]> Savannah Git Hosting - gnulib/maint-tools.git/commitdiff
gnulib-tool-tests: Fix the test-coreutils-1.sh test.
authorBruno Haible <bruno@clisp.org>
Thu, 21 Mar 2024 15:28:46 +0000 (16:28 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 21 Mar 2024 15:28:46 +0000 (16:28 +0100)
1957 files changed:
gnulib-tool-tests/import-tests/README
gnulib-tool-tests/import-tests/test-coreutils-1.out
gnulib-tool-tests/import-tests/test-coreutils-1.result/.gitignore~
gnulib-tool-tests/import-tests/test-coreutils-1.result/GNUmakefile [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/announce-gen [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/config.rpath [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/do-release-commit-and-tag [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/gendocs.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/git-version-gen [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/gitlog-to-changelog [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/gnu-web-doc-update [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/gnupload [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/update-copyright [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/useless-if-before-free [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/build-aux/vc-list-files [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/doc/gendocs_template [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/doc/gendocs_template_min [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/doc/parse-datetime.texi [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/_Noreturn.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/accept.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/arg-nonnull.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/array-mergesort.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/atoll.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/atomic-int-gnulib.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/atomic-int-posix.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/bench-digest.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/bench-md5.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/bench-sha1.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/bench-sha224.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/bench-sha256.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/bench-sha384.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/bench-sha512.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/bench.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/bind.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/c++defs.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/c-strcasestr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/c-strcasestr.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/c32rtomb.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/c32tob.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/connect.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/creat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/getrusage.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/glthread/thread.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/glthread/thread.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/glthread/yield.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/inet_pton.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/infinity.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/init.sh [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/ioctl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/listen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/locale.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/localename-table.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/localename-table.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/localename.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/localename.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/macros.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/minus-zero.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/nan.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/nap.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/null-ptr.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/perror.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/qemu.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/random.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/random_r.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/randomd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/randoml.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/sched_yield.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/setlocale.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/setsockopt.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/signature.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/signed-nan.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/signed-snan.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/sleep.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/snan.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/socket.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/str-two-way.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/strerror_r.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-accept.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-access.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-access.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-alignalloc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-alignasof.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-alignof.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-alloca-opt.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-areadlink-with-size.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-areadlink.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-areadlink.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-areadlinkat-with-size.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-areadlinkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-argmatch.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-argv-iter.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-arpa_inet.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-array-mergesort.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-assert.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-base32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-base64.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-binary-io.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-binary-io.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-bind.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-bitrotate.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-btoc32-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-btoc32-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-btoc32-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-btoc32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-btowc-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-btowc-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-btowc-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-btowc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-byteswap.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c-ctype.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c-strcase.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c-strcasecmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c-strcasestr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c-strncasecmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32_apply_type_test.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32_get_type_test.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isalnum.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isalnum.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isalpha.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isalpha.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isblank.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isblank.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32iscntrl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32iscntrl.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isdigit.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isgraph.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isgraph.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32islower.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32islower.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isprint.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isprint.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32ispunct.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32ispunct.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isspace.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isspace.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isupper.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isupper.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isxdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32isxdigit.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb-w32-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb-w32-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb-w32-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb-w32-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb-w32-6.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb-w32-7.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb-w32-8.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb-w32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32rtomb.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32tolower.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32tolower.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-c32width.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-calloc-gnu.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-canonicalize.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-chdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-chmod.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-chown.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-chown.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-cloexec.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-close.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-closein.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-closein.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-connect.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-copy-acl-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-copy-acl-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-copy-acl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-copy-acl.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-count-leading-zeros.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-creat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ctype.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-di-set.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-digest.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-dirent-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-dirent.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-dirfd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-dirname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-dup-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-dup.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-dup2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-dynarray.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-environ.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-errno.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-error.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-error.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-euidaccess.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-exclude.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-exclude1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-exclude2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-exclude3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-exclude4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-exclude5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-exclude6.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-exclude7.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-exclude8.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-explicit_bzero.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-faccessat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fchdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fchmodat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fchownat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fclose.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fcntl-h.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fcntl-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fcntl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fdatasync.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fdopen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fdopendir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fdutimensat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fflush.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fflush2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fflush2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fgetc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-file-has-acl-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-file-has-acl-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-file-has-acl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-file-has-acl.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-filenamecat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-filevercmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-float.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-h.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-w32-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-w32-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-w32-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-w32-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-w32-6.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-w32-7.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-w32-8.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch-w32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fnmatch.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fopen-gnu.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fopen-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fopen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fopen.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fpending.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fpending.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fprintf-posix.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fpurge.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fputc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fread.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freadahead.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freadahead.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freading.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freadptr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freadptr.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freadptr2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freadptr2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freadseek.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freadseek.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-free.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freopen-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-freopen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-frexp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-frexp.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-frexpl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseek.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseek.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseek2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseeko.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseeko.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseeko2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseeko3.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseeko3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseeko4.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseeko4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fseterr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fstat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fstatat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fsync.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftell.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftell.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftell2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftell3.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftello.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftello.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftello2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftello3.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftello4.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftello4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftruncate.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ftruncate.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-futimens.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-futimens.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-fwrite.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getaddrinfo.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getcwd-lgpl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getcwd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getcwd.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getdelim.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getdtablesize.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getgroups.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-gethostname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getline.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getloadavg.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getlogin.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getlogin.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getndelim2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getopt-gnu.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getopt-main.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getopt-posix.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getopt.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getopt_long.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getprogname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getrandom.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-getrusage.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-gettime-res.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-gettimeofday.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-hard-locale.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-hash.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-i-ring.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iconv-h.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iconv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ignore-value.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-inet_ntop.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-inet_pton.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-init.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ino-map.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-intprops.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-inttostr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-inttypes.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-ioctl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-isatty.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-isblank.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-isnand-nolibm.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-isnand.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-isnanf-nolibm.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-isnanf.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-isnanl-nolibm.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-isnanl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iswblank.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iswctype.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iswdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iswdigit.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iswpunct.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iswpunct.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iswxdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-iswxdigit.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-langinfo.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-largefile.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-lchmod.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-lchown.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-lchown.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-libgmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-limits-h.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-link.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-link.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-linkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-listen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-localcharset.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-locale.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-localeconv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-localename.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-lock.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-lseek.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-lseek.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-lstat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-lstat.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-lutimens.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-malloc-gnu.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-malloca.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-math.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-w32-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-w32-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-w32-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-w32-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-w32-6.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-w32-7.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-w32-8.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen-w32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrlen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-w32-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-w32-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-w32-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-w32-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-w32-6.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-w32-7.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-w32-8.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32-w32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtoc32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-w32-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-w32-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-w32-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-w32-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-w32-6.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-w32-7.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-w32-8.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc-w32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbrtowc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbscasecmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbscasecmp.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbschr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbschr.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsinit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsinit.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtoc32s-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtoc32s-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtoc32s-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtoc32s-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtoc32s-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtoc32s.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtowcs-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtowcs-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtowcs-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtowcs-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtowcs-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mbsrtowcs.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mcel.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-md5-buffer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-md5-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-memcasecmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-memchr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-memchr2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-memcoll.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-memrchr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-memset_explicit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mkdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mkdir.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mkdirat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mkfifo.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mkfifo.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mkfifoat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-mknod.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-nanosleep.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-netdb.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-netinet_in.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-nl_langinfo-mt.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-nl_langinfo1.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-nl_langinfo1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-nl_langinfo2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-nl_langinfo2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-nstrftime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-nullptr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-once.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-open.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-open.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-openat-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-openat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-parse-datetime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pathmax.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-perror.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-perror.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-perror2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-physmem.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pipe.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pipe2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-posix_memalign.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-posixtm.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-printf-frexp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-printf-frexpl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-printf-posix.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-printf-posix.output [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-priv-set.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pselect.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pthread-cond.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pthread-mutex.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pthread-thread.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pthread.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pthread_sigmask1.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-pthread_sigmask2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-qsort_r.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-quotearg-simple.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-quotearg.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-raise.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-random-mt.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-random.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-random_r.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-rawmemchr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-read-file.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-read.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-readlink.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-readlink.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-readlinkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-readtokens.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-readtokens.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-readutmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-realloc-gnu.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-reallocarray.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-regex.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-remove.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-rename.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-rename.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-renameat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-renameatu.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-rmdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-rmdir.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-rwlock1.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sameacls.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sched.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-scratch-buffer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-select-fd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-select-in.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-select-out.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-select-stdin.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-select.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-select.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-set-mode-acl-1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-set-mode-acl-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-set-mode-acl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-set-mode-acl.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-setenv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-setlocale1.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-setlocale1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-setlocale2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-setlocale2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-setlocale_null-mt-all.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-setlocale_null-mt-one.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-setlocale_null.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-setsockopt.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sha1-buffer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sha1-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sha256-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sha512-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sigaction.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-signal-h.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-signbit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sigprocmask.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sleep.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sm3-buffer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-snprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sockets.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-stat-time.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-stat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-stat.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-stdbool.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-stdckdint.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-stddef.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-stdint.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-stdio.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-stdlib.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-strerror.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-strerror_r.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-string.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-strnlen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-strsignal.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-strtoimax.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-strtoll.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-strtoull.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-strtoumax.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-symlink.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-symlink.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-symlinkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_ioctl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_random.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_resource.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_select.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_socket.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_stat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_time.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_types.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_uio.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_utsname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_wait.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-sys_wait.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-termios.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-thread_create.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-thread_self.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-time-h.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-time.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-timespec.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-tls.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-u64.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-uchar.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-uname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-unicodeio.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-unicodeio1.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-unicodeio2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-unicodeio3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-unistd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-unlink.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-unlink.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-unlinkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-unsetenv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-update-copyright.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-userspec.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-usleep.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-utime-h.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-utime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-utimens-common.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-utimens.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-utimens.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-utimensat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-vasnprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-vasprintf-posix.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-vasprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-vc-list-files-cvs.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-vc-list-files-git.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-verify-try.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-verify.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-verify.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-verror.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-verror.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-version-etc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-version-etc.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-vfprintf-posix.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-vfprintf-posix.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-vprintf-posix.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-vprintf-posix.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wchar.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb-w32-2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb-w32-3.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb-w32-4.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb-w32-5.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb-w32-6.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb-w32-7.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb-w32-8.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb-w32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcrtomb.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wctype-h.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wctype.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-wcwidth.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-write.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xalloc-die.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xalloc-die.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xfprintf-posix.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xprintf-posix.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xprintf-posix.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xstrtoimax.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xstrtoimax.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xstrtol.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xstrtol.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xstrtoul.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xstrtoumax.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xstrtoumax.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-xvasprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-year2038.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-yesno.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/test-yesno.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/thread-optim.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/timespec-add.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/timespec-sub.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/tmpfile.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unicase/test-mapping-part1.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unicase/test-mapping-part2.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unicase/test-uc_tolower.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_alnum.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_alpha.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_blank.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_cntrl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_digit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_graph.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_lower.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_print.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_punct.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_space.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_upper.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-ctype_xdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-predicate-part1.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unictype/test-predicate-part2.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-chr.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-cpy.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-pcpy.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-set.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-strcat.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-u32-chr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-u32-cpy.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-u32-pcpy.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-u32-set.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-u32-strcat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-u32-strlen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-u8-mbtoucr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/test-u8-uctomb.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/u-set.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/unistr/u32-set.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/uniwidth/test-uc_width.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/uniwidth/test-uc_width2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/uniwidth/test-uc_width2.sh [changed from symlink to file mode: 0755]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/usleep.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/vma-iter.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/vma-iter.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/w32sock.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/warn-on-use.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/wctob.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/wctomb-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/wctomb.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/gnulib-tests/zerosize-ptr.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/_Noreturn.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/access.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/acl-errno-valid.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/acl-internal.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/acl-internal.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/acl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/acl_entries.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/af_alg.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/af_alg.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/alignalloc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/alignalloc.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/alignof.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/alloca.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/alloca.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/allocator.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/allocator.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/anytostr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/areadlink-with-size.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/areadlink.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/areadlink.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/areadlinkat-with-size.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/areadlinkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/arg-nonnull.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/argmatch.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/argmatch.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/argv-iter.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/argv-iter.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/arpa_inet.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/asnprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/asprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/assert.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/assure.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/at-func.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/at-func2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/attribute.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/backup-find.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/backup-internal.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/backup-rename.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/backupfile.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/backupfile.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/base32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/base32.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/base64.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/base64.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/basename-lgpl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/basename-lgpl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/basename.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/binary-io.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/binary-io.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/bitrotate.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/bitrotate.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/boot-time-aux.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/btoc32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/btowc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/byteswap.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c++defs.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c-ctype.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c-ctype.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c-file-type.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c-strcase.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c-strcasecmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c-strcaseeq.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c-strncasecmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32_apply_type_test.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32_get_type_test.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32is-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32isalnum.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32isalpha.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32isblank.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32iscntrl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32isdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32isgraph.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32islower.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32isprint.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32ispunct.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32isspace.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32isupper.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32isxdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32to-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32tolower.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/c32width.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/calloc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/canon-host.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/canon-host.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/canonicalize.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/canonicalize.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/careadlinkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/careadlinkat.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/cdefs.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/chdir-long.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/chdir-long.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/chmod.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/chmodat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/chown.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/chownat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/cloexec.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/cloexec.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/close-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/close-stream.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/close.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/closedir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/closein.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/closein.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/closeout.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/closeout.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/copy-acl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/copy-file-range.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/count-leading-zeros.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/count-leading-zeros.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/creat-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ctype.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/cycle-check.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/cycle-check.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dev-ino.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/di-set.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/di-set.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirchownmod.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirchownmod.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirent--.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirent-private.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirent-safer.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirent.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirfd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirname-lgpl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dirname.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dtoastr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dtotimespec.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dup-safer-flag.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dup-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dup.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dup2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/dynarray.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/eloop-threshold.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/errno.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/error.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/error.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/euidaccess.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/exclude.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/exclude.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/exitfail.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/exitfail.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/explicit_bzero.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/faccessat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fchdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fchmodat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fchown-stub.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fchownat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fclose.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fcntl--.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fcntl-safer.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fcntl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fcntl.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fd-hook.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fd-hook.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fd-safer-flag.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fd-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fdatasync.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fdopen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fdopendir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fdutimensat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fflush.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/file-has-acl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/file-set.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/file-set.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/file-type.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/file-type.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fileblocks.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/filemode.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/filemode.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/filename.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/filenamecat-lgpl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/filenamecat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/filenamecat.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/filevercmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/filevercmp.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/flexmember.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/float+.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/float.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/float.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fnmatch.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fnmatch.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fnmatch_loop.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fopen-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fopen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fpending.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fpending.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fprintftime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fprintftime.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fpucw.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fpurge.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freadahead.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freadahead.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freading.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freading.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freadptr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freadptr.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freadseek.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freadseek.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/free.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freopen-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/freopen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/frexp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/frexpl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fseek.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fseeko.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fseterr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fseterr.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fstat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fstatat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fsusage.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fsusage.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fsync.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ftell.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ftello.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ftoastr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ftoastr.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ftruncate.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fts-cycle.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fts.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/fts_.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/full-read.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/full-read.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/full-write.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/full-write.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/futimens.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/gai_strerror.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/get-permissions.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getaddrinfo.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getcwd-lgpl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getcwd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getdelim.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getdtablesize.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getfilecon.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getgroups.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/gethostname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/gethrxtime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/gethrxtime.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getline.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getloadavg.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getlogin.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getndelim2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getndelim2.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getopt-cdefs.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getopt-core.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getopt-ext.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getopt-pfx-core.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getopt-pfx-ext.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getopt.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getopt.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getopt1.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getopt_int.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getpagesize.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getprogname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getprogname.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getrandom.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/gettext.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/gettime-res.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/gettime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/gettimeofday.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getugroups.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/getugroups.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/gl_openssl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/glthread/lock.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/glthread/lock.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/glthread/threadlib.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/glthread/tls.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/glthread/tls.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/group-member.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/hard-locale.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/hard-locale.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/hash-pjw.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/hash-pjw.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/hash-triple-simple.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/hash-triple.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/hash-triple.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/hash.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/hash.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/human.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/human.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/i-ring.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/i-ring.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ialloc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ialloc.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv_close.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv_open-aix.gperf [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv_open-hpux.gperf [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv_open-irix.gperf [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv_open-osf.gperf [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv_open-solaris.gperf [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv_open-zos.gperf [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iconv_open.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/idcache.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/idcache.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/idx.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ignore-value.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/imaxtostr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/inet_ntop.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ino-map.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ino-map.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/intprops-internal.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/intprops.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/inttostr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/inttostr.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/inttypes.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isapipe.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isapipe.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isatty.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isblank.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isnan.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isnand-nolibm.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isnand.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isnanf-nolibm.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isnanf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isnanl-nolibm.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/isnanl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iswblank.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iswctype-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iswctype.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iswdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iswpunct.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/iswxdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/itold.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/langinfo.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/lc-charset-dispatch.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/lc-charset-dispatch.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/lchmod.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/lchown.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/ldtoastr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/libc-config.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/limits.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/linebuffer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/linebuffer.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/link.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/linkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/localcharset.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/localcharset.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/locale.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/localeconv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/long-options.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/long-options.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/lseek.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/lstat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/dynarray-skeleton.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/dynarray.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/dynarray_at_failure.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/dynarray_emplace_enlarge.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/dynarray_finalize.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/dynarray_resize.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/dynarray_resize_clear.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/scratch_buffer.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/scratch_buffer_grow.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/scratch_buffer_grow_preserve.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloc/scratch_buffer_set_array_size.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloca.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/malloca.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/math.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/math.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbrlen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbrtoc32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbrtowc-impl-utf8.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbrtowc-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbrtowc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbscasecmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbschr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbsinit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbslen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbsrtoc32s-state.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbsrtoc32s.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbsrtowcs-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbsrtowcs-state.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbsrtowcs.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbswidth.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbswidth.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbszero.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbtowc-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbtowc-lock.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbtowc-lock.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mbtowc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mcel.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mcel.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/md5-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/md5.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/md5.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memcasecmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memcasecmp.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memchr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memchr.valgrind [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memchr2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memchr2.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memchr2.valgrind [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memcmp2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memcmp2.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memcoll.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memcoll.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mempcpy.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memrchr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/memset_explicit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mgetgroups.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mgetgroups.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mini-gmp-gnulib.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mini-gmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mini-gmp.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/minmax.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkancesdirs.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkancesdirs.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkdir-p.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkdir-p.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkdirat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkfifo.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkfifoat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mknod.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mknodat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkostemp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkstemp-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mkstemp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mktime-internal.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mktime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/modechange.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/modechange.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mountlist.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mountlist.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mpsort.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/mpsort.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/msvc-inval.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/msvc-inval.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/msvc-nothrow.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/msvc-nothrow.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/nanosleep.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/netdb.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/netinet_in.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/nl_langinfo-lock.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/nl_langinfo.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/nproc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/nproc.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/nstrftime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/obstack.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/obstack.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/offtostr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/open-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/open.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/openat-die.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/openat-priv.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/openat-proc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/openat-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/openat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/openat.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/opendir-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/opendir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/opendirat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/opendirat.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/parse-datetime.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/parse-datetime.y [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pathmax.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/physmem.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/physmem.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pipe-safer.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pipe.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pipe2.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/posix_memalign.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/posixtm.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/posixtm.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/posixver.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/posixver.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/printf-args.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/printf-args.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/printf-frexp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/printf-frexp.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/printf-frexpl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/printf-frexpl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/printf-parse.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/printf-parse.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/priv-set.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/priv-set.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/progname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/progname.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/propername-lite.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/propername.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pselect.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pthread-cond.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pthread-mutex.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pthread-thread.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pthread.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pthread_mutex_timedlock.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/pthread_sigmask.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/putenv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/qcopy-acl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/qset-acl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/qsort.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/qsort_r.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/quote.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/quotearg.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/quotearg.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/raise.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/rawmemchr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/rawmemchr.valgrind [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/read-file.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/read-file.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/read.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/readdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/readlink.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/readlinkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/readtokens.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/readtokens.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/readtokens0.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/readtokens0.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/readutmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/readutmp.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/realloc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/reallocarray.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/regcomp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/regex.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/regex.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/regex_internal.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/regex_internal.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/regexec.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/remove.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/rename.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/renameat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/renameatu.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/renameatu.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/rewinddir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/rmdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/root-uid.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/rpmatch.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/safe-read.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/safe-read.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/safe-write.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/safe-write.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/same-inode.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/same-inode.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/same.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/same.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/save-cwd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/save-cwd.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/savedir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/savedir.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/savewd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/savewd.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sched.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/scratch_buffer.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/se-context.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/se-context.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/se-label.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/se-label.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/se-selinux.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/se-selinux.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/secure_getenv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/select.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/selinux-at.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/selinux-at.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/set-acl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/set-permissions.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/setenv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/setlocale-lock.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/setlocale_null.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/setlocale_null.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/settime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sha1-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sha1.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sha1.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sha256-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sha256.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sha256.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sha512-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sha512.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sha512.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sig-handler.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sig-handler.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sig2str.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sig2str.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sigaction.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/siglist.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/signal.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/signbitd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/signbitf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/signbitl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sigprocmask.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/size_max.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sm3-stream.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sm3.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sm3.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/snprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sockets.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sockets.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stat-macros.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stat-size.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stat-time.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stat-time.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stat-w32.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stat-w32.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdarg.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdckdint.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stddef.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdint.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdio--.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdio-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdio-read.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdio-safer.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdio-write.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdio.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdlib--.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdlib-safer.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stdlib.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stpcpy.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/str-two-way.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strdup.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/streq.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strerror-override.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strerror-override.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strerror.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strftime.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/string.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/stripslash.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strnlen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strnlen1.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strnlen1.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strsignal.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strstr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strtoimax.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strtol.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strtoll.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strtoul.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strtoull.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/strtoumax.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/symlink.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/symlinkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys-limits.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_ioctl.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_random.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_resource.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_select.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_socket.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_socket.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_stat.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_time.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_types.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_uio.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_utsname.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/sys_wait.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/tempname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/tempname.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/termios.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/time-internal.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/time.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/time.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/time_r.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/time_rz.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/timegm.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/timespec.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/timespec.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/tmpdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/tmpdir.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/tzset.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/u64.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/u64.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/uchar.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/uinttostr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/umaxtostr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/uname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unicase.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unicase/simple-mapping.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unicase/tolower.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unicase/tolower.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unicodeio.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unicodeio.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/bitmap.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_alnum.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_alnum.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_alpha.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_alpha.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_blank.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_blank.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_cntrl.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_cntrl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_digit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_digit.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_graph.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_graph.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_lower.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_lower.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_print.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_print.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_punct.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_punct.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_space.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_space.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_upper.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_upper.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_xdigit.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unictype/ctype_xdigit.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/uninorm.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistd--.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistd-safer.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistd.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u-cpy.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u-pcpy.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u-strcat.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u-strlen.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u32-chr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u32-cpy.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u32-pcpy.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u32-strcat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u32-strlen.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u8-mbtoucr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u8-uctomb-aux.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unistr/u8-uctomb.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unitypes.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/uniwidth.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/uniwidth/cjk.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/uniwidth/width.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/uniwidth/width0.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/uniwidth/width2.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unlink.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unlinkat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unlinkdir.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unlinkdir.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unlocked-io.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/unsetenv.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/userspec.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/userspec.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/utime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/utime.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/utimecmp.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/utimecmp.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/utimens.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/utimens.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/utimensat.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/vasnprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/vasnprintf.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/vasprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/verify.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/verror.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/verror.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/version-etc-fsf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/version-etc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/version-etc.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/w32sock.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/warn-on-use.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wchar.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wcrtomb.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wctype-h.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wctype-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wctype.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wctype.in.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wcwidth.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-cond.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-cond.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-initguard.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-mutex.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-mutex.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-once.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-once.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-recmutex.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-recmutex.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-rwlock.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-rwlock.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-thread.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-thread.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-timedmutex.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-timedmutex.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-timedrecmutex.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-timedrecmutex.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-tls.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/windows-tls.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wmemchr-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wmemchr.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/wmempcpy.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/write-any-file.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/write-any-file.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/write.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xalignalloc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xalloc-die.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xalloc-oversized.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xalloc.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xasprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xbinary-io.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xbinary-io.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xgetaname-impl.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xgetcwd.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xgetcwd.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xgetgroups.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xgethostname.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xgethostname.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xmalloc.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xmemcoll.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xmemcoll.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xnanosleep.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xnanosleep.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xprintf.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xreadlink.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xreadlink.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xsize.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xsize.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtod.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtod.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtoimax.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtol-error.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtol-error.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtol.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtol.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtold.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtoul.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xstrtoumax.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xtime.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xtime.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xvasprintf.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/xvasprintf.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/yesno.c [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/lib/yesno.h [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/00gnulib.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/__inline.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/absolute-header.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/access.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/acl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/af_alg.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/alignalloc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/alloca.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/arpa_inet_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/assert.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/assert_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/atoll.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/autobuild.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/backupfile.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/base32.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/base64.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/bison.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/btowc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/build-to-host.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/builtin-expect.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/byteswap.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/c-bool.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/c32rtomb.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/calloc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/canon-host.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/canonicalize.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/chdir-long.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/chmod.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/chown.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/clock_time.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/close.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/closedir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/codeset.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/config-h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/configmake.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/copy-file-range.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/creat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/ctype_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/cycle-check.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/d-ino.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/d-type.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/dirent-safer.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/dirent_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/dirfd.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/double-slash-root.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/dup.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/dup2.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/eealloc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/environ.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/errno_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/error.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/error_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/euidaccess.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/explicit_bzero.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/exponentd.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/exponentf.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/exponentl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/extensions.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/extern-inline.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/faccessat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fchdir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fchmodat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fchownat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fclose.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fcntl-o.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fcntl-safer.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fcntl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fcntl_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fdatasync.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fdopen.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fdopendir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fflush.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fileblocks.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/filemode.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/filenamecat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/flexmember.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/float_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fnmatch.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fnmatch_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fopen.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fpending.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fpieee.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fpurge.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/freadahead.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/freading.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/freadptr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/freadseek.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/free.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/freopen.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/frexp.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/frexpl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fseek.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fseeko.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fseterr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fstat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fstatat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fstypename.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fsusage.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fsync.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/ftell.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/ftello.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/ftruncate.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/fts.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/futimens.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getaddrinfo.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getcwd-abort-bug.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getcwd-path-max.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getcwd.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getdelim.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getdtablesize.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getgroups.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/gethostname.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/gethrxtime.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getline.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getloadavg.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getlogin.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getndelim2.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getopt.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getpagesize.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getprogname.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getrandom.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getrusage.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/gettime.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/gettimeofday.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/getugroups.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/gl-openssl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/gnulib-common.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/gnulib-tool.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/group-member.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/host-cpu-c-abi.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/host-os.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/hostent.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/human.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/i-ring.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/iconv.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/iconv_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/iconv_open.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/idcache.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/include_next.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/inet_ntop.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/inet_pton.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/inline.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/intl-thread-locale.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/intlmacosx.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/intmax_t.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/inttostr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/inttypes.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/inttypes_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/ioctl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/isapipe.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/isatty.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/isblank.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/isnand.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/isnanf.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/isnanl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/iswblank.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/iswctype.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/iswdigit.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/iswpunct.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/iswxdigit.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/jm-winsz1.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/jm-winsz2.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/langinfo_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/largefile.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lchmod.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lchown.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lcmessage.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/ldexpl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lib-ignore.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lib-ld.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lib-link.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lib-prefix.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/libgmp.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/libunistring-base.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/limits-h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/link-follow.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/link.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/linkat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/localcharset.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/locale-fr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/locale-ja.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/locale-tr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/locale-zh.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/locale_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/localeconv.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/localename.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lock.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lseek.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/lstat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/malloc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/malloca.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/manywarnings-c++.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/manywarnings.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/math_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mbrlen.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mbrtoc32.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mbrtowc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mbsinit.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mbslen.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mbsrtowcs.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mbstate_t.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mbswidth.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mbtowc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/md5.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/memcasecmp.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/memchr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/memcoll.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mempcpy.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/memrchr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/memset_explicit.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mgetgroups.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/minmax.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mkancesdirs.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mkdir-p.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mkdir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mkdirat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mkfifo.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mkfifoat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mknod.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mkostemp.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mkstemp.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mktime.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mmap-anon.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mode_t.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/modechange.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mountlist.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/mpsort.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/msvc-inval.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/msvc-nothrow.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/multiarch.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/musl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/nan-mips.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/nanosleep.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/netdb_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/netinet_in_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/nl_langinfo.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/nocrash.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/nproc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/nstrftime.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/nullptr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/obstack.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/off_t.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/open-cloexec.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/open-slash.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/open.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/openat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/opendir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/parse-datetime.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pathmax.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/perl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/perror.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/physmem.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pid_t.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pipe.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pipe2.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/posix-shell.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/posix_memalign.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/posixtm.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/posixver.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/printf-frexp.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/printf-frexpl.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/printf.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/priv-set.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pselect.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pthread-cond.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pthread-mutex.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pthread-thread.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pthread_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pthread_mutex_timedlock.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pthread_rwlock_rdlock.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/pthread_sigmask.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/putenv.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/qsort_r.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/quote.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/quotearg.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/raise.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/random.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/random_r.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/rawmemchr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/read-file.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/read.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/readdir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/readlink.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/readlinkat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/readtokens.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/readutmp.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/realloc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/reallocarray.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/regex.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/remove.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/rename.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/renameat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/rewinddir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/rmdir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/rpmatch.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/safe-read.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/safe-write.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/same.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/save-cwd.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/savedir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/savewd.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sched_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sched_yield.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/secure_getenv.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/select.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/selinux-context-h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/selinux-label-h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/selinux-selinux-h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/semaphore.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/servent.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/setenv.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/setlocale.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/setlocale_null.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/settime.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sha1.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sha256.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sha512.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sig2str.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sigaction.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/signal_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/signalblocking.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/signbit.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/size_max.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sleep.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sm3.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/snan.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/snprintf.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/socketlib.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sockets.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/socklen.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sockpfaf.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/ssize_t.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stat-size.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stat-time.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/std-gnu11.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stdalign.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stdarg.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stddef_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stdint.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stdint_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stdio_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stdlib_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/stpcpy.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strdup.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strerror.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strerror_r.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/string_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strnlen.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strsignal.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strstr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strtoimax.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strtoll.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strtoull.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/strtoumax.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/symlink.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/symlinkat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_ioctl_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_random_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_resource_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_select_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_socket_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_stat_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_time_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_types_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_uio_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_utsname_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/sys_wait_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/systemd.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/tempname.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/termios_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/thread.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/threadlib.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/time.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/time_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/time_r.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/time_rz.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/timegm.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/timer_time.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/timespec.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/tls.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/tm_gmtoff.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/tmpdir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/tmpfile.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/tzset.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/uchar_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/uname.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/ungetc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unicase_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unicodeio.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unictype_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/uninorm_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unistd-safer.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unistd_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unlink-busy.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unlink.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unlinkat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unlinkdir.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/unlocked-io.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/userspec.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/usleep.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/utime.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/utime_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/utimecmp.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/utimens.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/utimensat.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/utimes.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/vararrays.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/vasnprintf.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/vasprintf-posix.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/vasprintf.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/version-etc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/vfprintf-posix.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/visibility.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/vprintf-posix.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/warn-on-use.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/warnings.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wchar_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wchar_t.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wcrtomb.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wctob.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wctomb.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wctype.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wctype_h.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wcwidth.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wint_t.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wmemchr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/wmempcpy.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/write-any-file.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/write.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/xalloc.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/xattr.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/xgetcwd.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/xnanosleep.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/xsize.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/xstrtod.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/xstrtol.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/xvasprintf.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/yesno.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/yield.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/m4/zzgnulib.m4 [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.result/maint.mk [changed from symlink to file mode: 0644]
gnulib-tool-tests/import-tests/test-coreutils-1.sh

index 6d87bb9935d3d2c3dfb11f62144455a94ca9b4f6..fa1b8f46328d0eb6118e514c8a22e7a35934fae4 100644 (file)
@@ -8,6 +8,7 @@ To add a new package:
 - Look at autogen.sh / bootstrap.conf / ... to find the gnulib-tool invocation.
   If there are several such invocations, each gives rise to a separate unit
   test; they share the package directory.
+- Remove --symlink or --hardlink options from these invocations.
 - Eliminate all files which are not relevant for gnulib-tool invocations.
   Typically this includes all .h and .c files that don't come from gnulib
   (although you need to watch out for --local-dir options!), all documentation
@@ -17,8 +18,8 @@ To add a new package:
     - *.m4
     - build-aux/*
     - all .h and .c files that were added by previous gnulib-tool invocations.
-- Look at all .gitignore files, and eliminate files and patterns that may match
-  files generated by gnulib-tool. In particular, eliminate '*~'.
+- Look at all .gitignore files, and eliminate file names and patterns that may
+  match files generated by gnulib-tool. In particular, eliminate '*~'.
 - Create a test-<PACKAGE>-<N>.sh file.
 - Run it: ./test-<PACKAGE>-<N>.sh
 - It will fail because there is no expected results. So, move them:
@@ -26,3 +27,13 @@ To add a new package:
   $ mv tmp<PID>-err test-<PACKAGE>-<N>.err
   $ mv tmp<PID>-result test-<PACKAGE>-<N>.result
   Verify the contents of test-<PACKAGE>-<N>.result.
+- Before committing the new package:
+  - Remove the tmp* files and directories (leftovers from past test failures).
+  - Add the new tests to test-all.sh.
+- To commit the new package:
+  1. Backup the .gitignore files in the test-<PACKAGE>-<N>.result directory.
+     Then remove these .gitignore files.
+  2. Commit the new files, including all files in the test-<PACKAGE>-<N>.result
+     directory.
+  3. Restore the .gitignore files in the test-<PACKAGE>-<N>.result directory.
+     Commit them in a separate commit.
index b32c9dcc9f895327b4b298adfc5a997e77942d98..5092359be0f575def59caaac8372a810143ed46b 100644 (file)
@@ -4901,6 +4901,22 @@ Creating m4/gnulib-comp.m4
 Creating lib/gnulib.mk
 Creating gnulib-tests/gnulib.mk
 Updating .gitignore (backup in .gitignore~)
+Creating build-aux/.gitignore
+Creating doc/.gitignore
+Creating gnulib-tests/.gitignore
+Creating gnulib-tests/glthread/.gitignore
+Creating gnulib-tests/unicase/.gitignore
+Creating gnulib-tests/unictype/.gitignore
+Creating gnulib-tests/unistr/.gitignore
+Creating gnulib-tests/uniwidth/.gitignore
+Creating lib/.gitignore
+Creating lib/glthread/.gitignore
+Creating lib/malloc/.gitignore
+Creating lib/unicase/.gitignore
+Creating lib/unictype/.gitignore
+Creating lib/unistr/.gitignore
+Creating lib/uniwidth/.gitignore
+Creating m4/.gitignore
 Finished.
 
 You may need to add #include directives for the following .h files.
index e8ae5984b6358c930d5363bdf67adc8d05267b36..bab280505aa1ba7fd94cacd7a9a81de584418fad 100644 (file)
@@ -19,7 +19,6 @@
 /THANKS-to-translators
 /aclocal.m4
 /autom4te.cache
-/build-aux/.gitignore
 /build-aux/ar-lib
 /build-aux/compile
 /build-aux/config.guess
deleted file mode 120000 (symlink)
index fd9113c7ee6e1c748dd6a1cf7ca80b70c9e8484a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/top/GNUmakefile
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0f469c8a45d8fcea994e0b293434844039081ff6
--- /dev/null
@@ -0,0 +1,127 @@
+# Having a separate GNUmakefile lets me 'include' the dynamically
+# generated rules created via cfg.mk (package-local configuration)
+# as well as maint.mk (generic maintainer rules).
+# This makefile is used only if you run GNU Make.
+# It is necessary if you want to build targets usually of interest
+# only to the maintainer.
+
+# Copyright (C) 2001, 2003, 2006-2024 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# If the user runs GNU make but has not yet run ./configure,
+# give them a diagnostic.
+_gl-Makefile := $(wildcard [M]akefile)
+ifneq ($(_gl-Makefile),)
+
+# Make tar archive easier to reproduce.
+export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner --sort=name
+
+# Allow the user to add to this in the Makefile.
+ALL_RECURSIVE_TARGETS =
+
+include Makefile
+
+# Some projects override e.g., _autoreconf here.
+-include $(srcdir)/cfg.mk
+
+# Allow cfg.mk to override these.
+_build-aux ?= build-aux
+_autoreconf ?= autoreconf -v
+
+include $(srcdir)/maint.mk
+
+# Ensure that $(VERSION) is up to date for dist-related targets, but not
+# for others: rerunning autoreconf and recompiling everything isn't cheap.
+_have-git-version-gen := \
+  $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
+ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
+  _is-dist-target ?= $(filter-out %clean, \
+    $(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS)))
+  _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
+  ifneq (,$(_is-dist-target)$(_is-install-target))
+    _curr-ver := $(shell cd $(srcdir)                          \
+                   && $(_build-aux)/git-version-gen            \
+                         .tarball-version                      \
+                         $(git-version-gen-tag-sed-script))
+    ifneq ($(_curr-ver),$(VERSION))
+      ifeq ($(_curr-ver),UNKNOWN)
+        $(info WARNING: unable to verify if $(VERSION) is the correct version)
+      else
+        ifneq (,$(_is-install-target))
+          # GNU Coding Standards state that 'make install' should not cause
+          # recompilation after 'make all'.  But as long as changing the version
+          # string alters config.h, the cost of having 'make all' always have an
+          # up-to-date version is prohibitive.  So, as a compromise, we merely
+          # warn when installing a version string that is out of date; the user
+          # should run 'autoreconf' (or something like 'make distcheck') to
+          # fix the version, 'make all' to propagate it, then 'make install'.
+          $(info WARNING: version string $(VERSION) is out of date;)
+          $(info run '$(MAKE) _version' to fix it)
+        else
+          $(info INFO: running autoreconf for new version string: $(_curr-ver))
+GNUmakefile: _version
+       touch GNUmakefile
+        endif
+      endif
+    endif
+  endif
+endif
+
+.PHONY: _version
+_version:
+       cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
+       $(MAKE) $(AM_MAKEFLAGS) Makefile
+
+else
+
+.DEFAULT_GOAL := abort-due-to-no-makefile
+srcdir = .
+
+# The package can override .DEFAULT_GOAL to run actions like autoreconf.
+-include ./cfg.mk
+
+# Allow cfg.mk to override these.
+_build-aux ?= build-aux
+_autoreconf ?= autoreconf -v
+
+include ./maint.mk
+
+ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
+$(MAKECMDGOALS): abort-due-to-no-makefile
+endif
+
+abort-due-to-no-makefile:
+       @echo There seems to be no Makefile in this directory.   1>&2
+       @echo "You must run ./configure before running '$(MAKE)'." 1>&2
+       @exit 1
+
+endif
+
+# Tell version 3.79 and up of GNU make to not build goals in this
+# directory in parallel, in case someone tries to build multiple
+# targets, and one of them can cause a recursive target to be invoked.
+
+# Only set this if Automake doesn't provide it.
+AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \
+  $(RECURSIVE_CLEAN_TARGETS:-recursive=) \
+  dist distcheck tags ctags
+
+ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS)
+
+ifneq ($(word 2, $(MAKECMDGOALS)), )
+ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), )
+.NOTPARALLEL:
+endif
+endif
deleted file mode 120000 (symlink)
index b6b9802a63e348fff3aeae4b4c3334e048a91490..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/announce-gen
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..f9e20129dda802077b5981e1eabc71dda6bdeec2
--- /dev/null
@@ -0,0 +1,704 @@
+#!/bin/sh
+#! -*-perl-*-
+
+# Generate a release announcement message.
+
+# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+#
+# Written by Jim Meyering
+
+# This is a prologue that allows to run a perl script as an executable
+# on systems that are compliant to a POSIX version before POSIX:2017.
+# On such systems, the usual invocation of an executable through execlp()
+# or execvp() fails with ENOEXEC if it is a script that does not start
+# with a #! line.  The script interpreter mentioned in the #! line has
+# to be /bin/sh, because on GuixSD systems that is the only program that
+# has a fixed file name.  The second line is essential for perl and is
+# also useful for editing this file in Emacs.  The next two lines below
+# are valid code in both sh and perl.  When executed by sh, they re-execute
+# the script through the perl program found in $PATH.  The '-x' option
+# is essential as well; without it, perl would re-execute the script
+# through /bin/sh.  When executed by perl, the next two lines are a no-op.
+eval 'exec perl -wSx "$0" "$@"'
+     if 0;
+
+my $VERSION = '2023-12-29 18:26'; # UTC
+# The definition above must lie within the first 8 lines in order
+# for the Emacs time-stamp write hook (at end) to update it.
+# If you change this file with Emacs, please let the write hook
+# do its job.  Otherwise, update this string manually.
+
+my $copyright_year = '2022';
+
+use strict;
+use Getopt::Long;
+use POSIX qw(strftime);
+
+(my $ME = $0) =~ s|.*/||;
+
+my %valid_release_types = map {$_ => 1} qw (alpha beta stable);
+my @archive_suffixes = qw (tar.gz tar.bz2 tar.lz tar.lzma tar.xz);
+my $srcdir = '.';
+
+sub usage ($)
+{
+  my ($exit_code) = @_;
+  my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
+  if ($exit_code != 0)
+    {
+      print $STREAM "Try '$ME --help' for more information.\n";
+    }
+  else
+    {
+      my @types = sort keys %valid_release_types;
+      print $STREAM <<EOF;
+Usage: $ME [OPTIONS]
+Generate an announcement message.  Run this from builddir.
+
+OPTIONS:
+
+These options must be specified:
+
+   --release-type=TYPE          TYPE must be one of @types
+   --package-name=PACKAGE_NAME
+   --previous-version=VER
+   --current-version=VER
+   --gpg-key-id=ID         The GnuPG ID of the key used to sign the tarballs
+   --url-directory=URL_DIR
+
+The following are optional:
+
+   --news=NEWS_FILE             include the NEWS section about this release
+                                from this NEWS_FILE; accumulates.
+   --srcdir=DIR                 where to find the NEWS_FILEs (default: $srcdir)
+   --bootstrap-tools=TOOL_LIST  a comma-separated list of tools, e.g.,
+                                autoconf,automake,bison,gnulib
+   --gnulib-version=VERSION     report VERSION as the gnulib version, where
+                                VERSION is the result of running git describe
+                                in the gnulib source directory.
+                                required if gnulib is in TOOL_LIST.
+   --gpg-key-email=EMAIL        The email address of the key used to
+                                sign the tarballs
+   --gpg-keyring-url=URL        URL pointing to keyring containing the key used
+                                to sign the tarballs
+   --no-print-checksums         do not emit SHA1 or SHA256 checksums
+   --archive-suffix=SUF         add SUF to the list of archive suffixes
+   --mail-headers=HEADERS       a space-separated list of mail headers, e.g.,
+                                To: x\@example.com Cc: y-announce\@example.com,...
+
+   --help             display this help and exit
+   --version          output version information and exit
+
+EOF
+    }
+  exit $exit_code;
+}
+
+
+=item C<%size> = C<sizes (@file)>
+
+Compute the sizes of the C<@file> and return them as a hash.  Return
+C<undef> if one of the computation failed.
+
+=cut
+
+sub sizes (@)
+{
+  my (@file) = @_;
+
+  my $fail = 0;
+  my %res;
+  foreach my $f (@file)
+    {
+      my $cmd = "du -h $f";
+      my $t = `$cmd`;
+      # FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
+      $@
+        and (warn "command failed: '$cmd'\n"), $fail = 1;
+      chomp $t;
+      $t =~ s/^\s*([\d.]+[MkK]).*/${1}B/;
+      $res{$f} = $t;
+    }
+  return $fail ? undef : %res;
+}
+
+=item C<print_locations ($title, \@url, \%size, @file)
+
+Print a section C<$title> dedicated to the list of <@file>, which
+sizes are stored in C<%size>, and which are available from the C<@url>.
+
+=cut
+
+sub print_locations ($\@\%@)
+{
+  my ($title, $url, $size, @file) = @_;
+  print "Here are the $title:\n";
+  foreach my $url (@{$url})
+    {
+      for my $file (@file)
+        {
+          print "  $url/$file";
+          print "   (", $$size{$file}, ")"
+            if exists $$size{$file};
+          print "\n";
+        }
+    }
+  print "\n";
+}
+
+=item C<print_checksums (@file)
+
+Print the SHA1 and SHA256 signature section for each C<@file>.
+
+=cut
+
+# This digest function omits the "=" padding that is required by cksum,
+# so add the 0..2 bytes of padding required for each of Digest's algorithms.
+sub digest_file_base64_wrap ($$)
+{
+  my ($file, $alg) = @_;
+  my $h = digest_file_base64($file, $alg);
+  $alg =~ tr{-}{}d;
+  my %pad = (MD5 => 2, SHA1 => 1, SHA256 => 1, SHA384 => 0, SHA512 => 2);
+  return $h . '=' x $pad{$alg};
+}
+
+sub print_checksums (@)
+{
+  my (@file) = @_;
+
+  print "Here are the SHA1 and SHA256 checksums:\n";
+  print "\n";
+
+  use Digest::file qw(digest_file_hex digest_file_base64);
+
+  foreach my $f (@file)
+    {
+      print '  ', digest_file_hex ($f, "SHA-1"), "  $f\n";
+      print '  ', digest_file_base64_wrap ($f, "SHA-256"), "  $f\n";
+    }
+  print "\nVerify the base64 SHA256 checksum with cksum -a sha256 --check\n";
+  print "from coreutils-9.2 or OpenBSD's cksum since 2007.\n\n";
+}
+
+=item C<print_news_deltas ($news_file, $prev_version, $curr_version)
+
+Print the section of the NEWS file C<$news_file> addressing changes
+between versions C<$prev_version> and C<$curr_version>.
+
+=cut
+
+sub print_news_deltas ($$$)
+{
+  my ($news_file, $prev_version, $curr_version) = @_;
+
+  my $news_name = $news_file;
+  $news_name =~ s|^\Q$srcdir\E/||;
+
+  print "\n$news_name\n\n";
+
+  # Print all lines from $news_file, starting with the first one
+  # that mentions $curr_version up to but not including
+  # the first occurrence of $prev_version.
+  my $in_items;
+
+  my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/;
+
+  my $found_news;
+  open NEWS, '<', $news_file
+    or die "$ME: $news_file: cannot open for reading: $!\n";
+  while (defined (my $line = <NEWS>))
+    {
+      if ( ! $in_items)
+        {
+          # Match lines like these:
+          # * Major changes in release 5.0.1:
+          # * Noteworthy changes in release 6.6 (2006-11-22) [stable]
+          $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
+            or next;
+          $in_items = 1;
+          print $line;
+        }
+      else
+        {
+          # This regexp must not match version numbers in NEWS items.
+          # For example, they might well say "introduced in 4.5.5",
+          # and we don't want that to match.
+          $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
+            and last;
+          print $line;
+          $line =~ /\S/
+            and $found_news = 1;
+        }
+    }
+  close NEWS;
+
+  $in_items
+    or die "$ME: $news_file: no matching lines for '$curr_version'\n";
+  $found_news
+    or die "$ME: $news_file: no news item found for '$curr_version'\n";
+}
+
+sub print_changelog_deltas ($$)
+{
+  my ($package_name, $prev_version) = @_;
+
+  # Print new ChangeLog entries.
+
+  # First find all CVS-controlled ChangeLog files.
+  use File::Find;
+  my @changelog;
+  find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS'
+                          and push @changelog, $File::Find::name}},
+        '.');
+
+  # If there are no ChangeLog files, we're done.
+  @changelog
+    or return;
+  my %changelog = map {$_ => 1} @changelog;
+
+  # Reorder the list of files so that if there are ChangeLog
+  # files in the specified directories, they're listed first,
+  # in this order:
+  my @dir = qw ( . src lib m4 config doc );
+
+  # A typical @changelog array might look like this:
+  # ./ChangeLog
+  # ./po/ChangeLog
+  # ./m4/ChangeLog
+  # ./lib/ChangeLog
+  # ./doc/ChangeLog
+  # ./config/ChangeLog
+  my @reordered;
+  foreach my $d (@dir)
+    {
+      my $dot_slash = $d eq '.' ? $d : "./$d";
+      my $target = "$dot_slash/ChangeLog";
+      delete $changelog{$target}
+        and push @reordered, $target;
+    }
+
+  # Append any remaining ChangeLog files.
+  push @reordered, sort keys %changelog;
+
+  # Remove leading './'.
+  @reordered = map { s!^\./!!; $_ } @reordered;
+
+  print "\nChangeLog entries:\n\n";
+  # print join ("\n", @reordered), "\n";
+
+  $prev_version =~ s/\./_/g;
+  my $prev_cvs_tag = "\U$package_name\E-$prev_version";
+
+  my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered";
+  open DIFF, '-|', $cmd
+    or die "$ME: cannot run '$cmd': $!\n";
+  # Print two types of lines, making minor changes:
+  # Lines starting with '+++ ', e.g.,
+  # +++ ChangeLog   22 Feb 2003 16:52:51 -0000      1.247
+  # and those starting with '+'.
+  # Don't print the others.
+  my $prev_printed_line_empty = 1;
+  while (defined (my $line = <DIFF>))
+    {
+      if ($line =~ /^\+\+\+ /)
+        {
+          my $separator = "*"x70 ."\n";
+          $line =~ s///;
+          $line =~ s/\s.*//;
+          $prev_printed_line_empty
+            or print "\n";
+          print $separator, $line, $separator;
+        }
+      elsif ($line =~ /^\+/)
+        {
+          $line =~ s///;
+          print $line;
+          $prev_printed_line_empty = ($line =~ /^$/);
+        }
+    }
+  close DIFF;
+
+  # The exit code should be 1.
+  # Allow in case there are no modified ChangeLog entries.
+  $? == 256 || $? == 128
+    or warn "warning: '$cmd' had unexpected exit code or signal ($?)\n";
+}
+
+sub get_tool_versions ($$)
+{
+  my ($tool_list, $gnulib_version) = @_;
+  @$tool_list
+    or return ();
+
+  my $fail;
+  my @tool_version_pair;
+  foreach my $t (@$tool_list)
+    {
+      if ($t eq 'gnulib')
+        {
+          push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
+          next;
+        }
+      # Assume that the last "word" on the first line of
+      # 'tool --version' output is the version string.
+      my ($first_line, undef) = split ("\n", `$t --version`);
+      if ($first_line =~ /.* (\d[\w.-]+)$/)
+        {
+          $t = ucfirst $t;
+          push @tool_version_pair, "$t $1";
+        }
+      else
+        {
+          defined $first_line
+            and $first_line = '';
+          warn "$t: unexpected --version output\n:$first_line";
+          $fail = 1;
+        }
+    }
+
+  $fail
+    and exit 1;
+
+  return @tool_version_pair;
+}
+
+# Print a more human-friendly representation of $SEC seconds.
+sub readable_interval0($)
+{
+  my $sec = shift;
+  $sec < 60 and return "$sec seconds";
+
+  my $min = int($sec / 60); $sec %= 60;
+  30 < $sec and $min++;
+  $min < 60 and return "$min minutes";
+
+  my $hr = int($min / 60); $min %= 60;
+  30 < $min and $hr++;
+  $hr < 24 and return "$hr hours";
+
+  my $day = int($hr / 24); $hr %= 24;
+  12 < $hr and $day++;
+  $day < 50 and return "$day days";
+
+  my $wk = int($day / 7); $day %= 7;
+  4 < $day and $wk++;
+  return "$wk weeks";
+}
+
+# Convert e.g., "1 weeks", to "1 week".
+sub readable_interval($)
+{
+  my $interval_str = shift;
+  my $i = readable_interval0 $interval_str;
+  $i =~ m{^1 \w+s$} and chop $i;
+  return $i;
+}
+
+{
+  # Use the C locale so that, for instance, "du" does not
+  # print "1,2" instead of "1.2", which would confuse our regexps.
+  $ENV{LC_ALL} = "C";
+
+  my $mail_headers;
+  my $release_type;
+  my $package_name;
+  my $prev_version;
+  my $curr_version;
+  my $gpg_key_id;
+  my @url_dir_list;
+  my @news_file;
+  my $bootstrap_tools;
+  my $gnulib_version;
+  my $print_checksums_p = 1;
+  my $gpg_key_email;
+  my $gpg_keyring_url;
+
+  # Reformat the warnings before displaying them.
+  local $SIG{__WARN__} = sub
+    {
+      my ($msg) = @_;
+      # Warnings from GetOptions.
+      $msg =~ s/Option (\w)/option --$1/;
+      warn "$ME: $msg";
+    };
+
+  GetOptions
+    (
+     'mail-headers=s'     => \$mail_headers,
+     'release-type=s'     => \$release_type,
+     'package-name=s'     => \$package_name,
+     'previous-version=s' => \$prev_version,
+     'current-version=s'  => \$curr_version,
+     'gpg-key-id=s'       => \$gpg_key_id,
+     'gpg-key-email=s'    => \$gpg_key_email,
+     'gpg-keyring-url=s'  => \$gpg_keyring_url,
+     'url-directory=s'    => \@url_dir_list,
+     'news=s'             => \@news_file,
+     'srcdir=s'           => \$srcdir,
+     'bootstrap-tools=s'  => \$bootstrap_tools,
+     'gnulib-version=s'   => \$gnulib_version,
+     'print-checksums!'   => \$print_checksums_p,
+     'archive-suffix=s'   => \@archive_suffixes,
+
+     help => sub { usage 0 },
+     version =>
+       sub
+       {
+         print "$ME version $VERSION\n";
+         print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
+         print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
+             . "This is free software: you are free to change and redistribute it.\n"
+             . "There is NO WARRANTY, to the extent permitted by law.\n";
+         print "\n";
+         my $author = "Jim Meyering";
+         print "Written by $author.\n";
+         exit
+       },
+    ) or usage 1;
+
+  my $fail = 0;
+  # Ensure that each required option is specified.
+  $release_type
+    or (warn "release type not specified\n"), $fail = 1;
+  $package_name
+    or (warn "package name not specified\n"), $fail = 1;
+  $prev_version
+    or (warn "previous version string not specified\n"), $fail = 1;
+  $curr_version
+    or (warn "current version string not specified\n"), $fail = 1;
+  $gpg_key_id
+    or (warn "GnuPG key ID not specified\n"), $fail = 1;
+  @url_dir_list
+    or (warn "URL directory name(s) not specified\n"), $fail = 1;
+
+  my @tool_list = split ',', $bootstrap_tools
+    if $bootstrap_tools;
+
+  grep (/^gnulib$/, @tool_list) && ! defined $gnulib_version
+    and (warn "when specifying gnulib as a tool, you must also specify\n"
+        . "--gnulib-version=V, where V is the result of running git describe\n"
+        . "in the gnulib source directory.\n"), $fail = 1;
+
+  ! grep (/^gnulib$/, @tool_list) && defined $gnulib_version
+    and (warn "with --gnulib-version=V you must use --bootstrap-tools=...\n"
+         . "including gnulib in that list"), $fail = 1;
+
+  !$release_type || exists $valid_release_types{$release_type}
+    or (warn "'$release_type': invalid release type\n"), $fail = 1;
+
+  @ARGV
+    and (warn "too many arguments:\n", join ("\n", @ARGV), "\n"),
+      $fail = 1;
+  $fail
+    and usage 1;
+
+  my $my_distdir = "$package_name-$curr_version";
+
+  my $xd = "$package_name-$prev_version-$curr_version.xdelta";
+
+  my @candidates = map { "$my_distdir.$_" } @archive_suffixes;
+  my @tarballs = grep {-f $_} @candidates;
+
+  @tarballs
+    or die "$ME: none of " . join(', ', @candidates) . " were found\n";
+  my @sizable = @tarballs;
+  -f $xd
+    and push @sizable, $xd;
+  my %size = sizes (@sizable);
+  %size
+    or exit 1;
+
+  my $headers = '';
+  if (defined $mail_headers)
+    {
+      ($headers = $mail_headers) =~ s/\s+(\S+:)/\n$1/g;
+      $headers .= "\n";
+    }
+
+  # The markup is escaped as <\# so that when this script is sent by
+  # mail (or part of a diff), Gnus is not triggered.
+  print <<EOF;
+
+${headers}Subject: $my_distdir released [$release_type]
+
+<\#secure method=pgpmime mode=sign>
+This is to announce $package_name-$curr_version, a $release_type release.
+
+FIXME: put comments here
+
+EOF
+
+  my $v0 = $prev_version;
+  my $v1 = $curr_version;
+
+  (my $first_name = `git config user.name|cut -d' ' -f1`)
+    =~ m{\S} or die "no name? set user.name in ~/.gitconfig\n";
+
+  chomp (my $n_ci = `git rev-list "v$v0..v$v1" | wc -l`);
+  chomp (my $n_p = `git shortlog "v$v0..v$v1" | grep -c '^[^ ]'`);
+
+  my $prev_release_date = `git log --pretty=%ct -1 "v$v0"`;
+  my $this_release_date = `git log --pretty=%ct -1 "v$v1"`;
+  my $n_seconds = $this_release_date - $prev_release_date;
+  my $time_since_prev = readable_interval $n_seconds;
+  my $names = `git shortlog "v$v0..v$v1"|perl -lne '/^(\\w.*):/ and print "  ".\$1'`;
+
+  print <<EOF;
+There have been $n_ci commits by $n_p people in the $time_since_prev since $v0.
+
+See the NEWS below for a brief summary.
+
+Thanks to everyone who has contributed!
+The following people contributed changes to this release:
+
+$names
+$first_name [on behalf of the $package_name maintainers]
+==================================================================
+
+Here is the GNU $package_name home page:
+    https://gnu.org/s/$package_name/
+
+For a summary of changes and contributors, see:
+  https://git.sv.gnu.org/gitweb/?p=$package_name.git;a=shortlog;h=v$v1
+or run this command from a git-cloned $package_name directory:
+  git shortlog v$v0..v$v1
+
+EOF
+
+  if (@url_dir_list == 1 && @tarballs == 1)
+    {
+      # When there's only one tarball and one URL, use a more concise form.
+      my $m = "$url_dir_list[0]/$tarballs[0]";
+      print "Here are the compressed sources and a GPG detached signature:\n"
+        . "  $m\n"
+        . "  $m.sig\n\n";
+    }
+  else
+    {
+      print_locations ("compressed sources", @url_dir_list, %size, @tarballs);
+      -f $xd
+        and print_locations ("xdelta diffs (useful? if so, "
+                             . "please tell bug-gnulib\@gnu.org)",
+                             @url_dir_list, %size, $xd);
+      my @sig_files = map { "$_.sig" } @tarballs;
+      print_locations ("GPG detached signatures", @url_dir_list, %size,
+                       @sig_files);
+    }
+
+  if ($url_dir_list[0] =~ "gnu\.org")
+    {
+      print "Use a mirror for higher download bandwidth:\n";
+      if (@tarballs == 1 && $url_dir_list[0] =~ m!https://ftp\.gnu\.org/gnu/!)
+        {
+          (my $m = "$url_dir_list[0]/$tarballs[0]")
+            =~ s!https://ftp\.gnu\.org/gnu/!https://ftpmirror\.gnu\.org/!;
+          print "  $m\n"
+              . "  $m.sig\n\n";
+
+        }
+      else
+        {
+          print "  https://www.gnu.org/order/ftp.html\n\n";
+        }
+    }
+
+  $print_checksums_p
+    and print_checksums (@sizable);
+
+  print <<EOF;
+Use a .sig file to verify that the corresponding file (without the
+.sig suffix) is intact.  First, be sure to download both the .sig file
+and the corresponding tarball.  Then, run a command like this:
+
+  gpg --verify $tarballs[0].sig
+
+EOF
+  my $gpg_fingerprint = `LC_ALL=C gpg --fingerprint $gpg_key_id | grep -v ^sub`;
+  if ($gpg_fingerprint =~ /^pub/)
+    {
+      chop $gpg_fingerprint;
+      $gpg_fingerprint =~ s/ \[expires:.*//mg;
+      $gpg_fingerprint =~ s/^uid           \[ultimate\]/uid  /mg;
+      $gpg_fingerprint =~ s/^/  /mg;
+      print<<EOF
+The signature should match the fingerprint of the following key:
+
+$gpg_fingerprint
+EOF
+    }
+  print <<EOF;
+If that command fails because you don't have the required public key,
+or that public key has expired, try the following commands to retrieve
+or refresh it, and then rerun the 'gpg --verify' command.
+EOF
+  if ($gpg_key_email) {
+    print <<EOF;
+
+  gpg --locate-external-key $gpg_key_email
+EOF
+    }
+  print <<EOF;
+
+  gpg --recv-keys $gpg_key_id
+EOF
+    if ($gpg_keyring_url) {
+      print <<EOF;
+
+  wget -q -O- '$gpg_keyring_url' | gpg --import -
+EOF
+      }
+  print <<EOF;
+
+As a last resort to find the key, you can try the official GNU
+keyring:
+
+  wget -q https://ftp.gnu.org/gnu/gnu-keyring.gpg
+  gpg --keyring gnu-keyring.gpg --verify $tarballs[0].sig
+EOF
+
+  my @tool_versions = get_tool_versions (\@tool_list, $gnulib_version);
+  @tool_versions
+    and print "\nThis release was bootstrapped with the following tools:",
+      join ('', map {"\n  $_"} @tool_versions), "\n";
+
+  print_news_deltas ($_, $prev_version, $curr_version)
+    foreach @news_file;
+
+  $release_type eq 'stable'
+    or print_changelog_deltas ($package_name, $prev_version);
+
+  exit 0;
+}
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## mode: perl
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## perl-extra-newline-before-brace: t
+## perl-merge-trailing-else: nil
+## eval: (add-hook 'before-save-hook 'time-stamp)
+## time-stamp-line-limit: 50
+## time-stamp-start: "my $VERSION = '"
+## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
+## time-stamp-time-zone: "UTC0"
+## time-stamp-end: "'; # UTC"
+## End:
deleted file mode 120000 (symlink)
index 8bbcd2c188acf9aebbe2c57aaa06df9682db228a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/config.rpath
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3893ddd86143aa490fc18dda6ead400ebb3f233f
--- /dev/null
@@ -0,0 +1,684 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+#   Copyright 1996-2024 Free Software Foundation, Inc.
+#   Taken from GNU libtool, 2001
+#   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+#   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.
+#
+# The first argument passed to this file is the canonical host specification,
+#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+#   than 256 bytes, otherwise the compiler driver will dump core. The only
+#   known workaround is to choose shorter directory names for the build
+#   directory and/or the installation directory.
+
+# All known linkers require a '.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's _LT_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+  wl='-Wl,'
+else
+  case "$host_os" in
+    aix*)
+      wl='-Wl,'
+      ;;
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      ;;
+    hpux9* | hpux10* | hpux11*)
+      wl='-Wl,'
+      ;;
+    irix5* | irix6* | nonstopux*)
+      wl='-Wl,'
+      ;;
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+        ecc*)
+          wl='-Wl,'
+          ;;
+        icc* | ifort*)
+          wl='-Wl,'
+          ;;
+        lf95*)
+          wl='-Wl,'
+          ;;
+        nagfor*)
+          wl='-Wl,-Wl,,'
+          ;;
+        pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+          wl='-Wl,'
+          ;;
+        ccc*)
+          wl='-Wl,'
+          ;;
+        xl* | bgxl* | bgf* | mpixl*)
+          wl='-Wl,'
+          ;;
+        como)
+          wl='-lopt='
+          ;;
+        *)
+          case `$CC -V 2>&1 | sed 5q` in
+            *Sun\ F* | *Sun*Fortran*)
+              wl=
+              ;;
+            *Sun\ C*)
+              wl='-Wl,'
+              ;;
+          esac
+          ;;
+      esac
+      ;;
+    newsos6)
+      ;;
+    *nto* | *qnx*)
+      ;;
+    osf3* | osf4* | osf5*)
+      wl='-Wl,'
+      ;;
+    rdos*)
+      ;;
+    solaris*)
+      case $cc_basename in
+        f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+          wl='-Qoption ld '
+          ;;
+        *)
+          wl='-Wl,'
+          ;;
+      esac
+      ;;
+    sunos4*)
+      wl='-Qoption ld '
+      ;;
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      wl='-Wl,'
+      ;;
+    sysv4*MP*)
+      ;;
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      wl='-Wl,'
+      ;;
+    unicos*)
+      wl='-Wl,'
+      ;;
+    uts4*)
+      ;;
+  esac
+fi
+
+# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # Set some defaults for GNU ld with shared library support. These
+  # are reset later if shared libraries are not supported. Putting them
+  # here allows them to be overridden if necessary.
+  # Unlike libtool, we use -rpath here, not --rpath, since the documented
+  # option of GNU ld is called -rpath, not --rpath.
+  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+  case "$host_os" in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+        ld_shlibs=no
+      fi
+      ;;
+    amigaos*)
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
+      ;;
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    cygwin* | mingw* | pw32* | cegcc*)
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    haiku*)
+      ;;
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      ;;
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    netbsd*)
+      ;;
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+        ld_shlibs=no
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+          ld_shlibs=no
+          ;;
+        *)
+          if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+            hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+          else
+            ld_shlibs=no
+          fi
+          ;;
+      esac
+      ;;
+    sunos4*)
+      hardcode_direct=yes
+      ;;
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+  esac
+  if test "$ld_shlibs" = no; then
+    hardcode_libdir_flag_spec=
+  fi
+else
+  case "$host_os" in
+    aix3*)
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes; then
+        # Neither direct hardcoding nor static linking is supported with a
+        # broken collect2.
+        hardcode_direct=unsupported
+      fi
+      ;;
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+        # On IA64, the linker does run time linking by default, so we don't
+        # have to do anything special.
+        aix_use_runtimelinking=no
+      else
+        aix_use_runtimelinking=no
+        # Test if we are trying to use run time linking or normal
+        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+        # need to do runtime linking.
+        case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+          for ld_flag in $LDFLAGS; do
+            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+              aix_use_runtimelinking=yes
+              break
+            fi
+          done
+          ;;
+        esac
+      fi
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      if test "$GCC" = yes; then
+        case $host_os in aix4.[012]|aix4.[012].*)
+          collect2name=`${CC} -print-prog-name=collect2`
+          if test -f "$collect2name" && \
+            strings "$collect2name" | grep resolve_lib_name >/dev/null
+          then
+            # We have reworked collect2
+            :
+          else
+            # We have old collect2
+            hardcode_direct=unsupported
+            hardcode_minus_L=yes
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_libdir_separator=
+          fi
+          ;;
+        esac
+      fi
+      # Begin _LT_AC_SYS_LIBPATH_AIX.
+      echo 'int main () { return 0; }' > conftest.c
+      ${CC} ${LDFLAGS} conftest.c -o conftest
+      aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      if test -z "$aix_libpath"; then
+        aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      fi
+      if test -z "$aix_libpath"; then
+        aix_libpath="/usr/lib:/lib"
+      fi
+      rm -f conftest.c conftest
+      # End _LT_AC_SYS_LIBPATH_AIX.
+      if test "$aix_use_runtimelinking" = yes; then
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+      else
+        if test "$host_cpu" = ia64; then
+          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+        else
+          hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        fi
+      fi
+      ;;
+    amigaos*)
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
+      ;;
+    bsdi[45]*)
+      ;;
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      libext=lib
+      ;;
+    darwin* | rhapsody*)
+      hardcode_direct=no
+      if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    dgux*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    freebsd2.[01]*)
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    freebsd* | dragonfly* | midnightbsd*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    hpux9*)
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      ;;
+    hpux10*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        hardcode_direct=yes
+        # hardcode_minus_L: Not really in the search PATH,
+        # but as the default location of the library.
+        hardcode_minus_L=yes
+      fi
+      ;;
+    hpux11*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct=no
+            ;;
+          *)
+            hardcode_direct=yes
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+        esac
+      fi
+      ;;
+    irix5* | irix6* | nonstopux*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    netbsd*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    newsos6)
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    *nto* | *qnx*)
+      ;;
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+        hardcode_direct=yes
+        if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+          hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        else
+          case "$host_os" in
+            openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+              hardcode_libdir_flag_spec='-R$libdir'
+              ;;
+            *)
+              hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+              ;;
+          esac
+        fi
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      ;;
+    osf3*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    osf4* | osf5*)
+      if test "$GCC" = yes; then
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+        # Both cc and cxx compiler support -rpath directly
+        hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+    solaris*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      ;;
+    sunos4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    sysv4)
+      case $host_vendor in
+        sni)
+          hardcode_direct=yes # is this really true???
+          ;;
+        siemens)
+          hardcode_direct=no
+          ;;
+        motorola)
+          hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+          ;;
+      esac
+      ;;
+    sysv4.3*)
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+        ld_shlibs=yes
+      fi
+      ;;
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      ;;
+    sysv5* | sco3.2v5* | sco5v6*)
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      ;;
+    uts4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    *)
+      ld_shlibs=no
+      ;;
+  esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
+# only about the one the linker finds when passed -lNAME. This is the last
+# element of library_names_spec in libtool.m4, or possibly two of them if the
+# linker has special search rules.
+library_names_spec=      # the last element of library_names_spec in libtool.m4
+libname_spec='lib$name'
+case "$host_os" in
+  aix3*)
+    library_names_spec='$libname.a'
+    ;;
+  aix[4-9]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  amigaos*)
+    case "$host_cpu" in
+      powerpc*)
+        library_names_spec='$libname$shrext' ;;
+      m68k)
+        library_names_spec='$libname.a' ;;
+    esac
+    ;;
+  beos*)
+    library_names_spec='$libname$shrext'
+    ;;
+  bsdi[45]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  cygwin* | mingw* | pw32* | cegcc*)
+    shrext=.dll
+    library_names_spec='$libname.dll.a $libname.lib'
+    ;;
+  darwin* | rhapsody*)
+    shrext=.dylib
+    library_names_spec='$libname$shrext'
+    ;;
+  dgux*)
+    library_names_spec='$libname$shrext'
+    ;;
+  freebsd[23].*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  freebsd* | dragonfly* | midnightbsd*)
+    library_names_spec='$libname$shrext'
+    ;;
+  gnu*)
+    library_names_spec='$libname$shrext'
+    ;;
+  haiku*)
+    library_names_spec='$libname$shrext'
+    ;;
+  hpux9* | hpux10* | hpux11*)
+    case $host_cpu in
+      ia64*)
+        shrext=.so
+        ;;
+      hppa*64*)
+        shrext=.sl
+        ;;
+      *)
+        shrext=.sl
+        ;;
+    esac
+    library_names_spec='$libname$shrext'
+    ;;
+  interix[3-9]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  irix5* | irix6* | nonstopux*)
+    library_names_spec='$libname$shrext'
+    case "$host_os" in
+      irix5* | nonstopux*)
+        libsuff= shlibsuff=
+        ;;
+      *)
+        case $LD in
+          *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+          *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+          *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+          *) libsuff= shlibsuff= ;;
+        esac
+        ;;
+    esac
+    ;;
+  linux*oldld* | linux*aout* | linux*coff*)
+    ;;
+  linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  knetbsd*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  netbsd*)
+    library_names_spec='$libname$shrext'
+    ;;
+  newsos6)
+    library_names_spec='$libname$shrext'
+    ;;
+  *nto* | *qnx*)
+    library_names_spec='$libname$shrext'
+    ;;
+  openbsd*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  os2*)
+    libname_spec='$name'
+    shrext=.dll
+    library_names_spec='$libname.a'
+    ;;
+  osf3* | osf4* | osf5*)
+    library_names_spec='$libname$shrext'
+    ;;
+  rdos*)
+    ;;
+  solaris*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sunos4*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  sysv4 | sysv4.3*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv4*MP*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+    library_names_spec='$libname$shrext'
+    ;;
+  tpf*)
+    library_names_spec='$libname$shrext'
+    ;;
+  uts4*)
+    library_names_spec='$libname$shrext'
+    ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Format of library name prefix.
+libname_spec="$escaped_libname_spec"
+
+# Library names that the linker finds when passed -lNAME.
+library_names_spec="$escaped_library_names_spec"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
deleted file mode 120000 (symlink)
index 251d634d7d7716a41658033e2d59035967ae9710..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/do-release-commit-and-tag
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..6876fe040fc3916402b9f48630a0d6d8a5ee1e71
--- /dev/null
@@ -0,0 +1,179 @@
+#!/bin/sh
+# In a git/autoconf/automake-enabled project with a NEWS file and a version-
+# controlled .prev-version file, automate the procedure by which we record
+# the date, release-type and version string in the NEWS file.  That commit
+# will serve to identify the release, so apply a signed tag to it as well.
+VERSION=2018-03-07.03 # UTC
+
+# Note: this is a bash script (could be zsh or dash)
+
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Written by Jim Meyering
+
+ME=$(basename "$0")
+warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
+die() { warn "$*"; exit 1; }
+
+help()
+{
+  cat <<EOF
+Usage: $ME [OPTION...] VERSION RELEASE_TYPE
+
+Run this script from top_srcdir to perform the final pre-release NEWS
+update in which the date, release-type and version string are
+recorded.  Commit that result with a log entry marking the release,
+and apply a signed tag.  Run it from your project's top-level
+directory.
+
+Requirements:
+- you use git for version-control
+- a version-controlled .prev-version file
+- a NEWS file, with line 3 identical to this:
+$noteworthy_stub
+
+Options:
+  --branch=BRANCH     set release branch (default: $branch)
+  -C, --builddir=DIR  location of (configured) Makefile (default: $builddir)
+  --help              print this help, then exit
+  --version           print version number, then exit
+
+EXAMPLE:
+To update NEWS and tag the beta 8.1 release of coreutils, I would run this:
+
+  $ME 8.1 beta
+
+Report bugs and patches to <bug-gnulib@gnu.org>.
+EOF
+  exit
+}
+
+version()
+{
+  year=$(echo "$VERSION" | sed 's/[^0-9].*//')
+  cat <<EOF
+$ME $VERSION
+Copyright (C) $year Free Software Foundation, Inc,
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+EOF
+  exit
+}
+
+## ------ ##
+## Main.  ##
+## ------ ##
+
+# Constants.
+noteworthy='* Noteworthy changes in release'
+noteworthy_stub="$noteworthy ?.? (????-??-??) [?]"
+
+# Variables.
+branch=$(git branch | sed -ne '/^\* /{s///;p;q;}')
+builddir=.
+
+while test $# != 0
+do
+  # Handle --option=value by splitting apart and putting back on argv.
+  case $1 in
+    --*=*)
+      opt=$(echo "$1" | sed -e 's/=.*//')
+      val=$(echo "$1" | sed -e 's/[^=]*=//')
+      shift
+      set dummy "$opt" "$val" "$@"; shift
+      ;;
+  esac
+
+  case $1 in
+    --help|--version) ${1#--};;
+    --branch) shift; branch=$1; shift ;;
+    -C|--builddir) shift; builddir=$1; shift ;;
+    --*) die "unrecognized option: $1";;
+    *) break;;
+  esac
+done
+
+test $# = 2 \
+  || die "Usage: $ME [OPTION...] VERSION TYPE"
+
+ver=$1
+type=$2
+
+
+## ---------------------- ##
+## First, sanity checks.  ##
+## ---------------------- ##
+
+# Verify that $ver looks like a version number, and...
+echo "$ver"|grep -E '^[0-9][0-9.]*[0-9]$' > /dev/null \
+  || die "invalid version: $ver"
+prev_ver=$(cat .prev-version) \
+  || die 'failed to determine previous version number from .prev-version'
+
+# Verify that $ver is sensible (> .prev-version).
+case $(printf "%s\n%s\n" "$prev_ver" "$ver"|sort -V -u|tr '\n' ':') in
+  "$prev_ver:$ver:") ;;
+  *) die "invalid version: $ver (<= $prev_ver)";;
+esac
+
+case $type in
+  alpha|beta|stable) ;;
+  *) die "invalid release type: $type";;
+esac
+
+# No local modifications allowed.
+case $(git diff-index --name-only HEAD) in
+  '') ;;
+  *) die 'this tree is dirty; commit your changes first';;
+esac
+
+# Ensure the current branch name is correct:
+curr_br=$(git rev-parse --symbolic-full-name HEAD)
+test "$curr_br" = "refs/heads/$branch" || die not on branch $branch
+
+# Extract package name from Makefile.
+Makefile=$builddir/Makefile
+pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' "$Makefile") \
+  || die "failed to determine package name from $Makefile"
+
+# Check that line 3 of NEWS is the stub line about to be replaced.
+test "$(sed -n 3p NEWS)" = "$noteworthy_stub" \
+  || die "line 3 of NEWS must be exactly '$noteworthy_stub'"
+
+## --------------- ##
+## Then, changes.  ##
+## --------------- ##
+
+# Update NEWS to have today's date, plus desired version number and $type.
+perl -MPOSIX -ni -e 'my $today = strftime "%F", localtime time;' \
+ -e 'my ($type, $ver) = qw('"$type $ver"');' \
+ -e 'my $pfx = "'"$noteworthy"'";' \
+ -e 'print $.==3 ? "$pfx $ver ($today) [$type]\n" : $_' \
+     NEWS || die 'failed to update NEWS'
+
+printf "version %s\n\n* NEWS: Record release date.\n" "$ver" \
+    | git commit -F -  -a || die 'git commit failed'
+git tag -s -m "$pkg $ver" v$ver HEAD || die 'git tag failed'
+
+# Local variables:
+# indent-tabs-mode: nil
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "VERSION="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: " # UTC"
+# End:
deleted file mode 120000 (symlink)
index e9e15c6a24401726553ee2f981c9e9265ae31adc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/gendocs.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b0433c798f43238ec519eaf46ac411c003c29d62
--- /dev/null
@@ -0,0 +1,524 @@
+#!/bin/sh -e
+# gendocs.sh -- generate a GNU manual in many formats.  This script is
+#   mentioned in maintain.texi.  See the help message below for usage details.
+
+scriptversion=2024-01-01.00
+
+# Copyright 2003-2024 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+#
+# Original author: Mohit Agarwal.
+# Send bug reports and any other correspondence to bug-gnulib@gnu.org.
+#
+# The latest version of this script, and the companion template, is
+# available from the Gnulib repository:
+#
+# https://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh
+# https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template
+
+# TODO:
+# - image importing was only implemented for HTML generated by
+#   makeinfo.  But it should be simple enough to adjust.
+# - images are not imported in the source tarball.  All the needed
+#   formats (PDF, PNG, etc.) should be included.
+
+prog=`basename "$0"`
+srcdir=`pwd`
+
+scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh"
+templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template"
+
+: "${SETLANG="env LANG= LC_TIME= LC_MESSAGES= LC_ALL= LANGUAGE="}"
+: "${MAKEINFO="makeinfo"}"
+: "${TEXI2DVI="texi2dvi"}"
+: "${DOCBOOK2HTML="docbook2html"}"
+: "${DOCBOOK2PDF="docbook2pdf"}"
+: "${DOCBOOK2TXT="docbook2txt"}"
+: "${GENDOCS_TEMPLATE_DIR="."}"
+: "${PERL="perl"}"
+: "${TEXI2HTML="texi2html"}"
+unset CDPATH
+unset use_texi2html
+
+MANUAL_TITLE=
+PACKAGE=
+EMAIL=webmasters@gnu.org  # please override with --email
+commonarg= # passed to all makeinfo/texi2html invocations.
+dirargs=   # passed to all tools (-I dir).
+dirs=      # -I directories.
+htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
+default_htmlarg=true
+infoarg=--no-split
+generate_ascii=true
+generate_html=true
+generate_info=true
+generate_tex=true
+outdir=manual
+source_extra=
+split=node
+srcfile=
+texarg="-t @finalout"
+
+version="gendocs.sh $scriptversion
+
+Copyright 2024 Free Software Foundation, Inc.
+There is NO warranty.  You may redistribute this software
+under the terms of the GNU General Public License.
+For more information about these matters, see the files named COPYING."
+
+usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE
+
+Generate output in various formats from PACKAGE.texinfo (or .texi or
+.txi) source.  See the GNU Maintainers document for a more extensive
+discussion:
+  https://www.gnu.org/prep/maintain_toc.html
+
+Options:
+  --email ADR use ADR as contact in generated web pages; always give this.
+
+  -s SRCFILE   read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
+  -o OUTDIR    write files into OUTDIR, instead of manual/.
+  -I DIR       append DIR to the Texinfo search path.
+  --common ARG pass ARG in all invocations.
+  --html ARG   pass ARG to makeinfo or texi2html for HTML targets,
+                 instead of '$htmlarg'.
+  --info ARG   pass ARG to makeinfo for Info, instead of --no-split.
+  --no-ascii   skip generating the plain text output.
+  --no-html    skip generating the html output.
+  --no-info    skip generating the info output.
+  --no-tex     skip generating the dvi and pdf output.
+  --source ARG include ARG in tar archive of sources.
+  --split HOW  make split HTML by node, section, chapter; default node.
+  --tex ARG    pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout.
+
+  --texi2html  use texi2html to make HTML target, with all split versions.
+  --docbook    convert through DocBook too (xml, txt, html, pdf).
+
+  --help       display this help and exit successfully.
+  --version    display version information and exit successfully.
+
+Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\"
+
+Typical sequence:
+  cd PACKAGESOURCE/doc
+  wget \"$scripturl\"
+  wget \"$templateurl\"
+  $prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\"
+
+Output will be in a new subdirectory \"manual\" (by default;
+use -o OUTDIR to override).  Move all the new files into your web CVS
+tree, as explained in the Web Pages node of maintain.texi.
+
+Please use the --email ADDRESS option so your own bug-reporting
+address will be used in the generated HTML pages.
+
+MANUAL-TITLE is included as part of the HTML <title> of the overall
+manual/index.html file.  It should include the name of the package being
+documented.  manual/index.html is created by substitution from the file
+$GENDOCS_TEMPLATE_DIR/gendocs_template.  (Feel free to modify the
+generic template for your own purposes.)
+
+If you have several manuals, you'll need to run this script several
+times with different MANUAL values, specifying a different output
+directory with -o each time.  Then write (by hand) an overall index.html
+with links to them all.
+
+If a manual's Texinfo sources are spread across several directories,
+first copy or symlink all Texinfo sources into a single directory.
+(Part of the script's work is to make a tar.gz of the sources.)
+
+As implied above, by default monolithic Info files are generated.
+If you want split Info, or other Info options, use --info to override.
+
+You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML,
+and PERL to control the programs that get executed, and
+GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
+looked for.  With --docbook, the environment variables DOCBOOK2HTML,
+DOCBOOK2PDF, and DOCBOOK2TXT are also consulted.
+
+By default, makeinfo and texi2dvi are run in the default (English)
+locale, since that's the language of most Texinfo manuals.  If you
+happen to have a non-English manual and non-English web site, see the
+SETLANG setting in the source.
+
+Email bug reports or enhancement requests to bug-gnulib@gnu.org.
+"
+
+while test $# -gt 0; do
+  case $1 in
+    -s)          shift; srcfile=$1;;
+    -o)          shift; outdir=$1;;
+    -I)          shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";;
+    --common)    shift; commonarg=$1;;
+    --docbook)   docbook=yes;;
+    --email)     shift; EMAIL=$1;;
+    --html)      shift; default_htmlarg=false; htmlarg=$1;;
+    --info)      shift; infoarg=$1;;
+    --no-ascii)  generate_ascii=false;;
+    --no-html)   generate_ascii=false;;
+    --no-info)   generate_info=false;;
+    --no-tex)    generate_tex=false;;
+    --source)    shift; source_extra=$1;;
+    --split)     shift; split=$1;;
+    --tex)       shift; texarg=$1;;
+    --texi2html) use_texi2html=1;;
+
+    --help)      echo "$usage"; exit 0;;
+    --version)   echo "$version"; exit 0;;
+    -*)
+      echo "$0: Unknown option \`$1'." >&2
+      echo "$0: Try \`--help' for more information." >&2
+      exit 1;;
+    *)
+      if test -z "$PACKAGE"; then
+        PACKAGE=$1
+      elif test -z "$MANUAL_TITLE"; then
+        MANUAL_TITLE=$1
+      else
+        echo "$0: extra non-option argument \`$1'." >&2
+        exit 1
+      fi;;
+  esac
+  shift
+done
+
+# makeinfo uses the dirargs, but texi2dvi doesn't.
+commonarg=" $dirargs $commonarg"
+
+# For most of the following, the base name is just $PACKAGE
+base=$PACKAGE
+
+if $default_htmlarg && test -n "$use_texi2html"; then
+  # The legacy texi2html doesn't support TOP_NODE_UP_URL
+  htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css"
+fi
+
+if test -n "$srcfile"; then
+  # but here, we use the basename of $srcfile
+  base=`basename "$srcfile"`
+  case $base in
+    *.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;;
+  esac
+  PACKAGE=$base
+elif test -s "$srcdir/$PACKAGE.texinfo"; then
+  srcfile=$srcdir/$PACKAGE.texinfo
+elif test -s "$srcdir/$PACKAGE.texi"; then
+  srcfile=$srcdir/$PACKAGE.texi
+elif test -s "$srcdir/$PACKAGE.txi"; then
+  srcfile=$srcdir/$PACKAGE.txi
+else
+  echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2
+  exit 1
+fi
+
+if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then
+  echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2
+  echo "$0: it is available from $templateurl." >&2
+  exit 1
+fi
+
+# Function to return size of $1 in something resembling kilobytes.
+calcsize()
+{
+  size=`ls -ksl $1 | awk '{print $1}'`
+  echo $size
+}
+
+# copy_images OUTDIR HTML-FILE...
+# -------------------------------
+# Copy all the images needed by the HTML-FILEs into OUTDIR.
+# Look for them in . and the -I directories; this is simpler than what
+# makeinfo supports with -I, but hopefully it will suffice.
+copy_images()
+{
+  local odir
+  odir=$1
+  shift
+  $PERL -n -e "
+BEGIN {
+  \$me = '$prog';
+  \$odir = '$odir';
+  @dirs = qw(. $dirs);
+}
+" -e '
+/<img src="(.*?)"/g && ++$need{$1};
+
+END {
+  #print "$me: @{[keys %need]}\n";  # for debugging, show images found.
+  FILE: for my $f (keys %need) {
+    for my $d (@dirs) {
+      if (-f "$d/$f") {
+        use File::Basename;
+        my $dest = dirname ("$odir/$f");
+        #
+        use File::Path;
+        -d $dest || mkpath ($dest)
+          || die "$me: cannot mkdir $dest: $!\n";
+        #
+        use File::Copy;
+        copy ("$d/$f", $dest)
+          || die "$me: cannot copy $d/$f to $dest: $!\n";
+        next FILE;
+      }
+    }
+    die "$me: $ARGV: cannot find image $f\n";
+  }
+}
+' -- "$@" || exit 1
+}
+
+case $outdir in
+  /*) abs_outdir=$outdir;;
+  *)  abs_outdir=$srcdir/$outdir;;
+esac
+
+echo "Making output for $srcfile"
+echo " in `pwd`"
+mkdir -p "$outdir/"
+
+# \f
+if $generate_info; then
+  cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
+  echo "Generating info... ($cmd)"
+  rm -f $PACKAGE.info* # get rid of any strays
+  eval "$cmd"
+  tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
+  ls -l "$outdir/$PACKAGE.info.tar.gz"
+  info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
+  # do not mv the info files, there's no point in having them available
+  # separately on the web.
+fi  # end info
+
+# \f
+if $generate_tex; then
+  cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\""
+  printf "\nGenerating dvi... (%s)\n" "$cmd"
+  eval "$cmd"
+  # compress/finish dvi:
+  gzip -f -9 $PACKAGE.dvi
+  dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
+  mv $PACKAGE.dvi.gz "$outdir/"
+  ls -l "$outdir/$PACKAGE.dvi.gz"
+
+  cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\""
+  printf "\nGenerating pdf... (%s)\n" "$cmd"
+  eval "$cmd"
+  pdf_size=`calcsize $PACKAGE.pdf`
+  mv $PACKAGE.pdf "$outdir/"
+  ls -l "$outdir/$PACKAGE.pdf"
+fi # end tex (dvi + pdf)
+
+# \f
+if $generate_ascii; then
+  opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
+  cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
+  printf "\nGenerating ascii... (%s)\n" "$cmd"
+  eval "$cmd"
+  ascii_size=`calcsize $PACKAGE.txt`
+  gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
+  ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
+  mv $PACKAGE.txt "$outdir/"
+  ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
+fi
+
+# \f
+
+if $generate_html; then
+# Split HTML at level $1.  Used for texi2html.
+html_split()
+{
+  opt="--split=$1 --node-files $commonarg $htmlarg"
+  cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
+  printf "\nGenerating html by %s... (%s)\n" "$1" "$cmd"
+  eval "$cmd"
+  split_html_dir=$PACKAGE.html
+  (
+    cd ${split_html_dir} || exit 1
+    ln -sf ${PACKAGE}.html index.html
+    tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
+  )
+  eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
+  rm -f "$outdir"/html_$1/*.html
+  mkdir -p "$outdir/html_$1/"
+  mv ${split_html_dir}/*.html "$outdir/html_$1/"
+  rmdir ${split_html_dir}
+}
+
+if test -z "$use_texi2html"; then
+  opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
+  cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
+  printf "\nGenerating monolithic html... (%s)\n" "$cmd"
+  rm -rf $PACKAGE.html  # in case a directory is left over
+  eval "$cmd"
+  html_mono_size=`calcsize $PACKAGE.html`
+  gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
+  html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
+  copy_images "$outdir/" $PACKAGE.html
+  mv $PACKAGE.html "$outdir/"
+  ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
+
+  # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option,
+  # it just always split by node.  So if we're splitting by node anyway,
+  # leave it out.
+  if test "x$split" = xnode; then
+    split_arg=
+  else
+    split_arg=--split=$split
+  fi
+  #
+  opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
+  cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
+  printf "\nGenerating html by %s... (%s)\n" "$split" "$cmd"
+  eval "$cmd"
+  split_html_dir=$PACKAGE.html
+  copy_images $split_html_dir/ $split_html_dir/*.html
+  (
+    cd $split_html_dir || exit 1
+    tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- *
+  )
+  eval \
+    html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
+  rm -rf "$outdir/html_$split/"
+  mv $split_html_dir "$outdir/html_$split/"
+  du -s "$outdir/html_$split/"
+  ls -l "$outdir/$PACKAGE.html_$split.tar.gz"
+
+else # use texi2html:
+  opt="--output $PACKAGE.html $commonarg $htmlarg"
+  cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
+  printf "\nGenerating monolithic html with texi2html... (%s)\n" "$cmd"
+  rm -rf $PACKAGE.html  # in case a directory is left over
+  eval "$cmd"
+  html_mono_size=`calcsize $PACKAGE.html`
+  gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
+  html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
+  mv $PACKAGE.html "$outdir/"
+
+  html_split node
+  html_split chapter
+  html_split section
+fi
+fi # end html
+
+# \f
+printf "\nMaking .tar.gz for sources...\n"
+d=`dirname $srcfile`
+(
+  cd "$d"
+  srcfiles=`ls -d *.texinfo *.texi *.txi *.eps $source_extra 2>/dev/null` || true
+  tar czfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
+  ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
+)
+texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
+
+# \f
+# Do everything again through docbook.
+if test -n "$docbook"; then
+  opt="-o - --docbook $commonarg"
+  cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
+  printf "\nGenerating docbook XML... (%s)\n" "$cmd"
+  eval "$cmd"
+  docbook_xml_size=`calcsize $PACKAGE-db.xml`
+  gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
+  docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
+  mv $PACKAGE-db.xml "$outdir/"
+
+  split_html_db_dir=html_node_db
+  opt="$commonarg -o $split_html_db_dir"
+  cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
+  printf "\nGenerating docbook HTML... (%s)\n" "$cmd"
+  eval "$cmd"
+  (
+    cd ${split_html_db_dir} || exit 1
+    tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
+  )
+  html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
+  rm -f "$outdir"/html_node_db/*.html
+  mkdir -p "$outdir/html_node_db"
+  mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
+  rmdir ${split_html_db_dir}
+
+  cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
+  printf "\nGenerating docbook ASCII... (%s)\n" "$cmd"
+  eval "$cmd"
+  docbook_ascii_size=`calcsize $PACKAGE-db.txt`
+  mv $PACKAGE-db.txt "$outdir/"
+
+  cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
+  printf "\nGenerating docbook PDF... (%s)\n" "$cmd"
+  eval "$cmd"
+  docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
+  mv $PACKAGE-db.pdf "$outdir/"
+fi
+
+# \f
+printf "\nMaking index.html for %s...\n" "$PACKAGE"
+if test -z "$use_texi2html"; then
+  if test x$split = xnode; then
+    CONDS="/%%IF  *HTML_NODE%%/d;/%%ENDIF  *HTML_NODE%%/d;\
+           /%%IF  *HTML_CHAPTER%%/,/%%ENDIF  *HTML_CHAPTER%%/d;\
+           /%%IF  *HTML_SECTION%%/,/%%ENDIF  *HTML_SECTION%%/d;"
+  elif test x$split = xchapter; then
+    CONDS="/%%IF  *HTML_CHAPTER%%/d;/%%ENDIF  *HTML_CHAPTER%%/d;\
+           /%%IF  *HTML_SECTION%%/,/%%ENDIF  *HTML_SECTION%%/d;\
+           /%%IF  *HTML_NODE%%/,/%%ENDIF  *HTML_NODE%%/d;"
+  elif test x$split = xsection; then
+    CONDS="/%%IF  *HTML_SECTION%%/d;/%%ENDIF  *HTML_SECTION%%/d;\
+           /%%IF  *HTML_CHAPTER%%/,/%%ENDIF  *HTML_CHAPTER%%/d;\
+           /%%IF  *HTML_NODE%%/,/%%ENDIF  *HTML_NODE%%/d;"
+  else
+    CONDS="/%%IF.*%%/d;/%%ENDIF.*%%/d;" # invalid split argument
+  fi
+else
+  # for texi2html, we do not take account of --split and simply output
+  # all variants
+  CONDS="/%%IF.*%%/d;/%%ENDIF.*%%/d;"
+fi
+
+curdate=`$SETLANG date '+%B %d, %Y'`
+sed \
+   -e "s!%%TITLE%%!$MANUAL_TITLE!g" \
+   -e "s!%%EMAIL%%!$EMAIL!g" \
+   -e "s!%%PACKAGE%%!$PACKAGE!g" \
+   -e "s!%%DATE%%!$curdate!g" \
+   -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
+   -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
+   -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
+   -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
+   -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
+   -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
+   -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
+   -e "s!%%PDF_SIZE%%!$pdf_size!g" \
+   -e "s!%%ASCII_SIZE%%!$ascii_size!g" \
+   -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
+   -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
+   -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
+   -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
+   -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
+   -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
+   -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
+   -e "s,%%SCRIPTURL%%,$scripturl,g" \
+   -e "s!%%SCRIPTNAME%%!$prog!g" \
+   -e "$CONDS" \
+$GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
+
+echo "Done, see $outdir/ subdirectory for new files."
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
deleted file mode 120000 (symlink)
index 543b03845fa3a96efbc706fd87d14bb40d5fdb6b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/git-version-gen
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..aa168e194d8a9ce6eead142b4c5df85def13ea2e
--- /dev/null
@@ -0,0 +1,227 @@
+#!/bin/sh
+# Print a version string.
+scriptversion=2022-07-09.08; # UTC
+
+# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# This script is derived from GIT-VERSION-GEN from GIT: https://git-scm.com/.
+# It may be run two ways:
+# - from a git repository in which the "git describe" command below
+#   produces useful output (thus requiring at least one signed tag)
+# - from a non-git-repo directory containing a .tarball-version file, which
+#   presumes this script is invoked like "./git-version-gen .tarball-version".
+
+# In order to use intra-version strings in your project, you will need two
+# separate generated version string files:
+#
+# .tarball-version - present only in a distribution tarball, and not in
+#   a checked-out repository.  Created with contents that were learned at
+#   the last time autoconf was run, and used by git-version-gen.  Must not
+#   be present in either $(srcdir) or $(builddir) for git-version-gen to
+#   give accurate answers during normal development with a checked out tree,
+#   but must be present in a tarball when there is no version control system.
+#   Therefore, it cannot be used in any dependencies.  GNUmakefile has
+#   hooks to force a reconfigure at distribution time to get the value
+#   correct, without penalizing normal development with extra reconfigures.
+#
+# .version - present in a checked-out repository and in a distribution
+#   tarball.  Usable in dependencies, particularly for files that don't
+#   want to depend on config.h but do want to track version changes.
+#   Delete this file prior to any autoconf run where you want to rebuild
+#   files to pick up a version string change; and leave it stale to
+#   minimize rebuild time after unrelated changes to configure sources.
+#
+# As with any generated file in a VC'd directory, you should add
+# /.version to .gitignore, so that you don't accidentally commit it.
+# .tarball-version is never generated in a VC'd directory, so needn't
+# be listed there.
+#
+# Use the following line in your configure.ac, so that $(VERSION) will
+# automatically be up-to-date each time configure is run (and note that
+# since configure.ac no longer includes a version string, Makefile rules
+# should not depend on configure.ac for version updates).
+#
+# AC_INIT([GNU project],
+#         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
+#         [bug-project@example])
+#
+# Then use the following lines in your Makefile.am, so that .version
+# will be present for dependencies, and so that .version and
+# .tarball-version will exist in distribution tarballs.
+#
+# EXTRA_DIST = $(top_srcdir)/.version
+# BUILT_SOURCES = $(top_srcdir)/.version
+# $(top_srcdir)/.version:
+#      echo '$(VERSION)' > $@-t
+#      mv $@-t $@
+# dist-hook:
+#      echo '$(VERSION)' > $(distdir)/.tarball-version
+
+
+me=$0
+
+year=`expr "$scriptversion" : '\([^-]*\)'`
+version="git-version-gen $scriptversion
+
+Copyright (C) ${year} Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
+
+usage="\
+Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
+Print a version string.
+
+Options:
+
+   --prefix PREFIX    prefix of git tags (default 'v')
+   --fallback VERSION
+                      fallback version to use if \"git --version\" fails
+
+   --help             display this help and exit
+   --version          output version information and exit
+
+Send patches and bug reports to <bug-gnulib@gnu.org>."
+
+prefix=v
+fallback=
+
+while test $# -gt 0; do
+  case $1 in
+    --help) echo "$usage"; exit 0;;
+    --version) echo "$version"; exit 0;;
+    --prefix) shift; prefix=${1?};;
+    --fallback) shift; fallback=${1?};;
+    -*)
+      echo "$0: Unknown option '$1'." >&2
+      echo "$0: Try '--help' for more information." >&2
+      exit 1;;
+    *)
+      if test "x$tarball_version_file" = x; then
+        tarball_version_file="$1"
+      elif test "x$tag_sed_script" = x; then
+        tag_sed_script="$1"
+      else
+        echo "$0: extra non-option argument '$1'." >&2
+        exit 1
+      fi;;
+  esac
+  shift
+done
+
+if test "x$tarball_version_file" = x; then
+    echo "$usage"
+    exit 1
+fi
+
+tag_sed_script="${tag_sed_script:-s/x/x/}"
+
+nl='
+'
+
+# Avoid meddling by environment variable of the same name.
+v=
+v_from_git=
+
+# First see if there is a tarball-only version file.
+# then try "git describe", then default.
+if test -f $tarball_version_file
+then
+    v=`cat $tarball_version_file` || v=
+    case $v in
+        *$nl*) v= ;; # reject multi-line output
+    esac
+    test "x$v" = x \
+        && echo "$0: WARNING: $tarball_version_file is damaged" 1>&2
+fi
+
+if test "x$v" != x
+then
+    : # use $v
+# Otherwise, if there is at least one git commit involving the working
+# directory, and "git describe" output looks sensible, use that to
+# derive a version string.
+elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
+    && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
+          || git describe --abbrev=4 HEAD 2>/dev/null` \
+    && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
+    && case $v in
+         $prefix[0-9]*) ;;
+         *) (exit 1) ;;
+       esac
+then
+    # Is this a new git that lists number of commits since the last
+    # tag or the previous older version that did not?
+    #   Newer: v6.10-77-g0f8faeb
+    #   Older: v6.10-g0f8faeb
+    vprefix=`expr "X$v" : 'X\(.*\)-g[^-]*$'` || vprefix=$v
+    case $vprefix in
+        *-*) : git describe is probably okay three part flavor ;;
+        *)
+            : git describe is older two part flavor
+            # Recreate the number of commits and rewrite such that the
+            # result is the same as if we were using the newer version
+            # of git describe.
+            vtag=`echo "$v" | sed 's/-.*//'`
+            commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \
+                || { commit_list=failed;
+                     echo "$0: WARNING: git rev-list failed" 1>&2; }
+            numcommits=`echo "$commit_list" | wc -l`
+            v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
+            test "$commit_list" = failed && v=UNKNOWN
+            ;;
+    esac
+
+    # Change the penultimate "-" to ".", for version-comparing tools.
+    # Remove the "g" to save a byte.
+    v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`;
+    v_from_git=1
+elif test "x$fallback" = x || git --version >/dev/null 2>&1; then
+    v=UNKNOWN
+else
+    v=$fallback
+fi
+
+v=`echo "$v" |sed "s/^$prefix//"`
+
+# Test whether to append the "-dirty" suffix only if the version
+# string we're using came from git.  I.e., skip the test if it's "UNKNOWN"
+# or if it came from .tarball-version.
+if test "x$v_from_git" != x; then
+  # Don't declare a version "dirty" merely because a timestamp has changed.
+  git update-index --refresh > /dev/null 2>&1
+
+  dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
+  case "$dirty" in
+      '') ;;
+      *) # Append the suffix only if there isn't one already.
+          case $v in
+            *-dirty) ;;
+            *) v="$v-dirty" ;;
+          esac ;;
+  esac
+fi
+
+# Omit the trailing newline, so that m4_esyscmd can use the result directly.
+printf %s "$v"
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
deleted file mode 120000 (symlink)
index e85e689ea5b3f80c3f92a49ac539dbc5a4699768..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/gitlog-to-changelog
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..90e81731a877c39a29ce5fb61bf3f9d9a583e0b4
--- /dev/null
@@ -0,0 +1,516 @@
+#!/bin/sh
+#! -*-perl-*-
+
+# Convert git log output to ChangeLog format.
+
+# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+#
+# Written by Jim Meyering
+
+# This is a prologue that allows to run a perl script as an executable
+# on systems that are compliant to a POSIX version before POSIX:2017.
+# On such systems, the usual invocation of an executable through execlp()
+# or execvp() fails with ENOEXEC if it is a script that does not start
+# with a #! line.  The script interpreter mentioned in the #! line has
+# to be /bin/sh, because on GuixSD systems that is the only program that
+# has a fixed file name.  The second line is essential for perl and is
+# also useful for editing this file in Emacs.  The next two lines below
+# are valid code in both sh and perl.  When executed by sh, they re-execute
+# the script through the perl program found in $PATH.  The '-x' option
+# is essential as well; without it, perl would re-execute the script
+# through /bin/sh.  When executed by perl, the next two lines are a no-op.
+eval 'exec perl -wSx "$0" "$@"'
+     if 0;
+
+my $VERSION = '2023-06-24 21:59'; # UTC
+# The definition above must lie within the first 8 lines in order
+# for the Emacs time-stamp write hook (at end) to update it.
+# If you change this file with Emacs, please let the write hook
+# do its job.  Otherwise, update this string manually.
+
+use strict;
+use warnings;
+use Getopt::Long;
+use POSIX qw(strftime);
+
+(my $ME = $0) =~ s|.*/||;
+
+# use File::Coda; # https://meyering.net/code/Coda/
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
+sub usage ($)
+{
+  my ($exit_code) = @_;
+  my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
+  if ($exit_code != 0)
+    {
+      print $STREAM "Try '$ME --help' for more information.\n";
+    }
+  else
+    {
+      print $STREAM <<EOF;
+Usage: $ME [OPTIONS] [ARGS]
+
+Convert git log output to ChangeLog format.  If present, any ARGS
+are passed to "git log".  To avoid ARGS being parsed as options to
+$ME, they may be preceded by '--'.
+
+OPTIONS:
+
+   --amend=FILE FILE maps from an SHA1 to perl code (i.e., s/old/new/) that
+                  makes a change to SHA1's commit log text or metadata.
+   --append-dot append a dot to the first line of each commit message if
+                  there is no other punctuation or blank at the end.
+   --no-cluster never cluster commit messages under the same date/author
+                  header; the default is to cluster adjacent commit messages
+                  if their headers are the same and neither commit message
+                  contains multiple paragraphs.
+   --srcdir=DIR the root of the source tree, from which the .git/
+                  directory can be derived.
+   --since=DATE convert only the logs since DATE;
+                  the default is to convert all log entries.
+   --until=DATE convert only the logs older than DATE.
+   --ignore-matching=PAT ignore commit messages whose first lines match PAT.
+   --ignore-line=PAT ignore lines of commit messages that match PAT.
+   --format=FMT set format string for commit subject and body;
+                  see 'man git-log' for the list of format metacharacters;
+                  the default is '%s%n%b%n'
+   --strip-tab  remove one additional leading TAB from commit message lines.
+   --strip-cherry-pick  remove data inserted by "git cherry-pick";
+                  this includes the "cherry picked from commit ..." line,
+                  and the possible final "Conflicts:" paragraph.
+   --help       display this help and exit
+   --version    output version information and exit
+
+EXAMPLE:
+
+  $ME --since=2008-01-01 > ChangeLog
+  $ME -- -n 5 foo > last-5-commits-to-branch-foo
+
+SPECIAL SYNTAX:
+
+The following types of strings are interpreted specially when they appear
+at the beginning of a log message line.  They are not copied to the output.
+
+  Copyright-paperwork-exempt: Yes
+    Append the "(tiny change)" notation to the usual "date name email"
+    ChangeLog header to mark a change that does not require a copyright
+    assignment.
+  Co-authored-by: Joe User <user\@example.com>
+    List the specified name and email address on a second
+    ChangeLog header, denoting a co-author.
+  Signed-off-by: Joe User <user\@example.com>
+    These lines are simply elided.
+
+In a FILE specified via --amend, comment lines (starting with "#") are ignored.
+FILE must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 (alone on
+a line) referring to a commit in the current project, and CODE refers to one
+or more consecutive lines of Perl code.  Pairs must be separated by one or
+more blank line.
+
+Here is sample input for use with --amend=FILE, from coreutils:
+
+3a169f4c5d9159283548178668d2fae6fced3030
+# fix typo in title:
+s/all tile types/all file types/
+
+1379ed974f1fa39b12e2ffab18b3f7a607082202
+# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself.
+# Change the author to be Paul.  Note the escaped "@":
+s,Jim .*>,Paul Eggert <eggert\\\@cs.ucla.edu>,
+
+EOF
+    }
+  exit $exit_code;
+}
+
+# If the string $S is a well-behaved file name, simply return it.
+# If it contains white space, quotes, etc., quote it, and return the new string.
+sub shell_quote($)
+{
+  my ($s) = @_;
+  if ($s =~ m![^\w+/.,-]!)
+    {
+      # Convert each single quote to '\''
+      $s =~ s/\'/\'\\\'\'/g;
+      # Then single quote the string.
+      $s = "'$s'";
+    }
+  return $s;
+}
+
+sub quoted_cmd(@)
+{
+  return join (' ', map {shell_quote $_} @_);
+}
+
+# Parse file F.
+# Comment lines (starting with "#") are ignored.
+# F must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1
+# (alone on a line) referring to a commit in the current project, and
+# CODE refers to one or more consecutive lines of Perl code.
+# Pairs must be separated by one or more blank line.
+sub parse_amend_file($)
+{
+  my ($f) = @_;
+
+  open F, '<', $f
+    or die "$ME: $f: failed to open for reading: $!\n";
+
+  my $fail;
+  my $h = {};
+  my $in_code = 0;
+  my $sha;
+  while (defined (my $line = <F>))
+    {
+      $line =~ /^\#/
+        and next;
+      chomp $line;
+      $line eq ''
+        and $in_code = 0, next;
+
+      if (!$in_code)
+        {
+          $line =~ /^([[:xdigit:]]{40})$/
+            or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"),
+              $fail = 1, next;
+          $sha = lc $1;
+          $in_code = 1;
+          exists $h->{$sha}
+            and (warn "$ME: $f:$.: duplicate SHA1\n"),
+              $fail = 1, next;
+        }
+      else
+        {
+          $h->{$sha} ||= '';
+          $h->{$sha} .= "$line\n";
+        }
+    }
+  close F;
+
+  $fail
+    and exit 1;
+
+  return $h;
+}
+
+# git_dir_option $SRCDIR
+#
+# From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR
+# is undef).  Return as a list (0 or 1 element).
+sub git_dir_option($)
+{
+  my ($srcdir) = @_;
+  my @res = ();
+  if (defined $srcdir)
+    {
+      my $qdir = shell_quote $srcdir;
+      my $cmd = "cd $qdir && git rev-parse --show-toplevel";
+      my $qcmd = shell_quote $cmd;
+      my $git_dir = qx($cmd);
+      defined $git_dir
+        or die "$ME: cannot run $qcmd: $!\n";
+      $? == 0
+        or die "$ME: $qcmd had unexpected exit code or signal ($?)\n";
+      chomp $git_dir;
+      push @res, "--git-dir=$git_dir/.git";
+    }
+  @res;
+}
+
+{
+  my $since_date;
+  my $until_date;
+  my $format_string = '%s%n%b%n';
+  my $amend_file;
+  my $append_dot = 0;
+  my $cluster = 1;
+  my $ignore_matching;
+  my $ignore_line;
+  my $strip_tab = 0;
+  my $strip_cherry_pick = 0;
+  my $srcdir;
+  GetOptions
+    (
+     help => sub { usage 0 },
+     version => sub { print "$ME version $VERSION\n"; exit },
+     'since=s' => \$since_date,
+     'until=s' => \$until_date,
+     'format=s' => \$format_string,
+     'amend=s' => \$amend_file,
+     'append-dot' => \$append_dot,
+     'cluster!' => \$cluster,
+     'ignore-matching=s' => \$ignore_matching,
+     'ignore-line=s' => \$ignore_line,
+     'strip-tab' => \$strip_tab,
+     'strip-cherry-pick' => \$strip_cherry_pick,
+     'srcdir=s' => \$srcdir,
+    ) or usage 1;
+
+  defined $since_date
+    and unshift @ARGV, "--since=$since_date";
+  defined $until_date
+    and unshift @ARGV, "--until=$until_date";
+
+  # This is a hash that maps an SHA1 to perl code (i.e., s/old/new/)
+  # that makes a correction in the log or attribution of that commit.
+  my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {};
+
+  my @cmd = ('git',
+             git_dir_option $srcdir,
+             qw(log --log-size),
+             '--pretty=format:%H:%ct  %an  <%ae>%n%n'.$format_string, @ARGV);
+  open PIPE, '-|', @cmd
+    or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n"
+            . "(Is your Git too old?  Version 1.5.1 or later is required.)\n");
+
+  my $prev_multi_paragraph;
+  my $prev_date_line = '';
+  my @prev_coauthors = ();
+  my @skipshas = ();
+  while (1)
+    {
+      defined (my $in = <PIPE>)
+        or last;
+      $in =~ /^log size (\d+)$/
+        or die "$ME:$.: Invalid line (expected log size):\n$in";
+      my $log_nbytes = $1;
+
+      my $log;
+      my $n_read = read PIPE, $log, $log_nbytes;
+      $n_read == $log_nbytes
+        or die "$ME:$.: unexpected EOF\n";
+
+      # Extract leading hash.
+      my ($sha, $rest) = split ':', $log, 2;
+      defined $sha
+        or die "$ME:$.: malformed log entry\n";
+      $sha =~ /^[[:xdigit:]]{40}$/
+        or die "$ME:$.: invalid SHA1: $sha\n";
+
+      my $skipflag = 0;
+      if (@skipshas)
+        {
+          foreach(@skipshas)
+            {
+              if ($sha =~ /^$_/)
+                {
+                  $skipflag = $_;
+                  last;
+                }
+            }
+        }
+
+      # If this commit's log requires any transformation, do it now.
+      my $code = $amend_code->{$sha};
+      if (defined $code)
+        {
+          eval 'use Safe';
+          my $s = new Safe;
+          # Put the unpreprocessed entry into "$_".
+          $_ = $rest;
+
+          # Let $code operate on it, safely.
+          my $r = $s->reval("$code")
+            or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n";
+
+          # Note that we've used this entry.
+          delete $amend_code->{$sha};
+
+          # Update $rest upon success.
+          $rest = $_;
+        }
+
+      # Remove lines inserted by "git cherry-pick".
+      if ($strip_cherry_pick)
+        {
+          $rest =~ s/^\s*Conflicts:\n.*//sm;
+          $rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m;
+        }
+
+      my @line = split /[ \t]*\n/, $rest;
+      my $author_line = shift @line;
+      defined $author_line
+        or die "$ME:$.: unexpected EOF\n";
+      $author_line =~ /^(\d+)  (.*>)$/
+        or die "$ME:$.: Invalid line "
+          . "(expected date/author/email):\n$author_line\n";
+
+      # Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog
+      # '(tiny change)' annotation.
+      my $tiny = (grep (/^(?:Copyright-paperwork-exempt|Tiny-change):\s+[Yy]es$/, @line)
+                  ? '  (tiny change)' : '');
+
+      my $date_line = sprintf "%s  %s$tiny\n",
+        strftime ("%Y-%m-%d", localtime ($1)), $2;
+
+      my @coauthors = grep /^Co-authored-by:.*$/, @line;
+      # Omit meta-data lines we've already interpreted.
+      @line = grep !/^(?:Signed-off-by:[ ].*>$
+                       |Co-authored-by:[ ]
+                       |Copyright-paperwork-exempt:[ ]
+                       |Tiny-change:[ ]
+                       )/x, @line;
+
+      # Remove leading and trailing blank lines.
+      if (@line)
+        {
+          while ($line[0] =~ /^\s*$/) { shift @line; }
+          while ($line[$#line] =~ /^\s*$/) { pop @line; }
+        }
+
+      # Handle Emacs gitmerge.el "skipped" commits.
+      # Yes, this should be controlled by an option.  So sue me.
+      if ( grep /^(; )?Merge from /, @line )
+      {
+          my $found = 0;
+          foreach (@line)
+          {
+              if (grep /^The following commit.*skipped:$/, $_)
+              {
+                  $found = 1;
+                  ## Reset at each merge to reduce chance of false matches.
+                  @skipshas = ();
+                  next;
+              }
+              if ($found && $_ =~ /^([[:xdigit:]]{7,}) [^ ]/)
+              {
+                  push ( @skipshas, $1 );
+              }
+          }
+      }
+
+      # Ignore commits that match the --ignore-matching pattern, if specified.
+      if (defined $ignore_matching && @line && $line[0] =~ /$ignore_matching/)
+        {
+          $skipflag = 1;
+        }
+      elsif ($skipflag)
+        {
+          ## Perhaps only warn if a pattern matches more than once?
+          warn "$ME: warning: skipping $sha due to $skipflag\n";
+        }
+
+      if (! $skipflag)
+        {
+          if (defined $ignore_line && @line)
+            {
+              @line = grep ! /$ignore_line/, @line;
+              while ($line[$#line] =~ /^\s*$/) { pop @line; }
+            }
+
+          # Record whether there are two or more paragraphs.
+          my $multi_paragraph = grep /^\s*$/, @line;
+
+          # Format 'Co-authored-by: A U Thor <email@example.com>' lines in
+          # standard multi-author ChangeLog format.
+          for (@coauthors)
+            {
+              s/^Co-authored-by:\s*/\t    /;
+              s/\s*</  </;
+
+              /<.*?@.*\..*>/
+                or warn "$ME: warning: missing email address for "
+                  . substr ($_, 5) . "\n";
+            }
+
+          # If clustering of commit messages has been disabled, if this header
+          # would be different from the previous date/name/etc. header,
+          # or if this or the previous entry consists of two or more paragraphs,
+          # then print the header.
+          if ( ! $cluster
+              || $date_line ne $prev_date_line
+              || "@coauthors" ne "@prev_coauthors"
+              || $multi_paragraph
+              || $prev_multi_paragraph)
+            {
+              $prev_date_line eq ''
+                or print "\n";
+              print $date_line;
+              @coauthors
+                and print join ("\n", @coauthors), "\n";
+            }
+          $prev_date_line = $date_line;
+          @prev_coauthors = @coauthors;
+          $prev_multi_paragraph = $multi_paragraph;
+
+          # If there were any lines
+          if (@line == 0)
+            {
+              warn "$ME: warning: empty commit message:\n"
+                   . "  commit $sha\n  $date_line\n";
+            }
+          else
+            {
+              if ($append_dot)
+                {
+                  # If the first line of the message has enough room, then
+                  if (length $line[0] < 72)
+                    {
+                      # append a dot if there is no other punctuation or blank
+                      # at the end.
+                      $line[0] =~ /[[:punct:]\s]$/
+                        or $line[0] .= '.';
+                    }
+                }
+
+              # Remove one additional leading TAB from each line.
+              $strip_tab
+                and map { s/^\t// } @line;
+
+              # Prefix each non-empty line with a TAB.
+              @line = map { length $_ ? "\t$_" : '' } @line;
+
+              print "\n", join ("\n", @line), "\n";
+            }
+        }
+
+      defined ($in = <PIPE>)
+        or last;
+      $in ne "\n"
+        and die "$ME:$.: unexpected line:\n$in";
+    }
+
+  close PIPE
+    or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n";
+  # FIXME-someday: include $PROCESS_STATUS in the diagnostic
+
+  # Complain about any unused entry in the --amend=F specified file.
+  my $fail = 0;
+  foreach my $sha (keys %$amend_code)
+    {
+      warn "$ME:$amend_file: unused entry: $sha\n";
+      $fail = 1;
+    }
+
+  exit $fail;
+}
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-line-limit: 50
+# time-stamp-start: "my $VERSION = '"
+# time-stamp-format: "%:y-%02m-%02d %02H:%02M"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "'; # UTC"
+# End:
deleted file mode 120000 (symlink)
index 05f9451f813b394567b496ab7c30dd7db7f27fed..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/gnu-web-doc-update
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b51fc1011948f1dafdd51a88708612bba6791618
--- /dev/null
@@ -0,0 +1,216 @@
+#!/bin/sh
+# Run this after each non-alpha release, to update the web documentation at
+# https://www.gnu.org/software/$pkg/manual/
+
+VERSION=2023-09-11.20; # UTC
+
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+ME=$(basename "$0")
+warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
+die() { warn "$*"; exit 1; }
+
+help()
+{
+  cat <<EOF
+Usage: $ME
+
+Run this script from top_srcdir (no arguments) after each non-alpha
+release, to update the web documentation at
+https://www.gnu.org/software/\$pkg/manual/
+
+This script assumes you're using git for revision control, and
+requires a .prev-version file as well as a Makefile, from which it
+extracts the version number and package name, respectively.  Also, it
+assumes all documentation is in the doc/ sub-directory.
+
+Options:
+  -C, --builddir=DIR  location of (configured) Makefile (default: .)
+  -n, --dry-run       don't actually commit anything
+  -m, --mirror        remove out of date files from document server
+  -u, --user          the name of the CVS user on Savannah
+  --help              print this help, then exit
+  --version           print version number, then exit
+
+Report bugs and patches to <bug-gnulib@gnu.org>.
+EOF
+  exit
+}
+
+version()
+{
+  year=$(echo "$VERSION" | sed 's/[^0-9].*//')
+  cat <<EOF
+$ME $VERSION
+Copyright (C) $year Free Software Foundation, Inc,
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+EOF
+  exit
+}
+
+# find_tool ENVVAR NAMES...
+# -------------------------
+# Search for a required program.  Use the value of ENVVAR, if set,
+# otherwise find the first of the NAMES that can be run (i.e.,
+# supports --version).  If found, set ENVVAR to the program name,
+# die otherwise.
+#
+# FIXME: code duplication, see also bootstrap.
+find_tool ()
+{
+  find_tool_envvar=$1
+  shift
+  find_tool_names=$@
+  eval "find_tool_res=\$$find_tool_envvar"
+  if test x"$find_tool_res" = x; then
+    for i
+    do
+      if ($i --version </dev/null) >/dev/null 2>&1; then
+       find_tool_res=$i
+       break
+      fi
+    done
+  else
+    find_tool_error_prefix="\$$find_tool_envvar: "
+  fi
+  test x"$find_tool_res" != x \
+    || die "one of these is required: $find_tool_names"
+  ($find_tool_res --version </dev/null) >/dev/null 2>&1 \
+    || die "${find_tool_error_prefix}cannot run $find_tool_res --version"
+  eval "$find_tool_envvar=\$find_tool_res"
+  eval "export $find_tool_envvar"
+}
+
+## ------ ##
+## Main.  ##
+## ------ ##
+
+# Requirements: everything required to bootstrap your package, plus
+# these.
+find_tool CVS cvs
+find_tool GIT git
+find_tool RSYNC rsync
+find_tool XARGS gxargs xargs
+
+builddir=.
+dryrun=
+rm_stale='echo'
+cvs_user="$USER"
+while test $# != 0
+do
+  # Handle --option=value by splitting apart and putting back on argv.
+  case $1 in
+    --*=*)
+      opt=$(echo "$1" | sed -e 's/=.*//')
+      val=$(echo "$1" | sed -e 's/[^=]*=//')
+      shift
+      set dummy "$opt" "$val" "$@"; shift
+      ;;
+  esac
+
+  case $1 in
+    --help|--version) ${1#--};;
+    -C|--builddir) shift; builddir=$1; shift ;;
+    -n|--dry-run) dryrun=echo; shift;;
+    -m|--mirror) rm_stale=''; shift;;
+    -u|--user) shift; cvs_user=$1; shift ;;
+    --*) die "unrecognized option: $1";;
+    *) break;;
+  esac
+done
+
+test $# = 0 \
+  || die "too many arguments"
+
+prev=.prev-version
+version=$(cat $prev) || die "no $prev file?"
+pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' $builddir/Makefile) \
+  || die "no Makefile?"
+tmp_branch=web-doc-$version-$$
+current_branch=$($GIT branch | sed -ne '/^\* /{s///;p;q;}')
+
+cleanup()
+{
+  __st=$?
+  $dryrun rm -rf "$tmp"
+  $GIT checkout "$current_branch"
+  $GIT submodule update --recursive
+  $GIT branch -d $tmp_branch
+  exit $__st
+}
+trap cleanup EXIT
+trap 'exit $?' HUP INT PIPE TERM
+
+# We must build using sources for which --version reports the
+# just-released version number, not some string like 7.6.18-20761.
+# That version string propagates into all documentation.
+set -e
+$GIT checkout -b $tmp_branch v$version
+$GIT submodule update --recursive
+./bootstrap
+srcdir=$(pwd)
+cd "$builddir"
+builddir=$(pwd)
+  ./config.status --recheck
+  ./config.status
+  make
+  make web-manual
+cd "$srcdir"
+set +e
+
+tmp=$(mktemp -d web-doc-update.XXXXXX) || exit 1
+( cd $tmp \
+    && $CVS -d $cvs_user@cvs.savannah.gnu.org:/webcvs/$pkg co $pkg )
+$RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
+
+(
+  cd $tmp/$pkg
+  test -d manual/CVS || $dryrun $CVS add -ko manual
+
+  cd manual
+
+  # Add all the files.  This is simpler than trying to add only the
+  # new ones because of new directories
+  # First add non empty dirs individually
+  find . -name CVS -prune -o -type d \! -empty -print             \
+    | $XARGS -n1 --no-run-if-empty -- $dryrun $CVS add -ko
+  # Now add all files
+  find . -name CVS -prune -o -type f -print             \
+    | $XARGS --no-run-if-empty -- $dryrun $CVS add -ko
+
+  # Report/Remove stale files
+  #   excluding doc server specific files like CVS/* and .symlinks
+  if test -n "$rm_stale"; then
+    echo 'Consider the --mirror option if all of the manual is generated,' >&2
+    echo 'which will run `cvs remove` to remove stale files.' >&2
+  fi
+  { find . \( -name CVS -o -type f -name '.*' \) -prune -o -type f -print
+    (cd "$builddir"/doc/manual/ && find . -type f -print | sed p)
+  } | sort | uniq -u \
+    | $XARGS --no-run-if-empty -- ${rm_stale:-$dryrun} $CVS remove -f
+
+  $dryrun $CVS ci -m $version
+)
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "VERSION="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
deleted file mode 120000 (symlink)
index 0545b9e28a4bb1d47b91ab895b87328b5fc93c1b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/gnupload
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..298a6766f0c40ec259a2b519dad0c30e28499b27
--- /dev/null
@@ -0,0 +1,480 @@
+#!/bin/sh
+# Sign files and upload them.
+
+scriptversion=2022-01-27.18; # UTC
+
+# Copyright (C) 2004-2024 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.  If not, see <https://www.gnu.org/licenses/>.
+
+# Originally written by Alexandre Duret-Lutz <adl@gnu.org>.
+# The master copy of this file is maintained in the gnulib Git repository.
+# Please send bug reports and feature requests to bug-gnulib@gnu.org.
+
+set -e
+
+GPG=gpg
+# Choose the proper version of gpg, so as to avoid a
+# "gpg-agent is not available in this session" error
+# when gpg-agent is version 2 but gpg is still version 1.
+# FIXME-2020: remove, once all major distros ship gpg version 2 as /usr/bin/gpg
+gpg_agent_version=`(gpg-agent --version) 2>/dev/null | sed -e '2,$d' -e 's/^[^0-9]*//'`
+case "$gpg_agent_version" in
+  2.*)
+    gpg_version=`(gpg --version) 2>/dev/null | sed -e '2,$d' -e 's/^[^0-9]*//'`
+    case "$gpg_version" in
+      1.*)
+        if (type gpg2) >/dev/null 2>/dev/null; then
+          # gpg2 is present.
+          GPG=gpg2
+        else
+          # gpg2 is missing. Ubuntu users should install the package 'gnupg2'.
+          echo "WARNING: Using 'gpg', which is too old. You should install 'gpg2'." 1>&2
+        fi
+        ;;
+    esac
+    ;;
+esac
+
+GPG="${GPG} --batch --no-tty"
+conffile=.gnuploadrc
+to=
+dry_run=false
+replace=
+symlink_files=
+delete_files=
+delete_symlinks=
+collect_var=
+dbg=
+nl='
+'
+
+usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...]
+
+Sign all FILES, and process them at the destinations specified with --to.
+If CMD is not given, it defaults to uploading.  See examples below.
+
+Commands:
+  --delete                 delete FILES from destination
+  --symlink                create symbolic links
+  --rmsymlink              remove symbolic links
+  --                       treat the remaining arguments as files to upload
+
+Options:
+  --to DEST                specify a destination DEST for FILES
+                           (multiple --to options are allowed)
+  --user NAME              sign with key NAME
+  --replace                allow replacements of existing files
+  --symlink-regex[=EXPR]   use sed script EXPR to compute symbolic link names
+  -n, --dry-run            do nothing, show what would have been done
+                           (including the constructed directive file)
+  --version                output version information and exit
+  -h, --help               print this help text and exit
+
+If --symlink-regex is given without EXPR, then the link target name
+is created by replacing the version information with '-latest', e.g.:
+  foo-1.3.4.tar.gz -> foo-latest.tar.gz
+
+Recognized destinations are:
+  alpha.gnu.org:DIRECTORY
+  savannah.gnu.org:DIRECTORY
+  savannah.nongnu.org:DIRECTORY
+  ftp.gnu.org:DIRECTORY
+                           build directive files and upload files by FTP
+  download.gnu.org.ua:{alpha|ftp}/DIRECTORY
+                           build directive files and upload files by SFTP
+  [user@]host:DIRECTORY    upload files with scp
+
+Options and commands are applied in order.  If the file $conffile exists
+in the current working directory, its contents are prepended to the
+actual command line options.  Use this to keep your defaults.  Comments
+(#) and empty lines in $conffile are allowed.
+
+<https://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>
+gives some further background.
+
+Examples:
+1. Upload foobar-1.0.tar.gz to ftp.gnu.org:
+  gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz
+
+2. Upload foobar-1.0.tar.gz and foobar-1.0.tar.xz to ftp.gnu.org:
+  gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz foobar-1.0.tar.xz
+
+3. Same as above, and also create symbolic links to foobar-latest.tar.*:
+  gnupload --to ftp.gnu.org:foobar \\
+           --symlink-regex \\
+           foobar-1.0.tar.gz foobar-1.0.tar.xz
+
+4. Create a symbolic link foobar-latest.tar.gz -> foobar-1.0.tar.gz
+   and likewise for the corresponding .sig file:
+  gnupload --to ftp.gnu.org:foobar \\
+           --symlink foobar-1.0.tar.gz     foobar-latest.tar.gz \\
+                     foobar-1.0.tar.gz.sig foobar-latest.tar.gz.sig
+  or (equivalent):
+  gnupload --to ftp.gnu.org:foobar \\
+           --symlink foobar-1.0.tar.gz     foobar-latest.tar.gz \\
+           --symlink foobar-1.0.tar.gz.sig foobar-latest.tar.gz.sig
+
+5. Upload foobar-0.9.90.tar.gz to two sites:
+  gnupload --to alpha.gnu.org:foobar \\
+           --to sources.redhat.com:~ftp/pub/foobar \\
+           foobar-0.9.90.tar.gz
+
+6. Delete oopsbar-0.9.91.tar.gz and upload foobar-0.9.91.tar.gz
+   (the -- terminates the list of files to delete):
+  gnupload --to alpha.gnu.org:foobar \\
+           --to sources.redhat.com:~ftp/pub/foobar \\
+           --delete oopsbar-0.9.91.tar.gz \\
+           -- foobar-0.9.91.tar.gz
+
+gnupload executes a program ncftpput to do the transfers; if you don't
+happen to have an ncftp package installed, the ncftpput-ftp script in
+the build-aux/ directory of the gnulib package
+(https://savannah.gnu.org/projects/gnulib) may serve as a replacement.
+
+Send patches and bug reports to <bug-gnulib@gnu.org>."
+
+copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
+copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
+License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
+
+# Read local configuration file
+if test -r "$conffile"; then
+  echo "$0: Reading configuration file $conffile"
+  conf=`sed 's/#.*$//;/^$/d' "$conffile" | tr "\015$nl" '  '`
+  eval set x "$conf \"\$@\""
+  shift
+fi
+
+while test -n "$1"; do
+  case $1 in
+  -*)
+    collect_var=
+    case $1 in
+    -h | --help)
+      echo "$usage"
+      exit $?
+      ;;
+    --to)
+      if test -z "$2"; then
+        echo "$0: Missing argument for --to" 1>&2
+        exit 1
+      elif echo "$2" | grep 'ftp-upload\.gnu\.org' >/dev/null; then
+        echo "$0: Use ftp.gnu.org:PKGNAME or alpha.gnu.org:PKGNAME" >&2
+        echo "$0: for the destination, not ftp-upload.gnu.org (which" >&2
+        echo "$0:  is used for direct ftp uploads, not with gnupload)." >&2
+        echo "$0: See --help and its examples if need be." >&2
+        exit 1
+      else
+        to="$to $2"
+        shift
+      fi
+      ;;
+    --user)
+      if test -z "$2"; then
+        echo "$0: Missing argument for --user" 1>&2
+        exit 1
+      else
+        GPG="$GPG --local-user $2"
+        shift
+      fi
+      ;;
+    --delete)
+      collect_var=delete_files
+      ;;
+    --replace)
+      replace="replace: true"
+      ;;
+    --rmsymlink)
+      collect_var=delete_symlinks
+      ;;
+    --symlink-regex=*)
+      symlink_expr=`expr "$1" : '[^=]*=\(.*\)'`
+      ;;
+    --symlink-regex)
+      symlink_expr='s|-[0-9][0-9\.]*\(-[0-9][0-9]*\)\{0,1\}\.|-latest.|'
+      ;;
+    --symlink)
+      collect_var=symlink_files
+      ;;
+    -n | --dry-run)
+      dry_run=:
+      ;;
+    --version)
+      echo "gnupload $scriptversion"
+      echo "$copyright"
+      exit 0
+      ;;
+    --)
+      shift
+      break
+      ;;
+    -*)
+      echo "$0: Unknown option '$1', try '$0 --help'" 1>&2
+      exit 1
+      ;;
+    esac
+    ;;
+  *)
+    if test -z "$collect_var"; then
+      break
+    else
+      eval "$collect_var=\"\$$collect_var $1\""
+    fi
+    ;;
+  esac
+  shift
+done
+
+dprint()
+{
+  echo "Running $* ..."
+}
+
+if $dry_run; then
+  dbg=dprint
+fi
+
+if test -z "$to"; then
+  echo "$0: Missing destination sites" >&2
+  exit 1
+fi
+
+if test -n "$symlink_files"; then
+  x=`echo "$symlink_files" | sed 's/[^ ]//g;s/  //g'`
+  if test -n "$x"; then
+    echo "$0: Odd number of symlink arguments" >&2
+    exit 1
+  fi
+fi
+
+if test $# = 0; then
+  if test -z "${symlink_files}${delete_files}${delete_symlinks}"; then
+    echo "$0: No file to upload" 1>&2
+    exit 1
+  fi
+else
+  # Make sure all files exist.  We don't want to ask
+  # for the passphrase if the script will fail.
+  for file
+  do
+    if test ! -f $file; then
+      echo "$0: Cannot find '$file'" 1>&2
+      exit 1
+    elif test -n "$symlink_expr"; then
+      linkname=`echo $file | sed "$symlink_expr"`
+      if test -z "$linkname"; then
+        echo "$0: symlink expression produces empty results" >&2
+        exit 1
+      elif test "$linkname" = $file; then
+        echo "$0: symlink expression does not alter file name" >&2
+        exit 1
+      fi
+    fi
+  done
+fi
+
+# Make sure passphrase is not exported in the environment.
+unset passphrase
+unset passphrase_fd_0
+GNUPGHOME=${GNUPGHOME:-$HOME/.gnupg}
+
+# Reset PATH to be sure that echo is a built-in.  We will later use
+# 'echo $passphrase' to output the passphrase, so it is important that
+# it is a built-in (third-party programs tend to appear in 'ps'
+# listings with their arguments...).
+# Remember this script runs with 'set -e', so if echo is not built-in
+# it will exit now.
+if $dry_run || grep -q "^use-agent" $GNUPGHOME/gpg.conf; then :; else
+  PATH=/empty echo -n "Enter GPG passphrase: "
+  stty -echo
+  read -r passphrase
+  stty echo
+  echo
+  passphrase_fd_0="--passphrase-fd 0"
+fi
+
+if test $# -ne 0; then
+  for file
+  do
+    echo "Signing $file ..."
+    rm -f $file.sig
+    echo "$passphrase" | $dbg $GPG $passphrase_fd_0 -ba -o $file.sig $file
+  done
+fi
+
+
+# mkdirective DESTDIR BASE FILE STMT
+# Arguments: See upload, below
+mkdirective ()
+{
+  stmt="$4"
+  if test -n "$3"; then
+    stmt="
+filename: $3$stmt"
+  fi
+
+  cat >${2}.directive<<EOF
+version: 1.2
+directory: $1
+comment: gnupload v. $scriptversion$stmt
+EOF
+  if $dry_run; then
+    echo "File ${2}.directive:"
+    cat ${2}.directive
+    echo "File ${2}.directive:" | sed 's/./-/g'
+  fi
+}
+
+mksymlink ()
+{
+  while test $# -ne 0
+  do
+    echo "symlink: $1 $2"
+    shift
+    shift
+  done
+}
+
+# upload DEST DESTDIR BASE FILE STMT FILES
+# Arguments:
+#  DEST     Destination site;
+#  DESTDIR  Destination directory;
+#  BASE     Base name for the directive file;
+#  FILE     Name of the file to distribute (may be empty);
+#  STMT     Additional statements for the directive file;
+#  FILES    List of files to upload.
+upload ()
+{
+  dest=$1
+  destdir=$2
+  base=$3
+  file=$4
+  stmt=$5
+  files=$6
+
+  rm -f $base.directive $base.directive.asc
+  case $dest in
+    alpha.gnu.org:*)
+      mkdirective "$destdir" "$base" "$file" "$stmt"
+      echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
+      $dbg ncftpput ftp-upload.gnu.org /incoming/alpha $files $base.directive.asc
+      ;;
+    ftp.gnu.org:*)
+      mkdirective "$destdir" "$base" "$file" "$stmt"
+      echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
+      $dbg ncftpput ftp-upload.gnu.org /incoming/ftp $files $base.directive.asc
+      ;;
+    savannah.gnu.org:*)
+      if test -z "$files"; then
+        echo "$0: warning: standalone directives not applicable for $dest" >&2
+      fi
+      $dbg ncftpput savannah.gnu.org /incoming/savannah/$destdir $files
+      ;;
+    savannah.nongnu.org:*)
+      if test -z "$files"; then
+        echo "$0: warning: standalone directives not applicable for $dest" >&2
+      fi
+      $dbg ncftpput savannah.nongnu.org /incoming/savannah/$destdir $files
+      ;;
+    download.gnu.org.ua:alpha/*|download.gnu.org.ua:ftp/*)
+      destdir_p1=`echo "$destdir" | sed 's,^[^/]*/,,'`
+      destdir_topdir=`echo "$destdir" | sed 's,/.*,,'`
+      mkdirective "$destdir_p1" "$base" "$file" "$stmt"
+      echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
+      for f in $files $base.directive.asc
+      do
+        echo put $f
+      done | $dbg sftp -b - download.gnu.org.ua:/incoming/$destdir_topdir
+      ;;
+    /*)
+      dest_host=`echo "$dest" | sed 's,:.*,,'`
+      mkdirective "$destdir" "$base" "$file" "$stmt"
+      echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
+      $dbg cp $files $base.directive.asc $dest_host
+      ;;
+    *)
+      if test -z "$files"; then
+        echo "$0: warning: standalone directives not applicable for $dest" >&2
+      fi
+      $dbg scp $files $dest
+      ;;
+  esac
+  rm -f $base.directive $base.directive.asc
+}
+
+#####
+# Process any standalone directives
+stmt=
+if test -n "$symlink_files"; then
+  stmt="$stmt
+`mksymlink $symlink_files`"
+fi
+
+for file in $delete_files
+do
+  stmt="$stmt
+archive: $file"
+done
+
+for file in $delete_symlinks
+do
+  stmt="$stmt
+rmsymlink: $file"
+done
+
+if test -n "$stmt"; then
+  for dest in $to
+  do
+    destdir=`echo $dest | sed 's/[^:]*://'`
+    upload "$dest" "$destdir" "`hostname`-$$" "" "$stmt"
+  done
+fi
+
+# Process actual uploads
+for dest in $to
+do
+  for file
+  do
+    echo "Uploading $file to $dest ..."
+    stmt=
+    #
+    # allowing file replacement is all or nothing.
+    if test -n "$replace"; then stmt="$stmt
+$replace"
+    fi
+    #
+    files="$file $file.sig"
+    destdir=`echo $dest | sed 's/[^:]*://'`
+    if test -n "$symlink_expr"; then
+      linkname=`echo $file | sed "$symlink_expr"`
+      stmt="$stmt
+symlink: $file $linkname
+symlink: $file.sig $linkname.sig"
+    fi
+    upload "$dest" "$destdir" "$file" "$file" "$stmt" "$files"
+  done
+done
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
deleted file mode 120000 (symlink)
index 87281fd00e0fb629bde1392a04858754b6984d51..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/update-copyright
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..efda754862c31050da044b754a748efdd190791e
--- /dev/null
@@ -0,0 +1,307 @@
+#!/bin/sh
+#! -*-perl-*-
+
+# Update an FSF copyright year list to include the current year.
+
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+#
+# Written by Jim Meyering and Joel E. Denny
+
+# This script updates an FSF copyright year list to include the current year.
+# Usage: update-copyright [FILE...]
+#
+# The arguments to this script should be names of files that contain
+# copyright statements to be updated.  The copyright holder's name
+# defaults to "Free Software Foundation, Inc." but may be changed to
+# any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment
+# variable.
+#
+# For example, you might wish to use the update-copyright target rule
+# in maint.mk from gnulib's maintainer-makefile module.
+#
+# Iff a copyright statement is recognized in a file and the final
+# year is not the current year, then the statement is updated for the
+# new year and it is reformatted to:
+#
+#   1. Fit within 72 columns.
+#   2. Convert 2-digit years to 4-digit years by prepending "19".
+#   3. Expand copyright year intervals.  (See "Environment variables"
+#      below.)
+#
+# A warning is printed for every file for which no copyright
+# statement is recognized.
+#
+# Each file's copyright statement must be formatted correctly in
+# order to be recognized.  For example, each of these is fine:
+#
+#   Copyright @copyright{} 1990-2005, 2007-2009 Free Software
+#   Foundation, Inc.
+#
+#   # Copyright (C) 1990-2005, 2007-2009 Free Software
+#   # Foundation, Inc.
+#
+#   /*
+#    * Copyright &copy; 90,2005,2007-2009
+#    * Free Software Foundation, Inc.
+#    */
+#
+# However, the following format is not recognized because the line
+# prefix changes after the first line:
+#
+#   ## Copyright (C) 1990-2005, 2007-2009 Free Software
+#   #  Foundation, Inc.
+#
+# However, any correctly formatted copyright statement following
+# a non-matching copyright statements would be recognized.
+#
+# The exact conditions that a file's copyright statement must meet
+# to be recognized are:
+#
+#   1. It is the first copyright statement that meets all of the
+#      following conditions.  Subsequent copyright statements are
+#      ignored.
+#   2. Its format is "Copyright (C)", then a list of copyright years,
+#      and then the name of the copyright holder.
+#   3. The "(C)" takes one of the following forms or is omitted
+#      entirely:
+#
+#        A. (C)
+#        B. (c)
+#        C. @copyright{}
+#        D. &copy;
+#        E. ©
+#
+#   4. The "Copyright" appears at the beginning of a line, except that it
+#      may be prefixed by any sequence (e.g., a comment) of no more than
+#      5 characters -- including white space.
+#   5. Iff such a prefix is present, the same prefix appears at the
+#      beginning of each remaining line within the FSF copyright
+#      statement.  There is one exception in order to support C-style
+#      comments: if the first line's prefix contains nothing but
+#      whitespace surrounding a "/*", then the prefix for all subsequent
+#      lines is the same as the first line's prefix except with each of
+#      "/" and possibly "*" replaced by a " ".  The replacement of "*"
+#      by " " is consistent throughout all subsequent lines.
+#   6. Blank lines, even if preceded by the prefix, do not appear
+#      within the FSF copyright statement.
+#   7. Each copyright year is 2 or 4 digits, and years are separated by
+#      commas, "-", "--", or "\(en" (for troff).  Whitespace may appear
+#      after commas.
+#
+# Environment variables:
+#
+#   1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
+#      is reformatted even if it does not need updating for the new
+#      year.  If unset or set to 0, only updated FSF copyright
+#      statements are reformatted.
+#   2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
+#      copyright years (such as 90, 1991, 1992-2007, 2008) in a
+#      reformatted FSF copyright statement is collapsed to a single
+#      interval (such as 1990-2008).  If unset or set to 0, all existing
+#      copyright year intervals in a reformatted FSF copyright statement
+#      are expanded instead.
+#      If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps
+#      to the minimal containing range.  For example, convert
+#      2000, 2004-2007, 2009 to 2000-2009.
+#   3. For testing purposes, you can set the assumed current year in
+#      UPDATE_COPYRIGHT_YEAR.
+#   4. The default maximum line length for a copyright line is 72.
+#      Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length.
+#   5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
+#      than "Free Software Foundation, Inc.".
+
+# This is a prologue that allows to run a perl script as an executable
+# on systems that are compliant to a POSIX version before POSIX:2017.
+# On such systems, the usual invocation of an executable through execlp()
+# or execvp() fails with ENOEXEC if it is a script that does not start
+# with a #! line.  The script interpreter mentioned in the #! line has
+# to be /bin/sh, because on GuixSD systems that is the only program that
+# has a fixed file name.  The second line is essential for perl and is
+# also useful for editing this file in Emacs.  The next two lines below
+# are valid code in both sh and perl.  When executed by sh, they re-execute
+# the script through the perl program found in $PATH.  The '-x' option
+# is essential as well; without it, perl would re-execute the script
+# through /bin/sh.  When executed by perl, the next two lines are a no-op.
+eval 'exec perl -wSx -0777 -pi "$0" "$@"'
+     if 0;
+
+my $VERSION = '2023-10-03.12:14'; # UTC
+# The definition above must lie within the first 8 lines in order
+# for the Emacs time-stamp write hook (at end) to update it.
+# If you change this file with Emacs, please let the write hook
+# do its job.  Otherwise, update this string manually.
+
+use strict;
+use warnings;
+use re 'eval';
+
+my $copyright_re = 'Copyright';
+my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|&copy;|©)';
+my $ndash_re = '(?:--?|\\\\\(en)';
+my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
+$holder ||= 'Free Software Foundation, Inc.';
+my $prefix_max = 5;
+my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH};
+!$margin || $margin !~ m/^\d+$/
+  and $margin = 72;
+
+my $tab_width = 8;
+
+my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
+if (!$this_year || $this_year !~ m/^\d{4}$/)
+  {
+    my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
+    $this_year = $year + 1900;
+  }
+
+# Unless the file consistently uses "\r\n" as the EOL, use "\n" instead.
+my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n";
+
+my $leading;
+my $prefix;
+my $ws_re;
+my $stmt_re;
+while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
+  {
+    $leading = "$1$2";
+    $prefix = $2;
+    if ($prefix =~ /^(\s*\/)\*(\s*)$/)
+      {
+        $prefix =~ s,/, ,;
+        my $prefix_ws = $prefix;
+        $prefix_ws =~ s/\*/ /; # Only whitespace.
+        if (/\G(?:[^*\n]|\*[^\/\n])*\*?\n$prefix_ws/)
+          {
+            $prefix = $prefix_ws;
+          }
+      }
+    $ws_re = '[ \t\r\f]'; # \s without \n
+    $ws_re =
+      "(?:$ws_re*(?:$ws_re|\\n" . quotemeta($prefix) . ")$ws_re*)";
+    my $holder_re = $holder;
+    $holder_re =~ s/\s/$ws_re/g;
+    my $stmt_remainder_re =
+      "(?:$ws_re$circle_c_re)?"
+      . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|$ndash_re))*"
+      . "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
+    if (/\G$stmt_remainder_re/)
+      {
+        $stmt_re =
+          quotemeta($leading) . "($copyright_re$stmt_remainder_re)";
+        last;
+      }
+  }
+if (defined $stmt_re)
+  {
+    /$stmt_re/ or die; # Should never die.
+    my $stmt = $1;
+    my $final_year_orig = $2;
+
+    # Handle two-digit year numbers like "98" and "99".
+    my $final_year = $final_year_orig;
+    $final_year <= 99
+      and $final_year += 1900;
+
+    if ($final_year != $this_year)
+      {
+        # Update the year.
+        $stmt =~ s/(^|[^\d])$final_year_orig\b/$1$final_year, $this_year/;
+      }
+    if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
+      {
+        # Normalize all whitespace including newline-prefix sequences.
+        $stmt =~ s/$ws_re/ /g;
+
+        # Put spaces after commas.
+        $stmt =~ s/, ?/, /g;
+
+        # Convert 2-digit to 4-digit years.
+        $stmt =~ s/(\b\d\d\b)/19$1/g;
+
+        # Make the use of intervals consistent.
+        if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS})
+          {
+            $stmt =~ s/(\d{4})$ndash_re(\d{4})/join(', ', $1..$2)/eg;
+          }
+        else
+          {
+            my $ndash = ($ARGV =~ /\.tex(i(nfo)?)?$/ ? "--"
+                         : $ARGV =~ /\.(\d[a-z]*|man)$/ ? "\\(en"
+                         : "-");
+
+            $stmt =~
+              s/
+                (\d{4})
+                (?:
+                  (,\ |$ndash_re)
+                  ((??{
+                    if   ($2 ne ', ') { '\d{4}'; }
+                    elsif (!$3)       { $1 + 1;  }
+                    else              { $3 + 1;  }
+                  }))
+                )+
+              /$1$ndash$3/gx;
+
+            # When it's 2, emit a single range encompassing all year numbers.
+            $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
+              and $stmt =~ s/(^|[^\d])(\d{4})\b.*(?:[^\d])(\d{4})\b/$1$2$ndash$3/;
+          }
+
+        # Format within margin.
+        my $stmt_wrapped;
+        my $text_margin = $margin - length($prefix);
+        if ($prefix =~ /^(\t+)/)
+          {
+            $text_margin -= length($1) * ($tab_width - 1);
+          }
+        while (length $stmt)
+          {
+            if (($stmt =~ s/^(.{1,$text_margin})(?: |$)//)
+                || ($stmt =~ s/^([\S]+)(?: |$)//))
+              {
+                my $line = $1;
+                $stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading;
+                $stmt_wrapped .= $line;
+              }
+            else
+              {
+                # Should be unreachable, but we don't want an infinite
+                # loop if it can be reached.
+                die;
+              }
+          }
+
+        # Replace the old copyright statement.
+        s/$stmt_re/$stmt_wrapped/g;
+      }
+  }
+else
+  {
+    print STDERR "$ARGV: warning: copyright statement not found\n";
+  }
+
+# Hey Emacs!
+# Local variables:
+# coding: utf-8
+# mode: perl
+# indent-tabs-mode: nil
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-line-limit: 200
+# time-stamp-start: "my $VERSION = '"
+# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "'; # UTC"
+# End:
deleted file mode 120000 (symlink)
index c4c771861d00afc032bd74ca5f213e9884221f90..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/useless-if-before-free
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..ac9c890170c9ea7a8181e540a3cc61ab08ea0561
--- /dev/null
@@ -0,0 +1,240 @@
+#!/bin/sh
+#! -*-perl-*-
+
+# Detect instances of "if (p) free (p);".
+# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
+
+# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+#
+# Written by Jim Meyering
+
+# This is a prologue that allows to run a perl script as an executable
+# on systems that are compliant to a POSIX version before POSIX:2017.
+# On such systems, the usual invocation of an executable through execlp()
+# or execvp() fails with ENOEXEC if it is a script that does not start
+# with a #! line.  The script interpreter mentioned in the #! line has
+# to be /bin/sh, because on GuixSD systems that is the only program that
+# has a fixed file name.  The second line is essential for perl and is
+# also useful for editing this file in Emacs.  The next two lines below
+# are valid code in both sh and perl.  When executed by sh, they re-execute
+# the script through the perl program found in $PATH.  The '-x' option
+# is essential as well; without it, perl would re-execute the script
+# through /bin/sh.  When executed by perl, the next two lines are a no-op.
+eval 'exec perl -wSx "$0" "$@"'
+     if 0;
+
+my $VERSION = '2022-01-27 18:51'; # UTC
+# The definition above must lie within the first 8 lines in order
+# for the Emacs time-stamp write hook (at end) to update it.
+# If you change this file with Emacs, please let the write hook
+# do its job.  Otherwise, update this string manually.
+
+my $copyright_year = '2022';
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+(my $ME = $0) =~ s|.*/||;
+
+# use File::Coda; # https://meyering.net/code/Coda/
+END {
+  defined fileno STDOUT or return;
+  close STDOUT and return;
+  warn "$ME: failed to close standard output: $!\n";
+  $? ||= 1;
+}
+
+sub usage ($)
+{
+  my ($exit_code) = @_;
+  my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
+  if ($exit_code != 0)
+    {
+      print $STREAM "Try '$ME --help' for more information.\n";
+    }
+  else
+    {
+      print $STREAM <<EOF;
+Usage: $ME [OPTIONS] FILE...
+
+Detect any instance in FILE of a useless "if" test before a free call, e.g.,
+"if (p) free (p);".  Any such test may be safely removed without affecting
+the semantics of the C code in FILE.  Use --name=FOO --name=BAR to also
+detect free-like functions named FOO and BAR.
+
+OPTIONS:
+
+   --list       print only the name of each matching FILE (\\0-terminated)
+   --name=N     add name N to the list of \'free\'-like functions to detect;
+                  may be repeated
+
+   --help       display this help and exit
+   --version    output version information and exit
+
+Exit status:
+
+  0   one or more matches
+  1   no match
+  2   an error
+
+EXAMPLE:
+
+For example, this command prints all removable "if" tests before "free"
+and "kfree" calls in the linux kernel sources:
+
+    git ls-files -z |xargs -0 $ME --name=kfree
+
+EOF
+    }
+  exit $exit_code;
+}
+
+sub is_NULL ($)
+{
+  my ($expr) = @_;
+  return ($expr eq 'NULL' || $expr eq '0');
+}
+
+{
+  sub EXIT_MATCH {0}
+  sub EXIT_NO_MATCH {1}
+  sub EXIT_ERROR {2}
+  my $err = EXIT_NO_MATCH;
+
+  my $list;
+  my @name = qw(free);
+  GetOptions
+    (
+     help => sub { usage 0 },
+     version =>
+       sub
+       {
+         print "$ME version $VERSION\n";
+         print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
+         print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
+             . "This is free software: you are free to change and redistribute it.\n"
+             . "There is NO WARRANTY, to the extent permitted by law.\n";
+         print "\n";
+         my $author = "Jim Meyering";
+         print "Written by $author.\n";
+         exit
+       },
+     list => \$list,
+     'name=s@' => \@name,
+    ) or usage 1;
+
+  # Make sure we have the right number of non-option arguments.
+  # Always tell the user why we fail.
+  @ARGV < 1
+    and (warn "$ME: missing FILE argument\n"), usage EXIT_ERROR;
+
+  my $or = join '|', @name;
+  my $regexp = qr/(?:$or)/;
+
+  # Set the input record separator.
+  # Note: this makes it impractical to print line numbers.
+  $/ = '"';
+
+  my $found_match = 0;
+ FILE:
+  foreach my $file (@ARGV)
+    {
+      open FH, '<', $file
+        or (warn "$ME: can't open '$file' for reading: $!\n"),
+          $err = EXIT_ERROR, next;
+      while (defined (my $line = <FH>))
+        {
+          # Skip non-matching lines early to save time
+          $line =~ /\bif\b/
+            or next;
+          while ($line =~
+              /\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
+              #  1          2                  3
+               (?:   \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;|
+                \s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
+            {
+              my $all = $1;
+              my ($lhs, $rhs) = ($2, $3);
+              my ($free_opnd, $braced_free_opnd) = ($4, $5);
+              my $non_NULL;
+              if (!defined $rhs) { $non_NULL = $lhs }
+              elsif (is_NULL $rhs) { $non_NULL = $lhs }
+              elsif (is_NULL $lhs) { $non_NULL = $rhs }
+              else { next }
+
+              # Compare the non-NULL part of the "if" expression and the
+              # free'd expression, without regard to white space.
+              $non_NULL =~ tr/ \t//d;
+              my $e2 = defined $free_opnd ? $free_opnd : $braced_free_opnd;
+              $e2 =~ tr/ \t//d;
+              if ($non_NULL eq $e2)
+                {
+                  $found_match = 1;
+                  $list
+                    and (print "$file\0"), next FILE;
+                  print "$file: $all\n";
+                }
+            }
+        }
+    }
+  continue
+    {
+      close FH;
+    }
+
+  $found_match && $err == EXIT_NO_MATCH
+    and $err = EXIT_MATCH;
+
+  exit $err;
+}
+
+my $foo = <<'EOF';
+# The above is to *find* them.
+# This adjusts them, removing the unnecessary "if (p)" part.
+
+# FIXME: do something like this as an option (doesn't do braces):
+free=xfree
+git grep -l -z "$free *(" \
+  | xargs -0 useless-if-before-free -l --name="$free" \
+  | xargs -0 perl -0x3b -pi -e \
+   's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
+
+# Use the following to remove redundant uses of kfree inside braces.
+# Note that -0777 puts perl in slurp-whole-file mode;
+# but we have plenty of memory, these days...
+free=kfree
+git grep -l -z "$free *(" \
+  | xargs -0 useless-if-before-free -l --name="$free" \
+  | xargs -0 perl -0777 -pi -e \
+     's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s*\{\s*('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\);)\s*\}[^\n]*$/$2/gms'
+
+Be careful that the result of the above transformation is valid.
+If the matched string is followed by "else", then obviously, it won't be.
+
+When modifying files, refuse to process anything other than a regular file.
+EOF
+
+## Local Variables:
+## mode: perl
+## indent-tabs-mode: nil
+## eval: (add-hook 'before-save-hook 'time-stamp)
+## time-stamp-line-limit: 50
+## time-stamp-start: "my $VERSION = '"
+## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
+## time-stamp-time-zone: "UTC0"
+## time-stamp-end: "'; # UTC"
+## End:
deleted file mode 120000 (symlink)
index eab7cb084173a798bec9e9d23be73dd83707d504..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/build-aux/vc-list-files
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7036576405fad7de3a4e689049242fa3fc704555
--- /dev/null
@@ -0,0 +1,113 @@
+#!/bin/sh
+# List version-controlled file names.
+
+# Print a version string.
+scriptversion=2018-03-07.03; # UTC
+
+# Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+
+# List the specified version-controlled files.
+# With no argument, list them all.  With a single DIRECTORY argument,
+# list the version-controlled files in that directory.
+
+# If there's an argument, it must be a single, "."-relative directory name.
+# cvsu is part of the cvsutils package: https://www.red-bean.com/cvsutils/
+
+postprocess=
+case $1 in
+  --help) cat <<EOF
+Usage: $0 [-C SRCDIR] [DIR...]
+
+Output a list of version-controlled files in DIR (default .), relative to
+SRCDIR (default .).  SRCDIR must be the top directory of a checkout.
+
+Options:
+  --help     print this help, then exit
+  --version  print version number, then exit
+  -C SRCDIR  change directory to SRCDIR before generating list
+
+Report bugs and patches to <bug-gnulib@gnu.org>.
+EOF
+    exit ;;
+
+  --version)
+    year=`echo "$scriptversion" | sed 's/[^0-9].*//'`
+    cat <<EOF
+vc-list-files $scriptversion
+Copyright (C) $year Free Software Foundation, Inc,
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+EOF
+    exit ;;
+
+  -C)
+    test "$2" = . || postprocess="| sed 's|^|$2/|'"
+    cd "$2" || exit 1
+    shift; shift ;;
+esac
+
+test $# = 0 && set .
+
+for dir
+do
+  if test -d .git || test -f .git; then
+    test "x$dir" = x. \
+      && dir= sed_esc= \
+      || { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
+    # Ignore git symlinks - either they point into the tree, in which case
+    # we don't need to visit the target twice, or they point somewhere
+    # else (often into a submodule), in which case the content does not
+    # belong to this package.
+    eval exec git ls-tree -r 'HEAD:"$dir"' \
+      \| sed -n '"s/^100[^     ]*./$sed_esc/p"' $postprocess
+  elif test -d .hg; then
+    eval exec hg locate '"$dir/*"' $postprocess
+  elif test -d .bzr; then
+    test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
+    eval exec bzr ls -R --versioned '"$dir"' $postprocess
+  elif test -d CVS; then
+    test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
+    if test -x build-aux/cvsu; then
+      eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
+    elif (cvsu --help) >/dev/null 2>&1; then
+      eval cvsu --find --types=AFGM '"$dir"' $postprocess
+    else
+      eval awk -F/ \''{                        \
+          if (!$1 && $3 !~ /^-/) {     \
+            f=FILENAME;                        \
+            if (f ~ /CVS\/Entries$/)   \
+              f = substr(f, 1, length(f)-11); \
+            print f $2;                        \
+          }}'\''                               \
+        `find "$dir" -name Entries -print` /dev/null' $postprocess
+    fi
+  elif test -d .svn; then
+    eval exec svn list -R '"$dir"' $postprocess
+  else
+    echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
+    exit 1
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
deleted file mode 120000 (symlink)
index cb5a014acc841e89245dd0ea041f7989835ffbf1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/doc/gendocs_template
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..277b1755dc88621b574b0355351f885012aca5c6
--- /dev/null
@@ -0,0 +1,103 @@
+<!--#include virtual="/server/header.html" -->
+<!-- Parent-Version: 1.78 -->
+
+<!--
+Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without any warranty.
+-->
+
+<title>%%TITLE%% - GNU Project - Free Software Foundation</title>
+<!--#include virtual="/server/banner.html" -->
+<h2>%%TITLE%%</h2>
+
+<address>Free Software Foundation</address>
+<address>last updated %%DATE%%</address>
+
+<p>This manual (%%PACKAGE%%) is available in the following formats:</p>
+
+<ul>
+<li><a href="%%PACKAGE%%.html">HTML
+    (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
+%%IF HTML_NODE%%
+<li><a href="html_node/index.html">HTML</a> - with one web page per
+    node.</li>
+%%ENDIF HTML_NODE%%
+%%IF HTML_SECTION%%
+<li><a href="html_section/index.html">HTML</a> - with one web page per
+    section.</li>
+%%ENDIF HTML_SECTION%%
+%%IF HTML_CHAPTER%%
+<li><a href="html_chapter/index.html">HTML</a> - with one web page per
+    chapter.</li>
+%%ENDIF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.html.gz">HTML compressed
+    (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
+    one web page.</li>
+%%IF HTML_NODE%%
+<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
+    (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
+    with one web page per node.</li>
+%%ENDIF HTML_NODE%%
+%%IF HTML_SECTION%%
+<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
+    (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -
+    with one web page per section.</li>
+%%ENDIF HTML_SECTION%%
+%%IF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed
+    (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> -
+    with one web page per chapter.</li>
+%%ENDIF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.info.tar.gz">Info document
+    (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li>
+<li><a href="%%PACKAGE%%.txt">ASCII text
+    (%%ASCII_SIZE%%K bytes)</a>.</li>
+<li><a href="%%PACKAGE%%.txt.gz">ASCII text compressed
+    (%%ASCII_GZ_SIZE%%K bytes gzipped)</a>.</li>
+<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file
+    (%%DVI_GZ_SIZE%%K bytes gzipped)</a>.</li>
+<li><a href="%%PACKAGE%%.pdf">PDF file
+    (%%PDF_SIZE%%K bytes)</a>.</li>
+<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source
+    (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).</a></li>
+</ul>
+
+<p>You can <a href="https://shop.fsf.org/">buy printed copies of
+some manuals</a> (among other items) from the Free Software Foundation;
+this helps support FSF activities.</p>
+
+<p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%
+script</a>.)</p>
+
+<!-- If needed, change the copyright block at the bottom. In general,
+     all pages on the GNU web server should have the section about
+     verbatim copying.  Please do NOT remove this without talking
+     with the webmasters first.  -->
+</div><!-- for id="content", starts in the include above -->
+<!--#include virtual="/server/footer.html" -->
+<div id="footer">
+<div class="unprintable">
+
+<p>Please send general FSF &amp; GNU inquiries to
+<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
+There are also <a href="/contact/">other ways to contact</a>
+the FSF.  Broken links and other corrections or suggestions can be sent
+to <a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
+</div>
+
+<p>Copyright &copy; 2023 Free Software Foundation, Inc.</p>
+
+<p>This page is licensed under a <a rel="license"
+href="https://creativecommons.org/licenses/by-nd/3.0/us/">Creative
+Commons Attribution-NoDerivs 3.0 United States License</a>.</p>
+
+<!--#include virtual="/server/bottom-notes.html" -->
+
+</div>
+</div>
+</body>
+</html>
deleted file mode 120000 (symlink)
index d6eb2bbe81ab938665356fe170fdb7c12b8d8f41..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/doc/gendocs_template_min
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5518a1a4caa759f08a0aa06f3fe6ae3e3e19d7c2
--- /dev/null
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+
+<!--
+Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without any warranty.
+-->
+
+<head>
+<title>%%TITLE%% - GNU Project - Free Software Foundation</title>
+<meta http-equiv="content-type" content='text/html; charset=utf-8' />
+<link rel="stylesheet" type="text/css" href="/gnu.css" />
+</head>
+
+<body>
+
+<h3>%%TITLE%%</h3>
+
+<address>Free Software Foundation</address>
+<address>last updated %%DATE%%</address>
+<p>
+<a href="/graphics/gnu-head.jpg">
+       <img src="/graphics/gnu-head-sm.jpg"
+             alt=" [image of the head of a GNU] " width="129" height="122"/>
+</a>
+</p>
+<hr />
+
+<p>This manual (%%PACKAGE%%) is available in the following formats:</p>
+
+<ul>
+<li><a href="%%PACKAGE%%.html">HTML
+    (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
+<li><a href="html_node/index.html">HTML</a> - with one web page per
+    node.</li>
+%%IF HTML_SECTION%%
+<li><a href="html_section/index.html">HTML</a> - with one web page per
+    section.</li>
+%%ENDIF HTML_SECTION%%
+%%IF HTML_CHAPTER%%
+<li><a href="html_chapter/index.html">HTML</a> - with one web page per
+    chapter.</li>
+%%ENDIF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.html.gz">HTML compressed
+    (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
+    one web page.</li>
+<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
+    (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
+    with one web page per node.</li>
+%%IF HTML_SECTION%%
+<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
+    (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -
+    with one web page per section.</li>
+%%ENDIF HTML_SECTION%%
+%%IF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed
+    (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> -
+    with one web page per chapter.</li>
+%%ENDIF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.info.tar.gz">Info document
+    (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li>
+<li><a href="%%PACKAGE%%.txt">ASCII text
+    (%%ASCII_SIZE%%K bytes)</a>.</li>
+<li><a href="%%PACKAGE%%.txt.gz">ASCII text compressed
+    (%%ASCII_GZ_SIZE%%K bytes gzipped)</a>.</li>
+<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file
+    (%%DVI_GZ_SIZE%%K bytes gzipped)</a>.</li>
+<li><a href="%%PACKAGE%%.pdf">PDF file
+    (%%PDF_SIZE%%K bytes)</a>.</li>
+<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source
+    (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).</a></li>
+</ul>
+
+<p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%
+script</a>.)</p>
+
+<!-- If needed, change the copyright block at the bottom. In general,
+     all pages on the GNU web server should have the section about
+     verbatim copying.  Please do NOT remove this without talking
+     with the webmasters first.
+     Please make sure the copyright date is consistent with the document
+     and that it is like this: "2001, 2002", not this: "2001-2002". -->
+<div id="footer" class="copyright">
+
+<p>Please send general FSF &amp; GNU inquiries to
+<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
+There are also <a href="/contact/">other ways to contact</a>
+the FSF.  Broken links and other corrections or suggestions can be sent
+to <a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
+</div>
+
+<p>Copyright &copy; 2020 Free Software Foundation, Inc.</p>
+
+<p>This page is licensed under a <a rel="license"
+href="https://creativecommons.org/licenses/by-nd/3.0/us/">Creative
+Commons Attribution-NoDerivs 3.0 United States License</a>.</p>
+
+<!--#include virtual="/server/bottom-notes.html" -->
+
+</div>
+</body>
+</html>
deleted file mode 120000 (symlink)
index b0b5372ecd6bda904d451c79baa34e11abb63292..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/doc/parse-datetime.texi
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6f100dc1ffa10cecb075c28d57136bd0eb11a933
--- /dev/null
@@ -0,0 +1,618 @@
+@c GNU date syntax documentation
+
+@c Copyright (C) 1994--2006, 2009--2024 Free Software Foundation, Inc.
+
+@c Permission is granted to copy, distribute and/or modify this document
+@c under the terms of the GNU Free Documentation License, Version 1.3 or
+@c any later version published by the Free Software Foundation; with no
+@c Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
+@c copy of the license is at <https://www.gnu.org/licenses/fdl-1.3.en.html>.
+
+@node Date input formats
+@chapter Date input formats
+
+@cindex date input formats
+@findex parse_datetime
+
+First, a quote:
+
+@quotation
+Our units of temporal measurement, from seconds on up to months, are so
+complicated, asymmetrical and disjunctive so as to make coherent mental
+reckoning in time all but impossible.  Indeed, had some tyrannical god
+contrived to enslave our minds to time, to make it all but impossible
+for us to escape subjection to sodden routines and unpleasant surprises,
+he could hardly have done better than handing down our present system.
+It is like a set of trapezoidal building blocks, with no vertical or
+horizontal surfaces, like a language in which the simplest thought
+demands ornate constructions, useless particles and lengthy
+circumlocutions.  Unlike the more successful patterns of language and
+science, which enable us to face experience boldly or at least
+level-headedly, our system of temporal calculation silently and
+persistently encourages our terror of time.
+
+@dots{}  It is as though architects had to measure length in feet, width
+in meters and height in ells; as though basic instruction manuals
+demanded a knowledge of five different languages.  It is no wonder then
+that we often look into our own immediate past or future, last Tuesday
+or a week from Sunday, with feelings of helpless confusion.  @dots{}
+
+---Robert Grudin, @cite{Time and the Art of Living}.
+@end quotation
+
+This section describes the textual date representations that GNU
+programs accept.  These are the strings you, as a user, can supply as
+arguments to the various programs.  The C interface (via the
+@code{parse_datetime} function) is not described here.
+
+@menu
+* General date syntax::          Common rules
+* Calendar date items::          @samp{14 Nov 2022}
+* Time of day items::            @samp{9:02pm}
+* Time zone items::              @samp{UTC}, @samp{-0700}, @samp{+0900}, @dots{}
+* Combined date and time of day items:: @samp{2022-11-14T21:02:42,000000-0500}
+* Day of week items::            @samp{Monday} and others
+* Relative items in date strings:: @samp{next tuesday, 2 years ago}
+* Pure numbers in date strings:: @samp{20221114}, @samp{2102}
+* Seconds since the Epoch::      @samp{@@1668477762}
+* Specifying time zone rules::   @samp{TZ="America/New_York"}, @samp{TZ="UTC0"}
+* Authors of parse_datetime::    Bellovin, Eggert, Salz, Berets, et al.
+@end menu
+
+
+@node General date syntax
+@section General date syntax
+
+@cindex general date syntax
+
+@cindex items in date strings
+A @dfn{date} is a string, possibly empty, containing many items
+separated by whitespace.  The whitespace may be omitted when no
+ambiguity arises.  The empty string means the beginning of today (i.e.,
+midnight).  Order of the items is immaterial.  A date string may contain
+many flavors of items:
+
+@itemize @bullet
+@item calendar date items
+@item time of day items
+@item time zone items
+@item combined date and time of day items
+@item day of the week items
+@item relative items
+@item pure numbers.
+@end itemize
+
+@noindent We describe each of these item types in turn, below.
+
+@cindex numbers, written-out
+@cindex ordinal numbers
+@findex first @r{in date strings}
+@findex next @r{in date strings}
+@findex last @r{in date strings}
+A few ordinal numbers may be written out in words in some contexts.  This is
+most useful for specifying day of the week items or relative items (see
+below).  Among the most commonly used ordinal numbers, the word
+@samp{last} stands for @math{-1}, @samp{this} stands for 0, and
+@samp{first} and @samp{next} both stand for 1.  Because the word
+@samp{second} stands for the unit of time there is no way to write the
+ordinal number 2, but for convenience @samp{third} stands for 3,
+@samp{fourth} for 4, @samp{fifth} for 5,
+@samp{sixth} for 6, @samp{seventh} for 7, @samp{eighth} for 8,
+@samp{ninth} for 9, @samp{tenth} for 10, @samp{eleventh} for 11 and
+@samp{twelfth} for 12.
+
+@cindex months, written-out
+When a month is written this way, it is still considered to be written
+numerically, instead of being ``spelled in full''; this changes the
+allowed strings.
+
+@cindex language, in dates
+In the current implementation, only English is supported for words and
+abbreviations like @samp{AM}, @samp{DST}, @samp{EST}, @samp{first},
+@samp{January}, @samp{Sunday}, @samp{tomorrow}, and @samp{year}.
+
+@cindex language, in dates
+@cindex time zone item
+The output of the @command{date} command
+is not always acceptable as a date string,
+not only because of the language problem, but also because there is no
+standard meaning for time zone items like @samp{IST}@.  When using
+@command{date} to generate a date string intended to be parsed later,
+specify a date format that is independent of language and that does not
+use time zone items other than @samp{UTC} and @samp{Z}@.  Here are some
+ways to do this:
+
+@example
+$ LC_ALL=C TZ=UTC0 date
+Tue Nov 15 02:02:42 UTC 2022
+$ TZ=UTC0 date +'%Y-%m-%d %H:%M:%SZ'
+2022-11-15 02:02:42Z
+$ date --rfc-3339=ns  # --rfc-3339 is a GNU extension.
+2022-11-14 21:02:42.000000000-05:00
+$ date --rfc-email  # a GNU extension
+Mon, 14 Nov 2022 21:02:42 -0500
+$ date +'%Y-%m-%d %H:%M:%S %z'  # %z is a GNU extension.
+2022-11-14 21:02:42 -0500
+$ date +'@@%s.%N'  # %s and %N are GNU extensions.
+@@1668477762.692722128
+@end example
+
+@cindex case, ignored in dates
+@cindex comments, in dates
+Alphabetic case is completely ignored in dates.  Comments may be introduced
+between round parentheses, as long as included parentheses are properly
+nested.  Hyphens not followed by a digit are currently ignored.  Leading
+zeros on numbers are ignored.
+
+@cindex leap seconds
+Invalid dates like @samp{2022-02-29} or times like @samp{24:00} are
+rejected.  In the typical case of a host that does not support leap
+seconds, a time like @samp{23:59:60} is rejected even if it
+corresponds to a valid leap second.
+
+
+@node Calendar date items
+@section Calendar date items
+
+@cindex calendar date item
+
+A @dfn{calendar date item} specifies a day of the year.  It is
+specified differently, depending on whether the month is specified
+numerically or literally.  All these strings specify the same calendar date:
+
+@example
+2022-11-14     # ISO 8601.
+22-11-14       # Assume 19xx for 69 through 99,
+               # 20xx for 00 through 68 (not recommended).
+11/14/2022     # Common U.S. writing.
+14 November 2022
+14 Nov 2022    # Three-letter abbreviations always allowed.
+November 14, 2022
+14-nov-2022
+14nov2022
+@end example
+
+The year can also be omitted.  In this case, the last specified year is
+used, or the current year if none.  For example:
+
+@example
+11/14
+nov 14
+@end example
+
+Here are the rules.
+
+@cindex ISO 8601 date format
+@cindex date format, ISO 8601
+For numeric months, the ISO 8601 format
+@samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is
+any positive number, @var{month} is a number between 01 and 12, and
+@var{day} is a number between 01 and 31.  A leading zero must be present
+if a number is less than ten.  If @var{year} is 68 or smaller, then 2000
+is added to it; otherwise, if @var{year} is less than 100,
+then 1900 is added to it.  The construct
+@samp{@var{month}/@var{day}/@var{year}}, popular in the United States,
+is accepted.  Also @samp{@var{month}/@var{day}}, omitting the year.
+
+@cindex month names in date strings
+@cindex abbreviations for months
+Literal months may be spelled out in full: @samp{January},
+@samp{February}, @samp{March}, @samp{April}, @samp{May}, @samp{June},
+@samp{July}, @samp{August}, @samp{September}, @samp{October},
+@samp{November} or @samp{December}.  Literal months may be abbreviated
+to their first three letters, possibly followed by an abbreviating dot.
+It is also permitted to write @samp{Sept} instead of @samp{September}.
+
+When months are written literally, the calendar date may be given as any
+of the following:
+
+@example
+@var{day} @var{month} @var{year}
+@var{day} @var{month}
+@var{month} @var{day} @var{year}
+@var{day}-@var{month}-@var{year}
+@end example
+
+Or, omitting the year:
+
+@example
+@var{month} @var{day}
+@end example
+
+
+@node Time of day items
+@section Time of day items
+
+@cindex time of day item
+
+A @dfn{time of day item} in date strings specifies the time on a given
+day.  Here are some examples, all of which represent the same time:
+
+@example
+20:02:00.000000
+20:02
+8:02pm
+20:02-0500      # In EST (U.S. Eastern Standard Time).
+@end example
+
+@cindex leap seconds
+More generally, the time of day may be given as
+@samp{@var{hour}:@var{minute}:@var{second}}, where @var{hour} is
+a number between 0 and 23, @var{minute} is a number between 0 and
+59, and @var{second} is a number between 0 and 59 possibly followed by
+@samp{.} or @samp{,} and a fraction containing one or more digits.
+Alternatively,
+@samp{:@var{second}} can be omitted, in which case it is taken to
+be zero.  On the rare hosts that support leap seconds, @var{second}
+may be 60.
+
+@findex am @r{in date strings}
+@findex pm @r{in date strings}
+@findex midnight @r{in date strings}
+@findex noon @r{in date strings}
+If the time is followed by @samp{am} or @samp{pm} (or @samp{a.m.}
+or @samp{p.m.}), @var{hour} is restricted to run from 1 to 12, and
+@samp{:@var{minute}} may be omitted (taken to be zero).  @samp{am}
+indicates the first half of the day, @samp{pm} indicates the second
+half of the day.  In this notation, 12 is the predecessor of 1:
+midnight is @samp{12am} while noon is @samp{12pm}.
+(This is the zero-oriented interpretation of @samp{12am} and @samp{12pm},
+as opposed to the old tradition derived from Latin
+which uses @samp{12m} for noon and @samp{12pm} for midnight.)
+
+@cindex time zone correction
+@cindex minutes, time zone correction by
+The time may alternatively be followed by a time zone correction,
+expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+}
+or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number
+of zone minutes.
+The zone minutes term, @var{mm}, may be omitted, in which case
+the one- or two-digit correction is interpreted as a number of hours.
+You can also separate @var{hh} from @var{mm} with a colon.
+When a time zone correction is given this way, it
+forces interpretation of the time relative to
+Coordinated Universal Time (UTC), overriding any previous
+specification for the time zone or the local time zone.  For example,
+@samp{+0530} and @samp{+05:30} both stand for the time zone 5.5 hours
+ahead of UTC (e.g., India).
+This is the best way to
+specify a time zone correction by fractional parts of an hour.
+The maximum zone correction is 24 hours.
+
+Either @samp{am}/@samp{pm} or a time zone correction may be specified,
+but not both.
+
+
+@node Time zone items
+@section Time zone items
+
+@cindex time zone item
+
+A @dfn{time zone item} specifies an international time zone, indicated
+by a small set of letters, e.g., @samp{UTC} or @samp{Z}
+for Coordinated Universal
+Time.  Any included periods are ignored.  By following a
+non-daylight-saving time zone by the string @samp{DST} in a separate
+word (that is, separated by some white space), the corresponding
+daylight saving time zone may be specified.
+Alternatively, a non-daylight-saving time zone can be followed by a
+time zone correction, to add the two values.  This is normally done
+only for @samp{UTC}; for example, @samp{UTC+05:30} is equivalent to
+@samp{+05:30}.
+
+Time zone items other than @samp{UTC} and @samp{Z}
+are obsolescent and are not recommended, because they
+are ambiguous; for example, @samp{EST} has a different meaning in
+Australia than in the United States, and @samp{A} has different
+meaning as a military time zone than as an obsolete
+RFC 822 time zone.  Instead, it's better to use
+unambiguous numeric time zone corrections like @samp{-0500}, as
+described in the previous section.
+
+If neither a time zone item nor a time zone correction is supplied,
+timestamps are interpreted using the rules of the default time zone
+(@pxref{Specifying time zone rules}).
+
+
+@node Combined date and time of day items
+@section Combined date and time of day items
+
+@cindex combined date and time of day item
+@cindex ISO 8601 date and time of day format
+@cindex date and time of day format, ISO 8601
+
+The ISO 8601 date and time of day extended format consists of an ISO
+8601 date, a @samp{T} character separator, and an ISO 8601 time of
+day.  This format is also recognized if the @samp{T} is replaced by a
+space.
+
+In this format, the time of day should use 24-hour notation.
+Fractional seconds are allowed, with either comma or period preceding
+the fraction.  ISO 8601 fractional minutes and hours are not
+supported.  Typically, hosts support nanosecond timestamp resolution;
+excess precision is silently discarded.
+
+Here are some examples:
+
+@example
+2022-09-24T20:02:00.052-05:00
+2022-12-31T23:59:59,999999999+11:00
+1970-01-01 00:00Z
+@end example
+
+@node Day of week items
+@section Day of week items
+
+@cindex day of week item
+
+The explicit mention of a day of the week will forward the date
+(only if necessary) to reach that day of the week in the future.
+
+Days of the week may be spelled out in full: @samp{Sunday},
+@samp{Monday}, @samp{Tuesday}, @samp{Wednesday}, @samp{Thursday},
+@samp{Friday} or @samp{Saturday}.  Days may be abbreviated to their
+first three letters, optionally followed by a period.  The special
+abbreviations @samp{Tues} for @samp{Tuesday}, @samp{Wednes} for
+@samp{Wednesday} and @samp{Thur} or @samp{Thurs} for @samp{Thursday} are
+also allowed.
+
+@findex next @var{day}
+@findex last @var{day}
+A number may precede a day of the week item to move forward
+supplementary weeks.  It is best used in expression like @samp{third
+monday}.  In this context, @samp{last @var{day}} or @samp{next
+@var{day}} is also acceptable; they move one week before or after
+the day that @var{day} by itself would represent.
+
+A comma following a day of the week item is ignored.
+
+
+@node Relative items in date strings
+@section Relative items in date strings
+
+@cindex relative items in date strings
+@cindex displacement of dates
+
+@dfn{Relative items} adjust a date (or the current date if none) forward
+or backward.  The effects of relative items accumulate.  Here are some
+examples:
+
+@example
+1 year
+1 year ago
+3 years
+2 days
+@end example
+
+@findex year @r{in date strings}
+@findex month @r{in date strings}
+@findex fortnight @r{in date strings}
+@findex week @r{in date strings}
+@findex day @r{in date strings}
+@findex hour @r{in date strings}
+@findex minute @r{in date strings}
+The unit of time displacement may be selected by the string @samp{year}
+or @samp{month} for moving by whole years or months.  These are fuzzy
+units, as years and months are not all of equal duration.  More precise
+units are @samp{fortnight} which is worth 14 days, @samp{week} worth 7
+days, @samp{day} worth 24 hours, @samp{hour} worth 60 minutes,
+@samp{minute} or @samp{min} worth 60 seconds, and @samp{second} or
+@samp{sec} worth one second.  An @samp{s} suffix on these units is
+accepted and ignored.
+
+@findex ago @r{in date strings}
+The unit of time may be preceded by a multiplier, given as an optionally
+signed number.  Unsigned numbers are taken as positively signed.  No
+number at all implies 1 for a multiplier.  Following a relative item by
+the string @samp{ago} is equivalent to preceding the unit by a
+multiplier with value @math{-1}.
+
+@findex day @r{in date strings}
+@findex tomorrow @r{in date strings}
+@findex yesterday @r{in date strings}
+The string @samp{tomorrow} is worth one day in the future (equivalent
+to @samp{day}), the string @samp{yesterday} is worth
+one day in the past (equivalent to @samp{day ago}).
+
+@findex now @r{in date strings}
+@findex today @r{in date strings}
+@findex this @r{in date strings}
+The strings @samp{now} or @samp{today} are relative items corresponding
+to zero-valued time displacement, these strings come from the fact
+a zero-valued time displacement represents the current time when not
+otherwise changed by previous items.  They may be used to stress other
+items, like in @samp{12:00 today}.  The string @samp{this} also has
+the meaning of a zero-valued time displacement, but is preferred in
+date strings like @samp{this thursday}.
+
+When a relative item causes the resulting date to cross a boundary
+where the clocks were adjusted, typically for daylight saving time,
+the resulting date and time are adjusted accordingly.
+
+The fuzz in units can cause problems with relative items.  For
+example, @samp{2022-12-31 -1 month} might evaluate to 2022-12-01,
+because 2022-11-31 is an invalid date.  To determine the previous
+month more reliably, you can ask for the month before the 15th of the
+current month.  For example:
+
+@example
+$ date -R
+Thu, 31 Dec 2022 13:02:39 -0400
+$ date --date='-1 month' +'Last month was %B?'
+Last month was December?
+$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
+Last month was November!
+@end example
+
+Also, take care when manipulating dates around clock changes such as
+daylight saving leaps.  In a few cases these have added or subtracted
+as much as 24 hours from the clock, so it is often wise to adopt
+universal time by setting the @env{TZ} environment variable to
+@samp{UTC0} before embarking on calendrical calculations.
+
+@node Pure numbers in date strings
+@section Pure numbers in date strings
+
+@cindex pure numbers in date strings
+
+The precise interpretation of a pure decimal number depends
+on the context in the date string.
+
+If the decimal number is of the form @var{yyyy}@var{mm}@var{dd} and no
+other calendar date item (@pxref{Calendar date items}) appears before it
+in the date string, then @var{yyyy} is read as the year, @var{mm} as the
+month number and @var{dd} as the day of the month, for the specified
+calendar date.
+
+If the decimal number is of the form @var{hh}@var{mm} and no other time
+of day item appears before it in the date string, then @var{hh} is read
+as the hour of the day and @var{mm} as the minute of the hour, for the
+specified time of day.  @var{mm} can also be omitted.
+
+If both a calendar date and a time of day appear to the left of a number
+in the date string, but no relative item, then the number overrides the
+year.
+
+
+@node Seconds since the Epoch
+@section Seconds since the Epoch
+
+If you precede a number with @samp{@@}, it represents an internal
+timestamp as a count of seconds.  The number can contain an internal
+decimal point (either @samp{.} or @samp{,}); any excess precision not
+supported by the internal representation is truncated toward minus
+infinity.  Such a number cannot be combined with any other date
+item, as it specifies a complete timestamp.
+
+@cindex beginning of time, for POSIX
+@cindex Epoch, for POSIX
+Internally, computer times are represented as a count of seconds since
+an Epoch---a well-defined point of time.  On GNU and
+POSIX systems, the Epoch is 1970-01-01 00:00:00 UTC, so
+@samp{@@0} represents this time, @samp{@@1} represents 1970-01-01
+00:00:01 UTC, and so forth.  GNU and most other
+POSIX-compliant systems support such times as an extension
+to POSIX, using negative counts, so that @samp{@@-1}
+represents 1969-12-31 23:59:59 UTC.
+
+Most modern systems count seconds with 64-bit two's-complement integers
+of seconds with nanosecond subcounts, which is a range that includes
+the known lifetime of the universe with nanosecond resolution.
+Some obsolescent systems count seconds with 32-bit two's-complement
+integers and can represent times from 1901-12-13 20:45:52 through
+2038-01-19 03:14:07 UTC@.  A few systems sport other time ranges.
+
+@cindex leap seconds
+On most hosts, these counts ignore the presence of leap seconds.
+For example, on most hosts @samp{@@1483228799} represents 2016-12-31
+23:59:59 UTC, @samp{@@1483228800} represents 2017-01-01 00:00:00
+UTC, and there is no way to represent the intervening leap second
+2016-12-31 23:59:60 UTC.
+
+@node Specifying time zone rules
+@section Specifying time zone rules
+
+@vindex TZ
+Normally, dates are interpreted using the rules of the current time
+zone, which in turn are specified by the @env{TZ} environment
+variable, or by a system default if @env{TZ} is not set.  To specify a
+different set of default time zone rules that apply just to one date,
+start the date with a string of the form @samp{TZ="@var{rule}"}.  The
+two quote characters (@samp{"}) must be present in the date, and any
+quotes or backslashes within @var{rule} must be escaped by a
+backslash.
+
+For example, with the GNU @command{date} command you can
+answer the question ``What time is it in New York when a Paris clock
+shows 6:30am on October 31, 2022?'' by using a date beginning with
+@samp{TZ="Europe/Paris"} as shown in the following shell transcript:
+
+@example
+$ export TZ="America/New_York"
+$ date --date='TZ="Europe/Paris" 2022-10-31 06:30'
+Mon Oct 31 01:30:00 EDT 2022
+@end example
+
+In this example, the @option{--date} operand begins with its own
+@env{TZ} setting, so the rest of that operand is processed according
+to @samp{Europe/Paris} rules, treating the string @samp{2022-11-14
+06:30} as if it were in Paris.  However, since the output of the
+@command{date} command is processed according to the overall time zone
+rules, it uses New York time.  (Paris was normally six hours ahead of
+New York in 2022, but this example refers to a brief Halloween period
+when the gap was five hours.)
+
+A @env{TZ} value is a rule that typically names a location in the
+@uref{https://www.iana.org/time-zones, @samp{tz} database}.
+A recent catalog of location names appears in the
+@uref{https://twiki.org/cgi-bin/xtra/tzdatepick.html, TWiki Date and Time
+Gateway}.  A few non-GNU hosts require a colon before a
+location name in a @env{TZ} setting, e.g.,
+@samp{TZ=":America/New_York"}.
+
+The @samp{tz} database includes a wide variety of locations ranging
+from @samp{Africa/Abidjan} to @samp{Pacific/Tongatapu}, but
+if you are at sea and have your own private time zone, or if you are
+using a non-GNU host that does not support the @samp{tz}
+database, you may need to use a POSIX rule instead.
+The previously-mentioned POSIX rule @samp{UTC0} says that the time zone
+abbreviation is @samp{UTC}, the zone is zero hours away from
+Greenwich, and there is no daylight saving time.
+POSIX rules can also specify nonzero Greenwich offsets.
+For example, the following shell transcript answers the question
+``What time is it five and a half hours east of Greenwich when a clock
+seven hours west of Greenwich shows 9:50pm on July 12, 2022?''
+
+@example
+$ TZ="<+0530>-5:30" date --date='TZ="<-07>+7" 2022-07-12 21:50'
+Wed Jul 13 10:20:00 +0530 2022
+@end example
+
+@noindent
+This example uses the somewhat-confusing POSIX convention for rules.
+@samp{TZ="<-07>+7"} says that the time zone abbreviation is @samp{-07}
+and the time zone is 7 hours west of Greenwich, and
+@samp{TZ="<+0530>-5:30"} says that the time zone abbreviation is @samp{+0530}
+and the time zone is 5 hours 30 minutes east of Greenwich.
+(One should never use a setting like @samp{TZ="UTC-5"}, since
+this would incorrectly imply that local time is five hours east of
+Greenwich and the time zone is called ``UTC''.)
+Although trickier POSIX @env{TZ} settings like
+@samp{TZ="<-05>+5<-04>,M3.2.0/2,M11.1.0/2"} can specify some daylight
+saving regimes, location-based settings like
+@samp{TZ="America/New_York"} are typically simpler and more accurate
+historically.  @xref{TZ Variable,, Specifying the Time Zone with @code{TZ},
+libc, The GNU C Library}.
+
+@node Authors of parse_datetime
+@section Authors of @code{parse_datetime}
+@c the anchor keeps the old node name, to try to avoid breaking links
+@anchor{Authors of get_date}
+
+@cindex authors of @code{parse_datetime}
+
+@cindex Bellovin, Steven M.
+@cindex Salz, Rich
+@cindex Berets, Jim
+@cindex MacKenzie, David
+@cindex Meyering, Jim
+@cindex Eggert, Paul
+@code{parse_datetime} started life as @code{getdate}, as originally
+implemented by Steven M. Bellovin
+(@email{smb@@research.att.com}) while at the University of North Carolina
+at Chapel Hill.  The code was later tweaked by a couple of people on
+Usenet, then completely overhauled by Rich $alz (@email{rsalz@@bbn.com})
+and Jim Berets (@email{jberets@@bbn.com}) in August, 1990.  Various
+revisions for the GNU system were made by David MacKenzie, Jim Meyering,
+Paul Eggert and others, including renaming it to @code{get_date} to
+avoid a conflict with the alternative Posix function @code{getdate},
+and a later rename to @code{parse_datetime}.  The Posix function
+@code{getdate} can parse more locale-specific dates using
+@code{strptime}, but relies on an environment variable and external
+file, and lacks the thread-safety of @code{parse_datetime}.
+
+@cindex Pinard, F.
+@cindex Berry, K.
+This chapter was originally produced by Fran@,{c}ois Pinard
+(@email{pinard@@iro.umontreal.ca}) from the @file{parse_datetime.y} source code,
+and then edited by K. Berry (@email{kb@@cs.umb.edu}).
deleted file mode 120000 (symlink)
index 5904f87bc12896f1da2520558f116250ef0b7bf2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/_Noreturn.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7326bd477331b4acbe93a119f3cc86b5ea3148b8
--- /dev/null
@@ -0,0 +1,50 @@
+/* A C macro for declaring that a function does not return.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _Noreturn
+# if (defined __cplusplus \
+      && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
+          || (defined _MSC_VER && 1900 <= _MSC_VER)) \
+      && 0)
+    /* [[noreturn]] is not practically usable, because with it the syntax
+         extern _Noreturn void func (...);
+       would not be valid; such a declaration would only be valid with 'extern'
+       and '_Noreturn' swapped, or without the 'extern' keyword.  However, some
+       AIX system header files and several gnulib header files use precisely
+       this syntax with 'extern'.  */
+#  define _Noreturn [[noreturn]]
+# elif (defined __clang__ && __clang_major__ < 16 \
+        && defined _GL_WORK_AROUND_LLVM_BUG_59792)
+   /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
+      that rare LLVM bug, though you may get many false-alarm warnings.  */
+#  define _Noreturn
+# elif ((!defined __cplusplus || defined __clang__) \
+        && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
+            || (!defined __STRICT_ANSI__ \
+                && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
+                    || (defined __apple_build_version__ \
+                        ? 6000000 <= __apple_build_version__ \
+                        : 3 < __clang_major__ + (5 <= __clang_minor__))))))
+   /* _Noreturn works as-is.  */
+# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
+        || 0x5110 <= __SUNPRO_C)
+#  define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn
+# endif
+#endif
deleted file mode 120000 (symlink)
index b8dc6bb4228d0c2c5bcacab8440a5aef31f78662..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/accept.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..18ce80c68e0b976a980fbbcbfe74d9b40a0f69a6
--- /dev/null
@@ -0,0 +1,52 @@
+/* accept.c --- wrappers for Windows accept function
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef accept
+
+int
+rpl_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
+{
+  SOCKET sock = FD_TO_SOCKET (fd);
+
+  if (sock == INVALID_SOCKET)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  else
+    {
+      SOCKET fh = accept (sock, addr, addrlen);
+      if (fh == INVALID_SOCKET)
+        {
+          set_winsock_errno ();
+          return -1;
+        }
+      else
+        return SOCKET_TO_FD (fh);
+    }
+}
deleted file mode 120000 (symlink)
index 1ea740df5b6efac9355bee0cb85b806b7389531a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/arg-nonnull.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..46c711ca1a128b87cc064a3d7594659cc5470b61
--- /dev/null
@@ -0,0 +1,26 @@
+/* A C macro for declaring that specific arguments must not be NULL.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
+   that the values passed as arguments n, ..., m must be non-NULL pointers.
+   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
+#ifndef _GL_ARG_NONNULL
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
+#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
+# else
+#  define _GL_ARG_NONNULL(params)
+# endif
+#endif
deleted file mode 120000 (symlink)
index 95a5c5e0808f0638f348aea8b8bc811dc7d0b364..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/array-mergesort.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..43be96fdf4d46e2c4ae802b0a29d0d6c4c11c115
--- /dev/null
@@ -0,0 +1,281 @@
+/* Stable-sorting of an array using mergesort.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file implements stable sorting of an array, using the mergesort
+   algorithm.
+   Worst-case running time for an array of length N is O(N log N).
+   Unlike the mpsort module, the algorithm here attempts to minimize not
+   only the number of comparisons, but also the number of copying operations.
+
+   Before including this file, you need to define
+     ELEMENT      The type of every array element.
+     COMPARE      A two-argument macro that takes two 'const ELEMENT *'
+                  pointers and returns a negative, zero, or positive 'int'
+                  value if the element pointed to by the first argument is,
+                  respectively, less, equal, or greater than the element
+                  pointed to by the second argument.
+     STATIC       The storage class of the functions being defined.
+     STATIC_FROMTO  (Optional.) Overrides STATIC for the 'merge_sort_fromto'
+                    function.
+   Before including this file, you also need to include:
+     #include <stddef.h>
+ */
+
+/* Merge the sorted arrays src1[0..n1-1] and src2[0..n2-1] into
+   dst[0..n1+n2-1].  In case of ambiguity, put the elements of src1
+   before the elements of src2.
+   n1 and n2 must be > 0.
+   The arrays src1 and src2 must not overlap the dst array, except that
+   src1 may be dst[n2..n1+n2-1], or src2 may be dst[n1..n1+n2-1].  */
+static void
+merge (const ELEMENT *src1, size_t n1,
+       const ELEMENT *src2, size_t n2,
+       ELEMENT *dst)
+{
+  for (;;) /* while (n1 > 0 && n2 > 0) */
+    {
+      if (COMPARE (src1, src2) <= 0)
+        {
+          *dst++ = *src1++;
+          n1--;
+          if (n1 == 0)
+            break;
+        }
+      else
+        {
+          *dst++ = *src2++;
+          n2--;
+          if (n2 == 0)
+            break;
+        }
+    }
+  /* Here n1 == 0 || n2 == 0 but also n1 > 0 || n2 > 0.  */
+  if (n1 > 0)
+    {
+      if (dst != src1)
+        do
+          {
+            *dst++ = *src1++;
+            n1--;
+          }
+        while (n1 > 0);
+    }
+  else /* n2 > 0 */
+    {
+      if (dst != src2)
+        do
+          {
+            *dst++ = *src2++;
+            n2--;
+          }
+        while (n2 > 0);
+    }
+}
+
+/* Sort src[0..n-1] into dst[0..n-1], using tmp[0..n/2-1] as temporary
+   (scratch) storage.
+   The arrays src, dst, tmp must not overlap.  */
+#ifdef STATIC_FROMTO
+STATIC_FROMTO
+#else
+STATIC
+#endif
+void
+merge_sort_fromto (const ELEMENT *src, ELEMENT *dst, size_t n, ELEMENT *tmp)
+{
+  switch (n)
+    {
+    case 0:
+      return;
+    case 1:
+      /* Nothing to do.  */
+      dst[0] = src[0];
+      return;
+    case 2:
+      /* Trivial case.  */
+      if (COMPARE (&src[0], &src[1]) <= 0)
+        {
+          /* src[0] <= src[1] */
+          dst[0] = src[0];
+          dst[1] = src[1];
+        }
+      else
+        {
+          dst[0] = src[1];
+          dst[1] = src[0];
+        }
+      break;
+    case 3:
+      /* Simple case.  */
+      if (COMPARE (&src[0], &src[1]) <= 0)
+        {
+          if (COMPARE (&src[1], &src[2]) <= 0)
+            {
+              /* src[0] <= src[1] <= src[2] */
+              dst[0] = src[0];
+              dst[1] = src[1];
+              dst[2] = src[2];
+            }
+          else if (COMPARE (&src[0], &src[2]) <= 0)
+            {
+              /* src[0] <= src[2] < src[1] */
+              dst[0] = src[0];
+              dst[1] = src[2];
+              dst[2] = src[1];
+            }
+          else
+            {
+              /* src[2] < src[0] <= src[1] */
+              dst[0] = src[2];
+              dst[1] = src[0];
+              dst[2] = src[1];
+            }
+        }
+      else
+        {
+          if (COMPARE (&src[0], &src[2]) <= 0)
+            {
+              /* src[1] < src[0] <= src[2] */
+              dst[0] = src[1];
+              dst[1] = src[0];
+              dst[2] = src[2];
+            }
+          else if (COMPARE (&src[1], &src[2]) <= 0)
+            {
+              /* src[1] <= src[2] < src[0] */
+              dst[0] = src[1];
+              dst[1] = src[2];
+              dst[2] = src[0];
+            }
+          else
+            {
+              /* src[2] < src[1] < src[0] */
+              dst[0] = src[2];
+              dst[1] = src[1];
+              dst[2] = src[0];
+            }
+        }
+      break;
+    default:
+      {
+        size_t n1 = n / 2;
+        size_t n2 = (n + 1) / 2;
+        /* Note: n1 + n2 = n, n1 <= n2.  */
+        /* Sort src[n1..n-1] into dst[n1..n-1], scratching tmp[0..n2/2-1].  */
+        merge_sort_fromto (src + n1, dst + n1, n2, tmp);
+        /* Sort src[0..n1-1] into tmp[0..n1-1], scratching dst[0..n1-1].  */
+        merge_sort_fromto (src, tmp, n1, dst);
+        /* Merge the two half results.  */
+        merge (tmp, n1, dst + n1, n2, dst);
+      }
+      break;
+    }
+}
+
+/* Sort src[0..n-1], using tmp[0..n-1] as temporary (scratch) storage.
+   The arrays src, tmp must not overlap. */
+STATIC void
+merge_sort_inplace (ELEMENT *src, size_t n, ELEMENT *tmp)
+{
+  switch (n)
+    {
+    case 0:
+    case 1:
+      /* Nothing to do.  */
+      return;
+    case 2:
+      /* Trivial case.  */
+      if (COMPARE (&src[0], &src[1]) <= 0)
+        {
+          /* src[0] <= src[1] */
+        }
+      else
+        {
+          ELEMENT t = src[0];
+          src[0] = src[1];
+          src[1] = t;
+        }
+      break;
+    case 3:
+      /* Simple case.  */
+      if (COMPARE (&src[0], &src[1]) <= 0)
+        {
+          if (COMPARE (&src[1], &src[2]) <= 0)
+            {
+              /* src[0] <= src[1] <= src[2] */
+            }
+          else if (COMPARE (&src[0], &src[2]) <= 0)
+            {
+              /* src[0] <= src[2] < src[1] */
+              ELEMENT t = src[1];
+              src[1] = src[2];
+              src[2] = t;
+            }
+          else
+            {
+              /* src[2] < src[0] <= src[1] */
+              ELEMENT t = src[0];
+              src[0] = src[2];
+              src[2] = src[1];
+              src[1] = t;
+            }
+        }
+      else
+        {
+          if (COMPARE (&src[0], &src[2]) <= 0)
+            {
+              /* src[1] < src[0] <= src[2] */
+              ELEMENT t = src[0];
+              src[0] = src[1];
+              src[1] = t;
+            }
+          else if (COMPARE (&src[1], &src[2]) <= 0)
+            {
+              /* src[1] <= src[2] < src[0] */
+              ELEMENT t = src[0];
+              src[0] = src[1];
+              src[1] = src[2];
+              src[2] = t;
+            }
+          else
+            {
+              /* src[2] < src[1] < src[0] */
+              ELEMENT t = src[0];
+              src[0] = src[2];
+              src[2] = t;
+            }
+        }
+      break;
+    default:
+      {
+        size_t n1 = n / 2;
+        size_t n2 = (n + 1) / 2;
+        /* Note: n1 + n2 = n, n1 <= n2.  */
+        /* Sort src[n1..n-1], scratching tmp[0..n2-1].  */
+        merge_sort_inplace (src + n1, n2, tmp);
+        /* Sort src[0..n1-1] into tmp[0..n1-1], scratching tmp[n1..2*n1-1].  */
+        merge_sort_fromto (src, tmp, n1, tmp + n1);
+        /* Merge the two half results.  */
+        merge (tmp, n1, src + n1, n2, src);
+      }
+      break;
+    }
+}
+
+#undef ELEMENT
+#undef COMPARE
+#undef STATIC
deleted file mode 120000 (symlink)
index c1dd8f3de47e07c87dccd668df991aa708d5da70..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/atoll.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..84dd9579bc2a5518a402c1b354c68a6274b7bc93
--- /dev/null
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1997-1998, 2008-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if !_LIBC
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include <stdlib.h>
+
+#if _LIBC
+# undef atoll
+#endif
+
+
+/* Convert a string to a long long int.  */
+long long int
+atoll (const char *nptr)
+{
+  return strtoll (nptr, (char **) NULL, 10);
+}
deleted file mode 120000 (symlink)
index 477e1d154915402473f9cb002a640f20a41c73d2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/atomic-int-gnulib.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b459f34464797bfec791fa92c07b2c2db1023e98
--- /dev/null
@@ -0,0 +1,174 @@
+/* Atomic integers.  Useful for testing multithreaded locking primitives.
+   Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+
+/* Whether to use 'volatile' on some variables that communicate information
+   between threads.  If set to 0, a semaphore or a lock is used to protect
+   these variables.  If set to 1, 'volatile' is used; this is theoretically
+   equivalent but can lead to much slower execution (e.g. 30x slower total
+   run time on a 40-core machine), because 'volatile' does not imply any
+   synchronization/communication between different CPUs.  */
+#define USE_VOLATILE 0
+
+#if USE_POSIX_THREADS && HAVE_SEMAPHORE_H
+/* Whether to use a semaphore to communicate information between threads.
+   If set to 0, a lock is used. If set to 1, a semaphore is used.
+   Uncomment this to reduce the dependencies of this test.  */
+# define USE_SEMAPHORE 1
+/* Mac OS X provides only named semaphores (sem_open); its facility for
+   unnamed semaphores (sem_init) does not work.  */
+# if defined __APPLE__ && defined __MACH__
+#  define USE_NAMED_SEMAPHORE 1
+# else
+#  define USE_UNNAMED_SEMAPHORE 1
+# endif
+#endif
+
+
+#if USE_SEMAPHORE
+# include <errno.h>
+# include <fcntl.h>
+# include <semaphore.h>
+# include <unistd.h>
+#endif
+
+
+#if USE_VOLATILE
+struct atomic_int {
+  volatile int value;
+};
+static void
+init_atomic_int (struct atomic_int *ai)
+{
+}
+static int
+get_atomic_int_value (struct atomic_int *ai)
+{
+  return ai->value;
+}
+static void
+set_atomic_int_value (struct atomic_int *ai, int new_value)
+{
+  ai->value = new_value;
+}
+#elif USE_SEMAPHORE
+/* This atomic_int implementation can only support the values 0 and 1.
+   It is initially 0 and can be set to 1 only once.  */
+# if USE_UNNAMED_SEMAPHORE
+struct atomic_int {
+  sem_t semaphore;
+};
+#define atomic_int_semaphore(ai) (&(ai)->semaphore)
+static void
+init_atomic_int (struct atomic_int *ai)
+{
+  sem_init (&ai->semaphore, 0, 0);
+}
+# endif
+# if USE_NAMED_SEMAPHORE
+struct atomic_int {
+  sem_t *semaphore;
+};
+#define atomic_int_semaphore(ai) ((ai)->semaphore)
+static void
+init_atomic_int (struct atomic_int *ai)
+{
+  sem_t *s;
+  unsigned int count;
+  for (count = 0; ; count++)
+    {
+      char name[80];
+      /* Use getpid() in the name, so that different processes running at the
+         same time will not interfere.  Use ai in the name, so that different
+         atomic_int in the same process will not interfere.  Use a count in
+         the name, so that even in the (unlikely) case that a semaphore with
+         the specified name already exists, we can try a different name.  */
+      sprintf (name, "test-lock-%lu-%p-%u",
+               (unsigned long) getpid (), ai, count);
+      s = sem_open (name, O_CREAT | O_EXCL, 0600, 0);
+      if (s == SEM_FAILED)
+        {
+          if (errno == EEXIST)
+            /* Retry with a different name.  */
+            continue;
+          else
+            {
+              perror ("sem_open failed");
+              fflush (stderr);
+              abort ();
+            }
+        }
+      else
+        {
+          /* Try not to leave a semaphore hanging around on the file system
+             eternally, if we can avoid it.  */
+          sem_unlink (name);
+          break;
+        }
+    }
+  ai->semaphore = s;
+}
+# endif
+static int
+get_atomic_int_value (struct atomic_int *ai)
+{
+  if (sem_trywait (atomic_int_semaphore (ai)) == 0)
+    {
+      if (sem_post (atomic_int_semaphore (ai)))
+        abort ();
+      return 1;
+    }
+  else if (errno == EAGAIN)
+    return 0;
+  else
+    abort ();
+}
+static void
+set_atomic_int_value (struct atomic_int *ai, int new_value)
+{
+  if (new_value == 0)
+    /* It's already initialized with 0.  */
+    return;
+  /* To set the value 1: */
+  if (sem_post (atomic_int_semaphore (ai)))
+    abort ();
+}
+#else
+struct atomic_int {
+  gl_lock_define (, lock)
+  int value;
+};
+static void
+init_atomic_int (struct atomic_int *ai)
+{
+  gl_lock_init (ai->lock);
+}
+static int
+get_atomic_int_value (struct atomic_int *ai)
+{
+  gl_lock_lock (ai->lock);
+  int ret = ai->value;
+  gl_lock_unlock (ai->lock);
+  return ret;
+}
+static void
+set_atomic_int_value (struct atomic_int *ai, int new_value)
+{
+  gl_lock_lock (ai->lock);
+  ai->value = new_value;
+  gl_lock_unlock (ai->lock);
+}
+#endif
deleted file mode 120000 (symlink)
index 9a9d8062e37bf64bf32a0e9e558ef31ccfbcbbcb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/atomic-int-posix.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aa0d914cb5bf3e4418f82a904eda00b167b90112
--- /dev/null
@@ -0,0 +1,179 @@
+/* Atomic integers.  Useful for testing multithreaded locking primitives.
+   Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+
+/* Whether to use 'volatile' on some variables that communicate information
+   between threads.  If set to 0, a semaphore or a lock is used to protect
+   these variables.  If set to 1, 'volatile' is used; this is theoretically
+   equivalent but can lead to much slower execution (e.g. 30x slower total
+   run time on a 40-core machine), because 'volatile' does not imply any
+   synchronization/communication between different CPUs.  */
+#define USE_VOLATILE 0
+
+#if USE_POSIX_THREADS && HAVE_SEMAPHORE_H
+/* Whether to use a semaphore to communicate information between threads.
+   If set to 0, a lock is used. If set to 1, a semaphore is used.
+   Uncomment this to reduce the dependencies of this test.  */
+# define USE_SEMAPHORE 1
+/* Mac OS X provides only named semaphores (sem_open); its facility for
+   unnamed semaphores (sem_init) does not work.  */
+# if defined __APPLE__ && defined __MACH__
+#  define USE_NAMED_SEMAPHORE 1
+# else
+#  define USE_UNNAMED_SEMAPHORE 1
+# endif
+#endif
+
+
+#if USE_SEMAPHORE
+# include <errno.h>
+# include <fcntl.h>
+# include <semaphore.h>
+# include <unistd.h>
+#endif
+
+
+#if USE_VOLATILE
+struct atomic_int {
+  volatile int value;
+};
+static void
+init_atomic_int (struct atomic_int *ai)
+{
+}
+static int
+get_atomic_int_value (struct atomic_int *ai)
+{
+  return ai->value;
+}
+static void
+set_atomic_int_value (struct atomic_int *ai, int new_value)
+{
+  ai->value = new_value;
+}
+#elif USE_SEMAPHORE
+/* This atomic_int implementation can only support the values 0 and 1.
+   It is initially 0 and can be set to 1 only once.  */
+# if USE_UNNAMED_SEMAPHORE
+struct atomic_int {
+  sem_t semaphore;
+};
+#define atomic_int_semaphore(ai) (&(ai)->semaphore)
+static void
+init_atomic_int (struct atomic_int *ai)
+{
+  sem_init (&ai->semaphore, 0, 0);
+}
+# endif
+# if USE_NAMED_SEMAPHORE
+struct atomic_int {
+  sem_t *semaphore;
+};
+#define atomic_int_semaphore(ai) ((ai)->semaphore)
+static void
+init_atomic_int (struct atomic_int *ai)
+{
+  sem_t *s;
+  unsigned int count;
+  for (count = 0; ; count++)
+    {
+      char name[80];
+      /* Use getpid() in the name, so that different processes running at the
+         same time will not interfere.  Use ai in the name, so that different
+         atomic_int in the same process will not interfere.  Use a count in
+         the name, so that even in the (unlikely) case that a semaphore with
+         the specified name already exists, we can try a different name.  */
+      sprintf (name, "test-lock-%lu-%p-%u",
+               (unsigned long) getpid (), ai, count);
+      s = sem_open (name, O_CREAT | O_EXCL, 0600, 0);
+      if (s == SEM_FAILED)
+        {
+          if (errno == EEXIST)
+            /* Retry with a different name.  */
+            continue;
+          else
+            {
+              perror ("sem_open failed");
+              fflush (stderr);
+              abort ();
+            }
+        }
+      else
+        {
+          /* Try not to leave a semaphore hanging around on the file system
+             eternally, if we can avoid it.  */
+          sem_unlink (name);
+          break;
+        }
+    }
+  ai->semaphore = s;
+}
+# endif
+static int
+get_atomic_int_value (struct atomic_int *ai)
+{
+  if (sem_trywait (atomic_int_semaphore (ai)) == 0)
+    {
+      if (sem_post (atomic_int_semaphore (ai)))
+        abort ();
+      return 1;
+    }
+  else if (errno == EAGAIN)
+    return 0;
+  else
+    abort ();
+}
+static void
+set_atomic_int_value (struct atomic_int *ai, int new_value)
+{
+  if (new_value == 0)
+    /* It's already initialized with 0.  */
+    return;
+  /* To set the value 1: */
+  if (sem_post (atomic_int_semaphore (ai)))
+    abort ();
+}
+#else
+struct atomic_int {
+  pthread_mutex_t lock;
+  int value;
+};
+static void
+init_atomic_int (struct atomic_int *ai)
+{
+  pthread_mutexattr_t attr;
+
+  ASSERT (pthread_mutexattr_init (&attr) == 0);
+  ASSERT (pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_NORMAL) == 0);
+  ASSERT (pthread_mutex_init (&ai->lock, &attr) == 0);
+  ASSERT (pthread_mutexattr_destroy (&attr) == 0);
+}
+static int
+get_atomic_int_value (struct atomic_int *ai)
+{
+  ASSERT (pthread_mutex_lock (&ai->lock) == 0);
+  int ret = ai->value;
+  ASSERT (pthread_mutex_unlock (&ai->lock) == 0);
+  return ret;
+}
+static void
+set_atomic_int_value (struct atomic_int *ai, int new_value)
+{
+  ASSERT (pthread_mutex_lock (&ai->lock) == 0);
+  ai->value = new_value;
+  ASSERT (pthread_mutex_unlock (&ai->lock) == 0);
+}
+#endif
deleted file mode 120000 (symlink)
index f4e23a207f21231ae5041991cfba7ec853ff1b12..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/bench-digest.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..23cb811df77d691f684c2aa6336a1a26337a7abd
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "bench.h"
+
+int
+main (int argc, char *argv[])
+{
+  if (argc != 3)
+    {
+      fprintf (stderr, "Usage: %s SIZE REPETITIONS\n", argv[0]);
+      exit (1);
+    }
+
+  size_t size = atol (argv[1]);
+  int repeat = atoi (argv[2]);
+
+  char *memblock = (char *) malloc (size);
+  if (!memblock)
+    {
+      fprintf (stderr, "%s: memory exhausted\n", argv[0]);
+      return 1;
+    }
+
+  /* Fill the memory block.  */
+  {
+    size_t i;
+    for (i = 0; i < size; i++)
+      memblock[i] =
+        (unsigned char) (((i * (i-1) * (i-5)) >> 6) + (i % 499) + (i % 101));
+  }
+
+  struct timings_state ts;
+  timing_start (&ts);
+
+  int count;
+  for (count = 0; count < repeat; count++)
+    {
+      char digest[64];
+      FUNC (memblock, size, digest);
+    }
+
+  timing_end (&ts);
+  timing_output (&ts);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 674aa60d96730cfeda1807d21e0f4194dfd31a2d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/bench-md5.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ca2e13677c038b328e9d71c08545598ea665c573
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Benchmark program for the md5_buffer function.  */
+
+#include <config.h>
+
+#include "md5.h"
+
+#define FUNC md5_buffer
+#include "bench-digest.h"
deleted file mode 120000 (symlink)
index b62e2f0f591af5b6ad816a5d7c7c737b2c8124ac..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/bench-sha1.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..28539e6f4637614ef5a60d0b1c2e3998d31a2ad1
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Benchmark program for the sha1_buffer function.  */
+
+#include <config.h>
+
+#include "sha1.h"
+
+#define FUNC sha1_buffer
+#include "bench-digest.h"
deleted file mode 120000 (symlink)
index 49ad101c781b05199d088db3b0b5583618571ff9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/bench-sha224.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d7c2b6e4a110e187daa1c6d13fcc5f5f2b8b32d5
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Benchmark program for the sha224_buffer function.  */
+
+#include <config.h>
+
+#include "sha256.h"
+
+#define FUNC sha224_buffer
+#include "bench-digest.h"
deleted file mode 120000 (symlink)
index ab38090023642beb49228d178c96a299ab99fe94..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/bench-sha256.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..378f4de5202cd706ac4c05d54be38575e270ca93
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Benchmark program for the sha256_buffer function.  */
+
+#include <config.h>
+
+#include "sha256.h"
+
+#define FUNC sha256_buffer
+#include "bench-digest.h"
deleted file mode 120000 (symlink)
index 3ff55edbe1329818fdfb5d68010bd7a50df9c642..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/bench-sha384.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b3f6f9340edeb0e85c901ed972a9a24afaf7404d
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Benchmark program for the sha384_buffer function.  */
+
+#include <config.h>
+
+#include "sha512.h"
+
+#define FUNC sha384_buffer
+#include "bench-digest.h"
deleted file mode 120000 (symlink)
index 47a56da680792780a3ea3b4e9d198bab79f6f95f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/bench-sha512.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1df62fb31be9cabf8a976bea173f72028e7f554c
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Benchmark program for the sha512_buffer function.  */
+
+#include <config.h>
+
+#include "sha512.h"
+
+#define FUNC sha512_buffer
+#include "bench-digest.h"
deleted file mode 120000 (symlink)
index 9821f8666cf77fce850710af31209a2937cd2a6e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/bench.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b64e6c9d7c26a15e1ae5f7ad7bdf062dbfbaf822
--- /dev/null
@@ -0,0 +1,69 @@
+/* Utilities for benchmarks.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+
+struct timings_state
+{
+  /* Filled when the timings start.  */
+  struct timeval real_start;
+  struct timeval user_start;
+  struct timeval sys_start;
+  /* Filled when the timings end.  */
+  long real_usec;
+  long user_usec;
+  long sys_usec;
+};
+
+static void
+timing_start (struct timings_state *ts)
+{
+  struct rusage usage;
+
+  getrusage (RUSAGE_SELF, &usage);
+  ts->user_start = usage.ru_utime;
+  ts->sys_start = usage.ru_stime;
+
+  gettimeofday (&ts->real_start, NULL);
+}
+
+static void
+timing_end (struct timings_state *ts)
+{
+  struct timeval real_end;
+  struct rusage usage;
+
+  gettimeofday (&real_end, NULL);
+
+  getrusage (RUSAGE_SELF, &usage);
+
+  ts->real_usec = (real_end.tv_sec - ts->real_start.tv_sec) * 1000000
+                  + real_end.tv_usec - ts->real_start.tv_usec;
+  ts->user_usec = (usage.ru_utime.tv_sec - ts->user_start.tv_sec) * 1000000
+                  + usage.ru_utime.tv_usec - ts->user_start.tv_usec;
+  ts->sys_usec = (usage.ru_stime.tv_sec - ts->sys_start.tv_sec) * 1000000
+                 + usage.ru_stime.tv_usec - ts->sys_start.tv_usec;
+}
+
+_GL_UNUSED static void
+timing_output (const struct timings_state *ts)
+{
+  printf ("real %10.6f\n", (double)ts->real_usec / 1000000.0);
+  printf ("user %7.3f\n", (double)ts->user_usec / 1000000.0);
+  printf ("sys  %7.3f\n", (double)ts->sys_usec / 1000000.0);
+}
deleted file mode 120000 (symlink)
index 034fc10094269c00fe5ea25b52455c7b20d7f522..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/bind.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7c5574487aee615c35a3c533e6e557a2b439d4ec
--- /dev/null
@@ -0,0 +1,49 @@
+/* bind.c --- wrappers for Windows bind function
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef bind
+
+int
+rpl_bind (int fd, const struct sockaddr *sockaddr, socklen_t len)
+{
+  SOCKET sock = FD_TO_SOCKET (fd);
+
+  if (sock == INVALID_SOCKET)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  else
+    {
+      int r = bind (sock, sockaddr, len);
+      if (r < 0)
+        set_winsock_errno ();
+
+      return r;
+    }
+}
deleted file mode 120000 (symlink)
index 26b3f35b1212c68a82f4a921c537ba3f8004aca3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c++defs.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eb66967b09be29a360fd3a65c937b1ea4501cc34
--- /dev/null
@@ -0,0 +1,337 @@
+/* C++ compatible function declaration macros.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_CXXDEFS_H
+#define _GL_CXXDEFS_H
+
+/* Begin/end the GNULIB_NAMESPACE namespace.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
+# define _GL_END_NAMESPACE }
+#else
+# define _GL_BEGIN_NAMESPACE
+# define _GL_END_NAMESPACE
+#endif
+
+/* The three most frequent use cases of these macros are:
+
+   * For providing a substitute for a function that is missing on some
+     platforms, but is declared and works fine on the platforms on which
+     it exists:
+
+       #if @GNULIB_FOO@
+       # if !@HAVE_FOO@
+       _GL_FUNCDECL_SYS (foo, ...);
+       # endif
+       _GL_CXXALIAS_SYS (foo, ...);
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+
+   * For providing a replacement for a function that exists on all platforms,
+     but is broken/insufficient and needs to be replaced on some platforms:
+
+       #if @GNULIB_FOO@
+       # if @REPLACE_FOO@
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+       #   undef foo
+       #   define foo rpl_foo
+       #  endif
+       _GL_FUNCDECL_RPL (foo, ...);
+       _GL_CXXALIAS_RPL (foo, ...);
+       # else
+       _GL_CXXALIAS_SYS (foo, ...);
+       # endif
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+
+   * For providing a replacement for a function that exists on some platforms
+     but is broken/insufficient and needs to be replaced on some of them and
+     is additionally either missing or undeclared on some other platforms:
+
+       #if @GNULIB_FOO@
+       # if @REPLACE_FOO@
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+       #   undef foo
+       #   define foo rpl_foo
+       #  endif
+       _GL_FUNCDECL_RPL (foo, ...);
+       _GL_CXXALIAS_RPL (foo, ...);
+       # else
+       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
+       _GL_FUNCDECL_SYS (foo, ...);
+       #  endif
+       _GL_CXXALIAS_SYS (foo, ...);
+       # endif
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+*/
+
+/* _GL_EXTERN_C declaration;
+   performs the declaration with C linkage.  */
+#if defined __cplusplus
+# define _GL_EXTERN_C extern "C"
+#else
+# define _GL_EXTERN_C extern
+#endif
+
+/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
+   declares a replacement function, named rpl_func, with the given prototype,
+   consisting of return type, parameters, and attributes.
+   Example:
+     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
+                                  _GL_ARG_NONNULL ((1)));
+
+   Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
+   of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode.  (That's
+   because
+     [[...]] extern "C" <declaration>;
+   is invalid syntax in C++.)
+ */
+#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
+  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
+#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
+  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
+
+/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
+   declares the system function, named func, with the given prototype,
+   consisting of return type, parameters, and attributes.
+   Example:
+     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
+                                  _GL_ARG_NONNULL ((1)));
+ */
+#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
+  _GL_EXTERN_C rettype func parameters_and_attributes
+
+/* _GL_CXXALIAS_RPL (func, rettype, parameters);
+   declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
+   Example:
+     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
+
+   Wrapping rpl_func in an object with an inline conversion operator
+   avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
+   actually used in the program.  */
+#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                                \
+    {                                                         \
+      static const struct _gl_ ## func ## _wrapper            \
+      {                                                       \
+        typedef rettype (*type) parameters;                   \
+                                                              \
+        inline operator type () const                         \
+        {                                                     \
+          return ::rpl_func;                                  \
+        }                                                     \
+      } func = {};                                            \
+    }                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_MDA (func, rettype, parameters);
+   is to be used when func is a Microsoft deprecated alias, on native Windows.
+   It declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to _func, if GNULIB_NAMESPACE is defined.
+   Example:
+     _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+ */
+#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
+
+/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
+   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
+   except that the C function rpl_func may have a slightly different
+   declaration.  A cast is used to silence the "invalid conversion" error
+   that would otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                                     \
+    {                                                              \
+      static const struct _gl_ ## func ## _wrapper                 \
+      {                                                            \
+        typedef rettype (*type) parameters;                        \
+                                                                   \
+        inline operator type () const                              \
+        {                                                          \
+          return reinterpret_cast<type>(::rpl_func);               \
+        }                                                          \
+      } func = {};                                                 \
+    }                                                              \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
+   is like  _GL_CXXALIAS_MDA (func, rettype, parameters);
+   except that the C function func may have a slightly different declaration.
+   A cast is used to silence the "invalid conversion" error that would
+   otherwise occur.  */
+#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
+
+/* _GL_CXXALIAS_SYS (func, rettype, parameters);
+   declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to the system provided function func, if GNULIB_NAMESPACE
+   is defined.
+   Example:
+     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+
+   Wrapping func in an object with an inline conversion operator
+   avoids a reference to func unless GNULIB_NAMESPACE::func is
+   actually used in the program.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
+    namespace GNULIB_NAMESPACE                                \
+    {                                                         \
+      static const struct _gl_ ## func ## _wrapper            \
+      {                                                       \
+        typedef rettype (*type) parameters;                   \
+                                                              \
+        inline operator type () const                         \
+        {                                                     \
+          return ::func;                                      \
+        }                                                     \
+      } func = {};                                            \
+    }                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
+   except that the C function func may have a slightly different declaration.
+   A cast is used to silence the "invalid conversion" error that would
+   otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                          \
+    {                                                   \
+      static const struct _gl_ ## func ## _wrapper      \
+      {                                                 \
+        typedef rettype (*type) parameters;             \
+                                                        \
+        inline operator type () const                   \
+        {                                               \
+          return reinterpret_cast<type>(::func);        \
+        }                                               \
+      } func = {};                                      \
+    }                                                   \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
+   except that the C function is picked among a set of overloaded functions,
+   namely the one with rettype2 and parameters2.  Two consecutive casts
+   are used to silence the "cannot find a match" and "invalid conversion"
+   errors that would otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+  /* The outer cast must be a reinterpret_cast.
+     The inner cast: When the function is defined as a set of overloaded
+     functions, it works as a static_cast<>, choosing the designated variant.
+     When the function is defined as a single variant, it works as a
+     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
+    namespace GNULIB_NAMESPACE                                                \
+    {                                                                         \
+      static const struct _gl_ ## func ## _wrapper                            \
+      {                                                                       \
+        typedef rettype (*type) parameters;                                   \
+                                                                              \
+        inline operator type () const                                         \
+        {                                                                     \
+          return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
+        }                                                                     \
+      } func = {};                                                            \
+    }                                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIASWARN (func);
+   causes a warning to be emitted when ::func is used but not when
+   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
+   variants.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIASWARN(func) \
+   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
+# define _GL_CXXALIASWARN_1(func,namespace) \
+   _GL_CXXALIASWARN_2 (func, namespace)
+/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+   we enable the warning only when not optimizing.  */
+# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
+#  define _GL_CXXALIASWARN_2(func,namespace) \
+    _GL_WARN_ON_USE (func, \
+                     "The symbol ::" #func " refers to the system function. " \
+                     "Use " #namespace "::" #func " instead.")
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+#  define _GL_CXXALIASWARN_2(func,namespace) \
+     extern __typeof__ (func) func
+# else
+#  define _GL_CXXALIASWARN_2(func,namespace) \
+     _GL_EXTERN_C int _gl_cxxalias_dummy
+# endif
+#else
+# define _GL_CXXALIASWARN(func) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
+   causes a warning to be emitted when the given overloaded variant of ::func
+   is used but not when GNULIB_NAMESPACE::func is used.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
+   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
+                        GNULIB_NAMESPACE)
+# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
+   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
+/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+   we enable the warning only when not optimizing.  */
+# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+    _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
+                         "The symbol ::" #func " refers to the system function. " \
+                         "Use " #namespace "::" #func " instead.")
+# else
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+     _GL_EXTERN_C int _gl_cxxalias_dummy
+# endif
+#else
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+#endif /* _GL_CXXDEFS_H */
deleted file mode 120000 (symlink)
index 82223e60045704db6b3acc5c883477bb563b1f7f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c-strcasestr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e5648bf23435844f5004c2976a776be5a7e4f79c
--- /dev/null
@@ -0,0 +1,76 @@
+/* c-strcasestr.c -- case insensitive substring search in C locale
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2005.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "c-strcasestr.h"
+
+#include <string.h>
+
+#include "c-ctype.h"
+#include "c-strcase.h"
+
+/* Two-Way algorithm.  */
+#define RETURN_TYPE char *
+#define AVAILABLE(h, h_l, j, n_l)                       \
+  (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l))     \
+   && ((h_l) = (j) + (n_l)))
+#define CANON_ELEMENT c_tolower
+#define CMP_FUNC(p1, p2, l)                             \
+  c_strncasecmp ((const char *) (p1), (const char *) (p2), l)
+#include "str-two-way.h"
+
+/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
+   comparison from the C locale, regardless of the current locale.  */
+char *
+c_strcasestr (const char *haystack_start, const char *needle_start)
+{
+  const char *haystack = haystack_start;
+  const char *needle = needle_start;
+  size_t needle_len; /* Length of NEEDLE.  */
+  size_t haystack_len; /* Known minimum length of HAYSTACK.  */
+  bool ok = true; /* True if NEEDLE is prefix of HAYSTACK.  */
+
+  /* Determine length of NEEDLE, and in the process, make sure
+     HAYSTACK is at least as long (no point processing all of a long
+     NEEDLE if HAYSTACK is too short).  */
+  while (*haystack && *needle)
+    ok &= (c_tolower ((unsigned char) *haystack++)
+           == c_tolower ((unsigned char) *needle++));
+  if (*needle)
+    return NULL;
+  if (ok)
+    return (char *) haystack_start;
+  needle_len = needle - needle_start;
+  haystack = haystack_start + 1;
+  haystack_len = needle_len - 1;
+
+  /* Perform the search.  Abstract memory is considered to be an array
+     of 'unsigned char' values, not an array of 'char' values.  See
+     ISO C 99 section 6.2.6.1.  */
+  if (needle_len < LONG_NEEDLE_THRESHOLD)
+    return two_way_short_needle ((const unsigned char *) haystack,
+                                 haystack_len,
+                                 (const unsigned char *) needle_start,
+                                 needle_len);
+  return two_way_long_needle ((const unsigned char *) haystack, haystack_len,
+                              (const unsigned char *) needle_start,
+                              needle_len);
+}
+
+#undef LONG_NEEDLE_THRESHOLD
deleted file mode 120000 (symlink)
index 88e3f03dac720d74356bc35e2da099cf0dd0710c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c-strcasestr.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7f3ef1d49c30eff9d6de1435d7f1a4714e798bc9
--- /dev/null
@@ -0,0 +1,36 @@
+/* Case-insensitive searching in a string in C locale.
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef C_STRCASESTR_H
+#define C_STRCASESTR_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
+   comparison.  */
+extern char *c_strcasestr (const char *haystack, const char *needle);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* C_STRCASESTR_H */
deleted file mode 120000 (symlink)
index 27630cf6af47a731a94d61967866392910c54698..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32rtomb.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..260bf097f7e269059f59a18087569a0f6714a5f4
--- /dev/null
@@ -0,0 +1,132 @@
+/* Convert 32-bit wide character to multibyte character.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <uchar.h>
+
+#include <errno.h>
+#include <wchar.h>
+
+#include "attribute.h" /* FALLTHROUGH */
+#include "localcharset.h"
+#include "streq.h"
+
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
+size_t
+c32rtomb (char *s, char32_t wc, mbstate_t *ps)
+#undef c32rtomb
+{
+#if HAVE_WORKING_MBRTOC32
+
+# if C32RTOMB_RETVAL_BUG
+  if (s == NULL)
+    /* We know the NUL wide character corresponds to the NUL character.  */
+    return 1;
+# endif
+
+  return c32rtomb (s, wc, ps);
+
+#elif _GL_SMALL_WCHAR_T
+
+  if (s == NULL)
+    return wcrtomb (NULL, 0, ps);
+  else
+    {
+      /* Special-case all encodings that may produce wide character values
+         > WCHAR_MAX.  */
+      const char *encoding = locale_charset ();
+      if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+        {
+          /* Special-case the UTF-8 encoding.  Assume that the wide-character
+             encoding in a UTF-8 locale is UCS-2 or, equivalently, UTF-16.  */
+          if (wc < 0x80)
+            {
+              s[0] = (unsigned char) wc;
+              return 1;
+            }
+          else
+            {
+              int count;
+
+              if (wc < 0x800)
+                count = 2;
+              else if (wc < 0x10000)
+                {
+                  if (wc < 0xd800 || wc >= 0xe000)
+                    count = 3;
+                  else
+                    {
+                      errno = EILSEQ;
+                      return (size_t)(-1);
+                    }
+                }
+              else if (wc < 0x110000)
+                count = 4;
+              else
+                {
+                  errno = EILSEQ;
+                  return (size_t)(-1);
+                }
+
+              switch (count) /* note: code falls through cases! */
+                {
+                case 4: s[3] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x10000;
+                  FALLTHROUGH;
+                case 3: s[2] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x800;
+                  FALLTHROUGH;
+                case 2: s[1] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0xc0;
+              /*case 1:*/ s[0] = wc;
+                }
+              return count;
+            }
+        }
+      else
+        {
+          if ((wchar_t) wc == wc)
+            return wcrtomb (s, (wchar_t) wc, ps);
+          else
+            {
+              errno = EILSEQ;
+              return (size_t)(-1);
+            }
+        }
+    }
+
+#else
+
+  /* char32_t and wchar_t are equivalent.  */
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  if (wc != 0)
+    {
+      wc = unicode_to_locale_encoding (wc);
+      if (wc == 0)
+        {
+          errno = EILSEQ;
+          return (size_t)(-1);
+        }
+    }
+# endif
+  return wcrtomb (s, (wchar_t) wc, ps);
+
+#endif
+}
deleted file mode 120000 (symlink)
index 83af5f0e542927dee67241cd0ee5559012cc9994..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32tob.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..901c9249f86dcaf5dcc10838d6f8e71a0401a696
--- /dev/null
@@ -0,0 +1,70 @@
+/* Convert 32-bit wide character to unibyte character.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <config.h>
+
+#define IN_C32TOB
+/* Specification.  */
+#include <uchar.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
+#if _GL_WCHAR_T_IS_UCS4
+_GL_EXTERN_INLINE
+#endif
+int
+c32tob (wint_t wc)
+{
+#if HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4
+  /* The char32_t encoding of a multibyte character may be different than its
+     wchar_t encoding.  */
+  if (wc != WEOF)
+    {
+      mbstate_t state;
+      char buf[8];
+
+      mbszero (&state);
+      if (c32rtomb (buf, wc, &state) == 1)
+        return (unsigned char) buf[0];
+    }
+  return EOF;
+#elif _GL_SMALL_WCHAR_T
+  /* In all known encodings, unibyte characters correspond only to
+     characters in the BMP.  */
+  if (wc != WEOF && (wchar_t) wc == wc)
+    return wctob ((wchar_t) wc);
+  else
+    return EOF;
+#else
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  if (wc != 0)
+    {
+      wc = unicode_to_locale_encoding (wc);
+      if (wc == 0)
+        return EOF;
+    }
+# endif
+  return wctob (wc);
+#endif
+}
deleted file mode 120000 (symlink)
index 2a6e60be51532c226978b5bdb81791b7f20c59dc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/connect.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..421849c1b54a5796a0cf801109b0a5bf9a5a15ac
--- /dev/null
@@ -0,0 +1,56 @@
+/* connect.c --- wrappers for Windows connect function
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef connect
+
+int
+rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len)
+{
+  SOCKET sock = FD_TO_SOCKET (fd);
+
+  if (sock == INVALID_SOCKET)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  else
+    {
+      int r = connect (sock, sockaddr, len);
+      if (r < 0)
+        {
+          /* EINPROGRESS is not returned by WinSock 2.0; for backwards
+             compatibility, connect(2) uses EWOULDBLOCK.  */
+          if (WSAGetLastError () == WSAEWOULDBLOCK)
+            WSASetLastError (WSAEINPROGRESS);
+
+          set_winsock_errno ();
+        }
+
+      return r;
+    }
+}
deleted file mode 120000 (symlink)
index 42ccd1745eee6a6ecb550b4343a43bc261289445..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/creat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..81626f9164b421596203ca385d6f7bfbc473099a
--- /dev/null
@@ -0,0 +1,84 @@
+/* Create a file.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* If the user's config.h happens to include <fcntl.h>, let it include only
+   the system's <fcntl.h> here, so that orig_creat doesn't recurse to
+   rpl_creat.  */
+#define __need_system_fcntl_h
+#include <config.h>
+
+/* Get the original definition of creat.  It might be defined as a macro.  */
+#include <fcntl.h>
+#include <sys/types.h>
+#undef __need_system_fcntl_h
+
+static int
+orig_creat (const char *filename, mode_t mode)
+{
+#if defined _WIN32 && !defined __CYGWIN__
+  return _creat (filename, mode);
+#else
+  return creat (filename, mode);
+#endif
+}
+
+/* Specification.  */
+#ifdef __osf__
+/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
+   this include because of the preliminary #include <fcntl.h> above.  */
+# include "fcntl.h"
+#else
+# include <fcntl.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+creat (const char *filename, mode_t mode)
+{
+#if OPEN_TRAILING_SLASH_BUG
+  /* Fail if the filename ends in a slash,
+     as POSIX says such a filename must name a directory
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>:
+       "A pathname that contains at least one non-<slash> character and that
+        ends with one or more trailing <slash> characters shall not be resolved
+        successfully unless the last pathname component before the trailing
+        <slash> characters names an existing directory"
+     creat() is defined as being equivalent to open() with flags
+     O_CREAT | O_TRUNC | O_WRONLY.  Therefore:
+     If the named file already exists as a directory, then creat() must fail
+     with errno = EISDIR.
+     If the named file does not exist or does not name a directory, then
+     creat() must fail since creat() cannot create directories.  */
+  {
+    size_t len = strlen (filename);
+    if (len > 0 && filename[len - 1] == '/')
+      {
+        errno = EISDIR;
+        return -1;
+      }
+  }
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+  /* Remap the 'x' bits to the 'r' bits.  */
+  mode = (mode & ~0111) | ((mode & 0111) << 2);
+#endif
+
+  return orig_creat (filename, mode);
+}
deleted file mode 120000 (symlink)
index 62ece93b09d0b18fa99aff763c7d2cd9571d6099..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getrusage.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a332f7a5bd7ebca84aad40cbc3e03a5726c6e0fb
--- /dev/null
@@ -0,0 +1,131 @@
+/* getrusage replacement for systems which lack it.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible, 2012.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/resource.h>
+
+#include <errno.h>
+#include <string.h>
+
+/* Get uint64_t.  */
+#include <stdint.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+#else
+
+# include <sys/times.h>
+# include <unistd.h>
+#endif
+
+int
+getrusage (int who, struct rusage *usage_p)
+{
+  if (who == RUSAGE_SELF || who == RUSAGE_CHILDREN)
+    {
+      /* Clear all unsupported members of 'struct rusage'.  */
+      memset (usage_p, '\0', sizeof (struct rusage));
+
+#if defined _WIN32 && ! defined __CYGWIN__
+      if (who == RUSAGE_SELF)
+        {
+          /* Fill in the ru_utime and ru_stime members.  */
+          FILETIME creation_time;
+          FILETIME exit_time;
+          FILETIME kernel_time;
+          FILETIME user_time;
+
+          if (GetProcessTimes (GetCurrentProcess (),
+                               &creation_time, &exit_time,
+                               &kernel_time, &user_time))
+            {
+              /* Convert to microseconds, rounding.  */
+              uint64_t kernel_usec =
+                ((((uint64_t) kernel_time.dwHighDateTime << 32)
+                  | (uint64_t) kernel_time.dwLowDateTime)
+                 + 5) / 10;
+              uint64_t user_usec =
+                ((((uint64_t) user_time.dwHighDateTime << 32)
+                  | (uint64_t) user_time.dwLowDateTime)
+                 + 5) / 10;
+
+              usage_p->ru_utime.tv_sec = user_usec / 1000000U;
+              usage_p->ru_utime.tv_usec = user_usec % 1000000U;
+              usage_p->ru_stime.tv_sec = kernel_usec / 1000000U;
+              usage_p->ru_stime.tv_usec = kernel_usec % 1000000U;
+            }
+        }
+#else
+      /* Fill in the ru_utime and ru_stime members.  */
+      {
+        struct tms time;
+
+        if (times (&time) != (clock_t) -1)
+          {
+            /* Number of clock ticks per second.  */
+            unsigned int clocks_per_second = sysconf (_SC_CLK_TCK);
+
+            if (clocks_per_second > 0)
+              {
+                clock_t user_ticks;
+                clock_t system_ticks;
+
+                uint64_t user_usec;
+                uint64_t system_usec;
+
+                if (who == RUSAGE_CHILDREN)
+                  {
+                    user_ticks   = time.tms_cutime;
+                    system_ticks = time.tms_cstime;
+                  }
+                else
+                  {
+                    user_ticks   = time.tms_utime;
+                    system_ticks = time.tms_stime;
+                  }
+
+                user_usec =
+                  (((uint64_t) user_ticks * (uint64_t) 1000000U)
+                   + clocks_per_second / 2) / clocks_per_second;
+                system_usec =
+                  (((uint64_t) system_ticks * (uint64_t) 1000000U)
+                   + clocks_per_second / 2) / clocks_per_second;
+
+                usage_p->ru_utime.tv_sec = user_usec / 1000000U;
+                usage_p->ru_utime.tv_usec = user_usec % 1000000U;
+                usage_p->ru_stime.tv_sec = system_usec / 1000000U;
+                usage_p->ru_stime.tv_usec = system_usec % 1000000U;
+              }
+          }
+      }
+#endif
+
+      return 0;
+    }
+  else
+    {
+      errno = EINVAL;
+      return -1;
+    }
+}
deleted file mode 120000 (symlink)
index cf0568b07c1e0263fe31b7471eeff8d2d8c75b40..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/glthread/thread.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9c8c3035a402386bd1fc096f331d0e4be54ad613
--- /dev/null
@@ -0,0 +1,218 @@
+/* Creating and controlling threads.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "glthread/thread.h"
+
+#include <stdlib.h>
+#include "glthread/lock.h"
+
+/* ========================================================================= */
+
+#if USE_ISOC_THREADS
+
+struct thrd_with_exitvalue
+{
+  thrd_t volatile tid;
+  void * volatile exitvalue;
+};
+
+/* The Thread-Specific Storage (TSS) key that allows to access each thread's
+   'struct thrd_with_exitvalue *' pointer.  */
+static tss_t thrd_with_exitvalue_key;
+
+/* Initializes thrd_with_exitvalue_key.
+   This function must only be called once.  */
+static void
+do_init_thrd_with_exitvalue_key (void)
+{
+  if (tss_create (&thrd_with_exitvalue_key, NULL) != thrd_success)
+    abort ();
+}
+
+/* Initializes thrd_with_exitvalue_key.  */
+static void
+init_thrd_with_exitvalue_key (void)
+{
+  static once_flag once = ONCE_FLAG_INIT;
+  call_once (&once, do_init_thrd_with_exitvalue_key);
+}
+
+typedef union
+        {
+          struct thrd_with_exitvalue t;
+          struct
+          {
+            thrd_t tid; /* reserve memory for t.tid */
+            void *(*mainfunc) (void *);
+            void *arg;
+          } a;
+        }
+        main_arg_t;
+
+static int
+thrd_main_func (void *pmarg)
+{
+  /* Unpack the object that combines mainfunc and arg.  */
+  main_arg_t *main_arg = (main_arg_t *) pmarg;
+  void *(*mainfunc) (void *) = main_arg->a.mainfunc;
+  void *arg = main_arg->a.arg;
+
+  if (tss_set (thrd_with_exitvalue_key, &main_arg->t) != thrd_success)
+    abort ();
+
+  /* Execute mainfunc, with arg as argument.  */
+  {
+    void *exitvalue = mainfunc (arg);
+    /* Store the exitvalue, for use by glthread_join().  */
+    main_arg->t.exitvalue = exitvalue;
+    return 0;
+  }
+}
+
+int
+glthread_create (gl_thread_t *threadp, void *(*mainfunc) (void *), void *arg)
+{
+  init_thrd_with_exitvalue_key ();
+  {
+    /* Combine mainfunc and arg in a single object.
+       A stack-allocated object does not work, because it would be out of
+       existence when thrd_create returns before thrd_main_func is
+       entered.  So, allocate it in the heap.  */
+    main_arg_t *main_arg = (main_arg_t *) malloc (sizeof (main_arg_t));
+    if (main_arg == NULL)
+      return ENOMEM;
+    main_arg->a.mainfunc = mainfunc;
+    main_arg->a.arg = arg;
+    switch (thrd_create ((thrd_t *) &main_arg->t.tid, thrd_main_func, main_arg))
+      {
+      case thrd_success:
+        break;
+      case thrd_nomem:
+        free (main_arg);
+        return ENOMEM;
+      default:
+        free (main_arg);
+        return EAGAIN;
+      }
+    *threadp = &main_arg->t;
+    return 0;
+  }
+}
+
+gl_thread_t
+gl_thread_self (void)
+{
+  init_thrd_with_exitvalue_key ();
+  {
+    gl_thread_t thread =
+      (struct thrd_with_exitvalue *) tss_get (thrd_with_exitvalue_key);
+    if (thread == NULL)
+      {
+        /* This happens only in threads that have not been created through
+           glthread_create(), such as the main thread.  */
+        for (;;)
+          {
+            thread =
+              (struct thrd_with_exitvalue *)
+              malloc (sizeof (struct thrd_with_exitvalue));
+            if (thread != NULL)
+              break;
+            /* Memory allocation failed.  There is not much we can do.  Have to
+               busy-loop, waiting for the availability of memory.  */
+            {
+              struct timespec ts =
+                {
+                  .tv_sec = 1,
+                  .tv_nsec = 0
+                };
+              thrd_sleep (&ts, NULL);
+            }
+          }
+        thread->tid = thrd_current ();
+        thread->exitvalue = NULL; /* just to be deterministic */
+        if (tss_set (thrd_with_exitvalue_key, thread) != thrd_success)
+          abort ();
+      }
+    return thread;
+  }
+}
+
+int
+glthread_join (gl_thread_t thread, void **return_value_ptr)
+{
+  /* On Solaris 11.4, thrd_join crashes when the second argument we pass is
+     NULL.  */
+  int dummy;
+
+  if (thread == gl_thread_self ())
+    return EINVAL;
+  if (thrd_join (thread->tid, &dummy) != thrd_success)
+    return EINVAL;
+  if (return_value_ptr != NULL)
+    *return_value_ptr = thread->exitvalue;
+  free (thread);
+  return 0;
+}
+
+_Noreturn void
+gl_thread_exit (void *return_value)
+{
+  gl_thread_t thread = gl_thread_self ();
+  thread->exitvalue = return_value;
+  thrd_exit (0);
+}
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+#include <pthread.h>
+
+#if defined PTW32_VERSION || defined __MVS__
+
+const gl_thread_t gl_null_thread /* = { .p = NULL } */;
+
+#endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WINDOWS_THREADS
+
+#endif
+
+/* ========================================================================= */
+
+gl_thread_t
+gl_thread_create (void *(*func) (void *arg), void *arg)
+{
+  gl_thread_t thread;
+  int ret;
+
+  ret = glthread_create (&thread, func, arg);
+  if (ret != 0)
+    abort ();
+  return thread;
+}
deleted file mode 120000 (symlink)
index ecb5fe6ea75d2116525bb6f3ea7871c6a20ae93a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/glthread/thread.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..748bb0454cd3296ccb0bf1b8ba997ce0b0a9eccb
--- /dev/null
@@ -0,0 +1,346 @@
+/* Creating and controlling threads.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h.  */
+
+/* This file contains primitives for creating and controlling threads.
+
+   Thread data type: gl_thread_t.
+
+   Creating a thread:
+       thread = gl_thread_create (func, arg);
+   Or with control of error handling:
+       err = glthread_create (&thread, func, arg);
+       extern int glthread_create (gl_thread_t *result,
+                                   void *(*func) (void *), void *arg);
+
+   Querying and changing the signal mask of a thread (not supported on all
+   platforms):
+       gl_thread_sigmask (how, newmask, oldmask);
+   Or with control of error handling:
+       err = glthread_sigmask (how, newmask, oldmask);
+       extern int glthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask);
+
+   Waiting for termination of another thread:
+       gl_thread_join (thread, &return_value);
+   Or with control of error handling:
+       err = glthread_join (thread, &return_value);
+       extern int glthread_join (gl_thread_t thread, void **return_value_ptr);
+
+   Getting a reference to the current thread:
+       current = gl_thread_self ();
+       extern gl_thread_t gl_thread_self (void);
+
+   Getting a reference to the current thread as a pointer, for debugging:
+       ptr = gl_thread_self_pointer ();
+       extern void * gl_thread_self_pointer (void);
+
+   Terminating the current thread:
+       gl_thread_exit (return_value);
+       extern _Noreturn void gl_thread_exit (void *return_value);
+
+   Requesting custom code to be executed at fork() time (not supported on all
+   platforms):
+       gl_thread_atfork (prepare_func, parent_func, child_func);
+   Or with control of error handling:
+       err = glthread_atfork (prepare_func, parent_func, child_func);
+       extern int glthread_atfork (void (*prepare_func) (void),
+                                   void (*parent_func) (void),
+                                   void (*child_func) (void));
+   Note that even on platforms where this is supported, use of fork() and
+   threads together is problematic, see
+     <https://lists.gnu.org/r/bug-gnulib/2008-08/msg00062.html>
+ */
+
+
+#ifndef _GLTHREAD_THREAD_H
+#define _GLTHREAD_THREAD_H
+
+/* This file uses _Noreturn, HAVE_THREADS_H, HAVE_PTHREAD_ATFORK.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+
+#if !defined c11_threads_in_use
+# if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC
+#  define c11_threads_in_use() 1
+# elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK
+#  include <threads.h>
+#  pragma weak thrd_exit
+#  define c11_threads_in_use() (thrd_exit != NULL)
+# else
+#  define c11_threads_in_use() 0
+# endif
+#endif
+
+/* ========================================================================= */
+
+#if USE_ISOC_THREADS
+
+/* Use the ISO C threads library.  */
+
+# include <threads.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/* -------------------------- gl_thread_t datatype -------------------------- */
+
+typedef struct thrd_with_exitvalue *gl_thread_t;
+extern int glthread_create (gl_thread_t *threadp,
+                            void *(*func) (void *), void *arg);
+# define glthread_sigmask(HOW, SET, OSET) \
+    pthread_sigmask (HOW, SET, OSET)
+extern int glthread_join (gl_thread_t thread, void **return_value_ptr);
+extern gl_thread_t gl_thread_self (void);
+# define gl_thread_self_pointer() \
+    (void *) gl_thread_self ()
+extern _Noreturn void gl_thread_exit (void *return_value);
+# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+/* Use the POSIX threads library.  */
+
+# include <pthread.h>
+
+/* Get intptr_t.  */
+# include <stdint.h>
+
+/* On IRIX, pthread_atfork is declared in <unistd.h>, not in <pthread.h>.  */
+# if defined __sgi
+#  include <unistd.h>
+# endif
+
+# if USE_POSIX_THREADS_WEAK
+/* Compilers other than GCC need to see the declaration of pthread_sigmask
+   before the "#pragma weak pthread_sigmask" below.  */
+#  include <signal.h>
+# endif
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if PTHREAD_IN_USE_DETECTION_HARD
+
+/* The pthread_in_use() detection needs to be done at runtime.  */
+#  define pthread_in_use() \
+     glthread_in_use ()
+extern int glthread_in_use (void);
+
+# endif
+
+# if USE_POSIX_THREADS_WEAK
+
+/* Use weak references to the POSIX threads library.  */
+
+/* Weak references avoid dragging in external libraries if the other parts
+   of the program don't use them.  Here we use them, because we don't want
+   every program that uses libintl to depend on libpthread.  This assumes
+   that libpthread would not be loaded after libintl; i.e. if libintl is
+   loaded first, by an executable that does not depend on libpthread, and
+   then a module is dynamically loaded that depends on libpthread, libintl
+   will not be multithread-safe.  */
+
+/* The way to test at runtime whether libpthread is present is to test
+   whether a function pointer's value, such as &pthread_mutex_init, is
+   non-NULL.  However, some versions of GCC have a bug through which, in
+   PIC mode, &foo != NULL always evaluates to true if there is a direct
+   call to foo(...) in the same function.  To avoid this, we test the
+   address of a function in libpthread that we don't use.  */
+
+#  ifndef pthread_sigmask /* Do not declare rpl_pthread_sigmask weak.  */
+#   pragma weak pthread_sigmask
+#  endif
+
+#  pragma weak pthread_join
+#  ifndef pthread_self
+#   pragma weak pthread_self
+#  endif
+#  pragma weak pthread_exit
+#  if HAVE_PTHREAD_ATFORK
+#   pragma weak pthread_atfork
+#  endif
+
+#  if !PTHREAD_IN_USE_DETECTION_HARD
+#   pragma weak pthread_mutexattr_gettype
+#   define pthread_in_use() \
+      (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
+#  endif
+
+# else
+
+#  if !PTHREAD_IN_USE_DETECTION_HARD
+#   define pthread_in_use() 1
+#  endif
+
+# endif
+
+/* -------------------------- gl_thread_t datatype -------------------------- */
+
+/* This choice of gl_thread_t assumes that
+     pthread_equal (a, b)  is equivalent to  ((a) == (b)).
+   This is the case on all platforms in use in 2008.  */
+typedef pthread_t gl_thread_t;
+# define glthread_create(THREADP, FUNC, ARG) \
+    (pthread_in_use () ? pthread_create (THREADP, NULL, FUNC, ARG) : ENOSYS)
+# define glthread_sigmask(HOW, SET, OSET) \
+    (pthread_in_use () ? pthread_sigmask (HOW, SET, OSET) : 0)
+# define glthread_join(THREAD, RETVALP) \
+    (pthread_in_use () ? pthread_join (THREAD, RETVALP) : 0)
+# ifdef PTW32_VERSION
+   /* In pthreads-win32, pthread_t is a struct with a pointer field 'p' and
+      other fields.  */
+#  define gl_thread_self() \
+     (pthread_in_use () ? pthread_self () : gl_null_thread)
+#  define gl_thread_self_pointer() \
+     (pthread_in_use () ? pthread_self ().p : NULL)
+extern const gl_thread_t gl_null_thread;
+# elif defined __MVS__
+   /* On IBM z/OS, pthread_t is a struct with an 8-byte '__' field.
+      The first three bytes of this field appear to uniquely identify a
+      pthread_t, though not necessarily representing a pointer.  */
+#  define gl_thread_self() \
+     (pthread_in_use () ? pthread_self () : gl_null_thread)
+#  define gl_thread_self_pointer() \
+     (pthread_in_use () ? *((void **) pthread_self ().__) : NULL)
+extern const gl_thread_t gl_null_thread;
+# else
+#  define gl_thread_self() \
+     (pthread_in_use () ? pthread_self () : (pthread_t) 0)
+#  define gl_thread_self_pointer() \
+     (pthread_in_use () ? (void *) (intptr_t) (pthread_t) pthread_self () : NULL)
+# endif
+# define gl_thread_exit(RETVAL) \
+    (void) (pthread_in_use () ? (pthread_exit (RETVAL), 0) : 0)
+
+# if HAVE_PTHREAD_ATFORK
+#  define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) \
+     (pthread_in_use () ? pthread_atfork (PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) : 0)
+# else
+#  define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WINDOWS_THREADS
+
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+
+# include "windows-thread.h"
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/* -------------------------- gl_thread_t datatype -------------------------- */
+
+typedef glwthread_thread_t gl_thread_t;
+# define glthread_create(THREADP, FUNC, ARG) \
+    glwthread_thread_create (THREADP, 0, FUNC, ARG)
+# define glthread_sigmask(HOW, SET, OSET) \
+    /* unsupported */ 0
+# define glthread_join(THREAD, RETVALP) \
+    glwthread_thread_join (THREAD, RETVALP)
+# define gl_thread_self() \
+    glwthread_thread_self ()
+# define gl_thread_self_pointer() \
+    gl_thread_self ()
+# define gl_thread_exit(RETVAL) \
+    glwthread_thread_exit (RETVAL)
+# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS)
+
+/* Provide dummy implementation if threads are not supported.  */
+
+typedef int gl_thread_t;
+# define glthread_create(THREADP, FUNC, ARG) ENOSYS
+# define glthread_sigmask(HOW, SET, OSET) 0
+# define glthread_join(THREAD, RETVALP) 0
+# define gl_thread_self() 0
+# define gl_thread_self_pointer() \
+    ((void *) gl_thread_self ())
+# define gl_thread_exit(RETVAL) (void)0
+# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
+
+#endif
+
+/* ========================================================================= */
+
+/* Macros with built-in error handling.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern gl_thread_t gl_thread_create (void *(*func) (void *arg), void *arg);
+#define gl_thread_sigmask(HOW, SET, OSET)     \
+   do                                         \
+     {                                        \
+       if (glthread_sigmask (HOW, SET, OSET)) \
+         abort ();                            \
+     }                                        \
+   while (0)
+#define gl_thread_join(THREAD, RETVAL)     \
+   do                                      \
+     {                                     \
+       if (glthread_join (THREAD, RETVAL)) \
+         abort ();                         \
+     }                                     \
+   while (0)
+#define gl_thread_atfork(PREPARE, PARENT, CHILD)     \
+   do                                                \
+     {                                               \
+       if (glthread_atfork (PREPARE, PARENT, CHILD)) \
+         abort ();                                   \
+     }                                               \
+   while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GLTHREAD_THREAD_H */
deleted file mode 120000 (symlink)
index 079e89db41a928aa06095c8ba6e8c7430e776670..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/glthread/yield.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..29105cc2f3696357fd9a8b75098b1577a33042c2
--- /dev/null
@@ -0,0 +1,100 @@
+/* Yielding the processor to other threads and processes.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file contains a primitive for yielding the processor to other threads.
+     extern void gl_thread_yield (void);
+ */
+
+#ifndef _GLTHREAD_YIELD_H
+#define _GLTHREAD_YIELD_H
+
+#include <errno.h>
+
+/* ========================================================================= */
+
+#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+/* Use the ISO C threads library.  */
+
+# include <threads.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# define gl_thread_yield() \
+    thrd_yield ()
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+/* Use the POSIX threads library.  */
+
+# include <sched.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# define gl_thread_yield() \
+    sched_yield ()
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WINDOWS_THREADS
+
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# define gl_thread_yield() \
+    Sleep (0)
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS)
+
+/* Provide dummy implementation if threads are not supported.  */
+
+# define gl_thread_yield() 0
+
+#endif
+
+/* ========================================================================= */
+
+#endif /* _GLTHREAD_YIELD_H */
deleted file mode 120000 (symlink)
index 7bcd3078d4397ec8b4a3408f802f11797c8c8652..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/inet_pton.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2d29608d472b97602165f5b62e04feccdde0cadd
--- /dev/null
@@ -0,0 +1,268 @@
+/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
+
+   Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/*
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <config.h>
+
+/* Specification.  */
+#include <arpa/inet.h>
+
+#if HAVE_DECL_INET_PTON
+
+# undef inet_pton
+
+int
+rpl_inet_pton (int af, const char *restrict src, void *restrict dst)
+{
+  return inet_pton (af, src, dst);
+}
+
+#else
+
+# include <c-ctype.h>
+# include <string.h>
+# include <errno.h>
+
+# define NS_INADDRSZ 4
+# define NS_IN6ADDRSZ 16
+# define NS_INT16SZ 2
+
+/*
+ * WARNING: Don't even consider trying to compile this on a system where
+ * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
+ */
+
+static int inet_pton4 (const char *src, unsigned char *dst);
+# if HAVE_IPV6
+static int inet_pton6 (const char *src, unsigned char *dst);
+# endif
+
+/* int
+ * inet_pton(af, src, dst)
+ *      convert from presentation format (which usually means ASCII printable)
+ *      to network format (which is usually some kind of binary format).
+ * return:
+ *      1 if the address was valid for the specified address family
+ *      0 if the address wasn't valid ('dst' is untouched in this case)
+ *      -1 if some other error occurred ('dst' is untouched in this case, too)
+ * author:
+ *      Paul Vixie, 1996.
+ */
+int
+inet_pton (int af, const char *restrict src, void *restrict dst)
+{
+  switch (af)
+    {
+    case AF_INET:
+      return (inet_pton4 (src, dst));
+
+# if HAVE_IPV6
+    case AF_INET6:
+      return (inet_pton6 (src, dst));
+# endif
+
+    default:
+      errno = EAFNOSUPPORT;
+      return (-1);
+    }
+  /* NOTREACHED */
+}
+
+/* int
+ * inet_pton4(src, dst)
+ *      like inet_aton() but without all the hexadecimal, octal (with the
+ *      exception of 0) and shorthand.
+ * return:
+ *      1 if 'src' is a valid dotted quad, else 0.
+ * notice:
+ *      does not touch 'dst' unless it's returning 1.
+ * author:
+ *      Paul Vixie, 1996.
+ */
+static int
+inet_pton4 (const char *restrict src, unsigned char *restrict dst)
+{
+  int saw_digit, octets, ch;
+  unsigned char tmp[NS_INADDRSZ], *tp;
+
+  saw_digit = 0;
+  octets = 0;
+  *(tp = tmp) = 0;
+  while ((ch = *src++) != '\0')
+    {
+
+      if (ch >= '0' && ch <= '9')
+        {
+          unsigned new = *tp * 10 + (ch - '0');
+
+          if (saw_digit && *tp == 0)
+            return (0);
+          if (new > 255)
+            return (0);
+          *tp = new;
+          if (!saw_digit)
+            {
+              if (++octets > 4)
+                return (0);
+              saw_digit = 1;
+            }
+        }
+      else if (ch == '.' && saw_digit)
+        {
+          if (octets == 4)
+            return (0);
+          *++tp = 0;
+          saw_digit = 0;
+        }
+      else
+        return (0);
+    }
+  if (octets < 4)
+    return (0);
+  memcpy (dst, tmp, NS_INADDRSZ);
+  return (1);
+}
+
+# if HAVE_IPV6
+
+/* int
+ * inet_pton6(src, dst)
+ *      convert presentation level address to network order binary form.
+ * return:
+ *      1 if 'src' is a valid [RFC1884 2.2] address, else 0.
+ * notice:
+ *      (1) does not touch 'dst' unless it's returning 1.
+ *      (2) :: in a full address is silently ignored.
+ * credit:
+ *      inspired by Mark Andrews.
+ * author:
+ *      Paul Vixie, 1996.
+ */
+static int
+inet_pton6 (const char *restrict src, unsigned char *restrict dst)
+{
+  static const char xdigits[] = "0123456789abcdef";
+  unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
+  const char *curtok;
+  int ch, saw_xdigit;
+  unsigned val;
+
+  tp = memset (tmp, '\0', NS_IN6ADDRSZ);
+  endp = tp + NS_IN6ADDRSZ;
+  colonp = NULL;
+  /* Leading :: requires some special handling. */
+  if (*src == ':')
+    if (*++src != ':')
+      return (0);
+  curtok = src;
+  saw_xdigit = 0;
+  val = 0;
+  while ((ch = c_tolower (*src++)) != '\0')
+    {
+      const char *pch;
+
+      pch = strchr (xdigits, ch);
+      if (pch != NULL)
+        {
+          val <<= 4;
+          val |= (pch - xdigits);
+          if (val > 0xffff)
+            return (0);
+          saw_xdigit = 1;
+          continue;
+        }
+      if (ch == ':')
+        {
+          curtok = src;
+          if (!saw_xdigit)
+            {
+              if (colonp)
+                return (0);
+              colonp = tp;
+              continue;
+            }
+          else if (*src == '\0')
+            {
+              return (0);
+            }
+          if (tp + NS_INT16SZ > endp)
+            return (0);
+          *tp++ = (u_char) (val >> 8) & 0xff;
+          *tp++ = (u_char) val & 0xff;
+          saw_xdigit = 0;
+          val = 0;
+          continue;
+        }
+      if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
+          inet_pton4 (curtok, tp) > 0)
+        {
+          tp += NS_INADDRSZ;
+          saw_xdigit = 0;
+          break;                /* '\0' was seen by inet_pton4(). */
+        }
+      return (0);
+    }
+  if (saw_xdigit)
+    {
+      if (tp + NS_INT16SZ > endp)
+        return (0);
+      *tp++ = (u_char) (val >> 8) & 0xff;
+      *tp++ = (u_char) val & 0xff;
+    }
+  if (colonp != NULL)
+    {
+      /*
+       * Since some memmove()'s erroneously fail to handle
+       * overlapping regions, we'll do the shift by hand.
+       */
+      const int n = tp - colonp;
+      int i;
+
+      if (tp == endp)
+        return (0);
+      for (i = 1; i <= n; i++)
+        {
+          endp[-i] = colonp[n - i];
+          colonp[n - i] = 0;
+        }
+      tp = endp;
+    }
+  if (tp != endp)
+    return (0);
+  memcpy (dst, tmp, NS_IN6ADDRSZ);
+  return (1);
+}
+
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index eb8a68ad26f42899891dd6b200fe3b15d393246b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/infinity.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..40e663ff8fa931afa64e84e8e703402967af12cc
--- /dev/null
@@ -0,0 +1,66 @@
+/* Macros for infinity.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+
+/* Infinityf () returns a 'float' +Infinity.  */
+
+/* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f.
+   The IBM XL C compiler on z/OS complains.
+   PGI 16.10 complains.  */
+#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI
+static float
+Infinityf ()
+{
+  static float zero = 0.0f;
+  return 1.0f / zero;
+}
+#else
+# define Infinityf() (1.0f / 0.0f)
+#endif
+
+
+/* Infinityd () returns a 'double' +Infinity.  */
+
+/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0.
+   The IBM XL C compiler on z/OS complains.
+   PGI 16.10 complains.  */
+#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI
+static double
+Infinityd ()
+{
+  static double zero = 0.0;
+  return 1.0 / zero;
+}
+#else
+# define Infinityd() (1.0 / 0.0)
+#endif
+
+
+/* Infinityl () returns a 'long double' +Infinity.  */
+
+/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L.
+   The IBM XL C compiler on z/OS complains.
+   PGI 16.10 complains.  */
+#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI
+static long double
+Infinityl ()
+{
+  static long double zero = 0.0L;
+  return 1.0L / zero;
+}
+#else
+# define Infinityl() (1.0L / 0.0L)
+#endif
deleted file mode 120000 (symlink)
index 4a22b5cea50646d6fb9be975047c410138bec86d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/init.sh
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c5ec5cfd5893fccfeb6dfc0a999f12309fc82e2a
--- /dev/null
@@ -0,0 +1,706 @@
+# source this file; set up for tests
+
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Using this file in a test
+# =========================
+#
+# The typical skeleton of a test looks like this:
+#
+#   #!/bin/sh
+#   . "${srcdir=.}/init.sh"; path_prepend_ .
+#   Execute some commands.
+#   Note that these commands are executed in a subdirectory, therefore you
+#   need to prepend "../" to relative filenames in the build directory.
+#   Note that the "path_prepend_ ." is useful only if the body of your
+#   test invokes programs residing in the initial directory.
+#   For example, if the programs you want to test are in src/, and this test
+#   script is named tests/test-1, then you would use "path_prepend_ ../src",
+#   or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"
+#   to all tests via automake's TESTS_ENVIRONMENT.
+#   Set the exit code 0 for success, 77 for skipped, or 1 or other for failure.
+#   Use the skip_ and fail_ functions to print a diagnostic and then exit
+#   with the corresponding exit code.
+#   Exit $?
+
+# Executing a test that uses this file
+# ====================================
+#
+# Running a single test:
+#   $ make check TESTS=test-foo.sh
+#
+# Running a single test, with verbose output:
+#   $ make check TESTS=test-foo.sh VERBOSE=yes
+#
+# Running a single test, keeping the temporary directory:
+#   $ make check TESTS=test-foo.sh KEEP=yes
+#
+# Running a single test, with single-stepping:
+#   1. Go into a sub-shell:
+#   $ bash
+#   2. Set relevant environment variables from TESTS_ENVIRONMENT in the
+#      Makefile:
+#   $ export srcdir=../../tests # this is an example
+#   3. Execute the commands from the test, copy&pasting them one by one:
+#   $ . "$srcdir/init.sh"; path_prepend_ .
+#   ...
+#   4. Finally
+#   $ exit
+
+# =============================================================================
+# Elementary diagnostics
+
+ME_=`expr "./$0" : '.*/\(.*\)$'`
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+# We use a trap below for cleanup.  This requires us to go through
+# hoops to get the right exit status transported through the handler.
+# So use 'Exit STATUS' instead of 'exit STATUS' inside of the tests.
+# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
+# sh inside this function.
+Exit () { set +e; (exit $1); exit $1; }
+
+# Print warnings (e.g., about skipped and failed tests) to this file number.
+# Override by defining to say, 9, in init.cfg, and putting say,
+#   export ...ENVVAR_SETTINGS...; $(SHELL) 9>&2
+# in the definition of TESTS_ENVIRONMENT in your tests/Makefile.am file.
+# This is useful when using automake's parallel tests mode, to print
+# the reason for skip/failure to console, rather than to the .log files.
+: ${stderr_fileno_=2}
+
+# Note that correct expansion of "$*" depends on IFS starting with ' '.
+# Always write the full diagnostic to stderr.
+# When stderr_fileno_ is not 2, also emit the first line of the
+# diagnostic to that file descriptor.
+warn_ ()
+{
+  # If IFS does not start with ' ', set it and emit the warning in a subshell.
+  case $IFS in
+    ' '*) printf '%s\n' "$*" >&2
+          test $stderr_fileno_ = 2 \
+            || { printf '%s\n' "$*" | sed 1q >&$stderr_fileno_ ; } ;;
+    *) (IFS=' '; warn_ "$@");;
+  esac
+}
+fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; }
+skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; }
+fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; }
+framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; }
+
+# =============================================================================
+# Ensure the shell supports modern syntax.
+
+# Sanitize this shell to POSIX mode, if possible.
+DUALCASE=1; export DUALCASE
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+    *posix*) set -o posix ;;
+  esac
+fi
+
+# We require $(...) support unconditionally.
+# We require that the printf built-in work correctly regarding octal escapes;
+# this eliminates /bin/sh on AIX 7.2.
+# We require non-surprising "local" semantics (this eliminates dash).
+# This takes the admittedly draconian step of eliminating dash, because the
+# assignment tab=$(printf '\t') works fine, yet preceding it with "local "
+# transforms it into an assignment that sets the variable to the empty string.
+# That is too counter-intuitive, and can lead to subtle run-time malfunction.
+# The example below is less subtle in that with dash, it evokes the run-time
+# exception "dash: 1: local: 1: bad variable name".
+# We require a few additional shell features only when $EXEEXT is nonempty,
+# in order to support automatic $EXEEXT emulation:
+# - hyphen-containing alias names
+# - we prefer to use ${var#...} substitution, rather than having
+#   to work around lack of support for that feature.
+# The following code attempts to find a shell with support for these features.
+# If the current shell passes the test, we're done.  Otherwise, test other
+# shells until we find one that passes.  If one is found, re-exec it.
+# If no acceptable shell is found, skip the current test.
+#
+# The "...set -x; P=1 true 2>err..." test is to disqualify any shell that
+# emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do.
+#
+# Use "9" to indicate success (rather than 0), in case some shell acts
+# like Solaris 10's /bin/sh but exits successfully instead of with status 2.
+
+# Eval this code in a subshell to determine a shell's suitability.
+# 10 - passes all tests; ok to use
+#  9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score
+#  ? - not ok
+gl_shell_test_script_='
+test $(echo y) = y || exit 1
+LC_ALL=en_US.UTF-8 printf "\\351" 2>/dev/null \
+  | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \
+  || exit 1
+printf "\\351" 2>/dev/null \
+  | LC_ALL=C tr "\\351" x | LC_ALL=C grep "^x$" > /dev/null \
+  || exit 1
+f_local_() { local v=1; }; f_local_ || exit 1
+f_dash_local_fail_() { local t=$(printf " 1"); }; f_dash_local_fail_
+score_=10
+if test "$VERBOSE" = yes; then
+  test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9
+fi
+test -z "$EXEEXT" && exit $score_
+shopt -s expand_aliases
+alias a-b="echo zoo"
+v=abx
+     test ${v%x} = ab \
+  && test ${v#a} = bx \
+  && test $(a-b) = zoo \
+  && exit $score_
+'
+
+if test "x$1" = "x--no-reexec"; then
+  shift
+else
+  # Assume a working shell.  Export to subshells (setup_ needs this).
+  gl_set_x_corrupts_stderr_=false
+  export gl_set_x_corrupts_stderr_
+
+  # Record the first marginally acceptable shell.
+  marginal_=
+
+  # Search for a shell that meets our requirements.
+  for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \
+      /bin/sh bash dash zsh pdksh fail
+  do
+    test "$re_shell_" = no_shell && continue
+
+    # If we've made it all the way to the sentinel, "fail" without
+    # finding even a marginal shell, skip this test.
+    if test "$re_shell_" = fail; then
+      test -z "$marginal_" && skip_ failed to find an adequate shell
+      re_shell_=$marginal_
+      break
+    fi
+
+    # When testing the current shell, simply "eval" the test code.
+    # Otherwise, run it via $re_shell_ -c ...
+    if test "$re_shell_" = __current__; then
+      # 'eval'ing this code makes Solaris 10's /bin/sh exit with
+      # $? set to 2.  It does not evaluate any of the code after the
+      # "unexpected" first '('.  Thus, we must run it in a subshell.
+      ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
+    else
+      "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
+    fi
+
+    st_=$?
+
+    # $re_shell_ works just fine.  Use it.
+    if test $st_ = 10; then
+      gl_set_x_corrupts_stderr_=false
+      break
+    fi
+
+    # If this is our first marginally acceptable shell, remember it.
+    if test "$st_:$marginal_" = 9: ; then
+      marginal_="$re_shell_"
+      gl_set_x_corrupts_stderr_=true
+    fi
+  done
+
+  if test "$re_shell_" != __current__; then
+    # Found a usable shell.  Preserve -v and -x.
+    case $- in
+      *v*x* | *x*v*) opts_=-vx ;;
+      *v*) opts_=-v ;;
+      *x*) opts_=-x ;;
+      *) opts_= ;;
+    esac
+    re_shell=$re_shell_
+    export re_shell
+    exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
+    echo "$ME_: exec failed" 1>&2
+    exit 127
+  fi
+fi
+
+# =============================================================================
+# Ensure the shell behaves reasonably.
+
+# If this is bash, turn off all aliases.
+test -n "$BASH_VERSION" && unalias -a
+
+# Note that when supporting $EXEEXT (transparently mapping from PROG_NAME to
+# PROG_NAME.exe), we want to support hyphen-containing names like test-acos.
+# That is part of the shell-selection test above.  Why use aliases rather
+# than functions?  Because support for hyphen-containing aliases is more
+# widespread than that for hyphen-containing function names.
+test -n "$EXEEXT" && test -n "$BASH_VERSION" && shopt -s expand_aliases
+
+# =============================================================================
+# Creating a temporary directory (needed by the core test framework)
+
+# Create a temporary directory, much like mktemp -d does.
+# Written by Jim Meyering.
+#
+# Usage: mktempd_ /tmp phoey.XXXXXXXXXX
+#
+# First, try to use the mktemp program.
+# Failing that, we'll roll our own mktemp-like function:
+#  - try to get random bytes from /dev/urandom, mapping them to file-name bytes
+#  - failing that, generate output from a combination of quickly-varying
+#      sources and awk.
+#  - try to create the desired directory.
+#  - make only $MAX_TRIES_ attempts
+
+# Helper function.  Print $N pseudo-random bytes from a-zA-Z0-9.
+rand_bytes_ ()
+{
+  n_=$1
+
+  # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first?
+  # But if they have openssl, they probably have mktemp, too.
+
+  chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+  dev_rand_=/dev/urandom
+  if test -r "$dev_rand_"; then
+    # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194.
+    dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \
+      | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_
+    return
+  fi
+
+  # Fall back on quickly-varying sources + awk.
+  # Limit awk program to 7th Edition Unix so that it works even on Solaris 10.
+
+  (date; date +%N; free; who -a; w; ps auxww; ps -ef) 2>&1 | awk '
+     BEGIN {
+       n = '"$n_"'
+       for (i = 0; i < 256; i++)
+         ordinal[sprintf ("%c", i)] = i
+     }
+     {
+       for (i = 1; i <= length; i++)
+         a[ai++ % n] += ordinal[substr ($0, i, 1)]
+     }
+     END {
+       chars = "'"$chars_"'"
+       charslen = length (chars)
+       for (i = 0; i < n; i++)
+         printf "%s", substr (chars, a[i] % charslen + 1, 1)
+       printf "\n"
+     }
+  '
+}
+
+mktempd_ ()
+{
+  case $# in
+  2);;
+  *) fail_ "Usage: mktempd_ DIR TEMPLATE";;
+  esac
+
+  destdir_=$1
+  template_=$2
+
+  MAX_TRIES_=4
+
+  # Disallow any trailing slash on specified destdir:
+  # it would subvert the post-mktemp "case"-based destdir test.
+  case $destdir_ in
+  / | //) destdir_slash_=$destdir;;
+  */) fail_ "invalid destination dir: remove trailing slash(es)";;
+  *) destdir_slash_=$destdir_/;;
+  esac
+
+  case $template_ in
+  *XXXX) ;;
+  *) fail_ \
+       "invalid template: $template_ (must have a suffix of at least 4 X's)";;
+  esac
+
+  # First, try to use mktemp.
+  d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` &&
+
+  # The resulting name must be in the specified directory.
+  case $d in "$destdir_slash_"*) :;; *) false;; esac &&
+
+  # It must have created the directory.
+  test -d "$d" &&
+
+  # It must have 0700 permissions.  Handle sticky "S" bits.
+  perms=`ls -dgo "$d" 2>/dev/null` &&
+  case $perms in drwx--[-S]---*) :;; *) false;; esac && {
+    echo "$d"
+    return
+  }
+
+  # If we reach this point, we'll have to create a directory manually.
+
+  # Get a copy of the template without its suffix of X's.
+  base_template_=`echo "$template_"|sed 's/XX*$//'`
+
+  # Calculate how many X's we've just removed.
+  template_length_=`echo "$template_" | wc -c`
+  nx_=`echo "$base_template_" | wc -c`
+  nx_=`expr $template_length_ - $nx_`
+
+  err_=
+  i_=1
+  while :; do
+    X_=`rand_bytes_ $nx_`
+    candidate_dir_="$destdir_slash_$base_template_$X_"
+    err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \
+      && { echo "$candidate_dir_"; return; }
+    test $MAX_TRIES_ -le $i_ && break;
+    i_=`expr $i_ + 1`
+  done
+  fail_ "$err_"
+}
+
+# =============================================================================
+# Core test framework
+
+# An arbitrary prefix to help distinguish test directories.
+testdir_prefix_ () { printf gt; }
+
+# Set up the environment for the test to run in.
+setup_ ()
+{
+  if test "$VERBOSE" = yes; then
+    # Test whether set -x may cause the selected shell to corrupt an
+    # application's stderr.  Many do, including zsh-4.3.10 and the /bin/sh
+    # from SunOS 5.11, OpenBSD 4.7 and Irix 6.5.
+    # If enabling verbose output this way would cause trouble, simply
+    # issue a warning and refrain.
+    if $gl_set_x_corrupts_stderr_; then
+      warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr"
+    else
+      set -x
+    fi
+  fi
+
+  initial_cwd_=$PWD
+
+  # Create and enter the temporary directory.
+  pfx_=`testdir_prefix_`
+  test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \
+    || fail_ "failed to create temporary directory in $initial_cwd_"
+  cd "$test_dir_" || fail_ "failed to cd to temporary directory"
+  # Set variables srcdir, builddir, for the convenience of the test.
+  case $srcdir in
+    /* | ?:*) ;;
+    *) srcdir="../$srcdir" ;;
+  esac
+  builddir=".."
+  export srcdir builddir
+
+  # As autoconf-generated configure scripts do, ensure that IFS
+  # is defined initially, so that saving and restoring $IFS works.
+  gl_init_sh_nl_='
+'
+  IFS=" ""     $gl_init_sh_nl_"
+
+  # This trap statement, along with a trap on 0 below, ensure that the
+  # temporary directory, $test_dir_, is removed upon exit as well as
+  # upon receipt of any of the listed signals.
+  for sig_ in 1 2 3 13 15; do
+    eval "trap 'Exit $(expr $sig_ + 128)' $sig_"
+  done
+
+  # Remove relative and non-accessible directories from PATH, including '.'
+  # and Zero-length entries.
+  saved_IFS="$IFS"; IFS="$PATH_SEPARATOR"
+  new_PATH=
+  for dir in $PATH; do
+    IFS="$saved_IFS"
+    case "$dir" in
+      [\\/]* | ?:[\\/]*)
+        test -d "$dir/." || continue
+        new_PATH="${new_PATH}${new_PATH:+$PATH_SEPARATOR}${dir}"
+        ;;
+    esac
+  done
+  IFS="$saved_IFS"
+  PATH="$new_PATH"
+  export PATH
+}
+
+# This is a stub function that is run upon trap (upon regular exit and
+# interrupt).  Override it with a per-test function, e.g., to unmount
+# a partition, or to undo any other global state changes.
+cleanup_ () { :; }
+
+# Run the user-overridable cleanup_ function, remove the temporary
+# directory and exit with the incoming value of $?.
+remove_tmp_ ()
+{
+  __st=$?
+  cleanup_
+  if test "$KEEP" = yes; then
+    echo "Not removing temporary directory $test_dir_"
+  else
+    # cd out of the directory we're about to remove
+    cd "$initial_cwd_" || cd / || cd /tmp
+    chmod -R u+rwx "$test_dir_"
+    # If removal fails and exit status was to be 0, then change it to 1.
+    rm -rf "$test_dir_" || { test $__st = 0 && __st=1; }
+  fi
+  exit $__st
+}
+
+# =============================================================================
+# Prepending directories to PATH
+
+# Given a directory name, DIR, if every entry in it that matches *.exe
+# contains only the specified bytes (see the case stmt below), then print
+# a space-separated list of those names and return 0.  Otherwise, don't
+# print anything and return 1.  Naming constraints apply also to DIR.
+find_exe_basenames_ ()
+{
+  feb_dir_=$1
+  feb_fail_=0
+  feb_result_=
+  feb_sp_=
+  for feb_file_ in $feb_dir_/*.exe; do
+    # If there was no *.exe file, or there existed a file named "*.exe" that
+    # was deleted between the above glob expansion and the existence test
+    # below, just skip it.
+    test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \
+      && continue
+    # Exempt [.exe, since we can't create a function by that name, yet
+    # we can't invoke [ by PATH search anyways due to shell builtins.
+    test "x$feb_file_" = "x$feb_dir_/[.exe" && continue
+    case $feb_file_ in
+      *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;;
+      *) # Remove leading file name components as well as the .exe suffix.
+         feb_file_=${feb_file_##*/}
+         feb_file_=${feb_file_%.exe}
+         feb_result_="$feb_result_$feb_sp_$feb_file_";;
+    esac
+    feb_sp_=' '
+  done
+  test $feb_fail_ = 0 && printf %s "$feb_result_"
+  return $feb_fail_
+}
+
+# Consider the files in directory, $1.
+# For each file name of the form PROG.exe, create an alias named
+# PROG that simply invokes PROG.exe, then return 0.  If any selected
+# file name or the directory name, $1, contains an unexpected character,
+# define no alias and return 1.
+create_exe_shims_ ()
+{
+  case $EXEEXT in
+    '') return 0 ;;
+    .exe) ;;
+    *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;;
+  esac
+
+  base_names_=`find_exe_basenames_ $1` \
+    || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; }
+
+  if test -n "$base_names_"; then
+    for base_ in $base_names_; do
+      alias "$base_"="$base_$EXEEXT"
+    done
+  fi
+
+  return 0
+}
+
+# Use this function to prepend to PATH an absolute name for each
+# specified, possibly-$initial_cwd_-relative, directory.
+path_prepend_ ()
+{
+  while test $# != 0; do
+    path_dir_=$1
+    case $path_dir_ in
+      '') fail_ "invalid path dir: '$1'";;
+      /* | ?:*) abs_path_dir_=$path_dir_;;
+      *) abs_path_dir_=$initial_cwd_/$path_dir_;;
+    esac
+    case $abs_path_dir_ in
+      *$PATH_SEPARATOR*) fail_ "invalid path dir: '$abs_path_dir_'";;
+    esac
+    PATH="$abs_path_dir_$PATH_SEPARATOR$PATH"
+
+    # Create an alias, FOO, for each FOO.exe in this directory.
+    create_exe_shims_ "$abs_path_dir_" \
+      || fail_ "something failed (above): $abs_path_dir_"
+    shift
+  done
+  export PATH
+}
+
+# =============================================================================
+# Convenience environment variables for the tests
+
+# -----------------------------------------------------------------------------
+
+# Enable glibc's malloc-perturbing option.
+# This is useful for exposing code that depends on the fact that
+# malloc-related functions often return memory that is mostly zeroed.
+# If you have the time and cycles, use valgrind to do an even better job.
+: ${MALLOC_PERTURB_=87}
+export MALLOC_PERTURB_
+
+# -----------------------------------------------------------------------------
+
+# The interpreter for Bourne-shell scripts.
+# No special standards compatibility requirements.
+# Some environments, such as Android, don't have /bin/sh.
+if test -f /bin/sh$EXEEXT; then
+  BOURNE_SHELL=/bin/sh
+else
+  BOURNE_SHELL=sh
+fi
+
+# =============================================================================
+# Convenience functions for the tests
+
+# -----------------------------------------------------------------------------
+# Return value checking
+
+# This is used to simplify checking of the return value
+# which is useful when ensuring a command fails as desired.
+# I.e., just doing `command ... &&fail=1` will not catch
+# a segfault in command for example.  With this helper you
+# instead check an explicit exit code like
+#   returns_ 1 command ... || fail
+returns_ () {
+  # Disable tracing so it doesn't interfere with stderr of the wrapped command
+  { set +x; } 2>/dev/null
+
+  local exp_exit="$1"
+  shift
+  "$@"
+  test $? -eq $exp_exit && ret_=0 || ret_=1
+
+  if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then
+    set -x
+  fi
+  { return $ret_; } 2>/dev/null
+}
+
+# -----------------------------------------------------------------------------
+# Text file comparison
+
+# Emit a header similar to that from diff -u;  Print the simulated "diff"
+# command so that the order of arguments is clear.  Don't bother with @@ lines.
+emit_diff_u_header_ ()
+{
+  printf '%s\n' "diff -u $*" \
+    "--- $1    1970-01-01" \
+    "+++ $2    1970-01-01"
+}
+
+# Arrange not to let diff or cmp operate on /dev/null,
+# since on some systems (at least OSF/1 5.1), that doesn't work.
+# When there are not two arguments, or no argument is /dev/null, return 2.
+# When one argument is /dev/null and the other is not empty,
+# cat the nonempty file to stderr and return 1.
+# Otherwise, return 0.
+compare_dev_null_ ()
+{
+  test $# = 2 || return 2
+
+  if test "x$1" = x/dev/null; then
+    test -s "$2" || return 0
+    emit_diff_u_header_ "$@"; sed 's/^/+/' "$2"
+    return 1
+  fi
+
+  if test "x$2" = x/dev/null; then
+    test -s "$1" || return 0
+    emit_diff_u_header_ "$@"; sed 's/^/-/' "$1"
+    return 1
+  fi
+
+  return 2
+}
+
+for diff_opt_ in -u -U3 -c '' no; do
+  test "$diff_opt_" != no &&
+    diff_out_=`exec 2>/dev/null
+      LC_ALL=C diff $diff_opt_ "$0" "$0" < /dev/null` &&
+    break
+done
+if test "$diff_opt_" != no; then
+  if test -z "$diff_out_"; then
+    compare_ () { LC_ALL=C diff $diff_opt_ "$@"; }
+  else
+    compare_ ()
+    {
+      # If no differences were found, AIX and HP-UX 'diff' produce output
+      # like "No differences encountered".  Hide this output.
+      LC_ALL=C diff $diff_opt_ "$@" > diff.out
+      diff_status_=$?
+      test $diff_status_ -eq 0 || cat diff.out || diff_status_=2
+      rm -f diff.out || diff_status_=2
+      return $diff_status_
+    }
+  fi
+elif cmp -s /dev/null /dev/null 2>/dev/null; then
+  compare_ () { cmp -s "$@"; }
+else
+  compare_ () { cmp "$@"; }
+fi
+
+# Usage: compare EXPECTED ACTUAL
+#
+# Given compare_dev_null_'s preprocessing, defer to compare_ if 2 or more.
+# Otherwise, propagate $? to caller: any diffs have already been printed.
+compare ()
+{
+  # This looks like it can be factored to use a simple "case $?"
+  # after unchecked compare_dev_null_ invocation, but that would
+  # fail in a "set -e" environment.
+  if compare_dev_null_ "$@"; then
+    return 0
+  else
+    case $? in
+      1) return 1;;
+      *) compare_ "$@";;
+    esac
+  fi
+}
+
+# -----------------------------------------------------------------------------
+
+# If you want to override the testdir_prefix_ function,
+# or to add more utility functions, use this file.
+test -f "$srcdir/init.cfg" \
+  && . "$srcdir/init.cfg"
+
+# =============================================================================
+# Set up the environment for the test to run in.
+
+setup_ "$@"
+# This trap is here, rather than in the setup_ function, because some
+# shells run the exit trap at shell function exit, rather than script exit.
+trap remove_tmp_ EXIT
deleted file mode 120000 (symlink)
index ac03670c3f7ff3b3a0518f150b714f4a3204bc1e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ioctl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3ee63fd8ce3198e807af2a70a805cece9ac1bce2
--- /dev/null
@@ -0,0 +1,92 @@
+/* ioctl.c --- wrappers for Windows ioctl function
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#include <sys/ioctl.h>
+
+#include <stdarg.h>
+
+#if HAVE_IOCTL
+
+/* Provide a wrapper with the POSIX prototype.  */
+# undef ioctl
+int
+rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
+{
+  void *buf;
+  va_list args;
+
+  va_start (args, request);
+  buf = va_arg (args, void *);
+  va_end (args);
+
+  /* Cast 'request' so that when the system's ioctl function takes a 64-bit
+     request argument, the value gets zero-extended, not sign-extended.  */
+  return ioctl (fd, (unsigned int) request, buf);
+}
+
+#else /* mingw */
+
+# include <errno.h>
+
+/* Get HANDLE.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+# include "fd-hook.h"
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+
+static int
+primary_ioctl (int fd, int request, void *arg)
+{
+  /* We don't support FIONBIO on pipes here.  If you want to make pipe
+     fds non-blocking, use the gnulib 'nonblocking' module, until
+     gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK.  */
+
+  if ((HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE)
+    errno = ENOSYS;
+  else
+    errno = EBADF;
+  return -1;
+}
+
+int
+ioctl (int fd, int request, ... /* {void *,char *} arg */)
+{
+  void *arg;
+  va_list args;
+
+  va_start (args, request);
+  arg = va_arg (args, void *);
+  va_end (args);
+
+# if WINDOWS_SOCKETS
+  return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg);
+# else
+  return primary_ioctl (fd, request, arg);
+# endif
+}
+
+#endif
deleted file mode 120000 (symlink)
index 555d7c6b17d84a2b0fb69a3ee0ef5f9ac1344038..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/listen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..785b13192675a3051044a645435165550287349e
--- /dev/null
@@ -0,0 +1,49 @@
+/* listen.c --- wrappers for Windows listen function
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef listen
+
+int
+rpl_listen (int fd, int backlog)
+{
+  SOCKET sock = FD_TO_SOCKET (fd);
+
+  if (sock == INVALID_SOCKET)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  else
+    {
+      int r = listen (sock, backlog);
+      if (r < 0)
+        set_winsock_errno ();
+
+      return r;
+    }
+}
deleted file mode 120000 (symlink)
index 12a719ee6052cf7893a8e4a833ea7dd0f8ea2d7f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/locale.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bd2bc00e421f426fe0af739fa5573c5398d712b2
--- /dev/null
@@ -0,0 +1,85 @@
+/* Program that prints the names of the categories of the current locale.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* We want to use the system's setlocale() function here, not the gnulib
+   override.  */
+#undef setlocale
+
+/* Specification:
+   <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/locale.html>
+   Here we implement only the invocation without any command-line options.  */
+
+static const char *
+defaulted_getenv (const char *variable)
+{
+  const char *value = getenv (variable);
+  return (value != NULL ? value : "");
+}
+
+static void
+print_category (int category, const char *variable)
+{
+  const char *value = defaulted_getenv (variable);
+  if (value[0] != '\0' && defaulted_getenv ("LC_ALL")[0] == '\0')
+    /* The variable is set in the environment and not overridden by LC_ALL.  */
+    printf ("%s=%s\n", variable, value);
+  else
+    printf ("%s=\"%s\"\n", variable, setlocale (category, NULL));
+}
+
+int
+main (void)
+{
+  setlocale (LC_ALL, "");
+
+  printf ("LANG=%s\n", defaulted_getenv ("LANG"));
+  print_category (LC_CTYPE, "LC_CTYPE");
+  print_category (LC_NUMERIC, "LC_NUMERIC");
+  print_category (LC_TIME, "LC_TIME");
+  print_category (LC_COLLATE, "LC_COLLATE");
+  print_category (LC_MONETARY, "LC_MONETARY");
+  print_category (LC_MESSAGES, "LC_MESSAGES");
+#ifdef LC_PAPER
+  print_category (LC_PAPER, "LC_PAPER");
+#endif
+#ifdef LC_NAME
+  print_category (LC_NAME, "LC_NAME");
+#endif
+#ifdef LC_ADDRESS
+  print_category (LC_ADDRESS, "LC_ADDRESS");
+#endif
+#ifdef LC_TELEPHONE
+  print_category (LC_TELEPHONE, "LC_TELEPHONE");
+#endif
+#ifdef LC_MEASUREMENT
+  print_category (LC_MEASUREMENT, "LC_MEASUREMENT");
+#endif
+#ifdef LC_IDENTIFICATION
+  print_category (LC_IDENTIFICATION, "LC_IDENTIFICATION");
+#endif
+
+  printf ("LC_ALL=%s\n", defaulted_getenv ("LC_ALL"));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 86953a52f2db889cf773e33c0c3ee6ef5d8a09a1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/localename-table.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ada724104801d936a87d0c369d0e09201b7b4864
--- /dev/null
@@ -0,0 +1,48 @@
+/* Table that maps a locale object to the names of the locale categories.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2018.  */
+
+#include <config.h>
+
+#if HAVE_WORKING_USELOCALE && HAVE_NAMELESS_LOCALES
+
+/* Specification.  */
+#include "localename-table.h"
+
+#include <stdint.h>
+
+/* A hash function for pointers.  */
+size_t _GL_ATTRIBUTE_CONST
+locale_hash_function (locale_t x)
+{
+  uintptr_t p = (uintptr_t) x;
+  size_t h = ((p % 4177) << 12) + ((p % 79) << 6) + (p % 61);
+  return h;
+}
+
+struct locale_hash_node * locale_hash_table[LOCALE_HASH_TABLE_SIZE]
+  /* = { NULL, ..., NULL } */;
+
+gl_rwlock_define_initialized(, locale_lock)
+
+#else
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#endif
deleted file mode 120000 (symlink)
index 3896670d9ec5169d04489784f40fdee064999c7d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/localename-table.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eaa98fa57f987396b6d952e503087377cce0e487
--- /dev/null
@@ -0,0 +1,69 @@
+/* Table that maps a locale object to the names of the locale categories.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2018.  */
+
+#if HAVE_WORKING_USELOCALE && HAVE_NAMELESS_LOCALES
+
+# include <stddef.h>
+# include <locale.h>
+
+# include "glthread/lock.h"
+
+struct locale_categories_names
+  {
+    /* Locale category -> name (allocated with indefinite extent).  */
+    const char *category_name[6];
+  };
+
+/* A hash table of fixed size.  Multiple threads can access it read-only
+   simultaneously, but only one thread can insert into it or remove from it
+   at the same time.
+   This hash table has global scope, so that when an application uses both
+   GNU libintl and gnulib, the application sees only one hash table.  (When
+   linking statically with libintl, the fact that localename-table.c is a
+   separate compilation unit resolves the duplicate symbol conflict.  When
+   linking with libintl as a shared library, we rely on ELF and the symbol
+   conflict resolution implemented in the ELF dynamic loader here.)
+   Both the libintl overrides and the gnulib overrides of the functions
+   newlocale, duplocale, freelocale see the same hash table (and the same lock).
+   For this reason, the internal layout of the hash table and the hash function
+   MUST NEVER CHANGE.  If you need to change the internal layout or the hash
+   function, introduce versioning by appending a version suffix to the symbols
+   at the linker level.  */
+# define locale_hash_function libintl_locale_hash_function
+# define locale_hash_table libintl_locale_hash_table
+# define locale_lock libintl_locale_lock
+
+extern size_t _GL_ATTRIBUTE_CONST locale_hash_function (locale_t x);
+
+/* A node in a hash bucket collision list.  */
+struct locale_hash_node
+  {
+    struct locale_hash_node *next;
+    locale_t locale;
+    struct locale_categories_names names;
+  };
+
+# define LOCALE_HASH_TABLE_SIZE 101
+extern struct locale_hash_node * locale_hash_table[LOCALE_HASH_TABLE_SIZE];
+
+/* This lock protects the locale_hash_table against multiple simultaneous
+   accesses (except that multiple simultaneous read accesses are allowed).  */
+
+gl_rwlock_define(extern, locale_lock)
+
+#endif
deleted file mode 120000 (symlink)
index db579a634e9f1d2f3db8216073e34aa09e040f96..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/localename.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b4c78df8aee77d4bb7c6e055991f6e86b880e5b6
--- /dev/null
+/* Determine name of the currently selected locale.
+   Copyright (C) 1995-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Ulrich Drepper <drepper@gnu.org>, 1995.  */
+/* Native Windows code written by Tor Lillqvist <tml@iki.fi>.  */
+/* Mac OS X code written by Bruno Haible <bruno@clisp.org>.  */
+
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the locale == NULL tests below in duplocale() and freelocale(),
+   or xlclang reports -Wtautological-pointer-compare warnings for these tests.
+ */
+#define _GL_ARG_NONNULL(params)
+
+#include <config.h>
+
+/* Specification.  */
+#include "localename.h"
+
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <string.h>
+
+#include "flexmember.h"
+#include "setlocale_null.h"
+#include "thread-optim.h"
+
+#if HAVE_GOOD_USELOCALE
+/* Mac OS X 10.5 defines the locale_t type in <xlocale.h>.  */
+# if defined __APPLE__ && defined __MACH__
+#  include <xlocale.h>
+# endif
+# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || (defined __linux__ && HAVE_LANGINFO_H) || defined __CYGWIN__
+#  include <langinfo.h>
+# endif
+# include "glthread/lock.h"
+# if defined __sun
+#  if HAVE_GETLOCALENAME_L
+/* Solaris >= 12.  */
+extern char * getlocalename_l(int, locale_t);
+#  elif HAVE_SOLARIS114_LOCALES
+#   include <sys/localedef.h>
+#  endif
+# endif
+# if HAVE_NAMELESS_LOCALES
+#  include "localename-table.h"
+# endif
+# if defined __HAIKU__
+#  include <dlfcn.h>
+# endif
+#endif
+
+#if HAVE_CFPREFERENCESCOPYAPPVALUE
+# include <CoreFoundation/CFString.h>
+# include <CoreFoundation/CFPreferences.h>
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# define WINDOWS_NATIVE
+# include "glthread/lock.h"
+#endif
+
+#if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Native Windows or Cygwin */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# include <winnls.h>
+/* List of language codes, sorted by value:
+   0x01 LANG_ARABIC
+   0x02 LANG_BULGARIAN
+   0x03 LANG_CATALAN
+   0x04 LANG_CHINESE
+   0x05 LANG_CZECH
+   0x06 LANG_DANISH
+   0x07 LANG_GERMAN
+   0x08 LANG_GREEK
+   0x09 LANG_ENGLISH
+   0x0a LANG_SPANISH
+   0x0b LANG_FINNISH
+   0x0c LANG_FRENCH
+   0x0d LANG_HEBREW
+   0x0e LANG_HUNGARIAN
+   0x0f LANG_ICELANDIC
+   0x10 LANG_ITALIAN
+   0x11 LANG_JAPANESE
+   0x12 LANG_KOREAN
+   0x13 LANG_DUTCH
+   0x14 LANG_NORWEGIAN
+   0x15 LANG_POLISH
+   0x16 LANG_PORTUGUESE
+   0x17 LANG_ROMANSH
+   0x18 LANG_ROMANIAN
+   0x19 LANG_RUSSIAN
+   0x1a LANG_CROATIAN == LANG_SERBIAN
+   0x1b LANG_SLOVAK
+   0x1c LANG_ALBANIAN
+   0x1d LANG_SWEDISH
+   0x1e LANG_THAI
+   0x1f LANG_TURKISH
+   0x20 LANG_URDU
+   0x21 LANG_INDONESIAN
+   0x22 LANG_UKRAINIAN
+   0x23 LANG_BELARUSIAN
+   0x24 LANG_SLOVENIAN
+   0x25 LANG_ESTONIAN
+   0x26 LANG_LATVIAN
+   0x27 LANG_LITHUANIAN
+   0x28 LANG_TAJIK
+   0x29 LANG_FARSI
+   0x2a LANG_VIETNAMESE
+   0x2b LANG_ARMENIAN
+   0x2c LANG_AZERI
+   0x2d LANG_BASQUE
+   0x2e LANG_SORBIAN
+   0x2f LANG_MACEDONIAN
+   0x30 LANG_SUTU
+   0x31 LANG_TSONGA
+   0x32 LANG_TSWANA
+   0x33 LANG_VENDA
+   0x34 LANG_XHOSA
+   0x35 LANG_ZULU
+   0x36 LANG_AFRIKAANS
+   0x37 LANG_GEORGIAN
+   0x38 LANG_FAEROESE
+   0x39 LANG_HINDI
+   0x3a LANG_MALTESE
+   0x3b LANG_SAMI
+   0x3c LANG_GAELIC
+   0x3d LANG_YIDDISH
+   0x3e LANG_MALAY
+   0x3f LANG_KAZAK
+   0x40 LANG_KYRGYZ
+   0x41 LANG_SWAHILI
+   0x42 LANG_TURKMEN
+   0x43 LANG_UZBEK
+   0x44 LANG_TATAR
+   0x45 LANG_BENGALI
+   0x46 LANG_PUNJABI
+   0x47 LANG_GUJARATI
+   0x48 LANG_ORIYA
+   0x49 LANG_TAMIL
+   0x4a LANG_TELUGU
+   0x4b LANG_KANNADA
+   0x4c LANG_MALAYALAM
+   0x4d LANG_ASSAMESE
+   0x4e LANG_MARATHI
+   0x4f LANG_SANSKRIT
+   0x50 LANG_MONGOLIAN
+   0x51 LANG_TIBETAN
+   0x52 LANG_WELSH
+   0x53 LANG_CAMBODIAN
+   0x54 LANG_LAO
+   0x55 LANG_BURMESE
+   0x56 LANG_GALICIAN
+   0x57 LANG_KONKANI
+   0x58 LANG_MANIPURI
+   0x59 LANG_SINDHI
+   0x5a LANG_SYRIAC
+   0x5b LANG_SINHALESE
+   0x5c LANG_CHEROKEE
+   0x5d LANG_INUKTITUT
+   0x5e LANG_AMHARIC
+   0x5f LANG_TAMAZIGHT
+   0x60 LANG_KASHMIRI
+   0x61 LANG_NEPALI
+   0x62 LANG_FRISIAN
+   0x63 LANG_PASHTO
+   0x64 LANG_TAGALOG
+   0x65 LANG_DIVEHI
+   0x66 LANG_EDO
+   0x67 LANG_FULFULDE
+   0x68 LANG_HAUSA
+   0x69 LANG_IBIBIO
+   0x6a LANG_YORUBA
+   0x6d LANG_BASHKIR
+   0x6e LANG_LUXEMBOURGISH
+   0x6f LANG_GREENLANDIC
+   0x70 LANG_IGBO
+   0x71 LANG_KANURI
+   0x72 LANG_OROMO
+   0x73 LANG_TIGRINYA
+   0x74 LANG_GUARANI
+   0x75 LANG_HAWAIIAN
+   0x76 LANG_LATIN
+   0x77 LANG_SOMALI
+   0x78 LANG_YI
+   0x79 LANG_PAPIAMENTU
+   0x7a LANG_MAPUDUNGUN
+   0x7c LANG_MOHAWK
+   0x7e LANG_BRETON
+   0x82 LANG_OCCITAN
+   0x83 LANG_CORSICAN
+   0x84 LANG_ALSATIAN
+   0x85 LANG_YAKUT
+   0x86 LANG_KICHE
+   0x87 LANG_KINYARWANDA
+   0x88 LANG_WOLOF
+   0x8c LANG_DARI
+   0x91 LANG_SCOTTISH_GAELIC
+*/
+/* Mingw headers don't have latest language and sublanguage codes.  */
+# ifndef LANG_AFRIKAANS
+# define LANG_AFRIKAANS 0x36
+# endif
+# ifndef LANG_ALBANIAN
+# define LANG_ALBANIAN 0x1c
+# endif
+# ifndef LANG_ALSATIAN
+# define LANG_ALSATIAN 0x84
+# endif
+# ifndef LANG_AMHARIC
+# define LANG_AMHARIC 0x5e
+# endif
+# ifndef LANG_ARABIC
+# define LANG_ARABIC 0x01
+# endif
+# ifndef LANG_ARMENIAN
+# define LANG_ARMENIAN 0x2b
+# endif
+# ifndef LANG_ASSAMESE
+# define LANG_ASSAMESE 0x4d
+# endif
+# ifndef LANG_AZERI
+# define LANG_AZERI 0x2c
+# endif
+# ifndef LANG_BASHKIR
+# define LANG_BASHKIR 0x6d
+# endif
+# ifndef LANG_BASQUE
+# define LANG_BASQUE 0x2d
+# endif
+# ifndef LANG_BELARUSIAN
+# define LANG_BELARUSIAN 0x23
+# endif
+# ifndef LANG_BENGALI
+# define LANG_BENGALI 0x45
+# endif
+# ifndef LANG_BRETON
+# define LANG_BRETON 0x7e
+# endif
+# ifndef LANG_BURMESE
+# define LANG_BURMESE 0x55
+# endif
+# ifndef LANG_CAMBODIAN
+# define LANG_CAMBODIAN 0x53
+# endif
+# ifndef LANG_CATALAN
+# define LANG_CATALAN 0x03
+# endif
+# ifndef LANG_CHEROKEE
+# define LANG_CHEROKEE 0x5c
+# endif
+# ifndef LANG_CORSICAN
+# define LANG_CORSICAN 0x83
+# endif
+# ifndef LANG_DARI
+# define LANG_DARI 0x8c
+# endif
+# ifndef LANG_DIVEHI
+# define LANG_DIVEHI 0x65
+# endif
+# ifndef LANG_EDO
+# define LANG_EDO 0x66
+# endif
+# ifndef LANG_ESTONIAN
+# define LANG_ESTONIAN 0x25
+# endif
+# ifndef LANG_FAEROESE
+# define LANG_FAEROESE 0x38
+# endif
+# ifndef LANG_FARSI
+# define LANG_FARSI 0x29
+# endif
+# ifndef LANG_FRISIAN
+# define LANG_FRISIAN 0x62
+# endif
+# ifndef LANG_FULFULDE
+# define LANG_FULFULDE 0x67
+# endif
+# ifndef LANG_GAELIC
+# define LANG_GAELIC 0x3c
+# endif
+# ifndef LANG_GALICIAN
+# define LANG_GALICIAN 0x56
+# endif
+# ifndef LANG_GEORGIAN
+# define LANG_GEORGIAN 0x37
+# endif
+# ifndef LANG_GREENLANDIC
+# define LANG_GREENLANDIC 0x6f
+# endif
+# ifndef LANG_GUARANI
+# define LANG_GUARANI 0x74
+# endif
+# ifndef LANG_GUJARATI
+# define LANG_GUJARATI 0x47
+# endif
+# ifndef LANG_HAUSA
+# define LANG_HAUSA 0x68
+# endif
+# ifndef LANG_HAWAIIAN
+# define LANG_HAWAIIAN 0x75
+# endif
+# ifndef LANG_HEBREW
+# define LANG_HEBREW 0x0d
+# endif
+# ifndef LANG_HINDI
+# define LANG_HINDI 0x39
+# endif
+# ifndef LANG_IBIBIO
+# define LANG_IBIBIO 0x69
+# endif
+# ifndef LANG_IGBO
+# define LANG_IGBO 0x70
+# endif
+# ifndef LANG_INDONESIAN
+# define LANG_INDONESIAN 0x21
+# endif
+# ifndef LANG_INUKTITUT
+# define LANG_INUKTITUT 0x5d
+# endif
+# ifndef LANG_KANNADA
+# define LANG_KANNADA 0x4b
+# endif
+# ifndef LANG_KANURI
+# define LANG_KANURI 0x71
+# endif
+# ifndef LANG_KASHMIRI
+# define LANG_KASHMIRI 0x60
+# endif
+# ifndef LANG_KAZAK
+# define LANG_KAZAK 0x3f
+# endif
+# ifndef LANG_KICHE
+# define LANG_KICHE 0x86
+# endif
+# ifndef LANG_KINYARWANDA
+# define LANG_KINYARWANDA 0x87
+# endif
+# ifndef LANG_KONKANI
+# define LANG_KONKANI 0x57
+# endif
+# ifndef LANG_KYRGYZ
+# define LANG_KYRGYZ 0x40
+# endif
+# ifndef LANG_LAO
+# define LANG_LAO 0x54
+# endif
+# ifndef LANG_LATIN
+# define LANG_LATIN 0x76
+# endif
+# ifndef LANG_LATVIAN
+# define LANG_LATVIAN 0x26
+# endif
+# ifndef LANG_LITHUANIAN
+# define LANG_LITHUANIAN 0x27
+# endif
+# ifndef LANG_LUXEMBOURGISH
+# define LANG_LUXEMBOURGISH 0x6e
+# endif
+# ifndef LANG_MACEDONIAN
+# define LANG_MACEDONIAN 0x2f
+# endif
+# ifndef LANG_MALAY
+# define LANG_MALAY 0x3e
+# endif
+# ifndef LANG_MALAYALAM
+# define LANG_MALAYALAM 0x4c
+# endif
+# ifndef LANG_MALTESE
+# define LANG_MALTESE 0x3a
+# endif
+# ifndef LANG_MANIPURI
+# define LANG_MANIPURI 0x58
+# endif
+# ifndef LANG_MAORI
+# define LANG_MAORI 0x81
+# endif
+# ifndef LANG_MAPUDUNGUN
+# define LANG_MAPUDUNGUN 0x7a
+# endif
+# ifndef LANG_MARATHI
+# define LANG_MARATHI 0x4e
+# endif
+# ifndef LANG_MOHAWK
+# define LANG_MOHAWK 0x7c
+# endif
+# ifndef LANG_MONGOLIAN
+# define LANG_MONGOLIAN 0x50
+# endif
+# ifndef LANG_NEPALI
+# define LANG_NEPALI 0x61
+# endif
+# ifndef LANG_OCCITAN
+# define LANG_OCCITAN 0x82
+# endif
+# ifndef LANG_ORIYA
+# define LANG_ORIYA 0x48
+# endif
+# ifndef LANG_OROMO
+# define LANG_OROMO 0x72
+# endif
+# ifndef LANG_PAPIAMENTU
+# define LANG_PAPIAMENTU 0x79
+# endif
+# ifndef LANG_PASHTO
+# define LANG_PASHTO 0x63
+# endif
+# ifndef LANG_PUNJABI
+# define LANG_PUNJABI 0x46
+# endif
+# ifndef LANG_QUECHUA
+# define LANG_QUECHUA 0x6b
+# endif
+# ifndef LANG_ROMANSH
+# define LANG_ROMANSH 0x17
+# endif
+# ifndef LANG_SAMI
+# define LANG_SAMI 0x3b
+# endif
+# ifndef LANG_SANSKRIT
+# define LANG_SANSKRIT 0x4f
+# endif
+# ifndef LANG_SCOTTISH_GAELIC
+# define LANG_SCOTTISH_GAELIC 0x91
+# endif
+# ifndef LANG_SERBIAN
+# define LANG_SERBIAN 0x1a
+# endif
+# ifndef LANG_SINDHI
+# define LANG_SINDHI 0x59
+# endif
+# ifndef LANG_SINHALESE
+# define LANG_SINHALESE 0x5b
+# endif
+# ifndef LANG_SLOVAK
+# define LANG_SLOVAK 0x1b
+# endif
+# ifndef LANG_SOMALI
+# define LANG_SOMALI 0x77
+# endif
+# ifndef LANG_SORBIAN
+# define LANG_SORBIAN 0x2e
+# endif
+# ifndef LANG_SOTHO
+# define LANG_SOTHO 0x6c
+# endif
+# ifndef LANG_SUTU
+# define LANG_SUTU 0x30
+# endif
+# ifndef LANG_SWAHILI
+# define LANG_SWAHILI 0x41
+# endif
+# ifndef LANG_SYRIAC
+# define LANG_SYRIAC 0x5a
+# endif
+# ifndef LANG_TAGALOG
+# define LANG_TAGALOG 0x64
+# endif
+# ifndef LANG_TAJIK
+# define LANG_TAJIK 0x28
+# endif
+# ifndef LANG_TAMAZIGHT
+# define LANG_TAMAZIGHT 0x5f
+# endif
+# ifndef LANG_TAMIL
+# define LANG_TAMIL 0x49
+# endif
+# ifndef LANG_TATAR
+# define LANG_TATAR 0x44
+# endif
+# ifndef LANG_TELUGU
+# define LANG_TELUGU 0x4a
+# endif
+# ifndef LANG_THAI
+# define LANG_THAI 0x1e
+# endif
+# ifndef LANG_TIBETAN
+# define LANG_TIBETAN 0x51
+# endif
+# ifndef LANG_TIGRINYA
+# define LANG_TIGRINYA 0x73
+# endif
+# ifndef LANG_TSONGA
+# define LANG_TSONGA 0x31
+# endif
+# ifndef LANG_TSWANA
+# define LANG_TSWANA 0x32
+# endif
+# ifndef LANG_TURKMEN
+# define LANG_TURKMEN 0x42
+# endif
+# ifndef LANG_UIGHUR
+# define LANG_UIGHUR 0x80
+# endif
+# ifndef LANG_UKRAINIAN
+# define LANG_UKRAINIAN 0x22
+# endif
+# ifndef LANG_URDU
+# define LANG_URDU 0x20
+# endif
+# ifndef LANG_UZBEK
+# define LANG_UZBEK 0x43
+# endif
+# ifndef LANG_VENDA
+# define LANG_VENDA 0x33
+# endif
+# ifndef LANG_VIETNAMESE
+# define LANG_VIETNAMESE 0x2a
+# endif
+# ifndef LANG_WELSH
+# define LANG_WELSH 0x52
+# endif
+# ifndef LANG_WOLOF
+# define LANG_WOLOF 0x88
+# endif
+# ifndef LANG_XHOSA
+# define LANG_XHOSA 0x34
+# endif
+# ifndef LANG_YAKUT
+# define LANG_YAKUT 0x85
+# endif
+# ifndef LANG_YI
+# define LANG_YI 0x78
+# endif
+# ifndef LANG_YIDDISH
+# define LANG_YIDDISH 0x3d
+# endif
+# ifndef LANG_YORUBA
+# define LANG_YORUBA 0x6a
+# endif
+# ifndef LANG_ZULU
+# define LANG_ZULU 0x35
+# endif
+# ifndef SUBLANG_AFRIKAANS_SOUTH_AFRICA
+# define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
+# endif
+# ifndef SUBLANG_ALBANIAN_ALBANIA
+# define SUBLANG_ALBANIAN_ALBANIA 0x01
+# endif
+# ifndef SUBLANG_ALSATIAN_FRANCE
+# define SUBLANG_ALSATIAN_FRANCE 0x01
+# endif
+# ifndef SUBLANG_AMHARIC_ETHIOPIA
+# define SUBLANG_AMHARIC_ETHIOPIA 0x01
+# endif
+# ifndef SUBLANG_ARABIC_SAUDI_ARABIA
+# define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
+# endif
+# ifndef SUBLANG_ARABIC_IRAQ
+# define SUBLANG_ARABIC_IRAQ 0x02
+# endif
+# ifndef SUBLANG_ARABIC_EGYPT
+# define SUBLANG_ARABIC_EGYPT 0x03
+# endif
+# ifndef SUBLANG_ARABIC_LIBYA
+# define SUBLANG_ARABIC_LIBYA 0x04
+# endif
+# ifndef SUBLANG_ARABIC_ALGERIA
+# define SUBLANG_ARABIC_ALGERIA 0x05
+# endif
+# ifndef SUBLANG_ARABIC_MOROCCO
+# define SUBLANG_ARABIC_MOROCCO 0x06
+# endif
+# ifndef SUBLANG_ARABIC_TUNISIA
+# define SUBLANG_ARABIC_TUNISIA 0x07
+# endif
+# ifndef SUBLANG_ARABIC_OMAN
+# define SUBLANG_ARABIC_OMAN 0x08
+# endif
+# ifndef SUBLANG_ARABIC_YEMEN
+# define SUBLANG_ARABIC_YEMEN 0x09
+# endif
+# ifndef SUBLANG_ARABIC_SYRIA
+# define SUBLANG_ARABIC_SYRIA 0x0a
+# endif
+# ifndef SUBLANG_ARABIC_JORDAN
+# define SUBLANG_ARABIC_JORDAN 0x0b
+# endif
+# ifndef SUBLANG_ARABIC_LEBANON
+# define SUBLANG_ARABIC_LEBANON 0x0c
+# endif
+# ifndef SUBLANG_ARABIC_KUWAIT
+# define SUBLANG_ARABIC_KUWAIT 0x0d
+# endif
+# ifndef SUBLANG_ARABIC_UAE
+# define SUBLANG_ARABIC_UAE 0x0e
+# endif
+# ifndef SUBLANG_ARABIC_BAHRAIN
+# define SUBLANG_ARABIC_BAHRAIN 0x0f
+# endif
+# ifndef SUBLANG_ARABIC_QATAR
+# define SUBLANG_ARABIC_QATAR 0x10
+# endif
+# ifndef SUBLANG_ARMENIAN_ARMENIA
+# define SUBLANG_ARMENIAN_ARMENIA 0x01
+# endif
+# ifndef SUBLANG_ASSAMESE_INDIA
+# define SUBLANG_ASSAMESE_INDIA 0x01
+# endif
+# ifndef SUBLANG_AZERI_LATIN
+# define SUBLANG_AZERI_LATIN 0x01
+# endif
+# ifndef SUBLANG_AZERI_CYRILLIC
+# define SUBLANG_AZERI_CYRILLIC 0x02
+# endif
+# ifndef SUBLANG_BASHKIR_RUSSIA
+# define SUBLANG_BASHKIR_RUSSIA 0x01
+# endif
+# ifndef SUBLANG_BASQUE_BASQUE
+# define SUBLANG_BASQUE_BASQUE 0x01
+# endif
+# ifndef SUBLANG_BELARUSIAN_BELARUS
+# define SUBLANG_BELARUSIAN_BELARUS 0x01
+# endif
+# ifndef SUBLANG_BENGALI_INDIA
+# define SUBLANG_BENGALI_INDIA 0x01
+# endif
+# ifndef SUBLANG_BENGALI_BANGLADESH
+# define SUBLANG_BENGALI_BANGLADESH 0x02
+# endif
+# ifndef SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN
+# define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
+# endif
+# ifndef SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC
+# define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
+# endif
+# ifndef SUBLANG_BRETON_FRANCE
+# define SUBLANG_BRETON_FRANCE 0x01
+# endif
+# ifndef SUBLANG_BULGARIAN_BULGARIA
+# define SUBLANG_BULGARIAN_BULGARIA 0x01
+# endif
+# ifndef SUBLANG_CAMBODIAN_CAMBODIA
+# define SUBLANG_CAMBODIAN_CAMBODIA 0x01
+# endif
+# ifndef SUBLANG_CATALAN_SPAIN
+# define SUBLANG_CATALAN_SPAIN 0x01
+# endif
+# ifndef SUBLANG_CORSICAN_FRANCE
+# define SUBLANG_CORSICAN_FRANCE 0x01
+# endif
+# ifndef SUBLANG_CROATIAN_CROATIA
+# define SUBLANG_CROATIAN_CROATIA 0x01
+# endif
+# ifndef SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN
+# define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
+# endif
+# ifndef SUBLANG_CHINESE_MACAU
+# define SUBLANG_CHINESE_MACAU 0x05
+# endif
+# ifndef SUBLANG_CZECH_CZECH_REPUBLIC
+# define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
+# endif
+# ifndef SUBLANG_DANISH_DENMARK
+# define SUBLANG_DANISH_DENMARK 0x01
+# endif
+# ifndef SUBLANG_DARI_AFGHANISTAN
+# define SUBLANG_DARI_AFGHANISTAN 0x01
+# endif
+# ifndef SUBLANG_DIVEHI_MALDIVES
+# define SUBLANG_DIVEHI_MALDIVES 0x01
+# endif
+# ifndef SUBLANG_DUTCH_SURINAM
+# define SUBLANG_DUTCH_SURINAM 0x03
+# endif
+# ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
+# define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
+# endif
+# ifndef SUBLANG_ENGLISH_JAMAICA
+# define SUBLANG_ENGLISH_JAMAICA 0x08
+# endif
+# ifndef SUBLANG_ENGLISH_CARIBBEAN
+# define SUBLANG_ENGLISH_CARIBBEAN 0x09
+# endif
+# ifndef SUBLANG_ENGLISH_BELIZE
+# define SUBLANG_ENGLISH_BELIZE 0x0a
+# endif
+# ifndef SUBLANG_ENGLISH_TRINIDAD
+# define SUBLANG_ENGLISH_TRINIDAD 0x0b
+# endif
+# ifndef SUBLANG_ENGLISH_ZIMBABWE
+# define SUBLANG_ENGLISH_ZIMBABWE 0x0c
+# endif
+# ifndef SUBLANG_ENGLISH_PHILIPPINES
+# define SUBLANG_ENGLISH_PHILIPPINES 0x0d
+# endif
+# ifndef SUBLANG_ENGLISH_INDONESIA
+# define SUBLANG_ENGLISH_INDONESIA 0x0e
+# endif
+# ifndef SUBLANG_ENGLISH_HONGKONG
+# define SUBLANG_ENGLISH_HONGKONG 0x0f
+# endif
+# ifndef SUBLANG_ENGLISH_INDIA
+# define SUBLANG_ENGLISH_INDIA 0x10
+# endif
+# ifndef SUBLANG_ENGLISH_MALAYSIA
+# define SUBLANG_ENGLISH_MALAYSIA 0x11
+# endif
+# ifndef SUBLANG_ENGLISH_SINGAPORE
+# define SUBLANG_ENGLISH_SINGAPORE 0x12
+# endif
+# ifndef SUBLANG_ESTONIAN_ESTONIA
+# define SUBLANG_ESTONIAN_ESTONIA 0x01
+# endif
+# ifndef SUBLANG_FAEROESE_FAROE_ISLANDS
+# define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
+# endif
+# ifndef SUBLANG_FARSI_IRAN
+# define SUBLANG_FARSI_IRAN 0x01
+# endif
+# ifndef SUBLANG_FINNISH_FINLAND
+# define SUBLANG_FINNISH_FINLAND 0x01
+# endif
+# ifndef SUBLANG_FRENCH_LUXEMBOURG
+# define SUBLANG_FRENCH_LUXEMBOURG 0x05
+# endif
+# ifndef SUBLANG_FRENCH_MONACO
+# define SUBLANG_FRENCH_MONACO 0x06
+# endif
+# ifndef SUBLANG_FRENCH_WESTINDIES
+# define SUBLANG_FRENCH_WESTINDIES 0x07
+# endif
+# ifndef SUBLANG_FRENCH_REUNION
+# define SUBLANG_FRENCH_REUNION 0x08
+# endif
+# ifndef SUBLANG_FRENCH_CONGO
+# define SUBLANG_FRENCH_CONGO 0x09
+# endif
+# ifndef SUBLANG_FRENCH_SENEGAL
+# define SUBLANG_FRENCH_SENEGAL 0x0a
+# endif
+# ifndef SUBLANG_FRENCH_CAMEROON
+# define SUBLANG_FRENCH_CAMEROON 0x0b
+# endif
+# ifndef SUBLANG_FRENCH_COTEDIVOIRE
+# define SUBLANG_FRENCH_COTEDIVOIRE 0x0c
+# endif
+# ifndef SUBLANG_FRENCH_MALI
+# define SUBLANG_FRENCH_MALI 0x0d
+# endif
+# ifndef SUBLANG_FRENCH_MOROCCO
+# define SUBLANG_FRENCH_MOROCCO 0x0e
+# endif
+# ifndef SUBLANG_FRENCH_HAITI
+# define SUBLANG_FRENCH_HAITI 0x0f
+# endif
+# ifndef SUBLANG_FRISIAN_NETHERLANDS
+# define SUBLANG_FRISIAN_NETHERLANDS 0x01
+# endif
+# ifndef SUBLANG_GALICIAN_SPAIN
+# define SUBLANG_GALICIAN_SPAIN 0x01
+# endif
+# ifndef SUBLANG_GEORGIAN_GEORGIA
+# define SUBLANG_GEORGIAN_GEORGIA 0x01
+# endif
+# ifndef SUBLANG_GERMAN_LUXEMBOURG
+# define SUBLANG_GERMAN_LUXEMBOURG 0x04
+# endif
+# ifndef SUBLANG_GERMAN_LIECHTENSTEIN
+# define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
+# endif
+# ifndef SUBLANG_GREEK_GREECE
+# define SUBLANG_GREEK_GREECE 0x01
+# endif
+# ifndef SUBLANG_GREENLANDIC_GREENLAND
+# define SUBLANG_GREENLANDIC_GREENLAND 0x01
+# endif
+# ifndef SUBLANG_GUJARATI_INDIA
+# define SUBLANG_GUJARATI_INDIA 0x01
+# endif
+# ifndef SUBLANG_HAUSA_NIGERIA_LATIN
+# define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
+# endif
+# ifndef SUBLANG_HEBREW_ISRAEL
+# define SUBLANG_HEBREW_ISRAEL 0x01
+# endif
+# ifndef SUBLANG_HINDI_INDIA
+# define SUBLANG_HINDI_INDIA 0x01
+# endif
+# ifndef SUBLANG_HUNGARIAN_HUNGARY
+# define SUBLANG_HUNGARIAN_HUNGARY 0x01
+# endif
+# ifndef SUBLANG_ICELANDIC_ICELAND
+# define SUBLANG_ICELANDIC_ICELAND 0x01
+# endif
+# ifndef SUBLANG_IGBO_NIGERIA
+# define SUBLANG_IGBO_NIGERIA 0x01
+# endif
+# ifndef SUBLANG_INDONESIAN_INDONESIA
+# define SUBLANG_INDONESIAN_INDONESIA 0x01
+# endif
+# ifndef SUBLANG_INUKTITUT_CANADA
+# define SUBLANG_INUKTITUT_CANADA 0x01
+# endif
+# undef SUBLANG_INUKTITUT_CANADA_LATIN
+# define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
+# undef SUBLANG_IRISH_IRELAND
+# define SUBLANG_IRISH_IRELAND 0x02
+# ifndef SUBLANG_JAPANESE_JAPAN
+# define SUBLANG_JAPANESE_JAPAN 0x01
+# endif
+# ifndef SUBLANG_KANNADA_INDIA
+# define SUBLANG_KANNADA_INDIA 0x01
+# endif
+# ifndef SUBLANG_KASHMIRI_INDIA
+# define SUBLANG_KASHMIRI_INDIA 0x02
+# endif
+# ifndef SUBLANG_KAZAK_KAZAKHSTAN
+# define SUBLANG_KAZAK_KAZAKHSTAN 0x01
+# endif
+# ifndef SUBLANG_KICHE_GUATEMALA
+# define SUBLANG_KICHE_GUATEMALA 0x01
+# endif
+# ifndef SUBLANG_KINYARWANDA_RWANDA
+# define SUBLANG_KINYARWANDA_RWANDA 0x01
+# endif
+# ifndef SUBLANG_KONKANI_INDIA
+# define SUBLANG_KONKANI_INDIA 0x01
+# endif
+# ifndef SUBLANG_KYRGYZ_KYRGYZSTAN
+# define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
+# endif
+# ifndef SUBLANG_LAO_LAOS
+# define SUBLANG_LAO_LAOS 0x01
+# endif
+# ifndef SUBLANG_LATVIAN_LATVIA
+# define SUBLANG_LATVIAN_LATVIA 0x01
+# endif
+# ifndef SUBLANG_LITHUANIAN_LITHUANIA
+# define SUBLANG_LITHUANIAN_LITHUANIA 0x01
+# endif
+# undef SUBLANG_LOWER_SORBIAN_GERMANY
+# define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
+# ifndef SUBLANG_LUXEMBOURGISH_LUXEMBOURG
+# define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
+# endif
+# ifndef SUBLANG_MACEDONIAN_MACEDONIA
+# define SUBLANG_MACEDONIAN_MACEDONIA 0x01
+# endif
+# ifndef SUBLANG_MALAY_MALAYSIA
+# define SUBLANG_MALAY_MALAYSIA 0x01
+# endif
+# ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
+# define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
+# endif
+# ifndef SUBLANG_MALAYALAM_INDIA
+# define SUBLANG_MALAYALAM_INDIA 0x01
+# endif
+# ifndef SUBLANG_MALTESE_MALTA
+# define SUBLANG_MALTESE_MALTA 0x01
+# endif
+# ifndef SUBLANG_MAORI_NEW_ZEALAND
+# define SUBLANG_MAORI_NEW_ZEALAND 0x01
+# endif
+# ifndef SUBLANG_MAPUDUNGUN_CHILE
+# define SUBLANG_MAPUDUNGUN_CHILE 0x01
+# endif
+# ifndef SUBLANG_MARATHI_INDIA
+# define SUBLANG_MARATHI_INDIA 0x01
+# endif
+# ifndef SUBLANG_MOHAWK_CANADA
+# define SUBLANG_MOHAWK_CANADA 0x01
+# endif
+# ifndef SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA
+# define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
+# endif
+# ifndef SUBLANG_MONGOLIAN_PRC
+# define SUBLANG_MONGOLIAN_PRC 0x02
+# endif
+# ifndef SUBLANG_NEPALI_NEPAL
+# define SUBLANG_NEPALI_NEPAL 0x01
+# endif
+# ifndef SUBLANG_NEPALI_INDIA
+# define SUBLANG_NEPALI_INDIA 0x02
+# endif
+# ifndef SUBLANG_OCCITAN_FRANCE
+# define SUBLANG_OCCITAN_FRANCE 0x01
+# endif
+# ifndef SUBLANG_ORIYA_INDIA
+# define SUBLANG_ORIYA_INDIA 0x01
+# endif
+# ifndef SUBLANG_PASHTO_AFGHANISTAN
+# define SUBLANG_PASHTO_AFGHANISTAN 0x01
+# endif
+# ifndef SUBLANG_POLISH_POLAND
+# define SUBLANG_POLISH_POLAND 0x01
+# endif
+# ifndef SUBLANG_PUNJABI_INDIA
+# define SUBLANG_PUNJABI_INDIA 0x01
+# endif
+# ifndef SUBLANG_PUNJABI_PAKISTAN
+# define SUBLANG_PUNJABI_PAKISTAN 0x02
+# endif
+# ifndef SUBLANG_QUECHUA_BOLIVIA
+# define SUBLANG_QUECHUA_BOLIVIA 0x01
+# endif
+# ifndef SUBLANG_QUECHUA_ECUADOR
+# define SUBLANG_QUECHUA_ECUADOR 0x02
+# endif
+# ifndef SUBLANG_QUECHUA_PERU
+# define SUBLANG_QUECHUA_PERU 0x03
+# endif
+# ifndef SUBLANG_ROMANIAN_ROMANIA
+# define SUBLANG_ROMANIAN_ROMANIA 0x01
+# endif
+# ifndef SUBLANG_ROMANIAN_MOLDOVA
+# define SUBLANG_ROMANIAN_MOLDOVA 0x02
+# endif
+# ifndef SUBLANG_ROMANSH_SWITZERLAND
+# define SUBLANG_ROMANSH_SWITZERLAND 0x01
+# endif
+# ifndef SUBLANG_RUSSIAN_RUSSIA
+# define SUBLANG_RUSSIAN_RUSSIA 0x01
+# endif
+# ifndef SUBLANG_RUSSIAN_MOLDAVIA
+# define SUBLANG_RUSSIAN_MOLDAVIA 0x02
+# endif
+# ifndef SUBLANG_SAMI_NORTHERN_NORWAY
+# define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
+# endif
+# ifndef SUBLANG_SAMI_NORTHERN_SWEDEN
+# define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
+# endif
+# ifndef SUBLANG_SAMI_NORTHERN_FINLAND
+# define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
+# endif
+# ifndef SUBLANG_SAMI_LULE_NORWAY
+# define SUBLANG_SAMI_LULE_NORWAY 0x04
+# endif
+# ifndef SUBLANG_SAMI_LULE_SWEDEN
+# define SUBLANG_SAMI_LULE_SWEDEN 0x05
+# endif
+# ifndef SUBLANG_SAMI_SOUTHERN_NORWAY
+# define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
+# endif
+# ifndef SUBLANG_SAMI_SOUTHERN_SWEDEN
+# define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
+# endif
+# undef SUBLANG_SAMI_SKOLT_FINLAND
+# define SUBLANG_SAMI_SKOLT_FINLAND 0x08
+# undef SUBLANG_SAMI_INARI_FINLAND
+# define SUBLANG_SAMI_INARI_FINLAND 0x09
+# ifndef SUBLANG_SANSKRIT_INDIA
+# define SUBLANG_SANSKRIT_INDIA 0x01
+# endif
+# ifndef SUBLANG_SERBIAN_LATIN
+# define SUBLANG_SERBIAN_LATIN 0x02
+# endif
+# ifndef SUBLANG_SERBIAN_CYRILLIC
+# define SUBLANG_SERBIAN_CYRILLIC 0x03
+# endif
+# ifndef SUBLANG_SINDHI_INDIA
+# define SUBLANG_SINDHI_INDIA 0x01
+# endif
+# undef SUBLANG_SINDHI_PAKISTAN
+# define SUBLANG_SINDHI_PAKISTAN 0x02
+# ifndef SUBLANG_SINDHI_AFGHANISTAN
+# define SUBLANG_SINDHI_AFGHANISTAN 0x02
+# endif
+# ifndef SUBLANG_SINHALESE_SRI_LANKA
+# define SUBLANG_SINHALESE_SRI_LANKA 0x01
+# endif
+# ifndef SUBLANG_SLOVAK_SLOVAKIA
+# define SUBLANG_SLOVAK_SLOVAKIA 0x01
+# endif
+# ifndef SUBLANG_SLOVENIAN_SLOVENIA
+# define SUBLANG_SLOVENIAN_SLOVENIA 0x01
+# endif
+# ifndef SUBLANG_SOTHO_SOUTH_AFRICA
+# define SUBLANG_SOTHO_SOUTH_AFRICA 0x01
+# endif
+# ifndef SUBLANG_SPANISH_GUATEMALA
+# define SUBLANG_SPANISH_GUATEMALA 0x04
+# endif
+# ifndef SUBLANG_SPANISH_COSTA_RICA
+# define SUBLANG_SPANISH_COSTA_RICA 0x05
+# endif
+# ifndef SUBLANG_SPANISH_PANAMA
+# define SUBLANG_SPANISH_PANAMA 0x06
+# endif
+# ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
+# define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
+# endif
+# ifndef SUBLANG_SPANISH_VENEZUELA
+# define SUBLANG_SPANISH_VENEZUELA 0x08
+# endif
+# ifndef SUBLANG_SPANISH_COLOMBIA
+# define SUBLANG_SPANISH_COLOMBIA 0x09
+# endif
+# ifndef SUBLANG_SPANISH_PERU
+# define SUBLANG_SPANISH_PERU 0x0a
+# endif
+# ifndef SUBLANG_SPANISH_ARGENTINA
+# define SUBLANG_SPANISH_ARGENTINA 0x0b
+# endif
+# ifndef SUBLANG_SPANISH_ECUADOR
+# define SUBLANG_SPANISH_ECUADOR 0x0c
+# endif
+# ifndef SUBLANG_SPANISH_CHILE
+# define SUBLANG_SPANISH_CHILE 0x0d
+# endif
+# ifndef SUBLANG_SPANISH_URUGUAY
+# define SUBLANG_SPANISH_URUGUAY 0x0e
+# endif
+# ifndef SUBLANG_SPANISH_PARAGUAY
+# define SUBLANG_SPANISH_PARAGUAY 0x0f
+# endif
+# ifndef SUBLANG_SPANISH_BOLIVIA
+# define SUBLANG_SPANISH_BOLIVIA 0x10
+# endif
+# ifndef SUBLANG_SPANISH_EL_SALVADOR
+# define SUBLANG_SPANISH_EL_SALVADOR 0x11
+# endif
+# ifndef SUBLANG_SPANISH_HONDURAS
+# define SUBLANG_SPANISH_HONDURAS 0x12
+# endif
+# ifndef SUBLANG_SPANISH_NICARAGUA
+# define SUBLANG_SPANISH_NICARAGUA 0x13
+# endif
+# ifndef SUBLANG_SPANISH_PUERTO_RICO
+# define SUBLANG_SPANISH_PUERTO_RICO 0x14
+# endif
+# ifndef SUBLANG_SPANISH_US
+# define SUBLANG_SPANISH_US 0x15
+# endif
+# ifndef SUBLANG_SWAHILI_KENYA
+# define SUBLANG_SWAHILI_KENYA 0x01
+# endif
+# ifndef SUBLANG_SWEDISH_SWEDEN
+# define SUBLANG_SWEDISH_SWEDEN 0x01
+# endif
+# ifndef SUBLANG_SWEDISH_FINLAND
+# define SUBLANG_SWEDISH_FINLAND 0x02
+# endif
+# ifndef SUBLANG_SYRIAC_SYRIA
+# define SUBLANG_SYRIAC_SYRIA 0x01
+# endif
+# ifndef SUBLANG_TAGALOG_PHILIPPINES
+# define SUBLANG_TAGALOG_PHILIPPINES 0x01
+# endif
+# ifndef SUBLANG_TAJIK_TAJIKISTAN
+# define SUBLANG_TAJIK_TAJIKISTAN 0x01
+# endif
+# ifndef SUBLANG_TAMAZIGHT_ARABIC
+# define SUBLANG_TAMAZIGHT_ARABIC 0x01
+# endif
+# ifndef SUBLANG_TAMAZIGHT_ALGERIA_LATIN
+# define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
+# endif
+# ifndef SUBLANG_TAMIL_INDIA
+# define SUBLANG_TAMIL_INDIA 0x01
+# endif
+# ifndef SUBLANG_TATAR_RUSSIA
+# define SUBLANG_TATAR_RUSSIA 0x01
+# endif
+# ifndef SUBLANG_TELUGU_INDIA
+# define SUBLANG_TELUGU_INDIA 0x01
+# endif
+# ifndef SUBLANG_THAI_THAILAND
+# define SUBLANG_THAI_THAILAND 0x01
+# endif
+# ifndef SUBLANG_TIBETAN_PRC
+# define SUBLANG_TIBETAN_PRC 0x01
+# endif
+# undef SUBLANG_TIBETAN_BHUTAN
+# define SUBLANG_TIBETAN_BHUTAN 0x02
+# ifndef SUBLANG_TIGRINYA_ETHIOPIA
+# define SUBLANG_TIGRINYA_ETHIOPIA 0x01
+# endif
+# ifndef SUBLANG_TIGRINYA_ERITREA
+# define SUBLANG_TIGRINYA_ERITREA 0x02
+# endif
+# ifndef SUBLANG_TSWANA_SOUTH_AFRICA
+# define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
+# endif
+# ifndef SUBLANG_TURKISH_TURKEY
+# define SUBLANG_TURKISH_TURKEY 0x01
+# endif
+# ifndef SUBLANG_TURKMEN_TURKMENISTAN
+# define SUBLANG_TURKMEN_TURKMENISTAN 0x01
+# endif
+# ifndef SUBLANG_UIGHUR_PRC
+# define SUBLANG_UIGHUR_PRC 0x01
+# endif
+# ifndef SUBLANG_UKRAINIAN_UKRAINE
+# define SUBLANG_UKRAINIAN_UKRAINE 0x01
+# endif
+# ifndef SUBLANG_UPPER_SORBIAN_GERMANY
+# define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
+# endif
+# ifndef SUBLANG_URDU_PAKISTAN
+# define SUBLANG_URDU_PAKISTAN 0x01
+# endif
+# ifndef SUBLANG_URDU_INDIA
+# define SUBLANG_URDU_INDIA 0x02
+# endif
+# ifndef SUBLANG_UZBEK_LATIN
+# define SUBLANG_UZBEK_LATIN 0x01
+# endif
+# ifndef SUBLANG_UZBEK_CYRILLIC
+# define SUBLANG_UZBEK_CYRILLIC 0x02
+# endif
+# ifndef SUBLANG_VIETNAMESE_VIETNAM
+# define SUBLANG_VIETNAMESE_VIETNAM 0x01
+# endif
+# ifndef SUBLANG_WELSH_UNITED_KINGDOM
+# define SUBLANG_WELSH_UNITED_KINGDOM 0x01
+# endif
+# ifndef SUBLANG_WOLOF_SENEGAL
+# define SUBLANG_WOLOF_SENEGAL 0x01
+# endif
+# ifndef SUBLANG_XHOSA_SOUTH_AFRICA
+# define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
+# endif
+# ifndef SUBLANG_YAKUT_RUSSIA
+# define SUBLANG_YAKUT_RUSSIA 0x01
+# endif
+# ifndef SUBLANG_YI_PRC
+# define SUBLANG_YI_PRC 0x01
+# endif
+# ifndef SUBLANG_YORUBA_NIGERIA
+# define SUBLANG_YORUBA_NIGERIA 0x01
+# endif
+# ifndef SUBLANG_ZULU_SOUTH_AFRICA
+# define SUBLANG_ZULU_SOUTH_AFRICA 0x01
+# endif
+/* GetLocaleInfoA operations.  */
+# ifndef LOCALE_SNAME
+# define LOCALE_SNAME 0x5c
+# endif
+# ifndef LOCALE_NAME_MAX_LENGTH
+# define LOCALE_NAME_MAX_LENGTH 85
+# endif
+/* Don't assume that UNICODE is not defined.  */
+# undef GetLocaleInfo
+# define GetLocaleInfo GetLocaleInfoA
+# undef EnumSystemLocales
+# define EnumSystemLocales EnumSystemLocalesA
+#endif
+
+/* We want to use the system's setlocale() function here, not the gnulib
+   override.  */
+#undef setlocale
+
+
+#if HAVE_CFPREFERENCESCOPYAPPVALUE
+/* Mac OS X 10.4 or newer */
+
+/* Canonicalize a Mac OS X locale name to a Unix locale name.
+   NAME is a sufficiently large buffer.
+   On input, it contains the Mac OS X locale name.
+   On output, it contains the Unix locale name.  */
+# if !defined IN_LIBINTL
+static
+# endif
+void
+gl_locale_name_canonicalize (char *name)
+{
+  /* This conversion is based on a posting by
+     Deborah GoldSmith <goldsmit@apple.com> on 2005-03-08,
+     https://lists.apple.com/archives/carbon-dev/2005/Mar/msg00293.html */
+
+  /* Convert legacy (NeXTstep inherited) English names to Unix (ISO 639 and
+     ISO 3166) names.  Prior to Mac OS X 10.3, there is no API for doing this.
+     Therefore we do it ourselves, using a table based on the results of the
+     Mac OS X 10.3.8 function
+     CFLocaleCreateCanonicalLocaleIdentifierFromString().  */
+  typedef struct { const char legacy[21+1]; const char unixy[5+1]; }
+          legacy_entry;
+  static const legacy_entry legacy_table[] = {
+    { "Afrikaans",             "af" },
+    { "Albanian",              "sq" },
+    { "Amharic",               "am" },
+    { "Arabic",                "ar" },
+    { "Armenian",              "hy" },
+    { "Assamese",              "as" },
+    { "Aymara",                "ay" },
+    { "Azerbaijani",           "az" },
+    { "Basque",                "eu" },
+    { "Belarusian",            "be" },
+    { "Belorussian",           "be" },
+    { "Bengali",               "bn" },
+    { "Brazilian Portugese",   "pt_BR" },
+    { "Brazilian Portuguese",  "pt_BR" },
+    { "Breton",                "br" },
+    { "Bulgarian",             "bg" },
+    { "Burmese",               "my" },
+    { "Byelorussian",          "be" },
+    { "Catalan",               "ca" },
+    { "Chewa",                 "ny" },
+    { "Chichewa",              "ny" },
+    { "Chinese",               "zh" },
+    { "Chinese, Simplified",   "zh_CN" },
+    { "Chinese, Traditional",  "zh_TW" },
+    { "Chinese, Tradtional",   "zh_TW" },
+    { "Croatian",              "hr" },
+    { "Czech",                 "cs" },
+    { "Danish",                "da" },
+    { "Dutch",                 "nl" },
+    { "Dzongkha",              "dz" },
+    { "English",               "en" },
+    { "Esperanto",             "eo" },
+    { "Estonian",              "et" },
+    { "Faroese",               "fo" },
+    { "Farsi",                 "fa" },
+    { "Finnish",               "fi" },
+    { "Flemish",               "nl_BE" },
+    { "French",                "fr" },
+    { "Galician",              "gl" },
+    { "Gallegan",              "gl" },
+    { "Georgian",              "ka" },
+    { "German",                "de" },
+    { "Greek",                 "el" },
+    { "Greenlandic",           "kl" },
+    { "Guarani",               "gn" },
+    { "Gujarati",              "gu" },
+    { "Hawaiian",              "haw" }, /* Yes, "haw", not "cpe".  */
+    { "Hebrew",                "he" },
+    { "Hindi",                 "hi" },
+    { "Hungarian",             "hu" },
+    { "Icelandic",             "is" },
+    { "Indonesian",            "id" },
+    { "Inuktitut",             "iu" },
+    { "Irish",                 "ga" },
+    { "Italian",               "it" },
+    { "Japanese",              "ja" },
+    { "Javanese",              "jv" },
+    { "Kalaallisut",           "kl" },
+    { "Kannada",               "kn" },
+    { "Kashmiri",              "ks" },
+    { "Kazakh",                "kk" },
+    { "Khmer",                 "km" },
+    { "Kinyarwanda",           "rw" },
+    { "Kirghiz",               "ky" },
+    { "Korean",                "ko" },
+    { "Kurdish",               "ku" },
+    { "Latin",                 "la" },
+    { "Latvian",               "lv" },
+    { "Lithuanian",            "lt" },
+    { "Macedonian",            "mk" },
+    { "Malagasy",              "mg" },
+    { "Malay",                 "ms" },
+    { "Malayalam",             "ml" },
+    { "Maltese",               "mt" },
+    { "Manx",                  "gv" },
+    { "Marathi",               "mr" },
+    { "Moldavian",             "mo" },
+    { "Mongolian",             "mn" },
+    { "Nepali",                "ne" },
+    { "Norwegian",             "nb" }, /* Yes, "nb", not the obsolete "no".  */
+    { "Nyanja",                "ny" },
+    { "Nynorsk",               "nn" },
+    { "Oriya",                 "or" },
+    { "Oromo",                 "om" },
+    { "Panjabi",               "pa" },
+    { "Pashto",                "ps" },
+    { "Persian",               "fa" },
+    { "Polish",                "pl" },
+    { "Portuguese",            "pt" },
+    { "Portuguese, Brazilian", "pt_BR" },
+    { "Punjabi",               "pa" },
+    { "Pushto",                "ps" },
+    { "Quechua",               "qu" },
+    { "Romanian",              "ro" },
+    { "Ruanda",                "rw" },
+    { "Rundi",                 "rn" },
+    { "Russian",               "ru" },
+    { "Sami",                  "se_NO" }, /* Not just "se".  */
+    { "Sanskrit",              "sa" },
+    { "Scottish",              "gd" },
+    { "Serbian",               "sr" },
+    { "Simplified Chinese",    "zh_CN" },
+    { "Sindhi",                "sd" },
+    { "Sinhalese",             "si" },
+    { "Slovak",                "sk" },
+    { "Slovenian",             "sl" },
+    { "Somali",                "so" },
+    { "Spanish",               "es" },
+    { "Sundanese",             "su" },
+    { "Swahili",               "sw" },
+    { "Swedish",               "sv" },
+    { "Tagalog",               "tl" },
+    { "Tajik",                 "tg" },
+    { "Tajiki",                "tg" },
+    { "Tamil",                 "ta" },
+    { "Tatar",                 "tt" },
+    { "Telugu",                "te" },
+    { "Thai",                  "th" },
+    { "Tibetan",               "bo" },
+    { "Tigrinya",              "ti" },
+    { "Tongan",                "to" },
+    { "Traditional Chinese",   "zh_TW" },
+    { "Turkish",               "tr" },
+    { "Turkmen",               "tk" },
+    { "Uighur",                "ug" },
+    { "Ukrainian",             "uk" },
+    { "Urdu",                  "ur" },
+    { "Uzbek",                 "uz" },
+    { "Vietnamese",            "vi" },
+    { "Welsh",                 "cy" },
+    { "Yiddish",               "yi" }
+  };
+
+  /* Convert new-style locale names with language tags (ISO 639 and ISO 15924)
+     to Unix (ISO 639 and ISO 3166) names.  */
+  typedef struct { const char langtag[7+1]; const char unixy[12+1]; }
+          langtag_entry;
+  static const langtag_entry langtag_table[] = {
+    /* Mac OS X has "az-Arab", "az-Cyrl", "az-Latn".
+       The default script for az on Unix is Latin.  */
+    { "az-Latn", "az" },
+    /* Mac OS X has "bs-Cyrl", "bs-Latn".
+       The default script for bs on Unix is Latin.  */
+    { "bs-Latn", "bs" },
+    /* Mac OS X has "ga-dots".  Does not yet exist on Unix.  */
+    { "ga-dots", "ga" },
+    /* Mac OS X has "kk-Cyrl".
+       The default script for kk on Unix is Cyrillic.  */
+    { "kk-Cyrl", "kk" },
+    /* Mac OS X has "mn-Cyrl", "mn-Mong".
+       The default script for mn on Unix is Cyrillic.  */
+    { "mn-Cyrl", "mn" },
+    /* Mac OS X has "ms-Arab", "ms-Latn".
+       The default script for ms on Unix is Latin.  */
+    { "ms-Latn", "ms" },
+    /* Mac OS X has "pa-Arab", "pa-Guru".
+       Country codes are used to distinguish these on Unix.  */
+    { "pa-Arab", "pa_PK" },
+    { "pa-Guru", "pa_IN" },
+    /* Mac OS X has "shi-Latn", "shi-Tfng".  Does not yet exist on Unix.  */
+    /* Mac OS X has "sr-Cyrl", "sr-Latn".
+       The default script for sr on Unix is Cyrillic.  */
+    { "sr-Cyrl", "sr" },
+    /* Mac OS X has "tg-Cyrl".
+       The default script for tg on Unix is Cyrillic.  */
+    { "tg-Cyrl", "tg" },
+    /* Mac OS X has "tk-Cyrl".
+       The default script for tk on Unix is Cyrillic.  */
+    { "tk-Cyrl", "tk" },
+    /* Mac OS X has "tt-Cyrl".
+       The default script for tt on Unix is Cyrillic.  */
+    { "tt-Cyrl", "tt" },
+    /* Mac OS X has "uz-Arab", "uz-Cyrl", "uz-Latn".
+       The default script for uz on Unix is Latin.  */
+    { "uz-Latn", "uz" },
+    /* Mac OS X has "vai-Latn", "vai-Vaii".  Does not yet exist on Unix.  */
+    /* Mac OS X has "yue-Hans", "yue-Hant".
+       The default script for yue on Unix is Simplified Han.  */
+    { "yue-Hans", "yue" },
+    /* Mac OS X has "zh-Hans", "zh-Hant".
+       Country codes are used to distinguish these on Unix.  */
+    { "zh-Hans", "zh_CN" },
+    { "zh-Hant", "zh_TW" }
+  };
+
+  /* Convert script names (ISO 15924) to Unix conventions.
+     See https://www.unicode.org/iso15924/iso15924-codes.html  */
+  typedef struct { const char script[4+1]; const char unixy[9+1]; }
+          script_entry;
+  static const script_entry script_table[] = {
+    { "Arab", "arabic" },
+    { "Cyrl", "cyrillic" },
+    { "Latn", "latin" },
+    { "Mong", "mongolian" }
+  };
+
+  /* Step 1: Convert using legacy_table.  */
+  if (name[0] >= 'A' && name[0] <= 'Z')
+    {
+      unsigned int i1, i2;
+      i1 = 0;
+      i2 = sizeof (legacy_table) / sizeof (legacy_entry);
+      while (i2 - i1 > 1)
+        {
+          /* At this point we know that if name occurs in legacy_table,
+             its index must be >= i1 and < i2.  */
+          unsigned int i = (i1 + i2) >> 1;
+          const legacy_entry *p = &legacy_table[i];
+          if (strcmp (name, p->legacy) < 0)
+            i2 = i;
+          else
+            i1 = i;
+        }
+      if (strcmp (name, legacy_table[i1].legacy) == 0)
+        {
+          strcpy (name, legacy_table[i1].unixy);
+          return;
+        }
+    }
+
+  /* Step 2: Convert using langtag_table and script_table.  */
+  if (strlen (name) == 7 && name[2] == '-')
+    {
+      unsigned int i1, i2;
+      i1 = 0;
+      i2 = sizeof (langtag_table) / sizeof (langtag_entry);
+      while (i2 - i1 > 1)
+        {
+          /* At this point we know that if name occurs in langtag_table,
+             its index must be >= i1 and < i2.  */
+          unsigned int i = (i1 + i2) >> 1;
+          const langtag_entry *p = &langtag_table[i];
+          if (strcmp (name, p->langtag) < 0)
+            i2 = i;
+          else
+            i1 = i;
+        }
+      if (strcmp (name, langtag_table[i1].langtag) == 0)
+        {
+          strcpy (name, langtag_table[i1].unixy);
+          return;
+        }
+
+      i1 = 0;
+      i2 = sizeof (script_table) / sizeof (script_entry);
+      while (i2 - i1 > 1)
+        {
+          /* At this point we know that if (name + 3) occurs in script_table,
+             its index must be >= i1 and < i2.  */
+          unsigned int i = (i1 + i2) >> 1;
+          const script_entry *p = &script_table[i];
+          if (strcmp (name + 3, p->script) < 0)
+            i2 = i;
+          else
+            i1 = i;
+        }
+      if (strcmp (name + 3, script_table[i1].script) == 0)
+        {
+          name[2] = '@';
+          strcpy (name + 3, script_table[i1].unixy);
+          return;
+        }
+    }
+
+  /* Step 3: Convert new-style dash to Unix underscore. */
+  {
+    char *p;
+    for (p = name; *p != '\0'; p++)
+      if (*p == '-')
+        *p = '_';
+  }
+}
+
+#endif
+
+
+#if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Native Windows or Cygwin */
+
+/* Canonicalize a Windows native locale name to a Unix locale name.
+   NAME is a sufficiently large buffer.
+   On input, it contains the Windows locale name.
+   On output, it contains the Unix locale name.  */
+# if !defined IN_LIBINTL
+static
+# endif
+void
+gl_locale_name_canonicalize (char *name)
+{
+  /* FIXME: This is probably incomplete: it does not handle "zh-Hans" and
+     "zh-Hant".  */
+  char *p;
+
+  for (p = name; *p != '\0'; p++)
+    if (*p == '-')
+      {
+        *p = '_';
+        p++;
+        for (; *p != '\0'; p++)
+          {
+            if (*p >= 'a' && *p <= 'z')
+              *p += 'A' - 'a';
+            if (*p == '-')
+              {
+                *p = '\0';
+                return;
+              }
+          }
+        return;
+      }
+}
+
+# if !defined IN_LIBINTL
+static
+# endif
+const char *
+gl_locale_name_from_win32_LANGID (LANGID langid)
+{
+  /* Activate the new code only when the GETTEXT_MUI environment variable is
+     set, for the time being, since the new code is not well tested.  */
+  if (getenv ("GETTEXT_MUI") != NULL)
+    {
+      static char namebuf[256];
+
+      /* Query the system's notion of locale name.
+         On Windows95/98/ME, GetLocaleInfoA returns some incorrect results.
+         But we don't need to support systems that are so old.  */
+      if (GetLocaleInfoA (MAKELCID (langid, SORT_DEFAULT), LOCALE_SNAME,
+                          namebuf, sizeof (namebuf) - 1))
+        {
+          /* Convert it to a Unix locale name.  */
+          gl_locale_name_canonicalize (namebuf);
+          return namebuf;
+        }
+    }
+  /* Internet Explorer has an LCID to RFC3066 name mapping stored in
+     HKEY_CLASSES_ROOT\Mime\Database\Rfc1766.  But we better don't use that
+     since IE's i18n subsystem is known to be inconsistent with the native
+     Windows base (e.g. they have different character conversion facilities
+     that produce different results).  */
+  /* Use our own table.  */
+  {
+    int primary, sub;
+
+    /* Split into language and territory part.  */
+    primary = PRIMARYLANGID (langid);
+    sub = SUBLANGID (langid);
+
+    /* Dispatch on language.
+       See also https://www.unicode.org/unicode/onlinedat/languages.html .
+       For details about languages, see https://www.ethnologue.com/ .  */
+    switch (primary)
+      {
+      case LANG_AFRIKAANS:
+        switch (sub)
+          {
+          case SUBLANG_AFRIKAANS_SOUTH_AFRICA: return "af_ZA";
+          }
+        return "af";
+      case LANG_ALBANIAN:
+        switch (sub)
+          {
+          case SUBLANG_ALBANIAN_ALBANIA: return "sq_AL";
+          }
+        return "sq";
+      case LANG_ALSATIAN:
+        switch (sub)
+          {
+          case SUBLANG_ALSATIAN_FRANCE: return "gsw_FR";
+          }
+        return "gsw";
+      case LANG_AMHARIC:
+        switch (sub)
+          {
+          case SUBLANG_AMHARIC_ETHIOPIA: return "am_ET";
+          }
+        return "am";
+      case LANG_ARABIC:
+        switch (sub)
+          {
+          case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA";
+          case SUBLANG_ARABIC_IRAQ: return "ar_IQ";
+          case SUBLANG_ARABIC_EGYPT: return "ar_EG";
+          case SUBLANG_ARABIC_LIBYA: return "ar_LY";
+          case SUBLANG_ARABIC_ALGERIA: return "ar_DZ";
+          case SUBLANG_ARABIC_MOROCCO: return "ar_MA";
+          case SUBLANG_ARABIC_TUNISIA: return "ar_TN";
+          case SUBLANG_ARABIC_OMAN: return "ar_OM";
+          case SUBLANG_ARABIC_YEMEN: return "ar_YE";
+          case SUBLANG_ARABIC_SYRIA: return "ar_SY";
+          case SUBLANG_ARABIC_JORDAN: return "ar_JO";
+          case SUBLANG_ARABIC_LEBANON: return "ar_LB";
+          case SUBLANG_ARABIC_KUWAIT: return "ar_KW";
+          case SUBLANG_ARABIC_UAE: return "ar_AE";
+          case SUBLANG_ARABIC_BAHRAIN: return "ar_BH";
+          case SUBLANG_ARABIC_QATAR: return "ar_QA";
+          }
+        return "ar";
+      case LANG_ARMENIAN:
+        switch (sub)
+          {
+          case SUBLANG_ARMENIAN_ARMENIA: return "hy_AM";
+          }
+        return "hy";
+      case LANG_ASSAMESE:
+        switch (sub)
+          {
+          case SUBLANG_ASSAMESE_INDIA: return "as_IN";
+          }
+        return "as";
+      case LANG_AZERI:
+        switch (sub)
+          {
+          /* FIXME: Adjust this when Azerbaijani locales appear on Unix.  */
+          case 0x1e: return "az@latin";
+          case SUBLANG_AZERI_LATIN: return "az_AZ@latin";
+          case 0x1d: return "az@cyrillic";
+          case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic";
+          }
+        return "az";
+      case LANG_BASHKIR:
+        switch (sub)
+          {
+          case SUBLANG_BASHKIR_RUSSIA: return "ba_RU";
+          }
+        return "ba";
+      case LANG_BASQUE:
+        switch (sub)
+          {
+          case SUBLANG_BASQUE_BASQUE: return "eu_ES";
+          }
+        return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR".  */
+      case LANG_BELARUSIAN:
+        switch (sub)
+          {
+          case SUBLANG_BELARUSIAN_BELARUS: return "be_BY";
+          }
+        return "be";
+      case LANG_BENGALI:
+        switch (sub)
+          {
+          case SUBLANG_BENGALI_INDIA: return "bn_IN";
+          case SUBLANG_BENGALI_BANGLADESH: return "bn_BD";
+          }
+        return "bn";
+      case LANG_BRETON:
+        switch (sub)
+          {
+          case SUBLANG_BRETON_FRANCE: return "br_FR";
+          }
+        return "br";
+      case LANG_BULGARIAN:
+        switch (sub)
+          {
+          case SUBLANG_BULGARIAN_BULGARIA: return "bg_BG";
+          }
+        return "bg";
+      case LANG_BURMESE:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "my_MM";
+          }
+        return "my";
+      case LANG_CAMBODIAN:
+        switch (sub)
+          {
+          case SUBLANG_CAMBODIAN_CAMBODIA: return "km_KH";
+          }
+        return "km";
+      case LANG_CATALAN:
+        switch (sub)
+          {
+          case SUBLANG_CATALAN_SPAIN: return "ca_ES";
+          }
+        return "ca";
+      case LANG_CHEROKEE:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "chr_US";
+          }
+        return "chr";
+      case LANG_CHINESE:
+        switch (sub)
+          {
+          case SUBLANG_CHINESE_TRADITIONAL: case 0x1f: return "zh_TW";
+          case SUBLANG_CHINESE_SIMPLIFIED: case 0x00: return "zh_CN";
+          case SUBLANG_CHINESE_HONGKONG: return "zh_HK"; /* traditional */
+          case SUBLANG_CHINESE_SINGAPORE: return "zh_SG"; /* simplified */
+          case SUBLANG_CHINESE_MACAU: return "zh_MO"; /* traditional */
+          }
+        return "zh";
+      case LANG_CORSICAN:
+        switch (sub)
+          {
+          case SUBLANG_CORSICAN_FRANCE: return "co_FR";
+          }
+        return "co";
+      case LANG_CROATIAN:      /* LANG_CROATIAN == LANG_SERBIAN == LANG_BOSNIAN
+                                * What used to be called Serbo-Croatian
+                                * should really now be two separate
+                                * languages because of political reasons.
+                                * (Says tml, who knows nothing about Serbian
+                                * or Croatian.)
+                                * (I can feel those flames coming already.)
+                                */
+        switch (sub)
+          {
+          /* Croatian */
+          case 0x00: return "hr";
+          case SUBLANG_CROATIAN_CROATIA: return "hr_HR";
+          case SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: return "hr_BA";
+          /* Serbian */
+          case 0x1f: return "sr";
+          case 0x1c: return "sr"; /* latin */
+          case SUBLANG_SERBIAN_LATIN: return "sr_CS"; /* latin */
+          case 0x09: return "sr_RS"; /* latin */
+          case 0x0b: return "sr_ME"; /* latin */
+          case 0x06: return "sr_BA"; /* latin */
+          case 0x1b: return "sr@cyrillic";
+          case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic";
+          case 0x0a: return "sr_RS@cyrillic";
+          case 0x0c: return "sr_ME@cyrillic";
+          case 0x07: return "sr_BA@cyrillic";
+          /* Bosnian */
+          case 0x1e: return "bs";
+          case 0x1a: return "bs"; /* latin */
+          case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: return "bs_BA"; /* latin */
+          case 0x19: return "bs@cyrillic";
+          case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: return "bs_BA@cyrillic";
+          }
+        return "hr";
+      case LANG_CZECH:
+        switch (sub)
+          {
+          case SUBLANG_CZECH_CZECH_REPUBLIC: return "cs_CZ";
+          }
+        return "cs";
+      case LANG_DANISH:
+        switch (sub)
+          {
+          case SUBLANG_DANISH_DENMARK: return "da_DK";
+          }
+        return "da";
+      case LANG_DARI:
+        /* FIXME: Adjust this when such locales appear on Unix.  */
+        switch (sub)
+          {
+          case SUBLANG_DARI_AFGHANISTAN: return "prs_AF";
+          }
+        return "prs";
+      case LANG_DIVEHI:
+        switch (sub)
+          {
+          case SUBLANG_DIVEHI_MALDIVES: return "dv_MV";
+          }
+        return "dv";
+      case LANG_DUTCH:
+        switch (sub)
+          {
+          case SUBLANG_DUTCH: return "nl_NL";
+          case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE";
+          case SUBLANG_DUTCH_SURINAM: return "nl_SR";
+          }
+        return "nl";
+      case LANG_EDO:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "bin_NG";
+          }
+        return "bin";
+      case LANG_ENGLISH:
+        switch (sub)
+          {
+          /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
+           * English was the language spoken in England.
+           * Oh well.
+           */
+          case SUBLANG_ENGLISH_US: return "en_US";
+          case SUBLANG_ENGLISH_UK: return "en_GB";
+          case SUBLANG_ENGLISH_AUS: return "en_AU";
+          case SUBLANG_ENGLISH_CAN: return "en_CA";
+          case SUBLANG_ENGLISH_NZ: return "en_NZ";
+          case SUBLANG_ENGLISH_EIRE: return "en_IE";
+          case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA";
+          case SUBLANG_ENGLISH_JAMAICA: return "en_JM";
+          case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */
+          case SUBLANG_ENGLISH_BELIZE: return "en_BZ";
+          case SUBLANG_ENGLISH_TRINIDAD: return "en_TT";
+          case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW";
+          case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH";
+          case SUBLANG_ENGLISH_INDONESIA: return "en_ID";
+          case SUBLANG_ENGLISH_HONGKONG: return "en_HK";
+          case SUBLANG_ENGLISH_INDIA: return "en_IN";
+          case SUBLANG_ENGLISH_MALAYSIA: return "en_MY";
+          case SUBLANG_ENGLISH_SINGAPORE: return "en_SG";
+          }
+        return "en";
+      case LANG_ESTONIAN:
+        switch (sub)
+          {
+          case SUBLANG_ESTONIAN_ESTONIA: return "et_EE";
+          }
+        return "et";
+      case LANG_FAEROESE:
+        switch (sub)
+          {
+          case SUBLANG_FAEROESE_FAROE_ISLANDS: return "fo_FO";
+          }
+        return "fo";
+      case LANG_FARSI:
+        switch (sub)
+          {
+          case SUBLANG_FARSI_IRAN: return "fa_IR";
+          }
+        return "fa";
+      case LANG_FINNISH:
+        switch (sub)
+          {
+          case SUBLANG_FINNISH_FINLAND: return "fi_FI";
+          }
+        return "fi";
+      case LANG_FRENCH:
+        switch (sub)
+          {
+          case SUBLANG_FRENCH: return "fr_FR";
+          case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE";
+          case SUBLANG_FRENCH_CANADIAN: return "fr_CA";
+          case SUBLANG_FRENCH_SWISS: return "fr_CH";
+          case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU";
+          case SUBLANG_FRENCH_MONACO: return "fr_MC";
+          case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */
+          case SUBLANG_FRENCH_REUNION: return "fr_RE";
+          case SUBLANG_FRENCH_CONGO: return "fr_CG";
+          case SUBLANG_FRENCH_SENEGAL: return "fr_SN";
+          case SUBLANG_FRENCH_CAMEROON: return "fr_CM";
+          case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI";
+          case SUBLANG_FRENCH_MALI: return "fr_ML";
+          case SUBLANG_FRENCH_MOROCCO: return "fr_MA";
+          case SUBLANG_FRENCH_HAITI: return "fr_HT";
+          }
+        return "fr";
+      case LANG_FRISIAN:
+        switch (sub)
+          {
+          case SUBLANG_FRISIAN_NETHERLANDS: return "fy_NL";
+          }
+        return "fy";
+      case LANG_FULFULDE:
+        /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin.  */
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "ff_NG";
+          }
+        return "ff";
+      case LANG_GAELIC:
+        switch (sub)
+          {
+          case 0x01: /* SCOTTISH */
+            /* old, superseded by LANG_SCOTTISH_GAELIC */
+            return "gd_GB";
+          case SUBLANG_IRISH_IRELAND: return "ga_IE";
+          }
+        return "ga";
+      case LANG_GALICIAN:
+        switch (sub)
+          {
+          case SUBLANG_GALICIAN_SPAIN: return "gl_ES";
+          }
+        return "gl";
+      case LANG_GEORGIAN:
+        switch (sub)
+          {
+          case SUBLANG_GEORGIAN_GEORGIA: return "ka_GE";
+          }
+        return "ka";
+      case LANG_GERMAN:
+        switch (sub)
+          {
+          case SUBLANG_GERMAN: return "de_DE";
+          case SUBLANG_GERMAN_SWISS: return "de_CH";
+          case SUBLANG_GERMAN_AUSTRIAN: return "de_AT";
+          case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU";
+          case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI";
+          }
+        return "de";
+      case LANG_GREEK:
+        switch (sub)
+          {
+          case SUBLANG_GREEK_GREECE: return "el_GR";
+          }
+        return "el";
+      case LANG_GREENLANDIC:
+        switch (sub)
+          {
+          case SUBLANG_GREENLANDIC_GREENLAND: return "kl_GL";
+          }
+        return "kl";
+      case LANG_GUARANI:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "gn_PY";
+          }
+        return "gn";
+      case LANG_GUJARATI:
+        switch (sub)
+          {
+          case SUBLANG_GUJARATI_INDIA: return "gu_IN";
+          }
+        return "gu";
+      case LANG_HAUSA:
+        switch (sub)
+          {
+          case 0x1f: return "ha";
+          case SUBLANG_HAUSA_NIGERIA_LATIN: return "ha_NG";
+          }
+        return "ha";
+      case LANG_HAWAIIAN:
+        /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers)
+           or Hawaii Creole English ("cpe_US", 600000 speakers)?  */
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "cpe_US";
+          }
+        return "cpe";
+      case LANG_HEBREW:
+        switch (sub)
+          {
+          case SUBLANG_HEBREW_ISRAEL: return "he_IL";
+          }
+        return "he";
+      case LANG_HINDI:
+        switch (sub)
+          {
+          case SUBLANG_HINDI_INDIA: return "hi_IN";
+          }
+        return "hi";
+      case LANG_HUNGARIAN:
+        switch (sub)
+          {
+          case SUBLANG_HUNGARIAN_HUNGARY: return "hu_HU";
+          }
+        return "hu";
+      case LANG_IBIBIO:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "nic_NG";
+          }
+        return "nic";
+      case LANG_ICELANDIC:
+        switch (sub)
+          {
+          case SUBLANG_ICELANDIC_ICELAND: return "is_IS";
+          }
+        return "is";
+      case LANG_IGBO:
+        switch (sub)
+          {
+          case SUBLANG_IGBO_NIGERIA: return "ig_NG";
+          }
+        return "ig";
+      case LANG_INDONESIAN:
+        switch (sub)
+          {
+          case SUBLANG_INDONESIAN_INDONESIA: return "id_ID";
+          }
+        return "id";
+      case LANG_INUKTITUT:
+        switch (sub)
+          {
+          case 0x1e: return "iu"; /* syllabic */
+          case SUBLANG_INUKTITUT_CANADA: return "iu_CA"; /* syllabic */
+          case 0x1f: return "iu@latin";
+          case SUBLANG_INUKTITUT_CANADA_LATIN: return "iu_CA@latin";
+          }
+        return "iu";
+      case LANG_ITALIAN:
+        switch (sub)
+          {
+          case SUBLANG_ITALIAN: return "it_IT";
+          case SUBLANG_ITALIAN_SWISS: return "it_CH";
+          }
+        return "it";
+      case LANG_JAPANESE:
+        switch (sub)
+          {
+          case SUBLANG_JAPANESE_JAPAN: return "ja_JP";
+          }
+        return "ja";
+      case LANG_KANNADA:
+        switch (sub)
+          {
+          case SUBLANG_KANNADA_INDIA: return "kn_IN";
+          }
+        return "kn";
+      case LANG_KANURI:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "kr_NG";
+          }
+        return "kr";
+      case LANG_KASHMIRI:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "ks_PK";
+          case SUBLANG_KASHMIRI_INDIA: return "ks_IN";
+          }
+        return "ks";
+      case LANG_KAZAK:
+        switch (sub)
+          {
+          case SUBLANG_KAZAK_KAZAKHSTAN: return "kk_KZ";
+          }
+        return "kk";
+      case LANG_KICHE:
+        /* FIXME: Adjust this when such locales appear on Unix.  */
+        switch (sub)
+          {
+          case SUBLANG_KICHE_GUATEMALA: return "qut_GT";
+          }
+        return "qut";
+      case LANG_KINYARWANDA:
+        switch (sub)
+          {
+          case SUBLANG_KINYARWANDA_RWANDA: return "rw_RW";
+          }
+        return "rw";
+      case LANG_KONKANI:
+        /* FIXME: Adjust this when such locales appear on Unix.  */
+        switch (sub)
+          {
+          case SUBLANG_KONKANI_INDIA: return "kok_IN";
+          }
+        return "kok";
+      case LANG_KOREAN:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "ko_KR";
+          }
+        return "ko";
+      case LANG_KYRGYZ:
+        switch (sub)
+          {
+          case SUBLANG_KYRGYZ_KYRGYZSTAN: return "ky_KG";
+          }
+        return "ky";
+      case LANG_LAO:
+        switch (sub)
+          {
+          case SUBLANG_LAO_LAOS: return "lo_LA";
+          }
+        return "lo";
+      case LANG_LATIN:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "la_VA";
+          }
+        return "la";
+      case LANG_LATVIAN:
+        switch (sub)
+          {
+          case SUBLANG_LATVIAN_LATVIA: return "lv_LV";
+          }
+        return "lv";
+      case LANG_LITHUANIAN:
+        switch (sub)
+          {
+          case SUBLANG_LITHUANIAN_LITHUANIA: return "lt_LT";
+          }
+        return "lt";
+      case LANG_LUXEMBOURGISH:
+        switch (sub)
+          {
+          case SUBLANG_LUXEMBOURGISH_LUXEMBOURG: return "lb_LU";
+          }
+        return "lb";
+      case LANG_MACEDONIAN:
+        switch (sub)
+          {
+          case SUBLANG_MACEDONIAN_MACEDONIA: return "mk_MK";
+          }
+        return "mk";
+      case LANG_MALAY:
+        switch (sub)
+          {
+          case SUBLANG_MALAY_MALAYSIA: return "ms_MY";
+          case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN";
+          }
+        return "ms";
+      case LANG_MALAYALAM:
+        switch (sub)
+          {
+          case SUBLANG_MALAYALAM_INDIA: return "ml_IN";
+          }
+        return "ml";
+      case LANG_MALTESE:
+        switch (sub)
+          {
+          case SUBLANG_MALTESE_MALTA: return "mt_MT";
+          }
+        return "mt";
+      case LANG_MANIPURI:
+        /* FIXME: Adjust this when such locales appear on Unix.  */
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "mni_IN";
+          }
+        return "mni";
+      case LANG_MAORI:
+        switch (sub)
+          {
+          case SUBLANG_MAORI_NEW_ZEALAND: return "mi_NZ";
+          }
+        return "mi";
+      case LANG_MAPUDUNGUN:
+        switch (sub)
+          {
+          case SUBLANG_MAPUDUNGUN_CHILE: return "arn_CL";
+          }
+        return "arn";
+      case LANG_MARATHI:
+        switch (sub)
+          {
+          case SUBLANG_MARATHI_INDIA: return "mr_IN";
+          }
+        return "mr";
+      case LANG_MOHAWK:
+        switch (sub)
+          {
+          case SUBLANG_MOHAWK_CANADA: return "moh_CA";
+          }
+        return "moh";
+      case LANG_MONGOLIAN:
+        switch (sub)
+          {
+          case SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA: case 0x1e: return "mn_MN";
+          case SUBLANG_MONGOLIAN_PRC: case 0x1f: return "mn_CN";
+          }
+        return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN".  */
+      case LANG_NEPALI:
+        switch (sub)
+          {
+          case SUBLANG_NEPALI_NEPAL: return "ne_NP";
+          case SUBLANG_NEPALI_INDIA: return "ne_IN";
+          }
+        return "ne";
+      case LANG_NORWEGIAN:
+        switch (sub)
+          {
+          case 0x1f: return "nb";
+          case SUBLANG_NORWEGIAN_BOKMAL: return "nb_NO";
+          case 0x1e: return "nn";
+          case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO";
+          }
+        return "no";
+      case LANG_OCCITAN:
+        switch (sub)
+          {
+          case SUBLANG_OCCITAN_FRANCE: return "oc_FR";
+          }
+        return "oc";
+      case LANG_ORIYA:
+        switch (sub)
+          {
+          case SUBLANG_ORIYA_INDIA: return "or_IN";
+          }
+        return "or";
+      case LANG_OROMO:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "om_ET";
+          }
+        return "om";
+      case LANG_PAPIAMENTU:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "pap_AN";
+          }
+        return "pap";
+      case LANG_PASHTO:
+        switch (sub)
+          {
+          case SUBLANG_PASHTO_AFGHANISTAN: return "ps_AF";
+          }
+        return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF".  */
+      case LANG_POLISH:
+        switch (sub)
+          {
+          case SUBLANG_POLISH_POLAND: return "pl_PL";
+          }
+        return "pl";
+      case LANG_PORTUGUESE:
+        switch (sub)
+          {
+          /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
+             Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
+          case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR";
+          case SUBLANG_PORTUGUESE: return "pt_PT";
+          }
+        return "pt";
+      case LANG_PUNJABI:
+        switch (sub)
+          {
+          case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */
+          case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */
+          }
+        return "pa";
+      case LANG_QUECHUA:
+        /* Note: Microsoft uses the non-ISO language code "quz".  */
+        switch (sub)
+          {
+          case SUBLANG_QUECHUA_BOLIVIA: return "qu_BO";
+          case SUBLANG_QUECHUA_ECUADOR: return "qu_EC";
+          case SUBLANG_QUECHUA_PERU: return "qu_PE";
+          }
+        return "qu";
+      case LANG_ROMANIAN:
+        switch (sub)
+          {
+          case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO";
+          case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD";
+          }
+        return "ro";
+      case LANG_ROMANSH:
+        switch (sub)
+          {
+          case SUBLANG_ROMANSH_SWITZERLAND: return "rm_CH";
+          }
+        return "rm";
+      case LANG_RUSSIAN:
+        switch (sub)
+          {
+          case SUBLANG_RUSSIAN_RUSSIA: return "ru_RU";
+          case SUBLANG_RUSSIAN_MOLDAVIA: return "ru_MD";
+          }
+        return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD".  */
+      case LANG_SAMI:
+        switch (sub)
+          {
+          /* Northern Sami */
+          case 0x00: return "se";
+          case SUBLANG_SAMI_NORTHERN_NORWAY: return "se_NO";
+          case SUBLANG_SAMI_NORTHERN_SWEDEN: return "se_SE";
+          case SUBLANG_SAMI_NORTHERN_FINLAND: return "se_FI";
+          /* Lule Sami */
+          case 0x1f: return "smj";
+          case SUBLANG_SAMI_LULE_NORWAY: return "smj_NO";
+          case SUBLANG_SAMI_LULE_SWEDEN: return "smj_SE";
+          /* Southern Sami */
+          case 0x1e: return "sma";
+          case SUBLANG_SAMI_SOUTHERN_NORWAY: return "sma_NO";
+          case SUBLANG_SAMI_SOUTHERN_SWEDEN: return "sma_SE";
+          /* Skolt Sami */
+          case 0x1d: return "sms";
+          case SUBLANG_SAMI_SKOLT_FINLAND: return "sms_FI";
+          /* Inari Sami */
+          case 0x1c: return "smn";
+          case SUBLANG_SAMI_INARI_FINLAND: return "smn_FI";
+          }
+        return "se"; /* or "smi"? */
+      case LANG_SANSKRIT:
+        switch (sub)
+          {
+          case SUBLANG_SANSKRIT_INDIA: return "sa_IN";
+          }
+        return "sa";
+      case LANG_SCOTTISH_GAELIC:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "gd_GB";
+          }
+        return "gd";
+      case LANG_SINDHI:
+        switch (sub)
+          {
+          case SUBLANG_SINDHI_INDIA: return "sd_IN";
+          case SUBLANG_SINDHI_PAKISTAN: return "sd_PK";
+          /*case SUBLANG_SINDHI_AFGHANISTAN: return "sd_AF";*/
+          }
+        return "sd";
+      case LANG_SINHALESE:
+        switch (sub)
+          {
+          case SUBLANG_SINHALESE_SRI_LANKA: return "si_LK";
+          }
+        return "si";
+      case LANG_SLOVAK:
+        switch (sub)
+          {
+          case SUBLANG_SLOVAK_SLOVAKIA: return "sk_SK";
+          }
+        return "sk";
+      case LANG_SLOVENIAN:
+        switch (sub)
+          {
+          case SUBLANG_SLOVENIAN_SLOVENIA: return "sl_SI";
+          }
+        return "sl";
+      case LANG_SOMALI:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "so_SO";
+          }
+        return "so";
+      case LANG_SORBIAN:
+        /* FIXME: Adjust this when such locales appear on Unix.  */
+        switch (sub)
+          {
+          /* Upper Sorbian */
+          case 0x00: return "hsb";
+          case SUBLANG_UPPER_SORBIAN_GERMANY: return "hsb_DE";
+          /* Lower Sorbian */
+          case 0x1f: return "dsb";
+          case SUBLANG_LOWER_SORBIAN_GERMANY: return "dsb_DE";
+          }
+        return "wen";
+      case LANG_SOTHO:
+        /* <https://docs.microsoft.com/en-us/windows/desktop/Intl/language-identifier-constants-and-strings>
+           calls it "Sesotho sa Leboa"; according to
+           <https://www.ethnologue.com/show_language.asp?code=nso>
+           <https://www.ethnologue.com/show_language.asp?code=sot>
+           it's the same as Northern Sotho.  */
+        switch (sub)
+          {
+          case SUBLANG_SOTHO_SOUTH_AFRICA: return "nso_ZA";
+          }
+        return "nso";
+      case LANG_SPANISH:
+        switch (sub)
+          {
+          case SUBLANG_SPANISH: return "es_ES";
+          case SUBLANG_SPANISH_MEXICAN: return "es_MX";
+          case SUBLANG_SPANISH_MODERN:
+            return "es_ES@modern";      /* not seen on Unix */
+          case SUBLANG_SPANISH_GUATEMALA: return "es_GT";
+          case SUBLANG_SPANISH_COSTA_RICA: return "es_CR";
+          case SUBLANG_SPANISH_PANAMA: return "es_PA";
+          case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO";
+          case SUBLANG_SPANISH_VENEZUELA: return "es_VE";
+          case SUBLANG_SPANISH_COLOMBIA: return "es_CO";
+          case SUBLANG_SPANISH_PERU: return "es_PE";
+          case SUBLANG_SPANISH_ARGENTINA: return "es_AR";
+          case SUBLANG_SPANISH_ECUADOR: return "es_EC";
+          case SUBLANG_SPANISH_CHILE: return "es_CL";
+          case SUBLANG_SPANISH_URUGUAY: return "es_UY";
+          case SUBLANG_SPANISH_PARAGUAY: return "es_PY";
+          case SUBLANG_SPANISH_BOLIVIA: return "es_BO";
+          case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV";
+          case SUBLANG_SPANISH_HONDURAS: return "es_HN";
+          case SUBLANG_SPANISH_NICARAGUA: return "es_NI";
+          case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR";
+          case SUBLANG_SPANISH_US: return "es_US";
+          }
+        return "es";
+      case LANG_SUTU:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */
+          }
+        return "bnt";
+      case LANG_SWAHILI:
+        switch (sub)
+          {
+          case SUBLANG_SWAHILI_KENYA: return "sw_KE";
+          }
+        return "sw";
+      case LANG_SWEDISH:
+        switch (sub)
+          {
+          case SUBLANG_SWEDISH_SWEDEN: return "sv_SE";
+          case SUBLANG_SWEDISH_FINLAND: return "sv_FI";
+          }
+        return "sv";
+      case LANG_SYRIAC:
+        switch (sub)
+          {
+          case SUBLANG_SYRIAC_SYRIA: return "syr_SY"; /* An extinct language.  */
+          }
+        return "syr";
+      case LANG_TAGALOG:
+        switch (sub)
+          {
+          case SUBLANG_TAGALOG_PHILIPPINES: return "tl_PH"; /* or "fil_PH"? */
+          }
+        return "tl"; /* or "fil"? */
+      case LANG_TAJIK:
+        switch (sub)
+          {
+          case 0x1f: return "tg";
+          case SUBLANG_TAJIK_TAJIKISTAN: return "tg_TJ";
+          }
+        return "tg";
+      case LANG_TAMAZIGHT:
+        /* Note: Microsoft uses the non-ISO language code "tmz".  */
+        switch (sub)
+          {
+          /* FIXME: Adjust this when Tamazight locales appear on Unix.  */
+          case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic";
+          case 0x1f: return "ber@latin";
+          case SUBLANG_TAMAZIGHT_ALGERIA_LATIN: return "ber_DZ@latin";
+          }
+        return "ber";
+      case LANG_TAMIL:
+        switch (sub)
+          {
+          case SUBLANG_TAMIL_INDIA: return "ta_IN";
+          }
+        return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG".  */
+      case LANG_TATAR:
+        switch (sub)
+          {
+          case SUBLANG_TATAR_RUSSIA: return "tt_RU";
+          }
+        return "tt";
+      case LANG_TELUGU:
+        switch (sub)
+          {
+          case SUBLANG_TELUGU_INDIA: return "te_IN";
+          }
+        return "te";
+      case LANG_THAI:
+        switch (sub)
+          {
+          case SUBLANG_THAI_THAILAND: return "th_TH";
+          }
+        return "th";
+      case LANG_TIBETAN:
+        switch (sub)
+          {
+          case SUBLANG_TIBETAN_PRC:
+            /* Most Tibetans would not like "bo_CN".  But Tibet does not yet
+               have a country code of its own.  */
+            return "bo";
+          case SUBLANG_TIBETAN_BHUTAN: return "bo_BT";
+          }
+        return "bo";
+      case LANG_TIGRINYA:
+        switch (sub)
+          {
+          case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET";
+          case SUBLANG_TIGRINYA_ERITREA: return "ti_ER";
+          }
+        return "ti";
+      case LANG_TSONGA:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "ts_ZA";
+          }
+        return "ts";
+      case LANG_TSWANA:
+        /* Spoken in South Africa, Botswana.  */
+        switch (sub)
+          {
+          case SUBLANG_TSWANA_SOUTH_AFRICA: return "tn_ZA";
+          }
+        return "tn";
+      case LANG_TURKISH:
+        switch (sub)
+          {
+          case SUBLANG_TURKISH_TURKEY: return "tr_TR";
+          }
+        return "tr";
+      case LANG_TURKMEN:
+        switch (sub)
+          {
+          case SUBLANG_TURKMEN_TURKMENISTAN: return "tk_TM";
+          }
+        return "tk";
+      case LANG_UIGHUR:
+        switch (sub)
+          {
+          case SUBLANG_UIGHUR_PRC: return "ug_CN";
+          }
+        return "ug";
+      case LANG_UKRAINIAN:
+        switch (sub)
+          {
+          case SUBLANG_UKRAINIAN_UKRAINE: return "uk_UA";
+          }
+        return "uk";
+      case LANG_URDU:
+        switch (sub)
+          {
+          case SUBLANG_URDU_PAKISTAN: return "ur_PK";
+          case SUBLANG_URDU_INDIA: return "ur_IN";
+          }
+        return "ur";
+      case LANG_UZBEK:
+        switch (sub)
+          {
+          case 0x1f: return "uz";
+          case SUBLANG_UZBEK_LATIN: return "uz_UZ";
+          case 0x1e: return "uz@cyrillic";
+          case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic";
+          }
+        return "uz";
+      case LANG_VENDA:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "ve_ZA";
+          }
+        return "ve";
+      case LANG_VIETNAMESE:
+        switch (sub)
+          {
+          case SUBLANG_VIETNAMESE_VIETNAM: return "vi_VN";
+          }
+        return "vi";
+      case LANG_WELSH:
+        switch (sub)
+          {
+          case SUBLANG_WELSH_UNITED_KINGDOM: return "cy_GB";
+          }
+        return "cy";
+      case LANG_WOLOF:
+        switch (sub)
+          {
+          case SUBLANG_WOLOF_SENEGAL: return "wo_SN";
+          }
+        return "wo";
+      case LANG_XHOSA:
+        switch (sub)
+          {
+          case SUBLANG_XHOSA_SOUTH_AFRICA: return "xh_ZA";
+          }
+        return "xh";
+      case LANG_YAKUT:
+        switch (sub)
+          {
+          case SUBLANG_YAKUT_RUSSIA: return "sah_RU";
+          }
+        return "sah";
+      case LANG_YI:
+        switch (sub)
+          {
+          case SUBLANG_YI_PRC: return "ii_CN";
+          }
+        return "ii";
+      case LANG_YIDDISH:
+        switch (sub)
+          {
+          case SUBLANG_DEFAULT: return "yi_IL";
+          }
+        return "yi";
+      case LANG_YORUBA:
+        switch (sub)
+          {
+          case SUBLANG_YORUBA_NIGERIA: return "yo_NG";
+          }
+        return "yo";
+      case LANG_ZULU:
+        switch (sub)
+          {
+          case SUBLANG_ZULU_SOUTH_AFRICA: return "zu_ZA";
+          }
+        return "zu";
+      default: return "C";
+      }
+  }
+}
+
+# if !defined IN_LIBINTL
+static
+# endif
+const char *
+gl_locale_name_from_win32_LCID (LCID lcid)
+{
+  LANGID langid;
+
+  /* Strip off the sorting rules, keep only the language part.  */
+  langid = LANGIDFROMLCID (lcid);
+
+  return gl_locale_name_from_win32_LANGID (langid);
+}
+
+# ifdef WINDOWS_NATIVE
+
+/* Two variables to interface between get_lcid and the EnumLocales
+   callback function below.  */
+static LCID found_lcid;
+static char lname[LC_MAX * (LOCALE_NAME_MAX_LENGTH + 1) + 1];
+
+/* Callback function for EnumLocales.  */
+static BOOL CALLBACK
+enum_locales_fn (LPSTR locale_num_str)
+{
+  char *endp;
+  char locval[2 * LOCALE_NAME_MAX_LENGTH + 1 + 1];
+  LCID try_lcid = strtoul (locale_num_str, &endp, 16);
+
+  if (GetLocaleInfo (try_lcid, LOCALE_SENGLANGUAGE,
+                    locval, LOCALE_NAME_MAX_LENGTH))
+    {
+      strcat (locval, "_");
+      if (GetLocaleInfo (try_lcid, LOCALE_SENGCOUNTRY,
+                        locval + strlen (locval), LOCALE_NAME_MAX_LENGTH))
+       {
+         size_t locval_len = strlen (locval);
+
+         if (strncmp (locval, lname, locval_len) == 0
+             && (lname[locval_len] == '.'
+                 || lname[locval_len] == '\0'))
+           {
+             found_lcid = try_lcid;
+             return FALSE;
+           }
+       }
+    }
+  return TRUE;
+}
+
+/* This lock protects the get_lcid against multiple simultaneous calls.  */
+gl_lock_define_initialized(static, get_lcid_lock)
+
+/* Return the Locale ID (LCID) number given the locale's name, a
+   string, in LOCALE_NAME.  This works by enumerating all the locales
+   supported by the system, until we find one whose name matches
+   LOCALE_NAME.  */
+static LCID
+get_lcid (const char *locale_name)
+{
+  /* A simple cache.  */
+  static LCID last_lcid;
+  static char last_locale[1000];
+
+  /* Lock while looking for an LCID, to protect access to static
+     variables: last_lcid, last_locale, found_lcid, and lname.  */
+  gl_lock_lock (get_lcid_lock);
+  if (last_lcid > 0 && strcmp (locale_name, last_locale) == 0)
+    {
+      gl_lock_unlock (get_lcid_lock);
+      return last_lcid;
+    }
+  strncpy (lname, locale_name, sizeof (lname) - 1);
+  lname[sizeof (lname) - 1] = '\0';
+  found_lcid = 0;
+  EnumSystemLocales (enum_locales_fn, LCID_SUPPORTED);
+  if (found_lcid > 0)
+    {
+      last_lcid = found_lcid;
+      strcpy (last_locale, locale_name);
+    }
+  gl_lock_unlock (get_lcid_lock);
+  return found_lcid;
+}
+
+# endif
+#endif
+
+
+#if HAVE_GOOD_USELOCALE /* glibc, Mac OS X, FreeBSD >= 9.1, Cygwin >= 2.6,
+                           Solaris 11 OpenIndiana, or Solaris >= 11.4  */
+
+/* Simple hash set of strings.  We don't want to drag in lots of hash table
+   code here.  */
+
+# define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
+
+/* A hash function for NUL-terminated char* strings using
+   the method described by Bruno Haible.
+   See https://www.haible.de/bruno/hashfunc.html.  */
+static size_t _GL_ATTRIBUTE_PURE
+string_hash (const void *x)
+{
+  const char *s = (const char *) x;
+  size_t h = 0;
+
+  for (; *s; s++)
+    h = *s + ((h << 9) | (h >> (SIZE_BITS - 9)));
+
+  return h;
+}
+
+/* A hash table of fixed size.  Multiple threads can access it read-only
+   simultaneously, but only one thread can insert into it at the same time.  */
+
+/* A node in a hash bucket collision list.  */
+struct struniq_hash_node
+  {
+    struct struniq_hash_node * volatile next;
+    char contents[FLEXIBLE_ARRAY_MEMBER];
+  };
+
+# define STRUNIQ_HASH_TABLE_SIZE 257
+static struct struniq_hash_node * volatile struniq_hash_table[STRUNIQ_HASH_TABLE_SIZE]
+  /* = { NULL, ..., NULL } */;
+
+/* This lock protects the struniq_hash_table against multiple simultaneous
+   insertions.  */
+gl_lock_define_initialized(static, struniq_lock)
+
+/* Store a copy of the given string in a string pool with indefinite extent.
+   Return a pointer to this copy.  */
+static const char *
+struniq (const char *string)
+{
+  size_t hashcode = string_hash (string);
+  size_t slot = hashcode % STRUNIQ_HASH_TABLE_SIZE;
+  size_t size;
+  struct struniq_hash_node *new_node;
+  struct struniq_hash_node *p;
+  for (p = struniq_hash_table[slot]; p != NULL; p = p->next)
+    if (strcmp (p->contents, string) == 0)
+      return p->contents;
+  size = strlen (string) + 1;
+  new_node =
+    (struct struniq_hash_node *)
+    malloc (FLEXSIZEOF (struct struniq_hash_node, contents, size));
+  if (new_node == NULL)
+    /* Out of memory.  Return a statically allocated string.  */
+    return "C";
+  memcpy (new_node->contents, string, size);
+  {
+    bool mt = gl_multithreaded ();
+    /* Lock while inserting new_node.  */
+    if (mt) gl_lock_lock (struniq_lock);
+    /* Check whether another thread already added the string while we were
+       waiting on the lock.  */
+    for (p = struniq_hash_table[slot]; p != NULL; p = p->next)
+      if (strcmp (p->contents, string) == 0)
+        {
+          free (new_node);
+          new_node = p;
+          goto done;
+        }
+    /* Really insert new_node into the hash table.  Fill new_node entirely
+       first, because other threads may be iterating over the linked list.  */
+    new_node->next = struniq_hash_table[slot];
+    struniq_hash_table[slot] = new_node;
+   done:
+    /* Unlock after new_node is inserted.  */
+    if (mt) gl_lock_unlock (struniq_lock);
+  }
+  return new_node->contents;
+}
+
+#endif
+
+
+#if LOCALENAME_ENHANCE_LOCALE_FUNCS
+
+/* The 'locale_t' object does not contain the names of the locale categories.
+   We have to associate them with the object through a hash table.
+   The hash table is defined in localename-table.[hc].  */
+
+/* Returns the name of a given locale category in a given locale_t object,
+   allocated as a string with indefinite extent.  */
+static const char *
+get_locale_t_name (int category, locale_t locale)
+{
+  if (locale == LC_GLOBAL_LOCALE)
+    {
+      /* Query the global locale.  */
+      const char *name = setlocale_null (category);
+      if (name != NULL)
+        return struniq (name);
+      else
+        /* Should normally not happen.  */
+        return "";
+    }
+  else
+    {
+      /* Look up the names in the hash table.  */
+      size_t hashcode = locale_hash_function (locale);
+      size_t slot = hashcode % LOCALE_HASH_TABLE_SIZE;
+      /* If the locale was not found in the table, return "".  This can
+         happen if the application uses the original newlocale()/duplocale()
+         functions instead of the overridden ones.  */
+      const char *name = "";
+      struct locale_hash_node *p;
+      /* Lock while looking up the hash node.  */
+      gl_rwlock_rdlock (locale_lock);
+      for (p = locale_hash_table[slot]; p != NULL; p = p->next)
+        if (p->locale == locale)
+          {
+            name = p->names.category_name[category];
+            break;
+          }
+      gl_rwlock_unlock (locale_lock);
+      return name;
+    }
+}
+
+# if !(defined newlocale && defined duplocale && defined freelocale)
+#  error "newlocale, duplocale, freelocale not being replaced as expected!"
+# endif
+
+/* newlocale() override.  */
+locale_t
+newlocale (int category_mask, const char *name, locale_t base)
+#undef newlocale
+{
+  struct locale_categories_names names;
+  struct locale_hash_node *node;
+  locale_t result;
+
+  /* Make sure name has indefinite extent.  */
+  if (((LC_CTYPE_MASK | LC_NUMERIC_MASK | LC_TIME_MASK | LC_COLLATE_MASK
+        | LC_MONETARY_MASK | LC_MESSAGES_MASK)
+       & category_mask) != 0)
+    name = struniq (name);
+
+  /* Determine the category names of the result.  */
+  if (((LC_CTYPE_MASK | LC_NUMERIC_MASK | LC_TIME_MASK | LC_COLLATE_MASK
+        | LC_MONETARY_MASK | LC_MESSAGES_MASK)
+       & ~category_mask) == 0)
+    {
+      /* Use name, ignore base.  */
+      int category;
+
+      name = struniq (name);
+      for (category = 0; category < 6; category++)
+        names.category_name[category] = name;
+    }
+  else
+    {
+      /* Use base, possibly also name.  */
+      if (base == NULL)
+        {
+          int category;
+
+          for (category = 0; category < 6; category++)
+            {
+              int mask;
+
+              switch (category)
+                {
+                case LC_CTYPE:
+                  mask = LC_CTYPE_MASK;
+                  break;
+                case LC_NUMERIC:
+                  mask = LC_NUMERIC_MASK;
+                  break;
+                case LC_TIME:
+                  mask = LC_TIME_MASK;
+                  break;
+                case LC_COLLATE:
+                  mask = LC_COLLATE_MASK;
+                  break;
+                case LC_MONETARY:
+                  mask = LC_MONETARY_MASK;
+                  break;
+                case LC_MESSAGES:
+                  mask = LC_MESSAGES_MASK;
+                  break;
+                default:
+                  abort ();
+                }
+              names.category_name[category] =
+                ((mask & category_mask) != 0 ? name : "C");
+            }
+        }
+      else if (base == LC_GLOBAL_LOCALE)
+        {
+          int category;
+
+          for (category = 0; category < 6; category++)
+            {
+              int mask;
+
+              switch (category)
+                {
+                case LC_CTYPE:
+                  mask = LC_CTYPE_MASK;
+                  break;
+                case LC_NUMERIC:
+                  mask = LC_NUMERIC_MASK;
+                  break;
+                case LC_TIME:
+                  mask = LC_TIME_MASK;
+                  break;
+                case LC_COLLATE:
+                  mask = LC_COLLATE_MASK;
+                  break;
+                case LC_MONETARY:
+                  mask = LC_MONETARY_MASK;
+                  break;
+                case LC_MESSAGES:
+                  mask = LC_MESSAGES_MASK;
+                  break;
+                default:
+                  abort ();
+                }
+              names.category_name[category] =
+                ((mask & category_mask) != 0
+                 ? name
+                 : get_locale_t_name (category, LC_GLOBAL_LOCALE));
+            }
+        }
+      else
+        {
+          /* Look up the names of base in the hash table.  Like multiple calls
+             of get_locale_t_name, but locking only once.  */
+          struct locale_hash_node *p;
+          int category;
+
+          /* Lock while looking up the hash node.  */
+          gl_rwlock_rdlock (locale_lock);
+          for (p = locale_hash_table[locale_hash_function (base) % LOCALE_HASH_TABLE_SIZE];
+               p != NULL;
+               p = p->next)
+            if (p->locale == base)
+              break;
+
+          for (category = 0; category < 6; category++)
+            {
+              int mask;
+
+              switch (category)
+                {
+                case LC_CTYPE:
+                  mask = LC_CTYPE_MASK;
+                  break;
+                case LC_NUMERIC:
+                  mask = LC_NUMERIC_MASK;
+                  break;
+                case LC_TIME:
+                  mask = LC_TIME_MASK;
+                  break;
+                case LC_COLLATE:
+                  mask = LC_COLLATE_MASK;
+                  break;
+                case LC_MONETARY:
+                  mask = LC_MONETARY_MASK;
+                  break;
+                case LC_MESSAGES:
+                  mask = LC_MESSAGES_MASK;
+                  break;
+                default:
+                  abort ();
+                }
+              names.category_name[category] =
+                ((mask & category_mask) != 0
+                 ? name
+                 : (p != NULL ? p->names.category_name[category] : ""));
+            }
+
+          gl_rwlock_unlock (locale_lock);
+        }
+    }
+
+  node = (struct locale_hash_node *) malloc (sizeof (struct locale_hash_node));
+  if (node == NULL)
+    /* errno is set to ENOMEM.  */
+    return NULL;
+
+  result = newlocale (category_mask, name, base);
+  if (result == NULL)
+    {
+      free (node);
+      return NULL;
+    }
+
+  /* Fill the hash node.  */
+  node->locale = result;
+  node->names = names;
+
+  /* Insert it in the hash table.  */
+  {
+    size_t hashcode = locale_hash_function (result);
+    size_t slot = hashcode % LOCALE_HASH_TABLE_SIZE;
+    struct locale_hash_node *p;
+
+    /* Lock while inserting the new node.  */
+    gl_rwlock_wrlock (locale_lock);
+    for (p = locale_hash_table[slot]; p != NULL; p = p->next)
+      if (p->locale == result)
+        {
+          /* This can happen if the application uses the original freelocale()
+             function instead of the overridden one.  */
+          p->names = node->names;
+          break;
+        }
+    if (p == NULL)
+      {
+        node->next = locale_hash_table[slot];
+        locale_hash_table[slot] = node;
+      }
+
+    gl_rwlock_unlock (locale_lock);
+
+    if (p != NULL)
+      free (node);
+  }
+
+  return result;
+}
+
+/* duplocale() override.  */
+locale_t
+duplocale (locale_t locale)
+#undef duplocale
+{
+  struct locale_hash_node *node;
+  locale_t result;
+
+  if (locale == NULL)
+    /* Invalid argument.  */
+    abort ();
+
+  node = (struct locale_hash_node *) malloc (sizeof (struct locale_hash_node));
+  if (node == NULL)
+    /* errno is set to ENOMEM.  */
+    return NULL;
+
+  result = duplocale (locale);
+  if (result == NULL)
+    {
+      free (node);
+      return NULL;
+    }
+
+  /* Fill the hash node.  */
+  node->locale = result;
+  if (locale == LC_GLOBAL_LOCALE)
+    {
+      int category;
+
+      for (category = 0; category < 6; category++)
+        node->names.category_name[category] =
+          get_locale_t_name (category, LC_GLOBAL_LOCALE);
+
+      /* Lock before inserting the new node.  */
+      gl_rwlock_wrlock (locale_lock);
+    }
+  else
+    {
+      struct locale_hash_node *p;
+
+      /* Lock once, for the lookup and the insertion.  */
+      gl_rwlock_wrlock (locale_lock);
+
+      for (p = locale_hash_table[locale_hash_function (locale) % LOCALE_HASH_TABLE_SIZE];
+           p != NULL;
+           p = p->next)
+        if (p->locale == locale)
+          break;
+      if (p != NULL)
+        node->names = p->names;
+      else
+        {
+          /* This can happen if the application uses the original
+             newlocale()/duplocale() functions instead of the overridden
+             ones.  */
+          int category;
+
+          for (category = 0; category < 6; category++)
+            node->names.category_name[category] = "";
+        }
+    }
+
+  /* Insert it in the hash table.  */
+  {
+    size_t hashcode = locale_hash_function (result);
+    size_t slot = hashcode % LOCALE_HASH_TABLE_SIZE;
+    struct locale_hash_node *p;
+
+    for (p = locale_hash_table[slot]; p != NULL; p = p->next)
+      if (p->locale == result)
+        {
+          /* This can happen if the application uses the original freelocale()
+             function instead of the overridden one.  */
+          p->names = node->names;
+          break;
+        }
+    if (p == NULL)
+      {
+        node->next = locale_hash_table[slot];
+        locale_hash_table[slot] = node;
+      }
+
+    gl_rwlock_unlock (locale_lock);
+
+    if (p != NULL)
+      free (node);
+  }
+
+  return result;
+}
+
+/* freelocale() override.  */
+void
+freelocale (locale_t locale)
+#undef freelocale
+{
+  if (locale == NULL || locale == LC_GLOBAL_LOCALE)
+    /* Invalid argument.  */
+    abort ();
+
+  {
+    size_t hashcode = locale_hash_function (locale);
+    size_t slot = hashcode % LOCALE_HASH_TABLE_SIZE;
+    struct locale_hash_node *found;
+    struct locale_hash_node **p;
+
+    found = NULL;
+    /* Lock while removing the hash node.  */
+    gl_rwlock_wrlock (locale_lock);
+    for (p = &locale_hash_table[slot]; *p != NULL; p = &(*p)->next)
+      if ((*p)->locale == locale)
+        {
+          found = *p;
+          *p = (*p)->next;
+          break;
+        }
+    gl_rwlock_unlock (locale_lock);
+    free (found);
+  }
+
+  freelocale (locale);
+}
+
+#endif
+
+
+#if defined IN_LIBINTL || HAVE_GOOD_USELOCALE
+
+/* Like gl_locale_name_thread, except that the result is not in storage of
+   indefinite extent.  */
+# if !defined IN_LIBINTL
+static
+# endif
+const char *
+gl_locale_name_thread_unsafe (int category, _GL_UNUSED const char *categoryname)
+{
+# if HAVE_GOOD_USELOCALE
+  {
+    locale_t thread_locale = uselocale (NULL);
+    if (thread_locale != LC_GLOBAL_LOCALE)
+      {
+#  if __GLIBC__ >= 2 && !defined __UCLIBC__
+        /* Work around an incorrect definition of the _NL_LOCALE_NAME macro in
+           glibc < 2.12.
+           See <https://sourceware.org/bugzilla/show_bug.cgi?id=10968>.  */
+        const char *name =
+          nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
+        if (name[0] == '\0')
+          /* Fallback code for glibc < 2.4, which did not implement
+             nl_langinfo (_NL_LOCALE_NAME (category)).  */
+          name = thread_locale->__names[category];
+        return name;
+#  elif defined __linux__ && HAVE_LANGINFO_H && defined NL_LOCALE_NAME
+        /* musl libc */
+        return nl_langinfo_l (NL_LOCALE_NAME (category), thread_locale);
+#  elif (defined __FreeBSD__ || defined __DragonFly__) || (defined __APPLE__ && defined __MACH__)
+        /* FreeBSD, Mac OS X */
+        int mask;
+
+        switch (category)
+          {
+          case LC_CTYPE:
+            mask = LC_CTYPE_MASK;
+            break;
+          case LC_NUMERIC:
+            mask = LC_NUMERIC_MASK;
+            break;
+          case LC_TIME:
+            mask = LC_TIME_MASK;
+            break;
+          case LC_COLLATE:
+            mask = LC_COLLATE_MASK;
+            break;
+          case LC_MONETARY:
+            mask = LC_MONETARY_MASK;
+            break;
+          case LC_MESSAGES:
+            mask = LC_MESSAGES_MASK;
+            break;
+          default: /* We shouldn't get here.  */
+            return "";
+          }
+        return querylocale (mask, thread_locale);
+#  elif defined __sun
+#   if HAVE_GETLOCALENAME_L
+        /* Solaris >= 12.  */
+        return getlocalename_l (category, thread_locale);
+#   elif HAVE_SOLARIS114_LOCALES
+        /* Solaris >= 11.4.  */
+        void *lcp = (*thread_locale)->core.data->lcp;
+        if (lcp != NULL)
+          switch (category)
+            {
+            case LC_CTYPE:
+            case LC_NUMERIC:
+            case LC_TIME:
+            case LC_COLLATE:
+            case LC_MONETARY:
+            case LC_MESSAGES:
+              return ((const char * const *) lcp)[category];
+            default: /* We shouldn't get here.  */
+              return "";
+            }
+#   elif HAVE_NAMELESS_LOCALES
+        return get_locale_t_name (category, thread_locale);
+#   else
+        /* Solaris 11 OpenIndiana.
+           For the internal structure of locale objects, see
+           https://github.com/OpenIndiana/illumos-gate/blob/master/usr/src/lib/libc/port/locale/localeimpl.h  */
+        switch (category)
+          {
+          case LC_CTYPE:
+          case LC_NUMERIC:
+          case LC_TIME:
+          case LC_COLLATE:
+          case LC_MONETARY:
+          case LC_MESSAGES:
+            return ((const char * const *) thread_locale)[category];
+          default: /* We shouldn't get here.  */
+            return "";
+          }
+#   endif
+#  elif defined _AIX && HAVE_NAMELESS_LOCALES
+        return get_locale_t_name (category, thread_locale);
+#  elif defined __CYGWIN__
+        /* Cygwin < 2.6 lacks uselocale and thread-local locales altogether.
+           Cygwin <= 2.6.1 lacks NL_LOCALE_NAME, requiring peeking inside
+           an opaque struct.  */
+#   ifdef NL_LOCALE_NAME
+        return nl_langinfo_l (NL_LOCALE_NAME (category), thread_locale);
+#   else
+        /* FIXME: Remove when we can assume new-enough Cygwin.  */
+        struct __locale_t {
+          char categories[7][32];
+        };
+        return ((struct __locale_t *) thread_locale)->categories[category];
+#   endif
+#  elif defined __HAIKU__
+        /* Since 2022, Haiku has per-thread locales.  locale_t is 'void *',
+           but in fact a 'LocaleBackendData *'.  */
+        struct LocaleBackendData {
+          int magic;
+          void /*BPrivate::Libroot::LocaleBackend*/ *backend;
+          void /*BPrivate::Libroot::LocaleDataBridge*/ *databridge;
+        };
+        void *thread_locale_backend =
+          ((struct LocaleBackendData *) thread_locale)->backend;
+        if (thread_locale_backend != NULL)
+          {
+            /* The only existing concrete subclass of
+               BPrivate::Libroot::LocaleBackend is
+               BPrivate::Libroot::ICULocaleBackend.
+               Invoke the (non-virtual) method
+               BPrivate::Libroot::ICULocaleBackend::_QueryLocale on it.
+               This method is located in a separate shared library,
+               libroot-addon-icu.so.  */
+            static void * volatile querylocale_method /* = NULL */;
+            static int volatile querylocale_found /* = 0 */;
+            /* Attempt to open this shared library, the first time we get
+               here.  */
+            if (querylocale_found == 0)
+              {
+                void *handle =
+                  dlopen ("/boot/system/lib/libroot-addon-icu.so", 0);
+                if (handle != NULL)
+                  {
+                    void *sym =
+                      dlsym (handle, "_ZN8BPrivate7Libroot16ICULocaleBackend12_QueryLocaleEi");
+                    if (sym != NULL)
+                      {
+                        querylocale_method = sym;
+                        querylocale_found = 1;
+                      }
+                    else
+                      /* Could not find the symbol.  */
+                      querylocale_found = -1;
+                  }
+                else
+                  /* Could not open the separate shared library.  */
+                  querylocale_found = -1;
+              }
+            if (querylocale_found > 0)
+              {
+                /* The _QueryLocale method is a non-static C++ method with
+                   parameters (int category) and return type 'const char *'.
+                   See
+                     haiku/headers/private/libroot/locale/ICULocaleBackend.h
+                     haiku/src/system/libroot/add-ons/icu/ICULocaleBackend.cpp
+                   This is the same as a C function with parameters
+                     (BPrivate::Libroot::LocaleBackend* this, int category)
+                   and return type 'const char *'.  Invoke it.  */
+                const char * (*querylocale_func) (void *, int) =
+                  (const char * (*) (void *, int)) querylocale_method;
+                return querylocale_func (thread_locale_backend, category);
+              }
+          }
+        else
+          /* It's the "C" or "POSIX" locale.  */
+          return "C";
+#  elif defined __ANDROID__
+        return MB_CUR_MAX == 4 ? "C.UTF-8" : "C";
+#  endif
+      }
+  }
+# endif
+  return NULL;
+}
+
+#endif
+
+const char *
+gl_locale_name_thread (int category, _GL_UNUSED const char *categoryname)
+{
+#if HAVE_GOOD_USELOCALE
+  const char *name = gl_locale_name_thread_unsafe (category, categoryname);
+  if (name != NULL)
+    return struniq (name);
+#endif
+  /* On WINDOWS_NATIVE, don't use GetThreadLocale() here, because when
+     SetThreadLocale has not been called - which is a very frequent case -
+     the value of GetThreadLocale() ignores past calls to 'setlocale'.  */
+  return NULL;
+}
+
+/* XPG3 defines the result of 'setlocale (category, NULL)' as:
+   "Directs 'setlocale()' to query 'category' and return the current
+    setting of 'local'."
+   However it does not specify the exact format.  Neither do SUSV2 and
+   ISO C 99.  So we can use this feature only on selected systems (e.g.
+   those using GNU C Library).  */
+#if defined _LIBC || ((defined __GLIBC__ && __GLIBC__ >= 2) && !defined __UCLIBC__)
+# define HAVE_LOCALE_NULL
+#endif
+
+const char *
+gl_locale_name_posix (int category, _GL_UNUSED const char *categoryname)
+{
+#if defined WINDOWS_NATIVE
+  if (LC_MIN <= category && category <= LC_MAX)
+    {
+      const char *locname =
+        /* setlocale_null (category) is identical to setlocale (category, NULL)
+           on this platform.  */
+        setlocale (category, NULL);
+
+      /* Convert locale name to LCID.  We don't want to use
+         LocaleNameToLCID because (a) it is only available since Vista,
+         and (b) it doesn't accept locale names returned by 'setlocale'.  */
+      LCID lcid = get_lcid (locname);
+
+      if (lcid > 0)
+        return gl_locale_name_from_win32_LCID (lcid);
+    }
+#endif
+  {
+    const char *locname;
+
+    /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
+       On some systems this can be done by the 'setlocale' function itself.  */
+#if defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
+    locname = setlocale_null (category);
+#else
+    /* On other systems we ignore what setlocale reports and instead look at the
+       environment variables directly.  This is necessary
+         1. on systems which have a facility for customizing the default locale
+            (Mac OS X, native Windows, Cygwin) and where the system's setlocale()
+            function ignores this default locale (Mac OS X, Cygwin), in two cases:
+            a. when the user missed to use the setlocale() override from libintl
+               (for example by not including <libintl.h>),
+            b. when setlocale supports only the "C" locale, such as on Cygwin
+               1.5.x.  In this case even the override from libintl cannot help.
+         2. on all systems where setlocale supports only the "C" locale.  */
+    /* Strictly speaking, it is a POSIX violation to look at the environment
+       variables regardless whether setlocale has been called or not.  POSIX
+       says:
+           "For C-language programs, the POSIX locale shall be the
+            default locale when the setlocale() function is not called."
+       But we assume that all programs that use internationalized APIs call
+       setlocale (LC_ALL, "").  */
+    locname = gl_locale_name_environ (category, categoryname);
+#endif
+    /* Convert the locale name from the format returned by setlocale() or found
+       in the environment variables to the XPG syntax.  */
+#if defined WINDOWS_NATIVE
+    if (locname != NULL)
+      {
+        /* Convert locale name to LCID.  We don't want to use
+           LocaleNameToLCID because (a) it is only available since Vista,
+           and (b) it doesn't accept locale names returned by 'setlocale'.  */
+        LCID lcid = get_lcid (locname);
+
+        if (lcid > 0)
+          return gl_locale_name_from_win32_LCID (lcid);
+      }
+#endif
+    return locname;
+  }
+}
+
+const char *
+gl_locale_name_environ (_GL_UNUSED int category, const char *categoryname)
+{
+  const char *retval;
+
+  /* Setting of LC_ALL overrides all other.  */
+  retval = getenv ("LC_ALL");
+  if (retval != NULL && retval[0] != '\0')
+    return retval;
+  /* Next comes the name of the desired category.  */
+  retval = getenv (categoryname);
+  if (retval != NULL && retval[0] != '\0')
+    return retval;
+  /* Last possibility is the LANG environment variable.  */
+  retval = getenv ("LANG");
+  if (retval != NULL && retval[0] != '\0')
+    {
+#if HAVE_CFPREFERENCESCOPYAPPVALUE
+      /* Mac OS X 10.2 or newer.
+         Ignore invalid LANG value set by the Terminal application.  */
+      if (strcmp (retval, "UTF-8") != 0)
+#endif
+#if defined __CYGWIN__
+      /* Cygwin.
+         Ignore dummy LANG value set by ~/.profile.  */
+      if (strcmp (retval, "C.UTF-8") != 0)
+#endif
+        return retval;
+    }
+
+  return NULL;
+}
+
+const char *
+gl_locale_name_default (void)
+{
+  /* POSIX:2001 says:
+     "All implementations shall define a locale as the default locale, to be
+      invoked when no environment variables are set, or set to the empty
+      string.  This default locale can be the POSIX locale or any other
+      implementation-defined locale.  Some implementations may provide
+      facilities for local installation administrators to set the default
+      locale, customizing it for each location.  POSIX:2001 does not require
+      such a facility.
+
+     The systems with such a facility are Mac OS X and Windows: They provide a
+     GUI that allows the user to choose a locale.
+       - On Mac OS X, by default, none of LC_* or LANG are set.  Starting with
+         Mac OS X 10.4 or 10.5, LANG is set for processes launched by the
+         'Terminal' application (but sometimes to an incorrect value "UTF-8").
+         When no environment variable is set, setlocale (LC_ALL, "") uses the
+         "C" locale.
+       - On native Windows, by default, none of LC_* or LANG are set.
+         When no environment variable is set, setlocale (LC_ALL, "") uses the
+         locale chosen by the user.
+       - On Cygwin 1.5.x, by default, none of LC_* or LANG are set.
+         When no environment variable is set, setlocale (LC_ALL, "") uses the
+         "C" locale.
+       - On Cygwin 1.7, by default, LANG is set to "C.UTF-8" when the default
+         ~/.profile is executed.
+         When no environment variable is set, setlocale (LC_ALL, "") uses the
+         "C.UTF-8" locale, which operates in the same way as the "C" locale.
+  */
+
+#if !(HAVE_CFPREFERENCESCOPYAPPVALUE || defined WINDOWS_NATIVE || defined __CYGWIN__)
+
+  /* The system does not have a way of setting the locale, other than the
+     POSIX specified environment variables.  We use C as default locale.  */
+  return "C";
+
+#else
+
+  /* Return an XPG style locale name language[_territory][@modifier].
+     Don't even bother determining the codeset; it's not useful in this
+     context, because message catalogs are not specific to a single
+     codeset.  */
+
+# if HAVE_CFPREFERENCESCOPYAPPVALUE
+  /* Mac OS X 10.4 or newer */
+  /* Don't use the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent,
+     because in macOS 10.13.4 it has the following behaviour:
+     When two or more languages are specified in the
+     "System Preferences > Language & Region > Preferred Languages" panel,
+     it returns en_CC where CC is the territory (even when English is not among
+     the preferred languages!).  What we want instead is what
+     CFLocaleCopyCurrent returned in earlier macOS releases and what
+     CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the
+     first among the preferred languages and CC is the territory.  */
+  {
+    /* Cache the locale name, since CoreFoundation calls are expensive.  */
+    static const char *cached_localename;
+
+    if (cached_localename == NULL)
+      {
+        char namebuf[256];
+        CFTypeRef value =
+          CFPreferencesCopyAppValue (CFSTR ("AppleLocale"),
+                                     kCFPreferencesCurrentApplication);
+        if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
+          {
+            CFStringRef name = (CFStringRef)value;
+
+            if (CFStringGetCString (name, namebuf, sizeof (namebuf),
+                                    kCFStringEncodingASCII))
+              {
+                gl_locale_name_canonicalize (namebuf);
+                cached_localename = strdup (namebuf);
+              }
+          }
+        if (cached_localename == NULL)
+          cached_localename = "C";
+      }
+    return cached_localename;
+  }
+
+# endif
+
+# if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Native Windows or Cygwin */
+  {
+    LCID lcid;
+
+    /* Use native Windows API locale ID.  */
+    lcid = GetThreadLocale ();
+
+    return gl_locale_name_from_win32_LCID (lcid);
+  }
+# endif
+#endif
+}
+
+/* Determine the current locale's name, and canonicalize it into XPG syntax
+     language[_territory][.codeset][@modifier]
+   The codeset part in the result is not reliable; the locale_charset()
+   should be used for codeset information instead.
+   The result must not be freed; it is statically allocated.  */
+
+const char *
+gl_locale_name (int category, const char *categoryname)
+{
+  const char *retval;
+
+  retval = gl_locale_name_thread (category, categoryname);
+  if (retval != NULL)
+    return retval;
+
+  retval = gl_locale_name_posix (category, categoryname);
+  if (retval != NULL)
+    return retval;
+
+  return gl_locale_name_default ();
+}
deleted file mode 120000 (symlink)
index 9a1945af63175ceee1114c0ba30514f5310771b8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/localename.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7bd59eadf4c773b27a13942e7fcb4624e04b949a
--- /dev/null
@@ -0,0 +1,103 @@
+/* Determine name of the currently selected locale.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_LOCALENAME_H
+#define _GL_LOCALENAME_H
+
+/* This file uses _GL_ATTRIBUTE_CONST, HAVE_CFPREFERENCESCOPYAPPVALUE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Determine the current locale's name.
+   It considers both the POSIX notion of locale name (see functions
+   gl_locale_name_thread and gl_locale_name_posix) and the system notion
+   of locale name (see function gl_locale_name_default).
+   CATEGORY is a locale category abbreviation, as defined in <locale.h>,
+   but not LC_ALL. E.g. LC_MESSAGES.
+   CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES".
+   Return the locale category's name, canonicalized into XPG syntax
+     language[_territory][.codeset][@modifier]
+   The codeset part in the result is not reliable; the locale_charset()
+   should be used for codeset information instead.
+   The result must not be freed; it is statically allocated.  */
+extern const char * gl_locale_name (int category, const char *categoryname);
+
+/* Determine the current per-thread locale's name, as specified by uselocale()
+   calls.
+   CATEGORY is a locale category abbreviation, as defined in <locale.h>,
+   but not LC_ALL. E.g. LC_MESSAGES.
+   CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES".
+   Return the locale category's name, canonicalized into XPG syntax
+     language[_territory][.codeset][@modifier]
+   or NULL if no locale has been specified for the current thread.
+   The codeset part in the result is not reliable; the locale_charset()
+   should be used for codeset information instead.
+   The result must not be freed; it is statically allocated.  */
+extern const char * gl_locale_name_thread (int category, const char *categoryname);
+
+/* Determine the thread-independent current locale's name, as specified by
+   setlocale() calls or by environment variables.
+   CATEGORY is a locale category abbreviation, as defined in <locale.h>,
+   but not LC_ALL. E.g. LC_MESSAGES.
+   CATEGORYNAME is the name of CATEGORY as a string, e.g. "LC_MESSAGES".
+   Return the locale category's name, canonicalized into XPG syntax
+     language[_territory][.codeset][@modifier]
+   or NULL if no locale has been specified to setlocale() or by environment
+   variables.
+   The codeset part in the result is not reliable; the locale_charset()
+   should be used for codeset information instead.
+   The result must not be freed; it is statically allocated.  */
+extern const char * gl_locale_name_posix (int category, const char *categoryname);
+
+/* Determine the default locale's name, as specified by environment
+   variables.
+   Return the locale category's name, or NULL if no locale has been specified
+   by environment variables.
+   The result must not be freed; it is statically allocated.  */
+extern const char * gl_locale_name_environ (int category, const char *categoryname);
+
+/* Determine the default locale's name.  This is the current locale's name,
+   if not specified by uselocale() calls, by setlocale() calls, or by
+   environment variables.  This locale name is usually determined by systems
+   settings that the user can manipulate through a GUI.
+
+   Quoting POSIX:2001:
+     "All implementations shall define a locale as the default locale,
+      to be invoked when no environment variables are set, or set to the
+      empty string.  This default locale can be the C locale or any other
+      implementation-defined locale.  Some implementations may provide
+      facilities for local installation administrators to set the default
+      locale, customizing it for each location.  IEEE Std 1003.1-2001 does
+      not require such a facility."
+
+   The result must not be freed; it is statically allocated.  */
+extern const char * gl_locale_name_default (void)
+#if !(HAVE_CFPREFERENCESCOPYAPPVALUE || defined _WIN32 || defined __CYGWIN__)
+  _GL_ATTRIBUTE_CONST
+#endif
+  ;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_LOCALENAME_H */
deleted file mode 120000 (symlink)
index accc0d03dc710754e42d94141247c8072a186578..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/macros.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d182cd6f07c17476568950dab45ab2b25df05d3e
--- /dev/null
@@ -0,0 +1,109 @@
+/* Common macros used by gnulib tests.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+
+/* This file contains macros that are used by many gnulib tests.
+   Put here only frequently used macros, say, used by 10 tests or more.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef FALLTHROUGH
+# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define FALLTHROUGH ((void) 0)
+# endif
+#endif
+
+/* Define ASSERT_STREAM before including this file if ASSERT must
+   target a stream other than stderr.  */
+#ifndef ASSERT_STREAM
+# define ASSERT_STREAM stderr
+#endif
+
+/* ASSERT (condition);
+   verifies that the specified condition is fulfilled.  If not, a message
+   is printed to ASSERT_STREAM if defined (defaulting to stderr if
+   undefined) and the program is terminated with an error code.
+
+   This macro has the following properties:
+     - The programmer specifies the expected condition, not the failure
+       condition.  This simplifies thinking.
+     - The condition is tested always, regardless of compilation flags.
+       (Unlike the macro from <assert.h>.)
+     - On Unix platforms, the tester can debug the test program with a
+       debugger (provided core dumps are enabled: "ulimit -c unlimited").
+     - For the sake of platforms where no debugger is available (such as
+       some mingw systems), an error message is printed on the error
+       stream that includes the source location of the ASSERT invocation.
+ */
+#define ASSERT(expr) \
+  do                                                                         \
+    {                                                                        \
+      if (!(expr))                                                           \
+        {                                                                    \
+          fprintf (ASSERT_STREAM, "%s:%d: assertion '%s' failed\n",          \
+                   __FILE__, __LINE__, #expr);                               \
+          fflush (ASSERT_STREAM);                                            \
+          abort ();                                                          \
+        }                                                                    \
+    }                                                                        \
+  while (0)
+
+/* Like ASSERT, except that it uses no stdio.
+   Requires #include <string.h> and #include <unistd.h>.  */
+#define ASSERT_NO_STDIO(expr) \
+  do                                                        \
+    {                                                       \
+      if (!(expr))                                          \
+        {                                                   \
+          WRITE_TO_STDERR (__FILE__);                       \
+          WRITE_TO_STDERR (":");                            \
+          WRITE_MACROEXPANDED_INTEGER_TO_STDERR (__LINE__); \
+          WRITE_TO_STDERR (": assertion '");                \
+          WRITE_TO_STDERR (#expr);                          \
+          WRITE_TO_STDERR ("' failed\n");                   \
+          abort ();                                         \
+        }                                                   \
+    }                                                       \
+  while (0)
+#define WRITE_MACROEXPANDED_INTEGER_TO_STDERR(integer) \
+  WRITE_INTEGER_TO_STDERR(integer)
+#define WRITE_INTEGER_TO_STDERR(integer) \
+  WRITE_TO_STDERR (#integer)
+#define WRITE_TO_STDERR(string_literal) \
+  {                                     \
+    const char *s = string_literal;     \
+    int ret = write (2, s, strlen (s)); \
+    (void) ret;                         \
+  }
+
+/* SIZEOF (array)
+   returns the number of elements of an array.  It works for arrays that are
+   declared outside functions and for local variables of array type.  It does
+   *not* work for function parameters of array type, because they are actually
+   parameters of pointer type.  */
+#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
+
+/* STREQ (str1, str2)
+   Return true if two strings compare equal.  */
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
+/* Some numbers in the interval [0,1).  */
+extern const float randomf[1000];
+extern const double randomd[1000];
+extern const long double randoml[1000];
deleted file mode 120000 (symlink)
index 185f57628d09ab31569e61ae762e6995946a2b5b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/minus-zero.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..73a388f69e33ebae405ddf67e04208b7b6229160
--- /dev/null
@@ -0,0 +1,74 @@
+/* Macros for floating-point negative zero.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Keep in sync with m4/minus-zero.m4!  */
+
+#include <float.h>
+
+
+/* minus_zerof represents the value -0.0f.  */
+
+/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f.
+   ICC 10.0 has a bug when optimizing the expression -zero.
+   The expression -FLT_MIN * FLT_MIN does not work when cross-compiling
+   to PowerPC on Mac OS X 10.5.  */
+#if defined __hpux || defined __sgi || defined __ICC
+static float
+compute_minus_zerof (void)
+{
+  return -FLT_MIN * FLT_MIN;
+}
+# define minus_zerof compute_minus_zerof ()
+#else
+float minus_zerof = -0.0f;
+#endif
+
+
+/* minus_zerod represents the value -0.0.  */
+
+/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
+   ICC 10.0 has a bug when optimizing the expression -zero.
+   The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
+   to PowerPC on Mac OS X 10.5.  */
+#if defined __hpux || defined __sgi || defined __ICC
+static double
+compute_minus_zerod (void)
+{
+  return -DBL_MIN * DBL_MIN;
+}
+# define minus_zerod compute_minus_zerod ()
+#else
+double minus_zerod = -0.0;
+#endif
+
+
+/* minus_zerol represents the value -0.0L.  */
+
+/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0L.
+   IRIX cc can't put -0.0L into .data, but can compute at runtime.
+   ICC 10.0 has a bug when optimizing the expression -zero.
+   The expression -LDBL_MIN * LDBL_MIN does not work when cross-compiling
+   to PowerPC on Mac OS X 10.5.  */
+#if defined __hpux || defined __sgi || defined __ICC
+static long double
+compute_minus_zerol (void)
+{
+  return -LDBL_MIN * LDBL_MIN;
+}
+# define minus_zerol compute_minus_zerol ()
+#else
+long double minus_zerol = -0.0L;
+#endif
deleted file mode 120000 (symlink)
index 54be4d63a8ec26baad9c63ad615d2a187b67adc0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/nan.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d540a0bb84301438a5ee81ed632f24fd1b5e002d
--- /dev/null
@@ -0,0 +1,97 @@
+/* Macros for quiet not-a-number.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_NAN_H
+#define _GL_NAN_H
+
+
+/* IBM z/OS supports both hexadecimal and IEEE floating-point formats. The
+   former does not support NaN and its isnan() implementation returns zero
+   for all values.  */
+#if defined __MVS__ && defined __IBMC__ && !defined __BFP__
+# error "NaN is not supported with IBM's hexadecimal floating-point format; please re-compile with -qfloat=ieee"
+#endif
+
+/* NaNf () returns a 'float' not-a-number.  */
+
+/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
+   on the expression 0.0 / 0.0.  The IBM XL C compiler on z/OS complains.
+   PGI 16.10 complains.  clang 13 on mips64 does incorrect constant-folding.  */
+#if (defined __DECC || defined _MSC_VER \
+     || (defined __MVS__ && defined __IBMC__) \
+     || defined __PGI \
+     || defined __mips__)
+static float
+NaNf ()
+{
+  static float volatile zero = 0.0f;
+  return zero / zero;
+}
+#else
+# define NaNf() (0.0f / 0.0f)
+#endif
+
+
+/* NaNd () returns a 'double' not-a-number.  */
+
+/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
+   on the expression 0.0 / 0.0.  The IBM XL C compiler on z/OS complains.
+   PGI 16.10 complains.  clang 13 on mips64 does incorrect constant-folding.  */
+#if (defined __DECC || defined _MSC_VER \
+     || (defined __MVS__ && defined __IBMC__) \
+     || defined __PGI \
+     || defined __mips__)
+static double
+NaNd ()
+{
+  static double volatile zero = 0.0;
+  return zero / zero;
+}
+#else
+# define NaNd() (0.0 / 0.0)
+#endif
+
+
+/* NaNl () returns a 'long double' not-a-number.  */
+
+/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
+   runtime type conversion.
+   The Microsoft MSVC 9 compiler chokes on the expression 0.0L / 0.0L.
+   The IBM XL C compiler on z/OS complains.
+   PGI 16.10 complains.
+   Avoid possible incorrect constant-folding on mips.  */
+#ifdef __sgi
+static long double NaNl ()
+{
+  double zero = 0.0;
+  return zero / zero;
+}
+#elif (defined _MSC_VER \
+       || (defined __MVS__ && defined __IBMC__) \
+       || defined __PGI \
+       || defined __mips__)
+static long double
+NaNl ()
+{
+  static long double volatile zero = 0.0L;
+  return zero / zero;
+}
+#else
+# define NaNl() (0.0L / 0.0L)
+#endif
+
+
+#endif /* _GL_NAN_H */
deleted file mode 120000 (symlink)
index 28ea7a398533358eca034ba1393717dbd6dcfebf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/nap.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cf7d998b800e99727f4f1d0a8d2719d7bf7892d7
--- /dev/null
@@ -0,0 +1,161 @@
+/* Assist in file system timestamp tests.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#ifndef GLTEST_NAP_H
+# define GLTEST_NAP_H
+
+# include <limits.h>
+
+# include <stdckdint.h>
+
+/* Avoid a conflict with a function called nap() on UnixWare.  */
+# if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__)  /* OpenServer, UnixWare */
+#  include <unistd.h>
+#  undef nap
+#  define nap gl_nap
+# endif
+
+/* Name of the witness file.  */
+#define TEMPFILE BASE "nap.tmp"
+
+/* File descriptor used for the witness file.  */
+static int nap_fd = -1;
+
+/* Return A - B, in ns.
+   Return 0 if the true result would be negative.
+   Return INT_MAX if the true result would be greater than INT_MAX.  */
+static int
+diff_timespec (struct timespec a, struct timespec b)
+{
+  time_t as = a.tv_sec;
+  time_t bs = b.tv_sec;
+  int ans = a.tv_nsec;
+  int bns = b.tv_nsec;
+  int sdiff;
+
+  ASSERT (0 <= ans && ans < 2000000000);
+  ASSERT (0 <= bns && bns < 2000000000);
+
+  if (! (bs < as || (bs == as && bns < ans)))
+    return 0;
+
+  if (ckd_sub (&sdiff, as, bs)
+      || ckd_mul (&sdiff, sdiff, 1000000000)
+      || ckd_add (&sdiff, sdiff, ans - bns))
+    return INT_MAX;
+
+  return sdiff;
+}
+
+/* If DO_WRITE, bump the modification time of the file designated by NAP_FD.
+   Then fetch the new STAT information of NAP_FD.  */
+static void
+nap_get_stat (struct stat *st, int do_write)
+{
+  if (do_write)
+    {
+      ASSERT (write (nap_fd, "\n", 1) == 1);
+#if defined _WIN32 || defined __CYGWIN__
+      /* On Windows, the modification times are not changed until NAP_FD
+         is closed. See
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-writefile> */
+      close (nap_fd);
+      nap_fd = open (TEMPFILE, O_RDWR, 0600);
+      ASSERT (nap_fd != -1);
+      lseek (nap_fd, 0, SEEK_END);
+#endif
+    }
+  ASSERT (fstat (nap_fd, st) == 0);
+}
+
+/* Given a file whose descriptor is FD, see whether delaying by DELAY
+   nanoseconds causes a change in a file's mtime.
+   OLD_ST is the file's status, recently gotten.  */
+static bool
+nap_works (int delay, struct stat old_st)
+{
+  struct stat st;
+  struct timespec delay_spec;
+  delay_spec.tv_sec = delay / 1000000000;
+  delay_spec.tv_nsec = delay % 1000000000;
+  ASSERT (nanosleep (&delay_spec, 0) == 0);
+  nap_get_stat (&st, 1);
+
+  if (diff_timespec (get_stat_mtime (&st), get_stat_mtime (&old_st)))
+    return true;
+
+  return false;
+}
+
+static void
+clear_temp_file (void)
+{
+  if (0 <= nap_fd)
+    {
+      ASSERT (close (nap_fd) != -1);
+      ASSERT (unlink (TEMPFILE) != -1);
+    }
+}
+
+/* Sleep long enough to notice a timestamp difference on the file
+   system in the current directory.  Use an adaptive approach, trying
+   to find the smallest delay which works on the current file system
+   to make the timestamp difference appear.  Assert a maximum delay of
+   ~2 seconds, more precisely sum(2^n) from 0 to 30 = 2^31 - 1 = 2.1s.
+   Assumes that BASE is defined, and requires that the test module
+   depends on nanosleep.  */
+static void
+nap (void)
+{
+  struct stat old_st;
+  static int delay = 1;
+
+  if (-1 == nap_fd)
+    {
+      atexit (clear_temp_file);
+      ASSERT ((nap_fd = creat (TEMPFILE, 0600)) != -1);
+      nap_get_stat (&old_st, 0);
+    }
+  else
+    {
+      ASSERT (0 <= nap_fd);
+      nap_get_stat (&old_st, 1);
+    }
+
+  if (1 < delay)
+    delay = delay / 2;  /* Try half of the previous delay.  */
+  ASSERT (0 < delay);
+
+  for (;;)
+    {
+      if (nap_works (delay, old_st))
+        return;
+      if (delay <= (2147483647 - 1) / 2)
+        {
+          delay = delay * 2 + 1;
+          continue;
+        }
+      else
+        break;
+    }
+
+  /* Bummer: even the highest nap delay didn't work. */
+  ASSERT (0);
+}
+
+#endif /* GLTEST_NAP_H */
deleted file mode 120000 (symlink)
index 50e080559ff0f50f3436072b124625d1926af50d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/null-ptr.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2f092d4984a33d897560306d02d230c89ebf5c70
--- /dev/null
@@ -0,0 +1,33 @@
+/* Return a NULL pointer, without letting the compiler know it.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stdlib.h>
+
+/* Return NULL.
+   Usual compilers are not able to infer something about the return value.  */
+static void *
+null_ptr (void)
+{
+  unsigned int x = rand ();
+  unsigned int y = x * x;
+  if (y & 2)
+    return (void *) -1;
+  else
+    return (void *) 0;
+}
+
+/* If you want to know why this always returns NULL, read
+   https://en.wikipedia.org/wiki/Quadratic_residue#Prime_power_modulus .  */
deleted file mode 120000 (symlink)
index 4d88edbc07083d66fdc1bd55c5c97c9864bbf340..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/perror.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f29cd03180f488f501ea3d4a07cdfa7556f29f9f
--- /dev/null
@@ -0,0 +1,49 @@
+/* Print a message describing error code.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible and Simon Josefsson.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "strerror-override.h"
+
+/* Use the system functions, not the gnulib overrides in this file.  */
+#undef fprintf
+
+void
+perror (const char *string)
+{
+  char stackbuf[STACKBUF_LEN];
+  int ret;
+
+  /* Our implementation guarantees that this will be a non-empty
+     string, even if it returns EINVAL; and stackbuf should be sized
+     large enough to avoid ERANGE.  */
+  ret = strerror_r (errno, stackbuf, sizeof stackbuf);
+  if (ret == ERANGE)
+    abort ();
+
+  if (string != NULL && *string != '\0')
+    fprintf (stderr, "%s: %s\n", string, stackbuf);
+  else
+    fprintf (stderr, "%s\n", stackbuf);
+}
deleted file mode 120000 (symlink)
index 6ad62c977334b538b2159d01b7845659e5565581..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/qemu.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a5ed16ab54276879b08d59789945f929f9fabaeb
--- /dev/null
@@ -0,0 +1,98 @@
+/* Determine whether the current process is running under QEMU.
+   Copyright (C) 2021-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2021.  */
+
+#ifdef __linux__
+# include <fcntl.h>
+# include <string.h>
+# include <unistd.h>
+#endif
+
+/* This function determines whether the current process is running under QEMU
+   (user-mode).
+
+   It does so by looking at parts of the environment that QEMU does not emulate
+   100% perfectly well.
+
+   For comparison, the techniques given in the paper
+     Thomas Raffetseder, Christopher Kruegel, Engin Kirda
+     "Detecting System Emulators"
+     2007
+     https://publik.tuwien.ac.at/files/pub-inf_5317.pdf
+   apply to both the QEMU system mode and QEMU user mode.  */
+
+static bool
+is_running_under_qemu_user (void)
+{
+#ifdef __linux__
+  char buf[4096 + 1];
+  int fd;
+
+# if defined __m68k__
+  fd = open ("/proc/hardware", O_RDONLY);
+  if (fd >= 0)
+    {
+      int n = read (fd, buf, sizeof (buf) - 1);
+      close (fd);
+      if (n > 0)
+        {
+          buf[n] = '\0';
+          if (strstr (buf, "qemu") != NULL)
+            return true;
+        }
+    }
+# endif
+
+  fd = open ("/proc/cpuinfo", O_RDONLY);
+  if (fd >= 0)
+    {
+      int n = read (fd, buf, sizeof (buf) - 1);
+      close (fd);
+      if (n > 0)
+        {
+          buf[n] = '\0';
+# if defined __hppa__
+          if (strstr (buf, "QEMU") != NULL)
+            return true;
+# endif
+# if !(defined __i386__ || defined __x86_64__)
+          if (strstr (buf, "AuthenticAMD") != NULL
+              || strstr (buf, "GenuineIntel") != NULL)
+            return true;
+# endif
+# if !(defined __arm__ || defined __aarch64__)
+          if (strstr (buf, "ARM") != NULL
+              || strcasestr (buf, "aarch64") != NULL)
+            return true;
+# endif
+# if !defined __sparc__
+          if (strcasestr (buf, "SPARC") != NULL)
+            return true;
+# endif
+# if !defined __powerpc__
+          if (strstr (buf, "POWER") != NULL)
+            return true;
+# endif
+        }
+    }
+
+  /* If you need more heuristics, look at system calls that are not perfectly
+     well emulated in qemu/linux-user/syscall.c.  */
+#endif
+
+  return false;
+}
deleted file mode 120000 (symlink)
index ad1da65bb6227403673aa513be15036221f6c17b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/random.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..97ba1691d74a616995f61f7b5aad6770189055f7
--- /dev/null
@@ -0,0 +1,317 @@
+/* Copyright (C) 1995-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/*
+ * This is derived from the Berkeley source:
+ *      @(#)random.c    5.5 (Berkeley) 7/6/88
+ * It was reworked for the GNU C Library by Roland McGrath.
+ * Rewritten to use reentrant functions by Ulrich Drepper, 1995.
+ */
+
+/*
+   Copyright (C) 1983 Regents of the University of California.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   4. Neither the name of the University nor the names of its contributors
+      may be used to endorse or promote products derived from this software
+      without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+   SUCH DAMAGE.*/
+
+#ifndef _LIBC
+# include <libc-config.h>
+# define __srandom srandom
+# define __initstate initstate
+# define __setstate setstate
+# define __random random
+# define __srandom_r srandom_r
+# define __initstate_r initstate_r
+# define __setstate_r setstate_r
+# define __random_r random_r
+#endif
+
+/* Specification.  */
+#include <stdlib.h>
+
+#ifdef _LIBC
+# include <libc-lock.h>
+#else
+# include "glthread/lock.h"
+# define __libc_lock_define_initialized gl_lock_define_initialized
+# define __libc_lock_lock gl_lock_lock
+# define __libc_lock_unlock gl_lock_unlock
+#endif
+
+/* An improved random number generation package.  In addition to the standard
+   rand()/srand() like interface, this package also has a special state info
+   interface.  The initstate() routine is called with a seed, an array of
+   bytes, and a count of how many bytes are being passed in; this array is
+   then initialized to contain information for random number generation with
+   that much state information.  Good sizes for the amount of state
+   information are 32, 64, 128, and 256 bytes.  The state can be switched by
+   calling the setstate() function with the same array as was initialized
+   with initstate().  By default, the package runs with 128 bytes of state
+   information and generates far better random numbers than a linear
+   congruential generator.  If the amount of state information is less than
+   32 bytes, a simple linear congruential R.N.G. is used.  Internally, the
+   state information is treated as an array of longs; the zeroth element of
+   the array is the type of R.N.G. being used (small integer); the remainder
+   of the array is the state information for the R.N.G.  Thus, 32 bytes of
+   state information will give 7 longs worth of state information, which will
+   allow a degree seven polynomial.  (Note: The zeroth word of state
+   information also has some other information stored in it; see setstate
+   for details).  The random number generation technique is a linear feedback
+   shift register approach, employing trinomials (since there are fewer terms
+   to sum up that way).  In this approach, the least significant bit of all
+   the numbers in the state table will act as a linear feedback shift register,
+   and will have period 2^deg - 1 (where deg is the degree of the polynomial
+   being used, assuming that the polynomial is irreducible and primitive).
+   The higher order bits will have longer periods, since their values are
+   also influenced by pseudo-random carries out of the lower bits.  The
+   total period of the generator is approximately deg*(2**deg - 1); thus
+   doubling the amount of state information has a vast influence on the
+   period of the generator.  Note: The deg*(2**deg - 1) is an approximation
+   only good for large deg, when the period of the shift register is the
+   dominant factor.  With deg equal to seven, the period is actually much
+   longer than the 7*(2**7 - 1) predicted by this formula.  */
+
+
+
+/* For each of the currently supported random number generators, we have a
+   break value on the amount of state information (you need at least this many
+   bytes of state info to support this random number generator), a degree for
+   the polynomial (actually a trinomial) that the R.N.G. is based on, and
+   separation between the two lower order coefficients of the trinomial.  */
+
+/* Linear congruential.  */
+#define TYPE_0          0
+#define BREAK_0         8
+#define DEG_0           0
+#define SEP_0           0
+
+/* x**7 + x**3 + 1.  */
+#define TYPE_1          1
+#define BREAK_1         32
+#define DEG_1           7
+#define SEP_1           3
+
+/* x**15 + x + 1.  */
+#define TYPE_2          2
+#define BREAK_2         64
+#define DEG_2           15
+#define SEP_2           1
+
+/* x**31 + x**3 + 1.  */
+#define TYPE_3          3
+#define BREAK_3         128
+#define DEG_3           31
+#define SEP_3           3
+
+/* x**63 + x + 1.  */
+#define TYPE_4          4
+#define BREAK_4         256
+#define DEG_4           63
+#define SEP_4           1
+
+
+/* Array versions of the above information to make code run faster.
+   Relies on fact that TYPE_i == i.  */
+
+#define MAX_TYPES       5       /* Max number of types above.  */
+
+
+/* Initially, everything is set up as if from:
+        initstate(1, randtbl, 128);
+   Note that this initialization takes advantage of the fact that srandom
+   advances the front and rear pointers 10*rand_deg times, and hence the
+   rear pointer which starts at 0 will also end up at zero; thus the zeroth
+   element of the state information, which contains info about the current
+   position of the rear pointer is just
+        (MAX_TYPES * (rptr - state)) + TYPE_3 == TYPE_3.  */
+
+static int32_t randtbl[DEG_3 + 1] =
+  {
+    TYPE_3,
+
+    -1726662223, 379960547, 1735697613, 1040273694, 1313901226,
+    1627687941, -179304937, -2073333483, 1780058412, -1989503057,
+    -615974602, 344556628, 939512070, -1249116260, 1507946756,
+    -812545463, 154635395, 1388815473, -1926676823, 525320961,
+    -1009028674, 968117788, -123449607, 1284210865, 435012392,
+    -2017506339, -911064859, -370259173, 1132637927, 1398500161,
+    -205601318,
+  };
+
+
+static struct random_data unsafe_state =
+  {
+/* FPTR and RPTR are two pointers into the state info, a front and a rear
+   pointer.  These two pointers are always rand_sep places apart, as they
+   cycle through the state information.  (Yes, this does mean we could get
+   away with just one pointer, but the code for random is more efficient
+   this way).  The pointers are left positioned as they would be from the call:
+        initstate(1, randtbl, 128);
+   (The position of the rear pointer, rptr, is really 0 (as explained above
+   in the initialization of randtbl) because the state table pointer is set
+   to point to randtbl[1] (as explained below).)  */
+
+    .fptr = &randtbl[SEP_3 + 1],
+    .rptr = &randtbl[1],
+
+/* The following things are the pointer to the state information table,
+   the type of the current generator, the degree of the current polynomial
+   being used, and the separation between the two pointers.
+   Note that for efficiency of random, we remember the first location of
+   the state information, not the zeroth.  Hence it is valid to access
+   state[-1], which is used to store the type of the R.N.G.
+   Also, we remember the last location, since this is more efficient than
+   indexing every time to find the address of the last element to see if
+   the front and rear pointers have wrapped.  */
+
+    .state = &randtbl[1],
+
+    .rand_type = TYPE_3,
+    .rand_deg = DEG_3,
+    .rand_sep = SEP_3,
+
+    .end_ptr = &randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
+};
+\f
+/* POSIX.1c requires that there is mutual exclusion for the 'rand' and
+   'srand' functions to prevent concurrent calls from modifying common
+   data.  */
+__libc_lock_define_initialized (static, lock)
+\f
+/* Initialize the random number generator based on the given seed.  If the
+   type is the trivial no-state-information type, just remember the seed.
+   Otherwise, initializes state[] based on the given "seed" via a linear
+   congruential generator.  Then, the pointers are set to known locations
+   that are exactly rand_sep places apart.  Lastly, it cycles the state
+   information a given number of times to get rid of any initial dependencies
+   introduced by the L.C.R.N.G.  Note that the initialization of randtbl[]
+   for default usage relies on values produced by this routine.  */
+void
+__srandom (unsigned int x)
+{
+  __libc_lock_lock (lock);
+  (void) __srandom_r (x, &unsafe_state);
+  __libc_lock_unlock (lock);
+}
+
+weak_alias (__srandom, srandom)
+weak_alias (__srandom, srand)
+\f
+/* Initialize the state information in the given array of N bytes for
+   future random number generation.  Based on the number of bytes we
+   are given, and the break values for the different R.N.G.'s, we choose
+   the best (largest) one we can and set things up for it.  srandom is
+   then called to initialize the state information.  Note that on return
+   from srandom, we set state[-1] to be the type multiplexed with the current
+   value of the rear pointer; this is so successive calls to initstate won't
+   lose this information and will be able to restart with setstate.
+   Note: The first thing we do is save the current state, if any, just like
+   setstate so that it doesn't matter when initstate is called.
+   Returns a pointer to the old state.  */
+char *
+__initstate (unsigned int seed, char *arg_state, size_t n)
+{
+  int32_t *ostate;
+  int ret;
+
+  __libc_lock_lock (lock);
+
+  ostate = &unsafe_state.state[-1];
+
+  ret = __initstate_r (seed, arg_state, n, &unsafe_state);
+
+  __libc_lock_unlock (lock);
+
+  return ret == -1 ? NULL : (char *) ostate;
+}
+
+weak_alias (__initstate, initstate)
+\f
+/* Restore the state from the given state array.
+   Note: It is important that we also remember the locations of the pointers
+   in the current state information, and restore the locations of the pointers
+   from the old state information.  This is done by multiplexing the pointer
+   location into the zeroth word of the state information. Note that due
+   to the order in which things are done, it is OK to call setstate with the
+   same state as the current state
+   Returns a pointer to the old state information.  */
+char *
+__setstate (char *arg_state)
+{
+  int32_t *ostate;
+
+  __libc_lock_lock (lock);
+
+  ostate = &unsafe_state.state[-1];
+
+  if (__setstate_r (arg_state, &unsafe_state) < 0)
+    ostate = NULL;
+
+  __libc_lock_unlock (lock);
+
+  return (char *) ostate;
+}
+
+weak_alias (__setstate, setstate)
+\f
+/* If we are using the trivial TYPE_0 R.N.G., just do the old linear
+   congruential bit.  Otherwise, we do our fancy trinomial stuff, which is the
+   same in all the other cases due to all the global variables that have been
+   set up.  The basic operation is to add the number at the rear pointer into
+   the one at the front pointer.  Then both pointers are advanced to the next
+   location cyclically in the table.  The value returned is the sum generated,
+   reduced to 31 bits by throwing away the "least random" low bit.
+   Note: The code takes advantage of the fact that both the front and
+   rear pointers can't wrap on the same call by not testing the rear
+   pointer if the front one has wrapped.  Returns a 31-bit random number.  */
+
+long int
+__random (void)
+{
+  int32_t retval;
+
+  __libc_lock_lock (lock);
+
+  (void) __random_r (&unsafe_state, &retval);
+
+  __libc_lock_unlock (lock);
+
+  return retval;
+}
+
+weak_alias (__random, random)
deleted file mode 120000 (symlink)
index 0f4f2307cc8ac0fc6e42a440fe9faa3af62d7df3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/random_r.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b0ab81acb2c7d2566204c8a88127d8e8dad64b68
--- /dev/null
@@ -0,0 +1,430 @@
+/*
+   Copyright (C) 1995-2024 Free Software Foundation, Inc.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/*
+   Copyright (C) 1983 Regents of the University of California.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   4. Neither the name of the University nor the names of its contributors
+      may be used to endorse or promote products derived from this software
+      without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+   SUCH DAMAGE.*/
+
+/*
+ * This is derived from the Berkeley source:
+ *      @(#)random.c    5.5 (Berkeley) 7/6/88
+ * It was reworked for the GNU C Library by Roland McGrath.
+ * Rewritten to be reentrant by Ulrich Drepper, 1995
+ */
+
+#ifndef _LIBC
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the buf == NULL, arg_state == NULL, result == NULL tests
+   below.  */
+# define _GL_ARG_NONNULL(params)
+
+# include <libc-config.h>
+# define __srandom_r srandom_r
+# define __initstate_r initstate_r
+# define __setstate_r setstate_r
+# define __random_r random_r
+#endif
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stddef.h>
+#include <string.h>
+
+
+/* An improved random number generation package.  In addition to the standard
+   rand()/srand() like interface, this package also has a special state info
+   interface.  The initstate() routine is called with a seed, an array of
+   bytes, and a count of how many bytes are being passed in; this array is
+   then initialized to contain information for random number generation with
+   that much state information.  Good sizes for the amount of state
+   information are 32, 64, 128, and 256 bytes.  The state can be switched by
+   calling the setstate() function with the same array as was initialized
+   with initstate().  By default, the package runs with 128 bytes of state
+   information and generates far better random numbers than a linear
+   congruential generator.  If the amount of state information is less than
+   32 bytes, a simple linear congruential R.N.G. is used.  Internally, the
+   state information is treated as an array of longs; the zeroth element of
+   the array is the type of R.N.G. being used (small integer); the remainder
+   of the array is the state information for the R.N.G.  Thus, 32 bytes of
+   state information will give 7 longs worth of state information, which will
+   allow a degree seven polynomial.  (Note: The zeroth word of state
+   information also has some other information stored in it; see setstate
+   for details).  The random number generation technique is a linear feedback
+   shift register approach, employing trinomials (since there are fewer terms
+   to sum up that way).  In this approach, the least significant bit of all
+   the numbers in the state table will act as a linear feedback shift register,
+   and will have period 2^deg - 1 (where deg is the degree of the polynomial
+   being used, assuming that the polynomial is irreducible and primitive).
+   The higher order bits will have longer periods, since their values are
+   also influenced by pseudo-random carries out of the lower bits.  The
+   total period of the generator is approximately deg*(2**deg - 1); thus
+   doubling the amount of state information has a vast influence on the
+   period of the generator.  Note: The deg*(2**deg - 1) is an approximation
+   only good for large deg, when the period of the shift register is the
+   dominant factor.  With deg equal to seven, the period is actually much
+   longer than the 7*(2**7 - 1) predicted by this formula.  */
+
+
+
+/* For each of the currently supported random number generators, we have a
+   break value on the amount of state information (you need at least this many
+   bytes of state info to support this random number generator), a degree for
+   the polynomial (actually a trinomial) that the R.N.G. is based on, and
+   separation between the two lower order coefficients of the trinomial.  */
+
+/* Linear congruential.  */
+#define TYPE_0          0
+#define BREAK_0         8
+#define DEG_0           0
+#define SEP_0           0
+
+/* x**7 + x**3 + 1.  */
+#define TYPE_1          1
+#define BREAK_1         32
+#define DEG_1           7
+#define SEP_1           3
+
+/* x**15 + x + 1.  */
+#define TYPE_2          2
+#define BREAK_2         64
+#define DEG_2           15
+#define SEP_2           1
+
+/* x**31 + x**3 + 1.  */
+#define TYPE_3          3
+#define BREAK_3         128
+#define DEG_3           31
+#define SEP_3           3
+
+/* x**63 + x + 1.  */
+#define TYPE_4          4
+#define BREAK_4         256
+#define DEG_4           63
+#define SEP_4           1
+
+
+/* Array versions of the above information to make code run faster.
+   Relies on fact that TYPE_i == i.  */
+
+#define MAX_TYPES       5       /* Max number of types above.  */
+
+struct random_poly_info
+{
+  int seps[MAX_TYPES];
+  int degrees[MAX_TYPES];
+};
+
+static const struct random_poly_info random_poly_info =
+{
+  { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 },
+  { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }
+};
+
+static int32_t
+get_int32 (void *p)
+{
+  int32_t v;
+  memcpy (&v, p, sizeof v);
+  return v;
+}
+
+static void
+set_int32 (void *p, int32_t v)
+{
+  memcpy (p, &v, sizeof v);
+}
+
+\f
+/* Initialize the random number generator based on the given seed.  If the
+   type is the trivial no-state-information type, just remember the seed.
+   Otherwise, initializes state[] based on the given "seed" via a linear
+   congruential generator.  Then, the pointers are set to known locations
+   that are exactly rand_sep places apart.  Lastly, it cycles the state
+   information a given number of times to get rid of any initial dependencies
+   introduced by the L.C.R.N.G.  Note that the initialization of randtbl[]
+   for default usage relies on values produced by this routine.  */
+int
+__srandom_r (unsigned int seed, struct random_data *buf)
+{
+  int type;
+  int32_t *state;
+  long int i;
+  int32_t word;
+  int32_t *dst;
+  int kc;
+
+  if (buf == NULL)
+    goto fail;
+  type = buf->rand_type;
+  if ((unsigned int) type >= MAX_TYPES)
+    goto fail;
+
+  state = buf->state;
+  /* We must make sure the seed is not 0.  Take arbitrarily 1 in this case.  */
+  if (seed == 0)
+    seed = 1;
+  set_int32 (&state[0], seed);
+  if (type == TYPE_0)
+    goto done;
+
+  dst = state;
+  word = seed;
+  kc = buf->rand_deg;
+  for (i = 1; i < kc; ++i)
+    {
+      /* This does:
+           state[i] = (16807 * state[i - 1]) % 2147483647;
+         but avoids overflowing 31 bits.  */
+      long int hi = word / 127773;
+      long int lo = word % 127773;
+      word = 16807 * lo - 2836 * hi;
+      if (word < 0)
+        word += 2147483647;
+      set_int32 (++dst, word);
+    }
+
+  buf->fptr = &state[buf->rand_sep];
+  buf->rptr = &state[0];
+  kc *= 10;
+  while (--kc >= 0)
+    {
+      int32_t discard;
+      (void) __random_r (buf, &discard);
+    }
+
+ done:
+  return 0;
+
+ fail:
+  return -1;
+}
+
+weak_alias (__srandom_r, srandom_r)
+\f
+/* Initialize the state information in the given array of N bytes for
+   future random number generation.  Based on the number of bytes we
+   are given, and the break values for the different R.N.G.'s, we choose
+   the best (largest) one we can and set things up for it.  srandom is
+   then called to initialize the state information.  Note that on return
+   from srandom, we set state[-1] to be the type multiplexed with the current
+   value of the rear pointer; this is so successive calls to initstate won't
+   lose this information and will be able to restart with setstate.
+   Note: The first thing we do is save the current state, if any, just like
+   setstate so that it doesn't matter when initstate is called.
+   Returns 0 on success, non-zero on failure.  */
+int
+__initstate_r (unsigned int seed, char *arg_state, size_t n,
+               struct random_data *buf)
+{
+  if (buf == NULL)
+    goto fail;
+
+  int32_t *old_state = buf->state;
+  if (old_state != NULL)
+    {
+      int old_type = buf->rand_type;
+      set_int32 (&old_state[-1],
+                 (old_type == TYPE_0
+                  ? TYPE_0
+                  : (MAX_TYPES * (buf->rptr - old_state)) + old_type));
+    }
+
+  int type;
+  if (n >= BREAK_3)
+    type = n < BREAK_4 ? TYPE_3 : TYPE_4;
+  else if (n < BREAK_1)
+    {
+      if (n < BREAK_0)
+        goto fail;
+
+      type = TYPE_0;
+    }
+  else
+    type = n < BREAK_2 ? TYPE_1 : TYPE_2;
+
+  int degree = random_poly_info.degrees[type];
+  int separation = random_poly_info.seps[type];
+
+  buf->rand_type = type;
+  buf->rand_sep = separation;
+  buf->rand_deg = degree;
+  int32_t *state = &((int32_t *) arg_state)[1]; /* First location.  */
+  /* Must set END_PTR before srandom.  */
+  buf->end_ptr = &state[degree];
+
+  buf->state = state;
+
+  __srandom_r (seed, buf);
+
+  set_int32 (&state[-1],
+             type == TYPE_0 ? TYPE_0 : (buf->rptr - state) * MAX_TYPES + type);
+
+  return 0;
+
+ fail:
+  __set_errno (EINVAL);
+  return -1;
+}
+
+weak_alias (__initstate_r, initstate_r)
+\f
+/* Restore the state from the given state array.
+   Note: It is important that we also remember the locations of the pointers
+   in the current state information, and restore the locations of the pointers
+   from the old state information.  This is done by multiplexing the pointer
+   location into the zeroth word of the state information. Note that due
+   to the order in which things are done, it is OK to call setstate with the
+   same state as the current state
+   Returns 0 on success, non-zero on failure.  */
+int
+__setstate_r (char *arg_state, struct random_data *buf)
+{
+  int32_t *new_state = 1 + (int32_t *) arg_state;
+  int type;
+  int old_type;
+  int32_t *old_state;
+  int degree;
+  int separation;
+
+  if (arg_state == NULL || buf == NULL)
+    goto fail;
+
+  old_type = buf->rand_type;
+  old_state = buf->state;
+  set_int32 (&old_state[-1],
+             (old_type == TYPE_0
+              ? TYPE_0
+              : (MAX_TYPES * (buf->rptr - old_state)) + old_type));
+
+  type = get_int32 (&new_state[-1]) % MAX_TYPES;
+  if (type < TYPE_0 || type > TYPE_4)
+    goto fail;
+
+  buf->rand_deg = degree = random_poly_info.degrees[type];
+  buf->rand_sep = separation = random_poly_info.seps[type];
+  buf->rand_type = type;
+
+  if (type != TYPE_0)
+    {
+      int rear = get_int32 (&new_state[-1]) / MAX_TYPES;
+      buf->rptr = &new_state[rear];
+      buf->fptr = &new_state[(rear + separation) % degree];
+    }
+  buf->state = new_state;
+  /* Set end_ptr too.  */
+  buf->end_ptr = &new_state[degree];
+
+  return 0;
+
+ fail:
+  __set_errno (EINVAL);
+  return -1;
+}
+
+weak_alias (__setstate_r, setstate_r)
+\f
+/* If we are using the trivial TYPE_0 R.N.G., just do the old linear
+   congruential bit.  Otherwise, we do our fancy trinomial stuff, which is the
+   same in all the other cases due to all the global variables that have been
+   set up.  The basic operation is to add the number at the rear pointer into
+   the one at the front pointer.  Then both pointers are advanced to the next
+   location cyclically in the table.  The value returned is the sum generated,
+   reduced to 31 bits by throwing away the "least random" low bit.
+   Note: The code takes advantage of the fact that both the front and
+   rear pointers can't wrap on the same call by not testing the rear
+   pointer if the front one has wrapped.  Returns a 31-bit random number.  */
+
+int
+__random_r (struct random_data *buf, int32_t *result)
+{
+  int32_t *state;
+
+  if (buf == NULL || result == NULL)
+    goto fail;
+
+  state = buf->state;
+
+  if (buf->rand_type == TYPE_0)
+    {
+      int32_t val = (((get_int32 (&state[0]) * 1103515245U) + 12345U)
+                     & 0x7fffffff);
+      set_int32 (&state[0], val);
+      *result = val;
+    }
+  else
+    {
+      int32_t *fptr = buf->fptr;
+      int32_t *rptr = buf->rptr;
+      int32_t *end_ptr = buf->end_ptr;
+      /* F and R are unsigned int, not uint32_t, to avoid undefined
+         overflow behavior on platforms where INT_MAX == UINT32_MAX.  */
+      unsigned int f = get_int32 (fptr);
+      unsigned int r = get_int32 (rptr);
+      uint32_t val = f + r;
+      set_int32 (fptr, val);
+      /* Chucking least random bit.  */
+      *result = val >> 1;
+      ++fptr;
+      if (fptr >= end_ptr)
+        {
+          fptr = state;
+          ++rptr;
+        }
+      else
+        {
+          ++rptr;
+          if (rptr >= end_ptr)
+            rptr = state;
+        }
+      buf->fptr = fptr;
+      buf->rptr = rptr;
+    }
+  return 0;
+
+ fail:
+  __set_errno (EINVAL);
+  return -1;
+}
+
+weak_alias (__random_r, random_r)
deleted file mode 120000 (symlink)
index d4a134cb1b792559b76c75e0a66ea2cd53517b07..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/randomd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..df2edbf3f1fa4f56b6ae3c2ac04d984e92f38061
--- /dev/null
+/* Some random 'double' numbers used by gnulib tests.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "macros.h"
+
+/* Some numbers in the interval [0,1).  */
+
+const double randomd[1000] =
+{
+  /* Some not so random numbers at the beginning.  */
+  0.0,
+  /* Then some numbers generated by GNU clisp.  */
+  0.89255299921822260894833866359,
+  0.56160033401164667976788987953,
+  0.51743003502243816003616725706,
+  0.78419011286685927826225711525,
+  0.64400370685467819470063888148,
+  0.38151255107934048933308886009,
+  0.279822118770531878839000163945,
+  0.51983544681375980919751125922,
+  0.314601557551148376372971500376,
+  0.44551938964685651088492647794,
+  0.44235192503793823441729544512,
+  0.0040120762636767874958681841509,
+  0.57608572759464216512285032474,
+  0.69151953350396585566714564265,
+  0.65634190642598148152780718322,
+  0.68520459394253807590733184567,
+  0.60728078832107635628786818115,
+  0.376679934380311318950949959986,
+  0.48893422455419005003224231708,
+  0.59664228319132670346209747371,
+  0.70162191594290728927555900075,
+  0.70981089000005327192380201706,
+  0.480574069305863387682360414433,
+  0.369264627455974856929910550376,
+  0.42224495444170593700839286742,
+  0.96974027194201320964041066537,
+  0.69950081092902694549973698004,
+  0.366921803754944985368022837045,
+  0.19460757354611588216534077527,
+  0.046437559879825520495822908204,
+  0.57694149138457596563075731094,
+  0.49632733844850578203860859535,
+  0.80735347459453553970910033766,
+  0.210271595033975357161360058967,
+  0.176539870249396534142059724214,
+  0.75320267419158828905982021879,
+  0.09535042912249636739069790414,
+  0.41433965906065337672703334968,
+  0.62189345390648146852641556292,
+  0.322595610794052908153116342595,
+  0.173860860827838938281708881865,
+  0.55258425878412963601205794028,
+  0.066559056629606284504735241978,
+  0.0193835990781649263368095562556,
+  0.127101629778251450428653553143,
+  0.9603475517586241593077319367,
+  0.68429794014738591042302507235,
+  0.0139808909843634026741151214975,
+  0.0036035679428138856395527711611,
+  0.072656401341518399752950821809,
+  0.229562863635014486626281702425,
+  0.88337277579960676546469424767,
+  0.88850212167800818244030104263,
+  0.208063225990716089095767541316,
+  0.268304917462565269805874454916,
+  0.3195427196271617997151392088,
+  0.59101407246003811289573881403,
+  0.972093867752368095080492689,
+  0.409246208960242309650511849637,
+  0.84250639316418167849010246997,
+  0.063842712141624332977179722113,
+  0.96470327141354888687046060373,
+  0.43109879978424216966175314888,
+  0.14551248610248934836482236208,
+  0.84819094513299136408788493212,
+  0.41166757935215520377191731704,
+  0.96020915727830366672170130175,
+  0.55313106883839046701902022583,
+  0.9796595451013758579218900134,
+  0.74222694300533435700276764516,
+  0.117294243075539310976051880564,
+  0.32216824750097146958151447387,
+  0.59090211400137031908131441,
+  0.116841680533127258304897076543,
+  0.83595865401141052310417569507,
+  0.249488155772987988074361149176,
+  0.67896015287499211280971531326,
+  0.72256498621401843299673078876,
+  0.327315362968271601258667297595,
+  0.37438214921868498405279953481,
+  0.76929694812658272272027330778,
+  0.44282297788821568912463681727,
+  0.59517407740270913902014268964,
+  0.346217547960702024419571713567,
+  0.68339868731911838904373225224,
+  0.057507087039986776837238366719,
+  0.1189343986186977384509521024,
+  0.65646666532916174831489781194,
+  0.80925124288745606089697795707,
+  0.61302937875769552609444313984,
+  0.64367434863387777107222872563,
+  0.059228300879437554416166010005,
+  0.76899237494115809397158171526,
+  0.335797991302131791511629123206,
+  0.72923178692628392090326699514,
+  0.79300056654108221012876564405,
+  0.58866760551158502690719665335,
+  0.65249222174748700395779659047,
+  0.79573528799715877963614353006,
+  0.101363067664632247385474166088,
+  0.392494669960902131436398643207,
+  0.37323453200630776302168616197,
+  0.29857554596542776498065634631,
+  0.9796202149626312305197715787,
+  0.58770219934833805722677794788,
+  0.126574575737099431915356308504,
+  0.51086682994362911961448609847,
+  0.26221303911946316754295166201,
+  0.87331402410090670707406246035,
+  0.08604799064198292716037672196,
+  0.77880380648915901962140523059,
+  0.34131646312914811415381942246,
+  0.422787222735822749759714960156,
+  0.16550478231620269333824890372,
+  0.84087065799129220871741135711,
+  0.96561976597443996963329538915,
+  0.059890627133354026356081805998,
+  0.09359839900604706997291172522,
+  0.61463026659668017286248279853,
+  0.220582135665522265733252389516,
+  0.30146695094150797543070759948,
+  0.406591688270652513808216198946,
+  0.206959751707199812083987569348,
+  0.71382992952779021033600406503,
+  0.98971690700151825984363090029,
+  0.86339958328134745391858859595,
+  0.70037828363249257457230217791,
+  0.97380974339470107231135690474,
+  0.9184635965630883290893011311,
+  0.418605216026507942885819265225,
+  0.61793227858714759711625818653,
+  0.67394880797682685081908511723,
+  0.98871101941805039780826467279,
+  0.65973593853137069988371349845,
+  0.93348525072186907424189028727,
+  0.59164378220465485142298641014,
+  0.95303768733773138214124075961,
+  0.88667310242538944858141870801,
+  0.83785319781204861623008709825,
+  0.54026788227426708201242457367,
+  0.74842599257855801522259951132,
+  0.286624102305531463268442510375,
+  0.41180484980938874161376712508,
+  0.22754664620316922947541651384,
+  0.62360609793949755240041318939,
+  0.3311618194042077047850111557,
+  0.315407885695867020730009836503,
+  0.215221706711430951961780213436,
+  0.168600630933631406101821024413,
+  0.62661489373200405241464923618,
+  0.95357070304277219756741072036,
+  0.5186418766697788447635039428,
+  0.70772930521061953327927296944,
+  0.410376884797056150221504703145,
+  0.39705302343406249619577860633,
+  0.79215885822696034431481699125,
+  0.157831717946112504384603002152,
+  0.26892306298536012837855426922,
+  0.15697088614321016223211167568,
+  0.41395315712905823355235182393,
+  0.043977876945327860015049914653,
+  0.91453495544799358550673657283,
+  0.46230093259088633973148827911,
+  0.79479146768024434444120965094,
+  0.1466704986407674407377422815,
+  0.093614591443204076599999803382,
+  0.66061870961706149406527099303,
+  0.087462146328394574476138187113,
+  0.79683664444310818297700615557,
+  0.39732728185755441060070738751,
+  0.141934473990413594291362391075,
+  0.63111751995951919258061547632,
+  0.78521985432793823024330967029,
+  0.53307346282606806792796696141,
+  0.61679109370763781010143645189,
+  0.40696293619387120891515025426,
+  0.68670343879278712242412028794,
+  0.0115112936831136012901340526452,
+  0.70866056737692430987650236649,
+  0.75378980574358943122474800795,
+  0.17133202766710894969283150847,
+  0.36771201738922655520549864974,
+  0.64614182581953931840374311331,
+  0.354495602088990708111406368474,
+  0.96418771817934443444348833491,
+  0.51633426669933834634574104246,
+  0.064671329812306055349433587193,
+  0.084335079914541732137341401384,
+  0.98578018340150609333535890283,
+  0.32988119060114570391488875477,
+  0.70568290443337103364762141207,
+  0.7501960060851696034137148851,
+  0.141312840936106004164373056114,
+  0.60721022154106372815080238296,
+  0.49179275887283771965744826261,
+  0.85530668893284708999269819019,
+  0.09730053915339358769067661488,
+  0.48817911888023094845428570434,
+  0.37116312252354470380676793579,
+  0.61870369881699387959990992873,
+  0.381874188039839457469043174076,
+  0.68193837613090719561872304949,
+  0.4773618313988618747215621251,
+  0.152383599292709764750406667286,
+  0.54317522808228983459963725598,
+  0.363848788591302782268887022354,
+  0.0105589810271147011378412305973,
+  0.55582445068669939957392951111,
+  0.99910376130213936748996659383,
+  0.90286867348280161480903197439,
+  0.48268382934936288156485037692,
+  0.0976084557356802030533675394,
+  0.29004949962481398455881920169,
+  0.99169758897256717005011514856,
+  0.20722895154834288274430061308,
+  0.50294863638464584121275744208,
+  0.71094033855350495714847377558,
+  0.94078709219520224551350834268,
+  0.48088262771516317628650315489,
+  0.80538698628980761175811796611,
+  0.83495029615293903361580945571,
+  0.67996381940825251937974905761,
+  0.57936805772275234468590364926,
+  0.41778137764942046281708286844,
+  0.161602687591454506771276482303,
+  0.093910625156097743113739432334,
+  0.45716763620641108625606409874,
+  0.96455075374827233820027584808,
+  0.5179966880512917274934448216,
+  0.046797382046060065926143985952,
+  0.83673567319931334127111064225,
+  0.44224504444533247245974476514,
+  0.73281179385894336737033582786,
+  0.5642490153724193432309549673,
+  0.83700200507325250303481208805,
+  0.152714941779871552944298597052,
+  0.38606607994977770238226473985,
+  0.0155140917516105439042442246577,
+  0.51621537013393688713546096688,
+  0.311969390991657895966526156064,
+  0.83890647777450698803932943984,
+  0.54370750820133482930695388638,
+  0.98636765788772465929756760473,
+  0.77334255661128878905675504339,
+  0.57070354296508751519811368688,
+  0.8365252076669013372866223481,
+  0.344601601940890721182485798794,
+  0.92658930620470543221158939208,
+  0.72724523363899270076210273102,
+  0.413672082025645586061788451734,
+  0.5132836422023222169840403333,
+  0.82135610583961360173883281975,
+  0.423835065039748889417547786563,
+  0.87083598844595488941471761572,
+  0.59009392451459866513886634656,
+  0.206124826643305920436961792363,
+  0.288685540685143988030522421633,
+  0.7944357933456167153993184889,
+  0.090945230657758780394996530608,
+  0.52981750421369669363095418817,
+  0.091368944984485824360107751981,
+  0.81824925769562351657564377069,
+  0.083315412912658535228751011063,
+  0.59602276778799576464600065047,
+  0.52258035262146456789454411102,
+  0.394692074165738897132014378974,
+  0.92031214264405188928824363967,
+  0.32812665356161216265971156268,
+  0.79754299890007289545033977389,
+  0.3029021512227565310021437326,
+  0.81425785760698537744367921928,
+  0.85199399843570233736733560413,
+  0.096629890212080240754541391968,
+  0.60643798959967098211181910285,
+  0.75368518979236587723780129098,
+  0.451368813651510369666120626045,
+  0.86189868235067352904955566961,
+  0.239506411296874624231401913963,
+  0.143392266376287906568670938457,
+  0.035585084401323981008798496622,
+  0.89407531932950775763701297226,
+  0.56699767164913732414312190205,
+  0.6107715946195223295493238966,
+  0.980870588312723808697191463,
+  0.37603666613089681502774907483,
+  0.19565477083291620146833762404,
+  0.70326913680165706368122461762,
+  0.98247770640436619202690080984,
+  0.54911931698472764719220618506,
+  0.96749331150477343995263612791,
+  0.9349501605275792139661332597,
+  0.067704019779021886031495084945,
+  0.52883185005352261786874768842,
+  0.03879817199556086106868125058,
+  0.011268895714104342862021635882,
+  0.86781395233112768504418642287,
+  0.73610697666830606371057497872,
+  0.22595829849389174304359852447,
+  0.95990840938724981323147621815,
+  0.5938079875208820675776232526,
+  0.78655922365792476391655372464,
+  0.51099073264725007373467108776,
+  0.66474884887866769539664215292,
+  0.88640025828226102852258218854,
+  0.39889893489572927635368967129,
+  0.76340426725003756852384366924,
+  0.485534753598641026618647825146,
+  0.55957578573824837450384728978,
+  0.50840543283094885180866842941,
+  0.0102415845792896532313226969615,
+  0.74666891036262398733922051708,
+  0.49044748088989431070743849791,
+  0.184017043174756439606592004597,
+  0.0225210121470402648790231578307,
+  0.096909683465740960387467976065,
+  0.0521874432095560437920256545446,
+  0.108114343037383115951564617563,
+  0.77430486784405922952977031491,
+  0.73286432949907824441702845144,
+  0.083559249182272369453587951223,
+  0.074541345541671560054508020717,
+  0.55130541064331728019681677403,
+  0.101450912226971008587146654246,
+  0.74564503962660370005995595861,
+  0.55903832180264925580029280922,
+  0.86098138284846671753408133719,
+  0.76146956314354797691373262733,
+  0.5569854467166466965564479865,
+  0.61138555623626762560168304163,
+  0.93778268377974305185411499629,
+  0.106728342608615813606903105742,
+  0.51139895550624845300079248199,
+  0.8826404150665399364200384063,
+  0.79849755952621824621632991954,
+  0.60058338183244813128378689372,
+  0.57271235605091257806409062354,
+  0.134476676178095582804914204515,
+  0.62710051406343298533266304307,
+  0.21517566131268423511744492316,
+  0.87763268502269127056352092234,
+  0.259516013975152388767641295316,
+  0.54026961752737864438921779715,
+  0.0321012344232942464157113655476,
+  0.047765687217921465801489989111,
+  0.17851281529041807770891682623,
+  0.67864372391481596436180177405,
+  0.27188630999531652193578141334,
+  0.76570352378902765382129471855,
+  0.55727605717645959087760838806,
+  0.40035295538031700787360193533,
+  0.65772683660586524086245866733,
+  0.87515739410383285146563935658,
+  0.51637173718066431535845791928,
+  0.32843440805452173782945632394,
+  0.46789250836790673252530282969,
+  0.153916136058705475580104911632,
+  0.38115724589238346986896925035,
+  0.96911901452270741576104655076,
+  0.327510878721849788805057952285,
+  0.52921188196053063832762822112,
+  0.357891066893689952162669812174,
+  0.8109495999496825638917226258,
+  0.87378695338223548954000159812,
+  0.071735687760291841872657613394,
+  0.22099818521305441851106524174,
+  0.61319403424123059973018445501,
+  0.49185069904977836269777464774,
+  0.8465618819298531473261910176,
+  0.88263955123256235889766657732,
+  0.264605739218701311737446373095,
+  0.157257748694727606809000832224,
+  0.61172692557424578980817509135,
+  0.89224381101792427145783648267,
+  0.049436313890546252030141534714,
+  0.78472068655126867546237630366,
+  0.94890896727672958163705440614,
+  0.61244719025309458330037069759,
+  0.69652639673616920270100103049,
+  0.82306805868313923466426022855,
+  0.4619352653236511042512479492,
+  0.248913888569715263431474781448,
+  0.64972077945521993267494748532,
+  0.058989138867897862567374093665,
+  0.97969837050674699927934092348,
+  0.112860503606029382332397067852,
+  0.9148268966080465389473749031,
+  0.80522292073416096202056634334,
+  0.80810563925192214527344776336,
+  0.082994810842601316055993203972,
+  0.58154183958194788097113770541,
+  0.91401321304178026032151961143,
+  0.064162440925738934087179609749,
+  0.15233762499249088696399602351,
+  0.05051666992337641462246832006,
+  0.138526581114846840617440323377,
+  0.3330645447918149831766264793,
+  0.217487368997014213919568641696,
+  0.61893770768550649722673903221,
+  0.48128956859001312165262121487,
+  0.67074178502738313699688470847,
+  0.74389636308055141796746779725,
+  0.78623735396470085242463142878,
+  0.74044466560335570728816983391,
+  0.44977042205766449238521848558,
+  0.04936658918716696558210777333,
+  0.46898154881467544198433735515,
+  0.86577421926732888331279455256,
+  0.351697801257336354285066689416,
+  0.44607679846684358775746123434,
+  0.68542184287580537292736482205,
+  0.044146424753083577398366558491,
+  0.84496717026871403905274974765,
+  0.20398318496314438897842101827,
+  0.75107700174605698650069666924,
+  0.178571061661964354577482608798,
+  0.67178502534981979941629966218,
+  0.90847842600882488644789391115,
+  0.073076683947302775918335357377,
+  0.33981323802799502107773228774,
+  0.88205531070102240708858032672,
+  0.52395959911163033140017417074,
+  0.339537812421755656306362620887,
+  0.54102447887624739438002987695,
+  0.99615637434542139613844677579,
+  0.91178029521112995461052949527,
+  0.75825739605806537625994927603,
+  0.20376049709427102495755901889,
+  0.414724980644126108685694310425,
+  0.33340705339227162790042902392,
+  0.63442350111338002489027718102,
+  0.79083735924049231993808201264,
+  0.7022290803727963570326957922,
+  0.073051026670174816217706335151,
+  0.50842348505687696224462184336,
+  0.32363091931107924009593033016,
+  0.097074638787613630803324174721,
+  0.79231345620836950165162896374,
+  0.46134517653790366185204412042,
+  0.87767180094474465071641454817,
+  0.30504377737897498569142680272,
+  0.96430402804903305707372788262,
+  0.58722709934909516402891605024,
+  0.36287829330987989626587492725,
+  0.341369045118572012709880807167,
+  0.18622546427505557603629823709,
+  0.71794779555885705340742601105,
+  0.098775720656078510422828040021,
+  0.94170390436210924588938028149,
+  0.6256516749208606216856038288,
+  0.84990648194056707180867958453,
+  0.24897158268824763099382644974,
+  0.67126976686560821454618204853,
+  0.18287142221906188751198231263,
+  0.58301735289988287890086250316,
+  0.39451451502323596545833498888,
+  0.64778726863510310777659172018,
+  0.344060647976610102257104623935,
+  0.8543225374577925606075052273,
+  0.41721025737118350088955048104,
+  0.346301150923723212219486824146,
+  0.430145349151890094004681136873,
+  0.083653676599147505357408467754,
+  0.89927285917733406113015320169,
+  0.87717630249665962395834008139,
+  0.114609060439245285884826496387,
+  0.19079403943711412757743782207,
+  0.095752662525740063245815699042,
+  0.79249438764728213221559489213,
+  0.36889557473162465630046043798,
+  0.076691690566591062968137595944,
+  0.82502767429905549906741868154,
+  0.7665582347663079379259164121,
+  0.40329445688627141530172819257,
+  0.76025417855373928649612014969,
+  0.67742016809536470259225177395,
+  0.56458198627250149175789836481,
+  0.78923506303765674533158921804,
+  0.242546191857944356752822856477,
+  0.5429792204847717222270173404,
+  0.7269010821579782458839227112,
+  0.68884017933657182784660476876,
+  0.037868346502260087811459749823,
+  0.5900507745679403546108564628,
+  0.2867946536016681954708929644,
+  0.47061390957475445523849010039,
+  0.51289737877965767076806069599,
+  0.422963220866519099525024712084,
+  0.056516063514784913538055836342,
+  0.77559606292381102490968685122,
+  0.44812023547000818124896526252,
+  0.8496368064876247362896528731,
+  0.272242276648834925536741986616,
+  0.21366791927514210787832263868,
+  0.458126557153035507756298880855,
+  0.59095285049337797286946531198,
+  0.41387171106200290943847880691,
+  0.040527832792286543640976926214,
+  0.84749051864346812142321430329,
+  0.6591922374100337646083630177,
+  0.30504037894556796180304594549,
+  0.69588062596190762407598122745,
+  0.54615362946297678668402889519,
+  0.27179536774730804380125320985,
+  0.16312965572910266758089041195,
+  0.60443803311418335000528681396,
+  0.76221957063947757300487766314,
+  0.0012561481228798307955579245318,
+  0.38477311712200424042679172286,
+  0.86336953839931184684851388121,
+  0.85132017314817690655384788334,
+  0.79741410166633177181313320738,
+  0.81142674213295830272567127246,
+  0.90095974521916505411272740187,
+  0.461262866736651478343958282766,
+  0.163149749038393754125992055513,
+  0.079563568933303239293664877234,
+  0.0076308467066608702534098522771,
+  0.74020408989686798939059759005,
+  0.68004244363120265645245845544,
+  0.99423282025586676895879517721,
+  0.256512790150101579655974619204,
+  0.15841489307390214447222985222,
+  0.53156533193583516285295078457,
+  0.51195175518666885397864463638,
+  0.2688502522458221215136352473,
+  0.290743998007688539265414246556,
+  0.375642431327791011131765421904,
+  0.73366824563603699669790620984,
+  0.89031055476039433366324605036,
+  0.63269458446317741594059410575,
+  0.79677646360837164675956632,
+  0.91096051787867659208019728176,
+  0.056411022047894420770349313174,
+  0.7117937367428418076554349793,
+  0.494496454398059649677550547185,
+  0.9944698091905991687808626336,
+  0.195654008095567563746040882677,
+  0.33245249703376584453346565181,
+  0.91671965905832444523554539619,
+  0.104159073216349402499760928077,
+  0.78250381705179599027513221262,
+  0.82221952254403323129879405024,
+  0.25404653774104883427079980313,
+  0.89334850648967094099280368977,
+  0.2721479244387740074938025269,
+  0.58627710421889854554604323774,
+  0.80740872172002770008164688167,
+  0.295213737773499230779293451686,
+  0.366266263469556210902410635735,
+  0.72189449997560167388059780325,
+  0.91339160960295327548014703572,
+  0.27978723834100283634925494393,
+  0.44312275285067091147157546317,
+  0.88264479919648468925459438057,
+  0.74860386620420068665117140949,
+  0.97534502025842784289380076051,
+  0.183653687608870314454061893335,
+  0.14143760686328530307343938507,
+  0.7794390875763962068165432699,
+  0.79988123088296718350409621263,
+  0.91344402454829897860268279997,
+  0.3003753710559256572305330721,
+  0.92236868180619898327118824659,
+  0.85128995509445007265453349716,
+  0.51226586850988855988005111668,
+  0.59328586801467434659081264762,
+  0.131543061349700789237108200816,
+  0.97962864281984756641024957818,
+  0.80003961712390827564285728721,
+  0.07332191035039234849987853587,
+  0.33710892945255754021249327366,
+  0.237798240512212115424045579506,
+  0.050628096786899757905464602857,
+  0.36368141580193860149061967396,
+  0.074547282281222729072803274018,
+  0.32013351651022219595136046535,
+  0.50087363542319392259892635316,
+  0.95534128322832584718763016378,
+  0.63089810554419660091974256912,
+  0.45937043591639452731937380837,
+  0.77794827072126710252068287081,
+  0.5833967217973934570703322242,
+  0.89948711130168823436943591707,
+  0.88448792344727137087709578749,
+  0.75774410588649351850782212564,
+  0.51545850808454807305763364038,
+  0.89535564141616759448334976604,
+  0.433876155086630438489414332084,
+  0.263145194001722566517185175524,
+  0.094513715303174637696079970882,
+  0.0067905149976316075236601623182,
+  0.3746548325271489972742277758,
+  0.81418012245523025207375976459,
+  0.7382555515800124086679648947,
+  0.71505454385778976492869269043,
+  0.7698698840252614242858413632,
+  0.53096667868591647121855295207,
+  0.5913146508318579789498085478,
+  0.82865413011200335887487636747,
+  0.246477924915753655378269255135,
+  0.7718625116939460952174295485,
+  0.33088224685104582360581424038,
+  0.077396220323469426942810035952,
+  0.399851739373243384531661374094,
+  0.74828949567652386217126904324,
+  0.55533476993642340021791702209,
+  0.475356366587838670689554086714,
+  0.99199926249299355831492581518,
+  0.60739053074816626181185925167,
+  0.94570422855790142383862352906,
+  0.67410117583869264525962136333,
+  0.99340016295179621471645098914,
+  0.30521664837678549625426072163,
+  0.82786899862234431119578444516,
+  0.0246054418785779831964997687095,
+  0.33057040500642957115284791089,
+  0.325865542252271051046671982904,
+  0.116469964535698881624567000313,
+  0.38792519202192930208550481713,
+  0.147033252049062199325747990948,
+  0.333360890210745561370686771174,
+  0.267717098935309378552279527125,
+  0.473606191830554736751491306975,
+  0.69379726024488030302072707274,
+  0.39866105325920152799379542147,
+  0.075996151521605600512218326895,
+  0.43692155239290098173990417979,
+  0.63183509185797834489905365016,
+  0.327726835190132824885685947736,
+  0.82769389015654780671213364517,
+  0.38036542617183448008870457384,
+  0.06416363778906221378580326597,
+  0.95989693996326393340364540321,
+  0.77473792948077472252492320019,
+  0.73353080354752465520384745159,
+  0.79531316211939777703706647305,
+  0.31887745411495362933791547194,
+  0.5504233366621661345254817397,
+  0.133841546560512334978343647306,
+  0.93323316393590598213508657757,
+  0.219534116905903225236593922786,
+  0.352227557302752346568799070044,
+  0.50699048681296139093781410327,
+  0.56063256677949754339755086295,
+  0.97859418495668224120337606178,
+  0.43217748779939454097021337034,
+  0.6118800794139137562939270606,
+  0.8826339041571606455078384688,
+  0.190654349423411314990846249777,
+  0.0272323818569649486990095499454,
+  0.13501820915175992368033644254,
+  0.34430252524220055863712676536,
+  0.135013324503164182485257894453,
+  0.83301344777287732687815180326,
+  0.71146270180847724757833953093,
+  0.059584725284656364940760846576,
+  0.124388342467555907606115942139,
+  0.86760011350010388002288781466,
+  0.43443235444248399222879725088,
+  0.62257025564267773540408523682,
+  0.42224480338939459869117553607,
+  0.122203729563367693705179104655,
+  0.86763329805228175173701751082,
+  0.61852711996472568821866689006,
+  0.9981036801779161471700405786,
+  0.177126618334123901292041594724,
+  0.37033568941002233661950847289,
+  0.81720705981865203019383851894,
+  0.194752883553301253160228353622,
+  0.5399475493930702257701115294,
+  0.21555050095259535717046390477,
+  0.031480898918419061738395489394,
+  0.0108626235742996694506893658131,
+  0.29439861659506237876675916168,
+  0.25969803792963051605662393213,
+  0.64305111681301349941082616522,
+  0.398301763391130971280749586885,
+  0.82959279528518208376169366062,
+  0.494452121232255582677051524076,
+  0.032046850110252624668328949032,
+  0.304808216164121089322038632124,
+  0.43743086801077933536332835933,
+  0.067635143022119684849606244687,
+  0.062601171413915686472972559687,
+  0.80704249768256597155262089974,
+  0.049090587901867220876053770281,
+  0.14290280489067737067786839775,
+  0.85153414385190808252068833198,
+  0.052035578866778404379096518691,
+  0.84803461110488710482683367176,
+  0.323391780352303842858779454674,
+  0.52713499343541339922976296515,
+  0.91034109375479019837692785976,
+  0.106146556890642346491650008212,
+  0.291532189474064930184344798145,
+  0.330494959183718721493342551525,
+  0.6236537208920888603043773443,
+  0.89122121355780761549659392994,
+  0.51799810738861013193016943087,
+  0.249256177739037963581221438965,
+  0.76322106809612787470242640888,
+  0.97852511972383831461233976406,
+  0.52255677693690499607690355455,
+  0.4450034860583097087122794844,
+  0.79114162250324775713725095404,
+  0.94756217345536380876998110362,
+  0.58677918818329126036021764787,
+  0.84845252924877884299669190981,
+  0.30081720041370757827674016113,
+  0.27920525653128846538023076229,
+  0.33471466998109052439193176801,
+  0.77432114969973711331784009482,
+  0.79975078898170550460312445454,
+  0.90029380309155505829673878957,
+  0.22735855793472972935624370264,
+  0.83917898101167717908999667914,
+  0.96001063929762371813642857618,
+  0.80557845129235602137075744771,
+  0.227828260252387705994553631692,
+  0.45514459312672738783331856798,
+  0.6996049090759249573037751274,
+  0.76407211467383802388153449844,
+  0.35750763601712374361686514082,
+  0.090157662209549066428683554241,
+  0.95043897530001474792481472865,
+  0.97262166470012788338731033975,
+  0.203045895422423613196589718133,
+  0.217437635156560627036179586425,
+  0.5222956932204809424910993278,
+  0.52865060708104384493756729767,
+  0.97715373213739469800445297208,
+  0.5740174414400501666597490431,
+  0.172348314420047937640907870932,
+  0.57197038071649167881433868039,
+  0.26289948915209002196358225729,
+  0.177903112174726341611524884074,
+  0.74917239660013094610681443816,
+  0.59837085384984040836442442706,
+  0.065070324689375259831989322427,
+  0.44807493892928848916566949155,
+  0.59027783360778386064107723777,
+  0.122058971772529617939528531479,
+  0.18965096763129552013799044806,
+  0.179455202785822708296801760066,
+  0.032170979041981235014758366854,
+  0.297222966386620738492021519056,
+  0.91323423393143490893801153646,
+  0.75998869946268189685327906564,
+  0.83934073246383862944110864099,
+  0.17898779712956184324621175982,
+  0.480986398855505957279379560397,
+  0.60860751560721289727164165043,
+  0.298927282590269088379100218673,
+  0.77935020447343759584143119835,
+  0.480545242963934573648858250607,
+  0.85619790637736236353631524289,
+  0.96488893882602300700764346564,
+  0.36351865634843046736230405883,
+  0.82895257550724293657223335349,
+  0.79749691055514662573933190753,
+  0.20106705267868388883102752272,
+  0.33623918491977977623116871123,
+  0.93256466340279772952587363977,
+  0.88648669501682764515636262464,
+  0.47662235152771500250187825963,
+  0.52659238455883068245922982067,
+  0.94111676559395948458425469814,
+  0.323317713690175795284098362026,
+  0.34796405933091263994264450729,
+  0.52445433363119391822452105405,
+  0.525140277317638922334264421,
+  0.64469482443585357444532895759,
+  0.33472685924872903603447879104,
+  0.42400458791646499703641118014,
+  0.8222662798441265944554029489,
+  0.75524567154228028735673060411,
+  0.90790601849806560799894333131,
+  0.75164241313793249434488428193,
+  0.38724602290468111557712203885,
+  0.36352513950081020449187506395,
+  0.078398790907179055722325452963,
+  0.5003676822199407758422514133,
+  0.86055044548361328714384972985,
+  0.66748567445598821900669819042,
+  0.95450644393912187127659765969,
+  0.9536501355878008523425355652,
+  0.56207573012593503802043957099,
+  0.99057795680550440527031916411,
+  0.056136908924222021770088579728,
+  0.89322960593560085272815946927,
+  0.19380351076299398770342941398,
+  0.036881975481577328074706357897,
+  0.38834900979665334617449710449,
+  0.77196507761008668275581490587,
+  0.87539115393397618421355963533,
+  0.9131721846286054396553858461,
+  0.62245648254908013430163665866,
+  0.56021174819199355559539089633,
+  0.86987294559046384230921358438,
+  0.474584307464076041054198211805,
+  0.37224942408757353492416873571,
+  0.198307276357215222087716993615,
+  0.81633548414328354008913860616,
+  0.071192681637945014051745371309,
+  0.227203421058334439883665388655,
+  0.50527083273847576806586104904,
+  0.25911353175247232791676189983,
+  0.103567996992606824957067451526,
+  0.98316826751311017109085781757,
+  0.99206610065531611133123425907,
+  0.63838444880264351660305680771,
+  0.90013304139719692321619239255,
+  0.541419881593941428911392944,
+  0.434681681520065487913409442927,
+  0.0277935905905462584654818408167,
+  0.28736085880215502013374946299,
+  0.204706679291990486471085620508,
+  0.29639415300325412139805373353,
+  0.316818074164048785111401123944,
+  0.58068268044073033182148412246,
+  0.137736206950094621238996907006,
+  0.80907996549523150166492783923,
+  0.73799561611209772635015717353,
+  0.84013433924397440368969968592,
+  0.46126521311414726401422152854,
+  0.78013716447507497359555980298,
+  0.83405708922951231042933175851,
+  0.6366367969739079258896472192,
+  0.77353748358406402598000037557,
+  0.17489624725635947111471117775,
+  0.80267952648428412026314875447,
+  0.80437106861315296029137160672,
+  0.62834462177566783487584779777,
+  0.31539602345858033626133832055,
+  0.50541890853061839219557074283,
+  0.0195874476781850222509795360627,
+  0.011676447193909007242643314705,
+  0.85675479754070644130150816794,
+  0.09391269154749661204040398199,
+  0.369625667102334643216258483376,
+  0.84311577046357953313746551837,
+  0.66438426715728382263582851036,
+  0.70530906415261448155650458603,
+  0.446783684004800041373395690117,
+  0.75627790284213576819810990131,
+  0.57190285913753158265774292274,
+  0.97785681370875218892539297465,
+  0.0244503386494348881614690746194,
+  0.48528430854909558202793141933,
+  0.89436155397807056672243211894,
+  0.40757489194485346255194449191,
+  0.91772837786834838909335779229,
+  0.28020326531649972709359017096,
+  0.28847822326776188982020803144,
+  0.93193769743225684077624356649,
+  0.58336147304815741644785105161,
+  0.4004241800179331174134885947,
+  0.265790823692672203607418801725,
+  0.4137092141145146388568879939,
+  0.0255090449126572366852573357318,
+  0.47601725598948555645487446626,
+  0.69141516452580797436419291497,
+  0.187709862166242786826507443003,
+  0.31177816288567708916778389045,
+  0.79635247302484103596788484137,
+  0.14648403361265752358955335086,
+  0.0088027047060531475573345163528,
+  0.90053967411241805345616039474,
+  0.373822238382428585287035417224,
+  0.94303097002109978273901800507,
+  0.037263906643698883423150604649,
+  0.98416823398276433881119247311,
+  0.257766562836474661728601317803,
+  0.09336855716941364387765222813,
+  0.057604551843195630210060755775,
+  0.37732024813036636644231432449,
+  0.437099108019093398068604946814,
+  0.0298274889889844501626534131975,
+  0.54161045457572229928359302347,
+  0.354192069739745951755754451894,
+  0.9952629304832433588789284291,
+  0.61362350596285189174752077338,
+  0.23176197923774029736185020682,
+  0.259000332877923815426717028414,
+  0.77171708810079063604185854121,
+  0.87278431247491539306511051532,
+  0.386310463821549823085972724515,
+  0.19043920209178263945663905422,
+  0.77200547833114724875436606573,
+  0.2683024354984293205497398925,
+  0.144270112550972640008446091075,
+  0.36996280314557984925474224612,
+  0.163548224543250866742712583905,
+  0.54541238293503241055380526708,
+  0.54270760938500008382580072956,
+  0.7374073253240524865446763851,
+  0.93470960326436177572863031654,
+  0.71417607213823278615975270201,
+  0.65837463356664939532769528292,
+  0.433323451649582925271830911365,
+  0.79664580661766246494864588315,
+  0.392079017934601610514677836005,
+  0.212454387416532999103471570235,
+  0.198678082418012501322802116335,
+  0.61525672800559338657275986197,
+  0.99339589895181138684928419014,
+  0.53563057949945927383392076793,
+  0.68817192513245948798192690082,
+  0.59671938169380086666866042956,
+  0.5686075254645125832635026196,
+  0.25860953535454698758704936914,
+  0.60779864941995215785819783969,
+  0.46515241662568547274625942204,
+  0.8756966078479474164213834749,
+  0.89153160343113076353740745469,
+  0.57055911159151577684982200009,
+  0.39366246576557783924065683256,
+  0.53789676931469921495851209609,
+  0.95842028586447684249630374944,
+  0.25218284880717367924827402845,
+  0.23718965807272971860203662735,
+  0.334222632819004380754702693406,
+  0.6370849366068287810411454729,
+  0.722665796162802454203702773,
+  0.50216248905279887048328225791,
+  0.34529823309520970630714708672,
+  0.45098892404492692601908443802,
+  0.64640019115293913591196874603,
+  0.137077316379736192931987264458,
+  0.29368115076039970149731521521,
+  0.20091822953913855557804069085,
+  0.066267083813833718511605782276,
+  0.88094596104423280074202839474,
+  0.071730322265966936504743175424,
+  0.69735904142296779896396736035,
+  0.91352594564083795862432502567,
+  0.13244220377041278512040316988,
+  0.6283911312781029516331064494,
+  0.34896540167805105781090114462,
+  0.6795367801751911186206756471,
+  0.74898526486791573083377925403,
+  0.71700182398199203349731046015,
+  0.121142833366516620257163901501,
+  0.32678002036857151533698078636,
+  0.327511655875027224450064555456,
+  0.0079152053645354575349489795814,
+  0.84748954479623021059675156738,
+  0.75041561033954009809301550159,
+  0.41101693712463238996746228193,
+  0.90155864029338267639417046915,
+  0.35464670537047753945618208157,
+  0.68848712573944472430623590326,
+  0.08893193373618063124738179594,
+  0.58932830480784385636485098641,
+  0.0501618828375381577588978271165,
+  0.9451968329901169788400753848,
+  0.074994725566097580721185016702,
+  0.191860088196691871607965261685,
+  0.67853841063536805868885844477,
+  0.179445375284033906887325905976,
+  0.84157620913886056000430779083,
+  0.7377942162322144186341324232,
+  0.231126715579023126062082806996,
+  0.127662509645324778320005407937,
+  0.63062414859560283674777403205,
+  0.55283326072907470543330204975,
+  0.81243486031688046850257374808,
+  0.299095175225750536694802628506,
+  0.34284433830834748530634854762,
+  0.92098838107935607957057329632,
+  0.6334432153537539286206936299,
+  0.49203336326915182548719200464,
+  0.70089872986754081776092540042,
+  0.410346112246289262244008861334,
+  0.689375704219352519232614571,
+  0.53543492718830214408075484368,
+  0.78985504761729292283075540625,
+  0.66802245726332267870092702429,
+  0.75600588548341120124374250114,
+  0.83217485519464083512235296359,
+  0.77758150309412736979136465746,
+  0.067382141804836913185384124002,
+  0.7289836962356747770023887674,
+  0.453434776313686590560640460504,
+  0.3160796148757468204057886796,
+  0.0098933475787107681104048511314,
+  0.3620064234142809735084479026,
+  0.85993179373877360456391909506,
+  0.90684883450763884954227285187,
+  0.75959171037325548903969803948,
+  0.91219881792279148536349496306,
+  0.97175430264940118917041244436,
+  0.292364544897748356834218017667,
+  0.126096590956329503351026499397,
+  0.058210669685805595156500555938,
+  0.207143479048534791976348255132,
+  0.202837039257860939456824357966,
+  0.459137240079351948795601640776,
+  0.65480905235794807223708347609
+};
deleted file mode 120000 (symlink)
index 835c8b5de7ee84b4676a2b55128d28e6a8d9e2a1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/randoml.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7a52f8a2ca058e5bfd4a24b87b9b4d789c8e0a6e
--- /dev/null
+/* Some random 'long double' numbers used by gnulib tests.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "macros.h"
+
+/* Some numbers in the interval [0,1).  */
+
+const long double randoml[1000] =
+{
+  /* Some not so random numbers at the beginning.  */
+  0.0L,
+  /* Then some numbers generated by GNU clisp.  */
+  0.709874756135422554674614242046304686448L,
+  0.486497838502717923110029188864352615388L,
+  0.474019570990182753146861083750226106848L,
+  0.998821069612940336401792152067298257397L,
+  0.68230324395444341476284133813649237509L,
+  0.0812383212795450007980350531141537177532L,
+  0.43131112016001535977175708439191217567L,
+  0.1596337172541222285215378906083607753005L,
+  0.0447361192177328171952931546845870270203L,
+  0.669148550486018286115665314826153614017L,
+  0.398752708644620313955955676251505325896L,
+  0.600019492390024166744893736290881101244L,
+  0.78337397012688890834008412364808365851L,
+  0.747414410152603863408503379239564644402L,
+  0.550615721371501982864462175362996180322L,
+  0.0073983673767251687422683917248311760491L,
+  0.693846360902780799478892082407382699085L,
+  0.751592057901191172906159475240427353057L,
+  0.74000578784995401707243054106755282117L,
+  0.847264623235961908747497547605068838836L,
+  0.917431426585209425652777605148791919017L,
+  0.267532476015101748449269162884835638528L,
+  0.486834088208986505203048715784492259319L,
+  0.4580154564181484580770749178538567666L,
+  0.391521076582874764982597286237947922907L,
+  0.69173131929214083677828129436922728366L,
+  0.995268639187054867212755710743514657877L,
+  0.553189251912843822062196619876802699895L,
+  0.632300552505301947698796653386744186037L,
+  0.445572801006840927064646197943103543344L,
+  0.993634311396905276414701816228609517838L,
+  0.611582274481091436495638926486363711255L,
+  0.017611091105275929341544154464243038417L,
+  0.598936378040443270534796418637146416803L,
+  0.939730325871014729497001074244817030738L,
+  0.385712528561693907444911228190200940125L,
+  0.48796444333495738271693214259711532603L,
+  0.508634972895891442259656591497940133962L,
+  0.88453398179301716552318999435310293852L,
+  0.509099535482633468613040057130206639612L,
+  0.333677997666677081186230843198919594355L,
+  0.82715349353996770180499230535973424237L,
+  0.0372593663309767971914036990047894757662L,
+  0.932828780275931267421133064996449298348L,
+  0.486099261359133830842098860485004683725L,
+  0.987156392631551825781809767746170502002L,
+  0.824739790678073493124786291053674093535L,
+  0.671869573118280976952523743592826377585L,
+  0.48088844444394888967684860088619551899L,
+  0.017233021606613044454327510797750273989L,
+  0.988102711714879869326666071903065279145L,
+  0.091615081537455465573860363408517029583L,
+  0.0113278995312253231106729997476313183323L,
+  0.294349528513080028346115860151112891433L,
+  0.0097058790914280197566968241982258935964L,
+  0.715113281550035710673074854712220192465L,
+  0.739627170474553083453358265804562580162L,
+  0.588476045636558489860462119645353521893L,
+  0.91330346819098343970944232526748274664L,
+  0.281457572112513183673653575304242456425L,
+  0.784192391468991402261628322552430383283L,
+  0.504857923842698553133786835061714061812L,
+  0.230410937725986177704701374433825197397L,
+  0.535805811877939822805608704986961969659L,
+  0.0508287955596506952822240797812703550548L,
+  0.179399756999629053194209501169297540332L,
+  0.675837373242984020977236431747771655704L,
+  0.981496523455084073391380532008173135055L,
+  0.325845075647804753424852268729037997407L,
+  0.832630951427200447589084239299500129776L,
+  0.825354056334755646582091209610369762364L,
+  0.574731012869980895104127749738122205757L,
+  0.799028354294603017571131513193291020045L,
+  0.537721586879667191016369071169775496218L,
+  0.83846801885738807298552515294277869191L,
+  0.0922901597877978587435698953162723703674L,
+  0.434458505758559675954739433438496373717L,
+  0.308017320632506922735963882703835222897L,
+  0.0192693232310748837390370764187488626234L,
+  0.65275462537999797862908920689650691667L,
+  0.357130585286320841741290333260811815153L,
+  0.359562085720204868627653630044659240449L,
+  0.758320826841831017712067337815543048118L,
+  0.62169722559489484088614873429559348682L,
+  0.17335411409874538731529771306978631118L,
+  0.154077331752487118534287271363344964006L,
+  0.148559174998934930922746358844164455867L,
+  0.881316225913391098839630896554038163768L,
+  0.89289796752480477623907740261818685845L,
+  0.57786655574695620371527391411424563834L,
+  0.318175774295281868509200498351278930862L,
+  0.194978302204782205514236430086515458283L,
+  0.87084962252516402992532937666368998137L,
+  0.362113882465068209502300826516448793743L,
+  0.273446496762640462316848141032810658473L,
+  0.1471399192242189033406154289397228481905L,
+  0.937157507052090331728212622934524925056L,
+  0.600045430164287985733450402316667890373L,
+  0.794478865621258499047814379367829521507L,
+  0.889115878933706260333129391997704491913L,
+  0.631825206206982866021784416451887594472L,
+  0.966422225095067311240936396545408962515L,
+  0.676845470105427028205320649846678927664L,
+  0.671163783319728784750606328490914935783L,
+  0.213726274743505026386536996423761328083L,
+  0.99483340496284948345969144891145513965L,
+  0.362072360280863974302182899205431874295L,
+  0.89135316959373017710710890812308229361L,
+  0.861008403776277958081202417380537907424L,
+  0.518258469677886348298849030872657409393L,
+  0.74995117457421590827489329835282465567L,
+  0.141688060236646135992059548400562463963L,
+  0.231055693687838328234866575264314255906L,
+  0.128367320195147852998795956530756587271L,
+  0.735643745226188370911313880883935933086L,
+  0.481951681233521227023903083881246017963L,
+  0.29797778097740396719094352844253033076L,
+  0.259026843185033526978277511857498182853L,
+  0.76454793636766387350530239448634042225L,
+  0.921742101320371872828332060575170679558L,
+  0.135594574885855893452962438848740230435L,
+  0.249482789438500604376469100084029356821L,
+  0.447893460512394580798054060401740249162L,
+  0.841167533365717681130523968098862274883L,
+  0.063885342343669943206116658917625959392L,
+  0.49268569222220133343083683720155184169L,
+  0.0320364278163828327673837310979596079469L,
+  0.83067006037141488187036282222404336846L,
+  0.32687090604018629599351990634445890267L,
+  0.524229581985562678867475657633756672726L,
+  0.26442137331545990230136529620604338964L,
+  0.1804465247704923307363156457827584866855L,
+  0.219897692414720290686302976466475627349L,
+  0.657372240957848561373923532613997515665L,
+  0.94917951707325275578037456019158874452L,
+  0.999935336870950506894538846120127792282L,
+  0.334292387732229479489367107895450895382L,
+  0.519605753222230586160238890634421180626L,
+  0.2353320030331258205431171147281090084686L,
+  0.697837952881171466097464830413620278996L,
+  0.337355949172173312279209733133367570558L,
+  0.59624609578396787690174902306338541087L,
+  0.430566868363073838098964774826687118822L,
+  0.303143768470597821848720008902412356097L,
+  0.45566572082779255052299434804712613961L,
+  0.63651052470632278377988990008643926753L,
+  0.88355849548999550762491205909993278845L,
+  0.857627182143034336666679544569747793963L,
+  0.579654405386150422035981447661995358225L,
+  0.527551502180559045145630115424486189773L,
+  0.227798290812497436015108334865799792168L,
+  0.860285575656798735433746383563482660567L,
+  0.657434642899561800145850990323893418457L,
+  0.991915916857419346367596676050775541352L,
+  0.0299053482258395117883768309912517801074L,
+  0.494186962160200346319995839440170254278L,
+  0.795837941248740362154274095100822390282L,
+  0.213898349709271555518444444268604992712L,
+  0.635385838537788174234352352696939407706L,
+  0.1161960540496013767418067989853615145483L,
+  0.236636716576793997613161803474856412323L,
+  0.250257128320679509772248555959408855321L,
+  0.754809883956726591031066199439807350575L,
+  0.240047496212680591313028855365466345707L,
+  0.125918185384015376472834932789271923263L,
+  0.830761928512260978768305988740912711273L,
+  0.0833746595456954680423678981938324373477L,
+  0.993235018876045312632920249583820095078L,
+  0.74457886551486005017424251252790500917L,
+  0.904041666312003998553971236017433817041L,
+  0.99682247674917724207607173416904094376L,
+  0.778185258630194559195184600522592063632L,
+  0.617908428541966249479693433082678846704L,
+  0.034201434638706652764862810175677292771L,
+  0.1166825963578175046863759835887066398776L,
+  0.618184997077951045734597662867931774914L,
+  0.67223166229200793562043589747700629457L,
+  0.50367723015643325152991864733820551338L,
+  0.287805524504497224349445840278160308547L,
+  0.418530565562949537953621246456529701546L,
+  0.356577284504836083965140033686046682705L,
+  0.727797226876543100474285620953868682292L,
+  0.261158535215243995918166290296126543963L,
+  0.1233681715943113445590872776925938156L,
+  0.397342365090131218507373938120760734013L,
+  0.33651833905580176460704582099080050591L,
+  0.124851176251609572087737060478799388707L,
+  0.49869389018540295598691678028277690211L,
+  0.603921102513219725593707198424421456834L,
+  0.0288068305492076274901316515486696644854L,
+  0.27635950491121559708402485015430409745L,
+  0.0219820746750707161670181537628175322048L,
+  0.893266704905772978187424688068554761406L,
+  0.055131714446612192984065196401480701447L,
+  0.478917803887421452005543212818108274705L,
+  0.1089109338581245135310441557812062287244L,
+  0.451355129465699006367714322379179082201L,
+  0.933539696310061306235683130737189659555L,
+  0.295046527696521751967458467625754033345L,
+  0.657654030109877699469191835246373699585L,
+  0.699519422709288537538980841108763784234L,
+  0.754780411476609088293217972311402262028L,
+  0.940185229424181440596885768821586612845L,
+  0.641206442188302531301220212171259413504L,
+  0.483623421775598486212538785028426545698L,
+  0.1819507033406890598006456890391145571876L,
+  0.3493992184159313422014002142021878866L,
+  0.2282143482135155999703670773974654680736L,
+  0.65404355620292102948676570623901452325L,
+  0.000126697620991797753719907018394969483701L,
+  0.000128697615694221449450257101713351917085L,
+  0.66277677565136622936757573048183355679L,
+  0.954427508631091518542647272554320259L,
+  0.821452416615550557725422642536361482673L,
+  0.783949133156224682132225528942727293192L,
+  0.883688268329322182794294084718215227776L,
+  0.887198477924019626901140168907684736036L,
+  0.301153686936585019868640358522761168745L,
+  0.97031160152938862140377079439908121466L,
+  0.613591225576913510391808189718881180802L,
+  0.973773801885628446394837963774216539007L,
+  0.969946092528631153860793542995840284225L,
+  0.0552318705490405481104532089875456066346L,
+  0.398506652226642658353465649824893657953L,
+  0.577466681084525459648007205600389579233L,
+  0.538305717497527581210294472297571817608L,
+  0.0378969572225333661087665511893845011475L,
+  0.82821208446292402852221418490682507414L,
+  0.207039760611344134455359310666092356869L,
+  0.278071434395492049592363658721835175976L,
+  0.418157919791356829061560807874478279737L,
+  0.917935426878916775097393966246600470752L,
+  0.968879316988430839484738642933327229065L,
+  0.836847484003257581736597938908686488306L,
+  0.95787762740618523171012745852536482523L,
+  0.381833463284092269744674988738521423563L,
+  0.585758801118634412354899474049588357203L,
+  0.590675098878457580254555486356030743515L,
+  0.999102261786447498899644398829003134788L,
+  0.278723779765613710807952395929736248799L,
+  0.150160483677965826860533794972733497469L,
+  0.39044191915595120943090707935299688844L,
+  0.882025297705744570797306391637391855587L,
+  0.26053886056730883704893455389142056588L,
+  0.530123960707389279621444598593626923328L,
+  0.307497951588709795568291546230129131789L,
+  0.755712717002473210112772528495042985208L,
+  0.403971099596680128749039001982260210321L,
+  0.0955902605698226580325595772471302440213L,
+  0.733946822526846681865131682504158670327L,
+  0.824558199580936798107294631591949429405L,
+  0.355777480091076251706346214380424670616L,
+  0.183210308747040172107746729630689571628L,
+  0.943081072447366944673610412439697363267L,
+  0.823437046917209496498923793615721213912L,
+  0.272212671889142468847791216625072718846L,
+  0.467586497114075237282436742306271250655L,
+  0.965430243779957305809196327799423550657L,
+  0.264527585376739963287684763043832918263L,
+  0.78305929918791974277407705060017330726L,
+  0.1569161089271269079867408493909342109635L,
+  0.385890512318945048667111881493883277209L,
+  0.748768801714747310036929893375463390286L,
+  0.9607241213632062657075501565333113635L,
+  0.681005349771442926258254424282975745535L,
+  0.417404611754855157969846623218352380733L,
+  0.384922954690351156114438668003273806442L,
+  0.0248688875333777009659560293287195312336L,
+  0.289622732329138351547499030028075517487L,
+  0.356660798938142089830284922931103513564L,
+  0.1092119220339924538904809107210351902013L,
+  0.263044604533896828574983495057823392153L,
+  0.72916056882229781356884933113775509031L,
+  0.277279616044198734111166028359400949283L,
+  0.448496025651349045553194567962243478962L,
+  0.397797975606664545700620422788810306397L,
+  0.915573317477921170464219734057440942223L,
+  0.565957191780698852582910000301549192135L,
+  0.0199640867363067059474765492007910956547L,
+  0.380718754942963039702539139065633248878L,
+  0.271561535356661429325107452975658450244L,
+  0.65703383768996023094650337496290243735L,
+  0.810303462640169412310932301780031244584L,
+  0.34389677270659068303923976829417662132L,
+  0.1459701849396526086771469906702178205394L,
+  0.0709566883230581731990192048699199874356L,
+  0.0273188133279639766234319338307950998466L,
+  0.189257375093862859152281617127963424911L,
+  0.483370049027267515091110020077746913052L,
+  0.6121051307445822901845022667347352688L,
+  0.0669683489197768142011855877890933175548L,
+  0.0462440353376468071116256899031962430102L,
+  0.66179099750239749196171922709429044667L,
+  0.331447780875915347204488922360787127231L,
+  0.88878630766137716878808504113561041651L,
+  0.57831688009568937419273238575083437733L,
+  0.1665758643537997337473156606765968668944L,
+  0.609499751553850514507525575752744468325L,
+  0.842660412678850878529299409778020570114L,
+  0.868735885617006579468607975714721515953L,
+  0.518323673739076029376626898444587264186L,
+  0.465048961779768578307935679739067346325L,
+  0.739933063031511059934522150792493137138L,
+  0.366097491036976922528977805725731033037L,
+  0.622890978255856721366594654155975719428L,
+  0.945120241233001881267096151974150875442L,
+  0.711795000549305806399598132955701848342L,
+  0.120093380051693652573317820347038096902L,
+  0.461420048084338423641881546847056927696L,
+  0.201645977777376722385295339631509175754L,
+  0.1479402104137110360277226090924965371445L,
+  0.287960179369955828242600303166176042591L,
+  0.788362667534075941033937374958276358103L,
+  0.610312055398887641020833805884097007991L,
+  0.758450801974187424825814780682156814865L,
+  0.64208882693968320907867911523798381855L,
+  0.255468285690834138126389042932304445888L,
+  0.0370478385689831649949675007793815537737L,
+  0.551880617631056560992613768623601574096L,
+  0.559262357532227558112085482526038868046L,
+  0.129705275018847798920129782613409588523L,
+  0.1076289463968801831500602693982998566697L,
+  0.272506325706516323678193293634687081578L,
+  0.721990855538151706841764025895777805643L,
+  0.523084042169573467351077180119310086396L,
+  0.0858615712848179826840482241961243288956L,
+  0.589714739430299853251893655400362103563L,
+  0.512412326166823937685402214713910254025L,
+  0.802350747297003067442509635888112412853L,
+  0.715817091619681167941132068164905209087L,
+  0.0824951218034037355816988555328185436778L,
+  0.829228234554153070848595829448989414728L,
+  0.59652037694553054648270061009002150308L,
+  0.133585725647906582691822880117773950377L,
+  0.812005216254498654412124509257882599085L,
+  0.808142463854396488512203093936737654517L,
+  0.570217922503074432494487309472855783614L,
+  0.704017977813333280013384719294741845102L,
+  0.0251797587779118690185681150429720019843L,
+  0.676272439608475367571481578590700290242L,
+  0.880796414989798318500723261307937258554L,
+  0.387922631107753361553377889431536170676L,
+  0.282350224157064849683455744598629321323L,
+  0.721001172978128539392551761867898599807L,
+  0.98720056526474911920598612334425157851L,
+  0.9951900286811655251775209231187451065L,
+  0.051844546479017627818996668613208776283L,
+  0.103738972117399718145836730690615155693L,
+  0.228544758674525285763674099492074936604L,
+  0.429309402103194762341587536897342160049L,
+  0.564535575507982971760351294178163523416L,
+  0.999063571593237112671743187500362701266L,
+  0.340374156369508513494787137157934959152L,
+  0.778748988242111504661479799747122556733L,
+  0.471307010869691772647781526213794708743L,
+  0.289707428078962269353959639691462373973L,
+  0.826577651264033230456965284610788939828L,
+  0.860667694131974131835140122175480202008L,
+  0.596405567348984902495263677852931818947L,
+  0.79786093770390728560184577433203234578L,
+  0.85492142888696693237980696048371212203L,
+  0.57242705004809831263405538576519171441L,
+  0.829648119655355629047392239460860046016L,
+  0.783260316181642610272420809845230036294L,
+  0.0941718863377651336163202407301145871807L,
+  0.156372209579300482444127671309443664823L,
+  0.95045258077372510217507306087908380692L,
+  0.1885289021059534081345247308001373861575L,
+  0.660776653890123229320677431688026234587L,
+  0.2333507388961794003755022400755269739225L,
+  0.926661255852332295794894190183342387092L,
+  0.862240624886232672002503279536846219655L,
+  0.093072473040365648693897225471155002338L,
+  0.210437952956145192084247103889970459783L,
+  0.98112543168220233380555460117617724093L,
+  0.740174391774267645790688716222038485627L,
+  0.0209886798500615011013258311339617682421L,
+  0.41833754096087514377582590206105535614L,
+  0.469019942905167330505858885046130048223L,
+  0.715228143253914303084091910768414947468L,
+  0.949215045400946624794326433082702896278L,
+  0.0839262379919984011512905346130401074556L,
+  0.358856470231875479544116669678510859691L,
+  0.676461324144301815445903930221360844898L,
+  0.321802718137104975636543941512529575137L,
+  0.993411285955596090334951526803325817472L,
+  0.860164319140927797258503749506400508873L,
+  0.94773452678939638468420772776729628408L,
+  0.786167026315331965750413583155691260173L,
+  0.45156944204188755542678210840170293585L,
+  0.490807428869058127589400400723875752095L,
+  0.1064150484458768919266881304357565451445L,
+  0.324460881496927069927267886879512784128L,
+  0.892536276084459403262968666925514247957L,
+  0.626906362142556286375622503025155623158L,
+  0.912617117728752553677432546319200457076L,
+  0.670287539555608481364011494943625670644L,
+  0.247614513279178220157281399165275150246L,
+  0.328334024179281412037962820247065990969L,
+  0.829445540957824174480776183273738605512L,
+  0.1787214688659462728637669907628671276175L,
+  0.925570168885833135397413435137754040344L,
+  0.98275386432184844551191217367555375122L,
+  0.364711512670624901280733420446798813805L,
+  0.0676060703890593392691073615176801081634L,
+  0.01088522590112897075539168583333589679446L,
+  0.0611693052224598303672047526429160913973L,
+  0.214589347780615411637055343786045569195L,
+  0.698097005257153990899739747284349971478L,
+  0.0354356066334430559162358810601367856981L,
+  0.0279531560831790454930326667914520406377L,
+  0.939682879995515407044885888120427639943L,
+  0.312419879113847025637130107480365284706L,
+  0.429063186024752762548549652686423948472L,
+  0.198325752893057589388425455067795077316L,
+  0.653970278037364931023007417819508007502L,
+  0.396811027519564931158159336303275106925L,
+  0.50451059823222344440248588902992099958L,
+  0.0862505815838354201964323759027263746603L,
+  0.957096030216378795442646824371057760147L,
+  0.587610162738417619467784731999441435863L,
+  0.582187586992416238476426545279573456436L,
+  0.535716130421670802716666237861890374707L,
+  0.090478847153957807764386571203708454605L,
+  0.788473620511487574655894325144660477707L,
+  0.610237648835883657058234607228408957708L,
+  0.678372723016422015853594971922211368707L,
+  0.0477042323920128297852928999674240977938L,
+  0.916676966783686851658830754268116450562L,
+  0.385373716764729378193009393283577714611L,
+  0.51049308234047313597601380814795899816L,
+  0.1196704708003806819299545192341910042065L,
+  0.446475706132336496196697021305914636716L,
+  0.22995164195921866005337396330755244987L,
+  0.632225374693904589951305492826903497058L,
+  0.1049567841702419598059377515889392050297L,
+  0.66749284825574584532432314559877621928L,
+  0.730750212627697291852996268443402535667L,
+  0.44210748459007730373853303409845654876L,
+  0.165882407048533464405922485111215401752L,
+  0.326102079042974476137893383568312181916L,
+  0.894926469777796621626659556932174565354L,
+  0.829811268916354531033773068150153342864L,
+  0.0607253283595596933368529290946492114805L,
+  0.0677752868787034912813695724240479638585L,
+  0.82861506635734784945473366382511846348L,
+  0.160085543323090657960949278634908144601L,
+  0.232569451519550129004668131405568301759L,
+  0.848363194546104528297512566450812116666L,
+  0.793640414525406609723674517332020118566L,
+  0.0908665486135344605492576594616215607582L,
+  0.98524892289773367881284955458176900047L,
+  0.232277847265217861619371474795084074907L,
+  0.2478103820537262599906715455471023544214L,
+  0.518524645780409202282547691600231775584L,
+  0.726858378884955244314303315523158335615L,
+  0.245545705017836867827662773158398435754L,
+  0.2242602776132220616213985660229694803996L,
+  0.69321599409749039262414070240230983052L,
+  0.0112978587458533729787299027903363211672L,
+  0.201700091442640051051557572594860881596L,
+  0.1553158804742445432796353137546288871905L,
+  0.297307958467221836656545818754009116053L,
+  0.858321137590160233755873079497950982112L,
+  0.66848174756798322137180974713907803341L,
+  0.996344263106353369755981871581860505522L,
+  0.0298469963581545313060582891253178820216L,
+  0.5825562269883888340326171333296281312L,
+  0.493316240919863194534203651249074989694L,
+  0.25506115557073666386519530923416434445L,
+  0.990037777634583670683401168871182857585L,
+  0.111966792328779238876716387539738843995L,
+  0.555536981182848652400091282463345207445L,
+  0.281763605895317871765768390877174374161L,
+  0.902702281907817546029803311979267829958L,
+  0.526223239446627547666226037912343453756L,
+  0.663322588876953268851644820272004691035L,
+  0.925956679854174995001911256195736125327L,
+  0.978687628923344717267490649565202182013L,
+  0.295452218109470204949110043833472171496L,
+  0.763317372768444290934585368155544717374L,
+  0.41484295515622153189510360412010755096L,
+  0.95319138766107113957717501566306191772L,
+  0.449833295238493367386837134824022661087L,
+  0.380903660964162496124546078818966824203L,
+  0.0591435603332779390763767398658188273838L,
+  0.594973116752510574186847848340951992488L,
+  0.66051154347057943107777082783767373976L,
+  0.9590947364014878778361002605613544034L,
+  0.141719503437180601174660143271258240733L,
+  0.72942088503531365739564056985302156428L,
+  0.96229479992042091317494337141213026865L,
+  0.51401712994901482942061876482808737646L,
+  0.09446204537625467018781365109090483186L,
+  0.568441523568450417056301286402539600564L,
+  0.598604342726174263070596195546293250945L,
+  0.774951017988365558347613104226790833317L,
+  0.81892086730816467017537310019875247387L,
+  0.890143355483709851496792149649550808793L,
+  0.2191477338352410954693547610221317715285L,
+  0.726897475480314385643181203422499653L,
+  0.756138778886812022822443490226271392144L,
+  0.36128016023552084266898937740898271179L,
+  0.410782581318000192446155911986931996913L,
+  0.223641334296034708685419059866928946095L,
+  0.0611617201563377229556630546893173872466L,
+  0.0454251140845604672274274573289906520655L,
+  0.292039969549662442463090760177927466818L,
+  0.0892783972345646734854765244000589132126L,
+  0.98769280749877429524697464655962686569L,
+  0.889843464657722517503667653048728011052L,
+  0.651776307404858375062718114948328477704L,
+  0.87617575855504123004785690824244025026L,
+  0.338359170956885135997817905734588127076L,
+  0.734032684330295341291816774804886223887L,
+  0.862422342223053851459695185679195132964L,
+  0.197333977370262353727756586852240555633L,
+  0.586060335783457129849055206578505427124L,
+  0.132898852938756538479400358451026471607L,
+  0.548298096092246267871555639877296879195L,
+  0.301119859270324657077136364646995297056L,
+  0.02186689635349189676964089313754648484195L,
+  0.037538023766844046167768352700498359816L,
+  0.739462465806194132819844936199304370748L,
+  0.306338591475158278790432712666553704959L,
+  0.0349382326130091592369352494672121905505L,
+  0.12659131714329909411210854142389581492L,
+  0.991566243159047696662802015340988687108L,
+  0.265613985138476447081523915107505113653L,
+  0.379928020809782559672193104868857287448L,
+  0.3311424971073397473661763760151895103L,
+  0.702177302636984264408758773725210449873L,
+  0.975045571615360787500646118846671455125L,
+  0.0373462862349996603561237755410350012631L,
+  0.846126776062337124521510357150131165153L,
+  0.604046707233534456382774833817964498043L,
+  0.1981113045697699450375369418161865703455L,
+  0.0223467484405979164693956414316536174577L,
+  0.67121960182601511325776586363807504696L,
+  0.165784481427263519151726479123968726022L,
+  0.721784618575898210943875783221281669927L,
+  0.247408211201465904622132596487935205602L,
+  0.474174174442367430962454680799704832459L,
+  0.38041380356189313505762491005159753494L,
+  0.412834591083812886132307610186713638625L,
+  0.294378742681402760124595985235966036022L,
+  0.319576442623415298744966071520183847465L,
+  0.17227236515412864866186439447886640924L,
+  0.19227796294349462194111033545303573433L,
+  0.701351402612222654905938605774127547107L,
+  0.55598633289035034815584162421930015865L,
+  0.402729648554369906881359212431684355721L,
+  0.595951760748834493622338584190905994085L,
+  0.119840257870361007206544525046135477756L,
+  0.90443395581066590152525534589406902782L,
+  0.205188871300477881549673944463237196075L,
+  0.339175278174772519132232276502457660768L,
+  0.447725444308107151040888910769680233742L,
+  0.541239546708188153505885726785683096117L,
+  0.12984235126732767588700711245028426254L,
+  0.0534701599183773436559514525508752846737L,
+  0.793436019832695131646422778046763975325L,
+  0.718125883729211211336344362949260539072L,
+  0.328649037343445105052694618356980072933L,
+  0.113307342739499399477248133420602576291L,
+  0.87683936228301044929749768481864525904L,
+  0.212591937265603187751611886807532831791L,
+  0.761002958456888912899646497131654914807L,
+  0.220849601519164170820922984026707209176L,
+  0.222305857213559738578093188054272365062L,
+  0.651516500020930005107266726995614198887L,
+  0.1505613416188572288472651067305496894266L,
+  0.166658450989632252583252879193540688162L,
+  0.249417632511505538283736333645627460544L,
+  0.50096054904291170172998992288713266662L,
+  0.173701146801321486346972068110605414347L,
+  0.93433415280052265881674202089278791561L,
+  0.1167900820460300938880016624066890278452L,
+  0.265137084235229705213901240937609442947L,
+  0.110072770364904306470596762714108445086L,
+  0.0670575770615268870829070207384379655213L,
+  0.92447493539224566948960065689964970346L,
+  0.187517201307673207566548753071237315229L,
+  0.935719666366703749433556454391358561756L,
+  0.964002672100646458888742916175546552353L,
+  0.6304136194377902875122727617639812134L,
+  0.497041144725381002743104205240568050483L,
+  0.589232636183711897405482721407549359295L,
+  0.524588285641300028631908965527617181296L,
+  0.786409662511483672510756944887012261427L,
+  0.9924030873238807048291154748671174581L,
+  0.891407534733792276848059682970952672076L,
+  0.308538095910260975496982224956384014562L,
+  0.949088891149549225900320967233005245566L,
+  0.507378396004105004571665876613293881214L,
+  0.348875146873077771786031143309488031474L,
+  0.129717394366372388305812826098578876617L,
+  0.371316171885006633822161450072014737125L,
+  0.550162123072752251266003313454007126843L,
+  0.822171979807031777641565545578299345138L,
+  0.75171547658293988559512988487590040284L,
+  0.329537443635543385256682239450819107475L,
+  0.159687481361602477899361671181005148163L,
+  0.788720723813465707294018605642035752394L,
+  0.1031423865826241581828274573741444954832L,
+  0.1925157943560383416361499973635531049876L,
+  0.771893047929845637497166550933789470487L,
+  0.681189132819106369246924892765206195007L,
+  0.180608768713011918428603967211913698036L,
+  0.0869303304414286810402604783458783443746L,
+  0.63890744831302111307395023326393791462L,
+  0.531696069328179766265158866360885671855L,
+  0.557357572478102464274432325432400878297L,
+  0.765306589402879669413870462450921612475L,
+  0.0941202729911292570046371838018359372082L,
+  0.902333472113108821746674873990738636997L,
+  0.165516366160118370026922089795742876131L,
+  0.0317472434880413278821576585103363607157L,
+  0.706107972335163251316361316043030620453L,
+  0.832472986392763388669796997227437520663L,
+  0.769939001736494466971306881365718899207L,
+  0.83093185023987157595917781461722256739L,
+  0.1143834825195292986705373579359335590854L,
+  0.283326017120251162360393258571085609729L,
+  0.301605389836836671045912951769199753359L,
+  0.855854391727628505548518803309296566532L,
+  0.089938332734139699450960989316391404434L,
+  0.310225946153425747793112265736973169299L,
+  0.96854812596413627994714291059983626441L,
+  0.279767360423571836833858253122290577619L,
+  0.113545981876279916290815278422648489865L,
+  0.943101270554056170747004305255027939268L,
+  0.812274724978801470221644756549524210083L,
+  0.9678011347395447510273023981530290554L,
+  0.514795136336602722878788704708053145966L,
+  0.50560840616487841567055789750974674943L,
+  0.127654209842819812026603428361923670116L,
+  0.273727399985085036497076514726791191553L,
+  0.964821797874257789566527793136425594082L,
+  0.853392912197074096341317268954834390727L,
+  0.914236806849585335611299422695886165192L,
+  0.277335361137281076359079507288838688219L,
+  0.865708792613433194377422367016717680172L,
+  0.761947879929658945814013586634774725302L,
+  0.276975494384441865188273120642155257808L,
+  0.0678895000408079241574268817560335475378L,
+  0.929521528875748672899760603996998763144L,
+  0.44453824299955605846877126958322272066L,
+  0.444318159420536625223816052640621069982L,
+  0.42913762214779045597457741573009821738L,
+  0.98994873802399078252493194985812582986L,
+  0.93065975343157446755652147574743540714L,
+  0.821639107980128580428385838275355600123L,
+  0.031337950421787684669360817154012683829L,
+  0.839516942888416107002513723437531514126L,
+  0.785501376812531727571251496474527490183L,
+  0.247978681554054401906203846371863203863L,
+  0.985774009303654108868853196421131421187L,
+  0.635347409930173147315815281304257764708L,
+  0.40087985483327734740658289294086718422L,
+  0.374059729085540852289174052767716446502L,
+  0.367226053686019780853702834825808619761L,
+  0.166424328898161772576167906091392715805L,
+  0.838115185925303343477055122060982270143L,
+  0.829549684532006011608856001441012324216L,
+  0.059867788238866724897690318151639504149L,
+  0.0253429734563284738087263277549928280781L,
+  0.953315773263436653713242828719775352192L,
+  0.597536998796130884349662459732857817956L,
+  0.0320571321493587106457025626624408278814L,
+  0.477506594803204144826488443400695434979L,
+  0.285541992141868221897101891229394096707L,
+  0.764190678950226854486968785768647879005L,
+  0.895489776830293129781335242249167913705L,
+  0.570740793029533496018083006013191540077L,
+  0.938316924714444954315906773563465846538L,
+  0.56157168133328941481074926451373503549L,
+  0.354184283860505415751320741296599995231L,
+  0.778294119283540721552919906619543293274L,
+  0.434953011661757598127924745629053141294L,
+  0.37156491156117895854194599593687697796L,
+  0.898767478977082606651667259049374990828L,
+  0.21819365919403129548458400006737057993L,
+  0.278163373548978939704874687746089548269L,
+  0.1089005781457343817756962209721573336768L,
+  0.85152888717082537570752846642305937149L,
+  0.2419243481761527583754399630924438738944L,
+  0.69442654829377168239365980152821108287L,
+  0.1512336533453368944625038813397779875445L,
+  0.617712962492924013140729661730350287525L,
+  0.935400762900002313827620435729493050175L,
+  0.79357339902161958573967958515254111256L,
+  0.734250188990467683521536859220675412636L,
+  0.748517858206364295837674601491185485078L,
+  0.82520014781239194590337105462135253912L,
+  0.1240649365160101108753438662971422995014L,
+  0.479769236133748631678854875312914195598L,
+  0.171269492636258554036912204801376697988L,
+  0.833025419245729049117746814929956940986L,
+  0.354429813451205200141830318428840891828L,
+  0.474809123369344367691189422128776480146L,
+  0.692239655770541262287308180705629028608L,
+  0.271366901464125731413801963807240905363L,
+  0.561330233800121182669429172066686942393L,
+  0.0695868383638479426233449148171168522655L,
+  0.627576910684655924911125045007979454546L,
+  0.423331542652214907262628326674848471962L,
+  0.354725031694671387579309719042578580595L,
+  0.312419264533145363169359084710774849388L,
+  0.167819037053563697473931127337972350099L,
+  0.99960836112225007722014049168024866743L,
+  0.820598666739967434549389339457492152643L,
+  0.689495024741546551592649728378054973272L,
+  0.831455766750164249604246627812180304754L,
+  0.515538871956858025876039391193370146897L,
+  0.011724889011994886395520178564059346913L,
+  0.587485679650311054946861235938601293477L,
+  0.113010564497810081892271654273794311467L,
+  0.381261245177928587613552004600730320213L,
+  0.466933821322235841488251157296771536952L,
+  0.646965031311287534221872388017990968767L,
+  0.1811101995014685369939482409137380098995L,
+  0.247896943912780884738461558340983142645L,
+  0.989351208835640462928338658234638846217L,
+  0.924605283008839688813842975338096967047L,
+  0.232010860908797395869871518793187418799L,
+  0.90274859050487649728273938229764570199L,
+  0.664078588165617572819884867627266650356L,
+  0.532118803501055886836301096658125012493L,
+  0.854049566634563277356849166147057535436L,
+  0.756477818237029394317820041473365538516L,
+  0.84578312219074068824832318394711642503L,
+  0.169914247711153055959592721695068126213L,
+  0.50848961455796310913779527189620088788L,
+  0.715231849280217810525151667911662744854L,
+  0.59666585539439202929452535210623694053L,
+  0.72343578283497935670188130618697814035L,
+  0.982228826906846431195861293729527133844L,
+  0.98068755339273420823366752414155272462L,
+  0.805277135157133623039231303778838094716L,
+  0.840154168539481858495551656699708834713L,
+  0.41783933695481411993780663692806809771L,
+  0.070981740672048589027432942629842679319L,
+  0.96664795205679820656636930925268162457L,
+  0.155178444292580006807274171645675417735L,
+  0.276407670358590477524508525465318694191L,
+  0.1054964292635286397825421772930229411286L,
+  0.354205947516472098240472076653525679013L,
+  0.583456972150065135260312420865576513532L,
+  0.338643867118430587299252775116788065723L,
+  0.146467849593879827355466951871059968293L,
+  0.0639448405747942007938896940026153617467L,
+  0.846536583732599902600485371566229612512L,
+  0.599728399399342923058515558777947417833L,
+  0.140387922890235239162309673093379598453L,
+  0.1613160217694973394489944660056369626715L,
+  0.151848582163159668039725770584081620756L,
+  0.663365628518336712743995463098831995163L,
+  0.752166976367665534193146852225632451022L,
+  0.911311062532571765386023433215793121138L,
+  0.692490353635171096989434518397248623866L,
+  0.990512559245857089458980255962574316578L,
+  0.135026433195284768293027372762691869458L,
+  0.82220389984592453325084678614092535756L,
+  0.385471328555065081327630832374267955206L,
+  0.108251633446048989722318564345306848022L,
+  0.429090236713339412878596384043906547999L,
+  0.983421429305507423332481562450757515935L,
+  0.0163920521681887489391607174895946079877L,
+  0.634276319224952361916496263299135133978L,
+  0.53164375434562160610011793242431018808L,
+  0.92801127390978303506935520414803575609L,
+  0.708525110316144414918831897015500504675L,
+  0.722458240987313977092360928226487539067L,
+  0.432028911017122242491499522489684865593L,
+  0.0001754664935299182587224394863719217640876L,
+  0.384266658709383389800969077999970411222L,
+  0.284964603427904715461598563563830112021L,
+  0.1541443027599544245798778784933517572175L,
+  0.958338802063400795313378181913830622686L,
+  0.636927309395779701122460610729048286624L,
+  0.0963946603295477475541191401069719222887L,
+  0.0995190436935072136624400787867889652226L,
+  0.294220607618706451139091631947946466958L,
+  0.180831121994104393794487526888221966969L,
+  0.635403971764105414766318934434540385347L,
+  0.333929089029202997624323059191296321991L,
+  0.498378678845335358166419186432789231466L,
+  0.79769145046274241777533636404451138797L,
+  0.269285209299779365433012558225847643041L,
+  0.110524792990169183853219228066613162975L,
+  0.252694136970632381193559370648931722998L,
+  0.447232396115786457656991370803052298542L,
+  0.136974250599080636030665381278567779455L,
+  0.67243844394695156696032636816317618716L,
+  0.280265952023932940327982570523639258968L,
+  0.960024614746466668963206103951264089396L,
+  0.83595031847062668345135859090890188348L,
+  0.127840531352213174558502027846545305518L,
+  0.333183884044346150282363573006579940787L,
+  0.480504229384957927069515726093850498988L,
+  0.768498913093287331615443023486434378468L,
+  0.940413493411219283289136687423264928073L,
+  0.548648592555019577089750862504091661273L,
+  0.57814360039222917342516307696519676185L,
+  0.752806287004316513987155718410926624384L,
+  0.328211694133870995310455637563825433641L,
+  0.153907665030571878436793446358668488233L,
+  0.694742699178286984320321272531890059073L,
+  0.25435421168640709608520313542078743933L,
+  0.61387638208113240104328972389071498415L,
+  0.250476311300881635346483832554226742174L,
+  0.345809836897231980069633800588202859833L,
+  0.343083789419841923142937785323119943136L,
+  0.319174378869537109008405333721782689566L,
+  0.158111477528301687597604325494967120237L,
+  0.244000500810322900960285910812181460829L,
+  0.23179705702278726416861948783067588642L,
+  0.54682924846605062799436489677774333716L,
+  0.549008127982055819651521103931442895238L,
+  0.262583044663608129412956518168777449925L,
+  0.00126513153702681878410946802239924274583L,
+  0.942613696151881635585127791325641506562L,
+  0.352686443706689559388572818776843215083L,
+  0.90689998425792029984240460273113807702L,
+  0.867511650419363872431681377574762734184L,
+  0.280671949468087158951852027769013272607L,
+  0.162038690615698843560500386213858514888L,
+  0.71179364933082197276587611716632482938L,
+  0.0967402545497599384082792036477527703823L,
+  0.465040868275334873151726613879001199556L,
+  0.621004503662486553272117361134036130264L,
+  0.732964940483576253705474121238830973672L,
+  0.423374863473223783721502627532544136435L,
+  0.490338535425760290944218064913112069833L,
+  0.0243433415988311460557576165617657963508L,
+  0.0502339423891456566961808478207103394328L,
+  0.57668149339841029115236469576085057193L,
+  0.654589079253818313716855283653923913987L,
+  0.1099728579252794893221972017964445810946L,
+  0.95067113980240197864048876003001477344L,
+  0.271440369581834169312179003284604198334L,
+  0.067152474145377434478612939162576726923L,
+  0.77434193893477314687843638736266814713L,
+  0.2095679937785625400917773512669417520444L,
+  0.7681370807102749183539277908648691358L,
+  0.24472807400083103884984122018932641814L,
+  0.191307162486577428460074174309309551616L,
+  0.637215617752531571162184184570005111405L,
+  0.858141525396878877938747690015117846998L,
+  0.338400625200720062249435065450813258281L,
+  0.564981422008979753676981861330327611986L,
+  0.809460314261206431741632790718777271837L,
+  0.879343403409393604462128113991125533726L,
+  0.284697509116613252542034824007026845569L,
+  0.497023470648395180497606069099534119801L,
+  0.650004713241995983979792197286941523L,
+  0.1177129995341492896184329340448111002318L,
+  0.923625966014428778639333261268345799732L,
+  0.698837131343914189577155394009532120604L,
+  0.28242326745092132457477019796509942259L,
+  0.70025600885251684699238650783454037429L,
+  0.876659050276528114198964471020380705343L,
+  0.52914892693002332233566353042454639365L,
+  0.319860854431864688430502078275989809115L,
+  0.83483115610648557287441551698147898778L,
+  0.727639064249568383685922880431792837046L,
+  0.58743287662861037184349933549802687836L,
+  0.510383231616356949495559076196319035197L,
+  0.00229935944348919214521608305418404052343L,
+  0.799567224020488433652933994297769381902L,
+  0.343651210821093611687224166251624444254L,
+  0.405948097827175151257603419529941300798L,
+  0.456473183882957921169800992232941517586L,
+  0.570248304776860782392105323292264026118L,
+  0.534779754769153667870756893044557559557L,
+  0.472965511839676757434979299779809656808L,
+  0.137335340499076127280155831169214403285L,
+  0.51975901660926295231312276736119435645L,
+  0.8085867293332018994761547260739912451L,
+  0.812416413241484848007226874256949892893L,
+  0.852994977709961112714176162016389410712L,
+  0.95270886248643660114015239563660004248L,
+  0.845133719240648570417568652136630304138L,
+  0.4074980021816323645978397907609428101L,
+  0.335850514497730546494305840184055599972L,
+  0.0882622233237065445998153436898044995127L,
+  0.936467561027640943446178111237050277205L,
+  0.56676472173638044722431698799123577376L,
+  0.528427769051008704179988533062745663408L,
+  0.460890427579778855697205646060084318038L,
+  0.754971897131798313468797543428083655928L,
+  0.980733597969419782109470537306886067907L,
+  0.204362127415649555111877580124343815074L,
+  0.424822548090499017266619697426652494042L,
+  0.790847149074521364262028407892114384257L,
+  0.559922683392730473870877613727301497865L,
+  0.779993507158626042106006393237738208875L,
+  0.30516368089713691312418593599115685319L,
+  0.68918765842229398168455844072311006826L,
+  0.972291357858071465096079542885284602882L,
+  0.92204286423973856982373873105566928589L,
+  0.488649453783638471576482476648021023315L,
+  0.467124744623849284659862825278549932824L,
+  0.548051233865943557014854568009331816852L,
+  0.306838990296265483205551142903402056051L,
+  0.497005516835688988273805238236922199451L,
+  0.341504433884138135798086132528045458722L,
+  0.969816416247460790089503289400709886528L,
+  0.63656435610220447227337751650167349487L,
+  0.83588076122262875881859751942918794857L,
+  0.647568600604975972308348018018445212894L,
+  0.916061870307308870029862807808332479077L,
+  0.767988745496844638880672392122527991445L,
+  0.1623230195628039449666927123215281227666L,
+  0.0791082835859634251558587844284289799848L,
+  0.575858643610197202634665099752882990844L,
+  0.559159434263749620344702466000799724913L,
+  0.063765998380760211208741798736948488376L,
+  0.230557913975359017084357477142151415967L,
+  0.702854691657277602758421942319022953845L,
+  0.789516660466782621905392733079230211954L,
+  0.491496186820051632244513986127898500904L,
+  0.171499215418269578563458417238340672634L,
+  0.626470061831746666081979158043673024967L,
+  0.258903137813870706268979320963343541457L,
+  0.64156850108405218894694811301875120511L,
+  0.534043520260340661507140771088018906496L,
+  0.388275182018399247097875416106759899469L,
+  0.920936363560998030495046998224168162945L,
+  0.826139404694006088220407338888245165242L,
+  0.343561253523163451528918423980552161597L,
+  0.921521003270491194867019217479780072647L,
+  0.656212467754097185125864111703195343744L,
+  0.628186262290474398328350301885606581942L,
+  0.573227336542237665153422986363073650388L,
+  0.94178975003001342039795597242477049832L,
+  0.0408103561362355768975182155847755354614L,
+  0.382581672073273072487550945526454964287L,
+  0.152851256046525520308098129538613498254L,
+  0.966735024597183045592313880114075824298L,
+  0.215564894798334550271993595018433286244L,
+  0.776491530531523589201618375156272004616L,
+  0.912460554179311241821569665648929177608L,
+  0.632880016212040018958086886452474382272L,
+  0.711577891112709305169603082360885583086L,
+  0.1120655756066491784920471129299439607153L,
+  0.691106483958832651050573402690448368687L,
+  0.227442567846797646970770128970529357636L,
+  0.837435613090485891584882062239924101455L,
+  0.524389161590691896070067767400758142565L,
+  0.591360583466508186135247682666313136762L,
+  0.103155847462960450706124014839446958843L,
+  0.98360160577671960281465138408293984545L,
+  0.197665014114674630647437622579741018817L,
+  0.1099709194312379594014239398842185159354L,
+  0.394053373921474751303577685990936074485L,
+  0.94945354787200894450508557094182436657L,
+  0.372593716084661547440393809983835348274L,
+  0.62514674616343692328572382301636412566L,
+  0.2001871481416310130073795585638383984926L,
+  0.148432902421401306477690922498335475507L,
+  0.687921673269487018193347305425182239764L,
+  0.470940334348984370262797433659013738143L,
+  0.1592476430730276812200821020958787823795L,
+  0.296776110696565927524970058176467314578L,
+  0.1491253105142218631726813695413369166796L,
+  0.579194717868638955003571989739802264354L,
+  0.0730543936466744761440131951539370917776L,
+  0.941296077873340797733875467209629660594L,
+  0.76720024949523806992504865943580486187L,
+  0.419526107681583337049761526455092560735L,
+  0.00688594806937144144337797612615981618743L,
+  0.931682704636487927763651991274577493318L,
+  0.660524215847727125058815911433184924133L,
+  0.71780972384903067744609138100002205676L,
+  0.02961791918271995070621856302848439458175L,
+  0.692791206212428997136050006631240567502L,
+  0.162762426697948445642880183096693062538L,
+  0.183637795551464341949019870428026949035L,
+  0.51263789620316407488619761125039609046L,
+  0.90238698122728366178818828411640824056L,
+  0.229784208410123517024401367798925386038L,
+  0.227218480059027721044118324890061381517L,
+  0.6555059570778176955459672492237825867L,
+  0.929815767583615624563413584598741896834L,
+  0.188559597559312695774663933876436875041L,
+  0.396184448063913762028147791554346199354L,
+  0.656329540957568516760105602115555736073L,
+  0.1410678455413176345310401990667063246115L,
+  0.621004667838855651847651367745487628637L,
+  0.01277988784767030635209958407461792778387L,
+  0.69482142276844418673788732511112265014L,
+  0.925705031133221932065307191539105635005L,
+  0.925744341385232535963050430363763081603L,
+  0.24189467813699258571134382505828701386L,
+  0.646009544609703485845605410919901799L,
+  0.051119212999532673562206731603906295406L,
+  0.85076142804383409765024452942896578158L
+};
deleted file mode 120000 (symlink)
index 3295188adba90b27293bb50403fbdb956099e9dc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sched_yield.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..72928b721e49e164f1a2693e25e6064f3f8caa5b
--- /dev/null
@@ -0,0 +1,59 @@
+/* Schedule other threads to run.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sched.h>
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+/* Use Windows threads.  */
+
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+
+int
+sched_yield (void)
+{
+  Sleep (0);
+  return 0;
+}
+
+#elif defined __KLIBC__
+/* OS/2 kLIBC implementation */
+
+# define INCL_DOS
+# include <os2.h>
+
+int
+sched_yield (void)
+{
+  DosSleep (0);
+  return 0;
+}
+
+#else
+/* Provide a dummy implementation for single-threaded applications.  */
+
+int
+sched_yield (void)
+{
+  return 0;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 81ef5ce6d5a9ea4045a2a451d30933b5971574d2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/setlocale.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eb263617dc8c83a4aadf6f6620a9682e1b020731
--- /dev/null
+/* Set the current locale.  -*- coding: utf-8 -*-
+   Copyright (C) 2009, 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+/* Override setlocale() so that when the default locale is requested
+   (locale = ""), the environment variables LC_ALL, LC_*, and LANG are
+   considered.
+   Also include all the functionality from libintl's setlocale() override.  */
+
+/* Please keep this file in sync with
+   gettext/gettext-runtime/intl/setlocale.c !  */
+
+/* Specification.  */
+#include <locale.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "localename.h"
+
+#if HAVE_CFLOCALECOPYPREFERREDLANGUAGES || HAVE_CFPREFERENCESCOPYAPPVALUE
+# if HAVE_CFLOCALECOPYPREFERREDLANGUAGES
+#  include <CoreFoundation/CFLocale.h>
+# elif HAVE_CFPREFERENCESCOPYAPPVALUE
+#  include <CoreFoundation/CFPreferences.h>
+# endif
+# include <CoreFoundation/CFPropertyList.h>
+# include <CoreFoundation/CFArray.h>
+# include <CoreFoundation/CFString.h>
+extern void gl_locale_name_canonicalize (char *name);
+#endif
+
+#if 1
+
+# undef setlocale
+
+/* Which of the replacements to activate?  */
+# if NEED_SETLOCALE_IMPROVED
+#  define setlocale_improved rpl_setlocale
+# elif NEED_SETLOCALE_MTSAFE
+#  define setlocale_mtsafe rpl_setlocale
+# else
+#  error "This file should only be compiled if NEED_SETLOCALE_IMPROVED || NEED_SETLOCALE_MTSAFE."
+# endif
+
+/* Like setlocale, but guaranteed to be multithread-safe if LOCALE == NULL.  */
+# if !SETLOCALE_NULL_ALL_MTSAFE || !SETLOCALE_NULL_ONE_MTSAFE /* i.e. if NEED_SETLOCALE_MTSAFE */
+
+#  if NEED_SETLOCALE_IMPROVED
+static
+#  endif
+char *
+setlocale_mtsafe (int category, const char *locale)
+{
+  if (locale == NULL)
+    return (char *) setlocale_null (category);
+  else
+    return setlocale (category, locale);
+}
+# else /* !NEED_SETLOCALE_MTSAFE */
+
+#  define setlocale_mtsafe setlocale
+
+# endif /* NEED_SETLOCALE_MTSAFE */
+
+# if NEED_SETLOCALE_IMPROVED
+
+/* Return string representation of locale category CATEGORY.  */
+static const char *
+category_to_name (int category)
+{
+  const char *retval;
+
+  switch (category)
+  {
+  case LC_COLLATE:
+    retval = "LC_COLLATE";
+    break;
+  case LC_CTYPE:
+    retval = "LC_CTYPE";
+    break;
+  case LC_MONETARY:
+    retval = "LC_MONETARY";
+    break;
+  case LC_NUMERIC:
+    retval = "LC_NUMERIC";
+    break;
+  case LC_TIME:
+    retval = "LC_TIME";
+    break;
+  case LC_MESSAGES:
+    retval = "LC_MESSAGES";
+    break;
+  default:
+    /* If you have a better idea for a default value let me know.  */
+    retval = "LC_XXX";
+  }
+
+  return retval;
+}
+
+#  if defined _WIN32 && ! defined __CYGWIN__
+
+/* The native Windows setlocale() function expects locale names of the form
+   "German" or "German_Germany" or "DEU", but not "de" or "de_DE".  We need
+   to convert the names from the form with ISO 639 language code and ISO 3166
+   country code to the form with English names or with three-letter identifier.
+   The three-letter identifiers known by a Windows XP SP2 or SP3 are:
+     AFK  Afrikaans_South Africa.1252
+     ARA  Arabic_Saudi Arabia.1256
+     ARB  Arabic_Lebanon.1256
+     ARE  Arabic_Egypt.1256
+     ARG  Arabic_Algeria.1256
+     ARH  Arabic_Bahrain.1256
+     ARI  Arabic_Iraq.1256
+     ARJ  Arabic_Jordan.1256
+     ARK  Arabic_Kuwait.1256
+     ARL  Arabic_Libya.1256
+     ARM  Arabic_Morocco.1256
+     ARO  Arabic_Oman.1256
+     ARQ  Arabic_Qatar.1256
+     ARS  Arabic_Syria.1256
+     ART  Arabic_Tunisia.1256
+     ARU  Arabic_U.A.E..1256
+     ARY  Arabic_Yemen.1256
+     AZE  Azeri (Latin)_Azerbaijan.1254
+     BEL  Belarusian_Belarus.1251
+     BGR  Bulgarian_Bulgaria.1251
+     BSB  Bosnian_Bosnia and Herzegovina.1250
+     BSC  Bosnian (Cyrillic)_Bosnia and Herzegovina.1250  (wrong encoding!)
+     CAT  Catalan_Spain.1252
+     CHH  Chinese_Hong Kong S.A.R..950
+     CHI  Chinese_Singapore.936
+     CHS  Chinese_People's Republic of China.936
+     CHT  Chinese_Taiwan.950
+     CSY  Czech_Czech Republic.1250
+     CYM  Welsh_United Kingdom.1252
+     DAN  Danish_Denmark.1252
+     DEA  German_Austria.1252
+     DEC  German_Liechtenstein.1252
+     DEL  German_Luxembourg.1252
+     DES  German_Switzerland.1252
+     DEU  German_Germany.1252
+     ELL  Greek_Greece.1253
+     ENA  English_Australia.1252
+     ENB  English_Caribbean.1252
+     ENC  English_Canada.1252
+     ENG  English_United Kingdom.1252
+     ENI  English_Ireland.1252
+     ENJ  English_Jamaica.1252
+     ENL  English_Belize.1252
+     ENP  English_Republic of the Philippines.1252
+     ENS  English_South Africa.1252
+     ENT  English_Trinidad and Tobago.1252
+     ENU  English_United States.1252
+     ENW  English_Zimbabwe.1252
+     ENZ  English_New Zealand.1252
+     ESA  Spanish_Panama.1252
+     ESB  Spanish_Bolivia.1252
+     ESC  Spanish_Costa Rica.1252
+     ESD  Spanish_Dominican Republic.1252
+     ESE  Spanish_El Salvador.1252
+     ESF  Spanish_Ecuador.1252
+     ESG  Spanish_Guatemala.1252
+     ESH  Spanish_Honduras.1252
+     ESI  Spanish_Nicaragua.1252
+     ESL  Spanish_Chile.1252
+     ESM  Spanish_Mexico.1252
+     ESN  Spanish_Spain.1252
+     ESO  Spanish_Colombia.1252
+     ESP  Spanish_Spain.1252
+     ESR  Spanish_Peru.1252
+     ESS  Spanish_Argentina.1252
+     ESU  Spanish_Puerto Rico.1252
+     ESV  Spanish_Venezuela.1252
+     ESY  Spanish_Uruguay.1252
+     ESZ  Spanish_Paraguay.1252
+     ETI  Estonian_Estonia.1257
+     EUQ  Basque_Spain.1252
+     FAR  Farsi_Iran.1256
+     FIN  Finnish_Finland.1252
+     FOS  Faroese_Faroe Islands.1252
+     FPO  Filipino_Philippines.1252
+     FRA  French_France.1252
+     FRB  French_Belgium.1252
+     FRC  French_Canada.1252
+     FRL  French_Luxembourg.1252
+     FRM  French_Principality of Monaco.1252
+     FRS  French_Switzerland.1252
+     FYN  Frisian_Netherlands.1252
+     GLC  Galician_Spain.1252
+     HEB  Hebrew_Israel.1255
+     HRB  Croatian_Bosnia and Herzegovina.1250
+     HRV  Croatian_Croatia.1250
+     HUN  Hungarian_Hungary.1250
+     IND  Indonesian_Indonesia.1252
+     IRE  Irish_Ireland.1252
+     ISL  Icelandic_Iceland.1252
+     ITA  Italian_Italy.1252
+     ITS  Italian_Switzerland.1252
+     IUK  Inuktitut (Latin)_Canada.1252
+     JPN  Japanese_Japan.932
+     KKZ  Kazakh_Kazakhstan.1251
+     KOR  Korean_Korea.949
+     KYR  Kyrgyz_Kyrgyzstan.1251
+     LBX  Luxembourgish_Luxembourg.1252
+     LTH  Lithuanian_Lithuania.1257
+     LVI  Latvian_Latvia.1257
+     MKI  FYRO Macedonian_Former Yugoslav Republic of Macedonia.1251
+     MON  Mongolian_Mongolia.1251
+     MPD  Mapudungun_Chile.1252
+     MSB  Malay_Brunei Darussalam.1252
+     MSL  Malay_Malaysia.1252
+     MWK  Mohawk_Canada.1252
+     NLB  Dutch_Belgium.1252
+     NLD  Dutch_Netherlands.1252
+     NON  Norwegian-Nynorsk_Norway.1252
+     NOR  Norwegian (Bokmål)_Norway.1252
+     NSO  Northern Sotho_South Africa.1252
+     PLK  Polish_Poland.1250
+     PTB  Portuguese_Brazil.1252
+     PTG  Portuguese_Portugal.1252
+     QUB  Quechua_Bolivia.1252
+     QUE  Quechua_Ecuador.1252
+     QUP  Quechua_Peru.1252
+     RMC  Romansh_Switzerland.1252
+     ROM  Romanian_Romania.1250
+     RUS  Russian_Russia.1251
+     SKY  Slovak_Slovakia.1250
+     SLV  Slovenian_Slovenia.1250
+     SMA  Sami (Southern)_Norway.1252
+     SMB  Sami (Southern)_Sweden.1252
+     SME  Sami (Northern)_Norway.1252
+     SMF  Sami (Northern)_Sweden.1252
+     SMG  Sami (Northern)_Finland.1252
+     SMJ  Sami (Lule)_Norway.1252
+     SMK  Sami (Lule)_Sweden.1252
+     SMN  Sami (Inari)_Finland.1252
+     SMS  Sami (Skolt)_Finland.1252
+     SQI  Albanian_Albania.1250
+     SRB  Serbian (Cyrillic)_Serbia and Montenegro.1251
+     SRL  Serbian (Latin)_Serbia and Montenegro.1250
+     SRN  Serbian (Cyrillic)_Bosnia and Herzegovina.1251
+     SRS  Serbian (Latin)_Bosnia and Herzegovina.1250
+     SVE  Swedish_Sweden.1252
+     SVF  Swedish_Finland.1252
+     SWK  Swahili_Kenya.1252
+     THA  Thai_Thailand.874
+     TRK  Turkish_Turkey.1254
+     TSN  Tswana_South Africa.1252
+     TTT  Tatar_Russia.1251
+     UKR  Ukrainian_Ukraine.1251
+     URD  Urdu_Islamic Republic of Pakistan.1256
+     USA  English_United States.1252
+     UZB  Uzbek (Latin)_Uzbekistan.1254
+     VIT  Vietnamese_Viet Nam.1258
+     XHO  Xhosa_South Africa.1252
+     ZHH  Chinese_Hong Kong S.A.R..950
+     ZHI  Chinese_Singapore.936
+     ZHM  Chinese_Macau S.A.R..950
+     ZUL  Zulu_South Africa.1252
+ */
+
+/* Table from ISO 639 language code, optionally with country or script suffix,
+   to English name.
+   Keep in sync with the gl_locale_name_from_win32_LANGID function in
+   localename.c!  */
+struct table_entry
+{
+  const char *code;
+  const char *english;
+};
+static const struct table_entry language_table[] =
+  {
+    { "af", "Afrikaans" },
+    { "am", "Amharic" },
+    { "ar", "Arabic" },
+    { "arn", "Mapudungun" },
+    { "as", "Assamese" },
+    { "az@cyrillic", "Azeri (Cyrillic)" },
+    { "az@latin", "Azeri (Latin)" },
+    { "ba", "Bashkir" },
+    { "be", "Belarusian" },
+    { "ber", "Tamazight" },
+    { "ber@arabic", "Tamazight (Arabic)" },
+    { "ber@latin", "Tamazight (Latin)" },
+    { "bg", "Bulgarian" },
+    { "bin", "Edo" },
+    { "bn", "Bengali" },
+    { "bn_BD", "Bengali (Bangladesh)" },
+    { "bn_IN", "Bengali (India)" },
+    { "bnt", "Sutu" },
+    { "bo", "Tibetan" },
+    { "br", "Breton" },
+    { "bs", "BSB" }, /* "Bosnian (Latin)" */
+    { "bs@cyrillic", "BSC" }, /* Bosnian (Cyrillic) */
+    { "ca", "Catalan" },
+    { "chr", "Cherokee" },
+    { "co", "Corsican" },
+    { "cpe", "Hawaiian" },
+    { "cs", "Czech" },
+    { "cy", "Welsh" },
+    { "da", "Danish" },
+    { "de", "German" },
+    { "dsb", "Lower Sorbian" },
+    { "dv", "Divehi" },
+    { "el", "Greek" },
+    { "en", "English" },
+    { "es", "Spanish" },
+    { "et", "Estonian" },
+    { "eu", "Basque" },
+    { "fa", "Farsi" },
+    { "ff", "Fulfulde" },
+    { "fi", "Finnish" },
+    { "fo", "Faroese" }, /* "Faeroese" does not work */
+    { "fr", "French" },
+    { "fy", "Frisian" },
+    { "ga", "IRE" }, /* Gaelic (Ireland) */
+    { "gd", "Gaelic (Scotland)" },
+    { "gd", "Scottish Gaelic" },
+    { "gl", "Galician" },
+    { "gn", "Guarani" },
+    { "gsw", "Alsatian" },
+    { "gu", "Gujarati" },
+    { "ha", "Hausa" },
+    { "he", "Hebrew" },
+    { "hi", "Hindi" },
+    { "hr", "Croatian" },
+    { "hsb", "Upper Sorbian" },
+    { "hu", "Hungarian" },
+    { "hy", "Armenian" },
+    { "id", "Indonesian" },
+    { "ig", "Igbo" },
+    { "ii", "Yi" },
+    { "is", "Icelandic" },
+    { "it", "Italian" },
+    { "iu", "IUK" }, /* Inuktitut */
+    { "ja", "Japanese" },
+    { "ka", "Georgian" },
+    { "kk", "Kazakh" },
+    { "kl", "Greenlandic" },
+    { "km", "Cambodian" },
+    { "km", "Khmer" },
+    { "kn", "Kannada" },
+    { "ko", "Korean" },
+    { "kok", "Konkani" },
+    { "kr", "Kanuri" },
+    { "ks", "Kashmiri" },
+    { "ks_IN", "Kashmiri_India" },
+    { "ks_PK", "Kashmiri (Arabic)_Pakistan" },
+    { "ky", "Kyrgyz" },
+    { "la", "Latin" },
+    { "lb", "Luxembourgish" },
+    { "lo", "Lao" },
+    { "lt", "Lithuanian" },
+    { "lv", "Latvian" },
+    { "mi", "Maori" },
+    { "mk", "FYRO Macedonian" },
+    { "mk", "Macedonian" },
+    { "ml", "Malayalam" },
+    { "mn", "Mongolian" },
+    { "mni", "Manipuri" },
+    { "moh", "Mohawk" },
+    { "mr", "Marathi" },
+    { "ms", "Malay" },
+    { "mt", "Maltese" },
+    { "my", "Burmese" },
+    { "nb", "NOR" }, /* Norwegian Bokmål */
+    { "ne", "Nepali" },
+    { "nic", "Ibibio" },
+    { "nl", "Dutch" },
+    { "nn", "NON" }, /* Norwegian Nynorsk */
+    { "no", "Norwegian" },
+    { "nso", "Northern Sotho" },
+    { "nso", "Sepedi" },
+    { "oc", "Occitan" },
+    { "om", "Oromo" },
+    { "or", "Oriya" },
+    { "pa", "Punjabi" },
+    { "pap", "Papiamentu" },
+    { "pl", "Polish" },
+    { "prs", "Dari" },
+    { "ps", "Pashto" },
+    { "pt", "Portuguese" },
+    { "qu", "Quechua" },
+    { "qut", "K'iche'" },
+    { "rm", "Romansh" },
+    { "ro", "Romanian" },
+    { "ru", "Russian" },
+    { "rw", "Kinyarwanda" },
+    { "sa", "Sanskrit" },
+    { "sah", "Yakut" },
+    { "sd", "Sindhi" },
+    { "se", "Sami (Northern)" },
+    { "se", "Northern Sami" },
+    { "si", "Sinhalese" },
+    { "sk", "Slovak" },
+    { "sl", "Slovenian" },
+    { "sma", "Sami (Southern)" },
+    { "sma", "Southern Sami" },
+    { "smj", "Sami (Lule)" },
+    { "smj", "Lule Sami" },
+    { "smn", "Sami (Inari)" },
+    { "smn", "Inari Sami" },
+    { "sms", "Sami (Skolt)" },
+    { "sms", "Skolt Sami" },
+    { "so", "Somali" },
+    { "sq", "Albanian" },
+    { "sr", "Serbian (Latin)" },
+    { "sr@cyrillic", "SRB" }, /* Serbian (Cyrillic) */
+    { "sv", "Swedish" },
+    { "sw", "Swahili" },
+    { "syr", "Syriac" },
+    { "ta", "Tamil" },
+    { "te", "Telugu" },
+    { "tg", "Tajik" },
+    { "th", "Thai" },
+    { "ti", "Tigrinya" },
+    { "tk", "Turkmen" },
+    { "tl", "Filipino" },
+    { "tn", "Tswana" },
+    { "tr", "Turkish" },
+    { "ts", "Tsonga" },
+    { "tt", "Tatar" },
+    { "ug", "Uighur" },
+    { "uk", "Ukrainian" },
+    { "ur", "Urdu" },
+    { "uz", "Uzbek" },
+    { "uz", "Uzbek (Latin)" },
+    { "uz@cyrillic", "Uzbek (Cyrillic)" },
+    { "ve", "Venda" },
+    { "vi", "Vietnamese" },
+    { "wen", "Sorbian" },
+    { "wo", "Wolof" },
+    { "xh", "Xhosa" },
+    { "yi", "Yiddish" },
+    { "yo", "Yoruba" },
+    { "zh", "Chinese" },
+    { "zu", "Zulu" }
+  };
+
+/* Table from ISO 3166 country code to English name.
+   Keep in sync with the gl_locale_name_from_win32_LANGID function in
+   localename.c!  */
+static const struct table_entry country_table[] =
+  {
+    { "AE", "U.A.E." },
+    { "AF", "Afghanistan" },
+    { "AL", "Albania" },
+    { "AM", "Armenia" },
+    { "AN", "Netherlands Antilles" },
+    { "AR", "Argentina" },
+    { "AT", "Austria" },
+    { "AU", "Australia" },
+    { "AZ", "Azerbaijan" },
+    { "BA", "Bosnia and Herzegovina" },
+    { "BD", "Bangladesh" },
+    { "BE", "Belgium" },
+    { "BG", "Bulgaria" },
+    { "BH", "Bahrain" },
+    { "BN", "Brunei Darussalam" },
+    { "BO", "Bolivia" },
+    { "BR", "Brazil" },
+    { "BT", "Bhutan" },
+    { "BY", "Belarus" },
+    { "BZ", "Belize" },
+    { "CA", "Canada" },
+    { "CG", "Congo" },
+    { "CH", "Switzerland" },
+    { "CI", "Cote d'Ivoire" },
+    { "CL", "Chile" },
+    { "CM", "Cameroon" },
+    { "CN", "People's Republic of China" },
+    { "CO", "Colombia" },
+    { "CR", "Costa Rica" },
+    { "CS", "Serbia and Montenegro" },
+    { "CZ", "Czech Republic" },
+    { "DE", "Germany" },
+    { "DK", "Denmark" },
+    { "DO", "Dominican Republic" },
+    { "DZ", "Algeria" },
+    { "EC", "Ecuador" },
+    { "EE", "Estonia" },
+    { "EG", "Egypt" },
+    { "ER", "Eritrea" },
+    { "ES", "Spain" },
+    { "ET", "Ethiopia" },
+    { "FI", "Finland" },
+    { "FO", "Faroe Islands" },
+    { "FR", "France" },
+    { "GB", "United Kingdom" },
+    { "GD", "Caribbean" },
+    { "GE", "Georgia" },
+    { "GL", "Greenland" },
+    { "GR", "Greece" },
+    { "GT", "Guatemala" },
+    { "HK", "Hong Kong" },
+    { "HK", "Hong Kong S.A.R." },
+    { "HN", "Honduras" },
+    { "HR", "Croatia" },
+    { "HT", "Haiti" },
+    { "HU", "Hungary" },
+    { "ID", "Indonesia" },
+    { "IE", "Ireland" },
+    { "IL", "Israel" },
+    { "IN", "India" },
+    { "IQ", "Iraq" },
+    { "IR", "Iran" },
+    { "IS", "Iceland" },
+    { "IT", "Italy" },
+    { "JM", "Jamaica" },
+    { "JO", "Jordan" },
+    { "JP", "Japan" },
+    { "KE", "Kenya" },
+    { "KG", "Kyrgyzstan" },
+    { "KH", "Cambodia" },
+    { "KR", "South Korea" },
+    { "KW", "Kuwait" },
+    { "KZ", "Kazakhstan" },
+    { "LA", "Laos" },
+    { "LB", "Lebanon" },
+    { "LI", "Liechtenstein" },
+    { "LK", "Sri Lanka" },
+    { "LT", "Lithuania" },
+    { "LU", "Luxembourg" },
+    { "LV", "Latvia" },
+    { "LY", "Libya" },
+    { "MA", "Morocco" },
+    { "MC", "Principality of Monaco" },
+    { "MD", "Moldava" },
+    { "MD", "Moldova" },
+    { "ME", "Montenegro" },
+    { "MK", "Former Yugoslav Republic of Macedonia" },
+    { "ML", "Mali" },
+    { "MM", "Myanmar" },
+    { "MN", "Mongolia" },
+    { "MO", "Macau S.A.R." },
+    { "MT", "Malta" },
+    { "MV", "Maldives" },
+    { "MX", "Mexico" },
+    { "MY", "Malaysia" },
+    { "NG", "Nigeria" },
+    { "NI", "Nicaragua" },
+    { "NL", "Netherlands" },
+    { "NO", "Norway" },
+    { "NP", "Nepal" },
+    { "NZ", "New Zealand" },
+    { "OM", "Oman" },
+    { "PA", "Panama" },
+    { "PE", "Peru" },
+    { "PH", "Philippines" },
+    { "PK", "Islamic Republic of Pakistan" },
+    { "PL", "Poland" },
+    { "PR", "Puerto Rico" },
+    { "PT", "Portugal" },
+    { "PY", "Paraguay" },
+    { "QA", "Qatar" },
+    { "RE", "Reunion" },
+    { "RO", "Romania" },
+    { "RS", "Serbia" },
+    { "RU", "Russia" },
+    { "RW", "Rwanda" },
+    { "SA", "Saudi Arabia" },
+    { "SE", "Sweden" },
+    { "SG", "Singapore" },
+    { "SI", "Slovenia" },
+    { "SK", "Slovak" },
+    { "SN", "Senegal" },
+    { "SO", "Somalia" },
+    { "SR", "Suriname" },
+    { "SV", "El Salvador" },
+    { "SY", "Syria" },
+    { "TH", "Thailand" },
+    { "TJ", "Tajikistan" },
+    { "TM", "Turkmenistan" },
+    { "TN", "Tunisia" },
+    { "TR", "Turkey" },
+    { "TT", "Trinidad and Tobago" },
+    { "TW", "Taiwan" },
+    { "TZ", "Tanzania" },
+    { "UA", "Ukraine" },
+    { "US", "United States" },
+    { "UY", "Uruguay" },
+    { "VA", "Vatican" },
+    { "VE", "Venezuela" },
+    { "VN", "Viet Nam" },
+    { "YE", "Yemen" },
+    { "ZA", "South Africa" },
+    { "ZW", "Zimbabwe" }
+  };
+
+/* Given a string STRING, find the set of indices i such that TABLE[i].code is
+   the given STRING.  It is a range [lo,hi-1].  */
+typedef struct { size_t lo; size_t hi; } range_t;
+static void
+search (const struct table_entry *table, size_t table_size, const char *string,
+        range_t *result)
+{
+  /* The table is sorted.  Perform a binary search.  */
+  size_t hi = table_size;
+  size_t lo = 0;
+  while (lo < hi)
+    {
+      /* Invariant:
+         for i < lo, strcmp (table[i].code, string) < 0,
+         for i >= hi, strcmp (table[i].code, string) > 0.  */
+      size_t mid = (hi + lo) >> 1; /* >= lo, < hi */
+      int cmp = strcmp (table[mid].code, string);
+      if (cmp < 0)
+        lo = mid + 1;
+      else if (cmp > 0)
+        hi = mid;
+      else
+        {
+          /* Found an i with
+               strcmp (language_table[i].code, string) == 0.
+             Find the entire interval of such i.  */
+          {
+            size_t i;
+
+            for (i = mid; i > lo; )
+              {
+                i--;
+                if (strcmp (table[i].code, string) < 0)
+                  {
+                    lo = i + 1;
+                    break;
+                  }
+              }
+          }
+          {
+            size_t i;
+
+            for (i = mid + 1; i < hi; i++)
+              {
+                if (strcmp (table[i].code, string) > 0)
+                  {
+                    hi = i;
+                    break;
+                  }
+              }
+          }
+          /* The set of i with
+               strcmp (language_table[i].code, string) == 0
+             is the interval [lo, hi-1].  */
+          break;
+        }
+    }
+  result->lo = lo;
+  result->hi = hi;
+}
+
+/* Like setlocale, but accept also locale names in the form ll or ll_CC,
+   where ll is an ISO 639 language code and CC is an ISO 3166 country code.  */
+static char *
+setlocale_unixlike (int category, const char *locale)
+{
+  char *result;
+  char llCC_buf[64];
+  char ll_buf[64];
+  char CC_buf[64];
+
+  /* The native Windows implementation of setlocale understands the special
+     locale name "C", but not "POSIX".  Therefore map "POSIX" to "C".  */
+  if (locale != NULL && strcmp (locale, "POSIX") == 0)
+    locale = "C";
+
+  /* First, try setlocale with the original argument unchanged.  */
+  result = setlocale_mtsafe (category, locale);
+  if (result != NULL)
+    return result;
+
+  /* Otherwise, assume the argument is in the form
+       language[_territory][.codeset][@modifier]
+     and try to map it using the tables.  */
+  if (strlen (locale) < sizeof (llCC_buf))
+    {
+      /* Second try: Remove the codeset part.  */
+      {
+        const char *p = locale;
+        char *q = llCC_buf;
+
+        /* Copy the part before the dot.  */
+        for (; *p != '\0' && *p != '.'; p++, q++)
+          *q = *p;
+        if (*p == '.')
+          /* Skip the part up to the '@', if any.  */
+          for (; *p != '\0' && *p != '@'; p++)
+            ;
+        /* Copy the part starting with '@', if any.  */
+        for (; *p != '\0'; p++, q++)
+          *q = *p;
+        *q = '\0';
+      }
+      /* llCC_buf now contains
+           language[_territory][@modifier]
+       */
+      if (strcmp (llCC_buf, locale) != 0)
+        {
+          result = setlocale (category, llCC_buf);
+          if (result != NULL)
+            return result;
+        }
+      /* Look it up in language_table.  */
+      {
+        range_t range;
+        size_t i;
+
+        search (language_table,
+                sizeof (language_table) / sizeof (language_table[0]),
+                llCC_buf,
+                &range);
+
+        for (i = range.lo; i < range.hi; i++)
+          {
+            /* Try the replacement in language_table[i].  */
+            result = setlocale (category, language_table[i].english);
+            if (result != NULL)
+              return result;
+          }
+      }
+      /* Split language[_territory][@modifier]
+         into  ll_buf = language[@modifier]
+         and   CC_buf = territory
+       */
+      {
+        const char *underscore = strchr (llCC_buf, '_');
+        if (underscore != NULL)
+          {
+            const char *territory_start = underscore + 1;
+            const char *territory_end = strchr (territory_start, '@');
+            if (territory_end == NULL)
+              territory_end = territory_start + strlen (territory_start);
+
+            memcpy (ll_buf, llCC_buf, underscore - llCC_buf);
+            strcpy (ll_buf + (underscore - llCC_buf), territory_end);
+
+            memcpy (CC_buf, territory_start, territory_end - territory_start);
+            CC_buf[territory_end - territory_start] = '\0';
+
+            {
+              /* Look up ll_buf in language_table
+                 and CC_buf in country_table.  */
+              range_t language_range;
+
+              search (language_table,
+                      sizeof (language_table) / sizeof (language_table[0]),
+                      ll_buf,
+                      &language_range);
+              if (language_range.lo < language_range.hi)
+                {
+                  range_t country_range;
+
+                  search (country_table,
+                          sizeof (country_table) / sizeof (country_table[0]),
+                          CC_buf,
+                          &country_range);
+                  if (country_range.lo < country_range.hi)
+                    {
+                      size_t i;
+                      size_t j;
+
+                      for (i = language_range.lo; i < language_range.hi; i++)
+                        for (j = country_range.lo; j < country_range.hi; j++)
+                          {
+                            /* Concatenate the replacements.  */
+                            const char *part1 = language_table[i].english;
+                            size_t part1_len = strlen (part1);
+                            const char *part2 = country_table[j].english;
+                            size_t part2_len = strlen (part2) + 1;
+                            char buf[64+64];
+
+                            if (!(part1_len + 1 + part2_len <= sizeof (buf)))
+                              abort ();
+                            memcpy (buf, part1, part1_len);
+                            buf[part1_len] = '_';
+                            memcpy (buf + part1_len + 1, part2, part2_len);
+
+                            /* Try the concatenated replacements.  */
+                            result = setlocale (category, buf);
+                            if (result != NULL)
+                              return result;
+                          }
+                    }
+
+                  /* Try omitting the country entirely.  This may set a locale
+                     corresponding to the wrong country, but is better than
+                     failing entirely.  */
+                  {
+                    size_t i;
+
+                    for (i = language_range.lo; i < language_range.hi; i++)
+                      {
+                        /* Try only the language replacement.  */
+                        result =
+                          setlocale (category, language_table[i].english);
+                        if (result != NULL)
+                          return result;
+                      }
+                  }
+                }
+            }
+          }
+      }
+    }
+
+  /* Failed.  */
+  return NULL;
+}
+
+#  elif defined __ANDROID__
+
+/* Like setlocale, but accept also the locale names "C" and "POSIX".  */
+static char *
+setlocale_unixlike (int category, const char *locale)
+{
+  char *result = setlocale_mtsafe (category, locale);
+  if (result == NULL)
+    switch (category)
+      {
+      case LC_CTYPE:
+      case LC_NUMERIC:
+      case LC_TIME:
+      case LC_COLLATE:
+      case LC_MONETARY:
+      case LC_MESSAGES:
+      case LC_ALL:
+      case LC_PAPER:
+      case LC_NAME:
+      case LC_ADDRESS:
+      case LC_TELEPHONE:
+      case LC_MEASUREMENT:
+        if (locale == NULL
+            || strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0)
+          result = (char *) "C";
+        break;
+      default:
+        break;
+      }
+  return result;
+}
+#   define setlocale setlocale_unixlike
+
+#  else
+#   define setlocale_unixlike setlocale_mtsafe
+#  endif
+
+#  if LC_MESSAGES == 1729
+
+/* The system does not store an LC_MESSAGES locale category.  Do it here.  */
+static char lc_messages_name[64] = "C";
+
+/* Like setlocale, but support also LC_MESSAGES.  */
+static char *
+setlocale_single (int category, const char *locale)
+{
+  if (category == LC_MESSAGES)
+    {
+      if (locale != NULL)
+        {
+          lc_messages_name[sizeof (lc_messages_name) - 1] = '\0';
+          strncpy (lc_messages_name, locale, sizeof (lc_messages_name) - 1);
+        }
+      return lc_messages_name;
+    }
+  else
+    return setlocale_unixlike (category, locale);
+}
+
+#  else
+#   define setlocale_single setlocale_unixlike
+#  endif
+
+#  if defined __APPLE__ && defined __MACH__
+
+/* Mapping from language to main territory where that language is spoken.  */
+static char const locales_with_principal_territory[][6 + 1] =
+  {
+                /* Language     Main territory */
+    "ace_ID",   /* Achinese     Indonesia */
+    "af_ZA",    /* Afrikaans    South Africa */
+    "ak_GH",    /* Akan         Ghana */
+    "am_ET",    /* Amharic      Ethiopia */
+    "an_ES",    /* Aragonese    Spain */
+    "ang_GB",   /* Old English  Britain */
+    "arn_CL",   /* Mapudungun   Chile */
+    "as_IN",    /* Assamese     India */
+    "ast_ES",   /* Asturian     Spain */
+    "av_RU",    /* Avaric       Russia */
+    "awa_IN",   /* Awadhi       India */
+    "az_AZ",    /* Azerbaijani  Azerbaijan */
+    "ban_ID",   /* Balinese     Indonesia */
+    "be_BY",    /* Belarusian   Belarus */
+    "bej_SD",   /* Beja         Sudan */
+    "bem_ZM",   /* Bemba        Zambia */
+    "bg_BG",    /* Bulgarian    Bulgaria */
+    "bho_IN",   /* Bhojpuri     India */
+    "bi_VU",    /* Bislama      Vanuatu */
+    "bik_PH",   /* Bikol        Philippines */
+    "bin_NG",   /* Bini         Nigeria */
+    "bm_ML",    /* Bambara      Mali */
+    "bn_IN",    /* Bengali      India */
+    "bo_CN",    /* Tibetan      China */
+    "br_FR",    /* Breton       France */
+    "bs_BA",    /* Bosnian      Bosnia */
+    "bug_ID",   /* Buginese     Indonesia */
+    "ca_ES",    /* Catalan      Spain */
+    "ce_RU",    /* Chechen      Russia */
+    "ceb_PH",   /* Cebuano      Philippines */
+    "co_FR",    /* Corsican     France */
+    "cr_CA",    /* Cree         Canada */
+    /* Don't put "crh_UZ" or "crh_UA" here.  That would be asking for fruitless
+       political discussion.  */
+    "cs_CZ",    /* Czech        Czech Republic */
+    "csb_PL",   /* Kashubian    Poland */
+    "cy_GB",    /* Welsh        Britain */
+    "da_DK",    /* Danish       Denmark */
+    "de_DE",    /* German       Germany */
+    "din_SD",   /* Dinka        Sudan */
+    "doi_IN",   /* Dogri        India */
+    "dsb_DE",   /* Lower Sorbian        Germany */
+    "dv_MV",    /* Divehi       Maldives */
+    "dz_BT",    /* Dzongkha     Bhutan */
+    "ee_GH",    /* Éwé          Ghana */
+    "el_GR",    /* Greek        Greece */
+    /* Don't put "en_GB" or "en_US" here.  That would be asking for fruitless
+       political discussion.  */
+    "es_ES",    /* Spanish      Spain */
+    "et_EE",    /* Estonian     Estonia */
+    "fa_IR",    /* Persian      Iran */
+    "fi_FI",    /* Finnish      Finland */
+    "fil_PH",   /* Filipino     Philippines */
+    "fj_FJ",    /* Fijian       Fiji */
+    "fo_FO",    /* Faroese      Faeroe Islands */
+    "fon_BJ",   /* Fon          Benin */
+    "fr_FR",    /* French       France */
+    "fur_IT",   /* Friulian     Italy */
+    "fy_NL",    /* Western Frisian      Netherlands */
+    "ga_IE",    /* Irish        Ireland */
+    "gd_GB",    /* Scottish Gaelic      Britain */
+    "gon_IN",   /* Gondi        India */
+    "gsw_CH",   /* Swiss German Switzerland */
+    "gu_IN",    /* Gujarati     India */
+    "he_IL",    /* Hebrew       Israel */
+    "hi_IN",    /* Hindi        India */
+    "hil_PH",   /* Hiligaynon   Philippines */
+    "hr_HR",    /* Croatian     Croatia */
+    "hsb_DE",   /* Upper Sorbian        Germany */
+    "ht_HT",    /* Haitian      Haiti */
+    "hu_HU",    /* Hungarian    Hungary */
+    "hy_AM",    /* Armenian     Armenia */
+    "id_ID",    /* Indonesian   Indonesia */
+    "ig_NG",    /* Igbo         Nigeria */
+    "ii_CN",    /* Sichuan Yi   China */
+    "ilo_PH",   /* Iloko        Philippines */
+    "is_IS",    /* Icelandic    Iceland */
+    "it_IT",    /* Italian      Italy */
+    "ja_JP",    /* Japanese     Japan */
+    "jab_NG",   /* Hyam         Nigeria */
+    "jv_ID",    /* Javanese     Indonesia */
+    "ka_GE",    /* Georgian     Georgia */
+    "kab_DZ",   /* Kabyle       Algeria */
+    "kaj_NG",   /* Jju          Nigeria */
+    "kam_KE",   /* Kamba        Kenya */
+    "kmb_AO",   /* Kimbundu     Angola */
+    "kcg_NG",   /* Tyap         Nigeria */
+    "kdm_NG",   /* Kagoma       Nigeria */
+    "kg_CD",    /* Kongo        Democratic Republic of Congo */
+    "kk_KZ",    /* Kazakh       Kazakhstan */
+    "kl_GL",    /* Kalaallisut  Greenland */
+    "km_KH",    /* Central Khmer        Cambodia */
+    "kn_IN",    /* Kannada      India */
+    "ko_KR",    /* Korean       Korea (South) */
+    "kok_IN",   /* Konkani      India */
+    "kr_NG",    /* Kanuri       Nigeria */
+    "kru_IN",   /* Kurukh       India */
+    "ky_KG",    /* Kyrgyz       Kyrgyzstan */
+    "lg_UG",    /* Ganda        Uganda */
+    "li_BE",    /* Limburgish   Belgium */
+    "lo_LA",    /* Laotian      Laos */
+    "lt_LT",    /* Lithuanian   Lithuania */
+    "lu_CD",    /* Luba-Katanga Democratic Republic of Congo */
+    "lua_CD",   /* Luba-Lulua   Democratic Republic of Congo */
+    "luo_KE",   /* Luo          Kenya */
+    "lv_LV",    /* Latvian      Latvia */
+    "mad_ID",   /* Madurese     Indonesia */
+    "mag_IN",   /* Magahi       India */
+    "mai_IN",   /* Maithili     India */
+    "mak_ID",   /* Makasar      Indonesia */
+    "man_ML",   /* Mandingo     Mali */
+    "men_SL",   /* Mende        Sierra Leone */
+    "mfe_MU",   /* Mauritian Creole     Mauritius */
+    "mg_MG",    /* Malagasy     Madagascar */
+    "mi_NZ",    /* Maori        New Zealand */
+    "min_ID",   /* Minangkabau  Indonesia */
+    "mk_MK",    /* Macedonian   North Macedonia */
+    "ml_IN",    /* Malayalam    India */
+    "mn_MN",    /* Mongolian    Mongolia */
+    "mni_IN",   /* Manipuri     India */
+    "mos_BF",   /* Mossi        Burkina Faso */
+    "mr_IN",    /* Marathi      India */
+    "ms_MY",    /* Malay        Malaysia */
+    "mt_MT",    /* Maltese      Malta */
+    "mwr_IN",   /* Marwari      India */
+    "my_MM",    /* Burmese      Myanmar */
+    "na_NR",    /* Nauru        Nauru */
+    "nah_MX",   /* Nahuatl      Mexico */
+    "nap_IT",   /* Neapolitan   Italy */
+    "nb_NO",    /* Norwegian Bokmål    Norway */
+    "nds_DE",   /* Low Saxon    Germany */
+    "ne_NP",    /* Nepali       Nepal */
+    "nl_NL",    /* Dutch        Netherlands */
+    "nn_NO",    /* Norwegian Nynorsk    Norway */
+    "no_NO",    /* Norwegian    Norway */
+    "nr_ZA",    /* South Ndebele        South Africa */
+    "nso_ZA",   /* Northern Sotho       South Africa */
+    "ny_MW",    /* Chichewa     Malawi */
+    "nym_TZ",   /* Nyamwezi     Tanzania */
+    "nyn_UG",   /* Nyankole     Uganda */
+    "oc_FR",    /* Occitan      France */
+    "oj_CA",    /* Ojibwa       Canada */
+    "or_IN",    /* Oriya        India */
+    "pa_IN",    /* Punjabi      India */
+    "pag_PH",   /* Pangasinan   Philippines */
+    "pam_PH",   /* Pampanga     Philippines */
+    "pap_AN",   /* Papiamento   Netherlands Antilles - this line can be removed in 2018 */
+    "pbb_CO",   /* Páez         Colombia */
+    "pl_PL",    /* Polish       Poland */
+    "ps_AF",    /* Pashto       Afghanistan */
+    "pt_PT",    /* Portuguese   Portugal */
+    "raj_IN",   /* Rajasthani   India */
+    "rm_CH",    /* Romansh      Switzerland */
+    "rn_BI",    /* Kirundi      Burundi */
+    "ro_RO",    /* Romanian     Romania */
+    "ru_RU",    /* Russian      Russia */
+    "rw_RW",    /* Kinyarwanda  Rwanda */
+    "sa_IN",    /* Sanskrit     India */
+    "sah_RU",   /* Yakut        Russia */
+    "sas_ID",   /* Sasak        Indonesia */
+    "sat_IN",   /* Santali      India */
+    "sc_IT",    /* Sardinian    Italy */
+    "scn_IT",   /* Sicilian     Italy */
+    "sg_CF",    /* Sango        Central African Republic */
+    "shn_MM",   /* Shan         Myanmar */
+    "si_LK",    /* Sinhala      Sri Lanka */
+    "sid_ET",   /* Sidamo       Ethiopia */
+    "sk_SK",    /* Slovak       Slovakia */
+    "sl_SI",    /* Slovenian    Slovenia */
+    "sm_WS",    /* Samoan       Samoa */
+    "smn_FI",   /* Inari Sami   Finland */
+    "sms_FI",   /* Skolt Sami   Finland */
+    "so_SO",    /* Somali       Somalia */
+    "sq_AL",    /* Albanian     Albania */
+    "sr_RS",    /* Serbian      Serbia */
+    "srr_SN",   /* Serer        Senegal */
+    "suk_TZ",   /* Sukuma       Tanzania */
+    "sus_GN",   /* Susu         Guinea */
+    "sv_SE",    /* Swedish      Sweden */
+    "te_IN",    /* Telugu       India */
+    "tem_SL",   /* Timne        Sierra Leone */
+    "tet_ID",   /* Tetum        Indonesia */
+    "tg_TJ",    /* Tajik        Tajikistan */
+    "th_TH",    /* Thai         Thailand */
+    "ti_ER",    /* Tigrinya     Eritrea */
+    "tiv_NG",   /* Tiv          Nigeria */
+    "tk_TM",    /* Turkmen      Turkmenistan */
+    "tl_PH",    /* Tagalog      Philippines */
+    "to_TO",    /* Tonga        Tonga */
+    "tpi_PG",   /* Tok Pisin    Papua New Guinea */
+    "tr_TR",    /* Turkish      Türkiye */
+    "tum_MW",   /* Tumbuka      Malawi */
+    "ug_CN",    /* Uighur       China */
+    "uk_UA",    /* Ukrainian    Ukraine */
+    "umb_AO",   /* Umbundu      Angola */
+    "ur_PK",    /* Urdu         Pakistan */
+    "uz_UZ",    /* Uzbek        Uzbekistan */
+    "ve_ZA",    /* Venda        South Africa */
+    "vi_VN",    /* Vietnamese   Vietnam */
+    "wa_BE",    /* Walloon      Belgium */
+    "wal_ET",   /* Walamo       Ethiopia */
+    "war_PH",   /* Waray        Philippines */
+    "wen_DE",   /* Sorbian      Germany */
+    "yao_MW",   /* Yao          Malawi */
+    "zap_MX"    /* Zapotec      Mexico */
+  };
+
+/* Compare just the language part of two locale names.  */
+static int
+langcmp (const char *locale1, const char *locale2)
+{
+  size_t locale1_len;
+  size_t locale2_len;
+  int cmp;
+
+  {
+    const char *locale1_end = strchr (locale1, '_');
+    if (locale1_end != NULL)
+      locale1_len = locale1_end - locale1;
+    else
+      locale1_len = strlen (locale1);
+  }
+  {
+    const char *locale2_end = strchr (locale2, '_');
+    if (locale2_end != NULL)
+      locale2_len = locale2_end - locale2;
+    else
+      locale2_len = strlen (locale2);
+  }
+
+  if (locale1_len < locale2_len)
+    {
+      cmp = memcmp (locale1, locale2, locale1_len);
+      if (cmp == 0)
+        cmp = -1;
+    }
+  else
+    {
+      cmp = memcmp (locale1, locale2, locale2_len);
+      if (locale1_len > locale2_len && cmp == 0)
+        cmp = 1;
+    }
+
+  return cmp;
+}
+
+/* Given a locale name, return the main locale with the same language,
+   or NULL if not found.
+   For example: "fr_DE" -> "fr_FR".  */
+static const char *
+get_main_locale_with_same_language (const char *locale)
+{
+#   define table locales_with_principal_territory
+  /* The table is sorted.  Perform a binary search.  */
+  size_t hi = sizeof (table) / sizeof (table[0]);
+  size_t lo = 0;
+  while (lo < hi)
+    {
+      /* Invariant:
+         for i < lo, langcmp (table[i], locale) < 0,
+         for i >= hi, langcmp (table[i], locale) > 0.  */
+      size_t mid = (hi + lo) >> 1; /* >= lo, < hi */
+      int cmp = langcmp (table[mid], locale);
+      if (cmp < 0)
+        lo = mid + 1;
+      else if (cmp > 0)
+        hi = mid;
+      else
+        {
+          /* Found an i with
+               langcmp (language_table[i], locale) == 0.
+             Verify that it is the only such i.  */
+          if (mid > lo && langcmp (table[mid - 1], locale) >= 0)
+            abort ();
+          if (mid + 1 < hi && langcmp (table[mid + 1], locale) <= 0)
+            abort ();
+          return table[mid];
+        }
+    }
+#   undef table
+  return NULL;
+}
+
+/* Mapping from territory to main language that is spoken in that territory.  */
+static char const locales_with_principal_language[][6 + 1] =
+  {
+    /* This is based on the set of existing locales in glibc, with duplicates
+       removed, and on the Wikipedia pages named "Languages of <territory>".
+       If in doubt, use the locale that exists in macOS.  For example, the only
+       "*_IN" locale in macOS 10.13 is "hi_IN", so use that.  */
+    /* A useful shell function for producing a line of this table is:
+         func_line ()
+         {
+           # Usage: func_line ll_CC
+           ll=`echo "$1" | sed -e 's|_.*||'`
+           cc=`echo "$1" | sed -e 's|^.*_||'`
+           llx=`sed -n -e "s|^${ll} ||p" < gettext-tools/doc/ISO_639`
+           ccx=`expand gettext-tools/doc/ISO_3166 | sed -n -e "s|^${cc}  *||p"`
+           echo "    \"$1\",    /$X* ${llx} ${ccx} *$X/"
+         }
+     */
+              /* Main language  Territory */
+    "ca_AD",    /* Catalan      Andorra */
+    "ar_AE",    /* Arabic       United Arab Emirates */
+    "ps_AF",    /* Pashto       Afghanistan */
+    "en_AG",    /* English      Antigua and Barbuda */
+    "sq_AL",    /* Albanian     Albania */
+    "hy_AM",    /* Armenian     Armenia */
+    "pap_AN",   /* Papiamento   Netherlands Antilles - this line can be removed in 2018 */
+    "pt_AO",    /* Portuguese   Angola */
+    "es_AR",    /* Spanish      Argentina */
+    "de_AT",    /* German       Austria */
+    "en_AU",    /* English      Australia */
+    /* Aruba has two official languages: "nl_AW", "pap_AW".  */
+    "az_AZ",    /* Azerbaijani  Azerbaijan */
+    "bs_BA",    /* Bosnian      Bosnia */
+    "bn_BD",    /* Bengali      Bangladesh */
+    "nl_BE",    /* Dutch        Belgium */
+    "fr_BF",    /* French       Burkina Faso */
+    "bg_BG",    /* Bulgarian    Bulgaria */
+    "ar_BH",    /* Arabic       Bahrain */
+    "rn_BI",    /* Kirundi      Burundi */
+    "fr_BJ",    /* French       Benin */
+    "es_BO",    /* Spanish      Bolivia */
+    "pt_BR",    /* Portuguese   Brazil */
+    "dz_BT",    /* Dzongkha     Bhutan */
+    "en_BW",    /* English      Botswana */
+    "be_BY",    /* Belarusian   Belarus */
+    "en_CA",    /* English      Canada */
+    "fr_CD",    /* French       Democratic Republic of Congo */
+    "sg_CF",    /* Sango        Central African Republic */
+    "de_CH",    /* German       Switzerland */
+    "es_CL",    /* Spanish      Chile */
+    "zh_CN",    /* Chinese      China */
+    "es_CO",    /* Spanish      Colombia */
+    "es_CR",    /* Spanish      Costa Rica */
+    "es_CU",    /* Spanish      Cuba */
+    /* Curaçao has three official languages: "nl_CW", "pap_CW", "en_CW".  */
+    "el_CY",    /* Greek        Cyprus */
+    "cs_CZ",    /* Czech        Czech Republic */
+    "de_DE",    /* German       Germany */
+    /* Djibouti has two official languages: "ar_DJ" and "fr_DJ".  */
+    "da_DK",    /* Danish       Denmark */
+    "es_DO",    /* Spanish      Dominican Republic */
+    "ar_DZ",    /* Arabic       Algeria */
+    "es_EC",    /* Spanish      Ecuador */
+    "et_EE",    /* Estonian     Estonia */
+    "ar_EG",    /* Arabic       Egypt */
+    "ti_ER",    /* Tigrinya     Eritrea */
+    "es_ES",    /* Spanish      Spain */
+    "am_ET",    /* Amharic      Ethiopia */
+    "fi_FI",    /* Finnish      Finland */
+    /* Fiji has three official languages: "en_FJ", "fj_FJ", "hif_FJ".  */
+    "fo_FO",    /* Faroese      Faeroe Islands */
+    "fr_FR",    /* French       France */
+    "en_GB",    /* English      Britain */
+    "ka_GE",    /* Georgian     Georgia */
+    "en_GH",    /* English      Ghana */
+    "kl_GL",    /* Kalaallisut  Greenland */
+    "fr_GN",    /* French       Guinea */
+    "el_GR",    /* Greek        Greece */
+    "es_GT",    /* Spanish      Guatemala */
+    "zh_HK",    /* Chinese      Hong Kong */
+    "es_HN",    /* Spanish      Honduras */
+    "hr_HR",    /* Croatian     Croatia */
+    "ht_HT",    /* Haitian      Haiti */
+    "hu_HU",    /* Hungarian    Hungary */
+    "id_ID",    /* Indonesian   Indonesia */
+    "en_IE",    /* English      Ireland */
+    "he_IL",    /* Hebrew       Israel */
+    "hi_IN",    /* Hindi        India */
+    "ar_IQ",    /* Arabic       Iraq */
+    "fa_IR",    /* Persian      Iran */
+    "is_IS",    /* Icelandic    Iceland */
+    "it_IT",    /* Italian      Italy */
+    "ar_JO",    /* Arabic       Jordan */
+    "ja_JP",    /* Japanese     Japan */
+    "sw_KE",    /* Swahili      Kenya */
+    "ky_KG",    /* Kyrgyz       Kyrgyzstan */
+    "km_KH",    /* Central Khmer        Cambodia */
+    "ko_KR",    /* Korean       Korea (South) */
+    "ar_KW",    /* Arabic       Kuwait */
+    "kk_KZ",    /* Kazakh       Kazakhstan */
+    "lo_LA",    /* Laotian      Laos */
+    "ar_LB",    /* Arabic       Lebanon */
+    "de_LI",    /* German       Liechtenstein */
+    "si_LK",    /* Sinhala      Sri Lanka */
+    "lt_LT",    /* Lithuanian   Lithuania */
+    /* Luxembourg has three official languages: "lb_LU", "fr_LU", "de_LU".  */
+    "lv_LV",    /* Latvian      Latvia */
+    "ar_LY",    /* Arabic       Libya */
+    "ar_MA",    /* Arabic       Morocco */
+    "sr_ME",    /* Serbian      Montenegro */
+    "mg_MG",    /* Malagasy     Madagascar */
+    "mk_MK",    /* Macedonian   North Macedonia */
+    "fr_ML",    /* French       Mali */
+    "my_MM",    /* Burmese      Myanmar */
+    "mn_MN",    /* Mongolian    Mongolia */
+    "mt_MT",    /* Maltese      Malta */
+    "mfe_MU",   /* Mauritian Creole     Mauritius */
+    "dv_MV",    /* Divehi       Maldives */
+    "ny_MW",    /* Chichewa     Malawi */
+    "es_MX",    /* Spanish      Mexico */
+    "ms_MY",    /* Malay        Malaysia */
+    "en_NG",    /* English      Nigeria */
+    "es_NI",    /* Spanish      Nicaragua */
+    "nl_NL",    /* Dutch        Netherlands */
+    "no_NO",    /* Norwegian    Norway */
+    "ne_NP",    /* Nepali       Nepal */
+    "na_NR",    /* Nauru        Nauru */
+    "niu_NU",   /* Niuean       Niue */
+    "en_NZ",    /* English      New Zealand */
+    "ar_OM",    /* Arabic       Oman */
+    "es_PA",    /* Spanish      Panama */
+    "es_PE",    /* Spanish      Peru */
+    "tpi_PG",   /* Tok Pisin    Papua New Guinea */
+    "fil_PH",   /* Filipino     Philippines */
+    "pa_PK",    /* Punjabi      Pakistan */
+    "pl_PL",    /* Polish       Poland */
+    "es_PR",    /* Spanish      Puerto Rico */
+    "pt_PT",    /* Portuguese   Portugal */
+    "es_PY",    /* Spanish      Paraguay */
+    "ar_QA",    /* Arabic       Qatar */
+    "ro_RO",    /* Romanian     Romania */
+    "sr_RS",    /* Serbian      Serbia */
+    "ru_RU",    /* Russian      Russia */
+    "rw_RW",    /* Kinyarwanda  Rwanda */
+    "ar_SA",    /* Arabic       Saudi Arabia */
+    "en_SC",    /* English      Seychelles */
+    "ar_SD",    /* Arabic       Sudan */
+    "sv_SE",    /* Swedish      Sweden */
+    "en_SG",    /* English      Singapore */
+    "sl_SI",    /* Slovenian    Slovenia */
+    "sk_SK",    /* Slovak       Slovakia */
+    "en_SL",    /* English      Sierra Leone */
+    "fr_SN",    /* French       Senegal */
+    "so_SO",    /* Somali       Somalia */
+    "ar_SS",    /* Arabic       South Sudan */
+    "es_SV",    /* Spanish      El Salvador */
+    "ar_SY",    /* Arabic       Syria */
+    "th_TH",    /* Thai         Thailand */
+    "tg_TJ",    /* Tajik        Tajikistan */
+    "tk_TM",    /* Turkmen      Turkmenistan */
+    "ar_TN",    /* Arabic       Tunisia */
+    "to_TO",    /* Tonga        Tonga */
+    "tr_TR",    /* Turkish      Türkiye */
+    "zh_TW",    /* Chinese      Taiwan */
+    "sw_TZ",    /* Swahili      Tanzania */
+    "uk_UA",    /* Ukrainian    Ukraine */
+    "lg_UG",    /* Ganda        Uganda */
+    "en_US",    /* English      United States of America */
+    "es_UY",    /* Spanish      Uruguay */
+    "uz_UZ",    /* Uzbek        Uzbekistan */
+    "es_VE",    /* Spanish      Venezuela */
+    "vi_VN",    /* Vietnamese   Vietnam */
+    "bi_VU",    /* Bislama      Vanuatu */
+    "sm_WS",    /* Samoan       Samoa */
+    "ar_YE",    /* Arabic       Yemen */
+    "en_ZA",    /* English      South Africa */
+    "en_ZM",    /* English      Zambia */
+    "en_ZW"     /* English      Zimbabwe */
+  };
+
+/* Compare just the territory part of two locale names.  */
+static int
+terrcmp (const char *locale1, const char *locale2)
+{
+  const char *territory1 = strrchr (locale1, '_') + 1;
+  const char *territory2 = strrchr (locale2, '_') + 1;
+
+  return strcmp (territory1, territory2);
+}
+
+/* Given a locale name, return the locale corresponding to the main language
+   with the same territory, or NULL if not found.
+   For example: "fr_DE" -> "de_DE".  */
+static const char *
+get_main_locale_with_same_territory (const char *locale)
+{
+  if (strrchr (locale, '_') != NULL)
+    {
+#   define table locales_with_principal_language
+      /* The table is sorted.  Perform a binary search.  */
+      size_t hi = sizeof (table) / sizeof (table[0]);
+      size_t lo = 0;
+      while (lo < hi)
+        {
+          /* Invariant:
+             for i < lo, terrcmp (table[i], locale) < 0,
+             for i >= hi, terrcmp (table[i], locale) > 0.  */
+          size_t mid = (hi + lo) >> 1; /* >= lo, < hi */
+          int cmp = terrcmp (table[mid], locale);
+          if (cmp < 0)
+            lo = mid + 1;
+          else if (cmp > 0)
+            hi = mid;
+          else
+            {
+              /* Found an i with
+                   terrcmp (language_table[i], locale) == 0.
+                 Verify that it is the only such i.  */
+              if (mid > lo && terrcmp (table[mid - 1], locale) >= 0)
+                abort ();
+              if (mid + 1 < hi && terrcmp (table[mid + 1], locale) <= 0)
+                abort ();
+              return table[mid];
+            }
+        }
+#   undef table
+    }
+  return NULL;
+}
+
+#  endif
+
+char *
+setlocale_improved (int category, const char *locale)
+{
+  if (locale != NULL && locale[0] == '\0')
+    {
+      /* A request to the set the current locale to the default locale.  */
+      if (category == LC_ALL)
+        {
+          /* Set LC_CTYPE first.  Then the other categories.  */
+          static int const categories[] =
+            {
+              LC_CTYPE,
+              LC_NUMERIC,
+              LC_TIME,
+              LC_COLLATE,
+              LC_MONETARY,
+              LC_MESSAGES
+            };
+          char *saved_locale;
+          const char *base_name;
+          unsigned int i;
+
+          /* Back up the old locale, in case one of the steps fails.  */
+          saved_locale = setlocale (LC_ALL, NULL);
+          if (saved_locale == NULL)
+            return NULL;
+          saved_locale = strdup (saved_locale);
+          if (saved_locale == NULL)
+            return NULL;
+
+          /* Set LC_CTYPE category.  Set all other categories (except possibly
+             LC_MESSAGES) to the same value in the same call; this is likely to
+             save calls.  */
+          base_name =
+            gl_locale_name_environ (LC_CTYPE, category_to_name (LC_CTYPE));
+          if (base_name == NULL)
+            base_name = gl_locale_name_default ();
+
+          if (setlocale_unixlike (LC_ALL, base_name) != NULL)
+            {
+              /* LC_CTYPE category already set.  */
+              i = 1;
+            }
+          else
+            {
+              /* On Mac OS X, "UTF-8" is a valid locale name for LC_CTYPE but
+                 not for LC_ALL.  Therefore this call may fail.  So, try
+                 another base_name.  */
+              base_name = "C";
+              if (setlocale_unixlike (LC_ALL, base_name) == NULL)
+                goto fail;
+              i = 0;
+            }
+#  if defined _WIN32 && ! defined __CYGWIN__
+          /* On native Windows, setlocale(LC_ALL,...) may succeed but set the
+             LC_CTYPE category to an invalid value ("C") when it does not
+             support the specified encoding.  Report a failure instead.  */
+          if (strchr (base_name, '.') != NULL
+              && strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+            goto fail;
+#  endif
+
+          for (; i < sizeof (categories) / sizeof (categories[0]); i++)
+            {
+              int cat = categories[i];
+              const char *name;
+
+              name = gl_locale_name_environ (cat, category_to_name (cat));
+              if (name == NULL)
+                name = gl_locale_name_default ();
+
+              /* If name is the same as base_name, it has already been set
+                 through the setlocale call before the loop.  */
+              if (strcmp (name, base_name) != 0
+#  if LC_MESSAGES == 1729
+                  || cat == LC_MESSAGES
+#  endif
+                 )
+                if (setlocale_single (cat, name) == NULL)
+#  if defined __APPLE__ && defined __MACH__
+                  {
+                    /* On Mac OS X 10.13, some locales can be set through
+                       System Preferences > Language & Region, that are not
+                       supported by libc.  The system's setlocale() falls
+                       back to "C" for these locale categories.  We can do
+                       better, by trying an existing locale with the same
+                       language or an existing locale with the same territory.
+                       If we can't, print a warning, to limit user
+                       expectations.  */
+                    int warn = 0;
+
+                    if (cat == LC_CTYPE)
+                      warn = (setlocale_single (cat, "UTF-8") == NULL);
+                    else if (cat == LC_MESSAGES)
+                      {
+#   if HAVE_CFLOCALECOPYPREFERREDLANGUAGES || HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */
+                        /* Take the primary language preference.  */
+#    if HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* MacOS X 10.5 or newer */
+                        CFArrayRef prefArray = CFLocaleCopyPreferredLanguages ();
+#    elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */
+                        CFTypeRef preferences =
+                          CFPreferencesCopyAppValue (CFSTR ("AppleLanguages"),
+                                                     kCFPreferencesCurrentApplication);
+                        if (preferences != NULL
+                            && CFGetTypeID (preferences) == CFArrayGetTypeID ())
+                          {
+                            CFArrayRef prefArray = (CFArrayRef)preferences;
+#    endif
+                            int n = CFArrayGetCount (prefArray);
+                            if (n > 0)
+                              {
+                                char buf[256];
+                                CFTypeRef element = CFArrayGetValueAtIndex (prefArray, 0);
+                                if (element != NULL
+                                    && CFGetTypeID (element) == CFStringGetTypeID ()
+                                    && CFStringGetCString ((CFStringRef)element,
+                                                           buf, sizeof (buf),
+                                                           kCFStringEncodingASCII))
+                                  {
+                                    /* Remove the country.
+                                       E.g. "zh-Hans-DE" -> "zh-Hans".  */
+                                    char *last_minus = strrchr (buf, '-');
+                                    if (last_minus != NULL)
+                                      *last_minus = '\0';
+
+                                    /* Convert to Unix locale name.
+                                       E.g. "zh-Hans" -> "zh_CN".  */
+                                    gl_locale_name_canonicalize (buf);
+
+                                    /* Try setlocale with this value.  */
+                                    if (setlocale_single (cat, buf) == NULL)
+                                      {
+                                        const char *last_try =
+                                          get_main_locale_with_same_language (buf);
+
+                                        if (last_try == NULL
+                                            || setlocale_single (cat, last_try) == NULL)
+                                          warn = 1;
+                                      }
+                                  }
+                              }
+#    if HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* MacOS X 10.5 or newer */
+                        CFRelease (prefArray);
+#    elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.4 or newer */
+                          }
+#    endif
+#   else
+                        const char *last_try =
+                          get_main_locale_with_same_language (name);
+
+                        if (last_try == NULL
+                            || setlocale_single (cat, last_try) == NULL)
+                          warn = 1;
+#   endif
+                      }
+                    else
+                      {
+                        /* For LC_NUMERIC, the application should use the locale
+                           properties kCFLocaleDecimalSeparator,
+                           kCFLocaleGroupingSeparator.
+                           For LC_TIME, the application should use the locale
+                           property kCFLocaleCalendarIdentifier.
+                           For LC_COLLATE, the application should use the locale
+                           properties kCFLocaleCollationIdentifier,
+                           kCFLocaleCollatorIdentifier.
+                           For LC_MONETARY, the application should use the locale
+                           properties kCFLocaleCurrencySymbol,
+                           kCFLocaleCurrencyCode.
+                           But since most applications don't have macOS specific
+                           code like this, try an existing locale with the same
+                           territory.  */
+                        const char *last_try =
+                          get_main_locale_with_same_territory (name);
+
+                        if (last_try == NULL
+                            || setlocale_single (cat, last_try) == NULL)
+                          warn = 1;
+                      }
+
+                    if (warn)
+                      {
+                        /* Warn only if the environment variable
+                           SETLOCALE_VERBOSE is set.  Otherwise these warnings
+                           are just annoyances, since normal users won't invoke
+                           'localedef'.  */
+                        const char *verbose = getenv ("SETLOCALE_VERBOSE");
+                        if (verbose != NULL && verbose[0] != '\0')
+                          fprintf (stderr,
+                                   "Warning: Failed to set locale category %s to %s.\n",
+                                   category_to_name (cat), name);
+                      }
+                  }
+#  else
+                  goto fail;
+#  endif
+            }
+
+          /* All steps were successful.  */
+          free (saved_locale);
+          return setlocale (LC_ALL, NULL);
+
+        fail:
+          if (saved_locale[0] != '\0') /* don't risk an endless recursion */
+            setlocale (LC_ALL, saved_locale);
+          free (saved_locale);
+          return NULL;
+        }
+      else
+        {
+          const char *name =
+            gl_locale_name_environ (category, category_to_name (category));
+          if (name == NULL)
+            name = gl_locale_name_default ();
+
+          return setlocale_single (category, name);
+        }
+    }
+  else
+    {
+#  if defined _WIN32 && ! defined __CYGWIN__
+      if (category == LC_ALL && locale != NULL && strchr (locale, '.') != NULL)
+        {
+          char *saved_locale;
+
+          /* Back up the old locale.  */
+          saved_locale = setlocale (LC_ALL, NULL);
+          if (saved_locale == NULL)
+            return NULL;
+          saved_locale = strdup (saved_locale);
+          if (saved_locale == NULL)
+            return NULL;
+
+          if (setlocale_unixlike (LC_ALL, locale) == NULL)
+            {
+              free (saved_locale);
+              return NULL;
+            }
+
+          /* On native Windows, setlocale(LC_ALL,...) may succeed but set the
+             LC_CTYPE category to an invalid value ("C") when it does not
+             support the specified encoding.  Report a failure instead.  */
+          if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+            {
+              if (saved_locale[0] != '\0') /* don't risk an endless recursion */
+                setlocale (LC_ALL, saved_locale);
+              free (saved_locale);
+              return NULL;
+            }
+
+          /* It was really successful.  */
+          free (saved_locale);
+          return setlocale (LC_ALL, NULL);
+        }
+      else
+#  endif
+        return setlocale_single (category, locale);
+    }
+}
+
+# endif /* NEED_SETLOCALE_IMPROVED */
+
+#endif
deleted file mode 120000 (symlink)
index bd3172903ed2bcef0d1448600dcea047f81804e9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/setsockopt.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..42cc3dcc16c845a582a3fd14ff8eab4a9cc3d33e
--- /dev/null
@@ -0,0 +1,65 @@
+/* setsockopt.c --- wrappers for Windows setsockopt function
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get struct timeval. */
+#include <sys/time.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#undef setsockopt
+
+int
+rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
+{
+  SOCKET sock = FD_TO_SOCKET (fd);
+  int r;
+
+  if (sock == INVALID_SOCKET)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  else
+    {
+      if (level == SOL_SOCKET
+          && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
+        {
+          const struct timeval *tv = optval;
+          int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000;
+          optval = &milliseconds;
+          r = setsockopt (sock, level, optname, optval, sizeof (int));
+        }
+      else
+        {
+          r = setsockopt (sock, level, optname, optval, optlen);
+        }
+
+      if (r < 0)
+        set_winsock_errno ();
+
+      return r;
+    }
+}
deleted file mode 120000 (symlink)
index 3ccdc30b27bf89bd5219f332b204120542fc3f82..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/signature.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d2a24622210cafbd16410e39c1b7bdf8dca17d88
--- /dev/null
@@ -0,0 +1,48 @@
+/* Macro for checking that a function declaration is compliant.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef SIGNATURE_CHECK
+
+/* Check that the function FN takes the specified arguments ARGS with
+   a return type of RET.  This header is designed to be included after
+   <config.h> and the one system header that is supposed to contain
+   the function being checked, but prior to any other system headers
+   that are necessary for the unit test.  Therefore, this file does
+   not include any system headers, nor reference anything outside of
+   the macro arguments.  For an example, if foo.h should provide:
+
+   extern int foo (char, float);
+
+   then the unit test named test-foo.c would start out with:
+
+   #include <config.h>
+   #include <foo.h>
+   #include "signature.h"
+   SIGNATURE_CHECK (foo, int, (char, float));
+   #include <other.h>
+   ...
+*/
+# define SIGNATURE_CHECK(fn, ret, args) \
+  SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
+
+/* Necessary to allow multiple SIGNATURE_CHECK lines in a unit test.
+   Note that the checks must not occupy the same line.  */
+# define SIGNATURE_CHECK1(fn, ret, args, id) \
+  SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */
+# define SIGNATURE_CHECK2(fn, ret, args, id) \
+  _GL_UNUSED static ret (*signature_check ## id) args = fn
+
+#endif /* SIGNATURE_CHECK */
deleted file mode 120000 (symlink)
index 6da585e5a33971cda65aa17272bcaee77cfa1cb4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/signed-nan.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..18a550a7515e0b26e1ecda2772fe99d910a13cff
--- /dev/null
@@ -0,0 +1,88 @@
+/* Macros for quiet not-a-number.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SIGNED_NAN_H
+#define _SIGNED_NAN_H
+
+#include <math.h>
+
+#include "nan.h"
+
+
+/* Returns a quiet 'float' NaN with sign bit == 0.  */
+_GL_UNUSED static float
+positive_NaNf ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  float volatile nan = NaNf ();
+  return (signbit (nan) ? - nan : nan);
+}
+
+/* Returns a quiet 'float' NaN with sign bit == 1.  */
+_GL_UNUSED static float
+negative_NaNf ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  float volatile nan = NaNf ();
+  return (signbit (nan) ? nan : - nan);
+}
+
+
+/* Returns a quiet 'double' NaN with sign bit == 0.  */
+_GL_UNUSED static double
+positive_NaNd ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  double volatile nan = NaNd ();
+  return (signbit (nan) ? - nan : nan);
+}
+
+/* Returns a quiet 'double' NaN with sign bit == 1.  */
+_GL_UNUSED static double
+negative_NaNd ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  double volatile nan = NaNd ();
+  return (signbit (nan) ? nan : - nan);
+}
+
+
+/* Returns a quiet 'long double' NaN with sign bit == 0.  */
+_GL_UNUSED static long double
+positive_NaNl ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  long double volatile nan = NaNl ();
+  return (signbit (nan) ? - nan : nan);
+}
+
+/* Returns a quiet 'long double' NaN with sign bit == 1.  */
+_GL_UNUSED static long double
+negative_NaNl ()
+{
+  /* 'volatile' works around a GCC bug:
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655>  */
+  long double volatile nan = NaNl ();
+  return (signbit (nan) ? nan : - nan);
+}
+
+
+#endif /* _SIGNED_NAN_H */
deleted file mode 120000 (symlink)
index e20b4b268ab297368cecce848f56cd2ca47a8e90..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/signed-snan.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7e6483a7618e0a91772d0a1a68bca135d74bafd6
--- /dev/null
@@ -0,0 +1,142 @@
+/* Macros for signalling not-a-number.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SIGNED_SNAN_H
+#define _SIGNED_SNAN_H
+
+#include "signed-nan.h"
+#include "snan.h"
+
+
+#if HAVE_SNANF
+
+/* Returns a signalling 'float' NaN with sign bit == 0 in memory.  */
+_GL_UNUSED static memory_float
+memory_positive_SNaNf ()
+{
+  return construct_memory_SNaNf (positive_NaNf ());
+}
+
+/* Returns a signalling 'float' NaN with sign bit == 1 in memory.  */
+_GL_UNUSED static memory_float
+memory_negative_SNaNf ()
+{
+  return construct_memory_SNaNf (negative_NaNf ());
+}
+
+/* Note: On 32-bit x86 processors, as well as on x86_64 processors with
+   CC="gcc -mfpmath=387", the following functions may return a quiet NaN
+   instead.  Use the functions with 'memory_' prefix if you need to avoid this.
+   See <https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00060.html>
+   for details.  */
+
+/* Returns a signalling 'float' NaN with sign bit == 0.  */
+_GL_UNUSED static float
+positive_SNaNf ()
+{
+  return memory_positive_SNaNf ().value;
+}
+
+/* Returns a signalling 'float' NaN with sign bit == 1.  */
+_GL_UNUSED static float
+negative_SNaNf ()
+{
+  return memory_negative_SNaNf ().value;
+}
+
+#endif
+
+
+#if HAVE_SNAND
+
+/* Returns a signalling 'double' NaN with sign bit == 0 in memory.  */
+_GL_UNUSED static memory_double
+memory_positive_SNaNd ()
+{
+  return construct_memory_SNaNd (positive_NaNd ());
+}
+
+/* Returns a signalling 'double' NaN with sign bit == 1 in memory.  */
+_GL_UNUSED static memory_double
+memory_negative_SNaNd ()
+{
+  return construct_memory_SNaNd (negative_NaNd ());
+}
+
+/* Note: On 32-bit x86 processors, as well as on x86_64 processors with
+   CC="gcc -mfpmath=387", the following functions may return a quiet NaN
+   instead.  Use the functions with 'memory_' prefix if you need to avoid this.
+   See <https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00060.html>
+   for details.  */
+
+/* Returns a signalling 'double' NaN with sign bit == 0.  */
+_GL_UNUSED static double
+positive_SNaNd ()
+{
+  return memory_positive_SNaNd ().value;
+}
+
+/* Returns a signalling 'double' NaN with sign bit == 1.  */
+_GL_UNUSED static double
+negative_SNaNd ()
+{
+  return memory_negative_SNaNd ().value;
+}
+
+#endif
+
+
+#if HAVE_SNANL
+
+/* Returns a signalling 'long double' NaN with sign bit == 0 in memory.  */
+_GL_UNUSED static memory_long_double
+memory_positive_SNaNl ()
+{
+  return construct_memory_SNaNl (positive_NaNl ());
+}
+
+/* Returns a signalling 'long double' NaN with sign bit == 1 in memory.  */
+_GL_UNUSED static memory_long_double
+memory_negative_SNaNl ()
+{
+  return construct_memory_SNaNl (negative_NaNl ());
+}
+
+/* Note: On 32-bit x86 processors, as well as on x86_64 processors with
+   CC="gcc -mfpmath=387", if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE is 1, the
+   following functions may return a quiet NaN instead.  Use the functions
+   with 'memory_' prefix if you need to avoid this.  See
+   <https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00060.html>
+   for details.  */
+
+/* Returns a signalling 'long double' NaN with sign bit == 0.  */
+_GL_UNUSED static long double
+positive_SNaNl ()
+{
+  return memory_positive_SNaNl ().value;
+}
+
+/* Returns a signalling 'long double' NaN with sign bit == 1.  */
+_GL_UNUSED static long double
+negative_SNaNl ()
+{
+  return memory_negative_SNaNl ().value;
+}
+
+#endif
+
+
+#endif /* _SIGNED_SNAN_H */
deleted file mode 120000 (symlink)
index 92cb969d50954df7ac8db578dd67580611c91fc9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sleep.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1cab9aa6139c249869a6dd9bbae916d0304f2fa8
--- /dev/null
@@ -0,0 +1,74 @@
+/* Pausing execution of the current thread.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2007.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <limits.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+
+unsigned int
+sleep (unsigned int seconds)
+{
+  unsigned int remaining;
+
+  /* Sleep for 1 second many times, because
+       1. Sleep is not interruptible by Ctrl-C,
+       2. we want to avoid arithmetic overflow while multiplying with 1000.  */
+  for (remaining = seconds; remaining > 0; remaining--)
+    Sleep (1000);
+
+  return remaining;
+}
+
+#elif HAVE_SLEEP
+
+# undef sleep
+
+/* Guarantee unlimited sleep and a reasonable return value.  Cygwin
+   1.5.x rejects attempts to sleep more than 49.7 days (2**32
+   milliseconds), but uses uninitialized memory which results in a
+   garbage answer.  Similarly, Linux 2.6.9 with glibc 2.3.4 has a too
+   small return value when asked to sleep more than 24.85 days.  */
+unsigned int
+rpl_sleep (unsigned int seconds)
+{
+  /* This requires int larger than 16 bits.  */
+  static_assert (UINT_MAX / 24 / 24 / 60 / 60);
+  const unsigned int limit = 24 * 24 * 60 * 60;
+  while (limit < seconds)
+    {
+      unsigned int result;
+      seconds -= limit;
+      result = sleep (limit);
+      if (result)
+        return seconds + result;
+    }
+  return sleep (seconds);
+}
+
+#else /* !HAVE_SLEEP */
+
+ #error "Please port gnulib sleep.c to your platform, possibly using usleep() or select(), then report this to bug-gnulib."
+
+#endif
deleted file mode 120000 (symlink)
index 13a5560472dbf171d422510f8719160f8a7193c1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/snan.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..95235040461c51169c3b750ea090b87401f39c24
--- /dev/null
@@ -0,0 +1,276 @@
+/* Macros for signalling not-a-number.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SNAN_H
+#define _SNAN_H
+
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+
+#include "nan.h"
+
+
+/* The bit that distinguishes a quiet NaN from a signalling NaN is, according to
+   <https://en.wikipedia.org/wiki/NaN#Encoding>, the most significant bit of the
+   mantissa field.
+   According to <https://en.wikipedia.org/wiki/IEEE_754#Formats>, this is the
+   next bit, right below the bit 0 of the exponent.
+   This bit is
+     *  == 0 to indicate a quiet NaN or Infinity,
+        == 1 to indicate a signalling NaN,
+        on these CPUs: hppa, mips (*), sh4.
+     *  == 1 to indicate a quiet NaN,
+        == 0 to indicate a signalling NaN or Infinity,
+        on all other CPUs.
+        On these platforms, additionally a signalling NaN must have some other
+        mantissa bit == 1, because when all exponent bits are == 1 and all
+        mantissa bits are == 0, the number denotes ±Infinity.
+        This NaN encoding is specified by IEEE 754-2008 § 6.2.1.
+
+   (*) On mips CPUs, it depends on the CPU model.  The classical behaviour is
+   as indicated above.  On some newer models, it's like on the other CPUs.
+   On some (but not all!) models this meta-info can be determined from two
+   special CPU registers: If the "Floating Point Implementation Register" (fir)
+   bit 23, also known as Has2008 bit, is set, the "Floating Point Control and
+   Status Register" (fcsr) bit 18, also known as the NAN2008 bit, has the value
+     - 0 for the classical behaviour,
+     - 1 for like on the other CPUs.
+   Both of these bits are read-only.
+   This module has determined the behaviour at configure time and defines the
+   C macros MIPS_NAN2008_FLOAT, MIPS_NAN2008_DOUBLE, MIPS_NAN2008_LONG_DOUBLE
+   accordingly.  */
+
+
+/* 'float' = IEEE 754 single-precision
+   <https://en.wikipedia.org/wiki/Single-precision_floating-point_format>  */
+
+#define NWORDS \
+  ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { float value; unsigned int word[NWORDS]; } memory_float;
+
+#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
+
+# define HAVE_SNANF 1
+
+_GL_UNUSED static memory_float
+construct_memory_SNaNf (float quiet_value)
+{
+  memory_float m;
+  m.value = quiet_value;
+  /* Turn the quiet NaN into a signalling NaN.  */
+  #if FLT_EXPBIT0_BIT > 0
+    m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1);
+  #else
+    m.word[FLT_EXPBIT0_WORD + (FLT_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
+      ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
+  #endif
+  /* Set some arbitrary mantissa bit.  */
+  if (FLT_EXPBIT0_WORD < NWORDS / 2) /* NWORDS > 1 and big endian */
+    m.word[FLT_EXPBIT0_WORD + 1] |= (unsigned int) 1 << FLT_EXPBIT0_BIT;
+  else /* NWORDS == 1 or little endian */
+    m.word[0] |= (unsigned int) 1;
+  return m;
+}
+
+/* Returns a signalling 'float' NaN in memory.  */
+_GL_UNUSED static memory_float
+memory_SNaNf ()
+{
+  return construct_memory_SNaNf (NaNf ());
+}
+
+_GL_UNUSED static float
+construct_SNaNf (float quiet_value)
+{
+  return construct_memory_SNaNf (quiet_value).value;
+}
+
+/* Returns a signalling 'float' NaN.
+   Note: On 32-bit x86 processors, as well as on x86_64 processors with
+   CC="gcc -mfpmath=387", this function may return a quiet NaN instead.
+   Use memory_SNaNf() if you need to avoid this.  See
+   <https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00060.html>
+   for details.  */
+_GL_UNUSED static float
+SNaNf ()
+{
+  return memory_SNaNf ().value;
+}
+
+#endif
+
+#undef NWORDS
+
+
+/* 'double' = IEEE 754 double-precision
+   <https://en.wikipedia.org/wiki/Double-precision_floating-point_format>  */
+
+#define NWORDS \
+  ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { double value; unsigned int word[NWORDS]; } memory_double;
+
+#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
+
+# define HAVE_SNAND 1
+
+_GL_UNUSED static memory_double
+construct_memory_SNaNd (double quiet_value)
+{
+  memory_double m;
+  m.value = quiet_value;
+  /* Turn the quiet NaN into a signalling NaN.  */
+  #if DBL_EXPBIT0_BIT > 0
+    m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1);
+  #else
+    m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
+      ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
+  #endif
+  /* Set some arbitrary mantissa bit.  */
+  m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
+    |= (unsigned int) 1 << DBL_EXPBIT0_BIT;
+  return m;
+}
+
+/* Returns a signalling 'double' NaN in memory.  */
+_GL_UNUSED static memory_double
+memory_SNaNd ()
+{
+  return construct_memory_SNaNd (NaNd ());
+}
+
+_GL_UNUSED static double
+construct_SNaNd (double quiet_value)
+{
+  return construct_memory_SNaNd (quiet_value).value;
+}
+
+/* Returns a signalling 'double' NaN.
+   Note: On 32-bit x86 processors, as well as on x86_64 processors with
+   CC="gcc -mfpmath=387", this function may return a quiet NaN instead.
+   Use memory_SNaNf() if you need to avoid this.  See
+   <https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00060.html>
+   for details.  */
+_GL_UNUSED static double
+SNaNd ()
+{
+  return memory_SNaNd ().value;
+}
+
+#endif
+
+#undef NWORDS
+
+
+/* 'long double' =
+   * if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE:
+     IEEE 754 double-precision
+     <https://en.wikipedia.org/wiki/Double-precision_floating-point_format>
+   * Otherwise:
+     - On i386, x86_64, ia64:
+       80-bits extended-precision
+       <https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format>
+     - On alpha, arm64, loongarch64, mips64, riscv64, s390x, sparc64:
+       IEEE 754 quadruple-precision
+       <https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format#IEEE_754_quadruple-precision_binary_floating-point_format:_binary128>
+     - On powerpc, powerpc64, powerpc64le:
+       2x64-bits double-double
+       <https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format#Double-double_arithmetic>
+     - On m68k:
+       80-bits extended-precision, padded to 96 bits, with non-IEEE exponent
+ */
+
+#define NWORDS \
+  ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { long double value; unsigned int word[NWORDS]; }
+        memory_long_double;
+
+#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
+
+# define HAVE_SNANL 1
+
+_GL_UNUSED static memory_long_double
+construct_memory_SNaNl (long double quiet_value)
+{
+  memory_long_double m;
+  m.value = quiet_value;
+  #if defined __powerpc__ && LDBL_MANT_DIG == 106
+    /* This is PowerPC "double double", a pair of two doubles.  Inf and NaN are
+       represented as the corresponding 64-bit IEEE values in the first double;
+       the second is ignored.  Manipulate only the first double.  */
+    #define HNWORDS \
+      ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+  #else
+    #define HNWORDS NWORDS
+  #endif
+  /* Turn the quiet NaN into a signalling NaN.  */
+  #if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+  /* In this representation, the leading 1 of the mantissa is explicitly
+     stored.  */
+   #if LDBL_EXPBIT0_BIT > 1
+    m.word[LDBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (LDBL_EXPBIT0_BIT - 2);
+   #else
+    m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < HNWORDS / 2 ? 1 : - 1)]
+      ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 2);
+   #endif
+  #else
+  /* In this representation, the leading 1 of the mantissa is implicit.  */
+   #if LDBL_EXPBIT0_BIT > 0
+    m.word[LDBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (LDBL_EXPBIT0_BIT - 1);
+   #else
+    m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < HNWORDS / 2 ? 1 : - 1)]
+      ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
+   #endif
+  #endif
+  /* Set some arbitrary mantissa bit.  */
+  m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < HNWORDS / 2 ? 1 : - 1)]
+    |= (unsigned int) 1 << LDBL_EXPBIT0_BIT;
+  #undef HNWORDS
+  return m;
+}
+
+/* Returns a signalling 'long double' NaN in memory.  */
+_GL_UNUSED static memory_long_double
+memory_SNaNl ()
+{
+  return construct_memory_SNaNl (NaNl ());
+}
+
+_GL_UNUSED static long double
+construct_SNaNl (long double quiet_value)
+{
+  return construct_memory_SNaNl (quiet_value).value;
+}
+
+/* Returns a signalling 'long double' NaN.
+   Note: On 32-bit x86 processors, as well as on x86_64 processors with
+   CC="gcc -mfpmath=387", if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE is 1, this
+   function may return a quiet NaN instead.  Use memory_SNaNf() if you
+   need to avoid this.  See
+   <https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00060.html>
+   for details.  */
+_GL_UNUSED static long double
+SNaNl ()
+{
+  return memory_SNaNl ().value;
+}
+
+#endif
+
+#undef NWORDS
+
+
+#endif /* _SNAN_H */
deleted file mode 120000 (symlink)
index 7ef7e689bb6946eb898a5ed9927aec43240c304f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/socket.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6061a3fb231b002fd394b8fe8a1896c6c0d14102
--- /dev/null
@@ -0,0 +1,53 @@
+/* socket.c --- wrappers for Windows socket function
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini */
+
+#include <config.h>
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <sys/socket.h>
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+#include "sockets.h"
+
+/* Don't assume that UNICODE is defined.  */
+#undef WSASocket
+#define WSASocket WSASocketW
+
+int
+rpl_socket (int domain, int type, int protocol)
+{
+  SOCKET fh;
+
+  gl_sockets_startup (SOCKETS_1_1);
+
+  /* We have to use WSASocket() to create non-overlapped IO sockets.
+     Overlapped IO sockets cannot be used with read/write.  */
+  fh = WSASocket (domain, type, protocol, NULL, 0, 0);
+
+  if (fh == INVALID_SOCKET)
+    {
+      set_winsock_errno ();
+      return -1;
+    }
+  else
+    return SOCKET_TO_FD (fh);
+}
deleted file mode 120000 (symlink)
index 3003bebd811e7377601846023e8e12312ea87d21..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/str-two-way.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cf85e26817ca8b1c18ade0236e807bd0aa6084a2
--- /dev/null
@@ -0,0 +1,452 @@
+/* Byte-wise substring search, using the Two-Way algorithm.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Written by Eric Blake <ebb9@byu.net>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Before including this file, you need to include <config.h> and
+   <string.h>, and define:
+     RETURN_TYPE             A macro that expands to the return type.
+     AVAILABLE(h, h_l, j, n_l)
+                             A macro that returns nonzero if there are
+                             at least N_L bytes left starting at H[J].
+                             H is 'unsigned char *', H_L, J, and N_L
+                             are 'size_t'; H_L is an lvalue.  For
+                             NUL-terminated searches, H_L can be
+                             modified each iteration to avoid having
+                             to compute the end of H up front.
+
+  For case-insensitivity, you may optionally define:
+     CMP_FUNC(p1, p2, l)     A macro that returns 0 iff the first L
+                             characters of P1 and P2 are equal.
+     CANON_ELEMENT(c)        A macro that canonicalizes an element right after
+                             it has been fetched from one of the two strings.
+                             The argument is an 'unsigned char'; the result
+                             must be an 'unsigned char' as well.
+
+  This file undefines the macros documented above, and defines
+  LONG_NEEDLE_THRESHOLD.
+*/
+
+#include <limits.h>
+#include <stdint.h>
+
+/* We use the Two-Way string matching algorithm (also known as
+   Chrochemore-Perrin), which guarantees linear complexity with
+   constant space.  Additionally, for long needles, we also use a bad
+   character shift table similar to the Boyer-Moore algorithm to
+   achieve improved (potentially sub-linear) performance.
+
+   See https://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260,
+   https://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm,
+   https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf
+*/
+
+/* Point at which computing a bad-byte shift table is likely to be
+   worthwhile.  Small needles should not compute a table, since it
+   adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a
+   speedup no greater than a factor of NEEDLE_LEN.  The larger the
+   needle, the better the potential performance gain.  On the other
+   hand, on non-POSIX systems with CHAR_BIT larger than eight, the
+   memory required for the table is prohibitive.  */
+#if CHAR_BIT < 10
+# define LONG_NEEDLE_THRESHOLD 32U
+#else
+# define LONG_NEEDLE_THRESHOLD SIZE_MAX
+#endif
+
+#ifndef MAX
+# define MAX(a, b) ((a < b) ? (b) : (a))
+#endif
+
+#ifndef CANON_ELEMENT
+# define CANON_ELEMENT(c) c
+#endif
+#ifndef CMP_FUNC
+# define CMP_FUNC memcmp
+#endif
+
+/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN.
+   Return the index of the first byte in the right half, and set
+   *PERIOD to the global period of the right half.
+
+   The global period of a string is the smallest index (possibly its
+   length) at which all remaining bytes in the string are repetitions
+   of the prefix (the last repetition may be a subset of the prefix).
+
+   When NEEDLE is factored into two halves, a local period is the
+   length of the smallest word that shares a suffix with the left half
+   and shares a prefix with the right half.  All factorizations of a
+   non-empty NEEDLE have a local period of at least 1 and no greater
+   than NEEDLE_LEN.
+
+   A critical factorization has the property that the local period
+   equals the global period.  All strings have at least one critical
+   factorization with the left half smaller than the global period.
+   And while some strings have more than one critical factorization,
+   it is provable that with an ordered alphabet, at least one of the
+   critical factorizations corresponds to a maximal suffix.
+
+   Given an ordered alphabet, a critical factorization can be computed
+   in linear time, with 2 * NEEDLE_LEN comparisons, by computing the
+   shorter of two ordered maximal suffixes.  The ordered maximal
+   suffixes are determined by lexicographic comparison while tracking
+   periodicity.  */
+static size_t
+critical_factorization (const unsigned char *needle, size_t needle_len,
+                        size_t *period)
+{
+  /* Index of last byte of left half, or SIZE_MAX.  */
+  size_t max_suffix, max_suffix_rev;
+  size_t j; /* Index into NEEDLE for current candidate suffix.  */
+  size_t k; /* Offset into current period.  */
+  size_t p; /* Intermediate period.  */
+  unsigned char a, b; /* Current comparison bytes.  */
+
+  /* Special case NEEDLE_LEN of 1 or 2 (all callers already filtered
+     out 0-length needles.  */
+  if (needle_len < 3)
+    {
+      *period = 1;
+      return needle_len - 1;
+    }
+
+  /* Invariants:
+     0 <= j < NEEDLE_LEN - 1
+     -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed)
+     min(max_suffix, max_suffix_rev) < global period of NEEDLE
+     1 <= p <= global period of NEEDLE
+     p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j]
+     1 <= k <= p
+  */
+
+  /* Perform lexicographic search.  */
+  max_suffix = SIZE_MAX;
+  j = 0;
+  k = p = 1;
+  while (j + k < needle_len)
+    {
+      a = CANON_ELEMENT (needle[j + k]);
+      b = CANON_ELEMENT (needle[max_suffix + k]);
+      if (a < b)
+        {
+          /* Suffix is smaller, period is entire prefix so far.  */
+          j += k;
+          k = 1;
+          p = j - max_suffix;
+        }
+      else if (a == b)
+        {
+          /* Advance through repetition of the current period.  */
+          if (k != p)
+            ++k;
+          else
+            {
+              j += p;
+              k = 1;
+            }
+        }
+      else /* b < a */
+        {
+          /* Suffix is larger, start over from current location.  */
+          max_suffix = j++;
+          k = p = 1;
+        }
+    }
+  *period = p;
+
+  /* Perform reverse lexicographic search.  */
+  max_suffix_rev = SIZE_MAX;
+  j = 0;
+  k = p = 1;
+  while (j + k < needle_len)
+    {
+      a = CANON_ELEMENT (needle[j + k]);
+      b = CANON_ELEMENT (needle[max_suffix_rev + k]);
+      if (b < a)
+        {
+          /* Suffix is smaller, period is entire prefix so far.  */
+          j += k;
+          k = 1;
+          p = j - max_suffix_rev;
+        }
+      else if (a == b)
+        {
+          /* Advance through repetition of the current period.  */
+          if (k != p)
+            ++k;
+          else
+            {
+              j += p;
+              k = 1;
+            }
+        }
+      else /* a < b */
+        {
+          /* Suffix is larger, start over from current location.  */
+          max_suffix_rev = j++;
+          k = p = 1;
+        }
+    }
+
+  /* Choose the shorter suffix.  Return the index of the first byte of
+     the right half, rather than the last byte of the left half.
+
+     For some examples, 'banana' has two critical factorizations, both
+     exposed by the two lexicographic extreme suffixes of 'anana' and
+     'nana', where both suffixes have a period of 2.  On the other
+     hand, with 'aab' and 'bba', both strings have a single critical
+     factorization of the last byte, with the suffix having a period
+     of 1.  While the maximal lexicographic suffix of 'aab' is 'b',
+     the maximal lexicographic suffix of 'bba' is 'ba', which is not a
+     critical factorization.  Conversely, the maximal reverse
+     lexicographic suffix of 'a' works for 'bba', but not 'ab' for
+     'aab'.  The shorter suffix of the two will always be a critical
+     factorization.  */
+  if (max_suffix_rev + 1 < max_suffix + 1)
+    return max_suffix + 1;
+  *period = p;
+  return max_suffix_rev + 1;
+}
+
+/* Return the first location of non-empty NEEDLE within HAYSTACK, or
+   NULL.  HAYSTACK_LEN is the minimum known length of HAYSTACK.  This
+   method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD.
+   Performance is guaranteed to be linear, with an initialization cost
+   of 2 * NEEDLE_LEN comparisons.
+
+   If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
+   most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.
+   If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
+   HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.  */
+static RETURN_TYPE _GL_ATTRIBUTE_PURE
+two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
+                      const unsigned char *needle, size_t needle_len)
+{
+  size_t i; /* Index into current byte of NEEDLE.  */
+  size_t j; /* Index into current window of HAYSTACK.  */
+  size_t period; /* The period of the right half of needle.  */
+  size_t suffix; /* The index of the right half of needle.  */
+
+  /* Factor the needle into two halves, such that the left half is
+     smaller than the global period, and the right half is
+     periodic (with a period as large as NEEDLE_LEN - suffix).  */
+  suffix = critical_factorization (needle, needle_len, &period);
+
+  /* Perform the search.  Each iteration compares the right half
+     first.  */
+  if (CMP_FUNC (needle, needle + period, suffix) == 0)
+    {
+      /* Entire needle is periodic; a mismatch in the left half can
+         only advance by the period, so use memory to avoid rescanning
+         known occurrences of the period in the right half.  */
+      size_t memory = 0;
+      j = 0;
+      while (AVAILABLE (haystack, haystack_len, j, needle_len))
+        {
+          /* Scan for matches in right half.  */
+          i = MAX (suffix, memory);
+          while (i < needle_len && (CANON_ELEMENT (needle[i])
+                                    == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (memory < i + 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i + 1 < memory + 1)
+                return (RETURN_TYPE) (haystack + j);
+              /* No match, so remember how many repetitions of period
+                 on the right half were scanned.  */
+              j += period;
+              memory = needle_len - period;
+            }
+          else
+            {
+              j += i - suffix + 1;
+              memory = 0;
+            }
+        }
+    }
+  else
+    {
+      /* The two halves of needle are distinct; no extra memory is
+         required, and any mismatch results in a maximal shift.  */
+      period = MAX (suffix, needle_len - suffix) + 1;
+      j = 0;
+      while (AVAILABLE (haystack, haystack_len, j, needle_len))
+        {
+          /* Scan for matches in right half.  */
+          i = suffix;
+          while (i < needle_len && (CANON_ELEMENT (needle[i])
+                                    == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
+                                       == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i == SIZE_MAX)
+                return (RETURN_TYPE) (haystack + j);
+              j += period;
+            }
+          else
+            j += i - suffix + 1;
+        }
+    }
+  return NULL;
+}
+
+/* Return the first location of non-empty NEEDLE within HAYSTACK, or
+   NULL.  HAYSTACK_LEN is the minimum known length of HAYSTACK.  This
+   method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN.
+   Performance is guaranteed to be linear, with an initialization cost
+   of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations.
+
+   If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
+   most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching,
+   and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible.
+   If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
+   HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and
+   sublinear performance is not possible.  */
+static RETURN_TYPE _GL_ATTRIBUTE_PURE
+two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
+                     const unsigned char *needle, size_t needle_len)
+{
+  size_t i; /* Index into current byte of NEEDLE.  */
+  size_t j; /* Index into current window of HAYSTACK.  */
+  size_t period; /* The period of the right half of needle.  */
+  size_t suffix; /* The index of the right half of needle.  */
+  size_t shift_table[1U << CHAR_BIT]; /* See below.  */
+
+  /* Factor the needle into two halves, such that the left half is
+     smaller than the global period, and the right half is
+     periodic (with a period as large as NEEDLE_LEN - suffix).  */
+  suffix = critical_factorization (needle, needle_len, &period);
+
+  /* Populate shift_table.  For each possible byte value c,
+     shift_table[c] is the distance from the last occurrence of c to
+     the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
+     shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0.  */
+  for (i = 0; i < 1U << CHAR_BIT; i++)
+    shift_table[i] = needle_len;
+  for (i = 0; i < needle_len; i++)
+    shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
+
+  /* Perform the search.  Each iteration compares the right half
+     first.  */
+  if (CMP_FUNC (needle, needle + period, suffix) == 0)
+    {
+      /* Entire needle is periodic; a mismatch in the left half can
+         only advance by the period, so use memory to avoid rescanning
+         known occurrences of the period in the right half.  */
+      size_t memory = 0;
+      size_t shift;
+      j = 0;
+      while (AVAILABLE (haystack, haystack_len, j, needle_len))
+        {
+          /* Check the last byte first; if it does not match, then
+             shift to the next possible match location.  */
+          shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
+          if (0 < shift)
+            {
+              if (memory && shift < period)
+                {
+                  /* Since needle is periodic, but the last period has
+                     a byte out of place, there can be no match until
+                     after the mismatch.  */
+                  shift = needle_len - period;
+                }
+              memory = 0;
+              j += shift;
+              continue;
+            }
+          /* Scan for matches in right half.  The last byte has
+             already been matched, by virtue of the shift table.  */
+          i = MAX (suffix, memory);
+          while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len - 1 <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (memory < i + 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i + 1 < memory + 1)
+                return (RETURN_TYPE) (haystack + j);
+              /* No match, so remember how many repetitions of period
+                 on the right half were scanned.  */
+              j += period;
+              memory = needle_len - period;
+            }
+          else
+            {
+              j += i - suffix + 1;
+              memory = 0;
+            }
+        }
+    }
+  else
+    {
+      /* The two halves of needle are distinct; no extra memory is
+         required, and any mismatch results in a maximal shift.  */
+      size_t shift;
+      period = MAX (suffix, needle_len - suffix) + 1;
+      j = 0;
+      while (AVAILABLE (haystack, haystack_len, j, needle_len))
+        {
+          /* Check the last byte first; if it does not match, then
+             shift to the next possible match location.  */
+          shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
+          if (0 < shift)
+            {
+              j += shift;
+              continue;
+            }
+          /* Scan for matches in right half.  The last byte has
+             already been matched, by virtue of the shift table.  */
+          i = suffix;
+          while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len - 1 <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
+                                       == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i == SIZE_MAX)
+                return (RETURN_TYPE) (haystack + j);
+              j += period;
+            }
+          else
+            j += i - suffix + 1;
+        }
+    }
+  return NULL;
+}
+
+#undef AVAILABLE
+#undef CANON_ELEMENT
+#undef CMP_FUNC
+#undef MAX
+#undef RETURN_TYPE
deleted file mode 120000 (symlink)
index cf8c1f4e33a4cca6d0fd551812f82e8e5210d97a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strerror_r.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0cd28ade6e60e741f92636478698f05a8d0ad866
--- /dev/null
@@ -0,0 +1,454 @@
+/* strerror_r.c --- POSIX compatible system error routine
+
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+/* Enable declaration of sys_nerr and sys_errlist in <errno.h> on NetBSD.  */
+#define _NETBSD_SOURCE 1
+
+/* Specification.  */
+#include <string.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#if !HAVE_SNPRINTF
+# include <stdarg.h>
+#endif
+
+#include "strerror-override.h"
+
+#if STRERROR_R_CHAR_P
+
+# if HAVE___XPG_STRERROR_R
+_GL_EXTERN_C int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
+# endif
+
+#elif HAVE_DECL_STRERROR_R
+
+/* The system's strerror_r function's API is OK, except that its third argument
+   is 'int', not 'size_t', or its return type is wrong.  */
+
+# include <limits.h>
+
+#else
+
+/* Use the system's strerror().  Exclude glibc and cygwin because the
+   system strerror_r has the wrong return type, and cygwin 1.7.9
+   strerror_r clobbers strerror.  */
+# undef strerror
+
+# if defined __NetBSD__ || defined __hpux || (defined _WIN32 && !defined __CYGWIN__) || defined __sgi || (defined __sun && !defined _LP64) || defined __CYGWIN__
+
+/* No locking needed.  */
+
+/* Get catgets internationalization functions.  */
+#  if HAVE_CATGETS
+#   include <nl_types.h>
+#  endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Get sys_nerr, sys_errlist on HP-UX (otherwise only declared in C++ mode).
+   Get sys_nerr, sys_errlist on IRIX (otherwise only declared with _SGIAPI).  */
+#  if defined __hpux || defined __sgi
+extern int sys_nerr;
+extern char *sys_errlist[];
+#  endif
+
+/* Get sys_nerr on Solaris.  */
+#  if defined __sun && !defined _LP64
+extern int sys_nerr;
+#  endif
+
+#ifdef __cplusplus
+}
+#endif
+
+# else
+
+#  include "glthread/lock.h"
+
+/* This lock protects the buffer returned by strerror().  We assume that
+   no other uses of strerror() exist in the program.  */
+gl_lock_define_initialized(static, strerror_lock)
+
+# endif
+
+#endif
+
+/* On MSVC, there is no snprintf() function, just a _snprintf().
+   It is of lower quality, but sufficient for the simple use here.
+   We only have to make sure to NUL terminate the result (_snprintf
+   does not NUL terminate, like strncpy).  */
+#if !HAVE_SNPRINTF
+static int
+local_snprintf (char *buf, size_t buflen, const char *format, ...)
+{
+  va_list args;
+  int result;
+
+  va_start (args, format);
+  result = _vsnprintf (buf, buflen, format, args);
+  va_end (args);
+  if (buflen > 0 && (result < 0 || result >= buflen))
+    buf[buflen - 1] = '\0';
+  return result;
+}
+# undef snprintf
+# define snprintf local_snprintf
+#endif
+
+/* Copy as much of MSG into BUF as possible, without corrupting errno.
+   Return 0 if MSG fit in BUFLEN, otherwise return ERANGE.  */
+static int
+safe_copy (char *buf, size_t buflen, const char *msg)
+{
+  size_t len = strlen (msg);
+  size_t moved = len < buflen ? len : buflen - 1;
+
+  /* Although POSIX lets memmove corrupt errno, we don't
+     know of any implementation where this is a real problem.  */
+  memmove (buf, msg, moved);
+  buf[moved] = '\0';
+  return len < buflen ? 0 : ERANGE;
+}
+
+
+int
+strerror_r (int errnum, char *buf, size_t buflen)
+#undef strerror_r
+{
+  /* Filter this out now, so that rest of this replacement knows that
+     there is room for a non-empty message and trailing NUL.  */
+  if (buflen <= 1)
+    {
+      if (buflen)
+        *buf = '\0';
+      return ERANGE;
+    }
+  *buf = '\0';
+
+  /* Check for gnulib overrides.  */
+  {
+    char const *msg = strerror_override (errnum);
+
+    if (msg)
+      return safe_copy (buf, buflen, msg);
+  }
+
+  {
+    int ret;
+    int saved_errno = errno;
+
+#if STRERROR_R_CHAR_P
+
+    {
+      ret = 0;
+
+# if HAVE___XPG_STRERROR_R
+      ret = __xpg_strerror_r (errnum, buf, buflen);
+      /* ret is 0 upon success, or EINVAL or ERANGE upon failure.  */
+# endif
+
+      if (!*buf)
+        {
+          /* glibc 2.13 ... 2.34 (at least) don't touch buf upon failure.
+             Therefore we have to fall back to strerror_r which, for valid
+             errnum, returns a thread-safe untruncated string.  For invalid
+             errnum, though, it returns a truncated string, which does not
+             allow us to determine whether to return ERANGE or 0.  Thus we
+             need to pass a sufficiently large buffer.  */
+          char stackbuf[80];
+          char *errstring = strerror_r (errnum, stackbuf, sizeof stackbuf);
+          ret = errstring ? safe_copy (buf, buflen, errstring) : errno;
+        }
+    }
+
+#elif HAVE_DECL_STRERROR_R
+
+    if (buflen > INT_MAX)
+      buflen = INT_MAX;
+
+# ifdef __hpux
+    /* On HP-UX 11.31, strerror_r always fails when buflen < 80; it
+       also fails to change buf on EINVAL.  */
+    {
+      char stackbuf[80];
+
+      if (buflen < sizeof stackbuf)
+        {
+          ret = strerror_r (errnum, stackbuf, sizeof stackbuf);
+          if (ret == 0)
+            ret = safe_copy (buf, buflen, stackbuf);
+        }
+      else
+        ret = strerror_r (errnum, buf, buflen);
+    }
+# else
+    ret = strerror_r (errnum, buf, buflen);
+
+    /* Some old implementations may return (-1, EINVAL) instead of EINVAL.
+       But on Haiku, valid error numbers are negative.  */
+#  if !defined __HAIKU__
+    if (ret < 0)
+      ret = errno;
+#  endif
+# endif
+
+# if defined _AIX || defined __HAIKU__
+    /* AIX and Haiku return 0 rather than ERANGE when truncating strings; try
+       again until we are sure we got the entire string.  */
+    if (!ret && strlen (buf) == buflen - 1)
+      {
+        char stackbuf[STACKBUF_LEN];
+        size_t len;
+        strerror_r (errnum, stackbuf, sizeof stackbuf);
+        len = strlen (stackbuf);
+        /* STACKBUF_LEN should have been large enough.  */
+        if (len + 1 == sizeof stackbuf)
+          abort ();
+        if (buflen <= len)
+          ret = ERANGE;
+      }
+# else
+    /* Solaris 10 does not populate buf on ERANGE.  OpenBSD 4.7
+       truncates early on ERANGE rather than return a partial integer.
+       We prefer the maximal string.  We set buf[0] earlier, and we
+       know of no implementation that modifies buf to be an
+       unterminated string, so this strlen should be portable in
+       practice (rather than pulling in a safer strnlen).  */
+    if (ret == ERANGE && strlen (buf) < buflen - 1)
+      {
+        char stackbuf[STACKBUF_LEN];
+
+        /* STACKBUF_LEN should have been large enough.  */
+        if (strerror_r (errnum, stackbuf, sizeof stackbuf) == ERANGE)
+          abort ();
+        safe_copy (buf, buflen, stackbuf);
+      }
+# endif
+
+#else /* strerror_r is not declared.  */
+
+    /* Try to do what strerror (errnum) does, but without clobbering the
+       buffer used by strerror().  */
+
+# if defined __NetBSD__ || defined __hpux || (defined _WIN32 && !defined __CYGWIN__) || defined __CYGWIN__ /* NetBSD, HP-UX, native Windows, Cygwin */
+
+    /* NetBSD:         sys_nerr, sys_errlist are declared through _NETBSD_SOURCE
+                       and <errno.h> above.
+       HP-UX:          sys_nerr, sys_errlist are declared explicitly above.
+       native Windows: sys_nerr, sys_errlist are declared in <stdlib.h>.
+       Cygwin:         sys_nerr, sys_errlist are declared in <errno.h>.  */
+    if (errnum >= 0 && errnum < sys_nerr)
+      {
+#  if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux)
+#   if defined __NetBSD__
+        nl_catd catd = catopen ("libc", NL_CAT_LOCALE);
+        const char *errmsg =
+          (catd != (nl_catd)-1
+           ? catgets (catd, 1, errnum, sys_errlist[errnum])
+           : sys_errlist[errnum]);
+#   endif
+#   if defined __hpux
+        nl_catd catd = catopen ("perror", NL_CAT_LOCALE);
+        const char *errmsg =
+          (catd != (nl_catd)-1
+           ? catgets (catd, 1, 1 + errnum, sys_errlist[errnum])
+           : sys_errlist[errnum]);
+#   endif
+#  else
+        const char *errmsg = sys_errlist[errnum];
+#  endif
+        if (errmsg == NULL || *errmsg == '\0')
+          ret = EINVAL;
+        else
+          ret = safe_copy (buf, buflen, errmsg);
+#  if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux)
+        if (catd != (nl_catd)-1)
+          catclose (catd);
+#  endif
+      }
+    else
+      ret = EINVAL;
+
+# elif defined __sgi || (defined __sun && !defined _LP64) /* IRIX, Solaris <= 9 32-bit */
+
+    /* For a valid error number, the system's strerror() function returns
+       a pointer to a not copied string, not to a buffer.  */
+    if (errnum >= 0 && errnum < sys_nerr)
+      {
+        char *errmsg = strerror (errnum);
+
+        if (errmsg == NULL || *errmsg == '\0')
+          ret = EINVAL;
+        else
+          ret = safe_copy (buf, buflen, errmsg);
+      }
+    else
+      ret = EINVAL;
+
+# else
+
+    gl_lock_lock (strerror_lock);
+
+    {
+      char *errmsg = strerror (errnum);
+
+      /* For invalid error numbers, strerror() on
+           - IRIX 6.5 returns NULL,
+           - HP-UX 11 returns an empty string.  */
+      if (errmsg == NULL || *errmsg == '\0')
+        ret = EINVAL;
+      else
+        ret = safe_copy (buf, buflen, errmsg);
+    }
+
+    gl_lock_unlock (strerror_lock);
+
+# endif
+
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+    /* MSVC 14 defines names for many error codes in the range 100..140,
+       but _sys_errlist contains strings only for the error codes
+       < _sys_nerr = 43.  */
+    if (ret == EINVAL)
+      {
+        const char *errmsg;
+
+        switch (errnum)
+          {
+          case 100 /* EADDRINUSE */:
+            errmsg = "Address already in use";
+            break;
+          case 101 /* EADDRNOTAVAIL */:
+            errmsg = "Cannot assign requested address";
+            break;
+          case 102 /* EAFNOSUPPORT */:
+            errmsg = "Address family not supported by protocol";
+            break;
+          case 103 /* EALREADY */:
+            errmsg = "Operation already in progress";
+            break;
+          case 105 /* ECANCELED */:
+            errmsg = "Operation canceled";
+            break;
+          case 106 /* ECONNABORTED */:
+            errmsg = "Software caused connection abort";
+            break;
+          case 107 /* ECONNREFUSED */:
+            errmsg = "Connection refused";
+            break;
+          case 108 /* ECONNRESET */:
+            errmsg = "Connection reset by peer";
+            break;
+          case 109 /* EDESTADDRREQ */:
+            errmsg = "Destination address required";
+            break;
+          case 110 /* EHOSTUNREACH */:
+            errmsg = "No route to host";
+            break;
+          case 112 /* EINPROGRESS */:
+            errmsg = "Operation now in progress";
+            break;
+          case 113 /* EISCONN */:
+            errmsg = "Transport endpoint is already connected";
+            break;
+          case 114 /* ELOOP */:
+            errmsg = "Too many levels of symbolic links";
+            break;
+          case 115 /* EMSGSIZE */:
+            errmsg = "Message too long";
+            break;
+          case 116 /* ENETDOWN */:
+            errmsg = "Network is down";
+            break;
+          case 117 /* ENETRESET */:
+            errmsg = "Network dropped connection on reset";
+            break;
+          case 118 /* ENETUNREACH */:
+            errmsg = "Network is unreachable";
+            break;
+          case 119 /* ENOBUFS */:
+            errmsg = "No buffer space available";
+            break;
+          case 123 /* ENOPROTOOPT */:
+            errmsg = "Protocol not available";
+            break;
+          case 126 /* ENOTCONN */:
+            errmsg = "Transport endpoint is not connected";
+            break;
+          case 128 /* ENOTSOCK */:
+            errmsg = "Socket operation on non-socket";
+            break;
+          case 129 /* ENOTSUP */:
+            errmsg = "Not supported";
+            break;
+          case 130 /* EOPNOTSUPP */:
+            errmsg = "Operation not supported";
+            break;
+          case 132 /* EOVERFLOW */:
+            errmsg = "Value too large for defined data type";
+            break;
+          case 133 /* EOWNERDEAD */:
+            errmsg = "Owner died";
+            break;
+          case 134 /* EPROTO */:
+            errmsg = "Protocol error";
+            break;
+          case 135 /* EPROTONOSUPPORT */:
+            errmsg = "Protocol not supported";
+            break;
+          case 136 /* EPROTOTYPE */:
+            errmsg = "Protocol wrong type for socket";
+            break;
+          case 138 /* ETIMEDOUT */:
+            errmsg = "Connection timed out";
+            break;
+          case 140 /* EWOULDBLOCK */:
+            errmsg = "Operation would block";
+            break;
+          default:
+            errmsg = NULL;
+            break;
+          }
+        if (errmsg != NULL)
+          ret = safe_copy (buf, buflen, errmsg);
+      }
+#endif
+
+    if (ret == EINVAL && !*buf)
+      {
+#if defined __HAIKU__
+        /* For consistency with perror().  */
+        snprintf (buf, buflen, "Unknown Application Error (%d)", errnum);
+#else
+        snprintf (buf, buflen, "Unknown error %d", errnum);
+#endif
+      }
+
+    errno = saved_errno;
+    return ret;
+  }
+}
deleted file mode 120000 (symlink)
index 93092e0c9660ce8af0ef4e34aae59760a40880c4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-accept.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ed02450beeaf349085274c79827bf0a9820e9bf8
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test accepting a connection to a server socket.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/socket.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (accept, int, (int, struct sockaddr *, socklen_t *));
+
+#include <errno.h>
+#include <netinet/in.h>
+#include <unistd.h>
+
+#include "sockets.h"
+#include "macros.h"
+
+int
+main (void)
+{
+  (void) gl_sockets_startup (SOCKETS_1_1);
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    struct sockaddr_in addr;
+    socklen_t addrlen = sizeof (addr);
+
+    errno = 0;
+    ASSERT (accept (-1, (struct sockaddr *) &addr, &addrlen) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    struct sockaddr_in addr;
+    socklen_t addrlen = sizeof (addr);
+
+    close (99);
+    errno = 0;
+    ASSERT (accept (99, (struct sockaddr *) &addr, &addrlen) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b5deddca222c327305c3e239d5b948dacae0be24..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-access.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a9bf19efb402ca45d7e04a59ec0f7075db9ab5e6
--- /dev/null
@@ -0,0 +1,40 @@
+/* Tests of access.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (access, int, (const char *, int));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include "root-uid.h"
+#include "macros.h"
+
+#define BASE "test-access.t"
+
+#include "test-access.h"
+
+int
+main ()
+{
+  test_access (access);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c13044665d99e9073027d44383ef0d57c54c359e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-access.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..42aee8b7e0ad964d9e461ebb18ce6978cb8fc96c
--- /dev/null
@@ -0,0 +1,102 @@
+/* Tests of access and euidaccess.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* mingw and MSVC 9 lack geteuid, so setup a dummy value.  */
+#if !HAVE_GETEUID
+# define geteuid() ROOT_UID
+#endif
+
+static void
+test_access (int (*func) (const char * /*file*/, int /*mode*/))
+{
+  /* Remove anything from prior partial run.  */
+  unlink (BASE "f");
+  unlink (BASE "f1");
+  chmod (BASE "f2", 0600);
+  unlink (BASE "f2");
+  unlink (BASE "sl");
+
+  {
+    errno = 0;
+    ASSERT (func (BASE "f", R_OK) == -1);
+    ASSERT (errno == ENOENT);
+
+    errno = 0;
+    ASSERT (func (BASE "f", W_OK) == -1);
+    ASSERT (errno == ENOENT);
+
+    errno = 0;
+    ASSERT (func (BASE "f", X_OK) == -1);
+    ASSERT (errno == ENOENT);
+  }
+  {
+    ASSERT (close (creat (BASE "f1", 0700)) == 0);
+
+    ASSERT (func (BASE "f1", F_OK) == 0);
+    ASSERT (func (BASE "f1", R_OK) == 0);
+    ASSERT (func (BASE "f1", W_OK) == 0);
+    ASSERT (func (BASE "f1", X_OK) == 0);
+
+    ASSERT (func (BASE "f1/", F_OK) == -1);
+    ASSERT (errno == ENOTDIR);
+    ASSERT (func (BASE "f1/", R_OK) == -1);
+    ASSERT (errno == ENOTDIR);
+    ASSERT (func (BASE "f1/", W_OK) == -1);
+    ASSERT (errno == ENOTDIR);
+    ASSERT (func (BASE "f1/", X_OK) == -1);
+    ASSERT (errno == ENOTDIR);
+
+    if (symlink (BASE "f1", BASE "sl") == 0)
+      {
+        ASSERT (func (BASE "sl/", F_OK) == -1);
+        ASSERT (errno == ENOTDIR);
+        ASSERT (func (BASE "sl/", R_OK) == -1);
+        ASSERT (errno == ENOTDIR);
+        ASSERT (func (BASE "sl/", W_OK) == -1);
+        ASSERT (errno == ENOTDIR);
+        ASSERT (func (BASE "sl/", X_OK) == -1);
+        ASSERT (errno == ENOTDIR);
+      }
+  }
+  {
+    ASSERT (close (creat (BASE "f2", 0600)) == 0);
+    ASSERT (chmod (BASE "f2", 0400) == 0);
+
+    ASSERT (func (BASE "f2", R_OK) == 0);
+
+    if (geteuid () != ROOT_UID)
+      {
+        errno = 0;
+        ASSERT (func (BASE "f2", W_OK) == -1);
+        ASSERT (errno == EACCES);
+      }
+
+#if defined _WIN32 && !defined __CYGWIN__
+    /* X_OK works like R_OK.  */
+    ASSERT (func (BASE "f2", X_OK) == 0);
+#else
+    errno = 0;
+    ASSERT (func (BASE "f2", X_OK) == -1);
+    ASSERT (errno == EACCES);
+#endif
+  }
+
+  /* Cleanup.  */
+  ASSERT (unlink (BASE "f1") == 0);
+  ASSERT (chmod (BASE "f2", 0600) == 0);
+  ASSERT (unlink (BASE "f2") == 0);
+  unlink (BASE "sl");
+}
deleted file mode 120000 (symlink)
index 74585aad92c5685cf56d9a5ba380640b5b8f8f69..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-alignalloc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..18b287859c2ddadcc0ba2520ad751799c4ec9001
--- /dev/null
@@ -0,0 +1,63 @@
+/* Test alignalloc and alignfree.
+
+   Copyright 2022-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <alignalloc.h>
+
+#include <stdint.h>
+#include <string.h>
+#include "intprops.h"
+
+#include "signature.h"
+SIGNATURE_CHECK (alignalloc, void *, (idx_t, idx_t));
+SIGNATURE_CHECK (alignfree, void, (void *));
+
+#include "macros.h"
+
+static void
+test_alignalloc (idx_t alignment, idx_t size)
+{
+  void *p = alignalloc (alignment, size);
+  if (p)
+    {
+      memset (p, 0, size);
+      ASSERT ((uintptr_t) p % alignment == 0);
+    }
+  alignfree (p);
+}
+
+int
+main ()
+{
+  /* Check that alignalloc returns properly aligned storage when it succeeds.
+     Stop at 16 MiB alignments because circa-2022 AddressSanitizer goes
+     catatonic with large alignments in posix_memalign,
+     and there seems to be little point to testing them.  */
+  for (idx_t alignment = 1; alignment <= 16 * 1024 * 1024; alignment *= 2)
+    for (idx_t size = 1; size <= 1024; size *= 2)
+      {
+        test_alignalloc (alignment, size - 1);
+        test_alignalloc (alignment, size);
+        test_alignalloc (alignment, size + 1);
+      }
+
+  /* Check that alignfree is a no-op on null pointers.  */
+  alignfree (NULL);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 35c4bde505488631eeb95fefd178165eb1d0c248..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-alignasof.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1cc75b0f3dba386a8ce73609faf0e821620b7e37
--- /dev/null
@@ -0,0 +1,100 @@
+/* Test of alignasof module.
+   Copyright 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, inspired by Bruno Haible's test-alignof.c.  */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "macros.h"
+
+typedef long double longdouble;
+typedef struct { char a[1]; } struct1;
+typedef struct { char a[2]; } struct2;
+typedef struct { char a[3]; } struct3;
+typedef struct { char a[4]; } struct4;
+
+#if (202311 <= __STDC_VERSION__ || __alignas_is_defined \
+     || 201103 <= __cplusplus)
+/* mingw can go up only to 8.  8 is all that GNU Emacs needs, so let's
+   limit the test to 8 for now.  */
+# define TEST_ALIGNMENT 8
+#else
+# undef alignas
+# define alignas(alignment)
+# define TEST_ALIGNMENT 1
+#endif
+
+#define CHECK_STATIC(type) \
+  typedef struct { char slot1; type slot2; } type##_helper; \
+  static_assert (alignof (type) == offsetof (type##_helper, slot2)); \
+  const int type##_alignment = alignof (type); \
+  type alignas (TEST_ALIGNMENT) static_##type##_alignas
+
+#define CHECK_ALIGNED(var) ASSERT ((uintptr_t) &(var) % TEST_ALIGNMENT == 0)
+
+CHECK_STATIC (char);
+CHECK_STATIC (short);
+CHECK_STATIC (int);
+CHECK_STATIC (long);
+#ifdef INT64_MAX
+CHECK_STATIC (int64_t);
+#endif
+CHECK_STATIC (float);
+CHECK_STATIC (double);
+/* CHECK_STATIC (longdouble); */
+CHECK_STATIC (struct1);
+CHECK_STATIC (struct2);
+CHECK_STATIC (struct3);
+CHECK_STATIC (struct4);
+
+int
+main ()
+{
+#if defined __SUNPRO_C && __SUNPRO_C < 0x5150
+  /* Avoid a test failure due to Sun Studio Developer Bug Report #2125432.  */
+  fputs ("Skipping test: known Sun C compiler bug\n", stderr);
+  return 77;
+#elif defined __HP_cc && __ia64
+  /* Avoid a test failure due to HP-UX Itanium cc bug; see:
+     https://lists.gnu.org/r/bug-gnulib/2017-03/msg00078.html  */
+  fputs ("Skipping test: known HP-UX Itanium cc compiler bug\n", stderr);
+  return 77;
+#elif defined __clang__ && defined __ibmxl__
+  /* Avoid a test failure with IBM xlc 16.1.  It ignores alignas (8),
+     _Alignas (8), and __attribute__ ((__aligned__ (8))).  */
+  fputs ("Skipping test: known AIX XL C compiler deficiency\n", stderr);
+  return 77;
+#else
+  CHECK_ALIGNED (static_char_alignas);
+  CHECK_ALIGNED (static_short_alignas);
+  CHECK_ALIGNED (static_int_alignas);
+  CHECK_ALIGNED (static_long_alignas);
+# ifdef INT64_MAX
+  CHECK_ALIGNED (static_int64_t_alignas);
+# endif
+  CHECK_ALIGNED (static_float_alignas);
+  CHECK_ALIGNED (static_double_alignas);
+  /* CHECK_ALIGNED (static_longdouble_alignas); */
+  CHECK_ALIGNED (static_struct1_alignas);
+  CHECK_ALIGNED (static_struct2_alignas);
+  CHECK_ALIGNED (static_struct3_alignas);
+  CHECK_ALIGNED (static_struct4_alignas);
+  return 0;
+#endif
+}
deleted file mode 120000 (symlink)
index c42293c16f63b70e34b7df97043b294a452df444..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-alignof.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..107b0e7f010c8e3ffe58f2848b28572b41fdb849
--- /dev/null
@@ -0,0 +1,57 @@
+/* Test of <alignof.h>.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <alignof.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+typedef long double longdouble;
+typedef struct { char a[1]; } struct1;
+typedef struct { char a[2]; } struct2;
+typedef struct { char a[3]; } struct3;
+typedef struct { char a[4]; } struct4;
+
+#define CHECK(type) \
+  typedef struct { char slot1; type slot2; } type##_helper; \
+  static_assert (alignof_slot (type) == offsetof (type##_helper, slot2)); \
+  const int type##_slot_alignment = alignof_slot (type); \
+  const int type##_type_alignment = alignof_type (type);
+
+CHECK (char)
+CHECK (short)
+CHECK (int)
+CHECK (long)
+CHECK (float)
+CHECK (double)
+CHECK (longdouble)
+#ifdef INT64_MAX
+CHECK (int64_t)
+#endif
+CHECK (struct1)
+CHECK (struct2)
+CHECK (struct3)
+CHECK (struct4)
+
+int
+main ()
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 9f1fe4258d6e9b8b94b391b06527989936111ab7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-alloca-opt.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3f20779c9e3c2f11d60329f374c6e68a4ff50edb
--- /dev/null
@@ -0,0 +1,62 @@
+/* Test of optional automatic memory allocation.
+   Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <alloca.h>
+
+#if HAVE_ALLOCA
+
+static void
+do_allocation (int n)
+{
+  void *volatile ptr = alloca (n);
+  (void) ptr;
+}
+
+void (*func) (int) = do_allocation;
+
+#endif
+
+int
+main ()
+{
+#if HAVE_ALLOCA
+  int i;
+
+  /* Repeat a lot of times, to make sure there's no memory leak.  */
+  for (i = 0; i < 100000; i++)
+    {
+      /* Try various values.
+         n = 0 gave a crash on Alpha with gcc-2.5.8.
+         Some versions of Mac OS X have a stack size limit of 512 KB.  */
+      func (34);
+      func (134);
+      func (399);
+      func (510823);
+      func (129321);
+      func (0);
+      func (4070);
+      func (4095);
+      func (1);
+      func (16582);
+    }
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 825088462b7c69fee830c7c4ffa93dd8e91b0d2a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-areadlink-with-size.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..521fa88407959bf32621f0589b266d5d1b30cb91
--- /dev/null
@@ -0,0 +1,45 @@
+/* Tests of areadlink_with_size.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "areadlink.h"
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-areadlink-with-size.t"
+
+#include "test-areadlink.h"
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_areadlink (areadlink_with_size, true);
+}
deleted file mode 120000 (symlink)
index 812694e6da0cacd7f20f15612cb60d7e75fa7714..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-areadlink.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4b49f6f348891636d73467464e622d3a57aee94e
--- /dev/null
@@ -0,0 +1,52 @@
+/* Tests of areadlink.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "areadlink.h"
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-areadlink.t"
+
+#include "test-areadlink.h"
+
+/* Wrapper for testing areadlink.  */
+static char *
+do_areadlink (char const *name, _GL_UNUSED size_t ignored)
+{
+  return areadlink (name);
+}
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_areadlink (do_areadlink, true);
+}
deleted file mode 120000 (symlink)
index caa585015f70e1f923f969cb9a6c181c5300fa2e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-areadlink.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cc65c4cc4eaa2115b8e0ef4dbfa91521c4c7a81c
--- /dev/null
@@ -0,0 +1,83 @@
+/* Tests of areadlink and friends.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+/* This file is designed to test areadlink(a),
+   areadlink_with_size(a,b), and areadlinkat(AT_FDCWD,a).  FUNC is the
+   function to test; a length is always supplied, but may be ignored.
+   Assumes that BASE and ASSERT are already defined, and that
+   appropriate headers are already included.  If PRINT, warn before
+   skipping symlink tests with status 77.  */
+
+static int
+test_areadlink (char * (*func) (char const *, size_t), bool print)
+{
+  /* Sanity checks of failures.  Mingw lacks symlink, but areadlink can
+     still distinguish between various errors.  */
+  errno = 0;
+  ASSERT (func ("no_such", 1) == NULL);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("no_such/", 1) == NULL);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("", 1) == NULL);
+  ASSERT (errno == ENOENT || errno == EINVAL);
+  errno = 0;
+  ASSERT (func (".", 1) == NULL);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (func ("./", 1) == NULL);
+  ASSERT (errno == EINVAL);
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  errno = 0;
+  ASSERT (func (BASE "file", 1) == NULL);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (func (BASE "file/", 1) == NULL);
+  ASSERT (errno == ENOTDIR || errno == EINVAL); /* AIX yields EINVAL */
+  ASSERT (unlink (BASE "file") == 0);
+
+  /* Now test actual symlinks.  */
+  if (symlink (BASE "dir", BASE "link"))
+    {
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  errno = 0;
+  ASSERT (func (BASE "link/", 1) == NULL);
+  ASSERT (errno == EINVAL);
+  {
+    /* Too small a guess is okay.  */
+    char *buf = func (BASE "link", 1);
+    ASSERT (buf);
+    ASSERT (strcmp (buf, BASE "dir") == 0);
+    free (buf);
+    /* Too large a guess is okay.  */
+    buf = func (BASE "link", 10000000);
+    ASSERT (buf);
+    ASSERT (strcmp (buf, BASE "dir") == 0);
+    free (buf);
+  }
+  ASSERT (rmdir (BASE "dir") == 0);
+  ASSERT (unlink (BASE "link") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 9126c9609a133898230645c0e070db9fe8830e79..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-areadlinkat-with-size.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e7a02b6116d9596f3af3846b0ae289b765a986b1
--- /dev/null
@@ -0,0 +1,88 @@
+/* Tests of areadlinkat_with_size.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "areadlink.h"
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-areadlinkat-with-size.t"
+
+#include "test-areadlink.h"
+
+static int dfd = AT_FDCWD;
+
+/* Wrapper for testing areadlinkat_with_size.  */
+static char *
+do_areadlinkat_with_size (char const *name, size_t size)
+{
+  return areadlinkat_with_size (dfd, name, size);
+}
+
+int
+main (void)
+{
+  int result;
+
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Basic tests.  */
+  result = test_areadlink (do_areadlinkat_with_size, false);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_areadlink (do_areadlinkat_with_size, false) == result);
+
+  /* Relative tests.  */
+  if (result == 77)
+    fputs ("skipping test: symlinks not supported on this file system\n",
+           stderr);
+  else
+    {
+      char *buf;
+      ASSERT (symlink ("nowhere", BASE "link") == 0);
+      ASSERT (mkdir (BASE "dir", 0700) == 0);
+      ASSERT (chdir (BASE "dir") == 0);
+      buf = areadlinkat_with_size (dfd, BASE "link", strlen (BASE "link"));
+      ASSERT (buf);
+      ASSERT (strcmp (buf, "nowhere") == 0);
+      free (buf);
+      errno = 0;
+      ASSERT (areadlinkat_with_size (-1, BASE "link", 1) == NULL);
+      ASSERT (errno == EBADF);
+      errno = 0;
+      ASSERT (areadlinkat_with_size (AT_FDCWD, BASE "link", 1) == NULL);
+      ASSERT (errno == ENOENT);
+      ASSERT (chdir ("..") == 0);
+      ASSERT (rmdir (BASE "dir") == 0);
+      ASSERT (unlink (BASE "link") == 0);
+    }
+
+  ASSERT (close (dfd) == 0);
+  return result;
+}
deleted file mode 120000 (symlink)
index e6ca4363cbbb5c7659d13925b60e9426a5e4f63d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-areadlinkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f2f994839077f6201a2294303ff779b4ba297f49
--- /dev/null
@@ -0,0 +1,88 @@
+/* Tests of areadlinkat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "areadlink.h"
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-areadlinkat.t"
+
+#include "test-areadlink.h"
+
+static int dfd = AT_FDCWD;
+
+/* Wrapper for testing areadlinkat.  */
+static char *
+do_areadlinkat (char const *name, _GL_UNUSED size_t ignored)
+{
+  return areadlinkat (dfd, name);
+}
+
+int
+main (void)
+{
+  int result;
+
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Basic tests.  */
+  result = test_areadlink (do_areadlinkat, false);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_areadlink (do_areadlinkat, false) == result);
+
+  /* Relative tests.  */
+  if (result == 77)
+    fputs ("skipping test: symlinks not supported on this file system\n",
+           stderr);
+  else
+    {
+      char *buf;
+      ASSERT (symlink ("nowhere", BASE "link") == 0);
+      ASSERT (mkdir (BASE "dir", 0700) == 0);
+      ASSERT (chdir (BASE "dir") == 0);
+      buf = areadlinkat (dfd, BASE "link");
+      ASSERT (buf);
+      ASSERT (strcmp (buf, "nowhere") == 0);
+      free (buf);
+      errno = 0;
+      ASSERT (areadlinkat (-1, BASE "link") == NULL);
+      ASSERT (errno == EBADF);
+      errno = 0;
+      ASSERT (areadlinkat (AT_FDCWD, BASE "link") == NULL);
+      ASSERT (errno == ENOENT);
+      ASSERT (chdir ("..") == 0);
+      ASSERT (rmdir (BASE "dir") == 0);
+      ASSERT (unlink (BASE "link") == 0);
+    }
+
+  ASSERT (close (dfd) == 0);
+  return result;
+}
deleted file mode 120000 (symlink)
index 970d523ef1962904f649198a94d028b38d1b2e37..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-argmatch.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2c18077fc304aef8d7c1982de5dba32eed1eede5
--- /dev/null
@@ -0,0 +1,189 @@
+/* Test of exact or abbreviated match search.
+   Copyright (C) 1990, 1998-1999, 2001-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007, based on test code
+   by David MacKenzie <djm@gnu.ai.mit.edu>.  */
+
+#include <config.h>
+
+/* As of GCC 11.2.1, gcc -Wanalyzer-too-complex reports that main's
+   use of CHECK macros expands to code that is too complicated for gcc
+   -fanalyzer.  Suppress the resulting bogus warnings.  */
+#if 10 <= __GNUC__
+# pragma GCC diagnostic ignored "-Wanalyzer-null-argument"
+#endif
+
+#include "argmatch.h"
+
+#include <stdlib.h>
+
+#include "macros.h"
+
+# define N_(Msgid) (Msgid)
+
+/* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
+   thus must link with a definition of that function.  Provide it here.  */
+#ifdef ARGMATCH_DIE_DECL
+
+_Noreturn ARGMATCH_DIE_DECL;
+ARGMATCH_DIE_DECL { exit (1); }
+
+#endif
+
+enum backup_type
+{
+  no_backups,
+  simple_backups,
+  numbered_existing_backups,
+  numbered_backups
+};
+
+static const char *const backup_args[] =
+{
+  "no", "none", "off",
+  "simple", "never", "single",
+  "existing", "nil", "numbered-existing",
+  "numbered", "t", "newstyle",
+  NULL
+};
+
+static const enum backup_type backup_vals[] =
+{
+  no_backups, no_backups, no_backups,
+  simple_backups, simple_backups, simple_backups,
+  numbered_existing_backups, numbered_existing_backups, numbered_existing_backups,
+  numbered_backups, numbered_backups, numbered_backups
+};
+
+ARGMATCH_DEFINE_GROUP(backup, enum backup_type)
+
+static const argmatch_backup_doc argmatch_backup_docs[] =
+{
+  { "no",       N_("never make backups (even if --backup is given)") },
+  { "numbered", N_("make numbered backups") },
+  { "existing", N_("numbered if numbered backups exist, simple otherwise") },
+  { "simple",   N_("always make simple backups") },
+  { NULL, NULL }
+};
+
+static const argmatch_backup_arg argmatch_backup_args[] =
+{
+  { "no",                no_backups },
+  { "none",              no_backups },
+  { "off",               no_backups },
+  { "simple",            simple_backups },
+  { "never",             simple_backups },
+  { "single",            simple_backups },
+  { "existing",          numbered_existing_backups },
+  { "nil",               numbered_existing_backups },
+  { "numbered-existing", numbered_existing_backups },
+  { "numbered",          numbered_backups },
+  { "t",                 numbered_backups },
+  { "newstyle",          numbered_backups },
+  { NULL, no_backups }
+};
+
+const argmatch_backup_group_type argmatch_backup_group =
+{
+  argmatch_backup_args,
+  argmatch_backup_docs,
+  N_("\
+The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.\n\
+The version control method may be selected via the --backup option or through\n\
+the VERSION_CONTROL environment variable.  Here are the values:\n"),
+  NULL
+};
+
+int
+main (int argc, char *argv[])
+{
+#define CHECK(Input, Output)                                            \
+  do {                                                                  \
+    ASSERT (ARGMATCH (Input, backup_args, backup_vals) == Output);      \
+    ASSERT (argmatch_backup_choice (Input) == Output);                  \
+    if (0 <= Output)                                                    \
+      {                                                                 \
+        enum backup_type val                                            \
+          = argmatch_backup_args[Output < 0 ? 0 : Output].val;          \
+        ASSERT (*argmatch_backup_value ("test", Input) == val);         \
+        ASSERT (*argmatch_backup_value ("test",                         \
+                                        argmatch_backup_argument (&val)) \
+                == val);                                                \
+      }                                                                 \
+  } while (0)
+
+#define CHECK_EXACT(Input, Output)                                      \
+  do {                                                                  \
+    ASSERT (ARGMATCH_EXACT (Input, backup_args) == Output);             \
+  } while (0)
+
+  /* Not found.  */
+  CHECK ("klingon", -1);
+  CHECK_EXACT ("klingon", -1);
+
+  /* Exact match.  */
+  CHECK ("none", 1);
+  CHECK_EXACT ("none", 1);
+  CHECK ("nil", 7);
+  CHECK_EXACT ("nil", 7);
+
+  /* Too long.  */
+  CHECK ("nilpotent", -1);
+  CHECK_EXACT ("nilpotent", -1);
+
+  /* Abbreviated.  */
+  CHECK ("simpl", 3);
+  CHECK_EXACT ("simpl", -1);
+  CHECK ("simp", 3);
+  CHECK_EXACT ("simp", -1);
+  CHECK ("sim", 3);
+  CHECK_EXACT ("sim", -1);
+
+  /* Exact match and abbreviated.  */
+  CHECK ("numbered", 9);
+  CHECK_EXACT ("numbered", 9);
+  CHECK ("numbere", -2);
+  CHECK_EXACT ("numbere", -1);
+  CHECK ("number", -2);
+  CHECK_EXACT ("number", -1);
+  CHECK ("numbe", -2);
+  CHECK_EXACT ("numbe", -1);
+  CHECK ("numb", -2);
+  CHECK_EXACT ("numb", -1);
+  CHECK ("num", -2);
+  CHECK_EXACT ("num", -1);
+  CHECK ("nu", -2);
+  CHECK_EXACT ("nu", -1);
+  CHECK ("n", -2);
+  CHECK_EXACT ("n", -1);
+
+  /* Ambiguous abbreviated.  */
+  CHECK ("ne", -2);
+  CHECK_EXACT ("ne", -1);
+
+  /* Ambiguous abbreviated, but same value ("single" and "simple").  */
+  CHECK ("si", 3);
+  CHECK_EXACT ("si", -1);
+  CHECK ("s", 3);
+  CHECK_EXACT ("s", -1);
+
+#undef CHECK
+#undef CHECK_EXACT
+
+  argmatch_backup_usage (stdout);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f6c677834cc49cf5b9fde5e0d49895b755477008..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-argv-iter.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1d06e03e923977a1d411732358a567527d5fdd28
--- /dev/null
@@ -0,0 +1,106 @@
+/* Test argv iterator
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "argv-iter.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
+static FILE *
+write_nul_delimited_argv (char **argv)
+{
+  FILE *fp = tmpfile ();
+  ASSERT (fp);
+  while (*argv)
+    {
+      size_t len = strlen (*argv) + 1;
+      ASSERT (fwrite (*argv, len, 1, fp) == 1);
+      argv++;
+    }
+  ASSERT (fflush (fp) == 0);
+  rewind (fp);
+  return fp;
+}
+
+int
+main (void)
+{
+  static char one[] = "1";
+  static char two[] = "2";
+  static char three[] = "3";
+  static char *av[][4] = {
+    {NULL},
+    {one, NULL},
+    {one, two, NULL},
+    {one, two, three, NULL}
+  };
+
+  int use_stream;
+  for (use_stream = 0; use_stream < 2; use_stream++)
+    {
+      size_t i;
+      for (i = 0; i < ARRAY_CARDINALITY (av); i++)
+        {
+          FILE *fp;
+          struct argv_iterator *ai;
+          size_t n_found = 0;
+          if (use_stream)
+            {
+              /* Generate an identical list to be read via FP.  */
+              ASSERT ((fp = write_nul_delimited_argv (av[i])) != NULL);
+              ai = argv_iter_init_stream (fp);
+            }
+          else
+            {
+              fp = NULL;
+              ai = argv_iter_init_argv (av[i]);
+            }
+          ASSERT (ai);
+
+          while (1)
+            {
+              enum argv_iter_err ai_err;
+              char *s = argv_iter (ai, &ai_err);
+              ASSERT ((i == n_found) == (ai_err == AI_ERR_EOF));
+              ASSERT ((s == NULL) ^ (ai_err == AI_ERR_OK));
+              ASSERT (ai_err == AI_ERR_OK || ai_err == AI_ERR_EOF);
+              if (ai_err == AI_ERR_EOF)
+                break;
+              /* In stream mode, the strings are equal, but
+                 in argv mode the actual pointers are equal.  */
+              ASSERT (use_stream
+                      ? STREQ (s, av[i][n_found])
+                      : s == av[i][n_found]);
+              ++n_found;
+            }
+          ASSERT (argv_iter_n_args (ai) == i);
+          argv_iter_free (ai);
+          if (fp)
+            ASSERT (fclose (fp) == 0);
+        }
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b3bd2d11282dc2b6fd7044ae7da73195b8a36bc0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-arpa_inet.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..77222638ef8f0eb3bd3bddca1502dd3ab6d67c99
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test of <arpa/inet.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <arpa/inet.h>
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 807f690422082b10c2a2a3d092cd0614c67b70ec..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-array-mergesort.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..71639d12e602949eab93ddd3b6b1b0fc54775097
--- /dev/null
@@ -0,0 +1,384 @@
+/* Test of stable-sorting of an array using mergesort.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation, either version 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stddef.h>
+
+struct foo { double x; double index; };
+#define ELEMENT struct foo
+#define COMPARE(a,b) ((a)->x < (b)->x ? -1 : (a)->x > (b)->x ? 1 : 0)
+#define STATIC static
+#include "array-mergesort.h"
+
+#include <stdlib.h>
+
+#include "macros.h"
+
+#define NMAX 257
+static const struct foo data[NMAX] =
+{
+  {  2, 0 },
+  { 28, 1 },
+  { 36, 2 },
+  { 43, 3 },
+  { 20, 4 },
+  { 37, 5 },
+  { 19, 6 },
+  { 37, 7 },
+  { 30, 8 },
+  { 18, 9 },
+  { 30, 10 },
+  { 49, 11 },
+  { 16, 12 },
+  { 22, 13 },
+  { 23, 14 },
+  {  3, 15 },
+  { 39, 16 },
+  { 48, 17 },
+  { 18, 18 },
+  { 18, 19 },
+  { 45, 20 },
+  { 39, 21 },
+  {  1, 22 },
+  { 44, 23 },
+  { 24, 24 },
+  { 21, 25 },
+  { 29, 26 },
+  {  3, 27 },
+  { 34, 28 },
+  { 15, 29 },
+  { 39, 30 },
+  { 11, 31 },
+  { 29, 32 },
+  { 27, 33 },
+  { 43, 34 },
+  { 31, 35 },
+  { 28, 36 },
+  { 12, 37 },
+  { 16, 38 },
+  { 34, 39 },
+  { 25, 40 },
+  { 31, 41 },
+  { 29, 42 },
+  { 36, 43 },
+  { 17, 44 },
+  { 18, 45 },
+  { 44, 46 },
+  { 22, 47 },
+  { 23, 48 },
+  { 32, 49 },
+  { 16, 50 },
+  { 47, 51 },
+  { 28, 52 },
+  { 46, 53 },
+  { 49, 54 },
+  { 24, 55 },
+  {  0, 56 },
+  { 20, 57 },
+  { 25, 58 },
+  { 42, 59 },
+  { 48, 60 },
+  { 16, 61 },
+  { 26, 62 },
+  { 32, 63 },
+  { 24, 64 },
+  { 17, 65 },
+  { 47, 66 },
+  { 47, 67 },
+  { 12, 68 },
+  { 33, 69 },
+  { 41, 70 },
+  { 36, 71 },
+  {  8, 72 },
+  { 15, 73 },
+  {  0, 74 },
+  { 32, 75 },
+  { 28, 76 },
+  { 11, 77 },
+  { 46, 78 },
+  { 34, 79 },
+  {  5, 80 },
+  { 20, 81 },
+  { 47, 82 },
+  { 25, 83 },
+  {  7, 84 },
+  { 29, 85 },
+  { 40, 86 },
+  {  5, 87 },
+  { 12, 88 },
+  { 30, 89 },
+  {  1, 90 },
+  { 22, 91 },
+  { 29, 92 },
+  { 42, 93 },
+  { 49, 94 },
+  { 30, 95 },
+  { 40, 96 },
+  { 33, 97 },
+  { 36, 98 },
+  { 12, 99 },
+  {  8, 100 },
+  { 33, 101 },
+  {  5, 102 },
+  { 31, 103 },
+  { 27, 104 },
+  { 19, 105 },
+  { 43, 106 },
+  { 37, 107 },
+  {  9, 108 },
+  { 40, 109 },
+  {  0, 110 },
+  { 35, 111 },
+  { 32, 112 },
+  {  6, 113 },
+  { 27, 114 },
+  { 28, 115 },
+  { 30, 116 },
+  { 37, 117 },
+  { 32, 118 },
+  { 41, 119 },
+  { 14, 120 },
+  { 44, 121 },
+  { 22, 122 },
+  { 26, 123 },
+  {  2, 124 },
+  { 43, 125 },
+  { 20, 126 },
+  { 32, 127 },
+  { 24, 128 },
+  { 33, 129 },
+  {  7, 130 },
+  { 17, 131 },
+  { 10, 132 },
+  { 47, 133 },
+  { 14, 134 },
+  { 29, 135 },
+  { 19, 136 },
+  { 25, 137 },
+  { 25, 138 },
+  { 13, 139 },
+  { 25, 140 },
+  { 32, 141 },
+  {  8, 142 },
+  { 37, 143 },
+  { 31, 144 },
+  { 32, 145 },
+  {  5, 146 },
+  { 45, 147 },
+  { 35, 148 },
+  { 47, 149 },
+  {  3, 150 },
+  {  4, 151 },
+  { 37, 152 },
+  { 43, 153 },
+  { 39, 154 },
+  { 18, 155 },
+  { 13, 156 },
+  { 15, 157 },
+  { 41, 158 },
+  { 34, 159 },
+  {  4, 160 },
+  { 33, 161 },
+  { 20, 162 },
+  {  4, 163 },
+  { 38, 164 },
+  { 47, 165 },
+  { 30, 166 },
+  { 41, 167 },
+  { 23, 168 },
+  { 40, 169 },
+  { 23, 170 },
+  { 35, 171 },
+  { 47, 172 },
+  { 32, 173 },
+  { 15, 174 },
+  { 15, 175 },
+  { 41, 176 },
+  { 35, 177 },
+  {  6, 178 },
+  { 18, 179 },
+  { 35, 180 },
+  { 39, 181 },
+  { 34, 182 },
+  {  6, 183 },
+  { 34, 184 },
+  { 37, 185 },
+  { 15, 186 },
+  {  6, 187 },
+  { 12, 188 },
+  { 39, 189 },
+  {  9, 190 },
+  { 48, 191 },
+  { 37, 192 },
+  { 28, 193 },
+  { 32, 194 },
+  {  1, 195 },
+  { 45, 196 },
+  { 21, 197 },
+  { 11, 198 },
+  { 32, 199 },
+  { 43, 200 },
+  { 35, 201 },
+  { 25, 202 },
+  {  4, 203 },
+  { 20, 204 },
+  { 10, 205 },
+  { 22, 206 },
+  { 44, 207 },
+  { 30, 208 },
+  { 16, 209 },
+  { 42, 210 },
+  { 13, 211 },
+  { 29, 212 },
+  { 23, 213 },
+  { 30, 214 },
+  { 25, 215 },
+  { 49, 216 },
+  {  0, 217 },
+  { 49, 218 },
+  { 29, 219 },
+  { 37, 220 },
+  {  6, 221 },
+  { 27, 222 },
+  { 31, 223 },
+  { 17, 224 },
+  { 45, 225 },
+  { 25, 226 },
+  { 15, 227 },
+  { 34, 228 },
+  {  7, 229 },
+  {  7, 230 },
+  {  4, 231 },
+  { 31, 232 },
+  { 40, 233 },
+  { 17, 234 },
+  {  2, 235 },
+  { 34, 236 },
+  { 17, 237 },
+  { 25, 238 },
+  {  5, 239 },
+  { 48, 240 },
+  { 31, 241 },
+  { 41, 242 },
+  { 45, 243 },
+  { 33, 244 },
+  { 46, 245 },
+  { 19, 246 },
+  { 17, 247 },
+  { 38, 248 },
+  { 43, 249 },
+  { 16, 250 },
+  {  5, 251 },
+  { 21, 252 },
+  {  0, 253 },
+  { 47, 254 },
+  { 40, 255 },
+  { 22, 256 }
+};
+
+static int
+cmp_double (const void *a, const void *b)
+{
+  return (*(const double *)a < *(const double *)b ? -1 :
+          *(const double *)a > *(const double *)b ? 1 :
+          0);
+}
+
+int
+main ()
+{
+  size_t n;
+
+  /* Test merge_sort_fromto.  */
+  for (n = 1; n <= NMAX; n++)
+    {
+      struct foo *dst;
+      struct foo *tmp;
+      double *qsort_result;
+      size_t i;
+
+      dst = (struct foo *) malloc ((n + 1) * sizeof (struct foo));
+      dst[n].x = 0x4A6A71FE; /* canary */
+      tmp = (struct foo *) malloc ((n / 2 + 1) * sizeof (struct foo));
+      tmp[n / 2].x = 0x587EF149; /* canary */
+
+      merge_sort_fromto (data, dst, n, tmp);
+
+      /* Verify the canaries.  */
+      ASSERT (dst[n].x == 0x4A6A71FE);
+      ASSERT (tmp[n / 2].x == 0x587EF149);
+
+      /* Verify the result.  */
+      qsort_result = (double *) malloc (n * sizeof (double));
+      for (i = 0; i < n; i++)
+        qsort_result[i] = data[i].x;
+      qsort (qsort_result, n, sizeof (double), cmp_double);
+      for (i = 0; i < n; i++)
+        ASSERT (dst[i].x == qsort_result[i]);
+
+      /* Verify the stability.  */
+      for (i = 0; i < n; i++)
+        if (i > 0 && dst[i - 1].x == dst[i].x)
+          ASSERT (dst[i - 1].index < dst[i].index);
+
+      free (qsort_result);
+      free (tmp);
+      free (dst);
+    }
+
+  /* Test merge_sort_inplace.  */
+  for (n = 1; n <= NMAX; n++)
+    {
+      struct foo *src;
+      struct foo *tmp;
+      double *qsort_result;
+      size_t i;
+
+      src = (struct foo *) malloc ((n + 1) * sizeof (struct foo));
+      src[n].x = 0x4A6A71FE; /* canary */
+      tmp = (struct foo *) malloc ((n + 1) * sizeof (struct foo));
+      tmp[n].x = 0x587EF149; /* canary */
+
+      for (i = 0; i < n; i++)
+        src[i] = data[i];
+
+      merge_sort_inplace (src, n, tmp);
+
+      /* Verify the canaries.  */
+      ASSERT (src[n].x == 0x4A6A71FE);
+      ASSERT (tmp[n].x == 0x587EF149);
+
+      /* Verify the result.  */
+      qsort_result = (double *) malloc (n * sizeof (double));
+      for (i = 0; i < n; i++)
+        qsort_result[i] = data[i].x;
+      qsort (qsort_result, n, sizeof (double), cmp_double);
+      for (i = 0; i < n; i++)
+        ASSERT (src[i].x == qsort_result[i]);
+
+      /* Verify the stability.  */
+      for (i = 0; i < n; i++)
+        if (i > 0 && src[i - 1].x == src[i].x)
+          ASSERT (src[i - 1].index < src[i].index);
+
+      free (qsort_result);
+      free (tmp);
+      free (src);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 1c1990aad21c9b947a87e0a2e82a2ed049357e56..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-assert.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..771eec34376a52e27453e64bcbf56b08bba7bfcf
--- /dev/null
@@ -0,0 +1,72 @@
+/* Test assert.h and static_assert.
+   Copyright 2022-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#define STATIC_ASSERT_TESTS \
+  static_assert (2 + 2 == 4, "arithmetic does not work"); \
+  static_assert (2 + 2 == 4); \
+  static_assert (sizeof (char) == 1, "sizeof does not work"); \
+  static_assert (sizeof (char) == 1)
+
+STATIC_ASSERT_TESTS;
+
+static char const *
+assert (char const *p, int i)
+{
+  return p + i;
+}
+
+static char const *
+f (char const *p)
+{
+  return assert (p, 0);
+}
+
+#include <assert.h>
+
+STATIC_ASSERT_TESTS;
+
+static int
+g (void)
+{
+  assert (f ("this should work"));
+  return 0;
+}
+
+#define NDEBUG 1
+#include <assert.h>
+
+STATIC_ASSERT_TESTS;
+
+static int
+h (void)
+{
+  assert (f ("this should work"));
+  return 0;
+}
+
+int
+main (void)
+{
+  STATIC_ASSERT_TESTS;
+  f ("");
+  g ();
+  h ();
+  return 0;
+}
deleted file mode 120000 (symlink)
index 0de1ea7a17379dce43f69dda6b3172dd7a1e268d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-base32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..08b0f02f0170d528d4c9bd69498bc52d8da8c882
--- /dev/null
@@ -0,0 +1,275 @@
+/* Self tests for base32.
+   Copyright (C) 2004, 2008-2024 Free Software Foundation, Inc.
+   Based on the tests for base64 written by Simon Josefsson.
+   Adapted for base32 by Gijs van Tulder.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "base32.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  const char *in = "abcdefghijklmnop";
+  const char *b32in = "MFRGGZDFMZTWQ2LKNNWG23TPOA======";
+  char out[255];
+  idx_t len;
+  bool ok;
+  char *p;
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 0, out, 0);
+  ASSERT (out[0] == '\x42');
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 1, out, 10);
+  ASSERT (memcmp (out, "ME======", 1) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 1, out, 2);
+  ASSERT (memcmp (out, "ME======", 2) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 1, out, 3);
+  ASSERT (memcmp (out, "ME======", 3) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 1, out, 4);
+  ASSERT (memcmp (out, "ME======", 4) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 1, out, 8);
+  ASSERT (memcmp (out, "ME======", 8) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 2, out, 8);
+  ASSERT (memcmp (out, "MFRA====", 8) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 3, out, 8);
+  ASSERT (memcmp (out, "MFRGG===", 8) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 4, out, 8);
+  ASSERT (memcmp (out, "MFRGGZA=", 8) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 5, out, 8);
+  ASSERT (memcmp (out, "MFRGGZDF", 8) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 6, out, 16);
+  ASSERT (memcmp (out, "MFRGGZDFMY======", 16) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base32_encode (in, 6, out, 100);
+  ASSERT (memcmp (out, "MFRGGZDFMY======", 16) == 0);
+
+  /* Decode. */
+
+  memset (out, 0x42, sizeof (out));
+  len = 0;
+  ok = base32_decode (b32in, 8, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 1;
+  ok = base32_decode (b32in, 8, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 1);
+  ASSERT (memcmp (out, "abcdefghijklmnop", 1) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 2;
+  ok = base32_decode (b32in, 8, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 2);
+  ASSERT (memcmp (out, "abcdefghijklmnop", 2) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 3;
+  ok = base32_decode (b32in, 8, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 3);
+  ASSERT (memcmp (out, "abcdefghijklmnop", 3) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 4;
+  ok = base32_decode (b32in, 8, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 4);
+  ASSERT (memcmp (out, "abcdefghijklmnop", 4) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 5;
+  ok = base32_decode (b32in, 8, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 5);
+  ASSERT (memcmp (out, "abcdefghijklmnop", 5) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 6;
+  ok = base32_decode (b32in, 8, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 5);
+  ASSERT (memcmp (out, "abcdefghijklmnop", 5) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 100;
+  ok = base32_decode (b32in, strlen (b32in), out, &len);
+  ASSERT (ok);
+  ASSERT (len == 16);
+  ASSERT (memcmp (out, "abcdefghijklmnop", 16) == 0);
+
+  /* Allocating encode */
+
+  len = base32_encode_alloc (in, strlen (in), &p);
+  ASSERT (len == 32);
+  ASSERT (strcmp (p, "MFRGGZDFMZTWQ2LKNNWG23TPOA======") == 0);
+  free (p);
+
+  len = base32_encode_alloc (in, IDX_MAX - 5, &p);
+  ASSERT (len == 0);
+
+  /* Decode context function */
+  {
+    struct base32_decode_context ctx;
+
+    base32_decode_ctx_init (&ctx);
+
+    len = sizeof (out);
+    ok = base32_decode_ctx (&ctx, b32in, strlen (b32in), out, &len);
+    ASSERT (ok);
+    ASSERT (len == 16);
+    ASSERT (memcmp (out, "abcdefghijklmnop", len) == 0);
+  }
+
+  /* Allocating decode context function */
+
+  ok = base32_decode_alloc_ctx (NULL, b32in, strlen (b32in), &p, &len);
+  ASSERT (ok);
+  ASSERT (len == 16);
+  ASSERT (memcmp (out, "abcdefghijklmnop", len) == 0);
+  free (p);
+
+  {
+    struct base32_decode_context ctx;
+    const char *newlineb32 = "MFRG\nGZDFMZTWQ2LKNNW\nG23TPOA======";
+
+    base32_decode_ctx_init (&ctx);
+
+    ok = base32_decode_alloc_ctx (&ctx, newlineb32, strlen (newlineb32), &p, &len);
+    ASSERT (ok);
+    ASSERT (len == strlen (in));
+    ASSERT (memcmp (p, in, len) == 0);
+    free (p);
+  }
+
+  {
+    struct base32_decode_context ctx;
+    base32_decode_ctx_init (&ctx);
+
+    ok = base32_decode_alloc_ctx (&ctx, "MFRGGZDFM\nZTWQ2LK", 17, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 10);
+    ASSERT (memcmp (p, "abcdefghij", len) == 0);
+    free (p);
+
+    base32_decode_ctx_init (&ctx);
+
+    ok = base32_decode_alloc_ctx (&ctx, "MF\n", 3, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 0);
+    free (p);
+
+    ok = base32_decode_alloc_ctx (&ctx, "RGGZDFMZ", 8, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 5);
+    ASSERT (memcmp (p, "abcde", len) == 0);
+    free (p);
+
+    ok = base32_decode_alloc_ctx (&ctx, "TWQ2LK", 6, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 5);
+    ASSERT (memcmp (p, "fghij", len) == 0);
+    free (p);
+
+    ok = base32_decode_alloc_ctx (&ctx, "", 0, &p, &len);
+    ASSERT (ok);
+    free (p);
+  }
+
+  {
+    struct base32_decode_context ctx;
+    const char *newlineb32 = "\n\n\n\n\n";
+
+    base32_decode_ctx_init (&ctx);
+
+    ok = base32_decode_alloc_ctx (&ctx, newlineb32, strlen (newlineb32), &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 0);
+    free (p);
+  }
+
+  ok = base32_decode_alloc_ctx (NULL, " ! ", 3, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "ABC\nDEF", 7, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "AA", 2, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "AA=", 3, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "AABBAAxx", 8, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "AABBAA=X", 8, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "AABBAA=X", 8, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "AABBAA=A", 8, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "FZ======", 8, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "FYXB====", 8, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "FYXC5===", 8, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "FYXC4LR=", 8, &p, &len);
+  ASSERT (!ok);
+
+  ok = base32_decode_alloc_ctx (NULL, "FZ======FY======", 16, &p, &len);
+  ASSERT (!ok);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8013eeb06b46a8ce2729d90b93de22b2ee5a1241..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-base64.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b697da9b1215324e48d610794d6b257a6864b78b
--- /dev/null
@@ -0,0 +1,246 @@
+/* Self tests for base64.
+   Copyright (C) 2004, 2008-2024 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "base64.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  const char *in = "abcdefghijklmnop";
+  const char *b64in = "YWJjZGVmZw==";
+  char out[255];
+  idx_t len;
+  bool ok;
+  char *p;
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 0, out, 0);
+  ASSERT (out[0] == '\x42');
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 1, out, 1);
+  ASSERT (memcmp (out, "YQ==", 1) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 1, out, 2);
+  ASSERT (memcmp (out, "YQ==", 2) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 1, out, 3);
+  ASSERT (memcmp (out, "YQ==", 3) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 1, out, 4);
+  ASSERT (memcmp (out, "YQ==", 4) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 1, out, 8);
+  ASSERT (memcmp (out, "YQ==", 4) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 2, out, 4);
+  ASSERT (memcmp (out, "YWI=", 4) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 3, out, 4);
+  ASSERT (memcmp (out, "YWJj", 4) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 4, out, 5);
+  ASSERT (memcmp (out, "YWJjZA==", 5) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  base64_encode (in, 4, out, 100);
+  ASSERT (memcmp (out, "YWJjZA==", 6) == 0);
+
+  /* Decode. */
+
+  memset (out, 0x42, sizeof (out));
+  len = 0;
+  ok = base64_decode (b64in, 4, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 1;
+  ok = base64_decode (b64in, 4, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 1);
+  ASSERT (memcmp (out, "abcdefg", 1) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 2;
+  ok = base64_decode (b64in, 4, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 2);
+  ASSERT (memcmp (out, "abcdefg", 2) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 3;
+  ok = base64_decode (b64in, 4, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 3);
+  ASSERT (memcmp (out, "abcdefg", 3) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 4;
+  ok = base64_decode (b64in, 4, out, &len);
+  ASSERT (ok);
+  ASSERT (len == 3);
+  ASSERT (memcmp (out, "abcdefg", 3) == 0);
+
+  memset (out, 0x42, sizeof (out));
+  len = 100;
+  ok = base64_decode (b64in, strlen (b64in), out, &len);
+  ASSERT (ok);
+  ASSERT (len == 7);
+  ASSERT (memcmp (out, "abcdefg", 7) == 0);
+
+  /* Allocating encode */
+
+  len = base64_encode_alloc (in, strlen (in), &p);
+  ASSERT (len == 24);
+  ASSERT (strcmp (p, "YWJjZGVmZ2hpamtsbW5vcA==") == 0);
+  free (p);
+
+  len = base64_encode_alloc (in, IDX_MAX - 5, &p);
+  ASSERT (len == 0);
+
+  /* Decode context function */
+  {
+    struct base64_decode_context ctx;
+
+    base64_decode_ctx_init (&ctx);
+
+    len = sizeof (out);
+    ok = base64_decode_ctx (&ctx, b64in, strlen (b64in), out, &len);
+    ASSERT (ok);
+    ASSERT (len == 7);
+    ASSERT (memcmp (out, "abcdefg", len) == 0);
+  }
+
+  /* Allocating decode context function */
+
+  ok = base64_decode_alloc_ctx (NULL, b64in, strlen (b64in), &p, &len);
+  ASSERT (ok);
+  ASSERT (len == 7);
+  ASSERT (memcmp (out, "abcdefg", len) == 0);
+  free (p);
+
+  {
+    struct base64_decode_context ctx;
+    const char *newlineb64 = "YWJjZG\nVmZ2hp\namtsbW5vcA==";
+
+    base64_decode_ctx_init (&ctx);
+
+    ok = base64_decode_alloc_ctx (&ctx, newlineb64, strlen (newlineb64), &p, &len);
+    ASSERT (ok);
+    ASSERT (len == strlen (in));
+    ASSERT (memcmp (p, in, len) == 0);
+    free (p);
+  }
+
+  {
+    struct base64_decode_context ctx;
+    base64_decode_ctx_init (&ctx);
+
+    ok = base64_decode_alloc_ctx (&ctx, "YW\nJjZGVmZ2hp", 13, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 9);
+    ASSERT (memcmp (p, "abcdefghi", len) == 0);
+    free (p);
+
+    base64_decode_ctx_init (&ctx);
+
+    ok = base64_decode_alloc_ctx (&ctx, "YW\n", 3, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 0);
+    free (p);
+
+    ok = base64_decode_alloc_ctx (&ctx, "JjZGVmZ2", 8, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 6);
+    ASSERT (memcmp (p, "abcdef", len) == 0);
+    free (p);
+
+    ok = base64_decode_alloc_ctx (&ctx, "hp", 2, &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 3);
+    ASSERT (memcmp (p, "ghi", len) == 0);
+    free (p);
+
+    ok = base64_decode_alloc_ctx (&ctx, "", 0, &p, &len);
+    ASSERT (ok);
+    free (p);
+  }
+
+  {
+    struct base64_decode_context ctx;
+    const char *newlineb64 = "\n\n\n\n\n";
+
+    base64_decode_ctx_init (&ctx);
+
+    ok = base64_decode_alloc_ctx (&ctx, newlineb64, strlen (newlineb64), &p, &len);
+    ASSERT (ok);
+    ASSERT (len == 0);
+    free (p);
+  }
+
+  ok = base64_decode_alloc_ctx (NULL, " ! ", 3, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "abc\ndef", 7, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aa", 2, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aa=", 3, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aax", 3, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aa=X", 4, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aa=X", 4, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "aax=X", 5, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "SGVsbG9=", 8, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "TR==", 4, &p, &len);
+  ASSERT (!ok);
+
+  ok = base64_decode_alloc_ctx (NULL, "TWF=TWE=", 8, &p, &len);
+  ASSERT (!ok);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index fa81d5d86946900d88e0e3c838f6e0fe828dd108..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-binary-io.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..32de2fe43ca614ffb78e566dcae552a68af03b89
--- /dev/null
@@ -0,0 +1,63 @@
+/* Test of binary mode I/O.
+   Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+#include "binary-io.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (_GL_UNUSED int argc, char *argv[])
+{
+  /* Test the O_BINARY macro.  */
+  {
+    int fd =
+      open ("t-bin-out0.tmp", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0600);
+    if (write (fd, "Hello\n", 6) < 0)
+      exit (1);
+    close (fd);
+  }
+  {
+    struct stat statbuf;
+    if (stat ("t-bin-out0.tmp", &statbuf) < 0)
+      exit (1);
+    ASSERT (statbuf.st_size == 6);
+  }
+
+  switch (argv[1][0])
+    {
+    case '1':
+      /* Test the set_binary_mode() function.  */
+      set_binary_mode (1, O_BINARY);
+      fputs ("Hello\n", stdout);
+      break;
+
+    default:
+      break;
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index cc0c93ebf291e98afc9d00bd83792bd60a218626..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-binary-io.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7bc5aa07f4baaa249ed96ca5188e373e8f44e17e
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-bin-out0.tmp t-bin-out1.tmp"
+${CHECKER} ./test-binary-io${EXEEXT} 1 > t-bin-out1.tmp || exit 1
+cmp t-bin-out0.tmp t-bin-out1.tmp > /dev/null || exit 1
+
+rm -fr $tmpfiles
+
+exit 0
deleted file mode 120000 (symlink)
index d5b866ae08330f2359d19a56e1ee55329f375213..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-bind.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0f8e783a87f1d9db44e7f4963f2c17875035606b
--- /dev/null
@@ -0,0 +1,58 @@
+/* Test binding a server socket to a port.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/socket.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (bind, int, (int, const struct sockaddr *, socklen_t));
+
+#include <errno.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+
+#include "sockets.h"
+#include "macros.h"
+
+int
+main (void)
+{
+  (void) gl_sockets_startup (SOCKETS_1_1);
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    struct sockaddr_in addr;
+
+    addr.sin_family = AF_INET;
+    inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr);
+    addr.sin_port = htons (80);
+    {
+      errno = 0;
+      ASSERT (bind (-1, (const struct sockaddr *) &addr, sizeof (addr)) == -1);
+      ASSERT (errno == EBADF);
+    }
+    {
+      close (99);
+      errno = 0;
+      ASSERT (bind (99, (const struct sockaddr *) &addr, sizeof (addr)) == -1);
+      ASSERT (errno == EBADF);
+    }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c52ede2c819f4e52b83c5c37131a31eb3c12aa64..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-bitrotate.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..73d75b5b06ca732dfa8c6a189b4e11a9c1a7282c
--- /dev/null
@@ -0,0 +1,279 @@
+/* Test of <bitrotate.h> substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2008.  */
+
+#include <config.h>
+
+#include "bitrotate.h"
+
+#include "macros.h"
+
+int
+main (void)
+{
+  ASSERT (rotl8 (42, 0) == 42);
+  ASSERT (rotl8 (42, 1) == 84);
+  ASSERT (rotl8 (42, 2) == 168);
+  ASSERT (rotl8 (42, 3) == 81);
+  ASSERT (rotl8 (42, 4) == 162);
+  ASSERT (rotl8 (42, 5) == 69);
+  ASSERT (rotl8 (42, 6) == 138);
+  ASSERT (rotl8 (42, 7) == 21);
+  ASSERT (rotl8 (42, 8) == 42);
+
+  ASSERT (rotr8 (42, 0) == 42);
+  ASSERT (rotr8 (42, 1) == 21);
+  ASSERT (rotr8 (42, 2) == 138);
+  ASSERT (rotr8 (42, 3) == 69);
+  ASSERT (rotr8 (42, 4) == 162);
+  ASSERT (rotr8 (42, 5) == 81);
+  ASSERT (rotr8 (42, 6) == 168);
+  ASSERT (rotr8 (42, 7) == 84);
+  ASSERT (rotr8 (42, 8) == 42);
+
+  ASSERT (rotl16 (43981, 0) == 43981);
+  ASSERT (rotl16 (43981, 1) == 22427);
+  ASSERT (rotl16 (43981, 2) == 44854);
+  ASSERT (rotl16 (43981, 3) == 24173);
+  ASSERT (rotl16 (43981, 4) == 48346);
+  ASSERT (rotl16 (43981, 5) == 31157);
+  ASSERT (rotl16 (43981, 6) == 62314);
+  ASSERT (rotl16 (43981, 7) == 59093);
+  ASSERT (rotl16 (43981, 8) == 52651);
+  ASSERT (rotl16 (43981, 9) == 39767);
+  ASSERT (rotl16 (43981, 10) == 13999);
+  ASSERT (rotl16 (43981, 11) == 27998);
+  ASSERT (rotl16 (43981, 12) == 55996);
+  ASSERT (rotl16 (43981, 13) == 46457);
+  ASSERT (rotl16 (43981, 14) == 27379);
+  ASSERT (rotl16 (43981, 15) == 54758);
+  ASSERT (rotl16 (43981, 16) == 43981);
+
+  ASSERT (rotr16 (43981, 0) == 43981);
+  ASSERT (rotr16 (43981, 1) == 54758);
+  ASSERT (rotr16 (43981, 2) == 27379);
+  ASSERT (rotr16 (43981, 3) == 46457);
+  ASSERT (rotr16 (43981, 4) == 55996);
+  ASSERT (rotr16 (43981, 5) == 27998);
+  ASSERT (rotr16 (43981, 6) == 13999);
+  ASSERT (rotr16 (43981, 7) == 39767);
+  ASSERT (rotr16 (43981, 8) == 52651);
+  ASSERT (rotr16 (43981, 9) == 59093);
+  ASSERT (rotr16 (43981, 10) == 62314);
+  ASSERT (rotr16 (43981, 11) == 31157);
+  ASSERT (rotr16 (43981, 12) == 48346);
+  ASSERT (rotr16 (43981, 13) == 24173);
+  ASSERT (rotr16 (43981, 14) == 44854);
+  ASSERT (rotr16 (43981, 15) == 22427);
+  ASSERT (rotr16 (43981, 16) == 43981);
+
+  ASSERT (rotl32 (2309737967U, 1) == 324508639U);
+  ASSERT (rotl32 (2309737967U, 2) == 649017278U);
+  ASSERT (rotl32 (2309737967U, 3) == 1298034556U);
+  ASSERT (rotl32 (2309737967U, 4) == 2596069112U);
+  ASSERT (rotl32 (2309737967U, 5) == 897170929U);
+  ASSERT (rotl32 (2309737967U, 6) == 1794341858U);
+  ASSERT (rotl32 (2309737967U, 7) == 3588683716U);
+  ASSERT (rotl32 (2309737967U, 8) == 2882400137U);
+  ASSERT (rotl32 (2309737967U, 9) == 1469832979U);
+  ASSERT (rotl32 (2309737967U, 10) == 2939665958U);
+  ASSERT (rotl32 (2309737967U, 11) == 1584364621U);
+  ASSERT (rotl32 (2309737967U, 12) == 3168729242U);
+  ASSERT (rotl32 (2309737967U, 13) == 2042491189U);
+  ASSERT (rotl32 (2309737967U, 14) == 4084982378U);
+  ASSERT (rotl32 (2309737967U, 15) == 3874997461U);
+  ASSERT (rotl32 (2309737967U, 16) == 3455027627U);
+  ASSERT (rotl32 (2309737967U, 17) == 2615087959U);
+  ASSERT (rotl32 (2309737967U, 18) == 935208623U);
+  ASSERT (rotl32 (2309737967U, 19) == 1870417246U);
+  ASSERT (rotl32 (2309737967U, 20) == 3740834492U);
+  ASSERT (rotl32 (2309737967U, 21) == 3186701689U);
+  ASSERT (rotl32 (2309737967U, 22) == 2078436083U);
+  ASSERT (rotl32 (2309737967U, 23) == 4156872166U);
+  ASSERT (rotl32 (2309737967U, 24) == 4018777037U);
+  ASSERT (rotl32 (2309737967U, 25) == 3742586779U);
+  ASSERT (rotl32 (2309737967U, 26) == 3190206263U);
+  ASSERT (rotl32 (2309737967U, 27) == 2085445231U);
+  ASSERT (rotl32 (2309737967U, 28) == 4170890462U);
+  ASSERT (rotl32 (2309737967U, 29) == 4046813629U);
+  ASSERT (rotl32 (2309737967U, 30) == 3798659963U);
+  ASSERT (rotl32 (2309737967U, 31) == 3302352631U);
+
+  ASSERT (rotr32 (2309737967U, 1) == 3302352631lU);
+  ASSERT (rotr32 (2309737967U, 2) == 3798659963lU);
+  ASSERT (rotr32 (2309737967U, 3) == 4046813629lU);
+  ASSERT (rotr32 (2309737967U, 4) == 4170890462lU);
+  ASSERT (rotr32 (2309737967U, 5) == 2085445231lU);
+  ASSERT (rotr32 (2309737967U, 6) == 3190206263lU);
+  ASSERT (rotr32 (2309737967U, 7) == 3742586779lU);
+  ASSERT (rotr32 (2309737967U, 8) == 4018777037lU);
+  ASSERT (rotr32 (2309737967U, 9) == 4156872166lU);
+  ASSERT (rotr32 (2309737967U, 10) == 2078436083lU);
+  ASSERT (rotr32 (2309737967U, 11) == 3186701689lU);
+  ASSERT (rotr32 (2309737967U, 12) == 3740834492lU);
+  ASSERT (rotr32 (2309737967U, 13) == 1870417246lU);
+  ASSERT (rotr32 (2309737967U, 14) == 935208623lU);
+  ASSERT (rotr32 (2309737967U, 15) == 2615087959lU);
+  ASSERT (rotr32 (2309737967U, 16) == 3455027627lU);
+  ASSERT (rotr32 (2309737967U, 17) == 3874997461lU);
+  ASSERT (rotr32 (2309737967U, 18) == 4084982378lU);
+  ASSERT (rotr32 (2309737967U, 19) == 2042491189lU);
+  ASSERT (rotr32 (2309737967U, 20) == 3168729242lU);
+  ASSERT (rotr32 (2309737967U, 21) == 1584364621lU);
+  ASSERT (rotr32 (2309737967U, 22) == 2939665958lU);
+  ASSERT (rotr32 (2309737967U, 23) == 1469832979lU);
+  ASSERT (rotr32 (2309737967U, 24) == 2882400137lU);
+  ASSERT (rotr32 (2309737967U, 25) == 3588683716lU);
+  ASSERT (rotr32 (2309737967U, 26) == 1794341858lU);
+  ASSERT (rotr32 (2309737967U, 27) == 897170929lU);
+  ASSERT (rotr32 (2309737967U, 28) == 2596069112lU);
+  ASSERT (rotr32 (2309737967U, 29) == 1298034556lU);
+  ASSERT (rotr32 (2309737967U, 30) == 649017278lU);
+  ASSERT (rotr32 (2309737967U, 31) == 324508639lU);
+
+#ifdef UINT64_MAX
+  ASSERT (rotl64 (16045690984503098046ULL, 1) == 13644637895296644477ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 2) == 8842531716883737339ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 3) == 17685063433767474678ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 4) == 16923382793825397741ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 5) == 15400021513941243867ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 6) == 12353298954172936119ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 7) == 6259853834636320623ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 8) == 12519707669272641246ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 9) == 6592671264835730877ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 10) == 13185342529671461754ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 11) == 7923940985633371893ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 12) == 15847881971266743786ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 13) == 13249019868823935957ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 14) == 8051295663938320299ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 15) == 16102591327876640598ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 16) == 13758438582043729581ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 17) == 9070133090377907547ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 18) == 18140266180755815094ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 19) == 17833788287802078573ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 20) == 17220832501894605531ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 21) == 15994920930079659447ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 22) == 13543097786449767279ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 23) == 8639451499189982943ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 24) == 17278902998379965886ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 25) == 16111061923050380157ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 26) == 13775379772391208699ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 27) == 9104015471072865783ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 28) == 18208030942145731566ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 29) == 17969317810581911517ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 30) == 17491891547454271419ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 31) == 16537039021198991223ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 32) == 14627333968688430831ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 33) == 10807923863667310047ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 34) == 3169103653625068479ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 35) == 6338207307250136958ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 36) == 12676414614500273916ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 37) == 6906085155290996217ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 38) == 13812170310581992434ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 39) == 9177596547454433253ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 40) == 18355193094908866506ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 41) == 18263642116108181397ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 42) == 18080540158506811179ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 43) == 17714336243304070743ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 44) == 16981928412898589871ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 45) == 15517112752087628127ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 46) == 12587481430465704639ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 47) == 6728218787221857663ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 48) == 13456437574443715326ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 49) == 8466131075177879037ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 50) == 16932262150355758074ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 51) == 15417780227001964533ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 52) == 12388816380294377451ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 53) == 6330888686879203287ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 54) == 12661777373758406574ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 55) == 6876810673807261533ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 56) == 13753621347614523066ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 57) == 9060498621519494517ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 58) == 18120997243038989034ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 59) == 17795250412368426453ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 60) == 17143756751027301291ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 61) == 15840769428345050967ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 62) == 13234794782980550319ULL);
+  ASSERT (rotl64 (16045690984503098046ULL, 63) == 8022845492251549023ULL);
+
+  ASSERT (rotr64 (16045690984503098046ULL, 1) == 8022845492251549023ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 2) == 13234794782980550319ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 3) == 15840769428345050967ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 4) == 17143756751027301291ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 5) == 17795250412368426453ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 6) == 18120997243038989034ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 7) == 9060498621519494517ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 8) == 13753621347614523066ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 9) == 6876810673807261533ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 10) == 12661777373758406574ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 11) == 6330888686879203287ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 12) == 12388816380294377451ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 13) == 15417780227001964533ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 14) == 16932262150355758074ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 15) == 8466131075177879037ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 16) == 13456437574443715326ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 17) == 6728218787221857663ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 18) == 12587481430465704639ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 19) == 15517112752087628127ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 20) == 16981928412898589871ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 21) == 17714336243304070743ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 22) == 18080540158506811179ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 23) == 18263642116108181397ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 24) == 18355193094908866506ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 25) == 9177596547454433253ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 26) == 13812170310581992434ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 27) == 6906085155290996217ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 28) == 12676414614500273916ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 29) == 6338207307250136958ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 30) == 3169103653625068479ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 31) == 10807923863667310047ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 32) == 14627333968688430831ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 33) == 16537039021198991223ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 34) == 17491891547454271419ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 35) == 17969317810581911517ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 36) == 18208030942145731566ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 37) == 9104015471072865783ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 38) == 13775379772391208699ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 39) == 16111061923050380157ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 40) == 17278902998379965886ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 41) == 8639451499189982943ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 42) == 13543097786449767279ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 43) == 15994920930079659447ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 44) == 17220832501894605531ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 45) == 17833788287802078573ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 46) == 18140266180755815094ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 47) == 9070133090377907547ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 48) == 13758438582043729581ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 49) == 16102591327876640598ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 50) == 8051295663938320299ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 51) == 13249019868823935957ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 52) == 15847881971266743786ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 53) == 7923940985633371893ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 54) == 13185342529671461754ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 55) == 6592671264835730877ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 56) == 12519707669272641246ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 57) == 6259853834636320623ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 58) == 12353298954172936119ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 59) == 15400021513941243867ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 60) == 16923382793825397741ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 61) == 17685063433767474678ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 62) == 8842531716883737339ULL);
+  ASSERT (rotr64 (16045690984503098046ULL, 63) == 13644637895296644477ULL);
+#endif /* UINT64_MAX */
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b9551bec16eddb3f7ba6304002f32ed9e90a71fb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-btoc32-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..25caea64d5f96f115cc1d1fbcf19e44050c9da04
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-btoc32${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-btoc32${EXEEXT} 1 || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index 65b1c478a8dc635e784310fb7f2cf5f2c25aa56e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-btoc32-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..ba52767bd2a581bc1399035e72ae3528611ad959
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-btoc32${EXEEXT} 2
deleted file mode 120000 (symlink)
index e2b5382a67b3792918b67f0fb257e6d1364ccde0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-btoc32-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..8c6b180369d1780391b2862a6964feb6a2e903e5
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-btoc32${EXEEXT} 3
deleted file mode 120000 (symlink)
index a1373869c572cbf6408b74d56eef67080eaea24c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-btoc32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7e15dcce1cf8ab9aeab9cb5df0b47cfe6e5d428c
--- /dev/null
@@ -0,0 +1,94 @@
+/* Test of conversion of unibyte character to 32-bit wide character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (btoc32, wint_t, (int));
+
+#include <locale.h>
+#include <stdio.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  int c;
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  ASSERT (btoc32 (EOF) == WEOF);
+
+#ifdef __ANDROID__
+  /* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
+     "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
+     locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
+     that is, effectively the "C.UTF-8" locale.  */
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
+#endif
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '1':
+        /* C or POSIX locale.  */
+        for (c = 0; c < 0x100; c++)
+          if (c != 0)
+            {
+              /* We are testing all nonnull bytes.  */
+              wint_t wc = btoc32 (c);
+              /* POSIX:2018 says regarding btowc: "In the POSIX locale, btowc()
+                 shall not return WEOF if c has a value in the range 0 to 255
+                 inclusive."  It is reasonable to expect btoc32 to behave in
+                 the same way.  */
+              if (c < 0x80)
+                /* c is an ASCII character.  */
+                ASSERT (wc == c);
+              else
+                /* On most platforms, the bytes 0x80..0xFF map to U+0080..U+00FF.
+                   But on musl libc, the bytes 0x80..0xFF map to U+DF80..U+DFFF.  */
+                ASSERT (wc == c || wc == 0xDF00 + c);
+            }
+        return 0;
+
+      case '2':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        for (c = 0; c < 0x80; c++)
+          ASSERT (btoc32 (c) == c);
+        for (c = 0xA0; c < 0x100; c++)
+          ASSERT (btoc32 (c) != WEOF);
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        for (c = 0; c < 0x80; c++)
+          ASSERT (btoc32 (c) == c);
+        for (c = 0x80; c < 0x100; c++)
+          ASSERT (btoc32 (c) == WEOF);
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 1a7f97efc0ff8c60842e6e3bceb58d11312e89d7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-btowc-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..d6776565d6f16d61b3cb7b10e6d7018674472c24
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-btowc${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-btowc${EXEEXT} 1 || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index 49e1317d8699f61177eee58a1bedf43f11a915df..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-btowc-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..9f939d6cbbb782257683703408806d0f564a571a
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-btowc${EXEEXT} 2
deleted file mode 120000 (symlink)
index b7bc5020f2fca58a0f621708eb3ed07e7dbe3bd5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-btowc-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..4124476564d799d05d07d6c5a4b76114a4668f2c
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-btowc${EXEEXT} 3
deleted file mode 120000 (symlink)
index 7e9a8e1a70cf17f3923113786a9b65ecca768dcc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-btowc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aeac4bbf764dfa2b438ab1e3ea090486307b417a
--- /dev/null
@@ -0,0 +1,91 @@
+/* Test of conversion of unibyte character to wide character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (btowc, wint_t, (int));
+
+#include <locale.h>
+#include <stdio.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  int c;
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  ASSERT (btowc (EOF) == WEOF);
+
+#ifdef __ANDROID__
+  /* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
+     "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
+     locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
+     that is, effectively the "C.UTF-8" locale.  */
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
+#endif
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '1':
+        /* C or POSIX locale.  */
+        for (c = 0; c < 0x100; c++)
+          if (c != 0)
+            {
+              /* We are testing all nonnull bytes.  */
+              wint_t wc = btowc (c);
+              /* POSIX:2018 says: "In the POSIX locale, btowc() shall not return
+                 WEOF if c has a value in the range 0 to 255 inclusive."  */
+              if (c < 0x80)
+                /* c is an ASCII character.  */
+                ASSERT (wc == c);
+              else
+                /* On most platforms, the bytes 0x80..0xFF map to U+0080..U+00FF.
+                   But on musl libc, the bytes 0x80..0xFF map to U+DF80..U+DFFF.  */
+                ASSERT (wc == c || wc == 0xDF00 + c);
+            }
+        return 0;
+
+      case '2':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        for (c = 0; c < 0x80; c++)
+          ASSERT (btowc (c) == c);
+        for (c = 0xA0; c < 0x100; c++)
+          ASSERT (btowc (c) != WEOF);
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        for (c = 0; c < 0x80; c++)
+          ASSERT (btowc (c) == c);
+        for (c = 0x80; c < 0x100; c++)
+          ASSERT (btowc (c) == WEOF);
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index b2b49c4af8e1ae14c85932c93abc717ceda75972..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-byteswap.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..85f7fd419378c60c2aabc4c8d1e227b048500b66
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test of <byteswap.h> substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <byteswap.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  ASSERT (bswap_16 (0xABCD) == 0xCDAB);
+  ASSERT (bswap_32 (0xDEADBEEF) == 0xEFBEADDE);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 057af1ac97b2876f0695acf852d57e6a1f3d8bf9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c-ctype.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8414a31d9ecca086ae9c60a16015182f7c94a972
--- /dev/null
@@ -0,0 +1,228 @@
+/* Test of character handling in C locale.
+   Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+#include "c-ctype.h"
+
+#include <ctype.h>
+#include <limits.h>
+#include <locale.h>
+
+#include "macros.h"
+
+static void
+test_agree_with_C_locale (void)
+{
+  int c;
+
+  for (c = 0; c <= UCHAR_MAX; c++)
+    {
+      ASSERT (c_isascii (c) == (isascii (c) != 0));
+      if (c_isascii (c))
+        {
+          ASSERT (c_isalnum (c) == (isalnum (c) != 0));
+          ASSERT (c_isalpha (c) == (isalpha (c) != 0));
+          ASSERT (c_isblank (c) == (isblank (c) != 0));
+          ASSERT (c_iscntrl (c) == (iscntrl (c) != 0));
+          ASSERT (c_isdigit (c) == (isdigit (c) != 0));
+          ASSERT (c_islower (c) == (islower (c) != 0));
+          ASSERT (c_isgraph (c) == (isgraph (c) != 0));
+          ASSERT (c_isprint (c) == (isprint (c) != 0));
+          ASSERT (c_ispunct (c) == (ispunct (c) != 0));
+          ASSERT (c_isspace (c) == (isspace (c) != 0));
+          ASSERT (c_isupper (c) == (isupper (c) != 0));
+          ASSERT (c_isxdigit (c) == (isxdigit (c) != 0));
+          ASSERT (c_tolower (c) == tolower (c));
+          ASSERT (c_toupper (c) == toupper (c));
+        }
+    }
+}
+
+static void
+test_all (void)
+{
+  int c;
+  int n_isascii = 0;
+
+  for (c = CHAR_MIN; c <= UCHAR_MAX; c++)
+    {
+      if (! (0 <= c && c <= CHAR_MAX))
+        {
+          ASSERT (! c_isascii (c));
+          ASSERT (! c_isalnum (c));
+          ASSERT (! c_isalpha (c));
+          ASSERT (! c_isblank (c));
+          ASSERT (! c_iscntrl (c));
+          ASSERT (! c_isdigit (c));
+          ASSERT (! c_islower (c));
+          ASSERT (! c_isgraph (c));
+          ASSERT (! c_isprint (c));
+          ASSERT (! c_ispunct (c));
+          ASSERT (! c_isspace (c));
+          ASSERT (! c_isupper (c));
+          ASSERT (! c_isxdigit (c));
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == c);
+        }
+
+      n_isascii += c_isascii (c);
+
+#ifdef C_CTYPE_ASCII
+      ASSERT (c_isascii (c) == (0 <= c && c <= 0x7f));
+#endif
+
+      ASSERT (c_isascii (c) == (c_isprint (c) || c_iscntrl (c)));
+
+      ASSERT (c_isalnum (c) == (c_isalpha (c) || c_isdigit (c)));
+
+      ASSERT (c_isalpha (c) == (c_islower (c) || c_isupper (c)));
+
+      switch (c)
+        {
+        case '\t': case ' ':
+          ASSERT (c_isblank (c) == 1);
+          break;
+        default:
+          ASSERT (c_isblank (c) == 0);
+          break;
+        }
+
+#ifdef C_CTYPE_ASCII
+      ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f));
+#endif
+
+      switch (c)
+        {
+        case '\a': case '\b': case '\f': case '\n':
+        case '\r': case '\t': case '\v':
+          ASSERT (c_iscntrl (c));
+          break;
+        }
+
+      ASSERT (! (c_iscntrl (c) && c_isprint (c)));
+
+      switch (c)
+        {
+        case '0': case '1': case '2': case '3': case '4': case '5':
+        case '6': case '7': case '8': case '9':
+          ASSERT (c_isdigit (c) == 1);
+          break;
+        default:
+          ASSERT (c_isdigit (c) == 0);
+          break;
+        }
+
+      switch (c)
+        {
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+        case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+        case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+        case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+        case 'y': case 'z':
+          ASSERT (c_islower (c) == 1);
+          ASSERT (c_toupper (c) == c - 'a' + 'A');
+          break;
+        default:
+          ASSERT (c_islower (c) == 0);
+          ASSERT (c_toupper (c) == c);
+          break;
+        }
+
+#ifdef C_CTYPE_ASCII
+      ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' '));
+
+      ASSERT (c_isprint (c) == (c >= 0x20 && c < 0x7f));
+#endif
+
+      ASSERT (c_isgraph (c) == (c_isalnum (c) || c_ispunct (c)));
+
+      ASSERT (c_isprint (c) == (c_isgraph (c) || c == ' '));
+
+      switch (c)
+        {
+        case '!': case '"': case '#': case '$': case '%': case '&': case '\'':
+        case '(': case ')': case '*': case '+': case ',': case '-': case '.':
+        case '/': case ':': case ';': case '<': case '=': case '>': case '?':
+        case '@': case '[': case'\\': case ']': case '^': case '_': case '`':
+        case '{': case '|': case '}': case '~':
+          ASSERT (c_ispunct (c) == 1);
+          break;
+        default:
+          ASSERT (c_ispunct (c) == 0);
+          break;
+        }
+
+      switch (c)
+        {
+        case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
+          ASSERT (c_isspace (c) == 1);
+          break;
+        default:
+          ASSERT (c_isspace (c) == 0);
+          break;
+        }
+
+      switch (c)
+        {
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+        case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+        case 'Y': case 'Z':
+          ASSERT (c_isupper (c) == 1);
+          ASSERT (c_tolower (c) == c - 'A' + 'a');
+          break;
+        default:
+          ASSERT (c_isupper (c) == 0);
+          ASSERT (c_tolower (c) == c);
+          break;
+        }
+
+      switch (c)
+        {
+        case '0': case '1': case '2': case '3': case '4': case '5':
+        case '6': case '7': case '8': case '9':
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+          ASSERT (c_isxdigit (c) == 1);
+          break;
+        default:
+          ASSERT (c_isxdigit (c) == 0);
+          break;
+        }
+    }
+
+  ASSERT (n_isascii == 128);
+}
+
+int
+main ()
+{
+  test_agree_with_C_locale ();
+
+  test_all ();
+
+  setlocale (LC_ALL, "de_DE");
+  test_all ();
+
+  setlocale (LC_ALL, "ja_JP.EUC-JP");
+  test_all ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 119b75903b8d874dc780800391f5d83d3010911e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c-strcase.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..9f491e0f960a757171bccb9dcb5e115b52e7e7c9
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Test in the C locale.
+${CHECKER} ./test-c-strcasecmp${EXEEXT} || exit 1
+${CHECKER} ./test-c-strncasecmp${EXEEXT} || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR ${CHECKER} ./test-c-strcasecmp${EXEEXT} locale || exit 1
+  LC_ALL=$LOCALE_FR ${CHECKER} ./test-c-strncasecmp${EXEEXT} locale || exit 1
+fi
+
+# Test in a Turkish UTF-8 locale.
+: "${LOCALE_TR_UTF8=tr_TR.UTF-8}"
+if test $LOCALE_TR_UTF8 != none; then
+  LC_ALL=$LOCALE_TR_UTF8 ${CHECKER} ./test-c-strcasecmp${EXEEXT} locale || exit 1
+  LC_ALL=$LOCALE_TR_UTF8 ${CHECKER} ./test-c-strncasecmp${EXEEXT} locale || exit 1
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 3dfa00c84c5e66adc18a7a81ee0f77e7cde5d412..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c-strcasecmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fd07e0093aab5954443e590c0944d8a55d30ee3b
--- /dev/null
@@ -0,0 +1,68 @@
+/* Test of case-insensitive string comparison function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "c-strcase.h"
+#include "c-ctype.h"
+
+#include <locale.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  if (argc > 1)
+    {
+      /* configure should already have checked that the locale is supported.  */
+      if (setlocale (LC_ALL, "") == NULL)
+        return 1;
+    }
+
+  ASSERT (c_strcasecmp ("paragraph", "Paragraph") == 0);
+
+  ASSERT (c_strcasecmp ("paragrapH", "parAgRaph") == 0);
+
+  ASSERT (c_strcasecmp ("paragraph", "paraLyzed") < 0);
+  ASSERT (c_strcasecmp ("paraLyzed", "paragraph") > 0);
+
+  ASSERT (c_strcasecmp ("para", "paragraph") < 0);
+  ASSERT (c_strcasecmp ("paragraph", "para") > 0);
+
+  /* The following tests shows how c_strcasecmp() is different from
+     strcasecmp().  */
+
+  ASSERT (c_strcasecmp ("\311mile", "\351mile") < 0);
+  ASSERT (c_strcasecmp ("\351mile", "\311mile") > 0);
+
+  /* The following tests shows how c_strcasecmp() is different from
+     mbscasecmp().  */
+
+  ASSERT (c_strcasecmp ("\303\266zg\303\274r", "\303\226ZG\303\234R") > 0); /* özgür */
+  ASSERT (c_strcasecmp ("\303\226ZG\303\234R", "\303\266zg\303\274r") < 0); /* özgür */
+
+#if C_CTYPE_ASCII
+  /* This test shows how strings of different size cannot compare equal.  */
+  ASSERT (c_strcasecmp ("turkish", "TURK\304\260SH") < 0);
+  ASSERT (c_strcasecmp ("TURK\304\260SH", "turkish") > 0);
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 44fad4f45705a59916286d18ae3745522858a981..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c-strcasestr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..39fad3ccc6ebdedd76565ea272e6b3bfe34d848f
--- /dev/null
@@ -0,0 +1,272 @@
+/* Test of case-insensitive searching in a string.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "c-strcasestr.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  {
+    const char input[] = "foo";
+    const char *result = c_strcasestr (input, "");
+    ASSERT (result == input);
+  }
+
+  {
+    const char input[] = "foo";
+    const char *result = c_strcasestr (input, "O");
+    ASSERT (result == input + 1);
+  }
+
+  {
+    const char input[] = "ABC ABCDAB ABCDABCDABDE";
+    const char *result = c_strcasestr (input, "ABCDaBD");
+    ASSERT (result == input + 15);
+  }
+
+  {
+    const char input[] = "ABC ABCDAB ABCDABCDABDE";
+    const char *result = c_strcasestr (input, "ABCDaBE");
+    ASSERT (result == NULL);
+  }
+
+  {
+    const char input[] = "ABC ABCDAB ABCDABCDABDE";
+    const char *result = c_strcasestr (input, "ABCDaBCD");
+    ASSERT (result == input + 11);
+  }
+
+  /* Check that a long periodic needle does not cause false positives.  */
+  {
+    const char input[] = "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+                         "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+                         "_C3_A7_20_EF_BF_BD";
+    const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+    const char *result = c_strcasestr (input, need);
+    ASSERT (result == NULL);
+  }
+  {
+    const char input[] = "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+                         "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+                         "_C3_A7_20_EF_BF_BD_DA_B5_C2_A6_20"
+                         "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+    const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+    const char *result = c_strcasestr (input, need);
+    ASSERT (result == input + 115);
+  }
+
+  /* Check that a very long haystack is handled quickly if the needle is
+     short and occurs near the beginning.  */
+  {
+    size_t repeat = 10000;
+    size_t m = 1000000;
+    const char *needle =
+      "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaAaaaaaaAAAAaaaaaaa"
+      "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+    char *haystack = (char *) malloc (m + 1);
+    if (haystack != NULL)
+      {
+        memset (haystack, 'A', m);
+        haystack[0] = 'B';
+        haystack[m] = '\0';
+
+        for (; repeat > 0; repeat--)
+          {
+            ASSERT (c_strcasestr (haystack, needle) == haystack + 1);
+          }
+
+        free (haystack);
+      }
+  }
+
+  /* Check that a very long needle is discarded quickly if the haystack is
+     short.  */
+  {
+    size_t repeat = 10000;
+    size_t m = 1000000;
+    const char *haystack =
+      "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+      "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB";
+    char *needle = (char *) malloc (m + 1);
+    if (needle != NULL)
+      {
+        memset (needle, 'A', m);
+        needle[m] = '\0';
+
+        for (; repeat > 0; repeat--)
+          {
+            ASSERT (c_strcasestr (haystack, needle) == NULL);
+          }
+
+        free (needle);
+      }
+  }
+
+  /* Check that the asymptotic worst-case complexity is not quadratic.  */
+  {
+    size_t m = 1000000;
+    char *haystack = (char *) malloc (2 * m + 2);
+    char *needle = (char *) malloc (m + 2);
+    if (haystack != NULL && needle != NULL)
+      {
+        const char *result;
+
+        memset (haystack, 'A', 2 * m);
+        haystack[2 * m] = 'B';
+        haystack[2 * m + 1] = '\0';
+
+        memset (needle, 'a', m);
+        needle[m] = 'B';
+        needle[m + 1] = '\0';
+
+        result = c_strcasestr (haystack, needle);
+        ASSERT (result == haystack + m);
+      }
+    free (needle);
+    free (haystack);
+  }
+
+  {
+    /* Ensure that with a barely periodic "short" needle, c_strcasestr's
+       search does not mistakenly skip just past the match point.
+       This use of c_strcasestr would mistakenly return NULL before
+       gnulib v0.0-4927.  */
+    const char *haystack =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "enable_generated_files_in_srcdir\n"
+      "with_gnu_ld\n"
+      "with_ld\n"
+      "with_demangler_in_ld\n"
+      "with_gnu_as\n"
+      "with_as\n"
+      "enable_largefile\n"
+      "enable_werror_always\n"
+      "enable_checking\n"
+      "enable_coverage\n"
+      "enable_gather_detailed_mem_stats\n"
+      "enable_build_with_cxx\n"
+      "with_stabs\n"
+      "enable_multilib\n"
+      "enable___cxa_atexit\n"
+      "enable_decimal_float\n"
+      "enable_fixed_point\n"
+      "enable_threads\n"
+      "enable_tls\n"
+      "enable_objc_gc\n"
+      "with_dwarf2\n"
+      "enable_shared\n"
+      "with_build_sysroot\n"
+      "with_sysroot\n"
+      "with_specs\n"
+      "with_pkgversion\n"
+      "with_bugurl\n"
+      "enable_languages\n"
+      "with_multilib_list\n";
+    const char *needle = "\n"
+      "with_GNU_ld\n";
+    const char* p = c_strcasestr (haystack, needle);
+    ASSERT (p - haystack == 114);
+  }
+
+  {
+    /* Same bug, shorter trigger.  */
+    const char *haystack = "..wi.D.";
+    const char *needle = ".d.";
+    const char* p = c_strcasestr (haystack, needle);
+    ASSERT (p - haystack == 4);
+  }
+
+  {
+    /* Like the above, but trigger the flaw in two_way_long_needle
+       by using a needle of length LONG_NEEDLE_THRESHOLD (32) or greater.
+       Rather than trying to find the right alignment manually, I've
+       arbitrarily chosen the following needle and template for the
+       haystack, and ensure that for each placement of the needle in
+       that haystack, c_strcasestr finds it.  */
+    const char *needle = "\nwith_gnu_ld-extend-to-len-32-b\n";
+    const char *h =
+      "\n"
+      "with_build_libsubdir\n"
+      "with_local_prefix\n"
+      "with_gxx_include_dir\n"
+      "with_cpp_install_dir\n"
+      "with_e_\n"
+      "..............................\n"
+      "with_FGHIJKLMNOPQRSTUVWXYZ\n"
+      "with_567890123456789\n"
+      "with_multilib_list\n";
+    size_t h_len = strlen (h);
+    char *haystack = malloc (h_len + 1);
+    size_t i;
+    ASSERT (haystack);
+    for (i = 0; i < h_len - strlen (needle); i++)
+      {
+        const char *p;
+        memcpy (haystack, h, h_len + 1);
+        memcpy (haystack + i, needle, strlen (needle) + 1);
+        p = c_strcasestr (haystack, needle);
+        ASSERT (p);
+        ASSERT (p - haystack == i);
+      }
+    free (haystack);
+  }
+
+  /* Test case from Yves Bastide.
+     <https://www.openwall.com/lists/musl/2014/04/18/2>  */
+  {
+    const char input[] = "playing PLAY play PLAY always";
+    const char *result = c_strcasestr (input, "play PLAY play");
+    ASSERT (result == input + 8);
+  }
+
+  /* Test long needles.  */
+  {
+    size_t m = 1024;
+    char *haystack = (char *) malloc (2 * m + 1);
+    char *needle = (char *) malloc (m + 1);
+    if (haystack != NULL && needle != NULL)
+      {
+        const char *p;
+        haystack[0] = 'x';
+        memset (haystack + 1, ' ', m - 1);
+        memset (haystack + m, 'x', m);
+        haystack[2 * m] = '\0';
+        memset (needle, 'X', m);
+        needle[m] = '\0';
+        p = c_strcasestr (haystack, needle);
+        ASSERT (p);
+        ASSERT (p - haystack == m);
+      }
+    free (needle);
+    free (haystack);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index d3837c8fb16b4fa5282a22a0985cd404ab6cfd48..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c-strncasecmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a8bb3358f2c5165698c59464bf8a8476f09ba6ee
--- /dev/null
@@ -0,0 +1,82 @@
+/* Test of case-insensitive string comparison function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "c-strcase.h"
+#include "c-ctype.h"
+
+#include <locale.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  if (argc > 1)
+    {
+      /* configure should already have checked that the locale is supported.  */
+      if (setlocale (LC_ALL, "") == NULL)
+        return 1;
+    }
+
+  ASSERT (c_strncasecmp ("paragraph", "Paragraph", 1000000) == 0);
+  ASSERT (c_strncasecmp ("paragraph", "Paragraph", 9) == 0);
+
+  ASSERT (c_strncasecmp ("paragrapH", "parAgRaph", 1000000) == 0);
+  ASSERT (c_strncasecmp ("paragrapH", "parAgRaph", 9) == 0);
+
+  ASSERT (c_strncasecmp ("paragraph", "paraLyzed", 10) < 0);
+  ASSERT (c_strncasecmp ("paragraph", "paraLyzed", 9) < 0);
+  ASSERT (c_strncasecmp ("paragraph", "paraLyzed", 5) < 0);
+  ASSERT (c_strncasecmp ("paragraph", "paraLyzed", 4) == 0);
+  ASSERT (c_strncasecmp ("paraLyzed", "paragraph", 10) > 0);
+  ASSERT (c_strncasecmp ("paraLyzed", "paragraph", 9) > 0);
+  ASSERT (c_strncasecmp ("paraLyzed", "paragraph", 5) > 0);
+  ASSERT (c_strncasecmp ("paraLyzed", "paragraph", 4) == 0);
+
+  ASSERT (c_strncasecmp ("para", "paragraph", 10) < 0);
+  ASSERT (c_strncasecmp ("para", "paragraph", 9) < 0);
+  ASSERT (c_strncasecmp ("para", "paragraph", 5) < 0);
+  ASSERT (c_strncasecmp ("para", "paragraph", 4) == 0);
+  ASSERT (c_strncasecmp ("paragraph", "para", 10) > 0);
+  ASSERT (c_strncasecmp ("paragraph", "para", 9) > 0);
+  ASSERT (c_strncasecmp ("paragraph", "para", 5) > 0);
+  ASSERT (c_strncasecmp ("paragraph", "para", 4) == 0);
+
+  /* The following tests shows how c_strncasecmp() is different from
+     strncasecmp().  */
+
+  ASSERT (c_strncasecmp ("\311mily", "\351mile", 4) < 0);
+  ASSERT (c_strncasecmp ("\351mile", "\311mily", 4) > 0);
+
+  /* The following tests shows how c_strncasecmp() is different from
+     mbsncasecmp().  */
+
+  ASSERT (c_strncasecmp ("\303\266zg\303\274r", "\303\226ZG\303\234R", 99) > 0); /* özgür */
+  ASSERT (c_strncasecmp ("\303\226ZG\303\234R", "\303\266zg\303\274r", 99) < 0); /* özgür */
+
+#if C_CTYPE_ASCII
+  /* This test shows how strings of different size cannot compare equal.  */
+  ASSERT (c_strncasecmp ("turkish", "TURK\304\260SH", 7) < 0);
+  ASSERT (c_strncasecmp ("TURK\304\260SH", "turkish", 7) > 0);
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index a34d00ff3fb98d7d1e0eb30f0015e1b9b2dd3f0d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32_apply_type_test.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e943ed95e2f15b6b19b61ab5de44c515b9d84359
--- /dev/null
@@ -0,0 +1,170 @@
+/* Test of 32-bit wide character properties.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32_apply_type_test, int, (wint_t, c32_type_test_t));
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  c32_type_test_t desc;
+
+  desc = c32_get_type_test ("any");
+  ASSERT (desc == (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("blank");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\n', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("space");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\n', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("punct");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) '$', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '.', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '<', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '>', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '1', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("lower");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '1', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("upper");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '1', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("alpha");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '1', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '$', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("digit");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'f', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'F', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("xdigit");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'f', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'F', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'g', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'G', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("alnum");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '_', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("cntrl");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) '\0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\n', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\\', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("graph");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '$', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\n', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\0', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  desc = c32_get_type_test ("print");
+  ASSERT (desc != (c32_type_test_t) 0);
+  ASSERT (c32_apply_type_test ((char32_t) 'a', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'A', desc));
+  ASSERT (c32_apply_type_test ((char32_t) 'Z', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '0', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '9', desc));
+  ASSERT (c32_apply_type_test ((char32_t) '$', desc));
+  ASSERT (c32_apply_type_test ((char32_t) ' ', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\t', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\n', desc));
+  ASSERT (! c32_apply_type_test ((char32_t) '\0', desc));
+  ASSERT (! c32_apply_type_test (WEOF, desc));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index fdd92fa24ef886fc4d090df36e138cbcf358905e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32_get_type_test.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..24b15bdc3c03d249a51ce24754fa4cf24b879542
--- /dev/null
@@ -0,0 +1,73 @@
+/* Test of getting descriptor for a 32-bit wide character property.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32_get_type_test, c32_type_test_t, (const char *));
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  c32_type_test_t desc;
+
+  desc = c32_get_type_test ("any");
+  ASSERT (desc == (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("blank");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("space");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("punct");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("lower");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("upper");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("alpha");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("digit");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("xdigit");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("alnum");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("cntrl");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("graph");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  desc = c32_get_type_test ("print");
+  ASSERT (desc != (c32_type_test_t) 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index e9c62ca664ab59041a163129027493c516fcce84..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isalnum.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4f75e0f4aa06cadd094afdd79484528a7e0db02c
--- /dev/null
@@ -0,0 +1,261 @@
+/* Test of c32isalnum() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32isalnum, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32isalnum for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32isalnum (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32isalnum (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     that
+       - in all locales, the alphanumeric characters include the uppercase and
+         lowercase characters and digits and, consequently, include the A ... Z
+         and a ... z and 0 ... 9 characters.
+       - in the "POSIX" locale (which is usually the same as the "C" locale),
+         the alphanumeric characters include only the ASCII A ... Z and a ... z
+         and 0 ... 9 characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+            case 'A': case 'B': case 'C': case 'D': case 'E':
+            case 'F': case 'G': case 'H': case 'I': case 'J':
+            case 'K': case 'L': case 'M': case 'N': case 'O':
+            case 'P': case 'Q': case 'R': case 'S': case 'T':
+            case 'U': case 'V': case 'W': case 'X': case 'Y':
+            case 'Z':
+            case 'a': case 'b': case 'c': case 'd': case 'e':
+            case 'f': case 'g': case 'h': case 'i': case 'j':
+            case 'k': case 'l': case 'm': case 'n': case 'o':
+            case 'p': case 'q': case 'r': case 's': case 't':
+            case 'u': case 'v': case 'w': case 'x': case 'y':
+            case 'z':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\327", 1);
+          ASSERT (is == 0);
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\330", 1);
+          ASSERT (is != 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\241\337", 2);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__)
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\217\251\254", 3);
+          ASSERT (is != 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\217\251\250", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\241\242", 2);
+          ASSERT (is == 0);
+        #if defined __GLIBC__
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is != 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
+          /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+          is = for_character ("\243\355", 2);
+          ASSERT (is != 0);
+        #endif
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\303\227", 2);
+          ASSERT (is == 0);
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\303\230", 2);
+          ASSERT (is != 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\305\201", 2);
+          ASSERT (is != 0);
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\343\200\201", 3);
+          ASSERT (is == 0);
+        #if defined __GLIBC__
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\357\274\221", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+          is = for_character ("\357\275\215", 3);
+          ASSERT (is != 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+10330 GOTHIC LETTER AHSA */
+          is = for_character ("\360\220\214\260", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+          is = for_character ("\360\235\204\200", 4);
+          ASSERT (is == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          is = for_character ("\363\240\201\241", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\241\301", 2);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\201\060\211\061", 4);
+          ASSERT (is != 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\201\060\221\071", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\241\242", 2);
+          ASSERT (is == 0);
+        #if defined __GLIBC__
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is != 0);
+        #endif
+        #if !defined __DragonFly__
+          /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+          is = for_character ("\243\355", 2);
+          ASSERT (is != 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+10330 GOTHIC LETTER AHSA */
+          is = for_character ("\220\060\322\066", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+          is = for_character ("\224\062\273\064", 4);
+          ASSERT (is == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          is = for_character ("\323\066\237\065", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 226527a3fd0a47577db958a41a6ac7074cd075df..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isalnum.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..df94aaded01e2eee52faa6538c49063cc1ff46a5
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32isalnum${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32isalnum${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32isalnum${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32isalnum${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32isalnum${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32isalnum${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 71e1a491ccf7a9aac71356f839a03cf662a0a74e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isalpha.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..14c78d7d236c863960dca58195b8842b564f22a2
--- /dev/null
@@ -0,0 +1,259 @@
+/* Test of c32isalpha() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32isalpha, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32isalpha for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32isalpha (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32isalpha (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     that
+       - in all locales, the alphabetic characters include the uppercase and
+         lowercase characters and, consequently, include the A ... Z and a ... z
+         characters.
+       - in the "POSIX" locale (which is usually the same as the "C" locale),
+         the alphabetic characters include only the ASCII A ... Z and a ... z
+         characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case 'A': case 'B': case 'C': case 'D': case 'E':
+            case 'F': case 'G': case 'H': case 'I': case 'J':
+            case 'K': case 'L': case 'M': case 'N': case 'O':
+            case 'P': case 'Q': case 'R': case 'S': case 'T':
+            case 'U': case 'V': case 'W': case 'X': case 'Y':
+            case 'Z':
+            case 'a': case 'b': case 'c': case 'd': case 'e':
+            case 'f': case 'g': case 'h': case 'i': case 'j':
+            case 'k': case 'l': case 'm': case 'n': case 'o':
+            case 'p': case 'q': case 'r': case 's': case 't':
+            case 'u': case 'v': case 'w': case 'x': case 'y':
+            case 'z':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\327", 1);
+          ASSERT (is == 0);
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\330", 1);
+          ASSERT (is != 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\241\337", 2);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__)
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\217\251\254", 3);
+          ASSERT (is != 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\217\251\250", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\241\242", 2);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__)
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
+          /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+          is = for_character ("\243\355", 2);
+          ASSERT (is != 0);
+        #endif
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\303\227", 2);
+          ASSERT (is == 0);
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\303\230", 2);
+          ASSERT (is != 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\305\201", 2);
+          ASSERT (is != 0);
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\343\200\201", 3);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\357\274\221", 3);
+          ASSERT (is == 0);
+        #endif
+          /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+          is = for_character ("\357\275\215", 3);
+          ASSERT (is != 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+10330 GOTHIC LETTER AHSA */
+          is = for_character ("\360\220\214\260", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+          is = for_character ("\360\235\204\200", 4);
+          ASSERT (is == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          is = for_character ("\363\240\201\241", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\241\301", 2);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\201\060\211\061", 4);
+          ASSERT (is != 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\201\060\221\071", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\241\242", 2);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+        #endif
+        #if !defined __DragonFly__
+          /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+          is = for_character ("\243\355", 2);
+          ASSERT (is != 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+10330 GOTHIC LETTER AHSA */
+          is = for_character ("\220\060\322\066", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+          is = for_character ("\224\062\273\064", 4);
+          ASSERT (is == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          is = for_character ("\323\066\237\065", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 30e00bbfbd2076ed4d07118f722d76ce481c684f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isalpha.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..11c896fa60bd9d77c8e005400e48a914acdb7959
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32isalpha${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32isalpha${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32isalpha${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32isalpha${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32isalpha${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32isalpha${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 9916656617813561e3c57a54e68fdfd01374a15e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isblank.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0e722b257529215ecd7ab07f5254bfd5effad40a
--- /dev/null
@@ -0,0 +1,205 @@
+/* Test of c32isblank() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32isblank, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32isblank for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32isblank (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32isblank (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     that
+       - in all locales, the blank characters include the <space> and <tab>
+         characters,
+       - in the "POSIX" locale (which is usually the same as the "C" locale),
+         the blank characters include only the ASCII <space> and <tab>
+         characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t':
+        #if !(defined __FreeBSD__ || defined __NetBSD__)
+        case '\v':
+        #endif
+        case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          if (c == '\t' || c == ' ')
+            ASSERT (is != 0);
+          else
+            ASSERT (is == 0);
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+        #if defined __GLIBC__
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\240", 1);
+          ASSERT (is == 0);
+        #endif
+          /* U+00B7 MIDDLE DOT */
+          is = for_character ("\267", 1);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+3002 IDEOGRAPHIC FULL STOP */
+          is = for_character ("\241\243", 2);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+        #if defined __GLIBC__
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\302\240", 2);
+          ASSERT (is == 0);
+        #endif
+          /* U+00B7 MIDDLE DOT */
+          is = for_character ("\302\267", 2);
+          ASSERT (is == 0);
+        #if defined __GLIBC__
+          /* U+202F NARROW NO-BREAK SPACE */
+          is = for_character ("\342\200\257", 3);
+          ASSERT (is == 0);
+        #endif
+          /* U+3002 IDEOGRAPHIC FULL STOP */
+          is = for_character ("\343\200\202", 3);
+          ASSERT (is == 0);
+          /* U+1D13D MUSICAL SYMBOL QUARTER REST */
+          is = for_character ("\360\235\204\275", 4);
+          ASSERT (is == 0);
+          /* U+E0020 TAG SPACE */
+          is = for_character ("\363\240\200\240", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+        #if defined __GLIBC__
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\201\060\204\062", 4);
+          ASSERT (is == 0);
+        #endif
+          /* U+00B7 MIDDLE DOT */
+          is = for_character ("\241\244", 2);
+          ASSERT (is == 0);
+        #if defined __GLIBC__
+          /* U+202F NARROW NO-BREAK SPACE */
+          is = for_character ("\201\066\247\062", 4);
+          ASSERT (is == 0);
+        #endif
+          /* U+3002 IDEOGRAPHIC FULL STOP */
+          is = for_character ("\241\243", 2);
+          ASSERT (is == 0);
+          /* U+1D13D MUSICAL SYMBOL QUARTER REST */
+          is = for_character ("\224\062\301\065", 4);
+          ASSERT (is == 0);
+          /* U+E0020 TAG SPACE */
+          is = for_character ("\323\066\231\060", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 7e921e9ac5c10901f286551bcbf542c19a85f274..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isblank.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..fe5f9b86bfd1989ab161a5b8a7f2e6b7dd56ca57
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32isblank${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32isblank${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32isblank${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32isblank${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32isblank${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32isblank${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 122ece2846251c2114424ae545a9a21acdcdd3c0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32iscntrl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..674c5804124f5f265274a09ed9bad18869e78f3e
--- /dev/null
@@ -0,0 +1,212 @@
+/* Test of c32iscntrl() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32iscntrl, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32iscntrl for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32iscntrl (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32iscntrl (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     no explicit list of control characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case '\t': case '\v': case '\f':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is != 0);
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\240", 1);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is != 0);
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\241\241", 2);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is != 0);
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\302\240", 2);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
+          /* U+202E RIGHT-TO-LEFT OVERRIDE */
+          is = for_character ("\342\200\256", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\343\200\200", 3);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
+          /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
+          is = for_character ("\357\273\277", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+20000 <CJK Ideograph> */
+          is = for_character ("\360\240\200\200", 4);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+E0001 LANGUAGE TAG */
+          is = for_character ("\363\240\200\201", 4);
+          ASSERT (is != 0);
+        #endif
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is != 0);
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\201\060\204\062", 4);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+202E RIGHT-TO-LEFT OVERRIDE */
+          is = for_character ("\201\066\247\061", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\241\241", 2);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
+          is = for_character ("\204\061\225\063", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+20000 <CJK Ideograph> */
+          is = for_character ("\225\062\202\066", 4);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+E0001 LANGUAGE TAG */
+          is = for_character ("\323\066\225\071", 4);
+          ASSERT (is != 0);
+        #endif
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index a73b2e068a5d5ddad9bf38886ececfee80665bd2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32iscntrl.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b27747c726fc5544efd561e4be6e5f0fceb8e0c3
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32iscntrl${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32iscntrl${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32iscntrl${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32iscntrl${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32iscntrl${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32iscntrl${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 5ecb221c18ce2a43e78e5ad54a7930e28a6fdd4f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..82b77015f0a08775848abeadecc6aabcfcc28a3c
--- /dev/null
@@ -0,0 +1,236 @@
+/* Test of c32isdigit() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32isdigit, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32isdigit for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32isdigit (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32isdigit (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     ISO C 99 sections 7.25.2.1.5 and 5.2.1 specify that the decimal digits
+     include only the ASCII 0 ... 9 characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\262", 1);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\263", 1);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\271", 1);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\302\262", 2);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\302\263", 2);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\302\271", 2);
+          ASSERT (is == 0);
+          /* U+0663 ARABIC-INDIC DIGIT THREE */
+          is = for_character ("\331\243", 2);
+          ASSERT (is == 0);
+          /* U+2070 SUPERSCRIPT ZERO */
+          is = for_character ("\342\201\260", 3);
+          ASSERT (is == 0);
+          /* U+2079 SUPERSCRIPT NINE */
+          is = for_character ("\342\201\271", 3);
+          ASSERT (is == 0);
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\357\274\221", 3);
+          ASSERT (is == 0);
+          /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */
+          is = for_character ("\360\235\237\221", 4);
+          ASSERT (is == 0);
+          /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */
+          is = for_character ("\360\235\237\233", 4);
+          ASSERT (is == 0);
+          /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */
+          is = for_character ("\360\235\237\245", 4);
+          ASSERT (is == 0);
+          /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */
+          is = for_character ("\360\235\237\257", 4);
+          ASSERT (is == 0);
+          /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */
+          is = for_character ("\360\235\237\271", 4);
+          ASSERT (is == 0);
+          /* U+E0033 TAG DIGIT THREE */
+          is = for_character ("\363\240\200\263", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\201\060\205\065", 4);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\201\060\205\066", 4);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\201\060\206\061", 4);
+          ASSERT (is == 0);
+          /* U+0663 ARABIC-INDIC DIGIT THREE */
+          is = for_character ("\201\061\211\071", 4);
+          ASSERT (is == 0);
+          /* U+2070 SUPERSCRIPT ZERO */
+          is = for_character ("\201\066\255\062", 4);
+          ASSERT (is == 0);
+          /* U+2079 SUPERSCRIPT NINE */
+          is = for_character ("\201\066\256\061", 4);
+          ASSERT (is == 0);
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+          /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */
+          is = for_character ("\224\063\353\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */
+          is = for_character ("\224\063\354\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */
+          is = for_character ("\224\063\355\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */
+          is = for_character ("\224\063\356\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */
+          is = for_character ("\224\063\357\071", 4);
+          ASSERT (is == 0);
+          /* U+E0033 TAG DIGIT THREE */
+          is = for_character ("\323\066\232\071", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 8a3bf2536334b23993bf1fd316f69e3bf02ba19b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isdigit.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..158d36287281588aa773b9510452323ad55dc4d4
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32isdigit${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32isdigit${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32isdigit${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32isdigit${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32isdigit${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32isdigit${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index e4c88a3a55421a0ed71a7dfb57dcaea3d145f726..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isgraph.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fb993bbb9664e93dcd7a98cd23313b66ec34dd63
--- /dev/null
@@ -0,0 +1,247 @@
+/* Test of c32isgraph() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32isgraph, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32isgraph for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32isgraph (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32isgraph (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     no explicit list of graphic characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case '\t': case '\v': case '\f':
+            case ' ':
+              ASSERT (is == 0);
+              break;
+            default:
+              ASSERT (is != 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sgi || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\240", 1);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+00B8 CEDILLA */
+          is = for_character ("\270", 1);
+          ASSERT (is != 0);
+        #endif
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__)
+          /* U+00B8 CEDILLA */
+          is = for_character ("\217\242\261", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\241\241", 2);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\302\240", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+00B8 CEDILLA */
+          is = for_character ("\302\270", 2);
+          ASSERT (is != 0);
+          /* U+2002 EN SPACE */
+          is = for_character ("\342\200\202", 3);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
+          /* U+202E RIGHT-TO-LEFT OVERRIDE */
+          is = for_character ("\342\200\256", 3);
+          ASSERT (is == 0);
+        #endif
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\343\200\200", 3);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
+          /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
+          is = for_character ("\357\273\277", 3);
+          ASSERT (is == 0);
+        #endif
+        #if !defined __sun
+          /* U+20000 <CJK Ideograph> */
+          is = for_character ("\360\240\200\200", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+E0001 LANGUAGE TAG */
+          is = for_character ("\363\240\200\201", 4);
+          ASSERT (is == 0);
+        #endif
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\201\060\204\062", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00B8 CEDILLA */
+          is = for_character ("\201\060\206\060", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+2002 EN SPACE */
+          is = for_character ("\201\066\243\070", 4);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
+          /* U+202E RIGHT-TO-LEFT OVERRIDE */
+          is = for_character ("\201\066\247\061", 4);
+          ASSERT (is == 0);
+        #endif
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\241\241", 2);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
+          /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
+          is = for_character ("\204\061\225\063", 4);
+          ASSERT (is == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+20000 <CJK Ideograph> */
+          is = for_character ("\225\062\202\066", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
+          /* U+E0001 LANGUAGE TAG */
+          is = for_character ("\323\066\225\071", 4);
+          ASSERT (is == 0);
+        #endif
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 0bdf841b7996b41afde3a2b4a996a141e566583e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isgraph.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..be760fb2f37e8c58a9d9ee2b4bb949760e00baab
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32isgraph${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32isgraph${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32isgraph${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32isgraph${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32isgraph${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32isgraph${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 03a322d9c66fca6b8f26c2b4091022bdd738a0e2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32islower.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3b799677fb3ad7e3b6c621160cd7a2415e475893
--- /dev/null
@@ -0,0 +1,354 @@
+/* Test of c32islower() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32islower, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32islower for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32islower (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32islower (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     that
+       - in all locales, the lowercase characters include the a ... z
+         characters,
+       - in the "POSIX" locale (which is usually the same as the "C" locale),
+         the lowercase characters include only the ASCII a ... z characters.
+   */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case 'a': case 'b': case 'c': case 'd': case 'e':
+            case 'f': case 'g': case 'h': case 'i': case 'j':
+            case 'k': case 'l': case 'm': case 'n': case 'o':
+            case 'p': case 'q': case 'r': case 's': case 't':
+            case 'u': case 'v': case 'w': case 'x': case 'y':
+            case 'z':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\262", 1);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+00B5 MICRO SIGN */
+          is = for_character ("\265", 1);
+          ASSERT (is == 0);
+        #endif
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          is = for_character ("\311", 1);
+          ASSERT (is == 0);
+        #if !defined __CYGWIN__
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\337", 1);
+          ASSERT (is != 0);
+        #endif
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          is = for_character ("\351", 1);
+          ASSERT (is != 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          is = for_character ("\377", 1);
+          ASSERT (is != 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          is = for_character ("\217\252\261", 3);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __CYGWIN__)
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\217\251\316", 3);
+          ASSERT (is != 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          is = for_character ("\217\253\261", 3);
+          ASSERT (is != 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          is = for_character ("\217\253\363", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\217\251\250", 3);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
+          /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+          is = for_character ("\217\251\310", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+          is = for_character ("\247\273", 2);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+          is = for_character ("\247\353", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+3073 HIRAGANA LETTER BI */
+          is = for_character ("\244\323", 2);
+          ASSERT (is == 0);
+        #if !defined __DragonFly__
+          /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */
+          is = for_character ("\243\347", 2);
+          ASSERT (is != 0);
+        #endif
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\302\262", 2);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+00B5 MICRO SIGN */
+          is = for_character ("\302\265", 2);
+          ASSERT (is == 0);
+        #endif
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          is = for_character ("\303\211", 2);
+          ASSERT (is == 0);
+        #if !defined __CYGWIN__
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\303\237", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          is = for_character ("\303\251", 2);
+          ASSERT (is != 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          is = for_character ("\303\277", 2);
+          ASSERT (is != 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\305\201", 2);
+          ASSERT (is == 0);
+          /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+          is = for_character ("\305\202", 2);
+          ASSERT (is != 0);
+          /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+          is = for_character ("\320\251", 2);
+          ASSERT (is == 0);
+          /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+          is = for_character ("\321\211", 2);
+          ASSERT (is != 0);
+          /* U+05D5 HEBREW LETTER VAV */
+          is = for_character ("\327\225", 2);
+          ASSERT (is == 0);
+          /* U+3073 HIRAGANA LETTER BI */
+          is = for_character ("\343\201\263", 3);
+          ASSERT (is == 0);
+          /* U+3162 HANGUL LETTER YI */
+          is = for_character ("\343\205\242", 3);
+          ASSERT (is == 0);
+          /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */
+          is = for_character ("\357\275\207", 3);
+          ASSERT (is != 0);
+          /* U+FFDB HALFWIDTH HANGUL LETTER YI */
+          is = for_character ("\357\277\233", 3);
+          ASSERT (is == 0);
+          /* U+10419 DESERET CAPITAL LETTER EF */
+          is = for_character ("\360\220\220\231", 4);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+10441 DESERET SMALL LETTER EF */
+          is = for_character ("\360\220\221\201", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          is = for_character ("\363\240\201\201", 4);
+          ASSERT (is == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          is = for_character ("\363\240\201\241", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\201\060\205\065", 4);
+          ASSERT (is == 0);
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__)
+          /* U+00B5 MICRO SIGN */
+          is = for_character ("\201\060\205\070", 4);
+          ASSERT (is == 0);
+        #endif
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          is = for_character ("\201\060\207\067", 4);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\201\060\211\070", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !defined __DragonFly__
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          is = for_character ("\250\246", 2);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          is = for_character ("\201\060\213\067", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\201\060\221\071", 4);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+          is = for_character ("\201\060\222\060", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+          is = for_character ("\247\273", 2);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+          is = for_character ("\247\353", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+05D5 HEBREW LETTER VAV */
+          is = for_character ("\201\060\371\067", 4);
+          ASSERT (is == 0);
+          /* U+3073 HIRAGANA LETTER BI */
+          is = for_character ("\244\323", 2);
+          ASSERT (is == 0);
+          /* U+3162 HANGUL LETTER YI */
+          is = for_character ("\201\071\256\062", 4);
+          ASSERT (is == 0);
+        #if !defined __DragonFly__
+          /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */
+          is = for_character ("\243\347", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+FFDB HALFWIDTH HANGUL LETTER YI */
+          is = for_character ("\204\061\241\071", 4);
+          ASSERT (is == 0);
+          /* U+10419 DESERET CAPITAL LETTER EF */
+          is = for_character ("\220\060\351\071", 4);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+10441 DESERET SMALL LETTER EF */
+          is = for_character ("\220\060\355\071", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          is = for_character ("\323\066\234\063", 4);
+          ASSERT (is == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          is = for_character ("\323\066\237\065", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index db3a1275de4a6e694657f293350e44d0e89c988e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32islower.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..f8b9840ce021995f4411602f47e7edd811073d30
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32islower${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32islower${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32islower${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32islower${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32islower${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32islower${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 9cef099a0c4805ffebcd11bc3636bfec57560dd4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isprint.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d28eb4922a490d735a258bea3363e6357a2b40d9
--- /dev/null
@@ -0,0 +1,250 @@
+/* Test of c32isprint() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32isprint, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32isprint for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32isprint (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32isprint (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     no explicit list of printable characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case '\t': case '\v': case '\f':
+              ASSERT (is == 0);
+              break;
+            default:
+              ASSERT (is != 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sgi || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\240", 1);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+00B8 CEDILLA */
+          is = for_character ("\270", 1);
+          ASSERT (is != 0);
+        #endif
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__)
+          /* U+00B8 CEDILLA */
+          is = for_character ("\217\242\261", 3);
+          ASSERT (is != 0);
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\241\241", 2);
+          ASSERT (is != 0);
+        #endif
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\302\240", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+00B8 CEDILLA */
+          is = for_character ("\302\270", 2);
+          ASSERT (is != 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+2002 EN SPACE */
+          is = for_character ("\342\200\202", 3);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
+          /* U+202E RIGHT-TO-LEFT OVERRIDE */
+          is = for_character ("\342\200\256", 3);
+          ASSERT (is == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\343\200\200", 3);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
+          is = for_character ("\357\273\277", 3);
+          ASSERT (is == 0);
+        #endif
+        #if !defined __sun
+          /* U+20000 <CJK Ideograph> */
+          is = for_character ("\360\240\200\200", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+E0001 LANGUAGE TAG */
+          is = for_character ("\363\240\200\201", 4);
+          ASSERT (is == 0);
+        #endif
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+007F <control> */
+          is = for_character ("\177", 1);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00A0 NO-BREAK SPACE */
+          is = for_character ("\201\060\204\062", 4);
+          ASSERT (is != 0);
+          /* U+00B8 CEDILLA */
+          is = for_character ("\201\060\206\060", 4);
+          ASSERT (is != 0);
+          /* U+2002 EN SPACE */
+          is = for_character ("\201\066\243\070", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
+          /* U+202E RIGHT-TO-LEFT OVERRIDE */
+          is = for_character ("\201\066\247\061", 4);
+          ASSERT (is == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\241\241", 2);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
+          /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
+          is = for_character ("\204\061\225\063", 4);
+          ASSERT (is == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+20000 <CJK Ideograph> */
+          is = for_character ("\225\062\202\066", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
+          /* U+E0001 LANGUAGE TAG */
+          is = for_character ("\323\066\225\071", 4);
+          ASSERT (is == 0);
+        #endif
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index a6ce1f88807fb831bcf80081dcaa415f71811bea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isprint.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..d455413ba3c31ef40940faa2d166da8fe0f20347
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32isprint${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32isprint${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32isprint${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32isprint${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32isprint${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32isprint${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 0e78412a0bb2576deb5354466fd07be70be84eda..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32ispunct.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1b9f8e3b3ce8e88f6d524a4592e244424a36651d
--- /dev/null
@@ -0,0 +1,330 @@
+/* Test of c32ispunct() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32ispunct, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32ispunct for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32ispunct (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32ispunct (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     no explicit list of punctuation or symbol characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case ' ':
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+            case 'A': case 'B': case 'C': case 'D': case 'E':
+            case 'F': case 'G': case 'H': case 'I': case 'J':
+            case 'K': case 'L': case 'M': case 'N': case 'O':
+            case 'P': case 'Q': case 'R': case 'S': case 'T':
+            case 'U': case 'V': case 'W': case 'X': case 'Y':
+            case 'Z':
+            case 'a': case 'b': case 'c': case 'd': case 'e':
+            case 'f': case 'g': case 'h': case 'i': case 'j':
+            case 'k': case 'l': case 'm': case 'n': case 'o':
+            case 'p': case 'q': case 'r': case 's': case 't':
+            case 'u': case 'v': case 'w': case 'x': case 'y':
+            case 'z':
+              /* c is an alphanumeric or space character.  */
+              ASSERT (is == 0);
+              break;
+            case '!': case '"': case '#': case '%':
+            case '&': case '\'': case '(': case ')': case '*':
+            case '+': case ',': case '-': case '.': case '/':
+            case ':': case ';': case '<': case '=': case '>':
+            case '?':
+            case '[': case '\\': case ']': case '^': case '_':
+            case '{': case '|': case '}': case '~':
+              /* These characters are usually expected to be punctuation or
+                 symbol characters.  */
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        /* These characters are not in the ISO C "basic character set", but
+           are nevertheless usually expected to be punctuation or symbol
+           characters.  */
+        is = for_character ("$", 1);
+        ASSERT (is != 0);
+        is = for_character ("@", 1);
+        ASSERT (is != 0);
+        is = for_character ("`", 1);
+        ASSERT (is != 0);
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+00BF INVERTED QUESTION MARK */
+          is = for_character ("\277", 1);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\327", 1);
+          ASSERT (is != 0);
+        #endif
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\330", 1);
+          ASSERT (is == 0);
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\337", 1);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
+          /* U+00BF INVERTED QUESTION MARK */
+          is = for_character ("\217\242\304", 3);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\241\337", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\217\251\254", 3);
+          ASSERT (is == 0);
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\217\251\316", 3);
+          ASSERT (is == 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\217\251\250", 3);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
+          /* U+2192 RIGHTWARDS ARROW */
+          is = for_character ("\242\252", 2);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\241\242", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+          /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+          is = for_character ("\243\355", 2);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00BF INVERTED QUESTION MARK */
+          is = for_character ("\302\277", 2);
+          ASSERT (is != 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\303\227", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\303\230", 2);
+          ASSERT (is == 0);
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\303\237", 2);
+          ASSERT (is == 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\305\201", 2);
+          ASSERT (is == 0);
+          /* U+05F3 HEBREW PUNCTUATION GERESH */
+          is = for_character ("\327\263", 2);
+          ASSERT (is != 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+2192 RIGHTWARDS ARROW */
+          is = for_character ("\342\206\222", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\343\200\201", 3);
+          ASSERT (is != 0);
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\357\274\221", 3);
+          ASSERT (is == 0);
+          /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+          is = for_character ("\357\275\215", 3);
+          ASSERT (is == 0);
+          /* U+10330 GOTHIC LETTER AHSA */
+          is = for_character ("\360\220\214\260", 4);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+          is = for_character ("\360\235\204\200", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+          /* U+E003A TAG COLON */
+          is = for_character ("\363\240\200\272", 4);
+          ASSERT (is == 0);
+        #endif
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00BF INVERTED QUESTION MARK */
+          is = for_character ("\201\060\206\067", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+00D7 MULTIPLICATION SIGN */
+          is = for_character ("\241\301", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+          is = for_character ("\201\060\211\061", 4);
+          ASSERT (is == 0);
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\201\060\211\070", 4);
+          ASSERT (is == 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\201\060\221\071", 4);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+05F3 HEBREW PUNCTUATION GERESH */
+          is = for_character ("\201\060\374\067", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+2192 RIGHTWARDS ARROW */
+          is = for_character ("\241\372", 2);
+          ASSERT (is != 0);
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\241\242", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+          /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+          is = for_character ("\243\355", 2);
+          ASSERT (is == 0);
+          /* U+10330 GOTHIC LETTER AHSA */
+          is = for_character ("\220\060\322\066", 4);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+          is = for_character ("\224\062\273\064", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
+          /* U+E003A TAG COLON */
+          is = for_character ("\323\066\233\066", 4);
+          ASSERT (is == 0);
+        #endif
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 654fda7513203014c1c0027988c3b468abdc4ee9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32ispunct.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..d818bcf7341ff71a5e5a3a96186e825a53cf0346
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32ispunct${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32ispunct${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32ispunct${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32ispunct${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32ispunct${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32ispunct${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index f92d9ba41d59764dd47dfd0d898334b505c893f8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isspace.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..15cf387dcf726f1ced7c2a354513d3a4f7a68eed
--- /dev/null
@@ -0,0 +1,198 @@
+/* Test of c32isspace() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32isspace, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32isspace for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32isspace (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32isspace (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     that
+       - in all locales, the white-space characters include the <space>,
+         <form-feed>, <newline>, <carriage-return>, <tab>, <vertical-tab>
+         characters,
+       - in the "POSIX" locale (which is usually the same as the "C" locale),
+         the white-space characters include only the ASCII <space>, <form-feed>,
+         <newline>, <carriage-return>, <tab>, <vertical-tab> characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\f': case '\n': case '\r': case '\t': case '\v':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set" or one of the explicitly
+             mentioned white-space characters.  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case ' ': case '\f': case '\n': case '\r': case '\t': case '\v':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00B7 MIDDLE DOT */
+          is = for_character ("\267", 1);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\241\241", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\241\242", 2);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00B7 MIDDLE DOT */
+          is = for_character ("\302\267", 2);
+          ASSERT (is == 0);
+          /* U+2002 EN SPACE */
+          is = for_character ("\342\200\202", 3);
+          ASSERT (is != 0);
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\343\200\200", 3);
+          ASSERT (is != 0);
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\343\200\201", 3);
+          ASSERT (is == 0);
+          /* U+E0020 TAG SPACE */
+          is = for_character ("\363\240\200\240", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+00B7 MIDDLE DOT */
+          is = for_character ("\241\244", 2);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+2002 EN SPACE */
+          is = for_character ("\201\066\243\070", 4);
+          ASSERT (is != 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+3000 IDEOGRAPHIC SPACE */
+          is = for_character ("\241\241", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+3001 IDEOGRAPHIC COMMA */
+          is = for_character ("\241\242", 2);
+          ASSERT (is == 0);
+          /* U+E0020 TAG SPACE */
+          is = for_character ("\323\066\231\060", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 9c8ee495cff3cc00b9ce720c8a373affde8e4260..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isspace.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..a704d86bfca1255e1c53f304a2b0a8274574f84a
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32isspace${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32isspace${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32isspace${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32isspace${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32isspace${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32isspace${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 92c9ce5b02db3dc24ea81315461599e3ef176035..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isupper.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..178b0d1998ad52006ca5fc4f665adaf181dbf72f
--- /dev/null
@@ -0,0 +1,340 @@
+/* Test of c32isupper() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32isupper, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32isupper for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32isupper (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32isupper (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     that
+       - in all locales, the uppercase characters include the A ... Z
+         characters,
+       - in the "POSIX" locale (which is usually the same as the "C" locale),
+         the uppercase characters include only the ASCII A ... Z characters.
+   */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case 'A': case 'B': case 'C': case 'D': case 'E':
+            case 'F': case 'G': case 'H': case 'I': case 'J':
+            case 'K': case 'L': case 'M': case 'N': case 'O':
+            case 'P': case 'Q': case 'R': case 'S': case 'T':
+            case 'U': case 'V': case 'W': case 'X': case 'Y':
+            case 'Z':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\262", 1);
+          ASSERT (is == 0);
+          /* U+00B5 MICRO SIGN */
+          is = for_character ("\265", 1);
+          ASSERT (is == 0);
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          is = for_character ("\311", 1);
+          ASSERT (is != 0);
+        #if !defined __hpux
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\337", 1);
+          ASSERT (is == 0);
+        #endif
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          is = for_character ("\351", 1);
+          ASSERT (is == 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          is = for_character ("\377", 1);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          is = for_character ("\217\252\261", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\217\251\316", 3);
+          ASSERT (is == 0);
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          is = for_character ("\217\253\261", 3);
+          ASSERT (is == 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          is = for_character ("\217\253\363", 3);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\217\251\250", 3);
+          ASSERT (is != 0);
+        #endif
+          /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+          is = for_character ("\217\251\310", 3);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+          is = for_character ("\247\273", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+          is = for_character ("\247\353", 2);
+          ASSERT (is == 0);
+          /* U+3073 HIRAGANA LETTER BI */
+          is = for_character ("\244\323", 2);
+          ASSERT (is == 0);
+        #if !defined __DragonFly__
+          /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */
+          is = for_character ("\243\307", 2);
+          ASSERT (is != 0);
+        #endif
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\302\262", 2);
+          ASSERT (is == 0);
+          /* U+00B5 MICRO SIGN */
+          is = for_character ("\302\265", 2);
+          ASSERT (is == 0);
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          is = for_character ("\303\211", 2);
+          ASSERT (is != 0);
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\303\237", 2);
+          ASSERT (is == 0);
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          is = for_character ("\303\251", 2);
+          ASSERT (is == 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          is = for_character ("\303\277", 2);
+          ASSERT (is == 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\305\201", 2);
+          ASSERT (is != 0);
+          /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+          is = for_character ("\305\202", 2);
+          ASSERT (is == 0);
+          /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+          is = for_character ("\320\251", 2);
+          ASSERT (is != 0);
+          /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+          is = for_character ("\321\211", 2);
+          ASSERT (is == 0);
+          /* U+05D5 HEBREW LETTER VAV */
+          is = for_character ("\327\225", 2);
+          ASSERT (is == 0);
+          /* U+3073 HIRAGANA LETTER BI */
+          is = for_character ("\343\201\263", 3);
+          ASSERT (is == 0);
+          /* U+3162 HANGUL LETTER YI */
+          is = for_character ("\343\205\242", 3);
+          ASSERT (is == 0);
+          /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */
+          is = for_character ("\357\274\247", 3);
+          ASSERT (is != 0);
+          /* U+FFDB HALFWIDTH HANGUL LETTER YI */
+          is = for_character ("\357\277\233", 3);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+10419 DESERET CAPITAL LETTER EF */
+          is = for_character ("\360\220\220\231", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+10441 DESERET SMALL LETTER EF */
+          is = for_character ("\360\220\221\201", 4);
+          ASSERT (is == 0);
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          is = for_character ("\363\240\201\201", 4);
+          ASSERT (is == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          is = for_character ("\363\240\201\241", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\201\060\205\065", 4);
+          ASSERT (is == 0);
+          /* U+00B5 MICRO SIGN */
+          is = for_character ("\201\060\205\070", 4);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          is = for_character ("\201\060\207\067", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          is = for_character ("\201\060\211\070", 4);
+          ASSERT (is == 0);
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          is = for_character ("\250\246", 2);
+          ASSERT (is == 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          is = for_character ("\201\060\213\067", 4);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          is = for_character ("\201\060\221\071", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+          is = for_character ("\201\060\222\060", 4);
+          ASSERT (is == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+          is = for_character ("\247\273", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+          is = for_character ("\247\353", 2);
+          ASSERT (is == 0);
+          /* U+05D5 HEBREW LETTER VAV */
+          is = for_character ("\201\060\371\067", 4);
+          ASSERT (is == 0);
+          /* U+3073 HIRAGANA LETTER BI */
+          is = for_character ("\244\323", 2);
+          ASSERT (is == 0);
+          /* U+3162 HANGUL LETTER YI */
+          is = for_character ("\201\071\256\062", 4);
+          ASSERT (is == 0);
+        #if !defined __DragonFly__
+          /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */
+          is = for_character ("\243\307", 2);
+          ASSERT (is != 0);
+        #endif
+          /* U+FFDB HALFWIDTH HANGUL LETTER YI */
+          is = for_character ("\204\061\241\071", 4);
+          ASSERT (is == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+10419 DESERET CAPITAL LETTER EF */
+          is = for_character ("\220\060\351\071", 4);
+          ASSERT (is != 0);
+        #endif
+          /* U+10441 DESERET SMALL LETTER EF */
+          is = for_character ("\220\060\355\071", 4);
+          ASSERT (is == 0);
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          is = for_character ("\323\066\234\063", 4);
+          ASSERT (is == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          is = for_character ("\323\066\237\065", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 6cca3a92f46314fade49952554be3bd34d50a633..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isupper.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..ea3efcb845246c06567e6c19a6c12b7e5e9d1afd
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32isupper${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32isupper${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32isupper${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32isupper${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32isupper${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32isupper${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 33f54dc03c8946a163923ee866f57c40633dd511..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isxdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0c266f47052ea5bcc4dc4fc45caa90066ae347fd
--- /dev/null
@@ -0,0 +1,262 @@
+/* Test of c32isxdigit() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32isxdigit, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of c32isxdigit for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  return c32isxdigit (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = c32isxdigit (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     ISO C 99 sections 7.25.2.1.12 and 6.4.4.1 specify that the hexadecimal
+     digits include only the ASCII 0 ... 9 A ... F a ... f characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+            case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+            case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\262", 1);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\263", 1);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\271", 1);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+          /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
+          is = for_character ("\243\301", 2);
+          ASSERT (is == 0);
+          /* U+FF41 FULLWIDTH LATIN SMALL LETTER A */
+          is = for_character ("\243\341", 2);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\302\262", 2);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\302\263", 2);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\302\271", 2);
+          ASSERT (is == 0);
+          /* U+0663 ARABIC-INDIC DIGIT THREE */
+          is = for_character ("\331\243", 2);
+          ASSERT (is == 0);
+          /* U+2070 SUPERSCRIPT ZERO */
+          is = for_character ("\342\201\260", 3);
+          ASSERT (is == 0);
+          /* U+2079 SUPERSCRIPT NINE */
+          is = for_character ("\342\201\271", 3);
+          ASSERT (is == 0);
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\357\274\221", 3);
+          ASSERT (is == 0);
+          /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
+          is = for_character ("\357\274\241", 3);
+          ASSERT (is == 0);
+          /* U+FF41 FULLWIDTH LATIN SMALL LETTER A */
+          is = for_character ("\357\275\201", 3);
+          ASSERT (is == 0);
+          /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */
+          is = for_character ("\360\235\237\221", 4);
+          ASSERT (is == 0);
+          /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */
+          is = for_character ("\360\235\237\233", 4);
+          ASSERT (is == 0);
+          /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */
+          is = for_character ("\360\235\237\245", 4);
+          ASSERT (is == 0);
+          /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */
+          is = for_character ("\360\235\237\257", 4);
+          ASSERT (is == 0);
+          /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */
+          is = for_character ("\360\235\237\271", 4);
+          ASSERT (is == 0);
+          /* U+E0033 TAG DIGIT THREE */
+          is = for_character ("\363\240\200\263", 4);
+          ASSERT (is == 0);
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          is = for_character ("\363\240\201\201", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\201\060\205\065", 4);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\201\060\205\066", 4);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\201\060\206\061", 4);
+          ASSERT (is == 0);
+          /* U+0663 ARABIC-INDIC DIGIT THREE */
+          is = for_character ("\201\061\211\071", 4);
+          ASSERT (is == 0);
+          /* U+2070 SUPERSCRIPT ZERO */
+          is = for_character ("\201\066\255\062", 4);
+          ASSERT (is == 0);
+          /* U+2079 SUPERSCRIPT NINE */
+          is = for_character ("\201\066\256\061", 4);
+          ASSERT (is == 0);
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+          /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
+          is = for_character ("\243\301", 2);
+          ASSERT (is == 0);
+          /* U+FF41 FULLWIDTH LATIN SMALL LETTER A */
+          is = for_character ("\243\341", 2);
+          ASSERT (is == 0);
+          /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */
+          is = for_character ("\224\063\353\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */
+          is = for_character ("\224\063\354\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */
+          is = for_character ("\224\063\355\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */
+          is = for_character ("\224\063\356\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */
+          is = for_character ("\224\063\357\071", 4);
+          ASSERT (is == 0);
+          /* U+E0033 TAG DIGIT THREE */
+          is = for_character ("\323\066\232\071", 4);
+          ASSERT (is == 0);
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          is = for_character ("\323\066\234\063", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 31be3352c30b128885453ae893f25f21375f7d92..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32isxdigit.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..48f8efa7320ea3662b1a25322cad581ff605ff34
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32isxdigit${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32isxdigit${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32isxdigit${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32isxdigit${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32isxdigit${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32isxdigit${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 09848842534d3bebcc8faf0dac98d97b3162f43c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb-w32-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..e797d0e5eb7f648da18c02c870636c8ee730c176
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1252 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} French_France 1252
deleted file mode 120000 (symlink)
index 1681f286b73a7853b008189db54a75b46f91dd6b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb-w32-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..1b63d472aa9fa04d4c771e6446141117f573b33b
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1256 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
deleted file mode 120000 (symlink)
index 47fc1a55b1881d67eedf39fb1d30ce9f11775dfd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb-w32-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3c0f3db48f679678b71f1bce7389c5c3166493e6
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test some UTF-8 locales.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
deleted file mode 120000 (symlink)
index 84ddf166e08b1e1c30e3a942dc130718f28c705f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb-w32-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..ff59a8727e91fc64df23a01e619991ae69b7afe2
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP932 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} Japanese_Japan 932
deleted file mode 120000 (symlink)
index d4b0e7095d4aefa40c3178c6b7e0273d6078a28d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb-w32-6.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3cf340655272bc1cba392cf690852248e01a1b24
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP950 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} Chinese_Taiwan 950
deleted file mode 120000 (symlink)
index 0a8449dbe0eca4e443ebb518c7158a402f4ad62e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb-w32-7.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..2174c0b572be35308523ce833b8e845a714f30c4
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP936 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} Chinese_China 936
deleted file mode 120000 (symlink)
index fcb674b07c8c82de8e0642d920876b44c2e9b5fc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb-w32-8.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b7e77b28d14fa8cad66ae45b7cf3e77c81eba8ae
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a GB18030 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} Chinese_China 54936
deleted file mode 120000 (symlink)
index 2668ca0ad63573d9cb9bb1c8bb0473392100f6b9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb-w32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3e089d112a19772c6eb2bfa96540788b1df5962f
--- /dev/null
@@ -0,0 +1,349 @@
+/* Test of conversion of wide character to multibyte character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "localcharset.h"
+#include "macros.h"
+
+#if defined _WIN32 && !defined __CYGWIN__
+
+static int
+test_one_locale (const char *name, int codepage)
+{
+  char buf[64];
+  size_t ret;
+
+# if 1
+  /* Portable code to set the locale.  */
+  {
+    char name_with_codepage[1024];
+
+    sprintf (name_with_codepage, "%s.%d", name, codepage);
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name_with_codepage) == NULL)
+      return 77;
+  }
+# else
+  /* Hacky way to set a locale.codepage combination that setlocale() refuses
+     to set.  */
+  {
+    /* Codepage of the current locale, set with setlocale().
+       Not necessarily the same as GetACP().  */
+    extern __declspec(dllimport) unsigned int __lc_codepage;
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name) == NULL)
+      return 77;
+
+    /* Clobber the codepage and MB_CUR_MAX, both set by setlocale().  */
+    __lc_codepage = codepage;
+    switch (codepage)
+      {
+      case 1252:
+      case 1256:
+        MB_CUR_MAX = 1;
+        break;
+      case 932:
+      case 950:
+      case 936:
+        MB_CUR_MAX = 2;
+        break;
+      case 54936:
+      case 65001:
+        MB_CUR_MAX = 4;
+        break;
+      }
+
+    /* Test whether the codepage is really available.  */
+    {
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, " ", 1, &state) == (size_t)(-1))
+        return 77;
+    }
+  }
+# endif
+
+  /* Test NUL character.  */
+  {
+    buf[0] = 'x';
+    ret = c32rtomb (buf, 0, NULL);
+    ASSERT (ret == 1);
+    ASSERT (buf[0] == '\0');
+  }
+
+  /* Test single bytes.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          ret = c32rtomb (buf, btoc32 (c), NULL);
+          ASSERT (ret == 1);
+          ASSERT (buf[0] == (char) c);
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    ret = c32rtomb (NULL, '\0', NULL);
+    ASSERT (ret == 1);
+    ret = c32rtomb (NULL, btoc32 ('x'), NULL);
+    ASSERT (ret == 1);
+  }
+
+  switch (codepage)
+    {
+    case 1252:
+      /* Locale encoding is CP1252, an extension of ISO-8859-1.  */
+      {
+        /* Convert "B\374\337er": "Büßer" */
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\374", 1) == 0);
+        ASSERT (buf[1] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\337", 1) == 0);
+        ASSERT (buf[1] == 'x');
+      }
+      return 0;
+
+    case 1256:
+      /* Locale encoding is CP1256, not the same as ISO-8859-6.  */
+      {
+        /* Convert "x\302\341\346y": "xآلوy" */
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x0622, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\302", 1) == 0);
+        ASSERT (buf[1] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x0644, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\341", 1) == 0);
+        ASSERT (buf[1] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x0648, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\346", 1) == 0);
+        ASSERT (buf[1] == 'x');
+      }
+      return 0;
+
+    case 65001:
+      /* Locale encoding is CP65001 = UTF-8.  */
+      if (strcmp (locale_charset (), "UTF-8") != 0)
+        return 77;
+      {
+        /* Convert "s\303\274\303\237\360\237\230\213!"; "süß😋!" */
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\303\274", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\303\237", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x1F60B, NULL);
+        ASSERT (ret == 4);
+        ASSERT (memcmp (buf, "\360\237\230\213", 4) == 0);
+        ASSERT (buf[4] == 'x');
+      }
+      return 0;
+
+    case 932:
+      /* Locale encoding is CP932, similar to Shift_JIS.  */
+      {
+        /* Convert "<\223\372\226\173\214\352>": "<日本語>" */
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x65E5, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\223\372", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x672C, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\226\173", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x8A9E, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\214\352", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 950:
+      /* Locale encoding is CP950, similar to Big5.  */
+      {
+        /* Convert "<\244\351\245\273\273\171>": "<日本語>" */
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x65E5, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\244\351", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x672C, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\245\273", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x8A9E, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\273\171", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 936:
+      /* Locale encoding is CP936 = GBK, an extension of GB2312.  */
+      {
+        /* Convert "<\310\325\261\276\325\132>": "<日本語>" */
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x65E5, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\310\325", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x672C, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\261\276", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x8A9E, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\325\132", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 54936:
+      /* Locale encoding is CP54936 = GB18030.  */
+      if (strcmp (locale_charset (), "GB18030") != 0)
+        return 77;
+      {
+        /* Convert "s\250\271\201\060\211\070\224\071\375\067!"; "süß😋!" */
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\250\271", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 4);
+        ASSERT (memcmp (buf, "\201\060\211\070", 4) == 0);
+        ASSERT (buf[4] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x1F60B, NULL);
+        ASSERT (ret == 4);
+        ASSERT (memcmp (buf, "\224\071\375\067", 4) == 0);
+        ASSERT (buf[4] == 'x');
+      }
+      return 0;
+
+    default:
+      return 1;
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int codepage = atoi (argv[argc - 1]);
+  int result;
+  int i;
+
+  result = 77;
+  for (i = 1; i < argc - 1; i++)
+    {
+      int ret = test_one_locale (argv[i], codepage);
+
+      if (ret != 77)
+        result = ret;
+    }
+
+  if (result == 77)
+    {
+      fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+               codepage);
+    }
+  return result;
+}
+
+#else
+
+int
+main (int argc, char *argv[])
+{
+  fputs ("Skipping test: not a native Windows system\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 15caf522fa2acf1c8da1bb9f80c0c59e5ba5d0f1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c33d08d3d41f67717c18fbe5fd009bb954a6f6d8
--- /dev/null
@@ -0,0 +1,174 @@
+/* Test of conversion of wide character to multibyte character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32rtomb, size_t, (char *, char32_t, mbstate_t *));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+/* Check the multibyte character s[0..n-1].  */
+static void
+check_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  char buf[64];
+  int iret;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  iret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (iret == n);
+
+  ret = c32rtomb (buf, wc, NULL);
+  ASSERT (ret == n);
+  ASSERT (memcmp (buf, s, n) == 0);
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  ret = c32rtomb (NULL, wc, NULL);
+  ASSERT (ret == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+  char buf[64];
+  size_t ret;
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test NUL character.  */
+  {
+    buf[0] = 'x';
+    ret = c32rtomb (buf, 0, NULL);
+    ASSERT (ret == 1);
+    ASSERT (buf[0] == '\0');
+  }
+
+  /* Test single bytes.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          ret = c32rtomb (buf, btoc32 (c), NULL);
+          ASSERT (ret == 1);
+          ASSERT (buf[0] == (char) c);
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    ret = c32rtomb (NULL, '\0', NULL);
+    ASSERT (ret == 1);
+    ret = c32rtomb (NULL, btoc32 ('x'), NULL);
+    ASSERT (ret == 1);
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '1':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '2':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          const char input[] = "B\374\337er"; /* "Büßer" */
+
+          check_character (input + 1, 1);
+          check_character (input + 2, 1);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          const char input[] = "s\303\274\303\237\360\237\230\213!"; /* "süß😋!" */
+
+          check_character (input + 1, 2);
+          check_character (input + 3, 2);
+          check_character (input + 5, 4);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is EUC-JP.  */
+        {
+          const char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
+
+          check_character (input + 1, 2);
+          check_character (input + 3, 2);
+          check_character (input + 5, 2);
+        }
+        return 0;
+
+      case '5':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          const char input[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
+
+          check_character (input + 1, 2);
+          check_character (input + 3, 4);
+          check_character (input + 7, 4);
+        }
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 8342695445e3e44ec18b8497434f3da996840ee2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32rtomb.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..e5236c976ab436d940eab52a93572775353c57e5
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32rtomb${EXEEXT} 1 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32rtomb${EXEEXT} 1 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32rtomb${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32rtomb${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32rtomb${EXEEXT} 4 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32rtomb${EXEEXT} 5
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 5f1b71a7116c769c1eda96a061453379690e13ca..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32tolower.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..681191b4adcc7adebae837aa9f8a2ed0cf73e93e
--- /dev/null
@@ -0,0 +1,440 @@
+/* Test of c32tolower() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32tolower, wint_t, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Representation of a multibyte character.  */
+#define MBCHAR_BUF_SIZE 6
+struct multibyte
+{
+  size_t nbytes;             /* number of bytes of current character, > 0 */
+  char buf[MBCHAR_BUF_SIZE]; /* room for the bytes */
+};
+
+/* Returns the value of c32tolower for the multibyte character s[0..n-1],
+   as a multibyte character.  */
+static struct multibyte
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+  struct multibyte result;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (char32_t) 0xBADFACE;
+  ret = mbrtoc32 (&wc, s, n, &state);
+  ASSERT (ret == n);
+
+  wc = c32tolower (wc);
+  ASSERT (wc != WEOF);
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  ret = c32rtomb (result.buf, wc, &state);
+  ASSERT (ret != 0);
+  if (ret == (size_t)(-1))
+    /* wc cannot be converted back to multibyte.  */
+    result.nbytes = 0;
+  else
+    {
+      ASSERT (ret <= MBCHAR_BUF_SIZE);
+      result.nbytes = ret;
+    }
+  return result;
+}
+
+int
+main (int argc, char *argv[])
+{
+  wint_t wc;
+  struct multibyte mb;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  wc = c32tolower (WEOF);
+  ASSERT (wc == WEOF);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     that
+       - in all locales, the uppercase characters include the A ... Z
+         characters, and the corresponding characters a ... z (if not in a
+         Turkish locale) are lowercase,
+       - in the "POSIX" locale (which is usually the same as the "C" locale),
+         the uppercase characters include only the ASCII A ... Z characters,
+         and the corresponding characters a ... z are lowercase.
+   */
+#if defined __NetBSD__
+  /* towlower is broken in the zh_CN.GB18030 locale on NetBSD 9.0.
+     See <https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57339>.  */
+  if (!(argc > 1 && argv[1][0] == '4'))
+#endif
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          mb = for_character (buf, 1);
+          switch (c)
+            {
+            case 'A': case 'B': case 'C': case 'D': case 'E':
+            case 'F': case 'G': case 'H': case 'I': case 'J':
+            case 'K': case 'L': case 'M': case 'N': case 'O':
+            case 'P': case 'Q': case 'R': case 'S': case 'T':
+            case 'U': case 'V': case 'W': case 'X': case 'Y':
+            case 'Z':
+              ASSERT (mb.nbytes == 1);
+              ASSERT ((unsigned char) mb.buf[0] == (unsigned char) c - 'A' + 'a');
+              break;
+            default:
+              ASSERT (mb.nbytes == 1);
+              ASSERT ((unsigned char) mb.buf[0] == c);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          mb = for_character ("\262", 1);
+          ASSERT (mb.nbytes == 1);
+          ASSERT (memcmp (mb.buf, "\262", 1) == 0);
+          /* U+00B5 MICRO SIGN */
+          mb = for_character ("\265", 1);
+          ASSERT (mb.nbytes == 1);
+          ASSERT (memcmp (mb.buf, "\265", 1) == 0);
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          mb = for_character ("\311", 1);
+          ASSERT (mb.nbytes == 1);
+          ASSERT (memcmp (mb.buf, "\351", 1) == 0);
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          mb = for_character ("\337", 1);
+          ASSERT (mb.nbytes == 1);
+          ASSERT (memcmp (mb.buf, "\337", 1) == 0);
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          mb = for_character ("\351", 1);
+          ASSERT (mb.nbytes == 1);
+          ASSERT (memcmp (mb.buf, "\351", 1) == 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          mb = for_character ("\377", 1);
+          ASSERT (mb.nbytes == 1);
+          ASSERT (memcmp (mb.buf, "\377", 1) == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+        #if !((defined __APPLE__ && defined __MACH__) || defined __DragonFly__)
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          mb = for_character ("\217\252\261", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\217\253\261", 3) == 0);
+        #endif
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          mb = for_character ("\217\251\316", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\217\251\316", 3) == 0);
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          mb = for_character ("\217\253\261", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\217\253\261", 3) == 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          mb = for_character ("\217\253\363", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\217\253\363", 3) == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __DragonFly__)
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          mb = for_character ("\217\251\250", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\217\251\310", 3) == 0);
+        #endif
+          /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+          mb = for_character ("\217\251\310", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\217\251\310", 3) == 0);
+        #if !defined __DragonFly__
+          /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+          mb = for_character ("\247\273", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\247\353", 2) == 0);
+        #endif
+          /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+          mb = for_character ("\247\353", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\247\353", 2) == 0);
+          /* U+3073 HIRAGANA LETTER BI */
+          mb = for_character ("\244\323", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\244\323", 2) == 0);
+        #if !defined __DragonFly__
+          /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */
+          mb = for_character ("\243\307", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\243\347", 2) == 0);
+        #endif
+          /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */
+          mb = for_character ("\243\347", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\243\347", 2) == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          mb = for_character ("\302\262", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\302\262", 2) == 0);
+          /* U+00B5 MICRO SIGN */
+          mb = for_character ("\302\265", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\302\265", 2) == 0);
+        #if !(defined _WIN32 && !defined __CYGWIN__)
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          mb = for_character ("\303\211", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\303\251", 2) == 0);
+        #endif
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          mb = for_character ("\303\237", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\303\237", 2) == 0);
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          mb = for_character ("\303\251", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\303\251", 2) == 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          mb = for_character ("\303\277", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\303\277", 2) == 0);
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          mb = for_character ("\305\201", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\305\202", 2) == 0);
+          /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+          mb = for_character ("\305\202", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\305\202", 2) == 0);
+          /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+          mb = for_character ("\320\251", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\321\211", 2) == 0);
+          /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+          mb = for_character ("\321\211", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\321\211", 2) == 0);
+          /* U+05D5 HEBREW LETTER VAV */
+          mb = for_character ("\327\225", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\327\225", 2) == 0);
+          /* U+3073 HIRAGANA LETTER BI */
+          mb = for_character ("\343\201\263", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\343\201\263", 3) == 0);
+          /* U+3162 HANGUL LETTER YI */
+          mb = for_character ("\343\205\242", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\343\205\242", 3) == 0);
+          /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */
+          mb = for_character ("\357\274\247", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\357\275\207", 3) == 0);
+          /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */
+          mb = for_character ("\357\275\207", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\357\275\207", 3) == 0);
+          /* U+FFDB HALFWIDTH HANGUL LETTER YI */
+          mb = for_character ("\357\277\233", 3);
+          ASSERT (mb.nbytes == 3);
+          ASSERT (memcmp (mb.buf, "\357\277\233", 3) == 0);
+        #if !(defined __DragonFly__ || defined __sun)
+          /* U+10419 DESERET CAPITAL LETTER EF */
+          mb = for_character ("\360\220\220\231", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\360\220\221\201", 4) == 0);
+        #endif
+          /* U+10441 DESERET SMALL LETTER EF */
+          mb = for_character ("\360\220\221\201", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\360\220\221\201", 4) == 0);
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          mb = for_character ("\363\240\201\201", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\363\240\201\201", 4) == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          mb = for_character ("\363\240\201\241", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\363\240\201\241", 4) == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          mb = for_character ("\201\060\205\065", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\201\060\205\065", 4) == 0);
+          /* U+00B5 MICRO SIGN */
+          mb = for_character ("\201\060\205\070", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\201\060\205\070", 4) == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+          mb = for_character ("\201\060\207\067", 4);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\250\246", 2) == 0);
+        #endif
+          /* U+00DF LATIN SMALL LETTER SHARP S */
+          mb = for_character ("\201\060\211\070", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\201\060\211\070", 4) == 0);
+          /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
+          mb = for_character ("\250\246", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\250\246", 2) == 0);
+          /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+          mb = for_character ("\201\060\213\067", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\201\060\213\067", 4) == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+          /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+          mb = for_character ("\201\060\221\071", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\201\060\222\060", 4) == 0);
+        #endif
+          /* U+0142 LATIN SMALL LETTER L WITH STROKE */
+          mb = for_character ("\201\060\222\060", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\201\060\222\060", 4) == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+          /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+          mb = for_character ("\247\273", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\247\353", 2) == 0);
+        #endif
+          /* U+0449 CYRILLIC SMALL LETTER SHCHA */
+          mb = for_character ("\247\353", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\247\353", 2) == 0);
+          /* U+05D5 HEBREW LETTER VAV */
+          mb = for_character ("\201\060\371\067", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\201\060\371\067", 4) == 0);
+          /* U+3073 HIRAGANA LETTER BI */
+          mb = for_character ("\244\323", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\244\323", 2) == 0);
+          /* U+3162 HANGUL LETTER YI */
+          mb = for_character ("\201\071\256\062", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\201\071\256\062", 4) == 0);
+        #if !defined __DragonFly__
+          /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */
+          mb = for_character ("\243\307", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\243\347", 2) == 0);
+        #endif
+          /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */
+          mb = for_character ("\243\347", 2);
+          ASSERT (mb.nbytes == 2);
+          ASSERT (memcmp (mb.buf, "\243\347", 2) == 0);
+          /* U+FFDB HALFWIDTH HANGUL LETTER YI */
+          mb = for_character ("\204\061\241\071", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\204\061\241\071", 4) == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+          /* U+10419 DESERET CAPITAL LETTER EF */
+          mb = for_character ("\220\060\351\071", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\220\060\355\071", 4) == 0);
+        #endif
+          /* U+10441 DESERET SMALL LETTER EF */
+          mb = for_character ("\220\060\355\071", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\220\060\355\071", 4) == 0);
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          mb = for_character ("\323\066\234\063", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\323\066\234\063", 4) == 0);
+          /* U+E0061 TAG LATIN SMALL LETTER A */
+          mb = for_character ("\323\066\237\065", 4);
+          ASSERT (mb.nbytes == 4);
+          ASSERT (memcmp (mb.buf, "\323\066\237\065", 4) == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 551685d57fffc68e3b4e6d4fea37bd4ac8357035..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32tolower.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..02f3e5f655e49e2c6a879184292bc3c398d6e52b
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# Allow distinguishing the various invocations in the .log file.
+set -x
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32tolower${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32tolower${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-c32tolower${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-c32tolower${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-c32tolower${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-c32tolower${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 8907414e70e761b7dd5890841253e48649a635d6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-c32width.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4ebc1afa7e2ac42d2e51729bcc02ed2cb3c9488a
--- /dev/null
@@ -0,0 +1,104 @@
+/* Test of c32width() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (c32width, int, (char32_t));
+
+#include <locale.h>
+#include <string.h>
+
+#include "c-ctype.h"
+#include "localcharset.h"
+#include "macros.h"
+
+int
+main ()
+{
+  char32_t wc;
+
+#if !GNULIB_WCHAR_SINGLE_LOCALE
+# ifdef C_CTYPE_ASCII
+  /* Test width of ASCII characters.  */
+  for (wc = 0x20; wc < 0x7F; wc++)
+    ASSERT (c32width (wc) == 1);
+# endif
+#endif
+
+  /* Switch to an UTF-8 locale.  */
+  if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL
+      /* Check whether it's really an UTF-8 locale.
+         On OpenBSD 4.0, the setlocale call succeeds only for the LC_CTYPE
+         category and therefore returns "C/fr_FR.UTF-8/C/C/C/C", but the
+         LC_CTYPE category is effectively set to an ASCII LC_CTYPE category;
+         in particular, locale_charset() returns "ASCII".  */
+      && strcmp (locale_charset (), "UTF-8") == 0)
+    {
+      /* Test width of ASCII characters.  */
+      for (wc = 0x20; wc < 0x7F; wc++)
+        ASSERT (c32width (wc) == 1);
+
+      /* Test width of some non-spacing characters.  */
+      ASSERT (c32width (0x0301) == 0);
+      ASSERT (c32width (0x05B0) == 0);
+
+      /* Test width of some format control characters.  */
+      ASSERT (c32width (0x200E) <= 0);
+      ASSERT (c32width (0x2060) <= 0);
+      ASSERT (c32width (0xE0001) <= 0);
+      ASSERT (c32width (0xE0044) <= 0);
+
+      /* Test width of some zero width characters.  */
+      /* While it is desirable that U+200B, U+200C, U+200D have width 0,
+         because this makes wcswidth work better on strings that contain these
+         characters, it is acceptable if an implementation treats these
+         characters like control characters.  */
+      ASSERT (c32width (0x200B) <= 0);
+      ASSERT (c32width (0xFEFF) <= 0);
+
+      /* Test width of some math symbols.
+         U+2202 is marked as having ambiguous width (A) in EastAsianWidth.txt
+         (see <https://www.unicode.org/Public/12.0.0/ucd/EastAsianWidth.txt>).
+         The Unicode Standard Annex 11
+         <https://www.unicode.org/reports/tr11/tr11-36.html>
+         says
+           "Ambiguous characters behave like wide or narrow characters
+            depending on the context (language tag, script identification,
+            associated font, source of data, or explicit markup; all can
+            provide the context). If the context cannot be established
+            reliably, they should be treated as narrow characters by default."
+         For c32width(), the only available context information is the locale.
+         "fr_FR.UTF-8" is a Western locale, not an East Asian locale, therefore
+         U+2202 should be treated like a narrow character.  */
+      ASSERT (c32width (0x2202) == 1);
+
+      /* Test width of some CJK characters.  */
+      ASSERT (c32width (0x3000) == 2);
+      ASSERT (c32width (0xB250) == 2);
+      ASSERT (c32width (0xFF1A) == 2);
+      #if !(defined __FreeBSD__ && __FreeBSD__ < 13 && !defined __GLIBC__)
+      ASSERT (c32width (0x20369) == 2);
+      ASSERT (c32width (0x2F876) == 2);
+      #endif
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index e1a76534172d7c97b36c83a0861d929652e45659..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-calloc-gnu.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cf8c564a53a587c6dd6cb2a2615c3857c6ba0650
--- /dev/null
@@ -0,0 +1,73 @@
+/* Test of calloc function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+#include "macros.h"
+
+/* Return N.
+   Usual compilers are not able to infer something about the return value.  */
+static size_t
+identity (size_t n)
+{
+  unsigned int x = rand ();
+  unsigned int y = x * x * x * x;
+  x++; y |= x * x * x * x;
+  x++; y |= x * x * x * x;
+  x++; y |= x * x * x * x;
+  y = y >> 1;
+  y &= -y;
+  y -= 8;
+  /* At this point Y is zero but GCC doesn't infer this.  */
+  return n + y;
+}
+
+int
+main ()
+{
+  /* Check that calloc (0, 0) is not a NULL pointer.  */
+  {
+    void * volatile p = calloc (0, 0);
+    ASSERT (p != NULL);
+    free (p);
+  }
+
+  /* Check that calloc fails when requested to allocate a block of memory
+     larger than PTRDIFF_MAX or SIZE_MAX bytes.
+     Use 'identity' to avoid a compiler warning from GCC 7.
+     'volatile' is needed to defeat an incorrect optimization by clang 10,
+     see <https://bugs.llvm.org/show_bug.cgi?id=46055>.  */
+  {
+    for (size_t n = 2; n != 0; n <<= 1)
+      {
+        void *volatile p = calloc (PTRDIFF_MAX / n + 1, identity (n));
+        ASSERT (p == NULL);
+        ASSERT (errno == ENOMEM);
+
+        p = calloc (SIZE_MAX / n + 1, identity (n));
+        ASSERT (p == NULL);
+        ASSERT (errno == ENOMEM);
+      }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 6e41a7d900bc13a8a83c5d82700fbbeaacb4dac6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-canonicalize.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6763a525c9ecf70eba7e9ddfbdc7df3233c36427
--- /dev/null
@@ -0,0 +1,440 @@
+/* Test of execution of file name canonicalization.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   may "optimize" the null_ptr function, when its result gets passed to a
+   function that has an argument declared as _GL_ARG_NONNULL.  */
+#define _GL_ARG_NONNULL(params)
+
+#include <config.h>
+
+#include "canonicalize.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "same-inode.h"
+#include "ignore-value.h"
+
+#if GNULIB_defined_canonicalize_file_name
+# include "null-ptr.h"
+#endif
+
+#include "macros.h"
+
+#define BASE "t-can.tmp"
+
+int
+main (void)
+{
+  /* Setup some hierarchy to be used by this test.  Start by removing
+     any leftovers from a previous partial run.  */
+  {
+    int fd;
+    ignore_value (system ("rm -rf " BASE " ise"));
+    ASSERT (mkdir (BASE, 0700) == 0);
+    fd = creat (BASE "/tra", 0600);
+    ASSERT (0 <= fd);
+    ASSERT (close (fd) == 0);
+  }
+
+  /* Check // handling (the easy cases, without symlinks).
+     This // handling is not mandated by POSIX.  However, many applications
+     expect that canonicalize_filename_mode "canonicalizes" the file name,
+     that is, that different results of canonicalize_filename_mode correspond
+     to different files (except for hard links).  */
+  {
+    char *result0 = canonicalize_file_name ("/etc/passwd");
+    if (result0 != NULL) /* This file does not exist on native Windows.  */
+      {
+        char *result;
+
+        result = canonicalize_filename_mode ("/etc/passwd", CAN_MISSING);
+        ASSERT (result != NULL && strcmp (result, result0) == 0);
+
+        result = canonicalize_filename_mode ("/etc//passwd", CAN_MISSING);
+        ASSERT (result != NULL && strcmp (result, result0) == 0);
+
+        result = canonicalize_filename_mode ("/etc///passwd", CAN_MISSING);
+        ASSERT (result != NULL && strcmp (result, result0) == 0);
+
+        /* On Windows, the syntax //host/share/filename denotes a file
+           in a directory named 'share', exported from host 'host'.
+           See also m4/double-slash-root.m4.  */
+#if !(defined _WIN32 || defined __CYGWIN__)
+        result = canonicalize_filename_mode ("//etc/passwd", CAN_MISSING);
+        ASSERT (result != NULL && strcmp (result, result0) == 0);
+
+        result = canonicalize_filename_mode ("//etc//passwd", CAN_MISSING);
+        ASSERT (result != NULL && strcmp (result, result0) == 0);
+
+        result = canonicalize_filename_mode ("//etc///passwd", CAN_MISSING);
+        ASSERT (result != NULL && strcmp (result, result0) == 0);
+#endif
+
+        result = canonicalize_filename_mode ("///etc/passwd", CAN_MISSING);
+        ASSERT (result != NULL && strcmp (result, result0) == 0);
+
+        result = canonicalize_filename_mode ("///etc//passwd", CAN_MISSING);
+        ASSERT (result != NULL && strcmp (result, result0) == 0);
+
+        result = canonicalize_filename_mode ("///etc///passwd", CAN_MISSING);
+        ASSERT (result != NULL && strcmp (result, result0) == 0);
+      }
+  }
+
+  /* Check for ., .., intermediate // handling, and for error cases.  */
+  {
+    char *result1 = canonicalize_file_name (BASE "//./..//" BASE "/tra");
+    char *result2 = canonicalize_filename_mode (BASE "//./..//" BASE "/tra",
+                                                CAN_EXISTING);
+    ASSERT (result1 != NULL);
+    ASSERT (result2 != NULL);
+    ASSERT (strcmp (result1, result2) == 0);
+    ASSERT (strstr (result1, "/" BASE "/tra")
+            == result1 + strlen (result1) - strlen ("/" BASE "/tra"));
+    free (result1);
+    free (result2);
+
+    errno = 0;
+    result1 = canonicalize_file_name ("");
+    ASSERT (result1 == NULL);
+    ASSERT (errno == ENOENT);
+
+    errno = 0;
+    result2 = canonicalize_filename_mode ("", CAN_EXISTING);
+    ASSERT (result2 == NULL);
+    ASSERT (errno == ENOENT);
+
+    /* This test works only if the canonicalize_file_name implementation
+       comes from gnulib.  If it comes from libc, we have no way to prevent
+       gcc from "optimizing" the null_ptr function in invalid ways.  See
+       <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93156>.  */
+#if GNULIB_defined_canonicalize_file_name
+    errno = 0;
+    result1 = canonicalize_file_name (null_ptr ());
+    ASSERT (result1 == NULL);
+    ASSERT (errno == EINVAL);
+#endif
+
+    errno = 0;
+    result2 = canonicalize_filename_mode (NULL, CAN_EXISTING);
+    ASSERT (result2 == NULL);
+    ASSERT (errno == EINVAL);
+
+    errno = 0;
+    result2 = canonicalize_filename_mode (".", CAN_MISSING | CAN_ALL_BUT_LAST);
+    ASSERT (result2 == NULL);
+    ASSERT (errno == EINVAL);
+  }
+
+  /* Check that a non-directory with trailing slash yields NULL.  */
+  {
+    char *result1;
+    char *result2;
+    errno = 0;
+    result1 = canonicalize_file_name (BASE "/tra/");
+    ASSERT (result1 == NULL);
+    ASSERT (errno == ENOTDIR);
+    errno = 0;
+    result2 = canonicalize_filename_mode (BASE "/tra/", CAN_EXISTING);
+    ASSERT (result2 == NULL);
+    ASSERT (errno == ENOTDIR);
+  }
+
+  /* Check that a missing directory yields NULL.  */
+  {
+    char *result1;
+    char *result2;
+    errno = 0;
+    result1 = canonicalize_file_name (BASE "/zzz/..");
+    ASSERT (result1 == NULL);
+    ASSERT (errno == ENOENT);
+    errno = 0;
+    result2 = canonicalize_filename_mode (BASE "/zzz/..", CAN_EXISTING);
+    ASSERT (result2 == NULL);
+    ASSERT (errno == ENOENT);
+  }
+
+  /* From here on out, tests involve symlinks.  */
+  if (symlink (BASE "/ket", "ise") != 0)
+    {
+      ASSERT (remove (BASE "/tra") == 0);
+      ASSERT (rmdir (BASE) == 0);
+      fputs ("skipping test: symlinks not supported on this file system\n",
+             stderr);
+      return 77;
+    }
+  ASSERT (symlink ("bef", BASE "/plo") == 0);
+  ASSERT (symlink ("tra", BASE "/huk") == 0);
+  ASSERT (symlink ("lum", BASE "/bef") == 0);
+  ASSERT (symlink ("wum", BASE "/ouk") == 0);
+  ASSERT (symlink ("../ise", BASE "/ket") == 0);
+  ASSERT (mkdir (BASE "/lum", 0700) == 0);
+  ASSERT (symlink ("s", BASE "/p") == 0);
+  ASSERT (symlink ("d", BASE "/s") == 0);
+  ASSERT (mkdir (BASE "/d", 0700) == 0);
+  ASSERT (close (creat (BASE "/d/2", 0600)) == 0);
+  ASSERT (symlink ("../s/2", BASE "/d/1") == 0);
+  ASSERT (symlink ("//.//../..", BASE "/droot") == 0);
+
+  /* Check that symbolic links are not resolved, with CAN_NOLINKS.  */
+  {
+    char *result1 = canonicalize_filename_mode (BASE "/huk", CAN_NOLINKS);
+    ASSERT (result1 != NULL);
+    ASSERT (strcmp (result1 + strlen (result1) - strlen ("/" BASE "/huk"),
+                    "/" BASE "/huk") == 0);
+    free (result1);
+  }
+
+  /* Check that the symbolic link to a file can be resolved.  */
+  {
+    char *result1 = canonicalize_file_name (BASE "/huk");
+    char *result2 = canonicalize_file_name (BASE "/tra");
+    char *result3 = canonicalize_filename_mode (BASE "/huk", CAN_EXISTING);
+    ASSERT (result1 != NULL);
+    ASSERT (result2 != NULL);
+    ASSERT (result3 != NULL);
+    ASSERT (strcmp (result1, result2) == 0);
+    ASSERT (strcmp (result2, result3) == 0);
+    ASSERT (strcmp (result1 + strlen (result1) - strlen ("/" BASE "/tra"),
+                    "/" BASE "/tra") == 0);
+    free (result1);
+    free (result2);
+    free (result3);
+  }
+
+  /* Check that the symbolic link to a directory can be resolved.  */
+  {
+    char *result1 = canonicalize_file_name (BASE "/plo");
+    char *result2 = canonicalize_file_name (BASE "/bef");
+    char *result3 = canonicalize_file_name (BASE "/lum");
+    char *result4 = canonicalize_filename_mode (BASE "/plo", CAN_EXISTING);
+    ASSERT (result1 != NULL);
+    ASSERT (result2 != NULL);
+    ASSERT (result3 != NULL);
+    ASSERT (result4 != NULL);
+    ASSERT (strcmp (result1, result2) == 0);
+    ASSERT (strcmp (result2, result3) == 0);
+    ASSERT (strcmp (result3, result4) == 0);
+    ASSERT (strcmp (result1 + strlen (result1) - strlen ("/" BASE "/lum"),
+                    "/" BASE "/lum") == 0);
+    free (result1);
+    free (result2);
+    free (result3);
+    free (result4);
+  }
+
+  /* Check that a symbolic link to a nonexistent file yields NULL.  */
+  {
+    char *result1;
+    char *result2;
+    errno = 0;
+    result1 = canonicalize_file_name (BASE "/ouk");
+    ASSERT (result1 == NULL);
+    ASSERT (errno == ENOENT);
+    errno = 0;
+    result2 = canonicalize_filename_mode (BASE "/ouk", CAN_EXISTING);
+    ASSERT (result2 == NULL);
+    ASSERT (errno == ENOENT);
+  }
+
+  /* Check that a non-directory symlink with trailing slash yields NULL,
+     and likewise for other troublesome suffixes.  */
+  {
+    char const *const file_name[]
+      = {
+         BASE "/huk/",
+         BASE "/huk/.",
+         BASE "/huk/./",
+         BASE "/huk/./.",
+         BASE "/huk/x",
+         BASE "/huk/..",
+         BASE "/huk/../",
+         BASE "/huk/../.",
+         BASE "/huk/../x",
+         BASE "/huk/./..",
+         BASE "/huk/././../x",
+        };
+    for (int i = 0; i < sizeof file_name / sizeof *file_name; i++)
+      {
+        errno = 0;
+        ASSERT (!canonicalize_file_name (file_name[i]));
+        ASSERT (errno == ENOTDIR);
+        errno = 0;
+        ASSERT (!canonicalize_filename_mode (file_name[i], CAN_EXISTING));
+        ASSERT (errno == ENOTDIR);
+      }
+  }
+
+  /* Check that a missing directory via symlink yields NULL.  */
+  {
+    char *result1;
+    char *result2;
+    errno = 0;
+    result1 = canonicalize_file_name (BASE "/ouk/..");
+    ASSERT (result1 == NULL);
+    ASSERT (errno == ENOENT);
+    errno = 0;
+    result2 = canonicalize_filename_mode (BASE "/ouk/..", CAN_EXISTING);
+    ASSERT (result2 == NULL);
+    ASSERT (errno == ENOENT);
+  }
+
+  /* Check that a loop of symbolic links is detected.  */
+  {
+    char *result1;
+    char *result2;
+    errno = 0;
+    result1 = canonicalize_file_name ("ise");
+    ASSERT (result1 == NULL);
+    ASSERT (errno == ELOOP);
+    errno = 0;
+    result2 = canonicalize_filename_mode ("ise", CAN_EXISTING);
+    ASSERT (result2 == NULL);
+    ASSERT (errno == ELOOP);
+  }
+
+  /* Check that alternate modes can resolve missing basenames.  */
+  {
+    char *result1 = canonicalize_filename_mode (BASE "/zzz", CAN_ALL_BUT_LAST);
+    char *result2 = canonicalize_filename_mode (BASE "/zzz", CAN_MISSING);
+    char *result3 = canonicalize_filename_mode (BASE "/zzz/", CAN_ALL_BUT_LAST);
+    char *result4 = canonicalize_filename_mode (BASE "/zzz/", CAN_MISSING);
+    ASSERT (result1 != NULL);
+    ASSERT (result2 != NULL);
+    ASSERT (result3 != NULL);
+    ASSERT (result4 != NULL);
+    ASSERT (strcmp (result1, result2) == 0);
+    ASSERT (strcmp (result2, result3) == 0);
+    ASSERT (strcmp (result3, result4) == 0);
+    ASSERT (strcmp (result1 + strlen (result1) - strlen ("/" BASE "/zzz"),
+                    "/" BASE "/zzz") == 0);
+    free (result1);
+    free (result2);
+    free (result3);
+    free (result4);
+  }
+
+  /* Check that alternate modes can resolve broken symlink basenames.  */
+  {
+    char *result1 = canonicalize_filename_mode (BASE "/ouk", CAN_ALL_BUT_LAST);
+    char *result2 = canonicalize_filename_mode (BASE "/ouk", CAN_MISSING);
+    char *result3 = canonicalize_filename_mode (BASE "/ouk/", CAN_ALL_BUT_LAST);
+    char *result4 = canonicalize_filename_mode (BASE "/ouk/", CAN_MISSING);
+    ASSERT (result1 != NULL);
+    ASSERT (result2 != NULL);
+    ASSERT (result3 != NULL);
+    ASSERT (result4 != NULL);
+    ASSERT (strcmp (result1, result2) == 0);
+    ASSERT (strcmp (result2, result3) == 0);
+    ASSERT (strcmp (result3, result4) == 0);
+    ASSERT (strcmp (result1 + strlen (result1) - strlen ("/" BASE "/wum"),
+                    "/" BASE "/wum") == 0);
+    free (result1);
+    free (result2);
+    free (result3);
+    free (result4);
+  }
+
+  /* Check that alternate modes can handle missing dirnames.  */
+  {
+    char *result1 = canonicalize_filename_mode ("t-can.zzz/zzz", CAN_ALL_BUT_LAST);
+    char *result2 = canonicalize_filename_mode ("t-can.zzz/zzz", CAN_MISSING);
+    ASSERT (result1 == NULL);
+    ASSERT (result2 != NULL);
+    ASSERT (strcmp (result2 + strlen (result2) - 14, "/t-can.zzz/zzz") == 0);
+    free (result2);
+  }
+
+  /* Ensure that the following is resolved properly.
+     Before 2007-09-27, it would mistakenly report a loop.  */
+  {
+    char *result1 = canonicalize_filename_mode (BASE, CAN_EXISTING);
+    char *result2 = canonicalize_filename_mode (BASE "/p/1", CAN_EXISTING);
+    ASSERT (result1 != NULL);
+    ASSERT (result2 != NULL);
+    ASSERT (strcmp (result2 + strlen (result1), "/d/2") == 0);
+    free (result1);
+    free (result2);
+  }
+
+  /* Check that leading // within symlinks is honored correctly.  */
+  {
+    struct stat st1;
+    struct stat st2;
+    char *result1 = canonicalize_file_name ("//.");
+    char *result2 = canonicalize_filename_mode ("//.", CAN_EXISTING);
+    char *result3 = canonicalize_file_name (BASE "/droot");
+    char *result4 = canonicalize_filename_mode (BASE "/droot", CAN_EXISTING);
+    ASSERT (result1);
+    ASSERT (result2);
+    ASSERT (result3);
+    ASSERT (result4);
+    ASSERT (stat ("/", &st1) == 0);
+    ASSERT (stat ("//", &st2) == 0);
+    bool same = psame_inode (&st1, &st2);
+#if defined __MVS__ || defined MUSL_LIBC
+    /* On IBM z/OS and musl libc, "/" and "//" both canonicalize to
+       themselves, yet they both have st_dev == st_ino == 1.  */
+    same = false;
+#endif
+    if (same)
+      {
+        ASSERT (strcmp (result1, "/") == 0);
+        ASSERT (strcmp (result2, "/") == 0);
+        ASSERT (strcmp (result3, "/") == 0);
+        ASSERT (strcmp (result4, "/") == 0);
+      }
+    else
+      {
+        ASSERT (strcmp (result1, "//") == 0);
+        ASSERT (strcmp (result2, "//") == 0);
+        ASSERT (strcmp (result3, "//") == 0);
+        ASSERT (strcmp (result4, "//") == 0);
+      }
+    free (result1);
+    free (result2);
+    free (result3);
+    free (result4);
+  }
+
+  /* Cleanup.  */
+  ASSERT (remove (BASE "/droot") == 0);
+  ASSERT (remove (BASE "/d/1") == 0);
+  ASSERT (remove (BASE "/d/2") == 0);
+  ASSERT (remove (BASE "/d") == 0);
+  ASSERT (remove (BASE "/s") == 0);
+  ASSERT (remove (BASE "/p") == 0);
+  ASSERT (remove (BASE "/plo") == 0);
+  ASSERT (remove (BASE "/huk") == 0);
+  ASSERT (remove (BASE "/bef") == 0);
+  ASSERT (remove (BASE "/ouk") == 0);
+  ASSERT (remove (BASE "/ket") == 0);
+  ASSERT (remove (BASE "/lum") == 0);
+  ASSERT (remove (BASE "/tra") == 0);
+  ASSERT (remove (BASE) == 0);
+  ASSERT (remove ("ise") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 34e93ce990dd7d3fbbc14cc6c09feb76f5c5d92c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-chdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..25d168b1af198a568af2f42a60aa8fd39d092960
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test changing to a directory.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (chdir, int, (const char *));
+
+#include "macros.h"
+
+int
+main (void)
+{
+  ASSERT (chdir ("/") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 133d529714b687f61a28907a2d44d69ce432aa0b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-chmod.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..64a37834afab7450f68c4e0423094970203f81ac
--- /dev/null
@@ -0,0 +1,87 @@
+/* Test changing the protections of a file.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (chmod, int, (const char *, mode_t));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-chmod."
+
+int
+main (void)
+{
+  /* Test that chmod works on regular files.  */
+  {
+    struct stat statbuf;
+    unlink (BASE "file");
+    ASSERT (close (creat (BASE "file", 0600)) == 0);
+    ASSERT (chmod (BASE "file", 0400) == 0);
+    ASSERT (stat (BASE "file", &statbuf) >= 0);
+    ASSERT ((statbuf.st_mode & 0700) == 0400);
+
+    errno = 0;
+    ASSERT (chmod (BASE "file/", 0600) == -1);
+    ASSERT (errno == ENOTDIR);
+
+    /* Clean up.  */
+    ASSERT (chmod (BASE "file", 0600) == 0);
+    ASSERT (unlink (BASE "file") == 0);
+  }
+
+  /* Test that chmod works on directories.  */
+  {
+    struct stat statbuf;
+
+    rmdir (BASE "dir");
+    ASSERT (mkdir (BASE "dir", 0700) == 0);
+    ASSERT (chmod (BASE "dir", 0500) == 0);
+    ASSERT (stat (BASE "dir", &statbuf) >= 0);
+    ASSERT ((statbuf.st_mode & 0700) == 0500);
+    ASSERT (chmod (BASE "dir/", 0700) == 0);
+
+    /* Clean up.  */
+    ASSERT (rmdir (BASE "dir") == 0);
+  }
+
+  /* Test that chmod on symlinks modifies the symlink target.  */
+  {
+    unlink (BASE "file");
+    unlink (BASE "link");
+    if (symlink (BASE "file", BASE "link") == 0)
+      {
+        struct stat statbuf;
+        ASSERT (close (creat (BASE "file", 0600)) == 0);
+        chmod (BASE "link", 0400);
+        ASSERT (stat (BASE "file", &statbuf) >= 0);
+        ASSERT ((statbuf.st_mode & 0700) == 0400);
+      }
+    /* Clean up.  */
+    unlink (BASE "file");
+    unlink (BASE "link");
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f2da9370c08192fe7caaea933c59645bf4caae11..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-chown.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4d65336349d8057c2daae092b01922da5dcb7b75
--- /dev/null
@@ -0,0 +1,48 @@
+/* Tests of chown.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (chown, int, (char const *, uid_t, gid_t));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#include "mgetgroups.h"
+#include "stat-time.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-chown.t"
+
+#include "test-chown.h"
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_chown (chown, true);
+}
deleted file mode 120000 (symlink)
index 5a6e5ef478f001ac8fb91c2834d5f29c1919979f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-chown.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..da58838ad810f710e064b0762c6c67fbdafc9e49
--- /dev/null
@@ -0,0 +1,218 @@
+/* Tests of chown.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include "nap.h"
+
+#if !HAVE_GETGID
+# define getgid() ((gid_t) -1)
+#endif
+
+#if !HAVE_GETEGID
+# define getegid() ((gid_t) -1)
+#endif
+
+/* This file is designed to test chown(n,o,g) and
+   chownat(AT_FDCWD,n,o,g,0).  FUNC is the function to test.  Assumes
+   that BASE and ASSERT are already defined, and that appropriate
+   headers are already included.  If PRINT, warn before skipping
+   symlink tests with status 77.  */
+
+static int
+test_chown (int (*func) (char const *, uid_t, gid_t), bool print)
+{
+  struct stat st1;
+  struct stat st2;
+  gid_t *gids = NULL;
+  int gids_count;
+  int result;
+
+  /* Solaris 8 is interesting - if the current process belongs to
+     multiple groups, the current directory is owned by a group that
+     the current process belongs to but different than getegid(), and
+     the current directory does not have the S_ISGID bit, then regular
+     files created in the directory belong to the directory's group,
+     but symlinks belong to the current effective group id.  If
+     S_ISGID is set, then both files and symlinks belong to the
+     directory's group.  However, it is possible to run the testsuite
+     from within a directory owned by a group we don't belong to, in
+     which case all things that we create belong to the current
+     effective gid.  So, work around the issues by creating a
+     subdirectory (we are guaranteed that the subdirectory will be
+     owned by one of our current groups), change ownership of that
+     directory to the current effective gid (which will thus succeed),
+     then create all other files within that directory (eliminating
+     questions on whether inheritance or current id triumphs, since
+     the two methods resolve to the same gid).  */
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  ASSERT (stat (BASE "dir", &st1) == 0);
+
+  /* Filter out mingw and file systems which have no concept of groups.  */
+  result = func (BASE "dir", st1.st_uid, getegid ());
+  if (result == -1 && (errno == ENOSYS || errno == EPERM))
+    {
+      ASSERT (rmdir (BASE "dir") == 0);
+      if (print)
+        fputs ("skipping test: no support for ownership\n", stderr);
+      return 77;
+    }
+  ASSERT (result == 0);
+
+  ASSERT (close (creat (BASE "dir/file", 0600)) == 0);
+  ASSERT (stat (BASE "dir/file", &st1) == 0);
+  ASSERT (st1.st_uid != (uid_t) -1);
+  ASSERT (st1.st_gid != (gid_t) -1);
+  /* On macOS 12, when logged in through ssh, getgid () and getegid () are both
+     == (gid_t) -1.  */
+  if (getgid () != (gid_t) -1)
+    ASSERT (st1.st_gid == getegid ());
+
+  /* Sanity check of error cases.  */
+  errno = 0;
+  ASSERT (func ("", -1, -1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("no_such", -1, -1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("no_such/", -1, -1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "dir/file/", -1, -1) == -1);
+  ASSERT (errno == ENOTDIR);
+
+  /* Check that -1 does not alter ownership.  */
+  ASSERT (func (BASE "dir/file", -1, st1.st_gid) == 0);
+  ASSERT (func (BASE "dir/file", st1.st_uid, -1) == 0);
+  ASSERT (func (BASE "dir/file", (uid_t) -1, (gid_t) -1) == 0);
+  ASSERT (stat (BASE "dir/file", &st2) == 0);
+  ASSERT (st1.st_uid == st2.st_uid);
+  ASSERT (st1.st_gid == st2.st_gid);
+
+  /* Even if the values aren't changing, ctime is required to change
+     if at least one argument is not -1.  */
+  nap ();
+  ASSERT (func (BASE "dir/file", st1.st_uid, st1.st_gid) == 0);
+  ASSERT (stat (BASE "dir/file", &st2) == 0);
+  ASSERT (st1.st_ctime < st2.st_ctime
+          || (st1.st_ctime == st2.st_ctime
+              && get_stat_ctime_ns (&st1) < get_stat_ctime_ns (&st2)));
+
+  /* Test symlink behavior.  */
+  if (symlink ("link", BASE "dir/link2"))
+    {
+      ASSERT (unlink (BASE "dir/file") == 0);
+      ASSERT (rmdir (BASE "dir") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  errno = 0;
+  ASSERT (func (BASE "dir/link2", -1, -1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "dir/link2/", st1.st_uid, st1.st_gid) == -1);
+  ASSERT (errno == ENOENT);
+  ASSERT (symlink ("file", BASE "dir/link") == 0);
+
+  /* For non-privileged users, chown can only portably succeed at
+     changing group ownership of a file we own.  If we belong to at
+     least two groups, then verifying the correct change is simple.
+     But if we belong to only one group, then we fall back on the
+     other observable effect of chown: the ctime must be updated.  */
+  gids_count = mgetgroups (NULL, st1.st_gid, &gids);
+  if (1 < gids_count)
+    {
+      ASSERT (gids[1] != st1.st_gid);
+      if (getgid () != (gid_t) -1)
+        ASSERT (gids[1] != (gid_t) -1);
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+
+      errno = 0;
+      ASSERT (func (BASE "dir/link2/", -1, gids[1]) == -1);
+      ASSERT (errno == ENOTDIR);
+      ASSERT (stat (BASE "dir/file", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+
+      ASSERT (func (BASE "dir/link2", -1, gids[1]) == 0);
+      ASSERT (stat (BASE "dir/file", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      if (getgid () != (gid_t) -1)
+        ASSERT (gids[1] == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+    }
+  else
+    {
+      struct stat l1;
+      struct stat l2;
+      ASSERT (stat (BASE "dir/file", &st1) == 0);
+      ASSERT (lstat (BASE "dir/link", &l1) == 0);
+      ASSERT (lstat (BASE "dir/link2", &l2) == 0);
+
+      nap ();
+      errno = 0;
+      ASSERT (func (BASE "dir/link2/", -1, st1.st_gid) == -1);
+      ASSERT (errno == ENOTDIR);
+      ASSERT (stat (BASE "dir/file", &st2) == 0);
+      ASSERT (st1.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&st1) == get_stat_ctime_ns (&st2));
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (l1.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&l1) == get_stat_ctime_ns (&st2));
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (l2.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&l2) == get_stat_ctime_ns (&st2));
+
+      ASSERT (func (BASE "dir/link2", -1, st1.st_gid) == 0);
+      ASSERT (stat (BASE "dir/file", &st2) == 0);
+      ASSERT (st1.st_ctime < st2.st_ctime
+              || (st1.st_ctime == st2.st_ctime
+                  && get_stat_ctime_ns (&st1) < get_stat_ctime_ns (&st2)));
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (l1.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&l1) == get_stat_ctime_ns (&st2));
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (l2.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&l2) == get_stat_ctime_ns (&st2));
+    }
+
+  /* Cleanup.  */
+  free (gids);
+  ASSERT (unlink (BASE "dir/file") == 0);
+  ASSERT (unlink (BASE "dir/link") == 0);
+  ASSERT (unlink (BASE "dir/link2") == 0);
+  ASSERT (rmdir (BASE "dir") == 0);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8526b22f3c8c61b66f703fa6edce11cd0f0f6b97..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-cloexec.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..76480bb6b25c26eaf616b30ff57be4359069cc52
--- /dev/null
@@ -0,0 +1,152 @@
+/* Test duplicating non-inheritable file descriptors.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "cloexec.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+#endif
+
+#include "binary-io.h"
+#include "macros.h"
+
+/* Return non-zero if FD is open and inheritable across exec/spawn.  */
+static int
+is_inheritable (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  DWORD flags;
+  if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0)
+    return 0;
+  return (flags & HANDLE_FLAG_INHERIT) != 0;
+#else
+# ifndef F_GETFD
+#  error Please port fcntl to your platform
+# endif
+  int i = fcntl (fd, F_GETFD);
+  return 0 <= i && (i & FD_CLOEXEC) == 0;
+#endif
+}
+
+#if !O_BINARY
+# define set_binary_mode my_set_binary_mode
+static int
+set_binary_mode (_GL_UNUSED int fd, _GL_UNUSED int mode)
+{
+  return 0;
+}
+#endif
+
+/* Return non-zero if FD is open in the given MODE, which is either
+   O_TEXT or O_BINARY.  */
+static int
+is_mode (int fd, int mode)
+{
+  int value = set_binary_mode (fd, O_BINARY);
+  set_binary_mode (fd, value);
+  return mode == value;
+}
+
+int
+main (void)
+{
+  const char *file = "test-cloexec.tmp";
+  int fd = creat (file, 0600);
+  int fd2;
+  int bad_fd = getdtablesize ();
+
+  /* Assume std descriptors were provided by invoker.  */
+  ASSERT (STDERR_FILENO < fd);
+  ASSERT (is_inheritable (fd));
+
+  /* Normal use of set_cloexec_flag.  */
+  ASSERT (set_cloexec_flag (fd, true) == 0);
+#if !(defined _WIN32 && ! defined __CYGWIN__)
+  ASSERT (!is_inheritable (fd));
+#endif
+  ASSERT (set_cloexec_flag (fd, false) == 0);
+  ASSERT (is_inheritable (fd));
+
+  /* Normal use of dup_cloexec.  */
+  fd2 = dup_cloexec (fd);
+  ASSERT (fd < fd2);
+  ASSERT (!is_inheritable (fd2));
+  ASSERT (close (fd) == 0);
+  ASSERT (dup_cloexec (fd2) == fd);
+  ASSERT (!is_inheritable (fd));
+  ASSERT (close (fd2) == 0);
+
+  /* On systems that distinguish between text and binary mode,
+     dup_cloexec reuses the mode of the source.  */
+  set_binary_mode (fd, O_BINARY);
+  ASSERT (is_mode (fd, O_BINARY));
+  fd2 = dup_cloexec (fd);
+  ASSERT (fd < fd2);
+  ASSERT (is_mode (fd2, O_BINARY));
+  ASSERT (close (fd2) == 0);
+  set_binary_mode (fd, O_TEXT);
+  ASSERT (is_mode (fd, O_TEXT));
+  fd2 = dup_cloexec (fd);
+  ASSERT (fd < fd2);
+  ASSERT (is_mode (fd2, O_TEXT));
+  ASSERT (close (fd2) == 0);
+
+  /* Test error handling.  */
+  errno = 0;
+  ASSERT (set_cloexec_flag (-1, false) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (set_cloexec_flag (bad_fd, false) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (set_cloexec_flag (fd2, false) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (dup_cloexec (-1) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (dup_cloexec (bad_fd) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (dup_cloexec (fd2) == -1);
+  ASSERT (errno == EBADF);
+
+  /* Clean up.  */
+  ASSERT (close (fd) == 0);
+  ASSERT (unlink (file) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 732c183483b39963b34211bc26b87f060a1113d1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-close.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..47b3aa45edcfc99c9c291205506ef124aa6ad19e
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test closing a file or socket.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (close, int, (int));
+
+#include <errno.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (close (-1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (close (99) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 94a64976ab90fff575bd7499acdd7c46a58d1b03..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-closein.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bfd741a0aec0e046d90a3da4a2695eb1b5ffa9b4
--- /dev/null
@@ -0,0 +1,49 @@
+/* Test of closein module.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#include <config.h>
+
+#include "closein.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "binary-io.h"
+#include "ignore-value.h"
+
+/* With no arguments, do nothing.  With arguments, attempt to consume
+   first 6 bytes of stdin.  In either case, let exit() take care of
+   closing std streams and changing exit status if ferror(stdin).  */
+int
+main (int argc, char **argv)
+{
+  char buf[7];
+  atexit (close_stdin);
+
+  /* close_stdin currently relies on ftell, but mingw ftell is
+     unreliable on text mode input.  */
+  set_binary_mode (0, O_BINARY);
+
+  if (argc > 2)
+    close (0);
+
+  if (argc > 1)
+    ignore_value (fread (buf, 1, 6, stdin));
+  return 0;
+}
deleted file mode 120000 (symlink)
index 33f23f20a505d9451ba690c2002a4f3219d289bb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-closein.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7d0fb919dc6da898f89ad552b86c38eee1e42b8f
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+: "${srcdir=.}"
+. "$srcdir/init.sh"; path_prepend_ .
+
+echo Hello world > in.tmp
+echo world > xout.tmp
+
+fail=0
+# Test with seekable stdin; follow-on process must see remaining data
+(${CHECKER} test-closein; cat) < in.tmp > out1.tmp || fail=1
+cmp out1.tmp in.tmp || fail=1
+
+(${CHECKER} test-closein consume; cat) < in.tmp > out2.tmp || fail=1
+cmp out2.tmp xout.tmp || fail=1
+
+# Test for lack of error on pipe.  Ignore any EPIPE failures from cat.
+cat in.tmp 2>/dev/null | ${CHECKER} test-closein || fail=1
+
+cat in.tmp 2>/dev/null | ${CHECKER} test-closein consume || fail=1
+
+# Test for lack of error when nothing is read
+${CHECKER} test-closein </dev/null || fail=1
+
+${CHECKER} test-closein <&- || fail=1
+
+# Test for no error when EOF is read early
+${CHECKER} test-closein consume </dev/null || fail=1
+
+# Test for error when read fails because no file available
+${CHECKER} test-closein consume close <&- 2>/dev/null && fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index ccf78c1606489e693eb076c454eaed0243dfae5a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-connect.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ea4b66ed6d6b17ae1fba1eccb108c23d7ffc3e55
--- /dev/null
@@ -0,0 +1,60 @@
+/* Test connecting a client socket.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/socket.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (connect, int, (int, const struct sockaddr *, socklen_t));
+
+#include <errno.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+
+#include "sockets.h"
+#include "macros.h"
+
+int
+main (void)
+{
+  (void) gl_sockets_startup (SOCKETS_1_1);
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    struct sockaddr_in addr;
+
+    addr.sin_family = AF_INET;
+    inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr);
+    addr.sin_port = htons (80);
+    {
+      errno = 0;
+      ASSERT (connect (-1, (const struct sockaddr *) &addr, sizeof (addr))
+              == -1);
+      ASSERT (errno == EBADF);
+    }
+    {
+      close (99);
+      errno = 0;
+      ASSERT (connect (99, (const struct sockaddr *) &addr, sizeof (addr))
+              == -1);
+      ASSERT (errno == EBADF);
+    }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 1d1f132410eda9897db5521d58fa3e5739781355..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-copy-acl-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..0fe44a5efc9f209207a0c75705ddaabdf29a5ffc
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Test copy-acl on the file system of /var/tmp, which usually is a local
+# file system.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+if test -d /var/tmp; then
+  TMPDIR=/var/tmp
+else
+  TMPDIR=/tmp
+fi
+test -d $TMPDIR || Exit 77
+export TMPDIR
+
+$BOURNE_SHELL "${srcdir}/test-copy-acl.sh"
+
+Exit $?
deleted file mode 120000 (symlink)
index 13cf1b06972928fe9edbda087a74ad77e6127c32..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-copy-acl-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..a35c12eba1e23be529c03a4a7a5fa5d963b794c5
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Test copy-acl on the file system of the build directory, which may be
+# a local file system or NFS mounted.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+TMPDIR=`pwd`
+export TMPDIR
+
+$BOURNE_SHELL "${srcdir}/test-copy-acl.sh"
+
+Exit $?
deleted file mode 120000 (symlink)
index 85a7b7c90c44fb93f5543b5d8db2f04ce70b6346..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-copy-acl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f19e7bd36ae498caa74fed656b1d458237f47562
--- /dev/null
@@ -0,0 +1,73 @@
+/* Test of copying of files.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  const char *file1;
+  const char *file2;
+  int fd1;
+  struct stat statbuf;
+  int mode;
+  int fd2;
+
+  ASSERT (argc == 3);
+
+  file1 = argv[1];
+  file2 = argv[2];
+
+  fd1 = open (file1, O_RDONLY);
+  if (fd1 < 0 || fstat (fd1, &statbuf) < 0)
+    {
+      fprintf (stderr, "could not open file \"%s\"\n", file1);
+      exit (EXIT_FAILURE);
+    }
+  mode = statbuf.st_mode & 07777;
+
+  fd2 = open (file2, O_WRONLY, 0600);
+  if (fd2 < 0)
+    {
+      fprintf (stderr, "could not open file \"%s\"\n", file2);
+      exit (EXIT_FAILURE);
+    }
+
+#if USE_ACL
+  if (copy_acl (file1, fd1, file2, fd2, mode))
+    exit (EXIT_FAILURE);
+#else
+  chmod (file2, mode);
+#endif
+
+  close (fd2);
+  close (fd1);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index edcf0638b754bec4cc13517cc02f1d7e0322147e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-copy-acl.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..50beba05d3bde546fbf4ecfc6d35b98c1d3848a9
--- /dev/null
@@ -0,0 +1,664 @@
+#!/bin/sh
+
+# Show all commands when run with environment variable VERBOSE=yes.
+test -z "$VERBOSE" || set -x
+
+test "$USE_ACL" = 0 &&
+  {
+    echo "Skipping test: insufficient ACL support"
+    exit 77
+  }
+
+# func_tmpdir
+# creates a temporary directory.
+# Sets variable
+# - tmp             pathname of freshly created temporary directory
+func_tmpdir ()
+{
+  # Use the environment variable TMPDIR, falling back to /tmp. This allows
+  # users to specify a different temporary directory, for example, if their
+  # /tmp is filled up or too small.
+  : "${TMPDIR=/tmp}"
+  {
+    # Use the mktemp program if available. If not available, hide the error
+    # message.
+    tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
+    test -n "$tmp" && test -d "$tmp"
+  } ||
+  {
+    # Use a simple mkdir command. It is guaranteed to fail if the directory
+    # already exists.  $RANDOM is bash specific and expands to empty in shells
+    # other than bash, ksh and zsh.  Its use does not increase security;
+    # rather, it minimizes the probability of failure in a very cluttered /tmp
+    # directory.
+    tmp=$TMPDIR/gl$$-$RANDOM
+    (umask 077 && mkdir "$tmp")
+  } ||
+  {
+    echo "$0: cannot create a temporary directory in $TMPDIR" >&2
+    exit 1
+  }
+}
+
+func_tmpdir
+# builddir may already be set by the script that invokes this one.
+case "$builddir" in
+  '') builddir=`pwd` ;;
+  /* | ?:*) ;;
+  *) builddir=`pwd`/$builddir ;;
+esac
+cd "$builddir" ||
+  {
+    echo "$0: cannot determine build directory (unreadable parent dir?)" >&2
+    exit 1
+  }
+# Switch to a temporary directory, to increase the likelihood that ACLs are
+# supported on the current file system. (/tmp is usually locally mounted,
+# whereas the build dir is sometimes NFS-mounted.)
+( cd "$tmp"
+
+  # Prepare tmpfile0.
+  rm -f tmpfile[0-9] tmpaclout[0-2]
+  echo "Simple contents" > tmpfile0
+  chmod 600 tmpfile0
+
+  # Classification of the platform according to the programs available for
+  # manipulating ACLs.
+  # Possible values are:
+  #   linux, cygwin, freebsd, solaris, hpux, hpuxjfs, osf1, aix, macosx, irix, none.
+  # TODO: Support also native Windows platforms (mingw).
+  acl_flavor=none
+  if (getfacl tmpfile0 >/dev/null) 2>/dev/null; then
+    # Platforms with the getfacl and setfacl programs.
+    # Linux, FreeBSD, Solaris, Cygwin.
+    if (setfacl --help >/dev/null) 2>/dev/null; then
+      # Linux, Cygwin.
+      if (LC_ALL=C setfacl --help | grep ' --set-file' >/dev/null) 2>/dev/null; then
+        # Linux.
+        acl_flavor=linux
+      else
+        acl_flavor=cygwin
+      fi
+    else
+      # FreeBSD, Solaris.
+      if (LC_ALL=C setfacl 2>&1 | grep '\-x entries' >/dev/null) 2>/dev/null; then
+        # FreeBSD.
+        acl_flavor=freebsd
+      else
+        # Solaris.
+        acl_flavor=solaris
+      fi
+    fi
+  else
+    if (lsacl / >/dev/null) 2>/dev/null; then
+      # Platforms with the lsacl and chacl programs.
+      # HP-UX, sometimes also IRIX.
+      if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
+        # HP-UX 11.11 or newer.
+        acl_flavor=hpuxjfs
+      else
+        # HP-UX 11.00.
+        acl_flavor=hpux
+      fi
+    else
+      if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
+        # Tru64, NonStop Kernel.
+        if (getacl -m tmpfile0 >/dev/null) 2>/dev/null; then
+          # Tru64.
+          acl_flavor=osf1
+        else
+          # NonStop Kernel.
+          acl_flavor=nsk
+        fi
+      else
+        if (aclget tmpfile0 >/dev/null) 2>/dev/null; then
+          # AIX.
+          acl_flavor=aix
+        else
+          if (fsaclctl -v >/dev/null) 2>/dev/null; then
+            # Mac OS X.
+            acl_flavor=macosx
+          else
+            if test -f /sbin/chacl; then
+              # IRIX.
+              acl_flavor=irix
+            fi
+          fi
+        fi
+      fi
+    fi
+  fi
+
+  # Define a function to test for the same ACLs, from the point of view of
+  # the programs.
+  # func_test_same_acls file1 file2
+  case $acl_flavor in
+    linux | cygwin | freebsd | solaris)
+      func_test_same_acls ()
+      {
+        getfacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
+        getfacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2
+        cmp tmpaclout1 tmpaclout2 > /dev/null
+      }
+      ;;
+    hpux)
+      func_test_same_acls ()
+      {
+        lsacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
+        lsacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2
+        cmp tmpaclout1 tmpaclout2 > /dev/null
+      }
+      ;;
+    hpuxjfs)
+      func_test_same_acls ()
+      {
+        { lsacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
+          lsacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2
+          cmp tmpaclout1 tmpaclout2 > /dev/null
+        } &&
+        { getacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
+          getacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2
+          cmp tmpaclout1 tmpaclout2 > /dev/null
+        }
+      }
+      ;;
+    osf1 | nsk)
+      func_test_same_acls ()
+      {
+        getacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
+        getacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2
+        cmp tmpaclout1 tmpaclout2 > /dev/null
+      }
+      ;;
+    aix)
+      func_test_same_acls ()
+      {
+        aclget "$1" > tmpaclout1
+        aclget "$2" > tmpaclout2
+        cmp tmpaclout1 tmpaclout2 > /dev/null
+      }
+      ;;
+    macosx)
+      func_test_same_acls ()
+      {
+        /bin/ls -le "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
+        /bin/ls -le "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2
+        cmp tmpaclout1 tmpaclout2 > /dev/null
+      }
+      ;;
+    irix)
+      func_test_same_acls ()
+      {
+        /bin/ls -lD "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
+        /bin/ls -lD "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2
+        cmp tmpaclout1 tmpaclout2 > /dev/null
+      }
+      ;;
+    none)
+      func_test_same_acls ()
+      {
+        :
+      }
+      ;;
+  esac
+
+  # func_test_copy file1 file2
+  # copies file1 to file2 and verifies the permissions and ACLs are the same
+  # on both.
+  func_test_copy ()
+  {
+    echo "Simple contents" > "$2"
+    chmod 600 "$2"
+    ${CHECKER} "$builddir"/test-copy-acl${EXEEXT} "$1" "$2" || exit 1
+    ${CHECKER} "$builddir"/test-sameacls${EXEEXT} "$1" "$2" || exit 1
+    func_test_same_acls                           "$1" "$2" || exit 1
+  }
+
+  func_test_copy tmpfile0 tmpfile1
+
+  if test $acl_flavor != none; then
+    # A POSIX compliant 'id' program.
+    if test -f /usr/xpg4/bin/id; then
+      ID=/usr/xpg4/bin/id
+    else
+      ID=id
+    fi
+    # Use a user and group id different from the current one, to avoid
+    # redundant/ambiguous ACLs.
+    myuid=`$ID -u`
+    mygid=`$ID -g`
+    auid=1
+    if test "$auid" = "$myuid"; then auid=2; fi
+    agid=1
+    if test "$agid" = "$mygid"; then agid=2; fi
+
+    case $acl_flavor in
+      linux | freebsd | solaris)
+
+        # Set an ACL for a user.
+        setfacl -m user:$auid:1 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for a group.
+        setfacl -m group:$agid:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile3
+
+        # Set an ACL for other.
+        case $acl_flavor in
+          freebsd) setfacl -m other::4 tmpfile0 ;;
+          solaris) chmod o+r tmpfile0 ;;
+          *)       setfacl -m other:4 tmpfile0 ;;
+        esac
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the user.
+        case $acl_flavor in
+          linux)   setfacl -x user:$auid tmpfile0 ;;
+          freebsd) setfacl -x user:$auid:1 tmpfile0 ;;
+          *)       setfacl -d user:$auid:1 tmpfile0 ;;
+        esac
+
+        func_test_copy tmpfile0 tmpfile5
+
+        # Remove the ACL for other.
+        case $acl_flavor in
+          linux | solaris) ;; # impossible
+          freebsd) setfacl -x other::4 tmpfile0 ;;
+          *)       setfacl -d other:4 tmpfile0 ;;
+        esac
+
+        func_test_copy tmpfile0 tmpfile6
+
+        # Remove the ACL for the group.
+        case $acl_flavor in
+          linux)   setfacl -x group:$agid tmpfile0 ;;
+          freebsd) setfacl -x group:$agid:4 tmpfile0 ;;
+          *)       setfacl -d group:$agid:4 tmpfile0 ;;
+        esac
+
+        func_test_copy tmpfile0 tmpfile7
+
+        # Delete all optional ACLs.
+        case $acl_flavor in
+          linux | freebsd)
+            setfacl -m user:$auid:1 tmpfile0
+            setfacl -b tmpfile0
+            ;;
+          *)
+            setfacl -s user::6,group::0,other:0 tmpfile0 ;;
+        esac
+
+        func_test_copy tmpfile0 tmpfile8
+
+        # Copy ACLs from a file that has no ACLs.
+        echo > tmpfile9
+        chmod a+x tmpfile9
+        case $acl_flavor in
+          linux)   getfacl tmpfile9 | setfacl --set-file=- tmpfile0 ;;
+          freebsd) ;;
+          *)       getfacl tmpfile9 | setfacl -f - tmpfile0 ;;
+        esac
+        rm -f tmpfile9
+
+        func_test_copy tmpfile0 tmpfile9
+
+        ;;
+
+      cygwin)
+
+        # Set an ACL for a group.
+        setfacl -m group:0:1 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for other.
+        setfacl -m other:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the group.
+        setfacl -d group:0 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile5
+
+        # Remove the ACL for other.
+        setfacl -d other:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile6
+
+        # Delete all optional ACLs.
+        setfacl -s user::6,group::0,other:0 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile8
+
+        # Copy ACLs from a file that has no ACLs.
+        echo > tmpfile9
+        chmod a+x tmpfile9
+        getfacl tmpfile9 | setfacl -f - tmpfile0
+        rm -f tmpfile9
+
+        func_test_copy tmpfile0 tmpfile9
+
+        ;;
+
+      hpux)
+
+        # Set an ACL for a user.
+        orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+        chacl -r "${orig}($auid.%,--x)" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for a group.
+        orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+        chacl -r "${orig}(%.$agid,r--)" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile3
+
+        # Set an ACL for other.
+        orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+        chacl -r "${orig}(%.%,r--)" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the user.
+        chacl -d "($auid.%,--x)" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile5
+
+        # Remove the ACL for the group.
+        chacl -d "(%.$agid,r--)" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile6
+
+        # Delete all optional ACLs.
+        chacl -z tmpfile0
+
+        func_test_copy tmpfile0 tmpfile8
+
+        # Copy ACLs from a file that has no ACLs.
+        echo > tmpfile9
+        chmod a+x tmpfile9
+        orig=`lsacl tmpfile9 | sed -e 's/ tmpfile9$//'`
+        rm -f tmpfile9
+        chacl -r "${orig}" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile9
+
+        ;;
+
+      hpuxjfs)
+
+        # Set an ACL for a user.
+        orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+        chacl -r "${orig}($auid.%,--x)" tmpfile0 \
+          || setacl -m user:$auid:1 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for a group.
+        orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+        chacl -r "${orig}(%.$agid,r--)" tmpfile0 \
+          || setacl -m group:$agid:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile3
+
+        # Set an ACL for other.
+        orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+        chacl -r "${orig}(%.%,r--)" tmpfile0 \
+          || setacl -m other:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the user.
+        chacl -d "($auid.%,--x)" tmpfile0 \
+          || setacl -d user:$auid tmpfile0
+
+        func_test_copy tmpfile0 tmpfile5
+
+        # Remove the ACL for the group.
+        chacl -d "(%.$agid,r--)" tmpfile0 \
+          || setacl -d group:$agid tmpfile0
+
+        func_test_copy tmpfile0 tmpfile6
+
+        # Delete all optional ACLs.
+        chacl -z tmpfile0 \
+          || { setacl -m user:$auid:1 tmpfile0
+               setacl -s user::6,group::0,class:7,other:0 tmpfile0
+             }
+
+        func_test_copy tmpfile0 tmpfile8
+
+        # Copy ACLs from a file that has no ACLs.
+        echo > tmpfile9
+        chmod a+x tmpfile9
+        orig=`lsacl tmpfile9 | sed -e 's/ tmpfile9$//'`
+        getacl tmpfile9 > tmpaclout0
+        rm -f tmpfile9
+        chacl -r "${orig}" tmpfile0 \
+          || setacl -f tmpaclout0 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile9
+
+        ;;
+
+      osf1)
+
+        # Set an ACL for a user.
+        setacl -u user:$auid:1 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for a group.
+        setacl -u group:$agid:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile3
+
+        # Set an ACL for other.
+        setacl -u other::4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the user.
+        setacl -x user:$auid:1 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile5
+
+        if false; then # would give an error "can't set ACL: Invalid argument"
+          # Remove the ACL for other.
+          setacl -x other::4 tmpfile0
+
+          func_test_copy tmpfile0 tmpfile6
+        fi
+
+        # Remove the ACL for the group.
+        setacl -x group:$agid:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile7
+
+        # Delete all optional ACLs.
+        setacl -u user:$auid:1 tmpfile0
+        setacl -b tmpfile0
+
+        func_test_copy tmpfile0 tmpfile8
+
+        # Copy ACLs from a file that has no ACLs.
+        echo > tmpfile9
+        chmod a+x tmpfile9
+        getacl tmpfile9 > tmpaclout0
+        setacl -b -U tmpaclout0 tmpfile0
+        rm -f tmpfile9
+
+        func_test_copy tmpfile0 tmpfile9
+
+        ;;
+
+      nsk)
+
+        # Set an ACL for a user.
+        setacl -m user:$auid:1 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for a group.
+        setacl -m group:$agid:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile3
+
+        # Set an ACL for other.
+        setacl -m other:4 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the user.
+        setacl -d user:$auid tmpfile0
+
+        func_test_copy tmpfile0 tmpfile5
+
+        # Remove the ACL for the group.
+        setacl -d group:$agid tmpfile0
+
+        func_test_copy tmpfile0 tmpfile6
+
+        # Delete all optional ACLs.
+        setacl -m user:$auid:1 tmpfile0
+        setacl -s user::6,group::0,class:7,other:0 tmpfile0
+
+        func_test_copy tmpfile0 tmpfile8
+
+        # Copy ACLs from a file that has no ACLs.
+        echo > tmpfile9
+        chmod a+x tmpfile9
+        getacl tmpfile9 > tmpaclout0
+        setacl -f tmpaclout0 tmpfile0
+        rm -f tmpfile9
+
+        func_test_copy tmpfile0 tmpfile9
+
+        ;;
+
+      aix)
+
+        # Set an ACL for a user.
+        { aclget tmpfile0 | sed -e 's/disabled$/enabled/'; echo "        permit --x u:$auid"; } | aclput tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for a group.
+        { aclget tmpfile0 | sed -e 's/disabled$/enabled/'; echo "        permit r-- g:$agid"; } | aclput tmpfile0
+
+        func_test_copy tmpfile0 tmpfile3
+
+        # Set an ACL for other.
+        chmod o+r tmpfile0
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the user.
+        aclget tmpfile0 | grep -v ' u:[^ ]*$' | aclput tmpfile0
+
+        func_test_copy tmpfile0 tmpfile5
+
+        # Remove the ACL for the group.
+        aclget tmpfile0 | grep -v ' g:[^ ]*$' | aclput tmpfile0
+
+        func_test_copy tmpfile0 tmpfile7
+
+        # Delete all optional ACLs.
+        aclget tmpfile0 | sed -e 's/enabled$/disabled/' | sed -e '/disabled$/q' | aclput tmpfile0
+
+        func_test_copy tmpfile0 tmpfile8
+
+        # Copy ACLs from a file that has no ACLs.
+        echo > tmpfile9
+        chmod a+x tmpfile9
+        aclget tmpfile9 | aclput tmpfile0
+        rm -f tmpfile9
+
+        func_test_copy tmpfile0 tmpfile9
+
+        ;;
+
+      macosx)
+
+        # Set an ACL for a user.
+        /bin/chmod +a "user:daemon allow execute" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for a group.
+        /bin/chmod +a "group:daemon allow read" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile3
+
+        # Set an ACL for other.
+        chmod o+r tmpfile0
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the user.
+        /bin/chmod -a "user:daemon allow execute" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile5
+
+        # Remove the ACL for the group.
+        /bin/chmod -a "group:daemon allow read" tmpfile0
+
+        func_test_copy tmpfile0 tmpfile7
+
+        # Delete all optional ACLs.
+        /bin/chmod -N tmpfile0
+
+        func_test_copy tmpfile0 tmpfile8
+
+        # Copy ACLs from a file that has no ACLs.
+        echo > tmpfile9
+        chmod a+x tmpfile9
+        { /bin/ls -le tmpfile9 | sed -n -e 's/^ [0-9][0-9]*: //p'; echo; } | /bin/chmod -E tmpfile0
+        rm -f tmpfile9
+
+        func_test_copy tmpfile0 tmpfile9
+
+        ;;
+
+      irix)
+
+        # Set an ACL for a user.
+        /sbin/chacl user::rw-,group::---,other::---,user:$auid:--x tmpfile0
+
+        func_test_copy tmpfile0 tmpfile2
+
+        # Set an ACL for a group.
+        /sbin/chacl user::rw-,group::---,other::---,user:$auid:--x,group:$agid:r-- tmpfile0
+
+        func_test_copy tmpfile0 tmpfile3
+
+        # Set an ACL for other.
+        /sbin/chacl user::rw-,group::---,user:$auid:--x,group:$agid:r--,other::r-- tmpfile0
+
+        func_test_copy tmpfile0 tmpfile4
+
+        # Remove the ACL for the user.
+        /sbin/chacl user::rw-,group::---,group:$agid:r--,other::r-- tmpfile0
+
+        func_test_copy tmpfile0 tmpfile5
+
+        # Remove the ACL for the group.
+        /sbin/chacl user::rw-,group::---,other::r-- tmpfile0
+
+        func_test_copy tmpfile0 tmpfile7
+
+        ;;
+
+    esac
+  fi
+
+  rm -f tmpfile[0-9] tmpaclout[0-2]
+) || exit 1
+
+rm -rf "$tmp"
+exit 0
deleted file mode 120000 (symlink)
index 67c02219657add6c6dd70489f0dd63d5b9f07dae..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-count-leading-zeros.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f748c014496e6a182a0b5e489c2adcabab4fe839
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#include <config.h>
+
+#include "count-leading-zeros.h"
+
+#include <limits.h>
+#include <stdio.h>
+
+#include "macros.h"
+
+#define UINT_BIT (sizeof (unsigned int) * CHAR_BIT)
+#define ULONG_BIT (sizeof (unsigned long int) * CHAR_BIT)
+#define ULLONG_BIT (sizeof (unsigned long long int) * CHAR_BIT)
+
+int
+main (int argc, char *argv[])
+{
+  int i, j;
+
+#define TEST_COUNT_LEADING_ZEROS(FUNC, TYPE, BITS, MAX, ONE)     \
+  ASSERT (FUNC (0) == BITS);                                     \
+  for (i = 0; i < BITS; i++)                                     \
+    {                                                            \
+      ASSERT (FUNC (ONE << i) == BITS - i - 1);                  \
+      for (j = 0; j < i; j++)                                    \
+        ASSERT (FUNC ((ONE << i) | (ONE << j)) == BITS - i - 1); \
+    }                                                            \
+  for (i = 0; i < 1000; i++)                                     \
+    {                                                            \
+      /* RAND_MAX is most often 0x7fff or 0x7fffffff.  */        \
+      TYPE value =                                               \
+        (RAND_MAX <= 0xffff                                      \
+         ? ((TYPE) rand () >> 3)                                 \
+           ^ (((TYPE) rand () >> 3) << 12)                       \
+           ^ (((TYPE) rand () >> 3) << 24)                       \
+           ^ (((TYPE) rand () >> 3) << 30 << 6)                  \
+           ^ (((TYPE) rand () >> 3) << 30 << 18)                 \
+           ^ (((TYPE) rand () >> 3) << 30 << 30)                 \
+         : ((TYPE) rand () >> 3)                                 \
+           ^ (((TYPE) rand () >> 3) << 22)                       \
+           ^ (((TYPE) rand () >> 3) << 22 << 22));               \
+      int count = 0;                                             \
+      for (j = 0; j < BITS; j++)                                 \
+        if (value & (ONE << j))                                  \
+          count = BITS - j - 1;                                  \
+      ASSERT (count == FUNC (value));                            \
+    }                                                            \
+  ASSERT (FUNC (MAX) == 0);
+
+  TEST_COUNT_LEADING_ZEROS (count_leading_zeros, unsigned int,
+                            UINT_BIT, UINT_MAX, 1U);
+  TEST_COUNT_LEADING_ZEROS (count_leading_zeros_l, unsigned long int,
+                            ULONG_BIT, ULONG_MAX, 1UL);
+  TEST_COUNT_LEADING_ZEROS (count_leading_zeros_ll, unsigned long long int,
+                            ULLONG_BIT, ULLONG_MAX, 1ULL);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 0a642d515cfeffc4dc165264c0655b42615d56d5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-creat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5f520c14d23942f7a675093c6d3162bd5b9f8cd0
--- /dev/null
@@ -0,0 +1,62 @@
+/* Test of creating a file.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <fcntl.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (creat, int, (const char *, mode_t));
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-creat.t"
+
+int
+main (void)
+{
+  int fd;
+
+  /* Remove anything from prior partial run.  */
+  unlink (BASE "file");
+  unlink (BASE "e.exe");
+
+  /* Cannot create directory.  */
+  errno = 0;
+  ASSERT (creat ("nonexist.ent/", 0600) == -1);
+  ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT
+          || errno == EINVAL);
+
+  /* Create a regular file.  */
+  fd = creat (BASE "file", 0600);
+  ASSERT (0 <= fd);
+  ASSERT (close (fd) == 0);
+
+  /* Create an executable regular file.  */
+  fd = creat (BASE "e.exe", 0700);
+  ASSERT (0 <= fd);
+  ASSERT (close (fd) == 0);
+
+  /* Cleanup.  */
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (unlink (BASE "e.exe") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 575c17836823895fb9217c75d93e87b6ed003e63..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ctype.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d7a9e415acf9df977cc52e005caba845cb88b572
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test of <ctype.h> substitute.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <ctype.h>
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index d7d64f16ac8ea04107c0a68b2dc05b6257094956..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-di-set.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2c826951a3bb56467c51e377dc054e6419e30e55
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test the di-set module.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "di-set.h"
+
+#include "macros.h"
+
+int
+main (void)
+{
+  struct di_set *dis = di_set_alloc ();
+  ASSERT (dis);
+  di_set_free (dis); /* free with dis->ino_map still being NULL */
+  dis = di_set_alloc ();
+  ASSERT (dis);
+
+  ASSERT (di_set_lookup (dis, 2, 5) == 0); /* initial lookup fails */
+  ASSERT (di_set_insert (dis, 2, 5) == 1); /* first insertion succeeds */
+  ASSERT (di_set_insert (dis, 2, 5) == 0); /* duplicate fails */
+  ASSERT (di_set_insert (dis, 3, 5) == 1); /* diff dev, duplicate inode is ok */
+  ASSERT (di_set_insert (dis, 2, 8) == 1); /* same dev, different inode is ok */
+  ASSERT (di_set_lookup (dis, 2, 5) == 1); /* now, the lookup succeeds */
+
+  /* very large (or negative) inode number */
+  ASSERT (di_set_insert (dis, 5, (ino_t) -1) == 1);
+  ASSERT (di_set_insert (dis, 5, (ino_t) -1) == 0); /* dup */
+
+  {
+    unsigned int i;
+    for (i = 0; i < 3000; i++)
+      ASSERT (di_set_insert (dis, 9, i) == 1);
+    for (i = 0; i < 3000; i++)
+      ASSERT (di_set_insert (dis, 9, i) == 0); /* duplicate fails */
+  }
+
+  di_set_free (dis);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 135b812e748aa245148eb84123a20b1295ae7a86..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-digest.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d9c1899719e02f51b435934fde101a07399967c4
--- /dev/null
@@ -0,0 +1,144 @@
+/* Test of message digests.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+static void
+test_digest_on_files (int (*streamfunc) (FILE *, void *),
+                      const char *streamfunc_name,
+                      size_t digest_size,
+                      const void *expected_for_empty_file,
+                      const void *expected_for_small_file,
+                      const void *expected_for_large_file)
+{
+  int pass;
+  unlink (TESTFILE);
+
+  for (pass = 0; pass < 5; pass++)
+    {
+      {
+        FILE *fp = fopen (TESTFILE, "wb");
+        if (fp == NULL)
+          {
+            fprintf (stderr, "Could not create file %s.\n", TESTFILE);
+            exit (1);
+          }
+        switch (pass)
+          {
+          case 0:
+            /* Nothing to do for the empty file.  */
+            break;
+          case 2:
+            /* Fill the small file, with some header that will be skipped.  */
+            fputs ("ABCD", fp);
+            FALLTHROUGH;
+          case 1:
+            /* Fill the small file.  */
+            fputs ("The quick brown fox jumps over the lazy dog.\n", fp);
+            break;
+          case 4:
+            /* Fill the large file, with some header that will be skipped.  */
+            fputs ("ABCD", fp);
+            FALLTHROUGH;
+          case 3:
+            /* Fill the large file (8 MiB).  */
+            {
+              unsigned int i;
+              for (i = 0; i < 0x400000; i++)
+                {
+                  unsigned char c[2];
+                  unsigned int j = i * (i-1) * (i-5);
+                  c[0] = (unsigned char)(j >> 6);
+                  c[1] = (i % 499) + (i % 101);
+                  fwrite (c, 1, 2, fp);
+                }
+            }
+            break;
+          }
+        if (ferror (fp))
+          {
+            fprintf (stderr, "Could not write data to file %s.\n", TESTFILE);
+            exit (1);
+          }
+        fclose (fp);
+      }
+      {
+        /* Test an unaligned digest.  */
+        char *digest = (char *) malloc (digest_size + 1) + 1;
+        const void *expected;
+        FILE *fp;
+        int ret;
+
+        switch (pass)
+          {
+          case 0:         expected = expected_for_empty_file; break;
+          case 1: case 2: expected = expected_for_small_file; break;
+          case 3: case 4: expected = expected_for_large_file; break;
+          default: abort ();
+          }
+
+        fp = fopen (TESTFILE, "rb");
+        if (fp == NULL)
+          {
+            fprintf (stderr, "Could not open file %s.\n", TESTFILE);
+            exit (1);
+          }
+        switch (pass)
+          {
+          case 2:
+          case 4:
+            {
+              char header[4];
+              if (fread (header, 1, sizeof (header), fp) != sizeof (header))
+                {
+                  fprintf (stderr, "Could not read the header of %s.\n",
+                           TESTFILE);
+                  exit (1);
+                }
+            }
+            break;
+          }
+        ret = streamfunc (fp, digest);
+        if (ret)
+          {
+            fprintf (stderr, "%s failed with error %d\n", streamfunc_name, -ret);
+            exit (1);
+          }
+        if (memcmp (digest, expected, digest_size) != 0)
+          {
+            size_t i;
+            fprintf (stderr, "%s produced wrong result.\n", streamfunc_name);
+            fprintf (stderr, "Expected: ");
+            for (i = 0; i < digest_size; i++)
+              fprintf (stderr, "\\x%02x", ((const unsigned char *) expected)[i]);
+            fprintf (stderr, "\n");
+            fprintf (stderr, "Got:      ");
+            for (i = 0; i < digest_size; i++)
+              fprintf (stderr, "\\x%02x", ((const unsigned char *) digest)[i]);
+            fprintf (stderr, "\n");
+            exit (1);
+          }
+        /* Verify that fp is now positioned at end of file.  */
+        if (getc (fp) != EOF)
+          {
+            fprintf (stderr, "%s left the stream not at EOF\n", streamfunc_name);
+            exit (1);
+          }
+        fclose (fp);
+        free (digest - 1);
+      }
+    }
+
+  unlink (TESTFILE);
+}
deleted file mode 120000 (symlink)
index 1ec971fb904320eb107870f7bb4fe9ef3e8ddb03..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-dirent-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c927e6f09448369f8b4bd413a7a1fb78392b7732
--- /dev/null
@@ -0,0 +1,94 @@
+/* Test that directory streams leave standard fds alone.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "dirent--.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+/* This test intentionally closes stderr.  So, we arrange to have fd 10
+   (outside the range of interesting fd's during the test) set up to
+   duplicate the original stderr.  */
+
+#define BACKUP_STDERR_FILENO 10
+#define ASSERT_STREAM myerr
+#include "macros.h"
+
+static FILE *myerr;
+
+int
+main (void)
+{
+  int i;
+  DIR *dp;
+  /* The dirent-safer module works without the use of fdopendir (which
+     would also pull in fchdir and openat); but if those modules were
+     also used, we ensure that they are safe.  In particular, the
+     gnulib version of fdopendir is unable to guarantee that
+     dirfd(fdopendir(fd))==fd, but we can at least guarantee that if
+     they are not equal, the fd returned by dirfd is safe.  */
+#if HAVE_FDOPENDIR || GNULIB_TEST_FDOPENDIR
+  int dfd;
+#endif
+
+  /* We close fd 2 later, so save it in fd 10.  */
+  if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
+      || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
+    return 2;
+
+#if HAVE_FDOPENDIR || GNULIB_TEST_FDOPENDIR
+  dfd = open (".", O_RDONLY);
+  ASSERT (STDERR_FILENO < dfd);
+#endif
+
+  /* Four iterations, with progressively more standard descriptors
+     closed.  */
+  for (i = -1; i <= STDERR_FILENO; i++)
+    {
+      if (0 <= i)
+        ASSERT (close (i) == 0);
+      dp = opendir (".");
+      ASSERT (dp);
+      ASSERT (dirfd (dp) == -1 || STDERR_FILENO < dirfd (dp));
+      ASSERT (closedir (dp) == 0);
+
+#if HAVE_FDOPENDIR || GNULIB_TEST_FDOPENDIR
+      {
+        int fd = fcntl (dfd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
+        ASSERT (STDERR_FILENO < fd);
+        dp = fdopendir (fd);
+        ASSERT (dp);
+        ASSERT (dirfd (dp) == -1 || STDERR_FILENO < dirfd (dp));
+        ASSERT (closedir (dp) == 0);
+        errno = 0;
+        ASSERT (close (fd) == -1);
+        ASSERT (errno == EBADF);
+      }
+#endif
+    }
+
+#if HAVE_FDOPENDIR || GNULIB_TEST_FDOPENDIR
+  ASSERT (close (dfd) == 0);
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8f6de3e38d7362b454094859cf94e42a4046085a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-dirent.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e3b46a38d13341a63c276ff38d34ac340ba5dd84
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test of <dirent.h> substitute.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <dirent.h>
+
+/* Check for existence of required types.  */
+_GL_UNUSED static DIR *dir;
+static struct dirent d;
+static ino_t i;
+
+int
+main (void)
+{
+  return d.d_name[0] + i;
+}
deleted file mode 120000 (symlink)
index 5d728feada188a9e08f46945cafe9b1092de183f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-dirfd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0cfac8427f1883ff6c20ead06a16f696cffa7130
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of dirfd() function.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <dirent.h>
+
+#include <stdio.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+#if defined _WIN32 && !defined __CYGWIN__
+  fprintf (stderr, "Skipping test: The DIR type does not contain a file descriptor.\n");
+  return 77;
+#else
+  /* On all other platforms, we expect to have either
+       - a dirfd() function, or
+       - a dirfd macro, or
+       - a DIR struct with a d_fd member, or
+       - a DIR struct with a dd_fd member.
+     If we don't have this, dirfd.c produces a function that always returns -1.
+     Check here that this does not happen.  */
+  DIR *d = opendir (".");
+  int fd = dirfd (d);
+  ASSERT (fd >= 0);
+
+  return 0;
+#endif
+}
deleted file mode 120000 (symlink)
index 98b6e917582cc55243b00487dbbefab286969f37..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-dirname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bf69bbdedfbd6c13e769f017e8f3ec594a9e8538
--- /dev/null
@@ -0,0 +1,192 @@
+/* Test the gnulib dirname module.
+   Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "dirname.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct test {
+  const char *name;     /* Name under test.  */
+  const char *dir;      /* dir_name (name).  */
+  const char *last;     /* last_component (name).  */
+  const char *base;     /* base_name (name).  */
+  const char *stripped; /* name after strip_trailing_slashes (name).  */
+  bool modified;        /* result of strip_trailing_slashes (name).  */
+  bool absolute;        /* IS_ABSOLUTE_FILE_NAME (name).  */
+};
+
+static struct test tests[] = {
+  {"d/f",       "d",    "f",    "f",    "d/f",  false,  false},
+  {"/d/f",      "/d",   "f",    "f",    "/d/f", false,  true},
+  {"d/f/",      "d",    "f/",   "f/",   "d/f",  true,   false},
+  {"d/f//",     "d",    "f//",  "f/",   "d/f",  true,   false},
+  {"f",         ".",    "f",    "f",    "f",    false,  false},
+  {"/",         "/",    "",     "/",    "/",    false,  true},
+#if DOUBLE_SLASH_IS_DISTINCT_ROOT
+  {"//",        "//",   "",     "//",   "//",   false,  true},
+  {"//d",       "//",   "d",    "d",    "//d",  false,  true},
+#else
+  {"//",        "/",    "",     "/",    "/",    true,   true},
+  {"//d",       "/",    "d",    "d",    "//d",  false,  true},
+#endif
+  {"///",       "/",    "",     "/",    "/",    true,   true},
+  {"///a///",   "/",    "a///", "a/",   "///a", true,   true},
+  /* POSIX requires dirname("") and basename("") to both return ".",
+     but dir_name and base_name are defined differently.  */
+  {"",          ".",    "",     "",     "",     false,  false},
+  {".",         ".",    ".",    ".",    ".",    false,  false},
+  {"..",        ".",    "..",   "..",   "..",   false,  false},
+#if ISSLASH ('\\')
+  {"a\\",       ".",    "a\\",  "a\\",  "a",    true,   false},
+  {"a\\b",      "a",    "b",    "b",    "a\\b", false,  false},
+  {"\\",        "\\",   "",     "\\",   "\\",   false,  true},
+  {"\\/\\",     "\\",   "",     "\\",   "\\",   true,   true},
+  {"\\\\/",     "\\",   "",     "\\",   "\\",   true,   true},
+  {"\\//",      "\\",   "",     "\\",   "\\",   true,   true},
+  {"//\\",      "/",    "",     "/",    "/",    true,   true},
+#else
+  {"a\\",       ".",    "a\\",  "a\\",  "a\\",  false,  false},
+  {"a\\b",      ".",    "a\\b", "a\\b", "a\\b", false,  false},
+  {"\\",        ".",    "\\",   "\\",   "\\",   false,  false},
+  {"\\/\\",     "\\",   "\\",   "\\",   "\\/\\",false,  false},
+  {"\\\\/",     ".",    "\\\\/","\\\\/","\\\\", true,   false},
+  {"\\//",      ".",    "\\//", "\\/",  "\\",   true,   false},
+# if DOUBLE_SLASH_IS_DISTINCT_ROOT
+  {"//\\",      "//",   "\\",   "\\",   "//\\", false,  true},
+# else
+  {"//\\",      "/",    "\\",   "\\",   "//\\", false,  true},
+# endif
+#endif
+#if ISSLASH ('\\')
+# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+  {"c:",        "c:",   "",     "c:",   "c:",   false,  false},
+  {"c:/",       "c:/",  "",     "c:/",  "c:/",  false,  true},
+  {"c://",      "c:/",  "",     "c:/",  "c:/",  true,   true},
+  {"c:/d",      "c:/",  "d",    "d",    "c:/d", false,  true},
+  {"c://d",     "c:/",  "d",    "d",    "c://d",false,  true},
+  {"c:/d/",     "c:/",  "d/",   "d/",   "c:/d", true,   true},
+  {"c:/d/f",    "c:/d", "f",    "f",    "c:/d/f",false, true},
+  {"c:d",       "c:.",  "d",    "d",    "c:d",  false,  false},
+  {"c:d/",      "c:.",  "d/",   "d/",   "c:d",  true,   false},
+  {"c:d/f",     "c:d",  "f",    "f",    "c:d/f",false,  false},
+  {"a:b:c",     "a:.",  "b:c",  "./b:c","a:b:c",false,  false},
+  {"a/b:c",     "a",    "b:c",  "./b:c","a/b:c",false,  false},
+  {"a/b:c/",    "a",    "b:c/", "./b:c/","a/b:c",true,  false},
+# else /* ! FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE */
+  {"c:",        "c:",   "",     "c:",   "c:",   false,  true},
+  {"c:/",       "c:",   "",     "c:",   "c:",   true,   true},
+  {"c://",      "c:",   "",     "c:",   "c:",   true,   true},
+  {"c:/d",      "c:",   "d",    "d",    "c:/d", false,  true},
+  {"c://d",     "c:",   "d",    "d",    "c://d",false,  true},
+  {"c:/d/",     "c:",   "d/",   "d/",   "c:/d", true,   true},
+  {"c:/d/f",    "c:/d", "f",    "f",    "c:/d/f",false, true},
+  {"c:d",       "c:",   "d",    "d",    "c:d",  false,  true},
+  {"c:d/",      "c:",   "d/",   "d/",   "c:d",  true,   true},
+  {"c:d/f",     "c:d",  "f",    "f",    "c:d/f",false,  true},
+  {"a:b:c",     "a:",   "b:c",  "./b:c","a:b:c",false,  true},
+  {"a/b:c",     "a",    "b:c",  "./b:c","a/b:c",false,  false},
+  {"a/b:c/",    "a",    "b:c/", "./b:c/","a/b:c",true,  false},
+# endif
+#else /* ! ISSLASH ('\\') */
+  {"c:",        ".",    "c:",   "c:",   "c:",   false,  false},
+  {"c:/",       ".",    "c:/",  "c:/",  "c:",   true,   false},
+  {"c://",      ".",    "c://", "c:/",  "c:",   true,   false},
+  {"c:/d",      "c:",   "d",    "d",    "c:/d", false,  false},
+  {"c://d",     "c:",   "d",    "d",    "c://d",false,  false},
+  {"c:/d/",     "c:",   "d/",   "d/",   "c:/d", true,   false},
+  {"c:/d/f",    "c:/d", "f",    "f",    "c:/d/f",false, false},
+  {"c:d",       ".",    "c:d",  "c:d",  "c:d",  false,  false},
+  {"c:d/",      ".",    "c:d/", "c:d/", "c:d",  true,   false},
+  {"c:d/f",     "c:d",  "f",    "f",    "c:d/f",false,  false},
+  {"a:b:c",     ".",    "a:b:c","a:b:c","a:b:c",false,  false},
+  {"a/b:c",     "a",    "b:c",  "b:c",  "a/b:c",false,  false},
+  {"a/b:c/",    "a",    "b:c/", "b:c/", "a/b:c",true,   false},
+#endif
+  {"1:",        ".",    "1:",   "1:",   "1:",   false,  false},
+  {"1:/",       ".",    "1:/",  "1:/",  "1:",   true,   false},
+  {"/:",        "/",    ":",    ":",    "/:",   false,  true},
+  {"/:/",       "/",    ":/",   ":/",   "/:",   true,   true},
+  /* End sentinel.  */
+  {NULL,        NULL,   NULL,   NULL,   NULL,   false,  false}
+};
+
+int
+main (void)
+{
+  struct test *t;
+  bool ok = true;
+
+  for (t = tests; t->name; t++)
+    {
+      char *dir = dir_name (t->name);
+      int dirlen = dir_len (t->name);
+      char *last = last_component (t->name);
+      char *base = base_name (t->name);
+      int baselen = base_len (base);
+      char *stripped = strdup (t->name);
+      bool modified = strip_trailing_slashes (stripped);
+      bool absolute = IS_ABSOLUTE_FILE_NAME (t->name);
+      if (! (strcmp (dir, t->dir) == 0
+             && (dirlen == strlen (dir)
+                 || (dirlen + 1 == strlen (dir) && dir[dirlen] == '.'))))
+        {
+          ok = false;
+          printf ("dir_name '%s': got '%s' len %d,"
+                  " expected '%s' len %lu\n",
+                  t->name, dir, dirlen,
+                  t->dir, (unsigned long) strlen (t->dir));
+        }
+      if (strcmp (last, t->last))
+        {
+          ok = false;
+          printf ("last_component '%s': got '%s', expected '%s'\n",
+                  t->name, last, t->last);
+        }
+      if (! (strcmp (base, t->base) == 0
+             && (baselen == strlen (base)
+                 || (baselen + 1 == strlen (base)
+                     && ISSLASH (base[baselen])))))
+        {
+          ok = false;
+          printf ("base_name '%s': got '%s' len %d,"
+                  " expected '%s' len %lu\n",
+                  t->name, base, baselen,
+                  t->base, (unsigned long) strlen (t->base));
+        }
+      if (strcmp (stripped, t->stripped) || modified != t->modified)
+        {
+          ok = false;
+          printf ("strip_trailing_slashes '%s': got %s %s, expected %s %s\n",
+                  t->name, stripped, modified ? "changed" : "unchanged",
+                  t->stripped, t->modified ? "changed" : "unchanged");
+        }
+      if (t->absolute != absolute)
+        {
+          ok = false;
+          printf ("'%s': got %s, expected %s\n", t->name,
+                  absolute ? "absolute" : "relative",
+                  t->absolute ? "absolute" : "relative");
+        }
+      free (dir);
+      free (base);
+      free (stripped);
+    }
+  return ok ? 0 : 1;
+}
deleted file mode 120000 (symlink)
index c41499d0b33a335d13fce32967233c2164810845..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-dup-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6ef6a2d30a14f6a0ef497088f3e799f6f8ddc79b
--- /dev/null
@@ -0,0 +1,183 @@
+/* Test that dup_safer leaves standard fds alone.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "unistd--.h"
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "binary-io.h"
+#include "cloexec.h"
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+#endif
+
+#if !O_BINARY
+# define set_binary_mode my_set_binary_mode
+static int
+set_binary_mode (_GL_UNUSED int fd, _GL_UNUSED int mode)
+{
+  return 0;
+}
+#endif
+
+/* This test intentionally closes stderr.  So, we arrange to have fd 10
+   (outside the range of interesting fd's during the test) set up to
+   duplicate the original stderr.  */
+
+#define BACKUP_STDERR_FILENO 10
+#define ASSERT_STREAM myerr
+#include "macros.h"
+
+static FILE *myerr;
+
+/* Return true if FD is open.  */
+static bool
+is_open (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+#else
+# ifndef F_GETFL
+#  error Please port fcntl to your platform
+# endif
+  return 0 <= fcntl (fd, F_GETFL);
+#endif
+}
+
+/* Return true if FD is open and inheritable across exec/spawn.  */
+static bool
+is_inheritable (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  DWORD flags;
+  if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0)
+    return 0;
+  return (flags & HANDLE_FLAG_INHERIT) != 0;
+#else
+# ifndef F_GETFD
+#  error Please port fcntl to your platform
+# endif
+  int i = fcntl (fd, F_GETFD);
+  return 0 <= i && (i & FD_CLOEXEC) == 0;
+#endif
+}
+
+/* Return true if FD is open in the given MODE, which is either
+   O_TEXT or O_BINARY.  */
+static bool
+is_mode (int fd, int mode)
+{
+  int value = set_binary_mode (fd, O_BINARY);
+  set_binary_mode (fd, value);
+  return mode == value;
+}
+
+#define witness "test-dup-safer.txt"
+
+int
+main (void)
+{
+  int i;
+  int fd;
+  int bad_fd = getdtablesize ();
+
+  /* We close fd 2 later, so save it in fd 10.  */
+  if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
+      || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
+    return 2;
+
+  /* Create file for later checks.  */
+  fd = creat (witness, 0600);
+  ASSERT (STDERR_FILENO < fd);
+
+  /* Four iterations, with progressively more standard descriptors
+     closed.  */
+  for (i = -1; i <= STDERR_FILENO; i++)
+    {
+      if (0 <= i)
+        ASSERT (close (i) == 0);
+
+      /* Detect errors.  */
+      errno = 0;
+      ASSERT (dup (-1) == -1);
+      ASSERT (errno == EBADF);
+      errno = 0;
+      ASSERT (dup (bad_fd) == -1);
+      ASSERT (errno == EBADF);
+      close (fd + 1);
+      errno = 0;
+      ASSERT (dup (fd + 1) == -1);
+      ASSERT (errno == EBADF);
+
+      /* Preserve text vs. binary.  */
+      set_binary_mode (fd, O_BINARY);
+      ASSERT (dup (fd) == fd + 1);
+      ASSERT (is_open (fd + 1));
+      ASSERT (is_inheritable (fd + 1));
+      ASSERT (is_mode (fd + 1, O_BINARY));
+
+      ASSERT (close (fd + 1) == 0);
+      set_binary_mode (fd, O_TEXT);
+      ASSERT (dup (fd) == fd + 1);
+      ASSERT (is_open (fd + 1));
+      ASSERT (is_inheritable (fd + 1));
+      ASSERT (is_mode (fd + 1, O_TEXT));
+
+      /* Create cloexec copy.  */
+      ASSERT (close (fd + 1) == 0);
+      ASSERT (fd_safer_flag (dup_cloexec (fd), O_CLOEXEC) == fd + 1);
+      ASSERT (set_cloexec_flag (fd + 1, true) == 0);
+      ASSERT (is_open (fd + 1));
+      ASSERT (!is_inheritable (fd + 1));
+      ASSERT (close (fd) == 0);
+
+      /* dup always creates inheritable copies.  Also, check that
+         earliest slot past std fds is used.  */
+      ASSERT (dup (fd + 1) == fd);
+      ASSERT (is_open (fd));
+      ASSERT (is_inheritable (fd));
+      ASSERT (close (fd + 1) == 0);
+    }
+
+  /* Cleanup.  */
+  ASSERT (close (fd) == 0);
+  ASSERT (unlink (witness) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index ebf130d69b04af09adef1542888ee53fc0c82adf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-dup.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cb312020baf6725e39eb646ba2d38030bfd993a1
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test duplicating a file descriptor.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (dup, int, (int));
+
+#include <errno.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (dup (-1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (dup (99) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 970f9c22bdd8196d27e8098b72a674eaf7fbffdf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-dup2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..55f3194023ac4022fffd3ff6daa417ebc2cc4b92
--- /dev/null
@@ -0,0 +1,232 @@
+/* Test duplicating file descriptors.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (dup2, int, (int, int));
+
+#include <errno.h>
+#include <fcntl.h>
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include "binary-io.h"
+
+#if GNULIB_TEST_CLOEXEC
+# include "cloexec.h"
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+#endif
+
+#include "macros.h"
+
+/* Tell GCC not to warn about the specific edge cases tested here.  */
+#if __GNUC__ >= 13
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
+#endif
+
+/* Return non-zero if FD is open.  */
+static int
+is_open (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+#else
+# ifndef F_GETFL
+#  error Please port fcntl to your platform
+# endif
+  return 0 <= fcntl (fd, F_GETFL);
+#endif
+}
+
+#if GNULIB_TEST_CLOEXEC
+/* Return non-zero if FD is open and inheritable across exec/spawn.  */
+static int
+is_inheritable (int fd)
+{
+# if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  DWORD flags;
+  if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0)
+    return 0;
+  return (flags & HANDLE_FLAG_INHERIT) != 0;
+# else
+#  ifndef F_GETFD
+#   error Please port fcntl to your platform
+#  endif
+  int i = fcntl (fd, F_GETFD);
+  return 0 <= i && (i & FD_CLOEXEC) == 0;
+# endif
+}
+#endif /* GNULIB_TEST_CLOEXEC */
+
+#if !O_BINARY
+# define set_binary_mode my_set_binary_mode
+static int
+set_binary_mode (_GL_UNUSED int fd, _GL_UNUSED int mode)
+{
+  return 0;
+}
+#endif
+
+/* Return non-zero if FD is open in the given MODE, which is either
+   O_TEXT or O_BINARY.  */
+static int
+is_mode (int fd, int mode)
+{
+  int value = set_binary_mode (fd, O_BINARY);
+  set_binary_mode (fd, value);
+  return mode == value;
+}
+
+int
+main (void)
+{
+  const char *file = "test-dup2.tmp";
+  char buffer[1];
+  int bad_fd = getdtablesize ();
+  int fd = open (file, O_CREAT | O_TRUNC | O_RDWR, 0600);
+
+  /* Assume std descriptors were provided by invoker.  */
+  ASSERT (STDERR_FILENO < fd);
+  ASSERT (is_open (fd));
+  /* Ignore any other fd's leaked into this process.  */
+  close (fd + 1);
+  close (fd + 2);
+  ASSERT (!is_open (fd + 1));
+  ASSERT (!is_open (fd + 2));
+
+  /* Assigning to self must be a no-op.  */
+  ASSERT (dup2 (fd, fd) == fd);
+  ASSERT (is_open (fd));
+
+  /* The source must be valid.  */
+  errno = 0;
+  ASSERT (dup2 (-1, fd) == -1);
+  ASSERT (errno == EBADF);
+  close (99);
+  errno = 0;
+  ASSERT (dup2 (99, fd) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (dup2 (AT_FDCWD, fd) == -1);
+  ASSERT (errno == EBADF);
+  ASSERT (is_open (fd));
+
+  /* If the source is not open, then the destination is unaffected.  */
+  errno = 0;
+  ASSERT (dup2 (fd + 1, fd + 1) == -1);
+  ASSERT (errno == EBADF);
+  ASSERT (!is_open (fd + 1));
+  errno = 0;
+  ASSERT (dup2 (fd + 1, fd) == -1);
+  ASSERT (errno == EBADF);
+  ASSERT (is_open (fd));
+
+  /* The destination must be valid.  */
+  errno = 0;
+  ASSERT (dup2 (fd, -2) == -1);
+  ASSERT (errno == EBADF);
+  if (bad_fd > 256)
+    {
+      ASSERT (dup2 (fd, 255) == 255);
+      ASSERT (dup2 (fd, 256) == 256);
+      ASSERT (close (255) == 0);
+      ASSERT (close (256) == 0);
+    }
+  ASSERT (dup2 (fd, bad_fd - 1) == bad_fd - 1);
+  ASSERT (close (bad_fd - 1) == 0);
+  errno = 0;
+  ASSERT (dup2 (fd, bad_fd) == -1);
+  ASSERT (errno == EBADF);
+
+  /* Using dup2 can skip fds.  */
+  ASSERT (dup2 (fd, fd + 2) == fd + 2);
+  ASSERT (is_open (fd));
+  ASSERT (!is_open (fd + 1));
+  ASSERT (is_open (fd + 2));
+
+  /* Verify that dup2 closes the previous occupant of a fd.  */
+  ASSERT (open ("/dev/null", O_WRONLY, 0600) == fd + 1);
+  ASSERT (dup2 (fd + 1, fd) == fd);
+  ASSERT (close (fd + 1) == 0);
+  ASSERT (write (fd, "1", 1) == 1);
+  ASSERT (dup2 (fd + 2, fd) == fd);
+  ASSERT (lseek (fd, 0, SEEK_END) == 0);
+  ASSERT (write (fd + 2, "2", 1) == 1);
+  ASSERT (lseek (fd, 0, SEEK_SET) == 0);
+  ASSERT (read (fd, buffer, 1) == 1);
+  ASSERT (*buffer == '2');
+
+#if GNULIB_TEST_CLOEXEC
+  /* Any new fd created by dup2 must not be cloexec.  */
+  ASSERT (close (fd + 2) == 0);
+  ASSERT (dup_cloexec (fd) == fd + 1);
+  ASSERT (!is_inheritable (fd + 1));
+  ASSERT (dup2 (fd + 1, fd + 1) == fd + 1);
+  ASSERT (!is_inheritable (fd + 1));
+  ASSERT (dup2 (fd + 1, fd + 2) == fd + 2);
+  ASSERT (!is_inheritable (fd + 1));
+  ASSERT (is_inheritable (fd + 2));
+  errno = 0;
+  ASSERT (dup2 (fd + 1, -1) == -1);
+  ASSERT (errno == EBADF);
+  ASSERT (!is_inheritable (fd + 1));
+#endif
+
+  /* On systems that distinguish between text and binary mode, dup2
+     reuses the mode of the source.  */
+  set_binary_mode (fd, O_BINARY);
+  ASSERT (is_mode (fd, O_BINARY));
+  ASSERT (dup2 (fd, fd + 1) == fd + 1);
+  ASSERT (is_mode (fd + 1, O_BINARY));
+  set_binary_mode (fd, O_TEXT);
+  ASSERT (is_mode (fd, O_TEXT));
+  ASSERT (dup2 (fd, fd + 1) == fd + 1);
+  ASSERT (is_mode (fd + 1, O_TEXT));
+
+  /* Clean up.  */
+  ASSERT (close (fd + 2) == 0);
+  ASSERT (close (fd + 1) == 0);
+  ASSERT (close (fd) == 0);
+  ASSERT (unlink (file) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8d6436e9c05f0d9a91d8d6b6a6b40d9eb578bf66..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-dynarray.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..024bef2df7353addb210755f97e16440dd465f71
--- /dev/null
@@ -0,0 +1,53 @@
+/* Test of type-safe arrays that grow dynamically.
+   Copyright (C) 2021-2024 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; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2021.  */
+
+#include <config.h>
+
+#define DYNARRAY_STRUCT int_sequence
+#define DYNARRAY_ELEMENT int
+#define DYNARRAY_PREFIX intseq_
+#include "dynarray.h"
+
+#include "macros.h"
+
+#define N 100000
+
+static int
+value_at (long long int i)
+{
+  return (i % 13) + ((i * i) % 251);
+}
+
+int
+main ()
+{
+  struct int_sequence s;
+  int i;
+
+  intseq_init (&s);
+  for (i = 0; i < N; i++)
+    intseq_add (&s, value_at (i));
+  for (i = N - 1; i >= N / 2; i--)
+    {
+      ASSERT (* intseq_at (&s, i) == value_at (i));
+      intseq_remove_last (&s);
+    }
+  intseq_free (&s);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 735de9d7331a14a38493c15fd57afaf8eec423d6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-environ.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fdd944f6e5e1781b1f36901ed2cae919086525bb
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test of environ variable.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <string.h>
+
+int
+main ()
+{
+  /* The environment variables that are set even in the weirdest situations
+     are HOME and PATH.
+     POSIX says that HOME is initialized by the system, and that PATH may be
+     unset.  But in practice it's more frequent to see HOME unset and PATH
+     set.  So we test the presence of PATH.  */
+  char **remaining_variables = environ;
+  char *string;
+
+  for (; (string = *remaining_variables) != NULL; remaining_variables++)
+    {
+      if (strncmp (string, "PATH=", 5) == 0)
+        /* Found the PATH environment variable.  */
+        return 0;
+    }
+  /* Failed to find the PATH environment variable.  */
+  return 1;
+}
deleted file mode 120000 (symlink)
index 580ebfbddc6b437a9905531241da6d02b98a580b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-errno.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..99600add8378304801b61a5620e040c91fd1ce44
--- /dev/null
@@ -0,0 +1,119 @@
+/* Test of <errno.h> substitute.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <errno.h>
+
+/* Verify that the POSIX mandated errno values exist and can be used as
+   initializers outside of a function.
+   The variable names happen to match the Linux/x86 error numbers.  */
+int e1 = EPERM;
+int e2 = ENOENT;
+int e3 = ESRCH;
+int e4 = EINTR;
+int e5 = EIO;
+int e6 = ENXIO;
+int e7 = E2BIG;
+int e8 = ENOEXEC;
+int e9 = EBADF;
+int e10 = ECHILD;
+int e11 = EAGAIN;
+int e11a = EWOULDBLOCK;
+int e12 = ENOMEM;
+int e13 = EACCES;
+int e14 = EFAULT;
+int e16 = EBUSY;
+int e17 = EEXIST;
+int e18 = EXDEV;
+int e19 = ENODEV;
+int e20 = ENOTDIR;
+int e21 = EISDIR;
+int e22 = EINVAL;
+int e23 = ENFILE;
+int e24 = EMFILE;
+int e25 = ENOTTY;
+int e26 = ETXTBSY;
+int e27 = EFBIG;
+int e28 = ENOSPC;
+int e29 = ESPIPE;
+int e30 = EROFS;
+int e31 = EMLINK;
+int e32 = EPIPE;
+int e33 = EDOM;
+int e34 = ERANGE;
+int e35 = EDEADLK;
+int e36 = ENAMETOOLONG;
+int e37 = ENOLCK;
+int e38 = ENOSYS;
+int e39 = ENOTEMPTY;
+int e40 = ELOOP;
+int e42 = ENOMSG;
+int e43 = EIDRM;
+int e67 = ENOLINK;
+int e71 = EPROTO;
+int e72 = EMULTIHOP;
+int e74 = EBADMSG;
+int e75 = EOVERFLOW;
+int e84 = EILSEQ;
+int e88 = ENOTSOCK;
+int e89 = EDESTADDRREQ;
+int e90 = EMSGSIZE;
+int e91 = EPROTOTYPE;
+int e92 = ENOPROTOOPT;
+int e93 = EPROTONOSUPPORT;
+int e95 = EOPNOTSUPP;
+int e95a = ENOTSUP;
+int e97 = EAFNOSUPPORT;
+int e98 = EADDRINUSE;
+int e99 = EADDRNOTAVAIL;
+int e100 = ENETDOWN;
+int e101 = ENETUNREACH;
+int e102 = ENETRESET;
+int e103 = ECONNABORTED;
+int e104 = ECONNRESET;
+int e105 = ENOBUFS;
+int e106 = EISCONN;
+int e107 = ENOTCONN;
+int e110 = ETIMEDOUT;
+int e111 = ECONNREFUSED;
+int e113 = EHOSTUNREACH;
+int e114 = EALREADY;
+int e115 = EINPROGRESS;
+int e116 = ESTALE;
+int e122 = EDQUOT;
+int e125 = ECANCELED;
+int e130 = EOWNERDEAD;
+int e131 = ENOTRECOVERABLE;
+
+/* Don't verify that these errno values are all different, except for possibly
+   EWOULDBLOCK == EAGAIN.  Even Linux/x86 does not pass this check: it has
+   ENOTSUP == EOPNOTSUPP.  */
+
+int
+main ()
+{
+  /* Verify that errno can be assigned.  */
+  errno = EOVERFLOW;
+
+  /* snprintf() callers want to distinguish EINVAL and EOVERFLOW.  */
+  if (errno == EINVAL)
+    return 1;
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c953d2945cd920cf3f451119f4ca98376da25e13..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-error.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..02704d7c697e5628363b24af8145d13dfe081ddb
--- /dev/null
@@ -0,0 +1,89 @@
+/* Test of error.h functions.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <error.h>
+
+#include <errno.h>
+
+#include "macros.h"
+
+/* Custom function to not show the program name in error messages.  */
+static void
+print_no_progname (void)
+{
+}
+
+int
+main ()
+{
+  /* Test error() function with zero STATUS and zero ERRNUM.  */
+  error (0, 0, "bummer");
+  /* With format string arguments.  */
+  errno = EINVAL; /* should be ignored */
+  error (0, 0, "Zonk %d%d%d is too large", 1, 2, 3);
+  /* With non-ASCII characters.  */
+  error (0, 0, "Pokémon started");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 3);
+
+  /* Test error_at_line() function with zero STATUS and zero ERRNUM.  */
+  error_at_line (0, 0, "d1/foo.c", 10, "invalid blub");
+  error_at_line (0, 0, "d1/foo.c", 10, "invalid blarn");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 5);
+
+  /* Test error_one_per_line.  */
+  error_one_per_line = 1;
+  error_at_line (0, 0, "d1/foo.c", 10, "unsupported glink");
+  /* Another line number.  */
+  error_at_line (0, 0, "d1/foo.c", 13, "invalid brump");
+  /* Another file name.  */
+  error_at_line (0, 0, "d2/foo.c", 13, "unsupported flinge");
+  /* Same file name and same line number => message not shown.  */
+  error_at_line (0, 0, "d2/foo.c", 13, "invalid bark");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 8);
+  error_one_per_line = 0;
+
+  /* Test error_print_progname.  */
+  error_print_progname = print_no_progname;
+  error (0, 0, "hammer");
+  error (0, 0, "boing %d%d%d is too large", 1, 2, 3);
+  #if 0
+  /* The documentation does not describe the output if the file name is NULL. */
+  error_at_line (0, 0, NULL, 42, "drummer too loud");
+  #endif
+  error_at_line (0, 0, "d2/bar.c", 11, "bark too loud");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 11);
+  error_print_progname = NULL;
+
+  /* Test error() function with nonzero ERRNUM.  */
+  errno = EINVAL; /* should be ignored */
+  error (0, EACCES, "can't steal");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 12);
+
+  /* Test error() function with nonzero STATUS.  */
+  error (4, 0, "fatal error");
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c565399eb8aa4ee5d99392b4444592a55cd366d1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-error.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..d173e183f41733c5eee617879b638b0d1c82e7a5
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Test of the 'error' module.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+${CHECKER} test-error${EXEEXT} > out 2> err
+# Verify the exit code.
+case $? in
+  4) ;;
+  *) Exit 1;;
+esac
+
+# Normalize the stderr output on Windows platforms.
+tr -d '\015' < err | sed 's,.*test-error[.ex]*:,test-error:,' > err2 || Exit 1
+
+# Verify the stderr output.
+compare - err2 <<\EOF || Exit 1
+test-error: bummer
+test-error: Zonk 123 is too large
+test-error: Pokémon started
+test-error:d1/foo.c:10: invalid blub
+test-error:d1/foo.c:10: invalid blarn
+test-error:d1/foo.c:10: unsupported glink
+test-error:d1/foo.c:13: invalid brump
+test-error:d2/foo.c:13: unsupported flinge
+hammer
+boing 123 is too large
+d2/bar.c:11: bark too loud
+test-error: can't steal: Permission denied
+test-error: fatal error
+EOF
+
+# Verify the stdout output.
+test -s out && Exit 1
+
+Exit 0
deleted file mode 120000 (symlink)
index d5f3da5d58ec4a15545ff721984c79f5346f7073..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-euidaccess.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..204313204c9fac5c30ca532ce682923da6445c26
--- /dev/null
@@ -0,0 +1,40 @@
+/* Tests of euidaccess.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (euidaccess, int, (const char *, int));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include "root-uid.h"
+#include "macros.h"
+
+#define BASE "test-euidaccess.t"
+
+#include "test-access.h"
+
+int
+main ()
+{
+  test_access (euidaccess);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 02e92305f291129d8e5788050f68fdd8a5113316..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-exclude.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2af6014d685c7dd37ccf146e6269f1e85ed0ba8b
--- /dev/null
@@ -0,0 +1,127 @@
+/* Test suite for exclude.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+   This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <fnmatch.h>
+
+#include <error.h>
+#include "exclude.h"
+#include "argmatch.h"
+
+#ifndef FNM_CASEFOLD
+# define FNM_CASEFOLD 0
+#endif
+#ifndef FNM_LEADING_DIR
+# define FNM_LEADING_DIR 0
+#endif
+
+char const * const exclude_keywords[] = {
+  "noescape",
+  "pathname",
+  "period",
+  "leading_dir",
+  "casefold",
+  "anchored",
+  "include",
+  "wildcards",
+  NULL
+};
+
+int exclude_flags[] = {
+  FNM_NOESCAPE,
+  FNM_PATHNAME,
+  FNM_PERIOD,
+  FNM_LEADING_DIR,
+  FNM_CASEFOLD,
+  EXCLUDE_ANCHORED,
+  EXCLUDE_INCLUDE,
+  EXCLUDE_WILDCARDS
+};
+
+ARGMATCH_VERIFY (exclude_keywords, exclude_flags);
+
+/* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
+   thus must link with a definition of that function.  Provide it here.  */
+#ifdef ARGMATCH_DIE_DECL
+
+_Noreturn ARGMATCH_DIE_DECL;
+ARGMATCH_DIE_DECL { exit (1); }
+
+#endif
+
+int
+main (int argc, char **argv)
+{
+  int exclude_options = 0;
+  struct exclude *exclude = new_exclude ();
+
+  if (argc == 1)
+    error (1, 0, "usage: %s file -- words...", argv[0]);
+
+  while (--argc)
+    {
+      char *opt = *++argv;
+      if (opt[0] == '-')
+        {
+          int neg = 0;
+          int flag;
+          char *s = opt + 1;
+
+          if (opt[1] == '-' && opt[2] == 0)
+            {
+              argc--;
+              break;
+            }
+          if (strlen (s) > 3 && memcmp (s, "no-", 3) == 0)
+            {
+              neg = 1;
+              s += 3;
+            }
+          flag = XARGMATCH (opt, s, exclude_keywords, exclude_flags);
+          if (neg)
+            exclude_options &= ~flag;
+          else
+            exclude_options |= flag;
+
+          /* Skip this test if invoked with -leading-dir on a system that
+             lacks support for FNM_LEADING_DIR. */
+          if (strcmp (s, "leading_dir") == 0 && FNM_LEADING_DIR == 0)
+            exit (77);
+
+          /* Likewise for -casefold and FNM_CASEFOLD.  */
+          if (strcmp (s, "casefold") == 0 && FNM_CASEFOLD == 0)
+            exit (77);
+        }
+      else if (add_exclude_file (add_exclude, exclude, opt,
+                                 exclude_options, '\n') != 0)
+        error (1, errno, "error loading %s", opt);
+    }
+
+  for (; argc; --argc)
+    {
+      char *word = *++argv;
+
+      printf ("%s: %d\n", word, excluded_file_name (exclude, word));
+    }
+
+  free_exclude (exclude);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 9abb2b9fd946f61a8e794af1a509bcf5d4a3e3fa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-exclude1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..8800442c49f8728a3de962ad717ce936e17f9577
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Test suite for exclude.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+fail=0
+
+# Test literal matches
+
+cat > in <<EOT
+foo*
+bar
+Baz
+EOT
+
+cat > expected <<EOT
+foo: 0
+foo*: 1
+bar: 1
+foobar: 0
+baz: 0
+bar/qux: 0
+EOT
+
+${CHECKER} test-exclude in -- foo 'foo*' bar foobar baz bar/qux > out || exit $?
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index f9c7f3f40749c31653c2c2c69c06e6b687ba564b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-exclude2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..4571155475a383f40ad19b0b2aea3ff8d5adae13
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Test suite for exclude.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+fail=0
+
+cat > in <<EOT
+foo*
+bar
+Baz
+EOT
+
+# Test case-insensitive literal matches
+
+cat > expected <<EOT
+foo: 0
+foo*: 1
+bar: 1
+foobar: 0
+baz: 1
+bar/qux: 0
+EOT
+
+${CHECKER} test-exclude -casefold in -- foo 'foo*' bar foobar baz bar/qux > out || exit $?
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index 1215b253a53d92b0d68c65a6695637d125da97bd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-exclude3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3568a8a7698e1d4402474cf62f0268a81e65ad62
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Test suite for exclude.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+fail=0
+
+# Test include
+
+cat > in <<EOT
+foo*
+bar
+Baz
+EOT
+
+cat > expected <<EOT
+foo: 1
+foo*: 0
+bar: 0
+foobar: 1
+baz: 1
+bar/qux: 1
+EOT
+
+${CHECKER} test-exclude -include in -- foo 'foo*' bar foobar baz bar/qux > out || exit $?
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index e990c53ed6368398678b103c851986d9957a652c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-exclude4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..6646e54a75bdc18dbdb68fe2fa63fa8def1f2bcc
--- /dev/null
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Test suite for exclude.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+fail=0
+
+# Test wildcard matching
+
+cat > in <<EOT
+foo*
+bar
+Baz
+EOT
+
+cat > expected <<EOT
+foobar: 1
+EOT
+
+${CHECKER} test-exclude -wildcards in -- foobar > out || exit $?
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index c3bf7eaa904252ae3ab510deb96edb9dfa82ddd2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-exclude5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..0c1ab18bcb97dba4594d540d41adb70d2d8ff470
--- /dev/null
@@ -0,0 +1,48 @@
+#! /bin/sh
+# Test suite for exclude.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+fail=0
+
+# Test FNM_LEADING_DIR
+
+cat > in <<EOT
+foo*
+bar
+Baz
+EOT
+
+cat > expected <<EOT
+bar: 1
+bar/qux: 1
+barz: 0
+foo/bar: 1
+EOT
+
+${CHECKER} test-exclude -leading_dir in -- bar bar/qux barz foo/bar > out || exit $?
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index 9c5fc447a667651d2d8c9c97cfcea391d69868f1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-exclude6.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..adfd30f29dafdf43586d65f03b1929d69ada41d8
--- /dev/null
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Test suite for exclude.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+fail=0
+
+# Test anchored
+
+cat > in <<EOT
+foo*
+bar
+Baz
+EOT
+
+cat > expected <<EOT
+bar: 1
+foo/bar: 0
+EOT
+
+${CHECKER} test-exclude -anchored in -- bar foo/bar > out || exit $?
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index 85eb0b2437dd2c63d730b445f2d41c1f563c9baf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-exclude7.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3edaf0cb329844ed7b47467466b4178fefb01b39
--- /dev/null
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Test suite for exclude.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+fail=0
+
+# Test exclude precedence
+
+cat > in <<EOT
+foo*
+bar
+Baz
+EOT
+
+cat > expected <<EOT
+bar: 0
+bar: 1
+EOT
+
+${CHECKER} test-exclude in -include in -- bar > out || exit $?
+${CHECKER} test-exclude -include in -no-include in -- bar >> out || exit $?
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index 3818b64109da8b81ab803b980cd4cc2dbdd1c21b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-exclude8.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..eb8dd2058a28fb8c49999aa45f893a296dbc7535
--- /dev/null
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Test suite for exclude.
+# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+fail=0
+
+# Test escaped metacharacters.
+
+cat > in <<'EOT'
+f\*e
+b[a\*]r
+EOT
+
+cat > expected <<'EOT'
+f*e: 1
+file: 0
+bar: 1
+EOT
+
+${CHECKER} test-exclude -wildcards in -- 'f*e' 'file' 'bar' > out || exit $?
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index e61ffba1640c962265265840d60094b1e07b2f74..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-explicit_bzero.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e414ea5e4dc1af0b5ddc6897b5d4094448b3f7c9
--- /dev/null
@@ -0,0 +1,205 @@
+/* Test of explicit_bzero() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (explicit_bzero, void, (void *, size_t));
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "vma-iter.h"
+#include "macros.h"
+
+#define SECRET "xyzzy1729"
+#define SECRET_SIZE 9
+
+static char zero[SECRET_SIZE] = { 0 };
+
+/* Enable this to verify that the test is effective.  */
+#if 0
+# define explicit_bzero(a, n)  memset (a, '\0', n)
+#endif
+
+/* Suppress GCC 13.2.1 false alarm, as this test needs a dangling pointer.  */
+#if 12 <= __GNUC__
+# pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
+
+/* =================== Verify operation on static memory =================== */
+
+static char stbuf[SECRET_SIZE];
+
+static void
+test_static (void)
+{
+  memcpy (stbuf, SECRET, SECRET_SIZE);
+  explicit_bzero (stbuf, SECRET_SIZE);
+  ASSERT (memcmp (zero, stbuf, SECRET_SIZE) == 0);
+}
+
+/* =============== Verify operation on heap-allocated memory =============== */
+
+/* Test whether an address range is mapped in memory.  */
+#if VMA_ITERATE_SUPPORTED
+
+struct locals
+{
+  uintptr_t range_start;
+  uintptr_t range_end;
+};
+
+static int
+vma_iterate_callback (void *data, uintptr_t start, uintptr_t end,
+                      unsigned int flags)
+{
+  struct locals *lp = (struct locals *) data;
+
+  /* Remove from [range_start, range_end) the part at the beginning or at the
+     end that is covered by [start, end).  */
+  if (start <= lp->range_start && end > lp->range_start)
+    lp->range_start = (end < lp->range_end ? end : lp->range_end);
+  if (start < lp->range_end && end >= lp->range_end)
+    lp->range_end = (start > lp->range_start ? start : lp->range_start);
+
+  return 0;
+}
+
+static bool
+is_range_mapped (uintptr_t range_start, uintptr_t range_end)
+{
+  struct locals l;
+
+  l.range_start = range_start;
+  l.range_end = range_end;
+  vma_iterate (vma_iterate_callback, &l);
+  return l.range_start == l.range_end;
+}
+
+#else
+
+static bool
+is_range_mapped (uintptr_t range_start, uintptr_t range_end)
+{
+  return true;
+}
+
+#endif
+
+static void
+test_heap (void)
+{
+  char *heapbuf = (char *) malloc (SECRET_SIZE);
+  ASSERT (heapbuf);
+  uintptr_t volatile addr = (uintptr_t) heapbuf;
+  memcpy (heapbuf, SECRET, SECRET_SIZE);
+  explicit_bzero (heapbuf, SECRET_SIZE);
+  free (heapbuf);
+  heapbuf = (char *) addr;
+  if (is_range_mapped (addr, addr + SECRET_SIZE))
+    {
+      /* some implementation could override freed memory by canaries so
+         compare against secret */
+      ASSERT (memcmp (heapbuf, SECRET, SECRET_SIZE) != 0);
+      printf ("test_heap: address range is still mapped after free().\n");
+    }
+  else
+    printf ("test_heap: address range is unmapped after free().\n");
+}
+
+/* =============== Verify operation on stack-allocated memory =============== */
+
+/* There are two passes:
+     1. Put a secret in memory and invoke explicit_bzero on it.
+     2. Verify that the memory has been erased.
+   Implement them in the same function, so that they access the same memory
+   range on the stack.  Declare the local scalars to be volatile so they
+   are not optimized away.  That way, the test verifies that the compiler
+   does not eliminate a call to explicit_bzero, even if data flow analysis
+   reveals that the stack area is dead at the end of the function.  */
+static bool _GL_ATTRIBUTE_NOINLINE
+#if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4
+__attribute__ ((__noclone__))
+#endif
+#if __GNUC__ >= 8
+__attribute__ ((__noipa__))
+#endif
+do_secret_stuff (int volatile pass, char *volatile *volatile last_stackbuf)
+{
+  char stackbuf[SECRET_SIZE];
+  if (pass == 1)
+    {
+      memcpy (stackbuf, SECRET, SECRET_SIZE);
+      explicit_bzero (stackbuf, SECRET_SIZE);
+      *last_stackbuf = stackbuf;
+      return false;
+    }
+  else /* pass == 2 */
+    {
+      /* Use *last_stackbuf here, because stackbuf may be allocated at a
+         different address than *last_stackbuf.  This can happen
+         when the compiler splits this function into different functions,
+         one for pass == 1 and one for pass != 1.  */
+      return memcmp (zero, *last_stackbuf, SECRET_SIZE) != 0;
+    }
+}
+
+static void
+test_stack (void)
+{
+  int count = 0;
+  int repeat;
+  char *volatile last_stackbuf;
+
+  for (repeat = 2 * 1000; repeat > 0; repeat--)
+    {
+      /* This odd way of writing two consecutive statements
+           do_secret_stuff (1, &last_stackbuf);
+           count += do_secret_stuff (2, &last_stackbuf);
+         ensures that the two do_secret_stuff calls are performed with the same
+         stack pointer value, on m68k.  */
+      if ((repeat % 2) == 0)
+        do_secret_stuff (1, &last_stackbuf);
+      else
+        count += do_secret_stuff (2, &last_stackbuf);
+    }
+  /* If explicit_bzero works, count is near 0.  (It may be > 0 if there were
+     some asynchronous signal invocations between the two calls of
+     do_secret_stuff.)
+     If explicit_bzero is optimized away by the compiler, count comes out as
+     approximately 1000.  */
+  printf ("test_stack: count = %d\n", count);
+  ASSERT (count < 50);
+}
+
+/* ========================================================================== */
+
+int
+main ()
+{
+  test_static ();
+  test_heap ();
+  test_stack ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 676d835f3737d1514a81fcec138508ad5c73edf8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-faccessat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..caea4be484ebfc66d946cbe90c3051ec8c811e33
--- /dev/null
@@ -0,0 +1,101 @@
+/* Test checking user's permissions for a file.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (faccessat, int, (int, const char *, int, int));
+
+#include <errno.h>
+#include <fcntl.h>
+
+#include "macros.h"
+
+#define BASE "test-faccessat.t"
+
+int
+main (void)
+{
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (faccessat (-1, "foo", F_OK, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (faccessat (99, "foo", F_OK, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Test behavior with trailing slash.  */
+
+  unlink (BASE "file");
+  ASSERT (faccessat (AT_FDCWD, ".", X_OK, 0) == 0);
+  ASSERT (faccessat (AT_FDCWD, "./", X_OK, 0) == 0);
+  ASSERT (close (open (BASE "file", O_CREAT | O_WRONLY, 0)) == 0);
+  ASSERT (faccessat (AT_FDCWD, BASE "file", F_OK, 0) == 0);
+
+  ASSERT (faccessat (AT_FDCWD, BASE "file/", F_OK, 0) != 0);
+  ASSERT (errno == ENOTDIR);
+  ASSERT (faccessat (AT_FDCWD, BASE "file/", R_OK, 0) != 0);
+  ASSERT (errno == ENOTDIR);
+  ASSERT (faccessat (AT_FDCWD, BASE "file/", W_OK, 0) != 0);
+  ASSERT (errno == ENOTDIR);
+  ASSERT (faccessat (AT_FDCWD, BASE "file/", X_OK, 0) != 0);
+  ASSERT (errno == ENOTDIR);
+
+  unlink (BASE "link1");
+  if (symlink (".", BASE "link1") == 0)
+    {
+      ASSERT (faccessat (AT_FDCWD, BASE "link1", X_OK, 0) == 0);
+      ASSERT (faccessat (AT_FDCWD, BASE "link1/", X_OK, 0) == 0);
+
+      unlink (BASE "link2");
+      ASSERT (symlink (BASE "file", BASE "link2") == 0);
+      ASSERT (faccessat (AT_FDCWD, BASE "link2", F_OK, 0) == 0);
+      ASSERT (faccessat (AT_FDCWD, BASE "link2/", F_OK, 0) != 0);
+      ASSERT (errno == ENOTDIR);
+      ASSERT (faccessat (AT_FDCWD, BASE "link2/", R_OK, 0) != 0);
+      ASSERT (errno == ENOTDIR || errno == EACCES);
+      ASSERT (faccessat (AT_FDCWD, BASE "link2/", W_OK, 0) != 0);
+      ASSERT (errno == ENOTDIR || errno == EACCES);
+      ASSERT (faccessat (AT_FDCWD, BASE "link2/", X_OK, 0) != 0);
+      ASSERT (errno == ENOTDIR || errno == EACCES);
+      unlink (BASE "link2");
+
+      unlink (BASE "link3");
+      ASSERT (symlink (BASE "no-such-file", BASE "link3") == 0);
+      ASSERT (faccessat (AT_FDCWD, BASE "link3", F_OK, 0) != 0);
+      ASSERT (errno == ENOENT);
+      ASSERT (faccessat (AT_FDCWD, BASE "link3/", F_OK, 0) != 0);
+      ASSERT (errno == ENOENT);
+      ASSERT (faccessat (AT_FDCWD, BASE "link3/", R_OK, 0) != 0);
+      ASSERT (errno == ENOENT);
+      ASSERT (faccessat (AT_FDCWD, BASE "link3/", W_OK, 0) != 0);
+      ASSERT (errno == ENOENT);
+      ASSERT (faccessat (AT_FDCWD, BASE "link3/", X_OK, 0) != 0);
+      ASSERT (errno == ENOENT);
+      unlink (BASE "link3");
+    }
+  unlink (BASE "link1");
+  unlink (BASE "file");
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 11f0dc298bb99dc8a248b3bc59e546826c5ec30f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fchdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dc529745378956253597c330d5fa8d4c480e3277
--- /dev/null
@@ -0,0 +1,110 @@
+/* Test changing to a directory named by a file descriptor.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fchdir, int, (int));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "cloexec.h"
+#include "macros.h"
+
+int
+main (void)
+{
+  char *cwd;
+  int fd;
+  int i;
+
+  cwd = getcwd (NULL, 0);
+  ASSERT (cwd);
+
+  fd = open (".", O_RDONLY);
+  ASSERT (0 <= fd);
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (fchdir (-1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (fchdir (99) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Check for other failure cases.  */
+  {
+    int bad_fd = open ("/dev/null", O_RDONLY);
+    ASSERT (0 <= bad_fd);
+    errno = 0;
+    ASSERT (fchdir (bad_fd) == -1);
+    ASSERT (errno == ENOTDIR);
+    ASSERT (close (bad_fd) == 0);
+  }
+
+  /* Repeat test twice, once in '.' and once in '..'.  */
+  for (i = 0; i < 2; i++)
+    {
+      ASSERT (chdir (&".."[1 - i]) == 0);
+      ASSERT (fchdir (fd) == 0);
+      {
+        size_t len = strlen (cwd) + 1;
+        char *new_dir = malloc (len);
+        ASSERT (new_dir);
+        ASSERT (getcwd (new_dir, len) == new_dir);
+        ASSERT (strcmp (cwd, new_dir) == 0);
+        free (new_dir);
+      }
+
+      /* For second iteration, use a cloned fd, to ensure that dup
+         remembers whether an fd was associated with a directory.  */
+      if (!i)
+        {
+          int new_fd = dup (fd);
+          ASSERT (0 <= new_fd);
+          ASSERT (close (fd) == 0);
+          ASSERT (dup2 (new_fd, fd) == fd);
+          ASSERT (close (new_fd) == 0);
+          ASSERT (dup_cloexec (fd) == new_fd);
+          ASSERT (dup2 (new_fd, fd) == fd);
+          ASSERT (close (new_fd) == 0);
+          ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, new_fd) == new_fd);
+          ASSERT (close (fd) == 0);
+          ASSERT (fcntl (new_fd, F_DUPFD, fd) == fd);
+          ASSERT (close (new_fd) == 0);
+#if GNULIB_TEST_DUP3
+          ASSERT (dup3 (fd, new_fd, 0) == new_fd);
+          ASSERT (dup3 (new_fd, fd, 0) == fd);
+          ASSERT (close (new_fd) == 0);
+#endif
+        }
+    }
+
+  free (cwd);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 4434857baafa1793fc4a1c8bbb1be8e71923f080..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fchmodat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8fdcb8942fa98ca7e41a12a1e254575b250c0b25
--- /dev/null
@@ -0,0 +1,97 @@
+/* Test changing the protections of a file relative to an open directory.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fchmodat, int, (int, const char *, mode_t, int));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-fchmodat."
+
+int
+main (void)
+{
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (fchmodat (-1, "foo", 0600, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (fchmodat (99, "foo", 0600, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Test that fchmodat works on regular files.  */
+  {
+    struct stat statbuf;
+
+    unlink (BASE "file");
+    ASSERT (close (creat (BASE "file", 0600)) == 0);
+    ASSERT (fchmodat (AT_FDCWD, BASE "file", 0400, 0) == 0);
+    ASSERT (stat (BASE "file", &statbuf) >= 0);
+    ASSERT ((statbuf.st_mode & 0700) == 0400);
+
+    errno = 0;
+    ASSERT (fchmodat (AT_FDCWD, BASE "file/", 0600, 0) == -1);
+    ASSERT (errno == ENOTDIR);
+
+    /* Clean up.  */
+    ASSERT (chmod (BASE "file", 0600) == 0);
+    ASSERT (unlink (BASE "file") == 0);
+  }
+
+  /* Test that fchmodat works on directories.  */
+  {
+    struct stat statbuf;
+    rmdir (BASE "dir");
+    ASSERT (mkdir (BASE "dir", 0700) == 0);
+    ASSERT (fchmodat (AT_FDCWD, BASE "dir", 0500, 0) == 0);
+    ASSERT (stat (BASE "dir", &statbuf) >= 0);
+    ASSERT ((statbuf.st_mode & 0700) == 0500);
+    ASSERT (fchmodat (AT_FDCWD, BASE "dir/", 0700, 0) == 0);
+
+    /* Clean up.  */
+    ASSERT (rmdir (BASE "dir") == 0);
+  }
+
+  /* Test that fchmodat works on non-symlinks, when given
+     the AT_SYMLINK_NOFOLLOW flag.  */
+  {
+    struct stat statbuf;
+    unlink (BASE "file");
+    ASSERT (close (creat (BASE "file", 0600)) == 0);
+    ASSERT (fchmodat (AT_FDCWD, BASE "file", 0400, AT_SYMLINK_NOFOLLOW) == 0);
+    ASSERT (stat (BASE "file", &statbuf) >= 0);
+    ASSERT ((statbuf.st_mode & 0700) == 0400);
+    /* Clean up.  */
+    ASSERT (chmod (BASE "file", 0600) == 0);
+    ASSERT (unlink (BASE "file") == 0);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 0e8981729ded5e7a15ef66936905477c5a0e2e00..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fchownat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..95a0eee24c7e62973af60b2dbd381ff8c882f608
--- /dev/null
@@ -0,0 +1,104 @@
+/* Tests of fchownat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fchownat, int, (int, char const *, uid_t, gid_t, int));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#include "mgetgroups.h"
+#include "openat.h"
+#include "stat-time.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#ifndef BASE
+# define BASE "test-fchownat.t"
+#endif
+
+#include "test-chown.h"
+#include "test-lchown.h"
+
+static int dfd = AT_FDCWD;
+
+/* Wrapper around fchownat to test chown behavior.  */
+static int
+do_chown (char const *name, uid_t user, gid_t group)
+{
+#ifdef TEST_CHOWNAT
+  return chownat (dfd, name, user, group);
+#else
+  return fchownat (dfd, name, user, group, 0);
+#endif
+}
+
+/* Wrapper around fchownat to test lchown behavior.  */
+static int
+do_lchown (char const *name, uid_t user, gid_t group)
+{
+#ifdef TEST_CHOWNAT
+  return lchownat (dfd, name, user, group);
+#else
+  return fchownat (dfd, name, user, group, AT_SYMLINK_NOFOLLOW);
+#endif
+}
+
+int
+main (_GL_UNUSED int argc, char *argv[])
+{
+  int result1; /* Skip because of no chown/symlink support.  */
+  int result2; /* Skip because of no lchown support.  */
+
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (fchownat (-1, "foo", getuid (), getgid (), 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (fchownat (99, "foo", getuid (), getgid (), 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Basic tests.  */
+  result1 = test_chown (do_chown, true);
+  result2 = test_lchown (do_lchown, result1 == 0);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_chown (do_chown, false) == result1);
+  ASSERT (test_lchown (do_lchown, false) == result2);
+  /* We expect 0/0, 0/77, or 77/77, but not 77/0.  */
+  ASSERT (result1 <= result2);
+  ASSERT (close (dfd) == 0);
+
+  /* FIXME - add additional tests of dfd not at current directory.  */
+  return result1 | result2;
+}
deleted file mode 120000 (symlink)
index cbb336e0b7b188f60bd67e8ae7948cc4329e1174..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fclose.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..123ea69911ba770cb3b09811b12c0d5200a2201a
--- /dev/null
@@ -0,0 +1,116 @@
+/* Test of fclose module.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fclose, int, (FILE *));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-fclose.t"
+
+int
+main (int argc, char **argv)
+{
+  const char buf[] = "hello world";
+  int fd;
+  int fd2;
+  FILE *f;
+
+  /* Prepare a seekable file.  */
+  fd = open (BASE, O_RDWR | O_CREAT | O_TRUNC, 0600);
+  ASSERT (0 <= fd);
+  ASSERT (write (fd, buf, sizeof buf) == sizeof buf);
+  ASSERT (lseek (fd, 1, SEEK_SET) == 1);
+
+  /* Create an output stream visiting the file; when it is closed, all
+     other file descriptors visiting the file must see the new file
+     position.  */
+  fd2 = dup (fd);
+  ASSERT (0 <= fd2);
+  f = fdopen (fd2, "w");
+  ASSERT (f);
+  ASSERT (fputc (buf[1], f) == buf[1]);
+  ASSERT (fclose (f) == 0);
+  errno = 0;
+  ASSERT (lseek (fd2, 0, SEEK_CUR) == -1);
+  ASSERT (errno == EBADF);
+  ASSERT (lseek (fd, 0, SEEK_CUR) == 2);
+
+  /* Likewise for an input stream.  */
+  fd2 = dup (fd);
+  ASSERT (0 <= fd2);
+  f = fdopen (fd2, "r");
+  ASSERT (f);
+  ASSERT (fgetc (f) == buf[2]);
+  ASSERT (fclose (f) == 0);
+  errno = 0;
+  ASSERT (lseek (fd2, 0, SEEK_CUR) == -1);
+  ASSERT (errno == EBADF);
+  ASSERT (lseek (fd, 0, SEEK_CUR) == 3);
+
+  /* Test that fclose() sets errno if someone else closes the stream
+     fd behind the back of stdio.  */
+  #if !defined __ANDROID__ /* fdsan */
+  {
+    FILE *fp = fdopen (fd, "w+");
+    ASSERT (fp != NULL);
+    ASSERT (close (fd) == 0);
+    errno = 0;
+    ASSERT (fclose (fp) == EOF);
+    ASSERT (errno == EBADF);
+  }
+  #endif
+
+  /* Test that fclose() sets errno if the stream was constructed with
+     an invalid file descriptor.  */
+  {
+    FILE *fp = fdopen (-1, "r");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (fclose (fp) == EOF);
+        ASSERT (errno == EBADF);
+      }
+  }
+  {
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "r");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (fclose (fp) == EOF);
+        ASSERT (errno == EBADF);
+      }
+  }
+
+  /* Clean up.  */
+  ASSERT (remove (BASE) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index d5367178fdd19146b259577dfa8eec97bf8d102a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fcntl-h.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d633167235a23800d5a0bd14ab52314d72d4b540
--- /dev/null
@@ -0,0 +1,130 @@
+/* Test of <fcntl.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <fcntl.h>
+
+/* Check that the various O_* macros are defined.  */
+int o = (O_DIRECT | O_DIRECTORY | O_DSYNC | O_IGNORE_CTTY | O_NDELAY | O_NOATIME
+         | O_NONBLOCK | O_NOCTTY | O_NOFOLLOW | O_NOLINK | O_NOLINKS | O_NOTRANS
+         | O_RSYNC | O_SYNC | O_TTY_INIT | O_BINARY | O_TEXT);
+
+/* Check that the various SEEK_* macros are defined.  */
+int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+
+/* Check that the FD_* macros are defined.  */
+int i = FD_CLOEXEC;
+
+/* Check that the types are all defined.  */
+pid_t t1;
+off_t t2;
+mode_t t3;
+
+int
+main (void)
+{
+  /* Ensure no overlap in SEEK_*. */
+  switch (0)
+    {
+    case SEEK_CUR:
+    case SEEK_END:
+    case SEEK_SET:
+      ;
+    }
+
+  /* Ensure no dangerous overlap in non-zero gnulib-defined replacements.  */
+  switch (O_RDONLY)
+    {
+      /* Access modes */
+    case O_RDONLY:
+    case O_WRONLY:
+    case O_RDWR:
+#if O_EXEC && O_EXEC != O_RDONLY
+    case O_EXEC:
+#endif
+#if O_SEARCH && O_EXEC != O_SEARCH && O_SEARCH != O_RDONLY
+    case O_SEARCH:
+#endif
+      i = ! (~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH));
+      break;
+
+      /* Everyone should have these */
+    case O_CREAT:
+    case O_EXCL:
+    case O_TRUNC:
+    case O_APPEND:
+      break;
+
+      /* These might be 0 or O_RDONLY, only test non-zero versions.  */
+#if O_CLOEXEC
+    case O_CLOEXEC:
+#endif
+#if O_DIRECT
+    case O_DIRECT:
+#endif
+#if O_DIRECTORY
+    case O_DIRECTORY:
+#endif
+#if O_DSYNC
+    case O_DSYNC:
+#endif
+#if O_IGNORE_CTTY
+    case O_IGNORE_CTTY:
+#endif
+#if O_NOATIME
+    case O_NOATIME:
+#endif
+#if O_NONBLOCK
+    case O_NONBLOCK:
+#endif
+#if O_NOCTTY
+    case O_NOCTTY:
+#endif
+#if O_NOFOLLOW
+    case O_NOFOLLOW:
+#endif
+#if O_NOLINK
+    case O_NOLINK:
+#endif
+#if O_NOLINKS
+    case O_NOLINKS:
+#endif
+#if O_NOTRANS
+    case O_NOTRANS:
+#endif
+#if O_RSYNC && O_RSYNC != O_DSYNC
+    case O_RSYNC:
+#endif
+#if O_SYNC && O_SYNC != O_DSYNC && O_SYNC != O_RSYNC
+    case O_SYNC:
+#endif
+#if O_TTY_INIT
+    case O_TTY_INIT:
+#endif
+#if O_BINARY
+    case O_BINARY:
+#endif
+#if O_TEXT
+    case O_TEXT:
+#endif
+      ;
+    }
+
+  return !i;
+}
deleted file mode 120000 (symlink)
index 61044e11fedd28f8fc49d2953e0fa25272f1a62f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fcntl-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6997e20fe50f0445ab8d9bf610057fd9a7810979
--- /dev/null
@@ -0,0 +1,37 @@
+/* Test of opening a file descriptor.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "fcntl--.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-fcntl-safer.t"
+
+#include "test-open.h"
+
+int
+main (void)
+{
+  return test_open (open, true);
+}
deleted file mode 120000 (symlink)
index f00c0f5ca5c1a207d75325eede7fe17bf9e1bf95..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fcntl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0eb24a9f6af37232846dd11bfebb94f95045ee46
--- /dev/null
@@ -0,0 +1,444 @@
+/* Test of fcntl(2).
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <fcntl.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fcntl, int, (int, int, ...));
+
+/* Helpers.  */
+#include <errno.h>
+#include <stdarg.h>
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+#endif
+
+#include "binary-io.h"
+#include "macros.h"
+
+/* Tell GCC not to warn about the specific edge cases tested here.  */
+#if __GNUC__ >= 13
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
+# pragma GCC diagnostic ignored "-Wanalyzer-va-arg-type-mismatch"
+#endif
+
+#if !O_BINARY
+# define set_binary_mode my_set_binary_mode
+static int
+set_binary_mode (_GL_UNUSED int fd, _GL_UNUSED int mode)
+{
+  return 0;
+}
+#endif
+
+/* Return true if FD is open.  */
+static bool
+is_open (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+#else
+# ifndef F_GETFL
+#  error Please port fcntl to your platform
+# endif
+  return 0 <= fcntl (fd, F_GETFL);
+#endif
+}
+
+/* Return true if FD is open and inheritable across exec/spawn.  */
+static bool
+is_inheritable (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  DWORD flags;
+  if (h == INVALID_HANDLE_VALUE || GetHandleInformation (h, &flags) == 0)
+    return false;
+  return (flags & HANDLE_FLAG_INHERIT) != 0;
+#else
+# ifndef F_GETFD
+#  error Please port fcntl to your platform
+# endif
+  int i = fcntl (fd, F_GETFD);
+  return 0 <= i && (i & FD_CLOEXEC) == 0;
+#endif
+}
+
+/* Return non-zero if FD is open in the given MODE, which is either
+   O_TEXT or O_BINARY.  */
+static bool
+is_mode (int fd, int mode)
+{
+  int value = set_binary_mode (fd, O_BINARY);
+  set_binary_mode (fd, value);
+  return mode == value;
+}
+
+/* Since native fcntl can have more supported operations than our
+   replacement is aware of, and since various operations assign
+   different types to the vararg argument, a wrapper around fcntl must
+   be able to pass a vararg of unknown type on through to the original
+   fcntl.  Make sure that this works properly: func1 behaves like the
+   original fcntl interpreting the vararg as an int or a pointer to a
+   struct, and func2 behaves like rpl_fcntl that doesn't know what
+   type to forward.  */
+struct dummy_struct
+{
+  long filler;
+  int value;
+};
+static int
+func1 (int a, ...)
+{
+  va_list arg;
+  int i;
+  va_start (arg, a);
+  if (a < 4)
+    i = va_arg (arg, int);
+  else
+    {
+      struct dummy_struct *s = va_arg (arg, struct dummy_struct *);
+      i = s->value;
+    }
+  va_end (arg);
+  return i;
+}
+static int
+func2 (int a, ...)
+{
+  va_list arg;
+  void *p;
+  va_start (arg, a);
+  p = va_arg (arg, void *);
+  va_end (arg);
+  return func1 (a, p);
+}
+
+/* Ensure that all supported fcntl actions are distinct, and
+   usable in preprocessor expressions.  */
+static void
+check_flags (void)
+{
+  switch (0)
+    {
+    case F_DUPFD:
+#if F_DUPFD
+#endif
+
+    case F_DUPFD_CLOEXEC:
+#if F_DUPFD_CLOEXEC
+#endif
+
+    case F_GETFD:
+#if F_GETFD
+#endif
+
+#ifdef F_SETFD
+    case F_SETFD:
+# if F_SETFD
+# endif
+#endif
+
+#ifdef F_GETFL
+    case F_GETFL:
+# if F_GETFL
+# endif
+#endif
+
+#ifdef F_SETFL
+    case F_SETFL:
+# if F_SETFL
+# endif
+#endif
+
+#ifdef F_GETOWN
+    case F_GETOWN:
+# if F_GETOWN
+# endif
+#endif
+
+#ifdef F_SETOWN
+    case F_SETOWN:
+# if F_SETOWN
+# endif
+#endif
+
+#ifdef F_GETLK
+    case F_GETLK:
+# if F_GETLK
+# endif
+#endif
+
+#ifdef F_SETLK
+    case F_SETLK:
+# if F_SETLK
+# endif
+#endif
+
+#ifdef F_SETLKW
+    case F_SETLKW:
+# if F_SETLKW
+# endif
+#endif
+
+    default:
+      ;
+    }
+}
+
+int
+main (int argc, _GL_UNUSED char *argv[])
+{
+  if (argc > 1)
+    /* child process */
+    return (is_open (10) ? 42 : 0);
+
+  const char *file = "test-fcntl.tmp";
+  int fd;
+  int bad_fd = getdtablesize ();
+
+  /* Sanity check that rpl_fcntl is likely to work.  */
+  ASSERT (func2 (1, 2) == 2);
+  ASSERT (func2 (2, -2) == -2);
+  ASSERT (func2 (3, 0x80000000) == 0x80000000);
+  {
+    struct dummy_struct s = { 0L, 4 };
+    ASSERT (func2 (4, &s) == 4);
+  }
+  check_flags ();
+
+  /* Assume std descriptors were provided by invoker, and ignore fds
+     that might have been inherited.  */
+  fd = creat (file, 0600);
+  ASSERT (STDERR_FILENO < fd);
+  close (fd + 1);
+  close (fd + 2);
+
+  /* For F_DUPFD*, the source must be valid.  */
+  errno = 0;
+  ASSERT (fcntl (-1, F_DUPFD, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_DUPFD, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (bad_fd, F_DUPFD, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (-1, F_DUPFD_CLOEXEC, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_DUPFD_CLOEXEC, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (bad_fd, F_DUPFD_CLOEXEC, 0) == -1);
+  ASSERT (errno == EBADF);
+
+  /* For F_DUPFD*, the destination must be valid.  */
+  errno = 0;
+  ASSERT (fcntl (fd, F_DUPFD, -1) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (fcntl (fd, F_DUPFD, bad_fd) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, -1) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, bad_fd) == -1);
+  ASSERT (errno == EINVAL
+          || errno == EMFILE /* WSL */);
+
+  /* For F_DUPFD*, check for correct inheritance, as well as
+     preservation of text vs. binary.  */
+  set_binary_mode (fd, O_BINARY);
+  ASSERT (is_open (fd));
+  ASSERT (!is_open (fd + 1));
+  ASSERT (!is_open (fd + 2));
+  ASSERT (is_inheritable (fd));
+  ASSERT (is_mode (fd, O_BINARY));
+
+  ASSERT (fcntl (fd, F_DUPFD, fd) == fd + 1);
+  ASSERT (is_open (fd));
+  ASSERT (is_open (fd + 1));
+  ASSERT (!is_open (fd + 2));
+  ASSERT (is_inheritable (fd + 1));
+  ASSERT (is_mode (fd, O_BINARY));
+  ASSERT (is_mode (fd + 1, O_BINARY));
+  ASSERT (close (fd + 1) == 0);
+
+  ASSERT (fcntl (fd, F_DUPFD_CLOEXEC, fd + 2) == fd + 2);
+  ASSERT (is_open (fd));
+  ASSERT (!is_open (fd + 1));
+  ASSERT (is_open (fd + 2));
+  ASSERT (is_inheritable (fd));
+  ASSERT (!is_inheritable (fd + 2));
+  ASSERT (is_mode (fd, O_BINARY));
+  ASSERT (is_mode (fd + 2, O_BINARY));
+  ASSERT (close (fd) == 0);
+
+  set_binary_mode (fd + 2, O_TEXT);
+  ASSERT (fcntl (fd + 2, F_DUPFD, fd + 1) == fd + 1);
+  ASSERT (!is_open (fd));
+  ASSERT (is_open (fd + 1));
+  ASSERT (is_open (fd + 2));
+  ASSERT (is_inheritable (fd + 1));
+  ASSERT (!is_inheritable (fd + 2));
+  ASSERT (is_mode (fd + 1, O_TEXT));
+  ASSERT (is_mode (fd + 2, O_TEXT));
+  ASSERT (close (fd + 1) == 0);
+
+  ASSERT (fcntl (fd + 2, F_DUPFD_CLOEXEC, 0) == fd);
+  ASSERT (is_open (fd));
+  ASSERT (!is_open (fd + 1));
+  ASSERT (is_open (fd + 2));
+  ASSERT (!is_inheritable (fd));
+  ASSERT (!is_inheritable (fd + 2));
+  ASSERT (is_mode (fd, O_TEXT));
+  ASSERT (is_mode (fd + 2, O_TEXT));
+  ASSERT (close (fd + 2) == 0);
+
+  /* Test F_GETFD on invalid file descriptors.  */
+  errno = 0;
+  ASSERT (fcntl (-1, F_GETFD) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_GETFD) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (bad_fd, F_GETFD) == -1);
+  ASSERT (errno == EBADF);
+
+  /* Test F_GETFD, the FD_CLOEXEC bit.  */
+  {
+    int result = fcntl (fd, F_GETFD);
+    ASSERT (0 <= result);
+    ASSERT ((result & FD_CLOEXEC) == FD_CLOEXEC);
+    ASSERT (dup (fd) == fd + 1);
+    result = fcntl (fd + 1, F_GETFD);
+    ASSERT (0 <= result);
+    ASSERT ((result & FD_CLOEXEC) == 0);
+    ASSERT (close (fd + 1) == 0);
+  }
+
+#ifdef F_SETFD
+  /* Test F_SETFD on invalid file descriptors.  */
+  errno = 0;
+  ASSERT (fcntl (-1, F_SETFD, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_SETFD, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (bad_fd, F_SETFD, 0) == -1);
+  ASSERT (errno == EBADF);
+#endif
+
+#ifdef F_GETFL
+  /* Test F_GETFL on invalid file descriptors.  */
+  errno = 0;
+  ASSERT (fcntl (-1, F_GETFL) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_GETFL) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (bad_fd, F_GETFL) == -1);
+  ASSERT (errno == EBADF);
+#endif
+
+#ifdef F_SETFL
+  /* Test F_SETFL on invalid file descriptors.  */
+  errno = 0;
+  ASSERT (fcntl (-1, F_SETFL, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_SETFL, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (bad_fd, F_SETFL, 0) == -1);
+  ASSERT (errno == EBADF);
+#endif
+
+#ifdef F_GETOWN
+  /* Test F_GETOWN on invalid file descriptors.  */
+  errno = 0;
+  ASSERT (fcntl (-1, F_GETOWN) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_GETOWN) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (bad_fd, F_GETOWN) == -1);
+  ASSERT (errno == EBADF);
+#endif
+
+#ifdef F_SETOWN
+  /* Test F_SETFL on invalid file descriptors.  */
+  errno = 0;
+  ASSERT (fcntl (-1, F_SETOWN, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (fd + 1, F_SETOWN, 0) == -1);
+  ASSERT (errno == EBADF);
+  errno = 0;
+  ASSERT (fcntl (bad_fd, F_SETOWN, 0) == -1);
+  ASSERT (errno == EBADF);
+#endif
+
+  /* Cleanup.  */
+  ASSERT (close (fd) == 0);
+  ASSERT (unlink (file) == 0);
+
+  /* Close file descriptors that may have been inherited from the parent
+     process and that would cause failures below.
+     Such file descriptors have been seen:
+       - with GNU make, when invoked as 'make -j N' with j > 1,
+       - in some versions of the KDE desktop environment,
+       - on NetBSD,
+       - in MacPorts with the "trace mode" enabled.
+   */
+  (void) close (10);
+
+  /* Test whether F_DUPFD_CLOEXEC is effective.  */
+  ASSERT (fcntl (1, F_DUPFD_CLOEXEC, 10) >= 0);
+#if defined _WIN32 && !defined __CYGWIN__
+  return _execl ("./test-fcntl", "./test-fcntl", "child", NULL);
+#else
+  return execl ("./test-fcntl", "./test-fcntl", "child", NULL);
+#endif
+}
deleted file mode 120000 (symlink)
index 405299e0afd80b5c9e7716908839280188381e38..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fdatasync.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c70a1d4bcddcf4eda09f20e49a313339f34101b0
--- /dev/null
@@ -0,0 +1,81 @@
+/* Test of fdatasync() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fdatasync, int, (int));
+
+#include <errno.h>
+#include <fcntl.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  int fd;
+  const char *file = "test-fdatasync.txt";
+
+  /* Assuming stdin and stdout are ttys, fdatasync is allowed to fail, but
+     may succeed as an extension.  */
+  for (fd = 0; fd < 2; fd++)
+    if (fdatasync (fd) != 0)
+      {
+        ASSERT (errno == EINVAL /* POSIX */
+                || errno == ENOTSUP /* seen on Mac OS X 10.5 */
+                || errno == EBADF /* seen on AIX 7.1 */
+                || errno == EIO /* seen on mingw */
+                );
+      }
+
+  /* fdatasync must fail on invalid fd.  */
+  {
+    errno = 0;
+    ASSERT (fdatasync (-1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (fdatasync (99) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+  ASSERT (0 <= fd);
+  ASSERT (write (fd, "hello", 5) == 5);
+  ASSERT (fdatasync (fd) == 0);
+  ASSERT (close (fd) == 0);
+
+#if 0
+  /* POSIX is self-contradictory on whether fdatasync must fail on
+     read-only file descriptors.  Glibc allows it, as does our
+     implementation if fsync allows it.  */
+  fd = open (file, O_RDONLY);
+  ASSERT (0 <= fd);
+  errno = 0;
+  ASSERT (fdatasync (fd) == -1);
+  ASSERT (errno == EBADF);
+  ASSERT (close (fd) == 0);
+#endif
+
+  ASSERT (unlink (file) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 24eef63b01fc4319146daafbca52b562c93a4b2c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fdopen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e5aa6442a11c0e5a5cb4a418c9f88129481144d2
--- /dev/null
@@ -0,0 +1,54 @@
+/* Test opening a stream with a file descriptor.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fdopen, FILE *, (int, const char *));
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Test behavior on failure.  POSIX makes it hard to check for
+     failure, since the behavior is not well-defined on invalid file
+     descriptors, so try fdopen 1000 times and if that's not enough to
+     fail due to EMFILE, so be it.  */
+  #if defined __ANDROID__ /* fdsan */
+    #define COUNT 1
+  #else
+    #define COUNT 1000
+  #endif
+
+  int i;
+  for (i = 0; i < COUNT; i++)
+    {
+      errno = 0;
+      if (! fdopen (STDOUT_FILENO, "w"))
+        {
+          ASSERT (errno != 0);
+          break;
+        }
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 75ff1fe03678ede12e4fceeb45524ee6f320963f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fdopendir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c92e5db4d31de7c498c2ea750a6a3d1cbcab591f
--- /dev/null
@@ -0,0 +1,80 @@
+/* Test opening a directory stream from a file descriptor.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <dirent.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fdopendir, DIR *, (int));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  DIR *d;
+  int fd;
+
+  /* A non-directory cannot be turned into a directory stream.  */
+  fd = open ("test-fdopendir.tmp", O_RDONLY | O_CREAT, 0600);
+  ASSERT (0 <= fd);
+  errno = 0;
+  ASSERT (fdopendir (fd) == NULL);
+  ASSERT (errno == ENOTDIR);
+  ASSERT (close (fd) == 0);
+  ASSERT (unlink ("test-fdopendir.tmp") == 0);
+
+  /* A bad fd cannot be turned into a stream.  */
+  {
+    errno = 0;
+    ASSERT (fdopendir (-1) == NULL);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (fdopendir (99) == NULL);
+    ASSERT (errno == EBADF);
+  }
+
+  /* This should work.  */
+  fd = open (".", O_RDONLY);
+  ASSERT (0 <= fd);
+  d = fdopendir (fd);
+  ASSERT (d);
+  /* fdopendir should not close fd.  */
+  ASSERT (dup2 (fd, fd) == fd);
+
+  /* Don't test dirfd here.  dirfd (d) must return fd on current POSIX
+     platforms, but on pre-2008 platforms or on non-POSIX platforms
+     dirfd (fd) might return some other descriptor, or -1, and gnulib
+     does not work around this porting problem.  */
+
+  ASSERT (closedir (d) == 0);
+  /* Now we can guarantee that fd must be closed.  */
+  errno = 0;
+  ASSERT (dup2 (fd, fd) == -1);
+  ASSERT (errno == EBADF);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5117ae5f708c9b589f60fb522bc39be10beb4e9e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fdutimensat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..56a7b49e0a040853efccd3c7d081a843cdc1226a
--- /dev/null
@@ -0,0 +1,150 @@
+/* Tests of fdutimensat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "utimens.h"
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-fdutimensat.t"
+
+#include "test-futimens.h"
+#include "test-lutimens.h"
+#include "test-utimens.h"
+
+static int dfd = AT_FDCWD;
+
+/* Wrap fdutimensat to behave like futimens.  */
+static int
+do_futimens (int fd, struct timespec const times[2])
+{
+  return fdutimensat (fd, dfd, NULL, times, 0);
+}
+
+/* Test the use of file descriptors alongside a name.  */
+static int
+do_fdutimens (char const *name, struct timespec const times[2])
+{
+  int result;
+  int nofollow_result;
+  int nofollow_errno;
+  int fd = openat (dfd, name, O_WRONLY);
+  if (fd < 0)
+    fd = openat (dfd, name, O_RDONLY);
+  errno = 0;
+  nofollow_result = fdutimensat (fd, dfd, name, times, AT_SYMLINK_NOFOLLOW);
+  nofollow_errno = errno;
+  result = fdutimensat (fd, dfd, name, times, 0);
+  ASSERT (result == nofollow_result
+          || (nofollow_result == -1 && nofollow_errno == ENOSYS));
+  if (0 <= fd)
+    {
+      int saved_errno = errno;
+      close (fd);
+      errno = saved_errno;
+    }
+  return result;
+}
+
+/* Wrap lutimensat to behave like lutimens.  */
+static int
+do_lutimens (const char *name, struct timespec const times[2])
+{
+  return lutimensat (dfd, name, times);
+}
+
+/* Wrap fdutimensat to behave like lutimens.  */
+static int
+do_lutimens1 (const char *name, struct timespec const times[2])
+{
+  return fdutimensat (-1, dfd, name, times, AT_SYMLINK_NOFOLLOW);
+}
+
+/* Wrap fdutimensat to behave like utimens.  */
+static int
+do_utimens (const char *name, struct timespec const times[2])
+{
+  return fdutimensat (-1, dfd, name, times, 0);
+}
+
+int
+main (void)
+{
+  int result1; /* Skip because of no symlink support.  */
+  int result2; /* Skip because of no futimens support.  */
+  int result3; /* Skip because of no lutimens support.  */
+  int fd;
+
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Basic tests.  */
+  result1 = test_utimens (do_utimens, true);
+  ASSERT (test_utimens (do_fdutimens, false) == result1);
+  result2 = test_futimens (do_futimens, result1 == 0);
+  result3 = test_lutimens (do_lutimens, (result1 + result2) == 0);
+  /* We expect 0/0, 0/77, or 77/77, but not 77/0.  */
+  ASSERT (result1 <= result3);
+  ASSERT (test_lutimens (do_lutimens1, (result1 + result2) == 0) == result3);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_utimens (do_utimens, false) == result1);
+  ASSERT (test_utimens (do_fdutimens, false) == result1);
+  ASSERT (test_futimens (do_futimens, false) == result2);
+  ASSERT (test_lutimens (do_lutimens, false) == result3);
+  ASSERT (test_lutimens (do_lutimens1, false) == result3);
+
+  /* Directory relative tests.  */
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  ASSERT (chdir (BASE "dir") == 0);
+  fd = creat ("file", 0600);
+  ASSERT (0 <= fd);
+  errno = 0;
+  ASSERT (fdutimensat (AT_FDCWD, fd, ".", NULL, 0) == -1);
+  ASSERT (errno == ENOTDIR);
+  {
+    struct timespec ts[2];
+    struct stat st;
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1] = ts[0];
+    ASSERT (fdutimensat (fd, dfd, BASE "dir/file", ts, 0) == 0);
+    ASSERT (stat ("file", &st) == 0);
+    ASSERT (st.st_atime == Y2K);
+    ASSERT (get_stat_atime_ns (&st) == 0);
+    ASSERT (st.st_mtime == Y2K);
+    ASSERT (get_stat_mtime_ns (&st) == 0);
+  }
+  ASSERT (close (fd) == 0);
+  ASSERT (close (dfd) == 0);
+  errno = 0;
+  ASSERT (fdutimensat (-1, dfd, ".", NULL, 0) == -1);
+  ASSERT (errno == EBADF);
+
+  /* Cleanup.  */
+  ASSERT (chdir ("..") == 0);
+  ASSERT (unlink (BASE "dir/file") == 0);
+  ASSERT (rmdir (BASE "dir") == 0);
+  return result1 | result2 | result3;
+}
deleted file mode 120000 (symlink)
index 725e6800d90013df670c530d35b13ce9d213e9ce..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fflush.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cef089f274d92dbfae40bd701ca5be6538aca0be
--- /dev/null
@@ -0,0 +1,193 @@
+/* Test of POSIX compatible fflush() function.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake, 2007.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   ftell link warning if we are not using the gnulib ftell module.  */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fflush, int, (FILE *));
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  FILE *f;
+  char buffer[10];
+  int fd;
+
+  /* Create test file.  */
+  f = fopen ("test-fflush.txt", "w");
+  if (!f || fwrite ("1234567890ABCDEFG", 1, 17, f) != 17 || fclose (f) != 0)
+    {
+      fputs ("Failed to create sample file.\n", stderr);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+
+  /* Test fflush.  */
+  f = fopen ("test-fflush.txt", "r");
+  ASSERT (f != NULL);
+  fd = fileno (f);
+  if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5)
+    {
+      fputs ("Failed initial read of sample file.\n", stderr);
+      if (f)
+        fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  /* For deterministic results, ensure f read a bigger buffer.
+     This is not the case on BeOS, nor on uClibc.  */
+#if !(defined __BEOS__ || defined __UCLIBC__)
+  if (lseek (fd, 0, SEEK_CUR) == 5)
+    {
+      fputs ("Sample file was not buffered after fread.\n", stderr);
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+#endif
+  /* POSIX requires fflush-fseek to set file offset of fd.  */
+  if (fflush (f) != 0 || fseeko (f, 0, SEEK_CUR) != 0)
+    {
+      fputs ("Failed to flush-fseek sample file.\n", stderr);
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  /* Check that offset is correct.  */
+  if (lseek (fd, 0, SEEK_CUR) != 5)
+    {
+      fprintf (stderr, "File offset is wrong after fseek: %ld.\n",
+               (long) lseek (fd, 0, SEEK_CUR));
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  if (ftell (f) != 5)
+    {
+      fprintf (stderr, "ftell result is wrong after fseek: %ld.\n",
+               (long) ftell (f));
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  /* Check that file reading resumes at correct location.  */
+  if (fgetc (f) != '6')
+    {
+      fputs ("Failed to read next byte after fseek.\n", stderr);
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  /* For deterministic results, ensure f read a bigger buffer.  */
+  if (lseek (fd, 0, SEEK_CUR) == 6)
+    {
+      fputs ("Sample file was not buffered after fgetc.\n", stderr);
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  /* POSIX requires fflush-fseeko to set file offset of fd.  */
+  if (fflush (f) != 0 || fseeko (f, 0, SEEK_CUR) != 0)
+    {
+      fputs ("Failed to flush-fseeko sample file.\n", stderr);
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  /* Check that offset is correct.  */
+  if (lseek (fd, 0, SEEK_CUR) != 6)
+    {
+      fprintf (stderr, "File offset is wrong after fseeko: %ld.\n",
+               (long) lseek (fd, 0, SEEK_CUR));
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  if (ftell (f) != 6)
+    {
+      fprintf (stderr, "ftell result is wrong after fseeko: %ld.\n",
+               (long) ftell (f));
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  /* Check that file reading resumes at correct location.  */
+  if (fgetc (f) != '7')
+    {
+      fputs ("Failed to read next byte after fseeko.\n", stderr);
+      fclose (f);
+      unlink ("test-fflush.txt");
+      return 1;
+    }
+  fclose (f);
+
+  /* Test that fflush() sets errno if someone else closes the stream
+     fd behind the back of stdio.  */
+  #if !defined __ANDROID__ /* fdsan */
+  {
+    FILE *fp = fopen ("test-fflush.txt", "w");
+    ASSERT (fp != NULL);
+    fputc ('x', fp);
+    ASSERT (close (fileno (fp)) == 0);
+    errno = 0;
+    ASSERT (fflush (fp) == EOF);
+    ASSERT (errno == EBADF);
+    fclose (fp);
+  }
+  #endif
+
+  /* Test that fflush() sets errno if the stream was constructed with
+     an invalid file descriptor.  */
+  {
+    FILE *fp = fdopen (-1, "w");
+    if (fp != NULL)
+      {
+        fputc ('x', fp);
+        errno = 0;
+        ASSERT (fflush (fp) == EOF);
+        ASSERT (errno == EBADF);
+      }
+  }
+  {
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "w");
+    if (fp != NULL)
+      {
+        fputc ('x', fp);
+        errno = 0;
+        ASSERT (fflush (fp) == EOF);
+        ASSERT (errno == EBADF);
+      }
+  }
+
+  /* Clean up.  */
+  unlink ("test-fflush.txt");
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 881289cd790f21905e5eea3b2b9bf62b570d7312..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fflush2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4f5025a78966174fefa41de1c7963432558e4eb9
--- /dev/null
@@ -0,0 +1,102 @@
+/* Test of POSIX compatible fflush() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "binary-io.h"
+#include "macros.h"
+
+int
+main (int argc, char **argv)
+{
+  int c;
+
+  /* Avoid the well-known bugs of fflush() on streams in O_TEXT mode
+     on native Windows platforms.  */
+  set_binary_mode (0, O_BINARY);
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '1':
+        /* Check fflush after a backup ungetc() call.  This is case 1a in
+           terms of
+           <https://lists.gnu.org/r/bug-gnulib/2008-03/msg00131.html>,
+           according to the Austin Group's resolution on 2009-01-08.  */
+
+        c = fgetc (stdin);
+        ASSERT (c == '#');
+
+        c = fgetc (stdin);
+        ASSERT (c == '!');
+
+        /* Here the file-position indicator must be 2.  */
+
+        c = ungetc ('!', stdin);
+        ASSERT (c == '!');
+
+        fflush (stdin);
+
+        /* Here the file-position indicator must be 1.  */
+
+        c = fgetc (stdin);
+        ASSERT (c == '!');
+
+        c = fgetc (stdin);
+        ASSERT (c == '/');
+
+        return 0;
+
+      case '2':
+        /* Check fflush after a non-backup ungetc() call.  This is case 2a in
+           terms of
+           <https://lists.gnu.org/r/bug-gnulib/2008-03/msg00131.html>,
+           according to the Austin Group's resolution on 2009-01-08.  */
+        /* Check that fflush after a non-backup ungetc() call discards the
+           ungetc buffer.  This is mandated by POSIX
+           <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html>:
+             "...any characters pushed back onto the stream by ungetc()
+              or ungetwc() that have not subsequently been read from the
+              stream shall be discarded..."  */
+
+        c = fgetc (stdin);
+        ASSERT (c == '#');
+
+        c = fgetc (stdin);
+        ASSERT (c == '!');
+
+        /* Here the file-position indicator must be 2.  */
+
+        c = ungetc ('@', stdin);
+        ASSERT (c == '@');
+
+        fflush (stdin);
+
+        /* Here the file-position indicator must be 1.  */
+
+        c = fgetc (stdin);
+        ASSERT (c == '!');
+
+        c = fgetc (stdin);
+        ASSERT (c == '/');
+
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 76928ede7e90868d38efa06b72b545cd7860d01b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fflush2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..0d8859de2ede1d8418c7b1ab36a155d3629f833b
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Execute the test only with seekable input stream.
+# The behaviour of fflush() on a non-seekable input stream is undefined.
+${CHECKER} ./test-fflush2${EXEEXT} 1 < "$srcdir/test-fflush2.sh" || exit $?
+${CHECKER} ./test-fflush2${EXEEXT} 2 < "$srcdir/test-fflush2.sh" || exit $?
+#cat "$srcdir/test-fflush2.sh" | ${CHECKER} ./test-fflush2${EXEEXT} || exit $?
+
+exit 0
deleted file mode 120000 (symlink)
index dd66cfe049e1676eba1951f2c38c5a57c3cf1fb1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fgetc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0d617980783fb5c300fd2d51e208752258403c63
--- /dev/null
@@ -0,0 +1,101 @@
+/* Test of fgetc() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fgetc, int, (FILE *));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#include "macros.h"
+
+int
+main ()
+{
+  const char *filename = "test-fgetc.txt";
+
+  /* We don't have an fgetc() function that installs an invalid parameter
+     handler so far.  So install that handler here, explicitly.  */
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
+    && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
+  gl_msvc_inval_ensure_handler ();
+#endif
+
+  /* Prepare a file.  */
+  {
+    const char text[] = "hello world";
+    int fd = open (filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
+    ASSERT (fd >= 0);
+    ASSERT (write (fd, text, sizeof (text)) == sizeof (text));
+    ASSERT (close (fd) == 0);
+  }
+
+  /* Test that fgetc() sets errno if someone else closes the stream
+     fd behind the back of stdio.  */
+  #if !defined __ANDROID__ /* fdsan */
+  {
+    FILE *fp = fopen (filename, "r");
+    ASSERT (fp != NULL);
+    ASSERT (close (fileno (fp)) == 0);
+    errno = 0;
+    ASSERT (fgetc (fp) == EOF);
+    ASSERT (errno == EBADF);
+    ASSERT (ferror (fp));
+    fclose (fp);
+  }
+  #endif
+
+  /* Test that fgetc() sets errno if the stream was constructed with
+     an invalid file descriptor.  */
+  {
+    FILE *fp = fdopen (-1, "r");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (fgetc (fp) == EOF);
+        ASSERT (errno == EBADF);
+        ASSERT (ferror (fp));
+        fclose (fp);
+      }
+  }
+  {
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "r");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (fgetc (fp) == EOF);
+        ASSERT (errno == EBADF);
+        ASSERT (ferror (fp));
+        fclose (fp);
+      }
+  }
+
+  /* Clean up.  */
+  unlink (filename);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index ce6750b8e3d53b133e12e72d8b7fe9fc330883ba..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-file-has-acl-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..c789d22d4c9b682a984bbd9a4aa7f574ea8ae9aa
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Test file-has-acl on the file system of /var/tmp, which usually is a local
+# file system.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+if test -d /var/tmp; then
+  TMPDIR=/var/tmp
+else
+  TMPDIR=/tmp
+fi
+test -d $TMPDIR || Exit 77
+export TMPDIR
+
+$BOURNE_SHELL "${srcdir}/test-file-has-acl.sh"
+
+Exit $?
deleted file mode 120000 (symlink)
index d5de014da35261921623eef14661407c9f933bb2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-file-has-acl-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..41561d6cf3b828fe3d1175b5ffcd553f1e750fe9
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Test file-has-acl on the file system of the build directory, which may be
+# a local file system or NFS mounted.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+TMPDIR=`pwd`
+export TMPDIR
+
+$BOURNE_SHELL "${srcdir}/test-file-has-acl.sh"
+
+Exit $?
deleted file mode 120000 (symlink)
index d31e82c96137ac01e0d495fb33a1e35801cb14d3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-file-has-acl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..444e167c3c62c769c4cbf51d157a7898dba9bb54
--- /dev/null
@@ -0,0 +1,74 @@
+/* Test for presence of ACL.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  const char *file;
+  struct stat statbuf;
+
+  ASSERT (argc == 2);
+
+  file = argv[1];
+
+  if (stat (file, &statbuf) < 0)
+    {
+      fprintf (stderr, "could not access file \"%s\"\n", file);
+      exit (EXIT_FAILURE);
+    }
+
+  /* Check against possible infinite loop in file_has_acl.  */
+#if HAVE_DECL_ALARM
+  /* Declare failure if test takes too long, by using default abort
+     caused by SIGALRM.  */
+  {
+    int alarm_value = 5;
+    signal (SIGALRM, SIG_DFL);
+    alarm (alarm_value);
+  }
+#endif
+
+#if USE_ACL
+  {
+    int ret = file_has_acl (file, &statbuf);
+    if (ret < 0)
+      {
+        fprintf (stderr, "could not access the ACL of file \"%s\"\n", file);
+        exit (EXIT_FAILURE);
+      }
+    printf ("%s\n", ret ? "yes" : "no");
+  }
+#else
+  printf ("no\n");
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8a3e95b1f8ca14e3a8a6435394ada615200d1714..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-file-has-acl.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..8703b02e8850240fb9861f066d43ab7df555504d
--- /dev/null
@@ -0,0 +1,389 @@
+#!/bin/sh
+
+# Show all commands when run with environment variable VERBOSE=yes.
+test -z "$VERBOSE" || set -x
+
+test "$USE_ACL" = 0 &&
+  {
+    echo "Skipping test: insufficient ACL support"
+    exit 77
+  }
+
+# func_tmpdir
+# creates a temporary directory.
+# Sets variable
+# - tmp             pathname of freshly created temporary directory
+func_tmpdir ()
+{
+  # Use the environment variable TMPDIR, falling back to /tmp. This allows
+  # users to specify a different temporary directory, for example, if their
+  # /tmp is filled up or too small.
+  : "${TMPDIR=/tmp}"
+  {
+    # Use the mktemp program if available. If not available, hide the error
+    # message.
+    tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
+    test -n "$tmp" && test -d "$tmp"
+  } ||
+  {
+    # Use a simple mkdir command. It is guaranteed to fail if the directory
+    # already exists.  $RANDOM is bash specific and expands to empty in shells
+    # other than bash, ksh and zsh.  Its use does not increase security;
+    # rather, it minimizes the probability of failure in a very cluttered /tmp
+    # directory.
+    tmp=$TMPDIR/gl$$-$RANDOM
+    (umask 077 && mkdir "$tmp")
+  } ||
+  {
+    echo "$0: cannot create a temporary directory in $TMPDIR" >&2
+    exit 1
+  }
+}
+
+func_tmpdir
+# builddir may already be set by the script that invokes this one.
+case "$builddir" in
+  '') builddir=`pwd` ;;
+  /* | ?:*) ;;
+  *) builddir=`pwd`/$builddir ;;
+esac
+cd "$builddir" ||
+  {
+    echo "$0: cannot determine build directory (unreadable parent dir?)" >&2
+    exit 1
+  }
+# Switch to a temporary directory, to increase the likelihood that ACLs are
+# supported on the current file system. (/tmp is usually locally mounted,
+# whereas the build dir is sometimes NFS-mounted.)
+( cd "$tmp"
+
+  # Prepare tmpfile0.
+  rm -f tmpfile[0-9] tmp.err
+  echo "Simple contents" > tmpfile0
+  chmod 600 tmpfile0
+
+  # Classification of the platform according to the programs available for
+  # manipulating ACLs.
+  # Possible values are:
+  #   linux, cygwin, freebsd, solaris, hpux, hpuxjfs, osf1, aix, macosx, irix, none.
+  # TODO: Support also native Windows platforms (mingw).
+  acl_flavor=none
+  if (getfacl tmpfile0 >/dev/null) 2>/dev/null; then
+    # Platforms with the getfacl and setfacl programs.
+    # Linux, FreeBSD, Solaris, Cygwin.
+    if (setfacl --help >/dev/null) 2>/dev/null; then
+      # Linux, Cygwin.
+      if (LC_ALL=C setfacl --help | grep ' --test' >/dev/null) 2>/dev/null; then
+        # Linux.
+        acl_flavor=linux
+      else
+        acl_flavor=cygwin
+      fi
+    else
+      # FreeBSD, Solaris.
+      if (LC_ALL=C setfacl 2>&1 | grep '\-x entries' >/dev/null) 2>/dev/null; then
+        # FreeBSD.
+        acl_flavor=freebsd
+      else
+        # Solaris.
+        acl_flavor=solaris
+      fi
+    fi
+  else
+    if (lsacl / >/dev/null) 2>/dev/null; then
+      # Platforms with the lsacl and chacl programs.
+      # HP-UX, sometimes also IRIX.
+      if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
+        # HP-UX 11.11 or newer.
+        acl_flavor=hpuxjfs
+      else
+        # HP-UX 11.00.
+        acl_flavor=hpux
+      fi
+    else
+      if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
+        # Tru64, NonStop Kernel.
+        if (getacl -m tmpfile0 >/dev/null) 2>/dev/null; then
+          # Tru64.
+          acl_flavor=osf1
+        else
+          # NonStop Kernel.
+          acl_flavor=nsk
+        fi
+      else
+        if (aclget tmpfile0 >/dev/null) 2>/dev/null; then
+          # AIX.
+          acl_flavor=aix
+        else
+          if (fsaclctl -v >/dev/null) 2>/dev/null; then
+            # Mac OS X.
+            acl_flavor=macosx
+          else
+            if test -f /sbin/chacl; then
+              # IRIX.
+              acl_flavor=irix
+            fi
+          fi
+        fi
+      fi
+    fi
+  fi
+
+  # func_test_file_has_acl file expected
+  # tests the result of the file_has_acl function on file, and checks that it
+  # matches the expected value.
+  func_test_file_has_acl ()
+  {
+    res=`${CHECKER} "$builddir"/test-file-has-acl${EXEEXT} "$1"`
+    test "$res" = "$2" || {
+      echo "file_has_acl(\"$1\") returned $res, expected $2" 1>&2
+      exit 1
+    }
+  }
+
+  # func_test_has_acl file expected
+  # tests the result of the file_has_acl function on file, and checks that it
+  # matches the expected value, also taking into account the system's 'ls'
+  # program.
+  case $acl_flavor in
+    freebsd | solaris | hpux | macosx)
+      case $acl_flavor in
+        freebsd | solaris | hpux) acl_ls_option="-ld" ;;
+        macosx)                   acl_ls_option="-lde" ;;
+      esac
+      func_test_has_acl ()
+      {
+        func_test_file_has_acl "$1" "$2"
+        case `/bin/ls $acl_ls_option "$1" | sed 1q` in
+          ??????????+*)
+            test "$2" = yes || {
+              echo "/bin/ls $acl_ls_option $1 shows an ACL, but expected $2" 1>&2
+              exit 1
+            }
+            ;;
+          ??????????" "*)
+            test "$2" = no || {
+              echo "/bin/ls $acl_ls_option $1 shows no ACL, but expected $2" 1>&2
+              exit 1
+            }
+            ;;
+        esac
+      }
+      ;;
+    irix)
+      func_test_has_acl ()
+      {
+        func_test_file_has_acl "$1" "$2"
+        case `/bin/ls -ldD "$1" | sed 1q` in
+          *" []")
+            test "$2" = no || {
+              echo "/bin/ls -ldD $1 shows no ACL, but expected $2" 1>&2
+              exit 1
+            }
+            ;;
+          *)
+            test "$2" = yes || {
+              echo "/bin/ls -ldD $1 shows an ACL, but expected $2" 1>&2
+              exit 1
+            }
+            ;;
+        esac
+      }
+      ;;
+    *)
+      func_test_has_acl ()
+      {
+        func_test_file_has_acl "$1" "$2"
+      }
+      ;;
+  esac
+
+  func_test_has_acl tmpfile0 no
+
+  mkdir tmpdir0
+  func_test_has_acl tmpdir0 no
+
+  if test $acl_flavor != none; then
+    # A POSIX compliant 'id' program.
+    if test -f /usr/xpg4/bin/id; then
+      ID=/usr/xpg4/bin/id
+    else
+      ID=id
+    fi
+    # Use a user and group id different from the current one, to avoid
+    # redundant/ambiguous ACLs.
+    myuid=`$ID -u`
+    mygid=`$ID -g`
+    auid=1
+    if test "$auid" = "$myuid"; then auid=2; fi
+    agid=1
+    if test "$agid" = "$mygid"; then agid=2; fi
+
+    case $acl_flavor in
+      linux | freebsd | solaris)
+
+        # Set an ACL for a user.
+        if setfacl -m user:$auid:1 tmpfile0; then
+
+          func_test_has_acl tmpfile0 yes
+
+          # Remove the ACL for the user.
+          case $acl_flavor in
+            linux)   setfacl -x user:$auid tmpfile0 ;;
+            freebsd) setfacl -x user:$auid:1 tmpfile0 ;;
+            *)       setfacl -d user:$auid:1 tmpfile0 ;;
+          esac
+
+          # On Linux and FreeBSD, the ACL for the mask is implicitly added.
+          # On Solaris, it is always there.
+          case $acl_flavor in
+            linux | freebsd) func_test_has_acl tmpfile0 yes ;;
+            *)               func_test_has_acl tmpfile0 no ;;
+          esac
+
+          # Remove the ACL for the mask, if it was implicitly added.
+          case $acl_flavor in
+            linux | freebsd) setfacl -x mask: tmpfile0 ;;
+            *)               setfacl -d mask: tmpfile0 ;;
+          esac
+
+          func_test_has_acl tmpfile0 no
+
+        fi
+        ;;
+
+      cygwin)
+
+        # Set an ACL for a group.
+        if setfacl -m group:0:1 tmpfile0; then
+
+          func_test_has_acl tmpfile0 yes
+
+          # Remove the ACL for the group.
+          setfacl -d group:0 tmpfile0
+
+          func_test_has_acl tmpfile0 no
+
+        fi
+        ;;
+
+      hpux | hpuxjfs)
+
+        # Set an ACL for a user.
+        orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+        if chacl -r "${orig}($auid.%,--x)" tmpfile0; then
+
+          func_test_has_acl tmpfile0 yes
+
+          # Remove the ACL for the user.
+          chacl -d "($auid.%,--x)" tmpfile0
+
+          func_test_has_acl tmpfile0 no
+
+        else
+          if test $acl_flavor = hpuxjfs; then
+
+            # Set an ACL for a user.
+            setacl -m user:$auid:1 tmpfile0
+
+            func_test_has_acl tmpfile0 yes
+
+            # Remove the ACL for the user.
+            setacl -d user:$auid tmpfile0
+
+            func_test_has_acl tmpfile0 no
+
+          fi
+        fi
+        ;;
+
+      osf1)
+
+        # Set an ACL for a user.
+        setacl -u user:$auid:1 tmpfile0 2> tmp.err
+        cat tmp.err 1>&2
+        if grep 'Error:' tmp.err > /dev/null \
+           || grep 'Operation not supported' tmp.err > /dev/null; then
+          :
+        else
+
+          func_test_has_acl tmpfile0 yes
+
+          # Remove the ACL for the user.
+          setacl -x user:$auid:1 tmpfile0
+
+          func_test_has_acl tmpfile0 no
+
+        fi
+        ;;
+
+      nsk)
+
+        # Set an ACL for a user.
+        setacl -m user:$auid:1 tmpfile0
+
+        func_test_has_acl tmpfile0 yes
+
+        # Remove the ACL for the user.
+        setacl -d user:$auid tmpfile0
+
+        func_test_has_acl tmpfile0 no
+
+        ;;
+
+      aix)
+
+        # Set an ACL for a user.
+        { aclget tmpfile0 | sed -e 's/disabled$/enabled/'; echo "        permit --x u:$auid"; } | aclput tmpfile0
+        if aclget tmpfile0 | grep enabled > /dev/null; then
+
+          func_test_has_acl tmpfile0 yes
+
+          # Remove the ACL for the user.
+          aclget tmpfile0 | grep -v ' u:[^ ]*$' | aclput tmpfile0
+
+          func_test_has_acl tmpfile0 no
+
+        fi
+        ;;
+
+      macosx)
+
+        # Set an ACL for a user.
+        /bin/chmod +a "user:daemon allow execute" tmpfile0
+
+        func_test_has_acl tmpfile0 yes
+
+        # Remove the ACL for the user.
+        /bin/chmod -a "user:daemon allow execute" tmpfile0
+
+        func_test_has_acl tmpfile0 no
+
+        ;;
+
+      irix)
+
+        # Set an ACL for a user.
+        /sbin/chacl user::rw-,group::---,other::---,user:$auid:--x tmpfile0 2> tmp.err
+        cat tmp.err 1>&2
+        if test -s tmp.err; then :; else
+
+          func_test_has_acl tmpfile0 yes
+
+          # Remove the ACL for the user.
+          /sbin/chacl user::rw-,group::---,other::--- tmpfile0
+
+          func_test_has_acl tmpfile0 no
+
+        fi
+        ;;
+
+    esac
+  fi
+
+  rm -f tmpfile[0-9] tmp.err
+  rm -rf tmpdir0
+) || exit 1
+
+rm -rf "$tmp"
+exit 0
deleted file mode 120000 (symlink)
index 97f2ce034deefd317f96c305f67288d100a59fbf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-filenamecat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fc00e88b185e807cfb16daf79f6c770b81830b6e
--- /dev/null
@@ -0,0 +1,86 @@
+/* Test of concatenation of two arbitrary file names.
+
+   Copyright (C) 1996-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "filenamecat.h"
+
+#include "idx.h"
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+int
+main (_GL_UNUSED int argc, char *argv[])
+{
+  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"}, /* This result could be shorter.  */
+      {"/", "/",  "/./"},  /* This result could be shorter.  */
+      {"a", "/",  "a/"},   /* this might deserve a diagnostic */
+      {"/a", "/", "/a/"},  /* this might deserve a diagnostic */
+      {"a", "//b",  "a//b"},
+      {"", "a", "a"},  /* this might deserve a diagnostic */
+    };
+  unsigned int 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);
+      idx_t prefixlen = base_in_result - res;
+      size_t t0len = strlen (t[0]);
+      size_t reslen = strlen (res);
+      if (strcmp (res, t[2]) != 0)
+        {
+          fprintf (stderr, "test #%u: got %s, expected %s\n", i, res, t[2]);
+          fail = true;
+        }
+      if (strcmp (t[1], base_in_result) != 0)
+        {
+          fprintf (stderr, "test #%u: base %s != base_in_result %s\n",
+                   i, t[1], base_in_result);
+          fail = true;
+        }
+      if (! (0 <= prefixlen && prefixlen <= reslen))
+        {
+          fprintf (stderr, "test #%u: base_in_result is not in result\n", i);
+          fail = true;
+        }
+      if (reslen < t0len || memcmp (res, t[0], t0len) != 0)
+        {
+          fprintf (stderr, "test #%u: %s is not a prefix of %s\n",
+                   i, t[0], res);
+          fail = true;
+        }
+      free (res);
+    }
+  exit (fail ? EXIT_FAILURE : EXIT_SUCCESS);
+}
deleted file mode 120000 (symlink)
index fa3f9e02339b58f79a653b80f891c6fc2c3b8675..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-filevercmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..613ebdff517db28ecefc6d421a1e8a76a6f3d701
--- /dev/null
@@ -0,0 +1,206 @@
+/* Test of filevercmp() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "filevercmp.h"
+
+#include <stddef.h>
+#include <string.h>
+
+#include "macros.h"
+
+/* set of well sorted examples */
+static const char *const examples[] =
+{
+  "",
+  ".",
+  "..",
+  ".0",
+  ".9",
+  ".A",
+  ".Z",
+  ".a~",
+  ".a",
+  ".b~",
+  ".b",
+  ".z",
+  ".zz~",
+  ".zz",
+  ".zz.~1~",
+  ".zz.0",
+  ".\1",
+  ".\1.txt",
+  ".\1x",
+  ".\1x\1",
+  ".\1.0",
+  "0",
+  "9",
+  "A",
+  "Z",
+  "a~",
+  "a",
+  "a.b~",
+  "a.b",
+  "a.bc~",
+  "a.bc",
+  "a+",
+  "a.",
+  "a..a",
+  "a.+",
+  "b~",
+  "b",
+  "gcc-c++-10.fc9.tar.gz",
+  "gcc-c++-10.fc9.tar.gz.~1~",
+  "gcc-c++-10.fc9.tar.gz.~2~",
+  "gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2",
+  "gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2.~1~",
+  "glibc-2-0.1.beta1.fc10.rpm",
+  "glibc-common-5-0.2.beta2.fc9.ebuild",
+  "glibc-common-5-0.2b.deb",
+  "glibc-common-11b.ebuild",
+  "glibc-common-11-0.6rc2.ebuild",
+  "libstdc++-0.5.8.11-0.7rc2.fc10.tar.gz",
+  "libstdc++-4a.fc8.tar.gz",
+  "libstdc++-4.10.4.20040204svn.rpm",
+  "libstdc++-devel-3.fc8.ebuild",
+  "libstdc++-devel-3a.fc9.tar.gz",
+  "libstdc++-devel-8.fc8.deb",
+  "libstdc++-devel-8.6.2-0.4b.fc8",
+  "nss_ldap-1-0.2b.fc9.tar.bz2",
+  "nss_ldap-1-0.6rc2.fc8.tar.gz",
+  "nss_ldap-1.0-0.1a.tar.gz",
+  "nss_ldap-10beta1.fc8.tar.gz",
+  "nss_ldap-10.11.8.6.20040204cvs.fc10.ebuild",
+  "z",
+  "zz~",
+  "zz",
+  "zz.~1~",
+  "zz.0",
+  "zz.0.txt",
+  "\1",
+  "\1.txt",
+  "\1x",
+  "\1x\1",
+  "\1.0",
+  "#\1.b#",
+  "#.b#",
+  NULL
+};
+
+/* Sets of examples that should all sort equally.  Each set is
+   terminated by NULL.  */
+static char const *const equals[] =
+  {
+    "a",
+    "a0",
+    "a0000",
+    NULL,
+    "a\1c-27.txt",
+    "a\1c-027.txt",
+    "a\1c-00000000000000000000000000000000000000000000000000000027.txt",
+    NULL,
+    ".a\1c-27.txt",
+    ".a\1c-027.txt",
+    ".a\1c-00000000000000000000000000000000000000000000000000000027.txt",
+    NULL,
+    "a\1c-",
+    "a\1c-0",
+    "a\1c-00",
+    NULL,
+    ".a\1c-",
+    ".a\1c-0",
+    ".a\1c-00",
+    NULL,
+    "a\1c-0.txt",
+    "a\1c-00.txt",
+    NULL,
+    ".a\1c-1\1.txt",
+    ".a\1c-001\1.txt",
+    NULL,
+  };
+
+static int
+sign (int i)
+{
+  return i < 0 ? -1 : 0 < i;
+}
+
+/* Return filevercmp (A, B), checking that a similar result is gotten
+   after replacing all '\1's with '\0's and calling filenvercmp with
+   the embedded '\0's.  */
+static int
+test_filevercmp (char const *a, char const *b)
+{
+  int result = filevercmp (a, b);
+
+  char buffer[1000];
+
+  ptrdiff_t alen = strlen (a), blen = strlen (b);
+  ASSERT (alen + blen <= sizeof buffer);
+  memcpy (buffer, a, alen);
+  memcpy (buffer + alen, b, blen);
+  for (ptrdiff_t i = 0; i < alen + blen; i++)
+    if (buffer[i] == '\1')
+      buffer[i] = '\0';
+
+  int nresult = filenvercmp (buffer, alen, buffer + alen, blen);
+  ASSERT (sign (nresult) == sign (result));
+
+  return result;
+}
+
+int
+main (void)
+{
+  const char *const *i;
+
+  /* Following tests taken from test-strverscmp.c */
+  ASSERT (filevercmp ("", "") == 0);
+  ASSERT (filevercmp ("a", "a") == 0);
+  ASSERT (filevercmp ("a", "b") < 0);
+  ASSERT (filevercmp ("b", "a") > 0);
+  ASSERT (filevercmp ("00", "01") < 0);
+  ASSERT (filevercmp ("01", "010") < 0);
+  ASSERT (filevercmp ("9", "10") < 0);
+  ASSERT (filevercmp ("0a", "0") > 0);
+
+  /* compare each version string with each other - O(n^2) */
+  for (i = examples; *i; i++)
+    {
+      const char *const *j;
+      for (j = examples; *j; j++)
+        {
+          int result = test_filevercmp (*i, *j);
+          if (result < 0)
+            ASSERT (i < j);
+          else if (0 < result)
+            ASSERT (j < i);
+          else
+            ASSERT (i == j);
+        }
+    }
+
+  for (i = equals; i < equals + sizeof equals / sizeof *equals; i++)
+    for (; *i; i++)
+      for (char const *const *j = i; *j; j++)
+        {
+          ASSERT (test_filevercmp (*i, *j) == 0);
+          ASSERT (test_filevercmp (*j, *i) == 0);
+        }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 6f08bc52a1636709abc4307d0f99d0ae30b9685b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-float.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e9dc4609fd286420afe1de780528c65b7d12c59d
--- /dev/null
@@ -0,0 +1,392 @@
+/* Test of <float.h> substitute.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include <float.h>
+
+/* Check that FLT_RADIX is a constant expression.  */
+int a[] = { FLT_RADIX };
+
+/* ----------------------- Check macros for 'float' ----------------------- */
+
+/* Check that the FLT_* macros expand to constant expressions.  */
+int fb[] =
+  {
+    FLT_MANT_DIG, FLT_MIN_EXP, FLT_MAX_EXP,
+    FLT_DIG, FLT_MIN_10_EXP, FLT_MAX_10_EXP
+  };
+float fc[] = { FLT_EPSILON, FLT_MIN, FLT_MAX };
+
+/* ----------------------- Check macros for 'double' ----------------------- */
+
+/* Check that the DBL_* macros expand to constant expressions.  */
+int db[] =
+  {
+    DBL_MANT_DIG, DBL_MIN_EXP, DBL_MAX_EXP,
+    DBL_DIG, DBL_MIN_10_EXP, DBL_MAX_10_EXP
+  };
+double dc[] = { DBL_EPSILON, DBL_MIN, DBL_MAX };
+
+/* -------------------- Check macros for 'long double' -------------------- */
+
+/* Check that the LDBL_* macros expand to constant expressions.  */
+int lb[] =
+  {
+    LDBL_MANT_DIG, LDBL_MIN_EXP, LDBL_MAX_EXP,
+    LDBL_DIG, LDBL_MIN_10_EXP, LDBL_MAX_10_EXP
+  };
+long double lc1 = LDBL_EPSILON;
+long double lc2 = LDBL_MIN;
+#if 0 /* LDBL_MAX is not a constant expression on some platforms.  */
+long double lc3 = LDBL_MAX;
+#endif
+
+/* ------------------------------------------------------------------------- */
+
+#include "fpucw.h"
+#include "macros.h"
+
+#if FLT_RADIX == 2
+
+/* Return 2^n.  */
+static float
+pow2f (int n)
+{
+  int k = n;
+  volatile float x = 1;
+  volatile float y = 2;
+  /* Invariant: 2^n == x * y^k.  */
+  if (k < 0)
+    {
+      y = 0.5f;
+      k = - k;
+    }
+  while (k > 0)
+    {
+      if (k != 2 * (k / 2))
+        {
+          x = x * y;
+          k = k - 1;
+        }
+      if (k == 0)
+        break;
+      y = y * y;
+      k = k / 2;
+    }
+  /* Now k == 0, hence x == 2^n.  */
+  return x;
+}
+
+/* Return 2^n.  */
+static double
+pow2d (int n)
+{
+  int k = n;
+  volatile double x = 1;
+  volatile double y = 2;
+  /* Invariant: 2^n == x * y^k.  */
+  if (k < 0)
+    {
+      y = 0.5;
+      k = - k;
+    }
+  while (k > 0)
+    {
+      if (k != 2 * (k / 2))
+        {
+          x = x * y;
+          k = k - 1;
+        }
+      if (k == 0)
+        break;
+      y = y * y;
+      k = k / 2;
+    }
+  /* Now k == 0, hence x == 2^n.  */
+  return x;
+}
+
+/* Return 2^n.  */
+static long double
+pow2l (int n)
+{
+  int k = n;
+  volatile long double x = 1;
+  volatile long double y = 2;
+  /* Invariant: 2^n == x * y^k.  */
+  if (k < 0)
+    {
+      y = 0.5L;
+      k = - k;
+    }
+  while (k > 0)
+    {
+      if (k != 2 * (k / 2))
+        {
+          x = x * y;
+          k = k - 1;
+        }
+      if (k == 0)
+        break;
+      y = y * y;
+      k = k / 2;
+    }
+  /* Now k == 0, hence x == 2^n.  */
+  return x;
+}
+
+/* ----------------------- Check macros for 'float' ----------------------- */
+
+static void
+test_float (void)
+{
+  /* Check that the value of FLT_MIN_EXP is well parenthesized.  */
+  ASSERT ((FLT_MIN_EXP % 101111) == (FLT_MIN_EXP) % 101111);
+
+  /* Check that the value of DBL_MIN_10_EXP is well parenthesized.  */
+  ASSERT ((FLT_MIN_10_EXP % 101111) == (FLT_MIN_10_EXP) % 101111);
+
+  /* Check that 'float' is as specified in IEEE 754.  */
+  ASSERT (FLT_MANT_DIG == 24);
+  ASSERT (FLT_MIN_EXP == -125);
+  ASSERT (FLT_MAX_EXP == 128);
+
+  /* Check the value of FLT_MIN_10_EXP.  */
+  ASSERT (FLT_MIN_10_EXP == - (int) (- (FLT_MIN_EXP - 1) * 0.30103));
+
+  /* Check the value of FLT_DIG.  */
+  ASSERT (FLT_DIG == (int) ((FLT_MANT_DIG - 1) * 0.30103));
+
+  /* Check the value of FLT_MIN_10_EXP.  */
+  ASSERT (FLT_MIN_10_EXP == - (int) (- (FLT_MIN_EXP - 1) * 0.30103));
+
+  /* Check the value of FLT_MAX_10_EXP.  */
+  ASSERT (FLT_MAX_10_EXP == (int) (FLT_MAX_EXP * 0.30103));
+
+  /* Check the value of FLT_MAX.  */
+  {
+    volatile float m = FLT_MAX;
+    int n;
+
+    ASSERT (m + m > m);
+    for (n = 0; n <= 2 * FLT_MANT_DIG; n++)
+      {
+        volatile float pow2_n = pow2f (n); /* 2^n */
+        volatile float x = m + (m / pow2_n);
+        if (x > m)
+          ASSERT (x + x == x);
+        else
+          ASSERT (!(x + x == x));
+      }
+  }
+
+  /* Check the value of FLT_MIN.  */
+  {
+    volatile float m = FLT_MIN;
+    volatile float x = pow2f (FLT_MIN_EXP - 1);
+    ASSERT (m == x);
+  }
+
+  /* Check the value of FLT_EPSILON.  */
+  {
+    volatile float e = FLT_EPSILON;
+    volatile float me;
+    int n;
+
+    me = 1.0f + e;
+    ASSERT (me > 1.0f);
+    ASSERT (me - 1.0f == e);
+    for (n = 0; n <= 2 * FLT_MANT_DIG; n++)
+      {
+        volatile float half_n = pow2f (- n); /* 2^-n */
+        volatile float x = me - half_n;
+        if (x < me)
+          ASSERT (x <= 1.0f);
+      }
+  }
+}
+
+/* ----------------------- Check macros for 'double' ----------------------- */
+
+static void
+test_double (void)
+{
+  /* Check that the value of DBL_MIN_EXP is well parenthesized.  */
+  ASSERT ((DBL_MIN_EXP % 101111) == (DBL_MIN_EXP) % 101111);
+
+  /* Check that the value of DBL_MIN_10_EXP is well parenthesized.  */
+  ASSERT ((DBL_MIN_10_EXP % 101111) == (DBL_MIN_10_EXP) % 101111);
+
+  /* Check that 'double' is as specified in IEEE 754.  */
+  ASSERT (DBL_MANT_DIG == 53);
+  ASSERT (DBL_MIN_EXP == -1021);
+  ASSERT (DBL_MAX_EXP == 1024);
+
+  /* Check the value of DBL_MIN_10_EXP.  */
+  ASSERT (DBL_MIN_10_EXP == - (int) (- (DBL_MIN_EXP - 1) * 0.30103));
+
+  /* Check the value of DBL_DIG.  */
+  ASSERT (DBL_DIG == (int) ((DBL_MANT_DIG - 1) * 0.30103));
+
+  /* Check the value of DBL_MIN_10_EXP.  */
+  ASSERT (DBL_MIN_10_EXP == - (int) (- (DBL_MIN_EXP - 1) * 0.30103));
+
+  /* Check the value of DBL_MAX_10_EXP.  */
+  ASSERT (DBL_MAX_10_EXP == (int) (DBL_MAX_EXP * 0.30103));
+
+  /* Check the value of DBL_MAX.  */
+  {
+    volatile double m = DBL_MAX;
+    int n;
+
+    ASSERT (m + m > m);
+    for (n = 0; n <= 2 * DBL_MANT_DIG; n++)
+      {
+        volatile double pow2_n = pow2d (n); /* 2^n */
+        volatile double x = m + (m / pow2_n);
+        if (x > m)
+          ASSERT (x + x == x);
+        else
+          ASSERT (!(x + x == x));
+      }
+  }
+
+  /* Check the value of DBL_MIN.  */
+  {
+    volatile double m = DBL_MIN;
+    volatile double x = pow2d (DBL_MIN_EXP - 1);
+    ASSERT (m == x);
+  }
+
+  /* Check the value of DBL_EPSILON.  */
+  {
+    volatile double e = DBL_EPSILON;
+    volatile double me;
+    int n;
+
+    me = 1.0 + e;
+    ASSERT (me > 1.0);
+    ASSERT (me - 1.0 == e);
+    for (n = 0; n <= 2 * DBL_MANT_DIG; n++)
+      {
+        volatile double half_n = pow2d (- n); /* 2^-n */
+        volatile double x = me - half_n;
+        if (x < me)
+          ASSERT (x <= 1.0);
+      }
+  }
+}
+
+/* -------------------- Check macros for 'long double' -------------------- */
+
+static void
+test_long_double (void)
+{
+  /* Check that the value of LDBL_MIN_EXP is well parenthesized.  */
+  ASSERT ((LDBL_MIN_EXP % 101111) == (LDBL_MIN_EXP) % 101111);
+
+  /* Check that the value of LDBL_MIN_10_EXP is well parenthesized.  */
+  ASSERT ((LDBL_MIN_10_EXP % 101111) == (LDBL_MIN_10_EXP) % 101111);
+
+  /* Check that 'long double' is at least as wide as 'double'.  */
+  ASSERT (LDBL_MANT_DIG >= DBL_MANT_DIG);
+  ASSERT (LDBL_MIN_EXP - LDBL_MANT_DIG <= DBL_MIN_EXP - DBL_MANT_DIG);
+  ASSERT (LDBL_MAX_EXP >= DBL_MAX_EXP);
+
+  /* Check the value of LDBL_DIG.  */
+  ASSERT (LDBL_DIG == (int)((LDBL_MANT_DIG - 1) * 0.30103));
+
+  /* Check the value of LDBL_MIN_10_EXP.  */
+  ASSERT (LDBL_MIN_10_EXP == - (int) (- (LDBL_MIN_EXP - 1) * 0.30103));
+
+  /* Check the value of LDBL_MAX_10_EXP.  */
+  ASSERT (LDBL_MAX_10_EXP == (int) (LDBL_MAX_EXP * 0.30103));
+
+  /* Check the value of LDBL_MAX.  */
+  {
+    volatile long double m = LDBL_MAX;
+    int n;
+
+    ASSERT (m + m > m);
+    for (n = 0; n <= 2 * LDBL_MANT_DIG; n++)
+      {
+        volatile long double pow2_n = pow2l (n); /* 2^n */
+        volatile long double x = m + (m / pow2_n);
+        if (x > m)
+          ASSERT (x + x == x);
+        else
+          ASSERT (!(x + x == x));
+      }
+  }
+
+  /* Check the value of LDBL_MIN.  */
+  {
+    volatile long double m = LDBL_MIN;
+    volatile long double x = pow2l (LDBL_MIN_EXP - 1);
+    ASSERT (m == x);
+  }
+
+  /* Check the value of LDBL_EPSILON.  */
+  {
+    volatile long double e = LDBL_EPSILON;
+    volatile long double me;
+    int n;
+
+    me = 1.0L + e;
+    ASSERT (me > 1.0L);
+    ASSERT (me - 1.0L == e);
+    for (n = 0; n <= 2 * LDBL_MANT_DIG; n++)
+      {
+        volatile long double half_n = pow2l (- n); /* 2^-n */
+        volatile long double x = me - half_n;
+        if (x < me)
+          ASSERT (x <= 1.0L);
+      }
+  }
+}
+
+int
+main ()
+{
+  test_float ();
+  test_double ();
+
+  {
+    DECL_LONG_DOUBLE_ROUNDING
+
+    BEGIN_LONG_DOUBLE_ROUNDING ();
+
+    test_long_double ();
+
+    END_LONG_DOUBLE_ROUNDING ();
+  }
+
+  return 0;
+}
+
+#else
+
+int
+main ()
+{
+  fprintf (stderr, "Skipping test: FLT_RADIX is not 2.\n");
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 881f2f8b983d9aa7e3d638c619e7861fc70fb474..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7ecc27063aba400273f545abe68ec99719d7b80d
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C \
+${CHECKER} ./test-fnmatch${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-fnmatch${EXEEXT} 1 || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index 73bf313e2658b7e12fe2187a72623408210307ea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..c7e17664b6d6e3b1bfb8ffaa6e65231ee623d2b8
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-fnmatch${EXEEXT} 2
deleted file mode 120000 (symlink)
index 02a30f59fcd733e2b7fa7110f9129e2ed464fed1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7ad5386c8d4b3ed53394b7f4459b1db6a3ea53d9
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-fnmatch${EXEEXT} 3
deleted file mode 120000 (symlink)
index 33c5887d7ae1603a9d418911c7f91a3a9e4c60f5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..04a86adcac114027d6ecf3d7ddb12d899f9b2bfc
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional japanese locale is installed"
+  else
+    echo "Skipping test: no traditional japanese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_JA \
+${CHECKER} ./test-fnmatch${EXEEXT} 4
deleted file mode 120000 (symlink)
index 81e6aaeeca713075f73b571f4270e720d99222c6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..8ba3bf9ece13550c21cd899581359f9a3527c1fc
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no transitional chinese locale is installed"
+  else
+    echo "Skipping test: no transitional chinese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-fnmatch${EXEEXT} 5
deleted file mode 120000 (symlink)
index 8cb524fb16a3012b0503c4969a6b93320c990c00..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-h.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9084cb26867151f57dd1c7e7338f133c5c792661
--- /dev/null
@@ -0,0 +1,31 @@
+/* Test of <fnmatch.h> substitute.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2018.  */
+
+#include <config.h>
+
+#include <fnmatch.h>
+
+/* Check that the various FNM_* macros are defined.  */
+int ret = FNM_NOMATCH;
+int options[] = { FNM_PATHNAME, FNM_PERIOD, FNM_NOESCAPE };
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index a7384460c9bb3b6081ec271bc41341aa8b542633..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-w32-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..6efe31fe9c0f1526dd169fd3ae42b61fe819a4bf
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1252 locale.
+${CHECKER} ./test-fnmatch-w32${EXEEXT} French_France 1252
deleted file mode 120000 (symlink)
index a492707c6d4857cd452473c8b25079c8bdd0c49e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-w32-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..aacf62a3f71b71323bef92f4d871566c5ead9aca
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1256 locale.
+${CHECKER} ./test-fnmatch-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
deleted file mode 120000 (symlink)
index fd8674cfaf82620c9aba22976ebc4ff555647447..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-w32-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..15f26faa9aac0496ecee67eedf8d27ab9f850f16
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test some UTF-8 locales.
+${CHECKER} ./test-fnmatch-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
deleted file mode 120000 (symlink)
index ea6460d040aca1d598ea101ae92378746850361d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-w32-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..56c8ef1ae6b059d34df8c41eb17c7af5f058595c
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP932 locale.
+${CHECKER} ./test-fnmatch-w32${EXEEXT} Japanese_Japan 932
deleted file mode 120000 (symlink)
index b6d0b7dacfeb8130babc4abeefe2452a69467b2d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-w32-6.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..e3c518115d48ff692c61cf7414c08e3050091ab3
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP950 locale.
+${CHECKER} ./test-fnmatch-w32${EXEEXT} Chinese_Taiwan 950
deleted file mode 120000 (symlink)
index f17b37cb769fd6d9951187ef163c522b51813f7a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-w32-7.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..0c2a048db27105c7234a9e1fcce6587f7c713e17
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP936 locale.
+${CHECKER} ./test-fnmatch-w32${EXEEXT} Chinese_China 936
deleted file mode 120000 (symlink)
index d3b9eca2114274ade84bd0be8f511e2d7e41ce44..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-w32-8.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..af024428e66f3476734c53484e698b714ff87533
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a GB18030 locale.
+${CHECKER} ./test-fnmatch-w32${EXEEXT} Chinese_China 54936
deleted file mode 120000 (symlink)
index 182bd5a115765f3fa6a20fa1cd955511875590a3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch-w32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0ee8a0860f35ed4498071600f5d4fef912326ee9
--- /dev/null
@@ -0,0 +1,411 @@
+/* Test of fnmatch string matching function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <fnmatch.h>
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "localcharset.h"
+#include "macros.h"
+
+#if defined _WIN32 && !defined __CYGWIN__
+
+static int
+test_one_locale (const char *name, int codepage)
+{
+# if 1
+  /* Portable code to set the locale.  */
+  {
+    char name_with_codepage[1024];
+
+    sprintf (name_with_codepage, "%s.%d", name, codepage);
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name_with_codepage) == NULL)
+      return 77;
+  }
+# else
+  /* Hacky way to set a locale.codepage combination that setlocale() refuses
+     to set.  */
+  {
+    /* Codepage of the current locale, set with setlocale().
+       Not necessarily the same as GetACP().  */
+    extern __declspec(dllimport) unsigned int __lc_codepage;
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name) == NULL)
+      return 77;
+
+    /* Clobber the codepage and MB_CUR_MAX, both set by setlocale().  */
+    __lc_codepage = codepage;
+    switch (codepage)
+      {
+      case 1252:
+      case 1256:
+        MB_CUR_MAX = 1;
+        break;
+      case 932:
+      case 950:
+      case 936:
+        MB_CUR_MAX = 2;
+        break;
+      case 54936:
+      case 65001:
+        MB_CUR_MAX = 4;
+        break;
+      }
+
+    /* Test whether the codepage is really available.  */
+    mbstate_t state;
+    wchar_t wc;
+    memset (&state, '\0', sizeof (mbstate_t));
+    if (mbrtowc (&wc, " ", 1, &state) == (size_t)(-1))
+      return 77;
+  }
+# endif
+
+  switch (codepage)
+    {
+    case 1252:
+      /* Locale encoding is CP1252, an extension of ISO-8859-1.  */
+
+      ASSERT (fnmatch ("x?y", "x\374y", 0) == 0); /* "xüy" */
+      ASSERT (fnmatch ("x?y", "x\337y", 0) == 0); /* "xßy" */
+      /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+      ASSERT (fnmatch ("x[[:alnum:]]y", "x\330y", 0) == 0);
+      /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+      ASSERT (fnmatch ("x[[:alpha:]]y", "x\330y", 0) == 0);
+      /* U+00B8 CEDILLA */
+      ASSERT (fnmatch ("x[[:graph:]]y", "x\270y", 0) == 0);
+      /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\377y", 0) == 0);
+      /* U+00B8 CEDILLA */
+      ASSERT (fnmatch ("x[[:print:]]y", "x\270y", 0) == 0);
+      /* U+00BF INVERTED QUESTION MARK */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\277y", 0) == 0);
+      /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\311y", 0) == 0);
+      /* U+00D7 MULTIPLICATION SIGN */
+      ASSERT (fnmatch ("x[[:alnum:]]y", "x\327y", 0) == FNM_NOMATCH);
+      /* U+00D7 MULTIPLICATION SIGN */
+      ASSERT (fnmatch ("x[[:alpha:]]y", "x\327y", 0) == FNM_NOMATCH);
+      /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+      ASSERT (fnmatch ("x[[:blank:]]y", "x\330y", 0) == FNM_NOMATCH);
+      /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+      ASSERT (fnmatch ("x[[:cntrl:]]y", "x\330y", 0) == FNM_NOMATCH);
+      /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+      ASSERT (fnmatch ("x[[:digit:]]y", "x\330y", 0) == FNM_NOMATCH);
+      /* U+00B2 SUPERSCRIPT TWO */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\262y", 0) == FNM_NOMATCH);
+      /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\330y", 0) == FNM_NOMATCH);
+      /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+      ASSERT (fnmatch ("x[[:space:]]y", "x\330y", 0) == FNM_NOMATCH);
+      /* U+00B2 SUPERSCRIPT TWO */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\262y", 0) == FNM_NOMATCH);
+      /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+      ASSERT (fnmatch ("x[[:xdigit:]]y", "x\330y", 0) == FNM_NOMATCH);
+
+      #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+      /* "Höhle" */
+      ASSERT (fnmatch ("H\366hle", "H\326hLe", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("H\326hLe", "H\366hle", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("H\326hle", "H\366hLe", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("H\366hLe", "H\326hle", FNM_CASEFOLD) == 0);
+      #endif
+
+      return 0;
+
+    case 1256:
+      /* Locale encoding is CP1256, not the same as ISO-8859-6.  */
+
+      ASSERT (fnmatch ("x?y", "x\302y", 0) == 0); /* "xآy" */
+      ASSERT (fnmatch ("x?y", "x\341y", 0) == 0); /* "xلy" */
+      ASSERT (fnmatch ("x?y", "x\346y", 0) == 0); /* "xوy" */
+
+      return 0;
+
+    case 65001:
+      /* Locale encoding is CP65001 = UTF-8.  */
+      if (strcmp (locale_charset (), "UTF-8") != 0)
+        return 77;
+
+      ASSERT (fnmatch ("x?y", "x\303\274y", 0) == 0); /* "xüy" */
+      ASSERT (fnmatch ("x?y", "x\303\237y", 0) == 0); /* "xßy" */
+      ASSERT (fnmatch ("x?y", "x\360\237\230\213y", 0) == 0); /* "x😋y" */
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:alnum:]]y", "x\305\201y", 0) == 0);
+      /* U+10330 GOTHIC LETTER AHSA */
+      ASSERT (fnmatch ("x[[:alnum:]]y", "x\360\220\214\260y", 0) == 0);
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:alpha:]]y", "x\305\201y", 0) == 0);
+      /* U+10330 GOTHIC LETTER AHSA */
+      ASSERT (fnmatch ("x[[:alpha:]]y", "x\360\220\214\260y", 0) == 0);
+      /* U+00B8 CEDILLA */
+      ASSERT (fnmatch ("x[[:graph:]]y", "x\302\270y", 0) == 0);
+      /* U+20000 <CJK Ideograph> */
+      ASSERT (fnmatch ("x[[:graph:]]y", "x\360\240\200\200y", 0) == 0);
+      /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\303\277y", 0) == 0);
+      /* U+10441 DESERET SMALL LETTER EF */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\360\220\221\201y", 0) == 0);
+      /* U+00B8 CEDILLA */
+      ASSERT (fnmatch ("x[[:print:]]y", "x\302\270y", 0) == 0);
+      /* U+20000 <CJK Ideograph> */
+      ASSERT (fnmatch ("x[[:print:]]y", "x\360\240\200\200y", 0) == 0);
+      /* U+00BF INVERTED QUESTION MARK */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\302\277y", 0) == 0);
+      /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\360\235\204\200y", 0) == 0);
+      /* U+3000 IDEOGRAPHIC SPACE */
+      ASSERT (fnmatch ("x[[:space:]]y", "x\343\200\200y", 0) == 0);
+      /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\320\251y", 0) == 0);
+      /* U+10419 DESERET CAPITAL LETTER EF */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\360\220\220\231y", 0) == 0);
+      /* U+00D7 MULTIPLICATION SIGN */
+      ASSERT (fnmatch ("x[[:alnum:]]y", "x\303\227y", 0) == FNM_NOMATCH);
+      /* U+00D7 MULTIPLICATION SIGN */
+      ASSERT (fnmatch ("x[[:alpha:]]y", "x\303\227y", 0) == FNM_NOMATCH);
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:blank:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:cntrl:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:digit:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+      /* U+2002 EN SPACE */
+      ASSERT (fnmatch ("x[[:graph:]]y", "x\342\200\202y", 0) == FNM_NOMATCH);
+      /* U+00B2 SUPERSCRIPT TWO */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\302\262y", 0) == FNM_NOMATCH);
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:space:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+      /* U+00B2 SUPERSCRIPT TWO */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\302\262y", 0) == FNM_NOMATCH);
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:xdigit:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+
+      #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+      /* "özgür" */
+      {
+        /* Some platforms, e.g. MSVC 14, lack the upper/lower mappings for
+           these wide characters in the *.65001 locales.  */
+        mbstate_t state;
+        wchar_t wc;
+        memset (&state, 0, sizeof (mbstate_t));
+        if (mbrtowc (&wc, "\303\274", 2, &state) == 2
+            && towupper (wc) != wc)
+          {
+            ASSERT (fnmatch ("\303\266zg\303\274r", "\303\226ZG\303\234R", FNM_CASEFOLD) == 0);
+            ASSERT (fnmatch ("\303\226ZG\303\234R", "\303\266zg\303\274r", FNM_CASEFOLD) == 0);
+            ASSERT (fnmatch ("\303\266Zg\303\234r", "\303\226zG\303\274R", FNM_CASEFOLD) == 0);
+            ASSERT (fnmatch ("\303\226zG\303\274R", "\303\266Zg\303\234r", FNM_CASEFOLD) == 0);
+          }
+      }
+      #endif
+
+      return 0;
+
+    case 932:
+      /* Locale encoding is CP932, similar to Shift_JIS.  */
+
+      ASSERT (fnmatch ("x?y", "x\223\372y", 0) == 0); /* "x日y" */
+      ASSERT (fnmatch ("x?y", "x\226\173y", 0) == 0); /* "x本y" */
+      ASSERT (fnmatch ("x?y", "x\214\352y", 0) == 0); /* "x語y" */
+
+      return 0;
+
+    case 950:
+      /* Locale encoding is CP950, similar to Big5.  */
+
+      ASSERT (fnmatch ("x?y", "x\244\351y", 0) == 0); /* "x日y" */
+      ASSERT (fnmatch ("x?y", "x\245\273y", 0) == 0); /* "x本y" */
+      ASSERT (fnmatch ("x?y", "x\273\171y", 0) == 0); /* "x語y" */
+
+      /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+      ASSERT (fnmatch ("x[[:alnum:]]y", "x\242\365y", 0) == 0);
+      /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+      ASSERT (fnmatch ("x[[:alpha:]]y", "x\242\365y", 0) == 0);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:graph:]]y", "x\241\102y", 0) == 0);
+      /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\242\365y", 0) == 0);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:print:]]y", "x\241\102y", 0) == 0);
+      /* U+00D7 MULTIPLICATION SIGN */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\241\321y", 0) == 0);
+      /* U+3000 IDEOGRAPHIC SPACE */
+      ASSERT (fnmatch ("x[[:space:]]y", "x\241\100y", 0) == 0);
+      /* U+FF2D FULLWIDTH LATIN CAPITAL LETTER M */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\242\333y", 0) == 0);
+
+      #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+      /* "α-ω" */
+      ASSERT (fnmatch ("\243\134-\243\163", "\243\104-\243\133", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("\243\104-\243\133", "\243\134-\243\163", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("\243\134-\243\133", "\243\104-\243\163", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("\243\104-\243\163", "\243\134-\243\133", FNM_CASEFOLD) == 0);
+      #endif
+
+      return 0;
+
+    case 936:
+      /* Locale encoding is CP936 = GBK, an extension of GB2312.  */
+
+      ASSERT (fnmatch ("x?y", "x\310\325y", 0) == 0); /* "x日y" */
+      ASSERT (fnmatch ("x?y", "x\261\276y", 0) == 0); /* "x本y" */
+      ASSERT (fnmatch ("x?y", "x\325\132y", 0) == 0); /* "x語y" */
+
+      /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+      ASSERT (fnmatch ("x[[:alnum:]]y", "x\243\355y", 0) == 0);
+      /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+      ASSERT (fnmatch ("x[[:alpha:]]y", "x\243\355y", 0) == 0);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:graph:]]y", "x\241\242y", 0) == 0);
+      /* U+FF4D FULLWIDTH LATIN SMALL LETTER M */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\243\355y", 0) == 0);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:print:]]y", "x\241\242y", 0) == 0);
+      /* U+00D7 MULTIPLICATION SIGN */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\241\301y", 0) == 0);
+      /* U+3000 IDEOGRAPHIC SPACE */
+      ASSERT (fnmatch ("x[[:space:]]y", "x\241\241y", 0) == 0);
+      /* U+FF2D FULLWIDTH LATIN CAPITAL LETTER M */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\243\315y", 0) == 0);
+
+      #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+      /* "α-ω" */
+      ASSERT (fnmatch ("\246\301-\246\330", "\246\241-\246\270", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("\246\241-\246\270", "\246\301-\246\330", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("\246\301-\246\270", "\246\241-\246\330", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("\246\241-\246\330", "\246\301-\246\270", FNM_CASEFOLD) == 0);
+      #endif
+
+      return 0;
+
+    case 54936:
+      /* Locale encoding is CP54936 = GB18030.  */
+      if (strcmp (locale_charset (), "GB18030") != 0)
+        return 77;
+
+      ASSERT (fnmatch ("x?y", "x\250\271y", 0) == 0); /* "xüy" */
+      ASSERT (fnmatch ("x?y", "x\201\060\211\070y", 0) == 0); /* "xßy" */
+      ASSERT (fnmatch ("x?y", "x\224\071\375\067y", 0) == 0); /* "x😋y" */
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:alnum:]]y", "x\201\060\221\071y", 0) == 0);
+      /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+      ASSERT (fnmatch ("x[[:alpha:]]y", "x\201\060\221\071y", 0) == 0);
+      /* U+00B8 CEDILLA */
+      ASSERT (fnmatch ("x[[:graph:]]y", "x\201\060\206\060y", 0) == 0);
+      /* U+20000 <CJK Ideograph> */
+      ASSERT (fnmatch ("x[[:graph:]]y", "x\225\062\202\066y", 0) == 0);
+      /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\201\060\213\067y", 0) == 0);
+      /* U+10441 DESERET SMALL LETTER EF */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\220\060\355\071y", 0) == 0);
+      /* U+00B8 CEDILLA */
+      ASSERT (fnmatch ("x[[:print:]]y", "x\201\060\206\060y", 0) == 0);
+      /* U+20000 <CJK Ideograph> */
+      ASSERT (fnmatch ("x[[:print:]]y", "x\225\062\202\066y", 0) == 0);
+      /* U+00D7 MULTIPLICATION SIGN */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\241\301y", 0) == 0);
+      /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\224\062\273\064y", 0) == 0);
+      /* U+3000 IDEOGRAPHIC SPACE */
+      ASSERT (fnmatch ("x[[:space:]]y", "x\241\241y", 0) == 0);
+      /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\247\273y", 0) == 0);
+      /* U+10419 DESERET CAPITAL LETTER EF */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\220\060\351\071y", 0) == 0);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:alnum:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:alpha:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:blank:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:cntrl:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:digit:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+      /* U+3000 IDEOGRAPHIC SPACE */
+      ASSERT (fnmatch ("x[[:graph:]]y", "x\241\241y", 0) == FNM_NOMATCH);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:lower:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+      /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+      ASSERT (fnmatch ("x[[:punct:]]y", "x\201\060\211\061y", 0) == FNM_NOMATCH);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:space:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:upper:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+      /* U+3001 IDEOGRAPHIC COMMA */
+      ASSERT (fnmatch ("x[[:xdigit:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+
+      #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+      /* "özgür" */
+      ASSERT (fnmatch ("\201\060\213\062zg\250\271r", "\201\060\211\060ZG\201\060\211\065R", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("\201\060\211\060ZG\201\060\211\065R", "\201\060\213\062zg\250\271r", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("\201\060\213\062Zg\201\060\211\065r", "\201\060\211\060zG\250\271R", FNM_CASEFOLD) == 0);
+      ASSERT (fnmatch ("\201\060\211\060zG\250\271R", "\201\060\213\062Zg\201\060\211\065r", FNM_CASEFOLD) == 0);
+      #endif
+
+      return 0;
+
+    default:
+      return 1;
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int codepage = atoi (argv[argc - 1]);
+  int result;
+  int i;
+
+  result = 77;
+  for (i = 1; i < argc - 1; i++)
+    {
+      int ret = test_one_locale (argv[i], codepage);
+
+      if (ret != 77)
+        result = ret;
+    }
+
+  if (result == 77)
+    {
+      fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+               codepage);
+    }
+  return result;
+}
+
+#else
+
+int
+main (int argc, char *argv[])
+{
+  fputs ("Skipping test: not a native Windows system\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 48052b826dbff19a55a25a95799f224b555f751e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fnmatch.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..afcad2df4422c1bcdeb0749f761c603b1d26a45d
--- /dev/null
@@ -0,0 +1,963 @@
+/* Test of fnmatch string matching function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2009,
+   and Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <fnmatch.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fnmatch, int, (char const *, char const *, int));
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+#ifdef __ANDROID__
+  /* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
+     "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
+     locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
+     that is, effectively the "C.UTF-8" locale.  */
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
+#endif
+
+  /* Patterns with ordinary characters.  */
+
+  ASSERT (fnmatch ("", "", 0) == 0);
+  ASSERT (fnmatch ("", "abc", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("xy", "xy", 0) == 0);
+  ASSERT (fnmatch ("xy", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("xy", "wxy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("xy", "xyz", 0) == FNM_NOMATCH);
+
+  /* Patterns with special pattern characters.  */
+
+  ASSERT (fnmatch ("?", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("?", "a", 0) == 0);
+  ASSERT (fnmatch ("?", "z", 0) == 0);
+  ASSERT (fnmatch ("?", ".", 0) == 0);
+  ASSERT (fnmatch ("?", "/", 0) == 0);
+  ASSERT (fnmatch ("?", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("?", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("x?y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?y", "y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?y", "xay", 0) == 0);
+  ASSERT (fnmatch ("x?y", "xzy", 0) == 0);
+  ASSERT (fnmatch ("x?y", "x.y", 0) == 0);
+  ASSERT (fnmatch ("x?y", "x/y", 0) == 0);
+  ASSERT (fnmatch ("x?y", "xazy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?y", "x//y", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("*", "", 0) == 0);
+  ASSERT (fnmatch ("*", "a", 0) == 0);
+  ASSERT (fnmatch ("*", "z", 0) == 0);
+  ASSERT (fnmatch ("*", ".", 0) == 0);
+  ASSERT (fnmatch ("*", "*", 0) == 0);
+  ASSERT (fnmatch ("*", "/", 0) == 0);
+  ASSERT (fnmatch ("*", "az", 0) == 0);
+  ASSERT (fnmatch ("*", "//", 0) == 0);
+  ASSERT (fnmatch ("*", "some long text", 0) == 0);
+
+  ASSERT (fnmatch ("x*y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*y", "y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*y", "xy", 0) == 0);
+  ASSERT (fnmatch ("x*y", "xay", 0) == 0);
+  ASSERT (fnmatch ("x*y", "xzy", 0) == 0);
+  ASSERT (fnmatch ("x*y", "x.y", 0) == 0);
+  ASSERT (fnmatch ("x*y", "x*y", 0) == 0);
+  ASSERT (fnmatch ("x*y", "x/y", 0) == 0);
+  ASSERT (fnmatch ("x*y", "xazy", 0) == 0);
+  ASSERT (fnmatch ("x*y", "x//y", 0) == 0);
+
+  ASSERT (fnmatch ("**", "", 0) == 0);
+  ASSERT (fnmatch ("**", "a", 0) == 0);
+  ASSERT (fnmatch ("**", "z", 0) == 0);
+  ASSERT (fnmatch ("**", ".", 0) == 0);
+  ASSERT (fnmatch ("**", "*", 0) == 0);
+  ASSERT (fnmatch ("**", "/", 0) == 0);
+  ASSERT (fnmatch ("**", "az", 0) == 0);
+  ASSERT (fnmatch ("**", "//", 0) == 0);
+  ASSERT (fnmatch ("**", "some long text", 0) == 0);
+
+  ASSERT (fnmatch ("x**y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x**y", "y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x**y", "xy", 0) == 0);
+  ASSERT (fnmatch ("x**y", "xay", 0) == 0);
+  ASSERT (fnmatch ("x**y", "xzy", 0) == 0);
+  ASSERT (fnmatch ("x**y", "x.y", 0) == 0);
+  ASSERT (fnmatch ("x**y", "x*y", 0) == 0);
+  ASSERT (fnmatch ("x**y", "x/y", 0) == 0);
+  ASSERT (fnmatch ("x**y", "xazy", 0) == 0);
+  ASSERT (fnmatch ("x**y", "x//y", 0) == 0);
+  ASSERT (fnmatch ("x**y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x**y", "y", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("*.*", "foo.txt", 0) == 0);
+  ASSERT (fnmatch ("*.*", "foo.", 0) == 0);
+  ASSERT (fnmatch ("*.*", "foo", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("x*y*z", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*y*z", "x", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*y*z", "y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*y*z", "z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*y*z", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*y*z", "xz", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*y*z", "yz", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*y*z", "xyz", 0) == 0);
+  ASSERT (fnmatch ("x*y*z", "xayz", 0) == 0);
+  ASSERT (fnmatch ("x*y*z", "xybz", 0) == 0);
+  ASSERT (fnmatch ("x*y*z", "xaybz", 0) == 0);
+  ASSERT (fnmatch ("x*y*z", "xxyz", 0) == 0);
+  ASSERT (fnmatch ("x*y*z", "xyyz", 0) == 0);
+  ASSERT (fnmatch ("x*y*z", "xyzz", 0) == 0);
+  ASSERT (fnmatch ("x*y*z", "xyxyz", 0) == 0);
+
+  ASSERT (fnmatch ("x***??y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x***??y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x***??y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x***??y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x***??y", "x123y", 0) == 0);
+
+  ASSERT (fnmatch ("x**??*y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x**??*y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x**??*y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x**??*y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x**??*y", "x123y", 0) == 0);
+
+  ASSERT (fnmatch ("x*??**y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*??**y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*??**y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*??**y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x*??**y", "x123y", 0) == 0);
+
+  ASSERT (fnmatch ("x??***y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x??***y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x??***y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x??***y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x??***y", "x123y", 0) == 0);
+
+  ASSERT (fnmatch ("x**?*?y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x**?*?y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x**?*?y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x**?*?y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x**?*?y", "x123y", 0) == 0);
+
+  ASSERT (fnmatch ("x*?*?*y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*?*?*y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*?*?*y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*?*?*y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x*?*?*y", "x123y", 0) == 0);
+
+  ASSERT (fnmatch ("x?*?**y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?*?**y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?*?**y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?*?**y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x?*?**y", "x123y", 0) == 0);
+
+  ASSERT (fnmatch ("x*?**?y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*?**?y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*?**?y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*?**?y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x*?**?y", "x123y", 0) == 0);
+
+  ASSERT (fnmatch ("x?**?*y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?**?*y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?**?*y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?**?*y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x?**?*y", "x123y", 0) == 0);
+
+  ASSERT (fnmatch ("x?***?y", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?***?y", "xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?***?y", "x1y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?***?y", "x12y", 0) == 0);
+  ASSERT (fnmatch ("x?***?y", "x123y", 0) == 0);
+
+  /* Patterns with bracket expressions.  */
+
+  ASSERT (fnmatch ("[a-z]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[a-z]", "a", 0) == 0);
+  ASSERT (fnmatch ("[a-z]", "z", 0) == 0);
+  ASSERT (fnmatch ("[a-z]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[a-z]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[a-z]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[a-z]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[!a-z]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[!a-z]", "a", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[!a-z]", "z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[!a-z]", ".", 0) == 0);
+  ASSERT (fnmatch ("[!a-z]", "/", 0) == 0);
+  ASSERT (fnmatch ("[!a-z]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[!a-z]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:alnum:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:alnum:]]", "a", 0) == 0);
+  ASSERT (fnmatch ("[[:alnum:]]", "z", 0) == 0);
+  ASSERT (fnmatch ("[[:alnum:]]", "7", 0) == 0);
+  ASSERT (fnmatch ("[[:alnum:]]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:alnum:]]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:alnum:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:alnum:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:alpha:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:alpha:]]", "a", 0) == 0);
+  ASSERT (fnmatch ("[[:alpha:]]", "z", 0) == 0);
+  ASSERT (fnmatch ("[[:alpha:]]", "7", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:alpha:]]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:alpha:]]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:alpha:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:alpha:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:blank:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:blank:]]", "a", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:blank:]]", "z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:blank:]]", "7", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:blank:]]", " ", 0) == 0);
+  ASSERT (fnmatch ("[[:blank:]]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:blank:]]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:blank:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:blank:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:cntrl:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:cntrl:]]", "a", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:cntrl:]]", "z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:cntrl:]]", "7", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:cntrl:]]", "\n", 0) == 0);
+  ASSERT (fnmatch ("[[:cntrl:]]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:cntrl:]]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:cntrl:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:cntrl:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:digit:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:digit:]]", "a", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:digit:]]", "z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:digit:]]", "7", 0) == 0);
+  ASSERT (fnmatch ("[[:digit:]]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:digit:]]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:digit:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:digit:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:graph:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:graph:]]", "a", 0) == 0);
+  ASSERT (fnmatch ("[[:graph:]]", "z", 0) == 0);
+  ASSERT (fnmatch ("[[:graph:]]", "7", 0) == 0);
+  ASSERT (fnmatch ("[[:graph:]]", " ", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:graph:]]", ".", 0) == 0);
+  ASSERT (fnmatch ("[[:graph:]]", "/", 0) == 0);
+  ASSERT (fnmatch ("[[:graph:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:graph:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:lower:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:lower:]]", "a", 0) == 0);
+  ASSERT (fnmatch ("[[:lower:]]", "z", 0) == 0);
+  ASSERT (fnmatch ("[[:lower:]]", "A", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:lower:]]", "Z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:lower:]]", "7", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:lower:]]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:lower:]]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:lower:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:lower:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:print:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:print:]]", "a", 0) == 0);
+  ASSERT (fnmatch ("[[:print:]]", "z", 0) == 0);
+  ASSERT (fnmatch ("[[:print:]]", "7", 0) == 0);
+  ASSERT (fnmatch ("[[:print:]]", " ", 0) == 0);
+  ASSERT (fnmatch ("[[:print:]]", ".", 0) == 0);
+  ASSERT (fnmatch ("[[:print:]]", "/", 0) == 0);
+  ASSERT (fnmatch ("[[:print:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:print:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:punct:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:punct:]]", "a", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:punct:]]", "z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:punct:]]", "7", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:punct:]]", ".", 0) == 0);
+  ASSERT (fnmatch ("[[:punct:]]", "/", 0) == 0);
+  ASSERT (fnmatch ("[[:punct:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:punct:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:space:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:space:]]", "a", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:space:]]", "z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:space:]]", "7", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:space:]]", " ", 0) == 0);
+  ASSERT (fnmatch ("[[:space:]]", "\t", 0) == 0);
+  ASSERT (fnmatch ("[[:space:]]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:space:]]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:space:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:space:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:upper:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:upper:]]", "a", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:upper:]]", "z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:upper:]]", "A", 0) == 0);
+  ASSERT (fnmatch ("[[:upper:]]", "Z", 0) == 0);
+  ASSERT (fnmatch ("[[:upper:]]", "7", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:upper:]]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:upper:]]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:upper:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:upper:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:xdigit:]]", "", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:xdigit:]]", "a", 0) == 0);
+  ASSERT (fnmatch ("[[:xdigit:]]", "F", 0) == 0);
+  ASSERT (fnmatch ("[[:xdigit:]]", "z", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:xdigit:]]", "7", 0) == 0);
+  ASSERT (fnmatch ("[[:xdigit:]]", ".", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:xdigit:]]", "/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:xdigit:]]", "az", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:xdigit:]]", "//", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:alpha:]'[:alpha:]\0]", "a", 0) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[a[.\0.]]", "a", 0) == FNM_NOMATCH);
+
+  /* Verify that an unmatched [ is treated as a literal, as POSIX requires.  */
+  ASSERT (fnmatch ("[", "[", 0) == 0);
+  ASSERT (fnmatch ("[", "]", 0) == FNM_NOMATCH);
+
+  /* The FNM_PATHNAME flag.  */
+
+  ASSERT (fnmatch ("x?y", "x/y", 0) == 0);
+  ASSERT (fnmatch ("x?y", "x/y", FNM_PATHNAME) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("x*y", "x/y", 0) == 0);
+  ASSERT (fnmatch ("x*y", "x/y", FNM_PATHNAME) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[/-/]", "/", 0) == 0);
+  ASSERT (fnmatch ("[/-/]", "/", FNM_PATHNAME) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[!-~]", "/", FNM_PATHNAME) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("[[:graph:]]", "/", FNM_PATHNAME) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:print:]]", "/", FNM_PATHNAME) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:punct:]]", "/", FNM_PATHNAME) == FNM_NOMATCH);
+
+  /* The FNM_NOESCAPE flag.  */
+
+  ASSERT (fnmatch ("foo\\.txt", "foo.txt", 0) == 0);
+  ASSERT (fnmatch ("foo\\.txt", "foo.txt", FNM_NOESCAPE) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("x?y", "x/y", 0) == 0);
+  ASSERT (fnmatch ("x\\?y", "x/y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x\\?y", "x/y", FNM_NOESCAPE) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x\\?y", "x?y", 0) == 0);
+  ASSERT (fnmatch ("x\\?y", "x?y", FNM_NOESCAPE) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x\\?y", "x\\?y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x\\?y", "x\\?y", FNM_NOESCAPE) == 0);
+
+  ASSERT (fnmatch ("x*y", "x/y", 0) == 0);
+  ASSERT (fnmatch ("x\\*y", "x/y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x\\*y", "x/y", FNM_NOESCAPE) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x\\*y", "x*y", 0) == 0);
+  ASSERT (fnmatch ("x\\*y", "x*y", FNM_NOESCAPE) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x\\*y", "x\\*y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x\\*y", "x\\*y", FNM_NOESCAPE) == 0);
+
+  /* The FNM_PERIOD flag.  */
+
+  ASSERT (fnmatch ("foo.rc", "foo.rc", 0) == 0);
+  ASSERT (fnmatch ("foo.rc", "foo.rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("foo.rc", "foo.rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("foo.rc", "foo.rc", FNM_PATHNAME | FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("foo?rc", "foo.rc", 0) == 0);
+  ASSERT (fnmatch ("foo?rc", "foo.rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("foo?rc", "foo.rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("foo?rc", "foo.rc", FNM_PATHNAME | FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("foo[[:punct:]]rc", "foo.rc", 0) == 0);
+  ASSERT (fnmatch ("foo[[:punct:]]rc", "foo.rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("foo[[:punct:]]rc", "foo.rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("foo[[:punct:]]rc", "foo.rc", FNM_PATHNAME | FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("foo*rc", "foo.rc", 0) == 0);
+  ASSERT (fnmatch ("foo*rc", "foo.rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("foo*rc", "foo.rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("foo*rc", "foo.rc", FNM_PATHNAME | FNM_PERIOD) == 0);
+
+  ASSERT (fnmatch (".rc", ".rc", 0) == 0);
+  ASSERT (fnmatch (".rc", ".rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch (".rc", ".rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch (".rc", ".rc", FNM_PATHNAME | FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("?rc", ".rc", 0) == 0);
+  ASSERT (fnmatch ("?rc", ".rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("?rc", ".rc", FNM_PERIOD) == FNM_NOMATCH);
+  ASSERT (fnmatch ("?rc", ".rc", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:punct:]]rc", ".rc", 0) == 0);
+  ASSERT (fnmatch ("[[:punct:]]rc", ".rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("[[:punct:]]rc", ".rc", FNM_PERIOD) == FNM_NOMATCH);
+  ASSERT (fnmatch ("[[:punct:]]rc", ".rc", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
+  ASSERT (fnmatch ("*rc", ".rc", 0) == 0);
+  ASSERT (fnmatch ("*rc", ".rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("*rc", ".rc", FNM_PERIOD) == FNM_NOMATCH);
+  ASSERT (fnmatch ("*rc", ".rc", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("dir/.rc", "dir/.rc", 0) == 0);
+  ASSERT (fnmatch ("dir/.rc", "dir/.rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("dir/.rc", "dir/.rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("dir/.rc", "dir/.rc", FNM_PATHNAME | FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("dir/?rc", "dir/.rc", 0) == 0);
+  ASSERT (fnmatch ("dir/?rc", "dir/.rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("dir/?rc", "dir/.rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("dir/?rc", "dir/.rc", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
+  ASSERT (fnmatch ("dir/[[:punct:]]rc", "dir/.rc", 0) == 0);
+  ASSERT (fnmatch ("dir/[[:punct:]]rc", "dir/.rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("dir/[[:punct:]]rc", "dir/.rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("dir/[[:punct:]]rc", "dir/.rc", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
+  ASSERT (fnmatch ("dir/*rc", "dir/.rc", 0) == 0);
+  ASSERT (fnmatch ("dir/*rc", "dir/.rc", FNM_PATHNAME) == 0);
+  ASSERT (fnmatch ("dir/*rc", "dir/.rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("dir/*rc", "dir/.rc", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
+  ASSERT (fnmatch ("*rc", "dir/.rc", 0) == 0);
+  ASSERT (fnmatch ("*rc", "dir/.rc", FNM_PATHNAME) == FNM_NOMATCH);
+  ASSERT (fnmatch ("*rc", "dir/.rc", FNM_PERIOD) == 0);
+  ASSERT (fnmatch ("*rc", "dir/.rc", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
+
+  /* The FNM_LEADING_DIR flag (common extension).  */
+  #if GNULIB_FNMATCH_GNU && defined FNM_LEADING_DIR
+
+  ASSERT (fnmatch ("x", "x", 0) == 0);
+  ASSERT (fnmatch ("x", "x", FNM_LEADING_DIR) == 0);
+  ASSERT (fnmatch ("x", "x/", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x", "x/", FNM_LEADING_DIR) == 0);
+  ASSERT (fnmatch ("x", "x/y", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x", "x/y", FNM_LEADING_DIR) == 0);
+
+  ASSERT (fnmatch ("x?y", "x/y", 0) == 0);
+  ASSERT (fnmatch ("x?y", "x/y", FNM_LEADING_DIR) == 0);
+  ASSERT (fnmatch ("x?y", "x/y", FNM_PATHNAME) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?y", "x/y", FNM_PATHNAME | FNM_LEADING_DIR) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?y", "x/y/z", FNM_PATHNAME | FNM_LEADING_DIR) == FNM_NOMATCH);
+
+  #endif
+
+  /* The FNM_CASEFOLD flag (common extension).  */
+  #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+
+  ASSERT (fnmatch ("xy", "xy", 0) == 0);
+  ASSERT (fnmatch ("xy", "xy", FNM_CASEFOLD) == 0);
+  ASSERT (fnmatch ("xy", "Xy", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("xy", "Xy", FNM_CASEFOLD) == 0);
+  ASSERT (fnmatch ("xy", "xY", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("xy", "xY", FNM_CASEFOLD) == 0);
+  ASSERT (fnmatch ("xy", "XY", 0) == FNM_NOMATCH);
+  ASSERT (fnmatch ("xy", "XY", FNM_CASEFOLD) == 0);
+
+  /* Locales other than the "C" locale may order the ASCII letters like this:
+     AaBb...Mm...Zz .  Seen on FreeBSD and Solaris 11.  */
+  if (argc == 1 || strcmp (argv[1], "1") == 0)
+    ASSERT (fnmatch ("[a-z]", "M", 0) == FNM_NOMATCH);
+  #if !defined GNULIB_defined_fnmatch_function
+  ASSERT (fnmatch ("[a-z]", "M", FNM_CASEFOLD) == 0);
+  #endif
+  if (argc == 1 || strcmp (argv[1], "1") == 0)
+    ASSERT (fnmatch ("[A-Z]", "m", 0) == FNM_NOMATCH);
+  #if !defined GNULIB_defined_fnmatch_function
+  ASSERT (fnmatch ("[A-Z]", "m", FNM_CASEFOLD) == 0);
+  #endif
+
+  #endif
+
+  /* The FNM_EXTMATCH flag (GNU extension).  */
+  #if GNULIB_FNMATCH_GNU && defined FNM_EXTMATCH
+
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "xy", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "x$y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "x7y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "xay", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "xzy", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "x/y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "x32y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "x$1y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x?($|[[:digit:]])y", "x1$y", FNM_EXTMATCH) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "xy", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "x$y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "x7y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "xay", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "xzy", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "x/y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "x32y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "x$1y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x*($|[[:digit:]])y", "x1$y", FNM_EXTMATCH) == 0);
+
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "xy", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "x$y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "x7y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "xay", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "xzy", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "x/y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "x32y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "x$1y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x+($|[[:digit:]])y", "x1$y", FNM_EXTMATCH) == 0);
+
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "xy", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "x$y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "x7y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "xay", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "xzy", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "x/y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "x32y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "x$1y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x@($|[[:digit:]])y", "x1$y", FNM_EXTMATCH) == FNM_NOMATCH);
+
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "xy", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "x$y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "x7y", FNM_EXTMATCH) == FNM_NOMATCH);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "xay", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "xzy", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "x/y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "x32y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "x$1y", FNM_EXTMATCH) == 0);
+  ASSERT (fnmatch ("x!($|[[:digit:]])y", "x1$y", FNM_EXTMATCH) == 0);
+
+  ASSERT (fnmatch ("**(!()", "**(!()", FNM_EXTMATCH) == 0);
+
+  #endif
+
+  /* Verify that the test cases from fnmatch.m4 are really working.  */
+  {
+    char const *Apat = 'A' < '\\' ? "[A-\\\\]" : "[\\\\-A]";
+    char const *apat = 'a' < '\\' ? "[a-\\\\]" : "[\\\\-a]";
+    static char const A_1[] = { 'A' - 1, 0 };
+    static char const A01[] = { 'A' + 1, 0 };
+    static char const a_1[] = { 'a' - 1, 0 };
+    static char const a01[] = { 'a' + 1, 0 };
+    static char const bs_1[] = { '\\' - 1, 0 };
+    static char const bs01[] = { '\\' + 1, 0 };
+    /* These are sanity checks. They all succeed on current platforms.  */
+    ASSERT (fnmatch ("a*", "", 0) == FNM_NOMATCH);
+    ASSERT (fnmatch ("a*", "abc", 0) == 0);
+    ASSERT (fnmatch ("d*/*1", "d/s/1", FNM_PATHNAME) == FNM_NOMATCH);
+    ASSERT (fnmatch ("a\\bc", "abc", 0) == 0);
+    ASSERT (fnmatch ("a\\bc", "abc", FNM_NOESCAPE) == FNM_NOMATCH);
+    ASSERT (fnmatch ("*x", ".x", 0) == 0);
+    ASSERT (fnmatch ("*x", ".x", FNM_PERIOD) == FNM_NOMATCH);
+    if (argc == 1 || strcmp (argv[1], "1") == 0)
+      {
+        /* glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=361>
+           exists in glibc 2.3.3, fixed in glibc 2.5.  */
+        ASSERT (fnmatch (Apat, "\\", 0) == 0);
+        ASSERT (fnmatch (Apat, "A", 0) == 0);
+        ASSERT (fnmatch (apat, "\\", 0) == 0);
+        ASSERT (fnmatch (apat, "a", 0) == 0);
+        ASSERT (fnmatch (Apat, A_1, 0) == ('A' < '\\' ? FNM_NOMATCH : 0));
+        ASSERT (fnmatch (apat, a_1, 0) == ('a' < '\\' ? FNM_NOMATCH : 0));
+        ASSERT (fnmatch (Apat, A01, 0) == ('A' < '\\' ? 0 : FNM_NOMATCH));
+        ASSERT (fnmatch (apat, a01, 0) == ('a' < '\\' ? 0 : FNM_NOMATCH));
+        ASSERT (fnmatch (Apat, bs_1, 0) == ('A' < '\\' ? 0 : FNM_NOMATCH));
+        ASSERT (fnmatch (apat, bs_1, 0) == ('a' < '\\' ? 0 : FNM_NOMATCH));
+        ASSERT (fnmatch (Apat, bs01, 0) == ('A' < '\\' ? FNM_NOMATCH : 0));
+        ASSERT (fnmatch (apat, bs01, 0) == ('a' < '\\' ? FNM_NOMATCH : 0));
+      }
+    /* glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=12378>
+       exists in glibc 2.12, fixed in glibc 2.13.  */
+    ASSERT (fnmatch ("[/b", "[/b", 0) == 0);
+    /* This test fails on FreeBSD 13.2, NetBSD 9.3, Cygwin 3.4.6.  */
+    ASSERT (fnmatch ("[[:alnum:]]", "a", 0) == 0);
+    #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+    ASSERT (fnmatch ("xxXX", "xXxX", FNM_CASEFOLD) == 0);
+    #endif
+    #if GNULIB_FNMATCH_GNU && defined FNM_EXTMATCH
+    ASSERT (fnmatch ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH) == 0);
+    #endif
+    #if GNULIB_FNMATCH_GNU && defined FNM_FILE_NAME
+    ASSERT (fnmatch ("d*/*1", "d/s/1", FNM_FILE_NAME) == FNM_NOMATCH);
+    ASSERT (fnmatch ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) == 0);
+    ASSERT (fnmatch ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) == 0);
+    ASSERT (fnmatch ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR) == 0);
+    #endif
+  }
+
+  /* Locale specific recognition of multibyte characters.  */
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '1':
+        /* C or POSIX locale.  */
+        return 0;
+
+      case '2':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+
+        ASSERT (fnmatch ("x?y", "x\374y", 0) == 0); /* "xüy" */
+        ASSERT (fnmatch ("x?y", "x\337y", 0) == 0); /* "xßy" */
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        ASSERT (fnmatch ("x[[:alnum:]]y", "x\330y", 0) == 0);
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        ASSERT (fnmatch ("x[[:alpha:]]y", "x\330y", 0) == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+        /* U+00B8 CEDILLA */
+        ASSERT (fnmatch ("x[[:graph:]]y", "x\270y", 0) == 0);
+        #endif
+        /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\377y", 0) == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+        /* U+00B8 CEDILLA */
+        ASSERT (fnmatch ("x[[:print:]]y", "x\270y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+        /* U+00BF INVERTED QUESTION MARK */
+        ASSERT (fnmatch ("x[[:punct:]]y", "x\277y", 0) == 0);
+        #endif
+        /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\311y", 0) == 0);
+        /* U+00D7 MULTIPLICATION SIGN */
+        ASSERT (fnmatch ("x[[:alnum:]]y", "x\327y", 0) == FNM_NOMATCH);
+        /* U+00D7 MULTIPLICATION SIGN */
+        ASSERT (fnmatch ("x[[:alpha:]]y", "x\327y", 0) == FNM_NOMATCH);
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        ASSERT (fnmatch ("x[[:blank:]]y", "x\330y", 0) == FNM_NOMATCH);
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        ASSERT (fnmatch ("x[[:cntrl:]]y", "x\330y", 0) == FNM_NOMATCH);
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        ASSERT (fnmatch ("x[[:digit:]]y", "x\330y", 0) == FNM_NOMATCH);
+        /* U+00B2 SUPERSCRIPT TWO */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\262y", 0) == FNM_NOMATCH);
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        ASSERT (fnmatch ("x[[:punct:]]y", "x\330y", 0) == FNM_NOMATCH);
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        ASSERT (fnmatch ("x[[:space:]]y", "x\330y", 0) == FNM_NOMATCH);
+        /* U+00B2 SUPERSCRIPT TWO */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\262y", 0) == FNM_NOMATCH);
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        ASSERT (fnmatch ("x[[:xdigit:]]y", "x\330y", 0) == FNM_NOMATCH);
+
+        #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+        /* "Höhle" */
+        ASSERT (fnmatch ("H\366hle", "H\326hLe", FNM_CASEFOLD) == 0);
+        ASSERT (fnmatch ("H\326hLe", "H\366hle", FNM_CASEFOLD) == 0);
+        ASSERT (fnmatch ("H\326hle", "H\366hLe", FNM_CASEFOLD) == 0);
+        ASSERT (fnmatch ("H\366hLe", "H\326hle", FNM_CASEFOLD) == 0);
+        #endif
+
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+
+        ASSERT (fnmatch ("x?y", "x\303\274y", 0) == 0); /* "xüy" */
+        ASSERT (fnmatch ("x?y", "x\303\237y", 0) == 0); /* "xßy" */
+        ASSERT (fnmatch ("x?y", "x\360\237\230\213y", 0) == 0); /* "x😋y" */
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:alnum:]]y", "x\305\201y", 0) == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+        /* U+10330 GOTHIC LETTER AHSA */
+        ASSERT (fnmatch ("x[[:alnum:]]y", "x\360\220\214\260y", 0) == 0);
+        #endif
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:alpha:]]y", "x\305\201y", 0) == 0);
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+        /* U+10330 GOTHIC LETTER AHSA */
+        ASSERT (fnmatch ("x[[:alpha:]]y", "x\360\220\214\260y", 0) == 0);
+        #endif
+        /* U+00B8 CEDILLA */
+        ASSERT (fnmatch ("x[[:graph:]]y", "x\302\270y", 0) == 0);
+        #if !defined __sun
+        /* U+20000 <CJK Ideograph> */
+        ASSERT (fnmatch ("x[[:graph:]]y", "x\360\240\200\200y", 0) == 0);
+        #endif
+        /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\303\277y", 0) == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        /* U+10441 DESERET SMALL LETTER EF */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\360\220\221\201y", 0) == 0);
+        #endif
+        /* U+00B8 CEDILLA */
+        ASSERT (fnmatch ("x[[:print:]]y", "x\302\270y", 0) == 0);
+        #if !defined __sun
+        /* U+20000 <CJK Ideograph> */
+        ASSERT (fnmatch ("x[[:print:]]y", "x\360\240\200\200y", 0) == 0);
+        #endif
+        /* U+00BF INVERTED QUESTION MARK */
+        ASSERT (fnmatch ("x[[:punct:]]y", "x\302\277y", 0) == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+        if (iswpunct (0x1D100))
+          ASSERT (fnmatch ("x[[:punct:]]y", "x\360\235\204\200y", 0) == 0);
+        #endif
+        /* U+3000 IDEOGRAPHIC SPACE */
+        ASSERT (fnmatch ("x[[:space:]]y", "x\343\200\200y", 0) == 0);
+        /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\320\251y", 0) == 0);
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        /* U+10419 DESERET CAPITAL LETTER EF */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\360\220\220\231y", 0) == 0);
+        #endif
+        /* U+00D7 MULTIPLICATION SIGN */
+        ASSERT (fnmatch ("x[[:alnum:]]y", "x\303\227y", 0) == FNM_NOMATCH);
+        /* U+00D7 MULTIPLICATION SIGN */
+        ASSERT (fnmatch ("x[[:alpha:]]y", "x\303\227y", 0) == FNM_NOMATCH);
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:blank:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:cntrl:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:digit:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+        /* U+2002 EN SPACE */
+        ASSERT (fnmatch ("x[[:graph:]]y", "x\342\200\202y", 0) == FNM_NOMATCH);
+        /* U+00B2 SUPERSCRIPT TWO */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\302\262y", 0) == FNM_NOMATCH);
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:punct:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:space:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+        /* U+00B2 SUPERSCRIPT TWO */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\302\262y", 0) == FNM_NOMATCH);
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:xdigit:]]y", "x\305\201y", 0) == FNM_NOMATCH);
+
+        #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+        /* "özgür" */
+        {
+          /* Some platforms, e.g. MSVC 14, lack the upper/lower mappings for
+             these wide characters in the *.65001 locales.  */
+          mbstate_t state;
+          wchar_t wc;
+          memset (&state, 0, sizeof (mbstate_t));
+          if (mbrtowc (&wc, "\303\274", 2, &state) == 2
+              && towupper (wc) != wc)
+            {
+              ASSERT (fnmatch ("\303\266zg\303\274r", "\303\226ZG\303\234R", FNM_CASEFOLD) == 0);
+              ASSERT (fnmatch ("\303\226ZG\303\234R", "\303\266zg\303\274r", FNM_CASEFOLD) == 0);
+              ASSERT (fnmatch ("\303\266Zg\303\234r", "\303\226zG\303\274R", FNM_CASEFOLD) == 0);
+              ASSERT (fnmatch ("\303\226zG\303\274R", "\303\266Zg\303\234r", FNM_CASEFOLD) == 0);
+            }
+        }
+        #endif
+
+        return 0;
+
+      case '4':
+        /* Locale encoding is EUC-JP.  */
+
+        ASSERT (fnmatch ("x?y", "x\306\374y", 0) == 0); /* "x日y" */
+        ASSERT (fnmatch ("x?y", "x\313\334y", 0) == 0); /* "x本y" */
+        ASSERT (fnmatch ("x?y", "x\270\354y", 0) == 0); /* "x語y" */
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__)
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:alnum:]]y", "x\217\251\250y", 0) == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__)
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:alpha:]]y", "x\217\251\250y", 0) == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__)
+        /* U+00B8 CEDILLA */
+        ASSERT (fnmatch ("x[[:graph:]]y", "x\217\242\261y", 0) == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
+        /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\217\253\363y", 0) == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__)
+        /* U+00B8 CEDILLA */
+        ASSERT (fnmatch ("x[[:print:]]y", "x\217\242\261y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+        /* U+00D7 MULTIPLICATION SIGN */
+        ASSERT (fnmatch ("x[[:punct:]]y", "x\241\337y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+        /* U+3000 IDEOGRAPHIC SPACE */
+        ASSERT (fnmatch ("x[[:space:]]y", "x\241\241y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+        /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\247\273y", 0) == 0);
+        #endif
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:alnum:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:alpha:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:blank:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:cntrl:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:digit:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3000 IDEOGRAPHIC SPACE */
+        ASSERT (fnmatch ("x[[:graph:]]y", "x\241\241y", 0) == FNM_NOMATCH);
+        /* U+3073 HIRAGANA LETTER BI */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\244\323y", 0) == FNM_NOMATCH);
+        /* U+00DF LATIN SMALL LETTER SHARP S */
+        ASSERT (fnmatch ("x[[:punct:]]y", "x\217\251\316y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:space:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3073 HIRAGANA LETTER BI */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\244\323y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:xdigit:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+
+        #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+        /* "özgür" */
+        {
+          /* Some platforms, e.g. macOS 12.5 and NetBSD 9.3, lack the
+             upper/lower mappings for these wide characters in the ja_JP.eucJP
+             locale.  */
+          mbstate_t state;
+          wchar_t wc;
+          memset (&state, 0, sizeof (mbstate_t));
+          if (mbrtowc (&wc, "\217\253\344", 3, &state) == 3
+              && towupper (wc) != wc)
+            {
+              ASSERT (fnmatch ("\217\253\323zg\217\253\344r", "\217\252\323ZG\217\252\344R", FNM_CASEFOLD) == 0);
+              ASSERT (fnmatch ("\217\252\323ZG\217\252\344R", "\217\253\323zg\217\253\344r", FNM_CASEFOLD) == 0);
+              ASSERT (fnmatch ("\217\253\323Zg\217\252\344r", "\217\252\323zG\217\253\344R", FNM_CASEFOLD) == 0);
+              ASSERT (fnmatch ("\217\252\323zG\217\253\344R", "\217\253\323Zg\217\252\344r", FNM_CASEFOLD) == 0);
+            }
+        }
+        #endif
+
+        return 0;
+
+      case '5':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+
+        ASSERT (fnmatch ("x?y", "x\250\271y", 0) == 0); /* "xüy" */
+        ASSERT (fnmatch ("x?y", "x\201\060\211\070y", 0) == 0); /* "xßy" */
+        ASSERT (fnmatch ("x?y", "x\224\071\375\067y", 0) == 0); /* "x😋y" */
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:alnum:]]y", "x\201\060\221\071y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */
+        ASSERT (fnmatch ("x[[:alpha:]]y", "x\201\060\221\071y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        /* U+00B8 CEDILLA */
+        ASSERT (fnmatch ("x[[:graph:]]y", "x\201\060\206\060y", 0) == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+        /* U+20000 <CJK Ideograph> */
+        ASSERT (fnmatch ("x[[:graph:]]y", "x\225\062\202\066y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\201\060\213\067y", 0) == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+        /* U+10441 DESERET SMALL LETTER EF */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\220\060\355\071y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        /* U+00B8 CEDILLA */
+        ASSERT (fnmatch ("x[[:print:]]y", "x\201\060\206\060y", 0) == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+        /* U+20000 <CJK Ideograph> */
+        ASSERT (fnmatch ("x[[:print:]]y", "x\225\062\202\066y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+        /* U+00D7 MULTIPLICATION SIGN */
+        ASSERT (fnmatch ("x[[:punct:]]y", "x\241\301y", 0) == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+        /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */
+        ASSERT (fnmatch ("x[[:punct:]]y", "x\224\062\273\064y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+        /* U+3000 IDEOGRAPHIC SPACE */
+        ASSERT (fnmatch ("x[[:space:]]y", "x\241\241y", 0) == 0);
+        #endif
+        #if !(defined __FreeBSD__ || defined __DragonFly__)
+        /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\247\273y", 0) == 0);
+        #endif
+        #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun)
+        /* U+10419 DESERET CAPITAL LETTER EF */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\220\060\351\071y", 0) == 0);
+        #endif
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:alnum:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:alpha:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:blank:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:cntrl:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:digit:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3000 IDEOGRAPHIC SPACE */
+        ASSERT (fnmatch ("x[[:graph:]]y", "x\241\241y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:lower:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        ASSERT (fnmatch ("x[[:punct:]]y", "x\201\060\211\061y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:space:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:upper:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+        /* U+3001 IDEOGRAPHIC COMMA */
+        ASSERT (fnmatch ("x[[:xdigit:]]y", "x\241\242y", 0) == FNM_NOMATCH);
+
+        #if GNULIB_FNMATCH_GNU && defined FNM_CASEFOLD
+        /* "özgür" */
+        {
+          /* Some platforms, e.g. FreeBSD 13.2 and Solaris 11.4, lack the
+             upper/lower mappings for these wide characters in the zh_CN.GB18030
+             locale.  */
+          mbstate_t state;
+          wchar_t wc;
+          memset (&state, 0, sizeof (mbstate_t));
+          if (mbrtowc (&wc, "\201\060\213\062", 4, &state) == 4
+              && towupper (wc) != wc)
+            {
+              ASSERT (fnmatch ("\201\060\213\062zg\250\271r", "\201\060\211\060ZG\201\060\211\065R", FNM_CASEFOLD) == 0);
+              ASSERT (fnmatch ("\201\060\211\060ZG\201\060\211\065R", "\201\060\213\062zg\250\271r", FNM_CASEFOLD) == 0);
+              ASSERT (fnmatch ("\201\060\213\062Zg\201\060\211\065r", "\201\060\211\060zG\250\271R", FNM_CASEFOLD) == 0);
+              ASSERT (fnmatch ("\201\060\211\060zG\250\271R", "\201\060\213\062Zg\201\060\211\065r", FNM_CASEFOLD) == 0);
+            }
+        }
+        #endif
+
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index c4853d778a559c4a56de0aaacd74ce9e127a377c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fopen-gnu.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b721d25fb290c5e54cc88f45641bdd858bc2d908
--- /dev/null
@@ -0,0 +1,88 @@
+/* Test of opening a file stream.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-fopen-gnu.t"
+
+/* 0x1a is an EOF on Windows.  */
+#define DATA "abc\x1axyz"
+
+int
+main (void)
+{
+  FILE *f;
+  int fd;
+  int flags;
+  char buf[16];
+
+  /* Remove anything from prior partial run.  */
+  unlink (BASE "file");
+  unlink (BASE "binary");
+
+  /* Create the file.  */
+  f = fopen (BASE "file", "w");
+  ASSERT (f);
+  fd = fileno (f);
+  ASSERT (fd >= 0);
+  flags = fcntl (fd, F_GETFD);
+  ASSERT (flags >= 0);
+  ASSERT ((flags & FD_CLOEXEC) == 0);
+  ASSERT (fclose (f) == 0);
+
+  /* Create the file and check the 'e' mode.  */
+  f = fopen (BASE "file", "we");
+  ASSERT (f);
+  fd = fileno (f);
+  ASSERT (fd >= 0);
+  flags = fcntl (fd, F_GETFD);
+  ASSERT (flags >= 0);
+  ASSERT ((flags & FD_CLOEXEC) != 0);
+  ASSERT (fclose (f) == 0);
+
+  /* Open the file and check the 'x' mode.  */
+  f = fopen (BASE "file", "ax");
+  ASSERT (f == NULL);
+  ASSERT (errno == EEXIST);
+
+  /* Open a binary file and check that the 'e' mode doesn't interfere.  */
+  f = fopen (BASE "binary", "wbe");
+  ASSERT (f);
+  ASSERT (fwrite (DATA, 1, sizeof (DATA)-1, f) == sizeof (DATA)-1);
+  ASSERT (fclose (f) == 0);
+
+  f = fopen (BASE "binary", "rbe");
+  ASSERT (f);
+  ASSERT (fread (buf, 1, sizeof (buf), f) == sizeof (DATA)-1);
+  ASSERT (fclose (f) == 0);
+
+  /* Cleanup.  */
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (unlink (BASE "binary") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 246a0cbbfed2095f70205b2cced67fe98fa53354..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fopen-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..47ea0d16a5c157d054fd9d61312a2dfe8a199431
--- /dev/null
@@ -0,0 +1,31 @@
+/* Test of opening a file stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "stdio--.h"
+
+#define BASE "test-fopen-safer.t"
+
+#include "test-fopen.h"
+
+int
+main (void)
+{
+  return test_fopen ();
+}
deleted file mode 120000 (symlink)
index cca937f1fdbae379ade41efb57c5b4ed38d2e58d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fopen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e687de1a2c4a9c56085f9911522d58bcc62d9bea
--- /dev/null
@@ -0,0 +1,34 @@
+/* Test of opening a file stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fopen, FILE *, (char const *, char const *));
+
+#define BASE "test-fopen.t"
+
+#include "test-fopen.h"
+
+int
+main (void)
+{
+  return test_fopen ();
+}
deleted file mode 120000 (symlink)
index 3b49dff579e4cabf93c0af2c7cbd4b1dbc0b0c35..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fopen.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..526736222495b7ea1dea7813751c21acf736f28c
--- /dev/null
@@ -0,0 +1,94 @@
+/* Test of opening a file stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+/* Include <config.h> and a form of <stdio.h> first.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+/* Tell GCC not to warn about the specific edge cases tested here.  */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic ignored "-Wanalyzer-file-leak"
+#endif
+
+/* Test fopen.  Assumes BASE is defined.  */
+
+static int
+test_fopen (void)
+{
+  FILE *f;
+  /* Remove anything from prior partial run.  */
+  unlink (BASE "file");
+
+  /* Read requires existing file.  */
+  errno = 0;
+  ASSERT (fopen (BASE "file", "r") == NULL);
+  ASSERT (errno == ENOENT);
+
+  /* Write can create a file.  */
+  f = fopen (BASE "file", "w");
+  ASSERT (f);
+  ASSERT (fclose (f) == 0);
+
+  /* Trailing slash is invalid on non-directory.  */
+  errno = 0;
+  ASSERT (fopen (BASE "file/", "r") == NULL);
+  ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL);
+
+  errno = 0;
+  ASSERT (fopen (BASE "file/", "r+") == NULL);
+  ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL);
+
+  /* Cannot create a directory.  */
+  errno = 0;
+  ASSERT (fopen ("nonexist.ent/", "w") == NULL);
+  ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT
+          || errno == EINVAL);
+
+  /* Directories cannot be opened for writing.  */
+  errno = 0;
+  ASSERT (fopen (".", "w") == NULL);
+  ASSERT (errno == EISDIR || errno == EINVAL || errno == EACCES);
+
+  errno = 0;
+  ASSERT (fopen ("./", "w") == NULL);
+  ASSERT (errno == EISDIR || errno == EINVAL || errno == EACCES);
+
+  errno = 0;
+  ASSERT (fopen (".", "r+") == NULL);
+  ASSERT (errno == EISDIR || errno == EINVAL || errno == EACCES);
+
+  errno = 0;
+  ASSERT (fopen ("./", "r+") == NULL);
+  ASSERT (errno == EISDIR || errno == EINVAL || errno == EACCES);
+
+  /* /dev/null must exist, and be writable.  */
+  f = fopen ("/dev/null", "r");
+  ASSERT (f);
+  ASSERT (fclose (f) == 0);
+  f = fopen ("/dev/null", "w");
+  ASSERT (f);
+  ASSERT (fclose (f) == 0);
+
+  /* Cleanup.  */
+  ASSERT (unlink (BASE "file") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 1a74d5aa9d602f359d567e16328cad71ea2f21e9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fpending.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..242c7a8754dff480566f256a9330d2eb4d988140
--- /dev/null
@@ -0,0 +1,41 @@
+/* Ensure that __fpending works.
+
+   Copyright (C) 2004, 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "fpending.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  ASSERT (__fpending (stdout) == 0);
+
+  fputs ("foo", stdout);
+  ASSERT (__fpending (stdout) == 3);
+
+  fflush (stdout);
+  ASSERT (__fpending (stdout) == 0);
+
+  exit (0);
+}
deleted file mode 120000 (symlink)
index fa086951af6fcbde5f2ff78e7af22a29edb43be8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fpending.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..4acd60a9f577f371b74873bc51540d5d0f7ba1ed
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+tmpfile=
+trap 'rm -fr $tmpfile' HUP INT QUIT TERM
+
+tmpfile=test-fpending.t
+
+${CHECKER} ./test-fpending${EXEEXT} > $tmpfile || exit 1
+
+rm -fr $tmpfile
+
+exit 0
deleted file mode 120000 (symlink)
index 0d07255c80665f4135abf8737c3fd02962895d41..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fprintf-posix.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d36305b14569c59c8f83f1bc7a28d58832759903
--- /dev/null
@@ -0,0 +1,153 @@
+/* Test of POSIX compatible vsprintf() and sprintf() functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include "infinity.h"
+
+static void
+test_function (int (*my_fprintf) (FILE *, const char *, ...))
+{
+  /* Here we don't test output that may be platform dependent.
+     The bulk of the tests is done as part of the 'vasnprintf-posix' module.  */
+
+  /* Test support of size specifiers as in C99.  */
+
+  my_fprintf (stdout, "%ju %d\n", (uintmax_t) 12345671, 33, 44, 55);
+
+  my_fprintf (stdout, "%zu %d\n", (size_t) 12345672, 33, 44, 55);
+
+  my_fprintf (stdout, "%tu %d\n", (ptrdiff_t) 12345673, 33, 44, 55);
+
+  /* Test the support of the 'a' and 'A' conversion specifier for hexadecimal
+     output of floating-point numbers.  */
+
+  /* Positive zero.  */
+  my_fprintf (stdout, "%a %d\n", 0.0, 33, 44, 55);
+
+  /* Positive infinity.  */
+  my_fprintf (stdout, "%a %d\n", Infinityd (), 33, 44, 55);
+
+  /* Negative infinity.  */
+  my_fprintf (stdout, "%a %d\n", - Infinityd (), 33, 44, 55);
+
+  /* FLAG_ZERO with infinite number.  */
+  my_fprintf (stdout, "%010a %d\n", Infinityd (), 33, 44, 55);
+
+  /* Test the support of the %f format directive.  */
+
+  /* A positive number.  */
+  my_fprintf (stdout, "%f %d\n", 12.75, 33, 44, 55);
+
+  /* A larger positive number.  */
+  my_fprintf (stdout, "%f %d\n", 1234567.0, 33, 44, 55);
+
+  /* A negative number.  */
+  my_fprintf (stdout, "%f %d\n", -0.03125, 33, 44, 55);
+
+  /* Positive zero.  */
+  my_fprintf (stdout, "%f %d\n", 0.0, 33, 44, 55);
+
+  /* FLAG_ZERO.  */
+  my_fprintf (stdout, "%015f %d\n", 1234.0, 33, 44, 55);
+
+  /* Precision.  */
+  my_fprintf (stdout, "%.f %d\n", 1234.0, 33, 44, 55);
+
+  /* Precision with no rounding.  */
+  my_fprintf (stdout, "%.2f %d\n", 999.95, 33, 44, 55);
+
+  /* Precision with rounding.  */
+  my_fprintf (stdout, "%.2f %d\n", 999.996, 33, 44, 55);
+
+  /* A positive number.  */
+  my_fprintf (stdout, "%Lf %d\n", 12.75L, 33, 44, 55);
+
+  /* A larger positive number.  */
+  my_fprintf (stdout, "%Lf %d\n", 1234567.0L, 33, 44, 55);
+
+  /* A negative number.  */
+  my_fprintf (stdout, "%Lf %d\n", -0.03125L, 33, 44, 55);
+
+  /* Positive zero.  */
+  my_fprintf (stdout, "%Lf %d\n", 0.0L, 33, 44, 55);
+
+  /* FLAG_ZERO.  */
+  my_fprintf (stdout, "%015Lf %d\n", 1234.0L, 33, 44, 55);
+
+  /* Precision.  */
+  my_fprintf (stdout, "%.Lf %d\n", 1234.0L, 33, 44, 55);
+
+  /* Precision with no rounding.  */
+  my_fprintf (stdout, "%.2Lf %d\n", 999.95L, 33, 44, 55);
+
+  /* Precision with rounding.  */
+  my_fprintf (stdout, "%.2Lf %d\n", 999.996L, 33, 44, 55);
+
+  /* Test the support of the %F format directive.  */
+
+  /* A positive number.  */
+  my_fprintf (stdout, "%F %d\n", 12.75, 33, 44, 55);
+
+  /* A larger positive number.  */
+  my_fprintf (stdout, "%F %d\n", 1234567.0, 33, 44, 55);
+
+  /* A negative number.  */
+  my_fprintf (stdout, "%F %d\n", -0.03125, 33, 44, 55);
+
+  /* Positive zero.  */
+  my_fprintf (stdout, "%F %d\n", 0.0, 33, 44, 55);
+
+  /* FLAG_ZERO.  */
+  my_fprintf (stdout, "%015F %d\n", 1234.0, 33, 44, 55);
+
+  /* Precision.  */
+  my_fprintf (stdout, "%.F %d\n", 1234.0, 33, 44, 55);
+
+  /* Precision with no rounding.  */
+  my_fprintf (stdout, "%.2F %d\n", 999.95, 33, 44, 55);
+
+  /* Precision with rounding.  */
+  my_fprintf (stdout, "%.2F %d\n", 999.996, 33, 44, 55);
+
+  /* A positive number.  */
+  my_fprintf (stdout, "%LF %d\n", 12.75L, 33, 44, 55);
+
+  /* A larger positive number.  */
+  my_fprintf (stdout, "%LF %d\n", 1234567.0L, 33, 44, 55);
+
+  /* A negative number.  */
+  my_fprintf (stdout, "%LF %d\n", -0.03125L, 33, 44, 55);
+
+  /* Positive zero.  */
+  my_fprintf (stdout, "%LF %d\n", 0.0L, 33, 44, 55);
+
+  /* FLAG_ZERO.  */
+  my_fprintf (stdout, "%015LF %d\n", 1234.0L, 33, 44, 55);
+
+  /* Precision.  */
+  my_fprintf (stdout, "%.LF %d\n", 1234.0L, 33, 44, 55);
+
+  /* Precision with no rounding.  */
+  my_fprintf (stdout, "%.2LF %d\n", 999.95L, 33, 44, 55);
+
+  /* Precision with rounding.  */
+  my_fprintf (stdout, "%.2LF %d\n", 999.996L, 33, 44, 55);
+
+  /* Test the support of the POSIX/XSI format strings with positions.  */
+
+  my_fprintf (stdout, "%2$d %1$d\n", 33, 55);
+}
deleted file mode 120000 (symlink)
index 30f893986a0f61f4db2a4925dbc962850d2781fd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fpurge.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6878509882ee971fef9942b35b826f3ede2ed91e
--- /dev/null
@@ -0,0 +1,134 @@
+/* Test of fpurge() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include <string.h>
+
+#include "macros.h"
+
+#define TESTFILE "t-fpurge.tmp"
+
+int
+main (void)
+{
+  int check_filepos;
+
+  for (check_filepos = 0; check_filepos <= 1; check_filepos++)
+    {
+      FILE *fp;
+
+      /* Create a file with some contents.  */
+      fp = fopen (TESTFILE, "w");
+      if (fp == NULL)
+        goto skip;
+      if (fwrite ("foobarsh", 1, 8, fp) < 8)
+        goto skip;
+      if (fclose (fp))
+        goto skip;
+
+      /* The file's contents is now "foobarsh".  */
+
+      /* Open it in read-write mode.  */
+      fp = fopen (TESTFILE, "r+");
+      if (fp == NULL)
+        goto skip;
+      if (fseek (fp, 3, SEEK_CUR))
+        goto skip;
+      if (fwrite ("g", 1, 1, fp) < 1)
+        goto skip;
+      if (fflush (fp))
+        goto skip;
+      if (fwrite ("bz", 1, 2, fp) < 2)
+        goto skip;
+      /* Discard pending write.  */
+      ASSERT (fpurge (fp) == 0);
+      /* Verify that when discarding pending output, the file position is set
+         back to where it was before the write calls.  */
+      if (check_filepos)
+        ASSERT (ftell (fp) == 4);
+      ASSERT (fclose (fp) == 0);
+
+      /* Open it in read-only mode.  */
+      fp = fopen (TESTFILE, "r");
+      if (fp == NULL)
+        goto skip;
+      /* Verify that the pending writes before the fpurge were really
+         discarded.  */
+      {
+        char buf[8];
+        if (fread (buf, 1, 7, fp) < 7)
+          goto skip;
+        ASSERT (memcmp (buf, "foogars", 7) == 0);
+      }
+      /* Discard the buffered 'h'.  */
+      if (check_filepos)
+        ASSERT (ftell (fp) == 7);
+      ASSERT (fpurge (fp) == 0);
+      /* Verify that when discarding pending input, the file position is
+         advanced to match the end of the previously read input.  */
+      if (check_filepos)
+        ASSERT (ftell (fp) == 8);
+      ASSERT (getc (fp) == EOF);
+      ASSERT (fclose (fp) == 0);
+
+      /* The file's contents is now "foogarsh".  */
+
+      /* Ensure that purging a read does not corrupt subsequent writes.  */
+      fp = fopen (TESTFILE, "r+");
+      if (fp == NULL)
+        goto skip;
+      if (fseek (fp, -1, SEEK_END))
+        goto skip;
+      ASSERT (getc (fp) == 'h');
+      ASSERT (getc (fp) == EOF);
+      if (check_filepos)
+        ASSERT (ftell (fp) == 8);
+      ASSERT (fpurge (fp) == 0);
+      if (check_filepos)
+        ASSERT (ftell (fp) == 8);
+      ASSERT (putc ('!', fp) == '!');
+      if (check_filepos)
+        ASSERT (ftell (fp) == 9);
+      ASSERT (fclose (fp) == 0);
+      fp = fopen (TESTFILE, "r");
+      if (fp == NULL)
+        goto skip;
+      {
+        char buf[10];
+        ASSERT (fread (buf, 1, 10, fp) == 9);
+        ASSERT (memcmp (buf, "foogarsh!", 9) == 0);
+      }
+      ASSERT (fclose (fp) == 0);
+
+      /* The file's contents is now "foogarsh!".  */
+    }
+
+  remove (TESTFILE);
+  return 0;
+
+ skip:
+  fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
+  remove (TESTFILE);
+  return 77;
+}
deleted file mode 120000 (symlink)
index 4e8854c87a35e51c681d7b3568d0bcdc23a0a609..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fputc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0d48a92fbc0f6b2169455091b24a5c25e03f3309
--- /dev/null
@@ -0,0 +1,95 @@
+/* Test of fputc() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fputc, int, (int, FILE *));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#include "macros.h"
+
+int
+main ()
+{
+  const char *filename = "test-fputc.txt";
+
+  /* We don't have an fputc() function that installs an invalid parameter
+     handler so far.  So install that handler here, explicitly.  */
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
+    && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
+  gl_msvc_inval_ensure_handler ();
+#endif
+
+  /* Test that fputc() on an unbuffered stream sets errno if someone else
+     closes the stream fd behind the back of stdio.  */
+  #if !defined __ANDROID__ /* fdsan */
+  {
+    FILE *fp = fopen (filename, "w");
+    ASSERT (fp != NULL);
+    setvbuf (fp, NULL, _IONBF, 0);
+    ASSERT (close (fileno (fp)) == 0);
+    errno = 0;
+    ASSERT (fputc ('x', fp) == EOF);
+    ASSERT (errno == EBADF);
+    ASSERT (ferror (fp));
+    fclose (fp);
+  }
+  #endif
+
+  /* Test that fputc() on an unbuffered stream sets errno if the stream
+     was constructed with an invalid file descriptor.  */
+  {
+    FILE *fp = fdopen (-1, "w");
+    if (fp != NULL)
+      {
+        setvbuf (fp, NULL, _IONBF, 0);
+        errno = 0;
+        ASSERT (fputc ('x', fp) == EOF);
+        ASSERT (errno == EBADF);
+        ASSERT (ferror (fp));
+        fclose (fp);
+      }
+  }
+  {
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "w");
+    if (fp != NULL)
+      {
+        setvbuf (fp, NULL, _IONBF, 0);
+        errno = 0;
+        ASSERT (fputc ('x', fp) == EOF);
+        ASSERT (errno == EBADF);
+        ASSERT (ferror (fp));
+        fclose (fp);
+      }
+  }
+
+  /* Clean up.  */
+  unlink (filename);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 226df2694c1307705542cf362648ed815fe92e84..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fread.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ac6bdecf4078c8990271203fb0a0ec4bcba71120
--- /dev/null
@@ -0,0 +1,104 @@
+/* Test of fread() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fread, size_t, (void *, size_t, size_t, FILE *));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#include "macros.h"
+
+int
+main ()
+{
+  const char *filename = "test-fread.txt";
+
+  /* We don't have an fread() function that installs an invalid parameter
+     handler so far.  So install that handler here, explicitly.  */
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
+    && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
+  gl_msvc_inval_ensure_handler ();
+#endif
+
+  /* Prepare a file.  */
+  {
+    const char text[] = "hello world";
+    int fd = open (filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
+    ASSERT (fd >= 0);
+    ASSERT (write (fd, text, sizeof (text)) == sizeof (text));
+    ASSERT (close (fd) == 0);
+  }
+
+  /* Test that fread() sets errno if someone else closes the stream
+     fd behind the back of stdio.  */
+  #if !defined __ANDROID__ /* fdsan */
+  {
+    FILE *fp = fopen (filename, "r");
+    char buf[5];
+    ASSERT (fp != NULL);
+    ASSERT (close (fileno (fp)) == 0);
+    errno = 0;
+    ASSERT (fread (buf, 1, sizeof (buf), fp) == 0);
+    ASSERT (errno == EBADF);
+    ASSERT (ferror (fp));
+    fclose (fp);
+  }
+  #endif
+
+  /* Test that fread() sets errno if the stream was constructed with
+     an invalid file descriptor.  */
+  {
+    FILE *fp = fdopen (-1, "r");
+    if (fp != NULL)
+      {
+        char buf[1];
+        errno = 0;
+        ASSERT (fread (buf, 1, 1, fp) == 0);
+        ASSERT (errno == EBADF);
+        ASSERT (ferror (fp));
+        fclose (fp);
+      }
+  }
+  {
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "r");
+    if (fp != NULL)
+      {
+        char buf[1];
+        errno = 0;
+        ASSERT (fread (buf, 1, 1, fp) == 0);
+        ASSERT (errno == EBADF);
+        ASSERT (ferror (fp));
+        fclose (fp);
+      }
+  }
+
+  /* Clean up.  */
+  unlink (filename);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 0f14ebf8054eef35dc90131f3f70ffe6f507c851..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freadahead.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b7a5e7c4ff50b25eddfd9e2069137f6e738d48fd
--- /dev/null
@@ -0,0 +1,77 @@
+/* Test of freadahead() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "freadahead.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (int argc, char **argv)
+{
+  int nbytes = atoi (argv[1]);
+  if (nbytes > 0)
+    {
+      void *buf = malloc (nbytes);
+      ASSERT (fread (buf, 1, nbytes, stdin) == nbytes);
+      free (buf);
+    }
+
+  if (nbytes == 0)
+    ASSERT (freadahead (stdin) == 0);
+  else
+    {
+      if (lseek (0, 0, SEEK_CUR) == nbytes)
+        /* An unbuffered stdio, such as BeOS or on uClibc compiled without
+           __STDIO_BUFFERS.  */
+        ASSERT (freadahead (stdin) == 0);
+      else
+        {
+          /* Normal buffered stdio.  */
+          size_t buffered;
+          int c, c2;
+
+          ASSERT (freadahead (stdin) != 0);
+          buffered = freadahead (stdin);
+
+          c = fgetc (stdin);
+          ASSERT (freadahead (stdin) == buffered - 1);
+          ungetc (c, stdin);
+          ASSERT (freadahead (stdin) == buffered);
+          c2 = fgetc (stdin);
+          ASSERT (c2 == c);
+          ASSERT (freadahead (stdin) == buffered - 1);
+
+          c = '@';
+          ungetc (c, stdin);
+          ASSERT (freadahead (stdin) == buffered);
+          c2 = fgetc (stdin);
+          ASSERT (c2 == c);
+          ASSERT (freadahead (stdin) == buffered - 1);
+        }
+    }
+
+  /* Free memory allocated during ungetc().  */
+  fclose (stdin);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index baff5964748e505bf2890f549c881f8ddb8bd67a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freadahead.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..f420000cfb0ebca52903c82abee421a5b8357047
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-freadahead${EXEEXT} 0 < "$srcdir/test-freadahead.sh" || exit 1
+${CHECKER} ./test-freadahead${EXEEXT} 5 < "$srcdir/test-freadahead.sh" || exit 1
+exit 0
deleted file mode 120000 (symlink)
index aaa77aa16b5bbd4e3279f3e4b9784b94af62d51f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freading.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..15dd28736d5802251ed1bfc0e304d78f9e3aa91c
--- /dev/null
@@ -0,0 +1,130 @@
+/* Test of freading() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
+#include "freading.h"
+
+#include <stdio.h>
+
+#include "macros.h"
+
+#define TESTFILE "t-freading.tmp"
+
+int
+main (void)
+{
+  FILE *fp;
+
+  /* Create a file with some contents.  Write-only file is never reading.  */
+  fp = fopen (TESTFILE, "w");
+  ASSERT (fp);
+  ASSERT (!freading (fp));
+  ASSERT (fwrite ("foobarsh", 1, 8, fp) == 8);
+  ASSERT (!freading (fp));
+  ASSERT (fclose (fp) == 0);
+
+  /* Open it in read-only mode.  Read-only file is always reading.  */
+  fp = fopen (TESTFILE, "r");
+  ASSERT (fp);
+  ASSERT (freading (fp));
+  ASSERT (fgetc (fp) == 'f');
+  ASSERT (freading (fp));
+  ASSERT (fseek (fp, 2, SEEK_CUR) == 0);
+  ASSERT (freading (fp));
+  ASSERT (fgetc (fp) == 'b');
+  ASSERT (freading (fp));
+  fflush (fp);
+  ASSERT (freading (fp));
+  ASSERT (fgetc (fp) == 'a');
+  ASSERT (freading (fp));
+  ASSERT (fseek (fp, 0, SEEK_END) == 0);
+  ASSERT (freading (fp));
+  ASSERT (fclose (fp) == 0);
+
+  /* Open it in read-write mode.  POSIX requires a reposition (fseek,
+     fsetpos, rewind) or EOF when transitioning from read to write;
+     freading is only deterministic after input or output, but this
+     test case should be portable even on open, after reposition, and
+     at EOF.  */
+  /* First a scenario with only fgetc, fseek, fputc.  */
+  fp = fopen (TESTFILE, "r+");
+  ASSERT (fp);
+  ASSERT (!freading (fp));
+  ASSERT (fgetc (fp) == 'f');
+  ASSERT (freading (fp));
+  ASSERT (fseek (fp, 2, SEEK_CUR) ==  0);
+  /* freading (fp) is undefined here, but fwriting (fp) is false.  */
+  ASSERT (fgetc (fp) == 'b');
+  ASSERT (freading (fp));
+  /* This fseek call is necessary when switching from reading to writing.
+     See the description of fopen(), ISO C 99 7.19.5.3.(6).  */
+  ASSERT (fseek (fp, 0, SEEK_CUR) == 0);
+  /* freading (fp) is undefined here, but fwriting (fp) is false.  */
+  ASSERT (fputc ('x', fp) == 'x');
+  ASSERT (!freading (fp));
+  ASSERT (fseek (fp, 0, SEEK_END) == 0);
+  /* freading (fp) is undefined here, because on some implementations (e.g.
+     glibc) fseek causes a buffer to be read.
+     fwriting (fp) is undefined as well.  */
+  ASSERT (fclose (fp) == 0);
+
+  /* Open it in read-write mode.  POSIX requires a reposition (fseek,
+     fsetpos, rewind) or EOF when transitioning from read to write;
+     freading is only deterministic after input or output, but this
+     test case should be portable even on open, after reposition, and
+     at EOF.  */
+  /* Here a scenario that includes fflush.  */
+  fp = fopen (TESTFILE, "r+");
+  ASSERT (fp);
+  ASSERT (!freading (fp));
+  ASSERT (fgetc (fp) == 'f');
+  ASSERT (freading (fp));
+  ASSERT (fseek (fp, 2, SEEK_CUR) == 0);
+  /* freading (fp) is undefined here, but fwriting (fp) is false.  */
+  ASSERT (fgetc (fp) == 'b');
+  ASSERT (freading (fp));
+  fflush (fp);
+  /* freading (fp) is undefined here, but fwriting (fp) is false.  */
+  ASSERT (fgetc (fp) == 'x');
+  ASSERT (freading (fp));
+  /* This fseek call is necessary when switching from reading to writing.
+     See the description of fopen(), ISO C 99 7.19.5.3.(6).  */
+  ASSERT (fseek (fp, 0, SEEK_CUR) == 0);
+  /* freading (fp) is undefined here, but fwriting (fp) is false.  */
+  ASSERT (fputc ('z', fp) == 'z');
+  ASSERT (!freading (fp));
+  ASSERT (fseek (fp, 0, SEEK_END) == 0);
+  /* freading (fp) is undefined here, because on some implementations (e.g.
+     glibc) fseek causes a buffer to be read.
+     fwriting (fp) is undefined as well.  */
+  ASSERT (fclose (fp) == 0);
+
+  /* Open it in append mode.  Write-only file is never reading.  */
+  fp = fopen (TESTFILE, "a");
+  ASSERT (fp);
+  ASSERT (!freading (fp));
+  ASSERT (fwrite ("bla", 1, 3, fp) == 3);
+  ASSERT (!freading (fp));
+  ASSERT (fclose (fp) == 0);
+  ASSERT (remove (TESTFILE) == 0);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5bd68a30e375ccb4bfee4c1c8c5b232563c58bd3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freadptr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..34a56cd6b7ce321747107140a34a08178917272a
--- /dev/null
@@ -0,0 +1,100 @@
+/* Test of freadptr() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include "freadptr.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (int argc, char **argv)
+{
+  int nbytes = atoi (argv[1]);
+  {
+    void *buf = malloc (nbytes);
+    ASSERT (fread (buf, 1, nbytes, stdin) == nbytes);
+    free (buf);
+  }
+
+  if (lseek (0, 0, SEEK_CUR) == nbytes)
+    {
+      /* An unbuffered stdio, such as BeOS or on uClibc compiled without
+         __STDIO_BUFFERS.  Or stdin is a pipe.  */
+      size_t size;
+      ASSERT (freadptr (stdin, &size) == NULL);
+    }
+  else
+    {
+      /* Normal buffered stdio.  */
+      const char stdin_contents[] =
+        "#!/bin/sh\n\n${CHECKER} ./test-freadptr${EXEEXT} 5 < \"$srcdir/test-freadptr.sh\" || exit 1\ncat \"$srcdir/test-freadptr.sh\" | ${CHECKER} ./test-freadptr${EXEEXT} 5 || exit 1\nexit 0\n";
+      const char *expected = stdin_contents + nbytes;
+      size_t available1;
+      size_t available2;
+      size_t available3;
+
+      /* Test normal behaviour.  */
+      {
+        const char *ptr = freadptr (stdin, &available1);
+
+        ASSERT (ptr != NULL);
+        ASSERT (available1 != 0);
+        ASSERT (available1 <= strlen (expected));
+        ASSERT (memcmp (ptr, expected, available1) == 0);
+      }
+
+      /* Test behaviour after normal ungetc.  */
+      ungetc (fgetc (stdin), stdin);
+      {
+        const char *ptr = freadptr (stdin, &available2);
+
+        if (ptr != NULL)
+          {
+            ASSERT (available2 == available1);
+            ASSERT (memcmp (ptr, expected, available2) == 0);
+          }
+      }
+
+      /* Test behaviour after arbitrary ungetc.  */
+      fgetc (stdin);
+      ungetc ('@', stdin);
+      {
+        const char *ptr = freadptr (stdin, &available3);
+
+        if (ptr != NULL)
+          {
+            ASSERT (available3 == 1 || available3 == available1);
+            ASSERT (ptr[0] == '@');
+            if (available3 > 1)
+              {
+                ASSERT (memcmp (ptr + 1, expected + 1, available3 - 1) == 0);
+              }
+          }
+      }
+    }
+
+  /* Free memory allocated during ungetc().  */
+  fclose (stdin);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 4c517005d6a65c48da47cd18f37b9bc7ef01dc6f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freadptr.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..0917fa37cc938b71d1c70840f0e815e549b504d0
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-freadptr${EXEEXT} 5 < "$srcdir/test-freadptr.sh" || exit 1
+cat "$srcdir/test-freadptr.sh" | ${CHECKER} ./test-freadptr${EXEEXT} 5 || exit 1
+exit 0
deleted file mode 120000 (symlink)
index 109c82b41e4241b59cbd1d03e4fa762c0565b11a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freadptr2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3ece18c2128daec39079ac7f9863726c33e1a75b
--- /dev/null
@@ -0,0 +1,63 @@
+/* Test of freadptr() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "freadptr.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+static int
+freadptrbufsize (FILE *fp)
+{
+  size_t size = 0;
+
+  freadptr (fp, &size);
+  return size;
+}
+
+int
+main (int argc, char **argv)
+{
+  int nbytes = atoi (argv[1]);
+  if (nbytes > 0)
+    {
+      void *buf = malloc (nbytes);
+      ASSERT (fread (buf, 1, nbytes, stdin) == nbytes);
+      free (buf);
+    }
+
+  if (nbytes == 0)
+    ASSERT (freadptrbufsize (stdin) == 0);
+  else
+    {
+      if (lseek (0, 0, SEEK_CUR) == nbytes)
+        /* An unbuffered stdio, such as BeOS or on uClibc compiled without
+           __STDIO_BUFFERS.  */
+        ASSERT (freadptrbufsize (stdin) == 0);
+      else
+        /* Normal buffered stdio.  */
+        ASSERT (freadptrbufsize (stdin) != 0);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c89794edac749cdee7f13acc6fcaedf76d834198..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freadptr2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..f429f38eeafd1dc9a28aaf644fedfec4787875f9
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-freadptr2${EXEEXT} 0 < "$srcdir/test-freadptr2.sh" || exit 1
+${CHECKER} ./test-freadptr2${EXEEXT} 5 < "$srcdir/test-freadptr2.sh" || exit 1
+exit 0
deleted file mode 120000 (symlink)
index f0ce3b0341b2179fe390652e3f1be2eb64e3ad4d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freadseek.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..da729e90ad5494d2d7d578783498b7748fb7d8cc
--- /dev/null
@@ -0,0 +1,98 @@
+/* Test of freadseek() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include "freadseek.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (int argc, char **argv)
+{
+  static const char stdin_contents[] =
+    "#!/bin/sh\n\n${CHECKER} ./test-freadseek${EXEEXT} 5 19 6 7 18 9 19 < \"$srcdir/test-freadseek.sh\" || exit 1\ncat \"$srcdir/test-freadseek.sh\" | ${CHECKER} ./test-freadseek${EXEEXT} 5 19 6 7 18 9 19 || exit 1\nexit 0\n";
+  int nbytes1 = atoi (argv[1]);
+  int nbytes2 = atoi (argv[2]);
+  int nbytes3 = atoi (argv[3]);
+  int nbytes4 = atoi (argv[4]);
+  int nbytes5 = atoi (argv[5]);
+  int nbytes6 = atoi (argv[6]);
+  int nbytes7 = atoi (argv[7]);
+  void *buf1 = malloc (nbytes1);
+  void *buf3 = malloc (nbytes3);
+  void *buf5 = malloc (nbytes5);
+  void *buf7 = malloc (nbytes7);
+  /* A private variable to keep track of the position.  */
+  size_t position = 0;
+
+  ASSERT (fread (buf1, 1, nbytes1, stdin) == nbytes1);
+  ASSERT (memcmp (buf1, stdin_contents + position, nbytes1) == 0);
+  position += nbytes1;
+
+  /* Test normal behaviour.  */
+  ASSERT (freadseek (stdin, nbytes2) == 0);
+  position += nbytes2;
+
+  ASSERT (fread (buf3, 1, nbytes3, stdin) == nbytes3);
+  ASSERT (memcmp (buf3, stdin_contents + position, nbytes3) == 0);
+  position += nbytes3;
+
+  /* Test behaviour after normal ungetc.  */
+  ungetc (fgetc (stdin), stdin);
+  ASSERT (freadseek (stdin, nbytes4) == 0);
+  position += nbytes4;
+
+  ASSERT (fread (buf5, 1, nbytes5, stdin) == nbytes5);
+  ASSERT (memcmp (buf5, stdin_contents + position, nbytes5) == 0);
+  position += nbytes5;
+
+  /* Test behaviour after arbitrary ungetc.  */
+  fgetc (stdin);
+  ungetc ('@', stdin);
+  ASSERT (freadseek (stdin, nbytes6) == 0);
+  position += nbytes6;
+
+  ASSERT (fread (buf7, 1, nbytes7, stdin) == nbytes7);
+  ASSERT (memcmp (buf7, stdin_contents + position, nbytes7) == 0);
+  position += nbytes7;
+
+  /* Test move to end of file.  */
+  ASSERT (freadseek (stdin, strlen (stdin_contents) - position) == 0);
+  ASSERT (fgetc (stdin) == EOF);
+  ASSERT (!ferror (stdin));
+
+#if !defined __MINT__ /* FreeMiNT has problems seeking past end of file */
+  /* Test move beyond end of file.  */
+  ASSERT (freadseek (stdin, 1000000) == 0);
+  ASSERT (fgetc (stdin) == EOF);
+  ASSERT (!ferror (stdin));
+#endif
+
+  free (buf7);
+  free (buf5);
+  free (buf3);
+  free (buf1);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 2ac75ff324f2b676eb1e3b2b34bbca289acec692..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freadseek.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..892520466ca81bdcf7bbd81fd4d1e696fcd4ef2d
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-freadseek${EXEEXT} 5 19 6 7 18 9 19 < "$srcdir/test-freadseek.sh" || exit 1
+cat "$srcdir/test-freadseek.sh" | ${CHECKER} ./test-freadseek${EXEEXT} 5 19 6 7 18 9 19 || exit 1
+exit 0
deleted file mode 120000 (symlink)
index bf52e38e9cdef8e03eb04a21ea379ef5bc42efd3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-free.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..703c550e0d713d830ba66d1d4bf2d2cc2a0a47ec
--- /dev/null
@@ -0,0 +1,175 @@
+/* Test of free() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#if defined __linux__
+# include <fcntl.h>
+# include <stdint.h>
+# include <string.h>
+# include <sys/mman.h>
+#endif
+
+#include "macros.h"
+
+/* The indirection through a volatile function pointer is necessary to prevent
+   a GCC optimization.  Without it, when optimizing, GCC would "know" that errno
+   is unchanged by calling free(ptr), when ptr was the result of a malloc(...)
+   call in the same function.  */
+static int
+get_errno (void)
+{
+  volatile int err = errno;
+  return err;
+}
+
+static int (* volatile get_errno_func) (void) = get_errno;
+
+int
+main ()
+{
+  /* Check that free() preserves errno.  */
+  {
+    errno = 1789; /* Liberté, égalité, fraternité.  */
+    free (NULL);
+    ASSERT_NO_STDIO (get_errno_func () == 1789);
+  }
+  { /* Small memory allocations.  */
+    #define N 10000
+    void * volatile ptrs[N];
+    size_t i;
+    for (i = 0; i < N; i++)
+      ptrs[i] = malloc (15);
+    for (i = 0; i < N; i++)
+      {
+        errno = 1789;
+        free (ptrs[i]);
+        ASSERT_NO_STDIO (get_errno_func () == 1789);
+      }
+    #undef N
+  }
+  { /* Medium memory allocations.  */
+    #define N 1000
+    void * volatile ptrs[N];
+    size_t i;
+    for (i = 0; i < N; i++)
+      ptrs[i] = malloc (729);
+    for (i = 0; i < N; i++)
+      {
+        errno = 1789;
+        free (ptrs[i]);
+        ASSERT_NO_STDIO (get_errno_func () == 1789);
+      }
+    #undef N
+  }
+  { /* Large memory allocations.  */
+    #define N 10
+    void * volatile ptrs[N];
+    size_t i;
+    for (i = 0; i < N; i++)
+      ptrs[i] = malloc (5318153);
+    for (i = 0; i < N; i++)
+      {
+        errno = 1789;
+        free (ptrs[i]);
+        ASSERT_NO_STDIO (get_errno_func () == 1789);
+      }
+    #undef N
+  }
+
+  /* Test a less common code path.
+     When malloc() is based on mmap(), free() can sometimes call munmap().
+     munmap() usually succeeds, but fails in a particular situation: when
+       - it has to unmap the middle part of a VMA, and
+       - the number of VMAs of a process is limited and the limit is
+         already reached.
+     The latter condition is fulfilled on Linux, when the file
+     /proc/sys/vm/max_map_count exists.  This file contains the limit
+       - for Linux >= 2.4.19: 65536 (DEFAULT_MAX_MAP_COUNT in linux/include/linux/sched.h)
+       - for Linux >= 2.6.31: 65530 (DEFAULT_MAX_MAP_COUNT in linux/include/linux/mm.h).
+     But do not test it with glibc < 2.15, since that triggers a glibc internal
+     abort: "malloc.c:3551: munmap_chunk: Assertion `ret == 0' failed."
+   */
+  #if defined __linux__ && !(__GLIBC__ == 2 && __GLIBC_MINOR__ < 15)
+  if (open ("/proc/sys/vm/max_map_count", O_RDONLY) >= 0)
+    {
+      /* Preparations.  */
+      size_t pagesize = getpagesize ();
+      void *firstpage_backup = malloc (pagesize);
+      void *lastpage_backup = malloc (pagesize);
+      /* Allocate a large memory area, as a bumper, so that the MAP_FIXED
+         allocation later will not overwrite parts of the memory areas
+         allocated to ld.so or libc.so.  */
+      void *bumper_region =
+        mmap (NULL, 0x1000000, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+      /* A file descriptor pointing to a regular file.  */
+      int fd = open ("test-free", O_RDONLY);
+
+      if (firstpage_backup != NULL && lastpage_backup != NULL
+          && bumper_region != (void *)(-1)
+          && fd >= 0)
+        {
+          /* Do a large memory allocation.  */
+          size_t big_size = 0x1000000;
+          void * volatile ptr = malloc (big_size - 0x100);
+          char *ptr_aligned = (char *) ((uintptr_t) ptr & ~(pagesize - 1));
+          /* This large memory allocation allocated a memory area
+             from ptr_aligned to ptr_aligned + big_size.
+             Enlarge this memory area by adding a page before and a page
+             after it.  */
+          memcpy (firstpage_backup, ptr_aligned, pagesize);
+          memcpy (lastpage_backup, ptr_aligned + big_size - pagesize, pagesize);
+          if (mmap (ptr_aligned - pagesize, pagesize + big_size + pagesize,
+                    PROT_READ | PROT_WRITE,
+                    MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0)
+              != (void *)(-1))
+            {
+              memcpy (ptr_aligned, firstpage_backup, pagesize);
+              memcpy (ptr_aligned + big_size - pagesize, lastpage_backup, pagesize);
+
+              /* Now add as many mappings as we can.
+                 Stop at 65536, in order not to crash the machine (in case the
+                 limit has been increased by the system administrator).  */
+              size_t i;
+              for (i = 0; i < 65536; i++)
+                if (mmap (NULL, pagesize, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0)
+                    == (void *)(-1))
+                  break;
+              /* Now the number of VMAs of this process has hopefully attained
+                 its limit.  */
+
+              errno = 1789;
+              /* This call to free() is supposed to call
+                   munmap (ptr_aligned, big_size);
+                 which increases the number of VMAs by 1, which is supposed
+                 to fail.  */
+              free (ptr);
+              ASSERT_NO_STDIO (get_errno_func () == 1789);
+            }
+        }
+    }
+  #endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3d168fd859c115cc0917ef2b958f9e8995402b74..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freopen-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..de4e89e67497566a52cea43323d34d529331c278
--- /dev/null
@@ -0,0 +1,97 @@
+/* Test of reopening a stream.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "stdio--.h"
+
+/* Helpers.  */
+#include <unistd.h>
+
+/* This test intentionally closes stderr.  So, we arrange to have fd 10
+   (outside the range of interesting fd's during the test) set up to
+   duplicate the original stderr.  */
+
+#define BACKUP_STDERR_FILENO 10
+#define ASSERT_STREAM myerr
+#include "macros.h"
+
+static FILE *myerr;
+
+int
+main (void)
+{
+  FILE *fp;
+
+  /* We close fd 2 later, so save it in fd 10.  */
+  if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
+      || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
+    return 2;
+
+  {
+    FILE *tmp;
+    ASSERT (tmp = fopen ("/dev/null", "r"));
+    ASSERT (STDERR_FILENO < fileno (tmp));
+    ASSERT (fp = fopen ("/dev/null", "w"));
+    ASSERT (fileno (tmp) < fileno (fp));
+    ASSERT (fclose (tmp) == 0);
+  }
+
+  /* Gap in fds.  */
+  ASSERT (freopen ("/dev/null", "r+", fp) == fp);
+  ASSERT (STDERR_FILENO < fileno (fp));
+
+  ASSERT (freopen ("/dev/null", "r", stdin) == stdin);
+  ASSERT (STDIN_FILENO == fileno (stdin));
+
+  ASSERT (freopen ("/dev/null", "w", stdout) == stdout);
+  ASSERT (STDOUT_FILENO == fileno (stdout));
+
+  ASSERT (freopen ("/dev/null", "w", stderr) == stderr);
+  ASSERT (STDERR_FILENO == fileno (stderr));
+
+  /* fd 0 closed.  */
+  ASSERT (close (STDIN_FILENO) == 0);
+
+  ASSERT (freopen ("/dev/null", "w", stdout) == stdout);
+  ASSERT (STDOUT_FILENO == fileno (stdout));
+
+  ASSERT (freopen ("/dev/null", "w", stderr) == stderr);
+  ASSERT (STDERR_FILENO == fileno (stderr));
+
+  ASSERT (freopen ("/dev/null", "a", fp) == fp);
+  ASSERT (STDERR_FILENO < fileno (fp));
+
+  /* fd 1 closed.  */
+  ASSERT (close (STDOUT_FILENO) == 0);
+
+  ASSERT (freopen ("/dev/null", "w", stderr) == stderr);
+  ASSERT (STDERR_FILENO == fileno (stderr));
+
+  ASSERT (freopen ("/dev/null", "a+", fp) == fp);
+  ASSERT (STDERR_FILENO < fileno (fp));
+
+  /* fd 2 closed.  */
+  ASSERT (close (STDERR_FILENO) == 0);
+
+  ASSERT (freopen ("/dev/null", "w+", fp) == fp);
+  ASSERT (STDERR_FILENO < fileno (fp));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 480003d3983dfc8e82c5d852c32a3c4d1f4de58a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-freopen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..54aa2f79aa6ba1b6ee429d7f73cfb486c1d5f835
--- /dev/null
@@ -0,0 +1,86 @@
+/* Test of opening a file stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (freopen, FILE *, (char const *, char const *, FILE *));
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  const char *filename = "test-freopen.txt";
+
+  close (STDIN_FILENO);
+  ASSERT (freopen ("/dev/null", "r", stdin) != NULL);
+  ASSERT (getchar () == EOF);
+  ASSERT (!ferror (stdin));
+  ASSERT (feof (stdin));
+
+#if 0 /* freopen (NULL, ...) is unsupported on most platforms.  */
+  /* Test that freopen() sets errno if someone else closes the stream
+     fd behind the back of stdio.  */
+  {
+    FILE *fp = fopen (filename, "w+");
+    ASSERT (fp != NULL);
+    ASSERT (close (fileno (fp)) == 0);
+    errno = 0;
+    ASSERT (freopen (NULL, "r", fp) == NULL);
+    perror("freopen");
+    ASSERT (errno == EBADF);
+    fclose (fp);
+  }
+
+  /* Test that freopen() sets errno if the stream was constructed with
+     an invalid file descriptor.  */
+  {
+    FILE *fp = fdopen (-1, "w+");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (freopen (NULL, "r", fp) == NULL);
+        ASSERT (errno == EBADF);
+        fclose (fp);
+      }
+  }
+  {
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "w+");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (freopen (NULL, "r", fp) == NULL);
+        ASSERT (errno == EBADF);
+        fclose (fp);
+      }
+  }
+#endif
+
+  /* Clean up.  */
+  unlink (filename);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 2b045798cb681187900243071eead12f8773865c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-frexp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3d6bc30028fab4030260c52bced4b56c5dba708e
--- /dev/null
@@ -0,0 +1,67 @@
+/* Test of splitting a double into fraction and mantissa.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (frexp, double, (double, int *));
+
+#include <float.h>
+
+#include "isnand-nolibm.h"
+#include "minus-zero.h"
+#include "infinity.h"
+#include "nan.h"
+#include "macros.h"
+
+/* Avoid some warnings from "gcc -Wshadow".
+   This file doesn't use the exp() function.  */
+#undef exp
+#define exp exponent
+
+#undef INFINITY
+#undef NAN
+
+#define DOUBLE double
+/* The use of 'volatile' guarantees that excess precision bits are dropped
+   when dealing with denormalized numbers.  It is necessary on x86 systems
+   where double-floats are not IEEE compliant by default, to avoid that the
+   results become platform and compiler option dependent.  'volatile' is a
+   portable alternative to gcc's -ffloat-store option.  */
+#define VOLATILE volatile
+#define ISNAN isnand
+#define INFINITY Infinityd ()
+#define NAN NaNd ()
+#define L_(literal) literal
+#define MINUS_ZERO minus_zerod
+#define MAX_EXP DBL_MAX_EXP
+#define MIN_EXP DBL_MIN_EXP
+#define MIN_NORMAL_EXP DBL_MIN_EXP
+#define FREXP frexp
+#define RANDOM randomd
+#include "test-frexp.h"
+
+int
+main ()
+{
+  test_function ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 20a1d9951b038550c286e44071f90d63e383b056..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-frexp.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..439c44efb289c9e43bd59527613321a293dff40e
--- /dev/null
@@ -0,0 +1,179 @@
+/* Test of splitting a double into fraction and mantissa.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+static DOUBLE
+my_ldexp (DOUBLE x, int d)
+{
+  for (; d > 0; d--)
+    x *= L_(2.0);
+  for (; d < 0; d++)
+    x *= L_(0.5);
+  return x;
+}
+
+static void
+test_function (void)
+{
+  int i;
+  VOLATILE DOUBLE x;
+
+  { /* NaN.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = NAN;
+    mantissa = FREXP (x, &exp);
+    ASSERT (ISNAN (mantissa));
+  }
+
+  { /* Positive infinity.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = INFINITY;
+    mantissa = FREXP (x, &exp);
+    ASSERT (mantissa == x);
+  }
+
+  { /* Negative infinity.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = - INFINITY;
+    mantissa = FREXP (x, &exp);
+    ASSERT (mantissa == x);
+  }
+
+  { /* Positive zero.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = L_(0.0);
+    mantissa = FREXP (x, &exp);
+    ASSERT (exp == 0);
+    ASSERT (mantissa == x);
+    ASSERT (!signbit (mantissa));
+  }
+
+  { /* Negative zero.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = MINUS_ZERO;
+    mantissa = FREXP (x, &exp);
+    ASSERT (exp == 0);
+    ASSERT (mantissa == x);
+    ASSERT (signbit (mantissa));
+  }
+
+  for (i = 1, x = L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.5));
+    }
+  for (i = 1, x = L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.5));
+    }
+  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.5));
+    }
+
+  for (i = 1, x = - L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == - L_(0.5));
+    }
+  for (i = 1, x = - L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == - L_(0.5));
+    }
+  for (; i >= MIN_EXP - 100 && x < L_(0.0); i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == - L_(0.5));
+    }
+
+  for (i = 1, x = L_(1.01); i <= MAX_EXP; i++, x *= L_(2.0))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.505));
+    }
+  for (i = 1, x = L_(1.01); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.505));
+    }
+  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa >= L_(0.5));
+      ASSERT (mantissa < L_(1.0));
+      ASSERT (mantissa == my_ldexp (x, - exp));
+    }
+
+  for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.866025));
+    }
+  for (i = 1, x = L_(1.73205); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.866025));
+    }
+  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i || exp == i + 1);
+      ASSERT (mantissa >= L_(0.5));
+      ASSERT (mantissa < L_(1.0));
+      ASSERT (mantissa == my_ldexp (x, - exp));
+    }
+
+  /* Randomized tests.  */
+  for (i = 0; i < SIZEOF (RANDOM); i++)
+    {
+      x = L_(20.0) * RANDOM[i] - L_(10.0); /* -10.0 <= x <= 10.0 */
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (x == my_ldexp (mantissa, exp));
+      }
+    }
+}
deleted file mode 120000 (symlink)
index 54d6752ec8ffba23c51e0e30bb6f468f570fed6a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-frexpl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ea4e97288fdf3302d9dd0ab17e611e703c5a93e3
--- /dev/null
@@ -0,0 +1,78 @@
+/* Test of splitting a 'long double' into fraction and mantissa.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (frexpl, long double, (long double, int *));
+
+#include <float.h>
+
+#include "fpucw.h"
+#include "isnanl-nolibm.h"
+#include "minus-zero.h"
+#include "infinity.h"
+#include "nan.h"
+#include "macros.h"
+
+/* Avoid some warnings from "gcc -Wshadow".
+   This file doesn't use the exp() function.  */
+#undef exp
+#define exp exponent
+
+#undef INFINITY
+#undef NAN
+
+#define DOUBLE long double
+#define VOLATILE
+#define ISNAN isnanl
+#define INFINITY Infinityl ()
+#define NAN NaNl ()
+#define L_(literal) literal##L
+#define MINUS_ZERO minus_zerol
+#define MAX_EXP LDBL_MAX_EXP
+#define MIN_EXP LDBL_MIN_EXP
+/* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable
+   exponent for 'long double' is -964.  Similarly, on PowerPC machines,
+   LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double'
+   is -968.  For exponents below that, the precision may be truncated to the
+   precision used for 'double'.  */
+#ifdef __sgi
+# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 57)
+#elif defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__
+# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53)
+#else
+# define MIN_NORMAL_EXP LDBL_MIN_EXP
+#endif
+#define FREXP frexpl
+#define RANDOM randoml
+#include "test-frexp.h"
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  test_function ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 2b60ca170f85a4ac8959b7da3bb3f14d58c1b9f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseek.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4bcbd930f758f212f84672b5cea29ac02eda0236
--- /dev/null
@@ -0,0 +1,70 @@
+/* Test of fseek() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if the user requested GNULIB_POSIXCHECK.  */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fseek, int, (FILE *, long, int));
+
+#include "macros.h"
+
+#ifndef FUNC_UNGETC_BROKEN
+# define FUNC_UNGETC_BROKEN 0
+#endif
+
+int
+main (int argc, char **argv)
+{
+  /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh'
+     iff argc > 1.  */
+  int expected = argc > 1 ? 0 : -1;
+  ASSERT (fseek (stdin, 0, SEEK_CUR) == expected);
+  if (argc > 1)
+    {
+      /* Test that fseek discards previously read ungetc data.  */
+      int ch = fgetc (stdin);
+      ASSERT (ch == '#');
+      ASSERT (ungetc (ch, stdin) == ch);
+      ASSERT (fseek (stdin, 2, SEEK_SET) == 0);
+      ch = fgetc (stdin);
+      ASSERT (ch == '/');
+      if (2 < argc)
+        {
+          if (FUNC_UNGETC_BROKEN)
+            {
+              fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
+                     stderr);
+              return 77;
+            }
+          /* Test that fseek discards random ungetc data.  */
+          ASSERT (ungetc (ch ^ 0xff, stdin) == (ch ^ 0xff));
+        }
+      ASSERT (fseek (stdin, 0, SEEK_END) == 0);
+      ASSERT (fgetc (stdin) == EOF);
+      /* Test that fseek resets end-of-file marker.  */
+      ASSERT (feof (stdin));
+      ASSERT (fseek (stdin, 0, SEEK_END) == 0);
+      ASSERT (!feof (stdin));
+    }
+  return 0;
+}
deleted file mode 120000 (symlink)
index 80d717a14ecde1470a601fcf3a18cb97f063f2ed..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseek.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..4ad3fda44747570ccfa7e78d05d615d826aa375e
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-fseek${EXEEXT} 1 < "$srcdir/test-fseek.sh" || exit 1
+echo hi | ${CHECKER} ./test-fseek${EXEEXT} || exit 1
+exit 0
deleted file mode 120000 (symlink)
index b02b68b4f6e1fbb93d07a985cb1b1c95fd73d70d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseek2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..beadc981f71368335488971a27f4b7c1d134fa6f
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ${CHECKER} ./test-fseek${EXEEXT} 1 2 < "$srcdir/test-fseek2.sh"
deleted file mode 120000 (symlink)
index 45c26e98140b2217af44fccd473d3f3911c7ea99..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseeko.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2af31abb033a4508f41b529b4ece04e6f4ddf1a4
--- /dev/null
@@ -0,0 +1,74 @@
+/* Test of fseeko() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fseeko, int, (FILE *, off_t, int));
+
+
+#include "macros.h"
+
+#ifndef FUNC_UNGETC_BROKEN
+# define FUNC_UNGETC_BROKEN 0
+#endif
+
+int
+main (int argc, _GL_UNUSED char **argv)
+{
+  /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh'
+     iff argc > 1.  */
+  int expected = argc > 1 ? 0 : -1;
+  /* Exit with success only if fseek/fseeko agree.  */
+  int r1 = fseeko (stdin, 0, SEEK_CUR);
+  int r2 = fseek (stdin, 0, SEEK_CUR);
+  ASSERT (r1 == r2 && r1 == expected);
+  if (argc > 1)
+    {
+      /* Test that fseek discards previously read ungetc data.  */
+      int ch = fgetc (stdin);
+      ASSERT (ch == '#');
+      ASSERT (ungetc (ch, stdin) == ch);
+      ASSERT (fseeko (stdin, 2, SEEK_SET) == 0);
+      ch = fgetc (stdin);
+      ASSERT (ch == '/');
+      if (2 < argc)
+        {
+          if (FUNC_UNGETC_BROKEN)
+            {
+              fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
+                     stderr);
+              return 77;
+            }
+          /* Test that fseek discards random ungetc data.  */
+          ASSERT (ungetc (ch ^ 0xff, stdin) == (ch ^ 0xff));
+        }
+      ASSERT (fseeko (stdin, 0, SEEK_END) == 0);
+      ASSERT (fgetc (stdin) == EOF);
+      /* Test that fseek resets end-of-file marker.  */
+      ASSERT (feof (stdin));
+      ASSERT (fseeko (stdin, 0, SEEK_END) == 0);
+      ASSERT (!feof (stdin));
+    }
+  return 0;
+}
deleted file mode 120000 (symlink)
index 7e285800b016ca56267b1519558a2e5cfe232fa4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseeko.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..c7b675e295906d67ace19a288964123bf58edc3a
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-fseeko${EXEEXT} 1 < "$srcdir/test-fseeko.sh" || exit 1
+echo hi | ${CHECKER} ./test-fseeko${EXEEXT} || exit 1
+exit 0
deleted file mode 120000 (symlink)
index 2ce16855a2356082c154854e2adb4b9b3af74765..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseeko2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7bf315ebc7006cf63eebacb82d7f4da2d487169c
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ${CHECKER} ./test-fseeko${EXEEXT} 1 2 < "$srcdir/test-fseeko2.sh"
deleted file mode 120000 (symlink)
index 688f394b7f8eafe2da046c9748fefb84de76b9b4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseeko3.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..882b466992c24d1a2cd4306bd5b0bdfdb6641beb
--- /dev/null
@@ -0,0 +1,51 @@
+/* Test of fseeko() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <eblake@redhat.com>, 2011.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stdlib.h>
+
+#include "macros.h"
+
+int
+main (int argc, char **argv)
+{
+  int do_initial_ftell = atoi (argv[1]);
+  const char *filename = argv[2];
+  FILE *fp = fopen (filename, "r");
+  ASSERT (fp != NULL);
+
+  if (do_initial_ftell)
+    {
+      off_t pos = ftell (fp);
+      ASSERT (pos == 0);
+    }
+
+  ASSERT (fseeko (fp, 0, SEEK_END) == 0);
+
+  {
+    off_t pos = ftell (fp);
+    ASSERT (pos > 0);
+  }
+
+  ASSERT (fclose (fp) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 72f1b219ca58ffb1b354570ef0462c2bd257ba8a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseeko3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..254d0cb7239443a052a9d73380fec8f7e24c12b8
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+${CHECKER} ./test-fseeko3${EXEEXT} 0 "$srcdir/test-fseeko3.sh" || exit 1
+
+${CHECKER} ./test-fseeko3${EXEEXT} 1 "$srcdir/test-fseeko3.sh" || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index ecb16748e0df2ecaf2fd5c3b1505bdaffbfbbdb6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseeko4.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2156ca94a437b9890dc92256e875aaae16de11a3
--- /dev/null
@@ -0,0 +1,75 @@
+/* Test of fseeko() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (int argc, char **argv)
+{
+  const char *filename = argv[1];
+
+  /* Test that fseeko() sets errno if someone else closes the stream
+     fd behind the back of stdio.  */
+  {
+    FILE *fp = fopen (filename, "r");
+    ASSERT (fp != NULL);
+    #if !defined __ANDROID__ /* fdsan */
+    setvbuf (fp, NULL, _IONBF, 0);
+    ASSERT (ftell (fp) == 0);
+    ASSERT (fseeko (fp, 0, SEEK_END) == 0);
+    ASSERT (ftell (fp) > 0);
+    ASSERT (close (fileno (fp)) == 0);
+    errno = 0;
+    ASSERT (fseeko (fp, 0, SEEK_SET) == -1);
+    ASSERT (errno == EBADF);
+    #endif
+    fclose (fp);
+  }
+
+  /* Test that fseeko() sets errno if the stream was constructed with
+     an invalid file descriptor.  */
+  {
+    FILE *fp = fdopen (-1, "w");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (fseeko (fp, 0, SEEK_END) == -1);
+        ASSERT (errno == EBADF);
+        fclose (fp);
+      }
+  }
+  {
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "w");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (fseeko (fp, 0, SEEK_END) == -1);
+        ASSERT (errno == EBADF);
+        fclose (fp);
+      }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index dcc5723327a9b36752ecc0ca6fa8865a440f7d72..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseeko4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7a4d352feb84203e5c055323e0fa85f0774ec217
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-fseeko4${EXEEXT} "$srcdir/test-fseeko4.sh" || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index 4f0fdc1be5490b6bbf9756c5ac163959b3a336c7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fseterr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..61584a414d3b246c3c40ca7bd9ccf2a4b5baf506
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test setting the error indicator of a stream.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "fseterr.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+  /* All streams are initially created with the error indicator cleared.  */
+  if (ferror (stdout))
+    abort ();
+
+  /* Verify that fseterr() works.  */
+  fseterr (stdout);
+  if (!ferror (stdout))
+    abort ();
+
+  /* Verify fseterr's effect can be undone by clearerr().  */
+  clearerr (stdout);
+  if (ferror (stdout))
+    abort ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 555e9204f81b851d0f6b08ea90d96c3e8e2833f1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fstat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7a361b86080cb3aace47468f11049dae2d9d565a
--- /dev/null
@@ -0,0 +1,50 @@
+/* Tests of fstat() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fstat, int, (int, struct stat *));
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    struct stat statbuf;
+
+    errno = 0;
+    ASSERT (fstat (-1, &statbuf) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    struct stat statbuf;
+
+    close (99);
+    errno = 0;
+    ASSERT (fstat (99, &statbuf) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b1ded08c8029a5b90e609c95b3d98fa42cc32a64..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fstatat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3b5dd43579d4c3cc56ee40afc9a1d5c933a18c60
--- /dev/null
@@ -0,0 +1,107 @@
+/* Tests of fstatat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fstatat, int, (int, char const *, struct stat *, int));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "openat.h"
+#include "same-inode.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#ifndef BASE
+# define BASE "test-fstatat.t"
+#endif
+
+#include "test-lstat.h"
+#include "test-stat.h"
+
+static int dfd = AT_FDCWD;
+
+/* Wrapper around fstatat to test stat behavior.  */
+static int
+do_stat (char const *name, struct stat *st)
+{
+#ifdef TEST_STATAT
+  return statat (dfd, name, st);
+#else
+  return fstatat (dfd, name, st, 0);
+#endif
+}
+
+/* Wrapper around fstatat to test lstat behavior.  */
+static int
+do_lstat (char const *name, struct stat *st)
+{
+#ifdef TEST_STATAT
+  return lstatat (dfd, name, st);
+#else
+  return fstatat (dfd, name, st, AT_SYMLINK_NOFOLLOW);
+#endif
+}
+
+int
+main (_GL_UNUSED int argc, _GL_UNUSED char *argv[])
+{
+  int result;
+
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    struct stat statbuf;
+
+    errno = 0;
+    ASSERT (fstatat (-1, "foo", &statbuf, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    struct stat statbuf;
+
+    close (99);
+    errno = 0;
+    ASSERT (fstatat (99, "foo", &statbuf, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  result = test_stat_func (do_stat, false);
+  ASSERT (test_lstat_func (do_lstat, false) == result);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_stat_func (do_stat, false) == result);
+  ASSERT (test_lstat_func (do_lstat, false) == result);
+  ASSERT (close (dfd) == 0);
+
+  /* FIXME - add additional tests of dfd not at current directory.  */
+
+  if (result == 77)
+    fputs ("skipping test: symlinks not supported on this file system\n",
+           stderr);
+  return result;
+}
deleted file mode 120000 (symlink)
index 90d93487abdbf244fb0468b6fed8f5046c1d240f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fsync.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4ec4d8aac9f46140fba415dfbedf6c080ae32291
--- /dev/null
@@ -0,0 +1,83 @@
+/* Test of fsync() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fsync, int, (int));
+
+#include <errno.h>
+#include <fcntl.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  int fd;
+  const char *file = "test-fsync.txt";
+
+  /* Assuming stdin and stdout are ttys, fsync is allowed to fail, but
+     may succeed as an extension.  */
+  for (fd = 0; fd < 2; fd++)
+    if (fsync (fd) != 0)
+      {
+        ASSERT (errno == EINVAL /* POSIX */
+                || errno == ENOTSUP /* seen on Mac OS X 10.5 */
+                || errno == EBADF /* seen on AIX 7.1 */
+                || errno == EIO /* seen on mingw */
+                );
+      }
+
+  /* fsync must fail on invalid fd.  */
+  {
+    errno = 0;
+    ASSERT (fsync (-1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (fsync (99) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+  ASSERT (0 <= fd);
+  ASSERT (write (fd, "hello", 5) == 5);
+  ASSERT (fsync (fd) == 0);
+  ASSERT (close (fd) == 0);
+
+  /* For a read-only regular file input file descriptor, fsync should
+     succeed (since at least atime changes can be synchronized).
+     On AIX and Cygwin, this test would fail.  */
+#if !(defined _AIX || defined __CYGWIN__)
+  fd = open (file, O_RDONLY);
+  ASSERT (0 <= fd);
+  {
+    char buf[1];
+    ASSERT (read (fd, buf, sizeof buf) == sizeof buf);
+  }
+  ASSERT (fsync (fd) == 0);
+  ASSERT (close (fd) == 0);
+#endif
+
+  ASSERT (unlink (file) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index ce0b22f28b4af36e0874bd23f5867a946aaddcbf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftell.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..06ec0e8be09df74e7c1f15c933f3f22d36ef7889
--- /dev/null
@@ -0,0 +1,107 @@
+/* Test of ftell() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (ftell, long, (FILE *));
+
+#include "binary-io.h"
+#include "macros.h"
+
+#ifndef FUNC_UNGETC_BROKEN
+# define FUNC_UNGETC_BROKEN 0
+#endif
+
+int
+main (int argc, char **argv)
+{
+  int ch;
+  /* Assume stdin is seekable iff argc > 1.  */
+  if (argc == 1)
+    {
+      ASSERT (ftell (stdin) == -1);
+      return 0;
+    }
+
+  /* mingw ftell is unreliable on text mode input.  */
+  set_binary_mode (0, O_BINARY);
+
+  /* Simple tests.  */
+  ASSERT (ftell (stdin) == 0);
+
+  ch = fgetc (stdin);
+  ASSERT (ch == '#');
+  ASSERT (ftell (stdin) == 1);
+
+  /* Test ftell after ungetc of read input.  */
+  ch = ungetc ('#', stdin);
+  ASSERT (ch == '#');
+  ASSERT (ftell (stdin) == 0);
+
+  ch = fgetc (stdin);
+  ASSERT (ch == '#');
+  ASSERT (ftell (stdin) == 1);
+
+  /* Test ftell after fseek.  */
+  ASSERT (fseek (stdin, 2, SEEK_SET) == 0);
+  ASSERT (ftell (stdin) == 2);
+
+  /* Test ftell after random ungetc.  */
+  ch = fgetc (stdin);
+  ASSERT (ch == '/');
+  ch = ungetc ('@', stdin);
+  ASSERT (ch == '@');
+  ASSERT (ftell (stdin) == 2);
+
+  ch = fgetc (stdin);
+  ASSERT (ch == '@');
+  ASSERT (ftell (stdin) == 3);
+
+  if (2 < argc)
+    {
+      if (FUNC_UNGETC_BROKEN)
+        {
+          fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
+                 stderr);
+          return 77;
+        }
+      /* Test ftell after ungetc without read.  */
+      ASSERT (fseek (stdin, 0, SEEK_CUR) == 0);
+      ASSERT (ftell (stdin) == 3);
+
+      ch = ungetc ('~', stdin);
+      ASSERT (ch == '~');
+      ASSERT (ftell (stdin) == 2);
+    }
+
+#if !defined __MINT__ /* FreeMiNT has problems seeking past end of file */
+  /* Test ftell beyond end of file.  */
+  ASSERT (fseek (stdin, 0, SEEK_END) == 0);
+  ch = ftell (stdin);
+  ASSERT (fseek (stdin, 10, SEEK_END) == 0);
+  ASSERT (ftell (stdin) == ch + 10);
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index d2232aad5dac54fc95cd9748747860c993ca9038..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftell.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..5c278082a8f27a2ad1416bcb38c566b436c16cb2
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-ftell${EXEEXT} 1 < "$srcdir/test-ftell.sh" || exit 1
+echo hi | ${CHECKER} ./test-ftell${EXEEXT} || exit 1
+exit 0
deleted file mode 120000 (symlink)
index 88c82e548b5ba701a0e3c71e84189842d09e4ef6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftell2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7d116d2cc8f830fb35dd0c540bc3c9feb622e054
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ${CHECKER} ./test-ftell${EXEEXT} 1 2 < "$srcdir/test-ftell2.sh"
deleted file mode 120000 (symlink)
index 632ac35c8cdb5a4d36bc0170750ac79ab96a4db5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftell3.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6f3cffcd4afbca1a7528aed788297221064701a1
--- /dev/null
@@ -0,0 +1,78 @@
+/* Test of ftell() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include <string.h>
+
+#include "macros.h"
+
+#define TESTFILE "t-ftell3.tmp"
+
+int
+main (void)
+{
+  FILE *fp;
+
+  /* Create a file with some contents.  */
+  fp = fopen (TESTFILE, "w");
+  if (fp == NULL)
+    goto skip;
+  if (fwrite ("foogarsh", 1, 8, fp) < 8)
+    goto skip;
+  if (fclose (fp))
+    goto skip;
+
+  /* The file's contents is now "foogarsh".  */
+
+  /* Try writing after reading to EOF.  */
+  fp = fopen (TESTFILE, "r+");
+  if (fp == NULL)
+    goto skip;
+  if (fseek (fp, -1, SEEK_END))
+    goto skip;
+  ASSERT (getc (fp) == 'h');
+  ASSERT (getc (fp) == EOF);
+  ASSERT (ftell (fp) == 8);
+  ASSERT (ftell (fp) == 8);
+  ASSERT (putc ('!', fp) == '!');
+  ASSERT (ftell (fp) == 9);
+  ASSERT (fclose (fp) == 0);
+  fp = fopen (TESTFILE, "r");
+  if (fp == NULL)
+    goto skip;
+  {
+    char buf[10];
+    ASSERT (fread (buf, 1, 10, fp) == 9);
+    ASSERT (memcmp (buf, "foogarsh!", 9) == 0);
+  }
+  ASSERT (fclose (fp) == 0);
+
+  /* The file's contents is now "foogarsh!".  */
+
+  remove (TESTFILE);
+  return 0;
+
+ skip:
+  fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
+  remove (TESTFILE);
+  return 77;
+}
deleted file mode 120000 (symlink)
index 2026468ce7a295a494ccddfb909851c671ec6f6f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftello.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f4c03a48009baaa9301841c948ca30e75d379508
--- /dev/null
@@ -0,0 +1,118 @@
+/* Test of ftello() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (ftello, off_t, (FILE *));
+
+#include "binary-io.h"
+#include "macros.h"
+
+#ifndef FUNC_UNGETC_BROKEN
+# define FUNC_UNGETC_BROKEN 0
+#endif
+
+int
+main (int argc, _GL_UNUSED char **argv)
+{
+  int ch;
+  /* Assume stdin is seekable iff argc > 1.  */
+  if (argc == 1)
+    {
+      ASSERT (ftell (stdin) == -1);
+      ASSERT (ftello (stdin) == -1);
+      return 0;
+    }
+
+  /* mingw ftell is unreliable on text mode input.  */
+  set_binary_mode (0, O_BINARY);
+
+  /* Simple tests.  For each test, make sure ftell and ftello agree.  */
+  ASSERT (ftell (stdin) == 0);
+  ASSERT (ftello (stdin) == 0);
+
+  ch = fgetc (stdin);
+  ASSERT (ch == '#');
+  ASSERT (ftell (stdin) == 1);
+  ASSERT (ftello (stdin) == 1);
+
+  /* Test ftell after ungetc of read input.  */
+  ch = ungetc ('#', stdin);
+  ASSERT (ch == '#');
+  ASSERT (ftell (stdin) == 0);
+  ASSERT (ftello (stdin) == 0);
+
+  ch = fgetc (stdin);
+  ASSERT (ch == '#');
+  ASSERT (ftell (stdin) == 1);
+  ASSERT (ftello (stdin) == 1);
+
+  /* Test ftell after fseek.  */
+  ASSERT (fseek (stdin, 2, SEEK_SET) == 0);
+  ASSERT (ftell (stdin) == 2);
+  ASSERT (ftello (stdin) == 2);
+
+  /* Test ftell after random ungetc.  */
+  ch = fgetc (stdin);
+  ASSERT (ch == '/');
+  ch = ungetc ('@', stdin);
+  ASSERT (ch == '@');
+  ASSERT (ftell (stdin) == 2);
+  ASSERT (ftello (stdin) == 2);
+
+  ch = fgetc (stdin);
+  ASSERT (ch == '@');
+  ASSERT (ftell (stdin) == 3);
+  ASSERT (ftello (stdin) == 3);
+
+  if (2 < argc)
+    {
+      if (FUNC_UNGETC_BROKEN)
+        {
+          fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
+                 stderr);
+          return 77;
+        }
+      /* Test ftell after ungetc without read.  */
+      ASSERT (fseek (stdin, 0, SEEK_CUR) == 0);
+      ASSERT (ftell (stdin) == 3);
+      ASSERT (ftello (stdin) == 3);
+
+      ch = ungetc ('~', stdin);
+      ASSERT (ch == '~');
+      ASSERT (ftell (stdin) == 2);
+      ASSERT (ftello (stdin) == 2);
+    }
+
+#if !defined __MINT__ /* FreeMiNT has problems seeking past end of file */
+  /* Test ftell beyond end of file.  */
+  ASSERT (fseek (stdin, 0, SEEK_END) == 0);
+  ch = ftello (stdin);
+  ASSERT (fseek (stdin, 10, SEEK_END) == 0);
+  ASSERT (ftell (stdin) == ch + 10);
+  ASSERT (ftello (stdin) == ch + 10);
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index d77870f08350078404ebbcb14a370031f196d84e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftello.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..e8db0613baf6b10a5ebf75dd591c3d1bfa0e7e2f
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-ftello${EXEEXT} 1 < "$srcdir/test-ftello.sh" || exit 1
+echo hi | ${CHECKER} ./test-ftello${EXEEXT} || exit 1
+exit 0
deleted file mode 120000 (symlink)
index f4c12f9e8952fc6161158ec175b09d6c485c492c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftello2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..63a222c1bc8c33ae088f42ec95a3314b92a1d8ab
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ${CHECKER} ./test-ftello${EXEEXT} 1 2 < "$srcdir/test-ftello2.sh"
deleted file mode 120000 (symlink)
index 856e81ad3310b529a115ccb0d5e45bc77852f040..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftello3.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f9d8cafd01a6ac121a9f8e20e4936905e3d03845
--- /dev/null
@@ -0,0 +1,78 @@
+/* Test of ftello() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   fseek link warning if we are not using the gnulib fseek module.  */
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include <string.h>
+
+#include "macros.h"
+
+#define TESTFILE "t-ftello3.tmp"
+
+int
+main (void)
+{
+  FILE *fp;
+
+  /* Create a file with some contents.  */
+  fp = fopen (TESTFILE, "w");
+  if (fp == NULL)
+    goto skip;
+  if (fwrite ("foogarsh", 1, 8, fp) < 8)
+    goto skip;
+  if (fclose (fp))
+    goto skip;
+
+  /* The file's contents is now "foogarsh".  */
+
+  /* Try writing after reading to EOF.  */
+  fp = fopen (TESTFILE, "r+");
+  if (fp == NULL)
+    goto skip;
+  if (fseek (fp, -1, SEEK_END))
+    goto skip;
+  ASSERT (getc (fp) == 'h');
+  ASSERT (getc (fp) == EOF);
+  ASSERT (ftello (fp) == 8);
+  ASSERT (ftello (fp) == 8);
+  ASSERT (putc ('!', fp) == '!');
+  ASSERT (ftello (fp) == 9);
+  ASSERT (fclose (fp) == 0);
+  fp = fopen (TESTFILE, "r");
+  if (fp == NULL)
+    goto skip;
+  {
+    char buf[10];
+    ASSERT (fread (buf, 1, 10, fp) == 9);
+    ASSERT (memcmp (buf, "foogarsh!", 9) == 0);
+  }
+  ASSERT (fclose (fp) == 0);
+
+  /* The file's contents is now "foogarsh!".  */
+
+  remove (TESTFILE);
+  return 0;
+
+ skip:
+  fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
+  remove (TESTFILE);
+  return 77;
+}
deleted file mode 120000 (symlink)
index ff2785316418fe87e67e49754e31499fca161b29..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftello4.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3bd52acd2d77a21a18eb287060b49a9bff6e125b
--- /dev/null
@@ -0,0 +1,72 @@
+/* Test of ftello() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (int argc, char **argv)
+{
+  const char *filename = argv[1];
+
+  /* Test that ftello() sets errno if someone else closes the stream
+     fd behind the back of stdio.  */
+  {
+    FILE *fp = fopen (filename, "r");
+    ASSERT (fp != NULL);
+    #if !defined __ANDROID__ /* fdsan */
+    setvbuf (fp, NULL, _IONBF, 0);
+    ASSERT (close (fileno (fp)) == 0);
+    errno = 0;
+    ASSERT (ftello (fp) == (off_t)-1);
+    ASSERT (errno == EBADF);
+    #endif
+    fclose (fp);
+  }
+
+  /* Test that ftello() sets errno if the stream was constructed with
+     an invalid file descriptor.  */
+  {
+    FILE *fp = fdopen (-1, "w");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (ftello (fp) == (off_t)-1);
+        ASSERT (errno == EBADF);
+        fclose (fp);
+      }
+  }
+  {
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "w");
+    if (fp != NULL)
+      {
+        errno = 0;
+        ASSERT (ftello (fp) == (off_t)-1);
+        ASSERT (errno == EBADF);
+        fclose (fp);
+      }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 7cd7712153a7daa99d1f0cc75efa5cad0d98a83b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftello4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..f7ff1496e9fcb0b8a5f6f582baaa41181d15e1ed
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${CHECKER} ./test-ftello4${EXEEXT} "$srcdir/test-ftello4.sh" || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index f64f8c06db034b26527e64c27c2868e0647ba307..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftruncate.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e9daf1bdcb95a8bae963bc8a2b8b786f4dd7543b
--- /dev/null
@@ -0,0 +1,60 @@
+/* Test truncating a file.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (ftruncate, int, (int, off_t));
+
+#include <errno.h>
+#include <fcntl.h>
+
+#include "macros.h"
+
+int
+main (_GL_UNUSED int argc, char *argv[])
+{
+  const char *filename = argv[1];
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (ftruncate (-1, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (ftruncate (99, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Test behaviour for read-only file descriptors.  */
+  {
+    int fd = open (filename, O_RDONLY);
+    ASSERT (fd >= 0);
+    errno = 0;
+    ASSERT (ftruncate (fd, 0) == -1);
+    ASSERT (errno == EBADF || errno == EINVAL
+            || errno == EACCES /* seen on mingw */
+           );
+    close (fd);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index d1d1fa6a8bcfcd75b87a321488b92e212117fa46..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ftruncate.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..203e07b67e9f1d897491d89780ee383ed7fba5e1
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ${CHECKER} ./test-ftruncate${EXEEXT} "$srcdir/test-ftruncate.sh"
deleted file mode 120000 (symlink)
index 93c64eb805373b360cbcd677651bde59c7d1351f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-futimens.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d6ccbd70569ddcc23498f18d45c28c4d6543a5d8
--- /dev/null
@@ -0,0 +1,50 @@
+/* Tests of futimens.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (futimens, int, (int, struct timespec const[2]));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "stat-time.h"
+#include "timespec.h"
+#include "utimecmp.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-futimens.t"
+
+#include "test-futimens.h"
+
+int
+main (void)
+{
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_futimens (futimens, true);
+}
deleted file mode 120000 (symlink)
index ce0186c0b18a044a4df9a507458bfa674500b59f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-futimens.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a6fd5c15cf114b45161c311702144591df031764
--- /dev/null
@@ -0,0 +1,177 @@
+/* Test of file timestamp modification functions.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-utimens-common.h"
+
+/* This file is designed to test both fdutimens(a,NULL,b) and
+   futimens(a,b).  FUNC is the function to test.  Assumes that BASE
+   and ASSERT are already defined.  If PRINT, warn before skipping
+   tests with status 77.  */
+static int
+test_futimens (int (*func) (int, struct timespec const *),
+               bool print)
+{
+  int fd = creat (BASE "file", 0600);
+  int result;
+  struct stat st1;
+  struct stat st2;
+  ASSERT (0 <= fd);
+
+  /* Sanity check.  */
+  ASSERT (fstat (fd, &st1) == 0);
+  nap ();
+  errno = 0;
+  result = func (fd, NULL);
+  if (result == -1 && errno == ENOSYS)
+    {
+      ASSERT (close (fd) == 0);
+      ASSERT (unlink (BASE "file") == 0);
+      if (print)
+        fputs ("skipping test: "
+               "setting fd time not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  ASSERT (!result);
+  ASSERT (fstat (fd, &st2) == 0);
+  /* If utimens truncates to worse resolution than the file system
+     supports, then time can appear to go backwards between now and a
+     follow-up utimens with UTIME_NOW or a NULL timespec.  Use
+     UTIMECMP_TRUNCATE_SOURCE to compensate, with st1 as the
+     source.  */
+  ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE));
+  if (check_ctime)
+    ASSERT (ctime_compare (&st1, &st2) < 0);
+  {
+    /* On some NFS systems, the 'now' timestamp of creat or a NULL
+       timespec is determined by the server, but the 'now' timestamp
+       determined by gettime() (as is done when using UTIME_NOW) is
+       determined by the client; since the two machines are not
+       necessarily on the same clock, this is another case where time
+       can appear to go backwards.  The rest of this test cares about
+       client time, so manually use gettime() to set both times.  */
+    struct timespec ts[2];
+    gettime (&ts[0]);
+    ts[1] = ts[0];
+    ASSERT (func (fd, ts) == 0);
+    ASSERT (fstat (fd, &st1) == 0);
+    nap ();
+  }
+
+  /* Invalid arguments.  */
+  {
+    errno = 0;
+    ASSERT (func (AT_FDCWD, NULL) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (func (-1, NULL) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (func (99, NULL) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    int fd0 = dup (0);
+    ASSERT (0 <= fd0);
+    ASSERT (close (fd0) == 0);
+    errno = 0;
+    ASSERT (func (fd0, NULL) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = UTIME_BOGUS_POS;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = 0;
+    errno = 0;
+    ASSERT (func (fd, ts) == -1);
+    ASSERT (errno == EINVAL);
+  }
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = UTIME_BOGUS_NEG;
+    errno = 0;
+    ASSERT (func (fd, ts) == -1);
+    ASSERT (errno == EINVAL);
+  }
+  ASSERT (fstat (fd, &st2) == 0);
+  ASSERT (st1.st_atime == st2.st_atime);
+  ASSERT (get_stat_atime_ns (&st1) == get_stat_atime_ns (&st2));
+  ASSERT (utimecmp (BASE "file", &st1, &st2, 0) == 0);
+
+  /* Set both times.  */
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = BILLION / 2 - 1;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = BILLION - 1;
+    ASSERT (func (fd, ts) == 0);
+    ASSERT (fstat (fd, &st2) == 0);
+    ASSERT (st2.st_atime == Y2K);
+    ASSERT (0 <= get_stat_atime_ns (&st2));
+    ASSERT (get_stat_atime_ns (&st2) < BILLION / 2);
+    ASSERT (st2.st_mtime == Y2K);
+    ASSERT (0 <= get_stat_mtime_ns (&st2));
+    ASSERT (get_stat_mtime_ns (&st2) < BILLION);
+    if (check_ctime)
+      ASSERT (ctime_compare (&st1, &st2) < 0);
+  }
+
+  /* Play with UTIME_OMIT, UTIME_NOW.  */
+  {
+    struct stat st3;
+    struct timespec ts[2];
+    ts[0].tv_sec = BILLION;
+    ts[0].tv_nsec = UTIME_OMIT;
+    ts[1].tv_sec = 0;
+    ts[1].tv_nsec = UTIME_NOW;
+    nap ();
+    ASSERT (func (fd, ts) == 0);
+    ASSERT (fstat (fd, &st3) == 0);
+    ASSERT (st3.st_atime == Y2K);
+    ASSERT (0 <= get_stat_atime_ns (&st3));
+    ASSERT (get_stat_atime_ns (&st3) <= BILLION / 2);
+    ASSERT (utimecmp (BASE "file", &st1, &st3, UTIMECMP_TRUNCATE_SOURCE) <= 0);
+    if (check_ctime)
+      ASSERT (ctime_compare (&st2, &st3) < 0);
+    nap ();
+    ts[0].tv_nsec = 0;
+    ts[1].tv_nsec = UTIME_OMIT;
+    ASSERT (func (fd, ts) == 0);
+    ASSERT (fstat (fd, &st2) == 0);
+    ASSERT (st2.st_atime == BILLION);
+    ASSERT (get_stat_atime_ns (&st2) == 0);
+    ASSERT (st3.st_mtime == st2.st_mtime);
+    ASSERT (get_stat_mtime_ns (&st3) == get_stat_mtime_ns (&st2));
+    if (check_ctime > 0)
+      ASSERT (ctime_compare (&st3, &st2) < 0);
+  }
+
+  /* Cleanup.  */
+  ASSERT (close (fd) == 0);
+  ASSERT (unlink (BASE "file") == 0);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 61dcfc6135b4c2de6d71c48e10484a8b50611d97..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-fwrite.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f00f35cafc062ada358c67654c825c42d11c394d
--- /dev/null
@@ -0,0 +1,98 @@
+/* Test of fwrite() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fwrite, size_t, (const void *, size_t, size_t, FILE *));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#include "macros.h"
+
+int
+main ()
+{
+  const char *filename = "test-fwrite.txt";
+
+  /* We don't have an fwrite() function that installs an invalid parameter
+     handler so far.  So install that handler here, explicitly.  */
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
+    && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
+  gl_msvc_inval_ensure_handler ();
+#endif
+
+  /* Test that fwrite() on an unbuffered stream sets errno if someone else
+     closes the stream fd behind the back of stdio.  */
+  #if !defined __ANDROID__ /* fdsan */
+  {
+    FILE *fp = fopen (filename, "w");
+    char buf[5] = "world";
+    ASSERT (fp != NULL);
+    setvbuf (fp, NULL, _IONBF, 0);
+    ASSERT (close (fileno (fp)) == 0);
+    errno = 0;
+    ASSERT (fwrite (buf, 1, sizeof (buf), fp) == 0);
+    ASSERT (errno == EBADF);
+    ASSERT (ferror (fp));
+    fclose (fp);
+  }
+  #endif
+
+  /* Test that fwrite() on an unbuffered stream sets errno if the stream
+     was constructed with an invalid file descriptor.  */
+  {
+    FILE *fp = fdopen (-1, "w");
+    if (fp != NULL)
+      {
+        char buf[5] = "world";
+        setvbuf (fp, NULL, _IONBF, 0);
+        errno = 0;
+        ASSERT (fwrite (buf, 1, sizeof (buf), fp) == 0);
+        ASSERT (errno == EBADF);
+        ASSERT (ferror (fp));
+        fclose (fp);
+      }
+  }
+  {
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "w");
+    if (fp != NULL)
+      {
+        char buf[5] = "world";
+        setvbuf (fp, NULL, _IONBF, 0);
+        errno = 0;
+        ASSERT (fwrite (buf, 1, sizeof (buf), fp) == 0);
+        ASSERT (errno == EBADF);
+        ASSERT (ferror (fp));
+        fclose (fp);
+      }
+  }
+
+  /* Clean up.  */
+  unlink (filename);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 2e5466b67255214a228551557a2142857ec79994..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getaddrinfo.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d6e56ea7d957b61590164c6a2a8f3c3f290e592b
--- /dev/null
@@ -0,0 +1,178 @@
+/* Test the getaddrinfo module.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson.  */
+
+#include <config.h>
+
+#include <netdb.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (gai_strerror, char const *, (int));
+/* On native Windows, these two functions may have the __stdcall calling
+   convention.  But the SIGNATURE_CHECK works only for functions with __cdecl
+   calling convention.  */
+#if !(defined _WIN32 && !defined __CYGWIN__)
+SIGNATURE_CHECK (freeaddrinfo, void, (struct addrinfo *));
+SIGNATURE_CHECK (getaddrinfo, int, (char const *, char const *,
+                                    struct addrinfo const *,
+                                    struct addrinfo **));
+#endif
+
+#include <arpa/inet.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "sockets.h"
+
+/* Whether to print debugging messages.  */
+#define ENABLE_DEBUGGING 0
+
+#if ENABLE_DEBUGGING
+# define dbgprintf printf
+#else
+# define dbgprintf if (0) printf
+#endif
+
+/* BeOS does not have AF_UNSPEC.  */
+#ifndef AF_UNSPEC
+# define AF_UNSPEC 0
+#endif
+
+#ifndef EAI_SERVICE
+# define EAI_SERVICE 0
+#endif
+
+static int
+simple (char const *host, char const *service)
+{
+  char buf[BUFSIZ];
+  static int skip = 0;
+  struct addrinfo hints;
+  struct addrinfo *ai0, *ai;
+  int res;
+  int err;
+
+  /* Once we skipped the test, do not try anything else */
+  if (skip)
+    return 0;
+
+  dbgprintf ("Finding %s service %s...\n", host, service);
+
+  /* This initializes "hints" but does not use it.  Is there a reason
+     for this?  If so, please fix this comment.  */
+  memset (&hints, 0, sizeof (hints));
+  hints.ai_flags = AI_CANONNAME;
+  hints.ai_family = AF_UNSPEC;
+  hints.ai_socktype = SOCK_STREAM;
+
+  res = getaddrinfo (host, service, 0, &ai0);
+  err = errno;
+
+  dbgprintf ("res %d: %s\n", res, gai_strerror (res));
+
+  if (res != 0)
+    {
+      /* EAI_AGAIN is returned if no network is available. Don't fail
+         the test merely because someone is down the country on their
+         in-law's farm. */
+      if (res == EAI_AGAIN)
+        {
+          skip++;
+          fprintf (stderr, "skipping getaddrinfo test: no network?\n");
+          return 77;
+        }
+      /* IRIX reports EAI_NONAME for "https".  Don't fail the test
+         merely because of this.  */
+      if (res == EAI_NONAME)
+        return 0;
+      /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
+         fail the test merely because of this.  */
+      if (res == EAI_SERVICE)
+        return 0;
+#ifdef EAI_NODATA
+      /* AIX reports EAI_NODATA for "https".  Don't fail the test
+         merely because of this.  */
+      if (res == EAI_NODATA)
+        return 0;
+#endif
+      /* Provide details if errno was set.  */
+      if (res == EAI_SYSTEM)
+        fprintf (stderr, "system error: %s\n", strerror (err));
+
+      return 1;
+    }
+
+  for (ai = ai0; ai; ai = ai->ai_next)
+    {
+      void *ai_addr = ai->ai_addr;
+      struct sockaddr_in *sock_addr = ai_addr;
+      dbgprintf ("\tflags %x\n", ai->ai_flags + 0u);
+      dbgprintf ("\tfamily %x\n", ai->ai_family + 0u);
+      dbgprintf ("\tsocktype %x\n", ai->ai_socktype + 0u);
+      dbgprintf ("\tprotocol %x\n", ai->ai_protocol + 0u);
+      dbgprintf ("\taddrlen %lu: ", (unsigned long) ai->ai_addrlen);
+      dbgprintf ("\tFound %s\n",
+                 inet_ntop (ai->ai_family,
+                            &sock_addr->sin_addr,
+                            buf, sizeof (buf) - 1));
+      if (ai->ai_canonname)
+        dbgprintf ("\tFound %s...\n", ai->ai_canonname);
+
+      {
+        char ipbuf[BUFSIZ];
+        char portbuf[BUFSIZ];
+
+        res = getnameinfo (ai->ai_addr, ai->ai_addrlen,
+                           ipbuf, sizeof (ipbuf) - 1,
+                           portbuf, sizeof (portbuf) - 1,
+                           NI_NUMERICHOST|NI_NUMERICSERV);
+        dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res));
+        if (res == 0)
+          {
+            dbgprintf ("\t\tip %s\n", ipbuf);
+            dbgprintf ("\t\tport %s\n", portbuf);
+          }
+      }
+
+    }
+
+  freeaddrinfo (ai0);
+
+  return 0;
+}
+
+#define HOST1 "www.gnu.org"
+#define SERV1 "http"
+#define HOST2 "www.ibm.com"
+#define SERV2 "https"
+#define HOST3 "microsoft.com"
+#define SERV3 "http"
+#define HOST4 "google.org"
+#define SERV4 "ldap"
+
+int main (void)
+{
+  (void) gl_sockets_startup (SOCKETS_1_1);
+
+  return simple (HOST1, SERV1)
+    + simple (HOST2, SERV2)
+    + simple (HOST3, SERV3)
+    + simple (HOST4, SERV4);
+}
deleted file mode 120000 (symlink)
index b50ead1560f26817f1ae367a200ab9b364c797c1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getcwd-lgpl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1e7238a06dfefd70134df59b95c0dfc2e11abf91
--- /dev/null
@@ -0,0 +1,102 @@
+/* Test of getcwd() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getcwd, char *, (char *, size_t));
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char **argv)
+{
+  char *pwd1;
+  char *pwd2;
+  /* If the user provides an argument, attempt to chdir there first.  */
+  if (1 < argc)
+    {
+      if (chdir (argv[1]) == 0)
+        printf ("changed to directory %s\n", argv[1]);
+    }
+
+  pwd1 = getcwd (NULL, 0);
+  ASSERT (pwd1 && *pwd1);
+  if (1 < argc)
+    printf ("cwd=%s\n", pwd1);
+
+  /* Make sure the result is usable.  */
+  ASSERT (chdir (pwd1) == 0);
+  ASSERT (chdir (".//./.") == 0);
+
+  /* Make sure that result is normalized.  */
+  pwd2 = getcwd (NULL, 0);
+  ASSERT (pwd2);
+  ASSERT (strcmp (pwd1, pwd2) == 0);
+  free (pwd2);
+  {
+    size_t len = strlen (pwd1);
+    ssize_t i = len - 10;
+    if (i < 1)
+      i = 1;
+    pwd2 = getcwd (NULL, len + 1);
+    ASSERT (pwd2);
+    free (pwd2);
+    pwd2 = malloc (len + 2);
+    for ( ; i <= len; i++)
+      {
+        char *tmp;
+        errno = 0;
+        ASSERT (getcwd (pwd2, i) == NULL);
+        ASSERT (errno == ERANGE);
+        /* Allow either glibc or BSD behavior, since POSIX allows both.  */
+        errno = 0;
+        tmp = getcwd (NULL, i);
+        if (tmp)
+          {
+            ASSERT (strcmp (pwd1, tmp) == 0);
+            free (tmp);
+          }
+        else
+          {
+            ASSERT (errno == ERANGE);
+          }
+      }
+    ASSERT (getcwd (pwd2, len + 1) == pwd2);
+    pwd2[len] = '/';
+    pwd2[len + 1] = '\0';
+  }
+  ASSERT (strstr (pwd2, "/./") == NULL);
+  ASSERT (strstr (pwd2, "/../") == NULL);
+  ASSERT (strstr (pwd2 + 1 + (pwd2[1] == '/'), "//") == NULL);
+
+  /* Validate a POSIX requirement on size.  */
+  errno = 0;
+  ASSERT (getcwd (pwd2, 0) == NULL);
+  ASSERT (errno == EINVAL);
+
+  free (pwd1);
+  free (pwd2);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f8e8d37e909c54f504b36fe6e278dc1fe7fa1e68..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getcwd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..03c63180d45fcb5291ca8ec7d363a0e2d32af3d9
--- /dev/null
@@ -0,0 +1,270 @@
+/* Test of getcwd() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "pathmax.h"
+#include "qemu.h"
+#include "macros.h"
+
+#if !(HAVE_GETPAGESIZE || defined getpagesize)
+# define getpagesize() 0
+#endif
+
+/* This size is chosen to be larger than PATH_MAX (4k), yet smaller than
+   the 16kB pagesize on ia64 linux.  Those conditions make the code below
+   trigger a bug in glibc's getcwd implementation before 2.4.90-10.  */
+#define TARGET_LEN (5 * 1024)
+
+#if defined HAVE_OPENAT || (defined GNULIB_OPENAT && defined HAVE_FDOPENDIR)
+# define HAVE_OPENAT_SUPPORT 1
+#else
+# define HAVE_OPENAT_SUPPORT 0
+#endif
+
+/* Keep this test in sync with m4/getcwd-abort-bug.m4.  */
+static int
+test_abort_bug (void)
+{
+  char *cwd;
+  size_t initial_cwd_len;
+  int fail = 0;
+
+  /* The bug is triggered when PATH_MAX < getpagesize (), so skip
+     this relatively expensive and invasive test if that's not true.  */
+#ifdef PATH_MAX
+  int bug_possible = PATH_MAX < getpagesize ();
+#else
+  int bug_possible = 0;
+#endif
+  if (! bug_possible)
+    return 0;
+
+  cwd = getcwd (NULL, 0);
+  if (cwd == NULL)
+    return 2;
+
+  initial_cwd_len = strlen (cwd);
+  free (cwd);
+
+  if (HAVE_OPENAT_SUPPORT)
+    {
+      static char const dir_name[] = "confdir-14B---";
+      size_t desired_depth = ((TARGET_LEN - 1 - initial_cwd_len)
+                              / sizeof dir_name);
+      size_t d;
+      for (d = 0; d < desired_depth; d++)
+        {
+          if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0)
+            {
+              if (! (errno == ERANGE || errno == ENAMETOOLONG
+                     || errno == ENOENT))
+                fail = 3; /* Unable to construct deep hierarchy.  */
+              break;
+            }
+        }
+
+      /* If libc has the bug in question, this invocation of getcwd
+         results in a failed assertion.  */
+      cwd = getcwd (NULL, 0);
+      if (cwd == NULL)
+        fail = 4; /* getcwd didn't assert, but it failed for a long name
+                     where the answer could have been learned.  */
+      free (cwd);
+
+      /* Call rmdir first, in case the above chdir failed.  */
+      rmdir (dir_name);
+      while (0 < d--)
+        {
+          if (chdir ("..") < 0)
+            {
+              fail = 5;
+              break;
+            }
+          rmdir (dir_name);
+        }
+    }
+
+  return fail;
+}
+
+/* The length of this name must be 8.  */
+#define DIR_NAME "confdir3"
+#define DIR_NAME_LEN 8
+#define DIR_NAME_SIZE (DIR_NAME_LEN + 1)
+
+/* The length of "../".  */
+#define DOTDOTSLASH_LEN 3
+
+/* Leftover bytes in the buffer, to work around library or OS bugs.  */
+#define BUF_SLOP 20
+
+/* Keep this test in sync with m4/getcwd-path-max.m4.  */
+static int
+test_long_name (void)
+{
+#ifndef PATH_MAX
+  /* The Hurd doesn't define this, so getcwd can't exhibit the bug --
+     at least not on a local file system.  And if we were to start worrying
+     about remote file systems, we'd have to enable the wrapper function
+     all of the time, just to be safe.  That's not worth the cost.  */
+  return 0;
+#elif ((INT_MAX / (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) \
+        - DIR_NAME_SIZE - BUF_SLOP) \
+       <= PATH_MAX)
+  /* FIXME: Assuming there's a system for which this is true,
+     this should be done in a compile test.  */
+  return 0;
+#else
+  /* For a process running under QEMU user-mode, the "/" directory is not
+     really the root directory, but the value of the QEMU_LD_PREFIX environment
+     variable or of the -L command-line option.  This causes the logic from
+     glibc/sysdeps/posix/getcwd.c to fail.  In this case, skip the test.  */
+  if (is_running_under_qemu_user ())
+    return 77;
+
+  char buf[PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1)
+           + DIR_NAME_SIZE + BUF_SLOP];
+  char *cwd = getcwd (buf, PATH_MAX);
+  size_t initial_cwd_len;
+  size_t cwd_len;
+  int fail = 0;
+  size_t n_chdirs = 0;
+
+  if (cwd == NULL)
+    return 1;
+
+  cwd_len = initial_cwd_len = strlen (cwd);
+
+  while (1)
+    {
+# ifdef HAVE_GETCWD_SHORTER
+      /* On OS/X <= 10.9 for example, we're restricted to shorter paths
+         as lstat() doesn't support more than PATH_MAX.  */
+      size_t dotdot_max = PATH_MAX * 2;
+# else
+      size_t dotdot_max = PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN);
+# endif
+      char *c = NULL;
+
+      cwd_len += DIR_NAME_SIZE;
+      /* If mkdir or chdir fails, it could be that this system cannot create
+         any file with an absolute name longer than PATH_MAX, such as cygwin.
+         If so, leave fail as 0, because the current working directory can't
+         be too long for getcwd if it can't even be created.  On Linux with
+         the 9p file system, mkdir fails with error EINVAL when cwd_len gets
+         too long; ignore this failure because the getcwd() system call
+         produces good results whereas the gnulib substitute calls getdents64
+         which fails with error EPROTO.
+         For other errors, be pessimistic and consider that as a failure,
+         too.  */
+      if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0)
+        {
+          if (! (errno == ERANGE || errno == ENAMETOOLONG || errno == ENOENT))
+            #ifdef __linux__
+            if (! (errno == EINVAL))
+            #endif
+              fail = 2;
+          break;
+        }
+
+      if (PATH_MAX <= cwd_len && cwd_len < PATH_MAX + DIR_NAME_SIZE)
+        {
+          c = getcwd (buf, PATH_MAX);
+          if (!c && errno == ENOENT)
+            {
+              fail = 3;
+              break;
+            }
+          if (c)
+            {
+              fail = 4;
+              break;
+            }
+          if (! (errno == ERANGE || errno == ENAMETOOLONG))
+            {
+              fail = 5;
+              break;
+            }
+        }
+
+      if (dotdot_max <= cwd_len - initial_cwd_len)
+        {
+          if (dotdot_max + DIR_NAME_SIZE < cwd_len - initial_cwd_len)
+            break;
+          c = getcwd (buf, cwd_len + 1);
+          if (!c)
+            {
+              if (! (errno == ERANGE || errno == ENOENT
+                     || errno == ENAMETOOLONG))
+                {
+                  fail = 6;
+                  break;
+                }
+              if (HAVE_OPENAT_SUPPORT || errno == ERANGE || errno == ENOENT)
+                {
+                  fail = 7;
+                  break;
+                }
+            }
+        }
+
+      if (c && strlen (c) != cwd_len)
+        {
+          fail = 8;
+          break;
+        }
+      ++n_chdirs;
+    }
+
+  /* Leaving behind such a deep directory is not polite.
+     So clean up here, right away, even though the driving
+     shell script would also clean up.  */
+  {
+    size_t i;
+
+    /* Try rmdir first, in case the chdir failed.  */
+    rmdir (DIR_NAME);
+    for (i = 0; i <= n_chdirs; i++)
+      {
+        if (chdir ("..") < 0)
+          break;
+        if (rmdir (DIR_NAME) != 0)
+          break;
+      }
+  }
+
+  return fail;
+#endif
+}
+
+int
+main ()
+{
+  int err1 = test_abort_bug ();
+  int err2 = test_long_name ();
+  return err1 * 10 + (err1 != 0 && err2 == 77 ? 0 : err2);
+}
deleted file mode 120000 (symlink)
index 885c7e7349fd77f8d297c958829510385192048b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getcwd.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..64a3c7c94399f7a752d57a3835276353cff0e089
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+${CHECKER} test-getcwd
+
+Exit $?
deleted file mode 120000 (symlink)
index f3b1d678b099a3a68bbce1ba169df3a837d61f4f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getdelim.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..48b5f8cae45c87f7c59862d67aa988cc686ddcce
--- /dev/null
@@ -0,0 +1,94 @@
+/* Test of getdelim() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getdelim, ssize_t, (char **, size_t *, int, FILE *));
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  FILE *f;
+  char *line;
+  size_t len;
+  ssize_t result;
+
+  /* Create test file.  */
+  f = fopen ("test-getdelim.txt", "wb");
+  if (!f || fwrite ("anAnbcnd\0f", 1, 10, f) != 10 || fclose (f) != 0)
+    {
+      fputs ("Failed to create sample file.\n", stderr);
+      remove ("test-getdelim.txt");
+      return 1;
+    }
+  f = fopen ("test-getdelim.txt", "rb");
+  if (!f)
+    {
+      fputs ("Failed to reopen sample file.\n", stderr);
+      remove ("test-getdelim.txt");
+      return 1;
+    }
+
+  /* Test initial allocation, which must include trailing NUL.  */
+  line = NULL;
+  len = 0;
+  result = getdelim (&line, &len, 'n', f);
+  ASSERT (result == 2);
+  ASSERT (strcmp (line, "an") == 0);
+  ASSERT (2 < len);
+  free (line);
+
+  /* Test initial allocation again, with line = NULL and len != 0.  */
+  line = NULL;
+  len = (size_t)(~0) / 4;
+  result = getdelim (&line, &len, 'n', f);
+  ASSERT (result == 2);
+  ASSERT (strcmp (line, "An") == 0);
+  ASSERT (2 < len);
+  free (line);
+
+  /* Test growth of buffer.  */
+  line = malloc (1);
+  len = 1;
+  result = getdelim (&line, &len, 'n', f);
+  ASSERT (result == 3);
+  ASSERT (strcmp (line, "bcn") == 0);
+  ASSERT (3 < len);
+
+  /* Test embedded NULs and EOF behavior.  */
+  result = getdelim (&line, &len, 'n', f);
+  ASSERT (result == 3);
+  ASSERT (memcmp (line, "d\0f", 4) == 0);
+  ASSERT (3 < len);
+
+  result = getdelim (&line, &len, 'n', f);
+  ASSERT (result == -1);
+
+  free (line);
+  fclose (f);
+  remove ("test-getdelim.txt");
+  return 0;
+}
deleted file mode 120000 (symlink)
index d37c97abcf2750e29156b4c1cc13a5557ea3b26e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getdtablesize.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..401fe9011ae8d00d49e8b42e8e85c81d59bda6a9
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of getdtablesize() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getdtablesize, int, (void));
+
+#include "macros.h"
+
+/* Tell GCC not to warn about the specific edge cases tested here.  */
+#if __GNUC__ >= 13
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
+#endif
+
+int
+main ()
+{
+  ASSERT (getdtablesize () >= 3);
+  ASSERT (dup2 (0, getdtablesize() - 1) == getdtablesize () - 1);
+  ASSERT (dup2 (0, getdtablesize()) == -1);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 364d65ab9228af9dbc5b45ad847e2252a69bfced..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getgroups.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..45d01a32372e9161b0e0a4322bdbc2a13678c46f
--- /dev/null
@@ -0,0 +1,88 @@
+/* Tests of getgroups.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getgroups, int, (int, gid_t[]));
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#include "macros.h"
+
+/* Tell GCC not to warn about the specific edge cases tested here.
+   GCC >= 10 with glibc >= 2.32 would otherwise trigger warnings, even without
+   any -W options, because getgroups() is declared with
+     __attribute__ ((__access__ (__write_only__, 2, 1)))
+ */
+#if __GNUC__ >= 7
+# pragma GCC diagnostic ignored "-Wstringop-overflow"
+#endif
+
+int
+main (int argc, _GL_UNUSED char **argv)
+{
+  int result;
+  gid_t *groups;
+
+  errno = 0;
+  result = getgroups (0, NULL);
+  if (result == -1 && errno == ENOSYS)
+    {
+      fputs ("skipping test: no support for groups\n", stderr);
+      return 77;
+    }
+  ASSERT (0 <= result);
+  ASSERT (result + 1 < SIZE_MAX / sizeof *groups);
+  groups = malloc ((result + 1) * sizeof *groups);
+  ASSERT (groups);
+  groups[result] = -1;
+  /* Check for EINVAL handling.  Not all processes have supplemental
+     groups, and getgroups does not have to return the effective gid,
+     so a result of 0 is reasonable.  Also, we can't test for EINVAL
+     if result is 1, because of how getgroups treats 0.  */
+  if (1 < result)
+    {
+      errno = 0;
+      ASSERT (getgroups (result - 1, groups) == -1);
+      ASSERT (errno == EINVAL);
+    }
+  ASSERT (getgroups (result, groups) == result);
+  ASSERT (getgroups (result + 1, groups) == result);
+  ASSERT (groups[result] == -1);
+  errno = 0;
+  ASSERT (getgroups (-1, NULL) == -1);
+  ASSERT (errno == EINVAL);
+
+  /* The automated unit test, with no arguments, ends here.  However,
+     for debugging purposes, you can pass a command-line argument to
+     list the returned groups.  */
+  if (1 < argc)
+    {
+      int i;
+      for (i = 0; i < result; i++)
+        printf ("%d\n", (int) groups[i]);
+    }
+  free (groups);
+  return 0;
+}
deleted file mode 120000 (symlink)
index d1560d36bc6ba32495e85a81386a789aab38e766..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-gethostname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d60cf206aed7d5b7ca699e9e0e39b37deac5730f
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ * Written by Simon Josefsson.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Get gethostname() declaration.  */
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (gethostname, int, (char *, size_t));
+
+/* Get HOST_NAME_MAX definition.  */
+#include <limits.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#define NOHOSTNAME "magic-gnulib-test-string"
+
+int
+main (int argc, _GL_UNUSED char *argv[])
+{
+  char buf[HOST_NAME_MAX];
+  int rc;
+
+  if (strlen (NOHOSTNAME) >= HOST_NAME_MAX)
+    {
+      printf ("HOST_NAME_MAX impossibly small?! %d\n", HOST_NAME_MAX);
+      return 2;
+    }
+
+  strcpy (buf, NOHOSTNAME);
+
+  rc = gethostname (buf, sizeof (buf));
+
+  if (rc != 0)
+    {
+      printf ("gethostname failed, rc %d errno %d\n", rc, errno);
+      return 1;
+    }
+
+  if (strcmp (buf, NOHOSTNAME) == 0)
+    {
+      printf ("gethostname left buffer untouched.\n");
+      return 1;
+    }
+
+  if (argc > 1)
+    printf ("hostname: %s\n", buf);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 57f77af09f0a5c58dfc039b51e43c86383bca359..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getline.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f2ee66292fe5d0b4c73b8c681bd52dec514ad5b3
--- /dev/null
@@ -0,0 +1,94 @@
+/* Test of getline() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getline, ssize_t, (char **, size_t *, FILE *));
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  FILE *f;
+  char *line;
+  size_t len;
+  ssize_t result;
+
+  /* Create test file.  */
+  f = fopen ("test-getline.txt", "wb");
+  if (!f || fwrite ("a\nA\nbc\nd\0f", 1, 10, f) != 10 || fclose (f) != 0)
+    {
+      fputs ("Failed to create sample file.\n", stderr);
+      remove ("test-getline.txt");
+      return 1;
+    }
+  f = fopen ("test-getline.txt", "rb");
+  if (!f)
+    {
+      fputs ("Failed to reopen sample file.\n", stderr);
+      remove ("test-getline.txt");
+      return 1;
+    }
+
+  /* Test initial allocation, which must include trailing NUL.  */
+  line = NULL;
+  len = 0;
+  result = getline (&line, &len, f);
+  ASSERT (result == 2);
+  ASSERT (strcmp (line, "a\n") == 0);
+  ASSERT (2 < len);
+  free (line);
+
+  /* Test initial allocation again, with line = NULL and len != 0.  */
+  line = NULL;
+  len = (size_t)(~0) / 4;
+  result = getline (&line, &len, f);
+  ASSERT (result == 2);
+  ASSERT (strcmp (line, "A\n") == 0);
+  ASSERT (2 < len);
+  free (line);
+
+  /* Test growth of buffer, must not leak.  */
+  len = 1;
+  line = malloc (len);
+  result = getline (&line, &len, f);
+  ASSERT (result == 3);
+  ASSERT (strcmp (line, "bc\n") == 0);
+  ASSERT (3 < len);
+
+  /* Test embedded NULs and EOF behavior.  */
+  result = getline (&line, &len, f);
+  ASSERT (result == 3);
+  ASSERT (memcmp (line, "d\0f", 4) == 0);
+  ASSERT (3 < len);
+
+  result = getline (&line, &len, f);
+  ASSERT (result == -1);
+
+  free (line);
+  fclose (f);
+  remove ("test-getline.txt");
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3010a03d9d76127cf5281e60ae369673a3158651..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getloadavg.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4fa383ee64fab4ede7a6db545f1b6a8de76ab152
--- /dev/null
@@ -0,0 +1,83 @@
+/* Test of getting load average.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getloadavg, int, (double [], int));
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static void
+check_avg (int minutes, double avg, int printit)
+{
+  if (printit)
+    printf ("%d-minute: %f  ", minutes, avg);
+  else
+    {
+      /* Plausibility checks.  */
+      if (avg < 0.01)
+        printf ("suspiciously low %d-minute average: %f\n", minutes, avg);
+      if (avg > 1000000)
+        printf ("suspiciously high %d-minute average: %f\n", minutes, avg);
+    }
+  if (avg < 0 || avg != avg)
+    exit (minutes);
+}
+
+/* This program can also be used as a manual test, by invoking it with
+   an argument; it then prints the load average.  If the argument is
+   nonzero, the manual test repeats forever, sleeping for the stated
+   interval between each iteration.  */
+int
+main (int argc, char **argv)
+{
+  int naptime = 0;
+
+  if (argc > 1)
+    naptime = atoi (argv[1]);
+
+  while (1)
+    {
+      double avg[3];
+      int loads = getloadavg (avg, 3);
+      if (loads == -1)
+        {
+          if (! (errno == ENOSYS || errno == ENOTSUP || errno == ENOENT))
+            return 1;
+          perror ("Skipping test; load average not supported");
+          return 77;
+        }
+      if (loads > 0)
+        check_avg (1, avg[0], argc > 1);
+      if (loads > 1)
+        check_avg (5, avg[1], argc > 1);
+      if (loads > 2)
+        check_avg (15, avg[2], argc > 1);
+      if (loads > 0 && argc > 1)
+        putchar ('\n');
+
+      if (naptime == 0)
+        break;
+      sleep (naptime);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 19a53384e94a7dce673b12fc69d3e3bb7001e966..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getlogin.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5da702503a070a43ec97618088df77ffa9a00817
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of getting user name.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible and Paul Eggert.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getlogin, char *, (void));
+
+#include "test-getlogin.h"
+
+int
+main (void)
+{
+  /* Test value.  */
+  char *buf = getlogin ();
+  int err = buf ? 0 : errno;
+#if defined __sun
+  if (buf == NULL && err == 0)
+    {
+      /* This can happen on Solaris 11 OpenIndiana in the MATE desktop.  */
+      fprintf (stderr, "Skipping test: no entry in /var/adm/utmpx.\n");
+      exit (77);
+    }
+#endif
+  test_getlogin_result (buf, err);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8a0b49297a1b235350a583e4a1beeeb880e65b3f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getlogin.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0cf1d5901046ba53281db4d003c0e3c8376139aa
--- /dev/null
@@ -0,0 +1,126 @@
+/* Test of getting user name.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible and Paul Eggert.  */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#if !(defined _WIN32 && !defined __CYGWIN__)
+# include <pwd.h>
+#endif
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "macros.h"
+
+static void
+test_getlogin_result (const char *buf, int err)
+{
+  if (err != 0)
+    {
+      if (err == ENOENT)
+        {
+          /* This can happen on GNU/Linux.  */
+          fprintf (stderr, "Skipping test: no entry in utmp file.\n");
+          exit (77);
+        }
+
+      ASSERT (err == ENOTTY
+              || err == EINVAL /* seen on Linux/SPARC */
+              || err == ENXIO
+             );
+
+#if defined __linux__
+      /* On Linux, it is possible to set up a chroot environment in such a way
+         that stdin is connected to a tty and nevertheless /proc/self/loginuid
+         contains the value (uid_t)(-1).  In this situation, getlogin() and
+         getlogin_r() fail; this is expected.  */
+      bool loginuid_undefined = false;
+      /* Does the special file /proc/self/loginuid contain the value
+         (uid_t)(-1)?  */
+      FILE *fp = fopen ("/proc/self/loginuid", "r");
+      if (fp != NULL)
+        {
+          char fread_buf[21];
+          size_t n = fread (fread_buf, 1, sizeof fread_buf, fp);
+          if (n > 0 && n < sizeof fread_buf)
+            {
+              fread_buf[n] = '\0';
+              errno = 0;
+              char *endptr;
+              unsigned long value = strtoul (fread_buf, &endptr, 10);
+              if (*endptr == '\0' && errno == 0)
+                loginuid_undefined = ((uid_t) value == (uid_t)(-1));
+            }
+          fclose (fp);
+        }
+      if (loginuid_undefined)
+        {
+          fprintf (stderr, "Skipping test: loginuid is undefined.\n");
+          exit (77);
+        }
+#endif
+
+      /* It fails when stdin is not connected to a tty.  */
+#if !defined __hpux /* On HP-UX 11.11 it fails anyway.  */
+      ASSERT (! isatty (0));
+#endif
+      fprintf (stderr, "Skipping test: stdin is not a tty.\n");
+      exit (77);
+    }
+
+  /* Compare against the value from the environment.  */
+#if !(defined _WIN32 && !defined __CYGWIN__)
+  /* Unix platform */
+  {
+    struct stat stat_buf;
+    struct passwd *pwd;
+
+    if (!isatty (STDIN_FILENO))
+      {
+        /* We get here, for example, when running under 'nohup' or as part of a
+           non-interactive ssh command.  */
+        fprintf (stderr, "Skipping test: stdin is not a tty.\n");
+        exit (77);
+      }
+
+    ASSERT (fstat (STDIN_FILENO, &stat_buf) == 0);
+
+    pwd = getpwnam (buf);
+    if (! pwd)
+      {
+        fprintf (stderr, "Skipping test: %s: no such user\n", buf);
+        exit (77);
+      }
+
+    ASSERT (pwd->pw_uid == stat_buf.st_uid);
+  }
+#endif
+#if defined _WIN32 && !defined __CYGWIN__
+  /* Native Windows platform.
+     Note: This test would fail on Cygwin in an ssh session, because sshd
+     sets USERNAME=SYSTEM.  */
+  {
+    const char *name = getenv ("USERNAME");
+    if (name != NULL && name[0] != '\0')
+      ASSERT (strcmp (buf, name) == 0);
+  }
+#endif
+}
deleted file mode 120000 (symlink)
index 25519f85a8dc9d28c3dedcd073862027974c24ad..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getndelim2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c0473cfaaa3d09defec9add259f2c712f8b767cf
--- /dev/null
@@ -0,0 +1,151 @@
+/* Test of getndelim2() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2008.  */
+
+#include <config.h>
+
+#include "getndelim2.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  FILE *f;
+  char *line = NULL;
+  size_t len = 0;
+  ssize_t result;
+
+  /* Create test file.  */
+  f = fopen ("test-getndelim2.txt", "wb+");
+  if (!f || fwrite ("a\nbc\nd\0f", 1, 8, f) != 8)
+    {
+      fputs ("Failed to create sample file.\n", stderr);
+      remove ("test-getndelim2.txt");
+      return 1;
+    }
+  rewind (f);
+
+  /* Unlimited lines.  */
+
+  /* Test initial allocation, which must include trailing NUL.  */
+  result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, '\n', '\n', f);
+  ASSERT (result == 2);
+  ASSERT (strcmp (line, "a\n") == 0);
+  ASSERT (2 < len);
+
+  /* Test growth of buffer, must not leak.  */
+  free (line);
+  line = malloc (1);
+  len = 0;
+  result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, EOF, '\n', f);
+  ASSERT (result == 3);
+  ASSERT (strcmp (line, "bc\n") == 0);
+  ASSERT (3 < len);
+
+  /* Test embedded NULs and EOF behavior.  */
+  result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, '\n', EOF, f);
+  ASSERT (result == 3);
+  ASSERT (memcmp (line, "d\0f", 4) == 0);
+  ASSERT (3 < len);
+
+  result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, '\n', EOF, f);
+  ASSERT (result == -1);
+
+  /* Using offset and nmax.  */
+
+  /* Limit growth to four bytes, including NUL, but parse to next 'd'.  */
+  free (line);
+  rewind (f);
+  line = malloc (8);
+  memset (line, 'e', 8);
+  len = 8;
+  result = getndelim2 (&line, &len, 6, 10, 'd', 'd', f);
+  ASSERT (result == 3);
+  ASSERT (10 == len);
+  ASSERT (strcmp (line, "eeeeeea\nb") == 0);
+
+  /* No change if offset larger than limit.  */
+  result = getndelim2 (&line, &len, len, 1, EOF, EOF, f);
+  ASSERT (result == -1);
+  ASSERT (10 == len);
+  ASSERT (strcmp (line, "eeeeeea\nb") == 0);
+
+  /* Consume to end of file, including embedded NUL.  */
+  result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, EOF, EOF, f);
+  ASSERT (result == 2);
+  ASSERT (10 == len);
+  ASSERT (memcmp (line, "\0f\0eeea\nb", 10) == 0);
+
+  result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, '\n', '\r', f);
+  ASSERT (result == -1);
+
+  /* Larger file size.  */
+  rewind (f);
+  {
+    int i;
+    for (i = 0; i < 16; i++)
+      fprintf (f, "%500x%c", i + 0u, i % 2 ? '\n' : '\r');
+  }
+  rewind (f);
+  {
+    char buffer[502];
+
+    result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, '\n', '\r', f);
+    ASSERT (result == 501);
+    ASSERT (501 < len);
+    memset (buffer, ' ', 499);
+    buffer[499] = '0';
+    buffer[500] = '\r';
+    buffer[501] = '\0';
+    ASSERT (strcmp (buffer, line) == 0);
+
+    result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, '\n', '\r', f);
+    ASSERT (result == 501);
+    ASSERT (501 < len);
+    buffer[499] = '1';
+    buffer[500] = '\n';
+    ASSERT (strcmp (buffer, line) == 0);
+
+    result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, 'g', 'f', f);
+    ASSERT (result == 501 * 14 - 1);
+    ASSERT (501 * 14 <= len);
+    buffer[499] = 'f';
+    buffer[500] = '\0';
+    ASSERT (strcmp (buffer, line + 501 * 13) == 0);
+
+    result = getndelim2 (&line, &len, 501 * 14 - 1, GETNLINE_NO_LIMIT,
+                         EOF, EOF, f);
+    ASSERT (result == 1);
+    buffer[500] = '\n';
+    ASSERT (strcmp (buffer, line + 501 * 13) == 0);
+
+    result = getndelim2 (&line, &len, 501 * 14 - 1, GETNLINE_NO_LIMIT,
+                         EOF, EOF, f);
+    buffer[500] = '\0';
+    ASSERT (strcmp (buffer, line + 501 * 13) == 0);
+    ASSERT (result == -1);
+  }
+
+  fclose (f);
+  remove ("test-getndelim2.txt");
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5e6ce7ea7356157f7f196fe44ef01d90c12b7784..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getopt-gnu.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..617f31806fbc0860f71b3f60c01dc7bc0d8b1e0d
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of command line argument processing.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   ftell link warning if we are not using the gnulib ftell module.  */
+#define _GL_NO_LARGE_FILES
+
+/* POSIX and glibc provide the getopt() function in <unistd.h>, see
+   https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html
+   https://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html
+   But gnulib provides the getopt() function in <getopt.h>, not in <unistd.h>.
+   This is what we are testing here.  */
+#include <getopt.h>
+
+#ifndef __getopt_argv_const
+# define __getopt_argv_const const
+#endif
+#include "signature.h"
+SIGNATURE_CHECK (getopt_long, int, (int, char *__getopt_argv_const *,
+                                    char const *, struct option const *,
+                                    int *));
+SIGNATURE_CHECK (getopt_long_only, int, (int, char *__getopt_argv_const *,
+                                         char const *, struct option const *,
+                                         int *));
+
+#define TEST_GETOPT_GNU 1
+#define TEST_GETOPT_TMP_NAME "test-getopt-gnu.tmp"
+#include "test-getopt-main.h"
deleted file mode 120000 (symlink)
index fac8653204c0f63754e5fe40507d4abc47625ebb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getopt-main.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..82ad65dfaf398616b45180f2aea2c2fdc1b8414e
--- /dev/null
@@ -0,0 +1,76 @@
+/* Test of command line argument processing.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include "signature.h"
+SIGNATURE_CHECK (getopt, int, (int, char * const[], char const *));
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* This test intentionally remaps stderr.  So, we arrange to have fd 10
+   (outside the range of interesting fd's during the test) set up to
+   duplicate the original stderr.  */
+
+#define BACKUP_STDERR_FILENO 10
+#define ASSERT_STREAM myerr
+#include "macros.h"
+
+static FILE *myerr;
+
+#include "test-getopt.h"
+#if TEST_GETOPT_GNU
+# include "test-getopt_long.h"
+#endif
+
+int
+main (void)
+{
+   /* This test validates that stderr is used correctly, so move the
+      original into fd 10.  */
+  if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
+      || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
+    return 2;
+
+  ASSERT (freopen (TEST_GETOPT_TMP_NAME, "w", stderr) == stderr);
+
+  /* These default values are required by POSIX.  */
+  ASSERT (optind == 1);
+  ASSERT (opterr != 0);
+
+  setenv ("POSIXLY_CORRECT", "1", 1);
+  test_getopt ();
+
+#if TEST_GETOPT_GNU
+  test_getopt_long_posix ();
+#endif
+
+  unsetenv ("POSIXLY_CORRECT");
+  test_getopt ();
+
+#if TEST_GETOPT_GNU
+  test_getopt_long ();
+  test_getopt_long_only ();
+#endif
+
+  ASSERT (fclose (stderr) == 0);
+  ASSERT (remove (TEST_GETOPT_TMP_NAME) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index fe59fabe5d1256fd23c3aa3a4144620457bd6443..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getopt-posix.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a0fbd69e6d2cda05073a6fd13c173780479a4100
--- /dev/null
@@ -0,0 +1,34 @@
+/* Test of command line argument processing.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+/* None of the files accessed by this test are large, so disable the
+   ftell link warning if we are not using the gnulib ftell module.  */
+#define _GL_NO_LARGE_FILES
+
+/* POSIX and glibc provide the getopt() function in <unistd.h>, see
+   https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html
+   https://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html
+   But gnulib provides the getopt() function in <getopt.h>, not in <unistd.h>.
+   Nevertheless the getopt() function should also be found in <unistd.h>.  */
+#include <unistd.h>
+
+#define TEST_GETOPT_GNU 0
+#define TEST_GETOPT_TMP_NAME "test-getopt-posix.tmp"
+#include "test-getopt-main.h"
deleted file mode 120000 (symlink)
index ece75bcaf353152d041713073208c37548c2da8f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getopt.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f13b59596b9c0377ac9baef0213fd7d4ca7c6f2f
--- /dev/null
+/* Test of command line argument processing.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+
+/* The glibc/gnulib implementation of getopt supports setting optind =
+   0, but not all other implementations do.  This matters for getopt.
+   But for getopt_long, we require GNU compatibility.  */
+#if defined __GETOPT_PREFIX || (__GLIBC__ >= 2 && !defined __UCLIBC__)
+# define OPTIND_MIN 0
+#elif HAVE_DECL_OPTRESET
+# define OPTIND_MIN (optreset = 1)
+#else
+# define OPTIND_MIN 1
+#endif
+
+static void
+getopt_loop (int argc, const char **argv,
+             const char *options,
+             int *a_seen, int *b_seen,
+             const char **p_value, const char **q_value,
+             int *non_options_count, const char **non_options,
+             int *unrecognized, bool *message_issued)
+{
+  int c;
+  int pos = ftell (stderr);
+
+  while ((c = getopt (argc, (char **) argv, options)) != -1)
+    {
+      switch (c)
+        {
+        case 'a':
+          (*a_seen)++;
+          break;
+        case 'b':
+          (*b_seen)++;
+          break;
+        case 'p':
+          *p_value = optarg;
+          break;
+        case 'q':
+          *q_value = optarg;
+          break;
+        case '\1':
+          /* Must only happen with option '-' at the beginning.  */
+          ASSERT (options[0] == '-');
+          non_options[(*non_options_count)++] = optarg;
+          break;
+        case ':':
+          /* Must only happen with option ':' at the beginning.  */
+          ASSERT (options[0] == ':'
+                  || ((options[0] == '-' || options[0] == '+')
+                      && options[1] == ':'));
+          FALLTHROUGH;
+        case '?':
+          *unrecognized = optopt;
+          break;
+        default:
+          *unrecognized = c;
+          break;
+        }
+    }
+
+  *message_issued = pos < ftell (stderr);
+}
+
+static void
+test_getopt (void)
+{
+  int start;
+  bool posixly = !!getenv ("POSIXLY_CORRECT");
+  /* See comment in getopt.c:
+     glibc gets a LSB-compliant getopt.
+     Standalone applications get a POSIX-compliant getopt.  */
+#if defined __GETOPT_PREFIX || !(__GLIBC__ >= 2 || defined __MINGW32__)
+  /* Using getopt from gnulib or from a non-glibc system.  */
+  posixly = true;
+#endif
+
+  /* Test processing of boolean options.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-a";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "ab",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-b";
+      argv[argc++] = "-a";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "ab",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ba";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "ab",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ab";
+      argv[argc++] = "-a";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "ab",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 2);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+      ASSERT (!output);
+    }
+
+  /* Test processing of options with arguments.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-pfoo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "p:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "p:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ab";
+      argv[argc++] = "-q";
+      argv[argc++] = "baz";
+      argv[argc++] = "-pfoo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 5);
+      ASSERT (!output);
+    }
+
+#if GNULIB_TEST_GETOPT_GNU
+  /* Test processing of options with optional arguments.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-pfoo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "p::q::",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "p::q::",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "abp::q::",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+      ASSERT (!output);
+    }
+#endif /* GNULIB_TEST_GETOPT_GNU */
+
+  /* Check that invalid options are recognized; and that both opterr
+     and leading ':' can silence output.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "-x";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 42;
+      getopt_loop (argc, argv, "abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'x');
+      ASSERT (optind == 5);
+      ASSERT (output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "-x";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 0;
+      getopt_loop (argc, argv, "abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'x');
+      ASSERT (optind == 5);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "-x";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, ":abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'x');
+      ASSERT (optind == 5);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "-:";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 42;
+      getopt_loop (argc, argv, "abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == ':');
+      ASSERT (optind == 5);
+      ASSERT (output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "-:";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 0;
+      getopt_loop (argc, argv, "abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == ':');
+      ASSERT (optind == 5);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "-:";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, ":abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == ':');
+      ASSERT (optind == 5);
+      ASSERT (!output);
+    }
+
+  /* Check for missing argument behavior.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ap";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'p');
+      ASSERT (optind == 2);
+      ASSERT (output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ap";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 0;
+      getopt_loop (argc, argv, "abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'p');
+      ASSERT (optind == 2);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ap";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, ":abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'p');
+      ASSERT (optind == 2);
+      ASSERT (!output);
+    }
+
+  /* Check that by default, non-options arguments are moved to the end.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      if (posixly)
+        {
+          ASSERT (strcmp (argv[0], "program") == 0);
+          ASSERT (strcmp (argv[1], "donald") == 0);
+          ASSERT (strcmp (argv[2], "-p") == 0);
+          ASSERT (strcmp (argv[3], "billy") == 0);
+          ASSERT (strcmp (argv[4], "duck") == 0);
+          ASSERT (strcmp (argv[5], "-a") == 0);
+          ASSERT (strcmp (argv[6], "bar") == 0);
+          ASSERT (argv[7] == NULL);
+          ASSERT (a_seen == 0);
+          ASSERT (b_seen == 0);
+          ASSERT (p_value == NULL);
+          ASSERT (q_value == NULL);
+          ASSERT (non_options_count == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 1);
+          ASSERT (!output);
+        }
+      else
+        {
+          ASSERT (strcmp (argv[0], "program") == 0);
+          ASSERT (strcmp (argv[1], "-p") == 0);
+          ASSERT (strcmp (argv[2], "billy") == 0);
+          ASSERT (strcmp (argv[3], "-a") == 0);
+          ASSERT (strcmp (argv[4], "donald") == 0);
+          ASSERT (strcmp (argv[5], "duck") == 0);
+          ASSERT (strcmp (argv[6], "bar") == 0);
+          ASSERT (argv[7] == NULL);
+          ASSERT (a_seen == 1);
+          ASSERT (b_seen == 0);
+          ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+          ASSERT (q_value == NULL);
+          ASSERT (non_options_count == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 4);
+          ASSERT (!output);
+        }
+    }
+
+  /* Check that '--' ends the argument processing.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[20];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "--";
+      argv[argc++] = "-b";
+      argv[argc++] = "foo";
+      argv[argc++] = "-q";
+      argv[argc++] = "johnny";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      if (posixly)
+        {
+          ASSERT (strcmp (argv[0], "program") == 0);
+          ASSERT (strcmp (argv[1], "donald") == 0);
+          ASSERT (strcmp (argv[2], "-p") == 0);
+          ASSERT (strcmp (argv[3], "billy") == 0);
+          ASSERT (strcmp (argv[4], "duck") == 0);
+          ASSERT (strcmp (argv[5], "-a") == 0);
+          ASSERT (strcmp (argv[6], "--") == 0);
+          ASSERT (strcmp (argv[7], "-b") == 0);
+          ASSERT (strcmp (argv[8], "foo") == 0);
+          ASSERT (strcmp (argv[9], "-q") == 0);
+          ASSERT (strcmp (argv[10], "johnny") == 0);
+          ASSERT (strcmp (argv[11], "bar") == 0);
+          ASSERT (argv[12] == NULL);
+          ASSERT (a_seen == 0);
+          ASSERT (b_seen == 0);
+          ASSERT (p_value == NULL);
+          ASSERT (q_value == NULL);
+          ASSERT (non_options_count == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 1);
+          ASSERT (!output);
+        }
+      else
+        {
+          ASSERT (strcmp (argv[0], "program") == 0);
+          ASSERT (strcmp (argv[1], "-p") == 0);
+          ASSERT (strcmp (argv[2], "billy") == 0);
+          ASSERT (strcmp (argv[3], "-a") == 0);
+          ASSERT (strcmp (argv[4], "--") == 0);
+          ASSERT (strcmp (argv[5], "donald") == 0);
+          ASSERT (strcmp (argv[6], "duck") == 0);
+          ASSERT (strcmp (argv[7], "-b") == 0);
+          ASSERT (strcmp (argv[8], "foo") == 0);
+          ASSERT (strcmp (argv[9], "-q") == 0);
+          ASSERT (strcmp (argv[10], "johnny") == 0);
+          ASSERT (strcmp (argv[11], "bar") == 0);
+          ASSERT (argv[12] == NULL);
+          ASSERT (a_seen == 1);
+          ASSERT (b_seen == 0);
+          ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+          ASSERT (q_value == NULL);
+          ASSERT (non_options_count == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 5);
+          ASSERT (!output);
+        }
+    }
+
+#if GNULIB_TEST_GETOPT_GNU
+  /* Check that the '-' flag causes non-options to be returned in order.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "-abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 3);
+      ASSERT (strcmp (non_options[0], "donald") == 0);
+      ASSERT (strcmp (non_options[1], "duck") == 0);
+      ASSERT (strcmp (non_options[2], "bar") == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 7);
+      ASSERT (!output);
+    }
+
+  /* Check that '--' ends the argument processing.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[20];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "--";
+      argv[argc++] = "-b";
+      argv[argc++] = "foo";
+      argv[argc++] = "-q";
+      argv[argc++] = "johnny";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "-abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "--") == 0);
+      ASSERT (strcmp (argv[7], "-b") == 0);
+      ASSERT (strcmp (argv[8], "foo") == 0);
+      ASSERT (strcmp (argv[9], "-q") == 0);
+      ASSERT (strcmp (argv[10], "johnny") == 0);
+      ASSERT (strcmp (argv[11], "bar") == 0);
+      ASSERT (argv[12] == NULL);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (!output);
+      if (non_options_count == 2)
+        {
+          /* glibc behaviour.  */
+          ASSERT (non_options_count == 2);
+          ASSERT (strcmp (non_options[0], "donald") == 0);
+          ASSERT (strcmp (non_options[1], "duck") == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 7);
+        }
+      else
+        {
+          /* Another valid behaviour.  */
+          ASSERT (non_options_count == 7);
+          ASSERT (strcmp (non_options[0], "donald") == 0);
+          ASSERT (strcmp (non_options[1], "duck") == 0);
+          ASSERT (strcmp (non_options[2], "-b") == 0);
+          ASSERT (strcmp (non_options[3], "foo") == 0);
+          ASSERT (strcmp (non_options[4], "-q") == 0);
+          ASSERT (strcmp (non_options[5], "johnny") == 0);
+          ASSERT (strcmp (non_options[6], "bar") == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 12);
+        }
+    }
+
+  /* Check that the '-' flag has to come first.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "abp:q:-",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      if (posixly)
+        {
+          ASSERT (strcmp (argv[0], "program") == 0);
+          ASSERT (strcmp (argv[1], "donald") == 0);
+          ASSERT (strcmp (argv[2], "-p") == 0);
+          ASSERT (strcmp (argv[3], "billy") == 0);
+          ASSERT (strcmp (argv[4], "duck") == 0);
+          ASSERT (strcmp (argv[5], "-a") == 0);
+          ASSERT (strcmp (argv[6], "bar") == 0);
+          ASSERT (argv[7] == NULL);
+          ASSERT (a_seen == 0);
+          ASSERT (b_seen == 0);
+          ASSERT (p_value == NULL);
+          ASSERT (q_value == NULL);
+          ASSERT (non_options_count == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 1);
+          ASSERT (!output);
+        }
+      else
+        {
+          ASSERT (strcmp (argv[0], "program") == 0);
+          ASSERT (strcmp (argv[1], "-p") == 0);
+          ASSERT (strcmp (argv[2], "billy") == 0);
+          ASSERT (strcmp (argv[3], "-a") == 0);
+          ASSERT (strcmp (argv[4], "donald") == 0);
+          ASSERT (strcmp (argv[5], "duck") == 0);
+          ASSERT (strcmp (argv[6], "bar") == 0);
+          ASSERT (argv[7] == NULL);
+          ASSERT (a_seen == 1);
+          ASSERT (b_seen == 0);
+          ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+          ASSERT (q_value == NULL);
+          ASSERT (non_options_count == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 4);
+          ASSERT (!output);
+        }
+    }
+
+  /* Check that the '+' flag causes the first non-option to terminate the
+     loop.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "+abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 1);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-+";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_loop (argc, argv, "+abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == '+');
+      ASSERT (optind == 2);
+      ASSERT (output);
+    }
+
+  /* Check that '--' ends the argument processing.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[20];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "--";
+      argv[argc++] = "-b";
+      argv[argc++] = "foo";
+      argv[argc++] = "-q";
+      argv[argc++] = "johnny";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "+abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "--") == 0);
+      ASSERT (strcmp (argv[7], "-b") == 0);
+      ASSERT (strcmp (argv[8], "foo") == 0);
+      ASSERT (strcmp (argv[9], "-q") == 0);
+      ASSERT (strcmp (argv[10], "johnny") == 0);
+      ASSERT (strcmp (argv[11], "bar") == 0);
+      ASSERT (argv[12] == NULL);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 1);
+      ASSERT (!output);
+    }
+#endif /* GNULIB_TEST_GETOPT_GNU */
+
+  /* Check that the '+' flag has to come first.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "abp:q:+",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      if (posixly)
+        {
+          ASSERT (strcmp (argv[0], "program") == 0);
+          ASSERT (strcmp (argv[1], "donald") == 0);
+          ASSERT (strcmp (argv[2], "-p") == 0);
+          ASSERT (strcmp (argv[3], "billy") == 0);
+          ASSERT (strcmp (argv[4], "duck") == 0);
+          ASSERT (strcmp (argv[5], "-a") == 0);
+          ASSERT (strcmp (argv[6], "bar") == 0);
+          ASSERT (argv[7] == NULL);
+          ASSERT (a_seen == 0);
+          ASSERT (b_seen == 0);
+          ASSERT (p_value == NULL);
+          ASSERT (q_value == NULL);
+          ASSERT (non_options_count == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 1);
+          ASSERT (!output);
+        }
+      else
+        {
+          ASSERT (strcmp (argv[0], "program") == 0);
+          ASSERT (strcmp (argv[1], "-p") == 0);
+          ASSERT (strcmp (argv[2], "billy") == 0);
+          ASSERT (strcmp (argv[3], "-a") == 0);
+          ASSERT (strcmp (argv[4], "donald") == 0);
+          ASSERT (strcmp (argv[5], "duck") == 0);
+          ASSERT (strcmp (argv[6], "bar") == 0);
+          ASSERT (argv[7] == NULL);
+          ASSERT (a_seen == 1);
+          ASSERT (b_seen == 0);
+          ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+          ASSERT (q_value == NULL);
+          ASSERT (non_options_count == 0);
+          ASSERT (unrecognized == 0);
+          ASSERT (optind == 4);
+          ASSERT (!output);
+        }
+    }
+
+#if GNULIB_TEST_GETOPT_GNU
+  /* If GNU extensions are supported, require compliance with POSIX
+     interpretation on leading '+' behavior.
+     http://austingroupbugs.net/view.php?id=191  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      getopt_loop (argc, argv, "+:abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 1);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_loop (argc, argv, "+:abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'p');
+      ASSERT (optind == 2);
+      ASSERT (!output);
+    }
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int a_seen = 0;
+      int b_seen = 0;
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      bool output;
+      int argc = 0;
+      const char *argv[10];
+
+      argv[argc++] = "program";
+      argv[argc++] = "-b";
+      argv[argc++] = "-p";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_loop (argc, argv, "+:abp:q:",
+                   &a_seen, &b_seen, &p_value, &q_value,
+                   &non_options_count, non_options, &unrecognized, &output);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'p');
+      ASSERT (optind == 3);
+      ASSERT (!output);
+    }
+
+  /* Check that 'W' does not dump core:
+     https://sourceware.org/bugzilla/show_bug.cgi?id=12922
+     Technically, POSIX says the presence of ';' in the opt-string
+     gives unspecified behavior, so we only test this when GNU compliance
+     is desired.  */
+  for (start = OPTIND_MIN; start <= 1; start++)
+    {
+      int argc = 0;
+      const char *argv[10];
+      int pos = ftell (stderr);
+
+      argv[argc++] = "program";
+      argv[argc++] = "-W";
+      argv[argc++] = "dummy";
+      argv[argc] = NULL;
+      optind = start;
+      opterr = 1;
+      ASSERT (getopt (argc, (char **) argv, "W;") == 'W');
+      ASSERT (ftell (stderr) == pos);
+      ASSERT (optind == 2);
+    }
+#endif /* GNULIB_TEST_GETOPT_GNU */
+}
deleted file mode 120000 (symlink)
index 78ca9fdb3b6669ba58fed1ce8c3bc907fd2a8df1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getopt_long.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..07bc71963dd5cc3f3dc5789531739cb1ced7fd52
--- /dev/null
+/* Test of command line argument processing.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+static int a_seen;
+static int b_seen;
+static int q_seen;
+
+static const struct option long_options_required[] =
+  {
+    { "alpha",    no_argument,       NULL, 'a' },
+    { "beta",     no_argument,       &b_seen, 1 },
+    { "prune",    required_argument, NULL, 'p' },
+    { "quetsche", required_argument, &q_seen, 1 },
+    { "xtremely-",no_argument,       NULL, 1003 },
+    { "xtra",     no_argument,       NULL, 1001 },
+    { "xtreme",   no_argument,       NULL, 1002 },
+    { "xtremely", no_argument,       NULL, 1003 },
+    { NULL,       0,                 NULL, 0 }
+  };
+
+static const struct option long_options_optional[] =
+  {
+    { "alpha",    no_argument,       NULL, 'a' },
+    { "beta",     no_argument,       &b_seen, 1 },
+    { "prune",    optional_argument, NULL, 'p' },
+    { "quetsche", optional_argument, &q_seen, 1 },
+    { NULL,       0,                 NULL, 0 }
+  };
+
+static void
+getopt_long_loop (int argc, const char **argv,
+                  const char *options, const struct option *long_options,
+                  const char **p_value, const char **q_value,
+                  int *non_options_count, const char **non_options,
+                  int *unrecognized)
+{
+  int option_index = -1;
+  int c;
+
+  opterr = 0;
+  q_seen = 0;
+  while ((c = getopt_long (argc, (char **) argv, options, long_options,
+                           &option_index))
+         != -1)
+    {
+      switch (c)
+        {
+        case 0:
+          /* An option with a non-NULL flag pointer was processed.  */
+          if (q_seen)
+            *q_value = optarg;
+          break;
+        case 'a':
+          a_seen++;
+          break;
+        case 'b':
+          b_seen = 1;
+          break;
+        case 'p':
+          *p_value = optarg;
+          break;
+        case 'q':
+          *q_value = optarg;
+          break;
+        case '\1':
+          /* Must only happen with option '-' at the beginning.  */
+          ASSERT (options[0] == '-');
+          non_options[(*non_options_count)++] = optarg;
+          break;
+        case ':':
+          /* Must only happen with option ':' at the beginning.  */
+          ASSERT (options[0] == ':'
+                  || ((options[0] == '-' || options[0] == '+')
+                      && options[1] == ':'));
+          FALLTHROUGH;
+        case '?':
+          *unrecognized = optopt;
+          break;
+        default:
+          *unrecognized = c;
+          break;
+        }
+    }
+}
+
+/* Reduce casting, so we can use string literals elsewhere.
+   getopt_long takes an array of char*, but luckily does not modify
+   those elements, so we can pass const char*.  */
+static int
+do_getopt_long (int argc, const char **argv, const char *shortopts,
+                const struct option *longopts, int *longind)
+{
+  return getopt_long (argc, (char **) argv, shortopts, longopts, longind);
+}
+
+static void
+test_getopt_long (void)
+{
+  int start;
+
+  /* Test disambiguation of options.  */
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--x";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--xt";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--xtr";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--xtra";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    ASSERT (c == 1001);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--xtre";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--xtrem";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--xtreme";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    ASSERT (c == 1002);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--xtremel";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    ASSERT (c == 1003);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--xtremely";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "ab", long_options_required, &option_index);
+    ASSERT (c == 1003);
+  }
+
+  /* Check that -W handles unknown options.  */
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-W";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "W;", long_options_required, &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 'W');
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-Wunknown";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "W;", long_options_required, &option_index);
+    /* glibc and BSD behave differently here, but for now, we allow
+       both behaviors since W support is not frequently used.  */
+    if (c == '?')
+      {
+        ASSERT (optopt == 0);
+        ASSERT (optarg == NULL);
+      }
+    else
+      {
+        ASSERT (c == 'W');
+        ASSERT (strcmp (optarg, "unknown") == 0);
+      }
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-W";
+    argv[argc++] = "unknown";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "W;", long_options_required, &option_index);
+    /* glibc and BSD behave differently here, but for now, we allow
+       both behaviors since W support is not frequently used.  */
+    if (c == '?')
+      {
+        ASSERT (optopt == 0);
+        ASSERT (optarg == NULL);
+      }
+    else
+      {
+        ASSERT (c == 'W');
+        ASSERT (strcmp (optarg, "unknown") == 0);
+      }
+  }
+
+  /* Test that 'W' does not dump core:
+     https://sourceware.org/bugzilla/show_bug.cgi?id=12922  */
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-W";
+    argv[argc++] = "dummy";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long (argc, argv, "W;", NULL, &option_index);
+    ASSERT (c == 'W');
+    ASSERT (optind == 2);
+  }
+
+  /* Test processing of boolean short options.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-a";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "ab", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-b";
+      argv[argc++] = "-a";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "ab", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ba";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "ab", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ab";
+      argv[argc++] = "-a";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "ab", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 2);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+    }
+
+  /* Test processing of boolean long options.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "--alpha";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "ab", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "--beta";
+      argv[argc++] = "--alpha";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "ab", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "--alpha";
+      argv[argc++] = "--beta";
+      argv[argc++] = "--alpha";
+      argv[argc++] = "--beta";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "ab", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 2);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 5);
+    }
+
+  /* Test processing of boolean long options via -W.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-Walpha";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abW;", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-W";
+      argv[argc++] = "beta";
+      argv[argc++] = "-W";
+      argv[argc++] = "alpha";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "aW;b", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 5);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-Walpha";
+      argv[argc++] = "-Wbeta";
+      argv[argc++] = "-Walpha";
+      argv[argc++] = "-Wbeta";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "W;ab", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 2);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 5);
+    }
+
+  /* Test processing of short options with arguments.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-pfoo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ab";
+      argv[argc++] = "-q";
+      argv[argc++] = "baz";
+      argv[argc++] = "-pfoo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 5);
+    }
+
+  /* Test processing of long options with arguments.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "--p=foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "--p";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ab";
+      argv[argc++] = "--q";
+      argv[argc++] = "baz";
+      argv[argc++] = "--p=foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 5);
+    }
+
+  /* Test processing of long options with arguments via -W.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-Wp=foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p:q:W;", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-W";
+      argv[argc++] = "p";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p:W;q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 4);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-ab";
+      argv[argc++] = "-Wq";
+      argv[argc++] = "baz";
+      argv[argc++] = "-W";
+      argv[argc++] = "p=foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "W;abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value != NULL && strcmp (q_value, "baz") == 0);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 6);
+    }
+
+  /* Test processing of short options with optional arguments.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-pfoo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+    }
+
+  /* Test processing of long options with optional arguments.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "--p=foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "--p";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "--p=";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && *p_value == '\0');
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "--p";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+    }
+
+  /* Test processing of long options with optional arguments via -W.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-Wp=foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p::q::W;", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-Wp";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p::q::W;", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-Wp=";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "W;p::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && *p_value == '\0');
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-W";
+      argv[argc++] = "p=";
+      argv[argc++] = "foo";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "W;p::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && *p_value == '\0');
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 3);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-W";
+      argv[argc++] = "p";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "W;abp::q::", long_options_optional,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      /* ASSERT (p_value == NULL); */
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 4);
+    }
+
+  /* Check that invalid options are recognized.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "-x";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'x');
+      ASSERT (optind == 5);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "-:";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == ':');
+      ASSERT (optind == 5);
+    }
+
+  /* Check that unexpected arguments are recognized.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "--a=";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 'a');
+      ASSERT (optind == 4);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "foo";
+      argv[argc++] = "--b=";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "foo") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      /* When flag is non-zero, glibc sets optopt anyway, but BSD
+         leaves optopt unchanged.  */
+      ASSERT (unrecognized == 1 || unrecognized == 0);
+      ASSERT (optind == 4);
+    }
+
+  /* Check that by default, non-options arguments are moved to the end.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "-p") == 0);
+      ASSERT (strcmp (argv[2], "billy") == 0);
+      ASSERT (strcmp (argv[3], "-a") == 0);
+      ASSERT (strcmp (argv[4], "donald") == 0);
+      ASSERT (strcmp (argv[5], "duck") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 4);
+    }
+
+  /* Check that '--' ends the argument processing.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[20];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "--";
+      argv[argc++] = "-b";
+      argv[argc++] = "foo";
+      argv[argc++] = "-q";
+      argv[argc++] = "johnny";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "-p") == 0);
+      ASSERT (strcmp (argv[2], "billy") == 0);
+      ASSERT (strcmp (argv[3], "-a") == 0);
+      ASSERT (strcmp (argv[4], "--") == 0);
+      ASSERT (strcmp (argv[5], "donald") == 0);
+      ASSERT (strcmp (argv[6], "duck") == 0);
+      ASSERT (strcmp (argv[7], "-b") == 0);
+      ASSERT (strcmp (argv[8], "foo") == 0);
+      ASSERT (strcmp (argv[9], "-q") == 0);
+      ASSERT (strcmp (argv[10], "johnny") == 0);
+      ASSERT (strcmp (argv[11], "bar") == 0);
+      ASSERT (argv[12] == NULL);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 5);
+    }
+
+  /* Check that the '-' flag causes non-options to be returned in order.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "-abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 3);
+      ASSERT (strcmp (non_options[0], "donald") == 0);
+      ASSERT (strcmp (non_options[1], "duck") == 0);
+      ASSERT (strcmp (non_options[2], "bar") == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 7);
+    }
+
+  /* Check that '--' ends the argument processing.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[20];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "--";
+      argv[argc++] = "-b";
+      argv[argc++] = "foo";
+      argv[argc++] = "-q";
+      argv[argc++] = "johnny";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "-abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "--") == 0);
+      ASSERT (strcmp (argv[7], "-b") == 0);
+      ASSERT (strcmp (argv[8], "foo") == 0);
+      ASSERT (strcmp (argv[9], "-q") == 0);
+      ASSERT (strcmp (argv[10], "johnny") == 0);
+      ASSERT (strcmp (argv[11], "bar") == 0);
+      ASSERT (argv[12] == NULL);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+      ASSERT (q_value == NULL);
+      if (non_options_count == 2)
+      {
+        /* glibc behaviour.  */
+        ASSERT (non_options_count == 2);
+        ASSERT (strcmp (non_options[0], "donald") == 0);
+        ASSERT (strcmp (non_options[1], "duck") == 0);
+        ASSERT (unrecognized == 0);
+        ASSERT (optind == 7);
+      }
+      else
+      {
+        /* Another valid behaviour.  */
+        ASSERT (non_options_count == 7);
+        ASSERT (strcmp (non_options[0], "donald") == 0);
+        ASSERT (strcmp (non_options[1], "duck") == 0);
+        ASSERT (strcmp (non_options[2], "-b") == 0);
+        ASSERT (strcmp (non_options[3], "foo") == 0);
+        ASSERT (strcmp (non_options[4], "-q") == 0);
+        ASSERT (strcmp (non_options[5], "johnny") == 0);
+        ASSERT (strcmp (non_options[6], "bar") == 0);
+        ASSERT (unrecognized == 0);
+        ASSERT (optind == 12);
+      }
+    }
+
+  /* Check that the '-' flag has to come first.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:-", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "-p") == 0);
+      ASSERT (strcmp (argv[2], "billy") == 0);
+      ASSERT (strcmp (argv[3], "-a") == 0);
+      ASSERT (strcmp (argv[4], "donald") == 0);
+      ASSERT (strcmp (argv[5], "duck") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 4);
+    }
+
+  /* Check that the '+' flag causes the first non-option to terminate the
+     loop.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "+abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 1);
+    }
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-+";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "+abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == '+');
+      ASSERT (optind == 2);
+    }
+
+  /* Check that '--' ends the argument processing.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[20];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "--";
+      argv[argc++] = "-b";
+      argv[argc++] = "foo";
+      argv[argc++] = "-q";
+      argv[argc++] = "johnny";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "+abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "--") == 0);
+      ASSERT (strcmp (argv[7], "-b") == 0);
+      ASSERT (strcmp (argv[8], "foo") == 0);
+      ASSERT (strcmp (argv[9], "-q") == 0);
+      ASSERT (strcmp (argv[10], "johnny") == 0);
+      ASSERT (strcmp (argv[11], "bar") == 0);
+      ASSERT (argv[12] == NULL);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 1);
+    }
+
+  /* Check that the '+' flag has to come first.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:+", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "-p") == 0);
+      ASSERT (strcmp (argv[2], "billy") == 0);
+      ASSERT (strcmp (argv[3], "-a") == 0);
+      ASSERT (strcmp (argv[4], "donald") == 0);
+      ASSERT (strcmp (argv[5], "duck") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value != NULL && strcmp (p_value, "billy") == 0);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 4);
+    }
+}
+
+/* Test behavior of getopt_long when POSIXLY_CORRECT is set in the
+   environment.  Options with optional arguments should not change
+   behavior just because of an environment variable.
+   https://lists.gnu.org/r/bug-m4/2006-09/msg00028.html  */
+static void
+test_getopt_long_posix (void)
+{
+  int start;
+
+  /* Check that POSIXLY_CORRECT stops parsing the same as leading '+'.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "donald";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc++] = "duck";
+      argv[argc++] = "-a";
+      argv[argc++] = "bar";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "abp:q:", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (strcmp (argv[0], "program") == 0);
+      ASSERT (strcmp (argv[1], "donald") == 0);
+      ASSERT (strcmp (argv[2], "-p") == 0);
+      ASSERT (strcmp (argv[3], "billy") == 0);
+      ASSERT (strcmp (argv[4], "duck") == 0);
+      ASSERT (strcmp (argv[5], "-a") == 0);
+      ASSERT (strcmp (argv[6], "bar") == 0);
+      ASSERT (argv[7] == NULL);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 1);
+    }
+
+  /* Check that POSIXLY_CORRECT doesn't change optional arguments.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-p";
+      argv[argc++] = "billy";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "p::", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 0);
+      ASSERT (b_seen == 0);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 2);
+    }
+
+  /* Check that leading - still sees options after non-options.  */
+  for (start = 0; start <= 1; start++)
+    {
+      const char *p_value = NULL;
+      const char *q_value = NULL;
+      int non_options_count = 0;
+      const char *non_options[10];
+      int unrecognized = 0;
+      int argc = 0;
+      const char *argv[10];
+      a_seen = 0;
+      b_seen = 0;
+
+      argv[argc++] = "program";
+      argv[argc++] = "-a";
+      argv[argc++] = "billy";
+      argv[argc++] = "-b";
+      argv[argc] = NULL;
+      optind = start;
+      getopt_long_loop (argc, argv, "-ab", long_options_required,
+                        &p_value, &q_value,
+                        &non_options_count, non_options, &unrecognized);
+      ASSERT (a_seen == 1);
+      ASSERT (b_seen == 1);
+      ASSERT (p_value == NULL);
+      ASSERT (q_value == NULL);
+      ASSERT (non_options_count == 1);
+      ASSERT (strcmp (non_options[0], "billy") == 0);
+      ASSERT (unrecognized == 0);
+      ASSERT (optind == 4);
+    }
+}
+
+/* Reduce casting, so we can use string literals elsewhere.
+   getopt_long_only takes an array of char*, but luckily does not
+   modify those elements, so we can pass const char*.  */
+static int
+do_getopt_long_only (int argc, const char **argv, const char *shortopts,
+                     const struct option *longopts, int *longind)
+{
+  return getopt_long_only (argc, (char **) argv, shortopts, longopts, longind);
+}
+
+static void
+test_getopt_long_only (void)
+{
+  /* Test disambiguation of options.  */
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-x";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "ab", long_options_required,
+                             &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-x";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "abx", long_options_required,
+                             &option_index);
+    ASSERT (c == 'x');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--x";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "abx", long_options_required,
+                             &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-b";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    b_seen = 0;
+    c = do_getopt_long_only (argc, argv, "abx", long_options_required,
+                             &option_index);
+    ASSERT (c == 'b');
+    ASSERT (b_seen == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "--b";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    b_seen = 0;
+    c = do_getopt_long_only (argc, argv, "abx", long_options_required,
+                             &option_index);
+    ASSERT (c == 0);
+    ASSERT (b_seen == 1);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-xt";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "ab", long_options_required,
+                             &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-xt";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "abx", long_options_required,
+                             &option_index);
+    ASSERT (c == '?');
+    ASSERT (optopt == 0);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-xtra";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "ab", long_options_required,
+                             &option_index);
+    ASSERT (c == 1001);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-xtreme";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "abx:", long_options_required,
+                             &option_index);
+    ASSERT (c == 1002);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-xtremel";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "ab", long_options_required,
+                             &option_index);
+    /* glibc getopt_long_only is intentionally different from
+       getopt_long when handling a prefix that is common to two
+       spellings, when both spellings have the same option directives.
+       BSD getopt_long_only treats both cases the same.  */
+    ASSERT (c == 1003 || c == '?');
+    ASSERT (optind == 2);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-xtremel";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "abx::", long_options_required,
+                             &option_index);
+    /* glibc getopt_long_only is intentionally different from
+       getopt_long when handling a prefix that is common to two
+       spellings, when both spellings have the same option directives.
+       BSD getopt_long_only treats both cases the same.  */
+    ASSERT (c == 1003 || c == '?');
+    ASSERT (optind == 2);
+    ASSERT (optarg == NULL);
+  }
+  {
+    int argc = 0;
+    const char *argv[10];
+    int option_index;
+    int c;
+
+    argv[argc++] = "program";
+    argv[argc++] = "-xtras";
+    argv[argc] = NULL;
+    optind = 1;
+    opterr = 0;
+    c = do_getopt_long_only (argc, argv, "abx::", long_options_required,
+                             &option_index);
+    ASSERT (c == 'x');
+    ASSERT (strcmp (optarg, "tras") == 0);
+  }
+}
deleted file mode 120000 (symlink)
index 1a3e38d1972fa1aa2108079beff7d34d06ae7a52..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getprogname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f26696dbdbf6e7ce564bd81f38dffd2cfdb2e3fc
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test the gnulib getprogname module.
+   Copyright (C) 2016-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <string.h>
+#include <assert.h>
+
+#ifdef __hpux
+# define STREQ(a, b) (strncmp (a, b, 14) == 0)
+#else
+# define STREQ(a, b) (strcmp (a, b) == 0)
+#endif
+
+int
+main (void)
+{
+  char const *p = getprogname ();
+
+  /* libtool creates a temporary executable whose name is sometimes prefixed
+     with "lt-" (depends on the platform).  But the name of the temporary
+     executable is a detail that should not be visible to the end user and to
+     the test suite.  Remove this "lt-" prefix here.  */
+  if (strncmp (p, "lt-", 3) == 0)
+    p += 3;
+
+  /* Note: You can make this test fail
+     a) by running it on a case-insensitive file system (such as on Windows,
+        Cygwin, or on Mac OS X with a case-insensitive HFS+ file system),
+        with an invocation that contains upper case characters, e.g.
+        test-GETPROGNAME,
+     b) by hardlinking or symlinking it to a different name (e.g. test-foo)
+        and invoking it through that name.
+     That's not the intended use. The Makefile always invokes it as
+     'test-getprogname${EXEEXT}'. */
+#if defined __CYGWIN__
+  /* The Cygwin getprogname() function strips the ".exe" suffix. */
+  assert (STREQ (p, "test-getprogname"));
+#else
+  assert (STREQ (p, "test-getprogname" EXEEXT));
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 642beca1c6fa4d8fe979ca322887a04d06434ef9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getrandom.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..68a3ae346b32afedd9454117edb0235db029c704
--- /dev/null
@@ -0,0 +1,92 @@
+/* Test of getting random bytes.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible.  */
+
+#include <config.h>
+
+#include <sys/random.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getrandom, ssize_t, (void *, size_t, unsigned int));
+
+#include <errno.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  char buf1[8];
+  char buf2[8];
+  char large_buf[100000];
+  ssize_t ret;
+
+  /* Check that different calls produce different results (with a high
+     probability).  */
+  ret = getrandom (buf1, sizeof (buf1), 0);
+  if (ret < 0)
+    ASSERT (errno == ENOSYS);
+  else
+    {
+      ret = getrandom (buf2, sizeof (buf2), 0);
+      if (ret < 0)
+        ASSERT (errno == ENOSYS);
+      else
+        {
+          /* It is very unlikely that two calls to getrandom produce the
+             same results.  */
+          ASSERT (memcmp (buf1, buf2, sizeof (buf1)) != 0);
+        }
+    }
+
+  /* Likewise with the "truly random" number generator.  */
+  ret = getrandom (buf1, sizeof (buf1), GRND_RANDOM);
+  if (ret < 0)
+    ASSERT (errno == ENOSYS);
+  else
+    {
+      ret = getrandom (buf2, sizeof (buf2), GRND_RANDOM);
+      if (ret < 0)
+        ASSERT (errno == ENOSYS);
+      else
+        {
+          /* It is very unlikely that two calls to getrandom produce the
+             same results.  */
+          ASSERT (memcmp (buf1, buf2, sizeof (buf1)) != 0);
+        }
+    }
+
+  /* Check that GRND_NONBLOCK works.  */
+  ret = getrandom (large_buf, sizeof (large_buf), GRND_RANDOM | GRND_NONBLOCK);
+  ASSERT (ret <= (ssize_t) sizeof (large_buf));
+  /* It is very unlikely that so many truly random bytes were ready.  */
+  if (ret < 0)
+    ASSERT (errno == ENOSYS || errno == EAGAIN
+            || errno == EINVAL /* Solaris */);
+  else
+    ASSERT (ret > 0);
+
+  if (getrandom (buf1, 1, 0) < 1)
+    if (getrandom (buf1, 1, GRND_RANDOM) < 1)
+      {
+        fputs ("Skipping test: getrandom is ineffective\n", stderr);
+        return 77;
+      }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 4cb8a883affec46de32e012afe213430b490e1bd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-getrusage.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a6549374f7786adee8483271afcbc14cdd4b079b
--- /dev/null
@@ -0,0 +1,86 @@
+/* Test of getting resource utilization.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2012.  */
+
+#include <config.h>
+
+#include <sys/resource.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getrusage, int, (int, struct rusage *));
+
+#include <sys/time.h>
+
+#include "macros.h"
+
+volatile unsigned int counter;
+
+int
+main (void)
+{
+  struct rusage before;
+  struct rusage after;
+  int ret;
+
+  ret = getrusage (RUSAGE_SELF, &before);
+  ASSERT (ret == 0);
+
+  /* Busy-loop for one second.  */
+  {
+    struct timeval t0;
+    ASSERT (gettimeofday (&t0, NULL) == 0);
+
+    for (;;)
+      {
+        struct timeval t;
+        int i;
+
+        for (i = 0; i < 1000000; i++)
+          counter++;
+
+        ASSERT (gettimeofday (&t, NULL) == 0);
+        if (t.tv_sec - t0.tv_sec > 1
+            || (t.tv_sec - t0.tv_sec == 1 && t.tv_usec >= t0.tv_usec))
+          break;
+      }
+  }
+
+  ret = getrusage (RUSAGE_SELF, &after);
+  ASSERT (ret == 0);
+
+  ASSERT (after.ru_utime.tv_sec >= before.ru_utime.tv_sec);
+  ASSERT (after.ru_stime.tv_sec >= before.ru_stime.tv_sec);
+  {
+    /* Compute time spent during busy-looping (in usec).  */
+    unsigned int spent_utime =
+      (after.ru_utime.tv_sec > before.ru_utime.tv_sec
+       ? (after.ru_utime.tv_sec - before.ru_utime.tv_sec - 1) * 1000000U
+         + after.ru_utime.tv_usec + (1000000U - before.ru_utime.tv_usec)
+       : after.ru_utime.tv_usec - before.ru_utime.tv_usec);
+    unsigned int spent_stime =
+      (after.ru_stime.tv_sec > before.ru_stime.tv_sec
+       ? (after.ru_stime.tv_sec - before.ru_stime.tv_sec - 1) * 1000000U
+         + after.ru_stime.tv_usec + (1000000U - before.ru_stime.tv_usec)
+       : after.ru_stime.tv_usec - before.ru_stime.tv_usec);
+
+    ASSERT (spent_utime + spent_stime <= 2 * 1000000U);
+    /* Assume that the load during this busy-looping was less than 100.  */
+    ASSERT (spent_utime + spent_stime > 10000U);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 4dea67d9494e4630ce302fa60a04a1dbf3163677..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-gettime-res.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f1dbf2395003dbb7f48c9d31c1faff6476492e81
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2022-2024 Free Software Foundation, Inc.
+ * Written by Paul Eggert.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <timespec.h>
+
+#include <stdio.h>
+
+int
+main (void)
+{
+  long int res = gettime_res ();
+  printf ("gettime_res returned %ld ns\n", res);
+
+  if (res <= 0)
+    {
+      fprintf (stderr, "gettime_res value %ld not positive\n", res);
+      return 1;
+    }
+
+  if (res < TIMESPEC_HZ)
+    {
+      if (TIMESPEC_HZ % res != 0)
+        {
+          fprintf (stderr,
+                   ("gettime_res value %ld ns is smaller than %d"
+                    " but does not divide it\n"),
+                   res, TIMESPEC_HZ);
+          return 1;
+        }
+    }
+  else
+    {
+      if (res % TIMESPEC_HZ != 0)
+        {
+          fprintf (stderr,
+                   ("gettime_res value %ld ns is larger than %d"
+                    " but is not a multiple of it\n"),
+                   res, TIMESPEC_HZ);
+          return 1;
+        }
+    }
+
+  int saw_res = 0;
+
+  for (int i = 0; i < 100000; i++)
+    {
+      struct timespec t = current_timespec ();
+      if (res < TIMESPEC_HZ
+          ? t.tv_nsec % res != 0
+          : t.tv_nsec != 0 || t.tv_sec % (res / TIMESPEC_HZ) != 0)
+        {
+          fprintf (stderr,
+                   ("current_timespec returned %lld.%09ld which is not"
+                    " a multiple of the resolution, %ld ns\n"),
+                   (long long) t.tv_sec, t.tv_nsec, res);
+          return 1;
+        }
+      if (res < TIMESPEC_HZ
+          ? (t.tv_nsec / res % 2 != 0
+             || t.tv_nsec / res % 5 != 0)
+          : (t.tv_sec / (res / TIMESPEC_HZ) % 2 != 0
+             || t.tv_sec / (res / TIMESPEC_HZ) % 5 != 0))
+        saw_res = 1;
+    }
+
+  if (saw_res == 0)
+    fprintf (stderr,
+             ("warning: all timestamps had coarser"
+              " resolution than %ld ns\n"),
+             res);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5821026332f8fa8a488953e14298415862aa8736..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-gettimeofday.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ea810bd55e86df1f51086cd6f8648dc7cdde9cc3
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering and Bruno Haible.  */
+
+#include <config.h>
+
+#include <sys/time.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (gettimeofday, int,
+                 (struct timeval *, GETTIMEOFDAY_TIMEZONE *));
+
+#include <time.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+static void
+test_clobber ()
+{
+  time_t t = 0;
+  struct tm *lt;
+  struct tm saved_lt;
+  struct timeval tv;
+  lt = localtime (&t);
+  saved_lt = *lt;
+  gettimeofday (&tv, NULL);
+  if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0)
+    {
+      fprintf (stderr, "gettimeofday still clobbers the localtime buffer!\n");
+      exit (1);
+    }
+}
+
+static void
+test_consistency ()
+{
+  struct timeval tv1;
+  time_t tt2;
+  struct timeval tv3;
+  time_t tt4;
+
+  ASSERT (gettimeofday (&tv1, NULL) == 0);
+  tt2 = time (NULL);
+  ASSERT (gettimeofday (&tv3, NULL) == 0);
+  tt4 = time (NULL);
+
+  /* Verify monotonicity of gettimeofday().  */
+  ASSERT (tv1.tv_sec < tv3.tv_sec
+          || (tv1.tv_sec == tv3.tv_sec && tv1.tv_usec <= tv3.tv_usec));
+
+  /* Verify monotonicity of time().  */
+  ASSERT (tt2 <= tt4);
+
+  /* Verify that the tv_sec field of the result is the same as time(NULL).  */
+  /* Note: It's here that the dependency to the 'time' module is needed.
+     Without it, this assertion would sometimes fail on glibc systems, see
+     https://sourceware.org/bugzilla/show_bug.cgi?id=30200  */
+  ASSERT (tv1.tv_sec <= tt2);
+  ASSERT (tt2 <= tv3.tv_sec);
+  ASSERT (tv3.tv_sec <= tt4);
+}
+
+int
+main (void)
+{
+  test_clobber ();
+  test_consistency ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 1f7faca1956160287511cce8fadede28665f8c03..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-hard-locale.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..151843ca63f93a43d75b8d9b034719a5241faf1a
--- /dev/null
@@ -0,0 +1,116 @@
+/* Test of determination whether a locale is different from the "C" locale.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+#include "hard-locale.h"
+
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+
+/* True if all locale names are accepted and all locales are trivial.
+   This is the case e.g. on OpenBSD 3.8.  */
+static bool all_trivial;
+
+static int
+test_one (const char *name, int failure_bitmask)
+{
+  if (setlocale (LC_ALL, name) != NULL)
+    {
+      bool expected;
+
+      /* musl libc has special code for the C.UTF-8 locale; other than that,
+         all locale names are accepted and all locales are trivial.
+         OpenBSD returns the locale name that was set, but we don't know how it
+         behaves under the hood.  Likewise for Haiku.
+         On Android >= 5.0, the "C" locale may have UTF-8 encoding, and we don't
+         know how it will behave in the future.  */
+#if defined MUSL_LIBC || defined __OpenBSD__ || defined __HAIKU__ || defined __ANDROID__
+      expected = true;
+#else
+      expected = !all_trivial;
+#endif
+      if (hard_locale (LC_CTYPE) != expected)
+        {
+          if (expected)
+            fprintf (stderr, "Unexpected: The category LC_CTYPE of the locale '%s' is not equivalent to C or POSIX.\n",
+                     name);
+          else
+            fprintf (stderr, "Unexpected: The category LC_CTYPE of the locale '%s' is equivalent to C or POSIX.\n",
+                     name);
+          return failure_bitmask;
+        }
+
+      /* On NetBSD 7.0, some locales such as de_DE.ISO8859-1 and de_DE.UTF-8
+         have the LC_COLLATE category set to "C".
+         Similarly, on musl libc, with the C.UTF-8 locale.
+         On Android >= 5.0, the "C" locale may have UTF-8 encoding, and we don't
+         know how it will behave in the future.  */
+#if defined __NetBSD__
+      expected = false;
+#elif defined MUSL_LIBC
+      expected = strcmp (name, "C.UTF-8") != 0;
+#elif (defined __OpenBSD__ && HAVE_DUPLOCALE) || defined __HAIKU__ || defined __ANDROID__ /* OpenBSD >= 6.2, Haiku, Android */
+      expected = true;
+#else
+      expected = !all_trivial;
+#endif
+      if (hard_locale (LC_COLLATE) != expected)
+        {
+          if (expected)
+            fprintf (stderr, "Unexpected: The category LC_COLLATE of the locale '%s' is not equivalent to C or POSIX.\n",
+                     name);
+          else
+            fprintf (stderr, "Unexpected: The category LC_COLLATE of the locale '%s' is equivalent to C or POSIX.\n",
+                     name);
+          return failure_bitmask;
+        }
+    }
+  return 0;
+}
+
+int
+main ()
+{
+  int fail = 0;
+
+  /* The initial locale is the "C" or "POSIX" locale.
+     On Android >= 5.0, it is equivalent to the "C.UTF-8" locale, cf.
+     <https://lists.gnu.org/archive/html/bug-gnulib/2023-01/msg00141.html>.  */
+#if ! defined __ANDROID__
+  if (hard_locale (LC_CTYPE) || hard_locale (LC_COLLATE))
+    {
+      fprintf (stderr, "The initial locale should not be hard!\n");
+      fail |= 1;
+    }
+#endif
+
+  all_trivial = (setlocale (LC_ALL, "foobar") != NULL);
+
+  fail |= test_one ("de", 2);
+  fail |= test_one ("de_DE", 4);
+  fail |= test_one ("de_DE.ISO8859-1", 8);
+  fail |= test_one ("de_DE.iso88591", 8);
+  fail |= test_one ("de_DE.UTF-8", 16);
+  fail |= test_one ("de_DE.utf8", 16);
+  fail |= test_one ("german", 32);
+  fail |= test_one ("C.UTF-8", 64);
+
+  return fail;
+}
deleted file mode 120000 (symlink)
index 24be457f7fb782e02e84b3df0c3b2ddc1fb1374c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-hash.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..12ce00ccde657b42f0f27378403449ab720ab34c
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ * Written by Jim Meyering
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "hash.h"
+#include "hash-pjw.h"
+#include "inttostr.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define STREQ(a, b) (strcmp (a, b) == 0)
+#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
+
+static bool
+hash_compare_strings (void const *x, void const *y)
+{
+  ASSERT (x != y);
+  return STREQ (x, y) ? true : false;
+}
+
+static void
+hash_freer (void *x)
+{
+  free (x);
+}
+
+static void
+insert_new (Hash_table *ht, const void *ent)
+{
+  void *e = hash_insert (ht, ent);
+  ASSERT (e == ent);
+}
+
+static bool
+walk (void *ent, void *data)
+{
+  char *str = ent;
+  unsigned int *map = data;
+  switch (*str)
+    {
+    case 'a': *map |= 1; return true;
+    case 'b': *map |= 2; return true;
+    case 'c': *map |= 4; return true;
+    }
+  *map |= 8;
+  return false;
+}
+
+static int
+get_seed (char const *str, unsigned int *seed)
+{
+  size_t len = strlen (str);
+  if (len == 0 || strspn (str, "0123456789") != len || 10 < len)
+    return 1;
+
+  *seed = atoi (str);
+  return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+  unsigned int i;
+  unsigned int k;
+  unsigned int table_size[] = {1, 2, 3, 4, 5, 23, 53};
+  Hash_table *ht;
+  Hash_tuning tuning;
+
+  hash_reset_tuning (&tuning);
+  tuning.shrink_threshold = 0.3;
+  tuning.shrink_factor = 0.707;
+  tuning.growth_threshold = 1.5;
+  tuning.growth_factor = 2.0;
+  tuning.is_n_buckets = true;
+
+  if (1 < argc)
+    {
+      unsigned int seed;
+      if (get_seed (argv[1], &seed) != 0)
+        {
+          fprintf (stderr, "invalid seed: %s\n", argv[1]);
+          exit (EXIT_FAILURE);
+        }
+
+      srand (seed);
+    }
+
+  for (i = 0; i < ARRAY_CARDINALITY (table_size); i++)
+    {
+      size_t sz = table_size[i];
+      ht = hash_initialize (sz, NULL, hash_pjw, hash_compare_strings, NULL);
+      ASSERT (ht);
+      insert_new (ht, "a");
+      {
+        char *str1 = strdup ("a");
+        char *str2;
+        ASSERT (str1);
+        str2 = hash_insert (ht, str1);
+        ASSERT (str1 != str2);
+        ASSERT (STREQ (str1, str2));
+        free (str1);
+      }
+      insert_new (ht, "b");
+      insert_new (ht, "c");
+      i = 0;
+      ASSERT (hash_do_for_each (ht, walk, &i) == 3);
+      ASSERT (i == 7);
+      {
+        void *buf[5] = { NULL };
+        ASSERT (hash_get_entries (ht, NULL, 0) == 0);
+        ASSERT (hash_get_entries (ht, buf, 5) == 3);
+        ASSERT (STREQ (buf[0], "a") || STREQ (buf[0], "b") || STREQ (buf[0], "c"));
+      }
+      ASSERT (hash_remove (ht, "a"));
+      ASSERT (hash_remove (ht, "a") == NULL);
+      ASSERT (hash_remove (ht, "b"));
+      ASSERT (hash_remove (ht, "c"));
+
+      ASSERT (hash_rehash (ht, 47));
+      ASSERT (hash_rehash (ht, 467));
+
+      /* Free an empty table. */
+      hash_clear (ht);
+      hash_free (ht);
+
+      ht = hash_initialize (sz, NULL, hash_pjw, hash_compare_strings, NULL);
+      ASSERT (ht);
+
+      insert_new (ht, "z");
+      insert_new (ht, "y");
+      insert_new (ht, "x");
+      insert_new (ht, "w");
+      insert_new (ht, "v");
+      insert_new (ht, "u");
+
+      hash_clear (ht);
+      ASSERT (hash_get_n_entries (ht) == 0);
+      hash_free (ht);
+
+      /* Test pointer hashing.  */
+      ht = hash_initialize (sz, NULL, NULL, NULL, NULL);
+      ASSERT (ht);
+      {
+        char *str = strdup ("a");
+        ASSERT (str);
+        insert_new (ht, "a");
+        insert_new (ht, str);
+        ASSERT (hash_lookup (ht, str) == str);
+        free (str);
+      }
+      hash_free (ht);
+    }
+
+  hash_reset_tuning (&tuning);
+  tuning.shrink_threshold = 0.3;
+  tuning.shrink_factor = 0.707;
+  tuning.growth_threshold = 1.5;
+  tuning.growth_factor = 2.0;
+  tuning.is_n_buckets = true;
+  /* Invalid tuning.  */
+  ht = hash_initialize (4651, &tuning, hash_pjw, hash_compare_strings,
+                        hash_freer);
+  ASSERT (!ht);
+
+  /* Alternate tuning.  */
+  tuning.growth_threshold = 0.89;
+
+  /* Run with default tuning, then with custom tuning settings.  */
+  for (k = 0; k < 2; k++)
+    {
+      Hash_tuning const *tune = (k == 0 ? NULL : &tuning);
+      /* Now, each entry is malloc'd.  */
+      ht = hash_initialize (4651, tune, hash_pjw,
+                            hash_compare_strings, hash_freer);
+      ASSERT (ht);
+      for (i = 0; i < 10000; i++)
+        {
+          unsigned int op = rand () % 10;
+          switch (op)
+            {
+            case 0:
+            case 1:
+            case 2:
+            case 3:
+            case 4:
+            case 5:
+              {
+                char buf[50];
+                char const *p = uinttostr (i, buf);
+                char *p_dup = strdup (p);
+                ASSERT (p_dup);
+                insert_new (ht, p_dup);
+              }
+              break;
+
+            case 6:
+              {
+                size_t n = hash_get_n_entries (ht);
+                ASSERT (hash_rehash (ht, n + rand () % 20));
+              }
+              break;
+
+            case 7:
+              {
+                size_t n = hash_get_n_entries (ht);
+                size_t delta = rand () % 20;
+                if (delta < n)
+                  ASSERT (hash_rehash (ht, n - delta));
+              }
+              break;
+
+            case 8:
+            case 9:
+              {
+                /* Delete a random entry.  */
+                size_t n = hash_get_n_entries (ht);
+                if (n)
+                  {
+                    size_t kk = rand () % n;
+                    void const *p;
+                    void *v;
+                    for (p = hash_get_first (ht); kk;
+                         --kk, p = hash_get_next (ht, p))
+                      {
+                        /* empty */
+                      }
+                    ASSERT (p);
+                    v = hash_remove (ht, p);
+                    ASSERT (v);
+                    free (v);
+                  }
+                break;
+              }
+            }
+          ASSERT (hash_table_ok (ht));
+        }
+
+      hash_free (ht);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f9947e896ecf2281caa139cbeb0c7e65a1866ca6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-i-ring.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f395538bc292eae1c14e94b2286b8322ecebb790
--- /dev/null
@@ -0,0 +1,63 @@
+/* Test the simple ring buffer.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "i-ring.h"
+
+#include "macros.h"
+
+int
+main (void)
+{
+  int o;
+  I_ring ir;
+  i_ring_init (&ir, -1);
+  o = i_ring_push (&ir, 1);
+  ASSERT (o == -1);
+  o = i_ring_push (&ir, 2);
+  ASSERT (o == -1);
+  o = i_ring_push (&ir, 3);
+  ASSERT (o == -1);
+  o = i_ring_push (&ir, 4);
+  ASSERT (o == -1);
+  o = i_ring_push (&ir, 5);
+  ASSERT (o == 1);
+  o = i_ring_push (&ir, 6);
+  ASSERT (o == 2);
+  o = i_ring_push (&ir, 7);
+  ASSERT (o == 3);
+
+  o = i_ring_pop (&ir);
+  ASSERT (o == 7);
+  o = i_ring_pop (&ir);
+  ASSERT (o == 6);
+  o = i_ring_pop (&ir);
+  ASSERT (o == 5);
+  o = i_ring_pop (&ir);
+  ASSERT (o == 4);
+  ASSERT (i_ring_empty (&ir));
+
+  o = i_ring_push (&ir, 8);
+  ASSERT (o == -1);
+  o = i_ring_pop (&ir);
+  ASSERT (o == 8);
+  ASSERT (i_ring_empty (&ir));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f6aeab55b19ba378a76fa379df316456b7af5c97..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iconv-h.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ba1534d3bab42af66af508d5669a6509ed8c7d89
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test of <iconv.h> substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#if HAVE_ICONV
+# include <iconv.h>
+#endif
+
+int
+main ()
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index ca3c2c6fe9f4e12b5c5c7b3c045742f3839adf16..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iconv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..78bf7a2edefe45af6e6c840f834504544bccc290
--- /dev/null
@@ -0,0 +1,159 @@
+/* Test of character set conversion.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#if HAVE_ICONV
+# include <iconv.h>
+
+# ifndef ICONV_CONST
+#  define ICONV_CONST /* empty */
+# endif
+
+#include "signature.h"
+SIGNATURE_CHECK (iconv, size_t, (iconv_t, ICONV_CONST char **, size_t *,
+                                 char **, size_t *));
+SIGNATURE_CHECK (iconv_close, int, (iconv_t x));
+SIGNATURE_CHECK (iconv_open, iconv_t, (char const *, char const *));
+
+#endif
+
+#include <errno.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+#if HAVE_ICONV
+  /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
+     and UTF-8.  */
+  iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+  iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8");
+
+#if defined __MVS__ && defined __IBMC__
+  /* String literals below are in ASCII, not EBCDIC.  */
+# pragma convert("ISO8859-1")
+# define CONVERT_ENABLED
+#endif
+
+  ASSERT (cd_88591_to_utf8 != (iconv_t)(-1));
+  ASSERT (cd_utf8_to_88591 != (iconv_t)(-1));
+
+  /* Test conversion from ISO-8859-1 to UTF-8 with no errors.  */
+  {
+    static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+    static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
+    char buf[50];
+    const char *inptr = input;
+    size_t inbytesleft = strlen (input);
+    char *outptr = buf;
+    size_t outbytesleft = sizeof (buf);
+    size_t res = iconv (cd_88591_to_utf8,
+                        (ICONV_CONST char **) &inptr, &inbytesleft,
+                        &outptr, &outbytesleft);
+    ASSERT (res == 0 && inbytesleft == 0);
+    ASSERT (outptr == buf + strlen (expected));
+    ASSERT (memcmp (buf, expected, strlen (expected)) == 0);
+  }
+
+  /* Test conversion from ISO-8859-1 to UTF-8 with E2BIG.  */
+  {
+    static const char input[] = "\304";
+    static char buf[2] = { (char)0xDE, (char)0xAD };
+    const char *inptr = input;
+    size_t inbytesleft = 1;
+    char *outptr = buf;
+    size_t outbytesleft = 1;
+    size_t res = iconv (cd_88591_to_utf8,
+                        (ICONV_CONST char **) &inptr, &inbytesleft,
+                        &outptr, &outbytesleft);
+    ASSERT (res == (size_t)(-1) && errno == E2BIG);
+    ASSERT (inbytesleft == 1);
+    ASSERT (outbytesleft == 1);
+    ASSERT ((unsigned char) buf[1] == 0xAD);
+    ASSERT ((unsigned char) buf[0] == 0xDE);
+  }
+
+  /* Test conversion from UTF-8 to ISO-8859-1 with no errors.  */
+  {
+    static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
+    static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+    char buf[50];
+    const char *inptr = input;
+    size_t inbytesleft = strlen (input);
+    char *outptr = buf;
+    size_t outbytesleft = sizeof (buf);
+    size_t res = iconv (cd_utf8_to_88591,
+                        (ICONV_CONST char **) &inptr, &inbytesleft,
+                        &outptr, &outbytesleft);
+    ASSERT (res == 0 && inbytesleft == 0);
+    ASSERT (outptr == buf + strlen (expected));
+    ASSERT (memcmp (buf, expected, strlen (expected)) == 0);
+  }
+
+  /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ.  */
+  {
+    static const char input[] = "\342\202\254"; /* EURO SIGN */
+    char buf[10];
+    const char *inptr = input;
+    size_t inbytesleft = strlen (input);
+    char *outptr = buf;
+    size_t outbytesleft = sizeof (buf);
+    size_t res = iconv (cd_utf8_to_88591,
+                        (ICONV_CONST char **) &inptr, &inbytesleft,
+                        &outptr, &outbytesleft);
+    if (res == (size_t)(-1))
+      {
+        ASSERT (errno == EILSEQ);
+        ASSERT (inbytesleft == strlen (input) && outptr == buf);
+      }
+    else
+      {
+        ASSERT (res == 1);
+        ASSERT (inbytesleft == 0);
+      }
+  }
+
+  /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL.  */
+  {
+    static const char input[] = "\342";
+    char buf[10];
+    const char *inptr = input;
+    size_t inbytesleft = 1;
+    char *outptr = buf;
+    size_t outbytesleft = sizeof (buf);
+    size_t res = iconv (cd_utf8_to_88591,
+                        (ICONV_CONST char **) &inptr, &inbytesleft,
+                        &outptr, &outbytesleft);
+    ASSERT (res == (size_t)(-1) && errno == EINVAL);
+    ASSERT (inbytesleft == 1 && outptr == buf);
+  }
+
+  iconv_close (cd_88591_to_utf8);
+  iconv_close (cd_utf8_to_88591);
+
+#ifdef CONVERT_ENABLED
+# pragma convert(pop)
+#endif
+
+#endif /* HAVE_ICONV */
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 95bcd067a62b06a09635ee1e7b04519f6d9ed8c3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ignore-value.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..32edfb45ef7409c1bedde7c58427e991c6686db4
--- /dev/null
@@ -0,0 +1,78 @@
+/* Test the "ignore-value" module.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#include <config.h>
+
+#include "ignore-value.h"
+
+#include <stdio.h>
+
+#include "attribute.h"
+
+struct s { int i; };
+NODISCARD static char doChar (void);
+NODISCARD static int doInt (void);
+NODISCARD static off_t doOff (void);
+NODISCARD static void *doPtr (void);
+NODISCARD static struct s doStruct (void);
+
+static char
+doChar (void)
+{
+  return 0;
+}
+
+static int
+doInt (void)
+{
+  return 0;
+}
+
+static off_t
+doOff (void)
+{
+  return 0;
+}
+
+static void *
+doPtr (void)
+{
+  return NULL;
+}
+
+static struct s
+doStruct (void)
+{
+  static struct s s1;
+  return s1;
+}
+
+int
+main (void)
+{
+  /* If this test can compile with -Werror and the same warnings as
+     the rest of the project, then we are properly silencing warnings
+     about ignored return values.  */
+  ignore_value (doChar ());
+  ignore_value (doInt ());
+  ignore_value (doOff ());
+  ignore_value (doPtr ());
+  ignore_value (doStruct ());
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8e08e5551bce36f7254ef3c02d8c0309cfbffe61..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-inet_ntop.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5985a2e7ff12a044447147a89bac9c364e59976d
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test of inet_ntop function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <arpa/inet.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (inet_ntop, char const *, (int, void const *, char *,
+                                           socklen_t));
+
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+#if defined AF_INET /* HAVE_IPV4 */
+  {
+    struct in_addr internal;
+    char printable[16];
+    const char *result;
+
+    /* This machine was for a long time known as
+       ma2s2.mathematik.uni-karlsruhe.de.  */
+# ifdef WORDS_BIGENDIAN
+    internal.s_addr = 0x810D7302;
+# else
+    internal.s_addr = 0x02730D81;
+# endif
+    result = inet_ntop (AF_INET, &internal, printable, sizeof (printable));
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "129.13.115.2") == 0);
+  }
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index a6e1a4ca4c32335cb8c5ca7913222dfdc1f81a34..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-inet_pton.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6598d5a0f30c5a6dcd0e6abdd05b1268e5629897
--- /dev/null
@@ -0,0 +1,58 @@
+/* Test of inet_pton function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <arpa/inet.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (inet_pton, int, (int, const char *, void *));
+
+#include <netinet/in.h>
+#include <sys/socket.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+#if defined AF_INET /* HAVE_IPV4 */
+  {
+    /* This machine was for a long time known as
+       ma2s2.mathematik.uni-karlsruhe.de.  */
+    const char printable[] = "129.13.115.2";
+    struct in_addr internal;
+    int ret;
+
+    ret = inet_pton (AF_INET, printable, &internal);
+    ASSERT (ret == 1);
+    /* Verify that internal is filled in network byte order.  */
+    ASSERT (((unsigned char *) &internal)[0] == 0x81);
+    ASSERT (((unsigned char *) &internal)[1] == 0x0D);
+    ASSERT (((unsigned char *) &internal)[2] == 0x73);
+    ASSERT (((unsigned char *) &internal)[3] == 0x02);
+# ifdef WORDS_BIGENDIAN
+    ASSERT (internal.s_addr == 0x810D7302);
+# else
+    ASSERT (internal.s_addr == 0x02730D81);
+# endif
+  }
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 44b7003bcd6d02635b99ad7e3430dfe85b1a41e4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-init.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..8f20fe61784ab9b7f0873fb943e14726ba3093e6
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/sh
+# Unit tests for init.sh
+# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.  */
+
+: "${srcdir=.}"
+. "$srcdir/init.sh"; path_prepend_ .
+
+fail=0
+
+test_compare()
+{
+  touch empty || fail=1
+  echo xyz > in || fail=1
+
+  compare /dev/null /dev/null >out 2>err || fail=1
+  test -s out && fail_ "out not empty: $(cat out)"
+  # "err" should be empty, too, but has "set -x" output when VERBOSE=yes
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+
+  compare /dev/null empty >out 2>err || fail=1
+  test -s out && fail_ "out not empty: $(cat out)"
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+
+  compare in in >out 2>err || fail=1
+  test -s out && fail_ "out not empty: $(cat out)"
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+
+  compare /dev/null in >out 2>err && fail=1
+  cat <<\EOF > exp
+diff -u /dev/null in
+--- /dev/null  1970-01-01
++++ in 1970-01-01
++xyz
+EOF
+  compare exp out || fail=1
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+
+  compare empty in >out 2>err && fail=1
+  # Compare against expected output only if compare is using diff -u.
+  if grep @ out >/dev/null; then
+    # Remove the TAB-date suffix on each --- and +++ line,
+    # for both the expected and the actual output files.
+    # Also remove the @@ line, since Solaris 5.10 and GNU diff formats differ:
+    # -@@ -0,0 +1 @@
+    # +@@ -1,0 +1,1 @@
+    # Also, remove space after leading '+', since AIX 7.1 diff outputs a space.
+    sed 's/    .*//;/^@@/d;s/^+ /+/' out > k && mv k out
+    cat <<\EOF > exp
+--- empty
++++ in
++xyz
+EOF
+    compare exp out || fail=1
+  fi
+  case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac
+}
+
+test_compare
+
+Exit $fail
deleted file mode 120000 (symlink)
index 90cfc310c8e390bbadd4882b5e71a1b71fe5868c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ino-map.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8e83252f85ebcfea1be02c82f8e0a36b2d95dea1
--- /dev/null
@@ -0,0 +1,50 @@
+/* Test the ino-map module.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "ino-map.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  enum { INO_MAP_INIT = 123 };
+  struct ino_map *ino_map = ino_map_alloc (INO_MAP_INIT);
+  ASSERT (ino_map != NULL);
+
+  ASSERT (ino_map_insert (ino_map, 42) == INO_MAP_INIT);
+  ASSERT (ino_map_insert (ino_map, 42) == INO_MAP_INIT);
+  ASSERT (ino_map_insert (ino_map, 398) == INO_MAP_INIT + 1);
+  ASSERT (ino_map_insert (ino_map, 398) == INO_MAP_INIT + 1);
+  ASSERT (ino_map_insert (ino_map, 0) == INO_MAP_INIT + 2);
+  ASSERT (ino_map_insert (ino_map, 0) == INO_MAP_INIT + 2);
+
+  {
+    int i;
+    for (i = 0; i < 100; i++)
+      {
+        ASSERT (ino_map_insert (ino_map, 10000 + i) == INO_MAP_INIT + 3 + i);
+      }
+  }
+
+  ino_map_free (ino_map);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index ed87d5d75713776863f9bfe7cfc3c830ae2147a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-intprops.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e0d63d474134b9f995a8912a5c564820c9c82561
--- /dev/null
@@ -0,0 +1,448 @@
+/* Test intprops.h.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* Tell gcc not to warn about the long expressions that the overflow
+   macros expand to, or about the (X < 0) expressions.  */
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Woverlength-strings"
+# pragma GCC diagnostic ignored "-Wtype-limits"
+
+/* Work around a bug in GCC 6.1 and earlier; see:
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68971  */
+# pragma GCC diagnostic ignored "-Woverflow"
+
+#endif
+
+#include <config.h>
+
+#ifdef TEST_STDCKDINT
+# include <stdckdint.h>
+#else
+# include "intprops.h"
+#endif
+
+#include <inttypes.h>
+#include <limits.h>
+
+#include "macros.h"
+
+/* Compile-time verification of expression X.
+   In this file, we need it as a statement, rather than as a declaration.  */
+#define verify_stmt(x) do { static_assert (x); } while (0)
+
+/* VERIFY (X) uses a static assertion for compilers that are known to work,
+   and falls back on a dynamic assertion for other compilers.
+   But it ignores X if testing stdckdint.h.
+   These tests should be checkable via 'verify' rather than 'ASSERT', but
+   using 'verify' would run into a bug with HP-UX 11.23 cc; see
+   <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>.  */
+#ifdef TEST_STDCKDINT
+# define VERIFY(x) ((void) 0)
+#elif __GNUC__ || __clang__ || __SUNPRO_C
+# define VERIFY(x) verify_stmt (x)
+#else
+# define VERIFY(x) ASSERT (x)
+#endif
+
+#define DONTCARE __LINE__
+
+int int_minus_2 = -2;
+int int_1 = 1;
+
+int
+main (void)
+{
+  /* Use VERIFY for tests that must be integer constant expressions,
+     ASSERT otherwise.  */
+
+#ifndef TEST_STDCKDINT
+  /* TYPE_IS_INTEGER.  */
+  ASSERT (TYPE_IS_INTEGER (bool));
+  ASSERT (TYPE_IS_INTEGER (char));
+  ASSERT (TYPE_IS_INTEGER (signed char));
+  ASSERT (TYPE_IS_INTEGER (unsigned char));
+  ASSERT (TYPE_IS_INTEGER (short int));
+  ASSERT (TYPE_IS_INTEGER (unsigned short int));
+  ASSERT (TYPE_IS_INTEGER (int));
+  ASSERT (TYPE_IS_INTEGER (unsigned int));
+  ASSERT (TYPE_IS_INTEGER (long int));
+  ASSERT (TYPE_IS_INTEGER (unsigned long int));
+  ASSERT (TYPE_IS_INTEGER (intmax_t));
+  ASSERT (TYPE_IS_INTEGER (uintmax_t));
+  ASSERT (! TYPE_IS_INTEGER (float));
+  ASSERT (! TYPE_IS_INTEGER (double));
+  ASSERT (! TYPE_IS_INTEGER (long double));
+
+  /* TYPE_SIGNED.  */
+  /* VERIFY (! TYPE_SIGNED (bool)); // not guaranteed by gnulib substitute */
+  VERIFY (TYPE_SIGNED (signed char));
+  VERIFY (! TYPE_SIGNED (unsigned char));
+  VERIFY (TYPE_SIGNED (short int));
+  VERIFY (! TYPE_SIGNED (unsigned short int));
+  VERIFY (TYPE_SIGNED (int));
+  VERIFY (! TYPE_SIGNED (unsigned int));
+  VERIFY (TYPE_SIGNED (long int));
+  VERIFY (! TYPE_SIGNED (unsigned long int));
+  VERIFY (TYPE_SIGNED (intmax_t));
+  VERIFY (! TYPE_SIGNED (uintmax_t));
+  ASSERT (TYPE_SIGNED (float));
+  ASSERT (TYPE_SIGNED (double));
+  ASSERT (TYPE_SIGNED (long double));
+
+  /* Integer representation.  Check that it is two's complement.  */
+  VERIFY (INT_MIN + INT_MAX < 0);
+
+  /* TYPE_MINIMUM, TYPE_MAXIMUM.  */
+  VERIFY (TYPE_MINIMUM (char) == CHAR_MIN);
+  VERIFY (TYPE_MAXIMUM (char) == CHAR_MAX);
+  VERIFY (TYPE_MINIMUM (unsigned char) == 0);
+  VERIFY (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX);
+  VERIFY (TYPE_MINIMUM (signed char) == SCHAR_MIN);
+  VERIFY (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
+  VERIFY (TYPE_MINIMUM (short int) == SHRT_MIN);
+  VERIFY (TYPE_MAXIMUM (short int) == SHRT_MAX);
+  VERIFY (TYPE_MINIMUM (unsigned short int) == 0);
+  VERIFY (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX);
+  VERIFY (TYPE_MINIMUM (int) == INT_MIN);
+  VERIFY (TYPE_MAXIMUM (int) == INT_MAX);
+  VERIFY (TYPE_MINIMUM (unsigned int) == 0);
+  VERIFY (TYPE_MAXIMUM (unsigned int) == UINT_MAX);
+  VERIFY (TYPE_MINIMUM (long int) == LONG_MIN);
+  VERIFY (TYPE_MAXIMUM (long int) == LONG_MAX);
+  VERIFY (TYPE_MINIMUM (unsigned long int) == 0);
+  VERIFY (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX);
+  #ifdef LLONG_MAX
+   verify_stmt (TYPE_MINIMUM (long long int) == LLONG_MIN);
+   verify_stmt (TYPE_MAXIMUM (long long int) == LLONG_MAX);
+   verify_stmt (TYPE_MINIMUM (unsigned long long int) == 0);
+   verify_stmt (TYPE_MAXIMUM (unsigned long long int) == ULLONG_MAX);
+  #endif
+  VERIFY (TYPE_MINIMUM (intmax_t) == INTMAX_MIN);
+  VERIFY (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX);
+  VERIFY (TYPE_MINIMUM (uintmax_t) == 0);
+  VERIFY (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX);
+
+  /* TYPE_WIDTH.  */
+  #ifdef CHAR_WIDTH
+   verify_stmt (TYPE_WIDTH (char) == CHAR_WIDTH);
+   verify_stmt (TYPE_WIDTH (signed char) == SCHAR_WIDTH);
+   verify_stmt (TYPE_WIDTH (unsigned char) == UCHAR_WIDTH);
+   verify_stmt (TYPE_WIDTH (short int) == SHRT_WIDTH);
+   verify_stmt (TYPE_WIDTH (unsigned short int) == USHRT_WIDTH);
+   verify_stmt (TYPE_WIDTH (int) == INT_WIDTH);
+   verify_stmt (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
+   verify_stmt (TYPE_WIDTH (long int) == LONG_WIDTH);
+   verify_stmt (TYPE_WIDTH (unsigned long int) == ULONG_WIDTH);
+   #ifdef LLONG_WIDTH
+    verify_stmt (TYPE_WIDTH (long long int) == LLONG_WIDTH);
+    verify_stmt (TYPE_WIDTH (unsigned long long int) == ULLONG_WIDTH);
+   #endif
+  #endif
+
+  /* INT_BITS_STRLEN_BOUND.  */
+  VERIFY (INT_BITS_STRLEN_BOUND (1) == 1);
+  VERIFY (INT_BITS_STRLEN_BOUND (2620) == 789);
+
+  /* INT_STRLEN_BOUND, INT_BUFSIZE_BOUND.  */
+  #ifdef INT32_MAX /* POSIX guarantees int32_t; this ports to non-POSIX.  */
+  VERIFY (INT_STRLEN_BOUND (int32_t) == sizeof ("-2147483648") - 1);
+  VERIFY (INT_BUFSIZE_BOUND (int32_t) == sizeof ("-2147483648"));
+  #endif
+  #ifdef INT64_MAX
+  VERIFY (INT_STRLEN_BOUND (int64_t) == sizeof ("-9223372036854775808") - 1);
+  VERIFY (INT_BUFSIZE_BOUND (int64_t) == sizeof ("-9223372036854775808"));
+  #endif
+#endif
+
+  /* All the INT_<op>_RANGE_OVERFLOW tests are equally valid as
+     INT_<op>_OVERFLOW tests, so define macros to do both.  OP is the
+     operation, OPNAME its symbolic name, A and B its operands, T the
+     result type, V the overflow flag, and VRES the result if V and if
+     two's complement.  CHECK_BINOP is for most binary operations,
+     CHECK_SBINOP for binary +, -, * when the result type is signed,
+     and CHECK_UNOP for unary operations.  */
+  #define CHECK_BINOP(op, opname, a, b, t, v, vres)                       \
+    VERIFY (INT_##opname##_RANGE_OVERFLOW (a, b, TYPE_MINIMUM (t),        \
+                                           TYPE_MAXIMUM (t))              \
+            == (v));                                                      \
+    VERIFY (INT_##opname##_OVERFLOW (a, b) == (v))
+  #define CHECK_SBINOP(op, opname, a, b, t, v, vres)                      \
+    CHECK_BINOP(op, opname, a, b, t, v, vres);                            \
+    {                                                                     \
+      t result;                                                           \
+      ASSERT (INT_##opname##_WRAPV (a, b, &result) == (v));               \
+      ASSERT (result == ((v) ? (vres) : ((a) op (b))));                   \
+    }
+  #define CHECK_UNOP(op, opname, a, t, v)                                 \
+    VERIFY (INT_##opname##_RANGE_OVERFLOW (a, TYPE_MINIMUM (t),           \
+                                           TYPE_MAXIMUM (t))              \
+            == (v));                                                      \
+    VERIFY (INT_##opname##_OVERFLOW (a) == (v))
+
+  /* INT_<op>_RANGE_OVERFLOW, INT_<op>_OVERFLOW.  */
+  VERIFY (INT_ADD_RANGE_OVERFLOW (INT_MAX, 1, INT_MIN, INT_MAX));
+  VERIFY (INT_ADD_OVERFLOW (INT_MAX, 1));
+
+  CHECK_SBINOP (+, ADD, INT_MAX, 1, int, true, INT_MIN);
+  CHECK_SBINOP (+, ADD, INT_MAX, -1, int, false, INT_MAX - 1);
+  CHECK_SBINOP (+, ADD, INT_MIN, 1, int, false, INT_MIN + 1);
+  CHECK_SBINOP (+, ADD, INT_MIN, -1, int, true, INT_MAX);
+  CHECK_BINOP (+, ADD, UINT_MAX, 1u, unsigned int, true, 0u);
+  CHECK_BINOP (+, ADD, 0u, 1u, unsigned int, false, 1u);
+
+  CHECK_SBINOP (-, SUBTRACT, INT_MAX, 1, int, false, INT_MAX - 1);
+  CHECK_SBINOP (-, SUBTRACT, INT_MAX, -1, int, true, INT_MIN);
+  CHECK_SBINOP (-, SUBTRACT, INT_MIN, 1, int, true, INT_MAX);
+  CHECK_SBINOP (-, SUBTRACT, INT_MIN, -1, int, false, INT_MIN - -1);
+  CHECK_BINOP (-, SUBTRACT, UINT_MAX, 1u, unsigned int, false, UINT_MAX - 1u);
+  CHECK_BINOP (-, SUBTRACT, 0u, 1u, unsigned int, true, 0u - 1u);
+
+  CHECK_UNOP (-, NEGATE, INT_MIN, int, true);
+  CHECK_UNOP (-, NEGATE, 0, int, false);
+  CHECK_UNOP (-, NEGATE, INT_MAX, int, false);
+  CHECK_UNOP (-, NEGATE, 0u, unsigned int, false);
+  CHECK_UNOP (-, NEGATE, 1u, unsigned int, true);
+  CHECK_UNOP (-, NEGATE, UINT_MAX, unsigned int, true);
+
+  CHECK_SBINOP (*, MULTIPLY, INT_MAX, INT_MAX, int, true, 1);
+  CHECK_SBINOP (*, MULTIPLY, INT_MAX, INT_MIN, int, true, INT_MIN);
+  CHECK_SBINOP (*, MULTIPLY, INT_MIN, INT_MAX, int, true, INT_MIN);
+  CHECK_SBINOP (*, MULTIPLY, INT_MIN, INT_MIN, int, true, 0);
+  CHECK_SBINOP (*, MULTIPLY, -1, INT_MIN, int,
+                INT_NEGATE_OVERFLOW (INT_MIN), INT_MIN);
+#if !defined __HP_cc
+  CHECK_SBINOP (*, MULTIPLY, LONG_MIN / INT_MAX, (long int) INT_MAX,
+                long int, false, LONG_MIN - LONG_MIN % INT_MAX);
+#endif
+
+  CHECK_BINOP (/, DIVIDE, INT_MIN, -1, int,
+               INT_NEGATE_OVERFLOW (INT_MIN), INT_MIN);
+  CHECK_BINOP (/, DIVIDE, INT_MAX, 1, int, false, INT_MAX);
+  CHECK_BINOP (/, DIVIDE, (unsigned int) INT_MIN, -1u, unsigned int,
+               false, INT_MIN / -1u);
+
+  CHECK_BINOP (%, REMAINDER, INT_MIN, -1, int, INT_NEGATE_OVERFLOW (INT_MIN), 0);
+  CHECK_BINOP (%, REMAINDER, INT_MAX, 1, int, false, 0);
+  CHECK_BINOP (%, REMAINDER, (unsigned int) INT_MIN, -1u, unsigned int,
+               false, INT_MIN % -1u);
+
+  CHECK_BINOP (<<, LEFT_SHIFT, UINT_MAX, 1, unsigned int, true, UINT_MAX << 1);
+  CHECK_BINOP (<<, LEFT_SHIFT, UINT_MAX / 2 + 1, 1, unsigned int, true,
+               (UINT_MAX / 2 + 1) << 1);
+  CHECK_BINOP (<<, LEFT_SHIFT, UINT_MAX / 2, 1, unsigned int, false,
+               (UINT_MAX / 2) << 1);
+
+  /* INT_<op>_OVERFLOW and INT_<op>_WRAPV with mixed types.  */
+  #define CHECK_SUM(a, b, t, v, vres)                                     \
+    CHECK_SUM1 (a, b, t, v, vres);                                        \
+    CHECK_SUM1 (b, a, t, v, vres)
+  #define CHECK_SUM_WRAPV(a, b, t, v, vres, okres)                        \
+    CHECK_SUM_WRAPV1 (a, b, t, v, vres, okres);                           \
+    CHECK_SUM_WRAPV1 (b, a, t, v, vres, okres)
+  #define CHECK_SUM1(a, b, t, v, vres)                                    \
+    VERIFY (INT_ADD_OVERFLOW (a, b) == (v));                              \
+    CHECK_SUM_WRAPV1 (a, b, t, v, vres, (a) + (b))
+  #define CHECK_SUM_WRAPV1(a, b, t, v, vres, okres)                       \
+    {                                                                     \
+      t result;                                                           \
+      ASSERT (INT_ADD_WRAPV (a, b, &result) == (v));                      \
+      ASSERT (result == ((v) ? (vres) : (okres)));                        \
+    }
+  CHECK_SUM (-1, LONG_MIN, long int, true, LONG_MAX);
+  CHECK_SUM (-1, UINT_MAX, unsigned int, false, DONTCARE);
+  CHECK_SUM (-1L, INT_MIN, long int, INT_MIN == LONG_MIN,
+              INT_MIN == LONG_MIN ? INT_MAX : DONTCARE);
+  CHECK_SUM (0u, -1, unsigned int, true, 0u + -1);
+  CHECK_SUM (0u, 0, unsigned int, false, DONTCARE);
+  CHECK_SUM (0u, 1, unsigned int, false, DONTCARE);
+  CHECK_SUM (1, LONG_MAX, long int, true, LONG_MIN);
+  CHECK_SUM (1, UINT_MAX, unsigned int, true, 0u);
+  CHECK_SUM (1L, INT_MAX, long int, INT_MAX == LONG_MAX,
+              INT_MAX == LONG_MAX ? INT_MIN : DONTCARE);
+  CHECK_SUM (1u, INT_MAX, unsigned int, INT_MAX == UINT_MAX, 1u + INT_MAX);
+  CHECK_SUM (1u, INT_MIN, unsigned int, true, 1u + INT_MIN);
+  CHECK_SUM_WRAPV (-1, 1u, int, false, DONTCARE, 0);
+  CHECK_SUM_WRAPV (-1, 1ul, int, false, DONTCARE, 0);
+  CHECK_SUM_WRAPV (-1l, 1u, int, false, DONTCARE, 0);
+  CHECK_SUM_WRAPV (-100, 1000u, int, false, DONTCARE, 900);
+  CHECK_SUM_WRAPV (INT_MIN, UINT_MAX, int, false, DONTCARE, INT_MAX);
+  CHECK_SUM_WRAPV (1u, INT_MAX, int, true, INT_MIN, DONTCARE);
+  CHECK_SUM_WRAPV (INT_MAX, 1, long int, LONG_MAX <= INT_MAX, INT_MIN,
+                   INT_MAX + 1L);
+  CHECK_SUM_WRAPV (UINT_MAX, 1, long int, LONG_MAX <= UINT_MAX, 0,
+                   UINT_MAX + 1L);
+  CHECK_SUM_WRAPV (INT_MAX, 1, unsigned long int, ULONG_MAX <= INT_MAX, 0,
+                   INT_MAX + 1uL);
+  CHECK_SUM_WRAPV (UINT_MAX, 1, unsigned long int, ULONG_MAX <= UINT_MAX, 0,
+                   UINT_MAX + 1uL);
+
+  {
+    long int result;
+    ASSERT (INT_ADD_WRAPV (1, INT_MAX, &result) == (INT_MAX == LONG_MAX));
+    ASSERT (INT_ADD_WRAPV (-1, INT_MIN, &result) == (INT_MIN == LONG_MIN));
+  }
+
+  #define CHECK_DIFFERENCE(a, b, t, v, vres)                              \
+    VERIFY (INT_SUBTRACT_OVERFLOW (a, b) == (v))
+  #define CHECK_SDIFFERENCE(a, b, t, v, vres)                             \
+    CHECK_DIFFERENCE (a, b, t, v, vres);                                  \
+    CHECK_SDIFFERENCE_WRAPV (a, b, t, v, vres)
+  #define CHECK_SDIFFERENCE_WRAPV(a, b, t, v, vres)                       \
+    {                                                                     \
+      t result;                                                           \
+      ASSERT (INT_SUBTRACT_WRAPV (a, b, &result) == (v));                 \
+      ASSERT (result == ((v) ? (vres) : ((a) - (b))));                    \
+    }
+  CHECK_DIFFERENCE (INT_MAX, 1u, unsigned int, UINT_MAX < INT_MAX - 1,
+                    INT_MAX - 1u);
+  CHECK_DIFFERENCE (UINT_MAX, 1, unsigned int, false, UINT_MAX - 1);
+  CHECK_DIFFERENCE (0u, -1, unsigned int, false, 0u - -1);
+  CHECK_DIFFERENCE (UINT_MAX, -1, unsigned int, true, UINT_MAX - -1);
+  CHECK_DIFFERENCE (INT_MIN, 1u, unsigned int, true, INT_MIN - 1u);
+  CHECK_DIFFERENCE (-1, 0u, unsigned int, true, -1 - 0u);
+  CHECK_SDIFFERENCE (-1, INT_MIN, int, false, -1 - INT_MIN);
+  CHECK_SDIFFERENCE (-1, INT_MAX, int, false, -1 - INT_MAX);
+  CHECK_SDIFFERENCE (0, INT_MIN, int, INT_MIN < -INT_MAX, INT_MIN);
+  CHECK_SDIFFERENCE (0, INT_MAX, int, false, 0 - INT_MAX);
+  CHECK_SDIFFERENCE_WRAPV (-1, 1u, int, false, DONTCARE);
+  CHECK_SDIFFERENCE_WRAPV (-1, 1ul, int, false, DONTCARE);
+  CHECK_SDIFFERENCE_WRAPV (-1l, 1u, int, false, DONTCARE);
+  CHECK_SDIFFERENCE_WRAPV (0u, INT_MAX, int, false, DONTCARE);
+  CHECK_SDIFFERENCE_WRAPV (1u, INT_MIN, int, true, 1u - INT_MIN);
+  {
+    long int result;
+    ASSERT (INT_SUBTRACT_WRAPV (INT_MAX, -1, &result) == (INT_MAX == LONG_MAX));
+    ASSERT (INT_SUBTRACT_WRAPV (INT_MIN, 1, &result) == (INT_MAX == LONG_MAX));
+  }
+
+  #define CHECK_PRODUCT(a, b, t, v, vres)                                 \
+    CHECK_PRODUCT1 (a, b, t, v, vres);                                    \
+    CHECK_PRODUCT1 (b, a, t, v, vres)
+  #define CHECK_SPRODUCT(a, b, t, v, vres)                                \
+    CHECK_SPRODUCT1 (a, b, t, v, vres);                                   \
+    CHECK_SPRODUCT1 (b, a, t, v, vres)
+  #define CHECK_SPRODUCT_WRAPV(a, b, t, v, vres)                          \
+    CHECK_SPRODUCT_WRAPV1 (a, b, t, v, vres);                             \
+    CHECK_SPRODUCT_WRAPV1 (b, a, t, v, vres)
+  #define CHECK_PRODUCT1(a, b, t, v, vres)                                \
+    VERIFY (INT_MULTIPLY_OVERFLOW (a, b) == (v))
+  #define CHECK_SPRODUCT1(a, b, t, v, vres)                               \
+    CHECK_PRODUCT1 (a, b, t, v, vres);                                    \
+    CHECK_SPRODUCT_WRAPV1 (a, b, t, v, vres)
+  #define CHECK_SPRODUCT_WRAPV1(a, b, t, v, vres)                         \
+    {                                                                     \
+      t result;                                                           \
+      ASSERT (INT_MULTIPLY_WRAPV (a, b, &result) == (v));                 \
+      ASSERT (result == ((v) ? (vres) : ((a) * (b))));                    \
+    }
+  CHECK_PRODUCT (-1, 1u, unsigned int, true, -1 * 1u);
+  CHECK_SPRODUCT (-1, INT_MIN, int, INT_NEGATE_OVERFLOW (INT_MIN), INT_MIN);
+  CHECK_PRODUCT (-1, UINT_MAX, unsigned int, true, -1 * UINT_MAX);
+  CHECK_SPRODUCT (-32768, LONG_MAX / -32768 - 1, long int, true, LONG_MIN);
+  CHECK_SPRODUCT (-12345, LONG_MAX / -12345, long int, false, DONTCARE);
+  CHECK_SPRODUCT (0, -1, int, false, DONTCARE);
+  CHECK_SPRODUCT (0, 0, int, false, DONTCARE);
+  CHECK_PRODUCT (0, 0u, unsigned int, false, DONTCARE);
+  CHECK_SPRODUCT (0, 1, int, false, DONTCARE);
+  CHECK_SPRODUCT (0, INT_MAX, int, false, DONTCARE);
+  CHECK_SPRODUCT (0, INT_MIN, int, false, DONTCARE);
+  CHECK_PRODUCT (0, UINT_MAX, unsigned int, false, DONTCARE);
+  CHECK_PRODUCT (0u, -1, unsigned int, false, DONTCARE);
+  CHECK_PRODUCT (0u, 0, unsigned int, false, DONTCARE);
+  CHECK_PRODUCT (0u, 0u, unsigned int, false, DONTCARE);
+  CHECK_PRODUCT (0u, 1, unsigned int, false, DONTCARE);
+  CHECK_PRODUCT (0u, INT_MAX, unsigned int, false, DONTCARE);
+  CHECK_PRODUCT (0u, INT_MIN, unsigned int, false, DONTCARE);
+  CHECK_PRODUCT (0u, UINT_MAX, unsigned int, false, DONTCARE);
+  CHECK_SPRODUCT (1, INT_MAX, int, false, DONTCARE);
+  CHECK_SPRODUCT (1, INT_MIN, int, false, DONTCARE);
+  CHECK_PRODUCT (1, UINT_MAX, unsigned int, false, DONTCARE);
+  CHECK_PRODUCT (1u, INT_MIN, unsigned int, true, 1u * INT_MIN);
+  CHECK_PRODUCT (1u, INT_MAX, unsigned int, UINT_MAX < INT_MAX, 1u * INT_MAX);
+  CHECK_PRODUCT (INT_MAX, UINT_MAX, unsigned int, true, INT_MAX * UINT_MAX);
+  CHECK_PRODUCT (INT_MAX, ULONG_MAX, unsigned long int, true,
+                 INT_MAX * ULONG_MAX);
+#if !defined __HP_cc
+  CHECK_SPRODUCT (INT_MIN, LONG_MAX / INT_MIN - 1, long int, true, LONG_MIN);
+  CHECK_SPRODUCT (INT_MIN, LONG_MAX / INT_MIN, long int, false, DONTCARE);
+#endif
+  CHECK_PRODUCT (INT_MIN, UINT_MAX, unsigned int, true, INT_MIN * UINT_MAX);
+  CHECK_PRODUCT (INT_MIN, ULONG_MAX, unsigned long int, true,
+                 INT_MIN * ULONG_MAX);
+  CHECK_SPRODUCT_WRAPV (-1, INT_MAX + 1u, int, false, DONTCARE);
+  CHECK_SPRODUCT_WRAPV (-1, 1u, int, false, DONTCARE);
+  CHECK_SPRODUCT (0, ULONG_MAX, int, false, DONTCARE);
+  CHECK_SPRODUCT (0u, LONG_MIN, int, false, DONTCARE);
+  {
+    long int result;
+    ASSERT (INT_MULTIPLY_WRAPV (INT_MAX, INT_MAX, &result)
+            == (LONG_MAX / INT_MAX < INT_MAX));
+    ASSERT (INT_MULTIPLY_WRAPV (INT_MAX, INT_MAX, &result)
+            || result == INT_MAX * (long int) INT_MAX);
+    ASSERT (INT_MULTIPLY_WRAPV (INT_MIN, INT_MIN, &result)
+            || result == INT_MIN * (long int) INT_MIN);
+  }
+
+# ifdef LLONG_MAX
+  {
+    long long int result;
+    ASSERT (INT_MULTIPLY_WRAPV (LONG_MAX, LONG_MAX, &result)
+            == (LLONG_MAX / LONG_MAX < LONG_MAX));
+    ASSERT (INT_MULTIPLY_WRAPV (LONG_MAX, LONG_MAX, &result)
+            || result == LONG_MAX * (long long int) LONG_MAX);
+    ASSERT (INT_MULTIPLY_WRAPV (LONG_MIN, LONG_MIN, &result)
+            || result == LONG_MIN * (long long int) LONG_MIN);
+  }
+# endif
+
+  /* Check for GCC bug 91450.  */
+  {
+    unsigned long long result;
+    ASSERT (INT_MULTIPLY_WRAPV (int_minus_2, int_1, &result) && result == -2);
+  }
+
+  #define CHECK_QUOTIENT(a, b, v) VERIFY (INT_DIVIDE_OVERFLOW (a, b) == (v))
+
+  CHECK_QUOTIENT (INT_MIN, -1L, INT_MIN == LONG_MIN);
+  CHECK_QUOTIENT (INT_MIN, UINT_MAX, false);
+  CHECK_QUOTIENT (INTMAX_MIN, UINTMAX_MAX, false);
+  CHECK_QUOTIENT (INTMAX_MIN, UINT_MAX, false);
+  CHECK_QUOTIENT (-11, 10u, true);
+  CHECK_QUOTIENT (-10, 10u, true);
+  CHECK_QUOTIENT (-9, 10u, false);
+  CHECK_QUOTIENT (11u, -10, true);
+  CHECK_QUOTIENT (10u, -10, true);
+  CHECK_QUOTIENT (9u, -10, false);
+
+  #define CHECK_REMAINDER(a, b, v) VERIFY (INT_REMAINDER_OVERFLOW (a, b) == (v))
+
+  CHECK_REMAINDER (INT_MIN, -1L, INT_MIN == LONG_MIN);
+  CHECK_REMAINDER (-1, UINT_MAX, true);
+  CHECK_REMAINDER ((intmax_t) -1, UINTMAX_MAX, true);
+  CHECK_REMAINDER (INTMAX_MIN, UINT_MAX,
+                   (INTMAX_MAX < UINT_MAX
+                    && - (unsigned int) INTMAX_MIN % UINT_MAX != 0));
+  CHECK_REMAINDER (INT_MIN, ULONG_MAX, INT_MIN % ULONG_MAX != 1);
+  CHECK_REMAINDER (1u, -1, false);
+  CHECK_REMAINDER (37*39u, -39, false);
+  CHECK_REMAINDER (37*39u + 1, -39, true);
+  CHECK_REMAINDER (37*39u - 1, -39, true);
+  CHECK_REMAINDER (LONG_MAX, -INT_MAX, false);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index e0e9dbba84f83b265386c591e3867002ecda5264..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-inttostr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..be7b5d4521e22df792e7846dd76db9fc42a60663
--- /dev/null
@@ -0,0 +1,94 @@
+/* Test inttostr functions, and incidentally, INT_BUFSIZE_BOUND
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "inttostr.h"
+#include "intprops.h"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define STREQ(a, b) (strcmp (a, b) == 0)
+#define IS_TIGHT(T) (_GL_SIGNED_TYPE_OR_EXPR (T) == TYPE_SIGNED (T))
+#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
+
+/* Verify that an inttostr function works as advertised.
+   Convert maximum and minimum (per-type, T) values using both snprintf --
+   with a cast to intmax_t or uintmax_t -- and FN, and compare the
+   resulting strings.  Use malloc for the inttostr buffer, so that if
+   we ever exceed the usually-tight INT_BUFSIZE_BOUND, tools like
+   valgrind will detect the failure. */
+#define CK(T, Fn)                                                       \
+  do                                                                    \
+    {                                                                   \
+      char ref[100];                                                    \
+      char *buf = malloc (INT_BUFSIZE_BOUND (T));                       \
+      char const *p;                                                    \
+      ASSERT (buf);                                                     \
+      *buf = '\0';                                                      \
+      ASSERT                                                            \
+        ((TYPE_SIGNED (T)                                               \
+          ? snprintf (ref, sizeof ref, "%jd", (intmax_t) TYPE_MINIMUM (T)) \
+          : snprintf (ref, sizeof ref, "%ju", (uintmax_t) TYPE_MINIMUM (T))) \
+         < sizeof ref);                                                 \
+      ASSERT (STREQ ((p = Fn (TYPE_MINIMUM (T), buf)), ref));           \
+      /* Ensure that INT_BUFSIZE_BOUND is tight for signed types.  */   \
+      ASSERT (! TYPE_SIGNED (T) || (p == buf && *p == '-'));            \
+      ASSERT                                                            \
+        ((TYPE_SIGNED (T)                                               \
+          ? snprintf (ref, sizeof ref, "%jd", (intmax_t) TYPE_MAXIMUM (T)) \
+          : snprintf (ref, sizeof ref, "%ju", (uintmax_t) TYPE_MAXIMUM (T))) \
+         < sizeof ref);                                                 \
+      ASSERT (STREQ ((p = Fn (TYPE_MAXIMUM (T), buf)), ref));           \
+      /* For unsigned types, the bound is not always tight.  */         \
+      ASSERT (! IS_TIGHT (T) || TYPE_SIGNED (T)                         \
+              || (p == buf && ISDIGIT (*p)));                           \
+      free (buf);                                                       \
+    }                                                                   \
+  while (0)
+
+int
+main (void)
+{
+  size_t b_size = 2;
+  char *b = malloc (b_size);
+  ASSERT (b);
+
+  /* Ideally we would rely on the snprintf-posix module, in which case
+     this guard would not be required, but due to limitations in gnulib's
+     implementation (see modules/snprintf-posix), we cannot.  */
+  if (snprintf (b, b_size, "%ju", (uintmax_t) 3) == 1
+      && b[0] == '3' && b[1] == '\0')
+    {
+      CK (int,          inttostr);
+      CK (unsigned int, uinttostr);
+      CK (off_t,        offtostr);
+      CK (uintmax_t,    umaxtostr);
+      CK (intmax_t,     imaxtostr);
+      free (b);
+      return 0;
+    }
+
+  /* snprintf doesn't accept %ju; skip this test.  */
+  free (b);
+  return 77;
+}
deleted file mode 120000 (symlink)
index 6036eabfd81706a08758b5f53ca64221cc6346c3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-inttypes.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..036ca510cfecebb66c3459eb818a079933ccaae5
--- /dev/null
@@ -0,0 +1,116 @@
+/* Test of <inttypes.h> substitute.
+   Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <inttypes.h>
+
+/* Tests for macros supposed to be defined in inttypes.h.  */
+
+const char *k = /* implicit string concatenation */
+#ifdef INT8_MAX
+  PRId8 PRIi8
+#endif
+#ifdef UINT8_MAX
+  PRIo8 PRIu8 PRIx8 PRIX8
+#endif
+#ifdef INT16_MAX
+  PRId16 PRIi16
+#endif
+#ifdef UINT16_MAX
+  PRIo16 PRIu16 PRIx16 PRIX16
+#endif
+#ifdef INT32_MAX
+  PRId32 PRIi32
+#endif
+#ifdef UINT32_MAX
+  PRIo32 PRIu32 PRIx32 PRIX32
+#endif
+#ifdef INT64_MAX
+  PRId64 PRIi64
+#endif
+#ifdef UINT64_MAX
+  PRIo64 PRIu64 PRIx64 PRIX64
+#endif
+  PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8
+  PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16
+  PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32
+  PRIdLEAST64 PRIiLEAST64
+  PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64
+  PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8
+  PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16
+  PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32
+  PRIdFAST64 PRIiFAST64
+  PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64
+  PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX
+#ifdef INTPTR_MAX
+  PRIdPTR PRIiPTR
+#endif
+#ifdef UINTPTR_MAX
+  PRIoPTR PRIuPTR PRIxPTR PRIXPTR
+#endif
+  ;
+const char *l = /* implicit string concatenation */
+#ifdef INT8_MAX
+  SCNd8 SCNi8
+#endif
+#ifdef UINT8_MAX
+  SCNo8 SCNu8 SCNx8
+#endif
+#ifdef INT16_MAX
+  SCNd16 SCNi16
+#endif
+#ifdef UINT16_MAX
+  SCNo16 SCNu16 SCNx16
+#endif
+#ifdef INT32_MAX
+  SCNd32 SCNi32
+#endif
+#ifdef UINT32_MAX
+  SCNo32 SCNu32 SCNx32
+#endif
+#ifdef INT64_MAX
+  SCNd64 SCNi64
+#endif
+#ifdef UINT64_MAX
+  SCNo64 SCNu64 SCNx64
+#endif
+  SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8
+  SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16
+  SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32
+  SCNdLEAST64 SCNiLEAST64
+  SCNoLEAST64 SCNuLEAST64 SCNxLEAST64
+  SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8
+  SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16
+  SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32
+  SCNdFAST64 SCNiFAST64
+  SCNoFAST64 SCNuFAST64 SCNxFAST64
+  SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX
+#ifdef INTPTR_MAX
+  SCNdPTR SCNiPTR
+#endif
+#ifdef UINTPTR_MAX
+  SCNoPTR SCNuPTR SCNxPTR
+#endif
+  ;
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8568931a05fa3dd20b3f6bb0a302be96fe51d64b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-ioctl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1fef85b4681c83cbdc47e9e47d542d3cd5deec71
--- /dev/null
@@ -0,0 +1,51 @@
+/* Test of ioctl() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/ioctl.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (ioctl, int, (int, int, ...));
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+#ifdef FIONREAD
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    int value;
+    errno = 0;
+    ASSERT (ioctl (-1, FIONREAD, &value) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    int value;
+    close (99);
+    errno = 0;
+    ASSERT (ioctl (99, FIONREAD, &value) == -1);
+    ASSERT (errno == EBADF);
+  }
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 57ec8148073a566bb07c45260a659a9830f56749..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-isatty.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..52e7a3dd9782097136112d104689f2289ceea564
--- /dev/null
@@ -0,0 +1,99 @@
+/* Test isatty() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (isatty, int, (int));
+
+#include <errno.h>
+#include <fcntl.h>
+
+#include "macros.h"
+
+/* The name of the "always silent" device.  */
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Native Windows API.  */
+# define DEV_NULL "NUL"
+#else
+/* Unix API.  */
+# define DEV_NULL "/dev/null"
+#endif
+
+int
+main (void)
+{
+  const char *file = "test-isatty.txt";
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (isatty (-1) == 0);
+    ASSERT (errno == EBADF
+            || errno == 0 /* seen on IRIX 6.5, Solaris 10 */
+           );
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (isatty (99) == 0);
+    ASSERT (errno == EBADF
+            || errno == 0 /* seen on IRIX 6.5, Solaris 10 */
+           );
+  }
+
+  /* Test behaviour for regular files.  */
+  {
+    int fd;
+
+    fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+    ASSERT (0 <= fd);
+    ASSERT (write (fd, "hello", 5) == 5);
+    ASSERT (close (fd) == 0);
+
+    fd = open (file, O_RDONLY);
+    ASSERT (0 <= fd);
+    ASSERT (! isatty (fd));
+    ASSERT (close (fd) == 0);
+  }
+
+  /* Test behaviour for pipes.  */
+  {
+    int fd[2];
+
+    ASSERT (pipe (fd) == 0);
+    ASSERT (! isatty (fd[0]));
+    ASSERT (! isatty (fd[1]));
+    ASSERT (close (fd[0]) == 0);
+    ASSERT (close (fd[1]) == 0);
+  }
+
+  /* Test behaviour for /dev/null.  */
+  {
+    int fd;
+
+    fd = open (DEV_NULL, O_RDONLY);
+    ASSERT (0 <= fd);
+    ASSERT (! isatty (fd));
+    ASSERT (close (fd) == 0);
+  }
+
+  ASSERT (unlink (file) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index a5f07b9ed1a13c71cc42b0444632944f0586e50e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-isblank.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8e13bae15858afb17dee1f55c1cfe54afcd35cc9
--- /dev/null
@@ -0,0 +1,50 @@
+/* Test of isblank() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <ctype.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (isblank, int, (int));
+
+#include <limits.h>
+#include <stdio.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  unsigned int c;
+
+  /* Verify the property in the "C" locale.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     that
+       - in all locales, the blank characters include the <space> and <tab>
+         characters,
+       - in the "POSIX" locale (which is usually the same as the "C" locale),
+         the blank characters include only the ASCII <space> and <tab>
+         characters.  */
+  for (c = 0; c <= UCHAR_MAX; c++)
+    ASSERT (!isblank (c) == !(c == ' ' || c == '\t'));
+  ASSERT (!isblank (EOF));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index af1fce8b9e063ba8a8d1dccf4b46251baa100867..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-isnand-nolibm.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7b251aa9f049d303d1f5073c33a5b120629dafe3
--- /dev/null
@@ -0,0 +1,21 @@
+/* Test of isnand() substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "isnand-nolibm.h"
+
+#include "test-isnand.h"
deleted file mode 120000 (symlink)
index 05895297dc256326736e6f04c49b8d1758b43aff..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-isnand.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5369e336407d02aad8dd1fe32c1356de8c36adee
--- /dev/null
@@ -0,0 +1,49 @@
+/* Test of isnand() substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <limits.h>
+
+#include "minus-zero.h"
+#include "infinity.h"
+#include "nan.h"
+#include "snan.h"
+#include "macros.h"
+
+int
+main ()
+{
+  /* Finite values.  */
+  ASSERT (!isnand (3.141));
+  ASSERT (!isnand (3.141e30));
+  ASSERT (!isnand (3.141e-30));
+  ASSERT (!isnand (-2.718));
+  ASSERT (!isnand (-2.718e30));
+  ASSERT (!isnand (-2.718e-30));
+  ASSERT (!isnand (0.0));
+  ASSERT (!isnand (minus_zerod));
+  /* Infinite values.  */
+  ASSERT (!isnand (Infinityd ()));
+  ASSERT (!isnand (- Infinityd ()));
+  /* Quiet NaN.  */
+  ASSERT (isnand (NaNd ()));
+#if HAVE_SNAND
+  /* Signalling NaN.  */
+  ASSERT (isnand (SNaNd ()));
+#endif
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5b9bd95e8ea2f50275ca2640ddc0c28be7ab1dd2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-isnanf-nolibm.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bd39f06fe7011762479387c6d3c2fbf153d8ff78
--- /dev/null
@@ -0,0 +1,21 @@
+/* Test of isnanf() substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "isnanf-nolibm.h"
+
+#include "test-isnanf.h"
deleted file mode 120000 (symlink)
index e5cbba94ec63537b4ba9c1c5ebe1638e2887248c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-isnanf.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6f138016c9f97d6408b461192457356760df22f1
--- /dev/null
@@ -0,0 +1,49 @@
+/* Test of isnanf() substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <limits.h>
+
+#include "minus-zero.h"
+#include "infinity.h"
+#include "nan.h"
+#include "snan.h"
+#include "macros.h"
+
+int
+main ()
+{
+  /* Finite values.  */
+  ASSERT (!isnanf (3.141f));
+  ASSERT (!isnanf (3.141e30f));
+  ASSERT (!isnanf (3.141e-30f));
+  ASSERT (!isnanf (-2.718f));
+  ASSERT (!isnanf (-2.718e30f));
+  ASSERT (!isnanf (-2.718e-30f));
+  ASSERT (!isnanf (0.0f));
+  ASSERT (!isnanf (minus_zerof));
+  /* Infinite values.  */
+  ASSERT (!isnanf (Infinityf ()));
+  ASSERT (!isnanf (- Infinityf ()));
+  /* Quiet NaN.  */
+  ASSERT (isnanf (NaNf ()));
+#if HAVE_SNANF
+  /* Signalling NaN.  */
+  ASSERT (isnanf (SNaNf ()));
+#endif
+  return 0;
+}
deleted file mode 120000 (symlink)
index 87ea1e914e5e72bddddd2345b0f90173c041620f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-isnanl-nolibm.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..caed43e01fe7cfbbae15b8fa6562ef4d093b4685
--- /dev/null
@@ -0,0 +1,23 @@
+/* Test of isnanl() substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "isnanl-nolibm.h"
+
+#include "test-isnanl.h"
deleted file mode 120000 (symlink)
index a618a93f232bf0eb438cfb91cb8b62bb529c5190..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-isnanl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ff42ee543654a206c3d78b87ea8d69d46aee5fb4
--- /dev/null
@@ -0,0 +1,104 @@
+/* Test of isnanl() substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <float.h>
+#include <limits.h>
+
+#include "minus-zero.h"
+#include "infinity.h"
+#include "nan.h"
+#include "snan.h"
+#include "macros.h"
+
+int
+main ()
+{
+  /* Finite values.  */
+  ASSERT (!isnanl (3.141L));
+  ASSERT (!isnanl (3.141e30L));
+  ASSERT (!isnanl (3.141e-30L));
+  ASSERT (!isnanl (-2.718L));
+  ASSERT (!isnanl (-2.718e30L));
+  ASSERT (!isnanl (-2.718e-30L));
+  ASSERT (!isnanl (0.0L));
+  ASSERT (!isnanl (minus_zerol));
+  /* Infinite values.  */
+  ASSERT (!isnanl (Infinityl ()));
+  ASSERT (!isnanl (- Infinityl ()));
+  /* Quiet NaN.  */
+  ASSERT (isnanl (NaNl ()));
+#if HAVE_SNANL
+  /* Signalling NaN.  */
+  ASSERT (isnanl (SNaNl ()));
+#endif
+
+#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+/* Representation of an 80-bit 'long double' as an initializer for a sequence
+   of 'unsigned int' words.  */
+# ifdef WORDS_BIGENDIAN
+#  define LDBL80_WORDS(exponent,manthi,mantlo) \
+     { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
+       ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16),   \
+       (unsigned int) (mantlo) << 16                                        \
+     }
+# else
+#  define LDBL80_WORDS(exponent,manthi,mantlo) \
+     { mantlo, manthi, exponent }
+# endif
+  { /* Quiet NaN.  */
+    static memory_long_double x =
+      { .word = LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
+    ASSERT (isnanl (x.value));
+  }
+  {
+    /* Signalling NaN.  */
+    static memory_long_double x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
+    ASSERT (isnanl (x.value));
+  }
+  /* isnanl should return something for noncanonical values.  */
+  { /* Pseudo-NaN.  */
+    static memory_long_double x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
+    ASSERT (isnanl (x.value) || !isnanl (x.value));
+  }
+  { /* Pseudo-Infinity.  */
+    static memory_long_double x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
+    ASSERT (isnanl (x.value) || !isnanl (x.value));
+  }
+  { /* Pseudo-Zero.  */
+    static memory_long_double x =
+      { .word = LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
+    ASSERT (isnanl (x.value) || !isnanl (x.value));
+  }
+  { /* Unnormalized number.  */
+    static memory_long_double x =
+      { .word = LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
+    ASSERT (isnanl (x.value) || !isnanl (x.value));
+  }
+  { /* Pseudo-Denormal.  */
+    static memory_long_double x =
+      { .word = LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
+    ASSERT (isnanl (x.value) || !isnanl (x.value));
+  }
+  #undef NWORDS
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index ef85e670b8b3f41428e712bbbb8c5fdad7c9fe1d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iswblank.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e59251791fd74b20abf5348d8abfb55f5058624c
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of iswblank() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <wctype.h>
+
+#include "macros.h"
+
+/* Check that WEOF is defined.  */
+wint_t e = WEOF;
+
+int
+main (void)
+{
+  /* Check that the function exist as a function or as a macro.  */
+  (void) iswblank (0);
+  /* Check that the isw* functions map WEOF to 0.  */
+  ASSERT (!iswblank (e));
+
+  /* Sanity check for the iswblank function.  */
+  ASSERT (iswblank (L' '));
+  ASSERT (iswblank (L'\t'));
+  ASSERT (!iswblank (L'\n'));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 506a1d245270b8ec52e4171179768bf9a18c68d3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iswctype.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e882bdbc4dd50631ae4f4c538148c11f3adaaac7
--- /dev/null
@@ -0,0 +1,198 @@
+/* Test of wide character properties.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <wctype.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (iswctype, int, (wint_t, wctype_t));
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  wctype_t desc;
+
+  desc = wctype ("any");
+  ASSERT (desc == (wctype_t) 0);
+
+  desc = wctype ("blank");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L' ', desc));
+  ASSERT (iswctype (L'\t', desc));
+  ASSERT (! iswctype (L'\n', desc));
+  ASSERT (! iswctype (L'a', desc));
+  ASSERT (! iswctype (L'_', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("space");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L' ', desc));
+  ASSERT (iswctype (L'\t', desc));
+  ASSERT (iswctype (L'\n', desc));
+  ASSERT (! iswctype (L'a', desc));
+  ASSERT (! iswctype (L'_', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("punct");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'!', desc));
+  ASSERT (iswctype (L'"', desc));
+  ASSERT (iswctype (L'#', desc));
+  ASSERT (iswctype (L'$', desc));
+  ASSERT (iswctype (L'%', desc));
+  ASSERT (iswctype (L'&', desc));
+  ASSERT (iswctype (L'\'', desc));
+  ASSERT (iswctype (L'(', desc));
+  ASSERT (iswctype (L')', desc));
+  ASSERT (iswctype (L'*', desc));
+  ASSERT (iswctype (L'+', desc));
+  ASSERT (iswctype (L',', desc));
+  ASSERT (iswctype (L'-', desc));
+  ASSERT (iswctype (L'.', desc));
+  ASSERT (iswctype (L'/', desc));
+  ASSERT (iswctype (L':', desc));
+  ASSERT (iswctype (L';', desc));
+  ASSERT (iswctype (L'<', desc));
+  ASSERT (iswctype (L'=', desc));
+  ASSERT (iswctype (L'>', desc));
+  ASSERT (iswctype (L'?', desc));
+  ASSERT (iswctype (L'@', desc));
+  ASSERT (iswctype (L'[', desc));
+  ASSERT (iswctype (L'\\', desc));
+  ASSERT (iswctype (L']', desc));
+  ASSERT (iswctype (L'^', desc));
+  ASSERT (iswctype (L'_', desc));
+  ASSERT (iswctype (L'`', desc));
+  ASSERT (iswctype (L'{', desc));
+  ASSERT (iswctype (L'|', desc));
+  ASSERT (iswctype (L'}', desc));
+  ASSERT (iswctype (L'~', desc));
+  ASSERT (! iswctype (L' ', desc));
+  ASSERT (! iswctype (L'a', desc));
+  ASSERT (! iswctype (L'1', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("lower");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'a', desc));
+  ASSERT (iswctype (L'z', desc));
+  ASSERT (! iswctype (L'A', desc));
+  ASSERT (! iswctype (L'Z', desc));
+  ASSERT (! iswctype (L'1', desc));
+  ASSERT (! iswctype (L'_', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("upper");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'A', desc));
+  ASSERT (iswctype (L'Z', desc));
+  ASSERT (! iswctype (L'a', desc));
+  ASSERT (! iswctype (L'z', desc));
+  ASSERT (! iswctype (L'1', desc));
+  ASSERT (! iswctype (L'_', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("alpha");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'a', desc));
+  ASSERT (iswctype (L'z', desc));
+  ASSERT (iswctype (L'A', desc));
+  ASSERT (iswctype (L'Z', desc));
+  ASSERT (! iswctype (L'1', desc));
+  ASSERT (! iswctype (L'$', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("digit");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'0', desc));
+  ASSERT (iswctype (L'9', desc));
+  ASSERT (! iswctype (L'a', desc));
+  ASSERT (! iswctype (L'f', desc));
+  ASSERT (! iswctype (L'A', desc));
+  ASSERT (! iswctype (L'F', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("xdigit");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'0', desc));
+  ASSERT (iswctype (L'9', desc));
+  ASSERT (iswctype (L'a', desc));
+  ASSERT (iswctype (L'f', desc));
+  ASSERT (iswctype (L'A', desc));
+  ASSERT (iswctype (L'F', desc));
+  ASSERT (! iswctype (L'g', desc));
+  ASSERT (! iswctype (L'G', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("alnum");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'a', desc));
+  ASSERT (iswctype (L'z', desc));
+  ASSERT (iswctype (L'A', desc));
+  ASSERT (iswctype (L'Z', desc));
+  ASSERT (iswctype (L'0', desc));
+  ASSERT (iswctype (L'9', desc));
+  ASSERT (! iswctype (L' ', desc));
+  ASSERT (! iswctype (L'_', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("cntrl");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'\0', desc));
+  ASSERT (iswctype (L'\n', desc));
+  ASSERT (iswctype (L'\t', desc));
+  ASSERT (! iswctype (L' ', desc));
+  ASSERT (! iswctype (L'a', desc));
+  ASSERT (! iswctype (L'\\', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("graph");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'a', desc));
+  ASSERT (iswctype (L'z', desc));
+  ASSERT (iswctype (L'A', desc));
+  ASSERT (iswctype (L'Z', desc));
+  ASSERT (iswctype (L'0', desc));
+  ASSERT (iswctype (L'9', desc));
+  ASSERT (iswctype (L'$', desc));
+  ASSERT (! iswctype (L' ', desc));
+  ASSERT (! iswctype (L'\t', desc));
+  ASSERT (! iswctype (L'\n', desc));
+  ASSERT (! iswctype (L'\0', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  desc = wctype ("print");
+  ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'a', desc));
+  ASSERT (iswctype (L'z', desc));
+  ASSERT (iswctype (L'A', desc));
+  ASSERT (iswctype (L'Z', desc));
+  ASSERT (iswctype (L'0', desc));
+  ASSERT (iswctype (L'9', desc));
+  ASSERT (iswctype (L'$', desc));
+  ASSERT (iswctype (L' ', desc));
+  ASSERT (! iswctype (L'\t', desc));
+  ASSERT (! iswctype (L'\n', desc));
+  ASSERT (! iswctype (L'\0', desc));
+  ASSERT (! iswctype (WEOF, desc));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index faa51ed3cc76567640e96aa79afd106c38239d28..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iswdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a5bcc4ff1dd5c6c898f996ae1e531d5cc745aabb
--- /dev/null
@@ -0,0 +1,233 @@
+/* Test of iswdigit() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <wctype.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (iswdigit, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of iswdigit for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  wchar_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (wchar_t) 0xBADFACE;
+  ret = mbrtowc (&wc, s, n, &state);
+  if (ret == n)
+    return iswdigit (wc);
+  else
+    return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = iswdigit (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     ISO C 99 sections 7.25.2.1.5 and 5.2.1 specify that the decimal digits
+     include only the ASCII 0 ... 9 characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\262", 1);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\263", 1);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\271", 1);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\302\262", 2);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\302\263", 2);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\302\271", 2);
+          ASSERT (is == 0);
+          /* U+0663 ARABIC-INDIC DIGIT THREE */
+          is = for_character ("\331\243", 2);
+          ASSERT (is == 0);
+          /* U+2070 SUPERSCRIPT ZERO */
+          is = for_character ("\342\201\260", 3);
+          ASSERT (is == 0);
+          /* U+2079 SUPERSCRIPT NINE */
+          is = for_character ("\342\201\271", 3);
+          ASSERT (is == 0);
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\357\274\221", 3);
+          ASSERT (is == 0);
+          /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */
+          is = for_character ("\360\235\237\221", 4);
+          ASSERT (is == 0);
+          /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */
+          is = for_character ("\360\235\237\233", 4);
+          ASSERT (is == 0);
+          /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */
+          is = for_character ("\360\235\237\245", 4);
+          ASSERT (is == 0);
+          /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */
+          is = for_character ("\360\235\237\257", 4);
+          ASSERT (is == 0);
+          /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */
+          is = for_character ("\360\235\237\271", 4);
+          ASSERT (is == 0);
+          /* U+E0033 TAG DIGIT THREE */
+          is = for_character ("\363\240\200\263", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\201\060\205\065", 4);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\201\060\205\066", 4);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\201\060\206\061", 4);
+          ASSERT (is == 0);
+          /* U+0663 ARABIC-INDIC DIGIT THREE */
+          is = for_character ("\201\061\211\071", 4);
+          ASSERT (is == 0);
+          /* U+2070 SUPERSCRIPT ZERO */
+          is = for_character ("\201\066\255\062", 4);
+          ASSERT (is == 0);
+          /* U+2079 SUPERSCRIPT NINE */
+          is = for_character ("\201\066\256\061", 4);
+          ASSERT (is == 0);
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+          /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */
+          is = for_character ("\224\063\353\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */
+          is = for_character ("\224\063\354\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */
+          is = for_character ("\224\063\355\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */
+          is = for_character ("\224\063\356\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */
+          is = for_character ("\224\063\357\071", 4);
+          ASSERT (is == 0);
+          /* U+E0033 TAG DIGIT THREE */
+          is = for_character ("\323\066\232\071", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 9c9556a0c86f31ece7424f6918ffee0ec9b11c9c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iswdigit.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..142a224f084ee1a608a9ea1350d7aa14dba8aea2
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-iswdigit${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-iswdigit${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-iswdigit${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-iswdigit${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-iswdigit${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-iswdigit${EXEEXT} 4 \
+  || exit 1
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 8bb7b371df57ef726e84a4f7fa074454cd6f7308..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iswpunct.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c0bbd168e7a11a0aa90921f756a2df5ca39df5ef
--- /dev/null
@@ -0,0 +1,153 @@
+/* Test of iswpunct() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <wctype.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (iswpunct, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of iswpunct for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  wchar_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (wchar_t) 0xBADFACE;
+  ret = mbrtowc (&wc, s, n, &state);
+  if (ret == n)
+    return iswpunct (wc);
+  else
+    return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = iswpunct (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     no explicit list of punctuation or symbol characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case ' ':
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+            case 'A': case 'B': case 'C': case 'D': case 'E':
+            case 'F': case 'G': case 'H': case 'I': case 'J':
+            case 'K': case 'L': case 'M': case 'N': case 'O':
+            case 'P': case 'Q': case 'R': case 'S': case 'T':
+            case 'U': case 'V': case 'W': case 'X': case 'Y':
+            case 'Z':
+            case 'a': case 'b': case 'c': case 'd': case 'e':
+            case 'f': case 'g': case 'h': case 'i': case 'j':
+            case 'k': case 'l': case 'm': case 'n': case 'o':
+            case 'p': case 'q': case 'r': case 's': case 't':
+            case 'u': case 'v': case 'w': case 'x': case 'y':
+            case 'z':
+              /* c is an alphanumeric or space character.  */
+              ASSERT (is == 0);
+              break;
+            case '!': case '"': case '#': case '%':
+            case '&': case '\'': case '(': case ')': case '*':
+            case '+': case ',': case '-': case '.': case '/':
+            case ':': case ';': case '<': case '=': case '>':
+            case '?':
+            case '[': case '\\': case ']': case '^': case '_':
+            case '{': case '|': case '}': case '~':
+              /* These characters are usually expected to be punctuation or
+                 symbol characters.  */
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        /* These characters are not in the ISO C "basic character set", but
+           are nevertheless usually expected to be punctuation or symbol
+           characters.  */
+        is = for_character ("$", 1);
+        ASSERT (is != 0);
+        is = for_character ("@", 1);
+        ASSERT (is != 0);
+        is = for_character ("`", 1);
+        ASSERT (is != 0);
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 325991adda7d0480e79f2f2263ea68d8981f1732..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iswpunct.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..366e18592a84526156cce4b9e2c2a07c46d417bd
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-iswpunct${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-iswpunct${EXEEXT} 0 || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index cd4c0ae045ef1689ca43e9912d52764e80fd38a8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iswxdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f4aeb493acd8b0d5b9e56f1b1d9387bfca8b2ec1
--- /dev/null
@@ -0,0 +1,259 @@
+/* Test of iswxdigit() function.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <wctype.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (iswxdigit, int, (wint_t));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+/* Returns the value of iswxdigit for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  wchar_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (wchar_t) 0xBADFACE;
+  ret = mbrtowc (&wc, s, n, &state);
+  if (ret == n)
+    return iswxdigit (wc);
+  else
+    return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  char buf[4];
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test WEOF.  */
+  is = iswxdigit (WEOF);
+  ASSERT (is == 0);
+
+  /* Test single-byte characters.
+     ISO C 99 sections 7.25.2.1.12 and 6.4.4.1 specify that the hexadecimal
+     digits include only the ASCII 0 ... 9 A ... F a ... f characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = (unsigned char) c;
+          is = for_character (buf, 1);
+          switch (c)
+            {
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+            case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+            case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '0':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '1':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\262", 1);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\263", 1);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\271", 1);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is EUC-JP.  */
+        {
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+          /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
+          is = for_character ("\243\301", 2);
+          ASSERT (is == 0);
+          /* U+FF41 FULLWIDTH LATIN SMALL LETTER A */
+          is = for_character ("\243\341", 2);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\302\262", 2);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\302\263", 2);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\302\271", 2);
+          ASSERT (is == 0);
+          /* U+0663 ARABIC-INDIC DIGIT THREE */
+          is = for_character ("\331\243", 2);
+          ASSERT (is == 0);
+          /* U+2070 SUPERSCRIPT ZERO */
+          is = for_character ("\342\201\260", 3);
+          ASSERT (is == 0);
+          /* U+2079 SUPERSCRIPT NINE */
+          is = for_character ("\342\201\271", 3);
+          ASSERT (is == 0);
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\357\274\221", 3);
+          ASSERT (is == 0);
+          /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
+          is = for_character ("\357\274\241", 3);
+          ASSERT (is == 0);
+          /* U+FF41 FULLWIDTH LATIN SMALL LETTER A */
+          is = for_character ("\357\275\201", 3);
+          ASSERT (is == 0);
+          /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */
+          is = for_character ("\360\235\237\221", 4);
+          ASSERT (is == 0);
+          /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */
+          is = for_character ("\360\235\237\233", 4);
+          ASSERT (is == 0);
+          /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */
+          is = for_character ("\360\235\237\245", 4);
+          ASSERT (is == 0);
+          /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */
+          is = for_character ("\360\235\237\257", 4);
+          ASSERT (is == 0);
+          /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */
+          is = for_character ("\360\235\237\271", 4);
+          ASSERT (is == 0);
+          /* U+E0033 TAG DIGIT THREE */
+          is = for_character ("\363\240\200\263", 4);
+          ASSERT (is == 0);
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          is = for_character ("\363\240\201\201", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is GB18030.  */
+        {
+          /* U+00B2 SUPERSCRIPT TWO */
+          is = for_character ("\201\060\205\065", 4);
+          ASSERT (is == 0);
+          /* U+00B3 SUPERSCRIPT THREE */
+          is = for_character ("\201\060\205\066", 4);
+          ASSERT (is == 0);
+          /* U+00B9 SUPERSCRIPT ONE */
+          is = for_character ("\201\060\206\061", 4);
+          ASSERT (is == 0);
+          /* U+0663 ARABIC-INDIC DIGIT THREE */
+          is = for_character ("\201\061\211\071", 4);
+          ASSERT (is == 0);
+          /* U+2070 SUPERSCRIPT ZERO */
+          is = for_character ("\201\066\255\062", 4);
+          ASSERT (is == 0);
+          /* U+2079 SUPERSCRIPT NINE */
+          is = for_character ("\201\066\256\061", 4);
+          ASSERT (is == 0);
+          /* U+FF11 FULLWIDTH DIGIT ONE */
+          is = for_character ("\243\261", 2);
+          ASSERT (is == 0);
+          /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
+          is = for_character ("\243\301", 2);
+          ASSERT (is == 0);
+          /* U+FF41 FULLWIDTH LATIN SMALL LETTER A */
+          is = for_character ("\243\341", 2);
+          ASSERT (is == 0);
+          /* U+1D7D1 MATHEMATICAL BOLD DIGIT THREE */
+          is = for_character ("\224\063\353\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7DB MATHEMATICAL DOUBLE-STRUCK DIGIT THREE */
+          is = for_character ("\224\063\354\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7E5 MATHEMATICAL SANS-SERIF DIGIT THREE */
+          is = for_character ("\224\063\355\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7EF MATHEMATICAL SANS-SERIF BOLD DIGIT THREE */
+          is = for_character ("\224\063\356\071", 4);
+          ASSERT (is == 0);
+          /* U+1D7F9 MATHEMATICAL MONOSPACE DIGIT THREE */
+          is = for_character ("\224\063\357\071", 4);
+          ASSERT (is == 0);
+          /* U+E0033 TAG DIGIT THREE */
+          is = for_character ("\323\066\232\071", 4);
+          ASSERT (is == 0);
+          /* U+E0041 TAG LATIN CAPITAL LETTER A */
+          is = for_character ("\323\066\234\063", 4);
+          ASSERT (is == 0);
+        }
+        return 0;
+
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index e9484e25aa35d35ba2082898625dab7ed9d31a12..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-iswxdigit.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..9bdaff4ad12558381316f60a36b6f799b56adb17
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-iswxdigit${EXEEXT} 0 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-iswxdigit${EXEEXT} 0 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-iswxdigit${EXEEXT} 1 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-iswxdigit${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-iswxdigit${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-iswxdigit${EXEEXT} 4 \
+  || exit 1
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 910ac30fa4fb9118c4587b46a210eea2af5d82ef..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-langinfo.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9561793bb93bc9e2db15e1cd9f8b295201996b00
--- /dev/null
@@ -0,0 +1,92 @@
+/* Test of <langinfo.h> substitute.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <langinfo.h>
+
+/* Check that all the nl_item values are defined.  */
+int items[] =
+  {
+    /* nl_langinfo items of the LC_CTYPE category */
+    CODESET,
+    /* nl_langinfo items of the LC_NUMERIC category */
+    RADIXCHAR,
+    THOUSEP,
+    /* nl_langinfo items of the LC_TIME category */
+    D_T_FMT,
+    D_FMT,
+    T_FMT,
+    T_FMT_AMPM,
+    AM_STR,
+    PM_STR,
+    DAY_1,
+    DAY_2,
+    DAY_3,
+    DAY_4,
+    DAY_5,
+    DAY_6,
+    DAY_7,
+    ABDAY_1,
+    ABDAY_2,
+    ABDAY_3,
+    ABDAY_4,
+    ABDAY_5,
+    ABDAY_6,
+    ABDAY_7,
+    MON_1,
+    MON_2,
+    MON_3,
+    MON_4,
+    MON_5,
+    MON_6,
+    MON_7,
+    MON_8,
+    MON_9,
+    MON_10,
+    MON_11,
+    MON_12,
+    ABMON_1,
+    ABMON_2,
+    ABMON_3,
+    ABMON_4,
+    ABMON_5,
+    ABMON_6,
+    ABMON_7,
+    ABMON_8,
+    ABMON_9,
+    ABMON_10,
+    ABMON_11,
+    ABMON_12,
+    ERA,
+    ERA_D_FMT,
+    ERA_D_T_FMT,
+    ERA_T_FMT,
+    ALT_DIGITS,
+    /* nl_langinfo items of the LC_MONETARY category */
+    CRNCYSTR,
+    /* nl_langinfo items of the LC_MESSAGES category */
+    YESEXPR,
+    NOEXPR
+  };
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5b283f3e4ed7209129002fc5e4fc2ae3e62782f5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-largefile.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d2d6a1577b0c569e1a37e7e2b6c39c79b714953c
--- /dev/null
@@ -0,0 +1,51 @@
+/* Test of largefile module.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+/* This test may fail if AC_SYS_LARGEFILE could not arrange for a 64-bit off_t.
+   This should be rare, though: only very old systems don't have support for
+   files larger than 2 GiB.  */
+
+#include <config.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "intprops.h"
+
+/* Although these tests could be done with static_assert, the test
+   harness prefers dynamic checking.  */
+
+int
+main (void)
+{
+  int result = 0;
+
+  /* Check the range of off_t.
+     With MSVC, this test succeeds only thanks to the 'sys_types' module.  */
+  if (TYPE_MAXIMUM (off_t) >> 31 >> 31 == 0)
+    result |= 1;
+
+  /* Check the size of the 'struct stat' field 'st_size'.
+     With MSVC, this test succeeds only thanks to the 'sys_stat' module.  */
+  {
+    struct stat st;
+    if (sizeof st.st_size != sizeof (off_t))
+      result |= 2;
+  }
+
+  return result;
+}
deleted file mode 120000 (symlink)
index a6b3153fd2409ce097bfe8f02843a11cfe36cc03..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-lchmod.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..396755cae6f34e655a52c07089243cfc0225ad31
--- /dev/null
@@ -0,0 +1,87 @@
+/* Test changing the protections of a file.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (lchmod, int, (const char *, mode_t));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-lchmod."
+
+int
+main (void)
+{
+  /* Test that lchmod works on regular files.  */
+  {
+    struct stat statbuf;
+    unlink (BASE "file");
+    ASSERT (close (creat (BASE "file", 0600)) == 0);
+    ASSERT (lchmod (BASE "file", 0400) == 0);
+    ASSERT (stat (BASE "file", &statbuf) >= 0);
+    ASSERT ((statbuf.st_mode & 0700) == 0400);
+
+    errno = 0;
+    ASSERT (lchmod (BASE "file/", 0600) == -1);
+    ASSERT (errno == ENOTDIR);
+
+    /* Clean up.  */
+    ASSERT (chmod (BASE "file", 0600) == 0);
+    ASSERT (unlink (BASE "file") == 0);
+  }
+
+  /* Test that lchmod works on directories.  */
+  {
+    struct stat statbuf;
+
+    rmdir (BASE "dir");
+    ASSERT (mkdir (BASE "dir", 0700) == 0);
+    ASSERT (lchmod (BASE "dir", 0500) == 0);
+    ASSERT (stat (BASE "dir", &statbuf) >= 0);
+    ASSERT ((statbuf.st_mode & 0700) == 0500);
+    ASSERT (lchmod (BASE "dir/", 0700) == 0);
+
+    /* Clean up.  */
+    ASSERT (rmdir (BASE "dir") == 0);
+  }
+
+  /* Test that lchmod on symlinks does not modify the symlink target.  */
+  {
+    unlink (BASE "file");
+    unlink (BASE "link");
+    if (symlink (BASE "file", BASE "link") == 0)
+      {
+        struct stat statbuf;
+        ASSERT (close (creat (BASE "file", 0600)) == 0);
+        lchmod (BASE "link", 0400);
+        ASSERT (stat (BASE "file", &statbuf) >= 0);
+        ASSERT ((statbuf.st_mode & 0700) == 0600);
+      }
+    /* Clean up.  */
+    unlink (BASE "file");
+    unlink (BASE "link");
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b7a60e6f26067af9f3b34db65faad6af4d4a083b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-lchown.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bf205c114bdd789304c426b9e499c3a75a20fd7a
--- /dev/null
@@ -0,0 +1,48 @@
+/* Tests of lchown.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (lchown, int, (char const *, uid_t, gid_t));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#include "mgetgroups.h"
+#include "stat-time.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-lchown.t"
+
+#include "test-lchown.h"
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_lchown (lchown, true);
+}
deleted file mode 120000 (symlink)
index a3a4b677a5eb0ff863d2c66b26cf652e4d0f8e91..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-lchown.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5249d6cd7bcc534a91edfa1984d2769b07643bac
--- /dev/null
@@ -0,0 +1,270 @@
+/* Tests of lchown.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include "nap.h"
+
+#if !HAVE_GETGID
+# define getgid() ((gid_t) -1)
+#endif
+
+#if !HAVE_GETEGID
+# define getegid() ((gid_t) -1)
+#endif
+
+#ifndef HAVE_LCHMOD
+# define HAVE_LCHMOD 0
+#endif
+
+#ifndef CHOWN_CHANGE_TIME_BUG
+# define CHOWN_CHANGE_TIME_BUG 0
+#endif
+
+/* This file is designed to test lchown(n,o,g) and
+   chownat(AT_FDCWD,n,o,g,AT_SYMLINK_NOFOLLOW).  FUNC is the function
+   to test.  Assumes that BASE and ASSERT are already defined, and
+   that appropriate headers are already included.  If PRINT, warn
+   before skipping symlink tests with status 77.  */
+
+static int
+test_lchown (int (*func) (char const *, uid_t, gid_t), bool print)
+{
+  struct stat st1;
+  struct stat st2;
+  gid_t *gids = NULL;
+  int gids_count;
+  int result;
+
+  /* Solaris 8 is interesting - if the current process belongs to
+     multiple groups, the current directory is owned by a group that
+     the current process belongs to but different than getegid(), and
+     the current directory does not have the S_ISGID bit, then regular
+     files created in the directory belong to the directory's group,
+     but symlinks belong to the current effective group id.  If
+     S_ISGID is set, then both files and symlinks belong to the
+     directory's group.  However, it is possible to run the testsuite
+     from within a directory owned by a group we don't belong to, in
+     which case all things that we create belong to the current
+     effective gid.  So, work around the issues by creating a
+     subdirectory (we are guaranteed that the subdirectory will be
+     owned by one of our current groups), change ownership of that
+     directory to the current effective gid (which will thus succeed),
+     then create all other files within that directory (eliminating
+     questions on whether inheritance or current id triumphs, since
+     the two methods resolve to the same gid).  */
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  ASSERT (stat (BASE "dir", &st1) == 0);
+
+  /* Filter out mingw and file systems which have no concept of groups.  */
+  result = func (BASE "dir", st1.st_uid, getegid ());
+  if (result == -1 && (errno == ENOSYS || errno == EPERM))
+    {
+      ASSERT (rmdir (BASE "dir") == 0);
+      if (print)
+        fputs ("skipping test: no support for ownership\n", stderr);
+      return 77;
+    }
+  ASSERT (result == 0);
+
+  ASSERT (close (creat (BASE "dir/file", 0600)) == 0);
+  ASSERT (stat (BASE "dir/file", &st1) == 0);
+  ASSERT (st1.st_uid != (uid_t) -1);
+  ASSERT (st1.st_gid != (gid_t) -1);
+  /* On macOS 12, when logged in through ssh, getgid () and getegid () are both
+     == (gid_t) -1.  */
+  if (getgid () != (gid_t) -1)
+    ASSERT (st1.st_gid == getegid ());
+
+  /* Sanity check of error cases.  */
+  errno = 0;
+  ASSERT (func ("", -1, -1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("no_such", -1, -1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("no_such/", -1, -1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "dir/file/", -1, -1) == -1);
+  ASSERT (errno == ENOTDIR);
+
+  /* Check that -1 does not alter ownership.  */
+  ASSERT (func (BASE "dir/file", -1, st1.st_gid) == 0);
+  ASSERT (func (BASE "dir/file", st1.st_uid, -1) == 0);
+  ASSERT (func (BASE "dir/file", (uid_t) -1, (gid_t) -1) == 0);
+  ASSERT (stat (BASE "dir/file", &st2) == 0);
+  ASSERT (st1.st_uid == st2.st_uid);
+  ASSERT (st1.st_gid == st2.st_gid);
+
+  /* Even if the values aren't changing, ctime is required to change
+     if at least one argument is not -1.  */
+  nap ();
+  ASSERT (func (BASE "dir/file", st1.st_uid, st1.st_gid) == 0);
+  ASSERT (stat (BASE "dir/file", &st2) == 0);
+  ASSERT (st1.st_ctime < st2.st_ctime
+          || (st1.st_ctime == st2.st_ctime
+              && get_stat_ctime_ns (&st1) < get_stat_ctime_ns (&st2)));
+
+  /* Test symlink behavior.  */
+  if (symlink ("link", BASE "dir/link2"))
+    {
+      ASSERT (unlink (BASE "dir/file") == 0);
+      ASSERT (rmdir (BASE "dir") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  result = func (BASE "dir/link2", -1, -1);
+  if (result == -1 && (errno == ENOSYS || errno == EOPNOTSUPP))
+    {
+      ASSERT (unlink (BASE "dir/file") == 0);
+      ASSERT (unlink (BASE "dir/link2") == 0);
+      ASSERT (rmdir (BASE "dir") == 0);
+      if (print)
+        fputs ("skipping test: symlink ownership not supported\n", stderr);
+      return 77;
+    }
+  ASSERT (result == 0);
+  errno = 0;
+  ASSERT (func (BASE "dir/link2/", st1.st_uid, st1.st_gid) == -1);
+  ASSERT (errno == ENOENT);
+  ASSERT (symlink ("file", BASE "dir/link") == 0);
+  ASSERT (mkdir (BASE "dir/sub", 0700) == 0);
+  ASSERT (symlink ("sub", BASE "dir/link3") == 0);
+
+  /* For non-privileged users, lchown can only portably succeed at
+     changing group ownership of a file we own.  If we belong to at
+     least two groups, then verifying the correct change is simple.
+     But if we belong to only one group, then we fall back on the
+     other observable effect of lchown: the ctime must be updated.  */
+  gids_count = mgetgroups (NULL, st1.st_gid, &gids);
+  if (1 < gids_count)
+    {
+      ASSERT (gids[1] != st1.st_gid);
+      if (getgid () != (gid_t) -1)
+        ASSERT (gids[1] != (gid_t) -1);
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+
+      errno = 0;
+      ASSERT (func (BASE "dir/link2/", -1, gids[1]) == -1);
+      ASSERT (errno == ENOTDIR);
+      ASSERT (stat (BASE "dir/file", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+
+      ASSERT (func (BASE "dir/link2", -1, gids[1]) == 0);
+      ASSERT (stat (BASE "dir/file", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      if (getgid () != (gid_t) -1)
+        ASSERT (gids[1] == st2.st_gid);
+
+      /* Trailing slash follows through to directory.  */
+      ASSERT (lstat (BASE "dir/link3", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/sub", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+
+      ASSERT (func (BASE "dir/link3/", -1, gids[1]) == 0);
+      ASSERT (lstat (BASE "dir/link3", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      ASSERT (st1.st_gid == st2.st_gid);
+      ASSERT (lstat (BASE "dir/sub", &st2) == 0);
+      ASSERT (st1.st_uid == st2.st_uid);
+      if (getgid () != (gid_t) -1)
+        ASSERT (gids[1] == st2.st_gid);
+    }
+  else if (!CHOWN_CHANGE_TIME_BUG || HAVE_LCHMOD)
+    {
+      /* If we don't have lchmod, and lchown fails to change ctime,
+         then we can't test this part of lchown.  */
+      struct stat l1;
+      struct stat l2;
+      ASSERT (stat (BASE "dir/file", &st1) == 0);
+      ASSERT (lstat (BASE "dir/link", &l1) == 0);
+      ASSERT (lstat (BASE "dir/link2", &l2) == 0);
+
+      nap ();
+      errno = 0;
+      ASSERT (func (BASE "dir/link2/", -1, st1.st_gid) == -1);
+      ASSERT (errno == ENOTDIR);
+      ASSERT (stat (BASE "dir/file", &st2) == 0);
+      ASSERT (st1.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&st1) == get_stat_ctime_ns (&st2));
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (l1.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&l1) == get_stat_ctime_ns (&st2));
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (l2.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&l2) == get_stat_ctime_ns (&st2));
+
+      ASSERT (func (BASE "dir/link2", -1, st1.st_gid) == 0);
+      ASSERT (stat (BASE "dir/file", &st2) == 0);
+      ASSERT (st1.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&st1) == get_stat_ctime_ns (&st2));
+      ASSERT (lstat (BASE "dir/link", &st2) == 0);
+      ASSERT (l1.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&l1) == get_stat_ctime_ns (&st2));
+      ASSERT (lstat (BASE "dir/link2", &st2) == 0);
+      ASSERT (l2.st_ctime < st2.st_ctime
+              || (l2.st_ctime == st2.st_ctime
+                  && get_stat_ctime_ns (&l2) < get_stat_ctime_ns (&st2)));
+
+      /* Trailing slash follows through to directory.  */
+      ASSERT (lstat (BASE "dir/sub", &st1) == 0);
+      ASSERT (lstat (BASE "dir/link3", &l1) == 0);
+      nap ();
+      ASSERT (func (BASE "dir/link3/", -1, st1.st_gid) == 0);
+      ASSERT (lstat (BASE "dir/link3", &st2) == 0);
+      ASSERT (l1.st_ctime == st2.st_ctime);
+      ASSERT (get_stat_ctime_ns (&l1) == get_stat_ctime_ns (&st2));
+      ASSERT (lstat (BASE "dir/sub", &st2) == 0);
+      ASSERT (st1.st_ctime < st2.st_ctime
+              || (st1.st_ctime == st2.st_ctime
+                  && get_stat_ctime_ns (&st1) < get_stat_ctime_ns (&st2)));
+    }
+
+  /* Cleanup.  */
+  free (gids);
+  ASSERT (unlink (BASE "dir/file") == 0);
+  ASSERT (unlink (BASE "dir/link") == 0);
+  ASSERT (unlink (BASE "dir/link2") == 0);
+  ASSERT (unlink (BASE "dir/link3") == 0);
+  ASSERT (rmdir (BASE "dir/sub") == 0);
+  ASSERT (rmdir (BASE "dir") == 0);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 83bc4f09b1bd4badea4e2e82c252c8b263d4022f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-libgmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5e8b7f2f6fbf60fc0ebac2c642dc1f63a3464ba6
--- /dev/null
@@ -0,0 +1,74 @@
+/* Test of libgmp or its mini-gmp substitute.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <gmp.h>
+
+#include <limits.h>
+#include <string.h>
+
+#include "macros.h"
+
+#ifndef MINI_GMP_LIMB_TYPE
+/* Verify that the gmp.h header file was generated for the same
+   machine word size as we are using.  */
+static_assert (GMP_NUMB_BITS == sizeof (mp_limb_t) * CHAR_BIT);
+#endif
+
+int
+main ()
+{
+#ifndef MINI_GMP_LIMB_TYPE
+  /* Verify that the gmp.h header file and the libgmp library come from
+     the same GMP version.  */
+  {
+    char gmp_header_version[32];
+    sprintf (gmp_header_version, "%d.%d.%d", __GNU_MP_VERSION,
+             __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL);
+    if (strcmp (gmp_version, gmp_header_version) != 0)
+      {
+        char gmp_header_version2[32];
+        if (__GNU_MP_VERSION_PATCHLEVEL > 0
+            || (sprintf (gmp_header_version2, "%d.%d", __GNU_MP_VERSION,
+                         __GNU_MP_VERSION_MINOR),
+                strcmp (gmp_version, gmp_header_version2) != 0))
+          {
+            fprintf (stderr,
+                     "gmp header version (%s) does not match gmp library version (%s).\n",
+                     gmp_header_version, gmp_version);
+            exit (1);
+          }
+      }
+  }
+#endif
+
+  /* A simple sanity check that 2 + 2 = 4.  */
+  static mp_limb_t const twobody[] = { 2 };
+  static mpz_t const two = MPZ_ROINIT_N ((mp_limb_t *) twobody, 1);
+  ASSERT (mpz_fits_slong_p (two));
+  ASSERT (mpz_get_si (two) == 2);
+
+  mpz_t four;
+  mpz_init (four);
+  mpz_add (four, two, two);
+  ASSERT (mpz_fits_slong_p (four));
+  ASSERT (mpz_get_si (four) == 4);
+  mpz_clear (four);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index a8346bce46a238b2e7952ea660bfd5dd38f14aac..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-limits-h.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6f574c88a01c26ecfead837740590f3e3e76780e
--- /dev/null
@@ -0,0 +1,133 @@
+/* Test of <limits.h> substitute.
+   Copyright 2016-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include <limits.h>
+
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Woverlength-strings"
+#endif
+
+#define verify_width(width, min, max) \
+  static_assert ((max) >> ((width) - 1 - ((min) < 0)) == 1)
+
+/* Macros borrowed from intprops.h.  */
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
+#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
+#define TYPE_MAXIMUM(t)                                                 \
+  ((t) (! TYPE_SIGNED (t)                                               \
+        ? (t) -1                                                        \
+        : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
+
+/* Type width macros.  */
+
+int type_bits[] =
+  {
+    CHAR_BIT,
+    WORD_BIT,
+    LONG_BIT
+  };
+verify_width (CHAR_BIT, CHAR_MIN, CHAR_MAX);
+verify_width (WORD_BIT, INT_MIN, INT_MAX);
+verify_width (LONG_BIT, LONG_MIN, LONG_MAX);
+
+/* Numerical limit macros.  */
+
+char               limits1[]  = { CHAR_MIN, CHAR_MAX };
+static_assert (TYPE_MINIMUM (char) == CHAR_MIN);
+static_assert (TYPE_MAXIMUM (char) == CHAR_MAX);
+
+signed char        limits2[]  = { SCHAR_MIN, SCHAR_MAX };
+static_assert (TYPE_MINIMUM (signed char) == SCHAR_MIN);
+static_assert (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
+
+unsigned char      limits3[]  = { UCHAR_MAX };
+static_assert (TYPE_MINIMUM (unsigned char) == 0);
+static_assert (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX);
+
+short              limits4[]  = { SHRT_MIN, SHRT_MAX };
+static_assert (TYPE_MINIMUM (short int) == SHRT_MIN);
+static_assert (TYPE_MAXIMUM (short int) == SHRT_MAX);
+
+unsigned short     limits5[]  = { USHRT_MAX };
+static_assert (TYPE_MINIMUM (unsigned short int) == 0);
+static_assert (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX);
+
+int                limits6[]  = { INT_MIN, INT_MAX };
+static_assert (TYPE_MINIMUM (int) == INT_MIN);
+static_assert (TYPE_MAXIMUM (int) == INT_MAX);
+
+unsigned int       limits7[]  = { UINT_MAX };
+static_assert (TYPE_MINIMUM (unsigned int) == 0);
+static_assert (TYPE_MAXIMUM (unsigned int) == UINT_MAX);
+
+long               limits8[]  = { LONG_MIN, LONG_MAX };
+static_assert (TYPE_MINIMUM (long int) == LONG_MIN);
+static_assert (TYPE_MAXIMUM (long int) == LONG_MAX);
+
+unsigned long      limits9[]  = { ULONG_MAX };
+static_assert (TYPE_MINIMUM (unsigned long int) == 0);
+static_assert (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX);
+
+long long          limits10[] = { LLONG_MIN, LLONG_MAX };
+static_assert (TYPE_MINIMUM (long long int) == LLONG_MIN);
+static_assert (TYPE_MAXIMUM (long long int) == LLONG_MAX);
+
+unsigned long long limits11[] = { ULLONG_MAX };
+static_assert (TYPE_MINIMUM (unsigned long long int) == 0);
+static_assert (TYPE_MAXIMUM (unsigned long long int) == ULLONG_MAX);
+
+/* Specified by POSIX, not by ISO C.  */
+
+long long limits12[] = { SSIZE_MAX };
+
+/* Macros specified by C23 and by ISO/IEC TS 18661-1:2014.  */
+
+verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX);
+verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX);
+verify_width (UCHAR_WIDTH, 0, UCHAR_MAX);
+verify_width (SHRT_WIDTH, SHRT_MIN, SHRT_MAX);
+verify_width (USHRT_WIDTH, 0, USHRT_MAX);
+verify_width (INT_WIDTH, INT_MIN, INT_MAX);
+verify_width (UINT_WIDTH, 0, UINT_MAX);
+verify_width (LONG_WIDTH, LONG_MIN, LONG_MAX);
+verify_width (ULONG_WIDTH, 0, ULONG_MAX);
+verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX);
+verify_width (ULLONG_WIDTH, 0, ULLONG_MAX);
+
+/* Macros specified by C23.  */
+
+int bool_attrs[] = { BOOL_MAX, BOOL_WIDTH };
+static_assert (BOOL_MAX == 1);
+
+static_assert (0 < MB_LEN_MAX);
+
+/* Get ssize_t, size_t.  */
+#include <sys/types.h>
+
+static_assert (TYPE_MAXIMUM (ssize_t) == SSIZE_MAX);
+/* Verify that ssize_t has the same width as size_t.  */
+static_assert (TYPE_MAXIMUM (size_t) / 2 == SSIZE_MAX);
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 18ce830515b5ec9c1ef557859205587aa18d3409..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-link.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..042b0afcb1765a57007a719da97f2fa8e7658e09
--- /dev/null
@@ -0,0 +1,46 @@
+/* Test of link() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (link, int, (char const *, char const *));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-link.t"
+
+#include "test-link.h"
+
+int
+main (void)
+{
+  /* Remove any garbage left from previous partial runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_link (link, true);
+}
deleted file mode 120000 (symlink)
index d9bee8cc1cbcc372c7c1447f240feeb8bb128af9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-link.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3e88f5e6e0aea7f8ac5430466eeb23d9c9bdc973
--- /dev/null
@@ -0,0 +1,187 @@
+/* Test of link() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file is designed to test both link(a,b) and
+   linkat(AT_FDCWD,a,AT_FDCWD,b,0).  FUNC is the function to test.
+   Assumes that BASE and ASSERT are already defined, and that
+   appropriate headers are already included.  If PRINT, warn before
+   skipping tests with status 77.  This test does not try to create
+   hard links to symlinks, but does test other aspects of symlink.  */
+
+static int
+test_link (int (*func) (char const *, char const *), bool print)
+{
+  int fd;
+  int ret;
+
+  /* Create first file.  */
+  fd = open (BASE "a", O_CREAT | O_EXCL | O_WRONLY, 0600);
+  ASSERT (0 <= fd);
+  ASSERT (write (fd, "hello", 5) == 5);
+  ASSERT (close (fd) == 0);
+
+  /* Not all file systems support link.  Mingw doesn't have reliable
+     st_nlink on hard links, but our implementation does fail with
+     EPERM on poor file systems, and we can detect the inferior stat()
+     via st_ino.  Cygwin 1.5.x copies rather than links files on those
+     file systems, but there, st_nlink and st_ino are reliable.  */
+  ret = func (BASE "a", BASE "b");
+  if (!ret)
+    {
+      struct stat st;
+      ASSERT (stat (BASE "b", &st) == 0);
+      if (st.st_ino && st.st_nlink != 2)
+        {
+          ASSERT (unlink (BASE "b") == 0);
+          errno = EPERM;
+          ret = -1;
+        }
+    }
+  if (ret == -1)
+    {
+      /* If the device does not support hard links, errno is
+         EPERM on Linux,
+         EOPNOTSUPP on FreeBSD,
+         EACCES on Android within Termux.  */
+      switch (errno)
+        {
+        case EPERM:
+        case EOPNOTSUPP:
+        #if defined __ANDROID__
+        case EACCES:
+        #endif
+          if (print)
+            fputs ("skipping test: "
+                   "hard links not supported on this file system\n",
+                   stderr);
+          ASSERT (unlink (BASE "a") == 0);
+          return 77;
+        default:
+          perror ("link");
+          return 1;
+        }
+    }
+  ASSERT (ret == 0);
+
+  /* Now, for some behavior tests.  Modify the contents of 'b', and
+     ensure that 'a' can see it, both while 'b' exists and after.  */
+  fd = open (BASE "b", O_APPEND | O_WRONLY);
+  ASSERT (0 <= fd);
+  ASSERT (write (fd, "world", 5) == 5);
+  ASSERT (close (fd) == 0);
+  {
+    char buf[11] = { 0 };
+    fd = open (BASE "a", O_RDONLY);
+    ASSERT (0 <= fd);
+    ASSERT (read (fd, buf, 10) == 10);
+    ASSERT (strcmp (buf, "helloworld") == 0);
+    ASSERT (close (fd) == 0);
+    ASSERT (unlink (BASE "b") == 0);
+    fd = open (BASE "a", O_RDONLY);
+    ASSERT (0 <= fd);
+    ASSERT (read (fd, buf, 10) == 10);
+    ASSERT (strcmp (buf, "helloworld") == 0);
+    ASSERT (close (fd) == 0);
+  }
+
+  /* Test for various error conditions.  */
+  ASSERT (mkdir (BASE "d", 0700) == 0);
+  errno = 0;
+  ASSERT (func (BASE "a", ".") == -1);
+  ASSERT (errno == EEXIST || errno == EINVAL);
+  errno = 0;
+  ASSERT (func (BASE "a", BASE "a") == -1);
+  ASSERT (errno == EEXIST);
+  ASSERT (func (BASE "a", BASE "b") == 0);
+  errno = 0;
+  ASSERT (func (BASE "a", BASE "b") == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (func (BASE "a", BASE "d") == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (func (BASE "c", BASE "e") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "a", BASE "c/.") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "a/", BASE "c") == -1);
+  ASSERT (errno == ENOTDIR || errno == EINVAL);
+  errno = 0;
+  ASSERT (func (BASE "a", BASE "c/") == -1);
+  ASSERT (errno == ENOTDIR || errno == ENOENT || errno == EINVAL);
+
+  /* Most platforms reject hard links to directories, and even on
+     those that do permit it, most users can't create them.  We assume
+     that if this test is run as root and we managed to create a hard
+     link, then unlink better be able to clean it up.  */
+  {
+    int result;
+    errno = 0;
+    result = func (BASE "d", BASE "c");
+    if (result == 0)
+      {
+        /* Probably root on Solaris.  */
+        ASSERT (unlink (BASE "c") == 0);
+      }
+    else
+      {
+        /* Most everyone else.  */
+        ASSERT (errno == EPERM || errno == EACCES || errno == EISDIR);
+        errno = 0;
+        ASSERT (func (BASE "d/.", BASE "c") == -1);
+        ASSERT (errno == EPERM || errno == EACCES || errno == EISDIR
+                || errno == EINVAL);
+        errno = 0;
+        ASSERT (func (BASE "d/.//", BASE "c") == -1);
+        ASSERT (errno == EPERM || errno == EACCES || errno == EISDIR
+                || errno == EINVAL);
+      }
+  }
+  ASSERT (unlink (BASE "a") == 0);
+  errno = 0;
+  ASSERT (unlink (BASE "c") == -1);
+  ASSERT (errno == ENOENT);
+  ASSERT (rmdir (BASE "d") == 0);
+
+  /* Test invalid use of symlink.  */
+  if (symlink (BASE "a", BASE "link") != 0)
+    {
+      ASSERT (unlink (BASE "b") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  errno = 0;
+  ASSERT (func (BASE "b", BASE "link/") == -1);
+  ASSERT (errno == ENOTDIR || errno == ENOENT || errno == EEXIST
+          || errno == EINVAL);
+  errno = 0;
+  ASSERT (func (BASE "b", BASE "link") == -1);
+  ASSERT (errno == EEXIST);
+  ASSERT (rename (BASE "b", BASE "a") == 0);
+  errno = 0;
+  ASSERT (func (BASE "link/", BASE "b") == -1);
+  ASSERT (errno == ENOTDIR || errno == EEXIST || errno == EINVAL);
+
+  /* Clean up.  */
+  ASSERT (unlink (BASE "a") == 0);
+  ASSERT (unlink (BASE "link") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 03689392a0e622bb83c1729c16c68fadeaa7a40b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-linkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2729821f647106e1146ff927a84404bf86e44920
--- /dev/null
@@ -0,0 +1,387 @@
+/* Tests of linkat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (linkat, int, (int, char const *, int, char const *, int));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "areadlink.h"
+#include "filenamecat.h"
+#include "same-inode.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-linkat.t"
+
+#include "test-link.h"
+
+static int dfd1 = AT_FDCWD;
+static int dfd2 = AT_FDCWD;
+static int flag = AT_SYMLINK_FOLLOW;
+
+/* Wrapper to test linkat like link.  */
+static int
+do_link (char const *name1, char const *name2)
+{
+  return linkat (dfd1, name1, dfd2, name2, flag);
+}
+
+/* Can we expect that link() and linkat(), when called on a symlink,
+   increment the link count of that symlink?  */
+#if LINK_FOLLOWS_SYMLINKS == 0
+# define EXPECT_LINK_HARDLINKS_SYMLINKS 1
+#elif LINK_FOLLOWS_SYMLINKS == -1
+extern int __xpg4;
+# define EXPECT_LINK_HARDLINKS_SYMLINKS (__xpg4 == 0)
+#else
+# define EXPECT_LINK_HARDLINKS_SYMLINKS 0
+#endif
+
+/* Wrapper to see if two symlinks act the same.  */
+static void
+check_same_link (char const *name1, char const *name2)
+{
+  struct stat st1;
+  struct stat st2;
+  char *contents1;
+  char *contents2;
+  ASSERT (lstat (name1, &st1) == 0);
+  ASSERT (lstat (name2, &st2) == 0);
+  contents1 = areadlink_with_size (name1, st1.st_size);
+  contents2 = areadlink_with_size (name2, st2.st_size);
+  ASSERT (contents1);
+  ASSERT (contents2);
+  ASSERT (strcmp (contents1, contents2) == 0);
+  if (EXPECT_LINK_HARDLINKS_SYMLINKS)
+    ASSERT (psame_inode (&st1, &st2));
+  free (contents1);
+  free (contents2);
+}
+
+int
+main (void)
+{
+  int i;
+  int dfd;
+  char *cwd;
+  int result;
+
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (linkat (-1, "foo", AT_FDCWD, "bar", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (linkat (99, "foo", AT_FDCWD, "bar", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  ASSERT (close (creat (BASE "oo", 0600)) == 0);
+  {
+    errno = 0;
+    ASSERT (linkat (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (linkat (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  ASSERT (unlink (BASE "oo") == 0);
+
+  /* Test basic link functionality, without mentioning symlinks.  */
+  result = test_link (do_link, true);
+  dfd1 = open (".", O_RDONLY);
+  ASSERT (0 <= dfd1);
+  ASSERT (test_link (do_link, false) == result);
+  dfd2 = dfd1;
+  ASSERT (test_link (do_link, false) == result);
+  dfd1 = AT_FDCWD;
+  ASSERT (test_link (do_link, false) == result);
+  flag = 0;
+  ASSERT (test_link (do_link, false) == result);
+  dfd1 = dfd2;
+  ASSERT (test_link (do_link, false) == result);
+  dfd2 = AT_FDCWD;
+  ASSERT (test_link (do_link, false) == result);
+  ASSERT (close (dfd1) == 0);
+  dfd1 = AT_FDCWD;
+  ASSERT (test_link (do_link, false) == result);
+
+  /* Skip the rest of the test if the file system does not support hard links
+     and symlinks.  */
+  if (result)
+    return result;
+
+  /* Create locations to manipulate.  */
+  ASSERT (mkdir (BASE "sub1", 0700) == 0);
+  ASSERT (mkdir (BASE "sub2", 0700) == 0);
+  ASSERT (close (creat (BASE "00", 0600)) == 0);
+  cwd = getcwd (NULL, 0);
+  ASSERT (cwd);
+
+  dfd = open (BASE "sub1", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (chdir (BASE "sub2") == 0);
+
+  /* There are 16 possible scenarios, based on whether an fd is
+     AT_FDCWD or real, whether a file is absolute or relative, coupled
+     with whether flag is set for 32 iterations.
+
+     To ensure that we test all of the code paths (rather than
+     triggering early normalization optimizations), we use a loop to
+     repeatedly rename a file in the parent directory, use an fd open
+     on subdirectory 1, all while executing in subdirectory 2; all
+     relative names are thus given with a leading "../".  Finally, the
+     last scenario (two relative paths given, neither one AT_FDCWD)
+     has two paths, based on whether the two fds are equivalent, so we
+     do the other variant after the loop.  */
+  for (i = 0; i < 32; i++)
+    {
+      int fd1 = (i & 8) ? dfd : AT_FDCWD;
+      char *file1 = mfile_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
+      int fd2 = (i & 2) ? dfd : AT_FDCWD;
+      char *file2 = mfile_name_concat ((i & 1) ? ".." : cwd, BASE "xx", NULL);
+      ASSERT (file1);
+      ASSERT (file2);
+      flag = (i & 0x10 ? AT_SYMLINK_FOLLOW : 0);
+
+      ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
+      ASSERT (sprintf (strchr (file2, '\0') - 2, "%02d", i + 1) == 2);
+      ASSERT (linkat (fd1, file1, fd2, file2, flag) == 0);
+      ASSERT (unlinkat (fd1, file1, 0) == 0);
+      free (file1);
+      free (file2);
+    }
+  dfd2 = open ("..", O_RDONLY);
+  ASSERT (0 <= dfd2);
+  ASSERT (linkat (dfd, "../" BASE "32", dfd2, BASE "33", 0) == 0);
+  ASSERT (linkat (dfd, "../" BASE "33", dfd2, BASE "34",
+                  AT_SYMLINK_FOLLOW) == 0);
+  ASSERT (close (dfd2) == 0);
+
+  /* Now we change back to the parent directory, and set dfd to ".",
+     in order to test behavior on symlinks.  */
+  ASSERT (chdir ("..") == 0);
+  ASSERT (close (dfd) == 0);
+  if (symlink (BASE "sub1", BASE "link1"))
+    {
+      ASSERT (unlink (BASE "32") == 0);
+      ASSERT (unlink (BASE "33") == 0);
+      ASSERT (unlink (BASE "34") == 0);
+      ASSERT (rmdir (BASE "sub1") == 0);
+      ASSERT (rmdir (BASE "sub2") == 0);
+      free (cwd);
+      if (!result)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return result;
+    }
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (symlink (BASE "34", BASE "link2") == 0);
+  ASSERT (symlink (BASE "link3", BASE "link3") == 0);
+  ASSERT (symlink (BASE "nowhere", BASE "link4") == 0);
+
+  /* Link cannot overwrite existing files.  */
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "sub1", 0) == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1/", dfd, BASE "sub1", 0) == -1);
+  ASSERT (errno == EEXIST || errno == EPERM || errno == EACCES);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "sub1/", 0) == -1);
+  ASSERT (errno == EEXIST || errno == ENOTDIR);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "sub1",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == EEXIST || errno == EPERM || errno == EACCES);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1/", dfd, BASE "sub1",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == EEXIST || errno == EPERM || errno == EACCES
+          || errno == EINVAL);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "sub1/",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == EEXIST || errno == EPERM || errno == EACCES
+          || errno == EINVAL);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "link2", 0) == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "link2",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == EEXIST || errno == EPERM || errno == EACCES);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "link3", 0) == -1);
+  ASSERT (errno == EEXIST || errno == ELOOP);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "link3",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == EEXIST || errno == EPERM || errno == EACCES
+          || errno == ELOOP);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link2", dfd, BASE "link3", 0) == -1);
+  ASSERT (errno == EEXIST || errno == ELOOP);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link2", dfd, BASE "link3",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == EEXIST || errno == ELOOP);
+
+  /* AT_SYMLINK_FOLLOW only follows first argument, not second.  */
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "link4", 0) == -1);
+  ASSERT (errno == EEXIST);
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "link4",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == EEXIST || errno == EPERM || errno == EACCES);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "34", dfd, BASE "link4", 0) == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "34", dfd, BASE "link4", AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == EEXIST);
+
+  /* Trailing slash handling.  */
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link2/", dfd, BASE "link5", 0) == -1);
+  ASSERT (errno == ENOTDIR);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link2/", dfd, BASE "link5",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == ENOTDIR || errno == EINVAL);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link3/", dfd, BASE "link5", 0) == -1);
+  ASSERT (errno == ELOOP);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link3/", dfd, BASE "link5",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == ELOOP || errno == EINVAL);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link4/", dfd, BASE "link5", 0) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link4/", dfd, BASE "link5",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == ENOENT || errno == EINVAL);
+
+  /* Check for hard links to symlinks.  */
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "link5", 0) == 0);
+  check_same_link (BASE "link1", BASE "link5");
+  ASSERT (unlink (BASE "link5") == 0);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link1", dfd, BASE "link5",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == EPERM || errno == EACCES);
+  ASSERT (linkat (dfd, BASE "link2", dfd, BASE "link5", 0) == 0);
+  check_same_link (BASE "link2", BASE "link5");
+  ASSERT (unlink (BASE "link5") == 0);
+  ASSERT (linkat (dfd, BASE "link2", dfd, BASE "file", AT_SYMLINK_FOLLOW) == 0);
+  errno = 0;
+  ASSERT (areadlink (BASE "file") == NULL);
+  ASSERT (errno == EINVAL);
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (linkat (dfd, BASE "link3", dfd, BASE "link5", 0) == 0);
+  check_same_link (BASE "link3", BASE "link5");
+  ASSERT (unlink (BASE "link5") == 0);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link3", dfd, BASE "link5",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == ELOOP);
+  ASSERT (linkat (dfd, BASE "link4", dfd, BASE "link5", 0) == 0);
+  check_same_link (BASE "link4", BASE "link5");
+  ASSERT (unlink (BASE "link5") == 0);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link4", dfd, BASE "link5",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == ENOENT);
+
+  /* Check that symlink to symlink to file is followed all the way.  */
+  ASSERT (symlink (BASE "link2", BASE "link5") == 0);
+  ASSERT (linkat (dfd, BASE "link5", dfd, BASE "link6", 0) == 0);
+  check_same_link (BASE "link5", BASE "link6");
+  ASSERT (unlink (BASE "link6") == 0);
+  ASSERT (linkat (dfd, BASE "link5", dfd, BASE "file", AT_SYMLINK_FOLLOW) == 0);
+  errno = 0;
+  ASSERT (areadlink (BASE "file") == NULL);
+  ASSERT (errno == EINVAL);
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (unlink (BASE "link5") == 0);
+  ASSERT (symlink (BASE "link3", BASE "link5") == 0);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link5", dfd, BASE "file",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == ELOOP);
+  ASSERT (unlink (BASE "link5") == 0);
+  ASSERT (symlink (BASE "link4", BASE "link5") == 0);
+  errno = 0;
+  ASSERT (linkat (dfd, BASE "link5", dfd, BASE "file",
+                  AT_SYMLINK_FOLLOW) == -1);
+  ASSERT (errno == ENOENT);
+
+  /* Now for some real fun with directory crossing.  */
+  ASSERT (symlink (cwd, BASE "sub1/link") == 0);
+  ASSERT (symlink (".././/" BASE "sub1/link/" BASE "link2",
+                   BASE "sub2/link") == 0);
+  ASSERT (close (dfd) == 0);
+  dfd = open (BASE "sub1", O_RDONLY);
+  ASSERT (0 <= dfd);
+  dfd2 = open (BASE "sub2", O_RDONLY);
+  ASSERT (0 < dfd2);
+  ASSERT (linkat (dfd, "../" BASE "sub2/link", dfd2, "./..//" BASE "sub1/file",
+              AT_SYMLINK_FOLLOW) == 0);
+  errno = 0;
+  ASSERT (areadlink (BASE "sub1/file") == NULL);
+  ASSERT (errno == EINVAL);
+
+  /* Cleanup.  */
+  ASSERT (close (dfd) == 0);
+  ASSERT (close (dfd2) == 0);
+  ASSERT (unlink (BASE "sub1/file") == 0);
+  ASSERT (unlink (BASE "sub1/link") == 0);
+  ASSERT (unlink (BASE "sub2/link") == 0);
+  ASSERT (unlink (BASE "32") == 0);
+  ASSERT (unlink (BASE "33") == 0);
+  ASSERT (unlink (BASE "34") == 0);
+  ASSERT (rmdir (BASE "sub1") == 0);
+  ASSERT (rmdir (BASE "sub2") == 0);
+  ASSERT (unlink (BASE "link1") == 0);
+  ASSERT (unlink (BASE "link2") == 0);
+  ASSERT (unlink (BASE "link3") == 0);
+  ASSERT (unlink (BASE "link4") == 0);
+  ASSERT (unlink (BASE "link5") == 0);
+  free (cwd);
+  return result;
+}
deleted file mode 120000 (symlink)
index 149a947fb52cb482c0c1a750e2238ec4066b0d25..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-listen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..21fc7a2b3e84cda10ce7ff3ad9b064fbffd8b318
--- /dev/null
@@ -0,0 +1,54 @@
+/* Test listen() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/socket.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (listen, int, (int, int));
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "sockets.h"
+#include "macros.h"
+
+/* Tell GCC not to warn about the specific edge cases tested here.  */
+#if __GNUC__ >= 13
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
+#endif
+
+int
+main (void)
+{
+  (void) gl_sockets_startup (SOCKETS_1_1);
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (listen (-1, 1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (listen (99 ,1) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3e6afa27519ebe802338cc5cabc68632499f6cdc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-localcharset.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..da6cbf6d7b1cba3ae34def4c3d86b88705997bce
--- /dev/null
@@ -0,0 +1,39 @@
+/* Manual test of localcharset() function.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This program prints the result of locale_charset in the current locale.
+   One way to use it is:
+     $ for l in `locale -a`; do
+         echo -n "$l               "; LANG=$l ./test-localcharset;
+       done \
+       | sort -k 2
+ */
+
+#include <config.h>
+
+#include "localcharset.h"
+
+#include <locale.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+  setlocale (LC_ALL, "");
+  printf ("%s\n", locale_charset ());
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f94fe43a17a0ac60d6af23eb2bc71eb9959343ea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-locale.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e4e61aad986fc04a9cc4e18c6f795856d949f9c6
--- /dev/null
@@ -0,0 +1,78 @@
+/* Test of <locale.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <locale.h>
+
+int a[] =
+  {
+    LC_ALL,
+    LC_COLLATE,
+    LC_CTYPE,
+    LC_MESSAGES,
+    LC_MONETARY,
+    LC_NUMERIC,
+    LC_TIME
+  };
+
+/* Check that the 'struct lconv' type is defined.  */
+struct lconv l;
+int ls;
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+static_assert (sizeof NULL == sizeof (void *));
+
+int
+main ()
+{
+#if HAVE_WORKING_NEWLOCALE
+  /* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined.  */
+  locale_t b = LC_GLOBAL_LOCALE;
+  (void) b;
+#endif
+
+  /* Check that 'struct lconv' has the ISO C and POSIX specified members.  */
+  ls += sizeof (*l.decimal_point);
+  ls += sizeof (*l.thousands_sep);
+  ls += sizeof (*l.grouping);
+  ls += sizeof (*l.mon_decimal_point);
+  ls += sizeof (*l.mon_thousands_sep);
+  ls += sizeof (*l.mon_grouping);
+  ls += sizeof (*l.positive_sign);
+  ls += sizeof (*l.negative_sign);
+  ls += sizeof (*l.currency_symbol);
+  ls += sizeof (l.frac_digits);
+  ls += sizeof (l.p_cs_precedes);
+  ls += sizeof (l.p_sign_posn);
+  ls += sizeof (l.p_sep_by_space);
+  ls += sizeof (l.n_cs_precedes);
+  ls += sizeof (l.n_sign_posn);
+  ls += sizeof (l.n_sep_by_space);
+  ls += sizeof (*l.int_curr_symbol);
+  ls += sizeof (l.int_frac_digits);
+  ls += sizeof (l.int_p_cs_precedes);
+  ls += sizeof (l.int_p_sign_posn);
+  ls += sizeof (l.int_p_sep_by_space);
+  ls += sizeof (l.int_n_cs_precedes);
+  ls += sizeof (l.int_n_sign_posn);
+  ls += sizeof (l.int_n_sep_by_space);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3247c19e5587614f469f6f376d518c54d20db9ab..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-localeconv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a4f0ecd89e8be5822f45fb07906b9c076adff50c
--- /dev/null
@@ -0,0 +1,72 @@
+/* Test of localeconv() function.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2012.  */
+
+#include <config.h>
+
+#include <locale.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (localeconv, struct lconv *, (void));
+
+#include <limits.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Test localeconv() result in the "C" locale.  */
+  {
+    struct lconv *l = localeconv ();
+
+    ASSERT (STREQ (l->decimal_point, "."));
+    ASSERT (STREQ (l->thousands_sep, ""));
+#if !((defined __FreeBSD__ || defined __DragonFly__) || defined __sun || defined __CYGWIN__)
+    ASSERT (STREQ (l->grouping, ""));
+#endif
+
+    ASSERT (STREQ (l->mon_decimal_point, ""));
+    ASSERT (STREQ (l->mon_thousands_sep, ""));
+#if !((defined __FreeBSD__ || defined __DragonFly__) || defined __sun || defined __CYGWIN__)
+    ASSERT (STREQ (l->mon_grouping, ""));
+#endif
+    ASSERT (STREQ (l->positive_sign, ""));
+    ASSERT (STREQ (l->negative_sign, ""));
+
+    ASSERT (STREQ (l->currency_symbol, ""));
+    ASSERT (l->frac_digits == CHAR_MAX);
+    ASSERT (l->p_cs_precedes == CHAR_MAX);
+    ASSERT (l->p_sign_posn == CHAR_MAX);
+    ASSERT (l->p_sep_by_space == CHAR_MAX);
+    ASSERT (l->n_cs_precedes == CHAR_MAX);
+    ASSERT (l->n_sign_posn == CHAR_MAX);
+    ASSERT (l->n_sep_by_space == CHAR_MAX);
+
+    ASSERT (STREQ (l->int_curr_symbol, ""));
+    ASSERT (l->int_frac_digits == CHAR_MAX);
+    ASSERT (l->int_p_cs_precedes == CHAR_MAX);
+    ASSERT (l->int_p_sign_posn == CHAR_MAX);
+    ASSERT (l->int_p_sep_by_space == CHAR_MAX);
+    ASSERT (l->int_n_cs_precedes == CHAR_MAX);
+    ASSERT (l->int_n_sign_posn == CHAR_MAX);
+    ASSERT (l->int_n_sep_by_space == CHAR_MAX);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 29535f1acc90a9917e7814b33f96e5409aa84d5b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-localename.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fe31201361e2e34167fe6082260e8a795eec919d
--- /dev/null
@@ -0,0 +1,825 @@
+/* Test of gl_locale_name function and its variants.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "localename.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+#if HAVE_WORKING_NEWLOCALE && HAVE_WORKING_USELOCALE && !HAVE_FAKE_LOCALES
+# define HAVE_GOOD_USELOCALE 1
+#endif
+
+#ifdef __HAIKU__
+/* Work around Haiku bug <https://dev.haiku-os.org/ticket/18344>.  */
+# define freelocale(loc) ((void) (loc))
+#endif
+
+/* Suppress GCC false positive.  */
+#if __GNUC__ >= 12
+# pragma GCC diagnostic ignored "-Wanalyzer-use-of-uninitialized-value"
+#endif
+
+#if HAVE_GOOD_USELOCALE
+
+static struct { int cat; int mask; const char *string; } const categories[] =
+  {
+      { LC_CTYPE,          LC_CTYPE_MASK,          "LC_CTYPE" },
+      { LC_NUMERIC,        LC_NUMERIC_MASK,        "LC_NUMERIC" },
+      { LC_TIME,           LC_TIME_MASK,           "LC_TIME" },
+      { LC_COLLATE,        LC_COLLATE_MASK,        "LC_COLLATE" },
+      { LC_MONETARY,       LC_MONETARY_MASK,       "LC_MONETARY" },
+      { LC_MESSAGES,       LC_MESSAGES_MASK,       "LC_MESSAGES" }
+# ifdef LC_PAPER
+    , { LC_PAPER,          LC_PAPER_MASK,          "LC_PAPER" }
+# endif
+# ifdef LC_NAME
+    , { LC_NAME,           LC_NAME_MASK,           "LC_NAME" }
+# endif
+# ifdef LC_ADDRESS
+    , { LC_ADDRESS,        LC_ADDRESS_MASK,        "LC_ADDRESS" }
+# endif
+# ifdef LC_TELEPHONE
+    , { LC_TELEPHONE,      LC_TELEPHONE_MASK,      "LC_TELEPHONE" }
+# endif
+# ifdef LC_MEASUREMENT
+    , { LC_MEASUREMENT,    LC_MEASUREMENT_MASK,    "LC_MEASUREMENT" }
+# endif
+# ifdef LC_IDENTIFICATION
+    , { LC_IDENTIFICATION, LC_IDENTIFICATION_MASK, "LC_IDENTIFICATION" }
+# endif
+  };
+
+#endif
+
+/* Test the gl_locale_name() function.  */
+static void
+test_locale_name (void)
+{
+  const char *ret;
+  const char *name;
+
+  /* Check that gl_locale_name returns non-NULL.  */
+  ASSERT (gl_locale_name (LC_MESSAGES, "LC_MESSAGES") != NULL);
+
+  /* Get into a defined state,  */
+  setlocale (LC_ALL, "en_US.UTF-8");
+#if HAVE_GOOD_USELOCALE
+  uselocale (LC_GLOBAL_LOCALE);
+#endif
+
+  /* Check that when all environment variables are unset,
+     gl_locale_name returns the default locale.  */
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LC_NUMERIC");
+  unsetenv ("LANG");
+  /* Need also to unset all environment variables that specify standard or
+     non-standard locale categories.  Otherwise, on glibc systems, when some
+     of these variables are set and reference a nonexistent locale, the
+     setlocale (LC_ALL, "") call below would fail.  */
+  unsetenv ("LC_COLLATE");
+  unsetenv ("LC_MONETARY");
+  unsetenv ("LC_TIME");
+  unsetenv ("LC_ADDRESS");
+  unsetenv ("LC_IDENTIFICATION");
+  unsetenv ("LC_MEASUREMENT");
+  unsetenv ("LC_NAME");
+  unsetenv ("LC_PAPER");
+  unsetenv ("LC_TELEPHONE");
+  ret = setlocale (LC_ALL, "");
+  ASSERT (ret != NULL);
+  ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"),
+                  gl_locale_name_default ()) == 0);
+  ASSERT (strcmp (gl_locale_name (LC_NUMERIC, "LC_NUMERIC"),
+                  gl_locale_name_default ()) == 0);
+
+  /* Check that an empty environment variable is treated like an unset
+     environment variable.  */
+
+  setenv ("LC_ALL", "", 1);
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"),
+                  gl_locale_name_default ()) == 0);
+
+  unsetenv ("LC_ALL");
+  setenv ("LC_CTYPE", "", 1);
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"),
+                  gl_locale_name_default ()) == 0);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  setenv ("LC_MESSAGES", "", 1);
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"),
+                  gl_locale_name_default ()) == 0);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  setenv ("LANG", "", 1);
+  setlocale (LC_ALL, "");
+  ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"),
+                  gl_locale_name_default ()) == 0);
+
+  /* Check that LC_ALL overrides the others, and LANG is overridden by the
+     others.  */
+
+  setenv ("LC_ALL", "C", 1);
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0);
+
+  unsetenv ("LC_ALL");
+  setenv ("LC_CTYPE", "C", 1);
+  setenv ("LC_MESSAGES", "C", 1);
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  setenv ("LANG", "C", 1);
+  setlocale (LC_ALL, "");
+  ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0);
+
+  /* Check mixed situations.  */
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1);
+  setenv ("LANG", "de_DE.UTF-8", 1);
+  if (setlocale (LC_ALL, "") != NULL)
+    {
+      name = gl_locale_name (LC_CTYPE, "LC_CTYPE");
+#if defined _WIN32 && !defined __CYGWIN__
+      /* On native Windows, here,
+           gl_locale_name_thread (LC_CTYPE, "LC_CTYPE")
+         returns NULL and
+           gl_locale_name_posix (LC_CTYPE, "LC_CTYPE")
+         returns either "de_DE" or "de_DE.UTF-8".  */
+      ASSERT (strcmp (name, "de_DE") == 0 || strcmp (name, "de_DE.UTF-8") == 0);
+#else
+      ASSERT (strcmp (name, "de_DE.UTF-8") == 0);
+#endif
+      name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES");
+      ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+    }
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1);
+  unsetenv ("LANG");
+  if (setlocale (LC_ALL, "") != NULL)
+    {
+      name = gl_locale_name (LC_CTYPE, "LC_CTYPE");
+      ASSERT (strcmp (name, gl_locale_name_default ()) == 0);
+      name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES");
+      ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+    }
+
+#if HAVE_GOOD_USELOCALE
+  /* Check that gl_locale_name considers the thread locale.  */
+  {
+    locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+    if (locale != NULL)
+      {
+        uselocale (locale);
+        name = gl_locale_name (LC_CTYPE, "LC_CTYPE");
+        ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+        name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES");
+        ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+        uselocale (LC_GLOBAL_LOCALE);
+        freelocale (locale);
+      }
+  }
+
+  /* Check that gl_locale_name distinguishes different categories of the
+     thread locale, and that the name is the right one for each.  */
+  {
+    unsigned int i;
+
+    for (i = 0; i < SIZEOF (categories); i++)
+      {
+        int category_mask = categories[i].mask;
+        locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+        if (loc != NULL)
+          {
+            locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
+            if (locale == NULL)
+              freelocale (loc);
+            else
+              {
+                unsigned int j;
+
+                uselocale (locale);
+                for (j = 0; j < SIZEOF (categories); j++)
+                  {
+                    const char *name_j =
+                      gl_locale_name (categories[j].cat, categories[j].string);
+                    if (j == i)
+                      ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0);
+                    else
+                      ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0);
+                  }
+                uselocale (LC_GLOBAL_LOCALE);
+                freelocale (locale);
+              }
+          }
+      }
+  }
+#endif
+}
+
+/* Test the gl_locale_name_thread() function.  */
+static void
+test_locale_name_thread (void)
+{
+  /* Get into a defined state,  */
+  setlocale (LC_ALL, "en_US.UTF-8");
+
+#if HAVE_GOOD_USELOCALE
+  /* Check that gl_locale_name_thread returns NULL when no thread locale is
+     set.  */
+  uselocale (LC_GLOBAL_LOCALE);
+  ASSERT (gl_locale_name_thread (LC_CTYPE, "LC_CTYPE") == NULL);
+  ASSERT (gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES") == NULL);
+
+  /* Check that gl_locale_name_thread considers the thread locale.  */
+  {
+    locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+    if (locale != NULL)
+      {
+        const char *name;
+
+        uselocale (locale);
+        name = gl_locale_name_thread (LC_CTYPE, "LC_CTYPE");
+        ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+        name = gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES");
+        ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+        uselocale (LC_GLOBAL_LOCALE);
+        freelocale (locale);
+      }
+  }
+
+  /* Check that gl_locale_name_thread distinguishes different categories of the
+     thread locale, and that the name is the right one for each.  */
+  {
+    unsigned int i;
+
+    for (i = 0; i < SIZEOF (categories); i++)
+      {
+        int category_mask = categories[i].mask;
+        locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+        if (loc != NULL)
+          {
+            locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
+            if (locale == NULL)
+              freelocale (loc);
+            else
+              {
+                unsigned int j;
+
+                uselocale (locale);
+                for (j = 0; j < SIZEOF (categories); j++)
+                  {
+                    const char *name_j =
+                      gl_locale_name_thread (categories[j].cat,
+                                             categories[j].string);
+                    if (j == i)
+                      ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0);
+                    else
+                      ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0);
+                  }
+                uselocale (LC_GLOBAL_LOCALE);
+                freelocale (locale);
+              }
+          }
+      }
+  }
+
+  /* Check that gl_locale_name_thread returns a string that is allocated with
+     indefinite extent.  */
+  {
+    /* Try many locale names in turn, in order to defeat possible caches.  */
+    static const char * const choices[] =
+      {
+        "C",
+        "POSIX",
+        "af_ZA",
+        "af_ZA.UTF-8",
+        "am_ET",
+        "am_ET.UTF-8",
+        "be_BY",
+        "be_BY.UTF-8",
+        "bg_BG",
+        "bg_BG.UTF-8",
+        "ca_ES",
+        "ca_ES.UTF-8",
+        "cs_CZ",
+        "cs_CZ.UTF-8",
+        "da_DK",
+        "da_DK.UTF-8",
+        "de_AT",
+        "de_AT.UTF-8",
+        "de_CH",
+        "de_CH.UTF-8",
+        "de_DE",
+        "de_DE.UTF-8",
+        "el_GR",
+        "el_GR.UTF-8",
+        "en_AU",
+        "en_AU.UTF-8",
+        "en_CA",
+        "en_CA.UTF-8",
+        "en_GB",
+        "en_GB.UTF-8",
+        "en_IE",
+        "en_IE.UTF-8",
+        "en_NZ",
+        "en_NZ.UTF-8",
+        "en_US",
+        "en_US.UTF-8",
+        "es_ES",
+        "es_ES.UTF-8",
+        "et_EE",
+        "et_EE.UTF-8",
+        "eu_ES",
+        "eu_ES.UTF-8",
+        "fi_FI",
+        "fi_FI.UTF-8",
+        "fr_BE",
+        "fr_BE.UTF-8",
+        "fr_CA",
+        "fr_CA.UTF-8",
+        "fr_CH",
+        "fr_CH.UTF-8",
+        "fr_FR",
+        "fr_FR.UTF-8",
+        "he_IL",
+        "he_IL.UTF-8",
+        "hr_HR",
+        "hr_HR.UTF-8",
+        "hu_HU",
+        "hu_HU.UTF-8",
+        "hy_AM",
+        "is_IS",
+        "is_IS.UTF-8",
+        "it_CH",
+        "it_CH.UTF-8",
+        "it_IT",
+        "it_IT.UTF-8",
+        "ja_JP.UTF-8",
+        "kk_KZ",
+        "kk_KZ.UTF-8",
+        "ko_KR.UTF-8",
+        "lt_LT",
+        "lt_LT.UTF-8",
+        "nl_BE",
+        "nl_BE.UTF-8",
+        "nl_NL",
+        "nl_NL.UTF-8",
+        "no_NO",
+        "no_NO.UTF-8",
+        "pl_PL",
+        "pl_PL.UTF-8",
+        "pt_BR",
+        "pt_BR.UTF-8",
+        "pt_PT",
+        "pt_PT.UTF-8",
+        "ro_RO",
+        "ro_RO.UTF-8",
+        "ru_RU",
+        "ru_RU.UTF-8",
+        "sk_SK",
+        "sk_SK.UTF-8",
+        "sl_SI",
+        "sl_SI.UTF-8",
+        "sv_SE",
+        "sv_SE.UTF-8",
+        "tr_TR",
+        "tr_TR.UTF-8",
+        "uk_UA",
+        "uk_UA.UTF-8",
+        "zh_CN",
+        "zh_CN.UTF-8",
+        "zh_HK",
+        "zh_HK.UTF-8",
+        "zh_TW",
+        "zh_TW.UTF-8"
+      };
+    /* Remember which locales are available.  */
+    unsigned char /* bool */ available[SIZEOF (choices)];
+    /* Array of remembered results of gl_locale_name_thread.  */
+    const char *unsaved_names[SIZEOF (choices)][SIZEOF (categories)];
+    /* Array of remembered results of gl_locale_name_thread, stored in safe
+       memory.  */
+    char *saved_names[SIZEOF (choices)][SIZEOF (categories)];
+    unsigned int j;
+
+    for (j = 0; j < SIZEOF (choices); j++)
+      {
+        locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL);
+        available[j] = (locale != NULL);
+        if (locale != NULL)
+          {
+            unsigned int i;
+
+            uselocale (locale);
+            for (i = 0; i < SIZEOF (categories); i++)
+              {
+                unsaved_names[j][i] = gl_locale_name_thread (categories[i].cat, categories[i].string);
+                saved_names[j][i] = strdup (unsaved_names[j][i]);
+              }
+            uselocale (LC_GLOBAL_LOCALE);
+            freelocale (locale);
+          }
+      }
+    /* Verify the unsaved_names are still valid.  */
+    for (j = 0; j < SIZEOF (choices); j++)
+      if (available[j])
+        {
+          unsigned int i;
+
+          for (i = 0; i < SIZEOF (categories); i++)
+            ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
+        }
+    /* Allocate many locales, without freeing them.  This is an attempt at
+       overwriting as much of the previously allocated memory as possible.  */
+    for (j = SIZEOF (choices); j > 0; )
+      {
+        j--;
+        if (available[j])
+          {
+            locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL);
+            unsigned int i;
+
+            ASSERT (locale != NULL);
+            uselocale (locale);
+            for (i = 0; i < SIZEOF (categories); i++)
+              {
+                const char *name = gl_locale_name_thread (categories[i].cat, categories[i].string);
+                ASSERT (strcmp (unsaved_names[j][i], name) == 0);
+              }
+            uselocale (LC_GLOBAL_LOCALE);
+            freelocale (locale);
+          }
+      }
+    /* Verify the unsaved_names are still valid.  */
+    for (j = 0; j < SIZEOF (choices); j++)
+      if (available[j])
+        {
+          unsigned int i;
+
+          for (i = 0; i < SIZEOF (categories); i++)
+            {
+              ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
+              free (saved_names[j][i]);
+            }
+        }
+  }
+#else
+  /* Check that gl_locale_name_thread always returns NULL.  */
+  ASSERT (gl_locale_name_thread (LC_CTYPE, "LC_CTYPE") == NULL);
+  ASSERT (gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES") == NULL);
+#endif
+}
+
+/* Test the gl_locale_name_posix() function.  */
+static void
+test_locale_name_posix (void)
+{
+  const char *ret;
+  const char *name;
+
+  /* Get into a defined state,  */
+  setlocale (LC_ALL, "en_US.UTF-8");
+#if HAVE_GOOD_USELOCALE
+  uselocale (LC_GLOBAL_LOCALE);
+#endif
+
+  /* Check that when all environment variables are unset,
+     gl_locale_name_posix returns either NULL or the default locale.  */
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LC_NUMERIC");
+  unsetenv ("LANG");
+  /* Need also to unset all environment variables that specify standard or
+     non-standard locale categories.  Otherwise, on glibc systems, when some
+     of these variables are set and reference a nonexistent locale, the
+     setlocale (LC_ALL, "") call below would fail.  */
+  unsetenv ("LC_COLLATE");
+  unsetenv ("LC_MONETARY");
+  unsetenv ("LC_TIME");
+  unsetenv ("LC_ADDRESS");
+  unsetenv ("LC_IDENTIFICATION");
+  unsetenv ("LC_MEASUREMENT");
+  unsetenv ("LC_NAME");
+  unsetenv ("LC_PAPER");
+  unsetenv ("LC_TELEPHONE");
+  ret = setlocale (LC_ALL, "");
+  ASSERT (ret != NULL);
+  name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0);
+  name = gl_locale_name_posix (LC_NUMERIC, "LC_NUMERIC");
+  ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0);
+
+  /* Check that an empty environment variable is treated like an unset
+     environment variable.  */
+
+  setenv ("LC_ALL", "", 1);
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0);
+
+  unsetenv ("LC_ALL");
+  setenv ("LC_CTYPE", "", 1);
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  setenv ("LC_MESSAGES", "", 1);
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  setenv ("LANG", "", 1);
+  setlocale (LC_ALL, "");
+  name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0);
+
+  /* Check that LC_ALL overrides the others, and LANG is overridden by the
+     others.  */
+
+  setenv ("LC_ALL", "C", 1);
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (strcmp (name, "C") == 0);
+
+  unsetenv ("LC_ALL");
+  setenv ("LC_CTYPE", "C", 1);
+  setenv ("LC_MESSAGES", "C", 1);
+  unsetenv ("LANG");
+  setlocale (LC_ALL, "");
+  name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (strcmp (name, "C") == 0);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  setenv ("LANG", "C", 1);
+  setlocale (LC_ALL, "");
+  name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (strcmp (name, "C") == 0);
+
+  /* Check mixed situations.  */
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1);
+  setenv ("LANG", "de_DE.UTF-8", 1);
+  if (setlocale (LC_ALL, "") != NULL)
+    {
+      name = gl_locale_name_posix (LC_CTYPE, "LC_CTYPE");
+#if defined _WIN32 && !defined __CYGWIN__
+      ASSERT (strcmp (name, "de_DE") == 0 || strcmp (name, "de_DE.UTF-8") == 0);
+#else
+      ASSERT (strcmp (name, "de_DE.UTF-8") == 0);
+#endif
+      name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+      ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+    }
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1);
+  unsetenv ("LANG");
+  if (setlocale (LC_ALL, "") != NULL)
+    {
+      name = gl_locale_name_posix (LC_CTYPE, "LC_CTYPE");
+      ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0);
+      name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+      ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+    }
+
+#if HAVE_GOOD_USELOCALE
+  /* Check that gl_locale_name_posix ignores the thread locale.  */
+  {
+    locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+    if (locale != NULL)
+      {
+        unsetenv ("LC_ALL");
+        unsetenv ("LC_CTYPE");
+        unsetenv ("LC_MESSAGES");
+        setenv ("LANG", "C", 1);
+        setlocale (LC_ALL, "");
+        uselocale (locale);
+        name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
+        ASSERT (strcmp (name, "C") == 0);
+        uselocale (LC_GLOBAL_LOCALE);
+        freelocale (locale);
+      }
+  }
+#endif
+}
+
+/* Test the gl_locale_name_environ() function.  */
+static void
+test_locale_name_environ (void)
+{
+  const char *name;
+
+  /* Get into a defined state,  */
+  setlocale (LC_ALL, "en_US.UTF-8");
+#if HAVE_GOOD_USELOCALE
+  uselocale (LC_GLOBAL_LOCALE);
+#endif
+
+  /* Check that when all environment variables are unset,
+     gl_locale_name_environ returns NULL.  */
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LC_NUMERIC");
+  unsetenv ("LANG");
+  ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL);
+  ASSERT (gl_locale_name_environ (LC_NUMERIC, "LC_NUMERIC") == NULL);
+
+  /* Check that an empty environment variable is treated like an unset
+     environment variable.  */
+
+  setenv ("LC_ALL", "", 1);
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LANG");
+  ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL);
+
+  unsetenv ("LC_ALL");
+  setenv ("LC_CTYPE", "", 1);
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LANG");
+  ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  setenv ("LC_MESSAGES", "", 1);
+  unsetenv ("LANG");
+  ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  setenv ("LANG", "", 1);
+  ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL);
+
+  /* Check that LC_ALL overrides the others, and LANG is overridden by the
+     others.  */
+
+  setenv ("LC_ALL", "C", 1);
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  unsetenv ("LANG");
+  name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (strcmp (name, "C") == 0);
+
+  unsetenv ("LC_ALL");
+  setenv ("LC_CTYPE", "C", 1);
+  setenv ("LC_MESSAGES", "C", 1);
+  unsetenv ("LANG");
+  name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (strcmp (name, "C") == 0);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  unsetenv ("LC_MESSAGES");
+  setenv ("LANG", "C", 1);
+  name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (strcmp (name, "C") == 0);
+
+  /* Check mixed situations.  */
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1);
+  setenv ("LANG", "de_DE.UTF-8", 1);
+  name = gl_locale_name_environ (LC_CTYPE, "LC_CTYPE");
+  ASSERT (strcmp (name, "de_DE.UTF-8") == 0);
+  name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+
+  unsetenv ("LC_ALL");
+  unsetenv ("LC_CTYPE");
+  setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1);
+  unsetenv ("LANG");
+  name = gl_locale_name_environ (LC_CTYPE, "LC_CTYPE");
+  ASSERT (name == NULL);
+  name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES");
+  ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+
+#if HAVE_GOOD_USELOCALE
+  /* Check that gl_locale_name_environ ignores the thread locale.  */
+  {
+    locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+    if (locale != NULL)
+      {
+        unsetenv ("LC_ALL");
+        unsetenv ("LC_CTYPE");
+        unsetenv ("LC_MESSAGES");
+        setenv ("LANG", "C", 1);
+        setlocale (LC_ALL, "");
+        uselocale (locale);
+        name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES");
+        ASSERT (strcmp (name, "C") == 0);
+        uselocale (LC_GLOBAL_LOCALE);
+        freelocale (locale);
+      }
+  }
+#endif
+}
+
+/* Test the gl_locale_name_default() function.  */
+static void
+test_locale_name_default (void)
+{
+  const char *name = gl_locale_name_default ();
+
+  ASSERT (name != NULL);
+
+  /* Only Mac OS X and Windows have a facility for the user to set the default
+     locale.  */
+#if !((defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __CYGWIN__))
+  ASSERT (strcmp (name, "C") == 0);
+#endif
+
+#if HAVE_GOOD_USELOCALE
+  /* Check that gl_locale_name_default ignores the thread locale.  */
+  {
+    locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+    if (locale != NULL)
+      {
+        uselocale (locale);
+        ASSERT (strcmp (gl_locale_name_default (), name) == 0);
+        uselocale (LC_GLOBAL_LOCALE);
+        freelocale (locale);
+      }
+  }
+#endif
+}
+
+int
+main ()
+{
+  test_locale_name ();
+  test_locale_name_thread ();
+  test_locale_name_posix ();
+  test_locale_name_environ ();
+  test_locale_name_default ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 9e1b7462b9051d56970573d42bbfc32ca0c23e33..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-lock.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b5a5240f30656c356ac5835c136dc6aff5ff0515
--- /dev/null
@@ -0,0 +1,618 @@
+/* Test of locking in multithreaded situations.
+   Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
+#if USE_ISOC_THREADS
+# define TEST_ISOC_THREADS 1
+#endif
+#if USE_POSIX_THREADS
+# define TEST_POSIX_THREADS 1
+#endif
+#if USE_ISOC_AND_POSIX_THREADS
+# define TEST_ISOC_AND_POSIX_THREADS 1
+#endif
+#if USE_WINDOWS_THREADS
+# define TEST_WINDOWS_THREADS 1
+#endif
+
+/* Whether to enable locking.
+   Uncomment this to get a test program without locking, to verify that
+   it crashes.  */
+#define ENABLE_LOCKING 1
+
+/* Which tests to perform.
+   Uncomment some of these, to verify that all tests crash if no locking
+   is enabled.  */
+#define DO_TEST_LOCK 1
+#define DO_TEST_RWLOCK 1
+#define DO_TEST_RECURSIVE_LOCK 1
+#define DO_TEST_ONCE 1
+
+/* Whether to help the scheduler through explicit yield().
+   Uncomment this to see if the operating system has a fair scheduler.  */
+#define EXPLICIT_YIELD 1
+
+/* Whether to print debugging messages.  */
+#define ENABLE_DEBUGGING 0
+
+/* Number of simultaneous threads.  */
+#define THREAD_COUNT 10
+
+/* Number of operations performed in each thread.
+   This is quite high, because with a smaller count, say 5000, we often get
+   an "OK" result even without ENABLE_LOCKING (on Linux/x86).  */
+#define REPEAT_COUNT 50000
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !ENABLE_LOCKING
+# undef USE_ISOC_THREADS
+# undef USE_POSIX_THREADS
+# undef USE_ISOC_AND_POSIX_THREADS
+# undef USE_WINDOWS_THREADS
+#endif
+#include "glthread/lock.h"
+
+#if !ENABLE_LOCKING
+# if TEST_ISOC_THREADS
+#  define USE_ISOC_THREADS 1
+# endif
+# if TEST_POSIX_THREADS
+#  define USE_POSIX_THREADS 1
+# endif
+# if TEST_ISOC_AND_POSIX_THREADS
+#  define USE_ISOC_AND_POSIX_THREADS 1
+# endif
+# if TEST_WINDOWS_THREADS
+#  define USE_WINDOWS_THREADS 1
+# endif
+#endif
+
+#include "glthread/thread.h"
+#include "glthread/yield.h"
+
+#if HAVE_DECL_ALARM
+# include <signal.h>
+# include <unistd.h>
+#endif
+
+#include "atomic-int-gnulib.h"
+
+#if ENABLE_DEBUGGING
+# define dbgprintf printf
+#else
+# define dbgprintf if (0) printf
+#endif
+
+#if EXPLICIT_YIELD
+# define yield() gl_thread_yield ()
+#else
+# define yield()
+#endif
+
+#define ACCOUNT_COUNT 4
+
+static int account[ACCOUNT_COUNT];
+
+static int
+random_account (void)
+{
+  return ((unsigned long) random () >> 3) % ACCOUNT_COUNT;
+}
+
+static void
+check_accounts (void)
+{
+  int i, sum;
+
+  sum = 0;
+  for (i = 0; i < ACCOUNT_COUNT; i++)
+    sum += account[i];
+  if (sum != ACCOUNT_COUNT * 1000)
+    abort ();
+}
+
+
+/* ------------------- Test normal (non-recursive) locks ------------------- */
+
+/* Test normal locks by having several bank accounts and several threads
+   which shuffle around money between the accounts and another thread
+   checking that all the money is still there.  */
+
+gl_lock_define_initialized(static, my_lock)
+
+static void *
+lock_mutator_thread (_GL_UNUSED void *arg)
+{
+  int repeat;
+
+  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+    {
+      int i1, i2, value;
+
+      dbgprintf ("Mutator %p before lock\n", gl_thread_self_pointer ());
+      gl_lock_lock (my_lock);
+      dbgprintf ("Mutator %p after  lock\n", gl_thread_self_pointer ());
+
+      i1 = random_account ();
+      i2 = random_account ();
+      value = ((unsigned long) random () >> 3) % 10;
+      account[i1] += value;
+      account[i2] -= value;
+
+      dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ());
+      gl_lock_unlock (my_lock);
+      dbgprintf ("Mutator %p after  unlock\n", gl_thread_self_pointer ());
+
+      dbgprintf ("Mutator %p before check lock\n", gl_thread_self_pointer ());
+      gl_lock_lock (my_lock);
+      check_accounts ();
+      gl_lock_unlock (my_lock);
+      dbgprintf ("Mutator %p after  check unlock\n", gl_thread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Mutator %p dying.\n", gl_thread_self_pointer ());
+  return NULL;
+}
+
+static struct atomic_int lock_checker_done;
+
+static void *
+lock_checker_thread (_GL_UNUSED void *arg)
+{
+  while (get_atomic_int_value (&lock_checker_done) == 0)
+    {
+      dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
+      gl_lock_lock (my_lock);
+      check_accounts ();
+      gl_lock_unlock (my_lock);
+      dbgprintf ("Checker %p after  check unlock\n", gl_thread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Checker %p dying.\n", gl_thread_self_pointer ());
+  return NULL;
+}
+
+static void
+test_lock (void)
+{
+  int i;
+  gl_thread_t checkerthread;
+  gl_thread_t threads[THREAD_COUNT];
+
+  /* Initialization.  */
+  for (i = 0; i < ACCOUNT_COUNT; i++)
+    account[i] = 1000;
+  init_atomic_int (&lock_checker_done);
+  set_atomic_int_value (&lock_checker_done, 0);
+
+  /* Spawn the threads.  */
+  checkerthread = gl_thread_create (lock_checker_thread, NULL);
+  for (i = 0; i < THREAD_COUNT; i++)
+    threads[i] = gl_thread_create (lock_mutator_thread, NULL);
+
+  /* Wait for the threads to terminate.  */
+  for (i = 0; i < THREAD_COUNT; i++)
+    gl_thread_join (threads[i], NULL);
+  set_atomic_int_value (&lock_checker_done, 1);
+  gl_thread_join (checkerthread, NULL);
+  check_accounts ();
+}
+
+
+/* ----------------- Test read-write (non-recursive) locks ----------------- */
+
+/* Test read-write locks by having several bank accounts and several threads
+   which shuffle around money between the accounts and several other threads
+   that check that all the money is still there.  */
+
+gl_rwlock_define_initialized(static, my_rwlock)
+
+static void *
+rwlock_mutator_thread (_GL_UNUSED void *arg)
+{
+  int repeat;
+
+  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+    {
+      int i1, i2, value;
+
+      dbgprintf ("Mutator %p before wrlock\n", gl_thread_self_pointer ());
+      gl_rwlock_wrlock (my_rwlock);
+      dbgprintf ("Mutator %p after  wrlock\n", gl_thread_self_pointer ());
+
+      i1 = random_account ();
+      i2 = random_account ();
+      value = ((unsigned long) random () >> 3) % 10;
+      account[i1] += value;
+      account[i2] -= value;
+
+      dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ());
+      gl_rwlock_unlock (my_rwlock);
+      dbgprintf ("Mutator %p after  unlock\n", gl_thread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Mutator %p dying.\n", gl_thread_self_pointer ());
+  return NULL;
+}
+
+static struct atomic_int rwlock_checker_done;
+
+static void *
+rwlock_checker_thread (_GL_UNUSED void *arg)
+{
+  while (get_atomic_int_value (&rwlock_checker_done) == 0)
+    {
+      dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ());
+      gl_rwlock_rdlock (my_rwlock);
+      check_accounts ();
+      gl_rwlock_unlock (my_rwlock);
+      dbgprintf ("Checker %p after  check unlock\n", gl_thread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Checker %p dying.\n", gl_thread_self_pointer ());
+  return NULL;
+}
+
+static void
+test_rwlock (void)
+{
+  int i;
+  gl_thread_t checkerthreads[THREAD_COUNT];
+  gl_thread_t threads[THREAD_COUNT];
+
+  /* Initialization.  */
+  for (i = 0; i < ACCOUNT_COUNT; i++)
+    account[i] = 1000;
+  init_atomic_int (&rwlock_checker_done);
+  set_atomic_int_value (&rwlock_checker_done, 0);
+
+  /* Spawn the threads.  */
+  for (i = 0; i < THREAD_COUNT; i++)
+    checkerthreads[i] = gl_thread_create (rwlock_checker_thread, NULL);
+  for (i = 0; i < THREAD_COUNT; i++)
+    threads[i] = gl_thread_create (rwlock_mutator_thread, NULL);
+
+  /* Wait for the threads to terminate.  */
+  for (i = 0; i < THREAD_COUNT; i++)
+    gl_thread_join (threads[i], NULL);
+  set_atomic_int_value (&rwlock_checker_done, 1);
+  for (i = 0; i < THREAD_COUNT; i++)
+    gl_thread_join (checkerthreads[i], NULL);
+  check_accounts ();
+}
+
+
+/* -------------------------- Test recursive locks -------------------------- */
+
+/* Test recursive locks by having several bank accounts and several threads
+   which shuffle around money between the accounts (recursively) and another
+   thread checking that all the money is still there.  */
+
+gl_recursive_lock_define_initialized(static, my_reclock)
+
+static void
+recshuffle (void)
+{
+  int i1, i2, value;
+
+  dbgprintf ("Mutator %p before lock\n", gl_thread_self_pointer ());
+  gl_recursive_lock_lock (my_reclock);
+  dbgprintf ("Mutator %p after  lock\n", gl_thread_self_pointer ());
+
+  i1 = random_account ();
+  i2 = random_account ();
+  value = ((unsigned long) random () >> 3) % 10;
+  account[i1] += value;
+  account[i2] -= value;
+
+  /* Recursive with probability 0.5.  */
+  if (((unsigned long) random () >> 3) % 2)
+    recshuffle ();
+
+  dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ());
+  gl_recursive_lock_unlock (my_reclock);
+  dbgprintf ("Mutator %p after  unlock\n", gl_thread_self_pointer ());
+}
+
+static void *
+reclock_mutator_thread (_GL_UNUSED void *arg)
+{
+  int repeat;
+
+  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+    {
+      recshuffle ();
+
+      dbgprintf ("Mutator %p before check lock\n", gl_thread_self_pointer ());
+      gl_recursive_lock_lock (my_reclock);
+      check_accounts ();
+      gl_recursive_lock_unlock (my_reclock);
+      dbgprintf ("Mutator %p after  check unlock\n", gl_thread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Mutator %p dying.\n", gl_thread_self_pointer ());
+  return NULL;
+}
+
+static struct atomic_int reclock_checker_done;
+
+static void *
+reclock_checker_thread (_GL_UNUSED void *arg)
+{
+  while (get_atomic_int_value (&reclock_checker_done) == 0)
+    {
+      dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
+      gl_recursive_lock_lock (my_reclock);
+      check_accounts ();
+      gl_recursive_lock_unlock (my_reclock);
+      dbgprintf ("Checker %p after  check unlock\n", gl_thread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Checker %p dying.\n", gl_thread_self_pointer ());
+  return NULL;
+}
+
+static void
+test_recursive_lock (void)
+{
+  int i;
+  gl_thread_t checkerthread;
+  gl_thread_t threads[THREAD_COUNT];
+
+  /* Initialization.  */
+  for (i = 0; i < ACCOUNT_COUNT; i++)
+    account[i] = 1000;
+  init_atomic_int (&reclock_checker_done);
+  set_atomic_int_value (&reclock_checker_done, 0);
+
+  /* Spawn the threads.  */
+  checkerthread = gl_thread_create (reclock_checker_thread, NULL);
+  for (i = 0; i < THREAD_COUNT; i++)
+    threads[i] = gl_thread_create (reclock_mutator_thread, NULL);
+
+  /* Wait for the threads to terminate.  */
+  for (i = 0; i < THREAD_COUNT; i++)
+    gl_thread_join (threads[i], NULL);
+  set_atomic_int_value (&reclock_checker_done, 1);
+  gl_thread_join (checkerthread, NULL);
+  check_accounts ();
+}
+
+
+/* ------------------------ Test once-only execution ------------------------ */
+
+/* Test once-only execution by having several threads attempt to grab a
+   once-only task simultaneously (triggered by releasing a read-write lock).  */
+
+gl_once_define(static, fresh_once)
+static int ready[THREAD_COUNT];
+static gl_lock_t ready_lock[THREAD_COUNT];
+#if ENABLE_LOCKING
+static gl_rwlock_t fire_signal[REPEAT_COUNT];
+#else
+static volatile int fire_signal_state;
+#endif
+static gl_once_t once_control;
+static int performed;
+gl_lock_define_initialized(static, performed_lock)
+
+static void
+once_execute (void)
+{
+  gl_lock_lock (performed_lock);
+  performed++;
+  gl_lock_unlock (performed_lock);
+}
+
+static void *
+once_contender_thread (void *arg)
+{
+  int id = (int) (intptr_t) arg;
+  int repeat;
+
+  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
+    {
+      /* Tell the main thread that we're ready.  */
+      gl_lock_lock (ready_lock[id]);
+      ready[id] = 1;
+      gl_lock_unlock (ready_lock[id]);
+
+      if (repeat == REPEAT_COUNT)
+        break;
+
+      dbgprintf ("Contender %p waiting for signal for round %d\n",
+                 gl_thread_self_pointer (), repeat);
+#if ENABLE_LOCKING
+      /* Wait for the signal to go.  */
+      gl_rwlock_rdlock (fire_signal[repeat]);
+      /* And don't hinder the others (if the scheduler is unfair).  */
+      gl_rwlock_unlock (fire_signal[repeat]);
+#else
+      /* Wait for the signal to go.  */
+      while (fire_signal_state <= repeat)
+        yield ();
+#endif
+      dbgprintf ("Contender %p got the     signal for round %d\n",
+                 gl_thread_self_pointer (), repeat);
+
+      /* Contend for execution.  */
+      gl_once (once_control, once_execute);
+    }
+
+  return NULL;
+}
+
+static void
+test_once (void)
+{
+  int i, repeat;
+  gl_thread_t threads[THREAD_COUNT];
+
+  /* Initialize all variables.  */
+  for (i = 0; i < THREAD_COUNT; i++)
+    {
+      ready[i] = 0;
+      gl_lock_init (ready_lock[i]);
+    }
+#if ENABLE_LOCKING
+  for (i = 0; i < REPEAT_COUNT; i++)
+    gl_rwlock_init (fire_signal[i]);
+#else
+  fire_signal_state = 0;
+#endif
+
+#if ENABLE_LOCKING
+  /* Block all fire_signals.  */
+  for (i = REPEAT_COUNT-1; i >= 0; i--)
+    gl_rwlock_wrlock (fire_signal[i]);
+#endif
+
+  /* Spawn the threads.  */
+  for (i = 0; i < THREAD_COUNT; i++)
+    threads[i] =
+      gl_thread_create (once_contender_thread, (void *) (intptr_t) i);
+
+  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
+    {
+      /* Wait until every thread is ready.  */
+      dbgprintf ("Main thread before synchronizing for round %d\n", repeat);
+      for (;;)
+        {
+          int ready_count = 0;
+          for (i = 0; i < THREAD_COUNT; i++)
+            {
+              gl_lock_lock (ready_lock[i]);
+              ready_count += ready[i];
+              gl_lock_unlock (ready_lock[i]);
+            }
+          if (ready_count == THREAD_COUNT)
+            break;
+          yield ();
+        }
+      dbgprintf ("Main thread after  synchronizing for round %d\n", repeat);
+
+      if (repeat > 0)
+        {
+          /* Check that exactly one thread executed the once_execute()
+             function.  */
+          if (performed != 1)
+            abort ();
+        }
+
+      if (repeat == REPEAT_COUNT)
+        break;
+
+      /* Preparation for the next round: Initialize once_control.  */
+      memcpy (&once_control, &fresh_once, sizeof (gl_once_t));
+
+      /* Preparation for the next round: Reset the performed counter.  */
+      performed = 0;
+
+      /* Preparation for the next round: Reset the ready flags.  */
+      for (i = 0; i < THREAD_COUNT; i++)
+        {
+          gl_lock_lock (ready_lock[i]);
+          ready[i] = 0;
+          gl_lock_unlock (ready_lock[i]);
+        }
+
+      /* Signal all threads simultaneously.  */
+      dbgprintf ("Main thread giving signal for round %d\n", repeat);
+#if ENABLE_LOCKING
+      gl_rwlock_unlock (fire_signal[repeat]);
+#else
+      fire_signal_state = repeat + 1;
+#endif
+    }
+
+  /* Wait for the threads to terminate.  */
+  for (i = 0; i < THREAD_COUNT; i++)
+    gl_thread_join (threads[i], NULL);
+}
+
+
+/* -------------------------------------------------------------------------- */
+
+int
+main ()
+{
+#if HAVE_DECL_ALARM
+  /* Declare failure if test takes too long, by using default abort
+     caused by SIGALRM.  */
+  int alarm_value = 600;
+  signal (SIGALRM, SIG_DFL);
+  alarm (alarm_value);
+#endif
+
+#if DO_TEST_LOCK
+  printf ("Starting test_lock ..."); fflush (stdout);
+  test_lock ();
+  printf (" OK\n"); fflush (stdout);
+#endif
+#if DO_TEST_RWLOCK
+  printf ("Starting test_rwlock ..."); fflush (stdout);
+  test_rwlock ();
+  printf (" OK\n"); fflush (stdout);
+#endif
+#if DO_TEST_RECURSIVE_LOCK
+  printf ("Starting test_recursive_lock ..."); fflush (stdout);
+  test_recursive_lock ();
+  printf (" OK\n"); fflush (stdout);
+#endif
+#if DO_TEST_ONCE
+  printf ("Starting test_once ..."); fflush (stdout);
+  test_once ();
+  printf (" OK\n"); fflush (stdout);
+#endif
+
+  return 0;
+}
+
+#else
+
+/* No multithreading available.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 56a9bf1a17e3ef435b2f37e381ae1bc12cdc6044..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-lseek.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a89523bda2522fa7fce2572ac604a4ed0b48a813
--- /dev/null
@@ -0,0 +1,109 @@
+/* Test of lseek() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake, 2007.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (lseek, off_t, (int, off_t, int));
+
+#include <errno.h>
+
+#include "macros.h"
+
+/* ARGC must be 2; *ARGV[1] is '0' if stdin and stdout are files, '1'
+   if they are pipes, and '2' if they are closed.  Check for proper
+   semantics of lseek.  */
+int
+main (int argc, char **argv)
+{
+  if (argc != 2)
+    return 2;
+  switch (*argv[1])
+    {
+    case '0': /* regular files */
+      ASSERT (lseek (0, (off_t)2, SEEK_SET) == 2);
+      ASSERT (lseek (0, (off_t)-4, SEEK_CUR) == -1);
+      ASSERT (errno == EINVAL);
+      errno = 0;
+#if ! defined __BEOS__
+      /* POSIX says that the last lseek call, when failing, does not change
+         the current offset.  But BeOS sets it to 0.  */
+      ASSERT (lseek (0, (off_t)0, SEEK_CUR) == 2);
+#endif
+#if 0 /* leads to SIGSYS on IRIX 6.5 */
+      ASSERT (lseek (0, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1);
+      ASSERT (errno == EINVAL);
+#endif
+      ASSERT (lseek (1, (off_t)2, SEEK_SET) == 2);
+      errno = 0;
+      ASSERT (lseek (1, (off_t)-4, SEEK_CUR) == -1);
+      ASSERT (errno == EINVAL);
+      errno = 0;
+#if ! defined __BEOS__
+      /* POSIX says that the last lseek call, when failing, does not change
+         the current offset.  But BeOS sets it to 0.  */
+      ASSERT (lseek (1, (off_t)0, SEEK_CUR) == 2);
+#endif
+#if 0 /* leads to SIGSYS on IRIX 6.5 */
+      ASSERT (lseek (1, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1);
+      ASSERT (errno == EINVAL);
+#endif
+      break;
+
+    case '1': /* pipes */
+      errno = 0;
+      ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1);
+      ASSERT (errno == ESPIPE);
+      errno = 0;
+      ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1);
+      ASSERT (errno == ESPIPE);
+      break;
+
+    case '2': /* closed */
+      /* Explicitly close file descriptors 0 and 1.  The <&- and >&- in the
+         invoking shell are not enough on HP-UX.  */
+      close (0);
+      close (1);
+
+      errno = 0;
+      ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1);
+      ASSERT (errno == EBADF);
+
+      errno = 0;
+      ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1);
+      ASSERT (errno == EBADF);
+
+      /* Test behaviour for invalid file descriptors.  */
+      errno = 0;
+      ASSERT (lseek (-1, (off_t)0, SEEK_CUR) == -1);
+      ASSERT (errno == EBADF);
+
+      close (99);
+      errno = 0;
+      ASSERT (lseek (99, (off_t)0, SEEK_CUR) == -1);
+      ASSERT (errno == EBADF);
+
+      break;
+
+    default:
+      return 1;
+    }
+  return 0;
+}
deleted file mode 120000 (symlink)
index a2096f4a922c3618d0c70d367fc37b811cafb7b9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-lseek.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..ff553c93b29e51d784714644c47f7461ec54178f
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+tmpfiles=
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles=t-lseek.tmp
+# seekable files
+${CHECKER} ./test-lseek${EXEEXT} 0 < "$srcdir/test-lseek.sh" > t-lseek.tmp || exit 1
+
+# pipes
+echo hi | { ${CHECKER} ./test-lseek${EXEEXT} 1; echo $? > t-lseek.tmp; cat > /dev/null; } | cat
+test "`cat t-lseek.tmp`" = "0" || exit 1
+
+# closed descriptors
+${CHECKER} ./test-lseek${EXEEXT} 2 <&- >&- || exit 1
+
+rm -rf $tmpfiles
+exit 0
deleted file mode 120000 (symlink)
index 927e7e46b230de100d40f984d7b9125af114f62d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-lstat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3a2d61ec6a606582e72820f3420a3aff68aa492b
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test of lstat() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson, 2008; and Eric Blake, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+/* Caution: lstat may be a function-like macro.  Although this
+   signature check must pass, it may be the signature of the real (and
+   broken) lstat rather than rpl_lstat.  Most code should not use the
+   address of lstat.  */
+#include "signature.h"
+SIGNATURE_CHECK (lstat, int, (char const *, struct stat *));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "same-inode.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-lstat.t"
+
+#include "test-lstat.h"
+
+/* Wrapper around lstat, which works even if lstat is a function-like
+   macro, where test_lstat_func(lstat) would do the wrong thing.  */
+static int
+do_lstat (char const *name, struct stat *st)
+{
+  return lstat (name, st);
+}
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_lstat_func (do_lstat, true);
+}
deleted file mode 120000 (symlink)
index 2c821ae758a98344b1433e8a9b9c4bc4ad490f6c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-lstat.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..31476132d0802add9826a96a6f1722f594ee7028
--- /dev/null
@@ -0,0 +1,122 @@
+/* Test of lstat() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson, 2008; and Eric Blake, 2009.  */
+
+/* This file is designed to test both lstat(n,buf) and
+   fstatat(AT_FDCWD,n,buf,AT_SYMLINK_NOFOLLOW).  FUNC is the function
+   to test.  Assumes that BASE and ASSERT are already defined, and
+   that appropriate headers are already included.  If PRINT, warn
+   before skipping symlink tests with status 77.  */
+
+static int
+test_lstat_func (int (*func) (char const *, struct stat *), bool print)
+{
+  struct stat st1;
+  struct stat st2;
+
+  /* Test for common directories.  */
+  ASSERT (func (".", &st1) == 0);
+  ASSERT (func ("./", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
+  ASSERT (psame_inode (&st1, &st2));
+#endif
+  ASSERT (S_ISDIR (st1.st_mode));
+  ASSERT (S_ISDIR (st2.st_mode));
+  ASSERT (func ("/", &st1) == 0);
+  ASSERT (func ("///", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
+  ASSERT (psame_inode (&st1, &st2));
+#endif
+  ASSERT (S_ISDIR (st1.st_mode));
+  ASSERT (S_ISDIR (st2.st_mode));
+  ASSERT (func ("..", &st1) == 0);
+  ASSERT (S_ISDIR (st1.st_mode));
+
+  /* Test for error conditions.  */
+  errno = 0;
+  ASSERT (func ("", &st1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("nosuch", &st1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("nosuch/", &st1) == -1);
+  ASSERT (errno == ENOENT);
+
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  ASSERT (func (BASE "file", &st1) == 0);
+  ASSERT (S_ISREG (st1.st_mode));
+  errno = 0;
+  ASSERT (func (BASE "file/", &st1) == -1);
+  ASSERT (errno == ENOTDIR);
+
+  /* Now for some symlink tests, where supported.  We set up:
+     link1 -> directory
+     link2 -> file
+     link3 -> dangling
+     link4 -> loop
+     then test behavior both with and without trailing slash.
+  */
+  if (symlink (".", BASE "link1") != 0)
+    {
+      ASSERT (unlink (BASE "file") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  ASSERT (symlink (BASE "file", BASE "link2") == 0);
+  ASSERT (symlink (BASE "nosuch", BASE "link3") == 0);
+  ASSERT (symlink (BASE "link4", BASE "link4") == 0);
+
+  ASSERT (func (BASE "link1", &st1) == 0);
+  ASSERT (S_ISLNK (st1.st_mode));
+  ASSERT (func (BASE "link1/", &st1) == 0);
+  ASSERT (stat (BASE "link1", &st2) == 0);
+  ASSERT (S_ISDIR (st1.st_mode));
+  ASSERT (S_ISDIR (st2.st_mode));
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
+  ASSERT (psame_inode (&st1, &st2));
+#endif
+
+  ASSERT (func (BASE "link2", &st1) == 0);
+  ASSERT (S_ISLNK (st1.st_mode));
+  errno = 0;
+  ASSERT (func (BASE "link2/", &st1) == -1);
+  ASSERT (errno == ENOTDIR);
+
+  ASSERT (func (BASE "link3", &st1) == 0);
+  ASSERT (S_ISLNK (st1.st_mode));
+  errno = 0;
+  ASSERT (func (BASE "link3/", &st1) == -1);
+  ASSERT (errno == ENOENT);
+
+  ASSERT (func (BASE "link4", &st1) == 0);
+  ASSERT (S_ISLNK (st1.st_mode));
+  errno = 0;
+  ASSERT (func (BASE "link4/", &st1) == -1);
+  ASSERT (errno == ELOOP);
+
+  /* Cleanup.  */
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (unlink (BASE "link1") == 0);
+  ASSERT (unlink (BASE "link2") == 0);
+  ASSERT (unlink (BASE "link3") == 0);
+  ASSERT (unlink (BASE "link4") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 62bec1d2b668b2a9c558a1bb6ff64692ecd27b74..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-lutimens.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..385b3c0acc43c912929b5f4b0bc76e8dcd55f2b1
--- /dev/null
@@ -0,0 +1,230 @@
+/* Test of file timestamp modification functions.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-utimens-common.h"
+
+/* This file is designed to test both lutimens(a,b) and
+   utimensat(AT_FDCWD,a,b,AT_SYMLINK_NOFOLLOW).  FUNC is the function
+   to test.  Assumes that BASE and ASSERT are already defined.  If
+   PRINT, warn before skipping tests with status 77.  */
+static int
+test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
+{
+  int result;
+  int saved_errno;
+  struct stat st1;
+  struct stat st2;
+  bool atime_supported = true;
+
+  /* Non-symlinks should be handled just like utimens.  */
+  errno = 0;
+  ASSERT (func ("no_such", NULL) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("no_such/", NULL) == -1);
+  ASSERT (errno == ENOENT || errno == ENOTDIR);
+  errno = 0;
+  ASSERT (func ("", NULL) == -1);
+  ASSERT (errno == ENOENT);
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  ASSERT (stat (BASE "file", &st1) == 0);
+  ASSERT (st1.st_atime != Y2K);
+  ASSERT (st1.st_mtime != Y2K);
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1] = ts[0];
+    errno = 0;
+    ASSERT (func (BASE "file/", ts) == -1);
+    ASSERT (errno == ENOTDIR);
+    ASSERT (stat (BASE "file", &st2) == 0);
+    ASSERT (st1.st_atime == st2.st_atime);
+    ASSERT (st1.st_mtime == st2.st_mtime);
+  }
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1] = ts[0];
+    nap ();
+    ASSERT (func (BASE "file", ts) == 0);
+  }
+  ASSERT (stat (BASE "file", &st2) == 0);
+  ASSERT (st2.st_atime == Y2K);
+  ASSERT (st2.st_mtime == Y2K);
+  if (check_ctime)
+    ASSERT (ctime_compare (&st1, &st2) < 0);
+
+  /* Play with symlink timestamps.  */
+  if (symlink (BASE "file", BASE "link"))
+    {
+      ASSERT (unlink (BASE "file") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  errno = 0;
+  result = func (BASE "link", NULL);
+  saved_errno = errno;
+  /* Make sure we did not reference through link by accident.  */
+  ASSERT (stat (BASE "file", &st1) == 0);
+  ASSERT (st1.st_atime == Y2K);
+  ASSERT (st1.st_mtime == Y2K);
+  ASSERT (lstat (BASE "link", &st1) == 0);
+  ASSERT (st1.st_atime != Y2K);
+  ASSERT (st1.st_mtime != Y2K);
+  ASSERT (unlink (BASE "file") == 0);
+  if (result == -1 && saved_errno == ENOSYS)
+    {
+      ASSERT (unlink (BASE "link") == 0);
+      if (print)
+        fputs ("skipping test: "
+               "setting symlink time not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  ASSERT (!result);
+  ASSERT (lstat (BASE "link", &st1) == 0);
+  /* On cygwin, lstat() changes atime of symlinks, so that lutimens
+     can only effectively modify mtime.  */
+  nap ();
+  ASSERT (lstat (BASE "link", &st2) == 0);
+  if (st1.st_atime != st2.st_atime
+      || get_stat_atime_ns (&st1) != get_stat_atime_ns (&st2))
+    atime_supported = false;
+  ASSERT (st1.st_ctime == st2.st_ctime);
+  ASSERT (get_stat_ctime_ns (&st1) == get_stat_ctime_ns (&st2));
+
+  /* Invalid arguments.  */
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = UTIME_BOGUS_POS;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = 0;
+    errno = 0;
+    ASSERT (func (BASE "link", ts) == -1);
+    ASSERT (errno == EINVAL);
+  }
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = UTIME_BOGUS_NEG;
+    errno = 0;
+    ASSERT (func (BASE "link", ts) == -1);
+    ASSERT (errno == EINVAL);
+  }
+  ASSERT (lstat (BASE "link", &st2) == 0);
+  if (atime_supported)
+    {
+      ASSERT (st1.st_atime == st2.st_atime);
+      ASSERT (get_stat_atime_ns (&st1) == get_stat_atime_ns (&st2));
+    }
+  ASSERT (utimecmp (BASE "link", &st1, &st2, 0) == 0);
+
+  /* Set both times.  */
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = BILLION / 2 - 1;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = BILLION - 1;
+    nap ();
+    ASSERT (func (BASE "link", ts) == 0);
+    ASSERT (lstat (BASE "link", &st2) == 0);
+    if (atime_supported)
+      {
+        ASSERT (st2.st_atime == Y2K);
+        ASSERT (0 <= get_stat_atime_ns (&st2));
+        ASSERT (get_stat_atime_ns (&st2) < BILLION / 2);
+      }
+    ASSERT (st2.st_mtime == Y2K);
+    ASSERT (0 <= get_stat_mtime_ns (&st2));
+    ASSERT (get_stat_mtime_ns (&st2) < BILLION);
+    if (check_ctime)
+      ASSERT (ctime_compare (&st1, &st2) < 0);
+  }
+
+  /* Play with UTIME_OMIT, UTIME_NOW.  */
+  {
+    struct stat st3;
+    struct timespec ts[2];
+    ts[0].tv_sec = BILLION;
+    ts[0].tv_nsec = UTIME_OMIT;
+    ts[1].tv_sec = 0;
+    ts[1].tv_nsec = UTIME_NOW;
+    nap ();
+    ASSERT (func (BASE "link", ts) == 0);
+    ASSERT (lstat (BASE "link", &st3) == 0);
+    if (atime_supported)
+      {
+        ASSERT (st3.st_atime == Y2K);
+        ASSERT (0 <= get_stat_atime_ns (&st3));
+        ASSERT (get_stat_atime_ns (&st3) < BILLION / 2);
+      }
+    ASSERT (utimecmp (BASE "link", &st1, &st3, 0) <= 0);
+    if (check_ctime)
+      ASSERT (ctime_compare (&st2, &st3) < 0);
+    nap ();
+    ts[0].tv_nsec = 0;
+    ts[1].tv_nsec = UTIME_OMIT;
+    ASSERT (func (BASE "link", ts) == 0);
+    ASSERT (lstat (BASE "link", &st2) == 0);
+    if (atime_supported)
+      {
+        ASSERT (st2.st_atime == BILLION);
+        ASSERT (get_stat_atime_ns (&st2) == 0);
+      }
+    ASSERT (st3.st_mtime == st2.st_mtime);
+    ASSERT (get_stat_mtime_ns (&st3) == get_stat_mtime_ns (&st2));
+    if (check_ctime > 0)
+      ASSERT (ctime_compare (&st3, &st2) < 0);
+  }
+
+  /* Symlink to directory.  */
+  ASSERT (unlink (BASE "link") == 0);
+  ASSERT (symlink (BASE "dir", BASE "link") == 0);
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1] = ts[0];
+    ASSERT (func (BASE "link/", ts) == 0);
+  }
+  /* On cygwin 1.5, stat() changes atime of directories, so only check
+     mtime.  */
+  ASSERT (stat (BASE "dir", &st1) == 0);
+  ASSERT (st1.st_mtime == Y2K);
+  ASSERT (lstat (BASE "link", &st1) == 0);
+  ASSERT (st1.st_atime != Y2K);
+  ASSERT (st1.st_mtime != Y2K);
+  ASSERT (func (BASE "link", NULL) == 0);
+  ASSERT (stat (BASE "dir", &st1) == 0);
+  ASSERT (st1.st_mtime == Y2K);
+  ASSERT (lstat (BASE "link", &st1) == 0);
+  ASSERT (st1.st_atime != Y2K);
+  ASSERT (st1.st_mtime != Y2K);
+
+  /* Cleanup.  */
+  ASSERT (rmdir (BASE "dir") == 0);
+  ASSERT (unlink (BASE "link") == 0);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 0cc56ea8b1451031a741b75c8d11b7acc0ffc14d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-malloc-gnu.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..490efb010e8a6780f6e33b9d0789a038dbcd92e3
--- /dev/null
@@ -0,0 +1,45 @@
+/* Test of malloc function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+#include "macros.h"
+
+int
+main (int argc, _GL_UNUSED char **argv)
+{
+  /* Check that malloc (0) is not a NULL pointer.  */
+  void *volatile p = malloc (0);
+  ASSERT (p != NULL);
+  free (p);
+
+  /* Check that malloc (n) fails when n exceeds PTRDIFF_MAX.  */
+  if (PTRDIFF_MAX < SIZE_MAX)
+    {
+      size_t one = argc != 12345;
+      p = malloc (PTRDIFF_MAX + one);
+      ASSERT (p == NULL);
+      ASSERT (errno == ENOMEM);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 36124be22596acfcb82d42f2814cae385523451f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-malloca.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9d46cd424e2fbf2b6d9de8963eac9d8954f5255b
--- /dev/null
@@ -0,0 +1,62 @@
+/* Test of safe automatic memory allocation.
+   Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+#include "malloca.h"
+
+#include <stdlib.h>
+
+static void
+do_allocation (int n)
+{
+  void *volatile ptr = malloca (n);
+  freea (ptr);
+  safe_alloca (n);
+}
+
+void (*func) (int) = do_allocation;
+
+int
+main ()
+{
+  int i;
+
+  /* This slows down malloc a lot.  */
+  unsetenv ("MALLOC_PERTURB_");
+
+  /* Repeat a lot of times, to make sure there's no memory leak.  */
+  for (i = 0; i < 50000; i++)
+    {
+      /* Try various values.
+         n = 0 gave a crash on Alpha with gcc-2.5.8.
+         Some versions of Mac OS X have a stack size limit of 512 KB.  */
+      func (34);
+      func (134);
+      func (399);
+      func (510823);
+      func (129321);
+      func (0);
+      func (4070);
+      func (4095);
+      func (1);
+      func (16582);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5dc57886ce296c1df90d83c062c2aaf83860fab7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-math.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d853f2a8715da47c28a79eea52fd237bba7e2143
--- /dev/null
@@ -0,0 +1,104 @@
+/* Test of <math.h> substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#ifndef NAN
+# error NAN should be defined
+choke me
+#endif
+
+#ifndef HUGE_VALF
+# error HUGE_VALF should be defined
+choke me
+#endif
+
+#ifndef HUGE_VAL
+# error HUGE_VAL should be defined
+choke me
+#endif
+
+#ifndef HUGE_VALL
+# error HUGE_VALL should be defined
+choke me
+#endif
+
+#ifndef FP_ILOGB0
+# error FP_ILOGB0 should be defined
+choke me
+#endif
+
+#ifndef FP_ILOGBNAN
+# error FP_ILOGBNAN should be defined
+choke me
+#endif
+
+#if 0
+/* Check that NAN expands into a constant expression.  */
+static float n = NAN;
+#endif
+
+#include <limits.h>
+
+#include "macros.h"
+
+/* Compare two numbers with ==.
+   This is a separate function because IRIX 6.5 "cc -O" miscompiles an
+   'x == x' test.  */
+static int
+numeric_equalf (float x, float y)
+{
+  return x == y;
+}
+static int
+numeric_equald (double x, double y)
+{
+  return x == y;
+}
+static int
+numeric_equall (long double x, long double y)
+{
+  return x == y;
+}
+
+int
+main (void)
+{
+  double d = NAN;
+  double zero = 0.0;
+  ASSERT (!numeric_equald (d, d));
+
+  d = HUGE_VAL;
+  ASSERT (numeric_equald (d, 1.0 / zero));
+
+  ASSERT (numeric_equalf (HUGE_VALF, HUGE_VALF + HUGE_VALF));
+
+  ASSERT (numeric_equald (HUGE_VAL, HUGE_VAL + HUGE_VAL));
+
+  ASSERT (numeric_equall (HUGE_VALL, HUGE_VALL + HUGE_VALL));
+
+  /* Check the value of FP_ILOGB0.  */
+  ASSERT (FP_ILOGB0 == INT_MIN || FP_ILOGB0 == - INT_MAX);
+
+  /* Check the value of FP_ILOGBNAN.  */
+  ASSERT (FP_ILOGBNAN == INT_MIN || FP_ILOGBNAN == INT_MAX);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 6c2bf1a4a112fbab43d364fe65e919445a907ced..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..8feabf822b5c364a39ceaa3345143df76092888b
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-mbrlen${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mbrlen${EXEEXT} 1 || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index da00e3ed64f6292dbfebd06c53025f78d12d7cec..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..200142d086ebf88241cba123dbe1b96c81b80548
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-mbrlen${EXEEXT} 2
deleted file mode 120000 (symlink)
index 8b88b9c8fc63ccffa752d6b114fdf73b5eb6db1d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..976803ade18ad172f2795de871130229f0320537
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-mbrlen${EXEEXT} 3
deleted file mode 120000 (symlink)
index dfbb155a4d9c4e0b199a8408ca5fa9898f6e04c4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..65ca2ebd2f20983cd5e9c6ca313f358a71a5b0f5
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional japanese locale is installed"
+  else
+    echo "Skipping test: no traditional japanese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_JA \
+${CHECKER} ./test-mbrlen${EXEEXT} 4
deleted file mode 120000 (symlink)
index e41fd0380aa5058a7df7d15c6e422f53b2db6b74..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..d594c66a503a698ef5036b81e0e0789ff8d6ba8e
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no transitional chinese locale is installed"
+  else
+    echo "Skipping test: no transitional chinese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mbrlen${EXEEXT} 5
deleted file mode 120000 (symlink)
index 945b2000d84de3283e3d5d8107194ca9b8c65c17..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-w32-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..ccf4c538cb7cadab7ecf034de416f28ca624d290
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1252 locale.
+${CHECKER} ./test-mbrlen-w32${EXEEXT} French_France 1252
deleted file mode 120000 (symlink)
index 1a1ed68932d6578121497d2af85f38dbab68d088..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-w32-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..22c5388d2a620d74f2ae8424d5cece5152c5fffd
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1256 locale.
+${CHECKER} ./test-mbrlen-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
deleted file mode 120000 (symlink)
index cdcbb186ec5eeef9a27a88673072fae5bc7c383c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-w32-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..dbf82d4abd117cea29ed0fc6fa4976d1beb9dbe9
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test some UTF-8 locales.
+${CHECKER} ./test-mbrlen-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
deleted file mode 120000 (symlink)
index 29a0f4c244f55503242dda0876a41c2b0f3f794c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-w32-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..12c2857b9efe8d84a53208918c003c6649f10281
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP932 locale.
+${CHECKER} ./test-mbrlen-w32${EXEEXT} Japanese_Japan 932
deleted file mode 120000 (symlink)
index 7dad95d13478b201a3eaa6f514f8a3e7b3a7fdbd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-w32-6.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..0746b240e7f1e794a2a63e1ef29a4501e05e387d
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP950 locale.
+${CHECKER} ./test-mbrlen-w32${EXEEXT} Chinese_Taiwan 950
deleted file mode 120000 (symlink)
index f6daff9a76aee8be1a8ab23c2a20b33f44afe579..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-w32-7.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..eb2cec24dfc3db547bc1dce184a04353e508cc10
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP936 locale.
+${CHECKER} ./test-mbrlen-w32${EXEEXT} Chinese_China 936
deleted file mode 120000 (symlink)
index 29bf36c5230edec419c154ea97e638d2d3885104..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-w32-8.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..d586b7dd2a5c90aceb7f89a3e47b14e71d20952e
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a GB18030 locale.
+${CHECKER} ./test-mbrlen-w32${EXEEXT} Chinese_China 54936
deleted file mode 120000 (symlink)
index 8d12b3960fbec9bcb38ef626577f2022d20be69a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen-w32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2fbcab58bd87567d0be151ac7e0c4c5bf931c26f
--- /dev/null
@@ -0,0 +1,565 @@
+/* Test of conversion of multibyte character to wide character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "localcharset.h"
+#include "macros.h"
+
+#if defined _WIN32 && !defined __CYGWIN__
+
+static int
+test_one_locale (const char *name, int codepage)
+{
+  mbstate_t state;
+  size_t ret;
+
+# if 1
+  /* Portable code to set the locale.  */
+  {
+    char name_with_codepage[1024];
+
+    sprintf (name_with_codepage, "%s.%d", name, codepage);
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name_with_codepage) == NULL)
+      return 77;
+  }
+# else
+  /* Hacky way to set a locale.codepage combination that setlocale() refuses
+     to set.  */
+  {
+    /* Codepage of the current locale, set with setlocale().
+       Not necessarily the same as GetACP().  */
+    extern __declspec(dllimport) unsigned int __lc_codepage;
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name) == NULL)
+      return 77;
+
+    /* Clobber the codepage and MB_CUR_MAX, both set by setlocale().  */
+    __lc_codepage = codepage;
+    switch (codepage)
+      {
+      case 1252:
+      case 1256:
+        MB_CUR_MAX = 1;
+        break;
+      case 932:
+      case 950:
+      case 936:
+        MB_CUR_MAX = 2;
+        break;
+      case 54936:
+      case 65001:
+        MB_CUR_MAX = 4;
+        break;
+      }
+
+    /* Test whether the codepage is really available.  */
+    memset (&state, '\0', sizeof (mbstate_t));
+    if (mbrlen (" ", 1, &state) == (size_t)(-1))
+      return 77;
+  }
+# endif
+
+  /* Test zero-length input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    ret = mbrlen ("x", 0, &state);
+    /* gnulib's implementation returns (size_t)(-2).
+       The AIX 5.1 implementation returns (size_t)(-1).
+       glibc's implementation returns 0.  */
+    ASSERT (ret == (size_t)(-2) || ret == (size_t)(-1) || ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test NUL byte input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    ret = mbrlen ("", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test single-byte input.  */
+  {
+    int c;
+    char buf[1];
+
+    memset (&state, '\0', sizeof (mbstate_t));
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = c;
+          ret = mbrlen (buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    ret = mbrlen (NULL, 5, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  switch (codepage)
+    {
+    case 1252:
+      /* Locale encoding is CP1252, an extension of ISO-8859-1.  */
+      {
+        char input[] = "B\374\337er"; /* "Büßer" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        ret = mbrlen (input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        ret = mbrlen (input + 1, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+
+        ret = mbrlen (input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        ret = mbrlen (input + 3, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+
+        ret = mbrlen (input + 4, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+      }
+      return 0;
+
+    case 1256:
+      /* Locale encoding is CP1256, not the same as ISO-8859-6.  */
+      {
+        char input[] = "x\302\341\346y"; /* "xآلوy" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        ret = mbrlen (input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        ret = mbrlen (input + 1, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+
+        ret = mbrlen (input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        ret = mbrlen (input + 3, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+
+        ret = mbrlen (input + 4, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+      }
+      return 0;
+
+    case 65001:
+      /* Locale encoding is CP65001 = UTF-8.  */
+      if (strcmp (locale_charset (), "UTF-8") != 0)
+        return 77;
+      {
+        char input[] = "B\303\274\303\237er"; /* "Büßer" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        ret = mbrlen (input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        ret = mbrlen (input + 1, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (!mbsinit (&state));
+        input[1] = '\0';
+
+        ret = mbrlen (input + 2, 5, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        ret = mbrlen (input + 3, 4, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+        input[4] = '\0';
+
+        ret = mbrlen (input + 5, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+
+        ret = mbrlen (input + 6, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\303\300", 2, &state); /* 0xC3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\343\300", 2, &state); /* 0xE3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\343\300\200", 3, &state); /* 0xE3 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\343\200\300", 3, &state); /* 0xE3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\363\300", 2, &state); /* 0xF3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\363\300\200\200", 4, &state); /* 0xF3 0xC0 0x80 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\363\200\300", 3, &state); /* 0xF3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\363\200\300\200", 4, &state); /* 0xF3 0x80 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\363\200\200\300", 4, &state); /* 0xF3 0x80 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    case 932:
+      /* Locale encoding is CP932, similar to Shift_JIS.  */
+      {
+        char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        ret = mbrlen (input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        ret = mbrlen (input + 1, 2, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+        input[2] = '\0';
+
+        ret = mbrlen (input + 3, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (!mbsinit (&state));
+        input[3] = '\0';
+
+        ret = mbrlen (input + 4, 4, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        ret = mbrlen (input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+
+        ret = mbrlen (input + 7, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\377", 1, &state); /* 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == (size_t)-2);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == 2);
+      }
+      return 0;
+
+    case 950:
+      /* Locale encoding is CP950, similar to Big5.  */
+      {
+        char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        ret = mbrlen (input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        ret = mbrlen (input + 1, 2, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+        input[2] = '\0';
+
+        ret = mbrlen (input + 3, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (!mbsinit (&state));
+        input[3] = '\0';
+
+        ret = mbrlen (input + 4, 4, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        ret = mbrlen (input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+
+        ret = mbrlen (input + 7, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\377", 1, &state); /* 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == (size_t)-2);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == 2);
+      }
+      return 0;
+
+    case 936:
+      /* Locale encoding is CP936 = GBK, an extension of GB2312.  */
+      {
+        char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        ret = mbrlen (input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        ret = mbrlen (input + 1, 2, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+        input[2] = '\0';
+
+        ret = mbrlen (input + 3, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (!mbsinit (&state));
+        input[3] = '\0';
+
+        ret = mbrlen (input + 4, 4, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        ret = mbrlen (input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+
+        ret = mbrlen (input + 7, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\377", 1, &state); /* 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == (size_t)-2);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == 2);
+      }
+      return 0;
+
+    case 54936:
+      /* Locale encoding is CP54936 = GB18030.  */
+      if (strcmp (locale_charset (), "GB18030") != 0)
+        return 77;
+      {
+        char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        ret = mbrlen (input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        ret = mbrlen (input + 1, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (!mbsinit (&state));
+        input[1] = '\0';
+
+        ret = mbrlen (input + 2, 7, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        ret = mbrlen (input + 3, 6, &state);
+        ASSERT (ret == 4);
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+        input[4] = '\0';
+        input[5] = '\0';
+        input[6] = '\0';
+
+        ret = mbrlen (input + 7, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+        input[7] = '\0';
+
+        ret = mbrlen (input + 8, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\201\045", 2, &state); /* 0x81 0x25 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\201\060\377", 3, &state); /* 0x81 0x30 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\201\060\377\064", 4, &state); /* 0x81 0x30 0xFF 0x34 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        ret = mbrlen ("\201\060\211\072", 4, &state); /* 0x81 0x30 0x89 0x3A */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    default:
+      return 1;
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int codepage = atoi (argv[argc - 1]);
+  int result;
+  int i;
+
+  result = 77;
+  for (i = 1; i < argc - 1; i++)
+    {
+      int ret = test_one_locale (argv[i], codepage);
+
+      if (ret != 77)
+        result = ret;
+    }
+
+  if (result == 77)
+    {
+      fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+               codepage);
+    }
+  return result;
+}
+
+#else
+
+int
+main (int argc, char *argv[])
+{
+  fputs ("Skipping test: not a native Windows system\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index a0efd6e6053d4724583d0298a5a825fc8b324a06..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrlen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1947ca9a3000367c0d51d9376ae09bc0cf809c9a
--- /dev/null
@@ -0,0 +1,297 @@
+/* Test of conversion of multibyte character to wide character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mbrlen, size_t, (char const *, size_t, mbstate_t *));
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  mbstate_t state;
+  size_t ret;
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test zero-length input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    ret = mbrlen ("x", 0, &state);
+    ASSERT (ret == (size_t)(-2));
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test NUL byte input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    ret = mbrlen ("", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test single-byte input.  */
+  {
+    int c;
+    char buf[1];
+
+    memset (&state, '\0', sizeof (mbstate_t));
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          ASSERT (c < 0x80);
+          /* c is an ASCII character.  */
+          buf[0] = c;
+
+          ret = mbrlen (buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+
+          break;
+        default:
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    ret = mbrlen (NULL, 5, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+#ifdef __ANDROID__
+  /* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
+     "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
+     locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
+     that is, effectively the "C.UTF-8" locale.  */
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
+#endif
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '1':
+        /* C or POSIX locale.  */
+        {
+          int c;
+          char buf[1];
+
+          memset (&state, '\0', sizeof (mbstate_t));
+          for (c = 0; c < 0x100; c++)
+            if (c != 0)
+              {
+                /* We are testing all nonnull bytes.  */
+                buf[0] = c;
+
+                ret = mbrlen (buf, 1, &state);
+                /* POSIX:2018 says: "In the POSIX locale an [EILSEQ] error
+                   cannot occur since all byte values are valid characters."  */
+                ASSERT (ret == 1);
+                ASSERT (mbsinit (&state));
+              }
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          char input[] = "B\374\337er"; /* "Büßer" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          ret = mbrlen (input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          ret = mbrlen (input + 1, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[1] = '\0';
+
+          ret = mbrlen (input + 2, 3, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[2] = '\0';
+
+          ret = mbrlen (input + 3, 2, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[3] = '\0';
+
+          ret = mbrlen (input + 4, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          char input[] = "B\303\274\303\237er"; /* "Büßer" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          ret = mbrlen (input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          ret = mbrlen (input + 1, 1, &state);
+          ASSERT (ret == (size_t)(-2));
+          ASSERT (!mbsinit (&state));
+          input[1] = '\0';
+
+          ret = mbrlen (input + 2, 5, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[2] = '\0';
+
+          ret = mbrlen (input + 3, 4, &state);
+          ASSERT (ret == 2);
+          ASSERT (mbsinit (&state));
+          input[3] = '\0';
+          input[4] = '\0';
+
+          ret = mbrlen (input + 5, 2, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[5] = '\0';
+
+          ret = mbrlen (input + 6, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is EUC-JP.  */
+        {
+          char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          ret = mbrlen (input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          ret = mbrlen (input + 1, 2, &state);
+          ASSERT (ret == 2);
+          ASSERT (mbsinit (&state));
+          input[1] = '\0';
+          input[2] = '\0';
+
+          ret = mbrlen (input + 3, 1, &state);
+          ASSERT (ret == (size_t)(-2));
+          ASSERT (!mbsinit (&state));
+          input[3] = '\0';
+
+          ret = mbrlen (input + 4, 4, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[4] = '\0';
+
+          ret = mbrlen (input + 5, 3, &state);
+          ASSERT (ret == 2);
+          ASSERT (mbsinit (&state));
+          input[5] = '\0';
+          input[6] = '\0';
+
+          ret = mbrlen (input + 7, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+
+      case '5':
+        /* Locale encoding is GB18030.  */
+        {
+          char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          ret = mbrlen (input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          ret = mbrlen (input + 1, 1, &state);
+          ASSERT (ret == (size_t)(-2));
+          ASSERT (!mbsinit (&state));
+          input[1] = '\0';
+
+          ret = mbrlen (input + 2, 7, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[2] = '\0';
+
+          ret = mbrlen (input + 3, 6, &state);
+          ASSERT (ret == 4);
+          ASSERT (mbsinit (&state));
+          input[3] = '\0';
+          input[4] = '\0';
+          input[5] = '\0';
+          input[6] = '\0';
+
+          ret = mbrlen (input + 7, 2, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          input[7] = '\0';
+
+          ret = mbrlen (input + 8, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 819ee09bb5affc7106338fa2b62016a2b393beff..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..85abbdad9d4868a152648b148e358e4b73f80a7c
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-mbrtoc32${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mbrtoc32${EXEEXT} 1 || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index e1617da42804441b00b823047e48644490038b37..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..1d44338a7810f8a8866f23edbdf6b42a9c601059
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-mbrtoc32${EXEEXT} 2
deleted file mode 120000 (symlink)
index 361be772eab3c0be3f3b36ca332fcc06406e89bc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..082bad849fa812a76b8b4b30fe0b05ee6441488c
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-mbrtoc32${EXEEXT} 3
deleted file mode 120000 (symlink)
index bcea62001021c0f53424fbc62a797e4c613178b1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b23a32728c1348f385778fe758b10d015ec3cc86
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional japanese locale is installed"
+  else
+    echo "Skipping test: no traditional japanese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_JA \
+${CHECKER} ./test-mbrtoc32${EXEEXT} 4
deleted file mode 120000 (symlink)
index e09c785aabdf1581da763d8f884f13e856d632a5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..734a959eebf49e8f0b069c9ded55d5d8b123ff42
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no transitional chinese locale is installed"
+  else
+    echo "Skipping test: no transitional chinese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mbrtoc32${EXEEXT} 5
deleted file mode 120000 (symlink)
index 755846f34fb6c6306256ba91bb2cb8ee4845cde7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-w32-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..bf6b61ce4c1c3b5eabe895744bf9b145855a1ce6
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1252 locale.
+${CHECKER} ./test-mbrtoc32-w32${EXEEXT} French_France 1252
deleted file mode 120000 (symlink)
index b665e167ebe2f434f371414a8c2e57e733ed6aea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-w32-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..dd96b17f5b83baf0ba619324e7a52763b97bd105
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1256 locale.
+${CHECKER} ./test-mbrtoc32-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
deleted file mode 120000 (symlink)
index c40119c753dda4d5c41c0d046204ac2346a28cc3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-w32-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b2b889b685158292f3777882f24f56888410b41e
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test some UTF-8 locales.
+${CHECKER} ./test-mbrtoc32-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
deleted file mode 120000 (symlink)
index 7909df16508e327a55bcd66c56ee0fb2ea0684d6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-w32-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..21a826b542a20b8e590aa06584a4b6c60926e467
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP932 locale.
+${CHECKER} ./test-mbrtoc32-w32${EXEEXT} Japanese_Japan 932
deleted file mode 120000 (symlink)
index 55484b00020d0253c4180d1b719eac7c1b647f1b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-w32-6.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..4e261dbd8121f1aa53541a1d224740d2598df7d6
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP950 locale.
+${CHECKER} ./test-mbrtoc32-w32${EXEEXT} Chinese_Taiwan 950
deleted file mode 120000 (symlink)
index 239b4d33df75c6ee3337e70fca8749854d49279d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-w32-7.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..200c248ccd5dd1159da298aeab209873245db42f
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP936 locale.
+${CHECKER} ./test-mbrtoc32-w32${EXEEXT} Chinese_China 936
deleted file mode 120000 (symlink)
index 221ea67d999153afbf3d029a3bc85828194470d4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-w32-8.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..a763e9fe94dd5b781db3f0acb9f9b29ea361f5e6
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a GB18030 locale.
+${CHECKER} ./test-mbrtoc32-w32${EXEEXT} Chinese_China 54936
deleted file mode 120000 (symlink)
index 5e31468ea17d8d215c695c273369f264b6f6222d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32-w32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..93196d48f6a995004f080cfdd4b43029d824b8c2
--- /dev/null
@@ -0,0 +1,750 @@
+/* Test of conversion of multibyte character to 32-bit wide character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "localcharset.h"
+#include "macros.h"
+
+#if defined _WIN32 && !defined __CYGWIN__
+
+static int
+test_one_locale (const char *name, int codepage)
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+# if 1
+  /* Portable code to set the locale.  */
+  {
+    char name_with_codepage[1024];
+
+    sprintf (name_with_codepage, "%s.%d", name, codepage);
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name_with_codepage) == NULL)
+      return 77;
+  }
+# else
+  /* Hacky way to set a locale.codepage combination that setlocale() refuses
+     to set.  */
+  {
+    /* Codepage of the current locale, set with setlocale().
+       Not necessarily the same as GetACP().  */
+    extern __declspec(dllimport) unsigned int __lc_codepage;
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name) == NULL)
+      return 77;
+
+    /* Clobber the codepage and MB_CUR_MAX, both set by setlocale().  */
+    __lc_codepage = codepage;
+    switch (codepage)
+      {
+      case 1252:
+      case 1256:
+        MB_CUR_MAX = 1;
+        break;
+      case 932:
+      case 950:
+      case 936:
+        MB_CUR_MAX = 2;
+        break;
+      case 54936:
+      case 65001:
+        MB_CUR_MAX = 4;
+        break;
+      }
+
+    /* Test whether the codepage is really available.  */
+    memset (&state, '\0', sizeof (mbstate_t));
+    if (mbrtoc32 (&wc, " ", 1, &state) == (size_t)(-1))
+      return 77;
+  }
+# endif
+
+  /* Test zero-length input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (char32_t) 0xBADFACE;
+    ret = mbrtoc32 (&wc, "x", 0, &state);
+    ASSERT (ret == (size_t)(-2));
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test NUL byte input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (char32_t) 0xBADFACE;
+    ret = mbrtoc32 (&wc, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == 0);
+    ASSERT (mbsinit (&state));
+    ret = mbrtoc32 (NULL, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test single-byte input.  */
+  {
+    int c;
+    char buf[1];
+
+    memset (&state, '\0', sizeof (mbstate_t));
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = c;
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == c);
+          ASSERT (mbsinit (&state));
+          ret = mbrtoc32 (NULL, buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (char32_t) 0xBADFACE;
+    ret = mbrtoc32 (&wc, NULL, 5, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == (char32_t) 0xBADFACE);
+    ASSERT (mbsinit (&state));
+  }
+
+  switch (codepage)
+    {
+    case 1252:
+      /* Locale encoding is CP1252, an extension of ISO-8859-1.  */
+      {
+        char input[] = "B\374\337er"; /* "Büßer" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'B');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 1, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == (unsigned char) '\374');
+        ASSERT (wc == 0x00FC); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtoc32 (NULL, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == (unsigned char) '\337');
+        ASSERT (wc == 0x00DF); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 3, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'e');
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 4, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'r');
+        ASSERT (mbsinit (&state));
+      }
+      return 0;
+
+    case 1256:
+      /* Locale encoding is CP1256, not the same as ISO-8859-6.  */
+      {
+        char input[] = "x\302\341\346y"; /* "xآلوy" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'x');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 1, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == (unsigned char) '\302');
+        ASSERT (wc == 0x0622); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtoc32 (NULL, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == (unsigned char) '\341');
+        ASSERT (wc == 0x0644); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 3, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == (unsigned char) '\346');
+        ASSERT (wc == 0x0648); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 4, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'y');
+        ASSERT (mbsinit (&state));
+      }
+      return 0;
+
+    case 65001:
+      /* Locale encoding is CP65001 = UTF-8.  */
+      if (strcmp (locale_charset (), "UTF-8") != 0)
+        return 77;
+      {
+        char input[] = "s\303\274\303\237\360\237\230\213!"; /* "süß😋!" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 's');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 1, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (char32_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[1] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 2, 7, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x00FC); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtoc32 (NULL, input + 3, 6, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 3, 6, &state);
+        ASSERT (ret == 2);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x00DF); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtoc32 (NULL, input + 5, 4, &state);
+        ASSERT (ret == 4);
+        ASSERT (mbsinit (&state));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 5, 4, &state);
+        ASSERT (ret == 4);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x1F60B); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+        input[7] = '\0';
+        input[8] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 9, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '!');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\303\300", 2, &state); /* 0xC3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\343\300", 2, &state); /* 0xE3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\343\300\200", 3, &state); /* 0xE3 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\343\200\300", 3, &state); /* 0xE3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\363\300", 2, &state); /* 0xF3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\363\300\200\200", 4, &state); /* 0xF3 0xC0 0x80 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\363\200\300", 3, &state); /* 0xF3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\363\200\300\200", 4, &state); /* 0xF3 0x80 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\363\200\200\300", 4, &state); /* 0xF3 0x80 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    case 932:
+      /* Locale encoding is CP932, similar to Shift_JIS.  */
+      {
+        char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '<');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 1, 2, &state);
+        ASSERT (ret == 2);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x65E5); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+        input[2] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 3, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (char32_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 4, 4, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x672C); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtoc32 (NULL, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x8A9E); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 7, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '>');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == (size_t)-2);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || (ret == 2 && wc == 0x30FB));
+      }
+      return 0;
+
+    case 950:
+      /* Locale encoding is CP950, similar to Big5.  */
+      {
+        char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '<');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 1, 2, &state);
+        ASSERT (ret == 2);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x65E5); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+        input[2] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 3, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (char32_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 4, 4, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x672C); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtoc32 (NULL, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x8A9E); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 7, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '>');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == (size_t)-2);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || (ret == 2 && wc == '?'));
+      }
+      return 0;
+
+    case 936:
+      /* Locale encoding is CP936 = GBK, an extension of GB2312.  */
+      {
+        char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '<');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 1, 2, &state);
+        ASSERT (ret == 2);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x65E5); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+        input[2] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 3, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (char32_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 4, 4, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x672C); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtoc32 (NULL, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x8A9E); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 7, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '>');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == (size_t)-2);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || (ret == 2 && wc == '?'));
+      }
+      return 0;
+
+    case 54936:
+      /* Locale encoding is CP54936 = GB18030.  */
+      if (strcmp (locale_charset (), "GB18030") != 0)
+        return 77;
+      {
+        char input[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 's');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 1, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (char32_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[1] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 2, 9, &state);
+        ASSERT (ret == 1);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x00FC); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtoc32 (NULL, input + 3, 8, &state);
+        ASSERT (ret == 4);
+        ASSERT (mbsinit (&state));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 3, 8, &state);
+        ASSERT (ret == 4);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x00DF); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+        input[4] = '\0';
+        input[5] = '\0';
+        input[6] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtoc32 (NULL, input + 7, 4, &state);
+        ASSERT (ret == 4);
+        ASSERT (mbsinit (&state));
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 7, 4, &state);
+        ASSERT (ret == 4);
+        ASSERT (c32tob (wc) == EOF);
+        ASSERT (wc == 0x1F60B); /* expect Unicode encoding */
+        ASSERT (mbsinit (&state));
+        input[7] = '\0';
+        input[8] = '\0';
+        input[9] = '\0';
+        input[10] = '\0';
+
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, input + 11, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '!');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\201\045", 2, &state); /* 0x81 0x25 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\201\060\377", 3, &state); /* 0x81 0x30 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\201\060\377\064", 4, &state); /* 0x81 0x30 0xFF 0x34 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (char32_t) 0xBADFACE;
+        ret = mbrtoc32 (&wc, "\201\060\211\072", 4, &state); /* 0x81 0x30 0x89 0x3A */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    default:
+      return 1;
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int codepage = atoi (argv[argc - 1]);
+  int result;
+  int i;
+
+  result = 77;
+  for (i = 1; i < argc - 1; i++)
+    {
+      int ret = test_one_locale (argv[i], codepage);
+
+      if (ret != 77)
+        result = ret;
+    }
+
+  if (result == 77)
+    {
+      fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+               codepage);
+    }
+  return result;
+}
+
+#else
+
+int
+main (int argc, char *argv[])
+{
+  fputs ("Skipping test: not a native Windows system\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 9d802eb4ca87c23de6774090550c66d1c27d53b3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtoc32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6fffb2a71c35cc400df562cb77c962ac8a82670c
--- /dev/null
@@ -0,0 +1,441 @@
+/* Test of conversion of multibyte character to 32-bit wide character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mbrtoc32, size_t,
+                 (char32_t *, const char *, size_t, mbstate_t *));
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test zero-length input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (char32_t) 0xBADFACE;
+    ret = mbrtoc32 (&wc, "x", 0, &state);
+    ASSERT (ret == (size_t)(-2));
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test NUL byte input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (char32_t) 0xBADFACE;
+    ret = mbrtoc32 (&wc, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == 0);
+    ASSERT (mbsinit (&state));
+    ret = mbrtoc32 (NULL, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test single-byte input.  */
+  {
+    int c;
+    char buf[1];
+
+    memset (&state, '\0', sizeof (mbstate_t));
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          ASSERT (c < 0x80);
+          /* c is an ASCII character.  */
+          buf[0] = c;
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == c);
+          ASSERT (mbsinit (&state));
+
+          ret = mbrtoc32 (NULL, buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+
+          break;
+        default:
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (char32_t) 0xBADFACE;
+    ret = mbrtoc32 (&wc, NULL, 5, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == (char32_t) 0xBADFACE);
+    ASSERT (mbsinit (&state));
+  }
+
+#ifdef __ANDROID__
+  /* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
+     "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
+     locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
+     that is, effectively the "C.UTF-8" locale.  */
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
+#endif
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '1':
+        /* C or POSIX locale.  */
+        {
+          int c;
+          char buf[1];
+
+          memset (&state, '\0', sizeof (mbstate_t));
+          for (c = 0; c < 0x100; c++)
+            if (c != 0)
+              {
+                /* We are testing all nonnull bytes.  */
+                buf[0] = c;
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, buf, 1, &state);
+                /* POSIX:2018 says regarding mbrtowc: "In the POSIX locale an
+                   [EILSEQ] error cannot occur since all byte values are valid
+                   characters."  It is reasonable to expect mbrtoc32 to behave
+                   in the same way.  */
+                ASSERT (ret == 1);
+                if (c < 0x80)
+                  /* c is an ASCII character.  */
+                  ASSERT (wc == c);
+                else
+                  /* On most platforms, the bytes 0x80..0xFF map to U+0080..U+00FF.
+                     But on musl libc, the bytes 0x80..0xFF map to U+DF80..U+DFFF.  */
+                  ASSERT (wc == (btoc32 (c) == 0xDF00 + c ? btoc32 (c) : c));
+                ASSERT (mbsinit (&state));
+
+                ret = mbrtoc32 (NULL, buf, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (mbsinit (&state));
+              }
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          char input[] = "B\374\337er"; /* "Büßer" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'B');
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 1, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (c32tob (wc) == (unsigned char) '\374');
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x00FC); /* expect Unicode encoding */
+          #endif
+          ASSERT (mbsinit (&state));
+          input[1] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtoc32 (NULL, input + 2, 3, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 2, 3, &state);
+          ASSERT (ret == 1);
+          ASSERT (c32tob (wc) == (unsigned char) '\337');
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x00DF); /* expect Unicode encoding */
+          #endif
+          ASSERT (mbsinit (&state));
+          input[2] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 3, 2, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'e');
+          ASSERT (mbsinit (&state));
+          input[3] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 4, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'r');
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          char input[] = "s\303\274\303\237\360\237\230\213!"; /* "süß😋!" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 's');
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 1, 1, &state);
+          ASSERT (ret == (size_t)(-2));
+          ASSERT (wc == (char32_t) 0xBADFACE);
+          ASSERT (!mbsinit (&state));
+          input[1] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 2, 7, &state);
+          ASSERT (ret == 1);
+          ASSERT (c32tob (wc) == EOF);
+          ASSERT (wc == 0x00FC); /* expect Unicode encoding */
+          ASSERT (mbsinit (&state));
+          input[2] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtoc32 (NULL, input + 3, 6, &state);
+          ASSERT (ret == 2);
+          ASSERT (mbsinit (&state));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 3, 6, &state);
+          ASSERT (ret == 2);
+          ASSERT (c32tob (wc) == EOF);
+          ASSERT (wc == 0x00DF); /* expect Unicode encoding */
+          ASSERT (mbsinit (&state));
+          input[3] = '\0';
+          input[4] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtoc32 (NULL, input + 5, 4, &state);
+          ASSERT (ret == 4);
+          ASSERT (mbsinit (&state));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 5, 4, &state);
+          ASSERT (ret == 4);
+          ASSERT (c32tob (wc) == EOF);
+          ASSERT (wc == 0x1F60B); /* expect Unicode encoding */
+          ASSERT (mbsinit (&state));
+          input[5] = '\0';
+          input[6] = '\0';
+          input[7] = '\0';
+          input[8] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 9, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == '!');
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is EUC-JP.  */
+        {
+          char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == '<');
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 1, 2, &state);
+          ASSERT (ret == 2);
+          ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x65E5); /* expect Unicode encoding */
+          #endif
+          ASSERT (mbsinit (&state));
+          input[1] = '\0';
+          input[2] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 3, 1, &state);
+          ASSERT (ret == (size_t)(-2));
+          ASSERT (wc == (char32_t) 0xBADFACE);
+          ASSERT (!mbsinit (&state));
+          input[3] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 4, 4, &state);
+          ASSERT (ret == 1);
+          ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x672C); /* expect Unicode encoding */
+          #endif
+          ASSERT (mbsinit (&state));
+          input[4] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtoc32 (NULL, input + 5, 3, &state);
+          ASSERT (ret == 2);
+          ASSERT (mbsinit (&state));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 5, 3, &state);
+          ASSERT (ret == 2);
+          ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x8A9E); /* expect Unicode encoding */
+          #endif
+          ASSERT (mbsinit (&state));
+          input[5] = '\0';
+          input[6] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 7, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == '>');
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+
+      case '5':
+        /* Locale encoding is GB18030.  */
+        #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
+        {
+          char input[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 's');
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 1, 1, &state);
+          ASSERT (ret == (size_t)(-2));
+          ASSERT (wc == (char32_t) 0xBADFACE);
+          ASSERT (!mbsinit (&state));
+          input[1] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 2, 9, &state);
+          ASSERT (ret == 1);
+          ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x00FC); /* expect Unicode encoding */
+          #endif
+          ASSERT (mbsinit (&state));
+          input[2] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtoc32 (NULL, input + 3, 8, &state);
+          ASSERT (ret == 4);
+          ASSERT (mbsinit (&state));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 3, 8, &state);
+          ASSERT (ret == 4);
+          ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x00DF); /* expect Unicode encoding */
+          #endif
+          ASSERT (mbsinit (&state));
+          input[3] = '\0';
+          input[4] = '\0';
+          input[5] = '\0';
+          input[6] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtoc32 (NULL, input + 7, 4, &state);
+          ASSERT (ret == 4);
+          ASSERT (mbsinit (&state));
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 7, 4, &state);
+          ASSERT (ret == 4);
+          ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x1F60B); /* expect Unicode encoding */
+          #endif
+          ASSERT (mbsinit (&state));
+          input[7] = '\0';
+          input[8] = '\0';
+          input[9] = '\0';
+          input[10] = '\0';
+
+          wc = (char32_t) 0xBADFACE;
+          ret = mbrtoc32 (&wc, input + 11, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == '!');
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 225cbfa803b48b72e22c7c3d0d40e48959a106b9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..f0a1feda19b05c38fd68c95801ed85c01cc9c47f
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-mbrtowc${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mbrtowc${EXEEXT} 1 || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index 7e24b172d05baf2e9024545495ec516c744f0eba..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..30662926c74eae4e3d29c95ddb61fdfe602eee84
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-mbrtowc${EXEEXT} 2
deleted file mode 120000 (symlink)
index b7cd89498b5de66c93cda8d598195e72c80c82b3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..36b0023cd5a46831311a313b44f18caef5e8a2cb
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-mbrtowc${EXEEXT} 3
deleted file mode 120000 (symlink)
index 69de2b1774fecf003543cfd7057a9b1a39fed20f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..1c5943ea976ed4cf4db66d166fe02066c27e536f
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional japanese locale is installed"
+  else
+    echo "Skipping test: no traditional japanese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_JA \
+${CHECKER} ./test-mbrtowc${EXEEXT} 4
deleted file mode 120000 (symlink)
index e2184116c9d504255eee998242ea235eab75f76e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..8690bbeffe6309b460f5fe61fefb7b595b7ea336
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no transitional chinese locale is installed"
+  else
+    echo "Skipping test: no transitional chinese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mbrtowc${EXEEXT} 5
deleted file mode 120000 (symlink)
index 4d724f568d637c92894381139e5dc20a095d1945..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-w32-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..fec9eadf264208689a2daf29c08b0fdc988717de
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1252 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} French_France 1252
deleted file mode 120000 (symlink)
index 52814984f30264eaa37dcfa0ff7e16680bb5824b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-w32-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..c55a0ec0aec119a26e371d99f7a689337220af8b
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1256 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
deleted file mode 120000 (symlink)
index 024bd07a110263576ca593d486d76c9da05a5c12..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-w32-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..2c5d555f1b7293100982c6cf4e388e523e89586f
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test some UTF-8 locales.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
deleted file mode 120000 (symlink)
index f61b96d1dc55e6f1ff841ca21aaeb034ec698526..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-w32-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..c49f4bdf7069a700a6288a5dc7f03987429248f1
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP932 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} Japanese_Japan 932
deleted file mode 120000 (symlink)
index c0c0c8ca9738971d81d814773bd1edcbe9a40c01..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-w32-6.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3e78615068975cbca7d2ea7a4cb8b1dc2d2e29a5
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP950 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_Taiwan 950
deleted file mode 120000 (symlink)
index 46a997c5590a55631abe8292a88e45f432b558eb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-w32-7.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..c6ba22261dd343b15db62438f7bb8d3c2d6599e9
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP936 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_China 936
deleted file mode 120000 (symlink)
index 2cd25be1a37beaa444f029674837950a90ba0b2d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-w32-8.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..c2e8dfe08173942e2bffcd36ba044904aa960519
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a GB18030 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_China 54936
deleted file mode 120000 (symlink)
index 6d6493054cea209032292c2e405b114d87ea85d0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc-w32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2071ddeb8258bdd30b2db33961f505318e91b80b
--- /dev/null
@@ -0,0 +1,734 @@
+/* Test of conversion of multibyte character to wide character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "localcharset.h"
+#include "macros.h"
+
+#if defined _WIN32 && !defined __CYGWIN__
+
+static int
+test_one_locale (const char *name, int codepage)
+{
+  mbstate_t state;
+  wchar_t wc;
+  size_t ret;
+
+# if 1
+  /* Portable code to set the locale.  */
+  {
+    char name_with_codepage[1024];
+
+    sprintf (name_with_codepage, "%s.%d", name, codepage);
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name_with_codepage) == NULL)
+      return 77;
+  }
+# else
+  /* Hacky way to set a locale.codepage combination that setlocale() refuses
+     to set.  */
+  {
+    /* Codepage of the current locale, set with setlocale().
+       Not necessarily the same as GetACP().  */
+    extern __declspec(dllimport) unsigned int __lc_codepage;
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name) == NULL)
+      return 77;
+
+    /* Clobber the codepage and MB_CUR_MAX, both set by setlocale().  */
+    __lc_codepage = codepage;
+    switch (codepage)
+      {
+      case 1252:
+      case 1256:
+        MB_CUR_MAX = 1;
+        break;
+      case 932:
+      case 950:
+      case 936:
+        MB_CUR_MAX = 2;
+        break;
+      case 54936:
+      case 65001:
+        MB_CUR_MAX = 4;
+        break;
+      }
+
+    /* Test whether the codepage is really available.  */
+    memset (&state, '\0', sizeof (mbstate_t));
+    if (mbrtowc (&wc, " ", 1, &state) == (size_t)(-1))
+      return 77;
+  }
+# endif
+
+  /* Test zero-length input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (wchar_t) 0xBADFACE;
+    ret = mbrtowc (&wc, "x", 0, &state);
+    /* gnulib's implementation returns (size_t)(-2).
+       The AIX 5.1 implementation returns (size_t)(-1).
+       glibc's implementation returns 0.  */
+    ASSERT (ret == (size_t)(-2) || ret == (size_t)(-1) || ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test NUL byte input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (wchar_t) 0xBADFACE;
+    ret = mbrtowc (&wc, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == 0);
+    ASSERT (mbsinit (&state));
+    ret = mbrtowc (NULL, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test single-byte input.  */
+  {
+    int c;
+    char buf[1];
+
+    memset (&state, '\0', sizeof (mbstate_t));
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          buf[0] = c;
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == c);
+          ASSERT (mbsinit (&state));
+          ret = mbrtowc (NULL, buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (wchar_t) 0xBADFACE;
+    ret = mbrtowc (&wc, NULL, 5, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == (wchar_t) 0xBADFACE);
+    ASSERT (mbsinit (&state));
+  }
+
+  switch (codepage)
+    {
+    case 1252:
+      /* Locale encoding is CP1252, an extension of ISO-8859-1.  */
+      {
+        char input[] = "B\374\337er"; /* "Büßer" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'B');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 1, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == (unsigned char) '\374');
+        ASSERT (wc == 0x00FC);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == (unsigned char) '\337');
+        ASSERT (wc == 0x00DF);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'e');
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 4, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'r');
+        ASSERT (mbsinit (&state));
+      }
+      return 0;
+
+    case 1256:
+      /* Locale encoding is CP1256, not the same as ISO-8859-6.  */
+      {
+        char input[] = "x\302\341\346y"; /* "xآلوy" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'x');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 1, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == (unsigned char) '\302');
+        ASSERT (wc == 0x0622);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 2, 3, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == (unsigned char) '\341');
+        ASSERT (wc == 0x0644);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == (unsigned char) '\346');
+        ASSERT (wc == 0x0648);
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 4, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'y');
+        ASSERT (mbsinit (&state));
+      }
+      return 0;
+
+    case 65001:
+      /* Locale encoding is CP65001 = UTF-8.  */
+      if (strcmp (locale_charset (), "UTF-8") != 0)
+        return 77;
+      {
+        char input[] = "B\303\274\303\237er"; /* "Büßer" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'B');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 1, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (wchar_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[1] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 2, 5, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x00FC);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 3, 4, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 4, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x00DF);
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+        input[4] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 5, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'e');
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 6, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'r');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\303\300", 2, &state); /* 0xC3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\343\300", 2, &state); /* 0xE3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\343\300\200", 3, &state); /* 0xE3 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\343\200\300", 3, &state); /* 0xE3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\300", 2, &state); /* 0xF3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\300\200\200", 4, &state); /* 0xF3 0xC0 0x80 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\200\300", 3, &state); /* 0xF3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\200\300\200", 4, &state); /* 0xF3 0x80 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\200\200\300", 4, &state); /* 0xF3 0x80 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    case 932:
+      /* Locale encoding is CP932, similar to Shift_JIS.  */
+      {
+        char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '<');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 1, 2, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x65E5);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+        input[2] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (wchar_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 4, 4, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x672C);
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x8A9E);
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 7, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '>');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == (size_t)-2);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || (ret == 2 && wc == 0x30FB));
+      }
+      return 0;
+
+    case 950:
+      /* Locale encoding is CP950, similar to Big5.  */
+      {
+        char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '<');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 1, 2, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x65E5);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+        input[2] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (wchar_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 4, 4, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x672C);
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x8A9E);
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 7, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '>');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == (size_t)-2);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || (ret == 2 && wc == '?'));
+      }
+      return 0;
+
+    case 936:
+      /* Locale encoding is CP936 = GBK, an extension of GB2312.  */
+      {
+        char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '<');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 1, 2, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x65E5);
+        ASSERT (mbsinit (&state));
+        input[1] = '\0';
+        input[2] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (wchar_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[3] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 4, 4, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x672C);
+        ASSERT (mbsinit (&state));
+        input[4] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 5, 3, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x8A9E);
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+        input[6] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 7, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == '>');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || ret == (size_t)-2);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT ((ret == (size_t)-1 && errno == EILSEQ) || (ret == 2 && wc == '?'));
+      }
+      return 0;
+
+    case 54936:
+      /* Locale encoding is CP54936 = GB18030.  */
+      if (strcmp (locale_charset (), "GB18030") != 0)
+        return 77;
+      {
+        char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'B');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 1, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (wchar_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[1] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 2, 7, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x00FC);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 3, 6, &state);
+        ASSERT (ret == 4);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 6, &state);
+        ASSERT (ret == 4);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x00DF);
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+        input[4] = '\0';
+        input[5] = '\0';
+        input[6] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 7, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'e');
+        ASSERT (mbsinit (&state));
+        input[7] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 8, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'r');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\225\377", 2, &state); /* 0x95 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\201\045", 2, &state); /* 0x81 0x25 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\201\060\377", 3, &state); /* 0x81 0x30 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\201\060\377\064", 4, &state); /* 0x81 0x30 0xFF 0x34 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\201\060\211\072", 4, &state); /* 0x81 0x30 0x89 0x3A */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
+    default:
+      return 1;
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int codepage = atoi (argv[argc - 1]);
+  int result;
+  int i;
+
+  result = 77;
+  for (i = 1; i < argc - 1; i++)
+    {
+      int ret = test_one_locale (argv[i], codepage);
+
+      if (ret != 77)
+        result = ret;
+    }
+
+  if (result == 77)
+    {
+      fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+               codepage);
+    }
+  return result;
+}
+
+#else
+
+int
+main (int argc, char *argv[])
+{
+  fputs ("Skipping test: not a native Windows system\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 9406198bccb5b04940ec5cd1b907c2ca77769597..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbrtowc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f45f90e4eca1d8df9934c0b73b5cb9eed2e70bff
--- /dev/null
@@ -0,0 +1,391 @@
+/* Test of conversion of multibyte character to wide character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mbrtowc, size_t, (wchar_t *, char const *, size_t,
+                                   mbstate_t *));
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  mbstate_t state;
+  wchar_t wc;
+  size_t ret;
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test zero-length input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (wchar_t) 0xBADFACE;
+    ret = mbrtowc (&wc, "x", 0, &state);
+    ASSERT (ret == (size_t)(-2));
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test NUL byte input.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (wchar_t) 0xBADFACE;
+    ret = mbrtowc (&wc, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == 0);
+    ASSERT (mbsinit (&state));
+    ret = mbrtowc (NULL, "", 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+  /* Test single-byte input.  */
+  {
+    int c;
+    char buf[1];
+
+    memset (&state, '\0', sizeof (mbstate_t));
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          ASSERT (c < 0x80);
+          /* c is an ASCII character.  */
+          buf[0] = c;
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == c);
+          ASSERT (mbsinit (&state));
+
+          ret = mbrtowc (NULL, buf, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+
+          break;
+        default:
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    memset (&state, '\0', sizeof (mbstate_t));
+    wc = (wchar_t) 0xBADFACE;
+    ret = mbrtowc (&wc, NULL, 5, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == (wchar_t) 0xBADFACE);
+    ASSERT (mbsinit (&state));
+  }
+
+#ifdef __ANDROID__
+  /* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
+     "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
+     locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
+     that is, effectively the "C.UTF-8" locale.  */
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
+#endif
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '1':
+        /* C or POSIX locale.  */
+        {
+          int c;
+          char buf[1];
+
+          memset (&state, '\0', sizeof (mbstate_t));
+          for (c = 0; c < 0x100; c++)
+            if (c != 0)
+              {
+                /* We are testing all nonnull bytes.  */
+                buf[0] = c;
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, buf, 1, &state);
+                /* POSIX:2018 says: "In the POSIX locale an [EILSEQ] error
+                   cannot occur since all byte values are valid characters."  */
+                ASSERT (ret == 1);
+                if (c < 0x80)
+                  /* c is an ASCII character.  */
+                  ASSERT (wc == c);
+                else
+                  /* On most platforms, the bytes 0x80..0xFF map to U+0080..U+00FF.
+                     But on musl libc, the bytes 0x80..0xFF map to U+DF80..U+DFFF.  */
+                  ASSERT (wc == (btowc (c) == 0xDF00 + c ? btowc (c) : c));
+                ASSERT (mbsinit (&state));
+
+                ret = mbrtowc (NULL, buf, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (mbsinit (&state));
+              }
+        }
+        return 0;
+
+      case '2':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          char input[] = "B\374\337er"; /* "Büßer" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'B');
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 1, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wctob (wc) == (unsigned char) '\374');
+          ASSERT (mbsinit (&state));
+          input[1] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtowc (NULL, input + 2, 3, &state);
+          ASSERT (ret == 1);
+          ASSERT (mbsinit (&state));
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 2, 3, &state);
+          ASSERT (ret == 1);
+          ASSERT (wctob (wc) == (unsigned char) '\337');
+          ASSERT (mbsinit (&state));
+          input[2] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 3, 2, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'e');
+          ASSERT (mbsinit (&state));
+          input[3] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 4, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'r');
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          char input[] = "B\303\274\303\237er"; /* "Büßer" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'B');
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 1, 1, &state);
+          ASSERT (ret == (size_t)(-2));
+          ASSERT (wc == (wchar_t) 0xBADFACE);
+          ASSERT (!mbsinit (&state));
+          input[1] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 2, 5, &state);
+          ASSERT (ret == 1);
+          ASSERT (wctob (wc) == EOF);
+          ASSERT (mbsinit (&state));
+          input[2] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtowc (NULL, input + 3, 4, &state);
+          ASSERT (ret == 2);
+          ASSERT (mbsinit (&state));
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 3, 4, &state);
+          ASSERT (ret == 2);
+          ASSERT (wctob (wc) == EOF);
+          ASSERT (mbsinit (&state));
+          input[3] = '\0';
+          input[4] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 5, 2, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'e');
+          ASSERT (mbsinit (&state));
+          input[5] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 6, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'r');
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is EUC-JP.  */
+        {
+          char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == '<');
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 1, 2, &state);
+          ASSERT (ret == 2);
+          ASSERT (wctob (wc) == EOF);
+          ASSERT (mbsinit (&state));
+          input[1] = '\0';
+          input[2] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 3, 1, &state);
+          ASSERT (ret == (size_t)(-2));
+          ASSERT (wc == (wchar_t) 0xBADFACE);
+          ASSERT (!mbsinit (&state));
+          input[3] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 4, 4, &state);
+          ASSERT (ret == 1);
+          ASSERT (wctob (wc) == EOF);
+          ASSERT (mbsinit (&state));
+          input[4] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtowc (NULL, input + 5, 3, &state);
+          ASSERT (ret == 2);
+          ASSERT (mbsinit (&state));
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 5, 3, &state);
+          ASSERT (ret == 2);
+          ASSERT (wctob (wc) == EOF);
+          ASSERT (mbsinit (&state));
+          input[5] = '\0';
+          input[6] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 7, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == '>');
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+
+      case '5':
+        /* Locale encoding is GB18030.  */
+        {
+          char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
+          memset (&state, '\0', sizeof (mbstate_t));
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'B');
+          ASSERT (mbsinit (&state));
+          input[0] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 1, 1, &state);
+          ASSERT (ret == (size_t)(-2));
+          ASSERT (wc == (wchar_t) 0xBADFACE);
+          ASSERT (!mbsinit (&state));
+          input[1] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 2, 7, &state);
+          ASSERT (ret == 1);
+          ASSERT (wctob (wc) == EOF);
+          ASSERT (mbsinit (&state));
+          input[2] = '\0';
+
+          /* Test support of NULL first argument.  */
+          ret = mbrtowc (NULL, input + 3, 6, &state);
+          ASSERT (ret == 4);
+          ASSERT (mbsinit (&state));
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 3, 6, &state);
+          ASSERT (ret == 4);
+          ASSERT (wctob (wc) == EOF);
+          ASSERT (mbsinit (&state));
+          input[3] = '\0';
+          input[4] = '\0';
+          input[5] = '\0';
+          input[6] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 7, 2, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'e');
+          ASSERT (mbsinit (&state));
+          input[7] = '\0';
+
+          wc = (wchar_t) 0xBADFACE;
+          ret = mbrtowc (&wc, input + 8, 1, &state);
+          ASSERT (ret == 1);
+          ASSERT (wc == 'r');
+          ASSERT (mbsinit (&state));
+        }
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index e32cd915a23c12c70325a23a1f0e415063d0dc05..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbscasecmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c097a98209e20619fed64837b0804bd1399815e1
--- /dev/null
@@ -0,0 +1,55 @@
+/* Test of case-insensitive string comparison function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <locale.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  ASSERT (mbscasecmp ("paragraph", "Paragraph") == 0);
+
+  ASSERT (mbscasecmp ("paragrapH", "parAgRaph") == 0);
+
+  ASSERT (mbscasecmp ("paragraph", "paraLyzed") < 0);
+  ASSERT (mbscasecmp ("paraLyzed", "paragraph") > 0);
+
+  ASSERT (mbscasecmp ("para", "paragraph") < 0);
+  ASSERT (mbscasecmp ("paragraph", "para") > 0);
+
+  /* The following tests shows how mbscasecmp() is different from
+     strcasecmp().  */
+
+  ASSERT (mbscasecmp ("\303\266zg\303\274r", "\303\226ZG\303\234R") == 0); /* özgür */
+  ASSERT (mbscasecmp ("\303\226ZG\303\234R", "\303\266zg\303\274r") == 0); /* özgür */
+
+  /* This test shows how strings of different size can compare equal.  */
+  ASSERT (mbscasecmp ("turkish", "TURK\304\260SH") == 0);
+  ASSERT (mbscasecmp ("TURK\304\260SH", "turkish") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index fab484bdfc668b4e69aafcd19d2546a1918457a2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbscasecmp.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..73e62b5f50f1cef0f414aac12b683bc960e4df4f
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific Turkish locale is installed.
+: "${LOCALE_TR_UTF8=tr_TR.UTF-8}"
+if test $LOCALE_TR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no turkish Unicode locale is installed"
+  else
+    echo "Skipping test: no turkish Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_TR_UTF8 \
+${CHECKER} ./test-mbscasecmp${EXEEXT}
deleted file mode 120000 (symlink)
index fd30b3de4629828f4ec5d1e5664b78f2a9b5c6cd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbschr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..20291614e38f595305a42e6bb12462ceb522a7da
--- /dev/null
@@ -0,0 +1,68 @@
+/* Test of searching a string for a character.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <locale.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Tests with a character < 0x30.  */
+  {
+    const char input[] = "\312\276\300\375 \312\276\300\375 \312\276\300\375"; /* "示例 示例 示例" */
+    const char *result = mbschr (input, ' ');
+    ASSERT (result == input + 4);
+  }
+
+  {
+    const char input[] = "\312\276\300\375"; /* "示例" */
+    const char *result = mbschr (input, ' ');
+    ASSERT (result == NULL);
+  }
+
+  /* Tests with a character >= 0x30.  */
+  {
+    const char input[] = "\272\305123\324\313\320\320\241\243"; /* "号123运行。" */
+    const char *result = mbschr (input, '2');
+    ASSERT (result == input + 3);
+  }
+
+  /* This test shows how mbschr() is different from strchr().  */
+  {
+    const char input[] = "\203\062\332\066123\324\313\320\320\241\243"; /* "씋123运行。" */
+    const char *result = mbschr (input, '2');
+    ASSERT (result == input + 5);
+  }
+
+  {
+    const char input[] = "\312\300\275\347\304\343\272\303\243\241"; /* "世界你好!" */
+    const char *result = mbschr (input, '!');
+    ASSERT (result == NULL);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3b2d99330ef4b63904d6678ae6d19a5e14085c99..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbschr.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7e62b3f08a71e1d0895c24e1c5b8567700d5af52
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no chinese GB18030 locale is installed"
+  else
+    echo "Skipping test: no chinese GB18030 locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mbschr${EXEEXT}
deleted file mode 120000 (symlink)
index 050742460f351a4a1339ae6f93b9baa1b96dc470..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsinit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0250894dd2e8c8c0d1fb70badf12ee0ed01ce825
--- /dev/null
@@ -0,0 +1,55 @@
+/* Test of test for initial conversion state.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mbsinit, int, (const mbstate_t *));
+
+#include <locale.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  static mbstate_t state;
+
+  ASSERT (mbsinit (NULL));
+
+  ASSERT (mbsinit (&state));
+
+  if (argc > 1)
+    {
+      static const char input[1] = "\303";
+      wchar_t wc;
+      size_t ret;
+
+      /* configure should already have checked that the locale is supported.  */
+      if (setlocale (LC_ALL, "") == NULL)
+        return 1;
+
+      ret = mbrtowc (&wc, input, 1, &state);
+      ASSERT (ret == (size_t)(-2));
+      ASSERT (!mbsinit (&state));
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3414602457586ad7fcb7fc71f5c82458583f1a1a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsinit.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..25d4b2e4826251417934429dcb7b60e2bb98464b
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-mbsinit${EXEEXT}
deleted file mode 120000 (symlink)
index 4da0e5f045948f31de99a47738572092560d9655..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtoc32s-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3d5f89be75c229d988e64a6868e60aef1e94a0b5
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-mbsrtoc32s${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mbsrtoc32s${EXEEXT} 1 || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index 163c920ebb3d5322bf9bc8dcb6bd7b97c3f568ae..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtoc32s-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..1f084d46d86f371f9e0aa26e9a8e63457b1a59e2
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-mbsrtoc32s${EXEEXT} 2
deleted file mode 120000 (symlink)
index 88a61d244b97d0b602f8b66a6c73d3e3779e0537..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtoc32s-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..721e8df973662c2668bad8eef782604be3c1eb7e
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-mbsrtoc32s${EXEEXT} 3
deleted file mode 120000 (symlink)
index 72efe365913d80edd5c0dbc5e86f7fc3d14726be..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtoc32s-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..553fde286fe02963ddcf8bf715fd312cb05d018d
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional japanese locale is installed"
+  else
+    echo "Skipping test: no traditional japanese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_JA \
+${CHECKER} ./test-mbsrtoc32s${EXEEXT} 4
deleted file mode 120000 (symlink)
index eb198b2d8d59919bb68ea2798aaa60627e45e51b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtoc32s-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..fa25beefcfe8cc68c1335eb335961e0d091a41ec
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no transitional chinese locale is installed"
+  else
+    echo "Skipping test: no transitional chinese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mbsrtoc32s${EXEEXT} 5
deleted file mode 120000 (symlink)
index 5f92209c297ff4b7c06036dc8fbf9d0c608f2018..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtoc32s.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fb6494a76dfcec75ee61900dd568a7420079ad21
--- /dev/null
@@ -0,0 +1,375 @@
+/* Test of conversion of string to 32-bit wide string.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mbsrtoc32s, size_t,
+                 (char32_t *, const char **, size_t, mbstate_t *));
+
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  mbstate_t state;
+  char32_t wc;
+  size_t ret;
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test NUL byte input.  */
+  {
+    const char *src;
+
+    memset (&state, '\0', sizeof (mbstate_t));
+
+    src = "";
+    ret = mbsrtoc32s (NULL, &src, 0, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+
+    src = "";
+    ret = mbsrtoc32s (NULL, &src, 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+
+    wc = (char32_t) 0xBADFACE;
+    src = "";
+    ret = mbsrtoc32s (&wc, &src, 0, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == (char32_t) 0xBADFACE);
+    ASSERT (mbsinit (&state));
+
+    wc = (char32_t) 0xBADFACE;
+    src = "";
+    ret = mbsrtoc32s (&wc, &src, 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+#ifdef __ANDROID__
+  /* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
+     "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
+     locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
+     that is, effectively the "C.UTF-8" locale.  */
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
+#endif
+
+  if (argc > 1)
+    {
+      int unlimited;
+
+      for (unlimited = 0; unlimited < 2; unlimited++)
+        {
+          #define BUFSIZE 10
+          char32_t buf[BUFSIZE];
+          const char *src;
+          mbstate_t temp_state;
+
+          {
+            size_t i;
+            for (i = 0; i < BUFSIZE; i++)
+              buf[i] = (char32_t) 0xBADFACE;
+          }
+
+          switch (argv[1][0])
+            {
+            case '1':
+              /* C or POSIX locale.  */
+              {
+                char input[] = "n/a";
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                src = input;
+                temp_state = state;
+                ret = mbsrtoc32s (NULL, &src, unlimited ? BUFSIZE : 1, &temp_state);
+                ASSERT (ret == 3);
+                ASSERT (src == input);
+                ASSERT (mbsinit (&state));
+
+                src = input;
+                ret = mbsrtoc32s (buf, &src, unlimited ? BUFSIZE : 1, &state);
+                ASSERT (ret == (unlimited ? 3 : 1));
+                ASSERT (src == (unlimited ? NULL : input + 1));
+                ASSERT (buf[0] == 'n');
+                if (unlimited)
+                  {
+                    ASSERT (buf[1] == '/');
+                    ASSERT (buf[2] == 'a');
+                    ASSERT (buf[3] == 0);
+                    ASSERT (buf[4] == (char32_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[1] == (char32_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              {
+                int c;
+                char input[2];
+
+                memset (&state, '\0', sizeof (mbstate_t));
+                for (c = 0; c < 0x100; c++)
+                  if (c != 0)
+                    {
+                      /* We are testing all nonnull bytes.  */
+                      input[0] = c;
+                      input[1] = '\0';
+
+                      src = input;
+                      ret = mbsrtoc32s (NULL, &src, unlimited ? BUFSIZE : 1, &state);
+                      ASSERT (ret == 1);
+                      ASSERT (src == input);
+                      ASSERT (mbsinit (&state));
+
+                      buf[0] = buf[1] = (char32_t) 0xBADFACE;
+                      src = input;
+                      ret = mbsrtoc32s (buf, &src, unlimited ? BUFSIZE : 1, &state);
+                      /* POSIX:2018 says regarding mbsrtowcs: "In the POSIX locale an
+                         [EILSEQ] error cannot occur since all byte values are valid
+                         characters."  It is reasonable to expect mbsrtoc32s to behave
+                         in the same way.  */
+                      ASSERT (ret == 1);
+                      ASSERT (src == (unlimited ? NULL : input + 1));
+                      if (c < 0x80)
+                        /* c is an ASCII character.  */
+                        ASSERT (buf[0] == c);
+                      else
+                        /* On most platforms, the bytes 0x80..0xFF map to U+0080..U+00FF.
+                           But on musl libc, the bytes 0x80..0xFF map to U+DF80..U+DFFF.  */
+                        ASSERT (buf[0] == (btoc32 (c) == 0xDF00 + c ? btoc32 (c) : c));
+                      ASSERT (mbsinit (&state));
+                    }
+              }
+              break;
+
+            case '2':
+              /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+              {
+                char input[] = "B\374\337er"; /* "Büßer" */
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, input, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (wc == 'B');
+                ASSERT (mbsinit (&state));
+                input[0] = '\0';
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, input + 1, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (c32tob (wc) == (unsigned char) '\374');
+                ASSERT (mbsinit (&state));
+                input[1] = '\0';
+
+                src = input + 2;
+                temp_state = state;
+                ret = mbsrtoc32s (NULL, &src, unlimited ? BUFSIZE : 1, &temp_state);
+                ASSERT (ret == 3);
+                ASSERT (src == input + 2);
+                ASSERT (mbsinit (&state));
+
+                src = input + 2;
+                ret = mbsrtoc32s (buf, &src, unlimited ? BUFSIZE : 1, &state);
+                ASSERT (ret == (unlimited ? 3 : 1));
+                ASSERT (src == (unlimited ? NULL : input + 3));
+                ASSERT (c32tob (buf[0]) == (unsigned char) '\337');
+                if (unlimited)
+                  {
+                    ASSERT (buf[1] == 'e');
+                    ASSERT (buf[2] == 'r');
+                    ASSERT (buf[3] == 0);
+                    ASSERT (buf[4] == (char32_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[1] == (char32_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              break;
+
+            case '3':
+              /* Locale encoding is UTF-8.  */
+              {
+                char input[] = "s\303\274\303\237\360\237\230\213!"; /* "süß😋!" */
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, input, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (wc == 's');
+                ASSERT (mbsinit (&state));
+                input[0] = '\0';
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, input + 1, 1, &state);
+                ASSERT (ret == (size_t)(-2));
+                ASSERT (wc == (char32_t) 0xBADFACE);
+                ASSERT (!mbsinit (&state));
+                input[1] = '\0';
+
+                src = input + 2;
+                temp_state = state;
+                ret = mbsrtoc32s (NULL, &src, unlimited ? BUFSIZE : 2, &temp_state);
+                ASSERT (ret == 4);
+                ASSERT (src == input + 2);
+                ASSERT (!mbsinit (&state));
+
+                src = input + 2;
+                ret = mbsrtoc32s (buf, &src, unlimited ? BUFSIZE : 2, &state);
+                ASSERT (ret == (unlimited ? 4 : 2));
+                ASSERT (src == (unlimited ? NULL : input + 5));
+                ASSERT (c32tob (buf[0]) == EOF);
+                ASSERT (c32tob (buf[1]) == EOF);
+                if (unlimited)
+                  {
+                    ASSERT (buf[2] == 0x1F60B); /* expect Unicode encoding */
+                    ASSERT (buf[3] == '!');
+                    ASSERT (buf[4] == 0);
+                    ASSERT (buf[5] == (char32_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[2] == (char32_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              break;
+
+            case '4':
+              /* Locale encoding is EUC-JP.  */
+              {
+                char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, input, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (wc == '<');
+                ASSERT (mbsinit (&state));
+                input[0] = '\0';
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, input + 1, 2, &state);
+                ASSERT (ret == 2);
+                ASSERT (c32tob (wc) == EOF);
+                ASSERT (mbsinit (&state));
+                input[1] = '\0';
+                input[2] = '\0';
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, input + 3, 1, &state);
+                ASSERT (ret == (size_t)(-2));
+                ASSERT (wc == (char32_t) 0xBADFACE);
+                ASSERT (!mbsinit (&state));
+                input[3] = '\0';
+
+                src = input + 4;
+                temp_state = state;
+                ret = mbsrtoc32s (NULL, &src, unlimited ? BUFSIZE : 2, &temp_state);
+                ASSERT (ret == 3);
+                ASSERT (src == input + 4);
+                ASSERT (!mbsinit (&state));
+
+                src = input + 4;
+                ret = mbsrtoc32s (buf, &src, unlimited ? BUFSIZE : 2, &state);
+                ASSERT (ret == (unlimited ? 3 : 2));
+                ASSERT (src == (unlimited ? NULL : input + 7));
+                ASSERT (c32tob (buf[0]) == EOF);
+                ASSERT (c32tob (buf[1]) == EOF);
+                if (unlimited)
+                  {
+                    ASSERT (buf[2] == '>');
+                    ASSERT (buf[3] == 0);
+                    ASSERT (buf[4] == (char32_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[2] == (char32_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              break;
+
+            case '5':
+              /* Locale encoding is GB18030.  */
+              #if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+              fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+              return 77;
+              #endif
+              {
+                char input[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, input, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (wc == 's');
+                ASSERT (mbsinit (&state));
+                input[0] = '\0';
+
+                wc = (char32_t) 0xBADFACE;
+                ret = mbrtoc32 (&wc, input + 1, 1, &state);
+                ASSERT (ret == (size_t)(-2));
+                ASSERT (wc == (char32_t) 0xBADFACE);
+                ASSERT (!mbsinit (&state));
+                input[1] = '\0';
+
+                src = input + 2;
+                temp_state = state;
+                ret = mbsrtoc32s (NULL, &src, unlimited ? BUFSIZE : 2, &temp_state);
+                ASSERT (ret == 4);
+                ASSERT (src == input + 2);
+                ASSERT (!mbsinit (&state));
+
+                src = input + 2;
+                ret = mbsrtoc32s (buf, &src, unlimited ? BUFSIZE : 2, &state);
+                ASSERT (ret == (unlimited ? 4 : 2));
+                ASSERT (src == (unlimited ? NULL : input + 7));
+                ASSERT (c32tob (buf[0]) == EOF);
+                ASSERT (c32tob (buf[1]) == EOF);
+                if (unlimited)
+                  {
+                    ASSERT (c32tob (buf[2]) == EOF);
+                    ASSERT (buf[3] == '!');
+                    ASSERT (buf[4] == 0);
+                    ASSERT (buf[5] == (char32_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[2] == (char32_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              break;
+
+            default:
+              return 1;
+            }
+        }
+
+      return 0;
+    }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index d0a24f92d36f2c6a8254bfc868190e15648597c1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtowcs-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..abac8d2eecd9459be1770427e5676277fa698334
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-mbsrtowcs${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mbsrtowcs${EXEEXT} 1 || exit 1
+
+exit 0
deleted file mode 120000 (symlink)
index 85b8bb5b6d8ce8456654ec728196cde79cd5488a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtowcs-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..508159e62ac2260a8bb15948de490f63fa379316
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-mbsrtowcs${EXEEXT} 2
deleted file mode 120000 (symlink)
index c76eb5ef738865afcc2b44ca1d4faab79bb7c8df..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtowcs-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..9c7caee5d5ca9009cd793c19671969b59e8fbe9a
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-mbsrtowcs${EXEEXT} 3
deleted file mode 120000 (symlink)
index 94a25077be0b0dfa72ff399e968d230f3b676382..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtowcs-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..87dc7e758c7d49e412219deaed8625afd5d32acd
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional japanese locale is installed"
+  else
+    echo "Skipping test: no traditional japanese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_JA \
+${CHECKER} ./test-mbsrtowcs${EXEEXT} 4
deleted file mode 120000 (symlink)
index 0a56e4ebc888604eecc15ec05d22f8bcf8bbf111..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtowcs-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..8e2de64cb35c29f7e7f876a0126be8e3a8604041
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no transitional chinese locale is installed"
+  else
+    echo "Skipping test: no transitional chinese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mbsrtowcs${EXEEXT} 5
deleted file mode 120000 (symlink)
index 6f45fcdaee26e8f83fdc80d328d9863169a868f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mbsrtowcs.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7e958a40df1a1473db9dd8c5653ea3f9542838a2
--- /dev/null
@@ -0,0 +1,368 @@
+/* Test of conversion of string to wide string.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mbsrtowcs, size_t, (wchar_t *, char const **, size_t,
+                                     mbstate_t *));
+
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  mbstate_t state;
+  wchar_t wc;
+  size_t ret;
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test NUL byte input.  */
+  {
+    const char *src;
+
+    memset (&state, '\0', sizeof (mbstate_t));
+
+    src = "";
+    ret = mbsrtowcs (NULL, &src, 0, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+
+    src = "";
+    ret = mbsrtowcs (NULL, &src, 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (mbsinit (&state));
+
+    wc = (wchar_t) 0xBADFACE;
+    src = "";
+    ret = mbsrtowcs (&wc, &src, 0, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == (wchar_t) 0xBADFACE);
+    ASSERT (mbsinit (&state));
+
+    wc = (wchar_t) 0xBADFACE;
+    src = "";
+    ret = mbsrtowcs (&wc, &src, 1, &state);
+    ASSERT (ret == 0);
+    ASSERT (wc == 0);
+    ASSERT (mbsinit (&state));
+  }
+
+#ifdef __ANDROID__
+  /* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
+     "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
+     locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
+     that is, effectively the "C.UTF-8" locale.  */
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
+#endif
+
+  if (argc > 1)
+    {
+      int unlimited;
+
+      for (unlimited = 0; unlimited < 2; unlimited++)
+        {
+          #define BUFSIZE 10
+          wchar_t buf[BUFSIZE];
+          const char *src;
+          mbstate_t temp_state;
+
+          {
+            size_t i;
+            for (i = 0; i < BUFSIZE; i++)
+              buf[i] = (wchar_t) 0xBADFACE;
+          }
+
+          switch (argv[1][0])
+            {
+            case '1':
+              /* C or POSIX locale.  */
+              {
+                char input[] = "n/a";
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                src = input;
+                temp_state = state;
+                ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 1, &temp_state);
+                ASSERT (ret == 3);
+                ASSERT (src == input);
+                ASSERT (mbsinit (&state));
+
+                src = input;
+                ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 1, &state);
+                ASSERT (ret == (unlimited ? 3 : 1));
+                ASSERT (src == (unlimited ? NULL : input + 1));
+                ASSERT (buf[0] == 'n');
+                if (unlimited)
+                  {
+                    ASSERT (buf[1] == '/');
+                    ASSERT (buf[2] == 'a');
+                    ASSERT (buf[3] == 0);
+                    ASSERT (buf[4] == (wchar_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[1] == (wchar_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              {
+                int c;
+                char input[2];
+
+                memset (&state, '\0', sizeof (mbstate_t));
+                for (c = 0; c < 0x100; c++)
+                  if (c != 0)
+                    {
+                      /* We are testing all nonnull bytes.  */
+                      input[0] = c;
+                      input[1] = '\0';
+
+                      src = input;
+                      ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 1, &state);
+                      ASSERT (ret == 1);
+                      ASSERT (src == input);
+                      ASSERT (mbsinit (&state));
+
+                      buf[0] = buf[1] = (wchar_t) 0xBADFACE;
+                      src = input;
+                      ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 1, &state);
+                      /* POSIX:2018 says: "In the POSIX locale an [EILSEQ] error
+                         cannot occur since all byte values are valid characters."  */
+                      ASSERT (ret == 1);
+                      ASSERT (src == (unlimited ? NULL : input + 1));
+                      if (c < 0x80)
+                        /* c is an ASCII character.  */
+                        ASSERT (buf[0] == c);
+                      else
+                        /* On most platforms, the bytes 0x80..0xFF map to U+0080..U+00FF.
+                           But on musl libc, the bytes 0x80..0xFF map to U+DF80..U+DFFF.  */
+                        ASSERT (buf[0] == (btowc (c) == 0xDF00 + c ? btowc (c) : c));
+                      ASSERT (mbsinit (&state));
+                    }
+              }
+              break;
+
+            case '2':
+              /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+              {
+                char input[] = "B\374\337er"; /* "Büßer" */
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, input, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (wc == 'B');
+                ASSERT (mbsinit (&state));
+                input[0] = '\0';
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, input + 1, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (wctob (wc) == (unsigned char) '\374');
+                ASSERT (mbsinit (&state));
+                input[1] = '\0';
+
+                src = input + 2;
+                temp_state = state;
+                ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 1, &temp_state);
+                ASSERT (ret == 3);
+                ASSERT (src == input + 2);
+                ASSERT (mbsinit (&state));
+
+                src = input + 2;
+                ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 1, &state);
+                ASSERT (ret == (unlimited ? 3 : 1));
+                ASSERT (src == (unlimited ? NULL : input + 3));
+                ASSERT (wctob (buf[0]) == (unsigned char) '\337');
+                if (unlimited)
+                  {
+                    ASSERT (buf[1] == 'e');
+                    ASSERT (buf[2] == 'r');
+                    ASSERT (buf[3] == 0);
+                    ASSERT (buf[4] == (wchar_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[1] == (wchar_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              break;
+
+            case '3':
+              /* Locale encoding is UTF-8.  */
+              {
+                char input[] = "B\303\274\303\237er"; /* "Büßer" */
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, input, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (wc == 'B');
+                ASSERT (mbsinit (&state));
+                input[0] = '\0';
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, input + 1, 1, &state);
+                ASSERT (ret == (size_t)(-2));
+                ASSERT (wc == (wchar_t) 0xBADFACE);
+                ASSERT (!mbsinit (&state));
+                input[1] = '\0';
+
+                src = input + 2;
+                temp_state = state;
+                ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 2, &temp_state);
+                ASSERT (ret == 4);
+                ASSERT (src == input + 2);
+                ASSERT (!mbsinit (&state));
+
+                src = input + 2;
+                ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 2, &state);
+                ASSERT (ret == (unlimited ? 4 : 2));
+                ASSERT (src == (unlimited ? NULL : input + 5));
+                ASSERT (wctob (buf[0]) == EOF);
+                ASSERT (wctob (buf[1]) == EOF);
+                if (unlimited)
+                  {
+                    ASSERT (buf[2] == 'e');
+                    ASSERT (buf[3] == 'r');
+                    ASSERT (buf[4] == 0);
+                    ASSERT (buf[5] == (wchar_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[2] == (wchar_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              break;
+
+            case '4':
+              /* Locale encoding is EUC-JP.  */
+              {
+                char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, input, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (wc == '<');
+                ASSERT (mbsinit (&state));
+                input[0] = '\0';
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, input + 1, 2, &state);
+                ASSERT (ret == 2);
+                ASSERT (wctob (wc) == EOF);
+                ASSERT (mbsinit (&state));
+                input[1] = '\0';
+                input[2] = '\0';
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, input + 3, 1, &state);
+                ASSERT (ret == (size_t)(-2));
+                ASSERT (wc == (wchar_t) 0xBADFACE);
+                ASSERT (!mbsinit (&state));
+                input[3] = '\0';
+
+                src = input + 4;
+                temp_state = state;
+                ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 2, &temp_state);
+                ASSERT (ret == 3);
+                ASSERT (src == input + 4);
+                ASSERT (!mbsinit (&state));
+
+                src = input + 4;
+                ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 2, &state);
+                ASSERT (ret == (unlimited ? 3 : 2));
+                ASSERT (src == (unlimited ? NULL : input + 7));
+                ASSERT (wctob (buf[0]) == EOF);
+                ASSERT (wctob (buf[1]) == EOF);
+                if (unlimited)
+                  {
+                    ASSERT (buf[2] == '>');
+                    ASSERT (buf[3] == 0);
+                    ASSERT (buf[4] == (wchar_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[2] == (wchar_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              break;
+
+            case '5':
+              /* Locale encoding is GB18030.  */
+              {
+                char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, input, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (wc == 'B');
+                ASSERT (mbsinit (&state));
+                input[0] = '\0';
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, input + 1, 1, &state);
+                ASSERT (ret == (size_t)(-2));
+                ASSERT (wc == (wchar_t) 0xBADFACE);
+                ASSERT (!mbsinit (&state));
+                input[1] = '\0';
+
+                src = input + 2;
+                temp_state = state;
+                ret = mbsrtowcs (NULL, &src, unlimited ? BUFSIZE : 2, &temp_state);
+                ASSERT (ret == 4);
+                ASSERT (src == input + 2);
+                ASSERT (!mbsinit (&state));
+
+                src = input + 2;
+                ret = mbsrtowcs (buf, &src, unlimited ? BUFSIZE : 2, &state);
+                ASSERT (ret == (unlimited ? 4 : 2));
+                ASSERT (src == (unlimited ? NULL : input + 7));
+                ASSERT (wctob (buf[0]) == EOF);
+                ASSERT (wctob (buf[1]) == EOF);
+                if (unlimited)
+                  {
+                    ASSERT (buf[2] == 'e');
+                    ASSERT (buf[3] == 'r');
+                    ASSERT (buf[4] == 0);
+                    ASSERT (buf[5] == (wchar_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[2] == (wchar_t) 0xBADFACE);
+                ASSERT (mbsinit (&state));
+              }
+              break;
+
+            default:
+              return 1;
+            }
+        }
+
+      return 0;
+    }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index a1dc98163f729125d900fd94003985b039198d9c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mcel.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7bff8b138756f96ee0cbc0c49c77177f83f004d7
--- /dev/null
@@ -0,0 +1,138 @@
+/* Test <mcel.h>
+   Copyright 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <mcel.h>
+
+#include <locale.h>
+
+#include "macros.h"
+
+static wint_t
+to_ascii (wint_t c)
+{
+  return c & 0x7f;
+}
+
+static int
+sgn (int i)
+{
+  return (i > 0) - (i < 0);
+}
+
+static void
+test_mcel_vs_mbrtoc32 (unsigned char uc, mcel_t c, size_t n, char32_t ch)
+{
+  ASSERT (!c.err == (n <= MB_LEN_MAX));
+  ASSERT (c.err
+          ? c.err == uc && c.ch == 0 && c.len == 1
+          : c.ch == ch && c.len == (n ? n : 1));
+}
+
+int
+main (void)
+{
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  mcel_t prev;
+  for (int ch = 0; ch < 0x80; ch++)
+    {
+      mcel_t c = mcel_ch (ch, 1);
+      ASSERT (c.ch == ch);
+      ASSERT (c.len == 1);
+      ASSERT (!c.err);
+      ASSERT (mcel_cmp (c, c) == 0);
+      ASSERT (mcel_tocmp (to_ascii, c, c) == 0);
+      if (ch)
+        {
+          ASSERT (mcel_cmp (prev, c) < 0);
+          ASSERT (mcel_cmp (c, prev) > 0);
+          ASSERT (mcel_tocmp (to_ascii, prev, c) < 0);
+          ASSERT (mcel_tocmp (to_ascii, c, prev) > 0);
+        }
+      ASSERT (mcel_isbasic (ch));
+      prev = c;
+    }
+  for (char ch = CHAR_MIN; ; ch++)
+    {
+      ASSERT (mcel_isbasic (ch) == (0 <= ch && ch <= 0x7f));
+      if (ch == CHAR_MAX)
+        break;
+    }
+  for (int ch = 0x80; ch < 0x200; ch++)
+    {
+      mcel_t c = mcel_ch (ch, 2);
+      ASSERT (c.ch == ch);
+      ASSERT (c.len == 2);
+      ASSERT (!c.err);
+      ASSERT (mcel_cmp (c, c) == 0);
+      ASSERT (mcel_tocmp (to_ascii, c, c) == 0);
+      ASSERT (mcel_cmp (prev, c) < 0);
+      ASSERT (mcel_cmp (c, prev) > 0);
+      ASSERT (mcel_tocmp (to_ascii, c, c) == 0);
+      int cmp = to_ascii (c.ch) ? -1 : 1;
+      ASSERT (sgn (mcel_tocmp (to_ascii, prev, c)) == cmp);
+      ASSERT (sgn (mcel_tocmp (to_ascii, c, prev)) == -cmp);
+      prev = c;
+    }
+  for (unsigned char err = 0x80; ; err++)
+    {
+      mcel_t c = mcel_err (err);
+      ASSERT (!c.ch);
+      ASSERT (c.len == 1);
+      ASSERT (c.err == err);
+      ASSERT (mcel_cmp (c, c) == 0);
+      ASSERT (mcel_cmp (prev, c) < 0);
+      ASSERT (mcel_cmp (c, prev) > 0);
+      ASSERT (mcel_tocmp (to_ascii, c, c) == 0);
+      ASSERT (mcel_tocmp (to_ascii, prev, c) < 0);
+      ASSERT (mcel_tocmp (to_ascii, c, prev) > 0);
+      prev = c;
+      if (err == (unsigned char) -1)
+        break;
+    }
+
+  for (int i = CHAR_MIN; i <= CHAR_MAX; i++)
+    for (int j = CHAR_MIN; i <= CHAR_MAX; i++)
+      for (int k = CHAR_MIN; k <= CHAR_MAX; k++)
+        {
+          char const ijk[] = {i, j, k};
+          mbstate_t mbs = {0};
+          char32_t ch;
+          size_t n = mbrtoc32 (&ch, ijk, sizeof ijk, &mbs);
+          mcel_t c = mcel_scan (ijk, ijk + sizeof ijk);
+          test_mcel_vs_mbrtoc32 (i, c, n, ch);
+
+          static char const terminator[] = "\r\n./";
+          for (int ti = 0; ti < sizeof terminator; ti++)
+            {
+              char t = terminator[ti];
+              if (i == t || j == t || k == t)
+                continue;
+              char const ijkt[] = {i, j, k, t};
+              mcel_t d = mcel_scant (ijkt, t);
+              ASSERT (c.ch == d.ch && c.err == d.err && c.len == d.len);
+              if (!t)
+                {
+                  mcel_t z = mcel_scanz (ijkt);
+                  ASSERT (d.ch == z.ch && d.err == z.err && d.len == z.len);
+                }
+            }
+        }
+}
deleted file mode 120000 (symlink)
index 32b92083aac42b9838fd1aaf85a6a53f5e017420..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-md5-buffer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..45f4b3bd0d5f9d75e7dc034fa10947149c7f36ac
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+ * Written by Simon Josefsson
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson. */
+
+#include <config.h>
+
+#include "md5.h"
+
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+  /* Test vectors from RFC 1321. */
+
+  const char *in1 = "abc";
+  const char *out1 =
+    "\x90\x01\x50\x98\x3C\xD2\x4F\xB0\xD6\x96\x3F\x7D\x28\xE1\x7F\x72";
+  const char *in2 = "message digest";
+  const char *out2 =
+    "\xF9\x6B\x69\x7D\x7C\xB7\x93\x8D\x52\x5A\x2F\x31\xAA\xF1\x61\xD0";
+  char buf[MD5_DIGEST_SIZE];
+
+  if (memcmp (md5_buffer (in1, strlen (in1), buf), out1, MD5_DIGEST_SIZE) != 0)
+    {
+      size_t i;
+      printf ("expected:\n");
+      for (i = 0; i < MD5_DIGEST_SIZE; i++)
+        printf ("%02x ", out1[i] & 0xFFu);
+      printf ("\ncomputed:\n");
+      for (i = 0; i < MD5_DIGEST_SIZE; i++)
+        printf ("%02x ", buf[i] & 0xFFu);
+      printf ("\n");
+      return 1;
+    }
+
+  if (memcmp (md5_buffer (in2, strlen (in2), buf), out2, MD5_DIGEST_SIZE) != 0)
+    {
+      size_t i;
+      printf ("expected:\n");
+      for (i = 0; i < MD5_DIGEST_SIZE; i++)
+        printf ("%02x ", out2[i] & 0xFFu);
+      printf ("\ncomputed:\n");
+      for (i = 0; i < MD5_DIGEST_SIZE; i++)
+        printf ("%02x ", buf[i] & 0xFFu);
+      printf ("\n");
+      return 1;
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c3faae8000087cf7c99047539e87e1af718816bd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-md5-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a9d2ef07a75b3d8c69debd65a95d7c21680e5f22
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+ * Written by Simon Josefsson
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson. */
+
+#include <config.h>
+
+#include "md5.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define TESTFILE "test-md5.data"
+#include "test-digest.h"
+
+int
+main (void)
+{
+  /* Test md5_stream.  */
+  test_digest_on_files (md5_stream, "md5_stream", 16,
+                        "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04\xe9\x80\x09\x98\xec\xf8\x42\x7e",
+                        "\x0d\x70\x06\xcd\x05\x5e\x94\xcf\x61\x45\x87\xe1\xd2\xae\x0c\x8e",
+                        "\xec\x99\x67\x9b\xff\xc0\xf9\xb0\x6d\x18\x30\x6b\x06\xd6\x56\x23");
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f04d105086189a09ad081a21484be3489bde068b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-memcasecmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ebafded1be89a3f67637dc53fd0d5e94fa2ea75a
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ * Written by Simon Josefsson and Bruno Haible
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "memcasecmp.h"
+
+#include <string.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Test equal / not equal distinction.  */
+  void *page_boundary1 = zerosize_ptr ();
+  void *page_boundary2 = zerosize_ptr ();
+  if (page_boundary1 && page_boundary2)
+    ASSERT (memcasecmp (page_boundary1, page_boundary2, 0) == 0);
+  ASSERT (memcasecmp ("foo", "foobar", 2) == 0);
+  ASSERT (memcasecmp ("foo", "foobar", 3) == 0);
+  ASSERT (memcasecmp ("foo", "foobar", 4) != 0);
+  ASSERT (memcasecmp ("foo", "bar", 1) != 0);
+  ASSERT (memcasecmp ("foo", "bar", 3) != 0);
+
+  /* Test less / equal / greater distinction.  */
+  ASSERT (memcasecmp ("foo", "moo", 4) < 0);
+  ASSERT (memcasecmp ("moo", "foo", 4) > 0);
+  ASSERT (memcasecmp ("oomph", "oops", 3) < 0);
+  ASSERT (memcasecmp ("oops", "oomph", 3) > 0);
+  ASSERT (memcasecmp ("foo", "foobar", 4) < 0);
+  ASSERT (memcasecmp ("foobar", "foo", 4) > 0);
+
+  /* Test embedded NULs.  */
+  ASSERT (memcasecmp ("1\0", "2\0", 2) < 0);
+  ASSERT (memcasecmp ("2\0", "1\0", 2) > 0);
+  ASSERT (memcasecmp ("x\0""1", "x\0""2", 3) < 0);
+  ASSERT (memcasecmp ("x\0""2", "x\0""1", 3) > 0);
+
+  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+     or more and with at least one buffer not starting on a 4-byte boundary.
+     William Lewis provided this test program.   */
+  {
+    char foo[21];
+    char bar[21];
+    int i;
+    for (i = 0; i < 4; i++)
+      {
+        char *a = foo + i;
+        char *b = bar + i;
+        strcpy (a, "--------01111111");
+        strcpy (b, "--------10000000");
+        ASSERT (memcasecmp (a, b, 16) < 0);
+      }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 86bd30c38fcffc745636c72758326c14f0e8f053..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-memchr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c43ce9ff19593fb1d27421520dd73c327a836e52
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ * Written by Eric Blake and Bruno Haible
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t));
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+/* Calculating void * + int is not portable, so this wrapper converts
+   to char * to make the tests easier to write.  */
+#define MEMCHR (char *) memchr
+
+int
+main (void)
+{
+  size_t n = 0x100000;
+  char *input = malloc (n);
+  ASSERT (input);
+
+  input[0] = 'a';
+  input[1] = 'b';
+  memset (input + 2, 'c', 1024);
+  memset (input + 1026, 'd', n - 1028);
+  input[n - 2] = 'e';
+  input[n - 1] = 'a';
+
+  /* Basic behavior tests.  */
+  ASSERT (MEMCHR (input, 'a', n) == input);
+
+  ASSERT (MEMCHR (input, 'a', 0) == NULL);
+
+  {
+    void *page_boundary = zerosize_ptr ();
+    if (page_boundary)
+      ASSERT (MEMCHR (page_boundary, 'a', 0) == NULL);
+  }
+
+  ASSERT (MEMCHR (input, 'b', n) == input + 1);
+  ASSERT (MEMCHR (input, 'c', n) == input + 2);
+  ASSERT (MEMCHR (input, 'd', n) == input + 1026);
+
+  ASSERT (MEMCHR (input + 1, 'a', n - 1) == input + n - 1);
+  ASSERT (MEMCHR (input + 1, 'e', n - 1) == input + n - 2);
+  ASSERT (MEMCHR (input + 1, 0x789abc00 | 'e', n - 1) == input + n - 2);
+
+  ASSERT (MEMCHR (input, 'f', n) == NULL);
+  ASSERT (MEMCHR (input, '\0', n) == NULL);
+
+  /* Check that a very long haystack is handled quickly if the byte is
+     found near the beginning.  */
+  {
+    size_t repeat = 10000;
+    for (; repeat > 0; repeat--)
+      {
+        ASSERT (MEMCHR (input, 'c', n) == input + 2);
+      }
+  }
+
+  /* Alignment tests.  */
+  {
+    int i, j;
+    for (i = 0; i < 32; i++)
+      {
+        for (j = 0; j < 256; j++)
+          input[i + j] = j;
+        for (j = 0; j < 256; j++)
+          {
+            ASSERT (MEMCHR (input + i, j, 256) == input + i + j);
+          }
+      }
+  }
+
+  /* Check that memchr() does not read past the first occurrence of the
+     byte being searched.  See the Austin Group's clarification
+     <https://www.opengroup.org/austin/docs/austin_454.txt>.
+     Test both '\0' and something else, since some implementations
+     special-case searching for NUL.
+  */
+  {
+    char *page_boundary = (char *) zerosize_ptr ();
+    /* Too small, and we miss cache line boundary tests; too large,
+       and the test takes cubically longer to complete.  */
+    int limit = 257;
+
+    if (page_boundary != NULL)
+      {
+        for (n = 1; n <= limit; n++)
+          {
+            char *mem = page_boundary - n;
+            memset (mem, 'X', n);
+            ASSERT (MEMCHR (mem, 'U', n) == NULL);
+            ASSERT (MEMCHR (mem, 0, n) == NULL);
+
+            {
+              size_t i;
+              size_t k;
+
+              for (i = 0; i < n; i++)
+                {
+                  mem[i] = 'U';
+                  for (k = i + 1; k < n + limit; k++)
+                    ASSERT (MEMCHR (mem, 'U', k) == mem + i);
+                  mem[i] = 0;
+                  for (k = i + 1; k < n + limit; k++)
+                    ASSERT (MEMCHR (mem, 0, k) == mem + i);
+                  mem[i] = 'X';
+                }
+            }
+          }
+      }
+  }
+
+  free (input);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index df99a941935471863e7cc6e5f546117542447907..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-memchr2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..84aec727af97bfef904c30f688a7cd31ad4d4819
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ * Written by Eric Blake
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "memchr2.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+/* Calculating void * + int is not portable, so this wrapper converts
+   to char * to make the tests easier to write.  */
+#define MEMCHR2 (char *) memchr2
+
+int
+main (void)
+{
+  size_t n = 0x100000;
+  char *input = malloc (n);
+  ASSERT (input);
+
+  input[0] = 'a';
+  input[1] = 'b';
+  memset (input + 2, 'c', 1024);
+  memset (input + 1026, 'd', n - 1028);
+  input[n - 2] = 'e';
+  input[n - 1] = 'a';
+
+  /* Basic behavior tests.  */
+  ASSERT (MEMCHR2 (input, 'a', 'b', n) == input);
+  ASSERT (MEMCHR2 (input, 'b', 'a', n) == input);
+
+  ASSERT (MEMCHR2 (input, 'a', 'b', 0) == NULL);
+  void *page_boundary = zerosize_ptr ();
+  if (page_boundary)
+    ASSERT (MEMCHR2 (page_boundary, 'a', 'b', 0) == NULL);
+
+  ASSERT (MEMCHR2 (input, 'b', 'd', n) == input + 1);
+  ASSERT (MEMCHR2 (input + 2, 'b', 'd', n - 2) == input + 1026);
+
+  ASSERT (MEMCHR2 (input, 'd', 'e', n) == input + 1026);
+  ASSERT (MEMCHR2 (input, 'e', 'd', n) == input + 1026);
+
+  ASSERT (MEMCHR2 (input + 1, 'a', 'e', n - 1) == input + n - 2);
+  ASSERT (MEMCHR2 (input + 1, 'e', 'a', n - 1) == input + n - 2);
+
+  ASSERT (MEMCHR2 (input, 'f', 'g', n) == NULL);
+  ASSERT (MEMCHR2 (input, 'f', '\0', n) == NULL);
+
+  ASSERT (MEMCHR2 (input, 'a', 'a', n) == input);
+  ASSERT (MEMCHR2 (input + 1, 'a', 'a', n - 1) == input + n - 1);
+  ASSERT (MEMCHR2 (input, 'f', 'f', n) == NULL);
+
+  /* Check that a very long haystack is handled quickly if one of the
+     two bytes is found near the beginning.  */
+  {
+    size_t repeat = 10000;
+    for (; repeat > 0; repeat--)
+      {
+        ASSERT (MEMCHR2 (input, 'c', 'e', n) == input + 2);
+        ASSERT (MEMCHR2 (input, 'e', 'c', n) == input + 2);
+        ASSERT (MEMCHR2 (input, 'c', '\0', n) == input + 2);
+        ASSERT (MEMCHR2 (input, '\0', 'c', n) == input + 2);
+      }
+  }
+
+  /* Alignment tests.  */
+  {
+    int i, j;
+    for (i = 0; i < 32; i++)
+      {
+        for (j = 0; j < 256; j++)
+          input[i + j] = j;
+        for (j = 0; j < 256; j++)
+          {
+            ASSERT (MEMCHR2 (input + i, j, 0xff, 256) == input + i + j);
+            ASSERT (MEMCHR2 (input + i, 0xff, j, 256) == input + i + j);
+          }
+      }
+  }
+
+  free (input);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c63c91fa0378ebb7b4b462aefd02200cbd0018be..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-memcoll.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e21aa77d3dc4ec1e7bfef2049bb25ec72ddd87db
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ * Written by Simon Josefsson and Bruno Haible
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "memcoll.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Test equal / not equal distinction.  */
+  ASSERT (memcoll0 ("", 1, "", 1) == 0);
+  ASSERT (memcoll0 ("fo", 3, "fo", 3) == 0);
+  ASSERT (memcoll0 ("foo", 4, "foo", 4) == 0);
+  ASSERT (memcoll0 ("foo\0", 5, "foob", 5) != 0);
+  ASSERT (memcoll0 ("f", 2, "b", 2) != 0);
+  ASSERT (memcoll0 ("foo", 4, "bar", 4) != 0);
+
+  /* Test less / equal / greater distinction.  */
+  ASSERT (memcoll0 ("foo\0", 5, "moo\0", 5) < 0);
+  ASSERT (memcoll0 ("moo\0", 5, "foo\0", 5) > 0);
+  ASSERT (memcoll0 ("oom", 4, "oop", 4) < 0);
+  ASSERT (memcoll0 ("oop", 4, "oom", 4) > 0);
+  ASSERT (memcoll0 ("foo\0", 5, "foob", 5) < 0);
+  ASSERT (memcoll0 ("foob", 5, "foo\0", 5) > 0);
+
+  /* Test embedded NULs.  */
+  ASSERT (memcoll0 ("1\0", 3, "2\0", 3) < 0);
+  ASSERT (memcoll0 ("2\0", 3, "1\0", 3) > 0);
+  ASSERT (memcoll0 ("x\0""1", 4, "x\0""2", 4) < 0);
+  ASSERT (memcoll0 ("x\0""2", 4, "x\0""1", 4) > 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index fdff0bef35c30e3973e9091f10e7f33ae3d876a9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-memrchr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0dde27ddf67a8ec23740a20b7012a476139241e9
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ * Written by Eric Blake and Bruno Haible
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (memrchr, void *, (void const *, int, size_t));
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+/* Work around GCC bug 101494.  */
+#if 4 < __GNUC__ + (7 <= __GNUC_MINOR__) && __GNUC__ < 12
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
+
+/* Calculating void * + int is not portable, so this wrapper converts
+   to char * to make the tests easier to write.  */
+#define MEMRCHR (char *) memrchr
+
+int
+main (void)
+{
+  size_t n = 0x100000;
+  char *input = malloc (n);
+  ASSERT (input);
+
+  input[n - 1] = 'a';
+  input[n - 2] = 'b';
+  memset (input + n - 1026, 'c', 1024);
+  memset (input + 2, 'd', n - 1028);
+  input[1] = 'e';
+  input[0] = 'a';
+
+  /* Basic behavior tests.  */
+  ASSERT (MEMRCHR (input, 'a', n) == input + n - 1);
+
+  ASSERT (MEMRCHR (input, 'a', 0) == NULL);
+  void *page_boundary = zerosize_ptr ();
+  if (page_boundary)
+    ASSERT (MEMRCHR (page_boundary, 'a', 0) == NULL);
+
+  ASSERT (MEMRCHR (input, 'b', n) == input + n - 2);
+  ASSERT (MEMRCHR (input, 'c', n) == input + n - 3);
+  ASSERT (MEMRCHR (input, 'd', n) == input + n - 1027);
+
+  ASSERT (MEMRCHR (input, 'a', n - 1) == input);
+  ASSERT (MEMRCHR (input, 'e', n - 1) == input + 1);
+
+  ASSERT (MEMRCHR (input, 'f', n) == NULL);
+  ASSERT (MEMRCHR (input, '\0', n) == NULL);
+
+  /* Check that a very long haystack is handled quickly if the byte is
+     found near the end.  */
+  {
+    size_t repeat = 10000;
+    for (; repeat > 0; repeat--)
+      {
+        ASSERT (MEMRCHR (input, 'c', n) == input + n - 3);
+      }
+  }
+
+  /* Alignment tests.  */
+  {
+    int i, j;
+    for (i = 0; i < 32; i++)
+      {
+        for (j = 0; j < 256; j++)
+          input[i + j] = j;
+        for (j = 0; j < 256; j++)
+          {
+            ASSERT (MEMRCHR (input + i, j, 256) == input + i + j);
+          }
+      }
+  }
+
+  free (input);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f8233258be66c75b58a6f05023fc4ea4677b25a7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-memset_explicit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..69bcdb5d83512c6f8a8f520197a79c7c9ff5da67
--- /dev/null
@@ -0,0 +1,215 @@
+/* Test memset_explicit.
+   Copyright 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+/* Adapted for memset_explicit by Paul Eggert <eggert@cs.ucla.edu>, 2022.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (memset_explicit, void *, (void *, int, size_t));
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "vma-iter.h"
+#include "macros.h"
+
+#define SECRET "xyzzy1729"
+#define SECRET_SIZE 9
+
+static char zero[SECRET_SIZE] = { 0 };
+
+/* Enable this to verify that the test is effective.  */
+#if 0
+# define memset_explicit(a, c, n)  memset (a, c, n)
+#endif
+
+/* Suppress GCC 13.2.1 false alarm, as this test needs a dangling pointer.  */
+#if 12 <= __GNUC__
+# pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
+
+/* =================== Verify operation on static memory =================== */
+
+static char stbuf[SECRET_SIZE];
+
+static void
+test_static (void)
+{
+  memcpy (stbuf, SECRET, SECRET_SIZE);
+  memset_explicit (stbuf, 0, SECRET_SIZE);
+  ASSERT (memcmp (zero, stbuf, SECRET_SIZE) == 0);
+  for (int i = 1; i <= UCHAR_MAX; i++)
+    {
+      char checkbuf[SECRET_SIZE];
+      memset (checkbuf, i, SECRET_SIZE);
+      memcpy (stbuf, SECRET, SECRET_SIZE);
+      memset_explicit (stbuf, i, SECRET_SIZE);
+      ASSERT (memcmp (checkbuf, stbuf, SECRET_SIZE) == 0);
+    }
+}
+
+/* =============== Verify operation on heap-allocated memory =============== */
+
+/* Test whether an address range is mapped in memory.  */
+#if VMA_ITERATE_SUPPORTED
+
+struct locals
+{
+  uintptr_t range_start;
+  uintptr_t range_end;
+};
+
+static int
+vma_iterate_callback (void *data, uintptr_t start, uintptr_t end,
+                      unsigned int flags)
+{
+  struct locals *lp = (struct locals *) data;
+
+  /* Remove from [range_start, range_end) the part at the beginning or at the
+     end that is covered by [start, end).  */
+  if (start <= lp->range_start && end > lp->range_start)
+    lp->range_start = (end < lp->range_end ? end : lp->range_end);
+  if (start < lp->range_end && end >= lp->range_end)
+    lp->range_end = (start > lp->range_start ? start : lp->range_start);
+
+  return 0;
+}
+
+static bool
+is_range_mapped (uintptr_t range_start, uintptr_t range_end)
+{
+  struct locals l;
+
+  l.range_start = range_start;
+  l.range_end = range_end;
+  vma_iterate (vma_iterate_callback, &l);
+  return l.range_start == l.range_end;
+}
+
+#else
+
+static bool
+is_range_mapped (uintptr_t range_start, uintptr_t range_end)
+{
+  return true;
+}
+
+#endif
+
+static void
+test_heap (void)
+{
+  char *heapbuf = (char *) malloc (SECRET_SIZE);
+  ASSERT (heapbuf);
+  uintptr_t volatile addr = (uintptr_t) heapbuf;
+  memcpy (heapbuf, SECRET, SECRET_SIZE);
+  memset_explicit (heapbuf, 0, SECRET_SIZE);
+  free (heapbuf);
+  heapbuf = (char *) addr;
+  if (is_range_mapped (addr, addr + SECRET_SIZE))
+    {
+      /* some implementation could override freed memory by canaries so
+         compare against secret */
+      ASSERT (memcmp (heapbuf, SECRET, SECRET_SIZE) != 0);
+      printf ("test_heap: address range is still mapped after free().\n");
+    }
+  else
+    printf ("test_heap: address range is unmapped after free().\n");
+}
+
+/* =============== Verify operation on stack-allocated memory =============== */
+
+/* There are two passes:
+     1. Put a secret in memory and invoke memset_explicit on it.
+     2. Verify that the memory has been erased.
+   Implement them in the same function, so that they access the same memory
+   range on the stack.  Declare the local scalars to be volatile so they
+   are not optimized away.  That way, the test verifies that the compiler
+   does not eliminate a call to memset_explicit, even if data flow analysis
+   reveals that the stack area is dead at the end of the function.  */
+static bool _GL_ATTRIBUTE_NOINLINE
+#if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4
+__attribute__ ((__noclone__))
+#endif
+#if __GNUC__ >= 8
+__attribute__ ((__noipa__))
+#endif
+do_secret_stuff (int volatile pass, char *volatile *volatile last_stackbuf)
+{
+  char stackbuf[SECRET_SIZE];
+  if (pass == 1)
+    {
+      memcpy (stackbuf, SECRET, SECRET_SIZE);
+      memset_explicit (stackbuf, 0, SECRET_SIZE);
+      *last_stackbuf = stackbuf;
+      return false;
+    }
+  else /* pass == 2 */
+    {
+      /* Use *last_stackbuf here, because stackbuf may be allocated at a
+         different address than *last_stackbuf.  This can happen
+         when the compiler splits this function into different functions,
+         one for pass == 1 and one for pass != 1.  */
+      return memcmp (zero, *last_stackbuf, SECRET_SIZE) != 0;
+    }
+}
+
+static void
+test_stack (void)
+{
+  int count = 0;
+  int repeat;
+  char *volatile last_stackbuf;
+
+  for (repeat = 2 * 1000; repeat > 0; repeat--)
+    {
+      /* This odd way of writing two consecutive statements
+           do_secret_stuff (1, &last_stackbuf);
+           count += do_secret_stuff (2, &last_stackbuf);
+         ensures that the two do_secret_stuff calls are performed with the same
+         stack pointer value, on m68k.  */
+      if ((repeat % 2) == 0)
+        do_secret_stuff (1, &last_stackbuf);
+      else
+        count += do_secret_stuff (2, &last_stackbuf);
+    }
+  /* If memset_explicit works, count is near 0.  (It may be > 0 if there were
+     some asynchronous signal invocations between the two calls of
+     do_secret_stuff.)
+     If memset_explicit is optimized away by the compiler, count comes out as
+     approximately 1000.  */
+  printf ("test_stack: count = %d\n", count);
+  ASSERT (count < 50);
+}
+
+/* ========================================================================== */
+
+int
+main ()
+{
+  test_static ();
+  test_heap ();
+  test_stack ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index e53faf8d0b31d2c38aec07ae353d36b1966897fc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mkdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ae0ed3415d5f7727e0533a3e7ffb82235c9b361f
--- /dev/null
@@ -0,0 +1,46 @@
+/* Tests of mkdir.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mkdir, int, (char const *, mode_t));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-mkdir.t"
+
+#include "test-mkdir.h"
+
+int
+main (void)
+{
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_mkdir (mkdir, true);
+}
deleted file mode 120000 (symlink)
index e13c53fb7ef714257bf57b4d9321833f8dae1e29..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mkdir.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e22d07ad4fc327935257f1137ed123d500c21a94
--- /dev/null
@@ -0,0 +1,98 @@
+/* Test of mkdir() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file is designed to test both mkdir(a,b) and
+   mkdirat(AT_FDCWD,a,b).  FUNC is the function to test.  Assumes that
+   BASE and ASSERT are already defined, and that appropriate headers
+   are already included.  If PRINT, warn before skipping tests with
+   status 77 when symlinks are unsupported.  */
+
+static int
+test_mkdir (int (*func) (char const *, mode_t), bool print)
+{
+  /* Test basic error handling.  */
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  errno = 0;
+  ASSERT (func (BASE "file", 0700) == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (func (BASE "file/", 0700) == -1);
+  ASSERT (errno == ENOTDIR || errno == EEXIST);
+  errno = 0;
+  ASSERT (func (BASE "file/dir", 0700) == -1);
+  ASSERT (errno == ENOTDIR || errno == ENOENT || errno == EOPNOTSUPP);
+  ASSERT (unlink (BASE "file") == 0);
+  errno = 0;
+  ASSERT (func ("", 0700) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "dir/sub", 0700) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "dir/.", 0700) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "dir/.//", 0700) == -1);
+  ASSERT (errno == ENOENT);
+
+  /* Test trailing slash handling.  */
+  ASSERT (func (BASE "dir", 0700) == 0);
+  errno = 0;
+  ASSERT (func (BASE "dir", 0700) == -1);
+  ASSERT (errno == EEXIST);
+  ASSERT (rmdir (BASE "dir") == 0);
+  ASSERT (func (BASE "dir/", 0700) == 0);
+  errno = 0;
+  ASSERT (func (BASE "dir/", 0700) == -1);
+  ASSERT (errno == EEXIST);
+  ASSERT (rmdir (BASE "dir") == 0);
+
+  /* Test symlink behavior.  POSIX requires the creation of
+     directories through a dangling symlink with trailing slash, but
+     GNU does not yet implement that, so we support either behavior
+     for now.  */
+  if (symlink (BASE "dir", BASE "link"))
+    {
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  errno = 0;
+  ASSERT (func (BASE "link", 0700) == -1);
+  ASSERT (errno == EEXIST);
+  {
+    int result;
+    errno = 0;
+    result = func (BASE "link/", 0700);
+    if (!result)
+      ASSERT (rmdir (BASE "dir") == 0);
+    else
+      {
+        ASSERT (result == -1);
+        ASSERT (errno == EEXIST);
+        errno = 0;
+        ASSERT (rmdir (BASE "dir") == -1);
+        ASSERT (errno == ENOENT);
+      }
+  }
+  errno = 0;
+  ASSERT (func (BASE "link/.", 0700) == -1);
+  ASSERT (errno == ENOENT);
+  ASSERT (unlink (BASE "link") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 646ac5186195630466562b5dcecb3b4ef1c054c5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mkdirat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6faa8443fe5d86983491254b49a38171e765611e
--- /dev/null
@@ -0,0 +1,97 @@
+/* Tests of mkdirat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mkdirat, int, (int, char const *, mode_t));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-mkdirat.t"
+
+#include "test-mkdir.h"
+
+static int dfd = AT_FDCWD;
+
+/* Wrapper to test mkdirat like mkdir.  */
+static int
+do_mkdir (char const *name, mode_t mode)
+{
+  return mkdirat (dfd, name, mode);
+}
+
+int
+main (_GL_UNUSED int argc, char *argv[])
+{
+  int result;
+
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (mkdirat (-1, "foo", 0700) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (mkdirat (99, "foo", 0700) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Test basic mkdir functionality.  */
+  result = test_mkdir (do_mkdir, false);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_mkdir (do_mkdir, false) == result);
+
+  /* Tests specific to mkdirat.  */
+  ASSERT (mkdirat (dfd, BASE "dir1", 0700) == 0);
+  ASSERT (chdir (BASE "dir1") == 0);
+  ASSERT (close (dfd) == 0);
+  dfd = open ("..", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (mkdirat (dfd, BASE "dir2", 0700) == 0);
+  ASSERT (close (dfd) == 0);
+  errno = 0;
+  ASSERT (mkdirat (dfd, BASE "dir3", 0700) == -1);
+  ASSERT (errno == EBADF);
+  dfd = open ("/dev/null", O_RDONLY);
+  ASSERT (0 <= dfd);
+  errno = 0;
+  ASSERT (mkdirat (dfd, "dir3", 0700) == -1);
+  ASSERT (errno == ENOTDIR);
+  ASSERT (close (dfd) == 0);
+  ASSERT (chdir ("..") == 0);
+  ASSERT (rmdir (BASE "dir1") == 0);
+  ASSERT (rmdir (BASE "dir2") == 0);
+
+  return result;
+}
deleted file mode 120000 (symlink)
index 51e1f8496b4ba4c45e68a35572a91bfe21ebacc8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mkfifo.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..88df9266a489f8ae59eafa813ed6b892fd3af766
--- /dev/null
@@ -0,0 +1,46 @@
+/* Tests of mkfifo.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mkfifo, int, (char const *, mode_t));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-mkfifo.t"
+
+#include "test-mkfifo.h"
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_mkfifo (mkfifo, true);
+}
deleted file mode 120000 (symlink)
index af5e579c80b0b41d8eb817fa6e43ab56e3df10d2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mkfifo.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d9b1b1cd79ef74343c37d03c0dc05063ac2cd6a2
--- /dev/null
@@ -0,0 +1,77 @@
+/* Tests of mkfifo and friends.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+/* This file is designed to test mkfifo(n,m), mknod(n,m|S_IFIFO,0),
+   mkfifoat(AT_FDCWD,n,m), and mknodat(AT_FDCWD,n,m|S_IFIFO,0).  FUNC
+   is the function to test.  Assumes that BASE and ASSERT are already
+   defined, and that appropriate headers are already included.  If
+   PRINT, warn before skipping symlink tests with status 77.  */
+
+static int
+test_mkfifo (int (*func) (char const *, mode_t), bool print)
+{
+  int result = func (BASE "fifo", 0600);
+  struct stat st;
+  if (result == -1 && errno == ENOSYS)
+    {
+      if (print)
+        fputs ("skipping test: no support for named fifos\n", stderr);
+      return 77;
+    }
+  ASSERT (result == 0);
+  ASSERT (stat (BASE "fifo", &st) == 0);
+  ASSERT (S_ISFIFO (st.st_mode));
+
+  /* Sanity checks of failures.  */
+  errno = 0;
+  ASSERT (func ("", S_IRUSR | S_IWUSR) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (".", 0600) == -1);
+  /* Allow HP-UX 11.11's EISDIR, even though POSIX says it's wrong,
+     since it doesn't really hurt anything and we lack the energy to
+     fix it.  */
+  ASSERT (errno == EEXIST || errno == EINVAL || errno == EISDIR);
+  errno = 0;
+  ASSERT (func (BASE "fifo", 0600) == -1);
+  ASSERT (errno == EEXIST);
+  ASSERT (unlink (BASE "fifo") == 0);
+  errno = 0;
+  ASSERT (func (BASE "fifo/", 0600) == -1);
+  ASSERT (errno == ENOENT || errno == ENOTDIR);
+
+  /* Test trailing slash behavior.  */
+  if (symlink (BASE "fifo", BASE "link"))
+    {
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  errno = 0;
+  ASSERT (func (BASE "link", 0600) == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (func (BASE "link/", 0600) == -1);
+  ASSERT (errno == EEXIST || errno == ENOENT || errno == ENOTDIR);
+  errno = 0;
+  ASSERT (unlink (BASE "fifo") == -1);
+  ASSERT (errno == ENOENT);
+  ASSERT (unlink (BASE "link") == 0);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 0824162b2aa8d2a63a1bd0e663590d81634e3e72..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mkfifoat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..efcc016fdfbcce05939a1f77a2dd64fa53bb1298
--- /dev/null
@@ -0,0 +1,149 @@
+/* Tests of mkfifoat and mknodat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mkfifoat, int, (int, char const *, mode_t));
+SIGNATURE_CHECK (mknodat, int, (int, char const *, mode_t, dev_t));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-mkfifoat.t"
+
+#include "test-mkfifo.h"
+
+typedef int (*test_func) (int, char const *, mode_t);
+
+static int dfd = AT_FDCWD;
+
+/* Wrapper to test mknodat like mkfifoat.  */
+static int
+test_mknodat (int fd, char const *name, mode_t mode)
+{
+  /* This is the only portable use of mknodat, per POSIX.  */
+  return mknodat (fd, name, mode | S_IFIFO, 0);
+}
+
+/* Wrapper to test mkfifoat like mkfifo.  */
+static int
+do_mkfifoat (char const *name, mode_t mode)
+{
+  return mkfifoat (dfd, name, mode);
+}
+
+/* Wrapper to test mknodat like mkfifo.  */
+static int
+do_mknodat (char const *name, mode_t mode)
+{
+  return mknodat (dfd, name, mode | S_IFIFO, 0);
+}
+
+int
+main (void)
+{
+  int i;
+  test_func funcs[2] = { mkfifoat, test_mknodat };
+  int result;
+
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Basic tests.  */
+  result = test_mkfifo (do_mkfifoat, true);
+  ASSERT (test_mkfifo (do_mknodat, false) == result);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_mkfifo (do_mkfifoat, false) == result);
+  ASSERT (test_mkfifo (do_mknodat, false) == result);
+
+  /* Test directory-relative handling of both functions.  */
+  for (i = 0; i < 2; i++)
+    {
+      struct stat st;
+      test_func func = funcs[i];
+
+      /* Test behaviour for invalid file descriptors.  */
+      {
+        errno = 0;
+        ASSERT (func (-1, "foo", 0600) == -1);
+        ASSERT (errno == EBADF
+                || errno == ENOSYS /* seen on mingw */
+               );
+      }
+      {
+        close (99);
+        errno = 0;
+        ASSERT (func (99, "foo", 0600) == -1);
+        ASSERT (errno == EBADF
+                || errno == ENOSYS /* seen on mingw */
+               );
+      }
+
+      /* Create fifo while cwd is '.', then stat it from '..'.  */
+      if (func (AT_FDCWD, BASE "fifo", 0600) != 0)
+        ASSERT (errno == ENOSYS); /* seen on native Windows */
+      else
+        {
+          errno = 0;
+          ASSERT (func (dfd, BASE "fifo", 0600) == -1);
+          ASSERT (errno == EEXIST);
+          ASSERT (chdir ("..") == 0);
+          errno = 0;
+          ASSERT (fstatat (AT_FDCWD, BASE "fifo", &st, 0) == -1);
+          ASSERT (errno == ENOENT);
+          memset (&st, 0, sizeof st);
+          ASSERT (fstatat (dfd, BASE "fifo", &st, 0) == 0);
+          ASSERT (S_ISFIFO (st.st_mode));
+          ASSERT (unlinkat (dfd, BASE "fifo", 0) == 0);
+        }
+
+      /* Create fifo while cwd is '..', then stat it from '.'.  */
+      if (func (dfd, BASE "fifo", 0600) != 0)
+        ASSERT (errno == ENOSYS); /* seen on native Windows */
+      else
+        {
+          ASSERT (fchdir (dfd) == 0);
+          errno = 0;
+          ASSERT (func (AT_FDCWD, BASE "fifo", 0600) == -1);
+          ASSERT (errno == EEXIST);
+          memset (&st, 0, sizeof st);
+          ASSERT (fstatat (AT_FDCWD, BASE "fifo", &st, AT_SYMLINK_NOFOLLOW)
+                  == 0);
+          ASSERT (S_ISFIFO (st.st_mode));
+          memset (&st, 0, sizeof st);
+          ASSERT (fstatat (dfd, BASE "fifo", &st, AT_SYMLINK_NOFOLLOW) == 0);
+          ASSERT (S_ISFIFO (st.st_mode));
+          ASSERT (unlink (BASE "fifo") == 0);
+        }
+    }
+
+  ASSERT (close (dfd) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index fadda2525df02db7af9fcf9f92413beb93aac14c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-mknod.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4a0db1894c587d258f355e8247f30cc922423e89
--- /dev/null
@@ -0,0 +1,55 @@
+/* Tests of mknod.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (mknod, int, (char const *, mode_t, dev_t));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-mknod.t"
+
+#include "test-mkfifo.h"
+
+/* Wrapper around mknod, to create fifos.  */
+static int
+do_mknod (char const *name, mode_t mode)
+{
+  return mknod (name, mode | S_IFIFO, 0);
+}
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* We can only portably test creation of fifos.  Anything else
+     requires root privileges and knowledge of device numbers.  */
+  return test_mkfifo (do_mknod, true);
+}
deleted file mode 120000 (symlink)
index a6833507a6f9f0a35db3528e28125d706a6a68c7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-nanosleep.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c3953843b8db9afe219f9afec7242f045163e6fc
--- /dev/null
@@ -0,0 +1,94 @@
+/* Test of nanosleep() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <time.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (nanosleep, int, (struct timespec const *, struct timespec *));
+
+#include <errno.h>
+#include <signal.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#if HAVE_DECL_ALARM
+static void
+handle_alarm (int sig)
+{
+  if (sig != SIGALRM)
+    _exit (1);
+}
+#endif
+
+int
+main (void)
+{
+  struct timespec ts;
+
+  /* Check that negative nanosecond values cause failure.  */
+  ts.tv_sec = 1;
+  ts.tv_nsec = -1;
+  errno = 0;
+  ASSERT (nanosleep (&ts, NULL) == -1);
+  ASSERT (errno == EINVAL);
+
+  ts.tv_sec = 1000;
+  ts.tv_nsec = -1;
+  errno = 0;
+  ASSERT (nanosleep (&ts, NULL) == -1);
+  ASSERT (errno == EINVAL);
+
+  /* Check that too large nanosecond values cause failure.  */
+  ts.tv_sec = 1000;
+  ts.tv_nsec = 1000000000;
+  errno = 0;
+  ASSERT (nanosleep (&ts, NULL) == -1);
+  ASSERT (errno == EINVAL);
+
+  /* Check successful call.  */
+  ts.tv_sec = 0;
+  ts.tv_nsec = 1;
+  ASSERT (nanosleep (&ts, &ts) == 0);
+  /* Remaining time is only defined on EINTR failure; but on success,
+     it is typically either 0 or unchanged from input.  At any rate,
+     it shouldn't be randomly changed to unrelated values.  */
+  ASSERT (ts.tv_sec == 0);
+  ASSERT (ts.tv_nsec == 0 || ts.tv_nsec == 1);
+  ts.tv_nsec = 0;
+  ASSERT (nanosleep (&ts, NULL) == 0);
+
+#if HAVE_DECL_ALARM
+  {
+    const time_t pentecost = 50 * 24 * 60 * 60; /* 50 days.  */
+    signal (SIGALRM, handle_alarm);
+    alarm (1);
+    ts.tv_sec = pentecost;
+    ts.tv_nsec = 999999999;
+    errno = 0;
+    ASSERT (nanosleep (&ts, &ts) == -1);
+    ASSERT (errno == EINTR);
+    ASSERT (pentecost - 10 < ts.tv_sec && ts.tv_sec <= pentecost);
+    ASSERT (0 <= ts.tv_nsec && ts.tv_nsec <= 999999999);
+  }
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 6964581f088efc79cd86f40aa7489014389709d0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-netdb.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9517057a5e769b2ed811de8a72f3cf9da890a147
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test of <netdb.h> substitute.
+   Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2008.  */
+
+#include <config.h>
+#include <netdb.h>
+
+/* Check that the 'struct hostent' type is defined.  */
+struct hostent t1;
+
+/* Check that the 'socklen_t' type is defined.  */
+socklen_t t2;
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5d2f82974c954069f8657c7efc7c66d9713658fa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-netinet_in.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6842821e9138cf01845d4267912a58a1f78dda5d
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test of <netinet/in.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <netinet/in.h>
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 004745a54420f892d609f817de336a01c9d23e5d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-nl_langinfo-mt.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b7e16fccceeec6ccc3e1ff36684b7ab6ee25a853
--- /dev/null
@@ -0,0 +1,253 @@
+/* Multithread-safety test for nl_langinfo().
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* Work around GCC bug 44511.  */
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wreturn-type"
+#endif
+
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
+/* Specification.  */
+#include <langinfo.h>
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "glthread/thread.h"
+
+
+/* Some common locale names.  */
+
+#if defined _WIN32 && !defined __CYGWIN__
+# define ENGLISH "English_United States"
+# define FRENCH  "French_France"
+# define GERMAN  "German_Germany"
+# define ENCODING ".1252"
+#else
+# define ENGLISH "en_US"
+# define FRENCH  "fr_FR"
+# define GERMAN  "de_DE"
+# if defined __sgi
+#  define ENCODING ".ISO8859-15"
+# elif defined __hpux
+#  define ENCODING ".utf8"
+# else
+#  define ENCODING ".UTF-8"
+# endif
+#endif
+
+static const char LOCALE1[] = ENGLISH ENCODING;
+static const char LOCALE2[] = FRENCH ENCODING;
+static const char LOCALE3[] = GERMAN ENCODING;
+
+static char *expected1;
+
+static void *
+thread1_func (void *arg)
+{
+  for (;;)
+    {
+      const char *value = nl_langinfo (CODESET);
+      if (strcmp (expected1, value) != 0)
+        {
+          fprintf (stderr, "thread1 disturbed by threadN!\n"); fflush (stderr);
+          abort ();
+        }
+    }
+
+  /*NOTREACHED*/
+}
+
+static char *expected2;
+
+static void *
+thread2_func (void *arg)
+{
+  for (;;)
+    {
+      const char *value = nl_langinfo (PM_STR);
+      if (strcmp (expected2, value) != 0)
+        {
+          fprintf (stderr, "thread2 disturbed by threadN!\n"); fflush (stderr);
+          abort ();
+        }
+    }
+
+  /*NOTREACHED*/
+}
+
+static char *expected3;
+
+static void *
+thread3_func (void *arg)
+{
+  for (;;)
+    {
+      const char *value = nl_langinfo (DAY_2);
+      if (strcmp (expected3, value) != 0)
+        {
+          fprintf (stderr, "thread3 disturbed by threadN!\n"); fflush (stderr);
+          abort ();
+        }
+    }
+
+  /*NOTREACHED*/
+}
+
+static char *expected4;
+
+static void *
+thread4_func (void *arg)
+{
+  for (;;)
+    {
+      const char *value = nl_langinfo (ALTMON_2);
+      if (strcmp (expected4, value) != 0)
+        {
+          fprintf (stderr, "thread4 disturbed by threadN!\n"); fflush (stderr);
+          abort ();
+        }
+    }
+
+  /*NOTREACHED*/
+}
+
+static char *expected5;
+
+static void *
+thread5_func (void *arg)
+{
+  for (;;)
+    {
+      const char *value = nl_langinfo (CRNCYSTR);
+      if (strcmp (expected5, value) != 0)
+        {
+          fprintf (stderr, "thread5 disturbed by threadN!\n"); fflush (stderr);
+          abort ();
+        }
+    }
+
+  /*NOTREACHED*/
+}
+
+static char *expected6;
+
+static void *
+thread6_func (void *arg)
+{
+  for (;;)
+    {
+      const char *value = nl_langinfo (RADIXCHAR);
+      if (strcmp (expected6, value) != 0)
+        {
+          fprintf (stderr, "thread6 disturbed by threadN!\n"); fflush (stderr);
+          abort ();
+        }
+    }
+
+  /*NOTREACHED*/
+}
+
+static void *
+threadN_func (void *arg)
+{
+  for (;;)
+    {
+      nl_langinfo (CODESET);   /* LC_CTYPE */    /* locale charmap */
+      nl_langinfo (AM_STR);    /* LC_TIME */     /* locale -k am_pm */
+      nl_langinfo (PM_STR);    /* LC_TIME */     /* locale -k am_pm */
+      nl_langinfo (DAY_2);     /* LC_TIME */     /* locale -k day */
+      nl_langinfo (DAY_5);     /* LC_TIME */     /* locale -k day */
+      nl_langinfo (ALTMON_2);  /* LC_TIME */     /* locale -k alt_mon */
+      nl_langinfo (ALTMON_9);  /* LC_TIME */     /* locale -k alt_mon */
+      nl_langinfo (CRNCYSTR);  /* LC_MONETARY */ /* locale -k currency_symbol */
+      nl_langinfo (RADIXCHAR); /* LC_NUMERIC */  /* locale -k decimal_point */
+      nl_langinfo (THOUSEP);   /* LC_NUMERIC */  /* locale -k thousands_sep */
+    }
+
+  /*NOTREACHED*/
+}
+
+int
+main (int argc, char *argv[])
+{
+  if (setlocale (LC_ALL, LOCALE1) == NULL)
+    {
+      fprintf (stderr, "Skipping test: LOCALE1 not recognized\n");
+      return 77;
+    }
+  if (setlocale (LC_MONETARY, LOCALE2) == NULL)
+    {
+      fprintf (stderr, "Skipping test: LOCALE2 not recognized\n");
+      return 77;
+    }
+  if (setlocale (LC_NUMERIC, LOCALE3) == NULL)
+    {
+      fprintf (stderr, "Skipping test: LOCALE3 not recognized\n");
+      return 77;
+    }
+
+  expected1 = strdup (nl_langinfo (CODESET));
+  expected2 = strdup (nl_langinfo (PM_STR));
+  expected3 = strdup (nl_langinfo (DAY_2));
+  expected4 = strdup (nl_langinfo (ALTMON_2));
+  expected5 = strdup (nl_langinfo (CRNCYSTR));
+  expected6 = strdup (nl_langinfo (RADIXCHAR));
+
+  /* Create the checker threads.  */
+  gl_thread_create (thread1_func, NULL);
+  gl_thread_create (thread2_func, NULL);
+  gl_thread_create (thread3_func, NULL);
+  gl_thread_create (thread4_func, NULL);
+  gl_thread_create (thread5_func, NULL);
+  gl_thread_create (thread6_func, NULL);
+  /* Create the disturber thread.  */
+  gl_thread_create (threadN_func, NULL);
+
+  /* Let them run for 2 seconds.  */
+  {
+    struct timespec duration;
+    duration.tv_sec = (argc > 1 ? atoi (argv[1]) : 2);
+    duration.tv_nsec = 0;
+
+    nanosleep (&duration, NULL);
+  }
+
+  return 0;
+}
+
+#else
+
+/* No multithreading available.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 950f8718d6d14bcd628a9356e1521a620c8a3f7e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-nl_langinfo1.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..367e0c0c40fda03031173c9b4d94cca1ad4cd45b
--- /dev/null
@@ -0,0 +1,152 @@
+/* Test of nl_langinfo replacement.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <langinfo.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (nl_langinfo, char *, (nl_item));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "c-strcase.h"
+#include "macros.h"
+
+/* For GCC >= 4.3, silence the warnings
+     "comparison of unsigned expression >= 0 is always true"
+   in this file.  */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+# pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
+int
+main (int argc, char *argv[])
+{
+  int pass = atoi (argv[1]);
+  /* pass    locale
+      0        C
+      1        traditional French locale
+      2        French UTF-8 locale
+   */
+
+  setlocale (LC_ALL, "");
+
+  /* nl_langinfo items of the LC_CTYPE category */
+  ASSERT (strlen (nl_langinfo (CODESET)) > 0);
+  if (pass == 2)
+    {
+      const char *codeset = nl_langinfo (CODESET);
+      ASSERT (c_strcasecmp (codeset, "UTF-8") == 0 || c_strcasecmp (codeset, "UTF8") == 0);
+    }
+  /* nl_langinfo items of the LC_NUMERIC category */
+  ASSERT (strlen (nl_langinfo (RADIXCHAR)) > 0);
+  ASSERT (strlen (nl_langinfo (THOUSEP)) >= 0);
+  /* nl_langinfo items of the LC_TIME category */
+  ASSERT (strlen (nl_langinfo (D_T_FMT)) > 0);
+  ASSERT (strlen (nl_langinfo (D_FMT)) > 0);
+  ASSERT (strlen (nl_langinfo (T_FMT)) > 0);
+  ASSERT (strlen (nl_langinfo (T_FMT_AMPM)) >= (pass == 0 ? 1 : 0));
+  ASSERT (strlen (nl_langinfo (AM_STR)) >= (pass == 0 ? 1 : 0));
+  ASSERT (strlen (nl_langinfo (PM_STR)) >= (pass == 0 ? 1 : 0));
+  ASSERT (strlen (nl_langinfo (DAY_1)) > 0);
+  ASSERT (strlen (nl_langinfo (DAY_2)) > 0);
+  ASSERT (strlen (nl_langinfo (DAY_3)) > 0);
+  ASSERT (strlen (nl_langinfo (DAY_4)) > 0);
+  ASSERT (strlen (nl_langinfo (DAY_5)) > 0);
+  ASSERT (strlen (nl_langinfo (DAY_6)) > 0);
+  ASSERT (strlen (nl_langinfo (DAY_7)) > 0);
+  ASSERT (strlen (nl_langinfo (ABDAY_1)) > 0);
+  ASSERT (strlen (nl_langinfo (ABDAY_2)) > 0);
+  ASSERT (strlen (nl_langinfo (ABDAY_3)) > 0);
+  ASSERT (strlen (nl_langinfo (ABDAY_4)) > 0);
+  ASSERT (strlen (nl_langinfo (ABDAY_5)) > 0);
+  ASSERT (strlen (nl_langinfo (ABDAY_6)) > 0);
+  ASSERT (strlen (nl_langinfo (ABDAY_7)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_1)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_2)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_3)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_4)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_5)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_6)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_7)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_8)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_9)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_10)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_11)) > 0);
+  ASSERT (strlen (nl_langinfo (MON_12)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_1)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_2)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_3)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_4)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_5)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_6)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_7)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_8)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_9)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_10)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_11)) > 0);
+  ASSERT (strlen (nl_langinfo (ALTMON_12)) > 0);
+  /* In the tested locales, alternate month names and month names ought to be
+     the same.  */
+  ASSERT (strcmp (nl_langinfo (ALTMON_1), nl_langinfo (MON_1)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_2), nl_langinfo (MON_2)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_3), nl_langinfo (MON_3)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_4), nl_langinfo (MON_4)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_5), nl_langinfo (MON_5)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_6), nl_langinfo (MON_6)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_7), nl_langinfo (MON_7)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_8), nl_langinfo (MON_8)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_9), nl_langinfo (MON_9)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_10), nl_langinfo (MON_10)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_11), nl_langinfo (MON_11)) == 0);
+  ASSERT (strcmp (nl_langinfo (ALTMON_12), nl_langinfo (MON_12)) == 0);
+  ASSERT (strlen (nl_langinfo (ABMON_1)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_2)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_3)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_4)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_5)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_6)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_7)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_8)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_9)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_10)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_11)) > 0);
+  ASSERT (strlen (nl_langinfo (ABMON_12)) > 0);
+  ASSERT (strlen (nl_langinfo (ERA)) >= 0);
+  ASSERT (strlen (nl_langinfo (ERA_D_FMT)) >= 0);
+  ASSERT (strlen (nl_langinfo (ERA_D_T_FMT)) >= 0);
+  ASSERT (strlen (nl_langinfo (ERA_T_FMT)) >= 0);
+  ASSERT (nl_langinfo (ALT_DIGITS) != NULL);
+  /* nl_langinfo items of the LC_MONETARY category */
+  {
+    const char *currency = nl_langinfo (CRNCYSTR);
+    ASSERT (strlen (currency) >= 0);
+#if !(defined MUSL_LIBC || defined __NetBSD__)
+    if (pass > 0)
+      ASSERT (strlen (currency) >= 1);
+#endif
+  }
+  /* nl_langinfo items of the LC_MESSAGES category */
+  ASSERT (strlen (nl_langinfo (YESEXPR)) > 0);
+  ASSERT (strlen (nl_langinfo (NOEXPR)) > 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index bca933972ee19a537f169811ab8784d1b9860fc5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-nl_langinfo1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..9acfcdd949733ec673b4a689122152abbd8382b5
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+LC_ALL=C ${CHECKER} ./test-nl_langinfo1${EXEEXT} 0 || exit 1
+
+# Test whether a specific traditional locale is installed.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR ${CHECKER} ./test-nl_langinfo1${EXEEXT} 1 || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 ${CHECKER} ./test-nl_langinfo1${EXEEXT} 2 || exit 1
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 79888815f6c460c1f6a4f90145e980c4a4269660..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-nl_langinfo2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0b8688a6fd8a98a5564d38aed3df61b92bc398e5
--- /dev/null
@@ -0,0 +1,146 @@
+/* Test of nl_langinfo replacement.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <langinfo.h>
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "c-strcase.h"
+#include "c-strcasestr.h"
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+#if HAVE_WORKING_USELOCALE
+  /* Check that nl_langinfo() uses the per-thread locale.  */
+  int pass;
+  bool skipped_all = true;
+
+  /* Extract a few items from the C locale.  */
+  /* nl_langinfo items of the LC_CTYPE category */
+  const char *c_CODESET = nl_langinfo (CODESET);
+  /* nl_langinfo items of the LC_NUMERIC category */
+  const char *c_RADIXCHAR = nl_langinfo (RADIXCHAR);
+  /* nl_langinfo items of the LC_TIME category */
+  const char *c_T_FMT_AMPM = nl_langinfo (T_FMT_AMPM);
+  const char *c_AM_STR = nl_langinfo (AM_STR);
+  const char *c_PM_STR = nl_langinfo (PM_STR);
+  /* nl_langinfo items of the LC_MONETARY category */
+  const char *c_CRNCYSTR = nl_langinfo (CRNCYSTR);
+  /* nl_langinfo items of the LC_MESSAGES category */
+  const char *c_YESEXPR = nl_langinfo (YESEXPR);
+
+  /* Sanity checks.  */
+  (void) c_CODESET;
+  ASSERT (strcmp (c_RADIXCHAR, ".") == 0);
+  ASSERT (strlen (c_T_FMT_AMPM) > 0);
+  ASSERT (strlen (c_AM_STR) > 0);
+  ASSERT (strlen (c_PM_STR) > 0);
+  ASSERT (strlen (c_CRNCYSTR) <= 1); /* "-", "+", ".", or "" */
+  ASSERT (c_strcasestr (c_YESEXPR, "y" /* from "yes" */) != NULL);
+
+  for (pass = 1; pass <= 2; pass++)
+    {
+      /* pass    locale
+          1        traditional French locale
+          2        French UTF-8 locale
+       */
+      const char *fr_locale_name =
+        getenv (pass == 1 ? "LOCALE_FR" : "LOCALE_FR_UTF8");
+      if (strcmp (fr_locale_name, "none") != 0)
+        {
+          /* Use a per-thread locale.  */
+          locale_t fr_locale = newlocale (LC_ALL_MASK, fr_locale_name, NULL);
+          if (fr_locale != NULL)
+            {
+              uselocale (fr_locale);
+
+              /* Extract a few items from the current locale, and check the
+                 values.  */
+
+              /* nl_langinfo items of the LC_CTYPE category */
+              const char *fr_CODESET = nl_langinfo (CODESET);
+              if (pass == 1)
+                ASSERT (strstr (fr_CODESET, "8859") != NULL);
+              else if (pass == 2)
+                ASSERT (c_strcasecmp (fr_CODESET, "UTF-8") == 0
+                        || c_strcasecmp (fr_CODESET, "UTF8") == 0);
+
+              /* In musl libc, locales differ at most in the LC_MESSAGES
+                 category.  */
+              #if !defined MUSL_LIBC
+
+              /* nl_langinfo items of the LC_NUMERIC category */
+              const char *fr_RADIXCHAR = nl_langinfo (RADIXCHAR);
+              ASSERT (strcmp (fr_RADIXCHAR, ",") == 0);
+
+              /* nl_langinfo items of the LC_TIME category */
+              /* macOS and Solaris 11 don't get the LC_TIME values right.
+                 Poor.  */
+              #if !((defined __APPLE__ && defined __MACH__) || defined __sun)
+              const char *fr_T_FMT_AMPM = nl_langinfo (T_FMT_AMPM);
+              const char *fr_AM_STR = nl_langinfo (AM_STR);
+              const char *fr_PM_STR = nl_langinfo (PM_STR);
+              ASSERT (strlen (fr_T_FMT_AMPM) == 0
+                      || strcmp (fr_T_FMT_AMPM, "%I:%M:%S") == 0);
+              ASSERT (strlen (fr_AM_STR) == 0);
+              ASSERT (strlen (fr_PM_STR) == 0);
+              #endif
+
+              /* nl_langinfo items of the LC_MONETARY category */
+              /* macOS doesn't get the EUR currency symbol or abbreviation
+                 right.  Very poor.  */
+              #if !(defined __APPLE__ && defined __MACH__)
+              const char *fr_CRNCYSTR = nl_langinfo (CRNCYSTR);
+              if (pass == 2)
+                ASSERT (strlen (fr_CRNCYSTR) >= 1
+                        && strcmp (fr_CRNCYSTR + 1, "€") == 0);
+              #endif
+
+              #endif
+
+              /* nl_langinfo items of the LC_MESSAGES category */
+              /* In musl libc, this works only if the package 'musl-locales' is
+                 installed.  */
+              #if !defined MUSL_LIBC
+              const char *fr_YESEXPR = nl_langinfo (YESEXPR);
+              ASSERT (c_strcasestr (fr_YESEXPR, "o" /* from "oui" */) != NULL);
+              #endif
+
+              skipped_all = false;
+            }
+        }
+    }
+
+  if (skipped_all)
+    {
+      fputs ("Skipping test: French locale is not installed\n", stderr);
+      return 77;
+    }
+
+  return 0;
+#else
+  fputs ("Skipping test: uselocale() not available\n", stderr);
+  return 77;
+#endif
+}
deleted file mode 120000 (symlink)
index 5da0932c069496b4cacd9b3ad2e14ee5a45f34f1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-nl_langinfo2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..6333c9006d5d9cb15ad6d11d1205f5e9df26ae04
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# The name of a specific traditional locale.
+: "${LOCALE_FR=fr_FR}"
+
+# The name of a specific UTF-8 locale.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+
+# Make them accessible as environment variables.
+export LOCALE_FR LOCALE_FR_UTF8
+
+${CHECKER} ./test-nl_langinfo2${EXEEXT}
deleted file mode 120000 (symlink)
index 203501fe28d8d25cc350ddc08aa10fc1e8d59bdb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-nstrftime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..87d6a351885772e3662c837e720e95e03712377d
--- /dev/null
@@ -0,0 +1,349 @@
+/* Test that nstrftime works as required.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "strftime.h"
+
+#include "intprops.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "macros.h"
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
+/* Support for settings like TZ='<+00>0' was added in IEEE Std 1003.1-2001.  */
+#define TZ_ANGLE_BRACKETS_SHOULD_WORK (200112 <= _POSIX_VERSION)
+
+struct posixtm_test
+{
+  time_t in;
+  int in_ns;
+  char const *fmt;
+  char const *exp;
+};
+
+static struct posixtm_test const T[] =
+  {
+    { 1300000000, 0,            "%F", "2011-03-13" },
+    { 0,          10,           "%T.%N", "00:00:00.000000010" },
+    { 56,         123456789,    "%T.%12N", "00:00:56.123456789000" },
+    { 0,          0,            NULL, NULL }
+  };
+
+static int
+posixtm_test (void)
+{
+  int fail = 0;
+  unsigned int i;
+
+  for (i = 0; T[i].fmt; i++)
+    {
+      char buf[1000];
+      time_t t = T[i].in;
+      struct tm *tm = gmtime (&t);
+      size_t n;
+
+      ASSERT (tm);
+
+      n = nstrftime (buf, sizeof buf, T[i].fmt, tm, 0, T[i].in_ns);
+      if (n == 0)
+        {
+          fail = 1;
+          printf ("nstrftime failed with format %s\n", T[i].fmt);
+        }
+
+      if (! STREQ (buf, T[i].exp))
+        {
+          fail = 1;
+          printf ("%s: result mismatch: got %s, expected %s\n",
+                  T[i].fmt, buf, T[i].exp);
+        }
+    }
+
+  return fail;
+}
+
+struct tzalloc_test
+{
+  timezone_t tz;
+  char const *setting;
+};
+
+static struct tzalloc_test TZ[] =
+  {
+#define Pacific 0
+    { 0, "PST8PDT,M3.2.0,M11.1.0"      },
+#define Arizona 1
+    { 0, "MST7"                        },
+#define UTC 2
+    { 0, 0                             },
+#define CentEur 3
+    { 0, "CET-1CEST,M3.5.0,M10.5.0/3"  },
+#define Japan 4
+    { 0, "JST-9"                       },
+#define NZ 5
+    { 0, "NZST-12NZDT,M9.5.0,M4.1.0/3" },
+#define Unknown 6
+    { 0, "<-00>0" },
+    { 0 }
+  };
+
+struct localtime_rz_test
+{
+  /* Input parameters.  */
+  struct tzalloc_test *tza;
+  time_t t;
+
+  /* Expected result.  */
+  char const *exp;
+
+  /* Determines if an incorrectly unset tm_isdst
+     results in failure or just a warning.  */
+  int ahistorical;
+};
+
+static struct localtime_rz_test LT[] =
+  {
+#if !(defined __DragonFly__ || defined __NetBSD__ || defined __ANDROID__)
+    { TZ+Pacific,          0, "1969-12-31 16:00:00 -0800 (PST)",  0 },
+#endif
+    { TZ+Arizona,          0, "1969-12-31 17:00:00 -0700 (MST)",  0 },
+    { TZ+UTC    ,          0, "1970-01-01 00:00:00 +0000 (UTC)",  0 },
+#if !(defined __DragonFly__ || defined __NetBSD__ || defined __ANDROID__)
+    { TZ+CentEur,          0, "1970-01-01 01:00:00 +0100 (CET)",  0 },
+#endif
+    { TZ+Japan  ,          0, "1970-01-01 09:00:00 +0900 (JST)",  0 },
+#if !defined __FreeBSD__
+    { TZ+NZ     ,          0, "1970-01-01 13:00:00 +1300 (NZDT)", 1 },
+#endif
+    { TZ+Pacific,  500000001, "1985-11-04 16:53:21 -0800 (PST)",  0 },
+    { TZ+Arizona,  500000001, "1985-11-04 17:53:21 -0700 (MST)",  0 },
+    { TZ+UTC    ,  500000001, "1985-11-05 00:53:21 +0000 (UTC)",  0 },
+    { TZ+CentEur,  500000001, "1985-11-05 01:53:21 +0100 (CET)",  1 },
+    { TZ+Japan  ,  500000001, "1985-11-05 09:53:21 +0900 (JST)",  0 },
+    { TZ+NZ     ,  500000001, "1985-11-05 13:53:21 +1300 (NZDT)", 0 },
+    { TZ+Pacific, 1000000002, "2001-09-08 18:46:42 -0700 (PDT)",  0 },
+    { TZ+Arizona, 1000000002, "2001-09-08 18:46:42 -0700 (MST)",  0 },
+    { TZ+UTC    , 1000000002, "2001-09-09 01:46:42 +0000 (UTC)",  0 },
+    { TZ+CentEur, 1000000002, "2001-09-09 03:46:42 +0200 (CEST)", 0 },
+    { TZ+Japan  , 1000000002, "2001-09-09 10:46:42 +0900 (JST)",  0 },
+    { TZ+NZ     , 1000000002, "2001-09-09 13:46:42 +1200 (NZST)", 0 },
+#if TZ_ANGLE_BRACKETS_SHOULD_WORK && !defined __FreeBSD__
+    { TZ+Unknown,          0, "1970-01-01 00:00:00 -0000 (-00)",  0 },
+    { TZ+Unknown,  500000001, "1985-11-05 00:53:21 -0000 (-00)",  0 },
+    { TZ+Unknown, 1000000002, "2001-09-09 01:46:42 -0000 (-00)",  0 },
+#endif
+    { 0 }
+  };
+
+static int
+tzalloc_test (void)
+{
+  int fail = 0;
+  int i;
+
+  for (i = 0; LT[i].tza; i++)
+    {
+      struct tzalloc_test *tza = LT[i].tza;
+      long lt = LT[i].t;
+      timezone_t tz = tza->tz;
+      char const *setting;
+      static char const format[] = "%Y-%m-%d %H:%M:%S %z (%Z)";
+      char buf[1000];
+      struct tm tm;
+      size_t n;
+
+      if (!tz && tza->setting)
+        {
+          tz = tzalloc (tza->setting);
+          if (!tz)
+            {
+              fail = 1;
+              printf ("%s: tzalloc: %s\n", TZ[i].setting, strerror (errno));
+              continue;
+            }
+          tza->tz = tz;
+        }
+
+      setting = tza->setting ? tza->setting : "UTC0";
+
+      if (!localtime_rz (tz, &LT[i].t, &tm))
+        {
+          fail = 1;
+          printf ("%s: %ld: localtime_rz: %s\n", setting, lt,
+                  strerror (errno));
+          continue;
+        }
+
+      n = nstrftime (buf, sizeof buf, format, &tm, tz, 0);
+      if (n == 0)
+        {
+          fail = 1;
+          printf ("%s: %ld: nstrftime failed\n", setting, lt);
+          continue;
+        }
+
+      if (! (STREQ (buf, LT[i].exp)
+             || (!tz && n == strlen (LT[i].exp)
+                 && memcmp (buf, LT[i].exp, n - sizeof "(GMT)" + 1) == 0
+                 && STREQ (buf + n - sizeof "(GMT)" + 1, "(GMT)"))))
+        {
+          /* Don't fail for unhandled dst in ahistorical entries,
+             as gnulib doesn't currently fix that issue, seen on Darwin 14.  */
+          if (!LT[i].ahistorical || tm.tm_isdst)
+            fail = 1;
+          printf ("%s: expected \"%s\", got \"%s\"\n",
+                  setting, LT[i].exp, buf);
+        }
+    }
+
+  return fail;
+}
+
+
+static int
+quarter_test (void)
+{
+  int result = 0;
+  size_t mon;
+
+  /* Check %q.  */
+  for (mon = 1; mon <= 12; mon++)
+    {
+      char out[2];
+      char exp[2] = {0,};
+      struct tm qtm = { .tm_mon = mon - 1 };
+      char fmt[3] = {'%','q','\0'};
+
+      size_t r = nstrftime (out, sizeof (out), fmt, &qtm, 0, 0);
+      if (r == 0)
+        {
+          puts ("nstrftime(\"%q\") failed");
+          result = 1;
+          break;
+        }
+
+      exp[0] = mon < 4 ? '1' : mon < 7 ? '2' : mon < 10 ? '3' : '4';
+      if (strcmp (out, exp) != 0)
+        {
+          printf ("nstrftime %%q: expected \"%s\", got \"%s\"\n", exp, out);
+          result = 1;
+          break;
+        }
+    }
+
+  return result;
+}
+
+static int
+errno_test (void)
+{
+  int fail = 0;
+  struct tm tm = { .tm_year = 2020 - 1900, .tm_mday = 1 };
+  char buf[INT_BUFSIZE_BOUND (time_t)];
+  size_t n;
+  int bigyear = LLONG_MAX - 1900 < INT_MAX ? LLONG_MAX - 1900 : INT_MAX;
+
+  errno = 0;
+  n = nstrftime (buf, 0, "%m", &tm, 0, 0);
+  if (! (n == 0 && errno == ERANGE))
+    {
+      fail = 1;
+      printf ("nstrftime failed to set errno = ERANGE\n");
+    }
+
+  errno = 0;
+  n = nstrftime (buf, sizeof buf, "", &tm, 0, 0);
+  if (! (n == 0 && errno == 0))
+    {
+      fail = 1;
+      printf ("nstrftime failed to leave errno alone\n");
+    }
+
+
+  tm.tm_year = bigyear;
+  errno = 0;
+  n = nstrftime (buf, sizeof buf, "%s", &tm, 0, 0);
+  if (n == 0)
+    {
+      if (errno != EOVERFLOW)
+        {
+          fail = 1;
+          printf ("nstrftime failed to set errno = EOVERFLOW\n");
+        }
+
+      if (mktime_z (0, &tm) != (time_t) -1)
+        {
+          fail = 1;
+          printf ("nstrftime %%s failed but mktime_z worked for tm_year=%d\n",
+                  bigyear);
+        }
+    }
+  else
+    {
+      long long int text_seconds = atoll (buf);
+      if (text_seconds <= (LLONG_MAX - 1 < TYPE_MAXIMUM (time_t)
+                           ? LLONG_MAX - 1 : TYPE_MAXIMUM (time_t)))
+        {
+          time_t bigtime = text_seconds;
+          struct tm *tmp = gmtime (&bigtime);
+          if (!tmp)
+            {
+              fail = 1;
+              printf ("gmtime failed on nstrftime result\n");
+            }
+          else
+            {
+              char buf1[sizeof buf];
+              size_t n1 = nstrftime (buf1, sizeof buf1, "%s", tmp, 0, 0);
+              buf1[n1] = '\0';
+              if (! STREQ (buf, buf1))
+                {
+                  fail = 1;
+                  printf ("nstrftime %%s first returned '%s', then '%s'\n",
+                          buf, buf1);
+                }
+            }
+        }
+    }
+
+  return fail;
+}
+
+int
+main (void)
+{
+  int fail = 0;
+  fail |= posixtm_test ();
+  fail |= tzalloc_test ();
+  fail |= quarter_test ();
+  fail |= errno_test ();
+  return fail;
+}
+
+/*
+Local Variables:
+indent-tabs-mode: nil
+End:
+*/
deleted file mode 120000 (symlink)
index 3a5ff35b88bc74d6b0ef16a8d8f71dc2940f795f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-nullptr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5c8f99e65fadd3ae1aceba57425f3d2ee1801646
--- /dev/null
@@ -0,0 +1,69 @@
+/* Test nullptr.
+   Copyright 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible.  */
+
+#include <config.h>
+
+int *my_null = nullptr;
+
+#if 0 /* not yet */
+/* Header that is supposed to define nullptr_t.  */
+# include <stddef.h>
+#endif
+
+#include <stdarg.h>
+
+#include "macros.h"
+
+#if 0 /* not yet */
+
+static void
+simple_callee (nullptr_t x)
+{
+  ASSERT (x == NULL);
+}
+
+#endif
+
+static void
+varargs_callee (const char *first, ...)
+{
+  va_list args;
+  const char *arg;
+
+  ASSERT (first[0] == 't');
+  va_start (args, first);
+
+  arg = va_arg (args, const char *);
+  ASSERT (arg == NULL);
+
+  arg = va_arg (args, const char *);
+  ASSERT (arg[0] == 'f');
+
+  arg = va_arg (args, const char *);
+  ASSERT (arg == NULL);
+
+  va_end (args);
+}
+
+int
+main ()
+{
+  varargs_callee ("type", nullptr, "foo", nullptr);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 7c35b09d5f5481520872c2a52e3dbf21b105371f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-once.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..70f54c029642200fb1bc4a0cd896d85331dd9439
--- /dev/null
@@ -0,0 +1,43 @@
+/* Test of once-only execution in multithreaded situations.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2018.  */
+
+#include <config.h>
+
+#include "glthread/lock.h"
+
+#include "macros.h"
+
+gl_once_define(static, a_once)
+
+static int a;
+
+static void
+a_init (void)
+{
+  a = 42;
+}
+
+int
+main ()
+{
+  gl_once (a_once, a_init);
+
+  ASSERT (a == 42);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index a410a502d26d808164f15724f54b39c897447407..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-open.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..52e72be98126d9fda9e3480b9ee26ffd75a0fd24
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of opening a file descriptor.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <fcntl.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (open, int, (char const *, int, ...));
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-open.t"
+
+#include "test-open.h"
+
+int
+main (void)
+{
+  return test_open (open, true);
+}
deleted file mode 120000 (symlink)
index 9e47c9b90046a8e9589e4153b08e675f5b61aeca..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-open.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..05764356f832bdc2699707d99b4554ea86d4bf2a
--- /dev/null
@@ -0,0 +1,138 @@
+/* Test of opening a file descriptor.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+/* Tell GCC not to warn about the specific edge cases tested here.  */
+#if __GNUC__ >= 13
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
+#endif
+
+/* Make test_open always inline if we're using Fortify, which defines
+   __always_inline to do that.  Do nothing otherwise.  This works
+   around a glibc bug whereby 'open' cannot be used as a function
+   pointer when _FORTIFY_SOURCE is positive.  */
+
+#if __GLIBC__ && defined __always_inline
+# define ALWAYS_INLINE __always_inline
+#else
+# define ALWAYS_INLINE
+#endif
+
+/* This file is designed to test both open(n,buf[,mode]) and
+   openat(AT_FDCWD,n,buf[,mode]).  FUNC is the function to test.
+   Assumes that BASE and ASSERT are already defined, and that
+   appropriate headers are already included.  If PRINT, warn before
+   skipping symlink tests with status 77.  */
+
+static ALWAYS_INLINE int
+test_open (int (*func) (char const *, int, ...), bool print)
+{
+  int fd;
+
+  /* Remove anything from prior partial run.  */
+  unlink (BASE "file");
+  unlink (BASE "e.exe");
+  unlink (BASE "link");
+
+  /* Cannot create directory.  */
+  errno = 0;
+  ASSERT (func ("nonexist.ent/", O_CREAT | O_RDONLY, 0600) == -1);
+  ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT
+          || errno == EINVAL);
+
+  /* Create a regular file.  */
+  fd = func (BASE "file", O_CREAT | O_RDONLY, 0600);
+  ASSERT (0 <= fd);
+  ASSERT (close (fd) == 0);
+
+  /* Create an executable regular file.  */
+  fd = func (BASE "e.exe", O_CREAT | O_RDONLY, 0700);
+  ASSERT (0 <= fd);
+  ASSERT (close (fd) == 0);
+
+  /* Trailing slash handling.  */
+  errno = 0;
+  ASSERT (func (BASE "file/", O_RDONLY) == -1);
+  ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL);
+
+  /* Directories cannot be opened for writing.  */
+  errno = 0;
+  ASSERT (func (".", O_WRONLY) == -1);
+  ASSERT (errno == EISDIR || errno == EACCES);
+
+  /* /dev/null must exist, and be writable.  */
+  fd = func ("/dev/null", O_RDONLY);
+  ASSERT (0 <= fd);
+  {
+    char c;
+    ASSERT (read (fd, &c, 1) == 0);
+  }
+  ASSERT (close (fd) == 0);
+  fd = func ("/dev/null", O_WRONLY);
+  ASSERT (0 <= fd);
+  ASSERT (write (fd, "c", 1) == 1);
+  ASSERT (close (fd) == 0);
+
+  /* Although O_NONBLOCK on regular files can be ignored, it must not
+     cause a failure.  */
+  fd = func (BASE "file", O_NONBLOCK | O_RDONLY);
+  ASSERT (0 <= fd);
+  ASSERT (close (fd) == 0);
+
+  /* O_CLOEXEC must be honoured.  */
+  if (O_CLOEXEC)
+    {
+      /* Since the O_CLOEXEC handling goes through a special code path at its
+         first invocation, test it twice.  */
+      int i;
+
+      for (i = 0; i < 2; i++)
+        {
+          int flags;
+
+          fd = func (BASE "file", O_CLOEXEC | O_RDONLY);
+          ASSERT (0 <= fd);
+          flags = fcntl (fd, F_GETFD);
+          ASSERT (flags >= 0);
+          ASSERT ((flags & FD_CLOEXEC) != 0);
+          ASSERT (close (fd) == 0);
+        }
+    }
+
+  /* Symlink handling, where supported.  */
+  if (symlink (BASE "file", BASE "link") != 0)
+    {
+      ASSERT (unlink (BASE "file") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  errno = 0;
+  ASSERT (func (BASE "link/", O_RDONLY) == -1);
+  ASSERT (errno == ENOTDIR);
+  fd = func (BASE "link", O_RDONLY);
+  ASSERT (0 <= fd);
+  ASSERT (close (fd) == 0);
+
+  /* Cleanup.  */
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (unlink (BASE "e.exe") == 0);
+  ASSERT (unlink (BASE "link") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index aa84f8b59ccb3af5df00d50990dc3feed0b17dcc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-openat-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..715ba12d79586fb7db8651d99be2b929fc052f8e
--- /dev/null
@@ -0,0 +1,125 @@
+/* Test that openat_safer leave standard fds alone.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "fcntl--.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+/* This test intentionally closes stderr.  So, we arrange to have fd 10
+   (outside the range of interesting fd's during the test) set up to
+   duplicate the original stderr.  */
+
+#define BACKUP_STDERR_FILENO 10
+#define ASSERT_STREAM myerr
+#include "macros.h"
+
+static FILE *myerr;
+
+#define witness "test-openat-safer.txt"
+
+int
+main (void)
+{
+  int i;
+  int j;
+  int dfd;
+  int fd;
+  char buf[2];
+
+  /* We close fd 2 later, so save it in fd 10.  */
+  if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
+      || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
+    return 2;
+
+  /* Create handle for future use.  */
+  dfd = openat (AT_FDCWD, ".", O_RDONLY);
+  ASSERT (STDERR_FILENO < dfd);
+
+  /* Create file for later checks.  */
+  remove (witness);
+  fd = openat (dfd, witness, O_WRONLY | O_CREAT | O_EXCL, 0600);
+  ASSERT (STDERR_FILENO < fd);
+  ASSERT (write (fd, "hi", 2) == 2);
+  ASSERT (close (fd) == 0);
+
+  /* Four iterations, with progressively more standard descriptors
+     closed.  */
+  for (i = -1; i <= STDERR_FILENO; i++)
+    {
+      ASSERT (fchdir (dfd) == 0);
+      if (0 <= i)
+        ASSERT (close (i) == 0);
+
+      /* Execute once in ".", once in "..".  */
+      for (j = 0; j <= 1; j++)
+        {
+          if (j)
+            ASSERT (chdir ("..") == 0);
+
+          /* Check for error detection.  */
+          errno = 0;
+          ASSERT (openat (AT_FDCWD, "", O_RDONLY) == -1);
+          ASSERT (errno == ENOENT);
+          errno = 0;
+          ASSERT (openat (dfd, "", O_RDONLY) == -1);
+          ASSERT (errno == ENOENT);
+          errno = 0;
+          ASSERT (openat (-1, ".", O_RDONLY) == -1);
+          ASSERT (errno == EBADF);
+
+          /* Check for trailing slash and /dev/null handling.  */
+          errno = 0;
+          ASSERT (openat (dfd, "nonexist.ent/", O_CREAT | O_RDONLY,
+                          S_IRUSR | S_IWUSR) == -1);
+          ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT
+                  || errno == EINVAL);
+          errno = 0;
+          ASSERT (openat (dfd, witness "/", O_RDONLY) == -1);
+          ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL);
+#if defined __linux__ || defined __ANDROID__
+          /* Using a bad directory is okay for absolute paths.  */
+          fd = openat (-1, "/dev/null", O_WRONLY);
+          ASSERT (STDERR_FILENO < fd);
+#endif
+          /* Using a non-directory is wrong for relative paths.  */
+          errno = 0;
+          fd = open ("/dev/null", O_RDONLY);
+          ASSERT (STDERR_FILENO < fd);
+          ASSERT (openat (fd, ".", O_RDONLY) == -1);
+          ASSERT (errno == EBADF || errno == ENOTDIR);
+          ASSERT (close (fd) == 0);
+
+          /* Check for our witness file.  */
+          fd = openat (dfd, witness, O_RDONLY | O_NOFOLLOW);
+          ASSERT (STDERR_FILENO < fd);
+          ASSERT (read (fd, buf, 2) == 2);
+          ASSERT (buf[0] == 'h' && buf[1] == 'i');
+          ASSERT (close (fd) == 0);
+        }
+    }
+  ASSERT (fchdir (dfd) == 0);
+  ASSERT (unlink (witness) == 0);
+  ASSERT (close (dfd) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8fb55d05d65d8d4000d493ab1f0c91c4af906bdf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-openat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6ae3e3e2d7f8e645fb8b286cc289207bf64ffd70
--- /dev/null
@@ -0,0 +1,98 @@
+/* Test that openat works.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <fcntl.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (openat, int, (int, char const *, int, ...));
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-openat.t"
+
+#include "test-open.h"
+
+static int dfd = AT_FDCWD;
+
+/* Wrapper around openat to test open behavior.  */
+static int
+do_open (char const *name, int flags, ...)
+{
+  if (flags & O_CREAT)
+    {
+      mode_t mode = 0;
+      va_list arg;
+      va_start (arg, flags);
+
+      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+         creates crashing code when 'mode_t' is smaller than 'int'.  */
+      mode = va_arg (arg, PROMOTED_MODE_T);
+
+      va_end (arg);
+      return openat (dfd, name, flags, mode);
+    }
+  return openat (dfd, name, flags);
+}
+
+int
+main ()
+{
+  int result;
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (openat (-1, "foo", O_RDONLY) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (openat (99, "foo", O_RDONLY) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Basic checks.  */
+  result = test_open (do_open, false);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_open (do_open, false) == result);
+  ASSERT (close (dfd) == 0);
+
+  /* Check that even when *-safer modules are in use, plain openat can
+     land in fd 0.  Do this test last, since it is destructive to
+     stdin.  */
+  ASSERT (close (STDIN_FILENO) == 0);
+  ASSERT (openat (AT_FDCWD, ".", O_RDONLY) == STDIN_FILENO);
+  {
+    dfd = open (".", O_RDONLY);
+    ASSERT (STDIN_FILENO < dfd);
+    ASSERT (chdir ("..") == 0);
+    ASSERT (close (STDIN_FILENO) == 0);
+    ASSERT (openat (dfd, ".", O_RDONLY) == STDIN_FILENO);
+    ASSERT (close (dfd) == 0);
+  }
+  return result;
+}
deleted file mode 120000 (symlink)
index 62d198fd07e3052afb13683c35384e247df3c107..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-parse-datetime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..05cf566579fd8e2496f0a9dfda84e8d6bb483597
--- /dev/null
@@ -0,0 +1,501 @@
+/* Test of parse_datetime() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2008.  */
+
+#include <config.h>
+
+#include "parse-datetime.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#ifdef DEBUG
+#define LOG(str, now, res)                                              \
+  printf ("string '%s' diff %d %d\n",                                 \
+          str, res.tv_sec - now.tv_sec, res.tv_nsec - now.tv_nsec);
+#else
+#define LOG(str, now, res) (void) 0
+#endif
+
+static const char *const day_table[] =
+{
+  "SUNDAY",
+  "MONDAY",
+  "TUESDAY",
+  "WEDNESDAY",
+  "THURSDAY",
+  "FRIDAY",
+  "SATURDAY",
+  NULL
+};
+
+
+#if ! HAVE_TM_GMTOFF
+/* Shift A right by B bits portably, by dividing A by 2**B and
+   truncating towards minus infinity.  A and B should be free of side
+   effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
+   INT_BITS is the number of useful bits in an int.  GNU code can
+   assume that INT_BITS is at least 32.
+
+   ISO C99 says that A >> B is implementation-defined if A < 0.  Some
+   implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
+   right in the usual way when A < 0, so SHR falls back on division if
+   ordinary A >> B doesn't seem to be the usual signed shift.  */
+#define SHR(a, b)       \
+  (-1 >> 1 == -1        \
+   ? (a) >> (b)         \
+   : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
+
+#define TM_YEAR_BASE 1900
+
+/* Yield the difference between *A and *B,
+   measured in seconds, ignoring leap seconds.
+   The body of this function is taken directly from the GNU C Library;
+   see src/strftime.c.  */
+static long int
+tm_diff (struct tm const *a, struct tm const *b)
+{
+  /* Compute intervening leap days correctly even if year is negative.
+     Take care to avoid int overflow in leap day calculations.  */
+  int a4 = SHR (a->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (a->tm_year & 3);
+  int b4 = SHR (b->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (b->tm_year & 3);
+  int a100 = a4 / 25 - (a4 % 25 < 0);
+  int b100 = b4 / 25 - (b4 % 25 < 0);
+  int a400 = SHR (a100, 2);
+  int b400 = SHR (b100, 2);
+  int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
+  long int ayear = a->tm_year;
+  long int years = ayear - b->tm_year;
+  long int days = (365 * years + intervening_leap_days
+                   + (a->tm_yday - b->tm_yday));
+  return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+                + (a->tm_min - b->tm_min))
+          + (a->tm_sec - b->tm_sec));
+}
+#endif /* ! HAVE_TM_GMTOFF */
+
+static long
+gmt_offset (time_t s)
+{
+  long gmtoff;
+
+#if !HAVE_TM_GMTOFF
+  struct tm tm_local = *localtime (&s);
+  struct tm tm_gmt   = *gmtime (&s);
+
+  gmtoff = tm_diff (&tm_local, &tm_gmt);
+#else
+  gmtoff = localtime (&s)->tm_gmtoff;
+#endif
+
+  return gmtoff;
+}
+
+int
+main (_GL_UNUSED int argc, char **argv)
+{
+  struct timespec result;
+  struct timespec result2;
+  struct timespec expected;
+  struct timespec now;
+  const char *p;
+  int i;
+  long gmtoff;
+  time_t ref_time = 1304250918;
+
+  /* Set the time zone to US Eastern time with the 2012 rules.  This
+     should disable any leap second support.  Otherwise, there will be
+     a problem with glibc on sites that default to leap seconds; see
+     <https://bugs.gnu.org/12206>.  */
+  ASSERT (setenv ("TZ", "EST5EDT,M3.2.0,M11.1.0", 1) == 0);
+
+  gmtoff = gmt_offset (ref_time);
+
+
+  /* ISO 8601 extended date and time of day representation,
+     'T' separator, local time zone */
+  p = "2011-05-01T11:55:18";
+  expected.tv_sec = ref_time - gmtoff;
+  expected.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, 0));
+  LOG (p, expected, result);
+  ASSERT (expected.tv_sec == result.tv_sec
+          && expected.tv_nsec == result.tv_nsec);
+
+  /* ISO 8601 extended date and time of day representation,
+     ' ' separator, local time zone */
+  p = "2011-05-01 11:55:18";
+  expected.tv_sec = ref_time - gmtoff;
+  expected.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, 0));
+  LOG (p, expected, result);
+  ASSERT (expected.tv_sec == result.tv_sec
+          && expected.tv_nsec == result.tv_nsec);
+
+  /* ISO 8601 extended date and time of day representation,
+     ' ' separator, 'J' (local) time zone */
+  p = "2011-05-01 11:55:18J";
+  expected.tv_sec = ref_time - gmtoff;
+  expected.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, 0));
+  LOG (p, expected, result);
+  ASSERT (expected.tv_sec == result.tv_sec
+          && expected.tv_nsec == result.tv_nsec);
+
+
+  /* ISO 8601, extended date and time of day representation,
+     'T' separator, UTC */
+  p = "2011-05-01T11:55:18Z";
+  expected.tv_sec = ref_time;
+  expected.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, 0));
+  LOG (p, expected, result);
+  ASSERT (expected.tv_sec == result.tv_sec
+          && expected.tv_nsec == result.tv_nsec);
+
+  /* ISO 8601, extended date and time of day representation,
+     ' ' separator, UTC */
+  p = "2011-05-01 11:55:18Z";
+  expected.tv_sec = ref_time;
+  expected.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, 0));
+  LOG (p, expected, result);
+  ASSERT (expected.tv_sec == result.tv_sec
+          && expected.tv_nsec == result.tv_nsec);
+
+
+  /* ISO 8601 extended date and time of day representation,
+     'T' separator, w/UTC offset */
+  p = "2011-05-01T11:55:18-07:00";
+  expected.tv_sec = 1304276118;
+  expected.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, 0));
+  LOG (p, expected, result);
+  ASSERT (expected.tv_sec == result.tv_sec
+          && expected.tv_nsec == result.tv_nsec);
+
+  /* ISO 8601 extended date and time of day representation,
+     ' ' separator, w/UTC offset */
+  p = "2011-05-01 11:55:18-07:00";
+  expected.tv_sec = 1304276118;
+  expected.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, 0));
+  LOG (p, expected, result);
+  ASSERT (expected.tv_sec == result.tv_sec
+          && expected.tv_nsec == result.tv_nsec);
+
+
+  /* ISO 8601 extended date and time of day representation,
+     'T' separator, w/hour only UTC offset */
+  p = "2011-05-01T11:55:18-07";
+  expected.tv_sec = 1304276118;
+  expected.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, 0));
+  LOG (p, expected, result);
+  ASSERT (expected.tv_sec == result.tv_sec
+          && expected.tv_nsec == result.tv_nsec);
+
+  /* ISO 8601 extended date and time of day representation,
+     ' ' separator, w/hour only UTC offset */
+  p = "2011-05-01 11:55:18-07";
+  expected.tv_sec = 1304276118;
+  expected.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, 0));
+  LOG (p, expected, result);
+  ASSERT (expected.tv_sec == result.tv_sec
+          && expected.tv_nsec == result.tv_nsec);
+
+
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "now";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  ASSERT (now.tv_sec == result.tv_sec && now.tv_nsec == result.tv_nsec);
+
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "tomorrow";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  ASSERT (now.tv_sec + 24 * 60 * 60 == result.tv_sec
+          && now.tv_nsec == result.tv_nsec);
+
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "yesterday";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  ASSERT (now.tv_sec - 24 * 60 * 60 == result.tv_sec
+          && now.tv_nsec == result.tv_nsec);
+
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "4 hours";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  ASSERT (now.tv_sec + 4 * 60 * 60 == result.tv_sec
+          && now.tv_nsec == result.tv_nsec);
+
+  /* test if timezone is not being ignored for day offset */
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC+400 +24 hours";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  p = "UTC+400 +1 day";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+
+  /* test if several time zones formats are handled same way */
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC+14:00";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  p = "UTC+14";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+  p = "UTC+1400";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC-14:00";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  p = "UTC-14";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+  p = "UTC-1400";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC+0:15";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  p = "UTC+0015";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC-1:30";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  p = "UTC-130";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+
+
+  /* TZ out of range should cause parse_datetime failure */
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC+25:00";
+  ASSERT (!parse_datetime (&result, p, &now));
+
+        /* Check for several invalid countable dayshifts */
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC+4:00 +40 yesterday";
+  ASSERT (!parse_datetime (&result, p, &now));
+  p = "UTC+4:00 next yesterday";
+  ASSERT (!parse_datetime (&result, p, &now));
+  p = "UTC+4:00 tomorrow ago";
+  ASSERT (!parse_datetime (&result, p, &now));
+  p = "UTC+4:00 tomorrow hence";
+  ASSERT (!parse_datetime (&result, p, &now));
+  p = "UTC+4:00 40 now ago";
+  ASSERT (!parse_datetime (&result, p, &now));
+  p = "UTC+4:00 last tomorrow";
+  ASSERT (!parse_datetime (&result, p, &now));
+  p = "UTC+4:00 -4 today";
+  ASSERT (!parse_datetime (&result, p, &now));
+
+  /* And check correct usage of dayshifts */
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC+400 tomorrow";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  p = "UTC+400 +1 day";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+  p = "UTC+400 1 day hence";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC+400 yesterday";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  p = "UTC+400 1 day ago";
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+  now.tv_sec = 4711;
+  now.tv_nsec = 1267;
+  p = "UTC+400 now";
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  p = "UTC+400 +0 minutes"; /* silly, but simple "UTC+400" is different*/
+  ASSERT (parse_datetime (&result2, p, &now));
+  LOG (p, now, result2);
+  ASSERT (result.tv_sec == result2.tv_sec
+          && result.tv_nsec == result2.tv_nsec);
+
+  /* If this platform has TZDB, check for GNU Bug#48085.  */
+  ASSERT (setenv ("TZ", "America/Indiana/Indianapolis", 1) == 0);
+  now.tv_sec = 1619641490;
+  now.tv_nsec = 0;
+  struct tm *tm = localtime (&now.tv_sec);
+  if (tm && tm->tm_year == 2021 - 1900 && tm->tm_mon == 4 - 1
+      && tm->tm_mday == 28 && tm->tm_hour == 16 && tm->tm_min == 24
+      && 0 < tm->tm_isdst)
+    {
+      int has_leap_seconds = tm->tm_sec != now.tv_sec % 60;
+      p = "now - 35 years";
+      ASSERT (parse_datetime (&result, p, &now));
+      LOG (p, now, result);
+      ASSERT (result.tv_sec
+              == 515107490 - 60 * 60 + (has_leap_seconds ? 13 : 0));
+    }
+
+  /* Check that some "next Monday", "last Wednesday", etc. are correct.  */
+  ASSERT (setenv ("TZ", "UTC0", 1) == 0);
+  for (i = 0; day_table[i]; i++)
+    {
+      unsigned int thur2 = 7 * 24 * 3600; /* 2nd thursday */
+      char tmp[32];
+      sprintf (tmp, "NEXT %s", day_table[i]);
+      now.tv_sec = thur2 + 4711;
+      now.tv_nsec = 1267;
+      ASSERT (parse_datetime (&result, tmp, &now));
+      LOG (tmp, now, result);
+      ASSERT (result.tv_nsec == 0);
+      ASSERT (result.tv_sec == thur2 + (i == 4 ? 7 : (i + 3) % 7) * 24 * 3600);
+
+      sprintf (tmp, "LAST %s", day_table[i]);
+      now.tv_sec = thur2 + 4711;
+      now.tv_nsec = 1267;
+      ASSERT (parse_datetime (&result, tmp, &now));
+      LOG (tmp, now, result);
+      ASSERT (result.tv_nsec == 0);
+      ASSERT (result.tv_sec == thur2 + ((i + 3) % 7 - 7) * 24 * 3600);
+    }
+
+  p = "1970-12-31T23:59:59+00:00 - 1 year";  /* Bug#50115 */
+  now.tv_sec = -1;
+  now.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  ASSERT (result.tv_sec == now.tv_sec
+          && result.tv_nsec == now.tv_nsec);
+
+  p = "THURSDAY UTC+00";  /* The epoch was on Thursday.  */
+  now.tv_sec = 0;
+  now.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  ASSERT (result.tv_sec == now.tv_sec
+          && result.tv_nsec == now.tv_nsec);
+
+  p = "FRIDAY UTC+00";
+  now.tv_sec = 0;
+  now.tv_nsec = 0;
+  ASSERT (parse_datetime (&result, p, &now));
+  LOG (p, now, result);
+  ASSERT (result.tv_sec == 24 * 3600
+          && result.tv_nsec == now.tv_nsec);
+
+  /* Exercise a sign-extension bug.  Before July 2012, an input
+     starting with a high-bit-set byte would be treated like "0".  */
+  ASSERT ( ! parse_datetime (&result, "\xb0", &now));
+
+  /* Exercise TZ="" parsing code.  */
+  /* These two would infloop or segfault before Feb 2014.  */
+  ASSERT ( ! parse_datetime (&result, "TZ=\"\"\"", &now));
+  ASSERT ( ! parse_datetime (&result, "TZ=\"\" \"", &now));
+  /* Exercise invalid patterns.  */
+  ASSERT ( ! parse_datetime (&result, "TZ=\"", &now));
+  ASSERT ( ! parse_datetime (&result, "TZ=\"\\\"", &now));
+  ASSERT ( ! parse_datetime (&result, "TZ=\"\\n", &now));
+  ASSERT ( ! parse_datetime (&result, "TZ=\"\\n\"", &now));
+  /* Exercise valid patterns.  */
+  ASSERT (   parse_datetime (&result, "TZ=\"\"", &now));
+  ASSERT (   parse_datetime (&result, "TZ=\"\" ", &now));
+  ASSERT (   parse_datetime (&result, " TZ=\"\"", &now));
+  /* Exercise patterns which may be valid or invalid, depending on the
+     platform.  */
+#if !defined __NetBSD__
+  ASSERT (   parse_datetime (&result, "TZ=\"\\\\\"", &now));
+  ASSERT (   parse_datetime (&result, "TZ=\"\\\"\"", &now));
+#endif
+
+  /* Outlandishly-long time zone abbreviations should not cause problems.  */
+  {
+    static char const bufprefix[] = "TZ=\"";
+    long int tzname_max = -1;
+    errno = 0;
+#ifdef _SC_TZNAME_MAX
+    tzname_max = sysconf (_SC_TZNAME_MAX);
+#endif
+    enum { tzname_alloc = 2000 };
+    if (tzname_max < 0)
+      tzname_max = errno ? 6 : tzname_alloc;
+    int tzname_len = tzname_alloc < tzname_max ? tzname_alloc : tzname_max;
+    static char const bufsuffix[] = "0\" 1970-01-01 01:02:03.123456789";
+    enum { bufsize = sizeof bufprefix - 1 + tzname_alloc + sizeof bufsuffix };
+    char buf[bufsize];
+    memcpy (buf, bufprefix, sizeof bufprefix - 1);
+    memset (buf + sizeof bufprefix - 1, 'X', tzname_len);
+    strcpy (buf + sizeof bufprefix - 1 + tzname_len, bufsuffix);
+    ASSERT (parse_datetime (&result, buf, &now));
+    LOG (buf, now, result);
+    ASSERT (result.tv_sec == 1 * 60 * 60 + 2 * 60 + 3
+            && result.tv_nsec == 123456789);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index bab8fb7ddf967c9941e67447fc6f824f261ecdca..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pathmax.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a80ee06562cdbd3e3f1525979e10a275632ddfa0
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test of "pathmax.h".
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include "pathmax.h"
+
+/* Check that PATH_MAX is a constant if it is defined.  */
+#ifdef PATH_MAX
+int a = PATH_MAX;
+#endif
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index b86137f756445152498f0fa7850425b93a4fb029..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-perror.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aba12fa14825ae4cb8a692a0eb9a94ec3b6da449
--- /dev/null
@@ -0,0 +1,36 @@
+/* Test of perror() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (perror, void, (char const *));
+
+#include <errno.h>
+
+int
+main (int argc, char **argv)
+{
+  const char *prefix = (argc > 1 ? argv[1] : NULL);
+
+  errno = EACCES;    perror (prefix);
+  errno = ETIMEDOUT; perror (prefix);
+  errno = EOVERFLOW; perror (prefix);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index a7a1105e20cd0d13563cc3e56b8123f13be3fae9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-perror.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..e6244413a0912470298845963a5ec7211c688f4b
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+: "${srcdir=.}"
+. "$srcdir/init.sh"; path_prepend_ .
+
+# Test NULL prefix. Result should not contain a number, except in lines that
+# start with 'EDC' (IBM z/OS libc produces an error identifier before the
+# error message).
+${CHECKER} test-perror 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror.tmp
+grep -v '^EDC' t-perror.tmp | grep '[0-9]' > /dev/null \
+  && fail_ "result should not contain a number"
+
+# Test empty prefix. Result should be the same.
+${CHECKER} test-perror '' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror1.tmp
+diff t-perror.tmp t-perror1.tmp \
+  || fail_ "empty prefix should behave like NULL argument"
+
+# Test non-empty prefix.
+${CHECKER} test-perror foo 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror3.tmp
+sed -e 's/^/foo: /' < t-perror.tmp > t-perror2.tmp
+diff t-perror2.tmp t-perror3.tmp || fail_ "prefix applied incorrectly"
+
+# Test exit status.
+${CHECKER} test-perror >out 2>/dev/null || fail_ "unexpected exit status"
+test -s out && fail_ "unexpected output"
+
+Exit 0
deleted file mode 120000 (symlink)
index f8163f4eb39ddced7e8077d7a1512ec27a7d975e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-perror2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..edf1d15f9f9c143d2e236db13c79b8d8b4a876bc
--- /dev/null
@@ -0,0 +1,138 @@
+/* Test of perror() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Tell GCC not to warn about myerr being leaked.  */
+#if __GNUC__ >= 13
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
+#endif
+
+/* This test intentionally parses stderr.  So, we arrange to have fd 10
+   (outside the range of interesting fd's during the test) set up to
+   duplicate the original stderr.  */
+#define BACKUP_STDERR_FILENO 10
+#define ASSERT_STREAM myerr
+#include "macros.h"
+
+static FILE *myerr;
+
+#define BASE "test-perror2"
+
+int
+main (void)
+{
+  /* We change fd 2 later, so save it in fd 10.  */
+  if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
+      || (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
+    return 2;
+
+  ASSERT (freopen (BASE ".tmp", "w+", stderr) == stderr);
+
+  /* Test that perror does not clobber strerror buffer.  */
+  {
+    const char *msg1;
+    const char *msg2;
+    const char *msg3;
+    const char *msg4;
+    char *str1;
+    char *str2;
+    char *str3;
+    char *str4;
+
+    msg1 = strerror (ENOENT);
+    ASSERT (msg1);
+    str1 = strdup (msg1);
+    ASSERT (str1);
+
+    msg2 = strerror (ERANGE);
+    ASSERT (msg2);
+    str2 = strdup (msg2);
+    ASSERT (str2);
+
+    msg3 = strerror (-4);
+    ASSERT (msg3);
+    str3 = strdup (msg3);
+    ASSERT (str3);
+
+    msg4 = strerror (1729576);
+    ASSERT (msg4);
+    str4 = strdup (msg4);
+    ASSERT (str4);
+
+    errno = EACCES;
+    perror ("");
+    errno = -5;
+    perror ("");
+    ASSERT (!ferror (stderr));
+    ASSERT (STREQ (msg4, str4));
+
+    free (str1);
+    free (str2);
+    free (str3);
+    free (str4);
+  }
+
+  /* Test that perror uses the same message as strerror.  */
+  {
+    int errs[] = { EACCES, 0, -3, };
+    int i;
+    for (i = 0; i < SIZEOF (errs); i++)
+      {
+        char buf[256];
+        const char *err = strerror (errs[i]);
+
+        ASSERT (err);
+        ASSERT (strlen (err) < sizeof buf);
+        rewind (stderr);
+        ASSERT (ftruncate (fileno (stderr), 0) == 0);
+        errno = errs[i];
+        perror (NULL);
+        ASSERT (!ferror (stderr));
+        rewind (stderr);
+        ASSERT (fgets (buf, sizeof buf, stderr) == buf);
+        ASSERT (strstr (buf, err));
+      }
+  }
+
+  /* Test that perror reports write failure.  */
+  {
+    ASSERT (freopen (BASE ".tmp", "r", stderr) == stderr);
+    ASSERT (setvbuf (stderr, NULL, _IONBF, BUFSIZ) == 0);
+    errno = -1;
+    ASSERT (!ferror (stderr));
+    perror (NULL);
+#if 0
+    /* Commented out until cygwin behaves:
+       https://sourceware.org/ml/newlib/2011/msg00228.html */
+    ASSERT (errno > 0);
+    /* Commented out until glibc behaves:
+       https://sourceware.org/bugzilla/show_bug.cgi?id=12792 */
+    ASSERT (ferror (stderr));
+#endif
+  }
+
+  ASSERT (fclose (stderr) == 0);
+  ASSERT (remove (BASE ".tmp") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b142a84d0089c64a069d45e755c8c30e9ac83973..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-physmem.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8aefcae3e2600ce39f5f16627fbddb9223bbb8ec
--- /dev/null
@@ -0,0 +1,38 @@
+/* Test of getting the amount of total/available physical memory.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include "physmem.h"
+
+#include <stdio.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  printf ("Total memory:     %12.f B = %6.f MiB\n",
+          physmem_total (), physmem_total () / (1024.0 * 1024.0));
+  printf ("Available memory: %12.f B = %6.f MiB\n",
+          physmem_available (), physmem_available () / (1024.0 * 1024.0));
+  ASSERT (physmem_total () >= physmem_available ());
+  ASSERT (physmem_available () >= 4 * 1024 * 1024);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b1854258f3cfd57129335b1e98aac4ef2f6032e7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pipe.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e9ebe162a7eb4abc8744a8371ef8c18cb9871417
--- /dev/null
@@ -0,0 +1,107 @@
+/* Test of pipe.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (pipe, int, (int[2]));
+
+#include <fcntl.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+#endif
+
+#include "binary-io.h"
+#include "macros.h"
+
+/* Return true if FD is open.  */
+static bool
+is_open (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+#else
+# ifndef F_GETFL
+#  error Please port fcntl to your platform
+# endif
+  return 0 <= fcntl (fd, F_GETFL);
+#endif
+}
+
+/* Return true if FD is not inherited to child processes.  */
+static bool
+is_cloexec (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  DWORD flags;
+  ASSERT (GetHandleInformation (h, &flags));
+  return (flags & HANDLE_FLAG_INHERIT) == 0;
+#else
+  int flags;
+  ASSERT ((flags = fcntl (fd, F_GETFD)) >= 0);
+  return (flags & FD_CLOEXEC) != 0;
+#endif
+}
+
+/* Return true if FD is in non-blocking mode.  */
+static bool
+is_nonblocking (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* We don't use the non-blocking mode for sockets here.  */
+  return 0;
+#else
+  int flags;
+  ASSERT ((flags = fcntl (fd, F_GETFL)) >= 0);
+  return (flags & O_NONBLOCK) != 0;
+#endif
+}
+
+int
+main ()
+{
+  int fd[2];
+
+  fd[0] = -1;
+  fd[1] = -1;
+  ASSERT (pipe (fd) >= 0);
+  ASSERT (fd[0] >= 0);
+  ASSERT (fd[1] >= 0);
+  ASSERT (fd[0] != fd[1]);
+  ASSERT (is_open (fd[0]));
+  ASSERT (is_open (fd[1]));
+  ASSERT (!is_cloexec (fd[0]));
+  ASSERT (!is_cloexec (fd[1]));
+  ASSERT (!is_nonblocking (fd[0]));
+  ASSERT (!is_nonblocking (fd[1]));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 53ffbc93f118909d04334c46fa23f1e8afd0074c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pipe2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..900614a2a893ec8ea39250263f8b9fe6a299f194
--- /dev/null
@@ -0,0 +1,146 @@
+/* Test of pipe2.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (pipe2, int, (int[2], int));
+
+#include <fcntl.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+#endif
+
+#include "binary-io.h"
+#include "macros.h"
+#if GNULIB_NONBLOCKING
+# include "nonblocking.h"
+#endif
+
+/* Return true if FD is open.  */
+static bool
+is_open (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows, the initial state of unassigned standard file
+     descriptors is that they are open but point to an
+     INVALID_HANDLE_VALUE, and there is no fcntl.  */
+  return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+#else
+# ifndef F_GETFL
+#  error Please port fcntl to your platform
+# endif
+  return 0 <= fcntl (fd, F_GETFL);
+#endif
+}
+
+/* Return true if FD is not inherited to child processes.  */
+static bool
+is_cloexec (int fd)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  DWORD flags;
+  ASSERT (GetHandleInformation (h, &flags));
+  return (flags & HANDLE_FLAG_INHERIT) == 0;
+#else
+  int flags;
+  ASSERT ((flags = fcntl (fd, F_GETFD)) >= 0);
+  return (flags & FD_CLOEXEC) != 0;
+#endif
+}
+
+#if ! GNULIB_NONBLOCKING
+static int
+get_nonblocking_flag (int fd)
+{
+# if defined _WIN32 && ! defined __CYGWIN__
+  return 0;
+# else
+#  ifndef F_GETFL
+#   error Please port fcntl to your platform
+#  endif
+  int flags;
+  ASSERT ((flags = fcntl (fd, F_GETFL)) >= 0);
+  return (flags & O_NONBLOCK) != 0;
+# endif
+}
+#endif
+
+int
+main ()
+{
+  int use_nonblocking;
+  int use_cloexec;
+
+  for (use_nonblocking = 0; use_nonblocking <= !!O_NONBLOCK; use_nonblocking++)
+    for (use_cloexec = 0; use_cloexec <= !!O_CLOEXEC; use_cloexec++)
+      {
+        int o_flags;
+        int fd[2];
+
+        o_flags = 0;
+        if (use_nonblocking)
+          o_flags |= O_NONBLOCK;
+        if (use_cloexec)
+          o_flags |= O_CLOEXEC;
+
+        fd[0] = -1;
+        fd[1] = -1;
+        ASSERT (pipe2 (fd, o_flags) >= 0);
+        ASSERT (fd[0] >= 0);
+        ASSERT (fd[1] >= 0);
+        ASSERT (fd[0] != fd[1]);
+        ASSERT (is_open (fd[0]));
+        ASSERT (is_open (fd[1]));
+        if (use_cloexec)
+          {
+            ASSERT (is_cloexec (fd[0]));
+            ASSERT (is_cloexec (fd[1]));
+          }
+        else
+          {
+            ASSERT (!is_cloexec (fd[0]));
+            ASSERT (!is_cloexec (fd[1]));
+          }
+        if (use_nonblocking)
+          {
+            ASSERT (get_nonblocking_flag (fd[0]) == 1);
+            ASSERT (get_nonblocking_flag (fd[1]) == 1);
+          }
+        else
+          {
+            ASSERT (get_nonblocking_flag (fd[0]) == 0);
+            ASSERT (get_nonblocking_flag (fd[1]) == 0);
+          }
+
+        ASSERT (close (fd[0]) == 0);
+        ASSERT (close (fd[1]) == 0);
+      }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 6a769dcdae81bd2e8d27948722077ea700494de2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-posix_memalign.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..803e40c5f5a5c227fb0eb6e3e5020d197f16c41d
--- /dev/null
@@ -0,0 +1,107 @@
+/* Test of allocating memory with given alignment.
+
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+#if HAVE_POSIX_MEMALIGN
+  static size_t sizes[] =
+    { 13, 8, 17, 450, 320, 1, 99, 4, 15, 16, 2, 76, 37, 127, 2406, 641, 5781 };
+  void *aligned2_blocks[SIZEOF (sizes)];
+  void *aligned4_blocks[SIZEOF (sizes)];
+  void *aligned8_blocks[SIZEOF (sizes)];
+  void *aligned16_blocks[SIZEOF (sizes)];
+  void *aligned32_blocks[SIZEOF (sizes)];
+  void *aligned64_blocks[SIZEOF (sizes)];
+  size_t i;
+
+  for (i = 0; i < SIZEOF (sizes); i++)
+    {
+      size_t size = sizes[i];
+
+      if (sizeof (void *) <= 2)
+        {
+          ASSERT (posix_memalign (&aligned2_blocks[i], 2, size) == 0);
+          ASSERT (aligned2_blocks[i] != NULL);
+          ASSERT (((uintptr_t) aligned2_blocks[i] % 2) == 0);
+          memset (aligned2_blocks[i], 'u', size);
+        }
+
+      if (sizeof (void *) <= 4)
+        {
+          ASSERT (posix_memalign (&aligned4_blocks[i], 4, size) == 0);
+          ASSERT (aligned4_blocks[i] != NULL);
+          ASSERT (((uintptr_t) aligned4_blocks[i] % 4) == 0);
+          memset (aligned4_blocks[i], 'v', size);
+        }
+
+      if (sizeof (void *) <= 8)
+       {
+         ASSERT (posix_memalign (&aligned8_blocks[i], 8, size) == 0);
+         ASSERT (aligned8_blocks[i] != NULL);
+         ASSERT (((uintptr_t) aligned8_blocks[i] % 8) == 0);
+         memset (aligned8_blocks[i], 'w', size);
+       }
+
+      ASSERT (posix_memalign (&aligned16_blocks[i], 16, size) == 0);
+      ASSERT (aligned16_blocks[i] != NULL);
+      ASSERT (((uintptr_t) aligned16_blocks[i] % 16) == 0);
+      memset (aligned16_blocks[i], 'x', size);
+
+      ASSERT (posix_memalign (&aligned32_blocks[i], 32, size) == 0);
+      ASSERT (aligned32_blocks[i] != NULL);
+      ASSERT (((uintptr_t) aligned32_blocks[i] % 32) == 0);
+      memset (aligned32_blocks[i], 'y', size);
+
+      ASSERT (posix_memalign (&aligned64_blocks[i], 64, size) == 0);
+      ASSERT (aligned64_blocks[i] != NULL);
+      ASSERT (((uintptr_t) aligned64_blocks[i] % 64) == 0);
+      memset (aligned64_blocks[i], 'z', size);
+    }
+
+  for (i = 0; i < SIZEOF (sizes); i++)
+    {
+      if (sizeof (void *) <= 2)
+        free (aligned2_blocks[i]);
+      if (sizeof (void *) <= 4)
+        free (aligned4_blocks[i]);
+      if (sizeof (void *) <= 8)
+       free (aligned8_blocks[i]);
+      free (aligned16_blocks[i]);
+      free (aligned32_blocks[i]);
+      free (aligned64_blocks[i]);
+    }
+
+  return 0;
+#else
+  fputs ("Skipping test: function 'aligned_alloc' does not exist\n", stderr);
+  return 77;
+#endif
+}
deleted file mode 120000 (symlink)
index c1ed7297759b08330781cc260385676e3882667d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-posixtm.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..193f4ea16e12e3a0d76e0c3d04c25676381168de
--- /dev/null
@@ -0,0 +1,201 @@
+/* Test that posixtime works as required.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "posixtm.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <time.h>
+
+#include "intprops.h"
+#include "macros.h"
+
+struct posixtm_test
+{
+  char const *in;
+  unsigned int syntax_bits;
+  bool valid;
+  int_least64_t t_expected;
+};
+
+/* Test mainly with syntax_bits == LY.  */
+enum { LY = PDS_CENTURY | PDS_SECONDS };
+
+static struct posixtm_test const T[] =
+  {
+    /* no year specified; cross-check via another posixtime call */
+    { "12131415.16",     LY, 1,            0}, /* ??? Dec 13 14:15:16 ???? */
+    { "12131415",        LY, 1,            0}, /* ??? Dec 13 14:15:00 ???? */
+
+#if !((defined __APPLE__ && defined __MACH__) || defined __sun \
+      || (defined _WIN32 && !defined __CYGWIN__))
+    /* These two tests fail on 64-bit Mac OS X 10.5 and on 64-bit Solaris up
+       through at least Solaris 11.3, which is off by one day for timestamps
+       before 0001-01-01 00:00:00 UTC.  */
+    { "000001010000.00", LY, 1,
+                      - INT64_C (62167219200)},/* Sat Jan  1 00:00:00 0    */
+    { "000012312359.59", LY, 1,
+                      - INT64_C (62135596801)},/* Fri Dec 31 23:59:59 0    */
+#endif
+#if !(defined _WIN32 && !defined __CYGWIN__)
+    { "000101010000.00", LY, 1,
+                      - INT64_C (62135596800)},/* Sat Jan  1 00:00:00 1    */
+    { "190112132045.51", LY, 1,
+                       - INT64_C (2147483649)},/* Fri Dec 13 20:45:51 1901 */
+    { "190112132045.52", LY, 1,
+                       - INT64_C (2147483648)},/* Fri Dec 13 20:45:52 1901 */
+    { "190112132045.53", LY, 1,  -2147483647}, /* Fri Dec 13 20:45:53 1901 */
+    { "190112132046.52", LY, 1,  -2147483588}, /* Fri Dec 13 20:46:52 1901 */
+    { "190112132145.52", LY, 1,  -2147480048}, /* Fri Dec 13 21:45:52 1901 */
+    { "190112142045.52", LY, 1,  -2147397248}, /* Sat Dec 14 20:45:52 1901 */
+    { "190201132045.52", LY, 1,  -2144805248}, /* Mon Jan 13 20:45:52 1902 */
+    { "196912312359.59", LY, 1,           -1}, /* Wed Dec 31 23:59:59 1969 */
+#endif
+    { "197001010000.00", LY, 1,            0}, /* Thu Jan  1 00:00:00 1970 */
+    { "197001010000.01", LY, 1,            1}, /* Thu Jan  1 00:00:01 1970 */
+    { "197001010001.00", LY, 1,           60}, /* Thu Jan  1 00:01:00 1970 */
+    { "197001010000.60", LY, 1,           60}, /* Thu Jan  1 00:01:00 1970 */
+    { "197001010100.00", LY, 1,         3600}, /* Thu Jan  1 01:00:00 1970 */
+    { "197001020000.00", LY, 1,        86400}, /* Fri Jan  2 00:00:00 1970 */
+    { "197002010000.00", LY, 1,      2678400}, /* Sun Feb  1 00:00:00 1970 */
+    { "197101010000.00", LY, 1,     31536000}, /* Fri Jan  1 00:00:00 1971 */
+    { "197001000000.00", LY, 0,            0}, /* -- */
+    { "197000010000.00", LY, 0,            0}, /* -- */
+    { "197001010060.00", LY, 0,            0}, /* -- */
+    { "197001012400.00", LY, 0,            0}, /* -- */
+    { "197001320000.00", LY, 0,            0}, /* -- */
+    { "197013010000.00", LY, 0,            0}, /* -- */
+    { "203801190314.06", LY, 1,   2147483646}, /* Tue Jan 19 03:14:06 2038 */
+    { "203801190314.07", LY, 1,   2147483647}, /* Tue Jan 19 03:14:07 2038 */
+    { "203801190314.08", LY, 1,
+                       INT64_C (  2147483648)},/* Tue Jan 19 03:14:08 2038 */
+#if !(defined _WIN32 && !defined __CYGWIN__)
+    { "999912312359.59", LY, 1,
+                       INT64_C (253402300799)},/* Fri Dec 31 23:59:59 9999 */
+#endif
+    { "1112131415",      LY, 1,   1323785700}, /* Tue Dec 13 14:15:00 2011 */
+    { "1112131415.16",   LY, 1,   1323785716}, /* Tue Dec 13 14:15:16 2011 */
+    { "201112131415.16", LY, 1,   1323785716}, /* Tue Dec 13 14:15:16 2011 */
+#if !(defined _WIN32 && !defined __CYGWIN__)
+    { "191112131415.16", LY, 1,  -1831974284}, /* Wed Dec 13 14:15:16 1911 */
+#endif
+    { "203712131415.16", LY, 1,   2144326516}, /* Sun Dec 13 14:15:16 2037 */
+    { "3712131415.16",   LY, 1,   2144326516}, /* Sun Dec 13 14:15:16 2037 */
+    { "6812131415.16",   LY, 1,
+                       INT64_C (  3122633716)},/* Thu Dec 13 14:15:16 2068 */
+#if !(defined _WIN32 && !defined __CYGWIN__)
+    { "6912131415.16",   LY, 1,     -1590284}, /* Sat Dec 13 14:15:16 1969 */
+#endif
+    { "7012131415.16",   LY, 1,     29945716}, /* Sun Dec 13 14:15:16 1970 */
+    { "1213141599",      PDS_TRAILING_YEAR,
+                             1,    945094500}, /* Mon Dec 13 14:15:00 1999 */
+    { "1213141500",      PDS_TRAILING_YEAR,
+                             1,    976716900}, /* Wed Dec 13 14:15:00 2000 */
+    { NULL,               0, 0,            0}
+  };
+
+int
+main (void)
+{
+  unsigned int i;
+  int fail = 0;
+  char curr_year_str[30];
+  struct tm *tm;
+  time_t t_now;
+  int err;
+  size_t n_bytes;
+
+  /* The above test data requires Universal Time, e.g., TZ="UTC0".  */
+  err = setenv ("TZ", "UTC0", 1);
+  ASSERT (err == 0);
+
+  t_now = time (NULL);
+  ASSERT (t_now != (time_t) -1);
+  tm = localtime (&t_now);
+  ASSERT (tm);
+  n_bytes = strftime (curr_year_str, sizeof curr_year_str, "%Y", tm);
+  ASSERT (0 < n_bytes);
+
+  for (i = 0; T[i].in; i++)
+    {
+      time_t t_out;
+      time_t t_exp;
+      bool ok;
+
+      /* Some tests assume that time_t is signed.
+         If it is unsigned and the result is negative, skip the test. */
+      if (T[i].t_expected < 0 && ! TYPE_SIGNED (time_t))
+        {
+          printf ("skipping %s: result is negative, "
+                  "but your time_t is unsigned\n", T[i].in);
+          continue;
+        }
+
+      if (! (TYPE_MINIMUM (time_t) <= T[i].t_expected
+             && T[i].t_expected <= TYPE_MAXIMUM (time_t)))
+        {
+          printf ("skipping %s: result is out of range of your time_t\n",
+                  T[i].in);
+          continue;
+        }
+
+      t_exp = T[i].t_expected;
+
+      /* If an input string does not specify the year number, determine
+         the expected output by calling posixtime with an otherwise
+         equivalent string that starts with the current year.  */
+      if (8 <= strlen (T[i].in)
+          && (T[i].in[8] == '.' || T[i].in[8] == '\0'))
+        {
+          char tmp_buf[20];
+          stpcpy (stpcpy (tmp_buf, curr_year_str), T[i].in);
+          ASSERT (posixtime (&t_exp, tmp_buf, T[i].syntax_bits));
+        }
+
+      ok = posixtime (&t_out, T[i].in, T[i].syntax_bits);
+      if (ok != !!T[i].valid)
+        {
+          printf ("%s return value mismatch: got %d, expected %d\n",
+                  T[i].in, !!ok, T[i].valid);
+          fail = 1;
+          continue;
+        }
+
+      if (!ok)
+        continue;
+
+      if (t_out != t_exp)
+        {
+          printf ("%s mismatch (-: actual; +:expected)\n-%12ld\n+%12ld\n",
+                  T[i].in, (long) t_out, (long) t_exp);
+          fail = 1;
+        }
+    }
+
+  return fail;
+}
+
+/*
+Local Variables:
+indent-tabs-mode: nil
+End:
+*/
deleted file mode 120000 (symlink)
index 3fb122e5daecafdbef8c502fc41f95f595295254..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-printf-frexp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e3aa7cafaa5d2f7001699a8627775c90ba51efdf
--- /dev/null
@@ -0,0 +1,119 @@
+/* Test of splitting a double into fraction and mantissa.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "printf-frexp.h"
+
+#include <float.h>
+
+#include "macros.h"
+
+static double
+my_ldexp (double x, int d)
+{
+  for (; d > 0; d--)
+    x *= 2.0;
+  for (; d < 0; d++)
+    x *= 0.5;
+  return x;
+}
+
+int
+main ()
+{
+  int i;
+  /* The use of 'volatile' guarantees that excess precision bits are dropped
+     when dealing with denormalized numbers.  It is necessary on x86 systems
+     where double-floats are not IEEE compliant by default, to avoid that the
+     results become platform and compiler option dependent.  'volatile' is a
+     portable alternative to gcc's -ffloat-store option.  */
+  volatile double x;
+
+  for (i = 1, x = 1.0; i <= DBL_MAX_EXP; i++, x *= 2.0)
+    {
+      int exp = -9999;
+      double mantissa = printf_frexp (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.0);
+    }
+  for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
+    {
+      int exp = -9999;
+      double mantissa = printf_frexp (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.0);
+    }
+  for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5)
+    {
+      int exp = -9999;
+      double mantissa = printf_frexp (x, &exp);
+      ASSERT (exp == DBL_MIN_EXP - 1);
+      ASSERT (mantissa == my_ldexp (1.0, i - DBL_MIN_EXP));
+    }
+
+  for (i = 1, x = 1.01; i <= DBL_MAX_EXP; i++, x *= 2.0)
+    {
+      int exp = -9999;
+      double mantissa = printf_frexp (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.01);
+    }
+  for (i = 1, x = 1.01; i >= DBL_MIN_EXP; i--, x *= 0.5)
+    {
+      int exp = -9999;
+      double mantissa = printf_frexp (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.01);
+    }
+  for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5)
+    {
+      int exp = -9999;
+      double mantissa = printf_frexp (x, &exp);
+      ASSERT (exp == DBL_MIN_EXP - 1);
+      ASSERT (mantissa >= my_ldexp (1.0, i - DBL_MIN_EXP));
+      ASSERT (mantissa <= my_ldexp (2.0, i - DBL_MIN_EXP));
+      ASSERT (mantissa == my_ldexp (x, - exp));
+    }
+
+  for (i = 1, x = 1.73205; i <= DBL_MAX_EXP; i++, x *= 2.0)
+    {
+      int exp = -9999;
+      double mantissa = printf_frexp (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.73205);
+    }
+  for (i = 1, x = 1.73205; i >= DBL_MIN_EXP; i--, x *= 0.5)
+    {
+      int exp = -9999;
+      double mantissa = printf_frexp (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.73205);
+    }
+  for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5)
+    {
+      int exp = -9999;
+      double mantissa = printf_frexp (x, &exp);
+      ASSERT (exp == DBL_MIN_EXP - 1);
+      ASSERT (mantissa >= my_ldexp (1.0, i - DBL_MIN_EXP));
+      ASSERT (mantissa <= my_ldexp (2.0, i - DBL_MIN_EXP));
+      ASSERT (mantissa == my_ldexp (x, - exp));
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 8f851ca1180f9c7bb435189574826b5770e5d1d9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-printf-frexpl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dd39fe849d09b4927b70869b6b3f7d4025aeb360
--- /dev/null
@@ -0,0 +1,134 @@
+/* Test of splitting a 'long double' into fraction and mantissa.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "printf-frexpl.h"
+
+#include <float.h>
+
+#include "fpucw.h"
+#include "macros.h"
+
+/* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable
+   exponent for 'long double' is -964.  Similarly, on PowerPC machines,
+   LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double'
+   is -968.  For exponents below that, the precision may be truncated to the
+   precision used for 'double'.  */
+#ifdef __sgi
+# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 57)
+# define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP
+#elif defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__
+# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53)
+# define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP
+#else
+# define MIN_NORMAL_EXP LDBL_MIN_EXP
+# define MIN_SUBNORMAL_EXP (LDBL_MIN_EXP - 100)
+#endif
+
+static long double
+my_ldexp (long double x, int d)
+{
+  for (; d > 0; d--)
+    x *= 2.0L;
+  for (; d < 0; d++)
+    x *= 0.5L;
+  return x;
+}
+
+int
+main ()
+{
+  int i;
+  long double x;
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  for (i = 1, x = 1.0L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
+    {
+      int exp = -9999;
+      long double mantissa = printf_frexpl (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.0L);
+    }
+  for (i = 1, x = 1.0L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
+    {
+      int exp = -9999;
+      long double mantissa = printf_frexpl (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.0L);
+    }
+  for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L)
+    {
+      int exp = -9999;
+      long double mantissa = printf_frexpl (x, &exp);
+      ASSERT (exp == LDBL_MIN_EXP - 1);
+      ASSERT (mantissa == my_ldexp (1.0L, i - LDBL_MIN_EXP));
+    }
+
+  for (i = 1, x = 1.01L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
+    {
+      int exp = -9999;
+      long double mantissa = printf_frexpl (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.01L);
+    }
+  for (i = 1, x = 1.01L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
+    {
+      int exp = -9999;
+      long double mantissa = printf_frexpl (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.01L);
+    }
+  for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L)
+    {
+      int exp = -9999;
+      long double mantissa = printf_frexpl (x, &exp);
+      ASSERT (exp == LDBL_MIN_EXP - 1);
+      ASSERT (mantissa >= my_ldexp (1.0L, i - LDBL_MIN_EXP));
+      ASSERT (mantissa <= my_ldexp (2.0L, i - LDBL_MIN_EXP));
+      ASSERT (mantissa == my_ldexp (x, - exp));
+    }
+
+  for (i = 1, x = 1.73205L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
+    {
+      int exp = -9999;
+      long double mantissa = printf_frexpl (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.73205L);
+    }
+  for (i = 1, x = 1.73205L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
+    {
+      int exp = -9999;
+      long double mantissa = printf_frexpl (x, &exp);
+      ASSERT (exp == i - 1);
+      ASSERT (mantissa == 1.73205L);
+    }
+  for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L)
+    {
+      int exp = -9999;
+      long double mantissa = printf_frexpl (x, &exp);
+      ASSERT (exp == LDBL_MIN_EXP - 1);
+      ASSERT (mantissa >= my_ldexp (1.0L, i - LDBL_MIN_EXP));
+      ASSERT (mantissa <= my_ldexp (2.0L, i - LDBL_MIN_EXP));
+      ASSERT (mantissa == my_ldexp (x, - exp));
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 2cc7f2a619fa95d7aa01396306734c1d66dfd075..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-printf-posix.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f1cb735c9cf41660e83a0f8d58f9f10e4f5a1c69
--- /dev/null
@@ -0,0 +1,155 @@
+/* Test of POSIX compatible vsprintf() and sprintf() functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include "infinity.h"
+
+static void
+test_function (int (*my_printf) (const char *, ...))
+{
+  /* Here we don't test output that may be platform dependent.
+     The bulk of the tests is done as part of the 'vasnprintf-posix' module.  */
+
+  /* Test support of size specifiers as in C99.  */
+
+  my_printf ("%ju %d\n", (uintmax_t) 12345671, 33, 44, 55);
+
+  my_printf ("%zu %d\n", (size_t) 12345672, 33, 44, 55);
+
+  my_printf ("%tu %d\n", (ptrdiff_t) 12345673, 33, 44, 55);
+
+  /* Test the support of the 'a' and 'A' conversion specifier for hexadecimal
+     output of floating-point numbers.  */
+
+  /* Positive zero.  */
+  my_printf ("%a %d\n", 0.0, 33, 44, 55);
+
+  /* Positive infinity.  */
+  my_printf ("%a %d\n", Infinityd (), 33, 44, 55);
+
+  /* Negative infinity.  */
+  my_printf ("%a %d\n", - Infinityd (), 33, 44, 55);
+
+  /* FLAG_ZERO with infinite number.  */
+  /* "0000000inf 33" is not a valid result; see
+     <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
+  my_printf ("%010a %d\n", Infinityd (), 33, 44, 55);
+
+  /* Test the support of the %f format directive.  */
+
+  /* A positive number.  */
+  my_printf ("%f %d\n", 12.75, 33, 44, 55);
+
+  /* A larger positive number.  */
+  my_printf ("%f %d\n", 1234567.0, 33, 44, 55);
+
+  /* A negative number.  */
+  my_printf ("%f %d\n", -0.03125, 33, 44, 55);
+
+  /* Positive zero.  */
+  my_printf ("%f %d\n", 0.0, 33, 44, 55);
+
+  /* FLAG_ZERO.  */
+  my_printf ("%015f %d\n", 1234.0, 33, 44, 55);
+
+  /* Precision.  */
+  my_printf ("%.f %d\n", 1234.0, 33, 44, 55);
+
+  /* Precision with no rounding.  */
+  my_printf ("%.2f %d\n", 999.95, 33, 44, 55);
+
+  /* Precision with rounding.  */
+  my_printf ("%.2f %d\n", 999.996, 33, 44, 55);
+
+  /* A positive number.  */
+  my_printf ("%Lf %d\n", 12.75L, 33, 44, 55);
+
+  /* A larger positive number.  */
+  my_printf ("%Lf %d\n", 1234567.0L, 33, 44, 55);
+
+  /* A negative number.  */
+  my_printf ("%Lf %d\n", -0.03125L, 33, 44, 55);
+
+  /* Positive zero.  */
+  my_printf ("%Lf %d\n", 0.0L, 33, 44, 55);
+
+  /* FLAG_ZERO.  */
+  my_printf ("%015Lf %d\n", 1234.0L, 33, 44, 55);
+
+  /* Precision.  */
+  my_printf ("%.Lf %d\n", 1234.0L, 33, 44, 55);
+
+  /* Precision with no rounding.  */
+  my_printf ("%.2Lf %d\n", 999.95L, 33, 44, 55);
+
+  /* Precision with rounding.  */
+  my_printf ("%.2Lf %d\n", 999.996L, 33, 44, 55);
+
+  /* Test the support of the %F format directive.  */
+
+  /* A positive number.  */
+  my_printf ("%F %d\n", 12.75, 33, 44, 55);
+
+  /* A larger positive number.  */
+  my_printf ("%F %d\n", 1234567.0, 33, 44, 55);
+
+  /* A negative number.  */
+  my_printf ("%F %d\n", -0.03125, 33, 44, 55);
+
+  /* Positive zero.  */
+  my_printf ("%F %d\n", 0.0, 33, 44, 55);
+
+  /* FLAG_ZERO.  */
+  my_printf ("%015F %d\n", 1234.0, 33, 44, 55);
+
+  /* Precision.  */
+  my_printf ("%.F %d\n", 1234.0, 33, 44, 55);
+
+  /* Precision with no rounding.  */
+  my_printf ("%.2F %d\n", 999.95, 33, 44, 55);
+
+  /* Precision with rounding.  */
+  my_printf ("%.2F %d\n", 999.996, 33, 44, 55);
+
+  /* A positive number.  */
+  my_printf ("%LF %d\n", 12.75L, 33, 44, 55);
+
+  /* A larger positive number.  */
+  my_printf ("%LF %d\n", 1234567.0L, 33, 44, 55);
+
+  /* A negative number.  */
+  my_printf ("%LF %d\n", -0.03125L, 33, 44, 55);
+
+  /* Positive zero.  */
+  my_printf ("%LF %d\n", 0.0L, 33, 44, 55);
+
+  /* FLAG_ZERO.  */
+  my_printf ("%015LF %d\n", 1234.0L, 33, 44, 55);
+
+  /* Precision.  */
+  my_printf ("%.LF %d\n", 1234.0L, 33, 44, 55);
+
+  /* Precision with no rounding.  */
+  my_printf ("%.2LF %d\n", 999.95L, 33, 44, 55);
+
+  /* Precision with rounding.  */
+  my_printf ("%.2LF %d\n", 999.996L, 33, 44, 55);
+
+  /* Test the support of the POSIX/XSI format strings with positions.  */
+
+  my_printf ("%2$d %1$d\n", 33, 55);
+}
deleted file mode 120000 (symlink)
index 162b93c61639882f5c17c366df2595caff5208e0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-printf-posix.output
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..618825bb7b966308f78d244162964bef27e77450
--- /dev/null
@@ -0,0 +1,40 @@
+12345671 33
+12345672 33
+12345673 33
+0x0p+0 33
+inf 33
+-inf 33
+       inf 33
+12.750000 33
+1234567.000000 33
+-0.031250 33
+0.000000 33
+00001234.000000 33
+1234 33
+999.95 33
+1000.00 33
+12.750000 33
+1234567.000000 33
+-0.031250 33
+0.000000 33
+00001234.000000 33
+1234 33
+999.95 33
+1000.00 33
+12.750000 33
+1234567.000000 33
+-0.031250 33
+0.000000 33
+00001234.000000 33
+1234 33
+999.95 33
+1000.00 33
+12.750000 33
+1234567.000000 33
+-0.031250 33
+0.000000 33
+00001234.000000 33
+1234 33
+999.95 33
+1000.00 33
+55 33
deleted file mode 120000 (symlink)
index 1f7ac21b793b1f50daf14376553d0ca55fb45c17..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-priv-set.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f7177d6eb87a132e4108d30fa862ef0e70b6d36d
--- /dev/null
@@ -0,0 +1,88 @@
+/* Test the priv-set module.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2007.  */
+
+#include <config.h>
+
+#include "priv-set.h"
+
+#if HAVE_GETPPRIV && HAVE_PRIV_H
+# include <priv.h>
+#endif
+#include <unistd.h>
+#include <errno.h>
+#include <sys/types.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+#if HAVE_GETPPRIV && HAVE_PRIV_H
+    priv_set_t *set;
+
+    ASSERT (set = priv_allocset ());
+    ASSERT (getppriv (PRIV_EFFECTIVE, set) == 0);
+    ASSERT (priv_ismember (set, PRIV_PROC_EXEC) == 1);
+
+    /* Do a series of removes and restores making sure that the results are
+       consistent with our ismember function and solaris' priv_ismember.  */
+    ASSERT (priv_set_ismember (PRIV_PROC_EXEC) == 1);
+        ASSERT (getppriv (PRIV_EFFECTIVE, set) == 0);
+        ASSERT (priv_ismember (set, PRIV_PROC_EXEC) == 1);
+    ASSERT (priv_set_restore (PRIV_PROC_EXEC) == -1);
+        ASSERT (errno == EINVAL);
+    ASSERT (priv_set_ismember (PRIV_PROC_EXEC) == 1);
+        ASSERT (getppriv (PRIV_EFFECTIVE, set) == 0);
+        ASSERT (priv_ismember (set, PRIV_PROC_EXEC) == 1);
+    ASSERT (priv_set_remove (PRIV_PROC_EXEC) == 0);
+    ASSERT (priv_set_ismember (PRIV_PROC_EXEC) == 0);
+        ASSERT (getppriv (PRIV_EFFECTIVE, set) == 0);
+        ASSERT (priv_ismember (set, PRIV_PROC_EXEC) == 0);
+    ASSERT (priv_set_remove (PRIV_PROC_EXEC) == -1);
+        ASSERT (errno == EINVAL);
+    ASSERT (priv_set_ismember (PRIV_PROC_EXEC) == 0);
+        ASSERT (getppriv (PRIV_EFFECTIVE, set) == 0);
+        ASSERT (priv_ismember (set, PRIV_PROC_EXEC) == 0);
+    ASSERT (priv_set_restore (PRIV_PROC_EXEC) == 0);
+    ASSERT (priv_set_ismember (PRIV_PROC_EXEC) == 1);
+        ASSERT (getppriv (PRIV_EFFECTIVE, set) == 0);
+        ASSERT (priv_ismember (set, PRIV_PROC_EXEC) == 1);
+    ASSERT (priv_set_restore (PRIV_PROC_EXEC) == -1);
+        ASSERT (errno == EINVAL);
+    ASSERT (priv_set_ismember (PRIV_PROC_EXEC) == 1);
+        ASSERT (getppriv (PRIV_EFFECTIVE, set) == 0);
+        ASSERT (priv_ismember (set, PRIV_PROC_EXEC) == 1);
+
+    /* Test the priv_set_linkdir wrappers.  */
+    ASSERT (getppriv (PRIV_EFFECTIVE, set) == 0);
+    if (priv_ismember (set, PRIV_SYS_LINKDIR))
+      {
+        ASSERT (priv_set_restore_linkdir () == -1);
+            ASSERT (errno == EINVAL);
+        ASSERT (priv_set_remove_linkdir () == 0);
+        ASSERT (priv_set_remove_linkdir () == -1);
+            ASSERT (errno == EINVAL);
+        ASSERT (priv_set_restore_linkdir () == 0);
+      }
+#else
+    ASSERT (priv_set_restore_linkdir () == -1);
+    ASSERT (priv_set_remove_linkdir () == -1);
+#endif
+
+    return 0;
+}
deleted file mode 120000 (symlink)
index d3eb926b377e83332a8bafc72eb0082d1f7c8914..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pselect.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2f239ddf555b4fac11b869957dc24f877248b143
--- /dev/null
@@ -0,0 +1,49 @@
+/* Test of pselect() substitute.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/select.h>
+
+#include "signature.h"
+
+SIGNATURE_CHECK (pselect, int,
+                 (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                  struct timespec const *restrict, const sigset_t *restrict));
+
+#define TEST_PORT 12347
+#include "test-select.h"
+
+static int
+my_select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+           struct timeval *timeout)
+{
+  struct timespec ts;
+  struct timespec *pts = NULL;
+  if (timeout)
+    {
+      ts.tv_sec = timeout->tv_sec;
+      ts.tv_nsec = timeout->tv_usec * 1000;
+      pts = &ts;
+    }
+  return pselect (nfds, readfds, writefds, exceptfds, pts, NULL);
+}
+
+int
+main (void)
+{
+  return test_function (my_select);
+}
deleted file mode 120000 (symlink)
index 922427589bda436416786544a5e4b43bfc69c085..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pthread-cond.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5c784f86dbc30894a56c960e98d34db66dfb3a1f
--- /dev/null
@@ -0,0 +1,238 @@
+/* Test of condition variables in multithreaded situations.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
+/* Which tests to perform.
+   Uncomment some of these, to verify that all tests crash if no locking
+   is enabled.  */
+#define DO_TEST_COND 1
+#define DO_TEST_TIMEDCOND 1
+
+/* Whether to help the scheduler through explicit sched_yield().
+   Uncomment this to see if the operating system has a fair scheduler.  */
+#define EXPLICIT_YIELD 1
+
+/* Whether to print debugging messages.  */
+#define ENABLE_DEBUGGING 0
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#if EXPLICIT_YIELD
+# include <sched.h>
+#endif
+
+#if HAVE_DECL_ALARM
+# include <signal.h>
+# include <unistd.h>
+#endif
+
+#include "macros.h"
+
+#if ENABLE_DEBUGGING
+# define dbgprintf printf
+#else
+# define dbgprintf if (0) printf
+#endif
+
+#if EXPLICIT_YIELD
+# define yield() sched_yield ()
+#else
+# define yield()
+#endif
+
+
+/*
+ * Condition check
+ */
+static int cond_value = 0;
+static pthread_cond_t condtest;
+static pthread_mutex_t lockcond;
+
+static void *
+pthread_cond_wait_routine (void *arg)
+{
+  ASSERT (pthread_mutex_lock (&lockcond) == 0);
+  while (!cond_value)
+    {
+      ASSERT (pthread_cond_wait (&condtest, &lockcond) == 0);
+    }
+  ASSERT (pthread_mutex_unlock (&lockcond) == 0);
+
+  cond_value = 2;
+
+  return NULL;
+}
+
+static void
+test_pthread_cond_wait ()
+{
+  struct timespec remain;
+  pthread_t thread;
+  int ret;
+
+  remain.tv_sec = 2;
+  remain.tv_nsec = 0;
+
+  cond_value = 0;
+
+  ASSERT (pthread_create (&thread, NULL, pthread_cond_wait_routine, NULL) == 0);
+  do
+    {
+      yield ();
+      ret = nanosleep (&remain, &remain);
+      ASSERT (ret >= -1);
+    }
+  while (ret == -1 && (remain.tv_sec != 0 || remain.tv_nsec != 0));
+
+  /* signal condition */
+  ASSERT (pthread_mutex_lock (&lockcond) == 0);
+  cond_value = 1;
+  ASSERT (pthread_cond_signal (&condtest) == 0);
+  ASSERT (pthread_mutex_unlock (&lockcond) == 0);
+
+  ASSERT (pthread_join (thread, NULL) == 0);
+
+  if (cond_value != 2)
+    abort ();
+}
+
+
+/*
+ * Timed Condition check
+ */
+static int cond_timeout;
+
+static void
+get_ts (struct timespec *ts)
+{
+  struct timeval now;
+
+  gettimeofday (&now, NULL);
+
+  ts->tv_sec = now.tv_sec + 1;
+  ts->tv_nsec = now.tv_usec * 1000;
+}
+
+static void *
+pthread_cond_timedwait_routine (void *arg)
+{
+  int ret;
+  struct timespec ts;
+
+  ASSERT (pthread_mutex_lock (&lockcond) == 0);
+  while (!cond_value)
+    {
+      get_ts (&ts);
+      ret = pthread_cond_timedwait (&condtest, &lockcond, &ts);
+      if (ret == ETIMEDOUT)
+        cond_timeout = 1;
+    }
+  ASSERT (pthread_mutex_unlock (&lockcond) == 0);
+
+  return NULL;
+}
+
+static void
+test_pthread_cond_timedwait (void)
+{
+  struct timespec remain;
+  pthread_t thread;
+  int ret;
+
+  remain.tv_sec = 2;
+  remain.tv_nsec = 0;
+
+  cond_value = cond_timeout = 0;
+
+  ASSERT (pthread_create (&thread, NULL, pthread_cond_timedwait_routine, NULL)
+          == 0);
+  do
+    {
+      yield ();
+      ret = nanosleep (&remain, &remain);
+      ASSERT (ret >= -1);
+    }
+  while (ret == -1 && (remain.tv_sec != 0 || remain.tv_nsec != 0));
+
+  /* signal condition */
+  ASSERT (pthread_mutex_lock (&lockcond) == 0);
+  cond_value = 1;
+  ASSERT (pthread_cond_signal (&condtest) == 0);
+  ASSERT (pthread_mutex_unlock (&lockcond) == 0);
+
+  ASSERT (pthread_join (thread, NULL) == 0);
+
+  if (!cond_timeout)
+    abort ();
+}
+
+int
+main ()
+{
+#if HAVE_DECL_ALARM
+  /* Declare failure if test takes too long, by using default abort
+     caused by SIGALRM.  */
+  int alarm_value = 600;
+  signal (SIGALRM, SIG_DFL);
+  alarm (alarm_value);
+#endif
+
+  ASSERT (pthread_cond_init (&condtest, NULL) == 0);
+
+  {
+    pthread_mutexattr_t attr;
+
+    ASSERT (pthread_mutexattr_init (&attr) == 0);
+    ASSERT (pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_NORMAL) == 0);
+    ASSERT (pthread_mutex_init (&lockcond, &attr) == 0);
+    ASSERT (pthread_mutexattr_destroy (&attr) == 0);
+  }
+
+#if DO_TEST_COND
+  printf ("Starting test_pthread_cond_wait ..."); fflush (stdout);
+  test_pthread_cond_wait ();
+  printf (" OK\n"); fflush (stdout);
+#endif
+#if DO_TEST_TIMEDCOND
+  printf ("Starting test_pthread_cond_timedwait ..."); fflush (stdout);
+  test_pthread_cond_timedwait ();
+  printf (" OK\n"); fflush (stdout);
+#endif
+
+  return 0;
+}
+
+#else
+
+/* No multithreading available.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 475e2bdb8e5d630a7d19a41b30c4476c2a6c7d27..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pthread-mutex.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ece1bb43e3f6de659a066dd872e2680b116b6050
--- /dev/null
@@ -0,0 +1,365 @@
+/* Test of locking in multithreaded situations.
+   Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
+/* Whether to enable locking.
+   Uncomment this to get a test program without locking, to verify that
+   it crashes.  */
+#define ENABLE_LOCKING 1
+
+/* Which tests to perform.
+   Uncomment some of these, to verify that all tests crash if no locking
+   is enabled.  */
+#define DO_TEST_LOCK 1
+#define DO_TEST_RECURSIVE_LOCK 1
+
+/* Whether to help the scheduler through explicit sched_yield().
+   Uncomment this to see if the operating system has a fair scheduler.  */
+#define EXPLICIT_YIELD 1
+
+/* Whether to print debugging messages.  */
+#define ENABLE_DEBUGGING 0
+
+/* Number of simultaneous threads.  */
+#define THREAD_COUNT 10
+
+/* Number of operations performed in each thread.
+   This is quite high, because with a smaller count, say 5000, we often get
+   an "OK" result even without ENABLE_LOCKING (on Linux/x86).  */
+#define REPEAT_COUNT 50000
+
+#include <pthread.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if EXPLICIT_YIELD
+# include <sched.h>
+#endif
+
+#if HAVE_DECL_ALARM
+# include <signal.h>
+# include <unistd.h>
+#endif
+
+#include "macros.h"
+#include "atomic-int-posix.h"
+
+#if ENABLE_DEBUGGING
+# define dbgprintf printf
+#else
+# define dbgprintf if (0) printf
+#endif
+
+#if EXPLICIT_YIELD
+# define yield() sched_yield ()
+#else
+# define yield()
+#endif
+
+/* Returns a reference to the current thread as a pointer, for debugging.  */
+#if defined __MVS__
+  /* On IBM z/OS, pthread_t is a struct with an 8-byte '__' field.
+     The first three bytes of this field appear to uniquely identify a
+     pthread_t, though not necessarily representing a pointer.  */
+# define pthread_self_pointer() (*((void **) pthread_self ().__))
+#else
+# define pthread_self_pointer() ((void *) (uintptr_t) pthread_self ())
+#endif
+
+#define ACCOUNT_COUNT 4
+
+static int account[ACCOUNT_COUNT];
+
+static int
+random_account (void)
+{
+  return ((unsigned long) random () >> 3) % ACCOUNT_COUNT;
+}
+
+static void
+check_accounts (void)
+{
+  int i, sum;
+
+  sum = 0;
+  for (i = 0; i < ACCOUNT_COUNT; i++)
+    sum += account[i];
+  if (sum != ACCOUNT_COUNT * 1000)
+    abort ();
+}
+
+
+/* ------------------- Test normal (non-recursive) locks ------------------- */
+
+/* Test normal locks by having several bank accounts and several threads
+   which shuffle around money between the accounts and another thread
+   checking that all the money is still there.  */
+
+static pthread_mutex_t my_lock;
+
+static void *
+lock_mutator_thread (void *arg)
+{
+  int repeat;
+
+  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+    {
+      int i1, i2, value;
+
+      dbgprintf ("Mutator %p before lock\n", pthread_self_pointer ());
+      ASSERT (pthread_mutex_lock (&my_lock) == 0);
+      dbgprintf ("Mutator %p after  lock\n", pthread_self_pointer ());
+
+      i1 = random_account ();
+      i2 = random_account ();
+      value = ((unsigned long) random () >> 3) % 10;
+      account[i1] += value;
+      account[i2] -= value;
+
+      dbgprintf ("Mutator %p before unlock\n", pthread_self_pointer ());
+      ASSERT (pthread_mutex_unlock (&my_lock) == 0);
+      dbgprintf ("Mutator %p after  unlock\n", pthread_self_pointer ());
+
+      dbgprintf ("Mutator %p before check lock\n", pthread_self_pointer ());
+      ASSERT (pthread_mutex_lock (&my_lock) == 0);
+      check_accounts ();
+      ASSERT (pthread_mutex_unlock (&my_lock) == 0);
+      dbgprintf ("Mutator %p after  check unlock\n", pthread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Mutator %p dying.\n", pthread_self_pointer ());
+  return NULL;
+}
+
+static struct atomic_int lock_checker_done;
+
+static void *
+lock_checker_thread (void *arg)
+{
+  while (get_atomic_int_value (&lock_checker_done) == 0)
+    {
+      dbgprintf ("Checker %p before check lock\n", pthread_self_pointer ());
+      ASSERT (pthread_mutex_lock (&my_lock) == 0);
+      check_accounts ();
+      ASSERT (pthread_mutex_unlock (&my_lock) == 0);
+      dbgprintf ("Checker %p after  check unlock\n", pthread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Checker %p dying.\n", pthread_self_pointer ());
+  return NULL;
+}
+
+static void
+test_pthread_mutex_normal (void)
+{
+  int i;
+  pthread_t checkerthread;
+  pthread_t threads[THREAD_COUNT];
+
+  /* Initialization.  */
+  for (i = 0; i < ACCOUNT_COUNT; i++)
+    account[i] = 1000;
+  init_atomic_int (&lock_checker_done);
+  set_atomic_int_value (&lock_checker_done, 0);
+
+  /* Spawn the threads.  */
+  ASSERT (pthread_create (&checkerthread, NULL, lock_checker_thread, NULL)
+          == 0);
+  for (i = 0; i < THREAD_COUNT; i++)
+    ASSERT (pthread_create (&threads[i], NULL, lock_mutator_thread, NULL) == 0);
+
+  /* Wait for the threads to terminate.  */
+  for (i = 0; i < THREAD_COUNT; i++)
+    ASSERT (pthread_join (threads[i], NULL) == 0);
+  set_atomic_int_value (&lock_checker_done, 1);
+  ASSERT (pthread_join (checkerthread, NULL) == 0);
+  check_accounts ();
+}
+
+
+/* -------------------------- Test recursive locks -------------------------- */
+
+/* Test recursive locks by having several bank accounts and several threads
+   which shuffle around money between the accounts (recursively) and another
+   thread checking that all the money is still there.  */
+
+static pthread_mutex_t my_reclock;
+
+static void
+recshuffle (void)
+{
+  int i1, i2, value;
+
+  dbgprintf ("Mutator %p before lock\n", pthread_self_pointer ());
+  ASSERT (pthread_mutex_lock (&my_reclock) == 0);
+  dbgprintf ("Mutator %p after  lock\n", pthread_self_pointer ());
+
+  i1 = random_account ();
+  i2 = random_account ();
+  value = ((unsigned long) random () >> 3) % 10;
+  account[i1] += value;
+  account[i2] -= value;
+
+  /* Recursive with probability 0.5.  */
+  if (((unsigned long) random () >> 3) % 2)
+    recshuffle ();
+
+  dbgprintf ("Mutator %p before unlock\n", pthread_self_pointer ());
+  ASSERT (pthread_mutex_unlock (&my_reclock) == 0);
+  dbgprintf ("Mutator %p after  unlock\n", pthread_self_pointer ());
+}
+
+static void *
+reclock_mutator_thread (void *arg)
+{
+  int repeat;
+
+  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+    {
+      recshuffle ();
+
+      dbgprintf ("Mutator %p before check lock\n", pthread_self_pointer ());
+      ASSERT (pthread_mutex_lock (&my_reclock) == 0);
+      check_accounts ();
+      ASSERT (pthread_mutex_unlock (&my_reclock) == 0);
+      dbgprintf ("Mutator %p after  check unlock\n", pthread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Mutator %p dying.\n", pthread_self_pointer ());
+  return NULL;
+}
+
+static struct atomic_int reclock_checker_done;
+
+static void *
+reclock_checker_thread (void *arg)
+{
+  while (get_atomic_int_value (&reclock_checker_done) == 0)
+    {
+      dbgprintf ("Checker %p before check lock\n", pthread_self_pointer ());
+      ASSERT (pthread_mutex_lock (&my_reclock) == 0);
+      check_accounts ();
+      ASSERT (pthread_mutex_unlock (&my_reclock) == 0);
+      dbgprintf ("Checker %p after  check unlock\n", pthread_self_pointer ());
+
+      yield ();
+    }
+
+  dbgprintf ("Checker %p dying.\n", pthread_self_pointer ());
+  return NULL;
+}
+
+static void
+test_pthread_mutex_recursive (void)
+{
+  int i;
+  pthread_t checkerthread;
+  pthread_t threads[THREAD_COUNT];
+
+  /* Initialization.  */
+  for (i = 0; i < ACCOUNT_COUNT; i++)
+    account[i] = 1000;
+  init_atomic_int (&reclock_checker_done);
+  set_atomic_int_value (&reclock_checker_done, 0);
+
+  /* Spawn the threads.  */
+  ASSERT (pthread_create (&checkerthread, NULL, reclock_checker_thread, NULL)
+          == 0);
+  for (i = 0; i < THREAD_COUNT; i++)
+    ASSERT (pthread_create (&threads[i], NULL, reclock_mutator_thread, NULL)
+            == 0);
+
+  /* Wait for the threads to terminate.  */
+  for (i = 0; i < THREAD_COUNT; i++)
+    ASSERT (pthread_join (threads[i], NULL) == 0);
+  set_atomic_int_value (&reclock_checker_done, 1);
+  ASSERT (pthread_join (checkerthread, NULL) == 0);
+  check_accounts ();
+}
+
+
+/* -------------------------------------------------------------------------- */
+
+int
+main ()
+{
+#if HAVE_DECL_ALARM
+  /* Declare failure if test takes too long, by using default abort
+     caused by SIGALRM.  */
+  int alarm_value = 600;
+  signal (SIGALRM, SIG_DFL);
+  alarm (alarm_value);
+#endif
+
+  {
+    pthread_mutexattr_t attr;
+
+    ASSERT (pthread_mutexattr_init (&attr) == 0);
+    ASSERT (pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_NORMAL) == 0);
+    ASSERT (pthread_mutex_init (&my_lock, &attr) == 0);
+    ASSERT (pthread_mutexattr_destroy (&attr) == 0);
+  }
+
+  {
+    pthread_mutexattr_t attr;
+
+    ASSERT (pthread_mutexattr_init (&attr) == 0);
+    ASSERT (pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE) == 0);
+    ASSERT (pthread_mutex_init (&my_reclock, &attr) == 0);
+    ASSERT (pthread_mutexattr_destroy (&attr) == 0);
+  }
+
+#if DO_TEST_LOCK
+  printf ("Starting test_pthread_mutex_normal ..."); fflush (stdout);
+  test_pthread_mutex_normal ();
+  printf (" OK\n"); fflush (stdout);
+#endif
+#if DO_TEST_RECURSIVE_LOCK
+  printf ("Starting test_pthread_mutex_recursive ..."); fflush (stdout);
+  test_pthread_mutex_recursive ();
+  printf (" OK\n"); fflush (stdout);
+#endif
+
+  return 0;
+}
+
+#else
+
+/* No multithreading available.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 141d1c77b92399309a9af361825145372ffd902a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pthread-thread.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f0a1979377592c2e708e22f53ae1509653f8e5a8
--- /dev/null
@@ -0,0 +1,73 @@
+/* Test of pthread_create () function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include <pthread.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "macros.h"
+
+static pthread_t main_thread_before;
+static pthread_t main_thread_after;
+static pthread_t worker_thread;
+
+#define MAGIC ((void *) 1266074729)
+static volatile int work_done;
+
+static void *
+worker_thread_func (_GL_UNUSED void *arg)
+{
+  work_done = 1;
+  return MAGIC;
+}
+
+int
+main ()
+{
+  main_thread_before = pthread_self ();
+
+  if (pthread_create (&worker_thread, NULL, worker_thread_func, NULL) == 0)
+    {
+      void *ret;
+
+      /* Check that pthread_self () has the same value before than after the
+         first call to pthread_create ().  */
+      main_thread_after = pthread_self ();
+      ASSERT (memcmp (&main_thread_before, &main_thread_after,
+                      sizeof (pthread_t))
+              == 0);
+
+      ASSERT (pthread_join (worker_thread, &ret) == 0);
+
+      /* Check the return value of the thread.  */
+      ASSERT (ret == MAGIC);
+
+      /* Check that worker_thread_func () has finished executing.  */
+      ASSERT (work_done);
+
+      return 0;
+    }
+  else
+    {
+      fputs ("pthread_create failed\n", stderr);
+      return 1;
+    }
+}
deleted file mode 120000 (symlink)
index 19b9756d5ab368275af6f529bbeca1933664d2e5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pthread.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f7e89c667c2639a4bf1b078ecf72a7a514967570
--- /dev/null
@@ -0,0 +1,88 @@
+/* Test of <pthread.h> substitute.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+#include <pthread.h>
+
+/* Check that the types are all defined.  */
+
+pthread_t t1;
+pthread_attr_t t2;
+
+pthread_once_t t3 = PTHREAD_ONCE_INIT;
+
+pthread_mutex_t t4 = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutexattr_t t5;
+
+pthread_rwlock_t t6 = PTHREAD_RWLOCK_INITIALIZER;
+pthread_rwlockattr_t t7;
+
+pthread_cond_t t8 = PTHREAD_COND_INITIALIZER;
+pthread_condattr_t t9;
+
+pthread_key_t t10;
+
+pthread_spinlock_t t11;
+
+#ifdef TODO /* Not implemented in gnulib yet */
+pthread_barrier_t t12;
+pthread_barrierattr_t t13;
+#endif
+
+/* Check that the various macros are defined.  */
+
+/* Constants for pthread_attr_setdetachstate().  */
+int ds[] = { PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_DETACHED };
+
+/* Constants for pthread_exit().  */
+void *canceled = PTHREAD_CANCELED;
+
+/* Constants for pthread_mutexattr_settype().  */
+int mt[] = {
+  PTHREAD_MUTEX_DEFAULT,
+  PTHREAD_MUTEX_NORMAL,
+  PTHREAD_MUTEX_RECURSIVE,
+  PTHREAD_MUTEX_ERRORCHECK
+};
+
+#ifdef TODO /* Not implemented in gnulib yet */
+
+/* Constants for pthread_mutexattr_setrobust().  */
+int mr[] = { PTHREAD_MUTEX_ROBUST, PTHREAD_MUTEX_STALLED };
+
+/* Constants for pthread_barrierattr_setpshared().  */
+int bp[] = { PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE };
+
+/* Constants for pthread_barrier_wait().  */
+int bw[] = { PTHREAD_BARRIER_SERIAL_THREAD };
+
+/* Constants for pthread_setcancelstate().  */
+int cs[] = { PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE };
+
+/* Constants for pthread_setcanceltype().  */
+int ct[] = { PTHREAD_CANCEL_DEFERRED, PTHREAD_CANCEL_ASYNCHRONOUS };
+
+#endif
+
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index fdd8a2d303221f31c4069456358bd2c284da2e6c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pthread_sigmask1.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a4f9ba6d7fc7313f094f6633836e6d3cebc0df00
--- /dev/null
@@ -0,0 +1,96 @@
+/* Test of pthread_sigmask in a single-threaded program.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include <signal.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (pthread_sigmask, int, (int, const sigset_t *, sigset_t *));
+
+#include <errno.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#if !(defined _WIN32 && !defined __CYGWIN__)
+
+static volatile int sigint_occurred;
+
+static void
+sigint_handler (_GL_UNUSED int sig)
+{
+  sigint_occurred++;
+}
+
+int
+main ()
+{
+  sigset_t set;
+  intmax_t pid = getpid ();
+  char command[80];
+
+  signal (SIGINT, sigint_handler);
+
+  sigemptyset (&set);
+  sigaddset (&set, SIGINT);
+
+  /* Check error handling.  */
+  ASSERT (pthread_sigmask (1729, &set, NULL) == EINVAL);
+
+  /* Block SIGINT.  */
+  ASSERT (pthread_sigmask (SIG_BLOCK, &set, NULL) == 0);
+
+  /* Request a SIGINT signal from outside.  */
+  sprintf (command, "sh -c 'sleep 1; kill -INT %"PRIdMAX"' &", pid);
+  ASSERT (system (command) == 0);
+
+  /* Wait.  */
+  sleep (2);
+
+  /* The signal should not have arrived yet, because it is blocked.  */
+  ASSERT (sigint_occurred == 0);
+
+  /* Unblock SIGINT.  */
+  ASSERT (pthread_sigmask (SIG_UNBLOCK, &set, NULL) == 0);
+
+  /* The signal should have arrived now, because POSIX says
+       "If there are any pending unblocked signals after the call to
+        pthread_sigmask(), at least one of those signals shall be delivered
+        before the call to pthread_sigmask() returns."  */
+  ASSERT (sigint_occurred == 1);
+
+  return 0;
+}
+
+#else
+
+/* On native Windows, getpid() values and the arguments that are passed to
+   the (Cygwin?) 'kill' program are not necessarily related.  */
+
+int
+main ()
+{
+  fputs ("Skipping test: native Windows platform\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index c10e8588a5eeca10b4be316f23c15fb71f31acad..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-pthread_sigmask2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d527eb8d6577fe1bf6afe8d594b2f35723fa1265
--- /dev/null
@@ -0,0 +1,105 @@
+/* Test of pthread_sigmask in a multi-threaded program.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include <signal.h>
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+static pthread_t main_thread;
+static pthread_t killer_thread;
+
+static void *
+killer_thread_func (_GL_UNUSED void *arg)
+{
+  sleep (1);
+  pthread_kill (main_thread, SIGINT);
+  return NULL;
+}
+
+static volatile int sigint_occurred;
+
+static void
+sigint_handler (_GL_UNUSED int sig)
+{
+  sigint_occurred++;
+}
+
+int
+main ()
+{
+  sigset_t set;
+
+  signal (SIGINT, sigint_handler);
+
+  sigemptyset (&set);
+  sigaddset (&set, SIGINT);
+
+  /* Check error handling.  */
+  /* This call returns 0 on NetBSD 8.0.  */
+#if !defined __NetBSD__
+  ASSERT (pthread_sigmask (1729, &set, NULL) == EINVAL);
+#endif
+
+  /* Block SIGINT.  */
+  ASSERT (pthread_sigmask (SIG_BLOCK, &set, NULL) == 0);
+
+  /* Request a SIGINT signal from another thread.  */
+  main_thread = pthread_self ();
+  ASSERT (pthread_create (&killer_thread, NULL, killer_thread_func, NULL) == 0);
+
+  /* Wait.  */
+  sleep (2);
+
+  /* The signal should not have arrived yet, because it is blocked.  */
+  ASSERT (sigint_occurred == 0);
+
+  /* Unblock SIGINT.  */
+  ASSERT (pthread_sigmask (SIG_UNBLOCK, &set, NULL) == 0);
+
+  /* The signal should have arrived now, because POSIX says
+       "If there are any pending unblocked signals after the call to
+        pthread_sigmask(), at least one of those signals shall be delivered
+        before the call to pthread_sigmask() returns."  */
+  ASSERT (sigint_occurred == 1);
+
+  /* Clean up the thread.  This avoid a "ThreadSanitizer: thread leak" warning
+     from "gcc -fsanitize=thread".  */
+  ASSERT (pthread_join (killer_thread, NULL) == 0);
+
+  return 0;
+}
+
+#else
+
+int
+main ()
+{
+  fputs ("Skipping test: POSIX threads not enabled\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 25906a736eef5b34af5f960789861677b1b8f11c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-qsort_r.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9cdbd5e3f26038c871cd2f42c34b16b6c50697c9
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test qsort_r.
+
+   Copyright 2014-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+int
+cmp (void const *va, void const *vb, void *varg)
+{
+  char const *a = va;
+  char const *b = vb;
+  int *arg = varg;
+  return (*a < *b ? -1 : *a > *b) * *arg;
+}
+
+int
+main (void)
+{
+  char buf[] = "thequickbrownfoxjumpedoverthelazydogs";
+  int forward = 1;
+  int reverse = -1;
+  qsort_r (buf, sizeof buf - 1, 1, cmp, &forward);
+  if (strcmp (buf, "abcddeeeefghhijklmnoooopqrrsttuuvwxyz") != 0)
+    return 1;
+  qsort_r (buf, sizeof buf - 1, 1, cmp, &reverse);
+  if (strcmp (buf, "zyxwvuuttsrrqpoooonmlkjihhgfeeeeddcba") != 0)
+    return 1;
+  return 0;
+}
deleted file mode 120000 (symlink)
index e58795594693255a1f8e48b1294487efd9efb74c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-quotearg-simple.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5a9a7695e8ce9cfd2013290c919031d53aad8b4b
--- /dev/null
@@ -0,0 +1,365 @@
+/* Test of quotearg family of functions.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2008.  */
+
+#include <config.h>
+
+#include "quotearg.h"
+
+#include <ctype.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "localcharset.h"
+#include "macros.h"
+#include "zerosize-ptr.h"
+
+#include "test-quotearg.h"
+
+static struct result_groups results_g[] = {
+  /* literal_quoting_style */
+  { { "", "\0""1\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
+      "a' b", LQ RQ, LQ RQ },
+    { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
+      "a' b", LQ RQ, LQ RQ },
+    { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
+      "a' b", LQ RQ, LQ RQ } },
+
+  /* shell_quoting_style */
+  { { "''", "\0""1\0", 3, "simple", "' \t\n'\\''\"\033?""?/\\'", "a:b",
+      "'a\\b'", "\"a' b\"", LQ RQ, LQ RQ },
+    { "''", "1", 1, "simple", "' \t\n'\\''\"\033?""?/\\'", "a:b",
+      "'a\\b'", "\"a' b\"", LQ RQ, LQ RQ },
+    { "''", "1", 1, "simple", "' \t\n'\\''\"\033?""?/\\'", "'a:b'",
+      "'a\\b'", "\"a' b\"", LQ RQ, LQ RQ } },
+
+  /* shell_always_quoting_style */
+  { { "''", "'\0""1\0'", 5, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'",
+      "'a\\b'", "\"a' b\"", "'" LQ RQ "'", "'" LQ RQ "'" },
+    { "''", "'1'", 3, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'",
+      "'a\\b'", "\"a' b\"", "'" LQ RQ "'", "'" LQ RQ "'" },
+    { "''", "'1'", 3, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'",
+      "'a\\b'", "\"a' b\"", "'" LQ RQ "'", "'" LQ RQ "'" } },
+
+  /* shell_escape_quoting_style */
+  { { "''", "''$'\\0''1'$'\\0'", 15, "simple",
+      "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "a:b",
+      "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", LQ RQ },
+    { "''", "''$'\\0''1'$'\\0'", 15, "simple",
+      "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "a:b",
+      "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", LQ RQ },
+    { "''", "''$'\\0''1'$'\\0'", 15, "simple",
+      "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'",
+      "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", LQ RQ } },
+
+  /* shell_escape_always_quoting_style */
+  { { "''", "''$'\\0''1'$'\\0'", 15, "'simple'",
+      "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'",
+      "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
+    { "''", "''$'\\0''1'$'\\0'", 15, "'simple'",
+      "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'",
+      "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
+    { "''", "''$'\\0''1'$'\\0'", 15, "'simple'",
+      "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'",
+      "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" } },
+
+  /* c_quoting_style */
+  { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
+      "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
+      "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"",
+      "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" } },
+
+  /* c_maybe_quoting_style */
+  { { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
+      "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
+    { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
+      "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
+    { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
+      "\"a:b\"", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ } },
+
+  /* escape_quoting_style */
+  { { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b",
+      "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ },
+    { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b",
+      "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ },
+    { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a\\:b",
+      "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ } },
+
+  /* locale_quoting_style */
+  { { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'",
+      "'a:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
+    { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'",
+      "'a:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
+    { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'",
+      "'a\\:b'", "'a\\\\b'", "'a\\' b'",
+      "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" } },
+
+  /* clocale_quoting_style */
+  { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
+      "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
+      "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"",
+      "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" } }
+};
+
+static struct result_groups flag_results[] = {
+  /* literal_quoting_style and QA_ELIDE_NULL_BYTES */
+  { { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b",
+      LQ RQ, LQ RQ },
+    { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b",
+      LQ RQ, LQ RQ },
+    { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b",
+      LQ RQ, LQ RQ } },
+
+  /* c_quoting_style and QA_ELIDE_OUTER_QUOTES */
+  { { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
+      "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
+    { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
+      "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
+    { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
+      "\"a:b\"", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ } },
+
+  /* c_quoting_style and QA_SPLIT_TRIGRAPHS */
+  { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+      "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
+      "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+      "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
+      "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+      "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"",
+      "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" } }
+};
+
+static char const *custom_quotes[][2] = {
+  { "", ""  },
+  { "'", "'"  },
+  { "(", ")"  },
+  { ":", " "  },
+  { " ", ":"  },
+  { "# ", "\n" },
+  { "\"'", "'\"" }
+};
+
+static struct result_groups custom_results[] = {
+  /* left_quote = right_quote = "" */
+  { { "", "\\0001\\0", 7, "simple",
+      " \\t\\n'\"\\033?""?/\\\\", "a:b", "a\\\\b",
+      "a' b", LQ_ENC RQ_ENC, LQ RQ },
+    { "", "\\0001\\0", 7, "simple",
+      " \\t\\n'\"\\033?""?/\\\\", "a:b", "a\\\\b",
+      "a' b", LQ_ENC RQ_ENC, LQ RQ },
+    { "", "\\0001\\0", 7, "simple",
+      " \\t\\n'\"\\033?""?/\\\\", "a\\:b", "a\\\\b",
+      "a' b", LQ_ENC RQ_ENC, LQ RQ } },
+
+  /* left_quote = right_quote = "'" */
+  { { "''", "'\\0001\\0'", 9, "'simple'",
+      "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'",
+      "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
+    { "''", "'\\0001\\0'", 9, "'simple'",
+      "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'",
+      "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
+    { "''", "'\\0001\\0'", 9, "'simple'",
+      "' \\t\\n\\'\"\\033?""?/\\\\'", "'a\\:b'", "'a\\\\b'",
+      "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" } },
+
+  /* left_quote = "(" and right_quote = ")" */
+  { { "()", "(\\0001\\0)", 9, "(simple)",
+      "( \\t\\n'\"\\033?""?/\\\\)", "(a:b)", "(a\\\\b)",
+      "(a' b)", "(" LQ_ENC RQ_ENC ")", "(" LQ RQ ")" },
+    { "()", "(\\0001\\0)", 9, "(simple)",
+      "( \\t\\n'\"\\033?""?/\\\\)", "(a:b)", "(a\\\\b)",
+      "(a' b)", "(" LQ_ENC RQ_ENC ")", "(" LQ RQ ")" },
+    { "()", "(\\0001\\0)", 9, "(simple)",
+      "( \\t\\n'\"\\033?""?/\\\\)", "(a\\:b)", "(a\\\\b)",
+      "(a' b)", "(" LQ_ENC RQ_ENC ")", "(" LQ RQ ")" } },
+
+  /* left_quote = ":" and right_quote = " " */
+  { { ": ", ":\\0001\\0 ", 9, ":simple ",
+      ":\\ \\t\\n'\"\\033?""?/\\\\ ", ":a:b ", ":a\\\\b ",
+      ":a'\\ b ", ":" LQ_ENC RQ_ENC " ", ":" LQ RQ " " },
+    { ": ", ":\\0001\\0 ", 9, ":simple ",
+      ":\\ \\t\\n'\"\\033?""?/\\\\ ", ":a:b ", ":a\\\\b ",
+      ":a'\\ b ", ":" LQ_ENC RQ_ENC " ", ":" LQ RQ " " },
+    { ": ", ":\\0001\\0 ", 9, ":simple ",
+      ":\\ \\t\\n'\"\\033?""?/\\\\ ", ":a\\:b ", ":a\\\\b ",
+      ":a'\\ b ", ":" LQ_ENC RQ_ENC " ", ":" LQ RQ " " } },
+
+  /* left_quote = " " and right_quote = ":" */
+  { { " :", " \\0001\\0:", 9, " simple:",
+      "  \\t\\n'\"\\033?""?/\\\\:", " a\\:b:", " a\\\\b:",
+      " a' b:", " " LQ_ENC RQ_ENC ":", " " LQ RQ ":" },
+    { " :", " \\0001\\0:", 9, " simple:",
+      "  \\t\\n'\"\\033?""?/\\\\:", " a\\:b:", " a\\\\b:",
+      " a' b:", " " LQ_ENC RQ_ENC ":", " " LQ RQ ":" },
+    { " :", " \\0001\\0:", 9, " simple:",
+      "  \\t\\n'\"\\033?""?/\\\\:", " a\\:b:", " a\\\\b:",
+      " a' b:", " " LQ_ENC RQ_ENC ":", " " LQ RQ ":" } },
+
+  /* left_quote = "# " and right_quote = "\n" */
+  { { "# \n", "# \\0001\\0\n", 10, "# simple\n",
+      "#  \\t\\n'\"\\033?""?/\\\\\n", "# a:b\n", "# a\\\\b\n",
+      "# a' b\n", "# " LQ_ENC RQ_ENC "\n", "# " LQ RQ "\n" },
+    { "# \n", "# \\0001\\0\n", 10, "# simple\n",
+      "#  \\t\\n'\"\\033?""?/\\\\\n", "# a:b\n", "# a\\\\b\n",
+      "# a' b\n", "# " LQ_ENC RQ_ENC "\n", "# " LQ RQ "\n" },
+    { "# \n", "# \\0001\\0\n", 10, "# simple\n",
+      "#  \\t\\n'\"\\033?""?/\\\\\n", "# a\\:b\n", "# a\\\\b\n",
+      "# a' b\n", "# " LQ_ENC RQ_ENC "\n", "# " LQ RQ "\n" } },
+
+  /* left_quote = "\"'" and right_quote = "'\"" */
+  { { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"",
+      "\"' \\t\\n\\'\"\\033?""?/\\\\'\"", "\"'a:b'\"", "\"'a\\\\b'\"",
+      "\"'a' b'\"", "\"'" LQ_ENC RQ_ENC "'\"", "\"'" LQ RQ "'\"" },
+    { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"",
+      "\"' \\t\\n\\'\"\\033?""?/\\\\'\"", "\"'a:b'\"", "\"'a\\\\b'\"",
+      "\"'a' b'\"", "\"'" LQ_ENC RQ_ENC "'\"", "\"'" LQ RQ "'\"" },
+    { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"",
+      "\"' \\t\\n\\'\"\\033?""?/\\\\'\"", "\"'a\\:b'\"", "\"'a\\\\b'\"",
+      "\"'a' b'\"", "\"'" LQ_ENC RQ_ENC "'\"", "\"'" LQ RQ "'\"" } }
+};
+
+static char *
+use_quote_double_quotes (const char *str, size_t *len)
+{
+  char *p = *len == SIZE_MAX ? quotearg_char (str, '"')
+                               : quotearg_char_mem (str, *len, '"');
+  *len = strlen (p);
+  return p;
+}
+
+int
+main (_GL_UNUSED int argc, char *argv[])
+{
+  int i;
+  bool ascii_only = MB_CUR_MAX == 1 && !isprint ((unsigned char) LQ[0]);
+
+  /* This part of the program is hard-wired to the C locale since it
+     does not call setlocale.  However, according to POSIX, the use of
+     8-bit bytes in a character context in the C locale gives
+     unspecified results (that is, the C locale charset is allowed to
+     be unibyte with 8-bit bytes rejected [ASCII], unibyte with 8-bit
+     bytes being characters [often ISO-8859-1], or multibyte [often
+     UTF-8]).  We assume that the latter two cases will be
+     indistinguishable in this test - that is, the LQ and RQ sequences
+     will pass through unchanged in either type of charset.  So when
+     testing for quoting of str7, use the ascii_only flag to decide
+     what to expect for the 8-bit data being quoted.  */
+  ASSERT (!isprint ('\033'));
+  for (i = literal_quoting_style; i <= clocale_quoting_style; i++)
+    {
+      set_quoting_style (NULL, (enum quoting_style) i);
+      if (!(i == locale_quoting_style || i == clocale_quoting_style)
+          || (strcmp (locale_charset (), "ASCII") == 0
+              || strcmp (locale_charset (), "ANSI_X3.4-1968") == 0))
+        {
+          compare_strings (use_quotearg_buffer, &results_g[i].group1,
+                           ascii_only);
+          compare_strings (use_quotearg, &results_g[i].group2,
+                           ascii_only);
+          if (i == c_quoting_style)
+            compare_strings (use_quote_double_quotes, &results_g[i].group2,
+                             ascii_only);
+          compare_strings (use_quotearg_colon, &results_g[i].group3,
+                           ascii_only);
+        }
+    }
+
+  set_quoting_style (NULL, literal_quoting_style);
+  ASSERT (set_quoting_flags (NULL, QA_ELIDE_NULL_BYTES) == 0);
+  compare_strings (use_quotearg_buffer, &flag_results[0].group1, ascii_only);
+  compare_strings (use_quotearg, &flag_results[0].group2, ascii_only);
+  compare_strings (use_quotearg_colon, &flag_results[0].group3, ascii_only);
+
+  set_quoting_style (NULL, c_quoting_style);
+  ASSERT (set_quoting_flags (NULL, QA_ELIDE_OUTER_QUOTES)
+          == QA_ELIDE_NULL_BYTES);
+  compare_strings (use_quotearg_buffer, &flag_results[1].group1, ascii_only);
+  compare_strings (use_quotearg, &flag_results[1].group2, ascii_only);
+  compare_strings (use_quote_double_quotes, &flag_results[1].group2,
+                   ascii_only);
+  compare_strings (use_quotearg_colon, &flag_results[1].group3, ascii_only);
+
+  ASSERT (set_quoting_flags (NULL, QA_SPLIT_TRIGRAPHS)
+          == QA_ELIDE_OUTER_QUOTES);
+  compare_strings (use_quotearg_buffer, &flag_results[2].group1, ascii_only);
+  compare_strings (use_quotearg, &flag_results[2].group2, ascii_only);
+  compare_strings (use_quote_double_quotes, &flag_results[2].group2,
+                   ascii_only);
+  compare_strings (use_quotearg_colon, &flag_results[2].group3, ascii_only);
+
+  ASSERT (set_quoting_flags (NULL, 0) == QA_SPLIT_TRIGRAPHS);
+
+  for (i = 0; i < sizeof custom_quotes / sizeof *custom_quotes; ++i)
+    {
+      set_custom_quoting (NULL,
+                          custom_quotes[i][0], custom_quotes[i][1]);
+      compare_strings (use_quotearg_buffer, &custom_results[i].group1,
+                       ascii_only);
+      compare_strings (use_quotearg, &custom_results[i].group2, ascii_only);
+      compare_strings (use_quotearg_colon, &custom_results[i].group3,
+                       ascii_only);
+    }
+
+  {
+    /* Trigger the bug whereby quotearg_buffer would read beyond the NUL
+       that defines the end of the string being quoted.  Use an input
+       string whose NUL is the last byte before an unreadable page.  */
+    char *z = zerosize_ptr ();
+
+    if (z)
+      {
+        size_t q_len = 1024;
+        char *q = malloc (q_len + 1);
+        char buf[10];
+        memset (q, 'Q', q_len);
+        q[q_len] = 0;
+
+        /* Z points to the boundary between a readable/writable page
+           and one that is neither readable nor writable.  Position
+           our string so its NUL is at the end of the writable one.  */
+        char const *str = "____";
+        size_t s_len = strlen (str);
+        z -= s_len + 1;
+        memcpy (z, str, s_len + 1);
+
+        set_custom_quoting (NULL, q, q);
+        /* Whether this actually triggers a SEGV depends on the
+           implementation of memcmp: whether it compares only byte-at-
+           a-time, and from left to right (no SEGV) or some other way.  */
+        size_t n = quotearg_buffer (buf, sizeof buf, z, SIZE_MAX, NULL);
+        ASSERT (n == s_len + 2 * q_len);
+        ASSERT (memcmp (buf, q, sizeof buf) == 0);
+        free (q);
+      }
+  }
+
+  quotearg_free ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 73a5dd0afeba14c49dc619e30a19c416f78e1c35..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-quotearg.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..47de7fee9fa5cba4df7abacb488bc438bbfff39c
--- /dev/null
@@ -0,0 +1,128 @@
+/* Test of quotearg family of functions.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2008.  */
+
+struct result_strings {
+  char const *str1; /* Translation of "".  */
+  char const *str2; /* Translation of "\0""1\0".  */
+  size_t len2; /* Length of str2.  */
+  char const *str3; /* Translation of "simple".  */
+  char const *str4; /* Translation of " \t\n'\"\033?""?/\\".  */
+  char const *str5; /* Translation of "a:b".  */
+  char const *str6; /* Translation of "a\\b".  */
+  char const *str7; /* Translation of "a' b".  */
+  char const *str8a; /* Translation of LQ RQ, in ASCII charset.  */
+  char const *str8b; /* Translation of LQ RQ, in Latin1 or UTF-8 charset.  */
+};
+
+struct result_groups {
+  struct result_strings group1; /* Via quotearg_buffer.  */
+  struct result_strings group2; /* Via quotearg{,_mem}.  */
+  struct result_strings group3; /* Via quotearg_colon{,_mem}.  */
+};
+
+/* These quotes are borrowed from a pt_PT.utf8 translation.  */
+# define LQ "\302\253"
+# define RQ "\302\273"
+# define LQ_ENC "\\302\\253"
+# define RQ_ENC "\\302\\273"
+# define RQ_ESC "\\\302\273"
+
+static struct result_strings inputs = {
+  "", "\0001\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
+  "a' b", LQ RQ, NULL
+};
+
+static void
+compare (char const *a, size_t la, char const *b, size_t lb)
+{
+  ASSERT (la == lb);
+  ASSERT (memcmp (a, b, la) == 0);
+  ASSERT (b[lb] == '\0');
+}
+
+static void
+compare_strings (char *(func) (char const *, size_t *),
+                 struct result_strings *results, bool ascii_only)
+{
+  size_t len;
+  char *p;
+
+  len = 0;
+  p = func (inputs.str1, &len);
+  compare (results->str1, strlen (results->str1), p, len);
+
+  len = inputs.len2;
+  p = func (inputs.str2, &len);
+  compare (results->str2, results->len2, p, len);
+
+  len = SIZE_MAX;
+  p = func (inputs.str3, &len);
+  compare (results->str3, strlen (results->str3), p, len);
+
+  len = strlen (inputs.str4);
+  p = func (inputs.str4, &len);
+  compare (results->str4, strlen (results->str4), p, len);
+
+  len = SIZE_MAX;
+  p = func (inputs.str5, &len);
+  compare (results->str5, strlen (results->str5), p, len);
+
+  len = strlen (inputs.str6);
+  p = func (inputs.str6, &len);
+  compare (results->str6, strlen (results->str6), p, len);
+
+  len = strlen (inputs.str7);
+  p = func (inputs.str7, &len);
+  compare (results->str7, strlen (results->str7), p, len);
+
+  len = strlen (inputs.str8a);
+  p = func (inputs.str8a, &len);
+  if (ascii_only)
+    compare (results->str8a, strlen (results->str8a), p, len);
+  else
+    compare (results->str8b, strlen (results->str8b), p, len);
+}
+
+static char *
+use_quotearg_buffer (const char *str, size_t *len)
+{
+  static char buf[100];
+  size_t size;
+  memset (buf, 0xa5, 100);
+  size = quotearg_buffer (buf, 100, str, *len, NULL);
+  *len = size;
+  ASSERT ((unsigned char) buf[size + 1] == 0xa5);
+  return buf;
+}
+
+static char *
+use_quotearg (const char *str, size_t *len)
+{
+  char *p = *len == SIZE_MAX ? quotearg (str) : quotearg_mem (str, *len);
+  *len = strlen (p);
+  return p;
+}
+
+static char *
+use_quotearg_colon (const char *str, size_t *len)
+{
+  char *p = (*len == SIZE_MAX ? quotearg_colon (str)
+             : quotearg_colon_mem (str, *len));
+  *len = strlen (p);
+  return p;
+}
deleted file mode 120000 (symlink)
index 1035a20f0b94a9c543205558673513523aec0b4f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-raise.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..39ffdc3085d48db4c79763873bec398b0de060d3
--- /dev/null
@@ -0,0 +1,51 @@
+/* Test raising a signal.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <signal.h>
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (raise, int, (int));
+
+#include <stdlib.h>
+
+#include "macros.h"
+
+/* It is safe to use _Noreturn here: _exit() never returns, and GCC knows that
+   _exit() is a non-returning function, even on platforms where its declaration
+   in <unistd.h> does not have the 'noreturn' attribute.  */
+static _Noreturn void
+handler (_GL_UNUSED int sig)
+{
+  _exit (0);
+}
+
+int
+main (void)
+{
+  /* Test behaviour for invalid argument.  */
+  ASSERT (raise (-1) != 0);
+
+  /* Test behaviour for SIGINT.  */
+  ASSERT (signal (SIGINT, handler) != SIG_ERR);
+
+  raise (SIGINT);
+
+  /* We should not get here, because the handler takes away the control.  */
+  exit (1);
+}
deleted file mode 120000 (symlink)
index d1cd8b7f088f5a5d870bcd91733933d003d7ce26..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-random-mt.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4e2f2d378e93bbdfc0893437f19ef1fb4310b4e0
--- /dev/null
@@ -0,0 +1,169 @@
+/* Multithread-safety test for random().
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
+/* Whether to help the scheduler through explicit yield().
+   Uncomment this to see if the operating system has a fair scheduler.  */
+#define EXPLICIT_YIELD 1
+
+/* Number of simultaneous threads.  */
+#define THREAD_COUNT 4
+
+/* Number of random() invocations operations performed in each thread.
+   This value is chosen so that the unit test terminates quickly.
+   To reliably determine whether a random() implementation is multithread-safe,
+   set REPEAT_COUNT to 1000000 and run the test 100 times:
+     $ for i in `seq 100`; do ./test-random-mt; done
+ */
+#define REPEAT_COUNT 100000
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <stdio.h>
+
+#if EXPLICIT_YIELD
+# include <sched.h>
+#endif
+
+#include "glthread/thread.h"
+#include "xalloc.h"
+
+#if EXPLICIT_YIELD
+# define yield() sched_yield ()
+#else
+# define yield()
+#endif
+
+/* This test runs REPEAT_COUNT invocations of random() in each thread and stores
+   the result, then compares the first REPEAT_COUNT among these
+     THREAD_COUNT * REPEAT_COUNT
+   random numbers against a precomputed sequence with the same seed.  */
+
+static void *
+random_invocator_thread (void *arg)
+{
+  long *storage = (long *) arg;
+  int repeat;
+
+  for (repeat = 0; repeat < REPEAT_COUNT; repeat++)
+    {
+      storage[repeat] = random ();
+      yield ();
+    }
+
+  return NULL;
+}
+
+int
+main ()
+{
+  unsigned int seed = 19891109;
+
+  /* First, get the expected sequence of random() results.  */
+  srandom (seed);
+  long *expected = XNMALLOC (REPEAT_COUNT, long);
+  {
+    int repeat;
+    for (repeat = 0; repeat < REPEAT_COUNT; repeat++)
+      expected[repeat] = random ();
+  }
+
+  /* Then, run REPEAT_COUNT invocations of random() each, in THREAD_COUNT
+     separate threads.  */
+  gl_thread_t threads[THREAD_COUNT];
+  long *thread_results[THREAD_COUNT];
+  srandom (seed);
+  {
+    int i;
+    for (i = 0; i < THREAD_COUNT; i++)
+      thread_results[i] = XNMALLOC (REPEAT_COUNT, long);
+    for (i = 0; i < THREAD_COUNT; i++)
+      threads[i] =
+        gl_thread_create (random_invocator_thread, thread_results[i]);
+  }
+
+  /* Wait for the threads to terminate.  */
+  {
+    int i;
+    for (i = 0; i < THREAD_COUNT; i++)
+      gl_thread_join (threads[i], NULL);
+  }
+
+  /* Finally, determine whether the threads produced the same sequence of
+     random() results.  */
+  {
+    int expected_index;
+    int result_index[THREAD_COUNT];
+    int i;
+
+    for (i = 0; i < THREAD_COUNT; i++)
+      result_index[i] = 0;
+
+    for (expected_index = 0; expected_index < REPEAT_COUNT; expected_index++)
+      {
+        long expected_value = expected[expected_index];
+
+        for (i = 0; i < THREAD_COUNT; i++)
+          {
+            if (thread_results[i][result_index[i]] == expected_value)
+              {
+                result_index[i]++;
+                break;
+              }
+          }
+        if (i == THREAD_COUNT)
+          {
+            if (expected_index == 0)
+              {
+                /* This occurs on platforms like OpenBSD, where srandom() has no
+                   effect and random() always return non-deterministic values.
+                   Mark the test as SKIP.  */
+                fprintf (stderr, "Skipping test: random() is non-deterministic.\n");
+                return 77;
+              }
+            else
+              {
+                fprintf (stderr, "Expected value #%d not found in multithreaded results.\n",
+                         expected_index);
+                return 1;
+              }
+          }
+      }
+  }
+
+  return 0;
+}
+
+#else
+
+/* No multithreading available.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index b2f129ca009dd0f4a759d91a7af6cb3c070248be..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-random.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4bfc1b8483d50704d44efaec5462f29d40207fb7
--- /dev/null
@@ -0,0 +1,49 @@
+/* Test random.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (srandom, void, (unsigned int));
+SIGNATURE_CHECK (initstate, char *, (unsigned int, char *, size_t));
+SIGNATURE_CHECK (setstate, char *, (char *));
+SIGNATURE_CHECK (random, long, (void));
+
+#include <time.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  char buf[128];
+  unsigned int i;
+  unsigned int n_big = 0;
+
+  initstate (time (NULL), buf, sizeof buf);
+  for (i = 0; i < 1000; i++)
+    {
+      long r = random ();
+      ASSERT (0 <= r);
+      if (RAND_MAX / 2 < r)
+        ++n_big;
+    }
+
+  /* Fail if none of the numbers were larger than RAND_MAX / 2.  */
+  return !n_big;
+}
deleted file mode 120000 (symlink)
index 8ed62b82ad3601a997ff85079ec02139ce7ff572..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-random_r.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..19f570d787a116ced076698d2c7154a34ff4d5bb
--- /dev/null
@@ -0,0 +1,68 @@
+/* Test random_r.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (srandom_r, int, (unsigned int, struct random_data *));
+SIGNATURE_CHECK (initstate_r, int, (unsigned int, char *, size_t,
+                                    struct random_data *));
+SIGNATURE_CHECK (setstate_r, int, (char *, struct random_data *));
+SIGNATURE_CHECK (random_r, int, (struct random_data *, int32_t *));
+
+#include <time.h>
+
+#include "macros.h"
+
+/* Note: This test crashes on glibc/SPARC systems.
+   Reported at <https://sourceware.org/bugzilla/show_bug.cgi?id=30584>.  */
+
+static int
+test_failed (int alignment)
+{
+  struct random_data rand_state;
+  char buf[128 + sizeof (int32_t)];
+  unsigned int i;
+  unsigned int n_big = 0;
+
+  rand_state.state = NULL;
+  if (initstate_r (time (NULL), buf + alignment, sizeof buf - alignment,
+                   &rand_state))
+    return 1;
+  for (i = 0; i < 1000; i++)
+    {
+      int32_t r;
+      ASSERT (random_r (&rand_state, &r) == 0);
+      ASSERT (0 <= r);
+      if (RAND_MAX / 2 < r)
+        ++n_big;
+    }
+
+  /* Fail if none of the numbers were larger than RAND_MAX / 2.  */
+  return !n_big;
+}
+
+int
+main ()
+{
+  int alignment;
+  for (alignment = 0; alignment < sizeof (int32_t); alignment++)
+    if (test_failed (alignment))
+      return 1;
+  return 0;
+}
deleted file mode 120000 (symlink)
index a740351b4f9b146665592f7f6c1efd54961948dd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-rawmemchr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..23d411c77aa88a74d94a0caa12cb4c95ae28c691
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ * Written by Eric Blake and Bruno Haible
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (rawmemchr, void *, (void const *, int));
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+/* Calculating void * + int is not portable, so this wrapper converts
+   to char * to make the tests easier to write.  */
+#define RAWMEMCHR (char *) rawmemchr
+
+int
+main (void)
+{
+  size_t n = 0x100000;
+  char *input = malloc (n + 1);
+  ASSERT (input);
+
+  input[0] = 'a';
+  input[1] = 'b';
+  memset (input + 2, 'c', 1024);
+  memset (input + 1026, 'd', n - 1028);
+  input[n - 2] = 'e';
+  input[n - 1] = 'a';
+  input[n] = '\0';
+
+  /* Basic behavior tests.  */
+  ASSERT (RAWMEMCHR (input, 'a') == input);
+  ASSERT (RAWMEMCHR (input, 'b') == input + 1);
+  ASSERT (RAWMEMCHR (input, 'c') == input + 2);
+  ASSERT (RAWMEMCHR (input, 'd') == input + 1026);
+
+  ASSERT (RAWMEMCHR (input + 1, 'a') == input + n - 1);
+  ASSERT (RAWMEMCHR (input + 1, 'e') == input + n - 2);
+  ASSERT (RAWMEMCHR (input + 1, 0x789abc00 | 'e') == input + n - 2);
+
+  ASSERT (RAWMEMCHR (input, '\0') == input + n);
+
+  /* Alignment tests.  */
+  {
+    int i, j;
+    for (i = 0; i < 32; i++)
+      {
+        for (j = 0; j < 256; j++)
+          input[i + j] = j;
+        for (j = 0; j < 256; j++)
+          {
+            ASSERT (RAWMEMCHR (input + i, j) == input + i + j);
+          }
+      }
+  }
+
+  /* Ensure that no unaligned oversized reads occur.  */
+  {
+    char *page_boundary = (char *) zerosize_ptr ();
+    size_t i;
+
+    if (!page_boundary)
+      page_boundary = input + 4096;
+    memset (page_boundary - 512, '1', 511);
+    page_boundary[-1] = '2';
+    for (i = 1; i <= 512; i++)
+      ASSERT (RAWMEMCHR (page_boundary - i, (i * 0x01010100) | '2')
+              == page_boundary - 1);
+  }
+
+  free (input);
+
+  /* Test aligned oversized reads, which are allowed on most architectures
+     but not on CHERI.  */
+  {
+    input = malloc (5);
+    memcpy (input, "abcde", 5);
+    ASSERT (RAWMEMCHR (input, 'e') == input + 4);
+    ASSERT (RAWMEMCHR (input + 1, 'e') == input + 4);
+    ASSERT (RAWMEMCHR (input + 2, 'e') == input + 4);
+    ASSERT (RAWMEMCHR (input + 3, 'e') == input + 4);
+    ASSERT (RAWMEMCHR (input + 4, 'e') == input + 4);
+    free (input);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 158e58df939c93267453f7f9feb58fd32db6b6f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-read-file.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dd84116efce83db834d977174b073babd35385fb
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2006-2007, 2010-2024 Free Software Foundation, Inc.
+ * Written by Simon Josefsson
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "read-file.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#include "macros.h"
+
+#define FILE1 "/etc/resolv.conf"
+#define FILE2 "/dev/null"
+
+static int
+test_read_file (int flags)
+{
+  struct stat statbuf;
+  int err = 0;
+
+  /* We can perform the test only if the file exists and is readable.
+     Test whether it exists, then assume it is world-readable.  */
+  if (stat (FILE1, &statbuf) >= 0)
+    {
+      size_t len;
+      char *out = read_file (FILE1, flags, &len);
+
+      if (!out)
+        {
+          perror ("Could not read file");
+          err = 1;
+        }
+      else
+        {
+          if (out[len] != '\0')
+            {
+              perror ("BAD: out[len] not zero");
+              err = 1;
+            }
+
+          if (S_ISREG (statbuf.st_mode))
+            {
+              /* FILE1 is a regular file or a symlink to a regular file.  */
+              if (len != statbuf.st_size)
+                {
+                  fprintf (stderr, "Read %lu from %s...\n",
+                           (unsigned long) len, FILE1);
+                  err = 1;
+                }
+            }
+          else
+            {
+              /* Assume FILE1 is not empty.  */
+              if (len == 0)
+                {
+                  fprintf (stderr, "Read nothing from %s\n", FILE1);
+                  err = 1;
+                }
+            }
+          free (out);
+        }
+    }
+
+  /* We can perform the test only if the file exists and is readable.
+     Test whether it exists, then assume it is world-readable.  */
+  if (stat (FILE2, &statbuf) >= 0)
+    {
+      size_t len;
+      char *out = read_file (FILE2, flags, &len);
+
+      if (!out)
+        {
+          perror ("Could not read file");
+          err = 1;
+        }
+      else
+        {
+          if (out[len] != '\0')
+            {
+              perror ("BAD: out[len] not zero");
+              err = 1;
+            }
+
+          /* /dev/null should always be empty.  Ignore statbuf.st_size, since it
+             is not a regular file.  */
+          if (len != 0)
+            {
+              fprintf (stderr, "Read %lu from %s...\n",
+                       (unsigned long) len, FILE2);
+              err = 1;
+            }
+          free (out);
+        }
+    }
+
+  return err;
+}
+
+int
+main (void)
+{
+  ASSERT (!test_read_file (0));
+  ASSERT (!test_read_file (RF_BINARY));
+  ASSERT (!test_read_file (RF_SENSITIVE));
+  ASSERT (!test_read_file (RF_BINARY | RF_SENSITIVE));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5bf856dfab4e52d9d12cc8f02c0068b4126ac74b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-read.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..03b803b0d6694b5d04f1ab9ef567f7da9287a021
--- /dev/null
@@ -0,0 +1,73 @@
+/* Test the read() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (read, ssize_t, (int, void *, size_t));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  const char *filename = "test-read.tmp";
+  int fd;
+
+  /* Create a file with a simple contents.  */
+  fd = open (filename, O_CREAT | O_WRONLY, 0600);
+  ASSERT (fd >= 0);
+  ASSERT (write (fd, "Hello World", 11) == 11);
+  ASSERT (close (fd) == 0);
+
+  /* Read from the middle of the file.  */
+  fd = open (filename, O_RDONLY);
+  ASSERT (fd >= 0);
+  ASSERT (lseek (fd, 6, SEEK_SET) == 6);
+  {
+    char buf[10];
+    ssize_t ret = read (fd, buf, 10);
+    ASSERT (ret == 5);
+    ASSERT (memcmp (buf, "World", 5) == 0);
+  }
+  ASSERT (close (fd) == 0);
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    char byte;
+    errno = 0;
+    ASSERT (read (-1, &byte, 1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    char byte;
+    close (99);
+    errno = 0;
+    ASSERT (read (99, &byte, 1) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Clean up.  */
+  unlink (filename);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 71e587c83ab99bbdb4fbc68663c5fcbc0f33644b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-readlink.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..911b8a132713e1f94bb4e22cfb138084019ecd13
--- /dev/null
@@ -0,0 +1,47 @@
+/* Tests of readlink.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (readlink, ssize_t, (char const *, char *, size_t));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-readlink.t"
+
+#include "test-readlink.h"
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_readlink (readlink, true);
+}
deleted file mode 120000 (symlink)
index 56dfe3b2d48e9901eb993785b53f69a8ca1e71d1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-readlink.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3a21b60b1560cfcfa263ae340ad26da8316ffe4f
--- /dev/null
@@ -0,0 +1,119 @@
+/* Tests of readlink.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+/* This file is designed to test both readlink(a,b,c) and
+   readlinkat(AT_FDCWD,a,b,c).  FUNC is the function to test.  Assumes
+   that BASE and ASSERT are already defined, and that appropriate
+   headers are already included.  If PRINT, warn before skipping
+   symlink tests with status 77.  */
+
+static int
+test_readlink (ssize_t (*func) (char const *, char *, size_t), bool print)
+{
+  char buf[80];
+
+  /* Sanity checks of failures.  Mingw lacks symlink, but readlink can
+     still distinguish between various errors.  */
+  memset (buf, 0xff, sizeof buf);
+  errno = 0;
+  ASSERT (func ("no_such", buf, sizeof buf) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("no_such/", buf, sizeof buf) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("", buf, sizeof buf) == -1);
+  ASSERT (errno == ENOENT || errno == EINVAL);
+  errno = 0;
+  ASSERT (func (".", buf, sizeof buf) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (func ("./", buf, sizeof buf) == -1);
+  ASSERT (errno == EINVAL);
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  errno = 0;
+  ASSERT (func (BASE "file", buf, sizeof buf) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (func (BASE "file/", buf, sizeof buf) == -1);
+  ASSERT (errno == ENOTDIR || errno == EINVAL); /* AIX yields EINVAL */
+
+  /* Now test actual symlinks.  */
+  if (symlink (BASE "dir", BASE "link"))
+    {
+      ASSERT (unlink (BASE "file") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  errno = 0;
+  ASSERT (func (BASE "link/", buf, sizeof buf) == -1);
+  ASSERT (errno == EINVAL);
+  ASSERT (symlink (BASE "link", BASE "link2") == 0);
+  errno = 0;
+  ASSERT (func (BASE "link2/", buf, sizeof buf) == -1);
+  ASSERT (errno == EINVAL);
+  ASSERT (unlink (BASE "link2") == 0);
+  ASSERT (symlink (BASE "file", BASE "link2") == 0);
+  errno = 0;
+  ASSERT (func (BASE "link2/", buf, sizeof buf) == -1);
+  ASSERT (errno == ENOTDIR || errno == EINVAL); /* AIX yields EINVAL */
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (unlink (BASE "link2") == 0);
+  {
+    /* Up till now, no readlink has been successful, so buf should be
+       unchanged.  */
+    int i;
+    for (i = 0; i < sizeof buf; i++)
+      ASSERT (buf[i] == (char) 0xff);
+  }
+  {
+    size_t len = strlen (BASE "dir");
+    /* When passing too small of a buffer, expect the truncated
+       length, or an ERANGE failure.  However, a size of 0 is not
+       portable enough to test.  */
+    ssize_t result;
+    errno = 0;
+    result = readlink (BASE "link", buf, 1);
+    if (result == -1)
+      {
+        ASSERT (errno == ERANGE);
+        ASSERT (buf[0] == (char) 0xff);
+      }
+    else
+      {
+        ASSERT (result == 1);
+        ASSERT (buf[0] == BASE[0]);
+      }
+    ASSERT (buf[1] == (char) 0xff);
+    ASSERT (func (BASE "link", buf, len) == len);
+    ASSERT (strncmp (buf, BASE "dir", len) == 0);
+    ASSERT (buf[len] == (char) 0xff);
+    ASSERT (func (BASE "link", buf, sizeof buf) == len);
+    ASSERT (strncmp (buf, BASE "dir", len) == 0);
+    /* POSIX says rest of buf is unspecified; but in practice, it is
+       either left alone, or NUL-terminated.  */
+    ASSERT (buf[len] == '\0' || buf[len] == (char) 0xff);
+  }
+  ASSERT (rmdir (BASE "dir") == 0);
+  ASSERT (unlink (BASE "link") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 29807d97c4788ddda8dcf992af8416f32eba493f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-readlinkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c36094f2ed569a387377085cfa9c706bcad6a4a0
--- /dev/null
@@ -0,0 +1,120 @@
+/* Tests of readlinkat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (readlinkat, ssize_t, (int, char const *, char *, size_t));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#ifndef HAVE_SYMLINK
+# define HAVE_SYMLINK 0
+#endif
+
+#define BASE "test-readlinkat.t"
+
+#include "test-readlink.h"
+
+static int dfd = AT_FDCWD;
+
+static ssize_t
+do_readlink (char const *name, char *buf, size_t len)
+{
+  return readlinkat (dfd, name, buf, len);
+}
+
+int
+main (void)
+{
+  char buf[80];
+  int result;
+
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (readlinkat (-1, "foo", buf, sizeof buf) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (readlinkat (99, "foo", buf, sizeof buf) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Perform same checks as counterpart functions.  */
+  result = test_readlink (do_readlink, false);
+  dfd = openat (AT_FDCWD, ".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_readlink (do_readlink, false) == result);
+
+  /* Now perform some cross-directory checks.  Skip everything else on
+     mingw.  */
+  if (HAVE_SYMLINK)
+    {
+      const char *contents = "don't matter!";
+      ssize_t exp = strlen (contents);
+
+      /* Create link while cwd is '.', then read it in '..'.  */
+      ASSERT (symlinkat (contents, AT_FDCWD, BASE "link") == 0);
+      errno = 0;
+      ASSERT (symlinkat (contents, dfd, BASE "link") == -1);
+      ASSERT (errno == EEXIST);
+      ASSERT (chdir ("..") == 0);
+      errno = 0;
+      ASSERT (readlinkat (AT_FDCWD, BASE "link", buf, sizeof buf) == -1);
+      ASSERT (errno == ENOENT);
+      ASSERT (readlinkat (dfd, BASE "link", buf, sizeof buf) == exp);
+      ASSERT (strncmp (contents, buf, exp) == 0);
+      ASSERT (unlinkat (dfd, BASE "link", 0) == 0);
+
+      /* Create link while cwd is '..', then read it in '.'.  */
+      ASSERT (symlinkat (contents, dfd, BASE "link") == 0);
+      ASSERT (fchdir (dfd) == 0);
+      errno = 0;
+      ASSERT (symlinkat (contents, AT_FDCWD, BASE "link") == -1);
+      ASSERT (errno == EEXIST);
+      buf[0] = '\0';
+      ASSERT (readlinkat (AT_FDCWD, BASE "link", buf, sizeof buf) == exp);
+      ASSERT (strncmp (contents, buf, exp) == 0);
+      buf[0] = '\0';
+      ASSERT (readlinkat (dfd, BASE "link", buf, sizeof buf) == exp);
+      ASSERT (strncmp (contents, buf, exp) == 0);
+      ASSERT (unlink (BASE "link") == 0);
+    }
+
+  ASSERT (close (dfd) == 0);
+  if (result == 77)
+    fputs ("skipping test: symlinks not supported on this file system\n",
+           stderr);
+  return result;
+}
deleted file mode 120000 (symlink)
index bf5646ca4a65177e6b62451f30cd747b252b90e2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-readtokens.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ad3cf77a66bdbf1669883f98564556478b4af568
--- /dev/null
@@ -0,0 +1,97 @@
+/* Test the readtokens module.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "readtokens.h"
+#include "closeout.h"
+#include "macros.h"
+
+static void
+basic (void)
+{
+  char const *filename = "in.827";
+  int fd = open (filename, O_CREAT | O_WRONLY, 0600);
+  ASSERT (fd >= 0);
+  ASSERT (write (fd, "a|b;c+d", 7) == 7);
+  ASSERT (close (fd) == 0);
+
+  {
+    token_buffer tb;
+    FILE *fp = fopen (filename, "r");
+    ASSERT (fp);
+
+    init_tokenbuffer (&tb);
+    ASSERT (readtoken (fp, "|;", 2, &tb)  == 1 && tb.buffer[0] == 'a');
+    ASSERT (readtoken (fp, "|;", 2, &tb) == 1 && tb.buffer[0] == 'b');
+    ASSERT (readtoken (fp, "+", 1, &tb)  == 1 && tb.buffer[0] == 'c');
+    ASSERT (readtoken (fp, "-", 1, &tb) == 1 && tb.buffer[0] == 'd');
+    ASSERT (readtoken (fp, "%", 0, &tb) == (size_t) -1);
+    ASSERT ( ! ferror (fp));
+    ASSERT (fclose (fp) == 0);
+  }
+}
+
+int
+main (int argc, char **argv)
+{
+  token_buffer tb;
+  char const *delim;
+  size_t delim_len;
+
+  atexit (close_stdout);
+
+  if (argc == 1)
+    {
+      basic ();
+      return 0;
+    }
+
+  init_tokenbuffer (&tb);
+
+  if (argc != 2)
+    return 99;
+
+  delim = argv[1];
+  delim_len = strlen (delim);
+
+  if (STREQ (delim, "\\0"))
+    {
+      delim = "";
+      delim_len = 1;
+    }
+
+  while (1)
+    {
+      size_t token_length = readtoken (stdin, delim, delim_len, &tb);
+      if (token_length == (size_t) -1)
+        break;
+      fwrite (tb.buffer, 1, token_length, stdout);
+      putchar (':');
+    }
+  putchar ('\n');
+  free (tb.buffer);
+
+  ASSERT ( ! ferror (stdin));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 94c84b397750e537133cd6bc9fc8d86720505946..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-readtokens.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..d0af2590a67f7c8a097590d96e5c3795d4e0ae04
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+fail=0
+
+${CHECKER} test-readtokens || fail=1
+
+# Simplest case.
+echo a:b:c: > exp || fail=1
+printf a:b:c | ${CHECKER} test-readtokens : > tmp 2>&1 || fail=1
+LC_ALL=C tr -d '\r' < tmp > out || fail=1
+compare exp out || fail=1
+
+# Use NUL as the delimiter.
+echo a:b:c: > exp || fail=1
+printf 'a\0b\0c' | ${CHECKER} test-readtokens '\0' > tmp 2>&1 || fail=1
+LC_ALL=C tr -d '\r' < tmp > out || fail=1
+compare exp out || fail=1
+
+# Two delimiter bytes, and adjacent delimiters in the input.
+echo a:b:c: > exp || fail=1
+printf a:-:b-:c:: | ${CHECKER} test-readtokens :- > tmp 2>&1 || fail=1
+LC_ALL=C tr -d '\r' < tmp > out || fail=1
+compare exp out || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index 416a34298ce4f3f978f265fd19229fb401597f63..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-readutmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..510d16774d6832618cb8a8d9ec1db120e533b7d5
--- /dev/null
@@ -0,0 +1,160 @@
+/* Test of readutmp module.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include "readutmp.h"
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "idx.h"
+#include "xalloc.h"
+
+#define ELEMENT STRUCT_UTMP
+#define COMPARE(entry1, entry2) \
+  _GL_CMP (UT_TIME_MEMBER (entry1), UT_TIME_MEMBER (entry2))
+#define STATIC static
+#include "array-mergesort.h"
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  STRUCT_UTMP *entries;
+  idx_t num_entries;
+
+  if (read_utmp (UTMP_FILE, &num_entries, &entries, 0) < 0)
+    {
+      #if READ_UTMP_SUPPORTED
+      fprintf (stderr, "Skipping test: cannot open %s\n", UTMP_FILE);
+      #else
+      fprintf (stderr, "Skipping test: neither <utmpx.h> nor <utmp.h> is available\n");
+      #endif
+      return 77;
+    }
+
+  printf ("Here are the read_utmp results.\n");
+  printf ("Flags: B = Boot, U = User Process\n");
+  printf ("\n");
+  printf ("                                                              Termi‐      Flags\n");
+  printf ("    Time (GMT)             User          Device        PID    nation Exit  B U  Host\n");
+  printf ("------------------- ------------------ ----------- ---------- ------ ----  - -  ----\n");
+
+  /* What do the results look like?
+     * On Alpine Linux, Cygwin, Android, the output is empty.
+     * The entries are usually not sorted according to the Time column, so
+       we do it here.
+     * In the User column, special values exist:
+       - The empty string denotes a system event.
+         Seen on glibc, macOS, FreeBSD, NetBSD, OpenBSD, AIX
+       - The value "reboot" denotes a reboot.
+         Seen on glibc
+       - The value "runlevel" denotes a runlevel change.
+         Seen on glibc
+       - The value "LOGIN" denotes the start of a virtual console.
+         Seen on glibc, Solaris
+       - The value "/usr/libexec/getty" denotes the start of a virtual console.
+         Seen on NetBSD
+     * In the Device column:
+       - The empty string denotes a system event.
+         Seen on macOS, FreeBSD, AIX
+       - The value "~" denotes an event with no associated device.
+         Seen on glibc
+       - The values "system boot", "system down", "run-level N" are
+         seen on NetBSD, AIX, Solaris.
+       - The values "old time", "new time" are
+         seen on Solaris.
+       - Common devices are:
+         - On glibc: "ttyN" (console) and "pts/N" (pseudo-terminals).
+         - On macOS: "ttysNNN" (pseudo-terminals).
+         - On FreeBSD: "ttyvN" (console).
+         - On NetBSD: "ttyEN", "constty" (console).
+         - On OpenBSD: "ttyCN", "console" (console) and "ttypN" (pseudo-terminals).
+         - on AIX: "vtyN" (console) and "pts/N" (pseudo-terminals).
+         - On Solaris: "vt/N", "console" (console) and "pts/N" (pseudo-terminals).
+     * The PID column is zero on platforms without a 'ut_pid' field: OpenBSD.
+   */
+  if (num_entries > 0)
+    {
+      /* Sort the entries according to increasing UT_TIME_MEMBER (entry).
+         Use a stable sort algorithm.  */
+      merge_sort_inplace (entries, num_entries,
+                          XNMALLOC (num_entries, STRUCT_UTMP));
+
+      idx_t boot_time_count = 0;
+      idx_t i;
+      for (i = 0; i < num_entries; i++)
+        {
+          const STRUCT_UTMP *entry = &entries[i];
+
+          char *user = extract_trimmed_name (entry);
+          const char *device = entry->ut_line;
+          long pid = UT_PID (entry);
+          int termination = UT_EXIT_E_TERMINATION (entry);
+          int exit = UT_EXIT_E_EXIT (entry);
+          const char *host = entry->ut_host;
+
+          time_t tim = UT_TIME_MEMBER (entry);
+          struct tm *gmt = gmtime (&tim);
+          char timbuf[100];
+          if (gmt == NULL
+              || strftime (timbuf, sizeof (timbuf), "%Y-%m-%d %H:%M:%S", gmt)
+                 == 0)
+            strcpy (timbuf, "---");
+
+          printf ("%-19s %-18s %-11s %10ld %4d   %3d   %c %c  %s\n",
+                  timbuf,
+                  user,
+                  device,
+                  pid,
+                  termination,
+                  exit,
+                  UT_TYPE_BOOT_TIME (entry) ? 'X' : ' ',
+                  UT_TYPE_USER_PROCESS (entry) ? 'X' : ' ',
+                  host);
+
+          if (UT_TYPE_BOOT_TIME (entry))
+            boot_time_count++;
+        }
+      fflush (stdout);
+
+      /* If the first time is more than 5 years in the past or the last time
+         is more than a week in the future, the time_t members are wrong.  */
+      time_t first = UT_TIME_MEMBER (&entries[0]);
+      time_t last = UT_TIME_MEMBER (&entries[num_entries - 1]);
+      time_t now = time (NULL);
+      ASSERT (first >= now - 157680000);
+      ASSERT (last <= now + 604800);
+
+      /* read_utmp should not produce multiple BOOT_TIME entries.  */
+      ASSERT (boot_time_count <= 1);
+
+      /* read_utmp should fake a BOOT_TIME entry if needed.
+         Platform specific hacks go into lib/boot-time-aux.h.  */
+      ASSERT (boot_time_count >= 1);
+    }
+
+  free (entries);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b1e2610944ff11d27eff4fbf7d3459b5b35807d2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-realloc-gnu.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..54832ee8feca9ff9531e0b780cfd82133278dd23
--- /dev/null
@@ -0,0 +1,49 @@
+/* Test of realloc function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+#include "macros.h"
+
+int
+main (int argc, _GL_UNUSED char **argv)
+{
+  /* Check that realloc (NULL, 0) is not a NULL pointer.  */
+  void *volatile p = realloc (NULL, 0);
+  ASSERT (p != NULL);
+
+  /* Check that realloc (p, n) fails when p is non-null and n exceeds
+     PTRDIFF_MAX.  */
+  if (PTRDIFF_MAX < SIZE_MAX)
+    {
+      size_t one = argc != 12345;
+      p = realloc (p, PTRDIFF_MAX + one);
+      ASSERT (p == NULL);
+      /* Avoid a test failure due to glibc bug
+         <https://sourceware.org/bugzilla/show_bug.cgi?id=27870>.  */
+      if (!getenv ("MALLOC_CHECK_"))
+        ASSERT (errno == ENOMEM);
+    }
+
+  free (p);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 92d4f7c0d52b86eeb6f28fc249cba6d8d980bbfc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-reallocarray.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fb9171ce8a72d3f4af2db7c28194495459a1eb4a
--- /dev/null
@@ -0,0 +1,58 @@
+/* Test of reallocarray function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (reallocarray, void *, (void *, size_t, size_t));
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Check that reallocarray fails when requested to allocate a block
+     of memory larger than PTRDIFF_MAX or SIZE_MAX bytes.  */
+  for (size_t n = 2; n != 0; n <<= 1)
+    {
+      void *volatile p = NULL;
+
+      if (PTRDIFF_MAX / n + 1 <= SIZE_MAX)
+        {
+          p = reallocarray (p, PTRDIFF_MAX / n + 1, n);
+          ASSERT (p == NULL);
+          ASSERT (errno == ENOMEM);
+        }
+
+      p = reallocarray (p, SIZE_MAX / n + 1, n);
+      ASSERT (p == NULL);
+      ASSERT (errno == ENOMEM
+              || errno == EOVERFLOW /* NetBSD */);
+
+      /* Reallocarray should not crash with zero sizes.  */
+      p = reallocarray (p, 0, n);
+      p = reallocarray (p, n, 0);
+      free (p);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index eb724ddfc471abf801ca1d519a72ae7cd1b0f329..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-regex.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..175cdf4fe63422fcb1c7de214185caf1b0b4bd24
--- /dev/null
@@ -0,0 +1,488 @@
+/* Test regular expressions
+   Copyright 1996-2001, 2003-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "regex.h"
+
+#include <locale.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wctype.h>
+#if HAVE_DECL_ALARM
+# include <unistd.h>
+# include <signal.h>
+#endif
+
+#include "localcharset.h"
+
+static int exit_status;
+
+static void
+report_error (char const *format, ...)
+{
+  va_list args;
+  va_start (args, format);
+  fprintf (stderr, "test-regex: ");
+  vfprintf (stderr, format, args);
+  fprintf (stderr, "\n");
+  va_end (args);
+  exit_status = 1;
+}
+
+/* Check whether it's really a UTF-8 locale.
+   On mingw, setlocale (LC_ALL, "en_US.UTF-8") succeeds but returns
+   "English_United States.1252", with locale_charset () returning "CP1252".  */
+static int
+really_utf8 (void)
+{
+  return strcmp (locale_charset (), "UTF-8") == 0;
+}
+
+/* Tests supposed to match; copied from glibc posix/bug-regex11.c.  */
+static struct
+{
+  const char *pattern;
+  const char *string;
+  int flags, nmatch;
+  regmatch_t rm[5];
+} const tests[] = {
+  /* Test for newline handling in regex.  */
+  { "[^~]*~", "\nx~y", 0, 2, { { 0, 3 }, { -1, -1 } } },
+  /* Other tests.  */
+  { "a(.*)b", "a b", REG_EXTENDED, 2, { { 0, 3 }, { 1, 2 } } },
+  { ".*|\\([KIO]\\)\\([^|]*\\).*|?[KIO]", "10~.~|P|K0|I10|O16|?KSb", 0, 3,
+    { { 0, 21 }, { 15, 16 }, { 16, 18 } } },
+  { ".*|\\([KIO]\\)\\([^|]*\\).*|?\\1", "10~.~|P|K0|I10|O16|?KSb", 0, 3,
+    { { 0, 21 }, { 8, 9 }, { 9, 10 } } },
+  { "^\\(a*\\)\\1\\{9\\}\\(a\\{0,9\\}\\)\\([0-9]*;.*[^a]\\2\\([0-9]\\)\\)",
+    "a1;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9aa2aa1a0", 0,
+    5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } },
+  /* Test for BRE expression anchoring.  POSIX says just that this may match;
+     in glibc regex it always matched, so avoid changing it.  */
+  { "\\(^\\|foo\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } },
+  { "\\(foo\\|^\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } },
+  /* In ERE this must be treated as an anchor.  */
+  { "(^|foo)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } },
+  { "(foo|^)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } },
+  /* Here ^ cannot be treated as an anchor according to POSIX.  */
+  { "(^|foo)bar", "(^|foo)bar", 0, 2, { { 0, 10 }, { -1, -1 } } },
+  { "(foo|^)bar", "(foo|^)bar", 0, 2, { { 0, 10 }, { -1, -1 } } },
+  /* More tests on backreferences.  */
+  { "()\\1", "x", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } },
+  { "()x\\1", "x", REG_EXTENDED, 2, { { 0, 1 }, { 0, 0 } } },
+  { "()\\1*\\1*", "", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } },
+  { "([0-9]).*\\1(a*)", "7;7a6", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } },
+  { "([0-9]).*\\1(a*)", "7;7a", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } },
+  { "(b)()c\\1", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 1 }, { 1, 1 } } },
+  { "()(b)c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 0, 1 } } },
+  { "a(b)()c\\1", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 2 }, { 2, 2 } } },
+  { "a()(b)c\\2", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 1 }, { 1, 2 } } },
+  { "()(b)\\1c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 0, 1 } } },
+  { "(b())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 2 }, { 0, 1 }, { 1, 1 } } },
+  { "a()(b)\\1c\\2", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 1 }, { 1, 2 } } },
+  { "a()d(b)\\1c\\2", "adbcb", REG_EXTENDED, 3, { { 0, 5 }, { 1, 1 }, { 2, 3 } } },
+  { "a(b())\\2\\1", "abbbb", REG_EXTENDED, 3, { { 0, 3 }, { 1, 2 }, { 2, 2 } } },
+  { "(bb())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 4 }, { 0, 2 }, { 2, 2 } } },
+  { "^([^,]*),\\1,\\1$", "a,a,a", REG_EXTENDED, 2, { { 0, 5 }, { 0, 1 } } },
+  { "^([^,]*),\\1,\\1$", "ab,ab,ab", REG_EXTENDED, 2, { { 0, 8 }, { 0, 2 } } },
+  { "^([^,]*),\\1,\\1,\\1$", "abc,abc,abc,abc", REG_EXTENDED, 2,
+    { { 0, 15 }, { 0, 3 } } },
+  { "^(.?)(.?)(.?)(.?)(.?).?\\5\\4\\3\\2\\1$",
+    "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } },
+  { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$|^.?$",
+    "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } },
+  { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$|^.?$",
+    "abcdedcba", REG_EXTENDED, 1, { { 0, 9 } } },
+  { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$|^.?$",
+    "ababababa", REG_EXTENDED, 1, { { 0, 9 } } },
+  { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$",
+    "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } },
+  { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$",
+    "ababababa", REG_EXTENDED, 1, { { 0, 9 } } },
+  /* Test for *+ match.  */
+  { "^a*+(.)", "ab", REG_EXTENDED, 2, { { 0, 2 }, { 1, 2 } } },
+  /* Test for ** match.  */
+  { "^(a*)*(.)", "ab", REG_EXTENDED, 3, { { 0, 2 }, { 0, 1 }, { 1, 2 } } },
+};
+
+static void
+bug_regex11 (void)
+{
+  regex_t re;
+  regmatch_t rm[5];
+  size_t i;
+  int n;
+
+  for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
+    {
+      n = regcomp (&re, tests[i].pattern, tests[i].flags);
+      if (n != 0)
+        {
+          char buf[500];
+          regerror (n, &re, buf, sizeof (buf));
+          report_error ("%s: regcomp %zd failed: %s", tests[i].pattern, i, buf);
+          continue;
+        }
+
+      if (regexec (&re, tests[i].string, tests[i].nmatch, rm, 0))
+        {
+          report_error ("%s: regexec %zd failed", tests[i].pattern, i);
+          regfree (&re);
+          continue;
+        }
+
+      for (n = 0; n < tests[i].nmatch; ++n)
+        if (rm[n].rm_so != tests[i].rm[n].rm_so
+              || rm[n].rm_eo != tests[i].rm[n].rm_eo)
+          {
+            if (tests[i].rm[n].rm_so == -1 && tests[i].rm[n].rm_eo == -1)
+              break;
+            report_error ("%s: regexec %zd match failure rm[%d] %d..%d",
+                          tests[i].pattern, i, n,
+                          (int) rm[n].rm_so, (int) rm[n].rm_eo);
+            break;
+          }
+
+      regfree (&re);
+    }
+}
+
+int
+main (void)
+{
+  static struct re_pattern_buffer regex;
+  unsigned char folded_chars[UCHAR_MAX + 1];
+  int i;
+  const char *s;
+  struct re_registers regs;
+
+#if HAVE_DECL_ALARM
+  /* In case a bug causes glibc to go into an infinite loop.
+     The tests should take less than 10 s on a reasonably modern CPU.  */
+  int alarm_value = 1000;
+  signal (SIGALRM, SIG_DFL);
+  alarm (alarm_value);
+#endif
+
+  bug_regex11 ();
+
+  if (setlocale (LC_ALL, "en_US.UTF-8"))
+    {
+      {
+        /* https://sourceware.org/ml/libc-hacker/2006-09/msg00008.html
+           This test needs valgrind to catch the bug on Debian
+           GNU/Linux 3.1 x86, but it might catch the bug better
+           on other platforms and it shouldn't hurt to try the
+           test here.  */
+        static char const pat[] = "insert into";
+        static char const data[] =
+          "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
+        re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
+                       | RE_ICASE);
+        memset (&regex, 0, sizeof regex);
+        s = re_compile_pattern (pat, sizeof pat - 1, &regex);
+        if (s)
+          report_error ("%s: %s", pat, s);
+        else
+          {
+            memset (&regs, 0, sizeof regs);
+            i = re_search (&regex, data, sizeof data - 1,
+                           0, sizeof data - 1, &regs);
+            if (i != -1)
+              report_error ("re_search '%s' on '%s' returned %d",
+                            pat, data, i);
+            regfree (&regex);
+            free (regs.start);
+            free (regs.end);
+          }
+      }
+
+      if (really_utf8 ())
+        {
+          /* This test is from glibc bug 15078.
+             The test case is from Andreas Schwab in
+             <https://sourceware.org/ml/libc-alpha/2013-01/msg00967.html>.
+          */
+          static char const pat[] = "[^x]x";
+          static char const data[] =
+            /* <U1000><U103B><U103D><U1014><U103A><U102F><U1015><U103A> */
+            "\xe1\x80\x80"
+            "\xe1\x80\xbb"
+            "\xe1\x80\xbd"
+            "\xe1\x80\x94"
+            "\xe1\x80\xba"
+            "\xe1\x80\xaf"
+            "\xe1\x80\x95"
+            "\xe1\x80\xba"
+            "x";
+          re_set_syntax (0);
+          memset (&regex, 0, sizeof regex);
+          s = re_compile_pattern (pat, sizeof pat - 1, &regex);
+          if (s)
+            report_error ("%s: %s", pat, s);
+          else
+            {
+              memset (&regs, 0, sizeof regs);
+              i = re_search (&regex, data, sizeof data - 1,
+                             0, sizeof data - 1, 0);
+              if (i != 0 && i != 21)
+                report_error ("re_search '%s' on '%s' returned %d",
+                              pat, data, i);
+              regfree (&regex);
+              free (regs.start);
+              free (regs.end);
+            }
+        }
+
+      if (! setlocale (LC_ALL, "C"))
+        {
+          report_error ("setlocale \"C\" failed");
+          return exit_status;
+        }
+    }
+
+  if (setlocale (LC_ALL, "tr_TR.UTF-8"))
+    {
+      if (really_utf8 () && towupper (L'i') == 0x0130 /* U+0130; see below.  */)
+        {
+          re_set_syntax (RE_SYNTAX_GREP | RE_ICASE);
+          memset (&regex, 0, sizeof regex);
+          static char const pat[] = "i";
+          s = re_compile_pattern (pat, sizeof pat - 1, &regex);
+          if (s)
+            report_error ("%s: %s", pat, s);
+          else
+            {
+              /* UTF-8 encoding of U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE.
+                 In Turkish, this is the upper-case equivalent of ASCII "i".
+                 Older versions of Gnulib failed to match "i" to U+0130 when
+                 ignoring case in Turkish <https://bugs.gnu.org/43577>.  */
+              static char const data[] = "\xc4\xb0";
+
+              memset (&regs, 0, sizeof regs);
+              i = re_search (&regex, data, sizeof data - 1, 0, sizeof data - 1,
+                             &regs);
+              if (i != 0)
+                report_error ("re_search '%s' on '%s' returned %d",
+                              pat, data, i);
+              regfree (&regex);
+              free (regs.start);
+              free (regs.end);
+            }
+        }
+
+      if (! setlocale (LC_ALL, "C"))
+        {
+          report_error ("setlocale \"C\" failed");
+          return exit_status;
+        }
+    }
+
+  /* This test is from glibc bug 3957, reported by Andrew Mackey.  */
+  re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE);
+  memset (&regex, 0, sizeof regex);
+  static char const pat_3957[] = "a[^x]b";
+  s = re_compile_pattern (pat_3957, sizeof pat_3957 - 1, &regex);
+  if (s)
+    report_error ("%s: %s", pat_3957, s);
+  else
+    {
+      /* This should fail, but succeeds for glibc-2.5.  */
+      memset (&regs, 0, sizeof regs);
+      static char const data[] = "a\nb";
+      i = re_search (&regex, data, sizeof data - 1, 0, sizeof data - 1, &regs);
+      if (i != -1)
+        report_error ("re_search '%s' on '%s' returned %d",
+                      pat_3957, data, i);
+      regfree (&regex);
+      free (regs.start);
+      free (regs.end);
+    }
+
+  /* This regular expression is from Spencer ere test number 75
+     in grep-2.3.  */
+  re_set_syntax (RE_SYNTAX_POSIX_EGREP);
+  memset (&regex, 0, sizeof regex);
+  for (i = 0; i <= UCHAR_MAX; i++)
+    folded_chars[i] = i;
+  regex.translate = folded_chars;
+  static char const pat75[] = "a[[:@:>@:]]b\n";
+  s = re_compile_pattern (pat75, sizeof pat75 - 1, &regex);
+  /* This should fail with _Invalid character class name_ error.  */
+  if (!s)
+    {
+      report_error ("re_compile_pattern: failed to reject '%s'", pat75);
+      regfree (&regex);
+    }
+
+  /* Ensure that [b-a] is diagnosed as invalid, when
+     using RE_NO_EMPTY_RANGES. */
+  re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES);
+  memset (&regex, 0, sizeof regex);
+  static char const pat_b_a[] = "a[b-a]";
+  s = re_compile_pattern (pat_b_a, sizeof pat_b_a - 1, &regex);
+  if (s == 0)
+    {
+      report_error ("re_compile_pattern: failed to reject '%s'", pat_b_a);
+      regfree (&regex);
+    }
+
+  /* This should succeed, but does not for glibc-2.1.3.  */
+  memset (&regex, 0, sizeof regex);
+  static char const pat_213[] = "{1";
+  s = re_compile_pattern (pat_213, sizeof pat_213 - 1, &regex);
+  if (s)
+    report_error ("%s: %s", pat_213, s);
+  else
+    regfree (&regex);
+
+  /* The following example is derived from a problem report
+     against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>.  */
+  memset (&regex, 0, sizeof regex);
+  static char const pat_stolfi[] = "[an\371]*n";
+  s = re_compile_pattern (pat_stolfi, sizeof pat_stolfi - 1, &regex);
+  if (s)
+    report_error ("%s: %s", pat_stolfi, s);
+  /* This should match, but does not for glibc-2.2.1.  */
+  else
+    {
+      memset (&regs, 0, sizeof regs);
+      static char const data[] = "an";
+      i = re_match (&regex, data, sizeof data - 1, 0, &regs);
+      if (i != 2)
+        report_error ("re_match '%s' on '%s' at 2 returned %d",
+                      pat_stolfi, data, i);
+      regfree (&regex);
+      free (regs.start);
+      free (regs.end);
+    }
+
+  memset (&regex, 0, sizeof regex);
+  static char const pat_x[] = "x";
+  s = re_compile_pattern (pat_x, sizeof pat_x - 1, &regex);
+  if (s)
+    report_error ("%s: %s", pat_x, s);
+  /* glibc-2.2.93 does not work with a negative RANGE argument.  */
+  else
+    {
+      memset (&regs, 0, sizeof regs);
+      static char const data[] = "wxy";
+      i = re_search (&regex, data, sizeof data - 1, 2, -2, &regs);
+      if (i != 1)
+        report_error ("re_search '%s' on '%s' returned %d", pat_x, data, i);
+      regfree (&regex);
+      free (regs.start);
+      free (regs.end);
+    }
+
+  /* The version of regex.c in older versions of gnulib
+     ignored RE_ICASE.  Detect that problem too.  */
+  re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE);
+  memset (&regex, 0, sizeof regex);
+  s = re_compile_pattern (pat_x, 1, &regex);
+  if (s)
+    report_error ("%s: %s", pat_x, s);
+  else
+    {
+      memset (&regs, 0, sizeof regs);
+      static char const data[] = "WXY";
+      i = re_search (&regex, data, sizeof data - 1, 0, 3, &regs);
+      if (i < 0)
+        report_error ("re_search '%s' on '%s' returned %d", pat_x, data, i);
+      regfree (&regex);
+      free (regs.start);
+      free (regs.end);
+    }
+
+  /* glibc bug 11053.  */
+  re_set_syntax (RE_SYNTAX_POSIX_BASIC);
+  memset (&regex, 0, sizeof regex);
+  static char const pat_sub2[] = "\\(a*\\)*a*\\1";
+  s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, &regex);
+  if (s)
+    report_error ("%s: %s", pat_sub2, s);
+  else
+    {
+      memset (&regs, 0, sizeof regs);
+      static char const data[] = "a";
+      int datalen = sizeof data - 1;
+      i = re_search (&regex, data, datalen, 0, datalen, &regs);
+      if (i != 0)
+        report_error ("re_search '%s' on '%s' returned %d", pat_sub2, data, i);
+      else if (regs.num_regs < 2)
+        report_error ("re_search '%s' on '%s' returned only %d registers",
+                      pat_sub2, data, (int) regs.num_regs);
+      else if (! (regs.start[0] == 0 && regs.end[0] == 1))
+        report_error ("re_search '%s' on '%s' returned wrong match [%d,%d)",
+                      pat_sub2, data, (int) regs.start[0], (int) regs.end[0]);
+      else if (! (regs.start[1] == 0 && regs.end[1] == 0))
+        report_error ("re_search '%s' on '%s' returned wrong submatch [%d,%d)",
+                      pat_sub2, data, (int) regs.start[1], (int) regs.end[1]);
+      regfree (&regex);
+      free (regs.start);
+      free (regs.end);
+    }
+
+  /* Catch a bug reported by Vin Shelton in
+     https://lists.gnu.org/r/bug-coreutils/2007-06/msg00089.html
+     */
+  re_set_syntax (RE_SYNTAX_POSIX_BASIC
+                 & ~RE_CONTEXT_INVALID_DUP
+                 & ~RE_NO_EMPTY_RANGES);
+  static char const pat_shelton[] = "[[:alnum:]_-]\\\\+$";
+  s = re_compile_pattern (pat_shelton, sizeof pat_shelton - 1, &regex);
+  if (s)
+    report_error ("%s: %s", pat_shelton, s);
+  else
+    regfree (&regex);
+
+  /* REG_STARTEND was added to glibc on 2004-01-15.
+     Reject older versions.  */
+  if (REG_STARTEND == 0)
+    report_error ("REG_STARTEND is zero");
+
+  /* Matching with the compiled form of this regexp would provoke
+     an assertion failure prior to glibc-2.28:
+       regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed
+     With glibc-2.28, compilation fails and reports the invalid
+     back reference.  */
+  re_set_syntax (RE_SYNTAX_POSIX_EGREP);
+  memset (&regex, 0, sizeof regex);
+  static char const pat_badback[] = "0|()0|\\1|0";
+  s = re_compile_pattern (pat_badback, sizeof pat_badback, &regex);
+  if (!s && re_search (&regex, "x", 1, 0, 1, &regs) != -1)
+    s = "mishandled invalid back reference";
+  if (s && strcmp (s, "Invalid back reference") != 0)
+    report_error ("%s: %s", pat_badback, s);
+
+#if 0
+  /* It would be nice to reject hosts whose regoff_t values are too
+     narrow (including glibc on hosts with 64-bit ptrdiff_t and
+     32-bit int), but we should wait until glibc implements this
+     feature.  Otherwise, support for equivalence classes and
+     multibyte collation symbols would always be broken except
+     when compiling --without-included-regex.   */
+  if (sizeof (regoff_t) < sizeof (ptrdiff_t)
+      || sizeof (regoff_t) < sizeof (ssize_t))
+    report_error ("regoff_t values are too narrow");
+#endif
+
+  return exit_status;
+}
deleted file mode 120000 (symlink)
index 4a3d806570d7253dc46a42fca8e9a1aed0f6851d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-remove.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0674dce8a004c0f35a53dedf1e413e04ec602dd1
--- /dev/null
@@ -0,0 +1,125 @@
+/* Tests of remove.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (remove, int, (char const *));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-remove.t"
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Setup.  */
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  ASSERT (close (creat (BASE "dir/file", 0600)) == 0);
+
+  /* Basic error conditions.  */
+  errno = 0;
+  ASSERT (remove ("") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (remove ("nosuch") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (remove ("nosuch/") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (remove (".") == -1);
+  ASSERT (errno == EINVAL || errno == EBUSY);
+  /* Resulting errno after ".." or "/" is too varied to test; it is
+     reasonable to see any of EINVAL, EEXIST, ENOTEMPTY, EACCES.  */
+  ASSERT (remove ("..") == -1);
+  ASSERT (remove ("/") == -1);
+  ASSERT (remove ("///") == -1);
+  errno = 0;
+  ASSERT (remove (BASE "dir/file/") == -1);
+  ASSERT (errno == ENOTDIR);
+
+  /* Non-empty directory.  */
+  errno = 0;
+  ASSERT (remove (BASE "dir") == -1);
+  ASSERT (errno == EEXIST || errno == ENOTEMPTY);
+
+  /* Non-directory.  */
+  ASSERT (remove (BASE "dir/file") == 0);
+
+  /* Empty directory.  */
+  errno = 0;
+  ASSERT (remove (BASE "dir/.//") == -1);
+  ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST);
+  ASSERT (remove (BASE "dir") == 0);
+
+  /* Test symlink behavior.  Specifying trailing slash should remove
+     referent directory, or cause ENOTDIR failure, but not touch
+     symlink.  */
+  if (symlink (BASE "dir", BASE "link") != 0)
+    {
+      fputs ("skipping test: symlinks not supported on this file system\n",
+             stderr);
+      return 77;
+    }
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  errno = 0;
+  if (remove (BASE "link/") == 0)
+    {
+      struct stat st;
+      errno = 0;
+      ASSERT (stat (BASE "link", &st) == -1);
+      ASSERT (errno == ENOENT);
+    }
+  else
+    ASSERT (remove (BASE "dir") == 0);
+  {
+    struct stat st;
+    ASSERT (lstat (BASE "link", &st) == 0);
+    ASSERT (S_ISLNK (st.st_mode));
+  }
+  ASSERT (remove (BASE "link") == 0);
+  /* Trailing slash on symlink to non-directory is an error.  */
+  ASSERT (symlink (BASE "loop", BASE "loop") == 0);
+  errno = 0;
+  ASSERT (remove (BASE "loop/") == -1);
+  ASSERT (errno == ELOOP || errno == ENOTDIR);
+  ASSERT (remove (BASE "loop") == 0);
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  ASSERT (symlink (BASE "file", BASE "link") == 0);
+  errno = 0;
+  ASSERT (remove (BASE "link/") == -1);
+  ASSERT (errno == ENOTDIR);
+  ASSERT (remove (BASE "link") == 0);
+  ASSERT (remove (BASE "file") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 355b7be2b79df83b4925cb95b831d27f3a0a6002..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-rename.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..df3e8fb643c1e0385d83522a337296012fa55358
--- /dev/null
@@ -0,0 +1,46 @@
+/* Test of rename() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (rename, int, (char const *, char const *));
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-rename.t"
+
+#include "test-rename.h"
+
+int
+main (void)
+{
+  /* Remove any garbage left from previous partial runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_rename (rename, true);
+}
deleted file mode 120000 (symlink)
index 870f4174100bd5805d5a2e99bac465fe36df2041..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-rename.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c0678492e8dedc43194e117cb80f30672bb991bd
--- /dev/null
@@ -0,0 +1,964 @@
+/* Test of rename() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file is designed to test both rename(a,b) and
+   renameat(AT_FDCWD,a,AT_FDCWD,b).  FUNC is the function to test.
+   Assumes that BASE and ASSERT are already defined, and that
+   appropriate headers are already included.  If PRINT, warn before
+   skipping symlink tests with status 77.  */
+
+/* Tests whether a file, given by a file name without slashes, exists in
+   the current directory, by scanning the directory entries.  */
+static bool
+dentry_exists (const char *filename)
+{
+  bool exists = false;
+  DIR *dir = opendir (".");
+
+  ASSERT (dir != NULL);
+  for (;;)
+    {
+      struct dirent *d = readdir (dir);
+      if (d == NULL)
+        break;
+      if (strcmp (d->d_name, filename) == 0)
+        {
+          exists = true;
+          break;
+        }
+    }
+  ASSERT (closedir (dir) == 0);
+  return exists;
+}
+
+/* Asserts that a specific file, given by a file name without slashes, does
+   not exist in the current directory.  */
+static void
+assert_nonexistent (const char *filename)
+{
+  struct stat st;
+
+  /* The usual way to test the presence of a file is via stat() or lstat().  */
+  errno = 0;
+  if (stat (filename, &st) == -1)
+    ASSERT (errno == ENOENT);
+  else
+    {
+      /* But after renaming a directory over an empty directory on an NFS-
+         mounted file system, on Linux 2.6.18, for a period of 30 seconds the
+         old directory name is "present" according to stat() but "nonexistent"
+         according to dentry_exists().  */
+      ASSERT (!dentry_exists (filename));
+      /* Remove the old directory name, so that subsequent mkdir calls
+         succeed.  */
+      (void) rmdir (filename);
+    }
+}
+
+static int
+test_rename (int (*func) (char const *, char const *), bool print)
+{
+  /* Setup.  */
+  struct stat st;
+  int fd = creat (BASE "file", 0600);
+  ASSERT (0 <= fd);
+  ASSERT (write (fd, "hi", 2) == 2);
+  ASSERT (close (fd) == 0);
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+
+  /* Files present here:
+       {BASE}file
+       {BASE}dir/
+   */
+
+  /* Obvious errors.  */
+
+  { /* Missing source.  */
+    {
+      errno = 0;
+      ASSERT (func (BASE "missing", BASE "missing") == -1);
+      ASSERT (errno == ENOENT);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "missing/", BASE "missing") == -1);
+      ASSERT (errno == ENOENT);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "missing", BASE "missing/") == -1);
+      ASSERT (errno == ENOENT);
+    }
+  }
+  { /* Empty operand.  */
+    {
+      errno = 0;
+      ASSERT (func ("", BASE "missing") == -1);
+      ASSERT (errno == ENOENT);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "file", "") == -1);
+      ASSERT (errno == ENOENT);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "", "") == -1);
+      ASSERT (errno == ENOENT);
+    }
+  }
+
+  /* Files.  */
+
+  { /* Trailing slash.  */
+    {
+      errno = 0;
+      ASSERT (func (BASE "file", BASE "file2/") == -1);
+      ASSERT (errno == ENOENT || errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "file/", BASE "file2") == -1);
+      ASSERT (errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (stat (BASE "file2", &st) == -1);
+      ASSERT (errno == ENOENT);
+    }
+  }
+  { /* Simple rename.  */
+    ASSERT (func (BASE "file", BASE "file2") == 0);
+    errno = 0;
+    ASSERT (stat (BASE "file", &st) == -1);
+    ASSERT (errno == ENOENT);
+    memset (&st, 0, sizeof st);
+    ASSERT (stat (BASE "file2", &st) == 0);
+    ASSERT (st.st_size == 2);
+  }
+  /* Files present here:
+       {BASE}file2
+       {BASE}dir/
+   */
+  { /* Overwrite.  */
+    ASSERT (close (creat (BASE "file", 0600)) == 0);
+    errno = 0;
+    ASSERT (func (BASE "file2", BASE "file/") == -1);
+    ASSERT (errno == ENOTDIR);
+    ASSERT (func (BASE "file2", BASE "file") == 0);
+    memset (&st, 0, sizeof st);
+    ASSERT (stat (BASE "file", &st) == 0);
+    ASSERT (st.st_size == 2);
+    errno = 0;
+    ASSERT (stat (BASE "file2", &st) == -1);
+    ASSERT (errno == ENOENT);
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}dir/
+   */
+
+  /* Directories.  */
+
+  { /* Simple rename.  */
+    {
+      ASSERT (func (BASE "dir", BASE "dir2/") == 0);
+      errno = 0;
+      ASSERT (stat (BASE "dir", &st) == -1);
+      ASSERT (errno == ENOENT);
+      ASSERT (stat (BASE "dir2", &st) == 0);
+    }
+    /* Files present here:
+         {BASE}file
+         {BASE}dir2/
+     */
+    {
+      ASSERT (func (BASE "dir2/", BASE "dir") == 0);
+      ASSERT (stat (BASE "dir", &st) == 0);
+      errno = 0;
+      ASSERT (stat (BASE "dir2", &st) == -1);
+      ASSERT (errno == ENOENT);
+    }
+    /* Files present here:
+         {BASE}file
+         {BASE}dir/
+     */
+    {
+      ASSERT (func (BASE "dir", BASE "dir2") == 0);
+      errno = 0;
+      ASSERT (stat (BASE "dir", &st) == -1);
+      ASSERT (errno == ENOENT);
+      ASSERT (stat (BASE "dir2", &st) == 0);
+    }
+    /* Files present here:
+         {BASE}file
+         {BASE}dir2/
+     */
+    { /* Empty onto empty.  */
+      ASSERT (mkdir (BASE "dir", 0700) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir2/
+       */
+      ASSERT (func (BASE "dir2", BASE "dir") == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+       */
+      ASSERT (mkdir (BASE "dir2", 0700) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir2/
+       */
+      ASSERT (func (BASE "dir2", BASE "dir/") == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+       */
+      ASSERT (mkdir (BASE "dir2", 0700) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir2/
+       */
+      ASSERT (func (BASE "dir2/", BASE "dir") == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+       */
+      ASSERT (mkdir (BASE "dir2", 0700) == 0);
+    }
+    /* Files present here:
+         {BASE}file
+         {BASE}dir/
+         {BASE}dir2/
+     */
+    { /* Empty onto full.  */
+      ASSERT (close (creat (BASE "dir/file", 0600)) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir/file
+           {BASE}dir2/
+       */
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir2", BASE "dir") == -1);
+        ASSERT (errno == EEXIST || errno == ENOTEMPTY);
+      }
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir2/", BASE "dir") == -1);
+        ASSERT (errno == EEXIST || errno == ENOTEMPTY);
+      }
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir2", BASE "dir/") == -1);
+        ASSERT (errno == EEXIST || errno == ENOTEMPTY);
+      }
+    }
+    { /* Full onto empty.  */
+      ASSERT (func (BASE "dir", BASE "dir2") == 0);
+      assert_nonexistent (BASE "dir");
+      ASSERT (stat (BASE "dir2/file", &st) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir2/
+           {BASE}dir2/file
+       */
+      ASSERT (mkdir (BASE "dir", 0700) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir2/
+           {BASE}dir2/file
+       */
+      {
+        ASSERT (func (BASE "dir2/", BASE "dir") == 0);
+        ASSERT (stat (BASE "dir/file", &st) == 0);
+        errno = 0;
+        ASSERT (stat (BASE "dir2", &st) == -1);
+        ASSERT (errno == ENOENT);
+      }
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir/file
+       */
+      ASSERT (mkdir (BASE "dir2", 0700) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir/file
+           {BASE}dir2/
+       */
+      {
+        ASSERT (func (BASE "dir", BASE "dir2/") == 0);
+        assert_nonexistent (BASE "dir");
+        ASSERT (stat (BASE "dir2/file", &st) == 0);
+      }
+      /* Files present here:
+           {BASE}file
+           {BASE}dir2/
+           {BASE}dir2/file
+       */
+      ASSERT (unlink (BASE "dir2/file") == 0);
+    }
+    /* Files present here:
+         {BASE}file
+         {BASE}dir2/
+     */
+    { /* Reject trailing dot.  */
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir2", BASE "dir/.") == -1);
+        ASSERT (errno == EINVAL || errno == ENOENT);
+      }
+      ASSERT (mkdir (BASE "dir", 0700) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir2/
+       */
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir2", BASE "dir/.") == -1);
+        ASSERT (errno == EINVAL || errno == EBUSY || errno == EISDIR
+                || errno == ENOTEMPTY || errno == EEXIST
+                || errno == ENOENT /* WSL */);
+      }
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir2/.", BASE "dir") == -1);
+        ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
+                || errno == ENOENT /* WSL */);
+      }
+      ASSERT (rmdir (BASE "dir") == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir2/
+       */
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir2", BASE "dir/.//") == -1);
+        ASSERT (errno == EINVAL || errno == ENOENT);
+      }
+      ASSERT (mkdir (BASE "dir", 0700) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir2/
+       */
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir2", BASE "dir/.//") == -1);
+        ASSERT (errno == EINVAL || errno == EBUSY || errno == EISDIR
+                || errno == ENOTEMPTY || errno == EEXIST
+                || errno == ENOENT /* WSL */);
+      }
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir2/.//", BASE "dir") == -1);
+        ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
+                || errno == ENOENT /* WSL */);
+      }
+      ASSERT (rmdir (BASE "dir2") == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+       */
+    }
+    { /* Move into subdir.  */
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir", BASE "dir/sub") == -1);
+        ASSERT (errno == EINVAL || errno == EACCES);
+      }
+      {
+        errno = 0;
+        ASSERT (stat (BASE "dir/sub", &st) == -1);
+        ASSERT (errno == ENOENT);
+      }
+      ASSERT (mkdir (BASE "dir/sub", 0700) == 0);
+      /* Files present here:
+           {BASE}file
+           {BASE}dir/
+           {BASE}dir/sub/
+       */
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir", BASE "dir/sub") == -1);
+        ASSERT (errno == EINVAL);
+        ASSERT (stat (BASE "dir/sub", &st) == 0);
+      }
+      ASSERT (rmdir (BASE "dir/sub") == 0);
+    }
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}dir/
+   */
+
+  /* Mixing file and directory.  */
+
+  {
+    { /* File onto dir.  */
+      {
+        errno = 0;
+        ASSERT (func (BASE "file", BASE "dir") == -1);
+        ASSERT (errno == EISDIR || errno == ENOTDIR);
+      }
+      {
+        errno = 0;
+        ASSERT (func (BASE "file", BASE "dir/") == -1);
+        ASSERT (errno == EISDIR || errno == ENOTDIR);
+      }
+    }
+    { /* Dir onto file.  */
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir", BASE "file") == -1);
+        ASSERT (errno == ENOTDIR);
+      }
+      {
+        errno = 0;
+        ASSERT (func (BASE "dir/", BASE "file") == -1);
+        ASSERT (errno == ENOTDIR);
+      }
+    }
+  }
+
+  /* Hard links.  */
+
+  { /* File onto self.  */
+    ASSERT (func (BASE "file", BASE "file") == 0);
+    memset (&st, 0, sizeof st);
+    ASSERT (stat (BASE "file", &st) == 0);
+    ASSERT (st.st_size == 2);
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}dir/
+   */
+  { /* Empty dir onto self.  */
+    ASSERT (func (BASE "dir", BASE "dir") == 0);
+    ASSERT (stat (BASE "dir", &st) == 0);
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}dir/
+   */
+  ASSERT (close (creat (BASE "dir/file", 0600)) == 0);
+  /* Files present here:
+       {BASE}file
+       {BASE}dir/
+       {BASE}dir/file
+   */
+  { /* Full dir onto self.  */
+    ASSERT (func (BASE "dir", BASE "dir") == 0);
+  }
+  ASSERT (unlink (BASE "dir/file") == 0);
+  /* Files present here:
+       {BASE}file
+       {BASE}dir/
+   */
+  {
+    /*  Not all file systems support link.  Mingw doesn't have
+        reliable st_nlink on hard links, but our implementation does
+        fail with EPERM on poor file systems, and we can detect the
+        inferior stat() via st_ino.  Cygwin 1.5.x copies rather than
+        links files on those file systems, but there, st_nlink and
+        st_ino are reliable.  */
+    int ret = link (BASE "file", BASE "file2");
+    if (!ret)
+      {
+        memset (&st, 0, sizeof st);
+        ASSERT (stat (BASE "file2", &st) == 0);
+        if (st.st_ino && st.st_nlink != 2)
+          {
+            ASSERT (unlink (BASE "file2") == 0);
+            errno = EPERM;
+            ret = -1;
+          }
+      }
+    if (ret == -1)
+      {
+        /* If the device does not support hard links, errno is
+           EPERM on Linux,
+           EOPNOTSUPP on FreeBSD,
+           EACCES on Android within Termux.  */
+        switch (errno)
+          {
+          case EPERM:
+          case EOPNOTSUPP:
+          #if defined __ANDROID__
+          case EACCES:
+          #endif
+            if (print)
+              fputs ("skipping test: "
+                     "hard links not supported on this file system\n",
+                     stderr);
+            ASSERT (unlink (BASE "file") == 0);
+            ASSERT (rmdir (BASE "dir") == 0);
+            return 77;
+          default:
+            perror ("link");
+            return 1;
+          }
+      }
+    ASSERT (ret == 0);
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}file2       (hard link to file)
+       {BASE}dir/
+   */
+  { /* File onto hard link.  */
+    ASSERT (func (BASE "file", BASE "file2") == 0);
+    memset (&st, 0, sizeof st);
+    if (stat (BASE "file", &st) != 0)
+      {
+        /* This can happen on NetBSD.  */
+        ASSERT (errno == ENOENT);
+        ASSERT (link (BASE "file2", BASE "file") == 0);
+        ASSERT (stat (BASE "file", &st) == 0);
+      }
+    ASSERT (st.st_size == 2);
+    memset (&st, 0, sizeof st);
+    ASSERT (stat (BASE "file2", &st) == 0);
+    ASSERT (st.st_size == 2);
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}file2
+       {BASE}dir/
+   */
+  ASSERT (unlink (BASE "file2") == 0);
+  /* Files present here:
+       {BASE}file
+       {BASE}dir/
+   */
+
+  /* Symlinks.  */
+
+  if (symlink (BASE "file", BASE "link1"))
+    {
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      ASSERT (unlink (BASE "file") == 0);
+      ASSERT (rmdir (BASE "dir") == 0);
+      return 77;
+    }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}dir/
+   */
+  { /* Simple rename.  */
+    ASSERT (func (BASE "link1", BASE "link2") == 0);
+    ASSERT (stat (BASE "file", &st) == 0);
+    errno = 0;
+    ASSERT (lstat (BASE "link1", &st) == -1);
+    ASSERT (errno == ENOENT);
+    memset (&st, 0, sizeof st);
+    ASSERT (lstat (BASE "link2", &st) == 0);
+    ASSERT (S_ISLNK (st.st_mode));
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link2 -> {BASE}file
+       {BASE}dir/
+   */
+  { /* Overwrite.  */
+    ASSERT (symlink (BASE "nowhere", BASE "link1") == 0);
+    /* Files present here:
+         {BASE}file
+         {BASE}link1 -> {BASE}nowhere
+         {BASE}link2 -> {BASE}file
+         {BASE}dir/
+     */
+    {
+      ASSERT (func (BASE "link2", BASE "link1") == 0);
+      memset (&st, 0, sizeof st);
+      ASSERT (stat (BASE "link1", &st) == 0);
+      ASSERT (st.st_size == 2);
+      errno = 0;
+      ASSERT (lstat (BASE "link2", &st) == -1);
+      ASSERT (errno == ENOENT);
+    }
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}dir/
+   */
+  { /* Symlink loop.  */
+    ASSERT (symlink (BASE "link2", BASE "link2") == 0);
+    /* Files present here:
+         {BASE}file
+         {BASE}link1 -> {BASE}file
+         {BASE}link2 -> {BASE}link2
+         {BASE}dir/
+     */
+    {
+      ASSERT (func (BASE "link2", BASE "link2") == 0);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "link2/", BASE "link2") == -1);
+      ASSERT (errno == ELOOP || errno == ENOTDIR);
+    }
+    ASSERT (func (BASE "link2", BASE "link3") == 0);
+    /* Files present here:
+         {BASE}file
+         {BASE}link1 -> {BASE}file
+         {BASE}link3 -> {BASE}link2
+         {BASE}dir/
+     */
+    ASSERT (unlink (BASE "link3") == 0);
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}dir/
+   */
+  { /* Dangling link.  */
+    ASSERT (symlink (BASE "nowhere", BASE "link2") == 0);
+    /* Files present here:
+         {BASE}file
+         {BASE}link1 -> {BASE}file
+         {BASE}link2 -> {BASE}nowhere
+         {BASE}dir/
+     */
+    {
+      ASSERT (func (BASE "link2", BASE "link3") == 0);
+      errno = 0;
+      ASSERT (lstat (BASE "link2", &st) == -1);
+      ASSERT (errno == ENOENT);
+      memset (&st, 0, sizeof st);
+      ASSERT (lstat (BASE "link3", &st) == 0);
+    }
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}link3 -> {BASE}nowhere
+       {BASE}dir/
+   */
+  { /* Trailing slash on dangling.  */
+    {
+      errno = 0;
+      ASSERT (func (BASE "link3/", BASE "link2") == -1);
+      ASSERT (errno == ENOENT || errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "link3", BASE "link2/") == -1);
+      ASSERT (errno == ENOENT || errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (lstat (BASE "link2", &st) == -1);
+      ASSERT (errno == ENOENT);
+    }
+    memset (&st, 0, sizeof st);
+    ASSERT (lstat (BASE "link3", &st) == 0);
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}link3 -> {BASE}nowhere
+       {BASE}dir/
+   */
+  { /* Trailing slash on link to file.  */
+    {
+      errno = 0;
+      ASSERT (func (BASE "link1/", BASE "link2") == -1);
+      ASSERT (errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "link1", BASE "link3/") == -1);
+      ASSERT (errno == ENOENT || errno == ENOTDIR);
+    }
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}link3 -> {BASE}nowhere
+       {BASE}dir/
+   */
+
+  /* Mixing symlink and file.  */
+
+  { /* File onto link.  */
+    ASSERT (close (creat (BASE "file2", 0600)) == 0);
+    /* Files present here:
+         {BASE}file
+         {BASE}file2
+         {BASE}link1 -> {BASE}file
+         {BASE}link3 -> {BASE}nowhere
+         {BASE}dir/
+     */
+    {
+      ASSERT (func (BASE "file2", BASE "link3") == 0);
+      errno = 0;
+      ASSERT (stat (BASE "file2", &st) == -1);
+      ASSERT (errno == ENOENT);
+      memset (&st, 0, sizeof st);
+      ASSERT (lstat (BASE "link3", &st) == 0);
+      ASSERT (S_ISREG (st.st_mode));
+    }
+    /* Files present here:
+         {BASE}file
+         {BASE}link1 -> {BASE}file
+         {BASE}link3
+         {BASE}dir/
+     */
+    ASSERT (unlink (BASE "link3") == 0);
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}dir/
+   */
+  { /* Link onto file.  */
+    ASSERT (symlink (BASE "nowhere", BASE "link2") == 0);
+    /* Files present here:
+         {BASE}file
+         {BASE}link1 -> {BASE}file
+         {BASE}link2 -> {BASE}nowhere
+         {BASE}dir/
+     */
+    ASSERT (close (creat (BASE "file2", 0600)) == 0);
+    /* Files present here:
+         {BASE}file
+         {BASE}file2
+         {BASE}link1 -> {BASE}file
+         {BASE}link2 -> {BASE}nowhere
+         {BASE}dir/
+     */
+    {
+      ASSERT (func (BASE "link2", BASE "file2") == 0);
+      errno = 0;
+      ASSERT (lstat (BASE "link2", &st) == -1);
+      ASSERT (errno == ENOENT);
+      memset (&st, 0, sizeof st);
+      ASSERT (lstat (BASE "file2", &st) == 0);
+      ASSERT (S_ISLNK (st.st_mode));
+    }
+    /* Files present here:
+         {BASE}file
+         {BASE}file2 -> {BASE}nowhere
+         {BASE}link1 -> {BASE}file
+         {BASE}dir/
+     */
+    ASSERT (unlink (BASE "file2") == 0);
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}dir/
+   */
+  { /* Trailing slash.  */
+    {
+      errno = 0;
+      ASSERT (func (BASE "file/", BASE "link1") == -1);
+      ASSERT (errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "file", BASE "link1/") == -1);
+      ASSERT (errno == ENOTDIR || errno == ENOENT);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "link1/", BASE "file") == -1);
+      ASSERT (errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "link1", BASE "file/") == -1);
+      ASSERT (errno == ENOTDIR || errno == ENOENT);
+      memset (&st, 0, sizeof st);
+      ASSERT (lstat (BASE "file", &st) == 0);
+      ASSERT (S_ISREG (st.st_mode));
+      memset (&st, 0, sizeof st);
+      ASSERT (lstat (BASE "link1", &st) == 0);
+      ASSERT (S_ISLNK (st.st_mode));
+    }
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}dir/
+   */
+
+  /* Mixing symlink and directory.  */
+
+  { /* Directory onto link.  */
+    {
+      errno = 0;
+      ASSERT (func (BASE "dir", BASE "link1") == -1);
+      ASSERT (errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "dir/", BASE "link1") == -1);
+      ASSERT (errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "dir", BASE "link1/") == -1);
+      ASSERT (errno == ENOTDIR);
+    }
+  }
+  { /* Link onto directory.  */
+    {
+      errno = 0;
+      ASSERT (func (BASE "link1", BASE "dir") == -1);
+      ASSERT (errno == EISDIR || errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "link1", BASE "dir/") == -1);
+      ASSERT (errno == EISDIR || errno == ENOTDIR);
+    }
+    {
+      errno = 0;
+      ASSERT (func (BASE "link1/", BASE "dir") == -1);
+      ASSERT (errno == ENOTDIR);
+      memset (&st, 0, sizeof st);
+      ASSERT (lstat (BASE "link1", &st) == 0);
+      ASSERT (S_ISLNK (st.st_mode));
+      memset (&st, 0, sizeof st);
+      ASSERT (lstat (BASE "dir", &st) == 0);
+      ASSERT (S_ISDIR (st.st_mode));
+    }
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}dir/
+   */
+
+  /* POSIX requires rename("link-to-dir/","other") to rename "dir" and
+     leave "link-to-dir" dangling, but GNU rejects this.  POSIX
+     requires rename("dir","dangling/") to create the directory so
+     that "dangling/" now resolves, but GNU rejects this.  While we
+     prefer GNU behavior, we don't enforce it.  However, we do test
+     that the system either follows POSIX in both cases, or follows
+     GNU.  */
+  {
+    int result;
+    ASSERT (symlink (BASE "dir2", BASE "link2") == 0);
+    /* Files present here:
+         {BASE}file
+         {BASE}link1 -> {BASE}file
+         {BASE}link2 -> {BASE}dir2
+         {BASE}dir/
+     */
+    errno = 0;
+    result = func (BASE "dir", BASE "link2/");
+    if (result == 0)
+      {
+        /* POSIX.  */
+        errno = 0;
+        ASSERT (lstat (BASE "dir", &st) == -1);
+        ASSERT (errno == ENOENT);
+        memset (&st, 0, sizeof st);
+        ASSERT (lstat (BASE "dir2", &st) == 0);
+        ASSERT (S_ISDIR (st.st_mode));
+        memset (&st, 0, sizeof st);
+        ASSERT (lstat (BASE "link2", &st) == 0);
+        ASSERT (S_ISLNK (st.st_mode));
+        /* Files present here:
+             {BASE}file
+             {BASE}link1 -> {BASE}file
+             {BASE}link2 -> {BASE}dir2
+             {BASE}dir2/
+         */
+        {
+          ASSERT (func (BASE "link2/", BASE "dir") == 0);
+          memset (&st, 0, sizeof st);
+          ASSERT (lstat (BASE "dir", &st) == 0);
+          ASSERT (S_ISDIR (st.st_mode));
+          errno = 0;
+          ASSERT (lstat (BASE "dir2", &st) == -1);
+          ASSERT (errno == ENOENT);
+          memset (&st, 0, sizeof st);
+          ASSERT (lstat (BASE "link2", &st) == 0);
+          ASSERT (S_ISLNK (st.st_mode));
+        }
+      }
+    else
+      {
+        /* GNU.  */
+        ASSERT (result == -1);
+        ASSERT (errno == ENOTDIR);
+        memset (&st, 0, sizeof st);
+        ASSERT (lstat (BASE "dir", &st) == 0);
+        ASSERT (S_ISDIR (st.st_mode));
+        errno = 0;
+        ASSERT (lstat (BASE "dir2", &st) == -1);
+        ASSERT (errno == ENOENT);
+        memset (&st, 0, sizeof st);
+        ASSERT (lstat (BASE "link2", &st) == 0);
+        ASSERT (S_ISLNK (st.st_mode));
+        ASSERT (unlink (BASE "link2") == 0);
+        ASSERT (symlink (BASE "dir", BASE "link2") == 0);
+        /* Files present here:
+             {BASE}file
+             {BASE}link1 -> {BASE}file
+             {BASE}link2 -> {BASE}dir
+             {BASE}dir/
+         */
+        errno = 0; /* OpenBSD notices that link2/ and dir are the same.  */
+        result = func (BASE "link2/", BASE "dir");
+        if (result) /* GNU/Linux rejects attempts to use link2/.  */
+          {
+            ASSERT (result == -1);
+            ASSERT (errno == ENOTDIR || errno == EISDIR);
+          }
+        memset (&st, 0, sizeof st);
+        ASSERT (lstat (BASE "dir", &st) == 0);
+        ASSERT (S_ISDIR (st.st_mode));
+        errno = 0;
+        ASSERT (lstat (BASE "dir2", &st) == -1);
+        ASSERT (errno == ENOENT);
+        memset (&st, 0, sizeof st);
+        ASSERT (lstat (BASE "link2", &st) == 0);
+        ASSERT (S_ISLNK (st.st_mode));
+      }
+  }
+  /* Files present here:
+       {BASE}file
+       {BASE}link1 -> {BASE}file
+       {BASE}link2 -> {BASE}dir or {BASE}dir2
+       {BASE}dir/
+   */
+
+  /* Clean up.  */
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (rmdir (BASE "dir") == 0);
+  ASSERT (unlink (BASE "link1") == 0);
+  ASSERT (unlink (BASE "link2") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index abcd7ba03acfa393a568f1853bc16799e0ac156c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-renameat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..79bf87b47471c69f8bde94ab6470f29c2ee35d1a
--- /dev/null
@@ -0,0 +1,207 @@
+/* Tests of renameat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (renameat, int, (int, char const *, int, char const *));
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include "filenamecat.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-renameat.t"
+
+#include "test-rename.h"
+
+static int dfd1 = AT_FDCWD;
+static int dfd2 = AT_FDCWD;
+
+/* Wrapper to test renameat like rename.  */
+static int
+do_rename (char const *name1, char const *name2)
+{
+  return renameat (dfd1, name1, dfd2, name2);
+}
+
+int
+main (void)
+{
+  int i;
+  int dfd;
+  char *cwd;
+  int result;
+
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (renameat (-1, "foo", AT_FDCWD, "bar") == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (renameat (99, "foo", AT_FDCWD, "bar") == -1);
+    ASSERT (errno == EBADF);
+  }
+  ASSERT (close (creat (BASE "oo", 0600)) == 0);
+  {
+    errno = 0;
+    ASSERT (renameat (AT_FDCWD, BASE "oo", -1, "bar") == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (renameat (AT_FDCWD, BASE "oo", 99, "bar") == -1);
+    ASSERT (errno == EBADF);
+  }
+  ASSERT (unlink (BASE "oo") == 0);
+
+  /* Test basic rename functionality, using current directory.  */
+  result = test_rename (do_rename, false);
+  dfd1 = open (".", O_RDONLY);
+  ASSERT (0 <= dfd1);
+  ASSERT (test_rename (do_rename, false) == result);
+  dfd2 = dfd1;
+  ASSERT (test_rename (do_rename, false) == result);
+  dfd1 = AT_FDCWD;
+  ASSERT (test_rename (do_rename, false) == result);
+  ASSERT (close (dfd2) == 0);
+
+  /* Create locations to manipulate.  */
+  ASSERT (mkdir (BASE "sub1", 0700) == 0);
+  ASSERT (mkdir (BASE "sub2", 0700) == 0);
+  dfd = creat (BASE "00", 0600);
+  ASSERT (0 <= dfd);
+  ASSERT (close (dfd) == 0);
+  cwd = getcwd (NULL, 0);
+  ASSERT (cwd);
+
+  dfd = open (BASE "sub1", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (chdir (BASE "sub2") == 0);
+
+  /* There are 16 possible scenarios, based on whether an fd is
+     AT_FDCWD or real, and whether a file is absolute or relative.
+
+     To ensure that we test all of the code paths (rather than
+     triggering early normalization optimizations), we use a loop to
+     repeatedly rename a file in the parent directory, use an fd open
+     on subdirectory 1, all while executing in subdirectory 2; all
+     relative names are thus given with a leading "../".  Finally, the
+     last scenario (two relative paths given, neither one AT_FDCWD)
+     has two paths, based on whether the two fds are equivalent, so we
+     do the other variant after the loop.  */
+  for (i = 0; i < 16; i++)
+    {
+      int fd1 = (i & 8) ? dfd : AT_FDCWD;
+      char *file1 = file_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
+      int fd2 = (i & 2) ? dfd : AT_FDCWD;
+      char *file2 = file_name_concat ((i & 1) ? ".." : cwd, BASE "xx", NULL);
+
+      ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
+      ASSERT (sprintf (strchr (file2, '\0') - 2, "%02d", i + 1) == 2);
+      ASSERT (renameat (fd1, file1, fd2, file2) == 0);
+      free (file1);
+      free (file2);
+    }
+  dfd2 = open ("..", O_RDONLY);
+  ASSERT (0 <= dfd2);
+  ASSERT (renameat (dfd, "../" BASE "16", dfd2, BASE "17") == 0);
+  ASSERT (close (dfd2) == 0);
+
+  /* Now we change back to the parent directory, and set dfd to ".";
+     using dfd in remaining tests will expose any bugs if emulation
+     via /proc/self/fd doesn't check for empty names.  */
+  ASSERT (chdir ("..") == 0);
+  ASSERT (close (dfd) == 0);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+
+  ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "sub1", dfd, BASE "sub2") == -1);
+  ASSERT (errno == EEXIST || errno == ENOTEMPTY);
+  ASSERT (unlink (BASE "sub2/file") == 0);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "sub2", dfd, BASE "sub1/.") == -1);
+  ASSERT (errno == EINVAL || errno == EISDIR || errno == EBUSY
+          || errno == ENOTEMPTY || errno == EEXIST
+          || errno == ENOENT /* WSL */);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "sub2/.", dfd, BASE "sub1") == -1);
+  ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
+          || errno == ENOENT /* WSL */);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "17", dfd, BASE "sub1") == -1);
+  ASSERT (errno == EISDIR);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "nosuch", dfd, BASE "18") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (renameat (dfd, "", dfd, BASE "17") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "17", dfd, "") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "sub2", dfd, BASE "17") == -1);
+  ASSERT (errno == ENOTDIR);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "17/", dfd, BASE "18") == -1);
+  ASSERT (errno == ENOTDIR);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "17", dfd, BASE "18/") == -1);
+  ASSERT (errno == ENOTDIR || errno == ENOENT);
+
+  /* Finally, make sure we can overwrite existing files.  */
+  ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
+  errno = 0;
+  ASSERT (renameat (dfd, BASE "sub2", dfd, BASE "sub1") == 0);
+  ASSERT (renameat (dfd, BASE "sub1/file", dfd, BASE "17") == 0);
+
+  /* Cleanup.  */
+  ASSERT (close (dfd) == 0);
+  errno = 0;
+  ASSERT (unlink (BASE "sub1/file") == -1);
+  ASSERT (errno == ENOENT);
+  ASSERT (unlink (BASE "17") == 0);
+  ASSERT (rmdir (BASE "sub1") == 0);
+  errno = 0;
+  ASSERT (rmdir (BASE "sub2") == -1);
+  ASSERT (errno == ENOENT);
+  free (cwd);
+
+  if (result)
+    fputs ("skipping test: symlinks not supported on this file system\n",
+           stderr);
+  return result;
+}
deleted file mode 120000 (symlink)
index 3954a7a3f3e7a1cbab78588b5d70bf87e4ba20b4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-renameatu.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..68faeb83e70a37a5619331ff234bee2b814c537e
--- /dev/null
@@ -0,0 +1,220 @@
+/* Test renameatu.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <renameatu.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (renameatu, int,
+                 (int, char const *, int, char const *, unsigned int));
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include "filenamecat.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-renameatu.t"
+
+#include "test-rename.h"
+
+static int dfd1 = AT_FDCWD;
+static int dfd2 = AT_FDCWD;
+
+/* Wrapper to test renameatu like rename.  */
+static int
+do_rename (char const *name1, char const *name2)
+{
+  return renameatu (dfd1, name1, dfd2, name2, 0);
+}
+
+int
+main (void)
+{
+  int i;
+  int dfd;
+  char *cwd;
+  int result;
+
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (renameatu (-1, "foo", AT_FDCWD, "bar", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (renameatu (99, "foo", AT_FDCWD, "bar", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  ASSERT (close (creat (BASE "oo", 0600)) == 0);
+  {
+    errno = 0;
+    ASSERT (renameatu (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (renameatu (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  ASSERT (unlink (BASE "oo") == 0);
+
+  /* Test basic rename functionality, using current directory.  */
+  result = test_rename (do_rename, false);
+  dfd1 = open (".", O_RDONLY);
+  ASSERT (0 <= dfd1);
+  ASSERT (test_rename (do_rename, false) == result);
+  dfd2 = dfd1;
+  ASSERT (test_rename (do_rename, false) == result);
+  dfd1 = AT_FDCWD;
+  ASSERT (test_rename (do_rename, false) == result);
+  ASSERT (close (dfd2) == 0);
+
+  /* Create locations to manipulate.  */
+  ASSERT (mkdir (BASE "sub1", 0700) == 0);
+  ASSERT (mkdir (BASE "sub2", 0700) == 0);
+  dfd = creat (BASE "00", 0600);
+  ASSERT (0 <= dfd);
+  ASSERT (close (dfd) == 0);
+  cwd = getcwd (NULL, 0);
+  ASSERT (cwd);
+
+  dfd = open (BASE "sub1", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (chdir (BASE "sub2") == 0);
+
+  /* There are 16 possible scenarios, based on whether an fd is
+     AT_FDCWD or real, and whether a file is absolute or relative.
+
+     To ensure that we test all of the code paths (rather than
+     triggering early normalization optimizations), we use a loop to
+     repeatedly rename a file in the parent directory, use an fd open
+     on subdirectory 1, all while executing in subdirectory 2; all
+     relative names are thus given with a leading "../".  Finally, the
+     last scenario (two relative paths given, neither one AT_FDCWD)
+     has two paths, based on whether the two fds are equivalent, so we
+     do the other variant after the loop.  */
+  for (i = 0; i < 16; i++)
+    {
+      int fd1 = (i & 8) ? dfd : AT_FDCWD;
+      char *file1 = file_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
+      int fd2 = (i & 2) ? dfd : AT_FDCWD;
+      char *file2 = file_name_concat ((i & 1) ? ".." : cwd, BASE "xx", NULL);
+
+      ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
+      ASSERT (sprintf (strchr (file2, '\0') - 2, "%02d", i + 1) == 2);
+      ASSERT (renameatu (fd1, file1, fd2, file2, 0) == 0);
+      free (file1);
+      free (file2);
+    }
+  dfd2 = open ("..", O_RDONLY);
+  ASSERT (0 <= dfd2);
+  ASSERT (renameatu (dfd, "../" BASE "16", dfd2, BASE "17", 0) == 0);
+  ASSERT (close (dfd2) == 0);
+
+  /* Now we change back to the parent directory, and set dfd to ".";
+     using dfd in remaining tests will expose any bugs if emulation
+     via /proc/self/fd doesn't check for empty names.  */
+  ASSERT (chdir ("..") == 0);
+  ASSERT (close (dfd) == 0);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+
+  ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
+  errno = 0;
+  ASSERT (renameatu (dfd, BASE "sub1", dfd, BASE "sub2", 0) == -1);
+  ASSERT (errno == EEXIST || errno == ENOTEMPTY);
+  ASSERT (unlink (BASE "sub2/file") == 0);
+  errno = 0;
+  ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "sub1/.", 0) == -1);
+  ASSERT (errno == EINVAL || errno == EISDIR || errno == EBUSY
+          || errno == ENOTEMPTY || errno == EEXIST
+          || errno == ENOENT /* WSL */);
+  errno = 0;
+  ASSERT (renameatu (dfd, BASE "sub2/.", dfd, BASE "sub1", 0) == -1);
+  ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
+          || errno == ENOENT /* WSL */);
+  errno = 0;
+  ASSERT (renameatu (dfd, BASE "17", dfd, BASE "sub1", 0) == -1);
+  ASSERT (errno == EISDIR);
+  errno = 0;
+  ASSERT (renameatu (dfd, BASE "nosuch", dfd, BASE "18", 0) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (renameatu (dfd, "", dfd, BASE "17", 0) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (renameatu (dfd, BASE "17", dfd, "", 0) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "17", 0) == -1);
+  ASSERT (errno == ENOTDIR);
+  errno = 0;
+  ASSERT (renameatu (dfd, BASE "17/", dfd, BASE "18", 0) == -1);
+  ASSERT (errno == ENOTDIR);
+  errno = 0;
+  ASSERT (renameatu (dfd, BASE "17", dfd, BASE "18/", 0) == -1);
+  ASSERT (errno == ENOTDIR || errno == ENOENT);
+
+  /* Finally, make sure we cannot overwrite existing files.  */
+  ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
+  errno = 0;
+  ASSERT ((renameatu (dfd, BASE "sub2/file", dfd, BASE "sub2/file",
+                      RENAME_NOREPLACE)
+           == -1)
+          && errno == EEXIST);
+  errno = 0;
+  ASSERT ((renameatu (dfd, BASE "sub2", dfd, BASE "sub2", RENAME_NOREPLACE)
+           == -1)
+          && errno == EEXIST);
+  errno = 0;
+  ASSERT ((renameatu (dfd, BASE "sub2", dfd, BASE "sub1", RENAME_NOREPLACE)
+           == -1)
+          && errno == EEXIST);
+  errno = 0;
+  ASSERT ((renameatu (dfd, BASE "sub2/file", dfd, BASE "17", RENAME_NOREPLACE)
+           == -1)
+          && errno == EEXIST);
+
+  /* Cleanup.  */
+  ASSERT (close (dfd) == 0);
+  ASSERT (unlink (BASE "sub2/file") == 0);
+  ASSERT (unlink (BASE "17") == 0);
+  ASSERT (rmdir (BASE "sub1") == 0);
+  ASSERT (rmdir (BASE "sub2") == 0);
+  free (cwd);
+
+  if (result)
+    fputs ("skipping test: symlinks not supported on this file system\n",
+           stderr);
+  return result;
+}
deleted file mode 120000 (symlink)
index 2644a2ef59f87f5c33361bedb2655c961ac77049..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-rmdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7f18663befadb84702371a5d49e8fb25ff213484
--- /dev/null
@@ -0,0 +1,46 @@
+/* Tests of rmdir.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (rmdir, int, (char const *));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-rmdir.t"
+
+#include "test-rmdir.h"
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_rmdir_func (rmdir, true);
+}
deleted file mode 120000 (symlink)
index d0dde8cd9e2d9d43ca59098d7d7479d0bd2e8a93..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-rmdir.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..09e3600d133b1578cc8e620740f38d29e4fcfa34
--- /dev/null
@@ -0,0 +1,102 @@
+/* Tests of rmdir.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+/* This file is designed to test both rmdir(n) and
+   unlinkat(AT_FDCWD,n,AT_REMOVEDIR).  FUNC is the function to test.
+   Assumes that BASE and ASSERT are already defined, and that
+   appropriate headers are already included.  If PRINT, then warn
+   before returning status 77 when symlinks are unsupported.  */
+
+static int
+test_rmdir_func (int (*func) (char const *name), bool print)
+{
+  /* Setup.  */
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  ASSERT (close (creat (BASE "dir/file", 0600)) == 0);
+
+  /* Basic error conditions.  */
+  errno = 0;
+  ASSERT (func ("") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "nosuch") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "nosuch/") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (".") == -1);
+  ASSERT (errno == EINVAL || errno == EBUSY);
+  /* Resulting errno after ".." or "/" is too varied to test; it is
+     reasonable to see any of EINVAL, EBUSY, EEXIST, ENOTEMPTY,
+     EACCES, EPERM.  */
+  ASSERT (func ("..") == -1);
+  ASSERT (func ("/") == -1);
+  ASSERT (func ("///") == -1);
+  errno = 0;
+  ASSERT (func (BASE "dir/file/") == -1);
+  ASSERT (errno == ENOTDIR);
+
+  /* Non-empty directory.  */
+  errno = 0;
+  ASSERT (func (BASE "dir") == -1);
+  ASSERT (errno == EEXIST || errno == ENOTEMPTY);
+
+  /* Non-directory.  */
+  errno = 0;
+  ASSERT (func (BASE "dir/file") == -1);
+  ASSERT (errno == ENOTDIR);
+
+  /* Empty directory.  */
+  ASSERT (unlink (BASE "dir/file") == 0);
+  errno = 0;
+  ASSERT (func (BASE "dir/.//") == -1);
+  ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
+          || errno == ENOTEMPTY);
+  ASSERT (func (BASE "dir") == 0);
+
+  /* Test symlink behavior.  Specifying trailing slash should remove
+     referent directory (POSIX), or cause ENOTDIR failure (Linux), but
+     not touch symlink.  We prefer the Linux behavior for its
+     intuitiveness (especially compared to rmdir("symlink-to-file/")),
+     but not enough to penalize POSIX systems with an rpl_rmdir.  */
+  if (symlink (BASE "dir", BASE "link") != 0)
+    {
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  errno = 0;
+  if (func (BASE "link/") == 0)
+    {
+      struct stat st;
+      errno = 0;
+      ASSERT (stat (BASE "link", &st) == -1);
+      ASSERT (errno == ENOENT);
+    }
+  else
+    {
+      ASSERT (errno == ENOTDIR);
+      ASSERT (func (BASE "dir") == 0);
+    }
+  ASSERT (unlink (BASE "link") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index a49a32224edacd570e7306562571767cd1d33659..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-rwlock1.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4275382c6ef7b1b07e84a8af635c59face181408
--- /dev/null
@@ -0,0 +1,170 @@
+/* Test of glthread_rwlock_rdlock function.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Inspired by
+   https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c
+   by Intel Corporation.  */
+
+#include <config.h>
+
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
+#include "glthread/lock.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "glthread/thread.h"
+
+/* Verify that in a situation where
+     - an rwlock is taken by a reader and has a writer waiting,
+     - an additional reader requests the lock,
+     - the waiting writer and the requesting reader threads have the same
+       priority,
+   the requesting reader thread gets blocked, so that at some point the
+   waiting writer can acquire the lock.
+   Without such a guarantee, when there a N readers and each of the readers
+   spends more than 1/Nth of the time with the lock held, there is a high
+   probability that the waiting writer will not get the lock in a given finite
+   time, a phenomenon called "writer starvation".
+   Without such a guarantee, applications have a hard time avoiding writer
+   starvation.
+
+   POSIX:2008 makes this requirement only for implementations that support TPS
+   (Thread Priority Scheduling) and only for the scheduling policies SCHED_FIFO
+   and SCHED_RR, see
+   https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html
+   but test verifies the guarantee regardless of TPS and regardless of
+   scheduling policy.  */
+
+#define SUCCEED() exit (0)
+#define FAILURE() exit (1)
+#define UNEXPECTED(n) (fprintf (stderr, "Unexpected outcome %d\n", n), abort ())
+
+/* The main thread creates the waiting writer and the requesting reader threads
+   in the default way; this guarantees that they have the same priority.
+   We can reuse the main thread as first reader thread.  */
+
+static gl_rwlock_t lock;
+static gl_thread_t reader1;
+static gl_thread_t writer;
+static gl_thread_t reader2;
+static gl_thread_t timer;
+/* Used to pass control from writer to reader2 and from reader2 to timer,
+   as in a relay race.
+   Passing control from one running thread to another running thread
+   is most likely faster than to create the second thread.  */
+static gl_lock_t baton;
+
+static void *
+timer_func (_GL_UNUSED void *ignored)
+{
+  /* Step 13 (can be before or after step 12):
+     The timer thread takes the baton, then waits a moment to make sure
+     it can tell whether the second reader thread is blocked at step 12.  */
+  if (glthread_lock_lock (&baton))
+    UNEXPECTED (13);
+  usleep (100000);
+  /* By the time we get here, it's clear that the second reader thread is
+     blocked at step 12.  This is the desired behaviour.  */
+  SUCCEED ();
+}
+
+static void *
+reader2_func (_GL_UNUSED void *ignored)
+{
+  int err;
+
+  /* Step 8 (can be before or after step 7):
+     The second reader thread takes the baton, then waits a moment to make sure
+     the writer thread has reached step 7.  */
+  if (glthread_lock_lock (&baton))
+    UNEXPECTED (8);
+  usleep (100000);
+  /* Step 9 omitted.  */
+  /* Step 10: Launch a timer, to test whether the next call blocks.  */
+  if (glthread_create (&timer, timer_func, NULL))
+    UNEXPECTED (10);
+  /* Step 11: Release the baton.  */
+  if (glthread_lock_unlock (&baton))
+    UNEXPECTED (11);
+  /* Step 12: The second reader thread requests the lock.  */
+  err = glthread_rwlock_rdlock (&lock);
+  if (err == 0)
+    FAILURE ();
+  else
+    UNEXPECTED (12);
+}
+
+static void *
+writer_func (_GL_UNUSED void *ignored)
+{
+  /* Step 4: Take the baton, so that the second reader thread does not go ahead
+     too early.  */
+  if (glthread_lock_lock (&baton))
+    UNEXPECTED (4);
+  /* Step 5: Create the second reader thread.  */
+  if (glthread_create (&reader2, reader2_func, NULL))
+    UNEXPECTED (5);
+  /* Step 6: Release the baton.  */
+  if (glthread_lock_unlock (&baton))
+    UNEXPECTED (6);
+  /* Step 7: The writer thread requests the lock.  */
+  if (glthread_rwlock_wrlock (&lock))
+    UNEXPECTED (7);
+  return NULL;
+}
+
+int
+main ()
+{
+  reader1 = gl_thread_self ();
+
+  /* Step 1: The main thread initializes the lock and the baton.  */
+  if (glthread_rwlock_init (&lock))
+    UNEXPECTED (1);
+  if (glthread_lock_init (&baton))
+    UNEXPECTED (1);
+  /* Step 2: The main thread acquires the lock as a reader.  */
+  if (glthread_rwlock_rdlock (&lock))
+    UNEXPECTED (2);
+  /* Step 3: Create the writer thread.  */
+  if (glthread_create (&writer, writer_func, NULL))
+    UNEXPECTED (3);
+  /* Job done.  Go to sleep.  */
+  for (;;)
+    {
+      sleep (1);
+    }
+}
+
+#else
+
+/* No multithreading available.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 6d215960b7d135802b85c506810c8ef722d8df2f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sameacls.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ea1634677f8fcee3b67710e378b4e33016c285c0
--- /dev/null
@@ -0,0 +1,714 @@
+/* Test whether two files have the same ACLs.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if HAVE_ACL_GET_FILE || HAVE_FACL || HAVE_GETACL || HAVE_ACLX_GET || HAVE_STATACL || HAVE_ACLSORT
+# include <sys/types.h>
+# include <sys/acl.h>
+#endif
+#if HAVE_ACLV_H
+# include <sys/types.h>
+# include <aclv.h>
+#endif
+
+#include "read-file.h"
+#include "xalloc.h"
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  const char *file1;
+  const char *file2;
+
+  ASSERT (argc == 3);
+
+  file1 = argv[1];
+  file2 = argv[2];
+
+  /* Compare the contents of the two files.  */
+  {
+    size_t size1;
+    char *contents1;
+    size_t size2;
+    char *contents2;
+
+    contents1 = read_file (file1, 0, &size1);
+    if (contents1 == NULL)
+      {
+        fprintf (stderr, "error reading file %s: errno = %d\n", file1, errno);
+        fflush (stderr);
+        abort ();
+      }
+    contents2 = read_file (file2, 0, &size2);
+    if (contents2 == NULL)
+      {
+        fprintf (stderr, "error reading file %s: errno = %d\n", file2, errno);
+        fflush (stderr);
+        abort ();
+      }
+
+    if (size2 != size1)
+      {
+        fprintf (stderr, "files %s and %s have different sizes\n",
+                 file1, file2);
+        fflush (stderr);
+        abort ();
+      }
+    if (memcmp (contents1, contents2, size1) != 0)
+      {
+        fprintf (stderr, "files %s and %s have different contents\n",
+                 file1, file2);
+        fflush (stderr);
+        abort ();
+      }
+
+    free (contents2);
+    free (contents1);
+  }
+
+  /* Compare the access permissions of the two files, including ACLs.  */
+  {
+    struct stat statbuf1;
+    struct stat statbuf2;
+
+    if (stat (file1, &statbuf1) < 0)
+      {
+        fprintf (stderr, "error accessing file %s: errno = %d\n", file1, errno);
+        fflush (stderr);
+        abort ();
+      }
+    if (stat (file2, &statbuf2) < 0)
+      {
+        fprintf (stderr, "error accessing file %s: errno = %d\n", file2, errno);
+        fflush (stderr);
+        abort ();
+      }
+    if (statbuf1.st_mode != statbuf2.st_mode)
+      {
+        fprintf (stderr, "files %s and %s have different access modes: %03o and %03o\n",
+                 file1, file2,
+                (unsigned int) statbuf1.st_mode, (unsigned int) statbuf2.st_mode);
+        return 1;
+      }
+  }
+  {
+#if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
+    static const int types[] =
+      {
+        ACL_TYPE_ACCESS
+# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
+        , ACL_TYPE_EXTENDED
+# endif
+      };
+    int t;
+
+    for (t = 0; t < sizeof (types) / sizeof (types[0]); t++)
+      {
+        int type = types[t];
+        acl_t acl1;
+        char *text1;
+        int errno1;
+        acl_t acl2;
+        char *text2;
+        int errno2;
+
+        acl1 = acl_get_file (file1, type);
+        if (acl1 == (acl_t)NULL)
+          {
+            text1 = NULL;
+            errno1 = errno;
+          }
+        else
+          {
+            text1 = acl_to_text (acl1, NULL);
+            if (text1 == NULL)
+              errno1 = errno;
+            else
+              errno1 = 0;
+          }
+        acl2 = acl_get_file (file2, type);
+        if (acl2 == (acl_t)NULL)
+          {
+            text2 = NULL;
+            errno2 = errno;
+          }
+        else
+          {
+            text2 = acl_to_text (acl2, NULL);
+            if (text2 == NULL)
+              errno2 = errno;
+            else
+              errno2 = 0;
+          }
+
+        if (acl1 != (acl_t)NULL)
+          {
+            if (acl2 != (acl_t)NULL)
+              {
+                if (text1 != NULL)
+                  {
+                    if (text2 != NULL)
+                      {
+                        if (strcmp (text1, text2) != 0)
+                          {
+                            fprintf (stderr, "files %s and %s have different ACLs:\n%s\n%s\n",
+                                     file1, file2, text1, text2);
+                            return 1;
+                          }
+                      }
+                    else
+                      {
+                        fprintf (stderr, "file %s has a valid ACL, but file %s has an invalid ACL\n",
+                                 file1, file2);
+                        return 1;
+                      }
+                  }
+                else
+                  {
+                    if (text2 != NULL)
+                      {
+                        fprintf (stderr, "file %s has an invalid ACL, but file %s has a valid ACL\n",
+                                 file1, file2);
+                        return 1;
+                      }
+                    else
+                      {
+                        if (errno1 != errno2)
+                          {
+                            fprintf (stderr, "files %s and %s have differently invalid ACLs, errno = %d vs. %d\n",
+                                     file1, file2, errno1, errno2);
+                            return 1;
+                          }
+                      }
+                  }
+              }
+            else
+              {
+                fprintf (stderr, "file %s has an ACL, but file %s has no ACL\n",
+                         file1, file2);
+                return 1;
+              }
+          }
+        else
+          {
+            if (acl2 != (acl_t)NULL)
+              {
+                fprintf (stderr, "file %s has no ACL, but file %s has an ACL\n",
+                         file1, file2);
+                return 1;
+              }
+          }
+        acl_free (text2);
+        if (acl2 != (acl_t)NULL)
+          acl_free (acl2);
+        acl_free (text1);
+        if (acl1 != (acl_t)NULL)
+          acl_free (acl1);
+      }
+#elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
+  int count1;
+  int count2;
+
+  count1 = acl (file1, GETACLCNT, 0, NULL);
+  if (count1 < 0 && errno == ENOSYS) /* Can happen on Solaris 10 with ZFS */
+    count1 = 0;
+  count2 = acl (file2, GETACLCNT, 0, NULL);
+  if (count2 < 0 && errno == ENOSYS) /* Can happen on Solaris 10 with ZFS */
+    count2 = 0;
+
+  if (count1 < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
+      fflush (stderr);
+      abort ();
+    }
+  if (count2 < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
+      fflush (stderr);
+      abort ();
+    }
+  if (count1 != count2)
+    {
+      fprintf (stderr, "files %s and %s have different number of ACLs: %d and %d\n",
+               file1, file2, count1, count2);
+      return 1;
+    }
+  else
+    {
+      aclent_t *entries1 = XNMALLOC (count1, aclent_t);
+      aclent_t *entries2 = XNMALLOC (count2, aclent_t);
+      int i;
+
+      if (count1 > 0 && acl (file1, GETACL, count1, entries1) < count1)
+        {
+          fprintf (stderr, "error retrieving the ACLs of file %s\n", file1);
+          fflush (stderr);
+          abort ();
+        }
+      if (count2 > 0 && acl (file2, GETACL, count2, entries2) < count1)
+        {
+          fprintf (stderr, "error retrieving the ACLs of file %s\n", file2);
+          fflush (stderr);
+          abort ();
+        }
+      for (i = 0; i < count1; i++)
+        {
+          if (entries1[i].a_type != entries2[i].a_type)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different types %d and %d\n",
+                       file1, file2, i, entries1[i].a_type, entries2[i].a_type);
+              return 1;
+            }
+          if (entries1[i].a_id != entries2[i].a_id)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different ids %d and %d\n",
+                       file1, file2, i, (int)entries1[i].a_id, (int)entries2[i].a_id);
+              return 1;
+            }
+          if (entries1[i].a_perm != entries2[i].a_perm)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different permissions %03o and %03o\n",
+                       file1, file2, i, (unsigned int) entries1[i].a_perm, (unsigned int) entries2[i].a_perm);
+              return 1;
+            }
+        }
+      free (entries2);
+      free (entries1);
+    }
+# ifdef ACE_GETACL
+  count1 = acl (file1, ACE_GETACLCNT, 0, NULL);
+  if (count1 < 0 && errno == EINVAL)
+    count1 = 0;
+  count2 = acl (file2, ACE_GETACLCNT, 0, NULL);
+  if (count2 < 0 && errno == EINVAL)
+    count2 = 0;
+  if (count1 < 0)
+    {
+      fprintf (stderr, "error accessing the ACE-ACLs of file %s\n", file1);
+      fflush (stderr);
+      abort ();
+    }
+  if (count2 < 0)
+    {
+      fprintf (stderr, "error accessing the ACE-ACLs of file %s\n", file2);
+      fflush (stderr);
+      abort ();
+    }
+  {
+    ace_t *entries1 = XNMALLOC (count1, ace_t);
+    ace_t *entries2 = XNMALLOC (count2, ace_t);
+    int ret;
+    int i;
+
+    ret = acl (file1, ACE_GETACL, count1, entries1);
+    if (ret < 0 && errno == EINVAL)
+      count1 = 0;
+    else if (ret < count1)
+      {
+        fprintf (stderr, "error retrieving the ACE-ACLs of file %s\n", file1);
+        fflush (stderr);
+        abort ();
+      }
+    ret = acl (file2, ACE_GETACL, count2, entries2);
+    if (ret < 0 && errno == EINVAL)
+      count2 = 0;
+    else if (ret < count2)
+      {
+        fprintf (stderr, "error retrieving the ACE-ACLs of file %s\n", file2);
+        fflush (stderr);
+        abort ();
+      }
+
+    if (count1 != count2)
+      {
+        fprintf (stderr, "files %s and %s have different number of ACE-ACLs: %d and %d\n",
+                 file1, file2, count1, count2);
+        return 1;
+      }
+
+    for (i = 0; i < count1; i++)
+      {
+        if (entries1[i].a_type != entries2[i].a_type)
+          {
+            fprintf (stderr, "files %s and %s: different ACE-ACL entry #%d: different types %d and %d\n",
+                     file1, file2, i, entries1[i].a_type, entries2[i].a_type);
+            return 1;
+          }
+        if (entries1[i].a_who != entries2[i].a_who)
+          {
+            fprintf (stderr, "files %s and %s: different ACE-ACL entry #%d: different ids %d and %d\n",
+                     file1, file2, i, (int)entries1[i].a_who, (int)entries2[i].a_who);
+            return 1;
+          }
+        if (entries1[i].a_access_mask != entries2[i].a_access_mask)
+          {
+            fprintf (stderr, "files %s and %s: different ACE-ACL entry #%d: different access masks %03o and %03o\n",
+                     file1, file2, i, (unsigned int) entries1[i].a_access_mask, (unsigned int) entries2[i].a_access_mask);
+            return 1;
+          }
+        if (entries1[i].a_flags != entries2[i].a_flags)
+          {
+            fprintf (stderr, "files %s and %s: different ACE-ACL entry #%d: different flags 0x%x and 0x%x\n",
+                     file1, file2, i, (unsigned int) entries1[i].a_flags, (unsigned int) entries2[i].a_flags);
+            return 1;
+          }
+      }
+    free (entries2);
+    free (entries1);
+  }
+# endif
+#elif HAVE_GETACL /* HP-UX */
+  int count1;
+  int count2;
+
+  count1 = getacl (file1, 0, NULL);
+  if (count1 < 0
+      && (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP))
+    count1 = 0;
+  count2 = getacl (file2, 0, NULL);
+  if (count2 < 0
+      && (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP))
+    count2 = 0;
+
+  if (count1 < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
+      fflush (stderr);
+      abort ();
+    }
+  if (count2 < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
+      fflush (stderr);
+      abort ();
+    }
+  if (count1 != count2)
+    {
+      fprintf (stderr, "files %s and %s have different number of ACLs: %d and %d\n",
+               file1, file2, count1, count2);
+      return 1;
+    }
+  else if (count1 > 0)
+    {
+      struct acl_entry *entries1 = XNMALLOC (count1, struct acl_entry);
+      struct acl_entry *entries2 = XNMALLOC (count2, struct acl_entry);
+      int i;
+
+      if (getacl (file1, count1, entries1) < count1)
+        {
+          fprintf (stderr, "error retrieving the ACLs of file %s\n", file1);
+          fflush (stderr);
+          abort ();
+        }
+      if (getacl (file2, count2, entries2) < count1)
+        {
+          fprintf (stderr, "error retrieving the ACLs of file %s\n", file2);
+          fflush (stderr);
+          abort ();
+        }
+      for (i = 0; i < count1; i++)
+        {
+          if (entries1[i].uid != entries2[i].uid)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different uids %d and %d\n",
+                       file1, file2, i, (int)entries1[i].uid, (int)entries2[i].uid);
+              return 1;
+            }
+          if (entries1[i].gid != entries2[i].gid)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different gids %d and %d\n",
+                       file1, file2, i, (int)entries1[i].gid, (int)entries2[i].gid);
+              return 1;
+            }
+          if (entries1[i].mode != entries2[i].mode)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different permissions %03o and %03o\n",
+                       file1, file2, i, (unsigned int) entries1[i].mode, (unsigned int) entries2[i].mode);
+              return 1;
+            }
+        }
+      free (entries2);
+      free (entries1);
+    }
+
+# if HAVE_ACLV_H /* HP-UX >= 11.11 */
+  {
+    struct acl dummy_entries[NACLVENTRIES];
+
+    count1 = acl ((char *) file1, ACL_CNT, NACLVENTRIES, dummy_entries);
+    if (count1 < 0
+        && (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL))
+      count1 = 0;
+    count2 = acl ((char *) file2, ACL_CNT, NACLVENTRIES, dummy_entries);
+    if (count2 < 0
+        && (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL))
+      count2 = 0;
+  }
+
+  if (count1 < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
+      fflush (stderr);
+      abort ();
+    }
+  if (count2 < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
+      fflush (stderr);
+      abort ();
+    }
+  if (count1 != count2)
+    {
+      fprintf (stderr, "files %s and %s have different number of ACLs: %d and %d\n",
+               file1, file2, count1, count2);
+      return 1;
+    }
+  else if (count1 > 0)
+    {
+      struct acl *entries1 = XNMALLOC (count1, struct acl);
+      struct acl *entries2 = XNMALLOC (count2, struct acl);
+      int i;
+
+      if (acl ((char *) file1, ACL_GET, count1, entries1) < count1)
+        {
+          fprintf (stderr, "error retrieving the ACLs of file %s\n", file1);
+          fflush (stderr);
+          abort ();
+        }
+      if (acl ((char *) file2, ACL_GET, count2, entries2) < count1)
+        {
+          fprintf (stderr, "error retrieving the ACLs of file %s\n", file2);
+          fflush (stderr);
+          abort ();
+        }
+      for (i = 0; i < count1; i++)
+        {
+          if (entries1[i].a_type != entries2[i].a_type)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different types %d and %d\n",
+                       file1, file2, i, entries1[i].a_type, entries2[i].a_type);
+              return 1;
+            }
+          if (entries1[i].a_id != entries2[i].a_id)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different ids %d and %d\n",
+                       file1, file2, i, (int)entries1[i].a_id, (int)entries2[i].a_id);
+              return 1;
+            }
+          if (entries1[i].a_perm != entries2[i].a_perm)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different permissions %03o and %03o\n",
+                       file1, file2, i, (unsigned int) entries1[i].a_perm, (unsigned int) entries2[i].a_perm);
+              return 1;
+            }
+        }
+      free (entries2);
+      free (entries1);
+    }
+# endif
+#elif HAVE_ACLX_GET /* AIX */
+  acl_type_t type1;
+  char acl1[1000];
+  size_t aclsize1 = sizeof (acl1);
+  mode_t mode1;
+  char text1[1000];
+  size_t textsize1 = sizeof (text1);
+  acl_type_t type2;
+  char acl2[1000];
+  size_t aclsize2 = sizeof (acl2);
+  mode_t mode2;
+  char text2[1000];
+  size_t textsize2 = sizeof (text2);
+
+  /* The docs say that type1 being 0 is equivalent to ACL_ANY, but it is not
+     true, in AIX 5.3.  */
+  type1.u64 = ACL_ANY;
+  if (aclx_get (file1, 0, &type1, acl1, &aclsize1, &mode1) < 0)
+    {
+      if (errno == ENOSYS)
+        text1[0] = '\0';
+      else
+        {
+          fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
+          fflush (stderr);
+          abort ();
+        }
+    }
+  else
+    if (aclx_printStr (text1, &textsize1, acl1, aclsize1, type1, file1, 0) < 0)
+      {
+        fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file1);
+        fflush (stderr);
+        abort ();
+      }
+
+  /* The docs say that type2 being 0 is equivalent to ACL_ANY, but it is not
+     true, in AIX 5.3.  */
+  type2.u64 = ACL_ANY;
+  if (aclx_get (file2, 0, &type2, acl2, &aclsize2, &mode2) < 0)
+    {
+      if (errno == ENOSYS)
+        text2[0] = '\0';
+      else
+        {
+          fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
+          fflush (stderr);
+          abort ();
+        }
+    }
+  else
+    if (aclx_printStr (text2, &textsize2, acl2, aclsize2, type2, file2, 0) < 0)
+      {
+        fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file2);
+        fflush (stderr);
+        abort ();
+      }
+
+  if (strcmp (text1, text2) != 0)
+    {
+      fprintf (stderr, "files %s and %s have different ACLs:\n%s\n%s\n",
+               file1, file2, text1, text2);
+      return 1;
+    }
+#elif HAVE_STATACL /* older AIX */
+  union { struct acl a; char room[4096]; } acl1;
+  union { struct acl a; char room[4096]; } acl2;
+  unsigned int i;
+
+  if (statacl (file1, STX_NORMAL, &acl1.a, sizeof (acl1)) < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
+      fflush (stderr);
+      abort ();
+    }
+  if (statacl (file2, STX_NORMAL, &acl2.a, sizeof (acl2)) < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
+      fflush (stderr);
+      abort ();
+    }
+
+  if (acl1.a.acl_len != acl2.a.acl_len)
+    {
+      fprintf (stderr, "files %s and %s have different ACL lengths: %u and %u\n",
+               file1, file2, acl1.a.acl_len, acl2.a.acl_len);
+      return 1;
+    }
+  if (acl1.a.acl_mode != acl2.a.acl_mode)
+    {
+      fprintf (stderr, "files %s and %s have different ACL modes: %03o and %03o\n",
+               file1, file2, acl1.a.acl_mode, acl2.a.acl_mode);
+      return 1;
+    }
+  if (acl1.a.u_access != acl2.a.u_access
+      || acl1.a.g_access != acl2.a.g_access
+      || acl1.a.o_access != acl2.a.o_access)
+    {
+      fprintf (stderr, "files %s and %s have different ACL access masks: %03o %03o %03o and %03o %03o %03o\n",
+               file1, file2,
+               acl1.a.u_access, acl1.a.g_access, acl1.a.o_access,
+               acl2.a.u_access, acl2.a.g_access, acl2.a.o_access);
+      return 1;
+    }
+  if (memcmp (acl1.a.acl_ext, acl2.a.acl_ext, acl1.a.acl_len) != 0)
+    {
+      fprintf (stderr, "files %s and %s have different ACL entries\n",
+               file1, file2);
+      return 1;
+    }
+#elif HAVE_ACLSORT /* NonStop Kernel */
+  int count1;
+  int count2;
+
+  count1 = acl ((char *) file1, ACL_CNT, NACLENTRIES, NULL);
+  count2 = acl ((char *) file2, ACL_CNT, NACLENTRIES, NULL);
+
+  if (count1 < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
+      fflush (stderr);
+      abort ();
+    }
+  if (count2 < 0)
+    {
+      fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
+      fflush (stderr);
+      abort ();
+    }
+  if (count1 != count2)
+    {
+      fprintf (stderr, "files %s and %s have different number of ACLs: %d and %d\n",
+               file1, file2, count1, count2);
+      return 1;
+    }
+  else if (count1 > 0)
+    {
+      struct acl *entries1 = XNMALLOC (count1, struct acl);
+      struct acl *entries2 = XNMALLOC (count2, struct acl);
+      int i;
+
+      if (acl ((char *) file1, ACL_GET, count1, entries1) < count1)
+        {
+          fprintf (stderr, "error retrieving the ACLs of file %s\n", file1);
+          fflush (stderr);
+          abort ();
+        }
+      if (acl ((char *) file2, ACL_GET, count2, entries2) < count1)
+        {
+          fprintf (stderr, "error retrieving the ACLs of file %s\n", file2);
+          fflush (stderr);
+          abort ();
+        }
+      for (i = 0; i < count1; i++)
+        {
+          if (entries1[i].a_type != entries2[i].a_type)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different types %d and %d\n",
+                       file1, file2, i, entries1[i].a_type, entries2[i].a_type);
+              return 1;
+            }
+          if (entries1[i].a_id != entries2[i].a_id)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different ids %d and %d\n",
+                       file1, file2, i, (int)entries1[i].a_id, (int)entries2[i].a_id);
+              return 1;
+            }
+          if (entries1[i].a_perm != entries2[i].a_perm)
+            {
+              fprintf (stderr, "files %s and %s: different ACL entry #%d: different permissions %03o and %03o\n",
+                       file1, file2, i, (unsigned int) entries1[i].a_perm, (unsigned int) entries2[i].a_perm);
+              return 1;
+            }
+        }
+      free (entries2);
+      free (entries1);
+    }
+#endif
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 1a9604e04e396b7a6c48a9e72d0682ccafc8d31e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sched.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..afefc7d5a7dbf4d84cd06d3ed672a8069b07753f
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of <sched.h> substitute.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <sched.h>
+
+/* Check that 'struct sched_param' is defined.  */
+static struct sched_param a;
+
+/* Check that the SCHED_* macros are defined and compile-time constants.  */
+int b[] = { SCHED_FIFO, SCHED_RR, SCHED_OTHER };
+
+/* Check that the types are all defined.  */
+pid_t t1;
+
+int f1;
+
+int
+main ()
+{
+  /* Check fields of 'struct sched_param'.  */
+  f1 = a.sched_priority;
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index d7067418638e43e25a163244d10e4d868b918732..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-scratch-buffer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..35a5adce0dd61fed6991de5fc5e894b07c48b264
--- /dev/null
@@ -0,0 +1,130 @@
+/* Test of scratch_buffer functions.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2018.  */
+
+#include <config.h>
+
+#include <scratch_buffer.h>
+
+#include <string.h>
+#include "macros.h"
+
+static int
+byte_at (unsigned long long int i)
+{
+  return ((i % 13) + ((i * i) % 251)) & 0xff;
+}
+
+int
+main ()
+{
+  /* Check scratch_buffer_set_array_size.  */
+  {
+    size_t sizes[] = { 100, 1000, 10000, 100000 };
+    size_t s;
+    for (s = 0; s < SIZEOF (sizes); s++)
+      {
+        size_t size = sizes[s];
+        struct scratch_buffer buf;
+        bool ok;
+        size_t i;
+
+        scratch_buffer_init (&buf);
+
+        ok = scratch_buffer_set_array_size (&buf, size, 1);
+        ASSERT (ok);
+
+        for (i = 0; i < size; i++)
+          ((unsigned char *) buf.data)[i] = byte_at (i);
+
+        memset (buf.data, 'x', buf.length);
+        memset (buf.data, 'y', size);
+
+        scratch_buffer_free (&buf);
+      }
+  }
+
+  /* Check scratch_buffer_grow.  */
+  {
+    size_t sizes[] = { 100, 1000, 10000, 100000 };
+    size_t s;
+    for (s = 0; s < SIZEOF (sizes); s++)
+      {
+        size_t size = sizes[s];
+        struct scratch_buffer buf;
+        bool ok;
+        size_t i;
+
+        scratch_buffer_init (&buf);
+
+        while (buf.length < size)
+          {
+            ok = scratch_buffer_grow (&buf);
+            ASSERT (ok);
+          }
+
+        for (i = 0; i < size; i++)
+          ((unsigned char *) buf.data)[i] = byte_at (i);
+
+        memset (buf.data, 'x', buf.length);
+        memset (buf.data, 'y', size);
+
+        scratch_buffer_free (&buf);
+      }
+  }
+
+  /* Check scratch_buffer_grow_preserve.  */
+  {
+    size_t sizes[] = { 100, 1000, 10000, 100000 };
+    struct scratch_buffer buf;
+    size_t s;
+    size_t size;
+    bool ok;
+    size_t i;
+
+    scratch_buffer_init (&buf);
+
+    s = 0;
+    size = sizes[s];
+    ok = scratch_buffer_set_array_size (&buf, size, 1);
+    ASSERT (ok);
+
+    for (i = 0; i < size; i++)
+      ((unsigned char *) buf.data)[i] = byte_at (i);
+
+    for (; s < SIZEOF (sizes); s++)
+      {
+        size_t oldsize = size;
+        size = sizes[s];
+
+        while (buf.length < size)
+          {
+            ok = scratch_buffer_grow_preserve (&buf);
+            ASSERT (ok);
+          }
+
+        for (i = 0; i < oldsize; i++)
+          ASSERT(((unsigned char *) buf.data)[i] == byte_at (i));
+        for (i = oldsize; i < size; i++)
+          ((unsigned char *) buf.data)[i] = byte_at (i);
+      }
+
+    scratch_buffer_free (&buf);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index a057b73290271835ec088993cf9a159e98f5264a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-select-fd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b94addd5028ed145f72efdbd6b11a9fb53746cea
--- /dev/null
@@ -0,0 +1,72 @@
+/* Test of select() substitute, reading or writing from a given file descriptor.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/select.h>
+
+int
+main (int argc, char *argv[])
+{
+  if (argc == 4)
+    {
+      char mode = argv[1][0];
+
+      if (mode == 'r' || mode == 'w')
+        {
+          int fd = atoi (argv[2]);
+
+          if (fd >= 0)
+            {
+              const char *result_file_name = argv[3];
+              FILE *result_file = fopen (result_file_name, "wb");
+
+              if (result_file != NULL)
+                {
+                  fd_set fds;
+                  struct timeval timeout;
+                  int ret;
+
+                  FD_ZERO (&fds);
+                  FD_SET (fd, &fds);
+                  timeout.tv_sec = 0;
+                  timeout.tv_usec = 10000;
+                  ret = (mode == 'r'
+                         ? select (fd + 1, &fds, NULL, NULL, &timeout)
+                         : select (fd + 1, NULL, &fds, NULL, &timeout));
+                  if (ret < 0)
+                    {
+                      perror ("select failed");
+                      exit (1);
+                    }
+                  if ((ret == 0) != ! FD_ISSET (fd, &fds))
+                    {
+                      fprintf (stderr, "incorrect return value\n");
+                      exit (1);
+                    }
+                  fprintf (result_file, "%d\n", ret);
+                  exit (0);
+                }
+            }
+        }
+    }
+  fprintf (stderr, "Usage: test-select-fd mode fd result-file-name\n");
+  exit (1);
+}
deleted file mode 120000 (symlink)
index 2455e51d89f4a5c8da6366daf328f66aa8ec3146..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-select-in.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..ad86ea252606a806314bf580ac5bc28d3163643c
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Test select() on file descriptors opened for reading.
+
+# This test is known to fail on Solaris 2.6 and older, due to its handling
+# of /dev/null.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-select-in.tmp"
+
+# Regular files.
+
+rm -f t-select-in.tmp
+${CHECKER} ./test-select-fd${EXEEXT} r 0 t-select-in.tmp < ./test-select-fd${EXEEXT}
+test `cat t-select-in.tmp` = "1" || exit 1
+
+# Pipes.
+
+rm -f t-select-in.tmp
+{ sleep 1; echo abc; } | \
+  { ${CHECKER} ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; }
+test `cat t-select-in.tmp` = "0" || exit 1
+
+rm -f t-select-in.tmp
+echo abc | { sleep 1; ${CHECKER} ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; }
+test `cat t-select-in.tmp` = "1" || exit 1
+
+# Special files.
+# This part of the test is known to fail on Solaris 2.6 and older.
+
+rm -f t-select-in.tmp
+${CHECKER} ./test-select-fd${EXEEXT} r 0 t-select-in.tmp < /dev/null
+test `cat t-select-in.tmp` = "1" || exit 1
+
+rm -fr $tmpfiles
+
+exit 0
deleted file mode 120000 (symlink)
index a26f4bf9e81b322eae88cad896d74948e5a6edb6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-select-out.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..cfa5e179578ae1405bdf3bee2ce0591f1f1b0b0b
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Test select() on file descriptors opened for writing.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp"
+
+# Regular files.
+
+rm -f t-select-out.tmp
+${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > t-select-out.out
+test `cat t-select-out.tmp` = "1" || exit 1
+
+# Pipes.
+
+if false; then # This test fails on some platforms.
+  rm -f t-select-out.tmp
+  ( { echo abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | { sleep 1; cat; } ) > /dev/null
+  test `cat t-select-out.tmp` = "0" || exit 1
+fi
+
+rm -f t-select-out.tmp
+( { sleep 1; echo abc; ${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | cat) > /dev/null
+test `cat t-select-out.tmp` = "1" || exit 1
+
+# Special files.
+
+rm -f t-select-out.tmp
+${CHECKER} ./test-select-fd${EXEEXT} w 1 t-select-out.tmp > /dev/null
+test `cat t-select-out.tmp` = "1" || exit 1
+
+rm -fr $tmpfiles
+
+exit 0
deleted file mode 120000 (symlink)
index bb54c8da76bbe1db51e55d6e69e6a6ca5d2b29d4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-select-stdin.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2f8f08aa7af1075986a99bfc693a4e9f40158c03
--- /dev/null
@@ -0,0 +1,83 @@
+/* Test of select() substitute, reading from stdin.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  printf ("Applying select() from standard input. Press Ctrl-C to abort.\n");
+  for (;;)
+    {
+      struct timeval before;
+      struct timeval after;
+      unsigned long spent_usec;
+      fd_set readfds;
+      struct timeval timeout;
+      int ret;
+
+      gettimeofday (&before, NULL);
+
+      FD_ZERO (&readfds);
+      FD_SET (0, &readfds);
+      timeout.tv_sec = 0;
+      timeout.tv_usec = 500000;
+      ret = select (1, &readfds, NULL, NULL, &timeout);
+
+      gettimeofday (&after, NULL);
+      spent_usec = (after.tv_sec - before.tv_sec) * 1000000
+                   + after.tv_usec - before.tv_usec;
+
+      if (ret < 0)
+        {
+          perror ("select failed");
+          exit (1);
+        }
+      if ((ret == 0) != ! FD_ISSET (0, &readfds))
+        {
+          fprintf (stderr, "incorrect return value\n");
+          exit (1);
+        }
+      if (ret == 0)
+        {
+          if (spent_usec < 250000)
+            {
+              fprintf (stderr, "returned too early\n");
+              exit (1);
+            }
+          /* Timeout */
+          printf (".");
+          ASSERT (fflush (stdout) == 0);
+        }
+      else
+        {
+          char c;
+
+          printf ("Input available! Trying to read 1 byte...\n");
+          ASSERT (read (0, &c, 1) == 1);
+        }
+    }
+}
deleted file mode 120000 (symlink)
index a32628965a5efc8a9a3fb0858f3f18f1fa276ddd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-select.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a75c9244b48c84ef7cdf5e6f270a8b1ae6905773
--- /dev/null
@@ -0,0 +1,35 @@
+/* Test of select() substitute.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini, 2008.  */
+
+#include <config.h>
+
+#include <sys/select.h>
+
+#include "signature.h"
+
+SIGNATURE_CHECK (select, int, (int, fd_set *, fd_set *, fd_set *,
+                               struct timeval *));
+
+#define TEST_PORT 12346
+#include "test-select.h"
+
+int
+main (void)
+{
+  return test_function (select);
+}
deleted file mode 120000 (symlink)
index a1eb2b8153edfe59b40c1c22ee8edafe467e98ff..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-select.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4896b674967a6ebf86a4916a9c4d2aa13d6b4263
--- /dev/null
@@ -0,0 +1,467 @@
+/* Test of select() substitute.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini, 2008.  */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+#include "macros.h"
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WINDOWS_NATIVE
+#endif
+
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+
+/* Tell GCC not to warn about the specific edge cases tested here.  */
+#if __GNUC__ >= 13
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
+#endif
+
+typedef int (*select_fn) (int, fd_set *, fd_set *, fd_set *, struct timeval *);
+
+
+/* Minimal testing infrastructure.  */
+
+static int failures;
+
+static void
+failed (const char *reason)
+{
+  if (++failures > 1)
+    printf ("  ");
+  printf ("failed (%s)\n", reason);
+}
+
+static int
+test (void (*fn) (select_fn), select_fn my_select, const char *msg)
+{
+  failures = 0;
+  printf ("%s... ", msg);
+  fflush (stdout);
+  fn (my_select);
+
+  if (!failures)
+    printf ("passed\n");
+
+  return failures;
+}
+
+
+/* Funny socket code.  */
+
+static int
+open_server_socket (void)
+{
+  int s, x;
+  struct sockaddr_in ia;
+
+  s = socket (AF_INET, SOCK_STREAM, 0);
+
+  x = 1;
+  setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x));
+
+  memset (&ia, 0, sizeof (ia));
+  ia.sin_family = AF_INET;
+  inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr);
+  ia.sin_port = htons (TEST_PORT);
+  if (bind (s, (struct sockaddr *) &ia, sizeof (ia)) < 0)
+    {
+      perror ("bind");
+      exit (77);
+    }
+
+  if (listen (s, 1) < 0)
+    {
+      perror ("listen");
+      exit (77);
+    }
+
+  return s;
+}
+
+static int
+connect_to_socket (bool blocking)
+{
+  int s;
+  struct sockaddr_in ia;
+
+  s = socket (AF_INET, SOCK_STREAM, 0);
+
+  memset (&ia, 0, sizeof (ia));
+  ia.sin_family = AF_INET;
+  inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr);
+  ia.sin_port = htons (TEST_PORT);
+
+  if (!blocking)
+    {
+#ifdef WINDOWS_NATIVE
+      unsigned long iMode = 1;
+      ioctl (s, FIONBIO, (char *) &iMode);
+
+#elif defined F_GETFL
+      int oldflags = fcntl (s, F_GETFL, NULL);
+
+      if (!(oldflags & O_NONBLOCK))
+        fcntl (s, F_SETFL, oldflags | O_NONBLOCK);
+#endif
+    }
+
+  if (connect (s, (struct sockaddr *) &ia, sizeof (ia)) < 0
+      && (blocking || errno != EINPROGRESS))
+    {
+      perror ("connect");
+      exit (77);
+    }
+
+  return s;
+}
+
+
+/* A slightly more convenient interface to select(2).
+   Waits until a specific event occurs on a file descriptor FD.
+   EV is a bit mask of events to look for:
+     SEL_IN - input can be polled without blocking,
+     SEL_OUT - output can be provided without blocking,
+     SEL_EXC - an exception occurred,
+   A maximum wait time is specified by TIMEOUT.
+   *TIMEOUT = { 0, 0 } means to return immediately,
+   TIMEOUT = NULL means to wait indefinitely.  */
+
+enum { SEL_IN = 1, SEL_OUT = 2, SEL_EXC = 4 };
+
+static int
+do_select (int fd, int ev, struct timeval *timeout, select_fn my_select)
+{
+  fd_set rfds, wfds, xfds;
+  int r, rev;
+
+  FD_ZERO (&rfds);
+  FD_ZERO (&wfds);
+  FD_ZERO (&xfds);
+  if (ev & SEL_IN)
+    FD_SET (fd, &rfds);
+  if (ev & SEL_OUT)
+    FD_SET (fd, &wfds);
+  if (ev & SEL_EXC)
+    FD_SET (fd, &xfds);
+  r = my_select (fd + 1, &rfds, &wfds, &xfds, timeout);
+  if (r < 0)
+    return r;
+
+  rev = 0;
+  if (FD_ISSET (fd, &rfds))
+    rev |= SEL_IN;
+  if (FD_ISSET (fd, &wfds))
+    rev |= SEL_OUT;
+  if (FD_ISSET (fd, &xfds))
+    rev |= SEL_EXC;
+  if (rev && r == 0)
+    failed ("select returned 0");
+  if (rev & ~ev)
+    failed ("select returned unrequested events");
+
+  return rev;
+}
+
+static int
+do_select_nowait (int fd, int ev, select_fn my_select)
+{
+  struct timeval tv0;
+  tv0.tv_sec = 0;
+  tv0.tv_usec = 0;
+  return do_select (fd, ev, &tv0, my_select);
+}
+
+static int
+do_select_wait (int fd, int ev, select_fn my_select)
+{
+  return do_select (fd, ev, NULL, my_select);
+}
+
+
+/* Test select(2) for TTYs.  */
+
+#ifdef INTERACTIVE
+static void
+test_tty (select_fn my_select)
+{
+  if (do_select_nowait (0, SEL_IN, my_select) != 0)
+    failed ("can read");
+  if (do_select_nowait (0, SEL_OUT, my_select) == 0)
+    failed ("cannot write");
+
+  if (do_select_wait (0, SEL_IN, my_select) == 0)
+    failed ("return with infinite timeout");
+
+  getchar ();
+  if (do_select_nowait (0, SEL_IN, my_select) != 0)
+    failed ("can read after getc");
+}
+#endif
+
+
+static int
+do_select_bad_nfd_nowait (int nfd, select_fn my_select)
+{
+  struct timeval tv0;
+  tv0.tv_sec = 0;
+  tv0.tv_usec = 0;
+  errno = 0;
+  return my_select (nfd, NULL, NULL, NULL, &tv0);
+}
+
+static void
+test_bad_nfd (select_fn my_select)
+{
+  if (do_select_bad_nfd_nowait (-1, my_select) != -1 || errno != EINVAL)
+    failed ("invalid errno after negative nfds");
+  /* Can't test FD_SETSIZE + 1 for EINVAL, since some systems allow
+     dynamically larger set size by redefining FD_SETSIZE anywhere up
+     to the actual maximum fd.  */
+#if 0
+  if (do_select_bad_nfd_nowait (FD_SETSIZE + 1, my_select) != -1
+      || errno != EINVAL)
+    failed ("invalid errno after bogus nfds");
+#endif
+}
+
+/* Test select(2) on invalid file descriptors.  */
+
+static int
+do_select_bad_fd (int fd, int ev, struct timeval *timeout, select_fn my_select)
+{
+  fd_set rfds, wfds, xfds;
+
+  FD_ZERO (&rfds);
+  FD_ZERO (&wfds);
+  FD_ZERO (&xfds);
+  if (ev & SEL_IN)
+    FD_SET (fd, &rfds);
+  if (ev & SEL_OUT)
+    FD_SET (fd, &wfds);
+  if (ev & SEL_EXC)
+    FD_SET (fd, &xfds);
+  errno = 0;
+  return my_select (fd + 1, &rfds, &wfds, &xfds, timeout);
+  /* In this case, when fd is invalid, on some platforms, the bit for fd
+     is left alone in the fd_set, whereas on other platforms it is cleared.
+     So, don't check the bit for fd here.  */
+}
+
+static int
+do_select_bad_fd_nowait (int fd, int ev, select_fn my_select)
+{
+  struct timeval tv0;
+  tv0.tv_sec = 0;
+  tv0.tv_usec = 0;
+  return do_select_bad_fd (fd, ev, &tv0, my_select);
+}
+
+static void
+test_bad_fd (select_fn my_select)
+{
+  /* This tests fails on OSF/1 and native Windows, even with fd = 16.  */
+#if !(defined __osf__ || defined WINDOWS_NATIVE)
+  int fd;
+
+  /* On Linux, Mac OS X, *BSD, values of fd like 99 or 399 are discarded
+     by the kernel early and therefore do *not* lead to EBADF, as required
+     by POSIX.  */
+# if defined __linux__ || (defined __APPLE__ && defined __MACH__) || (defined __FreeBSD__ || defined __DragonFly__) || defined __OpenBSD__ || defined __NetBSD__
+  fd = 14;
+# else
+  fd = 99;
+# endif
+  /* Even on the best POSIX compliant platforms, values of fd >= FD_SETSIZE
+     require an nfds argument that is > FD_SETSIZE and thus may lead to EINVAL,
+     not EBADF.  */
+  if (fd >= FD_SETSIZE)
+    fd = FD_SETSIZE - 1;
+  close (fd);
+
+  if (do_select_bad_fd_nowait (fd, SEL_IN, my_select) == 0 || errno != EBADF)
+    failed ("invalid fd among rfds");
+  if (do_select_bad_fd_nowait (fd, SEL_OUT, my_select) == 0 || errno != EBADF)
+    failed ("invalid fd among wfds");
+  if (do_select_bad_fd_nowait (fd, SEL_EXC, my_select) == 0 || errno != EBADF)
+    failed ("invalid fd among xfds");
+#endif
+}
+
+
+/* Test select(2) for unconnected nonblocking sockets.  */
+
+static void
+test_connect_first (select_fn my_select)
+{
+  int s = open_server_socket ();
+  struct sockaddr_in ia;
+  socklen_t addrlen;
+
+  int c1, c2;
+
+  if (do_select_nowait (s, SEL_IN | SEL_EXC, my_select) != 0)
+    failed ("can read, socket not connected");
+
+  c1 = connect_to_socket (false);
+
+  if (do_select_wait (s, SEL_IN | SEL_EXC, my_select) != SEL_IN)
+    failed ("expecting readability on passive socket");
+  if (do_select_nowait (s, SEL_IN | SEL_EXC, my_select) != SEL_IN)
+    failed ("expecting readability on passive socket");
+
+  addrlen = sizeof (ia);
+  c2 = accept (s, (struct sockaddr *) &ia, &addrlen);
+  ASSERT (close (s) == 0);
+  ASSERT (close (c1) == 0);
+  ASSERT (close (c2) == 0);
+}
+
+
+/* Test select(2) for unconnected blocking sockets.  */
+
+static void
+test_accept_first (select_fn my_select)
+{
+#ifndef WINDOWS_NATIVE
+  int s = open_server_socket ();
+  struct sockaddr_in ia;
+  socklen_t addrlen;
+  char buf[3];
+  int c, pid;
+
+  pid = fork ();
+  if (pid < 0)
+    return;
+
+  if (pid == 0)
+    {
+      addrlen = sizeof (ia);
+      c = accept (s, (struct sockaddr *) &ia, &addrlen);
+      ASSERT (close (s) == 0);
+      ASSERT (write (c, "foo", 3) == 3);
+      ASSERT (read (c, buf, 3) == 3);
+      shutdown (c, SHUT_RD);
+      ASSERT (close (c) == 0);
+      exit (0);
+    }
+  else
+    {
+      ASSERT (close (s) == 0);
+      c = connect_to_socket (true);
+      if (do_select_nowait (c, SEL_OUT, my_select) != SEL_OUT)
+        failed ("cannot write after blocking connect");
+      ASSERT (write (c, "foo", 3) == 3);
+      wait (&pid);
+      if (do_select_wait (c, SEL_IN, my_select) != SEL_IN)
+        failed ("cannot read data left in the socket by closed process");
+      ASSERT (read (c, buf, 3) == 3);
+      ASSERT (write (c, "foo", 3) == 3);
+      (void) close (c); /* may fail with errno = ECONNRESET */
+    }
+#endif
+}
+
+
+/* Common code for pipes and connected sockets.  */
+
+static void
+test_pair (int rd, int wd, select_fn my_select)
+{
+  char buf[3];
+  if (do_select_wait (wd, SEL_IN | SEL_OUT | SEL_EXC, my_select) != SEL_OUT)
+    failed ("expecting writability before writing");
+  if (do_select_nowait (wd, SEL_IN | SEL_OUT | SEL_EXC, my_select) != SEL_OUT)
+    failed ("expecting writability before writing");
+
+  ASSERT (write (wd, "foo", 3) == 3);
+  if (do_select_wait (rd, SEL_IN, my_select) != SEL_IN)
+    failed ("expecting readability after writing");
+  if (do_select_nowait (rd, SEL_IN, my_select) != SEL_IN)
+    failed ("expecting readability after writing");
+
+  ASSERT (read (rd, buf, 3) == 3);
+}
+
+
+/* Test select(2) on connected sockets.  */
+
+static void
+test_socket_pair (select_fn my_select)
+{
+  struct sockaddr_in ia;
+
+  socklen_t addrlen = sizeof (ia);
+  int s = open_server_socket ();
+  int c1 = connect_to_socket (false);
+  int c2 = accept (s, (struct sockaddr *) &ia, &addrlen);
+
+  ASSERT (close (s) == 0);
+
+  test_pair (c1, c2, my_select);
+  ASSERT (close (c1) == 0);
+  ASSERT (write (c2, "foo", 3) == 3);
+  (void) close (c2); /* may fail with errno = ECONNRESET */
+}
+
+
+/* Test select(2) on pipes.  */
+
+static void
+test_pipe (select_fn my_select)
+{
+  int fd[2];
+
+  ASSERT (pipe (fd) == 0);
+  test_pair (fd[0], fd[1], my_select);
+  ASSERT (close (fd[0]) == 0);
+  ASSERT (close (fd[1]) == 0);
+}
+
+
+/* Do them all.  */
+
+static int
+test_function (select_fn my_select)
+{
+  int result = 0;
+
+#ifdef INTERACTIVE
+  printf ("Please press Enter\n");
+  test (test_tty, "TTY", my_select);
+#endif
+
+  result += test (test_bad_nfd, my_select, "Invalid nfd test");
+  result += test (test_bad_fd, my_select, "Invalid fd test");
+  result += test (test_connect_first, my_select, "Unconnected socket test");
+  result += test (test_socket_pair, my_select, "Connected sockets test");
+  result += test (test_accept_first, my_select, "General socket test with fork");
+  result += test (test_pipe, my_select, "Pipe test");
+
+  return result;
+}
deleted file mode 120000 (symlink)
index 5d535216e30a28421ccbfc3bc13a36212128928d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-set-mode-acl-1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..73a4010619ecbd9161c69fe0fd58371e9ed823b1
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Test set-mode-acl on the file system of /var/tmp, which usually is a local
+# file system.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+if test -d /var/tmp; then
+  TMPDIR=/var/tmp
+else
+  TMPDIR=/tmp
+fi
+test -d $TMPDIR || Exit 77
+export TMPDIR
+
+$BOURNE_SHELL "${srcdir}/test-set-mode-acl.sh"
+
+Exit $?
deleted file mode 120000 (symlink)
index 8d73eec6d155e42ea0b3d80486ab1411882f2ca5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-set-mode-acl-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..2f7c8c02d5fcdf32dcb77b6508776db577f7702e
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Test set-mode-acl on the file system of the build directory, which may be
+# a local file system or NFS mounted.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+TMPDIR=`pwd`
+export TMPDIR
+
+$BOURNE_SHELL "${srcdir}/test-set-mode-acl.sh"
+
+Exit $?
deleted file mode 120000 (symlink)
index cbb16b05fd42d3914a947a8c8ae214e9f83d2320..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-set-mode-acl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..330f90589273443bdb2917c346f95e98ff35ad57
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of setting an ACL equivalent to a mode.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include <stdlib.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  const char *file;
+  int mode;
+
+  ASSERT (argc == 3);
+
+  file = argv[1];
+  mode = strtol (argv[2], NULL, 8);
+
+  set_acl (file, -1, mode);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 49280692a7f63303b824f09010e17b4e7df2b844..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-set-mode-acl.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..fa9771e034ebcc853fd4e50b1d9c3511b0a0142a
--- /dev/null
@@ -0,0 +1,234 @@
+#!/bin/sh
+
+# Show all commands when run with environment variable VERBOSE=yes.
+test -z "$VERBOSE" || set -x
+
+test "$USE_ACL" = 0 &&
+  {
+    echo "Skipping test: insufficient ACL support"
+    exit 77
+  }
+
+# func_tmpdir
+# creates a temporary directory.
+# Sets variable
+# - tmp             pathname of freshly created temporary directory
+func_tmpdir ()
+{
+  # Use the environment variable TMPDIR, falling back to /tmp. This allows
+  # users to specify a different temporary directory, for example, if their
+  # /tmp is filled up or too small.
+  : "${TMPDIR=/tmp}"
+  {
+    # Use the mktemp program if available. If not available, hide the error
+    # message.
+    tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
+    test -n "$tmp" && test -d "$tmp"
+  } ||
+  {
+    # Use a simple mkdir command. It is guaranteed to fail if the directory
+    # already exists.  $RANDOM is bash specific and expands to empty in shells
+    # other than bash, ksh and zsh.  Its use does not increase security;
+    # rather, it minimizes the probability of failure in a very cluttered /tmp
+    # directory.
+    tmp=$TMPDIR/gl$$-$RANDOM
+    (umask 077 && mkdir "$tmp")
+  } ||
+  {
+    echo "$0: cannot create a temporary directory in $TMPDIR" >&2
+    exit 1
+  }
+}
+
+func_tmpdir
+# builddir may already be set by the script that invokes this one.
+case "$builddir" in
+  '') builddir=`pwd` ;;
+  /* | ?:*) ;;
+  *) builddir=`pwd`/$builddir ;;
+esac
+cd "$builddir" ||
+  {
+    echo "$0: cannot determine build directory (unreadable parent dir?)" >&2
+    exit 1
+  }
+# Switch to a temporary directory, to increase the likelihood that ACLs are
+# supported on the current file system. (/tmp is usually locally mounted,
+# whereas the build dir is sometimes NFS-mounted.)
+( cd "$tmp"
+
+  # Prepare tmpfile0.
+  rm -f tmpfile[0-9]
+  echo "Simple contents" > tmpfile0
+  chmod 600 tmpfile0
+
+  # Classification of the platform according to the programs available for
+  # manipulating ACLs.
+  # Possible values are:
+  #   linux, cygwin, freebsd, solaris, hpux, hpuxjfs, osf1, aix, macosx, irix, none.
+  # TODO: Support also native Windows platforms (mingw).
+  acl_flavor=none
+  if (getfacl tmpfile0 >/dev/null) 2>/dev/null; then
+    # Platforms with the getfacl and setfacl programs.
+    # Linux, FreeBSD, Solaris, Cygwin.
+    if (setfacl --help >/dev/null) 2>/dev/null; then
+      # Linux, Cygwin.
+      if (LC_ALL=C setfacl --help | grep ' --set-file' >/dev/null) 2>/dev/null; then
+        # Linux.
+        acl_flavor=linux
+      else
+        acl_flavor=cygwin
+      fi
+    else
+      # FreeBSD, Solaris.
+      if (LC_ALL=C setfacl 2>&1 | grep '\-x entries' >/dev/null) 2>/dev/null; then
+        # FreeBSD.
+        acl_flavor=freebsd
+      else
+        # Solaris.
+        acl_flavor=solaris
+      fi
+    fi
+  else
+    if (lsacl / >/dev/null) 2>/dev/null; then
+      # Platforms with the lsacl and chacl programs.
+      # HP-UX, sometimes also IRIX.
+      if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
+        # HP-UX 11.11 or newer.
+        acl_flavor=hpuxjfs
+      else
+        # HP-UX 11.00.
+        acl_flavor=hpux
+      fi
+    else
+      if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
+        # Tru64, NonStop Kernel.
+        if (getacl -m tmpfile0 >/dev/null) 2>/dev/null; then
+          # Tru64.
+          acl_flavor=osf1
+        else
+          # NonStop Kernel.
+          acl_flavor=nsk
+        fi
+      else
+        if (aclget tmpfile0 >/dev/null) 2>/dev/null; then
+          # AIX.
+          acl_flavor=aix
+        else
+          if (fsaclctl -v >/dev/null) 2>/dev/null; then
+            # Mac OS X.
+            acl_flavor=macosx
+          else
+            if test -f /sbin/chacl; then
+              # IRIX.
+              acl_flavor=irix
+            fi
+          fi
+        fi
+      fi
+    fi
+  fi
+
+  if test $acl_flavor != none; then
+    # A POSIX compliant 'id' program.
+    if test -f /usr/xpg4/bin/id; then
+      ID=/usr/xpg4/bin/id
+    else
+      ID=id
+    fi
+    # Use a user and group id different from the current one, to avoid
+    # redundant/ambiguous ACLs.
+    myuid=`$ID -u`
+    mygid=`$ID -g`
+    auid=1
+    if test "$auid" = "$myuid"; then auid=2; fi
+    agid=1
+    if test "$agid" = "$mygid"; then agid=2; fi
+  fi
+
+  for mode in 700 400 200 100 644 650 605 011 4700 2070; do
+    rm -f tmpfile0 tmpfile1 tmpfile2
+
+    # Prepare a file with no ACL.
+    echo "Anything" > tmpfile0
+    # If a mode is not supported (e.g. 2070 on FreeBSD), we skip testing it.
+    if chmod $mode tmpfile0 2>/dev/null; then
+      modestring0=`ls -l tmpfile0 | dd ibs=1 count=10 2>/dev/null`
+
+      # Prepare a file with no ACL.
+      echo "Some contents" > tmpfile1
+      chmod 600 tmpfile1
+
+      # Try to set the ACL to only the given mode.
+      ${CHECKER} "$builddir"/test-set-mode-acl${EXEEXT} tmpfile1 $mode
+      # Verify that tmpfile1 has no ACL and has the desired mode.
+      modestring=`ls -l tmpfile1 | dd ibs=1 count=10 2>/dev/null`
+      if test "x$modestring" != "x$modestring0"; then
+        echo "mode = $mode: tmpfile1 has wrong mode: $modestring" 1>&2
+        exit 1
+      fi
+      if test `${CHECKER} "$builddir"/test-file-has-acl${EXEEXT} tmpfile1` != no; then
+        echo "mode = $mode: tmpfile1 got an ACL" 1>&2
+        exit 1
+      fi
+
+      if test $acl_flavor != none; then
+
+        # Prepare a file with an ACL.
+        echo "Special contents" > tmpfile2
+        chmod 600 tmpfile2
+        # Set an ACL for a user (or group).
+        case $acl_flavor in
+          linux | freebsd | solaris)
+            setfacl -m user:$auid:1 tmpfile0
+            ;;
+          cygwin)
+            setfacl -m group:0:1 tmpfile0
+            ;;
+          hpux)
+            orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+            chacl -r "${orig}($auid.%,--x)" tmpfile0
+            ;;
+          hpuxjfs)
+            orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+            chacl -r "${orig}($auid.%,--x)" tmpfile0 \
+              || setacl -m user:$auid:1 tmpfile0
+            ;;
+          osf1)
+            setacl -u user:$auid:1 tmpfile0
+            ;;
+          nsk)
+            setacl -m user:$auid:1 tmpfile0
+            ;;
+          aix)
+            { aclget tmpfile0 | sed -e 's/disabled$/enabled/'; echo "        permit --x u:$auid"; } | aclput tmpfile0
+            ;;
+          macosx)
+            /bin/chmod +a "user:daemon allow execute" tmpfile0
+            ;;
+          irix)
+            /sbin/chacl user::rw-,group::---,other::---,user:$auid:--x tmpfile0
+            ;;
+        esac
+
+        # Try to set the ACL to only the given mode.
+        ${CHECKER} "$builddir"/test-set-mode-acl${EXEEXT} tmpfile2 $mode
+        # Verify that tmpfile2 has no ACL and has the desired mode.
+        modestring=`ls -l tmpfile2 | dd ibs=1 count=10 2>/dev/null`
+        if test "x$modestring" != "x$modestring0"; then
+          echo "mode = $mode: tmpfile2 has wrong mode: $modestring" 1>&2
+          exit 1
+        fi
+        if test `${CHECKER} "$builddir"/test-file-has-acl${EXEEXT} tmpfile2` != no; then
+          echo "mode = $mode: tmpfile2 still has an ACL" 1>&2
+          exit 1
+        fi
+      fi
+    fi
+  done
+
+  rm -f tmpfile[0-9]
+) || exit 1
+
+rm -rf "$tmp"
+exit 0
deleted file mode 120000 (symlink)
index 99d4fc550208982b2dc4ccb23d649f8f022d9217..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-setenv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3b2850e40f0aa9eebef224498b3ad513c9f14cbc
--- /dev/null
@@ -0,0 +1,56 @@
+/* Tests of setenv.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (setenv, int, (char const *, char const *, int));
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Test overwriting.  */
+  ASSERT (setenv ("a", "==", -1) == 0);
+  ASSERT (setenv ("a", "2", 0) == 0);
+  ASSERT (strcmp (getenv ("a"), "==") == 0);
+
+  /* Required to fail with EINVAL.  */
+  errno = 0;
+  ASSERT (setenv ("", "", 1) == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (setenv ("a=b", "", 0) == -1);
+  ASSERT (errno == EINVAL);
+#if 0
+  /* glibc and gnulib's implementation guarantee this, but POSIX no
+     longer requires it: http://austingroupbugs.net/view.php?id=185  */
+  errno = 0;
+  ASSERT (setenv (NULL, "", 0) == -1);
+  ASSERT (errno == EINVAL);
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 1875ec69c56ce6e9c2fcb3028b4fada62b6bd522..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-setlocale1.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..329991b3a2a4f4aa803dc8c908a2cd3600ad1027
--- /dev/null
@@ -0,0 +1,64 @@
+/* Test of setting the current locale.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <locale.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (setlocale, char *, (int, const char *));
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  char *name1;
+  char *name2;
+
+  /* Try to set the locale by implicitly looking at the LC_ALL environment
+     variable.
+     configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  name1 = strdup (setlocale (LC_ALL, NULL));
+
+  /* Reset the locale.  */
+  if (setlocale (LC_ALL, "C") == NULL)
+    return 1;
+
+  /* Try to set the locale by explicitly looking at the LC_ALL environment
+     variable.
+     configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL)
+    return 1;
+
+  name2 = strdup (setlocale (LC_ALL, NULL));
+
+  ASSERT (name1);
+  ASSERT (name2);
+
+  /* Test that the two results are the same.  */
+  ASSERT (strcmp (name1, name2) == 0);
+  free (name1);
+  free (name2);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index ec33c2b9dcd60905f4b5fe9a364b9f02c2b108f7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-setlocale1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3c187f5d83f108ac2f052562b46336af8dc68b0b
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+: "${LOCALE_FR=fr_FR}"
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+: "${LOCALE_JA=ja_JP}"
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+
+if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none \
+   && test $LOCALE_JA = none && test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no locale for testing is installed"
+  else
+    echo "Skipping test: no locale for testing is supported"
+  fi
+  exit 77
+fi
+
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR      ${CHECKER} ./test-setlocale1${EXEEXT} || exit 1
+fi
+
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 ${CHECKER} ./test-setlocale1${EXEEXT} || exit 1
+fi
+
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA      ${CHECKER} ./test-setlocale1${EXEEXT} || exit 1
+fi
+
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN   ${CHECKER} ./test-setlocale1${EXEEXT} || exit 1
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index 2db7014e352986ca49f6c4ff209ad729490973db..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-setlocale2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b64b64caf34513790f1a7190d7807609c9d02f26
--- /dev/null
@@ -0,0 +1,55 @@
+/* Test of setting the current locale.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <locale.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main ()
+{
+  /* Try to set the locale by implicitly looking at the LC_ALL environment
+     variable.  */
+  if (setlocale (LC_ALL, "") != NULL)
+    /* It was successful.  Check whether LC_CTYPE is non-trivial.  */
+    if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+      {
+        fprintf (stderr, "setlocale did not fail for implicit %s\n",
+                 getenv ("LC_ALL"));
+        return 1;
+      }
+
+  /* Reset the locale.  */
+  if (setlocale (LC_ALL, "C") == NULL)
+    return 1;
+
+  /* Try to set the locale by explicitly looking at the LC_ALL environment
+     variable.  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) != NULL)
+    /* It was successful.  Check whether LC_CTYPE is non-trivial.  */
+    if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+      {
+        fprintf (stderr, "setlocale did not fail for explicit %s\n",
+                 getenv ("LC_ALL"));
+        return 1;
+      }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index d1212e6ce80bb6b2cfc895a9df000b3570a4d1be..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-setlocale2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..79ea32f40344c919cd407d88a4eedade2df874a3
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Test locale names with likely unsupported encoding in Unix syntax.
+for name in ar_SA.ISO-8859-1 fr_FR.CP1251 zh_TW.GB18030 zh_CN.BIG5; do
+  env LC_ALL=$name ${CHECKER} ./test-setlocale2${EXEEXT} 1 || exit 1
+done
+
+# Test locale names with likely unsupported encoding in native Windows syntax.
+for name in "Arabic_Saudi Arabia.1252" "Arabic_Saudi Arabia.65001" \
+            French_France.65001 Japanese_Japan.65001 Turkish_Turkey.65001 \
+            Chinese_Taiwan.65001 Chinese_China.54936 Chinese_China.65001; do
+  # Here we use 'env' to set the LC_ALL environment variable, because on
+  # Solaris 11.0, the /bin/sh refuses to do it for Turkish_Turkey.65001.
+  env LC_ALL="$name" ${CHECKER} ./test-setlocale2${EXEEXT} 1 || exit 1
+done
+
+exit 0
deleted file mode 120000 (symlink)
index dff354b7c5b0d4e0f6994c8c7d7993c5cd30407f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-setlocale_null-mt-all.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d565aa03827b3514fd1a190301f81f10e79ff5de
--- /dev/null
@@ -0,0 +1,172 @@
+/* Multithread-safety test for setlocale_null_r (LC_ALL, ...).
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* Work around GCC bug 44511.  */
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wreturn-type"
+#endif
+
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
+/* Specification.  */
+#include <locale.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "glthread/thread.h"
+
+/* We want to use the system's setlocale() function here, not the gnulib
+   override.  */
+#undef setlocale
+
+
+/* Some common locale names.  */
+
+#if defined _WIN32 && !defined __CYGWIN__
+# define ENGLISH "English_United States"
+# define GERMAN  "German_Germany"
+# define FRENCH  "French_France"
+# define ENCODING ".1252"
+#else
+# define ENGLISH "en_US"
+# define GERMAN  "de_DE"
+# define FRENCH  "fr_FR"
+# if defined __sgi
+#  define ENCODING ".ISO8859-15"
+# elif defined __hpux
+#  define ENCODING ".utf8"
+# else
+#  define ENCODING ".UTF-8"
+# endif
+#endif
+
+static const char LOCALE1[] = ENGLISH ENCODING;
+static const char LOCALE2[] = GERMAN ENCODING;
+static const char LOCALE3[] = FRENCH ENCODING;
+
+static char *expected;
+
+static void *
+thread1_func (void *arg)
+{
+  for (;;)
+    {
+      char buf[SETLOCALE_NULL_ALL_MAX];
+
+      if (setlocale_null_r (LC_ALL, buf, sizeof (buf)))
+        abort ();
+      if (strcmp (expected, buf) != 0)
+        {
+          fprintf (stderr, "thread1 disturbed by thread2!\n"); fflush (stderr);
+          abort ();
+        }
+    }
+
+  /*NOTREACHED*/
+}
+
+static void *
+thread2_func (void *arg)
+{
+  for (;;)
+    {
+      char buf[SETLOCALE_NULL_ALL_MAX];
+
+      setlocale_null_r (LC_NUMERIC, buf, sizeof (buf));
+      setlocale_null_r (LC_ALL, buf, sizeof (buf));
+    }
+
+  /*NOTREACHED*/
+}
+
+int
+main (int argc, char *argv[])
+{
+  if (setlocale (LC_ALL, LOCALE1) == NULL)
+    {
+      fprintf (stderr, "Skipping test: LOCALE1 not recognized\n");
+      return 77;
+    }
+  if (setlocale (LC_NUMERIC, LOCALE2) == NULL)
+    {
+      fprintf (stderr, "Skipping test: LOCALE2 not recognized\n");
+      return 77;
+    }
+  if (setlocale (LC_TIME, LOCALE3) == NULL)
+    {
+      fprintf (stderr, "Skipping test: LOCALE3 not recognized\n");
+      return 77;
+    }
+
+  expected = strdup (setlocale (LC_ALL, NULL));
+
+  /* Create the two threads.  */
+  gl_thread_create (thread1_func, NULL);
+  gl_thread_create (thread2_func, NULL);
+
+  /* Let them run for 5 seconds.  */
+  {
+    struct timespec duration;
+    duration.tv_sec = 5;
+    duration.tv_nsec = 0;
+
+    nanosleep (&duration, NULL);
+  }
+
+  return 0;
+}
+
+#else
+
+/* No multithreading available.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif
+
+/* Without locking, the results of this test would be:
+glibc                OK
+musl libc            crash < 10 sec
+macOS                crash < 1 sec
+FreeBSD              crash < 1 sec
+NetBSD               crash < 2 sec
+OpenBSD              crash < 1 sec
+AIX                  crash < 2 sec
+HP-UX                OK
+IRIX                 OK
+Solaris 10           OK
+Solaris 11.0         OK
+Solaris 11.4         OK
+Solaris OpenIndiana  OK
+Haiku                crash < 1 sec
+Cygwin < 3.4.6       crash < 1 sec
+mingw                OK
+MSVC                 OK (assuming compiler option /MD !)
+*/
deleted file mode 120000 (symlink)
index e021d6cc5adebae80cab72e34e6996e63147cd79..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-setlocale_null-mt-one.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cbd057f94f6d080e8334713b3ec4106155b4b179
--- /dev/null
@@ -0,0 +1,172 @@
+/* Multithread-safety test for setlocale_null_r (LC_xxx, ...).
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* Work around GCC bug 44511.  */
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wreturn-type"
+#endif
+
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
+/* Specification.  */
+#include <locale.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "glthread/thread.h"
+
+/* We want to use the system's setlocale() function here, not the gnulib
+   override.  */
+#undef setlocale
+
+
+/* Some common locale names.  */
+
+#if defined _WIN32 && !defined __CYGWIN__
+# define ENGLISH "English_United States"
+# define GERMAN  "German_Germany"
+# define FRENCH  "French_France"
+# define ENCODING ".1252"
+#else
+# define ENGLISH "en_US"
+# define GERMAN  "de_DE"
+# define FRENCH  "fr_FR"
+# if defined __sgi
+#  define ENCODING ".ISO8859-15"
+# elif defined __hpux
+#  define ENCODING ".utf8"
+# else
+#  define ENCODING ".UTF-8"
+# endif
+#endif
+
+static const char LOCALE1[] = ENGLISH ENCODING;
+static const char LOCALE2[] = GERMAN ENCODING;
+static const char LOCALE3[] = FRENCH ENCODING;
+
+static char *expected;
+
+static void *
+thread1_func (void *arg)
+{
+  for (;;)
+    {
+      char buf[SETLOCALE_NULL_MAX];
+
+      if (setlocale_null_r (LC_NUMERIC, buf, sizeof (buf)))
+        abort ();
+      if (strcmp (expected, buf) != 0)
+        {
+          fprintf (stderr, "thread1 disturbed by thread2!\n"); fflush (stderr);
+          abort ();
+        }
+    }
+
+  /*NOTREACHED*/
+}
+
+static void *
+thread2_func (void *arg)
+{
+  for (;;)
+    {
+      char buf[SETLOCALE_NULL_MAX];
+
+      setlocale_null_r (LC_NUMERIC, buf, sizeof (buf));
+      setlocale_null_r (LC_TIME, buf, sizeof (buf));
+    }
+
+  /*NOTREACHED*/
+}
+
+int
+main (int argc, char *argv[])
+{
+  if (setlocale (LC_ALL, LOCALE1) == NULL)
+    {
+      fprintf (stderr, "Skipping test: LOCALE1 not recognized\n");
+      return 77;
+    }
+  if (setlocale (LC_NUMERIC, LOCALE2) == NULL)
+    {
+      fprintf (stderr, "Skipping test: LOCALE2 not recognized\n");
+      return 77;
+    }
+  if (setlocale (LC_TIME, LOCALE3) == NULL)
+    {
+      fprintf (stderr, "Skipping test: LOCALE3 not recognized\n");
+      return 77;
+    }
+
+  expected = strdup (setlocale (LC_NUMERIC, NULL));
+
+  /* Create the two threads.  */
+  gl_thread_create (thread1_func, NULL);
+  gl_thread_create (thread2_func, NULL);
+
+  /* Let them run for 2 seconds.  */
+  {
+    struct timespec duration;
+    duration.tv_sec = 2;
+    duration.tv_nsec = 0;
+
+    nanosleep (&duration, NULL);
+  }
+
+  return 0;
+}
+
+#else
+
+/* No multithreading available.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif
+
+/* Without locking, the results of this test would be:
+glibc                OK
+musl libc            OK
+macOS                OK
+FreeBSD              OK
+NetBSD               OK
+OpenBSD              crash < 1 sec
+AIX                  crash < 2 sec
+HP-UX                OK
+IRIX                 OK
+Solaris 10           OK
+Solaris 11.0         OK
+Solaris 11.4         OK
+Solaris OpenIndiana  OK
+Haiku                OK
+Cygwin               OK
+mingw                OK
+MSVC                 OK (assuming compiler option /MD !)
+*/
deleted file mode 120000 (symlink)
index b3f352d3de2c9df3543b1cbeb50d5664d23f6fa8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-setlocale_null.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7235234836aec7859d33b11da652b1557c3275d2
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test of setlocale_null_r function.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <locale.h>
+
+/* Check that SETLOCALE_NULL_ALL_MAX is a constant expression.  */
+static char buf[SETLOCALE_NULL_ALL_MAX];
+
+int
+main ()
+{
+  /* Check that setlocale_null_r() can be used with $(SETLOCALE_NULL_LIB).  */
+  return setlocale_null_r (LC_ALL, buf, sizeof (buf)) != 0;
+}
deleted file mode 120000 (symlink)
index 5ad19ef7df551b7610b8d2633bf85af25954b165..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-setsockopt.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..754938109f727d3588048756edb37e8eb22561d0
--- /dev/null
@@ -0,0 +1,55 @@
+/* Test setsockopt() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/socket.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (setsockopt, int, (int, int, int, const void *, socklen_t));
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "sockets.h"
+#include "macros.h"
+
+int
+main (void)
+{
+  (void) gl_sockets_startup (SOCKETS_1_1);
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    int value = 1;
+
+    errno = 0;
+    ASSERT (setsockopt (-1, SOL_SOCKET, SO_REUSEADDR, &value, sizeof (value))
+            == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    int value = 1;
+
+    close (99);
+    errno = 0;
+    ASSERT (setsockopt (99, SOL_SOCKET, SO_REUSEADDR, &value, sizeof (value))
+            == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f4e0b226c5909c97f95c5efd636f6a0b6a50d727..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sha1-buffer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6c3090b015262d0af517263ed88f960d0de46ca9
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc.
+ * Written by Simon Josefsson
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "sha1.h"
+
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+  const char *in1 = "abcdefgh";
+  const char *out1 = "\x42\x5a\xf1\x2a\x07\x43\x50\x2b"
+    "\x32\x2e\x93\xa0\x15\xbc\xf8\x68\xe3\x24\xd5\x6a";
+  char buf[SHA1_DIGEST_SIZE];
+
+  if (memcmp (sha1_buffer (in1, strlen (in1), buf),
+              out1, SHA1_DIGEST_SIZE) != 0)
+    {
+      size_t i;
+      printf ("expected:\n");
+      for (i = 0; i < SHA1_DIGEST_SIZE; i++)
+        printf ("%02x ", out1[i] & 0xFFu);
+      printf ("\ncomputed:\n");
+      for (i = 0; i < SHA1_DIGEST_SIZE; i++)
+        printf ("%02x ", buf[i] & 0xFFu);
+      printf ("\n");
+      return 1;
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 6b848fee7435c6731cb71c4fd0f23d2a652e36f7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sha1-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a21428b0ace58886567f19333b746012934532a0
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc.
+ * Written by Simon Josefsson
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "sha1.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define TESTFILE "test-sha1.data"
+#include "test-digest.h"
+
+int
+main (void)
+{
+  /* Test sha1_stream.  */
+  test_digest_on_files (sha1_stream, "sha1_stream", 20,
+                        "\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09",
+                        "\x9c\x04\xcd\x63\x72\x07\x7e\x9b\x11\xf7\x0c\xa1\x11\xc9\x80\x7d\xc7\x13\x7e\x4b",
+                        "\x91\xab\x6b\x1b\x8d\x29\x25\x3c\xcb\x8d\xce\xb7\x7a\x25\x26\x2c\x92\xc9\x22\x09");
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 9f7b60365b5615b553cb1d1231fe8a680a4b5573..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sha256-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d48b28e9b0ac87919388076463c32eec41f1a6cd
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "sha256.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define TESTFILE "test-sha256.data"
+#include "test-digest.h"
+
+int
+main (void)
+{
+  /* Test sha224_stream.  */
+  test_digest_on_files (sha224_stream, "sha224_stream", 28,
+                        "\xd1\x4a\x02\x8c\x2a\x3a\x2b\xc9\x47\x61\x02\xbb\x28\x82\x34\xc4\x15\xa2\xb0\x1f\x82\x8e\xa6\x2a\xc5\xb3\xe4\x2f",
+                        "\xe8\x87\x99\xb0\xd0\xd5\xbe\xcc\x67\x91\x83\x7f\xa9\x53\x88\xd4\x05\x6f\x12\x50\xa5\x11\xd1\x48\x29\x76\x66\x63",
+                        "\x86\xa2\x5a\xc3\x6a\x70\x8e\xf3\x4e\x78\x55\xf0\xb1\x97\x8a\xa8\x61\x78\x6c\xb8\x87\xcd\x5c\xf1\x19\x3b\x53\xe4");
+
+  /* Test sha256_stream.  */
+  test_digest_on_files (sha256_stream, "sha256_stream", 32,
+                        "\xe3\xb0\xc4\x42\x98\xfc\x1c\x14\x9a\xfb\xf4\xc8\x99\x6f\xb9\x24\x27\xae\x41\xe4\x64\x9b\x93\x4c\xa4\x95\x99\x1b\x78\x52\xb8\x55",
+                        "\xb4\x7c\xc0\xf1\x04\xb6\x2d\x4c\x7c\x30\xbc\xd6\x8f\xd8\xe6\x76\x13\xe2\x87\xdc\x4a\xd8\xc3\x10\xef\x10\xcb\xad\xea\x9c\x43\x80",
+                        "\xe5\x19\x95\xff\x0b\xc4\x95\xcf\x49\xdd\x31\x42\x0a\x6b\xe0\x6b\x38\xef\xef\x43\xab\xa6\xf4\x76\x64\x32\x99\x4a\x47\x1a\x0f\xb5");
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 201a022baf9c03df1a8b39389345ceed8b26aebd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sha512-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bc816283bcb0c2f0e1f831f0518af705df706325
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "sha512.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define TESTFILE "test-sha512.data"
+#include "test-digest.h"
+
+int
+main (void)
+{
+  /* Test sha384_stream.  */
+  test_digest_on_files (sha384_stream, "sha384_stream", 48,
+                        "\x38\xb0\x60\xa7\x51\xac\x96\x38\x4c\xd9\x32\x7e\xb1\xb1\xe3\x6a\x21\xfd\xb7\x11\x14\xbe\x07\x43\x4c\x0c\xc7\xbf\x63\xf6\xe1\xda\x27\x4e\xde\xbf\xe7\x6f\x65\xfb\xd5\x1a\xd2\xf1\x48\x98\xb9\x5b",
+                        "\xd5\x1d\x28\xd0\x14\x1e\x56\xf6\x92\x95\x2e\xa1\x48\x61\x89\x8e\x2b\x41\x7b\x92\x28\x31\xe0\xf4\xbc\xdb\xc3\x26\xa7\xfe\x1e\x9d\x95\x63\x18\x2e\x83\xd3\xa8\xaf\x66\xf6\x85\x36\xe0\xd4\x2b\x88",
+                        "\xab\x32\x29\xa1\xc8\x43\xce\x38\x85\x93\xb3\xa6\x7f\x5a\x36\xdc\xda\xf2\xac\x33\x22\x80\xee\xbc\x5b\x1b\x70\x8b\x9b\x96\x4b\xc1\x75\x60\x00\xae\xdc\xfd\x60\x70\x24\x7f\x0b\x8b\x3a\x89\xd3\xbb");
+
+  /* Test sha512_stream.  */
+  test_digest_on_files (sha512_stream, "sha512_stream", 64,
+                        "\xcf\x83\xe1\x35\x7e\xef\xb8\xbd\xf1\x54\x28\x50\xd6\x6d\x80\x07\xd6\x20\xe4\x05\x0b\x57\x15\xdc\x83\xf4\xa9\x21\xd3\x6c\xe9\xce\x47\xd0\xd1\x3c\x5d\x85\xf2\xb0\xff\x83\x18\xd2\x87\x7e\xec\x2f\x63\xb9\x31\xbd\x47\x41\x7a\x81\xa5\x38\x32\x7a\xf9\x27\xda\x3e",
+                        "\x02\x0d\xa0\xf4\xd8\xa4\xc8\xbf\xbc\x98\x27\x40\x27\x74\x00\x61\xd7\xdf\x52\xee\x07\x09\x1e\xd6\x59\x5a\x08\x3e\x0f\x45\x32\x7b\xbe\x59\x42\x43\x12\xd8\x6f\x21\x8b\x74\xed\x2e\x25\x50\x7a\xba\xf5\xc7\xa5\xfc\xf4\xca\xfc\xf9\x53\x8b\x70\x58\x08\xfd\x55\xec",
+                        "\x38\x34\x58\xf3\xde\x68\x70\x33\x0c\xa4\xd4\x71\x4d\x0f\x41\xc5\xed\xc9\xf4\x67\x3e\x19\x0f\x87\x2b\x53\x72\x00\xa8\x35\x73\xf7\x0b\xf1\xf2\x0d\x9a\xa8\xd6\x08\x65\x2f\xe2\x28\xbd\x2d\x0c\xd5\xd6\xd4\xd3\xb2\x84\x3e\x32\x32\x5d\x62\x54\x7b\x39\xfd\x47\x04");
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 206fa6a8c9ceb5f2d86fc3507bc464b379b66d35..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sigaction.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5d29854f802dfb0464511af5303d09d0fe54c913
--- /dev/null
@@ -0,0 +1,122 @@
+/* Test of sigaction() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2008.  */
+
+#include <config.h>
+
+#include <signal.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (sigaction, int, (int, struct sigaction const *,
+                                  struct sigaction *));
+
+#include <stddef.h>
+
+#include "macros.h"
+
+#ifndef SA_NOCLDSTOP
+# define SA_NOCLDSTOP 0
+#endif
+#ifndef SA_ONSTACK
+# define SA_ONSTACK 0
+#endif
+#ifndef SA_RESETHAND
+# define SA_RESETHAND 0
+#endif
+#ifndef SA_RESTART
+# define SA_RESTART 0
+#endif
+#ifndef SA_SIGINFO
+# define SA_SIGINFO 0
+#endif
+#ifndef SA_NOCLDWAIT
+# define SA_NOCLDWAIT 0
+#endif
+
+/* Define a mask of flags required by POSIX.  Some implementations
+   provide other flags as extensions, such as SA_RESTORER, that we
+   must ignore in this test.  */
+#define MASK_SA_FLAGS (SA_NOCLDSTOP | SA_ONSTACK | SA_RESETHAND | SA_RESTART \
+                       | SA_SIGINFO | SA_NOCLDWAIT | SA_NODEFER)
+
+/* This test is unsafe in the presence of an asynchronous SIGABRT,
+   because we install a signal-handler that is intentionally not
+   async-safe.  Hopefully, this does not lead to too many reports of
+   false failures, since people don't generally use 'kill -s SIGABRT'
+   to end a runaway program.  */
+
+static void
+handler (int sig)
+{
+  static int entry_count;
+  struct sigaction sa;
+  ASSERT (sig == SIGABRT);
+  ASSERT (sigaction (SIGABRT, NULL, &sa) == 0);
+  ASSERT ((sa.sa_flags & SA_SIGINFO) == 0);
+  switch (entry_count++)
+    {
+    case 0:
+      ASSERT ((sa.sa_flags & SA_RESETHAND) == 0);
+      ASSERT (sa.sa_handler == handler);
+      break;
+    case 1:
+      /* This assertion fails on glibc-2.3.6 systems with LinuxThreads,
+         when this program is linked with -lpthread, due to the sigaction()
+         override in libpthread.so.  */
+#if !(defined __GLIBC__ || defined __UCLIBC__)
+      ASSERT (sa.sa_handler == SIG_DFL);
+#endif
+      break;
+    default:
+      ASSERT (0);
+    }
+}
+
+int
+main (void)
+{
+  struct sigaction sa;
+  struct sigaction old_sa;
+  sa.sa_handler = handler;
+
+  sa.sa_flags = 0;
+  ASSERT (sigemptyset (&sa.sa_mask) == 0);
+  ASSERT (sigaction (SIGABRT, &sa, NULL) == 0);
+  ASSERT (raise (SIGABRT) == 0);
+
+  sa.sa_flags = SA_RESETHAND | SA_NODEFER;
+  ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0);
+  ASSERT ((old_sa.sa_flags & MASK_SA_FLAGS) == 0);
+  ASSERT (old_sa.sa_handler == handler);
+  ASSERT (raise (SIGABRT) == 0);
+
+  sa.sa_handler = SIG_DFL;
+  ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0);
+  ASSERT ((old_sa.sa_flags & SA_SIGINFO) == 0);
+#if !(defined __GLIBC__ || defined __UCLIBC__) /* see above */
+  ASSERT (old_sa.sa_handler == SIG_DFL);
+#endif
+
+  sa.sa_handler = SIG_IGN;
+  ASSERT (sigaction (SIGABRT, &sa, NULL) == 0);
+  ASSERT (raise (SIGABRT) == 0);
+  ASSERT (sigaction (SIGABRT, NULL, &old_sa) == 0);
+  ASSERT (old_sa.sa_handler == SIG_IGN);
+  ASSERT (raise (SIGABRT) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 251adc0228b3380ce051be9cbfa5e13efb5c5d71..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-signal-h.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c4b322078762ea51f75c06f84549d1eb0eeb324c
--- /dev/null
@@ -0,0 +1,129 @@
+/* Test of <signal.h> substitute.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <signal.h>
+
+/* Check for required types.  */
+struct
+{
+  size_t a;
+  uid_t b;
+  volatile sig_atomic_t c;
+  sigset_t d;
+  pid_t e;
+#if 0
+  /* Not guaranteed by gnulib.  */
+  pthread_t f;
+  struct timespec g;
+#endif
+} s;
+
+/* Check that NSIG is defined.  */
+int nsig = NSIG;
+
+int
+main (void)
+{
+  switch (0)
+    {
+      /* The following are guaranteed by C.  */
+    case 0:
+    case SIGABRT:
+    case SIGFPE:
+    case SIGILL:
+    case SIGINT:
+    case SIGSEGV:
+    case SIGTERM:
+      /* The following is guaranteed by gnulib.  */
+#if GNULIB_SIGPIPE || defined SIGPIPE
+    case SIGPIPE:
+#endif
+      /* Ensure no conflict with other standardized names.  */
+#ifdef SIGALRM
+    case SIGALRM:
+#endif
+      /* On Haiku, SIGBUS is mistakenly equal to SIGSEGV.  */
+#if defined SIGBUS && SIGBUS != SIGSEGV
+    case SIGBUS:
+#endif
+#ifdef SIGCHLD
+    case SIGCHLD:
+#endif
+#ifdef SIGCONT
+    case SIGCONT:
+#endif
+#ifdef SIGHUP
+    case SIGHUP:
+#endif
+#ifdef SIGKILL
+    case SIGKILL:
+#endif
+#ifdef SIGQUIT
+    case SIGQUIT:
+#endif
+#ifdef SIGSTOP
+    case SIGSTOP:
+#endif
+#ifdef SIGTSTP
+    case SIGTSTP:
+#endif
+#ifdef SIGTTIN
+    case SIGTTIN:
+#endif
+#ifdef SIGTTOU
+    case SIGTTOU:
+#endif
+#ifdef SIGUSR1
+    case SIGUSR1:
+#endif
+#ifdef SIGUSR2
+    case SIGUSR2:
+#endif
+#ifdef SIGSYS
+    case SIGSYS:
+#endif
+#ifdef SIGTRAP
+    case SIGTRAP:
+#endif
+#ifdef SIGURG
+    case SIGURG:
+#endif
+#ifdef SIGVTALRM
+    case SIGVTALRM:
+#endif
+#ifdef SIGXCPU
+    case SIGXCPU:
+#endif
+#ifdef SIGXFSZ
+    case SIGXFSZ:
+#endif
+      /* SIGRTMIN and SIGRTMAX need not be compile-time constants.  */
+#if 0
+# ifdef SIGRTMIN
+    case SIGRTMIN:
+# endif
+# ifdef SIGRTMAX
+    case SIGRTMAX:
+# endif
+#endif
+      ;
+    }
+  return s.a + s.b + s.c + s.e;
+}
deleted file mode 120000 (symlink)
index 76bf8b4037261f15d5c288e622b5e1747d1c0fdb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-signbit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..da5b7981e5d075842cf6fdcccbeba7fc1da1c588
--- /dev/null
@@ -0,0 +1,135 @@
+/* Test of signbit() substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <math.h>
+
+/* signbit must be a macro.  */
+#ifndef signbit
+# error missing declaration
+#endif
+
+#include <float.h>
+#include <limits.h>
+
+#include "minus-zero.h"
+#include "infinity.h"
+#include "signed-nan.h"
+#include "signed-snan.h"
+#include "macros.h"
+
+float zerof = 0.0f;
+double zerod = 0.0;
+long double zerol = 0.0L;
+
+static void
+test_signbitf ()
+{
+  /* Finite values.  */
+  ASSERT (!signbit (3.141f));
+  ASSERT (!signbit (3.141e30f));
+  ASSERT (!signbit (3.141e-30f));
+  ASSERT (signbit (-2.718f));
+  ASSERT (signbit (-2.718e30f));
+  ASSERT (signbit (-2.718e-30f));
+  /* Zeros.  */
+  ASSERT (!signbit (0.0f));
+  if (1.0f / minus_zerof < 0)
+    ASSERT (signbit (minus_zerof));
+  else
+    ASSERT (!signbit (minus_zerof));
+  /* Infinite values.  */
+  ASSERT (!signbit (Infinityf ()));
+  ASSERT (signbit (- Infinityf ()));
+  /* Quiet NaN.  */
+  ASSERT (!signbit (positive_NaNf ()));
+  ASSERT (signbit (negative_NaNf ()));
+#if HAVE_SNANF
+  /* Signalling NaN.  */
+  ASSERT (!signbit (positive_SNaNf ()));
+  ASSERT (signbit (negative_SNaNf ()));
+#endif
+}
+
+static void
+test_signbitd ()
+{
+  /* Finite values.  */
+  ASSERT (!signbit (3.141));
+  ASSERT (!signbit (3.141e30));
+  ASSERT (!signbit (3.141e-30));
+  ASSERT (signbit (-2.718));
+  ASSERT (signbit (-2.718e30));
+  ASSERT (signbit (-2.718e-30));
+  /* Zeros.  */
+  ASSERT (!signbit (0.0));
+  if (1.0 / minus_zerod < 0)
+    ASSERT (signbit (minus_zerod));
+  else
+    ASSERT (!signbit (minus_zerod));
+  /* Infinite values.  */
+  ASSERT (!signbit (Infinityd ()));
+  ASSERT (signbit (- Infinityd ()));
+  /* Quiet NaN.  */
+  ASSERT (!signbit (positive_NaNd ()));
+  ASSERT (signbit (negative_NaNd ()));
+#if HAVE_SNAND
+  /* Signalling NaN.  */
+  ASSERT (!signbit (positive_SNaNd ()));
+  ASSERT (signbit (negative_SNaNd ()));
+#endif
+}
+
+static void
+test_signbitl ()
+{
+  /* Finite values.  */
+  ASSERT (!signbit (3.141L));
+  ASSERT (!signbit (3.141e30L));
+  ASSERT (!signbit (3.141e-30L));
+  ASSERT (signbit (-2.718L));
+  ASSERT (signbit (-2.718e30L));
+  ASSERT (signbit (-2.718e-30L));
+  /* Zeros.  */
+  ASSERT (!signbit (0.0L));
+  if (1.0L / minus_zerol < 0)
+    ASSERT (signbit (minus_zerol));
+  else
+    ASSERT (!signbit (minus_zerol));
+  /* Infinite values.  */
+  ASSERT (!signbit (Infinityl ()));
+  ASSERT (signbit (- Infinityl ()));
+  /* Quiet NaN.  */
+  ASSERT (!signbit (positive_NaNl ()));
+  ASSERT (signbit (negative_NaNl ()));
+#if HAVE_SNANL
+  /* Signalling NaN.  */
+  ASSERT (!signbit (positive_SNaNl ()));
+  ASSERT (signbit (negative_SNaNl ()));
+#endif
+}
+
+int
+main ()
+{
+  test_signbitf ();
+  test_signbitd ();
+  test_signbitl ();
+  return 0;
+}
deleted file mode 120000 (symlink)
index a3ba84d14c7e59232f4cf543bc14e665191c3561..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sigprocmask.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c712d77df5e24671bcedf033c67c21734433f9c4
--- /dev/null
@@ -0,0 +1,97 @@
+/* Test of sigprocmask.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include <signal.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (sigprocmask, int, (int, const sigset_t *, sigset_t *));
+
+#include <errno.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#if !(defined _WIN32 && !defined __CYGWIN__)
+
+static volatile int sigint_occurred;
+
+static void
+sigint_handler (_GL_UNUSED int sig)
+{
+  sigint_occurred++;
+}
+
+int
+main ()
+{
+  sigset_t set;
+  intmax_t pid = getpid ();
+  char command[80];
+
+  signal (SIGINT, sigint_handler);
+
+  sigemptyset (&set);
+  sigaddset (&set, SIGINT);
+
+  /* Check error handling.  */
+  ASSERT (sigprocmask (1729, &set, NULL) == -1);
+  ASSERT (errno == EINVAL);
+
+  /* Block SIGINT.  */
+  ASSERT (sigprocmask (SIG_BLOCK, &set, NULL) == 0);
+
+  /* Request a SIGINT signal from outside.  */
+  sprintf (command, "sh -c 'sleep 1; kill -INT %"PRIdMAX"' &", pid);
+  ASSERT (system (command) == 0);
+
+  /* Wait.  */
+  sleep (2);
+
+  /* The signal should not have arrived yet, because it is blocked.  */
+  ASSERT (sigint_occurred == 0);
+
+  /* Unblock SIGINT.  */
+  ASSERT (sigprocmask (SIG_UNBLOCK, &set, NULL) == 0);
+
+  /* The signal should have arrived now, because POSIX says
+       "If there are any pending unblocked signals after the call to
+        sigprocmask(), at least one of those signals shall be delivered
+        before the call to sigprocmask() returns."  */
+  ASSERT (sigint_occurred == 1);
+
+  return 0;
+}
+
+#else
+
+/* On native Windows, getpid() values and the arguments that are passed to
+   the (Cygwin?) 'kill' program are not necessarily related.  */
+
+int
+main ()
+{
+  fputs ("Skipping test: native Windows platform\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 48bfbd7ea9d0d59a003c0ac603d295d4d0519f80..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sleep.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b0896f2e97ab2afbdf8d0021dc28f574aecff34c
--- /dev/null
@@ -0,0 +1,58 @@
+/* Test of sleep() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (sleep, unsigned int, (unsigned int));
+
+#include <signal.h>
+
+#include "macros.h"
+
+#if HAVE_DECL_ALARM
+static void
+handle_alarm (int sig)
+{
+  if (sig != SIGALRM)
+    _exit (1);
+}
+#endif
+
+int
+main (void)
+{
+  ASSERT (sleep (1) <= 1);
+
+  ASSERT (sleep (0) == 0);
+
+#if HAVE_DECL_ALARM
+  {
+    const unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days.  */
+    unsigned int remaining;
+    signal (SIGALRM, handle_alarm);
+    alarm (1);
+    remaining = sleep (pentecost);
+    ASSERT (pentecost - 10 < remaining && remaining <= pentecost);
+  }
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 34f1e677064886d94fe9e2d7bac00202e1dfd807..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sm3-buffer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ae4409cc363115f516e9c2e3467a5910a5b9b884
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ * Written by Jia Zhang <qianyue.zj@alibaba-inc.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "sm3.h"
+
+#include <stdio.h>
+#include <string.h>
+
+static int
+test (const char *in, const char *out)
+{
+  char buf[SM3_DIGEST_SIZE];
+
+  if (memcmp (sm3_buffer (in, strlen (in), buf),
+              out, SM3_DIGEST_SIZE) != 0)
+    {
+      size_t i;
+      printf ("expected:\n");
+      for (i = 0; i < SM3_DIGEST_SIZE; i++)
+        printf ("%02x ", out[i] & 0xFFu);
+      printf ("\ncomputed:\n");
+      for (i = 0; i < SM3_DIGEST_SIZE; i++)
+        printf ("%02x ", buf[i] & 0xFFu);
+      printf ("\n");
+      return 1;
+    }
+
+  return 0;
+}
+
+int
+main (void)
+{
+  /* Test vectors from GM/T 004-2012 */
+  const char *in[] =
+    {
+      "abc",
+      "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd",
+    };
+  const char *out[] =
+    {
+      "\x66\xc7\xf0\xf4\x62\xee\xed\xd9\xd1\xf2\xd4\x6b\xdc\x10\xe4\xe2"
+      "\x41\x67\xc4\x87\x5c\xf2\xf7\xa2\x29\x7d\xa0\x2b\x8f\x4b\xa8\xe0",
+      "\xde\xbe\x9f\xf9\x22\x75\xb8\xa1\x38\x60\x48\x89\xc1\x8e\x5a\x4d"
+      "\x6f\xdb\x70\xe5\x38\x7e\x57\x65\x29\x3d\xcb\xa3\x9c\x0c\x57\x32",
+    };
+  size_t i;
+
+  for (i = 0; i < sizeof (in) / sizeof (in[0]); i++)
+    {
+      if (test (in[i], out[i]))
+        return 1;
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 4fdc3424057e683348ccbaee9d61ea0ff6461060..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-snprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..98f1f1c2ede88af074d1e7362456a1d85d36c396
--- /dev/null
@@ -0,0 +1,72 @@
+/* Test of snprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...));
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main ()
+{
+  char buf[8];
+  int size;
+  int retval;
+
+  retval = snprintf (NULL, 0, "%d", 12345);
+  ASSERT (retval == 5);
+
+  for (size = 0; size <= 8; size++)
+    {
+      memcpy (buf, "DEADBEEF", 8);
+      retval = snprintf (buf, size, "%d", 12345);
+      ASSERT (retval == 5);
+      if (size < 6)
+        {
+          if (size > 0)
+            {
+              ASSERT (memcmp (buf, "12345", size - 1) == 0);
+              ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
+            }
+#if !CHECK_SNPRINTF_POSIX
+          if (size > 0)
+#endif
+            ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
+        }
+      else
+        {
+          ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
+        }
+    }
+
+  /* Test the support of the POSIX/XSI format strings with positions.  */
+  {
+    char result[100];
+    retval = snprintf (result, sizeof (result), "%2$d %1$d", 33, 55);
+    ASSERT (strcmp (result, "55 33") == 0);
+    ASSERT (retval == strlen (result));
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 014d7e11a8508efa25939f443ee96c60ecacec74..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sockets.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5917e4ddf6b8b9debc42b2cd439a6f8f3c1fb79b
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ * Written by Simon Josefsson.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "sockets.h"
+
+int
+main (void)
+{
+  int err;
+
+  err = gl_sockets_startup (SOCKETS_1_1);
+  if (err != 0)
+    {
+      printf ("wsastartup failed %d\n", err);
+      return 1;
+    }
+
+  err = gl_sockets_cleanup ();
+  if (err != 0)
+    {
+      printf ("wsacleanup failed %d\n", err);
+      return 1;
+    }
+
+  (void) gl_fd_to_handle (0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3e67de6f1a16d87e70dd54f22cdd64bd2961130b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-stat-time.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f28b6c46b26062c46fa8bd891720f6248b020b17
--- /dev/null
@@ -0,0 +1,248 @@
+/* Test of <stat-time.h>.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by James Youngman <jay@gnu.org>, 2007.  */
+
+#include <config.h>
+
+#include "stat-time.h"
+
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <time.h>
+
+#include "macros.h"
+
+#define BASE "test-stat-time.t"
+#include "nap.h"
+
+enum { NFILES = 4 };
+
+static char filename_stamp1[50];
+static char filename_testfile[50];
+static char filename_stamp2[50];
+static char filename_stamp3[50];
+
+/* Use file names that are different at each run.
+   This is necessary for test_birthtime() to pass on native Windows:
+   On this platform, the file system apparently remembers the creation time
+   of a file even after it is removed and created anew.  See
+   "Windows NT Contains File System Tunneling Capabilities"
+   <https://support.microsoft.com/en-us/help/172190/>  */
+static void
+initialize_filenames (void)
+{
+  long t = (long) time (NULL);
+  sprintf (filename_stamp1,   "t-stt-%ld-stamp1", t);
+  sprintf (filename_testfile, "t-stt-%ld-testfile", t);
+  sprintf (filename_stamp2,   "t-stt-%ld-stamp2", t);
+  sprintf (filename_stamp3,   "t-stt-%ld-stamp3", t);
+}
+
+static int
+force_unlink (const char *filename)
+{
+  /* This chmod is necessary on mingw, where unlink() of a read-only file
+     fails with EPERM.  */
+  chmod (filename, 0600);
+  return unlink (filename);
+}
+
+static void
+cleanup (int sig)
+{
+  /* Remove temporary files.  */
+  force_unlink (filename_stamp1);
+  force_unlink (filename_testfile);
+  force_unlink (filename_stamp2);
+  force_unlink (filename_stamp3);
+
+  if (sig != 0)
+    _exit (1);
+}
+
+static int
+open_file (const char *filename, int flags)
+{
+  int fd = open (filename, flags | O_WRONLY, 0500);
+  if (fd >= 0)
+    {
+      close (fd);
+      return 1;
+    }
+  else
+    {
+      return 0;
+    }
+}
+
+static void
+create_file (const char *filename)
+{
+  ASSERT (open_file (filename, O_CREAT | O_EXCL));
+}
+
+static void
+do_stat (const char *filename, struct stat *p)
+{
+  ASSERT (stat (filename, p) == 0);
+}
+
+static void
+prepare_test (struct stat *statinfo, struct timespec *modtimes)
+{
+  int i;
+
+  create_file (filename_stamp1);
+  nap ();
+  create_file (filename_testfile);
+  nap ();
+  create_file (filename_stamp2);
+  nap ();
+  ASSERT (chmod (filename_testfile, 0400) == 0);
+  nap ();
+  create_file (filename_stamp3);
+
+  do_stat (filename_stamp1,   &statinfo[0]);
+  do_stat (filename_testfile, &statinfo[1]);
+  do_stat (filename_stamp2,   &statinfo[2]);
+  do_stat (filename_stamp3,   &statinfo[3]);
+
+  /* Now use our access functions. */
+  for (i = 0; i < NFILES; ++i)
+    {
+      modtimes[i] = get_stat_mtime (&statinfo[i]);
+    }
+}
+
+static void
+test_mtime (const struct stat *statinfo, struct timespec *modtimes)
+{
+  int i;
+
+  /* Use the struct stat fields directly. */
+  /* mtime(stamp1) < mtime(stamp2) */
+  ASSERT (statinfo[0].st_mtime < statinfo[2].st_mtime
+          || (statinfo[0].st_mtime == statinfo[2].st_mtime
+              && (get_stat_mtime_ns (&statinfo[0])
+                  < get_stat_mtime_ns (&statinfo[2]))));
+  /* mtime(stamp2) < mtime(stamp3) */
+  ASSERT (statinfo[2].st_mtime < statinfo[3].st_mtime
+          || (statinfo[2].st_mtime == statinfo[3].st_mtime
+              && (get_stat_mtime_ns (&statinfo[2])
+                  < get_stat_mtime_ns (&statinfo[3]))));
+
+  /* Now check the result of the access functions. */
+  /* mtime(stamp1) < mtime(stamp2) */
+  ASSERT (modtimes[0].tv_sec < modtimes[2].tv_sec
+          || (modtimes[0].tv_sec == modtimes[2].tv_sec
+              && modtimes[0].tv_nsec < modtimes[2].tv_nsec));
+  /* mtime(stamp2) < mtime(stamp3) */
+  ASSERT (modtimes[2].tv_sec < modtimes[3].tv_sec
+          || (modtimes[2].tv_sec == modtimes[3].tv_sec
+              && modtimes[2].tv_nsec < modtimes[3].tv_nsec));
+
+  /* verify equivalence */
+  for (i = 0; i < NFILES; ++i)
+    {
+      struct timespec ts;
+      ts = get_stat_mtime (&statinfo[i]);
+      ASSERT (ts.tv_sec == statinfo[i].st_mtime);
+    }
+}
+
+#if defined _WIN32 && !defined __CYGWIN__
+/* Skip the ctime tests on native Windows platforms, because their
+   st_ctime is either the same as st_mtime (plus or minus an offset)
+   or set to the file _creation_ time, and is not influenced by rename
+   or chmod.  */
+# define test_ctime(ignored) ((void) 0)
+#else
+static void
+test_ctime (const struct stat *statinfo)
+{
+  /* On some buggy NFS clients, mtime and ctime are disproportionately
+     skewed from one another.  Skip this test in that case.  */
+  if (statinfo[0].st_mtime != statinfo[0].st_ctime)
+    return;
+
+  /* mtime(stamp2) < ctime(testfile) */
+  ASSERT (statinfo[2].st_mtime < statinfo[1].st_ctime
+          || (statinfo[2].st_mtime == statinfo[1].st_ctime
+              && (get_stat_mtime_ns (&statinfo[2])
+                  < get_stat_ctime_ns (&statinfo[1]))));
+}
+#endif
+
+static void
+test_birthtime (const struct stat *statinfo,
+                const struct timespec *modtimes,
+                struct timespec *birthtimes)
+{
+  int i;
+
+  /* Collect the birth times.  */
+  for (i = 0; i < NFILES; ++i)
+    {
+      birthtimes[i] = get_stat_birthtime (&statinfo[i]);
+      if (birthtimes[i].tv_nsec < 0)
+        return;
+    }
+
+  /* mtime(stamp1) < birthtime(testfile) */
+  ASSERT (modtimes[0].tv_sec < birthtimes[1].tv_sec
+          || (modtimes[0].tv_sec == birthtimes[1].tv_sec
+              && modtimes[0].tv_nsec < birthtimes[1].tv_nsec));
+  /* birthtime(testfile) < mtime(stamp2) */
+  ASSERT (birthtimes[1].tv_sec < modtimes[2].tv_sec
+          || (birthtimes[1].tv_sec == modtimes[2].tv_sec
+              && birthtimes[1].tv_nsec < modtimes[2].tv_nsec));
+}
+
+int
+main (void)
+{
+  struct stat statinfo[NFILES];
+  struct timespec modtimes[NFILES];
+  struct timespec birthtimes[NFILES];
+
+  initialize_filenames ();
+
+#ifdef SIGHUP
+  signal (SIGHUP, cleanup);
+#endif
+#ifdef SIGINT
+  signal (SIGINT, cleanup);
+#endif
+#ifdef SIGQUIT
+  signal (SIGQUIT, cleanup);
+#endif
+#ifdef SIGTERM
+  signal (SIGTERM, cleanup);
+#endif
+
+  cleanup (0);
+  prepare_test (statinfo, modtimes);
+  test_mtime (statinfo, modtimes);
+  test_ctime (statinfo);
+  test_birthtime (statinfo, modtimes, birthtimes);
+
+  cleanup (0);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 7cd88439af655506b15ed1c525d99a19e919398f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-stat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..53ff77d9b3b9c758937ba0367114f55cbdf4c977
--- /dev/null
@@ -0,0 +1,55 @@
+/* Tests of stat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+/* Caution: stat may be a function-like macro.  Although this
+   signature check must pass, it may be the signature of the real (and
+   broken) stat rather than rpl_stat.  Most code should not use the
+   address of stat.  */
+#include "signature.h"
+SIGNATURE_CHECK (stat, int, (char const *, struct stat *));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "same-inode.h"
+#include "macros.h"
+
+#define BASE "test-stat.t"
+
+#include "test-stat.h"
+
+/* Wrapper around stat, which works even if stat is a function-like
+   macro, where test_stat_func(stat) would do the wrong thing.  */
+static int
+do_stat (char const *name, struct stat *st)
+{
+  return stat (name, st);
+}
+
+int
+main (void)
+{
+  return test_stat_func (do_stat, true);
+}
deleted file mode 120000 (symlink)
index 3a1e6d1e0627218563983917bec5db0486ad5725..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-stat.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a76f38f9cf87494c8f78d3f7dcc7aab4bbae8d22
--- /dev/null
@@ -0,0 +1,107 @@
+/* Tests of stat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+/* This file is designed to test both stat(n,buf) and
+   fstatat(AT_FDCWD,n,buf,0).  FUNC is the function to test.  Assumes
+   that BASE and ASSERT are already defined, and that appropriate
+   headers are already included.  If PRINT, warn before skipping
+   symlink tests with status 77.  */
+
+static int
+test_stat_func (int (*func) (char const *, struct stat *), bool print)
+{
+  struct stat st1;
+  struct stat st2;
+  char *cwd = getcwd (NULL, 0);
+
+  ASSERT (cwd);
+  ASSERT (func (".", &st1) == 0);
+  ASSERT (func ("./", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
+  ASSERT (psame_inode (&st1, &st2));
+#endif
+  ASSERT (func (cwd, &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
+  ASSERT (psame_inode (&st1, &st2));
+#endif
+  ASSERT (func ("/", &st1) == 0);
+  ASSERT (func ("///", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
+  ASSERT (psame_inode (&st1, &st2));
+#endif
+
+  errno = 0;
+  ASSERT (func ("", &st1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("nosuch", &st1) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("nosuch/", &st1) == -1);
+  ASSERT (errno == ENOENT);
+
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  ASSERT (func (BASE "file", &st1) == 0);
+  errno = 0;
+  ASSERT (func (BASE "file/", &st1) == -1);
+  ASSERT (errno == ENOTDIR);
+
+  /* Now for some symlink tests, where supported.  We set up:
+     link1 -> directory
+     link2 -> file
+     link3 -> dangling
+     link4 -> loop
+     then test behavior with trailing slash.
+  */
+  if (symlink (".", BASE "link1") != 0)
+    {
+      ASSERT (unlink (BASE "file") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  ASSERT (symlink (BASE "file", BASE "link2") == 0);
+  ASSERT (symlink (BASE "nosuch", BASE "link3") == 0);
+  ASSERT (symlink (BASE "link4", BASE "link4") == 0);
+
+  ASSERT (func (BASE "link1/", &st1) == 0);
+  ASSERT (S_ISDIR (st1.st_mode));
+
+  errno = 0;
+  ASSERT (func (BASE "link2/", &st1) == -1);
+  ASSERT (errno == ENOTDIR);
+
+  errno = 0;
+  ASSERT (func (BASE "link3/", &st1) == -1);
+  ASSERT (errno == ENOENT);
+
+  errno = 0;
+  ASSERT (func (BASE "link4/", &st1) == -1);
+  ASSERT (errno == ELOOP);
+
+  /* Cleanup.  */
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (unlink (BASE "link1") == 0);
+  ASSERT (unlink (BASE "link2") == 0);
+  ASSERT (unlink (BASE "link3") == 0);
+  ASSERT (unlink (BASE "link4") == 0);
+  free (cwd);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f3df647f80ef1807dadd2e19febf44e35d2f3d00..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-stdbool.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9322b500b69eb3fb5db600e7ecb58af10afc5b97
--- /dev/null
@@ -0,0 +1,119 @@
+/* Test bool.
+   Copyright (C) 2002-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+/* Define ADDRESS_CHECK_OKAY if it is OK to assign an address to a 'bool'
+   and this does not generate a warning (because we want this test to succeed
+   even when using gcc's -Werror).  */
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) \
+    || (__clang_major__ >= 4)
+/* We can silence the warning.  */
+# pragma GCC diagnostic ignored "-Waddress"
+# define ADDRESS_CHECK_OKAY
+#elif defined __GNUC__ || defined __clang__
+/* There may be a warning.  */
+#else
+/* Ignore warnings from other compilers.  */
+# define ADDRESS_CHECK_OKAY
+#endif
+
+#include <config.h>
+
+#ifdef TEST_STDBOOL_H
+# include <stdbool.h>
+#endif
+
+#if false
+ "error: false is not 0"
+#endif
+#if true != 1
+ "error: true is not 1"
+#endif
+
+/* Several tests cannot be guaranteed with gnulib's <stdbool.h>, at
+   least, not for all compilers and compiler options.  */
+#if ((HAVE_C_BOOL || defined __cplusplus \
+      || HAVE_STDBOOL_H || 3 <= __GNUC__ || 4 <= __clang_major__) \
+     && !(defined _MSC_VER || defined __SUNPRO_C))
+# define WORKING_BOOL 1
+#else
+# define WORKING_BOOL 0
+#endif
+
+#if WORKING_BOOL
+struct s { bool s: 1; bool t; } s;
+#endif
+
+char a[true == 1 ? 1 : -1];
+char b[false == 0 ? 1 : -1];
+#if WORKING_BOOL
+char d[(bool) 0.5 == true ? 1 : -1];
+# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning.  */
+/* C99 may plausibly be interpreted as not requiring support for a cast from
+   a variable's address to bool in a static initializer.  So treat it like a
+   GCC extension.  */
+#  if defined __GNUC__ || defined __clang__
+bool e = &s;
+#  endif
+# endif
+char f[(bool) 0.0 == false ? 1 : -1];
+#endif
+char g[true];
+char h[sizeof (bool)];
+#if WORKING_BOOL
+char i[sizeof s.t];
+#endif
+enum { j = false, k = true, l = false * true, m = true * 256 };
+bool n[m];
+char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+char p[-1 - (bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+/* Catch a bug in an HP-UX C compiler.  See
+   https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+   https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html
+ */
+bool q = true;
+bool *pq = &q;
+
+int
+main ()
+{
+  int error = 0;
+
+#if WORKING_BOOL
+# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning.  */
+  /* A cast from a variable's address to bool is valid in expressions.  */
+  {
+    bool e1 = &s;
+    if (!e1)
+      error = 1;
+  }
+# endif
+#endif
+
+  /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+     reported by James Lemley on 2005-10-05; see
+     https://lists.gnu.org/r/bug-coreutils/2005-10/msg00086.html
+     This is a runtime test, since a corresponding compile-time
+     test would rely on initializer extensions.  */
+  {
+    char digs[] = "0123456789";
+    if (&(digs + 5)[-2 + (bool) 1] != &digs[4])
+      error = 1;
+  }
+
+  return error;
+}
deleted file mode 120000 (symlink)
index 7f9be160aef01154c6e05b3e175b826db1223575..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-stdckdint.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f0a576f6ebf7b780c433f1ea5920a71bc879eb56
--- /dev/null
@@ -0,0 +1,30 @@
+/* Test <stdckdint.h>.
+   Copyright 2022-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* Tell test-intprops.c to test <stdckdint.h> instead of <intprops.h>.  */
+
+#define TEST_STDCKDINT 1
+
+#define INT_ADD_WRAPV(a, b, r) ckd_add (r, a, b)
+#define INT_SUBTRACT_WRAPV(a, b, r) ckd_sub (r, a, b)
+#define INT_MULTIPLY_WRAPV(a, b, r) ckd_mul (r, a, b)
+
+/* Luckily, test-intprops.c uses INT_NEGATE_OVERFLOW only on INT_MIN.  */
+#define INT_NEGATE_OVERFLOW(a) ((a) < -INT_MAX)
+
+#include "test-intprops.c"
deleted file mode 120000 (symlink)
index 16ac5135b222ad1ec62339ae4736980eede70b94..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-stddef.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5bceb18a29150363fd58b4a25f69f67907ce3cae
--- /dev/null
@@ -0,0 +1,100 @@
+/* Test of <stddef.h> substitute.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <stddef.h>
+
+/* Check that appropriate types are defined.  */
+wchar_t a = 'c';
+ptrdiff_t b = 1;
+size_t c = 2;
+max_align_t mat;
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+static_assert (sizeof NULL == sizeof (void *));
+
+/* Check that offsetof produces integer constants with correct type.  */
+struct d
+{
+  char e;
+  char f;
+};
+/* Solaris 10 has a bug where offsetof is under-parenthesized, and
+   cannot be used as an arbitrary expression.  However, since it is
+   unlikely to bite real code, we ignore that short-coming.  */
+/* static_assert (sizeof offsetof (struct d, e) == sizeof (size_t)); */
+static_assert (sizeof (offsetof (struct d, e)) == sizeof (size_t));
+static_assert (offsetof (struct d, f) == 1);
+
+/* Check max_align_t's alignment.  */
+static_assert (alignof (double) <= alignof (max_align_t));
+static_assert (alignof (int) <= alignof (max_align_t));
+static_assert (alignof (long double) <= alignof (max_align_t));
+static_assert (alignof (long int) <= alignof (max_align_t));
+static_assert (alignof (ptrdiff_t) <= alignof (max_align_t));
+static_assert (alignof (size_t) <= alignof (max_align_t));
+static_assert (alignof (wchar_t) <= alignof (max_align_t));
+static_assert (alignof (struct d) <= alignof (max_align_t));
+#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__
+static_assert (__alignof__ (double) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (int) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (long double) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (long int) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (ptrdiff_t) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (size_t) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (wchar_t) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (struct d) <= __alignof__ (max_align_t));
+#endif
+
+int test_unreachable_optimization (int x);
+_Noreturn void test_unreachable_noreturn (void);
+
+int
+test_unreachable_optimization (int x)
+{
+  /* Check that the compiler uses 'unreachable' for optimization.
+     This function, when compiled with optimization, should have code
+     equivalent to
+       return x + 3;
+     Use 'objdump --disassemble test-stddef.o' to verify this.  */
+  if (x < 4)
+    unreachable ();
+  return (x > 1 ? x + 3 : 2 * x + 10);
+}
+
+_Noreturn void
+test_unreachable_noreturn (void)
+{
+  /* Check that the compiler's data-flow analysis recognizes 'unreachable ()'.
+     This function should not elicit a warning.  */
+  unreachable ();
+}
+
+#include <limits.h> /* INT_MAX */
+
+/* offsetof promotes to an unsigned integer if and only if sizes do
+   not fit in int.  */
+static_assert ((offsetof (struct d, e) < -1) == (INT_MAX < (size_t) -1));
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index a4b5d6cfcd379dd365914750c5cd5e5b22b6976e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-stdint.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..47bedc8959fe51307a4dbd24aca521de36d6d0a3
--- /dev/null
@@ -0,0 +1,437 @@
+/* Test of <stdint.h> substitute.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2006.  */
+
+#include <config.h>
+
+/* Whether to enable pedantic checks. */
+#define DO_PEDANTIC 0
+
+#include <stdint.h>
+
+#include "verify.h"
+#include "intprops.h"
+
+#if ((__GNUC__ >= 2) || (__clang_major__ >= 4)) && DO_PEDANTIC
+# define verify_same_types(expr1,expr2)  \
+    extern void _verify_func(__LINE__) (__typeof__ (expr1) *); \
+    extern void _verify_func(__LINE__) (__typeof__ (expr2) *);
+# define _verify_func(line) _verify_func2(line)
+# define _verify_func2(line) verify_func_ ## line
+#else
+# define verify_same_types(expr1,expr2) extern void verify_func (int)
+#endif
+
+/* 7.18.1.1. Exact-width integer types */
+/* 7.18.2.1. Limits of exact-width integer types */
+
+int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX };
+verify (TYPE_MINIMUM (int8_t) == INT8_MIN);
+verify (TYPE_MAXIMUM (int8_t) == INT8_MAX);
+verify_same_types (INT8_MIN, (int8_t) 0 + 0);
+verify_same_types (INT8_MAX, (int8_t) 0 + 0);
+
+int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX };
+verify (TYPE_MINIMUM (int16_t) == INT16_MIN);
+verify (TYPE_MAXIMUM (int16_t) == INT16_MAX);
+verify_same_types (INT16_MIN, (int16_t) 0 + 0);
+verify_same_types (INT16_MAX, (int16_t) 0 + 0);
+
+int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX };
+verify (TYPE_MINIMUM (int32_t) == INT32_MIN);
+verify (TYPE_MAXIMUM (int32_t) == INT32_MAX);
+verify_same_types (INT32_MIN, (int32_t) 0 + 0);
+verify_same_types (INT32_MAX, (int32_t) 0 + 0);
+
+#ifdef INT64_MAX
+int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX };
+verify (TYPE_MINIMUM (int64_t) == INT64_MIN);
+verify (TYPE_MAXIMUM (int64_t) == INT64_MAX);
+verify_same_types (INT64_MIN, (int64_t) 0 + 0);
+verify_same_types (INT64_MAX, (int64_t) 0 + 0);
+#endif
+
+uint8_t b1[2] = { UINT8_C (17), UINT8_MAX };
+verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX);
+verify_same_types (UINT8_MAX, (uint8_t) 0 + 0);
+
+uint16_t b2[2] = { UINT16_C (17), UINT16_MAX };
+verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX);
+verify_same_types (UINT16_MAX, (uint16_t) 0 + 0);
+
+uint32_t b3[2] = { UINT32_C (17), UINT32_MAX };
+verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX);
+verify_same_types (UINT32_MAX, (uint32_t) 0 + 0);
+
+#ifdef UINT64_MAX
+uint64_t b4[2] = { UINT64_C (17), UINT64_MAX };
+verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX);
+verify_same_types (UINT64_MAX, (uint64_t) 0 + 0);
+#endif
+
+#if INT8_MIN && INT8_MAX && INT16_MIN && INT16_MAX && INT32_MIN && INT32_MAX
+/* ok */
+#else
+err or;
+#endif
+
+#if UINT8_MAX && UINT16_MAX && UINT32_MAX
+/* ok */
+#else
+err or;
+#endif
+
+/* 7.18.1.2. Minimum-width integer types */
+/* 7.18.2.2. Limits of minimum-width integer types */
+
+int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX };
+verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN);
+verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX);
+verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0);
+verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0);
+
+int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX };
+verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN);
+verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX);
+verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0);
+verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0);
+
+int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX };
+verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN);
+verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX);
+verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0);
+verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0);
+
+#ifdef INT_LEAST64_MAX
+int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX };
+verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN);
+verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX);
+verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0);
+verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0);
+#endif
+
+uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX };
+verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX);
+verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0);
+
+uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX };
+verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX);
+verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0);
+
+uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX };
+verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX);
+verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0);
+
+#ifdef UINT_LEAST64_MAX
+uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX };
+verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX);
+verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0);
+#endif
+
+#if INT_LEAST8_MIN && INT_LEAST8_MAX && INT_LEAST16_MIN && INT_LEAST16_MAX && INT_LEAST32_MIN && INT_LEAST32_MAX
+/* ok */
+#else
+err or;
+#endif
+
+#if UINT_LEAST8_MAX && UINT_LEAST16_MAX && UINT_LEAST32_MAX
+/* ok */
+#else
+err or;
+#endif
+
+/* 7.18.1.3. Fastest minimum-width integer types */
+/* 7.18.2.3. Limits of fastest minimum-width integer types */
+
+int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX };
+verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN);
+verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX);
+verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0);
+verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0);
+
+int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX };
+verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN);
+verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX);
+verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0);
+verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0);
+
+int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX };
+verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN);
+verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX);
+verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0);
+verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0);
+
+#ifdef INT_FAST64_MAX
+int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX };
+verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN);
+verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX);
+verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0);
+verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0);
+#endif
+
+uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX };
+verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX);
+verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0);
+
+uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX };
+verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX);
+verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0);
+
+uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX };
+verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX);
+verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0);
+
+#ifdef UINT_FAST64_MAX
+uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX };
+verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX);
+verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0);
+#endif
+
+#if INT_FAST8_MIN && INT_FAST8_MAX && INT_FAST16_MIN && INT_FAST16_MAX && INT_FAST32_MIN && INT_FAST32_MAX
+/* ok */
+#else
+err or;
+#endif
+
+#if UINT_FAST8_MAX && UINT_FAST16_MAX && UINT_FAST32_MAX
+/* ok */
+#else
+err or;
+#endif
+
+/* 7.18.1.4. Integer types capable of holding object pointers */
+/* 7.18.2.4. Limits of integer types capable of holding object pointers */
+
+#ifdef INTPTR_MAX
+intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX };
+verify (sizeof (void *) <= sizeof (intptr_t));
+# ifndef __CHERI_PURE_CAPABILITY__
+verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN);
+verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX);
+# endif
+verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0);
+verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0);
+#endif
+
+#ifdef UINTPTR_MAX
+uintptr_t h[2] = { 17, UINTPTR_MAX };
+verify (sizeof (void *) <= sizeof (uintptr_t));
+# ifndef __CHERI_PURE_CAPABILITY__
+verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX);
+# endif
+verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0);
+#endif
+
+/* 7.18.1.5. Greatest-width integer types */
+/* 7.18.2.5. Limits of greatest-width integer types */
+
+intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX };
+verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN);
+verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX);
+verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0);
+verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0);
+
+uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX };
+verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX);
+verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0);
+
+/* Older Sun C and HP-UX 10.20 cc don't support 'long long' constants in
+   the preprocessor.  */
+#if !((defined __SUNPRO_C && __SUNPRO_C < 0x5150) \
+      || (defined __hpux && !defined __GNUC__))
+#if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX
+/* ok */
+#else
+err or;
+#endif
+#endif
+
+/* 7.18.3. Limits of other integer types */
+
+#include <stddef.h>
+
+verify (TYPE_MINIMUM (ptrdiff_t) == PTRDIFF_MIN);
+verify (TYPE_MAXIMUM (ptrdiff_t) == PTRDIFF_MAX);
+verify_same_types (PTRDIFF_MIN, (ptrdiff_t) 0 + 0);
+verify_same_types (PTRDIFF_MAX, (ptrdiff_t) 0 + 0);
+
+#if PTRDIFF_MIN && PTRDIFF_MAX
+/* ok */
+#else
+err or;
+#endif
+
+#include <signal.h>
+
+verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN);
+verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX);
+verify_same_types (SIG_ATOMIC_MIN, (sig_atomic_t) 0 + 0);
+verify_same_types (SIG_ATOMIC_MAX, (sig_atomic_t) 0 + 0);
+
+#if SIG_ATOMIC_MIN != 17 && SIG_ATOMIC_MAX
+/* ok */
+#else
+err or;
+#endif
+
+verify (TYPE_MAXIMUM (size_t) == SIZE_MAX);
+verify_same_types (SIZE_MAX, (size_t) 0 + 0);
+
+#if SIZE_MAX
+/* ok */
+#else
+err or;
+#endif
+
+#if HAVE_WCHAR_T
+verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN);
+verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX);
+verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0);
+verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0);
+
+# if WCHAR_MIN != 17 && WCHAR_MAX
+/* ok */
+# else
+err or;
+# endif
+#endif
+
+#if HAVE_WINT_T
+# include <wchar.h>
+
+verify (TYPE_MINIMUM (wint_t) == WINT_MIN);
+verify (TYPE_MAXIMUM (wint_t) == WINT_MAX);
+verify_same_types (WINT_MIN, (wint_t) 0 + 0);
+verify_same_types (WINT_MAX, (wint_t) 0 + 0);
+
+# if WINT_MIN != 17 && WINT_MAX
+/* ok */
+# else
+err or;
+# endif
+#endif
+
+/* 7.18.4. Macros for integer constants */
+
+verify (INT8_C (17) == 17);
+verify_same_types (INT8_C (17), (int_least8_t)0 + 0);
+verify (UINT8_C (17) == 17);
+verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0);
+
+verify (INT16_C (17) == 17);
+verify_same_types (INT16_C (17), (int_least16_t)0 + 0);
+verify (UINT16_C (17) == 17);
+verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0);
+
+verify (INT32_C (17) == 17);
+verify_same_types (INT32_C (17), (int_least32_t)0 + 0);
+verify (UINT32_C (17) == 17);
+verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0);
+
+#ifdef INT64_C
+verify (INT64_C (17) == 17);
+verify_same_types (INT64_C (17), (int_least64_t)0 + 0);
+#endif
+#ifdef UINT64_C
+verify (UINT64_C (17) == 17);
+verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0);
+#endif
+
+verify (INTMAX_C (17) == 17);
+verify_same_types (INTMAX_C (17), (intmax_t)0 + 0);
+verify (UINTMAX_C (17) == 17);
+verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
+
+/* Use _GL_VERIFY (with a fixed-length diagnostic string) rather than verify,
+   because the latter would require forming each stringified expression, and
+   many of these would be so long as to trigger a warning/error like this:
+
+   test-stdint.c:407:1: error: string length '6980' is greater than the \
+     length '4095' ISO C99 compilers are required to support \
+     [-Werror=overlength-strings]
+  */
+#define verify_width(width, min, max) \
+  _GL_VERIFY ((max) >> ((width) - 1 - ((min) < 0)) == 1, \
+              "verify_width check", -)
+
+/* Macros specified by ISO/IEC TS 18661-1:2014.  */
+
+#ifdef INT8_MAX
+verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX);
+#endif
+#ifdef UINT8_MAX
+verify_width (UINT8_WIDTH, 0, UINT8_MAX);
+#endif
+#ifdef INT16_MAX
+verify_width (INT16_WIDTH, INT16_MIN, INT16_MAX);
+#endif
+#ifdef UINT16_MAX
+verify_width (UINT16_WIDTH, 0, UINT16_MAX);
+#endif
+#ifdef INT32_MAX
+verify_width (INT32_WIDTH, INT32_MIN, INT32_MAX);
+#endif
+#ifdef UINT32_MAX
+verify_width (UINT32_WIDTH, 0, UINT32_MAX);
+#endif
+#ifdef INT64_MAX
+verify_width (INT64_WIDTH, INT64_MIN, INT64_MAX);
+#endif
+#ifdef UINT64_MAX
+verify_width (UINT64_WIDTH, 0, UINT64_MAX);
+#endif
+verify_width (INT_LEAST8_WIDTH, INT_LEAST8_MIN, INT_LEAST8_MAX);
+verify_width (UINT_LEAST8_WIDTH, 0, UINT_LEAST8_MAX);
+verify_width (INT_LEAST16_WIDTH, INT_LEAST16_MIN, INT_LEAST16_MAX);
+verify_width (UINT_LEAST16_WIDTH, 0, UINT_LEAST16_MAX);
+verify_width (INT_LEAST32_WIDTH, INT_LEAST32_MIN, INT_LEAST32_MAX);
+verify_width (UINT_LEAST32_WIDTH, 0, UINT_LEAST32_MAX);
+verify_width (INT_LEAST64_WIDTH, INT_LEAST64_MIN, INT_LEAST64_MAX);
+verify_width (UINT_LEAST64_WIDTH, 0, UINT_LEAST64_MAX);
+verify_width (INT_FAST8_WIDTH, INT_FAST8_MIN, INT_FAST8_MAX);
+verify_width (UINT_FAST8_WIDTH, 0, UINT_FAST8_MAX);
+verify_width (INT_FAST16_WIDTH, INT_FAST16_MIN, INT_FAST16_MAX);
+verify_width (UINT_FAST16_WIDTH, 0, UINT_FAST16_MAX);
+verify_width (INT_FAST32_WIDTH, INT_FAST32_MIN, INT_FAST32_MAX);
+verify_width (UINT_FAST32_WIDTH, 0, UINT_FAST32_MAX);
+verify_width (INT_FAST64_WIDTH, INT_FAST64_MIN, INT_FAST64_MAX);
+verify_width (UINT_FAST64_WIDTH, 0, UINT_FAST64_MAX);
+#ifndef __CHERI_PURE_CAPABILITY__
+# ifdef INTPTR_WIDTH
+verify_width (INTPTR_WIDTH, INTPTR_MIN, INTPTR_MAX);
+# endif
+# ifdef UINTPTR_WIDTH
+verify_width (UINTPTR_WIDTH, 0, UINTPTR_MAX);
+# endif
+#endif
+verify_width (INTMAX_WIDTH, INTMAX_MIN, INTMAX_MAX);
+verify_width (UINTMAX_WIDTH, 0, UINTMAX_MAX);
+verify_width (PTRDIFF_WIDTH, PTRDIFF_MIN, PTRDIFF_MAX);
+verify_width (SIZE_WIDTH, 0, SIZE_MAX);
+verify_width (WCHAR_WIDTH, WCHAR_MIN, WCHAR_MAX);
+#ifdef WINT_MAX
+verify_width (WINT_WIDTH, WINT_MIN, WINT_MAX);
+#endif
+#ifdef SIG_ATOMIC_MAX
+verify_width (SIG_ATOMIC_WIDTH, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX);
+#endif
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 670cff03ae1c59f750a413e4e5487830e5816bcb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-stdio.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..499695206bafaf92997b33d753ae332d25476b56
--- /dev/null
@@ -0,0 +1,93 @@
+/* Test of <stdio.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+/* Check that the various SEEK_* macros are defined.  */
+int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+
+/* Check that the _PRINTF_NAN_LEN_MAX macro is defined.  */
+int pnlm[] = { _PRINTF_NAN_LEN_MAX };
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+static_assert (sizeof NULL == sizeof (void *));
+
+/* Check that the types are all defined.  */
+fpos_t t1;
+off_t t2;
+size_t t3;
+ssize_t t4;
+va_list t5;
+
+#include <string.h>
+
+#include "signed-nan.h"
+#include "signed-snan.h"
+#include "macros.h"
+
+int
+main (void)
+{
+  {
+    double value1;
+    char buf[64];
+
+    value1 = positive_NaNd();
+    sprintf (buf, "%g", value1);
+    ASSERT (strlen (buf) <= _PRINTF_NAN_LEN_MAX);
+
+    value1 = negative_NaNd();
+    sprintf (buf, "%g", value1);
+    ASSERT (strlen (buf) <= _PRINTF_NAN_LEN_MAX);
+  }
+#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
+  /* Check the value of _PRINTF_NAN_LEN_MAX.  */
+  {
+    double value1;
+    memory_double value2;
+    char buf[64];
+
+    value1 = positive_SNaNd();
+    sprintf (buf, "%g", value1);
+    ASSERT (strlen (buf) <= _PRINTF_NAN_LEN_MAX);
+
+    value1 = negative_SNaNd();
+    sprintf (buf, "%g", value1);
+    ASSERT (strlen (buf) <= _PRINTF_NAN_LEN_MAX);
+
+    value2.value = positive_NaNd ();
+    #if DBL_EXPBIT0_BIT == 20
+    value2.word[DBL_EXPBIT0_WORD] ^= 0x54321;
+    #endif
+    sprintf (buf, "%g", value2.value);
+    ASSERT (strlen (buf) <= _PRINTF_NAN_LEN_MAX);
+
+    value2.value = negative_NaNd ();
+    #if DBL_EXPBIT0_BIT == 20
+    value2.word[DBL_EXPBIT0_WORD] ^= 0x54321;
+    #endif
+    sprintf (buf, "%g", value2.value);
+    ASSERT (strlen (buf) <= _PRINTF_NAN_LEN_MAX);
+  }
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index ba7d76b1986de739cf0d6f72db81d624a0eb1bfe..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-stdlib.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cb6db8028fe602f8344eb0f9ecd1559717581292
--- /dev/null
@@ -0,0 +1,63 @@
+/* Test of <stdlib.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+/* Check that EXIT_SUCCESS is 0, per POSIX.  */
+static int exitcode = EXIT_SUCCESS;
+#if EXIT_SUCCESS
+"oops"
+#endif
+
+/* Check for GNU value (not guaranteed by POSIX, but is guaranteed by
+   gnulib).  */
+#if EXIT_FAILURE != 1
+"oops"
+#endif
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+static_assert (sizeof NULL == sizeof (void *));
+
+#if GNULIB_TEST_SYSTEM_POSIX
+# include "test-sys_wait.h"
+#else
+# define test_sys_wait_macros() 0
+#endif
+
+int
+main (void)
+{
+  /* POSIX:2018 says:
+     "In the POSIX locale the value of MB_CUR_MAX shall be 1."  */
+  /* On Android ≥ 5.0, the default locale is the "C.UTF-8" locale, not the
+     "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
+     locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
+     that is, effectively the "C.UTF-8" locale.  */
+#ifndef __ANDROID__
+  if (MB_CUR_MAX != 1)
+    return 1;
+#endif
+
+  if (test_sys_wait_macros ())
+    return 2;
+
+  return exitcode;
+}
deleted file mode 120000 (symlink)
index 0d543d536c229858e30ed42f0581c9020d5d089c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-strerror.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3074b5cd0de2e9f7ba7a7d05a813c1644c784a03
--- /dev/null
@@ -0,0 +1,75 @@
+/* Test of strerror() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2007.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (strerror, char *, (int));
+
+#include <errno.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  char *str;
+
+  errno = 0;
+  str = strerror (EACCES);
+  ASSERT (str);
+  ASSERT (*str);
+  ASSERT (errno == 0);
+
+  errno = 0;
+  str = strerror (ETIMEDOUT);
+  ASSERT (str);
+  ASSERT (*str);
+  ASSERT (errno == 0);
+
+  errno = 0;
+  str = strerror (EOVERFLOW);
+  ASSERT (str);
+  ASSERT (*str);
+  ASSERT (errno == 0);
+
+  /* POSIX requires strerror (0) to succeed.  Reject use of "Unknown
+     error", but allow "Success", "No error", or even Solaris' "Error
+     0" which are distinct patterns from true out-of-range strings.
+     http://austingroupbugs.net/view.php?id=382  */
+  errno = 0;
+  str = strerror (0);
+  ASSERT (str);
+  ASSERT (*str);
+  ASSERT (errno == 0);
+  ASSERT (strstr (str, "nknown") == NULL);
+  ASSERT (strstr (str, "ndefined") == NULL);
+
+  /* POSIX requires strerror to produce a non-NULL result for all
+     inputs; as an extension, we also guarantee a non-empty result.
+     Reporting EINVAL is optional.  */
+  errno = 0;
+  str = strerror (-3);
+  ASSERT (str);
+  ASSERT (*str);
+  ASSERT (errno == 0 || errno == EINVAL);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 9d6c4e97a94f7235b26f099937732e211f4f2df8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-strerror_r.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4b4e27f4a872b67c3556a6a0c665e087115967c7
--- /dev/null
@@ -0,0 +1,178 @@
+/* Test of strerror_r() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (strerror_r, int, (int, char *, size_t));
+
+#include <errno.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  char buf[100];
+  int ret;
+
+  /* Test results with valid errnum and enough room.  */
+
+  errno = 0;
+  buf[0] = '\0';
+  ASSERT (strerror_r (EACCES, buf, sizeof buf) == 0);
+  ASSERT (buf[0] != '\0');
+  ASSERT (errno == 0);
+  ASSERT (strlen (buf) < sizeof buf);
+
+  errno = 0;
+  buf[0] = '\0';
+  ASSERT (strerror_r (ETIMEDOUT, buf, sizeof buf) == 0);
+  ASSERT (buf[0] != '\0');
+  ASSERT (errno == 0);
+  ASSERT (strlen (buf) < sizeof buf);
+
+  errno = 0;
+  buf[0] = '\0';
+  ASSERT (strerror_r (EOVERFLOW, buf, sizeof buf) == 0);
+  ASSERT (buf[0] != '\0');
+  ASSERT (errno == 0);
+  ASSERT (strlen (buf) < sizeof buf);
+
+  /* POSIX requires strerror (0) to succeed.  Reject use of "Unknown
+     error", but allow "Success", "No error", or even Solaris' "Error
+     0" which are distinct patterns from true out-of-range strings.
+     http://austingroupbugs.net/view.php?id=382  */
+  errno = 0;
+  buf[0] = '\0';
+  ret = strerror_r (0, buf, sizeof buf);
+  ASSERT (ret == 0);
+  ASSERT (buf[0]);
+  ASSERT (errno == 0);
+  ASSERT (strstr (buf, "nknown") == NULL);
+  ASSERT (strstr (buf, "ndefined") == NULL);
+
+  /* Test results with out-of-range errnum and enough room.  POSIX
+     allows an empty string on success, and allows an unchanged buf on
+     error, but these are not useful, so we guarantee contents.  */
+  errno = 0;
+  buf[0] = '^';
+  ret = strerror_r (-3, buf, sizeof buf);
+  ASSERT (ret == 0 || ret == EINVAL);
+  ASSERT (buf[0] != '^');
+  ASSERT (*buf);
+  ASSERT (errno == 0);
+  ASSERT (strlen (buf) < sizeof buf);
+
+  /* Test results with a too small buffer.  POSIX requires an error;
+     only ERANGE for 0 and valid errors, and a choice of ERANGE or
+     EINVAL for out-of-range values.  On error, POSIX permits buf to
+     be empty, unchanged, or unterminated, but these are not useful,
+     so we guarantee NUL-terminated truncated contents for all but
+     size 0.  http://austingroupbugs.net/view.php?id=398.  Also ensure
+     that no out-of-bounds writes occur.  */
+  {
+    int errs[] = { EACCES, 0, -3, };
+    int j;
+
+    buf[sizeof buf - 1] = '\0';
+    for (j = 0; j < SIZEOF (errs); j++)
+      {
+        int err = errs[j];
+        char buf2[sizeof buf] = "";
+        size_t len;
+        size_t i;
+
+        strerror_r (err, buf2, sizeof buf2);
+        len = strlen (buf2);
+        ASSERT (len < sizeof buf);
+
+        for (i = 0; i <= len; i++)
+          {
+            memset (buf, '^', sizeof buf - 1);
+            errno = 0;
+            ret = strerror_r (err, buf, i);
+            ASSERT (errno == 0);
+            if (j == 2)
+              ASSERT (ret == ERANGE || ret == EINVAL);
+            else
+              ASSERT (ret == ERANGE);
+            if (i)
+              {
+                ASSERT (strncmp (buf, buf2, i - 1) == 0);
+                ASSERT (buf[i - 1] == '\0');
+              }
+            ASSERT (strspn (buf + i, "^") == sizeof buf - 1 - i);
+          }
+
+        strcpy (buf, "BADFACE");
+        errno = 0;
+        ret = strerror_r (err, buf, len + 1);
+        ASSERT (ret != ERANGE);
+        ASSERT (errno == 0);
+        ASSERT (strcmp (buf, buf2) == 0);
+      }
+  }
+
+#if GNULIB_STRERROR
+  /* Test that strerror_r does not clobber strerror buffer.  On some
+     platforms, this test can only succeed if gnulib also replaces
+     strerror.  */
+  {
+    const char *msg1;
+    const char *msg2;
+    const char *msg3;
+    const char *msg4;
+    char *str1;
+    char *str2;
+    char *str3;
+    char *str4;
+
+    msg1 = strerror (ENOENT);
+    ASSERT (msg1);
+    str1 = strdup (msg1);
+    ASSERT (str1);
+
+    msg2 = strerror (ERANGE);
+    ASSERT (msg2);
+    str2 = strdup (msg2);
+    ASSERT (str2);
+
+    msg3 = strerror (-4);
+    ASSERT (msg3);
+    str3 = strdup (msg3);
+    ASSERT (str3);
+
+    msg4 = strerror (1729576);
+    ASSERT (msg4);
+    str4 = strdup (msg4);
+    ASSERT (str4);
+
+    strerror_r (EACCES, buf, sizeof buf);
+    strerror_r (-5, buf, sizeof buf);
+    ASSERT (STREQ (msg4, str4));
+
+    free (str1);
+    free (str2);
+    free (str3);
+    free (str4);
+  }
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b514b154f88ceefea1bfe062b08d9681a5d957dc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-string.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..053c2e4aedd4a3c9de8ebd56ceeb117ab0a98d94
--- /dev/null
@@ -0,0 +1,31 @@
+/* Test of <string.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <string.h>
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+static_assert (sizeof NULL == sizeof (void *));
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 58835df6ed69e0969e62433cf61a0c9e08165fbf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-strnlen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0c85b8fc14f3d9aa1a41f091ab0030590c302691
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ * Written by Eric Blake
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (strnlen, size_t, (char const *, size_t));
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+int
+main (void)
+{
+  size_t i;
+  char *page_boundary = (char *) zerosize_ptr ();
+  if (!page_boundary)
+    {
+      page_boundary = malloc (0x1000);
+      ASSERT (page_boundary);
+      page_boundary += 0x1000;
+    }
+
+  /* Basic behavior tests.  */
+  ASSERT (strnlen ("a", 0) == 0);
+  ASSERT (strnlen ("a", 1) == 1);
+  ASSERT (strnlen ("a", 2) == 1);
+  ASSERT (strnlen ("", 0x100000) == 0);
+
+  /* Memory fence and alignment testing.  */
+  for (i = 0; i < 512; i++)
+    {
+      char *start = page_boundary - i;
+      size_t j = i;
+      memset (start, 'x', i);
+      do
+        {
+          if (i != j)
+            {
+              start[j] = 0;
+              ASSERT (strnlen (start, i + j) == j);
+            }
+          ASSERT (strnlen (start, i) == j);
+          ASSERT (strnlen (start, j) == j);
+        }
+      while (j--);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5ffce4a26874f27bf204b987df6f0616a9a41b7f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-strsignal.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3100e0b1c4f1f0eef402c7d3c465e6738dee8516
--- /dev/null
@@ -0,0 +1,79 @@
+/* Test of strsignal() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Colin Watson <cjwatson@debian.org>, 2008.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (strsignal, char *, (int));
+
+#include <signal.h>
+
+#include "macros.h"
+
+#if HAVE_DECL_SYS_SIGLIST
+# define ASSERT_DESCRIPTION(actual, expected)
+#else
+/* In this case, we can guarantee some signal descriptions.
+   But allow the actual result to be longer than the expected result.  */
+# define ASSERT_DESCRIPTION(actual, expected) \
+   ASSERT (strncmp (actual, expected, strlen (expected)) == 0)
+#endif
+
+int
+main (void)
+{
+  /* Work around bug in cygwin 1.5.25 <string.h> by declaring str as
+     const char *, even though strsignal is supposed to return char *.
+     At any rate, this doesn't hurt, since POSIX 200x states that "The
+     string pointed to shall not be modified by the application."  */
+  const char *str;
+
+  /* We try a couple of signals, since not all signals are supported
+     everywhere.  Notwithstanding the #ifdef for neatness, SIGINT should in
+     fact be available on all platforms.  */
+
+#ifdef SIGHUP
+  str = strsignal (SIGHUP);
+  ASSERT (str);
+  ASSERT (*str);
+  ASSERT_DESCRIPTION (str, "Hangup");
+#endif
+
+#ifdef SIGINT
+  str = strsignal (SIGINT);
+  ASSERT (str);
+  ASSERT (*str);
+  ASSERT_DESCRIPTION (str, "Interrupt");
+#endif
+
+  /* Test that for out-of-range signal numbers the result is usable.  */
+
+  str = strsignal (-1);
+  ASSERT (str);
+  ASSERT (str != (char *) -1);
+  ASSERT (strlen (str));
+
+  str = strsignal (9249234);
+  ASSERT (str);
+  ASSERT (str != (char *) -1);
+  ASSERT (strlen (str));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 69c261db7fc7e43e93270cd3a1a0cf397f96068c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-strtoimax.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..184da300488946cba84daebd8326bcd6e209455d
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <inttypes.h>
+
+#include "signature.h"
+#ifndef strtoimax
+SIGNATURE_CHECK (strtoimax, intmax_t, (const char *, char **, int));
+#endif
+
+#include <errno.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Subject sequence empty or invalid.  */
+  {
+    const char input[] = "";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " ";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " +";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " -";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+
+  /* Simple integer values.  */
+  {
+    const char input[] = "0";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "+0";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-0";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "23";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = " 23";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "+23";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-23";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == -23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+
+  /* Large integer values.  */
+  {
+    const char input[] = "2147483647";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == 2147483647);
+    ASSERT (ptr == input + 10);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-2147483648";
+    char *ptr;
+    intmax_t result;
+    errno = 0;
+    result = strtoimax (input, &ptr, 10);
+    ASSERT (result == -2147483647 - 1);
+    ASSERT (ptr == input + 11);
+    ASSERT (errno == 0);
+  }
+  if (sizeof (intmax_t) > sizeof (int))
+    {
+      const char input[] = "4294967295";
+      char *ptr;
+      intmax_t result;
+      errno = 0;
+      result = strtoimax (input, &ptr, 10);
+      ASSERT (result == (intmax_t) 65535 * (intmax_t) 65537);
+      ASSERT (ptr == input + 10);
+      ASSERT (errno == 0);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index bc3d40e1e953f2a93f486efe25ffd8b08b695ba0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-strtoll.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b15070227b1e002c7b81dc3f413ae43bea053428
--- /dev/null
@@ -0,0 +1,305 @@
+/*
+ * Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "signature.h"
+#ifndef strtoll
+SIGNATURE_CHECK (strtoll, long long, (const char *, char **, int));
+#endif
+
+#include <errno.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Subject sequence empty or invalid.  */
+  {
+    const char input[] = "";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " ";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " +";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " -";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+
+  /* Simple integer values.  */
+  {
+    const char input[] = "0";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "+0";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-0";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "23";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = " 23";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "+23";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-23";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == -23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+
+  /* Large integer values.  */
+  {
+    const char input[] = "2147483647";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 2147483647);
+    ASSERT (ptr == input + 10);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-2147483648";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == -2147483647 - 1);
+    ASSERT (ptr == input + 11);
+    ASSERT (errno == 0);
+  }
+  if (sizeof (long long) > sizeof (int))
+    {
+      const char input[] = "4294967295";
+      char *ptr;
+      long long result;
+      errno = 0;
+      result = strtoll (input, &ptr, 10);
+      ASSERT (result == 65535LL * 65537LL);
+      ASSERT (ptr == input + 10);
+      ASSERT (errno == 0);
+    }
+
+  /* Hexadecimal integer syntax.  */
+  {
+    const char input[] = "0x2A";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0LL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x2A";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 16);
+    ASSERT (result == 42LL);
+    ASSERT (ptr == input + 4);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x2A";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 0);
+    ASSERT (result == 42LL);
+    ASSERT (ptr == input + 4);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0LL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 16);
+    ASSERT (result == 0LL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 0);
+    ASSERT (result == 0LL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+
+  /* Binary integer syntax.  */
+  {
+    const char input[] = "0b111010";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0LL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b111010";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 2);
+    ASSERT (result == 58LL);
+    ASSERT (ptr == input + 8);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b111010";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 0);
+    ASSERT (result == 58LL);
+    ASSERT (ptr == input + 8);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 10);
+    ASSERT (result == 0LL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 2);
+    ASSERT (result == 0LL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b";
+    char *ptr;
+    long long result;
+    errno = 0;
+    result = strtoll (input, &ptr, 0);
+    ASSERT (result == 0LL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c87aab4fba4618cf741d01e5e9ad1bb56287346f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-strtoull.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9f0f22c289fcf383376ec99dfebda7b31654f01d
--- /dev/null
@@ -0,0 +1,304 @@
+/*
+ * Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "signature.h"
+#ifndef strtoull
+SIGNATURE_CHECK (strtoull, unsigned long long, (const char *, char **, int));
+#endif
+
+#include <errno.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Subject sequence empty or invalid.  */
+  {
+    const char input[] = "";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " ";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " +";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " -";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+
+  /* Simple integer values.  */
+  {
+    const char input[] = "0";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "+0";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-0";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "23";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = " 23";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "+23";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-23";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == - 23ULL);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+
+  /* Large integer values.  */
+  {
+    const char input[] = "2147483647";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 2147483647);
+    ASSERT (ptr == input + 10);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-2147483648";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == - 2147483648ULL);
+    ASSERT (ptr == input + 11);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "4294967295";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 4294967295U);
+    ASSERT (ptr == input + 10);
+    ASSERT (errno == 0);
+  }
+
+  /* Hexadecimal integer syntax.  */
+  {
+    const char input[] = "0x2A";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0ULL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x2A";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 16);
+    ASSERT (result == 42ULL);
+    ASSERT (ptr == input + 4);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x2A";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 0);
+    ASSERT (result == 42ULL);
+    ASSERT (ptr == input + 4);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0ULL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 16);
+    ASSERT (result == 0ULL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0x";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 0);
+    ASSERT (result == 0ULL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+
+  /* Binary integer syntax.  */
+  {
+    const char input[] = "0b111010";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0ULL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b111010";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 2);
+    ASSERT (result == 58ULL);
+    ASSERT (ptr == input + 8);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b111010";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 0);
+    ASSERT (result == 58ULL);
+    ASSERT (ptr == input + 8);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 10);
+    ASSERT (result == 0ULL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 2);
+    ASSERT (result == 0ULL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "0b";
+    char *ptr;
+    unsigned long long result;
+    errno = 0;
+    result = strtoull (input, &ptr, 0);
+    ASSERT (result == 0ULL);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 087e4ca2abb29e775999103c3433f52c12c8193c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-strtoumax.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..82ff12d82db7bd675d999a025fed31c52aef49fe
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <inttypes.h>
+
+#include "signature.h"
+#ifndef strtoumax
+SIGNATURE_CHECK (strtoumax, uintmax_t, (const char *, char **, int));
+#endif
+
+#include <errno.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Subject sequence empty or invalid.  */
+  {
+    const char input[] = "";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " ";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " +";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+  {
+    const char input[] = " -";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input);
+    ASSERT (errno == 0 || errno == EINVAL);
+  }
+
+  /* Simple integer values.  */
+  {
+    const char input[] = "0";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 1);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "+0";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-0";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 0);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "23";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 2);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = " 23";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "+23";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-23";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == - (uintmax_t) 23);
+    ASSERT (ptr == input + 3);
+    ASSERT (errno == 0);
+  }
+
+  /* Large integer values.  */
+  {
+    const char input[] = "2147483647";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 2147483647);
+    ASSERT (ptr == input + 10);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "-2147483648";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == - (uintmax_t) 2147483648U);
+    ASSERT (ptr == input + 11);
+    ASSERT (errno == 0);
+  }
+  {
+    const char input[] = "4294967295";
+    char *ptr;
+    uintmax_t result;
+    errno = 0;
+    result = strtoumax (input, &ptr, 10);
+    ASSERT (result == 4294967295U);
+    ASSERT (ptr == input + 10);
+    ASSERT (errno == 0);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index e3d35efb38f10599fe0aabb07242852bd037f49c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-symlink.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..04c3e7a837670277121fac6bcbeaec15c240ad3e
--- /dev/null
@@ -0,0 +1,46 @@
+/* Tests of symlink.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (symlink, int, (char const *, char const *));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-symlink.t"
+
+#include "test-symlink.h"
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_symlink (symlink, true);
+}
deleted file mode 120000 (symlink)
index b499ac95033695cd0806ab2569c65e8d41404ef7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-symlink.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a63faed714ea8d2ae7b369e817b9a2f14c623d9b
--- /dev/null
@@ -0,0 +1,96 @@
+/* Tests of symlink.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+/* This file is designed to test both symlink(a,b) and
+   symlinkat(a,AT_FDCWD,b).  FUNC is the function to test.  Assumes
+   that BASE and ASSERT are already defined, and that appropriate
+   headers are already included.  If PRINT, warn before skipping
+   symlink tests with status 77.  */
+
+static int
+test_symlink (int (*func) (char const *, char const *), bool print)
+{
+  if (func ("nowhere", BASE "link1"))
+    {
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+
+  /* Some systems allow the creation of 0-length symlinks as a synonym
+     for "."; but most reject it.  */
+  {
+    int status;
+    errno = 0;
+    status = func ("", BASE "link2");
+    if (status == -1)
+      ASSERT (errno == ENOENT || errno == EINVAL);
+    else
+      {
+        ASSERT (status == 0);
+        ASSERT (unlink (BASE "link2") == 0);
+      }
+  }
+
+  /* Sanity checks of failures.  */
+  errno = 0;
+  ASSERT (func ("nowhere", "") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("nowhere", ".") == -1);
+  ASSERT (errno == EEXIST || errno == EINVAL);
+  errno = 0;
+  ASSERT (func ("somewhere", BASE "link1") == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (func ("nowhere", BASE "link2/") == -1);
+  ASSERT (errno == ENOTDIR || errno == ENOENT);
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  errno = 0;
+  ASSERT (func ("nowhere", BASE "dir") == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (func ("nowhere", BASE "dir/") == -1);
+  ASSERT (errno == EEXIST || errno == EINVAL
+          || errno == ENOENT /* Lustre FS on Linux */);
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  errno = 0;
+  ASSERT (func ("nowhere", BASE "file") == -1);
+  ASSERT (errno == EEXIST);
+  errno = 0;
+  ASSERT (func ("nowhere", BASE "file/") == -1);
+  ASSERT (errno == EEXIST || errno == ENOTDIR || errno == ENOENT);
+
+  /* Trailing slash must always be rejected.  */
+  ASSERT (unlink (BASE "link1") == 0);
+  ASSERT (func (BASE "link2", BASE "link1") == 0);
+  errno = 0;
+  ASSERT (func (BASE "nowhere", BASE "link1/") == -1);
+  ASSERT (errno == EEXIST || errno == ENOTDIR || errno == ENOENT);
+  errno = 0;
+  ASSERT (unlink (BASE "link2") == -1);
+  ASSERT (errno == ENOENT);
+
+  /* Cleanup.  */
+  ASSERT (rmdir (BASE "dir") == 0);
+  ASSERT (unlink (BASE "file") == 0);
+  ASSERT (unlink (BASE "link1") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 01a020bf576440eeef8e0407b8931983a894d40b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-symlinkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..86d2558f637b67d455446945fc3fac65d0db0e20
--- /dev/null
@@ -0,0 +1,88 @@
+/* Tests of symlinkat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (symlinkat, int, (char const *, int, char const *));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#ifndef HAVE_SYMLINK
+# define HAVE_SYMLINK 0
+#endif
+
+#define BASE "test-symlinkat.t"
+
+#include "test-symlink.h"
+
+static int dfd = AT_FDCWD;
+
+static int
+do_symlink (char const *contents, char const *name)
+{
+  return symlinkat (contents, dfd, name);
+}
+
+int
+main (void)
+{
+  int result;
+
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (symlinkat ("foo", -1, "bar") == -1);
+    ASSERT (errno == EBADF
+            || errno == ENOSYS /* seen on mingw */
+           );
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (symlinkat ("foo", 99, "bar") == -1);
+    ASSERT (errno == EBADF
+            || errno == ENOSYS /* seen on mingw */
+           );
+  }
+
+  /* Perform same checks as counterpart functions.  */
+  result = test_symlink (do_symlink, false);
+  dfd = openat (AT_FDCWD, ".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_symlink (do_symlink, false) == result);
+
+  ASSERT (close (dfd) == 0);
+  if (result == 77)
+    fputs ("skipping test: symlinks not supported on this file system\n",
+           stderr);
+  return result;
+}
deleted file mode 120000 (symlink)
index a0a19bd4a73ee52d51668a1959cce8a34c6e82e4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_ioctl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4cecce1838f6594971cd7586672788c5b62f33b2
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test of <sys/ioctl.h> substitute.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/ioctl.h>
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 97c68ca9c03d96d87009e9cf916accaa86beb35e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_random.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..16cacd31d7c4883eebcc7ddaac2223e2f888bf8d
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test of <sys/random.h> substitute.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/random.h>
+
+/* Check that the necessary constants are defined.  */
+int flags[] =
+  {
+    GRND_RANDOM,
+    GRND_NONBLOCK
+  };
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index c79afa78097f0c2096f31ef473e24080d1eb2cc2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_resource.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0d7a0f5a5094f4626934b0735210e6b6f2b2fd4b
--- /dev/null
@@ -0,0 +1,72 @@
+/* Test of <sys/resource.h> substitute.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <sys/resource.h>
+
+/* Check that necessary types are defined.  */
+#ifdef TODO /* Not implemented in gnulib yet */
+rlim_t t1;
+struct rlimit t2;
+#endif
+struct rusage t3;
+#ifdef TODO
+struct timeval t4;
+id_t t5;
+time_t t10;
+suseconds_t t11;
+fd_set t12;
+#endif
+
+/* Check that the necessary constants are defined.  */
+#ifdef TODO /* Not implemented in gnulib yet */
+int prios[] =
+  {
+    PRIO_PROCESS,
+    PRIO_PGRP,
+    PRIO_USER
+  };
+int rlims[] =
+  {
+    RLIM_INFINITY,
+    RLIM_SAVED_MAX,
+    RLIM_SAVED_CUR
+  };
+#endif
+int rusages[] =
+  {
+    RUSAGE_SELF,
+    RUSAGE_CHILDREN
+  };
+#ifdef TODO
+int rlimits[] =
+  {
+    RLIMIT_CORE,
+    RLIMIT_CPU,
+    RLIMIT_DATA,
+    RLIMIT_FSIZE,
+    RLIMIT_NOFILE,
+    RLIMIT_STACK,
+    RLIMIT_AS
+  };
+#endif
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index b303187e418ec1584d358cc23ddf8aea242c7c58..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_select.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..db791de189c794db084f5de92d72e9796cf4ee86
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test of <sys/select.h> substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <sys/select.h>
+
+/* Check that the 'struct timeval' type is defined.  */
+struct timeval a;
+
+/* Check that a.tv_sec is wide enough to hold a time_t, ignoring
+   signedness issues.  */
+typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1];
+
+/* Check that sigset_t is defined.  */
+sigset_t t2;
+
+#include "signature.h"
+
+/* The following may be macros without underlying functions, so only
+   check signature if they are not macros.  */
+#ifndef FD_CLR
+SIGNATURE_CHECK (FD_CLR, void, (int, fd_set *));
+#endif
+#ifndef FD_ISSET
+SIGNATURE_CHECK (FD_ISSET, void, (int, fd_set *));
+#endif
+#ifndef FD_SET
+SIGNATURE_CHECK (FD_SET, int, (int, fd_set *));
+#endif
+#ifndef FD_ZERO
+SIGNATURE_CHECK (FD_ZERO, void, (fd_set *));
+#endif
+
+int
+main (void)
+{
+  /* Check that FD_ZERO can be used.  This should not yield a warning
+     such as "warning: implicit declaration of function 'memset'".  */
+  fd_set fds;
+  FD_ZERO (&fds);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 2bc32c923f61fbedeb81520524cb6170286f21c7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_socket.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4e0f9ad46e22f5e7a2dd181646fe792d4ae51b04
--- /dev/null
@@ -0,0 +1,68 @@
+/* Test of <sys/socket.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <sys/socket.h>
+
+#if HAVE_SHUTDOWN
+/* Check some integer constant expressions.  */
+int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
+#endif
+
+/* Check that the 'socklen_t' type is defined.  */
+socklen_t t1;
+
+/* Check that the 'size_t' and 'ssize_t' types are defined.  */
+size_t t2;
+ssize_t t3;
+
+/* Check that 'struct iovec' is defined.  */
+struct iovec io;
+
+/* Check that a minimal set of 'struct msghdr' is defined.  */
+struct msghdr msg;
+
+#include <errno.h>
+
+int
+main (void)
+{
+  struct sockaddr_storage x;
+  sa_family_t i;
+
+  /* Check some errno values.  */
+  switch (ENOTSOCK)
+    {
+    case ENOTSOCK:
+    case EADDRINUSE:
+    case ENETRESET:
+    case ECONNABORTED:
+    case ECONNRESET:
+    case ENOTCONN:
+    case ESHUTDOWN:
+      break;
+    }
+
+  x.ss_family = 42;
+  i = 42;
+  msg.msg_iov = &io;
+
+  return (x.ss_family - i + msg.msg_namelen + msg.msg_iov->iov_len
+          + msg.msg_iovlen);
+}
deleted file mode 120000 (symlink)
index fe8cfdd5a13e8ea99a42e02d2d1b70d7b5811270..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_stat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7c4ec1fe0a948130992bc5f4af342e88a0bf3c6d
--- /dev/null
@@ -0,0 +1,338 @@
+/* Test of <sys/stat.h> substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+/* Check the existence of some macros.  */
+int a[] =
+  {
+    S_IFMT,
+#ifdef S_IFBLK /* missing on MSVC */
+    S_IFBLK,
+#endif
+    S_IFCHR, S_IFDIR, S_IFIFO, S_IFREG,
+#ifdef S_IFLNK /* missing on native Windows and DJGPP */
+    S_IFLNK,
+#endif
+#ifdef S_IFSOCK /* missing on native Windows and DJGPP */
+    S_IFSOCK,
+#endif
+    S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR,
+    S_IRWXG, S_IRGRP, S_IWGRP, S_IXGRP,
+    S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH,
+    S_ISUID, S_ISGID, S_ISVTX,
+    S_ISBLK (S_IFREG),
+    S_ISCHR (S_IFREG),
+    S_ISDIR (S_IFREG),
+    S_ISFIFO (S_IFREG),
+    S_ISREG (S_IFREG),
+    S_ISLNK (S_IFREG),
+    S_ISSOCK (S_IFREG),
+    S_ISDOOR (S_IFREG),
+    S_ISMPB (S_IFREG),
+    S_ISMPX (S_IFREG),
+    S_ISNAM (S_IFREG),
+    S_ISNWK (S_IFREG),
+    S_ISPORT (S_IFREG),
+    S_ISCTG (S_IFREG),
+    S_ISOFD (S_IFREG),
+    S_ISOFL (S_IFREG),
+    S_ISWHT (S_IFREG)
+  };
+
+/* Sanity checks.  */
+
+static_assert (S_IRWXU == (S_IRUSR | S_IWUSR | S_IXUSR));
+static_assert (S_IRWXG == (S_IRGRP | S_IWGRP | S_IXGRP));
+static_assert (S_IRWXO == (S_IROTH | S_IWOTH | S_IXOTH));
+
+#ifdef S_IFBLK
+static_assert (S_ISBLK (S_IFBLK));
+#endif
+static_assert (!S_ISBLK (S_IFCHR));
+static_assert (!S_ISBLK (S_IFDIR));
+static_assert (!S_ISBLK (S_IFIFO));
+static_assert (!S_ISBLK (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISBLK (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISBLK (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISCHR (S_IFBLK));
+#endif
+static_assert (S_ISCHR (S_IFCHR));
+static_assert (!S_ISCHR (S_IFDIR));
+static_assert (!S_ISCHR (S_IFIFO));
+static_assert (!S_ISCHR (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISCHR (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISCHR (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISDIR (S_IFBLK));
+#endif
+static_assert (!S_ISDIR (S_IFCHR));
+static_assert (S_ISDIR (S_IFDIR));
+static_assert (!S_ISDIR (S_IFIFO));
+static_assert (!S_ISDIR (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISDIR (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISDIR (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISFIFO (S_IFBLK));
+#endif
+static_assert (!S_ISFIFO (S_IFCHR));
+static_assert (!S_ISFIFO (S_IFDIR));
+static_assert (S_ISFIFO (S_IFIFO));
+static_assert (!S_ISFIFO (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISFIFO (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISFIFO (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISREG (S_IFBLK));
+#endif
+static_assert (!S_ISREG (S_IFCHR));
+static_assert (!S_ISREG (S_IFDIR));
+static_assert (!S_ISREG (S_IFIFO));
+static_assert (S_ISREG (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISREG (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISREG (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISLNK (S_IFBLK));
+#endif
+static_assert (!S_ISLNK (S_IFCHR));
+static_assert (!S_ISLNK (S_IFDIR));
+static_assert (!S_ISLNK (S_IFIFO));
+static_assert (!S_ISLNK (S_IFREG));
+#ifdef S_IFLNK
+static_assert (S_ISLNK (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISLNK (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISSOCK (S_IFBLK));
+#endif
+static_assert (!S_ISSOCK (S_IFCHR));
+static_assert (!S_ISSOCK (S_IFDIR));
+static_assert (!S_ISSOCK (S_IFIFO));
+static_assert (!S_ISSOCK (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISSOCK (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (S_ISSOCK (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISDOOR (S_IFBLK));
+#endif
+static_assert (!S_ISDOOR (S_IFCHR));
+static_assert (!S_ISDOOR (S_IFDIR));
+static_assert (!S_ISDOOR (S_IFIFO));
+static_assert (!S_ISDOOR (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISDOOR (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISDOOR (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISMPB (S_IFBLK));
+#endif
+static_assert (!S_ISMPB (S_IFCHR));
+static_assert (!S_ISMPB (S_IFDIR));
+static_assert (!S_ISMPB (S_IFIFO));
+static_assert (!S_ISMPB (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISMPB (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISMPB (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISMPX (S_IFBLK));
+#endif
+static_assert (!S_ISMPX (S_IFCHR));
+static_assert (!S_ISMPX (S_IFDIR));
+static_assert (!S_ISMPX (S_IFIFO));
+static_assert (!S_ISMPX (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISMPX (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISMPX (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISNAM (S_IFBLK));
+#endif
+static_assert (!S_ISNAM (S_IFCHR));
+static_assert (!S_ISNAM (S_IFDIR));
+static_assert (!S_ISNAM (S_IFIFO));
+static_assert (!S_ISNAM (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISNAM (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISNAM (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISNWK (S_IFBLK));
+#endif
+static_assert (!S_ISNWK (S_IFCHR));
+static_assert (!S_ISNWK (S_IFDIR));
+static_assert (!S_ISNWK (S_IFIFO));
+static_assert (!S_ISNWK (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISNWK (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISNWK (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISPORT (S_IFBLK));
+#endif
+static_assert (!S_ISPORT (S_IFCHR));
+static_assert (!S_ISPORT (S_IFDIR));
+static_assert (!S_ISPORT (S_IFIFO));
+static_assert (!S_ISPORT (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISPORT (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISPORT (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISCTG (S_IFBLK));
+#endif
+static_assert (!S_ISCTG (S_IFCHR));
+static_assert (!S_ISCTG (S_IFDIR));
+static_assert (!S_ISCTG (S_IFIFO));
+static_assert (!S_ISCTG (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISCTG (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISCTG (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISOFD (S_IFBLK));
+#endif
+static_assert (!S_ISOFD (S_IFCHR));
+static_assert (!S_ISOFD (S_IFDIR));
+static_assert (!S_ISOFD (S_IFIFO));
+static_assert (!S_ISOFD (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISOFD (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISOFD (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISOFL (S_IFBLK));
+#endif
+static_assert (!S_ISOFL (S_IFCHR));
+static_assert (!S_ISOFL (S_IFDIR));
+static_assert (!S_ISOFL (S_IFIFO));
+static_assert (!S_ISOFL (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISOFL (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISOFL (S_IFSOCK));
+#endif
+
+#ifdef S_IFBLK
+static_assert (!S_ISWHT (S_IFBLK));
+#endif
+static_assert (!S_ISWHT (S_IFCHR));
+static_assert (!S_ISWHT (S_IFDIR));
+static_assert (!S_ISWHT (S_IFIFO));
+static_assert (!S_ISWHT (S_IFREG));
+#ifdef S_IFLNK
+static_assert (!S_ISWHT (S_IFLNK));
+#endif
+#ifdef S_IFSOCK
+static_assert (!S_ISWHT (S_IFSOCK));
+#endif
+
+/* POSIX 2008 requires traditional encoding of permission constants.  */
+static_assert (S_IRWXU == 00700);
+static_assert (S_IRUSR == 00400);
+static_assert (S_IWUSR == 00200);
+static_assert (S_IXUSR == 00100);
+static_assert (S_IRWXG == 00070);
+static_assert (S_IRGRP == 00040);
+static_assert (S_IWGRP == 00020);
+static_assert (S_IXGRP == 00010);
+static_assert (S_IRWXO == 00007);
+static_assert (S_IROTH == 00004);
+static_assert (S_IWOTH == 00002);
+static_assert (S_IXOTH == 00001);
+static_assert (S_ISUID == 04000);
+static_assert (S_ISGID == 02000);
+static_assert (S_ISVTX == 01000);
+
+#if ((0 <= UTIME_NOW && UTIME_NOW < 1000000000)           \
+     || (0 <= UTIME_OMIT && UTIME_OMIT < 1000000000)      \
+     || UTIME_NOW == UTIME_OMIT)
+invalid UTIME macros
+#endif
+
+/* Check the existence of some types.  */
+nlink_t t1;
+off_t t2;
+mode_t t3;
+
+struct timespec st;
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index b1c42855b0a1aefd0e284dfeef80a13e2b9fceb7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_time.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5db5c2c0c637a8a79d328baf42d6c1132b2a019d
--- /dev/null
@@ -0,0 +1,34 @@
+/* Test of <sys/time.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <sys/time.h>
+
+/* Check that the 'struct timeval' type is defined.  */
+struct timeval a;
+
+/* Check that a.tv_sec is wide enough to hold a time_t, ignoring
+   signedness issues.  */
+typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1];
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index c1af01fb77995efb89646cf0c6fd844e279cfe04..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_types.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f661a921539f4e443e663c853f2d9a5870b3e94e
--- /dev/null
@@ -0,0 +1,34 @@
+/* Test of <sys/types.h> substitute.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include <sys/types.h>
+
+/* Check that the types are all defined.  */
+pid_t t1;
+size_t t2;
+ssize_t t3;
+off_t t4;
+mode_t t5;
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 2d8d6f3c7b707c9ee83b41989ad511db617cdb9c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_uio.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d371471f876a2cd5ab3230944693aba41cddf477
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test of <sys/uio.h> substitute.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <eblake@redhat.com>, 2011.  */
+
+#include <config.h>
+
+#include <sys/uio.h>
+
+/* Check that necessary types are defined.  */
+size_t a;
+ssize_t b;
+struct iovec c;
+
+int
+main (void)
+{
+  return a + b + !!c.iov_base + c.iov_len;
+}
deleted file mode 120000 (symlink)
index c01e42c338cb784eb7c7db2245d582d5a99771fa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_utsname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..049314fafc8195ef24b1c41ae3a622904cb640a2
--- /dev/null
@@ -0,0 +1,37 @@
+/* Test of <sys/utsname.h> substitute.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <sys/utsname.h>
+
+#include <string.h>
+
+int
+main ()
+{
+  struct utsname buf;
+
+  strcpy (buf.sysname, "Linux");
+  strcpy (buf.nodename, "hobbybox");
+  strcpy (buf.release, "3.141.592");
+  strcpy (buf.version, "GENERIC");
+  strcpy (buf.machine, "i586");
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 2800913ac2cae5b4c1b508f4f36112cb05fb4a6e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_wait.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bdd6428926d7acd2608c0d31fb563e72d162faed
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of <sys/wait.h> substitute.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/wait.h>
+
+/* Check for existence of required types.  */
+static pid_t a;
+
+#include "test-sys_wait.h"
+
+int
+main (void)
+{
+  if (test_sys_wait_macros ())
+    return 1;
+
+#if 0
+  switch (WCONTINUED)
+    {
+  /* Gnulib doesn't guarantee these, yet.  */
+    case WCONTINUED:
+    case WEXITED:
+    case WNOWAIT:
+    case WSTOPPED:
+      break;
+    }
+#endif
+
+  return a ? 1 : 0;
+}
deleted file mode 120000 (symlink)
index e568d90560961fb84ccac07225a827ae76fce797..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-sys_wait.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5f2eec5493678316fc263131b2ac81834eaa3792
--- /dev/null
@@ -0,0 +1,53 @@
+/* Test of macros shared between <sys/wait.h> and <stdlib.h>.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2010.  */
+
+static int
+test_sys_wait_macros (void)
+{
+  /* Check subset of <sys/wait.h> macros that must be visible here.
+     Note that some of these macros are only portable when operating
+     on an lvalue.  */
+  int i;
+  for (i = 0; i < 0x8000; i = (i ? i << 1 : 1))
+    {
+      /* POSIX requires that for all valid process statuses, that
+         exactly one of these three macros is true.  But not all
+         possible 16-bit values map to valid process status.
+         Traditionally, 8 of the bits are for WIFEXITED, 7 of the bits
+         to tell between WIFSIGNALED and WIFSTOPPED, and either 0x80
+         or 0x8000 to flag that core was also dumped.  Since we don't
+         know which byte is WIFEXITED, we skip the both possible bits
+         that can signal core dump.  */
+      if (i == 0x80)
+        continue;
+      if (!!WIFSIGNALED (i) + !!WIFEXITED (i) + !!WIFSTOPPED (i) != 1)
+        return 1;
+    }
+  i = WEXITSTATUS (i) + WSTOPSIG (i) + WTERMSIG (i);
+
+#if 0
+  switch (i)
+    {
+  /* Gnulib doesn't guarantee these, yet.  */
+    case WNOHANG:
+    case WUNTRACED:
+      break;
+    }
+#endif
+  return 0;
+}
deleted file mode 120000 (symlink)
index a0b0660466ceea76968822e7ac375ae2b7573a5d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-termios.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..93a6b458cf55d4cd16c3d9589f7c8a360641e1a4
--- /dev/null
@@ -0,0 +1,30 @@
+/* Test of <termios.h> substitute.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <termios.h>
+
+/* Check that the types are all defined.  */
+pid_t t1;
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index eaccf49f440c9bcbe196309d14e4308dbaecdb92..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-thread_create.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..89dc1c9e69958cba4efe867fdac21024ea9d2b4c
--- /dev/null
@@ -0,0 +1,78 @@
+/* Test of gl_thread_create () macro.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include "glthread/thread.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include "macros.h"
+
+static gl_thread_t main_thread_before;
+static gl_thread_t main_thread_after;
+static gl_thread_t worker_thread;
+
+static int dummy;
+static volatile int work_done;
+
+static void *
+worker_thread_func (_GL_UNUSED void *arg)
+{
+  work_done = 1;
+  return &dummy;
+}
+
+int
+main ()
+{
+  main_thread_before = gl_thread_self ();
+
+  if (glthread_create (&worker_thread, worker_thread_func, NULL) == 0)
+    {
+      void *ret;
+
+      /* Check that gl_thread_self () has the same value before than after the
+         first call to gl_thread_create ().  */
+      main_thread_after = gl_thread_self ();
+      ASSERT (memcmp (&main_thread_before, &main_thread_after,
+                      sizeof (gl_thread_t))
+              == 0);
+
+      gl_thread_join (worker_thread, &ret);
+
+      /* Check the return value of the thread.  */
+      ASSERT (ret == &dummy);
+
+      /* Check that worker_thread_func () has finished executing.  */
+      ASSERT (work_done);
+
+      return 0;
+    }
+  else
+    {
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+      fputs ("glthread_create failed\n", stderr);
+      return 1;
+#else
+      fputs ("Skipping test: multithreading not enabled\n", stderr);
+      return 77;
+#endif
+    }
+}
deleted file mode 120000 (symlink)
index 8b667c5199d5b37f8b55868d1b7347d5d14da9d2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-thread_self.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e494613bf95dee88d61da2bec7da6695df7b7d1f
--- /dev/null
@@ -0,0 +1,39 @@
+/* Test of gl_thread_self () macro.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <config.h>
+
+#include "glthread/thread.h"
+
+gl_thread_t main_thread;
+
+int
+main ()
+{
+  /* Check that gl_thread_self () can be used with just $(LIBTHREAD), not
+     $(LIBMULTITHREAD), i.e. in libraries that are multithread-safe but don't
+     create threads themselves.  */
+  /* This is not the case on AIX with --enable-threads=isoc+posix, because in
+     this case, $(LIBTHREAD) is empty whereas $(LIBMULTITHREAD) is '-lpthread'.
+   */
+#if !defined _AIX
+  main_thread = gl_thread_self ();
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index d17e86e47c35e2f4a64921387dfdaa7d9feeab1c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-time-h.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..01f9fff8a3683227059286ea55b63a888a28ff6b
--- /dev/null
@@ -0,0 +1,43 @@
+/* Test of <time.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <time.h>
+
+/* Check that the types are all defined.  */
+struct timespec t1;
+#if 0
+/* POSIX:2008 does not require pid_t in <time.h> unconditionally, and indeed
+   it's missing on Mac OS X 10.5, FreeBSD 6.4, OpenBSD 4.9, mingw.  */
+pid_t t2;
+#endif
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+static_assert (sizeof NULL == sizeof (void *));
+
+/* Check that TIME_UTC is defined and a positive integer.  */
+int t3 = TIME_UTC;
+static_assert (TIME_UTC > 0);
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 58492cc92e2f3fe443f8df9068b8a79a379c1907..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-time.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..752d4c0f3e265cec522d1ed468a0574e0b4d333f
--- /dev/null
@@ -0,0 +1,49 @@
+/* Test of time() function.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible.  */
+
+#include <config.h>
+
+#include <time.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (time, time_t, (time_t *));
+
+#include <sys/time.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Check consistency of time() with gettimeofday().tv_sec.  */
+  struct timeval tv1;
+  struct timeval tv2;
+  time_t tt3;
+
+  /* Wait until gettimeofday() reports an increase in tv_sec.  */
+  ASSERT (gettimeofday (&tv1, NULL) == 0);
+  do
+    ASSERT (gettimeofday (&tv2, NULL) == 0);
+  while (tv2.tv_sec == tv1.tv_sec);
+  /* We are now at the beginning of a second.  Test whether time() reports
+     the new second or the previous one.  */
+  tt3 = time (NULL);
+  ASSERT (tt3 >= tv2.tv_sec);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 592c9f751b5b414d15353a3e8bc51d535577a72f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-timespec.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2859ead6a8d1e7b61e0704268b0a87194e469597
--- /dev/null
@@ -0,0 +1,166 @@
+/* Test timespec functions.
+   Copyright 2015-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "timespec.h"
+
+#include "intprops.h"
+#include "macros.h"
+
+#include <limits.h>
+
+static struct { int s; int ns; } const prototype[] =
+  {
+    { INT_MIN, 0 },
+    { INT_MIN, 1 },
+    { INT_MIN, TIMESPEC_HZ - 1 },
+    { INT_MIN + 1, 0 },
+    { INT_MIN + 1, 1 },
+    { INT_MIN + 1, TIMESPEC_HZ - 1 },
+    { -1, 0 },
+    { -1, 1 },
+    { -1, TIMESPEC_HZ - 1 },
+    { 0, 0 },
+    { 0, 1 },
+    { 0, TIMESPEC_HZ - 1 },
+    { 1, 0 },
+    { 1, 1 },
+    { 1, TIMESPEC_HZ - 1 },
+    { 1234567890, 0 },
+    { 1234567890, 1 },
+    { 1234567890, TIMESPEC_HZ - 1 },
+    { INT_MAX - 1, 0 },
+    { INT_MAX - 1, 1 },
+    { INT_MAX - 1, TIMESPEC_HZ - 1 },
+    { INT_MAX, 0 },
+    { INT_MAX, 1 },
+    { INT_MAX, TIMESPEC_HZ - 1 },
+    { INT_MAX, 2 * TIMESPEC_HZ }
+  };
+enum { nprototypes = sizeof prototype / sizeof *prototype };
+
+static bool
+valid (struct timespec a)
+{
+  return 0 <= a.tv_nsec && a.tv_nsec < TIMESPEC_HZ;
+}
+
+static int
+sign (int i)
+{
+  return i < 0 ? -1 : 0 < i;
+}
+
+static int
+cmp (struct timespec a, struct timespec b)
+{
+  return sign (timespec_cmp (a, b));
+}
+
+static bool
+eq (struct timespec a, struct timespec b)
+{
+  return timespec_cmp (a, b) == 0;
+}
+
+static bool
+extremal (struct timespec a)
+{
+  return ((a.tv_sec == TYPE_MINIMUM (time_t) && a.tv_nsec == 0)
+          || (a.tv_sec == TYPE_MAXIMUM (time_t)
+              && a.tv_nsec == TIMESPEC_HZ - 1));
+}
+
+int
+main (void)
+{
+  int i, j, k;
+  struct timespec test[nprototypes + 1];
+  int ntests;
+  int computed_hz = 1;
+  struct timespec prevroundtrip;
+
+  test[0] = make_timespec (TYPE_MINIMUM (time_t), -1);
+  ntests = 1;
+  for (i = 0; i < nprototypes; i++)
+    {
+      int s = prototype[i].s;
+      if (TYPE_SIGNED (time_t) || 0 <= s)
+        {
+          time_t t = (s <= INT_MIN + 1 ? s - INT_MIN + TYPE_MINIMUM (time_t)
+                      : INT_MAX - 1 <= s ? s - INT_MAX + TYPE_MAXIMUM (time_t)
+                      : s);
+          test[ntests++] = make_timespec (t, prototype[i].ns);
+        }
+    }
+
+  for (i = 0; i < LOG10_TIMESPEC_HZ; i++)
+    computed_hz *= 10;
+  ASSERT (computed_hz == TIMESPEC_HZ);
+
+  for (i = 0; i < ntests; i++)
+    {
+      struct timespec a = test[i];
+
+      struct timespec roundtrip = dtotimespec (timespectod (a));
+      if (i != 0)
+        ASSERT (cmp (prevroundtrip, roundtrip) <= 0);
+      prevroundtrip = roundtrip;
+
+      ASSERT (sign (timespec_sign (a)) == cmp (a, make_timespec (0, 0)));
+
+      if (valid (a))
+        for (j = 0; j < ntests; j++)
+          {
+            struct timespec b = test[j];
+            if (valid (b))
+              {
+                struct timespec sum = timespec_add (a, b);
+                struct timespec diff = timespec_sub (a, b);
+                struct timespec rdiff = timespec_sub (b, a);
+                ASSERT (cmp (a, b) == sign (i - j));
+                ASSERT (eq (sum, timespec_add (b, a)));
+                if (! extremal (sum))
+                  {
+                    ASSERT (eq (a, timespec_sub (sum, b)));
+                    ASSERT (eq (b, timespec_sub (sum, a)));
+
+                    for (k = 0; k < ntests; k++)
+                      {
+                        struct timespec c = test[k];
+                        if (valid (c))
+                          {
+                            struct timespec sumbc = timespec_add (b, c);
+                            if (! extremal (sumbc))
+                              ASSERT (eq (timespec_add (a, sumbc),
+                                          timespec_add (sum, c)));
+                          }
+                      }
+                  }
+                if (! extremal (diff))
+                  ASSERT (eq (a, timespec_add (diff, b)));
+                if (! extremal (rdiff))
+                  ASSERT (eq (b, timespec_add (rdiff, a)));
+
+              }
+          }
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index a29e9c46ab3e3400513373a9036a6123ae01e50a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-tls.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f0839e0a4be77afc5f7263c07ee0a379b0a3e74d
--- /dev/null
@@ -0,0 +1,538 @@
+/* Test of thread-local storage in multithreaded situations.
+   Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
+
+#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
+# define TEST_ISOC_THREADS 1
+#endif
+#if USE_POSIX_THREADS
+# define TEST_POSIX_THREADS 1
+#endif
+#if USE_WINDOWS_THREADS
+# define TEST_WINDOWS_THREADS 1
+#endif
+
+/* Whether to help the scheduler through explicit yield().
+   Uncomment this to see if the operating system has a fair scheduler.  */
+#define EXPLICIT_YIELD 1
+
+/* Whether to print debugging messages.  */
+#define ENABLE_DEBUGGING 0
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "glthread/tls.h"
+#include "glthread/thread.h"
+#include "glthread/lock.h"
+#include "glthread/yield.h"
+
+#if HAVE_DECL_ALARM
+# include <signal.h>
+# include <unistd.h>
+#endif
+
+#if ENABLE_DEBUGGING
+# define dbgprintf printf
+#else
+# define dbgprintf if (0) printf
+#endif
+
+#if EXPLICIT_YIELD
+# define yield() gl_thread_yield ()
+#else
+# define yield()
+#endif
+
+static void
+perhaps_yield (void)
+{
+  /* This helps making the sequence of thread activations less predictable.  */
+  if ((((unsigned long) random () >> 3) % 4) == 0)
+    yield ();
+}
+
+
+/* ----------------------- Test thread-local storage ----------------------- */
+
+/* Number of simultaneous threads.  */
+#define THREAD_COUNT 16
+
+/* Number of operations performed in each thread.  */
+#define REPEAT_COUNT 50000
+
+#define KEYS_COUNT 4
+
+static gl_tls_key_t mykeys[KEYS_COUNT];
+
+static void *
+worker_thread (void *arg)
+{
+  unsigned int id = (unsigned int) (uintptr_t) arg;
+  int i, j, repeat;
+  unsigned int values[KEYS_COUNT];
+
+  dbgprintf ("Worker %p started\n", gl_thread_self_pointer ());
+
+  /* Initialize the per-thread storage.  */
+  for (i = 0; i < KEYS_COUNT; i++)
+    {
+      values[i] = (((unsigned long) random () >> 3) % 1000000) * THREAD_COUNT + id;
+      /* Hopefully no arithmetic overflow.  */
+      if ((values[i] % THREAD_COUNT) != id)
+        abort ();
+    }
+  perhaps_yield ();
+
+  /* Verify that the initial value is NULL.  */
+  dbgprintf ("Worker %p before initial verify\n", gl_thread_self_pointer ());
+  for (i = 0; i < KEYS_COUNT; i++)
+    if (gl_tls_get (mykeys[i]) != NULL)
+      abort ();
+  dbgprintf ("Worker %p after  initial verify\n", gl_thread_self_pointer ());
+  perhaps_yield ();
+
+  /* Initialize the per-thread storage.  */
+  dbgprintf ("Worker %p before first tls_set\n", gl_thread_self_pointer ());
+  for (i = 0; i < KEYS_COUNT; i++)
+    {
+      unsigned int *ptr = (unsigned int *) malloc (sizeof (unsigned int));
+      *ptr = values[i];
+      gl_tls_set (mykeys[i], ptr);
+    }
+  dbgprintf ("Worker %p after  first tls_set\n", gl_thread_self_pointer ());
+  perhaps_yield ();
+
+  /* Shuffle around the pointers.  */
+  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+    {
+      dbgprintf ("Worker %p doing value swapping\n", gl_thread_self_pointer ());
+      i = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      j = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      if (i != j)
+        {
+          void *vi = gl_tls_get (mykeys[i]);
+          void *vj = gl_tls_get (mykeys[j]);
+
+          gl_tls_set (mykeys[i], vj);
+          gl_tls_set (mykeys[j], vi);
+        }
+      perhaps_yield ();
+    }
+
+  /* Verify that all the values are from this thread.  */
+  dbgprintf ("Worker %p before final verify\n", gl_thread_self_pointer ());
+  for (i = 0; i < KEYS_COUNT; i++)
+    if ((*(unsigned int *) gl_tls_get (mykeys[i]) % THREAD_COUNT) != id)
+      abort ();
+  dbgprintf ("Worker %p after  final verify\n", gl_thread_self_pointer ());
+  perhaps_yield ();
+
+  dbgprintf ("Worker %p dying.\n", gl_thread_self_pointer ());
+  return NULL;
+}
+
+static void
+test_tls (void)
+{
+  int pass, i;
+
+  for (pass = 0; pass < 2; pass++)
+    {
+      gl_thread_t threads[THREAD_COUNT];
+
+      if (pass == 0)
+        for (i = 0; i < KEYS_COUNT; i++)
+          gl_tls_key_init (mykeys[i], free);
+      else
+        for (i = KEYS_COUNT - 1; i >= 0; i--)
+          gl_tls_key_init (mykeys[i], free);
+
+      /* Spawn the threads.  */
+      for (i = 0; i < THREAD_COUNT; i++)
+        threads[i] = gl_thread_create (worker_thread, (void *) (uintptr_t) i);
+
+      /* Wait for the threads to terminate.  */
+      for (i = 0; i < THREAD_COUNT; i++)
+        gl_thread_join (threads[i], NULL);
+
+      for (i = 0; i < KEYS_COUNT; i++)
+        gl_tls_key_destroy (mykeys[i]);
+    }
+}
+
+#undef KEYS_COUNT
+#undef REPEAT_COUNT
+#undef THREAD_COUNT
+
+
+/* --------------- Test thread-local storage with destructors --------------- */
+
+/* Number of simultaneous threads.  */
+#define THREAD_COUNT 10
+
+/* Number of keys to allocate in each thread.  */
+#define KEYS_COUNT 10
+
+gl_lock_define_initialized(static, sumlock)
+static uintptr_t sum;
+
+static void
+inc_sum (uintptr_t value)
+{
+  gl_lock_lock (sumlock);
+  sum += value;
+  gl_lock_unlock (sumlock);
+}
+
+static void
+destructor0 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 0)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void
+destructor1 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 1)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void
+destructor2 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 2)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void
+destructor3 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 3)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void
+destructor4 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 4)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void
+destructor5 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 5)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void
+destructor6 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 6)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void
+destructor7 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 7)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void
+destructor8 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 8)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void
+destructor9 (void *value)
+{
+  if ((((uintptr_t) value - 1) % 10) != 9)
+    abort ();
+  inc_sum ((uintptr_t) value);
+}
+
+static void (*destructor_table[10]) (void *) =
+  {
+    destructor0,
+    destructor1,
+    destructor2,
+    destructor3,
+    destructor4,
+    destructor5,
+    destructor6,
+    destructor7,
+    destructor8,
+    destructor9
+  };
+
+static gl_tls_key_t dtorcheck_keys[THREAD_COUNT][KEYS_COUNT];
+
+/* Worker thread that uses destructors that verify that the destructor belongs
+   to the right thread.  */
+static void *
+dtorcheck1_thread (void *arg)
+{
+  unsigned int id = (unsigned int) (uintptr_t) arg;
+  gl_tls_key_t *keys = dtorcheck_keys[id]; /* an array of KEYS_COUNT keys */
+  int i;
+
+  for (i = 0; i < KEYS_COUNT; i++)
+    gl_tls_key_init (keys[i], destructor_table[i]);
+
+  for (i = 0; i < KEYS_COUNT; i++)
+    gl_tls_set (keys[i], (void *) (uintptr_t) (10 * id + i + 1));
+
+  return NULL;
+}
+
+static void
+test_tls_dtorcheck1 (void)
+{
+  gl_thread_t threads[THREAD_COUNT];
+  unsigned int id;
+  int i;
+  uintptr_t expected_sum;
+
+  sum = 0;
+
+  /* Spawn the threads.  */
+  for (id = 0; id < THREAD_COUNT; id++)
+    threads[id] = gl_thread_create (dtorcheck1_thread, (void *) (uintptr_t) id);
+
+  /* Wait for the threads to terminate.  */
+  for (id = 0; id < THREAD_COUNT; id++)
+    gl_thread_join (threads[id], NULL);
+
+  /* Clean up the keys.  */
+  for (id = 0; id < THREAD_COUNT; id++)
+    for (i = 0; i < KEYS_COUNT; i++)
+      gl_tls_key_destroy (dtorcheck_keys[id][i]);
+
+  /* Check that the destructor was invoked for each key.  */
+  expected_sum = 10 * KEYS_COUNT * (THREAD_COUNT * (THREAD_COUNT - 1) / 2)
+                 + THREAD_COUNT * (KEYS_COUNT * (KEYS_COUNT - 1) / 2)
+                 + THREAD_COUNT * KEYS_COUNT;
+  if (sum != expected_sum)
+    abort ();
+}
+
+/* Worker thread that uses destructors that verify that the destructor belongs
+   to the right key allocated within the thread.  */
+static void *
+dtorcheck2_thread (void *arg)
+{
+  unsigned int id = (unsigned int) (uintptr_t) arg;
+  gl_tls_key_t *keys = dtorcheck_keys[id]; /* an array of KEYS_COUNT keys */
+  int i;
+
+  for (i = 0; i < KEYS_COUNT; i++)
+    gl_tls_key_init (keys[i], destructor_table[id]);
+
+  for (i = 0; i < KEYS_COUNT; i++)
+    gl_tls_set (keys[i], (void *) (uintptr_t) (10 * i + id + 1));
+
+  return NULL;
+}
+
+static void
+test_tls_dtorcheck2 (void)
+{
+  gl_thread_t threads[THREAD_COUNT];
+  unsigned int id;
+  int i;
+  uintptr_t expected_sum;
+
+  sum = 0;
+
+  /* Spawn the threads.  */
+  for (id = 0; id < THREAD_COUNT; id++)
+    threads[id] = gl_thread_create (dtorcheck2_thread, (void *) (uintptr_t) id);
+
+  /* Wait for the threads to terminate.  */
+  for (id = 0; id < THREAD_COUNT; id++)
+    gl_thread_join (threads[id], NULL);
+
+  /* Clean up the keys.  */
+  for (id = 0; id < THREAD_COUNT; id++)
+    for (i = 0; i < KEYS_COUNT; i++)
+      gl_tls_key_destroy (dtorcheck_keys[id][i]);
+
+  /* Check that the destructor was invoked for each key.  */
+  expected_sum = 10 * THREAD_COUNT * (KEYS_COUNT * (KEYS_COUNT - 1) / 2)
+                 + KEYS_COUNT * (THREAD_COUNT * (THREAD_COUNT - 1) / 2)
+                 + THREAD_COUNT * KEYS_COUNT;
+  if (sum != expected_sum)
+    abort ();
+}
+
+#undef KEYS_COUNT
+#undef THREAD_COUNT
+
+
+/* --- Test thread-local storage with races between init and destroy --- */
+
+/* Number of simultaneous threads.  */
+#define THREAD_COUNT 10
+
+/* Number of keys to allocate in each thread.  */
+#define KEYS_COUNT 10
+
+/* Number of times to destroy and reallocate a key in each thread.  */
+#define REPEAT_COUNT 100000
+
+static gl_tls_key_t racecheck_keys[THREAD_COUNT][KEYS_COUNT];
+
+/* Worker thread that does many destructions and reallocations of keys, and also
+   uses destructors that verify that the destructor belongs to the right key.  */
+static void *
+racecheck_thread (void *arg)
+{
+  unsigned int id = (unsigned int) (uintptr_t) arg;
+  gl_tls_key_t *keys = racecheck_keys[id]; /* an array of KEYS_COUNT keys */
+  int repeat;
+  int i;
+
+  dbgprintf ("Worker %p started\n", gl_thread_self_pointer ());
+
+  for (i = 0; i < KEYS_COUNT; i++)
+    {
+      gl_tls_key_init (keys[i], destructor_table[i]);
+      gl_tls_set (keys[i], (void *) (uintptr_t) (10 * id + i + 1));
+    }
+
+  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+    {
+      i = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      dbgprintf ("Worker %p reallocating key %d\n", gl_thread_self_pointer (), i);
+      gl_tls_key_destroy (keys[i]);
+      gl_tls_key_init (keys[i], destructor_table[i]);
+      gl_tls_set (keys[i], (void *) (uintptr_t) (10 * id + i + 1));
+    }
+
+  dbgprintf ("Worker %p dying.\n", gl_thread_self_pointer ());
+  return NULL;
+}
+
+static void
+test_tls_racecheck (void)
+{
+  gl_thread_t threads[THREAD_COUNT];
+  unsigned int id;
+  int i;
+  uintptr_t expected_sum;
+
+  sum = 0;
+
+  /* Spawn the threads.  */
+  for (id = 0; id < THREAD_COUNT; id++)
+    threads[id] = gl_thread_create (racecheck_thread, (void *) (uintptr_t) id);
+
+  /* Wait for the threads to terminate.  */
+  for (id = 0; id < THREAD_COUNT; id++)
+    gl_thread_join (threads[id], NULL);
+
+  /* Clean up the keys.  */
+  for (id = 0; id < THREAD_COUNT; id++)
+    for (i = 0; i < KEYS_COUNT; i++)
+      gl_tls_key_destroy (racecheck_keys[id][i]);
+
+  /* Check that the destructor was invoked for each key.  */
+  expected_sum = 10 * KEYS_COUNT * (THREAD_COUNT * (THREAD_COUNT - 1) / 2)
+                 + THREAD_COUNT * (KEYS_COUNT * (KEYS_COUNT - 1) / 2)
+                 + THREAD_COUNT * KEYS_COUNT;
+  if (sum != expected_sum)
+    abort ();
+}
+
+#undef REPEAT_COUNT
+#undef KEYS_COUNT
+#undef THREAD_COUNT
+
+
+/* -------------------------------------------------------------------------- */
+
+int
+main ()
+{
+#if HAVE_DECL_ALARM
+  /* Declare failure if test takes too long, by using default abort
+     caused by SIGALRM.  */
+  int alarm_value = 600;
+  signal (SIGALRM, SIG_DFL);
+  alarm (alarm_value);
+#endif
+
+  printf ("Starting test_tls ..."); fflush (stdout);
+  test_tls ();
+  printf (" OK\n"); fflush (stdout);
+
+  printf ("Starting test_tls_dtorcheck1 ..."); fflush (stdout);
+  test_tls_dtorcheck1 ();
+  printf (" OK\n"); fflush (stdout);
+
+  printf ("Starting test_tls_dtorcheck2 ..."); fflush (stdout);
+  test_tls_dtorcheck2 ();
+  printf (" OK\n"); fflush (stdout);
+
+  /* This test hangs with the mingw-w64 winpthreads.  */
+#if (defined _WIN32 && ! defined __CYGWIN__) && TEST_POSIX_THREADS
+  fputs ("Skipping test: it is known to hang with the mingw-w64 winpthreads.\n",
+         stderr);
+  exit (77);
+#else
+  printf ("Starting test_tls_racecheck ..."); fflush (stdout);
+  test_tls_racecheck ();
+  printf (" OK\n"); fflush (stdout);
+#endif
+
+  return 0;
+}
+
+#else
+
+/* No multithreading available.  */
+
+#include <stdio.h>
+
+int
+main ()
+{
+  fputs ("Skipping test: multithreading not enabled\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 0b47c97723263944f880a66bed99c2df1b19b091..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-u64.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1c84eb3e251410348bb83854e10d13e02bc70366
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test of <u64.h>
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2009.  */
+
+#include <config.h>
+
+#include <u64.h>
+
+int
+main (void)
+{
+  u64 i = u64init (42, 4711);
+  u64 j, k, l;
+
+  j = u64hilo (42, 4711);
+
+  if (u64lt (i, j) || u64lt (j, i))
+    return 1;
+
+  i = u64hilo (0, 42);
+  j = u64hilo (0, 43);
+
+  if (!u64lt (i, j))
+    return 1;
+
+  k = u64plus (i, j);
+  l = u64hilo (0, 42 + 43);
+
+  if (u64lt (k, l) || u64lt (l, k))
+    return 1;
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 1c50921dad690316e54273b3a98809460fa886e0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-uchar.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dfb368e052435f59124f038b3e37987aa1d77278
--- /dev/null
@@ -0,0 +1,57 @@
+/* Test of <uchar.h> substitute.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+#include <uchar.h>
+
+/* Check that the types are defined.  */
+mbstate_t a = { 0 };
+size_t b = 5;
+char8_t c = 'x';
+char16_t d = 'y';
+char32_t e = 'z';
+
+/* Check that char8_t, char16_t, and char32_t are unsigned types.  */
+static_assert ((char8_t)(-1) >= 0);
+static_assert ((char16_t)(-1) >= 0);
+#if !defined __HP_cc
+static_assert ((char32_t)(-1) >= 0);
+#endif
+
+/* Check that char8_t is at least 8 bits wide.  */
+static_assert ((char8_t)0xFF != (char8_t)0x7F);
+
+/* Check that char16_t is at least 16 bits wide.  */
+static_assert ((char16_t)0xFFFF != (char16_t)0x7FFF);
+
+/* Check that char32_t is at least 31 bits wide.  */
+static_assert ((char32_t)0x7FFFFFFF != (char32_t)0x3FFFFFFF);
+
+/* Check that _GL_SMALL_WCHAR_T is correctly defined.  */
+#if _GL_SMALL_WCHAR_T
+static_assert (sizeof (wchar_t) < sizeof (char32_t));
+#else
+static_assert (sizeof (wchar_t) == sizeof (char32_t));
+#endif
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index c16133834140ddbef7b2cd7c8c5896eda7cbf1c9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-uname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5fc5716c105719d83777cfad6b6e129cfe4b1c4a
--- /dev/null
@@ -0,0 +1,64 @@
+/* Test of system information.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <sys/utsname.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (uname, int, (struct utsname *));
+
+#include <stdio.h>
+#include <string.h>
+
+#include "macros.h"
+
+
+/* This program can be called with no arguments, then it performs a unit
+   test.  Or it can be called with 1 argument, then it prints the uname
+   contents to standard output.  */
+
+int
+main (int argc, char *argv[])
+{
+  struct utsname buf;
+
+  memset (&buf, '?', sizeof (buf));
+
+  ASSERT (uname (&buf) >= 0);
+
+  /* Verify that every field's value is NUL terminated.  */
+  ASSERT (strlen (buf.sysname) < sizeof (buf.sysname));
+  ASSERT (strlen (buf.nodename) < sizeof (buf.nodename));
+  ASSERT (strlen (buf.release) < sizeof (buf.release));
+  ASSERT (strlen (buf.version) < sizeof (buf.version));
+  ASSERT (strlen (buf.machine) < sizeof (buf.machine));
+
+  if (argc > 1)
+    {
+      /* Show the result.  */
+
+      printf ("uname -n = nodename       = %s\n", buf.nodename);
+      printf ("uname -s = sysname        = %s\n", buf.sysname);
+      printf ("uname -r = release        = %s\n", buf.release);
+      printf ("uname -v = version        = %s\n", buf.version);
+      printf ("uname -m = machine or cpu = %s\n", buf.machine);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 31481822ffbea39eaf2e3b11cdb9028a1a2537fc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-unicodeio.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a2cbf7ab80e51ee19be81f06a269694c9078508a
--- /dev/null
@@ -0,0 +1,103 @@
+/* Tests for Unicode character output.
+
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible, 2020.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unicodeio.h"
+
+#include <locale.h>
+#include <string.h>
+
+#include "localcharset.h"
+#include "macros.h"
+
+#define TEST_CODE 0x2022
+#define TEST_CODE_AS_UTF8 "\xe2\x80\xa2"
+#define TEST_CODE_AS_GB18030 "\x81\x36\xa6\x31"
+
+static char result[64];
+
+static long
+success_callback (const char *buf, size_t buflen, void *callback_arg)
+{
+  memcpy (result, buf, buflen);
+  result[buflen] = '\0';
+  return 42;
+}
+
+static long
+failure_callback (unsigned int code, const char *msg, void *callback_arg)
+{
+  ASSERT (code == TEST_CODE);
+  strcpy (result, ".");
+  return 55;
+}
+
+int
+main (int argc, char *argv[])
+{
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  switch (unicode_to_mb (TEST_CODE, success_callback, failure_callback, NULL))
+    {
+    case 42:
+      if (argc > 1)
+        switch (argv[1][0])
+          {
+          case '1':
+            /* On some platforms, the "C" locale has UTF-8 encoding.
+               And on native Windows, the "C" locale may have an 8-bit encoding
+               such as CP1252, that contains the U+2022 character.  */
+            {
+              const char *charset = locale_charset ();
+              if (strcmp (charset, "CP874") == 0
+                  || strcmp (charset, "CP1250") == 0
+                  || strcmp (charset, "CP1251") == 0
+                  || strcmp (charset, "CP1252") == 0
+                  || strcmp (charset, "CP1253") == 0
+                  || strcmp (charset, "CP1254") == 0
+                  || strcmp (charset, "CP1255") == 0
+                  || strcmp (charset, "CP1256") == 0
+                  || strcmp (charset, "CP1257") == 0
+                  || strcmp (charset, "CP1258") == 0)
+                ASSERT (strcmp (result, "\x95") == 0);
+              else
+                ASSERT (strcmp (result, TEST_CODE_AS_UTF8) == 0);
+            }
+            break;
+          case '2':
+            ASSERT (strcmp (result, TEST_CODE_AS_UTF8) == 0);
+            break;
+          case '3':
+            ASSERT (strcmp (result, TEST_CODE_AS_GB18030) == 0);
+            break;
+          }
+      break;
+    case 55:
+      ASSERT (strcmp (result, ".") == 0);
+      break;
+    default:
+      ASSERT (0);
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index d1e372ab2b7b510fc65b9647e94c56c65ab28432..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-unicodeio1.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..5f5f1bd3ade0110e40f162a4f87f2d4c7cf4fd60
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Test in the C locale.
+LC_ALL=C \
+${CHECKER} ./test-unicodeio${EXEEXT} 1
deleted file mode 120000 (symlink)
index 08fc7b85626f94aa5b8d70c03ec8bf85d38c27dd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-unicodeio2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..f0f197181b5b3b00fe9f6f1eab1376ea272b5eda
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-unicodeio${EXEEXT} 2
deleted file mode 120000 (symlink)
index 8d43419b99e4ac4648765b12768980ccf77ea0c8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-unicodeio3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..9a301cfe463b693a8c8b5faf1fa272c0b32a8e18
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no transitional chinese locale is installed"
+  else
+    echo "Skipping test: no transitional chinese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-unicodeio${EXEEXT} 3
deleted file mode 120000 (symlink)
index b3e6021506fbdc6fb8fa965b6b9fa3cadaa2d320..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-unistd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..931d65e439c4c998e07fa9cb8adadb9c962ed877
--- /dev/null
@@ -0,0 +1,54 @@
+/* Test of <unistd.h> substitute.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+static_assert (sizeof NULL == sizeof (void *));
+
+/* Check that the various SEEK_* macros are defined.  */
+int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+
+/* Check that the various *_FILENO macros are defined.  */
+#if ! (defined STDIN_FILENO                                     \
+       && (STDIN_FILENO + STDOUT_FILENO + STDERR_FILENO == 3))
+missing or broken *_FILENO macros
+#endif
+
+/* Check that the types are all defined.  */
+size_t t1;
+ssize_t t2;
+#ifdef TODO /* Not implemented in gnulib yet */
+uid_t t3;
+gid_t t4;
+#endif
+off_t t5;
+pid_t t6;
+#ifdef TODO
+useconds_t t7;
+intptr_t t8;
+#endif
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index db4e0e3a8938030c205f7ca8f1add7b84f54b241..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-unlink.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f857acbf230213cd85d3eae4e309757d110cf78e
--- /dev/null
@@ -0,0 +1,48 @@
+/* Tests of unlink.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (unlink, int, (char const *));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "unlinkdir.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-unlink.t"
+
+#include "test-unlink.h"
+
+int
+main (void)
+{
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  return test_unlink_func (unlink, true);
+}
deleted file mode 120000 (symlink)
index e79fcdf1244be635371fd8237f389742aa40318d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-unlink.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..800537db6d155e5dfc0478f2faea9e43544508bd
--- /dev/null
@@ -0,0 +1,86 @@
+/* Tests of unlink.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+/* This file is designed to test both unlink(n) and
+   unlinkat(AT_FDCWD,n,0).  FUNC is the function to test.  Assumes
+   that BASE and ASSERT are already defined, and that appropriate
+   headers are already included.  If PRINT, then warn before returning
+   status 77 when symlinks are unsupported.  */
+
+static int
+test_unlink_func (int (*func) (char const *name), bool print)
+{
+  /* Setup.  */
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  ASSERT (close (creat (BASE "dir/file", 0600)) == 0);
+
+  /* Basic error conditions.  */
+  errno = 0;
+  ASSERT (func ("") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "nosuch") == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func (BASE "nosuch/") == -1);
+  ASSERT (errno == ENOENT);
+  /* Resulting errno after directories is rather varied across
+     implementations (EPERM, EINVAL, EACCES, EBUSY, EISDIR, ENOTSUP);
+     however, we must be careful to not attempt unlink on a directory
+     unless we know it must fail.  */
+  if (cannot_unlink_dir ())
+    {
+      ASSERT (func (".") == -1);
+      ASSERT (func ("..") == -1);
+      ASSERT (func ("/") == -1);
+      ASSERT (func (BASE "dir") == -1);
+      ASSERT (mkdir (BASE "dir1", 0700) == 0);
+      ASSERT (func (BASE "dir1") == -1);
+      ASSERT (rmdir (BASE "dir1") == 0);
+    }
+  errno = 0;
+  ASSERT (func (BASE "dir/file/") == -1);
+  ASSERT (errno == ENOTDIR);
+
+  /* Test symlink behavior.  Specifying trailing slash will attempt
+     unlink of a directory, so only attempt it if we know it must
+     fail.  */
+  if (symlink (BASE "dir", BASE "link") != 0)
+    {
+      ASSERT (func (BASE "dir/file") == 0);
+      ASSERT (rmdir (BASE "dir") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  if (cannot_unlink_dir ())
+    ASSERT (func (BASE "link/") == -1);
+  ASSERT (func (BASE "link") == 0);
+  ASSERT (symlink (BASE "dir/file", BASE "link") == 0);
+  errno = 0;
+  ASSERT (func (BASE "link/") == -1);
+  ASSERT (errno == ENOTDIR);
+  /* Order here proves unlink of a symlink does not follow through to
+     the file.  */
+  ASSERT (func (BASE "link") == 0);
+  ASSERT (func (BASE "dir/file") == 0);
+  ASSERT (rmdir (BASE "dir") == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c0ba93dd92e74e58ea8e911e6e762054b5be777c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-unlinkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4c4cf752216cfad44d723397e90c6f3ea68a320c
--- /dev/null
@@ -0,0 +1,94 @@
+/* Tests of unlinkat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (unlinkat, int, (int, char const *, int));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#include "unlinkdir.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-unlinkat.t"
+
+#include "test-rmdir.h"
+#include "test-unlink.h"
+
+static int dfd = AT_FDCWD;
+
+/* Wrapper around unlinkat to test rmdir behavior.  */
+static int
+rmdirat (char const *name)
+{
+  return unlinkat (dfd, name, AT_REMOVEDIR);
+}
+
+/* Wrapper around unlinkat to test unlink behavior.  */
+static int
+unlinker (char const *name)
+{
+  return unlinkat (dfd, name, 0);
+}
+
+int
+main ()
+{
+  /* FIXME: Add tests of fd other than ".".  */
+  int result1;
+  int result2;
+
+  /* Remove any leftovers from a previous partial run.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (unlinkat (-1, "foo", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (unlinkat (99, "foo", 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  result1 = test_rmdir_func (rmdirat, false);
+  result2 = test_unlink_func (unlinker, false);
+  ASSERT (result1 == result2);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  result2 = test_rmdir_func (rmdirat, false);
+  ASSERT (result1 == result2);
+  result2 = test_unlink_func (unlinker, false);
+  ASSERT (result1 == result2);
+  ASSERT (close (dfd) == 0);
+  if (result1 == 77)
+    fputs ("skipping test: symlinks not supported on this file system\n",
+           stderr);
+  return result1;
+}
deleted file mode 120000 (symlink)
index 2cefb3fe9f860766371ba2ad4fb97d56ef9c7be9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-unsetenv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4e6a19ad0defd6dfc5e5932adabfd30a6861cb9e
--- /dev/null
@@ -0,0 +1,62 @@
+/* Tests of unsetenv.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (unsetenv, int, (char const *));
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Static to pacify gcc -Wanalyzer-putenv-of-auto-var.  */
+  static char entry[] = "b=2";
+
+  /* Test removal when multiple entries present.  */
+  ASSERT (putenv ((char *) "a=1") == 0);
+  ASSERT (putenv (entry) == 0);
+  entry[0] = 'a'; /* Unspecified what getenv("a") would be at this point.  */
+  ASSERT (unsetenv ("a") == 0); /* Both entries will be removed.  */
+  ASSERT (getenv ("a") == NULL);
+  ASSERT (unsetenv ("a") == 0);
+
+  /* Required to fail with EINVAL.  */
+  errno = 0;
+  ASSERT (unsetenv ("") == -1);
+  ASSERT (errno == EINVAL);
+  errno = 0;
+  ASSERT (unsetenv ("a=b") == -1);
+  ASSERT (errno == EINVAL);
+#if 0
+  /* glibc and gnulib's implementation guarantee this, but POSIX no
+     longer requires it: http://austingroupbugs.net/view.php?id=185  */
+  errno = 0;
+  ASSERT (unsetenv (NULL) == -1);
+  ASSERT (errno == EINVAL);
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index f0a219151d1011edbe7c3818645b16784289640e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-update-copyright.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b2a7f2df8a77641e91eecb227afdb739081572c1
--- /dev/null
@@ -0,0 +1,611 @@
+#!/bin/sh
+# Test suite for update-copyright.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+diffout=`diff -u /dev/null /dev/null 2>&1`
+if test x"$diffout" = x"" && test $? -eq 0; then
+  compare() { diff -u "$@"; }
+else
+  compare() { cmp "$@"; }
+fi
+
+# Ensure the update-copyright program gets found.
+PATH=$abs_aux_dir:$PATH
+export PATH
+
+TMP_BASE=update-copyright.test
+trap 'rm -f $TMP_BASE*' EXIT HUP INT QUIT TERM
+
+## --------------------------------- ##
+## Skip if user does not have perl.  ##
+## --------------------------------- ##
+
+TMP=$TMP_BASE
+s=$TMP-script
+cat <<\EOF > $s
+#!/bin/sh
+#! -*-perl-*-
+# This is a prologue that allows to run a perl script as an executable
+# on systems that are compliant to a POSIX version before POSIX:2017.
+# On such systems, the usual invocation of an executable through execlp()
+# or execvp() fails with ENOEXEC if it is a script that does not start
+# with a #! line.  The script interpreter mentioned in the #! line has
+# to be /bin/sh, because on GuixSD systems that is the only program that
+# has a fixed file name.  The second line is essential for perl and is
+# also useful for editing this file in Emacs.  The next two lines below
+# are valid code in both sh and perl.  When executed by sh, they re-execute
+# the script through the perl program found in $PATH.  The '-x' option
+# is essential as well; without it, perl would re-execute the script
+# through /bin/sh.  When executed by perl, the next two lines are a no-op.
+eval 'exec perl -wSx -pi "$0" "$@"'
+     if 0;
+
+s/a/b/
+EOF
+chmod a+x $s
+echo a > $TMP-in
+./$s $TMP-in 2>/dev/null && test b = "`cat $TMP-in 2>/dev/null`" ||
+  {
+    printf '%s\n' "$0: skipping this test;" \
+      'your system has insufficient support for Perl' 1>&2
+    exit 77
+  }
+
+# Skip this test if Perl is too old.  FIXME: 5.8.0 is just a guess.
+# We have a report that 5.6.1 is inadequate and that 5.8.0 works.
+perl -e 'require 5.8.0' || {
+  echo "$0: skipping this test; Perl version is too old" 1>&2
+  exit 77
+}
+
+# Do not let a different envvar setting perturb results.
+UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72
+export UPDATE_COPYRIGHT_MAX_LINE_LENGTH
+
+# This assignment to 'ight' is so that data can contain strings
+# like "Copy$ight 2024 Free Software Foundation, Inc." without being
+# mistakenly updated by "cd .. && make update-copyright".
+ight=right
+
+## ----------------------------- ##
+## Examples from documentation.  ##
+## ----------------------------- ##
+
+TMP=$TMP_BASE-ex
+cat > $TMP-1 <<EOF
+Copy$ight @copy$ight{} 1990-2005, 2007-2009 Free Software
+Foundation, Inc.
+EOF
+cat > $TMP-2 <<EOF
+# Copy$ight (C) 1990-2005, 2007-2009 Free Software
+# Foundation, Inc.
+EOF
+cat > $TMP-3 <<EOF
+/*
+ * Copy$ight &copy; 90,2005,2007-2009
+ * Free Software Foundation, Inc.
+ */
+EOF
+cat > $TMP-4 <<EOF
+## Copy$ight (C) 1990-2005, 2007-2009 Free Software
+#  Foundation, Inc.
+EOF
+cat > $TMP-5 <<EOF
+Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
+EOF
+cat > $TMP-6 <<EOF
+## Copy$ight (C) 1990-2005, 2007-2009 Free Software
+#  Foundation, Inc.
+
+Copy$ight (C) 1990-2005, 2007-2009 Free Software Foundation,
+Inc.
+EOF
+cat > $TMP-7 <<EOF
+Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
+
+# Copy$ight (C) 1990-2005, 2007-2009 Free Software
+# Foundation, Inc.
+EOF
+cat > $TMP-8 <<EOF
+Copy$ight (C) 2008 Free Software Foundation, Inc.
+Copy$ight (C) 2008 Free Software Foundation, Inc.
+EOF
+
+UPDATE_COPYRIGHT_YEAR=2009 \
+  update-copyright $TMP-? 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare - $TMP-stderr <<EOF || exit 1
+$TMP-4: warning: copyright statement not found
+$TMP-5: warning: copyright statement not found
+EOF
+compare - $TMP-1 <<EOF || exit 1
+Copy$ight @copy$ight{} 1990-2005, 2007-2009 Free Software
+Foundation, Inc.
+EOF
+compare - $TMP-2 <<EOF || exit 1
+# Copy$ight (C) 1990-2005, 2007-2009 Free Software
+# Foundation, Inc.
+EOF
+compare - $TMP-3 <<EOF || exit 1
+/*
+ * Copy$ight &copy; 90,2005,2007-2009
+ * Free Software Foundation, Inc.
+ */
+EOF
+compare - $TMP-4 <<EOF || exit 1
+## Copy$ight (C) 1990-2005, 2007-2009 Free Software
+#  Foundation, Inc.
+EOF
+compare - $TMP-5 <<EOF || exit 1
+Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
+EOF
+compare - $TMP-6 <<EOF || exit 1
+## Copy$ight (C) 1990-2005, 2007-2009 Free Software
+#  Foundation, Inc.
+
+Copy$ight (C) 1990-2005, 2007-2009 Free Software Foundation,
+Inc.
+EOF
+compare - $TMP-7 <<EOF || exit 1
+Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
+
+# Copy$ight (C) 1990-2005, 2007-2009 Free Software
+# Foundation, Inc.
+EOF
+compare - $TMP-8 <<EOF || exit 1
+Copy$ight (C) 2008, 2009 Free Software Foundation, Inc.
+Copy$ight (C) 2008, 2009 Free Software Foundation, Inc.
+EOF
+
+UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
+  update-copyright $TMP-? 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare - $TMP-stderr <<EOF || exit 1
+$TMP-4: warning: copyright statement not found
+$TMP-5: warning: copyright statement not found
+EOF
+compare - $TMP-1 <<EOF || exit 1
+Copy$ight @copy$ight{} 1990-2005, 2007-2010 Free Software Foundation,
+Inc.
+EOF
+compare - $TMP-2 <<EOF || exit 1
+# Copy$ight (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
+EOF
+compare - $TMP-3 <<EOF || exit 1
+/*
+ * Copy$ight &copy; 1990, 2005, 2007-2010 Free Software Foundation, Inc.
+ */
+EOF
+compare - $TMP-4 <<EOF || exit 1
+## Copy$ight (C) 1990-2005, 2007-2009 Free Software
+#  Foundation, Inc.
+EOF
+compare - $TMP-5 <<EOF || exit 1
+Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
+EOF
+compare - $TMP-6 <<EOF || exit 1
+## Copy$ight (C) 1990-2005, 2007-2009 Free Software
+#  Foundation, Inc.
+
+Copy$ight (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
+EOF
+compare - $TMP-7 <<EOF || exit 1
+Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
+
+# Copy$ight (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
+EOF
+
+UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \
+  update-copyright $TMP-? 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare - $TMP-stderr <<EOF || exit 1
+$TMP-4: warning: copyright statement not found
+$TMP-5: warning: copyright statement not found
+EOF
+compare - $TMP-1 <<EOF || exit 1
+Copy$ight @copy$ight{} 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+Free Software Foundation, Inc.
+EOF
+compare - $TMP-2 <<EOF || exit 1
+# Copy$ight (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
+# Software Foundation, Inc.
+EOF
+compare - $TMP-3 <<EOF || exit 1
+/*
+ * Copy$ight &copy; 1990, 2005, 2007, 2008, 2009, 2010 Free Software
+ * Foundation, Inc.
+ */
+EOF
+compare - $TMP-4 <<EOF || exit 1
+## Copy$ight (C) 1990-2005, 2007-2009 Free Software
+#  Foundation, Inc.
+EOF
+compare - $TMP-5 <<EOF || exit 1
+Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
+EOF
+compare - $TMP-6 <<EOF || exit 1
+## Copy$ight (C) 1990-2005, 2007-2009 Free Software
+#  Foundation, Inc.
+
+Copy$ight (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
+EOF
+compare - $TMP-7 <<EOF || exit 1
+Copy$ight (C) 1990-2005, 2007-2009 Acme, Inc.
+
+# Copy$ight (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
+# Software Foundation, Inc.
+EOF
+
+rm $TMP*
+
+## ------------------------ ##
+## Examples from man pages  ##
+## ------------------------ ##
+
+TMP=$TMP_BASE-man
+cat > $TMP.1 <<EOF
+'\" Copy$ight (C) 1998-2009 Free Software Foundation, Inc.
+EOF
+cat > $TMP.2 <<EOF
+Copy$ight \(co 1998-2009 Free Software Foundation, Inc.
+EOF
+cat > $TMP.3 <<EOF
+Copy$ight \(co 1998\(en2009 Free Software Foundation, Inc.
+EOF
+cat > $TMP.4 <<EOF
+Copy$ight \(co 2009 Free Software Foundation, Inc.
+EOF
+
+UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
+  update-copyright $TMP.? 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP.1 <<EOF || exit 1
+'\" Copy$ight (C) 1998\(en2010 Free Software Foundation, Inc.
+EOF
+compare - $TMP.2 <<EOF || exit 1
+Copy$ight \(co 1998\(en2010 Free Software Foundation, Inc.
+EOF
+compare - $TMP.3 <<EOF || exit 1
+Copy$ight \(co 1998\(en2010 Free Software Foundation, Inc.
+EOF
+compare - $TMP.4 <<EOF || exit 1
+Copy$ight \(co 2009\(en2010 Free Software Foundation, Inc.
+EOF
+
+rm $TMP*
+
+## -------------- ##
+## Current year.  ##
+## -------------- ##
+
+TMP=$TMP_BASE-current-year
+YEAR=`date +%Y`
+cat > $TMP <<EOF
+'\" Copy$ight (C) 2006
+'\" Free Software Foundation,
+'\" Inc.
+EOF
+update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+'\" Copyright (C) 2006, $YEAR Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_USE_INTERVALS=1 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+'\" Copy$ight (C) 2006, $YEAR Free Software Foundation, Inc.
+EOF
+rm $TMP*
+
+## ------------------ ##
+## Surrounding text.  ##
+## ------------------ ##
+
+TMP=$TMP_BASE-surrounding-text
+cat > $TMP <<EOF
+    Undisturbed text.
+dnl Undisturbed text.
+dnl Copy$ight (C) 89
+dnl Free Software Foundation, Inc.
+dnl   Undisturbed text.
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+    Undisturbed text.
+dnl Undisturbed text.
+dnl Copy$ight (C) 1989, 2010 Free Software Foundation, Inc.
+dnl   Undisturbed text.
+EOF
+rm $TMP*
+
+## --------------- ##
+## Widest prefix.  ##
+## --------------- ##
+
+TMP=$TMP_BASE-widest-prefix
+cat > $TMP <<EOF
+#### Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
+#### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+#### 2008 Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+#### Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984,
+#### 1985, 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+#### 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+#### Copy$ight (C) 1976-1988, 1999-2008, 2010-2011 Free Software
+#### Foundation, Inc.
+EOF
+rm $TMP*
+
+## ------------------- ##
+## Prefix too large.  ##
+## ------------------- ##
+
+TMP=$TMP_BASE-prefix-too-large
+cat > $TMP <<EOF
+####  Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
+####  1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+####  2008 Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare - $TMP-stderr <<EOF || exit 1
+$TMP: warning: copyright statement not found
+EOF
+compare - $TMP <<EOF || exit 1
+####  Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
+####  1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+####  2008 Free Software Foundation, Inc.
+EOF
+rm $TMP*
+
+## ------------- ##
+## Blank lines.  ##
+## ------------- ##
+
+TMP=$TMP_BASE-blank-lines
+cat > $TMP <<EOF
+#Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
+#
+#1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+#2008 Free Software Foundation, Inc.
+
+Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
+
+1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+2008 Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare - $TMP-stderr <<EOF || exit 1
+$TMP: warning: copyright statement not found
+EOF
+compare - $TMP <<EOF || exit 1
+#Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
+#
+#1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+#2008 Free Software Foundation, Inc.
+
+Copy$ight (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985,
+
+1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+2008 Free Software Foundation, Inc.
+EOF
+rm $TMP*
+
+## -------------- ##
+## Leading tabs.  ##
+## -------------- ##
+
+TMP=$TMP_BASE-leading-tabs
+cat > $TMP <<EOF
+       Copy$ight (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98,
+        1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
+       Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+       Copy$ight (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996,
+       1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+       2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+       Copy$ight (C) 1987-1988, 1991-2011 Free Software Foundation,
+       Inc.
+EOF
+rm $TMP*
+
+## -------------------- ##
+## Unusual whitespace.  ##
+## -------------------- ##
+
+TMP=$TMP_BASE-unusual-ws
+cat > $TMP <<EOF
+               # Copy$ight (C) 87-88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+               # 98, 1999, 2000, 2001, 2002, 2003,             \f         2004, 2005, 2006, 2007, 2008,
+               # 2009 Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+               # Copy$ight (C) 1987, 1988, 1991, 1992, 1993, 1994,
+               # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+               # 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+               # Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+               # Copy$ight (C) 1987-1988, 1991-2011 Free Software
+               # Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=2 \
+  UPDATE_COPYRIGHT_FORCE=1 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+               # Copy$ight (C) 1987-2011 Free Software Foundation, Inc.
+EOF
+rm $TMP*
+
+## --------- ##
+## DOS EOL.  ##
+## --------- ##
+
+TMP=$TMP_BASE-dos-eol
+tr @ '\015' > $TMP <<EOF
+Rem Copy$ight (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@
+Rem 98, 1999, 2000, 2001, 2002, 2003,  2004, 2005, 2006, 2007, 2008,@
+Rem 2009 Free Software Foundation, Inc.@
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+tr @ '\015' > $TMP-exp <<EOF
+Rem Copy$ight (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@
+Rem 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@
+Rem 2009, 2010 Free Software Foundation, Inc.@
+EOF
+compare $TMP-exp $TMP || exit 1
+rm $TMP*
+
+## --------------- ##
+## Omitted "(C)".  ##
+## --------------- ##
+
+TMP=$TMP_BASE-omitted-circle-c
+cat > $TMP <<EOF
+  Copy$ight 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+  98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009 Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+  update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+  Copy$ight 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+  1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+  Free Software Foundation, Inc.
+EOF
+rm $TMP*
+
+## ------------------ ##
+## C-style comments.  ##
+## ------------------ ##
+
+TMP=$TMP_BASE-c-style-comments
+cat > $TMP.star <<EOF
+/*  Copy$ight 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+ *  98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+ *  2009 Free Software Foundation, Inc.  */
+EOF
+cat > $TMP.space <<EOF
+  /*Copy$ight 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+    98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+    2009 Free Software Foundation, Inc.  */
+EOF
+cat > $TMP.single-line <<EOF
+/*   Copy$ight 87, 1991, 1992 Free Software Foundation, Inc.  */
+EOF
+cat > $TMP.single-line-wrapped <<EOF
+ /* Copy$ight 1988, 1991, 1992, 1993 Free Software Foundation, Inc.  */
+EOF
+cat > $TMP.extra-text-star <<EOF
+ /* Copy$ight 1987, 1988, 1991, 1992 Free Software Foundation, Inc.  End
+  * More comments.  */
+EOF
+cat > $TMP.extra-text-space <<EOF
+ /* Copy$ight 1987, 1988, 1991, 1992 Free Software Foundation, Inc. ***
+    * End of comments. */
+EOF
+cat > $TMP.two-digit-final-is-substr-of-first <<EOF
+ /* Copy$ight 1991, 99 Free Software Foundation, Inc. */
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+  update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP.star <<EOF || exit 1
+/*  Copy$ight 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+ *  1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+ *  2009, 2010 Free Software Foundation, Inc.  */
+EOF
+compare - $TMP.space <<EOF || exit 1
+  /*Copy$ight 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+    1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+    2009, 2010 Free Software Foundation, Inc.  */
+EOF
+compare - $TMP.single-line <<EOF || exit 1
+/*   Copy$ight 1987, 1991, 1992, 2010 Free Software Foundation, Inc.  */
+EOF
+compare - $TMP.single-line-wrapped <<EOF || exit 1
+ /* Copy$ight 1988, 1991, 1992, 1993, 2010 Free Software Foundation,
+  * Inc.  */
+EOF
+compare - $TMP.extra-text-star <<EOF || exit 1
+ /* Copy$ight 1987, 1988, 1991, 1992, 2010 Free Software Foundation,
+  * Inc.  End
+  * More comments.  */
+EOF
+compare - $TMP.extra-text-space <<EOF || exit 1
+ /* Copy$ight 1987, 1988, 1991, 1992, 2010 Free Software Foundation,
+    Inc. ***
+    * End of comments. */
+EOF
+compare - $TMP.two-digit-final-is-substr-of-first <<EOF || exit 1
+ /* Copy$ight 1991, 1999, 2010 Free Software Foundation, Inc. */
+EOF
+rm $TMP*
+
+exit 0
deleted file mode 120000 (symlink)
index 1da7a99087387e27f0d12b7b27dac1f4a2e73938..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-userspec.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e1f375513a76c1af9aed225858d878317318cc03
--- /dev/null
@@ -0,0 +1,223 @@
+/* Test userspec.c
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "userspec.h"
+
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <grp.h>
+
+#include "xalloc.h"
+
+#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
+
+struct test
+{
+  char in[100];
+  uid_t uid;
+  gid_t gid;
+  const char *user_name;
+  const char *group_name;
+  const char *result;
+};
+
+static struct test T[] =
+  {
+    { "",                       -1, -1, "",   "",   NULL},
+    { ":",                      -1, -1, "",   "",   NULL},
+    { "+0:+0",                   0,  0, "",   "",   NULL},
+    { "+0:+0",                   0,  0, "",   "",   NULL},
+    { ":+1",                    -1,  1, "",   "",   NULL},
+    { "+1",                      1, -1, "",   "",   NULL},
+    { ":+0",                    -1,  0, "",   "",   NULL},
+    { "+22:+42",                22, 42, "",   "",   NULL},
+    /* (uint32_t)-1 should be invalid everywhere */
+    { "+4294967295:+4294967295", 0,  0, NULL, NULL, "invalid user"},
+    /* likewise, but with only the group being invalid */
+    { "+0:+4294967295",          0,  0, NULL, NULL, "invalid group"},
+    { ":+4294967295",            0,  0, NULL, NULL, "invalid group"},
+    /* and only the user being invalid */
+    { "+4294967295:+0",          0,  0, NULL, NULL, "invalid user"},
+    /* and using 2^32 */
+    { "+4294967296:+4294967296", 0,  0, NULL, NULL, "invalid user"},
+    { "+0:+4294967296",          0,  0, NULL, NULL, "invalid group"},
+    { ":+4294967296",            0,  0, NULL, NULL, "invalid group"},
+    { "+4294967296:+0",          0,  0, NULL, NULL, "invalid user"},
+    /* numeric user and no group is invalid */
+    { "+4294967295:",            0,  0, NULL, NULL, "invalid spec"},
+    { "+4294967296:",            0,  0, NULL, NULL, "invalid spec"},
+    { "+1:",                     0,  0, NULL, NULL, "invalid spec"},
+    { "+0:",                     0,  0, NULL, NULL, "invalid spec"},
+
+    /* "username:" must expand to UID:GID where GID is username's login group */
+    /* Add an entry like the following to the table, if possible.
+    { "U_NAME:",              UID,GID, U_NAME, G_NAME, NULL}, */
+    { "" /* placeholder */,    -1, -1,     "",     "", NULL},
+  };
+
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
+static char const *
+maybe_null (char const *s)
+{
+  return s ? s : "NULL";
+}
+
+static bool
+same_diag (char const *s, char const *t)
+{
+  if (s == NULL && t == NULL)
+    return true;
+  if (s == NULL || t == NULL)
+    return false;
+  return STREQ (s, t);
+}
+
+int
+main (void)
+{
+  unsigned int i;
+  int fail = 0;
+
+  /* Find a UID that has both a user name and login group name,
+     but skip UID 0.  */
+  {
+    uid_t uid;
+    for (uid = 1200; 0 < uid; uid--)
+      {
+        struct group *gr;
+        struct passwd *pw = getpwuid (uid);
+        unsigned int j;
+        size_t len;
+        if (!pw || !pw->pw_name || !(gr = getgrgid (pw->pw_gid)) || !gr->gr_name)
+          continue;
+        j = ARRAY_CARDINALITY (T) - 1;
+        len = strlen (pw->pw_name);
+        if (sizeof T[j].in - 2 < len)
+          continue;
+
+        /* Store "username:" in T[j].in.  */
+        memcpy(T[j].in, pw->pw_name, len);
+        strcpy(T[j].in + len, ":");
+
+        T[j].uid = uid;
+        T[j].gid = gr->gr_gid;
+        T[j].user_name = xstrdup (pw->pw_name);
+        T[j].group_name = xstrdup (gr->gr_name);
+        T[j].result = NULL;
+        break;
+      }
+  }
+
+  char *user_name = NULL;
+  char *group_name = NULL;
+
+  for (i = 0; i < ARRAY_CARDINALITY (T); i++)
+    {
+      uid_t uid = (uid_t) -1;
+      gid_t gid = (gid_t) -1;
+      free (user_name);
+      free (group_name);
+      char const *diag = parse_user_spec (T[i].in, &uid, &gid,
+                                          &user_name, &group_name);
+      if (!same_diag (diag, T[i].result))
+        {
+          printf ("%s return value mismatch: got %s, expected %s\n",
+                  T[i].in, maybe_null (diag), maybe_null (T[i].result));
+          fail = 1;
+          continue;
+        }
+
+      if (diag)
+        continue;
+
+      if (uid != T[i].uid || gid != T[i].gid)
+        {
+          printf ("%s mismatch (-: expected uid,gid; +:actual)\n"
+                  "-%3lu,%3lu\n+%3lu,%3lu\n",
+                  T[i].in,
+                  (unsigned long int) T[i].uid,
+                  (unsigned long int) T[i].gid,
+                  (unsigned long int) uid,
+                  (unsigned long int) gid);
+          fail = 1;
+        }
+
+      if (T[i].result)
+        {
+          /* Expected a non-NULL result diagnostic, yet got NULL.  */
+          diag = "NULL";
+          printf ("%s diagnostic mismatch (-: expected diagnostic; +:actual)\n"
+                  "-%s\n+%s\n", T[i].in, T[i].result, diag);
+          fail = 1;
+        }
+      else
+        {
+          /* Should get the same result, but with a warning, if replacing
+             ':' with '.'.  */
+          char *colon = strchr (T[i].in, ':');
+          if (colon)
+            {
+              *colon = '.';
+              uid_t uid2 = -1;
+              gid_t gid2 = -1;
+              char *user_name2 = NULL;
+              char *group_name2 = NULL;
+              bool warn;
+              if (! (parse_user_spec_warn (T[i].in, &uid2, &gid2,
+                                           &user_name2, &group_name2, &warn)
+                     && warn))
+                printf ("%s did not warn\n", T[i].in);
+              else if (! (uid == uid2 && gid == gid2
+                          && !!user_name == !!user_name2
+                          && (!user_name || STREQ (user_name, user_name2))
+                          && !!group_name == !!group_name2
+                          && (!group_name || STREQ (group_name, group_name2))))
+                printf ("%s treated differently than with colon\n", T[i].in);
+
+              free (user_name2);
+              free (group_name2);
+            }
+        }
+    }
+
+  /* Ensure NULL parameters are ignored.  */
+  {
+    uid_t uid = (uid_t) -1;
+    char const *diag = parse_user_spec ("", &uid, NULL, NULL, NULL);
+    if (diag)
+      {
+        printf ("unexpected error: %s\n", diag);
+        fail = 1;
+      }
+  }
+
+  return fail;
+}
+
+/*
+Local Variables:
+indent-tabs-mode: nil
+End:
+*/
deleted file mode 120000 (symlink)
index c46b00dbd9fc7c7ca5f99b5c88e5e7b80b502c40..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-usleep.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ba82a1620f4e31ccf797ced13ac8f45f86b3f2e5
--- /dev/null
@@ -0,0 +1,40 @@
+/* Test of usleep() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (usleep, int, (useconds_t));
+
+#include <time.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  time_t start = time (NULL);
+  ASSERT (usleep (1000000) == 0);
+  ASSERT (start < time (NULL));
+
+  ASSERT (usleep (0) == 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index cadf0ea21fe59f88c0c3c3c9392da072ba09cce0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-utime-h.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..908a0e72544b7d2de35d05158b5bb13013ce79bc
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test of <utime.h> substitute.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2017.  */
+
+#include <config.h>
+
+#include <utime.h>
+
+/* Check that 'struct utimbuf' is defined.  */
+struct utimbuf b;
+
+int
+main (void)
+{
+  b.actime = b.modtime = 1493490248; /* 2017-04-29 18:24:08 GMT */
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3d3b0daa0b34e29e7bca098bab2441989914c33e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-utime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5e228d334bd4fc6460eb0a9c8e87ea6d87ab1376
--- /dev/null
@@ -0,0 +1,141 @@
+/* Tests of utime.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <utime.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-utime.t"
+
+#include "test-utimens-common.h"
+
+/* If PRINT, warn before skipping tests with status 77.  */
+static int
+test_utime (bool print)
+{
+  struct stat st1;
+  struct stat st2;
+
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  ASSERT (stat (BASE "file", &st1) == 0);
+  nap ();
+  ASSERT (utime (BASE "file", NULL) == 0);
+  ASSERT (stat (BASE "file", &st2) == 0);
+  ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE));
+  if (check_ctime)
+    ASSERT (ctime_compare (&st1, &st2) < 0);
+  {
+    /* On some NFS systems, the 'now' timestamp of creat or a NULL
+       utimbuf is determined by the server, but the 'now' timestamp
+       determined by time() is determined by the client; since the two
+       machines are not necessarily on the same clock, this is another
+       case where time can appear to go backwards.  The rest of this
+       test cares about client time, so manually use time() to set
+       both times.  */
+    struct utimbuf ts;
+    ts.actime = ts.modtime = time (NULL);
+    ASSERT (utime (BASE "file", &ts) == 0);
+    ASSERT (stat (BASE "file", &st1) == 0);
+    nap ();
+  }
+
+  /* Invalid arguments.  */
+  errno = 0;
+  ASSERT (utime ("no_such", NULL) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (utime ("no_such/", NULL) == -1);
+  ASSERT (errno == ENOENT || errno == ENOTDIR);
+  errno = 0;
+  ASSERT (utime ("", NULL) == -1);
+  ASSERT (errno == ENOENT);
+  {
+    struct utimbuf ts;
+    ts.actime = ts.modtime = Y2K;
+    errno = 0;
+    ASSERT (utime (BASE "file/", &ts) == -1);
+    ASSERT (errno == ENOTDIR || errno == EINVAL);
+  }
+  ASSERT (stat (BASE "file", &st2) == 0);
+  ASSERT (st1.st_atime == st2.st_atime);
+  ASSERT (get_stat_atime_ns (&st1) == get_stat_atime_ns (&st2));
+  ASSERT (utimecmp (BASE "file", &st1, &st2, 0) == 0);
+
+  /* Set both times.  */
+  {
+    struct utimbuf ts;
+    ts.actime = ts.modtime = Y2K;
+    ASSERT (utime (BASE "file", &ts) == 0);
+    ASSERT (stat (BASE "file", &st2) == 0);
+    ASSERT (st2.st_atime == Y2K);
+    ASSERT (0 <= get_stat_atime_ns (&st2));
+    ASSERT (get_stat_atime_ns (&st2) < BILLION / 2);
+    ASSERT (st2.st_mtime == Y2K);
+    ASSERT (0 <= get_stat_mtime_ns (&st2));
+    ASSERT (get_stat_mtime_ns (&st2) < BILLION);
+    if (check_ctime)
+      ASSERT (ctime_compare (&st1, &st2) < 0);
+  }
+
+  /* Make sure this dereferences symlinks.  */
+  if (symlink (BASE "file", BASE "link"))
+    {
+      ASSERT (unlink (BASE "file") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  ASSERT (lstat (BASE "link", &st1) == 0);
+  ASSERT (st1.st_mtime != Y2K);
+  errno = 0;
+  ASSERT (utime (BASE "link/", NULL) == -1);
+  ASSERT (errno == ENOTDIR);
+  {
+    struct utimbuf ts;
+    ts.actime = ts.modtime = Y2K;
+    ASSERT (utime (BASE "link", &ts) == 0);
+    ASSERT (lstat (BASE "link", &st2) == 0);
+    /* Can't compare atimes, since lstat() changes symlink atime on cygwin.  */
+    ASSERT (st1.st_mtime == st2.st_mtime);
+    ASSERT (stat (BASE "link", &st2) == 0);
+    ASSERT (st2.st_mtime == Y2K);
+    ASSERT (get_stat_mtime_ns (&st2) == 0);
+  }
+
+  /* Cleanup.  */
+  ASSERT (unlink (BASE "link") == 0);
+  ASSERT (unlink (BASE "file") == 0);
+  return 0;
+}
+
+int
+main (void)
+{
+  int result1; /* Skip because of no symlink support.  */
+
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  result1 = test_utime (true);
+  return result1;
+}
deleted file mode 120000 (symlink)
index 9a2334829b7fb0dcf5e2c5b139818b9fe5301039..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-utimens-common.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..317a01b3dad5c4d598c30da1adc2b4cb3796e555
--- /dev/null
@@ -0,0 +1,82 @@
+/* Test of file timestamp modification functions.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file defines some prerequisites useful to utime-related tests.  */
+
+#ifndef GL_TEST_UTIMENS_COMMON
+# define GL_TEST_UTIMENS_COMMON
+
+# include <fcntl.h>
+# include <errno.h>
+# include <string.h>
+# include <sys/stat.h>
+# include <unistd.h>
+
+/* Gnulib modules.  */
+# include "stat-time.h"
+# include "timespec.h"
+# include "utimecmp.h"
+
+/* Gnulib test header.  */
+# include "nap.h"
+
+enum {
+  BILLION = 1000 * 1000 * 1000,
+
+  Y2K = 946684800, /* Jan 1, 2000, in seconds since epoch.  */
+
+  /* Bogus positive and negative tv_nsec values closest to valid
+     range, but without colliding with UTIME_NOW or UTIME_OMIT.  */
+  UTIME_BOGUS_POS = BILLION + ((UTIME_NOW == BILLION || UTIME_OMIT == BILLION)
+                               ? (1 + (UTIME_NOW == BILLION + 1)
+                                  + (UTIME_OMIT == BILLION + 1))
+                               : 0),
+  UTIME_BOGUS_NEG = -1 - ((UTIME_NOW == -1 || UTIME_OMIT == -1)
+                          ? (1 + (UTIME_NOW == -2) + (UTIME_OMIT == -2))
+                          : 0)
+};
+
+# if defined _WIN32 && !defined __CYGWIN__
+/* Skip ctime tests on native Windows, since it is either a copy of
+   mtime or birth time (depending on the file system), rather than a
+   properly tracked change time.  See
+   <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions>.  */
+#  define check_ctime 0
+# elif defined __APPLE__ && defined __MACH__
+/* On macOS, the ctime is not updated when only the st_atime changes.  */
+#  define check_ctime -1
+# else
+#  define check_ctime 1
+# endif
+
+/* Compare two st_ctime values.  Return -1, 0 or 1, respectively
+   when A's st_ctime is smaller than, equal to or greater than B's.  */
+static int
+ctime_compare (struct stat const *a, struct stat const *b)
+{
+  if (a->st_ctime < b->st_ctime)
+    return -1;
+  else if (b->st_ctime < a->st_ctime)
+    return 1;
+  else if (get_stat_ctime_ns (a) < get_stat_ctime_ns (b))
+    return -1;
+  else if (get_stat_ctime_ns (b) < get_stat_ctime_ns (a))
+    return 1;
+  else
+    return 0;
+}
+
+#endif /* GL_TEST_UTIMENS_COMMON */
deleted file mode 120000 (symlink)
index fc75352ff2e134d4c9bf078533a444120b899376..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-utimens.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f77ceb4dc89760461a48b86b939498281e07bfc8
--- /dev/null
@@ -0,0 +1,79 @@
+/* Tests of utimens.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include "utimens.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-utimens.t"
+
+#include "test-futimens.h"
+#include "test-lutimens.h"
+#include "test-utimens.h"
+
+/* Wrap fdutimens to behave like futimens.  */
+static int
+do_futimens (int fd, struct timespec const times[2])
+{
+  return fdutimens (fd, NULL, times);
+}
+
+/* Test the use of file descriptors alongside a name.  */
+static int
+do_fdutimens (char const *name, struct timespec const times[2])
+{
+  int result;
+  int fd = open (name, O_WRONLY);
+  if (fd < 0)
+    fd = open (name, O_RDONLY);
+  errno = 0;
+  result = fdutimens (fd, name, times);
+  if (0 <= fd)
+    {
+      int saved_errno = errno;
+      close (fd);
+      errno = saved_errno;
+    }
+  return result;
+}
+
+int
+main (void)
+{
+  int result1; /* Skip because of no symlink support.  */
+  int result2; /* Skip because of no futimens support.  */
+  int result3; /* Skip because of no lutimens support.  */
+
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  result1 = test_utimens (utimens, true);
+  ASSERT (test_utimens (do_fdutimens, false) == result1);
+  /* Print only one skip message.  */
+  result2 = test_futimens (do_futimens, result1 == 0);
+  result3 = test_lutimens (lutimens, (result1 + result2) == 0);
+  /* We expect 0/0, 0/77, or 77/77, but not 77/0.  */
+  ASSERT (result1 <= result3);
+  return result1 | result2 | result3;
+}
deleted file mode 120000 (symlink)
index 2a913aac565d88340da3ef6e6b767685d370ec88..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-utimens.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..83d785a4dd8a29f43bf53141b8bdfdc32975962c
--- /dev/null
@@ -0,0 +1,184 @@
+/* Test of file timestamp modification functions.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-utimens-common.h"
+
+/* This file is designed to test both utimens(a,b) and
+   utimensat(AT_FDCWD,a,b,0).  FUNC is the function to test.  Assumes
+   that BASE and ASSERT are already defined.  If PRINT, warn before
+   skipping tests with status 77.  */
+static int
+test_utimens (int (*func) (char const *, struct timespec const *), bool print)
+{
+  struct stat st1;
+  struct stat st2;
+
+  ASSERT (close (creat (BASE "file", 0600)) == 0);
+  /* If utimens truncates to worse resolution than the file system
+     supports, then time can appear to go backwards between now and a
+     follow-up utimens with UTIME_NOW or a NULL timespec.  Use
+     UTIMECMP_TRUNCATE_SOURCE to compensate, with st1 as the
+     source.  */
+  ASSERT (stat (BASE "file", &st1) == 0);
+  nap ();
+  ASSERT (func (BASE "file", NULL) == 0);
+  ASSERT (stat (BASE "file", &st2) == 0);
+  ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE));
+  if (check_ctime)
+    ASSERT (ctime_compare (&st1, &st2) < 0);
+  {
+    /* On some NFS systems, the 'now' timestamp of creat or a NULL
+       timespec is determined by the server, but the 'now' timestamp
+       determined by gettime() (as is done when using UTIME_NOW) is
+       determined by the client; since the two machines are not
+       necessarily on the same clock, this is another case where time
+       can appear to go backwards.  The rest of this test cares about
+       client time, so manually use gettime() to set both times.  */
+    struct timespec ts[2];
+    gettime (&ts[0]);
+    ts[1] = ts[0];
+    ASSERT (func (BASE "file", ts) == 0);
+    ASSERT (stat (BASE "file", &st1) == 0);
+    nap ();
+  }
+
+  /* Invalid arguments.  */
+  errno = 0;
+  ASSERT (func ("no_such", NULL) == -1);
+  ASSERT (errno == ENOENT);
+  errno = 0;
+  ASSERT (func ("no_such/", NULL) == -1);
+  ASSERT (errno == ENOENT || errno == ENOTDIR);
+  errno = 0;
+  ASSERT (func ("", NULL) == -1);
+  ASSERT (errno == ENOENT);
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = UTIME_BOGUS_POS;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = 0;
+    errno = 0;
+    ASSERT (func (BASE "file", ts) == -1);
+    ASSERT (errno == EINVAL);
+  }
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = UTIME_BOGUS_NEG;
+    errno = 0;
+    ASSERT (func (BASE "file", ts) == -1);
+    ASSERT (errno == EINVAL);
+  }
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1] = ts[0];
+    errno = 0;
+    ASSERT (func (BASE "file/", ts) == -1);
+    ASSERT (errno == ENOTDIR || errno == EINVAL);
+  }
+  ASSERT (stat (BASE "file", &st2) == 0);
+  ASSERT (st1.st_atime == st2.st_atime);
+  ASSERT (get_stat_atime_ns (&st1) == get_stat_atime_ns (&st2));
+  ASSERT (utimecmp (BASE "file", &st1, &st2, 0) == 0);
+
+  /* Set both times.  */
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = BILLION / 2 - 1;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = BILLION - 1;
+    ASSERT (func (BASE "file", ts) == 0);
+    ASSERT (stat (BASE "file", &st2) == 0);
+    ASSERT (st2.st_atime == Y2K);
+    ASSERT (0 <= get_stat_atime_ns (&st2));
+    ASSERT (get_stat_atime_ns (&st2) < BILLION / 2);
+    ASSERT (st2.st_mtime == Y2K);
+    ASSERT (0 <= get_stat_mtime_ns (&st2));
+    ASSERT (get_stat_mtime_ns (&st2) < BILLION);
+    if (check_ctime)
+      ASSERT (ctime_compare (&st1, &st2) < 0);
+  }
+
+  /* Play with UTIME_OMIT, UTIME_NOW.  */
+  {
+    struct stat st3;
+    struct timespec ts[2];
+    ts[0].tv_sec = BILLION;
+    ts[0].tv_nsec = UTIME_OMIT;
+    ts[1].tv_sec = 0;
+    ts[1].tv_nsec = UTIME_NOW;
+    nap ();
+    ASSERT (func (BASE "file", ts) == 0);
+    ASSERT (stat (BASE "file", &st3) == 0);
+    ASSERT (st3.st_atime == Y2K);
+    ASSERT (0 <= get_stat_atime_ns (&st3));
+    ASSERT (get_stat_atime_ns (&st3) < BILLION / 2);
+    /* See comment above about this utimecmp call.  */
+    ASSERT (0 <= utimecmp (BASE "file", &st3, &st1, UTIMECMP_TRUNCATE_SOURCE));
+    if (check_ctime)
+      ASSERT (ctime_compare (&st2, &st3) < 0);
+    nap ();
+    ts[0].tv_nsec = 0;
+    ts[1].tv_nsec = UTIME_OMIT;
+    ASSERT (func (BASE "file", ts) == 0);
+    ASSERT (stat (BASE "file", &st2) == 0);
+    ASSERT (st2.st_atime == BILLION);
+    ASSERT (get_stat_atime_ns (&st2) == 0);
+    ASSERT (st3.st_mtime == st2.st_mtime);
+    ASSERT (get_stat_mtime_ns (&st3) == get_stat_mtime_ns (&st2));
+    if (check_ctime > 0)
+      ASSERT (ctime_compare (&st3, &st2) < 0);
+  }
+
+  /* Make sure this dereferences symlinks.  */
+  if (symlink (BASE "file", BASE "link"))
+    {
+      ASSERT (unlink (BASE "file") == 0);
+      if (print)
+        fputs ("skipping test: symlinks not supported on this file system\n",
+               stderr);
+      return 77;
+    }
+  ASSERT (lstat (BASE "link", &st1) == 0);
+  ASSERT (st1.st_mtime != Y2K);
+  errno = 0;
+  ASSERT (func (BASE "link/", NULL) == -1);
+  ASSERT (errno == ENOTDIR);
+  {
+    struct timespec ts[2];
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1] = ts[0];
+    ASSERT (func (BASE "link", ts) == 0);
+    ASSERT (lstat (BASE "link", &st2) == 0);
+    /* Can't compare atimes, since lstat() changes symlink atime on cygwin.  */
+    ASSERT (st1.st_mtime == st2.st_mtime);
+    ASSERT (stat (BASE "link", &st2) == 0);
+    ASSERT (st2.st_mtime == Y2K);
+    ASSERT (get_stat_mtime_ns (&st2) == 0);
+  }
+
+  /* Cleanup.  */
+  ASSERT (unlink (BASE "link") == 0);
+  ASSERT (unlink (BASE "file") == 0);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3a0b0ed78eded7d4b381e528358584e308d4465f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-utimensat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c248d6a3471fbac78081a83d2ddfdfc03e2ac36a
--- /dev/null
@@ -0,0 +1,127 @@
+/* Tests of utimensat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (utimensat, int, (int, char const *, struct timespec const[2],
+                                  int));
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "stat-time.h"
+#include "timespec.h"
+#include "utimecmp.h"
+#include "ignore-value.h"
+#include "macros.h"
+
+#define BASE "test-utimensat.t"
+
+#include "test-lutimens.h"
+#include "test-utimens.h"
+
+static int dfd = AT_FDCWD;
+
+/* Wrap utimensat to behave like utimens.  */
+static int
+do_utimensat (char const *name, struct timespec const times[2])
+{
+  return utimensat (dfd, name, times, 0);
+}
+
+/* Wrap utimensat to behave like lutimens.  */
+static int
+do_lutimensat (char const *name, struct timespec const times[2])
+{
+  return utimensat (dfd, name, times, AT_SYMLINK_NOFOLLOW);
+}
+
+int
+main (void)
+{
+  int result1; /* Skip because of no symlink support.  */
+  int result2; /* Skip because of no lutimens support.  */
+  int fd;
+
+  /* Clean up any trash from prior testsuite runs.  */
+  ignore_value (system ("rm -rf " BASE "*"));
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (utimensat (-1, "foo", NULL, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    close (99);
+    errno = 0;
+    ASSERT (utimensat (99, "foo", NULL, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Basic tests.  */
+  result1 = test_utimens (do_utimensat, true);
+  result2 = test_lutimens (do_lutimensat, result1 == 0);
+  dfd = open (".", O_RDONLY);
+  ASSERT (0 <= dfd);
+  ASSERT (test_utimens (do_utimensat, false) == result1);
+  ASSERT (test_lutimens (do_lutimensat, false) == result2);
+  /* We expect 0/0, 0/77, or 77/77, but not 77/0.  */
+  ASSERT (result1 <= result2);
+
+  /* Directory-relative tests.  */
+  ASSERT (mkdir (BASE "dir", 0700) == 0);
+  ASSERT (chdir (BASE "dir") == 0);
+  fd = creat ("file", 0600);
+  ASSERT (0 <= fd);
+  errno = 0;
+  ASSERT (utimensat (fd, ".", NULL, 0) == -1);
+  ASSERT (errno == ENOTDIR);
+  {
+    struct timespec ts[2];
+    struct stat st;
+    ts[0].tv_sec = Y2K;
+    ts[0].tv_nsec = 0;
+    ts[1].tv_sec = Y2K;
+    ts[1].tv_nsec = 0;
+    ASSERT (utimensat (dfd, BASE "dir/file", ts, AT_SYMLINK_NOFOLLOW) == 0);
+    ASSERT (stat ("file", &st) == 0);
+    ASSERT (st.st_atime == Y2K);
+    ASSERT (get_stat_atime_ns (&st) == 0);
+    ASSERT (st.st_mtime == Y2K);
+    ASSERT (get_stat_mtime_ns (&st) == 0);
+  }
+  ASSERT (close (fd) == 0);
+  ASSERT (close (dfd) == 0);
+  errno = 0;
+  ASSERT (utimensat (dfd, ".", NULL, 0) == -1);
+  ASSERT (errno == EBADF);
+
+  /* Cleanup.  */
+  ASSERT (chdir ("..") == 0);
+  ASSERT (unlink (BASE "dir/file") == 0);
+  ASSERT (rmdir (BASE "dir") == 0);
+  return result1 | result2;
+}
deleted file mode 120000 (symlink)
index 9a6af99dd494c48b08acdb54108f424d37c639c8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-vasnprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..13b938729115e607c437c479c4f0964cbb7d9d5d
--- /dev/null
@@ -0,0 +1,121 @@
+/* Test of vasnprintf() and asnprintf() functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "vasnprintf.h"
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+static void
+test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
+{
+  char buf[8];
+  int size;
+
+  for (size = 0; size <= 8; size++)
+    {
+      size_t length = size;
+      char *result = my_asnprintf (NULL, &length, "%d", 12345);
+      ASSERT (result != NULL);
+      ASSERT (strcmp (result, "12345") == 0);
+      ASSERT (length == 5);
+      free (result);
+    }
+
+  for (size = 0; size <= 8; size++)
+    {
+      size_t length;
+      char *result;
+
+      memcpy (buf, "DEADBEEF", 8);
+      length = size;
+      result = my_asnprintf (buf, &length, "%d", 12345);
+      ASSERT (result != NULL);
+      ASSERT (strcmp (result, "12345") == 0);
+      ASSERT (length == 5);
+      if (size < 5 + 1)
+        ASSERT (result != buf);
+      ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
+      if (result != buf)
+        free (result);
+    }
+
+  /* Note: This test assumes IEEE 754 representation of 'double' floats.  */
+  for (size = 0; size <= 8; size++)
+    {
+      size_t length;
+      char *result;
+
+      memcpy (buf, "DEADBEEF", 8);
+      length = size;
+      result = my_asnprintf (buf, &length, "%2.0f", 1.6314159265358979e+125);
+      ASSERT (result != NULL);
+      /* The exact result and the result on glibc systems is
+         163141592653589790215729350939528493057529598899734151772468186268423257777068536614838678161083520756952076273094236944990208
+         On Cygwin, the result is
+         163141592653589790215729350939528493057529600000000000000000000000000000000000000000000000000000000000000000000000000000000000
+         On HP-UX 11.31 / hppa and IRIX 6.5, the result is
+         163141592653589790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+       */
+      ASSERT (strlen (result) == 126);
+      ASSERT (memcmp (result, "163141592653589790", 18) == 0);
+      ASSERT (length == 126);
+      if (size < 126 + 1)
+        ASSERT (result != buf);
+      ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
+      if (result != buf)
+        free (result);
+    }
+}
+
+static char *
+my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
+{
+  va_list args;
+  char *ret;
+
+  va_start (args, format);
+  ret = vasnprintf (resultbuf, lengthp, format, args);
+  va_end (args);
+  return ret;
+}
+
+static void
+test_vasnprintf ()
+{
+  test_function (my_asnprintf);
+}
+
+static void
+test_asnprintf ()
+{
+  test_function (asnprintf);
+}
+
+int
+main ()
+{
+  test_vasnprintf ();
+  test_asnprintf ();
+  return 0;
+}
deleted file mode 120000 (symlink)
index 48d34080ef2d592a78398d462b1813076084419d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-vasprintf-posix.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bcd1077dd9d9126f2e40176acad21e08111bf619
--- /dev/null
+/* Test of POSIX compatible vasprintf() and asprintf() functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <float.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "macros.h"
+#include "minus-zero.h"
+#include "infinity.h"
+#include "nan.h"
+#include "snan.h"
+
+/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0.  */
+static int
+have_minus_zero ()
+{
+  static double plus_zero = 0.0;
+  double minus_zero = minus_zerod;
+  return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
+}
+
+/* Representation of an 80-bit 'long double' as an initializer for a sequence
+   of 'unsigned int' words.  */
+#ifdef WORDS_BIGENDIAN
+# define LDBL80_WORDS(exponent,manthi,mantlo) \
+    { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
+      ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16),   \
+      (unsigned int) (mantlo) << 16                                        \
+    }
+#else
+# define LDBL80_WORDS(exponent,manthi,mantlo) \
+    { mantlo, manthi, exponent }
+#endif
+
+static int
+strmatch (const char *pattern, const char *string)
+{
+  if (strlen (pattern) != strlen (string))
+    return 0;
+  for (; *pattern != '\0'; pattern++, string++)
+    if (*pattern != '*' && *string != *pattern)
+      return 0;
+  return 1;
+}
+
+/* Test whether string[start_index..end_index-1] is a valid textual
+   representation of NaN.  */
+static int
+strisnan (const char *string, size_t start_index, size_t end_index, int uppercase)
+{
+  if (start_index < end_index)
+    {
+      if (string[start_index] == '-')
+        start_index++;
+      if (start_index + 3 <= end_index
+          && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0)
+        {
+          start_index += 3;
+          if (start_index == end_index
+              || (string[start_index] == '(' && string[end_index - 1] == ')'))
+            return 1;
+        }
+    }
+  return 0;
+}
+
+static void
+test_function (int (*my_asprintf) (char **, const char *, ...))
+{
+  int repeat;
+
+  /* Test return value convention.  */
+
+  for (repeat = 0; repeat <= 8; repeat++)
+    {
+      char *result;
+      int retval = asprintf (&result, "%d", 12345);
+      ASSERT (retval == 5);
+      ASSERT (result != NULL);
+      ASSERT (strcmp (result, "12345") == 0);
+      free (result);
+    }
+
+  /* Test support of size specifiers as in C99.  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%ju %d", (uintmax_t) 12345671, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "12345671 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%zu %d", (size_t) 12345672, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "12345672 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "12345673 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", (long double) 1.5, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.5 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the 'a' and 'A' conversion specifier for hexadecimal
+     output of floating-point numbers.  */
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%a %d", 3.1416015625, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.922p+1 33") == 0
+            || strcmp (result, "0x3.244p+0 33") == 0
+            || strcmp (result, "0x6.488p-1 33") == 0
+            || strcmp (result, "0xc.91p-2 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%A %d", -3.1416015625, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-0X1.922P+1 33") == 0
+            || strcmp (result, "-0X3.244P+0 33") == 0
+            || strcmp (result, "-0X6.488P-1 33") == 0
+            || strcmp (result, "-0XC.91P-2 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%a %d", 0.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x0p+0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%a %d", minus_zerod, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0x0p+0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%a %d", Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "inf 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%a %d", - Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-inf 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%a %d", NaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNAND
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%a %d", SNaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+
+  { /* Rounding near the decimal point.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0a %d", 1.5, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1p+0 33") == 0
+            || strcmp (result, "0x2p+0 33") == 0
+            || strcmp (result, "0x3p-1 33") == 0
+            || strcmp (result, "0x6p-2 33") == 0
+            || strcmp (result, "0xcp-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding with precision 0.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0a %d", 1.51, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1p+0 33") == 0
+            || strcmp (result, "0x2p+0 33") == 0
+            || strcmp (result, "0x3p-1 33") == 0
+            || strcmp (result, "0x6p-2 33") == 0
+            || strcmp (result, "0xcp-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding with precision 1.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.1a %d", 1.51, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.8p+0 33") == 0
+            || strcmp (result, "0x3.0p-1 33") == 0
+            || strcmp (result, "0x6.1p-2 33") == 0
+            || strcmp (result, "0xc.1p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding with precision 2.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2a %d", 1.51, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.83p+0 33") == 0
+            || strcmp (result, "0x3.05p-1 33") == 0
+            || strcmp (result, "0x6.0ap-2 33") == 0
+            || strcmp (result, "0xc.14p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding with precision 3.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.3a %d", 1.51, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.829p+0 33") == 0
+            || strcmp (result, "0x3.052p-1 33") == 0
+            || strcmp (result, "0x6.0a4p-2 33") == 0
+            || strcmp (result, "0xc.148p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding can turn a ...FFF into a ...000.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.3a %d", 1.49999, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.800p+0 33") == 0
+            || strcmp (result, "0x3.000p-1 33") == 0
+            || strcmp (result, "0x6.000p-2 33") == 0
+            || strcmp (result, "0xc.000p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding can turn a ...FFF into a ...000.
+       This shows a Mac OS X 10.3.9 (Darwin 7.9) bug.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.1a %d", 1.999, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.0p+1 33") == 0
+            || strcmp (result, "0x2.0p+0 33") == 0
+            || strcmp (result, "0x4.0p-1 33") == 0
+            || strcmp (result, "0x8.0p-2 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10a %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "  0x1.cp+0 33") == 0
+            || strcmp (result, "  0x3.8p-1 33") == 0
+            || strcmp (result, "    0x7p-2 33") == 0
+            || strcmp (result, "    0xep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*a %d", 10, 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "  0x1.cp+0 33") == 0
+            || strcmp (result, "  0x3.8p-1 33") == 0
+            || strcmp (result, "    0x7p-2 33") == 0
+            || strcmp (result, "    0xep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*a %d", -10, 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.cp+0   33") == 0
+            || strcmp (result, "0x3.8p-1   33") == 0
+            || strcmp (result, "0x7p-2     33") == 0
+            || strcmp (result, "0xep-3     33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Small precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.10a %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0
+            || strcmp (result, "0x3.8000000000p-1 33") == 0
+            || strcmp (result, "0x7.0000000000p-2 33") == 0
+            || strcmp (result, "0xe.0000000000p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Large precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.50a %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0
+            || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0
+            || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0
+            || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10a %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.cp+0   33") == 0
+            || strcmp (result, "0x3.8p-1   33") == 0
+            || strcmp (result, "0x7p-2     33") == 0
+            || strcmp (result, "0xep-3     33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SHOWSIGN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%+a %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "+0x1.cp+0 33") == 0
+            || strcmp (result, "+0x3.8p-1 33") == 0
+            || strcmp (result, "+0x7p-2 33") == 0
+            || strcmp (result, "+0xep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SPACE.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "% a %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, " 0x1.cp+0 33") == 0
+            || strcmp (result, " 0x3.8p-1 33") == 0
+            || strcmp (result, " 0x7p-2 33") == 0
+            || strcmp (result, " 0xep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#a %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.cp+0 33") == 0
+            || strcmp (result, "0x3.8p-1 33") == 0
+            || strcmp (result, "0x7.p-2 33") == 0
+            || strcmp (result, "0xe.p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#a %d", 1.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.p+0 33") == 0
+            || strcmp (result, "0x2.p-1 33") == 0
+            || strcmp (result, "0x4.p-2 33") == 0
+            || strcmp (result, "0x8.p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with finite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%010a %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x001.cp+0 33") == 0
+            || strcmp (result, "0x003.8p-1 33") == 0
+            || strcmp (result, "0x00007p-2 33") == 0
+            || strcmp (result, "0x0000ep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%010a %d", Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    /* "0000000inf 33" is not a valid result; see
+       <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
+    ASSERT (strcmp (result, "       inf 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%050a %d", NaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    /* "0000000nan 33" is not a valid result; see
+       <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
+    ASSERT (strlen (result) == 50 + 3
+            && strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", 3.1416015625L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.922p+1 33") == 0
+            || strcmp (result, "0x3.244p+0 33") == 0
+            || strcmp (result, "0x6.488p-1 33") == 0
+            || strcmp (result, "0xc.91p-2 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LA %d", -3.1416015625L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-0X1.922P+1 33") == 0
+            || strcmp (result, "-0X3.244P+0 33") == 0
+            || strcmp (result, "-0X6.488P-1 33") == 0
+            || strcmp (result, "-0XC.91P-2 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", 0.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x0p+0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", minus_zerol, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0x0p+0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    /* Note: This assertion fails under valgrind.
+       Reported at <https://bugs.kde.org/show_bug.cgi?id=424044>.  */
+    ASSERT (strcmp (result, "inf 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", - Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-inf 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", NaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNANL
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", SNaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+  { /* Quiet NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+  {
+    /* Signalling NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+  /* asprintf should print something for noncanonical values.  */
+  { /* Pseudo-NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Infinity.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Zero.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Unnormalized number.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Denormal.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%La %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+#endif
+
+  { /* Rounding near the decimal point.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0La %d", 1.5L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x2p+0 33") == 0
+            || strcmp (result, "0x3p-1 33") == 0
+            || strcmp (result, "0x6p-2 33") == 0
+            || strcmp (result, "0xcp-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding with precision 0.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0La %d", 1.51L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x2p+0 33") == 0
+            || strcmp (result, "0x3p-1 33") == 0
+            || strcmp (result, "0x6p-2 33") == 0
+            || strcmp (result, "0xcp-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding with precision 1.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.1La %d", 1.51L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.8p+0 33") == 0
+            || strcmp (result, "0x3.0p-1 33") == 0
+            || strcmp (result, "0x6.1p-2 33") == 0
+            || strcmp (result, "0xc.1p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding with precision 2.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2La %d", 1.51L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.83p+0 33") == 0
+            || strcmp (result, "0x3.05p-1 33") == 0
+            || strcmp (result, "0x6.0ap-2 33") == 0
+            || strcmp (result, "0xc.14p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding with precision 3.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.3La %d", 1.51L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.829p+0 33") == 0
+            || strcmp (result, "0x3.052p-1 33") == 0
+            || strcmp (result, "0x6.0a4p-2 33") == 0
+            || strcmp (result, "0xc.148p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding can turn a ...FFF into a ...000.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.3La %d", 1.49999L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.800p+0 33") == 0
+            || strcmp (result, "0x3.000p-1 33") == 0
+            || strcmp (result, "0x6.000p-2 33") == 0
+            || strcmp (result, "0xc.000p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Rounding can turn a ...FFF into a ...000.
+       This shows a Mac OS X 10.3.9 (Darwin 7.9) bug and a
+       glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.1La %d", 1.999L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.0p+1 33") == 0
+            || strcmp (result, "0x2.0p+0 33") == 0
+            || strcmp (result, "0x4.0p-1 33") == 0
+            || strcmp (result, "0x8.0p-2 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10La %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "  0x1.cp+0 33") == 0
+            || strcmp (result, "  0x3.8p-1 33") == 0
+            || strcmp (result, "    0x7p-2 33") == 0
+            || strcmp (result, "    0xep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*La %d", 10, 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "  0x1.cp+0 33") == 0
+            || strcmp (result, "  0x3.8p-1 33") == 0
+            || strcmp (result, "    0x7p-2 33") == 0
+            || strcmp (result, "    0xep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*La %d", -10, 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.cp+0   33") == 0
+            || strcmp (result, "0x3.8p-1   33") == 0
+            || strcmp (result, "0x7p-2     33") == 0
+            || strcmp (result, "0xep-3     33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Small precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.10La %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0
+            || strcmp (result, "0x3.8000000000p-1 33") == 0
+            || strcmp (result, "0x7.0000000000p-2 33") == 0
+            || strcmp (result, "0xe.0000000000p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Large precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.50La %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0
+            || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0
+            || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0
+            || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10La %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.cp+0   33") == 0
+            || strcmp (result, "0x3.8p-1   33") == 0
+            || strcmp (result, "0x7p-2     33") == 0
+            || strcmp (result, "0xep-3     33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SHOWSIGN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%+La %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "+0x1.cp+0 33") == 0
+            || strcmp (result, "+0x3.8p-1 33") == 0
+            || strcmp (result, "+0x7p-2 33") == 0
+            || strcmp (result, "+0xep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SPACE.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "% La %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, " 0x1.cp+0 33") == 0
+            || strcmp (result, " 0x3.8p-1 33") == 0
+            || strcmp (result, " 0x7p-2 33") == 0
+            || strcmp (result, " 0xep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#La %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.cp+0 33") == 0
+            || strcmp (result, "0x3.8p-1 33") == 0
+            || strcmp (result, "0x7.p-2 33") == 0
+            || strcmp (result, "0xe.p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#La %d", 1.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x1.p+0 33") == 0
+            || strcmp (result, "0x2.p-1 33") == 0
+            || strcmp (result, "0x4.p-2 33") == 0
+            || strcmp (result, "0x8.p-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with finite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%010La %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x001.cp+0 33") == 0
+            || strcmp (result, "0x003.8p-1 33") == 0
+            || strcmp (result, "0x00007p-2 33") == 0
+            || strcmp (result, "0x0000ep-3 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%010La %d", Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    /* "0000000inf 33" is not a valid result; see
+       <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
+    ASSERT (strcmp (result, "       inf 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%050La %d", NaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    /* "0000000nan 33" is not a valid result; see
+       <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
+    ASSERT (strlen (result) == 50 + 3
+            && strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the %f format directive.  */
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%f %d", 12.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "12.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A larger positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%f %d", 1234567.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1234567.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Small and large positive numbers.  */
+    static struct { double value; const char *string; } data[] =
+      {
+        { 1.234321234321234e-37, "0.000000" },
+        { 1.234321234321234e-36, "0.000000" },
+        { 1.234321234321234e-35, "0.000000" },
+        { 1.234321234321234e-34, "0.000000" },
+        { 1.234321234321234e-33, "0.000000" },
+        { 1.234321234321234e-32, "0.000000" },
+        { 1.234321234321234e-31, "0.000000" },
+        { 1.234321234321234e-30, "0.000000" },
+        { 1.234321234321234e-29, "0.000000" },
+        { 1.234321234321234e-28, "0.000000" },
+        { 1.234321234321234e-27, "0.000000" },
+        { 1.234321234321234e-26, "0.000000" },
+        { 1.234321234321234e-25, "0.000000" },
+        { 1.234321234321234e-24, "0.000000" },
+        { 1.234321234321234e-23, "0.000000" },
+        { 1.234321234321234e-22, "0.000000" },
+        { 1.234321234321234e-21, "0.000000" },
+        { 1.234321234321234e-20, "0.000000" },
+        { 1.234321234321234e-19, "0.000000" },
+        { 1.234321234321234e-18, "0.000000" },
+        { 1.234321234321234e-17, "0.000000" },
+        { 1.234321234321234e-16, "0.000000" },
+        { 1.234321234321234e-15, "0.000000" },
+        { 1.234321234321234e-14, "0.000000" },
+        { 1.234321234321234e-13, "0.000000" },
+        { 1.234321234321234e-12, "0.000000" },
+        { 1.234321234321234e-11, "0.000000" },
+        { 1.234321234321234e-10, "0.000000" },
+        { 1.234321234321234e-9, "0.000000" },
+        { 1.234321234321234e-8, "0.000000" },
+        { 1.234321234321234e-7, "0.000000" },
+        { 1.234321234321234e-6, "0.000001" },
+        { 1.234321234321234e-5, "0.000012" },
+        { 1.234321234321234e-4, "0.000123" },
+        { 1.234321234321234e-3, "0.001234" },
+        { 1.234321234321234e-2, "0.012343" },
+        { 1.234321234321234e-1, "0.123432" },
+        { 1.234321234321234, "1.234321" },
+        { 1.234321234321234e1, "12.343212" },
+        { 1.234321234321234e2, "123.432123" },
+        { 1.234321234321234e3, "1234.321234" },
+        { 1.234321234321234e4, "12343.212343" },
+        { 1.234321234321234e5, "123432.123432" },
+        { 1.234321234321234e6, "1234321.234321" },
+        { 1.234321234321234e7, "12343212.343212" },
+        { 1.234321234321234e8, "123432123.432123" },
+        { 1.234321234321234e9, "1234321234.321234" },
+        { 1.234321234321234e10, "12343212343.2123**" },
+        { 1.234321234321234e11, "123432123432.123***" },
+        { 1.234321234321234e12, "1234321234321.23****" },
+        { 1.234321234321234e13, "12343212343212.3*****" },
+        { 1.234321234321234e14, "123432123432123.******" },
+        { 1.234321234321234e15, "1234321234321234.000000" },
+        { 1.234321234321234e16, "123432123432123**.000000" },
+        { 1.234321234321234e17, "123432123432123***.000000" },
+        { 1.234321234321234e18, "123432123432123****.000000" },
+        { 1.234321234321234e19, "123432123432123*****.000000" },
+        { 1.234321234321234e20, "123432123432123******.000000" },
+        { 1.234321234321234e21, "123432123432123*******.000000" },
+        { 1.234321234321234e22, "123432123432123********.000000" },
+        { 1.234321234321234e23, "123432123432123*********.000000" },
+        { 1.234321234321234e24, "123432123432123**********.000000" },
+        { 1.234321234321234e25, "123432123432123***********.000000" },
+        { 1.234321234321234e26, "123432123432123************.000000" },
+        { 1.234321234321234e27, "123432123432123*************.000000" },
+        { 1.234321234321234e28, "123432123432123**************.000000" },
+        { 1.234321234321234e29, "123432123432123***************.000000" },
+        { 1.234321234321234e30, "123432123432123****************.000000" },
+        { 1.234321234321234e31, "123432123432123*****************.000000" },
+        { 1.234321234321234e32, "123432123432123******************.000000" },
+        { 1.234321234321234e33, "123432123432123*******************.000000" },
+        { 1.234321234321234e34, "123432123432123********************.000000" },
+        { 1.234321234321234e35, "123432123432123*********************.000000" },
+        { 1.234321234321234e36, "123432123432123**********************.000000" }
+      };
+    size_t k;
+    for (k = 0; k < SIZEOF (data); k++)
+      {
+        char *result;
+        int retval =
+          my_asprintf (&result, "%f", data[k].value);
+        ASSERT (result != NULL);
+        ASSERT (strmatch (data[k].string, result));
+        ASSERT (retval == strlen (result));
+        free (result);
+      }
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%f %d", -0.03125, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-0.031250 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%f %d", 0.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%f %d", minus_zerod, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%f %d", Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "inf 33") == 0
+            || strcmp (result, "infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%f %d", - Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-inf 33") == 0
+            || strcmp (result, "-infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%f %d", NaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNAND
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%f %d", SNaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10f %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "  1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*f %d", 10, 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "  1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*f %d", -10, 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000   33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10f %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000   33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SHOWSIGN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%+f %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "+1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SPACE.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "% f %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, " 1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#f %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.f %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "2. 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with finite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015f %d", 1234.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "00001234.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015f %d", - Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "           -inf 33") == 0
+            || strcmp (result, "      -infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%050f %d", NaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) == 50 + 3
+            && strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.f %d", 1234.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1234 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with no rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2f %d", 999.951, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "999.95 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2f %d", 999.996, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1000.00 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", 12.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "12.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A larger positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", 1234567.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1234567.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Small and large positive numbers.  */
+    static struct { long double value; const char *string; } data[] =
+      {
+        { 1.234321234321234e-37L, "0.000000" },
+        { 1.234321234321234e-36L, "0.000000" },
+        { 1.234321234321234e-35L, "0.000000" },
+        { 1.234321234321234e-34L, "0.000000" },
+        { 1.234321234321234e-33L, "0.000000" },
+        { 1.234321234321234e-32L, "0.000000" },
+        { 1.234321234321234e-31L, "0.000000" },
+        { 1.234321234321234e-30L, "0.000000" },
+        { 1.234321234321234e-29L, "0.000000" },
+        { 1.234321234321234e-28L, "0.000000" },
+        { 1.234321234321234e-27L, "0.000000" },
+        { 1.234321234321234e-26L, "0.000000" },
+        { 1.234321234321234e-25L, "0.000000" },
+        { 1.234321234321234e-24L, "0.000000" },
+        { 1.234321234321234e-23L, "0.000000" },
+        { 1.234321234321234e-22L, "0.000000" },
+        { 1.234321234321234e-21L, "0.000000" },
+        { 1.234321234321234e-20L, "0.000000" },
+        { 1.234321234321234e-19L, "0.000000" },
+        { 1.234321234321234e-18L, "0.000000" },
+        { 1.234321234321234e-17L, "0.000000" },
+        { 1.234321234321234e-16L, "0.000000" },
+        { 1.234321234321234e-15L, "0.000000" },
+        { 1.234321234321234e-14L, "0.000000" },
+        { 1.234321234321234e-13L, "0.000000" },
+        { 1.234321234321234e-12L, "0.000000" },
+        { 1.234321234321234e-11L, "0.000000" },
+        { 1.234321234321234e-10L, "0.000000" },
+        { 1.234321234321234e-9L, "0.000000" },
+        { 1.234321234321234e-8L, "0.000000" },
+        { 1.234321234321234e-7L, "0.000000" },
+        { 1.234321234321234e-6L, "0.000001" },
+        { 1.234321234321234e-5L, "0.000012" },
+        { 1.234321234321234e-4L, "0.000123" },
+        { 1.234321234321234e-3L, "0.001234" },
+        { 1.234321234321234e-2L, "0.012343" },
+        { 1.234321234321234e-1L, "0.123432" },
+        { 1.234321234321234L, "1.234321" },
+        { 1.234321234321234e1L, "12.343212" },
+        { 1.234321234321234e2L, "123.432123" },
+        { 1.234321234321234e3L, "1234.321234" },
+        { 1.234321234321234e4L, "12343.212343" },
+        { 1.234321234321234e5L, "123432.123432" },
+        { 1.234321234321234e6L, "1234321.234321" },
+        { 1.234321234321234e7L, "12343212.343212" },
+        { 1.234321234321234e8L, "123432123.432123" },
+        { 1.234321234321234e9L, "1234321234.321234" },
+        { 1.234321234321234e10L, "12343212343.2123**" },
+        { 1.234321234321234e11L, "123432123432.123***" },
+        { 1.234321234321234e12L, "1234321234321.23****" },
+        { 1.234321234321234e13L, "12343212343212.3*****" },
+        { 1.234321234321234e14L, "123432123432123.******" },
+        { 1.234321234321234e15L, "1234321234321234.000000" },
+        { 1.234321234321234e16L, "123432123432123**.000000" },
+        { 1.234321234321234e17L, "123432123432123***.000000" },
+        { 1.234321234321234e18L, "123432123432123****.000000" },
+        { 1.234321234321234e19L, "123432123432123*****.000000" },
+        { 1.234321234321234e20L, "123432123432123******.000000" },
+        { 1.234321234321234e21L, "123432123432123*******.000000" },
+        { 1.234321234321234e22L, "123432123432123********.000000" },
+        { 1.234321234321234e23L, "123432123432123*********.000000" },
+        { 1.234321234321234e24L, "123432123432123**********.000000" },
+        { 1.234321234321234e25L, "123432123432123***********.000000" },
+        { 1.234321234321234e26L, "123432123432123************.000000" },
+        { 1.234321234321234e27L, "123432123432123*************.000000" },
+        { 1.234321234321234e28L, "123432123432123**************.000000" },
+        { 1.234321234321234e29L, "123432123432123***************.000000" },
+        { 1.234321234321234e30L, "123432123432123****************.000000" },
+        { 1.234321234321234e31L, "123432123432123*****************.000000" },
+        { 1.234321234321234e32L, "123432123432123******************.000000" },
+        { 1.234321234321234e33L, "123432123432123*******************.000000" },
+        { 1.234321234321234e34L, "123432123432123********************.000000" },
+        { 1.234321234321234e35L, "123432123432123*********************.000000" },
+        { 1.234321234321234e36L, "123432123432123**********************.000000" }
+      };
+    size_t k;
+    for (k = 0; k < SIZEOF (data); k++)
+      {
+        char *result;
+        int retval =
+          my_asprintf (&result, "%Lf", data[k].value);
+        ASSERT (result != NULL);
+        ASSERT (strmatch (data[k].string, result));
+        ASSERT (retval == strlen (result));
+        free (result);
+      }
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", -0.03125L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-0.031250 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", 0.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", minus_zerol, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "inf 33") == 0
+            || strcmp (result, "infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", - Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-inf 33") == 0
+            || strcmp (result, "-infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", NaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNANL
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", SNaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+  { /* Quiet NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+  {
+    /* Signalling NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+  /* asprintf should print something for noncanonical values.  */
+  { /* Pseudo-NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Infinity.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Zero.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Unnormalized number.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Denormal.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+#endif
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10Lf %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "  1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*Lf %d", 10, 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "  1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*Lf %d", -10, 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000   33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10Lf %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000   33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SHOWSIGN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%+Lf %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "+1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SPACE.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "% Lf %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, " 1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#Lf %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.Lf %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "2. 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with finite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015Lf %d", 1234.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "00001234.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015Lf %d", - Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "           -inf 33") == 0
+            || strcmp (result, "      -infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%050Lf %d", NaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) == 50 + 3
+            && strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.Lf %d", 1234.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1234 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with no rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2Lf %d", 999.951L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "999.95 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2Lf %d", 999.996L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1000.00 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the %F format directive.  */
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%F %d", 12.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "12.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A larger positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%F %d", 1234567.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1234567.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%F %d", -0.03125, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-0.031250 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%F %d", 0.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%F %d", minus_zerod, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%F %d", Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "INF 33") == 0
+            || strcmp (result, "INFINITY 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%F %d", - Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-INF 33") == 0
+            || strcmp (result, "-INFINITY 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%F %d", NaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 1)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNAND
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%F %d", SNaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 1)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+
+  { /* FLAG_ZERO.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015F %d", 1234.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "00001234.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015F %d", - Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "           -INF 33") == 0
+            || strcmp (result, "      -INFINITY 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.F %d", 1234.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1234 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with no rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2F %d", 999.951, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "999.95 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2F %d", 999.996, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1000.00 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LF %d", 12.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "12.750000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A larger positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LF %d", 1234567.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1234567.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LF %d", -0.03125L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-0.031250 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LF %d", 0.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LF %d", minus_zerol, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LF %d", Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "INF 33") == 0
+            || strcmp (result, "INFINITY 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LF %d", - Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-INF 33") == 0
+            || strcmp (result, "-INFINITY 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LF %d", NaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 1)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNANL
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%LF %d", SNaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 1)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+
+  { /* FLAG_ZERO.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015LF %d", 1234.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "00001234.000000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015LF %d", - Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "           -INF 33") == 0
+            || strcmp (result, "      -INFINITY 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.LF %d", 1234.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1234 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with no rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2LF %d", 999.951L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "999.95 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.2LF %d", 999.996L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1000.00 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the %e format directive.  */
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%e %d", 12.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.275000e+01 33") == 0
+            || strcmp (result, "1.275000e+001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A larger positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%e %d", 1234567.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.234567e+06 33") == 0
+            || strcmp (result, "1.234567e+006 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Small and large positive numbers.  */
+    static struct { double value; const char *string; } data[] =
+      {
+        { 1.234321234321234e-37, "1.234321e-37" },
+        { 1.234321234321234e-36, "1.234321e-36" },
+        { 1.234321234321234e-35, "1.234321e-35" },
+        { 1.234321234321234e-34, "1.234321e-34" },
+        { 1.234321234321234e-33, "1.234321e-33" },
+        { 1.234321234321234e-32, "1.234321e-32" },
+        { 1.234321234321234e-31, "1.234321e-31" },
+        { 1.234321234321234e-30, "1.234321e-30" },
+        { 1.234321234321234e-29, "1.234321e-29" },
+        { 1.234321234321234e-28, "1.234321e-28" },
+        { 1.234321234321234e-27, "1.234321e-27" },
+        { 1.234321234321234e-26, "1.234321e-26" },
+        { 1.234321234321234e-25, "1.234321e-25" },
+        { 1.234321234321234e-24, "1.234321e-24" },
+        { 1.234321234321234e-23, "1.234321e-23" },
+        { 1.234321234321234e-22, "1.234321e-22" },
+        { 1.234321234321234e-21, "1.234321e-21" },
+        { 1.234321234321234e-20, "1.234321e-20" },
+        { 1.234321234321234e-19, "1.234321e-19" },
+        { 1.234321234321234e-18, "1.234321e-18" },
+        { 1.234321234321234e-17, "1.234321e-17" },
+        { 1.234321234321234e-16, "1.234321e-16" },
+        { 1.234321234321234e-15, "1.234321e-15" },
+        { 1.234321234321234e-14, "1.234321e-14" },
+        { 1.234321234321234e-13, "1.234321e-13" },
+        { 1.234321234321234e-12, "1.234321e-12" },
+        { 1.234321234321234e-11, "1.234321e-11" },
+        { 1.234321234321234e-10, "1.234321e-10" },
+        { 1.234321234321234e-9, "1.234321e-09" },
+        { 1.234321234321234e-8, "1.234321e-08" },
+        { 1.234321234321234e-7, "1.234321e-07" },
+        { 1.234321234321234e-6, "1.234321e-06" },
+        { 1.234321234321234e-5, "1.234321e-05" },
+        { 1.234321234321234e-4, "1.234321e-04" },
+        { 1.234321234321234e-3, "1.234321e-03" },
+        { 1.234321234321234e-2, "1.234321e-02" },
+        { 1.234321234321234e-1, "1.234321e-01" },
+        { 1.234321234321234, "1.234321e+00" },
+        { 1.234321234321234e1, "1.234321e+01" },
+        { 1.234321234321234e2, "1.234321e+02" },
+        { 1.234321234321234e3, "1.234321e+03" },
+        { 1.234321234321234e4, "1.234321e+04" },
+        { 1.234321234321234e5, "1.234321e+05" },
+        { 1.234321234321234e6, "1.234321e+06" },
+        { 1.234321234321234e7, "1.234321e+07" },
+        { 1.234321234321234e8, "1.234321e+08" },
+        { 1.234321234321234e9, "1.234321e+09" },
+        { 1.234321234321234e10, "1.234321e+10" },
+        { 1.234321234321234e11, "1.234321e+11" },
+        { 1.234321234321234e12, "1.234321e+12" },
+        { 1.234321234321234e13, "1.234321e+13" },
+        { 1.234321234321234e14, "1.234321e+14" },
+        { 1.234321234321234e15, "1.234321e+15" },
+        { 1.234321234321234e16, "1.234321e+16" },
+        { 1.234321234321234e17, "1.234321e+17" },
+        { 1.234321234321234e18, "1.234321e+18" },
+        { 1.234321234321234e19, "1.234321e+19" },
+        { 1.234321234321234e20, "1.234321e+20" },
+        { 1.234321234321234e21, "1.234321e+21" },
+        { 1.234321234321234e22, "1.234321e+22" },
+        { 1.234321234321234e23, "1.234321e+23" },
+        { 1.234321234321234e24, "1.234321e+24" },
+        { 1.234321234321234e25, "1.234321e+25" },
+        { 1.234321234321234e26, "1.234321e+26" },
+        { 1.234321234321234e27, "1.234321e+27" },
+        { 1.234321234321234e28, "1.234321e+28" },
+        { 1.234321234321234e29, "1.234321e+29" },
+        { 1.234321234321234e30, "1.234321e+30" },
+        { 1.234321234321234e31, "1.234321e+31" },
+        { 1.234321234321234e32, "1.234321e+32" },
+        { 1.234321234321234e33, "1.234321e+33" },
+        { 1.234321234321234e34, "1.234321e+34" },
+        { 1.234321234321234e35, "1.234321e+35" },
+        { 1.234321234321234e36, "1.234321e+36" }
+      };
+    size_t k;
+    for (k = 0; k < SIZEOF (data); k++)
+      {
+        char *result;
+        int retval =
+          my_asprintf (&result, "%e", data[k].value);
+        const char *expected = data[k].string;
+        ASSERT (result != NULL);
+        ASSERT (strcmp (result, expected) == 0
+                /* Some implementations produce exponents with 3 digits.  */
+                || (strlen (result) == strlen (expected) + 1
+                    && memcmp (result, expected, strlen (expected) - 2) == 0
+                    && result[strlen (expected) - 2] == '0'
+                    && strcmp (result + strlen (expected) - 1,
+                               expected + strlen (expected) - 2)
+                       == 0));
+        ASSERT (retval == strlen (result));
+        free (result);
+      }
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%e %d", -0.03125, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-3.125000e-02 33") == 0
+            || strcmp (result, "-3.125000e-002 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%e %d", 0.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0.000000e+00 33") == 0
+            || strcmp (result, "0.000000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%e %d", minus_zerod, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0.000000e+00 33") == 0
+              || strcmp (result, "-0.000000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%e %d", Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "inf 33") == 0
+            || strcmp (result, "infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%e %d", - Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-inf 33") == 0
+            || strcmp (result, "-infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%e %d", NaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNAND
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%e %d", SNaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%15e %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "   1.750000e+00 33") == 0
+            || strcmp (result, "  1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*e %d", 15, 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "   1.750000e+00 33") == 0
+            || strcmp (result, "  1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*e %d", -15, 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000e+00    33") == 0
+            || strcmp (result, "1.750000e+000   33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-15e %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000e+00    33") == 0
+            || strcmp (result, "1.750000e+000   33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SHOWSIGN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%+e %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "+1.750000e+00 33") == 0
+            || strcmp (result, "+1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SPACE.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "% e %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, " 1.750000e+00 33") == 0
+            || strcmp (result, " 1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#e %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000e+00 33") == 0
+            || strcmp (result, "1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.e %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "2.e+00 33") == 0
+            || strcmp (result, "2.e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.e %d", 9.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.e+01 33") == 0
+            || strcmp (result, "1.e+001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with finite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015e %d", 1234.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0001.234000e+03 33") == 0
+            || strcmp (result, "001.234000e+003 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015e %d", - Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "           -inf 33") == 0
+            || strcmp (result, "      -infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%050e %d", NaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) == 50 + 3
+            && strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.e %d", 1234.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1e+03 33") == 0
+            || strcmp (result, "1e+003 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with no rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4e %d", 999.951, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "9.9995e+02 33") == 0
+            || strcmp (result, "9.9995e+002 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4e %d", 999.996, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.0000e+03 33") == 0
+            || strcmp (result, "1.0000e+003 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", 12.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.275000e+01 33") == 0
+            || strcmp (result, "1.275000e+001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A larger positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", 1234567.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.234567e+06 33") == 0
+            || strcmp (result, "1.234567e+006 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Small and large positive numbers.  */
+    static struct { long double value; const char *string; } data[] =
+      {
+        { 1.234321234321234e-37L, "1.234321e-37" },
+        { 1.234321234321234e-36L, "1.234321e-36" },
+        { 1.234321234321234e-35L, "1.234321e-35" },
+        { 1.234321234321234e-34L, "1.234321e-34" },
+        { 1.234321234321234e-33L, "1.234321e-33" },
+        { 1.234321234321234e-32L, "1.234321e-32" },
+        { 1.234321234321234e-31L, "1.234321e-31" },
+        { 1.234321234321234e-30L, "1.234321e-30" },
+        { 1.234321234321234e-29L, "1.234321e-29" },
+        { 1.234321234321234e-28L, "1.234321e-28" },
+        { 1.234321234321234e-27L, "1.234321e-27" },
+        { 1.234321234321234e-26L, "1.234321e-26" },
+        { 1.234321234321234e-25L, "1.234321e-25" },
+        { 1.234321234321234e-24L, "1.234321e-24" },
+        { 1.234321234321234e-23L, "1.234321e-23" },
+        { 1.234321234321234e-22L, "1.234321e-22" },
+        { 1.234321234321234e-21L, "1.234321e-21" },
+        { 1.234321234321234e-20L, "1.234321e-20" },
+        { 1.234321234321234e-19L, "1.234321e-19" },
+        { 1.234321234321234e-18L, "1.234321e-18" },
+        { 1.234321234321234e-17L, "1.234321e-17" },
+        { 1.234321234321234e-16L, "1.234321e-16" },
+        { 1.234321234321234e-15L, "1.234321e-15" },
+        { 1.234321234321234e-14L, "1.234321e-14" },
+        { 1.234321234321234e-13L, "1.234321e-13" },
+        { 1.234321234321234e-12L, "1.234321e-12" },
+        { 1.234321234321234e-11L, "1.234321e-11" },
+        { 1.234321234321234e-10L, "1.234321e-10" },
+        { 1.234321234321234e-9L, "1.234321e-09" },
+        { 1.234321234321234e-8L, "1.234321e-08" },
+        { 1.234321234321234e-7L, "1.234321e-07" },
+        { 1.234321234321234e-6L, "1.234321e-06" },
+        { 1.234321234321234e-5L, "1.234321e-05" },
+        { 1.234321234321234e-4L, "1.234321e-04" },
+        { 1.234321234321234e-3L, "1.234321e-03" },
+        { 1.234321234321234e-2L, "1.234321e-02" },
+        { 1.234321234321234e-1L, "1.234321e-01" },
+        { 1.234321234321234L, "1.234321e+00" },
+        { 1.234321234321234e1L, "1.234321e+01" },
+        { 1.234321234321234e2L, "1.234321e+02" },
+        { 1.234321234321234e3L, "1.234321e+03" },
+        { 1.234321234321234e4L, "1.234321e+04" },
+        { 1.234321234321234e5L, "1.234321e+05" },
+        { 1.234321234321234e6L, "1.234321e+06" },
+        { 1.234321234321234e7L, "1.234321e+07" },
+        { 1.234321234321234e8L, "1.234321e+08" },
+        { 1.234321234321234e9L, "1.234321e+09" },
+        { 1.234321234321234e10L, "1.234321e+10" },
+        { 1.234321234321234e11L, "1.234321e+11" },
+        { 1.234321234321234e12L, "1.234321e+12" },
+        { 1.234321234321234e13L, "1.234321e+13" },
+        { 1.234321234321234e14L, "1.234321e+14" },
+        { 1.234321234321234e15L, "1.234321e+15" },
+        { 1.234321234321234e16L, "1.234321e+16" },
+        { 1.234321234321234e17L, "1.234321e+17" },
+        { 1.234321234321234e18L, "1.234321e+18" },
+        { 1.234321234321234e19L, "1.234321e+19" },
+        { 1.234321234321234e20L, "1.234321e+20" },
+        { 1.234321234321234e21L, "1.234321e+21" },
+        { 1.234321234321234e22L, "1.234321e+22" },
+        { 1.234321234321234e23L, "1.234321e+23" },
+        { 1.234321234321234e24L, "1.234321e+24" },
+        { 1.234321234321234e25L, "1.234321e+25" },
+        { 1.234321234321234e26L, "1.234321e+26" },
+        { 1.234321234321234e27L, "1.234321e+27" },
+        { 1.234321234321234e28L, "1.234321e+28" },
+        { 1.234321234321234e29L, "1.234321e+29" },
+        { 1.234321234321234e30L, "1.234321e+30" },
+        { 1.234321234321234e31L, "1.234321e+31" },
+        { 1.234321234321234e32L, "1.234321e+32" },
+        { 1.234321234321234e33L, "1.234321e+33" },
+        { 1.234321234321234e34L, "1.234321e+34" },
+        { 1.234321234321234e35L, "1.234321e+35" },
+        { 1.234321234321234e36L, "1.234321e+36" }
+      };
+    size_t k;
+    for (k = 0; k < SIZEOF (data); k++)
+      {
+        char *result;
+        int retval =
+          my_asprintf (&result, "%Le", data[k].value);
+        const char *expected = data[k].string;
+        ASSERT (result != NULL);
+        ASSERT (strcmp (result, expected) == 0
+                /* Some implementations produce exponents with 3 digits.  */
+                || (strlen (result) == strlen (expected) + 1
+                    && memcmp (result, expected, strlen (expected) - 2) == 0
+                    && result[strlen (expected) - 2] == '0'
+                    && strcmp (result + strlen (expected) - 1,
+                               expected + strlen (expected) - 2)
+                       == 0));
+        ASSERT (retval == strlen (result));
+        free (result);
+      }
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", -0.03125L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-3.125000e-02 33") == 0
+            || strcmp (result, "-3.125000e-002 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", 0.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0.000000e+00 33") == 0
+            || strcmp (result, "0.000000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", minus_zerol, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0.000000e+00 33") == 0
+              || strcmp (result, "-0.000000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "inf 33") == 0
+            || strcmp (result, "infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", - Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-inf 33") == 0
+            || strcmp (result, "-infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", NaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNANL
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", SNaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+  { /* Quiet NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+  {
+    /* Signalling NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+  /* asprintf should print something for noncanonical values.  */
+  { /* Pseudo-NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Infinity.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Zero.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Unnormalized number.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Denormal.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Le %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+#endif
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%15Le %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "   1.750000e+00 33") == 0
+            || strcmp (result, "  1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*Le %d", 15, 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "   1.750000e+00 33") == 0
+            || strcmp (result, "  1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*Le %d", -15, 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000e+00    33") == 0
+            || strcmp (result, "1.750000e+000   33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-15Le %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000e+00    33") == 0
+            || strcmp (result, "1.750000e+000   33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SHOWSIGN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%+Le %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "+1.750000e+00 33") == 0
+            || strcmp (result, "+1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SPACE.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "% Le %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, " 1.750000e+00 33") == 0
+            || strcmp (result, " 1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#Le %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.750000e+00 33") == 0
+            || strcmp (result, "1.750000e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.Le %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "2.e+00 33") == 0
+            || strcmp (result, "2.e+000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.Le %d", 9.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.e+01 33") == 0
+            || strcmp (result, "1.e+001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with finite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015Le %d", 1234.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0001.234000e+03 33") == 0
+            || strcmp (result, "001.234000e+003 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015Le %d", - Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "           -inf 33") == 0
+            || strcmp (result, "      -infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%050Le %d", NaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) == 50 + 3
+            && strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.Le %d", 1234.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1e+03 33") == 0
+            || strcmp (result, "1e+003 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with no rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4Le %d", 999.951L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "9.9995e+02 33") == 0
+            || strcmp (result, "9.9995e+002 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4Le %d", 999.996L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.0000e+03 33") == 0
+            || strcmp (result, "1.0000e+003 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the %g format directive.  */
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%g %d", 12.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "12.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A larger positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%g %d", 1234567.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.23457e+06 33") == 0
+            || strcmp (result, "1.23457e+006 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Small and large positive numbers.  */
+    static struct { double value; const char *string; } data[] =
+      {
+        { 1.234321234321234e-37, "1.23432e-37" },
+        { 1.234321234321234e-36, "1.23432e-36" },
+        { 1.234321234321234e-35, "1.23432e-35" },
+        { 1.234321234321234e-34, "1.23432e-34" },
+        { 1.234321234321234e-33, "1.23432e-33" },
+        { 1.234321234321234e-32, "1.23432e-32" },
+        { 1.234321234321234e-31, "1.23432e-31" },
+        { 1.234321234321234e-30, "1.23432e-30" },
+        { 1.234321234321234e-29, "1.23432e-29" },
+        { 1.234321234321234e-28, "1.23432e-28" },
+        { 1.234321234321234e-27, "1.23432e-27" },
+        { 1.234321234321234e-26, "1.23432e-26" },
+        { 1.234321234321234e-25, "1.23432e-25" },
+        { 1.234321234321234e-24, "1.23432e-24" },
+        { 1.234321234321234e-23, "1.23432e-23" },
+        { 1.234321234321234e-22, "1.23432e-22" },
+        { 1.234321234321234e-21, "1.23432e-21" },
+        { 1.234321234321234e-20, "1.23432e-20" },
+        { 1.234321234321234e-19, "1.23432e-19" },
+        { 1.234321234321234e-18, "1.23432e-18" },
+        { 1.234321234321234e-17, "1.23432e-17" },
+        { 1.234321234321234e-16, "1.23432e-16" },
+        { 1.234321234321234e-15, "1.23432e-15" },
+        { 1.234321234321234e-14, "1.23432e-14" },
+        { 1.234321234321234e-13, "1.23432e-13" },
+        { 1.234321234321234e-12, "1.23432e-12" },
+        { 1.234321234321234e-11, "1.23432e-11" },
+        { 1.234321234321234e-10, "1.23432e-10" },
+        { 1.234321234321234e-9, "1.23432e-09" },
+        { 1.234321234321234e-8, "1.23432e-08" },
+        { 1.234321234321234e-7, "1.23432e-07" },
+        { 1.234321234321234e-6, "1.23432e-06" },
+        { 1.234321234321234e-5, "1.23432e-05" },
+        { 1.234321234321234e-4, "0.000123432" },
+        { 1.234321234321234e-3, "0.00123432" },
+        { 1.234321234321234e-2, "0.0123432" },
+        { 1.234321234321234e-1, "0.123432" },
+        { 1.234321234321234, "1.23432" },
+        { 1.234321234321234e1, "12.3432" },
+        { 1.234321234321234e2, "123.432" },
+        { 1.234321234321234e3, "1234.32" },
+        { 1.234321234321234e4, "12343.2" },
+        { 1.234321234321234e5, "123432" },
+        { 1.234321234321234e6, "1.23432e+06" },
+        { 1.234321234321234e7, "1.23432e+07" },
+        { 1.234321234321234e8, "1.23432e+08" },
+        { 1.234321234321234e9, "1.23432e+09" },
+        { 1.234321234321234e10, "1.23432e+10" },
+        { 1.234321234321234e11, "1.23432e+11" },
+        { 1.234321234321234e12, "1.23432e+12" },
+        { 1.234321234321234e13, "1.23432e+13" },
+        { 1.234321234321234e14, "1.23432e+14" },
+        { 1.234321234321234e15, "1.23432e+15" },
+        { 1.234321234321234e16, "1.23432e+16" },
+        { 1.234321234321234e17, "1.23432e+17" },
+        { 1.234321234321234e18, "1.23432e+18" },
+        { 1.234321234321234e19, "1.23432e+19" },
+        { 1.234321234321234e20, "1.23432e+20" },
+        { 1.234321234321234e21, "1.23432e+21" },
+        { 1.234321234321234e22, "1.23432e+22" },
+        { 1.234321234321234e23, "1.23432e+23" },
+        { 1.234321234321234e24, "1.23432e+24" },
+        { 1.234321234321234e25, "1.23432e+25" },
+        { 1.234321234321234e26, "1.23432e+26" },
+        { 1.234321234321234e27, "1.23432e+27" },
+        { 1.234321234321234e28, "1.23432e+28" },
+        { 1.234321234321234e29, "1.23432e+29" },
+        { 1.234321234321234e30, "1.23432e+30" },
+        { 1.234321234321234e31, "1.23432e+31" },
+        { 1.234321234321234e32, "1.23432e+32" },
+        { 1.234321234321234e33, "1.23432e+33" },
+        { 1.234321234321234e34, "1.23432e+34" },
+        { 1.234321234321234e35, "1.23432e+35" },
+        { 1.234321234321234e36, "1.23432e+36" }
+      };
+    size_t k;
+    for (k = 0; k < SIZEOF (data); k++)
+      {
+        char *result;
+        int retval =
+          my_asprintf (&result, "%g", data[k].value);
+        const char *expected = data[k].string;
+        ASSERT (result != NULL);
+        ASSERT (strcmp (result, expected) == 0
+                /* Some implementations produce exponents with 3 digits.  */
+                || (expected[strlen (expected) - 4] == 'e'
+                    && strlen (result) == strlen (expected) + 1
+                    && memcmp (result, expected, strlen (expected) - 2) == 0
+                    && result[strlen (expected) - 2] == '0'
+                    && strcmp (result + strlen (expected) - 1,
+                               expected + strlen (expected) - 2)
+                       == 0));
+        ASSERT (retval == strlen (result));
+        free (result);
+      }
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%g %d", -0.03125, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-0.03125 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%g %d", 0.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%g %d", minus_zerod, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%g %d", Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "inf 33") == 0
+            || strcmp (result, "infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%g %d", - Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-inf 33") == 0
+            || strcmp (result, "-infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%g %d", NaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNAND
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%g %d", SNaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10g %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "      1.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*g %d", 10, 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "      1.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*g %d", -10, 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.75       33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10g %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.75       33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SHOWSIGN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%+g %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "+1.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SPACE.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "% g %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, " 1.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#g %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.75000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.g %d", 1.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "2. 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.g %d", 9.75, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.e+01 33") == 0
+            || strcmp (result, "1.e+001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with finite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%010g %d", 1234.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0000001234 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015g %d", - Infinityd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "           -inf 33") == 0
+            || strcmp (result, "      -infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%050g %d", NaNd (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) == 50 + 3
+            && strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.g %d", 1234.0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1e+03 33") == 0
+            || strcmp (result, "1e+003 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with no rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.5g %d", 999.951, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "999.95 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.5g %d", 999.996, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", 12.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "12.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A larger positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", 1234567.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.23457e+06 33") == 0
+            || strcmp (result, "1.23457e+006 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Small and large positive numbers.  */
+    static struct { long double value; const char *string; } data[] =
+      {
+        { 1.234321234321234e-37L, "1.23432e-37" },
+        { 1.234321234321234e-36L, "1.23432e-36" },
+        { 1.234321234321234e-35L, "1.23432e-35" },
+        { 1.234321234321234e-34L, "1.23432e-34" },
+        { 1.234321234321234e-33L, "1.23432e-33" },
+        { 1.234321234321234e-32L, "1.23432e-32" },
+        { 1.234321234321234e-31L, "1.23432e-31" },
+        { 1.234321234321234e-30L, "1.23432e-30" },
+        { 1.234321234321234e-29L, "1.23432e-29" },
+        { 1.234321234321234e-28L, "1.23432e-28" },
+        { 1.234321234321234e-27L, "1.23432e-27" },
+        { 1.234321234321234e-26L, "1.23432e-26" },
+        { 1.234321234321234e-25L, "1.23432e-25" },
+        { 1.234321234321234e-24L, "1.23432e-24" },
+        { 1.234321234321234e-23L, "1.23432e-23" },
+        { 1.234321234321234e-22L, "1.23432e-22" },
+        { 1.234321234321234e-21L, "1.23432e-21" },
+        { 1.234321234321234e-20L, "1.23432e-20" },
+        { 1.234321234321234e-19L, "1.23432e-19" },
+        { 1.234321234321234e-18L, "1.23432e-18" },
+        { 1.234321234321234e-17L, "1.23432e-17" },
+        { 1.234321234321234e-16L, "1.23432e-16" },
+        { 1.234321234321234e-15L, "1.23432e-15" },
+        { 1.234321234321234e-14L, "1.23432e-14" },
+        { 1.234321234321234e-13L, "1.23432e-13" },
+        { 1.234321234321234e-12L, "1.23432e-12" },
+        { 1.234321234321234e-11L, "1.23432e-11" },
+        { 1.234321234321234e-10L, "1.23432e-10" },
+        { 1.234321234321234e-9L, "1.23432e-09" },
+        { 1.234321234321234e-8L, "1.23432e-08" },
+        { 1.234321234321234e-7L, "1.23432e-07" },
+        { 1.234321234321234e-6L, "1.23432e-06" },
+        { 1.234321234321234e-5L, "1.23432e-05" },
+        { 1.234321234321234e-4L, "0.000123432" },
+        { 1.234321234321234e-3L, "0.00123432" },
+        { 1.234321234321234e-2L, "0.0123432" },
+        { 1.234321234321234e-1L, "0.123432" },
+        { 1.234321234321234L, "1.23432" },
+        { 1.234321234321234e1L, "12.3432" },
+        { 1.234321234321234e2L, "123.432" },
+        { 1.234321234321234e3L, "1234.32" },
+        { 1.234321234321234e4L, "12343.2" },
+        { 1.234321234321234e5L, "123432" },
+        { 1.234321234321234e6L, "1.23432e+06" },
+        { 1.234321234321234e7L, "1.23432e+07" },
+        { 1.234321234321234e8L, "1.23432e+08" },
+        { 1.234321234321234e9L, "1.23432e+09" },
+        { 1.234321234321234e10L, "1.23432e+10" },
+        { 1.234321234321234e11L, "1.23432e+11" },
+        { 1.234321234321234e12L, "1.23432e+12" },
+        { 1.234321234321234e13L, "1.23432e+13" },
+        { 1.234321234321234e14L, "1.23432e+14" },
+        { 1.234321234321234e15L, "1.23432e+15" },
+        { 1.234321234321234e16L, "1.23432e+16" },
+        { 1.234321234321234e17L, "1.23432e+17" },
+        { 1.234321234321234e18L, "1.23432e+18" },
+        { 1.234321234321234e19L, "1.23432e+19" },
+        { 1.234321234321234e20L, "1.23432e+20" },
+        { 1.234321234321234e21L, "1.23432e+21" },
+        { 1.234321234321234e22L, "1.23432e+22" },
+        { 1.234321234321234e23L, "1.23432e+23" },
+        { 1.234321234321234e24L, "1.23432e+24" },
+        { 1.234321234321234e25L, "1.23432e+25" },
+        { 1.234321234321234e26L, "1.23432e+26" },
+        { 1.234321234321234e27L, "1.23432e+27" },
+        { 1.234321234321234e28L, "1.23432e+28" },
+        { 1.234321234321234e29L, "1.23432e+29" },
+        { 1.234321234321234e30L, "1.23432e+30" },
+        { 1.234321234321234e31L, "1.23432e+31" },
+        { 1.234321234321234e32L, "1.23432e+32" },
+        { 1.234321234321234e33L, "1.23432e+33" },
+        { 1.234321234321234e34L, "1.23432e+34" },
+        { 1.234321234321234e35L, "1.23432e+35" },
+        { 1.234321234321234e36L, "1.23432e+36" }
+      };
+    size_t k;
+    for (k = 0; k < SIZEOF (data); k++)
+      {
+        char *result;
+        int retval =
+          my_asprintf (&result, "%Lg", data[k].value);
+        const char *expected = data[k].string;
+        ASSERT (result != NULL);
+        ASSERT (strcmp (result, expected) == 0
+                /* Some implementations produce exponents with 3 digits.  */
+                || (expected[strlen (expected) - 4] == 'e'
+                    && strlen (result) == strlen (expected) + 1
+                    && memcmp (result, expected, strlen (expected) - 2) == 0
+                    && result[strlen (expected) - 2] == '0'
+                    && strcmp (result + strlen (expected) - 1,
+                               expected + strlen (expected) - 2)
+                       == 0));
+        ASSERT (retval == strlen (result));
+        free (result);
+      }
+  }
+
+  { /* A negative number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", -0.03125L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-0.03125 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", 0.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", minus_zerol, 33, 44, 55);
+    ASSERT (result != NULL);
+    if (have_minus_zero ())
+      ASSERT (strcmp (result, "-0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Positive infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "inf 33") == 0
+            || strcmp (result, "infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative infinity.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", - Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "-inf 33") == 0
+            || strcmp (result, "-infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", NaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#if HAVE_SNANL
+  { /* Signalling NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", SNaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+  { /* Quiet NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+  {
+    /* Signalling NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) >= 3 + 3
+            && strisnan (result, 0, strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+  /* asprintf should print something for noncanonical values.  */
+  { /* Pseudo-NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Infinity.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Zero.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Unnormalized number.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+  { /* Pseudo-Denormal.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { .word = LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
+    char *result;
+    int retval =
+      my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (retval == strlen (result));
+    ASSERT (3 < retval && strcmp (result + retval - 3, " 33") == 0);
+    free (result);
+  }
+#endif
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10Lg %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "      1.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*Lg %d", 10, 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "      1.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*Lg %d", -10, 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.75       33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10Lg %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.75       33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SHOWSIGN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%+Lg %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "+1.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_SPACE.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "% Lg %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, " 1.75 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#Lg %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.75000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.Lg %d", 1.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "2. 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.Lg %d", 9.75L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1.e+01 33") == 0
+            || strcmp (result, "1.e+001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with finite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%010Lg %d", 1234.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0000001234 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with infinite number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015Lg %d", - Infinityl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "           -inf 33") == 0
+            || strcmp (result, "      -infinity 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ZERO with NaN.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%050Lg %d", NaNl (), 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strlen (result) == 50 + 3
+            && strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
+            && strcmp (result + strlen (result) - 3, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.Lg %d", 1234.0L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1e+03 33") == 0
+            || strcmp (result, "1e+003 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with no rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.5Lg %d", 999.951L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "999.95 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision with rounding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.5Lg %d", 999.996L, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "1000 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the %n format directive.  */
+
+  {
+    int count = -1;
+    char *result;
+    int retval =
+      my_asprintf (&result, "%d %n", 123, &count, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "123 ") == 0);
+    ASSERT (retval == strlen (result));
+    ASSERT (count == 4);
+    free (result);
+  }
+
+  /* Test the support of the POSIX/XSI format strings with positions.  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%2$d %1$d", 33, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "55 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the grouping flag.  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%'d %d", 1234567, 99);
+    ASSERT (result != NULL);
+    ASSERT (result[strlen (result) - 1] == '9');
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the left-adjust flag.  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "a%*sc", -3, "b");
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "a%-*sc", 3, "b");
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "a%-*sc", -3, "b");
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of large precision.  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4000d %d", 1234567, 99);
+    size_t i;
+    ASSERT (result != NULL);
+    for (i = 0; i < 4000 - 7; i++)
+      ASSERT (result[i] == '0');
+    ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.*d %d", 4000, 1234567, 99);
+    size_t i;
+    ASSERT (result != NULL);
+    for (i = 0; i < 4000 - 7; i++)
+      ASSERT (result[i] == '0');
+    ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4000d %d", -1234567, 99);
+    size_t i;
+    ASSERT (result != NULL);
+    ASSERT (result[0] == '-');
+    for (i = 0; i < 4000 - 7; i++)
+      ASSERT (result[1 + i] == '0');
+    ASSERT (strcmp (result + 1 + 4000 - 7, "1234567 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4000u %d", 1234567, 99);
+    size_t i;
+    ASSERT (result != NULL);
+    for (i = 0; i < 4000 - 7; i++)
+      ASSERT (result[i] == '0');
+    ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4000o %d", 1234567, 99);
+    size_t i;
+    ASSERT (result != NULL);
+    for (i = 0; i < 4000 - 7; i++)
+      ASSERT (result[i] == '0');
+    ASSERT (strcmp (result + 4000 - 7, "4553207 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4000x %d", 1234567, 99);
+    size_t i;
+    ASSERT (result != NULL);
+    for (i = 0; i < 4000 - 6; i++)
+      ASSERT (result[i] == '0');
+    ASSERT (strcmp (result + 4000 - 6, "12d687 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.4000x %d", 1234567, 99);
+    size_t i;
+    ASSERT (result != NULL);
+    ASSERT (result[0] == '0');
+    ASSERT (result[1] == 'x');
+    for (i = 0; i < 4000 - 6; i++)
+      ASSERT (result[2 + i] == '0');
+    ASSERT (strcmp (result + 2 + 4000 - 6, "12d687 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.4000f %d", 1.0, 99);
+    size_t i;
+    ASSERT (result != NULL);
+    ASSERT (result[0] == '1');
+    ASSERT (result[1] == '.');
+    for (i = 0; i < 4000; i++)
+      ASSERT (result[2 + i] == '0');
+    ASSERT (strcmp (result + 2 + 4000, " 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.511f %d", 1.0, 99);
+    size_t i;
+    ASSERT (result != NULL);
+    ASSERT (result[0] == '1');
+    ASSERT (result[1] == '.');
+    for (i = 0; i < 511; i++)
+      ASSERT (result[2 + i] == '0');
+    ASSERT (strcmp (result + 2 + 511, " 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char input[5000];
+    char *result;
+    int retval;
+    size_t i;
+
+    for (i = 0; i < sizeof (input) - 1; i++)
+      input[i] = 'a' + ((1000000 / (i + 1)) % 26);
+    input[i] = '\0';
+    retval = my_asprintf (&result, "%.4000s %d", input, 99);
+    ASSERT (result != NULL);
+    ASSERT (memcmp (result, input, 4000) == 0);
+    ASSERT (strcmp (result + 4000, " 99") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the %s format directive.  */
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10s %d", "xyz", 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "       xyz 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*s %d", 10, "xyz", 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "       xyz 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*s %d", -10, "xyz", 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "xyz        33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10s %d", "xyz", 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "xyz        33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+#if HAVE_WCHAR_T
+  static wchar_t L_xyz[4] = { 'x', 'y', 'z', 0 };
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10ls %d", L_xyz, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "       xyz 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*ls %d", 10, L_xyz, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "       xyz 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*ls %d", -10, L_xyz, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "xyz        33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10ls %d", L_xyz, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "xyz        33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+#endif
+
+  /* To verify that these tests succeed, it is necessary to run them under
+     a tool that checks against invalid memory accesses, such as ElectricFence
+     or "valgrind --tool=memcheck".  */
+  {
+    size_t i;
+
+    for (i = 1; i <= 8; i++)
+      {
+        char *block;
+        char *result;
+        int retval;
+
+        block = (char *) malloc (i);
+        memcpy (block, "abcdefgh", i);
+        retval = my_asprintf (&result, "%.*s", (int) i, block);
+        ASSERT (result != NULL);
+        ASSERT (memcmp (result, block, i) == 0);
+        ASSERT (result[i] == '\0');
+        ASSERT (retval == strlen (result));
+        free (result);
+        free (block);
+      }
+  }
+#if HAVE_WCHAR_T
+  {
+    size_t i;
+
+    for (i = 1; i <= 8; i++)
+      {
+        wchar_t *block;
+        size_t j;
+        char *result;
+        int retval;
+
+        block = (wchar_t *) malloc (i * sizeof (wchar_t));
+        for (j = 0; j < i; j++)
+          block[j] = "abcdefgh"[j];
+        retval = my_asprintf (&result, "%.*ls", (int) i, block);
+        ASSERT (result != NULL);
+        ASSERT (memcmp (result, "abcdefgh", i) == 0);
+        ASSERT (result[i] == '\0');
+        ASSERT (retval == strlen (result));
+        free (result);
+        free (block);
+      }
+  }
+#endif
+
+  /* Test the support of the %c format directive.  */
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10c %d", (unsigned char) 'x', 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "         x 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*c %d", 10, (unsigned char) 'x', 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "         x 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*c %d", -10, (unsigned char) 'x', 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "x          33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10c %d", (unsigned char) 'x', 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "x          33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision is ignored.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0c %d", (unsigned char) 'x', 33, 44, 55);
+    ASSERT (strcmp (result, "x 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NUL character.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "a%cz %d", '\0', 33, 44, 55);
+    ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0);
+    ASSERT (retval == 6);
+    free (result);
+  }
+
+#if HAVE_WCHAR_T
+  static wint_t L_x = (wchar_t) 'x';
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10lc %d", L_x, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "         x 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*lc %d", 10, L_x, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "         x 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*lc %d", -10, L_x, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "x          33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10lc %d", L_x, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "x          33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision is ignored.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0lc %d", L_x, 33, 44, 55);
+    ASSERT (strcmp (result, "x 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* NUL character.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "a%lcz %d", (wint_t) L'\0', 33, 44, 55);
+    /* ISO C had this wrong for decades.  ISO C 23 now corrects it, through
+       this wording:
+       "If an l length modifier is present, the wint_t argument is converted
+        as if by a call to the wcrtomb function with a pointer to storage of
+        at least MB_CUR_MAX bytes, the wint_t argument converted to wchar_t,
+        and an initial shift state."  */
+    ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0);
+    ASSERT (retval == 6);
+    free (result);
+  }
+
+  static wint_t L_invalid = (wchar_t) 0x76543210;
+
+  { /* Invalid wide character.
+       The conversion may succeed or may fail, but it should not abort.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%lc %d", L_invalid, 33, 44, 55);
+    if (retval >= 0)
+      free (result);
+  }
+
+  { /* Invalid wide character and width.
+       The conversion may succeed or may fail, but it should not abort.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10lc %d", L_invalid, 33, 44, 55);
+    if (retval >= 0)
+      free (result);
+  }
+#endif
+
+  /* Test the support of the 'x' conversion specifier for hexadecimal output of
+     integers.  */
+
+  { /* Zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%x %d", 0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A large positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%x %d", 0xFFFFFFFEU, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "fffffffe 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "      303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*x %d", 10, 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "      303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*x %d", -10, 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "303c       33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "000000303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Zero precision and a positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Zero precision and a zero number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0x %d", 0, 33, 44, 55);
+    ASSERT (result != NULL);
+    /* ISO C and POSIX specify that "The result of converting a zero value
+       with a precision of zero is no characters."  */
+    ASSERT (strcmp (result, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%15.10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "     000000303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Padding and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%015.10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    /* ISO C 99 § 7.19.6.1.(6) says: "For d, i, o, u, x, and X conversions, if a
+       precision is specified, the 0 flag is ignored."  */
+    ASSERT (strcmp (result, "     000000303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "303c       33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#x %d", 0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "    0x303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and padding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%0#10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x0000303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%0#.10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0x000000303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and width and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#15.10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "   0x000000303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and padding and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%0#15.10x %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    /* ISO C 99 § 7.19.6.1.(6) says: "For d, i, o, u, x, and X conversions, if a
+       precision is specified, the 0 flag is ignored."  */
+    ASSERT (strcmp (result, "   0x000000303c 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a zero precision and a zero number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.0x %d", 0, 33, 44, 55);
+    ASSERT (result != NULL);
+    /* ISO C and POSIX specify that "The result of converting a zero value
+       with a precision of zero is no characters.", and the prefix is added
+       only for non-zero values.  */
+    ASSERT (strcmp (result, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Uppercase 'X'.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%X %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "303C 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Uppercase 'X' with FLAG_ALT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#X %d", 12348, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0X303C 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Uppercase 'X' with FLAG_ALT and zero precision and a zero number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.0X %d", 0, 33, 44, 55);
+    ASSERT (result != NULL);
+    /* ISO C and POSIX specify that "The result of converting a zero value
+       with a precision of zero is no characters.", and the prefix is added
+       only for non-zero values.  */
+    ASSERT (strcmp (result, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of the 'b' conversion specifier for binary output of
+     integers.  */
+
+  { /* Zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%b %d", 0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* A large positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%b %d", 0xFFFFFFFEU, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "11111111111111111111111111111110 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "      11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width given as argument.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*b %d", 20, 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "      11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Negative width given as argument (cf. FLAG_LEFT below).  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%*b %d", -20, 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "11000000111001       33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "00000011000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Zero precision and a positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Zero precision and a zero number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%.0b %d", 0, 33, 44, 55);
+    ASSERT (result != NULL);
+    /* ISO C and POSIX specify that "The result of converting a zero value
+       with a precision of zero is no characters."  */
+    ASSERT (strcmp (result, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Width and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%25.20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "     00000011000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* Padding and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%025.20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    /* Neither ISO C nor POSIX specify that the '0' flag is ignored when
+       a width and a precision are both present.  But implementations do so.  */
+    ASSERT (strcmp (result, "     00000011000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_LEFT.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%-20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "11000000111001       33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with zero.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#b %d", 0, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0b11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and width.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "    0b11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and padding.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%0#20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0b000011000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%0#.20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "0b00000011000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and width and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#25.20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "   0b00000011000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a positive number and padding and precision.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%0#25.20b %d", 12345, 33, 44, 55);
+    ASSERT (result != NULL);
+    /* Neither ISO C nor POSIX specify that the '0' flag is ignored when
+       a width and a precision are both present.  But implementations do so.  */
+    ASSERT (strcmp (result, "   0b00000011000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  { /* FLAG_ALT with a zero precision and a zero number.  */
+    char *result;
+    int retval =
+      my_asprintf (&result, "%#.0b %d", 0, 33, 44, 55);
+    ASSERT (result != NULL);
+    /* ISO C and POSIX specify that "The result of converting a zero value
+       with a precision of zero is no characters.", and the prefix is added
+       only for non-zero values.  */
+    ASSERT (strcmp (result, " 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of argument type/size specifiers for signed integer
+     conversions.  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%hhd %d", (signed char) -42, 33, 44, 55);
+    ASSERT (strcmp (result, "-42 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%hd %d", (short) -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%d %d", -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%ld %d", (long int) -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%lld %d", (long long int) -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w8d %d", (int8_t) -42, 33, 44, 55);
+    ASSERT (strcmp (result, "-42 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w16d %d", (int16_t) -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w32d %d", (int32_t) -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w64d %d", (int64_t) -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf8d %d", (int_fast8_t) -42, 33, 44, 55);
+    ASSERT (strcmp (result, "-42 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf16d %d", (int_fast16_t) -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf32d %d", (int_fast32_t) -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf64d %d", (int_fast64_t) -12345, 33, 44, 55);
+    ASSERT (strcmp (result, "-12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of argument type/size specifiers for unsigned integer
+     conversions: %u  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%hhu %d", (unsigned char) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "42 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%hu %d", (unsigned short) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%u %d", (unsigned int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%lu %d", (unsigned long int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%llu %d", (unsigned long long int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w8u %d", (uint8_t) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "42 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w16u %d", (uint16_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w32u %d", (uint32_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w64u %d", (uint64_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf8u %d", (uint_fast8_t) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "42 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf16u %d", (uint_fast16_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf32u %d", (uint_fast32_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf64u %d", (uint_fast64_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "12345 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of argument type/size specifiers for unsigned integer
+     conversions: %b  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%hhb %d", (unsigned char) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "101010 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%hb %d", (unsigned short) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%b %d", (unsigned int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%lb %d", (unsigned long int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%llb %d", (unsigned long long int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w8b %d", (uint8_t) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "101010 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w16b %d", (uint16_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w32b %d", (uint32_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w64b %d", (uint64_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf8b %d", (uint_fast8_t) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "101010 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf16b %d", (uint_fast16_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf32b %d", (uint_fast32_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf64b %d", (uint_fast64_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "11000000111001 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of argument type/size specifiers for unsigned integer
+     conversions: %o  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%hho %d", (unsigned char) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "52 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%ho %d", (unsigned short) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%o %d", (unsigned int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%lo %d", (unsigned long int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%llo %d", (unsigned long long int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w8o %d", (uint8_t) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "52 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w16o %d", (uint16_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w32o %d", (uint32_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w64o %d", (uint64_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf8o %d", (uint_fast8_t) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "52 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf16o %d", (uint_fast16_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf32o %d", (uint_fast32_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf64o %d", (uint_fast64_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "30071 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  /* Test the support of argument type/size specifiers for unsigned integer
+     conversions: %x  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%hhX %d", (unsigned char) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "2A 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%hX %d", (unsigned short) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%X %d", (unsigned int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%lX %d", (unsigned long int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%llX %d", (unsigned long long int) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w8X %d", (uint8_t) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "2A 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w16X %d", (uint16_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w32X %d", (uint32_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%w64X %d", (uint64_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf8X %d", (uint_fast8_t) 42, 33, 44, 55);
+    ASSERT (strcmp (result, "2A 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf16X %d", (uint_fast16_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf32X %d", (uint_fast32_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "%wf64X %d", (uint_fast64_t) 12345, 33, 44, 55);
+    ASSERT (strcmp (result, "3039 33") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+}
+
+static int
+my_asprintf (char **result, const char *format, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start (args, format);
+  ret = vasprintf (result, format, args);
+  va_end (args);
+  return ret;
+}
+
+static void
+test_vasprintf ()
+{
+  test_function (my_asprintf);
+}
+
+static void
+test_asprintf ()
+{
+  test_function (asprintf);
+}
+
+int
+main (int argc, char *argv[])
+{
+  test_vasprintf ();
+  test_asprintf ();
+  return 0;
+}
deleted file mode 120000 (symlink)
index 976c9392470f7c8bcc57f925941c6d450c678937..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-vasprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..809e6ad712ea085f3d9aed588c8b041f079f0250
--- /dev/null
@@ -0,0 +1,103 @@
+/* Test of vasprintf() and asprintf() functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (asprintf, int, (char **, char const *, ...));
+SIGNATURE_CHECK (vasprintf, int, (char **, char const *, va_list));
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+static int
+my_asprintf (char **result, const char *format, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start (args, format);
+  ret = vasprintf (result, format, args);
+  va_end (args);
+  return ret;
+}
+
+static void
+test_vasprintf ()
+{
+  int repeat;
+
+  for (repeat = 0; repeat <= 8; repeat++)
+    {
+      char *result;
+      int retval = my_asprintf (&result, "%d", 12345);
+      ASSERT (retval == 5);
+      ASSERT (result != NULL);
+      ASSERT (strcmp (result, "12345") == 0);
+      free (result);
+    }
+
+  for (repeat = 0; repeat <= 8; repeat++)
+    {
+      char *result;
+      int retval = my_asprintf (&result, "%08lx", 12345UL);
+      ASSERT (retval == 8);
+      ASSERT (result != NULL);
+      ASSERT (strcmp (result, "00003039") == 0);
+      free (result);
+    }
+}
+
+static void
+test_asprintf ()
+{
+  int repeat;
+
+  for (repeat = 0; repeat <= 8; repeat++)
+    {
+      char *result;
+      int retval = asprintf (&result, "%d", 12345);
+      ASSERT (retval == 5);
+      ASSERT (result != NULL);
+      ASSERT (strcmp (result, "12345") == 0);
+      free (result);
+    }
+
+  for (repeat = 0; repeat <= 8; repeat++)
+    {
+      char *result;
+      int retval = asprintf (&result, "%08lx", 12345UL);
+      ASSERT (retval == 8);
+      ASSERT (result != NULL);
+      ASSERT (strcmp (result, "00003039") == 0);
+      free (result);
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  test_vasprintf ();
+  test_asprintf ();
+  return 0;
+}
deleted file mode 120000 (symlink)
index a27a4ff386ccba6a8ed481a92e6867f21aa862d9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-vc-list-files-cvs.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..64b54c0ebc1402b1b63d2e394144301b80e86922
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Unit tests for vc-list-files
+# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.  */
+
+: "${srcdir=.}"
+. "$srcdir/init.sh"; path_prepend_ .
+
+tmpdir=vc-cvs
+repo=`pwd`/$tmpdir/repo
+
+fail=0
+for i in with-cvsu without; do
+  # On the first iteration, test using cvsu, if it's in your path.
+  # On the second iteration, ensure that cvsu fails, so we'll
+  # exercise the awk-using code.
+  if test $i = without; then
+    printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu
+    chmod a+x cvsu
+    PATH=`pwd`:$PATH
+    export PATH
+  fi
+  ok=0
+  mkdir $tmpdir && cd $tmpdir &&
+    # without cvs, skip the test
+    { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \
+      || skip_ "cvs not found in PATH"; } &&
+    mkdir w && cd w &&
+    mkdir d &&
+    touch d/a b c &&
+    cvs -Q -d "$repo" import -m imp m M M0 &&
+    cvs -Q -d "$repo" co m && cd m &&
+    printf '%s\n' b c d/a > expected &&
+    $BOURNE_SHELL "$abs_aux_dir/vc-list-files" | sort > actual &&
+    compare expected actual &&
+    ok=1
+  test $ok = 0 && fail=1
+done
+
+Exit $fail
deleted file mode 120000 (symlink)
index 9078f916ea93b4eabffa85ff617c2e507c64bfa9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-vc-list-files-git.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..7bee9bed612569709b333b3290b606ffa0e867b6
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Unit tests for vc-list-files
+# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.  */
+
+: "${srcdir=.}"
+. "$srcdir/init.sh"; path_prepend_ .
+
+tmpdir=vc-git-$$
+GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE
+
+# Ignore local git configurations that may interact badly with
+# commands below.  For example, if the user has set
+# commit.gpgsign=true in ~/.gitconfig the 'git commit' below will
+# require a OpenPGP private key operation which trigger PIN prompts
+# and unwanted hardware access on the developer's machine.
+GIT_CONFIG_GLOBAL=/dev/null; export GIT_CONFIG_GLOBAL
+
+fail=1
+mkdir $tmpdir && cd $tmpdir &&
+  # without git, skip the test
+  # The double use of 'exit' is needed for the reference to $? inside the trap.
+  { ( git init -q ) > /dev/null 2>&1 \
+    || skip_ "git not found in PATH"; } &&
+  mkdir d &&
+  touch d/a b c &&
+  git config user.email "you@example.com" &&
+  git config user.name "Your Name" &&
+  git add . > /dev/null &&
+  git commit -q -a -m log &&
+  printf '%s\n' b c d/a > expected &&
+  $BOURNE_SHELL "$abs_aux_dir/vc-list-files" > actual &&
+  compare expected actual &&
+  fail=0
+
+Exit $fail
deleted file mode 120000 (symlink)
index 84eea42a1145013cd9eff198c25bfd811a905368..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-verify-try.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d16fb938dbbd244be22a23d9c820f026b2322865
--- /dev/null
@@ -0,0 +1,21 @@
+/* Test the "verify" module.
+
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This is a separate source file, so that the execution of test-verify.sh
+   does not interfere with the building of the 'test-verify' program.  */
+
+#include "test-verify.c"
deleted file mode 120000 (symlink)
index 051b4976e5899f344c1b3109f28d543fe41d3d0f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-verify.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1d8f43c7a721e33e25593f60dd74b3e3d869a2be
--- /dev/null
@@ -0,0 +1,119 @@
+/* Test the "verify" module.
+
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible.  */
+
+#include <config.h>
+
+#include "verify.h"
+
+#ifndef EXP_FAIL
+# define EXP_FAIL 0
+#endif
+
+/* ======================= Test verify, verify_expr ======================= */
+
+int gx;
+enum { A, B, C };
+
+#if EXP_FAIL == 1
+verify (gx >= 0);                 /* should give ERROR: non-constant expression */
+#endif
+verify (C == 2);                  /* should be ok */
+#if EXP_FAIL == 2
+verify (1 + 1 == 3);              /* should give ERROR */
+#endif
+verify (1 == 1); verify (1 == 1); /* should be ok */
+
+enum
+{
+  item = verify_expr (1 == 1, 10 * 0 + 17) /* should be ok */
+};
+
+static int
+function (int n)
+{
+#if EXP_FAIL == 3
+  verify (n >= 0);                  /* should give ERROR: non-constant expression */
+#endif
+  verify (C == 2);                  /* should be ok */
+#if EXP_FAIL == 4
+  verify (1 + 1 == 3);              /* should give ERROR */
+#endif
+  verify (1 == 1); verify (1 == 1); /* should be ok */
+
+  if (n)
+    return ((void) verify_expr (1 == 1, 1), verify_expr (1 == 1, 8)); /* should be ok */
+#if EXP_FAIL == 5
+  return verify_expr (1 == 2, 5); /* should give ERROR */
+#endif
+  return 0;
+}
+
+/* ============================== Test assume ============================== */
+
+static int
+f (int a)
+{
+  return a;
+}
+
+typedef struct { unsigned int context : 4; unsigned int halt : 1; } state;
+
+void test_assume_expressions (state *s);
+int test_assume_optimization (int x);
+_Noreturn void test_assume_noreturn (void);
+
+void
+test_assume_expressions (state *s)
+{
+  /* Check that 'assume' accepts a function call, even of a non-const
+     function.  */
+  assume (f (1));
+  /* Check that 'assume' accepts a bit-field expression.  */
+  assume (s->halt);
+}
+
+int
+test_assume_optimization (int x)
+{
+  /* Check that the compiler uses 'assume' for optimization.
+     This function, when compiled with optimization, should have code
+     equivalent to
+       return x + 3;
+     Use 'objdump --disassemble test-verify.o' to verify this.  */
+  assume (x >= 4);
+  return (x > 1 ? x + 3 : 2 * x + 10);
+}
+
+_Noreturn void
+test_assume_noreturn (void)
+{
+  /* Check that the compiler's data-flow analysis recognizes 'assume (0)'.
+     This function should not elicit a warning.  */
+  assume (0);
+}
+
+/* ============================== Main ===================================== */
+int
+main (void)
+{
+  state s = { 0, 1 };
+  test_assume_expressions (&s);
+  test_assume_optimization (5);
+  return !(function (0) == 0 && function (1) == 8);
+}
deleted file mode 120000 (symlink)
index 63e91378336b8c93e2b98629a0a6350326e72a18..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-verify.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..1e75d55a26e7824033554a6fcb14bfbb0683fa14
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+. "${srcdir=.}/init.sh"
+
+# We are not interested in triggering bugs in the compilers and tools
+# (such as gcc 4.3.1 on openSUSE 11.0).
+unset MALLOC_PERTURB_
+
+# Rather than figure out how to invoke the compiler with the right
+# include path ourselves, we let make do it:
+(cd "$initial_cwd_" \
+ && rm -f test-verify-try.o \
+ && $MAKE test-verify-try.o >/dev/null 2>&1) \
+  || skip_ "cannot compile error-free"
+
+# Now, prove that we encounter all expected compilation failures:
+: >out
+: >err
+for i in 1 2 3 4 5; do
+  (cd "$initial_cwd_"
+   rm -f test-verify-try.o
+   $MAKE CFLAGS=-DEXP_FAIL=$i test-verify-try.o) >>out 2>>err \
+  && { warn_ "compiler didn't detect verification failure $i"; fail=1; }
+done
+
+Exit $fail
deleted file mode 120000 (symlink)
index 0fc626ab82f610ea030a19573963b4b7bd1ed93b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-verror.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..53294aa03556d607b3b975bc772d8172d246ee66
--- /dev/null
@@ -0,0 +1,131 @@
+/* Test of verror.h functions.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include "verror.h"
+
+#include <errno.h>
+#include <stdarg.h>
+
+#include <error.h>
+#include "macros.h"
+
+/* Custom function to not show the program name in error messages.  */
+static void
+print_no_progname (void)
+{
+}
+
+static void
+test_zero (const char *format, ...)
+{
+  va_list args;
+
+  va_start (args, format);
+  verror (0, 0, format, args);
+  va_end (args);
+}
+
+static void
+test_zero_at_line (const char *filename, unsigned int lineno,
+                   const char *format, ...)
+{
+  va_list args;
+
+  va_start (args, format);
+  verror_at_line (0, 0, filename, lineno, format, args);
+  va_end (args);
+}
+
+static void
+test_errnum (const char *format, ...)
+{
+  va_list args;
+
+  va_start (args, format);
+  verror (0, EACCES, format, args);
+  va_end (args);
+}
+
+static void
+test_fatal (const char *format, ...)
+{
+  va_list args;
+
+  va_start (args, format);
+  verror (4, 0, format, args);
+  va_end (args);
+}
+
+int
+main (int argc, char *argv[])
+{
+  /* Test verror() function with zero STATUS and zero ERRNUM.  */
+  test_zero ("bummer");
+  /* With format string arguments.  */
+  errno = EINVAL; /* should be ignored */
+  test_zero ("Zonk %d%d%d is too large", 1, 2, 3);
+  /* With non-ASCII characters.  */
+  test_zero ("Pokémon started");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 3);
+
+  /* Test verror_at_line() function with zero STATUS and zero ERRNUM.  */
+  test_zero_at_line ("d1/foo.c", 10, "invalid blub");
+  test_zero_at_line ("d1/foo.c", 10, "invalid blarn");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 5);
+
+  /* Test error_one_per_line.  */
+  error_one_per_line = 1;
+  test_zero_at_line ("d1/foo.c", 10, "unsupported glink");
+  /* Another line number.  */
+  test_zero_at_line ("d1/foo.c", 13, "invalid brump");
+  /* Another file name.  */
+  test_zero_at_line ("d2/foo.c", 13, "unsupported flinge");
+  /* Same file name and same line number => message not shown.  */
+  test_zero_at_line ("d2/foo.c", 13, "invalid bark");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 8);
+  error_one_per_line = 0;
+
+  /* Test error_print_progname.  */
+  error_print_progname = print_no_progname;
+  test_zero ("hammer");
+  test_zero ("boing %d%d%d is too large", 1, 2, 3);
+  #if 0
+  /* The documentation does not describe the output if the file name is NULL. */
+  test_zero_at_line (NULL, 42, "drummer too loud");
+  #endif
+  test_zero_at_line ("d2/bar.c", 11, "bark too loud");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 11);
+  error_print_progname = NULL;
+
+  /* Test verror() function with nonzero ERRNUM.  */
+  errno = EINVAL; /* should be ignored */
+  test_errnum ("can't steal");
+  /* Verify error_message_count.  */
+  ASSERT (error_message_count == 12);
+
+  /* Test verror() function with nonzero STATUS.  */
+  test_fatal ("fatal error");
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 76b4d6bf1a50fd67514bf45ea90b1eeb74dba52c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-verror.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3652437e94bea6e5ff7dbfb3dc132aec95684ae5
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Test of the 'verror' module.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+${CHECKER} test-verror${EXEEXT} > out 2> err
+# Verify the exit code.
+case $? in
+  4) ;;
+  *) Exit 1;;
+esac
+
+# Normalize the stderr output on Windows platforms.
+tr -d '\015' < err | sed 's,.*test-verror[.ex]*:,test-verror:,' > err2 || Exit 1
+
+# Verify the stderr output.
+compare - err2 <<\EOF || Exit 1
+test-verror: bummer
+test-verror: Zonk 123 is too large
+test-verror: Pokémon started
+test-verror:d1/foo.c:10: invalid blub
+test-verror:d1/foo.c:10: invalid blarn
+test-verror:d1/foo.c:10: unsupported glink
+test-verror:d1/foo.c:13: invalid brump
+test-verror:d2/foo.c:13: unsupported flinge
+hammer
+boing 123 is too large
+d2/bar.c:11: bark too loud
+test-verror: can't steal: Permission denied
+test-verror: fatal error
+EOF
+
+# Verify the stdout output.
+test -s out && Exit 1
+
+Exit 0
deleted file mode 120000 (symlink)
index 40eb8019d8dd5b72b0ca8b3dd5bf726c601925e9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-version-etc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8662d24d12edc0741b6a5665c5458bf5afa1ca68
--- /dev/null
@@ -0,0 +1,31 @@
+/* Test suite for version-etc.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+   This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "version-etc.h"
+
+
+#define AUTHORS "Sergey Poznyakoff", "Eric Blake"
+
+int
+main (_GL_UNUSED int argc, char **argv)
+{
+  version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
+               (const char *) NULL);
+  return 0;
+}
deleted file mode 120000 (symlink)
index c3e1f25e38c708cfeffc37ce35e780683c0ffc97..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-version-etc.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..9b4b631aa942e870c282e34accfff0ac461d9b55
--- /dev/null
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Test suite for version-etc.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+TMP=ve-expected.tmp
+LC_ALL=C
+export LC_ALL
+ERR=0
+
+cat > $TMP <<EOT
+test-version-etc (PROJECT) VERSION
+COPYRIGHT Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written by Sergey Poznyakoff and Eric Blake.
+EOT
+
+${CHECKER} test-version-etc${EXEEXT} --version |
+ sed '1s/test-version-etc (.*) .*/test-version-etc (PROJECT) VERSION/
+      /^Packaged by/d
+      2,3 s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' |
+ tr -d '\015' |
+ compare $TMP - || ERR=1
+
+rm $TMP
+
+exit $ERR
deleted file mode 120000 (symlink)
index 7acb7ec4fb1303528a9c80bd5865fc07ab229bcb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-vfprintf-posix.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fa0b4954067c15b8b082bd67847ddb14a75db811
--- /dev/null
@@ -0,0 +1,52 @@
+/* Test of POSIX compatible vfprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (vfprintf, int, (FILE *, char const *, va_list));
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#include "test-fprintf-posix.h"
+
+static int
+my_fprintf (FILE *fp, const char *format, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start (args, format);
+  ret = vfprintf (fp, format, args);
+  va_end (args);
+  return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+  test_function (my_fprintf);
+  return 0;
+}
deleted file mode 120000 (symlink)
index fb8b19974acb3537fd78b18d3f7e76eed5152c7f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-vfprintf-posix.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..0d0945e411b962d820410cb01a6e1b6ad81163c6
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-vfprintf-posix.tmp t-vfprintf-posix.out"
+${CHECKER} ./test-vfprintf-posix${EXEEXT} > t-vfprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vfprintf-posix.tmp > t-vfprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-vfprintf-posix.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
deleted file mode 120000 (symlink)
index 210d68fb66243e134539bbc977589200f5844074..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-vprintf-posix.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6b8fdb74099c43dd02f35b4ec8b57caf663b115e
--- /dev/null
@@ -0,0 +1,52 @@
+/* Test of POSIX compatible vfprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (vprintf, int, (char const *, va_list));
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#include "test-printf-posix.h"
+
+static int
+my_printf (const char *format, ...)
+{
+  va_list args;
+  int ret;
+
+  va_start (args, format);
+  ret = vprintf (format, args);
+  va_end (args);
+  return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+  test_function (my_printf);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 98185cd7254dcf38991d06dc471b460fcc380d89..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-vprintf-posix.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..c2625c44c402bfa7ace0f5f03bdfb3dbffbfcafa
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-vprintf-posix.tmp t-vprintf-posix.out"
+${CHECKER} ./test-vprintf-posix${EXEEXT} > t-vprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vprintf-posix.tmp > t-vprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-vprintf-posix.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
deleted file mode 120000 (symlink)
index 17a7fa5c5b8f52d57e18239b513e2dd110ee7073..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wchar.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..663a5a4ea6ce013f53ca02e86aa138abd9213806
--- /dev/null
@@ -0,0 +1,35 @@
+/* Test of <wchar.h> substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+/* Check that the types wchar_t and wint_t are defined.  */
+wchar_t a = 'c';
+wint_t b = 'x';
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+static_assert (sizeof NULL == sizeof (void *));
+
+int
+main (void)
+{
+  return 0;
+}
deleted file mode 120000 (symlink)
index 7f60aa6a4a008fd318cf4650b7b51a49651d4fc5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb-w32-2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b01c5436b46b673ed75b416c770a6b8d62c850be
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1252 locale.
+${CHECKER} ./test-wcrtomb-w32${EXEEXT} French_France 1252
deleted file mode 120000 (symlink)
index dd3e67e72f1cb5951bfcefec9ec477e643bcfb46..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb-w32-3.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..5481634d4065fcf39164abe8d7c805a52cdc426c
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP1256 locale.
+${CHECKER} ./test-wcrtomb-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
deleted file mode 120000 (symlink)
index 87f9497b7ca5ea50723d0df1edf519bca253fdbe..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb-w32-4.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..fb04e5838d12f7814d682ceccdcfd0378120364e
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test some UTF-8 locales.
+${CHECKER} ./test-wcrtomb-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
deleted file mode 120000 (symlink)
index 6656b18612a44737a7d43d7e835ca967b074d651..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb-w32-5.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..f35879da3f0100ce22865b50a6f7cc330b7eec42
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP932 locale.
+${CHECKER} ./test-wcrtomb-w32${EXEEXT} Japanese_Japan 932
deleted file mode 120000 (symlink)
index 4a0cbd19d322a3581a15a0b7f2f130896dc806c3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb-w32-6.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..8eec6cbc307e7106e11598ecda2ece7833581ead
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP950 locale.
+${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_Taiwan 950
deleted file mode 120000 (symlink)
index aa72f3ea6f3967547bc9ecfaf8d376f7df241779..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb-w32-7.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..fd47d6fa9701d4c6bd6a436b12259b43c34ffe93
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a CP936 locale.
+${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_China 936
deleted file mode 120000 (symlink)
index 5a494bf2ed0699c009344532c5a0e0ba9a7ba64d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb-w32-8.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..802237d1aa2524d48152a7340625bb07c5a3e6a9
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a GB18030 locale.
+${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_China 54936
deleted file mode 120000 (symlink)
index 5d607855f4725e39ed5f6491de573d0a0edb57cf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb-w32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4be9a0df367561d9b1dc436978a57298f4d274f2
--- /dev/null
@@ -0,0 +1,337 @@
+/* Test of conversion of wide character to multibyte character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "localcharset.h"
+#include "macros.h"
+
+#if defined _WIN32 && !defined __CYGWIN__
+
+static int
+test_one_locale (const char *name, int codepage)
+{
+  char buf[64];
+  size_t ret;
+
+# if 1
+  /* Portable code to set the locale.  */
+  {
+    char name_with_codepage[1024];
+
+    sprintf (name_with_codepage, "%s.%d", name, codepage);
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name_with_codepage) == NULL)
+      return 77;
+  }
+# else
+  /* Hacky way to set a locale.codepage combination that setlocale() refuses
+     to set.  */
+  {
+    /* Codepage of the current locale, set with setlocale().
+       Not necessarily the same as GetACP().  */
+    extern __declspec(dllimport) unsigned int __lc_codepage;
+
+    /* Set the locale.  */
+    if (setlocale (LC_ALL, name) == NULL)
+      return 77;
+
+    /* Clobber the codepage and MB_CUR_MAX, both set by setlocale().  */
+    __lc_codepage = codepage;
+    switch (codepage)
+      {
+      case 1252:
+      case 1256:
+        MB_CUR_MAX = 1;
+        break;
+      case 932:
+      case 950:
+      case 936:
+        MB_CUR_MAX = 2;
+        break;
+      case 54936:
+      case 65001:
+        MB_CUR_MAX = 4;
+        break;
+      }
+
+    /* Test whether the codepage is really available.  */
+    {
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, " ", 1, &state) == (size_t)(-1))
+        return 77;
+    }
+  }
+# endif
+
+  /* Test NUL character.  */
+  {
+    buf[0] = 'x';
+    ret = wcrtomb (buf, 0, NULL);
+    ASSERT (ret == 1);
+    ASSERT (buf[0] == '\0');
+  }
+
+  /* Test single bytes.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          ret = wcrtomb (buf, btowc (c), NULL);
+          ASSERT (ret == 1);
+          ASSERT (buf[0] == (char) c);
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    ret = wcrtomb (NULL, '\0', NULL);
+    ASSERT (ret == 1);
+    ret = wcrtomb (NULL, btowc ('x'), NULL);
+    ASSERT (ret == 1);
+  }
+
+  switch (codepage)
+    {
+    case 1252:
+      /* Locale encoding is CP1252, an extension of ISO-8859-1.  */
+      {
+        /* Convert "B\374\337er": "Büßer" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\374", 1) == 0);
+        ASSERT (buf[1] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\337", 1) == 0);
+        ASSERT (buf[1] == 'x');
+      }
+      return 0;
+
+    case 1256:
+      /* Locale encoding is CP1256, not the same as ISO-8859-6.  */
+      {
+        /* Convert "x\302\341\346y": "xآلوy" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x0622, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\302", 1) == 0);
+        ASSERT (buf[1] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x0644, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\341", 1) == 0);
+        ASSERT (buf[1] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x0648, NULL);
+        ASSERT (ret == 1);
+        ASSERT (memcmp (buf, "\346", 1) == 0);
+        ASSERT (buf[1] == 'x');
+      }
+      return 0;
+
+    case 65001:
+      /* Locale encoding is CP65001 = UTF-8.  */
+      if (strcmp (locale_charset (), "UTF-8") != 0)
+        return 77;
+      {
+        /* Convert "B\303\274\303\237er": "Büßer" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\303\274", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\303\237", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 932:
+      /* Locale encoding is CP932, similar to Shift_JIS.  */
+      {
+        /* Convert "<\223\372\226\173\214\352>": "<日本語>" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x65E5, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\223\372", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x672C, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\226\173", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x8A9E, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\214\352", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 950:
+      /* Locale encoding is CP950, similar to Big5.  */
+      {
+        /* Convert "<\244\351\245\273\273\171>": "<日本語>" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x65E5, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\244\351", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x672C, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\245\273", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x8A9E, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\273\171", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 936:
+      /* Locale encoding is CP936 = GBK, an extension of GB2312.  */
+      {
+        /* Convert "<\310\325\261\276\325\132>": "<日本語>" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x65E5, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\310\325", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x672C, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\261\276", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x8A9E, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\325\132", 2) == 0);
+        ASSERT (buf[2] == 'x');
+      }
+      return 0;
+
+    case 54936:
+      /* Locale encoding is CP54936 = GB18030.  */
+      if (strcmp (locale_charset (), "GB18030") != 0)
+        return 77;
+      {
+        /* Convert "B\250\271\201\060\211\070er": "Büßer" */
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\250\271", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = wcrtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 4);
+        ASSERT (memcmp (buf, "\201\060\211\070", 4) == 0);
+        ASSERT (buf[4] == 'x');
+      }
+      return 0;
+
+    default:
+      return 1;
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int codepage = atoi (argv[argc - 1]);
+  int result;
+  int i;
+
+  result = 77;
+  for (i = 1; i < argc - 1; i++)
+    {
+      int ret = test_one_locale (argv[i], codepage);
+
+      if (ret != 77)
+        result = ret;
+    }
+
+  if (result == 77)
+    {
+      fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+               codepage);
+    }
+  return result;
+}
+
+#else
+
+int
+main (int argc, char *argv[])
+{
+  fputs ("Skipping test: not a native Windows system\n", stderr);
+  return 77;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 3ed433bbff66bf490ff00e61255c0e00e1cc8e99..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..640d6d9c50113923681b372fbc99df6413637517
--- /dev/null
@@ -0,0 +1,166 @@
+/* Test of conversion of wide character to multibyte character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (wcrtomb, size_t, (char *, wchar_t, mbstate_t *));
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+/* Check the multibyte character s[0..n-1].  */
+static void
+check_character (const char *s, size_t n)
+{
+  wchar_t wc;
+  char buf[64];
+  int iret;
+  size_t ret;
+
+  wc = (wchar_t) 0xBADFACE;
+  iret = mbtowc (&wc, s, n);
+  ASSERT (iret == n);
+
+  ret = wcrtomb (buf, wc, NULL);
+  ASSERT (ret == n);
+  ASSERT (memcmp (buf, s, n) == 0);
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  ret = wcrtomb (NULL, wc, NULL);
+  ASSERT (ret == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+  char buf[64];
+  size_t ret;
+
+  /* configure should already have checked that the locale is supported.  */
+  if (setlocale (LC_ALL, "") == NULL)
+    return 1;
+
+  /* Test NUL character.  */
+  {
+    buf[0] = 'x';
+    ret = wcrtomb (buf, 0, NULL);
+    ASSERT (ret == 1);
+    ASSERT (buf[0] == '\0');
+  }
+
+  /* Test single bytes.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          ret = wcrtomb (buf, btowc (c), NULL);
+          ASSERT (ret == 1);
+          ASSERT (buf[0] == (char) c);
+          break;
+        }
+  }
+
+  /* Test special calling convention, passing a NULL pointer.  */
+  {
+    ret = wcrtomb (NULL, '\0', NULL);
+    ASSERT (ret == 1);
+    ret = wcrtomb (NULL, btowc ('x'), NULL);
+    ASSERT (ret == 1);
+  }
+
+  if (argc > 1)
+    switch (argv[1][0])
+      {
+      case '1':
+        /* C locale; tested above.  */
+        return 0;
+
+      case '2':
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        {
+          const char input[] = "B\374\337er"; /* "Büßer" */
+
+          check_character (input + 1, 1);
+          check_character (input + 2, 1);
+        }
+        return 0;
+
+      case '3':
+        /* Locale encoding is UTF-8.  */
+        {
+          const char input[] = "B\303\274\303\237er"; /* "Büßer" */
+
+          check_character (input + 1, 2);
+          check_character (input + 3, 2);
+        }
+        return 0;
+
+      case '4':
+        /* Locale encoding is EUC-JP.  */
+        {
+          const char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
+
+          check_character (input + 1, 2);
+          check_character (input + 3, 2);
+          check_character (input + 5, 2);
+        }
+        return 0;
+
+      case '5':
+        /* Locale encoding is GB18030.  */
+        {
+          const char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
+
+          check_character (input + 1, 2);
+          check_character (input + 3, 4);
+        }
+        return 0;
+      }
+
+  return 1;
+}
deleted file mode 120000 (symlink)
index 113f4df75e832575c5cd2fdff7873b96eeff4aea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcrtomb.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b4604612bc157f4efdd8ba99e1c0b46f034ce8b9
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-wcrtomb${EXEEXT} 1 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-wcrtomb${EXEEXT} 1 || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+  LC_ALL=$LOCALE_FR \
+  ${CHECKER} ./test-wcrtomb${EXEEXT} 2 \
+  || exit 1
+fi
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 != none; then
+  LC_ALL=$LOCALE_FR_UTF8 \
+  ${CHECKER} ./test-wcrtomb${EXEEXT} 3 \
+  || exit 1
+fi
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA != none; then
+  LC_ALL=$LOCALE_JA \
+  ${CHECKER} ./test-wcrtomb${EXEEXT} 4 \
+  || exit 1
+fi
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN != none; then
+  LC_ALL=$LOCALE_ZH_CN \
+  ${CHECKER} ./test-wcrtomb${EXEEXT} 5 \
+  || exit 1
+fi
+
+exit 0
deleted file mode 120000 (symlink)
index bcaa634200d90c251da109044ad752d2ec77afff..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wctype-h.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..016fd8fcfb9ec170258f41c92c8cf9cabf9f57aa
--- /dev/null
@@ -0,0 +1,111 @@
+/* Test of <wctype.h> substitute.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <wctype.h>
+
+/* Check that the type wint_t is defined.  */
+wint_t a = 'x';
+/* Check that WEOF is defined.  */
+wint_t e = WEOF;
+
+/* Check that the type wctype_t is defined.  */
+wctype_t p;
+
+/* Check that the type wctrans_t is defined.  */
+wctrans_t q;
+
+#include "macros.h"
+
+int
+main (void)
+{
+  /* Check that the isw* functions exist as functions or as macros.  */
+  (void) iswalnum (0);
+  (void) iswalpha (0);
+  (void) iswcntrl (0);
+  (void) iswdigit (0);
+  (void) iswgraph (0);
+  (void) iswlower (0);
+  (void) iswprint (0);
+  (void) iswpunct (0);
+  (void) iswspace (0);
+  (void) iswupper (0);
+  (void) iswxdigit (0);
+
+  /* Check that the isw* functions map WEOF to 0.  */
+  ASSERT (!iswalnum (e));
+  ASSERT (!iswalpha (e));
+  ASSERT (!iswcntrl (e));
+  ASSERT (!iswdigit (e));
+  ASSERT (!iswgraph (e));
+  ASSERT (!iswlower (e));
+  ASSERT (!iswprint (e));
+  ASSERT (!iswpunct (e));
+  ASSERT (!iswspace (e));
+  ASSERT (!iswupper (e));
+  ASSERT (!iswxdigit (e));
+
+  /* Sanity check for the iswprint function.  */
+  ASSERT (iswprint (L' '));
+  ASSERT (!iswprint (L'\t'));
+  ASSERT (!iswprint (L'\n'));
+
+  /* Sanity check for the iswpunct function.
+     These characters are usually expected to be punctuation or symbol
+     characters.  */
+  ASSERT (iswpunct (L'!'));
+  ASSERT (iswpunct (L'"'));
+  ASSERT (iswpunct (L'#'));
+  ASSERT (iswpunct (L'%'));
+  ASSERT (iswpunct (L'&'));
+  ASSERT (iswpunct (L'\''));
+  ASSERT (iswpunct (L'('));
+  ASSERT (iswpunct (L')'));
+  ASSERT (iswpunct (L'*'));
+  ASSERT (iswpunct (L','));
+  ASSERT (iswpunct (L'-'));
+  ASSERT (iswpunct (L'.'));
+  ASSERT (iswpunct (L'/'));
+  ASSERT (iswpunct (L':'));
+  ASSERT (iswpunct (L';'));
+  ASSERT (iswpunct (L'?'));
+  ASSERT (iswpunct (L'@'));
+  ASSERT (iswpunct (L'['));
+  ASSERT (iswpunct (L'\\'));
+  ASSERT (iswpunct (L']'));
+  ASSERT (iswpunct (L'_'));
+  ASSERT (iswpunct (L'{'));
+  ASSERT (iswpunct (L'}'));
+  ASSERT (!iswpunct (L'5'));
+  ASSERT (!iswpunct (L'F'));
+  ASSERT (!iswpunct (L' '));
+  ASSERT (!iswpunct (L'\t'));
+  ASSERT (!iswpunct (L'\n'));
+
+  /* Check that the tow* functions exist as functions or as macros.  */
+  (void) towlower (0);
+  (void) towupper (0);
+
+  /* Check that the tow* functions map WEOF to WEOF.  */
+  ASSERT (towlower (e) == e);
+  ASSERT (towupper (e) == e);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 50e0809e8ef5915771d6159099162a28bb14c2a6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wctype.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..62d0a78c979fcd975acc066597d957341fbb90b0
--- /dev/null
@@ -0,0 +1,73 @@
+/* Test of getting descriptor for a wide character property.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include <wctype.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (wctype, wctype_t, (const char *));
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+  wctype_t desc;
+
+  desc = wctype ("any");
+  ASSERT (desc == (wctype_t) 0);
+
+  desc = wctype ("blank");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("space");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("punct");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("lower");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("upper");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("alpha");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("digit");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("xdigit");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("alnum");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("cntrl");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("graph");
+  ASSERT (desc != (wctype_t) 0);
+
+  desc = wctype ("print");
+  ASSERT (desc != (wctype_t) 0);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 947cde049437a227580af8a1f5b090f1a35f8b35..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-wcwidth.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..79556a24ed14e38e2d35a3423e43252a6423ac00
--- /dev/null
@@ -0,0 +1,106 @@
+/* Test of wcwidth() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (wcwidth, int, (wchar_t));
+
+#include <locale.h>
+#include <string.h>
+
+#include "c-ctype.h"
+#include "localcharset.h"
+#include "macros.h"
+
+int
+main ()
+{
+  wchar_t wc;
+
+#if !GNULIB_WCHAR_SINGLE_LOCALE
+# ifdef C_CTYPE_ASCII
+  /* Test width of ASCII characters.  */
+  for (wc = 0x20; wc < 0x7F; wc++)
+    ASSERT (wcwidth (wc) == 1);
+# endif
+#endif
+
+  /* Switch to an UTF-8 locale.  */
+  if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL
+      /* Check whether it's really an UTF-8 locale.
+         On OpenBSD 4.0, the setlocale call succeeds only for the LC_CTYPE
+         category and therefore returns "C/fr_FR.UTF-8/C/C/C/C", but the
+         LC_CTYPE category is effectively set to an ASCII LC_CTYPE category;
+         in particular, locale_charset() returns "ASCII".  */
+      && strcmp (locale_charset (), "UTF-8") == 0)
+    {
+      /* Test width of ASCII characters.  */
+      for (wc = 0x20; wc < 0x7F; wc++)
+        ASSERT (wcwidth (wc) == 1);
+
+      /* Test width of some non-spacing characters.  */
+      ASSERT (wcwidth (0x0301) == 0);
+      ASSERT (wcwidth (0x05B0) == 0);
+
+      /* Test width of some format control characters.  */
+      ASSERT (wcwidth (0x200E) <= 0);
+      ASSERT (wcwidth (0x2060) <= 0);
+#if 0  /* wchar_t may be only 16 bits.  */
+      ASSERT (wcwidth (0xE0001) <= 0);
+      ASSERT (wcwidth (0xE0044) <= 0);
+#endif
+
+      /* Test width of some zero width characters.  */
+      /* While it is desirable that U+200B, U+200C, U+200D have width 0,
+         because this makes wcswidth work better on strings that contain these
+         characters, it is acceptable if an implementation treats these
+         characters like control characters.  */
+      ASSERT (wcwidth (0x200B) <= 0);
+      ASSERT (wcwidth (0xFEFF) <= 0);
+
+      /* Test width of some math symbols.
+         U+2202 is marked as having ambiguous width (A) in EastAsianWidth.txt
+         (see <https://www.unicode.org/Public/12.0.0/ucd/EastAsianWidth.txt>).
+         The Unicode Standard Annex 11
+         <https://www.unicode.org/reports/tr11/tr11-36.html>
+         says
+           "Ambiguous characters behave like wide or narrow characters
+            depending on the context (language tag, script identification,
+            associated font, source of data, or explicit markup; all can
+            provide the context). If the context cannot be established
+            reliably, they should be treated as narrow characters by default."
+         For wcwidth(), the only available context information is the locale.
+         "fr_FR.UTF-8" is a Western locale, not an East Asian locale, therefore
+         U+2202 should be treated like a narrow character.  */
+      ASSERT (wcwidth (0x2202) == 1);
+
+      /* Test width of some CJK characters.  */
+      ASSERT (wcwidth (0x3000) == 2);
+      ASSERT (wcwidth (0xB250) == 2);
+      ASSERT (wcwidth (0xFF1A) == 2);
+#if 0  /* wchar_t may be only 16 bits.  */
+      ASSERT (wcwidth (0x20369) == 2);
+      ASSERT (wcwidth (0x2F876) == 2);
+#endif
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 72b9fc6695a5b55e3c05180a14c1c759362bb211..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-write.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0b046a56d610dcf3c3a15df947e6a34252e9fcb2
--- /dev/null
@@ -0,0 +1,79 @@
+/* Test the write() function.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (write, ssize_t, (int, const void *, size_t));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+  const char *filename = "test-write.tmp";
+  int fd;
+
+  /* Create a file with a simple contents.  */
+  fd = open (filename, O_CREAT | O_WRONLY, 0600);
+  ASSERT (fd >= 0);
+  ASSERT (write (fd, "Hello World", 11) == 11);
+  ASSERT (close (fd) == 0);
+
+  /* Write into the middle of the file.  */
+  fd = open (filename, O_WRONLY);
+  ASSERT (fd >= 0);
+  ASSERT (lseek (fd, 6, SEEK_SET) == 6);
+  ASSERT (write (fd, "fascination", 11) == 11);
+
+  /* Verify the contents of the file.  */
+  {
+    char buf[64];
+    int rfd = open (filename, O_RDONLY);
+    ASSERT (rfd >= 0);
+    ASSERT (read (rfd, buf, sizeof (buf)) == 17);
+    ASSERT (close (rfd) == 0);
+    ASSERT (memcmp (buf, "Hello fascination", 17) == 0);
+  }
+
+  ASSERT (close (fd) == 0);
+
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    char byte = 'x';
+    errno = 0;
+    ASSERT (write (-1, &byte, 1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    char byte = 'x';
+    close (99);
+    errno = 0;
+    ASSERT (write (99, &byte, 1) == -1);
+    ASSERT (errno == EBADF);
+  }
+
+  /* Clean up.  */
+  unlink (filename);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 81437a737f4565e0705ee97bc7fef32e7c6fe9ce..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xalloc-die.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d45654348d49702e334ead9c58c6905b9042da16
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of xalloc_die() function.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2009.  */
+
+#include <config.h>
+
+#include "xalloc.h"
+
+int
+main ()
+{
+  xalloc_die ();
+  return 0;
+}
deleted file mode 120000 (symlink)
index 7d26312a99975aa1234a6aca4e122bd0e86c2462..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xalloc-die.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..dedc132c9c6a2c3d2ee05141dff9f51182be6af7
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Test suite for xalloc_die.
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# This file is part of the GNUlib 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+${CHECKER} test-xalloc-die${EXEEXT} > out 2> err
+case $? in
+  1) ;;
+  *) Exit 1;;
+esac
+
+tr -d '\015' < err \
+  | sed 's,.*test-xalloc-die[.ex]*:,test-xalloc-die:,' > err2 || Exit 1
+
+compare - err2 <<\EOF || Exit 1
+test-xalloc-die: memory exhausted
+EOF
+
+test -s out && Exit 1
+
+Exit $fail
deleted file mode 120000 (symlink)
index 83b85738b38563f1de6e5f26e22c48240c73ea5e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xfprintf-posix.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..db56103afcfa1c2c2cbdb506f2aba62442cc49ce
--- /dev/null
@@ -0,0 +1,37 @@
+/* Test of error-checking xfprintf() function with POSIX compatible formatting.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "xprintf.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#include "test-fprintf-posix.h"
+
+int
+main (_GL_UNUSED int argc, char *argv[])
+{
+  test_function (xfprintf);
+  return 0;
+}
deleted file mode 120000 (symlink)
index a542749fbb4a4782ca1c5dd449230cc2aa935d15..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xprintf-posix.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..17660d7304a868d9cd3715f213181e574ca7ddae
--- /dev/null
@@ -0,0 +1,36 @@
+/* Test of error-checking xprintf() function with POSIX compatible formatting.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "xprintf.h"
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#include "test-printf-posix.h"
+
+int
+main (_GL_UNUSED int argc, char *argv[])
+{
+  test_function (xprintf);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 43dd0a59f312c5a5a3deec85ff941a831a4acc1c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xprintf-posix.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..35da74256a06ae431331b2b729302fb4974f18a1
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-xprintf-posix.tmp t-xprintf-posix.out"
+${CHECKER} ./test-xprintf-posix${EXEEXT} > t-xprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-xprintf-posix.tmp > t-xprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-xprintf-posix.out
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles t-xfprintf-posix.tmp t-xfprintf-posix.out"
+${CHECKER} ./test-xfprintf-posix${EXEEXT} > t-xfprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-xfprintf-posix.tmp > t-xfprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-xfprintf-posix.out
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+rm -fr $tmpfiles
+
+exit 0
deleted file mode 120000 (symlink)
index 4a62aaeef0680d427baf0a5dccce27248e9403f0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xstrtoimax.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cc2f6ae895ca111f545bbdcd488de657564074e3
--- /dev/null
@@ -0,0 +1,4 @@
+#define __xstrtol xstrtoimax
+#define __strtol_t intmax_t
+#define __spec PRIdMAX
+#include "test-xstrtol.c"
deleted file mode 120000 (symlink)
index 88fcd6ddfc6eb944aba074343b46315599ffb218..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xstrtoimax.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..f41e52eacaf354db341533299799d3ac2c910fad
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+: "${srcdir=.}"
+. "$srcdir/init.sh"; path_prepend_ .
+
+too_big=99999999999999999999999999999999999999999999999999999999999999999999
+result=0
+
+# test xstrtoimax
+${CHECKER} test-xstrtoimax 1 >> out 2>&1 || result=1
+${CHECKER} test-xstrtoimax -1 >> out 2>&1 || result=1
+${CHECKER} test-xstrtoimax 1k >> out 2>&1 || result=1
+${CHECKER} test-xstrtoimax ${too_big}h >> out 2>&1 && result=1
+${CHECKER} test-xstrtoimax $too_big >> out 2>&1 && result=1
+${CHECKER} test-xstrtoimax x >> out 2>&1 && result=1
+${CHECKER} test-xstrtoimax 9x >> out 2>&1 && result=1
+${CHECKER} test-xstrtoimax 010 >> out 2>&1 || result=1
+${CHECKER} test-xstrtoimax MiB >> out 2>&1 || result=1
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+  cr='\015'
+else
+  cr='\r'
+fi
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k
+mv k out
+
+# compare expected output
+cat > exp <<EOF
+1->1 ()
+-1->-1 ()
+1k->1024 ()
+invalid suffix in X argument '${too_big}h'
+X argument '$too_big' too large
+invalid X argument 'x'
+invalid suffix in X argument '9x'
+010->8 ()
+MiB->1048576 ()
+EOF
+
+compare exp out || result=1
+
+Exit $result
deleted file mode 120000 (symlink)
index 3583aace60f22d8f2fbbc565c0b896b8862069f9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xstrtol.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c9568379aea92877251855fcfc9f28d585e7f9b5
--- /dev/null
@@ -0,0 +1,62 @@
+/* Test of xstrtol module.
+   Copyright (C) 1995-1996, 1998-2001, 2003-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <error.h>
+#include "xstrtol-error.h"
+
+#ifndef __xstrtol
+# define __xstrtol xstrtol
+# define __strtol_t long int
+# define __spec "ld"
+#endif
+
+/* Don't show the program name in error messages.  */
+static void
+print_no_progname (void)
+{
+}
+
+int
+main (int argc, char **argv)
+{
+  strtol_error s_err;
+  int i;
+
+  error_print_progname = print_no_progname;
+
+  for (i = 1; i < argc; i++)
+    {
+      char *p;
+      __strtol_t val;
+
+      s_err = __xstrtol (argv[i], &p, 0, &val, "bckMw0");
+      if (s_err == LONGINT_OK)
+        {
+          printf ("%s->%" __spec " (%s)\n", argv[i], val, p);
+        }
+      else
+        {
+          xstrtol_fatal (s_err, -2, 'X', NULL, argv[i]);
+        }
+    }
+  exit (0);
+}
deleted file mode 120000 (symlink)
index 1ae5d6758a6bd2a468dbe2361eeff2f61c324ac3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xstrtol.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..e82b585bf4077b8b6c08d0d17467e288a0e8377e
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+: "${srcdir=.}"
+. "$srcdir/init.sh"; path_prepend_ .
+
+too_big=99999999999999999999999999999999999999999999999999999999999999999999
+result=0
+
+# test xstrtol
+${CHECKER} test-xstrtol 1 >> out 2>&1 || result=1
+${CHECKER} test-xstrtol -1 >> out 2>&1 || result=1
+${CHECKER} test-xstrtol 1k >> out 2>&1 || result=1
+${CHECKER} test-xstrtol ${too_big}h >> out 2>&1 && result=1
+${CHECKER} test-xstrtol $too_big >> out 2>&1 && result=1
+${CHECKER} test-xstrtol x >> out 2>&1 && result=1
+${CHECKER} test-xstrtol 9x >> out 2>&1 && result=1
+${CHECKER} test-xstrtol 010 >> out 2>&1 || result=1
+# suffix without integer is valid
+${CHECKER} test-xstrtol MiB >> out 2>&1 || result=1
+${CHECKER} test-xstrtol 1bB >> out 2>&1 && result=1
+
+# test xstrtoul
+${CHECKER} test-xstrtoul 1 >> out 2>&1 || result=1
+${CHECKER} test-xstrtoul -1 >> out 2>&1 && result=1
+${CHECKER} test-xstrtoul 1k >> out 2>&1 || result=1
+${CHECKER} test-xstrtoul ${too_big}h >> out 2>&1 && result=1
+${CHECKER} test-xstrtoul $too_big >> out 2>&1 && result=1
+${CHECKER} test-xstrtoul x >> out 2>&1 && result=1
+${CHECKER} test-xstrtoul 9x >> out 2>&1 && result=1
+${CHECKER} test-xstrtoul 010 >> out 2>&1 || result=1
+${CHECKER} test-xstrtoul MiB >> out 2>&1 || result=1
+${CHECKER} test-xstrtoul 1bB >> out 2>&1 && result=1
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+  cr='\015'
+else
+  cr='\r'
+fi
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k
+mv k out
+
+# compare expected output
+cat > expected <<EOF
+1->1 ()
+-1->-1 ()
+1k->1024 ()
+invalid suffix in X argument '${too_big}h'
+X argument '$too_big' too large
+invalid X argument 'x'
+invalid suffix in X argument '9x'
+010->8 ()
+MiB->1048576 ()
+invalid suffix in X argument '1bB'
+1->1 ()
+invalid X argument '-1'
+1k->1024 ()
+invalid suffix in X argument '${too_big}h'
+X argument '$too_big' too large
+invalid X argument 'x'
+invalid suffix in X argument '9x'
+010->8 ()
+MiB->1048576 ()
+invalid suffix in X argument '1bB'
+EOF
+
+compare expected out || result=1
+
+Exit $result
deleted file mode 120000 (symlink)
index dc479b18f083420562185604232619fe89c00dc1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xstrtoul.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9dda9ee67e610461fb9bb961119af157cf9e33c9
--- /dev/null
@@ -0,0 +1,4 @@
+#define __xstrtol xstrtoul
+#define __strtol_t unsigned long int
+#define __spec "lu"
+#include "test-xstrtol.c"
deleted file mode 120000 (symlink)
index a250a6e3e19e6e516302a93bad19201de9c9a9f7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xstrtoumax.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2e68c2e5d8e010c1fcb5e0353547d9f039631f09
--- /dev/null
@@ -0,0 +1,4 @@
+#define __xstrtol xstrtoumax
+#define __strtol_t uintmax_t
+#define __spec PRIuMAX
+#include "test-xstrtol.c"
deleted file mode 120000 (symlink)
index d2f4eba99ae88574a36f2f9faa5af11aa460e8c2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xstrtoumax.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..5faca6a4398f1cfc79e21bd0d49563b52f653f30
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+: "${srcdir=.}"
+. "$srcdir/init.sh"; path_prepend_ .
+
+too_big=99999999999999999999999999999999999999999999999999999999999999999999
+result=0
+
+# test xstrtoumax
+${CHECKER} test-xstrtoumax 1 >> out 2>&1 || result=1
+${CHECKER} test-xstrtoumax -1 >> out 2>&1 && result=1
+${CHECKER} test-xstrtoumax 1k >> out 2>&1 || result=1
+${CHECKER} test-xstrtoumax ${too_big}h >> out 2>&1 && result=1
+${CHECKER} test-xstrtoumax $too_big >> out 2>&1 && result=1
+${CHECKER} test-xstrtoumax x >> out 2>&1 && result=1
+${CHECKER} test-xstrtoumax 9x >> out 2>&1 && result=1
+${CHECKER} test-xstrtoumax 010 >> out 2>&1 || result=1
+${CHECKER} test-xstrtoumax MiB >> out 2>&1 || result=1
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+  cr='\015'
+else
+  cr='\r'
+fi
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k
+mv k out
+
+# compare expected output
+cat > exp <<EOF
+1->1 ()
+invalid X argument '-1'
+1k->1024 ()
+invalid suffix in X argument '${too_big}h'
+X argument '$too_big' too large
+invalid X argument 'x'
+invalid suffix in X argument '9x'
+010->8 ()
+MiB->1048576 ()
+EOF
+
+compare exp out || result=1
+
+Exit $result
deleted file mode 120000 (symlink)
index 3e0f55e8d4fcdce903269f977fc0004e73232359..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-xvasprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8202bd31d6035fcb5f695d168d90f1f9355f7424
--- /dev/null
@@ -0,0 +1,135 @@
+/* Test of xvasprintf() and xasprintf() functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+/* Tell GCC not to warn about the specific edge cases tested here.  */
+#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wformat-zero-length"
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+# pragma GCC diagnostic ignored "-Wformat-security"
+#endif
+
+#include <config.h>
+
+#include "xvasprintf.h"
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+static char *
+my_xasprintf (const char *format, ...)
+{
+  va_list args;
+  char *ret;
+
+  va_start (args, format);
+  ret = xvasprintf (format, args);
+  va_end (args);
+  return ret;
+}
+
+static void
+test_xvasprintf (void)
+{
+  int repeat;
+  char *result;
+
+  for (repeat = 0; repeat <= 8; repeat++)
+    {
+      result = my_xasprintf ("%d", 12345);
+      ASSERT (result != NULL);
+      ASSERT (strcmp (result, "12345") == 0);
+      free (result);
+    }
+
+  {
+    /* Silence gcc warning about zero-length format string.  */
+    const char *empty = "";
+    result = my_xasprintf (empty);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "") == 0);
+    free (result);
+  }
+
+  result = my_xasprintf ("%s", "foo");
+  ASSERT (result != NULL);
+  ASSERT (strcmp (result, "foo") == 0);
+  free (result);
+
+  result = my_xasprintf ("%s%s", "foo", "bar");
+  ASSERT (result != NULL);
+  ASSERT (strcmp (result, "foobar") == 0);
+  free (result);
+
+  result = my_xasprintf ("%s%sbaz", "foo", "bar");
+  ASSERT (result != NULL);
+  ASSERT (strcmp (result, "foobarbaz") == 0);
+  free (result);
+}
+
+static void
+test_xasprintf (void)
+{
+  int repeat;
+  char *result;
+
+  for (repeat = 0; repeat <= 8; repeat++)
+    {
+      result = xasprintf ("%d", 12345);
+      ASSERT (result != NULL);
+      ASSERT (strcmp (result, "12345") == 0);
+      free (result);
+    }
+
+  {
+    /* Silence gcc warning about zero-length format string,
+       and about "format not a string literal and no format"
+       (whatever that means) .  */
+    const char *empty = "";
+    result = xasprintf (empty, empty);
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "") == 0);
+    free (result);
+  }
+
+  result = xasprintf ("%s", "foo");
+  ASSERT (result != NULL);
+  ASSERT (strcmp (result, "foo") == 0);
+  free (result);
+
+  result = xasprintf ("%s%s", "foo", "bar");
+  ASSERT (result != NULL);
+  ASSERT (strcmp (result, "foobar") == 0);
+  free (result);
+
+  result = my_xasprintf ("%s%sbaz", "foo", "bar");
+  ASSERT (result != NULL);
+  ASSERT (strcmp (result, "foobarbaz") == 0);
+  free (result);
+}
+
+int
+main (_GL_UNUSED int argc, char *argv[])
+{
+  test_xvasprintf ();
+  test_xasprintf ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 29d84d321f350c2362651014efe092d7201db739..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-year2038.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3e80d930824d1f19c98c1f29b8be3371c6761d9b
--- /dev/null
@@ -0,0 +1,39 @@
+/* Test of year2038 module.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+/* This test fails if AC_SYS_YEAR2038 could not arrange for a time_t
+   that supports values > 2147483647.
+   This can happen
+     - on systems that are not year 2038 safe, or
+     - if the user specified --disable-year2038 at configure time.
+   It is intended that this test fails in these circumstances.  */
+
+#include <config.h>
+
+#include <sys/types.h>
+#include "intprops.h"
+
+/* Although this test could be done with static_assert, the test
+   harness prefers dynamic checking.  */
+
+int
+main (void)
+{
+  /* Check the range of time_t.  */
+  return TYPE_MAXIMUM (time_t) >> 31 == 0;
+}
deleted file mode 120000 (symlink)
index e3aa33750462943ec70ba4ea4ff881f804187a68..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-yesno.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..acb60614d7d23d9bcfad6dcbce058b9990820e7d
--- /dev/null
@@ -0,0 +1,62 @@
+/* Test of yesno module.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
+
+/* Specification.  */
+#include "yesno.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "closein.h"
+#include "binary-io.h"
+
+/* Test yesno.  Without arguments, read one line.  If first argument
+   is zero, close stdin before attempting to read one line.
+   Otherwise, read the number of lines specified by first
+   argument.  */
+int
+main (int argc, char **argv)
+{
+  int i = 1;
+
+  /* yesno recommends that all clients use close_stdin in main.  */
+  atexit (close_stdin);
+  /* But on mingw, close_stdin leaves stdin's file descriptor at the expected
+     position (i.e. where this program left off reading) only if its mode has
+     been set to O_BINARY.  If it has been set to O_TEXT, and the file
+     descriptor is seekable, and stdin is buffered, the MSVCRT runtime ends up
+     setting the file descriptor's position to the expected position _minus_
+     the number of LFs not preceded by CR that were read between the expected
+     position and the last filled buffer end position.  (I.e. the repositioning
+     from the end-of-buffer to the expected position does not work if the input
+     file contains end-of-line markers in Unix convention.)  */
+  set_binary_mode (0, O_BINARY);
+
+  if (1 < argc)
+    i = atoi (argv[1]);
+  if (!i)
+    {
+      i = 1;
+      close (0);
+    }
+  while (i--)
+    puts (yesno () ? "Y" : "N");
+  return 0;
+}
deleted file mode 120000 (symlink)
index 5ccc0baa7af8b84d0705c38d59f043c131da6e3b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/test-yesno.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..3f8f101ef32b6564b6d893ac53425859b2fd7569
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/sh
+: "${srcdir=.}"
+. "$srcdir/init.sh"; path_prepend_ .
+
+# For now, only test with C locale
+LC_ALL=C
+export LC_ALL
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+  cr='\015'
+else
+  cr='\r'
+fi
+
+# Test with seekable stdin; the follow-on process must see remaining data.
+tr @ '\177' <<EOF > in.tmp
+nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn - entire line consumed
+y@n - backspace does not change result
+y
+does not match either yesexpr or noexpr
+n
+EOF
+
+cat <<EOF > xout.tmp
+N
+Y
+Y
+N
+n
+EOF
+
+fail=0
+(${CHECKER} test-yesno; ${CHECKER} test-yesno 3; cat) < in.tmp > out1.tmp || fail=1
+LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1
+cmp xout.tmp out.tmp || fail=1
+
+(${CHECKER} test-yesno 3; ${CHECKER} test-yesno; cat) < in.tmp > out1.tmp || fail=1
+LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1
+cmp xout.tmp out.tmp || fail=1
+
+# Test for behavior on pipe
+cat <<EOF > xout.tmp
+Y
+N
+EOF
+echo yes | ${CHECKER} test-yesno 2 > out1.tmp || fail=1
+LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1
+cmp xout.tmp out.tmp || fail=1
+
+# Test for behavior with no EOL at EOF
+cat <<EOF > xout.tmp
+Y
+EOF
+printf y | ${CHECKER} test-yesno 1 > out1.tmp || fail=1
+LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1
+cmp xout.tmp out.tmp || fail=1
+
+# Test for behavior on EOF
+cat <<EOF > xout.tmp
+N
+EOF
+${CHECKER} test-yesno </dev/null > out1.tmp || fail=1
+LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1
+cmp xout.tmp out.tmp || fail=1
+
+# Test for behavior when stdin is closed
+${CHECKER} test-yesno 0 <&- > out1.tmp 2> err.tmp && fail=1
+LC_ALL=C tr -d "$cr" < out1.tmp > out.tmp || fail=1
+cmp xout.tmp out.tmp || fail=1
+test -s err.tmp || fail=1
+
+Exit $fail
deleted file mode 120000 (symlink)
index c6ba5c6d3e638b596282e8f68c92e8d8a0359648..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/thread-optim.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4bcc8afd007cce7e5f0cb9d1705fe2135c932bd6
--- /dev/null
@@ -0,0 +1,65 @@
+/* Optimization of multithreaded code.
+
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#ifndef _THREAD_OPTIM_H
+#define _THREAD_OPTIM_H
+
+/* This file defines a way to optimize multithreaded code for the single-thread
+   case, based on the variable '__libc_single_threaded', defined in
+   glibc >= 2.32.  */
+
+/* Typical use: In a block or function, use
+
+     bool mt = gl_multithreaded ();
+     ...
+     if (mt)
+       if (pthread_mutex_lock (&lock)) abort ();
+     ...
+     if (mt)
+       if (pthread_mutex_unlock (&lock)) abort ();
+
+   The gl_multithreaded () invocation determines whether the program currently
+   is multithreaded.
+
+   if (mt) STATEMENT executes STATEMENT in the multithreaded case, and skips
+   it in the single-threaded case.
+
+   The code between the gl_multithreaded () invocation and any use of the
+   variable 'mt' must not create threads or invoke functions that may
+   indirectly create threads (e.g. 'dlopen' may, indirectly through C++
+   initializers of global variables in the shared library being opened,
+   create threads).
+
+   The lock here is meant to synchronize threads in the same process.  The
+   same optimization cannot be applied to locks that synchronize different
+   processes (e.g. through shared memory mappings).  */
+
+/* This file uses HAVE_SYS_SINGLE_THREADED_H.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if HAVE_SYS_SINGLE_THREADED_H /* glibc >= 2.32 */
+# include <sys/single_threaded.h>
+# define gl_multithreaded()  (!__libc_single_threaded)
+#else
+# define gl_multithreaded()  1
+#endif
+
+#endif /* _THREAD_OPTIM_H */
deleted file mode 120000 (symlink)
index 56a36c0e252d29c36b3b15c044ef31cd76c9c868..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/timespec-add.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e10c19842cd0d2a2861836c3e70a0cb645ee58b2
--- /dev/null
@@ -0,0 +1,66 @@
+/* Add two struct timespec values.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* Return the sum of two timespec values A and B.  On overflow, return
+   an extremal value.  This assumes 0 <= tv_nsec < TIMESPEC_HZ.  */
+
+#include <config.h>
+#include "timespec.h"
+
+#include <stdckdint.h>
+#include "intprops.h"
+
+struct timespec
+timespec_add (struct timespec a, struct timespec b)
+{
+  time_t rs = a.tv_sec;
+  time_t bs = b.tv_sec;
+  int ns = a.tv_nsec + b.tv_nsec;
+  int nsd = ns - TIMESPEC_HZ;
+  int rns = ns;
+
+  if (0 <= nsd)
+    {
+      rns = nsd;
+      time_t bs1;
+      if (!ckd_add (&bs1, bs, 1))
+        bs = bs1;
+      else if (rs < 0)
+        rs++;
+      else
+        goto high_overflow;
+    }
+
+  if (ckd_add (&rs, rs, bs))
+    {
+      if (bs < 0)
+        {
+          rs = TYPE_MINIMUM (time_t);
+          rns = 0;
+        }
+      else
+        {
+        high_overflow:
+          rs = TYPE_MAXIMUM (time_t);
+          rns = TIMESPEC_HZ - 1;
+        }
+    }
+
+  return make_timespec (rs, rns);
+}
deleted file mode 120000 (symlink)
index 5066acb3489c49c6163eb26dea1150410002ef1a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/timespec-sub.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..315cc638369825264ce1caa876417a4c23551e5a
--- /dev/null
@@ -0,0 +1,66 @@
+/* Subtract two struct timespec values.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* Return the difference between two timespec values A and B.  On
+   overflow, return an extremal value.  This assumes 0 <= tv_nsec <
+   TIMESPEC_HZ.  */
+
+#include <config.h>
+#include "timespec.h"
+
+#include <stdckdint.h>
+#include "intprops.h"
+
+struct timespec
+timespec_sub (struct timespec a, struct timespec b)
+{
+  time_t rs = a.tv_sec;
+  time_t bs = b.tv_sec;
+  int ns = a.tv_nsec - b.tv_nsec;
+  int rns = ns;
+
+  if (ns < 0)
+    {
+      rns = ns + TIMESPEC_HZ;
+      time_t bs1;
+      if (!ckd_add (&bs1, bs, 1))
+        bs = bs1;
+      else if (- TYPE_SIGNED (time_t) < rs)
+        rs--;
+      else
+        goto low_overflow;
+    }
+
+  if (ckd_sub (&rs, rs, bs))
+    {
+      if (0 < bs)
+        {
+        low_overflow:
+          rs = TYPE_MINIMUM (time_t);
+          rns = 0;
+        }
+      else
+        {
+          rs = TYPE_MAXIMUM (time_t);
+          rns = TIMESPEC_HZ - 1;
+        }
+    }
+
+  return make_timespec (rs, rns);
+}
deleted file mode 120000 (symlink)
index 42af76f65cf15107f0f21fb487308db2b61590f8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/tmpfile.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7944a09076d28960a85fe552bcab0ca3cf1d052c
--- /dev/null
@@ -0,0 +1,186 @@
+/* Create a temporary file.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Ben Pfaff. */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* A native Windows platform.  */
+
+# include <fcntl.h>
+# include <string.h>
+# include <sys/stat.h>
+
+# include <io.h>
+
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+
+#else
+
+# include <unistd.h>
+
+#endif
+
+#include "pathmax.h"
+#include "tempname.h"
+#include "tmpdir.h"
+
+/* PATH_MAX is guaranteed to be defined, because this replacement is only
+   used on native Windows and Android.  */
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* A native Windows platform.  */
+
+/* Don't assume that UNICODE is not defined.  */
+# undef OSVERSIONINFO
+# define OSVERSIONINFO OSVERSIONINFOA
+# undef GetVersionEx
+# define GetVersionEx GetVersionExA
+# undef GetTempPath
+# define GetTempPath GetTempPathA
+
+/* On Windows, opening a file with _O_TEMPORARY has the effect of passing
+   the FILE_FLAG_DELETE_ON_CLOSE flag to CreateFile(), which has the effect
+   of deleting the file when it is closed - even when the program crashes.
+   But (according to the Cygwin sources) it works only on Windows NT or newer.
+   So we cache the info whether we are running on Windows NT or newer.  */
+
+static bool
+supports_delete_on_close ()
+{
+  static int known; /* 1 = yes, -1 = no, 0 = unknown */
+  if (!known)
+    {
+      OSVERSIONINFO v;
+
+      /* According to
+         <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getversionexa>
+         this structure must be initialized as follows:  */
+      v.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
+
+      if (GetVersionEx (&v))
+        known = (v.dwPlatformId == VER_PLATFORM_WIN32_NT ? 1 : -1);
+      else
+        known = -1;
+    }
+  return (known > 0);
+}
+
+FILE *
+tmpfile (void)
+{
+  char dir[PATH_MAX];
+  DWORD retval;
+
+  /* Find Windows temporary file directory.
+     We provide this as the directory argument to path_search because Windows
+     defines P_tmpdir to "\\" and will therefore try to put all temporary files
+     in the root directory (unless $TMPDIR is set). */
+  retval = GetTempPath (PATH_MAX, dir);
+  if (retval > 0 && retval < PATH_MAX)
+    {
+      char xtemplate[PATH_MAX];
+
+      if (path_search (xtemplate, PATH_MAX, dir, NULL, true) >= 0)
+        {
+          size_t len = strlen (xtemplate);
+          int o_temporary = (supports_delete_on_close () ? _O_TEMPORARY : 0);
+          int fd;
+
+          do
+            {
+              memcpy (&xtemplate[len - 6], "XXXXXX", 6);
+              if (gen_tempname (xtemplate, 0, 0, GT_NOCREATE) < 0)
+                {
+                  fd = -1;
+                  break;
+                }
+
+              fd = _open (xtemplate,
+                          _O_CREAT | _O_EXCL | o_temporary
+                          | _O_RDWR | _O_BINARY,
+                          _S_IREAD | _S_IWRITE);
+            }
+          while (fd < 0 && errno == EEXIST);
+
+          if (fd >= 0)
+            {
+              FILE *fp = _fdopen (fd, "w+b");
+
+              if (fp != NULL)
+                return fp;
+              else
+                {
+                  int saved_errno = errno;
+                  _close (fd);
+                  errno = saved_errno;
+                }
+            }
+        }
+    }
+  else
+    {
+      if (retval > 0)
+        errno = ENAMETOOLONG;
+      else
+        /* Ideally this should translate GetLastError () to an errno value.  */
+        errno = ENOENT;
+    }
+
+  return NULL;
+}
+
+#else
+
+FILE *
+tmpfile (void)
+{
+  char buf[PATH_MAX];
+  int fd;
+  FILE *fp;
+
+  /* Try $TMPDIR first, not /tmp nor P_tmpdir, because we need this replacement
+     on Android, and /tmp does not exist on Android.  */
+
+  if (path_search (buf, sizeof buf, NULL, "tmpf", true))
+    return NULL;
+
+  fd = gen_tempname (buf, 0, 0, GT_FILE);
+  if (fd < 0)
+    return NULL;
+
+  /* Note that this relies on the Unix semantics that
+     a file is not really removed until it is closed.  */
+  (void) unlink (buf);
+
+  if ((fp = fdopen (fd, "w+b")) == NULL)
+    {
+      int saved_errno = errno;
+      close (fd);
+      errno = saved_errno;
+    }
+
+  return fp;
+}
+
+#endif
deleted file mode 120000 (symlink)
index bfca6c7a44dca5c8fc0df935ecb2a09d08912036..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unicase/test-mapping-part1.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..562195a5197844e434e2295de68d1eadfcbe929c
--- /dev/null
@@ -0,0 +1,31 @@
+/* Test of single character case mapping functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "unicase.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+/* Pair of Unicode characters.  */
+typedef struct { ucs4_t ch; ucs4_t value; } pair_t;
+
+/* Characters and their mapping values, ignoring no-op mappings, in increasing
+   order.  */
+static const pair_t mapping[] =
+  {
deleted file mode 120000 (symlink)
index c271521b4a45e5647e9999bc1d6772bb7fec4e9d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unicase/test-mapping-part2.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ed4894820aa6d00d35ad30e08c27f2ef2a3381cf
--- /dev/null
@@ -0,0 +1,37 @@
+/* Test of single character case mapping functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+  };
+
+int
+main ()
+{
+  unsigned int c;
+  size_t i;
+
+  c = 0;
+  for (i = 0; i < SIZEOF (mapping); i++)
+    {
+      for (; c < mapping[i].ch; c++)
+        ASSERT (MAP (c) == c);
+      ASSERT (MAP (c) == mapping[i].value);
+      c++;
+    }
+  for (; c < 0x110000; c++)
+    ASSERT (MAP (c) == c);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 51adc50f15493cd617b25a173db5b68912176ad0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unicase/test-uc_tolower.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..83942037a72d1d66819ef961f79c7ccb2852252b
--- /dev/null
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character mapping functions.
+   Copyright (C) 2009-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+#include "test-mapping-part1.h"
+
+    { 0x0041, 0x0061 },
+    { 0x0042, 0x0062 },
+    { 0x0043, 0x0063 },
+    { 0x0044, 0x0064 },
+    { 0x0045, 0x0065 },
+    { 0x0046, 0x0066 },
+    { 0x0047, 0x0067 },
+    { 0x0048, 0x0068 },
+    { 0x0049, 0x0069 },
+    { 0x004A, 0x006A },
+    { 0x004B, 0x006B },
+    { 0x004C, 0x006C },
+    { 0x004D, 0x006D },
+    { 0x004E, 0x006E },
+    { 0x004F, 0x006F },
+    { 0x0050, 0x0070 },
+    { 0x0051, 0x0071 },
+    { 0x0052, 0x0072 },
+    { 0x0053, 0x0073 },
+    { 0x0054, 0x0074 },
+    { 0x0055, 0x0075 },
+    { 0x0056, 0x0076 },
+    { 0x0057, 0x0077 },
+    { 0x0058, 0x0078 },
+    { 0x0059, 0x0079 },
+    { 0x005A, 0x007A },
+    { 0x00C0, 0x00E0 },
+    { 0x00C1, 0x00E1 },
+    { 0x00C2, 0x00E2 },
+    { 0x00C3, 0x00E3 },
+    { 0x00C4, 0x00E4 },
+    { 0x00C5, 0x00E5 },
+    { 0x00C6, 0x00E6 },
+    { 0x00C7, 0x00E7 },
+    { 0x00C8, 0x00E8 },
+    { 0x00C9, 0x00E9 },
+    { 0x00CA, 0x00EA },
+    { 0x00CB, 0x00EB },
+    { 0x00CC, 0x00EC },
+    { 0x00CD, 0x00ED },
+    { 0x00CE, 0x00EE },
+    { 0x00CF, 0x00EF },
+    { 0x00D0, 0x00F0 },
+    { 0x00D1, 0x00F1 },
+    { 0x00D2, 0x00F2 },
+    { 0x00D3, 0x00F3 },
+    { 0x00D4, 0x00F4 },
+    { 0x00D5, 0x00F5 },
+    { 0x00D6, 0x00F6 },
+    { 0x00D8, 0x00F8 },
+    { 0x00D9, 0x00F9 },
+    { 0x00DA, 0x00FA },
+    { 0x00DB, 0x00FB },
+    { 0x00DC, 0x00FC },
+    { 0x00DD, 0x00FD },
+    { 0x00DE, 0x00FE },
+    { 0x0100, 0x0101 },
+    { 0x0102, 0x0103 },
+    { 0x0104, 0x0105 },
+    { 0x0106, 0x0107 },
+    { 0x0108, 0x0109 },
+    { 0x010A, 0x010B },
+    { 0x010C, 0x010D },
+    { 0x010E, 0x010F },
+    { 0x0110, 0x0111 },
+    { 0x0112, 0x0113 },
+    { 0x0114, 0x0115 },
+    { 0x0116, 0x0117 },
+    { 0x0118, 0x0119 },
+    { 0x011A, 0x011B },
+    { 0x011C, 0x011D },
+    { 0x011E, 0x011F },
+    { 0x0120, 0x0121 },
+    { 0x0122, 0x0123 },
+    { 0x0124, 0x0125 },
+    { 0x0126, 0x0127 },
+    { 0x0128, 0x0129 },
+    { 0x012A, 0x012B },
+    { 0x012C, 0x012D },
+    { 0x012E, 0x012F },
+    { 0x0130, 0x0069 },
+    { 0x0132, 0x0133 },
+    { 0x0134, 0x0135 },
+    { 0x0136, 0x0137 },
+    { 0x0139, 0x013A },
+    { 0x013B, 0x013C },
+    { 0x013D, 0x013E },
+    { 0x013F, 0x0140 },
+    { 0x0141, 0x0142 },
+    { 0x0143, 0x0144 },
+    { 0x0145, 0x0146 },
+    { 0x0147, 0x0148 },
+    { 0x014A, 0x014B },
+    { 0x014C, 0x014D },
+    { 0x014E, 0x014F },
+    { 0x0150, 0x0151 },
+    { 0x0152, 0x0153 },
+    { 0x0154, 0x0155 },
+    { 0x0156, 0x0157 },
+    { 0x0158, 0x0159 },
+    { 0x015A, 0x015B },
+    { 0x015C, 0x015D },
+    { 0x015E, 0x015F },
+    { 0x0160, 0x0161 },
+    { 0x0162, 0x0163 },
+    { 0x0164, 0x0165 },
+    { 0x0166, 0x0167 },
+    { 0x0168, 0x0169 },
+    { 0x016A, 0x016B },
+    { 0x016C, 0x016D },
+    { 0x016E, 0x016F },
+    { 0x0170, 0x0171 },
+    { 0x0172, 0x0173 },
+    { 0x0174, 0x0175 },
+    { 0x0176, 0x0177 },
+    { 0x0178, 0x00FF },
+    { 0x0179, 0x017A },
+    { 0x017B, 0x017C },
+    { 0x017D, 0x017E },
+    { 0x0181, 0x0253 },
+    { 0x0182, 0x0183 },
+    { 0x0184, 0x0185 },
+    { 0x0186, 0x0254 },
+    { 0x0187, 0x0188 },
+    { 0x0189, 0x0256 },
+    { 0x018A, 0x0257 },
+    { 0x018B, 0x018C },
+    { 0x018E, 0x01DD },
+    { 0x018F, 0x0259 },
+    { 0x0190, 0x025B },
+    { 0x0191, 0x0192 },
+    { 0x0193, 0x0260 },
+    { 0x0194, 0x0263 },
+    { 0x0196, 0x0269 },
+    { 0x0197, 0x0268 },
+    { 0x0198, 0x0199 },
+    { 0x019C, 0x026F },
+    { 0x019D, 0x0272 },
+    { 0x019F, 0x0275 },
+    { 0x01A0, 0x01A1 },
+    { 0x01A2, 0x01A3 },
+    { 0x01A4, 0x01A5 },
+    { 0x01A6, 0x0280 },
+    { 0x01A7, 0x01A8 },
+    { 0x01A9, 0x0283 },
+    { 0x01AC, 0x01AD },
+    { 0x01AE, 0x0288 },
+    { 0x01AF, 0x01B0 },
+    { 0x01B1, 0x028A },
+    { 0x01B2, 0x028B },
+    { 0x01B3, 0x01B4 },
+    { 0x01B5, 0x01B6 },
+    { 0x01B7, 0x0292 },
+    { 0x01B8, 0x01B9 },
+    { 0x01BC, 0x01BD },
+    { 0x01C4, 0x01C6 },
+    { 0x01C5, 0x01C6 },
+    { 0x01C7, 0x01C9 },
+    { 0x01C8, 0x01C9 },
+    { 0x01CA, 0x01CC },
+    { 0x01CB, 0x01CC },
+    { 0x01CD, 0x01CE },
+    { 0x01CF, 0x01D0 },
+    { 0x01D1, 0x01D2 },
+    { 0x01D3, 0x01D4 },
+    { 0x01D5, 0x01D6 },
+    { 0x01D7, 0x01D8 },
+    { 0x01D9, 0x01DA },
+    { 0x01DB, 0x01DC },
+    { 0x01DE, 0x01DF },
+    { 0x01E0, 0x01E1 },
+    { 0x01E2, 0x01E3 },
+    { 0x01E4, 0x01E5 },
+    { 0x01E6, 0x01E7 },
+    { 0x01E8, 0x01E9 },
+    { 0x01EA, 0x01EB },
+    { 0x01EC, 0x01ED },
+    { 0x01EE, 0x01EF },
+    { 0x01F1, 0x01F3 },
+    { 0x01F2, 0x01F3 },
+    { 0x01F4, 0x01F5 },
+    { 0x01F6, 0x0195 },
+    { 0x01F7, 0x01BF },
+    { 0x01F8, 0x01F9 },
+    { 0x01FA, 0x01FB },
+    { 0x01FC, 0x01FD },
+    { 0x01FE, 0x01FF },
+    { 0x0200, 0x0201 },
+    { 0x0202, 0x0203 },
+    { 0x0204, 0x0205 },
+    { 0x0206, 0x0207 },
+    { 0x0208, 0x0209 },
+    { 0x020A, 0x020B },
+    { 0x020C, 0x020D },
+    { 0x020E, 0x020F },
+    { 0x0210, 0x0211 },
+    { 0x0212, 0x0213 },
+    { 0x0214, 0x0215 },
+    { 0x0216, 0x0217 },
+    { 0x0218, 0x0219 },
+    { 0x021A, 0x021B },
+    { 0x021C, 0x021D },
+    { 0x021E, 0x021F },
+    { 0x0220, 0x019E },
+    { 0x0222, 0x0223 },
+    { 0x0224, 0x0225 },
+    { 0x0226, 0x0227 },
+    { 0x0228, 0x0229 },
+    { 0x022A, 0x022B },
+    { 0x022C, 0x022D },
+    { 0x022E, 0x022F },
+    { 0x0230, 0x0231 },
+    { 0x0232, 0x0233 },
+    { 0x023A, 0x2C65 },
+    { 0x023B, 0x023C },
+    { 0x023D, 0x019A },
+    { 0x023E, 0x2C66 },
+    { 0x0241, 0x0242 },
+    { 0x0243, 0x0180 },
+    { 0x0244, 0x0289 },
+    { 0x0245, 0x028C },
+    { 0x0246, 0x0247 },
+    { 0x0248, 0x0249 },
+    { 0x024A, 0x024B },
+    { 0x024C, 0x024D },
+    { 0x024E, 0x024F },
+    { 0x0370, 0x0371 },
+    { 0x0372, 0x0373 },
+    { 0x0376, 0x0377 },
+    { 0x037F, 0x03F3 },
+    { 0x0386, 0x03AC },
+    { 0x0388, 0x03AD },
+    { 0x0389, 0x03AE },
+    { 0x038A, 0x03AF },
+    { 0x038C, 0x03CC },
+    { 0x038E, 0x03CD },
+    { 0x038F, 0x03CE },
+    { 0x0391, 0x03B1 },
+    { 0x0392, 0x03B2 },
+    { 0x0393, 0x03B3 },
+    { 0x0394, 0x03B4 },
+    { 0x0395, 0x03B5 },
+    { 0x0396, 0x03B6 },
+    { 0x0397, 0x03B7 },
+    { 0x0398, 0x03B8 },
+    { 0x0399, 0x03B9 },
+    { 0x039A, 0x03BA },
+    { 0x039B, 0x03BB },
+    { 0x039C, 0x03BC },
+    { 0x039D, 0x03BD },
+    { 0x039E, 0x03BE },
+    { 0x039F, 0x03BF },
+    { 0x03A0, 0x03C0 },
+    { 0x03A1, 0x03C1 },
+    { 0x03A3, 0x03C3 },
+    { 0x03A4, 0x03C4 },
+    { 0x03A5, 0x03C5 },
+    { 0x03A6, 0x03C6 },
+    { 0x03A7, 0x03C7 },
+    { 0x03A8, 0x03C8 },
+    { 0x03A9, 0x03C9 },
+    { 0x03AA, 0x03CA },
+    { 0x03AB, 0x03CB },
+    { 0x03CF, 0x03D7 },
+    { 0x03D8, 0x03D9 },
+    { 0x03DA, 0x03DB },
+    { 0x03DC, 0x03DD },
+    { 0x03DE, 0x03DF },
+    { 0x03E0, 0x03E1 },
+    { 0x03E2, 0x03E3 },
+    { 0x03E4, 0x03E5 },
+    { 0x03E6, 0x03E7 },
+    { 0x03E8, 0x03E9 },
+    { 0x03EA, 0x03EB },
+    { 0x03EC, 0x03ED },
+    { 0x03EE, 0x03EF },
+    { 0x03F4, 0x03B8 },
+    { 0x03F7, 0x03F8 },
+    { 0x03F9, 0x03F2 },
+    { 0x03FA, 0x03FB },
+    { 0x03FD, 0x037B },
+    { 0x03FE, 0x037C },
+    { 0x03FF, 0x037D },
+    { 0x0400, 0x0450 },
+    { 0x0401, 0x0451 },
+    { 0x0402, 0x0452 },
+    { 0x0403, 0x0453 },
+    { 0x0404, 0x0454 },
+    { 0x0405, 0x0455 },
+    { 0x0406, 0x0456 },
+    { 0x0407, 0x0457 },
+    { 0x0408, 0x0458 },
+    { 0x0409, 0x0459 },
+    { 0x040A, 0x045A },
+    { 0x040B, 0x045B },
+    { 0x040C, 0x045C },
+    { 0x040D, 0x045D },
+    { 0x040E, 0x045E },
+    { 0x040F, 0x045F },
+    { 0x0410, 0x0430 },
+    { 0x0411, 0x0431 },
+    { 0x0412, 0x0432 },
+    { 0x0413, 0x0433 },
+    { 0x0414, 0x0434 },
+    { 0x0415, 0x0435 },
+    { 0x0416, 0x0436 },
+    { 0x0417, 0x0437 },
+    { 0x0418, 0x0438 },
+    { 0x0419, 0x0439 },
+    { 0x041A, 0x043A },
+    { 0x041B, 0x043B },
+    { 0x041C, 0x043C },
+    { 0x041D, 0x043D },
+    { 0x041E, 0x043E },
+    { 0x041F, 0x043F },
+    { 0x0420, 0x0440 },
+    { 0x0421, 0x0441 },
+    { 0x0422, 0x0442 },
+    { 0x0423, 0x0443 },
+    { 0x0424, 0x0444 },
+    { 0x0425, 0x0445 },
+    { 0x0426, 0x0446 },
+    { 0x0427, 0x0447 },
+    { 0x0428, 0x0448 },
+    { 0x0429, 0x0449 },
+    { 0x042A, 0x044A },
+    { 0x042B, 0x044B },
+    { 0x042C, 0x044C },
+    { 0x042D, 0x044D },
+    { 0x042E, 0x044E },
+    { 0x042F, 0x044F },
+    { 0x0460, 0x0461 },
+    { 0x0462, 0x0463 },
+    { 0x0464, 0x0465 },
+    { 0x0466, 0x0467 },
+    { 0x0468, 0x0469 },
+    { 0x046A, 0x046B },
+    { 0x046C, 0x046D },
+    { 0x046E, 0x046F },
+    { 0x0470, 0x0471 },
+    { 0x0472, 0x0473 },
+    { 0x0474, 0x0475 },
+    { 0x0476, 0x0477 },
+    { 0x0478, 0x0479 },
+    { 0x047A, 0x047B },
+    { 0x047C, 0x047D },
+    { 0x047E, 0x047F },
+    { 0x0480, 0x0481 },
+    { 0x048A, 0x048B },
+    { 0x048C, 0x048D },
+    { 0x048E, 0x048F },
+    { 0x0490, 0x0491 },
+    { 0x0492, 0x0493 },
+    { 0x0494, 0x0495 },
+    { 0x0496, 0x0497 },
+    { 0x0498, 0x0499 },
+    { 0x049A, 0x049B },
+    { 0x049C, 0x049D },
+    { 0x049E, 0x049F },
+    { 0x04A0, 0x04A1 },
+    { 0x04A2, 0x04A3 },
+    { 0x04A4, 0x04A5 },
+    { 0x04A6, 0x04A7 },
+    { 0x04A8, 0x04A9 },
+    { 0x04AA, 0x04AB },
+    { 0x04AC, 0x04AD },
+    { 0x04AE, 0x04AF },
+    { 0x04B0, 0x04B1 },
+    { 0x04B2, 0x04B3 },
+    { 0x04B4, 0x04B5 },
+    { 0x04B6, 0x04B7 },
+    { 0x04B8, 0x04B9 },
+    { 0x04BA, 0x04BB },
+    { 0x04BC, 0x04BD },
+    { 0x04BE, 0x04BF },
+    { 0x04C0, 0x04CF },
+    { 0x04C1, 0x04C2 },
+    { 0x04C3, 0x04C4 },
+    { 0x04C5, 0x04C6 },
+    { 0x04C7, 0x04C8 },
+    { 0x04C9, 0x04CA },
+    { 0x04CB, 0x04CC },
+    { 0x04CD, 0x04CE },
+    { 0x04D0, 0x04D1 },
+    { 0x04D2, 0x04D3 },
+    { 0x04D4, 0x04D5 },
+    { 0x04D6, 0x04D7 },
+    { 0x04D8, 0x04D9 },
+    { 0x04DA, 0x04DB },
+    { 0x04DC, 0x04DD },
+    { 0x04DE, 0x04DF },
+    { 0x04E0, 0x04E1 },
+    { 0x04E2, 0x04E3 },
+    { 0x04E4, 0x04E5 },
+    { 0x04E6, 0x04E7 },
+    { 0x04E8, 0x04E9 },
+    { 0x04EA, 0x04EB },
+    { 0x04EC, 0x04ED },
+    { 0x04EE, 0x04EF },
+    { 0x04F0, 0x04F1 },
+    { 0x04F2, 0x04F3 },
+    { 0x04F4, 0x04F5 },
+    { 0x04F6, 0x04F7 },
+    { 0x04F8, 0x04F9 },
+    { 0x04FA, 0x04FB },
+    { 0x04FC, 0x04FD },
+    { 0x04FE, 0x04FF },
+    { 0x0500, 0x0501 },
+    { 0x0502, 0x0503 },
+    { 0x0504, 0x0505 },
+    { 0x0506, 0x0507 },
+    { 0x0508, 0x0509 },
+    { 0x050A, 0x050B },
+    { 0x050C, 0x050D },
+    { 0x050E, 0x050F },
+    { 0x0510, 0x0511 },
+    { 0x0512, 0x0513 },
+    { 0x0514, 0x0515 },
+    { 0x0516, 0x0517 },
+    { 0x0518, 0x0519 },
+    { 0x051A, 0x051B },
+    { 0x051C, 0x051D },
+    { 0x051E, 0x051F },
+    { 0x0520, 0x0521 },
+    { 0x0522, 0x0523 },
+    { 0x0524, 0x0525 },
+    { 0x0526, 0x0527 },
+    { 0x0528, 0x0529 },
+    { 0x052A, 0x052B },
+    { 0x052C, 0x052D },
+    { 0x052E, 0x052F },
+    { 0x0531, 0x0561 },
+    { 0x0532, 0x0562 },
+    { 0x0533, 0x0563 },
+    { 0x0534, 0x0564 },
+    { 0x0535, 0x0565 },
+    { 0x0536, 0x0566 },
+    { 0x0537, 0x0567 },
+    { 0x0538, 0x0568 },
+    { 0x0539, 0x0569 },
+    { 0x053A, 0x056A },
+    { 0x053B, 0x056B },
+    { 0x053C, 0x056C },
+    { 0x053D, 0x056D },
+    { 0x053E, 0x056E },
+    { 0x053F, 0x056F },
+    { 0x0540, 0x0570 },
+    { 0x0541, 0x0571 },
+    { 0x0542, 0x0572 },
+    { 0x0543, 0x0573 },
+    { 0x0544, 0x0574 },
+    { 0x0545, 0x0575 },
+    { 0x0546, 0x0576 },
+    { 0x0547, 0x0577 },
+    { 0x0548, 0x0578 },
+    { 0x0549, 0x0579 },
+    { 0x054A, 0x057A },
+    { 0x054B, 0x057B },
+    { 0x054C, 0x057C },
+    { 0x054D, 0x057D },
+    { 0x054E, 0x057E },
+    { 0x054F, 0x057F },
+    { 0x0550, 0x0580 },
+    { 0x0551, 0x0581 },
+    { 0x0552, 0x0582 },
+    { 0x0553, 0x0583 },
+    { 0x0554, 0x0584 },
+    { 0x0555, 0x0585 },
+    { 0x0556, 0x0586 },
+    { 0x10A0, 0x2D00 },
+    { 0x10A1, 0x2D01 },
+    { 0x10A2, 0x2D02 },
+    { 0x10A3, 0x2D03 },
+    { 0x10A4, 0x2D04 },
+    { 0x10A5, 0x2D05 },
+    { 0x10A6, 0x2D06 },
+    { 0x10A7, 0x2D07 },
+    { 0x10A8, 0x2D08 },
+    { 0x10A9, 0x2D09 },
+    { 0x10AA, 0x2D0A },
+    { 0x10AB, 0x2D0B },
+    { 0x10AC, 0x2D0C },
+    { 0x10AD, 0x2D0D },
+    { 0x10AE, 0x2D0E },
+    { 0x10AF, 0x2D0F },
+    { 0x10B0, 0x2D10 },
+    { 0x10B1, 0x2D11 },
+    { 0x10B2, 0x2D12 },
+    { 0x10B3, 0x2D13 },
+    { 0x10B4, 0x2D14 },
+    { 0x10B5, 0x2D15 },
+    { 0x10B6, 0x2D16 },
+    { 0x10B7, 0x2D17 },
+    { 0x10B8, 0x2D18 },
+    { 0x10B9, 0x2D19 },
+    { 0x10BA, 0x2D1A },
+    { 0x10BB, 0x2D1B },
+    { 0x10BC, 0x2D1C },
+    { 0x10BD, 0x2D1D },
+    { 0x10BE, 0x2D1E },
+    { 0x10BF, 0x2D1F },
+    { 0x10C0, 0x2D20 },
+    { 0x10C1, 0x2D21 },
+    { 0x10C2, 0x2D22 },
+    { 0x10C3, 0x2D23 },
+    { 0x10C4, 0x2D24 },
+    { 0x10C5, 0x2D25 },
+    { 0x10C7, 0x2D27 },
+    { 0x10CD, 0x2D2D },
+    { 0x13A0, 0xAB70 },
+    { 0x13A1, 0xAB71 },
+    { 0x13A2, 0xAB72 },
+    { 0x13A3, 0xAB73 },
+    { 0x13A4, 0xAB74 },
+    { 0x13A5, 0xAB75 },
+    { 0x13A6, 0xAB76 },
+    { 0x13A7, 0xAB77 },
+    { 0x13A8, 0xAB78 },
+    { 0x13A9, 0xAB79 },
+    { 0x13AA, 0xAB7A },
+    { 0x13AB, 0xAB7B },
+    { 0x13AC, 0xAB7C },
+    { 0x13AD, 0xAB7D },
+    { 0x13AE, 0xAB7E },
+    { 0x13AF, 0xAB7F },
+    { 0x13B0, 0xAB80 },
+    { 0x13B1, 0xAB81 },
+    { 0x13B2, 0xAB82 },
+    { 0x13B3, 0xAB83 },
+    { 0x13B4, 0xAB84 },
+    { 0x13B5, 0xAB85 },
+    { 0x13B6, 0xAB86 },
+    { 0x13B7, 0xAB87 },
+    { 0x13B8, 0xAB88 },
+    { 0x13B9, 0xAB89 },
+    { 0x13BA, 0xAB8A },
+    { 0x13BB, 0xAB8B },
+    { 0x13BC, 0xAB8C },
+    { 0x13BD, 0xAB8D },
+    { 0x13BE, 0xAB8E },
+    { 0x13BF, 0xAB8F },
+    { 0x13C0, 0xAB90 },
+    { 0x13C1, 0xAB91 },
+    { 0x13C2, 0xAB92 },
+    { 0x13C3, 0xAB93 },
+    { 0x13C4, 0xAB94 },
+    { 0x13C5, 0xAB95 },
+    { 0x13C6, 0xAB96 },
+    { 0x13C7, 0xAB97 },
+    { 0x13C8, 0xAB98 },
+    { 0x13C9, 0xAB99 },
+    { 0x13CA, 0xAB9A },
+    { 0x13CB, 0xAB9B },
+    { 0x13CC, 0xAB9C },
+    { 0x13CD, 0xAB9D },
+    { 0x13CE, 0xAB9E },
+    { 0x13CF, 0xAB9F },
+    { 0x13D0, 0xABA0 },
+    { 0x13D1, 0xABA1 },
+    { 0x13D2, 0xABA2 },
+    { 0x13D3, 0xABA3 },
+    { 0x13D4, 0xABA4 },
+    { 0x13D5, 0xABA5 },
+    { 0x13D6, 0xABA6 },
+    { 0x13D7, 0xABA7 },
+    { 0x13D8, 0xABA8 },
+    { 0x13D9, 0xABA9 },
+    { 0x13DA, 0xABAA },
+    { 0x13DB, 0xABAB },
+    { 0x13DC, 0xABAC },
+    { 0x13DD, 0xABAD },
+    { 0x13DE, 0xABAE },
+    { 0x13DF, 0xABAF },
+    { 0x13E0, 0xABB0 },
+    { 0x13E1, 0xABB1 },
+    { 0x13E2, 0xABB2 },
+    { 0x13E3, 0xABB3 },
+    { 0x13E4, 0xABB4 },
+    { 0x13E5, 0xABB5 },
+    { 0x13E6, 0xABB6 },
+    { 0x13E7, 0xABB7 },
+    { 0x13E8, 0xABB8 },
+    { 0x13E9, 0xABB9 },
+    { 0x13EA, 0xABBA },
+    { 0x13EB, 0xABBB },
+    { 0x13EC, 0xABBC },
+    { 0x13ED, 0xABBD },
+    { 0x13EE, 0xABBE },
+    { 0x13EF, 0xABBF },
+    { 0x13F0, 0x13F8 },
+    { 0x13F1, 0x13F9 },
+    { 0x13F2, 0x13FA },
+    { 0x13F3, 0x13FB },
+    { 0x13F4, 0x13FC },
+    { 0x13F5, 0x13FD },
+    { 0x1C90, 0x10D0 },
+    { 0x1C91, 0x10D1 },
+    { 0x1C92, 0x10D2 },
+    { 0x1C93, 0x10D3 },
+    { 0x1C94, 0x10D4 },
+    { 0x1C95, 0x10D5 },
+    { 0x1C96, 0x10D6 },
+    { 0x1C97, 0x10D7 },
+    { 0x1C98, 0x10D8 },
+    { 0x1C99, 0x10D9 },
+    { 0x1C9A, 0x10DA },
+    { 0x1C9B, 0x10DB },
+    { 0x1C9C, 0x10DC },
+    { 0x1C9D, 0x10DD },
+    { 0x1C9E, 0x10DE },
+    { 0x1C9F, 0x10DF },
+    { 0x1CA0, 0x10E0 },
+    { 0x1CA1, 0x10E1 },
+    { 0x1CA2, 0x10E2 },
+    { 0x1CA3, 0x10E3 },
+    { 0x1CA4, 0x10E4 },
+    { 0x1CA5, 0x10E5 },
+    { 0x1CA6, 0x10E6 },
+    { 0x1CA7, 0x10E7 },
+    { 0x1CA8, 0x10E8 },
+    { 0x1CA9, 0x10E9 },
+    { 0x1CAA, 0x10EA },
+    { 0x1CAB, 0x10EB },
+    { 0x1CAC, 0x10EC },
+    { 0x1CAD, 0x10ED },
+    { 0x1CAE, 0x10EE },
+    { 0x1CAF, 0x10EF },
+    { 0x1CB0, 0x10F0 },
+    { 0x1CB1, 0x10F1 },
+    { 0x1CB2, 0x10F2 },
+    { 0x1CB3, 0x10F3 },
+    { 0x1CB4, 0x10F4 },
+    { 0x1CB5, 0x10F5 },
+    { 0x1CB6, 0x10F6 },
+    { 0x1CB7, 0x10F7 },
+    { 0x1CB8, 0x10F8 },
+    { 0x1CB9, 0x10F9 },
+    { 0x1CBA, 0x10FA },
+    { 0x1CBD, 0x10FD },
+    { 0x1CBE, 0x10FE },
+    { 0x1CBF, 0x10FF },
+    { 0x1E00, 0x1E01 },
+    { 0x1E02, 0x1E03 },
+    { 0x1E04, 0x1E05 },
+    { 0x1E06, 0x1E07 },
+    { 0x1E08, 0x1E09 },
+    { 0x1E0A, 0x1E0B },
+    { 0x1E0C, 0x1E0D },
+    { 0x1E0E, 0x1E0F },
+    { 0x1E10, 0x1E11 },
+    { 0x1E12, 0x1E13 },
+    { 0x1E14, 0x1E15 },
+    { 0x1E16, 0x1E17 },
+    { 0x1E18, 0x1E19 },
+    { 0x1E1A, 0x1E1B },
+    { 0x1E1C, 0x1E1D },
+    { 0x1E1E, 0x1E1F },
+    { 0x1E20, 0x1E21 },
+    { 0x1E22, 0x1E23 },
+    { 0x1E24, 0x1E25 },
+    { 0x1E26, 0x1E27 },
+    { 0x1E28, 0x1E29 },
+    { 0x1E2A, 0x1E2B },
+    { 0x1E2C, 0x1E2D },
+    { 0x1E2E, 0x1E2F },
+    { 0x1E30, 0x1E31 },
+    { 0x1E32, 0x1E33 },
+    { 0x1E34, 0x1E35 },
+    { 0x1E36, 0x1E37 },
+    { 0x1E38, 0x1E39 },
+    { 0x1E3A, 0x1E3B },
+    { 0x1E3C, 0x1E3D },
+    { 0x1E3E, 0x1E3F },
+    { 0x1E40, 0x1E41 },
+    { 0x1E42, 0x1E43 },
+    { 0x1E44, 0x1E45 },
+    { 0x1E46, 0x1E47 },
+    { 0x1E48, 0x1E49 },
+    { 0x1E4A, 0x1E4B },
+    { 0x1E4C, 0x1E4D },
+    { 0x1E4E, 0x1E4F },
+    { 0x1E50, 0x1E51 },
+    { 0x1E52, 0x1E53 },
+    { 0x1E54, 0x1E55 },
+    { 0x1E56, 0x1E57 },
+    { 0x1E58, 0x1E59 },
+    { 0x1E5A, 0x1E5B },
+    { 0x1E5C, 0x1E5D },
+    { 0x1E5E, 0x1E5F },
+    { 0x1E60, 0x1E61 },
+    { 0x1E62, 0x1E63 },
+    { 0x1E64, 0x1E65 },
+    { 0x1E66, 0x1E67 },
+    { 0x1E68, 0x1E69 },
+    { 0x1E6A, 0x1E6B },
+    { 0x1E6C, 0x1E6D },
+    { 0x1E6E, 0x1E6F },
+    { 0x1E70, 0x1E71 },
+    { 0x1E72, 0x1E73 },
+    { 0x1E74, 0x1E75 },
+    { 0x1E76, 0x1E77 },
+    { 0x1E78, 0x1E79 },
+    { 0x1E7A, 0x1E7B },
+    { 0x1E7C, 0x1E7D },
+    { 0x1E7E, 0x1E7F },
+    { 0x1E80, 0x1E81 },
+    { 0x1E82, 0x1E83 },
+    { 0x1E84, 0x1E85 },
+    { 0x1E86, 0x1E87 },
+    { 0x1E88, 0x1E89 },
+    { 0x1E8A, 0x1E8B },
+    { 0x1E8C, 0x1E8D },
+    { 0x1E8E, 0x1E8F },
+    { 0x1E90, 0x1E91 },
+    { 0x1E92, 0x1E93 },
+    { 0x1E94, 0x1E95 },
+    { 0x1E9E, 0x00DF },
+    { 0x1EA0, 0x1EA1 },
+    { 0x1EA2, 0x1EA3 },
+    { 0x1EA4, 0x1EA5 },
+    { 0x1EA6, 0x1EA7 },
+    { 0x1EA8, 0x1EA9 },
+    { 0x1EAA, 0x1EAB },
+    { 0x1EAC, 0x1EAD },
+    { 0x1EAE, 0x1EAF },
+    { 0x1EB0, 0x1EB1 },
+    { 0x1EB2, 0x1EB3 },
+    { 0x1EB4, 0x1EB5 },
+    { 0x1EB6, 0x1EB7 },
+    { 0x1EB8, 0x1EB9 },
+    { 0x1EBA, 0x1EBB },
+    { 0x1EBC, 0x1EBD },
+    { 0x1EBE, 0x1EBF },
+    { 0x1EC0, 0x1EC1 },
+    { 0x1EC2, 0x1EC3 },
+    { 0x1EC4, 0x1EC5 },
+    { 0x1EC6, 0x1EC7 },
+    { 0x1EC8, 0x1EC9 },
+    { 0x1ECA, 0x1ECB },
+    { 0x1ECC, 0x1ECD },
+    { 0x1ECE, 0x1ECF },
+    { 0x1ED0, 0x1ED1 },
+    { 0x1ED2, 0x1ED3 },
+    { 0x1ED4, 0x1ED5 },
+    { 0x1ED6, 0x1ED7 },
+    { 0x1ED8, 0x1ED9 },
+    { 0x1EDA, 0x1EDB },
+    { 0x1EDC, 0x1EDD },
+    { 0x1EDE, 0x1EDF },
+    { 0x1EE0, 0x1EE1 },
+    { 0x1EE2, 0x1EE3 },
+    { 0x1EE4, 0x1EE5 },
+    { 0x1EE6, 0x1EE7 },
+    { 0x1EE8, 0x1EE9 },
+    { 0x1EEA, 0x1EEB },
+    { 0x1EEC, 0x1EED },
+    { 0x1EEE, 0x1EEF },
+    { 0x1EF0, 0x1EF1 },
+    { 0x1EF2, 0x1EF3 },
+    { 0x1EF4, 0x1EF5 },
+    { 0x1EF6, 0x1EF7 },
+    { 0x1EF8, 0x1EF9 },
+    { 0x1EFA, 0x1EFB },
+    { 0x1EFC, 0x1EFD },
+    { 0x1EFE, 0x1EFF },
+    { 0x1F08, 0x1F00 },
+    { 0x1F09, 0x1F01 },
+    { 0x1F0A, 0x1F02 },
+    { 0x1F0B, 0x1F03 },
+    { 0x1F0C, 0x1F04 },
+    { 0x1F0D, 0x1F05 },
+    { 0x1F0E, 0x1F06 },
+    { 0x1F0F, 0x1F07 },
+    { 0x1F18, 0x1F10 },
+    { 0x1F19, 0x1F11 },
+    { 0x1F1A, 0x1F12 },
+    { 0x1F1B, 0x1F13 },
+    { 0x1F1C, 0x1F14 },
+    { 0x1F1D, 0x1F15 },
+    { 0x1F28, 0x1F20 },
+    { 0x1F29, 0x1F21 },
+    { 0x1F2A, 0x1F22 },
+    { 0x1F2B, 0x1F23 },
+    { 0x1F2C, 0x1F24 },
+    { 0x1F2D, 0x1F25 },
+    { 0x1F2E, 0x1F26 },
+    { 0x1F2F, 0x1F27 },
+    { 0x1F38, 0x1F30 },
+    { 0x1F39, 0x1F31 },
+    { 0x1F3A, 0x1F32 },
+    { 0x1F3B, 0x1F33 },
+    { 0x1F3C, 0x1F34 },
+    { 0x1F3D, 0x1F35 },
+    { 0x1F3E, 0x1F36 },
+    { 0x1F3F, 0x1F37 },
+    { 0x1F48, 0x1F40 },
+    { 0x1F49, 0x1F41 },
+    { 0x1F4A, 0x1F42 },
+    { 0x1F4B, 0x1F43 },
+    { 0x1F4C, 0x1F44 },
+    { 0x1F4D, 0x1F45 },
+    { 0x1F59, 0x1F51 },
+    { 0x1F5B, 0x1F53 },
+    { 0x1F5D, 0x1F55 },
+    { 0x1F5F, 0x1F57 },
+    { 0x1F68, 0x1F60 },
+    { 0x1F69, 0x1F61 },
+    { 0x1F6A, 0x1F62 },
+    { 0x1F6B, 0x1F63 },
+    { 0x1F6C, 0x1F64 },
+    { 0x1F6D, 0x1F65 },
+    { 0x1F6E, 0x1F66 },
+    { 0x1F6F, 0x1F67 },
+    { 0x1F88, 0x1F80 },
+    { 0x1F89, 0x1F81 },
+    { 0x1F8A, 0x1F82 },
+    { 0x1F8B, 0x1F83 },
+    { 0x1F8C, 0x1F84 },
+    { 0x1F8D, 0x1F85 },
+    { 0x1F8E, 0x1F86 },
+    { 0x1F8F, 0x1F87 },
+    { 0x1F98, 0x1F90 },
+    { 0x1F99, 0x1F91 },
+    { 0x1F9A, 0x1F92 },
+    { 0x1F9B, 0x1F93 },
+    { 0x1F9C, 0x1F94 },
+    { 0x1F9D, 0x1F95 },
+    { 0x1F9E, 0x1F96 },
+    { 0x1F9F, 0x1F97 },
+    { 0x1FA8, 0x1FA0 },
+    { 0x1FA9, 0x1FA1 },
+    { 0x1FAA, 0x1FA2 },
+    { 0x1FAB, 0x1FA3 },
+    { 0x1FAC, 0x1FA4 },
+    { 0x1FAD, 0x1FA5 },
+    { 0x1FAE, 0x1FA6 },
+    { 0x1FAF, 0x1FA7 },
+    { 0x1FB8, 0x1FB0 },
+    { 0x1FB9, 0x1FB1 },
+    { 0x1FBA, 0x1F70 },
+    { 0x1FBB, 0x1F71 },
+    { 0x1FBC, 0x1FB3 },
+    { 0x1FC8, 0x1F72 },
+    { 0x1FC9, 0x1F73 },
+    { 0x1FCA, 0x1F74 },
+    { 0x1FCB, 0x1F75 },
+    { 0x1FCC, 0x1FC3 },
+    { 0x1FD8, 0x1FD0 },
+    { 0x1FD9, 0x1FD1 },
+    { 0x1FDA, 0x1F76 },
+    { 0x1FDB, 0x1F77 },
+    { 0x1FE8, 0x1FE0 },
+    { 0x1FE9, 0x1FE1 },
+    { 0x1FEA, 0x1F7A },
+    { 0x1FEB, 0x1F7B },
+    { 0x1FEC, 0x1FE5 },
+    { 0x1FF8, 0x1F78 },
+    { 0x1FF9, 0x1F79 },
+    { 0x1FFA, 0x1F7C },
+    { 0x1FFB, 0x1F7D },
+    { 0x1FFC, 0x1FF3 },
+    { 0x2126, 0x03C9 },
+    { 0x212A, 0x006B },
+    { 0x212B, 0x00E5 },
+    { 0x2132, 0x214E },
+    { 0x2160, 0x2170 },
+    { 0x2161, 0x2171 },
+    { 0x2162, 0x2172 },
+    { 0x2163, 0x2173 },
+    { 0x2164, 0x2174 },
+    { 0x2165, 0x2175 },
+    { 0x2166, 0x2176 },
+    { 0x2167, 0x2177 },
+    { 0x2168, 0x2178 },
+    { 0x2169, 0x2179 },
+    { 0x216A, 0x217A },
+    { 0x216B, 0x217B },
+    { 0x216C, 0x217C },
+    { 0x216D, 0x217D },
+    { 0x216E, 0x217E },
+    { 0x216F, 0x217F },
+    { 0x2183, 0x2184 },
+    { 0x24B6, 0x24D0 },
+    { 0x24B7, 0x24D1 },
+    { 0x24B8, 0x24D2 },
+    { 0x24B9, 0x24D3 },
+    { 0x24BA, 0x24D4 },
+    { 0x24BB, 0x24D5 },
+    { 0x24BC, 0x24D6 },
+    { 0x24BD, 0x24D7 },
+    { 0x24BE, 0x24D8 },
+    { 0x24BF, 0x24D9 },
+    { 0x24C0, 0x24DA },
+    { 0x24C1, 0x24DB },
+    { 0x24C2, 0x24DC },
+    { 0x24C3, 0x24DD },
+    { 0x24C4, 0x24DE },
+    { 0x24C5, 0x24DF },
+    { 0x24C6, 0x24E0 },
+    { 0x24C7, 0x24E1 },
+    { 0x24C8, 0x24E2 },
+    { 0x24C9, 0x24E3 },
+    { 0x24CA, 0x24E4 },
+    { 0x24CB, 0x24E5 },
+    { 0x24CC, 0x24E6 },
+    { 0x24CD, 0x24E7 },
+    { 0x24CE, 0x24E8 },
+    { 0x24CF, 0x24E9 },
+    { 0x2C00, 0x2C30 },
+    { 0x2C01, 0x2C31 },
+    { 0x2C02, 0x2C32 },
+    { 0x2C03, 0x2C33 },
+    { 0x2C04, 0x2C34 },
+    { 0x2C05, 0x2C35 },
+    { 0x2C06, 0x2C36 },
+    { 0x2C07, 0x2C37 },
+    { 0x2C08, 0x2C38 },
+    { 0x2C09, 0x2C39 },
+    { 0x2C0A, 0x2C3A },
+    { 0x2C0B, 0x2C3B },
+    { 0x2C0C, 0x2C3C },
+    { 0x2C0D, 0x2C3D },
+    { 0x2C0E, 0x2C3E },
+    { 0x2C0F, 0x2C3F },
+    { 0x2C10, 0x2C40 },
+    { 0x2C11, 0x2C41 },
+    { 0x2C12, 0x2C42 },
+    { 0x2C13, 0x2C43 },
+    { 0x2C14, 0x2C44 },
+    { 0x2C15, 0x2C45 },
+    { 0x2C16, 0x2C46 },
+    { 0x2C17, 0x2C47 },
+    { 0x2C18, 0x2C48 },
+    { 0x2C19, 0x2C49 },
+    { 0x2C1A, 0x2C4A },
+    { 0x2C1B, 0x2C4B },
+    { 0x2C1C, 0x2C4C },
+    { 0x2C1D, 0x2C4D },
+    { 0x2C1E, 0x2C4E },
+    { 0x2C1F, 0x2C4F },
+    { 0x2C20, 0x2C50 },
+    { 0x2C21, 0x2C51 },
+    { 0x2C22, 0x2C52 },
+    { 0x2C23, 0x2C53 },
+    { 0x2C24, 0x2C54 },
+    { 0x2C25, 0x2C55 },
+    { 0x2C26, 0x2C56 },
+    { 0x2C27, 0x2C57 },
+    { 0x2C28, 0x2C58 },
+    { 0x2C29, 0x2C59 },
+    { 0x2C2A, 0x2C5A },
+    { 0x2C2B, 0x2C5B },
+    { 0x2C2C, 0x2C5C },
+    { 0x2C2D, 0x2C5D },
+    { 0x2C2E, 0x2C5E },
+    { 0x2C2F, 0x2C5F },
+    { 0x2C60, 0x2C61 },
+    { 0x2C62, 0x026B },
+    { 0x2C63, 0x1D7D },
+    { 0x2C64, 0x027D },
+    { 0x2C67, 0x2C68 },
+    { 0x2C69, 0x2C6A },
+    { 0x2C6B, 0x2C6C },
+    { 0x2C6D, 0x0251 },
+    { 0x2C6E, 0x0271 },
+    { 0x2C6F, 0x0250 },
+    { 0x2C70, 0x0252 },
+    { 0x2C72, 0x2C73 },
+    { 0x2C75, 0x2C76 },
+    { 0x2C7E, 0x023F },
+    { 0x2C7F, 0x0240 },
+    { 0x2C80, 0x2C81 },
+    { 0x2C82, 0x2C83 },
+    { 0x2C84, 0x2C85 },
+    { 0x2C86, 0x2C87 },
+    { 0x2C88, 0x2C89 },
+    { 0x2C8A, 0x2C8B },
+    { 0x2C8C, 0x2C8D },
+    { 0x2C8E, 0x2C8F },
+    { 0x2C90, 0x2C91 },
+    { 0x2C92, 0x2C93 },
+    { 0x2C94, 0x2C95 },
+    { 0x2C96, 0x2C97 },
+    { 0x2C98, 0x2C99 },
+    { 0x2C9A, 0x2C9B },
+    { 0x2C9C, 0x2C9D },
+    { 0x2C9E, 0x2C9F },
+    { 0x2CA0, 0x2CA1 },
+    { 0x2CA2, 0x2CA3 },
+    { 0x2CA4, 0x2CA5 },
+    { 0x2CA6, 0x2CA7 },
+    { 0x2CA8, 0x2CA9 },
+    { 0x2CAA, 0x2CAB },
+    { 0x2CAC, 0x2CAD },
+    { 0x2CAE, 0x2CAF },
+    { 0x2CB0, 0x2CB1 },
+    { 0x2CB2, 0x2CB3 },
+    { 0x2CB4, 0x2CB5 },
+    { 0x2CB6, 0x2CB7 },
+    { 0x2CB8, 0x2CB9 },
+    { 0x2CBA, 0x2CBB },
+    { 0x2CBC, 0x2CBD },
+    { 0x2CBE, 0x2CBF },
+    { 0x2CC0, 0x2CC1 },
+    { 0x2CC2, 0x2CC3 },
+    { 0x2CC4, 0x2CC5 },
+    { 0x2CC6, 0x2CC7 },
+    { 0x2CC8, 0x2CC9 },
+    { 0x2CCA, 0x2CCB },
+    { 0x2CCC, 0x2CCD },
+    { 0x2CCE, 0x2CCF },
+    { 0x2CD0, 0x2CD1 },
+    { 0x2CD2, 0x2CD3 },
+    { 0x2CD4, 0x2CD5 },
+    { 0x2CD6, 0x2CD7 },
+    { 0x2CD8, 0x2CD9 },
+    { 0x2CDA, 0x2CDB },
+    { 0x2CDC, 0x2CDD },
+    { 0x2CDE, 0x2CDF },
+    { 0x2CE0, 0x2CE1 },
+    { 0x2CE2, 0x2CE3 },
+    { 0x2CEB, 0x2CEC },
+    { 0x2CED, 0x2CEE },
+    { 0x2CF2, 0x2CF3 },
+    { 0xA640, 0xA641 },
+    { 0xA642, 0xA643 },
+    { 0xA644, 0xA645 },
+    { 0xA646, 0xA647 },
+    { 0xA648, 0xA649 },
+    { 0xA64A, 0xA64B },
+    { 0xA64C, 0xA64D },
+    { 0xA64E, 0xA64F },
+    { 0xA650, 0xA651 },
+    { 0xA652, 0xA653 },
+    { 0xA654, 0xA655 },
+    { 0xA656, 0xA657 },
+    { 0xA658, 0xA659 },
+    { 0xA65A, 0xA65B },
+    { 0xA65C, 0xA65D },
+    { 0xA65E, 0xA65F },
+    { 0xA660, 0xA661 },
+    { 0xA662, 0xA663 },
+    { 0xA664, 0xA665 },
+    { 0xA666, 0xA667 },
+    { 0xA668, 0xA669 },
+    { 0xA66A, 0xA66B },
+    { 0xA66C, 0xA66D },
+    { 0xA680, 0xA681 },
+    { 0xA682, 0xA683 },
+    { 0xA684, 0xA685 },
+    { 0xA686, 0xA687 },
+    { 0xA688, 0xA689 },
+    { 0xA68A, 0xA68B },
+    { 0xA68C, 0xA68D },
+    { 0xA68E, 0xA68F },
+    { 0xA690, 0xA691 },
+    { 0xA692, 0xA693 },
+    { 0xA694, 0xA695 },
+    { 0xA696, 0xA697 },
+    { 0xA698, 0xA699 },
+    { 0xA69A, 0xA69B },
+    { 0xA722, 0xA723 },
+    { 0xA724, 0xA725 },
+    { 0xA726, 0xA727 },
+    { 0xA728, 0xA729 },
+    { 0xA72A, 0xA72B },
+    { 0xA72C, 0xA72D },
+    { 0xA72E, 0xA72F },
+    { 0xA732, 0xA733 },
+    { 0xA734, 0xA735 },
+    { 0xA736, 0xA737 },
+    { 0xA738, 0xA739 },
+    { 0xA73A, 0xA73B },
+    { 0xA73C, 0xA73D },
+    { 0xA73E, 0xA73F },
+    { 0xA740, 0xA741 },
+    { 0xA742, 0xA743 },
+    { 0xA744, 0xA745 },
+    { 0xA746, 0xA747 },
+    { 0xA748, 0xA749 },
+    { 0xA74A, 0xA74B },
+    { 0xA74C, 0xA74D },
+    { 0xA74E, 0xA74F },
+    { 0xA750, 0xA751 },
+    { 0xA752, 0xA753 },
+    { 0xA754, 0xA755 },
+    { 0xA756, 0xA757 },
+    { 0xA758, 0xA759 },
+    { 0xA75A, 0xA75B },
+    { 0xA75C, 0xA75D },
+    { 0xA75E, 0xA75F },
+    { 0xA760, 0xA761 },
+    { 0xA762, 0xA763 },
+    { 0xA764, 0xA765 },
+    { 0xA766, 0xA767 },
+    { 0xA768, 0xA769 },
+    { 0xA76A, 0xA76B },
+    { 0xA76C, 0xA76D },
+    { 0xA76E, 0xA76F },
+    { 0xA779, 0xA77A },
+    { 0xA77B, 0xA77C },
+    { 0xA77D, 0x1D79 },
+    { 0xA77E, 0xA77F },
+    { 0xA780, 0xA781 },
+    { 0xA782, 0xA783 },
+    { 0xA784, 0xA785 },
+    { 0xA786, 0xA787 },
+    { 0xA78B, 0xA78C },
+    { 0xA78D, 0x0265 },
+    { 0xA790, 0xA791 },
+    { 0xA792, 0xA793 },
+    { 0xA796, 0xA797 },
+    { 0xA798, 0xA799 },
+    { 0xA79A, 0xA79B },
+    { 0xA79C, 0xA79D },
+    { 0xA79E, 0xA79F },
+    { 0xA7A0, 0xA7A1 },
+    { 0xA7A2, 0xA7A3 },
+    { 0xA7A4, 0xA7A5 },
+    { 0xA7A6, 0xA7A7 },
+    { 0xA7A8, 0xA7A9 },
+    { 0xA7AA, 0x0266 },
+    { 0xA7AB, 0x025C },
+    { 0xA7AC, 0x0261 },
+    { 0xA7AD, 0x026C },
+    { 0xA7AE, 0x026A },
+    { 0xA7B0, 0x029E },
+    { 0xA7B1, 0x0287 },
+    { 0xA7B2, 0x029D },
+    { 0xA7B3, 0xAB53 },
+    { 0xA7B4, 0xA7B5 },
+    { 0xA7B6, 0xA7B7 },
+    { 0xA7B8, 0xA7B9 },
+    { 0xA7BA, 0xA7BB },
+    { 0xA7BC, 0xA7BD },
+    { 0xA7BE, 0xA7BF },
+    { 0xA7C0, 0xA7C1 },
+    { 0xA7C2, 0xA7C3 },
+    { 0xA7C4, 0xA794 },
+    { 0xA7C5, 0x0282 },
+    { 0xA7C6, 0x1D8E },
+    { 0xA7C7, 0xA7C8 },
+    { 0xA7C9, 0xA7CA },
+    { 0xA7D0, 0xA7D1 },
+    { 0xA7D6, 0xA7D7 },
+    { 0xA7D8, 0xA7D9 },
+    { 0xA7F5, 0xA7F6 },
+    { 0xFF21, 0xFF41 },
+    { 0xFF22, 0xFF42 },
+    { 0xFF23, 0xFF43 },
+    { 0xFF24, 0xFF44 },
+    { 0xFF25, 0xFF45 },
+    { 0xFF26, 0xFF46 },
+    { 0xFF27, 0xFF47 },
+    { 0xFF28, 0xFF48 },
+    { 0xFF29, 0xFF49 },
+    { 0xFF2A, 0xFF4A },
+    { 0xFF2B, 0xFF4B },
+    { 0xFF2C, 0xFF4C },
+    { 0xFF2D, 0xFF4D },
+    { 0xFF2E, 0xFF4E },
+    { 0xFF2F, 0xFF4F },
+    { 0xFF30, 0xFF50 },
+    { 0xFF31, 0xFF51 },
+    { 0xFF32, 0xFF52 },
+    { 0xFF33, 0xFF53 },
+    { 0xFF34, 0xFF54 },
+    { 0xFF35, 0xFF55 },
+    { 0xFF36, 0xFF56 },
+    { 0xFF37, 0xFF57 },
+    { 0xFF38, 0xFF58 },
+    { 0xFF39, 0xFF59 },
+    { 0xFF3A, 0xFF5A },
+    { 0x10400, 0x10428 },
+    { 0x10401, 0x10429 },
+    { 0x10402, 0x1042A },
+    { 0x10403, 0x1042B },
+    { 0x10404, 0x1042C },
+    { 0x10405, 0x1042D },
+    { 0x10406, 0x1042E },
+    { 0x10407, 0x1042F },
+    { 0x10408, 0x10430 },
+    { 0x10409, 0x10431 },
+    { 0x1040A, 0x10432 },
+    { 0x1040B, 0x10433 },
+    { 0x1040C, 0x10434 },
+    { 0x1040D, 0x10435 },
+    { 0x1040E, 0x10436 },
+    { 0x1040F, 0x10437 },
+    { 0x10410, 0x10438 },
+    { 0x10411, 0x10439 },
+    { 0x10412, 0x1043A },
+    { 0x10413, 0x1043B },
+    { 0x10414, 0x1043C },
+    { 0x10415, 0x1043D },
+    { 0x10416, 0x1043E },
+    { 0x10417, 0x1043F },
+    { 0x10418, 0x10440 },
+    { 0x10419, 0x10441 },
+    { 0x1041A, 0x10442 },
+    { 0x1041B, 0x10443 },
+    { 0x1041C, 0x10444 },
+    { 0x1041D, 0x10445 },
+    { 0x1041E, 0x10446 },
+    { 0x1041F, 0x10447 },
+    { 0x10420, 0x10448 },
+    { 0x10421, 0x10449 },
+    { 0x10422, 0x1044A },
+    { 0x10423, 0x1044B },
+    { 0x10424, 0x1044C },
+    { 0x10425, 0x1044D },
+    { 0x10426, 0x1044E },
+    { 0x10427, 0x1044F },
+    { 0x104B0, 0x104D8 },
+    { 0x104B1, 0x104D9 },
+    { 0x104B2, 0x104DA },
+    { 0x104B3, 0x104DB },
+    { 0x104B4, 0x104DC },
+    { 0x104B5, 0x104DD },
+    { 0x104B6, 0x104DE },
+    { 0x104B7, 0x104DF },
+    { 0x104B8, 0x104E0 },
+    { 0x104B9, 0x104E1 },
+    { 0x104BA, 0x104E2 },
+    { 0x104BB, 0x104E3 },
+    { 0x104BC, 0x104E4 },
+    { 0x104BD, 0x104E5 },
+    { 0x104BE, 0x104E6 },
+    { 0x104BF, 0x104E7 },
+    { 0x104C0, 0x104E8 },
+    { 0x104C1, 0x104E9 },
+    { 0x104C2, 0x104EA },
+    { 0x104C3, 0x104EB },
+    { 0x104C4, 0x104EC },
+    { 0x104C5, 0x104ED },
+    { 0x104C6, 0x104EE },
+    { 0x104C7, 0x104EF },
+    { 0x104C8, 0x104F0 },
+    { 0x104C9, 0x104F1 },
+    { 0x104CA, 0x104F2 },
+    { 0x104CB, 0x104F3 },
+    { 0x104CC, 0x104F4 },
+    { 0x104CD, 0x104F5 },
+    { 0x104CE, 0x104F6 },
+    { 0x104CF, 0x104F7 },
+    { 0x104D0, 0x104F8 },
+    { 0x104D1, 0x104F9 },
+    { 0x104D2, 0x104FA },
+    { 0x104D3, 0x104FB },
+    { 0x10570, 0x10597 },
+    { 0x10571, 0x10598 },
+    { 0x10572, 0x10599 },
+    { 0x10573, 0x1059A },
+    { 0x10574, 0x1059B },
+    { 0x10575, 0x1059C },
+    { 0x10576, 0x1059D },
+    { 0x10577, 0x1059E },
+    { 0x10578, 0x1059F },
+    { 0x10579, 0x105A0 },
+    { 0x1057A, 0x105A1 },
+    { 0x1057C, 0x105A3 },
+    { 0x1057D, 0x105A4 },
+    { 0x1057E, 0x105A5 },
+    { 0x1057F, 0x105A6 },
+    { 0x10580, 0x105A7 },
+    { 0x10581, 0x105A8 },
+    { 0x10582, 0x105A9 },
+    { 0x10583, 0x105AA },
+    { 0x10584, 0x105AB },
+    { 0x10585, 0x105AC },
+    { 0x10586, 0x105AD },
+    { 0x10587, 0x105AE },
+    { 0x10588, 0x105AF },
+    { 0x10589, 0x105B0 },
+    { 0x1058A, 0x105B1 },
+    { 0x1058C, 0x105B3 },
+    { 0x1058D, 0x105B4 },
+    { 0x1058E, 0x105B5 },
+    { 0x1058F, 0x105B6 },
+    { 0x10590, 0x105B7 },
+    { 0x10591, 0x105B8 },
+    { 0x10592, 0x105B9 },
+    { 0x10594, 0x105BB },
+    { 0x10595, 0x105BC },
+    { 0x10C80, 0x10CC0 },
+    { 0x10C81, 0x10CC1 },
+    { 0x10C82, 0x10CC2 },
+    { 0x10C83, 0x10CC3 },
+    { 0x10C84, 0x10CC4 },
+    { 0x10C85, 0x10CC5 },
+    { 0x10C86, 0x10CC6 },
+    { 0x10C87, 0x10CC7 },
+    { 0x10C88, 0x10CC8 },
+    { 0x10C89, 0x10CC9 },
+    { 0x10C8A, 0x10CCA },
+    { 0x10C8B, 0x10CCB },
+    { 0x10C8C, 0x10CCC },
+    { 0x10C8D, 0x10CCD },
+    { 0x10C8E, 0x10CCE },
+    { 0x10C8F, 0x10CCF },
+    { 0x10C90, 0x10CD0 },
+    { 0x10C91, 0x10CD1 },
+    { 0x10C92, 0x10CD2 },
+    { 0x10C93, 0x10CD3 },
+    { 0x10C94, 0x10CD4 },
+    { 0x10C95, 0x10CD5 },
+    { 0x10C96, 0x10CD6 },
+    { 0x10C97, 0x10CD7 },
+    { 0x10C98, 0x10CD8 },
+    { 0x10C99, 0x10CD9 },
+    { 0x10C9A, 0x10CDA },
+    { 0x10C9B, 0x10CDB },
+    { 0x10C9C, 0x10CDC },
+    { 0x10C9D, 0x10CDD },
+    { 0x10C9E, 0x10CDE },
+    { 0x10C9F, 0x10CDF },
+    { 0x10CA0, 0x10CE0 },
+    { 0x10CA1, 0x10CE1 },
+    { 0x10CA2, 0x10CE2 },
+    { 0x10CA3, 0x10CE3 },
+    { 0x10CA4, 0x10CE4 },
+    { 0x10CA5, 0x10CE5 },
+    { 0x10CA6, 0x10CE6 },
+    { 0x10CA7, 0x10CE7 },
+    { 0x10CA8, 0x10CE8 },
+    { 0x10CA9, 0x10CE9 },
+    { 0x10CAA, 0x10CEA },
+    { 0x10CAB, 0x10CEB },
+    { 0x10CAC, 0x10CEC },
+    { 0x10CAD, 0x10CED },
+    { 0x10CAE, 0x10CEE },
+    { 0x10CAF, 0x10CEF },
+    { 0x10CB0, 0x10CF0 },
+    { 0x10CB1, 0x10CF1 },
+    { 0x10CB2, 0x10CF2 },
+    { 0x118A0, 0x118C0 },
+    { 0x118A1, 0x118C1 },
+    { 0x118A2, 0x118C2 },
+    { 0x118A3, 0x118C3 },
+    { 0x118A4, 0x118C4 },
+    { 0x118A5, 0x118C5 },
+    { 0x118A6, 0x118C6 },
+    { 0x118A7, 0x118C7 },
+    { 0x118A8, 0x118C8 },
+    { 0x118A9, 0x118C9 },
+    { 0x118AA, 0x118CA },
+    { 0x118AB, 0x118CB },
+    { 0x118AC, 0x118CC },
+    { 0x118AD, 0x118CD },
+    { 0x118AE, 0x118CE },
+    { 0x118AF, 0x118CF },
+    { 0x118B0, 0x118D0 },
+    { 0x118B1, 0x118D1 },
+    { 0x118B2, 0x118D2 },
+    { 0x118B3, 0x118D3 },
+    { 0x118B4, 0x118D4 },
+    { 0x118B5, 0x118D5 },
+    { 0x118B6, 0x118D6 },
+    { 0x118B7, 0x118D7 },
+    { 0x118B8, 0x118D8 },
+    { 0x118B9, 0x118D9 },
+    { 0x118BA, 0x118DA },
+    { 0x118BB, 0x118DB },
+    { 0x118BC, 0x118DC },
+    { 0x118BD, 0x118DD },
+    { 0x118BE, 0x118DE },
+    { 0x118BF, 0x118DF },
+    { 0x16E40, 0x16E60 },
+    { 0x16E41, 0x16E61 },
+    { 0x16E42, 0x16E62 },
+    { 0x16E43, 0x16E63 },
+    { 0x16E44, 0x16E64 },
+    { 0x16E45, 0x16E65 },
+    { 0x16E46, 0x16E66 },
+    { 0x16E47, 0x16E67 },
+    { 0x16E48, 0x16E68 },
+    { 0x16E49, 0x16E69 },
+    { 0x16E4A, 0x16E6A },
+    { 0x16E4B, 0x16E6B },
+    { 0x16E4C, 0x16E6C },
+    { 0x16E4D, 0x16E6D },
+    { 0x16E4E, 0x16E6E },
+    { 0x16E4F, 0x16E6F },
+    { 0x16E50, 0x16E70 },
+    { 0x16E51, 0x16E71 },
+    { 0x16E52, 0x16E72 },
+    { 0x16E53, 0x16E73 },
+    { 0x16E54, 0x16E74 },
+    { 0x16E55, 0x16E75 },
+    { 0x16E56, 0x16E76 },
+    { 0x16E57, 0x16E77 },
+    { 0x16E58, 0x16E78 },
+    { 0x16E59, 0x16E79 },
+    { 0x16E5A, 0x16E7A },
+    { 0x16E5B, 0x16E7B },
+    { 0x16E5C, 0x16E7C },
+    { 0x16E5D, 0x16E7D },
+    { 0x16E5E, 0x16E7E },
+    { 0x16E5F, 0x16E7F },
+    { 0x1E900, 0x1E922 },
+    { 0x1E901, 0x1E923 },
+    { 0x1E902, 0x1E924 },
+    { 0x1E903, 0x1E925 },
+    { 0x1E904, 0x1E926 },
+    { 0x1E905, 0x1E927 },
+    { 0x1E906, 0x1E928 },
+    { 0x1E907, 0x1E929 },
+    { 0x1E908, 0x1E92A },
+    { 0x1E909, 0x1E92B },
+    { 0x1E90A, 0x1E92C },
+    { 0x1E90B, 0x1E92D },
+    { 0x1E90C, 0x1E92E },
+    { 0x1E90D, 0x1E92F },
+    { 0x1E90E, 0x1E930 },
+    { 0x1E90F, 0x1E931 },
+    { 0x1E910, 0x1E932 },
+    { 0x1E911, 0x1E933 },
+    { 0x1E912, 0x1E934 },
+    { 0x1E913, 0x1E935 },
+    { 0x1E914, 0x1E936 },
+    { 0x1E915, 0x1E937 },
+    { 0x1E916, 0x1E938 },
+    { 0x1E917, 0x1E939 },
+    { 0x1E918, 0x1E93A },
+    { 0x1E919, 0x1E93B },
+    { 0x1E91A, 0x1E93C },
+    { 0x1E91B, 0x1E93D },
+    { 0x1E91C, 0x1E93E },
+    { 0x1E91D, 0x1E93F },
+    { 0x1E91E, 0x1E940 },
+    { 0x1E91F, 0x1E941 },
+    { 0x1E920, 0x1E942 },
+    { 0x1E921, 0x1E943 }
+
+#define MAP(c) uc_tolower (c)
+#include "test-mapping-part2.h"
deleted file mode 120000 (symlink)
index 7327e07414041155436631804cc814662ef7f86e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_alnum.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7947a92bdf22b44537cbbd9c26155afef76e974b
--- /dev/null
@@ -0,0 +1,738 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0030, 0x0039 },
+    { 0x0041, 0x005A },
+    { 0x0061, 0x007A },
+    { 0x00AA, 0x00AA },
+    { 0x00B5, 0x00B5 },
+    { 0x00BA, 0x00BA },
+    { 0x00C0, 0x00D6 },
+    { 0x00D8, 0x00F6 },
+    { 0x00F8, 0x02C1 },
+    { 0x02C6, 0x02D1 },
+    { 0x02E0, 0x02E4 },
+    { 0x02EC, 0x02EC },
+    { 0x02EE, 0x02EE },
+    { 0x0345, 0x0345 },
+    { 0x0370, 0x0374 },
+    { 0x0376, 0x0377 },
+    { 0x037A, 0x037D },
+    { 0x037F, 0x037F },
+    { 0x0386, 0x0386 },
+    { 0x0388, 0x038A },
+    { 0x038C, 0x038C },
+    { 0x038E, 0x03A1 },
+    { 0x03A3, 0x03F5 },
+    { 0x03F7, 0x0481 },
+    { 0x048A, 0x052F },
+    { 0x0531, 0x0556 },
+    { 0x0559, 0x0559 },
+    { 0x0560, 0x0588 },
+    { 0x05D0, 0x05EA },
+    { 0x05EF, 0x05F2 },
+    { 0x0620, 0x064A },
+    { 0x0660, 0x0669 },
+    { 0x066E, 0x066F },
+    { 0x0671, 0x06D3 },
+    { 0x06D5, 0x06D5 },
+    { 0x06E5, 0x06E6 },
+    { 0x06EE, 0x06FC },
+    { 0x06FF, 0x06FF },
+    { 0x0710, 0x0710 },
+    { 0x0712, 0x072F },
+    { 0x074D, 0x07A5 },
+    { 0x07B1, 0x07B1 },
+    { 0x07C0, 0x07EA },
+    { 0x07F4, 0x07F5 },
+    { 0x07FA, 0x07FA },
+    { 0x0800, 0x0815 },
+    { 0x081A, 0x081A },
+    { 0x0824, 0x0824 },
+    { 0x0828, 0x0828 },
+    { 0x0840, 0x0858 },
+    { 0x0860, 0x086A },
+    { 0x0870, 0x0887 },
+    { 0x0889, 0x088E },
+    { 0x08A0, 0x08C9 },
+    { 0x0904, 0x0939 },
+    { 0x093D, 0x093D },
+    { 0x0950, 0x0950 },
+    { 0x0958, 0x0961 },
+    { 0x0966, 0x096F },
+    { 0x0971, 0x0980 },
+    { 0x0985, 0x098C },
+    { 0x098F, 0x0990 },
+    { 0x0993, 0x09A8 },
+    { 0x09AA, 0x09B0 },
+    { 0x09B2, 0x09B2 },
+    { 0x09B6, 0x09B9 },
+    { 0x09BD, 0x09BD },
+    { 0x09CE, 0x09CE },
+    { 0x09DC, 0x09DD },
+    { 0x09DF, 0x09E1 },
+    { 0x09E6, 0x09F1 },
+    { 0x09FC, 0x09FC },
+    { 0x0A05, 0x0A0A },
+    { 0x0A0F, 0x0A10 },
+    { 0x0A13, 0x0A28 },
+    { 0x0A2A, 0x0A30 },
+    { 0x0A32, 0x0A33 },
+    { 0x0A35, 0x0A36 },
+    { 0x0A38, 0x0A39 },
+    { 0x0A59, 0x0A5C },
+    { 0x0A5E, 0x0A5E },
+    { 0x0A66, 0x0A6F },
+    { 0x0A72, 0x0A74 },
+    { 0x0A85, 0x0A8D },
+    { 0x0A8F, 0x0A91 },
+    { 0x0A93, 0x0AA8 },
+    { 0x0AAA, 0x0AB0 },
+    { 0x0AB2, 0x0AB3 },
+    { 0x0AB5, 0x0AB9 },
+    { 0x0ABD, 0x0ABD },
+    { 0x0AD0, 0x0AD0 },
+    { 0x0AE0, 0x0AE1 },
+    { 0x0AE6, 0x0AEF },
+    { 0x0AF9, 0x0AF9 },
+    { 0x0B05, 0x0B0C },
+    { 0x0B0F, 0x0B10 },
+    { 0x0B13, 0x0B28 },
+    { 0x0B2A, 0x0B30 },
+    { 0x0B32, 0x0B33 },
+    { 0x0B35, 0x0B39 },
+    { 0x0B3D, 0x0B3D },
+    { 0x0B5C, 0x0B5D },
+    { 0x0B5F, 0x0B61 },
+    { 0x0B66, 0x0B6F },
+    { 0x0B71, 0x0B71 },
+    { 0x0B83, 0x0B83 },
+    { 0x0B85, 0x0B8A },
+    { 0x0B8E, 0x0B90 },
+    { 0x0B92, 0x0B95 },
+    { 0x0B99, 0x0B9A },
+    { 0x0B9C, 0x0B9C },
+    { 0x0B9E, 0x0B9F },
+    { 0x0BA3, 0x0BA4 },
+    { 0x0BA8, 0x0BAA },
+    { 0x0BAE, 0x0BB9 },
+    { 0x0BD0, 0x0BD0 },
+    { 0x0BE6, 0x0BEF },
+    { 0x0C05, 0x0C0C },
+    { 0x0C0E, 0x0C10 },
+    { 0x0C12, 0x0C28 },
+    { 0x0C2A, 0x0C39 },
+    { 0x0C3D, 0x0C3D },
+    { 0x0C58, 0x0C5A },
+    { 0x0C5D, 0x0C5D },
+    { 0x0C60, 0x0C61 },
+    { 0x0C66, 0x0C6F },
+    { 0x0C80, 0x0C80 },
+    { 0x0C85, 0x0C8C },
+    { 0x0C8E, 0x0C90 },
+    { 0x0C92, 0x0CA8 },
+    { 0x0CAA, 0x0CB3 },
+    { 0x0CB5, 0x0CB9 },
+    { 0x0CBD, 0x0CBD },
+    { 0x0CDD, 0x0CDE },
+    { 0x0CE0, 0x0CE1 },
+    { 0x0CE6, 0x0CEF },
+    { 0x0CF1, 0x0CF2 },
+    { 0x0D04, 0x0D0C },
+    { 0x0D0E, 0x0D10 },
+    { 0x0D12, 0x0D3A },
+    { 0x0D3D, 0x0D3D },
+    { 0x0D4E, 0x0D4E },
+    { 0x0D54, 0x0D56 },
+    { 0x0D5F, 0x0D61 },
+    { 0x0D66, 0x0D6F },
+    { 0x0D7A, 0x0D7F },
+    { 0x0D85, 0x0D96 },
+    { 0x0D9A, 0x0DB1 },
+    { 0x0DB3, 0x0DBB },
+    { 0x0DBD, 0x0DBD },
+    { 0x0DC0, 0x0DC6 },
+    { 0x0DE6, 0x0DEF },
+    { 0x0E01, 0x0E2E },
+    { 0x0E30, 0x0E3A },
+    { 0x0E40, 0x0E45 },
+    { 0x0E47, 0x0E4E },
+    { 0x0E50, 0x0E59 },
+    { 0x0E81, 0x0E82 },
+    { 0x0E84, 0x0E84 },
+    { 0x0E86, 0x0E8A },
+    { 0x0E8C, 0x0EA3 },
+    { 0x0EA5, 0x0EA5 },
+    { 0x0EA7, 0x0EB0 },
+    { 0x0EB2, 0x0EB3 },
+    { 0x0EBD, 0x0EBD },
+    { 0x0EC0, 0x0EC4 },
+    { 0x0EC6, 0x0EC6 },
+    { 0x0ED0, 0x0ED9 },
+    { 0x0EDC, 0x0EDF },
+    { 0x0F00, 0x0F00 },
+    { 0x0F20, 0x0F29 },
+    { 0x0F40, 0x0F47 },
+    { 0x0F49, 0x0F6C },
+    { 0x0F88, 0x0F8C },
+    { 0x1000, 0x102A },
+    { 0x103F, 0x1049 },
+    { 0x1050, 0x1055 },
+    { 0x105A, 0x105D },
+    { 0x1061, 0x1061 },
+    { 0x1065, 0x1066 },
+    { 0x106E, 0x1070 },
+    { 0x1075, 0x1081 },
+    { 0x108E, 0x108E },
+    { 0x1090, 0x1099 },
+    { 0x10A0, 0x10C5 },
+    { 0x10C7, 0x10C7 },
+    { 0x10CD, 0x10CD },
+    { 0x10D0, 0x10FA },
+    { 0x10FC, 0x1248 },
+    { 0x124A, 0x124D },
+    { 0x1250, 0x1256 },
+    { 0x1258, 0x1258 },
+    { 0x125A, 0x125D },
+    { 0x1260, 0x1288 },
+    { 0x128A, 0x128D },
+    { 0x1290, 0x12B0 },
+    { 0x12B2, 0x12B5 },
+    { 0x12B8, 0x12BE },
+    { 0x12C0, 0x12C0 },
+    { 0x12C2, 0x12C5 },
+    { 0x12C8, 0x12D6 },
+    { 0x12D8, 0x1310 },
+    { 0x1312, 0x1315 },
+    { 0x1318, 0x135A },
+    { 0x1380, 0x138F },
+    { 0x13A0, 0x13F5 },
+    { 0x13F8, 0x13FD },
+    { 0x1401, 0x166C },
+    { 0x166F, 0x167F },
+    { 0x1681, 0x169A },
+    { 0x16A0, 0x16EA },
+    { 0x16EE, 0x16F8 },
+    { 0x1700, 0x1711 },
+    { 0x171F, 0x1731 },
+    { 0x1740, 0x1751 },
+    { 0x1760, 0x176C },
+    { 0x176E, 0x1770 },
+    { 0x1780, 0x17B3 },
+    { 0x17D7, 0x17D7 },
+    { 0x17DC, 0x17DC },
+    { 0x17E0, 0x17E9 },
+    { 0x1810, 0x1819 },
+    { 0x1820, 0x1878 },
+    { 0x1880, 0x1884 },
+    { 0x1887, 0x18A8 },
+    { 0x18AA, 0x18AA },
+    { 0x18B0, 0x18F5 },
+    { 0x1900, 0x191E },
+    { 0x1946, 0x196D },
+    { 0x1970, 0x1974 },
+    { 0x1980, 0x19AB },
+    { 0x19B0, 0x19C9 },
+    { 0x19D0, 0x19D9 },
+    { 0x1A00, 0x1A16 },
+    { 0x1A20, 0x1A54 },
+    { 0x1A80, 0x1A89 },
+    { 0x1A90, 0x1A99 },
+    { 0x1AA7, 0x1AA7 },
+    { 0x1B05, 0x1B33 },
+    { 0x1B45, 0x1B4C },
+    { 0x1B50, 0x1B59 },
+    { 0x1B83, 0x1BA0 },
+    { 0x1BAE, 0x1BE5 },
+    { 0x1C00, 0x1C23 },
+    { 0x1C40, 0x1C49 },
+    { 0x1C4D, 0x1C7D },
+    { 0x1C80, 0x1C88 },
+    { 0x1C90, 0x1CBA },
+    { 0x1CBD, 0x1CBF },
+    { 0x1CE9, 0x1CEC },
+    { 0x1CEE, 0x1CF3 },
+    { 0x1CF5, 0x1CF6 },
+    { 0x1CFA, 0x1CFA },
+    { 0x1D00, 0x1DBF },
+    { 0x1E00, 0x1F15 },
+    { 0x1F18, 0x1F1D },
+    { 0x1F20, 0x1F45 },
+    { 0x1F48, 0x1F4D },
+    { 0x1F50, 0x1F57 },
+    { 0x1F59, 0x1F59 },
+    { 0x1F5B, 0x1F5B },
+    { 0x1F5D, 0x1F5D },
+    { 0x1F5F, 0x1F7D },
+    { 0x1F80, 0x1FB4 },
+    { 0x1FB6, 0x1FBC },
+    { 0x1FBE, 0x1FBE },
+    { 0x1FC2, 0x1FC4 },
+    { 0x1FC6, 0x1FCC },
+    { 0x1FD0, 0x1FD3 },
+    { 0x1FD6, 0x1FDB },
+    { 0x1FE0, 0x1FEC },
+    { 0x1FF2, 0x1FF4 },
+    { 0x1FF6, 0x1FFC },
+    { 0x2071, 0x2071 },
+    { 0x207F, 0x207F },
+    { 0x2090, 0x209C },
+    { 0x2102, 0x2102 },
+    { 0x2107, 0x2107 },
+    { 0x210A, 0x2113 },
+    { 0x2115, 0x2115 },
+    { 0x2119, 0x211D },
+    { 0x2124, 0x2124 },
+    { 0x2126, 0x2126 },
+    { 0x2128, 0x212D },
+    { 0x212F, 0x2139 },
+    { 0x213C, 0x213F },
+    { 0x2145, 0x2149 },
+    { 0x214E, 0x214E },
+    { 0x2160, 0x2188 },
+    { 0x249C, 0x24E9 },
+    { 0x2C00, 0x2CE4 },
+    { 0x2CEB, 0x2CEE },
+    { 0x2CF2, 0x2CF3 },
+    { 0x2D00, 0x2D25 },
+    { 0x2D27, 0x2D27 },
+    { 0x2D2D, 0x2D2D },
+    { 0x2D30, 0x2D67 },
+    { 0x2D6F, 0x2D6F },
+    { 0x2D80, 0x2D96 },
+    { 0x2DA0, 0x2DA6 },
+    { 0x2DA8, 0x2DAE },
+    { 0x2DB0, 0x2DB6 },
+    { 0x2DB8, 0x2DBE },
+    { 0x2DC0, 0x2DC6 },
+    { 0x2DC8, 0x2DCE },
+    { 0x2DD0, 0x2DD6 },
+    { 0x2DD8, 0x2DDE },
+    { 0x2E2F, 0x2E2F },
+    { 0x3005, 0x3007 },
+    { 0x3021, 0x3029 },
+    { 0x3031, 0x3035 },
+    { 0x3038, 0x303C },
+    { 0x3041, 0x3096 },
+    { 0x309D, 0x309F },
+    { 0x30A1, 0x30FA },
+    { 0x30FC, 0x30FF },
+    { 0x3105, 0x312F },
+    { 0x3131, 0x318E },
+    { 0x31A0, 0x31BF },
+    { 0x31F0, 0x31FF },
+    { 0x3400, 0x4DBF },
+    { 0x4E00, 0xA48C },
+    { 0xA4D0, 0xA4FD },
+    { 0xA500, 0xA60C },
+    { 0xA610, 0xA62B },
+    { 0xA640, 0xA66E },
+    { 0xA67F, 0xA69D },
+    { 0xA6A0, 0xA6EF },
+    { 0xA717, 0xA71F },
+    { 0xA722, 0xA788 },
+    { 0xA78B, 0xA7CA },
+    { 0xA7D0, 0xA7D1 },
+    { 0xA7D3, 0xA7D3 },
+    { 0xA7D5, 0xA7D9 },
+    { 0xA7F2, 0xA801 },
+    { 0xA803, 0xA805 },
+    { 0xA807, 0xA80A },
+    { 0xA80C, 0xA822 },
+    { 0xA840, 0xA873 },
+    { 0xA882, 0xA8B3 },
+    { 0xA8D0, 0xA8D9 },
+    { 0xA8F2, 0xA8F7 },
+    { 0xA8FB, 0xA8FB },
+    { 0xA8FD, 0xA8FE },
+    { 0xA900, 0xA925 },
+    { 0xA930, 0xA946 },
+    { 0xA960, 0xA97C },
+    { 0xA984, 0xA9B2 },
+    { 0xA9CF, 0xA9D9 },
+    { 0xA9E0, 0xA9E4 },
+    { 0xA9E6, 0xA9FE },
+    { 0xAA00, 0xAA28 },
+    { 0xAA40, 0xAA42 },
+    { 0xAA44, 0xAA4B },
+    { 0xAA50, 0xAA59 },
+    { 0xAA60, 0xAA76 },
+    { 0xAA7A, 0xAA7A },
+    { 0xAA7E, 0xAAAF },
+    { 0xAAB1, 0xAAB1 },
+    { 0xAAB5, 0xAAB6 },
+    { 0xAAB9, 0xAABD },
+    { 0xAAC0, 0xAAC0 },
+    { 0xAAC2, 0xAAC2 },
+    { 0xAADB, 0xAADD },
+    { 0xAAE0, 0xAAEA },
+    { 0xAAF2, 0xAAF4 },
+    { 0xAB01, 0xAB06 },
+    { 0xAB09, 0xAB0E },
+    { 0xAB11, 0xAB16 },
+    { 0xAB20, 0xAB26 },
+    { 0xAB28, 0xAB2E },
+    { 0xAB30, 0xAB5A },
+    { 0xAB5C, 0xAB69 },
+    { 0xAB70, 0xABE2 },
+    { 0xABF0, 0xABF9 },
+    { 0xAC00, 0xD7A3 },
+    { 0xD7B0, 0xD7C6 },
+    { 0xD7CB, 0xD7FB },
+    { 0xF900, 0xFA6D },
+    { 0xFA70, 0xFAD9 },
+    { 0xFB00, 0xFB06 },
+    { 0xFB13, 0xFB17 },
+    { 0xFB1D, 0xFB1D },
+    { 0xFB1F, 0xFB28 },
+    { 0xFB2A, 0xFB36 },
+    { 0xFB38, 0xFB3C },
+    { 0xFB3E, 0xFB3E },
+    { 0xFB40, 0xFB41 },
+    { 0xFB43, 0xFB44 },
+    { 0xFB46, 0xFBB1 },
+    { 0xFBD3, 0xFD3D },
+    { 0xFD50, 0xFD8F },
+    { 0xFD92, 0xFDC7 },
+    { 0xFDF0, 0xFDFB },
+    { 0xFE70, 0xFE74 },
+    { 0xFE76, 0xFEFC },
+    { 0xFF10, 0xFF19 },
+    { 0xFF21, 0xFF3A },
+    { 0xFF41, 0xFF5A },
+    { 0xFF66, 0xFFBE },
+    { 0xFFC2, 0xFFC7 },
+    { 0xFFCA, 0xFFCF },
+    { 0xFFD2, 0xFFD7 },
+    { 0xFFDA, 0xFFDC },
+    { 0x10000, 0x1000B },
+    { 0x1000D, 0x10026 },
+    { 0x10028, 0x1003A },
+    { 0x1003C, 0x1003D },
+    { 0x1003F, 0x1004D },
+    { 0x10050, 0x1005D },
+    { 0x10080, 0x100FA },
+    { 0x10140, 0x10174 },
+    { 0x10280, 0x1029C },
+    { 0x102A0, 0x102D0 },
+    { 0x10300, 0x1031F },
+    { 0x1032D, 0x1034A },
+    { 0x10350, 0x10375 },
+    { 0x10380, 0x1039D },
+    { 0x103A0, 0x103C3 },
+    { 0x103C8, 0x103CF },
+    { 0x103D1, 0x103D5 },
+    { 0x10400, 0x1049D },
+    { 0x104A0, 0x104A9 },
+    { 0x104B0, 0x104D3 },
+    { 0x104D8, 0x104FB },
+    { 0x10500, 0x10527 },
+    { 0x10530, 0x10563 },
+    { 0x10570, 0x1057A },
+    { 0x1057C, 0x1058A },
+    { 0x1058C, 0x10592 },
+    { 0x10594, 0x10595 },
+    { 0x10597, 0x105A1 },
+    { 0x105A3, 0x105B1 },
+    { 0x105B3, 0x105B9 },
+    { 0x105BB, 0x105BC },
+    { 0x10600, 0x10736 },
+    { 0x10740, 0x10755 },
+    { 0x10760, 0x10767 },
+    { 0x10780, 0x10785 },
+    { 0x10787, 0x107B0 },
+    { 0x107B2, 0x107BA },
+    { 0x10800, 0x10805 },
+    { 0x10808, 0x10808 },
+    { 0x1080A, 0x10835 },
+    { 0x10837, 0x10838 },
+    { 0x1083C, 0x1083C },
+    { 0x1083F, 0x10855 },
+    { 0x10860, 0x10876 },
+    { 0x10880, 0x1089E },
+    { 0x108E0, 0x108F2 },
+    { 0x108F4, 0x108F5 },
+    { 0x10900, 0x10915 },
+    { 0x10920, 0x10939 },
+    { 0x10980, 0x109B7 },
+    { 0x109BE, 0x109BF },
+    { 0x10A00, 0x10A00 },
+    { 0x10A10, 0x10A13 },
+    { 0x10A15, 0x10A17 },
+    { 0x10A19, 0x10A35 },
+    { 0x10A60, 0x10A7C },
+    { 0x10A80, 0x10A9C },
+    { 0x10AC0, 0x10AC7 },
+    { 0x10AC9, 0x10AE4 },
+    { 0x10B00, 0x10B35 },
+    { 0x10B40, 0x10B55 },
+    { 0x10B60, 0x10B72 },
+    { 0x10B80, 0x10B91 },
+    { 0x10C00, 0x10C48 },
+    { 0x10C80, 0x10CB2 },
+    { 0x10CC0, 0x10CF2 },
+    { 0x10D00, 0x10D23 },
+    { 0x10D30, 0x10D39 },
+    { 0x10E80, 0x10EA9 },
+    { 0x10EB0, 0x10EB1 },
+    { 0x10F00, 0x10F1C },
+    { 0x10F27, 0x10F27 },
+    { 0x10F30, 0x10F45 },
+    { 0x10F70, 0x10F81 },
+    { 0x10FB0, 0x10FC4 },
+    { 0x10FE0, 0x10FF6 },
+    { 0x11003, 0x11037 },
+    { 0x11066, 0x1106F },
+    { 0x11071, 0x11072 },
+    { 0x11075, 0x11075 },
+    { 0x11083, 0x110AF },
+    { 0x110D0, 0x110E8 },
+    { 0x110F0, 0x110F9 },
+    { 0x11103, 0x11126 },
+    { 0x11136, 0x1113F },
+    { 0x11144, 0x11144 },
+    { 0x11147, 0x11147 },
+    { 0x11150, 0x11172 },
+    { 0x11176, 0x11176 },
+    { 0x11183, 0x111B2 },
+    { 0x111C1, 0x111C4 },
+    { 0x111D0, 0x111DA },
+    { 0x111DC, 0x111DC },
+    { 0x11200, 0x11211 },
+    { 0x11213, 0x1122B },
+    { 0x1123F, 0x11240 },
+    { 0x11280, 0x11286 },
+    { 0x11288, 0x11288 },
+    { 0x1128A, 0x1128D },
+    { 0x1128F, 0x1129D },
+    { 0x1129F, 0x112A8 },
+    { 0x112B0, 0x112DE },
+    { 0x112F0, 0x112F9 },
+    { 0x11305, 0x1130C },
+    { 0x1130F, 0x11310 },
+    { 0x11313, 0x11328 },
+    { 0x1132A, 0x11330 },
+    { 0x11332, 0x11333 },
+    { 0x11335, 0x11339 },
+    { 0x1133D, 0x1133D },
+    { 0x11350, 0x11350 },
+    { 0x1135D, 0x11361 },
+    { 0x11400, 0x11434 },
+    { 0x11447, 0x1144A },
+    { 0x11450, 0x11459 },
+    { 0x1145F, 0x11461 },
+    { 0x11480, 0x114AF },
+    { 0x114C4, 0x114C5 },
+    { 0x114C7, 0x114C7 },
+    { 0x114D0, 0x114D9 },
+    { 0x11580, 0x115AE },
+    { 0x115D8, 0x115DB },
+    { 0x11600, 0x1162F },
+    { 0x11644, 0x11644 },
+    { 0x11650, 0x11659 },
+    { 0x11680, 0x116AA },
+    { 0x116B8, 0x116B8 },
+    { 0x116C0, 0x116C9 },
+    { 0x11700, 0x1171A },
+    { 0x11730, 0x11739 },
+    { 0x11740, 0x11746 },
+    { 0x11800, 0x1182B },
+    { 0x118A0, 0x118E9 },
+    { 0x118FF, 0x11906 },
+    { 0x11909, 0x11909 },
+    { 0x1190C, 0x11913 },
+    { 0x11915, 0x11916 },
+    { 0x11918, 0x1192F },
+    { 0x1193F, 0x1193F },
+    { 0x11941, 0x11941 },
+    { 0x11950, 0x11959 },
+    { 0x119A0, 0x119A7 },
+    { 0x119AA, 0x119D0 },
+    { 0x119E1, 0x119E1 },
+    { 0x119E3, 0x119E3 },
+    { 0x11A00, 0x11A00 },
+    { 0x11A0B, 0x11A32 },
+    { 0x11A3A, 0x11A3A },
+    { 0x11A50, 0x11A50 },
+    { 0x11A5C, 0x11A89 },
+    { 0x11A9D, 0x11A9D },
+    { 0x11AB0, 0x11AF8 },
+    { 0x11C00, 0x11C08 },
+    { 0x11C0A, 0x11C2E },
+    { 0x11C40, 0x11C40 },
+    { 0x11C50, 0x11C59 },
+    { 0x11C72, 0x11C8F },
+    { 0x11D00, 0x11D06 },
+    { 0x11D08, 0x11D09 },
+    { 0x11D0B, 0x11D30 },
+    { 0x11D46, 0x11D46 },
+    { 0x11D50, 0x11D59 },
+    { 0x11D60, 0x11D65 },
+    { 0x11D67, 0x11D68 },
+    { 0x11D6A, 0x11D89 },
+    { 0x11D98, 0x11D98 },
+    { 0x11DA0, 0x11DA9 },
+    { 0x11EE0, 0x11EF2 },
+    { 0x11F02, 0x11F02 },
+    { 0x11F04, 0x11F10 },
+    { 0x11F12, 0x11F33 },
+    { 0x11F50, 0x11F59 },
+    { 0x11FB0, 0x11FB0 },
+    { 0x12000, 0x12399 },
+    { 0x12400, 0x1246E },
+    { 0x12480, 0x12543 },
+    { 0x12F90, 0x12FF0 },
+    { 0x13000, 0x1342F },
+    { 0x13441, 0x13446 },
+    { 0x14400, 0x14646 },
+    { 0x16800, 0x16A38 },
+    { 0x16A40, 0x16A5E },
+    { 0x16A60, 0x16A69 },
+    { 0x16A70, 0x16ABE },
+    { 0x16AC0, 0x16AC9 },
+    { 0x16AD0, 0x16AED },
+    { 0x16B00, 0x16B2F },
+    { 0x16B40, 0x16B43 },
+    { 0x16B50, 0x16B59 },
+    { 0x16B63, 0x16B77 },
+    { 0x16B7D, 0x16B8F },
+    { 0x16E40, 0x16E7F },
+    { 0x16F00, 0x16F4A },
+    { 0x16F50, 0x16F50 },
+    { 0x16F93, 0x16F9F },
+    { 0x16FE0, 0x16FE1 },
+    { 0x16FE3, 0x16FE3 },
+    { 0x17000, 0x187F7 },
+    { 0x18800, 0x18CD5 },
+    { 0x18D00, 0x18D08 },
+    { 0x1AFF0, 0x1AFF3 },
+    { 0x1AFF5, 0x1AFFB },
+    { 0x1AFFD, 0x1AFFE },
+    { 0x1B000, 0x1B122 },
+    { 0x1B132, 0x1B132 },
+    { 0x1B150, 0x1B152 },
+    { 0x1B155, 0x1B155 },
+    { 0x1B164, 0x1B167 },
+    { 0x1B170, 0x1B2FB },
+    { 0x1BC00, 0x1BC6A },
+    { 0x1BC70, 0x1BC7C },
+    { 0x1BC80, 0x1BC88 },
+    { 0x1BC90, 0x1BC99 },
+    { 0x1D400, 0x1D454 },
+    { 0x1D456, 0x1D49C },
+    { 0x1D49E, 0x1D49F },
+    { 0x1D4A2, 0x1D4A2 },
+    { 0x1D4A5, 0x1D4A6 },
+    { 0x1D4A9, 0x1D4AC },
+    { 0x1D4AE, 0x1D4B9 },
+    { 0x1D4BB, 0x1D4BB },
+    { 0x1D4BD, 0x1D4C3 },
+    { 0x1D4C5, 0x1D505 },
+    { 0x1D507, 0x1D50A },
+    { 0x1D50D, 0x1D514 },
+    { 0x1D516, 0x1D51C },
+    { 0x1D51E, 0x1D539 },
+    { 0x1D53B, 0x1D53E },
+    { 0x1D540, 0x1D544 },
+    { 0x1D546, 0x1D546 },
+    { 0x1D54A, 0x1D550 },
+    { 0x1D552, 0x1D6A5 },
+    { 0x1D6A8, 0x1D6C0 },
+    { 0x1D6C2, 0x1D6DA },
+    { 0x1D6DC, 0x1D6FA },
+    { 0x1D6FC, 0x1D714 },
+    { 0x1D716, 0x1D734 },
+    { 0x1D736, 0x1D74E },
+    { 0x1D750, 0x1D76E },
+    { 0x1D770, 0x1D788 },
+    { 0x1D78A, 0x1D7A8 },
+    { 0x1D7AA, 0x1D7C2 },
+    { 0x1D7C4, 0x1D7CB },
+    { 0x1D7CE, 0x1D7FF },
+    { 0x1DF00, 0x1DF1E },
+    { 0x1DF25, 0x1DF2A },
+    { 0x1E030, 0x1E06D },
+    { 0x1E100, 0x1E12C },
+    { 0x1E137, 0x1E13D },
+    { 0x1E140, 0x1E149 },
+    { 0x1E14E, 0x1E14E },
+    { 0x1E290, 0x1E2AD },
+    { 0x1E2C0, 0x1E2EB },
+    { 0x1E2F0, 0x1E2F9 },
+    { 0x1E4D0, 0x1E4EB },
+    { 0x1E4F0, 0x1E4F9 },
+    { 0x1E7E0, 0x1E7E6 },
+    { 0x1E7E8, 0x1E7EB },
+    { 0x1E7ED, 0x1E7EE },
+    { 0x1E7F0, 0x1E7FE },
+    { 0x1E800, 0x1E8C4 },
+    { 0x1E900, 0x1E943 },
+    { 0x1E94B, 0x1E94B },
+    { 0x1E950, 0x1E959 },
+    { 0x1EE00, 0x1EE03 },
+    { 0x1EE05, 0x1EE1F },
+    { 0x1EE21, 0x1EE22 },
+    { 0x1EE24, 0x1EE24 },
+    { 0x1EE27, 0x1EE27 },
+    { 0x1EE29, 0x1EE32 },
+    { 0x1EE34, 0x1EE37 },
+    { 0x1EE39, 0x1EE39 },
+    { 0x1EE3B, 0x1EE3B },
+    { 0x1EE42, 0x1EE42 },
+    { 0x1EE47, 0x1EE47 },
+    { 0x1EE49, 0x1EE49 },
+    { 0x1EE4B, 0x1EE4B },
+    { 0x1EE4D, 0x1EE4F },
+    { 0x1EE51, 0x1EE52 },
+    { 0x1EE54, 0x1EE54 },
+    { 0x1EE57, 0x1EE57 },
+    { 0x1EE59, 0x1EE59 },
+    { 0x1EE5B, 0x1EE5B },
+    { 0x1EE5D, 0x1EE5D },
+    { 0x1EE5F, 0x1EE5F },
+    { 0x1EE61, 0x1EE62 },
+    { 0x1EE64, 0x1EE64 },
+    { 0x1EE67, 0x1EE6A },
+    { 0x1EE6C, 0x1EE72 },
+    { 0x1EE74, 0x1EE77 },
+    { 0x1EE79, 0x1EE7C },
+    { 0x1EE7E, 0x1EE7E },
+    { 0x1EE80, 0x1EE89 },
+    { 0x1EE8B, 0x1EE9B },
+    { 0x1EEA1, 0x1EEA3 },
+    { 0x1EEA5, 0x1EEA9 },
+    { 0x1EEAB, 0x1EEBB },
+    { 0x1F110, 0x1F12C },
+    { 0x1F130, 0x1F149 },
+    { 0x1F150, 0x1F169 },
+    { 0x1F170, 0x1F18A },
+    { 0x1F1A5, 0x1F1A5 },
+    { 0x1F1E6, 0x1F1FF },
+    { 0x1FBF0, 0x1FBF9 },
+    { 0x20000, 0x2A6DF },
+    { 0x2A700, 0x2B739 },
+    { 0x2B740, 0x2B81D },
+    { 0x2B820, 0x2CEA1 },
+    { 0x2CEB0, 0x2EBE0 },
+    { 0x2F800, 0x2FA1D },
+    { 0x30000, 0x3134A },
+    { 0x31350, 0x323AF }
+
+#define PREDICATE(c) uc_is_alnum (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index 1e7dd47fba7e8d1696c3e456f8327d1496c3a883..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_alpha.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..284d964e889c60109869f88ce9ca5a9eb88f67a1
--- /dev/null
@@ -0,0 +1,737 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0041, 0x005A },
+    { 0x0061, 0x007A },
+    { 0x00AA, 0x00AA },
+    { 0x00B5, 0x00B5 },
+    { 0x00BA, 0x00BA },
+    { 0x00C0, 0x00D6 },
+    { 0x00D8, 0x00F6 },
+    { 0x00F8, 0x02C1 },
+    { 0x02C6, 0x02D1 },
+    { 0x02E0, 0x02E4 },
+    { 0x02EC, 0x02EC },
+    { 0x02EE, 0x02EE },
+    { 0x0345, 0x0345 },
+    { 0x0370, 0x0374 },
+    { 0x0376, 0x0377 },
+    { 0x037A, 0x037D },
+    { 0x037F, 0x037F },
+    { 0x0386, 0x0386 },
+    { 0x0388, 0x038A },
+    { 0x038C, 0x038C },
+    { 0x038E, 0x03A1 },
+    { 0x03A3, 0x03F5 },
+    { 0x03F7, 0x0481 },
+    { 0x048A, 0x052F },
+    { 0x0531, 0x0556 },
+    { 0x0559, 0x0559 },
+    { 0x0560, 0x0588 },
+    { 0x05D0, 0x05EA },
+    { 0x05EF, 0x05F2 },
+    { 0x0620, 0x064A },
+    { 0x0660, 0x0669 },
+    { 0x066E, 0x066F },
+    { 0x0671, 0x06D3 },
+    { 0x06D5, 0x06D5 },
+    { 0x06E5, 0x06E6 },
+    { 0x06EE, 0x06FC },
+    { 0x06FF, 0x06FF },
+    { 0x0710, 0x0710 },
+    { 0x0712, 0x072F },
+    { 0x074D, 0x07A5 },
+    { 0x07B1, 0x07B1 },
+    { 0x07C0, 0x07EA },
+    { 0x07F4, 0x07F5 },
+    { 0x07FA, 0x07FA },
+    { 0x0800, 0x0815 },
+    { 0x081A, 0x081A },
+    { 0x0824, 0x0824 },
+    { 0x0828, 0x0828 },
+    { 0x0840, 0x0858 },
+    { 0x0860, 0x086A },
+    { 0x0870, 0x0887 },
+    { 0x0889, 0x088E },
+    { 0x08A0, 0x08C9 },
+    { 0x0904, 0x0939 },
+    { 0x093D, 0x093D },
+    { 0x0950, 0x0950 },
+    { 0x0958, 0x0961 },
+    { 0x0966, 0x096F },
+    { 0x0971, 0x0980 },
+    { 0x0985, 0x098C },
+    { 0x098F, 0x0990 },
+    { 0x0993, 0x09A8 },
+    { 0x09AA, 0x09B0 },
+    { 0x09B2, 0x09B2 },
+    { 0x09B6, 0x09B9 },
+    { 0x09BD, 0x09BD },
+    { 0x09CE, 0x09CE },
+    { 0x09DC, 0x09DD },
+    { 0x09DF, 0x09E1 },
+    { 0x09E6, 0x09F1 },
+    { 0x09FC, 0x09FC },
+    { 0x0A05, 0x0A0A },
+    { 0x0A0F, 0x0A10 },
+    { 0x0A13, 0x0A28 },
+    { 0x0A2A, 0x0A30 },
+    { 0x0A32, 0x0A33 },
+    { 0x0A35, 0x0A36 },
+    { 0x0A38, 0x0A39 },
+    { 0x0A59, 0x0A5C },
+    { 0x0A5E, 0x0A5E },
+    { 0x0A66, 0x0A6F },
+    { 0x0A72, 0x0A74 },
+    { 0x0A85, 0x0A8D },
+    { 0x0A8F, 0x0A91 },
+    { 0x0A93, 0x0AA8 },
+    { 0x0AAA, 0x0AB0 },
+    { 0x0AB2, 0x0AB3 },
+    { 0x0AB5, 0x0AB9 },
+    { 0x0ABD, 0x0ABD },
+    { 0x0AD0, 0x0AD0 },
+    { 0x0AE0, 0x0AE1 },
+    { 0x0AE6, 0x0AEF },
+    { 0x0AF9, 0x0AF9 },
+    { 0x0B05, 0x0B0C },
+    { 0x0B0F, 0x0B10 },
+    { 0x0B13, 0x0B28 },
+    { 0x0B2A, 0x0B30 },
+    { 0x0B32, 0x0B33 },
+    { 0x0B35, 0x0B39 },
+    { 0x0B3D, 0x0B3D },
+    { 0x0B5C, 0x0B5D },
+    { 0x0B5F, 0x0B61 },
+    { 0x0B66, 0x0B6F },
+    { 0x0B71, 0x0B71 },
+    { 0x0B83, 0x0B83 },
+    { 0x0B85, 0x0B8A },
+    { 0x0B8E, 0x0B90 },
+    { 0x0B92, 0x0B95 },
+    { 0x0B99, 0x0B9A },
+    { 0x0B9C, 0x0B9C },
+    { 0x0B9E, 0x0B9F },
+    { 0x0BA3, 0x0BA4 },
+    { 0x0BA8, 0x0BAA },
+    { 0x0BAE, 0x0BB9 },
+    { 0x0BD0, 0x0BD0 },
+    { 0x0BE6, 0x0BEF },
+    { 0x0C05, 0x0C0C },
+    { 0x0C0E, 0x0C10 },
+    { 0x0C12, 0x0C28 },
+    { 0x0C2A, 0x0C39 },
+    { 0x0C3D, 0x0C3D },
+    { 0x0C58, 0x0C5A },
+    { 0x0C5D, 0x0C5D },
+    { 0x0C60, 0x0C61 },
+    { 0x0C66, 0x0C6F },
+    { 0x0C80, 0x0C80 },
+    { 0x0C85, 0x0C8C },
+    { 0x0C8E, 0x0C90 },
+    { 0x0C92, 0x0CA8 },
+    { 0x0CAA, 0x0CB3 },
+    { 0x0CB5, 0x0CB9 },
+    { 0x0CBD, 0x0CBD },
+    { 0x0CDD, 0x0CDE },
+    { 0x0CE0, 0x0CE1 },
+    { 0x0CE6, 0x0CEF },
+    { 0x0CF1, 0x0CF2 },
+    { 0x0D04, 0x0D0C },
+    { 0x0D0E, 0x0D10 },
+    { 0x0D12, 0x0D3A },
+    { 0x0D3D, 0x0D3D },
+    { 0x0D4E, 0x0D4E },
+    { 0x0D54, 0x0D56 },
+    { 0x0D5F, 0x0D61 },
+    { 0x0D66, 0x0D6F },
+    { 0x0D7A, 0x0D7F },
+    { 0x0D85, 0x0D96 },
+    { 0x0D9A, 0x0DB1 },
+    { 0x0DB3, 0x0DBB },
+    { 0x0DBD, 0x0DBD },
+    { 0x0DC0, 0x0DC6 },
+    { 0x0DE6, 0x0DEF },
+    { 0x0E01, 0x0E2E },
+    { 0x0E30, 0x0E3A },
+    { 0x0E40, 0x0E45 },
+    { 0x0E47, 0x0E4E },
+    { 0x0E50, 0x0E59 },
+    { 0x0E81, 0x0E82 },
+    { 0x0E84, 0x0E84 },
+    { 0x0E86, 0x0E8A },
+    { 0x0E8C, 0x0EA3 },
+    { 0x0EA5, 0x0EA5 },
+    { 0x0EA7, 0x0EB0 },
+    { 0x0EB2, 0x0EB3 },
+    { 0x0EBD, 0x0EBD },
+    { 0x0EC0, 0x0EC4 },
+    { 0x0EC6, 0x0EC6 },
+    { 0x0ED0, 0x0ED9 },
+    { 0x0EDC, 0x0EDF },
+    { 0x0F00, 0x0F00 },
+    { 0x0F20, 0x0F29 },
+    { 0x0F40, 0x0F47 },
+    { 0x0F49, 0x0F6C },
+    { 0x0F88, 0x0F8C },
+    { 0x1000, 0x102A },
+    { 0x103F, 0x1049 },
+    { 0x1050, 0x1055 },
+    { 0x105A, 0x105D },
+    { 0x1061, 0x1061 },
+    { 0x1065, 0x1066 },
+    { 0x106E, 0x1070 },
+    { 0x1075, 0x1081 },
+    { 0x108E, 0x108E },
+    { 0x1090, 0x1099 },
+    { 0x10A0, 0x10C5 },
+    { 0x10C7, 0x10C7 },
+    { 0x10CD, 0x10CD },
+    { 0x10D0, 0x10FA },
+    { 0x10FC, 0x1248 },
+    { 0x124A, 0x124D },
+    { 0x1250, 0x1256 },
+    { 0x1258, 0x1258 },
+    { 0x125A, 0x125D },
+    { 0x1260, 0x1288 },
+    { 0x128A, 0x128D },
+    { 0x1290, 0x12B0 },
+    { 0x12B2, 0x12B5 },
+    { 0x12B8, 0x12BE },
+    { 0x12C0, 0x12C0 },
+    { 0x12C2, 0x12C5 },
+    { 0x12C8, 0x12D6 },
+    { 0x12D8, 0x1310 },
+    { 0x1312, 0x1315 },
+    { 0x1318, 0x135A },
+    { 0x1380, 0x138F },
+    { 0x13A0, 0x13F5 },
+    { 0x13F8, 0x13FD },
+    { 0x1401, 0x166C },
+    { 0x166F, 0x167F },
+    { 0x1681, 0x169A },
+    { 0x16A0, 0x16EA },
+    { 0x16EE, 0x16F8 },
+    { 0x1700, 0x1711 },
+    { 0x171F, 0x1731 },
+    { 0x1740, 0x1751 },
+    { 0x1760, 0x176C },
+    { 0x176E, 0x1770 },
+    { 0x1780, 0x17B3 },
+    { 0x17D7, 0x17D7 },
+    { 0x17DC, 0x17DC },
+    { 0x17E0, 0x17E9 },
+    { 0x1810, 0x1819 },
+    { 0x1820, 0x1878 },
+    { 0x1880, 0x1884 },
+    { 0x1887, 0x18A8 },
+    { 0x18AA, 0x18AA },
+    { 0x18B0, 0x18F5 },
+    { 0x1900, 0x191E },
+    { 0x1946, 0x196D },
+    { 0x1970, 0x1974 },
+    { 0x1980, 0x19AB },
+    { 0x19B0, 0x19C9 },
+    { 0x19D0, 0x19D9 },
+    { 0x1A00, 0x1A16 },
+    { 0x1A20, 0x1A54 },
+    { 0x1A80, 0x1A89 },
+    { 0x1A90, 0x1A99 },
+    { 0x1AA7, 0x1AA7 },
+    { 0x1B05, 0x1B33 },
+    { 0x1B45, 0x1B4C },
+    { 0x1B50, 0x1B59 },
+    { 0x1B83, 0x1BA0 },
+    { 0x1BAE, 0x1BE5 },
+    { 0x1C00, 0x1C23 },
+    { 0x1C40, 0x1C49 },
+    { 0x1C4D, 0x1C7D },
+    { 0x1C80, 0x1C88 },
+    { 0x1C90, 0x1CBA },
+    { 0x1CBD, 0x1CBF },
+    { 0x1CE9, 0x1CEC },
+    { 0x1CEE, 0x1CF3 },
+    { 0x1CF5, 0x1CF6 },
+    { 0x1CFA, 0x1CFA },
+    { 0x1D00, 0x1DBF },
+    { 0x1E00, 0x1F15 },
+    { 0x1F18, 0x1F1D },
+    { 0x1F20, 0x1F45 },
+    { 0x1F48, 0x1F4D },
+    { 0x1F50, 0x1F57 },
+    { 0x1F59, 0x1F59 },
+    { 0x1F5B, 0x1F5B },
+    { 0x1F5D, 0x1F5D },
+    { 0x1F5F, 0x1F7D },
+    { 0x1F80, 0x1FB4 },
+    { 0x1FB6, 0x1FBC },
+    { 0x1FBE, 0x1FBE },
+    { 0x1FC2, 0x1FC4 },
+    { 0x1FC6, 0x1FCC },
+    { 0x1FD0, 0x1FD3 },
+    { 0x1FD6, 0x1FDB },
+    { 0x1FE0, 0x1FEC },
+    { 0x1FF2, 0x1FF4 },
+    { 0x1FF6, 0x1FFC },
+    { 0x2071, 0x2071 },
+    { 0x207F, 0x207F },
+    { 0x2090, 0x209C },
+    { 0x2102, 0x2102 },
+    { 0x2107, 0x2107 },
+    { 0x210A, 0x2113 },
+    { 0x2115, 0x2115 },
+    { 0x2119, 0x211D },
+    { 0x2124, 0x2124 },
+    { 0x2126, 0x2126 },
+    { 0x2128, 0x212D },
+    { 0x212F, 0x2139 },
+    { 0x213C, 0x213F },
+    { 0x2145, 0x2149 },
+    { 0x214E, 0x214E },
+    { 0x2160, 0x2188 },
+    { 0x249C, 0x24E9 },
+    { 0x2C00, 0x2CE4 },
+    { 0x2CEB, 0x2CEE },
+    { 0x2CF2, 0x2CF3 },
+    { 0x2D00, 0x2D25 },
+    { 0x2D27, 0x2D27 },
+    { 0x2D2D, 0x2D2D },
+    { 0x2D30, 0x2D67 },
+    { 0x2D6F, 0x2D6F },
+    { 0x2D80, 0x2D96 },
+    { 0x2DA0, 0x2DA6 },
+    { 0x2DA8, 0x2DAE },
+    { 0x2DB0, 0x2DB6 },
+    { 0x2DB8, 0x2DBE },
+    { 0x2DC0, 0x2DC6 },
+    { 0x2DC8, 0x2DCE },
+    { 0x2DD0, 0x2DD6 },
+    { 0x2DD8, 0x2DDE },
+    { 0x2E2F, 0x2E2F },
+    { 0x3005, 0x3007 },
+    { 0x3021, 0x3029 },
+    { 0x3031, 0x3035 },
+    { 0x3038, 0x303C },
+    { 0x3041, 0x3096 },
+    { 0x309D, 0x309F },
+    { 0x30A1, 0x30FA },
+    { 0x30FC, 0x30FF },
+    { 0x3105, 0x312F },
+    { 0x3131, 0x318E },
+    { 0x31A0, 0x31BF },
+    { 0x31F0, 0x31FF },
+    { 0x3400, 0x4DBF },
+    { 0x4E00, 0xA48C },
+    { 0xA4D0, 0xA4FD },
+    { 0xA500, 0xA60C },
+    { 0xA610, 0xA62B },
+    { 0xA640, 0xA66E },
+    { 0xA67F, 0xA69D },
+    { 0xA6A0, 0xA6EF },
+    { 0xA717, 0xA71F },
+    { 0xA722, 0xA788 },
+    { 0xA78B, 0xA7CA },
+    { 0xA7D0, 0xA7D1 },
+    { 0xA7D3, 0xA7D3 },
+    { 0xA7D5, 0xA7D9 },
+    { 0xA7F2, 0xA801 },
+    { 0xA803, 0xA805 },
+    { 0xA807, 0xA80A },
+    { 0xA80C, 0xA822 },
+    { 0xA840, 0xA873 },
+    { 0xA882, 0xA8B3 },
+    { 0xA8D0, 0xA8D9 },
+    { 0xA8F2, 0xA8F7 },
+    { 0xA8FB, 0xA8FB },
+    { 0xA8FD, 0xA8FE },
+    { 0xA900, 0xA925 },
+    { 0xA930, 0xA946 },
+    { 0xA960, 0xA97C },
+    { 0xA984, 0xA9B2 },
+    { 0xA9CF, 0xA9D9 },
+    { 0xA9E0, 0xA9E4 },
+    { 0xA9E6, 0xA9FE },
+    { 0xAA00, 0xAA28 },
+    { 0xAA40, 0xAA42 },
+    { 0xAA44, 0xAA4B },
+    { 0xAA50, 0xAA59 },
+    { 0xAA60, 0xAA76 },
+    { 0xAA7A, 0xAA7A },
+    { 0xAA7E, 0xAAAF },
+    { 0xAAB1, 0xAAB1 },
+    { 0xAAB5, 0xAAB6 },
+    { 0xAAB9, 0xAABD },
+    { 0xAAC0, 0xAAC0 },
+    { 0xAAC2, 0xAAC2 },
+    { 0xAADB, 0xAADD },
+    { 0xAAE0, 0xAAEA },
+    { 0xAAF2, 0xAAF4 },
+    { 0xAB01, 0xAB06 },
+    { 0xAB09, 0xAB0E },
+    { 0xAB11, 0xAB16 },
+    { 0xAB20, 0xAB26 },
+    { 0xAB28, 0xAB2E },
+    { 0xAB30, 0xAB5A },
+    { 0xAB5C, 0xAB69 },
+    { 0xAB70, 0xABE2 },
+    { 0xABF0, 0xABF9 },
+    { 0xAC00, 0xD7A3 },
+    { 0xD7B0, 0xD7C6 },
+    { 0xD7CB, 0xD7FB },
+    { 0xF900, 0xFA6D },
+    { 0xFA70, 0xFAD9 },
+    { 0xFB00, 0xFB06 },
+    { 0xFB13, 0xFB17 },
+    { 0xFB1D, 0xFB1D },
+    { 0xFB1F, 0xFB28 },
+    { 0xFB2A, 0xFB36 },
+    { 0xFB38, 0xFB3C },
+    { 0xFB3E, 0xFB3E },
+    { 0xFB40, 0xFB41 },
+    { 0xFB43, 0xFB44 },
+    { 0xFB46, 0xFBB1 },
+    { 0xFBD3, 0xFD3D },
+    { 0xFD50, 0xFD8F },
+    { 0xFD92, 0xFDC7 },
+    { 0xFDF0, 0xFDFB },
+    { 0xFE70, 0xFE74 },
+    { 0xFE76, 0xFEFC },
+    { 0xFF10, 0xFF19 },
+    { 0xFF21, 0xFF3A },
+    { 0xFF41, 0xFF5A },
+    { 0xFF66, 0xFFBE },
+    { 0xFFC2, 0xFFC7 },
+    { 0xFFCA, 0xFFCF },
+    { 0xFFD2, 0xFFD7 },
+    { 0xFFDA, 0xFFDC },
+    { 0x10000, 0x1000B },
+    { 0x1000D, 0x10026 },
+    { 0x10028, 0x1003A },
+    { 0x1003C, 0x1003D },
+    { 0x1003F, 0x1004D },
+    { 0x10050, 0x1005D },
+    { 0x10080, 0x100FA },
+    { 0x10140, 0x10174 },
+    { 0x10280, 0x1029C },
+    { 0x102A0, 0x102D0 },
+    { 0x10300, 0x1031F },
+    { 0x1032D, 0x1034A },
+    { 0x10350, 0x10375 },
+    { 0x10380, 0x1039D },
+    { 0x103A0, 0x103C3 },
+    { 0x103C8, 0x103CF },
+    { 0x103D1, 0x103D5 },
+    { 0x10400, 0x1049D },
+    { 0x104A0, 0x104A9 },
+    { 0x104B0, 0x104D3 },
+    { 0x104D8, 0x104FB },
+    { 0x10500, 0x10527 },
+    { 0x10530, 0x10563 },
+    { 0x10570, 0x1057A },
+    { 0x1057C, 0x1058A },
+    { 0x1058C, 0x10592 },
+    { 0x10594, 0x10595 },
+    { 0x10597, 0x105A1 },
+    { 0x105A3, 0x105B1 },
+    { 0x105B3, 0x105B9 },
+    { 0x105BB, 0x105BC },
+    { 0x10600, 0x10736 },
+    { 0x10740, 0x10755 },
+    { 0x10760, 0x10767 },
+    { 0x10780, 0x10785 },
+    { 0x10787, 0x107B0 },
+    { 0x107B2, 0x107BA },
+    { 0x10800, 0x10805 },
+    { 0x10808, 0x10808 },
+    { 0x1080A, 0x10835 },
+    { 0x10837, 0x10838 },
+    { 0x1083C, 0x1083C },
+    { 0x1083F, 0x10855 },
+    { 0x10860, 0x10876 },
+    { 0x10880, 0x1089E },
+    { 0x108E0, 0x108F2 },
+    { 0x108F4, 0x108F5 },
+    { 0x10900, 0x10915 },
+    { 0x10920, 0x10939 },
+    { 0x10980, 0x109B7 },
+    { 0x109BE, 0x109BF },
+    { 0x10A00, 0x10A00 },
+    { 0x10A10, 0x10A13 },
+    { 0x10A15, 0x10A17 },
+    { 0x10A19, 0x10A35 },
+    { 0x10A60, 0x10A7C },
+    { 0x10A80, 0x10A9C },
+    { 0x10AC0, 0x10AC7 },
+    { 0x10AC9, 0x10AE4 },
+    { 0x10B00, 0x10B35 },
+    { 0x10B40, 0x10B55 },
+    { 0x10B60, 0x10B72 },
+    { 0x10B80, 0x10B91 },
+    { 0x10C00, 0x10C48 },
+    { 0x10C80, 0x10CB2 },
+    { 0x10CC0, 0x10CF2 },
+    { 0x10D00, 0x10D23 },
+    { 0x10D30, 0x10D39 },
+    { 0x10E80, 0x10EA9 },
+    { 0x10EB0, 0x10EB1 },
+    { 0x10F00, 0x10F1C },
+    { 0x10F27, 0x10F27 },
+    { 0x10F30, 0x10F45 },
+    { 0x10F70, 0x10F81 },
+    { 0x10FB0, 0x10FC4 },
+    { 0x10FE0, 0x10FF6 },
+    { 0x11003, 0x11037 },
+    { 0x11066, 0x1106F },
+    { 0x11071, 0x11072 },
+    { 0x11075, 0x11075 },
+    { 0x11083, 0x110AF },
+    { 0x110D0, 0x110E8 },
+    { 0x110F0, 0x110F9 },
+    { 0x11103, 0x11126 },
+    { 0x11136, 0x1113F },
+    { 0x11144, 0x11144 },
+    { 0x11147, 0x11147 },
+    { 0x11150, 0x11172 },
+    { 0x11176, 0x11176 },
+    { 0x11183, 0x111B2 },
+    { 0x111C1, 0x111C4 },
+    { 0x111D0, 0x111DA },
+    { 0x111DC, 0x111DC },
+    { 0x11200, 0x11211 },
+    { 0x11213, 0x1122B },
+    { 0x1123F, 0x11240 },
+    { 0x11280, 0x11286 },
+    { 0x11288, 0x11288 },
+    { 0x1128A, 0x1128D },
+    { 0x1128F, 0x1129D },
+    { 0x1129F, 0x112A8 },
+    { 0x112B0, 0x112DE },
+    { 0x112F0, 0x112F9 },
+    { 0x11305, 0x1130C },
+    { 0x1130F, 0x11310 },
+    { 0x11313, 0x11328 },
+    { 0x1132A, 0x11330 },
+    { 0x11332, 0x11333 },
+    { 0x11335, 0x11339 },
+    { 0x1133D, 0x1133D },
+    { 0x11350, 0x11350 },
+    { 0x1135D, 0x11361 },
+    { 0x11400, 0x11434 },
+    { 0x11447, 0x1144A },
+    { 0x11450, 0x11459 },
+    { 0x1145F, 0x11461 },
+    { 0x11480, 0x114AF },
+    { 0x114C4, 0x114C5 },
+    { 0x114C7, 0x114C7 },
+    { 0x114D0, 0x114D9 },
+    { 0x11580, 0x115AE },
+    { 0x115D8, 0x115DB },
+    { 0x11600, 0x1162F },
+    { 0x11644, 0x11644 },
+    { 0x11650, 0x11659 },
+    { 0x11680, 0x116AA },
+    { 0x116B8, 0x116B8 },
+    { 0x116C0, 0x116C9 },
+    { 0x11700, 0x1171A },
+    { 0x11730, 0x11739 },
+    { 0x11740, 0x11746 },
+    { 0x11800, 0x1182B },
+    { 0x118A0, 0x118E9 },
+    { 0x118FF, 0x11906 },
+    { 0x11909, 0x11909 },
+    { 0x1190C, 0x11913 },
+    { 0x11915, 0x11916 },
+    { 0x11918, 0x1192F },
+    { 0x1193F, 0x1193F },
+    { 0x11941, 0x11941 },
+    { 0x11950, 0x11959 },
+    { 0x119A0, 0x119A7 },
+    { 0x119AA, 0x119D0 },
+    { 0x119E1, 0x119E1 },
+    { 0x119E3, 0x119E3 },
+    { 0x11A00, 0x11A00 },
+    { 0x11A0B, 0x11A32 },
+    { 0x11A3A, 0x11A3A },
+    { 0x11A50, 0x11A50 },
+    { 0x11A5C, 0x11A89 },
+    { 0x11A9D, 0x11A9D },
+    { 0x11AB0, 0x11AF8 },
+    { 0x11C00, 0x11C08 },
+    { 0x11C0A, 0x11C2E },
+    { 0x11C40, 0x11C40 },
+    { 0x11C50, 0x11C59 },
+    { 0x11C72, 0x11C8F },
+    { 0x11D00, 0x11D06 },
+    { 0x11D08, 0x11D09 },
+    { 0x11D0B, 0x11D30 },
+    { 0x11D46, 0x11D46 },
+    { 0x11D50, 0x11D59 },
+    { 0x11D60, 0x11D65 },
+    { 0x11D67, 0x11D68 },
+    { 0x11D6A, 0x11D89 },
+    { 0x11D98, 0x11D98 },
+    { 0x11DA0, 0x11DA9 },
+    { 0x11EE0, 0x11EF2 },
+    { 0x11F02, 0x11F02 },
+    { 0x11F04, 0x11F10 },
+    { 0x11F12, 0x11F33 },
+    { 0x11F50, 0x11F59 },
+    { 0x11FB0, 0x11FB0 },
+    { 0x12000, 0x12399 },
+    { 0x12400, 0x1246E },
+    { 0x12480, 0x12543 },
+    { 0x12F90, 0x12FF0 },
+    { 0x13000, 0x1342F },
+    { 0x13441, 0x13446 },
+    { 0x14400, 0x14646 },
+    { 0x16800, 0x16A38 },
+    { 0x16A40, 0x16A5E },
+    { 0x16A60, 0x16A69 },
+    { 0x16A70, 0x16ABE },
+    { 0x16AC0, 0x16AC9 },
+    { 0x16AD0, 0x16AED },
+    { 0x16B00, 0x16B2F },
+    { 0x16B40, 0x16B43 },
+    { 0x16B50, 0x16B59 },
+    { 0x16B63, 0x16B77 },
+    { 0x16B7D, 0x16B8F },
+    { 0x16E40, 0x16E7F },
+    { 0x16F00, 0x16F4A },
+    { 0x16F50, 0x16F50 },
+    { 0x16F93, 0x16F9F },
+    { 0x16FE0, 0x16FE1 },
+    { 0x16FE3, 0x16FE3 },
+    { 0x17000, 0x187F7 },
+    { 0x18800, 0x18CD5 },
+    { 0x18D00, 0x18D08 },
+    { 0x1AFF0, 0x1AFF3 },
+    { 0x1AFF5, 0x1AFFB },
+    { 0x1AFFD, 0x1AFFE },
+    { 0x1B000, 0x1B122 },
+    { 0x1B132, 0x1B132 },
+    { 0x1B150, 0x1B152 },
+    { 0x1B155, 0x1B155 },
+    { 0x1B164, 0x1B167 },
+    { 0x1B170, 0x1B2FB },
+    { 0x1BC00, 0x1BC6A },
+    { 0x1BC70, 0x1BC7C },
+    { 0x1BC80, 0x1BC88 },
+    { 0x1BC90, 0x1BC99 },
+    { 0x1D400, 0x1D454 },
+    { 0x1D456, 0x1D49C },
+    { 0x1D49E, 0x1D49F },
+    { 0x1D4A2, 0x1D4A2 },
+    { 0x1D4A5, 0x1D4A6 },
+    { 0x1D4A9, 0x1D4AC },
+    { 0x1D4AE, 0x1D4B9 },
+    { 0x1D4BB, 0x1D4BB },
+    { 0x1D4BD, 0x1D4C3 },
+    { 0x1D4C5, 0x1D505 },
+    { 0x1D507, 0x1D50A },
+    { 0x1D50D, 0x1D514 },
+    { 0x1D516, 0x1D51C },
+    { 0x1D51E, 0x1D539 },
+    { 0x1D53B, 0x1D53E },
+    { 0x1D540, 0x1D544 },
+    { 0x1D546, 0x1D546 },
+    { 0x1D54A, 0x1D550 },
+    { 0x1D552, 0x1D6A5 },
+    { 0x1D6A8, 0x1D6C0 },
+    { 0x1D6C2, 0x1D6DA },
+    { 0x1D6DC, 0x1D6FA },
+    { 0x1D6FC, 0x1D714 },
+    { 0x1D716, 0x1D734 },
+    { 0x1D736, 0x1D74E },
+    { 0x1D750, 0x1D76E },
+    { 0x1D770, 0x1D788 },
+    { 0x1D78A, 0x1D7A8 },
+    { 0x1D7AA, 0x1D7C2 },
+    { 0x1D7C4, 0x1D7CB },
+    { 0x1D7CE, 0x1D7FF },
+    { 0x1DF00, 0x1DF1E },
+    { 0x1DF25, 0x1DF2A },
+    { 0x1E030, 0x1E06D },
+    { 0x1E100, 0x1E12C },
+    { 0x1E137, 0x1E13D },
+    { 0x1E140, 0x1E149 },
+    { 0x1E14E, 0x1E14E },
+    { 0x1E290, 0x1E2AD },
+    { 0x1E2C0, 0x1E2EB },
+    { 0x1E2F0, 0x1E2F9 },
+    { 0x1E4D0, 0x1E4EB },
+    { 0x1E4F0, 0x1E4F9 },
+    { 0x1E7E0, 0x1E7E6 },
+    { 0x1E7E8, 0x1E7EB },
+    { 0x1E7ED, 0x1E7EE },
+    { 0x1E7F0, 0x1E7FE },
+    { 0x1E800, 0x1E8C4 },
+    { 0x1E900, 0x1E943 },
+    { 0x1E94B, 0x1E94B },
+    { 0x1E950, 0x1E959 },
+    { 0x1EE00, 0x1EE03 },
+    { 0x1EE05, 0x1EE1F },
+    { 0x1EE21, 0x1EE22 },
+    { 0x1EE24, 0x1EE24 },
+    { 0x1EE27, 0x1EE27 },
+    { 0x1EE29, 0x1EE32 },
+    { 0x1EE34, 0x1EE37 },
+    { 0x1EE39, 0x1EE39 },
+    { 0x1EE3B, 0x1EE3B },
+    { 0x1EE42, 0x1EE42 },
+    { 0x1EE47, 0x1EE47 },
+    { 0x1EE49, 0x1EE49 },
+    { 0x1EE4B, 0x1EE4B },
+    { 0x1EE4D, 0x1EE4F },
+    { 0x1EE51, 0x1EE52 },
+    { 0x1EE54, 0x1EE54 },
+    { 0x1EE57, 0x1EE57 },
+    { 0x1EE59, 0x1EE59 },
+    { 0x1EE5B, 0x1EE5B },
+    { 0x1EE5D, 0x1EE5D },
+    { 0x1EE5F, 0x1EE5F },
+    { 0x1EE61, 0x1EE62 },
+    { 0x1EE64, 0x1EE64 },
+    { 0x1EE67, 0x1EE6A },
+    { 0x1EE6C, 0x1EE72 },
+    { 0x1EE74, 0x1EE77 },
+    { 0x1EE79, 0x1EE7C },
+    { 0x1EE7E, 0x1EE7E },
+    { 0x1EE80, 0x1EE89 },
+    { 0x1EE8B, 0x1EE9B },
+    { 0x1EEA1, 0x1EEA3 },
+    { 0x1EEA5, 0x1EEA9 },
+    { 0x1EEAB, 0x1EEBB },
+    { 0x1F110, 0x1F12C },
+    { 0x1F130, 0x1F149 },
+    { 0x1F150, 0x1F169 },
+    { 0x1F170, 0x1F18A },
+    { 0x1F1A5, 0x1F1A5 },
+    { 0x1F1E6, 0x1F1FF },
+    { 0x1FBF0, 0x1FBF9 },
+    { 0x20000, 0x2A6DF },
+    { 0x2A700, 0x2B739 },
+    { 0x2B740, 0x2B81D },
+    { 0x2B820, 0x2CEA1 },
+    { 0x2CEB0, 0x2EBE0 },
+    { 0x2F800, 0x2FA1D },
+    { 0x30000, 0x3134A },
+    { 0x31350, 0x323AF }
+
+#define PREDICATE(c) uc_is_alpha (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index 448a7a906ec23ae3094c43726c125b250530e2e1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_blank.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4824fe73cf2c04ca24362e83a704cd048e200e6f
--- /dev/null
@@ -0,0 +1,29 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0009, 0x0009 },
+    { 0x0020, 0x0020 },
+    { 0x1680, 0x1680 },
+    { 0x2000, 0x2006 },
+    { 0x2008, 0x200A },
+    { 0x205F, 0x205F },
+    { 0x3000, 0x3000 }
+
+#define PREDICATE(c) uc_is_blank (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index 7ceb308e482bdb44619d60dd0b85c0be9caeec49..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_cntrl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d32c701d97cfd2e7bbc052300d94990ad4417569
--- /dev/null
@@ -0,0 +1,25 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0000, 0x001F },
+    { 0x007F, 0x009F },
+    { 0x2028, 0x2029 }
+
+#define PREDICATE(c) uc_is_cntrl (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index a174c6d6230a2241b13a0296d426b9a55ea8ba51..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_digit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ccda557f2776ed42a032398d406bc8a4efb73011
--- /dev/null
@@ -0,0 +1,23 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0030, 0x0039 }
+
+#define PREDICATE(c) uc_is_digit (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index c4066e923423832d22cd1d55da8b658a7dd575e8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_graph.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..16ab878afe43ff5703abd875a80fb63b43603a4d
--- /dev/null
@@ -0,0 +1,734 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0021, 0x007E },
+    { 0x00A0, 0x0377 },
+    { 0x037A, 0x037F },
+    { 0x0384, 0x038A },
+    { 0x038C, 0x038C },
+    { 0x038E, 0x03A1 },
+    { 0x03A3, 0x052F },
+    { 0x0531, 0x0556 },
+    { 0x0559, 0x058A },
+    { 0x058D, 0x058F },
+    { 0x0591, 0x05C7 },
+    { 0x05D0, 0x05EA },
+    { 0x05EF, 0x05F4 },
+    { 0x0600, 0x070D },
+    { 0x070F, 0x074A },
+    { 0x074D, 0x07B1 },
+    { 0x07C0, 0x07FA },
+    { 0x07FD, 0x082D },
+    { 0x0830, 0x083E },
+    { 0x0840, 0x085B },
+    { 0x085E, 0x085E },
+    { 0x0860, 0x086A },
+    { 0x0870, 0x088E },
+    { 0x0890, 0x0891 },
+    { 0x0898, 0x0983 },
+    { 0x0985, 0x098C },
+    { 0x098F, 0x0990 },
+    { 0x0993, 0x09A8 },
+    { 0x09AA, 0x09B0 },
+    { 0x09B2, 0x09B2 },
+    { 0x09B6, 0x09B9 },
+    { 0x09BC, 0x09C4 },
+    { 0x09C7, 0x09C8 },
+    { 0x09CB, 0x09CE },
+    { 0x09D7, 0x09D7 },
+    { 0x09DC, 0x09DD },
+    { 0x09DF, 0x09E3 },
+    { 0x09E6, 0x09FE },
+    { 0x0A01, 0x0A03 },
+    { 0x0A05, 0x0A0A },
+    { 0x0A0F, 0x0A10 },
+    { 0x0A13, 0x0A28 },
+    { 0x0A2A, 0x0A30 },
+    { 0x0A32, 0x0A33 },
+    { 0x0A35, 0x0A36 },
+    { 0x0A38, 0x0A39 },
+    { 0x0A3C, 0x0A3C },
+    { 0x0A3E, 0x0A42 },
+    { 0x0A47, 0x0A48 },
+    { 0x0A4B, 0x0A4D },
+    { 0x0A51, 0x0A51 },
+    { 0x0A59, 0x0A5C },
+    { 0x0A5E, 0x0A5E },
+    { 0x0A66, 0x0A76 },
+    { 0x0A81, 0x0A83 },
+    { 0x0A85, 0x0A8D },
+    { 0x0A8F, 0x0A91 },
+    { 0x0A93, 0x0AA8 },
+    { 0x0AAA, 0x0AB0 },
+    { 0x0AB2, 0x0AB3 },
+    { 0x0AB5, 0x0AB9 },
+    { 0x0ABC, 0x0AC5 },
+    { 0x0AC7, 0x0AC9 },
+    { 0x0ACB, 0x0ACD },
+    { 0x0AD0, 0x0AD0 },
+    { 0x0AE0, 0x0AE3 },
+    { 0x0AE6, 0x0AF1 },
+    { 0x0AF9, 0x0AFF },
+    { 0x0B01, 0x0B03 },
+    { 0x0B05, 0x0B0C },
+    { 0x0B0F, 0x0B10 },
+    { 0x0B13, 0x0B28 },
+    { 0x0B2A, 0x0B30 },
+    { 0x0B32, 0x0B33 },
+    { 0x0B35, 0x0B39 },
+    { 0x0B3C, 0x0B44 },
+    { 0x0B47, 0x0B48 },
+    { 0x0B4B, 0x0B4D },
+    { 0x0B55, 0x0B57 },
+    { 0x0B5C, 0x0B5D },
+    { 0x0B5F, 0x0B63 },
+    { 0x0B66, 0x0B77 },
+    { 0x0B82, 0x0B83 },
+    { 0x0B85, 0x0B8A },
+    { 0x0B8E, 0x0B90 },
+    { 0x0B92, 0x0B95 },
+    { 0x0B99, 0x0B9A },
+    { 0x0B9C, 0x0B9C },
+    { 0x0B9E, 0x0B9F },
+    { 0x0BA3, 0x0BA4 },
+    { 0x0BA8, 0x0BAA },
+    { 0x0BAE, 0x0BB9 },
+    { 0x0BBE, 0x0BC2 },
+    { 0x0BC6, 0x0BC8 },
+    { 0x0BCA, 0x0BCD },
+    { 0x0BD0, 0x0BD0 },
+    { 0x0BD7, 0x0BD7 },
+    { 0x0BE6, 0x0BFA },
+    { 0x0C00, 0x0C0C },
+    { 0x0C0E, 0x0C10 },
+    { 0x0C12, 0x0C28 },
+    { 0x0C2A, 0x0C39 },
+    { 0x0C3C, 0x0C44 },
+    { 0x0C46, 0x0C48 },
+    { 0x0C4A, 0x0C4D },
+    { 0x0C55, 0x0C56 },
+    { 0x0C58, 0x0C5A },
+    { 0x0C5D, 0x0C5D },
+    { 0x0C60, 0x0C63 },
+    { 0x0C66, 0x0C6F },
+    { 0x0C77, 0x0C8C },
+    { 0x0C8E, 0x0C90 },
+    { 0x0C92, 0x0CA8 },
+    { 0x0CAA, 0x0CB3 },
+    { 0x0CB5, 0x0CB9 },
+    { 0x0CBC, 0x0CC4 },
+    { 0x0CC6, 0x0CC8 },
+    { 0x0CCA, 0x0CCD },
+    { 0x0CD5, 0x0CD6 },
+    { 0x0CDD, 0x0CDE },
+    { 0x0CE0, 0x0CE3 },
+    { 0x0CE6, 0x0CEF },
+    { 0x0CF1, 0x0CF3 },
+    { 0x0D00, 0x0D0C },
+    { 0x0D0E, 0x0D10 },
+    { 0x0D12, 0x0D44 },
+    { 0x0D46, 0x0D48 },
+    { 0x0D4A, 0x0D4F },
+    { 0x0D54, 0x0D63 },
+    { 0x0D66, 0x0D7F },
+    { 0x0D81, 0x0D83 },
+    { 0x0D85, 0x0D96 },
+    { 0x0D9A, 0x0DB1 },
+    { 0x0DB3, 0x0DBB },
+    { 0x0DBD, 0x0DBD },
+    { 0x0DC0, 0x0DC6 },
+    { 0x0DCA, 0x0DCA },
+    { 0x0DCF, 0x0DD4 },
+    { 0x0DD6, 0x0DD6 },
+    { 0x0DD8, 0x0DDF },
+    { 0x0DE6, 0x0DEF },
+    { 0x0DF2, 0x0DF4 },
+    { 0x0E01, 0x0E3A },
+    { 0x0E3F, 0x0E5B },
+    { 0x0E81, 0x0E82 },
+    { 0x0E84, 0x0E84 },
+    { 0x0E86, 0x0E8A },
+    { 0x0E8C, 0x0EA3 },
+    { 0x0EA5, 0x0EA5 },
+    { 0x0EA7, 0x0EBD },
+    { 0x0EC0, 0x0EC4 },
+    { 0x0EC6, 0x0EC6 },
+    { 0x0EC8, 0x0ECE },
+    { 0x0ED0, 0x0ED9 },
+    { 0x0EDC, 0x0EDF },
+    { 0x0F00, 0x0F47 },
+    { 0x0F49, 0x0F6C },
+    { 0x0F71, 0x0F97 },
+    { 0x0F99, 0x0FBC },
+    { 0x0FBE, 0x0FCC },
+    { 0x0FCE, 0x0FDA },
+    { 0x1000, 0x10C5 },
+    { 0x10C7, 0x10C7 },
+    { 0x10CD, 0x10CD },
+    { 0x10D0, 0x1248 },
+    { 0x124A, 0x124D },
+    { 0x1250, 0x1256 },
+    { 0x1258, 0x1258 },
+    { 0x125A, 0x125D },
+    { 0x1260, 0x1288 },
+    { 0x128A, 0x128D },
+    { 0x1290, 0x12B0 },
+    { 0x12B2, 0x12B5 },
+    { 0x12B8, 0x12BE },
+    { 0x12C0, 0x12C0 },
+    { 0x12C2, 0x12C5 },
+    { 0x12C8, 0x12D6 },
+    { 0x12D8, 0x1310 },
+    { 0x1312, 0x1315 },
+    { 0x1318, 0x135A },
+    { 0x135D, 0x137C },
+    { 0x1380, 0x1399 },
+    { 0x13A0, 0x13F5 },
+    { 0x13F8, 0x13FD },
+    { 0x1400, 0x167F },
+    { 0x1681, 0x169C },
+    { 0x16A0, 0x16F8 },
+    { 0x1700, 0x1715 },
+    { 0x171F, 0x1736 },
+    { 0x1740, 0x1753 },
+    { 0x1760, 0x176C },
+    { 0x176E, 0x1770 },
+    { 0x1772, 0x1773 },
+    { 0x1780, 0x17DD },
+    { 0x17E0, 0x17E9 },
+    { 0x17F0, 0x17F9 },
+    { 0x1800, 0x1819 },
+    { 0x1820, 0x1878 },
+    { 0x1880, 0x18AA },
+    { 0x18B0, 0x18F5 },
+    { 0x1900, 0x191E },
+    { 0x1920, 0x192B },
+    { 0x1930, 0x193B },
+    { 0x1940, 0x1940 },
+    { 0x1944, 0x196D },
+    { 0x1970, 0x1974 },
+    { 0x1980, 0x19AB },
+    { 0x19B0, 0x19C9 },
+    { 0x19D0, 0x19DA },
+    { 0x19DE, 0x1A1B },
+    { 0x1A1E, 0x1A5E },
+    { 0x1A60, 0x1A7C },
+    { 0x1A7F, 0x1A89 },
+    { 0x1A90, 0x1A99 },
+    { 0x1AA0, 0x1AAD },
+    { 0x1AB0, 0x1ACE },
+    { 0x1B00, 0x1B4C },
+    { 0x1B50, 0x1B7E },
+    { 0x1B80, 0x1BF3 },
+    { 0x1BFC, 0x1C37 },
+    { 0x1C3B, 0x1C49 },
+    { 0x1C4D, 0x1C88 },
+    { 0x1C90, 0x1CBA },
+    { 0x1CBD, 0x1CC7 },
+    { 0x1CD0, 0x1CFA },
+    { 0x1D00, 0x1F15 },
+    { 0x1F18, 0x1F1D },
+    { 0x1F20, 0x1F45 },
+    { 0x1F48, 0x1F4D },
+    { 0x1F50, 0x1F57 },
+    { 0x1F59, 0x1F59 },
+    { 0x1F5B, 0x1F5B },
+    { 0x1F5D, 0x1F5D },
+    { 0x1F5F, 0x1F7D },
+    { 0x1F80, 0x1FB4 },
+    { 0x1FB6, 0x1FC4 },
+    { 0x1FC6, 0x1FD3 },
+    { 0x1FD6, 0x1FDB },
+    { 0x1FDD, 0x1FEF },
+    { 0x1FF2, 0x1FF4 },
+    { 0x1FF6, 0x1FFE },
+    { 0x2007, 0x2007 },
+    { 0x200B, 0x2027 },
+    { 0x202A, 0x205E },
+    { 0x2060, 0x2064 },
+    { 0x2066, 0x2071 },
+    { 0x2074, 0x208E },
+    { 0x2090, 0x209C },
+    { 0x20A0, 0x20C0 },
+    { 0x20D0, 0x20F0 },
+    { 0x2100, 0x218B },
+    { 0x2190, 0x2426 },
+    { 0x2440, 0x244A },
+    { 0x2460, 0x2B73 },
+    { 0x2B76, 0x2B95 },
+    { 0x2B97, 0x2CF3 },
+    { 0x2CF9, 0x2D25 },
+    { 0x2D27, 0x2D27 },
+    { 0x2D2D, 0x2D2D },
+    { 0x2D30, 0x2D67 },
+    { 0x2D6F, 0x2D70 },
+    { 0x2D7F, 0x2D96 },
+    { 0x2DA0, 0x2DA6 },
+    { 0x2DA8, 0x2DAE },
+    { 0x2DB0, 0x2DB6 },
+    { 0x2DB8, 0x2DBE },
+    { 0x2DC0, 0x2DC6 },
+    { 0x2DC8, 0x2DCE },
+    { 0x2DD0, 0x2DD6 },
+    { 0x2DD8, 0x2DDE },
+    { 0x2DE0, 0x2E5D },
+    { 0x2E80, 0x2E99 },
+    { 0x2E9B, 0x2EF3 },
+    { 0x2F00, 0x2FD5 },
+    { 0x2FF0, 0x2FFB },
+    { 0x3001, 0x303F },
+    { 0x3041, 0x3096 },
+    { 0x3099, 0x30FF },
+    { 0x3105, 0x312F },
+    { 0x3131, 0x318E },
+    { 0x3190, 0x31E3 },
+    { 0x31F0, 0x321E },
+    { 0x3220, 0xA48C },
+    { 0xA490, 0xA4C6 },
+    { 0xA4D0, 0xA62B },
+    { 0xA640, 0xA6F7 },
+    { 0xA700, 0xA7CA },
+    { 0xA7D0, 0xA7D1 },
+    { 0xA7D3, 0xA7D3 },
+    { 0xA7D5, 0xA7D9 },
+    { 0xA7F2, 0xA82C },
+    { 0xA830, 0xA839 },
+    { 0xA840, 0xA877 },
+    { 0xA880, 0xA8C5 },
+    { 0xA8CE, 0xA8D9 },
+    { 0xA8E0, 0xA953 },
+    { 0xA95F, 0xA97C },
+    { 0xA980, 0xA9CD },
+    { 0xA9CF, 0xA9D9 },
+    { 0xA9DE, 0xA9FE },
+    { 0xAA00, 0xAA36 },
+    { 0xAA40, 0xAA4D },
+    { 0xAA50, 0xAA59 },
+    { 0xAA5C, 0xAAC2 },
+    { 0xAADB, 0xAAF6 },
+    { 0xAB01, 0xAB06 },
+    { 0xAB09, 0xAB0E },
+    { 0xAB11, 0xAB16 },
+    { 0xAB20, 0xAB26 },
+    { 0xAB28, 0xAB2E },
+    { 0xAB30, 0xAB6B },
+    { 0xAB70, 0xABED },
+    { 0xABF0, 0xABF9 },
+    { 0xAC00, 0xD7A3 },
+    { 0xD7B0, 0xD7C6 },
+    { 0xD7CB, 0xD7FB },
+    { 0xE000, 0xFA6D },
+    { 0xFA70, 0xFAD9 },
+    { 0xFB00, 0xFB06 },
+    { 0xFB13, 0xFB17 },
+    { 0xFB1D, 0xFB36 },
+    { 0xFB38, 0xFB3C },
+    { 0xFB3E, 0xFB3E },
+    { 0xFB40, 0xFB41 },
+    { 0xFB43, 0xFB44 },
+    { 0xFB46, 0xFBC2 },
+    { 0xFBD3, 0xFD8F },
+    { 0xFD92, 0xFDC7 },
+    { 0xFDCF, 0xFDCF },
+    { 0xFDF0, 0xFE19 },
+    { 0xFE20, 0xFE52 },
+    { 0xFE54, 0xFE66 },
+    { 0xFE68, 0xFE6B },
+    { 0xFE70, 0xFE74 },
+    { 0xFE76, 0xFEFC },
+    { 0xFEFF, 0xFEFF },
+    { 0xFF01, 0xFFBE },
+    { 0xFFC2, 0xFFC7 },
+    { 0xFFCA, 0xFFCF },
+    { 0xFFD2, 0xFFD7 },
+    { 0xFFDA, 0xFFDC },
+    { 0xFFE0, 0xFFE6 },
+    { 0xFFE8, 0xFFEE },
+    { 0xFFF9, 0xFFFD },
+    { 0x10000, 0x1000B },
+    { 0x1000D, 0x10026 },
+    { 0x10028, 0x1003A },
+    { 0x1003C, 0x1003D },
+    { 0x1003F, 0x1004D },
+    { 0x10050, 0x1005D },
+    { 0x10080, 0x100FA },
+    { 0x10100, 0x10102 },
+    { 0x10107, 0x10133 },
+    { 0x10137, 0x1018E },
+    { 0x10190, 0x1019C },
+    { 0x101A0, 0x101A0 },
+    { 0x101D0, 0x101FD },
+    { 0x10280, 0x1029C },
+    { 0x102A0, 0x102D0 },
+    { 0x102E0, 0x102FB },
+    { 0x10300, 0x10323 },
+    { 0x1032D, 0x1034A },
+    { 0x10350, 0x1037A },
+    { 0x10380, 0x1039D },
+    { 0x1039F, 0x103C3 },
+    { 0x103C8, 0x103D5 },
+    { 0x10400, 0x1049D },
+    { 0x104A0, 0x104A9 },
+    { 0x104B0, 0x104D3 },
+    { 0x104D8, 0x104FB },
+    { 0x10500, 0x10527 },
+    { 0x10530, 0x10563 },
+    { 0x1056F, 0x1057A },
+    { 0x1057C, 0x1058A },
+    { 0x1058C, 0x10592 },
+    { 0x10594, 0x10595 },
+    { 0x10597, 0x105A1 },
+    { 0x105A3, 0x105B1 },
+    { 0x105B3, 0x105B9 },
+    { 0x105BB, 0x105BC },
+    { 0x10600, 0x10736 },
+    { 0x10740, 0x10755 },
+    { 0x10760, 0x10767 },
+    { 0x10780, 0x10785 },
+    { 0x10787, 0x107B0 },
+    { 0x107B2, 0x107BA },
+    { 0x10800, 0x10805 },
+    { 0x10808, 0x10808 },
+    { 0x1080A, 0x10835 },
+    { 0x10837, 0x10838 },
+    { 0x1083C, 0x1083C },
+    { 0x1083F, 0x10855 },
+    { 0x10857, 0x1089E },
+    { 0x108A7, 0x108AF },
+    { 0x108E0, 0x108F2 },
+    { 0x108F4, 0x108F5 },
+    { 0x108FB, 0x1091B },
+    { 0x1091F, 0x10939 },
+    { 0x1093F, 0x1093F },
+    { 0x10980, 0x109B7 },
+    { 0x109BC, 0x109CF },
+    { 0x109D2, 0x10A03 },
+    { 0x10A05, 0x10A06 },
+    { 0x10A0C, 0x10A13 },
+    { 0x10A15, 0x10A17 },
+    { 0x10A19, 0x10A35 },
+    { 0x10A38, 0x10A3A },
+    { 0x10A3F, 0x10A48 },
+    { 0x10A50, 0x10A58 },
+    { 0x10A60, 0x10A9F },
+    { 0x10AC0, 0x10AE6 },
+    { 0x10AEB, 0x10AF6 },
+    { 0x10B00, 0x10B35 },
+    { 0x10B39, 0x10B55 },
+    { 0x10B58, 0x10B72 },
+    { 0x10B78, 0x10B91 },
+    { 0x10B99, 0x10B9C },
+    { 0x10BA9, 0x10BAF },
+    { 0x10C00, 0x10C48 },
+    { 0x10C80, 0x10CB2 },
+    { 0x10CC0, 0x10CF2 },
+    { 0x10CFA, 0x10D27 },
+    { 0x10D30, 0x10D39 },
+    { 0x10E60, 0x10E7E },
+    { 0x10E80, 0x10EA9 },
+    { 0x10EAB, 0x10EAD },
+    { 0x10EB0, 0x10EB1 },
+    { 0x10EFD, 0x10F27 },
+    { 0x10F30, 0x10F59 },
+    { 0x10F70, 0x10F89 },
+    { 0x10FB0, 0x10FCB },
+    { 0x10FE0, 0x10FF6 },
+    { 0x11000, 0x1104D },
+    { 0x11052, 0x11075 },
+    { 0x1107F, 0x110C2 },
+    { 0x110CD, 0x110CD },
+    { 0x110D0, 0x110E8 },
+    { 0x110F0, 0x110F9 },
+    { 0x11100, 0x11134 },
+    { 0x11136, 0x11147 },
+    { 0x11150, 0x11176 },
+    { 0x11180, 0x111DF },
+    { 0x111E1, 0x111F4 },
+    { 0x11200, 0x11211 },
+    { 0x11213, 0x11241 },
+    { 0x11280, 0x11286 },
+    { 0x11288, 0x11288 },
+    { 0x1128A, 0x1128D },
+    { 0x1128F, 0x1129D },
+    { 0x1129F, 0x112A9 },
+    { 0x112B0, 0x112EA },
+    { 0x112F0, 0x112F9 },
+    { 0x11300, 0x11303 },
+    { 0x11305, 0x1130C },
+    { 0x1130F, 0x11310 },
+    { 0x11313, 0x11328 },
+    { 0x1132A, 0x11330 },
+    { 0x11332, 0x11333 },
+    { 0x11335, 0x11339 },
+    { 0x1133B, 0x11344 },
+    { 0x11347, 0x11348 },
+    { 0x1134B, 0x1134D },
+    { 0x11350, 0x11350 },
+    { 0x11357, 0x11357 },
+    { 0x1135D, 0x11363 },
+    { 0x11366, 0x1136C },
+    { 0x11370, 0x11374 },
+    { 0x11400, 0x1145B },
+    { 0x1145D, 0x11461 },
+    { 0x11480, 0x114C7 },
+    { 0x114D0, 0x114D9 },
+    { 0x11580, 0x115B5 },
+    { 0x115B8, 0x115DD },
+    { 0x11600, 0x11644 },
+    { 0x11650, 0x11659 },
+    { 0x11660, 0x1166C },
+    { 0x11680, 0x116B9 },
+    { 0x116C0, 0x116C9 },
+    { 0x11700, 0x1171A },
+    { 0x1171D, 0x1172B },
+    { 0x11730, 0x11746 },
+    { 0x11800, 0x1183B },
+    { 0x118A0, 0x118F2 },
+    { 0x118FF, 0x11906 },
+    { 0x11909, 0x11909 },
+    { 0x1190C, 0x11913 },
+    { 0x11915, 0x11916 },
+    { 0x11918, 0x11935 },
+    { 0x11937, 0x11938 },
+    { 0x1193B, 0x11946 },
+    { 0x11950, 0x11959 },
+    { 0x119A0, 0x119A7 },
+    { 0x119AA, 0x119D7 },
+    { 0x119DA, 0x119E4 },
+    { 0x11A00, 0x11A47 },
+    { 0x11A50, 0x11AA2 },
+    { 0x11AB0, 0x11AF8 },
+    { 0x11B00, 0x11B09 },
+    { 0x11C00, 0x11C08 },
+    { 0x11C0A, 0x11C36 },
+    { 0x11C38, 0x11C45 },
+    { 0x11C50, 0x11C6C },
+    { 0x11C70, 0x11C8F },
+    { 0x11C92, 0x11CA7 },
+    { 0x11CA9, 0x11CB6 },
+    { 0x11D00, 0x11D06 },
+    { 0x11D08, 0x11D09 },
+    { 0x11D0B, 0x11D36 },
+    { 0x11D3A, 0x11D3A },
+    { 0x11D3C, 0x11D3D },
+    { 0x11D3F, 0x11D47 },
+    { 0x11D50, 0x11D59 },
+    { 0x11D60, 0x11D65 },
+    { 0x11D67, 0x11D68 },
+    { 0x11D6A, 0x11D8E },
+    { 0x11D90, 0x11D91 },
+    { 0x11D93, 0x11D98 },
+    { 0x11DA0, 0x11DA9 },
+    { 0x11EE0, 0x11EF8 },
+    { 0x11F00, 0x11F10 },
+    { 0x11F12, 0x11F3A },
+    { 0x11F3E, 0x11F59 },
+    { 0x11FB0, 0x11FB0 },
+    { 0x11FC0, 0x11FF1 },
+    { 0x11FFF, 0x12399 },
+    { 0x12400, 0x1246E },
+    { 0x12470, 0x12474 },
+    { 0x12480, 0x12543 },
+    { 0x12F90, 0x12FF2 },
+    { 0x13000, 0x13455 },
+    { 0x14400, 0x14646 },
+    { 0x16800, 0x16A38 },
+    { 0x16A40, 0x16A5E },
+    { 0x16A60, 0x16A69 },
+    { 0x16A6E, 0x16ABE },
+    { 0x16AC0, 0x16AC9 },
+    { 0x16AD0, 0x16AED },
+    { 0x16AF0, 0x16AF5 },
+    { 0x16B00, 0x16B45 },
+    { 0x16B50, 0x16B59 },
+    { 0x16B5B, 0x16B61 },
+    { 0x16B63, 0x16B77 },
+    { 0x16B7D, 0x16B8F },
+    { 0x16E40, 0x16E9A },
+    { 0x16F00, 0x16F4A },
+    { 0x16F4F, 0x16F87 },
+    { 0x16F8F, 0x16F9F },
+    { 0x16FE0, 0x16FE4 },
+    { 0x16FF0, 0x16FF1 },
+    { 0x17000, 0x187F7 },
+    { 0x18800, 0x18CD5 },
+    { 0x18D00, 0x18D08 },
+    { 0x1AFF0, 0x1AFF3 },
+    { 0x1AFF5, 0x1AFFB },
+    { 0x1AFFD, 0x1AFFE },
+    { 0x1B000, 0x1B122 },
+    { 0x1B132, 0x1B132 },
+    { 0x1B150, 0x1B152 },
+    { 0x1B155, 0x1B155 },
+    { 0x1B164, 0x1B167 },
+    { 0x1B170, 0x1B2FB },
+    { 0x1BC00, 0x1BC6A },
+    { 0x1BC70, 0x1BC7C },
+    { 0x1BC80, 0x1BC88 },
+    { 0x1BC90, 0x1BC99 },
+    { 0x1BC9C, 0x1BCA3 },
+    { 0x1CF00, 0x1CF2D },
+    { 0x1CF30, 0x1CF46 },
+    { 0x1CF50, 0x1CFC3 },
+    { 0x1D000, 0x1D0F5 },
+    { 0x1D100, 0x1D126 },
+    { 0x1D129, 0x1D1EA },
+    { 0x1D200, 0x1D245 },
+    { 0x1D2C0, 0x1D2D3 },
+    { 0x1D2E0, 0x1D2F3 },
+    { 0x1D300, 0x1D356 },
+    { 0x1D360, 0x1D378 },
+    { 0x1D400, 0x1D454 },
+    { 0x1D456, 0x1D49C },
+    { 0x1D49E, 0x1D49F },
+    { 0x1D4A2, 0x1D4A2 },
+    { 0x1D4A5, 0x1D4A6 },
+    { 0x1D4A9, 0x1D4AC },
+    { 0x1D4AE, 0x1D4B9 },
+    { 0x1D4BB, 0x1D4BB },
+    { 0x1D4BD, 0x1D4C3 },
+    { 0x1D4C5, 0x1D505 },
+    { 0x1D507, 0x1D50A },
+    { 0x1D50D, 0x1D514 },
+    { 0x1D516, 0x1D51C },
+    { 0x1D51E, 0x1D539 },
+    { 0x1D53B, 0x1D53E },
+    { 0x1D540, 0x1D544 },
+    { 0x1D546, 0x1D546 },
+    { 0x1D54A, 0x1D550 },
+    { 0x1D552, 0x1D6A5 },
+    { 0x1D6A8, 0x1D7CB },
+    { 0x1D7CE, 0x1DA8B },
+    { 0x1DA9B, 0x1DA9F },
+    { 0x1DAA1, 0x1DAAF },
+    { 0x1DF00, 0x1DF1E },
+    { 0x1DF25, 0x1DF2A },
+    { 0x1E000, 0x1E006 },
+    { 0x1E008, 0x1E018 },
+    { 0x1E01B, 0x1E021 },
+    { 0x1E023, 0x1E024 },
+    { 0x1E026, 0x1E02A },
+    { 0x1E030, 0x1E06D },
+    { 0x1E08F, 0x1E08F },
+    { 0x1E100, 0x1E12C },
+    { 0x1E130, 0x1E13D },
+    { 0x1E140, 0x1E149 },
+    { 0x1E14E, 0x1E14F },
+    { 0x1E290, 0x1E2AE },
+    { 0x1E2C0, 0x1E2F9 },
+    { 0x1E2FF, 0x1E2FF },
+    { 0x1E4D0, 0x1E4F9 },
+    { 0x1E7E0, 0x1E7E6 },
+    { 0x1E7E8, 0x1E7EB },
+    { 0x1E7ED, 0x1E7EE },
+    { 0x1E7F0, 0x1E7FE },
+    { 0x1E800, 0x1E8C4 },
+    { 0x1E8C7, 0x1E8D6 },
+    { 0x1E900, 0x1E94B },
+    { 0x1E950, 0x1E959 },
+    { 0x1E95E, 0x1E95F },
+    { 0x1EC71, 0x1ECB4 },
+    { 0x1ED01, 0x1ED3D },
+    { 0x1EE00, 0x1EE03 },
+    { 0x1EE05, 0x1EE1F },
+    { 0x1EE21, 0x1EE22 },
+    { 0x1EE24, 0x1EE24 },
+    { 0x1EE27, 0x1EE27 },
+    { 0x1EE29, 0x1EE32 },
+    { 0x1EE34, 0x1EE37 },
+    { 0x1EE39, 0x1EE39 },
+    { 0x1EE3B, 0x1EE3B },
+    { 0x1EE42, 0x1EE42 },
+    { 0x1EE47, 0x1EE47 },
+    { 0x1EE49, 0x1EE49 },
+    { 0x1EE4B, 0x1EE4B },
+    { 0x1EE4D, 0x1EE4F },
+    { 0x1EE51, 0x1EE52 },
+    { 0x1EE54, 0x1EE54 },
+    { 0x1EE57, 0x1EE57 },
+    { 0x1EE59, 0x1EE59 },
+    { 0x1EE5B, 0x1EE5B },
+    { 0x1EE5D, 0x1EE5D },
+    { 0x1EE5F, 0x1EE5F },
+    { 0x1EE61, 0x1EE62 },
+    { 0x1EE64, 0x1EE64 },
+    { 0x1EE67, 0x1EE6A },
+    { 0x1EE6C, 0x1EE72 },
+    { 0x1EE74, 0x1EE77 },
+    { 0x1EE79, 0x1EE7C },
+    { 0x1EE7E, 0x1EE7E },
+    { 0x1EE80, 0x1EE89 },
+    { 0x1EE8B, 0x1EE9B },
+    { 0x1EEA1, 0x1EEA3 },
+    { 0x1EEA5, 0x1EEA9 },
+    { 0x1EEAB, 0x1EEBB },
+    { 0x1EEF0, 0x1EEF1 },
+    { 0x1F000, 0x1F02B },
+    { 0x1F030, 0x1F093 },
+    { 0x1F0A0, 0x1F0AE },
+    { 0x1F0B1, 0x1F0BF },
+    { 0x1F0C1, 0x1F0CF },
+    { 0x1F0D1, 0x1F0F5 },
+    { 0x1F100, 0x1F1AD },
+    { 0x1F1E6, 0x1F202 },
+    { 0x1F210, 0x1F23B },
+    { 0x1F240, 0x1F248 },
+    { 0x1F250, 0x1F251 },
+    { 0x1F260, 0x1F265 },
+    { 0x1F300, 0x1F6D7 },
+    { 0x1F6DC, 0x1F6EC },
+    { 0x1F6F0, 0x1F6FC },
+    { 0x1F700, 0x1F776 },
+    { 0x1F77B, 0x1F7D9 },
+    { 0x1F7E0, 0x1F7EB },
+    { 0x1F7F0, 0x1F7F0 },
+    { 0x1F800, 0x1F80B },
+    { 0x1F810, 0x1F847 },
+    { 0x1F850, 0x1F859 },
+    { 0x1F860, 0x1F887 },
+    { 0x1F890, 0x1F8AD },
+    { 0x1F8B0, 0x1F8B1 },
+    { 0x1F900, 0x1FA53 },
+    { 0x1FA60, 0x1FA6D },
+    { 0x1FA70, 0x1FA7C },
+    { 0x1FA80, 0x1FA88 },
+    { 0x1FA90, 0x1FABD },
+    { 0x1FABF, 0x1FAC5 },
+    { 0x1FACE, 0x1FADB },
+    { 0x1FAE0, 0x1FAE8 },
+    { 0x1FAF0, 0x1FAF8 },
+    { 0x1FB00, 0x1FB92 },
+    { 0x1FB94, 0x1FBCA },
+    { 0x1FBF0, 0x1FBF9 },
+    { 0x20000, 0x2A6DF },
+    { 0x2A700, 0x2B739 },
+    { 0x2B740, 0x2B81D },
+    { 0x2B820, 0x2CEA1 },
+    { 0x2CEB0, 0x2EBE0 },
+    { 0x2F800, 0x2FA1D },
+    { 0x30000, 0x3134A },
+    { 0x31350, 0x323AF },
+    { 0xE0001, 0xE0001 },
+    { 0xE0020, 0xE007F },
+    { 0xE0100, 0xE01EF },
+    { 0xF0000, 0xFFFFD },
+    { 0x100000, 0x10FFFD }
+
+#define PREDICATE(c) uc_is_graph (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index 154215485c9926febbecf5ad9aa2a311cd7e5f46..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_lower.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f8fceb33b3ad69e9929afc8347202ba4e8473997
--- /dev/null
@@ -0,0 +1,649 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0061, 0x007A },
+    { 0x00B5, 0x00B5 },
+    { 0x00DF, 0x00F6 },
+    { 0x00F8, 0x00FF },
+    { 0x0101, 0x0101 },
+    { 0x0103, 0x0103 },
+    { 0x0105, 0x0105 },
+    { 0x0107, 0x0107 },
+    { 0x0109, 0x0109 },
+    { 0x010B, 0x010B },
+    { 0x010D, 0x010D },
+    { 0x010F, 0x010F },
+    { 0x0111, 0x0111 },
+    { 0x0113, 0x0113 },
+    { 0x0115, 0x0115 },
+    { 0x0117, 0x0117 },
+    { 0x0119, 0x0119 },
+    { 0x011B, 0x011B },
+    { 0x011D, 0x011D },
+    { 0x011F, 0x011F },
+    { 0x0121, 0x0121 },
+    { 0x0123, 0x0123 },
+    { 0x0125, 0x0125 },
+    { 0x0127, 0x0127 },
+    { 0x0129, 0x0129 },
+    { 0x012B, 0x012B },
+    { 0x012D, 0x012D },
+    { 0x012F, 0x012F },
+    { 0x0131, 0x0131 },
+    { 0x0133, 0x0133 },
+    { 0x0135, 0x0135 },
+    { 0x0137, 0x0137 },
+    { 0x013A, 0x013A },
+    { 0x013C, 0x013C },
+    { 0x013E, 0x013E },
+    { 0x0140, 0x0140 },
+    { 0x0142, 0x0142 },
+    { 0x0144, 0x0144 },
+    { 0x0146, 0x0146 },
+    { 0x0148, 0x0148 },
+    { 0x014B, 0x014B },
+    { 0x014D, 0x014D },
+    { 0x014F, 0x014F },
+    { 0x0151, 0x0151 },
+    { 0x0153, 0x0153 },
+    { 0x0155, 0x0155 },
+    { 0x0157, 0x0157 },
+    { 0x0159, 0x0159 },
+    { 0x015B, 0x015B },
+    { 0x015D, 0x015D },
+    { 0x015F, 0x015F },
+    { 0x0161, 0x0161 },
+    { 0x0163, 0x0163 },
+    { 0x0165, 0x0165 },
+    { 0x0167, 0x0167 },
+    { 0x0169, 0x0169 },
+    { 0x016B, 0x016B },
+    { 0x016D, 0x016D },
+    { 0x016F, 0x016F },
+    { 0x0171, 0x0171 },
+    { 0x0173, 0x0173 },
+    { 0x0175, 0x0175 },
+    { 0x0177, 0x0177 },
+    { 0x017A, 0x017A },
+    { 0x017C, 0x017C },
+    { 0x017E, 0x0180 },
+    { 0x0183, 0x0183 },
+    { 0x0185, 0x0185 },
+    { 0x0188, 0x0188 },
+    { 0x018C, 0x018C },
+    { 0x0192, 0x0192 },
+    { 0x0195, 0x0195 },
+    { 0x0199, 0x019A },
+    { 0x019E, 0x019E },
+    { 0x01A1, 0x01A1 },
+    { 0x01A3, 0x01A3 },
+    { 0x01A5, 0x01A5 },
+    { 0x01A8, 0x01A8 },
+    { 0x01AD, 0x01AD },
+    { 0x01B0, 0x01B0 },
+    { 0x01B4, 0x01B4 },
+    { 0x01B6, 0x01B6 },
+    { 0x01B9, 0x01B9 },
+    { 0x01BD, 0x01BD },
+    { 0x01BF, 0x01BF },
+    { 0x01C5, 0x01C6 },
+    { 0x01C8, 0x01C9 },
+    { 0x01CB, 0x01CC },
+    { 0x01CE, 0x01CE },
+    { 0x01D0, 0x01D0 },
+    { 0x01D2, 0x01D2 },
+    { 0x01D4, 0x01D4 },
+    { 0x01D6, 0x01D6 },
+    { 0x01D8, 0x01D8 },
+    { 0x01DA, 0x01DA },
+    { 0x01DC, 0x01DD },
+    { 0x01DF, 0x01DF },
+    { 0x01E1, 0x01E1 },
+    { 0x01E3, 0x01E3 },
+    { 0x01E5, 0x01E5 },
+    { 0x01E7, 0x01E7 },
+    { 0x01E9, 0x01E9 },
+    { 0x01EB, 0x01EB },
+    { 0x01ED, 0x01ED },
+    { 0x01EF, 0x01EF },
+    { 0x01F2, 0x01F3 },
+    { 0x01F5, 0x01F5 },
+    { 0x01F9, 0x01F9 },
+    { 0x01FB, 0x01FB },
+    { 0x01FD, 0x01FD },
+    { 0x01FF, 0x01FF },
+    { 0x0201, 0x0201 },
+    { 0x0203, 0x0203 },
+    { 0x0205, 0x0205 },
+    { 0x0207, 0x0207 },
+    { 0x0209, 0x0209 },
+    { 0x020B, 0x020B },
+    { 0x020D, 0x020D },
+    { 0x020F, 0x020F },
+    { 0x0211, 0x0211 },
+    { 0x0213, 0x0213 },
+    { 0x0215, 0x0215 },
+    { 0x0217, 0x0217 },
+    { 0x0219, 0x0219 },
+    { 0x021B, 0x021B },
+    { 0x021D, 0x021D },
+    { 0x021F, 0x021F },
+    { 0x0223, 0x0223 },
+    { 0x0225, 0x0225 },
+    { 0x0227, 0x0227 },
+    { 0x0229, 0x0229 },
+    { 0x022B, 0x022B },
+    { 0x022D, 0x022D },
+    { 0x022F, 0x022F },
+    { 0x0231, 0x0231 },
+    { 0x0233, 0x0233 },
+    { 0x023C, 0x023C },
+    { 0x023F, 0x0240 },
+    { 0x0242, 0x0242 },
+    { 0x0247, 0x0247 },
+    { 0x0249, 0x0249 },
+    { 0x024B, 0x024B },
+    { 0x024D, 0x024D },
+    { 0x024F, 0x0254 },
+    { 0x0256, 0x0257 },
+    { 0x0259, 0x0259 },
+    { 0x025B, 0x025C },
+    { 0x0260, 0x0261 },
+    { 0x0263, 0x0263 },
+    { 0x0265, 0x0266 },
+    { 0x0268, 0x026C },
+    { 0x026F, 0x026F },
+    { 0x0271, 0x0272 },
+    { 0x0275, 0x0275 },
+    { 0x027D, 0x027D },
+    { 0x0280, 0x0280 },
+    { 0x0282, 0x0283 },
+    { 0x0287, 0x028C },
+    { 0x0292, 0x0292 },
+    { 0x029D, 0x029E },
+    { 0x0345, 0x0345 },
+    { 0x0371, 0x0371 },
+    { 0x0373, 0x0373 },
+    { 0x0377, 0x0377 },
+    { 0x037B, 0x037D },
+    { 0x03AC, 0x03AF },
+    { 0x03B1, 0x03CE },
+    { 0x03D0, 0x03D1 },
+    { 0x03D5, 0x03D7 },
+    { 0x03D9, 0x03D9 },
+    { 0x03DB, 0x03DB },
+    { 0x03DD, 0x03DD },
+    { 0x03DF, 0x03DF },
+    { 0x03E1, 0x03E1 },
+    { 0x03E3, 0x03E3 },
+    { 0x03E5, 0x03E5 },
+    { 0x03E7, 0x03E7 },
+    { 0x03E9, 0x03E9 },
+    { 0x03EB, 0x03EB },
+    { 0x03ED, 0x03ED },
+    { 0x03EF, 0x03F3 },
+    { 0x03F5, 0x03F5 },
+    { 0x03F8, 0x03F8 },
+    { 0x03FB, 0x03FB },
+    { 0x0430, 0x045F },
+    { 0x0461, 0x0461 },
+    { 0x0463, 0x0463 },
+    { 0x0465, 0x0465 },
+    { 0x0467, 0x0467 },
+    { 0x0469, 0x0469 },
+    { 0x046B, 0x046B },
+    { 0x046D, 0x046D },
+    { 0x046F, 0x046F },
+    { 0x0471, 0x0471 },
+    { 0x0473, 0x0473 },
+    { 0x0475, 0x0475 },
+    { 0x0477, 0x0477 },
+    { 0x0479, 0x0479 },
+    { 0x047B, 0x047B },
+    { 0x047D, 0x047D },
+    { 0x047F, 0x047F },
+    { 0x0481, 0x0481 },
+    { 0x048B, 0x048B },
+    { 0x048D, 0x048D },
+    { 0x048F, 0x048F },
+    { 0x0491, 0x0491 },
+    { 0x0493, 0x0493 },
+    { 0x0495, 0x0495 },
+    { 0x0497, 0x0497 },
+    { 0x0499, 0x0499 },
+    { 0x049B, 0x049B },
+    { 0x049D, 0x049D },
+    { 0x049F, 0x049F },
+    { 0x04A1, 0x04A1 },
+    { 0x04A3, 0x04A3 },
+    { 0x04A5, 0x04A5 },
+    { 0x04A7, 0x04A7 },
+    { 0x04A9, 0x04A9 },
+    { 0x04AB, 0x04AB },
+    { 0x04AD, 0x04AD },
+    { 0x04AF, 0x04AF },
+    { 0x04B1, 0x04B1 },
+    { 0x04B3, 0x04B3 },
+    { 0x04B5, 0x04B5 },
+    { 0x04B7, 0x04B7 },
+    { 0x04B9, 0x04B9 },
+    { 0x04BB, 0x04BB },
+    { 0x04BD, 0x04BD },
+    { 0x04BF, 0x04BF },
+    { 0x04C2, 0x04C2 },
+    { 0x04C4, 0x04C4 },
+    { 0x04C6, 0x04C6 },
+    { 0x04C8, 0x04C8 },
+    { 0x04CA, 0x04CA },
+    { 0x04CC, 0x04CC },
+    { 0x04CE, 0x04CF },
+    { 0x04D1, 0x04D1 },
+    { 0x04D3, 0x04D3 },
+    { 0x04D5, 0x04D5 },
+    { 0x04D7, 0x04D7 },
+    { 0x04D9, 0x04D9 },
+    { 0x04DB, 0x04DB },
+    { 0x04DD, 0x04DD },
+    { 0x04DF, 0x04DF },
+    { 0x04E1, 0x04E1 },
+    { 0x04E3, 0x04E3 },
+    { 0x04E5, 0x04E5 },
+    { 0x04E7, 0x04E7 },
+    { 0x04E9, 0x04E9 },
+    { 0x04EB, 0x04EB },
+    { 0x04ED, 0x04ED },
+    { 0x04EF, 0x04EF },
+    { 0x04F1, 0x04F1 },
+    { 0x04F3, 0x04F3 },
+    { 0x04F5, 0x04F5 },
+    { 0x04F7, 0x04F7 },
+    { 0x04F9, 0x04F9 },
+    { 0x04FB, 0x04FB },
+    { 0x04FD, 0x04FD },
+    { 0x04FF, 0x04FF },
+    { 0x0501, 0x0501 },
+    { 0x0503, 0x0503 },
+    { 0x0505, 0x0505 },
+    { 0x0507, 0x0507 },
+    { 0x0509, 0x0509 },
+    { 0x050B, 0x050B },
+    { 0x050D, 0x050D },
+    { 0x050F, 0x050F },
+    { 0x0511, 0x0511 },
+    { 0x0513, 0x0513 },
+    { 0x0515, 0x0515 },
+    { 0x0517, 0x0517 },
+    { 0x0519, 0x0519 },
+    { 0x051B, 0x051B },
+    { 0x051D, 0x051D },
+    { 0x051F, 0x051F },
+    { 0x0521, 0x0521 },
+    { 0x0523, 0x0523 },
+    { 0x0525, 0x0525 },
+    { 0x0527, 0x0527 },
+    { 0x0529, 0x0529 },
+    { 0x052B, 0x052B },
+    { 0x052D, 0x052D },
+    { 0x052F, 0x052F },
+    { 0x0561, 0x0586 },
+    { 0x10D0, 0x10FA },
+    { 0x10FD, 0x10FF },
+    { 0x13F8, 0x13FD },
+    { 0x1C80, 0x1C88 },
+    { 0x1D79, 0x1D79 },
+    { 0x1D7D, 0x1D7D },
+    { 0x1D8E, 0x1D8E },
+    { 0x1E01, 0x1E01 },
+    { 0x1E03, 0x1E03 },
+    { 0x1E05, 0x1E05 },
+    { 0x1E07, 0x1E07 },
+    { 0x1E09, 0x1E09 },
+    { 0x1E0B, 0x1E0B },
+    { 0x1E0D, 0x1E0D },
+    { 0x1E0F, 0x1E0F },
+    { 0x1E11, 0x1E11 },
+    { 0x1E13, 0x1E13 },
+    { 0x1E15, 0x1E15 },
+    { 0x1E17, 0x1E17 },
+    { 0x1E19, 0x1E19 },
+    { 0x1E1B, 0x1E1B },
+    { 0x1E1D, 0x1E1D },
+    { 0x1E1F, 0x1E1F },
+    { 0x1E21, 0x1E21 },
+    { 0x1E23, 0x1E23 },
+    { 0x1E25, 0x1E25 },
+    { 0x1E27, 0x1E27 },
+    { 0x1E29, 0x1E29 },
+    { 0x1E2B, 0x1E2B },
+    { 0x1E2D, 0x1E2D },
+    { 0x1E2F, 0x1E2F },
+    { 0x1E31, 0x1E31 },
+    { 0x1E33, 0x1E33 },
+    { 0x1E35, 0x1E35 },
+    { 0x1E37, 0x1E37 },
+    { 0x1E39, 0x1E39 },
+    { 0x1E3B, 0x1E3B },
+    { 0x1E3D, 0x1E3D },
+    { 0x1E3F, 0x1E3F },
+    { 0x1E41, 0x1E41 },
+    { 0x1E43, 0x1E43 },
+    { 0x1E45, 0x1E45 },
+    { 0x1E47, 0x1E47 },
+    { 0x1E49, 0x1E49 },
+    { 0x1E4B, 0x1E4B },
+    { 0x1E4D, 0x1E4D },
+    { 0x1E4F, 0x1E4F },
+    { 0x1E51, 0x1E51 },
+    { 0x1E53, 0x1E53 },
+    { 0x1E55, 0x1E55 },
+    { 0x1E57, 0x1E57 },
+    { 0x1E59, 0x1E59 },
+    { 0x1E5B, 0x1E5B },
+    { 0x1E5D, 0x1E5D },
+    { 0x1E5F, 0x1E5F },
+    { 0x1E61, 0x1E61 },
+    { 0x1E63, 0x1E63 },
+    { 0x1E65, 0x1E65 },
+    { 0x1E67, 0x1E67 },
+    { 0x1E69, 0x1E69 },
+    { 0x1E6B, 0x1E6B },
+    { 0x1E6D, 0x1E6D },
+    { 0x1E6F, 0x1E6F },
+    { 0x1E71, 0x1E71 },
+    { 0x1E73, 0x1E73 },
+    { 0x1E75, 0x1E75 },
+    { 0x1E77, 0x1E77 },
+    { 0x1E79, 0x1E79 },
+    { 0x1E7B, 0x1E7B },
+    { 0x1E7D, 0x1E7D },
+    { 0x1E7F, 0x1E7F },
+    { 0x1E81, 0x1E81 },
+    { 0x1E83, 0x1E83 },
+    { 0x1E85, 0x1E85 },
+    { 0x1E87, 0x1E87 },
+    { 0x1E89, 0x1E89 },
+    { 0x1E8B, 0x1E8B },
+    { 0x1E8D, 0x1E8D },
+    { 0x1E8F, 0x1E8F },
+    { 0x1E91, 0x1E91 },
+    { 0x1E93, 0x1E93 },
+    { 0x1E95, 0x1E95 },
+    { 0x1E9B, 0x1E9B },
+    { 0x1EA1, 0x1EA1 },
+    { 0x1EA3, 0x1EA3 },
+    { 0x1EA5, 0x1EA5 },
+    { 0x1EA7, 0x1EA7 },
+    { 0x1EA9, 0x1EA9 },
+    { 0x1EAB, 0x1EAB },
+    { 0x1EAD, 0x1EAD },
+    { 0x1EAF, 0x1EAF },
+    { 0x1EB1, 0x1EB1 },
+    { 0x1EB3, 0x1EB3 },
+    { 0x1EB5, 0x1EB5 },
+    { 0x1EB7, 0x1EB7 },
+    { 0x1EB9, 0x1EB9 },
+    { 0x1EBB, 0x1EBB },
+    { 0x1EBD, 0x1EBD },
+    { 0x1EBF, 0x1EBF },
+    { 0x1EC1, 0x1EC1 },
+    { 0x1EC3, 0x1EC3 },
+    { 0x1EC5, 0x1EC5 },
+    { 0x1EC7, 0x1EC7 },
+    { 0x1EC9, 0x1EC9 },
+    { 0x1ECB, 0x1ECB },
+    { 0x1ECD, 0x1ECD },
+    { 0x1ECF, 0x1ECF },
+    { 0x1ED1, 0x1ED1 },
+    { 0x1ED3, 0x1ED3 },
+    { 0x1ED5, 0x1ED5 },
+    { 0x1ED7, 0x1ED7 },
+    { 0x1ED9, 0x1ED9 },
+    { 0x1EDB, 0x1EDB },
+    { 0x1EDD, 0x1EDD },
+    { 0x1EDF, 0x1EDF },
+    { 0x1EE1, 0x1EE1 },
+    { 0x1EE3, 0x1EE3 },
+    { 0x1EE5, 0x1EE5 },
+    { 0x1EE7, 0x1EE7 },
+    { 0x1EE9, 0x1EE9 },
+    { 0x1EEB, 0x1EEB },
+    { 0x1EED, 0x1EED },
+    { 0x1EEF, 0x1EEF },
+    { 0x1EF1, 0x1EF1 },
+    { 0x1EF3, 0x1EF3 },
+    { 0x1EF5, 0x1EF5 },
+    { 0x1EF7, 0x1EF7 },
+    { 0x1EF9, 0x1EF9 },
+    { 0x1EFB, 0x1EFB },
+    { 0x1EFD, 0x1EFD },
+    { 0x1EFF, 0x1F07 },
+    { 0x1F10, 0x1F15 },
+    { 0x1F20, 0x1F27 },
+    { 0x1F30, 0x1F37 },
+    { 0x1F40, 0x1F45 },
+    { 0x1F51, 0x1F51 },
+    { 0x1F53, 0x1F53 },
+    { 0x1F55, 0x1F55 },
+    { 0x1F57, 0x1F57 },
+    { 0x1F60, 0x1F67 },
+    { 0x1F70, 0x1F7D },
+    { 0x1F80, 0x1F87 },
+    { 0x1F90, 0x1F97 },
+    { 0x1FA0, 0x1FA7 },
+    { 0x1FB0, 0x1FB1 },
+    { 0x1FB3, 0x1FB3 },
+    { 0x1FBE, 0x1FBE },
+    { 0x1FC3, 0x1FC3 },
+    { 0x1FD0, 0x1FD1 },
+    { 0x1FE0, 0x1FE1 },
+    { 0x1FE5, 0x1FE5 },
+    { 0x1FF3, 0x1FF3 },
+    { 0x214E, 0x214E },
+    { 0x2170, 0x217F },
+    { 0x2184, 0x2184 },
+    { 0x24D0, 0x24E9 },
+    { 0x2C30, 0x2C5F },
+    { 0x2C61, 0x2C61 },
+    { 0x2C65, 0x2C66 },
+    { 0x2C68, 0x2C68 },
+    { 0x2C6A, 0x2C6A },
+    { 0x2C6C, 0x2C6C },
+    { 0x2C73, 0x2C73 },
+    { 0x2C76, 0x2C76 },
+    { 0x2C81, 0x2C81 },
+    { 0x2C83, 0x2C83 },
+    { 0x2C85, 0x2C85 },
+    { 0x2C87, 0x2C87 },
+    { 0x2C89, 0x2C89 },
+    { 0x2C8B, 0x2C8B },
+    { 0x2C8D, 0x2C8D },
+    { 0x2C8F, 0x2C8F },
+    { 0x2C91, 0x2C91 },
+    { 0x2C93, 0x2C93 },
+    { 0x2C95, 0x2C95 },
+    { 0x2C97, 0x2C97 },
+    { 0x2C99, 0x2C99 },
+    { 0x2C9B, 0x2C9B },
+    { 0x2C9D, 0x2C9D },
+    { 0x2C9F, 0x2C9F },
+    { 0x2CA1, 0x2CA1 },
+    { 0x2CA3, 0x2CA3 },
+    { 0x2CA5, 0x2CA5 },
+    { 0x2CA7, 0x2CA7 },
+    { 0x2CA9, 0x2CA9 },
+    { 0x2CAB, 0x2CAB },
+    { 0x2CAD, 0x2CAD },
+    { 0x2CAF, 0x2CAF },
+    { 0x2CB1, 0x2CB1 },
+    { 0x2CB3, 0x2CB3 },
+    { 0x2CB5, 0x2CB5 },
+    { 0x2CB7, 0x2CB7 },
+    { 0x2CB9, 0x2CB9 },
+    { 0x2CBB, 0x2CBB },
+    { 0x2CBD, 0x2CBD },
+    { 0x2CBF, 0x2CBF },
+    { 0x2CC1, 0x2CC1 },
+    { 0x2CC3, 0x2CC3 },
+    { 0x2CC5, 0x2CC5 },
+    { 0x2CC7, 0x2CC7 },
+    { 0x2CC9, 0x2CC9 },
+    { 0x2CCB, 0x2CCB },
+    { 0x2CCD, 0x2CCD },
+    { 0x2CCF, 0x2CCF },
+    { 0x2CD1, 0x2CD1 },
+    { 0x2CD3, 0x2CD3 },
+    { 0x2CD5, 0x2CD5 },
+    { 0x2CD7, 0x2CD7 },
+    { 0x2CD9, 0x2CD9 },
+    { 0x2CDB, 0x2CDB },
+    { 0x2CDD, 0x2CDD },
+    { 0x2CDF, 0x2CDF },
+    { 0x2CE1, 0x2CE1 },
+    { 0x2CE3, 0x2CE3 },
+    { 0x2CEC, 0x2CEC },
+    { 0x2CEE, 0x2CEE },
+    { 0x2CF3, 0x2CF3 },
+    { 0x2D00, 0x2D25 },
+    { 0x2D27, 0x2D27 },
+    { 0x2D2D, 0x2D2D },
+    { 0xA641, 0xA641 },
+    { 0xA643, 0xA643 },
+    { 0xA645, 0xA645 },
+    { 0xA647, 0xA647 },
+    { 0xA649, 0xA649 },
+    { 0xA64B, 0xA64B },
+    { 0xA64D, 0xA64D },
+    { 0xA64F, 0xA64F },
+    { 0xA651, 0xA651 },
+    { 0xA653, 0xA653 },
+    { 0xA655, 0xA655 },
+    { 0xA657, 0xA657 },
+    { 0xA659, 0xA659 },
+    { 0xA65B, 0xA65B },
+    { 0xA65D, 0xA65D },
+    { 0xA65F, 0xA65F },
+    { 0xA661, 0xA661 },
+    { 0xA663, 0xA663 },
+    { 0xA665, 0xA665 },
+    { 0xA667, 0xA667 },
+    { 0xA669, 0xA669 },
+    { 0xA66B, 0xA66B },
+    { 0xA66D, 0xA66D },
+    { 0xA681, 0xA681 },
+    { 0xA683, 0xA683 },
+    { 0xA685, 0xA685 },
+    { 0xA687, 0xA687 },
+    { 0xA689, 0xA689 },
+    { 0xA68B, 0xA68B },
+    { 0xA68D, 0xA68D },
+    { 0xA68F, 0xA68F },
+    { 0xA691, 0xA691 },
+    { 0xA693, 0xA693 },
+    { 0xA695, 0xA695 },
+    { 0xA697, 0xA697 },
+    { 0xA699, 0xA699 },
+    { 0xA69B, 0xA69B },
+    { 0xA723, 0xA723 },
+    { 0xA725, 0xA725 },
+    { 0xA727, 0xA727 },
+    { 0xA729, 0xA729 },
+    { 0xA72B, 0xA72B },
+    { 0xA72D, 0xA72D },
+    { 0xA72F, 0xA72F },
+    { 0xA733, 0xA733 },
+    { 0xA735, 0xA735 },
+    { 0xA737, 0xA737 },
+    { 0xA739, 0xA739 },
+    { 0xA73B, 0xA73B },
+    { 0xA73D, 0xA73D },
+    { 0xA73F, 0xA73F },
+    { 0xA741, 0xA741 },
+    { 0xA743, 0xA743 },
+    { 0xA745, 0xA745 },
+    { 0xA747, 0xA747 },
+    { 0xA749, 0xA749 },
+    { 0xA74B, 0xA74B },
+    { 0xA74D, 0xA74D },
+    { 0xA74F, 0xA74F },
+    { 0xA751, 0xA751 },
+    { 0xA753, 0xA753 },
+    { 0xA755, 0xA755 },
+    { 0xA757, 0xA757 },
+    { 0xA759, 0xA759 },
+    { 0xA75B, 0xA75B },
+    { 0xA75D, 0xA75D },
+    { 0xA75F, 0xA75F },
+    { 0xA761, 0xA761 },
+    { 0xA763, 0xA763 },
+    { 0xA765, 0xA765 },
+    { 0xA767, 0xA767 },
+    { 0xA769, 0xA769 },
+    { 0xA76B, 0xA76B },
+    { 0xA76D, 0xA76D },
+    { 0xA76F, 0xA76F },
+    { 0xA77A, 0xA77A },
+    { 0xA77C, 0xA77C },
+    { 0xA77F, 0xA77F },
+    { 0xA781, 0xA781 },
+    { 0xA783, 0xA783 },
+    { 0xA785, 0xA785 },
+    { 0xA787, 0xA787 },
+    { 0xA78C, 0xA78C },
+    { 0xA791, 0xA791 },
+    { 0xA793, 0xA794 },
+    { 0xA797, 0xA797 },
+    { 0xA799, 0xA799 },
+    { 0xA79B, 0xA79B },
+    { 0xA79D, 0xA79D },
+    { 0xA79F, 0xA79F },
+    { 0xA7A1, 0xA7A1 },
+    { 0xA7A3, 0xA7A3 },
+    { 0xA7A5, 0xA7A5 },
+    { 0xA7A7, 0xA7A7 },
+    { 0xA7A9, 0xA7A9 },
+    { 0xA7B5, 0xA7B5 },
+    { 0xA7B7, 0xA7B7 },
+    { 0xA7B9, 0xA7B9 },
+    { 0xA7BB, 0xA7BB },
+    { 0xA7BD, 0xA7BD },
+    { 0xA7BF, 0xA7BF },
+    { 0xA7C1, 0xA7C1 },
+    { 0xA7C3, 0xA7C3 },
+    { 0xA7C8, 0xA7C8 },
+    { 0xA7CA, 0xA7CA },
+    { 0xA7D1, 0xA7D1 },
+    { 0xA7D7, 0xA7D7 },
+    { 0xA7D9, 0xA7D9 },
+    { 0xA7F6, 0xA7F6 },
+    { 0xAB53, 0xAB53 },
+    { 0xAB70, 0xABBF },
+    { 0xFF41, 0xFF5A },
+    { 0x10428, 0x1044F },
+    { 0x104D8, 0x104FB },
+    { 0x10597, 0x105A1 },
+    { 0x105A3, 0x105B1 },
+    { 0x105B3, 0x105B9 },
+    { 0x105BB, 0x105BC },
+    { 0x10CC0, 0x10CF2 },
+    { 0x118C0, 0x118DF },
+    { 0x16E60, 0x16E7F },
+    { 0x1E922, 0x1E943 }
+
+#define PREDICATE(c) uc_is_lower (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index 3e840136f8bf4a00340da6cc83e1b780b0beab7f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_print.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dad6b07b9b573d0f9d7c85c80be7488318d3a2fd
--- /dev/null
@@ -0,0 +1,731 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0020, 0x007E },
+    { 0x00A0, 0x0377 },
+    { 0x037A, 0x037F },
+    { 0x0384, 0x038A },
+    { 0x038C, 0x038C },
+    { 0x038E, 0x03A1 },
+    { 0x03A3, 0x052F },
+    { 0x0531, 0x0556 },
+    { 0x0559, 0x058A },
+    { 0x058D, 0x058F },
+    { 0x0591, 0x05C7 },
+    { 0x05D0, 0x05EA },
+    { 0x05EF, 0x05F4 },
+    { 0x0600, 0x070D },
+    { 0x070F, 0x074A },
+    { 0x074D, 0x07B1 },
+    { 0x07C0, 0x07FA },
+    { 0x07FD, 0x082D },
+    { 0x0830, 0x083E },
+    { 0x0840, 0x085B },
+    { 0x085E, 0x085E },
+    { 0x0860, 0x086A },
+    { 0x0870, 0x088E },
+    { 0x0890, 0x0891 },
+    { 0x0898, 0x0983 },
+    { 0x0985, 0x098C },
+    { 0x098F, 0x0990 },
+    { 0x0993, 0x09A8 },
+    { 0x09AA, 0x09B0 },
+    { 0x09B2, 0x09B2 },
+    { 0x09B6, 0x09B9 },
+    { 0x09BC, 0x09C4 },
+    { 0x09C7, 0x09C8 },
+    { 0x09CB, 0x09CE },
+    { 0x09D7, 0x09D7 },
+    { 0x09DC, 0x09DD },
+    { 0x09DF, 0x09E3 },
+    { 0x09E6, 0x09FE },
+    { 0x0A01, 0x0A03 },
+    { 0x0A05, 0x0A0A },
+    { 0x0A0F, 0x0A10 },
+    { 0x0A13, 0x0A28 },
+    { 0x0A2A, 0x0A30 },
+    { 0x0A32, 0x0A33 },
+    { 0x0A35, 0x0A36 },
+    { 0x0A38, 0x0A39 },
+    { 0x0A3C, 0x0A3C },
+    { 0x0A3E, 0x0A42 },
+    { 0x0A47, 0x0A48 },
+    { 0x0A4B, 0x0A4D },
+    { 0x0A51, 0x0A51 },
+    { 0x0A59, 0x0A5C },
+    { 0x0A5E, 0x0A5E },
+    { 0x0A66, 0x0A76 },
+    { 0x0A81, 0x0A83 },
+    { 0x0A85, 0x0A8D },
+    { 0x0A8F, 0x0A91 },
+    { 0x0A93, 0x0AA8 },
+    { 0x0AAA, 0x0AB0 },
+    { 0x0AB2, 0x0AB3 },
+    { 0x0AB5, 0x0AB9 },
+    { 0x0ABC, 0x0AC5 },
+    { 0x0AC7, 0x0AC9 },
+    { 0x0ACB, 0x0ACD },
+    { 0x0AD0, 0x0AD0 },
+    { 0x0AE0, 0x0AE3 },
+    { 0x0AE6, 0x0AF1 },
+    { 0x0AF9, 0x0AFF },
+    { 0x0B01, 0x0B03 },
+    { 0x0B05, 0x0B0C },
+    { 0x0B0F, 0x0B10 },
+    { 0x0B13, 0x0B28 },
+    { 0x0B2A, 0x0B30 },
+    { 0x0B32, 0x0B33 },
+    { 0x0B35, 0x0B39 },
+    { 0x0B3C, 0x0B44 },
+    { 0x0B47, 0x0B48 },
+    { 0x0B4B, 0x0B4D },
+    { 0x0B55, 0x0B57 },
+    { 0x0B5C, 0x0B5D },
+    { 0x0B5F, 0x0B63 },
+    { 0x0B66, 0x0B77 },
+    { 0x0B82, 0x0B83 },
+    { 0x0B85, 0x0B8A },
+    { 0x0B8E, 0x0B90 },
+    { 0x0B92, 0x0B95 },
+    { 0x0B99, 0x0B9A },
+    { 0x0B9C, 0x0B9C },
+    { 0x0B9E, 0x0B9F },
+    { 0x0BA3, 0x0BA4 },
+    { 0x0BA8, 0x0BAA },
+    { 0x0BAE, 0x0BB9 },
+    { 0x0BBE, 0x0BC2 },
+    { 0x0BC6, 0x0BC8 },
+    { 0x0BCA, 0x0BCD },
+    { 0x0BD0, 0x0BD0 },
+    { 0x0BD7, 0x0BD7 },
+    { 0x0BE6, 0x0BFA },
+    { 0x0C00, 0x0C0C },
+    { 0x0C0E, 0x0C10 },
+    { 0x0C12, 0x0C28 },
+    { 0x0C2A, 0x0C39 },
+    { 0x0C3C, 0x0C44 },
+    { 0x0C46, 0x0C48 },
+    { 0x0C4A, 0x0C4D },
+    { 0x0C55, 0x0C56 },
+    { 0x0C58, 0x0C5A },
+    { 0x0C5D, 0x0C5D },
+    { 0x0C60, 0x0C63 },
+    { 0x0C66, 0x0C6F },
+    { 0x0C77, 0x0C8C },
+    { 0x0C8E, 0x0C90 },
+    { 0x0C92, 0x0CA8 },
+    { 0x0CAA, 0x0CB3 },
+    { 0x0CB5, 0x0CB9 },
+    { 0x0CBC, 0x0CC4 },
+    { 0x0CC6, 0x0CC8 },
+    { 0x0CCA, 0x0CCD },
+    { 0x0CD5, 0x0CD6 },
+    { 0x0CDD, 0x0CDE },
+    { 0x0CE0, 0x0CE3 },
+    { 0x0CE6, 0x0CEF },
+    { 0x0CF1, 0x0CF3 },
+    { 0x0D00, 0x0D0C },
+    { 0x0D0E, 0x0D10 },
+    { 0x0D12, 0x0D44 },
+    { 0x0D46, 0x0D48 },
+    { 0x0D4A, 0x0D4F },
+    { 0x0D54, 0x0D63 },
+    { 0x0D66, 0x0D7F },
+    { 0x0D81, 0x0D83 },
+    { 0x0D85, 0x0D96 },
+    { 0x0D9A, 0x0DB1 },
+    { 0x0DB3, 0x0DBB },
+    { 0x0DBD, 0x0DBD },
+    { 0x0DC0, 0x0DC6 },
+    { 0x0DCA, 0x0DCA },
+    { 0x0DCF, 0x0DD4 },
+    { 0x0DD6, 0x0DD6 },
+    { 0x0DD8, 0x0DDF },
+    { 0x0DE6, 0x0DEF },
+    { 0x0DF2, 0x0DF4 },
+    { 0x0E01, 0x0E3A },
+    { 0x0E3F, 0x0E5B },
+    { 0x0E81, 0x0E82 },
+    { 0x0E84, 0x0E84 },
+    { 0x0E86, 0x0E8A },
+    { 0x0E8C, 0x0EA3 },
+    { 0x0EA5, 0x0EA5 },
+    { 0x0EA7, 0x0EBD },
+    { 0x0EC0, 0x0EC4 },
+    { 0x0EC6, 0x0EC6 },
+    { 0x0EC8, 0x0ECE },
+    { 0x0ED0, 0x0ED9 },
+    { 0x0EDC, 0x0EDF },
+    { 0x0F00, 0x0F47 },
+    { 0x0F49, 0x0F6C },
+    { 0x0F71, 0x0F97 },
+    { 0x0F99, 0x0FBC },
+    { 0x0FBE, 0x0FCC },
+    { 0x0FCE, 0x0FDA },
+    { 0x1000, 0x10C5 },
+    { 0x10C7, 0x10C7 },
+    { 0x10CD, 0x10CD },
+    { 0x10D0, 0x1248 },
+    { 0x124A, 0x124D },
+    { 0x1250, 0x1256 },
+    { 0x1258, 0x1258 },
+    { 0x125A, 0x125D },
+    { 0x1260, 0x1288 },
+    { 0x128A, 0x128D },
+    { 0x1290, 0x12B0 },
+    { 0x12B2, 0x12B5 },
+    { 0x12B8, 0x12BE },
+    { 0x12C0, 0x12C0 },
+    { 0x12C2, 0x12C5 },
+    { 0x12C8, 0x12D6 },
+    { 0x12D8, 0x1310 },
+    { 0x1312, 0x1315 },
+    { 0x1318, 0x135A },
+    { 0x135D, 0x137C },
+    { 0x1380, 0x1399 },
+    { 0x13A0, 0x13F5 },
+    { 0x13F8, 0x13FD },
+    { 0x1400, 0x169C },
+    { 0x16A0, 0x16F8 },
+    { 0x1700, 0x1715 },
+    { 0x171F, 0x1736 },
+    { 0x1740, 0x1753 },
+    { 0x1760, 0x176C },
+    { 0x176E, 0x1770 },
+    { 0x1772, 0x1773 },
+    { 0x1780, 0x17DD },
+    { 0x17E0, 0x17E9 },
+    { 0x17F0, 0x17F9 },
+    { 0x1800, 0x1819 },
+    { 0x1820, 0x1878 },
+    { 0x1880, 0x18AA },
+    { 0x18B0, 0x18F5 },
+    { 0x1900, 0x191E },
+    { 0x1920, 0x192B },
+    { 0x1930, 0x193B },
+    { 0x1940, 0x1940 },
+    { 0x1944, 0x196D },
+    { 0x1970, 0x1974 },
+    { 0x1980, 0x19AB },
+    { 0x19B0, 0x19C9 },
+    { 0x19D0, 0x19DA },
+    { 0x19DE, 0x1A1B },
+    { 0x1A1E, 0x1A5E },
+    { 0x1A60, 0x1A7C },
+    { 0x1A7F, 0x1A89 },
+    { 0x1A90, 0x1A99 },
+    { 0x1AA0, 0x1AAD },
+    { 0x1AB0, 0x1ACE },
+    { 0x1B00, 0x1B4C },
+    { 0x1B50, 0x1B7E },
+    { 0x1B80, 0x1BF3 },
+    { 0x1BFC, 0x1C37 },
+    { 0x1C3B, 0x1C49 },
+    { 0x1C4D, 0x1C88 },
+    { 0x1C90, 0x1CBA },
+    { 0x1CBD, 0x1CC7 },
+    { 0x1CD0, 0x1CFA },
+    { 0x1D00, 0x1F15 },
+    { 0x1F18, 0x1F1D },
+    { 0x1F20, 0x1F45 },
+    { 0x1F48, 0x1F4D },
+    { 0x1F50, 0x1F57 },
+    { 0x1F59, 0x1F59 },
+    { 0x1F5B, 0x1F5B },
+    { 0x1F5D, 0x1F5D },
+    { 0x1F5F, 0x1F7D },
+    { 0x1F80, 0x1FB4 },
+    { 0x1FB6, 0x1FC4 },
+    { 0x1FC6, 0x1FD3 },
+    { 0x1FD6, 0x1FDB },
+    { 0x1FDD, 0x1FEF },
+    { 0x1FF2, 0x1FF4 },
+    { 0x1FF6, 0x1FFE },
+    { 0x2000, 0x2027 },
+    { 0x202A, 0x2064 },
+    { 0x2066, 0x2071 },
+    { 0x2074, 0x208E },
+    { 0x2090, 0x209C },
+    { 0x20A0, 0x20C0 },
+    { 0x20D0, 0x20F0 },
+    { 0x2100, 0x218B },
+    { 0x2190, 0x2426 },
+    { 0x2440, 0x244A },
+    { 0x2460, 0x2B73 },
+    { 0x2B76, 0x2B95 },
+    { 0x2B97, 0x2CF3 },
+    { 0x2CF9, 0x2D25 },
+    { 0x2D27, 0x2D27 },
+    { 0x2D2D, 0x2D2D },
+    { 0x2D30, 0x2D67 },
+    { 0x2D6F, 0x2D70 },
+    { 0x2D7F, 0x2D96 },
+    { 0x2DA0, 0x2DA6 },
+    { 0x2DA8, 0x2DAE },
+    { 0x2DB0, 0x2DB6 },
+    { 0x2DB8, 0x2DBE },
+    { 0x2DC0, 0x2DC6 },
+    { 0x2DC8, 0x2DCE },
+    { 0x2DD0, 0x2DD6 },
+    { 0x2DD8, 0x2DDE },
+    { 0x2DE0, 0x2E5D },
+    { 0x2E80, 0x2E99 },
+    { 0x2E9B, 0x2EF3 },
+    { 0x2F00, 0x2FD5 },
+    { 0x2FF0, 0x2FFB },
+    { 0x3000, 0x303F },
+    { 0x3041, 0x3096 },
+    { 0x3099, 0x30FF },
+    { 0x3105, 0x312F },
+    { 0x3131, 0x318E },
+    { 0x3190, 0x31E3 },
+    { 0x31F0, 0x321E },
+    { 0x3220, 0xA48C },
+    { 0xA490, 0xA4C6 },
+    { 0xA4D0, 0xA62B },
+    { 0xA640, 0xA6F7 },
+    { 0xA700, 0xA7CA },
+    { 0xA7D0, 0xA7D1 },
+    { 0xA7D3, 0xA7D3 },
+    { 0xA7D5, 0xA7D9 },
+    { 0xA7F2, 0xA82C },
+    { 0xA830, 0xA839 },
+    { 0xA840, 0xA877 },
+    { 0xA880, 0xA8C5 },
+    { 0xA8CE, 0xA8D9 },
+    { 0xA8E0, 0xA953 },
+    { 0xA95F, 0xA97C },
+    { 0xA980, 0xA9CD },
+    { 0xA9CF, 0xA9D9 },
+    { 0xA9DE, 0xA9FE },
+    { 0xAA00, 0xAA36 },
+    { 0xAA40, 0xAA4D },
+    { 0xAA50, 0xAA59 },
+    { 0xAA5C, 0xAAC2 },
+    { 0xAADB, 0xAAF6 },
+    { 0xAB01, 0xAB06 },
+    { 0xAB09, 0xAB0E },
+    { 0xAB11, 0xAB16 },
+    { 0xAB20, 0xAB26 },
+    { 0xAB28, 0xAB2E },
+    { 0xAB30, 0xAB6B },
+    { 0xAB70, 0xABED },
+    { 0xABF0, 0xABF9 },
+    { 0xAC00, 0xD7A3 },
+    { 0xD7B0, 0xD7C6 },
+    { 0xD7CB, 0xD7FB },
+    { 0xE000, 0xFA6D },
+    { 0xFA70, 0xFAD9 },
+    { 0xFB00, 0xFB06 },
+    { 0xFB13, 0xFB17 },
+    { 0xFB1D, 0xFB36 },
+    { 0xFB38, 0xFB3C },
+    { 0xFB3E, 0xFB3E },
+    { 0xFB40, 0xFB41 },
+    { 0xFB43, 0xFB44 },
+    { 0xFB46, 0xFBC2 },
+    { 0xFBD3, 0xFD8F },
+    { 0xFD92, 0xFDC7 },
+    { 0xFDCF, 0xFDCF },
+    { 0xFDF0, 0xFE19 },
+    { 0xFE20, 0xFE52 },
+    { 0xFE54, 0xFE66 },
+    { 0xFE68, 0xFE6B },
+    { 0xFE70, 0xFE74 },
+    { 0xFE76, 0xFEFC },
+    { 0xFEFF, 0xFEFF },
+    { 0xFF01, 0xFFBE },
+    { 0xFFC2, 0xFFC7 },
+    { 0xFFCA, 0xFFCF },
+    { 0xFFD2, 0xFFD7 },
+    { 0xFFDA, 0xFFDC },
+    { 0xFFE0, 0xFFE6 },
+    { 0xFFE8, 0xFFEE },
+    { 0xFFF9, 0xFFFD },
+    { 0x10000, 0x1000B },
+    { 0x1000D, 0x10026 },
+    { 0x10028, 0x1003A },
+    { 0x1003C, 0x1003D },
+    { 0x1003F, 0x1004D },
+    { 0x10050, 0x1005D },
+    { 0x10080, 0x100FA },
+    { 0x10100, 0x10102 },
+    { 0x10107, 0x10133 },
+    { 0x10137, 0x1018E },
+    { 0x10190, 0x1019C },
+    { 0x101A0, 0x101A0 },
+    { 0x101D0, 0x101FD },
+    { 0x10280, 0x1029C },
+    { 0x102A0, 0x102D0 },
+    { 0x102E0, 0x102FB },
+    { 0x10300, 0x10323 },
+    { 0x1032D, 0x1034A },
+    { 0x10350, 0x1037A },
+    { 0x10380, 0x1039D },
+    { 0x1039F, 0x103C3 },
+    { 0x103C8, 0x103D5 },
+    { 0x10400, 0x1049D },
+    { 0x104A0, 0x104A9 },
+    { 0x104B0, 0x104D3 },
+    { 0x104D8, 0x104FB },
+    { 0x10500, 0x10527 },
+    { 0x10530, 0x10563 },
+    { 0x1056F, 0x1057A },
+    { 0x1057C, 0x1058A },
+    { 0x1058C, 0x10592 },
+    { 0x10594, 0x10595 },
+    { 0x10597, 0x105A1 },
+    { 0x105A3, 0x105B1 },
+    { 0x105B3, 0x105B9 },
+    { 0x105BB, 0x105BC },
+    { 0x10600, 0x10736 },
+    { 0x10740, 0x10755 },
+    { 0x10760, 0x10767 },
+    { 0x10780, 0x10785 },
+    { 0x10787, 0x107B0 },
+    { 0x107B2, 0x107BA },
+    { 0x10800, 0x10805 },
+    { 0x10808, 0x10808 },
+    { 0x1080A, 0x10835 },
+    { 0x10837, 0x10838 },
+    { 0x1083C, 0x1083C },
+    { 0x1083F, 0x10855 },
+    { 0x10857, 0x1089E },
+    { 0x108A7, 0x108AF },
+    { 0x108E0, 0x108F2 },
+    { 0x108F4, 0x108F5 },
+    { 0x108FB, 0x1091B },
+    { 0x1091F, 0x10939 },
+    { 0x1093F, 0x1093F },
+    { 0x10980, 0x109B7 },
+    { 0x109BC, 0x109CF },
+    { 0x109D2, 0x10A03 },
+    { 0x10A05, 0x10A06 },
+    { 0x10A0C, 0x10A13 },
+    { 0x10A15, 0x10A17 },
+    { 0x10A19, 0x10A35 },
+    { 0x10A38, 0x10A3A },
+    { 0x10A3F, 0x10A48 },
+    { 0x10A50, 0x10A58 },
+    { 0x10A60, 0x10A9F },
+    { 0x10AC0, 0x10AE6 },
+    { 0x10AEB, 0x10AF6 },
+    { 0x10B00, 0x10B35 },
+    { 0x10B39, 0x10B55 },
+    { 0x10B58, 0x10B72 },
+    { 0x10B78, 0x10B91 },
+    { 0x10B99, 0x10B9C },
+    { 0x10BA9, 0x10BAF },
+    { 0x10C00, 0x10C48 },
+    { 0x10C80, 0x10CB2 },
+    { 0x10CC0, 0x10CF2 },
+    { 0x10CFA, 0x10D27 },
+    { 0x10D30, 0x10D39 },
+    { 0x10E60, 0x10E7E },
+    { 0x10E80, 0x10EA9 },
+    { 0x10EAB, 0x10EAD },
+    { 0x10EB0, 0x10EB1 },
+    { 0x10EFD, 0x10F27 },
+    { 0x10F30, 0x10F59 },
+    { 0x10F70, 0x10F89 },
+    { 0x10FB0, 0x10FCB },
+    { 0x10FE0, 0x10FF6 },
+    { 0x11000, 0x1104D },
+    { 0x11052, 0x11075 },
+    { 0x1107F, 0x110C2 },
+    { 0x110CD, 0x110CD },
+    { 0x110D0, 0x110E8 },
+    { 0x110F0, 0x110F9 },
+    { 0x11100, 0x11134 },
+    { 0x11136, 0x11147 },
+    { 0x11150, 0x11176 },
+    { 0x11180, 0x111DF },
+    { 0x111E1, 0x111F4 },
+    { 0x11200, 0x11211 },
+    { 0x11213, 0x11241 },
+    { 0x11280, 0x11286 },
+    { 0x11288, 0x11288 },
+    { 0x1128A, 0x1128D },
+    { 0x1128F, 0x1129D },
+    { 0x1129F, 0x112A9 },
+    { 0x112B0, 0x112EA },
+    { 0x112F0, 0x112F9 },
+    { 0x11300, 0x11303 },
+    { 0x11305, 0x1130C },
+    { 0x1130F, 0x11310 },
+    { 0x11313, 0x11328 },
+    { 0x1132A, 0x11330 },
+    { 0x11332, 0x11333 },
+    { 0x11335, 0x11339 },
+    { 0x1133B, 0x11344 },
+    { 0x11347, 0x11348 },
+    { 0x1134B, 0x1134D },
+    { 0x11350, 0x11350 },
+    { 0x11357, 0x11357 },
+    { 0x1135D, 0x11363 },
+    { 0x11366, 0x1136C },
+    { 0x11370, 0x11374 },
+    { 0x11400, 0x1145B },
+    { 0x1145D, 0x11461 },
+    { 0x11480, 0x114C7 },
+    { 0x114D0, 0x114D9 },
+    { 0x11580, 0x115B5 },
+    { 0x115B8, 0x115DD },
+    { 0x11600, 0x11644 },
+    { 0x11650, 0x11659 },
+    { 0x11660, 0x1166C },
+    { 0x11680, 0x116B9 },
+    { 0x116C0, 0x116C9 },
+    { 0x11700, 0x1171A },
+    { 0x1171D, 0x1172B },
+    { 0x11730, 0x11746 },
+    { 0x11800, 0x1183B },
+    { 0x118A0, 0x118F2 },
+    { 0x118FF, 0x11906 },
+    { 0x11909, 0x11909 },
+    { 0x1190C, 0x11913 },
+    { 0x11915, 0x11916 },
+    { 0x11918, 0x11935 },
+    { 0x11937, 0x11938 },
+    { 0x1193B, 0x11946 },
+    { 0x11950, 0x11959 },
+    { 0x119A0, 0x119A7 },
+    { 0x119AA, 0x119D7 },
+    { 0x119DA, 0x119E4 },
+    { 0x11A00, 0x11A47 },
+    { 0x11A50, 0x11AA2 },
+    { 0x11AB0, 0x11AF8 },
+    { 0x11B00, 0x11B09 },
+    { 0x11C00, 0x11C08 },
+    { 0x11C0A, 0x11C36 },
+    { 0x11C38, 0x11C45 },
+    { 0x11C50, 0x11C6C },
+    { 0x11C70, 0x11C8F },
+    { 0x11C92, 0x11CA7 },
+    { 0x11CA9, 0x11CB6 },
+    { 0x11D00, 0x11D06 },
+    { 0x11D08, 0x11D09 },
+    { 0x11D0B, 0x11D36 },
+    { 0x11D3A, 0x11D3A },
+    { 0x11D3C, 0x11D3D },
+    { 0x11D3F, 0x11D47 },
+    { 0x11D50, 0x11D59 },
+    { 0x11D60, 0x11D65 },
+    { 0x11D67, 0x11D68 },
+    { 0x11D6A, 0x11D8E },
+    { 0x11D90, 0x11D91 },
+    { 0x11D93, 0x11D98 },
+    { 0x11DA0, 0x11DA9 },
+    { 0x11EE0, 0x11EF8 },
+    { 0x11F00, 0x11F10 },
+    { 0x11F12, 0x11F3A },
+    { 0x11F3E, 0x11F59 },
+    { 0x11FB0, 0x11FB0 },
+    { 0x11FC0, 0x11FF1 },
+    { 0x11FFF, 0x12399 },
+    { 0x12400, 0x1246E },
+    { 0x12470, 0x12474 },
+    { 0x12480, 0x12543 },
+    { 0x12F90, 0x12FF2 },
+    { 0x13000, 0x13455 },
+    { 0x14400, 0x14646 },
+    { 0x16800, 0x16A38 },
+    { 0x16A40, 0x16A5E },
+    { 0x16A60, 0x16A69 },
+    { 0x16A6E, 0x16ABE },
+    { 0x16AC0, 0x16AC9 },
+    { 0x16AD0, 0x16AED },
+    { 0x16AF0, 0x16AF5 },
+    { 0x16B00, 0x16B45 },
+    { 0x16B50, 0x16B59 },
+    { 0x16B5B, 0x16B61 },
+    { 0x16B63, 0x16B77 },
+    { 0x16B7D, 0x16B8F },
+    { 0x16E40, 0x16E9A },
+    { 0x16F00, 0x16F4A },
+    { 0x16F4F, 0x16F87 },
+    { 0x16F8F, 0x16F9F },
+    { 0x16FE0, 0x16FE4 },
+    { 0x16FF0, 0x16FF1 },
+    { 0x17000, 0x187F7 },
+    { 0x18800, 0x18CD5 },
+    { 0x18D00, 0x18D08 },
+    { 0x1AFF0, 0x1AFF3 },
+    { 0x1AFF5, 0x1AFFB },
+    { 0x1AFFD, 0x1AFFE },
+    { 0x1B000, 0x1B122 },
+    { 0x1B132, 0x1B132 },
+    { 0x1B150, 0x1B152 },
+    { 0x1B155, 0x1B155 },
+    { 0x1B164, 0x1B167 },
+    { 0x1B170, 0x1B2FB },
+    { 0x1BC00, 0x1BC6A },
+    { 0x1BC70, 0x1BC7C },
+    { 0x1BC80, 0x1BC88 },
+    { 0x1BC90, 0x1BC99 },
+    { 0x1BC9C, 0x1BCA3 },
+    { 0x1CF00, 0x1CF2D },
+    { 0x1CF30, 0x1CF46 },
+    { 0x1CF50, 0x1CFC3 },
+    { 0x1D000, 0x1D0F5 },
+    { 0x1D100, 0x1D126 },
+    { 0x1D129, 0x1D1EA },
+    { 0x1D200, 0x1D245 },
+    { 0x1D2C0, 0x1D2D3 },
+    { 0x1D2E0, 0x1D2F3 },
+    { 0x1D300, 0x1D356 },
+    { 0x1D360, 0x1D378 },
+    { 0x1D400, 0x1D454 },
+    { 0x1D456, 0x1D49C },
+    { 0x1D49E, 0x1D49F },
+    { 0x1D4A2, 0x1D4A2 },
+    { 0x1D4A5, 0x1D4A6 },
+    { 0x1D4A9, 0x1D4AC },
+    { 0x1D4AE, 0x1D4B9 },
+    { 0x1D4BB, 0x1D4BB },
+    { 0x1D4BD, 0x1D4C3 },
+    { 0x1D4C5, 0x1D505 },
+    { 0x1D507, 0x1D50A },
+    { 0x1D50D, 0x1D514 },
+    { 0x1D516, 0x1D51C },
+    { 0x1D51E, 0x1D539 },
+    { 0x1D53B, 0x1D53E },
+    { 0x1D540, 0x1D544 },
+    { 0x1D546, 0x1D546 },
+    { 0x1D54A, 0x1D550 },
+    { 0x1D552, 0x1D6A5 },
+    { 0x1D6A8, 0x1D7CB },
+    { 0x1D7CE, 0x1DA8B },
+    { 0x1DA9B, 0x1DA9F },
+    { 0x1DAA1, 0x1DAAF },
+    { 0x1DF00, 0x1DF1E },
+    { 0x1DF25, 0x1DF2A },
+    { 0x1E000, 0x1E006 },
+    { 0x1E008, 0x1E018 },
+    { 0x1E01B, 0x1E021 },
+    { 0x1E023, 0x1E024 },
+    { 0x1E026, 0x1E02A },
+    { 0x1E030, 0x1E06D },
+    { 0x1E08F, 0x1E08F },
+    { 0x1E100, 0x1E12C },
+    { 0x1E130, 0x1E13D },
+    { 0x1E140, 0x1E149 },
+    { 0x1E14E, 0x1E14F },
+    { 0x1E290, 0x1E2AE },
+    { 0x1E2C0, 0x1E2F9 },
+    { 0x1E2FF, 0x1E2FF },
+    { 0x1E4D0, 0x1E4F9 },
+    { 0x1E7E0, 0x1E7E6 },
+    { 0x1E7E8, 0x1E7EB },
+    { 0x1E7ED, 0x1E7EE },
+    { 0x1E7F0, 0x1E7FE },
+    { 0x1E800, 0x1E8C4 },
+    { 0x1E8C7, 0x1E8D6 },
+    { 0x1E900, 0x1E94B },
+    { 0x1E950, 0x1E959 },
+    { 0x1E95E, 0x1E95F },
+    { 0x1EC71, 0x1ECB4 },
+    { 0x1ED01, 0x1ED3D },
+    { 0x1EE00, 0x1EE03 },
+    { 0x1EE05, 0x1EE1F },
+    { 0x1EE21, 0x1EE22 },
+    { 0x1EE24, 0x1EE24 },
+    { 0x1EE27, 0x1EE27 },
+    { 0x1EE29, 0x1EE32 },
+    { 0x1EE34, 0x1EE37 },
+    { 0x1EE39, 0x1EE39 },
+    { 0x1EE3B, 0x1EE3B },
+    { 0x1EE42, 0x1EE42 },
+    { 0x1EE47, 0x1EE47 },
+    { 0x1EE49, 0x1EE49 },
+    { 0x1EE4B, 0x1EE4B },
+    { 0x1EE4D, 0x1EE4F },
+    { 0x1EE51, 0x1EE52 },
+    { 0x1EE54, 0x1EE54 },
+    { 0x1EE57, 0x1EE57 },
+    { 0x1EE59, 0x1EE59 },
+    { 0x1EE5B, 0x1EE5B },
+    { 0x1EE5D, 0x1EE5D },
+    { 0x1EE5F, 0x1EE5F },
+    { 0x1EE61, 0x1EE62 },
+    { 0x1EE64, 0x1EE64 },
+    { 0x1EE67, 0x1EE6A },
+    { 0x1EE6C, 0x1EE72 },
+    { 0x1EE74, 0x1EE77 },
+    { 0x1EE79, 0x1EE7C },
+    { 0x1EE7E, 0x1EE7E },
+    { 0x1EE80, 0x1EE89 },
+    { 0x1EE8B, 0x1EE9B },
+    { 0x1EEA1, 0x1EEA3 },
+    { 0x1EEA5, 0x1EEA9 },
+    { 0x1EEAB, 0x1EEBB },
+    { 0x1EEF0, 0x1EEF1 },
+    { 0x1F000, 0x1F02B },
+    { 0x1F030, 0x1F093 },
+    { 0x1F0A0, 0x1F0AE },
+    { 0x1F0B1, 0x1F0BF },
+    { 0x1F0C1, 0x1F0CF },
+    { 0x1F0D1, 0x1F0F5 },
+    { 0x1F100, 0x1F1AD },
+    { 0x1F1E6, 0x1F202 },
+    { 0x1F210, 0x1F23B },
+    { 0x1F240, 0x1F248 },
+    { 0x1F250, 0x1F251 },
+    { 0x1F260, 0x1F265 },
+    { 0x1F300, 0x1F6D7 },
+    { 0x1F6DC, 0x1F6EC },
+    { 0x1F6F0, 0x1F6FC },
+    { 0x1F700, 0x1F776 },
+    { 0x1F77B, 0x1F7D9 },
+    { 0x1F7E0, 0x1F7EB },
+    { 0x1F7F0, 0x1F7F0 },
+    { 0x1F800, 0x1F80B },
+    { 0x1F810, 0x1F847 },
+    { 0x1F850, 0x1F859 },
+    { 0x1F860, 0x1F887 },
+    { 0x1F890, 0x1F8AD },
+    { 0x1F8B0, 0x1F8B1 },
+    { 0x1F900, 0x1FA53 },
+    { 0x1FA60, 0x1FA6D },
+    { 0x1FA70, 0x1FA7C },
+    { 0x1FA80, 0x1FA88 },
+    { 0x1FA90, 0x1FABD },
+    { 0x1FABF, 0x1FAC5 },
+    { 0x1FACE, 0x1FADB },
+    { 0x1FAE0, 0x1FAE8 },
+    { 0x1FAF0, 0x1FAF8 },
+    { 0x1FB00, 0x1FB92 },
+    { 0x1FB94, 0x1FBCA },
+    { 0x1FBF0, 0x1FBF9 },
+    { 0x20000, 0x2A6DF },
+    { 0x2A700, 0x2B739 },
+    { 0x2B740, 0x2B81D },
+    { 0x2B820, 0x2CEA1 },
+    { 0x2CEB0, 0x2EBE0 },
+    { 0x2F800, 0x2FA1D },
+    { 0x30000, 0x3134A },
+    { 0x31350, 0x323AF },
+    { 0xE0001, 0xE0001 },
+    { 0xE0020, 0xE007F },
+    { 0xE0100, 0xE01EF },
+    { 0xF0000, 0xFFFFD },
+    { 0x100000, 0x10FFFD }
+
+#define PREDICATE(c) uc_is_print (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index c4cd62799c693d44ec058d9dec2b68fecb106818..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_punct.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1cd20e2ad87cc1c1b6f67174cc648dc688f459b7
--- /dev/null
@@ -0,0 +1,588 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0021, 0x002F },
+    { 0x003A, 0x0040 },
+    { 0x005B, 0x0060 },
+    { 0x007B, 0x007E },
+    { 0x00A0, 0x00A9 },
+    { 0x00AB, 0x00B4 },
+    { 0x00B6, 0x00B9 },
+    { 0x00BB, 0x00BF },
+    { 0x00D7, 0x00D7 },
+    { 0x00F7, 0x00F7 },
+    { 0x02C2, 0x02C5 },
+    { 0x02D2, 0x02DF },
+    { 0x02E5, 0x02EB },
+    { 0x02ED, 0x02ED },
+    { 0x02EF, 0x0344 },
+    { 0x0346, 0x036F },
+    { 0x0375, 0x0375 },
+    { 0x037E, 0x037E },
+    { 0x0384, 0x0385 },
+    { 0x0387, 0x0387 },
+    { 0x03F6, 0x03F6 },
+    { 0x0482, 0x0489 },
+    { 0x055A, 0x055F },
+    { 0x0589, 0x058A },
+    { 0x058D, 0x058F },
+    { 0x0591, 0x05C7 },
+    { 0x05F3, 0x05F4 },
+    { 0x0600, 0x061F },
+    { 0x064B, 0x065F },
+    { 0x066A, 0x066D },
+    { 0x0670, 0x0670 },
+    { 0x06D4, 0x06D4 },
+    { 0x06D6, 0x06E4 },
+    { 0x06E7, 0x06ED },
+    { 0x06FD, 0x06FE },
+    { 0x0700, 0x070D },
+    { 0x070F, 0x070F },
+    { 0x0711, 0x0711 },
+    { 0x0730, 0x074A },
+    { 0x07A6, 0x07B0 },
+    { 0x07EB, 0x07F3 },
+    { 0x07F6, 0x07F9 },
+    { 0x07FD, 0x07FF },
+    { 0x0816, 0x0819 },
+    { 0x081B, 0x0823 },
+    { 0x0825, 0x0827 },
+    { 0x0829, 0x082D },
+    { 0x0830, 0x083E },
+    { 0x0859, 0x085B },
+    { 0x085E, 0x085E },
+    { 0x0888, 0x0888 },
+    { 0x0890, 0x0891 },
+    { 0x0898, 0x089F },
+    { 0x08CA, 0x0903 },
+    { 0x093A, 0x093C },
+    { 0x093E, 0x094F },
+    { 0x0951, 0x0957 },
+    { 0x0962, 0x0965 },
+    { 0x0970, 0x0970 },
+    { 0x0981, 0x0983 },
+    { 0x09BC, 0x09BC },
+    { 0x09BE, 0x09C4 },
+    { 0x09C7, 0x09C8 },
+    { 0x09CB, 0x09CD },
+    { 0x09D7, 0x09D7 },
+    { 0x09E2, 0x09E3 },
+    { 0x09F2, 0x09FB },
+    { 0x09FD, 0x09FE },
+    { 0x0A01, 0x0A03 },
+    { 0x0A3C, 0x0A3C },
+    { 0x0A3E, 0x0A42 },
+    { 0x0A47, 0x0A48 },
+    { 0x0A4B, 0x0A4D },
+    { 0x0A51, 0x0A51 },
+    { 0x0A70, 0x0A71 },
+    { 0x0A75, 0x0A76 },
+    { 0x0A81, 0x0A83 },
+    { 0x0ABC, 0x0ABC },
+    { 0x0ABE, 0x0AC5 },
+    { 0x0AC7, 0x0AC9 },
+    { 0x0ACB, 0x0ACD },
+    { 0x0AE2, 0x0AE3 },
+    { 0x0AF0, 0x0AF1 },
+    { 0x0AFA, 0x0AFF },
+    { 0x0B01, 0x0B03 },
+    { 0x0B3C, 0x0B3C },
+    { 0x0B3E, 0x0B44 },
+    { 0x0B47, 0x0B48 },
+    { 0x0B4B, 0x0B4D },
+    { 0x0B55, 0x0B57 },
+    { 0x0B62, 0x0B63 },
+    { 0x0B70, 0x0B70 },
+    { 0x0B72, 0x0B77 },
+    { 0x0B82, 0x0B82 },
+    { 0x0BBE, 0x0BC2 },
+    { 0x0BC6, 0x0BC8 },
+    { 0x0BCA, 0x0BCD },
+    { 0x0BD7, 0x0BD7 },
+    { 0x0BF0, 0x0BFA },
+    { 0x0C00, 0x0C04 },
+    { 0x0C3C, 0x0C3C },
+    { 0x0C3E, 0x0C44 },
+    { 0x0C46, 0x0C48 },
+    { 0x0C4A, 0x0C4D },
+    { 0x0C55, 0x0C56 },
+    { 0x0C62, 0x0C63 },
+    { 0x0C77, 0x0C7F },
+    { 0x0C81, 0x0C84 },
+    { 0x0CBC, 0x0CBC },
+    { 0x0CBE, 0x0CC4 },
+    { 0x0CC6, 0x0CC8 },
+    { 0x0CCA, 0x0CCD },
+    { 0x0CD5, 0x0CD6 },
+    { 0x0CE2, 0x0CE3 },
+    { 0x0CF3, 0x0CF3 },
+    { 0x0D00, 0x0D03 },
+    { 0x0D3B, 0x0D3C },
+    { 0x0D3E, 0x0D44 },
+    { 0x0D46, 0x0D48 },
+    { 0x0D4A, 0x0D4D },
+    { 0x0D4F, 0x0D4F },
+    { 0x0D57, 0x0D5E },
+    { 0x0D62, 0x0D63 },
+    { 0x0D70, 0x0D79 },
+    { 0x0D81, 0x0D83 },
+    { 0x0DCA, 0x0DCA },
+    { 0x0DCF, 0x0DD4 },
+    { 0x0DD6, 0x0DD6 },
+    { 0x0DD8, 0x0DDF },
+    { 0x0DF2, 0x0DF4 },
+    { 0x0E2F, 0x0E2F },
+    { 0x0E3F, 0x0E3F },
+    { 0x0E46, 0x0E46 },
+    { 0x0E4F, 0x0E4F },
+    { 0x0E5A, 0x0E5B },
+    { 0x0EB1, 0x0EB1 },
+    { 0x0EB4, 0x0EBC },
+    { 0x0EC8, 0x0ECE },
+    { 0x0F01, 0x0F1F },
+    { 0x0F2A, 0x0F3F },
+    { 0x0F71, 0x0F87 },
+    { 0x0F8D, 0x0F97 },
+    { 0x0F99, 0x0FBC },
+    { 0x0FBE, 0x0FCC },
+    { 0x0FCE, 0x0FDA },
+    { 0x102B, 0x103E },
+    { 0x104A, 0x104F },
+    { 0x1056, 0x1059 },
+    { 0x105E, 0x1060 },
+    { 0x1062, 0x1064 },
+    { 0x1067, 0x106D },
+    { 0x1071, 0x1074 },
+    { 0x1082, 0x108D },
+    { 0x108F, 0x108F },
+    { 0x109A, 0x109F },
+    { 0x10FB, 0x10FB },
+    { 0x135D, 0x137C },
+    { 0x1390, 0x1399 },
+    { 0x1400, 0x1400 },
+    { 0x166D, 0x166E },
+    { 0x169B, 0x169C },
+    { 0x16EB, 0x16ED },
+    { 0x1712, 0x1715 },
+    { 0x1732, 0x1736 },
+    { 0x1752, 0x1753 },
+    { 0x1772, 0x1773 },
+    { 0x17B4, 0x17D6 },
+    { 0x17D8, 0x17DB },
+    { 0x17DD, 0x17DD },
+    { 0x17F0, 0x17F9 },
+    { 0x1800, 0x180F },
+    { 0x1885, 0x1886 },
+    { 0x18A9, 0x18A9 },
+    { 0x1920, 0x192B },
+    { 0x1930, 0x193B },
+    { 0x1940, 0x1940 },
+    { 0x1944, 0x1945 },
+    { 0x19DA, 0x19DA },
+    { 0x19DE, 0x19FF },
+    { 0x1A17, 0x1A1B },
+    { 0x1A1E, 0x1A1F },
+    { 0x1A55, 0x1A5E },
+    { 0x1A60, 0x1A7C },
+    { 0x1A7F, 0x1A7F },
+    { 0x1AA0, 0x1AA6 },
+    { 0x1AA8, 0x1AAD },
+    { 0x1AB0, 0x1ACE },
+    { 0x1B00, 0x1B04 },
+    { 0x1B34, 0x1B44 },
+    { 0x1B5A, 0x1B7E },
+    { 0x1B80, 0x1B82 },
+    { 0x1BA1, 0x1BAD },
+    { 0x1BE6, 0x1BF3 },
+    { 0x1BFC, 0x1BFF },
+    { 0x1C24, 0x1C37 },
+    { 0x1C3B, 0x1C3F },
+    { 0x1C7E, 0x1C7F },
+    { 0x1CC0, 0x1CC7 },
+    { 0x1CD0, 0x1CE8 },
+    { 0x1CED, 0x1CED },
+    { 0x1CF4, 0x1CF4 },
+    { 0x1CF7, 0x1CF9 },
+    { 0x1DC0, 0x1DFF },
+    { 0x1FBD, 0x1FBD },
+    { 0x1FBF, 0x1FC1 },
+    { 0x1FCD, 0x1FCF },
+    { 0x1FDD, 0x1FDF },
+    { 0x1FED, 0x1FEF },
+    { 0x1FFD, 0x1FFE },
+    { 0x2007, 0x2007 },
+    { 0x200B, 0x2027 },
+    { 0x202A, 0x205E },
+    { 0x2060, 0x2064 },
+    { 0x2066, 0x2070 },
+    { 0x2074, 0x207E },
+    { 0x2080, 0x208E },
+    { 0x20A0, 0x20C0 },
+    { 0x20D0, 0x20F0 },
+    { 0x2100, 0x2101 },
+    { 0x2103, 0x2106 },
+    { 0x2108, 0x2109 },
+    { 0x2114, 0x2114 },
+    { 0x2116, 0x2118 },
+    { 0x211E, 0x2123 },
+    { 0x2125, 0x2125 },
+    { 0x2127, 0x2127 },
+    { 0x212E, 0x212E },
+    { 0x213A, 0x213B },
+    { 0x2140, 0x2144 },
+    { 0x214A, 0x214D },
+    { 0x214F, 0x215F },
+    { 0x2189, 0x218B },
+    { 0x2190, 0x2426 },
+    { 0x2440, 0x244A },
+    { 0x2460, 0x249B },
+    { 0x24EA, 0x2B73 },
+    { 0x2B76, 0x2B95 },
+    { 0x2B97, 0x2BFF },
+    { 0x2CE5, 0x2CEA },
+    { 0x2CEF, 0x2CF1 },
+    { 0x2CF9, 0x2CFF },
+    { 0x2D70, 0x2D70 },
+    { 0x2D7F, 0x2D7F },
+    { 0x2DE0, 0x2E2E },
+    { 0x2E30, 0x2E5D },
+    { 0x2E80, 0x2E99 },
+    { 0x2E9B, 0x2EF3 },
+    { 0x2F00, 0x2FD5 },
+    { 0x2FF0, 0x2FFB },
+    { 0x3001, 0x3004 },
+    { 0x3008, 0x3020 },
+    { 0x302A, 0x3030 },
+    { 0x3036, 0x3037 },
+    { 0x303D, 0x303F },
+    { 0x3099, 0x309C },
+    { 0x30A0, 0x30A0 },
+    { 0x30FB, 0x30FB },
+    { 0x3190, 0x319F },
+    { 0x31C0, 0x31E3 },
+    { 0x3200, 0x321E },
+    { 0x3220, 0x33FF },
+    { 0x4DC0, 0x4DFF },
+    { 0xA490, 0xA4C6 },
+    { 0xA4FE, 0xA4FF },
+    { 0xA60D, 0xA60F },
+    { 0xA66F, 0xA67E },
+    { 0xA69E, 0xA69F },
+    { 0xA6F0, 0xA6F7 },
+    { 0xA700, 0xA716 },
+    { 0xA720, 0xA721 },
+    { 0xA789, 0xA78A },
+    { 0xA802, 0xA802 },
+    { 0xA806, 0xA806 },
+    { 0xA80B, 0xA80B },
+    { 0xA823, 0xA82C },
+    { 0xA830, 0xA839 },
+    { 0xA874, 0xA877 },
+    { 0xA880, 0xA881 },
+    { 0xA8B4, 0xA8C5 },
+    { 0xA8CE, 0xA8CF },
+    { 0xA8E0, 0xA8F1 },
+    { 0xA8F8, 0xA8FA },
+    { 0xA8FC, 0xA8FC },
+    { 0xA8FF, 0xA8FF },
+    { 0xA926, 0xA92F },
+    { 0xA947, 0xA953 },
+    { 0xA95F, 0xA95F },
+    { 0xA980, 0xA983 },
+    { 0xA9B3, 0xA9CD },
+    { 0xA9DE, 0xA9DF },
+    { 0xA9E5, 0xA9E5 },
+    { 0xAA29, 0xAA36 },
+    { 0xAA43, 0xAA43 },
+    { 0xAA4C, 0xAA4D },
+    { 0xAA5C, 0xAA5F },
+    { 0xAA77, 0xAA79 },
+    { 0xAA7B, 0xAA7D },
+    { 0xAAB0, 0xAAB0 },
+    { 0xAAB2, 0xAAB4 },
+    { 0xAAB7, 0xAAB8 },
+    { 0xAABE, 0xAABF },
+    { 0xAAC1, 0xAAC1 },
+    { 0xAADE, 0xAADF },
+    { 0xAAEB, 0xAAF1 },
+    { 0xAAF5, 0xAAF6 },
+    { 0xAB5B, 0xAB5B },
+    { 0xAB6A, 0xAB6B },
+    { 0xABE3, 0xABED },
+    { 0xE000, 0xF8FF },
+    { 0xFB1E, 0xFB1E },
+    { 0xFB29, 0xFB29 },
+    { 0xFBB2, 0xFBC2 },
+    { 0xFD3E, 0xFD4F },
+    { 0xFDCF, 0xFDCF },
+    { 0xFDFC, 0xFE19 },
+    { 0xFE20, 0xFE52 },
+    { 0xFE54, 0xFE66 },
+    { 0xFE68, 0xFE6B },
+    { 0xFEFF, 0xFEFF },
+    { 0xFF01, 0xFF0F },
+    { 0xFF1A, 0xFF20 },
+    { 0xFF3B, 0xFF40 },
+    { 0xFF5B, 0xFF65 },
+    { 0xFFE0, 0xFFE6 },
+    { 0xFFE8, 0xFFEE },
+    { 0xFFF9, 0xFFFD },
+    { 0x10100, 0x10102 },
+    { 0x10107, 0x10133 },
+    { 0x10137, 0x1013F },
+    { 0x10175, 0x1018E },
+    { 0x10190, 0x1019C },
+    { 0x101A0, 0x101A0 },
+    { 0x101D0, 0x101FD },
+    { 0x102E0, 0x102FB },
+    { 0x10320, 0x10323 },
+    { 0x10376, 0x1037A },
+    { 0x1039F, 0x1039F },
+    { 0x103D0, 0x103D0 },
+    { 0x1056F, 0x1056F },
+    { 0x10857, 0x1085F },
+    { 0x10877, 0x1087F },
+    { 0x108A7, 0x108AF },
+    { 0x108FB, 0x108FF },
+    { 0x10916, 0x1091B },
+    { 0x1091F, 0x1091F },
+    { 0x1093F, 0x1093F },
+    { 0x109BC, 0x109BD },
+    { 0x109C0, 0x109CF },
+    { 0x109D2, 0x109FF },
+    { 0x10A01, 0x10A03 },
+    { 0x10A05, 0x10A06 },
+    { 0x10A0C, 0x10A0F },
+    { 0x10A38, 0x10A3A },
+    { 0x10A3F, 0x10A48 },
+    { 0x10A50, 0x10A58 },
+    { 0x10A7D, 0x10A7F },
+    { 0x10A9D, 0x10A9F },
+    { 0x10AC8, 0x10AC8 },
+    { 0x10AE5, 0x10AE6 },
+    { 0x10AEB, 0x10AF6 },
+    { 0x10B39, 0x10B3F },
+    { 0x10B58, 0x10B5F },
+    { 0x10B78, 0x10B7F },
+    { 0x10B99, 0x10B9C },
+    { 0x10BA9, 0x10BAF },
+    { 0x10CFA, 0x10CFF },
+    { 0x10D24, 0x10D27 },
+    { 0x10E60, 0x10E7E },
+    { 0x10EAB, 0x10EAD },
+    { 0x10EFD, 0x10EFF },
+    { 0x10F1D, 0x10F26 },
+    { 0x10F46, 0x10F59 },
+    { 0x10F82, 0x10F89 },
+    { 0x10FC5, 0x10FCB },
+    { 0x11000, 0x11002 },
+    { 0x11038, 0x1104D },
+    { 0x11052, 0x11065 },
+    { 0x11070, 0x11070 },
+    { 0x11073, 0x11074 },
+    { 0x1107F, 0x11082 },
+    { 0x110B0, 0x110C2 },
+    { 0x110CD, 0x110CD },
+    { 0x11100, 0x11102 },
+    { 0x11127, 0x11134 },
+    { 0x11140, 0x11143 },
+    { 0x11145, 0x11146 },
+    { 0x11173, 0x11175 },
+    { 0x11180, 0x11182 },
+    { 0x111B3, 0x111C0 },
+    { 0x111C5, 0x111CF },
+    { 0x111DB, 0x111DB },
+    { 0x111DD, 0x111DF },
+    { 0x111E1, 0x111F4 },
+    { 0x1122C, 0x1123E },
+    { 0x11241, 0x11241 },
+    { 0x112A9, 0x112A9 },
+    { 0x112DF, 0x112EA },
+    { 0x11300, 0x11303 },
+    { 0x1133B, 0x1133C },
+    { 0x1133E, 0x11344 },
+    { 0x11347, 0x11348 },
+    { 0x1134B, 0x1134D },
+    { 0x11357, 0x11357 },
+    { 0x11362, 0x11363 },
+    { 0x11366, 0x1136C },
+    { 0x11370, 0x11374 },
+    { 0x11435, 0x11446 },
+    { 0x1144B, 0x1144F },
+    { 0x1145A, 0x1145B },
+    { 0x1145D, 0x1145E },
+    { 0x114B0, 0x114C3 },
+    { 0x114C6, 0x114C6 },
+    { 0x115AF, 0x115B5 },
+    { 0x115B8, 0x115D7 },
+    { 0x115DC, 0x115DD },
+    { 0x11630, 0x11643 },
+    { 0x11660, 0x1166C },
+    { 0x116AB, 0x116B7 },
+    { 0x116B9, 0x116B9 },
+    { 0x1171D, 0x1172B },
+    { 0x1173A, 0x1173F },
+    { 0x1182C, 0x1183B },
+    { 0x118EA, 0x118F2 },
+    { 0x11930, 0x11935 },
+    { 0x11937, 0x11938 },
+    { 0x1193B, 0x1193E },
+    { 0x11940, 0x11940 },
+    { 0x11942, 0x11946 },
+    { 0x119D1, 0x119D7 },
+    { 0x119DA, 0x119E0 },
+    { 0x119E2, 0x119E2 },
+    { 0x119E4, 0x119E4 },
+    { 0x11A01, 0x11A0A },
+    { 0x11A33, 0x11A39 },
+    { 0x11A3B, 0x11A47 },
+    { 0x11A51, 0x11A5B },
+    { 0x11A8A, 0x11A9C },
+    { 0x11A9E, 0x11AA2 },
+    { 0x11B00, 0x11B09 },
+    { 0x11C2F, 0x11C36 },
+    { 0x11C38, 0x11C3F },
+    { 0x11C41, 0x11C45 },
+    { 0x11C5A, 0x11C6C },
+    { 0x11C70, 0x11C71 },
+    { 0x11C92, 0x11CA7 },
+    { 0x11CA9, 0x11CB6 },
+    { 0x11D31, 0x11D36 },
+    { 0x11D3A, 0x11D3A },
+    { 0x11D3C, 0x11D3D },
+    { 0x11D3F, 0x11D45 },
+    { 0x11D47, 0x11D47 },
+    { 0x11D8A, 0x11D8E },
+    { 0x11D90, 0x11D91 },
+    { 0x11D93, 0x11D97 },
+    { 0x11EF3, 0x11EF8 },
+    { 0x11F00, 0x11F01 },
+    { 0x11F03, 0x11F03 },
+    { 0x11F34, 0x11F3A },
+    { 0x11F3E, 0x11F4F },
+    { 0x11FC0, 0x11FF1 },
+    { 0x11FFF, 0x11FFF },
+    { 0x12470, 0x12474 },
+    { 0x12FF1, 0x12FF2 },
+    { 0x13430, 0x13440 },
+    { 0x13447, 0x13455 },
+    { 0x16A6E, 0x16A6F },
+    { 0x16AF0, 0x16AF5 },
+    { 0x16B30, 0x16B3F },
+    { 0x16B44, 0x16B45 },
+    { 0x16B5B, 0x16B61 },
+    { 0x16E80, 0x16E9A },
+    { 0x16F4F, 0x16F4F },
+    { 0x16F51, 0x16F87 },
+    { 0x16F8F, 0x16F92 },
+    { 0x16FE2, 0x16FE2 },
+    { 0x16FE4, 0x16FE4 },
+    { 0x16FF0, 0x16FF1 },
+    { 0x1BC9C, 0x1BCA3 },
+    { 0x1CF00, 0x1CF2D },
+    { 0x1CF30, 0x1CF46 },
+    { 0x1CF50, 0x1CFC3 },
+    { 0x1D000, 0x1D0F5 },
+    { 0x1D100, 0x1D126 },
+    { 0x1D129, 0x1D1EA },
+    { 0x1D200, 0x1D245 },
+    { 0x1D2C0, 0x1D2D3 },
+    { 0x1D2E0, 0x1D2F3 },
+    { 0x1D300, 0x1D356 },
+    { 0x1D360, 0x1D378 },
+    { 0x1D6C1, 0x1D6C1 },
+    { 0x1D6DB, 0x1D6DB },
+    { 0x1D6FB, 0x1D6FB },
+    { 0x1D715, 0x1D715 },
+    { 0x1D735, 0x1D735 },
+    { 0x1D74F, 0x1D74F },
+    { 0x1D76F, 0x1D76F },
+    { 0x1D789, 0x1D789 },
+    { 0x1D7A9, 0x1D7A9 },
+    { 0x1D7C3, 0x1D7C3 },
+    { 0x1D800, 0x1DA8B },
+    { 0x1DA9B, 0x1DA9F },
+    { 0x1DAA1, 0x1DAAF },
+    { 0x1E000, 0x1E006 },
+    { 0x1E008, 0x1E018 },
+    { 0x1E01B, 0x1E021 },
+    { 0x1E023, 0x1E024 },
+    { 0x1E026, 0x1E02A },
+    { 0x1E08F, 0x1E08F },
+    { 0x1E130, 0x1E136 },
+    { 0x1E14F, 0x1E14F },
+    { 0x1E2AE, 0x1E2AE },
+    { 0x1E2EC, 0x1E2EF },
+    { 0x1E2FF, 0x1E2FF },
+    { 0x1E4EC, 0x1E4EF },
+    { 0x1E8C7, 0x1E8D6 },
+    { 0x1E944, 0x1E94A },
+    { 0x1E95E, 0x1E95F },
+    { 0x1EC71, 0x1ECB4 },
+    { 0x1ED01, 0x1ED3D },
+    { 0x1EEF0, 0x1EEF1 },
+    { 0x1F000, 0x1F02B },
+    { 0x1F030, 0x1F093 },
+    { 0x1F0A0, 0x1F0AE },
+    { 0x1F0B1, 0x1F0BF },
+    { 0x1F0C1, 0x1F0CF },
+    { 0x1F0D1, 0x1F0F5 },
+    { 0x1F100, 0x1F10F },
+    { 0x1F12D, 0x1F12F },
+    { 0x1F14A, 0x1F14F },
+    { 0x1F16A, 0x1F16F },
+    { 0x1F18B, 0x1F1A4 },
+    { 0x1F1A6, 0x1F1AD },
+    { 0x1F200, 0x1F202 },
+    { 0x1F210, 0x1F23B },
+    { 0x1F240, 0x1F248 },
+    { 0x1F250, 0x1F251 },
+    { 0x1F260, 0x1F265 },
+    { 0x1F300, 0x1F6D7 },
+    { 0x1F6DC, 0x1F6EC },
+    { 0x1F6F0, 0x1F6FC },
+    { 0x1F700, 0x1F776 },
+    { 0x1F77B, 0x1F7D9 },
+    { 0x1F7E0, 0x1F7EB },
+    { 0x1F7F0, 0x1F7F0 },
+    { 0x1F800, 0x1F80B },
+    { 0x1F810, 0x1F847 },
+    { 0x1F850, 0x1F859 },
+    { 0x1F860, 0x1F887 },
+    { 0x1F890, 0x1F8AD },
+    { 0x1F8B0, 0x1F8B1 },
+    { 0x1F900, 0x1FA53 },
+    { 0x1FA60, 0x1FA6D },
+    { 0x1FA70, 0x1FA7C },
+    { 0x1FA80, 0x1FA88 },
+    { 0x1FA90, 0x1FABD },
+    { 0x1FABF, 0x1FAC5 },
+    { 0x1FACE, 0x1FADB },
+    { 0x1FAE0, 0x1FAE8 },
+    { 0x1FAF0, 0x1FAF8 },
+    { 0x1FB00, 0x1FB92 },
+    { 0x1FB94, 0x1FBCA },
+    { 0xE0001, 0xE0001 },
+    { 0xE0020, 0xE007F },
+    { 0xE0100, 0xE01EF },
+    { 0xF0000, 0xFFFFD },
+    { 0x100000, 0x10FFFD }
+
+#define PREDICATE(c) uc_is_punct (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index 77fcfd4816bb4514de39efd82de06935393b125a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_space.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..da37cf74fed2a3971065223695a95cac748739bd
--- /dev/null
@@ -0,0 +1,30 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0009, 0x000D },
+    { 0x0020, 0x0020 },
+    { 0x1680, 0x1680 },
+    { 0x2000, 0x2006 },
+    { 0x2008, 0x200A },
+    { 0x2028, 0x2029 },
+    { 0x205F, 0x205F },
+    { 0x3000, 0x3000 }
+
+#define PREDICATE(c) uc_is_space (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index dac5151f24aeb8f3e944206a4d00a3e68770db95..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_upper.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..724d4c7cd2282086e1a41ee99bf38dab10af1ec1
--- /dev/null
@@ -0,0 +1,631 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0041, 0x005A },
+    { 0x00C0, 0x00D6 },
+    { 0x00D8, 0x00DE },
+    { 0x0100, 0x0100 },
+    { 0x0102, 0x0102 },
+    { 0x0104, 0x0104 },
+    { 0x0106, 0x0106 },
+    { 0x0108, 0x0108 },
+    { 0x010A, 0x010A },
+    { 0x010C, 0x010C },
+    { 0x010E, 0x010E },
+    { 0x0110, 0x0110 },
+    { 0x0112, 0x0112 },
+    { 0x0114, 0x0114 },
+    { 0x0116, 0x0116 },
+    { 0x0118, 0x0118 },
+    { 0x011A, 0x011A },
+    { 0x011C, 0x011C },
+    { 0x011E, 0x011E },
+    { 0x0120, 0x0120 },
+    { 0x0122, 0x0122 },
+    { 0x0124, 0x0124 },
+    { 0x0126, 0x0126 },
+    { 0x0128, 0x0128 },
+    { 0x012A, 0x012A },
+    { 0x012C, 0x012C },
+    { 0x012E, 0x012E },
+    { 0x0130, 0x0130 },
+    { 0x0132, 0x0132 },
+    { 0x0134, 0x0134 },
+    { 0x0136, 0x0136 },
+    { 0x0139, 0x0139 },
+    { 0x013B, 0x013B },
+    { 0x013D, 0x013D },
+    { 0x013F, 0x013F },
+    { 0x0141, 0x0141 },
+    { 0x0143, 0x0143 },
+    { 0x0145, 0x0145 },
+    { 0x0147, 0x0147 },
+    { 0x014A, 0x014A },
+    { 0x014C, 0x014C },
+    { 0x014E, 0x014E },
+    { 0x0150, 0x0150 },
+    { 0x0152, 0x0152 },
+    { 0x0154, 0x0154 },
+    { 0x0156, 0x0156 },
+    { 0x0158, 0x0158 },
+    { 0x015A, 0x015A },
+    { 0x015C, 0x015C },
+    { 0x015E, 0x015E },
+    { 0x0160, 0x0160 },
+    { 0x0162, 0x0162 },
+    { 0x0164, 0x0164 },
+    { 0x0166, 0x0166 },
+    { 0x0168, 0x0168 },
+    { 0x016A, 0x016A },
+    { 0x016C, 0x016C },
+    { 0x016E, 0x016E },
+    { 0x0170, 0x0170 },
+    { 0x0172, 0x0172 },
+    { 0x0174, 0x0174 },
+    { 0x0176, 0x0176 },
+    { 0x0178, 0x0179 },
+    { 0x017B, 0x017B },
+    { 0x017D, 0x017D },
+    { 0x0181, 0x0182 },
+    { 0x0184, 0x0184 },
+    { 0x0186, 0x0187 },
+    { 0x0189, 0x018B },
+    { 0x018E, 0x0191 },
+    { 0x0193, 0x0194 },
+    { 0x0196, 0x0198 },
+    { 0x019C, 0x019D },
+    { 0x019F, 0x01A0 },
+    { 0x01A2, 0x01A2 },
+    { 0x01A4, 0x01A4 },
+    { 0x01A6, 0x01A7 },
+    { 0x01A9, 0x01A9 },
+    { 0x01AC, 0x01AC },
+    { 0x01AE, 0x01AF },
+    { 0x01B1, 0x01B3 },
+    { 0x01B5, 0x01B5 },
+    { 0x01B7, 0x01B8 },
+    { 0x01BC, 0x01BC },
+    { 0x01C4, 0x01C5 },
+    { 0x01C7, 0x01C8 },
+    { 0x01CA, 0x01CB },
+    { 0x01CD, 0x01CD },
+    { 0x01CF, 0x01CF },
+    { 0x01D1, 0x01D1 },
+    { 0x01D3, 0x01D3 },
+    { 0x01D5, 0x01D5 },
+    { 0x01D7, 0x01D7 },
+    { 0x01D9, 0x01D9 },
+    { 0x01DB, 0x01DB },
+    { 0x01DE, 0x01DE },
+    { 0x01E0, 0x01E0 },
+    { 0x01E2, 0x01E2 },
+    { 0x01E4, 0x01E4 },
+    { 0x01E6, 0x01E6 },
+    { 0x01E8, 0x01E8 },
+    { 0x01EA, 0x01EA },
+    { 0x01EC, 0x01EC },
+    { 0x01EE, 0x01EE },
+    { 0x01F1, 0x01F2 },
+    { 0x01F4, 0x01F4 },
+    { 0x01F6, 0x01F8 },
+    { 0x01FA, 0x01FA },
+    { 0x01FC, 0x01FC },
+    { 0x01FE, 0x01FE },
+    { 0x0200, 0x0200 },
+    { 0x0202, 0x0202 },
+    { 0x0204, 0x0204 },
+    { 0x0206, 0x0206 },
+    { 0x0208, 0x0208 },
+    { 0x020A, 0x020A },
+    { 0x020C, 0x020C },
+    { 0x020E, 0x020E },
+    { 0x0210, 0x0210 },
+    { 0x0212, 0x0212 },
+    { 0x0214, 0x0214 },
+    { 0x0216, 0x0216 },
+    { 0x0218, 0x0218 },
+    { 0x021A, 0x021A },
+    { 0x021C, 0x021C },
+    { 0x021E, 0x021E },
+    { 0x0220, 0x0220 },
+    { 0x0222, 0x0222 },
+    { 0x0224, 0x0224 },
+    { 0x0226, 0x0226 },
+    { 0x0228, 0x0228 },
+    { 0x022A, 0x022A },
+    { 0x022C, 0x022C },
+    { 0x022E, 0x022E },
+    { 0x0230, 0x0230 },
+    { 0x0232, 0x0232 },
+    { 0x023A, 0x023B },
+    { 0x023D, 0x023E },
+    { 0x0241, 0x0241 },
+    { 0x0243, 0x0246 },
+    { 0x0248, 0x0248 },
+    { 0x024A, 0x024A },
+    { 0x024C, 0x024C },
+    { 0x024E, 0x024E },
+    { 0x0370, 0x0370 },
+    { 0x0372, 0x0372 },
+    { 0x0376, 0x0376 },
+    { 0x037F, 0x037F },
+    { 0x0386, 0x0386 },
+    { 0x0388, 0x038A },
+    { 0x038C, 0x038C },
+    { 0x038E, 0x038F },
+    { 0x0391, 0x03A1 },
+    { 0x03A3, 0x03AB },
+    { 0x03CF, 0x03CF },
+    { 0x03D8, 0x03D8 },
+    { 0x03DA, 0x03DA },
+    { 0x03DC, 0x03DC },
+    { 0x03DE, 0x03DE },
+    { 0x03E0, 0x03E0 },
+    { 0x03E2, 0x03E2 },
+    { 0x03E4, 0x03E4 },
+    { 0x03E6, 0x03E6 },
+    { 0x03E8, 0x03E8 },
+    { 0x03EA, 0x03EA },
+    { 0x03EC, 0x03EC },
+    { 0x03EE, 0x03EE },
+    { 0x03F4, 0x03F4 },
+    { 0x03F7, 0x03F7 },
+    { 0x03F9, 0x03FA },
+    { 0x03FD, 0x042F },
+    { 0x0460, 0x0460 },
+    { 0x0462, 0x0462 },
+    { 0x0464, 0x0464 },
+    { 0x0466, 0x0466 },
+    { 0x0468, 0x0468 },
+    { 0x046A, 0x046A },
+    { 0x046C, 0x046C },
+    { 0x046E, 0x046E },
+    { 0x0470, 0x0470 },
+    { 0x0472, 0x0472 },
+    { 0x0474, 0x0474 },
+    { 0x0476, 0x0476 },
+    { 0x0478, 0x0478 },
+    { 0x047A, 0x047A },
+    { 0x047C, 0x047C },
+    { 0x047E, 0x047E },
+    { 0x0480, 0x0480 },
+    { 0x048A, 0x048A },
+    { 0x048C, 0x048C },
+    { 0x048E, 0x048E },
+    { 0x0490, 0x0490 },
+    { 0x0492, 0x0492 },
+    { 0x0494, 0x0494 },
+    { 0x0496, 0x0496 },
+    { 0x0498, 0x0498 },
+    { 0x049A, 0x049A },
+    { 0x049C, 0x049C },
+    { 0x049E, 0x049E },
+    { 0x04A0, 0x04A0 },
+    { 0x04A2, 0x04A2 },
+    { 0x04A4, 0x04A4 },
+    { 0x04A6, 0x04A6 },
+    { 0x04A8, 0x04A8 },
+    { 0x04AA, 0x04AA },
+    { 0x04AC, 0x04AC },
+    { 0x04AE, 0x04AE },
+    { 0x04B0, 0x04B0 },
+    { 0x04B2, 0x04B2 },
+    { 0x04B4, 0x04B4 },
+    { 0x04B6, 0x04B6 },
+    { 0x04B8, 0x04B8 },
+    { 0x04BA, 0x04BA },
+    { 0x04BC, 0x04BC },
+    { 0x04BE, 0x04BE },
+    { 0x04C0, 0x04C1 },
+    { 0x04C3, 0x04C3 },
+    { 0x04C5, 0x04C5 },
+    { 0x04C7, 0x04C7 },
+    { 0x04C9, 0x04C9 },
+    { 0x04CB, 0x04CB },
+    { 0x04CD, 0x04CD },
+    { 0x04D0, 0x04D0 },
+    { 0x04D2, 0x04D2 },
+    { 0x04D4, 0x04D4 },
+    { 0x04D6, 0x04D6 },
+    { 0x04D8, 0x04D8 },
+    { 0x04DA, 0x04DA },
+    { 0x04DC, 0x04DC },
+    { 0x04DE, 0x04DE },
+    { 0x04E0, 0x04E0 },
+    { 0x04E2, 0x04E2 },
+    { 0x04E4, 0x04E4 },
+    { 0x04E6, 0x04E6 },
+    { 0x04E8, 0x04E8 },
+    { 0x04EA, 0x04EA },
+    { 0x04EC, 0x04EC },
+    { 0x04EE, 0x04EE },
+    { 0x04F0, 0x04F0 },
+    { 0x04F2, 0x04F2 },
+    { 0x04F4, 0x04F4 },
+    { 0x04F6, 0x04F6 },
+    { 0x04F8, 0x04F8 },
+    { 0x04FA, 0x04FA },
+    { 0x04FC, 0x04FC },
+    { 0x04FE, 0x04FE },
+    { 0x0500, 0x0500 },
+    { 0x0502, 0x0502 },
+    { 0x0504, 0x0504 },
+    { 0x0506, 0x0506 },
+    { 0x0508, 0x0508 },
+    { 0x050A, 0x050A },
+    { 0x050C, 0x050C },
+    { 0x050E, 0x050E },
+    { 0x0510, 0x0510 },
+    { 0x0512, 0x0512 },
+    { 0x0514, 0x0514 },
+    { 0x0516, 0x0516 },
+    { 0x0518, 0x0518 },
+    { 0x051A, 0x051A },
+    { 0x051C, 0x051C },
+    { 0x051E, 0x051E },
+    { 0x0520, 0x0520 },
+    { 0x0522, 0x0522 },
+    { 0x0524, 0x0524 },
+    { 0x0526, 0x0526 },
+    { 0x0528, 0x0528 },
+    { 0x052A, 0x052A },
+    { 0x052C, 0x052C },
+    { 0x052E, 0x052E },
+    { 0x0531, 0x0556 },
+    { 0x10A0, 0x10C5 },
+    { 0x10C7, 0x10C7 },
+    { 0x10CD, 0x10CD },
+    { 0x13A0, 0x13F5 },
+    { 0x1C90, 0x1CBA },
+    { 0x1CBD, 0x1CBF },
+    { 0x1E00, 0x1E00 },
+    { 0x1E02, 0x1E02 },
+    { 0x1E04, 0x1E04 },
+    { 0x1E06, 0x1E06 },
+    { 0x1E08, 0x1E08 },
+    { 0x1E0A, 0x1E0A },
+    { 0x1E0C, 0x1E0C },
+    { 0x1E0E, 0x1E0E },
+    { 0x1E10, 0x1E10 },
+    { 0x1E12, 0x1E12 },
+    { 0x1E14, 0x1E14 },
+    { 0x1E16, 0x1E16 },
+    { 0x1E18, 0x1E18 },
+    { 0x1E1A, 0x1E1A },
+    { 0x1E1C, 0x1E1C },
+    { 0x1E1E, 0x1E1E },
+    { 0x1E20, 0x1E20 },
+    { 0x1E22, 0x1E22 },
+    { 0x1E24, 0x1E24 },
+    { 0x1E26, 0x1E26 },
+    { 0x1E28, 0x1E28 },
+    { 0x1E2A, 0x1E2A },
+    { 0x1E2C, 0x1E2C },
+    { 0x1E2E, 0x1E2E },
+    { 0x1E30, 0x1E30 },
+    { 0x1E32, 0x1E32 },
+    { 0x1E34, 0x1E34 },
+    { 0x1E36, 0x1E36 },
+    { 0x1E38, 0x1E38 },
+    { 0x1E3A, 0x1E3A },
+    { 0x1E3C, 0x1E3C },
+    { 0x1E3E, 0x1E3E },
+    { 0x1E40, 0x1E40 },
+    { 0x1E42, 0x1E42 },
+    { 0x1E44, 0x1E44 },
+    { 0x1E46, 0x1E46 },
+    { 0x1E48, 0x1E48 },
+    { 0x1E4A, 0x1E4A },
+    { 0x1E4C, 0x1E4C },
+    { 0x1E4E, 0x1E4E },
+    { 0x1E50, 0x1E50 },
+    { 0x1E52, 0x1E52 },
+    { 0x1E54, 0x1E54 },
+    { 0x1E56, 0x1E56 },
+    { 0x1E58, 0x1E58 },
+    { 0x1E5A, 0x1E5A },
+    { 0x1E5C, 0x1E5C },
+    { 0x1E5E, 0x1E5E },
+    { 0x1E60, 0x1E60 },
+    { 0x1E62, 0x1E62 },
+    { 0x1E64, 0x1E64 },
+    { 0x1E66, 0x1E66 },
+    { 0x1E68, 0x1E68 },
+    { 0x1E6A, 0x1E6A },
+    { 0x1E6C, 0x1E6C },
+    { 0x1E6E, 0x1E6E },
+    { 0x1E70, 0x1E70 },
+    { 0x1E72, 0x1E72 },
+    { 0x1E74, 0x1E74 },
+    { 0x1E76, 0x1E76 },
+    { 0x1E78, 0x1E78 },
+    { 0x1E7A, 0x1E7A },
+    { 0x1E7C, 0x1E7C },
+    { 0x1E7E, 0x1E7E },
+    { 0x1E80, 0x1E80 },
+    { 0x1E82, 0x1E82 },
+    { 0x1E84, 0x1E84 },
+    { 0x1E86, 0x1E86 },
+    { 0x1E88, 0x1E88 },
+    { 0x1E8A, 0x1E8A },
+    { 0x1E8C, 0x1E8C },
+    { 0x1E8E, 0x1E8E },
+    { 0x1E90, 0x1E90 },
+    { 0x1E92, 0x1E92 },
+    { 0x1E94, 0x1E94 },
+    { 0x1E9E, 0x1E9E },
+    { 0x1EA0, 0x1EA0 },
+    { 0x1EA2, 0x1EA2 },
+    { 0x1EA4, 0x1EA4 },
+    { 0x1EA6, 0x1EA6 },
+    { 0x1EA8, 0x1EA8 },
+    { 0x1EAA, 0x1EAA },
+    { 0x1EAC, 0x1EAC },
+    { 0x1EAE, 0x1EAE },
+    { 0x1EB0, 0x1EB0 },
+    { 0x1EB2, 0x1EB2 },
+    { 0x1EB4, 0x1EB4 },
+    { 0x1EB6, 0x1EB6 },
+    { 0x1EB8, 0x1EB8 },
+    { 0x1EBA, 0x1EBA },
+    { 0x1EBC, 0x1EBC },
+    { 0x1EBE, 0x1EBE },
+    { 0x1EC0, 0x1EC0 },
+    { 0x1EC2, 0x1EC2 },
+    { 0x1EC4, 0x1EC4 },
+    { 0x1EC6, 0x1EC6 },
+    { 0x1EC8, 0x1EC8 },
+    { 0x1ECA, 0x1ECA },
+    { 0x1ECC, 0x1ECC },
+    { 0x1ECE, 0x1ECE },
+    { 0x1ED0, 0x1ED0 },
+    { 0x1ED2, 0x1ED2 },
+    { 0x1ED4, 0x1ED4 },
+    { 0x1ED6, 0x1ED6 },
+    { 0x1ED8, 0x1ED8 },
+    { 0x1EDA, 0x1EDA },
+    { 0x1EDC, 0x1EDC },
+    { 0x1EDE, 0x1EDE },
+    { 0x1EE0, 0x1EE0 },
+    { 0x1EE2, 0x1EE2 },
+    { 0x1EE4, 0x1EE4 },
+    { 0x1EE6, 0x1EE6 },
+    { 0x1EE8, 0x1EE8 },
+    { 0x1EEA, 0x1EEA },
+    { 0x1EEC, 0x1EEC },
+    { 0x1EEE, 0x1EEE },
+    { 0x1EF0, 0x1EF0 },
+    { 0x1EF2, 0x1EF2 },
+    { 0x1EF4, 0x1EF4 },
+    { 0x1EF6, 0x1EF6 },
+    { 0x1EF8, 0x1EF8 },
+    { 0x1EFA, 0x1EFA },
+    { 0x1EFC, 0x1EFC },
+    { 0x1EFE, 0x1EFE },
+    { 0x1F08, 0x1F0F },
+    { 0x1F18, 0x1F1D },
+    { 0x1F28, 0x1F2F },
+    { 0x1F38, 0x1F3F },
+    { 0x1F48, 0x1F4D },
+    { 0x1F59, 0x1F59 },
+    { 0x1F5B, 0x1F5B },
+    { 0x1F5D, 0x1F5D },
+    { 0x1F5F, 0x1F5F },
+    { 0x1F68, 0x1F6F },
+    { 0x1F88, 0x1F8F },
+    { 0x1F98, 0x1F9F },
+    { 0x1FA8, 0x1FAF },
+    { 0x1FB8, 0x1FBC },
+    { 0x1FC8, 0x1FCC },
+    { 0x1FD8, 0x1FDB },
+    { 0x1FE8, 0x1FEC },
+    { 0x1FF8, 0x1FFC },
+    { 0x2126, 0x2126 },
+    { 0x212A, 0x212B },
+    { 0x2132, 0x2132 },
+    { 0x2160, 0x216F },
+    { 0x2183, 0x2183 },
+    { 0x24B6, 0x24CF },
+    { 0x2C00, 0x2C2F },
+    { 0x2C60, 0x2C60 },
+    { 0x2C62, 0x2C64 },
+    { 0x2C67, 0x2C67 },
+    { 0x2C69, 0x2C69 },
+    { 0x2C6B, 0x2C6B },
+    { 0x2C6D, 0x2C70 },
+    { 0x2C72, 0x2C72 },
+    { 0x2C75, 0x2C75 },
+    { 0x2C7E, 0x2C80 },
+    { 0x2C82, 0x2C82 },
+    { 0x2C84, 0x2C84 },
+    { 0x2C86, 0x2C86 },
+    { 0x2C88, 0x2C88 },
+    { 0x2C8A, 0x2C8A },
+    { 0x2C8C, 0x2C8C },
+    { 0x2C8E, 0x2C8E },
+    { 0x2C90, 0x2C90 },
+    { 0x2C92, 0x2C92 },
+    { 0x2C94, 0x2C94 },
+    { 0x2C96, 0x2C96 },
+    { 0x2C98, 0x2C98 },
+    { 0x2C9A, 0x2C9A },
+    { 0x2C9C, 0x2C9C },
+    { 0x2C9E, 0x2C9E },
+    { 0x2CA0, 0x2CA0 },
+    { 0x2CA2, 0x2CA2 },
+    { 0x2CA4, 0x2CA4 },
+    { 0x2CA6, 0x2CA6 },
+    { 0x2CA8, 0x2CA8 },
+    { 0x2CAA, 0x2CAA },
+    { 0x2CAC, 0x2CAC },
+    { 0x2CAE, 0x2CAE },
+    { 0x2CB0, 0x2CB0 },
+    { 0x2CB2, 0x2CB2 },
+    { 0x2CB4, 0x2CB4 },
+    { 0x2CB6, 0x2CB6 },
+    { 0x2CB8, 0x2CB8 },
+    { 0x2CBA, 0x2CBA },
+    { 0x2CBC, 0x2CBC },
+    { 0x2CBE, 0x2CBE },
+    { 0x2CC0, 0x2CC0 },
+    { 0x2CC2, 0x2CC2 },
+    { 0x2CC4, 0x2CC4 },
+    { 0x2CC6, 0x2CC6 },
+    { 0x2CC8, 0x2CC8 },
+    { 0x2CCA, 0x2CCA },
+    { 0x2CCC, 0x2CCC },
+    { 0x2CCE, 0x2CCE },
+    { 0x2CD0, 0x2CD0 },
+    { 0x2CD2, 0x2CD2 },
+    { 0x2CD4, 0x2CD4 },
+    { 0x2CD6, 0x2CD6 },
+    { 0x2CD8, 0x2CD8 },
+    { 0x2CDA, 0x2CDA },
+    { 0x2CDC, 0x2CDC },
+    { 0x2CDE, 0x2CDE },
+    { 0x2CE0, 0x2CE0 },
+    { 0x2CE2, 0x2CE2 },
+    { 0x2CEB, 0x2CEB },
+    { 0x2CED, 0x2CED },
+    { 0x2CF2, 0x2CF2 },
+    { 0xA640, 0xA640 },
+    { 0xA642, 0xA642 },
+    { 0xA644, 0xA644 },
+    { 0xA646, 0xA646 },
+    { 0xA648, 0xA648 },
+    { 0xA64A, 0xA64A },
+    { 0xA64C, 0xA64C },
+    { 0xA64E, 0xA64E },
+    { 0xA650, 0xA650 },
+    { 0xA652, 0xA652 },
+    { 0xA654, 0xA654 },
+    { 0xA656, 0xA656 },
+    { 0xA658, 0xA658 },
+    { 0xA65A, 0xA65A },
+    { 0xA65C, 0xA65C },
+    { 0xA65E, 0xA65E },
+    { 0xA660, 0xA660 },
+    { 0xA662, 0xA662 },
+    { 0xA664, 0xA664 },
+    { 0xA666, 0xA666 },
+    { 0xA668, 0xA668 },
+    { 0xA66A, 0xA66A },
+    { 0xA66C, 0xA66C },
+    { 0xA680, 0xA680 },
+    { 0xA682, 0xA682 },
+    { 0xA684, 0xA684 },
+    { 0xA686, 0xA686 },
+    { 0xA688, 0xA688 },
+    { 0xA68A, 0xA68A },
+    { 0xA68C, 0xA68C },
+    { 0xA68E, 0xA68E },
+    { 0xA690, 0xA690 },
+    { 0xA692, 0xA692 },
+    { 0xA694, 0xA694 },
+    { 0xA696, 0xA696 },
+    { 0xA698, 0xA698 },
+    { 0xA69A, 0xA69A },
+    { 0xA722, 0xA722 },
+    { 0xA724, 0xA724 },
+    { 0xA726, 0xA726 },
+    { 0xA728, 0xA728 },
+    { 0xA72A, 0xA72A },
+    { 0xA72C, 0xA72C },
+    { 0xA72E, 0xA72E },
+    { 0xA732, 0xA732 },
+    { 0xA734, 0xA734 },
+    { 0xA736, 0xA736 },
+    { 0xA738, 0xA738 },
+    { 0xA73A, 0xA73A },
+    { 0xA73C, 0xA73C },
+    { 0xA73E, 0xA73E },
+    { 0xA740, 0xA740 },
+    { 0xA742, 0xA742 },
+    { 0xA744, 0xA744 },
+    { 0xA746, 0xA746 },
+    { 0xA748, 0xA748 },
+    { 0xA74A, 0xA74A },
+    { 0xA74C, 0xA74C },
+    { 0xA74E, 0xA74E },
+    { 0xA750, 0xA750 },
+    { 0xA752, 0xA752 },
+    { 0xA754, 0xA754 },
+    { 0xA756, 0xA756 },
+    { 0xA758, 0xA758 },
+    { 0xA75A, 0xA75A },
+    { 0xA75C, 0xA75C },
+    { 0xA75E, 0xA75E },
+    { 0xA760, 0xA760 },
+    { 0xA762, 0xA762 },
+    { 0xA764, 0xA764 },
+    { 0xA766, 0xA766 },
+    { 0xA768, 0xA768 },
+    { 0xA76A, 0xA76A },
+    { 0xA76C, 0xA76C },
+    { 0xA76E, 0xA76E },
+    { 0xA779, 0xA779 },
+    { 0xA77B, 0xA77B },
+    { 0xA77D, 0xA77E },
+    { 0xA780, 0xA780 },
+    { 0xA782, 0xA782 },
+    { 0xA784, 0xA784 },
+    { 0xA786, 0xA786 },
+    { 0xA78B, 0xA78B },
+    { 0xA78D, 0xA78D },
+    { 0xA790, 0xA790 },
+    { 0xA792, 0xA792 },
+    { 0xA796, 0xA796 },
+    { 0xA798, 0xA798 },
+    { 0xA79A, 0xA79A },
+    { 0xA79C, 0xA79C },
+    { 0xA79E, 0xA79E },
+    { 0xA7A0, 0xA7A0 },
+    { 0xA7A2, 0xA7A2 },
+    { 0xA7A4, 0xA7A4 },
+    { 0xA7A6, 0xA7A6 },
+    { 0xA7A8, 0xA7A8 },
+    { 0xA7AA, 0xA7AE },
+    { 0xA7B0, 0xA7B4 },
+    { 0xA7B6, 0xA7B6 },
+    { 0xA7B8, 0xA7B8 },
+    { 0xA7BA, 0xA7BA },
+    { 0xA7BC, 0xA7BC },
+    { 0xA7BE, 0xA7BE },
+    { 0xA7C0, 0xA7C0 },
+    { 0xA7C2, 0xA7C2 },
+    { 0xA7C4, 0xA7C7 },
+    { 0xA7C9, 0xA7C9 },
+    { 0xA7D0, 0xA7D0 },
+    { 0xA7D6, 0xA7D6 },
+    { 0xA7D8, 0xA7D8 },
+    { 0xA7F5, 0xA7F5 },
+    { 0xFF21, 0xFF3A },
+    { 0x10400, 0x10427 },
+    { 0x104B0, 0x104D3 },
+    { 0x10570, 0x1057A },
+    { 0x1057C, 0x1058A },
+    { 0x1058C, 0x10592 },
+    { 0x10594, 0x10595 },
+    { 0x10C80, 0x10CB2 },
+    { 0x118A0, 0x118BF },
+    { 0x16E40, 0x16E5F },
+    { 0x1E900, 0x1E921 }
+
+#define PREDICATE(c) uc_is_upper (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index 93479822ae15c4d89ec7c2bab97499aeaf13b543..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-ctype_xdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3de8ce98cb6c1ea4145c1570e8dc951f9822439e
--- /dev/null
@@ -0,0 +1,25 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "test-predicate-part1.h"
+
+    { 0x0030, 0x0039 },
+    { 0x0041, 0x0046 },
+    { 0x0061, 0x0066 }
+
+#define PREDICATE(c) uc_is_xdigit (c)
+#include "test-predicate-part2.h"
deleted file mode 120000 (symlink)
index f26031467ae5305ae9385d747d90acfd3367bb60..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-predicate-part1.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..10eb668ba6452cbe6841fd92f21327f32211638e
--- /dev/null
@@ -0,0 +1,31 @@
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "unictype.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+/* Interval of Unicode characters.  */
+typedef struct { ucs4_t start; ucs4_t end; } interval_t;
+
+/* Set of Unicode characters, described as list of intervals, in increasing
+   order.  */
+static const interval_t set[] =
+  {
deleted file mode 120000 (symlink)
index 496834aea77f8a853148cdead5f8745d090e0455..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unictype/test-predicate-part2.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aecd5f5a3a59ce69cefb3d85d8e722ab681d825a
--- /dev/null
@@ -0,0 +1,37 @@
+/* Test the Unicode character type functions.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+  };
+
+int
+main ()
+{
+  unsigned int c;
+  size_t i;
+
+  c = 0;
+  for (i = 0; i < SIZEOF (set); i++)
+    {
+      for (; c < set[i].start; c++)
+        ASSERT (!PREDICATE (c));
+      for (; c <= set[i].end; c++)
+        ASSERT (PREDICATE (c));
+    }
+  for (; c < 0x110000; c++)
+    ASSERT (!PREDICATE (c));
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 877ce381cddd41755ec583ed5eaf1138fc0ca88a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-chr.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f7bfc2baab04df5f709b2bb6fd3a0868f9da13ee
--- /dev/null
@@ -0,0 +1,142 @@
+/* Test of uN_chr() functions.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake and Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main (void)
+{
+  size_t size = 0x100000;
+  size_t length;
+  UNIT *input;
+  uint32_t *input32 = (uint32_t *) malloc (size * sizeof (uint32_t));
+  ASSERT (input32);
+
+  input32[0] = 'a';
+  input32[1] = 'b';
+  u32_set (input32 + 2, 'c', 1024);
+  for (size_t i = 1026; i < size - 2; i += 63)
+    {
+      size_t last = i + 63 < size - 2 ? i + 63 : size - 2;
+      ucs4_t uc = 'd' | (i - 1026);
+      if (uc >= 0xd800 && uc <= 0xdfff)
+        uc |= 0x100000;
+      u32_set (input32 + i, uc, last - i);
+    }
+
+  input32[size - 2] = 'e';
+  input32[size - 1] = 'a';
+
+  input = U32_TO_U (input32, size, NULL, &length);
+  ASSERT (input);
+
+  /* Basic behavior tests.  */
+  ASSERT (U_CHR (input, length, 'a') == input);
+
+  ASSERT (U_CHR (input, 0, 'a') == NULL);
+  {
+    void *page_boundary = zerosize_ptr ();
+    if (page_boundary != NULL)
+      ASSERT (U_CHR (page_boundary, 0, 'a') == NULL);
+  }
+
+  ASSERT (U_CHR (input, length, 'b') == input + 1);
+  ASSERT (U_CHR (input, length, 'c') == input + 2);
+  ASSERT (U_CHR (input, length, 'd') == input + 1026);
+
+  {
+    UNIT *exp = input + 1026;
+    UNIT *prev = input + 1;
+    for (size_t i = 1026; i < size - 2; i += 63)
+      {
+        UNIT c[6];
+        size_t n;
+        ucs4_t uc = 'd' | (i - 1026);
+        if (uc >= 0xd800 && uc <= 0xdfff)
+          uc |= 0x100000;
+        n = U_UCTOMB (c, uc, 6);
+        ASSERT (exp < input + length - 1);
+        ASSERT (U_CHR (prev, (length - 1) - (prev - input), uc) == exp);
+        ASSERT (memcmp (exp, c, n * sizeof (UNIT)) == 0);
+        prev = exp;
+        exp += n * 63;
+      }
+  }
+
+  ASSERT (U_CHR (input + 1, length - 1, 'a') == input + length - 1);
+  ASSERT (U_CHR (input + 1, length - 1, 'e') == input + length - 2);
+
+  ASSERT (U_CHR (input, length, 'f') == NULL);
+  ASSERT (U_CHR (input, length, '\0') == NULL);
+
+  /* Check that a very long haystack is handled quickly if the byte is
+     found near the beginning.  */
+  {
+    size_t repeat = 10000;
+    for (; repeat > 0; repeat--)
+      {
+        ASSERT (U_CHR (input, length, 'c') == input + 2);
+      }
+  }
+
+  /* Alignment tests.  */
+  {
+    int i, j;
+    for (i = 0; i < 32; i++)
+      {
+        for (j = 0; j < 128; j++)
+          input[i + j] = j;
+        for (j = 0; j < 128; j++)
+          {
+            ASSERT (U_CHR (input + i, 128, j) == input + i + j);
+          }
+      }
+  }
+
+  /* Check that uN_chr() does not read past the first occurrence of the
+     byte being searched.  */
+  {
+    UNIT *page_boundary = zerosize_ptr ();
+    size_t n;
+
+    if (page_boundary != NULL)
+      {
+        for (n = 1; n <= 500 / sizeof (UNIT); n++)
+          {
+            UNIT *mem = page_boundary - n;
+            U_SET (mem, 'X', n);
+            ASSERT (U_CHR (mem, n, 'U') == NULL);
+
+            {
+              size_t i;
+
+              for (i = 0; i < n; i++)
+                {
+                  mem[i] = 'U';
+                  ASSERT (U_CHR (mem, 4000, 'U') == mem + i);
+                  mem[i] = 'X';
+                }
+            }
+          }
+      }
+  }
+
+  free (input);
+  if (sizeof (UNIT) != sizeof (uint32_t))
+    free (input32);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 02c8bf896d8cfe61c4da1fb4cead4d269ecec763..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-cpy.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..05f1f5a88cbd76c8a55326983b96a9033b30c437
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test of uN_cpy() functions.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (src); n++)
+      {
+        UNIT dest[1 + SIZEOF (src) + 1] =
+          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+        UNIT *ret;
+        size_t i;
+
+        ret = U_CPY (dest + 1, src, n);
+        ASSERT (ret == dest + 1);
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == src[i]);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index e60d58aef961c8f0ac050c193d43e24a5aeeefee..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-pcpy.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..92ae0d0ebe81bbb41204f073162048dfbbe69c7a
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test of uN_pcpy() functions.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (src); n++)
+      {
+        UNIT dest[1 + SIZEOF (src) + 1] =
+          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+        UNIT *ret;
+        size_t i;
+
+        ret = U_PCPY (dest + 1, src, n);
+        ASSERT (ret == dest + 1 + n);
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == src[i]);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b0b6b30f5d6db1e6da9e57d3ea472f13232da6e3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-set.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c1966675184e11ff27db68f77927b52e252427cc
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test of uN_set() functions.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  {
+#define NMAX 7
+    size_t n;
+
+    for (n = 0; n <= NMAX; n++)
+      {
+        UNIT dest[1 + NMAX + 1] =
+          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+        UNIT *ret;
+        size_t i;
+
+        ret = U_SET (dest + 1, VALUE, n);
+        ASSERT (ret == dest + 1);
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == VALUE);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+#undef NMAX
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 4d30530f11c0543f2c4f296e5cb452ebe7a7c3ed..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-strcat.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..12440c43d68e3f47157719f3a0c00da5f361bf9d
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test of uN_strcat() functions.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 };
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 };
+    size_t m;
+    size_t n;
+
+    for (m = 0; m < SIZEOF (base); m++)
+      for (n = 1; n <= SIZEOF (src); n++)
+        {
+          UNIT dest[1 + (SIZEOF (base) - 1) + SIZEOF (src) + 1] =
+            { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC,
+              MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC
+            };
+          UNIT *result;
+          size_t i;
+
+          for (i = 0; i < m; i++)
+            dest[1 + i] = base[i];
+          dest[1 + m] = 0;
+
+          result = U_STRCAT (dest + 1, src + SIZEOF (src) - n);
+          ASSERT (result == dest + 1);
+
+          ASSERT (dest[0] == MAGIC);
+          for (i = 0; i < m; i++)
+            ASSERT (dest[1 + i] == base[i]);
+          for (i = 0; i < n; i++)
+            ASSERT (dest[1 + m + i] == src[SIZEOF (src) - n + i]);
+          ASSERT (dest[1 + m + n] == MAGIC);
+        }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 836da481c92033c0daf87f7e73b813a6ac1f6699..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-u32-chr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..474681ff6efa36ad2169616bdfc2b8cae9540c8c
--- /dev/null
@@ -0,0 +1,34 @@
+/* Test of u32_chr() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_UCTOMB(s, uc, n) (*(s) = (uc), 1)
+#define U32_TO_U(s, n, result, length) (*(length) = (n), (s))
+#define U_CHR u32_chr
+#define U_SET u32_set
+#include "test-chr.h"
deleted file mode 120000 (symlink)
index 9f7657448a5f5bc123a38dabdaae7c44ee0cd475..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-u32-cpy.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0ba5f8b4e8949524d6ae5dd2b6f4352b6d97df65
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u32_cpy() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_CPY u32_cpy
+#define MAGIC 0xBADFACE
+#include "test-cpy.h"
deleted file mode 120000 (symlink)
index e0b67a750b0d3e9ea3099c2a8a114b1bc06ec433..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-u32-pcpy.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..af77cc25e71cc57b0ec72ea76fd37acd3c307f26
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u32_pcpy() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_PCPY u32_pcpy
+#define MAGIC 0xBADFACE
+#include "test-pcpy.h"
deleted file mode 120000 (symlink)
index ecc479ce60a9d7a4bd875d74f09653372c711c5c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-u32-set.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..99e644dccefa475168e63ea22333ecaf173e0a5e
--- /dev/null
@@ -0,0 +1,29 @@
+/* Test of u32_set() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_SET u32_set
+#define MAGIC 0xBADFACE
+#define VALUE 0x1D51E
+#include "test-set.h"
deleted file mode 120000 (symlink)
index a93d323ea93bea015b2227cfe1d22542205e3032..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-u32-strcat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..64e1b5ccd6540ab683cff08a0daf71f9740c74c9
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of u32_strcat() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_STRCAT u32_strcat
+#define MAGIC 0xBADFACE
+#include "test-strcat.h"
deleted file mode 120000 (symlink)
index a0cc2b9c2369593983f3454d404e7d42882a2e40..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-u32-strlen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6186fbdb65aaaf014af060aa91570e615cad078e
--- /dev/null
@@ -0,0 +1,57 @@
+/* Test of u32_strlen() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  /* Empty string.  */
+  {
+    static const uint32_t input[] = { 0 };
+    ASSERT (u32_strlen (input) == 0);
+  }
+
+  /* Simple string.  */
+  { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
+    static const uint32_t input[] =
+      { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ',
+        0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443,
+        0x0439, 0x0442, 0x0435, '!', ' ',
+        'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2,
+        '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
+        0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0
+      };
+    ASSERT (u32_strlen (input) == SIZEOF (input) - 1);
+  }
+
+  /* String with characters outside the BMP.  */
+  {
+    static const uint32_t input[] =
+      { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
+        0x1D51F, 0x00D7, 0x1D51E, 0
+      };
+    ASSERT (u32_strlen (input) == SIZEOF (input) - 1);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 3251e0a0eee77b2d61baf204fff4f942d7c42ec5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-u8-mbtoucr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6a4a74a2fd9a7689c8295242fa5c35c77415a8e1
--- /dev/null
@@ -0,0 +1,187 @@
+/* Test of u8_mbtoucr() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+  int ret;
+
+  /* Test NUL unit input.  */
+  {
+    static const uint8_t input[] = "";
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == 1);
+    ASSERT (uc == 0);
+  }
+
+  /* Test ISO 646 unit input.  */
+  {
+    ucs4_t c;
+    uint8_t buf[1];
+
+    for (c = 0; c < 0x80; c++)
+      {
+        buf[0] = c;
+        uc = 0xBADFACE;
+        ret = u8_mbtoucr (&uc, buf, 1);
+        ASSERT (ret == 1);
+        ASSERT (uc == c);
+      }
+  }
+
+  /* Test 2-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xC3, 0x97 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == 2);
+    ASSERT (uc == 0x00D7);
+  }
+
+  /* Test 3-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xE2, 0x82, 0xAC };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 3);
+    ASSERT (ret == 3);
+    ASSERT (uc == 0x20AC);
+  }
+
+  /* Test 4-byte character input.  */
+  {
+    static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 4);
+    ASSERT (ret == 4);
+    ASSERT (uc == 0x10FFFD);
+  }
+
+  /* Test incomplete/invalid 1-byte input.  */
+  {
+    static const uint8_t input[] = { 0xC1 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xC3 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF4 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xFE };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 1);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  /* Test incomplete/invalid 2-byte input.  */
+  {
+    static const uint8_t input[] = { 0xE0, 0x9F };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0x82 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xE2, 0xD0 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF0, 0x8F };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 2);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  /* Test incomplete/invalid 3-byte input.  */
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xBF };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 3);
+    ASSERT (ret == -2);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0xD0, 0xBF };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 3);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+  {
+    static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 };
+    uc = 0xBADFACE;
+    ret = u8_mbtoucr (&uc, input, 3);
+    ASSERT (ret == -1);
+    ASSERT (uc == 0xFFFD);
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 11fbc23395d381b57f82d18eb645f750b93fae4b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/unistr/test-u8-uctomb.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2948eb09511119e4aa1c8c946421f6cfae142d7d
--- /dev/null
@@ -0,0 +1,157 @@
+/* Test of u8_uctomb() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define MAGIC 0xBA
+
+int
+main ()
+{
+  /* Test ISO 646 character, in particular the NUL character.  */
+  {
+    ucs4_t uc;
+
+    for (uc = 0; uc < 0x80; uc++)
+      {
+        uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+        int ret;
+
+        ret = u8_uctomb (buf, uc, 0);
+        ASSERT (ret == -2);
+        ASSERT (buf[0] == MAGIC);
+
+        ret = u8_uctomb (buf, uc, 1);
+        ASSERT (ret == 1);
+        ASSERT (buf[0] == uc);
+        ASSERT (buf[1] == MAGIC);
+      }
+  }
+
+  /* Test 2-byte character.  */
+  {
+    ucs4_t uc = 0x00D7;
+    uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+    int ret;
+
+    ret = u8_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 1);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 2);
+    ASSERT (ret == 2);
+    ASSERT (buf[0] == 0xC3);
+    ASSERT (buf[1] == 0x97);
+    ASSERT (buf[2] == MAGIC);
+  }
+
+  /* Test 3-byte character.  */
+  {
+    ucs4_t uc = 0x20AC;
+    uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+    int ret;
+
+    ret = u8_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 1);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 2);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+    ASSERT (buf[1] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 3);
+    ASSERT (ret == 3);
+    ASSERT (buf[0] == 0xE2);
+    ASSERT (buf[1] == 0x82);
+    ASSERT (buf[2] == 0xAC);
+    ASSERT (buf[3] == MAGIC);
+  }
+
+  /* Test 4-byte character.  */
+  {
+    ucs4_t uc = 0x10FFFD;
+    uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+    int ret;
+
+    ret = u8_uctomb (buf, uc, 0);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 1);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 2);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+    ASSERT (buf[1] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 3);
+    ASSERT (ret == -2);
+    ASSERT (buf[0] == MAGIC);
+    ASSERT (buf[1] == MAGIC);
+    ASSERT (buf[2] == MAGIC);
+
+    ret = u8_uctomb (buf, uc, 4);
+    ASSERT (ret == 4);
+    ASSERT (buf[0] == 0xF4);
+    ASSERT (buf[1] == 0x8F);
+    ASSERT (buf[2] == 0xBF);
+    ASSERT (buf[3] == 0xBD);
+    ASSERT (buf[4] == MAGIC);
+  }
+
+  /* Test invalid characters.  */
+  {
+    ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF };
+    uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+    size_t i;
+
+    for (i = 0; i < SIZEOF (invalid); i++)
+      {
+        ucs4_t uc = invalid[i];
+        int n;
+
+        for (n = 0; n <= 4; n++)
+          {
+            int ret = u8_uctomb (buf, uc, n);
+            ASSERT (ret == -1);
+            ASSERT (buf[0] == MAGIC);
+            ASSERT (buf[1] == MAGIC);
+            ASSERT (buf[2] == MAGIC);
+            ASSERT (buf[3] == MAGIC);
+            ASSERT (buf[4] == MAGIC);
+          }
+      }
+  }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 73d812128a5898baa6eff8a0b2d17b884498d813..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u-set.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..088cabef383ca9dcd6028fba912ad8641c1f3e53
--- /dev/null
@@ -0,0 +1,47 @@
+/* Fill UTF-8/UTF-16/UTF-32 string.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software.
+   It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
+   You can redistribute it and/or modify it under either
+     - the terms of the GNU Lesser General Public License as published
+       by the Free Software Foundation, either version 3, or (at your
+       option) any later version, or
+     - 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, or
+     - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License and the GNU General Public License
+   for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License and of the GNU General Public License along with this
+   program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+
+UNIT *
+FUNC (UNIT *s, ucs4_t uc, size_t n)
+{
+  if (n > 0)
+    {
+      if (IS_SINGLE_UNIT (uc))
+        {
+          UNIT *ptr = s;
+
+          for (; n > 0; n--)
+            *ptr++ = uc;
+        }
+      else
+        {
+          errno = EILSEQ;
+          return NULL;
+        }
+    }
+  return s;
+}
deleted file mode 120000 (symlink)
index 8a49cfd7fba2f60d5d5bcaad7de6fe6c9b043f31..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u32-set.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..51cf3d63ac9ae228a94e5bbc884097f8293dc959
--- /dev/null
@@ -0,0 +1,34 @@
+/* Fill UTF-32 string.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software.
+   It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
+   You can redistribute it and/or modify it under either
+     - the terms of the GNU Lesser General Public License as published
+       by the Free Software Foundation, either version 3, or (at your
+       option) any later version, or
+     - 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, or
+     - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License and the GNU General Public License
+   for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License and of the GNU General Public License along with this
+   program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+#define FUNC u32_set
+#define UNIT uint32_t
+#define IS_SINGLE_UNIT(uc) (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000))
+#include "u-set.h"
deleted file mode 120000 (symlink)
index c9a4c136157800054d4bb7db4a461d842d185880..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/uniwidth/test-uc_width.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5f0e793fa5e0e2144260f47df58bceee8f4f1e01
--- /dev/null
@@ -0,0 +1,56 @@
+/* Test of uc_width() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include "uniwidth.h"
+
+#include "macros.h"
+
+int
+main ()
+{
+  ucs4_t uc;
+
+  /* Test width of ASCII characters.  */
+  for (uc = 0x0020; uc < 0x007F; uc++)
+    ASSERT (uc_width (uc, "ISO-8859-2") == 1);
+
+  /* Test width of some non-spacing characters.  */
+  ASSERT (uc_width (0x0301, "UTF-8") == 0);
+  ASSERT (uc_width (0x05B0, "UTF-8") == 0);
+
+  /* Test width of some format control characters.  */
+  ASSERT (uc_width (0x200E, "UTF-8") == 0);
+  ASSERT (uc_width (0x2060, "UTF-8") == 0);
+  ASSERT (uc_width (0xE0001, "UTF-8") == 0);
+  ASSERT (uc_width (0xE0044, "UTF-8") == 0);
+
+  /* Test width of some zero width characters.  */
+  ASSERT (uc_width (0x200B, "UTF-8") == 0);
+  ASSERT (uc_width (0xFEFF, "UTF-8") == 0);
+
+  /* Test width of some CJK characters.  */
+  ASSERT (uc_width (0x3000, "UTF-8") == 2);
+  ASSERT (uc_width (0xB250, "UTF-8") == 2);
+  ASSERT (uc_width (0xFF1A, "UTF-8") == 2);
+  ASSERT (uc_width (0x20369, "UTF-8") == 2);
+  ASSERT (uc_width (0x2F876, "UTF-8") == 2);
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index c78809b7b3e35d8c2c6b3addc4af2fbdc20c1e64..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/uniwidth/test-uc_width2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a07a11f81fd21cfc9a0c02c2b882de3aefc4ba7c
--- /dev/null
@@ -0,0 +1,86 @@
+/* Test of uc_width() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include "uniwidth.h"
+
+#include <stdio.h>
+
+#include "macros.h"
+
+/* One of 0, '0', '1', 'A', '2'.  */
+static char current_width;
+/* The interval for which the current_width holds.  */
+static ucs4_t current_start;
+static ucs4_t current_end;
+
+static void
+finish_interval (void)
+{
+  if (current_width != 0)
+    {
+      if (current_start == current_end)
+        printf ("%04X\t\t%c\n", (unsigned) current_start, current_width);
+      else
+        printf ("%04X..%04X\t%c\n", (unsigned) current_start,
+                (unsigned) current_end, current_width);
+      current_width = 0;
+    }
+}
+
+static void
+add_to_interval (ucs4_t uc, char width)
+{
+  if (current_width == width && uc == current_end + 1)
+    current_end = uc;
+  else
+    {
+      finish_interval ();
+      current_width = width;
+      current_start = current_end = uc;
+    }
+}
+
+int
+main ()
+{
+  ucs4_t uc;
+
+  for (uc = 0; uc < 0x110000; uc++)
+    {
+      int w1 = uc_width (uc, "UTF-8");
+      int w2 = uc_width (uc, "GBK");
+      char width =
+        (w1 == 0 && w2 == 0 ? '0' :
+         w1 == 1 && w2 == 1 ? '1' :
+         w1 == 1 && w2 == 2 ? 'A' :
+         w1 == 2 && w2 == 2 ? '2' :
+         0);
+      if (width == 0)
+        {
+          /* uc must be a control character.  */
+          ASSERT (w1 < 0 && w2 < 0);
+        }
+      else
+        add_to_interval (uc, width);
+    }
+  finish_interval ();
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 50659c7e10d05837f9d5179174791540f337b2be..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/uniwidth/test-uc_width2.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..ae6f8f45948bbdf98ed7f00ac2bddf9ee0436b24
--- /dev/null
@@ -0,0 +1,939 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles uc_width.out"
+${CHECKER} ./test-uc_width2${EXEEXT} | LC_ALL=C tr -d '\r' > uc_width.out
+
+tmpfiles="$tmpfiles uc_width.ok"
+cat > uc_width.ok <<\EOF
+0000           0
+0020..007E     1
+00A0           1
+00A1..00AC     A
+00AD           0
+00AE..02FF     A
+0300..036F     0
+0370..0482     A
+0483..0489     0
+048A..0590     A
+0591..05BD     0
+05BE           A
+05BF           0
+05C0           A
+05C1..05C2     0
+05C3           A
+05C4..05C5     0
+05C6           A
+05C7           0
+05C8..05FF     A
+0600..0605     0
+0606..060F     A
+0610..061A     0
+061B           A
+061C           0
+061D..064A     A
+064B..065F     0
+0660..066F     A
+0670           0
+0671..06D5     A
+06D6..06DD     0
+06DE           A
+06DF..06E4     0
+06E5..06E6     A
+06E7..06E8     0
+06E9           A
+06EA..06ED     0
+06EE..070E     A
+070F           0
+0710           A
+0711           0
+0712..072F     A
+0730..074A     0
+074B..07A5     A
+07A6..07B0     0
+07B1..07EA     A
+07EB..07F3     0
+07F4..07FC     A
+07FD           0
+07FE..0815     A
+0816..0819     0
+081A           A
+081B..0823     0
+0824           A
+0825..0827     0
+0828           A
+0829..082D     0
+082E..0858     A
+0859..085B     0
+085C..088F     A
+0890..0891     0
+0892..0897     A
+0898..089F     0
+08A0..08C9     A
+08CA..0902     0
+0903..0939     A
+093A           0
+093B           A
+093C           0
+093D..0940     A
+0941..0948     0
+0949..094C     A
+094D           0
+094E..0950     A
+0951..0957     0
+0958..0961     A
+0962..0963     0
+0964..0980     A
+0981           0
+0982..09BB     A
+09BC           0
+09BD..09C0     A
+09C1..09C4     0
+09C5..09CC     A
+09CD           0
+09CE..09E1     A
+09E2..09E3     0
+09E4..09FD     A
+09FE           0
+09FF..0A00     A
+0A01..0A02     0
+0A03..0A3B     A
+0A3C           0
+0A3D..0A40     A
+0A41..0A42     0
+0A43..0A46     A
+0A47..0A48     0
+0A49..0A4A     A
+0A4B..0A4D     0
+0A4E..0A50     A
+0A51           0
+0A52..0A6F     A
+0A70..0A71     0
+0A72..0A74     A
+0A75           0
+0A76..0A80     A
+0A81..0A82     0
+0A83..0ABB     A
+0ABC           0
+0ABD..0AC0     A
+0AC1..0AC5     0
+0AC6           A
+0AC7..0AC8     0
+0AC9..0ACC     A
+0ACD           0
+0ACE..0AE1     A
+0AE2..0AE3     0
+0AE4..0AF9     A
+0AFA..0AFF     0
+0B00           A
+0B01           0
+0B02..0B3B     A
+0B3C           0
+0B3D..0B3E     A
+0B3F           0
+0B40           A
+0B41..0B44     0
+0B45..0B4C     A
+0B4D           0
+0B4E..0B54     A
+0B55..0B56     0
+0B57..0B61     A
+0B62..0B63     0
+0B64..0B81     A
+0B82           0
+0B83..0BBF     A
+0BC0           0
+0BC1..0BCC     A
+0BCD           0
+0BCE..0BFF     A
+0C00           0
+0C01..0C03     A
+0C04           0
+0C05..0C3B     A
+0C3C           0
+0C3D           A
+0C3E..0C40     0
+0C41..0C45     A
+0C46..0C48     0
+0C49           A
+0C4A..0C4D     0
+0C4E..0C54     A
+0C55..0C56     0
+0C57..0C61     A
+0C62..0C63     0
+0C64..0C80     A
+0C81           0
+0C82..0CBB     A
+0CBC           0
+0CBD..0CCB     A
+0CCC..0CCD     0
+0CCE..0CE1     A
+0CE2..0CE3     0
+0CE4..0CFF     A
+0D00..0D01     0
+0D02..0D3A     A
+0D3B..0D3C     0
+0D3D..0D40     A
+0D41..0D44     0
+0D45..0D4C     A
+0D4D           0
+0D4E..0D61     A
+0D62..0D63     0
+0D64..0D80     A
+0D81           0
+0D82..0DC9     A
+0DCA           0
+0DCB..0DD1     A
+0DD2..0DD4     0
+0DD5           A
+0DD6           0
+0DD7..0E30     A
+0E31           0
+0E32..0E33     A
+0E34..0E3A     0
+0E3B..0E46     A
+0E47..0E4E     0
+0E4F..0EB0     A
+0EB1           0
+0EB2..0EB3     A
+0EB4..0EBC     0
+0EBD..0EC7     A
+0EC8..0ECE     0
+0ECF..0F17     A
+0F18..0F19     0
+0F1A..0F34     A
+0F35           0
+0F36           A
+0F37           0
+0F38           A
+0F39           0
+0F3A..0F70     A
+0F71..0F7E     0
+0F7F           A
+0F80..0F84     0
+0F85           A
+0F86..0F87     0
+0F88..0F8C     A
+0F8D..0F97     0
+0F98           A
+0F99..0FBC     0
+0FBD..0FC5     A
+0FC6           0
+0FC7..102C     A
+102D..1030     0
+1031           A
+1032..1037     0
+1038           A
+1039..103A     0
+103B..103C     A
+103D..103E     0
+103F..1057     A
+1058..1059     0
+105A..105D     A
+105E..1060     0
+1061..1070     A
+1071..1074     0
+1075..1081     A
+1082           0
+1083..1084     A
+1085..1086     0
+1087..108C     A
+108D           0
+108E..109C     A
+109D           0
+109E..10FF     A
+1100..115F     2
+1160..11FF     0
+1200..135C     A
+135D..135F     0
+1360..1711     A
+1712..1714     0
+1715..1731     A
+1732..1733     0
+1734..1751     A
+1752..1753     0
+1754..1771     A
+1772..1773     0
+1774..17B3     A
+17B4..17B5     0
+17B6           A
+17B7..17BD     0
+17BE..17C5     A
+17C6           0
+17C7..17C8     A
+17C9..17D3     0
+17D4..17DC     A
+17DD           0
+17DE..180A     A
+180B..180F     0
+1810..1884     A
+1885..1886     0
+1887..18A8     A
+18A9           0
+18AA..191F     A
+1920..1922     0
+1923..1926     A
+1927..1928     0
+1929..1931     A
+1932           0
+1933..1938     A
+1939..193B     0
+193C..1A16     A
+1A17..1A18     0
+1A19..1A1A     A
+1A1B           0
+1A1C..1A55     A
+1A56           0
+1A57           A
+1A58..1A5E     0
+1A5F           A
+1A60           0
+1A61           A
+1A62           0
+1A63..1A64     A
+1A65..1A6C     0
+1A6D..1A72     A
+1A73..1A7C     0
+1A7D..1A7E     A
+1A7F           0
+1A80..1AAF     A
+1AB0..1ACE     0
+1ACF..1AFF     A
+1B00..1B03     0
+1B04..1B33     A
+1B34           0
+1B35           A
+1B36..1B3A     0
+1B3B           A
+1B3C           0
+1B3D..1B41     A
+1B42           0
+1B43..1B6A     A
+1B6B..1B73     0
+1B74..1B7F     A
+1B80..1B81     0
+1B82..1BA1     A
+1BA2..1BA5     0
+1BA6..1BA7     A
+1BA8..1BA9     0
+1BAA           A
+1BAB..1BAD     0
+1BAE..1BE5     A
+1BE6           0
+1BE7           A
+1BE8..1BE9     0
+1BEA..1BEC     A
+1BED           0
+1BEE           A
+1BEF..1BF1     0
+1BF2..1C2B     A
+1C2C..1C33     0
+1C34..1C35     A
+1C36..1C37     0
+1C38..1CCF     A
+1CD0..1CD2     0
+1CD3           A
+1CD4..1CE0     0
+1CE1           A
+1CE2..1CE8     0
+1CE9..1CEC     A
+1CED           0
+1CEE..1CF3     A
+1CF4           0
+1CF5..1CF7     A
+1CF8..1CF9     0
+1CFA..1DBF     A
+1DC0..1DFF     0
+1E00..200A     A
+200B..200F     0
+2010..2029     A
+202A..202E     0
+202F..205F     A
+2060..2064     0
+2065           A
+2066..206F     0
+2070..20A8     A
+20A9           1
+20AA..20CF     A
+20D0..20F0     0
+20F1..2319     A
+231A..231B     2
+231C..2328     A
+2329..232A     2
+232B..23E8     A
+23E9..23EC     2
+23ED..23EF     A
+23F0           2
+23F1..23F2     A
+23F3           2
+23F4..25FC     A
+25FD..25FE     2
+25FF..2613     A
+2614..2615     2
+2616..2647     A
+2648..2653     2
+2654..267E     A
+267F           2
+2680..2692     A
+2693           2
+2694..26A0     A
+26A1           2
+26A2..26A9     A
+26AA..26AB     2
+26AC..26BC     A
+26BD..26BE     2
+26BF..26C3     A
+26C4..26C5     2
+26C6..26CD     A
+26CE           2
+26CF..26D3     A
+26D4           2
+26D5..26E9     A
+26EA           2
+26EB..26F1     A
+26F2..26F3     2
+26F4           A
+26F5           2
+26F6..26F9     A
+26FA           2
+26FB..26FC     A
+26FD           2
+26FE..2704     A
+2705           2
+2706..2709     A
+270A..270B     2
+270C..2727     A
+2728           2
+2729..274B     A
+274C           2
+274D           A
+274E           2
+274F..2752     A
+2753..2755     2
+2756           A
+2757           2
+2758..2794     A
+2795..2797     2
+2798..27AF     A
+27B0           2
+27B1..27BE     A
+27BF           2
+27C0..2B1A     A
+2B1B..2B1C     2
+2B1D..2B4F     A
+2B50           2
+2B51..2B54     A
+2B55           2
+2B56..2CEE     A
+2CEF..2CF1     0
+2CF2..2D7E     A
+2D7F           0
+2D80..2DDF     A
+2DE0..2DFF     0
+2E00..2E7F     A
+2E80..3029     2
+302A..302D     0
+302E..303E     2
+303F           A
+3040..3098     2
+3099..309A     0
+309B..3247     2
+3248..324F     A
+3250..4DBF     2
+4DC0..4DFF     A
+4E00..A4CF     2
+A4D0..A66E     A
+A66F..A672     0
+A673           A
+A674..A67D     0
+A67E..A69D     A
+A69E..A69F     0
+A6A0..A6EF     A
+A6F0..A6F1     0
+A6F2..A801     A
+A802           0
+A803..A805     A
+A806           0
+A807..A80A     A
+A80B           0
+A80C..A824     A
+A825..A826     0
+A827..A82B     A
+A82C           0
+A82D..A8C3     A
+A8C4..A8C5     0
+A8C6..A8DF     A
+A8E0..A8F1     0
+A8F2..A8FE     A
+A8FF           0
+A900..A925     A
+A926..A92D     0
+A92E..A946     A
+A947..A951     0
+A952..A95F     A
+A960..A97C     2
+A97D..A97F     A
+A980..A982     0
+A983..A9B2     A
+A9B3           0
+A9B4..A9B5     A
+A9B6..A9B9     0
+A9BA..A9BB     A
+A9BC..A9BD     0
+A9BE..A9E4     A
+A9E5           0
+A9E6..AA28     A
+AA29..AA2E     0
+AA2F..AA30     A
+AA31..AA32     0
+AA33..AA34     A
+AA35..AA36     0
+AA37..AA42     A
+AA43           0
+AA44..AA4B     A
+AA4C           0
+AA4D..AA7B     A
+AA7C           0
+AA7D..AAAF     A
+AAB0           0
+AAB1           A
+AAB2..AAB4     0
+AAB5..AAB6     A
+AAB7..AAB8     0
+AAB9..AABD     A
+AABE..AABF     0
+AAC0           A
+AAC1           0
+AAC2..AAEB     A
+AAEC..AAED     0
+AAEE..AAF5     A
+AAF6           0
+AAF7..ABE4     A
+ABE5           0
+ABE6..ABE7     A
+ABE8           0
+ABE9..ABEC     A
+ABED           0
+ABEE..ABFF     A
+AC00..D7A3     2
+D7A4..D7AF     A
+D7B0..D7C6     0
+D7C7..D7CA     A
+D7CB..D7FB     0
+D7FC..F8FF     A
+F900..FAFF     2
+FB00..FB1D     A
+FB1E           0
+FB1F..FDFF     A
+FE00..FE0F     0
+FE10..FE1F     2
+FE20..FE2F     0
+FE30..FE6F     2
+FE70..FEFE     A
+FEFF           0
+FF00..FF60     2
+FF61..FFDF     1
+FFE0..FFE6     2
+FFE7..FFF8     1
+FFF9..FFFB     0
+FFFC..101FC    1
+101FD          0
+101FE..102DF   1
+102E0          0
+102E1..10375   1
+10376..1037A   0
+1037B..10A00   1
+10A01..10A03   0
+10A04          1
+10A05..10A06   0
+10A07..10A0B   1
+10A0C..10A0F   0
+10A10..10A37   1
+10A38..10A3A   0
+10A3B..10A3E   1
+10A3F          0
+10A40..10AE4   1
+10AE5..10AE6   0
+10AE7..10D23   1
+10D24..10D27   0
+10D28..10EAA   1
+10EAB..10EAC   0
+10EAD..10EFC   1
+10EFD..10EFF   0
+10F00..10F45   1
+10F46..10F50   0
+10F51..10F81   1
+10F82..10F85   0
+10F86..11000   1
+11001          0
+11002..11037   1
+11038..11046   0
+11047..1106F   1
+11070          0
+11071..11072   1
+11073..11074   0
+11075..1107E   1
+1107F..11081   0
+11082..110B2   1
+110B3..110B6   0
+110B7..110B8   1
+110B9..110BA   0
+110BB..110BC   1
+110BD          0
+110BE..110C1   1
+110C2          0
+110C3..110CC   1
+110CD          0
+110CE..110FF   1
+11100..11102   0
+11103..11126   1
+11127..1112B   0
+1112C          1
+1112D..11134   0
+11135..11172   1
+11173          0
+11174..1117F   1
+11180..11181   0
+11182..111B5   1
+111B6..111BE   0
+111BF..111C8   1
+111C9..111CC   0
+111CD..111CE   1
+111CF          0
+111D0..1122E   1
+1122F..11231   0
+11232..11233   1
+11234          0
+11235          1
+11236..11237   0
+11238..1123D   1
+1123E          0
+1123F..11240   1
+11241          0
+11242..112DE   1
+112DF          0
+112E0..112E2   1
+112E3..112EA   0
+112EB..112FF   1
+11300..11301   0
+11302..1133A   1
+1133B..1133C   0
+1133D..1133F   1
+11340          0
+11341..11365   1
+11366..1136C   0
+1136D..1136F   1
+11370..11374   0
+11375..11437   1
+11438..1143F   0
+11440..11441   1
+11442..11444   0
+11445          1
+11446          0
+11447..1145D   1
+1145E          0
+1145F..114B2   1
+114B3..114B8   0
+114B9          1
+114BA          0
+114BB..114BE   1
+114BF..114C0   0
+114C1          1
+114C2..114C3   0
+114C4..115B1   1
+115B2..115B5   0
+115B6..115BB   1
+115BC..115BD   0
+115BE          1
+115BF..115C0   0
+115C1..115DB   1
+115DC..115DD   0
+115DE..11632   1
+11633..1163A   0
+1163B..1163C   1
+1163D          0
+1163E          1
+1163F..11640   0
+11641..116AA   1
+116AB          0
+116AC          1
+116AD          0
+116AE..116AF   1
+116B0..116B5   0
+116B6          1
+116B7          0
+116B8..1171C   1
+1171D..1171F   0
+11720..11721   1
+11722..11725   0
+11726          1
+11727..1172B   0
+1172C..1182E   1
+1182F..11837   0
+11838          1
+11839..1183A   0
+1183B..1193A   1
+1193B..1193C   0
+1193D          1
+1193E          0
+1193F..11942   1
+11943          0
+11944..119D3   1
+119D4..119D7   0
+119D8..119D9   1
+119DA..119DB   0
+119DC..119DF   1
+119E0          0
+119E1..11A00   1
+11A01..11A06   0
+11A07..11A08   1
+11A09..11A0A   0
+11A0B..11A32   1
+11A33..11A38   0
+11A39..11A3A   1
+11A3B..11A3E   0
+11A3F..11A46   1
+11A47          0
+11A48..11A50   1
+11A51..11A56   0
+11A57..11A58   1
+11A59..11A5B   0
+11A5C..11A89   1
+11A8A..11A96   0
+11A97          1
+11A98..11A99   0
+11A9A..11C2F   1
+11C30..11C36   0
+11C37          1
+11C38..11C3D   0
+11C3E..11C91   1
+11C92..11CA7   0
+11CA8..11CA9   1
+11CAA..11CB0   0
+11CB1          1
+11CB2..11CB3   0
+11CB4          1
+11CB5..11CB6   0
+11CB7..11D30   1
+11D31..11D36   0
+11D37..11D39   1
+11D3A          0
+11D3B          1
+11D3C..11D3D   0
+11D3E          1
+11D3F..11D45   0
+11D46          1
+11D47          0
+11D48..11D8F   1
+11D90..11D91   0
+11D92..11D94   1
+11D95          0
+11D96          1
+11D97          0
+11D98..11EF2   1
+11EF3..11EF4   0
+11EF5..11EFF   1
+11F00..11F01   0
+11F02..11F35   1
+11F36..11F3A   0
+11F3B..11F3F   1
+11F40          0
+11F41          1
+11F42          0
+11F43..1342F   1
+13430..13440   0
+13441..13446   1
+13447..13455   0
+13456..16AEF   1
+16AF0..16AF4   0
+16AF5..16B2F   1
+16B30..16B36   0
+16B37..16F4E   1
+16F4F          0
+16F50..16F8E   1
+16F8F..16F92   0
+16F93..16FDF   1
+16FE0..16FE3   2
+16FE4          0
+16FE5..16FEF   1
+16FF0..16FF1   2
+16FF2..16FFF   1
+17000..187F7   2
+187F8..187FF   1
+18800..18CD5   2
+18CD6..18CFF   1
+18D00..18D08   2
+18D09..1AFEF   1
+1AFF0..1AFF3   2
+1AFF4          1
+1AFF5..1AFFB   2
+1AFFC          1
+1AFFD..1AFFE   2
+1AFFF          1
+1B000..1B122   2
+1B123..1B14F   1
+1B150..1B152   2
+1B153..1B163   1
+1B164..1B167   2
+1B168..1B16F   1
+1B170..1B2FB   2
+1B2FC..1BC9C   1
+1BC9D..1BC9E   0
+1BC9F          1
+1BCA0..1BCA3   0
+1BCA4..1CEFF   1
+1CF00..1CF2D   0
+1CF2E..1CF2F   1
+1CF30..1CF46   0
+1CF47..1D166   1
+1D167..1D169   0
+1D16A..1D172   1
+1D173..1D182   0
+1D183..1D184   1
+1D185..1D18B   0
+1D18C..1D1A9   1
+1D1AA..1D1AD   0
+1D1AE..1D241   1
+1D242..1D244   0
+1D245..1D9FF   1
+1DA00..1DA36   0
+1DA37..1DA3A   1
+1DA3B..1DA6C   0
+1DA6D..1DA74   1
+1DA75          0
+1DA76..1DA83   1
+1DA84          0
+1DA85..1DA9A   1
+1DA9B..1DA9F   0
+1DAA0          1
+1DAA1..1DAAF   0
+1DAB0..1DFFF   1
+1E000..1E006   0
+1E007          1
+1E008..1E018   0
+1E019..1E01A   1
+1E01B..1E021   0
+1E022          1
+1E023..1E024   0
+1E025          1
+1E026..1E02A   0
+1E02B..1E08E   1
+1E08F          0
+1E090..1E12F   1
+1E130..1E136   0
+1E137..1E2AD   1
+1E2AE          0
+1E2AF..1E2EB   1
+1E2EC..1E2EF   0
+1E2F0..1E4EB   1
+1E4EC..1E4EF   0
+1E4F0..1E8CF   1
+1E8D0..1E8D6   0
+1E8D7..1E943   1
+1E944..1E94A   0
+1E94B..1F003   1
+1F004          2
+1F005..1F0CE   1
+1F0CF          2
+1F0D0..1F18D   1
+1F18E          2
+1F18F..1F190   1
+1F191..1F19A   2
+1F19B..1F1FF   1
+1F200..1F320   2
+1F321..1F32C   1
+1F32D..1F335   2
+1F336          1
+1F337..1F37C   2
+1F37D          1
+1F37E..1F393   2
+1F394..1F39F   1
+1F3A0..1F3CA   2
+1F3CB..1F3CE   1
+1F3CF..1F3D3   2
+1F3D4..1F3DF   1
+1F3E0..1F3F0   2
+1F3F1..1F3F3   1
+1F3F4          2
+1F3F5..1F3F7   1
+1F3F8..1F43E   2
+1F43F          1
+1F440          2
+1F441          1
+1F442..1F4FC   2
+1F4FD..1F4FE   1
+1F4FF..1F53D   2
+1F53E..1F54A   1
+1F54B..1F54E   2
+1F54F          1
+1F550..1F567   2
+1F568..1F579   1
+1F57A          2
+1F57B..1F594   1
+1F595..1F596   2
+1F597..1F5A3   1
+1F5A4          2
+1F5A5..1F5FA   1
+1F5FB..1F64F   2
+1F650..1F67F   1
+1F680..1F6C5   2
+1F6C6..1F6CB   1
+1F6CC          2
+1F6CD..1F6CF   1
+1F6D0..1F6D2   2
+1F6D3..1F6D4   1
+1F6D5..1F6D7   2
+1F6D8..1F6DC   1
+1F6DD..1F6DF   2
+1F6E0..1F6EA   1
+1F6EB..1F6EC   2
+1F6ED..1F6F3   1
+1F6F4..1F6FC   2
+1F6FD..1F7DF   1
+1F7E0..1F7EB   2
+1F7EC..1F7EF   1
+1F7F0          2
+1F7F1..1F90B   1
+1F90C..1F93A   2
+1F93B          1
+1F93C..1F945   2
+1F946          1
+1F947..1F9FF   2
+1FA00..1FA6F   1
+1FA70..1FA74   2
+1FA75..1FA77   1
+1FA78..1FA7C   2
+1FA7D..1FA7F   1
+1FA80..1FA86   2
+1FA87..1FA8F   1
+1FA90..1FAAC   2
+1FAAD..1FAAF   1
+1FAB0..1FABA   2
+1FABB..1FABF   1
+1FAC0..1FAC5   2
+1FAC6..1FACF   1
+1FAD0..1FAD9   2
+1FADA..1FADF   1
+1FAE0..1FAE7   2
+1FAE8..1FAEF   1
+1FAF0..1FAF6   2
+1FAF7..1FFFF   1
+20000..3FFFF   2
+40000..E0000   1
+E0001          0
+E0002..E001F   1
+E0020..E007F   0
+E0080..E00FF   1
+E0100..E01EF   0
+E01F0..10FFFF  1
+EOF
+
+: "${DIFF=diff}"
+${DIFF} uc_width.ok uc_width.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
deleted file mode 120000 (symlink)
index e1a32f6b71df3fb54d47041b12ecb1fd4187aca4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/usleep.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4d325016a5669258393a7e94952757140bfbd7d4
--- /dev/null
@@ -0,0 +1,76 @@
+/* Pausing execution of the current thread.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+   Written by Eric Blake <ebb9@byu.net>, 2009.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file is _intentionally_ light-weight.  Rather than using
+   select or nanosleep, both of which drag in external libraries on
+   some platforms, this merely rounds up to the nearest second if
+   usleep() does not exist.  If sub-second resolution is important,
+   then use a more powerful interface to begin with.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+#endif
+
+#ifndef HAVE_USLEEP
+# define HAVE_USLEEP 0
+#endif
+
+/* Sleep for MICRO microseconds, which can be greater than 1 second.
+   Return -1 and set errno to EINVAL on range error (about 4295
+   seconds), or 0 on success.  Interaction with SIGALARM is
+   unspecified.  */
+
+int
+usleep (useconds_t micro)
+#undef usleep
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  unsigned int milliseconds = micro / 1000;
+  if (sizeof milliseconds < sizeof micro && micro / 1000 != milliseconds)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  if (micro % 1000)
+    milliseconds++;
+  Sleep (milliseconds);
+  return 0;
+#else
+  unsigned int seconds = micro / 1000000;
+  if (sizeof seconds < sizeof micro && micro / 1000000 != seconds)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  if (!HAVE_USLEEP && micro % 1000000)
+    seconds++;
+  while ((seconds = sleep (seconds)) != 0);
+
+# if !HAVE_USLEEP
+#  define usleep(x) 0
+# endif
+  return usleep (micro % 1000000);
+#endif
+}
deleted file mode 120000 (symlink)
index e6a6ebdde37eedb4651655f097f3d840194a9349..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/vma-iter.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8e830ae9e0ed520ae49b7db33730628c4ba6d928
--- /dev/null
+/* Iteration over virtual memory areas.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011-2017.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* On Solaris in 32-bit mode, when gnulib module 'largefile' is in use,
+   prevent a compilation error
+     "Cannot use procfs in the large file compilation environment"
+   while also preventing <sys/types.h> from not defining off_t.
+   On Android, when targeting Android 4.4 or older with a GCC toolchain,
+   prevent a compilation error
+     "error: call to 'mmap' declared with attribute error: mmap is not
+      available with _FILE_OFFSET_BITS=64 when using GCC until android-21.
+      Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or
+      switch to Clang."
+   The files that we access in this compilation unit are less than 2 GB
+   large.  */
+#if defined __sun && !defined _LP64 && _FILE_OFFSET_BITS == 64
+# undef _FILE_OFFSET_BITS
+# define _FILE_OFFSET_BITS 32
+#endif
+#ifdef __ANDROID__
+# undef _FILE_OFFSET_BITS
+#endif
+
+/* Specification.  */
+#include "vma-iter.h"
+
+#include <errno.h> /* errno */
+#include <stdlib.h> /* size_t */
+#include <fcntl.h> /* open, O_RDONLY */
+#include <unistd.h> /* getpagesize, lseek, read, close, getpid */
+
+#if defined __linux__ || defined __ANDROID__
+# include <limits.h> /* PATH_MAX */
+#endif
+
+#if defined __linux__ || defined __ANDROID__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix /* || defined __CYGWIN__ */
+# include <sys/types.h>
+# include <sys/mman.h> /* mmap, munmap */
+#endif
+#if defined __minix
+# include <string.h> /* memcpy */
+#endif
+
+#if defined __FreeBSD__ || defined __FreeBSD_kernel__ /* FreeBSD, GNU/kFreeBSD */
+# include <sys/types.h>
+# include <sys/mman.h> /* mmap, munmap */
+# include <sys/param.h> /* prerequisite of <sys/user.h> */
+# include <sys/user.h> /* struct kinfo_vmentry */
+# include <sys/sysctl.h> /* sysctl */
+#endif
+#if defined __NetBSD__ || defined __OpenBSD__ /* NetBSD, OpenBSD */
+# include <sys/types.h>
+# include <sys/mman.h> /* mmap, munmap */
+# include <sys/sysctl.h> /* sysctl, struct kinfo_vmentry */
+#endif
+
+#if defined _AIX /* AIX */
+# include <string.h> /* memcpy */
+# include <sys/types.h>
+# include <sys/mman.h> /* mmap, munmap */
+# include <sys/procfs.h> /* prmap_t */
+#endif
+
+#if defined __sgi || defined __osf__ /* IRIX, OSF/1 */
+# include <string.h> /* memcpy */
+# include <sys/types.h>
+# include <sys/mman.h> /* mmap, munmap */
+# include <sys/procfs.h> /* PIOC*, prmap_t */
+#endif
+
+#if defined __sun /* Solaris */
+# include <string.h> /* memcpy */
+# include <sys/types.h>
+# include <sys/mman.h> /* mmap, munmap */
+/* Try to use the newer ("structured") /proc filesystem API, if supported.  */
+# define _STRUCTURED_PROC 1
+# include <sys/procfs.h> /* prmap_t, optionally PIOC* */
+#endif
+
+#if HAVE_PSTAT_GETPROCVM /* HP-UX */
+# include <sys/pstat.h> /* pstat_getprocvm */
+#endif
+
+#if defined __APPLE__ && defined __MACH__ /* Mac OS X */
+# include <mach/mach.h>
+#endif
+
+#if defined __GNU__ /* GNU/Hurd */
+# include <mach/mach.h>
+#endif
+
+#if defined _WIN32 || defined __CYGWIN__ /* Windows */
+# include <windows.h>
+#endif
+
+#if defined __BEOS__ || defined __HAIKU__ /* BeOS, Haiku */
+# include <OS.h>
+#endif
+
+#if HAVE_MQUERY /* OpenBSD */
+# include <sys/types.h>
+# include <sys/mman.h> /* mquery */
+#endif
+
+
+/* Support for reading text files in the /proc file system.  */
+
+#if defined __linux__ || defined __ANDROID__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix /* || defined __CYGWIN__ */
+
+/* Buffered read-only streams.
+   We cannot use <stdio.h> here, because fopen() calls malloc(), and a malloc()
+   call may call mmap() and thus pre-allocate available memory.
+   Also, we cannot use multiple read() calls, because if the buffer size is
+   smaller than the file's contents:
+     - On NetBSD, the second read() call would return 0, thus making the file
+       appear truncated.
+     - On DragonFly BSD, the first read() call would fail with errno = EFBIG.
+     - On all platforms, if some other thread is doing memory allocations or
+       deallocations between two read() calls, there is a high risk that the
+       result of these two read() calls don't fit together, and as a
+       consequence we will parse garbage and either omit some VMAs or return
+       VMAs with nonsensical addresses.
+   So use mmap(), and ignore the resulting VMA.  */
+
+# if defined __linux__ || defined __ANDROID__
+  /* On Linux, if the file does not entirely fit into the buffer, the read()
+     function stops before the line that would come out truncated.  The
+     maximum size of such a line is 73 + PATH_MAX bytes.  To be sure that we
+     have read everything, we must verify that at least that many bytes are
+     left when read() returned.  */
+#  define MIN_LEFTOVER (73 + PATH_MAX)
+# else
+#  define MIN_LEFTOVER 1
+# endif
+
+# ifdef TEST
+/* During testing, we want to run into the hairy cases.  */
+#  define STACK_ALLOCATED_BUFFER_SIZE 32
+# else
+#  if MIN_LEFTOVER < 1024
+#   define STACK_ALLOCATED_BUFFER_SIZE 1024
+#  else
+    /* There is no point in using a stack-allocated buffer if it is too small anyway.  */
+#   define STACK_ALLOCATED_BUFFER_SIZE 1
+#  endif
+# endif
+
+struct rofile
+  {
+    size_t position;
+    size_t filled;
+    int eof_seen;
+    /* These fields deal with allocation of the buffer.  */
+    char *buffer;
+    char *auxmap;
+    size_t auxmap_length;
+    unsigned long auxmap_start;
+    unsigned long auxmap_end;
+    char stack_allocated_buffer[STACK_ALLOCATED_BUFFER_SIZE];
+  };
+
+/* Open a read-only file stream.  */
+static int
+rof_open (struct rofile *rof, const char *filename)
+{
+  int fd;
+  unsigned long pagesize;
+  size_t size;
+
+  fd = open (filename, O_RDONLY | O_CLOEXEC);
+  if (fd < 0)
+    return -1;
+  rof->position = 0;
+  rof->eof_seen = 0;
+  /* Try the static buffer first.  */
+  pagesize = 0;
+  rof->buffer = rof->stack_allocated_buffer;
+  size = sizeof (rof->stack_allocated_buffer);
+  rof->auxmap = NULL;
+  rof->auxmap_start = 0;
+  rof->auxmap_end = 0;
+  for (;;)
+    {
+      /* Attempt to read the contents in a single system call.  */
+      if (size > MIN_LEFTOVER)
+        {
+          int n = read (fd, rof->buffer, size);
+          if (n < 0 && errno == EINTR)
+            goto retry;
+# if defined __DragonFly__
+          if (!(n < 0 && errno == EFBIG))
+# endif
+            {
+              if (n <= 0)
+                /* Empty file.  */
+                goto fail1;
+              if (n + MIN_LEFTOVER <= size)
+                {
+                  /* The buffer was sufficiently large.  */
+                  rof->filled = n;
+# if defined __linux__ || defined __ANDROID__
+                  /* On Linux, the read() call may stop even if the buffer was
+                     large enough.  We need the equivalent of full_read().  */
+                  for (;;)
+                    {
+                      n = read (fd, rof->buffer + rof->filled, size - rof->filled);
+                      if (n < 0 && errno == EINTR)
+                        goto retry;
+                      if (n < 0)
+                        /* Some error.  */
+                        goto fail1;
+                      if (n + MIN_LEFTOVER > size - rof->filled)
+                        /* Allocate a larger buffer.  */
+                        break;
+                      if (n == 0)
+                        {
+                          /* Reached the end of file.  */
+                          close (fd);
+                          return 0;
+                        }
+                      rof->filled += n;
+                    }
+# else
+                  close (fd);
+                  return 0;
+# endif
+                }
+            }
+        }
+      /* Allocate a larger buffer.  */
+      if (pagesize == 0)
+        {
+          pagesize = getpagesize ();
+          size = pagesize;
+          while (size <= MIN_LEFTOVER)
+            size = 2 * size;
+        }
+      else
+        {
+          size = 2 * size;
+          if (size == 0)
+            /* Wraparound.  */
+            goto fail1;
+          if (rof->auxmap != NULL)
+            munmap (rof->auxmap, rof->auxmap_length);
+        }
+      rof->auxmap = (void *) mmap ((void *) 0, size, PROT_READ | PROT_WRITE,
+                                   MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+      if (rof->auxmap == (void *) -1)
+        {
+          close (fd);
+          return -1;
+        }
+      rof->auxmap_length = size;
+      rof->auxmap_start = (unsigned long) rof->auxmap;
+      rof->auxmap_end = rof->auxmap_start + size;
+      rof->buffer = (char *) rof->auxmap;
+     retry:
+      /* Restart.  */
+      if (lseek (fd, 0, SEEK_SET) < 0)
+        {
+          close (fd);
+          fd = open (filename, O_RDONLY | O_CLOEXEC);
+          if (fd < 0)
+            goto fail2;
+        }
+    }
+ fail1:
+  close (fd);
+ fail2:
+  if (rof->auxmap != NULL)
+    munmap (rof->auxmap, rof->auxmap_length);
+  return -1;
+}
+
+/* Return the next byte from a read-only file stream without consuming it,
+   or -1 at EOF.  */
+static int
+rof_peekchar (struct rofile *rof)
+{
+  if (rof->position == rof->filled)
+    {
+      rof->eof_seen = 1;
+      return -1;
+    }
+  return (unsigned char) rof->buffer[rof->position];
+}
+
+/* Return the next byte from a read-only file stream, or -1 at EOF.  */
+static int
+rof_getchar (struct rofile *rof)
+{
+  int c = rof_peekchar (rof);
+  if (c >= 0)
+    rof->position++;
+  return c;
+}
+
+/* Parse an unsigned hexadecimal number from a read-only file stream.  */
+static int
+rof_scanf_lx (struct rofile *rof, unsigned long *valuep)
+{
+  unsigned long value = 0;
+  unsigned int numdigits = 0;
+  for (;;)
+    {
+      int c = rof_peekchar (rof);
+      if (c >= '0' && c <= '9')
+        value = (value << 4) + (c - '0');
+      else if (c >= 'A' && c <= 'F')
+        value = (value << 4) + (c - 'A' + 10);
+      else if (c >= 'a' && c <= 'f')
+        value = (value << 4) + (c - 'a' + 10);
+      else
+        break;
+      rof_getchar (rof);
+      numdigits++;
+    }
+  if (numdigits == 0)
+    return -1;
+  *valuep = value;
+  return 0;
+}
+
+/* Close a read-only file stream.  */
+static void
+rof_close (struct rofile *rof)
+{
+  if (rof->auxmap != NULL)
+    munmap (rof->auxmap, rof->auxmap_length);
+}
+
+#endif
+
+
+/* Support for reading the info from a text file in the /proc file system.  */
+
+#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) /* || defined __CYGWIN__ */
+/* GNU/kFreeBSD mounts /proc as linprocfs, which looks like a Linux /proc
+   file system.  */
+
+static int
+vma_iterate_proc (vma_iterate_callback_fn callback, void *data)
+{
+  struct rofile rof;
+
+  /* Open the current process' maps file.  It describes one VMA per line.  */
+  if (rof_open (&rof, "/proc/self/maps") >= 0)
+    {
+      unsigned long auxmap_start = rof.auxmap_start;
+      unsigned long auxmap_end = rof.auxmap_end;
+
+      for (;;)
+        {
+          unsigned long start, end;
+          unsigned int flags;
+          int c;
+
+          /* Parse one line.  First start and end.  */
+          if (!(rof_scanf_lx (&rof, &start) >= 0
+                && rof_getchar (&rof) == '-'
+                && rof_scanf_lx (&rof, &end) >= 0))
+            break;
+          /* Then the flags.  */
+          do
+            c = rof_getchar (&rof);
+          while (c == ' ');
+          flags = 0;
+          if (c == 'r')
+            flags |= VMA_PROT_READ;
+          c = rof_getchar (&rof);
+          if (c == 'w')
+            flags |= VMA_PROT_WRITE;
+          c = rof_getchar (&rof);
+          if (c == 'x')
+            flags |= VMA_PROT_EXECUTE;
+          while (c = rof_getchar (&rof), c != -1 && c != '\n')
+            ;
+
+          if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+            {
+              /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+                 = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+              if (start < auxmap_start)
+                if (callback (data, start, auxmap_start, flags))
+                  break;
+              if (auxmap_end - 1 < end - 1)
+                if (callback (data, auxmap_end, end, flags))
+                  break;
+            }
+          else
+            {
+              if (callback (data, start, end, flags))
+                break;
+            }
+        }
+      rof_close (&rof);
+      return 0;
+    }
+
+  return -1;
+}
+
+#elif defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__
+
+static int
+vma_iterate_proc (vma_iterate_callback_fn callback, void *data)
+{
+  struct rofile rof;
+
+  /* Open the current process' maps file.  It describes one VMA per line.  */
+  if (rof_open (&rof, "/proc/curproc/map") >= 0)
+    {
+      unsigned long auxmap_start = rof.auxmap_start;
+      unsigned long auxmap_end = rof.auxmap_end;
+
+      for (;;)
+        {
+          unsigned long start, end;
+          unsigned int flags;
+          int c;
+
+          /* Parse one line.  First start.  */
+          if (!(rof_getchar (&rof) == '0'
+                && rof_getchar (&rof) == 'x'
+                && rof_scanf_lx (&rof, &start) >= 0))
+            break;
+          while (c = rof_peekchar (&rof), c == ' ' || c == '\t')
+            rof_getchar (&rof);
+          /* Then end.  */
+          if (!(rof_getchar (&rof) == '0'
+                && rof_getchar (&rof) == 'x'
+                && rof_scanf_lx (&rof, &end) >= 0))
+            break;
+# if defined __FreeBSD__ || defined __DragonFly__
+          /* Then the resident pages count.  */
+          do
+            c = rof_getchar (&rof);
+          while (c == ' ');
+          do
+            c = rof_getchar (&rof);
+          while (c != -1 && c != '\n' && c != ' ');
+          /* Then the private resident pages count.  */
+          do
+            c = rof_getchar (&rof);
+          while (c == ' ');
+          do
+            c = rof_getchar (&rof);
+          while (c != -1 && c != '\n' && c != ' ');
+          /* Then some kernel address.  */
+          do
+            c = rof_getchar (&rof);
+          while (c == ' ');
+          do
+            c = rof_getchar (&rof);
+          while (c != -1 && c != '\n' && c != ' ');
+# endif
+          /* Then the flags.  */
+          do
+            c = rof_getchar (&rof);
+          while (c == ' ');
+          flags = 0;
+          if (c == 'r')
+            flags |= VMA_PROT_READ;
+          c = rof_getchar (&rof);
+          if (c == 'w')
+            flags |= VMA_PROT_WRITE;
+          c = rof_getchar (&rof);
+          if (c == 'x')
+            flags |= VMA_PROT_EXECUTE;
+          while (c = rof_getchar (&rof), c != -1 && c != '\n')
+            ;
+
+          if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+            {
+              /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+                 = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+              if (start < auxmap_start)
+                if (callback (data, start, auxmap_start, flags))
+                  break;
+              if (auxmap_end - 1 < end - 1)
+                if (callback (data, auxmap_end, end, flags))
+                  break;
+            }
+          else
+            {
+              if (callback (data, start, end, flags))
+                break;
+            }
+        }
+      rof_close (&rof);
+      return 0;
+    }
+
+  return -1;
+}
+
+#elif defined __minix
+
+static int
+vma_iterate_proc (vma_iterate_callback_fn callback, void *data)
+{
+  char fnamebuf[6+10+4+1];
+  char *fname;
+  struct rofile rof;
+
+  /* Construct fname = sprintf (fnamebuf+i, "/proc/%u/map", getpid ()).  */
+  fname = fnamebuf + sizeof (fnamebuf) - (4 + 1);
+  memcpy (fname, "/map", 4 + 1);
+  {
+    unsigned int value = getpid ();
+    do
+      *--fname = (value % 10) + '0';
+    while ((value = value / 10) > 0);
+  }
+  fname -= 6;
+  memcpy (fname, "/proc/", 6);
+
+  /* Open the current process' maps file.  It describes one VMA per line.  */
+  if (rof_open (&rof, fname) >= 0)
+    {
+      unsigned long auxmap_start = rof.auxmap_start;
+      unsigned long auxmap_end = rof.auxmap_end;
+
+      for (;;)
+        {
+          unsigned long start, end;
+          unsigned int flags;
+          int c;
+
+          /* Parse one line.  First start and end.  */
+          if (!(rof_scanf_lx (&rof, &start) >= 0
+                && rof_getchar (&rof) == '-'
+                && rof_scanf_lx (&rof, &end) >= 0))
+            break;
+          /* Then the flags.  */
+          do
+            c = rof_getchar (&rof);
+          while (c == ' ');
+          flags = 0;
+          if (c == 'r')
+            flags |= VMA_PROT_READ;
+          c = rof_getchar (&rof);
+          if (c == 'w')
+            flags |= VMA_PROT_WRITE;
+          c = rof_getchar (&rof);
+          if (c == 'x')
+            flags |= VMA_PROT_EXECUTE;
+          while (c = rof_getchar (&rof), c != -1 && c != '\n')
+            ;
+
+          if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+            {
+              /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+                 = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+              if (start < auxmap_start)
+                if (callback (data, start, auxmap_start, flags))
+                  break;
+              if (auxmap_end - 1 < end - 1)
+                if (callback (data, auxmap_end, end, flags))
+                  break;
+            }
+          else
+            {
+              if (callback (data, start, end, flags))
+                break;
+            }
+        }
+      rof_close (&rof);
+      return 0;
+    }
+
+  return -1;
+}
+
+#else
+
+static inline int
+vma_iterate_proc (vma_iterate_callback_fn callback, void *data)
+{
+  return -1;
+}
+
+#endif
+
+
+/* Support for reading the info from the BSD sysctl() system call.  */
+
+#if (defined __FreeBSD__ || defined __FreeBSD_kernel__) && defined KERN_PROC_VMMAP /* FreeBSD >= 7.1 */
+
+static int
+vma_iterate_bsd (vma_iterate_callback_fn callback, void *data)
+{
+  /* Documentation: https://www.freebsd.org/cgi/man.cgi?sysctl(3)  */
+  int info_path[] = { CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid () };
+  size_t len;
+  size_t pagesize;
+  size_t memneed;
+  void *auxmap;
+  unsigned long auxmap_start;
+  unsigned long auxmap_end;
+  char *mem;
+  char *p;
+  char *p_end;
+
+  len = 0;
+  if (sysctl (info_path, 4, NULL, &len, NULL, 0) < 0)
+    return -1;
+  /* Allow for small variations over time.  In a multithreaded program
+     new VMAs can be allocated at any moment.  */
+  len = 2 * len + 200;
+  /* Allocate memneed bytes of memory.
+     We cannot use alloca here, because not much stack space is guaranteed.
+     We also cannot use malloc here, because a malloc() call may call mmap()
+     and thus pre-allocate available memory.
+     So use mmap(), and ignore the resulting VMA.  */
+  pagesize = getpagesize ();
+  memneed = len;
+  memneed = ((memneed - 1) / pagesize + 1) * pagesize;
+  auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE,
+                          MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+  if (auxmap == (void *) -1)
+    return -1;
+  auxmap_start = (unsigned long) auxmap;
+  auxmap_end = auxmap_start + memneed;
+  mem = (char *) auxmap;
+  if (sysctl (info_path, 4, mem, &len, NULL, 0) < 0)
+    {
+      munmap (auxmap, memneed);
+      return -1;
+    }
+  p = mem;
+  p_end = mem + len;
+  while (p < p_end)
+    {
+      struct kinfo_vmentry *kve = (struct kinfo_vmentry *) p;
+      unsigned long start = kve->kve_start;
+      unsigned long end = kve->kve_end;
+      unsigned int flags = 0;
+      if (kve->kve_protection & KVME_PROT_READ)
+        flags |= VMA_PROT_READ;
+      if (kve->kve_protection & KVME_PROT_WRITE)
+        flags |= VMA_PROT_WRITE;
+      if (kve->kve_protection & KVME_PROT_EXEC)
+        flags |= VMA_PROT_EXECUTE;
+      if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+        {
+          /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+             = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+          if (start < auxmap_start)
+            if (callback (data, start, auxmap_start, flags))
+              break;
+          if (auxmap_end - 1 < end - 1)
+            if (callback (data, auxmap_end, end, flags))
+              break;
+        }
+      else
+        {
+          if (callback (data, start, end, flags))
+            break;
+        }
+      p += kve->kve_structsize;
+    }
+  munmap (auxmap, memneed);
+  return 0;
+}
+
+#elif defined __NetBSD__ && defined VM_PROC_MAP /* NetBSD >= 8.0 */
+
+static int
+vma_iterate_bsd (vma_iterate_callback_fn callback, void *data)
+{
+  /* Documentation: https://man.netbsd.org/man/sysctl+7  */
+  unsigned int entry_size =
+    /* If we wanted to have the path of each entry, we would need
+       sizeof (struct kinfo_vmentry).  But we need only the non-string
+       parts of each entry.  */
+    offsetof (struct kinfo_vmentry, kve_path);
+  int info_path[] = { CTL_VM, VM_PROC, VM_PROC_MAP, getpid (), entry_size };
+  size_t len;
+  size_t pagesize;
+  size_t memneed;
+  void *auxmap;
+  unsigned long auxmap_start;
+  unsigned long auxmap_end;
+  char *mem;
+  char *p;
+  char *p_end;
+
+  len = 0;
+  if (sysctl (info_path, 5, NULL, &len, NULL, 0) < 0)
+    return -1;
+  /* Allow for small variations over time.  In a multithreaded program
+     new VMAs can be allocated at any moment.  */
+  len = 2 * len + 10 * entry_size;
+  /* But the system call rejects lengths > 1 MB.  */
+  if (len > 0x100000)
+    len = 0x100000;
+  /* And the system call causes a kernel panic if the length is not a multiple
+     of entry_size.  */
+  len = (len / entry_size) * entry_size;
+  /* Allocate memneed bytes of memory.
+     We cannot use alloca here, because not much stack space is guaranteed.
+     We also cannot use malloc here, because a malloc() call may call mmap()
+     and thus pre-allocate available memory.
+     So use mmap(), and ignore the resulting VMA.  */
+  pagesize = getpagesize ();
+  memneed = len;
+  memneed = ((memneed - 1) / pagesize + 1) * pagesize;
+  auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE,
+                          MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+  if (auxmap == (void *) -1)
+    return -1;
+  auxmap_start = (unsigned long) auxmap;
+  auxmap_end = auxmap_start + memneed;
+  mem = (char *) auxmap;
+  if (sysctl (info_path, 5, mem, &len, NULL, 0) < 0
+      || len > 0x100000 - entry_size)
+    {
+      /* sysctl failed, or the list of VMAs is possibly truncated.  */
+      munmap (auxmap, memneed);
+      return -1;
+    }
+  p = mem;
+  p_end = mem + len;
+  while (p < p_end)
+    {
+      struct kinfo_vmentry *kve = (struct kinfo_vmentry *) p;
+      unsigned long start = kve->kve_start;
+      unsigned long end = kve->kve_end;
+      unsigned int flags = 0;
+      if (kve->kve_protection & KVME_PROT_READ)
+        flags |= VMA_PROT_READ;
+      if (kve->kve_protection & KVME_PROT_WRITE)
+        flags |= VMA_PROT_WRITE;
+      if (kve->kve_protection & KVME_PROT_EXEC)
+        flags |= VMA_PROT_EXECUTE;
+      if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+        {
+          /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+             = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+          if (start < auxmap_start)
+            if (callback (data, start, auxmap_start, flags))
+              break;
+          if (auxmap_end - 1 < end - 1)
+            if (callback (data, auxmap_end, end, flags))
+              break;
+        }
+      else
+        {
+          if (callback (data, start, end, flags))
+            break;
+        }
+      p += entry_size;
+    }
+  munmap (auxmap, memneed);
+  return 0;
+}
+
+#elif defined __OpenBSD__ && defined KERN_PROC_VMMAP /* OpenBSD >= 5.7 */
+
+static int
+vma_iterate_bsd (vma_iterate_callback_fn callback, void *data)
+{
+  /* Documentation: https://man.openbsd.org/sysctl.2  */
+  int info_path[] = { CTL_KERN, KERN_PROC_VMMAP, getpid () };
+  size_t len;
+  size_t pagesize;
+  size_t memneed;
+  void *auxmap;
+  unsigned long auxmap_start;
+  unsigned long auxmap_end;
+  char *mem;
+  char *p;
+  char *p_end;
+
+  len = 0;
+  if (sysctl (info_path, 3, NULL, &len, NULL, 0) < 0)
+    return -1;
+  /* Allow for small variations over time.  In a multithreaded program
+     new VMAs can be allocated at any moment.  */
+  len = 2 * len + 10 * sizeof (struct kinfo_vmentry);
+  /* But the system call rejects lengths > 64 KB.  */
+  if (len > 0x10000)
+    len = 0x10000;
+  /* And the system call rejects lengths that are not a multiple of
+     sizeof (struct kinfo_vmentry).  */
+  len = (len / sizeof (struct kinfo_vmentry)) * sizeof (struct kinfo_vmentry);
+  /* Allocate memneed bytes of memory.
+     We cannot use alloca here, because not much stack space is guaranteed.
+     We also cannot use malloc here, because a malloc() call may call mmap()
+     and thus pre-allocate available memory.
+     So use mmap(), and ignore the resulting VMA.  */
+  pagesize = getpagesize ();
+  memneed = len;
+  memneed = ((memneed - 1) / pagesize + 1) * pagesize;
+  auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE,
+                          MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+  if (auxmap == (void *) -1)
+    return -1;
+  auxmap_start = (unsigned long) auxmap;
+  auxmap_end = auxmap_start + memneed;
+  mem = (char *) auxmap;
+  if (sysctl (info_path, 3, mem, &len, NULL, 0) < 0
+      || len > 0x10000 - sizeof (struct kinfo_vmentry))
+    {
+      /* sysctl failed, or the list of VMAs is possibly truncated.  */
+      munmap (auxmap, memneed);
+      return -1;
+    }
+  p = mem;
+  p_end = mem + len;
+  while (p < p_end)
+    {
+      struct kinfo_vmentry *kve = (struct kinfo_vmentry *) p;
+      unsigned long start = kve->kve_start;
+      unsigned long end = kve->kve_end;
+      unsigned int flags = 0;
+      if (kve->kve_protection & KVE_PROT_READ)
+        flags |= VMA_PROT_READ;
+      if (kve->kve_protection & KVE_PROT_WRITE)
+        flags |= VMA_PROT_WRITE;
+      if (kve->kve_protection & KVE_PROT_EXEC)
+        flags |= VMA_PROT_EXECUTE;
+      if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+        {
+          /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+             = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+          if (start < auxmap_start)
+            if (callback (data, start, auxmap_start, flags))
+              break;
+          if (auxmap_end - 1 < end - 1)
+            if (callback (data, auxmap_end, end, flags))
+              break;
+        }
+      else
+        {
+          if (start != end)
+            if (callback (data, start, end, flags))
+              break;
+        }
+      p += sizeof (struct kinfo_vmentry);
+    }
+  munmap (auxmap, memneed);
+  return 0;
+}
+
+#else
+
+static inline int
+vma_iterate_bsd (vma_iterate_callback_fn callback, void *data)
+{
+  return -1;
+}
+
+#endif
+
+
+int
+vma_iterate (vma_iterate_callback_fn callback, void *data)
+{
+#if defined __linux__ || defined __ANDROID__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix /* || defined __CYGWIN__ */
+
+# if defined __FreeBSD__
+  /* On FreeBSD with procfs (but not GNU/kFreeBSD, which uses linprocfs), the
+     function vma_iterate_proc does not return the virtual memory areas that
+     were created by anonymous mmap.  See
+     <https://svnweb.freebsd.org/base/head/sys/fs/procfs/procfs_map.c?view=markup>
+     So use vma_iterate_proc only as a fallback.  */
+  int retval = vma_iterate_bsd (callback, data);
+  if (retval == 0)
+      return 0;
+
+  return vma_iterate_proc (callback, data);
+# else
+  /* On the other platforms, try the /proc approach first, and the sysctl()
+     as a fallback.  */
+  int retval = vma_iterate_proc (callback, data);
+  if (retval == 0)
+      return 0;
+
+  return vma_iterate_bsd (callback, data);
+# endif
+
+#elif defined _AIX /* AIX */
+
+  /* On AIX, there is a /proc/$pic/map file, that contains records of type
+     prmap_t, defined in <sys/procfs.h>.  In older versions of AIX, it lists
+     only the virtual memory areas that are connected to a file, not the
+     anonymous ones.  But at least since AIX 7.1, it is well usable.  */
+
+  size_t pagesize;
+  char fnamebuf[6+10+4+1];
+  char *fname;
+  int fd;
+  size_t memneed;
+
+  pagesize = getpagesize ();
+
+  /* Construct fname = sprintf (fnamebuf+i, "/proc/%u/map", getpid ()).  */
+  fname = fnamebuf + sizeof (fnamebuf) - (4+1);
+  memcpy (fname, "/map", 4+1);
+  {
+    unsigned int value = getpid ();
+    do
+      *--fname = (value % 10) + '0';
+    while ((value = value / 10) > 0);
+  }
+  fname -= 6;
+  memcpy (fname, "/proc/", 6);
+
+  fd = open (fname, O_RDONLY | O_CLOEXEC);
+  if (fd < 0)
+    return -1;
+
+  /* The contents of /proc/<pid>/map contains a number of prmap_t entries,
+     then an entirely null prmap_t entry, then a heap of NUL terminated
+     strings.
+     Documentation: https://www.ibm.com/docs/en/aix/7.1?topic=files-proc-file
+     We read the entire contents, but look only at the prmap_t entries and
+     ignore the tail part.  */
+
+  for (memneed = 2 * pagesize; ; memneed = 2 * memneed)
+    {
+      /* Allocate memneed bytes of memory.
+         We cannot use alloca here, because not much stack space is guaranteed.
+         We also cannot use malloc here, because a malloc() call may call mmap()
+         and thus pre-allocate available memory.
+         So use mmap(), and ignore the resulting VMA if it occurs among the
+         resulting VMAs.  (Normally it doesn't, because it was allocated after
+         the open() call.)  */
+      void *auxmap;
+      unsigned long auxmap_start;
+      unsigned long auxmap_end;
+      ssize_t nbytes;
+
+      auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE,
+                              MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+      if (auxmap == (void *) -1)
+        {
+          close (fd);
+          return -1;
+        }
+      auxmap_start = (unsigned long) auxmap;
+      auxmap_end = auxmap_start + memneed;
+
+      /* Read the contents of /proc/<pid>/map in a single system call.
+         This guarantees a consistent result (no duplicated or omitted
+         entries).  */
+     retry:
+      do
+        nbytes = read (fd, auxmap, memneed);
+      while (nbytes < 0 && errno == EINTR);
+      if (nbytes <= 0)
+        {
+          munmap (auxmap, memneed);
+          close (fd);
+          return -1;
+        }
+      if (nbytes == memneed)
+        {
+          /* Need more memory.  */
+          munmap (auxmap, memneed);
+          if (lseek (fd, 0, SEEK_SET) < 0)
+            {
+              close (fd);
+              return -1;
+            }
+        }
+      else
+        {
+          if (read (fd, (char *) auxmap + nbytes, 1) > 0)
+            {
+              /* Oops, we had a short read.  Retry.  */
+              if (lseek (fd, 0, SEEK_SET) < 0)
+                {
+                  munmap (auxmap, memneed);
+                  close (fd);
+                  return -1;
+                }
+              goto retry;
+            }
+
+          /* We now have the entire contents of /proc/<pid>/map in memory.  */
+          prmap_t* maps = (prmap_t *) auxmap;
+
+          /* The entries are not sorted by address.  Therefore
+             1. Extract the relevant information into an array.
+             2. Sort the array in ascending order.
+             3. Invoke the callback.  */
+          typedef struct
+            {
+              uintptr_t start;
+              uintptr_t end;
+              unsigned int flags;
+            }
+          vma_t;
+          /* Since 2 * sizeof (vma_t) <= sizeof (prmap_t), we can reuse the
+             same memory.  */
+          vma_t *vmas = (vma_t *) auxmap;
+
+          vma_t *vp = vmas;
+          {
+            prmap_t* mp;
+            for (mp = maps;;)
+              {
+                unsigned long start, end;
+
+                start = (unsigned long) mp->pr_vaddr;
+                end = start + mp->pr_size;
+                if (start == 0 && end == 0 && mp->pr_mflags == 0)
+                  break;
+                /* Discard empty VMAs and kernel VMAs.  */
+                if (start < end && (mp->pr_mflags & MA_KERNTEXT) == 0)
+                  {
+                    unsigned int flags;
+                    flags = 0;
+                    if (mp->pr_mflags & MA_READ)
+                      flags |= VMA_PROT_READ;
+                    if (mp->pr_mflags & MA_WRITE)
+                      flags |= VMA_PROT_WRITE;
+                    if (mp->pr_mflags & MA_EXEC)
+                      flags |= VMA_PROT_EXECUTE;
+
+                    if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+                      {
+                        /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+                           = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+                        if (start < auxmap_start)
+                          {
+                            vp->start = start;
+                            vp->end = auxmap_start;
+                            vp->flags = flags;
+                            vp++;
+                          }
+                        if (auxmap_end - 1 < end - 1)
+                          {
+                            vp->start = auxmap_end;
+                            vp->end = end;
+                            vp->flags = flags;
+                            vp++;
+                          }
+                      }
+                    else
+                      {
+                        vp->start = start;
+                        vp->end = end;
+                        vp->flags = flags;
+                        vp++;
+                      }
+                  }
+                mp++;
+              }
+          }
+
+          size_t nvmas = vp - vmas;
+          /* Sort the array in ascending order.
+             Better not call qsort(), since it may call malloc().
+             Insertion-sort is OK in this case, despite its worst-case running
+             time of O(N²), since the number of VMAs will rarely be larger than
+             1000.  */
+          {
+            size_t i;
+            for (i = 1; i < nvmas; i++)
+              {
+                /* Invariant: Here vmas[0..i-1] is sorted.  */
+                size_t j;
+                for (j = i; j > 0 && vmas[j - 1].start > vmas[j].start; j--)
+                  {
+                    vma_t tmp = vmas[j - 1];
+                    vmas[j - 1] = vmas[j];
+                    vmas[j] = tmp;
+                  }
+                /* Invariant: Here vmas[0..i] is sorted.  */
+              }
+          }
+
+          /* Invoke the callback.  */
+          {
+            size_t i;
+            for (i = 0; i < nvmas; i++)
+              {
+                vma_t *vpi = &vmas[i];
+                if (callback (data, vpi->start, vpi->end, vpi->flags))
+                  break;
+              }
+          }
+
+          munmap (auxmap, memneed);
+          break;
+        }
+    }
+
+  close (fd);
+  return 0;
+
+#elif defined __sgi || defined __osf__ /* IRIX, OSF/1 */
+
+  size_t pagesize;
+  char fnamebuf[6+10+1];
+  char *fname;
+  int fd;
+  int nmaps;
+  size_t memneed;
+# if HAVE_MAP_ANONYMOUS
+#  define zero_fd -1
+#  define map_flags MAP_ANONYMOUS
+# else
+  int zero_fd;
+#  define map_flags 0
+# endif
+  void *auxmap;
+  unsigned long auxmap_start;
+  unsigned long auxmap_end;
+  prmap_t* maps;
+  prmap_t* mp;
+
+  pagesize = getpagesize ();
+
+  /* Construct fname = sprintf (fnamebuf+i, "/proc/%u", getpid ()).  */
+  fname = fnamebuf + sizeof (fnamebuf) - 1;
+  *fname = '\0';
+  {
+    unsigned int value = getpid ();
+    do
+      *--fname = (value % 10) + '0';
+    while ((value = value / 10) > 0);
+  }
+  fname -= 6;
+  memcpy (fname, "/proc/", 6);
+
+  fd = open (fname, O_RDONLY | O_CLOEXEC);
+  if (fd < 0)
+    return -1;
+
+  if (ioctl (fd, PIOCNMAP, &nmaps) < 0)
+    goto fail2;
+
+  memneed = (nmaps + 10) * sizeof (prmap_t);
+  /* Allocate memneed bytes of memory.
+     We cannot use alloca here, because not much stack space is guaranteed.
+     We also cannot use malloc here, because a malloc() call may call mmap()
+     and thus pre-allocate available memory.
+     So use mmap(), and ignore the resulting VMA.  */
+  memneed = ((memneed - 1) / pagesize + 1) * pagesize;
+# if !HAVE_MAP_ANONYMOUS
+  zero_fd = open ("/dev/zero", O_RDONLY | O_CLOEXEC, 0644);
+  if (zero_fd < 0)
+    goto fail2;
+# endif
+  auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE,
+                          map_flags | MAP_PRIVATE, zero_fd, 0);
+# if !HAVE_MAP_ANONYMOUS
+  close (zero_fd);
+# endif
+  if (auxmap == (void *) -1)
+    goto fail2;
+  auxmap_start = (unsigned long) auxmap;
+  auxmap_end = auxmap_start + memneed;
+  maps = (prmap_t *) auxmap;
+
+  if (ioctl (fd, PIOCMAP, maps) < 0)
+    goto fail1;
+
+  for (mp = maps;;)
+    {
+      unsigned long start, end;
+      unsigned int flags;
+
+      start = (unsigned long) mp->pr_vaddr;
+      end = start + mp->pr_size;
+      if (start == 0 && end == 0)
+        break;
+      flags = 0;
+      if (mp->pr_mflags & MA_READ)
+        flags |= VMA_PROT_READ;
+      if (mp->pr_mflags & MA_WRITE)
+        flags |= VMA_PROT_WRITE;
+      if (mp->pr_mflags & MA_EXEC)
+        flags |= VMA_PROT_EXECUTE;
+      mp++;
+      if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+        {
+          /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+             = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+          if (start < auxmap_start)
+            if (callback (data, start, auxmap_start, flags))
+              break;
+          if (auxmap_end - 1 < end - 1)
+            if (callback (data, auxmap_end, end, flags))
+              break;
+        }
+      else
+        {
+          if (callback (data, start, end, flags))
+            break;
+        }
+    }
+  munmap (auxmap, memneed);
+  close (fd);
+  return 0;
+
+ fail1:
+  munmap (auxmap, memneed);
+ fail2:
+  close (fd);
+  return -1;
+
+#elif defined __sun /* Solaris */
+
+  /* Note: Solaris <sys/procfs.h> defines a different type prmap_t with
+     _STRUCTURED_PROC than without! Here's a table of sizeof(prmap_t):
+                                  32-bit   64-bit
+         _STRUCTURED_PROC = 0       32       56
+         _STRUCTURED_PROC = 1       96      104
+     Therefore, if the include files provide the newer API, prmap_t has
+     the bigger size, and thus you MUST use the newer API.  And if the
+     include files provide the older API, prmap_t has the smaller size,
+     and thus you MUST use the older API.  */
+
+# if defined PIOCNMAP && defined PIOCMAP
+  /* We must use the older /proc interface.  */
+
+  size_t pagesize;
+  char fnamebuf[6+10+1];
+  char *fname;
+  int fd;
+  int nmaps;
+  size_t memneed;
+#  if HAVE_MAP_ANONYMOUS
+#   define zero_fd -1
+#   define map_flags MAP_ANONYMOUS
+#  else /* Solaris <= 7 */
+  int zero_fd;
+#   define map_flags 0
+#  endif
+  void *auxmap;
+  unsigned long auxmap_start;
+  unsigned long auxmap_end;
+  prmap_t* maps;
+  prmap_t* mp;
+
+  pagesize = getpagesize ();
+
+  /* Construct fname = sprintf (fnamebuf+i, "/proc/%u", getpid ()).  */
+  fname = fnamebuf + sizeof (fnamebuf) - 1;
+  *fname = '\0';
+  {
+    unsigned int value = getpid ();
+    do
+      *--fname = (value % 10) + '0';
+    while ((value = value / 10) > 0);
+  }
+  fname -= 6;
+  memcpy (fname, "/proc/", 6);
+
+  fd = open (fname, O_RDONLY | O_CLOEXEC);
+  if (fd < 0)
+    return -1;
+
+  if (ioctl (fd, PIOCNMAP, &nmaps) < 0)
+    goto fail2;
+
+  memneed = (nmaps + 10) * sizeof (prmap_t);
+  /* Allocate memneed bytes of memory.
+     We cannot use alloca here, because not much stack space is guaranteed.
+     We also cannot use malloc here, because a malloc() call may call mmap()
+     and thus pre-allocate available memory.
+     So use mmap(), and ignore the resulting VMA.  */
+  memneed = ((memneed - 1) / pagesize + 1) * pagesize;
+#  if !HAVE_MAP_ANONYMOUS
+  zero_fd = open ("/dev/zero", O_RDONLY | O_CLOEXEC, 0644);
+  if (zero_fd < 0)
+    goto fail2;
+#  endif
+  auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE,
+                          map_flags | MAP_PRIVATE, zero_fd, 0);
+#  if !HAVE_MAP_ANONYMOUS
+  close (zero_fd);
+#  endif
+  if (auxmap == (void *) -1)
+    goto fail2;
+  auxmap_start = (unsigned long) auxmap;
+  auxmap_end = auxmap_start + memneed;
+  maps = (prmap_t *) auxmap;
+
+  if (ioctl (fd, PIOCMAP, maps) < 0)
+    goto fail1;
+
+  for (mp = maps;;)
+    {
+      unsigned long start, end;
+      unsigned int flags;
+
+      start = (unsigned long) mp->pr_vaddr;
+      end = start + mp->pr_size;
+      if (start == 0 && end == 0)
+        break;
+      flags = 0;
+      if (mp->pr_mflags & MA_READ)
+        flags |= VMA_PROT_READ;
+      if (mp->pr_mflags & MA_WRITE)
+        flags |= VMA_PROT_WRITE;
+      if (mp->pr_mflags & MA_EXEC)
+        flags |= VMA_PROT_EXECUTE;
+      mp++;
+      if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+        {
+          /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+             = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+          if (start < auxmap_start)
+            if (callback (data, start, auxmap_start, flags))
+              break;
+          if (auxmap_end - 1 < end - 1)
+            if (callback (data, auxmap_end, end, flags))
+              break;
+        }
+      else
+        {
+          if (callback (data, start, end, flags))
+            break;
+        }
+    }
+  munmap (auxmap, memneed);
+  close (fd);
+  return 0;
+
+ fail1:
+  munmap (auxmap, memneed);
+ fail2:
+  close (fd);
+  return -1;
+
+# else
+  /* We must use the newer /proc interface.
+     Documentation:
+     https://docs.oracle.com/cd/E23824_01/html/821-1473/proc-4.html
+     The contents of /proc/<pid>/map consists of records of type
+     prmap_t.  These are different in 32-bit and 64-bit processes,
+     but here we are fortunately accessing only the current process.  */
+
+  size_t pagesize;
+  char fnamebuf[6+10+4+1];
+  char *fname;
+  int fd;
+  int nmaps;
+  size_t memneed;
+#  if HAVE_MAP_ANONYMOUS
+#   define zero_fd -1
+#   define map_flags MAP_ANONYMOUS
+#  else /* Solaris <= 7 */
+  int zero_fd;
+#   define map_flags 0
+#  endif
+  void *auxmap;
+  unsigned long auxmap_start;
+  unsigned long auxmap_end;
+  prmap_t* maps;
+  prmap_t* maps_end;
+  prmap_t* mp;
+
+  pagesize = getpagesize ();
+
+  /* Construct fname = sprintf (fnamebuf+i, "/proc/%u/map", getpid ()).  */
+  fname = fnamebuf + sizeof (fnamebuf) - 1 - 4;
+  memcpy (fname, "/map", 4 + 1);
+  {
+    unsigned int value = getpid ();
+    do
+      *--fname = (value % 10) + '0';
+    while ((value = value / 10) > 0);
+  }
+  fname -= 6;
+  memcpy (fname, "/proc/", 6);
+
+  fd = open (fname, O_RDONLY | O_CLOEXEC);
+  if (fd < 0)
+    return -1;
+
+  {
+    struct stat statbuf;
+    if (fstat (fd, &statbuf) < 0)
+      goto fail2;
+    nmaps = statbuf.st_size / sizeof (prmap_t);
+  }
+
+  memneed = (nmaps + 10) * sizeof (prmap_t);
+  /* Allocate memneed bytes of memory.
+     We cannot use alloca here, because not much stack space is guaranteed.
+     We also cannot use malloc here, because a malloc() call may call mmap()
+     and thus pre-allocate available memory.
+     So use mmap(), and ignore the resulting VMA.  */
+  memneed = ((memneed - 1) / pagesize + 1) * pagesize;
+#  if !HAVE_MAP_ANONYMOUS
+  zero_fd = open ("/dev/zero", O_RDONLY | O_CLOEXEC, 0644);
+  if (zero_fd < 0)
+    goto fail2;
+#  endif
+  auxmap = (void *) mmap ((void *) 0, memneed, PROT_READ | PROT_WRITE,
+                          map_flags | MAP_PRIVATE, zero_fd, 0);
+#  if !HAVE_MAP_ANONYMOUS
+  close (zero_fd);
+#  endif
+  if (auxmap == (void *) -1)
+    goto fail2;
+  auxmap_start = (unsigned long) auxmap;
+  auxmap_end = auxmap_start + memneed;
+  maps = (prmap_t *) auxmap;
+
+  /* Read up to memneed bytes from fd into maps.  */
+  {
+    size_t remaining = memneed;
+    size_t total_read = 0;
+    char *ptr = (char *) maps;
+
+    do
+      {
+        size_t nread = read (fd, ptr, remaining);
+        if (nread == (size_t)-1)
+          {
+            if (errno == EINTR)
+              continue;
+            goto fail1;
+          }
+        if (nread == 0)
+          /* EOF */
+          break;
+        total_read += nread;
+        ptr += nread;
+        remaining -= nread;
+      }
+    while (remaining > 0);
+
+    nmaps = (memneed - remaining) / sizeof (prmap_t);
+    maps_end = maps + nmaps;
+  }
+
+  for (mp = maps; mp < maps_end; mp++)
+    {
+      unsigned long start, end;
+      unsigned int flags;
+
+      start = (unsigned long) mp->pr_vaddr;
+      end = start + mp->pr_size;
+      flags = 0;
+      if (mp->pr_mflags & MA_READ)
+        flags |= VMA_PROT_READ;
+      if (mp->pr_mflags & MA_WRITE)
+        flags |= VMA_PROT_WRITE;
+      if (mp->pr_mflags & MA_EXEC)
+        flags |= VMA_PROT_EXECUTE;
+      if (start <= auxmap_start && auxmap_end - 1 <= end - 1)
+        {
+          /* Consider [start,end-1] \ [auxmap_start,auxmap_end-1]
+             = [start,auxmap_start-1] u [auxmap_end,end-1].  */
+          if (start < auxmap_start)
+            if (callback (data, start, auxmap_start, flags))
+              break;
+          if (auxmap_end - 1 < end - 1)
+            if (callback (data, auxmap_end, end, flags))
+              break;
+        }
+      else
+        {
+          if (callback (data, start, end, flags))
+            break;
+        }
+    }
+  munmap (auxmap, memneed);
+  close (fd);
+  return 0;
+
+ fail1:
+  munmap (auxmap, memneed);
+ fail2:
+  close (fd);
+  return -1;
+
+# endif
+
+#elif HAVE_PSTAT_GETPROCVM /* HP-UX */
+
+  unsigned long pagesize = getpagesize ();
+  int i;
+
+  for (i = 0; ; i++)
+    {
+      struct pst_vm_status info;
+      int ret = pstat_getprocvm (&info, sizeof (info), 0, i);
+      if (ret < 0)
+        return -1;
+      if (ret == 0)
+        break;
+      {
+        unsigned long start = info.pst_vaddr;
+        unsigned long end = start + info.pst_length * pagesize;
+        unsigned int flags = 0;
+        if (info.pst_permission & PS_PROT_READ)
+          flags |= VMA_PROT_READ;
+        if (info.pst_permission & PS_PROT_WRITE)
+          flags |= VMA_PROT_WRITE;
+        if (info.pst_permission & PS_PROT_EXECUTE)
+          flags |= VMA_PROT_EXECUTE;
+
+        if (callback (data, start, end, flags))
+          break;
+      }
+    }
+
+#elif defined __APPLE__ && defined __MACH__ /* Mac OS X */
+
+  task_t task = mach_task_self ();
+  vm_address_t address;
+  vm_size_t size;
+
+  for (address = VM_MIN_ADDRESS;; address += size)
+    {
+      int more;
+      mach_port_t object_name;
+      unsigned int flags;
+      /* In Mac OS X 10.5, the types vm_address_t, vm_offset_t, vm_size_t have
+         32 bits in 32-bit processes and 64 bits in 64-bit processes. Whereas
+         mach_vm_address_t and mach_vm_size_t are always 64 bits large.
+         Mac OS X 10.5 has three vm_region like methods:
+           - vm_region. It has arguments that depend on whether the current
+             process is 32-bit or 64-bit. When linking dynamically, this
+             function exists only in 32-bit processes. Therefore we use it only
+             in 32-bit processes.
+           - vm_region_64. It has arguments that depend on whether the current
+             process is 32-bit or 64-bit. It interprets a flavor
+             VM_REGION_BASIC_INFO as VM_REGION_BASIC_INFO_64, which is
+             dangerous since 'struct vm_region_basic_info_64' is larger than
+             'struct vm_region_basic_info'; therefore let's write
+             VM_REGION_BASIC_INFO_64 explicitly.
+           - mach_vm_region. It has arguments that are 64-bit always. This
+             function is useful when you want to access the VM of a process
+             other than the current process.
+         In 64-bit processes, we could use vm_region_64 or mach_vm_region.
+         I choose vm_region_64 because it uses the same types as vm_region,
+         resulting in less conditional code.  */
+# if defined __aarch64__ || defined __ppc64__ || defined __x86_64__
+      struct vm_region_basic_info_64 info;
+      mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT_64;
+
+      more = (vm_region_64 (task, &address, &size, VM_REGION_BASIC_INFO_64,
+                            (vm_region_info_t)&info, &info_count, &object_name)
+              == KERN_SUCCESS);
+# else
+      struct vm_region_basic_info info;
+      mach_msg_type_number_t info_count = VM_REGION_BASIC_INFO_COUNT;
+
+      more = (vm_region (task, &address, &size, VM_REGION_BASIC_INFO,
+                         (vm_region_info_t)&info, &info_count, &object_name)
+              == KERN_SUCCESS);
+# endif
+      if (object_name != MACH_PORT_NULL)
+        mach_port_deallocate (mach_task_self (), object_name);
+      if (!more)
+        break;
+      flags = 0;
+      if (info.protection & VM_PROT_READ)
+        flags |= VMA_PROT_READ;
+      if (info.protection & VM_PROT_WRITE)
+        flags |= VMA_PROT_WRITE;
+      if (info.protection & VM_PROT_EXECUTE)
+        flags |= VMA_PROT_EXECUTE;
+      if (callback (data, address, address + size, flags))
+        break;
+    }
+  return 0;
+
+#elif defined __GNU__ /* GNU/Hurd */
+
+  /* The Hurd has a /proc/self/maps that looks like the Linux one, but it
+     lacks the VMAs created through anonymous mmap.  Therefore use the Mach
+     API.
+     Documentation:
+     https://www.gnu.org/software/hurd/gnumach-doc/Memory-Attributes.html */
+
+  task_t task = mach_task_self ();
+  vm_address_t address;
+  vm_size_t size;
+
+  for (address = 0;; address += size)
+    {
+      vm_prot_t protection;
+      vm_prot_t max_protection;
+      vm_inherit_t inheritance;
+      boolean_t shared;
+      memory_object_name_t object_name;
+      vm_offset_t offset;
+      unsigned int flags;
+
+      if (!(vm_region (task, &address, &size, &protection, &max_protection,
+                         &inheritance, &shared, &object_name, &offset)
+            == KERN_SUCCESS))
+        break;
+      mach_port_deallocate (task, object_name);
+      flags = 0;
+      if (protection & VM_PROT_READ)
+        flags |= VMA_PROT_READ;
+      if (protection & VM_PROT_WRITE)
+        flags |= VMA_PROT_WRITE;
+      if (protection & VM_PROT_EXECUTE)
+        flags |= VMA_PROT_EXECUTE;
+      if (callback (data, address, address + size, flags))
+        break;
+    }
+  return 0;
+
+#elif defined _WIN32 || defined __CYGWIN__
+  /* Windows platform.  Use the native Windows API.  */
+
+  MEMORY_BASIC_INFORMATION info;
+  uintptr_t address = 0;
+
+  while (VirtualQuery ((void*)address, &info, sizeof(info)) == sizeof(info))
+    {
+      if (info.State != MEM_FREE)
+        /* Ignore areas where info.State has the value MEM_RESERVE or,
+           equivalently, info.Protect has the undocumented value 0.
+           This is needed, so that on Cygwin, areas used by malloc() are
+           distinguished from areas reserved for future malloc().  */
+        if (info.State != MEM_RESERVE)
+          {
+            uintptr_t start, end;
+            unsigned int flags;
+
+            start = (uintptr_t)info.BaseAddress;
+            end = start + info.RegionSize;
+            switch (info.Protect & ~(PAGE_GUARD|PAGE_NOCACHE))
+              {
+              case PAGE_READONLY:
+                flags = VMA_PROT_READ;
+                break;
+              case PAGE_READWRITE:
+              case PAGE_WRITECOPY:
+                flags = VMA_PROT_READ | VMA_PROT_WRITE;
+                break;
+              case PAGE_EXECUTE:
+                flags = VMA_PROT_EXECUTE;
+                break;
+              case PAGE_EXECUTE_READ:
+                flags = VMA_PROT_READ | VMA_PROT_EXECUTE;
+                break;
+              case PAGE_EXECUTE_READWRITE:
+              case PAGE_EXECUTE_WRITECOPY:
+                flags = VMA_PROT_READ | VMA_PROT_WRITE | VMA_PROT_EXECUTE;
+                break;
+              case PAGE_NOACCESS:
+              default:
+                flags = 0;
+                break;
+              }
+
+            if (callback (data, start, end, flags))
+              break;
+          }
+      address = (uintptr_t)info.BaseAddress + info.RegionSize;
+    }
+  return 0;
+
+#elif defined __BEOS__ || defined __HAIKU__
+  /* Use the BeOS specific API.  */
+
+  area_info info;
+  ssize_t cookie;
+
+  cookie = 0;
+  while (get_next_area_info (0, &cookie, &info) == B_OK)
+    {
+      unsigned long start, end;
+      unsigned int flags;
+
+      start = (unsigned long) info.address;
+      end = start + info.size;
+      flags = 0;
+      if (info.protection & B_READ_AREA)
+        flags |= VMA_PROT_READ | VMA_PROT_EXECUTE;
+      if (info.protection & B_WRITE_AREA)
+        flags |= VMA_PROT_WRITE;
+
+      if (callback (data, start, end, flags))
+        break;
+    }
+  return 0;
+
+#elif HAVE_MQUERY /* OpenBSD */
+
+# if defined __OpenBSD__
+  /* Try sysctl() first.  It is more efficient than the mquery() loop below
+     and also provides the flags.  */
+  {
+    int retval = vma_iterate_bsd (callback, data);
+    if (retval == 0)
+      return 0;
+  }
+# endif
+
+  {
+    uintptr_t pagesize;
+    uintptr_t address;
+    int /*bool*/ address_known_mapped;
+
+    pagesize = getpagesize ();
+    /* Avoid calling mquery with a NULL first argument, because this argument
+       value has a specific meaning.  We know the NULL page is unmapped.  */
+    address = pagesize;
+    address_known_mapped = 0;
+    for (;;)
+      {
+        /* Test whether the page at address is mapped.  */
+        if (address_known_mapped
+            || mquery ((void *) address, pagesize, 0, MAP_FIXED, -1, 0)
+               == (void *) -1)
+          {
+            /* The page at address is mapped.
+               This is the start of an interval.  */
+            uintptr_t start = address;
+            uintptr_t end;
+
+            /* Find the end of the interval.  */
+            end = (uintptr_t) mquery ((void *) address, pagesize, 0, 0, -1, 0);
+            if (end == (uintptr_t) (void *) -1)
+              end = 0; /* wrap around */
+            address = end;
+
+            /* It's too complicated to find out about the flags.
+               Just pass 0.  */
+            if (callback (data, start, end, 0))
+              break;
+
+            if (address < pagesize) /* wrap around? */
+              break;
+          }
+        /* Here we know that the page at address is unmapped.  */
+        {
+          uintptr_t query_size = pagesize;
+
+          address += pagesize;
+
+          /* Query larger and larger blocks, to get through the unmapped address
+             range with few mquery() calls.  */
+          for (;;)
+            {
+              if (2 * query_size > query_size)
+                query_size = 2 * query_size;
+              if (address + query_size - 1 < query_size) /* wrap around? */
+                {
+                  address_known_mapped = 0;
+                  break;
+                }
+              if (mquery ((void *) address, query_size, 0, MAP_FIXED, -1, 0)
+                  == (void *) -1)
+                {
+                  /* Not all the interval [address .. address + query_size - 1]
+                     is unmapped.  */
+                  address_known_mapped = (query_size == pagesize);
+                  break;
+                }
+              /* The interval [address .. address + query_size - 1] is
+                 unmapped.  */
+              address += query_size;
+            }
+          /* Reduce the query size again, to determine the precise size of the
+             unmapped interval that starts at address.  */
+          while (query_size > pagesize)
+            {
+              query_size = query_size / 2;
+              if (address + query_size - 1 >= query_size)
+                {
+                  if (mquery ((void *) address, query_size, 0, MAP_FIXED, -1, 0)
+                      != (void *) -1)
+                    {
+                      /* The interval [address .. address + query_size - 1] is
+                         unmapped.  */
+                      address += query_size;
+                      address_known_mapped = 0;
+                    }
+                  else
+                    address_known_mapped = (query_size == pagesize);
+                }
+            }
+          /* Here again query_size = pagesize, and
+             either address + pagesize - 1 < pagesize, or
+             mquery ((void *) address, pagesize, 0, MAP_FIXED, -1, 0) fails.
+             So, the unmapped area ends at address.  */
+        }
+        if (address + pagesize - 1 < pagesize) /* wrap around? */
+          break;
+      }
+    return 0;
+  }
+
+#else
+
+  /* Not implemented.  */
+  return -1;
+
+#endif
+}
+
+
+#ifdef TEST
+
+#include <stdio.h>
+
+/* Output the VMAs of the current process in a format similar to the Linux
+   /proc/$pid/maps file.  */
+
+static int
+vma_iterate_callback (void *data, uintptr_t start, uintptr_t end,
+                      unsigned int flags)
+{
+  printf ("%08lx-%08lx %c%c%c\n",
+          (unsigned long) start, (unsigned long) end,
+          flags & VMA_PROT_READ ? 'r' : '-',
+          flags & VMA_PROT_WRITE ? 'w' : '-',
+          flags & VMA_PROT_EXECUTE ? 'x' : '-');
+  return 0;
+}
+
+int
+main ()
+{
+  vma_iterate (vma_iterate_callback, NULL);
+
+  /* Let the user interactively look at the /proc file system.  */
+  sleep (10);
+
+  return 0;
+}
+
+/*
+ * Local Variables:
+ * compile-command: "gcc -ggdb -DTEST -Wall -I.. vma-iter.c"
+ * End:
+ */
+
+#endif /* TEST */
deleted file mode 120000 (symlink)
index 5254fe313d76ff2b4fb3712882ccecd30b5a8d3f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/vma-iter.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e5405cab7f7b5dac0dbd790e491e017ac7b58f7f
--- /dev/null
@@ -0,0 +1,69 @@
+/* Iteration over virtual memory areas.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _VMA_ITER_H
+#define _VMA_ITER_H
+
+/* This file uses HAVE_PSTAT_GETPROCVM, HAVE_MQUERY.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Bit mask for the FLAGS parameter of a vma_iterate callback function.  */
+#define VMA_PROT_READ    (1<<0)
+#define VMA_PROT_WRITE   (1<<1)
+#define VMA_PROT_EXECUTE (1<<2)
+
+typedef int (*vma_iterate_callback_fn) (void *data,
+                                        uintptr_t start, uintptr_t end,
+                                        unsigned int flags);
+
+/* Iterate over the virtual memory areas of the current process.
+   If such iteration is supported, the callback is called once for every
+   virtual memory area, in ascending order, with the following arguments:
+     - DATA is the same argument as passed to vma_iterate.
+     - START is the address of the first byte in the area, page-aligned.
+     - END is the address of the last byte in the area plus 1, page-aligned.
+       Note that it may be 0 for the last area in the address space.
+     - FLAGS is a combination of the VMA_* bits.
+   If the callback returns 0, the iteration continues.  If it returns 1,
+   the iteration terminates prematurely.
+   This function may open file descriptors, but does not call malloc().
+   Return 0 if all went well, or -1 in case of error.  */
+extern int vma_iterate (vma_iterate_callback_fn callback, void *data);
+
+/* The macro VMA_ITERATE_SUPPORTED indicates that vma_iterate is supported on
+   this platform.
+   Note that even when this macro is defined, vma_iterate() may still fail to
+   find any virtual memory area, for example if /proc is not mounted.  */
+#if defined __linux__ || defined __ANDROID__ || defined __GNU__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sgi || defined __osf__ || defined __sun || HAVE_PSTAT_GETPROCVM || (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__ || defined __BEOS__ || defined __HAIKU__ || defined __minix || HAVE_MQUERY
+# define VMA_ITERATE_SUPPORTED 1
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _VMA_ITER_H */
deleted file mode 120000 (symlink)
index 8cf454f36daf55871be605cda1751df03673d3a4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/w32sock.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..166a5f777e6908489802eb62bb50c7df4ba9b78b
--- /dev/null
@@ -0,0 +1,140 @@
+/* w32sock.h --- internal auxiliary functions for Windows socket functions
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini */
+
+#include <errno.h>
+
+/* Get O_RDWR and O_BINARY.  */
+#include <fcntl.h>
+
+/* Get _open_osfhandle().  */
+#include <io.h>
+
+/* Get _get_osfhandle().  */
+#if GNULIB_MSVC_NOTHROW
+# include "msvc-nothrow.h"
+#else
+# include <io.h>
+#endif
+
+#define FD_TO_SOCKET(fd)   ((SOCKET) _get_osfhandle ((fd)))
+#define SOCKET_TO_FD(fh)   (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY))
+
+static inline void
+set_winsock_errno (void)
+{
+  int err = WSAGetLastError ();
+
+  /* Map some WSAE* errors to the runtime library's error codes.  */
+  switch (err)
+    {
+    case WSA_INVALID_HANDLE:
+      errno = EBADF;
+      break;
+    case WSA_NOT_ENOUGH_MEMORY:
+      errno = ENOMEM;
+      break;
+    case WSA_INVALID_PARAMETER:
+      errno = EINVAL;
+      break;
+    case WSAENAMETOOLONG:
+      errno = ENAMETOOLONG;
+      break;
+    case WSAENOTEMPTY:
+      errno = ENOTEMPTY;
+      break;
+    case WSAEWOULDBLOCK:
+      errno = EWOULDBLOCK;
+      break;
+    case WSAEINPROGRESS:
+      errno = EINPROGRESS;
+      break;
+    case WSAEALREADY:
+      errno = EALREADY;
+      break;
+    case WSAENOTSOCK:
+      errno = ENOTSOCK;
+      break;
+    case WSAEDESTADDRREQ:
+      errno = EDESTADDRREQ;
+      break;
+    case WSAEMSGSIZE:
+      errno = EMSGSIZE;
+      break;
+    case WSAEPROTOTYPE:
+      errno = EPROTOTYPE;
+      break;
+    case WSAENOPROTOOPT:
+      errno = ENOPROTOOPT;
+      break;
+    case WSAEPROTONOSUPPORT:
+      errno = EPROTONOSUPPORT;
+      break;
+    case WSAEOPNOTSUPP:
+      errno = EOPNOTSUPP;
+      break;
+    case WSAEAFNOSUPPORT:
+      errno = EAFNOSUPPORT;
+      break;
+    case WSAEADDRINUSE:
+      errno = EADDRINUSE;
+      break;
+    case WSAEADDRNOTAVAIL:
+      errno = EADDRNOTAVAIL;
+      break;
+    case WSAENETDOWN:
+      errno = ENETDOWN;
+      break;
+    case WSAENETUNREACH:
+      errno = ENETUNREACH;
+      break;
+    case WSAENETRESET:
+      errno = ENETRESET;
+      break;
+    case WSAECONNABORTED:
+      errno = ECONNABORTED;
+      break;
+    case WSAECONNRESET:
+      errno = ECONNRESET;
+      break;
+    case WSAENOBUFS:
+      errno = ENOBUFS;
+      break;
+    case WSAEISCONN:
+      errno = EISCONN;
+      break;
+    case WSAENOTCONN:
+      errno = ENOTCONN;
+      break;
+    case WSAETIMEDOUT:
+      errno = ETIMEDOUT;
+      break;
+    case WSAECONNREFUSED:
+      errno = ECONNREFUSED;
+      break;
+    case WSAELOOP:
+      errno = ELOOP;
+      break;
+    case WSAEHOSTUNREACH:
+      errno = EHOSTUNREACH;
+      break;
+    default:
+      errno = (err > 10000 && err < 10025) ? err - 10000 : err;
+      break;
+    }
+}
deleted file mode 120000 (symlink)
index 2141d9af03ca04725b54396370a3a6d62606ffab..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/warn-on-use.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8f4d40dcbebdef9ff00d64d988396745836f59b6
--- /dev/null
@@ -0,0 +1,149 @@
+/* A C macro for emitting warnings if a function is used.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
+   for FUNCTION which will then trigger a compiler warning containing
+   the text of "literal string" anywhere that function is called, if
+   supported by the compiler.  If the compiler does not support this
+   feature, the macro expands to an unused extern declaration.
+
+   _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
+   attribute used in _GL_WARN_ON_USE.  If the compiler does not support
+   this feature, it expands to empty.
+
+   These macros are useful for marking a function as a potential
+   portability trap, with the intent that "literal string" include
+   instructions on the replacement function that should be used
+   instead.
+   _GL_WARN_ON_USE is for functions with 'extern' linkage.
+   _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
+   linkage.
+
+   However, one of the reasons that a function is a portability trap is
+   if it has the wrong signature.  Declaring FUNCTION with a different
+   signature in C is a compilation error, so this macro must use the
+   same type as any existing declaration so that programs that avoid
+   the problematic FUNCTION do not fail to compile merely because they
+   included a header that poisoned the function.  But this implies that
+   _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
+   have a declaration.  Use of this macro implies that there must not
+   be any other macro hiding the declaration of FUNCTION; but
+   undefining FUNCTION first is part of the poisoning process anyway
+   (although for symbols that are provided only via a macro, the result
+   is a compilation error rather than a warning containing
+   "literal string").  Also note that in C++, it is only safe to use if
+   FUNCTION has no overloads.
+
+   For an example, it is possible to poison 'getline' by:
+   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
+     [getline]) in configure.ac, which potentially defines
+     HAVE_RAW_DECL_GETLINE
+   - adding this code to a header that wraps the system <stdio.h>:
+     #undef getline
+     #if HAVE_RAW_DECL_GETLINE
+     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
+       "not universally present; use the gnulib module getline");
+     #endif
+
+   It is not possible to directly poison global variables.  But it is
+   possible to write a wrapper accessor function, and poison that
+   (less common usage, like &environ, will cause a compilation error
+   rather than issue the nice warning, but the end result of informing
+   the developer about their portability problem is still achieved):
+     #if HAVE_RAW_DECL_ENVIRON
+     static char ***
+     rpl_environ (void) { return &environ; }
+     _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
+     # undef environ
+     # define environ (*rpl_environ ())
+     #endif
+   or better (avoiding contradictory use of 'static' and 'extern'):
+     #if HAVE_RAW_DECL_ENVIRON
+     static char ***
+     _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
+     rpl_environ (void) { return &environ; }
+     # undef environ
+     # define environ (*rpl_environ ())
+     #endif
+   */
+#ifndef _GL_WARN_ON_USE
+
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
+#  define _GL_WARN_ON_USE(function, message) \
+_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
+#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
+  __attribute__ ((__warning__ (message)))
+# elif __clang_major__ >= 4
+/* Another compiler attribute is available in clang.  */
+#  define _GL_WARN_ON_USE(function, message) \
+_GL_WARN_EXTERN_C __typeof__ (function) function \
+  __attribute__ ((__diagnose_if__ (1, message, "warning")))
+#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
+  __attribute__ ((__diagnose_if__ (1, message, "warning")))
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+/* Verify the existence of the function.  */
+#  define _GL_WARN_ON_USE(function, message) \
+_GL_WARN_EXTERN_C __typeof__ (function) function
+#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
+# else /* Unsupported.  */
+#  define _GL_WARN_ON_USE(function, message) \
+_GL_WARN_EXTERN_C int _gl_warn_on_use
+#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
+# endif
+#endif
+
+/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
+   is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
+   function is declared with the given prototype, consisting of return type,
+   parameters, and attributes.
+   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
+   not work in this case.  */
+#ifndef _GL_WARN_ON_USE_CXX
+# if !defined __cplusplus
+#  define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+     _GL_WARN_ON_USE (function, msg)
+# else
+#  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
+#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+extern rettype_gcc function parameters_and_attributes \
+  __attribute__ ((__warning__ (msg)))
+#  elif __clang_major__ >= 4
+/* Another compiler attribute is available in clang.  */
+#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+extern rettype_clang function parameters_and_attributes \
+  __attribute__ ((__diagnose_if__ (1, msg, "warning")))
+#  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+/* Verify the existence of the function.  */
+#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+extern rettype_gcc function parameters_and_attributes
+#  else /* Unsupported.  */
+#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+_GL_WARN_EXTERN_C int _gl_warn_on_use
+#  endif
+# endif
+#endif
+
+/* _GL_WARN_EXTERN_C declaration;
+   performs the declaration with C linkage.  */
+#ifndef _GL_WARN_EXTERN_C
+# if defined __cplusplus
+#  define _GL_WARN_EXTERN_C extern "C"
+# else
+#  define _GL_WARN_EXTERN_C extern
+# endif
+#endif
deleted file mode 120000 (symlink)
index 49969b637532d5073488e6ac05ce6a613a34e846..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wctob.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e1f274040bd243b8cc9d0047940ad6380aba4ae2
--- /dev/null
@@ -0,0 +1,38 @@
+/* Convert wide character to unibyte character.
+   Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+wctob (wint_t wc)
+{
+  char buf[64];
+
+  if (!(MB_CUR_MAX <= sizeof (buf)))
+    abort ();
+  /* Handle the case where WEOF is a value that does not fit in a wchar_t.  */
+  if (wc == (wchar_t)wc)
+    if (wctomb (buf, (wchar_t)wc) == 1)
+      return (unsigned char) buf[0];
+  return EOF;
+}
deleted file mode 120000 (symlink)
index c99267346b0d758252c180c4d213d1dd43221bcd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wctomb-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ccec9ce039055b35655fb1ac93f377127e1ca907
--- /dev/null
@@ -0,0 +1,34 @@
+/* Convert wide character to multibyte character.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+int
+wctomb (char *s, wchar_t wc)
+{
+  if (s == NULL)
+    return 0;
+  else
+    {
+      mbstate_t state;
+      size_t result;
+
+      mbszero (&state);
+      result = wcrtomb (s, wc, &state);
+      if (result == (size_t)-1)
+        return -1;
+      return result;
+    }
+}
deleted file mode 120000 (symlink)
index 9468f0129425d8c6ace40114b7eab3d0e5707d99..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wctomb.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..694c95ca758668e6f8996713117f14404fae45f4
--- /dev/null
@@ -0,0 +1,25 @@
+/* Convert wide character to multibyte character.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <string.h>
+#include <wchar.h>
+
+#include "wctomb-impl.h"
deleted file mode 120000 (symlink)
index c9a50da59b672511d1d15cd92c71b68c17df6a24..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/tests/zerosize-ptr.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..90ab26f9d1a42ac63be1c4a0e36e20490efd936f
--- /dev/null
@@ -0,0 +1,82 @@
+/* Return a pointer to a zero-size object in memory.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* ISO C 99 does not allow memcmp(), memchr() etc. to be invoked with a NULL
+   argument.  Therefore this file produces a non-NULL pointer which cannot
+   be dereferenced, if possible.  */
+
+/* On Android, when targeting Android 4.4 or older with a GCC toolchain,
+   prevent a compilation error
+     "error: call to 'mmap' declared with attribute error: mmap is not
+      available with _FILE_OFFSET_BITS=64 when using GCC until android-21.
+      Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or
+      switch to Clang."
+   The files that we access in this compilation unit are less than 2 GB
+   large.  */
+#if defined __ANDROID__
+# undef _FILE_OFFSET_BITS
+# undef __USE_FILE_OFFSET64
+#endif
+
+#include <stdlib.h>
+
+/* Test whether mmap() and mprotect() are available.
+   We don't use HAVE_MMAP, because AC_FUNC_MMAP would not define it on HP-UX.
+   HAVE_MPROTECT is not enough, because mingw does not have mmap() but has an
+   mprotect() function in libgcc.a.
+   And OS/2 kLIBC has <sys/mman.h> and mprotect(), but not mmap().  */
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __KLIBC__
+# include <fcntl.h>
+# include <unistd.h>
+# include <sys/types.h>
+# include <sys/mman.h>
+/* Define MAP_FILE when it isn't otherwise.  */
+# ifndef MAP_FILE
+#  define MAP_FILE 0
+# endif
+#endif
+
+/* Return a pointer to a zero-size object in memory (that is, actually, a
+   pointer to a page boundary where the previous page is readable and writable
+   and the next page is neither readable not writable), if possible.
+   Return NULL otherwise.  */
+
+static void *
+zerosize_ptr (void)
+{
+/* Use mmap and mprotect when they exist.  Don't test HAVE_MMAP, because it is
+   not defined on HP-UX 11 (since it does not support MAP_FIXED).  */
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __KLIBC__
+# if HAVE_MAP_ANONYMOUS
+  const int flags = MAP_ANONYMOUS | MAP_PRIVATE;
+  const int fd = -1;
+# else /* !HAVE_MAP_ANONYMOUS */
+  const int flags = MAP_FILE | MAP_PRIVATE;
+  int fd = open ("/dev/zero", O_RDONLY, 0666);
+  if (fd >= 0)
+# endif
+    {
+      int pagesize = getpagesize ();
+      char *two_pages =
+        (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
+                       flags, fd, 0);
+      if (two_pages != (char *)(-1)
+          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
+        return two_pages + pagesize;
+    }
+#endif
+  return NULL;
+}
deleted file mode 120000 (symlink)
index 5904f87bc12896f1da2520558f116250ef0b7bf2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/_Noreturn.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7326bd477331b4acbe93a119f3cc86b5ea3148b8
--- /dev/null
@@ -0,0 +1,50 @@
+/* A C macro for declaring that a function does not return.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _Noreturn
+# if (defined __cplusplus \
+      && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
+          || (defined _MSC_VER && 1900 <= _MSC_VER)) \
+      && 0)
+    /* [[noreturn]] is not practically usable, because with it the syntax
+         extern _Noreturn void func (...);
+       would not be valid; such a declaration would only be valid with 'extern'
+       and '_Noreturn' swapped, or without the 'extern' keyword.  However, some
+       AIX system header files and several gnulib header files use precisely
+       this syntax with 'extern'.  */
+#  define _Noreturn [[noreturn]]
+# elif (defined __clang__ && __clang_major__ < 16 \
+        && defined _GL_WORK_AROUND_LLVM_BUG_59792)
+   /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
+      that rare LLVM bug, though you may get many false-alarm warnings.  */
+#  define _Noreturn
+# elif ((!defined __cplusplus || defined __clang__) \
+        && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
+            || (!defined __STRICT_ANSI__ \
+                && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
+                    || (defined __apple_build_version__ \
+                        ? 6000000 <= __apple_build_version__ \
+                        : 3 < __clang_major__ + (5 <= __clang_minor__))))))
+   /* _Noreturn works as-is.  */
+# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
+        || 0x5110 <= __SUNPRO_C)
+#  define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn
+# endif
+#endif
deleted file mode 120000 (symlink)
index 177bdbfbd415c633591e03fdb101980b9beb9eef..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/access.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c3bdbff41d2327fa8f821cf73651c437a6679150
--- /dev/null
@@ -0,0 +1,71 @@
+/* Test the access rights of a file.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#if defined _WIN32 && !defined __CYGWIN__
+# include <io.h>
+#endif
+
+int
+access (const char *file, int mode)
+#undef access
+{
+  int ret;
+
+#if defined _WIN32 && !defined __CYGWIN__
+  if ((mode & X_OK) != 0)
+    mode = (mode & ~X_OK) | R_OK;
+  ret = _access (file, mode);
+#else
+  ret = access (file, mode);
+#endif
+
+#if (defined _WIN32 && !defined __CYGWIN__) || ACCESS_TRAILING_SLASH_BUG
+# if defined _WIN32 && !defined __CYGWIN__
+  if (ret == 0 || errno == EINVAL)
+# else
+  if (ret == 0)
+# endif
+    {
+      size_t file_len = strlen (file);
+      if (file_len > 0 && file[file_len - 1] == '/')
+        {
+          struct stat st;
+          if (stat (file, &st) == 0)
+            {
+              if (! S_ISDIR (st.st_mode))
+                {
+                  errno = ENOTDIR;
+                  return -1;
+                }
+            }
+          else
+            return (mode == F_OK && errno == EOVERFLOW ? 0 : -1);
+        }
+    }
+#endif
+  return ret;
+}
deleted file mode 120000 (symlink)
index 623986ba5b5b4f4191f0727cf0445c1befe2f18c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/acl-errno-valid.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ee9407232db2c9fc83947482833fafad59535159
--- /dev/null
@@ -0,0 +1,52 @@
+/* Test whether ACLs are well supported on this system.
+
+   Copyright 2013-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include <acl.h>
+
+#include <errno.h>
+
+/* Return true if errno value ERRNUM indicates that ACLs are well
+   supported on this system.  ERRNUM should be an errno value obtained
+   after an ACL-related system call fails.  */
+bool
+acl_errno_valid (int errnum)
+{
+  /* Recognize some common errors such as from an NFS mount that does
+     not support ACLs, even when local drives do.  */
+  switch (errnum)
+    {
+    case EBUSY: return false;
+    case EINVAL: return false;
+#if defined __APPLE__ && defined __MACH__
+    case ENOENT: return false;
+#endif
+    case ENOSYS: return false;
+
+#if defined ENOTSUP && ENOTSUP != EOPNOTSUPP
+# if ENOTSUP != ENOSYS /* Needed for the MS-Windows port of GNU Emacs.  */
+    case ENOTSUP: return false;
+# endif
+#endif
+
+    case EOPNOTSUPP: return false;
+    default: return true;
+    }
+}
deleted file mode 120000 (symlink)
index 3bcf8e512eb2ae91d592d39d9367635450e12a39..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/acl-internal.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..68aead8de650e37a912ac7c145e533dc4d1105cc
--- /dev/null
@@ -0,0 +1,507 @@
+/* Test whether a file has a nontrivial ACL.  -*- coding: utf-8 -*-
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible.  */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include "acl-internal.h"
+
+#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+
+# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
+
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
+   Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial.  */
+int
+acl_extended_nontrivial (acl_t acl)
+{
+  /* acl is non-trivial if it is non-empty.  */
+  return (acl_entries (acl) > 0);
+}
+
+# else /* Linux, FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */
+
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
+   Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
+   Return -1 and set errno upon failure to determine it.  */
+int
+acl_access_nontrivial (acl_t acl)
+{
+  /* acl is non-trivial if it has some entries other than for "user::",
+     "group::", and "other::".  Normally these three should be present
+     at least, allowing us to write
+        return (3 < acl_entries (acl));
+     but the following code is more robust.  */
+#  if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, Cygwin >= 2.5 */
+
+  acl_entry_t ace;
+  int got_one;
+
+  for (got_one = acl_get_entry (acl, ACL_FIRST_ENTRY, &ace);
+       got_one > 0;
+       got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace))
+    {
+      acl_tag_t tag;
+      if (acl_get_tag_type (ace, &tag) < 0)
+        return -1;
+      if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER))
+        return 1;
+    }
+  return got_one;
+
+#  elif HAVE_ACL_TO_SHORT_TEXT /* IRIX */
+  /* Don't use acl_get_entry: it is undocumented.  */
+
+  int count = acl->acl_cnt;
+  int i;
+
+  for (i = 0; i < count; i++)
+    {
+      acl_entry_t ace = &acl->acl_entry[i];
+      acl_tag_t tag = ace->ae_tag;
+
+      if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ
+            || tag == ACL_OTHER_OBJ))
+        return 1;
+    }
+  return 0;
+
+#  elif HAVE_ACL_FREE_TEXT /* Tru64 */
+  /* Don't use acl_get_entry: it takes only one argument and does not work.  */
+
+  int count = acl->acl_num;
+  acl_entry_t ace;
+
+  for (ace = acl->acl_first; count > 0; ace = ace->next, count--)
+    {
+      acl_tag_t tag;
+      acl_perm_t perm;
+
+      tag = ace->entry->acl_type;
+      if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER))
+        return 1;
+
+      perm = ace->entry->acl_perm;
+      /* On Tru64, perm can also contain non-standard bits such as
+         PERM_INSERT, PERM_DELETE, PERM_MODIFY, PERM_LOOKUP, ... */
+      if ((perm & ~(ACL_READ | ACL_WRITE | ACL_EXECUTE)) != 0)
+        return 1;
+    }
+  return 0;
+
+#  else
+
+  errno = ENOSYS;
+  return -1;
+#  endif
+}
+
+int
+acl_default_nontrivial (acl_t acl)
+{
+  /* acl is non-trivial if it is non-empty.  */
+  return (acl_entries (acl) > 0);
+}
+
+# endif
+
+#elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin < 2.5, not HP-UX */
+
+/* Test an ACL retrieved with GETACL.
+   Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+int
+acl_nontrivial (int count, aclent_t *entries)
+{
+  int i;
+
+  for (i = 0; i < count; i++)
+    {
+      aclent_t *ace = &entries[i];
+
+      /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
+         If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
+         We don't need to check ace->a_id in these cases.  */
+      if (!(ace->a_type == USER_OBJ
+            || ace->a_type == GROUP_OBJ
+            || ace->a_type == OTHER_OBJ
+            /* Note: Cygwin does not return a CLASS_OBJ ("mask:") entry
+               sometimes.  */
+            || ace->a_type == CLASS_OBJ))
+        return 1;
+    }
+  return 0;
+}
+
+# ifdef ACE_GETACL
+
+/* A shortcut for a bitmask.  */
+#  define NEW_ACE_WRITEA_DATA (NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA)
+
+/* Test an ACL retrieved with ACE_GETACL.
+   Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+int
+acl_ace_nontrivial (int count, ace_t *entries)
+{
+  int i;
+
+  /* The flags in the ace_t structure changed in a binary incompatible way
+     when ACL_NO_TRIVIAL etc. were introduced in <sys/acl.h> version 1.15.
+     How to distinguish the two conventions at runtime?
+     In the old convention, usually three ACEs have a_flags = ACE_OWNER /
+     ACE_GROUP / ACE_OTHER, in the range 0x0100..0x0400.  In the new
+     convention, these values are not used.  */
+  int old_convention = 0;
+
+  for (i = 0; i < count; i++)
+    if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
+      {
+        old_convention = 1;
+        break;
+      }
+
+  if (old_convention)
+    /* Running on Solaris 10.  */
+    for (i = 0; i < count; i++)
+      {
+        ace_t *ace = &entries[i];
+
+        /* Note:
+           If ace->a_flags = ACE_OWNER, ace->a_who is the st_uid from stat().
+           If ace->a_flags = ACE_GROUP, ace->a_who is the st_gid from stat().
+           We don't need to check ace->a_who in these cases.  */
+        if (!(ace->a_type == OLD_ALLOW
+              && (ace->a_flags == OLD_ACE_OWNER
+                  || ace->a_flags == OLD_ACE_GROUP
+                  || ace->a_flags == OLD_ACE_OTHER)))
+          return 1;
+      }
+  else
+    {
+      /* Running on Solaris 10 (newer version) or Solaris 11.  */
+      unsigned int access_masks[6] =
+        {
+          0, /* owner@ deny */
+          0, /* owner@ allow */
+          0, /* group@ deny */
+          0, /* group@ allow */
+          0, /* everyone@ deny */
+          0  /* everyone@ allow */
+        };
+
+      for (i = 0; i < count; i++)
+        {
+          ace_t *ace = &entries[i];
+          unsigned int index1;
+          unsigned int index2;
+
+          if (ace->a_type == NEW_ACE_ACCESS_ALLOWED_ACE_TYPE)
+            index1 = 1;
+          else if (ace->a_type == NEW_ACE_ACCESS_DENIED_ACE_TYPE)
+            index1 = 0;
+          else
+            return 1;
+
+          if (ace->a_flags == NEW_ACE_OWNER)
+            index2 = 0;
+          else if (ace->a_flags == (NEW_ACE_GROUP | NEW_ACE_IDENTIFIER_GROUP))
+            index2 = 2;
+          else if (ace->a_flags == NEW_ACE_EVERYONE)
+            index2 = 4;
+          else
+            return 1;
+
+          access_masks[index1 + index2] |= ace->a_access_mask;
+        }
+
+      /* The same bit shouldn't be both allowed and denied.  */
+      if (access_masks[0] & access_masks[1])
+        return 1;
+      if (access_masks[2] & access_masks[3])
+        return 1;
+      if (access_masks[4] & access_masks[5])
+        return 1;
+
+      /* Check minimum masks.  */
+      if ((NEW_ACE_WRITE_NAMED_ATTRS
+           | NEW_ACE_WRITE_ATTRIBUTES
+           | NEW_ACE_WRITE_ACL
+           | NEW_ACE_WRITE_OWNER)
+          & ~ access_masks[1])
+        return 1;
+      access_masks[1] &= ~(NEW_ACE_WRITE_NAMED_ATTRS
+                           | NEW_ACE_WRITE_ATTRIBUTES
+                           | NEW_ACE_WRITE_ACL
+                           | NEW_ACE_WRITE_OWNER);
+      if ((NEW_ACE_READ_NAMED_ATTRS
+           | NEW_ACE_READ_ATTRIBUTES
+           | NEW_ACE_READ_ACL
+           | NEW_ACE_SYNCHRONIZE)
+          & ~ access_masks[5])
+        return 1;
+      access_masks[5] &= ~(NEW_ACE_READ_NAMED_ATTRS
+                           | NEW_ACE_READ_ATTRIBUTES
+                           | NEW_ACE_READ_ACL
+                           | NEW_ACE_SYNCHRONIZE);
+
+      /* Check the allowed or denied bits.  */
+      switch ((access_masks[0] | access_masks[1])
+              & ~(NEW_ACE_READ_NAMED_ATTRS
+                  | NEW_ACE_READ_ATTRIBUTES
+                  | NEW_ACE_READ_ACL
+                  | NEW_ACE_SYNCHRONIZE))
+        {
+        case 0:
+        case NEW_ACE_READ_DATA:
+        case                     NEW_ACE_WRITEA_DATA:
+        case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA:
+        case                                           NEW_ACE_EXECUTE:
+        case NEW_ACE_READ_DATA |                       NEW_ACE_EXECUTE:
+        case                     NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+        case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+          break;
+        default:
+          return 1;
+        }
+      switch ((access_masks[2] | access_masks[3])
+              & ~(NEW_ACE_READ_NAMED_ATTRS
+                  | NEW_ACE_READ_ATTRIBUTES
+                  | NEW_ACE_READ_ACL
+                  | NEW_ACE_SYNCHRONIZE))
+        {
+        case 0:
+        case NEW_ACE_READ_DATA:
+        case                     NEW_ACE_WRITEA_DATA:
+        case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA:
+        case                                           NEW_ACE_EXECUTE:
+        case NEW_ACE_READ_DATA |                       NEW_ACE_EXECUTE:
+        case                     NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+        case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+          break;
+        default:
+          return 1;
+        }
+      switch ((access_masks[4] | access_masks[5])
+              & ~(NEW_ACE_WRITE_NAMED_ATTRS
+                  | NEW_ACE_WRITE_ATTRIBUTES
+                  | NEW_ACE_WRITE_ACL
+                  | NEW_ACE_WRITE_OWNER))
+        {
+        case 0:
+        case NEW_ACE_READ_DATA:
+        case                     NEW_ACE_WRITEA_DATA:
+        case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA:
+        case                                           NEW_ACE_EXECUTE:
+        case NEW_ACE_READ_DATA |                       NEW_ACE_EXECUTE:
+        case                     NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+        case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+          break;
+        default:
+          return 1;
+        }
+
+      /* Check that the NEW_ACE_WRITE_DATA and NEW_ACE_APPEND_DATA bits are
+         either both allowed or both denied.  */
+      if (((access_masks[0] & NEW_ACE_WRITE_DATA) != 0)
+          != ((access_masks[0] & NEW_ACE_APPEND_DATA) != 0))
+        return 1;
+      if (((access_masks[2] & NEW_ACE_WRITE_DATA) != 0)
+          != ((access_masks[2] & NEW_ACE_APPEND_DATA) != 0))
+        return 1;
+      if (((access_masks[4] & NEW_ACE_WRITE_DATA) != 0)
+          != ((access_masks[4] & NEW_ACE_APPEND_DATA) != 0))
+        return 1;
+    }
+
+  return 0;
+}
+
+# endif
+
+#elif USE_ACL && HAVE_GETACL /* HP-UX */
+
+/* Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+int
+acl_nontrivial (int count, struct acl_entry *entries)
+{
+  int i;
+
+  if (count > 3)
+    return 1;
+
+  for (i = 0; i < count; i++)
+    {
+      struct acl_entry *ace = &entries[i];
+
+      if (ace->uid != ACL_NSUSER && ace->gid != ACL_NSGROUP)
+        return 1;
+    }
+  return 0;
+}
+
+# if HAVE_ACLV_H /* HP-UX >= 11.11 */
+
+/* Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+int
+aclv_nontrivial (int count, struct acl *entries)
+{
+  int i;
+
+  for (i = 0; i < count; i++)
+    {
+      struct acl *ace = &entries[i];
+
+      /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
+         If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
+         We don't need to check ace->a_id in these cases.  */
+      if (!(ace->a_type == USER_OBJ /* no need to check ace->a_id here */
+            || ace->a_type == GROUP_OBJ /* no need to check ace->a_id here */
+            || ace->a_type == CLASS_OBJ
+            || ace->a_type == OTHER_OBJ))
+        return 1;
+    }
+  return 0;
+}
+
+# endif
+
+#elif USE_ACL && (HAVE_ACLX_GET || HAVE_STATACL) /* AIX */
+
+/* Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+int
+acl_nontrivial (struct acl *a)
+{
+  /* The normal way to iterate through an ACL is like this:
+       struct acl_entry *ace;
+       for (ace = a->acl_ext; ace != acl_last (a); ace = acl_nxt (ace))
+         {
+           struct ace_id *aei;
+           switch (ace->ace_type)
+             {
+             case ACC_PERMIT:
+             case ACC_DENY:
+             case ACC_SPECIFY:
+               ...;
+             }
+           for (aei = ace->ace_id; aei != id_last (ace); aei = id_nxt (aei))
+             ...
+         }
+   */
+  return (acl_last (a) != a->acl_ext ? 1 : 0);
+}
+
+# if HAVE_ACLX_GET && defined ACL_AIX_WIP /* newer AIX */
+
+/* Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+int
+acl_nfs4_nontrivial (nfs4_acl_int_t *a)
+{
+#  if 1 /* let's try this first */
+  return (a->aclEntryN > 0 ? 1 : 0);
+#  else
+  int count = a->aclEntryN;
+  int i;
+
+  for (i = 0; i < count; i++)
+    {
+      nfs4_ace_int_t *ace = &a->aclEntry[i];
+
+      if (!((ace->flags & ACE4_ID_SPECIAL) != 0
+            && (ace->aceWho.special_whoid == ACE4_WHO_OWNER
+                || ace->aceWho.special_whoid == ACE4_WHO_GROUP
+                || ace->aceWho.special_whoid == ACE4_WHO_EVERYONE)
+            && ace->aceType == ACE4_ACCESS_ALLOWED_ACE_TYPE
+            && ace->aceFlags == 0
+            && (ace->aceMask & ~(ACE4_READ_DATA | ACE4_LIST_DIRECTORY
+                                 | ACE4_WRITE_DATA | ACE4_ADD_FILE
+                                 | ACE4_EXECUTE)) == 0))
+        return 1;
+    }
+  return 0;
+#  endif
+}
+
+# endif
+
+#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
+
+/* Test an ACL retrieved with ACL_GET.
+   Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+int
+acl_nontrivial (int count, struct acl *entries)
+{
+  int i;
+
+  for (i = 0; i < count; i++)
+    {
+      struct acl *ace = &entries[i];
+
+      /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
+         If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
+         We don't need to check ace->a_id in these cases.  */
+      if (!(ace->a_type == USER_OBJ /* no need to check ace->a_id here */
+            || ace->a_type == GROUP_OBJ /* no need to check ace->a_id here */
+            || ace->a_type == CLASS_OBJ
+            || ace->a_type == OTHER_OBJ))
+        return 1;
+    }
+  return 0;
+}
+
+#endif
+
+void
+free_permission_context (struct permission_context *ctx)
+{
+#if USE_ACL
+# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+  if (ctx->acl)
+    acl_free (ctx->acl);
+#  if !HAVE_ACL_TYPE_EXTENDED
+  if (ctx->default_acl)
+    acl_free (ctx->default_acl);
+#  endif
+
+# elif defined GETACL /* Solaris, Cygwin < 2.5 */
+  free (ctx->entries);
+#  ifdef ACE_GETACL
+  free (ctx->ace_entries);
+#  endif
+
+# elif HAVE_GETACL /* HP-UX */
+
+#  if HAVE_ACLV_H
+#  endif
+
+# elif HAVE_STATACL /* older AIX */
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+
+# endif
+#endif
+}
deleted file mode 120000 (symlink)
index bf994b91de70db7cdb641f86e18c91e1c23529b9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/acl-internal.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ef1f84dc243d6d28fd09d709431f427b275d19ab
--- /dev/null
@@ -0,0 +1,300 @@
+/* Internal implementation of access control lists.  -*- coding: utf-8 -*-
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible.  */
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include "acl.h"
+
+#include <stdlib.h>
+
+/* All systems define the ACL related API in <sys/acl.h>.  */
+#if HAVE_SYS_ACL_H
+# include <sys/acl.h>
+#endif
+#if defined HAVE_FACL && ! defined GETACLCNT && defined ACL_CNT
+# define GETACLCNT ACL_CNT
+#endif
+
+/* On Linux and Cygwin >= 2.5, additional ACL related API is available in
+   <acl/libacl.h>.  */
+#ifdef HAVE_ACL_LIBACL_H
+# include <acl/libacl.h>
+#endif
+
+/* On HP-UX >= 11.11, additional ACL API is available in <aclv.h>.  */
+#if HAVE_ACLV_H
+# include <sys/types.h>
+# include <aclv.h>
+/* HP-UX 11.11 lacks these declarations.  */
+extern int acl (char *, int, int, struct acl *);
+extern int aclsort (int, int, struct acl *);
+#endif
+
+#include <errno.h>
+
+#include <limits.h>
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
+#ifndef HAVE_FCHMOD
+# define HAVE_FCHMOD false
+# define fchmod(fd, mode) (-1)
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef ACL_INTERNAL_INLINE
+# define ACL_INTERNAL_INLINE _GL_INLINE
+#endif
+
+#if USE_ACL
+
+# if HAVE_ACL_GET_FILE
+/* POSIX 1003.1e (draft 17 -- abandoned) specific version.  */
+/* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+
+#  ifndef MIN_ACL_ENTRIES
+#   define MIN_ACL_ENTRIES 4
+#  endif
+
+/* POSIX 1003.1e (draft 17) */
+#  ifdef HAVE_ACL_GET_FD
+/* Most platforms have a 1-argument acl_get_fd, only OSF/1 has a 2-argument
+   macro(!).  */
+#   if HAVE_ACL_FREE_TEXT /* OSF/1 */
+ACL_INTERNAL_INLINE acl_t
+rpl_acl_get_fd (int fd)
+{
+  return acl_get_fd (fd, ACL_TYPE_ACCESS);
+}
+#    undef acl_get_fd
+#    define acl_get_fd rpl_acl_get_fd
+#   endif
+#  else
+#   define HAVE_ACL_GET_FD false
+#   undef acl_get_fd
+#   define acl_get_fd(fd) (NULL)
+#  endif
+
+/* POSIX 1003.1e (draft 17) */
+#  ifdef HAVE_ACL_SET_FD
+/* Most platforms have a 2-argument acl_set_fd, only OSF/1 has a 3-argument
+   macro(!).  */
+#   if HAVE_ACL_FREE_TEXT /* OSF/1 */
+ACL_INTERNAL_INLINE int
+rpl_acl_set_fd (int fd, acl_t acl)
+{
+  return acl_set_fd (fd, ACL_TYPE_ACCESS, acl);
+}
+#    undef acl_set_fd
+#    define acl_set_fd rpl_acl_set_fd
+#   endif
+#  else
+#   define HAVE_ACL_SET_FD false
+#   undef acl_set_fd
+#   define acl_set_fd(fd, acl) (-1)
+#  endif
+
+/* POSIX 1003.1e (draft 13) */
+#  if ! HAVE_ACL_FREE_TEXT
+#   define acl_free_text(buf) acl_free (buf)
+#  endif
+
+/* Linux-specific */
+/* Cygwin >= 2.5 implements this function, but it returns 1 for all
+   directories, thus is unusable.  */
+#  if !defined HAVE_ACL_EXTENDED_FILE || defined __CYGWIN__
+#   undef HAVE_ACL_EXTENDED_FILE
+#   define HAVE_ACL_EXTENDED_FILE false
+#   define acl_extended_file(name) (-1)
+#  endif
+
+#  if ! defined HAVE_ACL_FROM_MODE && ! defined HAVE_ACL_FROM_TEXT
+#   define acl_from_mode (NULL)
+#  endif
+
+/* Set to 0 if a file's mode is stored independently from the ACL.  */
+#  if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi /* Mac OS X, IRIX */
+#   define MODE_INSIDE_ACL 0
+#  endif
+
+/* Return the number of entries in ACL.
+   Return -1 and set errno upon failure to determine it.  */
+/* Define a replacement for acl_entries if needed. (Only Linux has it.)  */
+#  if !HAVE_ACL_ENTRIES
+#   define acl_entries rpl_acl_entries
+extern int acl_entries (acl_t);
+#  endif
+
+#  if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
+   Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial.  */
+extern int acl_extended_nontrivial (acl_t);
+#  else
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
+   Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
+   Return -1 and set errno upon failure to determine it.  */
+extern int acl_access_nontrivial (acl_t);
+
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_DEFAULT.
+   Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
+   Return -1 and set errno upon failure to determine it.  */
+extern int acl_default_nontrivial (acl_t);
+#  endif
+
+# elif HAVE_FACL && defined GETACL /* Solaris, Cygwin < 2.5, not HP-UX */
+
+/* Set to 0 if a file's mode is stored independently from the ACL.  */
+#  if defined __CYGWIN__ /* Cygwin */
+#   define MODE_INSIDE_ACL 0
+#  endif
+
+/* Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+extern int acl_nontrivial (int count, aclent_t *entries) _GL_ATTRIBUTE_PURE;
+
+#  ifdef ACE_GETACL /* Solaris 10 */
+
+/* Test an ACL retrieved with ACE_GETACL.
+   Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+extern int acl_ace_nontrivial (int count, ace_t *entries) _GL_ATTRIBUTE_PURE;
+
+/* Definitions for when the built executable is executed on Solaris 10
+   (newer version) or Solaris 11.  */
+/* For a_type.  */
+#   define OLD_ALLOW 0
+#   define OLD_DENY  1
+#   define NEW_ACE_ACCESS_ALLOWED_ACE_TYPE 0 /* replaces ALLOW */
+#   define NEW_ACE_ACCESS_DENIED_ACE_TYPE  1 /* replaces DENY */
+/* For a_flags.  */
+#   define OLD_ACE_OWNER            0x0100
+#   define OLD_ACE_GROUP            0x0200
+#   define OLD_ACE_OTHER            0x0400
+#   define NEW_ACE_OWNER            0x1000
+#   define NEW_ACE_GROUP            0x2000
+#   define NEW_ACE_IDENTIFIER_GROUP 0x0040
+#   define NEW_ACE_EVERYONE         0x4000
+/* For a_access_mask.  */
+#   define NEW_ACE_READ_DATA         0x001 /* corresponds to 'r' */
+#   define NEW_ACE_WRITE_DATA        0x002 /* corresponds to 'w' */
+#   define NEW_ACE_APPEND_DATA       0x004
+#   define NEW_ACE_READ_NAMED_ATTRS  0x008
+#   define NEW_ACE_WRITE_NAMED_ATTRS 0x010
+#   define NEW_ACE_EXECUTE           0x020
+#   define NEW_ACE_DELETE_CHILD      0x040
+#   define NEW_ACE_READ_ATTRIBUTES   0x080
+#   define NEW_ACE_WRITE_ATTRIBUTES  0x100
+#   define NEW_ACE_DELETE          0x10000
+#   define NEW_ACE_READ_ACL        0x20000
+#   define NEW_ACE_WRITE_ACL       0x40000
+#   define NEW_ACE_WRITE_OWNER     0x80000
+#   define NEW_ACE_SYNCHRONIZE    0x100000
+
+#  endif
+
+# elif HAVE_GETACL /* HP-UX */
+
+/* Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+extern int acl_nontrivial (int count, struct acl_entry *entries);
+
+#  if HAVE_ACLV_H /* HP-UX >= 11.11 */
+
+/* Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+extern int aclv_nontrivial (int count, struct acl *entries);
+
+#  endif
+
+# elif HAVE_ACLX_GET && 0 /* AIX */
+
+/* TODO */
+
+# elif HAVE_STATACL /* older AIX */
+
+/* Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+extern int acl_nontrivial (struct acl *a);
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+
+/* Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
+extern int acl_nontrivial (int count, struct acl *entries);
+
+# endif
+
+/* Set to 1 if a file's mode is implicit by the ACL.  */
+# ifndef MODE_INSIDE_ACL
+#  define MODE_INSIDE_ACL 1
+# endif
+
+#endif
+
+struct permission_context {
+  mode_t mode;
+#if USE_ACL
+# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+  acl_t acl;
+#  if !HAVE_ACL_TYPE_EXTENDED
+  acl_t default_acl;
+#  endif
+  bool acls_not_supported;
+
+# elif defined GETACL /* Solaris, Cygwin < 2.5 */
+  int count;
+  aclent_t *entries;
+#  ifdef ACE_GETACL
+  int ace_count;
+  ace_t *ace_entries;
+#  endif
+
+# elif HAVE_GETACL /* HP-UX */
+  struct acl_entry entries[NACLENTRIES];
+  int count;
+#  if HAVE_ACLV_H
+  struct acl aclv_entries[NACLVENTRIES];
+  int aclv_count;
+#  endif
+
+# elif HAVE_STATACL /* older AIX */
+  union { struct acl a; char room[4096]; } u;
+  bool have_u;
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+  struct acl entries[NACLENTRIES];
+  int count;
+
+# endif
+#endif
+};
+
+int get_permissions (const char *, int, mode_t, struct permission_context *);
+int set_permissions (struct permission_context *, const char *, int);
+void free_permission_context (struct permission_context *);
+
+_GL_INLINE_HEADER_END
deleted file mode 120000 (symlink)
index 0a85328b1c602ed0385109d0f10724e9465ee81a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/acl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a3aeb8fc86ae53e4b0ec5d0639d4579e46650d44
--- /dev/null
@@ -0,0 +1,39 @@
+/* acl.c - access control lists
+
+   Copyright (C) 2002, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert.  */
+
+#ifndef _GL_ACL_H
+#define _GL_ACL_H 1
+
+/* This file uses _GL_ATTRIBUTE_CONST.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+bool acl_errno_valid (int) _GL_ATTRIBUTE_CONST;
+int file_has_acl (char const *, struct stat const *);
+int qset_acl (char const *, int, mode_t);
+int set_acl (char const *, int, mode_t);
+int qcopy_acl (char const *, int, char const *, int, mode_t);
+int copy_acl (char const *, int, char const *, int, mode_t);
+int chmod_or_fchmod (char const *, int, mode_t);
+
+#endif
deleted file mode 120000 (symlink)
index 384fb036cb5adb434db3ba5aaf28cbfa8ab77b14..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/acl_entries.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..81338323f5c5936fe8f2b8f662a56de06c947e93
--- /dev/null
@@ -0,0 +1,75 @@
+/* Return the number of entries in an ACL.
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert and Andreas Gruenbacher.  */
+
+#include <config.h>
+
+#include "acl-internal.h"
+
+/* This file assumes POSIX-draft like ACLs
+   (Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5).  */
+
+/* Return the number of entries in ACL.
+   Return -1 and set errno upon failure to determine it.  */
+
+int
+acl_entries (acl_t acl)
+{
+  int count = 0;
+
+  if (acl != NULL)
+    {
+#if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, Mac OS X, Cygwin >= 2.5 */
+# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
+      /* acl_get_entry returns 0 when it successfully fetches an entry,
+         and -1/EINVAL at the end.  */
+      acl_entry_t ace;
+      int got_one;
+
+      for (got_one = acl_get_entry (acl, ACL_FIRST_ENTRY, &ace);
+           got_one >= 0;
+           got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace))
+        count++;
+# else /* Linux, FreeBSD, Cygwin >= 2.5 */
+      /* acl_get_entry returns 1 when it successfully fetches an entry,
+         and 0 at the end.  */
+      acl_entry_t ace;
+      int got_one;
+
+      for (got_one = acl_get_entry (acl, ACL_FIRST_ENTRY, &ace);
+           got_one > 0;
+           got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace))
+        count++;
+      if (got_one < 0)
+        return -1;
+# endif
+#else /* IRIX, Tru64 */
+# if HAVE_ACL_TO_SHORT_TEXT /* IRIX */
+      /* Don't use acl_get_entry: it is undocumented.  */
+      count = acl->acl_cnt;
+# endif
+# if HAVE_ACL_FREE_TEXT /* Tru64 */
+      /* Don't use acl_get_entry: it takes only one argument and does not
+         work.  */
+      count = acl->acl_num;
+# endif
+#endif
+    }
+
+  return count;
+}
deleted file mode 120000 (symlink)
index 32e1607f9fae343d106ba61d29e9398f50d733c9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/af_alg.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6fd08c287e6c88ea05d13a9130b75265eea406d5
--- /dev/null
@@ -0,0 +1,213 @@
+/* af_alg.c - Compute message digests from file streams and buffers.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Matteo Croce <mcroce@redhat.com>, 2018.  */
+
+#include <config.h>
+
+#include "af_alg.h"
+
+#if USE_LINUX_CRYPTO_API
+
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <linux/if_alg.h>
+#include <sys/stat.h>
+#include <sys/sendfile.h>
+#include <sys/socket.h>
+
+#include "sys-limits.h"
+
+#define BLOCKSIZE 32768
+
+/* Return a newly created socket for ALG.
+   On error, return a negative error number.  */
+static int
+alg_socket (char const *alg)
+{
+  struct sockaddr_alg salg = {
+    .salg_family = AF_ALG,
+    .salg_type = "hash",
+  };
+  /* Copy alg into salg.salg_name, without calling strcpy nor strlen.  */
+  for (size_t i = 0; (salg.salg_name[i] = alg[i]) != '\0'; i++)
+    if (i == sizeof salg.salg_name - 1)
+      /* alg is too long.  */
+      return -EINVAL;
+
+  int cfd = socket (AF_ALG, SOCK_SEQPACKET | SOCK_CLOEXEC, 0);
+  if (cfd < 0)
+    return -EAFNOSUPPORT;
+  int ofd = (bind (cfd, (struct sockaddr *) &salg, sizeof salg) == 0
+             ? accept4 (cfd, NULL, 0, SOCK_CLOEXEC)
+             : -1);
+  close (cfd);
+  return ofd < 0 ? -EAFNOSUPPORT : ofd;
+}
+
+int
+afalg_buffer (const char *buffer, size_t len, const char *alg,
+              void *resblock, ssize_t hashlen)
+{
+  /* On Linux < 4.9, the value for an empty stream is wrong (all zeroes).
+     See <https://patchwork.kernel.org/patch/9308641/>.
+     This was not fixed properly until November 2016,
+     see <https://patchwork.kernel.org/patch/9434741/>.  */
+  if (len == 0)
+    return -EAFNOSUPPORT;
+
+  int ofd = alg_socket (alg);
+  if (ofd < 0)
+    return ofd;
+
+  int result;
+
+  for (;;)
+    {
+      ssize_t size = (len > BLOCKSIZE ? BLOCKSIZE : len);
+      if (send (ofd, buffer, size, MSG_MORE) != size)
+        {
+          result = -EAFNOSUPPORT;
+          break;
+        }
+      buffer += size;
+      len -= size;
+      if (len == 0)
+        {
+          result = read (ofd, resblock, hashlen) == hashlen ? 0 : -EAFNOSUPPORT;
+          break;
+        }
+    }
+
+  close (ofd);
+  return result;
+}
+
+int
+afalg_stream (FILE *stream, const char *alg,
+              void *resblock, ssize_t hashlen)
+{
+  int ofd = alg_socket (alg);
+  if (ofd < 0)
+    return ofd;
+
+  /* If STREAM's size is known and nonzero and not too large, attempt
+     sendfile to pipe the data.  The nonzero restriction avoids issues
+     with /proc files that pretend to be empty, and lets the classic
+     read-write loop work around an empty-input bug noted below.  */
+  int fd = fileno (stream);
+  int result;
+  struct stat st;
+  off_t off = ftello (stream);
+  if (0 <= off && fstat (fd, &st) == 0
+      && (S_ISREG (st.st_mode) || S_TYPEISSHM (&st) || S_TYPEISTMO (&st))
+      && off < st.st_size && st.st_size - off < SYS_BUFSIZE_MAX)
+    {
+      /* Make sure the offset of fileno (stream) reflects how many bytes
+         have been read from stream before this function got invoked.
+         Note: fflush on an input stream after ungetc does not work as expected
+         on some platforms.  Therefore this situation is not supported here.  */
+      if (fflush (stream))
+        result = -EIO;
+      else
+        {
+          off_t nbytes = st.st_size - off;
+          if (sendfile (ofd, fd, &off, nbytes) == nbytes)
+            {
+              if (read (ofd, resblock, hashlen) == hashlen)
+                {
+                  /* The input buffers of stream are no longer valid.  */
+                  if (lseek (fd, off, SEEK_SET) != (off_t)-1)
+                    result = 0;
+                  else
+                    /* The file position of fd has not changed.  */
+                    result = -EAFNOSUPPORT;
+                }
+              else
+                /* The file position of fd has not changed.  */
+                result = -EAFNOSUPPORT;
+            }
+          else
+            /* The file position of fd has not changed.  */
+            result = -EAFNOSUPPORT;
+       }
+    }
+  else
+    {
+      /* sendfile not possible, do a classic read-write loop.  */
+
+      /* Number of bytes to seek (backwards) in case of error.  */
+      off_t nseek = 0;
+
+      for (;;)
+        {
+          char buf[BLOCKSIZE];
+          /* When the stream is not seekable, start with a single-byte block,
+             so that we can use ungetc() in the case that send() fails.  */
+          size_t blocksize = (nseek == 0 && off < 0 ? 1 : BLOCKSIZE);
+          ssize_t size = fread (buf, 1, blocksize, stream);
+          if (size == 0)
+            {
+              /* On Linux < 4.9, the value for an empty stream is wrong (all 0).
+                 See <https://patchwork.kernel.org/patch/9308641/>.
+                 This was not fixed properly until November 2016,
+                 see <https://patchwork.kernel.org/patch/9434741/>.  */
+              result = ferror (stream) ? -EIO : nseek == 0 ? -EAFNOSUPPORT : 0;
+              break;
+            }
+          nseek -= size;
+          if (send (ofd, buf, size, MSG_MORE) != size)
+            {
+              if (nseek == -1)
+                {
+                  /* 1 byte of pushback buffer is guaranteed on stream, even
+                     if stream is not seekable.  */
+                  ungetc ((unsigned char) buf[0], stream);
+                  result = -EAFNOSUPPORT;
+                }
+              else if (fseeko (stream, nseek, SEEK_CUR) == 0)
+                /* The position of stream has been restored.  */
+                result = -EAFNOSUPPORT;
+              else
+                result = -EIO;
+              break;
+            }
+
+          /* Don't assume that EOF is sticky. See:
+             <https://sourceware.org/bugzilla/show_bug.cgi?id=19476>.  */
+          if (feof (stream))
+            {
+              result = 0;
+              break;
+            }
+        }
+
+      if (result == 0 && read (ofd, resblock, hashlen) != hashlen)
+        {
+          if (nseek == 0 || fseeko (stream, nseek, SEEK_CUR) == 0)
+            /* The position of stream has been restored.  */
+            result = -EAFNOSUPPORT;
+          else
+            result = -EIO;
+        }
+    }
+  close (ofd);
+  return result;
+}
+
+#endif
deleted file mode 120000 (symlink)
index ee6d4feb3a92bed9dcfdf56949aa1bc6058b6bb7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/af_alg.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ed933e1208ddcc35d33844c2670952e200ad6bbc
--- /dev/null
@@ -0,0 +1,115 @@
+/* af_alg.h - Compute message digests from file streams and buffers.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Matteo Croce <mcroce@redhat.com>, 2018.
+   Documentation by Bruno Haible <bruno@clisp.org>, 2018.  */
+
+/* Declare specific functions for computing message digests
+   using the Linux kernel crypto API, if available.  This kernel API gives
+   access to specialized crypto instructions (that would also be available
+   in user space) or to crypto devices (not directly available in user space).
+
+   For a more complete set of facilities that use the Linux kernel crypto API,
+   look at libkcapi.  */
+
+#ifndef AF_ALG_H
+# define AF_ALG_H 1
+
+# include <stdio.h>
+# include <errno.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if USE_LINUX_CRYPTO_API
+
+/* Compute a message digest of a memory region.
+
+   The memory region starts at BUFFER and is LEN bytes long.
+
+   ALG is the message digest algorithm; see the file /proc/crypto.
+
+   RESBLOCK points to a block of HASHLEN bytes, for the result.
+   HASHLEN must be the length of the message digest, in bytes, in particular:
+
+      alg    | hashlen
+      -------+--------
+      md5    | 16
+      sha1   | 20
+      sha224 | 28
+      sha256 | 32
+      sha384 | 48
+      sha512 | 64
+
+   If successful, fill RESBLOCK and return 0.
+   Upon failure, return a negated error number.  */
+int
+afalg_buffer (const char *buffer, size_t len, const char *alg,
+              void *resblock, ssize_t hashlen);
+
+/* Compute a message digest of data read from STREAM.
+
+   STREAM is an open file stream.  The last operation on STREAM should
+   not be 'ungetc', and if STREAM is also open for writing it should
+   have been fflushed since its last write.  Read from the current
+   position to the end of STREAM.  Handle regular files efficiently.
+
+   ALG is the message digest algorithm; see the file /proc/crypto.
+
+   RESBLOCK points to a block of HASHLEN bytes, for the result.
+   HASHLEN must be the length of the message digest, in bytes, in particular:
+
+      alg    | hashlen
+      -------+--------
+      md5    | 16
+      sha1   | 20
+      sha224 | 28
+      sha256 | 32
+      sha384 | 48
+      sha512 | 64
+
+   If successful, fill RESBLOCK and return 0.
+   Upon failure, return a negated error number.
+   Unless returning 0 or -EIO, restore STREAM's file position so that
+   the caller can fall back on some other method.  */
+int
+afalg_stream (FILE *stream, const char *alg,
+              void *resblock, ssize_t hashlen);
+
+# else
+
+static inline int
+afalg_buffer (const char *buffer, size_t len, const char *alg,
+              void *resblock, ssize_t hashlen)
+{
+  return -EAFNOSUPPORT;
+}
+
+static inline int
+afalg_stream (FILE *stream, const char *alg,
+              void *resblock, ssize_t hashlen)
+{
+  return -EAFNOSUPPORT;
+}
+
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif /* AF_ALG_H */
deleted file mode 120000 (symlink)
index 581646fbfe497c77577858513030ad402f4d055a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/alignalloc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9d74f08c0b7e13155e86c60965d91ad619d5106e
--- /dev/null
@@ -0,0 +1,119 @@
+/* aligned memory allocation
+
+   Copyright 2022-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#define ALIGNALLOC_INLINE _GL_EXTERN_INLINE
+#include "alignalloc.h"
+
+#include <limits.h>
+#include <stdckdint.h>
+#include <stdint.h>
+
+#if !ALIGNALLOC_VIA_ALIGNED_ALLOC
+# if HAVE_POSIX_MEMALIGN
+
+/* posix_memalign requires the alignment to be a power-of-two multiple of
+   sizeof (void *), whereas alignalloc requires it to be a power of two.
+   To make it OK for the latter to call the former, check that
+   sizeof (void *) is a power of two, which is true on all known platforms.
+   This check is here rather than in alignalloc.h to save the compiler
+   the trouble of checking it each time alignalloc.h is included.  */
+static_assert (! (sizeof (void *) & (sizeof (void *) - 1)));
+
+# else /* !HAVE_POSIX_MEMALIGN */
+
+/* Return P aligned down to ALIGNMENT, which should be a power of two.  */
+
+static void *
+align_down (void *p, idx_t alignment)
+{
+  char *c = p;
+  return c - ((uintptr_t) p & (alignment - 1));
+}
+
+/* If alignalloc returned R and the base of the originally-allocated
+   storage is less than R - UCHAR_MAX, return the address of a pointer
+   holding the base of the originally-allocated storage.  */
+
+static void **
+address_of_pointer_to_malloced (unsigned char *r)
+{
+  /* The pointer P is located at the highest address A such that A is
+     aligned for pointers, and A + sizeof P < R so that there is room
+     for a 0 byte at R - 1.  This approach assumes UCHAR_MAX is large
+     enough so that there is room for P; although true on all
+     plausible platforms, check the assumption to be safe.  */
+  static_assert (sizeof (void *) + alignof (void *) - 1 <= UCHAR_MAX);
+
+  return align_down (r - 1 - sizeof (void *), alignof (void *));
+}
+
+/* Return an ALIGNMENT-aligned pointer to new storage of size SIZE,
+   or a null pointer (setting errno) if memory is exhausted.
+   ALIGNMENT must be a power of two.
+   If SIZE is zero, on success return a unique pointer each time.
+   To free storage later, call alignfree.  */
+
+void *
+alignalloc (idx_t alignment, idx_t size)
+{
+  /* malloc (ALIGNMENT + SIZE); if it succeeds, there must be at least
+     one byte available before the returned pointer.  It's OK if
+     ALIGNMENT + SIZE fits in size_t but not idx_t.  */
+
+  size_t malloc_size;
+  unsigned char *q;
+  if (ckd_add (&malloc_size, size, alignment)
+      || ! (q = malloc (malloc_size)))
+    {
+      errno = ENOMEM;
+      return NULL;
+    }
+
+  unsigned char *r = align_down (q + alignment, alignment);
+  idx_t offset = r - q;
+
+  if (offset <= UCHAR_MAX)
+    r[-1] = offset;
+  else
+    {
+      r[-1] = 0;
+      *address_of_pointer_to_malloced (r) = q;
+    }
+
+  return r;
+}
+
+/* Free storage allocated via alignalloc.  Do nothing if PTR is null.  */
+
+void
+alignfree (void *ptr)
+{
+  if (ptr)
+    {
+      unsigned char *r = ptr;
+      unsigned char offset = r[-1];
+      void *q = offset ? r - offset : *address_of_pointer_to_malloced (r);
+      free (q);
+    }
+}
+
+# endif /* ! HAVE_POSIX_MEMALIGN */
+#endif /* ! ALIGNALLOC_VIA_ALIGNED_ALLOC */
deleted file mode 120000 (symlink)
index 5945373fa8ce02f685d7e8e5d9c8105c2d8b1c31..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/alignalloc.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d33f62e29cefe32ae01f42d94c358ae7cce6342d
--- /dev/null
@@ -0,0 +1,123 @@
+/* aligned memory allocation
+
+   Copyright 2022-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef ALIGNALLOC_H_
+#define ALIGNALLOC_H_
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_ALLOC_SIZE,
+   _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_RETURNS_NONNULL, HAVE_POSIX_MEMALIGN.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include "idx.h"
+#if defined __CHERI_PURE_CAPABILITY__
+# include <cheri.h>
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef ALIGNALLOC_INLINE
+# define ALIGNALLOC_INLINE _GL_INLINE
+#endif
+
+/* Whether aligned_alloc supports any power-of-two alignment,
+   returns a nonnull pointer for size-zero allocations,
+   and sets errno on failure.  */
+#if 2 < __GLIBC__ + (16 <= __GLIBC_MINOR__)
+# define ALIGNALLOC_VIA_ALIGNED_ALLOC 1
+#else
+# define ALIGNALLOC_VIA_ALIGNED_ALLOC 0
+#endif
+
+/* Work around AddressSanitizer bug.
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104262
+   https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20220124/1001910.html
+   */
+#ifdef __SANITIZE_ADDRESS__
+# undef ALIGNALLOC_VIA_ALIGNED_ALLOC
+# define ALIGNALLOC_VIA_ALIGNED_ALLOC 0
+#endif
+#ifdef __has_feature
+# if __has_feature (address_sanitizer)
+#  undef ALIGNALLOC_VIA_ALIGNED_ALLOC
+#  define ALIGNALLOC_VIA_ALIGNED_ALLOC 0
+# endif
+#endif
+
+#if ALIGNALLOC_VIA_ALIGNED_ALLOC || HAVE_POSIX_MEMALIGN
+
+/* Free storage allocated via alignalloc.  Do nothing if PTR is null.  */
+
+ALIGNALLOC_INLINE void
+alignfree (void *ptr)
+{
+  free (ptr);
+}
+
+/* Return an ALIGNMENT-aligned pointer to new storage of size SIZE,
+   or a null pointer (setting errno) if memory is exhausted.
+   ALIGNMENT must be a power of two.
+   If SIZE is zero, on success return a unique pointer each time.
+   To free storage later, call alignfree.  */
+
+ALIGNALLOC_INLINE
+_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2))
+/* _GL_ATTRIBUTE_DEALLOC (alignfree, 1) */
+void *
+alignalloc (idx_t alignment, idx_t size)
+{
+  if ((size_t) -1 < alignment)
+    alignment = (size_t) -1;
+  if ((size_t) -1 < size)
+    size = (size_t) -1;
+
+# if ALIGNALLOC_VIA_ALIGNED_ALLOC
+  return aligned_alloc (alignment, size);
+# else
+  void *ptr = NULL;
+  if (alignment < sizeof (void *))
+    alignment = sizeof (void *);
+  errno = posix_memalign (&ptr, alignment, size | !size);
+#  if defined __CHERI_PURE_CAPABILITY__
+  if (ptr != NULL)
+    ptr = cheri_bounds_set (ptr, size);
+#  endif
+  return ptr;
+# endif
+}
+
+#else /* ! (ALIGNALLOC_VIA_ALIGNED_ALLOC || HAVE_POSIX_MEMALIGN) */
+
+void alignfree (void *);
+void *alignalloc (idx_t, idx_t)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2))
+  _GL_ATTRIBUTE_DEALLOC (alignfree, 1);
+
+#endif
+
+/* Like alignalloc, but die instead of returning a null pointer.  */
+void *xalignalloc (idx_t, idx_t)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2))
+  _GL_ATTRIBUTE_RETURNS_NONNULL /* _GL_ATTRIBUTE_DEALLOC (alignfree, 1) */;
+
+_GL_INLINE_HEADER_END
+
+#endif /* !ALIGNALLOC_H_ */
deleted file mode 120000 (symlink)
index dbe687361ec057891e3538de2edfd48044c1a75f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/alignof.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..581aaee9bcfb936faf6229e50c00dec08134f9c0
--- /dev/null
@@ -0,0 +1,56 @@
+/* Determine alignment of types.
+   Copyright (C) 2003-2004, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _ALIGNOF_H
+#define _ALIGNOF_H
+
+/* This file uses alignof.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+/* alignof_slot (TYPE)
+   Determine the alignment of a structure slot (field) of a given type,
+   at compile time.  Note that the result depends on the ABI.
+   This is the same as alignof (TYPE).
+   Note: The result cannot be used as a value for an 'enum' constant,
+   due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc.  */
+#if defined __cplusplus
+  template <class type> struct alignof_helper { char __slot1; type __slot2; };
+# define alignof_slot(type) offsetof (alignof_helper<type>, __slot2)
+#else
+# define alignof_slot(type) alignof (type)
+#endif
+
+/* alignof_type (TYPE)
+   Determine the good alignment of an object of the given type at compile time.
+   Note that this is not necessarily the same as alignof_slot(type).
+   For example, with GNU C on x86 platforms and with clang on Linux/x86:
+   alignof_type(long long) = 8, but alignof_slot(long long) = 4.
+   And alignof_type(double) = 8, but
+   - when -malign-double is not specified:  alignof_slot(double) = 4,
+   - when -malign-double is specified:      alignof_slot(double) = 8.
+   Note: The result cannot be used as a value for an 'enum' constant,
+   due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc.  */
+#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__
+# define alignof_type __alignof__
+#else
+# define alignof_type alignof_slot
+#endif
+
+#endif /* _ALIGNOF_H */
deleted file mode 120000 (symlink)
index 4822857bdb4e21a2a0f3e085ca162d79333ccbf7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/alloca.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5eb16a9ff5c77909268afc7eb74ed2fe3d6dd80e
--- /dev/null
@@ -0,0 +1,167 @@
+/* alloca.c -- allocate automatically reclaimed memory
+   This file is in the public domain.  */
+
+/* (Mostly) portable implementation -- D A Gwyn
+
+   This implementation of the PWB library alloca function,
+   which is used to allocate space off the run-time stack so
+   that it is automatically reclaimed upon procedure exit,
+   was inspired by discussions with J. Q. Johnson of Cornell.
+   J.Otto Tennant <jot@cray.com> contributed the Cray support.
+
+   There are some preprocessor constants that can
+   be defined when compiling for your specific system, for
+   improved efficiency; however, the defaults should be okay.
+
+   The general concept of this implementation is to keep
+   track of all alloca-allocated blocks, and reclaim any
+   that are found to be deeper in the stack than the current
+   invocation.  This heuristic does not reclaim storage as
+   soon as it becomes invalid, but it will do so eventually.
+
+   As a special case, alloca(0) reclaims storage without
+   allocating any.  It is a good idea to use alloca(0) in
+   your main control loop, etc. to force garbage collection.  */
+
+#include <config.h>
+
+#include <alloca.h>
+
+#include <string.h>
+#include <stdlib.h>
+
+/* If compiling with GCC or clang, this file is not needed.  */
+#if !(defined __GNUC__ || defined __clang__)
+
+/* If someone has defined alloca as a macro,
+   there must be some other way alloca is supposed to work.  */
+# ifndef alloca
+
+/* Define STACK_DIRECTION if you know the direction of stack
+   growth for your system; otherwise it will be automatically
+   deduced at run-time.
+
+   STACK_DIRECTION > 0 => grows toward higher addresses
+   STACK_DIRECTION < 0 => grows toward lower addresses
+   STACK_DIRECTION = 0 => direction of growth unknown  */
+
+#  ifndef STACK_DIRECTION
+#   define STACK_DIRECTION      0       /* Direction unknown.  */
+#  endif
+
+#  if STACK_DIRECTION != 0
+
+#   define STACK_DIR    STACK_DIRECTION /* Known at compile-time.  */
+
+#  else /* STACK_DIRECTION == 0; need run-time code.  */
+
+static int stack_dir;           /* 1 or -1 once known.  */
+#   define STACK_DIR    stack_dir
+
+static int
+find_stack_direction (int *addr, int depth)
+{
+  int dir, dummy = 0;
+  if (! addr)
+    addr = &dummy;
+  *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
+  dir = depth ? find_stack_direction (addr, depth - 1) : 0;
+  return dir + dummy;
+}
+
+#  endif /* STACK_DIRECTION == 0 */
+
+/* An "alloca header" is used to:
+   (a) chain together all alloca'ed blocks;
+   (b) keep track of stack depth.
+
+   It is very important that sizeof(header) agree with malloc
+   alignment chunk size.  The following default should work okay.  */
+
+#  ifndef       ALIGN_SIZE
+#   define ALIGN_SIZE   sizeof(double)
+#  endif
+
+typedef union hdr
+{
+  char align[ALIGN_SIZE];       /* To force sizeof(header).  */
+  struct
+    {
+      union hdr *next;          /* For chaining headers.  */
+      char *deep;               /* For stack depth measure.  */
+    } h;
+} header;
+
+static header *last_alloca_header = NULL;       /* -> last alloca header.  */
+
+/* Return a pointer to at least SIZE bytes of storage,
+   which will be automatically reclaimed upon exit from
+   the procedure that called alloca.  Originally, this space
+   was supposed to be taken from the current stack frame of the
+   caller, but that method cannot be made to work for some
+   implementations of C, for example under Gould's UTX/32.  */
+
+void *
+alloca (size_t size)
+{
+  auto char probe;              /* Probes stack depth: */
+  register char *depth = &probe;
+
+#  if STACK_DIRECTION == 0
+  if (STACK_DIR == 0)           /* Unknown growth direction.  */
+    STACK_DIR = find_stack_direction (NULL, (size & 1) + 20);
+#  endif
+
+  /* Reclaim garbage, defined as all alloca'd storage that
+     was allocated from deeper in the stack than currently.  */
+
+  {
+    register header *hp;        /* Traverses linked list.  */
+
+    for (hp = last_alloca_header; hp != NULL;)
+      if ((STACK_DIR > 0 && hp->h.deep > depth)
+          || (STACK_DIR < 0 && hp->h.deep < depth))
+        {
+          register header *np = hp->h.next;
+
+          free (hp);            /* Collect garbage.  */
+
+          hp = np;              /* -> next header.  */
+        }
+      else
+        break;                  /* Rest are not deeper.  */
+
+    last_alloca_header = hp;    /* -> last valid storage.  */
+  }
+
+  if (size == 0)
+    return NULL;                /* No allocation required.  */
+
+  /* Allocate combined header + user data storage.  */
+
+  {
+    /* Address of header.  */
+    register header *new;
+
+    size_t combined_size = sizeof (header) + size;
+    if (combined_size < sizeof (header))
+      memory_full ();
+
+    new = malloc (combined_size);
+
+    if (! new)
+      memory_full ();
+
+    new->h.next = last_alloca_header;
+    new->h.deep = depth;
+
+    last_alloca_header = new;
+
+    /* User storage begins just after header.  */
+
+    return (void *) (new + 1);
+  }
+}
+
+# endif /* no alloca */
+#endif /* not GCC || clang */
deleted file mode 120000 (symlink)
index 4dd6a9891f57df267d50e26836d2dedab03080df..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/alloca.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6aa47df8ec3350b7c639b899a574acb2017d5c5f
--- /dev/null
@@ -0,0 +1,72 @@
+/* Memory allocation on the stack.
+
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2024 Free Software Foundation,
+   Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
+   means there is a real alloca function.  */
+#ifndef _GL_ALLOCA_H
+#define _GL_ALLOCA_H
+
+/* alloca (N) returns a pointer to N bytes of memory
+   allocated on the stack, which will last until the function returns.
+   Use of alloca should be avoided:
+     - inside arguments of function calls - undefined behaviour,
+     - in inline functions - the allocation may actually last until the
+       calling function returns,
+     - for huge N (say, N >= 65536) - you never know how large (or small)
+       the stack is, and when the stack cannot fulfill the memory allocation
+       request, the program just crashes.
+ */
+
+#ifndef alloca
+  /* Some version of mingw have an <alloca.h> that causes trouble when
+     included after 'alloca' gets defined as a macro.  As a workaround,
+     include this <alloca.h> first and define 'alloca' as a macro afterwards
+     if needed.  */
+# if defined __GNUC__ && (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@
+#  include_next <alloca.h>
+# endif
+#endif
+#ifndef alloca
+# if defined __GNUC__ || (__clang_major__ >= 4)
+#  define alloca __builtin_alloca
+# elif defined _AIX
+#  define alloca __alloca
+# elif defined _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# elif defined __DECC && defined __VMS
+#  define alloca __ALLOCA
+# elif defined __TANDEM && defined _TNS_E_TARGET
+#  ifdef  __cplusplus
+extern "C"
+#  endif
+void *_alloca (unsigned short);
+#  pragma intrinsic (_alloca)
+#  define alloca _alloca
+# elif defined __MVS__
+#  include <stdlib.h>
+# else
+#  include <stddef.h>
+#  ifdef  __cplusplus
+extern "C"
+#  endif
+void *alloca (size_t);
+# endif
+#endif
+
+#endif /* _GL_ALLOCA_H */
deleted file mode 120000 (symlink)
index 399b65e8d5cd82e688ee79b6ced2e6431133df9b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/allocator.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..79fffbed14b11fdbc69621e83b1bc34ab85bc2cc
--- /dev/null
@@ -0,0 +1,22 @@
+/* Memory allocators such as malloc+free.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define _GL_USE_STDLIB_ALLOC 1
+#include <config.h>
+#include "allocator.h"
+#include <stdlib.h>
+struct allocator const stdlib_allocator = { malloc, realloc, free, NULL };
deleted file mode 120000 (symlink)
index ca975cb5056ac25a469e764e00c57b53bec1e26f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/allocator.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bb30a3440c2d631b6d130bfd355ee5a79aa7230a
--- /dev/null
@@ -0,0 +1,58 @@
+/* Memory allocators such as malloc+free.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef _GL_ALLOCATOR_H
+#define _GL_ALLOCATOR_H
+
+#include <stddef.h>
+
+/* An object describing a memory allocator family.  */
+
+struct allocator
+{
+  /* Do not use GCC attributes such as __attribute__ ((malloc)) with
+     the function types pointed at by these members, because these
+     attributes do not work with pointers to functions.  See
+     <https://lists.gnu.org/r/bug-gnulib/2011-04/msg00007.html>.  */
+
+  /* Call ALLOCATE to allocate memory, like 'malloc'.  On failure ALLOCATE
+     should return NULL, though not necessarily set errno.  When given
+     a zero size it may return NULL even if successful.  */
+  void *(*allocate) (size_t);
+
+  /* If nonnull, call REALLOCATE to reallocate memory, like 'realloc'.
+     On failure REALLOCATE should return NULL, though not necessarily set
+     errno.  When given a zero size it may return NULL even if
+     successful.  */
+  void *(*reallocate) (void *, size_t);
+
+  /* Call FREE to free memory, like 'free'.  */
+  void (*free) (void *);
+
+  /* If nonnull, call DIE (SIZE) if MALLOC (SIZE) or REALLOC (...,
+     SIZE) fails.  DIE should not return.  SIZE should equal SIZE_MAX
+     if size_t overflow was detected while calculating sizes to be
+     passed to MALLOC or REALLOC.  */
+  void (*die) (size_t);
+};
+
+/* An allocator using the stdlib functions and a null DIE function.  */
+extern struct allocator const stdlib_allocator;
+
+#endif /* _GL_ALLOCATOR_H */
deleted file mode 120000 (symlink)
index dfb87af48b85e5e9fa24004046faaa92267f013e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/anytostr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..11ef4478c1df898c4416b1705c03d3c735bccacf
--- /dev/null
@@ -0,0 +1,50 @@
+/* anytostr.c -- convert integers to printable strings
+
+   Copyright (C) 2001, 2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert */
+
+#include <config.h>
+
+#include "inttostr.h"
+
+/* Convert I to a printable string in BUF, which must be at least
+   INT_BUFSIZE_BOUND (INTTYPE) bytes long.  Return the address of the
+   printable string, which need not start at BUF.  */
+
+_GL_ATTRIBUTE_NODISCARD char *
+anytostr (inttype i, char *buf)
+{
+  char *p = buf + INT_STRLEN_BOUND (inttype);
+  *p = 0;
+
+  if (i < 0)
+    {
+      do
+        *--p = '0' - i % 10;
+      while ((i /= 10) != 0);
+
+      *--p = '-';
+    }
+  else
+    {
+      do
+        *--p = '0' + i % 10;
+      while ((i /= 10) != 0);
+    }
+
+  return p;
+}
deleted file mode 120000 (symlink)
index e9b32bbed4acd840d8358c9656b808d544f77b76..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/areadlink-with-size.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ea2fe7f51b11b93462709aaefcdb5374d2a6d6a4
--- /dev/null
@@ -0,0 +1,123 @@
+/* readlink wrapper to return the link name in malloc'd storage.
+   Unlike xreadlink and xreadlink_with_size, don't ever call exit.
+
+   Copyright (C) 2001, 2003-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering <jim@meyering.net>  */
+
+#include <config.h>
+
+#include "areadlink.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* SYMLINK_MAX is used only for an initial memory-allocation sanity
+   check, so it's OK to guess too small on hosts where there is no
+   arbitrary limit to symbolic link length.  */
+#ifndef SYMLINK_MAX
+# define SYMLINK_MAX 1024
+#endif
+
+#define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
+
+/* Call readlink to get the symbolic link value of FILE.
+   SIZE is a hint as to how long the link is expected to be;
+   typically it is taken from st_size.  It need not be correct.
+   Return a pointer to that NUL-terminated string in malloc'd storage.
+   If readlink fails, malloc fails, or if the link value is longer
+   than SSIZE_MAX, return NULL (caller may use errno to diagnose).  */
+
+char *
+areadlink_with_size (char const *file, size_t size)
+{
+  /* Some buggy file systems report garbage in st_size.  Defend
+     against them by ignoring outlandish st_size values in the initial
+     memory allocation.  */
+  size_t symlink_max = SYMLINK_MAX;
+  size_t INITIAL_LIMIT_BOUND = 8 * 1024;
+  size_t initial_limit = (symlink_max < INITIAL_LIMIT_BOUND
+                          ? symlink_max + 1
+                          : INITIAL_LIMIT_BOUND);
+
+  enum { stackbuf_size = 128 };
+
+  /* The initial buffer size for the link value.  */
+  size_t buf_size = (size == 0 ? stackbuf_size
+                     : size < initial_limit ? size + 1 : initial_limit);
+
+  while (1)
+    {
+      ssize_t r;
+      size_t link_length;
+      char stackbuf[stackbuf_size];
+      char *buf = stackbuf;
+      char *buffer = NULL;
+
+      if (! (size == 0 && buf_size == stackbuf_size))
+        {
+          buf = buffer = malloc (buf_size);
+          if (!buffer)
+            {
+              errno = ENOMEM;
+              return NULL;
+            }
+        }
+
+      r = readlink (file, buf, buf_size);
+      link_length = r;
+
+      if (r < 0)
+        {
+          free (buffer);
+          return NULL;
+        }
+
+      if (link_length < buf_size)
+        {
+          buf[link_length] = 0;
+          if (!buffer)
+            {
+              buffer = malloc (link_length + 1);
+              if (buffer)
+                return memcpy (buffer, buf, link_length + 1);
+            }
+          else if (link_length + 1 < buf_size)
+            {
+              /* Shrink BUFFER before returning it.  */
+              char *shrinked_buffer = realloc (buffer, link_length + 1);
+              if (shrinked_buffer != NULL)
+                buffer = shrinked_buffer;
+            }
+          return buffer;
+        }
+
+      free (buffer);
+      if (buf_size <= MAXSIZE / 2)
+        buf_size *= 2;
+      else if (buf_size < MAXSIZE)
+        buf_size = MAXSIZE;
+      else
+        {
+          errno = ENOMEM;
+          return NULL;
+        }
+    }
+}
deleted file mode 120000 (symlink)
index 41efb3b268f0fd95a4098e3beb20e39615898d9f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/areadlink.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a126f3b5178b170cdd7e5f4494e1878981ebd597
--- /dev/null
@@ -0,0 +1,56 @@
+/* areadlink.c -- readlink wrapper to return the link name in malloc'd storage
+   Unlike xreadlink and xreadlink_with_size, don't ever call exit.
+
+   Copyright (C) 2001, 2003-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering <jim@meyering.net>
+   and Bruno Haible <bruno@clisp.org>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "areadlink.h"
+
+#include "careadlinkat.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Get the symbolic link value of FILENAME and put it into BUFFER, with
+   size BUFFER_SIZE.  This function acts like readlink but has
+   readlinkat's signature.  */
+static ssize_t
+careadlinkatcwd (int fd, char const *filename, char *buffer,
+                 size_t buffer_size)
+{
+  /* FD must be AT_FDCWD here, otherwise the caller is using this
+     function in contexts it was not meant for.  */
+  if (fd != AT_FDCWD)
+    abort ();
+  return readlink (filename, buffer, buffer_size);
+}
+
+/* Call readlink to get the symbolic link value of FILENAME.
+   Return a pointer to that NUL-terminated string in malloc'd storage.
+   If readlink fails, return NULL and set errno.
+   If allocation fails, or if the link value is longer than SIZE_MAX :-),
+   return NULL and set errno to ENOMEM.  */
+
+char *
+areadlink (char const *filename)
+{
+  return careadlinkat (AT_FDCWD, filename, NULL, 0, NULL, careadlinkatcwd);
+}
deleted file mode 120000 (symlink)
index 1d03bdf59515ed28da0daa46cb86dac7cb2070b0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/areadlink.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d7ffaa2f3c3e055d488ef93bcb88de603c9d0d32
--- /dev/null
@@ -0,0 +1,37 @@
+/* Read symbolic links without size limitation.
+
+   Copyright (C) 2001, 2003-2004, 2007, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering <jim@meyering.net>  */
+
+#include <stdlib.h>
+
+extern char *areadlink (char const *filename)
+  _GL_ATTRIBUTE_DEALLOC_FREE;
+extern char *areadlink_with_size (char const *filename, size_t size_hint)
+  _GL_ATTRIBUTE_DEALLOC_FREE;
+
+#if GNULIB_AREADLINKAT
+extern char *areadlinkat (int fd, char const *filename)
+  _GL_ATTRIBUTE_DEALLOC_FREE;
+#endif
+
+#if GNULIB_AREADLINKAT_WITH_SIZE
+extern char *areadlinkat_with_size (int fd, char const *filename,
+                                    size_t size_hint)
+  _GL_ATTRIBUTE_DEALLOC_FREE;
+#endif
deleted file mode 120000 (symlink)
index 06847a324ab95696d1af9c6ec4503f4a0135c3a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/areadlinkat-with-size.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..09da28e8167ff3b8f1cc3ad0bf94c611e5202af6
--- /dev/null
@@ -0,0 +1,150 @@
+/* readlinkat wrapper to return the link name in malloc'd storage.
+   Unlike xreadlinkat, only call exit on failure to change directory.
+
+   Copyright (C) 2001, 2003-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering <jim@meyering.net>
+   and Eric Blake <ebb9@byu.net>.  */
+
+#include <config.h>
+
+#include "areadlink.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#if HAVE_READLINKAT
+
+/* SYMLINK_MAX is used only for an initial memory-allocation sanity
+   check, so it's OK to guess too small on hosts where there is no
+   arbitrary limit to symbolic link length.  */
+# ifndef SYMLINK_MAX
+#  define SYMLINK_MAX 1024
+# endif
+
+# define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
+
+/* Call readlinkat to get the symbolic link value of FILE, relative to FD.
+   SIZE is a hint as to how long the link is expected to be;
+   typically it is taken from st_size.  It need not be correct.
+   Return a pointer to that NUL-terminated string in malloc'd storage.
+   If readlinkat fails, malloc fails, or if the link value is longer
+   than SSIZE_MAX, return NULL (caller may use errno to diagnose).
+   However, failure to change directory during readlinkat will issue
+   a diagnostic and exit.  */
+
+char *
+areadlinkat_with_size (int fd, char const *file, size_t size)
+{
+  /* Some buggy file systems report garbage in st_size.  Defend
+     against them by ignoring outlandish st_size values in the initial
+     memory allocation.  */
+  size_t symlink_max = SYMLINK_MAX;
+  size_t INITIAL_LIMIT_BOUND = 8 * 1024;
+  size_t initial_limit = (symlink_max < INITIAL_LIMIT_BOUND
+                          ? symlink_max + 1
+                          : INITIAL_LIMIT_BOUND);
+
+  enum { stackbuf_size = 128 };
+
+  /* The initial buffer size for the link value.  */
+  size_t buf_size = (size == 0 ? stackbuf_size
+                     : size < initial_limit ? size + 1 : initial_limit);
+
+  while (1)
+    {
+      ssize_t r;
+      size_t link_length;
+      char stackbuf[stackbuf_size];
+      char *buf = stackbuf;
+      char *buffer = NULL;
+
+      if (! (size == 0 && buf_size == stackbuf_size))
+        {
+          buf = buffer = malloc (buf_size);
+          if (!buffer)
+            /* We can assume errno == ENOMEM here, since all platforms that have
+               readlinkat() have a POSIX compliant malloc().  */
+            return NULL;
+        }
+
+      r = readlinkat (fd, file, buf, buf_size);
+      link_length = r;
+
+      if (r < 0)
+        {
+          free (buffer);
+          return NULL;
+        }
+
+      if (link_length < buf_size)
+        {
+          buf[link_length] = 0;
+          if (!buffer)
+            {
+              buffer = malloc (link_length + 1);
+              if (buffer)
+                return memcpy (buffer, buf, link_length + 1);
+            }
+          else if (link_length + 1 < buf_size)
+            {
+              /* Shrink BUFFER before returning it.  */
+              char *shrinked_buffer = realloc (buffer, link_length + 1);
+              if (shrinked_buffer != NULL)
+                buffer = shrinked_buffer;
+            }
+          return buffer;
+        }
+
+      free (buffer);
+      if (buf_size <= MAXSIZE / 2)
+        buf_size *= 2;
+      else if (buf_size < MAXSIZE)
+        buf_size = MAXSIZE;
+      else
+        {
+          errno = ENOMEM;
+          return NULL;
+        }
+    }
+}
+
+#else /* !HAVE_READLINKAT */
+
+
+/* It is more efficient to change directories only once and call
+   areadlink_with_size, rather than repeatedly call the replacement
+   readlinkat.  */
+
+# define AT_FUNC_NAME areadlinkat_with_size
+# define AT_FUNC_F1 areadlink_with_size
+# define AT_FUNC_POST_FILE_PARAM_DECLS , size_t size
+# define AT_FUNC_POST_FILE_ARGS        , size
+# define AT_FUNC_RESULT char *
+# define AT_FUNC_FAIL NULL
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+# undef AT_FUNC_RESULT
+# undef AT_FUNC_FAIL
+
+#endif /* !HAVE_READLINKAT */
deleted file mode 120000 (symlink)
index 381d41c8e2dbb1b4fc720478b8f0c53012d50ac9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/areadlinkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4ce4944559ff51e90eac9713d58d228bc06a9f3a
--- /dev/null
@@ -0,0 +1,67 @@
+/* areadlinkat.c -- readlinkat wrapper to return malloc'd link name
+   Unlike xreadlinkat, only call exit on failure to change directory.
+
+   Copyright (C) 2001, 2003-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering <jim@meyering.net>,
+   and Bruno Haible <bruno@clisp.org>,
+   and Eric Blake <ebb9@byu.net>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "areadlink.h"
+
+#include <stdlib.h>
+
+#include "careadlinkat.h"
+
+#if HAVE_READLINKAT
+
+/* Call readlinkat to get the symbolic link value of FILENAME relative to FD.
+   Return a pointer to that NUL-terminated string in malloc'd storage.
+   If readlinkat fails, return NULL and set errno (although failure to
+   change directory will issue a diagnostic and exit).
+   If allocation fails, or if the link value is longer than SIZE_MAX :-),
+   return NULL and set errno to ENOMEM.  */
+
+char *
+areadlinkat (int fd, char const *filename)
+{
+  return careadlinkat (fd, filename, NULL, 0, NULL, readlinkat);
+}
+
+#else /* !HAVE_READLINKAT */
+
+/* It is more efficient to change directories only once and call
+   areadlink, rather than repeatedly call the replacement
+   readlinkat.  */
+
+# define AT_FUNC_NAME areadlinkat
+# define AT_FUNC_F1 areadlink
+# define AT_FUNC_POST_FILE_PARAM_DECLS /* empty */
+# define AT_FUNC_POST_FILE_ARGS        /* empty */
+# define AT_FUNC_RESULT char *
+# define AT_FUNC_FAIL NULL
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+# undef AT_FUNC_RESULT
+# undef AT_FUNC_FAIL
+
+#endif /* !HAVE_READLINKAT */
deleted file mode 120000 (symlink)
index 1ea740df5b6efac9355bee0cb85b806b7389531a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/arg-nonnull.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..46c711ca1a128b87cc064a3d7594659cc5470b61
--- /dev/null
@@ -0,0 +1,26 @@
+/* A C macro for declaring that specific arguments must not be NULL.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
+   that the values passed as arguments n, ..., m must be non-NULL pointers.
+   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
+#ifndef _GL_ARG_NONNULL
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
+#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
+# else
+#  define _GL_ARG_NONNULL(params)
+# endif
+#endif
deleted file mode 120000 (symlink)
index c75334163cf3ff2587b81470fb8df3a7f52c47a8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/argmatch.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c9d727c8e661ed547324ca9d6b1737836d28739c
--- /dev/null
@@ -0,0 +1,293 @@
+/* argmatch.c -- find a match for a string in an array
+
+   Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David MacKenzie <djm@ai.mit.edu>
+   Modified by Akim Demaille <demaille@inf.enst.fr> */
+
+#include <config.h>
+
+/* Specification.  */
+#include "argmatch.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define _(msgid) gettext (msgid)
+
+#include <error.h>
+#include "quotearg.h"
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+/* When reporting an invalid argument, show nonprinting characters
+   by using the quoting style ARGMATCH_QUOTING_STYLE.  Do not use
+   literal_quoting_style.  */
+#ifndef ARGMATCH_QUOTING_STYLE
+# define ARGMATCH_QUOTING_STYLE locale_quoting_style
+#endif
+
+/* Non failing version of argmatch call this function after failing. */
+#ifndef ARGMATCH_DIE
+# include "exitfail.h"
+# define ARGMATCH_DIE exit (exit_failure)
+#endif
+
+#ifdef ARGMATCH_DIE_DECL
+ARGMATCH_DIE_DECL;
+#endif
+
+static void
+__argmatch_die (void)
+{
+  ARGMATCH_DIE;
+}
+
+/* Used by XARGMATCH.  See description in argmatch.h.
+   Default to __argmatch_die, but allow caller to change this at run-time. */
+argmatch_exit_fn argmatch_die = __argmatch_die;
+
+\f
+/* If ARG is an unambiguous match for an element of the
+   NULL-terminated array ARGLIST, return the index in ARGLIST
+   of the matched element, else -1 if it does not match any element
+   or -2 if it is ambiguous (is a prefix of more than one element).
+
+   If VALLIST is none null, use it to resolve ambiguities limited to
+   synonyms, i.e., for
+     "yes", "yop" -> 0
+     "no", "nope" -> 1
+   "y" is a valid argument, for 0, and "n" for 1.  */
+
+ptrdiff_t
+argmatch (const char *arg, const char *const *arglist,
+          const void *vallist, size_t valsize)
+{
+  size_t i;                     /* Temporary index in ARGLIST.  */
+  size_t arglen;                /* Length of ARG.  */
+  ptrdiff_t matchind = -1;      /* Index of first nonexact match.  */
+  bool ambiguous = false;       /* If true, multiple nonexact match(es).  */
+
+  arglen = strlen (arg);
+
+  /* Test all elements for either exact match or abbreviated matches.  */
+  for (i = 0; arglist[i]; i++)
+    {
+      if (!strncmp (arglist[i], arg, arglen))
+        {
+          if (strlen (arglist[i]) == arglen)
+            /* Exact match found.  */
+            return i;
+          else if (matchind == -1)
+            /* First nonexact match found.  */
+            matchind = i;
+          else
+            {
+              /* Second nonexact match found.  */
+              if (vallist == NULL
+                  || memcmp ((char const *) vallist + valsize * matchind,
+                             (char const *) vallist + valsize * i, valsize))
+                {
+                  /* There is a real ambiguity, or we could not
+                     disambiguate. */
+                  ambiguous = true;
+                }
+            }
+        }
+    }
+  if (ambiguous)
+    return -2;
+  else
+    return matchind;
+}
+
+ptrdiff_t
+argmatch_exact (const char *arg, const char *const *arglist)
+{
+  size_t i;
+
+  /* Test elements for exact match.  */
+  for (i = 0; arglist[i]; i++)
+    {
+      if (!strcmp (arglist[i], arg))
+        return i;
+    }
+
+  return -1;
+}
+
+/* Error reporting for argmatch.
+   CONTEXT is a description of the type of entity that was being matched.
+   VALUE is the invalid value that was given.
+   PROBLEM is the return value from argmatch.  */
+
+void
+argmatch_invalid (const char *context, const char *value, ptrdiff_t problem)
+{
+  char const *format = (problem == -1
+                        ? _("invalid argument %s for %s")
+                        : _("ambiguous argument %s for %s"));
+
+  error (0, 0, format, quotearg_n_style (0, ARGMATCH_QUOTING_STYLE, value),
+         quote_n (1, context));
+}
+
+/* List the valid arguments for argmatch.
+   ARGLIST is the same as in argmatch.
+   VALLIST is a pointer to an array of values.
+   VALSIZE is the size of the elements of VALLIST */
+void
+argmatch_valid (const char *const *arglist,
+                const void *vallist, size_t valsize)
+{
+  size_t i;
+  const char *last_val = NULL;
+
+  /* We try to put synonyms on the same line.  The assumption is that
+     synonyms follow each other */
+  fputs (_("Valid arguments are:"), stderr);
+  for (i = 0; arglist[i]; i++)
+    if ((i == 0)
+        || memcmp (last_val, (char const *) vallist + valsize * i, valsize))
+      {
+        fprintf (stderr, "\n  - %s", quote (arglist[i]));
+        last_val = (char const *) vallist + valsize * i;
+      }
+    else
+      {
+        fprintf (stderr, ", %s", quote (arglist[i]));
+      }
+  putc ('\n', stderr);
+}
+
+/* Never failing versions of the previous functions.
+
+   CONTEXT is the context for which argmatch is called (e.g.,
+   "--version-control", or "$VERSION_CONTROL" etc.).  Upon failure,
+   calls the (supposed never to return) function EXIT_FN. */
+
+ptrdiff_t
+__xargmatch_internal (const char *context,
+                      const char *arg, const char *const *arglist,
+                      const void *vallist, size_t valsize,
+                      argmatch_exit_fn exit_fn,
+                      bool allow_abbreviation)
+{
+  ptrdiff_t res;
+
+  if (allow_abbreviation)
+    res = argmatch (arg, arglist, vallist, valsize);
+  else
+    res = argmatch_exact (arg, arglist);
+
+  if (res >= 0)
+    /* Success. */
+    return res;
+
+  /* We failed.  Explain why. */
+  argmatch_invalid (context, arg, res);
+  argmatch_valid (arglist, vallist, valsize);
+  (*exit_fn) ();
+
+  return -1; /* To please the compilers. */
+}
+
+/* Look for VALUE in VALLIST, an array of objects of size VALSIZE and
+   return the first corresponding argument in ARGLIST */
+const char *
+argmatch_to_argument (const void *value,
+                      const char *const *arglist,
+                      const void *vallist, size_t valsize)
+{
+  size_t i;
+
+  for (i = 0; arglist[i]; i++)
+    if (!memcmp (value, (char const *) vallist + valsize * i, valsize))
+      return arglist[i];
+  return NULL;
+}
+
+#ifdef TEST
+/*
+ * Based on "getversion.c" by David MacKenzie <djm@gnu.ai.mit.edu>
+ */
+
+/* When to make backup files.  */
+enum backup_type
+{
+  /* Never make backups.  */
+  no_backups,
+
+  /* Make simple backups of every file.  */
+  simple_backups,
+
+  /* Make numbered backups of files that already have numbered backups,
+     and simple backups of the others.  */
+  numbered_existing_backups,
+
+  /* Make numbered backups of every file.  */
+  numbered_backups
+};
+
+/* Two tables describing arguments (keys) and their corresponding
+   values */
+static const char *const backup_args[] =
+{
+  "no", "none", "off",
+  "simple", "never",
+  "existing", "nil",
+  "numbered", "t",
+  0
+};
+
+static const enum backup_type backup_vals[] =
+{
+  no_backups, no_backups, no_backups,
+  simple_backups, simple_backups,
+  numbered_existing_backups, numbered_existing_backups,
+  numbered_backups, numbered_backups
+};
+
+int
+main (int argc, const char *const *argv)
+{
+  const char *cp;
+  enum backup_type backup_type = no_backups;
+
+  if (argc > 2)
+    {
+      fprintf (stderr, "Usage: %s [VERSION_CONTROL]\n", getprogname ());
+      exit (1);
+    }
+
+  if ((cp = getenv ("VERSION_CONTROL")))
+    backup_type = XARGMATCH ("$VERSION_CONTROL", cp,
+                             backup_args, backup_vals);
+
+  if (argc == 2)
+    backup_type = XARGMATCH (getprogname (), argv[1],
+                             backup_args, backup_vals);
+
+  printf ("The version control is '%s'\n",
+          ARGMATCH_TO_ARGUMENT (&backup_type, backup_args, backup_vals));
+
+  return 0;
+}
+#endif
deleted file mode 120000 (symlink)
index cb26ff6a5c89b9a613727e953f8c3d43ca53df90..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/argmatch.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ca60dfe1ceff8521da7dbeae840907c36e16e1d7
--- /dev/null
@@ -0,0 +1,350 @@
+/* argmatch.h -- definitions and prototypes for argmatch.c
+
+   Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David MacKenzie <djm@ai.mit.edu>
+   Modified by Akim Demaille <demaille@inf.enst.fr> */
+
+#ifndef ARGMATCH_H_
+# define ARGMATCH_H_ 1
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <limits.h>
+# include <stddef.h>
+# include <stdio.h>
+# include <string.h> /* memcmp */
+
+# include "gettext.h"
+# include "quote.h"
+
+# ifdef  __cplusplus
+extern "C" {
+# endif
+
+# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
+
+/* Assert there are as many real arguments as there are values
+   (argument list ends with a NULL guard).  */
+
+# define ARGMATCH_VERIFY(Arglist, Vallist) \
+    static_assert (ARRAY_CARDINALITY (Arglist) \
+                   == ARRAY_CARDINALITY (Vallist) + 1)
+
+/* Return the index of the element of ARGLIST (NULL terminated) that
+   matches with ARG.  If VALLIST is not NULL, then use it to resolve
+   false ambiguities (i.e., different matches of ARG but corresponding
+   to the same values in VALLIST).  */
+
+ptrdiff_t argmatch (char const *arg, char const *const *arglist,
+                    void const *vallist, size_t valsize) _GL_ATTRIBUTE_PURE;
+
+ptrdiff_t argmatch_exact (char const *arg, char const *const *arglist)
+  _GL_ATTRIBUTE_PURE;
+
+# define ARGMATCH(Arg, Arglist, Vallist) \
+  argmatch (Arg, Arglist, (void const *) (Vallist), sizeof *(Vallist))
+
+# define ARGMATCH_EXACT(Arg, Arglist) \
+  argmatch_exact (Arg, Arglist)
+
+/* xargmatch calls this function when it fails.  This function should not
+   return.  By default, this is a function that calls ARGMATCH_DIE which
+   in turn defaults to 'exit (exit_failure)'.  */
+typedef void (*argmatch_exit_fn) (void);
+extern argmatch_exit_fn argmatch_die;
+
+/* Report on stderr why argmatch failed.  Report correct values. */
+
+void argmatch_invalid (char const *context, char const *value,
+                       ptrdiff_t problem);
+
+/* Left for compatibility with the old name invalid_arg */
+
+# define invalid_arg(Context, Value, Problem) \
+  argmatch_invalid (Context, Value, Problem)
+
+
+
+/* Report on stderr the list of possible arguments.  */
+
+void argmatch_valid (char const *const *arglist,
+                     void const *vallist, size_t valsize);
+
+# define ARGMATCH_VALID(Arglist, Vallist) \
+  argmatch_valid (Arglist, (void const *) (Vallist), sizeof *(Vallist))
+
+
+
+/* Like argmatch/argmatch_exact, but upon failure, report an explanation
+   of the failure, and exit using the function EXIT_FN. */
+
+ptrdiff_t __xargmatch_internal (char const *context,
+                                char const *arg, char const *const *arglist,
+                                void const *vallist, size_t valsize,
+                                argmatch_exit_fn exit_fn,
+                                bool allow_abbreviation);
+
+/* Programmer friendly interface to __xargmatch_internal. */
+
+# define XARGMATCH(Context, Arg, Arglist, Vallist)              \
+  ((Vallist) [__xargmatch_internal (Context, Arg, Arglist,      \
+                                    (void const *) (Vallist),   \
+                                    sizeof *(Vallist),          \
+                                    argmatch_die,               \
+                                    true)])
+
+# define XARGMATCH_EXACT(Context, Arg, Arglist, Vallist)        \
+  ((Vallist) [__xargmatch_internal (Context, Arg, Arglist,      \
+                                    (void const *) (Vallist),   \
+                                    sizeof *(Vallist),          \
+                                    argmatch_die,               \
+                                    false)])
+
+/* Convert a value into a corresponding argument. */
+
+char const *argmatch_to_argument (void const *value,
+                                  char const *const *arglist,
+                                  void const *vallist, size_t valsize)
+  _GL_ATTRIBUTE_PURE;
+
+# define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist)                  \
+  argmatch_to_argument (Value, Arglist,                                 \
+                        (void const *) (Vallist), sizeof *(Vallist))
+
+# define ARGMATCH_DEFINE_GROUP(Name, Type)                              \
+  /* The type of the values of this group.  */                          \
+  typedef Type argmatch_##Name##_type;                                  \
+                                                                        \
+  /* The size of the type of the values of this group. */               \
+  enum argmatch_##Name##_size_enum                                      \
+  {                                                                     \
+    argmatch_##Name##_size = sizeof (argmatch_##Name##_type)            \
+  };                                                                    \
+                                                                        \
+  /* Argument mapping of this group.  */                                \
+  typedef struct                                                        \
+  {                                                                     \
+    /* Argument (e.g., "simple").  */                                   \
+    const char *arg;                                                    \
+    /* Value (e.g., simple_backups).  */                                \
+    const argmatch_##Name##_type val;                                   \
+  } argmatch_##Name##_arg;                                              \
+                                                                        \
+  /* Documentation of this group.  */                                   \
+  typedef struct                                                        \
+  {                                                                     \
+    /* Argument (e.g., "simple").  */                                   \
+    const char *arg;                                                    \
+    /* Documentation (e.g., N_("always make simple backups")).  */      \
+    const char *doc;                                                    \
+  } argmatch_##Name##_doc;                                              \
+                                                                        \
+  /* All the features of an argmatch group.  */                         \
+  typedef struct                                                        \
+  {                                                                     \
+    const argmatch_##Name##_arg* args;                                  \
+    const argmatch_##Name##_doc* docs;                                  \
+                                                                        \
+    /* Printed before the usage message.  */                            \
+    const char *doc_pre;                                                \
+    /* Printed after the usage message.  */                             \
+    const char *doc_post;                                               \
+  } argmatch_##Name##_group_type;                                       \
+                                                                        \
+  /* The structure the user must build.  */                             \
+  extern const argmatch_##Name##_group_type argmatch_##Name##_group;    \
+                                                                        \
+  /* Print the documentation of this group.  */                         \
+  void argmatch_##Name##_usage (FILE *out);                             \
+                                                                        \
+  /* If nonnegative, the index I of ARG in ARGS, i.e,                   \
+     ARGS[I] == ARG.                                                    \
+     Return -1 for invalid argument, -2 for ambiguous argument. */      \
+  ptrdiff_t argmatch_##Name##_choice (const char *arg);                 \
+                                                                        \
+  /* A pointer to the corresponding value if it exists, or              \
+     report an error and exit with failure if the argument was          \
+     not recognized. */                                                 \
+  const argmatch_##Name##_type*                                         \
+  argmatch_##Name##_value (const char *context, const char *arg);       \
+                                                                        \
+  /* The first argument in ARGS that matches this value, or NULL.  */   \
+  const char *                                                          \
+  argmatch_##Name##_argument (const argmatch_##Name##_type *val);       \
+                                                                        \
+  ptrdiff_t                                                             \
+  argmatch_##Name##_choice (const char *arg)                            \
+  {                                                                     \
+    const argmatch_##Name##_group_type *g = &argmatch_##Name##_group;   \
+    size_t size = argmatch_##Name##_size;                               \
+    ptrdiff_t res = -1;      /* Index of first nonexact match.  */      \
+    bool ambiguous = false;  /* Whether multiple nonexact match(es). */ \
+    size_t arglen = strlen (arg);                                       \
+                                                                        \
+    /* Test all elements for either exact match or abbreviated          \
+       matches.  */                                                     \
+    for (size_t i = 0; g->args[i].arg; i++)                             \
+      if (!strncmp (g->args[i].arg, arg, arglen))                       \
+        {                                                               \
+          if (strlen (g->args[i].arg) == arglen)                        \
+            /* Exact match found.  */                                   \
+            return i;                                                   \
+          else if (res == -1)                                           \
+            /* First nonexact match found.  */                          \
+            res = i;                                                    \
+          else if (memcmp (&g->args[res].val, &g->args[i].val, size))   \
+            /* Second nonexact match found.  */                         \
+            /* There is a real ambiguity, or we could not               \
+               disambiguate. */                                         \
+            ambiguous = true;                                           \
+        }                                                               \
+    return ambiguous ? -2 : res;                                        \
+  }                                                                     \
+                                                                        \
+  const char *                                                          \
+  argmatch_##Name##_argument (const argmatch_##Name##_type *val)        \
+  {                                                                     \
+    const argmatch_##Name##_group_type *g = &argmatch_##Name##_group;   \
+    size_t size = argmatch_##Name##_size;                               \
+    for (size_t i = 0; g->args[i].arg; i++)                             \
+      if (!memcmp (val, &g->args[i].val, size))                         \
+        return g->args[i].arg;                                          \
+    return NULL;                                                        \
+  }                                                                     \
+                                                                        \
+  /* List the valid values of this group. */                            \
+  static void                                                           \
+  argmatch_##Name##_valid (FILE *out)                                   \
+  {                                                                     \
+    const argmatch_##Name##_group_type *g = &argmatch_##Name##_group;   \
+    size_t size = argmatch_##Name##_size;                               \
+                                                                        \
+    /* Try to put synonyms on the same line.  Synonyms are expected     \
+       to follow each other. */                                         \
+    fputs (gettext ("Valid arguments are:"), out);                      \
+    for (int i = 0; g->args[i].arg; i++)                                \
+      if (i == 0                                                        \
+          || memcmp (&g->args[i-1].val, &g->args[i].val, size))         \
+        fprintf (out, "\n  - %s", quote (g->args[i].arg));              \
+      else                                                              \
+        fprintf (out, ", %s", quote (g->args[i].arg));                  \
+    putc ('\n', out);                                                   \
+  }                                                                     \
+                                                                        \
+  const argmatch_##Name##_type*                                         \
+  argmatch_##Name##_value (const char *context, const char *arg)        \
+  {                                                                     \
+    const argmatch_##Name##_group_type *g = &argmatch_##Name##_group;   \
+    ptrdiff_t res = argmatch_##Name##_choice (arg);                     \
+    if (res < 0)                                                        \
+      {                                                                 \
+        argmatch_invalid (context, arg, res);                           \
+        argmatch_##Name##_valid (stderr);                               \
+        argmatch_die ();                                                \
+      }                                                                 \
+    return &g->args[res].val;                                           \
+  }                                                                     \
+                                                                        \
+  /* The column in which the documentation is displayed.                \
+     The leftmost possible, but no more than 20. */                     \
+  static int                                                            \
+  argmatch_##Name##_doc_col (void)                                      \
+  {                                                                     \
+    const argmatch_##Name##_group_type *g = &argmatch_##Name##_group;   \
+    size_t size = argmatch_##Name##_size;                               \
+    int res = 0;                                                        \
+    for (int i = 0; g->docs[i].arg; ++i)                                \
+      {                                                                 \
+        int col = 4;                                                    \
+        int ival = argmatch_##Name##_choice (g->docs[i].arg);           \
+        if (ival < 0)                                                   \
+          /* Pseudo argument, display it. */                            \
+          col += strlen (g->docs[i].arg);                               \
+        else                                                            \
+          /* Genuine argument, display it with its synonyms. */         \
+          for (int j = 0; g->args[j].arg; ++j)                          \
+            if (! memcmp (&g->args[ival].val, &g->args[j].val, size))   \
+              col += (col == 4 ? 0 : 2) + strlen (g->args[j].arg);      \
+        if (res <= col)                                                 \
+          res = col <= 20 ? col : 20;                                   \
+      }                                                                 \
+    return res ? res : 20;                                              \
+  }                                                                     \
+                                                                        \
+  void                                                                  \
+  argmatch_##Name##_usage (FILE *out)                                   \
+  {                                                                     \
+    const argmatch_##Name##_group_type *g = &argmatch_##Name##_group;   \
+    size_t size = argmatch_##Name##_size;                               \
+    /* Width of the screen.  Help2man does not seem to support          \
+       arguments on several lines, so in that case pretend a very       \
+       large width. */                                                  \
+    const int screen_width = getenv ("HELP2MAN") ? INT_MAX : 80;        \
+    if (g->doc_pre)                                                     \
+      fprintf (out, "%s\n", gettext (g->doc_pre));                      \
+    int doc_col = argmatch_##Name##_doc_col ();                         \
+    for (int i = 0; g->docs[i].arg; ++i)                                \
+      {                                                                 \
+        int col = 0;                                                    \
+        bool first = true;                                              \
+        int ival = argmatch_##Name##_choice (g->docs[i].arg);           \
+        if (ival < 0)                                                   \
+          /* Pseudo argument, display it. */                            \
+          col += fprintf (out,  "  %s", g->docs[i].arg);                \
+        else                                                            \
+          /* Genuine argument, display it with its synonyms. */         \
+          for (int j = 0; g->args[j].arg; ++j)                          \
+            if (! memcmp (&g->args[ival].val, &g->args[j].val, size))   \
+              {                                                         \
+                if (!first                                              \
+                    && screen_width < col + 2 + strlen (g->args[j].arg)) \
+                  {                                                     \
+                    fprintf (out, ",\n");                               \
+                    col = 0;                                            \
+                    first = true;                                       \
+                  }                                                     \
+                if (first)                                              \
+                  {                                                     \
+                    col += fprintf (out, " ");                          \
+                    first = false;                                      \
+                  }                                                     \
+                else                                                    \
+                  col += fprintf (out, ",");                            \
+                col += fprintf (out,  " %s", g->args[j].arg);           \
+              }                                                         \
+        /* The doc.  Separated by at least two spaces. */               \
+        if (doc_col < col + 2)                                          \
+          {                                                             \
+            fprintf (out, "\n");                                        \
+            col = 0;                                                    \
+          }                                                             \
+        fprintf (out, "%*s%s\n",                                        \
+                 doc_col - col, "", gettext (g->docs[i].doc));          \
+      }                                                                 \
+    if (g->doc_post)                                                    \
+      fprintf (out, "%s\n", gettext (g->doc_post));                     \
+  }
+
+# ifdef  __cplusplus
+}
+# endif
+
+#endif /* ARGMATCH_H_ */
deleted file mode 120000 (symlink)
index a0cbb3b0c34d98a97a309097438a307b4dbec37d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/argv-iter.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e010d349a3ff180a07b097a0fc0131a833d2c799
--- /dev/null
@@ -0,0 +1,111 @@
+/* Iterate over arguments from argv or --files0-from=FILE
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+#include "argv-iter.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+struct argv_iterator
+{
+  /* Test FP to determine whether in read-mode or argv-mode. */
+  /* file-mode: fp records position */
+  FILE *fp;
+  size_t item_idx;
+  char *tok;
+  size_t buf_len;
+
+  /* argv-mode: record just argv and current pointer */
+  char **arg_list;
+  char **p;
+};
+
+struct argv_iterator *
+argv_iter_init_argv (char **argv)
+{
+  struct argv_iterator *ai = malloc (sizeof *ai);
+  if (!ai)
+    return NULL;
+  ai->fp = NULL;
+  ai->arg_list = argv;
+  ai->p = argv;
+  return ai;
+}
+
+/* Initialize to read from the stream, FP.
+   The input is expected to contain a list of NUL-delimited tokens.  */
+struct argv_iterator *
+argv_iter_init_stream (FILE *fp)
+{
+  struct argv_iterator *ai = malloc (sizeof *ai);
+  if (!ai)
+    return NULL;
+  ai->fp = fp;
+  ai->tok = NULL;
+  ai->buf_len = 0;
+
+  ai->item_idx = 0;
+  ai->arg_list = NULL;
+  return ai;
+}
+
+char *
+argv_iter (struct argv_iterator *ai, enum argv_iter_err *err)
+{
+  if (ai->fp)
+    {
+      ssize_t len = getdelim (&ai->tok, &ai->buf_len, '\0', ai->fp);
+      if (len < 0)
+        {
+          *err = feof (ai->fp) ? AI_ERR_EOF : AI_ERR_READ;
+          return NULL;
+        }
+
+      *err = AI_ERR_OK;
+      ai->item_idx++;
+      return ai->tok;
+    }
+  else
+    {
+      if (*(ai->p) == NULL)
+        {
+          *err = AI_ERR_EOF;
+          return NULL;
+        }
+      else
+        {
+          *err = AI_ERR_OK;
+          return *(ai->p++);
+        }
+    }
+}
+
+size_t
+argv_iter_n_args (struct argv_iterator const *ai)
+{
+  return ai->fp ? ai->item_idx : ai->p - ai->arg_list;
+}
+
+void
+argv_iter_free (struct argv_iterator *ai)
+{
+  if (ai->fp)
+    free (ai->tok);
+  free (ai);
+}
deleted file mode 120000 (symlink)
index c6f0605467eb9ed0d7571a796dd7f781015dcbb3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/argv-iter.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d75a26416c93528701b1cb2e2bf51a04d9c419c4
--- /dev/null
@@ -0,0 +1,47 @@
+/* Iterate over arguments from argv or --files0-from=FILE
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdio.h>
+
+/* Definition of _GL_ARG_NONNULL.  */
+#include "arg-nonnull.h"
+
+struct argv_iterator;
+
+enum argv_iter_err
+{
+  AI_ERR_OK = 1,
+  AI_ERR_EOF,
+  AI_ERR_MEM,
+  AI_ERR_READ
+};
+
+void argv_iter_free (struct argv_iterator *)
+  _GL_ARG_NONNULL ((1));
+
+struct argv_iterator *argv_iter_init_argv (char **argv)
+  _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_DEALLOC (argv_iter_free, 1);
+struct argv_iterator *argv_iter_init_stream (FILE *fp)
+  _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_DEALLOC (argv_iter_free, 1);
+char *argv_iter (struct argv_iterator *, enum argv_iter_err *)
+  _GL_ARG_NONNULL ((1, 2));
+size_t argv_iter_n_args (struct argv_iterator const *)
+  _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1));
deleted file mode 120000 (symlink)
index e65b17ee2e6a41f5b03a95b0979ee589ac1ac0d4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/arpa_inet.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..523a448cbefc4f841e6b8d1a6e6b510bfdebcf66
--- /dev/null
@@ -0,0 +1,155 @@
+/* A GNU-like <arpa/inet.h>.
+
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_ARPA_INET_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if @HAVE_FEATURES_H@
+# include <features.h> /* for __GLIBC__ */
+#endif
+
+/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
+   for pulling in winsock2.h etc. under MinGW.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <sys/socket.h>
+#endif
+
+/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
+   But avoid namespace pollution on glibc systems.  */
+#if defined __TANDEM && !defined __GLIBC__
+# include <netdb.h>
+#endif
+
+#if @HAVE_ARPA_INET_H@
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_ARPA_INET_H
+#define _@GUARD_PREFIX@_ARPA_INET_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get all possible declarations of inet_ntop() and inet_pton().  */
+#if (@GNULIB_INET_NTOP@ || @GNULIB_INET_PTON@ || defined GNULIB_POSIXCHECK) \
+    && @HAVE_WS2TCPIP_H@
+# include <ws2tcpip.h>
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+#if @GNULIB_INET_NTOP@
+/* Converts an internet address from internal format to a printable,
+   presentable format.
+   AF is an internet address family, such as AF_INET or AF_INET6.
+   SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
+   (for AF_INET6).
+   DST points to a buffer having room for CNT bytes.
+   The printable representation of the address (in numeric form, not
+   surrounded by [...], no reverse DNS is done) is placed in DST, and
+   DST is returned.  If an error occurs, the return value is NULL and
+   errno is set.  If CNT bytes are not sufficient to hold the result,
+   the return value is NULL and errno is set to ENOSPC.  A good value
+   for CNT is 46.
+
+   For more details, see the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html>.  */
+# if @REPLACE_INET_NTOP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef inet_ntop
+#   define inet_ntop rpl_inet_ntop
+#  endif
+_GL_FUNCDECL_RPL (inet_ntop, const char *,
+                  (int af, const void *restrict src,
+                   char *restrict dst, socklen_t cnt)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (inet_ntop, const char *,
+                  (int af, const void *restrict src,
+                   char *restrict dst, socklen_t cnt));
+# else
+#  if !@HAVE_DECL_INET_NTOP@
+_GL_FUNCDECL_SYS (inet_ntop, const char *,
+                  (int af, const void *restrict src,
+                   char *restrict dst, socklen_t cnt)
+                  _GL_ARG_NONNULL ((2, 3)));
+#  endif
+/* Need to cast, because on NonStop Kernel, the fourth parameter is
+                                            size_t cnt.  */
+_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
+                       (int af, const void *restrict src,
+                        char *restrict dst, socklen_t cnt));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (inet_ntop);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef inet_ntop
+# if HAVE_RAW_DECL_INET_NTOP
+_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
+                 "use gnulib module inet_ntop for portability");
+# endif
+#endif
+
+#if @GNULIB_INET_PTON@
+# if @REPLACE_INET_PTON@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef inet_pton
+#   define inet_pton rpl_inet_pton
+#  endif
+_GL_FUNCDECL_RPL (inet_pton, int,
+                  (int af, const char *restrict src, void *restrict dst)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (inet_pton, int,
+                  (int af, const char *restrict src, void *restrict dst));
+# else
+#  if !@HAVE_DECL_INET_PTON@
+_GL_FUNCDECL_SYS (inet_pton, int,
+                  (int af, const char *restrict src, void *restrict dst)
+                  _GL_ARG_NONNULL ((2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (inet_pton, int,
+                  (int af, const char *restrict src, void *restrict dst));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (inet_pton);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef inet_pton
+# if HAVE_RAW_DECL_INET_PTON
+_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
+                 "use gnulib module inet_pton for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
+#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
deleted file mode 120000 (symlink)
index ed2ef11f9ddab713ed4161f18e2700c8ef856d75..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/asnprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a6c09bc2052ccde11bbcf8cae59d59f6d9c75345
--- /dev/null
@@ -0,0 +1,34 @@
+/* Formatted output to strings.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "vasnprintf.h"
+
+#include <stdarg.h>
+
+char *
+asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
+{
+  va_list args;
+  char *result;
+
+  va_start (args, format);
+  result = vasnprintf (resultbuf, lengthp, format, args);
+  va_end (args);
+  return result;
+}
deleted file mode 120000 (symlink)
index 574feb0bace2e4560171cccd604561074f73647a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/asprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b0c334788ab2e0e2bf235d27179605516c02fba6
--- /dev/null
@@ -0,0 +1,39 @@
+/* Formatted output to strings.
+   Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#ifdef IN_LIBASPRINTF
+# include "vasprintf.h"
+#else
+# include <stdio.h>
+#endif
+
+#include <stdarg.h>
+
+int
+asprintf (char **resultp, const char *format, ...)
+{
+  va_list args;
+  int result;
+
+  va_start (args, format);
+  result = vasprintf (resultp, format, args);
+  va_end (args);
+  return result;
+}
deleted file mode 120000 (symlink)
index 416d7fd6f875d5b390ea965f7d55f8bc112d16e6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/assert.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6e4995e145586b8ad2aae91bfdce8bd8ba811672
--- /dev/null
@@ -0,0 +1,27 @@
+/* Substitute for and wrapper around <assert.h>
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Do not guard the include, since <assert.h> is supposed to define
+   the assert macro each time it is included.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#@INCLUDE_NEXT@ @NEXT_ASSERT_H@
+
+/* The definition of static_assert is copied here.  */
deleted file mode 120000 (symlink)
index 48edae0b5902117de8ed96a64f88c30fc7ec560c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/assure.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d650ca15366ffe57d6d6060c2f078b262f4c983b
--- /dev/null
@@ -0,0 +1,57 @@
+/* Run-time assert-like macros.
+
+   Copyright (C) 2014-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef _GL_ASSURE_H
+#define _GL_ASSURE_H
+
+#include <assert.h>
+#include "verify.h"
+
+/* Evaluate an assertion E that is guaranteed to be true.
+   If NDEBUG is not defined, abort the program if E is false.
+   If NDEBUG is defined, the compiler can assume E and behavior is
+   undefined if E is false, fails to evaluate, or has side effects.
+
+   Unlike standard 'assert', this macro evaluates E even when NDEBUG
+   is defined, so as to catch typos, avoid some GCC warnings, and
+   improve performance when E is simple enough.
+
+   Also see the documentation for 'assume' in verify.h.  */
+
+#ifdef NDEBUG
+# define affirm(E) assume (E)
+#else
+# define affirm(E) assert (E)
+#endif
+
+/* Check E's value at runtime, and report an error and abort if not.
+   However, do nothing if NDEBUG is defined.
+
+   Unlike standard 'assert', this macro compiles E even when NDEBUG
+   is defined, so as to catch typos and avoid some GCC warnings.
+   Unlike 'affirm', it is OK for E to use hard-to-optimize features,
+   since E is not executed if NDEBUG is defined.  */
+
+#ifdef NDEBUG
+# define assure(E) ((void) (0 && (E)))
+#else
+# define assure(E) assert (E)
+#endif
+
+#endif
deleted file mode 120000 (symlink)
index fc359fb9b1423152350ba009bc1d1b140b731d66..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/at-func.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..56b313f4749d3736e99555b39bbc81668c89bcdb
--- /dev/null
@@ -0,0 +1,146 @@
+/* Define at-style functions like fstatat, unlinkat, fchownat, etc.
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include "filename.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+
+#ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD
+# include <errno.h>
+# ifndef ENOTSUP
+#  define ENOTSUP EINVAL
+# endif
+#else
+# include "openat.h"
+# include "openat-priv.h"
+# include "save-cwd.h"
+#endif
+
+#ifdef AT_FUNC_USE_F1_COND
+# define CALL_FUNC(F)                           \
+  (flag == AT_FUNC_USE_F1_COND                  \
+    ? AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS)     \
+    : AT_FUNC_F2 (F AT_FUNC_POST_FILE_ARGS))
+# define VALIDATE_FLAG(F)                       \
+  if (flag & ~AT_FUNC_USE_F1_COND)              \
+    {                                           \
+      errno = EINVAL;                           \
+      return FUNC_FAIL;                         \
+    }
+#else
+# define CALL_FUNC(F) (AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS))
+# define VALIDATE_FLAG(F) /* empty */
+#endif
+
+#ifdef AT_FUNC_RESULT
+# define FUNC_RESULT AT_FUNC_RESULT
+#else
+# define FUNC_RESULT int
+#endif
+
+#ifdef AT_FUNC_FAIL
+# define FUNC_FAIL AT_FUNC_FAIL
+#else
+# define FUNC_FAIL -1
+#endif
+
+/* Call AT_FUNC_F1 to operate on FILE, which is in the directory
+   open on descriptor FD.  If AT_FUNC_USE_F1_COND is defined to a value,
+   AT_FUNC_POST_FILE_PARAM_DECLS must include a parameter named flag;
+   call AT_FUNC_F2 if FLAG is 0 or fail if FLAG contains more bits than
+   AT_FUNC_USE_F1_COND.  Return int and fail with -1 unless AT_FUNC_RESULT
+   or AT_FUNC_FAIL are defined.  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.  */
+FUNC_RESULT
+AT_FUNC_NAME (int fd, char const *file AT_FUNC_POST_FILE_PARAM_DECLS)
+{
+  VALIDATE_FLAG (flag);
+
+  if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
+    return CALL_FUNC (file);
+
+#ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD
+  errno = ENOTSUP;
+  return FUNC_FAIL;
+#else
+  {
+  /* Be careful to choose names unlikely to conflict with
+     AT_FUNC_POST_FILE_PARAM_DECLS.  */
+  struct saved_cwd saved_cwd;
+  int saved_errno;
+  FUNC_RESULT err;
+
+  {
+    char proc_buf[OPENAT_BUFFER_SIZE];
+    char *proc_file = openat_proc_name (proc_buf, fd, file);
+    if (proc_file)
+      {
+        FUNC_RESULT proc_result = CALL_FUNC (proc_file);
+        int proc_errno = errno;
+        if (proc_file != proc_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 (FUNC_FAIL != 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 (0 <= fd && fd == saved_cwd.desc)
+    {
+      /* If saving the working directory collides with the user's
+         requested fd, then the user's fd must have been closed to
+         begin with.  */
+      free_cwd (&saved_cwd);
+      errno = EBADF;
+      return FUNC_FAIL;
+    }
+
+  if (fchdir (fd) != 0)
+    {
+      saved_errno = errno;
+      free_cwd (&saved_cwd);
+      errno = saved_errno;
+      return FUNC_FAIL;
+    }
+
+  err = CALL_FUNC (file);
+  saved_errno = (err == FUNC_FAIL ? errno : 0);
+
+  if (restore_cwd (&saved_cwd) != 0)
+    openat_restore_fail (errno);
+
+  free_cwd (&saved_cwd);
+
+  if (saved_errno)
+    errno = saved_errno;
+  return err;
+  }
+#endif
+}
+#undef CALL_FUNC
+#undef FUNC_RESULT
+#undef FUNC_FAIL
deleted file mode 120000 (symlink)
index b001b9d5686afc0f94c1944b5e589921c053ea95..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/at-func2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6fa224a2bc6888c05576759065c0927f980e6451
--- /dev/null
@@ -0,0 +1,289 @@
+/* Define 2-FD at-style functions like linkat or renameat.
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering and Eric Blake */
+
+#include <config.h>
+
+#include "openat-priv.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "filename.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "filenamecat.h"
+#include "openat.h"
+#include "same-inode.h"
+#include "save-cwd.h"
+
+/* Call FUNC to operate on a pair of files, where FILE1 is relative to FD1,
+   and FILE2 is relative to FD2.  If possible, do it without changing the
+   working directory.  Otherwise, resort to using save_cwd/fchdir,
+   FUNC, restore_cwd (up to two times).  If either the save_cwd or the
+   restore_cwd fails, then give a diagnostic and exit nonzero.  */
+int
+at_func2 (int fd1, char const *file1,
+          int fd2, char const *file2,
+          int (*func) (char const *file1, char const *file2))
+{
+  struct saved_cwd saved_cwd;
+  int saved_errno;
+  int err;
+  char *file1_alt;
+  char *file2_alt;
+  struct stat st1;
+  struct stat st2;
+
+  /* There are 16 possible scenarios, based on whether an fd is
+     AT_FDCWD or real, and whether a file is absolute or relative:
+
+         fd1  file1 fd2  file2  action
+     0   cwd  abs   cwd  abs    direct call
+     1   cwd  abs   cwd  rel    direct call
+     2   cwd  abs   fd   abs    direct call
+     3   cwd  abs   fd   rel    chdir to fd2
+     4   cwd  rel   cwd  abs    direct call
+     5   cwd  rel   cwd  rel    direct call
+     6   cwd  rel   fd   abs    direct call
+     7   cwd  rel   fd   rel    convert file1 to abs, then case 3
+     8   fd   abs   cwd  abs    direct call
+     9   fd   abs   cwd  rel    direct call
+     10  fd   abs   fd   abs    direct call
+     11  fd   abs   fd   rel    chdir to fd2
+     12  fd   rel   cwd  abs    chdir to fd1
+     13  fd   rel   cwd  rel    convert file2 to abs, then case 12
+     14  fd   rel   fd   abs    chdir to fd1
+     15a fd1  rel   fd1  rel    chdir to fd1
+     15b fd1  rel   fd2  rel    chdir to fd1, then case 7
+
+     Try some optimizations to reduce fd to AT_FDCWD, or to at least
+     avoid converting an absolute name or doing a double chdir.  */
+
+  if ((fd1 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file1))
+      && (fd2 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file2)))
+    return func (file1, file2); /* Case 0-2, 4-6, 8-10.  */
+
+  /* If /proc/self/fd works, we don't need any stat or chdir.  */
+  {
+    char proc_buf1[OPENAT_BUFFER_SIZE];
+    char *proc_file1 = ((fd1 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file1))
+                        ? (char *) file1
+                        : openat_proc_name (proc_buf1, fd1, file1));
+    if (proc_file1)
+      {
+        char proc_buf2[OPENAT_BUFFER_SIZE];
+        char *proc_file2 = ((fd2 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file2))
+                            ? (char *) file2
+                            : openat_proc_name (proc_buf2, fd2, file2));
+        if (proc_file2)
+          {
+            int proc_result = func (proc_file1, proc_file2);
+            int proc_errno = errno;
+            if (proc_file1 != proc_buf1 && proc_file1 != file1)
+              free (proc_file1);
+            if (proc_file2 != proc_buf2 && proc_file2 != file2)
+              free (proc_file2);
+            /* 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;
+              }
+          }
+        else if (proc_file1 != proc_buf1 && proc_file1 != file1)
+          free (proc_file1);
+      }
+  }
+
+  /* Cases 3, 7, 11-15 remain.  Time to normalize directory fds, if
+     possible.  */
+  if (IS_ABSOLUTE_FILE_NAME (file1))
+    fd1 = AT_FDCWD; /* Case 11 reduced to 3.  */
+  else if (IS_ABSOLUTE_FILE_NAME (file2))
+    fd2 = AT_FDCWD; /* Case 14 reduced to 12.  */
+
+  /* Cases 3, 7, 12, 13, 15 remain.  */
+
+  if (fd1 == AT_FDCWD) /* Cases 3, 7.  */
+    {
+      if (stat (".", &st1) == -1 || fstat (fd2, &st2) == -1)
+        return -1;
+      if (!S_ISDIR (st2.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      if (psame_inode (&st1, &st2)) /* Reduced to cases 1, 5.  */
+        return func (file1, file2);
+    }
+  else if (fd2 == AT_FDCWD) /* Cases 12, 13.  */
+    {
+      if (stat (".", &st2) == -1 || fstat (fd1, &st1) == -1)
+        return -1;
+      if (!S_ISDIR (st1.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      if (psame_inode (&st1, &st2)) /* Reduced to cases 4, 5.  */
+        return func (file1, file2);
+    }
+  else if (fd1 != fd2) /* Case 15b.  */
+    {
+      if (fstat (fd1, &st1) == -1 || fstat (fd2, &st2) == -1)
+        return -1;
+      if (!S_ISDIR (st1.st_mode) || !S_ISDIR (st2.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      if (psame_inode (&st1, &st2)) /* Reduced to case 15a.  */
+        {
+          fd2 = fd1;
+          if (stat (".", &st1) == 0 && psame_inode (&st1, &st2))
+            return func (file1, file2); /* Further reduced to case 5.  */
+        }
+    }
+  else /* Case 15a.  */
+    {
+      if (fstat (fd1, &st1) == -1)
+        return -1;
+      if (!S_ISDIR (st1.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      if (stat (".", &st2) == 0 && psame_inode (&st1, &st2))
+        return func (file1, file2); /* Reduced to case 5.  */
+    }
+
+  /* Catch invalid arguments before changing directories.  */
+  if (file1[0] == '\0' || file2[0] == '\0')
+    {
+      errno = ENOENT;
+      return -1;
+    }
+
+  /* Cases 3, 7, 12, 13, 15a, 15b remain.  With all reductions in
+     place, it is time to start changing directories.  */
+
+  if (save_cwd (&saved_cwd) != 0)
+    openat_save_fail (errno);
+
+  if (fd1 != AT_FDCWD && fd2 != AT_FDCWD && fd1 != fd2) /* Case 15b.  */
+    {
+      if (fchdir (fd1) != 0)
+        {
+          saved_errno = errno;
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      fd1 = AT_FDCWD; /* Reduced to case 7.  */
+    }
+
+  /* Cases 3, 7, 12, 13, 15a remain.  Convert one relative name to
+     absolute, if necessary.  */
+
+  file1_alt = (char *) file1;
+  file2_alt = (char *) file2;
+
+  if (fd1 == AT_FDCWD && !IS_ABSOLUTE_FILE_NAME (file1)) /* Case 7.  */
+    {
+      /* It would be nicer to use:
+         file1_alt = file_name_concat (xgetcwd (), file1, NULL);
+         but libraries should not call xalloc_die.  */
+      char *cwd = getcwd (NULL, 0);
+      if (!cwd)
+        {
+          saved_errno = errno;
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      file1_alt = mfile_name_concat (cwd, file1, NULL);
+      if (!file1_alt)
+        {
+          saved_errno = errno;
+          free (cwd);
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      free (cwd); /* Reduced to case 3.  */
+    }
+  else if (fd2 == AT_FDCWD && !IS_ABSOLUTE_FILE_NAME (file2)) /* Case 13.  */
+    {
+      char *cwd = getcwd (NULL, 0);
+      if (!cwd)
+        {
+          saved_errno = errno;
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      file2_alt = mfile_name_concat (cwd, file2, NULL);
+      if (!file2_alt)
+        {
+          saved_errno = errno;
+          free (cwd);
+          free_cwd (&saved_cwd);
+          errno = saved_errno;
+          return -1;
+        }
+      free (cwd); /* Reduced to case 12.  */
+    }
+
+  /* Cases 3, 12, 15a remain.  Change to the correct directory.  */
+  if (fchdir (fd1 == AT_FDCWD ? fd2 : fd1) != 0)
+    {
+      saved_errno = errno;
+      free_cwd (&saved_cwd);
+      if (file1 != file1_alt)
+        free (file1_alt);
+      else if (file2 != file2_alt)
+        free (file2_alt);
+      errno = saved_errno;
+      return -1;
+    }
+
+  /* Finally safe to perform the user's function, then clean up.  */
+
+  err = func (file1_alt, file2_alt);
+  saved_errno = (err < 0 ? errno : 0);
+
+  if (file1 != file1_alt)
+    free (file1_alt);
+  else if (file2 != file2_alt)
+    free (file2_alt);
+
+  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
+#undef FUNC_RESULT
deleted file mode 120000 (symlink)
index f81e3ba40e355d96beb73678e006ea636d42bf6d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/attribute.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..710341ba417c042714c819b18fa69b67633b1970
--- /dev/null
@@ -0,0 +1,243 @@
+/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers
+
+   Copyright 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_*
+   macros used within Gnulib.  */
+
+/* These attributes can be placed in two ways:
+     - At the start of a declaration (i.e. even before storage-class
+       specifiers!); then they apply to all entities that are declared
+       by the declaration.
+     - Immediately after the name of an entity being declared by the
+       declaration; then they apply to that entity only.  */
+
+#ifndef _GL_ATTRIBUTE_H
+#define _GL_ATTRIBUTE_H
+
+
+/* This file defines two types of attributes:
+   * C23 standard attributes.  These have macro names that do not begin with
+     'ATTRIBUTE_'.
+   * Selected GCC attributes; see:
+     https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
+     https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html
+     https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html
+     These names begin with 'ATTRIBUTE_' to avoid name clashes.  */
+
+
+/* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_ALWAYS_INLINE,
+   _GL_ATTRIBUTE_ARTIFICIAL, _GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_CONST,
+   _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR,
+   _GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE,
+   _GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF,
+   _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED,
+   _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL,
+   _GL_ATTRIBUTE_NONSTRING, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED,
+   _GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL,
+   _GL_ATTRIBUTE_SENTINEL.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+
+/* =============== Attributes for specific kinds of functions =============== */
+
+/* Attributes for functions that should not be used.  */
+
+/* Warn if the entity is used.  */
+/* Applies to:
+     - function, variable,
+     - struct, union, struct/union member,
+     - enumeration, enumeration item,
+     - typedef,
+   in C++ also: namespace, class, template specialization.  */
+#define DEPRECATED _GL_ATTRIBUTE_DEPRECATED
+
+/* If a function call is not optimized way, warn with MSG.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING (msg)
+
+/* If a function call is not optimized way, report an error with MSG.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR (msg)
+
+
+/* Attributes for memory-allocating functions.  */
+
+/* The function returns a pointer to freshly allocated memory.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_MALLOC _GL_ATTRIBUTE_MALLOC
+
+/* ATTRIBUTE_ALLOC_SIZE ((N)) - The Nth argument of the function
+   is the size of the returned memory block.
+   ATTRIBUTE_ALLOC_SIZE ((M, N)) - Multiply the Mth and Nth arguments
+   to determine the size of the returned memory block.  */
+/* Applies to: function, pointer to function, function types.  */
+#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args)
+
+/* ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
+   that can be freed by passing them as the Ith argument to the
+   function F.
+   ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+   can be freed via 'free'; it can be used only after declaring 'free'.  */
+/* Applies to: functions.  Cannot be used on inline functions.  */
+#define ATTRIBUTE_DEALLOC(f, i) _GL_ATTRIBUTE_DEALLOC(f, i)
+#define ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC_FREE
+
+/* Attributes for variadic functions.  */
+
+/* The variadic function expects a trailing NULL argument.
+   ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99).
+   ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL (pos)
+
+
+/* ================== Attributes for compiler diagnostics ================== */
+
+/* Attributes that help the compiler diagnose programmer mistakes.
+   Some of them may also help for some compiler optimizations.  */
+
+/* ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)) -
+   The STRING-INDEXth function argument is a format string of style
+   ARCHETYPE, which is one of:
+     printf, gnu_printf
+     scanf, gnu_scanf,
+     strftime, gnu_strftime,
+     strfmon,
+   or the same thing prefixed and suffixed with '__'.
+   If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK
+   are suitable for the format string.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT (spec)
+
+/* ATTRIBUTE_NONNULL ((N1, N2,...)) - Arguments N1, N2,... must not be NULL.
+   ATTRIBUTE_NONNULL () - All pointer arguments must not be null.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args)
+
+/* The function's return value is a non-NULL pointer.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL
+
+/* Warn if the caller does not use the return value,
+   unless the caller uses something like ignore_value.  */
+/* Applies to: function, enumeration, class.  */
+#define NODISCARD _GL_ATTRIBUTE_NODISCARD
+
+
+/* Attributes that disable false alarms when the compiler diagnoses
+   programmer "mistakes".  */
+
+/* Do not warn if the entity is not used.  */
+/* Applies to:
+     - function, variable,
+     - struct, union, struct/union member,
+     - enumeration, enumeration item,
+     - typedef,
+   in C++ also: class.  */
+#define MAYBE_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
+
+/* The contents of a character array is not meant to be NUL-terminated.  */
+/* Applies to: struct/union members and variables that are arrays of element
+   type '[[un]signed] char'.  */
+#define ATTRIBUTE_NONSTRING _GL_ATTRIBUTE_NONSTRING
+
+/* Do not warn if control flow falls through to the immediately
+   following 'case' or 'default' label.  */
+/* Applies to: Empty statement (;), inside a 'switch' statement.  */
+#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
+
+
+/* ================== Attributes for debugging information ================== */
+
+/* Attributes regarding debugging information emitted by the compiler.  */
+
+/* Omit the function from stack traces when debugging.  */
+/* Applies to: function.  */
+#define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL
+
+/* Make the entity visible to debuggers etc., even with '-fwhole-program'.  */
+/* Applies to: functions, variables.  */
+#define ATTRIBUTE_EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
+
+
+/* ========== Attributes that mainly direct compiler optimizations ========== */
+
+/* The function does not throw exceptions.  */
+/* Applies to: functions.  */
+/* After a function's parameter list, this attribute must come first, before
+   other attributes.  */
+#define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW
+
+/* Do not inline the function.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_NOINLINE _GL_ATTRIBUTE_NOINLINE
+
+/* Always inline the function, and report an error if the compiler
+   cannot inline.  */
+/* Applies to: function.  */
+#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE
+
+/* It is OK for a compiler to omit duplicate calls with the same arguments.
+   This attribute is safe for a function that neither depends on
+   nor affects observable state, and always returns exactly once -
+   e.g., does not loop forever, and does not call longjmp.
+   (This attribute is stricter than ATTRIBUTE_PURE.)  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
+
+/* It is OK for a compiler to omit duplicate calls with the same
+   arguments if observable state is not changed between calls.
+   This attribute is safe for a function that does not affect
+   observable state, and always returns exactly once.
+   (This attribute is looser than ATTRIBUTE_CONST.)  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
+
+/* The function is rarely executed.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD
+
+/* If called from some other compilation unit, the function executes
+   code from that unit only by return or by exception handling,
+   letting the compiler optimize that unit more aggressively.  */
+/* Applies to: functions.  */
+#define ATTRIBUTE_LEAF _GL_ATTRIBUTE_LEAF
+
+/* For struct members: The member has the smallest possible alignment.
+   For struct, union, class: All members have the smallest possible alignment,
+   minimizing the memory required.  */
+/* Applies to: struct members, struct, union,
+   in C++ also: class.  */
+#define ATTRIBUTE_PACKED _GL_ATTRIBUTE_PACKED
+
+
+/* ================ Attributes that make invalid code valid ================ */
+
+/* Attributes that prevent fatal compiler optimizations for code that is not
+   fully ISO C compliant.  */
+
+/* Pointers to the type may point to the same storage as pointers to
+   other types, thus disabling strict aliasing optimization.  */
+/* Applies to: types.  */
+#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS
+
+
+#endif /* _GL_ATTRIBUTE_H */
deleted file mode 120000 (symlink)
index 35b07ab4f357009b578f439d5a1e77b66df74734..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/backup-find.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5e39789d4327645cfdabbc4414a7170988866849
--- /dev/null
@@ -0,0 +1,93 @@
+/* backupfile.c -- make Emacs style backup file names
+
+   Copyright 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "backup-internal.h"
+
+#include "argmatch.h"
+#include "xalloc.h"
+
+#include <stdlib.h>
+
+/* Relative to DIR_FD, return the name of a backup file for the
+   existing file FILE, allocated with malloc.  Report an error and
+   exit if out of memory.  Do not call this function if
+   backup_type == no_backups.  */
+
+char *
+find_backup_file_name (int dir_fd, char const *file,
+                       enum backup_type backup_type)
+{
+  char *result = backupfile_internal (dir_fd, file, backup_type, false);
+  if (!result)
+    xalloc_die ();
+  return result;
+}
+
+static char const *const backup_args[] =
+{
+  /* In a series of synonyms, present the most meaningful first, so
+     that argmatch_valid be more readable. */
+  "none", "off",
+  "simple", "never",
+  "existing", "nil",
+  "numbered", "t",
+  NULL
+};
+
+static const enum backup_type backup_types[] =
+{
+  no_backups, no_backups,
+  simple_backups, simple_backups,
+  numbered_existing_backups, numbered_existing_backups,
+  numbered_backups, numbered_backups
+};
+
+/* Ensure that these two vectors have the same number of elements,
+   not counting the final NULL in the first one.  */
+ARGMATCH_VERIFY (backup_args, backup_types);
+
+/* Return the type of backup specified by VERSION.
+   If VERSION is NULL or the empty string, return numbered_existing_backups.
+   If VERSION is invalid or ambiguous, fail with a diagnostic appropriate
+   for the specified CONTEXT.  Unambiguous abbreviations are accepted.  */
+
+enum backup_type
+get_version (char const *context, char const *version)
+{
+  if (version == 0 || *version == 0)
+    return numbered_existing_backups;
+  else
+    return XARGMATCH (context, version, backup_args, backup_types);
+}
+
+
+/* Return the type of backup specified by VERSION.
+   If VERSION is NULL, use the value of the envvar VERSION_CONTROL.
+   If the specified string is invalid or ambiguous, fail with a diagnostic
+   appropriate for the specified CONTEXT.
+   Unambiguous abbreviations are accepted.  */
+
+enum backup_type
+xget_version (char const *context, char const *version)
+{
+  if (version && *version)
+    return get_version (context, version);
+  else
+    return get_version ("$VERSION_CONTROL", getenv ("VERSION_CONTROL"));
+}
deleted file mode 120000 (symlink)
index 170b4cc2db4f7a1e62233b8fc1bd90611f530a32..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/backup-internal.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1769702281c0762818fe7a41f8c52335c2eebc39
--- /dev/null
@@ -0,0 +1,22 @@
+/* Backup files.
+
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "backupfile.h"
+#include <stdlib.h>
+
+extern char *backupfile_internal (int, char const *, enum backup_type, bool)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
deleted file mode 120000 (symlink)
index 87187d6c9f568723cf5bf6216f019c8799db4028..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/backup-rename.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..521c8d5eed4c6f94503eb2733f6be00cb00bc63b
--- /dev/null
@@ -0,0 +1,31 @@
+/* Rename a file to a backup name, Emacs style.
+
+   Copyright 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "backup-internal.h"
+
+/* Relative to DIR_FD, rename the existing file FILE to a backup name,
+   allocated with malloc, and return the backup name.  On failure
+   return a null pointer, setting errno.  Do not call this function if
+   backup_type == no_backups.  */
+
+char *
+backup_file_rename (int dir_fd, char const *file, enum backup_type backup_type)
+{
+  return backupfile_internal (dir_fd, file, backup_type, true);
+}
deleted file mode 120000 (symlink)
index 0b60759c52aa81822e58e417c0a1b843c246d9d4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/backupfile.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d332604cdae6e4a5f5c25c329d2f10ffbaa01e68
--- /dev/null
@@ -0,0 +1,392 @@
+/* backupfile.c -- make Emacs style backup file names
+
+   Copyright (C) 1990-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and David MacKenzie.
+   Some algorithms adapted from GNU Emacs.  */
+
+#include <config.h>
+
+#include "backup-internal.h"
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdckdint.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "attribute.h"
+#include "basename-lgpl.h"
+#include "ialloc.h"
+#include "opendirat.h"
+#include "renameatu.h"
+
+#ifndef _D_EXACT_NAMLEN
+# define _D_EXACT_NAMLEN(dp) strlen ((dp)->d_name)
+#endif
+
+#if ! (HAVE_PATHCONF && defined _PC_NAME_MAX)
+# define pathconf(file, option) (errno = -1)
+# define fpathconf(fd, option) (errno = -1)
+#endif
+
+#ifndef _POSIX_NAME_MAX
+# define _POSIX_NAME_MAX 14
+#endif
+
+#if defined _XOPEN_NAME_MAX
+# define NAME_MAX_MINIMUM _XOPEN_NAME_MAX
+#else
+# define NAME_MAX_MINIMUM _POSIX_NAME_MAX
+#endif
+
+#ifndef HAVE_DOS_FILE_NAMES
+# define HAVE_DOS_FILE_NAMES 0
+#endif
+#ifndef HAVE_LONG_FILE_NAMES
+# define HAVE_LONG_FILE_NAMES 0
+#endif
+
+/* ISDIGIT differs from isdigit, as follows:
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+     or EOF.
+   - It's typically faster.
+   POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
+   ISDIGIT unless it's important to use the locale's definition
+   of "digit" even when the host does not conform to POSIX.  */
+#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
+
+/* The extension added to file names to produce a simple (as opposed
+   to numbered) backup file name. */
+char const *simple_backup_suffix = NULL;
+
+/* Set SIMPLE_BACKUP_SUFFIX to S, or to a default specified by the
+   environment if S is null.  If S or the environment does not specify
+   a valid backup suffix, use "~".  */
+void
+set_simple_backup_suffix (char const *s)
+{
+  if (!s)
+    s = getenv ("SIMPLE_BACKUP_SUFFIX");
+  simple_backup_suffix = s && *s && s == last_component (s) ? s : "~";
+}
+
+/* If FILE (which was of length FILELEN before an extension was
+   appended to it) is too long, replace the extension with the single
+   char E.  If the result is still too long, remove the char just
+   before E.  Return true if the extension was OK already, false
+   if it needed replacement.
+
+   If DIR_FD is nonnegative, it is a file descriptor for FILE's parent.
+   *BASE_MAX is either 0, or the cached result of a previous call for
+   FILE's parent's _PC_NAME_MAX.  */
+
+static bool
+check_extension (char *file, idx_t filelen, char e,
+                 int dir_fd, idx_t *base_max)
+{
+  char *base = last_component (file);
+  idx_t baselen = base_len (base);
+  idx_t baselen_max = HAVE_LONG_FILE_NAMES ? 255 : NAME_MAX_MINIMUM;
+
+  if (HAVE_DOS_FILE_NAMES || NAME_MAX_MINIMUM < baselen)
+    {
+      /* The new base name is long enough to require a pathconf check.  */
+      if (*base_max == 0)
+        {
+          long name_max;
+          if (dir_fd < 0)
+            {
+              /* Temporarily modify the buffer into its parent
+                 directory name, invoke pathconf on the directory, and
+                 then restore the buffer.  */
+              char tmp[sizeof "."];
+              memcpy (tmp, base, sizeof ".");
+              strcpy (base, ".");
+              errno = 0;
+              name_max = pathconf (file, _PC_NAME_MAX);
+              name_max -= !errno;
+              memcpy (base, tmp, sizeof ".");
+            }
+          else
+            {
+              errno = 0;
+              name_max = fpathconf (dir_fd, _PC_NAME_MAX);
+              name_max -= !errno;
+            }
+
+          *base_max = (0 <= name_max && name_max <= SIZE_MAX ? name_max
+                       : name_max < -1 ? NAME_MAX_MINIMUM : SIZE_MAX);
+        }
+
+      baselen_max = *base_max;
+    }
+
+  if (HAVE_DOS_FILE_NAMES && baselen_max <= 12)
+    {
+      /* Live within DOS's 8.3 limit.  */
+      char *dot = strchr (base, '.');
+      if (!dot)
+        baselen_max = 8;
+      else
+        {
+          char const *second_dot = strchr (dot + 1, '.');
+          baselen_max = (second_dot
+                         ? second_dot - base
+                         : dot + 1 - base + 3);
+        }
+    }
+
+  if (baselen <= baselen_max)
+    return true;
+  else
+    {
+      baselen = file + filelen - base;
+      if (baselen_max <= baselen)
+        baselen = baselen_max - 1;
+      base[baselen] = e;
+      base[baselen + 1] = '\0';
+      return false;
+    }
+}
+
+/* Returned values for NUMBERED_BACKUP.  */
+
+enum numbered_backup_result
+  {
+    /* The new backup name is the same length as an existing backup
+       name, so it's valid for that directory.  */
+    BACKUP_IS_SAME_LENGTH,
+
+    /* Some backup names already exist, but the returned name is longer
+       than any of them, and its length should be checked.  */
+    BACKUP_IS_LONGER,
+
+    /* There are no existing backup names.  The new name's length
+       should be checked.  */
+    BACKUP_IS_NEW,
+
+    /* Memory allocation failure.  */
+    BACKUP_NOMEM
+  };
+
+/* Relative to DIR_FD, *BUFFER contains a file name.
+   Store into *BUFFER the next backup name for the named file,
+   with a version number greater than all the
+   existing numbered backups.  Reallocate *BUFFER as necessary; its
+   initial allocated size is BUFFER_SIZE, which must be at least 5
+   bytes longer than the file name to make room for the initially
+   appended ".~1~".  FILELEN is the length of the original file name.
+   (The original file name is not necessarily null-terminated;
+   FILELEN does not count trailing slashes after a non-slash.)
+   BASE_OFFSET is the offset of the basename in *BUFFER.
+   The returned value indicates what kind of backup was found.  If an
+   I/O or other read error occurs, use the highest backup number that
+   was found.
+
+   *DIRPP is the destination directory.  If *DIRPP is null, open the
+   destination directory and store the resulting stream into *DIRPP
+   and its file descriptor into *PNEW_FD without closing the stream.  */
+
+static enum numbered_backup_result
+numbered_backup (int dir_fd, char **buffer, idx_t buffer_size, idx_t filelen,
+                 idx_t base_offset, DIR **dirpp, int *pnew_fd)
+{
+  enum numbered_backup_result result = BACKUP_IS_NEW;
+  DIR *dirp = *dirpp;
+  char *buf = *buffer;
+  idx_t versionlenmax = 1;
+  idx_t baselen = filelen - base_offset;
+
+  if (dirp)
+    rewinddir (dirp);
+  else
+    {
+      /* Temporarily modify the buffer into its parent directory name,
+         open the directory, and then restore the buffer.  */
+      char tmp[sizeof "."];
+      char *base = buf + base_offset;
+      memcpy (tmp, base, sizeof ".");
+      strcpy (base, ".");
+      dirp = opendirat (dir_fd, buf, 0, pnew_fd);
+      if (!dirp && errno == ENOMEM)
+        result = BACKUP_NOMEM;
+      memcpy (base, tmp, sizeof ".");
+      strcpy (base + baselen, ".~1~");
+      if (!dirp)
+        return result;
+      *dirpp = dirp;
+    }
+
+  for (struct dirent *dp; (dp = readdir (dirp)) != NULL; )
+    {
+      if (_D_EXACT_NAMLEN (dp) < baselen + 4)
+        continue;
+
+      if (memcmp (buf + base_offset, dp->d_name, baselen + 2) != 0)
+        continue;
+
+      char const *p = dp->d_name + baselen + 2;
+
+      /* Check whether this file has a version number and if so,
+         whether it is larger.  Use string operations rather than
+         integer arithmetic, to avoid problems with integer overflow.  */
+
+      if (! ('1' <= *p && *p <= '9'))
+        continue;
+      bool all_9s = (*p == '9');
+      idx_t versionlen;
+      for (versionlen = 1; ISDIGIT (p[versionlen]); versionlen++)
+        all_9s &= (p[versionlen] == '9');
+
+      if (! (p[versionlen] == '~' && !p[versionlen + 1]
+             && (versionlenmax < versionlen
+                 || (versionlenmax == versionlen
+                     && memcmp (buf + filelen + 2, p, versionlen) <= 0))))
+        continue;
+
+      /* This entry has the largest version number seen so far.
+         Append this highest numbered extension to the file name,
+         prepending '0' to the number if it is all 9s.  */
+
+      versionlenmax = all_9s + versionlen;
+      result = (all_9s ? BACKUP_IS_LONGER : BACKUP_IS_SAME_LENGTH);
+      idx_t new_buffer_size = filelen + 2 + versionlenmax + 2;
+      if (buffer_size < new_buffer_size)
+        {
+          idx_t grown;
+          if (! ckd_add (&grown, new_buffer_size, new_buffer_size >> 1))
+            new_buffer_size = grown;
+          char *new_buf = irealloc (buf, new_buffer_size);
+          if (!new_buf)
+            {
+              *buffer = buf;
+              return BACKUP_NOMEM;
+            }
+          buf = new_buf;
+          buffer_size = new_buffer_size;
+        }
+      char *q = buf + filelen;
+      *q++ = '.';
+      *q++ = '~';
+      *q = '0';
+      q += all_9s;
+      memcpy (q, p, versionlen + 2);
+
+      /* Add 1 to the version number.  */
+
+      q += versionlen;
+      while (*--q == '9')
+        *q = '0';
+      ++*q;
+    }
+
+  *buffer = buf;
+  return result;
+}
+
+/* Relative to DIR_FD, return the name of the new backup file for the
+   existing file FILE, allocated with malloc.
+   If RENAME, also rename FILE to the new name.
+   On failure, return NULL and set errno.
+   Do not call this function if backup_type == no_backups.  */
+
+char *
+backupfile_internal (int dir_fd, char const *file,
+                     enum backup_type backup_type, bool rename)
+{
+  idx_t base_offset = last_component (file) - file;
+  idx_t filelen = base_offset + base_len (file + base_offset);
+
+  if (! simple_backup_suffix)
+    set_simple_backup_suffix (NULL);
+
+  /* Allow room for simple or ".~N~" backups.  The guess must be at
+     least sizeof ".~1~", but otherwise will be adjusted as needed.  */
+  idx_t simple_backup_suffix_size = strlen (simple_backup_suffix) + 1;
+  idx_t backup_suffix_size_guess = simple_backup_suffix_size;
+  enum { GUESS = sizeof ".~12345~" };
+  if (backup_suffix_size_guess < GUESS)
+    backup_suffix_size_guess = GUESS;
+
+  idx_t ssize = filelen + backup_suffix_size_guess + 1;
+  char *s = imalloc (ssize);
+  if (!s)
+    return s;
+
+  DIR *dirp = NULL;
+  int sdir = -1;
+  idx_t base_max = 0;
+  while (true)
+    {
+      bool extended = true;
+      memcpy (s, file, filelen);
+
+      if (backup_type == simple_backups)
+        memcpy (s + filelen, simple_backup_suffix, simple_backup_suffix_size);
+      else
+        switch (numbered_backup (dir_fd, &s, ssize, filelen, base_offset,
+                                 &dirp, &sdir))
+          {
+          case BACKUP_IS_SAME_LENGTH:
+            break;
+
+          case BACKUP_IS_NEW:
+            if (backup_type == numbered_existing_backups)
+              {
+                backup_type = simple_backups;
+                memcpy (s + filelen, simple_backup_suffix,
+                        simple_backup_suffix_size);
+              }
+            FALLTHROUGH;
+          case BACKUP_IS_LONGER:
+            extended = check_extension (s, filelen, '~', sdir, &base_max);
+            break;
+
+          case BACKUP_NOMEM:
+            if (dirp)
+              closedir (dirp);
+            free (s);
+            errno = ENOMEM;
+            return NULL;
+          }
+
+      if (! rename)
+        break;
+
+      dir_fd = sdir < 0 ? dir_fd : sdir;
+      idx_t offset = sdir < 0 ? 0 : base_offset;
+      unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE;
+      if (renameatu (dir_fd, file + offset, dir_fd, s + offset, flags) == 0)
+        break;
+      int e = errno;
+      if (! (e == EEXIST && extended))
+        {
+          if (dirp)
+            closedir (dirp);
+          free (s);
+          errno = e;
+          return NULL;
+        }
+    }
+
+  if (dirp)
+    closedir (dirp);
+  return s;
+}
deleted file mode 120000 (symlink)
index 645cfca8de67c0f407530483bc24a540d98bcc65..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/backupfile.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..228b04988922f38d4b7d658d8137da51558e8432
--- /dev/null
@@ -0,0 +1,73 @@
+/* backupfile.h -- declarations for making Emacs style backup file names
+
+   Copyright (C) 1990-1992, 1997-1999, 2003-2004, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef BACKUPFILE_H_
+#define BACKUPFILE_H_
+
+/* This file uses _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_RETURNS_NONNULL.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get AT_FDCWD, as a convenience for users of this file.  */
+#include <fcntl.h>
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* When to make backup files. */
+enum backup_type
+{
+  /* Never make backups. */
+  no_backups,
+
+  /* Make simple backups of every file. */
+  simple_backups,
+
+  /* Make numbered backups of files that already have numbered backups,
+     and simple backups of the others. */
+  numbered_existing_backups,
+
+  /* Make numbered backups of every file. */
+  numbered_backups
+};
+
+#define VALID_BACKUP_TYPE(Type) \
+  ((unsigned int) (Type) <= numbered_backups)
+
+extern char const *simple_backup_suffix;
+
+void set_simple_backup_suffix (char const *);
+char *backup_file_rename (int, char const *, enum backup_type)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+char *find_backup_file_name (int, char const *, enum backup_type)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+enum backup_type get_version (char const *context, char const *arg);
+enum backup_type xget_version (char const *context, char const *arg);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! BACKUPFILE_H_ */
deleted file mode 120000 (symlink)
index 0e07218f8d1b2d9acedef927513efef7bcb3717e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/base32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..270c505e201f6494fb96e67fc7c96fa5d23ba177
--- /dev/null
@@ -0,0 +1,580 @@
+/* base32.c -- Encode binary data using printable characters.
+   Copyright (C) 1999-2001, 2004-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Adapted from Simon Josefsson's base64 code by Gijs van Tulder.
+ *
+ * See also RFC 4648 <https://www.ietf.org/rfc/rfc4648.txt>.
+ *
+ * Be careful with error checking.  Here is how you would typically
+ * use these functions:
+ *
+ * bool ok = base32_decode_alloc (in, inlen, &out, &outlen);
+ * if (!ok)
+ *   FAIL: input was not valid base32
+ * if (out == NULL)
+ *   FAIL: memory allocation error
+ * OK: data in OUT/OUTLEN
+ *
+ * idx_t outlen = base32_encode_alloc (in, inlen, &out);
+ * if (out == NULL && outlen == 0 && inlen != 0)
+ *   FAIL: input too long
+ * if (out == NULL)
+ *   FAIL: memory allocation error
+ * OK: data in OUT/OUTLEN.
+ *
+ */
+
+#include <config.h>
+
+/* Get prototype. */
+#define BASE32_INLINE _GL_EXTERN_INLINE
+#include "base32.h"
+
+/* Get imalloc. */
+#include <ialloc.h>
+
+#include <intprops.h>
+
+#include <string.h>
+
+/* Convert 'char' to 'unsigned char' without casting.  */
+static unsigned char
+to_uchar (char ch)
+{
+  return ch;
+}
+
+/* Base32 encode IN array of size INLEN into OUT array of size OUTLEN.
+   If OUTLEN is less than BASE32_LENGTH(INLEN), write as many bytes as
+   possible.  If OUTLEN is larger than BASE32_LENGTH(INLEN), also zero
+   terminate the output buffer. */
+void
+base32_encode (const char *restrict in, idx_t inlen,
+               char *restrict out, idx_t outlen)
+{
+  static const char b32str[32] =
+    "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+
+  while (inlen && outlen)
+    {
+      *out++ = b32str[(to_uchar (in[0]) >> 3) & 0x1f];
+      if (!--outlen)
+        break;
+      *out++ = b32str[((to_uchar (in[0]) << 2)
+                       + (--inlen ? to_uchar (in[1]) >> 6 : 0))
+                      & 0x1f];
+      if (!--outlen)
+        break;
+      *out++ =
+        (inlen
+         ? b32str[(to_uchar (in[1]) >> 1) & 0x1f]
+         : '=');
+      if (!--outlen)
+        break;
+      *out++ =
+        (inlen
+         ? b32str[((to_uchar (in[1]) << 4)
+                   + (--inlen ? to_uchar (in[2]) >> 4 : 0))
+                  & 0x1f]
+         : '=');
+      if (!--outlen)
+        break;
+      *out++ =
+        (inlen
+         ? b32str[((to_uchar (in[2]) << 1)
+                   + (--inlen ? to_uchar (in[3]) >> 7 : 0))
+                  & 0x1f]
+         : '=');
+      if (!--outlen)
+        break;
+      *out++ =
+        (inlen
+         ? b32str[(to_uchar (in[3]) >> 2) & 0x1f]
+         : '=');
+      if (!--outlen)
+        break;
+      *out++ =
+        (inlen
+         ? b32str[((to_uchar (in[3]) << 3)
+                   + (--inlen ? to_uchar (in[4]) >> 5 : 0))
+                  & 0x1f]
+         : '=');
+      if (!--outlen)
+        break;
+      *out++ = inlen ? b32str[to_uchar (in[4]) & 0x1f] : '=';
+      if (!--outlen)
+        break;
+      if (inlen)
+        inlen--;
+      if (inlen)
+        in += 5;
+    }
+
+  if (outlen)
+    *out = '\0';
+}
+
+/* Allocate a buffer and store zero terminated base32 encoded data
+   from array IN of size INLEN, returning BASE32_LENGTH(INLEN), i.e.,
+   the length of the encoded data, excluding the terminating zero.  On
+   return, the OUT variable will hold a pointer to newly allocated
+   memory that must be deallocated by the caller.  If output string
+   length would overflow, 0 is returned and OUT is set to NULL.  If
+   memory allocation failed, OUT is set to NULL, and the return value
+   indicates length of the requested memory block, i.e.,
+   BASE32_LENGTH(inlen) + 1. */
+idx_t
+base32_encode_alloc (const char *in, idx_t inlen, char **out)
+{
+  /* Check for overflow in outlen computation.
+     Treat negative INLEN as overflow, for better compatibility with
+     pre-2021-08-27 API, which used size_t.  */
+  idx_t in_over_5 = inlen / 5 + (inlen % 5 != 0), outlen;
+  if (! INT_MULTIPLY_OK (in_over_5, 8, &outlen) || inlen < 0)
+    {
+      *out = NULL;
+      return 0;
+    }
+  outlen++;
+
+  *out = imalloc (outlen);
+  if (!*out)
+    return outlen;
+
+  base32_encode (in, inlen, *out, outlen);
+
+  return outlen - 1;
+}
+
+/* With this approach this file works independent of the charset used
+   (think EBCDIC).  However, it does assume that the characters in the
+   Base32 alphabet (A-Z2-7) are encoded in 0..255.  POSIX
+   1003.1-2001 require that char and unsigned char are 8-bit
+   quantities, though, taking care of that problem.  But this may be a
+   potential problem on non-POSIX C99 platforms.
+
+   IBM C V6 for AIX mishandles "#define B32(x) ...'x'...", so use "_"
+   as the formal parameter rather than "x".  */
+#define B32(_)                                  \
+  ((_) == 'A' ? 0                               \
+   : (_) == 'B' ? 1                             \
+   : (_) == 'C' ? 2                             \
+   : (_) == 'D' ? 3                             \
+   : (_) == 'E' ? 4                             \
+   : (_) == 'F' ? 5                             \
+   : (_) == 'G' ? 6                             \
+   : (_) == 'H' ? 7                             \
+   : (_) == 'I' ? 8                             \
+   : (_) == 'J' ? 9                             \
+   : (_) == 'K' ? 10                            \
+   : (_) == 'L' ? 11                            \
+   : (_) == 'M' ? 12                            \
+   : (_) == 'N' ? 13                            \
+   : (_) == 'O' ? 14                            \
+   : (_) == 'P' ? 15                            \
+   : (_) == 'Q' ? 16                            \
+   : (_) == 'R' ? 17                            \
+   : (_) == 'S' ? 18                            \
+   : (_) == 'T' ? 19                            \
+   : (_) == 'U' ? 20                            \
+   : (_) == 'V' ? 21                            \
+   : (_) == 'W' ? 22                            \
+   : (_) == 'X' ? 23                            \
+   : (_) == 'Y' ? 24                            \
+   : (_) == 'Z' ? 25                            \
+   : (_) == '2' ? 26                            \
+   : (_) == '3' ? 27                            \
+   : (_) == '4' ? 28                            \
+   : (_) == '5' ? 29                            \
+   : (_) == '6' ? 30                            \
+   : (_) == '7' ? 31                            \
+   : -1)
+
+signed char const base32_to_int[256] = {
+  B32 (0), B32 (1), B32 (2), B32 (3),
+  B32 (4), B32 (5), B32 (6), B32 (7),
+  B32 (8), B32 (9), B32 (10), B32 (11),
+  B32 (12), B32 (13), B32 (14), B32 (15),
+  B32 (16), B32 (17), B32 (18), B32 (19),
+  B32 (20), B32 (21), B32 (22), B32 (23),
+  B32 (24), B32 (25), B32 (26), B32 (27),
+  B32 (28), B32 (29), B32 (30), B32 (31),
+  B32 (32), B32 (33), B32 (34), B32 (35),
+  B32 (36), B32 (37), B32 (38), B32 (39),
+  B32 (40), B32 (41), B32 (42), B32 (43),
+  B32 (44), B32 (45), B32 (46), B32 (47),
+  B32 (48), B32 (49), B32 (50), B32 (51),
+  B32 (52), B32 (53), B32 (54), B32 (55),
+  B32 (56), B32 (57), B32 (58), B32 (59),
+  B32 (60), B32 (61), B32 (62), B32 (63),
+  B32 (32), B32 (65), B32 (66), B32 (67),
+  B32 (68), B32 (69), B32 (70), B32 (71),
+  B32 (72), B32 (73), B32 (74), B32 (75),
+  B32 (76), B32 (77), B32 (78), B32 (79),
+  B32 (80), B32 (81), B32 (82), B32 (83),
+  B32 (84), B32 (85), B32 (86), B32 (87),
+  B32 (88), B32 (89), B32 (90), B32 (91),
+  B32 (92), B32 (93), B32 (94), B32 (95),
+  B32 (96), B32 (97), B32 (98), B32 (99),
+  B32 (100), B32 (101), B32 (102), B32 (103),
+  B32 (104), B32 (105), B32 (106), B32 (107),
+  B32 (108), B32 (109), B32 (110), B32 (111),
+  B32 (112), B32 (113), B32 (114), B32 (115),
+  B32 (116), B32 (117), B32 (118), B32 (119),
+  B32 (120), B32 (121), B32 (122), B32 (123),
+  B32 (124), B32 (125), B32 (126), B32 (127),
+  B32 (128), B32 (129), B32 (130), B32 (131),
+  B32 (132), B32 (133), B32 (134), B32 (135),
+  B32 (136), B32 (137), B32 (138), B32 (139),
+  B32 (140), B32 (141), B32 (142), B32 (143),
+  B32 (144), B32 (145), B32 (146), B32 (147),
+  B32 (148), B32 (149), B32 (150), B32 (151),
+  B32 (152), B32 (153), B32 (154), B32 (155),
+  B32 (156), B32 (157), B32 (158), B32 (159),
+  B32 (160), B32 (161), B32 (162), B32 (163),
+  B32 (132), B32 (165), B32 (166), B32 (167),
+  B32 (168), B32 (169), B32 (170), B32 (171),
+  B32 (172), B32 (173), B32 (174), B32 (175),
+  B32 (176), B32 (177), B32 (178), B32 (179),
+  B32 (180), B32 (181), B32 (182), B32 (183),
+  B32 (184), B32 (185), B32 (186), B32 (187),
+  B32 (188), B32 (189), B32 (190), B32 (191),
+  B32 (192), B32 (193), B32 (194), B32 (195),
+  B32 (196), B32 (197), B32 (198), B32 (199),
+  B32 (200), B32 (201), B32 (202), B32 (203),
+  B32 (204), B32 (205), B32 (206), B32 (207),
+  B32 (208), B32 (209), B32 (210), B32 (211),
+  B32 (212), B32 (213), B32 (214), B32 (215),
+  B32 (216), B32 (217), B32 (218), B32 (219),
+  B32 (220), B32 (221), B32 (222), B32 (223),
+  B32 (224), B32 (225), B32 (226), B32 (227),
+  B32 (228), B32 (229), B32 (230), B32 (231),
+  B32 (232), B32 (233), B32 (234), B32 (235),
+  B32 (236), B32 (237), B32 (238), B32 (239),
+  B32 (240), B32 (241), B32 (242), B32 (243),
+  B32 (244), B32 (245), B32 (246), B32 (247),
+  B32 (248), B32 (249), B32 (250), B32 (251),
+  B32 (252), B32 (253), B32 (254), B32 (255)
+};
+
+/* If CTX->i is 0 or 8, there are eight or more bytes in [*IN..IN_END), and
+   none of those eight is a newline, then return *IN.  Otherwise, copy up to
+   4 - CTX->i non-newline bytes from that range into CTX->buf, starting at
+   index CTX->i and setting CTX->i to reflect the number of bytes copied,
+   and return CTX->buf.  In either case, advance *IN to point to the byte
+   after the last one processed, and set *N_NON_NEWLINE to the number of
+   verified non-newline bytes accessible through the returned pointer.  */
+static char *
+get_8 (struct base32_decode_context *ctx,
+       char const *restrict *in, char const *restrict in_end,
+       idx_t *n_non_newline)
+{
+  if (ctx->i == 8)
+    ctx->i = 0;
+
+  if (ctx->i == 0)
+    {
+      char const *t = *in;
+      if (8 <= in_end - *in && memchr (t, '\n', 8) == NULL)
+        {
+          /* This is the common case: no newline.  */
+          *in += 8;
+          *n_non_newline = 8;
+          return (char *) t;
+        }
+    }
+
+  {
+    /* Copy non-newline bytes into BUF.  */
+    char const *p = *in;
+    while (p < in_end)
+      {
+        char c = *p++;
+        if (c != '\n')
+          {
+            ctx->buf[ctx->i++] = c;
+            if (ctx->i == 8)
+              break;
+          }
+      }
+
+    *in = p;
+    *n_non_newline = ctx->i;
+    return ctx->buf;
+  }
+}
+
+#define return_false                            \
+  do                                            \
+    {                                           \
+      *outp = out;                              \
+      return false;                             \
+    }                                           \
+  while (false)
+
+/* Decode eight bytes of base32-encoded data, IN, of length INLEN
+   into the output buffer, *OUT, of size *OUTLEN bytes.  Return true if
+   decoding is successful, false otherwise.  If *OUTLEN is too small,
+   as many bytes as possible are written to *OUT.  On return, advance
+   *OUT to point to the byte after the last one written, and decrement
+   *OUTLEN to reflect the number of bytes remaining in *OUT.  */
+static bool
+decode_8 (char const *restrict in, idx_t inlen,
+          char *restrict *outp, idx_t *outleft)
+{
+  char *out = *outp;
+  if (inlen < 8)
+    return false;
+
+  if (!isbase32 (in[0]) || !isbase32 (in[1]))
+    return false;
+
+  if (*outleft)
+    {
+      *out++ = ((base32_to_int[to_uchar (in[0])] << 3)
+                | (base32_to_int[to_uchar (in[1])] >> 2));
+      --*outleft;
+    }
+
+  if (in[2] == '=')
+    {
+      if (in[3] != '=' || in[4] != '=' || in[5] != '='
+          || in[6] != '=' || in[7] != '=')
+        return_false;
+
+      /* Reject non-canonical encodings.  */
+      if (base32_to_int[to_uchar (in[1])] & 0x03)
+        return_false;
+    }
+  else
+    {
+      if (!isbase32 (in[2]) || !isbase32 (in[3]))
+        return_false;
+
+      if (*outleft)
+        {
+          *out++ = ((base32_to_int[to_uchar (in[1])] << 6)
+                    | (base32_to_int[to_uchar (in[2])] << 1)
+                    | (base32_to_int[to_uchar (in[3])] >> 4));
+          --*outleft;
+        }
+
+      if (in[4] == '=')
+        {
+          if (in[5] != '=' || in[6] != '=' || in[7] != '=')
+            return_false;
+
+          /* Reject non-canonical encodings.  */
+          if (base32_to_int[to_uchar (in[3])] & 0x0f)
+            return_false;
+        }
+      else
+        {
+          if (!isbase32 (in[4]))
+            return_false;
+
+          if (*outleft)
+            {
+              *out++ = ((base32_to_int[to_uchar (in[3])] << 4)
+                        | (base32_to_int[to_uchar (in[4])] >> 1));
+              --*outleft;
+            }
+
+          if (in[5] == '=')
+            {
+              if (in[6] != '=' || in[7] != '=')
+                return_false;
+
+              /* Reject non-canonical encodings.  */
+              if (base32_to_int[to_uchar (in[4])] & 0x01)
+                return_false;
+            }
+          else
+            {
+              if (!isbase32 (in[5]) || !isbase32 (in[6]))
+                return_false;
+
+              if (*outleft)
+                {
+                  *out++ = ((base32_to_int[to_uchar (in[4])] << 7)
+                            | (base32_to_int[to_uchar (in[5])] << 2)
+                            | (base32_to_int[to_uchar (in[6])] >> 3));
+                  --*outleft;
+                }
+
+              if (in[7] != '=')
+                {
+                  if (!isbase32 (in[7]))
+                    return_false;
+
+                  if (*outleft)
+                    {
+                      *out++ = ((base32_to_int[to_uchar (in[6])] << 5)
+                                | (base32_to_int[to_uchar (in[7])]));
+                      --*outleft;
+                    }
+                }
+              else
+                {
+                  /* Reject non-canonical encodings.  */
+                  if (base32_to_int[to_uchar (in[6])] & 0x07)
+                    return_false;
+                }
+            }
+        }
+    }
+
+  *outp = out;
+  return true;
+}
+
+/* Decode base32-encoded input array IN of length INLEN to output array
+   OUT that can hold *OUTLEN bytes.  The input data may be interspersed
+   with newlines.  Return true if decoding was successful, i.e. if the
+   input was valid base32 data, false otherwise.  If *OUTLEN is too
+   small, as many bytes as possible will be written to OUT.  On return,
+   *OUTLEN holds the length of decoded bytes in OUT.  Note that as soon
+   as any non-alphabet, non-newline character is encountered, decoding
+   is stopped and false is returned.  If INLEN is zero, then process
+   only whatever data is stored in CTX.
+
+   Initially, CTX must have been initialized via base32_decode_ctx_init.
+   Subsequent calls to this function must reuse whatever state is recorded
+   in that buffer.  It is necessary for when a octuple of base32 input
+   bytes spans two input buffers.
+
+   If CTX is NULL then newlines are treated as garbage and the input
+   buffer is processed as a unit.  */
+
+bool
+base32_decode_ctx (struct base32_decode_context *ctx,
+                   const char *restrict in, idx_t inlen,
+                   char *restrict out, idx_t *outlen)
+{
+  idx_t outleft = *outlen;
+  bool ignore_newlines = ctx != NULL;
+  bool flush_ctx = false;
+  unsigned int ctx_i = 0;
+
+  if (ignore_newlines)
+    {
+      ctx_i = ctx->i;
+      flush_ctx = inlen == 0;
+    }
+
+
+  while (true)
+    {
+      idx_t outleft_save = outleft;
+      if (ctx_i == 0 && !flush_ctx)
+        {
+          while (true)
+            {
+              /* Save a copy of outleft, in case we need to re-parse this
+                 block of four bytes.  */
+              outleft_save = outleft;
+              if (!decode_8 (in, inlen, &out, &outleft))
+                break;
+
+              in += 8;
+              inlen -= 8;
+            }
+        }
+
+      if (inlen == 0 && !flush_ctx)
+        break;
+
+      /* Handle the common case of 72-byte wrapped lines.
+         This also handles any other multiple-of-8-byte wrapping.  */
+      if (inlen && *in == '\n' && ignore_newlines)
+        {
+          ++in;
+          --inlen;
+          continue;
+        }
+
+      /* Restore OUT and OUTLEFT.  */
+      out -= outleft_save - outleft;
+      outleft = outleft_save;
+
+      {
+        char const *in_end = in + inlen;
+        char const *non_nl;
+
+        if (ignore_newlines)
+          non_nl = get_8 (ctx, &in, in_end, &inlen);
+        else
+          non_nl = in;  /* Might have nl in this case. */
+
+        /* If the input is empty or consists solely of newlines (0 non-newlines),
+           then we're done.  Likewise if there are fewer than 8 bytes when not
+           flushing context and not treating newlines as garbage.  */
+        if (inlen == 0 || (inlen < 8 && !flush_ctx && ignore_newlines))
+          {
+            inlen = 0;
+            break;
+          }
+        if (!decode_8 (non_nl, inlen, &out, &outleft))
+          break;
+
+        inlen = in_end - in;
+      }
+    }
+
+  *outlen -= outleft;
+
+  return inlen == 0;
+}
+
+/* Allocate an output buffer in *OUT, and decode the base32 encoded
+   data stored in IN of size INLEN to the *OUT buffer.  On return, the
+   size of the decoded data is stored in *OUTLEN.  OUTLEN may be NULL,
+   if the caller is not interested in the decoded length.  *OUT may be
+   NULL to indicate an out of memory error, in which case *OUTLEN
+   contains the size of the memory block needed.  The function returns
+   true on successful decoding and memory allocation errors.  (Use the
+   *OUT and *OUTLEN parameters to differentiate between successful
+   decoding and memory error.)  The function returns false if the
+   input was invalid, in which case *OUT is NULL and *OUTLEN is
+   undefined. */
+bool
+base32_decode_alloc_ctx (struct base32_decode_context *ctx,
+                         const char *in, idx_t inlen, char **out,
+                         idx_t *outlen)
+{
+  /* This may allocate a few bytes too many, depending on input,
+     but it's not worth the extra CPU time to compute the exact size.
+     The exact size is 5 * inlen / 8, minus one or more bytes if the
+     input is padded with one or more "=".
+     Shifting before multiplying avoids the possibility of overflow.  */
+  idx_t needlen = 5 * ((inlen >> 3) + 1);
+
+  *out = imalloc (needlen);
+  if (!*out)
+    return true;
+
+  if (!base32_decode_ctx (ctx, in, inlen, *out, &needlen))
+    {
+      free (*out);
+      *out = NULL;
+      return false;
+    }
+
+  if (outlen)
+    *outlen = needlen;
+
+  return true;
+}
deleted file mode 120000 (symlink)
index c984212c885c95aeba2222112371df7001f05105..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/base32.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eadbeae56c1d5aa1d9ff278982f833d8fc957b25
--- /dev/null
@@ -0,0 +1,99 @@
+/* base32.h -- Encode binary data using printable characters.
+   Copyright (C) 2004-2006, 2009-2024 Free Software Foundation, Inc.
+   Adapted from Simon Josefsson's base64 code by Gijs van Tulder.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef BASE32_H
+#define BASE32_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get idx_t.  */
+#include <idx.h>
+
+/* Pacify GCC in isubase32.  */
+#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef BASE32_INLINE
+# define BASE32_INLINE _GL_INLINE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This uses that the expression (n+(k-1))/k means the smallest
+   integer >= n/k, i.e., the ceiling of n/k.  */
+#define BASE32_LENGTH(inlen) ((((inlen) + 4) / 5) * 8)
+
+struct base32_decode_context
+{
+  int i;
+  char buf[8];
+};
+
+extern signed char const base32_to_int[256];
+
+BASE32_INLINE bool
+isubase32 (unsigned char ch)
+{
+  return ch < sizeof base32_to_int && 0 <= base32_to_int[ch];
+}
+
+BASE32_INLINE bool
+isbase32 (char ch)
+{
+  return isubase32 (ch);
+}
+
+extern void base32_encode (const char *restrict in, idx_t inlen,
+                           char *restrict out, idx_t outlen);
+
+extern idx_t base32_encode_alloc (const char *in, idx_t inlen, char **out);
+
+/* Initialize decode-context buffer, CTX.  */
+BASE32_INLINE void
+base32_decode_ctx_init (struct base32_decode_context *ctx)
+{
+  ctx->i = 0;
+}
+
+extern bool base32_decode_ctx (struct base32_decode_context *ctx,
+                               const char *restrict in, idx_t inlen,
+                               char *restrict out, idx_t *outlen);
+
+extern bool base32_decode_alloc_ctx (struct base32_decode_context *ctx,
+                                     const char *in, idx_t inlen,
+                                     char **out, idx_t *outlen);
+
+#define base32_decode(in, inlen, out, outlen) \
+        base32_decode_ctx (NULL, in, inlen, out, outlen)
+
+#define base32_decode_alloc(in, inlen, out, outlen) \
+        base32_decode_alloc_ctx (NULL, in, inlen, out, outlen)
+
+#ifdef __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* BASE32_H */
deleted file mode 120000 (symlink)
index f064c5af6a27335872497dd99475de4f54c1b46b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/base64.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c8b3b76b0b9bcbceeee64505f1ae52cf37b75859
--- /dev/null
@@ -0,0 +1,582 @@
+/* base64.c -- Encode binary data using printable characters.
+   Copyright (C) 1999-2001, 2004-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson.  Partially adapted from GNU MailUtils
+ * (mailbox/filter_trans.c, as of 2004-11-28).  Improved by review
+ * from Paul Eggert, Bruno Haible, and Stepan Kasal.
+ *
+ * See also RFC 4648 <https://www.ietf.org/rfc/rfc4648.txt>.
+ *
+ * Be careful with error checking.  Here is how you would typically
+ * use these functions:
+ *
+ * bool ok = base64_decode_alloc (in, inlen, &out, &outlen);
+ * if (!ok)
+ *   FAIL: input was not valid base64
+ * if (out == NULL)
+ *   FAIL: memory allocation error
+ * OK: data in OUT/OUTLEN
+ *
+ * idx_t outlen = base64_encode_alloc (in, inlen, &out);
+ * if (out == NULL && outlen == 0 && inlen != 0)
+ *   FAIL: input too long
+ * if (out == NULL)
+ *   FAIL: memory allocation error
+ * OK: data in OUT/OUTLEN.
+ *
+ */
+
+#include <config.h>
+
+/* Get prototype. */
+#define BASE64_INLINE _GL_EXTERN_INLINE
+#include "base64.h"
+
+/* Get imalloc. */
+#include <ialloc.h>
+
+#include <intprops.h>
+
+#include <string.h>
+
+/* Convert 'char' to 'unsigned char' without casting.  */
+static unsigned char
+to_uchar (char ch)
+{
+  return ch;
+}
+
+static const char b64c[64] =
+  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+/* Base64 encode IN array of size INLEN into OUT array. OUT needs
+   to be of length >= BASE64_LENGTH(INLEN), and INLEN needs to be
+   a multiple of 3.  */
+static void
+base64_encode_fast (const char *restrict in, idx_t inlen, char *restrict out)
+{
+  while (inlen)
+    {
+      *out++ = b64c[(to_uchar (in[0]) >> 2) & 0x3f];
+      *out++ = b64c[((to_uchar (in[0]) << 4) + (to_uchar (in[1]) >> 4)) & 0x3f];
+      *out++ = b64c[((to_uchar (in[1]) << 2) + (to_uchar (in[2]) >> 6)) & 0x3f];
+      *out++ = b64c[to_uchar (in[2]) & 0x3f];
+
+      inlen -= 3;
+      in += 3;
+    }
+}
+
+/* Base64 encode IN array of size INLEN into OUT array of size OUTLEN.
+   If OUTLEN is less than BASE64_LENGTH(INLEN), write as many bytes as
+   possible.  If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
+   terminate the output buffer. */
+void
+base64_encode (const char *restrict in, idx_t inlen,
+               char *restrict out, idx_t outlen)
+{
+  /* Note this outlen constraint can be enforced at compile time.
+     I.E. that the output buffer is exactly large enough to hold
+     the encoded inlen bytes.  The inlen constraints (of corresponding
+     to outlen, and being a multiple of 3) can change at runtime
+     at the end of input.  However the common case when reading
+     large inputs is to have both constraints satisfied, so we depend
+     on both in base_encode_fast().  */
+  if (outlen % 4 == 0 && inlen == (outlen >> 2) * 3)
+    {
+      base64_encode_fast (in, inlen, out);
+      return;
+    }
+
+  while (inlen && outlen)
+    {
+      *out++ = b64c[(to_uchar (in[0]) >> 2) & 0x3f];
+      if (!--outlen)
+        break;
+      *out++ = b64c[((to_uchar (in[0]) << 4)
+                       + (--inlen ? to_uchar (in[1]) >> 4 : 0))
+                      & 0x3f];
+      if (!--outlen)
+        break;
+      *out++ =
+        (inlen
+         ? b64c[((to_uchar (in[1]) << 2)
+                   + (--inlen ? to_uchar (in[2]) >> 6 : 0))
+                  & 0x3f]
+         : '=');
+      if (!--outlen)
+        break;
+      *out++ = inlen ? b64c[to_uchar (in[2]) & 0x3f] : '=';
+      if (!--outlen)
+        break;
+      if (inlen)
+        inlen--;
+      if (inlen)
+        in += 3;
+    }
+
+  if (outlen)
+    *out = '\0';
+}
+
+/* Allocate a buffer and store zero terminated base64 encoded data
+   from array IN of size INLEN, returning BASE64_LENGTH(INLEN), i.e.,
+   the length of the encoded data, excluding the terminating zero.  On
+   return, the OUT variable will hold a pointer to newly allocated
+   memory that must be deallocated by the caller.  If output string
+   length would overflow, 0 is returned and OUT is set to NULL.  If
+   memory allocation failed, OUT is set to NULL, and the return value
+   indicates length of the requested memory block, i.e.,
+   BASE64_LENGTH(inlen) + 1. */
+idx_t
+base64_encode_alloc (const char *in, idx_t inlen, char **out)
+{
+  /* Check for overflow in outlen computation.
+     Treat negative INLEN as overflow, for better compatibility with
+     pre-2021-08-27 API, which used size_t.  */
+  idx_t in_over_3 = inlen / 3 + (inlen % 3 != 0), outlen;
+  if (! INT_MULTIPLY_OK (in_over_3, 4, &outlen) || inlen < 0)
+    {
+      *out = NULL;
+      return 0;
+    }
+  outlen++;
+
+  *out = imalloc (outlen);
+  if (!*out)
+    return outlen;
+
+  base64_encode (in, inlen, *out, outlen);
+
+  return outlen - 1;
+}
+
+/* With this approach this file works independent of the charset used
+   (think EBCDIC).  However, it does assume that the characters in the
+   Base64 alphabet (A-Za-z0-9+/) are encoded in 0..255.  POSIX
+   1003.1-2001 require that char and unsigned char are 8-bit
+   quantities, though, taking care of that problem.  But this may be a
+   potential problem on non-POSIX C99 platforms.
+
+   IBM C V6 for AIX mishandles "#define B64(x) ...'x'...", so use "_"
+   as the formal parameter rather than "x".  */
+#define B64(_)                                  \
+  ((_) == 'A' ? 0                               \
+   : (_) == 'B' ? 1                             \
+   : (_) == 'C' ? 2                             \
+   : (_) == 'D' ? 3                             \
+   : (_) == 'E' ? 4                             \
+   : (_) == 'F' ? 5                             \
+   : (_) == 'G' ? 6                             \
+   : (_) == 'H' ? 7                             \
+   : (_) == 'I' ? 8                             \
+   : (_) == 'J' ? 9                             \
+   : (_) == 'K' ? 10                            \
+   : (_) == 'L' ? 11                            \
+   : (_) == 'M' ? 12                            \
+   : (_) == 'N' ? 13                            \
+   : (_) == 'O' ? 14                            \
+   : (_) == 'P' ? 15                            \
+   : (_) == 'Q' ? 16                            \
+   : (_) == 'R' ? 17                            \
+   : (_) == 'S' ? 18                            \
+   : (_) == 'T' ? 19                            \
+   : (_) == 'U' ? 20                            \
+   : (_) == 'V' ? 21                            \
+   : (_) == 'W' ? 22                            \
+   : (_) == 'X' ? 23                            \
+   : (_) == 'Y' ? 24                            \
+   : (_) == 'Z' ? 25                            \
+   : (_) == 'a' ? 26                            \
+   : (_) == 'b' ? 27                            \
+   : (_) == 'c' ? 28                            \
+   : (_) == 'd' ? 29                            \
+   : (_) == 'e' ? 30                            \
+   : (_) == 'f' ? 31                            \
+   : (_) == 'g' ? 32                            \
+   : (_) == 'h' ? 33                            \
+   : (_) == 'i' ? 34                            \
+   : (_) == 'j' ? 35                            \
+   : (_) == 'k' ? 36                            \
+   : (_) == 'l' ? 37                            \
+   : (_) == 'm' ? 38                            \
+   : (_) == 'n' ? 39                            \
+   : (_) == 'o' ? 40                            \
+   : (_) == 'p' ? 41                            \
+   : (_) == 'q' ? 42                            \
+   : (_) == 'r' ? 43                            \
+   : (_) == 's' ? 44                            \
+   : (_) == 't' ? 45                            \
+   : (_) == 'u' ? 46                            \
+   : (_) == 'v' ? 47                            \
+   : (_) == 'w' ? 48                            \
+   : (_) == 'x' ? 49                            \
+   : (_) == 'y' ? 50                            \
+   : (_) == 'z' ? 51                            \
+   : (_) == '0' ? 52                            \
+   : (_) == '1' ? 53                            \
+   : (_) == '2' ? 54                            \
+   : (_) == '3' ? 55                            \
+   : (_) == '4' ? 56                            \
+   : (_) == '5' ? 57                            \
+   : (_) == '6' ? 58                            \
+   : (_) == '7' ? 59                            \
+   : (_) == '8' ? 60                            \
+   : (_) == '9' ? 61                            \
+   : (_) == '+' ? 62                            \
+   : (_) == '/' ? 63                            \
+   : -1)
+
+signed char const base64_to_int[256] = {
+  B64 (0), B64 (1), B64 (2), B64 (3),
+  B64 (4), B64 (5), B64 (6), B64 (7),
+  B64 (8), B64 (9), B64 (10), B64 (11),
+  B64 (12), B64 (13), B64 (14), B64 (15),
+  B64 (16), B64 (17), B64 (18), B64 (19),
+  B64 (20), B64 (21), B64 (22), B64 (23),
+  B64 (24), B64 (25), B64 (26), B64 (27),
+  B64 (28), B64 (29), B64 (30), B64 (31),
+  B64 (32), B64 (33), B64 (34), B64 (35),
+  B64 (36), B64 (37), B64 (38), B64 (39),
+  B64 (40), B64 (41), B64 (42), B64 (43),
+  B64 (44), B64 (45), B64 (46), B64 (47),
+  B64 (48), B64 (49), B64 (50), B64 (51),
+  B64 (52), B64 (53), B64 (54), B64 (55),
+  B64 (56), B64 (57), B64 (58), B64 (59),
+  B64 (60), B64 (61), B64 (62), B64 (63),
+  B64 (64), B64 (65), B64 (66), B64 (67),
+  B64 (68), B64 (69), B64 (70), B64 (71),
+  B64 (72), B64 (73), B64 (74), B64 (75),
+  B64 (76), B64 (77), B64 (78), B64 (79),
+  B64 (80), B64 (81), B64 (82), B64 (83),
+  B64 (84), B64 (85), B64 (86), B64 (87),
+  B64 (88), B64 (89), B64 (90), B64 (91),
+  B64 (92), B64 (93), B64 (94), B64 (95),
+  B64 (96), B64 (97), B64 (98), B64 (99),
+  B64 (100), B64 (101), B64 (102), B64 (103),
+  B64 (104), B64 (105), B64 (106), B64 (107),
+  B64 (108), B64 (109), B64 (110), B64 (111),
+  B64 (112), B64 (113), B64 (114), B64 (115),
+  B64 (116), B64 (117), B64 (118), B64 (119),
+  B64 (120), B64 (121), B64 (122), B64 (123),
+  B64 (124), B64 (125), B64 (126), B64 (127),
+  B64 (128), B64 (129), B64 (130), B64 (131),
+  B64 (132), B64 (133), B64 (134), B64 (135),
+  B64 (136), B64 (137), B64 (138), B64 (139),
+  B64 (140), B64 (141), B64 (142), B64 (143),
+  B64 (144), B64 (145), B64 (146), B64 (147),
+  B64 (148), B64 (149), B64 (150), B64 (151),
+  B64 (152), B64 (153), B64 (154), B64 (155),
+  B64 (156), B64 (157), B64 (158), B64 (159),
+  B64 (160), B64 (161), B64 (162), B64 (163),
+  B64 (164), B64 (165), B64 (166), B64 (167),
+  B64 (168), B64 (169), B64 (170), B64 (171),
+  B64 (172), B64 (173), B64 (174), B64 (175),
+  B64 (176), B64 (177), B64 (178), B64 (179),
+  B64 (180), B64 (181), B64 (182), B64 (183),
+  B64 (184), B64 (185), B64 (186), B64 (187),
+  B64 (188), B64 (189), B64 (190), B64 (191),
+  B64 (192), B64 (193), B64 (194), B64 (195),
+  B64 (196), B64 (197), B64 (198), B64 (199),
+  B64 (200), B64 (201), B64 (202), B64 (203),
+  B64 (204), B64 (205), B64 (206), B64 (207),
+  B64 (208), B64 (209), B64 (210), B64 (211),
+  B64 (212), B64 (213), B64 (214), B64 (215),
+  B64 (216), B64 (217), B64 (218), B64 (219),
+  B64 (220), B64 (221), B64 (222), B64 (223),
+  B64 (224), B64 (225), B64 (226), B64 (227),
+  B64 (228), B64 (229), B64 (230), B64 (231),
+  B64 (232), B64 (233), B64 (234), B64 (235),
+  B64 (236), B64 (237), B64 (238), B64 (239),
+  B64 (240), B64 (241), B64 (242), B64 (243),
+  B64 (244), B64 (245), B64 (246), B64 (247),
+  B64 (248), B64 (249), B64 (250), B64 (251),
+  B64 (252), B64 (253), B64 (254), B64 (255)
+};
+
+/* If CTX->i is 0 or 4, there are four or more bytes in [*IN..IN_END), and
+   none of those four is a newline, then return *IN.  Otherwise, copy up to
+   4 - CTX->i non-newline bytes from that range into CTX->buf, starting at
+   index CTX->i and setting CTX->i to reflect the number of bytes copied,
+   and return CTX->buf.  In either case, advance *IN to point to the byte
+   after the last one processed, and set *N_NON_NEWLINE to the number of
+   verified non-newline bytes accessible through the returned pointer.  */
+static char *
+get_4 (struct base64_decode_context *ctx,
+       char const *restrict *in, char const *restrict in_end,
+       idx_t *n_non_newline)
+{
+  if (ctx->i == 4)
+    ctx->i = 0;
+
+  if (ctx->i == 0)
+    {
+      char const *t = *in;
+      if (4 <= in_end - *in && memchr (t, '\n', 4) == NULL)
+        {
+          /* This is the common case: no newline.  */
+          *in += 4;
+          *n_non_newline = 4;
+          return (char *) t;
+        }
+    }
+
+  {
+    /* Copy non-newline bytes into BUF.  */
+    char const *p = *in;
+    while (p < in_end)
+      {
+        char c = *p++;
+        if (c != '\n')
+          {
+            ctx->buf[ctx->i++] = c;
+            if (ctx->i == 4)
+              break;
+          }
+      }
+
+    *in = p;
+    *n_non_newline = ctx->i;
+    return ctx->buf;
+  }
+}
+
+#define return_false                            \
+  do                                            \
+    {                                           \
+      *outp = out;                              \
+      return false;                             \
+    }                                           \
+  while (false)
+
+/* Decode up to four bytes of base64-encoded data, IN, of length INLEN
+   into the output buffer, *OUT, of size *OUTLEN bytes.  Return true if
+   decoding is successful, false otherwise.  If *OUTLEN is too small,
+   as many bytes as possible are written to *OUT.  On return, advance
+   *OUT to point to the byte after the last one written, and decrement
+   *OUTLEN to reflect the number of bytes remaining in *OUT.  */
+static bool
+decode_4 (char const *restrict in, idx_t inlen,
+          char *restrict *outp, idx_t *outleft)
+{
+  char *out = *outp;
+  if (inlen < 2)
+    return false;
+
+  if (!isbase64 (in[0]) || !isbase64 (in[1]))
+    return false;
+
+  if (*outleft)
+    {
+      *out++ = ((base64_to_int[to_uchar (in[0])] << 2)
+                | (base64_to_int[to_uchar (in[1])] >> 4));
+      --*outleft;
+    }
+
+  if (inlen == 2)
+    return_false;
+
+  if (in[2] == '=')
+    {
+      if (inlen != 4)
+        return_false;
+
+      if (in[3] != '=')
+        return_false;
+
+      /* Reject non-canonical encodings.  */
+      if (base64_to_int[to_uchar (in[1])] & 0x0f)
+        return_false;
+    }
+  else
+    {
+      if (!isbase64 (in[2]))
+        return_false;
+
+      if (*outleft)
+        {
+          *out++ = (((base64_to_int[to_uchar (in[1])] << 4) & 0xf0)
+                    | (base64_to_int[to_uchar (in[2])] >> 2));
+          --*outleft;
+        }
+
+      if (inlen == 3)
+        return_false;
+
+      if (in[3] == '=')
+        {
+          if (inlen != 4)
+            return_false;
+
+          /* Reject non-canonical encodings.  */
+          if (base64_to_int[to_uchar (in[2])] & 0x03)
+            return_false;
+        }
+      else
+        {
+          if (!isbase64 (in[3]))
+            return_false;
+
+          if (*outleft)
+            {
+              *out++ = (((base64_to_int[to_uchar (in[2])] << 6) & 0xc0)
+                        | base64_to_int[to_uchar (in[3])]);
+              --*outleft;
+            }
+        }
+    }
+
+  *outp = out;
+  return true;
+}
+
+/* Decode base64-encoded input array IN of length INLEN to output array
+   OUT that can hold *OUTLEN bytes.  The input data may be interspersed
+   with newlines.  Return true if decoding was successful, i.e. if the
+   input was valid base64 data, false otherwise.  If *OUTLEN is too
+   small, as many bytes as possible will be written to OUT.  On return,
+   *OUTLEN holds the length of decoded bytes in OUT.  Note that as soon
+   as any non-alphabet, non-newline character is encountered, decoding
+   is stopped and false is returned.  If INLEN is zero, then process
+   only whatever data is stored in CTX.
+
+   Initially, CTX must have been initialized via base64_decode_ctx_init.
+   Subsequent calls to this function must reuse whatever state is recorded
+   in that buffer.  It is necessary for when a quadruple of base64 input
+   bytes spans two input buffers.
+
+   If CTX is NULL then newlines are treated as garbage and the input
+   buffer is processed as a unit.  */
+
+bool
+base64_decode_ctx (struct base64_decode_context *ctx,
+                   const char *restrict in, idx_t inlen,
+                   char *restrict out, idx_t *outlen)
+{
+  idx_t outleft = *outlen;
+  bool ignore_newlines = ctx != NULL;
+  bool flush_ctx = false;
+  unsigned int ctx_i = 0;
+
+  if (ignore_newlines)
+    {
+      ctx_i = ctx->i;
+      flush_ctx = inlen == 0;
+    }
+
+
+  while (true)
+    {
+      idx_t outleft_save = outleft;
+      if (ctx_i == 0 && !flush_ctx)
+        {
+          while (true)
+            {
+              /* Save a copy of outleft, in case we need to re-parse this
+                 block of four bytes.  */
+              outleft_save = outleft;
+              if (!decode_4 (in, inlen, &out, &outleft))
+                break;
+
+              in += 4;
+              inlen -= 4;
+            }
+        }
+
+      if (inlen == 0 && !flush_ctx)
+        break;
+
+      /* Handle the common case of 72-byte wrapped lines.
+         This also handles any other multiple-of-4-byte wrapping.  */
+      if (inlen && *in == '\n' && ignore_newlines)
+        {
+          ++in;
+          --inlen;
+          continue;
+        }
+
+      /* Restore OUT and OUTLEFT.  */
+      out -= outleft_save - outleft;
+      outleft = outleft_save;
+
+      {
+        char const *in_end = in + inlen;
+        char const *non_nl;
+
+        if (ignore_newlines)
+          non_nl = get_4 (ctx, &in, in_end, &inlen);
+        else
+          non_nl = in;  /* Might have nl in this case. */
+
+        /* If the input is empty or consists solely of newlines (0 non-newlines),
+           then we're done.  Likewise if there are fewer than 4 bytes when not
+           flushing context and not treating newlines as garbage.  */
+        if (inlen == 0 || (inlen < 4 && !flush_ctx && ignore_newlines))
+          {
+            inlen = 0;
+            break;
+          }
+        if (!decode_4 (non_nl, inlen, &out, &outleft))
+          break;
+
+        inlen = in_end - in;
+      }
+    }
+
+  *outlen -= outleft;
+
+  return inlen == 0;
+}
+
+/* Allocate an output buffer in *OUT, and decode the base64 encoded
+   data stored in IN of size INLEN to the *OUT buffer.  On return, the
+   size of the decoded data is stored in *OUTLEN.  OUTLEN may be NULL,
+   if the caller is not interested in the decoded length.  *OUT may be
+   NULL to indicate an out of memory error, in which case *OUTLEN
+   contains the size of the memory block needed.  The function returns
+   true on successful decoding and memory allocation errors.  (Use the
+   *OUT and *OUTLEN parameters to differentiate between successful
+   decoding and memory error.)  The function returns false if the
+   input was invalid, in which case *OUT is NULL and *OUTLEN is
+   undefined. */
+bool
+base64_decode_alloc_ctx (struct base64_decode_context *ctx,
+                         const char *in, idx_t inlen, char **out,
+                         idx_t *outlen)
+{
+  /* This may allocate a few bytes too many, depending on input,
+     but it's not worth the extra CPU time to compute the exact size.
+     The exact size is 3 * (inlen + (ctx ? ctx->i : 0)) / 4, minus 1 if the
+     input ends with "=" and minus another 1 if the input ends with "==".
+     Shifting before multiplying avoids the possibility of overflow.  */
+  idx_t needlen = 3 * ((inlen >> 2) + 1);
+
+  *out = imalloc (needlen);
+  if (!*out)
+    return true;
+
+  if (!base64_decode_ctx (ctx, in, inlen, *out, &needlen))
+    {
+      free (*out);
+      *out = NULL;
+      return false;
+    }
+
+  if (outlen)
+    *outlen = needlen;
+
+  return true;
+}
deleted file mode 120000 (symlink)
index 7bb3f0e988aca46c5d480e108c022f783d2afd4d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/base64.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7691f6c4ade67e1fd60ccf1fb6b72cb2fa3917b4
--- /dev/null
@@ -0,0 +1,99 @@
+/* base64.h -- Encode binary data using printable characters.
+   Copyright (C) 2004-2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef BASE64_H
+#define BASE64_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get idx_t.  */
+#include <idx.h>
+
+/* Pacify GCC in isubase64.  */
+#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef BASE64_INLINE
+# define BASE64_INLINE _GL_INLINE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* This uses that the expression (n+(k-1))/k means the smallest
+   integer >= n/k, i.e., the ceiling of n/k.  */
+#define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
+
+struct base64_decode_context
+{
+  int i;
+  char buf[4];
+};
+
+extern signed char const base64_to_int[256];
+
+BASE64_INLINE bool
+isubase64 (unsigned char ch)
+{
+  return ch < sizeof base64_to_int && 0 <= base64_to_int[ch];
+}
+
+BASE64_INLINE bool
+isbase64 (char ch)
+{
+  return isubase64 (ch);
+}
+
+extern void base64_encode (const char *restrict in, idx_t inlen,
+                           char *restrict out, idx_t outlen);
+
+extern idx_t base64_encode_alloc (const char *in, idx_t inlen, char **out);
+
+/* Initialize decode-context buffer, CTX.  */
+BASE64_INLINE void
+base64_decode_ctx_init (struct base64_decode_context *ctx)
+{
+  ctx->i = 0;
+}
+
+extern bool base64_decode_ctx (struct base64_decode_context *ctx,
+                               const char *restrict in, idx_t inlen,
+                               char *restrict out, idx_t *outlen);
+
+extern bool base64_decode_alloc_ctx (struct base64_decode_context *ctx,
+                                     const char *in, idx_t inlen,
+                                     char **out, idx_t *outlen);
+
+#define base64_decode(in, inlen, out, outlen) \
+        base64_decode_ctx (NULL, in, inlen, out, outlen)
+
+#define base64_decode_alloc(in, inlen, out, outlen) \
+        base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
+
+#ifdef __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* BASE64_H */
deleted file mode 120000 (symlink)
index c161cb76df24fd754bd0efb717a71de05bd5de8f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/basename-lgpl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..256f84609ce7f0ecd6d45e96f45aaa2c46c75eda
--- /dev/null
@@ -0,0 +1,70 @@
+/* basename.c -- return the last element in a file name
+
+   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "basename-lgpl.h"
+
+#include <string.h>
+
+#include "filename.h"
+
+char *
+last_component (char const *name)
+{
+  char const *base = name + FILE_SYSTEM_PREFIX_LEN (name);
+  char const *p;
+  bool last_was_slash = false;
+
+  while (ISSLASH (*base))
+    base++;
+
+  for (p = base; *p; p++)
+    {
+      if (ISSLASH (*p))
+        last_was_slash = true;
+      else if (last_was_slash)
+        {
+          base = p;
+          last_was_slash = false;
+        }
+    }
+
+  return (char *) base;
+}
+
+size_t
+base_len (char const *name)
+{
+  size_t len;
+  size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
+
+  for (len = strlen (name);  1 < len && ISSLASH (name[len - 1]);  len--)
+    continue;
+
+  if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1
+      && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2])
+    return 2;
+
+  if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len
+      && len == prefix_len && ISSLASH (name[prefix_len]))
+    return prefix_len + 1;
+
+  return len;
+}
deleted file mode 120000 (symlink)
index 897eafc0186cd7513430a70bca78d9ea4189d66c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/basename-lgpl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2a56be98e23fcbff6d67e1c0c35a7abc500daba5
--- /dev/null
@@ -0,0 +1,83 @@
+/* Extract the last component (base name) of a file name.
+
+   Copyright (C) 1998, 2001, 2003-2006, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BASENAME_LGPL_H
+#define _BASENAME_LGPL_H
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+#ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
+# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Return the address of the last file name component of FILENAME.
+   If FILENAME has some trailing slash(es), they are considered to be
+   part of the last component.
+   If FILENAME has no relative file name components because it is a file
+   system root, return the empty string.
+   Examples:
+              FILENAME      RESULT
+              "foo.c"       "foo.c"
+              "foo/bar.c"   "bar.c"
+              "/foo/bar.c"  "bar.c"
+              "foo/bar/"    "bar/"
+              "foo/bar//"   "bar//"
+              "/"           ""
+              "//"          ""
+              ""            ""
+   The return value is a tail of the given FILENAME; do NOT free() it!  */
+
+/* This function was traditionally called 'basename', but we avoid this
+   function name because
+     * Various platforms have different functions in their libc.
+       In particular, the glibc basename(), defined in <string.h>, does
+       not consider trailing slashes to be part of the component:
+              FILENAME      RESULT
+              "foo/bar/"    ""
+              "foo/bar//"   ""
+     * The 'basename' command eliminates trailing slashes and for a root
+       produces a non-empty result:
+              FILENAME      RESULT
+              "foo/bar/"    "bar"
+              "foo/bar//"   "bar"
+              "/"           "/"
+              "//"          "/"
+ */
+extern char *last_component (char const *filename) _GL_ATTRIBUTE_PURE;
+
+/* Return the length of the basename FILENAME.
+   Typically FILENAME is the value returned by base_name or last_component.
+   Act like strlen (FILENAME), except omit all trailing slashes.  */
+extern size_t base_len (char const *filename) _GL_ATTRIBUTE_PURE;
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _BASENAME_LGPL_H */
deleted file mode 120000 (symlink)
index dafa24141698989a23f3e0b442042f13d7993585..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/basename.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c5a6bdc9d5d1274664f0a90d8043b063a7d216d8
--- /dev/null
@@ -0,0 +1,64 @@
+/* basename.c -- return the last element in a file name
+
+   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "dirname.h"
+
+#include <string.h>
+#include "xalloc.h"
+
+char *
+base_name (char const *name)
+{
+  char const *base = last_component (name);
+  idx_t length;
+  int dotslash_len;
+  if (*base)
+    {
+      length = base_len (base);
+
+      /* Collapse a sequence of trailing slashes into one.  */
+      length += ISSLASH (base[length]);
+
+      /* On systems with drive letters, "a/b:c" must return "./b:c" rather
+         than "b:c" to avoid confusion with a drive letter.  On systems
+         with pure POSIX semantics, this is not an issue.  */
+      dotslash_len = FILE_SYSTEM_PREFIX_LEN (base) != 0 ? 2 : 0;
+    }
+  else
+    {
+      /* There is no last component, so NAME is a file system root or
+         the empty string.  */
+      base = name;
+      length = base_len (base);
+      dotslash_len = 0;
+    }
+
+  char *p = ximalloc (dotslash_len + length + 1);
+  if (dotslash_len)
+    {
+      p[0] = '.';
+      p[1] = '/';
+    }
+
+  /* Finally, copy the basename.  */
+  memcpy (p + dotslash_len, base, length);
+  p[dotslash_len + length] = '\0';
+  return p;
+}
deleted file mode 120000 (symlink)
index 2196970255a0e1326eccadbc4208d9500aac6bb8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/binary-io.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..40f01d67ee11e736b00e11177feb57f04be1bfe4
--- /dev/null
@@ -0,0 +1,39 @@
+/* Binary mode I/O.
+   Copyright 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define BINARY_IO_INLINE _GL_EXTERN_INLINE
+#include "binary-io.h"
+
+#if defined __DJGPP__ || defined __EMX__
+# include <unistd.h>
+
+int
+set_binary_mode (int fd, int mode)
+{
+  if (isatty (fd))
+    /* If FD refers to a console (not a pipe, not a regular file),
+       O_TEXT is the only reasonable mode, both on input and on output.
+       Silently ignore the request.  If we were to return -1 here,
+       all programs that use xset_binary_mode would fail when run
+       with console input or console output.  */
+    return O_TEXT;
+  else
+    return __gl_setmode (fd, mode);
+}
+
+#endif
deleted file mode 120000 (symlink)
index d0f86bb372ddb51f233e2eca8b43d6eb2b0385e2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/binary-io.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0cc5c11748ca665df77ecdf3422cca5e4d1600f1
--- /dev/null
@@ -0,0 +1,79 @@
+/* Binary mode I/O.
+   Copyright (C) 2001, 2003, 2005, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BINARY_H
+#define _BINARY_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_UNUSED.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* For systems that distinguish between text and binary I/O.
+   O_BINARY is guaranteed by the gnulib <fcntl.h>. */
+#include <fcntl.h>
+
+/* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...',
+   so we include it here first.  */
+#include <stdio.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef BINARY_IO_INLINE
+# define BINARY_IO_INLINE _GL_INLINE
+#endif
+
+#if O_BINARY
+# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
+#  include <io.h> /* declares setmode() */
+#  define __gl_setmode setmode
+# else
+#  define __gl_setmode _setmode
+#  undef fileno
+#  define fileno _fileno
+# endif
+#else
+  /* On reasonable systems, binary I/O is the only choice.  */
+  /* Use a function rather than a macro, to avoid gcc warnings
+     "warning: statement with no effect".  */
+BINARY_IO_INLINE int
+__gl_setmode (_GL_UNUSED int fd, _GL_UNUSED int mode)
+{
+  return O_BINARY;
+}
+#endif
+
+/* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY.
+   Return the old mode if successful, -1 (setting errno) on failure.
+   Ordinarily this function would be called 'setmode', since that is
+   its old name on MS-Windows, but it is called 'set_binary_mode' here
+   to avoid colliding with a BSD function of another name.  */
+
+#if defined __DJGPP__ || defined __EMX__
+extern int set_binary_mode (int fd, int mode);
+#else
+BINARY_IO_INLINE int
+set_binary_mode (int fd, int mode)
+{
+  return __gl_setmode (fd, mode);
+}
+#endif
+
+/* This macro is obsolescent.  */
+#define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY))
+
+_GL_INLINE_HEADER_END
+
+#endif /* _BINARY_H */
deleted file mode 120000 (symlink)
index eb592ddb78ae8d206e45e5f00a0c35150edeeb7f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/bitrotate.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bbf94d8b7c8c0ec2dd7413eeae82f994a392edd0
--- /dev/null
@@ -0,0 +1,21 @@
+/* Rotate bits in integers.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define BITROTATE_INLINE _GL_EXTERN_INLINE
+#include "bitrotate.h"
deleted file mode 120000 (symlink)
index 2d3b7bbb2164708ee358313c3ab540ff22354896..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/bitrotate.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..91744cc5f98dc314fd6f273676b4fd8aa37c16d6
--- /dev/null
@@ -0,0 +1,140 @@
+/* bitrotate.h - Rotate bits in integers
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2008. */
+
+#ifndef _GL_BITROTATE_H
+#define _GL_BITROTATE_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <limits.h>
+#include <stdint.h>
+#include <sys/types.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef BITROTATE_INLINE
+# define BITROTATE_INLINE _GL_INLINE
+#endif
+
+#ifdef UINT64_MAX
+/* Given an unsigned 64-bit argument X, return the value corresponding
+   to rotating the bits N steps to the left.  N must be between 1 and
+   63 inclusive. */
+BITROTATE_INLINE uint64_t
+rotl64 (uint64_t x, int n)
+{
+  return ((x << n) | (x >> (64 - n))) & UINT64_MAX;
+}
+
+/* Given an unsigned 64-bit argument X, return the value corresponding
+   to rotating the bits N steps to the right.  N must be between 1 to
+   63 inclusive.*/
+BITROTATE_INLINE uint64_t
+rotr64 (uint64_t x, int n)
+{
+  return ((x >> n) | (x << (64 - n))) & UINT64_MAX;
+}
+#endif
+
+/* Given an unsigned 32-bit argument X, return the value corresponding
+   to rotating the bits N steps to the left.  N must be between 1 and
+   31 inclusive. */
+BITROTATE_INLINE uint32_t
+rotl32 (uint32_t x, int n)
+{
+  return ((x << n) | (x >> (32 - n))) & UINT32_MAX;
+}
+
+/* Given an unsigned 32-bit argument X, return the value corresponding
+   to rotating the bits N steps to the right.  N must be between 1 to
+   31 inclusive.*/
+BITROTATE_INLINE uint32_t
+rotr32 (uint32_t x, int n)
+{
+  return ((x >> n) | (x << (32 - n))) & UINT32_MAX;
+}
+
+/* Given a size_t argument X, return the value corresponding
+   to rotating the bits N steps to the left.  N must be between 1 and
+   (CHAR_BIT * sizeof (size_t) - 1) inclusive.  */
+BITROTATE_INLINE size_t
+rotl_sz (size_t x, int n)
+{
+  return ((x << n) | (x >> ((CHAR_BIT * sizeof x) - n))) & SIZE_MAX;
+}
+
+/* Given a size_t argument X, return the value corresponding
+   to rotating the bits N steps to the right.  N must be between 1 to
+   (CHAR_BIT * sizeof (size_t) - 1) inclusive.  */
+BITROTATE_INLINE size_t
+rotr_sz (size_t x, int n)
+{
+  return ((x >> n) | (x << ((CHAR_BIT * sizeof x) - n))) & SIZE_MAX;
+}
+
+/* Given an unsigned 16-bit argument X, return the value corresponding
+   to rotating the bits N steps to the left.  N must be between 1 to
+   15 inclusive, but on most relevant targets N can also be 0 and 16
+   because 'int' is at least 32 bits and the arguments must widen
+   before shifting. */
+BITROTATE_INLINE uint16_t
+rotl16 (uint16_t x, int n)
+{
+  return (((unsigned int) x << n) | ((unsigned int) x >> (16 - n)))
+         & UINT16_MAX;
+}
+
+/* Given an unsigned 16-bit argument X, return the value corresponding
+   to rotating the bits N steps to the right.  N must be in 1 to 15
+   inclusive, but on most relevant targets N can also be 0 and 16
+   because 'int' is at least 32 bits and the arguments must widen
+   before shifting. */
+BITROTATE_INLINE uint16_t
+rotr16 (uint16_t x, int n)
+{
+  return (((unsigned int) x >> n) | ((unsigned int) x << (16 - n)))
+         & UINT16_MAX;
+}
+
+/* Given an unsigned 8-bit argument X, return the value corresponding
+   to rotating the bits N steps to the left.  N must be between 1 to 7
+   inclusive, but on most relevant targets N can also be 0 and 8
+   because 'int' is at least 32 bits and the arguments must widen
+   before shifting. */
+BITROTATE_INLINE uint8_t
+rotl8 (uint8_t x, int n)
+{
+  return (((unsigned int) x << n) | ((unsigned int) x >> (8 - n))) & UINT8_MAX;
+}
+
+/* Given an unsigned 8-bit argument X, return the value corresponding
+   to rotating the bits N steps to the right.  N must be in 1 to 7
+   inclusive, but on most relevant targets N can also be 0 and 8
+   because 'int' is at least 32 bits and the arguments must widen
+   before shifting. */
+BITROTATE_INLINE uint8_t
+rotr8 (uint8_t x, int n)
+{
+  return (((unsigned int) x >> n) | ((unsigned int) x << (8 - n))) & UINT8_MAX;
+}
+
+_GL_INLINE_HEADER_END
+
+#endif /* _GL_BITROTATE_H */
deleted file mode 120000 (symlink)
index 60a587e47bcf523fe42d0601f550443d262d8579..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/boot-time-aux.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8b966fe691fc76d39749479d476e33a11f525e15
--- /dev/null
@@ -0,0 +1,323 @@
+/* Auxiliary functions for determining the time when the machine last booted.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>.  */
+
+#define SIZEOF(a) (sizeof(a)/sizeof(a[0]))
+
+#if defined __linux__ || defined __ANDROID__
+
+/* Store the uptime counter, as managed by the Linux kernel, in *P_UPTIME.
+   Return 0 upon success, -1 upon failure.  */
+_GL_ATTRIBUTE_MAYBE_UNUSED
+static int
+get_linux_uptime (struct timespec *p_uptime)
+{
+  /* The clock_gettime facility returns the uptime with a resolution of 1 µsec.
+     It is available with glibc >= 2.14, Android, or musl libc.
+     In glibc < 2.17 it required linking with librt.  */
+# if !defined __GLIBC__ || 2 < __GLIBC__ + (17 <= __GLIBC_MINOR__)
+  if (clock_gettime (CLOCK_BOOTTIME, p_uptime) >= 0)
+    return 0;
+# endif
+
+  /* /proc/uptime contains the uptime with a resolution of 0.01 sec.
+     But it does not have read permissions on Android.  */
+# if !defined __ANDROID__
+  FILE *fp = fopen ("/proc/uptime", "re");
+  if (fp != NULL)
+    {
+      char buf[32 + 1];
+      size_t n = fread (buf, 1, sizeof (buf) - 1, fp);
+      fclose (fp);
+      if (n > 0)
+        {
+          buf[n] = '\0';
+          /* buf now contains two values: the uptime and the idle time.  */
+          time_t s = 0;
+          char *p;
+          for (p = buf; '0' <= *p && *p <= '9'; p++)
+            s = 10 * s + (*p - '0');
+          if (buf < p)
+            {
+              long ns = 0;
+              if (*p++ == '.')
+                for (int i = 0; i < 9; i++)
+                  ns = 10 * ns + ('0' <= *p && *p <= '9' ? *p++ - '0' : 0);
+              p_uptime->tv_sec = s;
+              p_uptime->tv_nsec = ns;
+              return 0;
+            }
+        }
+    }
+# endif
+
+# if HAVE_DECL_SYSINFO /* not available in Android API < 9 */
+  /* The sysinfo call returns the uptime with a resolution of 1 sec only.  */
+  struct sysinfo info;
+  if (sysinfo (&info) >= 0)
+    {
+      p_uptime->tv_sec = info.uptime;
+      p_uptime->tv_nsec = 0;
+      return 0;
+    }
+# endif
+
+  return -1;
+}
+
+#endif
+
+#if defined __linux__ && !defined __ANDROID__
+
+static int
+get_linux_boot_time_fallback (struct timespec *p_boot_time)
+{
+  /* On Devuan with the 'runit' init system and on Artix with the 's6' init
+     system, UTMP_FILE contains USER_PROCESS and other entries, but no
+     BOOT_TIME entry.
+     On Alpine Linux, UTMP_FILE is not filled.  It is always empty.
+     So, in both cases, get the time stamp of a file that gets touched only
+     during the boot process.  */
+
+  const char * const boot_touched_files[] =
+    {
+      "/var/lib/systemd/random-seed", /* seen on distros with systemd */
+      "/var/lib/urandom/random-seed", /* seen on Devuan with runit */
+      "/var/lib/random-seed",         /* seen on Artix with s6 */
+      /* This must come last, since on several distros /var/run/utmp is
+         modified when a user logs in, i.e. long after boot.  */
+      "/var/run/utmp"                 /* seen on Alpine Linux with OpenRC */
+    };
+  for (idx_t i = 0; i < SIZEOF (boot_touched_files); i++)
+    {
+      const char *filename = boot_touched_files[i];
+      struct stat statbuf;
+      if (stat (filename, &statbuf) >= 0)
+        {
+          *p_boot_time = get_stat_mtime (&statbuf);
+          return 0;
+        }
+    }
+  return -1;
+}
+
+/* The following approach is only usable as a fallback, because it is of
+   the form
+     boot_time = (time now) - (kernel's ktime_get_boottime[_ts64] ())
+   and therefore produces wrong values after the date has been bumped in the
+   running system, which happens frequently if the system is running in a
+   virtual machine and this VM has been put into "saved" or "sleep" state
+   and then resumed.  */
+static int
+get_linux_boot_time_final_fallback (struct timespec *p_boot_time)
+{
+  struct timespec uptime;
+  if (get_linux_uptime (&uptime) >= 0)
+    {
+      struct timespec result;
+# if !defined __GLIBC__ || 2 < __GLIBC__ + (16 <= __GLIBC_MINOR__)
+      /* Better than:
+      if (0 <= clock_gettime (CLOCK_REALTIME, &result))
+         because timespec_get does not need -lrt in glibc 2.16.
+      */
+      if (! timespec_get (&result, TIME_UTC))
+        return -1;
+#  else
+      /* Fall back on lower-res approach that does not need -lrt.
+         This is good enough; on these hosts UPTIME is even lower-res.  */
+      struct timeval tv;
+      int r = gettimeofday (&tv, NULL);
+      if (r < 0)
+        return r;
+      result.tv_sec = tv.tv_sec;
+      result.tv_nsec = tv.tv_usec * 1000;
+#  endif
+
+      if (result.tv_nsec < uptime.tv_nsec)
+        {
+          result.tv_nsec += 1000000000;
+          result.tv_sec -= 1;
+        }
+      result.tv_sec -= uptime.tv_sec;
+      result.tv_nsec -= uptime.tv_nsec;
+      *p_boot_time = result;
+      return 0;
+    }
+  return -1;
+}
+
+#endif
+
+#if defined __ANDROID__
+
+static int
+get_android_boot_time (struct timespec *p_boot_time)
+{
+  /* On Android, there is no /var, and normal processes don't have access
+     to system files.  Therefore use the kernel's uptime counter, although
+     it produces wrong values after the date has been bumped in the running
+     system.  */
+  struct timespec uptime;
+  if (get_linux_uptime (&uptime) >= 0)
+    {
+      struct timespec result;
+      if (clock_gettime (CLOCK_REALTIME, &result) >= 0)
+        {
+          if (result.tv_nsec < uptime.tv_nsec)
+            {
+              result.tv_nsec += 1000000000;
+              result.tv_sec -= 1;
+            }
+          result.tv_sec -= uptime.tv_sec;
+          result.tv_nsec -= uptime.tv_nsec;
+          *p_boot_time = result;
+          return 0;
+        }
+    }
+  return -1;
+}
+
+#endif
+
+#if defined __OpenBSD__
+
+static int
+get_openbsd_boot_time (struct timespec *p_boot_time)
+{
+  /* On OpenBSD, UTMP_FILE is not filled.  It contains only dummy entries.
+     So, get the time stamp of a file that gets touched only during the
+     boot process.  */
+  const char * const boot_touched_files[] =
+    {
+      "/var/db/host.random",
+      "/var/run/utmp"
+    };
+  for (idx_t i = 0; i < SIZEOF (boot_touched_files); i++)
+    {
+      const char *filename = boot_touched_files[i];
+      struct stat statbuf;
+      if (stat (filename, &statbuf) >= 0)
+        {
+          *p_boot_time = get_stat_mtime (&statbuf);
+          return 0;
+        }
+    }
+  return -1;
+}
+
+#endif
+
+#if HAVE_SYS_SYSCTL_H && HAVE_SYSCTL \
+    && defined CTL_KERN && defined KERN_BOOTTIME \
+    && !defined __minix
+/* macOS, FreeBSD, GNU/kFreeBSD, NetBSD, OpenBSD */
+/* On Minix 3.3 this sysctl produces garbage results.  Therefore avoid it.  */
+
+/* The following approach is only usable as a fallback, because it produces
+   wrong values after the date has been bumped in the running system, which
+   happens frequently if the system is running in a virtual machine and this
+   VM has been put into "saved" or "sleep" state and then resumed.  */
+static int
+get_bsd_boot_time_final_fallback (struct timespec *p_boot_time)
+{
+  static int request[2] = { CTL_KERN, KERN_BOOTTIME };
+  struct timeval result;
+  size_t result_len = sizeof result;
+
+  if (sysctl (request, 2, &result, &result_len, NULL, 0) >= 0)
+    {
+      p_boot_time->tv_sec = result.tv_sec;
+      p_boot_time->tv_nsec = result.tv_usec * 1000;
+      return 0;
+    }
+  return -1;
+}
+
+#endif
+
+#if defined __HAIKU__
+
+static int
+get_haiku_boot_time (struct timespec *p_boot_time)
+{
+  /* On Haiku, /etc/utmp does not exist.  During boot,
+       1. the current time is restored, but possibly with a wrong time zone,
+          that is, with an offset of a few hours,
+       2. some symlinks and files get created,
+       3. the various devices are brought up, in particular the network device,
+       4. the correct date and time is set,
+       5. some more device nodes get created.
+     The boot time can be retrieved by looking at a directory created during
+     phase 5, such as /dev/input.  */
+  const char * const boot_touched_file = "/dev/input";
+  struct stat statbuf;
+  if (stat (boot_touched_file, &statbuf) >= 0)
+    {
+      *p_boot_time = get_stat_mtime (&statbuf);
+      return 0;
+    }
+  return -1;
+}
+
+#endif
+
+#if HAVE_OS_H /* BeOS, Haiku */
+
+/* The following approach is only usable as a fallback, because it produces
+   wrong values after the date has been bumped in the running system, which
+   happens frequently if the system is running in a virtual machine and this
+   VM has been put into "saved" or "sleep" state and then resumed.  */
+static int
+get_haiku_boot_time_final_fallback (struct timespec *p_boot_time)
+{
+  system_info si;
+
+  get_system_info (&si);
+  p_boot_time->tv_sec = si.boot_time / 1000000;
+  p_boot_time->tv_nsec = (si.boot_time % 1000000) * 1000;
+  return 0;
+}
+
+#endif
+
+#if defined __CYGWIN__ || defined _WIN32
+
+static int
+get_windows_boot_time (struct timespec *p_boot_time)
+{
+  /* On Cygwin, /var/run/utmp is empty.
+     On native Windows, <utmpx.h> and <utmp.h> don't exist.
+     Instead, on Windows, the boot time can be retrieved by looking at the
+     time stamp of a file that (normally) gets touched only during the boot
+     process, namely C:\pagefile.sys.  */
+  const char * const boot_touched_file =
+    #if defined __CYGWIN__ && !defined _WIN32
+    "/cygdrive/c/pagefile.sys"
+    #else
+    "C:\\pagefile.sys"
+    #endif
+    ;
+  struct stat statbuf;
+  if (stat (boot_touched_file, &statbuf) >= 0)
+    {
+      *p_boot_time = get_stat_mtime (&statbuf);
+      return 0;
+    }
+  return -1;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 5ac5d92786ab545110deb96ddb696cded8361069..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/btoc32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4f223059a751e6ae5a6532052224b2ef5ef2732d
--- /dev/null
@@ -0,0 +1,68 @@
+/* Convert unibyte character to 32-bit wide character.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <config.h>
+
+#define IN_BTOC32
+/* Specification.  */
+#include <uchar.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
+#if _GL_WCHAR_T_IS_UCS4
+_GL_EXTERN_INLINE
+#endif
+wint_t
+btoc32 (int c)
+{
+#if HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4
+  /* The char32_t encoding of a multibyte character may be different than its
+     wchar_t encoding.  */
+  if (c != EOF)
+    {
+      mbstate_t state;
+      char s[1];
+      char32_t wc;
+
+      mbszero (&state);
+      s[0] = (unsigned char) c;
+      if (mbrtoc32 (&wc, s, 1, &state) <= 1)
+        return wc;
+    }
+  return WEOF;
+#else
+  /* In all known locale encodings, unibyte characters correspond only to
+     characters in the BMP.  */
+  wint_t wc = btowc (c);
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  if (wc != WEOF && wc != 0)
+    {
+      wc = locale_encoding_to_unicode (wc);
+      if (wc == 0)
+        return WEOF;
+    }
+# endif
+  return wc;
+#endif
+}
deleted file mode 120000 (symlink)
index f73e2a9f72d09d4da11e26b57cd453233a8273e2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/btowc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8bf21aa6741da7cb087c02994b19d6aec750f128
--- /dev/null
@@ -0,0 +1,47 @@
+/* Convert unibyte character to wide character.
+   Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+wint_t
+btowc (int c)
+{
+  if (c != EOF)
+    {
+      char buf[1];
+      wchar_t wc;
+
+      buf[0] = c;
+#if HAVE_MBRTOWC
+      mbstate_t state;
+      mbszero (&state);
+      size_t ret = mbrtowc (&wc, buf, 1, &state);
+      if (!(ret == (size_t)(-1) || ret == (size_t)(-2)))
+#else
+      if (mbtowc (&wc, buf, 1) >= 0)
+#endif
+        return wc;
+    }
+  return WEOF;
+}
deleted file mode 120000 (symlink)
index b21321ddf07f7a0b130146dd341a48a79f3c2876..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/byteswap.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8e49efad05adfb39e38cce1523af817526735d53
--- /dev/null
@@ -0,0 +1,44 @@
+/* byteswap.h - Byte swapping
+   Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_BYTESWAP_H
+#define _GL_BYTESWAP_H
+
+/* Given an unsigned 16-bit argument X, return the value corresponding to
+   X with reversed byte order.  */
+#define bswap_16(x) ((((x) & 0x00FF) << 8) | \
+                     (((x) & 0xFF00) >> 8))
+
+/* Given an unsigned 32-bit argument X, return the value corresponding to
+   X with reversed byte order.  */
+#define bswap_32(x) ((((x) & 0x000000FF) << 24) | \
+                     (((x) & 0x0000FF00) << 8) | \
+                     (((x) & 0x00FF0000) >> 8) | \
+                     (((x) & 0xFF000000) >> 24))
+
+/* Given an unsigned 64-bit argument X, return the value corresponding to
+   X with reversed byte order.  */
+#define bswap_64(x) ((((x) & 0x00000000000000FFULL) << 56) | \
+                     (((x) & 0x000000000000FF00ULL) << 40) | \
+                     (((x) & 0x0000000000FF0000ULL) << 24) | \
+                     (((x) & 0x00000000FF000000ULL) << 8) | \
+                     (((x) & 0x000000FF00000000ULL) >> 8) | \
+                     (((x) & 0x0000FF0000000000ULL) >> 24) | \
+                     (((x) & 0x00FF000000000000ULL) >> 40) | \
+                     (((x) & 0xFF00000000000000ULL) >> 56))
+
+#endif /* _GL_BYTESWAP_H */
deleted file mode 120000 (symlink)
index 26b3f35b1212c68a82f4a921c537ba3f8004aca3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c++defs.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eb66967b09be29a360fd3a65c937b1ea4501cc34
--- /dev/null
@@ -0,0 +1,337 @@
+/* C++ compatible function declaration macros.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_CXXDEFS_H
+#define _GL_CXXDEFS_H
+
+/* Begin/end the GNULIB_NAMESPACE namespace.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
+# define _GL_END_NAMESPACE }
+#else
+# define _GL_BEGIN_NAMESPACE
+# define _GL_END_NAMESPACE
+#endif
+
+/* The three most frequent use cases of these macros are:
+
+   * For providing a substitute for a function that is missing on some
+     platforms, but is declared and works fine on the platforms on which
+     it exists:
+
+       #if @GNULIB_FOO@
+       # if !@HAVE_FOO@
+       _GL_FUNCDECL_SYS (foo, ...);
+       # endif
+       _GL_CXXALIAS_SYS (foo, ...);
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+
+   * For providing a replacement for a function that exists on all platforms,
+     but is broken/insufficient and needs to be replaced on some platforms:
+
+       #if @GNULIB_FOO@
+       # if @REPLACE_FOO@
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+       #   undef foo
+       #   define foo rpl_foo
+       #  endif
+       _GL_FUNCDECL_RPL (foo, ...);
+       _GL_CXXALIAS_RPL (foo, ...);
+       # else
+       _GL_CXXALIAS_SYS (foo, ...);
+       # endif
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+
+   * For providing a replacement for a function that exists on some platforms
+     but is broken/insufficient and needs to be replaced on some of them and
+     is additionally either missing or undeclared on some other platforms:
+
+       #if @GNULIB_FOO@
+       # if @REPLACE_FOO@
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+       #   undef foo
+       #   define foo rpl_foo
+       #  endif
+       _GL_FUNCDECL_RPL (foo, ...);
+       _GL_CXXALIAS_RPL (foo, ...);
+       # else
+       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
+       _GL_FUNCDECL_SYS (foo, ...);
+       #  endif
+       _GL_CXXALIAS_SYS (foo, ...);
+       # endif
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+*/
+
+/* _GL_EXTERN_C declaration;
+   performs the declaration with C linkage.  */
+#if defined __cplusplus
+# define _GL_EXTERN_C extern "C"
+#else
+# define _GL_EXTERN_C extern
+#endif
+
+/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
+   declares a replacement function, named rpl_func, with the given prototype,
+   consisting of return type, parameters, and attributes.
+   Example:
+     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
+                                  _GL_ARG_NONNULL ((1)));
+
+   Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
+   of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode.  (That's
+   because
+     [[...]] extern "C" <declaration>;
+   is invalid syntax in C++.)
+ */
+#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
+  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
+#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
+  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
+
+/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
+   declares the system function, named func, with the given prototype,
+   consisting of return type, parameters, and attributes.
+   Example:
+     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
+                                  _GL_ARG_NONNULL ((1)));
+ */
+#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
+  _GL_EXTERN_C rettype func parameters_and_attributes
+
+/* _GL_CXXALIAS_RPL (func, rettype, parameters);
+   declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
+   Example:
+     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
+
+   Wrapping rpl_func in an object with an inline conversion operator
+   avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
+   actually used in the program.  */
+#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                                \
+    {                                                         \
+      static const struct _gl_ ## func ## _wrapper            \
+      {                                                       \
+        typedef rettype (*type) parameters;                   \
+                                                              \
+        inline operator type () const                         \
+        {                                                     \
+          return ::rpl_func;                                  \
+        }                                                     \
+      } func = {};                                            \
+    }                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_MDA (func, rettype, parameters);
+   is to be used when func is a Microsoft deprecated alias, on native Windows.
+   It declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to _func, if GNULIB_NAMESPACE is defined.
+   Example:
+     _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+ */
+#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
+
+/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
+   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
+   except that the C function rpl_func may have a slightly different
+   declaration.  A cast is used to silence the "invalid conversion" error
+   that would otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                                     \
+    {                                                              \
+      static const struct _gl_ ## func ## _wrapper                 \
+      {                                                            \
+        typedef rettype (*type) parameters;                        \
+                                                                   \
+        inline operator type () const                              \
+        {                                                          \
+          return reinterpret_cast<type>(::rpl_func);               \
+        }                                                          \
+      } func = {};                                                 \
+    }                                                              \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
+   is like  _GL_CXXALIAS_MDA (func, rettype, parameters);
+   except that the C function func may have a slightly different declaration.
+   A cast is used to silence the "invalid conversion" error that would
+   otherwise occur.  */
+#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
+
+/* _GL_CXXALIAS_SYS (func, rettype, parameters);
+   declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to the system provided function func, if GNULIB_NAMESPACE
+   is defined.
+   Example:
+     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+
+   Wrapping func in an object with an inline conversion operator
+   avoids a reference to func unless GNULIB_NAMESPACE::func is
+   actually used in the program.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
+    namespace GNULIB_NAMESPACE                                \
+    {                                                         \
+      static const struct _gl_ ## func ## _wrapper            \
+      {                                                       \
+        typedef rettype (*type) parameters;                   \
+                                                              \
+        inline operator type () const                         \
+        {                                                     \
+          return ::func;                                      \
+        }                                                     \
+      } func = {};                                            \
+    }                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
+   except that the C function func may have a slightly different declaration.
+   A cast is used to silence the "invalid conversion" error that would
+   otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                          \
+    {                                                   \
+      static const struct _gl_ ## func ## _wrapper      \
+      {                                                 \
+        typedef rettype (*type) parameters;             \
+                                                        \
+        inline operator type () const                   \
+        {                                               \
+          return reinterpret_cast<type>(::func);        \
+        }                                               \
+      } func = {};                                      \
+    }                                                   \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
+   except that the C function is picked among a set of overloaded functions,
+   namely the one with rettype2 and parameters2.  Two consecutive casts
+   are used to silence the "cannot find a match" and "invalid conversion"
+   errors that would otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+  /* The outer cast must be a reinterpret_cast.
+     The inner cast: When the function is defined as a set of overloaded
+     functions, it works as a static_cast<>, choosing the designated variant.
+     When the function is defined as a single variant, it works as a
+     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
+    namespace GNULIB_NAMESPACE                                                \
+    {                                                                         \
+      static const struct _gl_ ## func ## _wrapper                            \
+      {                                                                       \
+        typedef rettype (*type) parameters;                                   \
+                                                                              \
+        inline operator type () const                                         \
+        {                                                                     \
+          return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
+        }                                                                     \
+      } func = {};                                                            \
+    }                                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIASWARN (func);
+   causes a warning to be emitted when ::func is used but not when
+   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
+   variants.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIASWARN(func) \
+   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
+# define _GL_CXXALIASWARN_1(func,namespace) \
+   _GL_CXXALIASWARN_2 (func, namespace)
+/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+   we enable the warning only when not optimizing.  */
+# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
+#  define _GL_CXXALIASWARN_2(func,namespace) \
+    _GL_WARN_ON_USE (func, \
+                     "The symbol ::" #func " refers to the system function. " \
+                     "Use " #namespace "::" #func " instead.")
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+#  define _GL_CXXALIASWARN_2(func,namespace) \
+     extern __typeof__ (func) func
+# else
+#  define _GL_CXXALIASWARN_2(func,namespace) \
+     _GL_EXTERN_C int _gl_cxxalias_dummy
+# endif
+#else
+# define _GL_CXXALIASWARN(func) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
+   causes a warning to be emitted when the given overloaded variant of ::func
+   is used but not when GNULIB_NAMESPACE::func is used.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
+   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
+                        GNULIB_NAMESPACE)
+# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
+   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
+/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
+   we enable the warning only when not optimizing.  */
+# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+    _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
+                         "The symbol ::" #func " refers to the system function. " \
+                         "Use " #namespace "::" #func " instead.")
+# else
+#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
+     _GL_EXTERN_C int _gl_cxxalias_dummy
+# endif
+#else
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+#endif /* _GL_CXXDEFS_H */
deleted file mode 120000 (symlink)
index 73c108ef90c79020672329bd9df349044a96ae97..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c-ctype.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d3f1b12d5a9b31d64cd9176aa52372c88d282d29
--- /dev/null
@@ -0,0 +1,21 @@
+/* Character handling in C locale.
+
+   Copyright (C) 2003-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define C_CTYPE_INLINE _GL_EXTERN_INLINE
+#include "c-ctype.h"
deleted file mode 120000 (symlink)
index b1ed6b206107289ce258606d6b732467341c4f7b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c-ctype.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b582de4a7fd79f2416d2df1190923d18bc6d5236
--- /dev/null
@@ -0,0 +1,366 @@
+/* Character handling in C locale.
+
+   These functions work like the corresponding functions in <ctype.h>,
+   except that they have the C (POSIX) locale hardwired, whereas the
+   <ctype.h> functions' behaviour depends on the current locale set via
+   setlocale.
+
+   Copyright (C) 2000-2003, 2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef C_CTYPE_H
+#define C_CTYPE_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef C_CTYPE_INLINE
+# define C_CTYPE_INLINE _GL_INLINE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* The functions defined in this file assume the "C" locale and a character
+   set without diacritics (ASCII-US or EBCDIC-US or something like that).
+   Even if the "C" locale on a particular system is an extension of the ASCII
+   character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
+   is ISO-8859-1), the functions in this file recognize only the ASCII
+   characters.  */
+
+
+#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+    && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+    && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
+    && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
+    && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
+    && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
+    && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
+    && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
+    && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
+    && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
+    && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
+    && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
+    && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
+    && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
+    && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
+    && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
+    && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
+    && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
+    && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
+    && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
+    && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
+    && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
+    && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)
+/* The character set is ASCII or one of its variants or extensions, not EBCDIC.
+   Testing the value of '\n' and '\r' is not relevant.  */
+# define C_CTYPE_ASCII 1
+#elif ! (' ' == '\x40' && '0' == '\xf0'                     \
+         && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \
+         && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2')
+# error "Only ASCII and EBCDIC are supported"
+#endif
+
+#if 'A' < 0
+# error "EBCDIC and char is signed -- not supported"
+#endif
+
+/* Cases for control characters.  */
+
+#define _C_CTYPE_CNTRL \
+   case '\a': case '\b': case '\f': case '\n': \
+   case '\r': case '\t': case '\v': \
+   _C_CTYPE_OTHER_CNTRL
+
+/* ASCII control characters other than those with \-letter escapes.  */
+
+#if C_CTYPE_ASCII
+# define _C_CTYPE_OTHER_CNTRL \
+    case '\x00': case '\x01': case '\x02': case '\x03': \
+    case '\x04': case '\x05': case '\x06': case '\x0e': \
+    case '\x0f': case '\x10': case '\x11': case '\x12': \
+    case '\x13': case '\x14': case '\x15': case '\x16': \
+    case '\x17': case '\x18': case '\x19': case '\x1a': \
+    case '\x1b': case '\x1c': case '\x1d': case '\x1e': \
+    case '\x1f': case '\x7f'
+#else
+   /* Use EBCDIC code page 1047's assignments for ASCII control chars;
+      assume all EBCDIC code pages agree about these assignments.  */
+# define _C_CTYPE_OTHER_CNTRL \
+    case '\x00': case '\x01': case '\x02': case '\x03': \
+    case '\x07': case '\x0e': case '\x0f': case '\x10': \
+    case '\x11': case '\x12': case '\x13': case '\x18': \
+    case '\x19': case '\x1c': case '\x1d': case '\x1e': \
+    case '\x1f': case '\x26': case '\x27': case '\x2d': \
+    case '\x2e': case '\x32': case '\x37': case '\x3c': \
+    case '\x3d': case '\x3f'
+#endif
+
+/* Cases for lowercase hex letters, and lowercase letters, all offset by N.  */
+
+#define _C_CTYPE_LOWER_A_THRU_F_N(N) \
+   case 'a' + (N): case 'b' + (N): case 'c' + (N): case 'd' + (N): \
+   case 'e' + (N): case 'f' + (N)
+#define _C_CTYPE_LOWER_N(N) \
+   _C_CTYPE_LOWER_A_THRU_F_N(N): \
+   case 'g' + (N): case 'h' + (N): case 'i' + (N): case 'j' + (N): \
+   case 'k' + (N): case 'l' + (N): case 'm' + (N): case 'n' + (N): \
+   case 'o' + (N): case 'p' + (N): case 'q' + (N): case 'r' + (N): \
+   case 's' + (N): case 't' + (N): case 'u' + (N): case 'v' + (N): \
+   case 'w' + (N): case 'x' + (N): case 'y' + (N): case 'z' + (N)
+
+/* Cases for hex letters, digits, lower, punct, and upper.  */
+
+#define _C_CTYPE_A_THRU_F \
+   _C_CTYPE_LOWER_A_THRU_F_N (0): \
+   _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a')
+#define _C_CTYPE_DIGIT                     \
+   case '0': case '1': case '2': case '3': \
+   case '4': case '5': case '6': case '7': \
+   case '8': case '9'
+#define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0)
+#define _C_CTYPE_PUNCT \
+   case '!': case '"': case '#': case '$':  \
+   case '%': case '&': case '\'': case '(': \
+   case ')': case '*': case '+': case ',':  \
+   case '-': case '.': case '/': case ':':  \
+   case ';': case '<': case '=': case '>':  \
+   case '?': case '@': case '[': case '\\': \
+   case ']': case '^': case '_': case '`':  \
+   case '{': case '|': case '}': case '~'
+#define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a')
+
+
+/* Function definitions.  */
+
+/* Unlike the functions in <ctype.h>, which require an argument in the range
+   of the 'unsigned char' type, the functions here operate on values that are
+   in the 'unsigned char' range or in the 'char' range.  In other words,
+   when you have a 'char' value, you need to cast it before using it as
+   argument to a <ctype.h> function:
+
+         const char *s = ...;
+         if (isalpha ((unsigned char) *s)) ...
+
+   but you don't need to cast it for the functions defined in this file:
+
+         const char *s = ...;
+         if (c_isalpha (*s)) ...
+ */
+
+C_CTYPE_INLINE bool
+c_isalnum (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_DIGIT:
+    _C_CTYPE_LOWER:
+    _C_CTYPE_UPPER:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_isalpha (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_LOWER:
+    _C_CTYPE_UPPER:
+      return true;
+    default:
+      return false;
+    }
+}
+
+/* The function isascii is not locale dependent.
+   Its use in EBCDIC is questionable. */
+C_CTYPE_INLINE bool
+c_isascii (int c)
+{
+  switch (c)
+    {
+    case ' ':
+    _C_CTYPE_CNTRL:
+    _C_CTYPE_DIGIT:
+    _C_CTYPE_LOWER:
+    _C_CTYPE_PUNCT:
+    _C_CTYPE_UPPER:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_isblank (int c)
+{
+  return c == ' ' || c == '\t';
+}
+
+C_CTYPE_INLINE bool
+c_iscntrl (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_CNTRL:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_isdigit (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_DIGIT:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_isgraph (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_DIGIT:
+    _C_CTYPE_LOWER:
+    _C_CTYPE_PUNCT:
+    _C_CTYPE_UPPER:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_islower (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_LOWER:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_isprint (int c)
+{
+  switch (c)
+    {
+    case ' ':
+    _C_CTYPE_DIGIT:
+    _C_CTYPE_LOWER:
+    _C_CTYPE_PUNCT:
+    _C_CTYPE_UPPER:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_ispunct (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_PUNCT:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_isspace (int c)
+{
+  switch (c)
+    {
+    case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_isupper (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_UPPER:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE bool
+c_isxdigit (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_DIGIT:
+    _C_CTYPE_A_THRU_F:
+      return true;
+    default:
+      return false;
+    }
+}
+
+C_CTYPE_INLINE int
+c_tolower (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_UPPER:
+      return c - 'A' + 'a';
+    default:
+      return c;
+    }
+}
+
+C_CTYPE_INLINE int
+c_toupper (int c)
+{
+  switch (c)
+    {
+    _C_CTYPE_LOWER:
+      return c - 'a' + 'A';
+    default:
+      return c;
+    }
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* C_CTYPE_H */
deleted file mode 120000 (symlink)
index ff86a4efc33f799b74780dde3825fae07ccfa07b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c-file-type.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1c558796f9632239b90511a01430180bbba788a1
--- /dev/null
@@ -0,0 +1,111 @@
+/* Return a string describing the type of a file.
+
+   Copyright (C) 1993-1994, 2001-2002, 2004-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "file-type.h"
+
+#define N_(msgid) (msgid)
+
+char const *
+c_file_type (struct stat const *st)
+{
+  /* For some of these formats, see POSIX 1003.1-2017 "file" command,
+     STDOUT section, Table: File Utility Output Strings
+     <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/file.html#tagtcjh_27>.
+
+     To keep diagnostics grammatical in English, the returned string
+     must start with a consonant.  */
+
+  /* Do these three first, as they're the most common.  */
+
+  if (S_ISREG (st->st_mode))
+    return st->st_size == 0 ? N_("regular empty file") : N_("regular file");
+
+  if (S_ISDIR (st->st_mode))
+    return N_("directory");
+
+  if (S_ISLNK (st->st_mode))
+    return N_("symbolic link");
+
+  /* Do the S_TYPEIS* macros next, as they may be implemented in terms
+     of S_ISNAM, and we want the more-specialized interpretation.  */
+
+  if (S_TYPEISMQ (st))
+    return N_("message queue");
+
+  if (S_TYPEISSEM (st))
+    return N_("semaphore");
+
+  if (S_TYPEISSHM (st))
+    return N_("shared memory object");
+
+  if (S_TYPEISTMO (st))
+    return N_("typed memory object");
+
+  /* The remaining are in alphabetical order.  */
+
+  if (S_ISBLK (st->st_mode))
+    return N_("block special file");
+
+  if (S_ISCHR (st->st_mode))
+    return N_("character special file");
+
+  if (S_ISCTG (st->st_mode))
+    return N_("contiguous data");
+
+  if (S_ISFIFO (st->st_mode))
+    return N_("fifo");
+
+  if (S_ISDOOR (st->st_mode))
+    return N_("door");
+
+  if (S_ISMPB (st->st_mode))
+    return N_("multiplexed block special file");
+
+  if (S_ISMPC (st->st_mode))
+    return N_("multiplexed character special file");
+
+  if (S_ISMPX (st->st_mode))
+    return N_("multiplexed file");
+
+  if (S_ISNAM (st->st_mode))
+    return N_("named file");
+
+  if (S_ISNWK (st->st_mode))
+    return N_("network special file");
+
+  if (S_ISOFD (st->st_mode))
+    return N_("migrated file with data");
+
+  if (S_ISOFL (st->st_mode))
+    return N_("migrated file without data");
+
+  if (S_ISPORT (st->st_mode))
+    return N_("port");
+
+  if (S_ISSOCK (st->st_mode))
+    return N_("socket");
+
+  if (S_ISWHT (st->st_mode))
+    return N_("whiteout");
+
+  return N_("weird file");
+}
deleted file mode 120000 (symlink)
index 79cceaf9b08cd3d1911cbd12b5f58bf0e4b5e600..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c-strcase.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b75e8dd1cb32c9590d1169f03419d6c0bb10783b
--- /dev/null
@@ -0,0 +1,61 @@
+/* Case-insensitive string comparison functions in C locale.
+   Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef C_STRCASE_H
+#define C_STRCASE_H
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+
+/* The functions defined in this file assume the "C" locale and a character
+   set without diacritics (ASCII-US or EBCDIC-US or something like that).
+   Even if the "C" locale on a particular system is an extension of the ASCII
+   character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
+   is ISO-8859-1), the functions in this file recognize only the ASCII
+   characters.  More precisely, one of the string arguments must be an ASCII
+   string; the other one can also contain non-ASCII characters (but then
+   the comparison result will be nonzero).  */
+
+
+#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.  */
+extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE;
+
+/* Compare no more than N characters 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.  */
+extern int c_strncasecmp (const char *s1, const char *s2, size_t n)
+  _GL_ATTRIBUTE_PURE;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* C_STRCASE_H */
deleted file mode 120000 (symlink)
index dbdd55c6095f3001324149027d9d931faa1ed5be..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c-strcasecmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1fa575a8562013b6f0233318c32453ac88146f80
--- /dev/null
@@ -0,0 +1,56 @@
+/* c-strcasecmp.c -- case insensitive string comparator in C locale
+   Copyright (C) 1998-1999, 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "c-strcase.h"
+
+#include <limits.h>
+
+#include "c-ctype.h"
+
+int
+c_strcasecmp (const char *s1, const char *s2)
+{
+  register const unsigned char *p1 = (const unsigned char *) s1;
+  register const unsigned char *p2 = (const unsigned char *) s2;
+  unsigned char c1, c2;
+
+  if (p1 == p2)
+    return 0;
+
+  do
+    {
+      c1 = c_tolower (*p1);
+      c2 = c_tolower (*p2);
+
+      if (c1 == '\0')
+        break;
+
+      ++p1;
+      ++p2;
+    }
+  while (c1 == c2);
+
+  if (UCHAR_MAX <= INT_MAX)
+    return c1 - c2;
+  else
+    /* On machines where 'char' and 'int' are types of the same size, the
+       difference of two 'unsigned char' values - including the sign bit -
+       doesn't fit in an 'int'.  */
+    return _GL_CMP (c1, c2);
+}
deleted file mode 120000 (symlink)
index 9963e68b1938e6580185e42b3655dcce9e22f59b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c-strcaseeq.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..26e05c93c3338d4f5d20f8997a6e272ae2c21638
--- /dev/null
@@ -0,0 +1,181 @@
+/* Optimized case-insensitive string comparison in C locale.
+   Copyright (C) 2001-2002, 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>.  */
+
+#include "c-strcase.h"
+#include "c-ctype.h"
+
+/* STRCASEEQ allows to optimize string comparison with a small literal string.
+     STRCASEEQ (s, "UTF-8", 'U','T','F','-','8',0,0,0,0)
+   is semantically equivalent to
+     c_strcasecmp (s, "UTF-8") == 0
+   just faster.  */
+
+/* Help GCC to generate good code for string comparisons with
+   immediate strings. */
+#if (defined __GNUC__ || defined __clang__) && defined __OPTIMIZE__
+
+/* Case insensitive comparison of ASCII characters.  */
+# if C_CTYPE_ASCII
+#  define CASEEQ(other,upper) \
+     (c_isupper (upper) ? ((other) & ~0x20) == (upper) : (other) == (upper))
+# else
+#  define CASEEQ(other,upper) \
+     (c_toupper (other) == (upper))
+# endif
+
+static inline int
+strcaseeq9 (const char *s1, const char *s2)
+{
+  return c_strcasecmp (s1 + 9, s2 + 9) == 0;
+}
+
+static inline int
+strcaseeq8 (const char *s1, const char *s2, char s28)
+{
+  if (CASEEQ (s1[8], s28))
+    {
+      if (s28 == 0)
+        return 1;
+      else
+        return strcaseeq9 (s1, s2);
+    }
+  else
+    return 0;
+}
+
+static inline int
+strcaseeq7 (const char *s1, const char *s2, char s27, char s28)
+{
+  if (CASEEQ (s1[7], s27))
+    {
+      if (s27 == 0)
+        return 1;
+      else
+        return strcaseeq8 (s1, s2, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+strcaseeq6 (const char *s1, const char *s2, char s26, char s27, char s28)
+{
+  if (CASEEQ (s1[6], s26))
+    {
+      if (s26 == 0)
+        return 1;
+      else
+        return strcaseeq7 (s1, s2, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+strcaseeq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
+{
+  if (CASEEQ (s1[5], s25))
+    {
+      if (s25 == 0)
+        return 1;
+      else
+        return strcaseeq6 (s1, s2, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+strcaseeq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
+{
+  if (CASEEQ (s1[4], s24))
+    {
+      if (s24 == 0)
+        return 1;
+      else
+        return strcaseeq5 (s1, s2, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+strcaseeq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (CASEEQ (s1[3], s23))
+    {
+      if (s23 == 0)
+        return 1;
+      else
+        return strcaseeq4 (s1, s2, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+strcaseeq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (CASEEQ (s1[2], s22))
+    {
+      if (s22 == 0)
+        return 1;
+      else
+        return strcaseeq3 (s1, s2, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+strcaseeq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (CASEEQ (s1[1], s21))
+    {
+      if (s21 == 0)
+        return 1;
+      else
+        return strcaseeq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+strcaseeq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (CASEEQ (s1[0], s20))
+    {
+      if (s20 == 0)
+        return 1;
+      else
+        return strcaseeq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+#define STRCASEEQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+  strcaseeq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
+
+#else
+
+#define STRCASEEQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+  (c_strcasecmp (s1, s2) == 0)
+
+#endif
deleted file mode 120000 (symlink)
index 2648a039ac3ceedb5d5c8d09beedfef8cb24f1ed..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c-strncasecmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4c8b0b6b8411bf947b227752fc5ed9aa799c1215
--- /dev/null
@@ -0,0 +1,56 @@
+/* c-strncasecmp.c -- case insensitive string comparator in C locale
+   Copyright (C) 1998-1999, 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "c-strcase.h"
+
+#include <limits.h>
+
+#include "c-ctype.h"
+
+int
+c_strncasecmp (const char *s1, const char *s2, size_t n)
+{
+  register const unsigned char *p1 = (const unsigned char *) s1;
+  register const unsigned char *p2 = (const unsigned char *) s2;
+  unsigned char c1, c2;
+
+  if (p1 == p2 || n == 0)
+    return 0;
+
+  do
+    {
+      c1 = c_tolower (*p1);
+      c2 = c_tolower (*p2);
+
+      if (--n == 0 || c1 == '\0')
+        break;
+
+      ++p1;
+      ++p2;
+    }
+  while (c1 == c2);
+
+  if (UCHAR_MAX <= INT_MAX)
+    return c1 - c2;
+  else
+    /* On machines where 'char' and 'int' are types of the same size, the
+       difference of two 'unsigned char' values - including the sign bit -
+       doesn't fit in an 'int'.  */
+    return _GL_CMP (c1, c2);
+}
deleted file mode 120000 (symlink)
index 01747f4d4b888fe8d7b0d83a67b872668ee85bb8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32_apply_type_test.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4d3ee90827049cf454e63269e336dae3dc3b5a4e
--- /dev/null
@@ -0,0 +1,39 @@
+/* Apply a 32-bit wide character property test.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#define IN_C32_APPLY_TYPE_TEST
+/* Specification.  */
+#include <uchar.h>
+
+#include <string.h>
+#include <wctype.h>
+
+#if _GL_WCHAR_T_IS_UCS4
+_GL_EXTERN_INLINE
+#endif
+int
+c32_apply_type_test (wint_t wc, c32_type_test_t property)
+{
+#if _GL_WCHAR_T_IS_UCS4
+  return iswctype (wc, property);
+#else
+  return property (wc);
+#endif
+}
deleted file mode 120000 (symlink)
index 1fd6febbb0e612471eee2a7b42f9b0c5d3fe6cb9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32_get_type_test.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..90bee394e7361e3be9df7a04552a3ac1b7a42ee3
--- /dev/null
@@ -0,0 +1,113 @@
+/* Get descriptor for a 32-bit wide character property.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#define IN_C32_GET_TYPE_TEST
+/* Specification.  */
+#include <uchar.h>
+
+#include <string.h>
+#include <wctype.h>
+
+#if _GL_WCHAR_T_IS_UCS4
+_GL_EXTERN_INLINE
+#endif
+c32_type_test_t
+c32_get_type_test (const char *name)
+{
+#if _GL_WCHAR_T_IS_UCS4
+  return wctype (name);
+#else
+  switch (name[0])
+    {
+    case 'a':
+      switch (name[1])
+        {
+        case 'l':
+          switch (name[2])
+            {
+            case 'n':
+              if (strcmp (name + 3, "um") == 0)
+                return c32isalnum;
+              break;
+            case 'p':
+              if (strcmp (name + 3, "ha") == 0)
+                return c32isalpha;
+              break;
+            default:
+              break;
+            }
+          break;
+        default:
+          break;
+        }
+      break;
+    case 'b':
+      if (strcmp (name + 1, "lank") == 0)
+        return c32isblank;
+      break;
+    case 'c':
+      if (strcmp (name + 1, "ntrl") == 0)
+        return c32iscntrl;
+      break;
+    case 'd':
+      if (strcmp (name + 1, "igit") == 0)
+        return c32isdigit;
+      break;
+    case 'g':
+      if (strcmp (name + 1, "raph") == 0)
+        return c32isgraph;
+      break;
+    case 'l':
+      if (strcmp (name + 1, "ower") == 0)
+        return c32islower;
+      break;
+    case 'p':
+      switch (name[1])
+        {
+        case 'r':
+          if (strcmp (name + 2, "int") == 0)
+            return c32isprint;
+          break;
+        case 'u':
+          if (strcmp (name + 2, "nct") == 0)
+            return c32ispunct;
+          break;
+        default:
+          break;
+        }
+      break;
+    case 's':
+      if (strcmp (name + 1, "pace") == 0)
+        return c32isspace;
+      break;
+    case 'u':
+      if (strcmp (name + 1, "pper") == 0)
+        return c32isupper;
+      break;
+    case 'x':
+      if (strcmp (name + 1, "digit") == 0)
+        return c32isxdigit;
+      break;
+    default:
+      break;
+    }
+  return (c32_type_test_t) 0;
+#endif
+}
deleted file mode 120000 (symlink)
index 6b0a0894b27985fe7496cf373516a0a4ed85fcf0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32is-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..084b3a02cf79bffa4ecf7670b3d798c4b6db192a
--- /dev/null
@@ -0,0 +1,105 @@
+/* Test whether a 32-bit wide character belongs to a specific character class.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <wchar.h>
+#include <wctype.h>
+
+#ifdef __CYGWIN__
+# include <cygwin/version.h>
+#endif
+
+#if GNULIB_defined_mbstate_t
+# include "localcharset.h"
+# include "streq.h"
+#endif
+
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
+#include "unictype.h"
+
+#if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t
+_GL_EXTERN_INLINE
+#endif
+int
+FUNC (wint_t wc)
+{
+  /* The char32_t encoding of a multibyte character is defined by the way
+     mbrtoc32() is defined.  */
+
+#if GNULIB_defined_mbstate_t            /* AIX, IRIX */
+  /* mbrtoc32() is defined on top of mbtowc() for the non-UTF-8 locales
+     and directly for the UTF-8 locales.  */
+  if (wc != WEOF)
+    {
+      const char *encoding = locale_charset ();
+      if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+        return UCS_FUNC (wc);
+      else
+        return WCHAR_FUNC (wc);
+    }
+  else
+    return 0;
+
+#elif HAVE_WORKING_MBRTOC32             /* glibc, Android */
+  /* mbrtoc32() is essentially defined by the system libc.  */
+
+# if _GL_WCHAR_T_IS_UCS4
+  /* The char32_t encoding of a multibyte character is known to be the same as
+     the wchar_t encoding.  */
+  return WCHAR_FUNC (wc);
+# else
+  /* The char32_t encoding of a multibyte character is known to be UCS-4,
+     different from the wchar_t encoding.  */
+  if (wc != WEOF)
+    return UCS_FUNC (wc);
+  else
+    return 0;
+# endif
+
+#elif _GL_SMALL_WCHAR_T                 /* Cygwin, mingw, MSVC */
+  /* The wchar_t encoding is UTF-16.
+     The char32_t encoding is UCS-4.  */
+
+# if defined __CYGWIN__ && CYGWIN_VERSION_DLL_MAJOR >= 1007
+  /* As an extension to POSIX, the iswalnum() function of Cygwin >= 1.7
+     supports also wc arguments outside the Unicode BMP, that is, outside
+     the 'wchar_t' range.  See
+     <https://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00019.html>
+     = <https://cygwin.com/ml/cygwin/2011-02/msg00044.html>.  */
+  return WCHAR_FUNC (wc);
+# else
+  if (wc == WEOF || wc == (wchar_t) wc)
+    /* wc is in the range for the isw* functions.  */
+    return WCHAR_FUNC (wc);
+  else
+    return UCS_FUNC (wc);
+# endif
+
+#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */
+  /* char32_t and wchar_t are equivalent.  */
+  static_assert (sizeof (char32_t) == sizeof (wchar_t));
+
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  return UCS_FUNC (wc);
+# else
+  return WCHAR_FUNC (wc);
+# endif
+#endif
+}
deleted file mode 120000 (symlink)
index 1de92bf6d186894dc9d3dd8ae168a593be8d7303..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32isalnum.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6335af6de47bb247c8fe23a6a6f8b004f2568da9
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being alphanumeric.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISALNUM
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32isalnum
+#define WCHAR_FUNC iswalnum
+#define UCS_FUNC uc_is_alnum
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index 286af37686f7799f58298957009f6d4c7a6adc36..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32isalpha.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ea43be56b5ff64c606e693e4889946c6376fa49f
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being alphabetic.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISALPHA
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32isalpha
+#define WCHAR_FUNC iswalpha
+#define UCS_FUNC uc_is_alpha
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index c609dfc63e38c924dc16c8255a06d3cd2e8aee0d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32isblank.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ee06d3d05b7fcd5564d56b0b8681664621613142
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being blank.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISBLANK
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32isblank
+#define WCHAR_FUNC iswblank
+#define UCS_FUNC uc_is_blank
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index 05d8b21b306c5bbe18c7fa0fc857d597152c7e10..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32iscntrl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1f50527bd7057f39132a7b833996b534301f079c
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being a control character.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISCNTRL
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32iscntrl
+#define WCHAR_FUNC iswcntrl
+#define UCS_FUNC uc_is_cntrl
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index 62bd51e5d4e88fcbf599629f70034d74a7ed165e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32isdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4cb99c2a0e19ccc82626e93d18f3e2c9dff6a796
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being a digit.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISDIGIT
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32isdigit
+#define WCHAR_FUNC iswdigit
+#define UCS_FUNC uc_is_digit
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index e86d21e50ca8d9c117931e9ba525d81f682d2e01..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32isgraph.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..407d6d1a24b4021c526631b62ed4185125e0e906
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being graphic.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISGRAPH
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32isgraph
+#define WCHAR_FUNC iswgraph
+#define UCS_FUNC uc_is_graph
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index 2a0c021140637b6e4c3adf47cb55adbc9ce65f5b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32islower.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f2bfda7c02cc81b52c147535b77fc720f726f0e5
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being lowercase.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISLOWER
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32islower
+#define WCHAR_FUNC iswlower
+#define UCS_FUNC uc_is_lower
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index c3da239c1729bc21b70f3ce002963e4a3c1a8231..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32isprint.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fd8d7a630a06cc22d2641c1d9ab94da94ba2f569
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being printable.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISPRINT
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32isprint
+#define WCHAR_FUNC iswprint
+#define UCS_FUNC uc_is_print
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index f337b5325d6283735e7eaa991500d65895c77444..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32ispunct.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..03d64699f58be71d578b32ec8d09c8e45e6ccdb9
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being a punctuation or symbol character.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISPUNCT
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32ispunct
+#define WCHAR_FUNC iswpunct
+#define UCS_FUNC uc_is_punct
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index 2af23d34c845306b6af08de2603bdc56fdb15b1b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32isspace.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1449fc4e71b26dae83e87ebcebf8b437a19736dd
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being white-space.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISSPACE
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32isspace
+#define WCHAR_FUNC iswspace
+#define UCS_FUNC uc_is_space
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index f2876b2697d7aa1caf75e39856e541c73475bace..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32isupper.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4b21860314c3537ac81797e542ee89b9fe2a9b97
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being uppercase.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISUPPER
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32isupper
+#define WCHAR_FUNC iswupper
+#define UCS_FUNC uc_is_upper
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index 11e503915b608b101e39176ccf1af279ff3e94f9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32isxdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..133d010360d5bd56b787a40dcad0ac2a1bf6ec0e
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test 32-bit wide character for being a hexadecimal digit.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32ISXDIGIT
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32isxdigit
+#define WCHAR_FUNC iswxdigit
+#define UCS_FUNC uc_is_xdigit
+#include "c32is-impl.h"
deleted file mode 120000 (symlink)
index d5faf7e8256c98c44cd2be97dc6fc53031cee19c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32to-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e94fa7dc9c26b1f0938630b4101f009f5dbcdba0
--- /dev/null
@@ -0,0 +1,92 @@
+/* Case mapping of a 32-bit wide character.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <wchar.h>
+#include <wctype.h>
+
+#if GNULIB_defined_mbstate_t
+# include "localcharset.h"
+# include "streq.h"
+#endif
+
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
+#include "unicase.h"
+
+#if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t
+_GL_EXTERN_INLINE
+#endif
+wint_t
+FUNC (wint_t wc)
+{
+  /* The char32_t encoding of a multibyte character is defined by the way
+     mbrtoc32() is defined.  */
+
+#if GNULIB_defined_mbstate_t            /* AIX, IRIX */
+  /* mbrtoc32() is defined on top of mbtowc() for the non-UTF-8 locales
+     and directly for the UTF-8 locales.  */
+  if (wc != WEOF)
+    {
+      const char *encoding = locale_charset ();
+      if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+        return UCS_FUNC (wc);
+      else
+        return WCHAR_FUNC (wc);
+    }
+  else
+    return wc;
+
+#elif HAVE_WORKING_MBRTOC32             /* glibc, Android */
+  /* mbrtoc32() is essentially defined by the system libc.  */
+
+# if _GL_WCHAR_T_IS_UCS4
+  /* The char32_t encoding of a multibyte character is known to be the same as
+     the wchar_t encoding.  */
+  return WCHAR_FUNC (wc);
+# else
+  /* The char32_t encoding of a multibyte character is known to be UCS-4,
+     different from the wchar_t encoding.  */
+  if (wc != WEOF)
+    return UCS_FUNC (wc);
+  else
+    return wc;
+# endif
+
+#elif _GL_SMALL_WCHAR_T                 /* Cygwin, mingw, MSVC */
+  /* The wchar_t encoding is UTF-16.
+     The char32_t encoding is UCS-4.  */
+
+  if (wc == WEOF || wc == (wchar_t) wc)
+    /* wc is in the range for the tow* functions.  */
+    return WCHAR_FUNC (wc);
+  else
+    return UCS_FUNC (wc);
+
+#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */
+  /* char32_t and wchar_t are equivalent.  */
+  static_assert (sizeof (char32_t) == sizeof (wchar_t));
+
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  return UCS_FUNC (wc);
+# else
+  return WCHAR_FUNC (wc);
+# endif
+#endif
+}
deleted file mode 120000 (symlink)
index 85d9f860dd897d15a6f33094c9681c827a634033..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32tolower.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..52b149b19d6283baba05852026169dd494e2709d
--- /dev/null
@@ -0,0 +1,26 @@
+/* Map a 32-bit wide character to lowercase.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_C32TOLOWER
+/* Specification.  */
+#include <uchar.h>
+
+#define FUNC c32tolower
+#define WCHAR_FUNC towlower
+#define UCS_FUNC uc_tolower
+#include "c32to-impl.h"
deleted file mode 120000 (symlink)
index 7271e0d1281bba3b83747a85e765c3e8a5819a18..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/c32width.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7edf0088f9cef78cc635c1c28e3a47b93f557fe0
--- /dev/null
@@ -0,0 +1,102 @@
+/* Determine the number of screen columns needed for a 32-bit wide character.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#define IN_C32WIDTH
+/* Specification.  */
+#include <uchar.h>
+
+#include <wchar.h>
+
+#ifdef __CYGWIN__
+# include <cygwin/version.h>
+#endif
+
+#if GNULIB_defined_mbstate_t
+# include "streq.h"
+#endif
+
+#include "localcharset.h"
+
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
+#include "uniwidth.h"
+
+#if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t
+_GL_EXTERN_INLINE
+#endif
+int
+c32width (char32_t wc)
+{
+  /* The char32_t encoding of a multibyte character is defined by the way
+     mbrtoc32() is defined.  */
+
+#if GNULIB_defined_mbstate_t            /* AIX, IRIX */
+  /* mbrtoc32() is defined on top of mbtowc() for the non-UTF-8 locales
+     and directly for the UTF-8 locales.  */
+  const char *encoding = locale_charset ();
+  if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+    return uc_width (wc, encoding);
+  else
+    return wcwidth (wc);
+
+#elif HAVE_WORKING_MBRTOC32             /* glibc, Android */
+  /* mbrtoc32() is essentially defined by the system libc.  */
+
+# if _GL_WCHAR_T_IS_UCS4
+  /* The char32_t encoding of a multibyte character is known to be the same as
+     the wchar_t encoding.  */
+  return wcwidth (wc);
+# else
+  /* The char32_t encoding of a multibyte character is known to be UCS-4,
+     different from the wchar_t encoding.  */
+  return uc_width (wc, locale_charset ());
+# endif
+
+#elif _GL_SMALL_WCHAR_T                 /* Cygwin, mingw, MSVC */
+  /* The wchar_t encoding is UTF-16.
+     The char32_t encoding is UCS-4.  */
+
+# if defined __CYGWIN__ && CYGWIN_VERSION_DLL_MAJOR >= 1007 && 0
+  /* As an extension to POSIX, the wcwidth() function of Cygwin >= 1.7
+     supports also wc arguments outside the Unicode BMP, that is, outside
+     the 'wchar_t' range.  See
+     <https://www.cygwin.com/cgit/newlib-cygwin/commit/?id=098a75dc51caa98f369d98a9809d773bc45329aa>.
+     But the resulting values for these characters are not of good quality.  */
+  return wcwidth (wc);
+# else
+  if (wc == (wchar_t) wc)
+    /* wc is in the range for the wcwidth function.  */
+    return wcwidth (wc);
+  else
+    return uc_width (wc, locale_charset ());
+# endif
+
+#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */
+  /* char32_t and wchar_t are equivalent.  */
+  static_assert (sizeof (char32_t) == sizeof (wchar_t));
+
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  return uc_width (wc, locale_charset ());
+# endif
+  return wcwidth (wc);
+#endif
+}
deleted file mode 120000 (symlink)
index 6d2b97e9377f84a75df8a4306380a2c5e0863928..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/calloc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..81dfd3efb53e297e430075bf612f150b81a86309
--- /dev/null
@@ -0,0 +1,55 @@
+/* calloc() function that is glibc compatible.
+   This wrapper function is required at least on Tru64 UNIX 5.1 and mingw.
+   Copyright (C) 2004-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering and Bruno Haible */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+
+#include "xalloc-oversized.h"
+
+/* Call the system's calloc below.  */
+#undef calloc
+
+/* Allocate and zero-fill an NxS-byte block of memory from the heap,
+   even if N or S is zero.  */
+
+void *
+rpl_calloc (size_t n, size_t s)
+{
+  if (n == 0 || s == 0)
+    n = s = 1;
+
+  if (xalloc_oversized (n, s))
+    {
+      errno = ENOMEM;
+      return NULL;
+    }
+
+  void *result = calloc (n, s);
+
+#if !HAVE_MALLOC_POSIX
+  if (result == NULL)
+    errno = ENOMEM;
+#endif
+
+  return result;
+}
deleted file mode 120000 (symlink)
index a5f15463cd2e9a5ab2f742bbb526c80f2b1365aa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/canon-host.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d513904949faa22a112bbffd555bde9c114189cf
--- /dev/null
@@ -0,0 +1,91 @@
+/* Host name canonicalization
+
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   Written by Derek Price <derek@ximbiot.com>.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "canon-host.h"
+
+#include <string.h>
+#include <netdb.h>
+
+/* Store the last error for the single-threaded version of this function.  */
+static int last_cherror;
+
+/* Single-threaded of wrapper for canon_host_r.  After a NULL return, error
+   messages may be retrieved via ch_strerror().  */
+char *
+canon_host (const char *host)
+{
+  return canon_host_r (host, &last_cherror);
+}
+
+/* Return a malloc'd string containing the canonical hostname associated with
+   HOST, or NULL if a canonical name cannot be determined.  On NULL return,
+   if CHERROR is not NULL, set *CHERROR to an error code as returned by
+   getaddrinfo().  Use ch_strerror_r() or gai_strerror() to convert a *CHERROR
+   value to a string suitable for error messages.
+
+   WARNINGS
+     HOST must be a string representation of a resolvable name for this host.
+     Strings containing an IP address in dotted decimal notation will be
+     returned as-is, without further resolution.
+
+     The use of the word "canonical" in this context is unfortunate but
+     entrenched.  The value returned by this function will be the end result
+     of the resolution of any CNAME chains in the DNS.  There may only be one
+     such value for any given hostname, though the actual IP address
+     referenced by this value and the device using that IP address may each
+     actually have any number of such "canonical" hostnames.  See the POSIX
+     getaddrinfo spec
+     <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>,
+     RFC 1034 <https://www.ietf.org/rfc/rfc1034.txt>, & RFC 2181
+     <https://www.ietf.org/rfc/rfc2181.txt> for more on what this confusing
+     term really refers to. */
+char *
+canon_host_r (char const *host, int *cherror)
+{
+  char *retval = NULL;
+  static struct addrinfo hints;
+  struct addrinfo *res = NULL;
+  int status;
+
+  hints.ai_flags = AI_CANONNAME;
+  status = getaddrinfo (host, NULL, &hints, &res);
+  if (!status)
+    {
+      /* https://lists.gnu.org/r/bug-coreutils/2006-09/msg00300.html
+         says Darwin 7.9.0 getaddrinfo returns 0 but sets
+         res->ai_canonname to NULL.  */
+      retval = strdup (res->ai_canonname ? res->ai_canonname : host);
+      if (!retval && cherror)
+        *cherror = EAI_MEMORY;
+      freeaddrinfo (res);
+    }
+  else if (cherror)
+    *cherror = status;
+
+  return retval;
+}
+
+/* Return a string describing the last error encountered by canon_host.  */
+const char *
+ch_strerror (void)
+{
+  return gai_strerror (last_cherror);
+}
deleted file mode 120000 (symlink)
index 44cd6399d98b2a8a47197a4077259ece07292322..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/canon-host.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3c7e5785cd295f70070bb9de75015d4f6b47e866
--- /dev/null
@@ -0,0 +1,38 @@
+/* Host name canonicalization
+
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   Written by Derek Price <derek@ximbiot.com>
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef CANON_HOST_H
+# define CANON_HOST_H 1
+
+/* This file uses _GL_ATTRIBUTE_MALLOC.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <stdlib.h>
+
+char *canon_host (char const *host)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+char *canon_host_r (char const *host, int *cherror)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+
+const char *ch_strerror (void);
+# define ch_strerror_r(cherror) gai_strerror (cherror);
+
+#endif /* !CANON_HOST_H */
deleted file mode 120000 (symlink)
index 67bc87b6f285a6a803b92596558dacb2e49f1297..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/canonicalize.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..52e9b3b371cc637c365bac1ac9f15a4dd1ce3054
--- /dev/null
@@ -0,0 +1,469 @@
+/* Return the canonical absolute name of a given file.
+   Copyright (C) 1996-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "canonicalize.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <filename.h>
+#include <idx.h>
+#include <intprops.h>
+#include <scratch_buffer.h>
+
+#include "attribute.h"
+#include "file-set.h"
+#include "hash-triple.h"
+#include "xalloc.h"
+
+#ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
+# define DOUBLE_SLASH_IS_DISTINCT_ROOT false
+#endif
+
+#if ISSLASH ('\\')
+# define SLASHES "/\\"
+#else
+# define SLASHES "/"
+#endif
+
+/* Avoid false GCC warning "'end_idx' may be used uninitialized".  */
+#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
+
+/* Return true if FILE's existence can be shown, false (setting errno)
+   otherwise.  Follow symbolic links.  */
+static bool
+file_accessible (char const *file)
+{
+# if HAVE_FACCESSAT
+  return faccessat (AT_FDCWD, file, F_OK, AT_EACCESS) == 0;
+# else
+  struct stat st;
+  return stat (file, &st) == 0 || errno == EOVERFLOW;
+# endif
+}
+
+/* True if concatenating END as a suffix to a file name means that the
+   code needs to check that the file name is that of a searchable
+   directory, since the canonicalize_filename_mode_stk code won't
+   check this later anyway when it checks an ordinary file name
+   component within END.  END must either be empty, or start with a
+   slash.  */
+
+static bool _GL_ATTRIBUTE_PURE
+suffix_requires_dir_check (char const *end)
+{
+  /* If END does not start with a slash, the suffix is OK.  */
+  while (ISSLASH (*end))
+    {
+      /* Two or more slashes act like a single slash.  */
+      do
+        end++;
+      while (ISSLASH (*end));
+
+      switch (*end++)
+        {
+        default: return false;  /* An ordinary file name component is OK.  */
+        case '\0': return true; /* Trailing "/" is trouble.  */
+        case '.': break;        /* Possibly "." or "..".  */
+        }
+      /* Trailing "/.", or "/.." even if not trailing, is trouble.  */
+      if (!*end || (*end == '.' && (!end[1] || ISSLASH (end[1]))))
+        return true;
+    }
+
+  return false;
+}
+
+/* Append this to a file name to test whether it is a searchable directory.
+   On POSIX platforms "/" suffices, but "/./" is sometimes needed on
+   macOS 10.13 <https://bugs.gnu.org/30350>, and should also work on
+   platforms like AIX 7.2 that need at least "/.".  */
+
+#ifdef LSTAT_FOLLOWS_SLASHED_SYMLINK
+static char const dir_suffix[] = "/";
+#else
+static char const dir_suffix[] = "/./";
+#endif
+
+/* Return true if DIR is a searchable dir, false (setting errno) otherwise.
+   DIREND points to the NUL byte at the end of the DIR string.
+   Store garbage into DIREND[0 .. strlen (dir_suffix)].  */
+
+static bool
+dir_check (char *dir, char *dirend)
+{
+  strcpy (dirend, dir_suffix);
+  return file_accessible (dir);
+}
+
+#if !((HAVE_CANONICALIZE_FILE_NAME && FUNC_REALPATH_WORKS)      \
+      || GNULIB_CANONICALIZE_LGPL)
+/* Return the canonical absolute name of file NAME.  A canonical name
+   does not contain any ".", ".." components nor any repeated file name
+   separators ('/') or symlinks.  All components must exist.
+   The result is malloc'd.  */
+
+char *
+canonicalize_file_name (const char *name)
+{
+  return canonicalize_filename_mode (name, CAN_EXISTING);
+}
+#endif /* !HAVE_CANONICALIZE_FILE_NAME */
+
+static bool
+multiple_bits_set (canonicalize_mode_t i)
+{
+  return (i & (i - 1)) != 0;
+}
+
+/* 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)
+    {
+      idx_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;
+}
+
+/* Scratch buffers used by canonicalize_filename_mode_stk and managed
+   by __realpath.  */
+struct realpath_bufs
+{
+  struct scratch_buffer rname;
+  struct scratch_buffer extra;
+  struct scratch_buffer link;
+};
+
+static char *
+canonicalize_filename_mode_stk (const char *name, canonicalize_mode_t can_mode,
+                                struct realpath_bufs *bufs)
+{
+  char *dest;
+  char const *start;
+  char const *end;
+  Hash_table *ht = NULL;
+  bool logical = (can_mode & CAN_NOLINKS) != 0;
+  int num_links = 0;
+
+  canonicalize_mode_t can_exist = can_mode & CAN_MODE_MASK;
+  if (multiple_bits_set (can_exist))
+    {
+      errno = EINVAL;
+      return NULL;
+    }
+
+  if (name == NULL)
+    {
+      errno = EINVAL;
+      return NULL;
+    }
+
+  if (name[0] == '\0')
+    {
+      errno = ENOENT;
+      return NULL;
+    }
+
+  char *rname = bufs->rname.data;
+  bool end_in_extra_buffer = false;
+  bool failed = true;
+
+  /* This is always zero for Posix hosts, but can be 2 for MS-Windows
+     and MS-DOS X:/foo/bar file names.  */
+  idx_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
+
+  if (!IS_ABSOLUTE_FILE_NAME (name))
+    {
+      while (!getcwd (bufs->rname.data, bufs->rname.length))
+        {
+          switch (errno)
+            {
+            case ERANGE:
+              if (scratch_buffer_grow (&bufs->rname))
+                break;
+              FALLTHROUGH;
+            case ENOMEM:
+              xalloc_die ();
+
+            default:
+              dest = rname;
+              goto error;
+            }
+          rname = bufs->rname.data;
+        }
+      dest = rawmemchr (rname, '\0');
+      start = name;
+      prefix_len = FILE_SYSTEM_PREFIX_LEN (rname);
+    }
+  else
+    {
+      dest = mempcpy (rname, name, prefix_len);
+      *dest++ = '/';
+      if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
+        {
+          if (prefix_len == 0 /* implies ISSLASH (name[0]) */
+              && ISSLASH (name[1]) && !ISSLASH (name[2]))
+            {
+              *dest++ = '/';
+#if defined _WIN32 && !defined __CYGWIN__
+              /* For UNC file names '\\server\path\to\file', extend the prefix
+                 to include the server: '\\server\'.  */
+              {
+                idx_t i;
+                for (i = 2; name[i] != '\0' && !ISSLASH (name[i]); )
+                  i++;
+                if (name[i] != '\0' /* implies ISSLASH (name[i]) */
+                    && i + 1 < bufs->rname.length)
+                  {
+                    prefix_len = i;
+                    memcpy (dest, name + 2, i - 2 + 1);
+                    dest += i - 2 + 1;
+                  }
+                else
+                  {
+                    /* Either name = '\\server'; this is an invalid file name.
+                       Or name = '\\server\...' and server is more than
+                       bufs->rname.length - 4 bytes long.  In either
+                       case, stop the UNC processing.  */
+                  }
+              }
+#endif
+            }
+          *dest = '\0';
+        }
+      start = name + prefix_len;
+    }
+
+  for ( ; *start; start = end)
+    {
+      /* Skip sequence of multiple file name separators.  */
+      while (ISSLASH (*start))
+        ++start;
+
+      /* Find end of component.  */
+      for (end = start; *end && !ISSLASH (*end); ++end)
+        /* Nothing.  */;
+
+      /* Length of this file name component; it can be zero if a file
+         name ends in '/'.  */
+      idx_t startlen = end - start;
+
+      if (startlen == 0)
+        break;
+      else if (startlen == 1 && start[0] == '.')
+        /* nothing */;
+      else if (startlen == 2 && start[0] == '.' && start[1] == '.')
+        {
+          /* Back up to previous component, ignore if at root already.  */
+          if (dest > rname + prefix_len + 1)
+            for (--dest; dest > rname && !ISSLASH (dest[-1]); --dest)
+              continue;
+          if (DOUBLE_SLASH_IS_DISTINCT_ROOT
+              && dest == rname + 1 && !prefix_len
+              && ISSLASH (*dest) && !ISSLASH (dest[1]))
+            dest++;
+        }
+      else
+        {
+          if (!ISSLASH (dest[-1]))
+            *dest++ = '/';
+
+          while (rname + bufs->rname.length - dest
+                 < startlen + sizeof dir_suffix)
+            {
+              idx_t dest_offset = dest - rname;
+              if (!scratch_buffer_grow_preserve (&bufs->rname))
+                xalloc_die ();
+              rname = bufs->rname.data;
+              dest = rname + dest_offset;
+            }
+
+          dest = mempcpy (dest, start, startlen);
+          *dest = '\0';
+
+          char *buf;
+          ssize_t n = -1;
+          if (!logical)
+            {
+              while (true)
+                {
+                  buf = bufs->link.data;
+                  idx_t bufsize = bufs->link.length;
+                  n = readlink (rname, buf, bufsize - 1);
+                  if (n < bufsize - 1)
+                    break;
+                  if (!scratch_buffer_grow (&bufs->link))
+                    xalloc_die ();
+                }
+            }
+          if (0 <= n)
+            {
+              /* A physical traversal and RNAME is a symbolic link.  */
+
+              if (num_links < 20)
+                num_links++;
+              else if (*start)
+                {
+                  /* Enough symlinks have been seen that it is time to
+                     worry about being in a symlink cycle.
+                     Get the device and inode of the parent directory, as
+                     pre-2017 POSIX says this info is not reliable for
+                     symlinks.  */
+                  struct stat st;
+                  dest[- startlen] = '\0';
+                  if (stat (*rname ? rname : ".", &st) != 0)
+                    goto error;
+                  dest[- startlen] = *start;
+
+                  /* Detect loops.  We cannot use the cycle-check module here,
+                     since it's possible to encounter the same parent
+                     directory more than once in a given traversal.  However,
+                     encountering the same (parentdir, START) pair twice does
+                     indicate a loop.  */
+                  if (seen_triple (&ht, start, &st))
+                    {
+                      if (can_exist == CAN_MISSING)
+                        continue;
+                      errno = ELOOP;
+                      goto error;
+                    }
+                }
+
+              buf[n] = '\0';
+
+              char *extra_buf = bufs->extra.data;
+              idx_t end_idx;
+              if (end_in_extra_buffer)
+                end_idx = end - extra_buf;
+              size_t len = strlen (end);
+              if (INT_ADD_OVERFLOW (len, n))
+                xalloc_die ();
+              while (bufs->extra.length <= len + n)
+                {
+                  if (!scratch_buffer_grow_preserve (&bufs->extra))
+                    xalloc_die ();
+                  extra_buf = bufs->extra.data;
+                }
+              if (end_in_extra_buffer)
+                end = extra_buf + end_idx;
+
+              /* Careful here, end may be a pointer into extra_buf... */
+              memmove (&extra_buf[n], end, len + 1);
+              name = end = memcpy (extra_buf, buf, n);
+              end_in_extra_buffer = true;
+
+              if (IS_ABSOLUTE_FILE_NAME (buf))
+                {
+                  idx_t pfxlen = FILE_SYSTEM_PREFIX_LEN (buf);
+
+                  dest = mempcpy (rname, buf, pfxlen);
+                  *dest++ = '/'; /* It's an absolute symlink */
+                  if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
+                    {
+                      if (ISSLASH (buf[1]) && !ISSLASH (buf[2]) && !pfxlen)
+                        *dest++ = '/';
+                      *dest = '\0';
+                    }
+                  /* Install the new prefix to be in effect hereafter.  */
+                  prefix_len = pfxlen;
+                }
+              else
+                {
+                  /* Back up to previous component, ignore if at root
+                     already: */
+                  if (dest > rname + prefix_len + 1)
+                    for (--dest; dest > rname && !ISSLASH (dest[-1]); --dest)
+                      continue;
+                  if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rname + 1
+                      && ISSLASH (*dest) && !ISSLASH (dest[1]) && !prefix_len)
+                    dest++;
+                }
+            }
+          else if (! (can_exist == CAN_MISSING
+                      || (suffix_requires_dir_check (end)
+                          ? dir_check (rname, dest)
+                          : !logical
+                          ? errno == EINVAL
+                          : *end || file_accessible (rname))
+                      || (can_exist == CAN_ALL_BUT_LAST
+                          && errno == ENOENT
+                          && !end[strspn (end, SLASHES)])))
+            goto error;
+        }
+    }
+  if (dest > rname + prefix_len + 1 && ISSLASH (dest[-1]))
+    --dest;
+  if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rname + 1 && !prefix_len
+      && ISSLASH (*dest) && !ISSLASH (dest[1]))
+    dest++;
+  failed = false;
+
+error:
+  if (ht)
+    hash_free (ht);
+
+  if (failed)
+    return NULL;
+
+  *dest++ = '\0';
+  char *result = malloc (dest - rname);
+  if (!result)
+    xalloc_die ();
+  return memcpy (result, rname, dest - rname);
+}
+
+/* Return the canonical absolute name of file NAME, while treating
+   missing elements according to CAN_MODE.  A canonical name
+   does not contain any ".", ".." components nor any repeated file name
+   separators ('/') or, depending on other CAN_MODE flags, symlinks.
+   Whether components must exist or not depends on canonicalize mode.
+   The result is malloc'd.  */
+
+char *
+canonicalize_filename_mode (const char *name, canonicalize_mode_t can_mode)
+{
+  struct realpath_bufs bufs;
+  scratch_buffer_init (&bufs.rname);
+  scratch_buffer_init (&bufs.extra);
+  scratch_buffer_init (&bufs.link);
+  char *result = canonicalize_filename_mode_stk (name, can_mode, &bufs);
+  scratch_buffer_free (&bufs.link);
+  scratch_buffer_free (&bufs.extra);
+  scratch_buffer_free (&bufs.rname);
+  return result;
+}
deleted file mode 120000 (symlink)
index 9345a80a4695978b45674e5f625b2a8c89762577..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/canonicalize.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fed014855cadcccc42f12f28c83f4d02d1205e09
--- /dev/null
@@ -0,0 +1,63 @@
+/* Return the canonical absolute name of a given file.
+   Copyright (C) 1996-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef CANONICALIZE_H_
+# define CANONICALIZE_H_
+
+/* This file uses _GL_ATTRIBUTE_MALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdlib.h> /* for canonicalize_file_name */
+
+#define CAN_MODE_MASK (CAN_EXISTING | CAN_ALL_BUT_LAST | CAN_MISSING)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum canonicalize_mode_t
+  {
+    /* All components must exist.  */
+    CAN_EXISTING = 0,
+
+    /* All components excluding last one must exist.  */
+    CAN_ALL_BUT_LAST = 1,
+
+    /* No requirements on components existence.  */
+    CAN_MISSING = 2,
+
+    /* Don't expand symlinks.  */
+    CAN_NOLINKS = 4
+  };
+typedef enum canonicalize_mode_t canonicalize_mode_t;
+
+/* Return the canonical absolute name of file NAME, while treating
+   missing elements according to CAN_MODE.  A canonical name
+   does not contain any `.', `..' components nor any repeated file name
+   separators ('/') or, depending on other CAN_MODE flags, symlinks.
+   Whether components must exist or not depends on canonicalize mode.
+   The result is malloc'd.
+   Upon failure, return NULL with errno set.  */
+char *canonicalize_filename_mode (const char *, canonicalize_mode_t)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !CANONICALIZE_H_ */
deleted file mode 120000 (symlink)
index 19a0cce2cfffd729002d48c9c6314cc346d2ed69..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/careadlinkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f308b6963ae638776f7f4e995f5ab3050c031831
--- /dev/null
@@ -0,0 +1,182 @@
+/* Read symbolic links into a buffer without size limitation, relative to fd.
+
+   Copyright (C) 2001, 2003-2004, 2007, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
+
+#include <config.h>
+
+#include "careadlinkat.h"
+
+#include "idx.h"
+#include "minmax.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Define this independently so that stdint.h is not a prerequisite.  */
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
+#include "allocator.h"
+
+enum { STACK_BUF_SIZE = 1024 };
+
+/* Act like careadlinkat (see below), with an additional argument
+   STACK_BUF that can be used as temporary storage.
+
+   If GCC_LINT is defined, do not inline this function with GCC 10.1
+   and later, to avoid creating a pointer to the stack that GCC
+   -Wreturn-local-addr incorrectly complains about.  See:
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644
+   Although the noinline attribute can hurt performance a bit, no better way
+   to pacify GCC is known; even an explicit #pragma does not pacify GCC.
+   When the GCC bug is fixed this workaround should be limited to the
+   broken GCC versions.  */
+#if _GL_GNUC_PREREQ (10, 1)
+# if _GL_GNUC_PREREQ (12, 1)
+#  pragma GCC diagnostic ignored "-Wreturn-local-addr"
+# elif defined GCC_LINT || defined lint
+__attribute__ ((__noinline__))
+# elif __OPTIMIZE__ && !__NO_INLINE__
+#  define GCC_BOGUS_WRETURN_LOCAL_ADDR
+# endif
+#endif
+static char *
+readlink_stk (int fd, char const *filename,
+              char *buffer, size_t buffer_size,
+              struct allocator const *alloc,
+              ssize_t (*preadlinkat) (int, char const *, char *, size_t),
+              char stack_buf[STACK_BUF_SIZE])
+{
+  if (! alloc)
+    alloc = &stdlib_allocator;
+
+  if (!buffer)
+    {
+      buffer = stack_buf;
+      buffer_size = STACK_BUF_SIZE;
+    }
+
+  char *buf = buffer;
+  idx_t buf_size_max = MIN (IDX_MAX, MIN (SSIZE_MAX, SIZE_MAX));
+  idx_t buf_size = MIN (buffer_size, buf_size_max);
+
+  while (buf)
+    {
+      /* Attempt to read the link into the current buffer.  */
+      idx_t link_length = preadlinkat (fd, filename, buf, buf_size);
+      if (link_length < 0)
+        {
+          if (buf != buffer)
+            {
+              int readlinkat_errno = errno;
+              alloc->free (buf);
+              errno = readlinkat_errno;
+            }
+          return NULL;
+        }
+
+      idx_t link_size = link_length;
+
+      if (link_size < buf_size)
+        {
+          buf[link_size++] = '\0';
+
+          if (buf == stack_buf)
+            {
+              char *b = alloc->allocate (link_size);
+              buf_size = link_size;
+              if (! b)
+                break;
+              return memcpy (b, buf, link_size);
+            }
+
+          if (link_size < buf_size && buf != buffer && alloc->reallocate)
+            {
+              /* Shrink BUF before returning it.  */
+              char *b = alloc->reallocate (buf, link_size);
+              if (b)
+                return b;
+            }
+
+          return buf;
+        }
+
+      if (buf != buffer)
+        alloc->free (buf);
+
+      if (buf_size_max / 2 <= buf_size)
+        {
+          errno = ENAMETOOLONG;
+          return NULL;
+        }
+
+      buf_size = 2 * buf_size + 1;
+      buf = alloc->allocate (buf_size);
+    }
+
+  if (alloc->die)
+    alloc->die (buf_size);
+  errno = ENOMEM;
+  return NULL;
+}
+
+
+/* Assuming the current directory is FD, get the symbolic link value
+   of FILENAME as a null-terminated string and put it into a buffer.
+   If FD is AT_FDCWD, FILENAME is interpreted relative to the current
+   working directory, as in openat.
+
+   If the link is small enough to fit into BUFFER put it there.
+   BUFFER's size is BUFFER_SIZE, and BUFFER can be null
+   if BUFFER_SIZE is zero.
+
+   If the link is not small, put it into a dynamically allocated
+   buffer managed by ALLOC.  It is the caller's responsibility to free
+   the returned value if it is nonnull and is not BUFFER.  A null
+   ALLOC stands for the standard allocator.
+
+   The PREADLINKAT function specifies how to read links.  It operates
+   like POSIX readlinkat()
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>
+   but can assume that its first argument is the same as FD.
+
+   If successful, return the buffer address; otherwise return NULL and
+   set errno.  */
+
+char *
+careadlinkat (int fd, char const *filename,
+              char *buffer, size_t buffer_size,
+              struct allocator const *alloc,
+              ssize_t (*preadlinkat) (int, char const *, char *, size_t))
+{
+  /* Allocate the initial buffer on the stack.  This way, in the
+     common case of a symlink of small size, we get away with a
+     single small malloc instead of a big malloc followed by a
+     shrinking realloc.  */
+  #ifdef GCC_BOGUS_WRETURN_LOCAL_ADDR
+   #warning "GCC might issue a bogus -Wreturn-local-addr warning here."
+   #warning "See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644>."
+  #endif
+  char stack_buf[STACK_BUF_SIZE];
+  return readlink_stk (fd, filename, buffer, buffer_size, alloc,
+                       preadlinkat, stack_buf);
+}
deleted file mode 120000 (symlink)
index 0e053406c67a99330eecf3511f01765ab97b3d42..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/careadlinkat.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..473e6531e67acacf02c8ddb8f5b1eff8ab2d635b
--- /dev/null
@@ -0,0 +1,72 @@
+/* Read symbolic links into a buffer without size limitation, relative to fd.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
+
+#ifndef _GL_CAREADLINKAT_H
+#define _GL_CAREADLINKAT_H
+
+/* This file uses HAVE_READLINKAT.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <fcntl.h>
+#include <unistd.h>
+
+struct allocator;
+
+/* Assuming the current directory is FD, get the symbolic link value
+   of FILENAME as a null-terminated string and put it into a buffer.
+   If FD is AT_FDCWD, FILENAME is interpreted relative to the current
+   working directory, as in openat.
+
+   If the link is small enough to fit into BUFFER put it there.
+   BUFFER's size is BUFFER_SIZE, and BUFFER can be null
+   if BUFFER_SIZE is zero.
+
+   If the link is not small, put it into a dynamically allocated
+   buffer managed by ALLOC.  It is the caller's responsibility to free
+   the returned value if it is nonnull and is not BUFFER.
+
+   The PREADLINKAT function specifies how to read links.  It operates
+   like POSIX readlinkat()
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>
+   but can assume that its first argument is the same as FD.
+
+   If successful, return the buffer address; otherwise return NULL and
+   set errno.  */
+
+char *careadlinkat (int fd, char const *filename,
+                    char *restrict buffer, size_t buffer_size,
+                    struct allocator const *alloc,
+                    ssize_t (*preadlinkat) (int, char const *,
+                                            char *, size_t));
+
+/* Suitable value for careadlinkat's FD argument.  */
+#if HAVE_READLINKAT
+/* AT_FDCWD is declared in <fcntl.h>.  */
+#else
+/* Define AT_FDCWD independently, so that the careadlinkat module does
+   not depend on the fcntl-h module.  We might as well use the same value
+   as fcntl-h.  */
+# ifndef AT_FDCWD
+#  define AT_FDCWD (-3041965)
+# endif
+#endif
+
+#endif /* _GL_CAREADLINKAT_H */
deleted file mode 120000 (symlink)
index e92c3343bc436ac4163d22d78aae6f20814ec81c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/cdefs.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6cc5581c0e07a078722f3438e22f5091a843af38
--- /dev/null
@@ -0,0 +1,715 @@
+/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
+   Copyright The GNU Toolchain Authors.
+   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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef        _SYS_CDEFS_H
+#define        _SYS_CDEFS_H    1
+
+/* We are almost always included from features.h. */
+#ifndef _FEATURES_H
+# include <features.h>
+#endif
+
+/* The GNU libc does not support any K&R compilers or the traditional mode
+   of ISO C compilers anymore.  Check for some of the combinations not
+   supported anymore.  */
+#if defined __GNUC__ && !defined __STDC__
+# error "You need a ISO C conforming compiler to use the glibc headers"
+#endif
+
+/* Some user header file might have defined this before.  */
+#undef __P
+#undef __PMT
+
+/* Compilers that lack __has_attribute may object to
+       #if defined __has_attribute && __has_attribute (...)
+   even though they do not need to evaluate the right-hand side of the &&.
+   Similarly for __has_builtin, etc.  */
+#if (defined __has_attribute \
+     && (!defined __clang_minor__ \
+         || (defined __apple_build_version__ \
+             ? 7000000 <= __apple_build_version__ \
+             : 3 < __clang_major__ + (5 <= __clang_minor__))))
+# define __glibc_has_attribute(attr) __has_attribute (attr)
+#else
+# define __glibc_has_attribute(attr) 0
+#endif
+#ifdef __has_builtin
+# define __glibc_has_builtin(name) __has_builtin (name)
+#else
+# define __glibc_has_builtin(name) 0
+#endif
+#ifdef __has_extension
+# define __glibc_has_extension(ext) __has_extension (ext)
+#else
+# define __glibc_has_extension(ext) 0
+#endif
+
+#if defined __GNUC__ || defined __clang__
+
+/* All functions, except those with callbacks or those that
+   synchronize memory, are leaf functions.  */
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+#  define __LEAF , __leaf__
+#  define __LEAF_ATTR __attribute__ ((__leaf__))
+# else
+#  define __LEAF
+#  define __LEAF_ATTR
+# endif
+
+/* GCC can always grok prototypes.  For C++ programs we add throw()
+   to help it optimize the function calls.  But this only works with
+   gcc 2.8.x and egcs.  For gcc 3.4 and up we even mark C functions
+   as non-throwing using a function attribute since programs can use
+   the -fexceptions options for C code as well.  */
+# if !defined __cplusplus \
+     && (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__))
+#  define __THROW      __attribute__ ((__nothrow__ __LEAF))
+#  define __THROWNL    __attribute__ ((__nothrow__))
+#  define __NTH(fct)   __attribute__ ((__nothrow__ __LEAF)) fct
+#  define __NTHNL(fct)  __attribute__ ((__nothrow__)) fct
+# else
+#  if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
+#   if __cplusplus >= 201103L
+#    define __THROW    noexcept (true)
+#   else
+#    define __THROW    throw ()
+#   endif
+#   define __THROWNL   __THROW
+#   define __NTH(fct)  __LEAF_ATTR fct __THROW
+#   define __NTHNL(fct) fct __THROW
+#  else
+#   define __THROW
+#   define __THROWNL
+#   define __NTH(fct)  fct
+#   define __NTHNL(fct) fct
+#  endif
+# endif
+
+#else  /* Not GCC or clang.  */
+
+# if (defined __cplusplus                                              \
+      || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
+#  define __inline     inline
+# else
+#  define __inline             /* No inline functions.  */
+# endif
+
+# define __THROW
+# define __THROWNL
+# define __NTH(fct)    fct
+
+#endif /* GCC || clang.  */
+
+/* These two macros are not used in glibc anymore.  They are kept here
+   only because some other projects expect the macros to be defined.  */
+#define __P(args)      args
+#define __PMT(args)    args
+
+/* For these things, GCC behaves the ANSI way normally,
+   and the non-ANSI way under -traditional.  */
+
+#define __CONCAT(x,y)  x ## y
+#define __STRING(x)    #x
+
+/* This is not a typedef so `const __ptr_t' does the right thing.  */
+#define __ptr_t void *
+
+
+/* C++ needs to know that types and declarations are C, not C++.  */
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS   }
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+
+
+/* Gnulib avoids these definitions, as they don't work on non-glibc platforms.
+   In particular, __bos and __bos0 are defined differently in the Android libc.
+ */
+#ifndef __GNULIB_CDEFS
+
+/* Fortify support.  */
+# define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
+# define __bos0(ptr) __builtin_object_size (ptr, 0)
+
+/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available.  */
+# if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0)                \
+                                 || __GNUC_PREREQ (12, 0))
+#  define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0)
+#  define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1)
+# else
+#  define __glibc_objsize0(__o) __bos0 (__o)
+#  define __glibc_objsize(__o) __bos (__o)
+# endif
+
+/* Compile time conditions to choose between the regular, _chk and _chk_warn
+   variants.  These conditions should get evaluated to constant and optimized
+   away.  */
+
+# define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s))
+# define __glibc_unsigned_or_positive(__l) \
+  ((__typeof (__l)) 0 < (__typeof (__l)) -1                                  \
+   || (__builtin_constant_p (__l) && (__l) > 0))
+
+/* Length is known to be safe at compile time if the __L * __S <= __OBJSZ
+   condition can be folded to a constant and if it is true, or unknown (-1) */
+# define __glibc_safe_or_unknown_len(__l, __s, __osz) \
+  ((__osz) == (__SIZE_TYPE__) -1                                             \
+   || (__glibc_unsigned_or_positive (__l)                                    \
+       && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \
+                                                      (__s), (__osz)))       \
+       && __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), (__s), (__osz))))
+
+/* Conversely, we know at compile time that the length is unsafe if the
+   __L * __S <= __OBJSZ condition can be folded to a constant and if it is
+   false.  */
+# define __glibc_unsafe_len(__l, __s, __osz) \
+  (__glibc_unsigned_or_positive (__l)                                        \
+   && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l),     \
+                                                  __s, __osz))               \
+   && !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz))
+
+/* Fortify function f.  __f_alias, __f_chk and __f_chk_warn must be
+   declared.  */
+
+# define __glibc_fortify(f, __l, __s, __osz, ...) \
+  (__glibc_safe_or_unknown_len (__l, __s, __osz)                             \
+   ? __ ## f ## _alias (__VA_ARGS__)                                         \
+   : (__glibc_unsafe_len (__l, __s, __osz)                                   \
+      ? __ ## f ## _chk_warn (__VA_ARGS__, __osz)                            \
+      : __ ## f ## _chk (__VA_ARGS__, __osz)))                       \
+
+/* Fortify function f, where object size argument passed to f is the number of
+   elements and not total size.  */
+
+# define __glibc_fortify_n(f, __l, __s, __osz, ...) \
+  (__glibc_safe_or_unknown_len (__l, __s, __osz)                             \
+   ? __ ## f ## _alias (__VA_ARGS__)                                         \
+   : (__glibc_unsafe_len (__l, __s, __osz)                                   \
+      ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s))                  \
+      : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s))))                     \
+
+#endif
+
+
+#if __GNUC_PREREQ (4,3)
+# define __warnattr(msg) __attribute__((__warning__ (msg)))
+# define __errordecl(name, msg) \
+  extern void name (void) __attribute__((__error__ (msg)))
+#else
+# define __warnattr(msg)
+# define __errordecl(name, msg) extern void name (void)
+#endif
+
+/* Support for flexible arrays.
+   Headers that should use flexible arrays only if they're "real"
+   (e.g. only if they won't affect sizeof()) should test
+   #if __glibc_c99_flexarr_available.  */
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc
+# define __flexarr     []
+# define __glibc_c99_flexarr_available 1
+#elif __GNUC_PREREQ (2,97) || defined __clang__
+/* GCC 2.97 and clang support C99 flexible array members as an extension,
+   even when in C89 mode or compiling C++ (any version).  */
+# define __flexarr     []
+# define __glibc_c99_flexarr_available 1
+#elif defined __GNUC__
+/* Pre-2.97 GCC did not support C99 flexible arrays but did have
+   an equivalent extension with slightly different notation.  */
+# define __flexarr     [0]
+# define __glibc_c99_flexarr_available 1
+#else
+/* Some other non-C99 compiler.  Approximate with [1].  */
+# define __flexarr     [1]
+# define __glibc_c99_flexarr_available 0
+#endif
+
+
+/* __asm__ ("xyz") is used throughout the headers to rename functions
+   at the assembly language level.  This is wrapped by the __REDIRECT
+   macro, in order to support compilers that can do this some other
+   way.  When compilers don't support asm-names at all, we have to do
+   preprocessor tricks instead (which don't have exactly the right
+   semantics, but it's the best we can do).
+
+   Example:
+   int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
+
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
+
+# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
+# ifdef __cplusplus
+#  define __REDIRECT_NTH(name, proto, alias) \
+     name proto __THROW __asm__ (__ASMNAME (#alias))
+#  define __REDIRECT_NTHNL(name, proto, alias) \
+     name proto __THROWNL __asm__ (__ASMNAME (#alias))
+# else
+#  define __REDIRECT_NTH(name, proto, alias) \
+     name proto __asm__ (__ASMNAME (#alias)) __THROW
+#  define __REDIRECT_NTHNL(name, proto, alias) \
+     name proto __asm__ (__ASMNAME (#alias)) __THROWNL
+# endif
+# define __ASMNAME(cname)  __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
+
+/*
+#elif __SOME_OTHER_COMPILER__
+
+# define __REDIRECT(name, proto, alias) name proto; \
+       _Pragma("let " #name " = " #alias)
+*/
+#endif
+
+/* GCC and clang have various useful declarations that can be made with
+   the '__attribute__' syntax.  All of the ways we use this do fine if
+   they are omitted for compilers that don't understand it.  */
+#if !(defined __GNUC__ || defined __clang__)
+# define __attribute__(xyz)    /* Ignore */
+#endif
+
+/* At some point during the gcc 2.96 development the `malloc' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.  */
+#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__)
+# define __attribute_malloc__ __attribute__ ((__malloc__))
+#else
+# define __attribute_malloc__ /* Ignore */
+#endif
+
+/* Tell the compiler which arguments to an allocation function
+   indicate the size of the allocation.  */
+#if __GNUC_PREREQ (4, 3)
+# define __attribute_alloc_size__(params) \
+  __attribute__ ((__alloc_size__ params))
+#else
+# define __attribute_alloc_size__(params) /* Ignore.  */
+#endif
+
+/* Tell the compiler which argument to an allocation function
+   indicates the alignment of the allocation.  */
+#if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__alloc_align__)
+# define __attribute_alloc_align__(param) \
+  __attribute__ ((__alloc_align__ param))
+#else
+# define __attribute_alloc_align__(param) /* Ignore.  */
+#endif
+
+/* At some point during the gcc 2.96 development the `pure' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.  */
+#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__)
+# define __attribute_pure__ __attribute__ ((__pure__))
+#else
+# define __attribute_pure__ /* Ignore */
+#endif
+
+/* This declaration tells the compiler that the value is constant.  */
+#if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__)
+# define __attribute_const__ __attribute__ ((__const__))
+#else
+# define __attribute_const__ /* Ignore */
+#endif
+
+#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
+# define __attribute_maybe_unused__ __attribute__ ((__unused__))
+#else
+# define __attribute_maybe_unused__ /* Ignore */
+#endif
+
+/* At some point during the gcc 3.1 development the `used' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.  */
+#if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__)
+# define __attribute_used__ __attribute__ ((__used__))
+# define __attribute_noinline__ __attribute__ ((__noinline__))
+#else
+# define __attribute_used__ __attribute__ ((__unused__))
+# define __attribute_noinline__ /* Ignore */
+#endif
+
+/* Since version 3.2, gcc allows marking deprecated functions.  */
+#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__)
+# define __attribute_deprecated__ __attribute__ ((__deprecated__))
+#else
+# define __attribute_deprecated__ /* Ignore */
+#endif
+
+/* Since version 4.5, gcc also allows one to specify the message printed
+   when a deprecated function is used.  clang claims to be gcc 4.2, but
+   may also support this feature.  */
+#if __GNUC_PREREQ (4,5) \
+    || __glibc_has_extension (__attribute_deprecated_with_message__)
+# define __attribute_deprecated_msg__(msg) \
+        __attribute__ ((__deprecated__ (msg)))
+#else
+# define __attribute_deprecated_msg__(msg) __attribute_deprecated__
+#endif
+
+/* At some point during the gcc 2.8 development the `format_arg' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.
+   If several `format_arg' attributes are given for the same function, in
+   gcc-3.0 and older, all but the last one are ignored.  In newer gccs,
+   all designated arguments are considered.  */
+#if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__)
+# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
+#else
+# define __attribute_format_arg__(x) /* Ignore */
+#endif
+
+/* At some point during the gcc 2.97 development the `strfmon' format
+   attribute for functions was introduced.  We don't want to use it
+   unconditionally (although this would be possible) since it
+   generates warnings.  */
+#if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__)
+# define __attribute_format_strfmon__(a,b) \
+  __attribute__ ((__format__ (__strfmon__, a, b)))
+#else
+# define __attribute_format_strfmon__(a,b) /* Ignore */
+#endif
+
+/* The nonnull function attribute marks pointer parameters that
+   must not be NULL.  This has the name __nonnull in glibc,
+   and __attribute_nonnull__ in files shared with Gnulib to avoid
+   collision with a different __nonnull in DragonFlyBSD 5.9.  */
+#ifndef __attribute_nonnull__
+# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
+#  define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params))
+# else
+#  define __attribute_nonnull__(params)
+# endif
+#endif
+#ifndef __nonnull
+# define __nonnull(params) __attribute_nonnull__ (params)
+#endif
+
+/* The returns_nonnull function attribute marks the return type of the function
+   as always being non-null.  */
+#ifndef __returns_nonnull
+# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__)
+# define __returns_nonnull __attribute__ ((__returns_nonnull__))
+# else
+# define __returns_nonnull
+# endif
+#endif
+
+/* If fortification mode, we warn about unused results of certain
+   function calls which can lead to problems.  */
+#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__)
+# define __attribute_warn_unused_result__ \
+   __attribute__ ((__warn_unused_result__))
+# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0
+#  define __wur __attribute_warn_unused_result__
+# endif
+#else
+# define __attribute_warn_unused_result__ /* empty */
+#endif
+#ifndef __wur
+# define __wur /* Ignore */
+#endif
+
+/* Forces a function to be always inlined.  */
+#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__)
+/* The Linux kernel defines __always_inline in stddef.h (283d7573), and
+   it conflicts with this definition.  Therefore undefine it first to
+   allow either header to be included first.  */
+# undef __always_inline
+# define __always_inline __inline __attribute__ ((__always_inline__))
+#else
+# undef __always_inline
+# define __always_inline __inline
+#endif
+
+/* Associate error messages with the source location of the call site rather
+   than with the source location inside the function.  */
+#if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__)
+# define __attribute_artificial__ __attribute__ ((__artificial__))
+#else
+# define __attribute_artificial__ /* Ignore */
+#endif
+
+/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+   inline semantics, unless -fgnu89-inline is used.  Using __GNUC_STDC_INLINE__
+   or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
+   older than 4.3 may define these macros and still not guarantee GNU inlining
+   semantics.
+
+   clang++ identifies itself as gcc-4.2, but has support for GNU inlining
+   semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
+   __GNUC_GNU_INLINE__ macro definitions.  */
+#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
+     || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
+                              || defined __GNUC_GNU_INLINE__)))
+# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
+#  define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
+#  define __extern_always_inline \
+  extern __always_inline __attribute__ ((__gnu_inline__))
+# else
+#  define __extern_inline extern __inline
+#  define __extern_always_inline extern __always_inline
+# endif
+#endif
+
+#ifdef __extern_always_inline
+# define __fortify_function __extern_always_inline __attribute_artificial__
+#endif
+
+/* GCC 4.3 and above allow passing all anonymous arguments of an
+   __extern_always_inline function to some other vararg function.  */
+#if __GNUC_PREREQ (4,3)
+# define __va_arg_pack() __builtin_va_arg_pack ()
+# define __va_arg_pack_len() __builtin_va_arg_pack_len ()
+#endif
+
+/* It is possible to compile containing GCC extensions even if GCC is
+   run in pedantic mode if the uses are carefully marked using the
+   `__extension__' keyword.  But this is not generally available before
+   version 2.8.  */
+#if !(__GNUC_PREREQ (2,8) || defined __clang__)
+# define __extension__         /* Ignore */
+#endif
+
+/* __restrict is known in EGCS 1.2 and above, and in clang.
+   It works also in C++ mode (outside of arrays), but only when spelled
+   as '__restrict', not 'restrict'.  */
+#if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3)
+# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#  define __restrict   restrict
+# else
+#  define __restrict   /* Ignore */
+# endif
+#endif
+
+/* ISO C99 also allows to declare arrays as non-overlapping.  The syntax is
+     array_name[restrict]
+   GCC 3.1 and clang support this.
+   This syntax is not usable in C++ mode.  */
+#if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus
+# define __restrict_arr        __restrict
+#else
+# ifdef __GNUC__
+#  define __restrict_arr       /* Not supported in old GCC.  */
+# else
+#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#   define __restrict_arr      restrict
+#  else
+/* Some other non-C99 compiler.  */
+#   define __restrict_arr      /* Not supported.  */
+#  endif
+# endif
+#endif
+
+#if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect)
+# define __glibc_unlikely(cond)        __builtin_expect ((cond), 0)
+# define __glibc_likely(cond)  __builtin_expect ((cond), 1)
+#else
+# define __glibc_unlikely(cond)        (cond)
+# define __glibc_likely(cond)  (cond)
+#endif
+
+#if (!defined _Noreturn \
+     && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
+     &&  !(__GNUC_PREREQ (4,7) \
+           || (3 < __clang_major__ + (5 <= __clang_minor__))))
+# if __GNUC_PREREQ (2,8)
+#  define _Noreturn __attribute__ ((__noreturn__))
+# else
+#  define _Noreturn
+# endif
+#endif
+
+#if __GNUC_PREREQ (8, 0)
+/* Describes a char array whose address can safely be passed as the first
+   argument to strncpy and strncat, as the char array is not necessarily
+   a NUL-terminated string.  */
+# define __attribute_nonstring__ __attribute__ ((__nonstring__))
+#else
+# define __attribute_nonstring__
+#endif
+
+/* Undefine (also defined in libc-symbols.h).  */
+#undef __attribute_copy__
+#if __GNUC_PREREQ (9, 0)
+/* Copies attributes from the declaration or type referenced by
+   the argument.  */
+# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg)))
+#else
+# define __attribute_copy__(arg)
+#endif
+
+#if (!defined _Static_assert && !defined __cplusplus \
+     && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
+     && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \
+         || defined __STRICT_ANSI__))
+# define _Static_assert(expr, diagnostic) \
+    extern int (*__Static_assert_function (void)) \
+      [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
+#endif
+
+/* Gnulib avoids including these, as they don't work on non-glibc or
+   older glibc platforms.  */
+#ifndef __GNULIB_CDEFS
+# include <bits/wordsize.h>
+# include <bits/long-double.h>
+#endif
+
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+
+/* Alias name defined automatically.  */
+#  define __LDBL_REDIR(name, proto) ... unused__ldbl_redir
+#  define __LDBL_REDIR_DECL(name) \
+  extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));
+
+/* Alias name defined automatically, with leading underscores.  */
+#  define __LDBL_REDIR2_DECL(name) \
+  extern __typeof (__##name) __##name \
+    __asm (__ASMNAME ("__" #name "ieee128"));
+
+/* Alias name defined manually.  */
+#  define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1
+#  define __LDBL_REDIR1_DECL(name, alias) \
+  extern __typeof (name) name __asm (__ASMNAME (#alias));
+
+#  define __LDBL_REDIR1_NTH(name, proto, alias) \
+  __REDIRECT_NTH (name, proto, alias)
+#  define __REDIRECT_NTH_LDBL(name, proto, alias) \
+  __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
+
+/* Unused.  */
+#  define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
+#  define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
+
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif
+#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# define __LDBL_COMPAT 1
+# ifdef __REDIRECT
+#  define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
+#  define __LDBL_REDIR(name, proto) \
+  __LDBL_REDIR1 (name, proto, __nldbl_##name)
+#  define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
+#  define __LDBL_REDIR_NTH(name, proto) \
+  __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
+#  define __LDBL_REDIR2_DECL(name) \
+  extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name));
+#  define __LDBL_REDIR1_DECL(name, alias) \
+  extern __typeof (name) name __asm (__ASMNAME (#alias));
+#  define __LDBL_REDIR_DECL(name) \
+  extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
+#  define __REDIRECT_LDBL(name, proto, alias) \
+  __LDBL_REDIR1 (name, proto, __nldbl_##alias)
+#  define __REDIRECT_NTH_LDBL(name, proto, alias) \
+  __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
+# endif
+#endif
+#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
+    || !defined __REDIRECT
+# define __LDBL_REDIR1(name, proto, alias) name proto
+# define __LDBL_REDIR(name, proto) name proto
+# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
+# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
+# define __LDBL_REDIR2_DECL(name)
+# define __LDBL_REDIR_DECL(name)
+# ifdef __REDIRECT
+#  define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
+#  define __REDIRECT_NTH_LDBL(name, proto, alias) \
+  __REDIRECT_NTH (name, proto, alias)
+# endif
+#endif
+
+/* __glibc_macro_warning (MESSAGE) issues warning MESSAGE.  This is
+   intended for use in preprocessor macros.
+
+   Note: MESSAGE must be a _single_ string; concatenation of string
+   literals is not supported.  */
+#if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
+# define __glibc_macro_warning1(message) _Pragma (#message)
+# define __glibc_macro_warning(message) \
+  __glibc_macro_warning1 (GCC warning message)
+#else
+# define __glibc_macro_warning(msg)
+#endif
+
+/* Generic selection (ISO C11) is a C-only feature, available in GCC
+   since version 4.9.  Previous versions do not provide generic
+   selection, even though they might set __STDC_VERSION__ to 201112L,
+   when in -std=c11 mode.  Thus, we must check for !defined __GNUC__
+   when testing __STDC_VERSION__ for generic selection support.
+   On the other hand, Clang also defines __GNUC__, so a clang-specific
+   check is required to enable the use of generic selection.  */
+#if !defined __cplusplus \
+    && (__GNUC_PREREQ (4, 9) \
+       || __glibc_has_extension (c_generic_selections) \
+       || (!defined __GNUC__ && defined __STDC_VERSION__ \
+           && __STDC_VERSION__ >= 201112L))
+# define __HAVE_GENERIC_SELECTION 1
+#else
+# define __HAVE_GENERIC_SELECTION 0
+#endif
+
+#if __GNUC_PREREQ (10, 0)
+/* Designates a 1-based positional argument ref-index of pointer type
+   that can be used to access size-index elements of the pointed-to
+   array according to access mode, or at least one element when
+   size-index is not provided:
+     access (access-mode, <ref-index> [, <size-index>])  */
+#  define __attr_access(x) __attribute__ ((__access__ x))
+/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may
+   use the access attribute to get object sizes from function definition
+   arguments, so we can't use them on functions we fortify.  Drop the object
+   size hints for such functions.  */
+#  if __USE_FORTIFY_LEVEL == 3
+#    define __fortified_attr_access(a, o, s) __attribute__ ((__access__ (a, o)))
+#  else
+#    define __fortified_attr_access(a, o, s) __attr_access ((a, o, s))
+#  endif
+#  if __GNUC_PREREQ (11, 0)
+#    define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno)))
+#  else
+#    define __attr_access_none(argno)
+#  endif
+#else
+#  define __fortified_attr_access(a, o, s)
+#  define __attr_access(x)
+#  define __attr_access_none(argno)
+#endif
+
+#if __GNUC_PREREQ (11, 0)
+/* Designates dealloc as a function to call to deallocate objects
+   allocated by the declared function.  */
+# define __attr_dealloc(dealloc, argno) \
+    __attribute__ ((__malloc__ (dealloc, argno)))
+# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1)
+#else
+# define __attr_dealloc(dealloc, argno)
+# define __attr_dealloc_free
+#endif
+
+/* Specify that a function such as setjmp or vfork may return
+   twice.  */
+#if __GNUC_PREREQ (4, 1)
+# define __attribute_returns_twice__ __attribute__ ((__returns_twice__))
+#else
+# define __attribute_returns_twice__ /* Ignore.  */
+#endif
+
+#endif  /* sys/cdefs.h */
deleted file mode 120000 (symlink)
index a5d818eebec69d778ccff9987751448176067923..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/chdir-long.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..61600251133a23a5911a07575d7b9eac9afb3b05
--- /dev/null
@@ -0,0 +1,263 @@
+/* provide a chdir function that tries not to fail due to ENAMETOOLONG
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "chdir-long.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "assure.h"
+
+#ifndef PATH_MAX
+# error "compile this file only if your system defines PATH_MAX"
+#endif
+
+/* The results of openat() in this file are not leaked to any
+   single-threaded code that could use stdio.
+   FIXME - if the kernel ever adds support for multi-thread safety for
+   avoiding standard fds, then we should use openat_safer.  */
+
+struct cd_buf
+{
+  int fd;
+};
+
+static void
+cdb_init (struct cd_buf *cdb)
+{
+  cdb->fd = AT_FDCWD;
+}
+
+static int
+cdb_fchdir (struct cd_buf const *cdb)
+{
+  return fchdir (cdb->fd);
+}
+
+static void
+cdb_free (struct cd_buf const *cdb)
+{
+  if (0 <= cdb->fd)
+    {
+      bool close_fail = close (cdb->fd);
+      assure (! 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_SEARCH | 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 char * _GL_ATTRIBUTE_PURE
+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.  */
+    assure (0 < len);
+    assure (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;
+      }
+
+    assure (*dir != '/');
+    assure (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';
+        assure (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 "closeout.h"
+# include <error.h>
+
+int
+main (int argc, char *argv[])
+{
+  char *line = NULL;
+  size_t n = 0;
+  int len;
+
+  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:
+*/
deleted file mode 120000 (symlink)
index 56f9ffd6b420791e3a674f775bfa311d721876bc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/chdir-long.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2f24fa08ebfb9c02520d20ff8efe93d931af58a8
--- /dev/null
@@ -0,0 +1,30 @@
+/* provide a chdir function that tries not to fail due to ENAMETOOLONG
+   Copyright (C) 2004-2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <unistd.h>
+#include <limits.h>
+
+#include "pathmax.h"
+
+/* 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
deleted file mode 120000 (symlink)
index e9a3c16e4cf665ae69d608bd795b8bdfa948ff22..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/chmod.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..827c7f9b26e1965df99d57767fe84bba15d2be55
--- /dev/null
@@ -0,0 +1,47 @@
+/* Implement chmod on platforms where it does not work correctly.
+
+   Copyright 2022-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <string.h>
+
+int
+rpl_chmod (const char *filename, mode_t mode)
+#undef chmod
+#if defined _WIN32 && !defined __CYGWIN__
+# define chmod _chmod
+#endif
+{
+  size_t len = strlen (filename);
+  if (len > 0 && filename[len - 1] == '/')
+    {
+      struct stat st;
+      if (lstat (filename, &st) < 0)
+        return -1;
+      if (!S_ISDIR (st.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+    }
+
+  return chmod (filename, mode);
+}
deleted file mode 120000 (symlink)
index 8d2ffa15a35e0c464b82d8311d95cf510672f03b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/chmodat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..17494e79b5534a8899de491a7f0885e699d4088d
--- /dev/null
@@ -0,0 +1,21 @@
+/* Change access permissions of a file at a directory.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define CHMODAT_INLINE _GL_EXTERN_INLINE
+#include "openat.h"
deleted file mode 120000 (symlink)
index 8f1a29812539891be63a6023565136a6171024ee..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/chown.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..398f8c185544befde88ef8df41725c8fdf95428c
--- /dev/null
@@ -0,0 +1,141 @@
+/* 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-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if !HAVE_CHOWN
+
+/* Simple stub that always fails with ENOSYS, for mingw.  */
+int
+chown (_GL_UNUSED const char *file, _GL_UNUSED uid_t uid,
+       _GL_UNUSED gid_t gid)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#else /* HAVE_CHOWN */
+
+/* Below we refer to the system's chown().  */
+# undef chown
+
+/* 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_CHANGE_TIME_BUG || CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE \
+      || CHOWN_TRAILING_SLASH_BUG)
+  struct stat st;
+  bool stat_valid = false;
+# endif
+  int result;
+
+# if CHOWN_CHANGE_TIME_BUG /* OpenBSD 7.2 */
+  if (gid != (gid_t) -1 || uid != (uid_t) -1)
+    {
+      if (stat (file, &st))
+        return -1;
+      stat_valid = true;
+    }
+# endif
+
+# if CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE /* some very old platforms */
+  if (gid == (gid_t) -1 || uid == (uid_t) -1)
+    {
+      /* Stat file to get id(s) that should remain unchanged.  */
+      if (!stat_valid && stat (file, &st))
+        return -1;
+      if (gid == (gid_t) -1)
+        gid = st.st_gid;
+      if (uid == (uid_t) -1)
+        uid = st.st_uid;
+    }
+# endif
+
+# if CHOWN_MODIFIES_SYMLINK /* some very old platforms */
+  /* The system-supplied chown function does not follow symlinks.
+     If the file is a symlink, open the file (following symlinks), and
+     fchown the resulting descriptor.  Although the open might fail
+     due to lack of permissions, it's the best we can easily do.  */
+  char linkbuf[1];
+  if (0 <= readlink (file, linkbuf, sizeof linkbuf))
+    {
+      int open_flags = O_NONBLOCK | O_NOCTTY | O_CLOEXEC;
+      int fd = open (file, O_RDONLY | open_flags);
+      if (fd < 0
+          && (errno != EACCES
+              || ((fd = open (file, O_WRONLY | open_flags)) < 0))
+          && (errno != EACCES || O_EXEC == O_RDONLY
+              || ((fd = open (file, O_EXEC | open_flags)) < 0))
+          && (errno != EACCES || O_SEARCH == O_RDONLY || O_SEARCH == O_EXEC
+              || ((fd = open (file, O_SEARCH | open_flags)) < 0)))
+        return fd;
+
+      int r = fchown (fd, uid, gid);
+      int err = errno;
+      close (fd);
+      errno = err;
+      return r;
+    }
+# endif
+
+# if CHOWN_TRAILING_SLASH_BUG /* macOS 12.5, FreeBSD 7.2, AIX 7.3.1, Solaris 9 */
+  if (!stat_valid)
+    {
+      size_t len = strlen (file);
+      if (len && file[len - 1] == '/' && stat (file, &st))
+        return -1;
+    }
+# endif
+
+  result = chown (file, uid, gid);
+
+# if CHOWN_CHANGE_TIME_BUG /* OpenBSD 7.2 */
+  if (result == 0 && stat_valid
+      && (uid == st.st_uid || uid == (uid_t) -1)
+      && (gid == st.st_gid || gid == (gid_t) -1))
+    {
+      /* No change in ownership, but at least one argument was not -1,
+         so we are required to update ctime.  Since chown succeeded,
+         we assume that chmod will do likewise.  Fortunately, on all
+         known systems where a 'no-op' chown skips the ctime update, a
+         'no-op' chmod still does the trick.  */
+      result = chmod (file, st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO
+                                          | S_ISUID | S_ISGID | S_ISVTX));
+    }
+# endif
+
+  return result;
+}
+
+#endif /* HAVE_CHOWN */
deleted file mode 120000 (symlink)
index a28168b00894adf866264b4ad09fd39fa278f53e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/chownat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..090bb45daeb974c39d8310adcd77339dcd3b93d0
--- /dev/null
@@ -0,0 +1,21 @@
+/* Change owner of a file at a directory.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define CHOWNAT_INLINE _GL_EXTERN_INLINE
+#include "openat.h"
deleted file mode 120000 (symlink)
index 1c44cefc8fdce27846c600516f84cc63bd226678..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/cloexec.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cdb0d740eb740a1122cc12f4d0964ea7090553f5
--- /dev/null
@@ -0,0 +1,83 @@
+/* cloexec.c - set or clear the close-on-exec descriptor flag
+
+   Copyright (C) 1991, 2004-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* The code is taken from glibc/manual/llio.texi  */
+
+#include <config.h>
+
+#include "cloexec.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true,
+   or clear the flag if VALUE is false.
+   Return 0 on success, or -1 on error with 'errno' set.
+
+   Note that on MingW, this function does NOT protect DESC from being
+   inherited into spawned children.  Instead, either use dup_cloexec
+   followed by closing the original DESC, or use interfaces such as
+   open or pipe2 that accept flags like O_CLOEXEC to create DESC
+   non-inheritable in the first place.  */
+
+int
+set_cloexec_flag (int desc, bool value)
+{
+#ifdef F_SETFD
+
+  int flags = fcntl (desc, F_GETFD, 0);
+
+  if (0 <= flags)
+    {
+      int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC);
+
+      if (flags == newflags
+          || fcntl (desc, F_SETFD, newflags) != -1)
+        return 0;
+    }
+
+  return -1;
+
+#else /* !F_SETFD */
+
+  /* Use dup2 to reject invalid file descriptors; the cloexec flag
+     will be unaffected.  */
+  if (desc < 0)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  if (dup2 (desc, desc) < 0)
+    /* errno is EBADF here.  */
+    return -1;
+
+  /* There is nothing we can do on this kind of platform.  Punt.  */
+  return 0;
+#endif /* !F_SETFD */
+}
+
+
+/* Duplicates a file handle FD, while marking the copy to be closed
+   prior to exec or spawn.  Returns -1 and sets errno if FD could not
+   be duplicated.  */
+
+int
+dup_cloexec (int fd)
+{
+  return fcntl (fd, F_DUPFD_CLOEXEC, 0);
+}
deleted file mode 120000 (symlink)
index f43b4e5c8989d3a381d9534f499ec9bd440e4fdf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/cloexec.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f52e5f2ec0fbcb862f22751328038866eb9fca0e
--- /dev/null
@@ -0,0 +1,34 @@
+/* cloexec.c - set or clear the close-on-exec descriptor flag
+
+   Copyright (C) 2004, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true,
+   or clear the flag if VALUE is false.
+   Return 0 on success, or -1 on error with 'errno' set.
+
+   Note that on MingW, this function does NOT protect DESC from being
+   inherited into spawned children.  Instead, either use dup_cloexec
+   followed by closing the original DESC, or use interfaces such as
+   open or pipe2 that accept flags like O_CLOEXEC to create DESC
+   non-inheritable in the first place.  */
+
+int set_cloexec_flag (int desc, bool value);
+
+/* Duplicates a file handle FD, while marking the copy to be closed
+   prior to exec or spawn.  Returns -1 and sets errno if FD could not
+   be duplicated.  */
+
+int dup_cloexec (int fd);
deleted file mode 120000 (symlink)
index a0430cd41e9ef02d3595b461d16a022275be6aab..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/close-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..81094c6863cbb25fbbd8fd3de2c4a85c29741ab1
--- /dev/null
@@ -0,0 +1,77 @@
+/* Close a stream, with nicer error checking than fclose's.
+
+   Copyright (C) 1998-2002, 2004, 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "close-stream.h"
+
+#include <errno.h>
+
+#include "fpending.h"
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+/* Close STREAM.  Return 0 if successful, EOF (setting errno)
+   otherwise.  A failure might set errno to 0 if the error number
+   cannot be determined.
+
+   A failure with errno set to EPIPE may or may not indicate an error
+   situation worth signaling to the user.  See the documentation of the
+   close_stdout_set_ignore_EPIPE function for details.
+
+   If a program writes *anything* to STREAM, that program should close
+   STREAM and make sure that it succeeds before exiting.  Otherwise,
+   suppose that you go to the extreme of checking the return status
+   of every function that does an explicit write to STREAM.  The last
+   printf can succeed in writing to the internal stream buffer, and yet
+   the fclose(STREAM) could still fail (due e.g., to a disk full error)
+   when it tries to write out that buffered data.  Thus, you would be
+   left with an incomplete output file and the offending program would
+   exit successfully.  Even calling fflush is not always sufficient,
+   since some file systems (NFS and CODA) buffer written/flushed data
+   until an actual close call.
+
+   Besides, it's wasteful to check the return value from every call
+   that writes to STREAM -- just let the internal stream state record
+   the failure.  That's what the ferror test is checking below.  */
+
+int
+close_stream (FILE *stream)
+{
+  const bool some_pending = (__fpending (stream) != 0);
+  const bool prev_fail = (ferror (stream) != 0);
+  const bool fclose_fail = (fclose (stream) != 0);
+
+  /* Return an error indication if there was a previous failure or if
+     fclose failed, with one exception: ignore an fclose failure if
+     there was no previous error, no data remains to be flushed, and
+     fclose failed with EBADF.  That can happen when a program like cp
+     is invoked like this 'cp a b >&-' (i.e., with standard output
+     closed) and doesn't generate any output (hence no previous error
+     and nothing to be flushed).  */
+
+  if (prev_fail || (fclose_fail && (some_pending || errno != EBADF)))
+    {
+      if (! fclose_fail)
+        errno = 0;
+      return EOF;
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index b8ac757fabfea9ca4f733de142e25562cf7e300f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/close-stream.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8a1b3c7ac2c9da3ca85b2e87906f3d5c6e63161d
--- /dev/null
@@ -0,0 +1,20 @@
+/* Close a stream, with nicer error checking than fclose's.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+
+int close_stream (FILE *stream);
deleted file mode 120000 (symlink)
index 45593c9928df1be8c2e69a8fa8639fd043f5d24d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/close.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..830fd820814609e699f442b8793a091345e4a56c
--- /dev/null
@@ -0,0 +1,75 @@
+/* close replacement.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+
+#include "fd-hook.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#undef close
+
+#if defined _WIN32 && !defined __CYGWIN__
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+close_nothrow (int fd)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _close (fd);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = -1;
+      errno = EBADF;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+# else
+#  define close_nothrow _close
+# endif
+#else
+# define close_nothrow close
+#endif
+
+/* Override close() to call into other gnulib modules.  */
+
+int
+rpl_close (int fd)
+{
+#if WINDOWS_SOCKETS
+  int retval = execute_all_close_hooks (close_nothrow, fd);
+#else
+  int retval = close_nothrow (fd);
+#endif
+
+#if REPLACE_FCHDIR
+  if (retval >= 0)
+    _gl_unregister_fd (fd);
+#endif
+
+  return retval;
+}
deleted file mode 120000 (symlink)
index 7896726a96c00c0134a952edd5964e9eaaffa5fd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/closedir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..24b6bdacb1ceaf83c62aeffc76a91759c8a0bfc0
--- /dev/null
@@ -0,0 +1,77 @@
+/* Stop reading the entries of a directory.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <dirent.h>
+
+#if REPLACE_FCHDIR
+# include <unistd.h>
+#endif
+
+#include <stdlib.h>
+
+#if HAVE_CLOSEDIR
+
+/* Override closedir(), to keep track of the open file descriptors.
+   Needed because there is a function dirfd().  */
+
+#endif
+
+#if GNULIB_defined_DIR
+# include "dirent-private.h"
+#endif
+
+int
+closedir (DIR *dirp)
+#undef closedir
+{
+#if GNULIB_defined_DIR || REPLACE_FCHDIR
+  int fd = dirfd (dirp);
+#endif
+  int retval;
+
+#if HAVE_DIRENT_H                       /* equivalent to HAVE_CLOSEDIR */
+
+# if GNULIB_defined_DIR
+  retval = closedir (dirp->real_dirp);
+  if (retval >= 0)
+    free (dirp);
+# else
+  retval = closedir (dirp);
+# endif
+
+#else
+
+  if (dirp->current != INVALID_HANDLE_VALUE)
+    FindClose (dirp->current);
+  free (dirp);
+
+  retval = 0;
+
+#endif
+
+#if GNULIB_defined_DIR
+  if (retval >= 0)
+    close (fd);
+#elif REPLACE_FCHDIR
+  if (retval >= 0)
+    _gl_unregister_fd (fd);
+#endif
+
+  return retval;
+}
deleted file mode 120000 (symlink)
index e1dd45ff6bc4cbd4d82a46ac927c97a6d41d97b3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/closein.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..74675f6c2b5fe7122c426e81d355c19ed9ddb06d
--- /dev/null
@@ -0,0 +1,111 @@
+/* Close standard input, rewinding seekable stdin if necessary.
+
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "closein.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+#include "close-stream.h"
+#include "closeout.h"
+#include <error.h>
+#include "exitfail.h"
+#include "freadahead.h"
+#include "quotearg.h"
+
+static const char *file_name;
+
+/* Set the file name to be reported in the event an error is detected
+   on stdin by close_stdin.  See also close_stdout_set_file_name, if
+   an error is detected when closing stdout.  */
+void
+close_stdin_set_file_name (const char *file)
+{
+  file_name = file;
+}
+
+/* Close standard input, rewinding any unused input if stdin is
+   seekable.  On error, issue a diagnostic and _exit with status
+   'exit_failure'.  Then call close_stdout.
+
+   Most programs can get by with close_stdout.  close_stdin is only
+   needed when a program wants to guarantee that partially read input
+   from seekable stdin is not consumed, for any subsequent clients.
+   For example, POSIX requires that these two commands behave alike:
+
+     (sed -ne 1q; cat) < file
+     tail -n +2 file
+
+   Since close_stdin is commonly registered via 'atexit', POSIX
+   and the C standard both say that it should not call 'exit',
+   because the behavior is undefined if 'exit' is called more than
+   once.  So it calls '_exit' instead of 'exit'.  If close_stdin
+   is registered via atexit before other functions are registered,
+   the other functions can act before this _exit is invoked.
+
+   Applications that use close_stdout should flush any streams other
+   than stdin, stdout, and stderr before exiting, since the call to
+   _exit will bypass other buffer flushing.  Applications should be
+   flushing and closing other streams anyway, to check for I/O errors.
+   Also, applications should not use tmpfile, since _exit can bypass
+   the removal of these files.
+
+   It's important to detect such failures and exit nonzero because many
+   tools (most notably 'make' and other build-management systems) depend
+   on being able to detect failure in other tools via their exit status.  */
+
+void
+close_stdin (void)
+{
+  bool fail = false;
+
+  /* There is no need to flush stdin if we can determine quickly that stdin's
+     input buffer is empty; in this case we know that if stdin is seekable,
+     (fseeko (stdin, 0, SEEK_CUR), ftello (stdin))
+     == lseek (0, 0, SEEK_CUR).  */
+  if (freadahead (stdin) > 0)
+    {
+      /* Only attempt flush if stdin is seekable, as fflush is entitled to
+         fail on non-seekable streams.  */
+      if (fseeko (stdin, 0, SEEK_CUR) == 0 && fflush (stdin) != 0)
+        fail = true;
+    }
+  if (close_stream (stdin) != 0)
+    fail = true;
+  if (fail)
+    {
+      /* Report failure, but defer exit until after closing stdout,
+         since the failure report should still be flushed.  */
+      char const *close_error = _("error closing file");
+      if (file_name)
+        error (0, errno, "%s: %s", quotearg_colon (file_name),
+               close_error);
+      else
+        error (0, errno, "%s", close_error);
+    }
+
+  close_stdout ();
+
+  if (fail)
+    _exit (exit_failure);
+}
deleted file mode 120000 (symlink)
index 635bfbd79e33e78ec3f71d2a95a352eb63c957bd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/closein.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..665df066eeba0ca477ee9fcd4f319d2e8ffcf579
--- /dev/null
@@ -0,0 +1,32 @@
+/* Close standard input, rewinding seekable stdin if necessary.
+
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_CLOSEIN_H
+# define _GL_CLOSEIN_H 1
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+void close_stdin_set_file_name (const char *file);
+void close_stdin (void);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index d933917e10b6f1fc3478d5b997575c88551cf040..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/closeout.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2ffdecb825caf2c5c6951505a71919543e6e3188
--- /dev/null
@@ -0,0 +1,135 @@
+/* Close standard output and standard error, exiting with a diagnostic on error.
+
+   Copyright (C) 1998-2002, 2004, 2006, 2008-2024 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "closeout.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+#include "close-stream.h"
+#include <error.h>
+#include "exitfail.h"
+#include "quotearg.h"
+
+#ifndef __has_feature
+# define __has_feature(a) false
+#endif
+
+#if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer)
+enum { SANITIZE_ADDRESS = true };
+#else
+enum { SANITIZE_ADDRESS = false };
+#endif
+
+static const char *file_name;
+
+/* Set the file name to be reported in the event an error is detected
+   by close_stdout.  */
+void
+close_stdout_set_file_name (const char *file)
+{
+  file_name = file;
+}
+
+static bool ignore_EPIPE /* = false */;
+
+/* Specify the reaction to an EPIPE error during the closing of stdout:
+     - If ignore = true, it shall be ignored.
+     - If ignore = false, it shall evoke a diagnostic, along with a nonzero
+       exit status.
+   The default is ignore = false.
+
+   This setting matters only if the SIGPIPE signal is ignored (i.e. its
+   handler set to SIG_IGN) or blocked.  Only particular programs need to
+   temporarily ignore SIGPIPE.  If SIGPIPE is ignored or blocked because
+   it was ignored or blocked in the parent process when it created the
+   child process, it usually is a bug in the parent process: It is bad
+   practice to have SIGPIPE ignored or blocked while creating a child
+   process.
+
+   EPIPE occurs when writing to a pipe or socket that has no readers now,
+   when SIGPIPE is ignored or blocked.
+
+   The ignore = false setting is suitable for a scenario where it is normally
+   guaranteed that the pipe writer terminates before the pipe reader.  In
+   this case, an EPIPE is an indication of a premature termination of the
+   pipe reader and should lead to a diagnostic and a nonzero exit status.
+
+   The ignore = true setting is suitable for a scenario where you don't know
+   ahead of time whether the pipe writer or the pipe reader will terminate
+   first.  In this case, an EPIPE is an indication that the pipe writer can
+   stop doing useless write() calls; this is what close_stdout does anyway.
+   EPIPE is part of the normal pipe/socket shutdown protocol in this case,
+   and should not lead to a diagnostic message.  */
+
+void
+close_stdout_set_ignore_EPIPE (bool ignore)
+{
+  ignore_EPIPE = ignore;
+}
+
+/* Close standard output.  On error, issue a diagnostic and _exit
+   with status 'exit_failure'.
+
+   Also close standard error.  On error, _exit with status 'exit_failure'.
+
+   Since close_stdout is commonly registered via 'atexit', POSIX
+   and the C standard both say that it should not call 'exit',
+   because the behavior is undefined if 'exit' is called more than
+   once.  So it calls '_exit' instead of 'exit'.  If close_stdout
+   is registered via atexit before other functions are registered,
+   the other functions can act before this _exit is invoked.
+
+   Applications that use close_stdout should flush any streams
+   other than stdout and stderr before exiting, since the call to
+   _exit will bypass other buffer flushing.  Applications should
+   be flushing and closing other streams anyway, to check for I/O
+   errors.  Also, applications should not use tmpfile, since _exit
+   can bypass the removal of these files.
+
+   It's important to detect such failures and exit nonzero because many
+   tools (most notably 'make' and other build-management systems) depend
+   on being able to detect failure in other tools via their exit status.  */
+
+void
+close_stdout (void)
+{
+  if (close_stream (stdout) != 0
+      && !(ignore_EPIPE && errno == EPIPE))
+    {
+      char const *write_error = _("write error");
+      if (file_name)
+        error (0, errno, "%s: %s", quotearg_colon (file_name),
+               write_error);
+      else
+        error (0, errno, "%s", write_error);
+
+      _exit (exit_failure);
+    }
+
+  /* Close stderr only if not sanitizing, as sanitizers may report to
+     stderr after this function returns.  */
+  if (!SANITIZE_ADDRESS && close_stream (stderr) != 0)
+    _exit (exit_failure);
+}
deleted file mode 120000 (symlink)
index ecdfeb0762fc476f247d3abce0af90127f6e816e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/closeout.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6036e62613d75af7fc2870dc973c943fb6068952
--- /dev/null
@@ -0,0 +1,34 @@
+/* Close standard output and standard error.
+
+   Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef CLOSEOUT_H
+# define CLOSEOUT_H 1
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+void close_stdout_set_file_name (const char *file);
+void close_stdout_set_ignore_EPIPE (bool ignore);
+void close_stdout (void);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index 5a3279427122dab5d7fd06e7339ff90087b98425..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/copy-acl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bde98f0b2695a11575900e289ed5a6819ab588b1
--- /dev/null
@@ -0,0 +1,61 @@
+/* Copy access control list from one file to file.  -*- coding: utf-8 -*-
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible.  */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include <errno.h>
+
+#include "quote.h"
+#include <error.h>
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+
+/* Copy access control lists from one file to another. If SOURCE_DESC is
+   a valid file descriptor, use file descriptor operations, else use
+   filename based operations on SRC_NAME. Likewise for DEST_DESC and
+   DST_NAME.
+   If access control lists are not available, fchmod the target file to
+   MODE.  Also sets the non-permission bits of the destination file
+   (S_ISUID, S_ISGID, S_ISVTX) to those from MODE if any are set.
+   Return 0 if successful, otherwise output a diagnostic and return a
+   negative error code.  */
+
+int
+copy_acl (const char *src_name, int source_desc, const char *dst_name,
+          int dest_desc, mode_t mode)
+{
+  int ret = qcopy_acl (src_name, source_desc, dst_name, dest_desc, mode);
+  switch (ret)
+    {
+    case -2:
+      error (0, errno, "%s", quote (src_name));
+      break;
+
+    case -1:
+      error (0, errno, _("preserving permissions for %s"), quote (dst_name));
+      break;
+
+    default:
+      break;
+    }
+  return ret;
+}
deleted file mode 120000 (symlink)
index 949a27e6bdf1e06c6582b4585bf6599ece3d864d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/copy-file-range.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e7e3a441c6b4b37b8f31c86047664f01d1d06664
--- /dev/null
@@ -0,0 +1,67 @@
+/* Stub for copy_file_range
+   Copyright 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+
+#if defined __linux__ && HAVE_COPY_FILE_RANGE
+# include <sys/utsname.h>
+#endif
+
+ssize_t
+copy_file_range (int infd, off_t *pinoff,
+                 int outfd, off_t *poutoff,
+                 size_t length, unsigned int flags)
+{
+#undef copy_file_range
+
+#if defined __linux__ && HAVE_COPY_FILE_RANGE
+  /* The implementation of copy_file_range (which first appeared in
+     Linux kernel release 4.5) had many issues before release 5.3
+     <https://lwn.net/Articles/789527/>, so fail with ENOSYS for Linux
+     kernels 5.2 and earlier.
+
+     This workaround, and the configure-time check for Linux, can be
+     removed when such kernels (released March 2016 through September
+     2019) are no longer a consideration.  As of January 2021, the
+     furthest-future planned kernel EOL is December 2024 for kernel
+     release 4.19.  */
+
+    static signed char ok;
+
+    if (! ok)
+      {
+        struct utsname name;
+        uname (&name);
+        char *p = name.release;
+        ok = ((p[1] != '.' || '5' < p[0]
+               || (p[0] == '5' && (p[3] != '.' || '2' < p[2])))
+              ? 1 : -1);
+      }
+
+    if (0 < ok)
+      return copy_file_range (infd, pinoff, outfd, poutoff, length, flags);
+#endif
+
+  /* There is little need to emulate copy_file_range with read+write,
+     since programs that use copy_file_range must fall back on
+     read+write anyway.  */
+  errno = ENOSYS;
+  return -1;
+}
deleted file mode 120000 (symlink)
index f10ad7e54d70370d148b6c39c1aa0be04cc465a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/count-leading-zeros.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2bbfd674849113fa0c8ccb0acb42cc4a2de28272
--- /dev/null
@@ -0,0 +1,21 @@
+/* Count the number of leading 0 bits in a word.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define COUNT_LEADING_ZEROS_INLINE _GL_EXTERN_INLINE
+#include "count-leading-zeros.h"
deleted file mode 120000 (symlink)
index 1b76c6ee6a3d50102dc62bb0de150c01c7b639c2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/count-leading-zeros.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..545749d6d2753cb51d81e928924b900eaccea5bb
--- /dev/null
@@ -0,0 +1,138 @@
+/* count-leading-zeros.h -- counts the number of leading 0 bits in a word.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#ifndef COUNT_LEADING_ZEROS_H
+#define COUNT_LEADING_ZEROS_H 1
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <limits.h>
+#include <stdlib.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef COUNT_LEADING_ZEROS_INLINE
+# define COUNT_LEADING_ZEROS_INLINE _GL_INLINE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Assuming the GCC builtin is BUILTIN and the MSC builtin is MSC_BUILTIN,
+   expand to code that computes the number of leading zeros of the local
+   variable 'x' of type TYPE (an unsigned integer type) and return it
+   from the current function.  */
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) \
+    || (__clang_major__ >= 4)
+# define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE)                \
+  return x ? BUILTIN (x) : CHAR_BIT * sizeof x;
+#elif _MSC_VER
+# pragma intrinsic (_BitScanReverse)
+# if defined _M_X64
+#  pragma intrinsic (_BitScanReverse64)
+# endif
+# define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE)                \
+    do                                                                  \
+      {                                                                 \
+        unsigned long result;                                           \
+        if (MSC_BUILTIN (&result, x))                                   \
+          return CHAR_BIT * sizeof x - 1 - result;                      \
+        return CHAR_BIT * sizeof x;                                     \
+      }                                                                 \
+    while (0)
+#else
+# define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE)                \
+    do                                                                  \
+      {                                                                 \
+        int count;                                                      \
+        unsigned int leading_32;                                        \
+        if (! x)                                                        \
+          return CHAR_BIT * sizeof x;                                   \
+        for (count = 0;                                                 \
+             (leading_32 = ((x >> (sizeof (TYPE) * CHAR_BIT - 32))      \
+                            & 0xffffffffU),                             \
+              count < CHAR_BIT * sizeof x - 32 && !leading_32);         \
+             count += 32)                                               \
+          x = x << 31 << 1;                                             \
+        return count + count_leading_zeros_32 (leading_32);             \
+      }                                                                 \
+    while (0)
+
+/* Compute and return the number of leading zeros in X,
+   where 0 < X < 2**32.  */
+COUNT_LEADING_ZEROS_INLINE int
+count_leading_zeros_32 (unsigned int x)
+{
+  /* <https://github.com/gibsjose/BitHacks>
+     <https://www.fit.vutbr.cz/~ibarina/pub/bithacks.pdf> */
+  static const char de_Bruijn_lookup[32] = {
+    31, 22, 30, 21, 18, 10, 29, 2, 20, 17, 15, 13, 9, 6, 28, 1,
+    23, 19, 11, 3, 16, 14, 7, 24, 12, 4, 8, 25, 5, 26, 27, 0
+  };
+
+  x |= x >> 1;
+  x |= x >> 2;
+  x |= x >> 4;
+  x |= x >> 8;
+  x |= x >> 16;
+  return de_Bruijn_lookup[((x * 0x07c4acddU) & 0xffffffffU) >> 27];
+}
+#endif
+
+/* Compute and return the number of leading zeros in X. */
+COUNT_LEADING_ZEROS_INLINE int
+count_leading_zeros (unsigned int x)
+{
+  COUNT_LEADING_ZEROS (__builtin_clz, _BitScanReverse, unsigned int);
+}
+
+/* Compute and return the number of leading zeros in X. */
+COUNT_LEADING_ZEROS_INLINE int
+count_leading_zeros_l (unsigned long int x)
+{
+  COUNT_LEADING_ZEROS (__builtin_clzl, _BitScanReverse, unsigned long int);
+}
+
+/* Compute and return the number of leading zeros in X. */
+COUNT_LEADING_ZEROS_INLINE int
+count_leading_zeros_ll (unsigned long long int x)
+{
+#if (defined _MSC_VER && !defined __clang__) && !defined _M_X64
+  /* 32-bit MSVC does not have _BitScanReverse64, only _BitScanReverse.  */
+  unsigned long result;
+  if (_BitScanReverse (&result, (unsigned long) (x >> 32)))
+    return CHAR_BIT * sizeof x - 1 - 32 - result;
+  if (_BitScanReverse (&result, (unsigned long) x))
+    return CHAR_BIT * sizeof x - 1 - result;
+  return CHAR_BIT * sizeof x;
+#else
+  COUNT_LEADING_ZEROS (__builtin_clzll, _BitScanReverse64,
+                       unsigned long long int);
+#endif
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* COUNT_LEADING_ZEROS_H */
deleted file mode 120000 (symlink)
index 9e166705f0b90a22fca98903ced743658d38dc5c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/creat-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c3d03d59a649f1477d071acf9f39a09000dba041
--- /dev/null
@@ -0,0 +1,31 @@
+/* Invoke creat, but avoid some glitches.
+
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by 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));
+}
deleted file mode 120000 (symlink)
index c8d7cec7eb2b1b90dda8ad3f8f492fbbb4318b05..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ctype.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..61bcbf167769a2e81927837c05f897b4eb2f731d
--- /dev/null
@@ -0,0 +1,62 @@
+/* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible.  */
+
+/*
+ * ISO C 99 <ctype.h> for platforms on which it is incomplete.
+ * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html>
+ */
+
+#ifndef _@GUARD_PREFIX@_CTYPE_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* Include the original <ctype.h>.  */
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_CTYPE_H@
+
+#ifndef _@GUARD_PREFIX@_CTYPE_H
+#define _@GUARD_PREFIX@_CTYPE_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* Return non-zero if c is a blank, i.e. a space or tab character.  */
+#if @GNULIB_ISBLANK@
+# if !@HAVE_ISBLANK@
+_GL_EXTERN_C int isblank (int c);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef isblank
+# if HAVE_RAW_DECL_ISBLANK
+_GL_WARN_ON_USE (isblank, "isblank is unportable - "
+                 "use gnulib module isblank for portability");
+# endif
+#endif
+
+#endif /* _@GUARD_PREFIX@_CTYPE_H */
+#endif /* _@GUARD_PREFIX@_CTYPE_H */
deleted file mode 120000 (symlink)
index e1842b90d4206b99b250c3f0022cd77386934df6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/cycle-check.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2b3ba3424f123c56c6b85e4ec0fd42a609c6959f
--- /dev/null
@@ -0,0 +1,84 @@
+/* help detect directory cycles efficiently
+
+   Copyright (C) 2003-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering */
+
+#include <config.h>
+
+#include "cycle-check.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "assure.h"
+
+#define CC_MAGIC 9827862
+
+/* Return true if I is a power of 2, or is zero.  */
+
+static 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)
+{
+  assure (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;
+}
deleted file mode 120000 (symlink)
index a29c3b8a7b2cab6bec96151e4b04e7c59e072fa2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/cycle-check.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..92d385fa0b7f0a1f55d8070423e212fb69d67da6
--- /dev/null
@@ -0,0 +1,51 @@
+/* help detect directory cycles efficiently
+
+   Copyright (C) 2003-2004, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering */
+
+#ifndef CYCLE_CHECK_H
+# define CYCLE_CHECK_H 1
+
+# include <stdint.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
deleted file mode 120000 (symlink)
index 03e930dc2902a258e8483faf1de89fa9cff5f7ad..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dev-ino.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..13e500289c59b88c39cf45b2027b143ce572be4d
--- /dev/null
@@ -0,0 +1,31 @@
+/* A simple (device, inode) struct.
+   Copyright (C) 2003-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering, 2003.  */
+
+#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
deleted file mode 120000 (symlink)
index abe7c21792e1f30e339cab16353195ab208ffc95..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/di-set.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f43cdc98c685f6655e7a6f1ff6e5cc278a81d57c
--- /dev/null
@@ -0,0 +1,261 @@
+/* Set operations for device-inode pairs stored in a space-efficient manner.
+
+   Copyright 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert and Jim Meyering */
+
+#include <config.h>
+#include "di-set.h"
+
+#include "hash.h"
+#include "ino-map.h"
+
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/* The hash package hashes "void *", but this package wants to hash
+   integers.  Use integers that are as large as possible, but no
+   larger than void *, so that they can be cast to void * and back
+   without losing information.  */
+typedef uintptr_t hashint;
+#define HASHINT_MAX ((hashint) -1)
+
+/* Integers represent inode numbers.  Integers in the range
+   1..(LARGE_INO_MIN-1) represent inode numbers directly.  (The hash
+   package does not work with null pointers, so inode 0 cannot be used
+   as a key.)  To find the representations of other inode numbers, map
+   them through INO_MAP.  */
+#define LARGE_INO_MIN (HASHINT_MAX / 2)
+
+/* Set operations for device-inode pairs stored in a space-efficient
+   manner.  Use a two-level hash table.  The top level hashes by
+   device number, as there are typically a small number of devices.
+   The lower level hashes by mapped inode numbers.  In the typical
+   case where the inode number is positive and small, the inode number
+   maps to itself, masquerading as a void * value; otherwise, its
+   value is the result of hashing the inode value through INO_MAP.  */
+
+/* A pair that maps a device number to a set of inode numbers.  */
+struct di_ent
+{
+  dev_t dev;
+  struct hash_table *ino_set;
+};
+
+/* A two-level hash table that manages and indexes these pairs.  */
+struct di_set
+{
+  /* Map device numbers to sets of inode number representatives.  */
+  struct hash_table *dev_map;
+
+  /* If nonnull, map large inode numbers to their small
+     representatives.  If null, there are no large inode numbers in
+     this set.  */
+  struct ino_map *ino_map;
+
+  /* Cache of the most recently allocated and otherwise-unused storage
+     for probing this table.  */
+  struct di_ent *probe;
+};
+
+/* Hash a device-inode-set entry.  */
+static size_t
+di_ent_hash (void const *x, size_t table_size)
+{
+  struct di_ent const *p = x;
+  dev_t dev = p->dev;
+
+  /* When DEV is wider than size_t, exclusive-OR the words of DEV into H.
+     This avoids loss of info, without applying % to the wider type,
+     which could be quite slow on some systems.  */
+  size_t h = dev;
+  unsigned int i;
+  unsigned int n_words = sizeof dev / sizeof h + (sizeof dev % sizeof h != 0);
+  for (i = 1; i < n_words; i++)
+    h ^= dev >> CHAR_BIT * sizeof h * i;
+
+  return h % table_size;
+}
+
+/* Return true if two device-inode-set entries are the same.  */
+static bool
+di_ent_compare (void const *x, void const *y)
+{
+  struct di_ent const *a = x;
+  struct di_ent const *b = y;
+  return a->dev == b->dev;
+}
+
+/* Free a device-inode-set entry.  */
+static void
+di_ent_free (void *v)
+{
+  struct di_ent *a = v;
+  hash_free (a->ino_set);
+  free (a);
+}
+
+/* Create a set of device-inode pairs.  Return NULL on allocation failure.  */
+struct di_set *
+di_set_alloc (void)
+{
+  struct di_set *dis = malloc (sizeof *dis);
+  if (dis)
+    {
+      enum { INITIAL_DEV_MAP_SIZE = 11 };
+      dis->dev_map = hash_initialize (INITIAL_DEV_MAP_SIZE, NULL,
+                                      di_ent_hash, di_ent_compare,
+                                      di_ent_free);
+      if (! dis->dev_map)
+        {
+          free (dis);
+          return NULL;
+        }
+      dis->ino_map = NULL;
+      dis->probe = NULL;
+    }
+
+  return dis;
+}
+
+/* Free a set of device-inode pairs.  */
+void
+di_set_free (struct di_set *dis)
+{
+  hash_free (dis->dev_map);
+  if (dis->ino_map)
+    ino_map_free (dis->ino_map);
+  free (dis->probe);
+  free (dis);
+}
+
+/* Hash an encoded inode number I.  */
+static size_t
+di_ino_hash (void const *i, size_t table_size)
+{
+  return (hashint) i % table_size;
+}
+
+/* Using the DIS table, map a device to a hash table that represents
+   a set of inode numbers.  Return NULL on error.  */
+static struct hash_table *
+map_device (struct di_set *dis, dev_t dev)
+{
+  /* Find space for the probe, reusing the cache if available.  */
+  struct di_ent *ent;
+  struct di_ent *probe = dis->probe;
+  if (probe)
+    {
+      /* If repeating a recent query, return the cached result.   */
+      if (probe->dev == dev)
+        return probe->ino_set;
+    }
+  else
+    {
+      dis->probe = probe = malloc (sizeof *probe);
+      if (! probe)
+        return NULL;
+    }
+
+  /* Probe for the device.  */
+  probe->dev = dev;
+  ent = hash_insert (dis->dev_map, probe);
+  if (! ent)
+    return NULL;
+
+  if (ent != probe)
+    {
+      /* Use the existing entry.  */
+      probe->ino_set = ent->ino_set;
+    }
+  else
+    {
+      enum { INITIAL_INO_SET_SIZE = 1021 };
+
+      /* Prepare to allocate a new probe next time; this one is in use.  */
+      dis->probe = NULL;
+
+      /* DEV is new; allocate an inode set for it.  */
+      probe->ino_set = hash_initialize (INITIAL_INO_SET_SIZE, NULL,
+                                        di_ino_hash, NULL, NULL);
+    }
+
+  return probe->ino_set;
+}
+
+/* Using the DIS table, map an inode number to a mapped value.
+   Return INO_MAP_INSERT_FAILURE on error.  */
+static hashint
+map_inode_number (struct di_set *dis, ino_t ino)
+{
+  if (0 < ino && ino < LARGE_INO_MIN)
+    return ino;
+
+  if (! dis->ino_map)
+    {
+      dis->ino_map = ino_map_alloc (LARGE_INO_MIN);
+      if (! dis->ino_map)
+        return INO_MAP_INSERT_FAILURE;
+    }
+
+  return ino_map_insert (dis->ino_map, ino);
+}
+
+/* Attempt to insert the DEV,INO pair into the set DIS.
+   If it matches a pair already in DIS, keep that pair and return 0.
+   Otherwise, if insertion is successful, return 1.
+   Upon any failure return -1.  */
+int
+di_set_insert (struct di_set *dis, dev_t dev, ino_t ino)
+{
+  hashint i;
+
+  /* Map the device number to a set of inodes.  */
+  struct hash_table *ino_set = map_device (dis, dev);
+  if (! ino_set)
+    return -1;
+
+  /* Map the inode number to a small representative I.  */
+  i = map_inode_number (dis, ino);
+  if (i == INO_MAP_INSERT_FAILURE)
+    return -1;
+
+  /* Put I into the inode set.  */
+  return hash_insert_if_absent (ino_set, (void const *) i, NULL);
+}
+
+/* Look up the DEV,INO pair in the set DIS.
+   If found, return 1; if not found, return 0.
+   Upon any failure return -1.  */
+int
+di_set_lookup (struct di_set *dis, dev_t dev, ino_t ino)
+{
+  hashint i;
+
+  /* Map the device number to a set of inodes.  */
+  struct hash_table *ino_set = map_device (dis, dev);
+  if (! ino_set)
+    return -1;
+
+  /* Map the inode number to a small representative I.  */
+  i = map_inode_number (dis, ino);
+  if (i == INO_MAP_INSERT_FAILURE)
+    return -1;
+
+  /* Perform the look-up.  */
+  return !!hash_lookup (ino_set, (void const *) i);
+}
deleted file mode 120000 (symlink)
index 34a4499ecef9daffe4b7a799f38fab993cc3740c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/di-set.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aa59a01f4624aedc56a0cbd39cb0dc5bd58652d1
--- /dev/null
@@ -0,0 +1,42 @@
+/* Manipulate sets of device-inode pairs efficiently.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering, 2010.  */
+
+#ifndef _GL_DI_SET_H
+# define _GL_DI_SET_H
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
+   _GL_ATTRIBUTE_NONNULL.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <sys/types.h>
+
+struct di_set;
+
+void di_set_free (struct di_set *) _GL_ATTRIBUTE_NONNULL ((1));
+
+struct di_set *di_set_alloc (void)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (di_set_free, 1);
+
+int di_set_insert (struct di_set *, dev_t, ino_t) _GL_ATTRIBUTE_NONNULL ((1));
+
+int di_set_lookup (struct di_set *dis, dev_t dev, ino_t ino)
+  _GL_ATTRIBUTE_NONNULL ((1));
+
+#endif
deleted file mode 120000 (symlink)
index b86baa316aa55ba2d8ab58e46cce8c937d982707..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirchownmod.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..633e6cb5dad4f80ef983e8b81667ec83c3c8ddd4
--- /dev/null
@@ -0,0 +1,141 @@
+/* Change the ownership and mode bits of a directory.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "dirchownmod.h"
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "stat-macros.h"
+
+#ifndef HAVE_FCHMOD
+# define HAVE_FCHMOD 0
+# undef fchmod
+# define fchmod(fd, mode) (-1)
+#endif
+
+/* Change the ownership and mode bits of a directory.  If FD is
+   nonnegative, it should be a file descriptor associated with the
+   directory; close it before returning.  DIR is the name of the
+   directory.
+
+   If MKDIR_MODE is not (mode_t) -1, mkdir (DIR, MKDIR_MODE) has just
+   been executed successfully with umask zero, so DIR should be a
+   directory (not a symbolic link).
+
+   First, set the file's owner to OWNER and group to GROUP, but leave
+   the owner alone if OWNER is (uid_t) -1, and similarly for GROUP.
+
+   Then, set the file's mode bits to MODE, except preserve any of the
+   bits that correspond to zero bits in MODE_BITS.  In other words,
+   MODE_BITS is a mask that specifies which of the file's mode bits
+   should be set or cleared.  MODE should be a subset of MODE_BITS,
+   which in turn should be a subset of CHMOD_MODE_BITS.
+
+   This implementation assumes the current umask is zero.
+
+   Return 0 if successful, -1 (setting errno) otherwise.  Unsuccessful
+   calls may do the chown but not the chmod.  */
+
+int
+dirchownmod (int fd, char const *dir, mode_t mkdir_mode,
+             uid_t owner, gid_t group,
+             mode_t mode, mode_t mode_bits)
+{
+  struct stat st;
+  int result = (fd < 0 ? stat (dir, &st) : fstat (fd, &st));
+
+  if (result == 0)
+    {
+      mode_t dir_mode = st.st_mode;
+
+      /* Check whether DIR is a directory.  If FD is nonnegative, this
+         check avoids changing the ownership and mode bits of the
+         wrong file in many cases.  This doesn't fix all the race
+         conditions, but it is better than nothing.  */
+      if (! S_ISDIR (dir_mode))
+        {
+          errno = ENOTDIR;
+          result = -1;
+        }
+      else
+        {
+          /* If at least one of the S_IXUGO bits are set, chown might
+             clear the S_ISUID and S_SGID bits.  Keep track of any
+             file mode bits whose values are indeterminate due to this
+             issue.  */
+          mode_t indeterminate = 0;
+
+          /* On some systems, chown clears S_ISUID and S_ISGID, so do
+             chown before chmod.  On older System V hosts, ordinary
+             users can give their files away via chown; don't worry
+             about that here, since users shouldn't do that.  */
+
+          if ((owner != (uid_t) -1 && owner != st.st_uid)
+              || (group != (gid_t) -1 && group != st.st_gid))
+            {
+              result = (0 <= fd
+                        ? fchown (fd, owner, group)
+                        : mkdir_mode != (mode_t) -1
+                        ? lchown (dir, owner, group)
+                        : chown (dir, owner, group));
+
+              /* Either the user cares about an indeterminate bit and
+                 it'll be set properly by chmod below, or the user
+                 doesn't care and it's OK to use the bit's pre-chown
+                 value.  So there's no need to re-stat DIR here.  */
+
+              if (result == 0 && (dir_mode & S_IXUGO))
+                indeterminate = dir_mode & (S_ISUID | S_ISGID);
+            }
+
+          /* If the file mode bits might not be right, use chmod to
+             change them.  Don't change bits the user doesn't care
+             about.  */
+          if (result == 0 && (((dir_mode ^ mode) | indeterminate) & mode_bits))
+            {
+              mode_t chmod_mode =
+                mode | (dir_mode & CHMOD_MODE_BITS & ~mode_bits);
+              result = (HAVE_FCHMOD && 0 <= fd
+                        ? fchmod (fd, chmod_mode)
+                        : mkdir_mode != (mode_t) -1
+                        ? lchmod (dir, chmod_mode)
+                        : chmod (dir, chmod_mode));
+            }
+        }
+    }
+
+  if (0 <= fd)
+    {
+      if (result == 0)
+        result = close (fd);
+      else
+        {
+          int e = errno;
+          close (fd);
+          errno = e;
+        }
+    }
+
+  return result;
+}
deleted file mode 120000 (symlink)
index c3a9f20ff04e00511c136f0560e059c323fb080a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirchownmod.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5f4de460d7ff4609e9a80542eb43f6ce66ba58d9
--- /dev/null
@@ -0,0 +1,20 @@
+/* Change the ownership and mode bits of a directory.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <sys/types.h>
+
+int dirchownmod (int, char const *, mode_t, uid_t, gid_t, mode_t, mode_t);
deleted file mode 120000 (symlink)
index 09c7e081e806d7d755d9dacd1691e663dc703a0d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirent--.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b3aa21d94ca5e0925aa1d53a67c88919be046946
--- /dev/null
@@ -0,0 +1,24 @@
+/* Like dirent.h, but redefine some names to avoid glitches.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#include "dirent-safer.h"
+
+#undef opendir
+#define opendir opendir_safer
+#define GNULIB_defined_opendir 1
deleted file mode 120000 (symlink)
index da58f2b8c9ff649e06eb0b087838b2ce006cea0b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirent-private.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..335fbc351a59bbf18049f76076a7e839313cfe94
--- /dev/null
@@ -0,0 +1,67 @@
+/* Private details of the DIR type.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _DIRENT_PRIVATE_H
+#define _DIRENT_PRIVATE_H 1
+
+#if HAVE_DIRENT_H                       /* mingw */
+
+# undef DIR
+
+struct gl_directory
+{
+  /* File descriptor to close during closedir().
+     Needed for implementing fdopendir().  */
+  int fd_to_close;
+  /* Pointer to the real DIR.  */
+  DIR *real_dirp;
+};
+
+/* Restore definition from dirent.h.  */
+# define DIR struct gl_directory
+
+#else                                   /* MSVC */
+
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+/* Don't assume that UNICODE is not defined.  */
+# undef WIN32_FIND_DATA
+# define WIN32_FIND_DATA WIN32_FIND_DATAA
+
+struct gl_directory
+{
+  /* File descriptor to close during closedir().
+     Needed for implementing fdopendir().  */
+  int fd_to_close;
+  /* Status, or error code to produce in next readdir() call.
+     -2 means the end of the directory is already reached,
+     -1 means the entry was already filled by FindFirstFile,
+     0 means the entry needs to be filled using FindNextFile.
+     A positive value is an error code.  */
+  int status;
+  /* Handle, reading the directory, at current position.  */
+  HANDLE current;
+  /* Found directory entry.  */
+  WIN32_FIND_DATA entry;
+  /* Argument to pass to FindFirstFile.  It consists of the absolutized
+     directory name, followed by a directory separator and the wildcards.  */
+  char dir_name_mask[1];
+};
+
+#endif
+
+#endif /* _DIRENT_PRIVATE_H */
deleted file mode 120000 (symlink)
index fcd7b05bba500de742c17365c62b96c1aab8ba27..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirent-safer.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2dba36d08b2f6faf71cb2d23c2e696c1a3610e05
--- /dev/null
@@ -0,0 +1,36 @@
+/* Invoke dirent-like functions, but avoid some glitches.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <dirent.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+DIR *opendir_safer (const char *name)
+  _GL_ATTRIBUTE_DEALLOC (closedir, 1);
+
+#ifdef __cplusplus
+}
+#endif
deleted file mode 120000 (symlink)
index 9dca088bb81873f030192cf5b175f171adab2f6d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirent.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f05b880077f619401a51076a00ca69a8c2ec8519
--- /dev/null
@@ -0,0 +1,352 @@
+/* A GNU-like <dirent.h>.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_DIRENT_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_DIRENT_H@
+# @INCLUDE_NEXT@ @NEXT_DIRENT_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_DIRENT_H
+#define _@GUARD_PREFIX@_DIRENT_H
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
+   _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get ino_t.  Needed on some systems, including glibc 2.8.  */
+#include <sys/types.h>
+
+#if !@HAVE_DIRENT_H@
+/* Define types DIR and 'struct dirent'.  */
+# if !GNULIB_defined_struct_dirent
+struct dirent
+{
+  char d_type;
+  char d_name[1];
+};
+/* Possible values for 'd_type'.  */
+#  define DT_UNKNOWN 0
+#  define DT_FIFO    1          /* FIFO */
+#  define DT_CHR     2          /* character device */
+#  define DT_DIR     4          /* directory */
+#  define DT_BLK     6          /* block device */
+#  define DT_REG     8          /* regular file */
+#  define DT_LNK    10          /* symbolic link */
+#  define DT_SOCK   12          /* socket */
+#  define DT_WHT    14          /* whiteout */
+#  define GNULIB_defined_struct_dirent 1
+# endif
+#endif
+
+#if !@DIR_HAS_FD_MEMBER@
+# if !GNULIB_defined_DIR
+/* struct gl_directory is a type with a field 'int fd_to_close'.
+   It is needed for implementing fdopendir().  */
+struct gl_directory;
+#  if @HAVE_DIRENT_H@
+#   define DIR struct gl_directory
+#  else
+typedef struct gl_directory DIR;
+#  endif
+#  define GNULIB_defined_DIR 1
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
+   that can be freed by passing them as the Ith argument to the
+   function F.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# if __GNUC__ >= 11
+#  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+# else
+#  define _GL_ATTRIBUTE_DEALLOC(f, i)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
+   allocated memory.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if __GNUC__ >= 3 || defined __clang__
+#  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define _GL_ATTRIBUTE_MALLOC
+# endif
+#endif
+
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __pure__ was added in gcc 2.96.  */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Declare overridden functions.  */
+
+#if @GNULIB_CLOSEDIR@
+# if @REPLACE_CLOSEDIR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef closedir
+#   define closedir rpl_closedir
+#   define GNULIB_defined_closedir 1
+#  endif
+_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
+# else
+#  if !@HAVE_CLOSEDIR@
+_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
+# endif
+_GL_CXXALIASWARN (closedir);
+#elif defined GNULIB_POSIXCHECK
+# undef closedir
+# if HAVE_RAW_DECL_CLOSEDIR
+_GL_WARN_ON_USE (closedir, "closedir is not portable - "
+                 "use gnulib module closedir for portability");
+# endif
+#endif
+
+#if @GNULIB_OPENDIR@
+# if @REPLACE_OPENDIR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef opendir
+#   define opendir rpl_opendir
+#   define GNULIB_defined_opendir 1
+#  endif
+_GL_FUNCDECL_RPL (opendir, DIR *,
+                  (const char *dir_name)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
+_GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
+# else
+#  if !@HAVE_OPENDIR@ || __GNUC__ >= 11
+_GL_FUNCDECL_SYS (opendir, DIR *,
+                  (const char *dir_name)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
+#  endif
+_GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
+# endif
+_GL_CXXALIASWARN (opendir);
+#else
+# if @GNULIB_CLOSEDIR@ && !GNULIB_defined_DIR && __GNUC__ >= 11 && !defined opendir
+/* For -Wmismatched-dealloc: Associate opendir with closedir or
+   rpl_closedir.  */
+_GL_FUNCDECL_SYS (opendir, DIR *,
+                  (const char *dir_name)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef opendir
+#  if HAVE_RAW_DECL_OPENDIR
+_GL_WARN_ON_USE (opendir, "opendir is not portable - "
+                 "use gnulib module opendir for portability");
+#  endif
+# endif
+#endif
+
+#if @GNULIB_READDIR@
+# if @REPLACE_READDIR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef readdir
+#   define readdir rpl_readdir
+#  endif
+_GL_FUNCDECL_RPL (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (readdir, struct dirent *, (DIR *dirp));
+# else
+#  if !@HAVE_READDIR@
+_GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp));
+# endif
+_GL_CXXALIASWARN (readdir);
+#elif defined GNULIB_POSIXCHECK
+# undef readdir
+# if HAVE_RAW_DECL_READDIR
+_GL_WARN_ON_USE (readdir, "readdir is not portable - "
+                 "use gnulib module readdir for portability");
+# endif
+#endif
+
+#if @GNULIB_REWINDDIR@
+# if @REPLACE_REWINDDIR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rewinddir
+#   define rewinddir rpl_rewinddir
+#  endif
+_GL_FUNCDECL_RPL (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (rewinddir, void, (DIR *dirp));
+# else
+#  if !@HAVE_REWINDDIR@
+_GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp));
+# endif
+_GL_CXXALIASWARN (rewinddir);
+#elif defined GNULIB_POSIXCHECK
+# undef rewinddir
+# if HAVE_RAW_DECL_REWINDDIR
+_GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
+                 "use gnulib module rewinddir for portability");
+# endif
+#endif
+
+#if @GNULIB_DIRFD@
+/* Return the file descriptor associated with the given directory stream,
+   or -1 if none exists.  */
+# if @REPLACE_DIRFD@
+/* On kLIBC, dirfd() is a macro that does not work.  Undefine it.  */
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE) || defined dirfd
+#   undef dirfd
+#   define dirfd rpl_dirfd
+#  endif
+_GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (dirfd, int, (DIR *));
+
+# else
+#  if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd
+    /* dirfd is defined as a macro and not as a function.
+       Turn it into a function and get rid of the macro.  */
+static inline int (dirfd) (DIR *dp) { return dirfd (dp); }
+#   undef dirfd
+#  endif
+#  if !(@HAVE_DECL_DIRFD@ || defined dirfd)
+_GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (dirfd, int, (DIR *));
+# endif
+_GL_CXXALIASWARN (dirfd);
+#elif defined GNULIB_POSIXCHECK
+# undef dirfd
+# if HAVE_RAW_DECL_DIRFD
+_GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
+                 "use gnulib module dirfd for portability");
+# endif
+#endif
+
+#if @GNULIB_FDOPENDIR@
+/* Open a directory stream visiting the given directory file
+   descriptor.  Return NULL and set errno if fd is not visiting a
+   directory.  On success, this function consumes fd (it will be
+   implicitly closed either by this function or by a subsequent
+   closedir).  */
+# if @REPLACE_FDOPENDIR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fdopendir
+#   define fdopendir rpl_fdopendir
+#  endif
+_GL_FUNCDECL_RPL (fdopendir, DIR *,
+                  (int fd)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
+_GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
+# else
+#  if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ || __GNUC__ >= 11
+_GL_FUNCDECL_SYS (fdopendir, DIR *,
+                  (int fd)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
+#  endif
+_GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
+# endif
+_GL_CXXALIASWARN (fdopendir);
+#else
+# if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined fdopendir
+/* For -Wmismatched-dealloc: Associate fdopendir with closedir or
+   rpl_closedir.  */
+_GL_FUNCDECL_SYS (fdopendir, DIR *,
+                  (int fd)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef fdopendir
+#  if HAVE_RAW_DECL_FDOPENDIR
+_GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
+                 "use gnulib module fdopendir for portability");
+#  endif
+# endif
+#endif
+
+#if @GNULIB_SCANDIR@
+/* Scan the directory DIR, calling FILTER on each directory entry.
+   Entries for which FILTER returns nonzero are individually malloc'd,
+   sorted using qsort with CMP, and collected in a malloc'd array in
+   *NAMELIST.  Returns the number of entries selected, or -1 on error.  */
+# if !@HAVE_SCANDIR@
+_GL_FUNCDECL_SYS (scandir, int,
+                  (const char *dir, struct dirent ***namelist,
+                   int (*filter) (const struct dirent *),
+                   int (*cmp) (const struct dirent **, const struct dirent **))
+                  _GL_ARG_NONNULL ((1, 2, 4)));
+# endif
+/* Need to cast, because on glibc systems, the fourth parameter is
+                        int (*cmp) (const void *, const void *).  */
+_GL_CXXALIAS_SYS_CAST (scandir, int,
+                       (const char *dir, struct dirent ***namelist,
+                        int (*filter) (const struct dirent *),
+                        int (*cmp) (const struct dirent **, const struct dirent **)));
+_GL_CXXALIASWARN (scandir);
+#elif defined GNULIB_POSIXCHECK
+# undef scandir
+# if HAVE_RAW_DECL_SCANDIR
+_GL_WARN_ON_USE (scandir, "scandir is unportable - "
+                 "use gnulib module scandir for portability");
+# endif
+#endif
+
+#if @GNULIB_ALPHASORT@
+/* Compare two 'struct dirent' entries alphabetically.  */
+# if !@HAVE_ALPHASORT@
+_GL_FUNCDECL_SYS (alphasort, int,
+                  (const struct dirent **, const struct dirent **)
+                  _GL_ATTRIBUTE_PURE
+                  _GL_ARG_NONNULL ((1, 2)));
+# endif
+/* Need to cast, because on glibc systems, the parameters are
+                       (const void *, const void *).  */
+_GL_CXXALIAS_SYS_CAST (alphasort, int,
+                       (const struct dirent **, const struct dirent **));
+_GL_CXXALIASWARN (alphasort);
+#elif defined GNULIB_POSIXCHECK
+# undef alphasort
+# if HAVE_RAW_DECL_ALPHASORT
+_GL_WARN_ON_USE (alphasort, "alphasort is unportable - "
+                 "use gnulib module alphasort for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_DIRENT_H */
+#endif /* _@GUARD_PREFIX@_DIRENT_H */
deleted file mode 120000 (symlink)
index e2b95553246b9764ef478ca0fcf9f56f3ea07bb5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirfd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..afcf382e301c8755463bd8035251eafb6ca5d172
--- /dev/null
@@ -0,0 +1,44 @@
+/* dirfd.c -- return the file descriptor associated with an open DIR*
+
+   Copyright (C) 2001, 2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+#include <dirent.h>
+#include <errno.h>
+
+#if GNULIB_defined_DIR
+# include "dirent-private.h"
+#endif
+
+int
+dirfd (DIR *dir_p)
+{
+#if GNULIB_defined_DIR
+  int fd = dir_p->fd_to_close;
+  if (fd == -1)
+    errno = EINVAL;
+  return fd;
+#else
+  int fd = DIR_TO_FD (dir_p);
+  if (fd == -1)
+    errno = ENOTSUP;
+
+  return fd;
+#endif
+}
deleted file mode 120000 (symlink)
index 6e6455d3f664c29c9fcd9fc6aa1210fde419246e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirname-lgpl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8333c0ebadea8e2a15a96d9438a06046ba925df4
--- /dev/null
@@ -0,0 +1,86 @@
+/* dirname.c -- return all but the last element in a file name
+
+   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "dirname.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+/* Return the length of the prefix of FILE that will be used by
+   dir_name.  If FILE is in the working directory, this returns zero
+   even though 'dir_name (FILE)' will return ".".  Works properly even
+   if there are trailing slashes (by effectively ignoring them).  */
+
+size_t
+dir_len (char const *file)
+{
+  size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file);
+  size_t length;
+
+  /* Advance prefix_length beyond important leading slashes.  */
+  prefix_length += (prefix_length != 0
+                    ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+                       && ISSLASH (file[prefix_length]))
+                    : (ISSLASH (file[0])
+                       ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT
+                           && ISSLASH (file[1]) && ! ISSLASH (file[2])
+                           ? 2 : 1))
+                       : 0));
+
+  /* Strip the basename and any redundant slashes before it.  */
+  for (length = last_component (file) - file;
+       prefix_length < length; length--)
+    if (! ISSLASH (file[length - 1]))
+      break;
+  return length;
+}
+
+
+/* In general, we can't use the builtin 'dirname' function if available,
+   since it has different meanings in different environments.
+   In some environments the builtin 'dirname' modifies its argument.
+
+   Return the leading directories part of FILE, allocated with malloc.
+   Works properly even if there are trailing slashes (by effectively
+   ignoring them).  Return NULL on failure.
+
+   If lstat (FILE) would succeed, then { chdir (dir_name (FILE));
+   lstat (base_name (FILE)); } will access the same file.  Likewise,
+   if the sequence { chdir (dir_name (FILE));
+   rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE
+   to "foo" in the same directory FILE was in.  */
+
+char *
+mdir_name (char const *file)
+{
+  size_t length = dir_len (file);
+  bool append_dot = (length == 0
+                     || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+                         && length == FILE_SYSTEM_PREFIX_LEN (file)
+                         && file[2] != '\0' && ! ISSLASH (file[2])));
+  char *dir = malloc (length + append_dot + 1);
+  if (!dir)
+    return NULL;
+  memcpy (dir, file, length);
+  if (append_dot)
+    dir[length++] = '.';
+  dir[length] = '\0';
+  return dir;
+}
deleted file mode 120000 (symlink)
index 66af64a0ab90fa2ea610835d51bb0be33c06d347..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..393ec1b442c94fb7a286fcacf26026887518b3a2
--- /dev/null
@@ -0,0 +1,38 @@
+/* dirname.c -- return all but the last element in a file name
+
+   Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "dirname.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include "xalloc.h"
+
+/* Just like mdir_name (dirname-lgpl.c), except, rather than
+   returning NULL upon malloc failure, here, we report the
+   "memory exhausted" condition and exit.  */
+
+char *
+dir_name (char const *file)
+{
+  char *result = mdir_name (file);
+  if (!result)
+    xalloc_die ();
+  return result;
+}
deleted file mode 120000 (symlink)
index 4cf7b520903005b399e2556d403f6456081b5c05..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dirname.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..33935ba9379b4f4cd5b3b0760b25e396700999cf
--- /dev/null
@@ -0,0 +1,59 @@
+/* Take file names apart into directory and base names.
+
+   Copyright (C) 1998, 2001, 2003-2006, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef DIRNAME_H_
+# define DIRNAME_H_ 1
+
+/* This file uses _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_PURE,
+   _GL_ATTRIBUTE_RETURNS_NONNULL.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+# include <stdlib.h>
+# include "filename.h"
+# include "basename-lgpl.h"
+
+# ifndef DIRECTORY_SEPARATOR
+#  define DIRECTORY_SEPARATOR '/'
+# endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+# if GNULIB_DIRNAME
+char *base_name (char const *file)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+char *dir_name (char const *file)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+# endif
+
+char *mdir_name (char const *file)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE;
+
+bool strip_trailing_slashes (char *file);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* not DIRNAME_H_ */
deleted file mode 120000 (symlink)
index ab5525a791220eb5d4b52bd08cd3d7b1cecc26fc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dtoastr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..09ddc3c668843f06a5072b6b55ff25ec62857d94
--- /dev/null
@@ -0,0 +1,19 @@
+/* Convert 'double' to accurate string.
+
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define LENGTH 2
+#include "ftoastr.c"
deleted file mode 120000 (symlink)
index a8032854e4741fc6dd5575a33463e5ada2f4147f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dtotimespec.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0557961cf978761ca9f898178e3fd5efb6a53992
--- /dev/null
@@ -0,0 +1,53 @@
+/* Convert double to timespec.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+/* Convert the double value SEC to a struct timespec.  Round toward
+   positive infinity.  On overflow, return an extremal value.  */
+
+#include <config.h>
+
+#include "timespec.h"
+
+#include "intprops.h"
+
+struct timespec
+dtotimespec (double sec)
+{
+  if (! (TYPE_MINIMUM (time_t) < sec))
+    return make_timespec (TYPE_MINIMUM (time_t), 0);
+  else if (! (sec < 1.0 + TYPE_MAXIMUM (time_t)))
+    return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_HZ - 1);
+  else
+    {
+      time_t s = sec;
+      double frac = TIMESPEC_HZ * (sec - s);
+      long ns = frac;
+      ns += ns < frac;
+      s += ns / TIMESPEC_HZ;
+      ns %= TIMESPEC_HZ;
+
+      if (ns < 0)
+        {
+          s--;
+          ns += TIMESPEC_HZ;
+        }
+
+      return make_timespec (s, ns);
+    }
+}
deleted file mode 120000 (symlink)
index 43271822c16ebdd1890f0e6d861052f4a0fdeb8c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dup-safer-flag.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ec2e311e40e9b70cce1c0ae45687e51ab22872b7
--- /dev/null
@@ -0,0 +1,38 @@
+/* Duplicate a file descriptor result, avoiding clobbering
+   STD{IN,OUT,ERR}_FILENO, with specific flags.
+
+   Copyright (C) 2001, 2004-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Eric Blake.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistd-safer.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+
+/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or
+   STDERR_FILENO.  If FLAG contains O_CLOEXEC, behave like
+   fcntl(F_DUPFD_CLOEXEC) rather than fcntl(F_DUPFD).  */
+
+int
+dup_safer_flag (int fd, int flag)
+{
+  return fcntl (fd, (flag & O_CLOEXEC) ? F_DUPFD_CLOEXEC : F_DUPFD,
+                STDERR_FILENO + 1);
+}
deleted file mode 120000 (symlink)
index 4f3375e7242b114eacd90ba0f338e56754ba6973..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dup-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b0df22785ce7c0629210eca2d32a8174b3811681
--- /dev/null
@@ -0,0 +1,34 @@
+/* Invoke dup, but avoid some glitches.
+
+   Copyright (C) 2001, 2004-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "unistd-safer.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+
+/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or
+   STDERR_FILENO.  */
+
+int
+dup_safer (int fd)
+{
+  return fcntl (fd, F_DUPFD, STDERR_FILENO + 1);
+}
deleted file mode 120000 (symlink)
index 2e48c12d7891f9f19dbb158eddea8a8b4639d61e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dup.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..db2680369b74c2d3f99339f7c7a2c03a417dc935
--- /dev/null
@@ -0,0 +1,92 @@
+/* Duplicate an open file descriptor.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#undef dup
+
+#if defined _WIN32 && !defined __CYGWIN__
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+dup_nothrow (int fd)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _dup (fd);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = -1;
+      errno = EBADF;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+# else
+#  define dup_nothrow _dup
+# endif
+#elif defined __KLIBC__
+# include <fcntl.h>
+# include <sys/stat.h>
+
+# include <InnoTekLIBC/backend.h>
+
+static int
+dup_nothrow (int fd)
+{
+  int dupfd;
+  struct stat sbuf;
+
+  dupfd = dup (fd);
+  if (dupfd == -1 && errno == ENOTSUP \
+      && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode))
+    {
+      char path[_MAX_PATH];
+
+      /* Get a path from fd */
+      if (!__libc_Back_ioFHToPath (fd, path, sizeof (path)))
+        dupfd = open (path, O_RDONLY);
+    }
+
+  return dupfd;
+}
+#else
+# define dup_nothrow dup
+#endif
+
+int
+rpl_dup (int fd)
+{
+  int result = dup_nothrow (fd);
+#if REPLACE_FCHDIR
+  if (result >= 0)
+    result = _gl_register_dup (fd, result);
+#endif
+  return result;
+}
deleted file mode 120000 (symlink)
index f86898db56059ff547cddc05e6533f0033e30f06..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dup2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..916e113dd899e4bea98eb841f3f747329c13393a
--- /dev/null
@@ -0,0 +1,189 @@
+/* Duplicate an open file descriptor to a specified file descriptor.
+
+   Copyright (C) 1999, 2004-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+
+#undef dup2
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+/* Get declarations of the native Windows API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#  include "msvc-inval.h"
+# endif
+
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+dup2_nothrow (int fd, int desired_fd)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _dup2 (fd, desired_fd);
+    }
+  CATCH_MSVC_INVAL
+    {
+      errno = EBADF;
+      result = -1;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+# else
+#  define dup2_nothrow _dup2
+# endif
+
+static int
+ms_windows_dup2 (int fd, int desired_fd)
+{
+  int result;
+
+  /* If fd is closed, mingw hangs on dup2 (fd, fd).  If fd is open,
+     dup2 (fd, fd) returns 0, but all further attempts to use fd in
+     future dup2 calls will hang.  */
+  if (fd == desired_fd)
+    {
+      if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
+        {
+          errno = EBADF;
+          return -1;
+        }
+      return fd;
+    }
+
+  /* Wine 1.0.1 return 0 when desired_fd is negative but not -1:
+     https://bugs.winehq.org/show_bug.cgi?id=21289 */
+  if (desired_fd < 0)
+    {
+      errno = EBADF;
+      return -1;
+    }
+
+  result = dup2_nothrow (fd, desired_fd);
+
+  if (result == 0)
+    result = desired_fd;
+
+  return result;
+}
+
+# define dup2 ms_windows_dup2
+
+#elif defined __KLIBC__
+
+# include <InnoTekLIBC/backend.h>
+
+static int
+klibc_dup2dirfd (int fd, int desired_fd)
+{
+  int tempfd;
+  int dupfd;
+
+  tempfd = open ("NUL", O_RDONLY);
+  if (tempfd == -1)
+    return -1;
+
+  if (tempfd == desired_fd)
+    {
+      close (tempfd);
+
+      char path[_MAX_PATH];
+      if (__libc_Back_ioFHToPath (fd, path, sizeof (path)))
+        return -1;
+
+      return open(path, O_RDONLY);
+    }
+
+  dupfd = klibc_dup2dirfd (fd, desired_fd);
+
+  close (tempfd);
+
+  return dupfd;
+}
+
+static int
+klibc_dup2 (int fd, int desired_fd)
+{
+  int dupfd;
+  struct stat sbuf;
+
+  dupfd = dup2 (fd, desired_fd);
+  if (dupfd == -1 && errno == ENOTSUP \
+      && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode))
+    {
+      close (desired_fd);
+
+      return klibc_dup2dirfd (fd, desired_fd);
+    }
+
+  return dupfd;
+}
+
+# define dup2 klibc_dup2
+#endif
+
+int
+rpl_dup2 (int fd, int desired_fd)
+{
+  int result;
+
+#ifdef F_GETFL
+  /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
+     On Cygwin 1.5.x, dup2 (1, 1) returns 0.
+     On Cygwin 1.7.17, dup2 (1, -1) dumps core.
+     On Cygwin 1.7.25, dup2 (1, 256) can dump core.
+     On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC.  */
+# if HAVE_SETDTABLESIZE
+  setdtablesize (desired_fd + 1);
+# endif
+  if (desired_fd < 0)
+    fd = desired_fd;
+  if (fd == desired_fd)
+    return fcntl (fd, F_GETFL) == -1 ? -1 : fd;
+#endif
+
+  result = dup2 (fd, desired_fd);
+
+  /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x.  */
+  if (result == -1 && errno == EMFILE)
+    errno = EBADF;
+#if REPLACE_FCHDIR
+  if (fd != desired_fd && result != -1)
+    result = _gl_register_dup (fd, result);
+#endif
+  return result;
+}
deleted file mode 120000 (symlink)
index 30e14aae44e47ad3127d5b3e3e875afc4f9581b1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/dynarray.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8940e81b25d0b86e24a7ac1087ae01939f44fa52
--- /dev/null
@@ -0,0 +1,284 @@
+/* Type-safe arrays which grow dynamically.
+   Copyright 2021-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Bruno Haible, 2021.  */
+
+#ifndef _GL_DYNARRAY_H
+#define _GL_DYNARRAY_H
+
+/* Before including this file, you need to define:
+
+   DYNARRAY_STRUCT
+      The struct tag of dynamic array to be defined.
+
+   DYNARRAY_ELEMENT
+      The type name of the element type.  Elements are copied
+      as if by memcpy, and can change address as the dynamic
+      array grows.
+
+   DYNARRAY_PREFIX
+      The prefix of the functions which are defined.
+
+   The following parameters are optional:
+
+   DYNARRAY_ELEMENT_FREE
+      DYNARRAY_ELEMENT_FREE (E) is evaluated to deallocate the
+      contents of elements. E is of type  DYNARRAY_ELEMENT *.
+
+   DYNARRAY_ELEMENT_INIT
+      DYNARRAY_ELEMENT_INIT (E) is evaluated to initialize a new
+      element.  E is of type  DYNARRAY_ELEMENT *.
+      If DYNARRAY_ELEMENT_FREE but not DYNARRAY_ELEMENT_INIT is
+      defined, new elements are automatically zero-initialized.
+      Otherwise, new elements have undefined contents.
+
+   DYNARRAY_INITIAL_SIZE
+      The size of the statically allocated array (default:
+      at least 2, more elements if they fit into 128 bytes).
+      Must be a preprocessor constant.  If DYNARRAY_INITIAL_SIZE is 0,
+      there is no statically allocated array at, and all non-empty
+      arrays are heap-allocated.
+
+   DYNARRAY_FINAL_TYPE
+      The name of the type which holds the final array.  If not
+      defined, is PREFIX##finalize not provided.  DYNARRAY_FINAL_TYPE
+      must be a struct type, with members of type DYNARRAY_ELEMENT and
+      size_t at the start (in this order).
+
+   These macros are undefined after this header file has been
+   included.
+
+   The following types are provided (their members are private to the
+   dynarray implementation):
+
+     struct DYNARRAY_STRUCT
+
+   The following functions are provided:
+ */
+
+/* Initialize a dynamic array object.  This must be called before any
+   use of the object.  */
+#if 0
+static void
+       DYNARRAY_PREFIX##init (struct DYNARRAY_STRUCT *list);
+#endif
+
+/* Deallocate the dynamic array and its elements.  */
+#if 0
+static void
+       DYNARRAY_PREFIX##free (struct DYNARRAY_STRUCT *list);
+#endif
+
+/* Return true if the dynamic array is in an error state.  */
+#if 0
+static bool
+       DYNARRAY_PREFIX##has_failed (const struct DYNARRAY_STRUCT *list);
+#endif
+
+/* Mark the dynamic array as failed.  All elements are deallocated as
+   a side effect.  */
+#if 0
+static void
+       DYNARRAY_PREFIX##mark_failed (struct DYNARRAY_STRUCT *list);
+#endif
+
+/* Return the number of elements which have been added to the dynamic
+   array.  */
+#if 0
+static size_t
+       DYNARRAY_PREFIX##size (const struct DYNARRAY_STRUCT *list);
+#endif
+
+/* Return a pointer to the first array element, if any.  For a
+   zero-length array, the pointer can be NULL even though the dynamic
+   array has not entered the failure state.  */
+#if 0
+static DYNARRAY_ELEMENT *
+       DYNARRAY_PREFIX##begin (const struct DYNARRAY_STRUCT *list);
+#endif
+
+/* Return a pointer one element past the last array element.  For a
+   zero-length array, the pointer can be NULL even though the dynamic
+   array has not entered the failure state.  */
+#if 0
+static DYNARRAY_ELEMENT *
+       DYNARRAY_PREFIX##end (const struct DYNARRAY_STRUCT *list);
+#endif
+
+/* Return a pointer to the array element at INDEX.  Terminate the
+   process if INDEX is out of bounds.  */
+#if 0
+static DYNARRAY_ELEMENT *
+       DYNARRAY_PREFIX##at (struct DYNARRAY_STRUCT *list, size_t index);
+#endif
+
+/* Add ITEM at the end of the array, enlarging it by one element.
+   Mark *LIST as failed if the dynamic array allocation size cannot be
+   increased.  */
+#if 0
+static void
+       DYNARRAY_PREFIX##add (struct DYNARRAY_STRUCT *list,
+                             DYNARRAY_ELEMENT item);
+#endif
+
+/* Allocate a place for a new element in *LIST and return a pointer to
+   it.  The pointer can be NULL if the dynamic array cannot be
+   enlarged due to a memory allocation failure.  */
+#if 0
+static DYNARRAY_ELEMENT *
+       DYNARRAY_PREFIX##emplace (struct DYNARRAY_STRUCT *list);
+#endif
+
+/* Change the size of *LIST to SIZE.  If SIZE is larger than the
+   existing size, new elements are added (which can be initialized).
+   Otherwise, the list is truncated, and elements are freed.  Return
+   false on memory allocation failure (and mark *LIST as failed).  */
+#if 0
+static bool
+       DYNARRAY_PREFIX##resize (struct DYNARRAY_STRUCT *list, size_t size);
+#endif
+
+/* Remove the last element of LIST if it is present.  */
+#if 0
+static void
+       DYNARRAY_PREFIX##remove_last (struct DYNARRAY_STRUCT *list);
+#endif
+
+/* Remove all elements from the list.  The elements are freed, but the
+   list itself is not.  */
+#if 0
+static void
+       DYNARRAY_PREFIX##clear (struct DYNARRAY_STRUCT *list);
+#endif
+
+#if defined DYNARRAY_FINAL_TYPE
+/* Transfer the dynamic array to a permanent location at *RESULT.
+   Returns true on success on false on allocation failure.  In either
+   case, *LIST is re-initialized and can be reused.  A NULL pointer is
+   stored in *RESULT if LIST refers to an empty list.  On success, the
+   pointer in *RESULT is heap-allocated and must be deallocated using
+   free.  */
+#if 0
+static bool
+       DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *list,
+                                  DYNARRAY_FINAL_TYPE *result);
+#endif
+#else /* !defined DYNARRAY_FINAL_TYPE */
+/* Transfer the dynamic array to a heap-allocated array and return a
+   pointer to it.  The pointer is NULL if memory allocation fails, or
+   if the array is empty, so this function should be used only for
+   arrays which are known not be empty (usually because they always
+   have a sentinel at the end).  If LENGTHP is not NULL, the array
+   length is written to *LENGTHP.  *LIST is re-initialized and can be
+   reused.  */
+#if 0
+static DYNARRAY_ELEMENT *
+       DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *list,
+                                  size_t *lengthp);
+#endif
+#endif
+
+/* A minimal example which provides a growing list of integers can be
+   defined like this:
+
+     struct int_array
+     {
+       // Pointer to result array followed by its length,
+       // as required by DYNARRAY_FINAL_TYPE.
+       int *array;
+       size_t length;
+     };
+
+     #define DYNARRAY_STRUCT dynarray_int
+     #define DYNARRAY_ELEMENT int
+     #define DYNARRAY_PREFIX dynarray_int_
+     #define DYNARRAY_FINAL_TYPE struct int_array
+     #include <malloc/dynarray-skeleton.c>
+
+   To create a three-element array with elements 1, 2, 3, use this
+   code:
+
+     struct dynarray_int dyn;
+     dynarray_int_init (&dyn);
+     for (int i = 1; i <= 3; ++i)
+       {
+         int *place = dynarray_int_emplace (&dyn);
+         assert (place != NULL);
+         *place = i;
+       }
+     struct int_array result;
+     bool ok = dynarray_int_finalize (&dyn, &result);
+     assert (ok);
+     assert (result.length == 3);
+     assert (result.array[0] == 1);
+     assert (result.array[1] == 2);
+     assert (result.array[2] == 3);
+     free (result.array);
+
+   If the elements contain resources which must be freed, define
+   DYNARRAY_ELEMENT_FREE appropriately, like this:
+
+     struct str_array
+     {
+       char **array;
+       size_t length;
+     };
+
+     #define DYNARRAY_STRUCT dynarray_str
+     #define DYNARRAY_ELEMENT char *
+     #define DYNARRAY_ELEMENT_FREE(ptr) free (*ptr)
+     #define DYNARRAY_PREFIX dynarray_str_
+     #define DYNARRAY_FINAL_TYPE struct str_array
+     #include <malloc/dynarray-skeleton.c>
+ */
+
+
+/* The implementation is imported from glibc.  */
+
+/* Avoid possible conflicts with symbols exported by the GNU libc.  */
+#define __libc_dynarray_at_failure gl_dynarray_at_failure
+#define __libc_dynarray_emplace_enlarge gl_dynarray_emplace_enlarge
+#define __libc_dynarray_finalize gl_dynarray_finalize
+#define __libc_dynarray_resize_clear gl_dynarray_resize_clear
+#define __libc_dynarray_resize gl_dynarray_resize
+
+#if defined DYNARRAY_STRUCT || defined DYNARRAY_ELEMENT || defined DYNARRAY_PREFIX
+
+# ifndef _GL_LIKELY
+/* Rely on __builtin_expect, as provided by the module 'builtin-expect'.  */
+#  define _GL_LIKELY(cond) __builtin_expect ((cond), 1)
+#  define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0)
+# endif
+
+/* Define auxiliary structs and declare auxiliary functions, common to all
+   instantiations of dynarray.  */
+# include <malloc/dynarray.gl.h>
+
+/* Define the instantiation, specified through
+     DYNARRAY_STRUCT
+     DYNARRAY_ELEMENT
+     DYNARRAY_PREFIX
+   etc.  */
+# include <malloc/dynarray-skeleton.gl.h>
+
+#else
+
+/* This file is being included from one of the malloc/dynarray_*.c files.  */
+# include <malloc/dynarray.h>
+
+#endif
+
+#endif /* _GL_DYNARRAY_H */
deleted file mode 120000 (symlink)
index 919ca2050267f398e1860abfb3c5fea506f8b106..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/eloop-threshold.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..84d19b458b8c9f8b1fe671437165c5f7b8c71095
--- /dev/null
@@ -0,0 +1,88 @@
+/* Threshold at which to diagnose ELOOP.  Generic version.
+   Copyright (C) 2012-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _ELOOP_THRESHOLD_H
+#define _ELOOP_THRESHOLD_H      1
+
+/* This file uses _GL_ATTRIBUTE_CONST.  */
+#if !_LIBC && !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <limits.h>
+#ifdef _LIBC
+# include <sys/param.h>
+# define _GL_ATTRIBUTE_CONST __attribute__ ((const))
+#else
+# include <unistd.h>
+# include "minmax.h"
+# define __sysconf sysconf
+# if (!defined SYMLOOP_MAX \
+      && ! (defined _SC_SYMLOOP_MAX && defined _POSIX_SYMLOOP_MAX))
+#  define SYMLOOP_MAX 8
+# endif
+#endif
+
+/* POSIX specifies SYMLOOP_MAX as the "Maximum number of symbolic
+   links that can be reliably traversed in the resolution of a
+   pathname in the absence of a loop."  This makes it a minimum that
+   we should certainly accept.  But it leaves open the possibility
+   that more might sometimes work--just not "reliably".
+
+   For example, Linux implements a complex policy whereby there is a
+   small limit on the number of direct symlink traversals (a symlink
+   to a symlink to a symlink), but larger limit on the total number of
+   symlink traversals overall.  Hence the SYMLOOP_MAX number should be
+   the small one, but the limit library functions enforce on users
+   should be the larger one.
+
+   So, we use the larger of the reported SYMLOOP_MAX (if any) and our
+   own constant MIN_ELOOP_THRESHOLD, below.  This constant should be
+   large enough that it never rules out a file name and directory tree
+   that the underlying system (i.e. calls to 'open' et al) would
+   resolve successfully.  It should be small enough that actual loops
+   are detected without a huge number of iterations.  */
+
+#ifndef MIN_ELOOP_THRESHOLD
+# define MIN_ELOOP_THRESHOLD    40
+#endif
+
+/* Return the maximum number of symlink traversals to permit
+   before diagnosing ELOOP.  */
+static inline unsigned int _GL_ATTRIBUTE_CONST
+__eloop_threshold (void)
+{
+#ifdef SYMLOOP_MAX
+  const int symloop_max = SYMLOOP_MAX;
+#else
+  /* The function is marked 'const' even though we use memory and
+     call a function, because sysconf is required to return the
+     same value in every call and so it must always be safe to
+     call __eloop_threshold exactly once and reuse the value.  */
+  static long int sysconf_symloop_max;
+  if (sysconf_symloop_max == 0)
+    sysconf_symloop_max = __sysconf (_SC_SYMLOOP_MAX);
+  const unsigned int symloop_max = (sysconf_symloop_max <= 0
+                                    ? _POSIX_SYMLOOP_MAX
+                                    : sysconf_symloop_max);
+#endif
+
+  return MAX (symloop_max, MIN_ELOOP_THRESHOLD);
+}
+
+#endif  /* eloop-threshold.h */
deleted file mode 120000 (symlink)
index c1a7820ed6b208b13ff128d6b0997cae911bffe3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/errno.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aa658e627083bea966de3e97a76a63e1c49898d4
--- /dev/null
@@ -0,0 +1,279 @@
+/* A POSIX-like <errno.h>.
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_ERRNO_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
+
+#ifndef _@GUARD_PREFIX@_ERRNO_H
+#define _@GUARD_PREFIX@_ERRNO_H
+
+
+/* On native Windows platforms, many macros are not defined.  */
+# if defined _WIN32 && ! defined __CYGWIN__
+
+/* These are the same values as defined by MSVC 10, for interoperability.  */
+
+#  ifndef ENOMSG
+#   define ENOMSG    122
+#   define GNULIB_defined_ENOMSG 1
+#  endif
+
+#  ifndef EIDRM
+#   define EIDRM     111
+#   define GNULIB_defined_EIDRM 1
+#  endif
+
+#  ifndef ENOLINK
+#   define ENOLINK   121
+#   define GNULIB_defined_ENOLINK 1
+#  endif
+
+#  ifndef EPROTO
+#   define EPROTO    134
+#   define GNULIB_defined_EPROTO 1
+#  endif
+
+#  ifndef EBADMSG
+#   define EBADMSG   104
+#   define GNULIB_defined_EBADMSG 1
+#  endif
+
+#  ifndef EOVERFLOW
+#   define EOVERFLOW 132
+#   define GNULIB_defined_EOVERFLOW 1
+#  endif
+
+#  ifndef ENOTSUP
+#   define ENOTSUP   129
+#   define GNULIB_defined_ENOTSUP 1
+#  endif
+
+#  ifndef ENETRESET
+#   define ENETRESET 117
+#   define GNULIB_defined_ENETRESET 1
+#  endif
+
+#  ifndef ECONNABORTED
+#   define ECONNABORTED 106
+#   define GNULIB_defined_ECONNABORTED 1
+#  endif
+
+#  ifndef ECANCELED
+#   define ECANCELED 105
+#   define GNULIB_defined_ECANCELED 1
+#  endif
+
+#  ifndef EOWNERDEAD
+#   define EOWNERDEAD 133
+#   define GNULIB_defined_EOWNERDEAD 1
+#  endif
+
+#  ifndef ENOTRECOVERABLE
+#   define ENOTRECOVERABLE 127
+#   define GNULIB_defined_ENOTRECOVERABLE 1
+#  endif
+
+#  ifndef EINPROGRESS
+#   define EINPROGRESS     112
+#   define EALREADY        103
+#   define ENOTSOCK        128
+#   define EDESTADDRREQ    109
+#   define EMSGSIZE        115
+#   define EPROTOTYPE      136
+#   define ENOPROTOOPT     123
+#   define EPROTONOSUPPORT 135
+#   define EOPNOTSUPP      130
+#   define EAFNOSUPPORT    102
+#   define EADDRINUSE      100
+#   define EADDRNOTAVAIL   101
+#   define ENETDOWN        116
+#   define ENETUNREACH     118
+#   define ECONNRESET      108
+#   define ENOBUFS         119
+#   define EISCONN         113
+#   define ENOTCONN        126
+#   define ETIMEDOUT       138
+#   define ECONNREFUSED    107
+#   define ELOOP           114
+#   define EHOSTUNREACH    110
+#   define EWOULDBLOCK     140
+#   define GNULIB_defined_ESOCK 1
+#  endif
+
+#  ifndef ETXTBSY
+#   define ETXTBSY         139
+#   define ENODATA         120  /* not required by POSIX */
+#   define ENOSR           124  /* not required by POSIX */
+#   define ENOSTR          125  /* not required by POSIX */
+#   define ETIME           137  /* not required by POSIX */
+#   define EOTHER          131  /* not required by POSIX */
+#   define GNULIB_defined_ESTREAMS 1
+#  endif
+
+/* These are intentionally the same values as the WSA* error numbers, defined
+   in <winsock2.h>.  */
+#  define ESOCKTNOSUPPORT 10044  /* not required by POSIX */
+#  define EPFNOSUPPORT    10046  /* not required by POSIX */
+#  define ESHUTDOWN       10058  /* not required by POSIX */
+#  define ETOOMANYREFS    10059  /* not required by POSIX */
+#  define EHOSTDOWN       10064  /* not required by POSIX */
+#  define EPROCLIM        10067  /* not required by POSIX */
+#  define EUSERS          10068  /* not required by POSIX */
+#  define EDQUOT          10069
+#  define ESTALE          10070
+#  define EREMOTE         10071  /* not required by POSIX */
+#  define GNULIB_defined_EWINSOCK 1
+
+# endif
+
+
+/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
+   EMULTIHOP, ENOLINK, EOVERFLOW are not defined.  */
+# if @EMULTIHOP_HIDDEN@
+#  define EMULTIHOP @EMULTIHOP_VALUE@
+#  define GNULIB_defined_EMULTIHOP 1
+# endif
+# if @ENOLINK_HIDDEN@
+#  define ENOLINK   @ENOLINK_VALUE@
+#  define GNULIB_defined_ENOLINK 1
+# endif
+# if @EOVERFLOW_HIDDEN@
+#  define EOVERFLOW @EOVERFLOW_VALUE@
+#  define GNULIB_defined_EOVERFLOW 1
+# endif
+
+
+/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
+   EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
+   Likewise, on NonStop Kernel, EDQUOT is not defined.
+   Define them here.  Values >= 2000 seem safe to use: Solaris ESTALE = 151,
+   HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
+
+   Note: When one of these systems defines some of these macros some day,
+   binaries will have to be recompiled so that they recognizes the new
+   errno values from the system.  */
+
+# ifndef ENOMSG
+#  define ENOMSG    2000
+#  define GNULIB_defined_ENOMSG 1
+# endif
+
+# ifndef EIDRM
+#  define EIDRM     2001
+#  define GNULIB_defined_EIDRM 1
+# endif
+
+# ifndef ENOLINK
+#  define ENOLINK   2002
+#  define GNULIB_defined_ENOLINK 1
+# endif
+
+# ifndef EPROTO
+#  define EPROTO    2003
+#  define GNULIB_defined_EPROTO 1
+# endif
+
+# ifndef EMULTIHOP
+#  define EMULTIHOP 2004
+#  define GNULIB_defined_EMULTIHOP 1
+# endif
+
+# ifndef EBADMSG
+#  define EBADMSG   2005
+#  define GNULIB_defined_EBADMSG 1
+# endif
+
+# ifndef EOVERFLOW
+#  define EOVERFLOW 2006
+#  define GNULIB_defined_EOVERFLOW 1
+# endif
+
+# ifndef ENOTSUP
+#  define ENOTSUP   2007
+#  define GNULIB_defined_ENOTSUP 1
+# endif
+
+# ifndef ENETRESET
+#  define ENETRESET 2011
+#  define GNULIB_defined_ENETRESET 1
+# endif
+
+# ifndef ECONNABORTED
+#  define ECONNABORTED 2012
+#  define GNULIB_defined_ECONNABORTED 1
+# endif
+
+# ifndef ESTALE
+#  define ESTALE    2009
+#  define GNULIB_defined_ESTALE 1
+# endif
+
+# ifndef EDQUOT
+#  define EDQUOT 2010
+#  define GNULIB_defined_EDQUOT 1
+# endif
+
+# ifndef ECANCELED
+#  define ECANCELED 2008
+#  define GNULIB_defined_ECANCELED 1
+# endif
+
+/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not
+   defined.  */
+
+# ifndef EOWNERDEAD
+#  if defined __sun
+    /* Use the same values as defined for Solaris >= 8, for
+       interoperability.  */
+#   define EOWNERDEAD      58
+#   define ENOTRECOVERABLE 59
+#  elif defined _WIN32 && ! defined __CYGWIN__
+    /* We have a conflict here: pthreads-win32 defines these values
+       differently than MSVC 10.  It's hairy to decide which one to use.  */
+#   if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
+     /* Use the same values as defined by pthreads-win32, for
+        interoperability.  */
+#    define EOWNERDEAD      43
+#    define ENOTRECOVERABLE 44
+#   else
+     /* Use the same values as defined by MSVC 10, for
+        interoperability.  */
+#    define EOWNERDEAD      133
+#    define ENOTRECOVERABLE 127
+#   endif
+#  else
+#   define EOWNERDEAD      2013
+#   define ENOTRECOVERABLE 2014
+#  endif
+#  define GNULIB_defined_EOWNERDEAD 1
+#  define GNULIB_defined_ENOTRECOVERABLE 1
+# endif
+
+# ifndef EILSEQ
+#  define EILSEQ 2015
+#  define GNULIB_defined_EILSEQ 1
+# endif
+
+#endif /* _@GUARD_PREFIX@_ERRNO_H */
+#endif /* _@GUARD_PREFIX@_ERRNO_H */
deleted file mode 120000 (symlink)
index 5916d7dfc6cdda69e519e99fe8dfe78720dcc724..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/error.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c53dfeb60da31e87e8770ed2a14f15bd86771e15
--- /dev/null
@@ -0,0 +1,410 @@
+/* Error handler for noninteractive utilities
+   Copyright (C) 1990-1998, 2000-2007, 2009-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */
+
+#if !_LIBC
+# include <config.h>
+# define _GL_NO_INLINE_ERROR
+#endif
+
+#include <error.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !_LIBC && ENABLE_NLS
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+# include <stdbool.h>
+# include <stdint.h>
+# include <wchar.h>
+# define mbsrtowcs __mbsrtowcs
+# define USE_UNLOCKED_IO 0
+# define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(a, b)
+# define _GL_ARG_NONNULL(a)
+#endif
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+#ifndef _
+# define _(String) String
+#endif
+
+/* If NULL, error will flush stdout, then print on stderr the program
+   name, a colon and a space.  Otherwise, error will call this
+   function without parameters instead.  */
+void (*error_print_progname) (void);
+
+/* This variable is incremented each time 'error' is called.  */
+unsigned int error_message_count;
+
+#ifdef _LIBC
+/* In the GNU C library, there is a predefined variable for this.  */
+
+# define program_name program_invocation_name
+# include <errno.h>
+# include <limits.h>
+# include <libio/libioP.h>
+
+/* In GNU libc we want do not want to use the common name 'error' directly.
+   Instead make it a weak alias.  */
+extern void __error (int status, int errnum, const char *message, ...)
+     __attribute__ ((__format__ (__printf__, 3, 4)));
+extern void __error_at_line (int status, int errnum, const char *file_name,
+                             unsigned int line_number, const char *message,
+                             ...)
+     __attribute__ ((__format__ (__printf__, 5, 6)));
+# define error __error
+# define error_at_line __error_at_line
+
+# include <libio/iolibio.h>
+# define fflush(s) _IO_fflush (s)
+# undef putc
+# define putc(c, fp) _IO_putc (c, fp)
+
+# include <bits/libc-lock.h>
+
+#else /* not _LIBC */
+
+# include <fcntl.h>
+# include <unistd.h>
+
+# if defined _WIN32 && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions.  */
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+/* Get _get_osfhandle.  */
+#  if GNULIB_MSVC_NOTHROW
+#   include "msvc-nothrow.h"
+#  else
+#   include <io.h>
+#  endif
+# endif
+
+/* The gnulib override of fcntl is not needed in this file.  */
+# undef fcntl
+
+# if !(GNULIB_STRERROR_R_POSIX || HAVE_DECL_STRERROR_R)
+#  ifndef HAVE_DECL_STRERROR_R
+"this configure-time declaration test was not run"
+#  endif
+#  if STRERROR_R_CHAR_P
+char *strerror_r (int errnum, char *buf, size_t buflen);
+#  else
+int strerror_r (int errnum, char *buf, size_t buflen);
+#  endif
+# endif
+
+# define program_name getprogname ()
+
+# if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r
+#  define __strerror_r strerror_r
+# endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */
+#endif  /* not _LIBC */
+
+#if !_LIBC
+/* Return non-zero if FD is open.  */
+static int
+is_open (int fd)
+{
+# if defined _WIN32 && ! defined __CYGWIN__
+  /* On native Windows: The initial state of unassigned standard file
+     descriptors is that they are open but point to an INVALID_HANDLE_VALUE.
+     There is no fcntl, and the gnulib replacement fcntl does not support
+     F_GETFL.  */
+  return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+# else
+#  ifndef F_GETFL
+#   error Please port fcntl to your platform
+#  endif
+  return 0 <= fcntl (fd, F_GETFL);
+# endif
+}
+#endif
+
+static void
+flush_stdout (void)
+{
+#if !_LIBC
+  int stdout_fd;
+
+# if GNULIB_FREOPEN_SAFER
+  /* Use of gnulib's freopen-safer module normally ensures that
+       fileno (stdout) == 1
+     whenever stdout is open.  */
+  stdout_fd = STDOUT_FILENO;
+# else
+  /* POSIX states that fileno (stdout) after fclose is unspecified.  But in
+     practice it is not a problem, because stdout is statically allocated and
+     the fd of a FILE stream is stored as a field in its allocated memory.  */
+  stdout_fd = fileno (stdout);
+# endif
+  /* POSIX states that fflush (stdout) after fclose is unspecified; it
+     is safe in glibc, but not on all other platforms.  fflush (NULL)
+     is always defined, but too draconian.  */
+  if (0 <= stdout_fd && is_open (stdout_fd))
+#endif
+    fflush (stdout);
+}
+
+static void
+print_errno_message (int errnum)
+{
+  char const *s;
+
+#if _LIBC || GNULIB_STRERROR_R_POSIX || defined HAVE_STRERROR_R
+  char errbuf[1024];
+# if _LIBC || (!GNULIB_STRERROR_R_POSIX && STRERROR_R_CHAR_P)
+  s = __strerror_r (errnum, errbuf, sizeof errbuf);
+# else
+  if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
+    s = errbuf;
+  else
+    s = 0;
+# endif
+#else
+  s = strerror (errnum);
+#endif
+
+#if !_LIBC
+  if (! s)
+    s = _("Unknown system error");
+#endif
+
+#if _LIBC
+  __fxprintf (NULL, ": %s", s);
+#else
+  fprintf (stderr, ": %s", s);
+#endif
+}
+
+static void _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3))
+error_tail (int status, int errnum, const char *message, va_list args)
+{
+#if _LIBC
+  if (_IO_fwide (stderr, 0) > 0)
+    {
+      size_t len = strlen (message) + 1;
+      wchar_t *wmessage = NULL;
+      mbstate_t st;
+      size_t res;
+      const char *tmp;
+      bool use_malloc = false;
+
+      while (1)
+        {
+          if (__libc_use_alloca (len * sizeof (wchar_t)))
+            wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
+          else
+            {
+              if (!use_malloc)
+                wmessage = NULL;
+
+              wchar_t *p = (wchar_t *) realloc (wmessage,
+                                                len * sizeof (wchar_t));
+              if (p == NULL)
+                {
+                  free (wmessage);
+                  fputws_unlocked (L"out of memory\n", stderr);
+                  return;
+                }
+              wmessage = p;
+              use_malloc = true;
+            }
+
+          memset (&st, '\0', sizeof (st));
+          tmp = message;
+
+          res = mbsrtowcs (wmessage, &tmp, len, &st);
+          if (res != len)
+            break;
+
+          if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0))
+            {
+              /* This really should not happen if everything is fine.  */
+              res = (size_t) -1;
+              break;
+            }
+
+          len *= 2;
+        }
+
+      if (res == (size_t) -1)
+        {
+          /* The string cannot be converted.  */
+          if (use_malloc)
+            {
+              free (wmessage);
+              use_malloc = false;
+            }
+          wmessage = (wchar_t *) L"???";
+        }
+
+      __vfwprintf (stderr, wmessage, args);
+
+      if (use_malloc)
+        free (wmessage);
+    }
+  else
+#endif
+    vfprintf (stderr, message, args);
+
+  ++error_message_count;
+  if (errnum)
+    print_errno_message (errnum);
+#if _LIBC
+  __fxprintf (NULL, "\n");
+#else
+  putc ('\n', stderr);
+#endif
+  fflush (stderr);
+  if (status)
+    exit (status);
+}
+
+
+/* Print the program name and error message MESSAGE, which is a printf-style
+   format string with optional args.
+   If ERRNUM is nonzero, print its corresponding system error message.
+   Exit with status STATUS if it is nonzero.  */
+void
+error (int status, int errnum, const char *message, ...)
+{
+  va_list args;
+
+#if defined _LIBC && defined __libc_ptf_call
+  /* We do not want this call to be cut short by a thread
+     cancellation.  Therefore disable cancellation for now.  */
+  int state = PTHREAD_CANCEL_ENABLE;
+  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
+                   0);
+#endif
+
+  flush_stdout ();
+#ifdef _LIBC
+  _IO_flockfile (stderr);
+#endif
+  if (error_print_progname)
+    (*error_print_progname) ();
+  else
+    {
+#if _LIBC
+      __fxprintf (NULL, "%s: ", program_name);
+#else
+      fprintf (stderr, "%s: ", program_name);
+#endif
+    }
+
+  va_start (args, message);
+  error_tail (status, errnum, message, args);
+  va_end (args);
+
+#ifdef _LIBC
+  _IO_funlockfile (stderr);
+# ifdef __libc_ptf_call
+  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+# endif
+#endif
+}
+\f
+/* Sometimes we want to have at most one error per line.  This
+   variable controls whether this mode is selected or not.  */
+int error_one_per_line;
+
+void
+error_at_line (int status, int errnum, const char *file_name,
+               unsigned int line_number, const char *message, ...)
+{
+  va_list args;
+
+  if (error_one_per_line)
+    {
+      static const char *old_file_name;
+      static unsigned int old_line_number;
+
+      if (old_line_number == line_number
+          && (file_name == old_file_name
+              || (old_file_name != NULL
+                  && file_name != NULL
+                  && strcmp (old_file_name, file_name) == 0)))
+
+        /* Simply return and print nothing.  */
+        return;
+
+      old_file_name = file_name;
+      old_line_number = line_number;
+    }
+
+#if defined _LIBC && defined __libc_ptf_call
+  /* We do not want this call to be cut short by a thread
+     cancellation.  Therefore disable cancellation for now.  */
+  int state = PTHREAD_CANCEL_ENABLE;
+  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
+                   0);
+#endif
+
+  flush_stdout ();
+#ifdef _LIBC
+  _IO_flockfile (stderr);
+#endif
+  if (error_print_progname)
+    (*error_print_progname) ();
+  else
+    {
+#if _LIBC
+      __fxprintf (NULL, "%s:", program_name);
+#else
+      fprintf (stderr, "%s:", program_name);
+#endif
+    }
+
+#if _LIBC
+  __fxprintf (NULL, file_name != NULL ? "%s:%u: " : " ",
+              file_name, line_number);
+#else
+  fprintf (stderr, file_name != NULL ? "%s:%u: " : " ",
+           file_name, line_number);
+#endif
+
+  va_start (args, message);
+  error_tail (status, errnum, message, args);
+  va_end (args);
+
+#ifdef _LIBC
+  _IO_funlockfile (stderr);
+# ifdef __libc_ptf_call
+  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+# endif
+#endif
+}
+
+#ifdef _LIBC
+/* Make the weak alias.  */
+# undef error
+# undef error_at_line
+weak_alias (__error, error)
+weak_alias (__error_at_line, error_at_line)
+#endif
deleted file mode 120000 (symlink)
index 03272940a3343516fb2913311571cff01dab4f15..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/error.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..51f8cafd10539df4277cf0fd12fc261ba79668ad
--- /dev/null
@@ -0,0 +1,216 @@
+/* Declarations for error-reporting functions.
+   Copyright (C) 1995-1997, 2003, 2006, 2008-2024 Free Software Foundation,
+   Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_ERROR_H
+
+/* No @PRAGMA_SYSTEM_HEADER@ here, because it would prevent
+   -Wimplicit-fallthrough warnings for missing FALLTHROUGH after error(...)
+   or error_at_line(...) invocations.  */
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_ERROR_H@
+# @INCLUDE_NEXT@ @NEXT_ERROR_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_ERROR_H
+#define _@GUARD_PREFIX@_ERROR_H
+
+/* This file uses _GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_FORMAT,
+  _GL_ATTRIBUTE_MAYBE_UNUSED.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get 'unreachable'.  */
+#include <stddef.h>
+
+/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM.  */
+#include <stdio.h>
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+#if GNULIB_VFPRINTF_POSIX
+# define _GL_ATTRIBUTE_SPEC_PRINTF_ERROR _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD
+#else
+# define _GL_ATTRIBUTE_SPEC_PRINTF_ERROR _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM
+#endif
+
+/* Helper macro for supporting the compiler's control flow analysis better.
+   It evaluates its arguments only once.
+   Test case: Compile copy-file.c with "gcc -Wimplicit-fallthrough".  */
+#if defined __GNUC__ || defined __clang__
+/* Use 'unreachable' to tell the compiler when the function call does not
+   return.  */
+# define __gl_error_call1(function, status, ...) \
+    ((function) (status, __VA_ARGS__), \
+     (status) != 0 ? unreachable () : (void) 0)
+/* If STATUS is a not a constant, the function call may or may not return;
+   therefore -Wimplicit-fallthrough will produce a warning.  Use a compound
+   statement in order to evaluate STATUS only once.
+   If STATUS is a constant, we don't use a compound statement, because that
+   would trigger a -Wimplicit-fallthrough warning even when STATUS is != 0,
+   when not optimizing.  This causes STATUS to be evaluated twice, but
+   that's OK since it does not have side effects.  */
+# define __gl_error_call(function, status, ...)                 \
+    (__builtin_constant_p (status)                              \
+     ? __gl_error_call1 (function, status, __VA_ARGS__)         \
+     : __extension__                                            \
+       ({                                                       \
+         int const __errstatus = status;                        \
+         __gl_error_call1 (function, __errstatus, __VA_ARGS__); \
+       }))
+#else
+# define __gl_error_call(function, status, ...) \
+    (function) (status, __VA_ARGS__)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Print a message with 'fprintf (stderr, FORMAT, ...)';
+   if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+   If STATUS is nonzero, terminate the program with 'exit (STATUS)'.  */
+#if @REPLACE_ERROR@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef error
+#  define error rpl_error
+# endif
+_GL_FUNCDECL_RPL (error, void,
+                  (int __status, int __errnum, const char *__format, ...)
+                  _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4)));
+_GL_CXXALIAS_RPL (error, void,
+                  (int __status, int __errnum, const char *__format, ...));
+# ifndef _GL_NO_INLINE_ERROR
+#  undef error
+#  define error(status, ...) \
+     __gl_error_call (rpl_error, status, __VA_ARGS__)
+# endif
+#else
+# if ! @HAVE_ERROR@
+_GL_FUNCDECL_SYS (error, void,
+                  (int __status, int __errnum, const char *__format, ...)
+                  _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4)));
+# endif
+_GL_CXXALIAS_SYS (error, void,
+                  (int __status, int __errnum, const char *__format, ...));
+# ifndef _GL_NO_INLINE_ERROR
+#  ifdef error
+/* Only gcc ≥ 4.7 has __builtin_va_arg_pack.  */
+#   if _GL_GNUC_PREREQ (4, 7)
+#    pragma GCC diagnostic push
+#    pragma GCC diagnostic ignored "-Wattributes"
+_GL_ATTRIBUTE_MAYBE_UNUSED
+static void
+_GL_ATTRIBUTE_ALWAYS_INLINE
+_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4))
+_gl_inline_error (int __status, int __errnum, const char *__format, ...)
+{
+  return error (__status, __errnum, __format, __builtin_va_arg_pack ());
+}
+#    pragma GCC diagnostic pop
+#    undef error
+#    define error(status, ...) \
+       __gl_error_call (_gl_inline_error, status, __VA_ARGS__)
+#   endif
+#  else
+#   define error(status, ...) \
+      __gl_error_call (error, status, __VA_ARGS__)
+#  endif
+# endif
+#endif
+#if __GLIBC__ >= 2
+_GL_CXXALIASWARN (error);
+#endif
+
+/* Likewise.  If FILENAME is non-NULL, include FILENAME:LINENO: in the
+   message.  */
+#if @REPLACE_ERROR_AT_LINE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef error_at_line
+#  define error_at_line rpl_error_at_line
+# endif
+_GL_FUNCDECL_RPL (error_at_line, void,
+                  (int __status, int __errnum, const char *__filename,
+                   unsigned int __lineno, const char *__format, ...)
+                  _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6)));
+_GL_CXXALIAS_RPL (error_at_line, void,
+                  (int __status, int __errnum, const char *__filename,
+                   unsigned int __lineno, const char *__format, ...));
+# ifndef _GL_NO_INLINE_ERROR
+#  undef error_at_line
+#  define error_at_line(status, ...) \
+     __gl_error_call (rpl_error_at_line, status, __VA_ARGS__)
+# endif
+#else
+# if ! @HAVE_ERROR_AT_LINE@
+_GL_FUNCDECL_SYS (error_at_line, void,
+                  (int __status, int __errnum, const char *__filename,
+                   unsigned int __lineno, const char *__format, ...)
+                  _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6)));
+# endif
+_GL_CXXALIAS_SYS (error_at_line, void,
+                  (int __status, int __errnum, const char *__filename,
+                   unsigned int __lineno, const char *__format, ...));
+# ifndef _GL_NO_INLINE_ERROR
+#  ifdef error_at_line
+/* Only gcc ≥ 4.7 has __builtin_va_arg_pack.  */
+#   if _GL_GNUC_PREREQ (4, 7)
+#    pragma GCC diagnostic push
+#    pragma GCC diagnostic ignored "-Wattributes"
+_GL_ATTRIBUTE_MAYBE_UNUSED
+static void
+_GL_ATTRIBUTE_ALWAYS_INLINE
+_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6))
+_gl_inline_error_at_line (int __status, int __errnum, const char *__filename,
+                          unsigned int __lineno, const char *__format, ...)
+{
+  return error_at_line (__status, __errnum, __filename, __lineno, __format,
+                        __builtin_va_arg_pack ());
+}
+#    pragma GCC diagnostic pop
+#    undef error_at_line
+#    define error_at_line(status, ...) \
+       __gl_error_call (_gl_inline_error_at_line, status, __VA_ARGS__)
+#   endif
+#  else
+#   define error_at_line(status, ...) \
+      __gl_error_call (error_at_line, status, __VA_ARGS__)
+#  endif
+# endif
+#endif
+_GL_CXXALIASWARN (error_at_line);
+
+/* If NULL, error will flush stdout, then print on stderr the program
+   name, a colon and a space.  Otherwise, error will call this
+   function without parameters instead.  */
+extern void (*error_print_progname) (void);
+
+/* This variable is incremented each time 'error' is called.  */
+extern unsigned int error_message_count;
+
+/* Sometimes we want to have at most one error per line.  This
+   variable controls whether this mode is selected or not.  */
+extern int error_one_per_line;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _@GUARD_PREFIX@_ERROR_H */
+#endif /* _@GUARD_PREFIX@_ERROR_H */
deleted file mode 120000 (symlink)
index d0e1f4ffc87aaef8ab94deb32a5c094908173763..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/euidaccess.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ad392dba19cd9adc7de4a180aeaa55de63a389f4
--- /dev/null
@@ -0,0 +1,226 @@
+/* euidaccess -- check if effective user id can access file
+
+   Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2024 Free
+   Software Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David MacKenzie and Torbjorn Granlund.
+   Adapted for GNU C library by Roland McGrath.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#if defined _WIN32 && ! defined __CYGWIN__
+# include <io.h>
+#else
+# include "root-uid.h"
+#endif
+
+#if HAVE_LIBGEN_H
+# include <libgen.h>
+#endif
+
+#include <errno.h>
+#ifndef __set_errno
+# define __set_errno(val) errno = (val)
+#endif
+
+#if defined EACCES && !defined EACCESS
+# define EACCESS EACCES
+#endif
+
+#ifndef F_OK
+# define F_OK 0
+# define X_OK 1
+# define W_OK 2
+# define R_OK 4
+#endif
+
+
+#ifdef _LIBC
+
+# define access __access
+# define getuid __getuid
+# define getgid __getgid
+# define geteuid __geteuid
+# define getegid __getegid
+# define group_member __group_member
+# define euidaccess __euidaccess
+# undef stat
+# define stat stat64
+
+#endif
+
+/* Return 0 if the user has permission of type MODE on FILE;
+   otherwise, return -1 and set 'errno'.
+   Like access, except that it uses the effective user and group
+   id's instead of the real ones, and it does not always check for read-only
+   file system, text busy, etc.  */
+
+int
+euidaccess (const char *file, int mode)
+{
+#if HAVE_FACCESSAT                   /* glibc, AIX 7, Solaris 11, Cygwin 1.7 */
+  return faccessat (AT_FDCWD, file, mode, AT_EACCESS);
+#elif defined EFF_ONLY_OK               /* IRIX, OSF/1, Interix */
+  return access (file, mode | EFF_ONLY_OK);
+#elif defined ACC_SELF                  /* AIX */
+  return accessx (file, mode, ACC_SELF);
+#elif HAVE_EACCESS                      /* FreeBSD */
+  return eaccess (file, mode);
+#elif defined _WIN32 && ! defined __CYGWIN__  /* mingw */
+  return _access (file, mode);
+#else              /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, BeOS */
+
+  uid_t uid = getuid ();
+  gid_t gid = getgid ();
+  uid_t euid = geteuid ();
+  gid_t egid = getegid ();
+  struct stat stats;
+
+# if HAVE_DECL_SETREGID && PREFER_NONREENTRANT_EUIDACCESS
+
+  /* Define PREFER_NONREENTRANT_EUIDACCESS if you prefer euidaccess to
+     return the correct result even if this would make it
+     nonreentrant.  Define this only if your entire application is
+     safe even if the uid or gid might temporarily change.  If your
+     application uses signal handlers or threads it is probably not
+     safe.  */
+
+  if (mode == F_OK)
+    {
+      int result = stat (file, &stats);
+      return result != 0 && errno == EOVERFLOW ? 0 : result;
+    }
+  else
+    {
+      int result;
+      int saved_errno;
+
+      if (uid != euid)
+        setreuid (euid, uid);
+      if (gid != egid)
+        setregid (egid, gid);
+
+      result = access (file, mode);
+      saved_errno = errno;
+
+      /* Restore them.  */
+      if (uid != euid)
+        setreuid (uid, euid);
+      if (gid != egid)
+        setregid (gid, egid);
+
+      errno = saved_errno;
+      return result;
+    }
+
+# else
+
+  /* The following code assumes the traditional Unix model, and is not
+     correct on systems that have ACLs or the like.  However, it's
+     better than nothing, and it is reentrant.  */
+
+  unsigned int granted;
+  if (uid == euid && gid == egid)
+    /* If we are not set-uid or set-gid, access does the same.  */
+    return access (file, mode);
+
+  if (stat (file, &stats) == -1)
+    return mode == F_OK && errno == EOVERFLOW ? 0 : -1;
+
+  /* The super-user can read and write any file, and execute any file
+     that anyone can execute.  */
+  if (euid == ROOT_UID
+      && ((mode & X_OK) == 0
+          || (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
+    return 0;
+
+  /* Convert the mode to traditional form, clearing any bogus bits.  */
+  if (R_OK == 4 && W_OK == 2 && X_OK == 1 && F_OK == 0)
+    mode &= 7;
+  else
+    mode = ((mode & R_OK ? 4 : 0)
+            + (mode & W_OK ? 2 : 0)
+            + (mode & X_OK ? 1 : 0));
+
+  if (mode == 0)
+    return 0;                   /* The file exists.  */
+
+  /* Convert the file's permission bits to traditional form.  */
+  if (S_IRUSR == (4 << 6) && S_IWUSR == (2 << 6) && S_IXUSR == (1 << 6)
+      && S_IRGRP == (4 << 3) && S_IWGRP == (2 << 3) && S_IXGRP == (1 << 3)
+      && S_IROTH == (4 << 0) && S_IWOTH == (2 << 0) && S_IXOTH == (1 << 0))
+    granted = stats.st_mode;
+  else
+    granted = ((stats.st_mode & S_IRUSR ? 4 << 6 : 0)
+               + (stats.st_mode & S_IWUSR ? 2 << 6 : 0)
+               + (stats.st_mode & S_IXUSR ? 1 << 6 : 0)
+               + (stats.st_mode & S_IRGRP ? 4 << 3 : 0)
+               + (stats.st_mode & S_IWGRP ? 2 << 3 : 0)
+               + (stats.st_mode & S_IXGRP ? 1 << 3 : 0)
+               + (stats.st_mode & S_IROTH ? 4 << 0 : 0)
+               + (stats.st_mode & S_IWOTH ? 2 << 0 : 0)
+               + (stats.st_mode & S_IXOTH ? 1 << 0 : 0));
+
+  if (euid == stats.st_uid)
+    granted >>= 6;
+  else if (egid == stats.st_gid || group_member (stats.st_gid))
+    granted >>= 3;
+
+  if ((mode & ~granted) == 0)
+    return 0;
+  __set_errno (EACCESS);
+  return -1;
+
+# endif
+#endif
+}
+#undef euidaccess
+#ifdef weak_alias
+weak_alias (__euidaccess, euidaccess)
+#endif
+\f
+#ifdef TEST
+# include <error.h>
+# include <stdio.h>
+# include <stdlib.h>
+
+int
+main (int argc, char **argv)
+{
+  char *file;
+  int mode;
+  int err;
+
+  if (argc < 3)
+    abort ();
+  file = argv[1];
+  mode = atoi (argv[2]);
+
+  err = euidaccess (file, mode);
+  printf ("%d\n", err);
+  if (err != 0)
+    error (0, errno, "%s", file);
+  exit (0);
+}
+#endif
deleted file mode 120000 (symlink)
index 3d14769be4b336ae2668c4630a5f136f9e407ef9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/exclude.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..568d1ec1c677a87a87757c827311358fa9226e1c
--- /dev/null
@@ -0,0 +1,673 @@
+/* exclude.c -- exclude file names
+
+   Copyright (C) 1992-1994, 1997, 1999-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert <eggert@twinsun.com>
+   and Sergey Poznyakoff <gray@gnu.org>.
+   Thanks to Phil Proudman <phil@proudman51.freeserve.co.uk>
+   for improvement suggestions. */
+
+#include <config.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <regex.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <uchar.h>
+
+#include "exclude.h"
+#include "filename.h"
+#include <fnmatch.h>
+#include "hash.h"
+#if GNULIB_MCEL_PREFER
+# include "mcel.h"
+#else
+# include "mbuiter.h"
+#endif
+#include "xalloc.h"
+
+#if GNULIB_EXCLUDE_SINGLE_THREAD
+# include "unlocked-io.h"
+#endif
+
+/* Non-GNU systems lack these options, so we don't need to check them.  */
+#ifndef FNM_CASEFOLD
+# define FNM_CASEFOLD 0
+#endif
+#ifndef FNM_EXTMATCH
+# define FNM_EXTMATCH 0
+#endif
+#ifndef FNM_LEADING_DIR
+# define FNM_LEADING_DIR 0
+#endif
+
+static_assert (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS)
+                & (FNM_PATHNAME | FNM_NOESCAPE | FNM_PERIOD | FNM_LEADING_DIR
+                   | FNM_CASEFOLD | FNM_EXTMATCH))
+               == 0);
+
+
+/* Exclusion patterns are grouped into a singly-linked list of
+   "exclusion segments".  Each segment represents a set of patterns
+   that can be matches using the same algorithm.  Non-wildcard
+   patterns are kept in hash tables, to speed up searches.  Wildcard
+   patterns are stored as arrays of patterns. */
+
+
+/* An exclude pattern-options pair.  The options are fnmatch options
+   ORed with EXCLUDE_* options.  */
+
+struct patopts
+  {
+    int options;
+    union
+    {
+      char const *pattern;
+      regex_t re;
+    } v;
+  };
+
+/* An array of pattern-options pairs.  */
+
+struct exclude_pattern
+  {
+    struct patopts *exclude;
+    idx_t exclude_alloc;
+    idx_t exclude_count;
+  };
+
+enum exclude_type
+  {
+    exclude_hash,                    /* a hash table of excluded names */
+    exclude_pattern                  /* an array of exclude patterns */
+  };
+
+struct exclude_segment
+  {
+    struct exclude_segment *next;    /* next segment in list */
+    enum exclude_type type;          /* type of this segment */
+    int options;                     /* common options for this segment */
+    union
+    {
+      Hash_table *table;             /* for type == exclude_hash */
+      struct exclude_pattern pat;    /* for type == exclude_pattern */
+    } v;
+  };
+
+struct pattern_buffer
+  {
+    struct pattern_buffer *next;
+    char *base;
+  };
+
+/* The exclude structure keeps a singly-linked list of exclude segments,
+   maintained in reverse order.  */
+struct exclude
+  {
+    struct exclude_segment *head;
+    struct pattern_buffer *patbuf;
+  };
+
+/* Register BUF in the pattern buffer list of EX.  ADD_FUNC (see
+   add_exclude_file and add_exclude_fp below) can use this function
+   if it modifies the pattern, to ensure the allocated memory will be
+   properly reclaimed upon calling free_exclude. */
+void
+exclude_add_pattern_buffer (struct exclude *ex, char *buf)
+{
+  struct pattern_buffer *pbuf = xmalloc (sizeof *pbuf);
+  pbuf->base = buf;
+  pbuf->next = ex->patbuf;
+  ex->patbuf = pbuf;
+}
+
+/* Return true if STR has or may have wildcards, when matched with OPTIONS.
+   Return false if STR definitely does not have wildcards.  */
+bool
+fnmatch_pattern_has_wildcards (const char *str, int options)
+{
+  while (true)
+    {
+      switch (*str++)
+        {
+        case '.':
+        case '{':
+        case '}':
+        case '(':
+        case ')':
+          if (options & EXCLUDE_REGEX)
+            return true;
+          break;
+
+        case '\\':
+          if (options & EXCLUDE_REGEX)
+            continue;
+          else
+            str += ! (options & FNM_NOESCAPE) && *str;
+          break;
+
+        case '+': case '@': case '!':
+          if (options & FNM_EXTMATCH && *str == '(')
+            return true;
+          break;
+
+        case '?': case '*': case '[':
+          return true;
+
+        case '\0':
+          return false;
+        }
+    }
+}
+
+static void
+unescape_pattern (char *str)
+{
+  char const *q = str;
+  do
+    q += *q == '\\' && q[1];
+  while ((*str++ = *q++));
+}
+
+/* Return a newly allocated and empty exclude list.  */
+
+struct exclude *
+new_exclude (void)
+{
+  return xzalloc (sizeof *new_exclude ());
+}
+
+/* Calculate the hash of string.  */
+static size_t
+string_hasher (void const *data, size_t n_buckets)
+{
+  return hash_string (data, n_buckets);
+}
+
+/* Ditto, for case-insensitive hashes */
+static size_t
+string_hasher_ci (void const *data, size_t n_buckets)
+{
+  char const *p = data;
+  size_t value = 0;
+
+#if GNULIB_MCEL_PREFER
+  while (*p)
+    {
+      mcel_t g = mcel_scanz (p);
+      value = value * 31 + (c32tolower (g.ch) - g.err);
+      p += g.len;
+    }
+#else
+  mbui_iterator_t iter;
+
+  for (mbui_init (iter, p); mbui_avail (iter); mbui_advance (iter))
+    {
+      mbchar_t m = mbui_cur (iter);
+      char32_t wc;
+
+      if (m.wc_valid)
+        wc = c32tolower (m.wc);
+      else
+        wc = *m.ptr;
+
+      value = value * 31 + wc;
+    }
+#endif
+
+  return value % n_buckets;
+}
+
+/* compare two strings for equality */
+static bool
+string_compare (void const *data1, void const *data2)
+{
+  return strcmp (data1, data2) == 0;
+}
+
+/* compare two strings for equality, case-insensitive */
+static bool
+string_compare_ci (void const *data1, void const *data2)
+{
+  return mbscasecmp (data1, data2) == 0;
+}
+
+/* Create new exclude segment of given TYPE and OPTIONS, and attach it
+   to the head of EX.  */
+static void
+new_exclude_segment (struct exclude *ex, enum exclude_type type, int options)
+{
+  struct exclude_segment *sp = xmalloc (sizeof (struct exclude_segment));
+  sp->type = type;
+  sp->options = options;
+  switch (type)
+    {
+    case exclude_pattern:
+      sp->v.pat = (struct exclude_pattern) {0};
+      break;
+
+    case exclude_hash:
+      sp->v.table = hash_initialize (0, nullptr,
+                                     (options & FNM_CASEFOLD
+                                      ? string_hasher_ci
+                                      : string_hasher),
+                                     (options & FNM_CASEFOLD
+                                      ? string_compare_ci
+                                      : string_compare),
+                                     free);
+      break;
+    }
+  sp->next = ex->head;
+  ex->head = sp;
+}
+
+/* Free a single exclude segment */
+static void
+free_exclude_segment (struct exclude_segment *seg)
+{
+  switch (seg->type)
+    {
+    case exclude_pattern:
+      for (idx_t i = 0; i < seg->v.pat.exclude_count; i++)
+        if (seg->v.pat.exclude[i].options & EXCLUDE_REGEX)
+          regfree (&seg->v.pat.exclude[i].v.re);
+      free (seg->v.pat.exclude);
+      break;
+
+    case exclude_hash:
+      hash_free (seg->v.table);
+      break;
+    }
+  free (seg);
+}
+
+/* Free the storage associated with an exclude list.  */
+void
+free_exclude (struct exclude *ex)
+{
+  for (struct exclude_segment *seg = ex->head; seg; )
+    {
+      struct exclude_segment *next = seg->next;
+      free_exclude_segment (seg);
+      seg = next;
+    }
+
+  for (struct pattern_buffer *pbuf = ex->patbuf; pbuf; )
+    {
+      struct pattern_buffer *next = pbuf->next;
+      free (pbuf->base);
+      free (pbuf);
+      pbuf = next;
+    }
+
+  free (ex);
+}
+
+/* Return zero if PATTERN matches F, obeying OPTIONS, except that
+   (unlike fnmatch) wildcards are disabled in PATTERN.  */
+
+static int
+fnmatch_no_wildcards (char const *pattern, char const *f, int options)
+{
+  if (! (options & FNM_LEADING_DIR))
+    return ((options & FNM_CASEFOLD)
+            ? mbscasecmp (pattern, f)
+            : strcmp (pattern, f));
+  else if (! (options & FNM_CASEFOLD))
+    {
+      idx_t patlen = strlen (pattern);
+      int r = strncmp (pattern, f, patlen);
+      if (! r)
+        {
+          r = f[patlen];
+          if (r == '/')
+            r = 0;
+        }
+      return r;
+    }
+  else
+    {
+      /* Walk through a copy of F, seeing whether P matches any prefix
+         of F.
+
+         FIXME: This is an O(N**2) algorithm; it should be O(N).
+         Also, the copy should not be necessary.  However, fixing this
+         will probably involve a change to the mbs* API.  */
+
+      char *fcopy = xstrdup (f);
+      int r;
+      for (char *p = fcopy; ; *p++ = '/')
+        {
+          p = strchr (p, '/');
+          if (p)
+            *p = '\0';
+          r = mbscasecmp (pattern, fcopy);
+          if (!p || r <= 0)
+            break;
+        }
+      free (fcopy);
+      return r;
+    }
+}
+
+bool
+exclude_fnmatch (char const *pattern, char const *f, int options)
+{
+  int (*matcher) (char const *, char const *, int) =
+    (options & EXCLUDE_WILDCARDS
+     ? fnmatch
+     : fnmatch_no_wildcards);
+  bool matched = matcher (pattern, f, options) == 0;
+
+  if (! (options & EXCLUDE_ANCHORED))
+    for (char const *p = f; *p && ! matched; p++)
+      if (*p == '/' && p[1] != '/')
+        matched = matcher (pattern, p + 1, options) == 0;
+
+  return matched;
+}
+
+static bool
+exclude_patopts (struct patopts const *opts, char const *f)
+{
+  int options = opts->options;
+
+  return (options & EXCLUDE_REGEX
+          ? regexec (&opts->v.re, f, 0, nullptr, 0) == 0
+          : exclude_fnmatch (opts->v.pattern, f, options));
+}
+
+/* Return true if the exclude_pattern segment SEG matches F.  */
+
+static bool
+file_pattern_matches (struct exclude_segment const *seg, char const *f)
+{
+  idx_t exclude_count = seg->v.pat.exclude_count;
+  struct patopts const *exclude = seg->v.pat.exclude;
+
+  for (idx_t i = 0; i < exclude_count; i++)
+    if (exclude_patopts (exclude + i, f))
+      return true;
+  return false;
+}
+
+/* Return true if the exclude_hash segment SEG matches F.
+   BUFFER is an auxiliary storage of the same length as F (with nul
+   terminator included) */
+static bool
+file_name_matches (struct exclude_segment const *seg, char const *f,
+                   char *buffer)
+{
+  int options = seg->options;
+  Hash_table *table = seg->v.table;
+
+  do
+    {
+      /* initialize the pattern */
+      strcpy (buffer, f);
+
+      while (true)
+        {
+          if (hash_lookup (table, buffer))
+            return true;
+          if (options & FNM_LEADING_DIR)
+            {
+              char *p = strrchr (buffer, '/');
+              if (p)
+                {
+                  *p = '\0';
+                  continue;
+                }
+            }
+          break;
+        }
+
+      if (!(options & EXCLUDE_ANCHORED))
+        {
+          f = strchr (f, '/');
+          if (f)
+            f++;
+        }
+      else
+        break;
+    }
+  while (f);
+
+  return false;
+}
+
+/* Return true if EX excludes F.  */
+
+bool
+excluded_file_name (struct exclude const *ex, char const *f)
+{
+  /* If no patterns are given, the default is to include.  */
+  if (!ex->head)
+    return false;
+
+  bool invert = false;
+  char *filename = nullptr;
+
+  /* Scan through the segments, reporting the status of the first match.
+     The segments are in reverse order, so this reports the status of
+     the last match in the original option list.  */
+  struct exclude_segment *seg;
+  for (seg = ex->head; ; seg = seg->next)
+    {
+      if (seg->type == exclude_hash)
+        {
+          if (!filename)
+            filename = xmalloc (strlen (f) + 1);
+          if (file_name_matches (seg, f, filename))
+            break;
+        }
+      else
+        {
+          if (file_pattern_matches (seg, f))
+            break;
+        }
+
+      if (! seg->next)
+        {
+          /* If patterns are given but none match, the default is the
+             opposite of the last segment (i.e., the first in the
+             original option list).  For example, in the command
+             'grep -r --exclude="a*" --include="*b" pat dir', the
+             first option is --exclude so any file name matching
+             neither a* nor *b is included.  */
+          invert = true;
+          break;
+        }
+    }
+
+  free (filename);
+  return invert ^ ! (seg->options & EXCLUDE_INCLUDE);
+}
+
+/* Append to EX the exclusion PATTERN with OPTIONS.  */
+
+void
+add_exclude (struct exclude *ex, char const *pattern, int options)
+{
+  if ((options & (EXCLUDE_REGEX|EXCLUDE_WILDCARDS))
+      && fnmatch_pattern_has_wildcards (pattern, options))
+    {
+      if (! (ex->head && ex->head->type == exclude_pattern
+             && ((ex->head->options & EXCLUDE_INCLUDE)
+                 == (options & EXCLUDE_INCLUDE))))
+        new_exclude_segment (ex, exclude_pattern, options);
+
+      struct exclude_pattern *pat = &ex->head->v.pat;
+      if (pat->exclude_count == pat->exclude_alloc)
+        pat->exclude = xpalloc (pat->exclude, &pat->exclude_alloc, 1, -1,
+                                sizeof *pat->exclude);
+      struct patopts *patopts = &pat->exclude[pat->exclude_count++];
+
+      patopts->options = options;
+      if (options & EXCLUDE_REGEX)
+        {
+          int rc;
+          int cflags = (REG_NOSUB | REG_EXTENDED
+                        | (options & FNM_CASEFOLD ? REG_ICASE : 0));
+
+          if (! (options & FNM_LEADING_DIR))
+            rc = regcomp (&patopts->v.re, pattern, cflags);
+          else
+            for (idx_t len = strlen (pattern); ; len--)
+              {
+                if (len == 0)
+                  {
+                    rc = 1;
+                    break;
+                  }
+                if (!ISSLASH (pattern[len - 1]))
+                  {
+                    static char const patsuffix[] = "(/.*)?";
+                    char *tmp = ximalloc (len + sizeof patsuffix);
+                    memcpy (tmp, pattern, len);
+                    strcpy (tmp + len, patsuffix);
+                    rc = regcomp (&patopts->v.re, tmp, cflags);
+                    free (tmp);
+                    break;
+                  }
+              }
+
+          if (rc)
+            {
+              pat->exclude_count--;
+              return;
+            }
+        }
+      else
+        {
+          if (options & EXCLUDE_ALLOC)
+            {
+              char *dup = xstrdup (pattern);
+              pattern = dup;
+              exclude_add_pattern_buffer (ex, dup);
+            }
+          patopts->v.pattern = pattern;
+        }
+    }
+  else
+    {
+      int exclude_hash_flags = (EXCLUDE_INCLUDE | EXCLUDE_ANCHORED
+                                | FNM_LEADING_DIR | FNM_CASEFOLD);
+      if (! (ex->head && ex->head->type == exclude_hash
+             && ((ex->head->options & exclude_hash_flags)
+                 == (options & exclude_hash_flags))))
+        new_exclude_segment (ex, exclude_hash, options);
+
+      char *str = xstrdup (pattern);
+      if ((options & (EXCLUDE_WILDCARDS | FNM_NOESCAPE)) == EXCLUDE_WILDCARDS)
+        unescape_pattern (str);
+      if (hash_insert (ex->head->v.table, str) != str)
+        free (str);
+    }
+}
+
+/* Use ADD_FUNC to append to EX the patterns in FILE_NAME, each with
+   OPTIONS.  LINE_END terminates each pattern in the file.  If
+   LINE_END is a space character, ignore trailing spaces and empty
+   lines in FP.  Return -1 (setting errno) on failure, 0 on success.  */
+
+int
+add_exclude_fp (void (*add_func) (struct exclude *, char const *, int, void *),
+                struct exclude *ex, FILE *fp, int options,
+                char line_end, void *data)
+{
+  char *buf = nullptr;
+  idx_t buf_alloc = 0;
+  idx_t buf_count = 0;
+
+  for (int c; (c = getc (fp)) != EOF; )
+    {
+      if (buf_count == buf_alloc)
+        buf = xpalloc (buf, &buf_alloc, 1, -1, 1);
+      buf[buf_count++] = c;
+    }
+
+  int e = ferror (fp) ? errno : 0;
+
+  buf = xirealloc (buf, buf_count + 1);
+  buf[buf_count] = line_end;
+  char const *lim = (buf + buf_count
+                     + ! (buf_count == 0 || buf[buf_count - 1] == line_end));
+
+  exclude_add_pattern_buffer (ex, buf);
+
+  char *pattern = buf;
+
+  for (char *p = buf; p < lim; p++)
+    if (*p == line_end)
+      {
+        char *pattern_end = p;
+
+        if (isspace ((unsigned char) line_end))
+          {
+            /* Assume that no multi-byte character has a trailing byte
+               that satisfies isspace, and that nobody cares about
+               trailing white space containing non-single-byte characters.
+               If either assumption turns out to be false, presumably
+               the code should be changed to scan forward through the
+               entire pattern, one multi-byte character at a time.  */
+            for (; ; pattern_end--)
+              if (pattern_end == pattern)
+                goto next_pattern;
+              else if (! isspace ((unsigned char) pattern_end[-1]))
+                break;
+          }
+
+        *pattern_end = '\0';
+        add_func (ex, pattern, options, data);
+
+      next_pattern:
+        pattern = p + 1;
+      }
+
+  errno = e;
+  return e ? -1 : 0;
+}
+
+static void
+call_addfn (struct exclude *ex, char const *pattern, int options, void *data)
+{
+  void (**addfnptr) (struct exclude *, char const *, int) = data;
+  (*addfnptr) (ex, pattern, options);
+}
+
+int
+add_exclude_file (void (*add_func) (struct exclude *, char const *, int),
+                  struct exclude *ex, char const *file_name, int options,
+                  char line_end)
+{
+  if (strcmp (file_name, "-") == 0)
+    return add_exclude_fp (call_addfn, ex, stdin, options, line_end, &add_func);
+
+  FILE *in = fopen (file_name, "re");
+  if (!in)
+    return -1;
+  int rc = add_exclude_fp (call_addfn, ex, in, options, line_end, &add_func);
+  int e = errno;
+  if (fclose (in) < 0)
+    return -1;
+  errno = e;
+  return rc;
+}
deleted file mode 120000 (symlink)
index 9dd6b70665a610e4ca0afca7e4030a9ba725dae4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/exclude.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0783b087326e6b09cc69f45251b70b1a4840c8e4
--- /dev/null
@@ -0,0 +1,70 @@
+/* exclude.h -- declarations for excluding file names
+
+   Copyright (C) 1992-1994, 1997, 1999, 2001-2003, 2005-2006, 2009-2024 Free
+   Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_EXCLUDE_H
+#define _GL_EXCLUDE_H 1
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
+   _GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdio.h>
+
+/* Written by Paul Eggert <eggert@twinsun.com>
+   and Sergey Poznyakoff <gray@gnu.org> */
+
+/* Exclude options, which can be ORed with fnmatch options.  */
+
+/* Patterns must match the start of file names, instead of matching
+   anywhere after a '/'.  */
+#define EXCLUDE_ANCHORED (1 << 30)
+
+/* Include instead of exclude.  */
+#define EXCLUDE_INCLUDE (1 << 29)
+
+/* '?', '*', '[', and '\\' are special in patterns.  Without this
+   option, these characters are ordinary and fnmatch is not used.  */
+#define EXCLUDE_WILDCARDS (1 << 28)
+
+/* Patterns are POSIX extended regular expressions */
+#define EXCLUDE_REGEX     (1 << 27)
+
+/* Allocate storage for the pattern */
+#define EXCLUDE_ALLOC     (1 << 26)
+
+struct exclude;
+
+bool fnmatch_pattern_has_wildcards (const char *, int) _GL_ATTRIBUTE_PURE;
+
+void free_exclude (struct exclude *)
+  _GL_ATTRIBUTE_NONNULL ((1));
+struct exclude *new_exclude (void)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_RETURNS_NONNULL
+  _GL_ATTRIBUTE_DEALLOC (free_exclude, 1);
+void add_exclude (struct exclude *, char const *, int);
+int add_exclude_file (void (*) (struct exclude *, char const *, int),
+                      struct exclude *, char const *, int, char);
+int add_exclude_fp (void (*) (struct exclude *, char const *, int, void *),
+                    struct exclude *, FILE *, int, char, void *);
+bool excluded_file_name (struct exclude const *, char const *);
+void exclude_add_pattern_buffer (struct exclude *ex, char *buf);
+bool exclude_fnmatch (char const *, char const *, int);
+
+#endif /* _GL_EXCLUDE_H */
deleted file mode 120000 (symlink)
index ef2c00b8566a4c5ad1379ee1b4b77bbbfe69c75f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/exitfail.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8a5962e82f27eae4569c6b061324b60a955f6258
--- /dev/null
@@ -0,0 +1,24 @@
+/* Failure exit status
+
+   Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "exitfail.h"
+
+#include <stdlib.h>
+
+int volatile exit_failure = EXIT_FAILURE;
deleted file mode 120000 (symlink)
index bec15957a0060b9508afa568f5a1ce23e1dd973e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/exitfail.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..20ac506b4a55461a98cffe499539f159cb441fb2
--- /dev/null
@@ -0,0 +1,18 @@
+/* Failure exit status
+
+   Copyright (C) 2002, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+extern int volatile exit_failure;
deleted file mode 120000 (symlink)
index 717ddfe418e723a315cebfc58e37ca93c5554861..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/explicit_bzero.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dd078292bad7647eb8e08a839796c8706a046538
--- /dev/null
@@ -0,0 +1,27 @@
+/* Erasure of sensitive data, generic implementation.
+   Copyright (C) 2016-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <string.h>
+
+/* Set LEN bytes of S to 0.  The compiler will not delete a call to
+   this function, even if S is dead after the call.  */
+void
+explicit_bzero (void *s, size_t len)
+{
+  memset_explicit (s, 0, len);
+}
deleted file mode 120000 (symlink)
index 85e5bfa0dbb037cde9a95d43caa247956c2c76c3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/faccessat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8178ca8632eafefb924011eb4fffe4e9d1856864
--- /dev/null
@@ -0,0 +1,98 @@
+/* Check the access rights of a file relative to an open directory.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+/* If the user's config.h happens to include <unistd.h>, let it include only
+   the system's <unistd.h> here, so that orig_faccessat doesn't recurse to
+   rpl_faccessat.  */
+#define _GL_INCLUDING_UNISTD_H
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#undef _GL_INCLUDING_UNISTD_H
+
+#if HAVE_FACCESSAT
+static int
+orig_faccessat (int fd, char const *name, int mode, int flag)
+{
+  return faccessat (fd, name, mode, flag);
+}
+#endif
+
+#ifdef __osf__
+/* Write "unistd.h" here, not <unistd.h>, otherwise OSF/1 5.1 DTK cc
+   eliminates this include because of the preliminary #include <unistd.h>
+   above.  */
+# include "unistd.h"
+#else
+# include <unistd.h>
+#endif
+
+#ifndef HAVE_ACCESS
+/* Mingw lacks access, but it also lacks real vs. effective ids, so
+   the gnulib euidaccess module is good enough.  */
+# undef access
+# define access euidaccess
+#endif
+
+#if HAVE_FACCESSAT
+
+int
+rpl_faccessat (int fd, char const *file, int mode, int flag)
+{
+  int result = orig_faccessat (fd, file, mode, flag);
+
+  if (result == 0 && file[strlen (file) - 1] == '/')
+    {
+      struct stat st;
+      result = fstatat (fd, file, &st, 0);
+      if (result == 0 && !S_ISDIR (st.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+    }
+
+  return result;
+}
+
+#else /* !HAVE_FACCESSAT */
+
+/* Invoke access or euidaccess 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
+   (access|euidaccess)/restore_cwd.  If either the save_cwd or the
+   restore_cwd fails, then give a diagnostic and exit nonzero.
+   Note that this implementation only supports AT_EACCESS, although some
+   native versions also support AT_SYMLINK_NOFOLLOW.  */
+
+# define AT_FUNC_NAME faccessat
+# define AT_FUNC_F1 euidaccess
+# define AT_FUNC_F2 access
+# define AT_FUNC_USE_F1_COND AT_EACCESS
+# define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag
+# define AT_FUNC_POST_FILE_ARGS        , mode
+# include "at-func.c"
+
+#endif
deleted file mode 120000 (symlink)
index 20f742fe1312038192f9e7996623a87ea5dab383..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fchdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5ac2f0965ac693bbbf6e58865f87cd587926bd34
--- /dev/null
@@ -0,0 +1,204 @@
+/* fchdir replacement.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "assure.h"
+#include "filename.h"
+#include "filenamecat.h"
+
+#ifndef REPLACE_OPEN_DIRECTORY
+# define REPLACE_OPEN_DIRECTORY 0
+#endif
+
+/* This replacement assumes that a directory is not renamed while opened
+   through a file descriptor.
+
+   FIXME: On mingw, this would be possible to enforce if we were to
+   also open a HANDLE to each directory currently visited by a file
+   descriptor, since mingw refuses to rename any in-use file system
+   object.  */
+
+/* Array of file descriptors opened.  If REPLACE_OPEN_DIRECTORY or if it points
+   to a directory, it stores info about this directory.  */
+typedef struct
+{
+  char *name;       /* Absolute name of the directory, or NULL.  */
+} 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; free any
+   contents already in that slot.  Return false and set errno to
+   ENOMEM on allocation failure.  */
+static bool
+ensure_dirs_slot (size_t fd)
+{
+  if (fd < dirs_allocated)
+    free (dirs[fd].name);
+  else
+    {
+      size_t new_allocated;
+      dir_info_t *new_dirs;
+
+      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 *dirs)
+         : (dir_info_t *) malloc (new_allocated * sizeof *dirs));
+      if (new_dirs == NULL)
+        return false;
+      memset (new_dirs + dirs_allocated, 0,
+              (new_allocated - dirs_allocated) * sizeof *dirs);
+      dirs = new_dirs;
+      dirs_allocated = new_allocated;
+    }
+  return true;
+}
+
+/* Return an absolute name of DIR in malloc'd storage.
+   Upon failure, return NULL with errno set.  */
+static char *
+get_name (char const *dir)
+{
+  char *cwd;
+  char *result;
+
+  if (IS_ABSOLUTE_FILE_NAME (dir))
+    return strdup (dir);
+
+  /* We often encounter "."; treat it as a special case.  */
+  cwd = getcwd (NULL, 0);
+  if (!cwd || (dir[0] == '.' && dir[1] == '\0'))
+    return cwd;
+
+  result = mfile_name_concat (cwd, dir, NULL);
+  free (cwd);
+  return result;
+}
+
+/* Hook into the gnulib replacements for open() and close() to keep track
+   of the open file descriptors.  */
+
+/* Close FD, cleaning up any fd to name mapping if fd was visiting a
+   directory.  */
+void
+_gl_unregister_fd (int fd)
+{
+  if (fd >= 0 && fd < dirs_allocated)
+    {
+      free (dirs[fd].name);
+      dirs[fd].name = NULL;
+    }
+}
+
+/* Mark FD as visiting FILENAME.  FD must be non-negative, and refer
+   to an open file descriptor.  If REPLACE_OPEN_DIRECTORY is non-zero,
+   this should only be called if FD is visiting a directory.  Close FD
+   and return -1 with errno set if there is insufficient memory to track
+   the directory name; otherwise return FD.  */
+int
+_gl_register_fd (int fd, const char *filename)
+{
+  struct stat statbuf;
+
+  assure (0 <= fd);
+  if (REPLACE_OPEN_DIRECTORY
+      || (fstat (fd, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)))
+    {
+      if (!ensure_dirs_slot (fd)
+          || (dirs[fd].name = get_name (filename)) == NULL)
+        {
+          int saved_errno = errno;
+          close (fd);
+          errno = saved_errno;
+          return -1;
+        }
+    }
+  return fd;
+}
+
+/* Mark NEWFD as a duplicate of OLDFD; useful from dup, dup2, dup3,
+   and fcntl.  Both arguments must be valid and distinct file
+   descriptors.  Close NEWFD and return -1 if OLDFD is tracking a
+   directory, but there is insufficient memory to track the same
+   directory in NEWFD; otherwise return NEWFD.  */
+int
+_gl_register_dup (int oldfd, int newfd)
+{
+  assure (0 <= oldfd && 0 <= newfd && oldfd != newfd);
+  if (oldfd < dirs_allocated && dirs[oldfd].name)
+    {
+      /* Duplicated a directory; must ensure newfd is allocated.  */
+      if (!ensure_dirs_slot (newfd)
+          || (dirs[newfd].name = strdup (dirs[oldfd].name)) == NULL)
+        {
+          int saved_errno = errno;
+          close (newfd);
+          errno = saved_errno;
+          newfd = -1;
+        }
+    }
+  else if (newfd < dirs_allocated)
+    {
+      /* Duplicated a non-directory; ensure newfd is cleared.  */
+      free (dirs[newfd].name);
+      dirs[newfd].name = NULL;
+    }
+  return newfd;
+}
+
+/* If FD is currently visiting a directory, then return the name of
+   that directory.  Otherwise, return NULL and set errno.  */
+const char *
+_gl_directory_name (int fd)
+{
+  if (0 <= fd && fd < dirs_allocated && dirs[fd].name != NULL)
+    return dirs[fd].name;
+  /* At this point, fd is either invalid, or open but not a directory.
+     If dup2 fails, errno is correctly EBADF.  */
+  if (0 <= fd)
+    {
+      if (dup2 (fd, fd) == fd)
+        errno = ENOTDIR;
+    }
+  else
+    errno = EBADF;
+  return NULL;
+}
+
+
+/* Implement fchdir() in terms of chdir().  */
+
+int
+fchdir (int fd)
+{
+  const char *name = _gl_directory_name (fd);
+  return name ? chdir (name) : -1;
+}
deleted file mode 120000 (symlink)
index a9f549a5df39b7de02812613796335abdb763a8f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fchmodat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..00f6cf624489ae76881535ca322d222701b43145
--- /dev/null
@@ -0,0 +1,142 @@
+/* Change the protections of file relative to an open directory.
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering and Paul Eggert */
+
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+   the system's <sys/stat.h> here, so that orig_fchmodat doesn't recurse to
+   rpl_fchmodat.  */
+#define __need_system_sys_stat_h
+#include <config.h>
+
+/* Specification.  */
+#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+#if HAVE_FCHMODAT
+static int
+orig_fchmodat (int dir, char const *file, mode_t mode, int flags)
+{
+  return fchmodat (dir, file, mode, flags);
+}
+#endif
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifdef __osf__
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+   eliminates this include because of the preliminary #include <sys/stat.h>
+   above.  */
+# include "sys/stat.h"
+#else
+# include <sys/stat.h>
+#endif
+
+#include <intprops.h>
+
+/* Invoke chmod or lchmod on 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 (chmod|lchmod)/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.  */
+
+#if HAVE_FCHMODAT
+int
+fchmodat (int dir, char const *file, mode_t mode, int flags)
+{
+# if HAVE_NEARLY_WORKING_FCHMODAT
+  /* Correct the trailing slash handling.  */
+  size_t len = strlen (file);
+  if (len && file[len - 1] == '/')
+    {
+      struct stat st;
+      if (fstatat (dir, file, &st, flags & AT_SYMLINK_NOFOLLOW) < 0)
+        return -1;
+      if (!S_ISDIR (st.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+    }
+# endif
+
+# if NEED_FCHMODAT_NONSYMLINK_FIX
+  if (flags == AT_SYMLINK_NOFOLLOW)
+    {
+#  if HAVE_READLINKAT
+      char readlink_buf[1];
+
+#   ifdef O_PATH
+      /* Open a file descriptor with O_NOFOLLOW, to make sure we don't
+         follow symbolic links, if /proc is mounted.  O_PATH is used to
+         avoid a failure if the file is not readable.
+         Cf. <https://sourceware.org/bugzilla/show_bug.cgi?id=14578>  */
+      int fd = openat (dir, file, O_PATH | O_NOFOLLOW | O_CLOEXEC);
+      if (fd < 0)
+        return fd;
+
+      int err;
+      if (0 <= readlinkat (fd, "", readlink_buf, sizeof readlink_buf))
+        err = EOPNOTSUPP;
+      else if (errno == EINVAL)
+        {
+          static char const fmt[] = "/proc/self/fd/%d";
+          char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
+          sprintf (buf, fmt, fd);
+          err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno;
+        }
+      else
+        err = errno == ENOENT ? -1 : errno;
+
+      close (fd);
+
+      errno = err;
+      if (0 <= err)
+        return err == 0 ? 0 : -1;
+#   endif
+
+      /* O_PATH + /proc is not supported.  */
+
+      if (0 <= readlinkat (dir, file, readlink_buf, sizeof readlink_buf))
+        {
+          errno = EOPNOTSUPP;
+          return -1;
+        }
+#  endif
+
+      /* Fall back on orig_fchmodat with no flags, despite a possible race.  */
+      flags = 0;
+    }
+# endif
+
+  return orig_fchmodat (dir, file, mode, flags);
+}
+#else
+# define AT_FUNC_NAME fchmodat
+# define AT_FUNC_F1 lchmod
+# define AT_FUNC_F2 chmod
+# define AT_FUNC_USE_F1_COND 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"
+#endif
deleted file mode 120000 (symlink)
index 9024ba61161395589dab62d9b09e22a527b56e91..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fchown-stub.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d432269fca481e9e549154cc2e2339d3d5d3c63b
--- /dev/null
@@ -0,0 +1,34 @@
+/* Change ownership of a file.
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, 2004.  */
+
+#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;
+}
deleted file mode 120000 (symlink)
index 5c8e639c344fc223a63d8c1c9c65c308b3cb1579..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fchownat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..61902d1d986357bb4cc7858fa7b047219e052f86
--- /dev/null
@@ -0,0 +1,116 @@
+/* This function serves as replacement for a missing fchownat function,
+   as well as a workaround for the fchownat bug in glibc-2.4:
+    <https://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, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "openat.h"
+
+#if !HAVE_FCHOWNAT
+
+/* 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 (chown|lchown)/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 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"
+# 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
+
+#else /* HAVE_FCHOWNAT */
+
+# undef fchownat
+
+# if FCHOWNAT_NOFOLLOW_BUG
+
+/* Failure to handle AT_SYMLINK_NOFOLLOW requires the /proc/self/fd or
+   fchdir workaround to call lchown for lchownat, but there is no need
+   to penalize chownat.  */
+static int
+local_lchownat (int fd, char const *file, uid_t owner, gid_t group);
+
+#  define AT_FUNC_NAME local_lchownat
+#  define AT_FUNC_F1 lchown
+#  define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group
+#  define AT_FUNC_POST_FILE_ARGS        , owner, group
+#  include "at-func.c"
+#  undef AT_FUNC_NAME
+#  undef AT_FUNC_F1
+#  undef AT_FUNC_POST_FILE_PARAM_DECLS
+#  undef AT_FUNC_POST_FILE_ARGS
+
+# endif
+
+/* Work around bugs with trailing slash, using the same workarounds as
+   chown and lchown.  */
+
+int
+rpl_fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag)
+{
+# if FCHOWNAT_NOFOLLOW_BUG
+  if (flag == AT_SYMLINK_NOFOLLOW)
+    return local_lchownat (fd, file, owner, group);
+# endif
+# if FCHOWNAT_EMPTY_FILENAME_BUG
+  if (file[0] == '\0')
+    {
+      errno = ENOENT;
+      return -1;
+    }
+# endif
+# if CHOWN_TRAILING_SLASH_BUG
+  {
+    size_t len = strlen (file);
+    struct stat st;
+    if (len && file[len - 1] == '/')
+      {
+        if (fstatat (fd, file, &st, 0))
+          return -1;
+        if (flag == AT_SYMLINK_NOFOLLOW)
+          return fchownat (fd, file, owner, group, 0);
+      }
+  }
+# endif
+  return fchownat (fd, file, owner, group, flag);
+}
+
+#endif /* HAVE_FCHOWNAT */
deleted file mode 120000 (symlink)
index 9e2eb143c78f463cbd2fe128094d7da36d4fb1f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fclose.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..77c74d65662ae13ac39322feabca8cdd20d96a06
--- /dev/null
@@ -0,0 +1,112 @@
+/* fclose replacement.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "freading.h"
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#undef fclose
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+fclose_nothrow (FILE *fp)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = fclose (fp);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = EOF;
+      errno = EBADF;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+#else
+# define fclose_nothrow fclose
+#endif
+
+/* Override fclose() to call the overridden fflush() or close().  */
+
+int
+rpl_fclose (FILE *fp)
+{
+  int saved_errno = 0;
+  int fd;
+  int result = 0;
+
+  /* Don't change behavior on memstreams.  */
+  fd = fileno (fp);
+  if (fd < 0)
+    return fclose_nothrow (fp);
+
+  /* We only need to flush the file if it is not reading or if it is
+     seekable.  This only guarantees the file position of input files
+     if the fflush module is also in use.  */
+  if ((!freading (fp) || lseek (fileno (fp), 0, SEEK_CUR) != -1)
+      && fflush (fp))
+    saved_errno = errno;
+
+  /* fclose() calls close(), but we need to also invoke all hooks that our
+     overridden close() function invokes.  See lib/close.c.  */
+#if WINDOWS_SOCKETS
+  /* Call the overridden close(), then the original fclose().
+     Note about multithread-safety: There is a race condition where some
+     other thread could open fd between our close and fclose.  */
+  if (close (fd) < 0 && saved_errno == 0)
+    saved_errno = errno;
+
+  fclose_nothrow (fp); /* will fail with errno = EBADF,
+                          if we did not lose a race */
+
+#else /* !WINDOWS_SOCKETS */
+  /* Call fclose() and invoke all hooks of the overridden close().  */
+
+# if REPLACE_FCHDIR
+  /* Note about multithread-safety: There is a race condition here as well.
+     Some other thread could open fd between our calls to fclose and
+     _gl_unregister_fd.  */
+  result = fclose_nothrow (fp);
+  if (result == 0)
+    _gl_unregister_fd (fd);
+# else
+  /* No race condition here.  */
+  result = fclose_nothrow (fp);
+# endif
+
+#endif /* !WINDOWS_SOCKETS */
+
+  if (saved_errno != 0)
+    {
+      errno = saved_errno;
+      result = EOF;
+    }
+
+  return result;
+}
deleted file mode 120000 (symlink)
index 6016babc1ee8debf8b9eff03965e1e24d028ef54..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fcntl--.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..acb237d7f05d55bd35067987200eedc989254e7b
--- /dev/null
@@ -0,0 +1,32 @@
+/* Like fcntl.h, but redefine some names to avoid glitches.
+
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <fcntl.h>
+#include "fcntl-safer.h"
+
+#undef open
+#define open open_safer
+
+#undef creat
+#define creat creat_safer
+
+#if GNULIB_OPENAT_SAFER
+# undef openat
+# define openat openat_safer
+#endif
deleted file mode 120000 (symlink)
index 7c5686c5f15c61fd7dcf7cf9debbcb315de1606e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fcntl-safer.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..75f7142e306c0207db5ebb4fb8264a2666bd7bff
--- /dev/null
@@ -0,0 +1,27 @@
+/* Invoke fcntl-like functions, but avoid some glitches.
+
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <sys/types.h>
+
+int open_safer (char const *, int, ...);
+int creat_safer (char const *, mode_t);
+
+#if GNULIB_OPENAT_SAFER
+int openat_safer (int, char const *, int, ...);
+#endif
deleted file mode 120000 (symlink)
index b5dbd0d6271ed5f508b40c26c64faf242cc85266..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fcntl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7cd3a0f976d9f9c9fbb1b5cab5b57780a72cec58
--- /dev/null
@@ -0,0 +1,629 @@
+/* Provide file descriptor control.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <fcntl.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#ifdef __KLIBC__
+# define INCL_DOS
+# include <os2.h>
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions.  */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+
+/* Upper bound on getdtablesize().  See lib/getdtablesize.c.  */
+# define OPEN_MAX_MAX 0x10000
+
+/* Duplicate OLDFD into the first available slot of at least NEWFD,
+   which must be positive, with FLAGS determining whether the duplicate
+   will be inheritable.  */
+static int
+dupfd (int oldfd, int newfd, int flags)
+{
+  /* Mingw has no way to create an arbitrary fd.  Iterate until all
+     file descriptors less than newfd are filled up.  */
+  HANDLE curr_process = GetCurrentProcess ();
+  HANDLE old_handle = (HANDLE) _get_osfhandle (oldfd);
+  unsigned char fds_to_close[OPEN_MAX_MAX / CHAR_BIT];
+  unsigned int fds_to_close_bound = 0;
+  int result;
+  BOOL inherit = flags & O_CLOEXEC ? FALSE : TRUE;
+  int mode;
+
+  if (newfd < 0 || getdtablesize () <= newfd)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  if (old_handle == INVALID_HANDLE_VALUE
+      || (mode = _setmode (oldfd, O_BINARY)) == -1)
+    {
+      /* oldfd is not open, or is an unassigned standard file
+         descriptor.  */
+      errno = EBADF;
+      return -1;
+    }
+  _setmode (oldfd, mode);
+  flags |= mode;
+
+  for (;;)
+    {
+      HANDLE new_handle;
+      int duplicated_fd;
+      unsigned int index;
+
+      if (!DuplicateHandle (curr_process,           /* SourceProcessHandle */
+                            old_handle,             /* SourceHandle */
+                            curr_process,           /* TargetProcessHandle */
+                            (PHANDLE) &new_handle,  /* TargetHandle */
+                            (DWORD) 0,              /* DesiredAccess */
+                            inherit,                /* InheritHandle */
+                            DUPLICATE_SAME_ACCESS)) /* Options */
+        {
+          switch (GetLastError ())
+            {
+              case ERROR_TOO_MANY_OPEN_FILES:
+                errno = EMFILE;
+                break;
+              case ERROR_INVALID_HANDLE:
+              case ERROR_INVALID_TARGET_HANDLE:
+              case ERROR_DIRECT_ACCESS_HANDLE:
+                errno = EBADF;
+                break;
+              case ERROR_INVALID_PARAMETER:
+              case ERROR_INVALID_FUNCTION:
+              case ERROR_INVALID_ACCESS:
+                errno = EINVAL;
+                break;
+              default:
+                errno = EACCES;
+                break;
+            }
+          result = -1;
+          break;
+        }
+      duplicated_fd = _open_osfhandle ((intptr_t) new_handle, flags);
+      if (duplicated_fd < 0)
+        {
+          CloseHandle (new_handle);
+          result = -1;
+          break;
+        }
+      if (newfd <= duplicated_fd)
+        {
+          result = duplicated_fd;
+          break;
+        }
+
+      /* Set the bit duplicated_fd in fds_to_close[].  */
+      index = (unsigned int) duplicated_fd / CHAR_BIT;
+      if (fds_to_close_bound <= index)
+        {
+          if (sizeof fds_to_close <= index)
+            /* Need to increase OPEN_MAX_MAX.  */
+            abort ();
+          memset (fds_to_close + fds_to_close_bound, '\0',
+                  index + 1 - fds_to_close_bound);
+          fds_to_close_bound = index + 1;
+        }
+      fds_to_close[index] |= 1 << ((unsigned int) duplicated_fd % CHAR_BIT);
+    }
+
+  /* Close the previous fds that turned out to be too small.  */
+  {
+    int saved_errno = errno;
+    unsigned int duplicated_fd;
+
+    for (duplicated_fd = 0;
+         duplicated_fd < fds_to_close_bound * CHAR_BIT;
+         duplicated_fd++)
+      if ((fds_to_close[duplicated_fd / CHAR_BIT]
+           >> (duplicated_fd % CHAR_BIT))
+          & 1)
+        close (duplicated_fd);
+
+    errno = saved_errno;
+  }
+
+# if REPLACE_FCHDIR
+  if (0 <= result)
+    result = _gl_register_dup (oldfd, result);
+# endif
+  return result;
+}
+#endif /* W32 */
+
+/* Forward declarations, because we '#undef fcntl' in the middle of this
+   compilation unit.  */
+/* Our implementation of fcntl (fd, F_DUPFD, target).  */
+static int rpl_fcntl_DUPFD (int fd, int target);
+/* Our implementation of fcntl (fd, F_DUPFD_CLOEXEC, target).  */
+static int rpl_fcntl_DUPFD_CLOEXEC (int fd, int target);
+#ifdef __KLIBC__
+/* Adds support for fcntl on directories.  */
+static int klibc_fcntl (int fd, int action, /* arg */...);
+#endif
+
+
+/* Perform the specified ACTION on the file descriptor FD, possibly
+   using the argument ARG further described below.  This replacement
+   handles the following actions, and forwards all others on to the
+   native fcntl.  An unrecognized ACTION returns -1 with errno set to
+   EINVAL.
+
+   F_DUPFD - duplicate FD, with int ARG being the minimum target fd.
+   If successful, return the duplicate, which will be inheritable;
+   otherwise return -1 and set errno.
+
+   F_DUPFD_CLOEXEC - duplicate FD, with int ARG being the minimum
+   target fd.  If successful, return the duplicate, which will not be
+   inheritable; otherwise return -1 and set errno.
+
+   F_GETFD - ARG need not be present.  If successful, return a
+   non-negative value containing the descriptor flags of FD (only
+   FD_CLOEXEC is portable, but other flags may be present); otherwise
+   return -1 and set errno.  */
+
+int
+fcntl (int fd, int action, /* arg */...)
+#undef fcntl
+#ifdef __KLIBC__
+# define fcntl klibc_fcntl
+#endif
+{
+  va_list arg;
+  int result = -1;
+  va_start (arg, action);
+  switch (action)
+    {
+    case F_DUPFD:
+      {
+        int target = va_arg (arg, int);
+        result = rpl_fcntl_DUPFD (fd, target);
+        break;
+      }
+
+    case F_DUPFD_CLOEXEC:
+      {
+        int target = va_arg (arg, int);
+        result = rpl_fcntl_DUPFD_CLOEXEC (fd, target);
+        break;
+      }
+
+#if !HAVE_FCNTL
+    case F_GETFD:
+      {
+# if defined _WIN32 && ! defined __CYGWIN__
+        HANDLE handle = (HANDLE) _get_osfhandle (fd);
+        DWORD flags;
+        if (handle == INVALID_HANDLE_VALUE
+            || GetHandleInformation (handle, &flags) == 0)
+          errno = EBADF;
+        else
+          result = (flags & HANDLE_FLAG_INHERIT) ? 0 : FD_CLOEXEC;
+# else /* !W32 */
+        /* Use dup2 to reject invalid file descriptors.  No way to
+           access this information, so punt.  */
+        if (0 <= dup2 (fd, fd))
+          result = 0;
+# endif /* !W32 */
+        break;
+      } /* F_GETFD */
+#endif /* !HAVE_FCNTL */
+
+      /* Implementing F_SETFD on mingw is not trivial - there is no
+         API for changing the O_NOINHERIT bit on an fd, and merely
+         changing the HANDLE_FLAG_INHERIT bit on the underlying handle
+         can lead to odd state.  It may be possible by duplicating the
+         handle, using _open_osfhandle with the right flags, then
+         using dup2 to move the duplicate onto the original, but that
+         is not supported for now.  */
+
+    default:
+      {
+#if HAVE_FCNTL
+        switch (action)
+          {
+          #ifdef F_BARRIERFSYNC                  /* macOS */
+          case F_BARRIERFSYNC:
+          #endif
+          #ifdef F_CHKCLEAN                      /* macOS */
+          case F_CHKCLEAN:
+          #endif
+          #ifdef F_CLOSEM                        /* NetBSD, HP-UX */
+          case F_CLOSEM:
+          #endif
+          #ifdef F_FLUSH_DATA                    /* macOS */
+          case F_FLUSH_DATA:
+          #endif
+          #ifdef F_FREEZE_FS                     /* macOS */
+          case F_FREEZE_FS:
+          #endif
+          #ifdef F_FULLFSYNC                     /* macOS */
+          case F_FULLFSYNC:
+          #endif
+          #ifdef F_GETCONFINED                   /* macOS */
+          case F_GETCONFINED:
+          #endif
+          #ifdef F_GETDEFAULTPROTLEVEL           /* macOS */
+          case F_GETDEFAULTPROTLEVEL:
+          #endif
+          #ifdef F_GETFD                         /* POSIX */
+          case F_GETFD:
+          #endif
+          #ifdef F_GETFL                         /* POSIX */
+          case F_GETFL:
+          #endif
+          #ifdef F_GETLEASE                      /* Linux */
+          case F_GETLEASE:
+          #endif
+          #ifdef F_GETNOSIGPIPE                  /* macOS */
+          case F_GETNOSIGPIPE:
+          #endif
+          #ifdef F_GETOWN                        /* POSIX */
+          case F_GETOWN:
+          #endif
+          #ifdef F_GETPIPE_SZ                    /* Linux */
+          case F_GETPIPE_SZ:
+          #endif
+          #ifdef F_GETPROTECTIONCLASS            /* macOS */
+          case F_GETPROTECTIONCLASS:
+          #endif
+          #ifdef F_GETPROTECTIONLEVEL            /* macOS */
+          case F_GETPROTECTIONLEVEL:
+          #endif
+          #ifdef F_GET_SEALS                     /* Linux */
+          case F_GET_SEALS:
+          #endif
+          #ifdef F_GETSIG                        /* Linux */
+          case F_GETSIG:
+          #endif
+          #ifdef F_MAXFD                         /* NetBSD */
+          case F_MAXFD:
+          #endif
+          #ifdef F_RECYCLE                       /* macOS */
+          case F_RECYCLE:
+          #endif
+          #ifdef F_SETFIFOENH                    /* HP-UX */
+          case F_SETFIFOENH:
+          #endif
+          #ifdef F_THAW_FS                       /* macOS */
+          case F_THAW_FS:
+          #endif
+            /* These actions take no argument.  */
+            result = fcntl (fd, action);
+            break;
+
+          #ifdef F_ADD_SEALS                     /* Linux */
+          case F_ADD_SEALS:
+          #endif
+          #ifdef F_BADFD                         /* Solaris */
+          case F_BADFD:
+          #endif
+          #ifdef F_CHECK_OPENEVT                 /* macOS */
+          case F_CHECK_OPENEVT:
+          #endif
+          #ifdef F_DUP2FD                        /* FreeBSD, AIX, Solaris */
+          case F_DUP2FD:
+          #endif
+          #ifdef F_DUP2FD_CLOEXEC                /* FreeBSD, Solaris */
+          case F_DUP2FD_CLOEXEC:
+          #endif
+          #ifdef F_DUP2FD_CLOFORK                /* Solaris */
+          case F_DUP2FD_CLOFORK:
+          #endif
+          #ifdef F_DUPFD                         /* POSIX */
+          case F_DUPFD:
+          #endif
+          #ifdef F_DUPFD_CLOEXEC                 /* POSIX */
+          case F_DUPFD_CLOEXEC:
+          #endif
+          #ifdef F_DUPFD_CLOFORK                 /* Solaris */
+          case F_DUPFD_CLOFORK:
+          #endif
+          #ifdef F_GETXFL                        /* Solaris */
+          case F_GETXFL:
+          #endif
+          #ifdef F_GLOBAL_NOCACHE                /* macOS */
+          case F_GLOBAL_NOCACHE:
+          #endif
+          #ifdef F_MAKECOMPRESSED                /* macOS */
+          case F_MAKECOMPRESSED:
+          #endif
+          #ifdef F_MOVEDATAEXTENTS               /* macOS */
+          case F_MOVEDATAEXTENTS:
+          #endif
+          #ifdef F_NOCACHE                       /* macOS */
+          case F_NOCACHE:
+          #endif
+          #ifdef F_NODIRECT                      /* macOS */
+          case F_NODIRECT:
+          #endif
+          #ifdef F_NOTIFY                        /* Linux */
+          case F_NOTIFY:
+          #endif
+          #ifdef F_OPLKACK                       /* IRIX */
+          case F_OPLKACK:
+          #endif
+          #ifdef F_OPLKREG                       /* IRIX */
+          case F_OPLKREG:
+          #endif
+          #ifdef F_RDAHEAD                       /* macOS */
+          case F_RDAHEAD:
+          #endif
+          #ifdef F_SETBACKINGSTORE               /* macOS */
+          case F_SETBACKINGSTORE:
+          #endif
+          #ifdef F_SETCONFINED                   /* macOS */
+          case F_SETCONFINED:
+          #endif
+          #ifdef F_SETFD                         /* POSIX */
+          case F_SETFD:
+          #endif
+          #ifdef F_SETFL                         /* POSIX */
+          case F_SETFL:
+          #endif
+          #ifdef F_SETLEASE                      /* Linux */
+          case F_SETLEASE:
+          #endif
+          #ifdef F_SETNOSIGPIPE                  /* macOS */
+          case F_SETNOSIGPIPE:
+          #endif
+          #ifdef F_SETOWN                        /* POSIX */
+          case F_SETOWN:
+          #endif
+          #ifdef F_SETPIPE_SZ                    /* Linux */
+          case F_SETPIPE_SZ:
+          #endif
+          #ifdef F_SETPROTECTIONCLASS            /* macOS */
+          case F_SETPROTECTIONCLASS:
+          #endif
+          #ifdef F_SETSIG                        /* Linux */
+          case F_SETSIG:
+          #endif
+          #ifdef F_SINGLE_WRITER                 /* macOS */
+          case F_SINGLE_WRITER:
+          #endif
+            /* These actions take an 'int' argument.  */
+            {
+              int x = va_arg (arg, int);
+              result = fcntl (fd, action, x);
+            }
+            break;
+
+          default:
+            /* Other actions take a pointer argument.  */
+            {
+              void *p = va_arg (arg, void *);
+              result = fcntl (fd, action, p);
+            }
+            break;
+          }
+#else
+        errno = EINVAL;
+#endif
+        break;
+      }
+    }
+  va_end (arg);
+  return result;
+}
+
+static int
+rpl_fcntl_DUPFD (int fd, int target)
+{
+  int result;
+#if !HAVE_FCNTL
+  result = dupfd (fd, target, 0);
+#elif FCNTL_DUPFD_BUGGY || REPLACE_FCHDIR
+  /* Detect invalid target; needed for cygwin 1.5.x.  */
+  if (target < 0 || getdtablesize () <= target)
+    {
+      result = -1;
+      errno = EINVAL;
+    }
+  else
+    {
+      /* Haiku alpha 2 loses fd flags on original.  */
+      int flags = fcntl (fd, F_GETFD);
+      if (flags < 0)
+        result = -1;
+      else
+        {
+          result = fcntl (fd, F_DUPFD, target);
+          if (0 <= result && fcntl (fd, F_SETFD, flags) == -1)
+            {
+              int saved_errno = errno;
+              close (result);
+              result = -1;
+              errno = saved_errno;
+            }
+# if REPLACE_FCHDIR
+          if (0 <= result)
+            result = _gl_register_dup (fd, result);
+# endif
+        }
+    }
+#else
+  result = fcntl (fd, F_DUPFD, target);
+#endif
+  return result;
+}
+
+static int
+rpl_fcntl_DUPFD_CLOEXEC (int fd, int target)
+{
+  int result;
+#if !HAVE_FCNTL
+  result = dupfd (fd, target, O_CLOEXEC);
+#else /* HAVE_FCNTL */
+# if defined __NetBSD__ || defined __HAIKU__
+  /* On NetBSD 9.0, the system fcntl (fd, F_DUPFD_CLOEXEC, target)
+     has only the same effect as fcntl (fd, F_DUPFD, target).  */
+  /* On Haiku, the system fcntl (fd, F_DUPFD_CLOEXEC, target) sets
+     the FD_CLOEXEC flag on fd, not on target.  Therefore avoid the
+     system fcntl in this case.  */
+#  define have_dupfd_cloexec -1
+# else
+  /* Try the system call first, if the headers claim it exists
+     (that is, if GNULIB_defined_F_DUPFD_CLOEXEC is 0), since we
+     may be running with a glibc that has the macro but with an
+     older kernel that does not support it.  Cache the
+     information on whether the system call really works, but
+     avoid caching failure if the corresponding F_DUPFD fails
+     for any reason.  0 = unknown, 1 = yes, -1 = no.  */
+  static int have_dupfd_cloexec = GNULIB_defined_F_DUPFD_CLOEXEC ? -1 : 0;
+  if (0 <= have_dupfd_cloexec)
+    {
+      result = fcntl (fd, F_DUPFD_CLOEXEC, target);
+      if (0 <= result || errno != EINVAL)
+        {
+          have_dupfd_cloexec = 1;
+#  if REPLACE_FCHDIR
+          if (0 <= result)
+            result = _gl_register_dup (fd, result);
+#  endif
+        }
+      else
+        {
+          result = rpl_fcntl_DUPFD (fd, target);
+          if (result >= 0)
+            have_dupfd_cloexec = -1;
+        }
+    }
+  else
+# endif
+    result = rpl_fcntl_DUPFD (fd, target);
+  if (0 <= result && have_dupfd_cloexec == -1)
+    {
+      int flags = fcntl (result, F_GETFD);
+      if (flags < 0 || fcntl (result, F_SETFD, flags | FD_CLOEXEC) == -1)
+        {
+          int saved_errno = errno;
+          close (result);
+          errno = saved_errno;
+          result = -1;
+        }
+    }
+#endif /* HAVE_FCNTL */
+  return result;
+}
+
+#undef fcntl
+
+#ifdef __KLIBC__
+
+static int
+klibc_fcntl (int fd, int action, /* arg */...)
+{
+  va_list arg_ptr;
+  int arg;
+  struct stat sbuf;
+  int result;
+
+  va_start (arg_ptr, action);
+  arg = va_arg (arg_ptr, int);
+  result = fcntl (fd, action, arg);
+  /* EPERM for F_DUPFD, ENOTSUP for others */
+  if (result == -1 && (errno == EPERM || errno == ENOTSUP)
+      && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode))
+    {
+      ULONG ulMode;
+
+      switch (action)
+        {
+        case F_DUPFD:
+          /* Find available fd */
+          while (fcntl (arg, F_GETFL) != -1 || errno != EBADF)
+            arg++;
+
+          result = dup2 (fd, arg);
+          break;
+
+        /* Using underlying APIs is right ? */
+        case F_GETFD:
+          if (DosQueryFHState (fd, &ulMode))
+            break;
+
+          result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0;
+          break;
+
+        case F_SETFD:
+          if (arg & ~FD_CLOEXEC)
+            break;
+
+          if (DosQueryFHState (fd, &ulMode))
+            break;
+
+          if (arg & FD_CLOEXEC)
+            ulMode |= OPEN_FLAGS_NOINHERIT;
+          else
+            ulMode &= ~OPEN_FLAGS_NOINHERIT;
+
+          /* Filter supported flags.  */
+          ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR
+                     | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT);
+
+          if (DosSetFHState (fd, ulMode))
+            break;
+
+          result = 0;
+          break;
+
+        case F_GETFL:
+          result = 0;
+          break;
+
+        case F_SETFL:
+          if (arg != 0)
+            break;
+
+          result = 0;
+          break;
+
+        default:
+          errno = EINVAL;
+          break;
+        }
+    }
+
+  va_end (arg_ptr);
+
+  return result;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 1e9f121031b2a6071fa48700f88120dbf1db342e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fcntl.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eea3b9542a514fcd046bac5878f45435285b2918
--- /dev/null
@@ -0,0 +1,450 @@
+/* Like <fcntl.h>, but with non-working flags defined to 0.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined __need_system_fcntl_h
+/* Special invocation convention.  */
+
+/* Needed before <sys/stat.h>.
+   May also define off_t to a 64-bit type on native Windows.  */
+#include <sys/types.h>
+/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
+   <fcntl.h>.  On glibc systems, we would like to avoid namespace pollution.
+   But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
+   extern "C" { ... } block, which leads to errors in C++ mode with the
+   overridden <sys/stat.h> from gnulib.  These errors are known to be gone
+   with g++ version >= 4.3.  */
+#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
+# include <sys/stat.h>
+#endif
+#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
+
+/* Native Windows platforms declare open(), creat() in <io.h>.  */
+#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
+    && (defined _WIN32 && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_FCNTL_H
+
+/* Needed before <sys/stat.h>.
+   May also define off_t to a 64-bit type on native Windows.  */
+#include <sys/types.h>
+/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
+   <fcntl.h>.  On glibc systems, we would like to avoid namespace pollution.
+   But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
+   extern "C" { ... } block, which leads to errors in C++ mode with the
+   overridden <sys/stat.h> from gnulib.  These errors are known to be gone
+   with g++ version >= 4.3.  */
+#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
+# include <sys/stat.h>
+#endif
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
+
+/* Native Windows platforms declare open(), creat() in <io.h>.  */
+#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
+    && (defined _WIN32 && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
+#ifndef _@GUARD_PREFIX@_FCNTL_H
+#define _@GUARD_PREFIX@_FCNTL_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
+# include <unistd.h>
+#endif
+
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Declare overridden functions.  */
+
+#if @GNULIB_CREAT@
+# if @REPLACE_CREAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef creat
+#   define creat rpl_creat
+#  endif
+_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode)
+                             _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef creat
+#   define creat _creat
+#  endif
+_GL_CXXALIAS_MDA (creat, int, (const char *filename, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
+# endif
+_GL_CXXALIASWARN (creat);
+#elif defined GNULIB_POSIXCHECK
+# undef creat
+/* Assume creat is always declared.  */
+_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
+                 "use gnulib module creat for portability");
+#elif @GNULIB_MDA_CREAT@
+/* On native Windows, map 'creat' to '_creat', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::creat always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef creat
+#   define creat _creat
+#  endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (creat, int, (const char *filename, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
+# endif
+_GL_CXXALIASWARN (creat);
+#endif
+
+#if @GNULIB_FCNTL@
+# if @REPLACE_FCNTL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fcntl
+#   define fcntl rpl_fcntl
+#  endif
+_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
+_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
+#  if !GNULIB_defined_rpl_fcntl
+#   define GNULIB_defined_rpl_fcntl 1
+#  endif
+# else
+#  if !@HAVE_FCNTL@
+_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
+#   if !GNULIB_defined_fcntl
+#    define GNULIB_defined_fcntl 1
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
+# endif
+_GL_CXXALIASWARN (fcntl);
+#elif defined GNULIB_POSIXCHECK
+# undef fcntl
+# if HAVE_RAW_DECL_FCNTL
+_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
+                 "use gnulib module fcntl for portability");
+# endif
+#endif
+
+#if @GNULIB_OPEN@
+# if @REPLACE_OPEN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef open
+#   define open rpl_open
+#  endif
+_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
+                             _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef open
+#   define open _open
+#  endif
+_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+# else
+_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+# endif
+/* On HP-UX 11, in C++ mode, open() is defined as an inline function with a
+   default argument.  _GL_CXXALIASWARN does not work in this case.  */
+# if !defined __hpux
+_GL_CXXALIASWARN (open);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef open
+/* Assume open is always declared.  */
+_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
+                 "use gnulib module open for portability");
+#elif @GNULIB_MDA_OPEN@
+/* On native Windows, map 'open' to '_open', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::open always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef open
+#   define open _open
+#  endif
+_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
+# else
+_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+# endif
+# if !defined __hpux
+_GL_CXXALIASWARN (open);
+# endif
+#endif
+
+#if @GNULIB_OPENAT@
+# if @REPLACE_OPENAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef openat
+#   define openat rpl_openat
+#  endif
+_GL_FUNCDECL_RPL (openat, int,
+                  (int fd, char const *file, int flags, /* mode_t mode */ ...)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (openat, int,
+                  (int fd, char const *file, int flags, /* mode_t mode */ ...));
+# else
+#  if !@HAVE_OPENAT@
+_GL_FUNCDECL_SYS (openat, int,
+                  (int fd, char const *file, int flags, /* mode_t mode */ ...)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (openat, int,
+                  (int fd, char const *file, int flags, /* mode_t mode */ ...));
+# endif
+_GL_CXXALIASWARN (openat);
+#elif defined GNULIB_POSIXCHECK
+# undef openat
+# if HAVE_RAW_DECL_OPENAT
+_GL_WARN_ON_USE (openat, "openat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
+#endif
+
+
+/* Fix up the FD_* macros, only known to be missing on mingw.  */
+
+#ifndef FD_CLOEXEC
+# define FD_CLOEXEC 1
+#endif
+
+/* Fix up the supported F_* macros.  Intentionally leave other F_*
+   macros undefined.  Only known to be missing on mingw.  */
+
+#ifndef F_DUPFD_CLOEXEC
+# define F_DUPFD_CLOEXEC 0x40000000
+/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise.  */
+# define GNULIB_defined_F_DUPFD_CLOEXEC 1
+#else
+# define GNULIB_defined_F_DUPFD_CLOEXEC 0
+#endif
+
+#ifndef F_DUPFD
+# define F_DUPFD 1
+#endif
+
+#ifndef F_GETFD
+# define F_GETFD 2
+#endif
+
+/* Fix up the O_* macros.  */
+
+/* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT
+   to values outside 'int' range, so omit these misdefinitions.
+   But avoid namespace pollution on non-AIX systems.  */
+#ifdef _AIX
+# include <limits.h>
+# if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX)
+#  undef O_CLOEXEC
+# endif
+# if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX)
+#  undef O_NOFOLLOW
+# endif
+# if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX)
+#  undef O_TTY_INIT
+# endif
+#endif
+
+#if !defined O_DIRECT && defined O_DIRECTIO
+/* Tru64 spells it 'O_DIRECTIO'.  */
+# define O_DIRECT O_DIRECTIO
+#endif
+
+#if !defined O_CLOEXEC && defined O_NOINHERIT
+/* Mingw spells it 'O_NOINHERIT'.  */
+# define O_CLOEXEC O_NOINHERIT
+#endif
+
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0x40000000 /* Try to not collide with system O_* flags.  */
+# define GNULIB_defined_O_CLOEXEC 1
+#else
+# define GNULIB_defined_O_CLOEXEC 0
+#endif
+
+#ifndef O_DIRECT
+# define O_DIRECT 0
+#endif
+
+#ifndef O_DIRECTORY
+# define O_DIRECTORY 0
+#endif
+
+#ifndef O_DSYNC
+# define O_DSYNC 0
+#endif
+
+#ifndef O_EXEC
+# define O_EXEC O_RDONLY /* This is often close enough in older systems.  */
+#endif
+
+#ifndef O_IGNORE_CTTY
+# define O_IGNORE_CTTY 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
+
+/* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero
+   value of O_NONBLOCK.  Otherwise, O_NONBLOCK is defined (above) to O_NDELAY
+   or to 0 as fallback.  */
+#if @GNULIB_NONBLOCKING@
+# if O_NONBLOCK
+#  define GNULIB_defined_O_NONBLOCK 0
+# else
+#  define GNULIB_defined_O_NONBLOCK 1
+#  undef O_NONBLOCK
+#  define O_NONBLOCK 0x40000000
+# endif
+#endif
+
+#ifndef O_NOCTTY
+# define O_NOCTTY 0
+#endif
+
+#ifndef O_NOFOLLOW
+# define O_NOFOLLOW 0
+#endif
+
+#ifndef O_NOLINK
+# define O_NOLINK 0
+#endif
+
+#ifndef O_NOLINKS
+# define O_NOLINKS 0
+#endif
+
+#ifndef O_NOTRANS
+# define O_NOTRANS 0
+#endif
+
+#ifndef O_RSYNC
+# define O_RSYNC 0
+#endif
+
+#ifndef O_SEARCH
+# define O_SEARCH O_RDONLY /* This is often close enough in older systems.  */
+#endif
+
+#ifndef O_SYNC
+# define O_SYNC 0
+#endif
+
+#ifndef O_TTY_INIT
+# define O_TTY_INIT 0
+#endif
+
+#if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
+# undef O_ACCMODE
+# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
+#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
+
+#if defined __BEOS__ || defined __HAIKU__
+  /* BeOS 5 and Haiku have 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
+
+/* Fix up the AT_* macros.  */
+
+/* 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
+#endif
+
+#ifndef AT_REMOVEDIR
+# define AT_REMOVEDIR 1
+#endif
+
+/* Solaris 9 lacks these two, so just pick unique values.  */
+#ifndef AT_SYMLINK_FOLLOW
+# define AT_SYMLINK_FOLLOW 2
+#endif
+
+#ifndef AT_EACCESS
+# define AT_EACCESS 4
+#endif
+
+/* Ignore this flag if not supported.  */
+#ifndef AT_NO_AUTOMOUNT
+# define AT_NO_AUTOMOUNT 0
+#endif
+
+#endif /* _@GUARD_PREFIX@_FCNTL_H */
+#endif /* _@GUARD_PREFIX@_FCNTL_H */
+#endif
deleted file mode 120000 (symlink)
index cc0d81bd593c6e309a3c33cef09aa04b1e2a8c9b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fd-hook.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..75bbe49c92ef93fad77852a859880f8e79fa46d3
--- /dev/null
@@ -0,0 +1,116 @@
+/* Hook for making file descriptor functions close(), ioctl() extensible.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "fd-hook.h"
+
+#include <stdlib.h>
+
+/* Currently, this entire code is only needed for the handling of sockets
+   on native Windows platforms.  */
+#if WINDOWS_SOCKETS
+
+/* The first and last link in the doubly linked list.
+   Initially the list is empty.  */
+static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL };
+
+int
+execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary,
+                     int fd)
+{
+  if (remaining_list == &anchor)
+    /* End of list reached.  */
+    return primary (fd);
+  else
+    return remaining_list->private_close_fn (remaining_list->private_next,
+                                             primary, fd);
+}
+
+int
+execute_all_close_hooks (gl_close_fn primary, int fd)
+{
+  return execute_close_hooks (anchor.private_next, primary, fd);
+}
+
+int
+execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary,
+                     int fd, int request, void *arg)
+{
+  if (remaining_list == &anchor)
+    /* End of list reached.  */
+    return primary (fd, request, arg);
+  else
+    return remaining_list->private_ioctl_fn (remaining_list->private_next,
+                                             primary, fd, request, arg);
+}
+
+int
+execute_all_ioctl_hooks (gl_ioctl_fn primary,
+                         int fd, int request, void *arg)
+{
+  return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg);
+}
+
+void
+register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link)
+{
+  if (close_hook == NULL)
+    close_hook = execute_close_hooks;
+  if (ioctl_hook == NULL)
+    ioctl_hook = execute_ioctl_hooks;
+
+  if (link->private_next == NULL && link->private_prev == NULL)
+    {
+      /* Add the link to the doubly linked list.  */
+      link->private_next = anchor.private_next;
+      link->private_prev = &anchor;
+      link->private_close_fn = close_hook;
+      link->private_ioctl_fn = ioctl_hook;
+      anchor.private_next->private_prev = link;
+      anchor.private_next = link;
+    }
+  else
+    {
+      /* The link is already in use.  */
+      if (link->private_close_fn != close_hook
+          || link->private_ioctl_fn != ioctl_hook)
+        abort ();
+    }
+}
+
+void
+unregister_fd_hook (struct fd_hook *link)
+{
+  struct fd_hook *next = link->private_next;
+  struct fd_hook *prev = link->private_prev;
+
+  if (next != NULL && prev != NULL)
+    {
+      /* The link is in use.  Remove it from the doubly linked list.  */
+      prev->private_next = next;
+      next->private_prev = prev;
+      /* Clear the link, to mark it unused.  */
+      link->private_next = NULL;
+      link->private_prev = NULL;
+      link->private_close_fn = NULL;
+      link->private_ioctl_fn = NULL;
+    }
+}
+
+#endif
deleted file mode 120000 (symlink)
index b2d341428283edfa179761f690501deeb0839e14..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fd-hook.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2150460bc143d7e2088b8e6868ef83822dbb5edb
--- /dev/null
@@ -0,0 +1,119 @@
+/* Hook for making file descriptor functions close(), ioctl() extensible.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+
+#ifndef FD_HOOK_H
+#define FD_HOOK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Currently, this entire code is only needed for the handling of sockets
+   on native Windows platforms.  */
+#if WINDOWS_SOCKETS
+
+
+/* Type of function that closes FD.  */
+typedef int (*gl_close_fn) (int fd);
+
+/* Type of function that applies a control request to FD.  */
+typedef int (*gl_ioctl_fn) (int fd, int request, void *arg);
+
+/* An element of the list of file descriptor hooks.
+   In CLOS (Common Lisp Object System) speak, it consists of an "around"
+   method for the close() function and an "around" method for the ioctl()
+   function.
+   The fields of this structure are considered private.  */
+struct fd_hook
+{
+  /* Doubly linked list.  */
+  struct fd_hook *private_next;
+  struct fd_hook *private_prev;
+  /* Function that treats the types of FD that it knows about and calls
+     execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback.  */
+  int (*private_close_fn) (const struct fd_hook *remaining_list,
+                           gl_close_fn primary,
+                           int fd);
+  /* Function that treats the types of FD that it knows about and calls
+     execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a
+     fallback.  */
+  int (*private_ioctl_fn) (const struct fd_hook *remaining_list,
+                           gl_ioctl_fn primary,
+                           int fd, int request, void *arg);
+};
+
+/* This type of function closes FD, applying special knowledge for the FD
+   types it knows about, and calls
+   execute_close_hooks (REMAINING_LIST, PRIMARY, FD)
+   for the other FD types.
+   In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
+   and PRIMARY is the "primary" method for close().  */
+typedef int (*close_hook_fn) (const struct fd_hook *remaining_list,
+                              gl_close_fn primary,
+                              int fd);
+
+/* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method.
+   Return 0 or -1, like close() would do.  */
+extern int execute_close_hooks (const struct fd_hook *remaining_list,
+                                gl_close_fn primary,
+                                int fd);
+
+/* Execute all close hooks, with PRIMARY as "primary" method.
+   Return 0 or -1, like close() would do.  */
+extern int execute_all_close_hooks (gl_close_fn primary, int fd);
+
+/* This type of function applies a control request to FD, applying special
+   knowledge for the FD types it knows about, and calls
+   execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG)
+   for the other FD types.
+   In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
+   and PRIMARY is the "primary" method for ioctl().  */
+typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list,
+                              gl_ioctl_fn primary,
+                              int fd, int request, void *arg);
+
+/* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method.
+   Return 0 or -1, like ioctl() would do.  */
+extern int execute_ioctl_hooks (const struct fd_hook *remaining_list,
+                                gl_ioctl_fn primary,
+                                int fd, int request, void *arg);
+
+/* Execute all ioctl hooks, with PRIMARY as "primary" method.
+   Return 0 or -1, like ioctl() would do.  */
+extern int execute_all_ioctl_hooks (gl_ioctl_fn primary,
+                                    int fd, int request, void *arg);
+
+/* Add a function pair to the list of file descriptor hooks.
+   CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change.
+   The LINK variable points to a piece of memory which is guaranteed to be
+   accessible until the corresponding call to unregister_fd_hook.  */
+extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook,
+                              struct fd_hook *link);
+
+/* Removes a hook from the list of file descriptor hooks.  */
+extern void unregister_fd_hook (struct fd_hook *link);
+
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FD_HOOK_H */
deleted file mode 120000 (symlink)
index 0aea051620c2bcff99d1c8a72818f2444c688c41..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fd-safer-flag.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4cd1b148d8bdd2db2364cc8abc3609503219fb67
--- /dev/null
@@ -0,0 +1,52 @@
+/* Adjust a file descriptor result so that it avoids clobbering
+   STD{IN,OUT,ERR}_FILENO, with specific flags.
+
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Eric Blake.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistd-safer.h"
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return FD, unless FD would be a copy of standard input, output, or
+   error; in that case, return a duplicate of FD, closing FD.  If FLAG
+   contains O_CLOEXEC, the returned FD will have close-on-exec
+   semantics.  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_flag (open ("file", O_RDONLY | flag), flag).  */
+
+int
+fd_safer_flag (int fd, int flag)
+{
+  if (STDIN_FILENO <= fd && fd <= STDERR_FILENO)
+    {
+      int f = dup_safer_flag (fd, flag);
+      int e = errno;
+      close (fd);
+      errno = e;
+      fd = f;
+    }
+
+  return fd;
+}
deleted file mode 120000 (symlink)
index ab63a8797424dd4d99770fac9cf61f76fab8da40..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fd-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8d624337b882669fcc5bb5ea3192b2e5f80a36fd
--- /dev/null
@@ -0,0 +1,49 @@
+/* Return a safer copy of a file descriptor.
+
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "unistd-safer.h"
+
+#include <errno.h>
+#include <unistd.h>
+
+/* 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;
+}
deleted file mode 120000 (symlink)
index 72a83297899080ad9bf34081ccdd21f9d91c467e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fdatasync.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2cdf9cb41cfea40aad4bf4309aae322318441bcf
--- /dev/null
@@ -0,0 +1,27 @@
+/* Emulate fdatasync on platforms that lack it.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+#include <unistd.h>
+
+int
+fdatasync (int fd)
+{
+  /* This does more work than strictly necessary, but is the best we
+     can do portably.  */
+  return fsync (fd);
+}
deleted file mode 120000 (symlink)
index dfac37c5bf365f0a12dd8fcb2d7487814f2a6eea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fdopen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5a8cd535d13157bd57bcc30c4c7f0f945bdacc6b
--- /dev/null
@@ -0,0 +1,73 @@
+/* Open a stream with a given file descriptor.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#undef fdopen
+
+#if defined _WIN32 && !defined __CYGWIN__
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static FILE *
+fdopen_nothrow (int fd, const char *mode)
+{
+  FILE *result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _fdopen (fd, mode);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = NULL;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+# else
+#  define fdopen_nothrow _fdopen
+# endif
+#else
+# define fdopen_nothrow fdopen
+#endif
+
+FILE *
+rpl_fdopen (int fd, const char *mode)
+{
+  int saved_errno = errno;
+  FILE *fp;
+
+  errno = 0;
+  fp = fdopen_nothrow (fd, mode);
+  if (fp == NULL)
+    {
+      if (errno == 0)
+        errno = EBADF;
+    }
+  else
+    errno = saved_errno;
+
+  return fp;
+}
deleted file mode 120000 (symlink)
index d9b3e7e00c102cf66bd8f53e4e6a66fbdffa3028..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fdopendir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bdbb2ea912fbc3da700fe125e1201b28318a3c60
--- /dev/null
@@ -0,0 +1,238 @@
+/* provide a replacement fdopendir function
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <dirent.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#if !HAVE_FDOPENDIR
+
+# if GNULIB_defined_DIR
+/* We are in control of the file descriptor of a DIR.  */
+
+#  include "dirent-private.h"
+
+#  if !REPLACE_FCHDIR
+#   error "unexpected configuration: GNULIB_defined_DIR but fchdir not replaced"
+#  endif
+
+DIR *
+fdopendir (int fd)
+{
+  char const *name = _gl_directory_name (fd);
+  DIR *dirp = name ? opendir (name) : NULL;
+  if (dirp != NULL)
+    dirp->fd_to_close = fd;
+  return dirp;
+}
+
+# else
+/* We are not in control of the file descriptor of a DIR, and therefore have to
+   play tricks with file descriptors before and after a call to opendir().  */
+
+#  include "openat.h"
+#  include "openat-priv.h"
+#  include "save-cwd.h"
+
+#  if GNULIB_DIRENT_SAFER
+#   include "dirent--.h"
+#  endif
+
+#  ifndef REPLACE_FCHDIR
+#   define REPLACE_FCHDIR 0
+#  endif
+
+static DIR *fdopendir_with_dup (int, int, struct saved_cwd const *);
+static DIR *fd_clone_opendir (int, struct saved_cwd const *);
+
+/* Replacement for POSIX fdopendir.
+
+   First, try to simulate it via opendir ("/proc/self/fd/...").  Failing
+   that, simulate it by using fchdir metadata, or 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.
+
+   If successful, the resulting stream is based on FD in
+   implementations where streams are based on file descriptors and in
+   applications where no other thread or signal handler allocates or
+   frees file descriptors.  In other cases, consult dirfd on the result
+   to find out whether FD is still being used.
+
+   Otherwise, this function works just like POSIX fdopendir.
+
+   W A R N I N G:
+
+   Unlike other fd-related functions, this one places constraints on FD.
+   If this function returns successfully, FD is under control of the
+   dirent.h system, and the caller should not close or modify the state of
+   FD other than by the dirent.h functions.  */
+DIR *
+fdopendir (int fd)
+{
+  DIR *dir = fdopendir_with_dup (fd, -1, NULL);
+
+  if (! REPLACE_FCHDIR && ! dir)
+    {
+      int saved_errno = errno;
+      if (EXPECTED_ERRNO (saved_errno))
+        {
+          struct saved_cwd cwd;
+          if (save_cwd (&cwd) != 0)
+            openat_save_fail (errno);
+          dir = fdopendir_with_dup (fd, -1, &cwd);
+          saved_errno = errno;
+          free_cwd (&cwd);
+          errno = saved_errno;
+        }
+    }
+
+  return dir;
+}
+
+/* Like fdopendir, except that if OLDER_DUPFD is not -1, it is known
+   to be a dup of FD which is less than FD - 1 and which will be
+   closed by the caller and not otherwise used by the caller.  This
+   function makes sure that FD is closed and all file descriptors less
+   than FD are open, and then calls fd_clone_opendir on a dup of FD.
+   That way, barring race conditions, fd_clone_opendir returns a
+   stream whose file descriptor is FD.
+
+   If REPLACE_FCHDIR or CWD is null, use opendir ("/proc/self/fd/...",
+   falling back on fchdir metadata.  Otherwise, CWD is a saved version
+   of the working directory; use fchdir/opendir(".")/restore_cwd(CWD).  */
+static DIR *
+fdopendir_with_dup (int fd, int older_dupfd, struct saved_cwd const *cwd)
+{
+  int dupfd = dup (fd);
+  if (dupfd < 0 && errno == EMFILE)
+    dupfd = older_dupfd;
+  if (dupfd < 0)
+    return NULL;
+  else
+    {
+      DIR *dir;
+      int saved_errno;
+      if (dupfd < fd - 1 && dupfd != older_dupfd)
+        {
+          dir = fdopendir_with_dup (fd, dupfd, cwd);
+          saved_errno = errno;
+        }
+      else
+        {
+          close (fd);
+          dir = fd_clone_opendir (dupfd, cwd);
+          saved_errno = errno;
+          if (! dir)
+            {
+              int fd1 = dup (dupfd);
+              if (fd1 != fd)
+                openat_save_fail (fd1 < 0 ? errno : EBADF);
+            }
+        }
+
+      if (dupfd != older_dupfd)
+        close (dupfd);
+      errno = saved_errno;
+      return dir;
+    }
+}
+
+/* Like fdopendir, except the result controls a clone of FD.  It is
+   the caller's responsibility both to close FD and (if the result is
+   not null) to closedir the result.  */
+static DIR *
+fd_clone_opendir (int fd, struct saved_cwd const *cwd)
+{
+  if (REPLACE_FCHDIR || ! cwd)
+    {
+      DIR *dir = NULL;
+      int saved_errno = EOPNOTSUPP;
+      char buf[OPENAT_BUFFER_SIZE];
+      char *proc_file = openat_proc_name (buf, fd, ".");
+      if (proc_file)
+        {
+          dir = opendir (proc_file);
+          saved_errno = errno;
+          if (proc_file != buf)
+            free (proc_file);
+        }
+#  if REPLACE_FCHDIR
+      if (! dir && EXPECTED_ERRNO (saved_errno))
+        {
+          char const *name = _gl_directory_name (fd);
+          DIR *dp = name ? opendir (name) : NULL;
+
+          /* The caller has done an elaborate dance to arrange for opendir to
+             consume just the right file descriptor.  If dirfd returns -1,
+             though, we're on a system like mingw where opendir does not
+             consume a file descriptor.  Consume it via 'dup' instead.  */
+          if (dp && dirfd (dp) < 0)
+            dup (fd);
+
+          return dp;
+        }
+#  endif
+      errno = saved_errno;
+      return dir;
+    }
+  else
+    {
+      if (fchdir (fd) != 0)
+        return NULL;
+      else
+        {
+          DIR *dir = opendir (".");
+          int saved_errno = errno;
+          if (restore_cwd (cwd) != 0)
+            openat_restore_fail (errno);
+          errno = saved_errno;
+          return dir;
+        }
+    }
+}
+
+# endif
+
+#else /* HAVE_FDOPENDIR */
+
+# include <errno.h>
+# include <sys/stat.h>
+
+# undef fdopendir
+
+/* Like fdopendir, but work around GNU/Hurd bug by validating FD.  */
+
+DIR *
+rpl_fdopendir (int fd)
+{
+  struct stat st;
+  if (fstat (fd, &st))
+    return NULL;
+  if (!S_ISDIR (st.st_mode))
+    {
+      errno = ENOTDIR;
+      return NULL;
+    }
+  return fdopendir (fd);
+}
+
+#endif /* HAVE_FDOPENDIR */
deleted file mode 120000 (symlink)
index 14a0dc6b4fdd23175ed55bbc15f7b11ed2fc6770..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fdutimensat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7adfeacb0cb21b4350e6ddf74d67517e0346be06
--- /dev/null
@@ -0,0 +1,57 @@
+/* Set file access and modification times.
+
+   Copyright (C) 2009-2024 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 any
+   later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+/* derived from a function in utimens.c */
+
+#include <config.h>
+
+#include "utimens.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* Set the access and modification timestamps of FD (a.k.a. FILE) to be
+   TIMESPEC[0] and TIMESPEC[1], respectively; relative to directory DIR.
+   FD must be either negative -- in which case it is ignored --
+   or a file descriptor that is open on FILE.
+   If FD is nonnegative, then FILE can be NULL, which means
+   use just futimes (or equivalent) instead of utimes (or equivalent),
+   and fail if on an old system without futimes (or equivalent).
+   If TIMESPEC is null, set the timestamps to the current time.
+   ATFLAG is passed to utimensat if FD is negative or futimens was
+   unsupported, which can allow operation on FILE as a symlink.
+   Return 0 on success, -1 (setting errno) on failure.  */
+
+int
+fdutimensat (int fd, int dir, char const *file, struct timespec const ts[2],
+             int atflag)
+{
+  int result = 1;
+  if (0 <= fd)
+    result = futimens (fd, ts);
+  if (file && (fd < 0 || (result == -1 && errno == ENOSYS)))
+    result = utimensat (dir, file, ts, atflag);
+  if (result == 1)
+    {
+      errno = EBADF;
+      result = -1;
+    }
+  return result;
+}
deleted file mode 120000 (symlink)
index 1152e1784e0687a49bf48bd30398986419b8e3b6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fflush.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..36cc14d1f68e6385185e86a758e34cea2788e117
--- /dev/null
@@ -0,0 +1,233 @@
+/* fflush.c -- allow flushing input streams
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake. */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "freading.h"
+
+#include "stdio-impl.h"
+
+#undef fflush
+
+
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+/* GNU libc, BeOS, Haiku, Linux libc5 */
+
+/* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
+static void
+clear_ungetc_buffer_preserving_position (FILE *fp)
+{
+  if (fp->_flags & _IO_IN_BACKUP)
+    /* _IO_free_backup_area is a bit complicated.  Simply call fseek.  */
+    fseeko (fp, 0, SEEK_CUR);
+}
+
+#else
+
+/* Clear the stream's ungetc buffer.  May modify the value of ftello (fp).  */
+static void
+clear_ungetc_buffer (FILE *fp)
+{
+# if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+  if (HASUB (fp))
+    {
+      fp_->_p += fp_->_r;
+      fp_->_r = 0;
+    }
+# elif defined __EMX__              /* emx+gcc */
+  if (fp->_ungetc_count > 0)
+    {
+      fp->_ungetc_count = 0;
+      fp->_rcount = - fp->_rcount;
+    }
+# elif defined _IOERR               /* Minix, AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+  /* Nothing to do.  */
+# else                              /* other implementations */
+  fseeko (fp, 0, SEEK_CUR);
+# endif
+}
+
+#endif
+
+#if ! (defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1)
+/* GNU libc, BeOS, Haiku, Linux libc5 */
+
+# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
+/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+
+static int
+disable_seek_optimization (FILE *fp)
+{
+  int saved_flags = fp_->_flags & (__SOPT | __SNPT);
+  fp_->_flags = (fp_->_flags & ~__SOPT) | __SNPT;
+  return saved_flags;
+}
+
+static void
+restore_seek_optimization (FILE *fp, int saved_flags)
+{
+  fp_->_flags = (fp_->_flags & ~(__SOPT | __SNPT)) | saved_flags;
+}
+
+# else
+
+static void
+update_fpos_cache (_GL_ATTRIBUTE_MAYBE_UNUSED FILE *fp,
+                   _GL_ATTRIBUTE_MAYBE_UNUSED off_t pos)
+{
+#  if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+#   if defined __CYGWIN__ || defined __ANDROID__
+  /* fp_->_offset is typed as an integer.  */
+  fp_->_offset = pos;
+#   else
+  /* fp_->_offset is an fpos_t.  */
+  /* Use a union, since on NetBSD, the compilation flags determine
+     whether fpos_t is typedef'd to off_t or a struct containing a
+     single off_t member.  */
+  union
+    {
+      fpos_t f;
+      off_t o;
+    } u;
+  u.o = pos;
+  fp_->_offset = u.f;
+#   endif
+  fp_->_flags |= __SOFF;
+#  endif
+}
+# endif
+#endif
+
+/* Flush all pending data on STREAM according to POSIX rules.  Both
+   output and seekable input streams are supported.  */
+int
+rpl_fflush (FILE *stream)
+{
+  /* When stream is NULL, POSIX and C99 only require flushing of "output
+     streams and update streams in which the most recent operation was not
+     input", and all implementations do this.
+
+     When stream is "an output stream or an update stream in which the most
+     recent operation was not input", POSIX and C99 requires that fflush
+     writes out any buffered data, and all implementations do this.
+
+     When stream is, however, an input stream or an update stream in
+     which the most recent operation was input, C99 specifies nothing,
+     and POSIX only specifies behavior if the stream is seekable.
+     mingw, in particular, drops the input buffer, leaving the file
+     descriptor positioned at the end of the input buffer. I.e. ftell
+     (stream) is lost.  We don't want to call the implementation's
+     fflush in this case.
+
+     We test ! freading (stream) here, rather than fwriting (stream), because
+     what we need to know is whether the stream holds a "read buffer", and on
+     mingw this is indicated by _IOREAD, regardless of _IOWRT.  */
+  if (stream == NULL || ! freading (stream))
+    return fflush (stream);
+
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+  /* GNU libc, BeOS, Haiku, Linux libc5 */
+
+  clear_ungetc_buffer_preserving_position (stream);
+
+  return fflush (stream);
+
+#else
+  {
+    /* What POSIX says:
+       1) About the file-position indicator (-> fseeko, ftello):
+          The file position indicator is incremented by fgetc() and decremented
+          by ungetc():
+          <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fgetc.html>
+            "... the fgetc() function shall ... advance the associated file
+             position indicator for the stream ..."
+          <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ungetc.html>
+            "The file-position indicator is decremented by each successful
+             call to ungetc()..."
+       2) fflush discards bytes pushed back by ungetc:
+          <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html>
+            "...any characters pushed back onto the stream by ungetc()
+             or ungetwc() that have not subsequently been read from the
+             stream shall be discarded..."
+          This implies implicitly: fflush does not change the file position
+          indicator.
+       3) Effects on the file descriptor, if the file descriptor is capable of
+          seeking:
+          <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html>
+            "...the file offset of the underlying open file description shall
+             be set to the file position of the stream..."  */
+
+    /* POSIX does not specify fflush behavior for non-seekable input
+       streams.  Some implementations purge unread data, some return
+       EBADF, some do nothing.  */
+    off_t pos = ftello (stream);
+    if (pos == -1)
+      {
+        errno = EBADF;
+        return EOF;
+      }
+
+    /* Clear the ungetc buffer.  */
+    clear_ungetc_buffer (stream);
+
+    /* To get here, we must be flushing a seekable input stream, so the
+       semantics of fpurge are now appropriate to clear the buffer.  To
+       avoid losing data, the lseek is also necessary.  */
+    {
+      int result = fpurge (stream);
+      if (result != 0)
+        return result;
+    }
+
+# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
+    /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+
+    {
+      /* Disable seek optimization for the next fseeko call.  This tells the
+         following fseeko call to seek to the desired position directly, rather
+         than to seek to a block-aligned boundary.  */
+      int saved_flags = disable_seek_optimization (stream);
+      int result = fseeko (stream, pos, SEEK_SET);
+
+      restore_seek_optimization (stream, saved_flags);
+      return result;
+    }
+
+# else
+
+    pos = lseek (fileno (stream), pos, SEEK_SET);
+    if (pos == -1)
+      return EOF;
+    /* After a successful lseek, update the file descriptor's position cache
+       in the stream.  */
+    update_fpos_cache (stream, pos);
+
+    return 0;
+
+# endif
+  }
+#endif
+}
deleted file mode 120000 (symlink)
index c13a4f3d5ec77ae73bfdfd2e38c20f08aa24f4a5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/file-has-acl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..898fb030d1de9b9f6e886e099f29c98b31310c58
--- /dev/null
@@ -0,0 +1,684 @@
+/* Test whether a file has a nontrivial ACL.  -*- coding: utf-8 -*-
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible.  */
+
+/* Without this pragma, gcc 4.7.0 20120126 may suggest that the
+   file_has_acl function might be candidate for attribute 'const'  */
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
+#endif
+
+#include <config.h>
+
+#include "acl.h"
+
+#include "acl-internal.h"
+#include "attribute.h"
+#include "minmax.h"
+
+#if USE_ACL && HAVE_LINUX_XATTR_H && HAVE_LISTXATTR
+# include <stdckdint.h>
+# include <string.h>
+# include <arpa/inet.h>
+# include <sys/xattr.h>
+# include <linux/xattr.h>
+# ifndef XATTR_NAME_NFSV4_ACL
+#  define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
+# endif
+# ifndef XATTR_NAME_POSIX_ACL_ACCESS
+#  define XATTR_NAME_POSIX_ACL_ACCESS "system.posix_acl_access"
+# endif
+# ifndef XATTR_NAME_POSIX_ACL_DEFAULT
+#  define XATTR_NAME_POSIX_ACL_DEFAULT "system.posix_acl_default"
+# endif
+
+enum {
+  /* ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000, */
+  ACE4_ACCESS_DENIED_ACE_TYPE  = 0x00000001,
+  ACE4_IDENTIFIER_GROUP        = 0x00000040
+};
+
+/* Return true if ATTR is in the set represented by the NUL-terminated
+   strings in LISTBUF, which is of size LISTSIZE.  */
+
+ATTRIBUTE_PURE static bool
+have_xattr (char const *attr, char const *listbuf, ssize_t listsize)
+{
+  char const *blim = listbuf + listsize;
+  for (char const *b = listbuf; b < blim; b += strlen (b) + 1)
+    for (char const *a = attr; *a == *b; a++, b++)
+      if (!*a)
+        return true;
+  return false;
+}
+
+/* Return 1 if given ACL in XDR format is non-trivial, 0 if it is trivial.
+   -1 upon failure to determine it.  Possibly change errno.  Assume that
+   the ACL is valid, except avoid undefined behavior even if invalid.
+
+   See <https://linux.die.net/man/5/nfs4_acl>.  The NFSv4 acls are
+   defined in Internet RFC 7530 and as such, every NFSv4 server
+   supporting ACLs should support NFSv4 ACLs (they differ from from
+   POSIX draft ACLs).  The ACLs can be obtained via the
+   nfsv4-acl-tools, e.g., the nfs4_getfacl command.  Gnulib provides
+   only basic support of NFSv4 ACLs, i.e., recognize trivial vs
+   nontrivial ACLs.  */
+
+static int
+acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes)
+{
+  enum { BYTES_PER_NETWORK_UINT = 4};
+
+  /* Grab the number of aces in the acl.  */
+  nbytes -= BYTES_PER_NETWORK_UINT;
+  if (nbytes < 0)
+    return -1;
+  uint32_t num_aces = ntohl (*xattr++);
+  if (6 < num_aces)
+    return 1;
+  int ace_found = 0;
+
+  for (int ace_n = 0; ace_n < num_aces; ace_n++)
+    {
+      /* Get the acl type and flag.  Skip the mask; it's too risky to
+         test it and it does not seem to be needed.  Get the wholen.  */
+      nbytes -= 4 * BYTES_PER_NETWORK_UINT;
+      if (nbytes < 0)
+        return -1;
+      uint32_t type = ntohl (xattr[0]);
+      uint32_t flag = ntohl (xattr[1]);
+      uint32_t wholen = ntohl (xattr[3]);
+      xattr += 4;
+      int whowords = (wholen / BYTES_PER_NETWORK_UINT
+                      + (wholen % BYTES_PER_NETWORK_UINT != 0));
+      int64_t wholen4 = whowords;
+      wholen4 *= BYTES_PER_NETWORK_UINT;
+
+      /* Trivial ACLs have only ACE4_ACCESS_ALLOWED_ACE_TYPE or
+         ACE4_ACCESS_DENIED_ACE_TYPE.  */
+      if (ACE4_ACCESS_DENIED_ACE_TYPE < type)
+        return 1;
+
+      /* RFC 7530 says FLAG should be 0, but be generous to NetApp and
+         also accept the group flag.  */
+      if (flag & ~ACE4_IDENTIFIER_GROUP)
+        return 1;
+
+      /* Get the who string.  Check NBYTES - WHOLEN4 before storing
+         into NBYTES, to avoid truncation on conversion.  */
+      if (nbytes - wholen4 < 0)
+        return -1;
+      nbytes -= wholen4;
+
+      /* For a trivial ACL, max 6 (typically 3) ACEs, 3 allow, 3 deny.
+         Check that there is at most one ACE of each TYPE and WHO.  */
+      int who2
+        = (wholen == 6 && memcmp (xattr, "OWNER@", 6) == 0 ? 0
+           : wholen == 6 && memcmp (xattr, "GROUP@", 6) == 0 ? 2
+           : wholen == 9 && memcmp (xattr, "EVERYONE@", 9) == 0 ? 4
+           : -1);
+      if (who2 < 0)
+        return 1;
+      int ace_found_bit = 1 << (who2 | type);
+      if (ace_found & ace_found_bit)
+        return 1;
+      ace_found |= ace_found_bit;
+
+      xattr += whowords;
+    }
+
+  return 0;
+}
+#endif
+
+/* Return 1 if NAME has a nontrivial access control list,
+   0 if ACLs are not supported, or if NAME has no or only a base ACL,
+   and -1 (setting errno) on error.  Note callers can determine
+   if ACLs are not supported as errno is set in that case also.
+   SB must be set to the stat buffer of NAME,
+   obtained through stat() or lstat().  */
+
+int
+file_has_acl (char const *name, struct stat const *sb)
+{
+#if USE_ACL
+  if (! S_ISLNK (sb->st_mode))
+    {
+
+# if HAVE_LINUX_XATTR_H && HAVE_LISTXATTR
+      int initial_errno = errno;
+
+      /* The max length of a trivial NFSv4 ACL is 6 words for owner,
+         6 for group, 7 for everyone, all times 2 because there are
+         both allow and deny ACEs.  There are 6 words for owner
+         because of type, flag, mask, wholen, "OWNER@"+pad and
+         similarly for group; everyone is another word to hold
+         "EVERYONE@".  */
+      typedef uint32_t trivial_NFSv4_xattr_buf[2 * (6 + 6 + 7)];
+
+      /* A buffer large enough to hold any trivial NFSv4 ACL,
+         and also useful as a small array of char.  */
+      union {
+        trivial_NFSv4_xattr_buf xattr;
+        char ch[sizeof (trivial_NFSv4_xattr_buf)];
+      } stackbuf;
+
+      char *listbuf = stackbuf.ch;
+      ssize_t listbufsize = sizeof stackbuf.ch;
+      char *heapbuf = NULL;
+      ssize_t listsize;
+
+      /* Use listxattr first, as this means just one syscall in the
+         typical case where the file lacks an ACL.  Try stackbuf
+         first, falling back on malloc if stackbuf is too small.  */
+      while ((listsize = listxattr (name, listbuf, listbufsize)) < 0
+             && errno == ERANGE)
+        {
+          free (heapbuf);
+          ssize_t newsize = listxattr (name, NULL, 0);
+          if (newsize <= 0)
+            return newsize;
+
+          /* Grow LISTBUFSIZE to at least NEWSIZE.  Grow it by a
+             nontrivial amount too, to defend against denial of
+             service by an adversary that fiddles with ACLs.  */
+          bool overflow = ckd_add (&listbufsize, listbufsize, listbufsize >> 1);
+          listbufsize = MAX (listbufsize, newsize);
+          if (overflow || SIZE_MAX < listbufsize)
+            {
+              errno = ENOMEM;
+              return -1;
+            }
+
+          listbuf = heapbuf = malloc (listbufsize);
+          if (!listbuf)
+            return -1;
+        }
+
+      /* In Fedora 39, a file can have both NFSv4 and POSIX ACLs,
+         but if it has an NFSv4 ACL that's the one that matters.
+         In earlier Fedora the two types of ACLs were mutually exclusive.
+         Attempt to work correctly on both kinds of systems.  */
+      bool nfsv4_acl
+        = 0 < listsize && have_xattr (XATTR_NAME_NFSV4_ACL, listbuf, listsize);
+      int ret
+        = (listsize <= 0 ? listsize
+           : (nfsv4_acl
+              || have_xattr (XATTR_NAME_POSIX_ACL_ACCESS, listbuf, listsize)
+              || (S_ISDIR (sb->st_mode)
+                  && have_xattr (XATTR_NAME_POSIX_ACL_DEFAULT,
+                                 listbuf, listsize))));
+      free (heapbuf);
+
+      /* If there is an NFSv4 ACL, follow up with a getxattr syscall
+         to see whether the NFSv4 ACL is nontrivial.  */
+      if (nfsv4_acl)
+        {
+          ret = getxattr (name, XATTR_NAME_NFSV4_ACL,
+                          stackbuf.xattr, sizeof stackbuf.xattr);
+          if (ret < 0)
+            switch (errno)
+              {
+              case ENODATA: return 0;
+              case ERANGE : return 1; /* ACL must be nontrivial.  */
+              }
+          else
+            {
+              /* It looks like a trivial ACL, but investigate further.  */
+              ret = acl_nfs4_nontrivial (stackbuf.xattr, ret);
+              if (ret < 0)
+                {
+                  errno = EINVAL;
+                  return ret;
+                }
+              errno = initial_errno;
+            }
+        }
+      if (ret < 0)
+        return - acl_errno_valid (errno);
+      return ret;
+
+# elif HAVE_ACL_GET_FILE
+
+      /* POSIX 1003.1e (draft 17 -- abandoned) specific version.  */
+      /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+      int ret;
+
+      if (HAVE_ACL_EXTENDED_FILE) /* Linux */
+        {
+          /* On Linux, acl_extended_file is an optimized function: It only
+             makes two calls to getxattr(), one for ACL_TYPE_ACCESS, one for
+             ACL_TYPE_DEFAULT.  */
+          ret = acl_extended_file (name);
+        }
+      else /* FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+        {
+#  if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
+          /* On Mac OS X, acl_get_file (name, ACL_TYPE_ACCESS)
+             and acl_get_file (name, ACL_TYPE_DEFAULT)
+             always return NULL / EINVAL.  There is no point in making
+             these two useless calls.  The real ACL is retrieved through
+             acl_get_file (name, ACL_TYPE_EXTENDED).  */
+          acl_t acl = acl_get_file (name, ACL_TYPE_EXTENDED);
+          if (acl)
+            {
+              ret = acl_extended_nontrivial (acl);
+              acl_free (acl);
+            }
+          else
+            ret = -1;
+#  else /* FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */
+          acl_t acl = acl_get_file (name, ACL_TYPE_ACCESS);
+          if (acl)
+            {
+              int saved_errno;
+
+              ret = acl_access_nontrivial (acl);
+              saved_errno = errno;
+              acl_free (acl);
+              errno = saved_errno;
+#   if HAVE_ACL_FREE_TEXT /* Tru64 */
+              /* On OSF/1, acl_get_file (name, ACL_TYPE_DEFAULT) always
+                 returns NULL with errno not set.  There is no point in
+                 making this call.  */
+#   else /* FreeBSD, IRIX, Cygwin >= 2.5 */
+              /* On Linux, FreeBSD, IRIX, acl_get_file (name, ACL_TYPE_ACCESS)
+                 and acl_get_file (name, ACL_TYPE_DEFAULT) on a directory
+                 either both succeed or both fail; it depends on the
+                 file system.  Therefore there is no point in making the second
+                 call if the first one already failed.  */
+              if (ret == 0 && S_ISDIR (sb->st_mode))
+                {
+                  acl = acl_get_file (name, ACL_TYPE_DEFAULT);
+                  if (acl)
+                    {
+#    ifdef __CYGWIN__ /* Cygwin >= 2.5 */
+                      ret = acl_access_nontrivial (acl);
+                      saved_errno = errno;
+                      acl_free (acl);
+                      errno = saved_errno;
+#    else
+                      ret = (0 < acl_entries (acl));
+                      acl_free (acl);
+#    endif
+                    }
+                  else
+                    ret = -1;
+                }
+#   endif
+            }
+          else
+            ret = -1;
+#  endif
+        }
+      if (ret < 0)
+        return - acl_errno_valid (errno);
+      return ret;
+
+# elif HAVE_FACL && defined GETACL /* Solaris, Cygwin < 2.5, not HP-UX */
+
+#  if defined ACL_NO_TRIVIAL
+
+      /* Solaris 10 (newer version), which has additional API declared in
+         <sys/acl.h> (acl_t) and implemented in libsec (acl_set, acl_trivial,
+         acl_fromtext, ...).  */
+      return acl_trivial (name);
+
+#  else /* Solaris, Cygwin, general case */
+
+      /* Solaris 2.5 through Solaris 10, Cygwin, and contemporaneous versions
+         of Unixware.  The acl() call returns the access and default ACL both
+         at once.  */
+      {
+        /* Initially, try to read the entries into a stack-allocated buffer.
+           Use malloc if it does not fit.  */
+        enum
+          {
+            alloc_init = 4000 / sizeof (aclent_t), /* >= 3 */
+            alloc_max = MIN (INT_MAX, SIZE_MAX / sizeof (aclent_t))
+          };
+        aclent_t buf[alloc_init];
+        size_t alloc = alloc_init;
+        aclent_t *entries = buf;
+        aclent_t *malloced = NULL;
+        int count;
+
+        for (;;)
+          {
+            count = acl (name, GETACL, alloc, entries);
+            if (count < 0 && errno == ENOSPC)
+              {
+                /* Increase the size of the buffer.  */
+                free (malloced);
+                if (alloc > alloc_max / 2)
+                  {
+                    errno = ENOMEM;
+                    return -1;
+                  }
+                alloc = 2 * alloc; /* <= alloc_max */
+                entries = malloced =
+                  (aclent_t *) malloc (alloc * sizeof (aclent_t));
+                if (entries == NULL)
+                  {
+                    errno = ENOMEM;
+                    return -1;
+                  }
+                continue;
+              }
+            break;
+          }
+        if (count < 0)
+          {
+            if (errno == ENOSYS || errno == ENOTSUP)
+              ;
+            else
+              {
+                free (malloced);
+                return -1;
+              }
+          }
+        else if (count == 0)
+          ;
+        else
+          {
+            /* Don't use MIN_ACL_ENTRIES:  It's set to 4 on Cygwin, but Cygwin
+               returns only 3 entries for files with no ACL.  But this is safe:
+               If there are more than 4 entries, there cannot be only the
+               "user::", "group::", "other:", and "mask:" entries.  */
+            if (count > 4)
+              {
+                free (malloced);
+                return 1;
+              }
+
+            if (acl_nontrivial (count, entries))
+              {
+                free (malloced);
+                return 1;
+              }
+          }
+        free (malloced);
+      }
+
+#   ifdef ACE_GETACL
+      /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
+         file systems (whereas the other ones are used in UFS file systems).  */
+      {
+        /* Initially, try to read the entries into a stack-allocated buffer.
+           Use malloc if it does not fit.  */
+        enum
+          {
+            alloc_init = 4000 / sizeof (ace_t), /* >= 3 */
+            alloc_max = MIN (INT_MAX, SIZE_MAX / sizeof (ace_t))
+          };
+        ace_t buf[alloc_init];
+        size_t alloc = alloc_init;
+        ace_t *entries = buf;
+        ace_t *malloced = NULL;
+        int count;
+
+        for (;;)
+          {
+            count = acl (name, ACE_GETACL, alloc, entries);
+            if (count < 0 && errno == ENOSPC)
+              {
+                /* Increase the size of the buffer.  */
+                free (malloced);
+                if (alloc > alloc_max / 2)
+                  {
+                    errno = ENOMEM;
+                    return -1;
+                  }
+                alloc = 2 * alloc; /* <= alloc_max */
+                entries = malloced = (ace_t *) malloc (alloc * sizeof (ace_t));
+                if (entries == NULL)
+                  {
+                    errno = ENOMEM;
+                    return -1;
+                  }
+                continue;
+              }
+            break;
+          }
+        if (count < 0)
+          {
+            if (errno == ENOSYS || errno == EINVAL)
+              ;
+            else
+              {
+                free (malloced);
+                return -1;
+              }
+          }
+        else if (count == 0)
+          ;
+        else
+          {
+            /* In the old (original Solaris 10) convention:
+               If there are more than 3 entries, there cannot be only the
+               ACE_OWNER, ACE_GROUP, ACE_OTHER entries.
+               In the newer Solaris 10 and Solaris 11 convention:
+               If there are more than 6 entries, there cannot be only the
+               ACE_OWNER, ACE_GROUP, ACE_EVERYONE entries, each once with
+               NEW_ACE_ACCESS_ALLOWED_ACE_TYPE and once with
+               NEW_ACE_ACCESS_DENIED_ACE_TYPE.  */
+            if (count > 6)
+              {
+                free (malloced);
+                return 1;
+              }
+
+            if (acl_ace_nontrivial (count, entries))
+              {
+                free (malloced);
+                return 1;
+              }
+          }
+        free (malloced);
+      }
+#   endif
+
+      return 0;
+#  endif
+
+# elif HAVE_GETACL /* HP-UX */
+
+      {
+        struct acl_entry entries[NACLENTRIES];
+        int count;
+
+        count = getacl (name, NACLENTRIES, entries);
+
+        if (count < 0)
+          {
+            /* ENOSYS is seen on newer HP-UX versions.
+               EOPNOTSUPP is typically seen on NFS mounts.
+               ENOTSUP was seen on Quantum StorNext file systems (cvfs).  */
+            if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+              ;
+            else
+              return -1;
+          }
+        else if (count == 0)
+          return 0;
+        else /* count > 0 */
+          {
+            if (count > NACLENTRIES)
+              /* If NACLENTRIES cannot be trusted, use dynamic memory
+                 allocation.  */
+              abort ();
+
+            /* If there are more than 3 entries, there cannot be only the
+               (uid,%), (%,gid), (%,%) entries.  */
+            if (count > 3)
+              return 1;
+
+            {
+              struct stat statbuf;
+
+              if (stat (name, &statbuf) == -1 && errno != EOVERFLOW)
+                return -1;
+
+              return acl_nontrivial (count, entries);
+            }
+          }
+      }
+
+#  if HAVE_ACLV_H /* HP-UX >= 11.11 */
+
+      {
+        struct acl entries[NACLVENTRIES];
+        int count;
+
+        count = acl ((char *) name, ACL_GET, NACLVENTRIES, entries);
+
+        if (count < 0)
+          {
+            /* EOPNOTSUPP is seen on NFS in HP-UX 11.11, 11.23.
+               EINVAL is seen on NFS in HP-UX 11.31.  */
+            if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+              ;
+            else
+              return -1;
+          }
+        else if (count == 0)
+          return 0;
+        else /* count > 0 */
+          {
+            if (count > NACLVENTRIES)
+              /* If NACLVENTRIES cannot be trusted, use dynamic memory
+                 allocation.  */
+              abort ();
+
+            /* If there are more than 4 entries, there cannot be only the
+               four base ACL entries.  */
+            if (count > 4)
+              return 1;
+
+            return aclv_nontrivial (count, entries);
+          }
+      }
+
+#  endif
+
+# elif HAVE_ACLX_GET && defined ACL_AIX_WIP /* AIX */
+
+      acl_type_t type;
+      char aclbuf[1024];
+      void *acl = aclbuf;
+      size_t aclsize = sizeof (aclbuf);
+      mode_t mode;
+
+      for (;;)
+        {
+          /* The docs say that type being 0 is equivalent to ACL_ANY, but it
+             is not true, in AIX 5.3.  */
+          type.u64 = ACL_ANY;
+          if (aclx_get (name, 0, &type, aclbuf, &aclsize, &mode) >= 0)
+            break;
+          if (errno == ENOSYS)
+            return 0;
+          if (errno != ENOSPC)
+            {
+              if (acl != aclbuf)
+                free (acl);
+              return -1;
+            }
+          aclsize = 2 * aclsize;
+          if (acl != aclbuf)
+            free (acl);
+          acl = malloc (aclsize);
+          if (acl == NULL)
+            {
+              errno = ENOMEM;
+              return -1;
+            }
+        }
+
+      if (type.u64 == ACL_AIXC)
+        {
+          int result = acl_nontrivial ((struct acl *) acl);
+          if (acl != aclbuf)
+            free (acl);
+          return result;
+        }
+      else if (type.u64 == ACL_NFS4)
+        {
+          int result = acl_nfs4_nontrivial ((nfs4_acl_int_t *) acl);
+          if (acl != aclbuf)
+            free (acl);
+          return result;
+        }
+      else
+        {
+          /* A newer type of ACL has been introduced in the system.
+             We should better support it.  */
+          if (acl != aclbuf)
+            free (acl);
+          errno = EINVAL;
+          return -1;
+        }
+
+# elif HAVE_STATACL /* older AIX */
+
+      union { struct acl a; char room[4096]; } u;
+
+      if (statacl ((char *) name, STX_NORMAL, &u.a, sizeof (u)) < 0)
+        return -1;
+
+      return acl_nontrivial (&u.a);
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+
+      {
+        struct acl entries[NACLENTRIES];
+        int count;
+
+        count = acl ((char *) name, ACL_GET, NACLENTRIES, entries);
+
+        if (count < 0)
+          {
+            if (errno == ENOSYS || errno == ENOTSUP)
+              ;
+            else
+              return -1;
+          }
+        else if (count == 0)
+          return 0;
+        else /* count > 0 */
+          {
+            if (count > NACLENTRIES)
+              /* If NACLENTRIES cannot be trusted, use dynamic memory
+                 allocation.  */
+              abort ();
+
+            /* If there are more than 4 entries, there cannot be only the
+               four base ACL entries.  */
+            if (count > 4)
+              return 1;
+
+            return acl_nontrivial (count, entries);
+          }
+      }
+
+# endif
+    }
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 0906863d5a07beffab59b61fbf0ded6e6b36648e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/file-set.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..956c092d92db8da523db4b8808ff60ab53e14444
--- /dev/null
@@ -0,0 +1,74 @@
+/* Specialized functions to manipulate a set of files.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by 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 already 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);
+}
deleted file mode 120000 (symlink)
index ee35aef5921e875ecfb59e0f4fe18f521138cc77..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/file-set.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..17e89ca1544a03fa7e74b66eea187247c0ea9006
--- /dev/null
@@ -0,0 +1,32 @@
+/* Very specialized set-of-files code.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering, 2007.  */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "hash.h"
+
+extern void record_file (Hash_table *ht, char const *file,
+                         struct stat const *stats)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
+  __attribute__ ((__nonnull__ (2, 3)))
+#endif
+;
+
+extern bool seen_file (Hash_table const *ht, char const *file,
+                       struct stat const *stats);
deleted file mode 120000 (symlink)
index c8af7b1504068baaca441b50d4d137dee52b0307..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/file-type.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..657ca5c7f9441c05c6fcc263b579ffdeb7485ffd
--- /dev/null
@@ -0,0 +1,31 @@
+/* Return a string describing the type of a file.
+
+   Copyright (C) 1993-1994, 2001-2002, 2004-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "file-type.h"
+
+#include <gettext.h>
+
+char const *
+file_type (struct stat const *st)
+{
+  return gettext (c_file_type (st));
+}
deleted file mode 120000 (symlink)
index a69f415203fb7d5f34f7249b729e1fa537c2a8b8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/file-type.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7ca0357aef4228021aec2dd3b330506df3ea4504
--- /dev/null
@@ -0,0 +1,35 @@
+/* Return a string describing the type of a file.
+
+   Copyright (C) 1993-1994, 2001-2002, 2004-2005, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Jim Meyering.  */
+
+#ifndef FILE_TYPE_H
+# define FILE_TYPE_H 1
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <sys/types.h>
+# include <sys/stat.h>
+
+char const *c_file_type (struct stat const *) _GL_ATTRIBUTE_PURE;
+char const *file_type (struct stat const *) _GL_ATTRIBUTE_PURE;
+
+#endif /* FILE_TYPE_H */
deleted file mode 120000 (symlink)
index 5db589cf3d01eb23b0d410e7e3d27e2250d6b46d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fileblocks.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1be34d9085becf8184c397e7edacd81063533a17
--- /dev/null
@@ -0,0 +1,74 @@
+/* Convert file size to number of blocks on System V-like machines.
+
+   Copyright (C) 1990, 1997-1999, 2004-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Brian L. Matthews, blm@6sceng.UUCP. */
+
+#include <config.h>
+
+#include <sys/types.h>
+
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+#if !HAVE_STRUCT_STAT_ST_BLOCKS && !defined _POSIX_SOURCE && defined BSIZE
+
+# include <unistd.h>
+
+# ifndef NINDIR
+
+#  if defined __DJGPP__
+typedef long daddr_t; /* for disk address */
+#  endif
+
+/* Some SysV's, like Irix, seem to lack this.  Hope it's correct. */
+/* Number of inode pointers per indirect block. */
+#  define NINDIR (BSIZE / sizeof (daddr_t))
+# endif /* !NINDIR */
+
+/* Number of direct block addresses in an inode. */
+# define NDIR   10
+
+/* Return the number of 512-byte blocks in a file of SIZE bytes. */
+
+off_t
+st_blocks (off_t size)
+{
+  off_t datablks = size / 512 + (size % 512 != 0);
+  off_t indrblks = 0;
+
+  if (datablks > NDIR)
+    {
+      indrblks = (datablks - NDIR - 1) / NINDIR + 1;
+
+      if (datablks > NDIR + NINDIR)
+        {
+          indrblks += (datablks - NDIR - NINDIR - 1) / (NINDIR * NINDIR) + 1;
+
+          if (datablks > NDIR + NINDIR + NINDIR * NINDIR)
+            indrblks++;
+        }
+    }
+
+  return datablks + indrblks;
+}
+#else
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int textutils_fileblocks_unused;
+#endif
deleted file mode 120000 (symlink)
index b4f688cf19eb6c3875ef45a11ac4fa86e6ec90f1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/filemode.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9be6aad1878aacd9253bf5da9acd88ed046b1087
--- /dev/null
@@ -0,0 +1,166 @@
+/* filemode.c -- make a string describing file modes
+
+   Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2024 Free
+   Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "filemode.h"
+
+#if ! HAVE_DECL_STRMODE
+
+/* Return a character indicating the type of file described by
+   file mode BITS:
+   '-' regular file
+   'b' block special file
+   'c' character special file
+   'C' high performance ("contiguous data") file
+   'd' directory
+   'D' door
+   'l' symbolic link
+   'm' multiplexed file (7th edition Unix; obsolete)
+   'n' network special file (HP-UX)
+   'p' fifo (named pipe)
+   'P' port
+   's' socket
+   'w' whiteout (4.4BSD)
+   '?' some other file type  */
+
+static char
+ftypelet (mode_t bits)
+{
+  /* These are the most common, so test for them first.  */
+  if (S_ISREG (bits))
+    return '-';
+  if (S_ISDIR (bits))
+    return 'd';
+
+  /* Other letters standardized by POSIX 1003.1-2004.  */
+  if (S_ISBLK (bits))
+    return 'b';
+  if (S_ISCHR (bits))
+    return 'c';
+  if (S_ISLNK (bits))
+    return 'l';
+  if (S_ISFIFO (bits))
+    return 'p';
+
+  /* Other file types (though not letters) standardized by POSIX.  */
+  if (S_ISSOCK (bits))
+    return 's';
+
+  /* Nonstandard file types.  */
+  if (S_ISCTG (bits))
+    return 'C';
+  if (S_ISDOOR (bits))
+    return 'D';
+  if (S_ISMPB (bits) || S_ISMPC (bits) || S_ISMPX (bits))
+    return 'm';
+  if (S_ISNWK (bits))
+    return 'n';
+  if (S_ISPORT (bits))
+    return 'P';
+  if (S_ISWHT (bits))
+    return 'w';
+
+  return '?';
+}
+
+/* Like filemodestring, but rely only on MODE.  */
+
+void
+strmode (mode_t mode, char *str)
+{
+  str[0] = ftypelet (mode);
+  str[1] = mode & S_IRUSR ? 'r' : '-';
+  str[2] = mode & S_IWUSR ? 'w' : '-';
+  str[3] = (mode & S_ISUID
+            ? (mode & S_IXUSR ? 's' : 'S')
+            : (mode & S_IXUSR ? 'x' : '-'));
+  str[4] = mode & S_IRGRP ? 'r' : '-';
+  str[5] = mode & S_IWGRP ? 'w' : '-';
+  str[6] = (mode & S_ISGID
+            ? (mode & S_IXGRP ? 's' : 'S')
+            : (mode & S_IXGRP ? 'x' : '-'));
+  str[7] = mode & S_IROTH ? 'r' : '-';
+  str[8] = mode & S_IWOTH ? 'w' : '-';
+  str[9] = (mode & S_ISVTX
+            ? (mode & S_IXOTH ? 't' : 'T')
+            : (mode & S_IXOTH ? 'x' : '-'));
+  str[10] = ' ';
+  str[11] = '\0';
+}
+
+#endif /* ! HAVE_DECL_STRMODE */
+
+/* filemodestring - fill in string STR with an ls-style ASCII
+   representation of the st_mode field of file stats block STATP.
+   12 characters are stored in STR.
+   The characters stored in STR are:
+
+   0    File type, as in ftypelet above, except that other letters are used
+        for files whose type cannot be determined solely from st_mode:
+
+            'F' semaphore
+            'Q' message queue
+            'S' shared memory object
+            'T' typed memory object
+
+   1    'r' if the owner may read, '-' otherwise.
+
+   2    'w' if the owner may write, '-' otherwise.
+
+   3    'x' if the owner may execute, 's' if the file is
+        set-user-id, '-' otherwise.
+        'S' if the file is set-user-id, but the execute
+        bit isn't set.
+
+   4    'r' if group members may read, '-' otherwise.
+
+   5    'w' if group members may write, '-' otherwise.
+
+   6    'x' if group members may execute, 's' if the file is
+        set-group-id, '-' otherwise.
+        'S' if it is set-group-id but not executable.
+
+   7    'r' if any user may read, '-' otherwise.
+
+   8    'w' if any user may write, '-' otherwise.
+
+   9    'x' if any user may execute, 't' if the file is "sticky"
+        (will be retained in swap space after execution), '-'
+        otherwise.
+        'T' if the file is sticky but not executable.
+
+   10   ' ' for compatibility with 4.4BSD strmode,
+        since this interface does not support ACLs.
+
+   11   '\0'.  */
+
+void
+filemodestring (struct stat const *statp, char *str)
+{
+  strmode (statp->st_mode, str);
+
+  if (S_TYPEISSEM (statp))
+    str[0] = 'F';
+  else if (S_TYPEISMQ (statp))
+    str[0] = 'Q';
+  else if (S_TYPEISSHM (statp))
+    str[0] = 'S';
+  else if (S_TYPEISTMO (statp))
+    str[0] = 'T';
+}
deleted file mode 120000 (symlink)
index 1c1995f57eb321cbabe0b2107dc187df16baa4bf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/filemode.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2dee82f0be1e936eff6b6092b5dd3aee6fd247ba
--- /dev/null
@@ -0,0 +1,50 @@
+/* Make a string describing file modes.
+
+   Copyright (C) 1998-1999, 2003, 2006, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef FILEMODE_H_
+# define FILEMODE_H_
+
+/* This file uses HAVE_DECL_STRMODE.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <sys/types.h>
+# include <sys/stat.h>
+
+/* Get the declaration of strmode.  */
+# if HAVE_DECL_STRMODE
+#  include <string.h> /* Mac OS X, FreeBSD, OpenBSD */
+#  include <unistd.h> /* NetBSD */
+# endif
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if !HAVE_DECL_STRMODE
+extern void strmode (mode_t mode, char *str);
+# endif
+
+extern void filemodestring (struct stat const *statp, char *str);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index 1323612932ce04a43893b6be4a85ce24947263a8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/filename.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a2400a9dfe3948d511b53e2ac6e65c9ff42b75cf
--- /dev/null
@@ -0,0 +1,112 @@
+/* Basic filename support macros.
+   Copyright (C) 2001-2023 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* From Paul Eggert and Jim Meyering.  */
+
+#ifndef _FILENAME_H
+#define _FILENAME_H
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Filename support.
+   ISSLASH(C)                  tests whether C is a directory separator
+                               character.
+   HAS_DEVICE(Filename)        tests whether Filename contains a device
+                               specification.
+   FILE_SYSTEM_PREFIX_LEN(Filename)  length of the device specification
+                                     at the beginning of Filename,
+                                     index of the part consisting of
+                                     alternating components and slashes.
+   FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+                               1 when a non-empty device specification
+                               can be followed by an empty or relative
+                               part,
+                               0 when a non-empty device specification
+                               must be followed by a slash,
+                               0 when device specification don't exist.
+   IS_ABSOLUTE_FILE_NAME(Filename)
+                               tests whether Filename is independent of
+                               any notion of "current directory".
+   IS_RELATIVE_FILE_NAME(Filename)
+                               tests whether Filename may be concatenated
+                               to a directory filename.
+   Note: On native Windows, OS/2, DOS, "c:" is neither an absolute nor a
+   relative file name!
+   IS_FILE_NAME_WITH_DIR(Filename)  tests whether Filename contains a device
+                                    or directory specification.
+ */
+#if defined _WIN32 || defined __CYGWIN__ \
+    || defined __EMX__ || defined __MSDOS__ || defined __DJGPP__
+  /* Native Windows, Cygwin, OS/2, DOS */
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+  /* Internal macro: Tests whether a character is a drive letter.  */
+# define _IS_DRIVE_LETTER(C) \
+    (((C) >= 'A' && (C) <= 'Z') || ((C) >= 'a' && (C) <= 'z'))
+  /* Help the compiler optimizing it.  This assumes ASCII.  */
+# undef _IS_DRIVE_LETTER
+# define _IS_DRIVE_LETTER(C) \
+    (((unsigned int) (C) | ('a' - 'A')) - 'a' <= 'z' - 'a')
+# define HAS_DEVICE(Filename) \
+    (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':')
+# define FILE_SYSTEM_PREFIX_LEN(Filename) (HAS_DEVICE (Filename) ? 2 : 0)
+# ifdef __CYGWIN__
+#  define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
+# else
+   /* On native Windows, OS/2, DOS, the system has the notion of a
+      "current directory" on each drive.  */
+#  define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
+# endif
+# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+#  define IS_ABSOLUTE_FILE_NAME(Filename) \
+     ISSLASH ((Filename)[FILE_SYSTEM_PREFIX_LEN (Filename)])
+# else
+#  define IS_ABSOLUTE_FILE_NAME(Filename) \
+     (ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename))
+# endif
+# define IS_RELATIVE_FILE_NAME(Filename) \
+    (! (ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename)))
+# define IS_FILE_NAME_WITH_DIR(Filename) \
+    (strchr ((Filename), '/') != NULL || strchr ((Filename), '\\') != NULL \
+     || HAS_DEVICE (Filename))
+#else
+  /* Unix */
+# define ISSLASH(C) ((C) == '/')
+# define HAS_DEVICE(Filename) ((void) (Filename), 0)
+# define FILE_SYSTEM_PREFIX_LEN(Filename) ((void) (Filename), 0)
+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
+# define IS_ABSOLUTE_FILE_NAME(Filename) ISSLASH ((Filename)[0])
+# define IS_RELATIVE_FILE_NAME(Filename) (! ISSLASH ((Filename)[0]))
+# define IS_FILE_NAME_WITH_DIR(Filename) (strchr ((Filename), '/') != NULL)
+#endif
+
+/* Deprecated macros.  For backward compatibility with old users of the
+   'filename' module.  */
+#define IS_ABSOLUTE_PATH IS_ABSOLUTE_FILE_NAME
+#define IS_PATH_WITH_DIR IS_FILE_NAME_WITH_DIR
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FILENAME_H */
deleted file mode 120000 (symlink)
index 352ed517b4bef87b22dbb7ab586ec562915f2bb1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/filenamecat-lgpl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dc6d3468c865191d263e2edc39e10ef2bf848ab8
--- /dev/null
@@ -0,0 +1,90 @@
+/* Concatenate two arbitrary file names.
+
+   Copyright (C) 1996-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "filenamecat.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "basename-lgpl.h"
+#include "filename.h"
+
+#if ! HAVE_MEMPCPY && ! defined mempcpy
+# define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
+#endif
+
+/* Concatenate two file name components, DIR and BASE, in
+   newly-allocated storage and return the result.
+   The resulting file name F is such that the commands "ls F" and "(cd
+   DIR; ls ./BASE)" refer to the same file.  If necessary, put
+   a separator between DIR and BASE in the result.  Typically this
+   separator is "/", but in rare cases it might be ".".
+   In any case, if BASE_IN_RESULT is non-NULL, set
+   *BASE_IN_RESULT to point to the copy of BASE at the end of the
+   returned concatenation.
+
+   If malloc fails, return NULL with errno set.  */
+
+char *
+mfile_name_concat (char const *dir, char const *base, char **base_in_result)
+{
+  char const *dirbase = last_component (dir);
+  size_t dirbaselen = base_len (dirbase);
+  size_t dirlen = dirbase - dir + dirbaselen;
+  size_t baselen = strlen (base);
+  char sep = '\0';
+  if (dirbaselen)
+    {
+      /* DIR is not a file system root, so separate with / if needed.  */
+      if (! ISSLASH (dir[dirlen - 1]) && ! ISSLASH (*base))
+        sep = '/';
+    }
+  else if (ISSLASH (*base))
+    {
+      /* DIR is a file system root and BASE begins with a slash, so
+         separate with ".".  For example, if DIR is "/" and BASE is
+         "/foo" then return "/./foo", as "//foo" would be wrong on
+         some POSIX systems.  A fancier algorithm could omit "." in
+         some cases but is not worth the trouble.  */
+      sep = '.';
+    }
+
+  char *p_concat = malloc (dirlen + (sep != '\0')  + baselen + 1);
+  if (p_concat == NULL)
+    return NULL;
+
+  {
+    char *p;
+
+    p = mempcpy (p_concat, dir, dirlen);
+    *p = sep;
+    p += sep != '\0';
+
+    if (base_in_result)
+      *base_in_result = p;
+
+    p = mempcpy (p, base, baselen);
+    *p = '\0';
+  }
+
+  return p_concat;
+}
deleted file mode 120000 (symlink)
index 17aa724b6f38b57e326237d15eac055f4ea0d75f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/filenamecat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b0d0fe72e1bfa610d67e50d74d396b832ab45907
--- /dev/null
@@ -0,0 +1,41 @@
+/* Concatenate two arbitrary file names.
+
+   Copyright (C) 1996-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "filenamecat.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "xalloc.h"
+
+/* Just like mfile_name_concat (filenamecat-lgpl.c), except, rather than
+   returning NULL upon malloc failure, here, we report the
+   "memory exhausted" condition and exit.  */
+
+char *
+file_name_concat (char const *dir, char const *base, char **base_in_result)
+{
+  char *p = mfile_name_concat (dir, base, base_in_result);
+  if (p == NULL)
+    xalloc_die ();
+  return p;
+}
deleted file mode 120000 (symlink)
index c5235703004edc1b2af8d40aade5a399a347f8ee..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/filenamecat.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8c8cf44199d1fcd586ebbe7edcf45987efcb1e7b
--- /dev/null
@@ -0,0 +1,37 @@
+/* Concatenate two arbitrary file names.
+
+   Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+/* This file uses _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_RETURNS_NONNULL.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdlib.h>
+
+#if GNULIB_FILENAMECAT
+char *file_name_concat (char const *dir, char const *base,
+                        char **base_in_result)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+#endif
+
+char *mfile_name_concat (char const *dir, char const *base,
+                         char **base_in_result)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
deleted file mode 120000 (symlink)
index 890a045fce6bd85b80b1a20642e0bdb5108f5679..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/filevercmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..88745b5f1d42691ed3b98496ea2cd4f46594ae49
--- /dev/null
@@ -0,0 +1,188 @@
+/* Compare file names containing version numbers.
+
+   Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
+   Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+#include "filevercmp.h"
+
+#include <c-ctype.h>
+#include <limits.h>
+#include <idx.h>
+
+/* Return the length of a prefix of S that corresponds to the suffix
+   defined by this extended regular expression in the C locale:
+     (\.[A-Za-z~][A-Za-z0-9~]*)*$
+   Use the longest suffix matching this regular expression,
+   except do not use all of S as a suffix if S is nonempty.
+   If *LEN is -1, S is a string; set *LEN to S's length.
+   Otherwise, *LEN should be nonnegative, S is a char array,
+   and *LEN does not change.  */
+static idx_t
+file_prefixlen (char const *s, ptrdiff_t *len)
+{
+  size_t n = *len;  /* SIZE_MAX if N == -1.  */
+  idx_t prefixlen = 0;
+
+  for (idx_t i = 0; ; )
+    {
+      if (*len < 0 ? !s[i] : i == n)
+        {
+          *len = i;
+          return prefixlen;
+        }
+
+      i++;
+      prefixlen = i;
+      while (i + 1 < n && s[i] == '.' && (c_isalpha (s[i + 1])
+                                          || s[i + 1] == '~'))
+        for (i += 2; i < n && (c_isalnum (s[i]) || s[i] == '~'); i++)
+          continue;
+    }
+}
+
+/* Return a version sort comparison value for S's byte at position POS.
+   S has length LEN.  If POS == LEN, sort before all non-'~' bytes.  */
+
+static int
+order (char const *s, idx_t pos, idx_t len)
+{
+  if (pos == len)
+    return -1;
+
+  unsigned char c = s[pos];
+  if (c_isdigit (c))
+    return 0;
+  else if (c_isalpha (c))
+    return c;
+  else if (c == '~')
+    return -2;
+  else
+    {
+      static_assert (UCHAR_MAX <= (INT_MAX - 1 - 2) / 2);
+      return c + UCHAR_MAX + 1;
+    }
+}
+
+/* slightly modified verrevcmp function from dpkg
+   S1, S2 - compared char array
+   S1_LEN, S2_LEN - length of arrays to be scanned
+
+   This implements the algorithm for comparison of version strings
+   specified by Debian and now widely adopted.  The detailed
+   specification can be found in the Debian Policy Manual in the
+   section on the 'Version' control field.  This version of the code
+   implements that from s5.6.12 of Debian Policy v3.8.0.1
+   https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version */
+static int _GL_ATTRIBUTE_PURE
+verrevcmp (const char *s1, idx_t s1_len, const char *s2, idx_t s2_len)
+{
+  idx_t s1_pos = 0;
+  idx_t s2_pos = 0;
+  while (s1_pos < s1_len || s2_pos < s2_len)
+    {
+      int first_diff = 0;
+      while ((s1_pos < s1_len && !c_isdigit (s1[s1_pos]))
+             || (s2_pos < s2_len && !c_isdigit (s2[s2_pos])))
+        {
+          int s1_c = order (s1, s1_pos, s1_len);
+          int s2_c = order (s2, s2_pos, s2_len);
+          if (s1_c != s2_c)
+            return s1_c - s2_c;
+          s1_pos++;
+          s2_pos++;
+        }
+      while (s1_pos < s1_len && s1[s1_pos] == '0')
+        s1_pos++;
+      while (s2_pos < s2_len && s2[s2_pos] == '0')
+        s2_pos++;
+      while (s1_pos < s1_len && s2_pos < s2_len
+             && c_isdigit (s1[s1_pos]) && c_isdigit (s2[s2_pos]))
+        {
+          if (!first_diff)
+            first_diff = s1[s1_pos] - s2[s2_pos];
+          s1_pos++;
+          s2_pos++;
+        }
+      if (s1_pos < s1_len && c_isdigit (s1[s1_pos]))
+        return 1;
+      if (s2_pos < s2_len && c_isdigit (s2[s2_pos]))
+        return -1;
+      if (first_diff)
+        return first_diff;
+    }
+  return 0;
+}
+
+/* Compare version strings S1 and S2.
+   See filevercmp.h for function description.  */
+int
+filevercmp (const char *s1, const char *s2)
+{
+  return filenvercmp (s1, -1, s2, -1);
+}
+
+/* Compare versions A (of length ALEN) and B (of length BLEN).
+   See filevercmp.h for function description.  */
+int
+filenvercmp (char const *a, ptrdiff_t alen, char const *b, ptrdiff_t blen)
+{
+  /* Special case for empty versions.  */
+  bool aempty = alen < 0 ? !a[0] : !alen;
+  bool bempty = blen < 0 ? !b[0] : !blen;
+  if (aempty)
+    return -!bempty;
+  if (bempty)
+    return 1;
+
+  /* Special cases for leading ".": "." sorts first, then "..", then
+     other names with leading ".", then other names.  */
+  if (a[0] == '.')
+    {
+      if (b[0] != '.')
+        return -1;
+
+      bool adot = alen < 0 ? !a[1] : alen == 1;
+      bool bdot = blen < 0 ? !b[1] : blen == 1;
+      if (adot)
+        return -!bdot;
+      if (bdot)
+        return 1;
+
+      bool adotdot = a[1] == '.' && (alen < 0 ? !a[2] : alen == 2);
+      bool bdotdot = b[1] == '.' && (blen < 0 ? !b[2] : blen == 2);
+      if (adotdot)
+        return -!bdotdot;
+      if (bdotdot)
+        return 1;
+    }
+  else if (b[0] == '.')
+    return 1;
+
+  /* Cut file suffixes.  */
+  idx_t aprefixlen = file_prefixlen (a, &alen);
+  idx_t bprefixlen = file_prefixlen (b, &blen);
+
+  /* If both suffixes are empty, a second pass would return the same thing.  */
+  bool one_pass_only = aprefixlen == alen && bprefixlen == blen;
+
+  int result = verrevcmp (a, aprefixlen, b, bprefixlen);
+
+  /* Return the initial result if nonzero, or if no second pass is needed.
+     Otherwise, restore the suffixes and try again.  */
+  return result || one_pass_only ? result : verrevcmp (a, alen, b, blen);
+}
deleted file mode 120000 (symlink)
index 3133eeeb04c5333651f7d1f81680e864018988f3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/filevercmp.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8c549fcda00730b12e58af1f71b64e87d194c424
--- /dev/null
@@ -0,0 +1,83 @@
+/* Compare file names containing version numbers.
+
+   Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
+   Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef FILEVERCMP_H
+#define FILEVERCMP_H
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+/* Compare strings A and B as file names containing version numbers,
+   and return an integer that is negative, zero, or positive depending
+   on whether A compares less than, equal to, or greater than B.
+
+   Use the following version sort algorithm:
+
+     1. Compare the strings' maximal-length non-digit prefixes lexically.
+        If there is a difference return that difference.
+        Otherwise discard the prefixes and continue with the next step.
+
+     2. Compare the strings' maximal-length digit prefixes, using
+        numeric comparison of the numbers represented by each prefix.
+        (Treat an empty prefix as zero; this can happen only at string end.)
+        If there is a difference, return that difference.
+        Otherwise discard the prefixes and continue with the next step.
+
+     3. If both strings are empty, return 0.  Otherwise continue with step 1.
+
+   In version sort, lexical comparison is left to right, byte by byte,
+   using the byte's numeric value (0-255), except that:
+
+     1. ASCII letters sort before other bytes.
+     2. A tilde sorts before anything, even an empty string.
+
+   In addition to the version sort rules, the following strings have
+   special priority and sort before all other strings (listed in order):
+
+     1. The empty string.
+     2. ".".
+     3. "..".
+     4. Strings starting with "." sort before other strings.
+
+   Before comparing two strings where both begin with non-".",
+   or where both begin with "." but neither is "." or "..",
+   suffixes matching the C-locale extended regular expression
+   (\.[A-Za-z~][A-Za-z0-9~]*)*$ are removed and the strings compared
+   without them, using version sort without special priority;
+   if they do not compare equal, this comparison result is used and
+   the suffixes are effectively ignored.  Otherwise, the entire
+   strings are compared using version sort.  When removing a suffix
+   from a nonempty string, remove the maximal-length suffix such that
+   the remaining string is nonempty.
+
+   This function is intended to be a replacement for strverscmp.  */
+int filevercmp (char const *a, char const *b) _GL_ATTRIBUTE_PURE;
+
+/* Like filevercmp, except compare the byte arrays A (of length ALEN)
+   and B (of length BLEN) so that A and B can contain '\0', which
+   sorts just before '\1'.  But if ALEN is -1 treat A as a string
+   terminated by '\0', and similarly for BLEN.  */
+int filenvercmp (char const *a, ptrdiff_t alen, char const *b, ptrdiff_t blen)
+  _GL_ATTRIBUTE_PURE;
+
+#endif /* FILEVERCMP_H */
deleted file mode 120000 (symlink)
index bcf79b97801faf3dd9b3ca23649f8cc8eb6f62bf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/flexmember.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6ef66a32d3227e89fc65388bb96c14606b7ae0d8
--- /dev/null
@@ -0,0 +1,76 @@
+/* Sizes of structs with flexible array members.
+
+   Copyright 2016-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert.  */
+
+/* This file uses _Alignof.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+/* Nonzero multiple of alignment of TYPE, suitable for FLEXSIZEOF below.
+   On older platforms without _Alignof, use a pessimistic bound that is
+   safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1.
+   On newer platforms, use _Alignof to get a tighter bound.  */
+
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+# define FLEXALIGNOF(type) (sizeof (type) & ~ (sizeof (type) - 1))
+#else
+# define FLEXALIGNOF(type) _Alignof (type)
+#endif
+
+/* Yield a properly aligned upper bound on the size of a struct of
+   type TYPE with a flexible array member named MEMBER that is
+   followed by N bytes of other data.  The result is suitable as an
+   argument to malloc.  For example:
+
+     struct s { int a; char d[FLEXIBLE_ARRAY_MEMBER]; };
+     struct s *p = malloc (FLEXSIZEOF (struct s, d, n * sizeof (char)));
+
+   FLEXSIZEOF (TYPE, MEMBER, N) is not simply (sizeof (TYPE) + N),
+   since FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms.  Nor is
+   it simply (offsetof (TYPE, MEMBER) + N), as that might yield a size
+   that causes malloc to yield a pointer that is not properly aligned
+   for TYPE; for example, if sizeof (int) == alignof (int) == 4,
+   malloc (offsetof (struct s, d) + 3 * sizeof (char)) is equivalent
+   to malloc (7) and might yield a pointer that is not a multiple of 4
+   (which means the pointer is not properly aligned for struct s),
+   whereas malloc (FLEXSIZEOF (struct s, d, 3 * sizeof (char))) is
+   equivalent to malloc (8) and must yield a pointer that is a
+   multiple of 4.
+
+   Yield a value less than N if and only if arithmetic overflow occurs.  */
+
+#define FLEXSIZEOF(type, member, n) \
+   ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \
+    & ~ (FLEXALIGNOF (type) - 1))
+
+/* Yield a properly aligned upper bound on the size of a struct of
+   type TYPE with a flexible array member named MEMBER that has N
+   elements.  The result is suitable as an argument to malloc.
+   For example:
+
+     struct s { int a; double d[FLEXIBLE_ARRAY_MEMBER]; };
+     struct s *p = malloc (FLEXNSIZEOF (struct s, d, n));
+ */
+#define FLEXNSIZEOF(type, member, n) \
+  FLEXSIZEOF (type, member, (n) * sizeof (((type *) 0)->member[0]))
deleted file mode 120000 (symlink)
index b1652efc216660c8ec63a8035e9d6f86ceb2a7fe..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/float+.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..104f477faa032201a71f6df6bb6e761d3d058825
--- /dev/null
@@ -0,0 +1,147 @@
+/* Supplemental information about the floating-point formats.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2007.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _FLOATPLUS_H
+#define _FLOATPLUS_H
+
+#include <float.h>
+#include <limits.h>
+
+/* Number of bits in the mantissa of a floating-point number, including the
+   "hidden bit".  */
+#if FLT_RADIX == 2
+# define FLT_MANT_BIT FLT_MANT_DIG
+# define DBL_MANT_BIT DBL_MANT_DIG
+# define LDBL_MANT_BIT LDBL_MANT_DIG
+#elif FLT_RADIX == 4
+# define FLT_MANT_BIT (FLT_MANT_DIG * 2)
+# define DBL_MANT_BIT (DBL_MANT_DIG * 2)
+# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2)
+#elif FLT_RADIX == 16
+# define FLT_MANT_BIT (FLT_MANT_DIG * 4)
+# define DBL_MANT_BIT (DBL_MANT_DIG * 4)
+# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4)
+#endif
+
+/* Bit mask that can be used to mask the exponent, as an unsigned number.  */
+#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7)
+#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
+#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)
+
+/* Number of bits used for the exponent of a floating-point number, including
+   the exponent's sign.  */
+#define FLT_EXP_BIT \
+  (FLT_EXP_MASK < 0x100 ? 8 : \
+   FLT_EXP_MASK < 0x200 ? 9 : \
+   FLT_EXP_MASK < 0x400 ? 10 : \
+   FLT_EXP_MASK < 0x800 ? 11 : \
+   FLT_EXP_MASK < 0x1000 ? 12 : \
+   FLT_EXP_MASK < 0x2000 ? 13 : \
+   FLT_EXP_MASK < 0x4000 ? 14 : \
+   FLT_EXP_MASK < 0x8000 ? 15 : \
+   FLT_EXP_MASK < 0x10000 ? 16 : \
+   FLT_EXP_MASK < 0x20000 ? 17 : \
+   FLT_EXP_MASK < 0x40000 ? 18 : \
+   FLT_EXP_MASK < 0x80000 ? 19 : \
+   FLT_EXP_MASK < 0x100000 ? 20 : \
+   FLT_EXP_MASK < 0x200000 ? 21 : \
+   FLT_EXP_MASK < 0x400000 ? 22 : \
+   FLT_EXP_MASK < 0x800000 ? 23 : \
+   FLT_EXP_MASK < 0x1000000 ? 24 : \
+   FLT_EXP_MASK < 0x2000000 ? 25 : \
+   FLT_EXP_MASK < 0x4000000 ? 26 : \
+   FLT_EXP_MASK < 0x8000000 ? 27 : \
+   FLT_EXP_MASK < 0x10000000 ? 28 : \
+   FLT_EXP_MASK < 0x20000000 ? 29 : \
+   FLT_EXP_MASK < 0x40000000 ? 30 : \
+   FLT_EXP_MASK <= 0x7fffffff ? 31 : \
+   32)
+#define DBL_EXP_BIT \
+  (DBL_EXP_MASK < 0x100 ? 8 : \
+   DBL_EXP_MASK < 0x200 ? 9 : \
+   DBL_EXP_MASK < 0x400 ? 10 : \
+   DBL_EXP_MASK < 0x800 ? 11 : \
+   DBL_EXP_MASK < 0x1000 ? 12 : \
+   DBL_EXP_MASK < 0x2000 ? 13 : \
+   DBL_EXP_MASK < 0x4000 ? 14 : \
+   DBL_EXP_MASK < 0x8000 ? 15 : \
+   DBL_EXP_MASK < 0x10000 ? 16 : \
+   DBL_EXP_MASK < 0x20000 ? 17 : \
+   DBL_EXP_MASK < 0x40000 ? 18 : \
+   DBL_EXP_MASK < 0x80000 ? 19 : \
+   DBL_EXP_MASK < 0x100000 ? 20 : \
+   DBL_EXP_MASK < 0x200000 ? 21 : \
+   DBL_EXP_MASK < 0x400000 ? 22 : \
+   DBL_EXP_MASK < 0x800000 ? 23 : \
+   DBL_EXP_MASK < 0x1000000 ? 24 : \
+   DBL_EXP_MASK < 0x2000000 ? 25 : \
+   DBL_EXP_MASK < 0x4000000 ? 26 : \
+   DBL_EXP_MASK < 0x8000000 ? 27 : \
+   DBL_EXP_MASK < 0x10000000 ? 28 : \
+   DBL_EXP_MASK < 0x20000000 ? 29 : \
+   DBL_EXP_MASK < 0x40000000 ? 30 : \
+   DBL_EXP_MASK <= 0x7fffffff ? 31 : \
+   32)
+#define LDBL_EXP_BIT \
+  (LDBL_EXP_MASK < 0x100 ? 8 : \
+   LDBL_EXP_MASK < 0x200 ? 9 : \
+   LDBL_EXP_MASK < 0x400 ? 10 : \
+   LDBL_EXP_MASK < 0x800 ? 11 : \
+   LDBL_EXP_MASK < 0x1000 ? 12 : \
+   LDBL_EXP_MASK < 0x2000 ? 13 : \
+   LDBL_EXP_MASK < 0x4000 ? 14 : \
+   LDBL_EXP_MASK < 0x8000 ? 15 : \
+   LDBL_EXP_MASK < 0x10000 ? 16 : \
+   LDBL_EXP_MASK < 0x20000 ? 17 : \
+   LDBL_EXP_MASK < 0x40000 ? 18 : \
+   LDBL_EXP_MASK < 0x80000 ? 19 : \
+   LDBL_EXP_MASK < 0x100000 ? 20 : \
+   LDBL_EXP_MASK < 0x200000 ? 21 : \
+   LDBL_EXP_MASK < 0x400000 ? 22 : \
+   LDBL_EXP_MASK < 0x800000 ? 23 : \
+   LDBL_EXP_MASK < 0x1000000 ? 24 : \
+   LDBL_EXP_MASK < 0x2000000 ? 25 : \
+   LDBL_EXP_MASK < 0x4000000 ? 26 : \
+   LDBL_EXP_MASK < 0x8000000 ? 27 : \
+   LDBL_EXP_MASK < 0x10000000 ? 28 : \
+   LDBL_EXP_MASK < 0x20000000 ? 29 : \
+   LDBL_EXP_MASK < 0x40000000 ? 30 : \
+   LDBL_EXP_MASK <= 0x7fffffff ? 31 : \
+   32)
+
+/* Number of bits used for a floating-point number: the mantissa (not
+   counting the "hidden bit", since it may or may not be explicit), the
+   exponent, and the sign.  */
+#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1)
+#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1)
+#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1)
+
+/* Number of bytes used for a floating-point number.
+   This can be smaller than the 'sizeof'.  For example, on i386 systems,
+   'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence
+   LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but
+   sizeof (long double) = 12 or = 16.  */
+#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
+#define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
+#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
+
+/* Verify that SIZEOF_FLT <= sizeof (float) etc.  */
+typedef int verify_sizeof_flt[SIZEOF_FLT <= sizeof (float) ? 1 : -1];
+typedef int verify_sizeof_dbl[SIZEOF_DBL <= sizeof (double) ? 1 : - 1];
+typedef int verify_sizeof_ldbl[SIZEOF_LDBL <= sizeof (long double) ? 1 : - 1];
+
+#endif /* _FLOATPLUS_H */
deleted file mode 120000 (symlink)
index b075ea25fc1a08031cce9b15e7f330c584f6c65d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/float.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a9ea40b063bdf04b1f9d72927324c2850b8f5159
--- /dev/null
@@ -0,0 +1,33 @@
+/* Auxiliary definitions for <float.h>.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <float.h>
+
+#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
+const union gl_long_double_union gl_LDBL_MAX =
+  { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } };
+#elif defined __i386__
+const union gl_long_double_union gl_LDBL_MAX =
+  { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } };
+#else
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+#endif
deleted file mode 120000 (symlink)
index 27ff6dd68bec1989d74ee79b140e36a83d7161bf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/float.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..73e8d40621ffa521cddbab3e63168fbdd55dc8f3
--- /dev/null
@@ -0,0 +1,194 @@
+/* A correct <float.h>.
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_FLOAT_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
+
+#ifndef _@GUARD_PREFIX@_FLOAT_H
+#define _@GUARD_PREFIX@_FLOAT_H
+
+/* 'long double' properties.  */
+
+#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
+/* Number of mantissa units, in base FLT_RADIX.  */
+# undef LDBL_MANT_DIG
+# define LDBL_MANT_DIG   64
+/* Number of decimal digits that is sufficient for representing a number.  */
+# undef LDBL_DIG
+# define LDBL_DIG        18
+/* x-1 where x is the smallest representable number > 1.  */
+# undef LDBL_EPSILON
+# define LDBL_EPSILON    1.0842021724855044340E-19L
+/* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP    (-16381)
+/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
+# undef LDBL_MAX_EXP
+# define LDBL_MAX_EXP    16384
+/* Minimum positive normalized number.  */
+# undef LDBL_MIN
+# define LDBL_MIN        3.3621031431120935063E-4932L
+/* Maximum representable finite number.  */
+# undef LDBL_MAX
+# define LDBL_MAX        1.1897314953572317650E+4932L
+/* Minimum e such that 10^e is in the range of normalized numbers.  */
+# undef LDBL_MIN_10_EXP
+# define LDBL_MIN_10_EXP (-4931)
+/* Maximum e such that 10^e is in the range of representable finite numbers.  */
+# undef LDBL_MAX_10_EXP
+# define LDBL_MAX_10_EXP 4932
+#endif
+
+/* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of
+   precision in the compiler but 64 bits of precision at runtime.  See
+   <https://lists.gnu.org/r/bug-gnulib/2008-07/msg00063.html>.  */
+#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__)
+/* Number of mantissa units, in base FLT_RADIX.  */
+# undef LDBL_MANT_DIG
+# define LDBL_MANT_DIG   64
+/* Number of decimal digits that is sufficient for representing a number.  */
+# undef LDBL_DIG
+# define LDBL_DIG        18
+/* x-1 where x is the smallest representable number > 1.  */
+# undef LDBL_EPSILON
+# define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */
+/* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP    (-16381)
+/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
+# undef LDBL_MAX_EXP
+# define LDBL_MAX_EXP    16384
+/* Minimum positive normalized number.  */
+# undef LDBL_MIN
+# define LDBL_MIN        3.362103143112093506262677817321752E-4932L /* = 0x1p-16382L */
+/* Maximum representable finite number.  */
+# undef LDBL_MAX
+/* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }.
+   But the largest literal that GCC allows us to write is
+   0x0.fffffffffffff8p16384L = { 0xFFFFF800, 0xFFFFFFFF, 32766 }.
+   So, define it like this through a reference to an external variable
+
+     const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 };
+     extern const long double LDBL_MAX;
+
+   Unfortunately, this is not a constant expression.  */
+# if !GNULIB_defined_long_double_union
+union gl_long_double_union
+  {
+    struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd;
+    long double ld;
+  };
+#  define GNULIB_defined_long_double_union 1
+# endif
+extern const union gl_long_double_union gl_LDBL_MAX;
+# define LDBL_MAX (gl_LDBL_MAX.ld)
+/* Minimum e such that 10^e is in the range of normalized numbers.  */
+# undef LDBL_MIN_10_EXP
+# define LDBL_MIN_10_EXP (-4931)
+/* Maximum e such that 10^e is in the range of representable finite numbers.  */
+# undef LDBL_MAX_10_EXP
+# define LDBL_MAX_10_EXP 4932
+#endif
+
+/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
+   wrong.
+   On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong.  */
+#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP DBL_MIN_EXP
+# undef LDBL_MIN_10_EXP
+# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
+# undef LDBL_MIN
+# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
+#endif
+#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
+# undef LDBL_MAX
+/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }.
+   It is not easy to define:
+     #define LDBL_MAX 1.79769313486231580793728971405302307166e308L
+   is too small, whereas
+     #define LDBL_MAX 1.79769313486231580793728971405302307167e308L
+   is too large.  Apparently a bug in GCC decimal-to-binary conversion.
+   Also, I can't get values larger than
+     #define LDBL63 ((long double) (1ULL << 63))
+     #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
+     #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
+     #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
+     #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL)
+   which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }.
+   So, define it like this through a reference to an external variable
+
+     const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL };
+     extern const long double LDBL_MAX;
+
+   or through a pointer cast
+
+     #define LDBL_MAX \
+       (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL })
+
+   Unfortunately, this is not a constant expression, and the latter expression
+   does not work well when GCC is optimizing..  */
+# if !GNULIB_defined_long_double_union
+union gl_long_double_union
+  {
+    struct { double hi; double lo; } dd;
+    long double ld;
+  };
+#  define GNULIB_defined_long_double_union 1
+# endif
+extern const union gl_long_double_union gl_LDBL_MAX;
+# define LDBL_MAX (gl_LDBL_MAX.ld)
+#endif
+
+/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong.
+   On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON
+   are wrong.  */
+#if defined __sgi && (LDBL_MANT_DIG >= 106)
+# undef LDBL_MANT_DIG
+# define LDBL_MANT_DIG 106
+# if defined __GNUC__
+#  undef LDBL_MIN_EXP
+#  define LDBL_MIN_EXP DBL_MIN_EXP
+#  undef LDBL_MIN_10_EXP
+#  define LDBL_MIN_10_EXP DBL_MIN_10_EXP
+#  undef LDBL_MIN
+#  define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
+#  undef LDBL_EPSILON
+#  define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */
+# endif
+#endif
+
+#if @REPLACE_ITOLD@
+/* Pull in a function that fixes the 'int' to 'long double' conversion
+   of glibc 2.7.  */
+extern
+# ifdef __cplusplus
+"C"
+# endif
+void _Qp_itoq (long double *, int);
+static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq;
+#endif
+
+#endif /* _@GUARD_PREFIX@_FLOAT_H */
+#endif /* _@GUARD_PREFIX@_FLOAT_H */
deleted file mode 120000 (symlink)
index 4c154a8d4b322945ad997801afbd71db88407feb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fnmatch.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..832b5a1e0c9b5011c25dcd1646e30823b4e3c2bd
--- /dev/null
@@ -0,0 +1,391 @@
+/* Copyright (C) 1991-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+/* Enable GNU extensions in fnmatch.h.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE    1
+#endif
+
+#include <fnmatch.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdckdint.h>
+#include <stdlib.h>
+#if defined _LIBC || HAVE_ALLOCA
+# include <alloca.h>
+#endif
+#include <stddef.h>
+#include <uchar.h>
+#if defined _LIBC || !_GL_SMALL_WCHAR_T
+/* It's OK to use wchar_t, since it's wide enough.  */
+# include <wchar.h>
+# include <wctype.h>
+# define WCHAR_T wchar_t
+# define WINT_T wint_t
+# define BTOWC btowc
+# define MBSRTOWCS mbsrtowcs
+# define WCSLEN wcslen
+# define WCSCAT wcscat
+# define WMEMPCPY wmempcpy
+# define WMEMCHR wmemchr
+# define TOWLOWER towlower
+# define WCTYPE_T wctype_t
+# define WCTYPE wctype
+# define ISWCTYPE iswctype
+#else
+/* wchar_t is too small, use char32_t instead.  */
+# include "unistr.h"
+# define WCHAR_T char32_t
+# define WINT_T char32_t
+# define BTOWC btoc32
+# define MBSRTOWCS mbsrtoc32s
+# define WCSLEN u32_strlen
+# define WCSCAT u32_strcat
+# define WMEMPCPY u32_pcpy
+# define WMEMCHR(S, C, N) u32_chr (S, N, C)
+# define TOWLOWER c32tolower
+# define WCTYPE_T c32_type_test_t
+# define WCTYPE c32_get_type_test
+# define ISWCTYPE c32_apply_type_test
+#endif
+
+/* We need some of the locale data (the collation sequence information)
+   but there is no interface to get this information in general.  Therefore
+   we support a correct implementation only in glibc.  */
+#ifdef _LIBC
+# include "../locale/localeinfo.h"
+# include "../locale/coll-lookup.h"
+# include <shlib-compat.h>
+
+# define CONCAT(a,b) __CONCAT(a,b)
+# define btowc __btowc
+# define iswctype __iswctype
+# define mbsrtowcs __mbsrtowcs
+# define mempcpy __mempcpy
+# define strnlen __strnlen
+# define towlower __towlower
+# define wcscat __wcscat
+# define wcslen __wcslen
+# define wctype __wctype
+# define wmemchr __wmemchr
+# define wmempcpy __wmempcpy
+# define fnmatch __fnmatch
+extern int fnmatch (const char *pattern, const char *string, int flags);
+#endif
+
+#ifdef _LIBC
+# if __glibc_has_attribute (__fallthrough__)
+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define FALLTHROUGH ((void) 0)
+# endif
+#else
+# include "attribute.h"
+#endif
+
+#include <flexmember.h>
+
+#ifdef _LIBC
+typedef ptrdiff_t idx_t;
+#else
+# include "idx.h"
+#endif
+
+/* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set.  */
+#define NO_LEADING_PERIOD(flags) \
+  ((flags & (FNM_FILE_NAME | FNM_PERIOD)) == (FNM_FILE_NAME | FNM_PERIOD))
+
+#ifndef _LIBC
+# 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
+/* Just use malloc.  */
+#  define __libc_use_alloca(n) false
+#  undef alloca
+#  define alloca(n) malloc (n)
+# endif
+# define alloca_account(size, avar) ((avar) += (size), alloca (size))
+#endif
+
+/* Provide support for user-defined character classes, based on the functions
+   from ISO C 90 amendment 1.  */
+#ifdef CHARCLASS_NAME_MAX
+# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
+#else
+/* This shouldn't happen but some implementation might still have this
+   problem.  Use a reasonable default value.  */
+# define CHAR_CLASS_MAX_LENGTH 256
+#endif
+
+#define IS_CHAR_CLASS(string) WCTYPE (string)
+
+/* Avoid depending on library functions or files
+   whose names are inconsistent.  */
+
+/* Global variable.  */
+static int posixly_correct;
+
+/* Note that this evaluates C many times.  */
+#define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
+#define CHAR    char
+#define UCHAR   unsigned char
+#define INT     int
+#define FCT     internal_fnmatch
+#define EXT     ext_match
+#define END     end_pattern
+#define STRUCT  fnmatch_struct
+#define L_(CS)  CS
+#define UCHAR_TO_WCHAR(C) BTOWC (C)
+#define STRLEN(S) strlen (S)
+#define STRCAT(D, S) strcat (D, S)
+#define MEMPCPY(D, S, N) mempcpy (D, S, N)
+#define MEMCHR(S, C, N) memchr (S, C, N)
+#define WIDE_CHAR_VERSION 0
+#ifdef _LIBC
+# include <locale/weight.h>
+# define FINDIDX findidx
+#endif
+#include "fnmatch_loop.c"
+
+
+#define FOLD(c) ((flags & FNM_CASEFOLD) ? TOWLOWER (c) : (c))
+#define CHAR    WCHAR_T
+#define UCHAR   WINT_T
+#define INT     WINT_T
+#define FCT     internal_fnwmatch
+#define EXT     ext_wmatch
+#define END     end_wpattern
+#define L_(CS)  L##CS
+#define UCHAR_TO_WCHAR(C) (C)
+#define STRLEN(S) WCSLEN (S)
+#define STRCAT(D, S) WCSCAT (D, S)
+#define MEMPCPY(D, S, N) WMEMPCPY (D, S, N)
+#define MEMCHR(S, C, N) WMEMCHR (S, C, N)
+#define WIDE_CHAR_VERSION 1
+#ifdef _LIBC
+/* Change the name the header defines so it doesn't conflict with
+   the <locale/weight.h> version included above.  */
+# define findidx findidxwc
+# include <locale/weightwc.h>
+# undef findidx
+# define FINDIDX findidxwc
+#endif
+
+#undef IS_CHAR_CLASS
+/* We have to convert the wide character string in a multibyte string.  But
+   we know that the character class names consist of alphanumeric characters
+   from the portable character set, and since the wide character encoding
+   for a member of the portable character set is the same code point as
+   its single-byte encoding, we can use a simplified method to convert the
+   string to a multibyte character string.  */
+static WCTYPE_T
+is_char_class (const WCHAR_T *wcs)
+{
+  char s[CHAR_CLASS_MAX_LENGTH + 1];
+  char *cp = s;
+
+  do
+    {
+      /* Test for a printable character from the portable character set.  */
+#ifdef _LIBC
+      if (*wcs < 0x20 || *wcs > 0x7e
+          || *wcs == 0x24 || *wcs == 0x40 || *wcs == 0x60)
+        return (WCTYPE_T) 0;
+#else
+      switch (*wcs)
+        {
+        case L' ': case L'!': case L'"': case L'#': case L'%':
+        case L'&': case L'\'': case L'(': case L')': case L'*':
+        case L'+': case L',': case L'-': case L'.': case L'/':
+        case L'0': case L'1': case L'2': case L'3': case L'4':
+        case L'5': case L'6': case L'7': case L'8': case L'9':
+        case L':': case L';': case L'<': case L'=': case L'>':
+        case L'?':
+        case L'A': case L'B': case L'C': case L'D': case L'E':
+        case L'F': case L'G': case L'H': case L'I': case L'J':
+        case L'K': case L'L': case L'M': case L'N': case L'O':
+        case L'P': case L'Q': case L'R': case L'S': case L'T':
+        case L'U': case L'V': case L'W': case L'X': case L'Y':
+        case L'Z':
+        case L'[': case L'\\': case L']': case L'^': case L'_':
+        case L'a': case L'b': case L'c': case L'd': case L'e':
+        case L'f': case L'g': case L'h': case L'i': case L'j':
+        case L'k': case L'l': case L'm': case L'n': case L'o':
+        case L'p': case L'q': case L'r': case L's': case L't':
+        case L'u': case L'v': case L'w': case L'x': case L'y':
+        case L'z': case L'{': case L'|': case L'}': case L'~':
+          break;
+        default:
+          return (WCTYPE_T) 0;
+        }
+#endif
+
+      /* Avoid overrunning the buffer.  */
+      if (cp == s + CHAR_CLASS_MAX_LENGTH)
+        return (WCTYPE_T) 0;
+
+      *cp++ = (char) *wcs++;
+    }
+  while (*wcs != L'\0');
+
+  *cp = '\0';
+
+  return WCTYPE (s);
+}
+#define IS_CHAR_CLASS(string) is_char_class (string)
+
+#include "fnmatch_loop.c"
+
+
+int
+fnmatch (const char *pattern, const char *string, int flags)
+{
+  if (__glibc_unlikely (MB_CUR_MAX != 1))
+    {
+      mbstate_t ps;
+      size_t n;
+      const char *p;
+      WCHAR_T *wpattern_malloc = NULL;
+      WCHAR_T *wpattern;
+      WCHAR_T *wstring_malloc = NULL;
+      WCHAR_T *wstring;
+      size_t alloca_used = 0;
+
+      /* Convert the strings into wide characters.  */
+      memset (&ps, '\0', sizeof (ps));
+      p = pattern;
+      n = strnlen (pattern, 1024);
+      if (__glibc_likely (n < 1024))
+        {
+          wpattern = (WCHAR_T *) alloca_account ((n + 1) * sizeof (WCHAR_T),
+                                                 alloca_used);
+          n = MBSRTOWCS (wpattern, &p, n + 1, &ps);
+          if (__glibc_unlikely (n == (size_t) -1))
+            /* Something wrong.
+               XXX Do we have to set 'errno' to something which mbsrtows hasn't
+               already done?  */
+            return -1;
+          if (p)
+            {
+              memset (&ps, '\0', sizeof (ps));
+              goto prepare_wpattern;
+            }
+        }
+      else
+        {
+        prepare_wpattern:
+          n = MBSRTOWCS (NULL, &pattern, 0, &ps);
+          if (__glibc_unlikely (n == (size_t) -1))
+            /* Something wrong.
+               XXX Do we have to set 'errno' to something which mbsrtows hasn't
+               already done?  */
+            return -1;
+          if (__glibc_unlikely (n >= (size_t) -1 / sizeof (WCHAR_T)))
+            {
+              __set_errno (ENOMEM);
+              return -2;
+            }
+          wpattern_malloc = wpattern
+            = (WCHAR_T *) malloc ((n + 1) * sizeof (WCHAR_T));
+          assert (mbsinit (&ps));
+          if (wpattern == NULL)
+            return -2;
+          (void) MBSRTOWCS (wpattern, &pattern, n + 1, &ps);
+        }
+
+      assert (mbsinit (&ps));
+      n = strnlen (string, 1024);
+      p = string;
+      if (__glibc_likely (n < 1024))
+        {
+          wstring = (WCHAR_T *) alloca_account ((n + 1) * sizeof (WCHAR_T),
+                                                alloca_used);
+          n = MBSRTOWCS (wstring, &p, n + 1, &ps);
+          if (__glibc_unlikely (n == (size_t) -1))
+            {
+              /* Something wrong.
+                 XXX Do we have to set 'errno' to something which
+                 mbsrtows hasn't already done?  */
+            free_return:
+              free (wpattern_malloc);
+              return -1;
+            }
+          if (p)
+            {
+              memset (&ps, '\0', sizeof (ps));
+              goto prepare_wstring;
+            }
+        }
+      else
+        {
+        prepare_wstring:
+          n = MBSRTOWCS (NULL, &string, 0, &ps);
+          if (__glibc_unlikely (n == (size_t) -1))
+            /* Something wrong.
+               XXX Do we have to set 'errno' to something which mbsrtows hasn't
+               already done?  */
+            goto free_return;
+          if (__glibc_unlikely (n >= (size_t) -1 / sizeof (WCHAR_T)))
+            {
+              free (wpattern_malloc);
+              __set_errno (ENOMEM);
+              return -2;
+            }
+
+          wstring_malloc = wstring
+            = (WCHAR_T *) malloc ((n + 1) * sizeof (WCHAR_T));
+          if (wstring == NULL)
+            {
+              free (wpattern_malloc);
+              return -2;
+            }
+          assert (mbsinit (&ps));
+          (void) MBSRTOWCS (wstring, &string, n + 1, &ps);
+        }
+
+      int res = internal_fnwmatch (wpattern, wstring, wstring + n,
+                                   flags & FNM_PERIOD, flags, NULL,
+                                   alloca_used);
+
+      free (wstring_malloc);
+      free (wpattern_malloc);
+
+      return res;
+    }
+
+  return internal_fnmatch (pattern, string, string + strlen (string),
+                           flags & FNM_PERIOD, flags, NULL, 0);
+}
+
+#undef fnmatch
+versioned_symbol (libc, __fnmatch, fnmatch, GLIBC_2_2_3);
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_3)
+strong_alias (__fnmatch, __fnmatch_old)
+compat_symbol (libc, __fnmatch_old, fnmatch, GLIBC_2_0);
+#endif
+libc_hidden_ver (__fnmatch, fnmatch)
deleted file mode 120000 (symlink)
index 6c03e0eb62058e91f66d693eb3cbd7015cbdab55..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fnmatch.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..974bbffd854d37564a14942060963348f97f21f0
--- /dev/null
@@ -0,0 +1,117 @@
+/* Substitute for and wrapper around <fnmatch.h>.
+   Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2024 Free
+   Software Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_FNMATCH_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_FNMATCH_H@ && !@REPLACE_FNMATCH@
+# @INCLUDE_NEXT@ @NEXT_FNMATCH_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_FNMATCH_H
+#define _@GUARD_PREFIX@_FNMATCH_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+#if !@HAVE_FNMATCH_H@ || @REPLACE_FNMATCH@
+
+/* We #undef these before defining them because some losing systems
+   (HP-UX A.08.07 for example) define these in <unistd.h>.  */
+#undef  FNM_PATHNAME
+#undef  FNM_NOESCAPE
+#undef  FNM_PERIOD
+
+/* Bits set in the FLAGS argument to 'fnmatch'.  */
+#define FNM_PATHNAME    (1 << 0) /* No wildcard can ever match '/'.  */
+#define FNM_NOESCAPE    (1 << 1) /* Backslashes don't quote special chars.  */
+#define FNM_PERIOD      (1 << 2) /* Leading '.' is matched only explicitly.  */
+
+#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
+# define FNM_FILE_NAME   FNM_PATHNAME   /* Preferred GNU name.  */
+# define FNM_LEADING_DIR (1 << 3)       /* Ignore '/...' after a match.  */
+# define FNM_CASEFOLD    (1 << 4)       /* Compare without regard to case.  */
+# define FNM_EXTMATCH    (1 << 5)       /* Use ksh-like extended matching. */
+#endif
+
+/* Value returned by 'fnmatch' if STRING does not match PATTERN.  */
+#define FNM_NOMATCH     1
+
+/* This value is returned if the implementation does not support
+   'fnmatch'.  Since this is not the case here it will never be
+   returned but the conformance test suites still require the symbol
+   to be defined.  */
+#ifdef _XOPEN_SOURCE
+# define FNM_NOSYS      (-1)
+#endif
+
+#endif
+
+
+#if @GNULIB_FNMATCH@
+/* Match NAME against the file name pattern PATTERN,
+   returning zero if it matches, FNM_NOMATCH if not.  */
+# if @REPLACE_FNMATCH@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define fnmatch rpl_fnmatch
+#  endif
+#  define GNULIB_defined_fnmatch_function 1
+_GL_FUNCDECL_RPL (fnmatch, int,
+                  (const char *pattern, const char *name, int flags)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fnmatch, int,
+                  (const char *pattern, const char *name, int flags));
+# else
+#  if !@HAVE_FNMATCH@
+#   define GNULIB_defined_fnmatch_function 1
+_GL_FUNCDECL_SYS (fnmatch, int,
+                  (const char *pattern, const char *name, int flags)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (fnmatch, int,
+                  (const char *pattern, const char *name, int flags));
+# endif
+# if !GNULIB_FNMATCH_GNU && __GLIBC__ >= 2
+_GL_CXXALIASWARN (fnmatch);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fnmatch
+# if HAVE_RAW_DECL_FNMATCH
+_GL_WARN_ON_USE (fnmatch,
+                 "fnmatch does not portably work - "
+                 "use gnulib module fnmatch for portability or gnulib module fnmatch-gnu for a glibc compatible implementation");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_FNMATCH_H */
+#endif /* _@GUARD_PREFIX@_FNMATCH_H */
deleted file mode 120000 (symlink)
index 5485c14614bc7900b689f6b76a3727bea590b3a5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fnmatch_loop.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4e6e0865e9c3f358f3a56ff1acfccea5cc1668cf
--- /dev/null
+/* Copyright (C) 1991-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifdef _LIBC
+# include <stdint.h>
+#endif
+
+struct STRUCT
+{
+  const CHAR *pattern;
+  const CHAR *string;
+  bool no_leading_period;
+};
+
+/* Match STRING against the file name pattern PATTERN, returning zero if
+   it matches, nonzero if not.  */
+static int FCT (const CHAR *pattern, const CHAR *string,
+                const CHAR *string_end, bool no_leading_period, int flags,
+                struct STRUCT *ends, size_t alloca_used);
+static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
+                const CHAR *string_end, bool no_leading_period, int flags,
+                size_t alloca_used);
+static const CHAR *END (const CHAR *patternp);
+
+static int
+FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
+     bool no_leading_period, int flags, struct STRUCT *ends, size_t alloca_used)
+{
+  const CHAR *p = pattern, *n = string;
+  UCHAR c;
+#ifdef _LIBC
+# if WIDE_CHAR_VERSION
+  const char *collseq = (const char *)
+    _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
+# else
+  const UCHAR *collseq = (const UCHAR *)
+    _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQMB);
+# endif
+#endif
+
+  while ((c = *p++) != L_('\0'))
+    {
+      bool new_no_leading_period = false;
+      c = FOLD (c);
+
+      switch (c)
+        {
+        case L_('?'):
+          if (__glibc_unlikely (flags & FNM_EXTMATCH) && *p == '(')
+            {
+              int res = EXT (c, p, n, string_end, no_leading_period,
+                             flags, alloca_used);
+              if (res != -1)
+                return res;
+            }
+
+          if (n == string_end)
+            return FNM_NOMATCH;
+          else if (*n == L_('/') && (flags & FNM_FILE_NAME))
+            return FNM_NOMATCH;
+          else if (*n == L_('.') && no_leading_period)
+            return FNM_NOMATCH;
+          break;
+
+        case L_('\\'):
+          if (!(flags & FNM_NOESCAPE))
+            {
+              c = *p++;
+              if (c == L_('\0'))
+                /* Trailing \ loses.  */
+                return FNM_NOMATCH;
+              c = FOLD (c);
+            }
+          if (n == string_end || FOLD ((UCHAR) *n) != c)
+            return FNM_NOMATCH;
+          break;
+
+        case L_('*'):
+          if (__glibc_unlikely (flags & FNM_EXTMATCH) && *p == '(')
+            {
+              int res = EXT (c, p, n, string_end, no_leading_period,
+                             flags, alloca_used);
+              if (res != -1)
+                return res;
+            }
+          else if (ends != NULL)
+            {
+              ends->pattern = p - 1;
+              ends->string = n;
+              ends->no_leading_period = no_leading_period;
+              return 0;
+            }
+
+          if (n != string_end && *n == L_('.') && no_leading_period)
+            return FNM_NOMATCH;
+
+          for (c = *p++; c == L_('?') || c == L_('*'); c = *p++)
+            {
+              if (*p == L_('(') && (flags & FNM_EXTMATCH) != 0)
+                {
+                  const CHAR *endp = END (p);
+                  if (endp != p)
+                    {
+                      /* This is a pattern.  Skip over it.  */
+                      p = endp;
+                      continue;
+                    }
+                }
+
+              if (c == L_('?'))
+                {
+                  /* A ? needs to match one character.  */
+                  if (n == string_end)
+                    /* There isn't another character; no match.  */
+                    return FNM_NOMATCH;
+                  else if (*n == L_('/')
+                           && __glibc_unlikely (flags & FNM_FILE_NAME))
+                    /* A slash does not match a wildcard under
+                       FNM_FILE_NAME.  */
+                    return FNM_NOMATCH;
+                  else
+                    /* One character of the string is consumed in matching
+                       this ? wildcard, so *??? won't match if there are
+                       less than three characters.  */
+                    ++n;
+                }
+            }
+
+          if (c == L_('\0'))
+            /* The wildcard(s) is/are the last element of the pattern.
+               If the name is a file name and contains another slash
+               this means it cannot match, unless the FNM_LEADING_DIR
+               flag is set.  */
+            {
+              int result = (flags & FNM_FILE_NAME) == 0 ? 0 : FNM_NOMATCH;
+
+              if (flags & FNM_FILE_NAME)
+                {
+                  if (flags & FNM_LEADING_DIR)
+                    result = 0;
+                  else
+                    {
+                      if (MEMCHR (n, L_('/'), string_end - n) == NULL)
+                        result = 0;
+                    }
+                }
+
+              return result;
+            }
+          else
+            {
+              const CHAR *endp;
+              struct STRUCT end;
+
+              end.pattern = NULL;
+              endp = MEMCHR (n, (flags & FNM_FILE_NAME) ? L_('/') : L_('\0'),
+                             string_end - n);
+              if (endp == NULL)
+                endp = string_end;
+
+              if (c == L_('[')
+                  || (__glibc_unlikely (flags & FNM_EXTMATCH)
+                      && (c == L_('@') || c == L_('+') || c == L_('!'))
+                      && *p == L_('(')))
+                {
+                  int flags2 = ((flags & FNM_FILE_NAME)
+                                ? flags : (flags & ~FNM_PERIOD));
+
+                  for (--p; n < endp; ++n, no_leading_period = false)
+                    if (FCT (p, n, string_end, no_leading_period, flags2,
+                             &end, alloca_used) == 0)
+                      goto found;
+                }
+              else if (c == L_('/') && (flags & FNM_FILE_NAME))
+                {
+                  while (n < string_end && *n != L_('/'))
+                    ++n;
+                  if (n < string_end && *n == L_('/')
+                      && (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags,
+                               NULL, alloca_used) == 0))
+                    return 0;
+                }
+              else
+                {
+                  int flags2 = ((flags & FNM_FILE_NAME)
+                                ? flags : (flags & ~FNM_PERIOD));
+
+                  if (c == L_('\\') && !(flags & FNM_NOESCAPE))
+                    c = *p;
+                  c = FOLD (c);
+                  for (--p; n < endp; ++n, no_leading_period = false)
+                    if (FOLD ((UCHAR) *n) == c
+                        && (FCT (p, n, string_end, no_leading_period, flags2,
+                                 &end, alloca_used) == 0))
+                      {
+                      found:
+                        if (end.pattern == NULL)
+                          return 0;
+                        break;
+                      }
+                  if (end.pattern != NULL)
+                    {
+                      p = end.pattern;
+                      n = end.string;
+                      no_leading_period = end.no_leading_period;
+                      continue;
+                    }
+                }
+            }
+
+          /* If we come here no match is possible with the wildcard.  */
+          return FNM_NOMATCH;
+
+        case L_('['):
+          {
+            /* Nonzero if the sense of the character class is inverted.  */
+            const CHAR *p_init = p;
+            const CHAR *n_init = n;
+            bool not;
+            CHAR cold;
+            UCHAR fn;
+
+            if (posixly_correct == 0)
+              posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
+
+            if (n == string_end)
+              return FNM_NOMATCH;
+
+            if (*n == L_('.') && no_leading_period)
+              return FNM_NOMATCH;
+
+            if (*n == L_('/') && (flags & FNM_FILE_NAME))
+              /* '/' cannot be matched.  */
+              return FNM_NOMATCH;
+
+            not = (*p == L_('!') || (posixly_correct < 0 && *p == L_('^')));
+            if (not)
+              ++p;
+
+            fn = FOLD ((UCHAR) *n);
+
+            c = *p++;
+            for (;;)
+              {
+                if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
+                  {
+                    if (*p == L_('\0'))
+                      return FNM_NOMATCH;
+                    c = FOLD ((UCHAR) *p);
+                    ++p;
+
+                    goto normal_bracket;
+                  }
+                else if (c == L_('[') && *p == L_(':'))
+                  {
+                    /* Leave room for the null.  */
+                    CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
+                    size_t c1 = 0;
+                    WCTYPE_T wt;
+                    const CHAR *startp = p;
+
+                    for (;;)
+                      {
+                        if (c1 == CHAR_CLASS_MAX_LENGTH)
+                          /* The name is too long and therefore the pattern
+                             is ill-formed.  */
+                          return FNM_NOMATCH;
+
+                        c = *++p;
+                        if (c == L_(':') && p[1] == L_(']'))
+                          {
+                            p += 2;
+                            break;
+                          }
+                        if (c < L_('a') || c >= L_('z'))
+                          {
+                            /* This cannot possibly be a character class name.
+                               Match it as a normal range.  */
+                            p = startp;
+                            c = L_('[');
+                            goto normal_bracket;
+                          }
+                        str[c1++] = c;
+                      }
+                    str[c1] = L_('\0');
+
+                    wt = IS_CHAR_CLASS (str);
+                    if (wt == 0)
+                      /* Invalid character class name.  */
+                      return FNM_NOMATCH;
+
+#if defined _LIBC && ! WIDE_CHAR_VERSION
+                    /* The following code is glibc specific but does
+                       there a good job in speeding up the code since
+                       we can avoid the btowc() call.  */
+                    if (_ISCTYPE ((UCHAR) *n, wt))
+                      goto matched;
+#else
+                    if (ISWCTYPE (UCHAR_TO_WCHAR ((UCHAR) *n), wt))
+                      goto matched;
+#endif
+                    c = *p++;
+                  }
+#ifdef _LIBC
+                else if (c == L_('[') && *p == L_('='))
+                  {
+                    /* It's important that STR be a scalar variable rather
+                       than a one-element array, because GCC (at least 4.9.2
+                       -O2 on x86-64) can be confused by the array and
+                       diagnose a "used initialized" in a dead branch in the
+                       findidx function.  */
+                    UCHAR str;
+                    uint32_t nrules =
+                      _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+                    const CHAR *startp = p;
+
+                    c = *++p;
+                    if (c == L_('\0'))
+                      {
+                        p = startp;
+                        c = L_('[');
+                        goto normal_bracket;
+                      }
+                    str = c;
+
+                    c = *++p;
+                    if (c != L_('=') || p[1] != L_(']'))
+                      {
+                        p = startp;
+                        c = L_('[');
+                        goto normal_bracket;
+                      }
+                    p += 2;
+
+                    if (nrules == 0)
+                      {
+                        if ((UCHAR) *n == str)
+                          goto matched;
+                      }
+                    else
+                      {
+                        const int32_t *table;
+# if WIDE_CHAR_VERSION
+                        const int32_t *weights;
+                        const wint_t *extra;
+# else
+                        const unsigned char *weights;
+                        const unsigned char *extra;
+# endif
+                        const int32_t *indirect;
+                        int32_t idx;
+                        const UCHAR *cp = (const UCHAR *) &str;
+
+# if WIDE_CHAR_VERSION
+                        table = (const int32_t *)
+                          _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
+                        weights = (const int32_t *)
+                          _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
+                        extra = (const wint_t *)
+                          _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
+                        indirect = (const int32_t *)
+                          _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
+# else
+                        table = (const int32_t *)
+                          _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
+                        weights = (const unsigned char *)
+                          _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
+                        extra = (const unsigned char *)
+                          _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
+                        indirect = (const int32_t *)
+                          _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
+# endif
+
+                        idx = FINDIDX (table, indirect, extra, &cp, 1);
+                        if (idx != 0)
+                          {
+                            /* We found a table entry.  Now see whether the
+                               character we are currently at has the same
+                               equivalence class value.  */
+                            int len = weights[idx & 0xffffff];
+                            int32_t idx2;
+                            const UCHAR *np = (const UCHAR *) n;
+
+                            idx2 = FINDIDX (table, indirect, extra,
+                                            &np, string_end - n);
+                            if (idx2 != 0
+                                && (idx >> 24) == (idx2 >> 24)
+                                && len == weights[idx2 & 0xffffff])
+                              {
+                                int cnt = 0;
+
+                                idx &= 0xffffff;
+                                idx2 &= 0xffffff;
+
+                                while (cnt < len
+                                       && (weights[idx + 1 + cnt]
+                                           == weights[idx2 + 1 + cnt]))
+                                  ++cnt;
+
+                                if (cnt == len)
+                                  goto matched;
+                              }
+                          }
+                      }
+
+                    c = *p++;
+                  }
+#endif
+                else if (c == L_('\0'))
+                  {
+                    /* [ unterminated, treat as normal character.  */
+                    p = p_init;
+                    n = n_init;
+                    c = L_('[');
+                    goto normal_match;
+                  }
+                else
+                  {
+                    bool is_range = false;
+
+#ifdef _LIBC
+                    bool is_seqval = false;
+
+                    if (c == L_('[') && *p == L_('.'))
+                      {
+                        uint32_t nrules =
+                          _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+                        const CHAR *startp = p;
+                        size_t c1 = 0;
+
+                        while (1)
+                          {
+                            c = *++p;
+                            if (c == L_('.') && p[1] == L_(']'))
+                              {
+                                p += 2;
+                                break;
+                              }
+                            if (c == '\0')
+                              return FNM_NOMATCH;
+                            ++c1;
+                          }
+
+                        /* We have to handling the symbols differently in
+                           ranges since then the collation sequence is
+                           important.  */
+                        is_range = *p == L_('-') && p[1] != L_('\0');
+
+                        if (nrules == 0)
+                          {
+                            /* There are no names defined in the collation
+                               data.  Therefore we only accept the trivial
+                               names consisting of the character itself.  */
+                            if (c1 != 1)
+                              return FNM_NOMATCH;
+
+                            if (!is_range && *n == startp[1])
+                              goto matched;
+
+                            cold = startp[1];
+                            c = *p++;
+                          }
+                        else
+                          {
+                            int32_t table_size;
+                            const int32_t *symb_table;
+                            const unsigned char *extra;
+                            int32_t idx;
+                            int32_t elem;
+# if WIDE_CHAR_VERSION
+                            CHAR *wextra;
+# endif
+
+                            table_size =
+                              _NL_CURRENT_WORD (LC_COLLATE,
+                                                _NL_COLLATE_SYMB_HASH_SIZEMB);
+                            symb_table = (const int32_t *)
+                              _NL_CURRENT (LC_COLLATE,
+                                           _NL_COLLATE_SYMB_TABLEMB);
+                            extra = (const unsigned char *)
+                              _NL_CURRENT (LC_COLLATE,
+                                           _NL_COLLATE_SYMB_EXTRAMB);
+
+                            for (elem = 0; elem < table_size; elem++)
+                              if (symb_table[2 * elem] != 0)
+                                {
+                                  idx = symb_table[2 * elem + 1];
+                                  /* Skip the name of collating element.  */
+                                  idx += 1 + extra[idx];
+# if WIDE_CHAR_VERSION
+                                  /* Skip the byte sequence of the
+                                     collating element.  */
+                                  idx += 1 + extra[idx];
+                                  /* Adjust for the alignment.  */
+                                  idx = (idx + 3) & ~3;
+
+                                  wextra = (CHAR *) &extra[idx + 4];
+
+                                  if (/* Compare the length of the sequence.  */
+                                      c1 == wextra[0]
+                                      /* Compare the wide char sequence.  */
+                                      && (__wmemcmp (startp + 1, &wextra[1],
+                                                     c1)
+                                          == 0))
+                                    /* Yep, this is the entry.  */
+                                    break;
+# else
+                                  if (/* Compare the length of the sequence.  */
+                                      c1 == extra[idx]
+                                      /* Compare the byte sequence.  */
+                                      && memcmp (startp + 1,
+                                                 &extra[idx + 1], c1) == 0)
+                                    /* Yep, this is the entry.  */
+                                    break;
+# endif
+                                }
+
+                            if (elem < table_size)
+                              {
+                                /* Compare the byte sequence but only if
+                                   this is not part of a range.  */
+                                if (! is_range
+
+# if WIDE_CHAR_VERSION
+                                    && __wmemcmp (n, &wextra[1], c1) == 0
+# else
+                                    && memcmp (n, &extra[idx + 1], c1) == 0
+# endif
+                                    )
+                                  {
+                                    n += c1 - 1;
+                                    goto matched;
+                                  }
+
+                                /* Get the collation sequence value.  */
+                                is_seqval = true;
+# if WIDE_CHAR_VERSION
+                                cold = wextra[1 + wextra[0]];
+# else
+                                idx += 1 + extra[idx];
+                                /* Adjust for the alignment.  */
+                                idx = (idx + 3) & ~3;
+                                cold = *((int32_t *) &extra[idx]);
+# endif
+
+                                c = *p++;
+                              }
+                            else if (c1 == 1)
+                              {
+                                /* No valid character.  Match it as a
+                                   single byte.  */
+                                if (!is_range && *n == startp[1])
+                                  goto matched;
+
+                                cold = startp[1];
+                                c = *p++;
+                              }
+                            else
+                              return FNM_NOMATCH;
+                          }
+                      }
+                    else
+#endif
+                      {
+                        c = FOLD (c);
+                      normal_bracket:
+
+                        /* We have to handling the symbols differently in
+                           ranges since then the collation sequence is
+                           important.  */
+                        is_range = (*p == L_('-') && p[1] != L_('\0')
+                                    && p[1] != L_(']'));
+
+                        if (!is_range && c == fn)
+                          goto matched;
+
+#if _LIBC
+                        /* This is needed if we goto normal_bracket; from
+                           outside of is_seqval's scope.  */
+                        is_seqval = false;
+#endif
+                        cold = c;
+                        c = *p++;
+                      }
+
+                    if (c == L_('-') && *p != L_(']'))
+                      {
+#if _LIBC
+                        /* We have to find the collation sequence
+                           value for C.  Collation sequence is nothing
+                           we can regularly access.  The sequence
+                           value is defined by the order in which the
+                           definitions of the collation values for the
+                           various characters appear in the source
+                           file.  A strange concept, nowhere
+                           documented.  */
+                        uint32_t fcollseq;
+                        uint32_t lcollseq;
+                        UCHAR cend = *p++;
+
+# if WIDE_CHAR_VERSION
+                        /* Search in the 'names' array for the characters.  */
+                        fcollseq = __collseq_table_lookup (collseq, fn);
+                        if (fcollseq == ~((uint32_t) 0))
+                          /* XXX We don't know anything about the character
+                             we are supposed to match.  This means we are
+                             failing.  */
+                          goto range_not_matched;
+
+                        if (is_seqval)
+                          lcollseq = cold;
+                        else
+                          lcollseq = __collseq_table_lookup (collseq, cold);
+# else
+                        fcollseq = collseq[fn];
+                        lcollseq = is_seqval ? cold : collseq[(UCHAR) cold];
+# endif
+
+                        is_seqval = false;
+                        if (cend == L_('[') && *p == L_('.'))
+                          {
+                            uint32_t nrules =
+                              _NL_CURRENT_WORD (LC_COLLATE,
+                                                _NL_COLLATE_NRULES);
+                            const CHAR *startp = p;
+                            size_t c1 = 0;
+
+                            while (1)
+                              {
+                                c = *++p;
+                                if (c == L_('.') && p[1] == L_(']'))
+                                  {
+                                    p += 2;
+                                    break;
+                                  }
+                                if (c == '\0')
+                                  return FNM_NOMATCH;
+                                ++c1;
+                              }
+
+                            if (nrules == 0)
+                              {
+                                /* There are no names defined in the
+                                   collation data.  Therefore we only
+                                   accept the trivial names consisting
+                                   of the character itself.  */
+                                if (c1 != 1)
+                                  return FNM_NOMATCH;
+
+                                cend = startp[1];
+                              }
+                            else
+                              {
+                                int32_t table_size;
+                                const int32_t *symb_table;
+                                const unsigned char *extra;
+                                int32_t idx;
+                                int32_t elem;
+# if WIDE_CHAR_VERSION
+                                CHAR *wextra;
+# endif
+
+                                table_size =
+                                  _NL_CURRENT_WORD (LC_COLLATE,
+                                                    _NL_COLLATE_SYMB_HASH_SIZEMB);
+                                symb_table = (const int32_t *)
+                                  _NL_CURRENT (LC_COLLATE,
+                                               _NL_COLLATE_SYMB_TABLEMB);
+                                extra = (const unsigned char *)
+                                  _NL_CURRENT (LC_COLLATE,
+                                               _NL_COLLATE_SYMB_EXTRAMB);
+
+                                for (elem = 0; elem < table_size; elem++)
+                                  if (symb_table[2 * elem] != 0)
+                                    {
+                                      idx = symb_table[2 * elem + 1];
+                                      /* Skip the name of collating
+                                         element.  */
+                                      idx += 1 + extra[idx];
+# if WIDE_CHAR_VERSION
+                                      /* Skip the byte sequence of the
+                                         collating element.  */
+                                      idx += 1 + extra[idx];
+                                      /* Adjust for the alignment.  */
+                                      idx = (idx + 3) & ~3;
+
+                                      wextra = (CHAR *) &extra[idx + 4];
+
+                                      if (/* Compare the length of the
+                                             sequence.  */
+                                          c1 == wextra[0]
+                                          /* Compare the wide char sequence.  */
+                                          && (__wmemcmp (startp + 1,
+                                                         &wextra[1], c1)
+                                              == 0))
+                                        /* Yep, this is the entry.  */
+                                        break;
+# else
+                                      if (/* Compare the length of the
+                                             sequence.  */
+                                          c1 == extra[idx]
+                                          /* Compare the byte sequence.  */
+                                          && memcmp (startp + 1,
+                                                     &extra[idx + 1], c1) == 0)
+                                        /* Yep, this is the entry.  */
+                                        break;
+# endif
+                                    }
+
+                                if (elem < table_size)
+                                  {
+                                    /* Get the collation sequence value.  */
+                                    is_seqval = true;
+# if WIDE_CHAR_VERSION
+                                    cend = wextra[1 + wextra[0]];
+# else
+                                    idx += 1 + extra[idx];
+                                    /* Adjust for the alignment.  */
+                                    idx = (idx + 3) & ~3;
+                                    cend = *((int32_t *) &extra[idx]);
+# endif
+                                  }
+                                else if (c1 == 1)
+                                  {
+                                    cend = startp[1];
+                                    c = *p++;
+                                  }
+                                else
+                                  return FNM_NOMATCH;
+                              }
+                          }
+                        else
+                          {
+                            if (!(flags & FNM_NOESCAPE) && cend == L_('\\'))
+                              cend = *p++;
+                            if (cend == L_('\0'))
+                              return FNM_NOMATCH;
+                            cend = FOLD (cend);
+                          }
+
+                        /* XXX It is not entirely clear to me how to handle
+                           characters which are not mentioned in the
+                           collation specification.  */
+                        if (
+# if WIDE_CHAR_VERSION
+                            lcollseq == 0xffffffff ||
+# endif
+                            lcollseq <= fcollseq)
+                          {
+                            /* We have to look at the upper bound.  */
+                            uint32_t hcollseq;
+
+                            if (is_seqval)
+                              hcollseq = cend;
+                            else
+                              {
+# if WIDE_CHAR_VERSION
+                                hcollseq =
+                                  __collseq_table_lookup (collseq, cend);
+                                if (hcollseq == ~((uint32_t) 0))
+                                  {
+                                    /* Hum, no information about the upper
+                                       bound.  The matching succeeds if the
+                                       lower bound is matched exactly.  */
+                                    if (lcollseq != fcollseq)
+                                      goto range_not_matched;
+
+                                    goto matched;
+                                  }
+# else
+                                hcollseq = collseq[cend];
+# endif
+                              }
+
+                            if (lcollseq <= hcollseq && fcollseq <= hcollseq)
+                              goto matched;
+                          }
+# if WIDE_CHAR_VERSION
+                      range_not_matched:
+# endif
+#else
+                        /* We use a boring value comparison of the character
+                           values.  This is better than comparing using
+                           'strcoll' since the latter would have surprising
+                           and sometimes fatal consequences.  */
+                        UCHAR cend = *p++;
+
+                        if (!(flags & FNM_NOESCAPE) && cend == L_('\\'))
+                          cend = *p++;
+                        if (cend == L_('\0'))
+                          return FNM_NOMATCH;
+
+                        /* It is a range.  */
+                        if ((UCHAR) cold <= fn && fn <= cend)
+                          goto matched;
+#endif
+
+                        c = *p++;
+                      }
+                  }
+
+                if (c == L_(']'))
+                  break;
+              }
+
+            if (!not)
+              return FNM_NOMATCH;
+            break;
+
+          matched:
+            /* Skip the rest of the [...] that already matched.  */
+            while ((c = *p++) != L_(']'))
+              {
+                if (c == L_('\0'))
+                  /* [... (unterminated) loses.  */
+                  return FNM_NOMATCH;
+
+                if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
+                  {
+                    if (*p == L_('\0'))
+                      return FNM_NOMATCH;
+                    /* XXX 1003.2d11 is unclear if this is right.  */
+                    ++p;
+                  }
+                else if (c == L_('[') && *p == L_(':'))
+                  {
+                    int c1 = 0;
+                    const CHAR *startp = p;
+
+                    while (1)
+                      {
+                        c = *++p;
+                        if (++c1 == CHAR_CLASS_MAX_LENGTH)
+                          return FNM_NOMATCH;
+
+                        if (*p == L_(':') && p[1] == L_(']'))
+                          break;
+
+                        if (c < L_('a') || c >= L_('z'))
+                          {
+                            p = startp - 2;
+                            break;
+                          }
+                      }
+                    p += 2;
+                  }
+                else if (c == L_('[') && *p == L_('='))
+                  {
+                    c = *++p;
+                    if (c == L_('\0'))
+                      return FNM_NOMATCH;
+                    c = *++p;
+                    if (c != L_('=') || p[1] != L_(']'))
+                      return FNM_NOMATCH;
+                    p += 2;
+                  }
+                else if (c == L_('[') && *p == L_('.'))
+                  {
+                    while (1)
+                      {
+                        c = *++p;
+                        if (c == L_('\0'))
+                          return FNM_NOMATCH;
+
+                        if (c == L_('.') && p[1] == L_(']'))
+                          break;
+                      }
+                    p += 2;
+                  }
+              }
+            if (not)
+              return FNM_NOMATCH;
+          }
+          break;
+
+        case L_('+'):
+        case L_('@'):
+        case L_('!'):
+          if (__glibc_unlikely (flags & FNM_EXTMATCH) && *p == '(')
+            {
+              int res = EXT (c, p, n, string_end, no_leading_period, flags,
+                             alloca_used);
+              if (res != -1)
+                return res;
+            }
+          goto normal_match;
+
+        case L_('/'):
+          if (NO_LEADING_PERIOD (flags))
+            {
+              if (n == string_end || c != (UCHAR) *n)
+                return FNM_NOMATCH;
+
+              new_no_leading_period = true;
+              break;
+            }
+          FALLTHROUGH;
+        default:
+        normal_match:
+          if (n == string_end || c != FOLD ((UCHAR) *n))
+            return FNM_NOMATCH;
+        }
+
+      no_leading_period = new_no_leading_period;
+      ++n;
+    }
+
+  if (n == string_end)
+    return 0;
+
+  if ((flags & FNM_LEADING_DIR) && n != string_end && *n == L_('/'))
+    /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz".  */
+    return 0;
+
+  return FNM_NOMATCH;
+}
+
+
+static const CHAR *
+END (const CHAR *pattern)
+{
+  const CHAR *p = pattern;
+
+  while (1)
+    if (*++p == L_('\0'))
+      /* This is an invalid pattern.  */
+      return pattern;
+    else if (*p == L_('['))
+      {
+        /* Handle brackets special.  */
+        if (posixly_correct == 0)
+          posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
+
+        /* Skip the not sign.  We have to recognize it because of a possibly
+           following ']'.  */
+        if (*++p == L_('!') || (posixly_correct < 0 && *p == L_('^')))
+          ++p;
+        /* A leading ']' is recognized as such.  */
+        if (*p == L_(']'))
+          ++p;
+        /* Skip over all characters of the list.  */
+        while (*p != L_(']'))
+          if (*p++ == L_('\0'))
+            /* This is no valid pattern.  */
+            return pattern;
+      }
+    else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@')
+              || *p == L_('!')) && p[1] == L_('('))
+      {
+        p = END (p + 1);
+        if (*p == L_('\0'))
+          /* This is an invalid pattern.  */
+          return pattern;
+      }
+    else if (*p == L_(')'))
+      break;
+
+  return p + 1;
+}
+
+
+static int
+EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
+     bool no_leading_period, int flags, size_t alloca_used)
+{
+  const CHAR *startp;
+  ptrdiff_t level;
+  struct patternlist
+  {
+    struct patternlist *next;
+    CHAR malloced;
+    CHAR str __flexarr;
+  } *list = NULL;
+  struct patternlist **lastp = &list;
+  size_t pattern_len = STRLEN (pattern);
+  bool any_malloced = false;
+  const CHAR *p;
+  const CHAR *rs;
+  int retval = 0;
+
+  /* Parse the pattern.  Store the individual parts in the list.  */
+  level = 0;
+  for (startp = p = pattern + 1; level >= 0; ++p)
+    if (*p == L_('\0'))
+      {
+        /* This is an invalid pattern.  */
+        retval = -1;
+        goto out;
+      }
+    else if (*p == L_('['))
+      {
+        /* Handle brackets special.  */
+        if (posixly_correct == 0)
+          posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
+
+        /* Skip the not sign.  We have to recognize it because of a possibly
+           following ']'.  */
+        if (*++p == L_('!') || (posixly_correct < 0 && *p == L_('^')))
+          ++p;
+        /* A leading ']' is recognized as such.  */
+        if (*p == L_(']'))
+          ++p;
+        /* Skip over all characters of the list.  */
+        while (*p != L_(']'))
+          if (*p++ == L_('\0'))
+            {
+              /* This is no valid pattern.  */
+              retval = -1;
+              goto out;
+            }
+      }
+    else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@')
+              || *p == L_('!')) && p[1] == L_('('))
+      /* Remember the nesting level.  */
+      ++level;
+    else if (*p == L_(')'))
+      {
+        if (level-- == 0)
+          {
+            /* This means we found the end of the pattern.  */
+#define NEW_PATTERN \
+            struct patternlist *newp;                                         \
+            size_t plen = (opt == L_('?') || opt == L_('@')                   \
+                           ? pattern_len : (p - startp + 1UL));               \
+            idx_t slen = FLEXSIZEOF (struct patternlist, str, 0);             \
+            idx_t new_used = alloca_used + slen;                              \
+            idx_t plensize;                                                   \
+            if (ckd_mul (&plensize, plen, sizeof (CHAR))                      \
+                || ckd_add (&new_used, new_used, plensize))                   \
+              {                                                               \
+                retval = -2;                                                  \
+                goto out;                                                     \
+              }                                                               \
+            slen += plensize;                                                 \
+            bool malloced = ! __libc_use_alloca (new_used);                   \
+            if (__glibc_unlikely (malloced))                                  \
+              {                                                               \
+                newp = malloc (slen);                                         \
+                if (newp == NULL)                                             \
+                  {                                                           \
+                    retval = -2;                                              \
+                    goto out;                                                 \
+                  }                                                           \
+                any_malloced = true;                                          \
+              }                                                               \
+            else                                                              \
+              newp = alloca_account (slen, alloca_used);                      \
+            newp->next = NULL;                                                \
+            newp->malloced = malloced;                                        \
+            *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L_('\0');   \
+            *lastp = newp;                                                    \
+            lastp = &newp->next
+            NEW_PATTERN;
+          }
+      }
+    else if (*p == L_('|'))
+      {
+        if (level == 0)
+          {
+            NEW_PATTERN;
+            startp = p + 1;
+          }
+      }
+  assert (list != NULL);
+  assert (p[-1] == L_(')'));
+#undef NEW_PATTERN
+
+  switch (opt)
+    {
+    case L_('*'):
+      if (FCT (p, string, string_end, no_leading_period, flags, NULL,
+               alloca_used) == 0)
+        goto success;
+      FALLTHROUGH;
+    case L_('+'):
+      do
+        {
+          for (rs = string; rs <= string_end; ++rs)
+            /* First match the prefix with the current pattern with the
+               current pattern.  */
+            if (FCT (list->str, string, rs, no_leading_period,
+                     flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
+                     NULL, alloca_used) == 0
+                /* This was successful.  Now match the rest with the rest
+                   of the pattern.  */
+                && (FCT (p, rs, string_end,
+                         rs == string
+                         ? no_leading_period
+                         : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
+                         flags & FNM_FILE_NAME
+                         ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0
+                    /* This didn't work.  Try the whole pattern.  */
+                    || (rs != string
+                        && FCT (pattern - 1, rs, string_end,
+                                rs == string
+                                ? no_leading_period
+                                : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
+                                flags & FNM_FILE_NAME
+                                ? flags : flags & ~FNM_PERIOD, NULL,
+                                alloca_used) == 0)))
+              /* It worked.  Signal success.  */
+              goto success;
+        }
+      while ((list = list->next) != NULL);
+
+      /* None of the patterns lead to a match.  */
+      retval = FNM_NOMATCH;
+      break;
+
+    case L_('?'):
+      if (FCT (p, string, string_end, no_leading_period, flags, NULL,
+               alloca_used) == 0)
+        goto success;
+      FALLTHROUGH;
+    case L_('@'):
+      do
+        /* I cannot believe it but 'strcat' is actually acceptable
+           here.  Match the entire string with the prefix from the
+           pattern list and the rest of the pattern following the
+           pattern list.  */
+        if (FCT (STRCAT (list->str, p), string, string_end,
+                 no_leading_period,
+                 flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
+                 NULL, alloca_used) == 0)
+          /* It worked.  Signal success.  */
+          goto success;
+      while ((list = list->next) != NULL);
+
+      /* None of the patterns lead to a match.  */
+      retval = FNM_NOMATCH;
+      break;
+
+    case L_('!'):
+      for (rs = string; rs <= string_end; ++rs)
+        {
+          struct patternlist *runp;
+
+          for (runp = list; runp != NULL; runp = runp->next)
+            if (FCT (runp->str, string, rs,  no_leading_period,
+                     flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
+                     NULL, alloca_used) == 0)
+              break;
+
+          /* If none of the patterns matched see whether the rest does.  */
+          if (runp == NULL
+              && (FCT (p, rs, string_end,
+                       rs == string
+                       ? no_leading_period
+                       : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
+                       flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
+                       NULL, alloca_used) == 0))
+            /* This is successful.  */
+            goto success;
+        }
+
+      /* None of the patterns together with the rest of the pattern
+         lead to a match.  */
+      retval = FNM_NOMATCH;
+      break;
+
+    default:
+      assert (! "Invalid extended matching operator");
+      retval = -1;
+      break;
+    }
+
+ success:
+ out:
+  if (any_malloced)
+    while (list != NULL)
+      {
+        struct patternlist *old = list;
+        list = list->next;
+        if (old->malloced)
+          free (old);
+      }
+
+  return retval;
+}
+
+
+#undef FOLD
+#undef CHAR
+#undef UCHAR
+#undef INT
+#undef FCT
+#undef EXT
+#undef END
+#undef STRUCT
+#undef MEMPCPY
+#undef MEMCHR
+#undef STRLEN
+#undef STRCAT
+#undef L_
+#undef UCHAR_TO_WCHAR
+#undef WIDE_CHAR_VERSION
+#undef FINDIDX
deleted file mode 120000 (symlink)
index f750813ff2c550c0c2eb7019e54c7bc0964e5ba9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fopen-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a6446665e0481d6784f3f81f0e8e0914b048dd8f
--- /dev/null
@@ -0,0 +1,63 @@
+/* Invoke fopen, but avoid some glitches.
+
+   Copyright (C) 2001, 2004-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "stdio-safer.h"
+
+#include <errno.h>
+#include <unistd.h>
+#include "unistd-safer.h"
+
+/* Like fopen, but do not return stdin, stdout, or stderr.  */
+
+FILE *
+fopen_safer (char const *file, char const *mode)
+{
+  FILE *fp = fopen (file, mode);
+
+  if (fp)
+    {
+      int fd = fileno (fp);
+
+      if (0 <= fd && fd <= STDERR_FILENO)
+        {
+          int f = dup_safer (fd);
+
+          if (f < 0)
+            {
+              int e = errno;
+              fclose (fp);
+              errno = e;
+              return NULL;
+            }
+
+          if (fclose (fp) != 0
+              || ! (fp = fdopen (f, mode)))
+            {
+              int e = errno;
+              close (f);
+              errno = e;
+              return NULL;
+            }
+        }
+    }
+
+  return fp;
+}
deleted file mode 120000 (symlink)
index 10b56f8eaf68f152ead00d64c3924eabdbaf74d6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fopen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d3b57a987a07106bc223f3c30c8e01024c27d441
--- /dev/null
@@ -0,0 +1,237 @@
+/* Open a stream to a file.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+/* If the user's config.h happens to include <stdio.h>, let it include only
+   the system's <stdio.h> here, so that orig_fopen doesn't recurse to
+   rpl_fopen.  */
+#define _GL_ALREADY_INCLUDING_STDIO_H
+#include <config.h>
+
+/* Get the original definition of fopen.  It might be defined as a macro.  */
+#include <stdio.h>
+#undef _GL_ALREADY_INCLUDING_STDIO_H
+
+static FILE *
+orig_fopen (const char *filename, const char *mode)
+{
+  return fopen (filename, mode);
+}
+
+/* Specification.  */
+#ifdef __osf__
+/* Write "stdio.h" here, not <stdio.h>, otherwise OSF/1 5.1 DTK cc eliminates
+   this include because of the preliminary #include <stdio.h> above.  */
+# include "stdio.h"
+#else
+# include <stdio.h>
+#endif
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+FILE *
+rpl_fopen (const char *filename, const char *mode)
+{
+  int open_direction;
+  int open_flags;
+#if GNULIB_FOPEN_GNU
+  bool open_flags_gnu;
+# define BUF_SIZE 80
+  char fdopen_mode_buf[BUF_SIZE + 1];
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+  if (strcmp (filename, "/dev/null") == 0)
+    filename = "NUL";
+#endif
+
+  /* Parse the mode.  */
+  open_direction = 0;
+  open_flags = 0;
+#if GNULIB_FOPEN_GNU
+  open_flags_gnu = false;
+#endif
+  {
+    const char *p = mode;
+#if GNULIB_FOPEN_GNU
+    char *q = fdopen_mode_buf;
+#endif
+
+    for (; *p != '\0'; p++)
+      {
+        switch (*p)
+          {
+          case 'r':
+            open_direction = O_RDONLY;
+#if GNULIB_FOPEN_GNU
+            if (q < fdopen_mode_buf + BUF_SIZE)
+              *q++ = *p;
+#endif
+            continue;
+          case 'w':
+            open_direction = O_WRONLY;
+            open_flags |= O_CREAT | O_TRUNC;
+#if GNULIB_FOPEN_GNU
+            if (q < fdopen_mode_buf + BUF_SIZE)
+              *q++ = *p;
+#endif
+            continue;
+          case 'a':
+            open_direction = O_WRONLY;
+            open_flags |= O_CREAT | O_APPEND;
+#if GNULIB_FOPEN_GNU
+            if (q < fdopen_mode_buf + BUF_SIZE)
+              *q++ = *p;
+#endif
+            continue;
+          case 'b':
+            /* While it is non-standard, O_BINARY is guaranteed by
+               gnulib <fcntl.h>.  We can also assume that orig_fopen
+               supports the 'b' flag.  */
+            open_flags |= O_BINARY;
+#if GNULIB_FOPEN_GNU
+            if (q < fdopen_mode_buf + BUF_SIZE)
+              *q++ = *p;
+#endif
+            continue;
+          case '+':
+            open_direction = O_RDWR;
+#if GNULIB_FOPEN_GNU
+            if (q < fdopen_mode_buf + BUF_SIZE)
+              *q++ = *p;
+#endif
+            continue;
+#if GNULIB_FOPEN_GNU
+          case 'x':
+            open_flags |= O_EXCL;
+            open_flags_gnu = true;
+            continue;
+          case 'e':
+            open_flags |= O_CLOEXEC;
+            open_flags_gnu = true;
+            continue;
+#endif
+          default:
+            break;
+          }
+#if GNULIB_FOPEN_GNU
+        /* The rest of the mode string can be a platform-dependent extension.
+           Copy it unmodified.  */
+        {
+          size_t len = strlen (p);
+          if (len > fdopen_mode_buf + BUF_SIZE - q)
+            len = fdopen_mode_buf + BUF_SIZE - q;
+          memcpy (q, p, len);
+          q += len;
+        }
+#endif
+        break;
+      }
+#if GNULIB_FOPEN_GNU
+    *q = '\0';
+#endif
+  }
+
+#if FOPEN_TRAILING_SLASH_BUG
+  /* Fail if the mode requires write access and the filename ends in a slash,
+     as POSIX says such a filename must name a directory
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>:
+       "A pathname that contains at least one non-<slash> character and that
+        ends with one or more trailing <slash> characters shall not be resolved
+        successfully unless the last pathname component before the trailing
+        <slash> characters names an existing directory"
+     If the named file already exists as a directory, then if a mode that
+     requires write access is specified, fopen() must fail because POSIX
+     <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html>
+     says that it fails with errno = EISDIR in this case.
+     If the named file does not exist or does not name a directory, then
+     fopen() must fail since the file does not contain a '.' directory.  */
+  {
+    size_t len = strlen (filename);
+    if (len > 0 && filename[len - 1] == '/')
+      {
+        int fd;
+        struct stat statbuf;
+        FILE *fp;
+
+        if (open_direction != O_RDONLY)
+          {
+            errno = EISDIR;
+            return NULL;
+          }
+
+        fd = open (filename, open_direction | open_flags,
+                   S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
+        if (fd < 0)
+          return NULL;
+
+        if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
+          {
+            close (fd);
+            errno = ENOTDIR;
+            return NULL;
+          }
+
+# if GNULIB_FOPEN_GNU
+        fp = fdopen (fd, fdopen_mode_buf);
+# else
+        fp = fdopen (fd, mode);
+# endif
+        if (fp == NULL)
+          {
+            int saved_errno = errno;
+            close (fd);
+            errno = saved_errno;
+          }
+        return fp;
+      }
+  }
+#endif
+
+#if GNULIB_FOPEN_GNU
+  if (open_flags_gnu)
+    {
+      int fd;
+      FILE *fp;
+
+      fd = open (filename, open_direction | open_flags,
+                 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
+      if (fd < 0)
+        return NULL;
+
+      fp = fdopen (fd, fdopen_mode_buf);
+      if (fp == NULL)
+        {
+          int saved_errno = errno;
+          close (fd);
+          errno = saved_errno;
+        }
+      return fp;
+    }
+#endif
+
+  /* open_direction is sometimes used, sometimes unused.
+     Silence gcc's warning about this situation.  */
+  (void) open_direction;
+
+  return orig_fopen (filename, mode);
+}
deleted file mode 120000 (symlink)
index 0896c4c138eee7f0ad062cfcf4d0db685f7d9515..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fpending.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..514689558444fd8ab9e9ce00e3df1a4cb87df2a4
--- /dev/null
@@ -0,0 +1,63 @@
+/* fpending.c -- return the number of pending output bytes on a stream
+   Copyright (C) 2000, 2004, 2006-2007, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+/* Specification.  */
+#include "fpending.h"
+
+#include "stdio-impl.h"
+
+/* This file is not used on systems that already have the __fpending function,
+   namely glibc >= 2.2, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34,
+   Android API >= 23.  */
+
+/* Return the number of pending (aka buffered, unflushed)
+   bytes on the stream, FP, that is open for writing.  */
+size_t
+__fpending (FILE *fp)
+{
+  /* Most systems provide FILE as a struct and the necessary bitmask in
+     <stdio.h>, because they need it for implementing getc() and putc() as
+     fast macros.  */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+  /* GNU libc, BeOS, Haiku, Linux libc5 */
+  return fp->_IO_write_ptr - fp->_IO_write_base;
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */
+  return fp_->_p - fp_->_bf._base;
+#elif defined __EMX__                /* emx+gcc */
+  return fp->_ptr - fp->_buffer;
+#elif defined __minix                /* Minix */
+  return fp_->_ptr - fp_->_buf;
+#elif defined _IOERR                 /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+  return (fp_->_ptr ? fp_->_ptr - fp_->_base : 0);
+#elif defined __UCLIBC__             /* uClibc */
+  return (fp->__modeflags & __FLAG_WRITING ? fp->__bufpos - fp->__bufstart : 0);
+#elif defined __QNX__                /* QNX */
+  return (fp->_Mode & 0x2000 /*_MWRITE*/ ? fp->_Next - fp->_Buf : 0);
+#elif defined __MINT__               /* Atari FreeMiNT */
+  return fp->__bufp - fp->__buffer;
+#elif defined EPLAN9                 /* Plan9 */
+  return fp->wp - fp->buf;
+#else
+# error "Please port gnulib fpending.c to your platform!"
+  return 1;
+#endif
+}
deleted file mode 120000 (symlink)
index 662483d6fbfb99705c18ba7b8569e7147fde7a14..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fpending.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..28db3b403d99760c01981b17573cd89c4198d899
--- /dev/null
@@ -0,0 +1,35 @@
+/* Declare __fpending.
+
+   Copyright (C) 2000, 2003, 2005-2006, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Jim Meyering.  */
+
+/* This file uses _GL_ATTRIBUTE_PURE, HAVE_STDIO_EXT_H,
+   HAVE_DECL___FPENDING.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+#include <stdio.h>
+#if HAVE_STDIO_EXT_H
+# include <stdio_ext.h>
+#endif
+
+#if !HAVE_DECL___FPENDING
+size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE;
+#endif
deleted file mode 120000 (symlink)
index 0dbc63c1f4fe0dc35c17ece5e5fd257820259331..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fprintftime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f3d06c441582290a5f08263ac13654ef260a22ef
--- /dev/null
@@ -0,0 +1,19 @@
+/* Generate time strings directly to the output.
+
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define FPRINTFTIME 1
+#include "nstrftime.c"
deleted file mode 120000 (symlink)
index 57aec82dc1d0b67afe9c33d6a1311554fe9f1fc2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fprintftime.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a36325bf38222822b6efb90e02090bcd6f04711a
--- /dev/null
@@ -0,0 +1,29 @@
+/* Generate time strings directly to the output.  */
+
+/* Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <time.h>
+
+/* A cross between fprintf and nstrftime, that prints directly
+   to the output stream, without the need for the potentially
+   large buffer that nstrftime would require.
+
+   Output to stream FP the result of formatting (according to the
+   nstrftime format string, FMT) the time data, *TM, and the ZONE
+   and NANOSECONDS values.  */
+size_t fprintftime (FILE *fp, char const *fmt, struct tm const *tm,
+                    timezone_t zone, int nanoseconds);
deleted file mode 120000 (symlink)
index 91a74729175f32c7b865e4286d39b08427c4b9d5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fpucw.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c7387a22992aae67a764c099266ae61eff9c60e1
--- /dev/null
@@ -0,0 +1,108 @@
+/* Manipulating the FPU control word.  -*- coding: utf-8 -*-
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2007.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _FPUCW_H
+#define _FPUCW_H
+
+/* The i386 floating point hardware (the 387 compatible FPU, not the modern
+   SSE/SSE2 hardware) has a controllable rounding precision.  It is specified
+   through the 'PC' bits in the FPU control word ('fctrl' register).  (See
+   the GNU libc i386 <fpu_control.h> header for details.)
+
+   On some platforms, such as Linux or Solaris, the default precision setting
+   is set to "extended precision".  This means that 'long double' instructions
+   operate correctly, but 'double' computations often produce slightly
+   different results as on strictly IEEE 754 conforming systems.
+
+   On some platforms, such as NetBSD, the default precision is set to
+   "double precision".  This means that 'long double' instructions will operate
+   only as 'double', i.e. lead to wrong results.  Similarly on FreeBSD 6.4, at
+   least for the division of 'long double' numbers.
+
+   The FPU control word is under control of the application, i.e. it is
+   not required to be set either way by the ABI.  (In fact, the i386 ABI
+   https://www.linux-mips.org/pub/linux/mips/doc/ABI/abi386-4.pdf page 3-12 = page 38
+   is not clear about it.  But in any case, gcc treats the control word
+   like a "preserved" register: it emits code that assumes that the control
+   word is preserved across calls, and it restores the control word at the
+   end of functions that modify it.)
+
+   See Vincent Lefèvre's page https://www.vinc17.net/research/extended.en.html
+   for a good explanation.
+   See https://web.archive.org/web/20060905133417/http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html
+   some argumentation which setting should be the default.  */
+
+/* This header file provides the following facilities:
+     fpucw_t                        integral type holding the value of 'fctrl'
+     FPU_PC_MASK                    bit mask denoting the precision control
+     FPU_PC_DOUBLE                  precision control for 53 bits mantissa
+     FPU_PC_EXTENDED                precision control for 64 bits mantissa
+     GET_FPUCW ()                   yields the current FPU control word
+     SET_FPUCW (word)               sets the FPU control word
+     DECL_LONG_DOUBLE_ROUNDING      variable declaration for
+                                    BEGIN/END_LONG_DOUBLE_ROUNDING
+     BEGIN_LONG_DOUBLE_ROUNDING ()  starts a sequence of instructions with
+                                    'long double' safe operation precision
+     END_LONG_DOUBLE_ROUNDING ()    ends a sequence of instructions with
+                                    'long double' safe operation precision
+ */
+
+/* Inline assembler like this works only with GNU C and clang.  */
+#if (defined __i386__ || defined __x86_64__) && (defined __GNUC__ || defined __clang__)
+
+typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */
+
+# define FPU_PC_MASK 0x0300
+# define FPU_PC_DOUBLE 0x200    /* glibc calls this _FPU_DOUBLE */
+# define FPU_PC_EXTENDED 0x300  /* glibc calls this _FPU_EXTENDED */
+
+# define GET_FPUCW() __extension__ \
+  ({ fpucw_t _cw;                                               \
+     __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw));         \
+     _cw;                                                       \
+   })
+# define SET_FPUCW(word) __extension__ \
+  (void)({ fpucw_t _ncw = (word);                               \
+           __asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw));  \
+         })
+
+# define DECL_LONG_DOUBLE_ROUNDING \
+  fpucw_t oldcw;
+# define BEGIN_LONG_DOUBLE_ROUNDING() \
+  (void)(oldcw = GET_FPUCW (),                                  \
+         SET_FPUCW ((oldcw & ~FPU_PC_MASK) | FPU_PC_EXTENDED))
+# define END_LONG_DOUBLE_ROUNDING() \
+  SET_FPUCW (oldcw)
+
+#else
+
+typedef unsigned int fpucw_t;
+
+# define FPU_PC_MASK 0
+# define FPU_PC_DOUBLE 0
+# define FPU_PC_EXTENDED 0
+
+# define GET_FPUCW() 0
+# define SET_FPUCW(word) (void)(word)
+
+# define DECL_LONG_DOUBLE_ROUNDING
+# define BEGIN_LONG_DOUBLE_ROUNDING()
+# define END_LONG_DOUBLE_ROUNDING()
+
+#endif
+
+#endif /* _FPUCW_H */
deleted file mode 120000 (symlink)
index bc9321f730de20a59558e59c8b28e6a8c46deeaf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fpurge.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..52a3dceff3749b58954144db3ecc7750801c9927
--- /dev/null
@@ -0,0 +1,150 @@
+/* Flushing buffers of a FILE stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#if HAVE___FPURGE                   /* glibc >= 2.2, Haiku, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.10, Android API >= 23, musl libc */
+# if HAVE_STDIO_EXT_H
+#  include <stdio_ext.h>
+# endif
+#endif
+#include <stdlib.h>
+
+#include "stdio-impl.h"
+
+int
+fpurge (FILE *fp)
+{
+#if HAVE___FPURGE                   /* glibc >= 2.2, Haiku, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.10, Android API >= 23, musl libc */
+
+  __fpurge (fp);
+  /* The __fpurge function does not have a return value.  */
+  return 0;
+
+#elif HAVE_FPURGE                   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin >= 1.7 */
+
+  /* Call the system's fpurge function.  */
+# undef fpurge
+# if !HAVE_DECL_FPURGE
+  extern int fpurge (FILE *);
+# endif
+  int result = fpurge (fp);
+# if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+  if (result == 0)
+    /* Correct the invariants that fpurge broke.
+       <stdio.h> on BSD systems says:
+         "The following always hold: if _flags & __SRD, _w is 0."
+       If this invariant is not fulfilled and the stream is read-write but
+       currently reading, subsequent putc or fputc calls will write directly
+       into the buffer, although they shouldn't be allowed to.  */
+    if ((fp_->_flags & __SRD) != 0)
+      fp_->_w = 0;
+# endif
+  return result;
+
+#else
+
+  /* Most systems provide FILE as a struct and the necessary bitmask in
+     <stdio.h>, because they need it for implementing getc() and putc() as
+     fast macros.  */
+# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+  /* GNU libc, BeOS, Haiku, Linux libc5 */
+  fp->_IO_read_end = fp->_IO_read_ptr;
+  fp->_IO_write_ptr = fp->_IO_write_base;
+  /* Avoid memory leak when there is an active ungetc buffer.  */
+  if (fp->_IO_save_base != NULL)
+    {
+      free (fp->_IO_save_base);
+      fp->_IO_save_base = NULL;
+    }
+  return 0;
+# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+  fp_->_p = fp_->_bf._base;
+  fp_->_r = 0;
+  fp_->_w = ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
+             ? fp_->_bf._size
+             : 0);
+  /* Avoid memory leak when there is an active ungetc buffer.  */
+  if (fp_ub._base != NULL)
+    {
+      if (fp_ub._base != fp_->_ubuf)
+        free (fp_ub._base);
+      fp_ub._base = NULL;
+    }
+  return 0;
+# elif defined __EMX__              /* emx+gcc */
+  fp->_ptr = fp->_buffer;
+  fp->_rcount = 0;
+  fp->_wcount = 0;
+  fp->_ungetc_count = 0;
+  return 0;
+# elif defined __minix              /* Minix */
+  fp->_ptr = fp->_buf;
+  if (fp->_ptr != NULL)
+    fp->_count = 0;
+  return 0;
+# elif defined _IOERR               /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+  fp_->_ptr = fp_->_base;
+  if (fp_->_ptr != NULL)
+    fp_->_cnt = 0;
+  return 0;
+# elif defined __UCLIBC__           /* uClibc */
+#  ifdef __STDIO_BUFFERS
+  if (fp->__modeflags & __FLAG_WRITING)
+    fp->__bufpos = fp->__bufstart;
+  else if (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING))
+    fp->__bufpos = fp->__bufread;
+#  endif
+  return 0;
+# elif defined __QNX__              /* QNX */
+  fp->_Rback = fp->_Back + sizeof (fp->_Back);
+  fp->_Rsave = NULL;
+  if (fp->_Mode & 0x2000 /* _MWRITE */)
+    /* fp->_Buf <= fp->_Next <= fp->_Wend */
+    fp->_Next = fp->_Buf;
+  else
+    /* fp->_Buf <= fp->_Next <= fp->_Rend */
+    fp->_Rend = fp->_Next;
+  return 0;
+# elif defined __MINT__             /* Atari FreeMiNT */
+  if (fp->__pushed_back)
+    {
+      fp->__bufp = fp->__pushback_bufp;
+      fp->__pushed_back = 0;
+    }
+  /* Preserve the current file position.  */
+  if (fp->__target != -1)
+    fp->__target += fp->__bufp - fp->__buffer;
+  fp->__bufp = fp->__buffer;
+  /* Nothing in the buffer, next getc is nontrivial.  */
+  fp->__get_limit = fp->__bufp;
+  /* Nothing in the buffer, next putc is nontrivial.  */
+  fp->__put_limit = fp->__buffer;
+  return 0;
+# elif defined EPLAN9               /* Plan9 */
+  fp->rp = fp->wp = fp->lp = fp->buf;
+  return 0;
+# else
+#  error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib."
+# endif
+
+#endif
+}
deleted file mode 120000 (symlink)
index d6115593025157500160c73962ef2c6e9e818d11..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freadahead.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c7f235c4bda341e86301bb8e75de04caeb85572b
--- /dev/null
@@ -0,0 +1,103 @@
+/* Retrieve information about a FILE stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "freadahead.h"
+
+#include <stdlib.h>
+#include "stdio-impl.h"
+
+#if defined __DragonFly__
+/* Defined in libc, but not declared in <stdio.h>.  */
+extern size_t __sreadahead (FILE *);
+#endif
+
+/* This file is not used on systems that have the __freadahead function,
+   namely musl libc.  */
+
+size_t
+freadahead (FILE *fp)
+{
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+  /* GNU libc, BeOS, Haiku, Linux libc5 */
+  if (fp->_IO_write_ptr > fp->_IO_write_base)
+    return 0;
+  return (fp->_IO_read_end - fp->_IO_read_ptr)
+         + (fp->_flags & _IO_IN_BACKUP ? fp->_IO_save_end - fp->_IO_save_base :
+            0);
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+  if ((fp_->_flags & __SWR) != 0 || fp_->_r < 0)
+    return 0;
+# if defined __DragonFly__
+  return __sreadahead (fp);
+# else
+  return fp_->_r
+         + (HASUB (fp) ? fp_->_ur : 0);
+# endif
+#elif defined __EMX__               /* emx+gcc */
+  if ((fp->_flags & _IOWRT) != 0)
+    return 0;
+  /* Note: fp->_ungetc_count > 0 implies fp->_rcount <= 0,
+           fp->_ungetc_count = 0 implies fp->_rcount >= 0.  */
+  /* equivalent to
+     (fp->_ungetc_count == 0 ? fp->_rcount : fp->_ungetc_count - fp->_rcount) */
+  return (fp->_rcount > 0 ? fp->_rcount : fp->_ungetc_count - fp->_rcount);
+#elif defined __minix               /* Minix */
+  if ((fp_->_flags & _IOWRITING) != 0)
+    return 0;
+  return fp_->_count;
+#elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+  if ((fp_->_flag & _IOWRT) != 0)
+    return 0;
+  return fp_->_cnt;
+#elif defined __UCLIBC__            /* uClibc */
+# ifdef __STDIO_BUFFERS
+  if (fp->__modeflags & __FLAG_WRITING)
+    return 0;
+  return (fp->__bufread - fp->__bufpos)
+         + (fp->__modeflags & __FLAG_UNGOT ? 1 : 0);
+# else
+  return 0;
+# endif
+#elif defined __QNX__               /* QNX */
+  if ((fp->_Mode & 0x2000 /* _MWRITE */) != 0)
+    return 0;
+  /* fp->_Buf <= fp->_Next <= fp->_Rend,
+     and fp->_Rend may be overridden by fp->_Rsave. */
+  return ((fp->_Rsave ? fp->_Rsave : fp->_Rend) - fp->_Next)
+         + (fp->_Mode & 0x4000 /* _MBYTE */
+            ? (fp->_Back + sizeof (fp->_Back)) - fp->_Rback
+            : 0);
+#elif defined __MINT__              /* Atari FreeMiNT */
+  if (!fp->__mode.__read)
+    return 0;
+  return (fp->__pushed_back
+          ? fp->__get_limit - fp->__pushback_bufp + 1
+          : fp->__get_limit - fp->__bufp);
+#elif defined EPLAN9                /* Plan9 */
+  if (fp->state == 4 /* WR */ || fp->rp >= fp->wp)
+    return 0;
+  return fp->wp - fp->rp;
+#elif defined SLOW_BUT_NO_HACKS     /* users can define this */
+  abort ();
+  return 0;
+#else
+ #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
+#endif
+}
deleted file mode 120000 (symlink)
index 24797f78b59a0ee60952e7860ba9adc7a7b3a01b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freadahead.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f4fc26cbd725ea501330f169c62dded7af6b4a71
--- /dev/null
@@ -0,0 +1,52 @@
+/* Retrieve information about a FILE stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses _GL_ATTRIBUTE_PURE, HAVE___FREADAHEAD.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+#include <stdio.h>
+
+/* Assuming the stream STREAM is open for reading:
+   Return the number of bytes waiting in the input buffer of STREAM.
+   This includes both the bytes that have been read from the underlying input
+   source and the bytes that have been pushed back through 'ungetc'.
+
+   If this number is 0 and the stream is not currently writing,
+   fflush (STREAM) is known to be a no-op.
+
+   STREAM must not be wide-character oriented.  */
+
+#if HAVE___FREADAHEAD /* musl libc, Android API level ≥ 33 */
+
+# include <stdio_ext.h>
+# define freadahead(stream) __freadahead (stream)
+
+#else
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+extern size_t freadahead (FILE *stream) _GL_ATTRIBUTE_PURE;
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index fa16157ea9982f8b72982ed21bbb6e3a73a2965f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freading.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c80d9aa81769bed6c71c01ca24e4146c35ef67aa
--- /dev/null
@@ -0,0 +1,76 @@
+/* Retrieve information about a FILE stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "freading.h"
+
+#include "stdio-impl.h"
+
+/* Don't use glibc's __freading function in glibc < 2.7, see
+   <https://sourceware.org/bugzilla/show_bug.cgi?id=4359>  */
+#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)))
+
+bool
+freading (FILE *fp)
+{
+  /* Most systems provide FILE as a struct and the necessary bitmask in
+     <stdio.h>, because they need it for implementing getc() and putc() as
+     fast macros.  */
+# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+  /* GNU libc, BeOS, Haiku, Linux libc5 */
+  return ((fp->_flags & _IO_NO_WRITES) != 0
+          || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
+              && fp->_IO_read_base != NULL));
+# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */
+  return (fp_->_flags & __SRD) != 0;
+# elif defined __EMX__               /* emx+gcc */
+  return (fp->_flags & _IOREAD) != 0;
+# elif defined __minix               /* Minix */
+  return (fp->_flags & _IOREADING) != 0;
+# elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+#  if defined __sun                  /* Solaris */
+  return (fp_->_flag & _IOREAD) != 0 && (fp_->_flag & _IOWRT) == 0;
+#  else
+  return (fp_->_flag & _IOREAD) != 0;
+#  endif
+# elif defined __UCLIBC__            /* uClibc */
+  return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
+# elif defined __QNX__               /* QNX */
+  return ((fp->_Mode & 0x2 /* _MOPENW */) == 0
+          || (fp->_Mode & 0x1000 /* _MREAD */) != 0);
+# elif defined __MINT__              /* Atari FreeMiNT */
+  if (!fp->__mode.__write)
+    return 1;
+  if (!fp->__mode.__read)
+    return 0;
+#  ifdef _IO_CURRENTLY_GETTING /* Flag added on 2009-02-28 */
+  return (fp->__flags & _IO_CURRENTLY_GETTING) != 0;
+#  else
+  return (fp->__buffer < fp->__get_limit /*|| fp->__bufp == fp->__put_limit ??*/);
+#  endif
+# elif defined EPLAN9                /* Plan9 */
+  if (fp->state == 0 /* CLOSED */ || fp->state == 4 /* WR */)
+    return 0;
+  return (fp->state == 3 /* RD */ && (fp->bufl == 0 || fp->rp < fp->wp));
+# else
+#  error "Please port gnulib freading.c to your platform!"
+# endif
+}
+
+#endif
deleted file mode 120000 (symlink)
index 8b13194b22ce4ed106973d4706ca642dbdc15cf6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freading.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..943354f5ebe37bd79b5515b2a415304383cf0ee4
--- /dev/null
@@ -0,0 +1,59 @@
+/* Retrieve information about a FILE stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses _GL_ATTRIBUTE_PURE, HAVE___FREADING, HAVE_STDIO_EXT_H.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdio.h>
+
+/* Return true if the stream STREAM is opened read-only, or if the
+   last operation on the stream was a read operation.  Return false if
+   the stream is opened write-only or append-only, or if it supports
+   writing and there is no current read operation (such as fgetc).
+
+   freading and fwriting will never both be true.  If STREAM supports
+   both reads and writes, then:
+     - both freading and fwriting might be false when the stream is first
+       opened, after read encounters EOF, or after fflush,
+     - freading might be false or true and fwriting might be false
+       after repositioning (such as fseek, fsetpos, or rewind),
+   depending on the underlying implementation.
+
+   STREAM must not be wide-character oriented.  */
+
+#if HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
+/* Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34, Android API >= 29, not glibc >= 2.2, but glibc >= 2.7, or musl libc  */
+
+# if HAVE_STDIO_EXT_H
+#  include <stdio_ext.h>
+# endif
+# define freading(stream) (__freading (stream) != 0)
+
+#else
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+extern bool freading (FILE *stream) _GL_ATTRIBUTE_PURE;
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index c07d3d2f6651eb15dd833365327b2ec57371de03..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freadptr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6edc2a1f89c45ca388541c1203bccb1515ed6e90
--- /dev/null
@@ -0,0 +1,125 @@
+/* Retrieve information about a FILE stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "freadptr.h"
+
+#include <stdlib.h>
+
+#include "stdio-impl.h"
+
+/* This file is not used on systems that have the __freadptr function,
+   namely musl libc.  */
+
+const char *
+freadptr (FILE *fp, size_t *sizep)
+{
+  size_t size;
+
+  /* Keep this code in sync with freadahead!  */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+  /* GNU libc, BeOS, Haiku, Linux libc5 */
+  if (fp->_IO_write_ptr > fp->_IO_write_base)
+    return NULL;
+  size = fp->_IO_read_end - fp->_IO_read_ptr;
+  if (size == 0)
+    return NULL;
+  *sizep = size;
+  return (const char *) fp->_IO_read_ptr;
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+  if ((fp_->_flags & __SWR) != 0 || fp_->_r < 0)
+    return NULL;
+  size = fp_->_r;
+  if (size == 0)
+    return NULL;
+  *sizep = size;
+  return (const char *) fp_->_p;
+#elif defined __EMX__               /* emx+gcc */
+  if ((fp->_flags & _IOWRT) != 0)
+    return NULL;
+  /* Note: fp->_ungetc_count > 0 implies fp->_rcount <= 0,
+           fp->_ungetc_count = 0 implies fp->_rcount >= 0.  */
+  if (fp->_rcount <= 0)
+    return NULL;
+  if (!(fp->_ungetc_count == 0))
+    abort ();
+  *sizep = fp->_rcount;
+  return fp->_ptr;
+#elif defined __minix               /* Minix */
+  if ((fp_->_flags & _IOWRITING) != 0)
+    return NULL;
+  size = fp_->_count;
+  if (size == 0)
+    return NULL;
+  *sizep = size;
+  return (const char *) fp_->_ptr;
+#elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+  if ((fp_->_flag & _IOWRT) != 0)
+    return NULL;
+  size = fp_->_cnt;
+  if (size == 0)
+    return NULL;
+  *sizep = size;
+  return (const char *) fp_->_ptr;
+#elif defined __UCLIBC__            /* uClibc */
+# ifdef __STDIO_BUFFERS
+  if (fp->__modeflags & __FLAG_WRITING)
+    return NULL;
+  if (fp->__modeflags & __FLAG_UNGOT)
+    return NULL;
+  size = fp->__bufread - fp->__bufpos;
+  if (size == 0)
+    return NULL;
+  *sizep = size;
+  return (const char *) fp->__bufpos;
+# else
+  return NULL;
+# endif
+#elif defined __QNX__               /* QNX */
+  if ((fp->_Mode & 0x2000 /* _MWRITE */) != 0)
+    return NULL;
+  /* fp->_Buf <= fp->_Next <= fp->_Rend */
+  size = fp->_Rend - fp->_Next;
+  if (size == 0)
+    return NULL;
+  *sizep = size;
+  return (const char *) fp->_Next;
+#elif defined __MINT__              /* Atari FreeMiNT */
+  if (!fp->__mode.__read)
+    return NULL;
+  size = fp->__get_limit - fp->__bufp;
+  if (size == 0)
+    return NULL;
+  *sizep = size;
+  return fp->__bufp;
+#elif defined EPLAN9                /* Plan9 */
+  if (fp->state == 4 /* WR */)
+    return NULL;
+  if (fp->rp >= fp->wp)
+    return NULL;
+  *sizep = fp->wp - fp->rp;
+  return fp->rp;
+#elif defined SLOW_BUT_NO_HACKS     /* users can define this */
+  /* This implementation is correct on any ANSI C platform.  It is just
+     awfully slow.  */
+  return NULL;
+#else
+ #error "Please port gnulib freadptr.c to your platform! Look at the definition of fflush, fread, getc, getc_unlocked on your system, then report this to bug-gnulib."
+#endif
+}
deleted file mode 120000 (symlink)
index c9e2b1c01ba89400dcfc8ce723528519a5a95a17..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freadptr.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e543f6dc25631a2d448e8fa4f7d351e5e1ff68b8
--- /dev/null
@@ -0,0 +1,53 @@
+/* Retrieve information about a FILE stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses HAVE___FREADPTR.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+#include <stdio.h>
+
+/* Assuming the stream STREAM is open for reading:
+   Return a pointer to the input buffer of STREAM, or NULL.
+   If the returned pointer is non-NULL, *SIZEP is set to the (positive) size
+   of the input buffer.
+   If the returned pointer is NULL, you should use getc (STREAM),
+   fgetc (STREAM), or fread (..., STREAM) to access the input from STREAM.
+
+   The resulting pointer becomes invalid upon any operation on STREAM.
+
+   STREAM must not be wide-character oriented.  */
+
+#if HAVE___FREADPTR /* musl libc */
+
+# include <stdio_ext.h>
+# define freadptr(stream,sizep) __freadptr (stream, sizep)
+
+#else
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+extern const char * freadptr (FILE *stream, size_t *sizep);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index e53386ff162d118fbaaae7b8dc35c1205c5ee700..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freadseek.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..30f606f73add5fb201bf8de098167abfb837c913
--- /dev/null
@@ -0,0 +1,145 @@
+/* Skipping input from a FILE stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "freadseek.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "freadahead.h"
+#include "freadptr.h"
+
+#include "stdio-impl.h"
+
+/* Increment the in-memory pointer.  INCREMENT must be at most the buffer size
+   returned by freadptr().
+   This is very cheap (no system calls).  */
+static void
+freadptrinc (FILE *fp, size_t increment)
+{
+  /* Keep this code in sync with freadptr!  */
+#if HAVE___FREADPTRINC              /* musl libc */
+  __freadptrinc (fp, increment);
+#elif defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+  /* GNU libc, BeOS, Haiku, Linux libc5 */
+  fp->_IO_read_ptr += increment;
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+  fp_->_p += increment;
+  fp_->_r -= increment;
+#elif defined __EMX__               /* emx+gcc */
+  fp->_ptr += increment;
+  fp->_rcount -= increment;
+#elif defined __minix               /* Minix */
+  fp_->_ptr += increment;
+  fp_->_count -= increment;
+#elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+  fp_->_ptr += increment;
+  fp_->_cnt -= increment;
+#elif defined __UCLIBC__            /* uClibc */
+# ifdef __STDIO_BUFFERS
+  fp->__bufpos += increment;
+# else
+  abort ();
+# endif
+#elif defined __QNX__               /* QNX */
+  fp->_Next += increment;
+#elif defined __MINT__              /* Atari FreeMiNT */
+  fp->__bufp += increment;
+#elif defined EPLAN9                /* Plan9 */
+  fp->rp += increment;
+#elif defined SLOW_BUT_NO_HACKS     /* users can define this */
+#else
+ #error "Please port gnulib freadseek.c to your platform! Look at the definition of getc, getc_unlocked on your system, then report this to bug-gnulib."
+#endif
+}
+
+int
+freadseek (FILE *fp, size_t offset)
+{
+  size_t total_buffered;
+  int fd;
+
+  if (offset == 0)
+    return 0;
+
+  /* Seek over the already read and buffered input as quickly as possible,
+     without doing any system calls.  */
+  total_buffered = freadahead (fp);
+  /* This loop is usually executed at most twice: once for ungetc buffer (if
+     present) and once for the main buffer.  */
+  while (total_buffered > 0)
+    {
+      size_t buffered;
+
+      if (freadptr (fp, &buffered) != NULL && buffered > 0)
+        {
+          size_t increment = (buffered < offset ? buffered : offset);
+
+          freadptrinc (fp, increment);
+          offset -= increment;
+          if (offset == 0)
+            return 0;
+          total_buffered -= increment;
+          if (total_buffered == 0)
+            break;
+        }
+      /* Read one byte.  If we were reading from the ungetc buffer, this
+         switches the stream back to the main buffer.  */
+      if (fgetc (fp) == EOF)
+        goto eof;
+      offset--;
+      if (offset == 0)
+        return 0;
+      total_buffered--;
+    }
+
+  /* Test whether the stream is seekable or not.  */
+  fd = fileno (fp);
+  if (fd >= 0 && lseek (fd, 0, SEEK_CUR) >= 0)
+    {
+      /* FP refers to a regular file.  fseek is most efficient in this case.  */
+      return fseeko (fp, offset, SEEK_CUR);
+    }
+  else
+    {
+      /* FP is a non-seekable stream, possibly not even referring to a file
+         descriptor.  Read OFFSET bytes explicitly and discard them.  */
+      char buf[4096];
+
+      do
+        {
+          size_t count = (sizeof (buf) < offset ? sizeof (buf) : offset);
+          if (fread (buf, 1, count, fp) < count)
+            goto eof;
+          offset -= count;
+        }
+      while (offset > 0);
+
+      return 0;
+   }
+
+ eof:
+  /* EOF, or error before or while reading.  */
+  if (ferror (fp))
+    return EOF;
+  else
+    /* Encountered EOF.  */
+    return 0;
+}
deleted file mode 120000 (symlink)
index 72a2a42c260b843bf56d26a8ebf182b13d9a8dfd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freadseek.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ee63017318862fd9ab67087389abe1fcff2f0577
--- /dev/null
@@ -0,0 +1,42 @@
+/* Skipping input from a FILE stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Assuming the stream STREAM is open for reading:
+
+   Read and discard OFFSET bytes from STREAM.
+
+   freadseek (STREAM, OFFSET) is the same as
+   fseek (STREAM, OFFSET, SEEK_CUR), except that the latter does not work
+   on non-seekable input streams (such as pipes).
+
+   Upon success, return 0.
+   Upon premature end of stream, return 0 (like fseek does).
+   Upon error, set the error indicator in the stream and return EOF.
+
+   STREAM must not be wide-character oriented.  */
+
+extern int freadseek (FILE *stream, size_t offset);
+
+#ifdef __cplusplus
+}
+#endif
deleted file mode 120000 (symlink)
index 8c13f861ee2ade5c08884c151868bae209665e75..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/free.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2f0c40ba89df9fe25ac4f3c751ee102b3d9974cc
--- /dev/null
@@ -0,0 +1,53 @@
+/* Make free() preserve errno.
+
+   Copyright (C) 2003, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+/* A function definition is only needed if HAVE_FREE_POSIX is not defined.  */
+#if !HAVE_FREE_POSIX
+
+# include <errno.h>
+
+void
+rpl_free (void *p)
+# undef free
+{
+# if defined __GNUC__ && !defined __clang__
+  /* An invalid GCC optimization
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98396>
+     would optimize away the assignments in the code below, when link-time
+     optimization (LTO) is enabled.  Make the code more complicated, so that
+     GCC does not grok how to optimize it.  */
+  int err[2];
+  err[0] = errno;
+  err[1] = errno;
+  errno = 0;
+  free (p);
+  errno = err[errno == 0];
+# else
+  int err = errno;
+  free (p);
+  errno = err;
+# endif
+}
+
+#endif
deleted file mode 120000 (symlink)
index 74b361c907e7c08dae7180ef9a29df42d461bea6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freopen-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3a7f5681149c71678076b1e6e65316d1b8a08714
--- /dev/null
@@ -0,0 +1,109 @@
+/* Invoke freopen, but avoid some glitches.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#include <config.h>
+
+#include "stdio-safer.h"
+
+#include "attribute.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* GCC 13 misunderstands the dup2 trickery in this file.  */
+#if 13 <= __GNUC__
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
+#endif
+
+/* Guarantee that FD is open; all smaller FDs must already be open.
+   Return true if successful.  */
+static bool
+protect_fd (int fd)
+{
+  int value = open ("/dev/null", O_RDONLY);
+  if (value != fd)
+    {
+      if (0 <= value)
+        {
+          close (value);
+          errno = EBADF; /* Unexpected; this is as good as anything else.  */
+        }
+      return false;
+    }
+  return true;
+}
+
+/* Like freopen, but guarantee that reopening stdin, stdout, or stderr
+   preserves the invariant that STDxxx_FILENO==fileno(stdxxx), and
+   that no other stream will interfere with the standard streams.
+   This is necessary because most freopen implementations will change
+   the associated fd of a stream to the lowest available slot.  */
+
+FILE *
+freopen_safer (char const *name, char const *mode, FILE *f)
+{
+  /* Unfortunately, we cannot use the fopen_safer approach of using
+     fdopen (dup_safer (fileno (freopen (cmd, mode, f)))), because we
+     need to return f itself.  The implementation of freopen(NULL,m,f)
+     is system-dependent, so the best we can do is guarantee that all
+     lower-valued standard fds are open prior to the freopen call,
+     even though this puts more pressure on open fds.  */
+  bool protect_in = false;
+  bool protect_out = false;
+  bool protect_err = false;
+  int saved_errno;
+
+  switch (fileno (f))
+    {
+    default: /* -1 or not a standard stream.  */
+      if (dup2 (STDERR_FILENO, STDERR_FILENO) != STDERR_FILENO)
+        protect_err = true;
+      FALLTHROUGH;
+    case STDERR_FILENO:
+      if (dup2 (STDOUT_FILENO, STDOUT_FILENO) != STDOUT_FILENO)
+        protect_out = true;
+      FALLTHROUGH;
+    case STDOUT_FILENO:
+      if (dup2 (STDIN_FILENO, STDIN_FILENO) != STDIN_FILENO)
+        protect_in = true;
+      FALLTHROUGH;
+    case STDIN_FILENO:
+      /* Nothing left to protect.  */
+      break;
+    }
+  if (protect_in && !protect_fd (STDIN_FILENO))
+    f = NULL;
+  else if (protect_out && !protect_fd (STDOUT_FILENO))
+    f = NULL;
+  else if (protect_err && !protect_fd (STDERR_FILENO))
+    f = NULL;
+  else
+    f = freopen (name, mode, f);
+  saved_errno = errno;
+  if (protect_err)
+    close (STDERR_FILENO);
+  if (protect_out)
+    close (STDOUT_FILENO);
+  if (protect_in)
+    close (STDIN_FILENO);
+  if (!f)
+    errno = saved_errno;
+  return f;
+}
deleted file mode 120000 (symlink)
index 2b44ed9d62535501b442d5fbb787e5566b8ea3e4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/freopen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e003c0ba7f61ed24454fa8e4aeff218cd5e02c10
--- /dev/null
@@ -0,0 +1,96 @@
+/* Open a stream to a file.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+/* If the user's config.h happens to include <stdio.h>, let it include only
+   the system's <stdio.h> here, so that orig_freopen doesn't recurse to
+   rpl_freopen.  */
+#define _GL_ALREADY_INCLUDING_STDIO_H
+#include <config.h>
+
+/* Get the original definition of freopen.  It might be defined as a macro.  */
+#include <stdio.h>
+#undef _GL_ALREADY_INCLUDING_STDIO_H
+
+#include <errno.h>
+
+static FILE *
+orig_freopen (const char *filename, const char *mode, FILE *stream)
+{
+  return freopen (filename, mode, stream);
+}
+
+/* Specification.  */
+#ifdef __osf__
+/* Write "stdio.h" here, not <stdio.h>, otherwise OSF/1 5.1 DTK cc eliminates
+   this include because of the preliminary #include <stdio.h> above.  */
+# include "stdio.h"
+#else
+# include <stdio.h>
+#endif
+
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+FILE *
+rpl_freopen (const char *filename, const char *mode, FILE *stream)
+{
+  FILE *result;
+#if defined _WIN32 && ! defined __CYGWIN__
+  char const *null_device = "NUL";
+  if (filename && strcmp (filename, "/dev/null") == 0)
+    filename = null_device;
+#else
+  char const *null_device = "/dev/null";
+#endif
+
+#ifdef __KLIBC__
+  errno = 0;
+#endif
+
+  result = orig_freopen (filename, mode, stream);
+
+  if (!result)
+    {
+#ifdef __KLIBC__
+      /* On OS/2 kLIBC, freopen returns NULL even if it is successful
+         if filename is NULL. */
+      if (!filename && !errno)
+        result = stream;
+#endif
+    }
+  else if (filename)
+    {
+      int fd = fileno (result);
+      if (dup2 (fd, fd) < 0 && errno == EBADF)
+        {
+          int nullfd = open (null_device, O_RDONLY | O_CLOEXEC);
+          int err = 0;
+          if (nullfd != fd)
+            {
+              if (dup2 (nullfd, fd) < 0)
+                err = 1;
+              close (nullfd);
+            }
+          if (!err)
+            result = orig_freopen (filename, mode, result);
+        }
+    }
+
+  return result;
+}
deleted file mode 120000 (symlink)
index 68a279be495e0612dde3f9dc0db41ad6a4e8d0ae..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/frexp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5ce96e8e561d0b8bdc91c2a8ec216194544e0703
--- /dev/null
@@ -0,0 +1,168 @@
+/* Split a double into fraction and mantissa.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini <bonzini@gnu.org>, 2003, and
+   Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#if ! defined USE_LONG_DOUBLE
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include <math.h>
+
+#include <float.h>
+#ifdef USE_LONG_DOUBLE
+# include "isnanl-nolibm.h"
+# include "fpucw.h"
+#else
+# include "isnand-nolibm.h"
+#endif
+
+/* This file assumes FLT_RADIX = 2.  If FLT_RADIX is a power of 2 greater
+   than 2, or not even a power of 2, some rounding errors can occur, so that
+   then the returned mantissa is only guaranteed to be <= 1.0, not < 1.0.  */
+
+#ifdef USE_LONG_DOUBLE
+# define FUNC frexpl
+# define DOUBLE long double
+# define ISNAN isnanl
+# define DECL_ROUNDING DECL_LONG_DOUBLE_ROUNDING
+# define BEGIN_ROUNDING() BEGIN_LONG_DOUBLE_ROUNDING ()
+# define END_ROUNDING() END_LONG_DOUBLE_ROUNDING ()
+# define L_(literal) literal##L
+#else
+# define FUNC frexp
+# define DOUBLE double
+# define ISNAN isnand
+# define DECL_ROUNDING
+# define BEGIN_ROUNDING()
+# define END_ROUNDING()
+# define L_(literal) literal
+#endif
+
+DOUBLE
+FUNC (DOUBLE x, int *expptr)
+{
+  int sign;
+  int exponent;
+  DECL_ROUNDING
+
+  /* Test for NaN, infinity, and zero.  */
+  if (ISNAN (x) || x + x == x)
+    {
+      *expptr = 0;
+      return x;
+    }
+
+  sign = 0;
+  if (x < 0)
+    {
+      x = - x;
+      sign = -1;
+    }
+
+  BEGIN_ROUNDING ();
+
+  {
+    /* Since the exponent is an 'int', it fits in 64 bits.  Therefore the
+       loops are executed no more than 64 times.  */
+    DOUBLE pow2[64]; /* pow2[i] = 2^2^i */
+    DOUBLE powh[64]; /* powh[i] = 2^-2^i */
+    int i;
+
+    exponent = 0;
+    if (x >= L_(1.0))
+      {
+        /* A positive exponent.  */
+        DOUBLE pow2_i; /* = pow2[i] */
+        DOUBLE powh_i; /* = powh[i] */
+
+        /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i,
+           x * 2^exponent = argument, x >= 1.0.  */
+        for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5);
+             ;
+             i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i)
+          {
+            if (x >= pow2_i)
+              {
+                exponent += (1 << i);
+                x *= powh_i;
+              }
+            else
+              break;
+
+            pow2[i] = pow2_i;
+            powh[i] = powh_i;
+          }
+        /* Avoid making x too small, as it could become a denormalized
+           number and thus lose precision.  */
+        while (i > 0 && x < pow2[i - 1])
+          {
+            i--;
+            powh_i = powh[i];
+          }
+        exponent += (1 << i);
+        x *= powh_i;
+        /* Here 2^-2^i <= x < 1.0.  */
+      }
+    else
+      {
+        /* A negative or zero exponent.  */
+        DOUBLE pow2_i; /* = pow2[i] */
+        DOUBLE powh_i; /* = powh[i] */
+
+        /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i,
+           x * 2^exponent = argument, x < 1.0.  */
+        for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5);
+             ;
+             i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i)
+          {
+            if (x < powh_i)
+              {
+                exponent -= (1 << i);
+                x *= pow2_i;
+              }
+            else
+              break;
+
+            pow2[i] = pow2_i;
+            powh[i] = powh_i;
+          }
+        /* Here 2^-2^i <= x < 1.0.  */
+      }
+
+    /* Invariants: x * 2^exponent = argument, and 2^-2^i <= x < 1.0.  */
+    while (i > 0)
+      {
+        i--;
+        if (x < powh[i])
+          {
+            exponent -= (1 << i);
+            x *= pow2[i];
+          }
+      }
+    /* Here 0.5 <= x < 1.0.  */
+  }
+
+  if (sign < 0)
+    x = - x;
+
+  END_ROUNDING ();
+
+  *expptr = exponent;
+  return x;
+}
deleted file mode 120000 (symlink)
index 1ac4787e1cfffd6d3cff0e7fc5dfd68ee2f19736..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/frexpl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..700b7b87e2f5851c22c4280d3fd4ab3102d91688
--- /dev/null
@@ -0,0 +1,35 @@
+/* Split a 'long double' into fraction and mantissa.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+
+/* Specification.  */
+# include <math.h>
+
+long double
+frexpl (long double x, int *expptr)
+{
+  return frexp (x, expptr);
+}
+
+#else
+
+# define USE_LONG_DOUBLE
+# include "frexp.c"
+
+#endif
deleted file mode 120000 (symlink)
index 28081eedde7f8e360e86b77c0723cd6c5e00facf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fseek.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cebc17491316d529c4c1bf0848abf7a2da0b960e
--- /dev/null
@@ -0,0 +1,30 @@
+/* An fseek() function that, together with fflush(), is POSIX compliant.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+/* Get off_t.  */
+#include <unistd.h>
+
+int
+fseek (FILE *fp, long offset, int whence)
+{
+  /* Use the replacement fseeko function with all its workarounds.  */
+  return fseeko (fp, (off_t)offset, whence);
+}
deleted file mode 120000 (symlink)
index 52e976b109f2598ee1d27ad740976375990317ab..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fseeko.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2c3b053a3bda78a4a2c8c56bb4cb3b0cf04aaf3b
--- /dev/null
@@ -0,0 +1,164 @@
+/* An fseeko() function that, together with fflush(), is POSIX compliant.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+/* Get off_t, lseek, _POSIX_VERSION.  */
+#include <unistd.h>
+
+#include "stdio-impl.h"
+
+int
+fseeko (FILE *fp, off_t offset, int whence)
+#undef fseeko
+#if !HAVE_FSEEKO
+# undef fseek
+# define fseeko fseek
+#endif
+#if _GL_WINDOWS_64_BIT_OFF_T
+# undef fseeko
+# if HAVE__FSEEKI64 && HAVE_DECL__FSEEKI64 /* msvc, mingw since msvcrt8.0, mingw64 */
+#  define fseeko _fseeki64
+# else /* mingw before msvcrt8.0 */
+#  define fseeko fseeko64
+# endif
+#endif
+{
+#if LSEEK_PIPE_BROKEN
+  /* mingw gives bogus answers rather than failure on non-seekable files.  */
+  if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
+    return EOF;
+#endif
+
+  /* These tests are based on fpurge.c.  */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+  /* GNU libc, BeOS, Haiku, Linux libc5 */
+  if (fp->_IO_read_end == fp->_IO_read_ptr
+      && fp->_IO_write_ptr == fp->_IO_write_base
+      && fp->_IO_save_base == NULL)
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+# if defined __SL64 && defined __SCLE /* Cygwin */
+  if ((fp->_flags & __SL64) == 0)
+    {
+      /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
+         mode; but has an fseeko that requires 64-bit mode.  */
+      FILE *tmp = fopen ("/dev/null", "r");
+      if (!tmp)
+        return -1;
+      fp->_flags |= __SL64;
+      fp->_seek64 = tmp->_seek64;
+      fclose (tmp);
+    }
+# endif
+  if (fp_->_p == fp_->_bf._base
+      && fp_->_r == 0
+      && fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
+                     ? fp_->_bf._size
+                     : 0)
+      && fp_ub._base == NULL)
+#elif defined __EMX__               /* emx+gcc */
+  if (fp->_ptr == fp->_buffer
+      && fp->_rcount == 0
+      && fp->_wcount == 0
+      && fp->_ungetc_count == 0)
+#elif defined __minix               /* Minix */
+  if (fp_->_ptr == fp_->_buf
+      && (fp_->_ptr == NULL || fp_->_count == 0))
+#elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+  if (fp_->_ptr == fp_->_base
+      && (fp_->_ptr == NULL || fp_->_cnt == 0))
+#elif defined __UCLIBC__            /* uClibc */
+  if (((fp->__modeflags & __FLAG_WRITING) == 0
+       || fp->__bufpos == fp->__bufstart)
+      && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
+          || fp->__bufpos == fp->__bufread))
+#elif defined __QNX__               /* QNX */
+  if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
+      && fp->_Rback == fp->_Back + sizeof (fp->_Back)
+      && fp->_Rsave == NULL)
+#elif defined __MINT__              /* Atari FreeMiNT */
+  if (fp->__bufp == fp->__buffer
+      && fp->__get_limit == fp->__bufp
+      && fp->__put_limit == fp->__bufp
+      && !fp->__pushed_back)
+#elif defined EPLAN9                /* Plan9 */
+  if (fp->rp == fp->buf
+      && fp->wp == fp->buf)
+#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION
+  /* Cross-compiling to some other system advertising conformance to
+     POSIX.1-2008 or later.  Assume fseeko and fflush work as advertised.
+     If this assumption is incorrect, please report the bug to
+     bug-gnulib.  */
+  if (0)
+#else
+  #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
+#endif
+    {
+      /* We get here when an fflush() call immediately preceded this one (or
+         if ftell() has created buffers but no I/O has occurred on a
+         newly-opened stream).  We know there are no buffers.  */
+      off_t pos = lseek (fileno (fp), offset, whence);
+      if (pos == -1)
+        {
+#if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+          /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+          fp_->_flags &= ~__SOFF;
+#endif
+          return -1;
+        }
+
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+      /* GNU libc, BeOS, Haiku, Linux libc5 */
+      fp->_flags &= ~_IO_EOF_SEEN;
+      fp->_offset = pos;
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+      /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || defined __minix
+      /* fp_->_offset is typed as an integer.  */
+      fp_->_offset = pos;
+# else
+      /* fp_->_offset is an fpos_t.  */
+      {
+        /* Use a union, since on NetBSD, the compilation flags
+           determine whether fpos_t is typedef'd to off_t or a struct
+           containing a single off_t member.  */
+        union
+          {
+            fpos_t f;
+            off_t o;
+          } u;
+        u.o = pos;
+        fp_->_offset = u.f;
+      }
+# endif
+      fp_->_flags |= __SOFF;
+      fp_->_flags &= ~__SEOF;
+#elif defined __EMX__               /* emx+gcc */
+      fp->_flags &= ~_IOEOF;
+#elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+      fp_->_flag &= ~_IOEOF;
+#elif defined __MINT__              /* Atari FreeMiNT */
+      fp->__offset = pos;
+      fp->__eof = 0;
+#endif
+      return 0;
+    }
+  return fseeko (fp, offset, whence);
+}
deleted file mode 120000 (symlink)
index 8aba80e4461edfc62791f27a7fe65b8b03aac0da..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fseterr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2504205e3b7db2025230f37978a4f2b5489a4df5
--- /dev/null
@@ -0,0 +1,84 @@
+/* Set the error indicator of a stream.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "fseterr.h"
+
+#include <errno.h>
+
+#include "stdio-impl.h"
+
+/* This file is not used on systems that have the __fseterr function,
+   namely musl libc.  */
+
+void
+fseterr (FILE *fp)
+{
+  /* Most systems provide FILE as a struct and the necessary bitmask in
+     <stdio.h>, because they need it for implementing getc() and putc() as
+     fast macros.  */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
+  /* GNU libc, BeOS, Haiku, Linux libc5 */
+  fp->_flags |= _IO_ERR_SEEN;
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+  fp_->_flags |= __SERR;
+#elif defined __EMX__               /* emx+gcc */
+  fp->_flags |= _IOERR;
+#elif defined __minix               /* Minix */
+  fp->_flags |= _IOERR;
+#elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
+  fp_->_flag |= _IOERR;
+#elif defined __UCLIBC__            /* uClibc */
+  fp->__modeflags |= __FLAG_ERROR;
+#elif defined __QNX__               /* QNX */
+  fp->_Mode |= 0x200 /* _MERR */;
+#elif defined __MINT__              /* Atari FreeMiNT */
+  fp->__error = 1;
+#elif defined EPLAN9                /* Plan9 */
+  if (fp->state != 0 /* CLOSED */)
+    fp->state = 5 /* ERR */;
+#elif 0                             /* unknown  */
+  /* Portable fallback, based on an idea by Rich Felker.
+     Wow! 6 system calls for something that is just a bit operation!
+     Not activated on any system, because there is no way to repair FP when
+     the sequence of system calls fails, and library code should not call
+     abort().  */
+  int saved_errno;
+  int fd;
+  int fd2;
+
+  saved_errno = errno;
+  fflush (fp);
+  fd = fileno (fp);
+  fd2 = dup (fd);
+  if (fd2 >= 0)
+    {
+      close (fd);
+      fputc ('\0', fp); /* This should set the error indicator.  */
+      fflush (fp);      /* Or this.  */
+      if (dup2 (fd2, fd) < 0)
+        /* Whee... we botched the stream and now cannot restore it!  */
+        abort ();
+      close (fd2);
+    }
+  errno = saved_errno;
+#else
+ #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
+#endif
+}
deleted file mode 120000 (symlink)
index 086c3f3e3cf6fea14f7b6c15ad43e9f895cbe644..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fseterr.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..42e49fcb659ee52dfbcbec1e4ea1423ad83c1d79
--- /dev/null
@@ -0,0 +1,50 @@
+/* Set the error indicator of a stream.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _FSETERR_H
+#define _FSETERR_H
+
+/* This file uses HAVE___FSETERR.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdio.h>
+
+/* Set the error indicator of the stream FP.
+   The "error indicator" is set when an I/O operation on the stream fails, and
+   is cleared (together with the "end-of-file" indicator) by clearerr (FP).  */
+
+#if HAVE___FSETERR /* musl libc */
+
+# include <stdio_ext.h>
+# define fseterr(fp) __fseterr (fp)
+
+#else
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+extern void fseterr (FILE *fp);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+#endif /* _FSETERR_H */
deleted file mode 120000 (symlink)
index 134a9076efd07c6bff199cda1805f7608446b1c2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fstat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..205d5aab8064a36d3bf25a51ff7ccac4605cca7e
--- /dev/null
@@ -0,0 +1,94 @@
+/* fstat() replacement.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+   the system's <sys/stat.h> here, so that orig_fstat doesn't recurse to
+   rpl_fstat.  */
+#define __need_system_sys_stat_h
+#include <config.h>
+
+/* Get the original definition of fstat.  It might be defined as a macro.  */
+#include <sys/types.h>
+#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WINDOWS_NATIVE
+#endif
+
+#if !defined WINDOWS_NATIVE
+
+static int
+orig_fstat (int fd, struct stat *buf)
+{
+  return fstat (fd, buf);
+}
+
+#endif
+
+/* Specification.  */
+#ifdef __osf__
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+   eliminates this include because of the preliminary #include <sys/stat.h>
+   above.  */
+# include "sys/stat.h"
+#else
+# include <sys/stat.h>
+#endif
+
+#include "stat-time.h"
+
+#include <errno.h>
+#include <unistd.h>
+#ifdef WINDOWS_NATIVE
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+# include "stat-w32.h"
+#endif
+
+int
+rpl_fstat (int fd, struct stat *buf)
+{
+#if REPLACE_FCHDIR && REPLACE_OPEN_DIRECTORY
+  /* Handle the case when rpl_open() used a dummy file descriptor to work
+     around an open() that can't normally visit directories.  */
+  const char *name = _gl_directory_name (fd);
+  if (name != NULL)
+    return stat (name, buf);
+#endif
+
+#ifdef WINDOWS_NATIVE
+  /* Fill the fields ourselves, because the original fstat function returns
+     values for st_atime, st_mtime, st_ctime that depend on the current time
+     zone.  See
+     <https://lists.gnu.org/r/bug-gnulib/2017-04/msg00134.html>  */
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+
+  if (h == INVALID_HANDLE_VALUE)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  return _gl_fstat_by_handle (h, NULL, buf);
+#else
+  return stat_time_normalize (orig_fstat (fd, buf), buf);
+#endif
+}
deleted file mode 120000 (symlink)
index 9e981e739a25d5315c24eb06d0d04a135bdee9ff..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fstatat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..470ef336cfff5f36583008593c2a4f5bed2fbe69
--- /dev/null
@@ -0,0 +1,148 @@
+/* Work around an fstatat bug on Solaris 9.
+
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Jim Meyering.  */
+
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+   the system's <sys/stat.h> here, so that orig_fstatat doesn't recurse to
+   rpl_fstatat.  */
+#define __need_system_sys_stat_h
+#include <config.h>
+
+/* Get the original definition of fstatat.  It might be defined as a macro.  */
+#include <sys/types.h>
+#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG
+static int
+orig_fstatat (int fd, char const *filename, struct stat *buf, int flags)
+{
+  return fstatat (fd, filename, buf, flags);
+}
+#endif
+
+#ifdef __osf__
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+   eliminates this include because of the preliminary #include <sys/stat.h>
+   above.  */
+# include "sys/stat.h"
+#else
+# include <sys/stat.h>
+#endif
+
+#include "stat-time.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG
+
+# ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK
+#  define LSTAT_FOLLOWS_SLASHED_SYMLINK 0
+# endif
+
+static int
+normal_fstatat (int fd, char const *file, struct stat *st, int flag)
+{
+  return stat_time_normalize (orig_fstatat (fd, file, st, flag), st);
+}
+
+/* fstatat should always follow symbolic links that end in /, but on
+   Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified.
+   Likewise, trailing slash on a non-directory should be an error.
+   These are the same problems that lstat.c and stat.c address, so
+   solve it in a similar way.
+
+   AIX 7.1 fstatat (AT_FDCWD, ..., 0) always fails, which is a bug.
+   Work around this bug if FSTATAT_AT_FDCWD_0_BROKEN is nonzero.  */
+
+int
+rpl_fstatat (int fd, char const *file, struct stat *st, int flag)
+{
+  int result = normal_fstatat (fd, file, st, flag);
+  size_t len;
+
+  if (LSTAT_FOLLOWS_SLASHED_SYMLINK || result != 0)
+    return result;
+  len = strlen (file);
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    {
+      /* Fix lstat behavior.  */
+      if (file[len - 1] != '/' || S_ISDIR (st->st_mode))
+        return 0;
+      if (!S_ISLNK (st->st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+      result = normal_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW);
+    }
+  /* Fix stat behavior.  */
+  if (result == 0 && !S_ISDIR (st->st_mode) && file[len - 1] == '/')
+    {
+      errno = ENOTDIR;
+      return -1;
+    }
+  return result;
+}
+
+#else /* ! (HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG) */
+
+/* On mingw, the gnulib <sys/stat.h> defines 'stat' as a function-like
+   macro; but using it in AT_FUNC_F2 causes compilation failure
+   because the preprocessor sees a use of a macro that requires two
+   arguments but is only given one.  Hence, we need an inline
+   forwarder to get past the preprocessor.  */
+static int
+stat_func (char const *name, struct stat *st)
+{
+  return stat (name, st);
+}
+
+/* Likewise, if there is no native 'lstat', then the gnulib
+   <sys/stat.h> defined it as stat, which also needs adjustment.  */
+# if !HAVE_LSTAT
+#  undef lstat
+#  define lstat stat_func
+# endif
+
+/* Replacement for Solaris' function by the same name.
+   <https://www.google.com/search?q=fstatat+site:docs.oracle.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_func
+# define AT_FUNC_USE_F1_COND 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
+
+#endif /* !HAVE_FSTATAT */
deleted file mode 120000 (symlink)
index 4049aafec707a29b18604d96330fd88fa31cef63..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fsusage.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..97d0eef7aa8951f04e93c20cea259907a1bc73ef
--- /dev/null
@@ -0,0 +1,233 @@
+/* fsusage.c -- return space usage of mounted file systems
+
+   Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "fsusage.h"
+
+#include <limits.h>
+#include <sys/types.h>
+
+#if STAT_STATVFS || STAT_STATVFS64 /* POSIX 1003.1-2001 (and later) with XSI */
+# include <sys/statvfs.h>
+#else
+/* Don't include backward-compatibility files unless they're needed.
+   Eventually we'd like to remove all this cruft.  */
+# include <fcntl.h>
+# include <unistd.h>
+# include <sys/stat.h>
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#if HAVE_SYS_MOUNT_H
+# include <sys/mount.h>
+#endif
+#if HAVE_SYS_VFS_H
+# include <sys/vfs.h>
+#endif
+# if HAVE_SYS_FS_S5PARAM_H      /* Fujitsu UXP/V */
+#  include <sys/fs/s5param.h>
+# endif
+# if HAVE_SYS_STATFS_H
+#  include <sys/statfs.h>
+# endif
+#endif
+
+/* Many space usage primitives use all 1 bits to denote a value that is
+   not applicable or unknown.  Propagate this information by returning
+   a uintmax_t value that is all 1 bits if X is all 1 bits, even if X
+   is unsigned and narrower than uintmax_t.  */
+#define PROPAGATE_ALL_ONES(x) \
+  ((sizeof (x) < sizeof (uintmax_t) \
+    && (~ (x) == (sizeof (x) < sizeof (int) \
+                  ? - (1 << (sizeof (x) * CHAR_BIT)) \
+                  : 0))) \
+   ? UINTMAX_MAX : (uintmax_t) (x))
+
+/* Extract the top bit of X as an uintmax_t value.  */
+#define EXTRACT_TOP_BIT(x) ((x) \
+                            & ((uintmax_t) 1 << (sizeof (x) * CHAR_BIT - 1)))
+
+/* If a value is negative, many space usage primitives store it into an
+   integer variable by assignment, even if the variable's type is unsigned.
+   So, if a space usage variable X's top bit is set, convert X to the
+   uintmax_t value V such that (- (uintmax_t) V) is the negative of
+   the original value.  If X's top bit is clear, just yield X.
+   Use PROPAGATE_TOP_BIT if the original value might be negative;
+   otherwise, use PROPAGATE_ALL_ONES.  */
+#define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1))
+
+#ifdef STAT_STATVFS
+/* Return true if statvfs works.  This is false for statvfs on systems
+   with GNU libc on Linux kernels before 2.6.36, which stats all
+   preceding entries in /proc/mounts; that makes df hang if even one
+   of the corresponding file systems is hard-mounted but not available.  */
+# if ! (__linux__ && (__GLIBC__ || __UCLIBC__))
+/* The FRSIZE fallback is not required in this case.  */
+#  undef STAT_STATFS2_FRSIZE
+static int statvfs_works (void) { return 1; }
+# else
+#  include <string.h> /* for strverscmp */
+#  include <sys/utsname.h>
+#  include <sys/statfs.h>
+#  define STAT_STATFS2_BSIZE 1
+
+static int
+statvfs_works (void)
+{
+  static int statvfs_works_cache = -1;
+  struct utsname name;
+  if (statvfs_works_cache < 0)
+    statvfs_works_cache = (uname (&name) == 0
+                           && 0 <= strverscmp (name.release, "2.6.36"));
+  return statvfs_works_cache;
+}
+# endif
+#endif
+
+
+/* Fill in the fields of FSP with information about space usage for
+   the file system on which FILE resides.
+   DISK is the device on which FILE is mounted, for space-getting
+   methods that need to know it.
+   Return 0 if successful, -1 if not.  When returning -1, ensure that
+   ERRNO is either a system error value, or zero if DISK is NULL
+   on a system that requires a non-NULL value.  */
+int
+get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
+{
+#ifdef STAT_STATVFS     /* POSIX, except pre-2.6.36 glibc/Linux */
+
+  if (statvfs_works ())
+    {
+      struct statvfs vfsd;
+
+      if (statvfs (file, &vfsd) < 0)
+        return -1;
+
+      /* f_frsize isn't guaranteed to be supported.  */
+      fsp->fsu_blocksize = (vfsd.f_frsize
+                            ? PROPAGATE_ALL_ONES (vfsd.f_frsize)
+                            : PROPAGATE_ALL_ONES (vfsd.f_bsize));
+
+      fsp->fsu_blocks = PROPAGATE_ALL_ONES (vfsd.f_blocks);
+      fsp->fsu_bfree = PROPAGATE_ALL_ONES (vfsd.f_bfree);
+      fsp->fsu_bavail = PROPAGATE_TOP_BIT (vfsd.f_bavail);
+      fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (vfsd.f_bavail) != 0;
+      fsp->fsu_files = PROPAGATE_ALL_ONES (vfsd.f_files);
+      fsp->fsu_ffree = PROPAGATE_ALL_ONES (vfsd.f_ffree);
+      return 0;
+    }
+
+#endif
+
+#if defined STAT_STATVFS64            /* AIX */
+
+  struct statvfs64 fsd;
+
+  if (statvfs64 (file, &fsd) < 0)
+    return -1;
+
+  /* f_frsize isn't guaranteed to be supported.  */
+  fsp->fsu_blocksize = (fsd.f_frsize
+                        ? PROPAGATE_ALL_ONES (fsd.f_frsize)
+                        : PROPAGATE_ALL_ONES (fsd.f_bsize));
+
+#elif defined STAT_STATFS3_OSF1         /* OSF/1 */
+
+  struct statfs fsd;
+
+  if (statfs (file, &fsd, sizeof (struct statfs)) != 0)
+    return -1;
+
+  fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
+
+#elif defined STAT_STATFS2_FRSIZE        /* 2.6 < glibc/Linux < 2.6.36 */
+
+  struct statfs fsd;
+
+  if (statfs (file, &fsd) < 0)
+    return -1;
+
+  fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_frsize);
+
+#elif defined STAT_STATFS2_BSIZE        /* glibc/Linux < 2.6, 4.3BSD, SunOS 4, \
+                                           Mac OS X < 10.4, FreeBSD < 5.0, \
+                                           NetBSD < 3.0, OpenBSD < 4.4 */
+
+  struct statfs fsd;
+
+  if (statfs (file, &fsd) < 0)
+    return -1;
+
+  fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
+
+# ifdef STATFS_TRUNCATES_BLOCK_COUNTS
+
+  /* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
+     struct statfs are truncated to 2GB.  These conditions detect that
+     truncation, presumably without botching the 4.1.1 case, in which
+     the values are not truncated.  The correct counts are stored in
+     undocumented spare fields.  */
+  if (fsd.f_blocks == 0x7fffffff / fsd.f_bsize && fsd.f_spare[0] > 0)
+    {
+      fsd.f_blocks = fsd.f_spare[0];
+      fsd.f_bfree = fsd.f_spare[1];
+      fsd.f_bavail = fsd.f_spare[2];
+    }
+# endif /* STATFS_TRUNCATES_BLOCK_COUNTS */
+
+#elif defined STAT_STATFS2_FSIZE        /* 4.4BSD and older NetBSD */
+
+  struct statfs fsd;
+
+  if (statfs (file, &fsd) < 0)
+    return -1;
+
+  fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
+
+#elif defined STAT_STATFS4              /* SVR3, old Irix */
+
+  struct statfs fsd;
+
+  if (statfs (file, &fsd, sizeof fsd, 0) < 0)
+    return -1;
+
+  /* Empirically, the block counts on most SVR3 and SVR3-derived
+     systems seem to always be in terms of 512-byte blocks,
+     no matter what value f_bsize has.  */
+   fsp->fsu_blocksize = 512;
+
+#endif
+
+#if (defined STAT_STATVFS64 || defined STAT_STATFS3_OSF1                \
+     || defined STAT_STATFS2_FRSIZE || defined STAT_STATFS2_BSIZE       \
+     || defined STAT_STATFS2_FSIZE || defined STAT_STATFS4)
+
+  fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks);
+  fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.f_bfree);
+  fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.f_bavail);
+  fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.f_bavail) != 0;
+  fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.f_files);
+  fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree);
+
+#endif
+
+  (void) disk;  /* avoid argument-unused warning */
+  return 0;
+}
deleted file mode 120000 (symlink)
index 4eb6310aa78f057027c7d159d41cd55b7e0011a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fsusage.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d7ae5f63a36c1bec169744869f38a97745a1e817
--- /dev/null
@@ -0,0 +1,39 @@
+/* fsusage.h -- declarations for file system space usage info
+
+   Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Space usage statistics for a file system.  Blocks are 512-byte. */
+
+#if !defined FSUSAGE_H_
+# define FSUSAGE_H_
+
+# include <stdint.h>
+
+struct fs_usage
+{
+  uintmax_t fsu_blocksize;      /* Size of a block.  */
+  uintmax_t fsu_blocks;         /* Total blocks. */
+  uintmax_t fsu_bfree;          /* Free blocks available to superuser. */
+  uintmax_t fsu_bavail;         /* Free blocks available to non-superuser. */
+  bool fsu_bavail_top_bit_set;  /* 1 if fsu_bavail represents a value < 0.  */
+  uintmax_t fsu_files;          /* Total file nodes. */
+  uintmax_t fsu_ffree;          /* Free file nodes. */
+};
+
+int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp);
+
+#endif
deleted file mode 120000 (symlink)
index 6080175681c69981b20a12c1ada526103ec1371c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fsync.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..10a70023a15dadda143c7dc9970db96f98773139
--- /dev/null
@@ -0,0 +1,87 @@
+/* Emulate fsync on platforms that lack it, primarily Windows and
+   cross-compilers like MinGW.
+
+   This is derived from sqlite3 sources.
+   https://www.sqlite.org/src/finfo?name=src/os_win.c
+   https://www.sqlite.org/copyright.html
+
+   Written by Richard W.M. Jones <rjones.at.redhat.com>
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+/* FlushFileBuffers */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+# include <errno.h>
+
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+
+int
+fsync (int fd)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  DWORD err;
+
+  if (h == INVALID_HANDLE_VALUE)
+    {
+      errno = EBADF;
+      return -1;
+    }
+
+  if (!FlushFileBuffers (h))
+    {
+      /* Translate some Windows errors into rough approximations of Unix
+       * errors.  MSDN is useless as usual - in this case it doesn't
+       * document the full range of errors.
+       */
+      err = GetLastError ();
+      switch (err)
+        {
+        case ERROR_ACCESS_DENIED:
+          /* For a read-only handle, fsync should succeed, even though we have
+             no way to sync the access-time changes.  */
+          return 0;
+
+          /* eg. Trying to fsync a tty. */
+        case ERROR_INVALID_HANDLE:
+          errno = EINVAL;
+          break;
+
+        default:
+          errno = EIO;
+        }
+      return -1;
+    }
+
+  return 0;
+}
+
+#else /* !Windows */
+
+# error "This platform lacks fsync function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
+
+#endif /* !Windows */
deleted file mode 120000 (symlink)
index f2d357eb9e467c5893e2d369f1b494108be22df1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ftell.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..21cab43998e0ca054d37105b5dd43659b47da009
--- /dev/null
@@ -0,0 +1,37 @@
+/* An ftell() function that works around platform bugs.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include <limits.h>
+
+long
+ftell (FILE *fp)
+{
+  /* Use the replacement ftello function with all its workarounds.  */
+  off_t offset = ftello (fp);
+  if (LONG_MIN <= offset && offset <= LONG_MAX)
+    return /* (long) */ offset;
+  else
+    {
+      errno = EOVERFLOW;
+      return -1;
+    }
+}
deleted file mode 120000 (symlink)
index 2a710e6851821a26b2901d3e40646340930ee69b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ftello.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..64119aabf1cc6d1a81c40f6afa898d14372ab995
--- /dev/null
@@ -0,0 +1,157 @@
+/* An ftello() function that works around platform bugs.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include "intprops.h"
+
+/* Get lseek.  */
+#include <unistd.h>
+
+#include "stdio-impl.h"
+
+off_t
+ftello (FILE *fp)
+#undef ftello
+#if !HAVE_FTELLO
+# undef ftell
+# define ftello ftell
+#endif
+#if _GL_WINDOWS_64_BIT_OFF_T
+# undef ftello
+# if HAVE__FTELLI64 /* msvc, mingw64 */
+#  define ftello _ftelli64
+# else /* mingw */
+#  define ftello ftello64
+# endif
+#endif
+{
+#if FTELLO_BROKEN_AFTER_UNGETC /* macOS >= 10.15 */
+  /* The system's ftello() is completely broken, because it calls __sflush,
+     which makes side effects on the stream.  */
+
+  /* Handle non-seekable files first.  */
+  if (fp->_file < 0 || fp->_seek == NULL)
+    {
+      errno = ESPIPE;
+      return -1;
+    }
+
+  /* Determine the current offset, ignoring buffered and pushed-back bytes.  */
+  off_t pos;
+
+  if (fp->_flags & __SOFF)
+    pos = fp->_offset;
+  else
+    {
+      pos = fp->_seek (fp->_cookie, 0, SEEK_CUR);
+      if (pos < 0)
+        return -1;
+      if (fp->_flags & __SOPT)
+        {
+          fp->_offset = pos;
+          fp->_flags |= __SOFF;
+        }
+    }
+
+  if (fp->_flags & __SRD)
+    {
+      /* Now consider buffered and pushed-back bytes from ungetc.  */
+      if (fp->_ub._base != NULL)
+        /* Considering the buffered bytes, we are at position
+             pos - fp->_ur.
+           Considering also the pushed-back bytes, we are at position
+             pos - fp->_ur - fp->_r.  */
+        pos = pos - fp->_ur - fp->_r;
+      else
+        /* Considering the buffered bytes, we are at position
+             pos - fp->_r.  */
+        pos = pos - fp->_r;
+      if (pos < 0)
+        {
+          errno = EIO;
+          return -1;
+        }
+    }
+  else if ((fp->_flags & __SWR) && fp->_p != NULL)
+    {
+      /* Consider the buffered bytes.  */
+      off_t buffered = fp->_p - fp->_bf._base;
+
+      /* Compute pos + buffered, with overflow check.  */
+      off_t sum;
+      if (! INT_ADD_OK (pos, buffered, &sum))
+        {
+          errno = EOVERFLOW;
+          return -1;
+        }
+      pos = sum;
+    }
+
+  return pos;
+
+#else
+
+# if LSEEK_PIPE_BROKEN
+  /* mingw gives bogus answers rather than failure on non-seekable files.  */
+  if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
+    return -1;
+# endif
+
+# if FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE /* Solaris */
+  /* The Solaris stdio leaves the _IOREAD flag set after reading from a file
+     reaches EOF and the program then starts writing to the file.  ftello
+     gets confused by this.  */
+  if (fp_->_flag & _IOWRT)
+    {
+      off_t pos;
+
+      /* Call ftello nevertheless, for the side effects that it does on fp.  */
+      ftello (fp);
+
+      /* Compute the file position ourselves.  */
+      pos = lseek (fileno (fp), (off_t) 0, SEEK_CUR);
+      if (pos >= 0)
+        {
+          if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL)
+            pos += fp_->_ptr - fp_->_base;
+        }
+      return pos;
+    }
+# endif
+
+# if defined __SL64 && defined __SCLE /* Cygwin */
+  if ((fp->_flags & __SL64) == 0)
+    {
+      /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
+         mode; but has an ftello that requires 64-bit mode.  */
+      FILE *tmp = fopen ("/dev/null", "r");
+      if (!tmp)
+        return -1;
+      fp->_flags |= __SL64;
+      fp->_seek64 = tmp->_seek64;
+      fclose (tmp);
+    }
+# endif
+
+  return ftello (fp);
+
+#endif
+}
deleted file mode 120000 (symlink)
index 99f9b7fa6f9c02108cb979b984c8aa99ca131fd7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ftoastr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4ecde06cea9035a7d5669b52a98405408214ea78
--- /dev/null
@@ -0,0 +1,151 @@
+/* floating point to accurate string
+
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* This code can misbehave on some buggy or older platforms, when
+   operating on arguments on floating types other than 'double', or
+   when given unusual combinations of options.  Gnulib's
+   snprintf-posix module works around many of these problems.
+
+   This code relies on sprintf, strtod, etc. operating accurately;
+   otherwise, the resulting strings could be inaccurate or too long.  */
+
+#include <config.h>
+
+#include "ftoastr.h"
+
+#include <float.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef C_LOCALE
+# include "c-snprintf.h"
+# include "c-strtod.h"
+# define PREFIX(name) c_ ## name
+#else
+# define PREFIX(name) name
+#endif
+
+#if LENGTH == 3
+# define FLOAT long double
+# define FLOAT_DIG LDBL_DIG
+# define FLOAT_MIN LDBL_MIN
+# define FLOAT_PREC_BOUND _GL_LDBL_PREC_BOUND
+# define FTOASTR PREFIX (ldtoastr)
+# define PROMOTED_FLOAT long double
+# define STRTOF PREFIX (strtold)
+#elif LENGTH == 2
+# define FLOAT double
+# define FLOAT_DIG DBL_DIG
+# define FLOAT_MIN DBL_MIN
+# define FLOAT_PREC_BOUND _GL_DBL_PREC_BOUND
+# define FTOASTR PREFIX (dtoastr)
+# define PROMOTED_FLOAT double
+#else
+# define LENGTH 1
+# define FLOAT float
+# define FLOAT_DIG FLT_DIG
+# define FLOAT_MIN FLT_MIN
+# define FLOAT_PREC_BOUND _GL_FLT_PREC_BOUND
+# define FTOASTR PREFIX (ftoastr)
+# define PROMOTED_FLOAT double
+# if HAVE_STRTOF
+#  define STRTOF strtof
+# endif
+#endif
+
+/* On pre-C99 hosts, approximate strtof with strtod.  This
+   may generate one or two extra digits, but that's better than not
+   working at all.  */
+#ifndef STRTOF
+# define STRTOF PREFIX (strtod)
+#endif
+
+/* On hosts where it's not known that snprintf works, use sprintf to
+   implement the subset needed here.  Typically BUFSIZE is big enough
+   and there's little or no performance hit.  */
+#ifdef C_LOCALE
+# undef snprintf
+# define snprintf c_snprintf
+#elif ! GNULIB_SNPRINTF
+# undef snprintf
+# define snprintf ftoastr_snprintf
+static int
+ftoastr_snprintf (char *buf, size_t bufsize, char const *format,
+                  int width, int prec, FLOAT x)
+{
+  PROMOTED_FLOAT promoted_x = x;
+  char width_0_buffer[LENGTH == 1 ? FLT_BUFSIZE_BOUND
+                      : LENGTH == 2 ? DBL_BUFSIZE_BOUND
+                      : LDBL_BUFSIZE_BOUND];
+  int n = width;
+  if (bufsize < sizeof width_0_buffer)
+    {
+      n = sprintf (width_0_buffer, format, 0, prec, promoted_x);
+      if (n < 0)
+        return n;
+      if (n < width)
+        n = width;
+    }
+  if (n < bufsize)
+    n = sprintf (buf, format, width, prec, promoted_x);
+  return n;
+}
+#endif
+
+int
+FTOASTR (char *buf, size_t bufsize, int flags, int width, FLOAT x)
+{
+  /* The following method is simple but slow.
+     For ideas about speeding things up, please see:
+
+     Andrysco M, Jhala R, Lerner S. Printing floating-point numbers:
+     a faster, always correct method. ACM SIGPLAN notices - POPL '16.
+     2016;51(1):555-67 <https://doi.org/10.1145/2914770.2837654>; draft at
+     <https://cseweb.ucsd.edu/~lerner/papers/fp-printing-popl16.pdf>.  */
+
+  PROMOTED_FLOAT promoted_x = x;
+  char format[sizeof "%-+ 0*.*Lg"];
+  FLOAT abs_x = x < 0 ? -x : x;
+  int prec;
+
+  char *p = format;
+  *p++ = '%';
+
+  /* Support flags that generate output parsable by strtof.  */
+  *p = '-'; p += (flags & FTOASTR_LEFT_JUSTIFY  ) != 0;
+  *p = '+'; p += (flags & FTOASTR_ALWAYS_SIGNED ) != 0;
+  *p = ' '; p += (flags & FTOASTR_SPACE_POSITIVE) != 0;
+  *p = '0'; p += (flags & FTOASTR_ZERO_PAD      ) != 0;
+
+  *p++ = '*';
+  *p++ = '.';
+  *p++ = '*';
+  *p = 'L'; p += 2 < LENGTH;
+  *p++ = flags & FTOASTR_UPPER_E ? 'G' : 'g';
+  *p = '\0';
+
+  for (prec = abs_x < FLOAT_MIN ? 1 : FLOAT_DIG; ; prec++)
+    {
+      int n = snprintf (buf, bufsize, format, width, prec, promoted_x);
+      if (n < 0
+          || FLOAT_PREC_BOUND <= prec
+          || (n < bufsize && STRTOF (buf, NULL) == x))
+        return n;
+    }
+}
deleted file mode 120000 (symlink)
index 679dcf9b608b70a445bd2fea3f9637c1579a647e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ftoastr.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ed43c961a0421441a5a1197251a04b58f5432d61
--- /dev/null
@@ -0,0 +1,152 @@
+/* floating point to accurate string
+
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef _GL_FTOASTR_H
+#define _GL_FTOASTR_H
+
+#include "intprops.h"
+#include <float.h>
+#include <stddef.h>
+
+/* Store into BUF (of size BUFSIZE) an accurate minimal-precision
+   string representation of a floating point number.  FLAGS affect the
+   formatting of the number.  Pad the output string with spaces as
+   necessary to width WIDTH bytes, in the style of printf.  WIDTH must
+   be nonnegative.  X is the floating-point number to be converted.
+
+   Return the number of bytes stored into BUF, not counting the
+   terminating null.  However, do not overrun BUF: if BUF is too
+   small, return a fairly tight (but not necessarily exact) upper
+   bound on the value that would have been returned if BUF had been
+   big enough.  If SIZE is zero, BUF may be a null pointer.  On error
+   (e.g., returned value would exceed INT_MAX), return -1 and set
+   errno.
+
+   Example:
+
+     char buf[DBL_BUFSIZE_BOUND];
+     int r = dtoastr (buf, sizeof buf, 0, 0, 0.1);
+
+   In the C locale, this sets R to 3 and stores "0.1" into BUF.  */
+
+int  ftoastr (char *buf, size_t bufsize, int flags, int width,       float x);
+int  dtoastr (char *buf, size_t bufsize, int flags, int width,      double x);
+int ldtoastr (char *buf, size_t bufsize, int flags, int width, long double x);
+
+/* The last two functions except that the formatting takes place in
+   the C locale.  */
+int  c_dtoastr (char *buf, size_t bufsize, int flags, int width,      double x);
+int c_ldtoastr (char *buf, size_t bufsize, int flags, int width, long double x);
+
+
+/* Flag values for ftoastr etc.  These can be ORed together.  */
+enum
+  {
+    /* Left justify within the width; the default is right justification.  */
+    FTOASTR_LEFT_JUSTIFY = 1,
+
+    /* Output "+" before positive numbers; the default outputs nothing.  */
+    FTOASTR_ALWAYS_SIGNED = 2,
+
+    /* Output " " before positive numbers; ignored if
+       FTOASTR_ALWAYS_SIGNED is also given.  */
+    FTOASTR_SPACE_POSITIVE = 4,
+
+    /* Pad with zeros instead of spaces; ignored if FTOASTR_LEFT_JUSTIFY
+       is also given.  */
+    FTOASTR_ZERO_PAD = 8,
+
+    /* Use 'E' instead of 'e' before the exponent.  */
+    FTOASTR_UPPER_E = 16
+  };
+
+
+/* _GL_FLT_PREC_BOUND is an upper bound on the precision needed to
+   represent a float value without losing information.  Likewise for
+   _GL_DBL_PREC_BOUND and double, and _GL_LDBL_PREC_BOUND and long double.
+   These are macros, not enums, to work around a bug in IBM xlc 12.1.  */
+
+#if FLT_RADIX == 10 /* decimal floating point */
+# define  _GL_FLT_PREC_BOUND  FLT_MANT_DIG
+# define  _GL_DBL_PREC_BOUND  DBL_MANT_DIG
+# define _GL_LDBL_PREC_BOUND LDBL_MANT_DIG
+#else
+
+/* An upper bound on the number of bits needed to represent a single
+   digit in a floating-point fraction.  */
+# if FLT_RADIX == 2 /* IEEE 754 floating point, VAX floating point, etc. */
+#  define _GL_FLOAT_DIG_BITS_BOUND 1
+# elif FLT_RADIX <= 16 /* IBM hex floating point has FLT_RADIX == 16.  */
+#  define _GL_FLOAT_DIG_BITS_BOUND 4
+# else /* no machine is this bad, but let's be complete */
+#  define _GL_FLOAT_DIG_BITS_BOUND ((int) TYPE_WIDTH (int) - 1)
+# endif
+
+/* An upper bound on the number of decimal digits needed to represent
+   a floating point number accurately, assuming a fraction contains
+   DIG digits.  For why the "+ 1" is needed, see "Binary to Decimal
+   Conversion" in David Goldberg's paper "What Every Computer
+   Scientist Should Know About Floating-Point Arithmetic"
+   <https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html>.  */
+# define _GL_FLOAT_PREC_BOUND(dig) \
+   (INT_BITS_STRLEN_BOUND ((dig) * _GL_FLOAT_DIG_BITS_BOUND) + 1)
+
+# define  _GL_FLT_PREC_BOUND _GL_FLOAT_PREC_BOUND ( FLT_MANT_DIG)
+# define  _GL_DBL_PREC_BOUND _GL_FLOAT_PREC_BOUND ( DBL_MANT_DIG)
+# define _GL_LDBL_PREC_BOUND _GL_FLOAT_PREC_BOUND (LDBL_MANT_DIG)
+#endif
+
+
+/* Bound on the number of bytes printed for an exponent in the range
+   MIN..MAX, where MIN < 0 < MAX; printf always prints a sign and at
+   least 2 digits.  Although the maximum known exponent is 4932 for
+   IEEE 754 binary128, support tight bounds for exponents up to a
+   million, just in case.  */
+#define _GL_FLOAT_EXPONENT_STRLEN_BOUND(min, max)  \
+  (      -100 < (min) && (max) <     100 ? 3       \
+   :    -1000 < (min) && (max) <    1000 ? 4       \
+   :   -10000 < (min) && (max) <   10000 ? 5       \
+   :  -100000 < (min) && (max) <  100000 ? 6       \
+   : -1000000 < (min) && (max) < 1000000 ? 7       \
+   : INT_STRLEN_BOUND (int) /* not a tight bound */)
+
+/* A reasonably tight bound on the length of a type-T floating value
+   formatted with ftoastr etc.  Room is needed for sign, fraction
+   digits, decimal point, "e", and exponent.  POINTLEN should be a
+   reasonably tight bound on the string length of the decimal
+   point.  */
+#define _GL_FLOAT_STRLEN_BOUND_L(t, pointlen)                          \
+  (1 + _GL_##t##_PREC_BOUND + pointlen + 1                             \
+   + _GL_FLOAT_EXPONENT_STRLEN_BOUND (t##_MIN_10_EXP, t##_MAX_10_EXP))
+#define  FLT_STRLEN_BOUND_L(pointlen) _GL_FLOAT_STRLEN_BOUND_L ( FLT, pointlen)
+#define  DBL_STRLEN_BOUND_L(pointlen) _GL_FLOAT_STRLEN_BOUND_L ( DBL, pointlen)
+#define LDBL_STRLEN_BOUND_L(pointlen) _GL_FLOAT_STRLEN_BOUND_L (LDBL, pointlen)
+
+/* Looser bounds that are locale-independent and are integral constant
+   expressions.  */
+#define  FLT_STRLEN_BOUND  FLT_STRLEN_BOUND_L (MB_LEN_MAX)
+#define  DBL_STRLEN_BOUND  DBL_STRLEN_BOUND_L (MB_LEN_MAX)
+#define LDBL_STRLEN_BOUND LDBL_STRLEN_BOUND_L (MB_LEN_MAX)
+
+/* Looser, locale-independent bounds that include the trailing null byte.  */
+#define  FLT_BUFSIZE_BOUND ( FLT_STRLEN_BOUND + 1)
+#define  DBL_BUFSIZE_BOUND ( DBL_STRLEN_BOUND + 1)
+#define LDBL_BUFSIZE_BOUND (LDBL_STRLEN_BOUND + 1)
+
+#endif /* _GL_FTOASTR_H */
deleted file mode 120000 (symlink)
index 4dd0b75b487c5fbc3f84d030a4d1dbba1f810d6d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ftruncate.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6394725781b4e10d597fd97667b1c74be3a32669
--- /dev/null
@@ -0,0 +1,195 @@
+/* ftruncate emulations for native Windows.
+   Copyright (C) 1992-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#if HAVE__CHSIZE
+/* A native Windows platform.  */
+
+# include <errno.h>
+
+# if _GL_WINDOWS_64_BIT_OFF_T
+
+/* Large File Support: off_t is 64-bit, but _chsize() takes only a 32-bit
+   argument.  So, define a 64-bit safe SetFileSize function ourselves.  */
+
+/* Ensure that <windows.h> declares GetFileSizeEx.  */
+#  if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN2K)
+#   undef _WIN32_WINNT
+#   define _WIN32_WINNT _WIN32_WINNT_WIN2K
+#  endif
+
+/* Get declarations of the native Windows API functions.  */
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+
+/* Get _get_osfhandle.  */
+#  if GNULIB_MSVC_NOTHROW
+#   include "msvc-nothrow.h"
+#  else
+#   include <io.h>
+#  endif
+
+static BOOL
+SetFileSize (HANDLE h, LONGLONG size)
+{
+  LARGE_INTEGER old_size;
+
+  if (!GetFileSizeEx (h, &old_size))
+    return FALSE;
+
+  if (size != old_size.QuadPart)
+    {
+      /* Duplicate the handle, so we are free to modify its file position.  */
+      HANDLE curr_process = GetCurrentProcess ();
+      HANDLE tmph;
+
+      if (!DuplicateHandle (curr_process,           /* SourceProcessHandle */
+                            h,                      /* SourceHandle */
+                            curr_process,           /* TargetProcessHandle */
+                            (PHANDLE) &tmph,        /* TargetHandle */
+                            (DWORD) 0,              /* DesiredAccess */
+                            FALSE,                  /* InheritHandle */
+                            DUPLICATE_SAME_ACCESS)) /* Options */
+        return FALSE;
+
+      if (size < old_size.QuadPart)
+        {
+          /* Reduce the size.  */
+          LONG size_hi = (LONG) (size >> 32);
+          if (SetFilePointer (tmph, (LONG) size, &size_hi, FILE_BEGIN)
+              == INVALID_SET_FILE_POINTER
+              && GetLastError() != NO_ERROR)
+            {
+              CloseHandle (tmph);
+              return FALSE;
+            }
+          if (!SetEndOfFile (tmph))
+            {
+              CloseHandle (tmph);
+              return FALSE;
+            }
+        }
+      else
+        {
+          /* Increase the size by adding zero bytes at the end.  */
+          static char zero_bytes[1024];
+          LONG pos_hi = 0;
+          LONG pos_lo = SetFilePointer (tmph, (LONG) 0, &pos_hi, FILE_END);
+          LONGLONG pos;
+          if (pos_lo == INVALID_SET_FILE_POINTER
+              && GetLastError() != NO_ERROR)
+            {
+              CloseHandle (tmph);
+              return FALSE;
+            }
+          pos = ((LONGLONG) pos_hi << 32) | (ULONGLONG) (ULONG) pos_lo;
+          while (pos < size)
+            {
+              DWORD written;
+              LONGLONG count = size - pos;
+              if (count > sizeof (zero_bytes))
+                count = sizeof (zero_bytes);
+              if (!WriteFile (tmph, zero_bytes, (DWORD) count, &written, NULL)
+                  || written == 0)
+                {
+                  CloseHandle (tmph);
+                  return FALSE;
+                }
+              pos += (ULONGLONG) (ULONG) written;
+            }
+        }
+      /* Close the handle.  */
+      CloseHandle (tmph);
+    }
+  return TRUE;
+}
+
+int
+ftruncate (int fd, off_t length)
+{
+  HANDLE handle = (HANDLE) _get_osfhandle (fd);
+
+  if (handle == INVALID_HANDLE_VALUE)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  if (length < 0)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  if (!SetFileSize (handle, length))
+    {
+      switch (GetLastError ())
+        {
+        case ERROR_ACCESS_DENIED:
+          errno = EACCES;
+          break;
+        case ERROR_HANDLE_DISK_FULL:
+        case ERROR_DISK_FULL:
+        case ERROR_DISK_TOO_FRAGMENTED:
+          errno = ENOSPC;
+          break;
+        default:
+          errno = EIO;
+          break;
+        }
+      return -1;
+    }
+  return 0;
+}
+
+# else
+
+#  include <io.h>
+
+#  if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#   include "msvc-inval.h"
+static int
+chsize_nothrow (int fd, long length)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _chsize (fd, length);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = -1;
+      errno = EBADF;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+#  else
+#   define chsize_nothrow _chsize
+#  endif
+
+int
+ftruncate (int fd, off_t length)
+{
+  return chsize_nothrow (fd, length);
+}
+
+# endif
+#endif
deleted file mode 120000 (symlink)
index 99775edb42044af5282e0786301cc9fc72f11d70..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fts-cycle.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d5e5f897ea984d70d7531d984d9a65a6b9c02ae5
--- /dev/null
@@ -0,0 +1,160 @@
+/* Detect cycles in file tree walks.
+
+   Copyright (C) 2003-2006, 2009-2024 Free Software Foundation, Inc.
+
+   Written by Jim Meyering.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "cycle-check.h"
+#include "hash.h"
+
+/* Use each of these to map a device/inode pair to an FTSENT.  */
+struct Active_dir
+{
+  dev_t dev;
+  ino_t ino;
+  FTSENT *fts_ent;
+};
+
+static bool
+AD_compare (void const *x, void const *y)
+{
+  struct Active_dir const *ax = x;
+  struct Active_dir const *ay = y;
+  return ax->ino == ay->ino
+      && ax->dev == ay->dev;
+}
+
+static size_t
+AD_hash (void const *x, size_t table_size)
+{
+  struct Active_dir const *ax = x;
+  return (uintmax_t) ax->ino % table_size;
+}
+
+/* Set up the cycle-detection machinery.  */
+
+static bool
+setup_dir (FTS *fts)
+{
+  if (fts->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL))
+    {
+      enum { HT_INITIAL_SIZE = 31 };
+      fts->fts_cycle.ht = hash_initialize (HT_INITIAL_SIZE, NULL, AD_hash,
+                                           AD_compare, free);
+      if (! fts->fts_cycle.ht)
+        return false;
+    }
+  else
+    {
+      fts->fts_cycle.state = malloc (sizeof *fts->fts_cycle.state);
+      if (! fts->fts_cycle.state)
+        return false;
+      cycle_check_init (fts->fts_cycle.state);
+    }
+
+  return true;
+}
+
+/* Enter a directory during a file tree walk.  */
+
+static bool
+enter_dir (FTS *fts, FTSENT *ent)
+{
+  if (fts->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL))
+    {
+      struct stat const *st = ent->fts_statp;
+      struct Active_dir *ad = malloc (sizeof *ad);
+      struct Active_dir *ad_from_table;
+
+      if (!ad)
+        return false;
+
+      ad->dev = st->st_dev;
+      ad->ino = st->st_ino;
+      ad->fts_ent = ent;
+
+      /* See if we've already encountered this directory.
+         This can happen when following symlinks as well as
+         with a corrupted directory hierarchy. */
+      ad_from_table = hash_insert (fts->fts_cycle.ht, ad);
+
+      if (ad_from_table != ad)
+        {
+          free (ad);
+          if (!ad_from_table)
+            return false;
+
+          /* There was an entry with matching dev/inode already in the table.
+             Record the fact that we've found a cycle.  */
+          ent->fts_cycle = ad_from_table->fts_ent;
+          ent->fts_info = FTS_DC;
+        }
+    }
+  else
+    {
+      if (cycle_check (fts->fts_cycle.state, ent->fts_statp))
+        {
+          /* FIXME: setting fts_cycle like this isn't proper.
+             To do what the documentation requires, we'd have to
+             go around the cycle again and find the right entry.
+             But no callers in coreutils use the fts_cycle member. */
+          ent->fts_cycle = ent;
+          ent->fts_info = FTS_DC;
+        }
+    }
+
+  return true;
+}
+
+/* Leave a directory during a file tree walk.  */
+
+static void
+leave_dir (FTS *fts, FTSENT *ent)
+{
+  struct stat const *st = ent->fts_statp;
+  if (fts->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL))
+    {
+      struct Active_dir obj;
+      void *found;
+      obj.dev = st->st_dev;
+      obj.ino = st->st_ino;
+      found = hash_remove (fts->fts_cycle.ht, &obj);
+      if (!found)
+        abort ();
+      free (found);
+    }
+  else
+    {
+      FTSENT *parent = ent->fts_parent;
+      if (parent != NULL && 0 <= parent->fts_level)
+        CYCLE_CHECK_REFLECT_CHDIR_UP (fts->fts_cycle.state,
+                                      *(parent->fts_statp), *st);
+    }
+}
+
+/* Free any memory used for cycle detection.  */
+
+static void
+free_dir (FTS *sp)
+{
+  if (sp->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL))
+    {
+      if (sp->fts_cycle.ht)
+        hash_free (sp->fts_cycle.ht);
+    }
+  else
+    free (sp->fts_cycle.state);
+}
deleted file mode 120000 (symlink)
index f0b52d370046df657e913f71903b442ffd1224c8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fts.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5a86419c748b8a1592851df6cd2d17b699939ca3
--- /dev/null
+/* Traverse a file hierarchy.
+
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <config.h>
+
+#if defined LIBC_SCCS && !defined GCC_LINT && !defined lint
+static char sccsid[] = "@(#)fts.c       8.6 (Berkeley) 8/14/94";
+#endif
+
+#include "fts_.h"
+
+#if HAVE_SYS_PARAM_H || defined _LIBC
+# include <sys/param.h>
+#endif
+#ifdef _LIBC
+# include <include/sys/stat.h>
+#else
+# include <sys/stat.h>
+#endif
+#include <fcntl.h>
+#include <errno.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#if ! _LIBC
+# include "attribute.h"
+# include "fcntl--.h"
+# include "flexmember.h"
+# include "openat.h"
+# include "opendirat.h"
+# include "same-inode.h"
+#endif
+
+#include <dirent.h>
+#ifndef _D_EXACT_NAMLEN
+# define _D_EXACT_NAMLEN(dirent) strlen ((dirent)->d_name)
+#endif
+
+#if HAVE_STRUCT_DIRENT_D_TYPE
+/* True if the type of the directory entry D is known.  */
+# define DT_IS_KNOWN(d) ((d)->d_type != DT_UNKNOWN)
+/* True if the type of the directory entry D must be T.  */
+# define DT_MUST_BE(d, t) ((d)->d_type == (t))
+# define D_TYPE(d) ((d)->d_type)
+#else
+# define DT_IS_KNOWN(d) false
+# define DT_MUST_BE(d, t) false
+# define D_TYPE(d) DT_UNKNOWN
+
+# undef DT_UNKNOWN
+# define DT_UNKNOWN 0
+
+/* Any nonzero values will do here, so long as they're distinct.
+   Undef any existing macros out of the way.  */
+# undef DT_BLK
+# undef DT_CHR
+# undef DT_DIR
+# undef DT_FIFO
+# undef DT_LNK
+# undef DT_REG
+# undef DT_SOCK
+# define DT_BLK 1
+# define DT_CHR 2
+# define DT_DIR 3
+# define DT_FIFO 4
+# define DT_LNK 5
+# define DT_REG 6
+# define DT_SOCK 7
+#endif
+
+#ifndef S_IFBLK
+# define S_IFBLK 0
+#endif
+#ifndef S_IFLNK
+# define S_IFLNK 0
+#endif
+#ifndef S_IFSOCK
+# define S_IFSOCK 0
+#endif
+
+enum
+{
+  NOT_AN_INODE_NUMBER = 0
+};
+
+#ifdef D_INO_IN_DIRENT
+# define D_INO(dp) (dp)->d_ino
+#else
+/* Some systems don't have inodes, so fake them to avoid lots of ifdefs.  */
+# define D_INO(dp) NOT_AN_INODE_NUMBER
+#endif
+
+/* If possible (see max_entries, below), read no more than this many directory
+   entries at a time.  Without this limit (i.e., when using non-NULL
+   fts_compar), processing a directory with 4,000,000 entries requires ~1GiB
+   of memory, and handling 64M entries would require 16GiB of memory.  */
+#ifndef FTS_MAX_READDIR_ENTRIES
+# define FTS_MAX_READDIR_ENTRIES 100000
+#endif
+
+/* If there are more than this many entries in a directory,
+   and the conditions mentioned below are satisfied, then sort
+   the entries on inode number before any further processing.  */
+#ifndef FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD
+# define FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD 10000
+#endif
+
+enum
+{
+  _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD = FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD
+};
+
+enum Fts_stat
+{
+  FTS_NO_STAT_REQUIRED = 1,
+  FTS_STAT_REQUIRED = 2
+};
+
+#ifdef _LIBC
+# undef close
+# define close __close
+# undef closedir
+# define closedir __closedir
+# undef fchdir
+# define fchdir __fchdir
+# undef open
+# define open __open
+# undef readdir
+# define readdir __readdir
+#else
+# undef internal_function
+# define internal_function /* empty */
+#endif
+
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+
+/* If this host provides the openat function, then we can avoid
+   attempting to open "." in some initialization code below.  */
+#ifdef HAVE_OPENAT
+# define HAVE_OPENAT_SUPPORT 1
+#else
+# define HAVE_OPENAT_SUPPORT 0
+#endif
+
+#ifdef NDEBUG
+# define fts_assert(expr) ((void) (0 && (expr)))
+#else
+# define fts_assert(expr)       \
+    do                          \
+      {                         \
+        if (!(expr))            \
+          abort ();             \
+      }                         \
+    while (false)
+#endif
+
+#ifdef _LIBC
+# if __glibc_has_attribute (__fallthrough__)
+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define FALLTHROUGH ((void) 0)
+# endif
+#endif
+
+static FTSENT   *fts_alloc (FTS *, const char *, size_t) internal_function;
+static FTSENT   *fts_build (FTS *, int) internal_function;
+static void      fts_lfree (FTSENT *) internal_function;
+static void      fts_load (FTS *, FTSENT *) internal_function;
+static size_t    fts_maxarglen (char * const *) internal_function;
+static void      fts_padjust (FTS *, FTSENT *) internal_function;
+static bool      fts_palloc (FTS *, size_t) internal_function;
+static FTSENT   *fts_sort (FTS *, FTSENT *, size_t) internal_function;
+static unsigned short int fts_stat (FTS *, FTSENT *, bool) internal_function;
+static int      fts_safe_changedir (FTS *, FTSENT *, int, const char *)
+     internal_function;
+
+#include "fts-cycle.c"
+
+#ifndef MAX
+# define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
+#define ISDOT(a)        (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
+#define STREQ(a, b)     (strcmp (a, b) == 0)
+
+#define CLR(opt)        (sp->fts_options &= ~(opt))
+#define ISSET(opt)      ((sp->fts_options & (opt)) != 0)
+#define SET(opt)        (sp->fts_options |= (opt))
+
+/* FIXME: FTS_NOCHDIR is now misnamed.
+   Call it FTS_USE_FULL_RELATIVE_FILE_NAMES instead. */
+#define FCHDIR(sp, fd)                                  \
+  (!ISSET(FTS_NOCHDIR) && (ISSET(FTS_CWDFD)             \
+                           ? (cwd_advance_fd ((sp), (fd), true), 0) \
+                           : fchdir (fd)))
+
+
+/* fts_build flags */
+/* FIXME: make this an enum */
+#define BCHILD          1               /* fts_children */
+#define BNAMES          2               /* fts_children, names only */
+#define BREAD           3               /* fts_read */
+
+#if GNULIB_FTS_DEBUG
+# include <inttypes.h>
+# include <stdio.h>
+bool fts_debug = false;
+# define Dprintf(x) do { if (fts_debug) printf x; } while (false)
+static void fd_ring_check (FTS const *);
+static void fd_ring_print (FTS const *, FILE *, char const *);
+#else
+# define Dprintf(x)
+# define fd_ring_check(x)
+# define fd_ring_print(a, b, c)
+#endif
+
+#define LEAVE_DIR(Fts, Ent, Tag)                                \
+  do                                                            \
+    {                                                           \
+      Dprintf (("  %s-leaving: %s\n", Tag, (Ent)->fts_path));   \
+      leave_dir (Fts, Ent);                                     \
+      fd_ring_check (Fts);                                      \
+    }                                                           \
+  while (false)
+
+static void
+fd_ring_clear (I_ring *fd_ring)
+{
+  while ( ! i_ring_empty (fd_ring))
+    {
+      int fd = i_ring_pop (fd_ring);
+      if (0 <= fd)
+        close (fd);
+    }
+}
+
+/* Overload the fts_statp->st_size member (otherwise unused, when
+   fts_info is FTS_NSOK) to indicate whether fts_read should stat
+   this entry or not.  */
+static void
+fts_set_stat_required (FTSENT *p, bool required)
+{
+  fts_assert (p->fts_info == FTS_NSOK);
+  p->fts_statp->st_size = (required
+                           ? FTS_STAT_REQUIRED
+                           : FTS_NO_STAT_REQUIRED);
+}
+
+/* Virtual fchdir.  Advance SP's working directory file descriptor,
+   SP->fts_cwd_fd, to FD, and push the previous value onto the fd_ring.
+   CHDIR_DOWN_ONE is true if FD corresponds to an entry in the directory
+   open on sp->fts_cwd_fd; i.e., to move the working directory one level
+   down.  */
+static void
+internal_function
+cwd_advance_fd (FTS *sp, int fd, bool chdir_down_one)
+{
+  int old = sp->fts_cwd_fd;
+  fts_assert (old != fd || old == AT_FDCWD);
+
+  if (chdir_down_one)
+    {
+      /* Push "old" onto the ring.
+         If the displaced file descriptor is non-negative, close it.  */
+      int prev_fd_in_slot = i_ring_push (&sp->fts_fd_ring, old);
+      fd_ring_print (sp, stderr, "post-push");
+      if (0 <= prev_fd_in_slot)
+        close (prev_fd_in_slot); /* ignore any close failure */
+    }
+  else if ( ! ISSET (FTS_NOCHDIR))
+    {
+      if (0 <= old)
+        close (old); /* ignore any close failure */
+    }
+
+  sp->fts_cwd_fd = fd;
+}
+
+/* Restore the initial, pre-traversal, "working directory".
+   In FTS_CWDFD mode, we merely call cwd_advance_fd, otherwise,
+   we may actually change the working directory.
+   Return 0 upon success. Upon failure, set errno and return nonzero.  */
+static int
+restore_initial_cwd (FTS *sp)
+{
+  int fail = FCHDIR (sp, ISSET (FTS_CWDFD) ? AT_FDCWD : sp->fts_rfd);
+  fd_ring_clear (&(sp->fts_fd_ring));
+  return fail;
+}
+
+/* Open the directory DIR if possible, and return a file
+   descriptor.  Return -1 and set errno on failure.  It doesn't matter
+   whether the file descriptor has read or write access.  */
+
+static int
+internal_function
+diropen (FTS const *sp, char const *dir)
+{
+  int open_flags = (O_SEARCH | O_CLOEXEC | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
+                    | (ISSET (FTS_PHYSICAL) ? O_NOFOLLOW : 0));
+
+  int fd = (ISSET (FTS_CWDFD)
+            ? openat (sp->fts_cwd_fd, dir, open_flags)
+            : open (dir, open_flags));
+  return fd;
+}
+
+FTS *
+fts_open (char * const *argv,
+          register int options,
+          int (*compar) (FTSENT const **, FTSENT const **))
+{
+        register FTS *sp;
+        register FTSENT *p, *root;
+        register size_t nitems;
+        FTSENT *parent = NULL;
+        FTSENT *tmp = NULL;     /* pacify gcc */
+        bool defer_stat;
+
+        /* Options check. */
+        if (options & ~FTS_OPTIONMASK) {
+                __set_errno (EINVAL);
+                return (NULL);
+        }
+        if ((options & FTS_NOCHDIR) && (options & FTS_CWDFD)) {
+                __set_errno (EINVAL);
+                return (NULL);
+        }
+        if ( ! (options & (FTS_LOGICAL | FTS_PHYSICAL))) {
+                __set_errno (EINVAL);
+                return (NULL);
+        }
+
+        /* Allocate/initialize the stream */
+        sp = calloc (1, sizeof *sp);
+        if (sp == NULL)
+                return (NULL);
+        sp->fts_compar = compar;
+        sp->fts_options = options;
+
+        /* Logical walks turn on NOCHDIR; symbolic links are too hard. */
+        if (ISSET(FTS_LOGICAL)) {
+                SET(FTS_NOCHDIR);
+                CLR(FTS_CWDFD);
+        }
+
+        /* Initialize fts_cwd_fd.  */
+        sp->fts_cwd_fd = AT_FDCWD;
+        if ( ISSET(FTS_CWDFD) && ! HAVE_OPENAT_SUPPORT)
+          {
+            /* While it isn't technically necessary to open "." this
+               early, doing it here saves us the trouble of ensuring
+               later (where it'd be messier) that "." can in fact
+               be opened.  If not, revert to FTS_NOCHDIR mode.  */
+            int fd = open (".", O_SEARCH | O_CLOEXEC);
+            if (fd < 0)
+              {
+                /* Even if "." is unreadable, don't revert to FTS_NOCHDIR mode
+                   on systems like Linux+PROC_FS, where our openat emulation
+                   is good enough.  Note: on a system that emulates
+                   openat via /proc, this technique can still fail, but
+                   only in extreme conditions, e.g., when the working
+                   directory cannot be saved (i.e. save_cwd fails) --
+                   and that happens on Linux only when "." is unreadable
+                   and the CWD would be longer than PATH_MAX.
+                   FIXME: once Linux kernel openat support is well established,
+                   replace the above open call and this entire if/else block
+                   with the body of the if-block below.  */
+                if ( openat_needs_fchdir ())
+                  {
+                    SET(FTS_NOCHDIR);
+                    CLR(FTS_CWDFD);
+                  }
+              }
+            else
+              {
+                close (fd);
+              }
+          }
+
+        /*
+         * Start out with 1K of file name space, and enough, in any case,
+         * to hold the user's file names.
+         */
+#ifndef MAXPATHLEN
+# define MAXPATHLEN 1024
+#endif
+        {
+          size_t maxarglen = fts_maxarglen(argv);
+          if (! fts_palloc(sp, MAX(maxarglen, MAXPATHLEN)))
+                  goto mem1;
+        }
+
+        /* Allocate/initialize root's parent. */
+        if (*argv != NULL) {
+                if ((parent = fts_alloc(sp, "", 0)) == NULL)
+                        goto mem2;
+                parent->fts_level = FTS_ROOTPARENTLEVEL;
+          }
+
+        /* The classic fts implementation would call fts_stat with
+           a new entry for each iteration of the loop below.
+           If the comparison function is not specified or if the
+           FTS_DEFER_STAT option is in effect, don't stat any entry
+           in this loop.  This is an attempt to minimize the interval
+           between the initial stat/lstat/fstatat and the point at which
+           a directory argument is first opened.  This matters for any
+           directory command line argument that resides on a file system
+           without genuine i-nodes.  If you specify FTS_DEFER_STAT along
+           with a comparison function, that function must not access any
+           data via the fts_statp pointer.  */
+        defer_stat = (compar == NULL || ISSET(FTS_DEFER_STAT));
+
+        /* Allocate/initialize root(s). */
+        for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) {
+                /* *Do* allow zero-length file names. */
+                size_t len = strlen(*argv);
+
+                if ( ! (options & FTS_VERBATIM))
+                  {
+                    /* If there are two or more trailing slashes, trim all but one,
+                       but don't change "//" to "/", and do map "///" to "/".  */
+                    char const *v = *argv;
+                    if (2 < len && v[len - 1] == '/')
+                      while (1 < len && v[len - 2] == '/')
+                        --len;
+                  }
+
+                if ((p = fts_alloc(sp, *argv, len)) == NULL)
+                        goto mem3;
+                p->fts_level = FTS_ROOTLEVEL;
+                p->fts_parent = parent;
+                p->fts_accpath = p->fts_name;
+                /* Even when defer_stat is true, be sure to stat the first
+                   command line argument, since fts_read (at least with
+                   FTS_XDEV) requires that.  */
+                if (defer_stat && root != NULL) {
+                        p->fts_info = FTS_NSOK;
+                        fts_set_stat_required(p, true);
+                } else {
+                        p->fts_info = fts_stat(sp, p, false);
+                }
+
+                /*
+                 * If comparison routine supplied, traverse in sorted
+                 * order; otherwise traverse in the order specified.
+                 */
+                if (compar) {
+                        p->fts_link = root;
+                        root = p;
+                } else {
+                        p->fts_link = NULL;
+                        if (root == NULL)
+                                tmp = root = p;
+                        else {
+                                tmp->fts_link = p;
+                                tmp = p;
+                        }
+                }
+        }
+        if (compar && nitems > 1)
+                root = fts_sort(sp, root, nitems);
+
+        /*
+         * Allocate a dummy pointer and make fts_read think that we've just
+         * finished the node before the root(s); set p->fts_info to FTS_INIT
+         * so that everything about the "current" node is ignored.
+         */
+        if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
+                goto mem3;
+        sp->fts_cur->fts_link = root;
+        sp->fts_cur->fts_info = FTS_INIT;
+        sp->fts_cur->fts_level = 1;
+        if (! setup_dir (sp))
+                goto mem3;
+
+        /*
+         * If using chdir(2), grab a file descriptor pointing to dot to ensure
+         * that we can get back here; this could be avoided for some file names,
+         * but almost certainly not worth the effort.  Slashes, symbolic links,
+         * and ".." are all fairly nasty problems.  Note, if we can't get the
+         * descriptor we run anyway, just more slowly.
+         */
+        if (!ISSET(FTS_NOCHDIR) && !ISSET(FTS_CWDFD)
+            && (sp->fts_rfd = diropen (sp, ".")) < 0)
+                SET(FTS_NOCHDIR);
+
+        i_ring_init (&sp->fts_fd_ring, -1);
+        return (sp);
+
+mem3:   fts_lfree(root);
+        free(parent);
+mem2:   free(sp->fts_path);
+mem1:   free(sp);
+        return (NULL);
+}
+
+static void
+internal_function
+fts_load (FTS *sp, register FTSENT *p)
+{
+        register size_t len;
+        register char *cp;
+
+        /*
+         * Load the stream structure for the next traversal.  Since we don't
+         * actually enter the directory until after the preorder visit, set
+         * the fts_accpath field specially so the chdir gets done to the right
+         * place and the user can access the first node.  From fts_open it's
+         * known that the file name will fit.
+         */
+        len = p->fts_pathlen = p->fts_namelen;
+        memmove(sp->fts_path, p->fts_name, len + 1);
+        if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) {
+                len = strlen(++cp);
+                memmove(p->fts_name, cp, len + 1);
+                p->fts_namelen = len;
+        }
+        p->fts_accpath = p->fts_path = sp->fts_path;
+}
+
+int
+fts_close (FTS *sp)
+{
+        register FTSENT *freep, *p;
+        int saved_errno = 0;
+
+        /*
+         * This still works if we haven't read anything -- the dummy structure
+         * points to the root list, so we step through to the end of the root
+         * list which has a valid parent pointer.
+         */
+        if (sp->fts_cur) {
+                for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
+                        freep = p;
+                        p = p->fts_link != NULL ? p->fts_link : p->fts_parent;
+                        free(freep);
+                }
+                free(p);
+        }
+
+        /* Free up child linked list, sort array, file name buffer. */
+        if (sp->fts_child)
+                fts_lfree(sp->fts_child);
+        free(sp->fts_array);
+        free(sp->fts_path);
+
+        if (ISSET(FTS_CWDFD))
+          {
+            if (0 <= sp->fts_cwd_fd)
+              if (close (sp->fts_cwd_fd))
+                saved_errno = errno;
+          }
+        else if (!ISSET(FTS_NOCHDIR))
+          {
+            /* Return to original directory, save errno if necessary. */
+            if (fchdir(sp->fts_rfd))
+              saved_errno = errno;
+
+            /* If close fails, record errno only if saved_errno is zero,
+               so that we report the probably-more-meaningful fchdir errno.  */
+            if (close (sp->fts_rfd))
+              if (saved_errno == 0)
+                saved_errno = errno;
+          }
+
+        fd_ring_clear (&sp->fts_fd_ring);
+
+        if (sp->fts_leaf_optimization_works_ht)
+          hash_free (sp->fts_leaf_optimization_works_ht);
+
+        free_dir (sp);
+
+        /* Free up the stream pointer. */
+        free(sp);
+
+        /* Set errno and return. */
+        if (saved_errno) {
+                __set_errno (saved_errno);
+                return (-1);
+        }
+
+        return (0);
+}
+
+/* Minimum link count of a traditional Unix directory.  When leaf
+   optimization is OK and a directory's st_nlink == MIN_DIR_NLINK,
+   then the directory has no subdirectories.  */
+enum { MIN_DIR_NLINK = 2 };
+
+/* Whether leaf optimization is OK for a directory.  */
+enum leaf_optimization
+  {
+    /* st_nlink is not reliable for this directory's subdirectories.  */
+    NO_LEAF_OPTIMIZATION,
+
+    /* st_nlink == 2 means the directory lacks subdirectories.  */
+    OK_LEAF_OPTIMIZATION
+  };
+
+#if (defined __linux__ || defined __ANDROID__) \
+  && HAVE_SYS_VFS_H && HAVE_FSTATFS && HAVE_STRUCT_STATFS_F_TYPE
+
+# include <sys/vfs.h>
+
+/* Linux-specific constants from coreutils' src/fs.h */
+# define S_MAGIC_AFS 0x5346414F
+# define S_MAGIC_CIFS 0xFF534D42
+# define S_MAGIC_NFS 0x6969
+# define S_MAGIC_PROC 0x9FA0
+# define S_MAGIC_TMPFS 0x1021994
+
+# ifdef HAVE___FSWORD_T
+typedef __fsword_t fsword;
+# else
+typedef long int fsword;
+# endif
+
+/* Map a stat.st_dev number to a file system type number f_ftype.  */
+struct dev_type
+{
+  dev_t st_dev;
+  fsword f_type;
+};
+
+/* Use a tiny initial size.  If a traversal encounters more than
+   a few devices, the cost of growing/rehashing this table will be
+   rendered negligible by the number of inodes processed.  */
+enum { DEV_TYPE_HT_INITIAL_SIZE = 13 };
+
+static size_t
+dev_type_hash (void const *x, size_t table_size)
+{
+  struct dev_type const *ax = x;
+  uintmax_t dev = ax->st_dev;
+  return dev % table_size;
+}
+
+static bool
+dev_type_compare (void const *x, void const *y)
+{
+  struct dev_type const *ax = x;
+  struct dev_type const *ay = y;
+  return ax->st_dev == ay->st_dev;
+}
+
+/* Return the file system type of P with file descriptor FD, or 0 if not known.
+   If FD is negative, P's file descriptor is unavailable.
+   Try to cache known values.  */
+
+static fsword
+filesystem_type (FTSENT const *p, int fd)
+{
+  FTS *sp = p->fts_fts;
+  Hash_table *h = sp->fts_leaf_optimization_works_ht;
+  struct dev_type *ent;
+  struct statfs fs_buf;
+
+  /* If we're not in CWDFD mode, don't bother with this optimization,
+     since the caller is not serious about performance.  */
+  if (!ISSET (FTS_CWDFD))
+    return 0;
+
+  if (! h)
+    h = sp->fts_leaf_optimization_works_ht
+      = hash_initialize (DEV_TYPE_HT_INITIAL_SIZE, NULL, dev_type_hash,
+                         dev_type_compare, free);
+  if (h)
+    {
+      struct dev_type tmp;
+      tmp.st_dev = p->fts_statp->st_dev;
+      ent = hash_lookup (h, &tmp);
+      if (ent)
+        return ent->f_type;
+    }
+
+  /* Look-up failed.  Query directly and cache the result.  */
+  if (fd < 0 || fstatfs (fd, &fs_buf) != 0)
+    return 0;
+
+  if (h)
+    {
+      struct dev_type *t2 = malloc (sizeof *t2);
+      if (t2)
+        {
+          t2->st_dev = p->fts_statp->st_dev;
+          t2->f_type = fs_buf.f_type;
+
+          ent = hash_insert (h, t2);
+          if (ent)
+            fts_assert (ent == t2);
+          else
+            free (t2);
+        }
+    }
+
+  return fs_buf.f_type;
+}
+
+/* Return true if sorting dirents on inode numbers is known to improve
+   traversal performance for the directory P with descriptor DIR_FD.
+   Return false otherwise.  When in doubt, return true.
+   DIR_FD is negative if unavailable.  */
+static bool
+dirent_inode_sort_may_be_useful (FTSENT const *p, int dir_fd)
+{
+  /* Skip the sort only if we can determine efficiently
+     that skipping it is the right thing to do.
+     The cost of performing an unnecessary sort is negligible,
+     while the cost of *not* performing it can be O(N^2) with
+     a very large constant.  */
+
+  switch (filesystem_type (p, dir_fd))
+    {
+    case S_MAGIC_CIFS:
+    case S_MAGIC_NFS:
+    case S_MAGIC_TMPFS:
+      /* On a file system of any of these types, sorting
+         is unnecessary, and hence wasteful.  */
+      return false;
+
+    default:
+      return true;
+    }
+}
+
+/* Given an FTS entry P for a directory with descriptor DIR_FD,
+   return whether it is valid to apply leaf optimization.
+   The optimization is valid if a directory's st_nlink value equal
+   to MIN_DIR_NLINK means the directory has no subdirectories.
+   DIR_FD is negative if unavailable.  */
+static enum leaf_optimization
+leaf_optimization (FTSENT const *p, int dir_fd)
+{
+  switch (filesystem_type (p, dir_fd))
+    {
+    case 0:
+      /* Leaf optimization is unsafe if the file system type is unknown.  */
+      FALLTHROUGH;
+    case S_MAGIC_AFS:
+      /* Although AFS mount points are not counted in st_nlink, they
+         act like directories.  See <https://bugs.debian.org/143111>.  */
+      FALLTHROUGH;
+    case S_MAGIC_CIFS:
+      /* Leaf optimization causes 'find' to abort.  See
+         <https://lists.gnu.org/r/bug-gnulib/2018-04/msg00015.html>.  */
+      FALLTHROUGH;
+    case S_MAGIC_NFS:
+      /* NFS provides usable dirent.d_type but not necessarily for all entries
+         of large directories, so as per <https://bugzilla.redhat.com/1252549>
+         NFS should return true.  However st_nlink values are not accurate on
+         all implementations as per <https://bugzilla.redhat.com/1299169>.  */
+      FALLTHROUGH;
+    case S_MAGIC_PROC:
+      /* Per <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=143111> /proc
+         may have bogus stat.st_nlink values.  */
+      return NO_LEAF_OPTIMIZATION;
+
+    default:
+      return OK_LEAF_OPTIMIZATION;
+    }
+}
+
+#else
+static bool
+dirent_inode_sort_may_be_useful (_GL_UNUSED FTSENT const *p,
+                                 _GL_UNUSED int dir_fd)
+{
+  return true;
+}
+static enum leaf_optimization
+leaf_optimization (_GL_UNUSED FTSENT const *p, _GL_UNUSED int dir_fd)
+{
+  return NO_LEAF_OPTIMIZATION;
+}
+#endif
+
+/*
+ * Special case of "/" at the end of the file name so that slashes aren't
+ * appended which would cause file names to be written as "....//foo".
+ */
+#define NAPPEND(p)                                                      \
+        (p->fts_path[p->fts_pathlen - 1] == '/'                         \
+            ? p->fts_pathlen - 1 : p->fts_pathlen)
+
+FTSENT *
+fts_read (register FTS *sp)
+{
+        register FTSENT *p, *tmp;
+        register unsigned short int instr;
+        register char *t;
+
+        /* If finished or unrecoverable error, return NULL. */
+        if (sp->fts_cur == NULL || ISSET(FTS_STOP))
+                return (NULL);
+
+        /* Set current node pointer. */
+        p = sp->fts_cur;
+
+        /* Save and zero out user instructions. */
+        instr = p->fts_instr;
+        p->fts_instr = FTS_NOINSTR;
+
+        /* Any type of file may be re-visited; re-stat and re-turn. */
+        if (instr == FTS_AGAIN) {
+                p->fts_info = fts_stat(sp, p, false);
+                return (p);
+        }
+        Dprintf (("fts_read: p=%s\n",
+                  p->fts_info == FTS_INIT ? "" : p->fts_path));
+
+        /*
+         * Following a symlink -- SLNONE test allows application to see
+         * SLNONE and recover.  If indirecting through a symlink, have
+         * keep a pointer to current location.  If unable to get that
+         * pointer, follow fails.
+         */
+        if (instr == FTS_FOLLOW &&
+            (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
+                p->fts_info = fts_stat(sp, p, true);
+                if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+                        if ((p->fts_symfd = diropen (sp, ".")) < 0) {
+                                p->fts_errno = errno;
+                                p->fts_info = FTS_ERR;
+                        } else
+                                p->fts_flags |= FTS_SYMFOLLOW;
+                }
+                goto check_for_dir;
+        }
+
+        /* Directory in pre-order. */
+        if (p->fts_info == FTS_D) {
+                /* If skipped or crossed mount point, do post-order visit. */
+                if (instr == FTS_SKIP ||
+                    (ISSET(FTS_XDEV) && p->fts_statp->st_dev != sp->fts_dev)) {
+                        if (p->fts_flags & FTS_SYMFOLLOW)
+                                (void)close(p->fts_symfd);
+                        if (sp->fts_child) {
+                                fts_lfree(sp->fts_child);
+                                sp->fts_child = NULL;
+                        }
+                        p->fts_info = FTS_DP;
+                        LEAVE_DIR (sp, p, "1");
+                        return (p);
+                }
+
+                /* Rebuild if only read the names and now traversing. */
+                if (sp->fts_child != NULL && ISSET(FTS_NAMEONLY)) {
+                        CLR(FTS_NAMEONLY);
+                        fts_lfree(sp->fts_child);
+                        sp->fts_child = NULL;
+                }
+
+                /*
+                 * Cd to the subdirectory.
+                 *
+                 * If have already read and now fail to chdir, whack the list
+                 * to make the names come out right, and set the parent errno
+                 * so the application will eventually get an error condition.
+                 * Set the FTS_DONTCHDIR flag so that when we logically change
+                 * directories back to the parent we don't do a chdir.
+                 *
+                 * If haven't read do so.  If the read fails, fts_build sets
+                 * FTS_STOP or the fts_info field of the node.
+                 */
+                if (sp->fts_child != NULL) {
+                        if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) {
+                                p->fts_errno = errno;
+                                p->fts_flags |= FTS_DONTCHDIR;
+                                for (p = sp->fts_child; p != NULL;
+                                     p = p->fts_link)
+                                        p->fts_accpath =
+                                            p->fts_parent->fts_accpath;
+                        }
+                } else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
+                        if (ISSET(FTS_STOP))
+                                return (NULL);
+                        /* If fts_build's call to fts_safe_changedir failed
+                           because it was not able to fchdir into a
+                           subdirectory, tell the caller.  */
+                        if (p->fts_errno && p->fts_info != FTS_DNR)
+                                p->fts_info = FTS_ERR;
+                        LEAVE_DIR (sp, p, "2");
+                        return (p);
+                }
+                p = sp->fts_child;
+                sp->fts_child = NULL;
+                goto name;
+        }
+
+        /* Move to the next node on this level. */
+next:   tmp = p;
+
+        /* If we have so many directory entries that we're reading them
+           in batches, and we've reached the end of the current batch,
+           read in a new batch.  */
+        if (p->fts_link == NULL && p->fts_parent->fts_dirp)
+          {
+            p = tmp->fts_parent;
+            sp->fts_cur = p;
+            sp->fts_path[p->fts_pathlen] = '\0';
+
+            if ((p = fts_build (sp, BREAD)) == NULL)
+              {
+                if (ISSET(FTS_STOP))
+                  return NULL;
+                goto cd_dot_dot;
+              }
+
+            free(tmp);
+            goto name;
+          }
+
+        if ((p = p->fts_link) != NULL) {
+                sp->fts_cur = p;
+                free(tmp);
+
+                /*
+                 * If reached the top, return to the original directory (or
+                 * the root of the tree), and load the file names for the next
+                 * root.
+                 */
+                if (p->fts_level == FTS_ROOTLEVEL) {
+                        if (restore_initial_cwd(sp)) {
+                                SET(FTS_STOP);
+                                return (NULL);
+                        }
+                        free_dir(sp);
+                        fts_load(sp, p);
+                        if (! setup_dir(sp)) {
+                                free_dir(sp);
+                                return (NULL);
+                        }
+                        goto check_for_dir;
+                }
+
+                /*
+                 * User may have called fts_set on the node.  If skipped,
+                 * ignore.  If followed, get a file descriptor so we can
+                 * get back if necessary.
+                 */
+                if (p->fts_instr == FTS_SKIP)
+                        goto next;
+                if (p->fts_instr == FTS_FOLLOW) {
+                        p->fts_info = fts_stat(sp, p, true);
+                        if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+                                if ((p->fts_symfd = diropen (sp, ".")) < 0) {
+                                        p->fts_errno = errno;
+                                        p->fts_info = FTS_ERR;
+                                } else
+                                        p->fts_flags |= FTS_SYMFOLLOW;
+                        }
+                        p->fts_instr = FTS_NOINSTR;
+                }
+
+name:           t = sp->fts_path + NAPPEND(p->fts_parent);
+                *t++ = '/';
+                memmove(t, p->fts_name, p->fts_namelen + 1);
+check_for_dir:
+                sp->fts_cur = p;
+                if (p->fts_info == FTS_NSOK)
+                  {
+                    if (p->fts_statp->st_size == FTS_STAT_REQUIRED)
+                      p->fts_info = fts_stat(sp, p, false);
+                    else
+                      fts_assert (p->fts_statp->st_size == FTS_NO_STAT_REQUIRED);
+                  }
+
+                if (p->fts_info == FTS_D)
+                  {
+                    /* Now that P->fts_statp is guaranteed to be valid,
+                       if this is a command-line directory, record its
+                       device number, to be used for FTS_XDEV.  */
+                    if (p->fts_level == FTS_ROOTLEVEL)
+                      sp->fts_dev = p->fts_statp->st_dev;
+                    Dprintf (("  entering: %s\n", p->fts_path));
+                    if (! enter_dir (sp, p))
+                      return NULL;
+                  }
+                return p;
+        }
+cd_dot_dot:
+
+        /* Move up to the parent node. */
+        p = tmp->fts_parent;
+        sp->fts_cur = p;
+        free(tmp);
+
+        if (p->fts_level == FTS_ROOTPARENTLEVEL) {
+                /*
+                 * Done; free everything up and set errno to 0 so the user
+                 * can distinguish between error and EOF.
+                 */
+                free(p);
+                __set_errno (0);
+                return (sp->fts_cur = NULL);
+        }
+
+        fts_assert (p->fts_info != FTS_NSOK);
+
+        /* NUL terminate the file name.  */
+        sp->fts_path[p->fts_pathlen] = '\0';
+
+        /*
+         * Return to the parent directory.  If at a root node, restore
+         * the initial working directory.  If we came through a symlink,
+         * go back through the file descriptor.  Otherwise, move up
+         * one level, via "..".
+         */
+        if (p->fts_level == FTS_ROOTLEVEL) {
+                if (restore_initial_cwd(sp)) {
+                        p->fts_errno = errno;
+                        SET(FTS_STOP);
+                }
+        } else if (p->fts_flags & FTS_SYMFOLLOW) {
+                if (FCHDIR(sp, p->fts_symfd)) {
+                        p->fts_errno = errno;
+                        SET(FTS_STOP);
+                }
+                (void)close(p->fts_symfd);
+        } else if (!(p->fts_flags & FTS_DONTCHDIR) &&
+                   fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
+                p->fts_errno = errno;
+                SET(FTS_STOP);
+        }
+
+        /* If the directory causes a cycle, preserve the FTS_DC flag and keep
+           the corresponding dev/ino pair in the hash table.  It is going to be
+           removed when leaving the original directory.  */
+        if (p->fts_info != FTS_DC) {
+                p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
+                if (p->fts_errno == 0)
+                        LEAVE_DIR (sp, p, "3");
+        }
+        return ISSET(FTS_STOP) ? NULL : p;
+}
+
+/*
+ * Fts_set takes the stream as an argument although it's not used in this
+ * implementation; it would be necessary if anyone wanted to add global
+ * semantics to fts using fts_set.  An error return is allowed for similar
+ * reasons.
+ */
+/* ARGSUSED */
+int
+fts_set(_GL_UNUSED FTS *sp, FTSENT *p, int instr)
+{
+        if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
+            instr != FTS_NOINSTR && instr != FTS_SKIP) {
+                __set_errno (EINVAL);
+                return (1);
+        }
+        p->fts_instr = instr;
+        return (0);
+}
+
+FTSENT *
+fts_children (register FTS *sp, int instr)
+{
+        register FTSENT *p;
+        int fd;
+
+        if (instr != 0 && instr != FTS_NAMEONLY) {
+                __set_errno (EINVAL);
+                return (NULL);
+        }
+
+        /* Set current node pointer. */
+        p = sp->fts_cur;
+
+        /*
+         * Errno set to 0 so user can distinguish empty directory from
+         * an error.
+         */
+        __set_errno (0);
+
+        /* Fatal errors stop here. */
+        if (ISSET(FTS_STOP))
+                return (NULL);
+
+        /* Return logical hierarchy of user's arguments. */
+        if (p->fts_info == FTS_INIT)
+                return (p->fts_link);
+
+        /*
+         * If not a directory being visited in pre-order, stop here.  Could
+         * allow FTS_DNR, assuming the user has fixed the problem, but the
+         * same effect is available with FTS_AGAIN.
+         */
+        if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
+                return (NULL);
+
+        /* Free up any previous child list. */
+        if (sp->fts_child != NULL)
+                fts_lfree(sp->fts_child);
+
+        if (instr == FTS_NAMEONLY) {
+                SET(FTS_NAMEONLY);
+                instr = BNAMES;
+        } else
+                instr = BCHILD;
+
+        /*
+         * If using chdir on a relative file name and called BEFORE fts_read
+         * does its chdir to the root of a traversal, we can lose -- we need to
+         * chdir into the subdirectory, and we don't know where the current
+         * directory is, so we can't get back so that the upcoming chdir by
+         * fts_read will work.
+         */
+        if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
+            ISSET(FTS_NOCHDIR))
+                return (sp->fts_child = fts_build(sp, instr));
+
+        if ((fd = diropen (sp, ".")) < 0)
+                return (sp->fts_child = NULL);
+        sp->fts_child = fts_build(sp, instr);
+        if (ISSET(FTS_CWDFD))
+          {
+            cwd_advance_fd (sp, fd, true);
+          }
+        else
+          {
+            if (fchdir(fd))
+              {
+                int saved_errno = errno;
+                close (fd);
+                __set_errno (saved_errno);
+                return NULL;
+              }
+            close (fd);
+          }
+        return (sp->fts_child);
+}
+
+/* A comparison function to sort on increasing inode number.
+   For some file system types, sorting either way makes a huge
+   performance difference for a directory with very many entries,
+   but sorting on increasing values is slightly better than sorting
+   on decreasing values.  The difference is in the 5% range.  */
+static int
+fts_compare_ino (struct _ftsent const **a, struct _ftsent const **b)
+{
+  return _GL_CMP (a[0]->fts_statp->st_ino, b[0]->fts_statp->st_ino);
+}
+
+/* Map the dirent.d_type value, DTYPE, to the corresponding stat.st_mode
+   S_IF* bit and set ST.st_mode, thus clearing all other bits in that field.  */
+static void
+set_stat_type (struct stat *st, unsigned int dtype)
+{
+  mode_t type;
+  switch (dtype)
+    {
+    case DT_BLK:
+      type = S_IFBLK;
+      break;
+    case DT_CHR:
+      type = S_IFCHR;
+      break;
+    case DT_DIR:
+      type = S_IFDIR;
+      break;
+    case DT_FIFO:
+      type = S_IFIFO;
+      break;
+    case DT_LNK:
+      type = S_IFLNK;
+      break;
+    case DT_REG:
+      type = S_IFREG;
+      break;
+    case DT_SOCK:
+      type = S_IFSOCK;
+      break;
+    default:
+      type = 0;
+    }
+  st->st_mode = type;
+}
+
+#define closedir_and_clear(dirp)                \
+  do                                            \
+    {                                           \
+      closedir (dirp);                          \
+      dirp = NULL;                              \
+    }                                           \
+  while (0)
+
+#define fts_opendir(file, Pdir_fd)                              \
+        opendirat((! ISSET(FTS_NOCHDIR) && ISSET(FTS_CWDFD)     \
+                   ? sp->fts_cwd_fd : AT_FDCWD),                \
+                  file,                                         \
+                  (((ISSET(FTS_PHYSICAL)                        \
+                     && ! (ISSET(FTS_COMFOLLOW)                 \
+                           && cur->fts_level == FTS_ROOTLEVEL)) \
+                    ? O_NOFOLLOW : 0)),                         \
+                  Pdir_fd)
+
+/*
+ * This is the tricky part -- do not casually change *anything* in here.  The
+ * idea is to build the linked list of entries that are used by fts_children
+ * and fts_read.  There are lots of special cases.
+ *
+ * The real slowdown in walking the tree is the stat calls.  If FTS_NOSTAT is
+ * set and it's a physical walk (so that symbolic links can't be directories),
+ * we can do things quickly.  First, if it's a 4.4BSD file system, the type
+ * of the file is in the directory entry.  Otherwise, we assume that the number
+ * of subdirectories in a node is equal to the number of links to the parent.
+ * The former skips all stat calls.  The latter skips stat calls in any leaf
+ * directories and for any files after the subdirectories in the directory have
+ * been found, cutting the stat calls by about 2/3.
+ */
+static FTSENT *
+internal_function
+fts_build (register FTS *sp, int type)
+{
+        register FTSENT *p, *head;
+        register size_t nitems;
+        FTSENT *tail;
+        int saved_errno;
+        bool descend;
+        bool doadjust;
+        ptrdiff_t level;
+        size_t len, maxlen, new_len;
+        char *cp;
+        int dir_fd;
+        FTSENT *cur = sp->fts_cur;
+        bool continue_readdir = !!cur->fts_dirp;
+        bool sort_by_inode = false;
+        size_t max_entries;
+
+        /* When cur->fts_dirp is non-NULL, that means we should
+           continue calling readdir on that existing DIR* pointer
+           rather than opening a new one.  */
+        if (continue_readdir)
+          {
+            DIR *dp = cur->fts_dirp;
+            dir_fd = dirfd (dp);
+            if (dir_fd < 0)
+              {
+                int dirfd_errno = errno;
+                closedir_and_clear (cur->fts_dirp);
+                if (type == BREAD)
+                  {
+                    cur->fts_info = FTS_DNR;
+                    cur->fts_errno = dirfd_errno;
+                  }
+                return NULL;
+              }
+          }
+        else
+          {
+            /* Open the directory for reading.  If this fails, we're done.
+               If being called from fts_read, set the fts_info field. */
+            if ((cur->fts_dirp = fts_opendir(cur->fts_accpath, &dir_fd)) == NULL)
+              {
+                if (type == BREAD)
+                  {
+                    cur->fts_info = FTS_DNR;
+                    cur->fts_errno = errno;
+                  }
+                return NULL;
+              }
+            /* Rather than calling fts_stat for each and every entry encountered
+               in the readdir loop (below), stat each directory only right after
+               opening it.  */
+            bool stat_optimization = cur->fts_info == FTS_NSOK;
+
+            if (stat_optimization
+                /* Also read the stat info again after opening a directory to
+                   reveal eventual changes caused by a submount triggered by
+                   the traversal.  But do it only for utilities which use
+                   FTS_TIGHT_CYCLE_CHECK.  Therefore, only find and du
+                   benefit/suffer from this feature for now.  */
+                || ISSET (FTS_TIGHT_CYCLE_CHECK))
+              {
+                if (!stat_optimization)
+                  LEAVE_DIR (sp, cur, "4");
+                if (fstat (dir_fd, cur->fts_statp) != 0)
+                  {
+                    int fstat_errno = errno;
+                    closedir_and_clear (cur->fts_dirp);
+                    if (type == BREAD)
+                      {
+                        cur->fts_errno = fstat_errno;
+                        cur->fts_info = FTS_NS;
+                      }
+                    __set_errno (fstat_errno);
+                    return NULL;
+                  }
+                if (stat_optimization)
+                  cur->fts_info = FTS_D;
+                else if (! enter_dir (sp, cur))
+                  {
+                    int err = errno;
+                    closedir_and_clear (cur->fts_dirp);
+                    __set_errno (err);
+                    return NULL;
+                  }
+              }
+          }
+
+        /* Maximum number of readdir entries to read at one time.  This
+           limitation is to avoid reading millions of entries into memory
+           at once.  When an fts_compar function is specified, we have no
+           choice: we must read all entries into memory before calling that
+           function.  But when no such function is specified, we can read
+           entries in batches that are large enough to help us with inode-
+           sorting, yet not so large that we risk exhausting memory.  */
+        max_entries = sp->fts_compar ? SIZE_MAX : FTS_MAX_READDIR_ENTRIES;
+
+        /*
+         * If we're going to need to stat anything or we want to descend
+         * and stay in the directory, chdir.  If this fails we keep going,
+         * but set a flag so we don't chdir after the post-order visit.
+         * We won't be able to stat anything, but we can still return the
+         * names themselves.  Note, that since fts_read won't be able to
+         * chdir into the directory, it will have to return different file
+         * names than before, i.e. "a/b" instead of "b".  Since the node
+         * has already been visited in pre-order, have to wait until the
+         * post-order visit to return the error.  There is a special case
+         * here, if there was nothing to stat then it's not an error to
+         * not be able to stat.  This is all fairly nasty.  If a program
+         * needed sorted entries or stat information, they had better be
+         * checking FTS_NS on the returned nodes.
+         */
+        if (continue_readdir)
+          {
+            /* When resuming a short readdir run, we already have
+               the required dirp and dir_fd.  */
+            descend = true;
+          }
+        else
+          {
+            /* Try to descend unless it is a names-only fts_children,
+               or the directory is known to lack subdirectories.  */
+            descend = (type != BNAMES
+                       && ! (ISSET (FTS_NOSTAT) && ISSET (FTS_PHYSICAL)
+                             && ! ISSET (FTS_SEEDOT)
+                             && cur->fts_statp->st_nlink == MIN_DIR_NLINK
+                             && (leaf_optimization (cur, dir_fd)
+                                 != NO_LEAF_OPTIMIZATION)));
+            if (descend || type == BREAD)
+              {
+                if (ISSET(FTS_CWDFD))
+                  dir_fd = fcntl (dir_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
+                if (dir_fd < 0 || fts_safe_changedir(sp, cur, dir_fd, NULL)) {
+                        if (descend && type == BREAD)
+                                cur->fts_errno = errno;
+                        cur->fts_flags |= FTS_DONTCHDIR;
+                        descend = false;
+                        closedir_and_clear(cur->fts_dirp);
+                        if (ISSET(FTS_CWDFD) && 0 <= dir_fd)
+                                close (dir_fd);
+                        cur->fts_dirp = NULL;
+                } else
+                        descend = true;
+              }
+          }
+
+        /*
+         * Figure out the max file name length that can be stored in the
+         * current buffer -- the inner loop allocates more space as necessary.
+         * We really wouldn't have to do the maxlen calculations here, we
+         * could do them in fts_read before returning the name, but it's a
+         * lot easier here since the length is part of the dirent structure.
+         *
+         * If not changing directories set a pointer so that can just append
+         * each new component into the file name.
+         */
+        len = NAPPEND(cur);
+        if (ISSET(FTS_NOCHDIR)) {
+                cp = sp->fts_path + len;
+                *cp++ = '/';
+        } else {
+                /* GCC, you're too verbose. */
+                cp = NULL;
+        }
+        len++;
+        maxlen = sp->fts_pathlen - len;
+
+        level = cur->fts_level + 1;
+
+        /* Read the directory, attaching each entry to the "link" pointer. */
+        doadjust = false;
+        head = NULL;
+        tail = NULL;
+        nitems = 0;
+        while (cur->fts_dirp) {
+                size_t d_namelen;
+                __set_errno (0);
+                struct dirent *dp = readdir(cur->fts_dirp);
+                if (dp == NULL) {
+                        if (errno) {
+                                cur->fts_errno = errno;
+                                /* If we've not read any items yet, treat
+                                   the error as if we can't access the dir.  */
+                                cur->fts_info = (continue_readdir || nitems)
+                                                ? FTS_ERR : FTS_DNR;
+                        }
+                        closedir_and_clear(cur->fts_dirp);
+                        break;
+                }
+                if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
+                        continue;
+
+                d_namelen = _D_EXACT_NAMLEN (dp);
+                p = fts_alloc (sp, dp->d_name, d_namelen);
+                if (!p)
+                        goto mem1;
+                if (d_namelen >= maxlen) {
+                        /* include space for NUL */
+                        uintptr_t oldaddr = (uintptr_t) sp->fts_path;
+                        if (! fts_palloc(sp, d_namelen + len + 1)) {
+                                /*
+                                 * No more memory.  Save
+                                 * errno, free up the current structure and the
+                                 * structures already allocated.
+                                 */
+mem1:                           saved_errno = errno;
+                                free(p);
+                                fts_lfree(head);
+                                closedir_and_clear(cur->fts_dirp);
+                                cur->fts_info = FTS_ERR;
+                                SET(FTS_STOP);
+                                __set_errno (saved_errno);
+                                return (NULL);
+                        }
+                        /* Did realloc() change the pointer? */
+                        if (oldaddr != (uintptr_t) sp->fts_path) {
+                                doadjust = true;
+                                if (ISSET(FTS_NOCHDIR))
+                                        cp = sp->fts_path + len;
+                        }
+                        maxlen = sp->fts_pathlen - len;
+                }
+
+                new_len = len + d_namelen;
+                if (new_len < len) {
+                        /*
+                         * In the unlikely event that we would end up
+                         * with a file name longer than SIZE_MAX, free up
+                         * the current structure and the structures already
+                         * allocated, then error out with ENAMETOOLONG.
+                         */
+                        free(p);
+                        fts_lfree(head);
+                        closedir_and_clear(cur->fts_dirp);
+                        cur->fts_info = FTS_ERR;
+                        SET(FTS_STOP);
+                        __set_errno (ENAMETOOLONG);
+                        return (NULL);
+                }
+                p->fts_level = level;
+                p->fts_parent = sp->fts_cur;
+                p->fts_pathlen = new_len;
+
+                /* Store dirent.d_ino, in case we need to sort
+                   entries before processing them.  */
+                p->fts_statp->st_ino = D_INO (dp);
+
+                /* Build a file name for fts_stat to stat. */
+                if (ISSET(FTS_NOCHDIR)) {
+                        p->fts_accpath = p->fts_path;
+                        memmove(cp, p->fts_name, p->fts_namelen + 1);
+                } else
+                        p->fts_accpath = p->fts_name;
+
+                if (sp->fts_compar == NULL || ISSET(FTS_DEFER_STAT)) {
+                        /* Record what fts_read will have to do with this
+                           entry. In many cases, it will simply fts_stat it,
+                           but we can take advantage of any d_type information
+                           to optimize away the unnecessary stat calls.  I.e.,
+                           if FTS_NOSTAT is in effect and we're not following
+                           symlinks (FTS_PHYSICAL) and d_type indicates this
+                           is *not* a directory, then we won't have to stat it
+                           at all.  If it *is* a directory, then (currently)
+                           we stat it regardless, in order to get device and
+                           inode numbers.  Some day we might optimize that
+                           away, too, for directories where d_ino is known to
+                           be valid.  */
+                        bool skip_stat = (ISSET(FTS_NOSTAT)
+                                          && DT_IS_KNOWN(dp)
+                                          && ! DT_MUST_BE(dp, DT_DIR)
+                                          && (ISSET(FTS_PHYSICAL)
+                                              || ! DT_MUST_BE(dp, DT_LNK)));
+                        p->fts_info = FTS_NSOK;
+                        /* Propagate dirent.d_type information back
+                           to caller, when possible.  */
+                        set_stat_type (p->fts_statp, D_TYPE (dp));
+                        fts_set_stat_required(p, !skip_stat);
+                } else {
+                        p->fts_info = fts_stat(sp, p, false);
+                }
+
+                /* We walk in directory order so "ls -f" doesn't get upset. */
+                p->fts_link = NULL;
+                if (head == NULL)
+                        head = tail = p;
+                else {
+                        tail->fts_link = p;
+                        tail = p;
+                }
+
+                /* If there are many entries, no sorting function has been
+                   specified, and this file system is of a type that may be
+                   slow with a large number of entries, arrange to sort the
+                   directory entries on increasing inode numbers.
+
+                   The NITEMS comparison uses ==, not >, because the test
+                   needs to be tried at most once once, and NITEMS will exceed
+                   the threshold after it is incremented below.  */
+                if (nitems == _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD
+                    && !sp->fts_compar)
+                  sort_by_inode = dirent_inode_sort_may_be_useful (cur, dir_fd);
+
+                ++nitems;
+                if (max_entries <= nitems) {
+                        /* When there are too many dir entries, leave
+                           fts_dirp open, so that a subsequent fts_read
+                           can take up where we leave off.  */
+                        break;
+                }
+        }
+
+        /*
+         * If realloc() changed the address of the file name, adjust the
+         * addresses for the rest of the tree and the dir list.
+         */
+        if (doadjust)
+                fts_padjust(sp, head);
+
+        /*
+         * If not changing directories, reset the file name back to original
+         * state.
+         */
+        if (ISSET(FTS_NOCHDIR)) {
+                if (len == sp->fts_pathlen || nitems == 0)
+                        --cp;
+                *cp = '\0';
+        }
+
+        /*
+         * If descended after called from fts_children or after called from
+         * fts_read and nothing found, get back.  At the root level we use
+         * the saved fd; if one of fts_open()'s arguments is a relative name
+         * to an empty directory, we wind up here with no other way back.  If
+         * can't get back, we're done.
+         */
+        if (!continue_readdir && descend && (type == BCHILD || !nitems) &&
+            (cur->fts_level == FTS_ROOTLEVEL
+             ? restore_initial_cwd(sp)
+             : fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
+                cur->fts_info = FTS_ERR;
+                SET(FTS_STOP);
+                fts_lfree(head);
+                return (NULL);
+        }
+
+        /* If didn't find anything, return NULL. */
+        if (!nitems) {
+                if (type == BREAD
+                    && cur->fts_info != FTS_DNR && cur->fts_info != FTS_ERR)
+                        cur->fts_info = FTS_DP;
+                fts_lfree(head);
+                return (NULL);
+        }
+
+        if (sort_by_inode) {
+                sp->fts_compar = fts_compare_ino;
+                head = fts_sort (sp, head, nitems);
+                sp->fts_compar = NULL;
+        }
+
+        /* Sort the entries. */
+        if (sp->fts_compar && nitems > 1)
+                head = fts_sort(sp, head, nitems);
+        return (head);
+}
+
+#if GNULIB_FTS_DEBUG
+
+struct devino {
+  intmax_t dev, ino;
+};
+#define PRINT_DEVINO "(%jd,%jd)"
+
+static struct devino
+getdevino (int fd)
+{
+  struct stat st;
+  return (fd == AT_FDCWD
+          ? (struct devino) { -1, 0 }
+          : fstat (fd, &st) == 0
+          ? (struct devino) { st.st_dev, st.st_ino }
+          : (struct devino) { -1, errno });
+}
+
+/* Walk ->fts_parent links starting at E_CURR, until the root of the
+   current hierarchy.  There should be a directory with dev/inode
+   matching those of AD.  If not, print a lot of diagnostics.  */
+static void
+find_matching_ancestor (FTSENT const *e_curr, struct Active_dir const *ad)
+{
+  FTSENT const *ent;
+  for (ent = e_curr; ent->fts_level >= FTS_ROOTLEVEL; ent = ent->fts_parent)
+    {
+      if (ad->ino == ent->fts_statp->st_ino
+          && ad->dev == ent->fts_statp->st_dev)
+        return;
+    }
+  printf ("ERROR: tree dir, %s, not active\n", ad->fts_ent->fts_accpath);
+  printf ("active dirs:\n");
+  for (ent = e_curr;
+       ent->fts_level >= FTS_ROOTLEVEL; ent = ent->fts_parent)
+    printf ("  %s(%"PRIuMAX"/%"PRIuMAX") to %s(%"PRIuMAX"/%"PRIuMAX")...\n",
+            ad->fts_ent->fts_accpath,
+            (uintmax_t) ad->dev,
+            (uintmax_t) ad->ino,
+            ent->fts_accpath,
+            (uintmax_t) ent->fts_statp->st_dev,
+            (uintmax_t) ent->fts_statp->st_ino);
+}
+
+void
+fts_cross_check (FTS const *sp)
+{
+  FTSENT const *ent = sp->fts_cur;
+  FTSENT const *t;
+  if ( ! ISSET (FTS_TIGHT_CYCLE_CHECK))
+    return;
+
+  Dprintf (("fts-cross-check cur=%s\n", ent->fts_path));
+  /* Make sure every parent dir is in the tree.  */
+  for (t = ent->fts_parent; t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
+    {
+      struct Active_dir ad;
+      ad.ino = t->fts_statp->st_ino;
+      ad.dev = t->fts_statp->st_dev;
+      if ( ! hash_lookup (sp->fts_cycle.ht, &ad))
+        printf ("ERROR: active dir, %s, not in tree\n", t->fts_path);
+    }
+
+  /* Make sure every dir in the tree is an active dir.
+     But ENT is not necessarily a directory.  If so, just skip this part. */
+  if (ent->fts_parent->fts_level >= FTS_ROOTLEVEL
+      && (ent->fts_info == FTS_DP
+          || ent->fts_info == FTS_D))
+    {
+      struct Active_dir *ad;
+      for (ad = hash_get_first (sp->fts_cycle.ht); ad != NULL;
+           ad = hash_get_next (sp->fts_cycle.ht, ad))
+        {
+          find_matching_ancestor (ent, ad);
+        }
+    }
+}
+
+static bool
+same_fd (int fd1, int fd2)
+{
+  struct stat sb1, sb2;
+  return (fstat (fd1, &sb1) == 0
+          && fstat (fd2, &sb2) == 0
+          && psame_inode (&sb1, &sb2));
+}
+
+static void
+fd_ring_print (FTS const *sp, FILE *stream, char const *msg)
+{
+  if (!fts_debug)
+    return;
+  I_ring const *fd_ring = &sp->fts_fd_ring;
+  unsigned int i = fd_ring->ir_front;
+  struct devino cwd = getdevino (sp->fts_cwd_fd);
+  fprintf (stream, "=== %s ========== "PRINT_DEVINO"\n", msg, cwd.dev, cwd.ino);
+  if (i_ring_empty (fd_ring))
+    return;
+
+  while (true)
+    {
+      int fd = fd_ring->ir_data[i];
+      if (fd < 0)
+        fprintf (stream, "%u: %d:\n", i, fd);
+      else
+        {
+          struct devino wd = getdevino (fd);
+          fprintf (stream, "%u: %d: "PRINT_DEVINO"\n", i, fd, wd.dev, wd.ino);
+        }
+      if (i == fd_ring->ir_back)
+        break;
+      i = (i + I_RING_SIZE - 1) % I_RING_SIZE;
+    }
+}
+
+/* Ensure that each file descriptor on the fd_ring matches a
+   parent, grandparent, etc. of the current working directory.  */
+static void
+fd_ring_check (FTS const *sp)
+{
+  if (!fts_debug)
+    return;
+
+  /* Make a writable copy.  */
+  I_ring fd_w = sp->fts_fd_ring;
+
+  int cwd_fd = sp->fts_cwd_fd;
+  cwd_fd = fcntl (cwd_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
+  struct devino dot = getdevino (cwd_fd);
+  fprintf (stderr, "===== check ===== cwd: "PRINT_DEVINO"\n",
+           dot.dev, dot.ino);
+  while ( ! i_ring_empty (&fd_w))
+    {
+      int fd = i_ring_pop (&fd_w);
+      if (0 <= fd)
+        {
+          int open_flags = O_SEARCH | O_CLOEXEC;
+          int parent_fd = openat (cwd_fd, "..", open_flags);
+          if (parent_fd < 0)
+            {
+              // Warn?
+              break;
+            }
+          if (!same_fd (fd, parent_fd))
+            {
+              struct devino cwd = getdevino (fd);
+              fprintf (stderr, "ring  : "PRINT_DEVINO"\n", cwd.dev, cwd.ino);
+              struct devino c2 = getdevino (parent_fd);
+              fprintf (stderr, "parent: "PRINT_DEVINO"\n", c2.dev, c2.ino);
+              fts_assert (0);
+            }
+          close (cwd_fd);
+          cwd_fd = parent_fd;
+        }
+    }
+  close (cwd_fd);
+}
+#endif
+
+static unsigned short int
+internal_function
+fts_stat(FTS *sp, register FTSENT *p, bool follow)
+{
+        struct stat *sbp = p->fts_statp;
+
+        if (ISSET (FTS_LOGICAL)
+            || (ISSET (FTS_COMFOLLOW) && p->fts_level == FTS_ROOTLEVEL))
+                follow = true;
+
+        /*
+         * If doing a logical walk, or application requested FTS_FOLLOW, do
+         * a stat(2).  If that fails, check for a nonexistent symlink.  If
+         * fail, set the errno from the stat call.
+         */
+        int flags = follow ? 0 : AT_SYMLINK_NOFOLLOW;
+        if (fstatat (sp->fts_cwd_fd, p->fts_accpath, sbp, flags) < 0)
+          {
+            if (follow && errno == ENOENT
+                && 0 <= fstatat (sp->fts_cwd_fd, p->fts_accpath, sbp,
+                                 AT_SYMLINK_NOFOLLOW))
+              {
+                __set_errno (0);
+                return FTS_SLNONE;
+              }
+
+            p->fts_errno = errno;
+            memset (sbp, 0, sizeof *sbp);
+            return FTS_NS;
+          }
+
+        if (S_ISDIR(sbp->st_mode)) {
+                if (ISDOT(p->fts_name)) {
+                        /* Command-line "." and ".." are real directories. */
+                        return (p->fts_level == FTS_ROOTLEVEL ? FTS_D : FTS_DOT);
+                }
+
+                return (FTS_D);
+        }
+        if (S_ISLNK(sbp->st_mode))
+                return (FTS_SL);
+        if (S_ISREG(sbp->st_mode))
+                return (FTS_F);
+        return (FTS_DEFAULT);
+}
+
+static int
+fts_compar (void const *a, void const *b)
+{
+  /* Convert A and B to the correct types, to pacify the compiler, and
+     for portability to bizarre hosts where "void const *" and "FTSENT
+     const **" differ in runtime representation.  The comparison
+     function cannot modify *a and *b, but there is no compile-time
+     check for this.  */
+  FTSENT const **pa = (FTSENT const **) a;
+  FTSENT const **pb = (FTSENT const **) b;
+  return pa[0]->fts_fts->fts_compar (pa, pb);
+}
+
+static FTSENT *
+internal_function
+fts_sort (FTS *sp, FTSENT *head, register size_t nitems)
+{
+        register FTSENT **ap, *p;
+
+        /* On most modern hosts, void * and FTSENT ** have the same
+           run-time representation, and one can convert sp->fts_compar to
+           the type qsort expects without problem.  Use the heuristic that
+           this is OK if the two pointer types are the same size, and if
+           converting FTSENT ** to long int is the same as converting
+           FTSENT ** to void * and then to long int.  This heuristic isn't
+           valid in general but we don't know of any counterexamples.  */
+        FTSENT *dummy;
+        int (*compare) (void const *, void const *) =
+          ((sizeof &dummy == sizeof (void *)
+            && (long int) &dummy == (long int) (void *) &dummy)
+           ? (int (*) (void const *, void const *)) sp->fts_compar
+           : fts_compar);
+
+        /*
+         * Construct an array of pointers to the structures and call qsort(3).
+         * Reassemble the array in the order returned by qsort.  If unable to
+         * sort for memory reasons, return the directory entries in their
+         * current order.  Allocate enough space for the current needs plus
+         * 40 so don't realloc one entry at a time.
+         */
+        if (nitems > sp->fts_nitems) {
+                FTSENT **a;
+
+                sp->fts_nitems = nitems + 40;
+                if (SIZE_MAX / sizeof *a < sp->fts_nitems
+                    || ! (a = realloc (sp->fts_array,
+                                       sp->fts_nitems * sizeof *a))) {
+                        free(sp->fts_array);
+                        sp->fts_array = NULL;
+                        sp->fts_nitems = 0;
+                        return (head);
+                }
+                sp->fts_array = a;
+        }
+        for (ap = sp->fts_array, p = head; p; p = p->fts_link)
+                *ap++ = p;
+        qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), compare);
+        for (head = *(ap = sp->fts_array); --nitems; ++ap)
+                ap[0]->fts_link = ap[1];
+        ap[0]->fts_link = NULL;
+        return (head);
+}
+
+static FTSENT *
+internal_function
+fts_alloc (FTS *sp, const char *name, register size_t namelen)
+{
+        register FTSENT *p;
+        size_t len;
+
+        /*
+         * The file name is a variable length array.  Allocate the FTSENT
+         * structure and the file name in one chunk.
+         */
+        len = FLEXSIZEOF(FTSENT, fts_name, namelen + 1);
+        if ((p = malloc(len)) == NULL)
+                return (NULL);
+
+        /* Copy the name and guarantee NUL termination. */
+        memcpy(p->fts_name, name, namelen);
+        p->fts_name[namelen] = '\0';
+
+        p->fts_namelen = namelen;
+        p->fts_fts = sp;
+        p->fts_path = sp->fts_path;
+        p->fts_errno = 0;
+        p->fts_dirp = NULL;
+        p->fts_flags = 0;
+        p->fts_instr = FTS_NOINSTR;
+        p->fts_number = 0;
+        p->fts_pointer = NULL;
+        return (p);
+}
+
+static void
+internal_function
+fts_lfree (register FTSENT *head)
+{
+        register FTSENT *p;
+        int err = errno;
+
+        /* Free a linked list of structures. */
+        while ((p = head)) {
+                head = head->fts_link;
+                if (p->fts_dirp)
+                        closedir (p->fts_dirp);
+                free(p);
+        }
+
+        __set_errno (err);
+}
+
+/*
+ * Allow essentially unlimited file name lengths; find, rm, ls should
+ * all work on any tree.  Most systems will allow creation of file
+ * names much longer than MAXPATHLEN, even though the kernel won't
+ * resolve them.  Add the size (not just what's needed) plus 256 bytes
+ * so don't realloc the file name 2 bytes at a time.
+ */
+static bool
+internal_function
+fts_palloc (FTS *sp, size_t more)
+{
+        char *p;
+        size_t new_len = sp->fts_pathlen + more + 256;
+
+        /*
+         * See if fts_pathlen would overflow.
+         */
+        if (new_len < sp->fts_pathlen) {
+                free(sp->fts_path);
+                sp->fts_path = NULL;
+                __set_errno (ENAMETOOLONG);
+                return false;
+        }
+        sp->fts_pathlen = new_len;
+        p = realloc(sp->fts_path, sp->fts_pathlen);
+        if (p == NULL) {
+                free(sp->fts_path);
+                sp->fts_path = NULL;
+                return false;
+        }
+        sp->fts_path = p;
+        return true;
+}
+
+/*
+ * When the file name is realloc'd, have to fix all of the pointers in
+ *  structures already returned.
+ */
+static void
+internal_function
+fts_padjust (FTS *sp, FTSENT *head)
+{
+        FTSENT *p;
+        char *addr = sp->fts_path;
+
+        /* This code looks at bit-patterns of freed pointers to
+           relocate them, so it relies on undefined behavior.  If this
+           trick does not work on your platform, please report a bug.  */
+
+#define ADJUST(p) do {                                                  \
+        uintptr_t old_accpath = (uintptr_t) (p)->fts_accpath;           \
+        if (old_accpath != (uintptr_t) (p)->fts_name) {                 \
+                (p)->fts_accpath =                                      \
+                  addr + (old_accpath - (uintptr_t) (p)->fts_path);     \
+        }                                                               \
+        (p)->fts_path = addr;                                           \
+} while (0)
+        /* Adjust the current set of children. */
+        for (p = sp->fts_child; p; p = p->fts_link)
+                ADJUST(p);
+
+        /* Adjust the rest of the tree, including the current level. */
+        for (p = head; p->fts_level >= FTS_ROOTLEVEL;) {
+                ADJUST(p);
+                p = p->fts_link ? p->fts_link : p->fts_parent;
+        }
+}
+
+static size_t
+internal_function _GL_ATTRIBUTE_PURE
+fts_maxarglen (char * const *argv)
+{
+        size_t len, max;
+
+        for (max = 0; *argv; ++argv)
+                if ((len = strlen(*argv)) > max)
+                        max = len;
+        return (max + 1);
+}
+
+/*
+ * Change to dir specified by fd or file name without getting
+ * tricked by someone changing the world out from underneath us.
+ * Assumes p->fts_statp->st_dev and p->fts_statp->st_ino are filled in.
+ * If FD is non-negative, expect it to be used after this function returns,
+ * and to be closed eventually.  So don't pass e.g., 'dirfd(dirp)' and then
+ * do closedir(dirp), because that would invalidate the saved FD.
+ * Upon failure, close FD immediately and return nonzero.
+ */
+static int
+internal_function
+fts_safe_changedir (FTS *sp, FTSENT *p, int fd, char const *dir)
+{
+        int ret;
+        bool is_dotdot = dir && STREQ (dir, "..");
+        int newfd;
+
+        /* This clause handles the unusual case in which FTS_NOCHDIR
+           is specified, along with FTS_CWDFD.  In that case, there is
+           no need to change even the virtual cwd file descriptor.
+           However, if FD is non-negative, we do close it here.  */
+        if (ISSET (FTS_NOCHDIR))
+          {
+            if (ISSET (FTS_CWDFD) && 0 <= fd)
+              close (fd);
+            return 0;
+          }
+
+        if (fd < 0 && is_dotdot && ISSET (FTS_CWDFD))
+          {
+            /* When possible, skip the diropen and subsequent fstat+dev/ino
+               comparison.  I.e., when changing to parent directory
+               (chdir ("..")), use a file descriptor from the ring and
+               save the overhead of diropen+fstat, as well as avoiding
+               failure when we lack "x" access to the virtual cwd.  */
+            if ( ! i_ring_empty (&sp->fts_fd_ring))
+              {
+                int parent_fd;
+                fd_ring_print (sp, stderr, "pre-pop");
+                parent_fd = i_ring_pop (&sp->fts_fd_ring);
+                if (0 <= parent_fd)
+                  {
+                    fd = parent_fd;
+                    dir = NULL;
+                  }
+              }
+          }
+
+        newfd = fd;
+        if (fd < 0 && (newfd = diropen (sp, dir)) < 0)
+          return -1;
+
+        /* The following dev/inode check is necessary if we're doing a
+           "logical" traversal (through symlinks, a la chown -L), if the
+           system lacks O_NOFOLLOW support, or if we're changing to ".."
+           (but not via a popped file descriptor).  When changing to the
+           name "..", O_NOFOLLOW can't help.  In general, when the target is
+           not "..", diropen's use of O_NOFOLLOW ensures we don't mistakenly
+           follow a symlink, so we can avoid the expense of this fstat.  */
+        if (ISSET(FTS_LOGICAL) || ! HAVE_WORKING_O_NOFOLLOW
+            || (dir && STREQ (dir, "..")))
+          {
+            struct stat sb;
+            if (fstat(newfd, &sb))
+              {
+                ret = -1;
+                goto bail;
+              }
+            if (p->fts_statp->st_dev != sb.st_dev
+                || p->fts_statp->st_ino != sb.st_ino)
+              {
+                __set_errno (ENOENT);           /* disinformation */
+                ret = -1;
+                goto bail;
+              }
+          }
+
+        if (ISSET(FTS_CWDFD))
+          {
+            cwd_advance_fd (sp, newfd, ! is_dotdot);
+            return 0;
+          }
+
+        ret = fchdir(newfd);
+bail:
+        if (fd < 0)
+          {
+            int oerrno = errno;
+            (void)close(newfd);
+            __set_errno (oerrno);
+          }
+        return ret;
+}
deleted file mode 120000 (symlink)
index 9e62c479c3189af34d28fae9900b6dfd3481c956..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/fts_.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..00ea3f179f8839bcefce4acc8fee0fb42c9eca4a
--- /dev/null
@@ -0,0 +1,280 @@
+/* Traverse a file hierarchy.
+
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/*
+ * Copyright (c) 1989, 1993
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *      @(#)fts.h       8.3 (Berkeley) 8/14/94
+ */
+
+#ifndef _FTS_H
+# define _FTS_H 1
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_NODISCARD.  */
+# if !_LIBC && !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# ifdef _LIBC
+#  include <features.h>
+#  if __STDC_VERSION__ < 199901L
+#   define __FLEXIBLE_ARRAY_MEMBER 1
+#  else
+#   define __FLEXIBLE_ARRAY_MEMBER
+#  endif
+# else
+#  define __FLEXIBLE_ARRAY_MEMBER FLEXIBLE_ARRAY_MEMBER
+#  undef __THROW
+#  define __THROW
+#  undef __BEGIN_DECLS
+#  undef __END_DECLS
+#  ifdef __cplusplus
+#   define __BEGIN_DECLS extern "C" {
+#   define __END_DECLS }
+#  else
+#   define __BEGIN_DECLS
+#   define __END_DECLS
+#  endif
+# endif
+
+# include <stddef.h>
+# include <sys/types.h>
+# include <dirent.h>
+# include <sys/stat.h>
+# include "i-ring.h"
+
+typedef struct {
+        struct _ftsent *fts_cur;        /* current node */
+        struct _ftsent *fts_child;      /* linked list of children */
+        struct _ftsent **fts_array;     /* sort array */
+        dev_t fts_dev;                  /* starting device # */
+        char *fts_path;                 /* file name for this descent */
+        int fts_rfd;                    /* fd for root */
+        int fts_cwd_fd;                 /* the file descriptor on which the
+                                           virtual cwd is open, or AT_FDCWD */
+        size_t fts_pathlen;             /* sizeof(path) */
+        size_t fts_nitems;              /* elements in the sort array */
+        int (*fts_compar) (struct _ftsent const **, struct _ftsent const **);
+                                        /* compare fn */
+
+# define FTS_COMFOLLOW  0x0001          /* follow command line symlinks */
+# define FTS_LOGICAL    0x0002          /* logical walk */
+# define FTS_NOCHDIR    0x0004          /* don't change directories */
+# define FTS_NOSTAT     0x0008          /* don't get stat info */
+# define FTS_PHYSICAL   0x0010          /* physical walk */
+# define FTS_SEEDOT     0x0020          /* return dot and dot-dot */
+# define FTS_XDEV       0x0040          /* don't cross devices */
+# define FTS_WHITEOUT   0x0080          /* return whiteout information */
+
+  /* There are two ways to detect cycles.
+     The lazy way (which works only with FTS_PHYSICAL),
+     with which one may process a directory that is a
+     part of the cycle several times before detecting the cycle.
+     The "tight" way, whereby fts uses more memory (proportional
+     to number of "active" directories, aka distance from root
+     of current tree to current directory -- see active_dir_ht)
+     to detect any cycle right away.  For example, du must use
+     this option to avoid counting disk space in a cycle multiple
+     times, but chown -R need not.
+     The default is to use the constant-memory lazy way, when possible
+     (see below).
+
+     However, with FTS_LOGICAL (when following symlinks, e.g., chown -L)
+     using lazy cycle detection is inadequate.  For example, traversing
+     a directory containing a symbolic link to a peer directory, it is
+     possible to encounter the same directory twice even though there
+     is no cycle:
+     dir
+     ...
+     slink -> dir
+     So, when FTS_LOGICAL is selected, we have to use a different
+     mode of cycle detection: FTS_TIGHT_CYCLE_CHECK.  */
+# define FTS_TIGHT_CYCLE_CHECK  0x0100
+
+  /* Use this flag to enable semantics with which the parent
+     application may be made both more efficient and more robust.
+     Whereas the default is to visit each directory in a recursive
+     traversal (via chdir), using this flag makes it so the initial
+     working directory is never changed.  Instead, these functions
+     perform the traversal via a virtual working directory, maintained
+     through the file descriptor member, fts_cwd_fd.  */
+# define FTS_CWDFD              0x0200
+
+  /* Historically, for each directory that fts initially encounters, it would
+     open it, read all entries, and stat each entry, storing the results, and
+     then it would process the first entry.  But that behavior is bad for
+     locality of reference, and also causes trouble with inode-simulating
+     file systems like FAT, CIFS, FUSE-based ones, etc., when entries from
+     their name/inode cache are flushed too early.
+     Use this flag to make fts_open and fts_read defer the stat/lstat/fststat
+     of each entry until it is actually processed.  However, note that if you
+     use this option and also specify a comparison function, that function may
+     not examine any data via fts_statp.  However, when fts_statp->st_mode is
+     nonzero, the S_IFMT type bits are valid, with mapped dirent.d_type data.
+     Of course, that happens only on file systems that provide useful
+     dirent.d_type data.  */
+# define FTS_DEFER_STAT         0x0400
+
+  /* Use this flag to disable stripping of trailing slashes
+     from input path names during fts_open initialization.  */
+# define FTS_VERBATIM   0x0800
+
+# define FTS_OPTIONMASK 0x0fff          /* valid user option mask */
+
+# define FTS_NAMEONLY   0x1000          /* (private) child names only */
+# define FTS_STOP       0x2000          /* (private) unrecoverable error */
+        int fts_options;                /* fts_open options, global flags */
+
+        /* Map a directory's device number to a boolean.  The boolean is
+           true if for that file system (type determined by a single fstatfs
+           call per FS) st_nlink can be used to calculate the number of
+           sub-directory entries in a directory.
+           Using this table is an optimization that permits us to look up
+           file system type on a per-inode basis at the minimal cost of
+           calling fstatfs only once per traversed device.  */
+        struct hash_table *fts_leaf_optimization_works_ht;
+
+        union {
+                /* This data structure is used if FTS_TIGHT_CYCLE_CHECK is
+                   specified.  It records the directories between a starting
+                   point and the current directory.  I.e., a directory is
+                   recorded here IFF we have visited it once, but we have not
+                   yet completed processing of all its entries.  Every time we
+                   visit a new directory, we add that directory to this set.
+                   When we finish with a directory (usually by visiting it a
+                   second time), we remove it from this set.  Each entry in
+                   this data structure is a device/inode pair.  This data
+                   structure is used to detect directory cycles efficiently and
+                   promptly even when the depth of a hierarchy is in the tens
+                   of thousands.  */
+                struct hash_table *ht;
+
+                /* FIXME: rename these two members to have the fts_ prefix */
+                /* This data structure uses a lazy cycle-detection algorithm,
+                   as done by rm via cycle-check.c.  It's the default,
+                   but it's not appropriate for programs like du.  */
+                struct cycle_check_state *state;
+        } fts_cycle;
+
+        /* A stack of the file descriptors corresponding to the
+           most-recently traversed parent directories.
+           Currently used only in FTS_CWDFD mode.  */
+        I_ring fts_fd_ring;
+} FTS;
+
+typedef struct _ftsent {
+        struct _ftsent *fts_cycle;      /* cycle node */
+        struct _ftsent *fts_parent;     /* parent directory */
+        struct _ftsent *fts_link;       /* next file in directory */
+        DIR *fts_dirp;                  /* Dir pointer for any directory
+                                           containing more entries than we
+                                           read at one time.  */
+        long fts_number;                /* local numeric value */
+        void *fts_pointer;              /* local address value */
+        char *fts_accpath;              /* access file name */
+        char *fts_path;                 /* root name; == fts_fts->fts_path */
+        int fts_errno;                  /* errno for this node */
+        int fts_symfd;                  /* fd for symlink */
+        size_t fts_pathlen;             /* strlen(fts_path) */
+
+        FTS *fts_fts;                   /* the file hierarchy itself */
+
+# define FTS_ROOTPARENTLEVEL    (-1)
+# define FTS_ROOTLEVEL           0
+        ptrdiff_t fts_level;            /* depth (-1 to N) */
+
+        size_t fts_namelen;             /* strlen(fts_name) */
+
+# define FTS_D           1              /* preorder directory */
+# define FTS_DC          2              /* directory that causes cycles */
+# define FTS_DEFAULT     3              /* none of the above */
+# define FTS_DNR         4              /* unreadable directory */
+# define FTS_DOT         5              /* dot or dot-dot */
+# define FTS_DP          6              /* postorder directory */
+# define FTS_ERR         7              /* error; errno is set */
+# define FTS_F           8              /* regular file */
+# define FTS_INIT        9              /* initialized only */
+# define FTS_NS         10              /* stat(2) failed */
+# define FTS_NSOK       11              /* no stat(2) requested */
+# define FTS_SL         12              /* symbolic link */
+# define FTS_SLNONE     13              /* symbolic link without target */
+# define FTS_W          14              /* whiteout object */
+        unsigned short int fts_info;    /* user flags for FTSENT structure */
+
+# define FTS_DONTCHDIR   0x01           /* don't chdir .. to the parent */
+# define FTS_SYMFOLLOW   0x02           /* followed a symlink to get here */
+        unsigned short int fts_flags;   /* private flags for FTSENT structure */
+
+# define FTS_AGAIN       1              /* read node again */
+# define FTS_FOLLOW      2              /* follow symbolic link */
+# define FTS_NOINSTR     3              /* no instructions */
+# define FTS_SKIP        4              /* discard node */
+        unsigned short int fts_instr;   /* fts_set() instructions */
+
+        struct stat fts_statp[1];       /* stat(2) information */
+        char fts_name[__FLEXIBLE_ARRAY_MEMBER]; /* file name */
+} FTSENT;
+
+__BEGIN_DECLS
+
+ _GL_ATTRIBUTE_NODISCARD
+FTSENT  *fts_children (FTS *, int) __THROW;
+
+_GL_ATTRIBUTE_NODISCARD
+int      fts_close (FTS *) __THROW;
+
+_GL_ATTRIBUTE_NODISCARD
+FTS     *fts_open (char * const *, int,
+                   int (*)(const FTSENT **, const FTSENT **))
+  _GL_ATTRIBUTE_DEALLOC (fts_close, 1) __THROW;
+
+_GL_ATTRIBUTE_NODISCARD
+FTSENT  *fts_read (FTS *) __THROW;
+
+int      fts_set (FTS *, FTSENT *, int) __THROW;
+
+#if GNULIB_FTS_DEBUG
+void     fts_cross_check (FTS const *);
+#endif
+__END_DECLS
+
+#endif /* fts.h */
deleted file mode 120000 (symlink)
index b50ad225f2a5e82c818a32fd20d38f3efc81a217..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/full-read.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9ef498c54b79242534d7a39ae608d7b5b57b4cca
--- /dev/null
@@ -0,0 +1,18 @@
+/* An interface to read that retries after partial reads and interrupts.
+   Copyright (C) 2002-2003, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define FULL_READ
+#include "full-write.c"
deleted file mode 120000 (symlink)
index 538bdd0645c664eaaa11b80a12cc8df857367131..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/full-read.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5f73a19ae978394d9712bfd7213f60c7f2686373
--- /dev/null
@@ -0,0 +1,23 @@
+/* An interface to read() that reads all it is asked to read.
+
+   Copyright (C) 2002, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+
+/* Read COUNT bytes at BUF to descriptor FD, retrying if interrupted
+   or if partial reads occur.  Return the number of bytes successfully
+   read, setting errno if that is less than COUNT.  errno = 0 means EOF.  */
+extern size_t full_read (int fd, void *buf, size_t count);
deleted file mode 120000 (symlink)
index 8a7f1eb7ede288a4651b0f86c4774739c889516a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/full-write.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8e27b9c13441ef5830ded69f1cb6057239a22daa
--- /dev/null
@@ -0,0 +1,79 @@
+/* An interface to read and write that retries (if necessary) until complete.
+
+   Copyright (C) 1993-1994, 1997-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#ifdef FULL_READ
+# include "full-read.h"
+#else
+# include "full-write.h"
+#endif
+
+#include <errno.h>
+
+#ifdef FULL_READ
+# include "safe-read.h"
+# define safe_rw safe_read
+# define full_rw full_read
+# undef const
+# define const /* empty */
+#else
+# include "safe-write.h"
+# define safe_rw safe_write
+# define full_rw full_write
+#endif
+
+#ifdef FULL_READ
+/* Set errno to zero upon EOF.  */
+# define ZERO_BYTE_TRANSFER_ERRNO 0
+#else
+/* Some buggy drivers return 0 when one tries to write beyond
+   a device's end.  (Example: Linux 1.2.13 on /dev/fd0.)
+   Set errno to ENOSPC so they get a sensible diagnostic.  */
+# define ZERO_BYTE_TRANSFER_ERRNO ENOSPC
+#endif
+
+/* Write(read) COUNT bytes at BUF to(from) descriptor FD, retrying if
+   interrupted or if a partial write(read) occurs.  Return the number
+   of bytes transferred.
+   When writing, set errno if fewer than COUNT bytes are written.
+   When reading, if fewer than COUNT bytes are read, you must examine
+   errno to distinguish failure from EOF (errno == 0).  */
+size_t
+full_rw (int fd, const void *buf, size_t count)
+{
+  size_t total = 0;
+  const char *ptr = (const char *) buf;
+
+  while (count > 0)
+    {
+      size_t n_rw = safe_rw (fd, ptr, count);
+      if (n_rw == (size_t) -1)
+        break;
+      if (n_rw == 0)
+        {
+          errno = ZERO_BYTE_TRANSFER_ERRNO;
+          break;
+        }
+      total += n_rw;
+      ptr += n_rw;
+      count -= n_rw;
+    }
+
+  return total;
+}
deleted file mode 120000 (symlink)
index e17e54e7be0fe1c6e3aeb9886a25b219e6840ec3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/full-write.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..87f9b928b919ad7c0c1f04c476d21fdbc4c2eb79
--- /dev/null
@@ -0,0 +1,34 @@
+/* An interface to write() that writes all it is asked to write.
+
+   Copyright (C) 2002-2003, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Write COUNT bytes at BUF to descriptor FD, retrying if interrupted
+   or if partial writes occur.  Return the number of bytes successfully
+   written, setting errno if that is less than COUNT.  */
+extern size_t full_write (int fd, const void *buf, size_t count);
+
+
+#ifdef __cplusplus
+}
+#endif
deleted file mode 120000 (symlink)
index 0399d683592fb39ec67ab1aff35ed6951eb9cf2b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/futimens.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..defae933adea9274182b04d4620f25fd7218d98b
--- /dev/null
@@ -0,0 +1,37 @@
+/* Set the access and modification time of an open fd.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include "utimens.h"
+
+/* Set the access and modification timestamps of FD to be
+   TIMESPEC[0] and TIMESPEC[1], respectively.
+   Fail with ENOSYS on systems without futimes (or equivalent).
+   If TIMESPEC is null, set the timestamps to the current time.
+   Return 0 on success, -1 (setting errno) on failure.  */
+int
+futimens (int fd, struct timespec const times[2])
+{
+  /* fdutimens also works around bugs in native futimens, when running
+     with glibc compiled against newer headers but on a Linux kernel
+     older than 2.6.32.  */
+  return fdutimens (fd, NULL, times);
+}
deleted file mode 120000 (symlink)
index eeb02edc02b374ae61431c3b74865bcfacad0428..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/gai_strerror.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..37092e295cd736b06c22a7defe3319f498ace108
--- /dev/null
@@ -0,0 +1,92 @@
+/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2024 Free Software
+   Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <netdb.h>
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "gettext.h"
+# define _(String) gettext (String)
+# define N_(String) String
+#endif
+
+#if HAVE_DECL_GAI_STRERROR
+
+# include <sys/socket.h>
+# undef gai_strerror
+# if HAVE_DECL_GAI_STRERRORA
+#  define gai_strerror gai_strerrorA
+# endif
+
+const char *
+rpl_gai_strerror (int code)
+{
+  return gai_strerror (code);
+}
+
+#else /* !HAVE_DECL_GAI_STRERROR */
+
+static struct
+  {
+    int code;
+    const char *msg;
+  }
+values[] =
+  {
+    { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
+    { EAI_AGAIN, N_("Temporary failure in name resolution") },
+    { EAI_BADFLAGS, N_("Bad value for ai_flags") },
+    { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
+    { EAI_FAMILY, N_("ai_family not supported") },
+    { EAI_MEMORY, N_("Memory allocation failure") },
+    { EAI_NODATA, N_("No address associated with hostname") },
+    { EAI_NONAME, N_("Name or service not known") },
+    { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
+    { EAI_SOCKTYPE, N_("ai_socktype not supported") },
+    { EAI_SYSTEM, N_("System error") },
+    { EAI_OVERFLOW, N_("Argument buffer too small") },
+#ifdef EAI_INPROGRESS
+    { EAI_INPROGRESS, N_("Processing request in progress") },
+    { EAI_CANCELED, N_("Request canceled") },
+    { EAI_NOTCANCELED, N_("Request not canceled") },
+    { EAI_ALLDONE, N_("All requests done") },
+    { EAI_INTR, N_("Interrupted by a signal") },
+    { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
+#endif
+  };
+
+const char *
+gai_strerror (int code)
+{
+  size_t i;
+  for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
+    if (values[i].code == code)
+      return _(values[i].msg);
+
+  return _("Unknown error");
+}
+# ifdef _LIBC
+libc_hidden_def (gai_strerror)
+# endif
+#endif /* !HAVE_DECL_GAI_STRERROR */
deleted file mode 120000 (symlink)
index a412a1506403a23be41f4f7268f9b73060537872..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/get-permissions.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..36848d3d080d367f3ce8c164d623107bcf2248a2
--- /dev/null
@@ -0,0 +1,291 @@
+/* Get permissions of a file.  -*- coding: utf-8 -*-
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible.  */
+
+#include <config.h>
+
+#include <string.h>
+#include "acl.h"
+
+#include "acl-internal.h"
+
+/* Read the permissions of a file into CTX. If DESC is a valid file descriptor,
+   use file descriptor operations, else use filename based operations on NAME.
+   MODE is the file mode obtained from a previous stat call.
+   Return 0 if successful.  Return -1 and set errno upon failure.  */
+
+int
+get_permissions (const char *name, int desc, mode_t mode,
+                 struct permission_context *ctx)
+{
+  memset (ctx, 0, sizeof *ctx);
+  ctx->mode = mode;
+
+#if USE_ACL && HAVE_ACL_GET_FILE
+  /* POSIX 1003.1e (draft 17 -- abandoned) specific version.  */
+  /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+# if !HAVE_ACL_TYPE_EXTENDED
+  /* Linux, FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */
+
+  if (HAVE_ACL_GET_FD && desc != -1)
+    ctx->acl = acl_get_fd (desc);
+  else
+    ctx->acl = acl_get_file (name, ACL_TYPE_ACCESS);
+  if (ctx->acl == NULL)
+    return acl_errno_valid (errno) ? -1 : 0;
+
+  /* With POSIX ACLs, a file cannot have "no" acl; a file without
+     extended permissions has a "minimal" acl which is equivalent to the
+     file mode.  */
+
+  if (S_ISDIR (mode))
+    {
+      ctx->default_acl = acl_get_file (name, ACL_TYPE_DEFAULT);
+      if (ctx->default_acl == NULL)
+        return -1;
+    }
+
+#  if HAVE_ACL_TYPE_NFS4  /* FreeBSD */
+
+  /* TODO (see set_permissions). */
+
+#  endif
+
+# else /* HAVE_ACL_TYPE_EXTENDED */
+  /* Mac OS X */
+
+  /* On Mac OS X,  acl_get_file (name, ACL_TYPE_ACCESS)
+     and           acl_get_file (name, ACL_TYPE_DEFAULT)
+     always return NULL / EINVAL.  You have to use
+                   acl_get_file (name, ACL_TYPE_EXTENDED)
+     or            acl_get_fd (open (name, ...))
+     to retrieve an ACL.
+     On the other hand,
+                   acl_set_file (name, ACL_TYPE_ACCESS, acl)
+     and           acl_set_file (name, ACL_TYPE_DEFAULT, acl)
+     have the same effect as
+                   acl_set_file (name, ACL_TYPE_EXTENDED, acl):
+     Each of these calls sets the file's ACL.  */
+
+  if (HAVE_ACL_GET_FD && desc != -1)
+    ctx->acl = acl_get_fd (desc);
+  else
+    ctx->acl = acl_get_file (name, ACL_TYPE_EXTENDED);
+  if (ctx->acl == NULL)
+    return acl_errno_valid (errno) ? -1 : 0;
+
+# endif
+
+#elif USE_ACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
+
+  /* Solaris 2.5 through Solaris 10, Cygwin, and contemporaneous versions
+     of Unixware.  The acl() call returns the access and default ACL both
+     at once.  */
+# ifdef ACE_GETACL
+  /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
+     file systems (whereas the other ones are used in UFS file systems).
+     There is an API
+       pathconf (name, _PC_ACL_ENABLED)
+       fpathconf (desc, _PC_ACL_ENABLED)
+     that allows us to determine which of the two kinds of ACLs is supported
+     for the given file.  But some file systems may implement this call
+     incorrectly, so better not use it.
+     When fetching the source ACL, we simply fetch both ACL types.
+     When setting the destination ACL, we try either ACL types, assuming
+     that the kernel will translate the ACL from one form to the other.
+     (See in <https://docs.oracle.com/cd/E86824_01/html/E54765/acl-2.html>
+     the description of ENOTSUP.)  */
+  for (;;)
+    {
+      int ret;
+
+      if (desc != -1)
+        ret = facl (desc, ACE_GETACLCNT, 0, NULL);
+      else
+        ret = acl (name, ACE_GETACLCNT, 0, NULL);
+      if (ret < 0)
+        {
+          if (errno == ENOSYS || errno == EINVAL)
+            ret = 0;
+          else
+            return -1;
+        }
+      ctx->ace_count = ret;
+
+      if (ctx->ace_count == 0)
+        break;
+
+      ctx->ace_entries = (ace_t *) malloc (ctx->ace_count * sizeof (ace_t));
+      if (ctx->ace_entries == NULL)
+        {
+          errno = ENOMEM;
+          return -1;
+        }
+
+      if (desc != -1)
+        ret = facl (desc, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
+      else
+        ret = acl (name, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
+      if (ret < 0)
+        {
+          if (errno == ENOSYS || errno == EINVAL)
+            {
+              free (ctx->ace_entries);
+              ctx->ace_entries = NULL;
+              ctx->ace_count = 0;
+              break;
+            }
+          else
+            return -1;
+        }
+      if (ret <= ctx->ace_count)
+        {
+          ctx->ace_count = ret;
+          break;
+        }
+      /* Huh? The number of ACL entries has increased since the last call.
+         Repeat.  */
+      free (ctx->ace_entries);
+      ctx->ace_entries = NULL;
+    }
+# endif
+
+  for (;;)
+    {
+      int ret;
+
+      if (desc != -1)
+        ret = facl (desc, GETACLCNT, 0, NULL);
+      else
+        ret = acl (name, GETACLCNT, 0, NULL);
+      if (ret < 0)
+        {
+          if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
+            ret = 0;
+          else
+            return -1;
+        }
+      ctx->count = ret;
+
+      if (ctx->count == 0)
+        break;
+
+      ctx->entries = (aclent_t *) malloc (ctx->count * sizeof (aclent_t));
+      if (ctx->entries == NULL)
+        {
+          errno = ENOMEM;
+          return -1;
+        }
+
+      if (desc != -1)
+        ret = facl (desc, GETACL, ctx->count, ctx->entries);
+      else
+        ret = acl (name, GETACL, ctx->count, ctx->entries);
+      if (ret < 0)
+        {
+          if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
+            {
+              free (ctx->entries);
+              ctx->entries = NULL;
+              ctx->count = 0;
+              break;
+            }
+          else
+            return -1;
+        }
+      if (ret <= ctx->count)
+        {
+          ctx->count = ret;
+          break;
+        }
+      /* Huh? The number of ACL entries has increased since the last call.
+         Repeat.  */
+      free (ctx->entries);
+      ctx->entries = NULL;
+    }
+
+#elif USE_ACL && HAVE_GETACL /* HP-UX */
+
+  {
+    int ret;
+
+    if (desc != -1)
+      ret = fgetacl (desc, NACLENTRIES, ctx->entries);
+    else
+      ret = getacl (name, NACLENTRIES, ctx->entries);
+    if (ret < 0)
+      {
+        if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+          ret = 0;
+        else
+          return -1;
+      }
+    else if (ret > NACLENTRIES)
+      /* If NACLENTRIES cannot be trusted, use dynamic memory allocation.  */
+      abort ();
+    ctx->count = ret;
+
+# if HAVE_ACLV_H
+    ret = acl ((char *) name, ACL_GET, NACLVENTRIES, ctx->aclv_entries);
+    if (ret < 0)
+      {
+        if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+          ret = 0;
+        else
+          return -2;
+      }
+    else if (ret > NACLVENTRIES)
+      /* If NACLVENTRIES cannot be trusted, use dynamic memory allocation.  */
+      abort ();
+    ctx->aclv_count = ret;
+# endif
+  }
+
+#elif USE_ACL && HAVE_ACLX_GET && ACL_AIX_WIP /* AIX */
+
+  /* TODO (see set_permissions). */
+
+#elif USE_ACL && HAVE_STATACL /* older AIX */
+
+  {
+    int ret;
+    if (desc != -1)
+      ret = fstatacl (desc, STX_NORMAL, &ctx->u.a, sizeof ctx->u);
+    else
+      ret = statacl ((char *) name, STX_NORMAL, &ctx->u.a, sizeof ctx->u);
+    if (ret == 0)
+      ctx->have_u = true;
+  }
+
+#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
+
+  {
+    int ret = acl ((char *) name, ACL_GET, NACLENTRIES, ctx->entries);
+    if (ret < 0)
+      return -1;
+    else if (ret > NACLENTRIES)
+      /* If NACLENTRIES cannot be trusted, use dynamic memory allocation.  */
+      abort ();
+    ctx->count = ret;
+  }
+
+#endif
+
+  return 0;
+
+}
deleted file mode 120000 (symlink)
index 4a56d85f747e5e51eba693822d995b3f1fbf1556..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getaddrinfo.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bf5d61f387884f9a9f868a8166ee5f5aad426f45
--- /dev/null
@@ -0,0 +1,503 @@
+/* Get address information (partial implementation).
+   Copyright (C) 1997, 2001-2002, 2004-2024 Free Software Foundation, Inc.
+   Contributed by Simon Josefsson <simon@josefsson.org>.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the sa == NULL test below.  */
+#define _GL_ARG_NONNULL(params)
+
+#include <config.h>
+
+#include <netdb.h>
+
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+
+/* Get inet_ntop.  */
+#include <arpa/inet.h>
+
+/* Get calloc. */
+#include <stdlib.h>
+
+/* Get memcpy, strdup. */
+#include <string.h>
+
+/* Get snprintf. */
+#include <stdio.h>
+
+#include "gettext.h"
+#define _(String) gettext (String)
+#define N_(String) String
+
+/* BeOS has AF_INET, but not PF_INET.  */
+#ifndef PF_INET
+# define PF_INET AF_INET
+#endif
+/* BeOS also lacks PF_UNSPEC.  */
+#ifndef PF_UNSPEC
+# define PF_UNSPEC 0
+#endif
+
+#if HAVE_GETADDRINFO
+
+/* Override with cdecl calling convention.  */
+
+int
+getaddrinfo (const char *restrict nodename,
+             const char *restrict servname,
+             const struct addrinfo *restrict hints,
+             struct addrinfo **restrict res)
+# undef getaddrinfo
+{
+  return getaddrinfo (nodename, servname, hints, res);
+}
+
+void
+freeaddrinfo (struct addrinfo *ai)
+# undef freeaddrinfo
+{
+  freeaddrinfo (ai);
+}
+
+#else
+
+# if defined _WIN32 && !defined __CYGWIN__
+#  define WINDOWS_NATIVE
+# endif
+
+/* gl_sockets_startup */
+# include "sockets.h"
+
+# ifdef WINDOWS_NATIVE
+
+/* Don't assume that UNICODE is not defined.  */
+#  undef GetModuleHandle
+#  define GetModuleHandle GetModuleHandleA
+
+#  if !(_WIN32_WINNT >= _WIN32_WINNT_WINXP)
+
+/* Avoid warnings from gcc -Wcast-function-type.  */
+#   define GetProcAddress \
+     (void *) GetProcAddress
+
+typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
+                                        const struct addrinfo*,
+                                        struct addrinfo**);
+typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
+typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
+                                        socklen_t, char*, DWORD,
+                                        char*, DWORD, int);
+
+static getaddrinfo_func getaddrinfo_ptr = NULL;
+static freeaddrinfo_func freeaddrinfo_ptr = NULL;
+static getnameinfo_func getnameinfo_ptr = NULL;
+
+static int
+use_win32_p (void)
+{
+  static int done = 0;
+  HMODULE h;
+
+  if (done)
+    return getaddrinfo_ptr ? 1 : 0;
+
+  done = 1;
+
+  h = GetModuleHandle ("ws2_32.dll");
+
+  if (h)
+    {
+      getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
+      freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo");
+      getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
+    }
+
+  /* If either is missing, something is odd. */
+  if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
+    {
+      getaddrinfo_ptr = NULL;
+      freeaddrinfo_ptr = NULL;
+      getnameinfo_ptr = NULL;
+      return 0;
+    }
+
+  gl_sockets_startup (SOCKETS_1_1);
+
+  return 1;
+}
+
+#  else
+
+static int
+use_win32_p (void)
+{
+  static int done = 0;
+
+  if (!done)
+    {
+      done = 1;
+
+      gl_sockets_startup (SOCKETS_1_1);
+    }
+
+  return 1;
+}
+
+#   define getaddrinfo_ptr getaddrinfo
+#   define freeaddrinfo_ptr freeaddrinfo
+#   define getnameinfo_ptr getnameinfo
+
+#  endif
+# endif
+
+static bool
+validate_family (int family)
+{
+  /* FIXME: Support more families. */
+# if HAVE_IPV4
+     if (family == PF_INET)
+       return true;
+# endif
+# if HAVE_IPV6
+     if (family == PF_INET6)
+       return true;
+# endif
+     if (family == PF_UNSPEC)
+       return true;
+     return false;
+}
+
+/* Translate name of a service location and/or a service name to set of
+   socket addresses. */
+int
+getaddrinfo (const char *restrict nodename,
+             const char *restrict servname,
+             const struct addrinfo *restrict hints,
+             struct addrinfo **restrict res)
+#undef getaddrinfo
+{
+  struct addrinfo *tmp;
+  int port = 0;
+  struct hostent *he;
+  void *storage;
+  size_t size;
+# if HAVE_IPV6
+  struct v6_pair {
+    struct addrinfo addrinfo;
+    struct sockaddr_in6 sockaddr_in6;
+  };
+# endif
+# if HAVE_IPV4
+  struct v4_pair {
+    struct addrinfo addrinfo;
+    struct sockaddr_in sockaddr_in;
+  };
+# endif
+
+# ifdef WINDOWS_NATIVE
+  if (use_win32_p ())
+    return getaddrinfo_ptr (nodename, servname, hints, res);
+# endif
+
+  if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE)))
+    /* FIXME: Support more flags. */
+    return EAI_BADFLAGS;
+
+  if (hints && !validate_family (hints->ai_family))
+    return EAI_FAMILY;
+
+  if (hints &&
+      hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM)
+    /* FIXME: Support other socktype. */
+    return EAI_SOCKTYPE; /* FIXME: Better return code? */
+
+  if (!nodename)
+    {
+      if (!(hints->ai_flags & AI_PASSIVE))
+        return EAI_NONAME;
+
+# ifdef HAVE_IPV6
+      nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
+# else
+      nodename = "0.0.0.0";
+# endif
+    }
+
+  if (servname)
+    {
+      struct servent *se = NULL;
+      const char *proto =
+        (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
+
+      if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
+        /* FIXME: Use getservbyname_r if available. */
+        se = getservbyname (servname, proto);
+
+      if (!se)
+        {
+          char *c;
+          if (!(*servname >= '0' && *servname <= '9'))
+            return EAI_NONAME;
+          port = strtoul (servname, &c, 10);
+          if (*c || port > 0xffff)
+            return EAI_NONAME;
+          port = htons (port);
+        }
+      else
+        port = se->s_port;
+    }
+
+  /* FIXME: Use gethostbyname_r if available. */
+  he = gethostbyname (nodename);
+  if (!he || he->h_addr_list[0] == NULL)
+    return EAI_NONAME;
+
+  switch (he->h_addrtype)
+    {
+# if HAVE_IPV6
+    case PF_INET6:
+      size = sizeof (struct v6_pair);
+      break;
+# endif
+
+# if HAVE_IPV4
+    case PF_INET:
+      size = sizeof (struct v4_pair);
+      break;
+# endif
+
+    default:
+      return EAI_NODATA;
+    }
+
+  storage = calloc (1, size);
+  if (!storage)
+    return EAI_MEMORY;
+
+  switch (he->h_addrtype)
+    {
+# if HAVE_IPV6
+    case PF_INET6:
+      {
+        struct v6_pair *p = storage;
+        struct sockaddr_in6 *sinp = &p->sockaddr_in6;
+        tmp = &p->addrinfo;
+
+        if (port)
+          sinp->sin6_port = port;
+
+        if (he->h_length != sizeof (sinp->sin6_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
+
+        memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
+
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
+      }
+      break;
+# endif
+
+# if HAVE_IPV4
+    case PF_INET:
+      {
+        struct v4_pair *p = storage;
+        struct sockaddr_in *sinp = &p->sockaddr_in;
+        tmp = &p->addrinfo;
+
+        if (port)
+          sinp->sin_port = port;
+
+        if (he->h_length != sizeof (sinp->sin_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
+
+        memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
+
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
+      }
+      break;
+# endif
+
+    default:
+      free (storage);
+      return EAI_NODATA;
+    }
+
+  if (hints && hints->ai_flags & AI_CANONNAME)
+    {
+      const char *cn;
+      if (he->h_name)
+        cn = he->h_name;
+      else
+        cn = nodename;
+
+      tmp->ai_canonname = strdup (cn);
+      if (!tmp->ai_canonname)
+        {
+          free (storage);
+          return EAI_MEMORY;
+        }
+    }
+
+  tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
+  tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
+  tmp->ai_addr->sa_family = he->h_addrtype;
+  tmp->ai_family = he->h_addrtype;
+
+# ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+  switch (he->h_addrtype)
+    {
+#  if HAVE_IPV4
+    case AF_INET:
+      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in);
+      break;
+#  endif
+#  if HAVE_IPV6
+    case AF_INET6:
+      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in6);
+      break;
+#  endif
+    }
+# endif
+
+  /* FIXME: If more than one address, create linked list of addrinfo's. */
+
+  *res = tmp;
+
+  return 0;
+}
+
+/* Free 'addrinfo' structure AI including associated storage.  */
+void
+freeaddrinfo (struct addrinfo *ai)
+#undef freeaddrinfo
+{
+# ifdef WINDOWS_NATIVE
+  if (use_win32_p ())
+    {
+      freeaddrinfo_ptr (ai);
+      return;
+    }
+# endif
+
+  while (ai)
+    {
+      struct addrinfo *cur;
+
+      cur = ai;
+      ai = ai->ai_next;
+
+      free (cur->ai_canonname);
+      free (cur);
+    }
+}
+
+int
+getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
+             char *restrict node, socklen_t nodelen,
+             char *restrict service, socklen_t servicelen,
+             int flags)
+#undef getnameinfo
+{
+# ifdef WINDOWS_NATIVE
+  if (use_win32_p ())
+    return getnameinfo_ptr (sa, salen, node, nodelen,
+                            service, servicelen, flags);
+# endif
+
+  /* FIXME: Support other flags. */
+  if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
+      (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
+      (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
+    return EAI_BADFLAGS;
+
+  if (sa == NULL || salen < sizeof (sa->sa_family))
+    return EAI_FAMILY;
+
+  switch (sa->sa_family)
+    {
+# if HAVE_IPV4
+    case AF_INET:
+      if (salen < sizeof (struct sockaddr_in))
+        return EAI_FAMILY;
+      break;
+# endif
+# if HAVE_IPV6
+    case AF_INET6:
+      if (salen < sizeof (struct sockaddr_in6))
+        return EAI_FAMILY;
+      break;
+# endif
+    default:
+      return EAI_FAMILY;
+    }
+
+  if (node && nodelen > 0 && flags & NI_NUMERICHOST)
+    {
+      switch (sa->sa_family)
+        {
+# if HAVE_IPV4
+        case AF_INET:
+          if (!inet_ntop (AF_INET,
+                          &(((const struct sockaddr_in *) sa)->sin_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
+# endif
+
+# if HAVE_IPV6
+        case AF_INET6:
+          if (!inet_ntop (AF_INET6,
+                          &(((const struct sockaddr_in6 *) sa)->sin6_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
+# endif
+
+        default:
+          return EAI_FAMILY;
+        }
+    }
+
+  if (service && servicelen > 0 && flags & NI_NUMERICSERV)
+    switch (sa->sa_family)
+      {
+# if HAVE_IPV4
+      case AF_INET:
+# endif
+# if HAVE_IPV6
+      case AF_INET6:
+# endif
+        {
+          unsigned short int port
+            = ntohs (((const struct sockaddr_in *) sa)->sin_port);
+          if (servicelen <= snprintf (service, servicelen, "%u", port))
+            return EAI_OVERFLOW;
+        }
+        break;
+      }
+
+  return 0;
+}
+
+#endif
deleted file mode 120000 (symlink)
index d09bfd3e12f1cd030bb90b13dce914f286d98cd7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getcwd-lgpl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..67ed2878e6e0d574910d5004d3e21f1feb37bd08
--- /dev/null
@@ -0,0 +1,127 @@
+/* Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   This file is part of gnulib.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification */
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if GNULIB_GETCWD
+/* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use.  */
+typedef int dummy;
+#else
+
+/* Get the name of the current working directory, and put it in SIZE
+   bytes of BUF.  Returns NULL if the directory couldn't be determined
+   (perhaps because the absolute name was longer than PATH_MAX, or
+   because of missing read/search permissions on parent directories)
+   or SIZE was too small.  If successful, returns BUF.  If BUF is
+   NULL, an array is allocated with 'malloc'; the array is SIZE bytes
+   long, unless SIZE == 0, in which case it is as big as
+   necessary.  */
+
+# undef getcwd
+# if defined _WIN32 && !defined __CYGWIN__
+#  define getcwd _getcwd
+# endif
+
+char *
+rpl_getcwd (char *buf, size_t size)
+{
+  char *result;
+
+  /* Handle single size operations.  */
+  if (buf)
+    {
+      /* Check SIZE argument.  */
+      if (!size)
+        {
+          errno = EINVAL;
+          return NULL;
+        }
+      return getcwd (buf, size);
+    }
+
+  if (size)
+    {
+      buf = malloc (size);
+      if (!buf)
+        {
+          errno = ENOMEM;
+          return NULL;
+        }
+      result = getcwd (buf, size);
+      if (!result)
+        free (buf);
+      return result;
+    }
+
+  /* Flexible sizing requested.  Avoid over-allocation for the common
+     case of a name that fits within a 4k page, minus some space for
+     local variables, to be sure we don't skip over a guard page.  */
+  {
+    char tmp[4032];
+    size = sizeof tmp;
+    char *ptr = getcwd (tmp, size);
+    if (ptr)
+      {
+        result = strdup (ptr);
+        if (!result)
+          errno = ENOMEM;
+        return result;
+      }
+    if (errno != ERANGE)
+      return NULL;
+  }
+
+  /* My what a large directory name we have.  */
+  do
+    {
+      size <<= 1;
+      char *ptr = realloc (buf, size);
+      if (ptr == NULL)
+        {
+          free (buf);
+          errno = ENOMEM;
+          return NULL;
+        }
+      buf = ptr;
+      result = getcwd (buf, size);
+    }
+  while (!result && errno == ERANGE);
+
+  if (!result)
+    free (buf);
+  else
+    {
+      /* Here result == buf.  */
+      /* Shrink result before returning it.  */
+      size_t actual_size = strlen (result) + 1;
+      if (actual_size < size)
+        {
+          char *shrinked_result = realloc (result, actual_size);
+          if (shrinked_result != NULL)
+            result = shrinked_result;
+        }
+    }
+  return result;
+}
+
+#endif
deleted file mode 120000 (symlink)
index f59b8434fbdcd6c5a50b44ab1d2484566c23a0d7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getcwd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..214950a144732bfee21ffe39c72bd9686947f416
--- /dev/null
@@ -0,0 +1,567 @@
+/* Copyright (C) 1991-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if !_LIBC
+# include <config.h>
+# include <stdio.h>
+# include <unistd.h>
+# include "pathmax.h"
+#else
+# define HAVE_OPENAT 1
+# define D_INO_IN_DIRENT 1
+# define HAVE_MSVC_INVALID_PARAMETER_HANDLER 0
+# define HAVE_MINIMALLY_WORKING_GETCWD 0
+#endif
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stddef.h>
+
+#include <fcntl.h> /* For AT_FDCWD on Solaris 9.  */
+
+/* If this host provides the openat function or if we're using the
+   gnulib replacement function with a native fdopendir, then enable
+   code below to make getcwd more efficient and robust.  */
+#if defined HAVE_OPENAT || (defined GNULIB_OPENAT && defined HAVE_FDOPENDIR)
+# define HAVE_OPENAT_SUPPORT 1
+#else
+# define HAVE_OPENAT_SUPPORT 0
+#endif
+
+#ifndef __set_errno
+# define __set_errno(val) (errno = (val))
+#endif
+
+#include <dirent.h>
+#ifndef _D_EXACT_NAMLEN
+# define _D_EXACT_NAMLEN(d) strlen ((d)->d_name)
+#endif
+#ifndef _D_ALLOC_NAMLEN
+# define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1)
+#endif
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if _LIBC
+# ifndef mempcpy
+#  define mempcpy __mempcpy
+# endif
+#endif
+
+#ifndef MAX
+# define MAX(a, b) ((a) < (b) ? (b) : (a))
+#endif
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+/* In this file, PATH_MAX only serves as a threshold for choosing among two
+   algorithms.  */
+#ifndef PATH_MAX
+# define PATH_MAX 8192
+#endif
+
+#if D_INO_IN_DIRENT
+# define MATCHING_INO(dp, ino) ((dp)->d_ino == (ino))
+#else
+# define MATCHING_INO(dp, ino) true
+#endif
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#if !_LIBC
+# define GETCWD_RETURN_TYPE char *
+# define __close_nocancel_nostatus close
+# define __getcwd_generic rpl_getcwd
+# undef stat64
+# define stat64    stat
+# define __fstat64 fstat
+# define __fstatat64 fstatat
+# define __lstat64 lstat
+# define __closedir closedir
+# define __opendir opendir
+# define __readdir64 readdir
+# define __fdopendir fdopendir
+# define __openat openat
+# define __rewinddir rewinddir
+# define __openat64 openat
+# define dirent64 dirent
+#else
+# include <not-cancel.h>
+#endif
+
+/* The results of opendir() in this file are not used with dirfd and fchdir,
+   and we do not leak fds to any single-threaded code that could use stdio,
+   therefore save some unnecessary recursion in fchdir.c.
+   FIXME - if the kernel ever adds support for multi-thread safety for
+   avoiding standard fds, then we should use opendir_safer and
+   openat_safer.  */
+#ifdef GNULIB_defined_DIR
+# undef DIR
+# undef opendir
+# undef closedir
+# undef readdir
+# undef rewinddir
+#else
+# ifdef GNULIB_defined_opendir
+#  undef opendir
+# endif
+# ifdef GNULIB_defined_closedir
+#  undef closedir
+# endif
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static char *
+getcwd_nothrow (char *buf, size_t size)
+{
+  char *result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _getcwd (buf, size);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = NULL;
+      errno = ERANGE;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+# else
+#  define getcwd_nothrow _getcwd
+# endif
+# define getcwd_system getcwd_nothrow
+#else
+# define getcwd_system getcwd
+#endif
+
+/* Get the name of the current working directory, and put it in SIZE
+   bytes of BUF.  Returns NULL with errno set if the directory couldn't be
+   determined or SIZE was too small.  If successful, returns BUF.  In GNU,
+   if BUF is NULL, an array is allocated with 'malloc'; the array is SIZE
+   bytes long, unless SIZE == 0, in which case it is as big as necessary.  */
+
+GETCWD_RETURN_TYPE
+__getcwd_generic (char *buf, size_t size)
+{
+  /* Lengths of big file name components and entire file names, and a
+     deep level of file name nesting.  These numbers are not upper
+     bounds; they are merely large values suitable for initial
+     allocations, designed to be large enough for most real-world
+     uses.  */
+  enum
+    {
+      BIG_FILE_NAME_COMPONENT_LENGTH = 255,
+      BIG_FILE_NAME_LENGTH = MIN (4095, PATH_MAX - 1),
+      DEEP_NESTING = 100
+    };
+
+#if HAVE_OPENAT_SUPPORT
+  int fd = AT_FDCWD;
+  bool fd_needs_closing = false;
+# if defined __linux__
+  bool proc_fs_not_mounted = false;
+# endif
+#else
+  char dots[DEEP_NESTING * sizeof ".." + BIG_FILE_NAME_COMPONENT_LENGTH + 1];
+  char *dotlist = dots;
+  size_t dotsize = sizeof dots;
+  size_t dotlen = 0;
+#endif
+  DIR *dirstream = NULL;
+  dev_t rootdev, thisdev;
+  ino_t rootino, thisino;
+  char *dir;
+  register char *dirp;
+  struct stat64 st;
+  size_t allocated = size;
+  size_t used;
+
+#if HAVE_MINIMALLY_WORKING_GETCWD
+  /* If AT_FDCWD is not defined, the algorithm below is O(N**2) and
+     this is much slower than the system getcwd (at least on
+     GNU/Linux).  So trust the system getcwd's results unless they
+     look suspicious.
+
+     Use the system getcwd even if we have openat support, since the
+     system getcwd works even when a parent is unreadable, while the
+     openat-based approach does not.
+
+     But on AIX 5.1..7.1, the system getcwd is not even minimally
+     working: If the current directory name is slightly longer than
+     PATH_MAX, it omits the first directory component and returns
+     this wrong result with errno = 0.  */
+
+# undef getcwd
+  dir = getcwd_system (buf, size);
+  if (dir || (size && errno == ERANGE))
+    return dir;
+
+  /* Solaris getcwd (NULL, 0) fails with errno == EINVAL, but it has
+     internal magic that lets it work even if an ancestor directory is
+     inaccessible, which is better in many cases.  So in this case try
+     again with a buffer that's almost always big enough.  */
+  if (errno == EINVAL && buf == NULL && size == 0)
+    {
+      char big_buffer[BIG_FILE_NAME_LENGTH + 1];
+      dir = getcwd_system (big_buffer, sizeof big_buffer);
+      if (dir)
+        return strdup (dir);
+    }
+
+# if HAVE_PARTLY_WORKING_GETCWD
+  /* The system getcwd works, except it sometimes fails when it
+     shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.    */
+  if (errno != ERANGE && errno != ENAMETOOLONG && errno != ENOENT)
+    return NULL;
+# endif
+#endif
+  if (size == 0)
+    {
+      if (buf != NULL)
+        {
+          __set_errno (EINVAL);
+          return NULL;
+        }
+
+      allocated = BIG_FILE_NAME_LENGTH + 1;
+    }
+
+  if (buf == NULL)
+    {
+      dir = malloc (allocated);
+      if (dir == NULL)
+        return NULL;
+    }
+  else
+    dir = buf;
+
+  dirp = dir + allocated;
+  *--dirp = '\0';
+
+  if (__lstat64 (".", &st) < 0)
+    goto lose;
+  thisdev = st.st_dev;
+  thisino = st.st_ino;
+
+  if (__lstat64 ("/", &st) < 0)
+    goto lose;
+  rootdev = st.st_dev;
+  rootino = st.st_ino;
+
+  while (!(thisdev == rootdev && thisino == rootino))
+    {
+      struct dirent64 *d;
+      dev_t dotdev;
+      ino_t dotino;
+      bool mount_point;
+      int parent_status;
+      size_t dirroom;
+      size_t namlen;
+      bool use_d_ino = true;
+
+      /* Look at the parent directory.  */
+#if HAVE_OPENAT_SUPPORT
+      fd = __openat64 (fd, "..", O_RDONLY);
+      if (fd < 0)
+        goto lose;
+      fd_needs_closing = true;
+      parent_status = __fstat64 (fd, &st);
+#else
+      dotlist[dotlen++] = '.';
+      dotlist[dotlen++] = '.';
+      dotlist[dotlen] = '\0';
+      parent_status = __lstat64 (dotlist, &st);
+#endif
+      if (parent_status != 0)
+        goto lose;
+
+      if (dirstream && __closedir (dirstream) != 0)
+        {
+          dirstream = NULL;
+          goto lose;
+        }
+
+      /* Figure out if this directory is a mount point.  */
+      dotdev = st.st_dev;
+      dotino = st.st_ino;
+      mount_point = dotdev != thisdev;
+
+      /* Search for the last directory.  */
+#if HAVE_OPENAT_SUPPORT
+      dirstream = __fdopendir (fd);
+      if (dirstream == NULL)
+        goto lose;
+      fd_needs_closing = false;
+#else
+      dirstream = __opendir (dotlist);
+      if (dirstream == NULL)
+        goto lose;
+      dotlist[dotlen++] = '/';
+#endif
+      for (;;)
+        {
+          /* Clear errno to distinguish EOF from error if readdir returns
+             NULL.  */
+          __set_errno (0);
+          d = __readdir64 (dirstream);
+
+          /* When we've iterated through all directory entries without finding
+             one with a matching d_ino, rewind the stream and consider each
+             name again, but this time, using lstat.  This is necessary in a
+             chroot on at least one system (glibc-2.3.6 + linux 2.6.12), where
+             .., ../.., ../../.., etc. all had the same device number, yet the
+             d_ino values for entries in / did not match those obtained
+             via lstat.  */
+          if (d == NULL && errno == 0 && use_d_ino)
+            {
+              use_d_ino = false;
+              __rewinddir (dirstream);
+              d = __readdir64 (dirstream);
+            }
+
+          if (d == NULL)
+            {
+              if (errno == 0)
+                /* EOF on dirstream, which can mean e.g., that the current
+                   directory has been removed.  */
+                __set_errno (ENOENT);
+              goto lose;
+            }
+          if (d->d_name[0] == '.' &&
+              (d->d_name[1] == '\0' ||
+               (d->d_name[1] == '.' && d->d_name[2] == '\0')))
+            continue;
+
+          if (use_d_ino)
+            {
+              bool match = (MATCHING_INO (d, thisino) || mount_point);
+              if (! match)
+                continue;
+            }
+
+          {
+            int entry_status;
+#if HAVE_OPENAT_SUPPORT
+            entry_status = __fstatat64 (fd, d->d_name, &st, AT_SYMLINK_NOFOLLOW);
+#else
+            /* Compute size needed for this file name, or for the file
+               name ".." in the same directory, whichever is larger.
+               Room for ".." might be needed the next time through
+               the outer loop.  */
+            size_t name_alloc = _D_ALLOC_NAMLEN (d);
+            size_t filesize = dotlen + MAX (sizeof "..", name_alloc);
+
+            if (filesize < dotlen)
+              goto memory_exhausted;
+
+            if (dotsize < filesize)
+              {
+                /* My, what a deep directory tree you have, Grandma.  */
+                size_t newsize = MAX (filesize, dotsize * 2);
+                size_t i;
+                if (newsize < dotsize)
+                  goto memory_exhausted;
+                if (dotlist != dots)
+                  free (dotlist);
+                dotlist = malloc (newsize);
+                if (dotlist == NULL)
+                  goto lose;
+                dotsize = newsize;
+
+                i = 0;
+                do
+                  {
+                    dotlist[i++] = '.';
+                    dotlist[i++] = '.';
+                    dotlist[i++] = '/';
+                  }
+                while (i < dotlen);
+              }
+
+            memcpy (dotlist + dotlen, d->d_name, _D_ALLOC_NAMLEN (d));
+            entry_status = __lstat64 (dotlist, &st);
+#endif
+            /* We don't fail here if we cannot stat() a directory entry.
+               This can happen when (network) file systems fail.  If this
+               entry is in fact the one we are looking for we will find
+               out soon as we reach the end of the directory without
+               having found anything.  */
+            if (entry_status == 0 && S_ISDIR (st.st_mode)
+                && st.st_dev == thisdev && st.st_ino == thisino)
+              break;
+          }
+        }
+
+      dirroom = dirp - dir;
+      namlen = _D_EXACT_NAMLEN (d);
+
+      if (dirroom <= namlen)
+        {
+          if (size != 0)
+            {
+              __set_errno (ERANGE);
+              goto lose;
+            }
+          else
+            {
+              char *tmp;
+              size_t oldsize = allocated;
+
+              allocated += MAX (allocated, namlen);
+              if (allocated < oldsize
+                  || ! (tmp = realloc (dir, allocated)))
+                goto memory_exhausted;
+
+              /* Move current contents up to the end of the buffer.
+                 This is guaranteed to be non-overlapping.  */
+              dirp = memcpy (tmp + allocated - (oldsize - dirroom),
+                             tmp + dirroom,
+                             oldsize - dirroom);
+              dir = tmp;
+            }
+        }
+      dirp -= namlen;
+      memcpy (dirp, d->d_name, namlen);
+      *--dirp = '/';
+
+      thisdev = dotdev;
+      thisino = dotino;
+
+#if HAVE_OPENAT_SUPPORT
+      /* On some platforms, a system call returns the directory that FD points
+         to.  This is useful if some of the ancestor directories of the
+         directory are unreadable, because in this situation the loop that
+         climbs up the ancestor hierarchy runs into an EACCES error.
+         For example, in some Android app, /data/data/com.termux is readable,
+         but /data/data and /data are not.  */
+# if defined __linux__
+      /* On Linux, in particular, if /proc is mounted,
+           readlink ("/proc/self/fd/<fd>")
+         returns the directory, if its length is < 4096.  (If the length is
+         >= 4096, it fails with error ENAMETOOLONG, even if the buffer that we
+         pass to the readlink function would be large enough.)  */
+      if (!proc_fs_not_mounted)
+        {
+          char namebuf[14 + 10 + 1];
+          sprintf (namebuf, "/proc/self/fd/%u", (unsigned int) fd);
+          char linkbuf[4096];
+          ssize_t linklen = readlink (namebuf, linkbuf, sizeof linkbuf);
+          if (linklen < 0)
+            {
+              if (errno != ENAMETOOLONG)
+                /* If this call was not successful, the next one will likely be
+                   not successful either.  */
+                proc_fs_not_mounted = true;
+            }
+          else
+            {
+              dirroom = dirp - dir;
+              if (dirroom < linklen)
+                {
+                  if (size != 0)
+                    {
+                      __set_errno (ERANGE);
+                      goto lose;
+                    }
+                  else
+                    {
+                      char *tmp;
+                      size_t oldsize = allocated;
+
+                      allocated += linklen - dirroom;
+                      if (allocated < oldsize
+                          || ! (tmp = realloc (dir, allocated)))
+                        goto memory_exhausted;
+
+                      /* Move current contents up to the end of the buffer.  */
+                      dirp = memmove (tmp + dirroom + (allocated - oldsize),
+                                      tmp + dirroom,
+                                      oldsize - dirroom);
+                      dir = tmp;
+                    }
+                }
+              dirp -= linklen;
+              memcpy (dirp, linkbuf, linklen);
+              break;
+            }
+        }
+# endif
+#endif
+    }
+
+  if (dirstream && __closedir (dirstream) != 0)
+    {
+      dirstream = NULL;
+      goto lose;
+    }
+
+  if (dirp == &dir[allocated - 1])
+    *--dirp = '/';
+
+#if ! HAVE_OPENAT_SUPPORT
+  if (dotlist != dots)
+    free (dotlist);
+#endif
+
+  used = dir + allocated - dirp;
+  memmove (dir, dirp, used);
+
+  if (size == 0)
+    /* Ensure that the buffer is only as large as necessary.  */
+    buf = (used < allocated ? realloc (dir, used) : dir);
+
+  if (buf == NULL)
+    /* Either buf was NULL all along, or 'realloc' failed but
+       we still have the original string.  */
+    buf = dir;
+
+  return buf;
+
+ memory_exhausted:
+  __set_errno (ENOMEM);
+ lose:
+  {
+    int save = errno;
+    if (dirstream)
+      __closedir (dirstream);
+#if HAVE_OPENAT_SUPPORT
+    if (fd_needs_closing)
+       __close_nocancel_nostatus (fd);
+#else
+    if (dotlist != dots)
+      free (dotlist);
+#endif
+    if (buf == NULL)
+      free (dir);
+    __set_errno (save);
+  }
+  return NULL;
+}
+
+#if defined _LIBC && !defined GETCWD_RETURN_TYPE
+libc_hidden_def (__getcwd)
+weak_alias (__getcwd, getcwd)
+#endif
deleted file mode 120000 (symlink)
index 0326de70eed7edcadbf22fc8394a1a1f121300a2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getdelim.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..58063b156e7222228a6b5e0909a569b922328f31
--- /dev/null
@@ -0,0 +1,143 @@
+/* getdelim.c --- Implementation of replacement getdelim function.
+   Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Ported from glibc by Simon Josefsson. */
+
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below.  */
+#define _GL_ARG_NONNULL(params)
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+# define getc_maybe_unlocked(fp)        getc(fp)
+#elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED
+# undef flockfile
+# undef funlockfile
+# define flockfile(x) ((void) 0)
+# define funlockfile(x) ((void) 0)
+# define getc_maybe_unlocked(fp)        getc(fp)
+#else
+# define getc_maybe_unlocked(fp)        getc_unlocked(fp)
+#endif
+
+static void
+alloc_failed (void)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* Avoid errno problem without using the realloc module; see:
+     https://lists.gnu.org/r/bug-gnulib/2016-08/msg00025.html  */
+  errno = ENOMEM;
+#endif
+}
+
+/* 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.  */
+
+ssize_t
+getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
+{
+  ssize_t result;
+  size_t cur_len = 0;
+
+  if (lineptr == NULL || n == NULL || fp == NULL)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  flockfile (fp);
+
+  if (*lineptr == NULL || *n == 0)
+    {
+      char *new_lineptr;
+      *n = 120;
+      new_lineptr = (char *) realloc (*lineptr, *n);
+      if (new_lineptr == NULL)
+        {
+          alloc_failed ();
+          result = -1;
+          goto unlock_return;
+        }
+      *lineptr = new_lineptr;
+    }
+
+  for (;;)
+    {
+      int i;
+
+      i = getc_maybe_unlocked (fp);
+      if (i == EOF)
+        {
+          result = -1;
+          break;
+        }
+
+      /* Make enough space for len+1 (for final NUL) bytes.  */
+      if (cur_len + 1 >= *n)
+        {
+          size_t needed_max =
+            SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
+          size_t needed = 2 * *n + 1;   /* Be generous. */
+          char *new_lineptr;
+
+          if (needed_max < needed)
+            needed = needed_max;
+          if (cur_len + 1 >= needed)
+            {
+              result = -1;
+              errno = EOVERFLOW;
+              goto unlock_return;
+            }
+
+          new_lineptr = (char *) realloc (*lineptr, needed);
+          if (new_lineptr == NULL)
+            {
+              alloc_failed ();
+              result = -1;
+              goto unlock_return;
+            }
+
+          *lineptr = new_lineptr;
+          *n = needed;
+        }
+
+      (*lineptr)[cur_len] = i;
+      cur_len++;
+
+      if (i == delimiter)
+        break;
+    }
+  (*lineptr)[cur_len] = '\0';
+  result = cur_len ? cur_len : result;
+
+ unlock_return:
+  funlockfile (fp); /* doesn't set errno */
+
+  return result;
+}
deleted file mode 120000 (symlink)
index 2534a86b39bcc6e55eefb3a45319b98732697d93..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getdtablesize.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..762c100b38a526f8e17e33add8ef41e68163241a
--- /dev/null
@@ -0,0 +1,124 @@
+/* getdtablesize() function: Return maximum possible file descriptor value + 1.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+# include <stdio.h>
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#  include "msvc-inval.h"
+# endif
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+_setmaxstdio_nothrow (int newmax)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _setmaxstdio (newmax);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = -1;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+# else
+#  define _setmaxstdio_nothrow _setmaxstdio
+# endif
+
+/* Cache for the previous getdtablesize () result.  Safe to cache because
+   Windows also lacks setrlimit.  */
+static int dtablesize;
+
+int
+getdtablesize (void)
+{
+  if (dtablesize == 0)
+    {
+      /* We are looking for the number N such that the valid file descriptors
+         are 0..N-1.  It can be obtained through a loop as follows:
+           {
+             int fd;
+             for (fd = 3; fd < 65536; fd++)
+               if (dup2 (0, fd) == -1)
+                 break;
+             return fd;
+           }
+         On Windows XP, the result is 2048.
+         The drawback of this loop is that it allocates memory for a libc
+         internal array that is never freed.
+
+         The number N can also be obtained as the upper bound for
+         _getmaxstdio ().  _getmaxstdio () returns the maximum number of open
+         FILE objects.  The sanity check in _setmaxstdio reveals the maximum
+         number of file descriptors.  This too allocates memory, but it is
+         freed when we call _setmaxstdio with the original value.  */
+      int orig_max_stdio = _getmaxstdio ();
+      unsigned int bound;
+      for (bound = 0x10000; _setmaxstdio_nothrow (bound) < 0; bound = bound / 2)
+        ;
+      _setmaxstdio_nothrow (orig_max_stdio);
+      dtablesize = bound;
+    }
+  return dtablesize;
+}
+
+#else
+
+# include <limits.h>
+# include <sys/resource.h>
+
+# ifndef RLIM_SAVED_CUR
+#  define RLIM_SAVED_CUR RLIM_INFINITY
+# endif
+# ifndef RLIM_SAVED_MAX
+#  define RLIM_SAVED_MAX RLIM_INFINITY
+# endif
+
+# ifdef __CYGWIN__
+  /* Cygwin 1.7.25 auto-increases the RLIMIT_NOFILE soft limit until it
+     hits the compile-time constant hard limit of 3200.  We might as
+     well just report the hard limit.  */
+#  define rlim_cur rlim_max
+# endif
+
+int
+getdtablesize (void)
+{
+  struct rlimit lim;
+
+  if (getrlimit (RLIMIT_NOFILE, &lim) == 0
+      && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX
+      && lim.rlim_cur != RLIM_INFINITY
+      && lim.rlim_cur != RLIM_SAVED_CUR
+      && lim.rlim_cur != RLIM_SAVED_MAX)
+    return lim.rlim_cur;
+
+  return INT_MAX;
+}
+
+#endif
deleted file mode 120000 (symlink)
index e8344d450ed1b4857c28ce00c7d44839c906b7e6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getfilecon.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..76927820863344f21d19c0bef80598c6700c568f
--- /dev/null
@@ -0,0 +1,114 @@
+/* wrap getfilecon, lgetfilecon, and fgetfilecon
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <selinux/selinux.h>
+
+#include <sys/types.h>
+#include <errno.h>
+#include <string.h>
+
+/* FIXME: remove this once there is an errno-gnu module
+   that guarantees the definition of ENODATA.  */
+#ifndef ENODATA
+# define ENODATA ENOTSUP
+#endif
+
+#undef getfilecon
+#undef getfilecon_raw
+#undef lgetfilecon
+#undef lgetfilecon_raw
+#undef fgetfilecon
+#undef fgetfilecon_raw
+int getfilecon (char const *file, char **con);
+int getfilecon_raw (char const *file, char **con);
+int lgetfilecon (char const *file, char **con);
+int lgetfilecon_raw (char const *file, char **con);
+int fgetfilecon (int fd, char **con);
+int fgetfilecon_raw (int fd, char **con);
+
+/* getfilecon, lgetfilecon, and fgetfilecon can all misbehave, be it
+   via an old version of libselinux where these would return 0 and set the
+   result context to NULL, or via a modern kernel+lib operating on a file
+   from a disk whose attributes were set by a kernel from around 2006.
+   In that latter case, the functions return a length of 10 for the
+   "unlabeled" context.  Map both failures to a return value of -1, and
+   set errno to ENOTSUP in the first case, and ENODATA in the latter.  */
+
+static int
+map_to_failure (int ret, char **con)
+{
+  if (ret == 0)
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
+
+  if (ret == 10 && strcmp (*con, "unlabeled") == 0)
+    {
+      freecon (*con);
+      *con = NULL;
+      errno = ENODATA;
+      return -1;
+    }
+
+  return ret;
+}
+
+int
+rpl_getfilecon (char const *file, char **con)
+{
+  int ret = getfilecon (file, con);
+  return map_to_failure (ret, con);
+}
+
+int
+rpl_getfilecon_raw (char const *file, char **con)
+{
+  int ret = getfilecon_raw (file, con);
+  return map_to_failure (ret, con);
+}
+
+int
+rpl_lgetfilecon (char const *file, char **con)
+{
+  int ret = lgetfilecon (file, con);
+  return map_to_failure (ret, con);
+}
+
+int
+rpl_lgetfilecon_raw (char const *file, char **con)
+{
+  int ret = lgetfilecon_raw (file, con);
+  return map_to_failure (ret, con);
+}
+
+int
+rpl_fgetfilecon (int fd, char**con)
+{
+  int ret = fgetfilecon (fd, con);
+  return map_to_failure (ret, con);
+}
+
+int
+rpl_fgetfilecon_raw (int fd, char**con)
+{
+  int ret = fgetfilecon_raw (fd, con);
+  return map_to_failure (ret, con);
+}
deleted file mode 120000 (symlink)
index d3d1c013f88ddbc3f0b9b449505e8f661ca19222..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getgroups.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9f4908e9977e61f18bcae3700174735e687a9f92
--- /dev/null
@@ -0,0 +1,125 @@
+/* provide consistent interface to getgroups for systems that don't allow N==0
+
+   Copyright (C) 1996, 1999, 2003, 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#if !HAVE_GETGROUPS
+
+/* Provide a stub that fails with ENOSYS, since there is no group
+   information available on mingw.  */
+int
+getgroups (_GL_UNUSED int n, _GL_UNUSED GETGROUPS_T *groups)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#else /* HAVE_GETGROUPS */
+
+# undef getgroups
+# ifndef GETGROUPS_ZERO_BUG
+#  define GETGROUPS_ZERO_BUG 0
+# endif
+
+/* On OS X 10.6 and later, use the usual getgroups, not the one
+   supplied when _DARWIN_C_SOURCE is defined.  _DARWIN_C_SOURCE is
+   normally defined, since it means "conform to POSIX, but add
+   non-POSIX extensions even if that violates the POSIX namespace
+   rules", which is what we normally want.  But with getgroups there
+   is an inconsistency, and _DARWIN_C_SOURCE means "change getgroups()
+   so that it no longer works right".  The BUGS section of compat(5)
+   says that the behavior is dubious if you compile different sections
+   of a program with different _DARWIN_C_SOURCE settings, so fix only
+   the offending symbol.  */
+# ifdef __APPLE__
+int posix_getgroups (int, gid_t []) __asm ("_getgroups");
+#  define getgroups posix_getgroups
+# endif
+
+/* On at least NeXTstep 3.2, getgroups (0, NULL) always fails.
+   On other systems, it returns the number of supplemental
+   groups for the process.  This function handles that special case
+   and lets the system-provided function handle all others.  However,
+   it can fail with ENOMEM if memory is tight.  It is unspecified
+   whether the effective group id is included in the list.  */
+
+int
+rpl_getgroups (int n, gid_t *group)
+{
+  int n_groups;
+  GETGROUPS_T *gbuf;
+
+  if (n < 0)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if (n != 0 || !GETGROUPS_ZERO_BUG)
+    {
+      int result;
+      if (sizeof *group == sizeof *gbuf)
+        return getgroups (n, (GETGROUPS_T *) group);
+
+      if (SIZE_MAX / sizeof *gbuf <= n)
+        {
+          errno = ENOMEM;
+          return -1;
+        }
+      gbuf = malloc (n * sizeof *gbuf);
+      if (!gbuf)
+        return -1;
+      result = getgroups (n, gbuf);
+      if (0 <= result)
+        {
+          n = result;
+          while (n--)
+            group[n] = gbuf[n];
+        }
+      free (gbuf);
+      return result;
+    }
+
+  n = 20;
+  while (1)
+    {
+      /* No need to worry about address arithmetic overflow here,
+         since the ancient systems that we're running on have low
+         limits on the number of secondary groups.  */
+      gbuf = malloc (n * sizeof *gbuf);
+      if (!gbuf)
+        return -1;
+      n_groups = getgroups (n, gbuf);
+      if (n_groups == -1 ? errno != EINVAL : n_groups < n)
+        break;
+      free (gbuf);
+      n *= 2;
+    }
+
+  free (gbuf);
+  return n_groups;
+}
+
+#endif /* HAVE_GETGROUPS */
deleted file mode 120000 (symlink)
index 93e7869cb8082eab1b6b39e8c20733d77ee2bfac..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/gethostname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c075b6dfa9612a6f0cd60d239053c37fc87b854d
--- /dev/null
@@ -0,0 +1,104 @@
+/* gethostname emulation for SysV and POSIX.1.
+
+   Copyright (C) 1992, 2003, 2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* David MacKenzie <djm@gnu.ai.mit.edu>
+   Windows port by Simon Josefsson <simon@josefsson.org> */
+
+#include <config.h>
+
+#if !(defined _WIN32 && !defined __CYGWIN__)
+/* Unix API.  */
+
+/* Specification.  */
+#include <unistd.h>
+
+#ifdef HAVE_UNAME
+# include <sys/utsname.h>
+#endif
+
+#include <string.h>
+
+/* Put up to LEN chars of the host name into NAME.
+   Null terminate it if the name is shorter than LEN.
+   Return 0 if ok, -1 if error.  */
+
+#include <stddef.h>
+
+int
+gethostname (char *name, size_t len)
+{
+#ifdef HAVE_UNAME
+  struct utsname uts;
+
+  if (uname (&uts) == -1)
+    return -1;
+  if (len > sizeof (uts.nodename))
+    {
+      /* More space than we need is available.  */
+      name[sizeof (uts.nodename)] = '\0';
+      len = sizeof (uts.nodename);
+    }
+  strncpy (name, uts.nodename, len);
+#else
+  strcpy (name, "");            /* Hardcode your system name if you want.  */
+#endif
+  return 0;
+}
+
+#else
+/* Native Windows API.  Which primitive to choose?
+   - gethostname() requires linking with -lws2_32.
+   - GetComputerName() does not return the right kind of hostname.
+   - GetComputerNameEx(ComputerNameDnsHostname,...) returns the right hostname,
+     but it is hard to use portably:
+       - It requires defining _WIN32_WINNT to at least 0x0500.
+       - With mingw, it also requires
+         "#define GetComputerNameEx GetComputerNameExA".
+       - With older versions of mingw, none of the declarations are present at
+         all, not even of the enum value ComputerNameDnsHostname.
+   So we use gethostname().  Linking with -lws2_32 is the least evil.  */
+
+#define WIN32_LEAN_AND_MEAN
+/* Get winsock2.h. */
+#include <unistd.h>
+
+/* Get INT_MAX.  */
+#include <limits.h>
+
+/* Get set_winsock_errno. */
+#include "w32sock.h"
+
+#include "sockets.h"
+
+#undef gethostname
+
+int
+rpl_gethostname (char *name, size_t len)
+{
+  int r;
+
+  if (len > INT_MAX)
+    len = INT_MAX;
+  gl_sockets_startup (SOCKETS_1_1);
+  r = gethostname (name, (int) len);
+  if (r < 0)
+    set_winsock_errno ();
+
+  return r;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 2db51f9dbe60e0d3fa5d2f59076414711279915c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/gethrxtime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..549c3c8e19c46661d09b007acb12f5728546c241
--- /dev/null
@@ -0,0 +1,73 @@
+/* gethrxtime -- get high resolution real time
+
+   Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#define GETHRXTIME_INLINE _GL_EXTERN_INLINE
+#include "gethrxtime.h"
+
+#if ! (HAVE_ARITHMETIC_HRTIME_T && HAVE_DECL_GETHRTIME)
+
+#include <sys/time.h>
+#include "timespec.h"
+
+/* Get the current time, as a count of the number of nanoseconds since
+   an arbitrary epoch (e.g., the system boot time).  Prefer a
+   high-resolution clock that is not subject to resetting or
+   drifting.  */
+
+xtime_t
+gethrxtime (void)
+{
+# if HAVE_NANOUPTIME
+  {
+    struct timespec ts;
+    nanouptime (&ts);
+    return xtime_make (ts.tv_sec, ts.tv_nsec);
+  }
+# else
+
+#  if defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME
+  {
+    struct timespec ts;
+    if (clock_gettime (CLOCK_MONOTONIC, &ts) == 0)
+      return xtime_make (ts.tv_sec, ts.tv_nsec);
+  }
+#  endif
+
+#  if HAVE_MICROUPTIME
+  {
+    struct timeval tv;
+    microuptime (&tv);
+    return xtime_make (tv.tv_sec, 1000 * tv.tv_usec);
+  }
+
+#  else
+  /* No monotonically increasing clocks are available; fall back on a
+     clock that might jump backwards, since it's the best we can do.  */
+  {
+    struct timespec ts;
+    gettime (&ts);
+    return xtime_make (ts.tv_sec, ts.tv_nsec);
+  }
+#  endif
+# endif
+}
+
+#endif
deleted file mode 120000 (symlink)
index 48c110910ea215c9c0e9784c3426882481c9e4f5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/gethrxtime.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..244337a64448e5b94a74d9a0c037a397d72c874b
--- /dev/null
@@ -0,0 +1,58 @@
+/* gethrxtime -- get high resolution real time
+
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef GETHRXTIME_H_
+#define GETHRXTIME_H_ 1
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, HAVE_ARITHMETIC_HRTIME_T,
+   HAVE_DECL_GETHRTIME.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include "xtime.h"
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef GETHRXTIME_INLINE
+# define GETHRXTIME_INLINE _GL_INLINE
+#endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Get the current time, as a count of the number of nanoseconds since
+   an arbitrary epoch (e.g., the system boot time).  Prefer a
+   high-resolution clock that is not subject to resetting or
+   drifting.  */
+
+#if HAVE_ARITHMETIC_HRTIME_T && HAVE_DECL_GETHRTIME
+# include <time.h>
+GETHRXTIME_INLINE xtime_t gethrxtime (void) { return gethrtime (); }
+# else
+xtime_t gethrxtime (void);
+#endif
+
+_GL_INLINE_HEADER_END
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
deleted file mode 120000 (symlink)
index 907752034a3257763abd86833f88966985bf7da9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getline.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2d03b64689e05f3333e9807bf7a3b88df2e5bf9f
--- /dev/null
@@ -0,0 +1,27 @@
+/* getline.c --- Implementation of replacement getline function.
+   Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson. */
+
+#include <config.h>
+
+#include <stdio.h>
+
+ssize_t
+getline (char **lineptr, size_t *n, FILE *stream)
+{
+  return getdelim (lineptr, n, '\n', stream);
+}
deleted file mode 120000 (symlink)
index 047e7677c099e5018581d569b62e2ac597f2b720..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getloadavg.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c940e4c7ee01274b07b0f111260f6fbb41e0ca5d
--- /dev/null
@@ -0,0 +1,943 @@
+/* Get the system load averages.
+
+   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2024 Free Software
+   Foundation, Inc.
+
+   NOTE: The canonical source of this file is maintained with gnulib.
+   Bugs can be reported to bug-gnulib@gnu.org.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Compile-time symbols that this file uses:
+
+   HAVE_PSTAT_GETDYNAMIC        Define this if your system has the
+                                pstat_getdynamic function.  I think it
+                                is unique to HPUX9.  The best way to get the
+                                definition is through the AC_FUNC_GETLOADAVG
+                                macro that comes with autoconf 2.13 or newer.
+                                If that isn't an option, then just put
+                                AC_CHECK_FUNCS(pstat_getdynamic) in your
+                                configure.ac file.
+   HAVE_LIBPERFSTAT Define this if your system has the
+                                perfstat_cpu_total function in libperfstat (AIX).
+   FIXUP_KERNEL_SYMBOL_ADDR()   Adjust address in returned struct nlist.
+   KERNEL_FILE                  Name of the kernel file to nlist.
+   LDAV_CVT()                   Scale the load average from the kernel.
+                                Returns a double.
+   LDAV_SYMBOL                  Name of kernel symbol giving load average.
+   LOAD_AVE_TYPE                Type of the load average array in the kernel.
+                                Must be defined unless one of
+                                apollo, DGUX, NeXT, or UMAX is defined;
+                                or we have libkstat;
+                                otherwise, no load average is available.
+   HAVE_NLIST_H                 nlist.h is available.  NLIST_STRUCT defaults
+                                to this.
+   NLIST_STRUCT                 Include nlist.h, not a.out.h.
+   N_NAME_POINTER               The nlist n_name element is a pointer,
+                                not an array.
+   HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
+   LINUX_LDAV_FILE              [__linux__, __ANDROID__, __CYGWIN__]: File
+                                containing load averages.
+
+   Specific system predefines this file uses, aside from setting
+   default values if not emacs:
+
+   apollo
+   BSD                          Real BSD, not just BSD-like.
+   DGUX
+   eunice                       UNIX emulator under VMS.
+   hpux
+   __MSDOS__                    No-op for MSDOS.
+   NeXT
+   sgi
+   UMAX
+   UMAX4_3
+   VMS
+   _WIN32                       Native Windows (possibly also defined on Cygwin)
+   __linux__, __ANDROID__       Linux: assumes /proc file system mounted.
+                                Support from Michael K. Johnson.
+   __CYGWIN__                   Cygwin emulates linux /proc/loadavg.
+   __NetBSD__                   NetBSD: assumes /kern file system mounted.
+
+   In addition, to avoid nesting many #ifdefs, we internally set
+   LDAV_DONE to indicate that the load average has been computed.
+
+   We also #define LDAV_PRIVILEGED if a program will require
+   special installation to be able to call getloadavg.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#include <stdio.h>
+
+# include <sys/types.h>
+
+# if HAVE_SYS_PARAM_H
+#  include <sys/param.h>
+# endif
+
+# include "intprops.h"
+
+# if defined _WIN32 && ! defined __CYGWIN__ && ! defined WINDOWS32
+#  define WINDOWS32
+# endif
+
+# ifdef NeXT
+/* NeXT in the 2.{0,1,2} releases defines BSD in <sys/param.h>, which
+   conflicts with the definition understood in this file, that this
+   really is BSD. */
+#  undef BSD
+
+/* NeXT defines FSCALE in <sys/param.h>.  However, we take FSCALE being
+   defined to mean that the nlist method should be used, which is not true.  */
+#  undef FSCALE
+# endif
+
+/* Same issues as for NeXT apply to the HURD-based GNU system.  */
+# ifdef __GNU__
+#  undef BSD
+#  undef FSCALE
+# endif /* __GNU__ */
+
+/* Set values that are different from the defaults, which are
+   set a little farther down with #ifndef.  */
+
+
+/* Some shorthands.  */
+
+# if defined (HPUX) && !defined (hpux)
+#  define hpux
+# endif
+
+# if defined (__hpux) && !defined (hpux)
+#  define hpux
+# endif
+
+# if defined (__sun) && !defined (sun)
+#  define sun
+# endif
+
+# if defined (hp300) && !defined (hpux)
+#  define MORE_BSD
+# endif
+
+# if defined (__SVR4) && !defined (SVR4)
+#  define SVR4
+# endif
+
+# if (defined (sun) && defined (SVR4)) || defined (SOLARIS2)
+#  define SUNOS_5
+# endif
+
+# if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
+#  define OSF_ALPHA
+#  include <sys/mbuf.h>
+#  include <sys/socket.h>
+#  include <net/route.h>
+#  include <sys/table.h>
+/* Tru64 4.0D's table.h redefines sys */
+#  undef sys
+# endif
+
+# if defined (__osf__) && (defined (mips) || defined (__mips__))
+#  define OSF_MIPS
+#  include <sys/table.h>
+# endif
+
+
+/* VAX C can't handle multi-line #ifs, or lines longer than 256 chars.  */
+# ifndef LOAD_AVE_TYPE
+
+#  ifdef MORE_BSD
+#   define LOAD_AVE_TYPE long
+#  endif
+
+#  ifdef sun
+#   define LOAD_AVE_TYPE long
+#  endif
+
+#  ifdef sgi
+#   define LOAD_AVE_TYPE long
+#  endif
+
+#  ifdef SVR4
+#   define LOAD_AVE_TYPE long
+#  endif
+
+#  ifdef OSF_ALPHA
+#   define LOAD_AVE_TYPE long
+#  endif
+
+#  if defined _AIX && ! defined HAVE_LIBPERFSTAT
+#   define LOAD_AVE_TYPE long
+#  endif
+
+# endif /* No LOAD_AVE_TYPE.  */
+
+# ifdef OSF_ALPHA
+/* <sys/param.h> defines an incorrect value for FSCALE on Alpha OSF/1,
+   according to ghazi@noc.rutgers.edu.  */
+#  undef FSCALE
+#  define FSCALE 1024.0
+# endif
+
+
+# ifndef FSCALE
+
+/* SunOS and some others define FSCALE in sys/param.h.  */
+
+#  ifdef MORE_BSD
+#   define FSCALE 2048.0
+#  endif
+
+#  if defined (MIPS) || defined (SVR4)
+#   define FSCALE 256
+#  endif
+
+#  if defined (sgi)
+/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
+   above under #ifdef MIPS.  But we want the sgi value.  */
+#   undef FSCALE
+#   define FSCALE 1000.0
+#  endif
+
+#  if defined _AIX && !defined HAVE_LIBPERFSTAT
+#   define FSCALE 65536.0
+#  endif
+
+# endif /* Not FSCALE.  */
+
+# if !defined (LDAV_CVT) && defined (FSCALE)
+#  define LDAV_CVT(n) (((double) (n)) / FSCALE)
+# endif
+
+# ifndef NLIST_STRUCT
+#  if HAVE_NLIST_H
+#   define NLIST_STRUCT
+#  endif
+# endif
+
+# if defined (sgi) || (defined (mips) && !defined (BSD))
+#  define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
+# endif
+
+
+# if !defined (KERNEL_FILE) && defined (hpux)
+#  define KERNEL_FILE "/hp-ux"
+# endif
+
+# if !defined (KERNEL_FILE) && (defined (MIPS) || defined (SVR4) || defined (ISC) || defined (sgi))
+#  define KERNEL_FILE "/unix"
+# endif
+
+
+# if !defined (LDAV_SYMBOL) && (defined (hpux) || defined (SVR4) || defined (ISC) || defined (sgi) || (defined (_AIX) && !defined(HAVE_LIBPERFSTAT)))
+#  define LDAV_SYMBOL "avenrun"
+# endif
+
+# ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
+
+/* LOAD_AVE_TYPE should only get defined if we're going to use the
+   nlist method.  */
+# if !defined (LOAD_AVE_TYPE) && (defined (BSD) || defined (LDAV_CVT) || defined (KERNEL_FILE) || defined (LDAV_SYMBOL))
+#  define LOAD_AVE_TYPE double
+# endif
+
+# ifdef LOAD_AVE_TYPE
+
+#  ifndef __VMS
+#   if !(defined __linux__ || defined __ANDROID__)
+#    ifndef NLIST_STRUCT
+#     include <a.out.h>
+#    else /* NLIST_STRUCT */
+#     include <nlist.h>
+#    endif /* NLIST_STRUCT */
+
+#    ifdef SUNOS_5
+#     include <kvm.h>
+#     include <kstat.h>
+#    endif
+
+#    if defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
+#     include <sys/pstat.h>
+#    endif
+
+#    ifndef KERNEL_FILE
+#     define KERNEL_FILE "/vmunix"
+#    endif /* KERNEL_FILE */
+
+#    ifndef LDAV_SYMBOL
+#     define LDAV_SYMBOL "_avenrun"
+#    endif /* LDAV_SYMBOL */
+#   endif /* __linux__ || __ANDROID__ */
+
+#  else /* __VMS */
+
+#   ifndef eunice
+#    include <iodef.h>
+#    include <descrip.h>
+#   else /* eunice */
+#    include <vms/iodef.h>
+#   endif /* eunice */
+#  endif /* __VMS */
+
+#  ifndef LDAV_CVT
+#   define LDAV_CVT(n) ((double) (n))
+#  endif /* !LDAV_CVT */
+
+# endif /* LOAD_AVE_TYPE */
+
+# if defined HAVE_LIBPERFSTAT
+#  include <sys/protosw.h>
+#  include <libperfstat.h>
+#  include <sys/proc.h>
+#  ifndef SBITS
+#   define SBITS 16
+#  endif
+# endif
+
+# if defined (__GNU__) && !defined (NeXT)
+/* Note that NeXT Openstep defines __GNU__ even though it should not.  */
+/* GNU system acts much like NeXT, for load average purposes,
+   but not exactly.  */
+#  define NeXT
+#  define host_self mach_host_self
+# endif
+
+# ifdef NeXT
+#  ifdef HAVE_MACH_MACH_H
+#   include <mach/mach.h>
+#  else
+#   include <mach.h>
+#  endif
+# endif /* NeXT */
+
+# ifdef sgi
+#  include <sys/sysmp.h>
+# endif /* sgi */
+
+# ifdef UMAX
+#  include <signal.h>
+#  include <sys/time.h>
+#  include <sys/wait.h>
+#  include <sys/syscall.h>
+
+#  ifdef UMAX_43
+#   include <machine/cpu.h>
+#   include <inq_stats/statistics.h>
+#   include <inq_stats/sysstats.h>
+#   include <inq_stats/cpustats.h>
+#   include <inq_stats/procstats.h>
+#  else /* Not UMAX_43.  */
+#   include <sys/sysdefs.h>
+#   include <sys/statistics.h>
+#   include <sys/sysstats.h>
+#   include <sys/cpudefs.h>
+#   include <sys/cpustats.h>
+#   include <sys/procstats.h>
+#  endif /* Not UMAX_43.  */
+# endif /* UMAX */
+
+# ifdef DGUX
+#  include <sys/dg_sys_info.h>
+# endif
+
+# if (defined __linux__ || defined __ANDROID__ \
+      || defined __CYGWIN__ || defined SUNOS_5 \
+      || (defined LOAD_AVE_TYPE && ! defined __VMS))
+#  include <fcntl.h>
+# endif
+\f
+/* Avoid static vars inside a function since in HPUX they dump as pure.  */
+
+# ifdef NeXT
+static processor_set_t default_set;
+static bool getloadavg_initialized;
+# endif /* NeXT */
+
+# ifdef UMAX
+static unsigned int cpus = 0;
+static unsigned int samples;
+# endif /* UMAX */
+
+# ifdef DGUX
+static struct dg_sys_info_load_info load_info;  /* what-a-mouthful! */
+# endif /* DGUX */
+
+# if !defined (HAVE_LIBKSTAT) && defined (LOAD_AVE_TYPE)
+/* File descriptor open to /dev/kmem or VMS load ave driver.  */
+static int channel;
+/* True if channel is valid.  */
+static bool getloadavg_initialized;
+/* Offset in kmem to seek to read load average, or 0 means invalid.  */
+static long offset;
+
+#  if ! defined __VMS && ! defined sgi && ! (defined __linux__ || defined __ANDROID__)
+static struct nlist name_list[2];
+#  endif
+
+#  ifdef SUNOS_5
+static kvm_t *kd;
+#  endif /* SUNOS_5 */
+
+# endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
+\f
+/* Put the 1 minute, 5 minute and 15 minute load averages
+   into the first NELEM elements of LOADAVG.
+   Return the number written (never more than 3, but may be less than NELEM),
+   or -1 (setting errno) if an error occurred.  */
+
+int
+getloadavg (double loadavg[], int nelem)
+{
+  int elem = 0;                 /* Return value.  */
+
+# ifdef NO_GET_LOAD_AVG
+#  define LDAV_DONE
+  errno = ENOSYS;
+  elem = -1;
+# endif
+
+# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT)       /* Solaris <= 2.6 */
+/* Use libkstat because we don't have to be root.  */
+#  define LDAV_DONE
+  kstat_ctl_t *kc;
+  kstat_t *ksp;
+  kstat_named_t *kn;
+  int saved_errno;
+
+  kc = kstat_open ();
+  if (kc == NULL)
+    return -1;
+  ksp = kstat_lookup (kc, "unix", 0, "system_misc");
+  if (ksp == NULL)
+    return -1;
+  if (kstat_read (kc, ksp, 0) == -1)
+    return -1;
+
+
+  kn = kstat_data_lookup (ksp, "avenrun_1min");
+  if (kn == NULL)
+    {
+      /* Return -1 if no load average information is available.  */
+      nelem = 0;
+      elem = -1;
+    }
+
+  if (nelem >= 1)
+    loadavg[elem++] = (double) kn->value.ul / FSCALE;
+
+  if (nelem >= 2)
+    {
+      kn = kstat_data_lookup (ksp, "avenrun_5min");
+      if (kn != NULL)
+        {
+          loadavg[elem++] = (double) kn->value.ul / FSCALE;
+
+          if (nelem >= 3)
+            {
+              kn = kstat_data_lookup (ksp, "avenrun_15min");
+              if (kn != NULL)
+                loadavg[elem++] = (double) kn->value.ul / FSCALE;
+            }
+        }
+    }
+
+  saved_errno = errno;
+  kstat_close (kc);
+  errno = saved_errno;
+# endif /* HAVE_LIBKSTAT */
+
+# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
+                                                           /* HP-UX */
+/* Use pstat_getdynamic() because we don't have to be root.  */
+#  define LDAV_DONE
+#  undef LOAD_AVE_TYPE
+
+  struct pst_dynamic dyn_info;
+  if (pstat_getdynamic (&dyn_info, sizeof (dyn_info), 0, 0) < 0)
+    return -1;
+  if (nelem > 0)
+    loadavg[elem++] = dyn_info.psd_avg_1_min;
+  if (nelem > 1)
+    loadavg[elem++] = dyn_info.psd_avg_5_min;
+  if (nelem > 2)
+    loadavg[elem++] = dyn_info.psd_avg_15_min;
+
+# endif /* hpux && HAVE_PSTAT_GETDYNAMIC */
+
+# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT       /* AIX */
+#  define LDAV_DONE
+#  undef LOAD_AVE_TYPE
+/* Use perfstat_cpu_total because we don't have to be root. */
+  {
+    perfstat_cpu_total_t cpu_stats;
+    int result = perfstat_cpu_total (NULL, &cpu_stats, sizeof cpu_stats, 1);
+    if (result == -1)
+      return result;
+    loadavg[0] = cpu_stats.loadavg[0] / (double)(1 << SBITS);
+    loadavg[1] = cpu_stats.loadavg[1] / (double)(1 << SBITS);
+    loadavg[2] = cpu_stats.loadavg[2] / (double)(1 << SBITS);
+    elem = 3;
+  }
+# endif
+
+# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__)
+                                      /* Linux without glibc, Android, Cygwin */
+#  define LDAV_DONE
+#  undef LOAD_AVE_TYPE
+
+#  ifndef LINUX_LDAV_FILE
+#   define LINUX_LDAV_FILE "/proc/loadavg"
+#  endif
+
+  char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
+  char const *ptr = ldavgbuf;
+  int fd, count, saved_errno;
+
+  fd = open (LINUX_LDAV_FILE, O_RDONLY | O_CLOEXEC);
+  if (fd == -1)
+    return -1;
+  count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
+  saved_errno = errno;
+  (void) close (fd);
+  errno = saved_errno;
+  if (count <= 0)
+    return -1;
+  ldavgbuf[count] = '\0';
+
+  for (elem = 0; elem < nelem; elem++)
+    {
+      double numerator = 0;
+      double denominator = 1;
+
+      while (*ptr == ' ')
+        ptr++;
+
+      /* Finish if this number is missing, and report an error if all
+         were missing.  */
+      if (! ('0' <= *ptr && *ptr <= '9'))
+        {
+          if (elem == 0)
+            {
+              errno = ENOTSUP;
+              return -1;
+            }
+          break;
+        }
+
+      while ('0' <= *ptr && *ptr <= '9')
+        numerator = 10 * numerator + (*ptr++ - '0');
+
+      if (*ptr == '.')
+        for (ptr++; '0' <= *ptr && *ptr <= '9'; ptr++)
+          numerator = 10 * numerator + (*ptr - '0'), denominator *= 10;
+
+      loadavg[elem] = numerator / denominator;
+    }
+
+  return elem;
+
+# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */
+
+# if !defined (LDAV_DONE) && defined (__NetBSD__)          /* NetBSD < 0.9 */
+#  define LDAV_DONE
+#  undef LOAD_AVE_TYPE
+
+#  ifndef NETBSD_LDAV_FILE
+#   define NETBSD_LDAV_FILE "/kern/loadavg"
+#  endif
+
+  unsigned long int load_ave[3], scale;
+  int count;
+  char readbuf[4 * INT_BUFSIZE_BOUND (unsigned long int) + 1];
+  int fd = open (NETBSD_LDAV_FILE, O_RDONLY | O_CLOEXEC);
+  if (fd < 0)
+    return fd;
+  int nread = read (fd, readbuf, sizeof readbuf - 1);
+  int err = errno;
+  close (fd);
+  if (nread < 0)
+    {
+      errno = err;
+      return -1;
+    }
+  readbuf[nread] = '\0';
+  count = sscanf (readbuf, "%lu %lu %lu %lu\n",
+                  &load_ave[0], &load_ave[1], &load_ave[2],
+                  &scale);
+  if (count != 4)
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
+
+  for (elem = 0; elem < nelem; elem++)
+    loadavg[elem] = (double) load_ave[elem] / (double) scale;
+
+  return elem;
+
+# endif /* __NetBSD__ */
+
+# if !defined (LDAV_DONE) && defined (NeXT)                /* NeXTStep */
+#  define LDAV_DONE
+  /* The NeXT code was adapted from iscreen 3.2.  */
+
+  host_t host;
+  struct processor_set_basic_info info;
+  unsigned int info_count;
+
+  /* We only know how to get the 1-minute average for this system,
+     so even if the caller asks for more than 1, we only return 1.  */
+
+  if (!getloadavg_initialized)
+    {
+      if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS)
+        getloadavg_initialized = true;
+    }
+
+  if (getloadavg_initialized)
+    {
+      info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
+      if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
+                              (processor_set_info_t) &info, &info_count)
+          != KERN_SUCCESS)
+        getloadavg_initialized = false;
+      else
+        {
+          if (nelem > 0)
+            loadavg[elem++] = (double) info.load_average / LOAD_SCALE;
+        }
+    }
+
+  if (!getloadavg_initialized)
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
+# endif /* NeXT */
+
+# if !defined (LDAV_DONE) && defined (UMAX)
+#  define LDAV_DONE
+/* UMAX 4.2, which runs on the Encore Multimax multiprocessor, does not
+   have a /dev/kmem.  Information about the workings of the running kernel
+   can be gathered with inq_stats system calls.
+   We only know how to get the 1-minute average for this system.  */
+
+  struct proc_summary proc_sum_data;
+  struct stat_descr proc_info;
+  double load;
+  register unsigned int i, j;
+
+  if (cpus == 0)
+    {
+      register unsigned int c, i;
+      struct cpu_config conf;
+      struct stat_descr desc;
+
+      desc.sd_next = 0;
+      desc.sd_subsys = SUBSYS_CPU;
+      desc.sd_type = CPUTYPE_CONFIG;
+      desc.sd_addr = (char *) &conf;
+      desc.sd_size = sizeof conf;
+
+      if (inq_stats (1, &desc))
+        return -1;
+
+      c = 0;
+      for (i = 0; i < conf.config_maxclass; ++i)
+        {
+          struct class_stats stats;
+          memset (&stats, 0, sizeof stats);
+
+          desc.sd_type = CPUTYPE_CLASS;
+          desc.sd_objid = i;
+          desc.sd_addr = (char *) &stats;
+          desc.sd_size = sizeof stats;
+
+          if (inq_stats (1, &desc))
+            return -1;
+
+          c += stats.class_numcpus;
+        }
+      cpus = c;
+      samples = cpus < 2 ? 3 : (2 * cpus / 3);
+    }
+
+  proc_info.sd_next = 0;
+  proc_info.sd_subsys = SUBSYS_PROC;
+  proc_info.sd_type = PROCTYPE_SUMMARY;
+  proc_info.sd_addr = (char *) &proc_sum_data;
+  proc_info.sd_size = sizeof (struct proc_summary);
+  proc_info.sd_sizeused = 0;
+
+  if (inq_stats (1, &proc_info) != 0)
+    return -1;
+
+  load = proc_sum_data.ps_nrunnable;
+  j = 0;
+  for (i = samples - 1; i > 0; --i)
+    {
+      load += proc_sum_data.ps_nrun[j];
+      if (j++ == PS_NRUNSIZE)
+        j = 0;
+    }
+
+  if (nelem > 0)
+    loadavg[elem++] = load / samples / cpus;
+# endif /* UMAX */
+
+# if !defined (LDAV_DONE) && defined (DGUX)
+#  define LDAV_DONE
+  /* This call can return -1 for an error, but with good args
+     it's not supposed to fail.  The first argument is for no
+     apparent reason of type 'long int *'.  */
+  dg_sys_info ((long int *) &load_info,
+               DG_SYS_INFO_LOAD_INFO_TYPE,
+               DG_SYS_INFO_LOAD_VERSION_0);
+
+  if (nelem > 0)
+    loadavg[elem++] = load_info.one_minute;
+  if (nelem > 1)
+    loadavg[elem++] = load_info.five_minute;
+  if (nelem > 2)
+    loadavg[elem++] = load_info.fifteen_minute;
+# endif /* DGUX */
+
+# if !defined (LDAV_DONE) && defined (apollo)
+#  define LDAV_DONE
+/* Apollo code from lisch@mentorg.com (Ray Lischner).
+
+   This system call is not documented.  The load average is obtained as
+   three long integers, for the load average over the past minute,
+   five minutes, and fifteen minutes.  Each value is a scaled integer,
+   with 16 bits of integer part and 16 bits of fraction part.
+
+   I'm not sure which operating system first supported this system call,
+   but I know that SR10.2 supports it.  */
+
+  extern void proc1_$get_loadav ();
+  unsigned long load_ave[3];
+
+  proc1_$get_loadav (load_ave);
+
+  if (nelem > 0)
+    loadavg[elem++] = load_ave[0] / 65536.0;
+  if (nelem > 1)
+    loadavg[elem++] = load_ave[1] / 65536.0;
+  if (nelem > 2)
+    loadavg[elem++] = load_ave[2] / 65536.0;
+# endif /* apollo */
+
+# if !defined (LDAV_DONE) && defined (OSF_MIPS)
+#  define LDAV_DONE
+
+  struct tbl_loadavg load_ave;
+  table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
+  loadavg[elem++]
+    = (load_ave.tl_lscale == 0
+       ? load_ave.tl_avenrun.d[0]
+       : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
+# endif /* OSF_MIPS */
+
+# if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
+                                                           /* DJGPP */
+#  define LDAV_DONE
+
+  /* A faithful emulation is going to have to be saved for a rainy day.  */
+  for ( ; elem < nelem; elem++)
+    {
+      loadavg[elem] = 0.0;
+    }
+# endif  /* __MSDOS__ || WINDOWS32 */
+
+# if !defined (LDAV_DONE) && defined (OSF_ALPHA)           /* OSF/1 */
+#  define LDAV_DONE
+
+  struct tbl_loadavg load_ave;
+  table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
+  for (elem = 0; elem < nelem; elem++)
+    loadavg[elem]
+      = (load_ave.tl_lscale == 0
+         ? load_ave.tl_avenrun.d[elem]
+         : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
+# endif /* OSF_ALPHA */
+
+# if ! defined LDAV_DONE && defined __VMS                  /* VMS */
+  /* VMS specific code -- read from the Load Ave driver.  */
+
+  LOAD_AVE_TYPE load_ave[3];
+  static bool getloadavg_initialized;
+#  ifdef eunice
+  struct
+  {
+    int dsc$w_length;
+    char *dsc$a_pointer;
+  } descriptor;
+#  endif
+
+  /* Ensure that there is a channel open to the load ave device.  */
+  if (!getloadavg_initialized)
+    {
+      /* Attempt to open the channel.  */
+#  ifdef eunice
+      descriptor.dsc$w_length = 18;
+      descriptor.dsc$a_pointer = "$$VMS_LOAD_AVERAGE";
+#  else
+      $DESCRIPTOR (descriptor, "LAV0:");
+#  endif
+      if (sys$assign (&descriptor, &channel, 0, 0) & 1)
+        getloadavg_initialized = true;
+    }
+
+  /* Read the load average vector.  */
+  if (getloadavg_initialized
+      && !(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
+                     load_ave, 12, 0, 0, 0, 0) & 1))
+    {
+      sys$dassgn (channel);
+      getloadavg_initialized = false;
+    }
+
+  if (!getloadavg_initialized)
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
+# endif /* ! defined LDAV_DONE && defined __VMS */
+
+# if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS
+                                                  /* IRIX, other old systems */
+
+  /* UNIX-specific code -- read the average from /dev/kmem.  */
+
+#  define LDAV_PRIVILEGED               /* This code requires special installation.  */
+
+  LOAD_AVE_TYPE load_ave[3];
+
+  /* Get the address of LDAV_SYMBOL.  */
+  if (offset == 0)
+    {
+#  ifndef sgi
+#   if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER
+      strcpy (name_list[0].n_name, LDAV_SYMBOL);
+      strcpy (name_list[1].n_name, "");
+#   else /* NLIST_STRUCT */
+#    ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
+      name_list[0].n_un.n_name = LDAV_SYMBOL;
+      name_list[1].n_un.n_name = 0;
+#    else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
+      name_list[0].n_name = LDAV_SYMBOL;
+      name_list[1].n_name = 0;
+#    endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
+#   endif /* NLIST_STRUCT */
+
+#   ifndef SUNOS_5
+      if (
+#    if !defined (_AIX)
+          nlist (KERNEL_FILE, name_list)
+#    else  /* _AIX */
+          knlist (name_list, 1, sizeof (name_list[0]))
+#    endif
+          >= 0)
+          /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i.  */
+          {
+#    ifdef FIXUP_KERNEL_SYMBOL_ADDR
+            FIXUP_KERNEL_SYMBOL_ADDR (name_list);
+#    endif
+            offset = name_list[0].n_value;
+          }
+#   endif /* !SUNOS_5 */
+#  else  /* sgi */
+      ptrdiff_t ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
+      if (ldav_off != -1)
+        offset = (long int) ldav_off & 0x7fffffff;
+#  endif /* sgi */
+    }
+
+  /* Make sure we have /dev/kmem open.  */
+  if (!getloadavg_initialized)
+    {
+#  ifndef SUNOS_5
+      int fd = open ("/dev/kmem", O_RDONLY | O_CLOEXEC);
+      if (0 <= fd)
+        {
+          channel = fd;
+          getloadavg_initialized = true;
+        }
+#  else /* SUNOS_5 */
+      /* We pass 0 for the kernel, corefile, and swapfile names
+         to use the currently running kernel.  */
+      kd = kvm_open (0, 0, 0, O_RDONLY, 0);
+      if (kd != NULL)
+        {
+          /* nlist the currently running kernel.  */
+          kvm_nlist (kd, name_list);
+          offset = name_list[0].n_value;
+          getloadavg_initialized = true;
+        }
+#  endif /* SUNOS_5 */
+    }
+
+  /* If we can, get the load average values.  */
+  if (offset && getloadavg_initialized)
+    {
+      /* Try to read the load.  */
+#  ifndef SUNOS_5
+      if (lseek (channel, offset, 0) == -1L
+          || read (channel, (char *) load_ave, sizeof (load_ave))
+          != sizeof (load_ave))
+        {
+          close (channel);
+          getloadavg_initialized = false;
+        }
+#  else  /* SUNOS_5 */
+      if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave))
+          != sizeof (load_ave))
+        {
+          kvm_close (kd);
+          getloadavg_initialized = false;
+        }
+#  endif /* SUNOS_5 */
+    }
+
+  if (offset == 0 || !getloadavg_initialized)
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
+# endif /* ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS */
+
+# if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS.  */
+  if (nelem > 0)
+    loadavg[elem++] = LDAV_CVT (load_ave[0]);
+  if (nelem > 1)
+    loadavg[elem++] = LDAV_CVT (load_ave[1]);
+  if (nelem > 2)
+    loadavg[elem++] = LDAV_CVT (load_ave[2]);
+
+#  define LDAV_DONE
+# endif /* !LDAV_DONE && LOAD_AVE_TYPE */
+
+# if !defined LDAV_DONE
+  errno = ENOSYS;
+  elem = -1;
+# endif
+  return elem;
+}
deleted file mode 120000 (symlink)
index d8a2fc922a03caabb80148b70eec36d46ec0778d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getlogin.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2f37569d35a45ccc2d9a697886046a8b94d451c8
--- /dev/null
@@ -0,0 +1,44 @@
+/* Provide a working getlogin for systems which lack it.
+
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible, 2010.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* Don't assume that UNICODE is not defined.  */
+# undef GetUserName
+# define GetUserName GetUserNameA
+#endif
+
+char *
+getlogin (void)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  static char login_name[1024];
+  DWORD sz = sizeof (login_name);
+
+  if (GetUserName (login_name, &sz))
+    return login_name;
+#endif
+  return NULL;
+}
deleted file mode 120000 (symlink)
index 3d40d75e989514de6ef97908ba0420d4c6f12771..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getndelim2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dc11f8dd21372f9b19f24da64b9aaf929fbf74fb
--- /dev/null
@@ -0,0 +1,210 @@
+/* getndelim2 - Read a line from a stream, stopping at one of 2 delimiters,
+   with bounded memory allocation.
+
+   Copyright (C) 1993, 1996-1998, 2000, 2003-2004, 2006, 2008-2024 Free
+   Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Originally written by Jan Brittenson, bson@gnu.ai.mit.edu.  */
+
+#include <config.h>
+
+#include "getndelim2.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+#if !HAVE_FLOCKFILE
+# undef flockfile
+# define flockfile(x) ((void) 0)
+#endif
+#if !HAVE_FUNLOCKFILE
+# undef funlockfile
+# define funlockfile(x) ((void) 0)
+#endif
+
+#include <limits.h>
+#include <stdint.h>
+
+#include "freadptr.h"
+#include "freadseek.h"
+#include "memchr2.h"
+
+/* Avoid false GCC warning "'c' may be used uninitialized".  */
+#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
+
+/* The maximum value that getndelim2 can return without suffering from
+   overflow problems, either internally (because of pointer
+   subtraction overflow) or due to the API (because of ssize_t).  */
+#define GETNDELIM2_MAXIMUM (PTRDIFF_MAX < SSIZE_MAX ? PTRDIFF_MAX : SSIZE_MAX)
+
+/* Try to add at least this many bytes when extending the buffer.
+   MIN_CHUNK must be no greater than GETNDELIM2_MAXIMUM.  */
+#define MIN_CHUNK 64
+
+ssize_t
+getndelim2 (char **lineptr, size_t *linesize, size_t offset, size_t nmax,
+            int delim1, int delim2, FILE *stream)
+{
+  size_t nbytes_avail;          /* Allocated but unused bytes in *LINEPTR.  */
+  char *read_pos;               /* Where we're reading into *LINEPTR. */
+  ssize_t bytes_stored = -1;
+  char *ptr = *lineptr;
+  size_t size = *linesize;
+  bool found_delimiter;
+
+  if (!ptr)
+    {
+      size = nmax < MIN_CHUNK ? nmax : MIN_CHUNK;
+      ptr = malloc (size);
+      if (!ptr)
+        return -1;
+    }
+
+  if (size < offset)
+    goto done;
+
+  nbytes_avail = size - offset;
+  read_pos = ptr + offset;
+
+  if (nbytes_avail == 0 && nmax <= size)
+    goto done;
+
+  /* Normalize delimiters, since memchr2 doesn't handle EOF.  */
+  if (delim1 == EOF)
+    delim1 = delim2;
+  else if (delim2 == EOF)
+    delim2 = delim1;
+
+  flockfile (stream);
+
+  found_delimiter = false;
+  do
+    {
+      /* Here always ptr + size == read_pos + nbytes_avail.
+         Also nbytes_avail > 0 || size < nmax.  */
+
+      int c;
+      const char *buffer;
+      size_t buffer_len;
+
+      buffer = freadptr (stream, &buffer_len);
+      if (buffer)
+        {
+          if (delim1 != EOF)
+            {
+              const char *end = memchr2 (buffer, delim1, delim2, buffer_len);
+              if (end)
+                {
+                  buffer_len = end - buffer + 1;
+                  found_delimiter = true;
+                }
+            }
+        }
+      else
+        {
+          c = getc (stream);
+          if (c == EOF)
+            {
+              /* Return partial line, if any.  */
+              if (read_pos == ptr)
+                goto unlock_done;
+              else
+                break;
+            }
+          if (c == delim1 || c == delim2)
+            found_delimiter = true;
+          buffer_len = 1;
+        }
+
+      /* We always want at least one byte left in the buffer, since we
+         always (unless we get an error while reading the first byte)
+         NUL-terminate the line buffer.  */
+
+      if (nbytes_avail < buffer_len + 1 && size < nmax)
+        {
+          /* Grow size proportionally, not linearly, to avoid O(n^2)
+             running time.  */
+          size_t newsize = size < MIN_CHUNK ? size + MIN_CHUNK : 2 * size;
+          char *newptr;
+
+          /* Increase newsize so that it becomes
+             >= (read_pos - ptr) + buffer_len.  */
+          if (newsize - (read_pos - ptr) < buffer_len + 1)
+            newsize = (read_pos - ptr) + buffer_len + 1;
+          /* Respect nmax.  This handles possible integer overflow.  */
+          if (! (size < newsize && newsize <= nmax))
+            newsize = nmax;
+
+          if (GETNDELIM2_MAXIMUM < newsize - offset)
+            {
+              size_t newsizemax = offset + GETNDELIM2_MAXIMUM + 1;
+              if (size == newsizemax)
+                goto unlock_done;
+              newsize = newsizemax;
+            }
+
+          nbytes_avail = newsize - (read_pos - ptr);
+          newptr = realloc (ptr, newsize);
+          if (!newptr)
+            goto unlock_done;
+          ptr = newptr;
+          size = newsize;
+          read_pos = size - nbytes_avail + ptr;
+        }
+
+      /* Here, if size < nmax, nbytes_avail >= buffer_len + 1.
+         If size == nmax, nbytes_avail > 0.  */
+
+      if (1 < nbytes_avail)
+        {
+          size_t copy_len = nbytes_avail - 1;
+          if (buffer_len < copy_len)
+            copy_len = buffer_len;
+          if (buffer)
+            memcpy (read_pos, buffer, copy_len);
+          else
+            *read_pos = c;
+          read_pos += copy_len;
+          nbytes_avail -= copy_len;
+        }
+
+      /* Here still nbytes_avail > 0.  */
+
+      if (buffer && freadseek (stream, buffer_len))
+        goto unlock_done;
+    }
+  while (!found_delimiter);
+
+  /* Done - NUL terminate and return the number of bytes read.
+     At this point we know that nbytes_avail >= 1.  */
+  *read_pos = '\0';
+
+  bytes_stored = read_pos - (ptr + offset);
+
+ unlock_done:
+  funlockfile (stream);
+
+ done:
+  *lineptr = ptr;
+  *linesize = size;
+  return bytes_stored ? bytes_stored : -1;
+}
deleted file mode 120000 (symlink)
index e481fa11ea49f52b181df381bc827786ca8fc8d3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getndelim2.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ed50d36ea41037b8f68beab7c084e617391702bd
--- /dev/null
@@ -0,0 +1,42 @@
+/* getndelim2 - Read a line from a stream, stopping at one of 2 delimiters,
+   with bounded memory allocation.
+
+   Copyright (C) 2003-2004, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef GETNDELIM2_H
+#define GETNDELIM2_H 1
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#define GETNLINE_NO_LIMIT ((size_t) -1)
+
+/* Read into a buffer *LINEPTR returned from malloc (or NULL),
+   pointing to *LINESIZE bytes of space.  Store the input bytes
+   starting at *LINEPTR + OFFSET, and null-terminate them.  Reallocate
+   the buffer as necessary, but if NMAX is not GETNLINE_NO_LIMIT
+   then do not allocate more than NMAX bytes; if the line is longer
+   than that, read and discard the extra bytes.  Stop reading after
+   the first occurrence of DELIM1 or DELIM2, whichever comes first;
+   a delimiter equal to EOF stands for no delimiter.  Read the
+   input bytes from STREAM.
+   Return the number of bytes read and stored at *LINEPTR + OFFSET (not
+   including the NUL terminator), or -1 on error or EOF.  */
+extern ssize_t getndelim2 (char **lineptr, size_t *linesize, size_t offset,
+                           size_t nmax, int delim1, int delim2,
+                           FILE *stream);
+
+#endif /* GETNDELIM2_H */
deleted file mode 120000 (symlink)
index f1cbe56833d65ad712efbb759604ceafae2a9202..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getopt-cdefs.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a1d304d49e876f0ca5c42aa52884308d45db4022
--- /dev/null
@@ -0,0 +1,70 @@
+/* getopt-on-non-glibc compatibility macros.
+   Copyright (C) 1989-2024 Free Software Foundation, Inc.
+   This file is part of gnulib.
+   Unlike most of the getopt implementation, it is NOT shared
+   with the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GETOPT_CDEFS_H
+#define _GETOPT_CDEFS_H 1
+
+/* This header should not be used directly; include getopt.h or
+   unistd.h instead.  It does not have a protective #error, because
+   the guard macro for getopt.h in gnulib is not fixed.  */
+
+/* getopt-core.h and getopt-ext.h are shared with GNU libc, and expect
+   a number of the internal macros supplied to GNU libc's headers by
+   sys/cdefs.h.  Provide fallback definitions for all of them.  */
+#if @HAVE_SYS_CDEFS_H@
+# include <sys/cdefs.h>
+#endif
+
+#ifndef __BEGIN_DECLS
+# ifdef __cplusplus
+#  define __BEGIN_DECLS extern "C" {
+# else
+#  define __BEGIN_DECLS /* nothing */
+# endif
+#endif
+#ifndef __END_DECLS
+# ifdef __cplusplus
+#  define __END_DECLS }
+# else
+#  define __END_DECLS /* nothing */
+# endif
+#endif
+
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_VERSION__
+# define __GNUC_PREREQ(maj, min) \
+        ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+# else
+#  define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+
+#ifndef __THROW
+# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
+#  if __cplusplus >= 201103L
+#   define __THROW      noexcept (true)
+#  else
+#   define __THROW      throw ()
+#  endif
+# else
+#  define __THROW
+# endif
+#endif
+
+#endif /* _GETOPT_CDEFS_H */
deleted file mode 120000 (symlink)
index c1c95e3ea24343282b7ecba5319e040a7573689a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getopt-core.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..12d09a25c0de35440778ddf5151b6821d0539c7c
--- /dev/null
@@ -0,0 +1,96 @@
+/* Declarations for getopt (basic, portable features only).
+   Copyright (C) 1989-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library and is also part of gnulib.
+   Patches to this file should be submitted to both projects.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GETOPT_CORE_H
+#define _GETOPT_CORE_H 1
+
+/* This header should not be used directly; include getopt.h or
+   unistd.h instead.  Unlike most bits headers, it does not have
+   a protective #error, because the guard macro for getopt.h in
+   gnulib is not fixed.  */
+
+__BEGIN_DECLS
+
+/* For communication from 'getopt' to the caller.
+   When 'getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when 'ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to 'getopt'.
+
+   On entry to 'getopt', zero means this is the first call; initialize.
+
+   When 'getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, 'optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message 'getopt' prints
+   for unrecognized options.  */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized.  */
+
+extern int optopt;
+
+/* Get definitions and prototypes for functions to process the
+   arguments in ARGV (ARGC of them, minus the program name) for
+   options given in OPTS.
+
+   Return the option character from OPTS just read.  Return -1 when
+   there are no more options.  For unrecognized options, or options
+   missing arguments, 'optopt' is set to the option letter, and '?' is
+   returned.
+
+   The OPTS string is a list of characters which are recognized option
+   letters, optionally followed by colons, specifying that that letter
+   takes an argument, to be placed in 'optarg'.
+
+   If a letter in OPTS is followed by two colons, its argument is
+   optional.  This behavior is specific to the GNU 'getopt'.
+
+   The argument '--' causes premature termination of argument
+   scanning, explicitly telling 'getopt' that there are no more
+   options.
+
+   If OPTS begins with '-', then non-option arguments are treated as
+   arguments to the option '\1'.  This behavior is specific to the GNU
+   'getopt'.  If OPTS begins with '+', or POSIXLY_CORRECT is set in
+   the environment, then do not permute arguments.
+
+   For standards compliance, the 'argv' argument has the type
+   char *const *, but this is inaccurate; if argument permutation is
+   enabled, the argv array (not the strings it points to) must be
+   writable.  */
+
+extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
+       __THROW _GL_ARG_NONNULL ((2, 3));
+
+__END_DECLS
+
+#endif /* _GETOPT_CORE_H */
deleted file mode 120000 (symlink)
index 9e083ba7746edc82174e9e8127b3a9e627c4defe..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getopt-ext.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e4b499d4e823c3358f8e10569c1d575ecfb8b082
--- /dev/null
@@ -0,0 +1,77 @@
+/* Declarations for getopt (GNU extensions).
+   Copyright (C) 1989-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library and is also part of gnulib.
+   Patches to this file should be submitted to both projects.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GETOPT_EXT_H
+#define _GETOPT_EXT_H 1
+
+/* This header should not be used directly; include getopt.h instead.
+   Unlike most bits headers, it does not have a protective #error,
+   because the guard macro for getopt.h in gnulib is not fixed.  */
+
+__BEGIN_DECLS
+
+/* Describe the long-named options requested by the application.
+   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+   of 'struct option' terminated by an element containing a name which is
+   zero.
+
+   The field 'has_arg' is:
+   no_argument         (or 0) if the option does not take an argument,
+   required_argument   (or 1) if the option requires an argument,
+   optional_argument   (or 2) if the option takes an optional argument.
+
+   If the field 'flag' is not NULL, it points to a variable that is set
+   to the value given in the field 'val' when the option is found, but
+   left unchanged if the option is not found.
+
+   To have a long-named option do something other than set an 'int' to
+   a compiled-in constant, such as set a value from 'optarg', set the
+   option's 'flag' field to zero and its 'val' field to a nonzero
+   value (the equivalent single-letter option character, if there is
+   one).  For long options that have a zero 'flag' field, 'getopt'
+   returns the contents of the 'val' field.  */
+
+struct option
+{
+  const char *name;
+  /* has_arg can't be an enum because some compilers complain about
+     type mismatches in all the code that assumes it is an int.  */
+  int has_arg;
+  int *flag;
+  int val;
+};
+
+/* Names for the values of the 'has_arg' field of 'struct option'.  */
+
+#define no_argument            0
+#define required_argument      1
+#define optional_argument      2
+
+extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
+                       const char *__shortopts,
+                       const struct option *__longopts, int *__longind)
+       __THROW _GL_ARG_NONNULL ((2, 3));
+extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
+                            const char *__shortopts,
+                            const struct option *__longopts, int *__longind)
+       __THROW _GL_ARG_NONNULL ((2, 3));
+
+__END_DECLS
+
+#endif /* _GETOPT_EXT_H */
deleted file mode 120000 (symlink)
index 30156fe86534cccda8c91633747348712fac1b33..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getopt-pfx-core.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..78b7816aa42aa5a7cacd0a383a002f861b674029
--- /dev/null
@@ -0,0 +1,66 @@
+/* getopt (basic, portable features) gnulib wrapper header.
+   Copyright (C) 1989-2024 Free Software Foundation, Inc.
+   This file is part of gnulib.
+   Unlike most of the getopt implementation, it is NOT shared
+   with the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GETOPT_PFX_CORE_H
+#define _GETOPT_PFX_CORE_H 1
+
+/* This header should not be used directly; include getopt.h or
+   unistd.h instead.  It does not have a protective #error, because
+   the guard macro for getopt.h in gnulib is not fixed.  */
+
+/* Standalone applications should #define __GETOPT_PREFIX to an
+   identifier that prefixes the external functions and variables
+   defined in getopt-core.h and getopt-ext.h.  Systematically
+   rename identifiers so that they do not collide with the system
+   functions and variables.  Renaming avoids problems with some
+   compilers and linkers.  */
+#ifdef __GETOPT_PREFIX
+# ifndef __GETOPT_ID
+#  define __GETOPT_CONCAT(x, y) x ## y
+#  define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
+#  define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
+# endif
+# undef getopt
+# undef optarg
+# undef opterr
+# undef optind
+# undef optopt
+# define getopt __GETOPT_ID (getopt)
+# define optarg __GETOPT_ID (optarg)
+# define opterr __GETOPT_ID (opterr)
+# define optind __GETOPT_ID (optind)
+# define optopt __GETOPT_ID (optopt)
+
+/* Work around a problem on macOS, which declares getopt with a
+   trailing __DARWIN_ALIAS(getopt) that would expand to something like
+   __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following
+   hack to suppress the macOS declaration <https://bugs.gnu.org/40205>.  */
+# ifdef __APPLE__
+#  define _GETOPT
+# endif
+
+/* The system's getopt.h may have already included getopt-core.h to
+   declare the unprefixed identifiers.  Undef _GETOPT_CORE_H so that
+   getopt-core.h declares them with prefixes.  */
+# undef _GETOPT_CORE_H
+#endif
+
+#include <getopt-core.h>
+
+#endif /* _GETOPT_PFX_CORE_H */
deleted file mode 120000 (symlink)
index 8fbd2849902f9c3e46b8c99df36a3418f864ddcb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getopt-pfx-ext.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f001c11e057436bbb57aaff4deb4f01f9b95fd6c
--- /dev/null
@@ -0,0 +1,70 @@
+/* getopt (GNU extensions) gnulib wrapper header.
+   Copyright (C) 1989-2024 Free Software Foundation, Inc.
+   This file is part of gnulib.
+   Unlike most of the getopt implementation, it is NOT shared
+   with the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GETOPT_PFX_EXT_H
+#define _GETOPT_PFX_EXT_H 1
+
+/* This header should not be used directly; include getopt.h instead.
+   It does not have a protective #error, because the guard macro for
+   getopt.h in gnulib is not fixed.  */
+
+/* Standalone applications should #define __GETOPT_PREFIX to an
+   identifier that prefixes the external functions and variables
+   defined in getopt-core.h and getopt-ext.h.  Systematically
+   rename identifiers so that they do not collide with the system
+   functions and variables.  Renaming avoids problems with some
+   compilers and linkers.  */
+#ifdef __GETOPT_PREFIX
+# ifndef __GETOPT_ID
+#  define __GETOPT_CONCAT(x, y) x ## y
+#  define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
+#  define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
+# endif
+# undef getopt_long
+# undef getopt_long_only
+# undef option
+# undef _getopt_internal
+# define getopt_long __GETOPT_ID (getopt_long)
+# define getopt_long_only __GETOPT_ID (getopt_long_only)
+# define option __GETOPT_ID (option)
+# define _getopt_internal __GETOPT_ID (getopt_internal)
+
+/* The system's getopt.h may have already included getopt-ext.h to
+   declare the unprefixed identifiers.  Undef _GETOPT_EXT_H so that
+   getopt-ext.h declares them with prefixes.  */
+# undef _GETOPT_EXT_H
+#endif
+
+/* Standalone applications get correct prototypes for getopt_long and
+   getopt_long_only; they declare "char **argv".  For backward
+   compatibility with old applications, if __GETOPT_PREFIX is not
+   defined, we supply GNU-libc-compatible, but incorrect, prototypes
+   using "char *const *argv".  (GNU libc is stuck with the incorrect
+   prototypes, as they are baked into older versions of LSB.)  */
+#ifndef __getopt_argv_const
+# if defined __GETOPT_PREFIX
+#  define __getopt_argv_const /* empty */
+# else
+#  define __getopt_argv_const const
+# endif
+#endif
+
+#include <getopt-ext.h>
+
+#endif /* _GETOPT_PFX_EXT_H */
deleted file mode 120000 (symlink)
index b8ec563f9835d7db757fdd115d0901b521527205..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getopt.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f66f119ec50ab3eb0f5810f4dec40ce008a3b338
--- /dev/null
@@ -0,0 +1,814 @@
+/* Getopt for GNU.
+   Copyright (C) 1987-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library and is also part of gnulib.
+   Patches to this file should be submitted to both projects.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+\f
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+#include <getopt.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifdef _LIBC
+/* When used as part of glibc, error printing must be done differently
+   for standards compliance.  getopt is not a cancellation point, so
+   it must not call functions that are, and it is specified by an
+   older standard than stdio locking, so it must not refer to
+   functions in the "user namespace" related to stdio locking.
+   Finally, it must use glibc's internal message translation so that
+   the messages are looked up in the proper text domain.  */
+# include <libintl.h>
+# define fprintf __fxprintf_nocancel
+# define flockfile(fp) _IO_flockfile (fp)
+# define funlockfile(fp) _IO_funlockfile (fp)
+#else
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+/* When used standalone, flockfile and funlockfile might not be
+   available.  */
+# if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \
+      || (defined _WIN32 && ! defined __CYGWIN__))
+#  define flockfile(fp) /* nop */
+#  define funlockfile(fp) /* nop */
+# endif
+/* When used standalone, do not attempt to use alloca.  */
+# define __libc_use_alloca(size) 0
+# undef alloca
+# define alloca(size) (abort (), (void *)0)
+#endif
+
+/* This implementation of 'getopt' has three modes for handling
+   options interspersed with non-option arguments.  It can stop
+   scanning for options at the first non-option argument encountered,
+   as POSIX specifies.  It can continue scanning for options after the
+   first non-option argument, but permute 'argv' as it goes so that,
+   after 'getopt' is done, all the options precede all the non-option
+   arguments and 'optind' points to the first non-option argument.
+   Or, it can report non-option arguments as if they were arguments to
+   the option character '\x01'.
+
+   The default behavior of 'getopt_long' is to permute the argument list.
+   When this implementation is used standalone, the default behavior of
+   'getopt' is to stop at the first non-option argument, but when it is
+   used as part of GNU libc it also permutes the argument list.  In both
+   cases, setting the environment variable POSIXLY_CORRECT to any value
+   disables permutation.
+
+   If the first character of the OPTSTRING argument to 'getopt' or
+   'getopt_long' is '+', both functions will stop at the first
+   non-option argument.  If it is '-', both functions will report
+   non-option arguments as arguments to the option character '\x01'.  */
+
+#include "getopt_int.h"
+
+/* For communication from 'getopt' to the caller.
+   When 'getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when 'ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to 'getopt'.
+
+   On entry to 'getopt', zero means this is the first call; initialize.
+
+   When 'getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, 'optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+/* 1003.2 says this must be 1 before any call.  */
+int optind = 1;
+
+/* Callers store zero here to inhibit the error message
+   for unrecognized options.  */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+   This must be initialized on some systems to avoid linking in the
+   system's own getopt implementation.  */
+
+int optopt = '?';
+
+/* Keep a global copy of all internal members of getopt_data.  */
+
+static struct _getopt_data getopt_data;
+\f
+/* Exchange two adjacent subsequences of ARGV.
+   One subsequence is elements [first_nonopt,last_nonopt)
+   which contains all the non-options that have been skipped so far.
+   The other is elements [last_nonopt,optind), which contains all
+   the options processed since those non-options were skipped.
+
+   'first_nonopt' and 'last_nonopt' are relocated so that they describe
+   the new indices of the non-options in ARGV after they are moved.  */
+
+static void
+exchange (char **argv, struct _getopt_data *d)
+{
+  int bottom = d->__first_nonopt;
+  int middle = d->__last_nonopt;
+  int top = d->optind;
+  char *tem;
+
+  /* Exchange the shorter segment with the far end of the longer segment.
+     That puts the shorter segment into the right place.
+     It leaves the longer segment in the right place overall,
+     but it consists of two parts that need to be swapped next.  */
+
+  while (top > middle && middle > bottom)
+    {
+      if (top - middle > middle - bottom)
+       {
+         /* Bottom segment is the short one.  */
+         int len = middle - bottom;
+         int i;
+
+         /* Swap it with the top part of the top segment.  */
+         for (i = 0; i < len; i++)
+           {
+             tem = argv[bottom + i];
+             argv[bottom + i] = argv[top - (middle - bottom) + i];
+             argv[top - (middle - bottom) + i] = tem;
+           }
+         /* Exclude the moved bottom segment from further swapping.  */
+         top -= len;
+       }
+      else
+       {
+         /* Top segment is the short one.  */
+         int len = top - middle;
+         int i;
+
+         /* Swap it with the bottom part of the bottom segment.  */
+         for (i = 0; i < len; i++)
+           {
+             tem = argv[bottom + i];
+             argv[bottom + i] = argv[middle + i];
+             argv[middle + i] = tem;
+           }
+         /* Exclude the moved top segment from further swapping.  */
+         bottom += len;
+       }
+    }
+
+  /* Update records for the slots the non-options now occupy.  */
+
+  d->__first_nonopt += (d->optind - d->__last_nonopt);
+  d->__last_nonopt = d->optind;
+}
+
+/* Process the argument starting with d->__nextchar as a long option.
+   d->optind should *not* have been advanced over this argument.
+
+   If the value returned is -1, it was not actually a long option, the
+   state is unchanged, and the argument should be processed as a set
+   of short options (this can only happen when long_only is true).
+   Otherwise, the option (and its argument, if any) have been consumed
+   and the return value is the value to return from _getopt_internal_r.  */
+static int
+process_long_option (int argc, char **argv, const char *optstring,
+                    const struct option *longopts, int *longind,
+                    int long_only, struct _getopt_data *d,
+                    int print_errors, const char *prefix)
+{
+  char *nameend;
+  size_t namelen;
+  const struct option *p;
+  const struct option *pfound = NULL;
+  int n_options;
+  int option_index;
+
+  for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
+    /* Do nothing.  */ ;
+  namelen = nameend - d->__nextchar;
+
+  /* First look for an exact match, counting the options as a side
+     effect.  */
+  for (p = longopts, n_options = 0; p->name; p++, n_options++)
+    if (!strncmp (p->name, d->__nextchar, namelen)
+       && namelen == strlen (p->name))
+      {
+       /* Exact match found.  */
+       pfound = p;
+       option_index = n_options;
+       break;
+      }
+
+  if (pfound == NULL)
+    {
+      /* Didn't find an exact match, so look for abbreviations.  */
+      unsigned char *ambig_set = NULL;
+      /* Use simpler fallback diagnostic if ambig_set == &ambig_fallback.  */
+      unsigned char ambig_fallback;
+      void *ambig_malloced = NULL;
+      int indfound = -1;
+
+      for (p = longopts, option_index = 0; p->name; p++, option_index++)
+       if (!strncmp (p->name, d->__nextchar, namelen))
+         {
+           if (pfound == NULL)
+             {
+               /* First nonexact match found.  */
+               pfound = p;
+               indfound = option_index;
+             }
+           else if (long_only
+                    || pfound->has_arg != p->has_arg
+                    || pfound->flag != p->flag
+                    || pfound->val != p->val)
+             {
+               /* Second or later nonexact match found.  */
+               if (ambig_set != &ambig_fallback)
+                 {
+                   if (!print_errors)
+                     /* Don't waste effort tracking the ambig set if
+                        we're not going to print it anyway.  */
+                     ambig_set = &ambig_fallback;
+                   else if (!ambig_set)
+                     {
+                       if (__libc_use_alloca (n_options))
+                         ambig_set = alloca (n_options);
+                       else
+                         {
+                           ambig_malloced = malloc (n_options);
+                           /* Fall back to simpler diagnostic if
+                              memory allocation fails.  */
+                           ambig_set = (ambig_malloced ? ambig_malloced
+                                        : &ambig_fallback);
+                         }
+
+                       if (ambig_set != &ambig_fallback)
+                         {
+                           memset (ambig_set, 0, n_options);
+                           ambig_set[indfound] = 1;
+                         }
+                     }
+                   if (ambig_set && ambig_set != &ambig_fallback)
+                     ambig_set[option_index] = 1;
+                 }
+             }
+         }
+
+      if (ambig_set)
+       {
+         if (print_errors)
+           {
+             if (ambig_set == &ambig_fallback)
+               fprintf (stderr, _("%s: option '%s%s' is ambiguous\n"),
+                        argv[0], prefix, d->__nextchar);
+             else
+               {
+                 flockfile (stderr);
+                 fprintf (stderr,
+                          _("%s: option '%s%s' is ambiguous; possibilities:"),
+                          argv[0], prefix, d->__nextchar);
+
+                 for (option_index = 0; option_index < n_options; option_index++)
+                   if (ambig_set[option_index])
+                     fprintf (stderr, " '%s%s'",
+                              prefix, longopts[option_index].name);
+
+                 /* This must use 'fprintf' even though it's only
+                    printing a single character, so that it goes through
+                    __fxprintf_nocancel when compiled as part of glibc.  */
+                 fprintf (stderr, "\n");
+                 funlockfile (stderr);
+               }
+           }
+         free (ambig_malloced);
+         d->__nextchar += strlen (d->__nextchar);
+         d->optind++;
+         d->optopt = 0;
+         return '?';
+       }
+
+      option_index = indfound;
+    }
+
+  if (pfound == NULL)
+    {
+      /* Can't find it as a long option.  If this is not getopt_long_only,
+        or the option starts with '--' or is not a valid short option,
+        then it's an error.  */
+      if (!long_only || argv[d->optind][1] == '-'
+         || strchr (optstring, *d->__nextchar) == NULL)
+       {
+         if (print_errors)
+           fprintf (stderr, _("%s: unrecognized option '%s%s'\n"),
+                    argv[0], prefix, d->__nextchar);
+
+         d->__nextchar = NULL;
+         d->optind++;
+         d->optopt = 0;
+         return '?';
+       }
+
+      /* Otherwise interpret it as a short option.  */
+      return -1;
+    }
+
+  /* We have found a matching long option.  Consume it.  */
+  d->optind++;
+  d->__nextchar = NULL;
+  if (*nameend)
+    {
+      /* Don't test has_arg with >, because some C compilers don't
+        allow it to be used on enums.  */
+      if (pfound->has_arg)
+       d->optarg = nameend + 1;
+      else
+       {
+         if (print_errors)
+           fprintf (stderr,
+                    _("%s: option '%s%s' doesn't allow an argument\n"),
+                    argv[0], prefix, pfound->name);
+
+         d->optopt = pfound->val;
+         return '?';
+       }
+    }
+  else if (pfound->has_arg == 1)
+    {
+      if (d->optind < argc)
+       d->optarg = argv[d->optind++];
+      else
+       {
+         if (print_errors)
+           fprintf (stderr,
+                    _("%s: option '%s%s' requires an argument\n"),
+                    argv[0], prefix, pfound->name);
+
+         d->optopt = pfound->val;
+         return optstring[0] == ':' ? ':' : '?';
+       }
+    }
+
+  if (longind != NULL)
+    *longind = option_index;
+  if (pfound->flag)
+    {
+      *(pfound->flag) = pfound->val;
+      return 0;
+    }
+  return pfound->val;
+}
+
+/* Initialize internal data upon the first call to getopt.  */
+
+static const char *
+_getopt_initialize (_GL_UNUSED int argc,
+                   _GL_UNUSED char **argv, const char *optstring,
+                   struct _getopt_data *d, int posixly_correct)
+{
+  /* Start processing options with ARGV-element 1 (since ARGV-element 0
+     is the program name); the sequence of previously skipped
+     non-option ARGV-elements is empty.  */
+  if (d->optind == 0)
+    d->optind = 1;
+
+  d->__first_nonopt = d->__last_nonopt = d->optind;
+  d->__nextchar = NULL;
+
+  /* Determine how to handle the ordering of options and nonoptions.  */
+  if (optstring[0] == '-')
+    {
+      d->__ordering = RETURN_IN_ORDER;
+      ++optstring;
+    }
+  else if (optstring[0] == '+')
+    {
+      d->__ordering = REQUIRE_ORDER;
+      ++optstring;
+    }
+  else if (posixly_correct || !!getenv ("POSIXLY_CORRECT"))
+    d->__ordering = REQUIRE_ORDER;
+  else
+    d->__ordering = PERMUTE;
+
+  d->__initialized = 1;
+  return optstring;
+}
+\f
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+   given in OPTSTRING.
+
+   If an element of ARGV starts with '-', and is not exactly "-" or "--",
+   then it is an option element.  The characters of this element
+   (aside from the initial '-') are option characters.  If 'getopt'
+   is called repeatedly, it returns successively each of the option characters
+   from each of the option elements.
+
+   If 'getopt' finds another option character, it returns that character,
+   updating 'optind' and 'nextchar' so that the next call to 'getopt' can
+   resume the scan with the following option character or ARGV-element.
+
+   If there are no more option characters, 'getopt' returns -1.
+   Then 'optind' is the index in ARGV of the first ARGV-element
+   that is not an option.  (The ARGV-elements have been permuted
+   so that those that are not options now come last.)
+
+   OPTSTRING is a string containing the legitimate option characters.
+   If an option character is seen that is not listed in OPTSTRING,
+   return '?' after printing an error message.  If you set 'opterr' to
+   zero, the error message is suppressed but we still return '?'.
+
+   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+   so the following text in the same ARGV-element, or the text of the following
+   ARGV-element, is returned in 'optarg'.  Two colons mean an option that
+   wants an optional arg; if there is text in the current ARGV-element,
+   it is returned in 'optarg', otherwise 'optarg' is set to zero.
+
+   If OPTSTRING starts with '-' or '+', it requests different methods of
+   handling the non-option ARGV-elements.
+   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+   Long-named options begin with '--' instead of '-'.
+   Their names may be abbreviated as long as the abbreviation is unique
+   or is an exact match for some defined option.  If they have an
+   argument, it follows the option name in the same ARGV-element, separated
+   from the option name by a '=', or else the in next ARGV-element.
+   When 'getopt' finds a long-named option, it returns 0 if that option's
+   'flag' field is nonzero, the value of the option's 'val' field
+   if the 'flag' field is zero.
+
+   The elements of ARGV aren't really const, because we permute them.
+   But we pretend they're const in the prototype to be compatible
+   with other systems.
+
+   LONGOPTS is a vector of 'struct option' terminated by an
+   element containing a name which is zero.
+
+   LONGIND returns the index in LONGOPT of the long-named option found.
+   It is only valid when a long-named option has been found by the most
+   recent call.
+
+   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+   long-named options.  */
+
+int
+_getopt_internal_r (int argc, char **argv, const char *optstring,
+                   const struct option *longopts, int *longind,
+                   int long_only, struct _getopt_data *d, int posixly_correct)
+{
+  int print_errors = d->opterr;
+
+  if (argc < 1)
+    return -1;
+
+  d->optarg = NULL;
+
+  if (d->optind == 0 || !d->__initialized)
+    optstring = _getopt_initialize (argc, argv, optstring, d, posixly_correct);
+  else if (optstring[0] == '-' || optstring[0] == '+')
+    optstring++;
+
+  if (optstring[0] == ':')
+    print_errors = 0;
+
+  /* Test whether ARGV[optind] points to a non-option argument.  */
+#define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
+
+  if (d->__nextchar == NULL || *d->__nextchar == '\0')
+    {
+      /* Advance to the next ARGV-element.  */
+
+      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+        moved back by the user (who may also have changed the arguments).  */
+      if (d->__last_nonopt > d->optind)
+       d->__last_nonopt = d->optind;
+      if (d->__first_nonopt > d->optind)
+       d->__first_nonopt = d->optind;
+
+      if (d->__ordering == PERMUTE)
+       {
+         /* If we have just processed some options following some non-options,
+            exchange them so that the options come first.  */
+
+         if (d->__first_nonopt != d->__last_nonopt
+             && d->__last_nonopt != d->optind)
+           exchange (argv, d);
+         else if (d->__last_nonopt != d->optind)
+           d->__first_nonopt = d->optind;
+
+         /* Skip any additional non-options
+            and extend the range of non-options previously skipped.  */
+
+         while (d->optind < argc && NONOPTION_P)
+           d->optind++;
+         d->__last_nonopt = d->optind;
+       }
+
+      /* The special ARGV-element '--' means premature end of options.
+        Skip it like a null option,
+        then exchange with previous non-options as if it were an option,
+        then skip everything else like a non-option.  */
+
+      if (d->optind != argc && !strcmp (argv[d->optind], "--"))
+       {
+         d->optind++;
+
+         if (d->__first_nonopt != d->__last_nonopt
+             && d->__last_nonopt != d->optind)
+           exchange (argv, d);
+         else if (d->__first_nonopt == d->__last_nonopt)
+           d->__first_nonopt = d->optind;
+         d->__last_nonopt = argc;
+
+         d->optind = argc;
+       }
+
+      /* If we have done all the ARGV-elements, stop the scan
+        and back over any non-options that we skipped and permuted.  */
+
+      if (d->optind == argc)
+       {
+         /* Set the next-arg-index to point at the non-options
+            that we previously skipped, so the caller will digest them.  */
+         if (d->__first_nonopt != d->__last_nonopt)
+           d->optind = d->__first_nonopt;
+         return -1;
+       }
+
+      /* If we have come to a non-option and did not permute it,
+        either stop the scan or describe it to the caller and pass it by.  */
+
+      if (NONOPTION_P)
+       {
+         if (d->__ordering == REQUIRE_ORDER)
+           return -1;
+         d->optarg = argv[d->optind++];
+         return 1;
+       }
+
+      /* We have found another option-ARGV-element.
+        Check whether it might be a long option.  */
+      if (longopts)
+       {
+         if (argv[d->optind][1] == '-')
+           {
+             /* "--foo" is always a long option.  The special option
+                "--" was handled above.  */
+             d->__nextchar = argv[d->optind] + 2;
+             return process_long_option (argc, argv, optstring, longopts,
+                                         longind, long_only, d,
+                                         print_errors, "--");
+           }
+
+         /* If long_only and the ARGV-element has the form "-f",
+            where f is a valid short option, don't consider it an
+            abbreviated form of a long option that starts with f.
+            Otherwise there would be no way to give the -f short
+            option.
+
+            On the other hand, if there's a long option "fubar" and
+            the ARGV-element is "-fu", do consider that an
+            abbreviation of the long option, just like "--fu", and
+            not "-f" with arg "u".
+
+            This distinction seems to be the most useful approach.  */
+         if (long_only && (argv[d->optind][2]
+                           || !strchr (optstring, argv[d->optind][1])))
+           {
+             int code;
+             d->__nextchar = argv[d->optind] + 1;
+             code = process_long_option (argc, argv, optstring, longopts,
+                                         longind, long_only, d,
+                                         print_errors, "-");
+             if (code != -1)
+               return code;
+           }
+       }
+
+      /* It is not a long option.  Skip the initial punctuation.  */
+      d->__nextchar = argv[d->optind] + 1;
+    }
+
+  /* Look at and handle the next short option-character.  */
+
+  {
+    char c = *d->__nextchar++;
+    const char *temp = strchr (optstring, c);
+
+    /* Increment 'optind' when we start to process its last character.  */
+    if (*d->__nextchar == '\0')
+      ++d->optind;
+
+    if (temp == NULL || c == ':' || c == ';')
+      {
+       if (print_errors)
+         fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c);
+       d->optopt = c;
+       return '?';
+      }
+
+    /* Convenience. Treat POSIX -W foo same as long option --foo */
+    if (temp[0] == 'W' && temp[1] == ';' && longopts != NULL)
+      {
+       /* This is an option that requires an argument.  */
+       if (*d->__nextchar != '\0')
+         d->optarg = d->__nextchar;
+       else if (d->optind == argc)
+         {
+           if (print_errors)
+             fprintf (stderr,
+                      _("%s: option requires an argument -- '%c'\n"),
+                      argv[0], c);
+
+           d->optopt = c;
+           if (optstring[0] == ':')
+             c = ':';
+           else
+             c = '?';
+           return c;
+         }
+       else
+         d->optarg = argv[d->optind];
+
+       d->__nextchar = d->optarg;
+       d->optarg = NULL;
+       return process_long_option (argc, argv, optstring, longopts, longind,
+                                   0 /* long_only */, d, print_errors, "-W ");
+      }
+    if (temp[1] == ':')
+      {
+       if (temp[2] == ':')
+         {
+           /* This is an option that accepts an argument optionally.  */
+           if (*d->__nextchar != '\0')
+             {
+               d->optarg = d->__nextchar;
+               d->optind++;
+             }
+           else
+             d->optarg = NULL;
+           d->__nextchar = NULL;
+         }
+       else
+         {
+           /* This is an option that requires an argument.  */
+           if (*d->__nextchar != '\0')
+             {
+               d->optarg = d->__nextchar;
+               /* If we end this ARGV-element by taking the rest as an arg,
+                  we must advance to the next element now.  */
+               d->optind++;
+             }
+           else if (d->optind == argc)
+             {
+               if (print_errors)
+                 fprintf (stderr,
+                          _("%s: option requires an argument -- '%c'\n"),
+                          argv[0], c);
+
+               d->optopt = c;
+               if (optstring[0] == ':')
+                 c = ':';
+               else
+                 c = '?';
+             }
+           else
+             /* We already incremented 'optind' once;
+                increment it again when taking next ARGV-elt as argument.  */
+             d->optarg = argv[d->optind++];
+           d->__nextchar = NULL;
+         }
+      }
+    return c;
+  }
+}
+
+int
+_getopt_internal (int argc, char **argv, const char *optstring,
+                 const struct option *longopts, int *longind, int long_only,
+                 int posixly_correct)
+{
+  int result;
+
+  getopt_data.optind = optind;
+  getopt_data.opterr = opterr;
+
+  result = _getopt_internal_r (argc, argv, optstring, longopts,
+                              longind, long_only, &getopt_data,
+                              posixly_correct);
+
+  optind = getopt_data.optind;
+  optarg = getopt_data.optarg;
+  optopt = getopt_data.optopt;
+
+  return result;
+}
+
+/* glibc gets a LSB-compliant getopt and a POSIX-complaint __posix_getopt.
+   Standalone applications just get a POSIX-compliant getopt.
+   POSIX and LSB both require these functions to take 'char *const *argv'
+   even though this is incorrect (because of the permutation).  */
+#define GETOPT_ENTRY(NAME, POSIXLY_CORRECT)                    \
+  int                                                          \
+  NAME (int argc, char *const *argv, const char *optstring)    \
+  {                                                            \
+    return _getopt_internal (argc, (char **)argv, optstring,   \
+                            0, 0, 0, POSIXLY_CORRECT);         \
+  }
+
+#ifdef _LIBC
+GETOPT_ENTRY(getopt, 0)
+GETOPT_ENTRY(__posix_getopt, 1)
+#else
+GETOPT_ENTRY(getopt, 1)
+#endif
+
+\f
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+   the above definition of 'getopt'.  */
+
+int
+main (int argc, char **argv)
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+
+      c = getopt (argc, argv, "abc:d:0123456789");
+      if (c == -1)
+       break;
+
+      switch (c)
+       {
+       case '0':
+       case '1':
+       case '2':
+       case '3':
+       case '4':
+       case '5':
+       case '6':
+       case '7':
+       case '8':
+       case '9':
+         if (digit_optind != 0 && digit_optind != this_option_optind)
+           printf ("digits occur in two different argv-elements.\n");
+         digit_optind = this_option_optind;
+         printf ("option %c\n", c);
+         break;
+
+       case 'a':
+         printf ("option a\n");
+         break;
+
+       case 'b':
+         printf ("option b\n");
+         break;
+
+       case 'c':
+         printf ("option c with value '%s'\n", optarg);
+         break;
+
+       case '?':
+         break;
+
+       default:
+         printf ("?? getopt returned character code 0%o ??\n", c);
+       }
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+       printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
deleted file mode 120000 (symlink)
index ac6a6197edd1065ab891a4b89d45fc7755f50a50..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getopt.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c2411a754fa5827145fb0cc7dab89840c8dfbe05
--- /dev/null
@@ -0,0 +1,61 @@
+/* Declarations for getopt.
+   Copyright (C) 1989-2024 Free Software Foundation, Inc.
+   This file is part of gnulib.
+   Unlike most of the getopt implementation, it is NOT shared
+   with the GNU C Library, which supplies a different version of
+   this file.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_GETOPT_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  We must
+   also inform the replacement unistd.h to not recursively use
+   <getopt.h>; our definitions will be present soon enough.  */
+#if @HAVE_GETOPT_H@
+# define _GL_SYSTEM_GETOPT
+# @INCLUDE_NEXT@ @NEXT_GETOPT_H@
+# undef _GL_SYSTEM_GETOPT
+#endif
+
+#define _@GUARD_PREFIX@_GETOPT_H 1
+
+/* Standalone applications should #define __GETOPT_PREFIX to an
+   identifier that prefixes the external functions and variables
+   defined in getopt-core.h and getopt-ext.h.  When this happens,
+   include the headers that might declare getopt so that they will not
+   cause confusion if included after this file (if the system had
+   <getopt.h>, we have already included it).  */
+#if defined __GETOPT_PREFIX
+# if !@HAVE_GETOPT_H@
+#  define __need_system_stdlib_h
+#  include <stdlib.h>
+#  undef __need_system_stdlib_h
+#  include <stdio.h>
+#  include <unistd.h>
+# endif
+#endif
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+#include <getopt-cdefs.h>
+#include <getopt-pfx-core.h>
+#include <getopt-pfx-ext.h>
+
+#endif /* _@GUARD_PREFIX@_GETOPT_H */
deleted file mode 120000 (symlink)
index 184eb06603deeeab99f239d1e2861446929537b8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getopt1.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c42d29f8b57abf669cabe6a4875c13b2eeeebc24
--- /dev/null
@@ -0,0 +1,159 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+   Copyright (C) 1987-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library and is also part of gnulib.
+   Patches to this file should be submitted to both projects.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+\f
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+#include <getopt.h>
+#include "getopt_int.h"
+
+int
+getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
+            const struct option *long_options, int *opt_index)
+{
+  return _getopt_internal (argc, (char **) argv, options, long_options,
+                          opt_index, 0, 0);
+}
+
+int
+_getopt_long_r (int argc, char **argv, const char *options,
+               const struct option *long_options, int *opt_index,
+               struct _getopt_data *d)
+{
+  return _getopt_internal_r (argc, argv, options, long_options, opt_index,
+                            0, d, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+   If an option that starts with '-' (not '--') doesn't match a long option,
+   but does match a short option, it is parsed as a short option
+   instead.  */
+
+int
+getopt_long_only (int argc, char *__getopt_argv_const *argv,
+                 const char *options,
+                 const struct option *long_options, int *opt_index)
+{
+  return _getopt_internal (argc, (char **) argv, options, long_options,
+                          opt_index, 1, 0);
+}
+
+int
+_getopt_long_only_r (int argc, char **argv, const char *options,
+                    const struct option *long_options, int *opt_index,
+                    struct _getopt_data *d)
+{
+  return _getopt_internal_r (argc, argv, options, long_options, opt_index,
+                            1, d, 0);
+}
+
+\f
+#ifdef TEST
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (int argc, char **argv)
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+      int option_index = 0;
+      static const struct option long_options[] =
+      {
+       {"add", 1, 0, 0},
+       {"append", 0, 0, 0},
+       {"delete", 1, 0, 0},
+       {"verbose", 0, 0, 0},
+       {"create", 0, 0, 0},
+       {"file", 1, 0, 0},
+       {0, 0, 0, 0}
+      };
+
+      c = getopt_long (argc, argv, "abc:d:0123456789",
+                      long_options, &option_index);
+      if (c == -1)
+       break;
+
+      switch (c)
+       {
+       case 0:
+         printf ("option %s", long_options[option_index].name);
+         if (optarg)
+           printf (" with arg %s", optarg);
+         printf ("\n");
+         break;
+
+       case '0':
+       case '1':
+       case '2':
+       case '3':
+       case '4':
+       case '5':
+       case '6':
+       case '7':
+       case '8':
+       case '9':
+         if (digit_optind != 0 && digit_optind != this_option_optind)
+           printf ("digits occur in two different argv-elements.\n");
+         digit_optind = this_option_optind;
+         printf ("option %c\n", c);
+         break;
+
+       case 'a':
+         printf ("option a\n");
+         break;
+
+       case 'b':
+         printf ("option b\n");
+         break;
+
+       case 'c':
+         printf ("option c with value '%s'\n", optarg);
+         break;
+
+       case 'd':
+         printf ("option d with value '%s'\n", optarg);
+         break;
+
+       case '?':
+         break;
+
+       default:
+         printf ("?? getopt returned character code 0%o ??\n", c);
+       }
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+       printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
deleted file mode 120000 (symlink)
index f04f259a5d7461b0d0f76e4553010254e580f27f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getopt_int.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c00c0b6940422f4b3784089648cde5cf0e2d6495
--- /dev/null
@@ -0,0 +1,118 @@
+/* Internal declarations for getopt.
+   Copyright (C) 1989-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library and is also part of gnulib.
+   Patches to this file should be submitted to both projects.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GETOPT_INT_H
+#define _GETOPT_INT_H  1
+
+#include <getopt.h>
+
+extern int _getopt_internal (int ___argc, char **___argv,
+                            const char *__shortopts,
+                            const struct option *__longopts, int *__longind,
+                            int __long_only, int __posixly_correct);
+
+\f
+/* Reentrant versions which can handle parsing multiple argument
+   vectors at the same time.  */
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+   REQUIRE_ORDER means don't recognize them as options; stop option
+   processing when the first non-option is seen.  This is what POSIX
+   specifies should happen.
+
+   PERMUTE means permute the contents of ARGV as we scan, so that
+   eventually all the non-options are at the end.  This allows options
+   to be given in any order, even with programs that were not written
+   to expect this.
+
+   RETURN_IN_ORDER is an option available to programs that were
+   written to expect options and other ARGV-elements in any order
+   and that care about the ordering of the two.  We describe each
+   non-option ARGV-element as if it were the argument of an option
+   with character code 1.
+
+   The special argument '--' forces an end of option-scanning regardless
+   of the value of 'ordering'.  In the case of RETURN_IN_ORDER, only
+   '--' can cause 'getopt' to return -1 with 'optind' != ARGC.  */
+
+enum __ord
+  {
+    REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+  };
+
+/* Data type for reentrant functions.  */
+struct _getopt_data
+{
+  /* These have exactly the same meaning as the corresponding global
+     variables, except that they are used for the reentrant
+     versions of getopt.  */
+  int optind;
+  int opterr;
+  int optopt;
+  char *optarg;
+
+  /* Internal members.  */
+
+  /* True if the internal members have been initialized.  */
+  int __initialized;
+
+  /* The next char to be scanned in the option-element
+     in which the last option character we returned was found.
+     This allows us to pick up the scan where we left off.
+
+     If this is zero, or a null string, it means resume the scan
+     by advancing to the next ARGV-element.  */
+  char *__nextchar;
+
+  /* See __ord above.  */
+  enum __ord __ordering;
+
+  /* Handle permutation of arguments.  */
+
+  /* Describe the part of ARGV that contains non-options that have
+     been skipped.  'first_nonopt' is the index in ARGV of the first
+     of them; 'last_nonopt' is the index after the last of them.  */
+
+  int __first_nonopt;
+  int __last_nonopt;
+};
+
+/* The initializer is necessary to set OPTIND and OPTERR to their
+   default values and to clear the initialization flag.  */
+#define _GETOPT_DATA_INITIALIZER       { 1, 1 }
+
+extern int _getopt_internal_r (int ___argc, char **___argv,
+                              const char *__shortopts,
+                              const struct option *__longopts, int *__longind,
+                              int __long_only, struct _getopt_data *__data,
+                              int __posixly_correct);
+
+extern int _getopt_long_r (int ___argc, char **___argv,
+                          const char *__shortopts,
+                          const struct option *__longopts, int *__longind,
+                          struct _getopt_data *__data);
+
+extern int _getopt_long_only_r (int ___argc, char **___argv,
+                               const char *__shortopts,
+                               const struct option *__longopts,
+                               int *__longind,
+                               struct _getopt_data *__data);
+
+#endif /* getopt_int.h */
deleted file mode 120000 (symlink)
index 8c201342f5272bd69d77a7a898409f29bb49865d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getpagesize.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d203155329077876a0f6e26eaf3317381ebffe65
--- /dev/null
@@ -0,0 +1,39 @@
+/* getpagesize emulation for systems where it cannot be done in a C macro.
+
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible and Martin Lambers.  */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+/* This implementation is only for native Windows systems.  */
+#if defined _WIN32 && ! defined __CYGWIN__
+
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+int
+getpagesize (void)
+{
+  SYSTEM_INFO system_info;
+  GetSystemInfo (&system_info);
+  return system_info.dwPageSize;
+}
+
+#endif
deleted file mode 120000 (symlink)
index ae125b1a66a01110988dcc5caefad52cbf1a216d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getprogname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..392a9a2f9898ec10d572665d3eee8cd55b2c4d3d
--- /dev/null
@@ -0,0 +1,312 @@
+/* Program name management.
+   Copyright (C) 2016-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  Also get __argv declaration.  */
+#include <stdlib.h>
+
+#include <errno.h> /* get program_invocation_name declaration */
+
+#ifdef _AIX
+# include <unistd.h>
+# include <procinfo.h>
+# include <string.h>
+#endif
+
+#ifdef __MVS__
+# ifndef _OPEN_SYS
+#  define _OPEN_SYS
+# endif
+# include <string.h>
+# include <sys/ps.h>
+#endif
+
+#ifdef __hpux
+# include <unistd.h>
+# include <sys/param.h>
+# include <sys/pstat.h>
+# include <string.h>
+#endif
+
+#if defined __sgi || defined __osf__
+# include <string.h>
+# include <unistd.h>
+# include <stdio.h>
+# include <fcntl.h>
+# include <sys/procfs.h>
+#endif
+
+#if defined __SCO_VERSION__ || defined __sysv5__
+# include <fcntl.h>
+# include <string.h>
+#endif
+
+#include "basename-lgpl.h"
+
+#ifndef HAVE_GETPROGNAME  /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Solaris >= 11, Cygwin, Android API level >= 21 */
+char const *
+getprogname (void)
+{
+# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME                /* glibc, BeOS */
+  /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */
+  return program_invocation_short_name;
+# elif HAVE_DECL_PROGRAM_INVOCATION_NAME                    /* glibc, BeOS */
+  /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */
+  return last_component (program_invocation_name);
+# elif HAVE_GETEXECNAME                                     /* Solaris */
+  /* https://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */
+  const char *p = getexecname ();
+  if (!p)
+    p = "?";
+  return last_component (p);
+# elif HAVE_DECL___ARGV                                     /* mingw, MSVC */
+  /* https://docs.microsoft.com/en-us/cpp/c-runtime-library/argc-argv-wargv */
+  const char *p = __argv && __argv[0] ? __argv[0] : "?";
+  return last_component (p);
+# elif HAVE_VAR___PROGNAME                                  /* OpenBSD, Android, QNX */
+  /* https://man.openbsd.org/style.9 */
+  /* http://www.qnx.de/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fp%2F__progname.html */
+  /* Be careful to declare this only when we absolutely need it
+     (OpenBSD 5.1), rather than when it's available.  Otherwise,
+     its mere declaration makes program_invocation_short_name
+     malfunction (have zero length) with Fedora 25's glibc.  */
+  extern char *__progname;
+  const char *p = __progname;
+#  if defined __ANDROID__
+  return last_component (p);
+#  else
+  return p && p[0] ? p : "?";
+#  endif
+# elif _AIX                                                 /* AIX */
+  /* Idea by Bastien ROUCARIÈS,
+     https://lists.gnu.org/r/bug-gnulib/2010-12/msg00095.html
+     Reference: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_61/com.ibm.aix.basetrf1/getprocs.htm
+  */
+  static char *p;
+  static int first = 1;
+  if (first)
+    {
+      first = 0;
+      pid_t pid = getpid ();
+      struct procentry64 procs;
+      p = (0 < getprocs64 (&procs, sizeof procs, NULL, 0, &pid, 1)
+           ? strdup (procs.pi_comm)
+           : NULL);
+      if (!p)
+        p = "?";
+    }
+  return p;
+# elif defined __hpux
+  static char *p;
+  static int first = 1;
+  if (first)
+    {
+      first = 0;
+      pid_t pid = getpid ();
+      struct pst_status status;
+      if (pstat_getproc (&status, sizeof status, 0, pid) > 0)
+        {
+          char *ucomm = status.pst_ucomm;
+          char *cmd = status.pst_cmd;
+          if (strlen (ucomm) < PST_UCOMMLEN - 1)
+            p = ucomm;
+          else
+            {
+              /* ucomm is truncated to length PST_UCOMMLEN - 1.
+                 Look at cmd instead.  */
+              char *space = strchr (cmd, ' ');
+              if (space != NULL)
+                *space = '\0';
+              p = strrchr (cmd, '/');
+              if (p != NULL)
+                p++;
+              else
+                p = cmd;
+              if (strlen (p) > PST_UCOMMLEN - 1
+                  && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0)
+                /* p is less truncated than ucomm.  */
+                ;
+              else
+                p = ucomm;
+            }
+          p = strdup (p);
+        }
+      else
+        {
+#  if !defined __LP64__
+          /* Support for 32-bit programs running in 64-bit HP-UX.
+             The documented way to do this is to use the same source code
+             as above, but in a compilation unit where '#define _PSTAT64 1'
+             is in effect.  I prefer a single compilation unit; the struct
+             size and the offsets are not going to change.  */
+          char status64[1216];
+          if (__pstat_getproc64 (status64, sizeof status64, 0, pid) > 0)
+            {
+              char *ucomm = status64 + 288;
+              char *cmd = status64 + 168;
+              if (strlen (ucomm) < PST_UCOMMLEN - 1)
+                p = ucomm;
+              else
+                {
+                  /* ucomm is truncated to length PST_UCOMMLEN - 1.
+                     Look at cmd instead.  */
+                  char *space = strchr (cmd, ' ');
+                  if (space != NULL)
+                    *space = '\0';
+                  p = strrchr (cmd, '/');
+                  if (p != NULL)
+                    p++;
+                  else
+                    p = cmd;
+                  if (strlen (p) > PST_UCOMMLEN - 1
+                      && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0)
+                    /* p is less truncated than ucomm.  */
+                    ;
+                  else
+                    p = ucomm;
+                }
+              p = strdup (p);
+            }
+          else
+#  endif
+            p = NULL;
+        }
+      if (!p)
+        p = "?";
+    }
+  return p;
+# elif __MVS__                                              /* z/OS */
+  /* https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/rtwgetp.htm */
+  static char *p = "?";
+  static int first = 1;
+  if (first)
+    {
+      pid_t pid = getpid ();
+      int token;
+      W_PSPROC buf;
+      first = 0;
+      memset (&buf, 0, sizeof(buf));
+      buf.ps_cmdptr    = (char *) malloc (buf.ps_cmdlen    = PS_CMDBLEN_LONG);
+      buf.ps_conttyptr = (char *) malloc (buf.ps_conttylen = PS_CONTTYBLEN);
+      buf.ps_pathptr   = (char *) malloc (buf.ps_pathlen   = PS_PATHBLEN);
+      if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr)
+        {
+          for (token = 0; token >= 0;
+               token = w_getpsent (token, &buf, sizeof(buf)))
+            {
+              if (token > 0 && buf.ps_pid == pid)
+                {
+                  char *s = strdup (last_component (buf.ps_pathptr));
+                  if (s)
+                    {
+#  if defined __XPLINK__ && __CHARSET_LIB == 1
+                      /* The compiler option -qascii is in use.
+                         https://makingdeveloperslivesbetter.wordpress.com/2022/01/07/is-z-os-ascii-or-ebcdic-yes/
+                         https://www.ibm.com/docs/en/zos/2.5.0?topic=features-macros-related-compiler-option-settings
+                         So, convert the result from EBCDIC to ASCII.
+                         https://www.ibm.com/docs/en/zos/2.5.0?topic=functions-e2a-s-convert-string-from-ebcdic-ascii */
+                      if (__e2a_s (s) == (size_t)-1)
+                        free (s);
+                      else
+#  endif
+                        p = s;
+                    }
+                  break;
+                }
+            }
+        }
+      free (buf.ps_cmdptr);
+      free (buf.ps_conttyptr);
+      free (buf.ps_pathptr);
+    }
+  return p;
+# elif defined __sgi || defined __osf__                     /* IRIX or Tru64 */
+  char filename[50];
+  int fd;
+
+  # if defined __sgi
+    sprintf (filename, "/proc/pinfo/%d", (int) getpid ());
+  # else
+    sprintf (filename, "/proc/%d", (int) getpid ());
+  # endif
+  fd = open (filename, O_RDONLY | O_CLOEXEC);
+  if (0 <= fd)
+    {
+      prpsinfo_t buf;
+      int ioctl_ok = 0 <= ioctl (fd, PIOCPSINFO, &buf);
+      close (fd);
+      if (ioctl_ok)
+        {
+          char *name = buf.pr_fname;
+          size_t namesize = sizeof buf.pr_fname;
+          /* It may not be NUL-terminated.  */
+          char *namenul = memchr (name, '\0', namesize);
+          size_t namelen = namenul ? namenul - name : namesize;
+          char *namecopy = malloc (namelen + 1);
+          if (namecopy)
+            {
+              namecopy[namelen] = '\0';
+              return memcpy (namecopy, name, namelen);
+            }
+        }
+    }
+  return NULL;
+# elif defined __SCO_VERSION__ || defined __sysv5__                /* SCO OpenServer6/UnixWare */
+  char buf[80];
+  int fd;
+  sprintf (buf, "/proc/%d/cmdline", getpid());
+  fd = open (buf, O_RDONLY);
+  if (0 <= fd)
+    {
+      size_t n = read (fd, buf, 79);
+      if (n > 0)
+        {
+          buf[n] = '\0'; /* Guarantee null-termination */
+          char *progname;
+          progname = strrchr (buf, '/');
+          if (progname)
+            {
+              progname = progname + 1; /* Skip the '/' */
+            }
+          else
+            {
+              progname = buf;
+            }
+          char *ret;
+          ret = malloc (strlen (progname) + 1);
+          if (ret)
+            {
+              strcpy (ret, progname);
+              return ret;
+            }
+        }
+      close (fd);
+    }
+  return "?";
+# else
+#  error "getprogname module not ported to this OS"
+# endif
+}
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 36a2510b5c4fc385281ab4ac63cae1d574a5acc0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getprogname.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bee1c1a21acf04167007258f8dbb90097c7de5ef
--- /dev/null
@@ -0,0 +1,26 @@
+/* Program name management.
+   Copyright (C) 2016-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_GETPROGNAME_H
+#define _GL_GETPROGNAME_H
+
+#include <stdlib.h>
+
+#if __GNUC__ || (__clang_major__ >= 4)
+# warning "The include file getprogname.h is deprecated. Use <stdlib.h> instead."
+#endif
+
+#endif
deleted file mode 120000 (symlink)
index 688ce79a557e3d61d769d40c5d094c36556cb1c4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getrandom.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..44283cf1816ae322657d3521a7bdf02140c038ed
--- /dev/null
@@ -0,0 +1,190 @@
+/* Obtain a series of random bytes.
+
+   Copyright 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include <sys/random.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# if HAVE_BCRYPT_H
+#  include <bcrypt.h>
+# else
+#  define NTSTATUS LONG
+typedef void * BCRYPT_ALG_HANDLE;
+#  define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002
+#  if HAVE_LIB_BCRYPT
+extern NTSTATUS WINAPI BCryptGenRandom (BCRYPT_ALG_HANDLE, UCHAR *, ULONG, ULONG);
+#  endif
+# endif
+# if !HAVE_LIB_BCRYPT
+#  include <wincrypt.h>
+#  ifndef CRYPT_VERIFY_CONTEXT
+#   define CRYPT_VERIFY_CONTEXT 0xF0000000
+#  endif
+# endif
+#endif
+
+#include "minmax.h"
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+/* Don't assume that UNICODE is not defined.  */
+# undef LoadLibrary
+# define LoadLibrary LoadLibraryA
+# undef CryptAcquireContext
+# define CryptAcquireContext CryptAcquireContextA
+
+# if !HAVE_LIB_BCRYPT
+
+/* Avoid warnings from gcc -Wcast-function-type.  */
+#  define GetProcAddress \
+    (void *) GetProcAddress
+
+/* BCryptGenRandom with the BCRYPT_USE_SYSTEM_PREFERRED_RNG flag works only
+   starting with Windows 7.  */
+typedef NTSTATUS (WINAPI * BCryptGenRandomFuncType) (BCRYPT_ALG_HANDLE, UCHAR *, ULONG, ULONG);
+static BCryptGenRandomFuncType BCryptGenRandomFunc = NULL;
+static BOOL initialized = FALSE;
+
+static void
+initialize (void)
+{
+  HMODULE bcrypt = LoadLibrary ("bcrypt.dll");
+  if (bcrypt != NULL)
+    {
+      BCryptGenRandomFunc =
+        (BCryptGenRandomFuncType) GetProcAddress (bcrypt, "BCryptGenRandom");
+    }
+  initialized = TRUE;
+}
+
+# else
+
+#  define BCryptGenRandomFunc BCryptGenRandom
+
+# endif
+
+#else
+/* These devices exist on all platforms except native Windows.  */
+
+/* Name of a device through which the kernel returns high quality random
+   numbers, from an entropy pool.  When the pool is empty, the call blocks
+   until entropy sources have added enough bits of entropy.  */
+# ifndef NAME_OF_RANDOM_DEVICE
+#  define NAME_OF_RANDOM_DEVICE "/dev/random"
+# endif
+
+/* Name of a device through which the kernel returns random or pseudo-random
+   numbers.  It uses an entropy pool, but, in order to avoid blocking, adds
+   bits generated by a pseudo-random number generator, as needed.  */
+# ifndef NAME_OF_NONCE_DEVICE
+#  define NAME_OF_NONCE_DEVICE "/dev/urandom"
+# endif
+
+#endif
+
+/* Set BUFFER (of size LENGTH) to random bytes under the control of FLAGS.
+   Return the number of bytes written (> 0).
+   Upon error, return -1 and set errno.  */
+ssize_t
+getrandom (void *buffer, size_t length, unsigned int flags)
+#undef getrandom
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* BCryptGenRandom, defined in <bcrypt.h>
+     <https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom>
+     with the BCRYPT_USE_SYSTEM_PREFERRED_RNG flag
+     works in Windows 7 and newer.  */
+  static int bcrypt_not_working /* = 0 */;
+  if (!bcrypt_not_working)
+    {
+# if !HAVE_LIB_BCRYPT
+      if (!initialized)
+        initialize ();
+# endif
+      if (BCryptGenRandomFunc != NULL
+          && BCryptGenRandomFunc (NULL, buffer, length,
+                                  BCRYPT_USE_SYSTEM_PREFERRED_RNG)
+             == 0 /*STATUS_SUCCESS*/)
+        return length;
+      bcrypt_not_working = 1;
+    }
+# if !HAVE_LIB_BCRYPT
+  /* CryptGenRandom, defined in <wincrypt.h>
+     <https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom>
+     works in older releases as well, but is now deprecated.
+     CryptAcquireContext, defined in <wincrypt.h>
+     <https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptacquirecontexta>  */
+  {
+    static int crypt_initialized /* = 0 */;
+    static HCRYPTPROV provider;
+    if (!crypt_initialized)
+      {
+        if (CryptAcquireContext (&provider, NULL, NULL, PROV_RSA_FULL,
+                                 CRYPT_VERIFY_CONTEXT))
+          crypt_initialized = 1;
+        else
+          crypt_initialized = -1;
+      }
+    if (crypt_initialized >= 0)
+      {
+        if (!CryptGenRandom (provider, length, buffer))
+          {
+            errno = EIO;
+            return -1;
+          }
+        return length;
+      }
+  }
+# endif
+  errno = ENOSYS;
+  return -1;
+#elif HAVE_GETRANDOM
+  return getrandom (buffer, length, flags);
+#else
+  static int randfd[2] = { -1, -1 };
+  bool devrandom = (flags & GRND_RANDOM) != 0;
+  int fd = randfd[devrandom];
+
+  if (fd < 0)
+    {
+      static char const randdevice[][MAX (sizeof NAME_OF_NONCE_DEVICE,
+                                          sizeof NAME_OF_RANDOM_DEVICE)]
+        = { NAME_OF_NONCE_DEVICE, NAME_OF_RANDOM_DEVICE };
+      int oflags = (O_RDONLY + O_CLOEXEC
+                    + (flags & GRND_NONBLOCK ? O_NONBLOCK : 0));
+      fd = open (randdevice[devrandom], oflags);
+      if (fd < 0)
+        {
+          if (errno == ENOENT || errno == ENOTDIR)
+            errno = ENOSYS;
+          return -1;
+        }
+      randfd[devrandom] = fd;
+    }
+
+  return read (fd, buffer, length);
+#endif
+}
deleted file mode 120000 (symlink)
index 5adfec3b59e0945ee8391225d432c3144891c3ec..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/gettext.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..39d5ae4daa55772105516eb315c30f45aa23264b
--- /dev/null
@@ -0,0 +1,300 @@
+/* Convenience header for conditional use of GNU <libintl.h>.
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBGETTEXT_H
+#define _LIBGETTEXT_H 1
+
+/* NLS can be disabled through the configure --disable-nls option
+   or through "#define ENABLE NLS 0" before including this file.  */
+#if defined ENABLE_NLS && ENABLE_NLS
+
+/* Get declarations of GNU message catalog functions.  */
+# include <libintl.h>
+
+/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
+   the gettext() and ngettext() macros.  This is an alternative to calling
+   textdomain(), and is useful for libraries.  */
+# ifdef DEFAULT_TEXT_DOMAIN
+#  undef gettext
+#  define gettext(Msgid) \
+     dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
+#  undef ngettext
+#  define ngettext(Msgid1, Msgid2, N) \
+     dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
+# endif
+
+#else
+
+/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
+   chokes if dcgettext is defined as a macro.  So include it now, to make
+   later inclusions of <locale.h> a NOP.  We don't include <libintl.h>
+   as well because people using "gettext.h" will not include <libintl.h>,
+   and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
+   is OK.  */
+#if defined(__sun)
+# include <locale.h>
+#endif
+
+/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
+   <libintl.h>, which chokes if dcgettext is defined as a macro.  So include
+   it now, to make later inclusions of <libintl.h> a NOP.  */
+#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
+# include <cstdlib>
+# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
+#  include <libintl.h>
+# endif
+#endif
+
+/* Disabled NLS.
+   The casts to 'const char *' serve the purpose of producing warnings
+   for invalid uses of the value returned from these functions.
+   On pre-ANSI systems without 'const', the config.h file is supposed to
+   contain "#define const".  */
+# undef gettext
+# define gettext(Msgid) ((const char *) (Msgid))
+# undef dgettext
+# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
+# undef dcgettext
+# define dcgettext(Domainname, Msgid, Category) \
+    ((void) (Category), dgettext (Domainname, Msgid))
+# undef ngettext
+# define ngettext(Msgid1, Msgid2, N) \
+    ((N) == 1 \
+     ? ((void) (Msgid2), (const char *) (Msgid1)) \
+     : ((void) (Msgid1), (const char *) (Msgid2)))
+# undef dngettext
+# define dngettext(Domainname, Msgid1, Msgid2, N) \
+    ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
+# undef dcngettext
+# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
+    ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
+# undef textdomain
+# define textdomain(Domainname) ((const char *) (Domainname))
+# undef bindtextdomain
+# define bindtextdomain(Domainname, Dirname) \
+    ((void) (Domainname), (const char *) (Dirname))
+# undef bind_textdomain_codeset
+# define bind_textdomain_codeset(Domainname, Codeset) \
+    ((void) (Domainname), (const char *) (Codeset))
+
+#endif
+
+/* Prefer gnulib's setlocale override over libintl's setlocale override.  */
+#ifdef GNULIB_defined_setlocale
+# undef setlocale
+# define setlocale rpl_setlocale
+#endif
+
+/* A pseudo function call that serves as a marker for the automated
+   extraction of messages, but does not call gettext().  The run-time
+   translation is done at a different place in the code.
+   The argument, String, should be a literal string.  Concatenated strings
+   and other string expressions won't work.
+   The macro's expansion is not parenthesized, so that it is suitable as
+   initializer for static 'char[]' or 'const char[]' variables.  */
+#define gettext_noop(String) String
+
+/* The separator between msgctxt and msgid in a .mo file.  */
+#define GETTEXT_CONTEXT_GLUE "\004"
+
+/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
+   MSGID.  MSGCTXT and MSGID must be string literals.  MSGCTXT should be
+   short and rarely need to change.
+   The letter 'p' stands for 'particular' or 'special'.  */
+#ifdef DEFAULT_TEXT_DOMAIN
+# define pgettext(Msgctxt, Msgid) \
+   pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
+#else
+# define pgettext(Msgctxt, Msgid) \
+   pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
+#endif
+#define dpgettext(Domainname, Msgctxt, Msgid) \
+  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
+#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
+  pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
+#ifdef DEFAULT_TEXT_DOMAIN
+# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
+   npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
+#else
+# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
+   npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
+#endif
+#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
+  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
+#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
+  npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
+
+#if defined __GNUC__ || defined __clang__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static const char *
+pgettext_aux (const char *domain,
+              const char *msg_ctxt_id, const char *msgid,
+              int category)
+{
+  const char *translation = dcgettext (domain, msg_ctxt_id, category);
+  if (translation == msg_ctxt_id)
+    return msgid;
+  else
+    return translation;
+}
+
+#if defined __GNUC__ || defined __clang__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static const char *
+npgettext_aux (const char *domain,
+               const char *msg_ctxt_id, const char *msgid,
+               const char *msgid_plural, unsigned long int n,
+               int category)
+{
+  const char *translation =
+    dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
+  if (translation == msg_ctxt_id || translation == msgid_plural)
+    return (n == 1 ? msgid : msgid_plural);
+  else
+    return translation;
+}
+
+/* The same thing extended for non-constant arguments.  Here MSGCTXT and MSGID
+   can be arbitrary expressions.  But for string literals these macros are
+   less efficient than those above.  */
+
+#include <string.h>
+
+/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported.
+   This relates to the -Wvla and -Wvla-larger-than warnings, enabled in
+   the default GCC many warnings set.  This allows programs to disable use
+   of VLAs, which may be unintended, or may be awkward to support portably,
+   or may have security implications due to non-deterministic stack usage.  */
+
+#if (!defined GNULIB_NO_VLA \
+     && defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
+     && !defined __STDC_NO_VLA__)
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
+#else
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
+#endif
+
+#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+#include <stdlib.h>
+#endif
+
+#define pgettext_expr(Msgctxt, Msgid) \
+  dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
+#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
+  dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
+
+#if defined __GNUC__ || defined __clang__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static const char *
+dcpgettext_expr (const char *domain,
+                 const char *msgctxt, const char *msgid,
+                 int category)
+{
+  size_t msgctxt_len = strlen (msgctxt) + 1;
+  size_t msgid_len = strlen (msgid) + 1;
+  const char *translation;
+#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+  char msg_ctxt_id[msgctxt_len + msgid_len];
+#else
+  char buf[1024];
+  char *msg_ctxt_id =
+    (msgctxt_len + msgid_len <= sizeof (buf)
+     ? buf
+     : (char *) malloc (msgctxt_len + msgid_len));
+  if (msg_ctxt_id != NULL)
+#endif
+    {
+      int found_translation;
+      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
+      msg_ctxt_id[msgctxt_len - 1] = '\004';
+      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
+      translation = dcgettext (domain, msg_ctxt_id, category);
+      found_translation = (translation != msg_ctxt_id);
+#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+      if (msg_ctxt_id != buf)
+        free (msg_ctxt_id);
+#endif
+      if (found_translation)
+        return translation;
+    }
+  return msgid;
+}
+
+#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
+  dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
+#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
+  dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
+
+#if defined __GNUC__ || defined __clang__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static const char *
+dcnpgettext_expr (const char *domain,
+                  const char *msgctxt, const char *msgid,
+                  const char *msgid_plural, unsigned long int n,
+                  int category)
+{
+  size_t msgctxt_len = strlen (msgctxt) + 1;
+  size_t msgid_len = strlen (msgid) + 1;
+  const char *translation;
+#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+  char msg_ctxt_id[msgctxt_len + msgid_len];
+#else
+  char buf[1024];
+  char *msg_ctxt_id =
+    (msgctxt_len + msgid_len <= sizeof (buf)
+     ? buf
+     : (char *) malloc (msgctxt_len + msgid_len));
+  if (msg_ctxt_id != NULL)
+#endif
+    {
+      int found_translation;
+      memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
+      msg_ctxt_id[msgctxt_len - 1] = '\004';
+      memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
+      translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
+      found_translation = !(translation == msg_ctxt_id || translation == msgid_plural);
+#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+      if (msg_ctxt_id != buf)
+        free (msg_ctxt_id);
+#endif
+      if (found_translation)
+        return translation;
+    }
+  return (n == 1 ? msgid : msgid_plural);
+}
+
+#endif /* _LIBGETTEXT_H */
deleted file mode 120000 (symlink)
index 7a2cdcd50952cf83a3828a8e786384dd9e71340d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/gettime-res.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..afc828a5fb8ae5bfd69cecccabfd305dfe858d82
--- /dev/null
@@ -0,0 +1,93 @@
+/* Get the system clock resolution.
+
+   Copyright 2021-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "timespec.h"
+
+static long int _GL_ATTRIBUTE_CONST
+gcd (long int a, long int b)
+{
+  while (b != 0)
+    {
+      long int r = a % b;
+      a = b;
+      b = r;
+    }
+  return a;
+}
+
+/* Return the system time resolution in nanoseconds.  */
+
+long int
+gettime_res (void)
+{
+  struct timespec res;
+#if defined CLOCK_REALTIME && HAVE_CLOCK_GETRES
+  clock_getres (CLOCK_REALTIME, &res);
+#elif defined HAVE_TIMESPEC_GETRES
+  timespec_getres (&res, TIME_UTC);
+#else
+  /* Guess high and let the later code deduce better.  */
+  res.tv_sec = 1;
+  res.tv_nsec = 0;
+#endif
+
+  /* On all Gnulib platforms the following calculations do not overflow.  */
+
+  long int hz = TIMESPEC_HZ;
+  long int r = res.tv_nsec <= 0 ? hz : res.tv_nsec;
+  struct timespec earlier = { .tv_nsec = -1 };
+
+  /* On some platforms, clock_getres (CLOCK_REALTIME, ...) yields a
+     too-large resolution, under the mistaken theory that it should
+     return the timer interval.  For example, on AIX 7.2 POWER8
+     clock_getres yields 10 ms even though clock_gettime yields 1 μs
+     resolution.  Work around the problem with high probability by
+     trying clock_gettime several times and observing the resulting
+     bounds on resolution.  */
+  int nsamples = 32;
+  for (int i = 0; 1 < r && i < nsamples; i++)
+    {
+      /* If successive timestamps disagree the clock resolution must
+         be small, so exit the inner loop to check this sample.
+         Otherwise, arrange for the outer loop to exit but continue
+         the inner-loop search for a differing timestamp sample.  */
+      struct timespec now;
+      for (;; i = nsamples)
+        {
+          now = current_timespec ();
+          if (earlier.tv_nsec != now.tv_nsec || earlier.tv_sec != now.tv_sec)
+            break;
+        }
+      earlier = now;
+
+      if (0 < now.tv_nsec)
+        r = gcd (r, now.tv_nsec);
+    }
+
+  return r;
+}
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 476cde81cbbb7f48731832bdad16b696807939d2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/gettime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..38d368594150d4048222a25cccfef0d6562c77bd
--- /dev/null
@@ -0,0 +1,51 @@
+/* gettime -- get the system clock
+
+   Copyright (C) 2002, 2004-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "timespec.h"
+
+#include <sys/time.h>
+
+/* Get the system time into *TS.  */
+
+void
+gettime (struct timespec *ts)
+{
+#if defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME
+  clock_gettime (CLOCK_REALTIME, ts);
+#elif defined HAVE_TIMESPEC_GET
+  timespec_get (ts, TIME_UTC);
+#else
+  struct timeval tv;
+  gettimeofday (&tv, NULL);
+  *ts = (struct timespec) { .tv_sec  = tv.tv_sec,
+                            .tv_nsec = tv.tv_usec * 1000 };
+#endif
+}
+
+/* Return the current system time as a struct timespec.  */
+
+struct timespec
+current_timespec (void)
+{
+  struct timespec ts;
+  gettime (&ts);
+  return ts;
+}
deleted file mode 120000 (symlink)
index 679d1a879df2013443d1638a33d5fbdbc10a91b4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/gettimeofday.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8dd26f73c039ca1c89a88c5fa50310a622ab4c2d
--- /dev/null
@@ -0,0 +1,151 @@
+/* Provide gettimeofday for systems that don't have it or for which it's broken.
+
+   Copyright (C) 2001-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/time.h>
+
+#include <time.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WINDOWS_NATIVE
+# include <windows.h>
+#endif
+
+#ifdef WINDOWS_NATIVE
+
+/* Don't assume that UNICODE is not defined.  */
+# undef LoadLibrary
+# define LoadLibrary LoadLibraryA
+
+# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
+
+/* Avoid warnings from gcc -Wcast-function-type.  */
+#  define GetProcAddress \
+    (void *) GetProcAddress
+
+/* GetSystemTimePreciseAsFileTime was introduced only in Windows 8.  */
+typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime);
+static GetSystemTimePreciseAsFileTimeFuncType GetSystemTimePreciseAsFileTimeFunc = NULL;
+static BOOL initialized = FALSE;
+
+static void
+initialize (void)
+{
+  HMODULE kernel32 = LoadLibrary ("kernel32.dll");
+  if (kernel32 != NULL)
+    {
+      GetSystemTimePreciseAsFileTimeFunc =
+        (GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime");
+    }
+  initialized = TRUE;
+}
+
+# else
+
+#  define GetSystemTimePreciseAsFileTimeFunc GetSystemTimePreciseAsFileTime
+
+# endif
+
+#endif
+
+/* This is a wrapper for gettimeofday.  It is used only on systems
+   that lack this function, or whose implementation of this function
+   causes problems.
+   Work around the bug in some systems whereby gettimeofday clobbers
+   the static buffer that localtime uses for its return value.  The
+   gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
+   this problem.  */
+
+int
+gettimeofday (struct timeval *restrict tv, void *restrict tz)
+{
+#undef gettimeofday
+#ifdef WINDOWS_NATIVE
+
+  /* On native Windows, there are two ways to get the current time:
+     GetSystemTimeAsFileTime
+     <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>
+     or
+     GetSystemTimePreciseAsFileTime
+     <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>.
+     GetSystemTimeAsFileTime produces values that jump by increments of
+     15.627 milliseconds (!) on average.
+     Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2
+     microseconds.
+     More discussion on this topic:
+     <http://www.windowstimestamp.com/description>.  */
+  FILETIME current_time;
+
+# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
+  if (!initialized)
+    initialize ();
+# endif
+  if (GetSystemTimePreciseAsFileTimeFunc != NULL)
+    GetSystemTimePreciseAsFileTimeFunc (&current_time);
+  else
+    GetSystemTimeAsFileTime (&current_time);
+
+  /* Convert from FILETIME to 'struct timeval'.  */
+  /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */
+  ULONGLONG since_1601 =
+    ((ULONGLONG) current_time.dwHighDateTime << 32)
+    | (ULONGLONG) current_time.dwLowDateTime;
+  /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap
+     years, in total 134774 days.  */
+  ULONGLONG since_1970 =
+    since_1601 - (ULONGLONG) 134774 * (ULONGLONG) 86400 * (ULONGLONG) 10000000;
+  ULONGLONG microseconds_since_1970 = since_1970 / (ULONGLONG) 10;
+  *tv = (struct timeval) {
+    .tv_sec  = microseconds_since_1970 / (ULONGLONG) 1000000,
+    .tv_usec = microseconds_since_1970 % (ULONGLONG) 1000000
+  };
+
+  return 0;
+
+#else
+
+# if HAVE_GETTIMEOFDAY
+
+#  if defined timeval /* 'struct timeval' overridden by gnulib?  */
+#   undef timeval
+  struct timeval otv;
+  int result = gettimeofday (&otv, (struct timezone *) tz);
+  if (result == 0)
+    *tv = otv;
+#  else
+  int result = gettimeofday (tv, (struct timezone *) tz);
+#  endif
+
+  return result;
+
+# else
+
+#  if !defined OK_TO_USE_1S_CLOCK
+#   error "Only 1-second nominal clock resolution found.  Is that intended?" \
+          "If so, compile with the -DOK_TO_USE_1S_CLOCK option."
+#  endif
+  *tv = (struct timeval) { .tv_sec = time (NULL), .tv_usec = 0 };
+
+  return 0;
+
+# endif
+#endif
+}
deleted file mode 120000 (symlink)
index cd49cd672348e41e90a1822c23286b6ac07b416e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getugroups.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..445e7b2691f776adb68b58fec557658775334f37
--- /dev/null
@@ -0,0 +1,128 @@
+/* getugroups.c -- return a list of the groups a user is in
+
+   Copyright (C) 1990-1991, 1998-2000, 2003-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David MacKenzie. */
+
+#include <config.h>
+
+#include "getugroups.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h> /* grp.h on alpha OSF1 V2.0 uses "FILE *". */
+#include <string.h>
+#include <unistd.h>
+
+#if !HAVE_GRP_H || defined __ANDROID__
+
+/* Mingw lacks all things related to group management.  The best we
+   can do is fail with ENOSYS.
+
+   Bionic declares e.g. getgrent() in <grp.h> but it isn't actually
+   defined in the library.  */
+
+int
+getugroups (_GL_UNUSED int maxcount,
+            _GL_UNUSED gid_t *grouplist,
+            _GL_UNUSED char const *username,
+            _GL_UNUSED gid_t gid)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#else /* HAVE_GRP_H */
+# include <grp.h>
+
+# define STREQ(a, b) (strcmp (a, b) == 0)
+
+/* Like 'getgroups', but for user USERNAME instead of for the current
+   process.  Store at most MAXCOUNT group IDs in the GROUPLIST array.
+   If GID is not -1, store it first (if possible).  GID should be the
+   group ID (pw_gid) obtained from getpwuid, in case USERNAME is not
+   listed in /etc/groups.  Upon failure, set errno and return -1.
+   Otherwise, return the number of IDs we've written into GROUPLIST.  */
+
+int
+getugroups (int maxcount, gid_t *grouplist, char const *username,
+            gid_t gid)
+{
+  int count = 0;
+
+  if (gid != (gid_t) -1)
+    {
+      if (maxcount != 0)
+        grouplist[count] = gid;
+      ++count;
+    }
+
+  setgrent ();
+  while (1)
+    {
+      char **cp;
+      struct group *grp;
+
+      errno = 0;
+      grp = getgrent ();
+      if (grp == NULL)
+        break;
+
+      for (cp = grp->gr_mem; *cp; ++cp)
+        {
+          int n;
+
+          if ( ! STREQ (username, *cp))
+            continue;
+
+          /* See if this group number is already on the list.  */
+          for (n = 0; n < count; ++n)
+            if (grouplist && grouplist[n] == grp->gr_gid)
+              break;
+
+          /* If it's a new group number, then try to add it to the list.  */
+          if (n == count)
+            {
+              if (maxcount != 0)
+                {
+                  if (count >= maxcount)
+                    goto done;
+                  grouplist[count] = grp->gr_gid;
+                }
+              if (count == INT_MAX)
+                {
+                  errno = EOVERFLOW;
+                  goto done;
+                }
+              count++;
+            }
+        }
+    }
+
+  if (errno != 0)
+    count = -1;
+
+ done:
+  {
+    int saved_errno = errno;
+    endgrent ();
+    errno = saved_errno;
+  }
+
+  return count;
+}
+
+#endif /* HAVE_GRP_H */
deleted file mode 120000 (symlink)
index fc85a82c1656baf8726d504dff8a1bcd0c14e531..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/getugroups.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1fa4fd360d26ff4a60ec73ea79dd855b3d3d9ccd
--- /dev/null
@@ -0,0 +1,19 @@
+/* Get a list of group IDs associated with a specified user ID.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <sys/types.h>
+int getugroups (int maxcount, gid_t *grouplist, char const *username,
+                gid_t gid);
deleted file mode 120000 (symlink)
index 5dcd044195176cf3dd901a63982f682d7efdf702..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/gl_openssl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..06864732787ea722ec745d4d09ecc99400580c2b
--- /dev/null
@@ -0,0 +1,118 @@
+/* Wrap openssl crypto hash routines in gnulib interface.  -*- coding: utf-8 -*-
+
+   Copyright (C) 2013-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Pádraig Brady */
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#ifndef GL_OPENSSL_NAME
+# error "Please define GL_OPENSSL_NAME to 1,5,256 etc."
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef GL_OPENSSL_INLINE
+# define GL_OPENSSL_INLINE _GL_INLINE
+#endif
+
+/* Concatenate two preprocessor tokens.  */
+#define _GLCRYPTO_CONCAT_(prefix, suffix) prefix##suffix
+#define _GLCRYPTO_CONCAT(prefix, suffix) _GLCRYPTO_CONCAT_ (prefix, suffix)
+
+#if GL_OPENSSL_NAME == 5
+# define OPENSSL_ALG md5
+#else
+# define OPENSSL_ALG _GLCRYPTO_CONCAT (sha, GL_OPENSSL_NAME)
+#endif
+
+/* Context type mappings.  */
+#if BASE_OPENSSL_TYPE != GL_OPENSSL_NAME
+# undef BASE_OPENSSL_TYPE
+# if GL_OPENSSL_NAME == 224
+#  define BASE_OPENSSL_TYPE 256
+# elif GL_OPENSSL_NAME == 384
+#  define BASE_OPENSSL_TYPE 512
+# endif
+# define md5_CTX MD5_CTX
+# define sha1_CTX SHA_CTX
+# define sha224_CTX SHA256_CTX
+# define sha224_ctx sha256_ctx
+# define sha256_CTX SHA256_CTX
+# define sha384_CTX SHA512_CTX
+# define sha384_ctx sha512_ctx
+# define sha512_CTX SHA512_CTX
+# undef _gl_CTX
+# undef _gl_ctx
+# define _gl_CTX _GLCRYPTO_CONCAT (OPENSSL_ALG, _CTX) /* openssl type.  */
+# define _gl_ctx _GLCRYPTO_CONCAT (OPENSSL_ALG, _ctx) /* gnulib type.  */
+
+struct _gl_ctx { _gl_CTX CTX; };
+#endif
+
+/* Function name mappings.  */
+#define md5_prefix MD5
+#define sha1_prefix SHA1
+#define sha224_prefix SHA224
+#define sha256_prefix SHA256
+#define sha384_prefix SHA384
+#define sha512_prefix SHA512
+#define _GLCRYPTO_PREFIX _GLCRYPTO_CONCAT (OPENSSL_ALG, _prefix)
+#define OPENSSL_FN(suffix) _GLCRYPTO_CONCAT (_GLCRYPTO_PREFIX, suffix)
+#define GL_CRYPTO_FN(suffix) _GLCRYPTO_CONCAT (OPENSSL_ALG, suffix)
+
+GL_OPENSSL_INLINE void
+GL_CRYPTO_FN (_init_ctx) (struct _gl_ctx *ctx)
+{ (void) OPENSSL_FN (_Init) ((_gl_CTX *) ctx); }
+
+/* These were never exposed by gnulib.  */
+#if ! (GL_OPENSSL_NAME == 224 || GL_OPENSSL_NAME == 384)
+GL_OPENSSL_INLINE void
+GL_CRYPTO_FN (_process_bytes) (const void *buf, size_t len, struct _gl_ctx *ctx)
+{ OPENSSL_FN (_Update) ((_gl_CTX *) ctx, buf, len); }
+
+GL_OPENSSL_INLINE void
+GL_CRYPTO_FN (_process_block) (const void *buf, size_t len, struct _gl_ctx *ctx)
+{ GL_CRYPTO_FN (_process_bytes) (buf, len, ctx); }
+#endif
+
+GL_OPENSSL_INLINE void *
+GL_CRYPTO_FN (_finish_ctx) (struct _gl_ctx *ctx, void *restrict res)
+{ OPENSSL_FN (_Final) ((unsigned char *) res, (_gl_CTX *) ctx); return res; }
+
+GL_OPENSSL_INLINE void *
+GL_CRYPTO_FN (_buffer) (const char *buf, size_t len, void *restrict res)
+{ return OPENSSL_FN () ((const unsigned char *) buf, len, (unsigned char *) res); }
+
+GL_OPENSSL_INLINE void *
+GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *restrict res)
+{
+  /* Assume any unprocessed bytes in ctx are not to be ignored.  */
+  _gl_CTX tmp_ctx = *(_gl_CTX *) ctx;
+  OPENSSL_FN (_Final) ((unsigned char *) res, &tmp_ctx);
+  return res;
+}
+
+/* Undef so we can include multiple times.  */
+#undef GL_CRYPTO_FN
+#undef OPENSSL_FN
+#undef _GLCRYPTO_PREFIX
+#undef OPENSSL_ALG
+#undef GL_OPENSSL_NAME
+
+_GL_INLINE_HEADER_END
deleted file mode 120000 (symlink)
index b3e45e778d022f8e4220d927ccb1e14ccb0c4360..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/glthread/lock.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6661ad6a82c514418474d92414daf461472ebfd9
--- /dev/null
@@ -0,0 +1,749 @@
+/* Locking in multithreaded situations.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-posix.h, gthr-posix95.h.  */
+
+#include <config.h>
+
+#include "glthread/lock.h"
+
+/* ========================================================================= */
+
+#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+int
+glthread_lock_init (gl_lock_t *lock)
+{
+  if (mtx_init (&lock->mutex, mtx_plain) != thrd_success)
+    return ENOMEM;
+  lock->init_needed = 0;
+  return 0;
+}
+
+int
+glthread_lock_lock (gl_lock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  if (mtx_lock (&lock->mutex) != thrd_success)
+    return EAGAIN;
+  return 0;
+}
+
+int
+glthread_lock_unlock (gl_lock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  if (mtx_unlock (&lock->mutex) != thrd_success)
+    return EINVAL;
+  return 0;
+}
+
+int
+glthread_lock_destroy (gl_lock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  mtx_destroy (&lock->mutex);
+  return 0;
+}
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+int
+glthread_rwlock_init (gl_rwlock_t *lock)
+{
+  if (mtx_init (&lock->lock, mtx_plain) != thrd_success
+      || cnd_init (&lock->waiting_readers) != thrd_success
+      || cnd_init (&lock->waiting_writers) != thrd_success)
+    return ENOMEM;
+  lock->waiting_writers_count = 0;
+  lock->runcount = 0;
+  lock->init_needed = 0;
+  return 0;
+}
+
+int
+glthread_rwlock_rdlock (gl_rwlock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  if (mtx_lock (&lock->lock) != thrd_success)
+    return EAGAIN;
+  /* Test whether only readers are currently running, and whether the runcount
+     field will not overflow, and whether no writer is waiting.  The latter
+     condition is because POSIX recommends that "write locks shall take
+     precedence over read locks", to avoid "writer starvation".  */
+  while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+         waiting_readers.  */
+      if (cnd_wait (&lock->waiting_readers, &lock->lock) != thrd_success)
+        {
+          mtx_unlock (&lock->lock);
+          return EINVAL;
+        }
+    }
+  lock->runcount++;
+  if (mtx_unlock (&lock->lock) != thrd_success)
+    return EINVAL;
+  return 0;
+}
+
+int
+glthread_rwlock_wrlock (gl_rwlock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  if (mtx_lock (&lock->lock) != thrd_success)
+    return EAGAIN;
+  /* Test whether no readers or writers are currently running.  */
+  while (!(lock->runcount == 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+         waiting_writers.  */
+      lock->waiting_writers_count++;
+      if (cnd_wait (&lock->waiting_writers, &lock->lock) != thrd_success)
+        {
+          lock->waiting_writers_count--;
+          mtx_unlock (&lock->lock);
+          return EINVAL;
+        }
+      lock->waiting_writers_count--;
+    }
+  lock->runcount--; /* runcount becomes -1 */
+  if (mtx_unlock (&lock->lock) != thrd_success)
+    return EINVAL;
+  return 0;
+}
+
+int
+glthread_rwlock_unlock (gl_rwlock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  if (mtx_lock (&lock->lock) != thrd_success)
+    return EAGAIN;
+  if (lock->runcount < 0)
+    {
+      /* Drop a writer lock.  */
+      if (!(lock->runcount == -1))
+        {
+          mtx_unlock (&lock->lock);
+          return EINVAL;
+        }
+      lock->runcount = 0;
+    }
+  else
+    {
+      /* Drop a reader lock.  */
+      if (!(lock->runcount > 0))
+        {
+          mtx_unlock (&lock->lock);
+          return EINVAL;
+        }
+      lock->runcount--;
+    }
+  if (lock->runcount == 0)
+    {
+      /* POSIX recommends that "write locks shall take precedence over read
+         locks", to avoid "writer starvation".  */
+      if (lock->waiting_writers_count > 0)
+        {
+          /* Wake up one of the waiting writers.  */
+          if (cnd_signal (&lock->waiting_writers) != thrd_success)
+            {
+              mtx_unlock (&lock->lock);
+              return EINVAL;
+            }
+        }
+      else
+        {
+          /* Wake up all waiting readers.  */
+          if (cnd_broadcast (&lock->waiting_readers) != thrd_success)
+            {
+              mtx_unlock (&lock->lock);
+              return EINVAL;
+            }
+        }
+    }
+  if (mtx_unlock (&lock->lock) != thrd_success)
+    return EINVAL;
+  return 0;
+}
+
+int
+glthread_rwlock_destroy (gl_rwlock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  mtx_destroy (&lock->lock);
+  cnd_destroy (&lock->waiting_readers);
+  cnd_destroy (&lock->waiting_writers);
+  return 0;
+}
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+int
+glthread_recursive_lock_init (gl_recursive_lock_t *lock)
+{
+  if (mtx_init (&lock->mutex, mtx_plain | mtx_recursive) != thrd_success)
+    return ENOMEM;
+  lock->init_needed = 0;
+  return 0;
+}
+
+int
+glthread_recursive_lock_lock (gl_recursive_lock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  if (mtx_lock (&lock->mutex) != thrd_success)
+    return EAGAIN;
+  return 0;
+}
+
+int
+glthread_recursive_lock_unlock (gl_recursive_lock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  if (mtx_unlock (&lock->mutex) != thrd_success)
+    return EINVAL;
+  return 0;
+}
+
+int
+glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
+{
+  if (lock->init_needed)
+    call_once (&lock->init_once, lock->init_func);
+  mtx_destroy (&lock->mutex);
+  return 0;
+}
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1)))
+
+#  if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP
+
+#   if !HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER
+     /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */
+
+int
+glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock)
+{
+  pthread_rwlockattr_t attributes;
+  int err;
+
+  err = pthread_rwlockattr_init (&attributes);
+  if (err != 0)
+    return err;
+  /* Note: PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP is the only value that
+     causes the writer to be preferred. PTHREAD_RWLOCK_PREFER_WRITER_NP does not
+     do this; see
+     http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */
+  err = pthread_rwlockattr_setkind_np (&attributes,
+                                       PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
+  if (err == 0)
+    err = pthread_rwlock_init(lock, &attributes);
+  /* pthread_rwlockattr_destroy always returns 0.  It cannot influence the
+     return value.  */
+  pthread_rwlockattr_destroy (&attributes);
+  return err;
+}
+
+#   endif
+#  else
+
+int
+glthread_rwlock_init_multithreaded (gl_rwlock_t *lock)
+{
+  int err;
+
+  err = pthread_rwlock_init (&lock->rwlock, NULL);
+  if (err != 0)
+    return err;
+  lock->initialized = 1;
+  return 0;
+}
+
+int
+glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock)
+{
+  if (!lock->initialized)
+    {
+      int err;
+
+      err = pthread_mutex_lock (&lock->guard);
+      if (err != 0)
+        return err;
+      if (!lock->initialized)
+        {
+          err = glthread_rwlock_init_multithreaded (lock);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->guard);
+              return err;
+            }
+        }
+      err = pthread_mutex_unlock (&lock->guard);
+      if (err != 0)
+        return err;
+    }
+  return pthread_rwlock_rdlock (&lock->rwlock);
+}
+
+int
+glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock)
+{
+  if (!lock->initialized)
+    {
+      int err;
+
+      err = pthread_mutex_lock (&lock->guard);
+      if (err != 0)
+        return err;
+      if (!lock->initialized)
+        {
+          err = glthread_rwlock_init_multithreaded (lock);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->guard);
+              return err;
+            }
+        }
+      err = pthread_mutex_unlock (&lock->guard);
+      if (err != 0)
+        return err;
+    }
+  return pthread_rwlock_wrlock (&lock->rwlock);
+}
+
+int
+glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock)
+{
+  if (!lock->initialized)
+    return EINVAL;
+  return pthread_rwlock_unlock (&lock->rwlock);
+}
+
+int
+glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock)
+{
+  int err;
+
+  if (!lock->initialized)
+    return EINVAL;
+  err = pthread_rwlock_destroy (&lock->rwlock);
+  if (err != 0)
+    return err;
+  lock->initialized = 0;
+  return 0;
+}
+
+#  endif
+
+# else
+
+int
+glthread_rwlock_init_multithreaded (gl_rwlock_t *lock)
+{
+  int err;
+
+  err = pthread_mutex_init (&lock->lock, NULL);
+  if (err != 0)
+    return err;
+  err = pthread_cond_init (&lock->waiting_readers, NULL);
+  if (err != 0)
+    return err;
+  err = pthread_cond_init (&lock->waiting_writers, NULL);
+  if (err != 0)
+    return err;
+  lock->waiting_writers_count = 0;
+  lock->runcount = 0;
+  return 0;
+}
+
+int
+glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock)
+{
+  int err;
+
+  err = pthread_mutex_lock (&lock->lock);
+  if (err != 0)
+    return err;
+  /* Test whether only readers are currently running, and whether the runcount
+     field will not overflow, and whether no writer is waiting.  The latter
+     condition is because POSIX recommends that "write locks shall take
+     precedence over read locks", to avoid "writer starvation".  */
+  while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+         waiting_readers.  */
+      err = pthread_cond_wait (&lock->waiting_readers, &lock->lock);
+      if (err != 0)
+        {
+          pthread_mutex_unlock (&lock->lock);
+          return err;
+        }
+    }
+  lock->runcount++;
+  return pthread_mutex_unlock (&lock->lock);
+}
+
+int
+glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock)
+{
+  int err;
+
+  err = pthread_mutex_lock (&lock->lock);
+  if (err != 0)
+    return err;
+  /* Test whether no readers or writers are currently running.  */
+  while (!(lock->runcount == 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+         waiting_writers.  */
+      lock->waiting_writers_count++;
+      err = pthread_cond_wait (&lock->waiting_writers, &lock->lock);
+      if (err != 0)
+        {
+          lock->waiting_writers_count--;
+          pthread_mutex_unlock (&lock->lock);
+          return err;
+        }
+      lock->waiting_writers_count--;
+    }
+  lock->runcount--; /* runcount becomes -1 */
+  return pthread_mutex_unlock (&lock->lock);
+}
+
+int
+glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock)
+{
+  int err;
+
+  err = pthread_mutex_lock (&lock->lock);
+  if (err != 0)
+    return err;
+  if (lock->runcount < 0)
+    {
+      /* Drop a writer lock.  */
+      if (!(lock->runcount == -1))
+        {
+          pthread_mutex_unlock (&lock->lock);
+          return EINVAL;
+        }
+      lock->runcount = 0;
+    }
+  else
+    {
+      /* Drop a reader lock.  */
+      if (!(lock->runcount > 0))
+        {
+          pthread_mutex_unlock (&lock->lock);
+          return EINVAL;
+        }
+      lock->runcount--;
+    }
+  if (lock->runcount == 0)
+    {
+      /* POSIX recommends that "write locks shall take precedence over read
+         locks", to avoid "writer starvation".  */
+      if (lock->waiting_writers_count > 0)
+        {
+          /* Wake up one of the waiting writers.  */
+          err = pthread_cond_signal (&lock->waiting_writers);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->lock);
+              return err;
+            }
+        }
+      else
+        {
+          /* Wake up all waiting readers.  */
+          err = pthread_cond_broadcast (&lock->waiting_readers);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->lock);
+              return err;
+            }
+        }
+    }
+  return pthread_mutex_unlock (&lock->lock);
+}
+
+int
+glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock)
+{
+  int err;
+
+  err = pthread_mutex_destroy (&lock->lock);
+  if (err != 0)
+    return err;
+  err = pthread_cond_destroy (&lock->waiting_readers);
+  if (err != 0)
+    return err;
+  err = pthread_cond_destroy (&lock->waiting_writers);
+  if (err != 0)
+    return err;
+  return 0;
+}
+
+# endif
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+# if HAVE_PTHREAD_MUTEX_RECURSIVE
+
+#  if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+int
+glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
+{
+  pthread_mutexattr_t attributes;
+  int err;
+
+  err = pthread_mutexattr_init (&attributes);
+  if (err != 0)
+    return err;
+  err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE);
+  if (err != 0)
+    {
+      pthread_mutexattr_destroy (&attributes);
+      return err;
+    }
+  err = pthread_mutex_init (lock, &attributes);
+  if (err != 0)
+    {
+      pthread_mutexattr_destroy (&attributes);
+      return err;
+    }
+  err = pthread_mutexattr_destroy (&attributes);
+  if (err != 0)
+    return err;
+  return 0;
+}
+
+#  else
+
+int
+glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
+{
+  pthread_mutexattr_t attributes;
+  int err;
+
+  err = pthread_mutexattr_init (&attributes);
+  if (err != 0)
+    return err;
+  err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE);
+  if (err != 0)
+    {
+      pthread_mutexattr_destroy (&attributes);
+      return err;
+    }
+  err = pthread_mutex_init (&lock->recmutex, &attributes);
+  if (err != 0)
+    {
+      pthread_mutexattr_destroy (&attributes);
+      return err;
+    }
+  err = pthread_mutexattr_destroy (&attributes);
+  if (err != 0)
+    return err;
+  lock->initialized = 1;
+  return 0;
+}
+
+int
+glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
+{
+  if (!lock->initialized)
+    {
+      int err;
+
+      err = pthread_mutex_lock (&lock->guard);
+      if (err != 0)
+        return err;
+      if (!lock->initialized)
+        {
+          err = glthread_recursive_lock_init_multithreaded (lock);
+          if (err != 0)
+            {
+              pthread_mutex_unlock (&lock->guard);
+              return err;
+            }
+        }
+      err = pthread_mutex_unlock (&lock->guard);
+      if (err != 0)
+        return err;
+    }
+  return pthread_mutex_lock (&lock->recmutex);
+}
+
+int
+glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock)
+{
+  if (!lock->initialized)
+    return EINVAL;
+  return pthread_mutex_unlock (&lock->recmutex);
+}
+
+int
+glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock)
+{
+  int err;
+
+  if (!lock->initialized)
+    return EINVAL;
+  err = pthread_mutex_destroy (&lock->recmutex);
+  if (err != 0)
+    return err;
+  lock->initialized = 0;
+  return 0;
+}
+
+#  endif
+
+# else
+
+int
+glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
+{
+  int err;
+
+  err = pthread_mutex_init (&lock->mutex, NULL);
+  if (err != 0)
+    return err;
+  lock->owner = (pthread_t) 0;
+  lock->depth = 0;
+  return 0;
+}
+
+int
+glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
+{
+  pthread_t self = pthread_self ();
+  if (lock->owner != self)
+    {
+      int err;
+
+      err = pthread_mutex_lock (&lock->mutex);
+      if (err != 0)
+        return err;
+      lock->owner = self;
+    }
+  if (++(lock->depth) == 0) /* wraparound? */
+    {
+      lock->depth--;
+      return EAGAIN;
+    }
+  return 0;
+}
+
+int
+glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock)
+{
+  if (lock->owner != pthread_self ())
+    return EPERM;
+  if (lock->depth == 0)
+    return EINVAL;
+  if (--(lock->depth) == 0)
+    {
+      lock->owner = (pthread_t) 0;
+      return pthread_mutex_unlock (&lock->mutex);
+    }
+  else
+    return 0;
+}
+
+int
+glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock)
+{
+  if (lock->owner != (pthread_t) 0)
+    return EBUSY;
+  return pthread_mutex_destroy (&lock->mutex);
+}
+
+# endif
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT;
+
+int
+glthread_once_singlethreaded (pthread_once_t *once_control)
+{
+  /* We don't know whether pthread_once_t is an integer type, a floating-point
+     type, a pointer type, or a structure type.  */
+  char *firstbyte = (char *)once_control;
+  if (*firstbyte == *(const char *)&fresh_once)
+    {
+      /* First time use of once_control.  Invert the first byte.  */
+      *firstbyte = ~ *(const char *)&fresh_once;
+      return 1;
+    }
+  else
+    return 0;
+}
+
+# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK)
+
+int
+glthread_once_multithreaded (pthread_once_t *once_control,
+                             void (*init_function) (void))
+{
+  int err = pthread_once (once_control, init_function);
+  if (err == ENOSYS)
+    {
+      /* This happens on FreeBSD 11: The pthread_once function in libc returns
+         ENOSYS.  */
+      if (glthread_once_singlethreaded (once_control))
+        init_function ();
+      return 0;
+    }
+  return err;
+}
+
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WINDOWS_THREADS
+
+#endif
+
+/* ========================================================================= */
deleted file mode 120000 (symlink)
index 395661ee727ee3d85ef2b10dbd02e10f3a3894f1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/glthread/lock.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2d5cb3209c5fb28c965fd459af86d3b29f20cc27
--- /dev/null
@@ -0,0 +1,799 @@
+/* Locking in multithreaded situations.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h.  */
+
+/* This file contains locking primitives for use with a given thread library.
+   It does not contain primitives for creating threads or for other
+   synchronization primitives.
+
+   Normal (non-recursive) locks:
+     Type:                gl_lock_t
+     Declaration:         gl_lock_define(extern, name)
+     Initializer:         gl_lock_define_initialized(, name)
+     Initialization:      gl_lock_init (name);
+     Taking the lock:     gl_lock_lock (name);
+     Releasing the lock:  gl_lock_unlock (name);
+     De-initialization:   gl_lock_destroy (name);
+   Equivalent functions with control of error handling:
+     Initialization:      err = glthread_lock_init (&name);
+     Taking the lock:     err = glthread_lock_lock (&name);
+     Releasing the lock:  err = glthread_lock_unlock (&name);
+     De-initialization:   err = glthread_lock_destroy (&name);
+
+   Read-Write (non-recursive) locks:
+     Type:                gl_rwlock_t
+     Declaration:         gl_rwlock_define(extern, name)
+     Initializer:         gl_rwlock_define_initialized(, name)
+     Initialization:      gl_rwlock_init (name);
+     Taking the lock:     gl_rwlock_rdlock (name);
+                          gl_rwlock_wrlock (name);
+     Releasing the lock:  gl_rwlock_unlock (name);
+     De-initialization:   gl_rwlock_destroy (name);
+   Equivalent functions with control of error handling:
+     Initialization:      err = glthread_rwlock_init (&name);
+     Taking the lock:     err = glthread_rwlock_rdlock (&name);
+                          err = glthread_rwlock_wrlock (&name);
+     Releasing the lock:  err = glthread_rwlock_unlock (&name);
+     De-initialization:   err = glthread_rwlock_destroy (&name);
+
+   Recursive locks:
+     Type:                gl_recursive_lock_t
+     Declaration:         gl_recursive_lock_define(extern, name)
+     Initializer:         gl_recursive_lock_define_initialized(, name)
+     Initialization:      gl_recursive_lock_init (name);
+     Taking the lock:     gl_recursive_lock_lock (name);
+     Releasing the lock:  gl_recursive_lock_unlock (name);
+     De-initialization:   gl_recursive_lock_destroy (name);
+   Equivalent functions with control of error handling:
+     Initialization:      err = glthread_recursive_lock_init (&name);
+     Taking the lock:     err = glthread_recursive_lock_lock (&name);
+     Releasing the lock:  err = glthread_recursive_lock_unlock (&name);
+     De-initialization:   err = glthread_recursive_lock_destroy (&name);
+
+  Once-only execution:
+     Type:                gl_once_t
+     Initializer:         gl_once_define(extern, name)
+     Execution:           gl_once (name, initfunction);
+   Equivalent functions with control of error handling:
+     Execution:           err = glthread_once (&name, initfunction);
+*/
+
+
+#ifndef _LOCK_H
+#define _LOCK_H
+
+/* This file uses HAVE_THREADS_H, HAVE_PTHREAD_RWLOCK,
+   HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER,
+   PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+   HAVE_PTHREAD_MUTEX_RECURSIVE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+
+#if !defined c11_threads_in_use
+# if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC
+#  define c11_threads_in_use() 1
+# elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK
+#  include <threads.h>
+#  pragma weak thrd_exit
+#  define c11_threads_in_use() (thrd_exit != NULL)
+# else
+#  define c11_threads_in_use() 0
+# endif
+#endif
+
+/* ========================================================================= */
+
+#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+/* Use the ISO C threads library.  */
+
+# include <threads.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+typedef struct
+        {
+          int volatile init_needed;
+          once_flag init_once;
+          void (*init_func) (void);
+          mtx_t mutex;
+        }
+        gl_lock_t;
+# define gl_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_lock_t NAME;
+# define gl_lock_define_initialized(STORAGECLASS, NAME) \
+    static void _atomic_init_##NAME (void);       \
+    STORAGECLASS gl_lock_t NAME =                 \
+      { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \
+    static void _atomic_init_##NAME (void)        \
+    {                                             \
+      if (glthread_lock_init (&(NAME)))           \
+        abort ();                                 \
+    }
+extern int glthread_lock_init (gl_lock_t *lock);
+extern int glthread_lock_lock (gl_lock_t *lock);
+extern int glthread_lock_unlock (gl_lock_t *lock);
+extern int glthread_lock_destroy (gl_lock_t *lock);
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+typedef struct
+        {
+          int volatile init_needed;
+          once_flag init_once;
+          void (*init_func) (void);
+          mtx_t lock; /* protects the remaining fields */
+          cnd_t waiting_readers; /* waiting readers */
+          cnd_t waiting_writers; /* waiting writers */
+          unsigned int waiting_writers_count; /* number of waiting writers */
+          int runcount; /* number of readers running, or -1 when a writer runs */
+        }
+        gl_rwlock_t;
+# define gl_rwlock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_rwlock_t NAME;
+# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+    static void _atomic_init_##NAME (void);       \
+    STORAGECLASS gl_rwlock_t NAME =               \
+      { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \
+    static void _atomic_init_##NAME (void)        \
+    {                                             \
+      if (glthread_rwlock_init (&(NAME)))         \
+        abort ();                                 \
+    }
+extern int glthread_rwlock_init (gl_rwlock_t *lock);
+extern int glthread_rwlock_rdlock (gl_rwlock_t *lock);
+extern int glthread_rwlock_wrlock (gl_rwlock_t *lock);
+extern int glthread_rwlock_unlock (gl_rwlock_t *lock);
+extern int glthread_rwlock_destroy (gl_rwlock_t *lock);
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+typedef struct
+        {
+          int volatile init_needed;
+          once_flag init_once;
+          void (*init_func) (void);
+          mtx_t mutex;
+        }
+        gl_recursive_lock_t;
+# define gl_recursive_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_recursive_lock_t NAME;
+# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+    static void _atomic_init_##NAME (void);       \
+    STORAGECLASS gl_recursive_lock_t NAME =       \
+      { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \
+    static void _atomic_init_##NAME (void)        \
+    {                                             \
+      if (glthread_recursive_lock_init (&(NAME))) \
+        abort ();                                 \
+    }
+extern int glthread_recursive_lock_init (gl_recursive_lock_t *lock);
+extern int glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
+extern int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
+extern int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef once_flag gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+    STORAGECLASS once_flag NAME = ONCE_FLAG_INIT;
+# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+    (call_once (ONCE_CONTROL, INITFUNCTION), 0)
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+/* Use the POSIX threads library.  */
+
+# include <pthread.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if PTHREAD_IN_USE_DETECTION_HARD
+
+/* The pthread_in_use() detection needs to be done at runtime.  */
+#  define pthread_in_use() \
+     glthread_in_use ()
+extern int glthread_in_use (void);
+
+# endif
+
+# if USE_POSIX_THREADS_WEAK
+
+/* Use weak references to the POSIX threads library.  */
+
+/* Weak references avoid dragging in external libraries if the other parts
+   of the program don't use them.  Here we use them, because we don't want
+   every program that uses libintl to depend on libpthread.  This assumes
+   that libpthread would not be loaded after libintl; i.e. if libintl is
+   loaded first, by an executable that does not depend on libpthread, and
+   then a module is dynamically loaded that depends on libpthread, libintl
+   will not be multithread-safe.  */
+
+/* The way to test at runtime whether libpthread is present is to test
+   whether a function pointer's value, such as &pthread_mutex_init, is
+   non-NULL.  However, some versions of GCC have a bug through which, in
+   PIC mode, &foo != NULL always evaluates to true if there is a direct
+   call to foo(...) in the same function.  To avoid this, we test the
+   address of a function in libpthread that we don't use.  */
+
+#  pragma weak pthread_mutex_init
+#  pragma weak pthread_mutex_lock
+#  pragma weak pthread_mutex_unlock
+#  pragma weak pthread_mutex_destroy
+#  pragma weak pthread_rwlock_init
+#  pragma weak pthread_rwlock_rdlock
+#  pragma weak pthread_rwlock_wrlock
+#  pragma weak pthread_rwlock_unlock
+#  pragma weak pthread_rwlock_destroy
+#  pragma weak pthread_once
+#  pragma weak pthread_cond_init
+#  pragma weak pthread_cond_wait
+#  pragma weak pthread_cond_signal
+#  pragma weak pthread_cond_broadcast
+#  pragma weak pthread_cond_destroy
+#  pragma weak pthread_mutexattr_init
+#  pragma weak pthread_mutexattr_settype
+#  pragma weak pthread_mutexattr_destroy
+#  pragma weak pthread_rwlockattr_init
+#  if __GNU_LIBRARY__ > 1
+#   pragma weak pthread_rwlockattr_setkind_np
+#  endif
+#  pragma weak pthread_rwlockattr_destroy
+#  ifndef pthread_self
+#   pragma weak pthread_self
+#  endif
+
+#  if !PTHREAD_IN_USE_DETECTION_HARD
+    /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols
+       can be used to determine whether libpthread is in use.  These are:
+         pthread_mutexattr_gettype
+         pthread_rwlockattr_destroy
+         pthread_rwlockattr_init
+     */
+#   pragma weak pthread_mutexattr_gettype
+#   define pthread_in_use() \
+      (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
+#  endif
+
+# else
+
+#  if !PTHREAD_IN_USE_DETECTION_HARD
+#   define pthread_in_use() 1
+#  endif
+
+# endif
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+typedef pthread_mutex_t gl_lock_t;
+# define gl_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS pthread_mutex_t NAME;
+# define gl_lock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS pthread_mutex_t NAME = gl_lock_initializer;
+# define gl_lock_initializer \
+    PTHREAD_MUTEX_INITIALIZER
+# define glthread_lock_init(LOCK) \
+    (pthread_in_use () ? pthread_mutex_init (LOCK, NULL) : 0)
+# define glthread_lock_lock(LOCK) \
+    (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0)
+# define glthread_lock_unlock(LOCK) \
+    (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0)
+# define glthread_lock_destroy(LOCK) \
+    (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0)
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1)))
+
+#  if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP
+
+typedef pthread_rwlock_t gl_rwlock_t;
+#   define gl_rwlock_define(STORAGECLASS, NAME) \
+      STORAGECLASS pthread_rwlock_t NAME;
+#   define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+      STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer;
+#   if HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER
+#    if defined PTHREAD_RWLOCK_INITIALIZER
+#     define gl_rwlock_initializer \
+        PTHREAD_RWLOCK_INITIALIZER
+#    else
+#     define gl_rwlock_initializer \
+        PTHREAD_RWLOCK_INITIALIZER_NP
+#    endif
+#    define glthread_rwlock_init(LOCK) \
+       (pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0)
+#   else /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */
+#    define gl_rwlock_initializer \
+       PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
+#    define glthread_rwlock_init(LOCK) \
+       (pthread_in_use () ? glthread_rwlock_init_for_glibc (LOCK) : 0)
+extern int glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock);
+#   endif
+#   define glthread_rwlock_rdlock(LOCK) \
+      (pthread_in_use () ? pthread_rwlock_rdlock (LOCK) : 0)
+#   define glthread_rwlock_wrlock(LOCK) \
+      (pthread_in_use () ? pthread_rwlock_wrlock (LOCK) : 0)
+#   define glthread_rwlock_unlock(LOCK) \
+      (pthread_in_use () ? pthread_rwlock_unlock (LOCK) : 0)
+#   define glthread_rwlock_destroy(LOCK) \
+      (pthread_in_use () ? pthread_rwlock_destroy (LOCK) : 0)
+
+#  else
+
+typedef struct
+        {
+          int initialized;
+          pthread_mutex_t guard;   /* protects the initialization */
+          pthread_rwlock_t rwlock; /* read-write lock */
+        }
+        gl_rwlock_t;
+#   define gl_rwlock_define(STORAGECLASS, NAME) \
+      STORAGECLASS gl_rwlock_t NAME;
+#   define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+      STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
+#   define gl_rwlock_initializer \
+      { 0, PTHREAD_MUTEX_INITIALIZER }
+#   define glthread_rwlock_init(LOCK) \
+      (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0)
+#   define glthread_rwlock_rdlock(LOCK) \
+      (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0)
+#   define glthread_rwlock_wrlock(LOCK) \
+      (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0)
+#   define glthread_rwlock_unlock(LOCK) \
+      (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0)
+#   define glthread_rwlock_destroy(LOCK) \
+      (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0)
+extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock);
+extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock);
+extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock);
+extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock);
+extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock);
+
+#  endif
+
+# else
+
+typedef struct
+        {
+          pthread_mutex_t lock; /* protects the remaining fields */
+          pthread_cond_t waiting_readers; /* waiting readers */
+          pthread_cond_t waiting_writers; /* waiting writers */
+          unsigned int waiting_writers_count; /* number of waiting writers */
+          int runcount; /* number of readers running, or -1 when a writer runs */
+        }
+        gl_rwlock_t;
+# define gl_rwlock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_rwlock_t NAME;
+# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
+# define gl_rwlock_initializer \
+    { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
+# define glthread_rwlock_init(LOCK) \
+    (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0)
+# define glthread_rwlock_rdlock(LOCK) \
+    (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0)
+# define glthread_rwlock_wrlock(LOCK) \
+    (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0)
+# define glthread_rwlock_unlock(LOCK) \
+    (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0)
+# define glthread_rwlock_destroy(LOCK) \
+    (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0)
+extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock);
+extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock);
+extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock);
+extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock);
+extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock);
+
+# endif
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+# if HAVE_PTHREAD_MUTEX_RECURSIVE
+
+#  if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+typedef pthread_mutex_t gl_recursive_lock_t;
+#   define gl_recursive_lock_define(STORAGECLASS, NAME) \
+      STORAGECLASS pthread_mutex_t NAME;
+#   define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+      STORAGECLASS pthread_mutex_t NAME = gl_recursive_lock_initializer;
+#   ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#    define gl_recursive_lock_initializer \
+       PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#   else
+#    define gl_recursive_lock_initializer \
+       PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#   endif
+#   define glthread_recursive_lock_init(LOCK) \
+      (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
+#   define glthread_recursive_lock_lock(LOCK) \
+      (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0)
+#   define glthread_recursive_lock_unlock(LOCK) \
+      (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0)
+#   define glthread_recursive_lock_destroy(LOCK) \
+      (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0)
+extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
+
+#  else
+
+typedef struct
+        {
+          pthread_mutex_t recmutex; /* recursive mutex */
+          pthread_mutex_t guard;    /* protects the initialization */
+          int initialized;
+        }
+        gl_recursive_lock_t;
+#   define gl_recursive_lock_define(STORAGECLASS, NAME) \
+      STORAGECLASS gl_recursive_lock_t NAME;
+#   define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+      STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
+#   define gl_recursive_lock_initializer \
+      { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 }
+#   define glthread_recursive_lock_init(LOCK) \
+      (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
+#   define glthread_recursive_lock_lock(LOCK) \
+      (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0)
+#   define glthread_recursive_lock_unlock(LOCK) \
+      (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0)
+#   define glthread_recursive_lock_destroy(LOCK) \
+      (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0)
+extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
+extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock);
+extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock);
+extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock);
+
+#  endif
+
+# else
+
+/* Old versions of POSIX threads on Solaris did not have recursive locks.
+   We have to implement them ourselves.  */
+
+typedef struct
+        {
+          pthread_mutex_t mutex;
+          pthread_t owner;
+          unsigned long depth;
+        }
+        gl_recursive_lock_t;
+#  define gl_recursive_lock_define(STORAGECLASS, NAME) \
+     STORAGECLASS gl_recursive_lock_t NAME;
+#  define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+     STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
+#  define gl_recursive_lock_initializer \
+     { PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 }
+#  define glthread_recursive_lock_init(LOCK) \
+     (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0)
+#  define glthread_recursive_lock_lock(LOCK) \
+     (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0)
+#  define glthread_recursive_lock_unlock(LOCK) \
+     (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0)
+#  define glthread_recursive_lock_destroy(LOCK) \
+     (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0)
+extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock);
+extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock);
+extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock);
+extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock);
+
+# endif
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef pthread_once_t gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+    STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
+# if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK
+#  define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+     (pthread_in_use ()                                                        \
+      ? pthread_once (ONCE_CONTROL, INITFUNCTION)                              \
+      : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
+# else
+#  define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+     (pthread_in_use ()                                                        \
+      ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION)               \
+      : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
+extern int glthread_once_multithreaded (pthread_once_t *once_control,
+                                        void (*init_function) (void));
+# endif
+extern int glthread_once_singlethreaded (pthread_once_t *once_control);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WINDOWS_THREADS
+
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+
+# include "windows-mutex.h"
+# include "windows-rwlock.h"
+# include "windows-recmutex.h"
+# include "windows-once.h"
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/* We can use CRITICAL_SECTION directly, rather than the native Windows Event,
+   Mutex, Semaphore types, because
+     - we need only to synchronize inside a single process (address space),
+       not inter-process locking,
+     - we don't need to support trylock operations.  (TryEnterCriticalSection
+       does not work on Windows 95/98/ME.  Packages that need trylock usually
+       define their own mutex type.)  */
+
+/* There is no way to statically initialize a CRITICAL_SECTION.  It needs
+   to be done lazily, once only.  For this we need spinlocks.  */
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+typedef glwthread_mutex_t gl_lock_t;
+# define gl_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_lock_t NAME;
+# define gl_lock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS gl_lock_t NAME = gl_lock_initializer;
+# define gl_lock_initializer \
+    GLWTHREAD_MUTEX_INIT
+# define glthread_lock_init(LOCK) \
+    (glwthread_mutex_init (LOCK), 0)
+# define glthread_lock_lock(LOCK) \
+    glwthread_mutex_lock (LOCK)
+# define glthread_lock_unlock(LOCK) \
+    glwthread_mutex_unlock (LOCK)
+# define glthread_lock_destroy(LOCK) \
+    glwthread_mutex_destroy (LOCK)
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+typedef glwthread_rwlock_t gl_rwlock_t;
+# define gl_rwlock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_rwlock_t NAME;
+# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer;
+# define gl_rwlock_initializer \
+    GLWTHREAD_RWLOCK_INIT
+# define glthread_rwlock_init(LOCK) \
+    (glwthread_rwlock_init (LOCK), 0)
+# define glthread_rwlock_rdlock(LOCK) \
+    glwthread_rwlock_rdlock (LOCK)
+# define glthread_rwlock_wrlock(LOCK) \
+    glwthread_rwlock_wrlock (LOCK)
+# define glthread_rwlock_unlock(LOCK) \
+    glwthread_rwlock_unlock (LOCK)
+# define glthread_rwlock_destroy(LOCK) \
+    glwthread_rwlock_destroy (LOCK)
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+typedef glwthread_recmutex_t gl_recursive_lock_t;
+# define gl_recursive_lock_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_recursive_lock_t NAME;
+# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \
+    STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer;
+# define gl_recursive_lock_initializer \
+    GLWTHREAD_RECMUTEX_INIT
+# define glthread_recursive_lock_init(LOCK) \
+    (glwthread_recmutex_init (LOCK), 0)
+# define glthread_recursive_lock_lock(LOCK) \
+    glwthread_recmutex_lock (LOCK)
+# define glthread_recursive_lock_unlock(LOCK) \
+    glwthread_recmutex_unlock (LOCK)
+# define glthread_recursive_lock_destroy(LOCK) \
+    glwthread_recmutex_destroy (LOCK)
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef glwthread_once_t gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT;
+# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+    (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0)
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS)
+
+/* Provide dummy implementation if threads are not supported.  */
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+typedef int gl_lock_t;
+# define gl_lock_define(STORAGECLASS, NAME)
+# define gl_lock_define_initialized(STORAGECLASS, NAME)
+# define glthread_lock_init(NAME) 0
+# define glthread_lock_lock(NAME) 0
+# define glthread_lock_unlock(NAME) 0
+# define glthread_lock_destroy(NAME) 0
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+typedef int gl_rwlock_t;
+# define gl_rwlock_define(STORAGECLASS, NAME)
+# define gl_rwlock_define_initialized(STORAGECLASS, NAME)
+# define glthread_rwlock_init(NAME) 0
+# define glthread_rwlock_rdlock(NAME) 0
+# define glthread_rwlock_wrlock(NAME) 0
+# define glthread_rwlock_unlock(NAME) 0
+# define glthread_rwlock_destroy(NAME) 0
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+typedef int gl_recursive_lock_t;
+# define gl_recursive_lock_define(STORAGECLASS, NAME)
+# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME)
+# define glthread_recursive_lock_init(NAME) 0
+# define glthread_recursive_lock_lock(NAME) 0
+# define glthread_recursive_lock_unlock(NAME) 0
+# define glthread_recursive_lock_destroy(NAME) 0
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef int gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+    STORAGECLASS gl_once_t NAME = 0;
+# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+    (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0)
+
+#endif
+
+/* ========================================================================= */
+
+/* Macros with built-in error handling.  */
+
+/* -------------------------- gl_lock_t datatype -------------------------- */
+
+#define gl_lock_init(NAME) \
+   do                                  \
+     {                                 \
+       if (glthread_lock_init (&NAME)) \
+         abort ();                     \
+     }                                 \
+   while (0)
+#define gl_lock_lock(NAME) \
+   do                                  \
+     {                                 \
+       if (glthread_lock_lock (&NAME)) \
+         abort ();                     \
+     }                                 \
+   while (0)
+#define gl_lock_unlock(NAME) \
+   do                                    \
+     {                                   \
+       if (glthread_lock_unlock (&NAME)) \
+         abort ();                       \
+     }                                   \
+   while (0)
+#define gl_lock_destroy(NAME) \
+   do                                     \
+     {                                    \
+       if (glthread_lock_destroy (&NAME)) \
+         abort ();                        \
+     }                                    \
+   while (0)
+
+/* ------------------------- gl_rwlock_t datatype ------------------------- */
+
+#define gl_rwlock_init(NAME) \
+   do                                    \
+     {                                   \
+       if (glthread_rwlock_init (&NAME)) \
+         abort ();                       \
+     }                                   \
+   while (0)
+#define gl_rwlock_rdlock(NAME) \
+   do                                      \
+     {                                     \
+       if (glthread_rwlock_rdlock (&NAME)) \
+         abort ();                         \
+     }                                     \
+   while (0)
+#define gl_rwlock_wrlock(NAME) \
+   do                                      \
+     {                                     \
+       if (glthread_rwlock_wrlock (&NAME)) \
+         abort ();                         \
+     }                                     \
+   while (0)
+#define gl_rwlock_unlock(NAME) \
+   do                                      \
+     {                                     \
+       if (glthread_rwlock_unlock (&NAME)) \
+         abort ();                         \
+     }                                     \
+   while (0)
+#define gl_rwlock_destroy(NAME) \
+   do                                       \
+     {                                      \
+       if (glthread_rwlock_destroy (&NAME)) \
+         abort ();                          \
+     }                                      \
+   while (0)
+
+/* --------------------- gl_recursive_lock_t datatype --------------------- */
+
+#define gl_recursive_lock_init(NAME) \
+   do                                            \
+     {                                           \
+       if (glthread_recursive_lock_init (&NAME)) \
+         abort ();                               \
+     }                                           \
+   while (0)
+#define gl_recursive_lock_lock(NAME) \
+   do                                            \
+     {                                           \
+       if (glthread_recursive_lock_lock (&NAME)) \
+         abort ();                               \
+     }                                           \
+   while (0)
+#define gl_recursive_lock_unlock(NAME) \
+   do                                              \
+     {                                             \
+       if (glthread_recursive_lock_unlock (&NAME)) \
+         abort ();                                 \
+     }                                             \
+   while (0)
+#define gl_recursive_lock_destroy(NAME) \
+   do                                               \
+     {                                              \
+       if (glthread_recursive_lock_destroy (&NAME)) \
+         abort ();                                  \
+     }                                              \
+   while (0)
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+#define gl_once(NAME, INITFUNCTION) \
+   do                                           \
+     {                                          \
+       if (glthread_once (&NAME, INITFUNCTION)) \
+         abort ();                              \
+     }                                          \
+   while (0)
+
+/* ========================================================================= */
+
+#endif /* _LOCK_H */
deleted file mode 120000 (symlink)
index be3789443bfa165e55d8db833c1cf2042b2dbb23..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/glthread/threadlib.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7a776768414261b82823c7102d437b609298e940
--- /dev/null
@@ -0,0 +1,108 @@
+/* Multithreading primitives.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+/* Use the POSIX threads library.  */
+
+# include <errno.h>
+# include <pthread.h>
+# include <stdlib.h>
+
+# if PTHREAD_IN_USE_DETECTION_HARD
+
+#  if defined __FreeBSD__ || defined __DragonFly__                 /* FreeBSD */
+
+/* Test using pthread_key_create.  */
+
+int
+glthread_in_use (void)
+{
+  static int tested;
+  static int result; /* 1: linked with -lpthread, 0: only with libc */
+
+  if (!tested)
+    {
+      pthread_key_t key;
+      int err = pthread_key_create (&key, NULL);
+
+      if (err == ENOSYS)
+        result = 0;
+      else
+        {
+          result = 1;
+          if (err == 0)
+            pthread_key_delete (key);
+        }
+      tested = 1;
+    }
+  return result;
+}
+
+#  else                                                     /* Solaris, HP-UX */
+
+/* Test using pthread_create.  */
+
+/* The function to be executed by a dummy thread.  */
+static void *
+dummy_thread_func (void *arg)
+{
+  return arg;
+}
+
+int
+glthread_in_use (void)
+{
+  static int tested;
+  static int result; /* 1: linked with -lpthread, 0: only with libc */
+
+  if (!tested)
+    {
+      pthread_t thread;
+
+      if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0)
+        /* Thread creation failed.  */
+        result = 0;
+      else
+        {
+          /* Thread creation works.  */
+          void *retval;
+          if (pthread_join (thread, &retval) != 0)
+            abort ();
+          result = 1;
+        }
+      tested = 1;
+    }
+  return result;
+}
+
+#  endif
+
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
deleted file mode 120000 (symlink)
index acc090528d0cec90b811854887a2e8c553283449..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/glthread/tls.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c0d0e42f1f9c324bb0ab618b4229161a0ca3a6e1
--- /dev/null
@@ -0,0 +1,41 @@
+/* Thread-local storage in multithreaded situations.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+#include "glthread/tls.h"
+
+/* ========================================================================= */
+
+#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WINDOWS_THREADS
+
+#endif
+
+/* ========================================================================= */
deleted file mode 120000 (symlink)
index 9bffd1bc2e47e307682447b491ee5236ceb927a3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/glthread/tls.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..20ec62d2b94a319b3f1392d67bdba02c0c33d107
--- /dev/null
@@ -0,0 +1,235 @@
+/* Thread-local storage in multithreaded situations.
+   Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+/* This file contains thread-local storage primitives for use with a given
+   thread library.  It does not contain primitives for creating threads or
+   for other multithreading primitives.
+
+     Type:                      gl_tls_key_t
+     Initialization:            gl_tls_key_init (name, destructor);
+     Getting per-thread value:  gl_tls_get (name)
+     Setting per-thread value:  gl_tls_set (name, pointer);
+     De-initialization:         gl_tls_key_destroy (name);
+   Equivalent functions with control of error handling:
+     Initialization:            err = glthread_tls_key_init (&name, destructor);
+     Setting per-thread value:  err = glthread_tls_set (&name, pointer);
+     De-initialization:         err = glthread_tls_key_destroy (&name);
+
+   A per-thread value is of type 'void *'.
+
+   A destructor is a function pointer of type 'void (*) (void *)', called
+   when a thread exits, and taking the last per-thread value as argument.  It
+   is unspecified whether the destructor function is called when the last
+   per-thread value is NULL.  On some platforms, the destructor function is
+   not called at all.
+*/
+
+
+#ifndef _TLS_H
+#define _TLS_H
+
+/* This file uses HAVE_THREADS_H.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+
+#if !defined c11_threads_in_use
+# if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC
+#  define c11_threads_in_use() 1
+# elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK
+#  include <threads.h>
+#  pragma weak thrd_exit
+#  define c11_threads_in_use() (thrd_exit != NULL)
+# else
+#  define c11_threads_in_use() 0
+# endif
+#endif
+
+/* ========================================================================= */
+
+#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+/* Use the ISO C threads library.  */
+
+# include <threads.h>
+
+/* ------------------------- gl_tls_key_t datatype ------------------------- */
+
+typedef tss_t gl_tls_key_t;
+# define glthread_tls_key_init(KEY, DESTRUCTOR) \
+    (tss_create (KEY, DESTRUCTOR) != thrd_success ? EAGAIN : 0)
+# define gl_tls_get(NAME) \
+    tss_get (NAME)
+# define glthread_tls_set(KEY, POINTER) \
+    (tss_set (*(KEY), (POINTER)) != thrd_success ? ENOMEM : 0)
+# define glthread_tls_key_destroy(KEY) \
+    (tss_delete (*(KEY)), 0)
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+/* Use the POSIX threads library.  */
+
+# include <pthread.h>
+
+# if PTHREAD_IN_USE_DETECTION_HARD
+
+/* The pthread_in_use() detection needs to be done at runtime.  */
+#  define pthread_in_use() \
+     glthread_in_use ()
+extern int glthread_in_use (void);
+
+# endif
+
+# if USE_POSIX_THREADS_WEAK
+
+/* Use weak references to the POSIX threads library.  */
+
+#  pragma weak pthread_key_create
+#  pragma weak pthread_getspecific
+#  pragma weak pthread_setspecific
+#  pragma weak pthread_key_delete
+#  ifndef pthread_self
+#   pragma weak pthread_self
+#  endif
+
+#  if !PTHREAD_IN_USE_DETECTION_HARD
+#   pragma weak pthread_mutexattr_gettype
+#   define pthread_in_use() \
+      (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
+#  endif
+
+# else
+
+#  if !PTHREAD_IN_USE_DETECTION_HARD
+#   define pthread_in_use() 1
+#  endif
+
+# endif
+
+/* ------------------------- gl_tls_key_t datatype ------------------------- */
+
+typedef union
+        {
+          void *singlethread_value;
+          pthread_key_t key;
+        }
+        gl_tls_key_t;
+# define glthread_tls_key_init(KEY, DESTRUCTOR) \
+    (pthread_in_use ()                              \
+     ? pthread_key_create (&(KEY)->key, DESTRUCTOR) \
+     : ((KEY)->singlethread_value = NULL, 0))
+# define gl_tls_get(NAME) \
+    (pthread_in_use ()                  \
+     ? pthread_getspecific ((NAME).key) \
+     : (NAME).singlethread_value)
+# define glthread_tls_set(KEY, POINTER) \
+    (pthread_in_use ()                             \
+     ? pthread_setspecific ((KEY)->key, (POINTER)) \
+     : ((KEY)->singlethread_value = (POINTER), 0))
+# define glthread_tls_key_destroy(KEY) \
+    (pthread_in_use () ? pthread_key_delete ((KEY)->key) : 0)
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WINDOWS_THREADS
+
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+
+# include "windows-tls.h"
+
+/* ------------------------- gl_tls_key_t datatype ------------------------- */
+
+typedef glwthread_tls_key_t gl_tls_key_t;
+# define glthread_tls_key_init(KEY, DESTRUCTOR) \
+    glwthread_tls_key_create (KEY, DESTRUCTOR)
+# define gl_tls_get(NAME) \
+    TlsGetValue (NAME)
+# define glthread_tls_set(KEY, POINTER) \
+    (!TlsSetValue (*(KEY), POINTER) ? EINVAL : 0)
+# define glthread_tls_key_destroy(KEY) \
+    glwthread_tls_key_delete (*(KEY))
+
+#endif
+
+/* ========================================================================= */
+
+#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS)
+
+/* Provide dummy implementation if threads are not supported.  */
+
+/* ------------------------- gl_tls_key_t datatype ------------------------- */
+
+typedef struct
+        {
+          void *singlethread_value;
+        }
+        gl_tls_key_t;
+# define glthread_tls_key_init(KEY, DESTRUCTOR) \
+    ((KEY)->singlethread_value = NULL, \
+     (void) (DESTRUCTOR),              \
+     0)
+# define gl_tls_get(NAME) \
+    (NAME).singlethread_value
+# define glthread_tls_set(KEY, POINTER) \
+    ((KEY)->singlethread_value = (POINTER), 0)
+# define glthread_tls_key_destroy(KEY) \
+    0
+
+#endif
+
+/* ========================================================================= */
+
+/* Macros with built-in error handling.  */
+
+/* ------------------------- gl_tls_key_t datatype ------------------------- */
+
+#define gl_tls_key_init(NAME, DESTRUCTOR) \
+   do                                                 \
+     {                                                \
+       if (glthread_tls_key_init (&NAME, DESTRUCTOR)) \
+         abort ();                                    \
+     }                                                \
+   while (0)
+#define gl_tls_set(NAME, POINTER) \
+   do                                         \
+     {                                        \
+       if (glthread_tls_set (&NAME, POINTER)) \
+         abort ();                            \
+     }                                        \
+   while (0)
+#define gl_tls_key_destroy(NAME) \
+   do                                        \
+     {                                       \
+       if (glthread_tls_key_destroy (&NAME)) \
+         abort ();                           \
+     }                                       \
+   while (0)
+
+/* ========================================================================= */
+
+#endif /* _TLS_H */
deleted file mode 120000 (symlink)
index 43c16c4767b499c5feb6ad1bf31fbf121639102b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/group-member.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..43b498310034c26b9cdebf68e281b8043d71d68b
--- /dev/null
@@ -0,0 +1,114 @@
+/* group-member.c -- determine whether group id is in calling user's group list
+
+   Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <stdckdint.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <stdlib.h>
+
+/* Most processes have no more than this many groups, and for these
+   processes we can avoid using malloc.  */
+enum { GROUPBUF_SIZE = 100 };
+
+struct group_info
+  {
+    gid_t *group;
+    gid_t groupbuf[GROUPBUF_SIZE];
+  };
+
+static void
+free_group_info (struct group_info const *g)
+{
+  if (g->group != g->groupbuf)
+    free (g->group);
+}
+
+static int
+get_group_info (struct group_info *gi)
+{
+  int n_groups = getgroups (GROUPBUF_SIZE, gi->groupbuf);
+  gi->group = gi->groupbuf;
+
+  if (n_groups < 0)
+    {
+      int n_group_slots = getgroups (0, NULL);
+      size_t nbytes;
+      if (! ckd_mul (&nbytes, n_group_slots, sizeof *gi->group))
+        {
+          gi->group = malloc (nbytes);
+          if (gi->group)
+            n_groups = getgroups (n_group_slots, gi->group);
+        }
+    }
+
+  /* In case of error, the user loses.  */
+  return n_groups;
+}
+
+/* Return non-zero if GID is one that we have in our groups list.
+   Note that the groups list is not guaranteed to contain the current
+   or effective group ID, so they should generally be checked
+   separately.  */
+
+int
+group_member (gid_t gid)
+{
+  int i;
+  int found;
+  struct group_info gi;
+  int n_groups = get_group_info (&gi);
+
+  /* Search through the list looking for GID. */
+  found = 0;
+  for (i = 0; i < n_groups; i++)
+    {
+      if (gid == gi.group[i])
+        {
+          found = 1;
+          break;
+        }
+    }
+
+  free_group_info (&gi);
+
+  return found;
+}
+
+#ifdef TEST
+
+int
+main (int argc, char **argv)
+{
+  int i;
+
+  for (i = 1; i < argc; i++)
+    {
+      gid_t gid;
+
+      gid = atoi (argv[i]);
+      printf ("%d: %s\n", gid, group_member (gid) ? "yes" : "no");
+    }
+  exit (0);
+}
+
+#endif /* TEST */
deleted file mode 120000 (symlink)
index d3901daef0a919a26682a098d2522622ade1322d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/hard-locale.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..653c5809256596381bb000d3dba6332134ec17a1
--- /dev/null
@@ -0,0 +1,47 @@
+/* hard-locale.c -- Determine whether a locale is hard.
+
+   Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "hard-locale.h"
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+
+bool
+hard_locale (int category)
+{
+  char locale[SETLOCALE_NULL_MAX];
+
+  if (setlocale_null_r (category, locale, sizeof (locale)))
+    return false;
+
+  if (!(strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0))
+    return true;
+
+#if defined __ANDROID__
+  /* On Android 5.0 or newer, it is possible to set a locale that has the same
+     name as the "C" locale but in fact uses UTF-8 encoding.  Cf. test case 2 in
+     <https://lists.gnu.org/archive/html/bug-gnulib/2023-01/msg00141.html>.  */
+  if (MB_CUR_MAX > 1)
+    return true;
+#endif
+
+  return false;
+}
deleted file mode 120000 (symlink)
index 5b06b29192a3e83ddbff81f638138a19f9dc512b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/hard-locale.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..21c5c546d3667d0e0a0a7da6c86c5297af368a8d
--- /dev/null
@@ -0,0 +1,28 @@
+/* Determine whether a locale is hard.
+
+   Copyright (C) 1999, 2003-2004, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef HARD_LOCALE_H_
+# define HARD_LOCALE_H_ 1
+
+/* Return true if the specified CATEGORY of the current locale is hard, i.e.
+   different from the C or POSIX locale that has a fixed behavior.
+   CATEGORY must be one of the LC_* values, but not LC_ALL.
+   Note: This function uses the current global locale; it ignores the
+   per-thread locale.  */
+extern bool hard_locale (int category);
+
+#endif /* HARD_LOCALE_H_ */
deleted file mode 120000 (symlink)
index 1eecf1ed3a172eb1a3df7b5f44b855f1aad1136c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/hash-pjw.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d8517ea442f09959eeae0acedd09023411d5c14f
--- /dev/null
@@ -0,0 +1,40 @@
+/* hash-pjw.c -- compute a hash value from a NUL-terminated string.
+
+   Copyright (C) 2001, 2003, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://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 https://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;
+}
deleted file mode 120000 (symlink)
index a2b40cb397421d0014fd0f18434a788f65beae94..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/hash-pjw.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7c60d16f58a87071d75df26b52d36598991d7b00
--- /dev/null
@@ -0,0 +1,28 @@
+/* hash-pjw.h -- declaration for a simple hash function
+   Copyright (C) 2001, 2003, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#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) _GL_ATTRIBUTE_PURE;
deleted file mode 120000 (symlink)
index 7ecbc54a1dbc15de909851e91edd26e4f8491b77..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/hash-triple-simple.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ef1b4dcb3cd0a47b399b5bd2f34080fe55e82bae
--- /dev/null
@@ -0,0 +1,59 @@
+/* Hash functions for file-related triples: name, device, inode.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include "hash-triple.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "hash-pjw.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;
+}
+
+/* Compare two F_triple structs.  */
+bool
+triple_compare_ino_str (void const *x, void const *y)
+{
+  struct F_triple const *a = x;
+  struct F_triple const *b = y;
+  return PSAME_INODE (a, b) && STREQ (a->name, b->name);
+}
+
+/* Free an F_triple.  */
+void
+triple_free (void *x)
+{
+  struct F_triple *a = x;
+  free (a->name);
+  free (a);
+}
deleted file mode 120000 (symlink)
index dd6da640f0ca406c829aa65337f02dc9796f63f4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/hash-triple.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a5fabaccb1ab93b700cb8565ab5328c4fab91e8d
--- /dev/null
@@ -0,0 +1,44 @@
+/* Hash functions for file-related triples: name, device, inode.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include "hash-triple.h"
+
+#include "same.h"
+#include "same-inode.h"
+
+/* 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 PSAME_INODE (a, b) && same_name (a->name, b->name);
+}
deleted file mode 120000 (symlink)
index 689e689043f4a82cffaaa0c646ca9ad39aaca727..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/hash-triple.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9135e73435f7a950eda0ac5717c3196206ca92ce
--- /dev/null
@@ -0,0 +1,50 @@
+/* Hash functions for file-related (name, device, inode) triples.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering, 2007.  */
+
+#ifndef HASH_TRIPLE_H
+#define HASH_TRIPLE_H
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/* Describe a just-created or just-renamed destination file.  */
+struct F_triple
+{
+  char *name;
+  ino_t st_ino;
+  dev_t st_dev;
+};
+
+/* Defined in module 'hash-triple-simple'.  */
+
+extern size_t triple_hash (void const *x, size_t table_size) _GL_ATTRIBUTE_PURE;
+extern bool triple_compare_ino_str (void const *x, void const *y)
+  _GL_ATTRIBUTE_PURE;
+extern void triple_free (void *x);
+
+/* Defined in module 'hash-triple'.  */
+extern size_t triple_hash_no_name (void const *x, size_t table_size)
+  _GL_ATTRIBUTE_PURE;
+extern bool triple_compare (void const *x, void const *y);
+
+#endif
deleted file mode 120000 (symlink)
index b8e82720a5ec3eb730dd73e24378b43ddb4ecf82..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/hash.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2b123be75433cf01c294cbc663987646526bbe76
--- /dev/null
+/* hash - hashing table processing.
+
+   Copyright (C) 1998-2004, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+
+   Written by Jim Meyering, 1992.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://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 "bitrotate.h"
+#include "xalloc-oversized.h"
+
+#include <errno.h>
+#include <stdint.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
+
+struct hash_entry
+  {
+    void *data;
+    struct hash_entry *next;
+  };
+
+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 physically 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.8f
+#define DEFAULT_GROWTH_FACTOR 1.414f
+
+/* 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.0f
+#define DEFAULT_SHRINK_FACTOR 1.0f
+
+/* 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.  */
+
+size_t
+hash_get_n_buckets (const Hash_table *table)
+{
+  return table->n_buckets;
+}
+
+size_t
+hash_get_n_buckets_used (const Hash_table *table)
+{
+  return table->n_buckets_used;
+}
+
+size_t
+hash_get_n_entries (const Hash_table *table)
+{
+  return table->n_entries;
+}
+
+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;
+}
+
+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);
+}
+
+/* Hash KEY and return a pointer to the selected bucket.
+   If TABLE->hasher misbehaves, abort.  */
+static struct hash_entry *
+safe_hasher (const Hash_table *table, const void *key)
+{
+  size_t n = table->hasher (key, table->n_buckets);
+  if (! (n < table->n_buckets))
+    abort ();
+  return table->bucket + n;
+}
+
+void *
+hash_lookup (const Hash_table *table, const void *entry)
+{
+  struct hash_entry const *bucket = safe_hasher (table, entry);
+  struct hash_entry const *cursor;
+
+  if (bucket->data == NULL)
+    return NULL;
+
+  for (cursor = bucket; cursor; cursor = cursor->next)
+    if (entry == cursor->data || table->comparator (entry, cursor->data))
+      return cursor->data;
+
+  return NULL;
+}
+
+/* Walking.  */
+
+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;
+}
+
+void *
+hash_get_next (const Hash_table *table, const void *entry)
+{
+  struct hash_entry const *bucket = safe_hasher (table, entry);
+  struct hash_entry const *cursor;
+
+  /* Find next entry in the same bucket.  */
+  cursor = bucket;
+  do
+    {
+      if (cursor->data == entry && cursor->next)
+        return cursor->next->data;
+      cursor = cursor->next;
+    }
+  while (cursor != NULL);
+
+  /* Find first entry in any subsequent bucket.  */
+  while (++bucket < table->bucket_limit)
+    if (bucket->data)
+      return bucket->data;
+
+  /* None found.  */
+  return NULL;
+}
+
+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;
+}
+
+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.  */
+
+#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 HASH_ONE_CHAR(Value, Byte) \
+  ((Byte) + rotl_sz (Value, 7))
+
+  size_t value = 0;
+  unsigned char ch;
+
+  for (; (ch = *string); string++)
+    value = HASH_ONE_CHAR (value, ch);
+  return value % n_buckets;
+
+# 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 _GL_ATTRIBUTE_CONST
+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 _GL_ATTRIBUTE_CONST
+next_prime (size_t candidate)
+{
+  /* Skip small primes.  */
+  if (candidate < 10)
+    candidate = 10;
+
+  /* Make it definitely odd.  */
+  candidate |= 1;
+
+  while (SIZE_MAX != candidate && !is_prime (candidate))
+    candidate += 2;
+
+  return candidate;
+}
+
+void
+hash_reset_tuning (Hash_tuning *tuning)
+{
+  *tuning = default_tuning;
+}
+
+/* If the user passes a NULL hasher, we hash the raw pointer.  */
+static size_t
+raw_hasher (const void *data, size_t n)
+{
+  /* When hashing unique pointers, it is often the case that they were
+     generated by malloc and thus have the property that the low-order
+     bits are 0.  As this tends to give poorer performance with small
+     tables, we rotate the pointer value before performing division,
+     in an attempt to improve hash quality.  */
+  size_t val = rotr_sz ((size_t) data, 3);
+  return val % n;
+}
+
+/* If the user passes a NULL comparator, we use pointer comparison.  */
+static bool
+raw_comparator (const void *a, const void *b)
+{
+  return a == b;
+}
+
+
+/* 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;
+  float epsilon;
+  if (tuning == &default_tuning)
+    return true;
+
+  /* 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.  */
+  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;
+}
+
+/* Compute the size of the bucket array for the given CANDIDATE and
+   TUNING, or return 0 if there is no possible way to allocate that
+   many entries.  */
+
+static size_t _GL_ATTRIBUTE_PURE
+compute_bucket_size (size_t candidate, const Hash_tuning *tuning)
+{
+  if (!tuning->is_n_buckets)
+    {
+      float new_candidate = candidate / tuning->growth_threshold;
+      if ((float) SIZE_MAX <= new_candidate)
+        goto nomem;
+      candidate = new_candidate;
+    }
+  candidate = next_prime (candidate);
+  if (xalloc_oversized (candidate, sizeof (struct hash_entry *)))
+    goto nomem;
+  return candidate;
+
+ nomem:
+  errno = ENOMEM;
+  return 0;
+}
+
+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)
+    hasher = raw_hasher;
+  if (comparator == NULL)
+    comparator = raw_comparator;
+
+  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.  */
+      errno = EINVAL;
+      goto fail;
+    }
+
+  table->n_buckets = compute_bucket_size (candidate, tuning);
+  if (!table->n_buckets)
+    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;
+}
+
+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;
+}
+
+void
+hash_free (Hash_table *table)
+{
+  struct hash_entry *bucket;
+  struct hash_entry *cursor;
+  struct hash_entry *next;
+  int err = errno;
+
+  /* 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);
+
+  errno = err;
+}
+
+/* Insertion and deletion.  */
+
+/* Get a new hash entry for a bucket overflow, possibly by recycling 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 = safe_hasher (table, entry);
+  struct hash_entry *cursor;
+
+  *bucket_head = bucket;
+
+  /* Test for empty bucket.  */
+  if (bucket->data == NULL)
+    return NULL;
+
+  /* See if the entry is the first in the bucket.  */
+  if (entry == bucket->data || 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 (entry == cursor->next->data
+          || 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;
+}
+
+/* Internal helper, to move entries from SRC to DST.  Both tables must
+   share the same free entry list.  If SAFE, only move overflow
+   entries, saving bucket heads for later, so that no allocations will
+   occur.  Return false (setting errno) if the free entry list is
+   exhausted and an allocation fails.  */
+
+static bool
+transfer_entries (Hash_table *dst, Hash_table *src, bool safe)
+{
+  struct hash_entry *bucket;
+  struct hash_entry *cursor;
+  struct hash_entry *next;
+  for (bucket = src->bucket; bucket < src->bucket_limit; bucket++)
+    if (bucket->data)
+      {
+        void *data;
+        struct hash_entry *new_bucket;
+
+        /* Within each bucket, transfer overflow entries first and
+           then the bucket head, to minimize memory pressure.  After
+           all, the only time we might allocate is when moving the
+           bucket head, but moving overflow entries first may create
+           free entries that can be recycled by the time we finally
+           get to the bucket head.  */
+        for (cursor = bucket->next; cursor; cursor = next)
+          {
+            data = cursor->data;
+            new_bucket = safe_hasher (dst, data);
+
+            next = cursor->next;
+
+            if (new_bucket->data)
+              {
+                /* 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.  */
+                new_bucket->data = data;
+                dst->n_buckets_used++;
+                free_entry (dst, cursor);
+              }
+          }
+        /* Now move the bucket head.  Be sure that if we fail due to
+           allocation failure that the src table is in a consistent
+           state.  */
+        data = bucket->data;
+        bucket->next = NULL;
+        if (safe)
+          continue;
+        new_bucket = safe_hasher (dst, data);
+
+        if (new_bucket->data)
+          {
+            /* Allocate or recycle an entry, when moving from a bucket
+               header into a bucket overflow.  */
+            struct hash_entry *new_entry = allocate_entry (dst);
+
+            if (new_entry == NULL)
+              return false;
+
+            new_entry->data = data;
+            new_entry->next = new_bucket->next;
+            new_bucket->next = new_entry;
+          }
+        else
+          {
+            /* Move from one bucket header to another.  */
+            new_bucket->data = data;
+            dst->n_buckets_used++;
+          }
+        bucket->data = NULL;
+        src->n_buckets_used--;
+      }
+  return true;
+}
+
+bool
+hash_rehash (Hash_table *table, size_t candidate)
+{
+  Hash_table storage;
+  Hash_table *new_table;
+  size_t new_size = compute_bucket_size (candidate, table->tuning);
+
+  if (!new_size)
+    return false;
+  if (new_size == table->n_buckets)
+    return true;
+  new_table = &storage;
+  new_table->bucket = calloc (new_size, sizeof *new_table->bucket);
+  if (new_table->bucket == NULL)
+    return false;
+  new_table->n_buckets = new_size;
+  new_table->bucket_limit = new_table->bucket + new_size;
+  new_table->n_buckets_used = 0;
+  new_table->n_entries = 0;
+  new_table->tuning = table->tuning;
+  new_table->hasher = table->hasher;
+  new_table->comparator = table->comparator;
+  new_table->data_freer = table->data_freer;
+
+  /* In order for the transfer to successfully complete, we need
+     additional overflow entries when distinct buckets in the old
+     table collide into a common bucket in the new table.  The worst
+     case possible is a hasher that gives a good spread with the old
+     size, but returns a constant with the new size; if we were to
+     guarantee table->n_buckets_used-1 free entries in advance, then
+     the transfer would be guaranteed to not allocate memory.
+     However, for large tables, a guarantee of no further allocation
+     introduces a lot of extra memory pressure, all for an unlikely
+     corner case (most rehashes reduce, rather than increase, the
+     number of overflow entries needed).  So, we instead ensure that
+     the transfer process can be reversed if we hit a memory
+     allocation failure mid-transfer.  */
+
+  /* Merely reuse the extra old space into the new table.  */
+#if USE_OBSTACK
+  new_table->entry_stack = table->entry_stack;
+#endif
+  new_table->free_entry_list = table->free_entry_list;
+
+  if (transfer_entries (new_table, table, false))
+    {
+      /* Entries transferred successfully; tie up the loose ends.  */
+      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 and table->entry_stack already hold their value.  */
+      return true;
+    }
+
+  /* We've allocated new_table->bucket (and possibly some entries),
+     exhausted the free list, and moved some but not all entries into
+     new_table.  We must undo the partial move before returning
+     failure.  The only way to get into this situation is if new_table
+     uses fewer buckets than the old table, so we will reclaim some
+     free entries as overflows in the new table are put back into
+     distinct buckets in the old table.
+
+     There are some pathological cases where a single pass through the
+     table requires more intermediate overflow entries than using two
+     passes.  Two passes give worse cache performance and takes
+     longer, but at this point, we're already out of memory, so slow
+     and safe is better than failure.  */
+  int err = errno;
+  table->free_entry_list = new_table->free_entry_list;
+  if (! (transfer_entries (table, new_table, true)
+         && transfer_entries (table, new_table, false)))
+    abort ();
+  /* table->n_entries already holds its value.  */
+  free (new_table->bucket);
+  errno = err;
+  return false;
+}
+
+int
+hash_insert_if_absent (Hash_table *table, void const *entry,
+                       void const **matched_ent)
+{
+  void *data;
+  struct hash_entry *bucket;
+
+  /* The caller cannot insert a NULL entry, since hash_lookup returns NULL
+     to indicate "not found", and hash_find_entry uses "bucket->data == NULL"
+     to indicate an empty bucket.  */
+  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)
+    {
+      if (matched_ent)
+        *matched_ent = data;
+      return 0;
+    }
+
+  /* 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 ((float) SIZE_MAX <= candidate)
+            {
+              errno = ENOMEM;
+              return -1;
+            }
+
+          /* If the rehash fails, arrange to return NULL.  */
+          if (!hash_rehash (table, candidate))
+            return -1;
+
+          /* Update the bucket we are interested in.  */
+          if (hash_find_entry (table, entry, &bucket, false) != NULL)
+            abort ();
+        }
+    }
+
+  /* ENTRY is not matched, it should be inserted.  */
+
+  if (bucket->data)
+    {
+      struct hash_entry *new_entry = allocate_entry (table);
+
+      if (new_entry == NULL)
+        return -1;
+
+      /* 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 1;
+    }
+
+  /* Add ENTRY right in the bucket head.  */
+
+  bucket->data = (void *) entry;
+  table->n_entries++;
+  table->n_buckets_used++;
+
+  return 1;
+}
+
+void *
+hash_insert (Hash_table *table, void const *entry)
+{
+  void const *matched_ent;
+  int err = hash_insert_if_absent (table, entry, &matched_ent);
+  return (err == -1
+          ? NULL
+          : (void *) (err == 0 ? matched_ent : entry));
+}
+
+void *
+hash_remove (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));
+
+              if (!hash_rehash (table, candidate))
+                {
+                  /* Failure to allocate memory in an attempt to
+                     shrink the table is not fatal.  But since memory
+                     is low, we can at least be kind and free any
+                     spare entries, rather than keeping them tied up
+                     in the free entry list.  */
+#if ! USE_OBSTACK
+                  struct hash_entry *cursor = table->free_entry_list;
+                  struct hash_entry *next;
+                  while (cursor)
+                    {
+                      next = cursor->next;
+                      free (cursor);
+                      cursor = next;
+                    }
+                  table->free_entry_list = NULL;
+#endif
+                }
+            }
+        }
+    }
+
+  return data;
+}
+
+void *
+hash_delete (Hash_table *table, const void *entry)
+{
+  return hash_remove (table, entry);
+}
+
+/* Testing.  */
+
+#if TESTING
+
+void
+hash_print (const Hash_table *table)
+{
+  struct hash_entry *bucket = (struct hash_entry *) table->bucket;
+
+  for ( ; 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 */
deleted file mode 120000 (symlink)
index f68a6db1be2125a5871a7e990d41158fa57da09a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/hash.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f764985fb6fa685f951bb1bb6d24bed5c708b0d4
--- /dev/null
@@ -0,0 +1,273 @@
+/* hash - hashing table processing.
+   Copyright (C) 1998-1999, 2001, 2003, 2009-2024 Free Software Foundation,
+   Inc.
+   Written by Jim Meyering <meyering@ascend.com>, 1998.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://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_
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEPRECATED,
+   _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_PURE,
+   _GL_ATTRIBUTE_RETURNS_NONNULL.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+# include <stdio.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+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.
+ */
+
+/* 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.  */
+extern size_t hash_get_n_buckets (const Hash_table *table)
+       _GL_ATTRIBUTE_PURE;
+
+/* Return the number of slots in use (non-empty buckets).  */
+extern size_t hash_get_n_buckets_used (const Hash_table *table)
+       _GL_ATTRIBUTE_PURE;
+
+/* Return the number of active entries.  */
+extern size_t hash_get_n_entries (const Hash_table *table)
+       _GL_ATTRIBUTE_PURE;
+
+/* Return the length of the longest chain (bucket).  */
+extern size_t hash_get_max_bucket_length (const Hash_table *table)
+       _GL_ATTRIBUTE_PURE;
+
+/* Do a mild validation of a hash table, by traversing it and checking two
+   statistics.  */
+extern bool hash_table_ok (const Hash_table *table)
+       _GL_ATTRIBUTE_PURE;
+
+extern void hash_print_statistics (const Hash_table *table, FILE *stream);
+
+/* If ENTRY matches an entry already in the hash table, return the
+   entry from the table.  Otherwise, return NULL.  */
+extern void *hash_lookup (const Hash_table *table, const void *entry);
+
+/*
+ * 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, and an entry
+   may be removed only if there is no shrink threshold and the entry being
+   removed has already been passed to hash_get_next.  */
+
+/* Return the first data in the table, or NULL if the table is empty.  */
+extern void *hash_get_first (const Hash_table *table)
+       _GL_ATTRIBUTE_PURE;
+
+/* 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.  */
+extern void *hash_get_next (const Hash_table *table, const void *entry);
+
+/* 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.  */
+extern size_t hash_get_entries (const Hash_table *table, void **buffer,
+                                size_t buffer_size);
+
+typedef bool (*Hash_processor) (void *entry, void *processor_data);
+
+/* 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.  */
+extern size_t hash_do_for_each (const Hash_table *table,
+                                Hash_processor processor, void *processor_data);
+
+/*
+ * 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.  */
+extern size_t hash_string (const char *string, size_t n_buckets)
+       _GL_ATTRIBUTE_PURE;
+
+extern void hash_reset_tuning (Hash_tuning *tuning);
+
+typedef size_t (*Hash_hasher) (const void *entry, size_t table_size);
+typedef bool (*Hash_comparator) (const void *entry1, const void *entry2);
+typedef void (*Hash_data_freer) (void *entry);
+
+/* 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.  This function preserves errno, like 'free'.  */
+extern void hash_free (Hash_table *table);
+
+/* 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.  If TUNING is
+   provided but the values requested are out of bounds or might cause
+   rounding errors, return NULL.
+
+   The user-supplied HASHER function, when not NULL, 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, when not NULL, 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,
+   but which are distinct pointers.
+
+   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.
+
+   Set errno on failure; otherwise errno is unspecified.  */
+_GL_ATTRIBUTE_NODISCARD
+extern Hash_table *hash_initialize (size_t candidate,
+                                    const Hash_tuning *tuning,
+                                    Hash_hasher hasher,
+                                    Hash_comparator comparator,
+                                    Hash_data_freer data_freer)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (hash_free, 1);
+
+/* Like hash_initialize, but invokes xalloc_die instead of returning NULL.  */
+/* This function is defined by module 'xhash'.  */
+_GL_ATTRIBUTE_NODISCARD
+extern Hash_table *hash_xinitialize (size_t candidate,
+                                     const Hash_tuning *tuning,
+                                     Hash_hasher hasher,
+                                     Hash_comparator comparator,
+                                     Hash_data_freer data_freer)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (hash_free, 1)
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+/* Make all buckets empty, placing any chained entries on the free list.
+   Apply the user-specified function data_freer (if any) to the data of any
+   affected entries.  */
+extern void hash_clear (Hash_table *table);
+
+/*
+ * Insertion and deletion.
+ */
+
+/* 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.  Return true iff the rehash succeeded,
+   false (setting errno) otherwise.  */
+_GL_ATTRIBUTE_NODISCARD
+extern bool hash_rehash (Hash_table *table, size_t candidate);
+
+/* 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 (setting errno) if the storage required for insertion
+   cannot be allocated.  This implementation does not support
+   duplicate entries or insertion of NULL.  */
+_GL_ATTRIBUTE_NODISCARD
+extern void *hash_insert (Hash_table *table, const void *entry);
+
+/* Same as hash_insert, but invokes xalloc_die instead of returning NULL.  */
+/* This function is defined by module 'xhash'.  */
+extern void *hash_xinsert (Hash_table *table, const void *entry);
+
+/* Insert ENTRY into hash TABLE if there is not already a matching entry.
+
+   Return -1 (setting errno) upon memory allocation failure.
+   Return 1 if insertion succeeded.
+   Return 0 if there is already a matching entry in the table,
+   and in that case, if MATCHED_ENT is non-NULL, set *MATCHED_ENT
+   to that entry.
+
+   This interface is easier to use than hash_insert when you must
+   distinguish between the latter two cases.  More importantly,
+   hash_insert is unusable for some types of ENTRY values.  When using
+   hash_insert, the only way to distinguish those cases is to compare
+   the return value and ENTRY.  That works only when you can have two
+   different ENTRY values that point to data that compares "equal".  Thus,
+   when the ENTRY value is a simple scalar, you must use
+   hash_insert_if_absent.  ENTRY must not be NULL.  */
+extern int hash_insert_if_absent (Hash_table *table, const void *entry,
+                                  const void **matched_ent);
+
+/* 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.  */
+extern void *hash_remove (Hash_table *table, const void *entry);
+
+/* Same as hash_remove.  This interface is deprecated.
+   FIXME: Remove in 2022.  */
+_GL_ATTRIBUTE_DEPRECATED
+extern void *hash_delete (Hash_table *table, const void *entry);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index 700204d058fd436956897c21983471fe5b8ab87e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/human.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fbf45bb57352009ec2dba0ab5b271f6f14a9e580
--- /dev/null
@@ -0,0 +1,473 @@
+/* human.c -- print human readable file size
+
+   Copyright (C) 1996-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Larry McVoy.  */
+
+#include <config.h>
+
+#include "human.h"
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <argmatch.h>
+#include <error.h>
+#include <intprops.h>
+
+/* The maximum length of a suffix like "KiB".  */
+#define HUMAN_READABLE_SUFFIX_LENGTH_MAX 3
+
+static const char power_letter[] =
+{
+  0,    /* not used */
+  'K',  /* kibi ('k' for kilo is a special case) */
+  'M',  /* mega or mebi */
+  'G',  /* giga or gibi */
+  'T',  /* tera or tebi */
+  'P',  /* peta or pebi */
+  'E',  /* exa or exbi */
+  'Z',  /* zetta or 2**70 */
+  'Y',  /* yotta or 2**80 */
+  'R',  /* ronna or 2**90 */
+  'Q'   /* quetta or 2**100 */
+};
+
+
+/* If INEXACT_STYLE is not human_round_to_nearest, and if easily
+   possible, adjust VALUE according to the style.  */
+
+static long double
+adjust_value (int inexact_style, long double value)
+{
+  /* Do not use the floorl or ceill functions, as that would mean
+     checking for their presence and possibly linking with the
+     standard math library, which is a porting pain.  So leave the
+     value alone if it is too large to easily round.  */
+  if (inexact_style != human_round_to_nearest && value < UINTMAX_MAX)
+    {
+      uintmax_t u = value;
+      value = u + (inexact_style == human_ceiling && u != value);
+    }
+
+  return value;
+}
+
+/* Group the digits of NUMBER according to the grouping rules of the
+   current locale.  NUMBER contains NUMBERLEN digits.  Modify the
+   bytes pointed to by NUMBER in place, subtracting 1 from NUMBER for
+   each byte inserted.  Return the starting address of the modified
+   number.
+
+   To group the digits, use GROUPING and THOUSANDS_SEP as in 'struct
+   lconv' from <locale.h>.  */
+
+static char *
+group_number (char *number, size_t numberlen,
+              char const *grouping, char const *thousands_sep)
+{
+  register char *d;
+  size_t grouplen = SIZE_MAX;
+  size_t thousands_seplen = strlen (thousands_sep);
+  size_t i = numberlen;
+
+  /* The maximum possible value for NUMBERLEN is the number of digits
+     in the square of the largest uintmax_t, so double the size needed.  */
+  char buf[2 * INT_STRLEN_BOUND (uintmax_t) + 1];
+
+  memcpy (buf, number, numberlen);
+  d = number + numberlen;
+
+  for (;;)
+    {
+      unsigned char g = *grouping;
+
+      if (g)
+        {
+          grouplen = g < CHAR_MAX ? g : i;
+          grouping++;
+        }
+
+      if (i < grouplen)
+        grouplen = i;
+
+      d -= grouplen;
+      i -= grouplen;
+      memcpy (d, buf + i, grouplen);
+      if (i == 0)
+        return d;
+
+      d -= thousands_seplen;
+      memcpy (d, thousands_sep, thousands_seplen);
+    }
+}
+
+/* Convert N to a human readable format in BUF, using the options OPTS.
+
+   N is expressed in units of FROM_BLOCK_SIZE.  FROM_BLOCK_SIZE must
+   be nonnegative.
+
+   Use units of TO_BLOCK_SIZE in the output number.  TO_BLOCK_SIZE
+   must be positive.
+
+   Use (OPTS & (human_round_to_nearest | human_floor | human_ceiling))
+   to determine whether to take the ceiling or floor of any result
+   that cannot be expressed exactly.
+
+   If (OPTS & human_group_digits), group the thousands digits
+   according to the locale, e.g., "1,000,000" in an American English
+   locale.
+
+   If (OPTS & human_autoscale), deduce the output block size
+   automatically; TO_BLOCK_SIZE must be 1 but it has no effect on the
+   output.  Use powers of 1024 if (OPTS & human_base_1024), and powers
+   of 1000 otherwise.  For example, assuming powers of 1024, 8500
+   would be converted to 8.3, 133456345 to 127, 56990456345 to 53, and
+   so on.  Numbers smaller than the power aren't modified.
+   human_autoscale is normally used together with human_SI.
+
+   If (OPTS & human_space_before_unit), use a space to separate the
+   number from any suffix that is appended as described below.
+
+   If (OPTS & human_SI), append an SI prefix indicating which power is
+   being used.  If in addition (OPTS & human_B), append "B" (if base
+   1000) or "iB" (if base 1024) to the SI prefix.  When ((OPTS &
+   human_SI) && ! (OPTS & human_autoscale)), TO_BLOCK_SIZE must be a
+   power of 1024 or of 1000, depending on (OPTS &
+   human_base_1024).  */
+
+char *
+human_readable (uintmax_t n, char *buf, int opts,
+                uintmax_t from_block_size, uintmax_t to_block_size)
+{
+  int inexact_style =
+    opts & (human_round_to_nearest | human_floor | human_ceiling);
+  unsigned int base = opts & human_base_1024 ? 1024 : 1000;
+  uintmax_t amt;
+  int tenths;
+  int exponent = -1;
+  int exponent_max = sizeof power_letter - 1;
+  char *p;
+  char *psuffix;
+  char const *integerlim;
+
+  /* 0 means adjusted N == AMT.TENTHS;
+     1 means AMT.TENTHS < adjusted N < AMT.TENTHS + 0.05;
+     2 means adjusted N == AMT.TENTHS + 0.05;
+     3 means AMT.TENTHS + 0.05 < adjusted N < AMT.TENTHS + 0.1.  */
+  int rounding;
+
+  char const *decimal_point = ".";
+  size_t decimal_pointlen = 1;
+  char const *grouping = "";
+  char const *thousands_sep = "";
+  struct lconv const *l = localeconv ();
+  size_t pointlen = strlen (l->decimal_point);
+  if (0 < pointlen && pointlen <= MB_LEN_MAX)
+    {
+      decimal_point = l->decimal_point;
+      decimal_pointlen = pointlen;
+    }
+  grouping = l->grouping;
+  if (strlen (l->thousands_sep) <= MB_LEN_MAX)
+    thousands_sep = l->thousands_sep;
+
+  /* Leave room for a trailing space and following suffix.  */
+  psuffix = buf + LONGEST_HUMAN_READABLE - 1 - HUMAN_READABLE_SUFFIX_LENGTH_MAX;
+  p = psuffix;
+
+  /* Adjust AMT out of FROM_BLOCK_SIZE units and into TO_BLOCK_SIZE
+     units.  If this can be done exactly with integer arithmetic, do
+     not use floating point operations.  */
+  if (to_block_size <= from_block_size)
+    {
+      if (from_block_size % to_block_size == 0)
+        {
+          uintmax_t multiplier = from_block_size / to_block_size;
+          amt = n * multiplier;
+          if (amt / multiplier == n)
+            {
+              tenths = 0;
+              rounding = 0;
+              goto use_integer_arithmetic;
+            }
+        }
+    }
+  else if (from_block_size != 0 && to_block_size % from_block_size == 0)
+    {
+      uintmax_t divisor = to_block_size / from_block_size;
+      uintmax_t r10 = (n % divisor) * 10;
+      uintmax_t r2 = (r10 % divisor) * 2;
+      amt = n / divisor;
+      tenths = r10 / divisor;
+      rounding = r2 < divisor ? 0 < r2 : 2 + (divisor < r2);
+      goto use_integer_arithmetic;
+    }
+
+  {
+    /* Either the result cannot be computed easily using uintmax_t,
+       or from_block_size is zero.  Fall back on floating point.
+       FIXME: This can yield answers that are slightly off.  */
+
+    long double dto_block_size = to_block_size;
+    long double damt = n * (from_block_size / dto_block_size);
+    size_t buflen;
+    size_t nonintegerlen;
+
+    if (! (opts & human_autoscale))
+      {
+        sprintf (buf, "%.0Lf", adjust_value (inexact_style, damt));
+        buflen = strlen (buf);
+        nonintegerlen = 0;
+      }
+    else
+      {
+        long double e = 1;
+        exponent = 0;
+
+        do
+          {
+            e *= base;
+            exponent++;
+          }
+        while (e * base <= damt && exponent < exponent_max);
+
+        damt /= e;
+
+        sprintf (buf, "%.1Lf", adjust_value (inexact_style, damt));
+        buflen = strlen (buf);
+        nonintegerlen = decimal_pointlen + 1;
+
+        if (1 + nonintegerlen + ! (opts & human_base_1024) < buflen
+            || ((opts & human_suppress_point_zero)
+                && buf[buflen - 1] == '0'))
+          {
+            sprintf (buf, "%.0Lf",
+                     adjust_value (inexact_style, damt * 10) / 10);
+            buflen = strlen (buf);
+            nonintegerlen = 0;
+          }
+      }
+
+    p = psuffix - buflen;
+    memmove (p, buf, buflen);
+    integerlim = p + buflen - nonintegerlen;
+  }
+  goto do_grouping;
+
+ use_integer_arithmetic:
+  {
+    /* The computation can be done exactly, with integer arithmetic.
+
+       Use power of BASE notation if requested and if adjusted AMT is
+       large enough.  */
+
+    if (opts & human_autoscale)
+      {
+        exponent = 0;
+
+        if (base <= amt)
+          {
+            do
+              {
+                unsigned int r10 = (amt % base) * 10 + tenths;
+                unsigned int r2 = (r10 % base) * 2 + (rounding >> 1);
+                amt /= base;
+                tenths = r10 / base;
+                rounding = (r2 < base
+                            ? (r2 + rounding) != 0
+                            : 2 + (base < r2 + rounding));
+                exponent++;
+              }
+            while (base <= amt && exponent < exponent_max);
+
+            if (amt < 10)
+              {
+                if (inexact_style == human_round_to_nearest
+                    ? 2 < rounding + (tenths & 1)
+                    : inexact_style == human_ceiling && 0 < rounding)
+                  {
+                    tenths++;
+                    rounding = 0;
+
+                    if (tenths == 10)
+                      {
+                        amt++;
+                        tenths = 0;
+                      }
+                  }
+
+                if (amt < 10
+                    && (tenths || ! (opts & human_suppress_point_zero)))
+                  {
+                    *--p = '0' + tenths;
+                    p -= decimal_pointlen;
+                    memcpy (p, decimal_point, decimal_pointlen);
+                    tenths = rounding = 0;
+                  }
+              }
+          }
+      }
+
+    if (inexact_style == human_round_to_nearest
+        ? 5 < tenths + (0 < rounding + (amt & 1))
+        : inexact_style == human_ceiling && 0 < tenths + rounding)
+      {
+        amt++;
+
+        if ((opts & human_autoscale)
+            && amt == base && exponent < exponent_max)
+          {
+            exponent++;
+            if (! (opts & human_suppress_point_zero))
+              {
+                *--p = '0';
+                p -= decimal_pointlen;
+                memcpy (p, decimal_point, decimal_pointlen);
+              }
+            amt = 1;
+          }
+      }
+
+    integerlim = p;
+
+    do
+      {
+        int digit = amt % 10;
+        *--p = digit + '0';
+      }
+    while ((amt /= 10) != 0);
+  }
+
+ do_grouping:
+  if (opts & human_group_digits)
+    p = group_number (p, integerlim - p, grouping, thousands_sep);
+
+  if (opts & human_SI)
+    {
+      if (exponent < 0)
+        {
+          uintmax_t power;
+          exponent = 0;
+          for (power = 1; power < to_block_size; power *= base)
+            if (++exponent == exponent_max)
+              break;
+        }
+
+      if ((exponent | (opts & human_B)) && (opts & human_space_before_unit))
+        *psuffix++ = ' ';
+
+      if (exponent)
+        *psuffix++ = (! (opts & human_base_1024) && exponent == 1
+                      ? 'k'
+                      : power_letter[exponent]);
+
+      if (opts & human_B)
+        {
+          if ((opts & human_base_1024) && exponent)
+            *psuffix++ = 'i';
+          *psuffix++ = 'B';
+        }
+    }
+
+  *psuffix = '\0';
+
+  return p;
+}
+
+
+/* The default block size used for output.  This number may change in
+   the future as disks get larger.  */
+#ifndef DEFAULT_BLOCK_SIZE
+# define DEFAULT_BLOCK_SIZE 1024
+#endif
+
+static char const *const block_size_args[] = { "human-readable", "si", 0 };
+static int const block_size_opts[] =
+  {
+    human_autoscale + human_SI + human_base_1024,
+    human_autoscale + human_SI
+  };
+
+static uintmax_t
+default_block_size (void)
+{
+  return getenv ("POSIXLY_CORRECT") ? 512 : DEFAULT_BLOCK_SIZE;
+}
+
+static strtol_error
+humblock (char const *spec, uintmax_t *block_size, int *options)
+{
+  int i;
+  int opts = 0;
+
+  if (! spec
+      && ! (spec = getenv ("BLOCK_SIZE"))
+      && ! (spec = getenv ("BLOCKSIZE")))
+    *block_size = default_block_size ();
+  else
+    {
+      if (*spec == '\'')
+        {
+          opts |= human_group_digits;
+          spec++;
+        }
+
+      if (0 <= (i = ARGMATCH (spec, block_size_args, block_size_opts)))
+        {
+          opts |= block_size_opts[i];
+          *block_size = 1;
+        }
+      else
+        {
+          char *ptr;
+          strtol_error e = xstrtoumax (spec, &ptr, 0, block_size,
+                                       "eEgGkKmMpPtTyYzZ0");
+          if (e != LONGINT_OK)
+            {
+              *options = 0;
+              return e;
+            }
+          for (; ! ('0' <= *spec && *spec <= '9'); spec++)
+            if (spec == ptr)
+              {
+                opts |= human_SI;
+                if (ptr[-1] == 'B')
+                  opts |= human_B;
+                if (ptr[-1] != 'B' || ptr[-2] == 'i')
+                  opts |= human_base_1024;
+                break;
+              }
+        }
+    }
+
+  *options = opts;
+  return LONGINT_OK;
+}
+
+enum strtol_error
+human_options (char const *spec, int *opts, uintmax_t *block_size)
+{
+  strtol_error e = humblock (spec, block_size, opts);
+  if (*block_size == 0)
+    {
+      *block_size = default_block_size ();
+      e = LONGINT_INVALID;
+    }
+  return e;
+}
deleted file mode 120000 (symlink)
index 200a745647d72471a8525bffd1d3e8822fd34e8d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/human.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f89e7640b2db13a58efb1cc112c7e58c7bdee23b
--- /dev/null
@@ -0,0 +1,82 @@
+/* human.h -- print human readable file size
+
+   Copyright (C) 1996-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Larry McVoy.  */
+
+#ifndef HUMAN_H_
+# define HUMAN_H_ 1
+
+# include <limits.h>
+# include <stdint.h>
+# include <unistd.h>
+
+# include <xstrtol.h>
+
+/* A conservative bound on the maximum length of a human-readable string.
+   The output can be the square of the largest uintmax_t, so double
+   its size before converting to a bound.
+   log10 (2.0) < 146/485.  Add 1 for integer division truncation.
+   Also, the output can have a thousands separator between every digit,
+   so multiply by MB_LEN_MAX + 1 and then subtract MB_LEN_MAX.
+   Append 1 for a space before the suffix.
+   Finally, append 3, the maximum length of a suffix.  */
+# define LONGEST_HUMAN_READABLE \
+  ((2 * sizeof (uintmax_t) * CHAR_BIT * 146 / 485 + 1) * (MB_LEN_MAX + 1) \
+   - MB_LEN_MAX + 1 + 3)
+
+/* Options for human_readable.  */
+enum
+{
+  /* Unless otherwise specified these options may be ORed together.  */
+
+  /* The following three options are mutually exclusive.  */
+  /* Round to plus infinity (default).  */
+  human_ceiling = 0,
+  /* Round to nearest, ties to even.  */
+  human_round_to_nearest = 1,
+  /* Round to minus infinity.  */
+  human_floor = 2,
+
+  /* Group digits together, e.g. "1,000,000".  This uses the
+     locale-defined grouping; the traditional C locale does not group,
+     so this has effect only if some other locale is in use.  */
+  human_group_digits = 4,
+
+  /* When autoscaling, suppress ".0" at end.  */
+  human_suppress_point_zero = 8,
+
+  /* Scale output and use SI-style units, ignoring the output block size.  */
+  human_autoscale = 16,
+
+  /* Prefer base 1024 to base 1000.  */
+  human_base_1024 = 32,
+
+  /* Prepend " " before unit symbol.  */
+  human_space_before_unit = 64,
+
+  /* Append SI prefix, e.g. "k" or "M".  */
+  human_SI = 128,
+
+  /* Append "B" (if base 1000) or "iB" (if base 1024) to SI prefix.  */
+  human_B = 256
+};
+
+char *human_readable (uintmax_t, char *, int, uintmax_t, uintmax_t);
+
+enum strtol_error human_options (char const *, int *, uintmax_t *);
+
+#endif /* HUMAN_H_ */
deleted file mode 120000 (symlink)
index 639180b14f646a40952fae23cc73208fd0c29b79..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/i-ring.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5f66ff0b25312de7fcc2d85c6c658a06ccc0ad2b
--- /dev/null
@@ -0,0 +1,68 @@
+/* a simple ring buffer
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+#include "i-ring.h"
+
+#include <stdlib.h>
+
+void
+i_ring_init (I_ring *ir, int default_val)
+{
+  int i;
+  ir->ir_empty = true;
+  ir->ir_front = 0;
+  ir->ir_back = 0;
+  for (i = 0; i < I_RING_SIZE; i++)
+    ir->ir_data[i] = default_val;
+  ir->ir_default_val = default_val;
+}
+
+bool
+i_ring_empty (I_ring const *ir)
+{
+  return ir->ir_empty;
+}
+
+int
+i_ring_push (I_ring *ir, int val)
+{
+  unsigned int dest_idx = (ir->ir_front + !ir->ir_empty) % I_RING_SIZE;
+  int old_val = ir->ir_data[dest_idx];
+  ir->ir_data[dest_idx] = val;
+  ir->ir_front = dest_idx;
+  if (dest_idx == ir->ir_back)
+    ir->ir_back = (ir->ir_back + !ir->ir_empty) % I_RING_SIZE;
+  ir->ir_empty = false;
+  return old_val;
+}
+
+int
+i_ring_pop (I_ring *ir)
+{
+  int top_val;
+  if (i_ring_empty (ir))
+    abort ();
+  top_val = ir->ir_data[ir->ir_front];
+  ir->ir_data[ir->ir_front] = ir->ir_default_val;
+  if (ir->ir_front == ir->ir_back)
+    ir->ir_empty = true;
+  else
+    ir->ir_front = ((ir->ir_front + I_RING_SIZE - 1) % I_RING_SIZE);
+  return top_val;
+}
deleted file mode 120000 (symlink)
index a0b76f2c8b783e16c834f67761242ad426c09577..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/i-ring.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7a493f670113613c4928aad775cc523ad384b36f
--- /dev/null
@@ -0,0 +1,47 @@
+/* definitions for a simple ring buffer
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+enum { I_RING_SIZE = 4 };
+static_assert (1 <= I_RING_SIZE);
+
+/* When ir_empty is true, the ring is empty.
+   Otherwise, ir_data[B..F] are defined, where B..F is the contiguous
+   range of indices, modulo I_RING_SIZE, from back to front, inclusive.
+   Undefined elements of ir_data are always set to ir_default_val.
+   Popping from an empty ring aborts.
+   Pushing onto a full ring returns the displaced value.
+   An empty ring has F==B and ir_empty == true.
+   A ring with one entry still has F==B, but now ir_empty == false.  */
+struct I_ring
+{
+  int ir_data[I_RING_SIZE];
+  int ir_default_val;
+  unsigned int ir_front;
+  unsigned int ir_back;
+  bool ir_empty;
+};
+typedef struct I_ring I_ring;
+
+void i_ring_init (I_ring *ir, int ir_default_val);
+int i_ring_push (I_ring *ir, int val);
+int i_ring_pop (I_ring *ir);
+bool i_ring_empty (I_ring const *ir) _GL_ATTRIBUTE_PURE;
deleted file mode 120000 (symlink)
index 2c00d8810375e9bde2726cae407d46ec18de9e07..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ialloc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8564a15b6a7dbdc519b7af651b8a47ca74d147f6
--- /dev/null
@@ -0,0 +1,21 @@
+/* malloc with idx_t rather than size_t
+
+   Copyright 2021-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IALLOC_INLINE _GL_EXTERN_INLINE
+#include "ialloc.h"
deleted file mode 120000 (symlink)
index 5f161da3200ec48fcdb31d90e1647fe8bd1ddefe..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ialloc.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2aa94ae7caf93f7df3cc21d432b248afad3e3f4f
--- /dev/null
@@ -0,0 +1,140 @@
+/* ialloc.h -- malloc with idx_t rather than size_t
+
+   Copyright 2021-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef IALLOC_H_
+#define IALLOC_H_
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_COLD,
+   _GL_ATTRIBUTE_MALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include "idx.h"
+
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+#if defined __CHERI_PURE_CAPABILITY__
+# include <cheri.h>
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef IALLOC_INLINE
+# define IALLOC_INLINE _GL_INLINE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+IALLOC_INLINE void * _GL_ATTRIBUTE_COLD
+_gl_alloc_nomem (void)
+{
+  errno = ENOMEM;
+  return NULL;
+}
+
+/* imalloc (size) is like malloc (size).
+   It returns a non-NULL pointer to size bytes of memory.
+   Upon failure, it returns NULL with errno set.  */
+IALLOC_INLINE
+_GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/
+void *
+imalloc (idx_t s)
+{
+  return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem ();
+}
+
+/* irealloc (ptr, size) is like realloc (ptr, size).
+   It returns a non-NULL pointer to size bytes of memory.
+   Upon failure, it returns NULL with errno set.  */
+IALLOC_INLINE
+/*_GL_ATTRIBUTE_DEALLOC_FREE*/
+void *
+irealloc (void *p, idx_t s)
+{
+  if (s <= SIZE_MAX)
+    {
+      /* Work around GNU realloc glitch by treating a zero size as if it
+         were 1, so that returning NULL is equivalent to failing.  */
+      p = realloc (p, s | !s);
+#if defined __CHERI_PURE_CAPABILITY__
+      if (p != NULL)
+        p = cheri_bounds_set (p, s);
+#endif
+      return p;
+    }
+  else
+    return _gl_alloc_nomem ();
+}
+
+/* icalloc (num, size) is like calloc (num, size).
+   It returns a non-NULL pointer to num * size bytes of memory.
+   Upon failure, it returns NULL with errno set.  */
+IALLOC_INLINE
+_GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/
+void *
+icalloc (idx_t n, idx_t s)
+{
+  if (SIZE_MAX < n)
+    {
+      if (s != 0)
+        return _gl_alloc_nomem ();
+      n = 0;
+    }
+  if (SIZE_MAX < s)
+    {
+      if (n != 0)
+        return _gl_alloc_nomem ();
+      s = 0;
+    }
+  return calloc (n, s);
+}
+
+/* ireallocarray (ptr, num, size) is like reallocarray (ptr, num, size).
+   It returns a non-NULL pointer to num * size bytes of memory.
+   Upon failure, it returns NULL with errno set.  */
+IALLOC_INLINE void *
+ireallocarray (void *p, idx_t n, idx_t s)
+{
+  if (n <= SIZE_MAX && s <= SIZE_MAX)
+    {
+      /* Work around GNU reallocarray glitch by treating a zero size as if
+         it were 1, so that returning NULL is equivalent to failing.  */
+      size_t nx = n;
+      size_t sx = s;
+      if (n == 0 || s == 0)
+        nx = sx = 1;
+      p = reallocarray (p, nx, sx);
+#if defined __CHERI_PURE_CAPABILITY__
+      if (p != NULL && (n == 0 || s == 0))
+        p = cheri_bounds_set (p, 0);
+#endif
+      return p;
+    }
+  else
+    return _gl_alloc_nomem ();
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif
deleted file mode 120000 (symlink)
index 383aeaf2e923d581c604c3580ff84ab039d33923..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..310f4043eb4586b101c0cf6a5a6dac8df7f0a0df
--- /dev/null
@@ -0,0 +1,446 @@
+/* Character set conversion.
+   Copyright (C) 1999-2001, 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <iconv.h>
+
+#include <stddef.h>
+
+#if REPLACE_ICONV_UTF
+# include <errno.h>
+# include <stdint.h>
+# include <stdlib.h>
+# include "unistr.h"
+#endif
+
+#if REPLACE_ICONV_UTF
+
+/* UTF-{16,32}{BE,LE} converters taken from GNU libiconv 1.11.  */
+
+/* Return code if invalid. (xxx_mbtowc) */
+# define RET_ILSEQ      -1
+/* Return code if no bytes were read. (xxx_mbtowc) */
+# define RET_TOOFEW     -2
+
+/* Return code if invalid. (xxx_wctomb) */
+# define RET_ILUNI      -1
+/* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */
+# define RET_TOOSMALL   -2
+
+/*
+ * UTF-16BE
+ */
+
+/* Specification: RFC 2781 */
+
+static int
+utf16be_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n)
+{
+  if (n >= 2)
+    {
+      ucs4_t wc = (s[0] << 8) + s[1];
+      if (wc >= 0xd800 && wc < 0xdc00)
+        {
+          if (n >= 4)
+            {
+              ucs4_t wc2 = (s[2] << 8) + s[3];
+              if (!(wc2 >= 0xdc00 && wc2 < 0xe000))
+                return RET_ILSEQ;
+              *pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00);
+              return 4;
+            }
+        }
+      else if (wc >= 0xdc00 && wc < 0xe000)
+        {
+          return RET_ILSEQ;
+        }
+      else
+        {
+          *pwc = wc;
+          return 2;
+        }
+    }
+  return RET_TOOFEW;
+}
+
+static int
+utf16be_wctomb (unsigned char *r, ucs4_t wc, size_t n)
+{
+  if (!(wc >= 0xd800 && wc < 0xe000))
+    {
+      if (wc < 0x10000)
+        {
+          if (n >= 2)
+            {
+              r[0] = (unsigned char) (wc >> 8);
+              r[1] = (unsigned char) wc;
+              return 2;
+            }
+          else
+            return RET_TOOSMALL;
+        }
+      else if (wc < 0x110000)
+        {
+          if (n >= 4)
+            {
+              ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10);
+              ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff);
+              r[0] = (unsigned char) (wc1 >> 8);
+              r[1] = (unsigned char) wc1;
+              r[2] = (unsigned char) (wc2 >> 8);
+              r[3] = (unsigned char) wc2;
+              return 4;
+            }
+          else
+            return RET_TOOSMALL;
+        }
+    }
+  return RET_ILUNI;
+}
+
+/*
+ * UTF-16LE
+ */
+
+/* Specification: RFC 2781 */
+
+static int
+utf16le_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n)
+{
+  if (n >= 2)
+    {
+      ucs4_t wc = s[0] + (s[1] << 8);
+      if (wc >= 0xd800 && wc < 0xdc00)
+        {
+          if (n >= 4)
+            {
+              ucs4_t wc2 = s[2] + (s[3] << 8);
+              if (!(wc2 >= 0xdc00 && wc2 < 0xe000))
+                return RET_ILSEQ;
+              *pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00);
+              return 4;
+            }
+        }
+      else if (wc >= 0xdc00 && wc < 0xe000)
+        {
+          return RET_ILSEQ;
+        }
+      else
+        {
+          *pwc = wc;
+          return 2;
+        }
+    }
+  return RET_TOOFEW;
+}
+
+static int
+utf16le_wctomb (unsigned char *r, ucs4_t wc, size_t n)
+{
+  if (!(wc >= 0xd800 && wc < 0xe000))
+    {
+      if (wc < 0x10000)
+        {
+          if (n >= 2)
+            {
+              r[0] = (unsigned char) wc;
+              r[1] = (unsigned char) (wc >> 8);
+              return 2;
+            }
+          else
+            return RET_TOOSMALL;
+        }
+      else if (wc < 0x110000)
+        {
+          if (n >= 4)
+            {
+              ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10);
+              ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff);
+              r[0] = (unsigned char) wc1;
+              r[1] = (unsigned char) (wc1 >> 8);
+              r[2] = (unsigned char) wc2;
+              r[3] = (unsigned char) (wc2 >> 8);
+              return 4;
+            }
+          else
+            return RET_TOOSMALL;
+        }
+    }
+  return RET_ILUNI;
+}
+
+/*
+ * UTF-32BE
+ */
+
+/* Specification: Unicode 3.1 Standard Annex #19 */
+
+static int
+utf32be_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n)
+{
+  if (n >= 4)
+    {
+      ucs4_t wc = (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3];
+      if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000))
+        {
+          *pwc = wc;
+          return 4;
+        }
+      else
+        return RET_ILSEQ;
+    }
+  return RET_TOOFEW;
+}
+
+static int
+utf32be_wctomb (unsigned char *r, ucs4_t wc, size_t n)
+{
+  if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000))
+    {
+      if (n >= 4)
+        {
+          r[0] = 0;
+          r[1] = (unsigned char) (wc >> 16);
+          r[2] = (unsigned char) (wc >> 8);
+          r[3] = (unsigned char) wc;
+          return 4;
+        }
+      else
+        return RET_TOOSMALL;
+    }
+  return RET_ILUNI;
+}
+
+/*
+ * UTF-32LE
+ */
+
+/* Specification: Unicode 3.1 Standard Annex #19 */
+
+static int
+utf32le_mbtowc (ucs4_t *pwc, const unsigned char *s, size_t n)
+{
+  if (n >= 4)
+    {
+      ucs4_t wc = s[0] + (s[1] << 8) + (s[2] << 16) + (s[3] << 24);
+      if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000))
+        {
+          *pwc = wc;
+          return 4;
+        }
+      else
+        return RET_ILSEQ;
+    }
+  return RET_TOOFEW;
+}
+
+static int
+utf32le_wctomb (unsigned char *r, ucs4_t wc, size_t n)
+{
+  if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000))
+    {
+      if (n >= 4)
+        {
+          r[0] = (unsigned char) wc;
+          r[1] = (unsigned char) (wc >> 8);
+          r[2] = (unsigned char) (wc >> 16);
+          r[3] = 0;
+          return 4;
+        }
+      else
+        return RET_TOOSMALL;
+    }
+  return RET_ILUNI;
+}
+
+#endif
+
+size_t
+rpl_iconv (iconv_t cd,
+           ICONV_CONST char **inbuf, size_t *inbytesleft,
+           char **outbuf, size_t *outbytesleft)
+#undef iconv
+{
+#if REPLACE_ICONV_UTF
+  switch ((uintptr_t) cd)
+    {
+      {
+        int (*xxx_wctomb) (unsigned char *, ucs4_t, size_t);
+
+        case (uintptr_t) _ICONV_UTF8_UTF16BE:
+          xxx_wctomb = utf16be_wctomb;
+          goto loop_from_utf8;
+        case (uintptr_t) _ICONV_UTF8_UTF16LE:
+          xxx_wctomb = utf16le_wctomb;
+          goto loop_from_utf8;
+        case (uintptr_t) _ICONV_UTF8_UTF32BE:
+          xxx_wctomb = utf32be_wctomb;
+          goto loop_from_utf8;
+        case (uintptr_t) _ICONV_UTF8_UTF32LE:
+          xxx_wctomb = utf32le_wctomb;
+          goto loop_from_utf8;
+
+       loop_from_utf8:
+        if (inbuf == NULL || *inbuf == NULL)
+          return 0;
+        {
+          ICONV_CONST char *inptr = *inbuf;
+          size_t inleft = *inbytesleft;
+          char *outptr = *outbuf;
+          size_t outleft = *outbytesleft;
+          size_t res = 0;
+          while (inleft > 0)
+            {
+              ucs4_t uc;
+              int m = u8_mbtoucr (&uc, (const uint8_t *) inptr, inleft);
+              if (m <= 0)
+                {
+                  if (m == -1)
+                    {
+                      errno = EILSEQ;
+                      res = (size_t)(-1);
+                      break;
+                    }
+                  if (m == -2)
+                    {
+                      errno = EINVAL;
+                      res = (size_t)(-1);
+                      break;
+                    }
+                  abort ();
+                }
+              else
+                {
+                  int n = xxx_wctomb ((uint8_t *) outptr, uc, outleft);
+                  if (n < 0)
+                    {
+                      if (n == RET_ILUNI)
+                        {
+                          errno = EILSEQ;
+                          res = (size_t)(-1);
+                          break;
+                        }
+                      if (n == RET_TOOSMALL)
+                        {
+                          errno = E2BIG;
+                          res = (size_t)(-1);
+                          break;
+                        }
+                      abort ();
+                    }
+                  else
+                    {
+                      inptr += m;
+                      inleft -= m;
+                      outptr += n;
+                      outleft -= n;
+                    }
+                }
+            }
+          *inbuf = inptr;
+          *inbytesleft = inleft;
+          *outbuf = outptr;
+          *outbytesleft = outleft;
+          return res;
+        }
+      }
+
+      {
+        int (*xxx_mbtowc) (ucs4_t *, const unsigned char *, size_t);
+
+        case (uintptr_t) _ICONV_UTF16BE_UTF8:
+          xxx_mbtowc = utf16be_mbtowc;
+          goto loop_to_utf8;
+        case (uintptr_t) _ICONV_UTF16LE_UTF8:
+          xxx_mbtowc = utf16le_mbtowc;
+          goto loop_to_utf8;
+        case (uintptr_t) _ICONV_UTF32BE_UTF8:
+          xxx_mbtowc = utf32be_mbtowc;
+          goto loop_to_utf8;
+        case (uintptr_t) _ICONV_UTF32LE_UTF8:
+          xxx_mbtowc = utf32le_mbtowc;
+          goto loop_to_utf8;
+
+       loop_to_utf8:
+        if (inbuf == NULL || *inbuf == NULL)
+          return 0;
+        {
+          ICONV_CONST char *inptr = *inbuf;
+          size_t inleft = *inbytesleft;
+          char *outptr = *outbuf;
+          size_t outleft = *outbytesleft;
+          size_t res = 0;
+          while (inleft > 0)
+            {
+              ucs4_t uc;
+              int m = xxx_mbtowc (&uc, (const uint8_t *) inptr, inleft);
+              if (m <= 0)
+                {
+                  if (m == RET_ILSEQ)
+                    {
+                      errno = EILSEQ;
+                      res = (size_t)(-1);
+                      break;
+                    }
+                  if (m == RET_TOOFEW)
+                    {
+                      errno = EINVAL;
+                      res = (size_t)(-1);
+                      break;
+                    }
+                  abort ();
+                }
+              else
+                {
+                  int n = u8_uctomb ((uint8_t *) outptr, uc, outleft);
+                  if (n < 0)
+                    {
+                      if (n == -1)
+                        {
+                          errno = EILSEQ;
+                          res = (size_t)(-1);
+                          break;
+                        }
+                      if (n == -2)
+                        {
+                          errno = E2BIG;
+                          res = (size_t)(-1);
+                          break;
+                        }
+                      abort ();
+                    }
+                  else
+                    {
+                      inptr += m;
+                      inleft -= m;
+                      outptr += n;
+                      outleft -= n;
+                    }
+                }
+            }
+          *inbuf = inptr;
+          *inbytesleft = inleft;
+          *outbuf = outptr;
+          *outbytesleft = outleft;
+          return res;
+        }
+      }
+    }
+#endif
+  return iconv (cd, inbuf, inbytesleft, outbuf, outbytesleft);
+}
deleted file mode 120000 (symlink)
index 54d0b6393b1a6e731fd5e7975f3f2c164f0a8603..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9e41e4174d8ba3185cda9d6b7d94d5408c30837b
--- /dev/null
@@ -0,0 +1,132 @@
+/* A GNU-like <iconv.h>.
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_ICONV_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_ICONV_H@
+
+#ifndef _@GUARD_PREFIX@_ICONV_H
+#define _@GUARD_PREFIX@_ICONV_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+#if @GNULIB_ICONV@
+# if @REPLACE_ICONV_OPEN@
+/* An iconv_open wrapper that supports the IANA standardized encoding names
+   ("ISO-8859-1" etc.) as far as possible.  */
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define iconv_open rpl_iconv_open
+#  endif
+_GL_FUNCDECL_RPL (iconv_open, iconv_t,
+                  (const char *tocode, const char *fromcode)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (iconv_open, iconv_t,
+                  (const char *tocode, const char *fromcode));
+# else
+_GL_CXXALIAS_SYS (iconv_open, iconv_t,
+                  (const char *tocode, const char *fromcode));
+# endif
+_GL_CXXALIASWARN (iconv_open);
+#elif defined GNULIB_POSIXCHECK
+# undef iconv_open
+# if HAVE_RAW_DECL_ICONV_OPEN
+_GL_WARN_ON_USE (iconv_open, "iconv_open is not working correctly everywhere - "
+                 "use gnulib module iconv for portability");
+# endif
+#endif
+
+#if @REPLACE_ICONV_UTF@
+/* Special constants for supporting UTF-{16,32}{BE,LE} encodings.
+   Not public.  */
+# define _ICONV_UTF8_UTF16BE (iconv_t)(-161)
+# define _ICONV_UTF8_UTF16LE (iconv_t)(-162)
+# define _ICONV_UTF8_UTF32BE (iconv_t)(-163)
+# define _ICONV_UTF8_UTF32LE (iconv_t)(-164)
+# define _ICONV_UTF16BE_UTF8 (iconv_t)(-165)
+# define _ICONV_UTF16LE_UTF8 (iconv_t)(-166)
+# define _ICONV_UTF32BE_UTF8 (iconv_t)(-167)
+# define _ICONV_UTF32LE_UTF8 (iconv_t)(-168)
+#endif
+
+#if @GNULIB_ICONV@
+# if @REPLACE_ICONV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define iconv rpl_iconv
+#  endif
+_GL_FUNCDECL_RPL (iconv, size_t,
+                  (iconv_t cd,
+                   @ICONV_CONST@ char **restrict inbuf,
+                   size_t *restrict inbytesleft,
+                   char **restrict outbuf, size_t *restrict outbytesleft));
+_GL_CXXALIAS_RPL (iconv, size_t,
+                  (iconv_t cd,
+                   @ICONV_CONST@ char **restrict inbuf,
+                   size_t *restrict inbytesleft,
+                   char **restrict outbuf, size_t *restrict outbytesleft));
+# else
+/* Need to cast, because on some versions of Solaris, ICONV_CONST does
+   not have the right value for C++.  */
+_GL_CXXALIAS_SYS_CAST (iconv, size_t,
+                       (iconv_t cd,
+                        @ICONV_CONST@ char **restrict inbuf,
+                        size_t *restrict inbytesleft,
+                        char **restrict outbuf, size_t *restrict outbytesleft));
+# endif
+_GL_CXXALIASWARN (iconv);
+# ifndef ICONV_CONST
+#  define ICONV_CONST @ICONV_CONST@
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef iconv
+# if HAVE_RAW_DECL_ICONV
+_GL_WARN_ON_USE (iconv, "iconv is not working correctly everywhere - "
+                 "use gnulib module iconv for portability");
+# endif
+#endif
+
+#if @GNULIB_ICONV@
+# if @REPLACE_ICONV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define iconv_close rpl_iconv_close
+#  endif
+_GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd));
+_GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd));
+# else
+_GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd));
+# endif
+_GL_CXXALIASWARN (iconv_close);
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_ICONV_H */
+#endif /* _@GUARD_PREFIX@_ICONV_H */
deleted file mode 120000 (symlink)
index 37d820436671208a4784b1296ad058086fe81e1f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv_close.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..692cbb84f7188b1b9cd7cd5b00520df7813dff1d
--- /dev/null
@@ -0,0 +1,43 @@
+/* Character set conversion.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <iconv.h>
+
+#include <stdint.h>
+
+int
+rpl_iconv_close (iconv_t cd)
+#undef iconv_close
+{
+#if REPLACE_ICONV_UTF
+  switch ((uintptr_t) cd)
+    {
+    case (uintptr_t) _ICONV_UTF8_UTF16BE:
+    case (uintptr_t) _ICONV_UTF8_UTF16LE:
+    case (uintptr_t) _ICONV_UTF8_UTF32BE:
+    case (uintptr_t) _ICONV_UTF8_UTF32LE:
+    case (uintptr_t) _ICONV_UTF16BE_UTF8:
+    case (uintptr_t) _ICONV_UTF16LE_UTF8:
+    case (uintptr_t) _ICONV_UTF32BE_UTF8:
+    case (uintptr_t) _ICONV_UTF32LE_UTF8:
+      return 0;
+    }
+#endif
+  return iconv_close (cd);
+}
deleted file mode 120000 (symlink)
index 9ee5f36676161e0878355fefd039a525b24f57f8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv_open-aix.gperf
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..55cccd0320f6dd47a0ff5b75aa0787bbfe61a575
--- /dev/null
@@ -0,0 +1,60 @@
+/* Character set conversion.
+   Copyright (C) 2007, 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+struct mapping { int standard_name; const char vendor_name[10 + 1]; };
+%struct-type
+%language=ANSI-C
+%define slot-name standard_name
+%define hash-function-name mapping_hash
+%define lookup-function-name mapping_lookup
+%readonly-tables
+%global-table
+%define word-array-name mappings
+%pic
+%%
+# On AIX 5.1, look in /usr/lib/nls/loc/uconvTable.
+ISO-8859-1, "ISO8859-1"
+ISO-8859-2, "ISO8859-2"
+ISO-8859-3, "ISO8859-3"
+ISO-8859-4, "ISO8859-4"
+ISO-8859-5, "ISO8859-5"
+ISO-8859-6, "ISO8859-6"
+ISO-8859-7, "ISO8859-7"
+ISO-8859-8, "ISO8859-8"
+ISO-8859-9, "ISO8859-9"
+ISO-8859-15, "ISO8859-15"
+CP437, "IBM-437"
+CP850, "IBM-850"
+CP852, "IBM-852"
+CP856, "IBM-856"
+CP857, "IBM-857"
+CP861, "IBM-861"
+CP865, "IBM-865"
+CP869, "IBM-869"
+ISO-8859-13, "IBM-921"
+CP922, "IBM-922"
+CP932, "IBM-932"
+CP943, "IBM-943"
+CP1046, "IBM-1046"
+CP1124, "IBM-1124"
+CP1125, "IBM-1125"
+CP1129, "IBM-1129"
+CP1252, "IBM-1252"
+GB2312, "IBM-eucCN"
+EUC-JP, "IBM-eucJP"
+EUC-KR, "IBM-eucKR"
+EUC-TW, "IBM-eucTW"
+BIG5, "big5"
deleted file mode 120000 (symlink)
index fad5f0679a3cd68505a72e3fe1fb7e9ed6fecc54..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv_open-hpux.gperf
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ddf51e30fc785e9f1f90d20049a88d9eed888ee0
--- /dev/null
@@ -0,0 +1,72 @@
+/* Character set conversion.
+   Copyright (C) 2007, 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+struct mapping { int standard_name; const char vendor_name[9 + 1]; };
+%struct-type
+%language=ANSI-C
+%define slot-name standard_name
+%define hash-function-name mapping_hash
+%define lookup-function-name mapping_lookup
+%readonly-tables
+%global-table
+%define word-array-name mappings
+%pic
+%%
+# On HP-UX 11.11, look in /usr/lib/nls/iconv.
+ISO-8859-1, "iso88591"
+ISO-8859-2, "iso88592"
+ISO-8859-5, "iso88595"
+ISO-8859-6, "iso88596"
+ISO-8859-7, "iso88597"
+ISO-8859-8, "iso88598"
+ISO-8859-9, "iso88599"
+ISO-8859-15, "iso885915"
+CP437, "cp437"
+CP775, "cp775"
+CP850, "cp850"
+CP852, "cp852"
+CP855, "cp855"
+CP857, "cp857"
+CP861, "cp861"
+CP862, "cp862"
+CP864, "cp864"
+CP865, "cp865"
+CP866, "cp866"
+CP869, "cp869"
+CP874, "cp874"
+CP1250, "cp1250"
+CP1251, "cp1251"
+CP1252, "cp1252"
+CP1253, "cp1253"
+CP1254, "cp1254"
+CP1255, "cp1255"
+CP1256, "cp1256"
+CP1257, "cp1257"
+CP1258, "cp1258"
+HP-ROMAN8, "roman8"
+HP-ARABIC8, "arabic8"
+HP-GREEK8, "greek8"
+HP-HEBREW8, "hebrew8"
+HP-TURKISH8, "turkish8"
+HP-KANA8, "kana8"
+TIS-620, "tis620"
+GB2312, "hp15CN"
+EUC-JP, "eucJP"
+EUC-KR, "eucKR"
+EUC-TW, "eucTW"
+BIG5, "big5"
+SHIFT_JIS, "sjis"
+UTF-8, "utf8"
deleted file mode 120000 (symlink)
index 8694577d2dc5645e4b93e1b8b6071c33b3c695b4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv_open-irix.gperf
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cd0ad544afae4c7f9c29521f5f07142ab63ce5bf
--- /dev/null
@@ -0,0 +1,47 @@
+/* Character set conversion.
+   Copyright (C) 2007, 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+struct mapping { int standard_name; const char vendor_name[10 + 1]; };
+%struct-type
+%language=ANSI-C
+%define slot-name standard_name
+%define hash-function-name mapping_hash
+%define lookup-function-name mapping_lookup
+%readonly-tables
+%global-table
+%define word-array-name mappings
+%pic
+%%
+# On IRIX 6.5, look in /usr/lib/iconv and /usr/lib/international/encodings.
+ISO-8859-1, "ISO8859-1"
+ISO-8859-2, "ISO8859-2"
+ISO-8859-3, "ISO8859-3"
+ISO-8859-4, "ISO8859-4"
+ISO-8859-5, "ISO8859-5"
+ISO-8859-6, "ISO8859-6"
+ISO-8859-7, "ISO8859-7"
+ISO-8859-8, "ISO8859-8"
+ISO-8859-9, "ISO8859-9"
+ISO-8859-15, "ISO8859-15"
+KOI8-R, "KOI8"
+CP855, "DOS855"
+CP1251, "WIN1251"
+GB2312, "eucCN"
+EUC-JP, "eucJP"
+EUC-KR, "eucKR"
+EUC-TW, "eucTW"
+SHIFT_JIS, "sjis"
+TIS-620, "TIS620"
deleted file mode 120000 (symlink)
index 57874cca62fe57217708474068a048c7980e4631..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv_open-osf.gperf
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..417f7e3ec4831613d515dbd584e79ac9718d0771
--- /dev/null
@@ -0,0 +1,66 @@
+/* Character set conversion.
+   Copyright (C) 2007, 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+struct mapping { int standard_name; const char vendor_name[10 + 1]; };
+%struct-type
+%language=ANSI-C
+%define slot-name standard_name
+%define hash-function-name mapping_hash
+%define lookup-function-name mapping_lookup
+%readonly-tables
+%global-table
+%define word-array-name mappings
+%pic
+%%
+# On OSF/1 5.1, look in /usr/lib/nls/loc/iconv.
+ISO-8859-1, "ISO8859-1"
+ISO-8859-2, "ISO8859-2"
+ISO-8859-3, "ISO8859-3"
+ISO-8859-4, "ISO8859-4"
+ISO-8859-5, "ISO8859-5"
+ISO-8859-6, "ISO8859-6"
+ISO-8859-7, "ISO8859-7"
+ISO-8859-8, "ISO8859-8"
+ISO-8859-9, "ISO8859-9"
+ISO-8859-15, "ISO8859-15"
+CP437, "cp437"
+CP775, "cp775"
+CP850, "cp850"
+CP852, "cp852"
+CP855, "cp855"
+CP857, "cp857"
+CP861, "cp861"
+CP862, "cp862"
+CP865, "cp865"
+CP866, "cp866"
+CP869, "cp869"
+CP874, "cp874"
+CP949, "KSC5601"
+CP1250, "cp1250"
+CP1251, "cp1251"
+CP1252, "cp1252"
+CP1253, "cp1253"
+CP1254, "cp1254"
+CP1255, "cp1255"
+CP1256, "cp1256"
+CP1257, "cp1257"
+CP1258, "cp1258"
+EUC-JP, "eucJP"
+EUC-KR, "eucKR"
+EUC-TW, "eucTW"
+BIG5, "big5"
+SHIFT_JIS, "SJIS"
+TIS-620, "TACTIS"
deleted file mode 120000 (symlink)
index 33da38e2029d1259934b44bab108342e1a8d8d75..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv_open-solaris.gperf
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d5411de0c18734d776e8c384cd21c34f620fb9fa
--- /dev/null
@@ -0,0 +1,46 @@
+/* Character set conversion.
+   Copyright (C) 2007, 2009, 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+struct mapping { int standard_name; const char vendor_name[10 + 1]; };
+%struct-type
+%language=ANSI-C
+%define slot-name standard_name
+%define hash-function-name mapping_hash
+%define lookup-function-name mapping_lookup
+%readonly-tables
+%global-table
+%define word-array-name mappings
+%pic
+%%
+# On Solaris 10, look in the "iconv -l" output. Some aliases are advertised but
+# not actually supported by the iconv() function and by the 'iconv' program.
+# For example:
+#   $ echo abc | iconv -f 646 -t ISO-8859-1
+#   Not supported 646 to ISO-8859-1
+#   $ echo abc | iconv -f 646 -t ISO8859-1
+$   abc
+ASCII, "646"
+ISO-8859-1, "ISO8859-1"
+ISO-8859-2, "ISO8859-2"
+ISO-8859-3, "ISO8859-3"
+ISO-8859-4, "ISO8859-4"
+ISO-8859-5, "ISO8859-5"
+ISO-8859-6, "ISO8859-6"
+ISO-8859-7, "ISO8859-7"
+ISO-8859-8, "ISO8859-8"
+ISO-8859-9, "ISO8859-9"
+ISO-8859-15, "ISO8859-15"
+CP1251, "ansi-1251"
deleted file mode 120000 (symlink)
index 4f62c7f1a623088f28d1f71b50acd67aaeaf6b9a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv_open-zos.gperf
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a7fc3dc7c1257ffb88af0a3f9d8c9471df33a1ed
--- /dev/null
@@ -0,0 +1,76 @@
+/* Character set conversion.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+struct mapping { int standard_name; const char vendor_name[10 + 1]; };
+%struct-type
+%language=ANSI-C
+%define slot-name standard_name
+%define hash-function-name mapping_hash
+%define lookup-function-name mapping_lookup
+%readonly-tables
+%global-table
+%define word-array-name mappings
+%pic
+%%
+ASCII, "00367"
+ISO-8859-1, "ISO8859-1"
+ISO-8859-2, "ISO8859-2"
+ISO-8859-3, "00913"
+ISO-8859-4, "ISO8859-4"
+ISO-8859-5, "ISO8859-5"
+ISO-8859-6, "ISO8859-6"
+ISO-8859-7, "ISO8859-7"
+ISO-8859-8, "05012"
+ISO-8859-9, "ISO8859-9"
+ISO-8859-13, "ISO8859-13"
+ISO-8859-15, "ISO8859-15"
+KOI8-R, "00878"
+KOI8-U, "01168"
+CP437, "IBM-437"
+CP775, "00775"
+CP850, "09042"
+CP852, "IBM-852"
+CP855, "13143"
+CP856, "IBM-856"
+CP857, "00857"
+CP861, "IBM-861"
+CP862, "IBM-862"
+CP864, "IBM-864"
+CP865, "00865"
+CP866, "04962"
+CP869, "IBM-869"
+CP874, "TIS-620"
+CP922, "IBM-922"
+CP932, "IBM-943"
+CP943, "IBM-943"
+CP949, "IBM-1363"
+CP1046, "IBM-1046"
+CP1124, "IBM-1124"
+CP1125, "IBM-1125"
+CP1129, "01129"
+CP1131, "01131"
+CP1250, "IBM-5346"
+CP1251, "IBM-5347"
+CP1252, "IBM-5348"
+CP1253, "IBM-5349"
+CP1254, "IBM-5350"
+CP1255, "09447"
+CP1256, "09448"
+CP1257, "09449"
+GB2312, "IBM-eucCN"
+EUC-JP, "01350"
+EUC-KR, "IBM-eucKR"
+GBK, "IBM-1386"
deleted file mode 120000 (symlink)
index 7ee7c6e79182b9b05bb2859d1a7e6e2944077a61..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iconv_open.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2be02eff9e386166e855ac014c8d91d0fa10da90
--- /dev/null
@@ -0,0 +1,173 @@
+/* Character set conversion.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <iconv.h>
+
+#include <errno.h>
+#include <string.h>
+#include "c-ctype.h"
+#include "c-strcase.h"
+
+#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
+
+/* Namespace cleanliness.  */
+#define mapping_lookup rpl_iconv_open_mapping_lookup
+
+/* The macro ICONV_FLAVOR is defined to one of these or undefined.  */
+
+#define ICONV_FLAVOR_AIX "iconv_open-aix.h"
+#define ICONV_FLAVOR_HPUX "iconv_open-hpux.h"
+#define ICONV_FLAVOR_IRIX "iconv_open-irix.h"
+#define ICONV_FLAVOR_OSF "iconv_open-osf.h"
+#define ICONV_FLAVOR_SOLARIS "iconv_open-solaris.h"
+#define ICONV_FLAVOR_ZOS "iconv_open-zos.h"
+
+#ifdef ICONV_FLAVOR
+# include ICONV_FLAVOR
+#endif
+
+iconv_t
+rpl_iconv_open (const char *tocode, const char *fromcode)
+#undef iconv_open
+{
+  char fromcode_upper[32];
+  char tocode_upper[32];
+  char *fromcode_upper_end;
+  char *tocode_upper_end;
+
+#if REPLACE_ICONV_UTF
+  /* Special handling of conversion between UTF-8 and UTF-{16,32}{BE,LE}.
+     Do this here, before calling the real iconv_open(), because  OSF/1 5.1
+     iconv() to these encoding inserts a BOM, which is wrong.
+     We do not need to handle conversion between arbitrary encodings and
+     UTF-{16,32}{BE,LE}, because the 'striconveh' module implements two-step
+     conversion through UTF-8.
+     The _ICONV_* constants are chosen to be disjoint from any iconv_t
+     returned by the system's iconv_open() functions.  Recall that iconv_t
+     is a scalar type.  */
+  if (c_toupper (fromcode[0]) == 'U'
+      && c_toupper (fromcode[1]) == 'T'
+      && c_toupper (fromcode[2]) == 'F'
+      && fromcode[3] == '-')
+    {
+      if (c_toupper (tocode[0]) == 'U'
+          && c_toupper (tocode[1]) == 'T'
+          && c_toupper (tocode[2]) == 'F'
+          && tocode[3] == '-')
+        {
+          if (strcmp (fromcode + 4, "8") == 0)
+            {
+              if (c_strcasecmp (tocode + 4, "16BE") == 0)
+                return _ICONV_UTF8_UTF16BE;
+              if (c_strcasecmp (tocode + 4, "16LE") == 0)
+                return _ICONV_UTF8_UTF16LE;
+              if (c_strcasecmp (tocode + 4, "32BE") == 0)
+                return _ICONV_UTF8_UTF32BE;
+              if (c_strcasecmp (tocode + 4, "32LE") == 0)
+                return _ICONV_UTF8_UTF32LE;
+            }
+          else if (strcmp (tocode + 4, "8") == 0)
+            {
+              if (c_strcasecmp (fromcode + 4, "16BE") == 0)
+                return _ICONV_UTF16BE_UTF8;
+              if (c_strcasecmp (fromcode + 4, "16LE") == 0)
+                return _ICONV_UTF16LE_UTF8;
+              if (c_strcasecmp (fromcode + 4, "32BE") == 0)
+                return _ICONV_UTF32BE_UTF8;
+              if (c_strcasecmp (fromcode + 4, "32LE") == 0)
+                return _ICONV_UTF32LE_UTF8;
+            }
+        }
+    }
+#endif
+
+  /* Do *not* add special support for 8-bit encodings like ASCII or ISO-8859-1
+     here.  This would lead to programs that work in some locales (such as the
+     "C" or "en_US" locales) but do not work in East Asian locales.  It is
+     better if programmers make their programs depend on GNU libiconv (except
+     on glibc systems), e.g. by using the AM_ICONV macro and documenting the
+     dependency in an INSTALL or DEPENDENCIES file.  */
+
+  /* Try with the original names first.
+     This covers the case when fromcode or tocode is a lowercase encoding name
+     that is understood by the system's iconv_open but not listed in our
+     mappings table.  */
+  {
+    iconv_t cd = iconv_open (tocode, fromcode);
+    if (cd != (iconv_t)(-1))
+      return cd;
+  }
+
+  /* Convert the encodings to upper case, because
+       1. in the arguments of iconv_open() on AIX, HP-UX, and OSF/1 the case
+          matters,
+       2. it makes searching in the table faster.  */
+  {
+    const char *p = fromcode;
+    char *q = fromcode_upper;
+    while ((*q = c_toupper (*p)) != '\0')
+      {
+        p++;
+        q++;
+        if (q == &fromcode_upper[SIZEOF (fromcode_upper)])
+          {
+            errno = EINVAL;
+            return (iconv_t)(-1);
+          }
+      }
+    fromcode_upper_end = q;
+  }
+
+  {
+    const char *p = tocode;
+    char *q = tocode_upper;
+    while ((*q = c_toupper (*p)) != '\0')
+      {
+        p++;
+        q++;
+        if (q == &tocode_upper[SIZEOF (tocode_upper)])
+          {
+            errno = EINVAL;
+            return (iconv_t)(-1);
+          }
+      }
+    tocode_upper_end = q;
+  }
+
+#ifdef ICONV_FLAVOR
+  /* Apply the mappings.  */
+  {
+    const struct mapping *m =
+      mapping_lookup (fromcode_upper, fromcode_upper_end - fromcode_upper);
+
+    fromcode = (m != NULL ? m->vendor_name : fromcode_upper);
+  }
+  {
+    const struct mapping *m =
+      mapping_lookup (tocode_upper, tocode_upper_end - tocode_upper);
+
+    tocode = (m != NULL ? m->vendor_name : tocode_upper);
+  }
+#else
+  fromcode = fromcode_upper;
+  tocode = tocode_upper;
+#endif
+
+  return iconv_open (tocode, fromcode);
+}
deleted file mode 120000 (symlink)
index cae6c3f0680b1364e74cc48146fb49dcad56e1af..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/idcache.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ccaf56dad2ffb69f6a0a9f5ec65a2fdaaeeb42c0
--- /dev/null
@@ -0,0 +1,228 @@
+/* idcache.c -- map user and group IDs, cached for speed
+
+   Copyright (C) 1985, 1988-1990, 1997-1998, 2003, 2005-2007, 2009-2024 Free
+   Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "idcache.h"
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <pwd.h>
+#include <grp.h>
+
+#include <unistd.h>
+
+#include "flexmember.h"
+#include "xalloc.h"
+
+#ifdef __DJGPP__
+static char digits[] = "0123456789";
+#endif
+
+struct userid
+{
+  union
+    {
+      uid_t u;
+      gid_t g;
+    } id;
+  struct userid *next;
+  char name[FLEXIBLE_ARRAY_MEMBER];
+};
+
+/* FIXME: provide a function to free any malloc'd storage and reset lists,
+   so that an application can use code like this just before exiting:
+   #if defined GCC_LINT || defined lint
+     idcache_clear ();
+   #endif
+*/
+
+static struct userid *user_alist;
+
+/* Each entry on list is a user name for which the first lookup failed.  */
+static struct userid *nouser_alist;
+
+/* Use the same struct as for userids.  */
+static struct userid *group_alist;
+
+/* Each entry on list is a group name for which the first lookup failed.  */
+static struct userid *nogroup_alist;
+
+/* Translate UID to a login name, with cache, or NULL if unresolved.  */
+
+char *
+getuser (uid_t uid)
+{
+  struct userid *tail;
+  struct userid *match = NULL;
+
+  for (tail = user_alist; tail; tail = tail->next)
+    {
+      if (tail->id.u == uid)
+        {
+          match = tail;
+          break;
+        }
+    }
+
+  if (match == NULL)
+    {
+      struct passwd *pwent = getpwuid (uid);
+      char const *name = pwent ? pwent->pw_name : "";
+      match = xmalloc (FLEXSIZEOF (struct userid, name, strlen (name) + 1));
+      match->id.u = uid;
+      strcpy (match->name, name);
+
+      /* Add to the head of the list, so most recently used is first.  */
+      match->next = user_alist;
+      user_alist = match;
+    }
+
+  return match->name[0] ? match->name : NULL;
+}
+
+/* Translate USER to a UID, with cache.
+   Return NULL if there is no such user.
+   (We also cache which user names have no passwd entry,
+   so we don't keep looking them up.)  */
+
+uid_t *
+getuidbyname (const char *user)
+{
+  struct userid *tail;
+  struct passwd *pwent;
+
+  for (tail = user_alist; tail; tail = tail->next)
+    /* Avoid a function call for the most common case.  */
+    if (*tail->name == *user && !strcmp (tail->name, user))
+      return &tail->id.u;
+
+  for (tail = nouser_alist; tail; tail = tail->next)
+    /* Avoid a function call for the most common case.  */
+    if (*tail->name == *user && !strcmp (tail->name, user))
+      return NULL;
+
+  pwent = getpwnam (user);
+#ifdef __DJGPP__
+  /* We need to pretend to be the user USER, to make
+     pwd functions know about an arbitrary user name.  */
+  if (!pwent && strspn (user, digits) < strlen (user))
+    {
+      setenv ("USER", user, 1);
+      pwent = getpwnam (user);  /* now it will succeed */
+    }
+#endif
+
+  tail = xmalloc (FLEXSIZEOF (struct userid, name, strlen (user) + 1));
+  strcpy (tail->name, user);
+
+  /* Add to the head of the list, so most recently used is first.  */
+  if (pwent)
+    {
+      tail->id.u = pwent->pw_uid;
+      tail->next = user_alist;
+      user_alist = tail;
+      return &tail->id.u;
+    }
+
+  tail->next = nouser_alist;
+  nouser_alist = tail;
+  return NULL;
+}
+
+/* Translate GID to a group name, with cache, or NULL if unresolved.  */
+
+char *
+getgroup (gid_t gid)
+{
+  struct userid *tail;
+  struct userid *match = NULL;
+
+  for (tail = group_alist; tail; tail = tail->next)
+    {
+      if (tail->id.g == gid)
+        {
+          match = tail;
+          break;
+        }
+    }
+
+  if (match == NULL)
+    {
+      struct group *grent = getgrgid (gid);
+      char const *name = grent ? grent->gr_name : "";
+      match = xmalloc (FLEXSIZEOF (struct userid, name, strlen (name) + 1));
+      match->id.g = gid;
+      strcpy (match->name, name);
+
+      /* Add to the head of the list, so most recently used is first.  */
+      match->next = group_alist;
+      group_alist = match;
+    }
+
+  return match->name[0] ? match->name : NULL;
+}
+
+/* Translate GROUP to a GID, with cache.
+   Return NULL if there is no such group.
+   (We also cache which group names have no group entry,
+   so we don't keep looking them up.)  */
+
+gid_t *
+getgidbyname (const char *group)
+{
+  struct userid *tail;
+  struct group *grent;
+
+  for (tail = group_alist; tail; tail = tail->next)
+    /* Avoid a function call for the most common case.  */
+    if (*tail->name == *group && !strcmp (tail->name, group))
+      return &tail->id.g;
+
+  for (tail = nogroup_alist; tail; tail = tail->next)
+    /* Avoid a function call for the most common case.  */
+    if (*tail->name == *group && !strcmp (tail->name, group))
+      return NULL;
+
+  grent = getgrnam (group);
+#ifdef __DJGPP__
+  /* We need to pretend to belong to group GROUP, to make
+     grp functions know about an arbitrary group name.  */
+  if (!grent && strspn (group, digits) < strlen (group))
+    {
+      setenv ("GROUP", group, 1);
+      grent = getgrnam (group); /* now it will succeed */
+    }
+#endif
+
+  tail = xmalloc (FLEXSIZEOF (struct userid, name, strlen (group) + 1));
+  strcpy (tail->name, group);
+
+  /* Add to the head of the list, so most recently used is first.  */
+  if (grent)
+    {
+      tail->id.g = grent->gr_gid;
+      tail->next = group_alist;
+      group_alist = tail;
+      return &tail->id.g;
+    }
+
+  tail->next = nogroup_alist;
+  nogroup_alist = tail;
+  return NULL;
+}
deleted file mode 120000 (symlink)
index 73eb4c34f4da1947f3f16a3b797841c9d1b01499..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/idcache.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..55f3ab7596f59a42f129e61e40bb0abcfaa8c5d1
--- /dev/null
@@ -0,0 +1,29 @@
+/* Username <--> uid and groupname <--> gid conversions, with cache for speed.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering, 2007.  */
+
+#ifndef IDCACHE_H
+# define IDCACHE_H 1
+
+# include <sys/types.h>
+
+extern char *getuser (uid_t uid);
+extern char *getgroup (gid_t gid);
+extern uid_t *getuidbyname (const char *user);
+extern gid_t *getgidbyname (const char *group);
+
+#endif
deleted file mode 120000 (symlink)
index 1c5828c08fc9856119ac3238e60b786c1b9bb93c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/idx.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f9ce0acd57d019a78241c360904bdd3118031e8a
--- /dev/null
@@ -0,0 +1,134 @@
+/* A type for indices and sizes.
+   Copyright (C) 2020-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _IDX_H
+#define _IDX_H
+
+/* Get ptrdiff_t.  */
+#include <stddef.h>
+
+/* Get PTRDIFF_MAX.  */
+#include <stdint.h>
+
+/* The type 'idx_t' holds an (array) index or an (object) size.
+   Its implementation promotes to a signed integer type,
+   which can hold the values
+     0..2^63-1 (on 64-bit platforms) or
+     0..2^31-1 (on 32-bit platforms).
+
+   Why a signed integer type?
+
+     * Security: Signed types can be checked for overflow via
+       '-fsanitize=undefined', but unsigned types cannot.
+
+     * Comparisons without surprises: ISO C99 § 6.3.1.8 specifies a few
+       surprising results for comparisons, such as
+
+           (int) -3 < (unsigned long) 7  =>  false
+           (int) -3 < (unsigned int) 7   =>  false
+       and on 32-bit machines:
+           (long) -3 < (unsigned int) 7  =>  false
+
+       This is surprising because the natural comparison order is by
+       value in the realm of infinite-precision signed integers (ℤ).
+
+       The best way to get rid of such surprises is to use signed types
+       for numerical integer values, and use unsigned types only for
+       bit masks and enums.
+
+   Why not use 'size_t' directly?
+
+     * Because 'size_t' is an unsigned type, and a signed type is better.
+       See above.
+
+   Why not use 'ssize_t'?
+
+     * 'ptrdiff_t' is more portable; it is standardized by ISO C
+       whereas 'ssize_t' is standardized only by POSIX.
+
+     * 'ssize_t' is not required to be as wide as 'size_t', and some
+       now-obsolete POSIX platforms had 'size_t' wider than 'ssize_t'.
+
+     * Conversely, some now-obsolete platforms had 'ptrdiff_t' wider
+       than 'size_t', which can be a win and conforms to POSIX.
+
+   Won't this cause a problem with objects larger than PTRDIFF_MAX?
+
+     * Typical modern or large platforms do not allocate such objects,
+       so this is not much of a problem in practice; for example, you
+       can safely write 'idx_t len = strlen (s);'.  To port to older
+       small platforms where allocations larger than PTRDIFF_MAX could
+       in theory be a problem, you can use Gnulib's ialloc module, or
+       functions like ximalloc in Gnulib's xalloc module.
+
+   Why not use 'ptrdiff_t' directly?
+
+     * Maintainability: When reading and modifying code, it helps to know that
+       a certain variable cannot have negative values.  For example, when you
+       have a loop
+
+         int n = ...;
+         for (int i = 0; i < n; i++) ...
+
+       or
+
+         ptrdiff_t n = ...;
+         for (ptrdiff_t i = 0; i < n; i++) ...
+
+       you have to ask yourself "what if n < 0?".  Whereas in
+
+         idx_t n = ...;
+         for (idx_t i = 0; i < n; i++) ...
+
+       you know that this case cannot happen.
+
+       Similarly, when a programmer writes
+
+         idx_t = ptr2 - ptr1;
+
+       there is an implied assertion that ptr1 and ptr2 point into the same
+       object and that ptr1 <= ptr2.
+
+     * Being future-proof: In the future, range types (integers which are
+       constrained to a certain range of values) may be added to C compilers
+       or to the C standard.  Several programming languages (Ada, Haskell,
+       Common Lisp, Pascal) already have range types.  Such range types may
+       help producing good code and good warnings.  The type 'idx_t' could
+       then be typedef'ed to a range type that is signed after promotion.  */
+
+/* In the future, idx_t could be typedef'ed to a signed range type.
+   The clang "extended integer types", supported in Clang 11 or newer
+   <https://clang.llvm.org/docs/LanguageExtensions.html#extended-integer-types>,
+   are a special case of range types.  However, these types don't support binary
+   operators with plain integer types (e.g. expressions such as x > 1).
+   Therefore, they don't behave like signed types (and not like unsigned types
+   either).  So, we cannot use them here.  */
+
+/* Use the signed type 'ptrdiff_t'.  */
+/* Note: ISO C does not mandate that 'size_t' and 'ptrdiff_t' have the same
+   size, but it is so on all platforms we have seen since 1990.  */
+typedef ptrdiff_t idx_t;
+
+/* IDX_MAX is the maximum value of an idx_t.  */
+#define IDX_MAX PTRDIFF_MAX
+
+/* So far no need has been found for an IDX_WIDTH macro.
+   Perhaps there should be another macro IDX_VALUE_BITS that does not
+   count the sign bit and is therefore one less than PTRDIFF_WIDTH.  */
+
+#endif /* _IDX_H */
deleted file mode 120000 (symlink)
index 8a7a9c3c6961a85ba449fa15fee4c593d2ae624d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ignore-value.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..de4a240cef4903ea2c0c70e43f281920c67c016d
--- /dev/null
@@ -0,0 +1,51 @@
+/* ignore a function return without a compiler warning.  -*- coding: utf-8 -*-
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering, Eric Blake and Pádraig Brady.  */
+
+/* Use "ignore_value" to avoid a warning when using a function declared with
+   gcc's warn_unused_result attribute, but for which you really do want to
+   ignore the result.  Traditionally, people have used a "(void)" cast to
+   indicate that a function's return value is deliberately unused.  However,
+   if the function is declared with __attribute__((warn_unused_result)),
+   gcc issues a warning even with the cast.
+
+   Caution: most of the time, you really should heed gcc's warning, and
+   check the return value.  However, in those exceptional cases in which
+   you're sure you know what you're doing, use this function.
+
+   For the record, here's one of the ignorable warnings:
+   "copy.c:233: warning: ignoring return value of 'fchown',
+   declared with attribute warn_unused_result".  */
+
+#ifndef _GL_IGNORE_VALUE_H
+#define _GL_IGNORE_VALUE_H
+
+/* Normally casting an expression to void discards its value, but GCC
+   versions 3.4 and newer have __attribute__ ((__warn_unused_result__))
+   which may cause unwanted diagnostics in that case.  Use __typeof__
+   and __extension__ to work around the problem, if the workaround is
+   known to be needed.
+   The workaround is not needed with clang.  */
+#if (3 < __GNUC__ + (4 <= __GNUC_MINOR__)) && !defined __clang__
+# define ignore_value(x) \
+    (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; }))
+#else
+# define ignore_value(x) ((void) (x))
+#endif
+
+#endif
deleted file mode 120000 (symlink)
index 08a65af458a9007447ab25d20811464bac2c2ce5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/imaxtostr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..98f6fafa9fa8679f074706478e25c827167b2eae
--- /dev/null
@@ -0,0 +1,20 @@
+/* Convert 'intmax_t' integer to printable string.
+
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define anytostr imaxtostr
+#define inttype intmax_t
+#include "anytostr.c"
deleted file mode 120000 (symlink)
index 8187bab9d53f94737a1d3c66b6f0ebdf78d351f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/inet_ntop.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0a4ba20e0dbdde4858c4b03fdeeae4e6b3515629
--- /dev/null
@@ -0,0 +1,260 @@
+/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
+
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/*
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <config.h>
+
+/* Specification.  */
+#include <arpa/inet.h>
+
+/* Use this to suppress gcc's "...may be used before initialized" warnings.
+   Beware: The Code argument must not contain commas.  */
+#ifndef IF_LINT
+# if defined GCC_LINT || defined lint
+#  define IF_LINT(Code) Code
+# else
+#  define IF_LINT(Code) /* empty */
+# endif
+#endif
+
+#if HAVE_DECL_INET_NTOP
+
+# undef inet_ntop
+
+const char *
+rpl_inet_ntop (int af, const void *restrict src,
+               char *restrict dst, socklen_t cnt)
+{
+  return inet_ntop (af, src, dst, cnt);
+}
+
+#else
+
+# include <stdio.h>
+# include <string.h>
+# include <errno.h>
+
+# define NS_IN6ADDRSZ 16
+# define NS_INT16SZ 2
+
+/*
+ * WARNING: Don't even consider trying to compile this on a system where
+ * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
+ */
+typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1];
+
+static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
+# if HAVE_IPV6
+static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size);
+# endif
+
+
+/* char *
+ * inet_ntop(af, src, dst, size)
+ *      convert a network format address to presentation format.
+ * return:
+ *      pointer to presentation format address ('dst'), or NULL (see errno).
+ * author:
+ *      Paul Vixie, 1996.
+ */
+const char *
+inet_ntop (int af, const void *restrict src,
+           char *restrict dst, socklen_t cnt)
+{
+  switch (af)
+    {
+# if HAVE_IPV4
+    case AF_INET:
+      return (inet_ntop4 (src, dst, cnt));
+# endif
+
+# if HAVE_IPV6
+    case AF_INET6:
+      return (inet_ntop6 (src, dst, cnt));
+# endif
+
+    default:
+      errno = EAFNOSUPPORT;
+      return (NULL);
+    }
+  /* NOTREACHED */
+}
+
+/* const char *
+ * inet_ntop4(src, dst, size)
+ *      format an IPv4 address
+ * return:
+ *      'dst' (as a const)
+ * notes:
+ *      (1) uses no statics
+ *      (2) takes a u_char* not an in_addr as input
+ * author:
+ *      Paul Vixie, 1996.
+ */
+static const char *
+inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
+{
+  char tmp[sizeof "255.255.255.255"];
+  int len;
+
+  len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
+  if (len < 0)
+    return NULL;
+
+  if (len > size)
+    {
+      errno = ENOSPC;
+      return NULL;
+    }
+
+  return strcpy (dst, tmp);
+}
+
+# if HAVE_IPV6
+
+/* const char *
+ * inet_ntop6(src, dst, size)
+ *      convert IPv6 binary address into presentation (printable) format
+ * author:
+ *      Paul Vixie, 1996.
+ */
+static const char *
+inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
+{
+  /*
+   * Note that int32_t and int16_t need only be "at least" large enough
+   * to contain a value of the specified size.  On some systems, like
+   * Crays, there is no such thing as an integer variable with 16 bits.
+   * Keep this in mind if you think this function should have been coded
+   * to use pointer overlays.  All the world's not a VAX.
+   */
+  char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
+  struct
+  {
+    int base, len;
+  } best, cur;
+  unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
+  int i;
+
+  /*
+   * Preprocess:
+   *      Copy the input (bytewise) array into a wordwise array.
+   *      Find the longest run of 0x00's in src[] for :: shorthanding.
+   */
+  memset (words, '\0', sizeof words);
+  for (i = 0; i < NS_IN6ADDRSZ; i += 2)
+    words[i / 2] = (src[i] << 8) | src[i + 1];
+  best.base = -1;
+  cur.base = -1;
+  IF_LINT(best.len = 0);
+  IF_LINT(cur.len = 0);
+  for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
+    {
+      if (words[i] == 0)
+        {
+          if (cur.base == -1)
+            cur.base = i, cur.len = 1;
+          else
+            cur.len++;
+        }
+      else
+        {
+          if (cur.base != -1)
+            {
+              if (best.base == -1 || cur.len > best.len)
+                best = cur;
+              cur.base = -1;
+            }
+        }
+    }
+  if (cur.base != -1)
+    {
+      if (best.base == -1 || cur.len > best.len)
+        best = cur;
+    }
+  if (best.base != -1 && best.len < 2)
+    best.base = -1;
+
+  /*
+   * Format the result.
+   */
+  tp = tmp;
+  for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
+    {
+      /* Are we inside the best run of 0x00's? */
+      if (best.base != -1 && i >= best.base && i < (best.base + best.len))
+        {
+          if (i == best.base)
+            *tp++ = ':';
+          continue;
+        }
+      /* Are we following an initial run of 0x00s or any real hex? */
+      if (i != 0)
+        *tp++ = ':';
+      /* Is this address an encapsulated IPv4? */
+      if (i == 6 && best.base == 0 &&
+          (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
+        {
+          if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
+            return (NULL);
+          tp += strlen (tp);
+          break;
+        }
+      {
+        int len = sprintf (tp, "%x", words[i]);
+        if (len < 0)
+          return NULL;
+        tp += len;
+      }
+    }
+  /* Was it a trailing run of 0x00's? */
+  if (best.base != -1 && (best.base + best.len) ==
+      (NS_IN6ADDRSZ / NS_INT16SZ))
+    *tp++ = ':';
+  *tp++ = '\0';
+
+  /*
+   * Check for overflow, copy, and we're done.
+   */
+  if ((socklen_t) (tp - tmp) > size)
+    {
+      errno = ENOSPC;
+      return NULL;
+    }
+
+  return strcpy (dst, tmp);
+}
+
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index 2f235873184905762a3f64b8327a99b2a57a19ac..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ino-map.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7b1dd0a5a0ca4413c9e5eac69defcc5da3993dc0
--- /dev/null
@@ -0,0 +1,163 @@
+/* Map an ino_t inode number to a small integer.
+
+   Copyright 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert and Jim Meyering */
+
+#include <config.h>
+#include "ino-map.h"
+
+#include "hash.h"
+
+#include <limits.h>
+#include <stdlib.h>
+
+/* A pair that maps an inode number to a mapped inode number; the
+   latter is a small unique ID for the former.  */
+struct ino_map_ent
+{
+  ino_t ino;
+  size_t mapped_ino;
+};
+
+/* A table that manages and indexes these pairs.  */
+struct ino_map
+{
+  /* A table of KEY,VAL pairs, where KEY is the raw ino_t value and
+     VAL is the small number that it maps to.  */
+  struct hash_table *map;
+
+  /* The next mapped inode number to hand out.  */
+  size_t next_mapped_ino;
+
+  /* Cache of the most recently allocated and otherwise-unused storage
+     for probing the table.  */
+  struct ino_map_ent *probe;
+};
+
+/* Hash an inode map entry.  */
+static size_t
+ino_hash (void const *x, size_t table_size)
+{
+  struct ino_map_ent const *p = x;
+  ino_t ino = p->ino;
+
+  /* When INO is wider than size_t, exclusive-OR the words of INO into H.
+     This avoids loss of info, without applying % to the wider type,
+     which could be quite slow on some systems.  */
+  size_t h = ino;
+  unsigned int i;
+  unsigned int n_words = sizeof ino / sizeof h + (sizeof ino % sizeof h != 0);
+  for (i = 1; i < n_words; i++)
+    h ^= ino >> CHAR_BIT * sizeof h * i;
+
+  return h % table_size;
+}
+
+/* Return true if two inode map entries are the same.  */
+static bool
+ino_compare (void const *x, void const *y)
+{
+  struct ino_map_ent const *a = x;
+  struct ino_map_ent const *b = y;
+  return a->ino == b->ino;
+}
+
+/* Allocate an inode map that will hand out integers starting with
+   NEXT_MAPPED_INO.  Return NULL if memory is exhausted.  */
+struct ino_map *
+ino_map_alloc (size_t next_mapped_ino)
+{
+  struct ino_map *im = malloc (sizeof *im);
+
+  if (im)
+    {
+      enum { INITIAL_INO_MAP_TABLE_SIZE = 1021 };
+      im->map = hash_initialize (INITIAL_INO_MAP_TABLE_SIZE, NULL,
+                                 ino_hash, ino_compare, free);
+      if (! im->map)
+        {
+          free (im);
+          return NULL;
+        }
+      im->next_mapped_ino = next_mapped_ino;
+      im->probe = NULL;
+    }
+
+  return im;
+}
+
+/* Free an inode map.  */
+void
+ino_map_free (struct ino_map *map)
+{
+  hash_free (map->map);
+  free (map->probe);
+  free (map);
+}
+
+
+/* Insert into MAP the inode number INO if it's not there already,
+   and return its nonnegative mapped inode number.
+   If INO is already in MAP, return the existing mapped inode number.
+   Return INO_MAP_INSERT_FAILURE on memory or counter exhaustion.  */
+size_t
+ino_map_insert (struct ino_map *im, ino_t ino)
+{
+  struct ino_map_ent *ent;
+
+  /* Find space for the probe, reusing the cache if available.  */
+  struct ino_map_ent *probe = im->probe;
+  if (probe)
+    {
+      /* If repeating a recent query, return the cached result.   */
+      if (probe->ino == ino)
+        return probe->mapped_ino;
+    }
+  else
+    {
+      im->probe = probe = malloc (sizeof *probe);
+      if (! probe)
+        return INO_MAP_INSERT_FAILURE;
+    }
+
+  probe->ino = ino;
+  ent = hash_insert (im->map, probe);
+  if (! ent)
+    return INO_MAP_INSERT_FAILURE;
+
+  if (ent != probe)
+    {
+      /* Use the existing entry.  */
+      probe->mapped_ino = ent->mapped_ino;
+    }
+  else
+    {
+      /* If adding 1 to map->next_mapped_ino would cause it to
+         overflow to zero, then it must equal INO_MAP_INSERT_FAILURE,
+         which is the value that should be returned in that case.
+         Verify that this works.  */
+      static_assert (INO_MAP_INSERT_FAILURE + 1 == 0);
+
+      /* Prepare to allocate a new probe next time; this one is in use.  */
+      im->probe = NULL;
+
+      /* INO is new; allocate a mapped inode number for it.  */
+      probe->mapped_ino = im->next_mapped_ino++;
+    }
+
+  return probe->mapped_ino;
+}
deleted file mode 120000 (symlink)
index 1412bf1a5018a4c4fdb30f2ff9781ebecf369174..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ino-map.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4aa33754e492a1d1585c99c97295c10fee8908dc
--- /dev/null
@@ -0,0 +1,41 @@
+/* Maintain a mapping of ino_t numbers to small integers.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, 2010.  */
+
+#ifndef _GL_INO_MAP_H
+# define _GL_INO_MAP_H
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
+   _GL_ATTRIBUTE_NONNULL.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <sys/types.h>
+
+# define INO_MAP_INSERT_FAILURE ((size_t) -1)
+
+struct ino_map;
+
+void ino_map_free (struct ino_map *) _GL_ATTRIBUTE_NONNULL ((1));
+
+struct ino_map *ino_map_alloc (size_t)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (ino_map_free, 1);
+
+size_t ino_map_insert (struct ino_map *, ino_t) _GL_ATTRIBUTE_NONNULL ((1));
+
+#endif
deleted file mode 120000 (symlink)
index 203b29303ac8563fec9f8834ce9fff40cfeb7073..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/intprops-internal.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c8a87d2bb27bc0643b0315c9aa0b907a41987776
--- /dev/null
@@ -0,0 +1,397 @@
+/* intprops-internal.h -- properties of integer types not visible to users
+
+   Copyright (C) 2001-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_INTPROPS_INTERNAL_H
+#define _GL_INTPROPS_INTERNAL_H
+
+#include <limits.h>
+
+/* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED.  */
+#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
+/* Return a value with the common real type of E and V and the value of V.
+   Do not evaluate E.  */
+#define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v))
+
+/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
+   <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>.  */
+#define _GL_INT_NEGATE_CONVERT(e, v) ((1 ? 0 : (e)) - (v))
+
+/* The extra casts in the following macros work around compiler bugs,
+   e.g., in Cray C 5.0.3.0.  */
+
+/* True if the real type T is signed.  */
+#define _GL_TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+
+/* Return 1 if the real expression E, after promotion, has a
+   signed or floating type.  Do not evaluate E.  */
+#define _GL_EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
+
+
+/* Minimum and maximum values for integer types and expressions.  */
+
+/* The width in bits of the integer type or expression T.
+   Do not evaluate T.  T must not be a bit-field expression.
+   Padding bits are not supported; this is checked at compile-time below.  */
+#define _GL_TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
+
+/* The maximum and minimum values for the type of the expression E,
+   after integer promotion.  E is not evaluated.  */
+#define _GL_INT_MINIMUM(e)                                              \
+  (_GL_EXPR_SIGNED (e)                                                  \
+   ? ~ _GL_SIGNED_INT_MAXIMUM (e)                                       \
+   : _GL_INT_CONVERT (e, 0))
+#define _GL_INT_MAXIMUM(e)                                              \
+  (_GL_EXPR_SIGNED (e)                                                  \
+   ? _GL_SIGNED_INT_MAXIMUM (e)                                         \
+   : _GL_INT_NEGATE_CONVERT (e, 1))
+#define _GL_SIGNED_INT_MAXIMUM(e)                                       \
+  (((_GL_INT_CONVERT (e, 1) << (_GL_TYPE_WIDTH (+ (e)) - 2)) - 1) * 2 + 1)
+
+/* Work around OpenVMS incompatibility with C99.  */
+#if !defined LLONG_MAX && defined __INT64_MAX
+# define LLONG_MAX __INT64_MAX
+# define LLONG_MIN __INT64_MIN
+#endif
+
+/* This include file assumes that signed types are two's complement without
+   padding bits; the above macros have undefined behavior otherwise.
+   If this is a problem for you, please let us know how to fix it for your host.
+   This assumption is tested by the intprops-tests module.  */
+
+/* Does the __typeof__ keyword work?  This could be done by
+   'configure', but for now it's easier to do it by hand.  */
+#if (2 <= __GNUC__ \
+     || (4 <= __clang_major__) \
+     || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \
+     || (0x5110 <= __SUNPRO_C && !__STDC__))
+# define _GL_HAVE___TYPEOF__ 1
+#else
+# define _GL_HAVE___TYPEOF__ 0
+#endif
+
+/* Return 1 if the integer type or expression T might be signed.  Return 0
+   if it is definitely unsigned.  T must not be a bit-field expression.
+   This macro does not evaluate its argument, and expands to an
+   integer constant expression.  */
+#if _GL_HAVE___TYPEOF__
+# define _GL_SIGNED_TYPE_OR_EXPR(t) _GL_TYPE_SIGNED (__typeof__ (t))
+#else
+# define _GL_SIGNED_TYPE_OR_EXPR(t) 1
+#endif
+
+/* Return 1 if - A would overflow in [MIN,MAX] arithmetic.
+   A should not have side effects, and A's type should be an
+   integer with minimum value MIN and maximum MAX.  */
+#define _GL_INT_NEGATE_RANGE_OVERFLOW(a, min, max) \
+  ((min) < 0 ? (a) < - (max) : 0 < (a))
+
+/* True if __builtin_add_overflow (A, B, P) and __builtin_sub_overflow
+   (A, B, P) work when P is non-null.  */
+#ifdef __EDG__
+/* EDG-based compilers like nvc 22.1 cannot add 64-bit signed to unsigned
+   <https://bugs.gnu.org/53256>.  */
+# define _GL_HAS_BUILTIN_ADD_OVERFLOW 0
+#elif defined __has_builtin
+# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
+/* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x,
+   see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>.  */
+#elif 7 <= __GNUC__
+# define _GL_HAS_BUILTIN_ADD_OVERFLOW 1
+#else
+# define _GL_HAS_BUILTIN_ADD_OVERFLOW 0
+#endif
+
+/* True if __builtin_mul_overflow (A, B, P) works when P is non-null.  */
+#if defined __clang_major__ && __clang_major__ < 14
+/* Work around Clang bug <https://bugs.llvm.org/show_bug.cgi?id=16404>.  */
+# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0
+#else
+# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW
+#endif
+
+/* True if __builtin_add_overflow_p (A, B, C) works, and similarly for
+   __builtin_sub_overflow_p and __builtin_mul_overflow_p.  */
+#ifdef __EDG__
+/* In EDG-based compilers like ICC 2021.3 and earlier,
+   __builtin_add_overflow_p etc. are not treated as integral constant
+   expressions even when all arguments are.  */
+# define _GL_HAS_BUILTIN_OVERFLOW_P 0
+#elif defined __has_builtin
+# define _GL_HAS_BUILTIN_OVERFLOW_P __has_builtin (__builtin_mul_overflow_p)
+#else
+# define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__)
+#endif
+
+#if (!defined _GL_STDCKDINT_H && 202311 <= __STDC_VERSION__ \
+     && ! (_GL_HAS_BUILTIN_ADD_OVERFLOW && _GL_HAS_BUILTIN_MUL_OVERFLOW))
+# include <stdckdint.h>
+#endif
+
+/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R.
+   Return 1 if the result overflows.  Arguments should not have side
+   effects and A, B and *R can be of any integer type other than char,
+   bool, a bit-precise integer type, or an enumeration type.  */
+#if _GL_HAS_BUILTIN_ADD_OVERFLOW
+# define _GL_INT_ADD_WRAPV(a, b, r) __builtin_add_overflow (a, b, r)
+# define _GL_INT_SUBTRACT_WRAPV(a, b, r) __builtin_sub_overflow (a, b, r)
+#elif defined ckd_add && defined ckd_sub && !defined _GL_STDCKDINT_H
+# define _GL_INT_ADD_WRAPV(a, b, r) ckd_add (r, + (a), + (b))
+# define _GL_INT_SUBTRACT_WRAPV(a, b, r) ckd_sub (r, + (a), + (b))
+#else
+# define _GL_INT_ADD_WRAPV(a, b, r) \
+   _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW)
+# define _GL_INT_SUBTRACT_WRAPV(a, b, r) \
+   _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
+#endif
+#if _GL_HAS_BUILTIN_MUL_OVERFLOW
+# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
+       || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \
+      && !defined __EDG__)
+#  define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
+# else
+   /* Work around GCC bug 91450.  */
+#  define _GL_INT_MULTIPLY_WRAPV(a, b, r) \
+    ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && _GL_EXPR_SIGNED (a) && _GL_EXPR_SIGNED (b) \
+      && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \
+     ? ((void) __builtin_mul_overflow (a, b, r), 1) \
+     : __builtin_mul_overflow (a, b, r))
+# endif
+#elif defined ckd_mul && !defined _GL_STDCKDINT_H
+# define _GL_INT_MULTIPLY_WRAPV(a, b, r) ckd_mul (r, + (a), + (b))
+#else
+# define _GL_INT_MULTIPLY_WRAPV(a, b, r) \
+   _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
+#endif
+
+/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390.  See:
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193
+   https://llvm.org/bugs/show_bug.cgi?id=25390
+   For now, assume all versions of GCC-like compilers generate bogus
+   warnings for _Generic.  This matters only for compilers that
+   lack relevant builtins.  */
+#if __GNUC__ || defined __clang__
+# define _GL__GENERIC_BOGUS 1
+#else
+# define _GL__GENERIC_BOGUS 0
+#endif
+
+/* Store the low-order bits of A <op> B into *R, where OP specifies
+   the operation and OVERFLOW the overflow predicate.  Return 1 if the
+   result overflows.  Arguments should not have side effects,
+   and A, B and *R can be of any integer type other than char, bool, a
+   bit-precise integer type, or an enumeration type.  */
+#if 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS
+# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \
+   (_Generic \
+    (*(r), \
+     signed char: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                        signed char, SCHAR_MIN, SCHAR_MAX), \
+     unsigned char: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                        unsigned char, 0, UCHAR_MAX), \
+     short int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                        short int, SHRT_MIN, SHRT_MAX), \
+     unsigned short int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                        unsigned short int, 0, USHRT_MAX), \
+     int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                        int, INT_MIN, INT_MAX), \
+     unsigned int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                        unsigned int, 0, UINT_MAX), \
+     long int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+                        long int, LONG_MIN, LONG_MAX), \
+     unsigned long int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+                        unsigned long int, 0, ULONG_MAX), \
+     long long int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
+                        long long int, LLONG_MIN, LLONG_MAX), \
+     unsigned long long int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
+                        unsigned long long int, 0, ULLONG_MAX)))
+#else
+/* Store the low-order bits of A <op> B into *R, where OP specifies
+   the operation and OVERFLOW the overflow predicate.  If *R is
+   signed, its type is ST with bounds SMIN..SMAX; otherwise its type
+   is UT with bounds U..UMAX.  ST and UT are narrower than int.
+   Return 1 if the result overflows.  Arguments should not have side
+   effects, and A, B and *R can be of any integer type other than
+   char, bool, a bit-precise integer type, or an enumeration type.  */
+# if _GL_HAVE___TYPEOF__
+#  define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \
+    (_GL_TYPE_SIGNED (__typeof__ (*(r))) \
+     ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, st, smin, smax) \
+     : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, ut, 0, umax))
+# else
+#  define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \
+    (overflow (a, b, smin, smax) \
+     ? (overflow (a, b, 0, umax) \
+        ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 1) \
+        : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) < 0) \
+     : (overflow (a, b, 0, umax) \
+        ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) >= 0 \
+        : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 0)))
+# endif
+
+# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \
+   (sizeof *(r) == sizeof (signed char) \
+    ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \
+                                 signed char, SCHAR_MIN, SCHAR_MAX, \
+                                 unsigned char, UCHAR_MAX) \
+    : sizeof *(r) == sizeof (short int) \
+    ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \
+                                 short int, SHRT_MIN, SHRT_MAX, \
+                                 unsigned short int, USHRT_MAX) \
+    : sizeof *(r) == sizeof (int) \
+    ? (_GL_EXPR_SIGNED (*(r)) \
+       ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                          int, INT_MIN, INT_MAX) \
+       : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                          unsigned int, 0, UINT_MAX)) \
+    : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
+# ifdef LLONG_MAX
+#  define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
+    (sizeof *(r) == sizeof (long int) \
+     ? (_GL_EXPR_SIGNED (*(r)) \
+        ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+                           long int, LONG_MIN, LONG_MAX) \
+        : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+                           unsigned long int, 0, ULONG_MAX)) \
+     : (_GL_EXPR_SIGNED (*(r)) \
+        ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
+                           long long int, LLONG_MIN, LLONG_MAX) \
+        : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
+                           unsigned long long int, 0, ULLONG_MAX)))
+# else
+#  define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
+    (_GL_EXPR_SIGNED (*(r)) \
+     ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+                        long int, LONG_MIN, LONG_MAX) \
+     : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+                        unsigned long int, 0, ULONG_MAX))
+# endif
+#endif
+
+/* Store the low-order bits of A <op> B into *R, where the operation
+   is given by OP.  Use the unsigned type UT for calculation to avoid
+   overflow problems.  *R's type is T, with extrema TMIN and TMAX.
+   T can be any signed integer type other than char, bool, a
+   bit-precise integer type, or an enumeration type.
+   Return 1 if the result overflows.  */
+#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
+  (overflow (a, b, tmin, tmax) \
+   ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \
+   : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0))
+
+/* Return 1 if the integer expressions A - B and -A would overflow,
+   respectively.  Arguments should not have side effects,
+   and can be any signed integer type other than char, bool, a
+   bit-precise integer type, or an enumeration type.
+   These macros are tuned for their last input argument being a constant.  */
+
+#if _GL_HAS_BUILTIN_OVERFLOW_P
+# define _GL_INT_NEGATE_OVERFLOW(a) \
+   __builtin_sub_overflow_p (0, a, (__typeof__ (- (a))) 0)
+#else
+# define _GL_INT_NEGATE_OVERFLOW(a) \
+   _GL_INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+#endif
+
+/* Return the low-order bits of A <op> B, where the operation is given
+   by OP.  Use the unsigned type UT for calculation to avoid undefined
+   behavior on signed integer overflow, and convert the result to type T.
+   UT is at least as wide as T and is no narrower than unsigned int,
+   T is two's complement, and there is no padding or trap representations.
+   Assume that converting UT to T yields the low-order bits, as is
+   done in all known two's-complement C compilers.  E.g., see:
+   https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html
+
+   According to the C standard, converting UT to T yields an
+   implementation-defined result or signal for values outside T's
+   range.  However, code that works around this theoretical problem
+   runs afoul of a compiler bug in Oracle Studio 12.3 x86.  See:
+   https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html
+   As the compiler bug is real, don't try to work around the
+   theoretical problem.  */
+
+#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \
+  ((t) ((ut) (a) op (ut) (b)))
+
+/* Return true if the numeric values A + B, A - B, A * B fall outside
+   the range TMIN..TMAX.  Arguments should not have side effects
+   and can be any integer type other than char, bool,
+   a bit-precise integer type, or an enumeration type.
+   TMIN should be signed and nonpositive.
+   TMAX should be positive, and should be signed unless TMIN is zero.  */
+#define _GL_INT_ADD_RANGE_OVERFLOW(a, b, tmin, tmax) \
+  ((b) < 0 \
+   ? (((tmin) \
+       ? ((_GL_EXPR_SIGNED (_GL_INT_CONVERT (a, (tmin) - (b))) || (b) < (tmin)) \
+          && (a) < (tmin) - (b)) \
+       : (a) <= -1 - (b)) \
+      || ((_GL_EXPR_SIGNED (a) ? 0 <= (a) : (tmax) < (a)) && (tmax) < (a) + (b))) \
+   : (a) < 0 \
+   ? (((tmin) \
+       ? ((_GL_EXPR_SIGNED (_GL_INT_CONVERT (b, (tmin) - (a))) || (a) < (tmin)) \
+          && (b) < (tmin) - (a)) \
+       : (b) <= -1 - (a)) \
+      || ((_GL_EXPR_SIGNED (_GL_INT_CONVERT (a, b)) || (tmax) < (b)) \
+          && (tmax) < (a) + (b))) \
+   : (tmax) < (b) || (tmax) - (b) < (a))
+#define _GL_INT_SUBTRACT_RANGE_OVERFLOW(a, b, tmin, tmax) \
+  (((a) < 0) == ((b) < 0) \
+   ? ((a) < (b) \
+      ? !(tmin) || -1 - (tmin) < (b) - (a) - 1 \
+      : (tmax) < (a) - (b)) \
+   : (a) < 0 \
+   ? ((!_GL_EXPR_SIGNED (_GL_INT_CONVERT ((a) - (tmin), b)) && (a) - (tmin) < 0) \
+      || (a) - (tmin) < (b)) \
+   : ((! (_GL_EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \
+          && _GL_EXPR_SIGNED (_GL_INT_CONVERT ((tmax) + (b), a))) \
+       && (tmax) <= -1 - (b)) \
+      || (tmax) + (b) < (a)))
+#define _GL_INT_MULTIPLY_RANGE_OVERFLOW(a, b, tmin, tmax) \
+  ((b) < 0 \
+   ? ((a) < 0 \
+      ? (_GL_EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \
+         ? (a) < (tmax) / (b) \
+         : ((_GL_INT_NEGATE_OVERFLOW (b) \
+             ? _GL_INT_CONVERT (b, tmax) >> (_GL_TYPE_WIDTH (+ (b)) - 1) \
+             : (tmax) / -(b)) \
+            <= -1 - (a))) \
+      : _GL_INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (b, tmin)) && (b) == -1 \
+      ? (_GL_EXPR_SIGNED (a) \
+         ? 0 < (a) + (tmin) \
+         : 0 < (a) && -1 - (tmin) < (a) - 1) \
+      : (tmin) / (b) < (a)) \
+   : (b) == 0 \
+   ? 0 \
+   : ((a) < 0 \
+      ? (_GL_INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (a, tmin)) && (a) == -1 \
+         ? (_GL_EXPR_SIGNED (b) ? 0 < (b) + (tmin) : -1 - (tmin) < (b) - 1) \
+         : (tmin) / (a) < (b)) \
+      : (tmax) / (b) < (a)))
+
+#endif /* _GL_INTPROPS_INTERNAL_H */
deleted file mode 120000 (symlink)
index 1fc005233ab1272fd5d1d795c556daeae84515fe..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/intprops.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..43734f3440ad4064fd97c89eef149195c118b936
--- /dev/null
@@ -0,0 +1,335 @@
+/* intprops.h -- properties of integer types
+
+   Copyright (C) 2001-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_INTPROPS_H
+#define _GL_INTPROPS_H
+
+#include "intprops-internal.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 the real type T is signed.  */
+#define TYPE_SIGNED(t) _GL_TYPE_SIGNED (t)
+
+/* Return 1 if the real expression E, after promotion, has a
+   signed or floating type.  Do not evaluate E.  */
+#define EXPR_SIGNED(e) _GL_EXPR_SIGNED (e)
+
+
+/* Minimum and maximum values for integer types and expressions.  */
+
+/* The width in bits of the integer type or expression T.
+   Do not evaluate T.  T must not be a bit-field expression.
+   Padding bits are not supported; this is checked at compile-time below.  */
+#define TYPE_WIDTH(t) _GL_TYPE_WIDTH (t)
+
+/* The maximum and minimum values for the integer type T.  */
+#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
+#define TYPE_MAXIMUM(t)                                                 \
+  ((t) (! TYPE_SIGNED (t)                                               \
+        ? (t) -1                                                        \
+        : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
+
+/* Bound on length of the string representing an unsigned integer
+   value representable in B bits.  log10 (2.0) < 146/485.  The
+   smallest value of B where this bound is not tight is 2621.  */
+#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485)
+
+/* Bound on length of the string representing an integer type or expression T.
+   T must not be a bit-field expression.
+
+   Subtract 1 for the sign bit if T is signed, and then add 1 more for
+   a minus sign if needed.
+
+   Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 1 when its argument is
+   unsigned, this macro may overestimate the true bound by one byte when
+   applied to unsigned types of size 2, 4, 16, ... bytes.  */
+#define INT_STRLEN_BOUND(t)                                     \
+  (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \
+   + _GL_SIGNED_TYPE_OR_EXPR (t))
+
+/* Bound on buffer size needed to represent an integer type or expression T,
+   including the terminating null.  T must not be a bit-field expression.  */
+#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+
+
+/* Range overflow checks.
+
+   The INT_<op>_RANGE_OVERFLOW macros return 1 if the corresponding C
+   operators overflow arithmetically when given the same arguments.
+   These macros do not rely on undefined or implementation-defined behavior.
+   Although their implementations are simple and straightforward,
+   they are harder to use and may be less efficient than the
+   INT_<op>_WRAPV, INT_<op>_OK, and INT_<op>_OVERFLOW macros described below.
+
+   Example usage:
+
+     long int i = ...;
+     long int j = ...;
+     if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX))
+       printf ("multiply would overflow");
+     else
+       printf ("product is %ld", i * j);
+
+   Restrictions on *_RANGE_OVERFLOW macros:
+
+   These macros do not check for all possible numerical problems or
+   undefined or unspecified behavior: they do not check for division
+   by zero, for bad shift counts, or for shifting negative numbers.
+
+   These macros may evaluate their arguments zero or multiple times,
+   so the arguments should not have side effects.  The arithmetic
+   arguments (including the MIN and MAX arguments) must be of the same
+   integer type after the usual arithmetic conversions, and the type
+   must have minimum value MIN and maximum MAX.  Unsigned types should
+   use a zero MIN of the proper type.
+
+   Because all arguments are subject to integer promotions, these
+   macros typically do not work on types narrower than 'int'.
+
+   These macros are tuned for constant MIN and MAX.  For commutative
+   operations such as A + B, they are also tuned for constant B.  */
+
+/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  */
+#define INT_ADD_RANGE_OVERFLOW(a, b, min, max)          \
+  ((b) < 0                                              \
+   ? (a) < (min) - (b)                                  \
+   : (max) - (b) < (a))
+
+/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  */
+#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max)     \
+  ((b) < 0                                              \
+   ? (max) + (b) < (a)                                  \
+   : (a) < (min) + (b))
+
+/* Return 1 if - A would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  */
+#define INT_NEGATE_RANGE_OVERFLOW(a, min, max)          \
+  _GL_INT_NEGATE_RANGE_OVERFLOW (a, min, max)
+
+/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  Avoid && and || as they tickle
+   bugs in Sun C 5.11 2010/08/13 and other compilers; see
+   <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>.  */
+#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max)     \
+  ((b) < 0                                              \
+   ? ((a) < 0                                           \
+      ? (a) < (max) / (b)                               \
+      : (b) == -1                                       \
+      ? 0                                               \
+      : (min) / (b) < (a))                              \
+   : (b) == 0                                           \
+   ? 0                                                  \
+   : ((a) < 0                                           \
+      ? (a) < (min) / (b)                               \
+      : (max) / (b) < (a)))
+
+/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  Do not check for division by zero.  */
+#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max)       \
+  ((min) < 0 && (b) == -1 && (a) < - (max))
+
+/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  Do not check for division by zero.
+   Mathematically, % should never overflow, but on x86-like hosts
+   INT_MIN % -1 traps, and the C standard permits this, so treat this
+   as an overflow too.  */
+#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max)    \
+  INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max)
+
+/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  Here, MIN and MAX are for A only, and B need
+   not be of the same type as the other arguments.  The C standard says that
+   behavior is undefined for shifts unless 0 <= B < wordwidth, and that when
+   A is negative then A << B has undefined behavior and A >> B has
+   implementation-defined behavior, but do not check these other
+   restrictions.  */
+#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max)   \
+  ((a) < 0                                              \
+   ? (a) < (min) >> (b)                                 \
+   : (max) >> (b) < (a))
+
+/* The _GL*_OVERFLOW macros have the same restrictions as the
+   *_RANGE_OVERFLOW macros, except that they do not assume that operands
+   (e.g., A and B) have the same type as MIN and MAX.  Instead, they assume
+   that the result (e.g., A + B) has that type.  */
+#if _GL_HAS_BUILTIN_OVERFLOW_P
+# define _GL_ADD_OVERFLOW(a, b, min, max)                               \
+   __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max)                          \
+   __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max)                          \
+   __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0)
+#else
+# define _GL_ADD_OVERFLOW(a, b, min, max)                                \
+   ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max)                  \
+    : (a) < 0 ? (b) <= (a) + (b)                                         \
+    : (b) < 0 ? (a) <= (a) + (b)                                         \
+    : (a) + (b) < (b))
+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max)                           \
+   ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max)             \
+    : (a) < 0 ? 1                                                        \
+    : (b) < 0 ? (a) - (b) <= (a)                                         \
+    : (a) < (b))
+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max)                           \
+   (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a))))       \
+    || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
+#endif
+#define _GL_DIVIDE_OVERFLOW(a, b, min, max)                             \
+  ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max)  \
+   : (a) < 0 ? (b) <= (a) + (b) - 1                                     \
+   : (b) < 0 && (a) + (b) <= (a))
+#define _GL_REMAINDER_OVERFLOW(a, b, min, max)                          \
+  ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max)  \
+   : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b)                     \
+   : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max))
+
+/* Return a nonzero value if A is a mathematical multiple of B, where
+   A is unsigned, B is negative, and MAX is the maximum value of A's
+   type.  A's type must be the same as (A % B)'s type.  Normally (A %
+   -B == 0) suffices, but things get tricky if -B would overflow.  */
+#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max)                            \
+  (((b) < -_GL_SIGNED_INT_MAXIMUM (b)                                   \
+    ? (_GL_SIGNED_INT_MAXIMUM (b) == (max)                              \
+       ? (a)                                                            \
+       : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1))   \
+    : (a) % - (b))                                                      \
+   == 0)
+
+/* Check for integer overflow, and report low order bits of answer.
+
+   The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators
+   might not yield numerically correct answers due to arithmetic overflow.
+   The INT_<op>_WRAPV macros compute the low-order bits of the sum,
+   difference, and product of two C integers, and return 1 if these
+   low-order bits are not numerically correct.
+   These macros work correctly on all known practical hosts, and do not rely
+   on undefined behavior due to signed arithmetic overflow.
+
+   Example usage, assuming A and B are long int:
+
+     if (INT_MULTIPLY_OVERFLOW (a, b))
+       printf ("result would overflow\n");
+     else
+       printf ("result is %ld (no overflow)\n", a * b);
+
+   Example usage with WRAPV flavor:
+
+     long int result;
+     bool overflow = INT_MULTIPLY_WRAPV (a, b, &result);
+     printf ("result is %ld (%s)\n", result,
+             overflow ? "after overflow" : "no overflow");
+
+   Restrictions on these macros:
+
+   These macros do not check for all possible numerical problems or
+   undefined or unspecified behavior: they do not check for division
+   by zero, for bad shift counts, or for shifting negative numbers.
+
+   These macros may evaluate their arguments zero or multiple times, so the
+   arguments should not have side effects.
+
+   The WRAPV macros are not constant expressions.  They support only
+   +, binary -, and *.
+
+   Because the WRAPV macros convert the result, they report overflow
+   in different circumstances than the OVERFLOW macros do.  For
+   example, in the typical case with 16-bit 'short' and 32-bit 'int',
+   if A, B and *R are all of type 'short' then INT_ADD_OVERFLOW (A, B)
+   returns false because the addition cannot overflow after A and B
+   are converted to 'int', whereas INT_ADD_WRAPV (A, B, R) returns
+   true or false depending on whether the sum fits into 'short'.
+
+   These macros are tuned for their last input argument being a constant.
+
+   A, B, and *R should be integers; they need not be the same type,
+   and they need not be all signed or all unsigned.
+   However, none of the integer types should be bit-precise,
+   and *R's type should not be char, bool, or an enumeration type.
+
+   Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
+   A % B, and A << B would overflow, respectively.  */
+
+#define INT_ADD_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
+#define INT_SUBTRACT_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
+#define INT_NEGATE_OVERFLOW(a) _GL_INT_NEGATE_OVERFLOW (a)
+#define INT_MULTIPLY_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
+#define INT_DIVIDE_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW)
+#define INT_REMAINDER_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW)
+#define INT_LEFT_SHIFT_OVERFLOW(a, b) \
+  INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \
+                                 _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+
+/* Return 1 if the expression A <op> B would overflow,
+   where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test,
+   assuming MIN and MAX are the minimum and maximum for the result type.
+   Arguments should be free of side effects.  */
+#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow)        \
+  op_result_overflow (a, b,                                     \
+                      _GL_INT_MINIMUM (_GL_INT_CONVERT (a, b)), \
+                      _GL_INT_MAXIMUM (_GL_INT_CONVERT (a, b)))
+
+/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R.
+   Return 1 if the result overflows.  See above for restrictions.  */
+#define INT_ADD_WRAPV(a, b, r) _GL_INT_ADD_WRAPV (a, b, r)
+#define INT_SUBTRACT_WRAPV(a, b, r) _GL_INT_SUBTRACT_WRAPV (a, b, r)
+#define INT_MULTIPLY_WRAPV(a, b, r) _GL_INT_MULTIPLY_WRAPV (a, b, r)
+
+/* The following macros compute A + B, A - B, and A * B, respectively.
+   If no overflow occurs, they set *R to the result and return 1;
+   otherwise, they return 0 and may modify *R.
+
+   Example usage:
+
+     long int result;
+     if (INT_ADD_OK (a, b, &result))
+       printf ("result is %ld\n", result);
+     else
+       printf ("overflow\n");
+
+   A, B, and *R should be integers; they need not be the same type,
+   and they need not be all signed or all unsigned.
+   However, none of the integer types should be bit-precise,
+   and *R's type should not be char, bool, or an enumeration type.
+
+   These macros work correctly on all known practical hosts, and do not rely
+   on undefined behavior due to signed arithmetic overflow.
+
+   These macros are not constant expressions.
+
+   These macros may evaluate their arguments zero or multiple times, so the
+   arguments should not have side effects.
+
+   These macros are tuned for B being a constant.  */
+
+#define INT_ADD_OK(a, b, r) (! INT_ADD_WRAPV (a, b, r))
+#define INT_SUBTRACT_OK(a, b, r) (! INT_SUBTRACT_WRAPV (a, b, r))
+#define INT_MULTIPLY_OK(a, b, r) (! INT_MULTIPLY_WRAPV (a, b, r))
+
+#endif /* _GL_INTPROPS_H */
deleted file mode 120000 (symlink)
index bb67c6e94682a6a56e092a8dfb34c3b61f9a230c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/inttostr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3f31d6209455352ff34ffd878fd0e9a35082e289
--- /dev/null
@@ -0,0 +1,20 @@
+/* Convert 'int' integer to printable string.
+
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define anytostr inttostr
+#define inttype int
+#include "anytostr.c"
deleted file mode 120000 (symlink)
index c28e892569d868a5a82f33ef0ad55e0fdd34e4c5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/inttostr.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..51cadf42e85ea7b3e91b4de939d2b11507df1090
--- /dev/null
@@ -0,0 +1,34 @@
+/* inttostr.h -- convert integers to printable strings
+
+   Copyright (C) 2001-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert */
+
+/* This file uses _GL_ATTRIBUTE_NODISCARD.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include "intprops.h"
+
+_GL_ATTRIBUTE_NODISCARD char *imaxtostr (intmax_t, char *);
+_GL_ATTRIBUTE_NODISCARD char *inttostr (int, char *);
+_GL_ATTRIBUTE_NODISCARD char *offtostr (off_t, char *);
+_GL_ATTRIBUTE_NODISCARD char *uinttostr (unsigned int, char *);
+_GL_ATTRIBUTE_NODISCARD char *umaxtostr (uintmax_t, char *);
deleted file mode 120000 (symlink)
index 410cfb1e8c72c28f18415347642e60ad1e6b8fb1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/inttypes.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b9ab8a4b424e3921f517868f9fc95529dce04f88
--- /dev/null
+/* Copyright (C) 2006-2024 Free Software Foundation, Inc.
+   Written by Paul Eggert, Bruno Haible, Derek Price.
+   This file is part of gnulib.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/*
+ * ISO C 99 <inttypes.h> for platforms that lack it.
+ * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html>
+ */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* Include the original <inttypes.h> if it exists, and if this file
+   has not been included yet or if this file includes gnulib stdint.h
+   which in turn includes this file.
+   The include_next requires a split double-inclusion guard.  */
+#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+# if @HAVE_INTTYPES_H@
+
+   /* Some pre-C++11 <stdint.h> implementations need this.  */
+#  if defined __cplusplus && ! defined __STDC_FORMAT_MACROS
+#   define __STDC_FORMAT_MACROS 1
+#  endif
+
+#  @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
+
+#  define _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H
+# endif
+#endif
+
+#if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+#define INTTYPES_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Include <stdint.h> or the gnulib replacement.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stdint.h>
+#endif
+/* Get CHAR_BIT, INT_MAX, LONG_MAX, etc.  */
+#include <limits.h>
+/* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */
+#if defined _WIN32 && ! defined __CYGWIN__
+# include <stdio.h>
+#endif
+
+#if !(INT_MAX == 0x7fffffff && INT_MIN + INT_MAX == -1)
+# error "This file assumes that 'int' is 32-bit two's complement. Please report your platform and compiler to <bug-gnulib@gnu.org>."
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* 7.8.1 Macros for format specifiers */
+
+#if defined _TNS_R_TARGET
+   /* Tandem NonStop R series and compatible platforms released before
+      July 2005 support %Ld but not %lld.  */
+# define _LONG_LONG_FORMAT_PREFIX "L"
+#else
+# define _LONG_LONG_FORMAT_PREFIX "ll"
+#endif
+
+#if !defined PRId8
+# ifdef INT8_MAX
+#  define PRId8 "d"
+# endif
+#endif
+#if !defined PRIi8
+# ifdef INT8_MAX
+#  define PRIi8 "i"
+# endif
+#endif
+#if !defined PRIo8
+# ifdef UINT8_MAX
+#  define PRIo8 "o"
+# endif
+#endif
+#if !defined PRIu8
+# ifdef UINT8_MAX
+#  define PRIu8 "u"
+# endif
+#endif
+#if !defined PRIx8
+# ifdef UINT8_MAX
+#  define PRIx8 "x"
+# endif
+#endif
+#if !defined PRIX8
+# ifdef UINT8_MAX
+#  define PRIX8 "X"
+# endif
+#endif
+#if !defined PRId16
+# ifdef INT16_MAX
+#  define PRId16 "d"
+# endif
+#endif
+#if !defined PRIi16
+# ifdef INT16_MAX
+#  define PRIi16 "i"
+# endif
+#endif
+#if !defined PRIo16
+# ifdef UINT16_MAX
+#  define PRIo16 "o"
+# endif
+#endif
+#if !defined PRIu16
+# ifdef UINT16_MAX
+#  define PRIu16 "u"
+# endif
+#endif
+#if !defined PRIx16
+# ifdef UINT16_MAX
+#  define PRIx16 "x"
+# endif
+#endif
+#if !defined PRIX16
+# ifdef UINT16_MAX
+#  define PRIX16 "X"
+# endif
+#endif
+#if !defined PRId32
+# ifdef INT32_MAX
+#  define PRId32 "d"
+# endif
+#endif
+#if !defined PRIi32
+# ifdef INT32_MAX
+#  define PRIi32 "i"
+# endif
+#endif
+#if !defined PRIo32
+# ifdef UINT32_MAX
+#  define PRIo32 "o"
+# endif
+#endif
+#if !defined PRIu32
+# ifdef UINT32_MAX
+#  define PRIu32 "u"
+# endif
+#endif
+#if !defined PRIx32
+# ifdef UINT32_MAX
+#  define PRIx32 "x"
+# endif
+#endif
+#if !defined PRIX32
+# ifdef UINT32_MAX
+#  define PRIX32 "X"
+# endif
+#endif
+#ifdef INT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
+#  define _PRI64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _PRI64_PREFIX "I64"
+# elif LONG_MAX >> 30 == 1
+#  define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined PRId64
+#  define PRId64 _PRI64_PREFIX "d"
+# endif
+# if !defined PRIi64
+#  define PRIi64 _PRI64_PREFIX "i"
+# endif
+#endif
+#ifdef UINT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
+#  define _PRIu64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _PRIu64_PREFIX "I64"
+# elif ULONG_MAX >> 31 == 1
+#  define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined PRIo64
+#  define PRIo64 _PRIu64_PREFIX "o"
+# endif
+# if !defined PRIu64
+#  define PRIu64 _PRIu64_PREFIX "u"
+# endif
+# if !defined PRIx64
+#  define PRIx64 _PRIu64_PREFIX "x"
+# endif
+# if !defined PRIX64
+#  define PRIX64 _PRIu64_PREFIX "X"
+# endif
+#endif
+
+#if !defined PRIdLEAST8
+# define PRIdLEAST8 "d"
+#endif
+#if !defined PRIiLEAST8
+# define PRIiLEAST8 "i"
+#endif
+#if !defined PRIoLEAST8
+# define PRIoLEAST8 "o"
+#endif
+#if !defined PRIuLEAST8
+# define PRIuLEAST8 "u"
+#endif
+#if !defined PRIxLEAST8
+# define PRIxLEAST8 "x"
+#endif
+#if !defined PRIXLEAST8
+# define PRIXLEAST8 "X"
+#endif
+#if !defined PRIdLEAST16
+# define PRIdLEAST16 "d"
+#endif
+#if !defined PRIiLEAST16
+# define PRIiLEAST16 "i"
+#endif
+#if !defined PRIoLEAST16
+# define PRIoLEAST16 "o"
+#endif
+#if !defined PRIuLEAST16
+# define PRIuLEAST16 "u"
+#endif
+#if !defined PRIxLEAST16
+# define PRIxLEAST16 "x"
+#endif
+#if !defined PRIXLEAST16
+# define PRIXLEAST16 "X"
+#endif
+#if !defined PRIdLEAST32
+# define PRIdLEAST32 "d"
+#endif
+#if !defined PRIiLEAST32
+# define PRIiLEAST32 "i"
+#endif
+#if !defined PRIoLEAST32
+# define PRIoLEAST32 "o"
+#endif
+#if !defined PRIuLEAST32
+# define PRIuLEAST32 "u"
+#endif
+#if !defined PRIxLEAST32
+# define PRIxLEAST32 "x"
+#endif
+#if !defined PRIXLEAST32
+# define PRIXLEAST32 "X"
+#endif
+#ifdef INT64_MAX
+# if !defined PRIdLEAST64
+#  define PRIdLEAST64 PRId64
+# endif
+# if !defined PRIiLEAST64
+#  define PRIiLEAST64 PRIi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined PRIoLEAST64
+#  define PRIoLEAST64 PRIo64
+# endif
+# if !defined PRIuLEAST64
+#  define PRIuLEAST64 PRIu64
+# endif
+# if !defined PRIxLEAST64
+#  define PRIxLEAST64 PRIx64
+# endif
+# if !defined PRIXLEAST64
+#  define PRIXLEAST64 PRIX64
+# endif
+#endif
+
+#if !defined PRIdFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define PRIdFAST8 PRId64
+# else
+#  define PRIdFAST8 "d"
+# endif
+#endif
+#if !defined PRIiFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define PRIiFAST8 PRIi64
+# else
+#  define PRIiFAST8 "i"
+# endif
+#endif
+#if !defined PRIoFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIoFAST8 PRIo64
+# else
+#  define PRIoFAST8 "o"
+# endif
+#endif
+#if !defined PRIuFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIuFAST8 PRIu64
+# else
+#  define PRIuFAST8 "u"
+# endif
+#endif
+#if !defined PRIxFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIxFAST8 PRIx64
+# else
+#  define PRIxFAST8 "x"
+# endif
+#endif
+#if !defined PRIXFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIXFAST8 PRIX64
+# else
+#  define PRIXFAST8 "X"
+# endif
+#endif
+#if !defined PRIdFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define PRIdFAST16 PRId64
+# else
+#  define PRIdFAST16 "d"
+# endif
+#endif
+#if !defined PRIiFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define PRIiFAST16 PRIi64
+# else
+#  define PRIiFAST16 "i"
+# endif
+#endif
+#if !defined PRIoFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIoFAST16 PRIo64
+# else
+#  define PRIoFAST16 "o"
+# endif
+#endif
+#if !defined PRIuFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIuFAST16 PRIu64
+# else
+#  define PRIuFAST16 "u"
+# endif
+#endif
+#if !defined PRIxFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIxFAST16 PRIx64
+# else
+#  define PRIxFAST16 "x"
+# endif
+#endif
+#if !defined PRIXFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIXFAST16 PRIX64
+# else
+#  define PRIXFAST16 "X"
+# endif
+#endif
+#if !defined PRIdFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define PRIdFAST32 PRId64
+# else
+#  define PRIdFAST32 "d"
+# endif
+#endif
+#if !defined PRIiFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define PRIiFAST32 PRIi64
+# else
+#  define PRIiFAST32 "i"
+# endif
+#endif
+#if !defined PRIoFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIoFAST32 PRIo64
+# else
+#  define PRIoFAST32 "o"
+# endif
+#endif
+#if !defined PRIuFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIuFAST32 PRIu64
+# else
+#  define PRIuFAST32 "u"
+# endif
+#endif
+#if !defined PRIxFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIxFAST32 PRIx64
+# else
+#  define PRIxFAST32 "x"
+# endif
+#endif
+#if !defined PRIXFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIXFAST32 PRIX64
+# else
+#  define PRIXFAST32 "X"
+# endif
+#endif
+#ifdef INT64_MAX
+# if !defined PRIdFAST64
+#  define PRIdFAST64 PRId64
+# endif
+# if !defined PRIiFAST64
+#  define PRIiFAST64 PRIi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined PRIoFAST64
+#  define PRIoFAST64 PRIo64
+# endif
+# if !defined PRIuFAST64
+#  define PRIuFAST64 PRIu64
+# endif
+# if !defined PRIxFAST64
+#  define PRIxFAST64 PRIx64
+# endif
+# if !defined PRIXFAST64
+#  define PRIXFAST64 PRIX64
+# endif
+#endif
+
+#if !defined PRIdMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define PRIdMAX PRId64
+# else
+#  define PRIdMAX "ld"
+# endif
+#endif
+#if !defined PRIiMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define PRIiMAX PRIi64
+# else
+#  define PRIiMAX "li"
+# endif
+#endif
+#if !defined PRIoMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIoMAX PRIo64
+# else
+#  define PRIoMAX "lo"
+# endif
+#endif
+#if !defined PRIuMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIuMAX PRIu64
+# else
+#  define PRIuMAX "lu"
+# endif
+#endif
+#if !defined PRIxMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIxMAX PRIx64
+# else
+#  define PRIxMAX "lx"
+# endif
+#endif
+#if !defined PRIXMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIXMAX PRIX64
+# else
+#  define PRIXMAX "lX"
+# endif
+#endif
+
+#if !defined PRIdPTR
+# ifdef INTPTR_MAX
+#  define PRIdPTR @PRIPTR_PREFIX@ "d"
+# endif
+#endif
+#if !defined PRIiPTR
+# ifdef INTPTR_MAX
+#  define PRIiPTR @PRIPTR_PREFIX@ "i"
+# endif
+#endif
+#if !defined PRIoPTR
+# ifdef UINTPTR_MAX
+#  define PRIoPTR @PRIPTR_PREFIX@ "o"
+# endif
+#endif
+#if !defined PRIuPTR
+# ifdef UINTPTR_MAX
+#  define PRIuPTR @PRIPTR_PREFIX@ "u"
+# endif
+#endif
+#if !defined PRIxPTR
+# ifdef UINTPTR_MAX
+#  define PRIxPTR @PRIPTR_PREFIX@ "x"
+# endif
+#endif
+#if !defined PRIXPTR
+# ifdef UINTPTR_MAX
+#  define PRIXPTR @PRIPTR_PREFIX@ "X"
+# endif
+#endif
+
+#if !defined SCNd8
+# ifdef INT8_MAX
+#  define SCNd8 "hhd"
+# endif
+#endif
+#if !defined SCNi8
+# ifdef INT8_MAX
+#  define SCNi8 "hhi"
+# endif
+#endif
+#if !defined SCNo8
+# ifdef UINT8_MAX
+#  define SCNo8 "hho"
+# endif
+#endif
+#if !defined SCNu8
+# ifdef UINT8_MAX
+#  define SCNu8 "hhu"
+# endif
+#endif
+#if !defined SCNx8
+# ifdef UINT8_MAX
+#  define SCNx8 "hhx"
+# endif
+#endif
+#if !defined SCNd16
+# ifdef INT16_MAX
+#  define SCNd16 "hd"
+# endif
+#endif
+#if !defined SCNi16
+# ifdef INT16_MAX
+#  define SCNi16 "hi"
+# endif
+#endif
+#if !defined SCNo16
+# ifdef UINT16_MAX
+#  define SCNo16 "ho"
+# endif
+#endif
+#if !defined SCNu16
+# ifdef UINT16_MAX
+#  define SCNu16 "hu"
+# endif
+#endif
+#if !defined SCNx16
+# ifdef UINT16_MAX
+#  define SCNx16 "hx"
+# endif
+#endif
+#if !defined SCNd32
+# ifdef INT32_MAX
+#  define SCNd32 "d"
+# endif
+#endif
+#if !defined SCNi32
+# ifdef INT32_MAX
+#  define SCNi32 "i"
+# endif
+#endif
+#if !defined SCNo32
+# ifdef UINT32_MAX
+#  define SCNo32 "o"
+# endif
+#endif
+#if !defined SCNu32
+# ifdef UINT32_MAX
+#  define SCNu32 "u"
+# endif
+#endif
+#if !defined SCNx32
+# ifdef UINT32_MAX
+#  define SCNx32 "x"
+# endif
+#endif
+#ifdef INT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
+#  define _SCN64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _SCN64_PREFIX "I64"
+# elif LONG_MAX >> 30 == 1
+#  define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined SCNd64
+#  define SCNd64 _SCN64_PREFIX "d"
+# endif
+# if !defined SCNi64
+#  define SCNi64 _SCN64_PREFIX "i"
+# endif
+#endif
+#ifdef UINT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
+#  define _SCNu64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _SCNu64_PREFIX "I64"
+# elif ULONG_MAX >> 31 == 1
+#  define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined SCNo64
+#  define SCNo64 _SCNu64_PREFIX "o"
+# endif
+# if !defined SCNu64
+#  define SCNu64 _SCNu64_PREFIX "u"
+# endif
+# if !defined SCNx64
+#  define SCNx64 _SCNu64_PREFIX "x"
+# endif
+#endif
+
+#if !defined SCNdLEAST8
+# define SCNdLEAST8 "hhd"
+#endif
+#if !defined SCNiLEAST8
+# define SCNiLEAST8 "hhi"
+#endif
+#if !defined SCNoLEAST8
+# define SCNoLEAST8 "hho"
+#endif
+#if !defined SCNuLEAST8
+# define SCNuLEAST8 "hhu"
+#endif
+#if !defined SCNxLEAST8
+# define SCNxLEAST8 "hhx"
+#endif
+#if !defined SCNdLEAST16
+# define SCNdLEAST16 "hd"
+#endif
+#if !defined SCNiLEAST16
+# define SCNiLEAST16 "hi"
+#endif
+#if !defined SCNoLEAST16
+# define SCNoLEAST16 "ho"
+#endif
+#if !defined SCNuLEAST16
+# define SCNuLEAST16 "hu"
+#endif
+#if !defined SCNxLEAST16
+# define SCNxLEAST16 "hx"
+#endif
+#if !defined SCNdLEAST32
+# define SCNdLEAST32 "d"
+#endif
+#if !defined SCNiLEAST32
+# define SCNiLEAST32 "i"
+#endif
+#if !defined SCNoLEAST32
+# define SCNoLEAST32 "o"
+#endif
+#if !defined SCNuLEAST32
+# define SCNuLEAST32 "u"
+#endif
+#if !defined SCNxLEAST32
+# define SCNxLEAST32 "x"
+#endif
+#ifdef INT64_MAX
+# if !defined SCNdLEAST64
+#  define SCNdLEAST64 SCNd64
+# endif
+# if !defined SCNiLEAST64
+#  define SCNiLEAST64 SCNi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined SCNoLEAST64
+#  define SCNoLEAST64 SCNo64
+# endif
+# if !defined SCNuLEAST64
+#  define SCNuLEAST64 SCNu64
+# endif
+# if !defined SCNxLEAST64
+#  define SCNxLEAST64 SCNx64
+# endif
+#endif
+
+#if !defined SCNdFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define SCNdFAST8 SCNd64
+# elif INT_FAST8_MAX == 0x7fff
+#  define SCNdFAST8 "hd"
+# elif INT_FAST8_MAX == 0x7f
+#  define SCNdFAST8 "hhd"
+# else
+#  define SCNdFAST8 "d"
+# endif
+#endif
+#if !defined SCNiFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define SCNiFAST8 SCNi64
+# elif INT_FAST8_MAX == 0x7fff
+#  define SCNiFAST8 "hi"
+# elif INT_FAST8_MAX == 0x7f
+#  define SCNiFAST8 "hhi"
+# else
+#  define SCNiFAST8 "i"
+# endif
+#endif
+#if !defined SCNoFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define SCNoFAST8 SCNo64
+# elif UINT_FAST8_MAX == 0xffff
+#  define SCNoFAST8 "ho"
+# elif UINT_FAST8_MAX == 0xff
+#  define SCNoFAST8 "hho"
+# else
+#  define SCNoFAST8 "o"
+# endif
+#endif
+#if !defined SCNuFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define SCNuFAST8 SCNu64
+# elif UINT_FAST8_MAX == 0xffff
+#  define SCNuFAST8 "hu"
+# elif UINT_FAST8_MAX == 0xff
+#  define SCNuFAST8 "hhu"
+# else
+#  define SCNuFAST8 "u"
+# endif
+#endif
+#if !defined SCNxFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define SCNxFAST8 SCNx64
+# elif UINT_FAST8_MAX == 0xffff
+#  define SCNxFAST8 "hx"
+# elif UINT_FAST8_MAX == 0xff
+#  define SCNxFAST8 "hhx"
+# else
+#  define SCNxFAST8 "x"
+# endif
+#endif
+#if !defined SCNdFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define SCNdFAST16 SCNd64
+# elif INT_FAST16_MAX == 0x7fff
+#  define SCNdFAST16 "hd"
+# else
+#  define SCNdFAST16 "d"
+# endif
+#endif
+#if !defined SCNiFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define SCNiFAST16 SCNi64
+# elif INT_FAST16_MAX == 0x7fff
+#  define SCNiFAST16 "hi"
+# else
+#  define SCNiFAST16 "i"
+# endif
+#endif
+#if !defined SCNoFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define SCNoFAST16 SCNo64
+# elif UINT_FAST16_MAX == 0xffff
+#  define SCNoFAST16 "ho"
+# else
+#  define SCNoFAST16 "o"
+# endif
+#endif
+#if !defined SCNuFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define SCNuFAST16 SCNu64
+# elif UINT_FAST16_MAX == 0xffff
+#  define SCNuFAST16 "hu"
+# else
+#  define SCNuFAST16 "u"
+# endif
+#endif
+#if !defined SCNxFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define SCNxFAST16 SCNx64
+# elif UINT_FAST16_MAX == 0xffff
+#  define SCNxFAST16 "hx"
+# else
+#  define SCNxFAST16 "x"
+# endif
+#endif
+#if !defined SCNdFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define SCNdFAST32 SCNd64
+# else
+#  define SCNdFAST32 "d"
+# endif
+#endif
+#if !defined SCNiFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define SCNiFAST32 SCNi64
+# else
+#  define SCNiFAST32 "i"
+# endif
+#endif
+#if !defined SCNoFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define SCNoFAST32 SCNo64
+# else
+#  define SCNoFAST32 "o"
+# endif
+#endif
+#if !defined SCNuFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define SCNuFAST32 SCNu64
+# else
+#  define SCNuFAST32 "u"
+# endif
+#endif
+#if !defined SCNxFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define SCNxFAST32 SCNx64
+# else
+#  define SCNxFAST32 "x"
+# endif
+#endif
+#ifdef INT64_MAX
+# if !defined SCNdFAST64
+#  define SCNdFAST64 SCNd64
+# endif
+# if !defined SCNiFAST64
+#  define SCNiFAST64 SCNi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined SCNoFAST64
+#  define SCNoFAST64 SCNo64
+# endif
+# if !defined SCNuFAST64
+#  define SCNuFAST64 SCNu64
+# endif
+# if !defined SCNxFAST64
+#  define SCNxFAST64 SCNx64
+# endif
+#endif
+
+#if !defined SCNdMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define SCNdMAX SCNd64
+# else
+#  define SCNdMAX "ld"
+# endif
+#endif
+#if !defined SCNiMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define SCNiMAX SCNi64
+# else
+#  define SCNiMAX "li"
+# endif
+#endif
+#if !defined SCNoMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define SCNoMAX SCNo64
+# else
+#  define SCNoMAX "lo"
+# endif
+#endif
+#if !defined SCNuMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define SCNuMAX SCNu64
+# else
+#  define SCNuMAX "lu"
+# endif
+#endif
+#if !defined SCNxMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define SCNxMAX SCNx64
+# else
+#  define SCNxMAX "lx"
+# endif
+#endif
+
+#if !defined SCNdPTR
+# ifdef INTPTR_MAX
+#  define SCNdPTR @PRIPTR_PREFIX@ "d"
+# endif
+#endif
+#if !defined SCNiPTR
+# ifdef INTPTR_MAX
+#  define SCNiPTR @PRIPTR_PREFIX@ "i"
+# endif
+#endif
+#if !defined SCNoPTR
+# ifdef UINTPTR_MAX
+#  define SCNoPTR @PRIPTR_PREFIX@ "o"
+# endif
+#endif
+#if !defined SCNuPTR
+# ifdef UINTPTR_MAX
+#  define SCNuPTR @PRIPTR_PREFIX@ "u"
+# endif
+#endif
+#if !defined SCNxPTR
+# ifdef UINTPTR_MAX
+#  define SCNxPTR @PRIPTR_PREFIX@ "x"
+# endif
+#endif
+
+/* 7.8.2 Functions for greatest-width integer types */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if @GNULIB_IMAXABS@
+# if @REPLACE_IMAXABS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef imaxabs
+#   define imaxabs rpl_imaxabs
+#  endif
+_GL_FUNCDECL_RPL (imaxabs, intmax_t, (intmax_t x));
+_GL_CXXALIAS_RPL (imaxabs, intmax_t, (intmax_t x));
+# else
+#  if !@HAVE_DECL_IMAXABS@
+_GL_FUNCDECL_SYS (imaxabs, intmax_t, (intmax_t x));
+#  endif
+_GL_CXXALIAS_SYS (imaxabs, intmax_t, (intmax_t x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (imaxabs);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef imaxabs
+# if HAVE_RAW_DECL_IMAXABS
+_GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
+                 "use gnulib module imaxabs for portability");
+# endif
+#endif
+
+#if @GNULIB_IMAXDIV@
+# if !@HAVE_IMAXDIV_T@
+#  if !GNULIB_defined_imaxdiv_t
+typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
+#   define GNULIB_defined_imaxdiv_t 1
+#  endif
+# endif
+# if @REPLACE_IMAXDIV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef imaxdiv
+#   define imaxdiv rpl_imaxdiv
+#  endif
+_GL_FUNCDECL_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom));
+_GL_CXXALIAS_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom));
+# else
+#  if !@HAVE_DECL_IMAXDIV@
+_GL_FUNCDECL_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom));
+#  endif
+_GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (imaxdiv);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef imaxdiv
+# if HAVE_RAW_DECL_IMAXDIV
+_GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
+                 "use gnulib module imaxdiv for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOIMAX@
+# if @REPLACE_STRTOIMAX@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strtoimax
+#   define strtoimax rpl_strtoimax
+#  endif
+_GL_FUNCDECL_RPL (strtoimax, intmax_t,
+                  (const char *restrict, char **restrict, int)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoimax, intmax_t,
+                  (const char *restrict, char **restrict, int));
+# else
+#  if !@HAVE_DECL_STRTOIMAX@
+#   undef strtoimax
+_GL_FUNCDECL_SYS (strtoimax, intmax_t,
+                  (const char *restrict, char **restrict, int)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtoimax, intmax_t,
+                  (const char *restrict, char **restrict, int));
+# endif
+_GL_CXXALIASWARN (strtoimax);
+#elif defined GNULIB_POSIXCHECK
+# undef strtoimax
+# if HAVE_RAW_DECL_STRTOIMAX
+_GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
+                 "use gnulib module strtoimax for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOUMAX@
+# if @REPLACE_STRTOUMAX@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strtoumax
+#   define strtoumax rpl_strtoumax
+#  endif
+_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
+                  (const char *restrict, char **restrict, int)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoumax, uintmax_t,
+                  (const char *restrict, char **restrict, int));
+# else
+#  if !@HAVE_DECL_STRTOUMAX@
+#   undef strtoumax
+_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
+                  (const char *restrict, char **restrict, int)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtoumax, uintmax_t,
+                  (const char *restrict, char **restrict, int));
+# endif
+_GL_CXXALIASWARN (strtoumax);
+#elif defined GNULIB_POSIXCHECK
+# undef strtoumax
+# if HAVE_RAW_DECL_STRTOUMAX
+_GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - "
+                 "use gnulib module strtoumax for portability");
+# endif
+#endif
+
+/* Don't bother defining or declaring wcstoimax and wcstoumax, since
+   wide-character functions like this are hardly ever useful.  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */
deleted file mode 120000 (symlink)
index bb4aa8dfdf94199387fee05f4212b638e3519f76..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isapipe.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..82cdae25ccb92822b86a86a8eabe2ea1a7518094
--- /dev/null
@@ -0,0 +1,122 @@
+/* Test whether a file descriptor is a pipe.
+
+   Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "isapipe.h"
+
+#include <errno.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Windows platforms.  */
+
+/* Get GetFileType.  */
+# include <windows.h>
+
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+
+int
+isapipe (int fd)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+
+  if (h == INVALID_HANDLE_VALUE)
+    {
+      errno = EBADF;
+      return -1;
+    }
+
+  return (GetFileType (h) == FILE_TYPE_PIPE);
+}
+
+#else
+/* Unix platforms.  */
+
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <unistd.h>
+
+/* The maximum link count for pipes; (nlink_t) -1 if not known.  */
+# ifndef PIPE_LINK_COUNT_MAX
+#  define PIPE_LINK_COUNT_MAX ((nlink_t) (-1))
+# endif
+
+/* Return 1 if FD is a pipe, 0 if not, -1 (setting errno) on error.
+
+   Test fairly strictly whether FD is a pipe.  lseek and checking for
+   ESPIPE does not suffice, since many non-pipe files cause lseek to
+   fail with errno == ESPIPE.  */
+
+int
+isapipe (int fd)
+{
+  nlink_t pipe_link_count_max = PIPE_LINK_COUNT_MAX;
+  bool check_for_fifo = (HAVE_FIFO_PIPES == 1);
+  struct stat st;
+  int fstat_result = fstat (fd, &st);
+
+  if (fstat_result != 0)
+    return fstat_result;
+
+  /* We want something that succeeds only for pipes, but on
+     POSIX-conforming hosts S_ISFIFO succeeds for both FIFOs and pipes
+     and we know of no portable, reliable way to distinguish them in
+     general.  However, in practice pipes always have a link count <=
+     PIPE_LINK_COUNT_MAX (unless someone attaches them to the file
+     system name space using fattach, in which case they're not really
+     pipes any more), so test for that as well.
+
+     On Darwin 7.7, pipes are sockets, so check for those instead.  */
+
+  if (! ((HAVE_FIFO_PIPES == 0 || HAVE_FIFO_PIPES == 1)
+         && PIPE_LINK_COUNT_MAX != (nlink_t) -1)
+      && (S_ISFIFO (st.st_mode) | S_ISSOCK (st.st_mode)))
+    {
+      int fd_pair[2];
+      int pipe_result = pipe (fd_pair);
+      if (pipe_result != 0)
+        return pipe_result;
+      else
+        {
+          struct stat pipe_st;
+          int fstat_pipe_result = fstat (fd_pair[0], &pipe_st);
+          int fstat_pipe_errno = errno;
+          close (fd_pair[0]);
+          close (fd_pair[1]);
+          if (fstat_pipe_result != 0)
+            {
+              errno = fstat_pipe_errno;
+              return fstat_pipe_result;
+            }
+          check_for_fifo = (S_ISFIFO (pipe_st.st_mode) != 0);
+          pipe_link_count_max = pipe_st.st_nlink;
+        }
+    }
+
+  return
+    (st.st_nlink <= pipe_link_count_max
+     && (check_for_fifo ? S_ISFIFO (st.st_mode) : S_ISSOCK (st.st_mode)));
+}
+
+#endif
deleted file mode 120000 (symlink)
index 9a9f7cc34e2804b5fe98ed85a2f59163e389f067..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isapipe.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..affdca8a9612a8da61e0fb62fc8a988979be3862
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test whether a file descriptor is a pipe.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses HAVE_FIFO_PIPES.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Whether pipes are FIFOs; -1 if not known.  */
+#ifndef HAVE_FIFO_PIPES
+# define HAVE_FIFO_PIPES (-1)
+#endif
+
+int isapipe (int fd);
deleted file mode 120000 (symlink)
index a4d215f35675dcc5af8197425a3472fc557fa380..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isatty.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..667a699217fe9ed1a7bfaed15ce63d5d8184743a
--- /dev/null
@@ -0,0 +1,187 @@
+/* isatty() replacement.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+/* This replacement is enabled on native Windows.  */
+
+#include <errno.h>
+#include <string.h>
+
+/* Get declarations of the Win32 API functions.  */
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+/* Get _get_osfhandle().  */
+#if GNULIB_MSVC_NOTHROW
+# include "msvc-nothrow.h"
+#else
+# include <io.h>
+#endif
+
+/* Don't assume that UNICODE is not defined.  */
+#undef LoadLibrary
+#define LoadLibrary LoadLibraryA
+#undef QueryFullProcessImageName
+#define QueryFullProcessImageName QueryFullProcessImageNameA
+
+#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+
+/* Avoid warnings from gcc -Wcast-function-type.  */
+# define GetProcAddress \
+   (void *) GetProcAddress
+
+/* GetNamedPipeClientProcessId was introduced only in Windows Vista.  */
+typedef BOOL (WINAPI * GetNamedPipeClientProcessIdFuncType) (HANDLE hPipe,
+                                                             PULONG pClientProcessId);
+static GetNamedPipeClientProcessIdFuncType GetNamedPipeClientProcessIdFunc = NULL;
+/* QueryFullProcessImageName was introduced only in Windows Vista.  */
+typedef BOOL (WINAPI * QueryFullProcessImageNameFuncType) (HANDLE hProcess,
+                                                           DWORD dwFlags,
+                                                           LPSTR lpExeName,
+                                                           PDWORD pdwSize);
+static QueryFullProcessImageNameFuncType QueryFullProcessImageNameFunc = NULL;
+static BOOL initialized = FALSE;
+
+static void
+initialize (void)
+{
+  HMODULE kernel32 = LoadLibrary ("kernel32.dll");
+  if (kernel32 != NULL)
+    {
+      GetNamedPipeClientProcessIdFunc =
+        (GetNamedPipeClientProcessIdFuncType) GetProcAddress (kernel32, "GetNamedPipeClientProcessId");
+      QueryFullProcessImageNameFunc =
+        (QueryFullProcessImageNameFuncType) GetProcAddress (kernel32, "QueryFullProcessImageNameA");
+    }
+  initialized = TRUE;
+}
+
+#else
+
+# define GetNamedPipeClientProcessIdFunc GetNamedPipeClientProcessId
+# define QueryFullProcessImageNameFunc QueryFullProcessImageName
+
+#endif
+
+static BOOL IsConsoleHandle (HANDLE h)
+{
+  DWORD mode;
+  /* GetConsoleMode
+     <https://docs.microsoft.com/en-us/windows/console/getconsolemode> */
+  return GetConsoleMode (h, &mode) != 0;
+}
+
+static BOOL IsCygwinConsoleHandle (HANDLE h)
+{
+  /* A handle to a Cygwin console is in fact a named pipe whose client process
+     and server process is <CYGWIN_INSTALL_DIR>\bin\mintty.exe.  */
+  BOOL result = FALSE;
+  ULONG processId;
+
+#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+  if (!initialized)
+    initialize ();
+#endif
+
+  /* GetNamedPipeClientProcessId
+     <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getnamedpipeclientprocessid>
+     It requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher.  */
+  if (GetNamedPipeClientProcessIdFunc && QueryFullProcessImageNameFunc
+      && GetNamedPipeClientProcessIdFunc (h, &processId))
+    {
+      /* OpenProcess
+         <https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-openprocess> */
+      HANDLE processHandle =
+        OpenProcess (PROCESS_QUERY_LIMITED_INFORMATION, FALSE, processId);
+      if (processHandle != NULL)
+        {
+          char buf[1024];
+          DWORD bufsize = sizeof (buf);
+          /* The file name can be determined through
+             GetProcessImageFileName
+             <https://docs.microsoft.com/en-us/windows/desktop/api/psapi/nf-psapi-getprocessimagefilenamea>
+             or
+             QueryFullProcessImageName
+             <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-queryfullprocessimagenamea>
+             The former returns a file name in non-standard notation (it starts
+             with '\Device\') and may require linking with psapi.dll.
+             The latter is better, but requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA
+             or higher.  */
+          if (QueryFullProcessImageNameFunc (processHandle, 0, buf, &bufsize))
+            {
+              if (strlen (buf) >= 11
+                  && strcmp (buf + strlen (buf) - 11, "\\mintty.exe") == 0)
+                result = TRUE;
+            }
+          CloseHandle (processHandle);
+        }
+    }
+  return result;
+}
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+_isatty_nothrow (int fd)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _isatty (fd);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = 0;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+#else
+# define _isatty_nothrow _isatty
+#endif
+
+/* Determine whether FD refers to a console device.  Return 1 if yes.
+   Return 0 and set errno if no. (ptsname_r relies on the errno value.)  */
+int
+isatty (int fd)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  if (h == INVALID_HANDLE_VALUE)
+    {
+      errno = EBADF;
+      return 0;
+    }
+  /* _isatty (fd) tests whether GetFileType of the handle is FILE_TYPE_CHAR.
+     But it does not set errno when it returns 0.  */
+  if (_isatty_nothrow (fd))
+    {
+      if (IsConsoleHandle (h))
+        return 1;
+    }
+  if (IsCygwinConsoleHandle (h))
+    return 1;
+  errno = ENOTTY;
+  return 0;
+}
deleted file mode 120000 (symlink)
index 52b6e49c1a3cc22d7006db97fccf117804e05d07..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isblank.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d16450aaae4454511464927b3aff05c3fa262977
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test whether a character is a blank.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <ctype.h>
+
+int
+isblank (int c)
+{
+  /* On all known platforms, in all predefined locales, isblank(c) is likely
+     equivalent with  (c == ' ' || c == '\t').  Look at the glibc definition
+     (in glibc/localedata/locales/i18n): The "blank" characters are '\t', ' ',
+     U+1680, U+180E, U+2000..U+2006, U+2008..U+200A, U+205F, U+3000, and none
+     except the first two is present in a common 8-bit encoding.  Therefore
+     the substitute for other platforms is not more complicated than this.  */
+  return (c == ' ' || c == '\t');
+}
deleted file mode 120000 (symlink)
index 73ffa783259a41c5e086ecf64965bc7b9d1ac321..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isnan.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c7d84e8dc40a524ee8b5b292562de544fc77832a
--- /dev/null
@@ -0,0 +1,190 @@
+/* Test for NaN that does not need libm.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+/* Specification.  */
+#ifdef USE_LONG_DOUBLE
+/* Specification found in math.h or isnanl-nolibm.h.  */
+extern int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
+#elif ! defined USE_FLOAT
+/* Specification found in math.h or isnand-nolibm.h.  */
+extern int rpl_isnand (double x);
+#else /* defined USE_FLOAT */
+/* Specification found in math.h or isnanf-nolibm.h.  */
+extern int rpl_isnanf (float x);
+#endif
+
+#include <float.h>
+#include <string.h>
+
+#include "float+.h"
+
+#ifdef USE_LONG_DOUBLE
+# define FUNC rpl_isnanl
+# define DOUBLE long double
+# define MAX_EXP LDBL_MAX_EXP
+# define MIN_EXP LDBL_MIN_EXP
+# if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
+#  define KNOWN_EXPBIT0_LOCATION
+#  define EXPBIT0_WORD LDBL_EXPBIT0_WORD
+#  define EXPBIT0_BIT LDBL_EXPBIT0_BIT
+# endif
+# define SIZE SIZEOF_LDBL
+# define L_(literal) literal##L
+#elif ! defined USE_FLOAT
+# define FUNC rpl_isnand
+# define DOUBLE double
+# define MAX_EXP DBL_MAX_EXP
+# define MIN_EXP DBL_MIN_EXP
+# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
+#  define KNOWN_EXPBIT0_LOCATION
+#  define EXPBIT0_WORD DBL_EXPBIT0_WORD
+#  define EXPBIT0_BIT DBL_EXPBIT0_BIT
+# endif
+# define SIZE SIZEOF_DBL
+# define L_(literal) literal
+#else /* defined USE_FLOAT */
+# define FUNC rpl_isnanf
+# define DOUBLE float
+# define MAX_EXP FLT_MAX_EXP
+# define MIN_EXP FLT_MIN_EXP
+# if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
+#  define KNOWN_EXPBIT0_LOCATION
+#  define EXPBIT0_WORD FLT_EXPBIT0_WORD
+#  define EXPBIT0_BIT FLT_EXPBIT0_BIT
+# endif
+# define SIZE SIZEOF_FLT
+# define L_(literal) literal##f
+#endif
+
+#define EXP_MASK ((MAX_EXP - MIN_EXP) | 7)
+
+#define NWORDS \
+  ((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double;
+
+/* Most hosts nowadays use IEEE floating point, so they use IEC 60559
+   representations, have infinities and NaNs, and do not trap on
+   exceptions.  Define IEEE_FLOATING_POINT if this host is one of the
+   typical ones.  The C23 macro __STDC_IEC_60559_BFP__ macro (or its cousin,
+   the now-obsolescent C11 macro __STDC_IEC_559__) is close to what is
+   wanted here, but is not quite right because this file does not require
+   all the features of C23 Annex F (and works even with pre-C11 platforms,
+   for that matter).  */
+
+#define IEEE_FLOATING_POINT (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
+                             && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
+
+int
+FUNC (DOUBLE x)
+{
+#if defined KNOWN_EXPBIT0_LOCATION && IEEE_FLOATING_POINT
+# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+  /* Special CPU dependent code is needed to treat bit patterns outside the
+     IEEE 754 specification (such as Pseudo-NaNs, Pseudo-Infinities,
+     Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals) as NaNs.
+     These bit patterns are:
+       - exponent = 0x0001..0x7FFF, mantissa bit 63 = 0,
+       - exponent = 0x0000, mantissa bit 63 = 1.
+     The NaN bit pattern is:
+       - exponent = 0x7FFF, mantissa >= 0x8000000000000001.  */
+  memory_double m;
+  unsigned int exponent;
+
+  m.value = x;
+  exponent = (m.word[EXPBIT0_WORD] >> EXPBIT0_BIT) & EXP_MASK;
+#  ifdef WORDS_BIGENDIAN
+  /* Big endian: EXPBIT0_WORD = 0, EXPBIT0_BIT = 16.  */
+  if (exponent == 0)
+    return 1 & (m.word[0] >> 15);
+  else if (exponent == EXP_MASK)
+    return (((m.word[0] ^ 0x8000U) << 16) | m.word[1] | (m.word[2] >> 16)) != 0;
+  else
+    return 1 & ~(m.word[0] >> 15);
+#  else
+  /* Little endian: EXPBIT0_WORD = 2, EXPBIT0_BIT = 0.  */
+  if (exponent == 0)
+    return (m.word[1] >> 31);
+  else if (exponent == EXP_MASK)
+    return ((m.word[1] ^ 0x80000000U) | m.word[0]) != 0;
+  else
+    return (m.word[1] >> 31) ^ 1;
+#  endif
+# else
+  /* Be careful to not do any floating-point operation on x, such as x == x,
+     because x may be a signaling NaN.  */
+#  if defined __SUNPRO_C || defined __ICC || defined _MSC_VER \
+      || defined __DECC || defined __TINYC__ \
+      || (defined __sgi && !defined __GNUC__)
+  /* The Sun C 5.0, Intel ICC 10.0, Microsoft Visual C/C++ 9.0, Compaq (ex-DEC)
+     6.4, and TinyCC compilers don't recognize the initializers as constant
+     expressions.  The Compaq compiler also fails when constant-folding
+     0.0 / 0.0 even when constant-folding is not required.  The Microsoft
+     Visual C/C++ compiler also fails when constant-folding 1.0 / 0.0 even
+     when constant-folding is not required. The SGI MIPSpro C compiler
+     complains about "floating-point operation result is out of range".  */
+  static DOUBLE zero = L_(0.0);
+  memory_double nan;
+  DOUBLE plus_inf = L_(1.0) / zero;
+  DOUBLE minus_inf = -L_(1.0) / zero;
+  nan.value = zero / zero;
+#  else
+  static memory_double nan = { L_(0.0) / L_(0.0) };
+  static DOUBLE plus_inf = L_(1.0) / L_(0.0);
+  static DOUBLE minus_inf = -L_(1.0) / L_(0.0);
+#  endif
+  {
+    memory_double m;
+
+    /* A NaN can be recognized through its exponent.  But exclude +Infinity and
+       -Infinity, which have the same exponent.  */
+    m.value = x;
+    if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD])
+         & (EXP_MASK << EXPBIT0_BIT))
+        == 0)
+      return (memcmp (&m.value, &plus_inf, SIZE) != 0
+              && memcmp (&m.value, &minus_inf, SIZE) != 0);
+    else
+      return 0;
+  }
+# endif
+#else
+  /* The configuration did not find sufficient information, or does
+     not use IEEE floating point.  Give up about the signaling NaNs;
+     handle only the quiet NaNs.  */
+  if (x == x)
+    {
+# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+      /* Detect any special bit patterns that pass ==; see comment above.  */
+      memory_double m1;
+      memory_double m2;
+
+      memset (&m1.value, 0, SIZE);
+      memset (&m2.value, 0, SIZE);
+      m1.value = x;
+      m2.value = x + (x ? 0.0L : -0.0L);
+      if (memcmp (&m1.value, &m2.value, SIZE) != 0)
+        return 1;
+# endif
+      return 0;
+    }
+  else
+    return 1;
+#endif
+}
deleted file mode 120000 (symlink)
index 22b84f179971b93ba3f3a7824317767545061029..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isnand-nolibm.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4d8b0e8f53a60e049d43c006e00bd5b4d8fdd6b1
--- /dev/null
@@ -0,0 +1,38 @@
+/* Test for NaN that does not need libm.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses HAVE_ISNAND_IN_LIBC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if HAVE_ISNAND_IN_LIBC
+/* Get declaration of isnan macro.  */
+# include <math.h>
+# if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+   /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.  */
+#  undef isnand
+#  define isnand(x) __builtin_isnan ((double)(x))
+# else
+#  undef isnand
+#  define isnand(x) isnan ((double)(x))
+# endif
+#else
+/* Test whether X is a NaN.  */
+# undef isnand
+# define isnand rpl_isnand
+extern int isnand (double x);
+#endif
deleted file mode 120000 (symlink)
index 57841ffa407a5262f32670071f71295944664c16..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isnand.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1287144a65a1dfdecfc471eaedcf7536bcee8805
--- /dev/null
@@ -0,0 +1,19 @@
+/* Test for NaN that does not need libm.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include "isnan.c"
deleted file mode 120000 (symlink)
index fc42b171a00d894d8920066576cecf927ab8ddd7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isnanf-nolibm.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..520b8147d27064b05440f58331ccb925528362d7
--- /dev/null
@@ -0,0 +1,46 @@
+/* Test for NaN that does not need libm.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses HAVE_ISNANF_IN_LIBC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if HAVE_ISNANF_IN_LIBC
+/* Get declaration of isnan macro or (older) isnanf function.  */
+# include <math.h>
+# if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+   /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.
+      GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't.  */
+#  undef isnanf
+#  define isnanf(x) __builtin_isnan ((float)(x))
+# elif defined isnan
+#  undef isnanf
+#  define isnanf(x) isnan ((float)(x))
+# else
+   /* Get declaration of isnanf(), if not declared in <math.h>.  */
+#  if defined __sgi
+   /* We can't include <ieeefp.h>, because it conflicts with our definition of
+      isnand.  Therefore declare isnanf separately.  */
+extern int isnanf (float x);
+#  endif
+# endif
+#else
+/* Test whether X is a NaN.  */
+# undef isnanf
+# define isnanf rpl_isnanf
+extern int isnanf (float x);
+#endif
deleted file mode 120000 (symlink)
index 1fca1700ca2b72d9a9b6a5ba9b3c905ba41900d7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isnanf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c540011775a72ad4246c622d6332a2325c83e34a
--- /dev/null
@@ -0,0 +1,20 @@
+/* Test for NaN that does not need libm.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#define USE_FLOAT
+#include "isnan.c"
deleted file mode 120000 (symlink)
index 20c5025b1820169fb023b0f2a1d17e5878f64fcd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isnanl-nolibm.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3ea82f7d7d0c3220eb3fac48d0b944859eb18d3b
--- /dev/null
@@ -0,0 +1,39 @@
+/* Test for NaN that does not need libm.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses HAVE_ISNANL_IN_LIBC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if HAVE_ISNANL_IN_LIBC
+/* Get declaration of isnan macro or (older) isnanl function.  */
+# include <math.h>
+# if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+   /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.
+      GCC >= 4.0 also provides __builtin_isnanl, but clang doesn't.  */
+#  undef isnanl
+#  define isnanl(x) __builtin_isnan ((long double)(x))
+# elif defined isnan
+#  undef isnanl
+#  define isnanl(x) isnan ((long double)(x))
+# endif
+#else
+/* Test whether X is a NaN.  */
+# undef isnanl
+# define isnanl rpl_isnanl
+extern int isnanl (long double x);
+#endif
deleted file mode 120000 (symlink)
index f499de742d15101a1c5b84e7bf163764daa1ca7e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/isnanl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6d2ee67d580ef661e32a3ce063c92a637b03847a
--- /dev/null
@@ -0,0 +1,20 @@
+/* Test for NaN that does not need libm.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#define USE_LONG_DOUBLE
+#include "isnan.c"
deleted file mode 120000 (symlink)
index 28bd886c6e573b8b26c79e3c5ce8edac477d84a8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iswblank.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f699850a1bd91f2a8be80f9cb48f545bb7d59830
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test wide character for being blank.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+int
+iswblank (wint_t wc)
+{
+  return wc == ' ' || wc == '\t';
+}
deleted file mode 120000 (symlink)
index 8e92a1adfb34245ac93cacf4db58938b1b7fe22d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iswctype-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..999f220cc149cdf05f0d0b2ddf8d80968a4b625e
--- /dev/null
@@ -0,0 +1,22 @@
+/* Test whether a wide character has a given property.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+int
+iswctype (wint_t wc, wctype_t desc)
+{
+  return ((int (*) (wint_t)) desc) (wc);
+}
deleted file mode 120000 (symlink)
index 6feec63ca528a234f21346f87e4e1f7d6ebe5067..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iswctype.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f4e6f015d963d738ec29fe04450f478c077576b4
--- /dev/null
@@ -0,0 +1,36 @@
+/* Test whether a wide character has a given property.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+#if GNULIB_defined_wint_t && !GNULIB_defined_wctype_t
+
+int
+iswctype (wint_t wc, wctype_t desc)
+# undef iswctype
+{
+  return ((wchar_t) wc == wc ? iswctype ((wchar_t) wc, desc) : 0);
+}
+
+#else
+
+# include "iswctype-impl.h"
+
+#endif
deleted file mode 120000 (symlink)
index 500319177fbcc88398699ce460efdf61c8a474ac..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iswdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..57363ab8e405601c5e335a30a46d3375b8b53d67
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test wide character for being a digit.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+int
+iswdigit (wint_t wc)
+{
+  return wc >= '0' && wc <= '9';
+}
deleted file mode 120000 (symlink)
index 4143afacd8ead4655665425a9d668a04cb5a7ad5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iswpunct.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c7cb28b5fa716ce5d3aa4ce6cb7533e7274932dd
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test wide character for being a punctuation or symbol character.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+#include <ctype.h>
+
+int
+iswpunct (wint_t wc)
+#undef iswpunct
+{
+#if defined __ANDROID__
+  if ((unsigned int) wc < 128)
+    return ispunct ((unsigned int) wc);
+#endif
+  return iswpunct (wc);
+}
deleted file mode 120000 (symlink)
index 3de58b90fac8cdc29555ccdd42abb8e611ac7cb3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/iswxdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d32e3b0f7cdda2a692b63911f0344f5af4bc5d44
--- /dev/null
@@ -0,0 +1,33 @@
+/* Test wide character for being a hexadecimal digit.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+int
+iswxdigit (wint_t wc)
+{
+  return ((wc >= '0' && wc <= '9')
+#if 'A' == 0x41 && 'a' == 0x61
+          /* Optimization, assuming ASCII */
+          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')
+#else
+          || (wc >= 'A' && wc <= 'F') || (wc >= 'a' && wc <= 'f')
+#endif
+         );
+}
deleted file mode 120000 (symlink)
index 99d2dd85b9d166ebb656abc35d108c0bce90dc6a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/itold.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e6fbcff4089709f111b3ffbf0a4248ad0cb3c233
--- /dev/null
@@ -0,0 +1,28 @@
+/* Replacement for 'int' to 'long double' conversion routine.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <float.h>
+
+void
+_Qp_itoq (long double *result, int a)
+{
+  /* Convert from 'int' to 'double', then from 'double' to 'long double'.  */
+  *result = (double) a;
+}
deleted file mode 120000 (symlink)
index cafb17ead0b7f508a8f30097604dac78d2962d12..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/langinfo.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..febbd25f241367ed25514302da303611b8e3bac7
--- /dev/null
@@ -0,0 +1,229 @@
+/* Substitute for and wrapper around <langinfo.h>.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/*
+ * POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
+ * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
+ */
+
+#ifndef _@GUARD_PREFIX@_LANGINFO_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_LANGINFO_H@
+# @INCLUDE_NEXT@ @NEXT_LANGINFO_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_LANGINFO_H
+#define _@GUARD_PREFIX@_LANGINFO_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+
+#if !@HAVE_LANGINFO_H@
+
+/* A platform that lacks <langinfo.h>.  */
+
+/* Assume that it also lacks <nl_types.h> and the nl_item type.  */
+# if !GNULIB_defined_nl_item
+typedef int nl_item;
+#  define GNULIB_defined_nl_item 1
+# endif
+
+/* nl_langinfo items of the LC_CTYPE category */
+# define CODESET     10000
+/* nl_langinfo items of the LC_NUMERIC category */
+# define RADIXCHAR   10001
+# define DECIMAL_POINT RADIXCHAR
+# define THOUSEP     10002
+# define THOUSANDS_SEP THOUSEP
+# define GROUPING    10114
+/* nl_langinfo items of the LC_TIME category */
+# define D_T_FMT     10003
+# define D_FMT       10004
+# define T_FMT       10005
+# define T_FMT_AMPM  10006
+# define AM_STR      10007
+# define PM_STR      10008
+# define DAY_1       10009
+# define DAY_2       (DAY_1 + 1)
+# define DAY_3       (DAY_1 + 2)
+# define DAY_4       (DAY_1 + 3)
+# define DAY_5       (DAY_1 + 4)
+# define DAY_6       (DAY_1 + 5)
+# define DAY_7       (DAY_1 + 6)
+# define ABDAY_1     10016
+# define ABDAY_2     (ABDAY_1 + 1)
+# define ABDAY_3     (ABDAY_1 + 2)
+# define ABDAY_4     (ABDAY_1 + 3)
+# define ABDAY_5     (ABDAY_1 + 4)
+# define ABDAY_6     (ABDAY_1 + 5)
+# define ABDAY_7     (ABDAY_1 + 6)
+# define MON_1       10023
+# define MON_2       (MON_1 + 1)
+# define MON_3       (MON_1 + 2)
+# define MON_4       (MON_1 + 3)
+# define MON_5       (MON_1 + 4)
+# define MON_6       (MON_1 + 5)
+# define MON_7       (MON_1 + 6)
+# define MON_8       (MON_1 + 7)
+# define MON_9       (MON_1 + 8)
+# define MON_10      (MON_1 + 9)
+# define MON_11      (MON_1 + 10)
+# define MON_12      (MON_1 + 11)
+# define ALTMON_1    10200
+# define ALTMON_2    (ALTMON_1 + 1)
+# define ALTMON_3    (ALTMON_1 + 2)
+# define ALTMON_4    (ALTMON_1 + 3)
+# define ALTMON_5    (ALTMON_1 + 4)
+# define ALTMON_6    (ALTMON_1 + 5)
+# define ALTMON_7    (ALTMON_1 + 6)
+# define ALTMON_8    (ALTMON_1 + 7)
+# define ALTMON_9    (ALTMON_1 + 8)
+# define ALTMON_10   (ALTMON_1 + 9)
+# define ALTMON_11   (ALTMON_1 + 10)
+# define ALTMON_12   (ALTMON_1 + 11)
+# define ABMON_1     10035
+# define ABMON_2     (ABMON_1 + 1)
+# define ABMON_3     (ABMON_1 + 2)
+# define ABMON_4     (ABMON_1 + 3)
+# define ABMON_5     (ABMON_1 + 4)
+# define ABMON_6     (ABMON_1 + 5)
+# define ABMON_7     (ABMON_1 + 6)
+# define ABMON_8     (ABMON_1 + 7)
+# define ABMON_9     (ABMON_1 + 8)
+# define ABMON_10    (ABMON_1 + 9)
+# define ABMON_11    (ABMON_1 + 10)
+# define ABMON_12    (ABMON_1 + 11)
+# define ERA         10047
+# define ERA_D_FMT   10048
+# define ERA_D_T_FMT 10049
+# define ERA_T_FMT   10050
+# define ALT_DIGITS  10051
+/* nl_langinfo items of the LC_MONETARY category */
+# define CRNCYSTR    10052
+# define CURRENCY_SYMBOL   CRNCYSTR
+# define INT_CURR_SYMBOL   10100
+# define MON_DECIMAL_POINT 10101
+# define MON_THOUSANDS_SEP 10102
+# define MON_GROUPING      10103
+# define POSITIVE_SIGN     10104
+# define NEGATIVE_SIGN     10105
+# define FRAC_DIGITS       10106
+# define INT_FRAC_DIGITS   10107
+# define P_CS_PRECEDES     10108
+# define N_CS_PRECEDES     10109
+# define P_SEP_BY_SPACE    10110
+# define N_SEP_BY_SPACE    10111
+# define P_SIGN_POSN       10112
+# define N_SIGN_POSN       10113
+/* nl_langinfo items of the LC_MESSAGES category */
+# define YESEXPR     10053
+# define NOEXPR      10054
+
+#else
+
+/* A platform that has <langinfo.h>.  */
+
+# if !@HAVE_LANGINFO_CODESET@
+#  define CODESET     10000
+#  define GNULIB_defined_CODESET 1
+# endif
+
+# if !@HAVE_LANGINFO_T_FMT_AMPM@
+#  define T_FMT_AMPM  10006
+#  define GNULIB_defined_T_FMT_AMPM 1
+# endif
+
+# if !@HAVE_LANGINFO_ALTMON@
+#  define ALTMON_1    10200
+#  define ALTMON_2    (ALTMON_1 + 1)
+#  define ALTMON_3    (ALTMON_1 + 2)
+#  define ALTMON_4    (ALTMON_1 + 3)
+#  define ALTMON_5    (ALTMON_1 + 4)
+#  define ALTMON_6    (ALTMON_1 + 5)
+#  define ALTMON_7    (ALTMON_1 + 6)
+#  define ALTMON_8    (ALTMON_1 + 7)
+#  define ALTMON_9    (ALTMON_1 + 8)
+#  define ALTMON_10   (ALTMON_1 + 9)
+#  define ALTMON_11   (ALTMON_1 + 10)
+#  define ALTMON_12   (ALTMON_1 + 11)
+#  define GNULIB_defined_ALTMON 1
+# endif
+
+# if !@HAVE_LANGINFO_ERA@
+#  define ERA         10047
+#  define ERA_D_FMT   10048
+#  define ERA_D_T_FMT 10049
+#  define ERA_T_FMT   10050
+#  define ALT_DIGITS  10051
+#  define GNULIB_defined_ERA 1
+# endif
+
+# if !@HAVE_LANGINFO_YESEXPR@
+#  define YESEXPR     10053
+#  define NOEXPR      10054
+#  define GNULIB_defined_YESEXPR 1
+# endif
+
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* Declare overridden functions.  */
+
+
+/* Return a piece of locale dependent information.
+   Note: The difference between nl_langinfo (CODESET) and locale_charset ()
+   is that the latter normalizes the encoding names to GNU conventions.  */
+
+#if @GNULIB_NL_LANGINFO@
+# if @REPLACE_NL_LANGINFO@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef nl_langinfo
+#   define nl_langinfo rpl_nl_langinfo
+#  endif
+_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
+_GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
+# else
+#  if !@HAVE_NL_LANGINFO@
+_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
+#  endif
+_GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (nl_langinfo);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef nl_langinfo
+# if HAVE_RAW_DECL_NL_LANGINFO
+_GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
+                 "use gnulib module nl_langinfo for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_LANGINFO_H */
+#endif /* _@GUARD_PREFIX@_LANGINFO_H */
deleted file mode 120000 (symlink)
index deb9f6a72921aadf7da66eaa94cb391e069ec631..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/lc-charset-dispatch.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e2f8b2f5dec64efd4c94d4f7969d4ae8d81c05ad
--- /dev/null
@@ -0,0 +1,82 @@
+/* Dispatching based on the current locale's character encoding.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2018.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "lc-charset-dispatch.h"
+
+#if GNULIB_defined_mbstate_t
+
+# include "localcharset.h"
+# include "streq.h"
+
+# if GNULIB_WCHAR_SINGLE_LOCALE
+/* When we know that the locale does not change, provide a speedup by
+   caching the value of locale_encoding_classification.  */
+#  define locale_encoding_classification_cached locale_encoding_classification
+# else
+/* By default, don't make assumptions, hence no caching.  */
+#  define locale_encoding_classification_uncached locale_encoding_classification
+# endif
+
+# if GNULIB_WCHAR_SINGLE_LOCALE
+static inline
+# endif
+enc_t
+locale_encoding_classification_uncached (void)
+{
+  const char *encoding = locale_charset ();
+  if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+    return enc_utf8;
+  if (STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
+    return enc_eucjp;
+  if (STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
+      || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
+      || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
+    return enc_94;
+  if (STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
+    return enc_euctw;
+  if (STREQ_OPT (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
+    return enc_gb18030;
+  if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
+    return enc_sjis;
+  return enc_other;
+}
+
+# if GNULIB_WCHAR_SINGLE_LOCALE
+
+static int cached_locale_enc = -1;
+
+enc_t
+locale_encoding_classification_cached (void)
+{
+  if (cached_locale_enc < 0)
+    cached_locale_enc = locale_encoding_classification_uncached ();
+  return cached_locale_enc;
+}
+
+# endif
+
+#else
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#endif
deleted file mode 120000 (symlink)
index e9093804de7cc100c91565703e3ea781d20ea9b9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/lc-charset-dispatch.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4c1cf5f1ac638599e9e864383dbd269b19fd4eca
--- /dev/null
@@ -0,0 +1,40 @@
+/* Dispatching based on the current locale's character encoding.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2018.  */
+
+#include <wchar.h>
+
+#if GNULIB_defined_mbstate_t
+
+/* A classification of special values of the encoding of the current locale.  */
+typedef enum
+  {
+    enc_other,      /* other */
+    enc_utf8,       /* UTF-8 */
+    enc_eucjp,      /* EUC-JP */
+    enc_94,         /* EUC-KR, GB2312, BIG5 */
+    enc_euctw,      /* EUC-TW */
+    enc_gb18030,    /* GB18030 */
+    enc_sjis        /* SJIS */
+  }
+  enc_t;
+
+/* Returns a classification of special values of the encoding of the current
+   locale.  */
+extern enc_t locale_encoding_classification (void);
+
+#endif
deleted file mode 120000 (symlink)
index d6b9e9f3ce17d3608eb181a42cefe89b8775c41a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/lchmod.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8056f0b197df92d65c4918a02cf88f40aff9e9ab
--- /dev/null
@@ -0,0 +1,94 @@
+/* Implement lchmod on platforms where it does not work correctly.
+
+   Copyright 2020-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <intprops.h>
+
+/* Work like chmod, except when FILE is a symbolic link.
+   In that case, on systems where permissions on symbolic links are unsupported
+   (such as Linux), set errno to EOPNOTSUPP and return -1.  */
+
+int
+lchmod (char const *file, mode_t mode)
+{
+  char readlink_buf[1];
+
+#ifdef O_PATH
+  /* Open a file descriptor with O_NOFOLLOW, to make sure we don't
+     follow symbolic links, if /proc is mounted.  O_PATH is used to
+     avoid a failure if the file is not readable.
+     Cf. <https://sourceware.org/bugzilla/show_bug.cgi?id=14578>  */
+  int fd = open (file, O_PATH | O_NOFOLLOW | O_CLOEXEC);
+  if (fd < 0)
+    return fd;
+
+  int err;
+  if (0 <= readlinkat (fd, "", readlink_buf, sizeof readlink_buf))
+    err = EOPNOTSUPP;
+  else if (errno == EINVAL)
+    {
+      static char const fmt[] = "/proc/self/fd/%d";
+      char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
+      sprintf (buf, fmt, fd);
+      err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno;
+    }
+  else
+    err = errno == ENOENT ? -1 : errno;
+
+  close (fd);
+
+  errno = err;
+  if (0 <= err)
+    return err == 0 ? 0 : -1;
+#endif
+
+  size_t len = strlen (file);
+  if (len && file[len - 1] == '/')
+    {
+      struct stat st;
+      if (lstat (file, &st) < 0)
+        return -1;
+      if (!S_ISDIR (st.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+    }
+
+  /* O_PATH + /proc is not supported.  */
+
+  if (0 <= readlink (file, readlink_buf, sizeof readlink_buf))
+    {
+      errno = EOPNOTSUPP;
+      return -1;
+    }
+
+  /* Fall back on chmod, despite a possible race.  */
+  return chmod (file, mode);
+}
deleted file mode 120000 (symlink)
index 3444e35723d9dd0f83eb628bf8c43b8ce8dba58f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/lchown.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..03836bcb3b2f52bd2fc9ed14d857d8928880d8ef
--- /dev/null
@@ -0,0 +1,116 @@
+/* Provide a stub lchown function for systems that lack it.
+
+   Copyright (C) 1998-1999, 2002, 2004, 2006-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if !HAVE_LCHOWN
+
+/* 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 /* native Windows and some very old platforms */
+#  undef chown
+# 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 HAVE_CHOWN
+#  if ! CHOWN_MODIFIES_SYMLINK
+  char readlink_buf[1];
+
+  if (0 <= readlink (file, readlink_buf, sizeof readlink_buf))
+    {
+      errno = EOPNOTSUPP;
+      return -1;
+    }
+#  endif
+
+  return chown (file, uid, gid);
+
+# else /* !HAVE_CHOWN */
+  errno = ENOSYS;
+  return -1;
+# endif
+}
+
+#else /* HAVE_LCHOWN */
+
+# undef lchown
+
+/* Work around trailing slash bugs in lchown.  */
+int
+rpl_lchown (const char *file, uid_t uid, gid_t gid)
+{
+  bool stat_valid = false;
+  int result;
+
+# if CHOWN_CHANGE_TIME_BUG
+  struct stat st;
+
+  if (gid != (gid_t) -1 || uid != (uid_t) -1)
+    {
+      if (lstat (file, &st))
+        return -1;
+      stat_valid = true;
+      if (!S_ISLNK (st.st_mode))
+        return chown (file, uid, gid);
+    }
+# endif
+
+# if CHOWN_TRAILING_SLASH_BUG
+  if (!stat_valid)
+    {
+      size_t len = strlen (file);
+      if (len && file[len - 1] == '/')
+        return chown (file, uid, gid);
+    }
+# endif
+
+  result = lchown (file, uid, gid);
+
+# if CHOWN_CHANGE_TIME_BUG && HAVE_LCHMOD
+  if (result == 0 && stat_valid
+      && (uid == st.st_uid || uid == (uid_t) -1)
+      && (gid == st.st_gid || gid == (gid_t) -1))
+    {
+      /* No change in ownership, but at least one argument was not -1,
+         so we are required to update ctime.  Since lchown succeeded,
+         we assume that lchmod will do likewise.  But if the system
+         lacks lchmod and lutimes, we are out of luck.  Oh well.  */
+      result = lchmod (file, st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO
+                                           | S_ISUID | S_ISGID | S_ISVTX));
+    }
+# endif
+
+  return result;
+}
+
+#endif /* HAVE_LCHOWN */
deleted file mode 120000 (symlink)
index afa9389f3d4823b3bfcb0cb2234d431ac8b47071..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/ldtoastr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..210a6d68633d26de03c7d54d2ccca3503181d531
--- /dev/null
@@ -0,0 +1,19 @@
+/* Convert 'long double' to accurate string.
+
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define LENGTH 3
+#include "ftoastr.c"
deleted file mode 120000 (symlink)
index 71760b8b8bbc5bf0a3578ee88fb9ebc5755a11b7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/libc-config.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..70114608fb15aae9905f5b5f1bcff578dce0d4cb
--- /dev/null
@@ -0,0 +1,204 @@
+/* System definitions for code taken from the GNU C Library
+
+   Copyright 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this program; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* This is intended to be a good-enough substitute for glibc system
+   macros like those defined in <sys/cdefs.h>, so that Gnulib code
+   shared with glibc can do this as the first #include:
+
+     #ifndef _LIBC
+     # include <libc-config.h>
+     #endif
+
+   When compiled as part of glibc this is a no-op; when compiled as
+   part of Gnulib this includes Gnulib's <config.h> and defines macros
+   that glibc library code would normally assume.
+
+   Note: This header file MUST NOT be included by public header files
+   of Gnulib.  */
+
+#include <config.h>
+
+/* On glibc this includes <features.h> and <sys/cdefs.h> and #defines
+   _FEATURES_H, __WORDSIZE, and __set_errno.  On FreeBSD 11 and
+   DragonFlyBSD 5.9 it includes <sys/cdefs.h> which defines __nonnull.
+   Elsewhere it is harmless.  */
+#include <errno.h>
+
+/* From glibc <errno.h>.  */
+#ifndef __set_errno
+# define __set_errno(val) (errno = (val))
+#endif
+
+/* From glibc <features.h>.  */
+
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_MINOR__
+#  define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__))
+# else
+#  define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+
+#ifndef __glibc_clang_prereq
+# if defined __clang_major__ && defined __clang_minor__
+#  ifdef __apple_build_version__
+/* Apple for some reason renumbers __clang_major__ and __clang_minor__.
+   Gnulib code uses only __glibc_clang_prereq (3, 5); map it to
+   6000000 <= __apple_build_version__.  Support for other calls to
+   __glibc_clang_prereq can be added here as needed.  */
+#   define __glibc_clang_prereq(maj, min) \
+      ((maj) == 3 && (min) == 5 ? 6000000 <= __apple_build_version__ : 0)
+#  else
+#   define __glibc_clang_prereq(maj, min) \
+      ((maj) < __clang_major__ + ((min) <= __clang_minor__))
+#  endif
+# else
+#  define __glibc_clang_prereq(maj, min) 0
+# endif
+#endif
+
+#ifndef __attribute_nonnull__
+/* <sys/cdefs.h> either does not exist, or is too old for Gnulib.
+   Prepare to include <cdefs.h>, which is Gnulib's version of a
+   more-recent glibc <sys/cdefs.h>.  */
+
+/* Define _FEATURES_H so that <cdefs.h> does not include <features.h>.  */
+# ifndef _FEATURES_H
+#  define _FEATURES_H 1
+# endif
+/* Define __GNULIB_CDEFS so that <cdefs.h> does not attempt to include
+   nonexistent files.  */
+# define __GNULIB_CDEFS
+/* Undef the macros unconditionally defined by our copy of glibc
+   <sys/cdefs.h>, so that they do not clash with any system-defined
+   versions.  */
+# undef _SYS_CDEFS_H
+# undef __ASMNAME
+# undef __ASMNAME2
+# undef __BEGIN_DECLS
+# undef __CONCAT
+# undef __END_DECLS
+# undef __HAVE_GENERIC_SELECTION
+# undef __LDBL_COMPAT
+# undef __LDBL_REDIR
+# undef __LDBL_REDIR1
+# undef __LDBL_REDIR1_DECL
+# undef __LDBL_REDIR1_NTH
+# undef __LDBL_REDIR2_DECL
+# undef __LDBL_REDIR_DECL
+# undef __LDBL_REDIR_NTH
+# undef __LEAF
+# undef __LEAF_ATTR
+# undef __NTH
+# undef __NTHNL
+# undef __REDIRECT
+# undef __REDIRECT_LDBL
+# undef __REDIRECT_NTH
+# undef __REDIRECT_NTHNL
+# undef __REDIRECT_NTH_LDBL
+# undef __STRING
+# undef __THROW
+# undef __THROWNL
+# undef __attr_access
+# undef __attr_access_none
+# undef __attr_dealloc
+# undef __attr_dealloc_free
+# undef __attribute__
+# undef __attribute_alloc_align__
+# undef __attribute_alloc_size__
+# undef __attribute_artificial__
+# undef __attribute_const__
+# undef __attribute_deprecated__
+# undef __attribute_deprecated_msg__
+# undef __attribute_format_arg__
+# undef __attribute_format_strfmon__
+# undef __attribute_malloc__
+# undef __attribute_maybe_unused__
+# undef __attribute_noinline__
+# undef __attribute_nonstring__
+# undef __attribute_pure__
+# undef __attribute_returns_twice__
+# undef __attribute_used__
+# undef __attribute_warn_unused_result__
+# undef __errordecl
+# undef __extension__
+# undef __extern_always_inline
+# undef __extern_inline
+# undef __flexarr
+# undef __fortified_attr_access
+# undef __fortify_function
+# undef __glibc_c99_flexarr_available
+# undef __glibc_has_attribute
+# undef __glibc_has_builtin
+# undef __glibc_has_extension
+# undef __glibc_likely
+# undef __glibc_macro_warning
+# undef __glibc_macro_warning1
+# undef __glibc_unlikely
+# undef __inline
+# undef __ptr_t
+# undef __restrict
+# undef __restrict_arr
+# undef __va_arg_pack
+# undef __va_arg_pack_len
+# undef __warnattr
+# undef __wur
+# ifndef __GNULIB_CDEFS
+#  undef __bos
+#  undef __bos0
+#  undef __glibc_fortify
+#  undef __glibc_fortify_n
+#  undef __glibc_objsize
+#  undef __glibc_objsize0
+#  undef __glibc_safe_len_cond
+#  undef __glibc_safe_or_unknown_len
+#  undef __glibc_unsafe_len
+#  undef __glibc_unsigned_or_positive
+# endif
+
+/* Include our copy of glibc <sys/cdefs.h>.  */
+# include <cdefs.h>
+
+/* <cdefs.h> __inline is too pessimistic for non-GCC.  */
+# undef __inline
+# ifndef HAVE___INLINE
+#  if 199901 <= __STDC_VERSION__ || defined inline
+#   define __inline inline
+#  else
+#   define __inline
+#  endif
+# endif
+
+#endif /* defined __glibc_likely */
+
+
+/* A substitute for glibc <libc-symbols.h>, good enough for Gnulib.  */
+#define attribute_hidden
+#define libc_hidden_proto(name)
+#define libc_hidden_def(name)
+#define libc_hidden_weak(name)
+#define libc_hidden_ver(local, name)
+#define strong_alias(name, aliasname)
+#define weak_alias(name, aliasname)
+
+/* A substitute for glibc <shlib-compat.h>, good enough for Gnulib.  */
+#define SHLIB_COMPAT(lib, introduced, obsoleted) 0
+#define compat_symbol(lib, local, symbol, version) extern int dummy
+#define versioned_symbol(lib, local, symbol, version) extern int dummy
deleted file mode 120000 (symlink)
index ea7fd6e32f7f2b838e6d8d33fe7c7bd4979d01a9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/limits.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c65eb4c1cfeac2eabd4f778a656912ac4a2ceb14
--- /dev/null
@@ -0,0 +1,151 @@
+/* A GNU-like <limits.h>.
+
+   Copyright 2016-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined _GL_ALREADY_INCLUDING_LIMITS_H
+/* Special invocation convention:
+   On Haiku/x86_64, we have a sequence of nested includes
+   <limits.h> -> <syslimits.h> -> <limits.h>.
+   In this situation, LONG_MAX and INT_MAX are not yet defined,
+   therefore we should not attempt to define LONG_BIT.  */
+
+#@INCLUDE_NEXT@ @NEXT_LIMITS_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_LIMITS_H
+
+# define _GL_ALREADY_INCLUDING_LIMITS_H
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_LIMITS_H@
+
+# undef _GL_ALREADY_INCLUDING_LIMITS_H
+
+#ifndef _@GUARD_PREFIX@_LIMITS_H
+#define _@GUARD_PREFIX@_LIMITS_H
+
+#ifndef LLONG_MIN
+# if defined LONG_LONG_MIN /* HP-UX 11.31 */
+#  define LLONG_MIN LONG_LONG_MIN
+# elif defined LONGLONG_MIN /* IRIX 6.5 */
+#  define LLONG_MIN LONGLONG_MIN
+# elif defined __GNUC__
+#  define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL)
+# endif
+#endif
+#ifndef LLONG_MAX
+# if defined LONG_LONG_MAX /* HP-UX 11.31 */
+#  define LLONG_MAX LONG_LONG_MAX
+# elif defined LONGLONG_MAX /* IRIX 6.5 */
+#  define LLONG_MAX LONGLONG_MAX
+# elif defined __GNUC__
+#  define LLONG_MAX __LONG_LONG_MAX__
+# endif
+#endif
+#ifndef ULLONG_MAX
+# if defined ULONG_LONG_MAX /* HP-UX 11.31 */
+#  define ULLONG_MAX ULONG_LONG_MAX
+# elif defined ULONGLONG_MAX /* IRIX 6.5 */
+#  define ULLONG_MAX ULONGLONG_MAX
+# elif defined __GNUC__
+#  define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL)
+# endif
+#endif
+
+/* The number of usable bits in an unsigned or signed integer type
+   with minimum value MIN and maximum value MAX, as an int expression
+   suitable in #if.  Cover all known practical hosts.  This
+   implementation exploits the fact that MAX is 1 less than a power of
+   2, and merely counts the number of 1 bits in MAX; "COBn" means
+   "count the number of 1 bits in the low-order n bits").  */
+#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max))
+#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n))
+#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n))
+#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n))
+#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n))
+#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n))
+#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1))
+
+#ifndef WORD_BIT
+/* Assume 'int' is 32 bits wide.  */
+# define WORD_BIT 32
+#endif
+#ifndef LONG_BIT
+/* Assume 'long' is 32 or 64 bits wide.  */
+# if LONG_MAX == INT_MAX
+#  define LONG_BIT 32
+# else
+#  define LONG_BIT 64
+# endif
+#endif
+
+/* Assume no multibyte character is longer than 16 bytes.  */
+#ifndef MB_LEN_MAX
+# define MB_LEN_MAX 16
+#endif
+
+/* Macros specified by C23 and by ISO/IEC TS 18661-1:2014.  */
+
+#if (! defined ULLONG_WIDTH                                             \
+     && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__ \
+         || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__)))
+# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX)
+# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX)
+# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX)
+# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX)
+# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX)
+# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX)
+# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX)
+# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX)
+# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX)
+# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX)
+# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX)
+#endif
+
+/* Macros specified by C23.  */
+
+#if (defined _GNU_SOURCE \
+     || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))
+# if ! defined BOOL_WIDTH
+#  define BOOL_WIDTH 1
+#  define BOOL_MAX 1
+# elif ! defined BOOL_MAX
+#  define BOOL_MAX 1
+# endif
+#endif
+
+/* Macro specified by POSIX.  */
+
+/* The maximum ssize_t value.  Although it might not be of ssize_t type
+   as it should be, it's too much trouble to fix this minor detail.  */
+#ifndef SSIZE_MAX
+# ifdef _WIN64
+#  define SSIZE_MAX LLONG_MAX
+# else
+#  define SSIZE_MAX LONG_MAX
+# endif
+#endif
+
+#endif /* _@GUARD_PREFIX@_LIMITS_H */
+#endif /* _@GUARD_PREFIX@_LIMITS_H */
+#endif
deleted file mode 120000 (symlink)
index 1eb0c1f4ea0a85be0182c7fc62a3ddbb2b8cb74a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/linebuffer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3152772838842b6cef6055e94e6793ed8b422003
--- /dev/null
@@ -0,0 +1,103 @@
+/* linebuffer.c -- read arbitrarily long lines
+
+   Copyright (C) 1986, 1991, 1998-1999, 2001, 2003-2004, 2006-2007, 2009-2024
+   Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Richard Stallman. */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include "linebuffer.h"
+#include "xalloc.h"
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+/* Initialize linebuffer LINEBUFFER for use. */
+
+void
+initbuffer (struct linebuffer *linebuffer)
+{
+  memset (linebuffer, 0, sizeof *linebuffer);
+}
+
+struct linebuffer *
+readlinebuffer (struct linebuffer *linebuffer, FILE *stream)
+{
+  return readlinebuffer_delim (linebuffer, stream, '\n');
+}
+
+/* Read an arbitrarily long line of text from STREAM into LINEBUFFER.
+   Consider lines to be terminated by DELIMITER.
+   Keep the delimiter; append DELIMITER if it's the last line of a file
+   that ends in a character other than DELIMITER.  Do not NUL-terminate.
+   Therefore the stream can contain NUL bytes, and the length
+   (including the delimiter) is returned in linebuffer->length.
+   Return NULL when stream is empty.  Return NULL and set errno upon
+   error; callers can distinguish this case from the empty case by
+   invoking ferror (stream).
+   Otherwise, return LINEBUFFER.  */
+struct linebuffer *
+readlinebuffer_delim (struct linebuffer *linebuffer, FILE *stream,
+                      char delimiter)
+{
+  int c;
+  char *buffer = linebuffer->buffer;
+  char *p = linebuffer->buffer;
+  char *end = buffer + linebuffer->size; /* Sentinel. */
+
+  if (feof (stream))
+    return NULL;
+
+  do
+    {
+      c = getc (stream);
+      if (c == EOF)
+        {
+          if (p == buffer || ferror (stream))
+            return NULL;
+          if (p[-1] == delimiter)
+            break;
+          c = delimiter;
+        }
+      if (p == end)
+        {
+          idx_t oldsize = linebuffer->size;
+          buffer = xpalloc (buffer, &linebuffer->size, 1, -1, 1);
+          p = buffer + oldsize;
+          linebuffer->buffer = buffer;
+          end = buffer + linebuffer->size;
+        }
+      *p++ = c;
+    }
+  while (c != delimiter);
+
+  linebuffer->length = p - buffer;
+  return linebuffer;
+}
+
+/* Free the buffer that was allocated for linebuffer LINEBUFFER.  */
+
+void
+freebuffer (struct linebuffer *linebuffer)
+{
+  free (linebuffer->buffer);
+}
deleted file mode 120000 (symlink)
index 07fe5da585a2f801f6ce99f028ede606255648de..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/linebuffer.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ae0d55dd02610ee960679ffd883ad72fcd5bd87a
--- /dev/null
@@ -0,0 +1,54 @@
+/* linebuffer.h -- declarations for reading arbitrarily long lines
+
+   Copyright (C) 1986, 1991, 1998-1999, 2002-2003, 2007, 2009-2024 Free
+   Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if !defined LINEBUFFER_H
+# define LINEBUFFER_H
+
+# include "idx.h"
+# include <stdio.h>
+
+/* A 'struct linebuffer' holds a line of text. */
+
+struct linebuffer
+{
+  idx_t size;                  /* Allocated. */
+  idx_t length;                /* Used. */
+  char *buffer;
+};
+
+/* Initialize linebuffer LINEBUFFER for use. */
+void initbuffer (struct linebuffer *linebuffer);
+
+/* Read an arbitrarily long line of text from STREAM into LINEBUFFER.
+   Consider lines to be terminated by DELIMITER.
+   Keep the delimiter; append DELIMITER if we reach EOF and it wasn't
+   the last character in the file.  Do not NUL-terminate.
+   Return LINEBUFFER, except at end of file return NULL.  */
+struct linebuffer *readlinebuffer_delim (struct linebuffer *linebuffer,
+                                         FILE *stream, char delimiter);
+
+/* Read an arbitrarily long line of text from STREAM into LINEBUFFER.
+   Keep the newline; append a newline if it's the last line of a file
+   that ends in a non-newline character.  Do not NUL-terminate.
+   Return LINEBUFFER, except at end of file return NULL.  */
+struct linebuffer *readlinebuffer (struct linebuffer *linebuffer, FILE *stream);
+
+/* Free linebuffer LINEBUFFER and its data, all allocated with malloc. */
+void freebuffer (struct linebuffer *);
+
+#endif /* LINEBUFFER_H */
deleted file mode 120000 (symlink)
index dada378628f6f58f11b0c27b44912385e7a48ad7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/link.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..97aa6d52c2bed6df14c54f17bd31e0fe312ffdba
--- /dev/null
@@ -0,0 +1,237 @@
+/* Emulate link on platforms that lack it, namely native Windows platforms.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if !HAVE_LINK
+# if defined _WIN32 && ! defined __CYGWIN__
+
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+
+/* Don't assume that UNICODE is not defined.  */
+#  undef GetModuleHandle
+#  define GetModuleHandle GetModuleHandleA
+#  undef CreateHardLink
+#  define CreateHardLink CreateHardLinkA
+
+#  if !(_WIN32_WINNT >= _WIN32_WINNT_WINXP)
+
+/* Avoid warnings from gcc -Wcast-function-type.  */
+#   define GetProcAddress \
+     (void *) GetProcAddress
+
+/* CreateHardLink was introduced only in Windows 2000.  */
+typedef BOOL (WINAPI * CreateHardLinkFuncType) (LPCSTR lpFileName,
+                                                LPCSTR lpExistingFileName,
+                                                LPSECURITY_ATTRIBUTES lpSecurityAttributes);
+static CreateHardLinkFuncType CreateHardLinkFunc = NULL;
+static BOOL initialized = FALSE;
+
+static void
+initialize (void)
+{
+  HMODULE kernel32 = GetModuleHandle ("kernel32.dll");
+  if (kernel32 != NULL)
+    {
+      CreateHardLinkFunc =
+        (CreateHardLinkFuncType) GetProcAddress (kernel32, "CreateHardLinkA");
+    }
+  initialized = TRUE;
+}
+
+#  else
+
+#   define CreateHardLinkFunc CreateHardLink
+
+#  endif
+
+int
+link (const char *file1, const char *file2)
+{
+  char *dir;
+  size_t len1 = strlen (file1);
+  size_t len2 = strlen (file2);
+
+#  if !(_WIN32_WINNT >= _WIN32_WINNT_WINXP)
+  if (!initialized)
+    initialize ();
+#  endif
+
+  if (CreateHardLinkFunc == NULL)
+    {
+      /* System does not support hard links.  */
+      errno = EPERM;
+      return -1;
+    }
+  /* Reject trailing slashes on non-directories; native Windows does not
+     support hard-linking directories.  */
+  if ((len1 && (file1[len1 - 1] == '/' || file1[len1 - 1] == '\\'))
+      || (len2 && (file2[len2 - 1] == '/' || file2[len2 - 1] == '\\')))
+    {
+      /* If stat() fails, then link() should fail for the same reason.  */
+      struct stat st;
+      if (stat (file1, &st))
+        {
+          if (errno == EOVERFLOW)
+            /* It's surely a file, not a directory (see stat-w32.c).  */
+            errno = ENOTDIR;
+          return -1;
+        }
+      if (!S_ISDIR (st.st_mode))
+        errno = ENOTDIR;
+      else
+        errno = EPERM;
+      return -1;
+    }
+  /* CreateHardLink("b/.","a",NULL) creates file "b", so we must check
+     that dirname(file2) exists.  */
+  dir = strdup (file2);
+  if (!dir)
+    return -1;
+  {
+    struct stat st;
+    char *p = strchr (dir, '\0');
+    while (dir < p && (*--p != '/' && *p != '\\'));
+    *p = '\0';
+    if (p != dir && stat (dir, &st) != 0 && errno != EOVERFLOW)
+      {
+        free (dir);
+        return -1;
+      }
+    free (dir);
+  }
+  /* Now create the link.  */
+  if (CreateHardLinkFunc (file2, file1, NULL) == 0)
+    {
+      /* It is not documented which errors CreateHardLink() can produce.
+       * The following conversions are based on tests on a Windows XP SP2
+       * system. */
+      DWORD err = GetLastError ();
+      switch (err)
+        {
+        case ERROR_ACCESS_DENIED:
+          errno = EACCES;
+          break;
+
+        case ERROR_INVALID_FUNCTION:    /* fs does not support hard links */
+          errno = EPERM;
+          break;
+
+        case ERROR_NOT_SAME_DEVICE:
+          errno = EXDEV;
+          break;
+
+        case ERROR_PATH_NOT_FOUND:
+        case ERROR_FILE_NOT_FOUND:
+          errno = ENOENT;
+          break;
+
+        case ERROR_INVALID_PARAMETER:
+          errno = ENAMETOOLONG;
+          break;
+
+        case ERROR_TOO_MANY_LINKS:
+          errno = EMLINK;
+          break;
+
+        case ERROR_ALREADY_EXISTS:
+          errno = EEXIST;
+          break;
+
+        default:
+          errno = EIO;
+        }
+      return -1;
+    }
+
+  return 0;
+}
+
+# else /* !Windows */
+
+#  error "This platform lacks a link function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
+
+# endif /* !Windows */
+#else /* HAVE_LINK */
+
+# undef link
+
+/* Create a hard link from FILE1 to FILE2, working around platform bugs.  */
+int
+rpl_link (char const *file1, char const *file2)
+{
+  size_t len1;
+  size_t len2;
+  struct stat st;
+
+  /* Don't allow IRIX to dereference dangling file2 symlink.  */
+  if (lstat (file2, &st) == 0 || errno == EOVERFLOW)
+    {
+      errno = EEXIST;
+      return -1;
+    }
+
+  /* Reject trailing slashes on non-directories.  */
+  len1 = strlen (file1);
+  len2 = strlen (file2);
+  if ((len1 && file1[len1 - 1] == '/')
+      || (len2 && file2[len2 - 1] == '/'))
+    {
+      /* Let link() decide whether hard-linking directories is legal.
+         If stat() fails, then link() should fail for the same reason
+         (although on Solaris 9, link("file/","oops") mistakenly
+         succeeds); if stat() succeeds, require a directory.  */
+      if (stat (file1, &st))
+        return -1;
+      if (!S_ISDIR (st.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+    }
+  else
+    {
+      /* Fix Cygwin 1.5.x bug where link("a","b/.") creates file "b".  */
+      char *dir = strdup (file2);
+      char *p;
+      if (!dir)
+        return -1;
+      /* We already know file2 does not end in slash.  Strip off the
+         basename, then check that the dirname exists.  */
+      p = strrchr (dir, '/');
+      if (p)
+        {
+          *p = '\0';
+          if (stat (dir, &st) != 0 && errno != EOVERFLOW)
+            {
+              free (dir);
+              return -1;
+            }
+        }
+      free (dir);
+    }
+  return link (file1, file2);
+}
+#endif /* HAVE_LINK */
deleted file mode 120000 (symlink)
index 264201148f00976e6e665c0fe8abe78046f8a674..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/linkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7ce1f81feb119ceab87e5d77dfc2c34b51463a1f
--- /dev/null
@@ -0,0 +1,329 @@
+/* Create a hard link relative to open directories.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "areadlink.h"
+#include "dirname.h"
+#include "eloop-threshold.h"
+#include "filenamecat.h"
+#include "openat-priv.h"
+
+#if !HAVE_LINKAT || LINKAT_SYMLINK_NOTSUP
+
+/* Create a link.  If FILE1 is a symlink, either create a hardlink to
+   that symlink, or fake it by creating an identical symlink.  */
+# if LINK_FOLLOWS_SYMLINKS == 0
+#  define link_immediate link
+# else
+static int
+link_immediate (char const *file1, char const *file2)
+{
+  char *target = areadlink (file1);
+  if (target)
+    {
+      /* A symlink cannot be modified in-place.  Therefore, creating
+         an identical symlink behaves like a hard link to a symlink,
+         except for incorrect st_ino and st_nlink.  However, we must
+         be careful of EXDEV.  */
+      struct stat st1;
+      struct stat st2;
+      char *dir = mdir_name (file2);
+      if (!dir)
+        {
+          free (target);
+          errno = ENOMEM;
+          return -1;
+        }
+      if (lstat (file1, &st1) == 0 && stat (dir, &st2) == 0)
+        {
+          if (st1.st_dev == st2.st_dev)
+            {
+              int result = symlink (target, file2);
+              free (target);
+              free (dir);
+              return result;
+            }
+          free (target);
+          free (dir);
+          errno = EXDEV;
+          return -1;
+        }
+      free (target);
+      free (dir);
+    }
+  if (errno == ENOMEM)
+    return -1;
+  return link (file1, file2);
+}
+# endif /* LINK_FOLLOWS_SYMLINKS == 0 */
+
+/* Create a link.  If FILE1 is a symlink, create a hardlink to the
+   canonicalized file.  */
+# if 0 < LINK_FOLLOWS_SYMLINKS
+#  define link_follow link
+# else
+static int
+link_follow (char const *file1, char const *file2)
+{
+  char *name = (char *) file1;
+  char *target;
+  int result;
+  int i = __eloop_threshold ();
+
+  /* Using realpath or canonicalize_file_name is too heavy-handed: we
+     don't need an absolute name, and we don't need to resolve
+     intermediate symlinks, just the basename of each iteration.  */
+  while (i-- && (target = areadlink (name)))
+    {
+      if (IS_ABSOLUTE_FILE_NAME (target))
+        {
+          if (name != file1)
+            free (name);
+          name = target;
+        }
+      else
+        {
+          char *dir = mdir_name (name);
+          if (name != file1)
+            free (name);
+          if (!dir)
+            {
+              free (target);
+              errno = ENOMEM;
+              return -1;
+            }
+          name = mfile_name_concat (dir, target, NULL);
+          free (dir);
+          free (target);
+          if (!name)
+            {
+              errno = ENOMEM;
+              return -1;
+            }
+        }
+    }
+  if (i < 0)
+    {
+      target = NULL;
+      errno = ELOOP;
+    }
+  if (!target && errno != EINVAL)
+    {
+      if (name != file1)
+        free (name);
+      return -1;
+    }
+  result = link (name, file2);
+  if (name != file1)
+    free (name);
+  return result;
+}
+# endif /* 0 < LINK_FOLLOWS_SYMLINKS */
+
+/* On Solaris, link() doesn't follow symlinks by default, but does so as soon
+   as a library or executable takes part in the program that has been compiled
+   with "c99" or "cc -xc99=all" or "cc ... /usr/lib/values-xpg4.o ...".  */
+# if LINK_FOLLOWS_SYMLINKS == -1
+
+/* Reduce the penalty of link_immediate and link_follow by incorporating the
+   knowledge that link()'s behaviour depends on the __xpg4 variable.  */
+extern int __xpg4;
+
+static int
+solaris_optimized_link_immediate (char const *file1, char const *file2)
+{
+  if (__xpg4 == 0)
+    return link (file1, file2);
+  return link_immediate (file1, file2);
+}
+
+static int
+solaris_optimized_link_follow (char const *file1, char const *file2)
+{
+  if (__xpg4 != 0)
+    return link (file1, file2);
+  return link_follow (file1, file2);
+}
+
+#  define link_immediate solaris_optimized_link_immediate
+#  define link_follow solaris_optimized_link_follow
+
+# endif
+
+#endif /* !HAVE_LINKAT || LINKAT_SYMLINK_NOTSUP  */
+
+#if !HAVE_LINKAT
+
+/* Create a link to FILE1, in the directory open on descriptor FD1, to FILE2,
+   in the directory open on descriptor FD2.  If FILE1 is a symlink, FLAG
+   controls whether to dereference FILE1 first.  If possible, do it without
+   changing the working directory.  Otherwise, resort to using
+   save_cwd/fchdir, then rename/restore_cwd.  If either the save_cwd or
+   the restore_cwd fails, then give a diagnostic and exit nonzero.  */
+
+int
+linkat (int fd1, char const *file1, int fd2, char const *file2, int flag)
+{
+  if (flag & ~AT_SYMLINK_FOLLOW)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  return at_func2 (fd1, file1, fd2, file2,
+                   flag ? link_follow : link_immediate);
+}
+
+#else /* HAVE_LINKAT */
+
+# undef linkat
+
+/* Create a link.  If FILE1 is a symlink, create a hardlink to the
+   canonicalized file.  */
+
+static int
+linkat_follow (int fd1, char const *file1, int fd2, char const *file2)
+{
+  char *name = (char *) file1;
+  char *target;
+  int result;
+  int i = __eloop_threshold ();
+
+  /* There is no realpathat.  */
+  while (i-- && (target = areadlinkat (fd1, name)))
+    {
+      if (IS_ABSOLUTE_FILE_NAME (target))
+        {
+          if (name != file1)
+            free (name);
+          name = target;
+        }
+      else
+        {
+          char *dir = mdir_name (name);
+          if (name != file1)
+            free (name);
+          if (!dir)
+            {
+              free (target);
+              errno = ENOMEM;
+              return -1;
+            }
+          name = mfile_name_concat (dir, target, NULL);
+          free (dir);
+          free (target);
+          if (!name)
+            {
+              errno = ENOMEM;
+              return -1;
+            }
+        }
+    }
+  if (i < 0)
+    {
+      target = NULL;
+      errno = ELOOP;
+    }
+  if (!target && errno != EINVAL)
+    {
+      if (name != file1)
+        free (name);
+      return -1;
+    }
+  result = linkat (fd1, name, fd2, file2, 0);
+  if (name != file1)
+    free (name);
+  return result;
+}
+
+
+/* Like linkat, but guarantee that AT_SYMLINK_FOLLOW works even on
+   older Linux kernels.  */
+
+int
+rpl_linkat (int fd1, char const *file1, int fd2, char const *file2, int flag)
+{
+  if (flag & ~AT_SYMLINK_FOLLOW)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+# if LINKAT_TRAILING_SLASH_BUG
+  /* Reject trailing slashes on non-directories.  */
+  {
+    size_t len1 = strlen (file1);
+    size_t len2 = strlen (file2);
+    if ((len1 && file1[len1 - 1] == '/')
+        || (len2 && file2[len2 - 1] == '/'))
+      {
+        /* Let linkat() decide whether hard-linking directories is legal.
+           If fstatat() fails, then linkat() should fail for the same reason;
+           if fstatat() succeeds, require a directory.  */
+        struct stat st;
+        if (fstatat (fd1, file1, &st, flag ? 0 : AT_SYMLINK_NOFOLLOW))
+          return -1;
+        if (!S_ISDIR (st.st_mode))
+          {
+            errno = ENOTDIR;
+            return -1;
+          }
+      }
+  }
+# endif
+
+  if (!flag)
+    {
+      int result = linkat (fd1, file1, fd2, file2, flag);
+# if LINKAT_SYMLINK_NOTSUP
+      /* OS X 10.10 has linkat() but it doesn't support
+         hardlinks to symlinks.  Fallback to our emulation
+         in that case.  */
+      if (result == -1 && (errno == ENOTSUP || errno == EOPNOTSUPP))
+        return at_func2 (fd1, file1, fd2, file2, link_immediate);
+# endif
+      return result;
+    }
+
+  /* Cache the information on whether the system call really works.  */
+  {
+    static int have_follow_really; /* 0 = unknown, 1 = yes, -1 = no */
+    if (0 <= have_follow_really)
+    {
+      int result = linkat (fd1, file1, fd2, file2, flag);
+      if (!(result == -1 && errno == EINVAL))
+        {
+          have_follow_really = 1;
+          return result;
+        }
+      have_follow_really = -1;
+    }
+  }
+  return linkat_follow (fd1, file1, fd2, file2);
+}
+
+#endif /* HAVE_LINKAT */
deleted file mode 120000 (symlink)
index 530cbf607ab66a98641dc30f14f3cb2448bbe03d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/localcharset.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..93c4baa471485f02d4ebab1a04890c485271bcf3
--- /dev/null
+/* Determine a canonical name for the current locale's character encoding.
+
+   Copyright (C) 2000-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "localcharset.h"
+
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
+# define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# define WINDOWS_NATIVE
+# include <locale.h>
+#endif
+
+#if defined __EMX__
+/* Assume EMX program runs on OS/2, even if compiled under DOS.  */
+# ifndef OS2
+#  define OS2
+# endif
+#endif
+
+#if !defined WINDOWS_NATIVE
+# if HAVE_LANGINFO_CODESET
+#  include <langinfo.h>
+# else
+#  if 0 /* see comment regarding use of setlocale(), below */
+#   include <locale.h>
+#  endif
+# endif
+# ifdef __CYGWIN__
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+# endif
+#elif defined WINDOWS_NATIVE
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+  /* For the use of setlocale() below, the Gnulib override in setlocale.c is
+     not needed; see the platform lists in setlocale_null.m4.  */
+# undef setlocale
+#endif
+#if defined OS2
+# define INCL_DOS
+# include <os2.h>
+#endif
+
+/* For MB_CUR_MAX_L */
+#if defined DARWIN7
+# include <xlocale.h>
+#endif
+
+
+#if HAVE_LANGINFO_CODESET || defined WINDOWS_NATIVE || defined OS2
+
+/* On these platforms, we use a mapping from non-canonical encoding name
+   to GNU canonical encoding name.  */
+
+/* With glibc-2.1 or newer, we don't need any canonicalization,
+   because glibc has iconv and both glibc and libiconv support all
+   GNU canonical names directly.  */
+# if !((defined __GNU_LIBRARY__ && __GLIBC__ >= 2) || defined __UCLIBC__)
+
+struct table_entry
+{
+  const char alias[11+1];
+  const char canonical[11+1];
+};
+
+/* Table of platform-dependent mappings, sorted in ascending order.  */
+static const struct table_entry alias_table[] =
+  {
+#  if defined __FreeBSD__                                   /* FreeBSD */
+  /*{ "ARMSCII-8",  "ARMSCII-8" },*/
+    { "Big5",       "BIG5" },
+    { "C",          "ASCII" },
+  /*{ "CP1131",     "CP1131" },*/
+  /*{ "CP1251",     "CP1251" },*/
+  /*{ "CP866",      "CP866" },*/
+  /*{ "GB18030",    "GB18030" },*/
+  /*{ "GB2312",     "GB2312" },*/
+  /*{ "GBK",        "GBK" },*/
+  /*{ "ISCII-DEV",  "?" },*/
+    { "ISO8859-1",  "ISO-8859-1" },
+    { "ISO8859-13", "ISO-8859-13" },
+    { "ISO8859-15", "ISO-8859-15" },
+    { "ISO8859-2",  "ISO-8859-2" },
+    { "ISO8859-5",  "ISO-8859-5" },
+    { "ISO8859-7",  "ISO-8859-7" },
+    { "ISO8859-9",  "ISO-8859-9" },
+  /*{ "KOI8-R",     "KOI8-R" },*/
+  /*{ "KOI8-U",     "KOI8-U" },*/
+    { "SJIS",       "SHIFT_JIS" },
+    { "US-ASCII",   "ASCII" },
+    { "eucCN",      "GB2312" },
+    { "eucJP",      "EUC-JP" },
+    { "eucKR",      "EUC-KR" }
+#   define alias_table_defined
+#  endif
+#  if defined __NetBSD__                                    /* NetBSD */
+    { "646",        "ASCII" },
+  /*{ "ARMSCII-8",  "ARMSCII-8" },*/
+  /*{ "BIG5",       "BIG5" },*/
+    { "Big5-HKSCS", "BIG5-HKSCS" },
+  /*{ "CP1251",     "CP1251" },*/
+  /*{ "CP866",      "CP866" },*/
+  /*{ "GB18030",    "GB18030" },*/
+  /*{ "GB2312",     "GB2312" },*/
+    { "ISO8859-1",  "ISO-8859-1" },
+    { "ISO8859-13", "ISO-8859-13" },
+    { "ISO8859-15", "ISO-8859-15" },
+    { "ISO8859-2",  "ISO-8859-2" },
+    { "ISO8859-4",  "ISO-8859-4" },
+    { "ISO8859-5",  "ISO-8859-5" },
+    { "ISO8859-7",  "ISO-8859-7" },
+  /*{ "KOI8-R",     "KOI8-R" },*/
+  /*{ "KOI8-U",     "KOI8-U" },*/
+  /*{ "PT154",      "PT154" },*/
+    { "SJIS",       "SHIFT_JIS" },
+    { "eucCN",      "GB2312" },
+    { "eucJP",      "EUC-JP" },
+    { "eucKR",      "EUC-KR" },
+    { "eucTW",      "EUC-TW" }
+#   define alias_table_defined
+#  endif
+#  if defined __OpenBSD__                                   /* OpenBSD */
+    { "646",        "ASCII" },
+    { "ISO8859-1",  "ISO-8859-1" },
+    { "ISO8859-13", "ISO-8859-13" },
+    { "ISO8859-15", "ISO-8859-15" },
+    { "ISO8859-2",  "ISO-8859-2" },
+    { "ISO8859-4",  "ISO-8859-4" },
+    { "ISO8859-5",  "ISO-8859-5" },
+    { "ISO8859-7",  "ISO-8859-7" },
+    { "US-ASCII",   "ASCII" }
+#   define alias_table_defined
+#  endif
+#  if defined __APPLE__ && defined __MACH__                 /* Mac OS X */
+    /* Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is
+       useless:
+       - It returns the empty string when LANG is set to a locale of the
+         form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
+         LC_CTYPE file.
+       - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
+         the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
+       - The documentation says:
+           "... all code that calls BSD system routines should ensure
+            that the const *char parameters of these routines are in UTF-8
+            encoding. All BSD system functions expect their string
+            parameters to be in UTF-8 encoding and nothing else."
+         It also says
+           "An additional caveat is that string parameters for files,
+            paths, and other file-system entities must be in canonical
+            UTF-8. In a canonical UTF-8 Unicode string, all decomposable
+            characters are decomposed ..."
+         but this is not true: You can pass non-decomposed UTF-8 strings
+         to file system functions, and it is the OS which will convert
+         them to decomposed UTF-8 before accessing the file system.
+       - The Apple Terminal application displays UTF-8 by default.
+       - However, other applications are free to use different encodings:
+         - xterm uses ISO-8859-1 by default.
+         - TextEdit uses MacRoman by default.
+       We prefer UTF-8 over decomposed UTF-8-MAC because one should
+       minimize the use of decomposed Unicode. Unfortunately, through the
+       Darwin file system, decomposed UTF-8 strings are leaked into user
+       space nevertheless.
+       Then there are also the locales with encodings other than US-ASCII
+       and UTF-8. These locales can be occasionally useful to users (e.g.
+       when grepping through ISO-8859-1 encoded text files), when all their
+       file names are in US-ASCII.
+     */
+    { "ARMSCII-8",  "ARMSCII-8" },
+    { "Big5",       "BIG5" },
+    { "Big5HKSCS",  "BIG5-HKSCS" },
+    { "CP1131",     "CP1131" },
+    { "CP1251",     "CP1251" },
+    { "CP866",      "CP866" },
+    { "CP949",      "CP949" },
+    { "GB18030",    "GB18030" },
+    { "GB2312",     "GB2312" },
+    { "GBK",        "GBK" },
+  /*{ "ISCII-DEV",  "?" },*/
+    { "ISO8859-1",  "ISO-8859-1" },
+    { "ISO8859-13", "ISO-8859-13" },
+    { "ISO8859-15", "ISO-8859-15" },
+    { "ISO8859-2",  "ISO-8859-2" },
+    { "ISO8859-4",  "ISO-8859-4" },
+    { "ISO8859-5",  "ISO-8859-5" },
+    { "ISO8859-7",  "ISO-8859-7" },
+    { "ISO8859-9",  "ISO-8859-9" },
+    { "KOI8-R",     "KOI8-R" },
+    { "KOI8-U",     "KOI8-U" },
+    { "PT154",      "PT154" },
+    { "SJIS",       "SHIFT_JIS" },
+    { "eucCN",      "GB2312" },
+    { "eucJP",      "EUC-JP" },
+    { "eucKR",      "EUC-KR" }
+#   define alias_table_defined
+#  endif
+#  if defined _AIX                                          /* AIX */
+  /*{ "GBK",        "GBK" },*/
+    { "IBM-1046",   "CP1046" },
+    { "IBM-1124",   "CP1124" },
+    { "IBM-1129",   "CP1129" },
+    { "IBM-1252",   "CP1252" },
+    { "IBM-850",    "CP850" },
+    { "IBM-856",    "CP856" },
+    { "IBM-921",    "ISO-8859-13" },
+    { "IBM-922",    "CP922" },
+    { "IBM-932",    "CP932" },
+    { "IBM-943",    "CP943" },
+    { "IBM-eucCN",  "GB2312" },
+    { "IBM-eucJP",  "EUC-JP" },
+    { "IBM-eucKR",  "EUC-KR" },
+    { "IBM-eucTW",  "EUC-TW" },
+    { "ISO8859-1",  "ISO-8859-1" },
+    { "ISO8859-15", "ISO-8859-15" },
+    { "ISO8859-2",  "ISO-8859-2" },
+    { "ISO8859-5",  "ISO-8859-5" },
+    { "ISO8859-6",  "ISO-8859-6" },
+    { "ISO8859-7",  "ISO-8859-7" },
+    { "ISO8859-8",  "ISO-8859-8" },
+    { "ISO8859-9",  "ISO-8859-9" },
+    { "TIS-620",    "TIS-620" },
+  /*{ "UTF-8",      "UTF-8" },*/
+    { "big5",       "BIG5" }
+#   define alias_table_defined
+#  endif
+#  if defined __hpux                                        /* HP-UX */
+    { "SJIS",      "SHIFT_JIS" },
+    { "arabic8",   "HP-ARABIC8" },
+    { "big5",      "BIG5" },
+    { "cp1251",    "CP1251" },
+    { "eucJP",     "EUC-JP" },
+    { "eucKR",     "EUC-KR" },
+    { "eucTW",     "EUC-TW" },
+    { "gb18030",   "GB18030" },
+    { "greek8",    "HP-GREEK8" },
+    { "hebrew8",   "HP-HEBREW8" },
+    { "hkbig5",    "BIG5-HKSCS" },
+    { "hp15CN",    "GB2312" },
+    { "iso88591",  "ISO-8859-1" },
+    { "iso885913", "ISO-8859-13" },
+    { "iso885915", "ISO-8859-15" },
+    { "iso88592",  "ISO-8859-2" },
+    { "iso88594",  "ISO-8859-4" },
+    { "iso88595",  "ISO-8859-5" },
+    { "iso88596",  "ISO-8859-6" },
+    { "iso88597",  "ISO-8859-7" },
+    { "iso88598",  "ISO-8859-8" },
+    { "iso88599",  "ISO-8859-9" },
+    { "kana8",     "HP-KANA8" },
+    { "koi8r",     "KOI8-R" },
+    { "roman8",    "HP-ROMAN8" },
+    { "tis620",    "TIS-620" },
+    { "turkish8",  "HP-TURKISH8" },
+    { "utf8",      "UTF-8" }
+#   define alias_table_defined
+#  endif
+#  if defined __sgi                                         /* IRIX */
+    { "ISO8859-1",  "ISO-8859-1" },
+    { "ISO8859-15", "ISO-8859-15" },
+    { "ISO8859-2",  "ISO-8859-2" },
+    { "ISO8859-5",  "ISO-8859-5" },
+    { "ISO8859-7",  "ISO-8859-7" },
+    { "ISO8859-9",  "ISO-8859-9" },
+    { "eucCN",      "GB2312" },
+    { "eucJP",      "EUC-JP" },
+    { "eucKR",      "EUC-KR" },
+    { "eucTW",      "EUC-TW" }
+#   define alias_table_defined
+#  endif
+#  if defined __osf__                                       /* OSF/1 */
+  /*{ "GBK",        "GBK" },*/
+    { "ISO8859-1",  "ISO-8859-1" },
+    { "ISO8859-15", "ISO-8859-15" },
+    { "ISO8859-2",  "ISO-8859-2" },
+    { "ISO8859-4",  "ISO-8859-4" },
+    { "ISO8859-5",  "ISO-8859-5" },
+    { "ISO8859-7",  "ISO-8859-7" },
+    { "ISO8859-8",  "ISO-8859-8" },
+    { "ISO8859-9",  "ISO-8859-9" },
+    { "KSC5601",    "CP949" },
+    { "SJIS",       "SHIFT_JIS" },
+    { "TACTIS",     "TIS-620" },
+  /*{ "UTF-8",      "UTF-8" },*/
+    { "big5",       "BIG5" },
+    { "cp850",      "CP850" },
+    { "dechanyu",   "DEC-HANYU" },
+    { "dechanzi",   "GB2312" },
+    { "deckanji",   "DEC-KANJI" },
+    { "deckorean",  "EUC-KR" },
+    { "eucJP",      "EUC-JP" },
+    { "eucKR",      "EUC-KR" },
+    { "eucTW",      "EUC-TW" },
+    { "sdeckanji",  "EUC-JP" }
+#   define alias_table_defined
+#  endif
+#  if defined __sun                                         /* Solaris */
+    { "5601",        "EUC-KR" },
+    { "646",         "ASCII" },
+  /*{ "BIG5",        "BIG5" },*/
+    { "Big5-HKSCS",  "BIG5-HKSCS" },
+    { "GB18030",     "GB18030" },
+  /*{ "GBK",         "GBK" },*/
+    { "ISO8859-1",   "ISO-8859-1" },
+    { "ISO8859-11",  "TIS-620" },
+    { "ISO8859-13",  "ISO-8859-13" },
+    { "ISO8859-15",  "ISO-8859-15" },
+    { "ISO8859-2",   "ISO-8859-2" },
+    { "ISO8859-3",   "ISO-8859-3" },
+    { "ISO8859-4",   "ISO-8859-4" },
+    { "ISO8859-5",   "ISO-8859-5" },
+    { "ISO8859-6",   "ISO-8859-6" },
+    { "ISO8859-7",   "ISO-8859-7" },
+    { "ISO8859-8",   "ISO-8859-8" },
+    { "ISO8859-9",   "ISO-8859-9" },
+    { "PCK",         "SHIFT_JIS" },
+    { "TIS620.2533", "TIS-620" },
+  /*{ "UTF-8",       "UTF-8" },*/
+    { "ansi-1251",   "CP1251" },
+    { "cns11643",    "EUC-TW" },
+    { "eucJP",       "EUC-JP" },
+    { "gb2312",      "GB2312" },
+    { "koi8-r",      "KOI8-R" }
+#   define alias_table_defined
+#  endif
+#  if defined __minix                                       /* Minix */
+    { "646", "ASCII" }
+#   define alias_table_defined
+#  endif
+#  if defined WINDOWS_NATIVE || defined __CYGWIN__          /* Windows */
+    { "CP1361",  "JOHAB" },
+    { "CP20127", "ASCII" },
+    { "CP20866", "KOI8-R" },
+    { "CP20936", "GB2312" },
+    { "CP21866", "KOI8-RU" },
+    { "CP28591", "ISO-8859-1" },
+    { "CP28592", "ISO-8859-2" },
+    { "CP28593", "ISO-8859-3" },
+    { "CP28594", "ISO-8859-4" },
+    { "CP28595", "ISO-8859-5" },
+    { "CP28596", "ISO-8859-6" },
+    { "CP28597", "ISO-8859-7" },
+    { "CP28598", "ISO-8859-8" },
+    { "CP28599", "ISO-8859-9" },
+    { "CP28605", "ISO-8859-15" },
+    { "CP38598", "ISO-8859-8" },
+    { "CP51932", "EUC-JP" },
+    { "CP51936", "GB2312" },
+    { "CP51949", "EUC-KR" },
+    { "CP51950", "EUC-TW" },
+    { "CP54936", "GB18030" },
+    { "CP65001", "UTF-8" },
+    { "CP936",   "GBK" }
+#   define alias_table_defined
+#  endif
+#  if defined OS2                                           /* OS/2 */
+    /* The list of encodings is taken from "List of OS/2 Codepages"
+       by Alex Taylor:
+       <http://altsan.org/os2/toolkits/uls/index.html#codepages>.
+       See also "__convcp() of kLIBC":
+       <https://github.com/bitwiseworks/libc/blob/master/src/emx/src/lib/locale/__convcp.c>.  */
+    { "CP1004",        "CP1252" },
+  /*{ "CP1041",        "CP943" },*/
+  /*{ "CP1088",        "CP949" },*/
+    { "CP1089",        "ISO-8859-6" },
+  /*{ "CP1114",        "CP950" },*/
+  /*{ "CP1115",        "GB2312" },*/
+    { "CP1208",        "UTF-8" },
+  /*{ "CP1380",        "GB2312" },*/
+    { "CP1381",        "GB2312" },
+    { "CP1383",        "GB2312" },
+    { "CP1386",        "GBK" },
+  /*{ "CP301",         "CP943" },*/
+    { "CP3372",        "EUC-JP" },
+    { "CP4946",        "CP850" },
+  /*{ "CP5048",        "JIS_X0208-1990" },*/
+  /*{ "CP5049",        "JIS_X0212-1990" },*/
+  /*{ "CP5067",        "KS_C_5601-1987" },*/
+    { "CP813",         "ISO-8859-7" },
+    { "CP819",         "ISO-8859-1" },
+    { "CP878",         "KOI8-R" },
+  /*{ "CP897",         "CP943" },*/
+    { "CP912",         "ISO-8859-2" },
+    { "CP913",         "ISO-8859-3" },
+    { "CP914",         "ISO-8859-4" },
+    { "CP915",         "ISO-8859-5" },
+    { "CP916",         "ISO-8859-8" },
+    { "CP920",         "ISO-8859-9" },
+    { "CP921",         "ISO-8859-13" },
+    { "CP923",         "ISO-8859-15" },
+  /*{ "CP941",         "CP943" },*/
+  /*{ "CP947",         "CP950" },*/
+  /*{ "CP951",         "CP949" },*/
+  /*{ "CP952",         "JIS_X0208-1990" },*/
+  /*{ "CP953",         "JIS_X0212-1990" },*/
+    { "CP954",         "EUC-JP" },
+    { "CP964",         "EUC-TW" },
+    { "CP970",         "EUC-KR" },
+  /*{ "CP971",         "KS_C_5601-1987" },*/
+    { "IBM-1004",      "CP1252" },
+  /*{ "IBM-1006",      "?" },*/
+  /*{ "IBM-1008",      "?" },*/
+  /*{ "IBM-1041",      "CP943" },*/
+  /*{ "IBM-1051",      "?" },*/
+  /*{ "IBM-1088",      "CP949" },*/
+    { "IBM-1089",      "ISO-8859-6" },
+  /*{ "IBM-1098",      "?" },*/
+  /*{ "IBM-1114",      "CP950" },*/
+  /*{ "IBM-1115",      "GB2312" },*/
+  /*{ "IBM-1116",      "?" },*/
+  /*{ "IBM-1117",      "?" },*/
+  /*{ "IBM-1118",      "?" },*/
+  /*{ "IBM-1119",      "?" },*/
+    { "IBM-1124",      "CP1124" },
+    { "IBM-1125",      "CP1125" },
+    { "IBM-1131",      "CP1131" },
+    { "IBM-1208",      "UTF-8" },
+    { "IBM-1250",      "CP1250" },
+    { "IBM-1251",      "CP1251" },
+    { "IBM-1252",      "CP1252" },
+    { "IBM-1253",      "CP1253" },
+    { "IBM-1254",      "CP1254" },
+    { "IBM-1255",      "CP1255" },
+    { "IBM-1256",      "CP1256" },
+    { "IBM-1257",      "CP1257" },
+  /*{ "IBM-1275",      "?" },*/
+  /*{ "IBM-1276",      "?" },*/
+  /*{ "IBM-1277",      "?" },*/
+  /*{ "IBM-1280",      "?" },*/
+  /*{ "IBM-1281",      "?" },*/
+  /*{ "IBM-1282",      "?" },*/
+  /*{ "IBM-1283",      "?" },*/
+  /*{ "IBM-1380",      "GB2312" },*/
+    { "IBM-1381",      "GB2312" },
+    { "IBM-1383",      "GB2312" },
+    { "IBM-1386",      "GBK" },
+  /*{ "IBM-301",       "CP943" },*/
+    { "IBM-3372",      "EUC-JP" },
+    { "IBM-367",       "ASCII" },
+    { "IBM-437",       "CP437" },
+    { "IBM-4946",      "CP850" },
+  /*{ "IBM-5048",      "JIS_X0208-1990" },*/
+  /*{ "IBM-5049",      "JIS_X0212-1990" },*/
+  /*{ "IBM-5067",      "KS_C_5601-1987" },*/
+    { "IBM-813",       "ISO-8859-7" },
+    { "IBM-819",       "ISO-8859-1" },
+    { "IBM-850",       "CP850" },
+  /*{ "IBM-851",       "?" },*/
+    { "IBM-852",       "CP852" },
+    { "IBM-855",       "CP855" },
+    { "IBM-856",       "CP856" },
+    { "IBM-857",       "CP857" },
+  /*{ "IBM-859",       "?" },*/
+    { "IBM-860",       "CP860" },
+    { "IBM-861",       "CP861" },
+    { "IBM-862",       "CP862" },
+    { "IBM-863",       "CP863" },
+    { "IBM-864",       "CP864" },
+    { "IBM-865",       "CP865" },
+    { "IBM-866",       "CP866" },
+  /*{ "IBM-868",       "?" },*/
+    { "IBM-869",       "CP869" },
+    { "IBM-874",       "CP874" },
+    { "IBM-878",       "KOI8-R" },
+  /*{ "IBM-895",       "?" },*/
+  /*{ "IBM-897",       "CP943" },*/
+  /*{ "IBM-907",       "?" },*/
+  /*{ "IBM-909",       "?" },*/
+    { "IBM-912",       "ISO-8859-2" },
+    { "IBM-913",       "ISO-8859-3" },
+    { "IBM-914",       "ISO-8859-4" },
+    { "IBM-915",       "ISO-8859-5" },
+    { "IBM-916",       "ISO-8859-8" },
+    { "IBM-920",       "ISO-8859-9" },
+    { "IBM-921",       "ISO-8859-13" },
+    { "IBM-922",       "CP922" },
+    { "IBM-923",       "ISO-8859-15" },
+    { "IBM-932",       "CP932" },
+  /*{ "IBM-941",       "CP943" },*/
+  /*{ "IBM-942",       "?" },*/
+    { "IBM-943",       "CP943" },
+  /*{ "IBM-947",       "CP950" },*/
+    { "IBM-949",       "CP949" },
+    { "IBM-950",       "CP950" },
+  /*{ "IBM-951",       "CP949" },*/
+  /*{ "IBM-952",       "JIS_X0208-1990" },*/
+  /*{ "IBM-953",       "JIS_X0212-1990" },*/
+    { "IBM-954",       "EUC-JP" },
+  /*{ "IBM-955",       "?" },*/
+    { "IBM-964",       "EUC-TW" },
+    { "IBM-970",       "EUC-KR" },
+  /*{ "IBM-971",       "KS_C_5601-1987" },*/
+    { "IBM-eucCN",     "GB2312" },
+    { "IBM-eucJP",     "EUC-JP" },
+    { "IBM-eucKR",     "EUC-KR" },
+    { "IBM-eucTW",     "EUC-TW" },
+    { "IBM33722",      "EUC-JP" },
+    { "ISO8859-1",     "ISO-8859-1" },
+    { "ISO8859-2",     "ISO-8859-2" },
+    { "ISO8859-3",     "ISO-8859-3" },
+    { "ISO8859-4",     "ISO-8859-4" },
+    { "ISO8859-5",     "ISO-8859-5" },
+    { "ISO8859-6",     "ISO-8859-6" },
+    { "ISO8859-7",     "ISO-8859-7" },
+    { "ISO8859-8",     "ISO-8859-8" },
+    { "ISO8859-9",     "ISO-8859-9" },
+  /*{ "JISX0201-1976", "JISX0201-1976" },*/
+  /*{ "JISX0208-1978", "?" },*/
+  /*{ "JISX0208-1983", "JIS_X0208-1983" },*/
+  /*{ "JISX0208-1990", "JIS_X0208-1990" },*/
+  /*{ "JISX0212-1990", "JIS_X0212-1990" },*/
+  /*{ "KSC5601-1987",  "KS_C_5601-1987" },*/
+    { "SJIS-1",        "CP943" },
+    { "SJIS-2",        "CP943" },
+    { "eucJP",         "EUC-JP" },
+    { "eucKR",         "EUC-KR" },
+    { "eucTW-1993",    "EUC-TW" }
+#   define alias_table_defined
+#  endif
+#  if defined VMS                                           /* OpenVMS */
+    /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
+       "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
+       section 10.7 "Handling Different Character Sets".  */
+    { "DECHANYU",  "DEC-HANYU" },
+    { "DECHANZI",  "GB2312" },
+    { "DECKANJI",  "DEC-KANJI" },
+    { "DECKOREAN", "EUC-KR" },
+    { "ISO8859-1", "ISO-8859-1" },
+    { "ISO8859-2", "ISO-8859-2" },
+    { "ISO8859-5", "ISO-8859-5" },
+    { "ISO8859-7", "ISO-8859-7" },
+    { "ISO8859-8", "ISO-8859-8" },
+    { "ISO8859-9", "ISO-8859-9" },
+    { "SDECKANJI", "EUC-JP" },
+    { "SJIS",      "SHIFT_JIS" },
+    { "eucJP",     "EUC-JP" },
+    { "eucTW",     "EUC-TW" }
+#   define alias_table_defined
+#  endif
+#  ifndef alias_table_defined
+    /* Just a dummy entry, to avoid a C syntax error.  */
+    { "", "" }
+#  endif
+  };
+
+# endif
+
+#else
+
+/* On these platforms, we use a mapping from locale name to GNU canonical
+   encoding name.  */
+
+struct table_entry
+{
+  const char locale[17+1];
+  const char canonical[11+1];
+};
+
+/* Table of platform-dependent mappings, sorted in ascending order.  */
+static const struct table_entry locale_table[] =
+  {
+# if defined __FreeBSD__                                    /* FreeBSD 4.2 */
+    { "cs_CZ.ISO_8859-2",  "ISO-8859-2" },
+    { "da_DK.DIS_8859-15", "ISO-8859-15" },
+    { "da_DK.ISO_8859-1",  "ISO-8859-1" },
+    { "de_AT.DIS_8859-15", "ISO-8859-15" },
+    { "de_AT.ISO_8859-1",  "ISO-8859-1" },
+    { "de_CH.DIS_8859-15", "ISO-8859-15" },
+    { "de_CH.ISO_8859-1",  "ISO-8859-1" },
+    { "de_DE.DIS_8859-15", "ISO-8859-15" },
+    { "de_DE.ISO_8859-1",  "ISO-8859-1" },
+    { "en_AU.DIS_8859-15", "ISO-8859-15" },
+    { "en_AU.ISO_8859-1",  "ISO-8859-1" },
+    { "en_CA.DIS_8859-15", "ISO-8859-15" },
+    { "en_CA.ISO_8859-1",  "ISO-8859-1" },
+    { "en_GB.DIS_8859-15", "ISO-8859-15" },
+    { "en_GB.ISO_8859-1",  "ISO-8859-1" },
+    { "en_US.DIS_8859-15", "ISO-8859-15" },
+    { "en_US.ISO_8859-1",  "ISO-8859-1" },
+    { "es_ES.DIS_8859-15", "ISO-8859-15" },
+    { "es_ES.ISO_8859-1",  "ISO-8859-1" },
+    { "fi_FI.DIS_8859-15", "ISO-8859-15" },
+    { "fi_FI.ISO_8859-1",  "ISO-8859-1" },
+    { "fr_BE.DIS_8859-15", "ISO-8859-15" },
+    { "fr_BE.ISO_8859-1",  "ISO-8859-1" },
+    { "fr_CA.DIS_8859-15", "ISO-8859-15" },
+    { "fr_CA.ISO_8859-1",  "ISO-8859-1" },
+    { "fr_CH.DIS_8859-15", "ISO-8859-15" },
+    { "fr_CH.ISO_8859-1",  "ISO-8859-1" },
+    { "fr_FR.DIS_8859-15", "ISO-8859-15" },
+    { "fr_FR.ISO_8859-1",  "ISO-8859-1" },
+    { "hr_HR.ISO_8859-2",  "ISO-8859-2" },
+    { "hu_HU.ISO_8859-2",  "ISO-8859-2" },
+    { "is_IS.DIS_8859-15", "ISO-8859-15" },
+    { "is_IS.ISO_8859-1",  "ISO-8859-1" },
+    { "it_CH.DIS_8859-15", "ISO-8859-15" },
+    { "it_CH.ISO_8859-1",  "ISO-8859-1" },
+    { "it_IT.DIS_8859-15", "ISO-8859-15" },
+    { "it_IT.ISO_8859-1",  "ISO-8859-1" },
+    { "ja_JP.EUC",         "EUC-JP" },
+    { "ja_JP.SJIS",        "SHIFT_JIS" },
+    { "ja_JP.Shift_JIS",   "SHIFT_JIS" },
+    { "ko_KR.EUC",         "EUC-KR" },
+    { "la_LN.ASCII",       "ASCII" },
+    { "la_LN.DIS_8859-15", "ISO-8859-15" },
+    { "la_LN.ISO_8859-1",  "ISO-8859-1" },
+    { "la_LN.ISO_8859-2",  "ISO-8859-2" },
+    { "la_LN.ISO_8859-4",  "ISO-8859-4" },
+    { "lt_LN.ASCII",       "ASCII" },
+    { "lt_LN.DIS_8859-15", "ISO-8859-15" },
+    { "lt_LN.ISO_8859-1",  "ISO-8859-1" },
+    { "lt_LN.ISO_8859-2",  "ISO-8859-2" },
+    { "lt_LT.ISO_8859-4",  "ISO-8859-4" },
+    { "nl_BE.DIS_8859-15", "ISO-8859-15" },
+    { "nl_BE.ISO_8859-1",  "ISO-8859-1" },
+    { "nl_NL.DIS_8859-15", "ISO-8859-15" },
+    { "nl_NL.ISO_8859-1",  "ISO-8859-1" },
+    { "no_NO.DIS_8859-15", "ISO-8859-15" },
+    { "no_NO.ISO_8859-1",  "ISO-8859-1" },
+    { "pl_PL.ISO_8859-2",  "ISO-8859-2" },
+    { "pt_PT.DIS_8859-15", "ISO-8859-15" },
+    { "pt_PT.ISO_8859-1",  "ISO-8859-1" },
+    { "ru_RU.CP866",       "CP866" },
+    { "ru_RU.ISO_8859-5",  "ISO-8859-5" },
+    { "ru_RU.KOI8-R",      "KOI8-R" },
+    { "ru_SU.CP866",       "CP866" },
+    { "ru_SU.ISO_8859-5",  "ISO-8859-5" },
+    { "ru_SU.KOI8-R",      "KOI8-R" },
+    { "sl_SI.ISO_8859-2",  "ISO-8859-2" },
+    { "sv_SE.DIS_8859-15", "ISO-8859-15" },
+    { "sv_SE.ISO_8859-1",  "ISO-8859-1" },
+    { "uk_UA.KOI8-U",      "KOI8-U" },
+    { "zh_CN.EUC",         "GB2312" },
+    { "zh_TW.BIG5",        "BIG5" },
+    { "zh_TW.Big5",        "BIG5" }
+#  define locale_table_defined
+# endif
+# if defined __DJGPP__                                      /* DOS / DJGPP 2.03 */
+    /* The encodings given here may not all be correct.
+       If you find that the encoding given for your language and
+       country is not the one your DOS machine actually uses, just
+       correct it in this file, and send a mail to
+       Juan Manuel Guerrero <juan.guerrero@gmx.de>
+       and <bug-gnulib@gnu.org>.  */
+    { "C",     "ASCII" },
+    { "ar",    "CP864" },
+    { "ar_AE", "CP864" },
+    { "ar_DZ", "CP864" },
+    { "ar_EG", "CP864" },
+    { "ar_IQ", "CP864" },
+    { "ar_IR", "CP864" },
+    { "ar_JO", "CP864" },
+    { "ar_KW", "CP864" },
+    { "ar_MA", "CP864" },
+    { "ar_OM", "CP864" },
+    { "ar_QA", "CP864" },
+    { "ar_SA", "CP864" },
+    { "ar_SY", "CP864" },
+    { "be",    "CP866" },
+    { "be_BE", "CP866" },
+    { "bg",    "CP866" }, /* not CP855 ?? */
+    { "bg_BG", "CP866" }, /* not CP855 ?? */
+    { "ca",    "CP850" },
+    { "ca_ES", "CP850" },
+    { "cs",    "CP852" },
+    { "cs_CZ", "CP852" },
+    { "da",    "CP865" }, /* not CP850 ?? */
+    { "da_DK", "CP865" }, /* not CP850 ?? */
+    { "de",    "CP850" },
+    { "de_AT", "CP850" },
+    { "de_CH", "CP850" },
+    { "de_DE", "CP850" },
+    { "el",    "CP869" },
+    { "el_GR", "CP869" },
+    { "en",    "CP850" },
+    { "en_AU", "CP850" }, /* not CP437 ?? */
+    { "en_CA", "CP850" },
+    { "en_GB", "CP850" },
+    { "en_NZ", "CP437" },
+    { "en_US", "CP437" },
+    { "en_ZA", "CP850" }, /* not CP437 ?? */
+    { "eo",    "CP850" },
+    { "eo_EO", "CP850" },
+    { "es",    "CP850" },
+    { "es_AR", "CP850" },
+    { "es_BO", "CP850" },
+    { "es_CL", "CP850" },
+    { "es_CO", "CP850" },
+    { "es_CR", "CP850" },
+    { "es_CU", "CP850" },
+    { "es_DO", "CP850" },
+    { "es_EC", "CP850" },
+    { "es_ES", "CP850" },
+    { "es_GT", "CP850" },
+    { "es_HN", "CP850" },
+    { "es_MX", "CP850" },
+    { "es_NI", "CP850" },
+    { "es_PA", "CP850" },
+    { "es_PE", "CP850" },
+    { "es_PY", "CP850" },
+    { "es_SV", "CP850" },
+    { "es_UY", "CP850" },
+    { "es_VE", "CP850" },
+    { "et",    "CP850" },
+    { "et_EE", "CP850" },
+    { "eu",    "CP850" },
+    { "eu_ES", "CP850" },
+    { "fi",    "CP850" },
+    { "fi_FI", "CP850" },
+    { "fr",    "CP850" },
+    { "fr_BE", "CP850" },
+    { "fr_CA", "CP850" },
+    { "fr_CH", "CP850" },
+    { "fr_FR", "CP850" },
+    { "ga",    "CP850" },
+    { "ga_IE", "CP850" },
+    { "gd",    "CP850" },
+    { "gd_GB", "CP850" },
+    { "gl",    "CP850" },
+    { "gl_ES", "CP850" },
+    { "he",    "CP862" },
+    { "he_IL", "CP862" },
+    { "hr",    "CP852" },
+    { "hr_HR", "CP852" },
+    { "hu",    "CP852" },
+    { "hu_HU", "CP852" },
+    { "id",    "CP850" }, /* not CP437 ?? */
+    { "id_ID", "CP850" }, /* not CP437 ?? */
+    { "is",    "CP861" }, /* not CP850 ?? */
+    { "is_IS", "CP861" }, /* not CP850 ?? */
+    { "it",    "CP850" },
+    { "it_CH", "CP850" },
+    { "it_IT", "CP850" },
+    { "ja",    "CP932" },
+    { "ja_JP", "CP932" },
+    { "kr",    "CP949" }, /* not CP934 ?? */
+    { "kr_KR", "CP949" }, /* not CP934 ?? */
+    { "lt",    "CP775" },
+    { "lt_LT", "CP775" },
+    { "lv",    "CP775" },
+    { "lv_LV", "CP775" },
+    { "mk",    "CP866" }, /* not CP855 ?? */
+    { "mk_MK", "CP866" }, /* not CP855 ?? */
+    { "mt",    "CP850" },
+    { "mt_MT", "CP850" },
+    { "nb",    "CP865" }, /* not CP850 ?? */
+    { "nb_NO", "CP865" }, /* not CP850 ?? */
+    { "nl",    "CP850" },
+    { "nl_BE", "CP850" },
+    { "nl_NL", "CP850" },
+    { "nn",    "CP865" }, /* not CP850 ?? */
+    { "nn_NO", "CP865" }, /* not CP850 ?? */
+    { "no",    "CP865" }, /* not CP850 ?? */
+    { "no_NO", "CP865" }, /* not CP850 ?? */
+    { "pl",    "CP852" },
+    { "pl_PL", "CP852" },
+    { "pt",    "CP850" },
+    { "pt_BR", "CP850" },
+    { "pt_PT", "CP850" },
+    { "ro",    "CP852" },
+    { "ro_RO", "CP852" },
+    { "ru",    "CP866" },
+    { "ru_RU", "CP866" },
+    { "sk",    "CP852" },
+    { "sk_SK", "CP852" },
+    { "sl",    "CP852" },
+    { "sl_SI", "CP852" },
+    { "sq",    "CP852" },
+    { "sq_AL", "CP852" },
+    { "sr",    "CP852" }, /* CP852 or CP866 or CP855 ?? */
+    { "sr_CS", "CP852" }, /* CP852 or CP866 or CP855 ?? */
+    { "sr_YU", "CP852" }, /* CP852 or CP866 or CP855 ?? */
+    { "sv",    "CP850" },
+    { "sv_SE", "CP850" },
+    { "th",    "CP874" },
+    { "th_TH", "CP874" },
+    { "tr",    "CP857" },
+    { "tr_TR", "CP857" },
+    { "uk",    "CP1125" },
+    { "uk_UA", "CP1125" },
+    { "zh_CN", "GBK" },
+    { "zh_TW", "CP950" } /* not CP938 ?? */
+#  define locale_table_defined
+# endif
+# ifndef locale_table_defined
+    /* Just a dummy entry, to avoid a C syntax error.  */
+    { "", "" }
+# endif
+  };
+
+#endif
+
+
+/* Determine the current locale's character encoding, and canonicalize it
+   into one of the canonical names listed below.
+   The result must not be freed; it is statically allocated.  The result
+   becomes invalid when setlocale() is used to change the global locale, or
+   when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG
+   is changed; threads in multithreaded programs should not do this.
+   If the canonical name cannot be determined, the result is a non-canonical
+   name.  */
+
+#ifdef STATIC
+STATIC
+#endif
+const char *
+locale_charset (void)
+{
+  const char *codeset;
+
+  /* This function must be multithread-safe.  To achieve this without using
+     thread-local storage, we use a simple strcpy or memcpy to fill this static
+     buffer.  Filling it through, for example, strcpy + strcat would not be
+     guaranteed to leave the buffer's contents intact if another thread is
+     currently accessing it.  If necessary, the contents is first assembled in
+     a stack-allocated buffer.  */
+
+#if HAVE_LANGINFO_CODESET || defined WINDOWS_NATIVE || defined OS2
+
+# if HAVE_LANGINFO_CODESET
+
+  /* Most systems support nl_langinfo (CODESET) nowadays.  */
+  codeset = nl_langinfo (CODESET);
+
+#  ifdef __CYGWIN__
+  /* Cygwin < 1.7 does not have locales.  nl_langinfo (CODESET) always
+     returns "US-ASCII".  Return the suffix of the locale name from the
+     environment variables (if present) or the codepage as a number.  */
+  if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
+    {
+      const char *locale;
+      static char resultbuf[2 + 10 + 1];
+
+      locale = getenv ("LC_ALL");
+      if (locale == NULL || locale[0] == '\0')
+        {
+          locale = getenv ("LC_CTYPE");
+          if (locale == NULL || locale[0] == '\0')
+            locale = getenv ("LANG");
+        }
+      if (locale != NULL && locale[0] != '\0')
+        {
+          /* If the locale name contains an encoding after the dot, return
+             it.  */
+          const char *dot = strchr (locale, '.');
+
+          if (dot != NULL)
+            {
+              const char *modifier;
+
+              dot++;
+              /* Look for the possible @... trailer and remove it, if any.  */
+              modifier = strchr (dot, '@');
+              if (modifier == NULL)
+                return dot;
+              if (modifier - dot < sizeof (resultbuf))
+                {
+                  /* This way of filling resultbuf is multithread-safe.  */
+                  memcpy (resultbuf, dot, modifier - dot);
+                  resultbuf [modifier - dot] = '\0';
+                  return resultbuf;
+                }
+            }
+        }
+
+      /* The Windows API has a function returning the locale's codepage as a
+         number: GetACP().  This encoding is used by Cygwin, unless the user
+         has set the environment variable CYGWIN=codepage:oem (which very few
+         people do).
+         Output directed to console windows needs to be converted (to
+         GetOEMCP() if the console is using a raster font, or to
+         GetConsoleOutputCP() if it is using a TrueType font).  Cygwin does
+         this conversion transparently (see winsup/cygwin/fhandler_console.cc),
+         converting to GetConsoleOutputCP().  This leads to correct results,
+         except when SetConsoleOutputCP has been called and a raster font is
+         in use.  */
+      {
+        char buf[2 + 10 + 1];
+
+        sprintf (buf, "CP%u", GetACP ());
+        strcpy (resultbuf, buf);
+        codeset = resultbuf;
+      }
+    }
+#  endif
+
+  if (codeset == NULL)
+    /* The canonical name cannot be determined.  */
+    codeset = "";
+
+# elif defined WINDOWS_NATIVE
+
+  char buf[2 + 10 + 1];
+  static char resultbuf[2 + 10 + 1];
+
+  /* The Windows API has a function returning the locale's codepage as
+     a number, but the value doesn't change according to what the
+     'setlocale' call specified.  So we use it as a last resort, in
+     case the string returned by 'setlocale' doesn't specify the
+     codepage.  */
+  char *current_locale = setlocale (LC_CTYPE, NULL);
+  char *pdot = strrchr (current_locale, '.');
+
+  if (pdot && 2 + strlen (pdot + 1) + 1 <= sizeof (buf))
+    sprintf (buf, "CP%s", pdot + 1);
+  else
+    {
+      /* The Windows API has a function returning the locale's codepage as a
+         number: GetACP().
+         When the output goes to a console window, it needs to be provided in
+         GetOEMCP() encoding if the console is using a raster font, or in
+         GetConsoleOutputCP() encoding if it is using a TrueType font.
+         But in GUI programs and for output sent to files and pipes, GetACP()
+         encoding is the best bet.  */
+      sprintf (buf, "CP%u", GetACP ());
+    }
+  /* For a locale name such as "French_France.65001", in Windows 10,
+     setlocale now returns "French_France.utf8" instead.  */
+  if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0)
+    codeset = "UTF-8";
+  else
+    {
+      strcpy (resultbuf, buf);
+      codeset = resultbuf;
+    }
+
+# elif defined OS2
+
+  const char *locale;
+  static char resultbuf[2 + 10 + 1];
+  ULONG cp[3];
+  ULONG cplen;
+
+  codeset = NULL;
+
+  /* Allow user to override the codeset, as set in the operating system,
+     with standard language environment variables.  */
+  locale = getenv ("LC_ALL");
+  if (locale == NULL || locale[0] == '\0')
+    {
+      locale = getenv ("LC_CTYPE");
+      if (locale == NULL || locale[0] == '\0')
+        locale = getenv ("LANG");
+    }
+  if (locale != NULL && locale[0] != '\0')
+    {
+      /* If the locale name contains an encoding after the dot, return it.  */
+      const char *dot = strchr (locale, '.');
+
+      if (dot != NULL)
+        {
+          const char *modifier;
+
+          dot++;
+          /* Look for the possible @... trailer and remove it, if any.  */
+          modifier = strchr (dot, '@');
+          if (modifier == NULL)
+            return dot;
+          if (modifier - dot < sizeof (resultbuf))
+            {
+              /* This way of filling resultbuf is multithread-safe.  */
+              memcpy (resultbuf, dot, modifier - dot);
+              resultbuf [modifier - dot] = '\0';
+              return resultbuf;
+            }
+        }
+
+      /* For the POSIX locale, don't use the system's codepage.  */
+      if (strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0)
+        codeset = "";
+    }
+
+  if (codeset == NULL)
+    {
+      /* OS/2 has a function returning the locale's codepage as a number.  */
+      if (DosQueryCp (sizeof (cp), cp, &cplen))
+        codeset = "";
+      else
+        {
+          char buf[2 + 10 + 1];
+
+          sprintf (buf, "CP%u", cp[0]);
+          strcpy (resultbuf, buf);
+          codeset = resultbuf;
+        }
+    }
+
+# else
+
+#  error "Add code for other platforms here."
+
+# endif
+
+  /* Resolve alias.  */
+  {
+# ifdef alias_table_defined
+    /* On some platforms, UTF-8 locales are the most frequently used ones.
+       Speed up the common case and slow down the less common cases by
+       testing for this case first.  */
+#  if defined __OpenBSD__ || (defined __APPLE__ && defined __MACH__) || defined __sun || defined __CYGWIN__
+    if (strcmp (codeset, "UTF-8") == 0)
+      goto done_table_lookup;
+    else
+#  endif
+      {
+        const struct table_entry * const table = alias_table;
+        size_t const table_size =
+          sizeof (alias_table) / sizeof (struct table_entry);
+        /* The table is sorted.  Perform a binary search.  */
+        size_t hi = table_size;
+        size_t lo = 0;
+        while (lo < hi)
+          {
+            /* Invariant:
+               for i < lo, strcmp (table[i].alias, codeset) < 0,
+               for i >= hi, strcmp (table[i].alias, codeset) > 0.  */
+            size_t mid = (hi + lo) >> 1; /* >= lo, < hi */
+            int cmp = strcmp (table[mid].alias, codeset);
+            if (cmp < 0)
+              lo = mid + 1;
+            else if (cmp > 0)
+              hi = mid;
+            else
+              {
+                /* Found an i with
+                     strcmp (table[i].alias, codeset) == 0.  */
+                codeset = table[mid].canonical;
+                goto done_table_lookup;
+              }
+          }
+      }
+    if (0)
+      done_table_lookup: {}
+    else
+# endif
+      {
+        /* Did not find it in the table.  */
+        /* On Mac OS X, all modern locales use the UTF-8 encoding.
+           BeOS and Haiku have a single locale, and it has UTF-8 encoding.  */
+# if (defined __APPLE__ && defined __MACH__) || defined __BEOS__ || defined __HAIKU__
+        codeset = "UTF-8";
+# else
+        /* Don't return an empty string.  GNU libc and GNU libiconv interpret
+           the empty string as denoting "the locale's character encoding",
+           thus GNU libiconv would call this function a second time.  */
+        if (codeset[0] == '\0')
+          codeset = "ASCII";
+# endif
+      }
+  }
+
+#else
+
+  /* On old systems which lack it, use setlocale or getenv.  */
+  const char *locale = NULL;
+
+  /* But most old systems don't have a complete set of locales.  Some
+     (like DJGPP) have only the C locale.  Therefore we don't use setlocale
+     here; it would return "C" when it doesn't support the locale name the
+     user has set.  */
+# if 0
+  locale = setlocale (LC_CTYPE, NULL);
+# endif
+  if (locale == NULL || locale[0] == '\0')
+    {
+      locale = getenv ("LC_ALL");
+      if (locale == NULL || locale[0] == '\0')
+        {
+          locale = getenv ("LC_CTYPE");
+          if (locale == NULL || locale[0] == '\0')
+            locale = getenv ("LANG");
+            if (locale == NULL)
+              locale = "";
+        }
+    }
+
+  /* Map locale name to canonical encoding name.  */
+  {
+# ifdef locale_table_defined
+    const struct table_entry * const table = locale_table;
+    size_t const table_size =
+      sizeof (locale_table) / sizeof (struct table_entry);
+    /* The table is sorted.  Perform a binary search.  */
+    size_t hi = table_size;
+    size_t lo = 0;
+    while (lo < hi)
+      {
+        /* Invariant:
+           for i < lo, strcmp (table[i].locale, locale) < 0,
+           for i >= hi, strcmp (table[i].locale, locale) > 0.  */
+        size_t mid = (hi + lo) >> 1; /* >= lo, < hi */
+        int cmp = strcmp (table[mid].locale, locale);
+        if (cmp < 0)
+          lo = mid + 1;
+        else if (cmp > 0)
+          hi = mid;
+        else
+          {
+            /* Found an i with
+                 strcmp (table[i].locale, locale) == 0.  */
+            codeset = table[mid].canonical;
+            goto done_table_lookup;
+          }
+      }
+    if (0)
+      done_table_lookup: ;
+    else
+# endif
+      {
+        /* Did not find it in the table.  */
+        /* On Mac OS X, all modern locales use the UTF-8 encoding.
+           BeOS and Haiku have a single locale, and it has UTF-8 encoding.  */
+# if (defined __APPLE__ && defined __MACH__) || defined __BEOS__ || defined __HAIKU__
+        codeset = "UTF-8";
+# else
+        /* The canonical name cannot be determined.  */
+        /* Don't return an empty string.  GNU libc and GNU libiconv interpret
+           the empty string as denoting "the locale's character encoding",
+           thus GNU libiconv would call this function a second time.  */
+        codeset = "ASCII";
+# endif
+      }
+  }
+
+#endif
+
+#ifdef DARWIN7
+  /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8"
+     (the default codeset) does not work when MB_CUR_MAX is 1.  */
+  if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX_L (uselocale (NULL)) <= 1)
+    codeset = "ASCII";
+#endif
+
+  return codeset;
+}
deleted file mode 120000 (symlink)
index e9c32c490ee5616bab6076cf9e5e20667eb1fa18..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/localcharset.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..472140248c3bf0007cae18d2e0e78f8c5419c35c
--- /dev/null
@@ -0,0 +1,135 @@
+/* Determine a canonical name for the current locale's character encoding.
+   Copyright (C) 2000-2003, 2009-2024 Free Software Foundation, Inc.
+   This file is part of the GNU CHARSET Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LOCALCHARSET_H
+#define _LOCALCHARSET_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Determine the current locale's character encoding, and canonicalize it
+   into one of the canonical names listed below.
+   The result must not be freed; it is statically allocated.  The result
+   becomes invalid when setlocale() is used to change the global locale, or
+   when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG
+   is changed; threads in multithreaded programs should not do this.
+   If the canonical name cannot be determined, the result is a non-canonical
+   name.  */
+extern const char * locale_charset (void);
+
+/* About GNU canonical names for character encodings:
+
+   Every canonical name must be supported by GNU libiconv.  Support by GNU libc
+   is also desirable.
+
+   The name is case insensitive.  Usually an upper case MIME charset name is
+   preferred.
+
+   The current list of these GNU canonical names is:
+
+       name              MIME?             used by which systems
+                                    (darwin = Mac OS X, windows = native Windows)
+
+   ASCII, ANSI_X3.4-1968       glibc solaris freebsd netbsd darwin minix cygwin
+   ISO-8859-1              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
+   ISO-8859-2              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
+   ISO-8859-3              Y   glibc solaris cygwin
+   ISO-8859-4              Y   hpux osf solaris freebsd netbsd openbsd darwin
+   ISO-8859-5              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
+   ISO-8859-6              Y   glibc aix hpux solaris cygwin
+   ISO-8859-7              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
+   ISO-8859-8              Y   glibc aix hpux osf solaris cygwin zos
+   ISO-8859-9              Y   glibc aix hpux irix osf solaris freebsd darwin cygwin zos
+   ISO-8859-13                 glibc hpux solaris freebsd netbsd openbsd darwin cygwin
+   ISO-8859-14                 glibc cygwin
+   ISO-8859-15                 glibc aix irix osf solaris freebsd netbsd openbsd darwin cygwin
+   KOI8-R                  Y   glibc hpux solaris freebsd netbsd openbsd darwin
+   KOI8-U                  Y   glibc freebsd netbsd openbsd darwin cygwin
+   KOI8-T                      glibc
+   CP437                       dos
+   CP775                       dos
+   CP850                       aix osf dos
+   CP852                       dos
+   CP855                       dos
+   CP856                       aix
+   CP857                       dos
+   CP861                       dos
+   CP862                       dos
+   CP864                       dos
+   CP865                       dos
+   CP866                       freebsd netbsd openbsd darwin dos
+   CP869                       dos
+   CP874                       windows dos
+   CP922                       aix
+   CP932                       aix cygwin windows dos
+   CP943                       aix zos
+   CP949                       osf darwin windows dos
+   CP950                       windows dos
+   CP1046                      aix
+   CP1124                      aix
+   CP1125                      dos
+   CP1129                      aix
+   CP1131                      freebsd darwin
+   CP1250                      windows
+   CP1251                      glibc hpux solaris freebsd netbsd openbsd darwin cygwin windows
+   CP1252                      aix windows
+   CP1253                      windows
+   CP1254                      windows
+   CP1255                      glibc windows
+   CP1256                      windows
+   CP1257                      windows
+   GB2312                  Y   glibc aix hpux irix solaris freebsd netbsd darwin cygwin zos
+   EUC-JP                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin
+   EUC-KR                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin zos
+   EUC-TW                      glibc aix hpux irix osf solaris netbsd
+   BIG5                    Y   glibc aix hpux osf solaris freebsd netbsd darwin cygwin zos
+   BIG5-HKSCS                  glibc hpux solaris netbsd darwin
+   GBK                         glibc aix osf solaris freebsd darwin cygwin windows dos
+   GB18030                     glibc hpux solaris freebsd netbsd darwin
+   SHIFT_JIS               Y   hpux osf solaris freebsd netbsd darwin
+   JOHAB                       solaris windows
+   TIS-620                     glibc aix hpux osf solaris cygwin zos
+   ARMSCII-8                   glibc freebsd netbsd darwin
+   GEORGIAN-PS                 glibc cygwin
+   PT154                       glibc netbsd cygwin
+   HP-ROMAN8                   hpux
+   HP-ARABIC8                  hpux
+   HP-GREEK8                   hpux
+   HP-HEBREW8                  hpux
+   HP-TURKISH8                 hpux
+   HP-KANA8                    hpux
+   DEC-KANJI                   osf
+   DEC-HANYU                   osf
+   UTF-8                   Y   glibc aix hpux osf solaris netbsd darwin cygwin zos
+
+   Note: Names which are not marked as being a MIME name should not be used in
+   Internet protocols for information interchange (mail, news, etc.).
+
+   Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names.  Applications
+   must understand both names and treat them as equivalent.
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _LOCALCHARSET_H */
deleted file mode 120000 (symlink)
index 0ad211bf2f9cdc630f8b26d38fcd41e7c50a60a5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/locale.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bda07c932636ffb76ed0ce55a2f02e16b98a5a3d
--- /dev/null
@@ -0,0 +1,310 @@
+/* A POSIX <locale.h>.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \
+    || defined _GL_ALREADY_INCLUDING_LOCALE_H
+
+/* Special invocation convention:
+   - Inside mingw header files,
+   - To handle Solaris header files (through Solaris 10) when combined
+     with gettext's libintl.h.  */
+
+#@INCLUDE_NEXT@ @NEXT_LOCALE_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_LOCALE_H
+
+#define _GL_ALREADY_INCLUDING_LOCALE_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_LOCALE_H@
+
+#undef _GL_ALREADY_INCLUDING_LOCALE_H
+
+#ifndef _@GUARD_PREFIX@_LOCALE_H
+#define _@GUARD_PREFIX@_LOCALE_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
+
+/* Mac OS X 10.5 defines the locale_t type in <xlocale.h>.  */
+#if @HAVE_XLOCALE_H@
+# include <xlocale.h>
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
+   On systems that don't define it, use the same value as GNU libintl.  */
+#if !defined LC_MESSAGES
+# define LC_MESSAGES 1729
+#endif
+
+/* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and
+   int_n_*.  Instead of overriding 'struct lconv', merely define these member
+   names as macros.  This avoids trouble in C++ mode.  */
+#if defined _MSC_VER
+# define int_p_cs_precedes   p_cs_precedes
+# define int_p_sign_posn     p_sign_posn
+# define int_p_sep_by_space  p_sep_by_space
+# define int_n_cs_precedes   n_cs_precedes
+# define int_n_sign_posn     n_sign_posn
+# define int_n_sep_by_space  n_sep_by_space
+#endif
+
+/* Bionic libc's 'struct lconv' is just a dummy.  */
+#if @REPLACE_STRUCT_LCONV@
+# define lconv rpl_lconv
+struct lconv
+{
+  /* All 'char *' are actually 'const char *'.  */
+
+  /* Members that depend on the LC_NUMERIC category of the locale.  See
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */
+
+  /* Symbol used as decimal point.  */
+  char *decimal_point;
+  /* Symbol used to separate groups of digits to the left of the decimal
+     point.  */
+  char *thousands_sep;
+  /* Definition of the size of groups of digits to the left of the decimal
+     point.  */
+  char *grouping;
+
+  /* Members that depend on the LC_MONETARY category of the locale.  See
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */
+
+  /* Symbol used as decimal point.  */
+  char *mon_decimal_point;
+  /* Symbol used to separate groups of digits to the left of the decimal
+     point.  */
+  char *mon_thousands_sep;
+  /* Definition of the size of groups of digits to the left of the decimal
+     point.  */
+  char *mon_grouping;
+  /* Sign used to indicate a value >= 0.  */
+  char *positive_sign;
+  /* Sign used to indicate a value < 0.  */
+  char *negative_sign;
+
+  /* For formatting local currency.  */
+  /* Currency symbol (3 characters) followed by separator (1 character).  */
+  char *currency_symbol;
+  /* Number of digits after the decimal point.  */
+  char frac_digits;
+  /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
+     comes after the number.  */
+  char p_cs_precedes;
+  /* For values >= 0: Position of the sign.  */
+  char p_sign_posn;
+  /* For values >= 0: Placement of spaces between currency symbol, sign, and
+     number.  */
+  char p_sep_by_space;
+  /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
+     comes after the number.  */
+  char n_cs_precedes;
+  /* For values < 0: Position of the sign.  */
+  char n_sign_posn;
+  /* For values < 0: Placement of spaces between currency symbol, sign, and
+     number.  */
+  char n_sep_by_space;
+
+  /* For formatting international currency.  */
+  /* Currency symbol (3 characters) followed by separator (1 character).  */
+  char *int_curr_symbol;
+  /* Number of digits after the decimal point.  */
+  char int_frac_digits;
+  /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
+     comes after the number.  */
+  char int_p_cs_precedes;
+  /* For values >= 0: Position of the sign.  */
+  char int_p_sign_posn;
+  /* For values >= 0: Placement of spaces between currency symbol, sign, and
+     number.  */
+  char int_p_sep_by_space;
+  /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
+     comes after the number.  */
+  char int_n_cs_precedes;
+  /* For values < 0: Position of the sign.  */
+  char int_n_sign_posn;
+  /* For values < 0: Placement of spaces between currency symbol, sign, and
+     number.  */
+  char int_n_sep_by_space;
+};
+#endif
+
+#if @GNULIB_LOCALECONV@
+# if @REPLACE_LOCALECONV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef localeconv
+#   define localeconv rpl_localeconv
+#  endif
+_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void));
+_GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
+# else
+_GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (localeconv);
+# endif
+#elif @REPLACE_STRUCT_LCONV@
+# undef localeconv
+# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
+#elif defined GNULIB_POSIXCHECK
+# undef localeconv
+# if HAVE_RAW_DECL_LOCALECONV
+_GL_WARN_ON_USE (localeconv,
+                 "localeconv returns too few information on some platforms - "
+                 "use gnulib module localeconv for portability");
+# endif
+#endif
+
+#if @GNULIB_SETLOCALE@
+# if @REPLACE_SETLOCALE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setlocale
+#   define setlocale rpl_setlocale
+#   define GNULIB_defined_setlocale 1
+#  endif
+_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale));
+_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
+# else
+_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (setlocale);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef setlocale
+# if HAVE_RAW_DECL_SETLOCALE
+_GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
+                 "use gnulib module setlocale for portability");
+# endif
+#endif
+
+#if @GNULIB_SETLOCALE_NULL@
+/* Included here for convenience.  */
+# include "setlocale_null.h"
+#endif
+
+#if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@)
+# if @REPLACE_NEWLOCALE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef newlocale
+#   define newlocale rpl_newlocale
+#   define GNULIB_defined_newlocale 1
+#  endif
+_GL_FUNCDECL_RPL (newlocale, locale_t,
+                  (int category_mask, const char *name, locale_t base)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (newlocale, locale_t,
+                  (int category_mask, const char *name, locale_t base));
+# else
+#  if @HAVE_NEWLOCALE@
+_GL_CXXALIAS_SYS (newlocale, locale_t,
+                  (int category_mask, const char *name, locale_t base));
+#  endif
+# endif
+# if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@
+_GL_CXXALIASWARN (newlocale);
+# endif
+# if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@
+#  ifndef HAVE_WORKING_NEWLOCALE
+#   define HAVE_WORKING_NEWLOCALE 1
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef newlocale
+# if HAVE_RAW_DECL_NEWLOCALE
+_GL_WARN_ON_USE (newlocale, "newlocale is not portable");
+# endif
+#endif
+
+#if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@)
+# if @HAVE_DUPLOCALE@ /* locale_t may be undefined if !@HAVE_DUPLOCALE@.  */
+#  if @REPLACE_DUPLOCALE@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef duplocale
+#    define duplocale rpl_duplocale
+#    define GNULIB_defined_duplocale 1
+#   endif
+_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
+#  else
+_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
+#  endif
+# endif
+# if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@
+_GL_CXXALIASWARN (duplocale);
+# endif
+# if @HAVE_DUPLOCALE@
+#  ifndef HAVE_WORKING_DUPLOCALE
+#   define HAVE_WORKING_DUPLOCALE 1
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef duplocale
+# if HAVE_RAW_DECL_DUPLOCALE
+_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
+                 "use gnulib module duplocale for portability");
+# endif
+#endif
+
+#if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@)
+# if @REPLACE_FREELOCALE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef freelocale
+#   define freelocale rpl_freelocale
+#   define GNULIB_defined_freelocale 1
+#  endif
+_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (freelocale, void, (locale_t locale));
+# else
+#  if @HAVE_FREELOCALE@
+/* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is
+                                   int.  */
+_GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale));
+#  endif
+# endif
+# if __GLIBC__ >= 2 && @HAVE_FREELOCALE@
+_GL_CXXALIASWARN (freelocale);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef freelocale
+# if HAVE_RAW_DECL_FREELOCALE
+_GL_WARN_ON_USE (freelocale, "freelocale is not portable");
+# endif
+#endif
+
+#endif /* _@GUARD_PREFIX@_LOCALE_H */
+#endif /* _@GUARD_PREFIX@_LOCALE_H */
+#endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */
deleted file mode 120000 (symlink)
index e9f0512c654f12ae86f3c7b3461227921ef38663..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/localeconv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..10fc7b748bc78fdb5a1cc6d3898e9eaa56ab15a2
--- /dev/null
@@ -0,0 +1,114 @@
+/* Query locale dependent information for formatting numbers.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <locale.h>
+
+#include <limits.h>
+
+#if HAVE_STRUCT_LCONV_DECIMAL_POINT
+
+# define FIX_CHAR_VALUE(x) ((x) >= 0 ? (x) : CHAR_MAX)
+
+/* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_*
+   members or where fields of type 'char' are set to -1 instead of CHAR_MAX.  */
+
+struct lconv *
+localeconv (void)
+{
+  static struct lconv result;
+# undef lconv
+# undef localeconv
+  struct lconv *sys_result = localeconv ();
+
+  result.decimal_point = sys_result->decimal_point;
+  result.thousands_sep = sys_result->thousands_sep;
+  result.grouping = sys_result->grouping;
+  result.mon_decimal_point = sys_result->mon_decimal_point;
+  result.mon_thousands_sep = sys_result->mon_thousands_sep;
+  result.mon_grouping = sys_result->mon_grouping;
+  result.positive_sign = sys_result->positive_sign;
+  result.negative_sign = sys_result->negative_sign;
+  result.currency_symbol = sys_result->currency_symbol;
+  result.frac_digits = FIX_CHAR_VALUE (sys_result->frac_digits);
+  result.p_cs_precedes = FIX_CHAR_VALUE (sys_result->p_cs_precedes);
+  result.p_sign_posn = FIX_CHAR_VALUE (sys_result->p_sign_posn);
+  result.p_sep_by_space = FIX_CHAR_VALUE (sys_result->p_sep_by_space);
+  result.n_cs_precedes = FIX_CHAR_VALUE (sys_result->n_cs_precedes);
+  result.n_sign_posn = FIX_CHAR_VALUE (sys_result->n_sign_posn);
+  result.n_sep_by_space = FIX_CHAR_VALUE (sys_result->n_sep_by_space);
+  result.int_curr_symbol = sys_result->int_curr_symbol;
+  result.int_frac_digits = FIX_CHAR_VALUE (sys_result->int_frac_digits);
+# if HAVE_STRUCT_LCONV_INT_P_CS_PRECEDES
+  result.int_p_cs_precedes = FIX_CHAR_VALUE (sys_result->int_p_cs_precedes);
+  result.int_p_sign_posn = FIX_CHAR_VALUE (sys_result->int_p_sign_posn);
+  result.int_p_sep_by_space = FIX_CHAR_VALUE (sys_result->int_p_sep_by_space);
+  result.int_n_cs_precedes = FIX_CHAR_VALUE (sys_result->int_n_cs_precedes);
+  result.int_n_sign_posn = FIX_CHAR_VALUE (sys_result->int_n_sign_posn);
+  result.int_n_sep_by_space = FIX_CHAR_VALUE (sys_result->int_n_sep_by_space);
+# else
+  result.int_p_cs_precedes = FIX_CHAR_VALUE (sys_result->p_cs_precedes);
+  result.int_p_sign_posn = FIX_CHAR_VALUE (sys_result->p_sign_posn);
+  result.int_p_sep_by_space = FIX_CHAR_VALUE (sys_result->p_sep_by_space);
+  result.int_n_cs_precedes = FIX_CHAR_VALUE (sys_result->n_cs_precedes);
+  result.int_n_sign_posn = FIX_CHAR_VALUE (sys_result->n_sign_posn);
+  result.int_n_sep_by_space = FIX_CHAR_VALUE (sys_result->n_sep_by_space);
+# endif
+
+  return &result;
+}
+
+#else
+
+/* Override for platforms where 'struct lconv' is a dummy.  */
+
+struct lconv *
+localeconv (void)
+{
+  static /*const*/ struct lconv result =
+    {
+      /* decimal_point */ ".",
+      /* thousands_sep */ "",
+      /* grouping */ "",
+      /* mon_decimal_point */ "",
+      /* mon_thousands_sep */ "",
+      /* mon_grouping */ "",
+      /* positive_sign */ "",
+      /* negative_sign */ "",
+      /* currency_symbol */ "",
+      /* frac_digits */ CHAR_MAX,
+      /* p_cs_precedes */ CHAR_MAX,
+      /* p_sign_posn */ CHAR_MAX,
+      /* p_sep_by_space */ CHAR_MAX,
+      /* n_cs_precedes */ CHAR_MAX,
+      /* n_sign_posn */ CHAR_MAX,
+      /* n_sep_by_space */ CHAR_MAX,
+      /* int_curr_symbol */ "",
+      /* int_frac_digits */ CHAR_MAX,
+      /* int_p_cs_precedes */ CHAR_MAX,
+      /* int_p_sign_posn */ CHAR_MAX,
+      /* int_p_sep_by_space */ CHAR_MAX,
+      /* int_n_cs_precedes */ CHAR_MAX,
+      /* int_n_sign_posn */ CHAR_MAX,
+      /* int_n_sep_by_space */ CHAR_MAX
+    };
+
+  return &result;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 609a9627c51b21adbf2caf5a5b908a7f1068cf6b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/long-options.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7f6600cabc04f5f87ebc6d2e9bfe05888a69b01d
--- /dev/null
@@ -0,0 +1,139 @@
+/* Utility to accept --help and --version options as unobtrusively as possible.
+
+   Copyright (C) 1993-1994, 1998-2000, 2002-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "long-options.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+#include "version-etc.h"
+#include "exitfail.h"
+
+static struct option const long_options[] =
+{
+  {"help", no_argument, NULL, 'h'},
+  {"version", no_argument, NULL, 'v'},
+  {NULL, 0, NULL, 0}
+};
+
+/* Process long options --help and --version, but only if argc == 2.
+   Be careful not to gobble up "--".  */
+
+void
+parse_long_options (int argc,
+                    char **argv,
+                    const char *command_name,
+                    const char *package,
+                    const char *version,
+                    void (*usage_func) (int),
+                    /* const char *author1, ...*/ ...)
+{
+  int c;
+  int saved_opterr;
+
+  saved_opterr = opterr;
+
+  /* Don't print an error message for unrecognized options.  */
+  opterr = 0;
+
+  if (argc == 2
+      && (c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
+    {
+      switch (c)
+        {
+        case 'h':
+          (*usage_func) (EXIT_SUCCESS);
+          break;
+
+        case 'v':
+          {
+            va_list authors;
+            va_start (authors, usage_func);
+            version_etc_va (stdout, command_name, package, version, authors);
+            exit (EXIT_SUCCESS);
+          }
+
+        default:
+          /* Don't process any other long-named options.  */
+          break;
+        }
+    }
+
+  /* Restore previous value.  */
+  opterr = saved_opterr;
+
+  /* Reset this to zero so that getopt internals get initialized from
+     the probably-new parameters when/if getopt is called later.  */
+  optind = 0;
+}
+
+/* Process the GNU default long options --help and --version (see also
+   https://gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html),
+   and fail for any other unknown long or short option.
+   Use with SCAN_ALL=true to scan until "--", or with SCAN_ALL=false to stop
+   at the first non-option argument (or "--", whichever comes first).  */
+void
+parse_gnu_standard_options_only (int argc,
+                                 char **argv,
+                                 const char *command_name,
+                                 const char *package,
+                                 const char *version,
+                                 bool scan_all,
+                                 void (*usage_func) (int),
+                                 /* const char *author1, ...*/ ...)
+{
+  int c;
+  int saved_opterr = opterr;
+
+  /* Print an error message for unrecognized options.  */
+  opterr = 1;
+
+  const char *optstring = scan_all ? "" : "+";
+
+  if ((c = getopt_long (argc, argv, optstring, long_options, NULL)) != -1)
+    {
+      switch (c)
+        {
+        case 'h':
+          (*usage_func) (EXIT_SUCCESS);
+          break;
+
+        case 'v':
+          {
+            va_list authors;
+            va_start (authors, usage_func);
+            version_etc_va (stdout, command_name, package, version, authors);
+            exit (EXIT_SUCCESS);
+          }
+
+        default:
+          (*usage_func) (exit_failure);
+          break;
+        }
+    }
+
+  /* Restore previous value.  */
+  opterr = saved_opterr;
+}
deleted file mode 120000 (symlink)
index b2833aab60149cf4e0db2aad0695a7ce2ca7ec24..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/long-options.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..61e90f9ebf4d4eca74ff9f9dd1180bfc33405baa
--- /dev/null
@@ -0,0 +1,40 @@
+/* long-options.h -- declaration for --help- and --version-handling function.
+   Copyright (C) 1993-1994, 1998-1999, 2003, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#ifndef LONG_OPTIONS_H_
+# define LONG_OPTIONS_H_ 1
+
+void parse_long_options (int _argc,
+                         char **_argv,
+                         const char *_command_name,
+                         const char *_package,
+                         const char *_version,
+                         void (*_usage) (int),
+                         /* const char *author1, ...*/ ...);
+
+void parse_gnu_standard_options_only (int argc,
+                                      char **argv,
+                                      const char *command_name,
+                                      const char *package,
+                                      const char *version,
+                                      bool scan_all,
+                                      void (*usage_func) (int),
+                                      /* const char *author1, ...*/ ...);
+
+#endif /* LONG_OPTIONS_H_ */
deleted file mode 120000 (symlink)
index 58fc81434c172ee27f441fe2828481a96e3bd8fa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/lseek.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..61bd9fcbb63fd25aeaa3bac71ae4637554f76fec
--- /dev/null
@@ -0,0 +1,89 @@
+/* An lseek() function that detects pipes.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Windows platforms.  */
+/* Get GetFileType.  */
+# include <windows.h>
+/* Get _get_osfhandle.  */
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+#else
+# include <sys/stat.h>
+#endif
+#include <errno.h>
+
+#undef lseek
+
+off_t
+rpl_lseek (int fd, off_t offset, int whence)
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* mingw lseek mistakenly succeeds on pipes, sockets, and terminals.  */
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  if (h == INVALID_HANDLE_VALUE)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  if (GetFileType (h) != FILE_TYPE_DISK)
+    {
+      errno = ESPIPE;
+      return -1;
+    }
+#elif defined __APPLE__ && defined __MACH__ && defined SEEK_DATA
+  if (whence == SEEK_DATA)
+    {
+      /* If OFFSET points to data, macOS lseek+SEEK_DATA returns the
+         start S of the first data region that begins *after* OFFSET,
+         where the region from OFFSET to S consists of possibly-empty
+         data followed by a possibly-empty hole.  To work around this
+         portability glitch, check whether OFFSET is within data by
+         using lseek+SEEK_HOLE, and if so return to OFFSET by using
+         lseek+SEEK_SET.  Also, contrary to the macOS documentation,
+         lseek+SEEK_HOLE can fail with ENXIO if there are no holes on
+         or after OFFSET.  What a mess!  */
+      off_t next_hole = lseek (fd, offset, SEEK_HOLE);
+      if (next_hole < 0)
+        return errno == ENXIO ? offset : next_hole;
+      if (next_hole != offset)
+        whence = SEEK_SET;
+    }
+#else
+  /* BeOS lseek mistakenly succeeds on pipes...  */
+  struct stat statbuf;
+  if (fstat (fd, &statbuf) < 0)
+    return -1;
+  if (!S_ISREG (statbuf.st_mode))
+    {
+      errno = ESPIPE;
+      return -1;
+    }
+#endif
+#if _GL_WINDOWS_64_BIT_OFF_T || (defined __MINGW32__ && defined _FILE_OFFSET_BITS && (_FILE_OFFSET_BITS == 64))
+  return _lseeki64 (fd, offset, whence);
+#else
+  return lseek (fd, offset, whence);
+#endif
+}
deleted file mode 120000 (symlink)
index cb602eed228a02054af5e08592e33aad55f9e83a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/lstat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7c09957e20de329f58b9bf9222e65a2ef6f6909c
--- /dev/null
@@ -0,0 +1,104 @@
+/* Work around a bug of lstat on some systems
+
+   Copyright (C) 1997-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+   the system's <sys/stat.h> here, so that orig_lstat doesn't recurse to
+   rpl_lstat.  */
+#define __need_system_sys_stat_h
+#include <config.h>
+
+#if !HAVE_LSTAT
+/* On systems that lack symlinks, our replacement <sys/stat.h> already
+   defined lstat as stat, so there is nothing further to do other than
+   avoid an empty file.  */
+typedef int dummy;
+#else /* HAVE_LSTAT */
+
+/* Get the original definition of lstat.  It might be defined as a macro.  */
+# include <sys/types.h>
+# include <sys/stat.h>
+# undef __need_system_sys_stat_h
+
+static int
+orig_lstat (const char *filename, struct stat *buf)
+{
+  return lstat (filename, buf);
+}
+
+/* Specification.  */
+# ifdef __osf__
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+   eliminates this include because of the preliminary #include <sys/stat.h>
+   above.  */
+#  include "sys/stat.h"
+# else
+#  include <sys/stat.h>
+# endif
+
+# include "stat-time.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)
+{
+  int result = orig_lstat (file, sbuf);
+
+  /* This replacement file can blindly check against '/' rather than
+     using the ISSLASH macro, because all platforms with '\\' either
+     lack symlinks (mingw) or have working lstat (cygwin) and thus do
+     not compile this file.  0 len should have already been filtered
+     out above, with a failure return of ENOENT.  */
+  if (result == 0)
+    {
+      if (S_ISDIR (sbuf->st_mode) || file[strlen (file) - 1] != '/')
+        result = stat_time_normalize (result, sbuf);
+      else
+        {
+          /* At this point, a trailing slash is permitted only on
+             symlink-to-dir; but it should have found information on the
+             directory, not the symlink.  Call 'stat' to get info about the
+             link's referent.  Our replacement stat guarantees valid results,
+             even if the symlink is not pointing to a directory.  */
+          if (!S_ISLNK (sbuf->st_mode))
+            {
+              errno = ENOTDIR;
+              return -1;
+            }
+          result = stat (file, sbuf);
+        }
+    }
+  return result;
+}
+
+#endif /* HAVE_LSTAT */
deleted file mode 120000 (symlink)
index a8a86cdadf756a93f746787fd7d4a9eb05bb7f6e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2a7867a1d1ffa286ab32aab1364d4c48ea04924a
--- /dev/null
@@ -0,0 +1,51 @@
+/* malloc() function that is glibc compatible.
+
+   Copyright (C) 1997-1998, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering and Bruno Haible */
+
+#define _GL_USE_STDLIB_ALLOC 1
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <errno.h>
+
+#include "xalloc-oversized.h"
+
+/* Allocate an N-byte block of memory from the heap, even if N is 0.  */
+
+void *
+rpl_malloc (size_t n)
+{
+  if (n == 0)
+    n = 1;
+
+  if (xalloc_oversized (n, 1))
+    {
+      errno = ENOMEM;
+      return NULL;
+    }
+
+  void *result = malloc (n);
+
+#if !HAVE_MALLOC_POSIX
+  if (result == NULL)
+    errno = ENOMEM;
+#endif
+
+  return result;
+}
deleted file mode 120000 (symlink)
index 27a89a9414871c998a2cee430368e93c97cac68c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/dynarray-skeleton.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a95241abd2de25270ae7ed4e5d7ab18f0eefcd24
--- /dev/null
@@ -0,0 +1,528 @@
+/* Type-safe arrays which grow dynamically.
+   Copyright (C) 2017-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* Pre-processor macros which act as parameters:
+
+   DYNARRAY_STRUCT
+      The struct tag of dynamic array to be defined.
+   DYNARRAY_ELEMENT
+      The type name of the element type.  Elements are copied
+      as if by memcpy, and can change address as the dynamic
+      array grows.
+   DYNARRAY_PREFIX
+      The prefix of the functions which are defined.
+
+   The following parameters are optional:
+
+   DYNARRAY_ELEMENT_FREE
+      DYNARRAY_ELEMENT_FREE (E) is evaluated to deallocate the
+      contents of elements. E is of type  DYNARRAY_ELEMENT *.
+   DYNARRAY_ELEMENT_INIT
+      DYNARRAY_ELEMENT_INIT (E) is evaluated to initialize a new
+      element.  E is of type  DYNARRAY_ELEMENT *.
+      If DYNARRAY_ELEMENT_FREE but not DYNARRAY_ELEMENT_INIT is
+      defined, new elements are automatically zero-initialized.
+      Otherwise, new elements have undefined contents.
+   DYNARRAY_INITIAL_SIZE
+      The size of the statically allocated array (default:
+      at least 2, more elements if they fit into 128 bytes).
+      Must be a preprocessor constant.  If DYNARRAY_INITIAL_SIZE is 0,
+      there is no statically allocated array at, and all non-empty
+      arrays are heap-allocated.
+   DYNARRAY_FINAL_TYPE
+      The name of the type which holds the final array.  If not
+      defined, is PREFIX##finalize not provided.  DYNARRAY_FINAL_TYPE
+      must be a struct type, with members of type DYNARRAY_ELEMENT and
+      size_t at the start (in this order).
+
+   These macros are undefined after this header file has been
+   included.
+
+   The following types are provided (their members are private to the
+   dynarray implementation):
+
+     struct DYNARRAY_STRUCT
+
+   The following functions are provided:
+
+     void DYNARRAY_PREFIX##init (struct DYNARRAY_STRUCT *);
+     void DYNARRAY_PREFIX##free (struct DYNARRAY_STRUCT *);
+     bool DYNARRAY_PREFIX##has_failed (const struct DYNARRAY_STRUCT *);
+     void DYNARRAY_PREFIX##mark_failed (struct DYNARRAY_STRUCT *);
+     size_t DYNARRAY_PREFIX##size (const struct DYNARRAY_STRUCT *);
+     DYNARRAY_ELEMENT *DYNARRAY_PREFIX##begin (const struct DYNARRAY_STRUCT *);
+     DYNARRAY_ELEMENT *DYNARRAY_PREFIX##end (const struct DYNARRAY_STRUCT *);
+     DYNARRAY_ELEMENT *DYNARRAY_PREFIX##at (struct DYNARRAY_STRUCT *, size_t);
+     void DYNARRAY_PREFIX##add (struct DYNARRAY_STRUCT *, DYNARRAY_ELEMENT);
+     DYNARRAY_ELEMENT *DYNARRAY_PREFIX##emplace (struct DYNARRAY_STRUCT *);
+     bool DYNARRAY_PREFIX##resize (struct DYNARRAY_STRUCT *, size_t);
+     void DYNARRAY_PREFIX##remove_last (struct DYNARRAY_STRUCT *);
+     void DYNARRAY_PREFIX##clear (struct DYNARRAY_STRUCT *);
+
+   The following functions are provided are provided if the
+   prerequisites are met:
+
+     bool DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *,
+                                     DYNARRAY_FINAL_TYPE *);
+       (if DYNARRAY_FINAL_TYPE is defined)
+     DYNARRAY_ELEMENT *DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *,
+                                                  size_t *);
+       (if DYNARRAY_FINAL_TYPE is not defined)
+*/
+
+#include <malloc/dynarray.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef DYNARRAY_STRUCT
+# error "DYNARRAY_STRUCT must be defined"
+#endif
+
+#ifndef DYNARRAY_ELEMENT
+# error "DYNARRAY_ELEMENT must be defined"
+#endif
+
+#ifndef DYNARRAY_PREFIX
+# error "DYNARRAY_PREFIX must be defined"
+#endif
+
+#ifdef DYNARRAY_INITIAL_SIZE
+# if DYNARRAY_INITIAL_SIZE < 0
+#  error "DYNARRAY_INITIAL_SIZE must be non-negative"
+# endif
+# if DYNARRAY_INITIAL_SIZE > 0
+#  define DYNARRAY_HAVE_SCRATCH 1
+# else
+#  define DYNARRAY_HAVE_SCRATCH 0
+# endif
+#else
+/* Provide a reasonable default which limits the size of
+   DYNARRAY_STRUCT.  */
+# define DYNARRAY_INITIAL_SIZE \
+  (sizeof (DYNARRAY_ELEMENT) > 64 ? 2 : 128 / sizeof (DYNARRAY_ELEMENT))
+# define DYNARRAY_HAVE_SCRATCH 1
+#endif
+
+/* Public type definitions.  */
+
+/* All fields of this struct are private to the implementation.  */
+struct DYNARRAY_STRUCT
+{
+  union
+  {
+    struct dynarray_header dynarray_abstract;
+    struct
+    {
+      /* These fields must match struct dynarray_header.  */
+      size_t used;
+      size_t allocated;
+      DYNARRAY_ELEMENT *array;
+    } dynarray_header;
+  } u;
+
+#if DYNARRAY_HAVE_SCRATCH
+  /* Initial inline allocation.  */
+  DYNARRAY_ELEMENT scratch[DYNARRAY_INITIAL_SIZE];
+#endif
+};
+
+/* Internal use only: Helper macros.  */
+
+/* Ensure macro-expansion of DYNARRAY_PREFIX.  */
+#define DYNARRAY_CONCAT0(prefix, name) prefix##name
+#define DYNARRAY_CONCAT1(prefix, name) DYNARRAY_CONCAT0(prefix, name)
+#define DYNARRAY_NAME(name) DYNARRAY_CONCAT1(DYNARRAY_PREFIX, name)
+
+/* Use DYNARRAY_FREE instead of DYNARRAY_NAME (free),
+   so that Gnulib does not change 'free' to 'rpl_free'.  */
+#define DYNARRAY_FREE DYNARRAY_CONCAT1 (DYNARRAY_NAME (f), ree)
+
+/* Address of the scratch buffer if any.  */
+#if DYNARRAY_HAVE_SCRATCH
+# define DYNARRAY_SCRATCH(list) (list)->scratch
+#else
+# define DYNARRAY_SCRATCH(list) NULL
+#endif
+
+/* Internal use only: Helper functions.  */
+
+/* Internal function.  Call DYNARRAY_ELEMENT_FREE with the array
+   elements.  Name mangling needed due to the DYNARRAY_ELEMENT_FREE
+   macro expansion.  */
+static inline void
+DYNARRAY_NAME (free__elements__) (DYNARRAY_ELEMENT *__dynarray_array,
+                                  size_t __dynarray_used)
+{
+#ifdef DYNARRAY_ELEMENT_FREE
+  for (size_t __dynarray_i = 0; __dynarray_i < __dynarray_used; ++__dynarray_i)
+    DYNARRAY_ELEMENT_FREE (&__dynarray_array[__dynarray_i]);
+#endif /* DYNARRAY_ELEMENT_FREE */
+}
+
+/* Internal function.  Free the non-scratch array allocation.  */
+static inline void
+DYNARRAY_NAME (free__array__) (struct DYNARRAY_STRUCT *list)
+{
+#if DYNARRAY_HAVE_SCRATCH
+  if (list->u.dynarray_header.array != list->scratch)
+    free (list->u.dynarray_header.array);
+#else
+  free (list->u.dynarray_header.array);
+#endif
+}
+
+/* Public functions.  */
+
+/* Initialize a dynamic array object.  This must be called before any
+   use of the object.  */
+__attribute_nonnull__ ((1))
+static void
+DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list)
+{
+  list->u.dynarray_header.used = 0;
+  list->u.dynarray_header.allocated = DYNARRAY_INITIAL_SIZE;
+  list->u.dynarray_header.array = DYNARRAY_SCRATCH (list);
+}
+
+/* Deallocate the dynamic array and its elements.  */
+__attribute_maybe_unused__ __attribute_nonnull__ ((1))
+static void
+DYNARRAY_FREE (struct DYNARRAY_STRUCT *list)
+{
+  DYNARRAY_NAME (free__elements__)
+    (list->u.dynarray_header.array, list->u.dynarray_header.used);
+  DYNARRAY_NAME (free__array__) (list);
+  DYNARRAY_NAME (init) (list);
+}
+
+/* Return true if the dynamic array is in an error state.  */
+__attribute_nonnull__ ((1))
+static inline bool
+DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list)
+{
+  return list->u.dynarray_header.allocated == __dynarray_error_marker ();
+}
+
+/* Mark the dynamic array as failed.  All elements are deallocated as
+   a side effect.  */
+__attribute_nonnull__ ((1))
+static void
+DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list)
+{
+  DYNARRAY_NAME (free__elements__)
+    (list->u.dynarray_header.array, list->u.dynarray_header.used);
+  DYNARRAY_NAME (free__array__) (list);
+  list->u.dynarray_header.array = DYNARRAY_SCRATCH (list);
+  list->u.dynarray_header.used = 0;
+  list->u.dynarray_header.allocated = __dynarray_error_marker ();
+}
+
+/* Return the number of elements which have been added to the dynamic
+   array.  */
+__attribute_nonnull__ ((1))
+static inline size_t
+DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list)
+{
+  return list->u.dynarray_header.used;
+}
+
+/* Return a pointer to the array element at INDEX.  Terminate the
+   process if INDEX is out of bounds.  */
+__attribute_nonnull__ ((1))
+static inline DYNARRAY_ELEMENT *
+DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index)
+{
+  if (__glibc_unlikely (index >= DYNARRAY_NAME (size) (list)))
+    __libc_dynarray_at_failure (DYNARRAY_NAME (size) (list), index);
+  return list->u.dynarray_header.array + index;
+}
+
+/* Return a pointer to the first array element, if any.  For a
+   zero-length array, the pointer can be NULL even though the dynamic
+   array has not entered the failure state.  */
+__attribute_nonnull__ ((1))
+static inline DYNARRAY_ELEMENT *
+DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list)
+{
+  return list->u.dynarray_header.array;
+}
+
+/* Return a pointer one element past the last array element.  For a
+   zero-length array, the pointer can be NULL even though the dynamic
+   array has not entered the failure state.  */
+__attribute_nonnull__ ((1))
+static inline DYNARRAY_ELEMENT *
+DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list)
+{
+  return list->u.dynarray_header.array + list->u.dynarray_header.used;
+}
+
+/* Internal function.  Slow path for the add function below.  */
+static void
+DYNARRAY_NAME (add__) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item)
+{
+  if (__glibc_unlikely
+      (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract,
+                                         DYNARRAY_SCRATCH (list),
+                                         sizeof (DYNARRAY_ELEMENT))))
+    {
+      DYNARRAY_NAME (mark_failed) (list);
+      return;
+    }
+
+  /* Copy the new element and increase the array length.  */
+  list->u.dynarray_header.array[list->u.dynarray_header.used++] = item;
+}
+
+/* Add ITEM at the end of the array, enlarging it by one element.
+   Mark *LIST as failed if the dynamic array allocation size cannot be
+   increased.  */
+__attribute_nonnull__ ((1))
+static inline void
+DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item)
+{
+  /* Do nothing in case of previous error.  */
+  if (DYNARRAY_NAME (has_failed) (list))
+    return;
+
+  /* Enlarge the array if necessary.  */
+  if (__glibc_unlikely (list->u.dynarray_header.used
+                        == list->u.dynarray_header.allocated))
+    {
+      DYNARRAY_NAME (add__) (list, item);
+      return;
+    }
+
+  /* Copy the new element and increase the array length.  */
+  list->u.dynarray_header.array[list->u.dynarray_header.used++] = item;
+}
+
+/* Internal function.  Building block for the emplace functions below.
+   Assumes space for one more element in *LIST.  */
+static inline DYNARRAY_ELEMENT *
+DYNARRAY_NAME (emplace__tail__) (struct DYNARRAY_STRUCT *list)
+{
+  DYNARRAY_ELEMENT *result
+    = &list->u.dynarray_header.array[list->u.dynarray_header.used];
+  ++list->u.dynarray_header.used;
+#if defined (DYNARRAY_ELEMENT_INIT)
+  DYNARRAY_ELEMENT_INIT (result);
+#elif defined (DYNARRAY_ELEMENT_FREE)
+  memset (result, 0, sizeof (*result));
+#endif
+  return result;
+}
+
+/* Internal function.  Slow path for the emplace function below.  */
+static DYNARRAY_ELEMENT *
+DYNARRAY_NAME (emplace__) (struct DYNARRAY_STRUCT *list)
+{
+  if (__glibc_unlikely
+      (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract,
+                                         DYNARRAY_SCRATCH (list),
+                                         sizeof (DYNARRAY_ELEMENT))))
+    {
+      DYNARRAY_NAME (mark_failed) (list);
+      return NULL;
+    }
+  return DYNARRAY_NAME (emplace__tail__) (list);
+}
+
+/* Allocate a place for a new element in *LIST and return a pointer to
+   it.  The pointer can be NULL if the dynamic array cannot be
+   enlarged due to a memory allocation failure.  */
+__attribute_maybe_unused__ __attribute_warn_unused_result__
+__attribute_nonnull__ ((1))
+static
+/* Avoid inlining with the larger initialization code.  */
+#if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE))
+inline
+#endif
+DYNARRAY_ELEMENT *
+DYNARRAY_NAME (emplace) (struct DYNARRAY_STRUCT *list)
+{
+  /* Do nothing in case of previous error.  */
+  if (DYNARRAY_NAME (has_failed) (list))
+    return NULL;
+
+  /* Enlarge the array if necessary.  */
+  if (__glibc_unlikely (list->u.dynarray_header.used
+                        == list->u.dynarray_header.allocated))
+    return (DYNARRAY_NAME (emplace__) (list));
+  return DYNARRAY_NAME (emplace__tail__) (list);
+}
+
+/* Change the size of *LIST to SIZE.  If SIZE is larger than the
+   existing size, new elements are added (which can be initialized).
+   Otherwise, the list is truncated, and elements are freed.  Return
+   false on memory allocation failure (and mark *LIST as failed).  */
+__attribute_maybe_unused__ __attribute_nonnull__ ((1))
+static bool
+DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size)
+{
+  if (size > list->u.dynarray_header.used)
+    {
+      bool ok;
+#if defined (DYNARRAY_ELEMENT_INIT)
+      /* The new elements have to be initialized.  */
+      size_t old_size = list->u.dynarray_header.used;
+      ok = __libc_dynarray_resize (&list->u.dynarray_abstract,
+                                   size, DYNARRAY_SCRATCH (list),
+                                   sizeof (DYNARRAY_ELEMENT));
+      if (ok)
+        for (size_t i = old_size; i < size; ++i)
+          {
+            DYNARRAY_ELEMENT_INIT (&list->u.dynarray_header.array[i]);
+          }
+#elif defined (DYNARRAY_ELEMENT_FREE)
+      /* Zero initialization is needed so that the elements can be
+         safely freed.  */
+      ok = __libc_dynarray_resize_clear
+        (&list->u.dynarray_abstract, size,
+         DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT));
+#else
+      ok =  __libc_dynarray_resize (&list->u.dynarray_abstract,
+                                    size, DYNARRAY_SCRATCH (list),
+                                    sizeof (DYNARRAY_ELEMENT));
+#endif
+      if (__glibc_unlikely (!ok))
+        DYNARRAY_NAME (mark_failed) (list);
+      return ok;
+    }
+  else
+    {
+      /* The list has shrunk in size.  Free the removed elements.  */
+      DYNARRAY_NAME (free__elements__)
+        (list->u.dynarray_header.array + size,
+         list->u.dynarray_header.used - size);
+      list->u.dynarray_header.used = size;
+      return true;
+    }
+}
+
+/* Remove the last element of LIST if it is present.  */
+__attribute_maybe_unused__ __attribute_nonnull__ ((1))
+static void
+DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list)
+{
+  /* used > 0 implies that the array is the non-failed state.  */
+  if (list->u.dynarray_header.used > 0)
+    {
+      size_t new_length = list->u.dynarray_header.used - 1;
+#ifdef DYNARRAY_ELEMENT_FREE
+      DYNARRAY_ELEMENT_FREE (&list->u.dynarray_header.array[new_length]);
+#endif
+      list->u.dynarray_header.used = new_length;
+    }
+}
+
+/* Remove all elements from the list.  The elements are freed, but the
+   list itself is not.  */
+__attribute_maybe_unused__ __attribute_nonnull__ ((1))
+static void
+DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list)
+{
+  /* free__elements__ does nothing if the list is in the failed
+     state.  */
+  DYNARRAY_NAME (free__elements__)
+    (list->u.dynarray_header.array, list->u.dynarray_header.used);
+  list->u.dynarray_header.used = 0;
+}
+
+#ifdef DYNARRAY_FINAL_TYPE
+/* Transfer the dynamic array to a permanent location at *RESULT.
+   Returns true on success on false on allocation failure.  In either
+   case, *LIST is re-initialized and can be reused.  A NULL pointer is
+   stored in *RESULT if LIST refers to an empty list.  On success, the
+   pointer in *RESULT is heap-allocated and must be deallocated using
+   free.  */
+__attribute_maybe_unused__ __attribute_warn_unused_result__
+__attribute_nonnull__ ((1, 2))
+static bool
+DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list,
+                          DYNARRAY_FINAL_TYPE *result)
+{
+  struct dynarray_finalize_result res;
+  if (__libc_dynarray_finalize (&list->u.dynarray_abstract,
+                                DYNARRAY_SCRATCH (list),
+                                sizeof (DYNARRAY_ELEMENT), &res))
+    {
+      /* On success, the result owns all the data.  */
+      DYNARRAY_NAME (init) (list);
+      *result = (DYNARRAY_FINAL_TYPE) { res.array, res.length };
+      return true;
+    }
+  else
+    {
+      /* On error, we need to free all data.  */
+      DYNARRAY_FREE (list);
+      errno = ENOMEM;
+      return false;
+    }
+}
+#else /* !DYNARRAY_FINAL_TYPE */
+/* Transfer the dynamic array to a heap-allocated array and return a
+   pointer to it.  The pointer is NULL if memory allocation fails, or
+   if the array is empty, so this function should be used only for
+   arrays which are known not be empty (usually because they always
+   have a sentinel at the end).  If LENGTHP is not NULL, the array
+   length is written to *LENGTHP.  *LIST is re-initialized and can be
+   reused.  */
+__attribute_maybe_unused__ __attribute_warn_unused_result__
+__attribute_nonnull__ ((1))
+static DYNARRAY_ELEMENT *
+DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp)
+{
+  struct dynarray_finalize_result res;
+  if (__libc_dynarray_finalize (&list->u.dynarray_abstract,
+                                DYNARRAY_SCRATCH (list),
+                                sizeof (DYNARRAY_ELEMENT), &res))
+    {
+      /* On success, the result owns all the data.  */
+      DYNARRAY_NAME (init) (list);
+      if (lengthp != NULL)
+        *lengthp = res.length;
+      return res.array;
+    }
+  else
+    {
+      /* On error, we need to free all data.  */
+      DYNARRAY_FREE (list);
+      errno = ENOMEM;
+      return NULL;
+    }
+}
+#endif /* !DYNARRAY_FINAL_TYPE */
+
+/* Undo macro definitions.  */
+
+#undef DYNARRAY_CONCAT0
+#undef DYNARRAY_CONCAT1
+#undef DYNARRAY_NAME
+#undef DYNARRAY_SCRATCH
+#undef DYNARRAY_HAVE_SCRATCH
+
+#undef DYNARRAY_STRUCT
+#undef DYNARRAY_ELEMENT
+#undef DYNARRAY_PREFIX
+#undef DYNARRAY_ELEMENT_FREE
+#undef DYNARRAY_ELEMENT_INIT
+#undef DYNARRAY_INITIAL_SIZE
+#undef DYNARRAY_FINAL_TYPE
deleted file mode 120000 (symlink)
index 12b6e8bf3c1163f0557ca27614c28105958e20d1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/dynarray.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3163e2782b4a2f2043af19d08039f2a31aea2088
--- /dev/null
@@ -0,0 +1,177 @@
+/* Type-safe arrays which grow dynamically.  Shared definitions.
+   Copyright (C) 2017-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* To use the dynarray facility, you need to include
+   <malloc/dynarray-skeleton.c> and define the parameter macros
+   documented in that file.
+
+   A minimal example which provides a growing list of integers can be
+   defined like this:
+
+     struct int_array
+     {
+       // Pointer to result array followed by its length,
+       // as required by DYNARRAY_FINAL_TYPE.
+       int *array;
+       size_t length;
+     };
+
+     #define DYNARRAY_STRUCT dynarray_int
+     #define DYNARRAY_ELEMENT int
+     #define DYNARRAY_PREFIX dynarray_int_
+     #define DYNARRAY_FINAL_TYPE struct int_array
+     #include <malloc/dynarray-skeleton.c>
+
+   To create a three-element array with elements 1, 2, 3, use this
+   code:
+
+     struct dynarray_int dyn;
+     dynarray_int_init (&dyn);
+     for (int i = 1; i <= 3; ++i)
+       {
+         int *place = dynarray_int_emplace (&dyn);
+         assert (place != NULL);
+         *place = i;
+       }
+     struct int_array result;
+     bool ok = dynarray_int_finalize (&dyn, &result);
+     assert (ok);
+     assert (result.length == 3);
+     assert (result.array[0] == 1);
+     assert (result.array[1] == 2);
+     assert (result.array[2] == 3);
+     free (result.array);
+
+   If the elements contain resources which must be freed, define
+   DYNARRAY_ELEMENT_FREE appropriately, like this:
+
+     struct str_array
+     {
+       char **array;
+       size_t length;
+     };
+
+     #define DYNARRAY_STRUCT dynarray_str
+     #define DYNARRAY_ELEMENT char *
+     #define DYNARRAY_ELEMENT_FREE(ptr) free (*ptr)
+     #define DYNARRAY_PREFIX dynarray_str_
+     #define DYNARRAY_FINAL_TYPE struct str_array
+     #include <malloc/dynarray-skeleton.c>
+
+   Compared to scratch buffers, dynamic arrays have the following
+   features:
+
+   - They have an element type, and are not just an untyped buffer of
+     bytes.
+
+   - When growing, previously stored elements are preserved.  (It is
+     expected that scratch_buffer_grow_preserve and
+     scratch_buffer_set_array_size eventually go away because all
+     current users are moved to dynamic arrays.)
+
+   - Scratch buffers have a more aggressive growth policy because
+     growing them typically means a retry of an operation (across an
+     NSS service module boundary), which is expensive.
+
+   - For the same reason, scratch buffers have a much larger initial
+     stack allocation.  */
+
+#ifndef _DYNARRAY_H
+#define _DYNARRAY_H
+
+#include <stddef.h>
+#include <string.h>
+
+struct dynarray_header
+{
+  size_t used;
+  size_t allocated;
+  void *array;
+};
+
+/* Marker used in the allocated member to indicate that an error was
+   encountered.  */
+static inline size_t
+__dynarray_error_marker (void)
+{
+  return -1;
+}
+
+/* Internal function.  See the has_failed function in
+   dynarray-skeleton.c.  */
+static inline bool
+__dynarray_error (struct dynarray_header *list)
+{
+  return list->allocated == __dynarray_error_marker ();
+}
+
+/* Internal function.  Enlarge the dynamically allocated area of the
+   array to make room for one more element.  SCRATCH is a pointer to
+   the scratch area (which is not heap-allocated and must not be
+   freed).  ELEMENT_SIZE is the size, in bytes, of one element.
+   Return false on failure, true on success.  */
+bool __libc_dynarray_emplace_enlarge (struct dynarray_header *,
+                                      void *scratch, size_t element_size);
+
+/* Internal function.  Enlarge the dynamically allocated area of the
+   array to make room for at least SIZE elements (which must be larger
+   than the existing used part of the dynamic array).  SCRATCH is a
+   pointer to the scratch area (which is not heap-allocated and must
+   not be freed).  ELEMENT_SIZE is the size, in bytes, of one element.
+   Return false on failure, true on success.  */
+bool __libc_dynarray_resize (struct dynarray_header *, size_t size,
+                             void *scratch, size_t element_size);
+
+/* Internal function.  Like __libc_dynarray_resize, but clear the new
+   part of the dynamic array.  */
+bool __libc_dynarray_resize_clear (struct dynarray_header *, size_t size,
+                                   void *scratch, size_t element_size);
+
+/* Internal type.  */
+struct dynarray_finalize_result
+{
+  void *array;
+  size_t length;
+};
+
+/* Internal function.  Copy the dynamically-allocated area to an
+   explicitly-sized heap allocation.  SCRATCH is a pointer to the
+   embedded scratch space.  ELEMENT_SIZE is the size, in bytes, of the
+   element type.  On success, true is returned, and pointer and length
+   are written to *RESULT.  On failure, false is returned.  The caller
+   has to take care of some of the memory management; this function is
+   expected to be called from dynarray-skeleton.c.  */
+bool __libc_dynarray_finalize (struct dynarray_header *list, void *scratch,
+                               size_t element_size,
+                               struct dynarray_finalize_result *result);
+
+
+/* Internal function.  Terminate the process after an index error.
+   SIZE is the number of elements of the dynamic array.  INDEX is the
+   lookup index which triggered the failure.  */
+_Noreturn void __libc_dynarray_at_failure (size_t size, size_t index);
+
+#ifndef _ISOMAC
+libc_hidden_proto (__libc_dynarray_emplace_enlarge)
+libc_hidden_proto (__libc_dynarray_resize)
+libc_hidden_proto (__libc_dynarray_resize_clear)
+libc_hidden_proto (__libc_dynarray_finalize)
+libc_hidden_proto (__libc_dynarray_at_failure)
+#endif
+
+#endif /* _DYNARRAY_H */
deleted file mode 120000 (symlink)
index 353d09b5138886f2fc4c48187087d06188d0ab30..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/dynarray_at_failure.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..95e34e7aacd43d1fe6b37d99a4df8a0e9faecb9b
--- /dev/null
@@ -0,0 +1,40 @@
+/* Report an dynamic array index out of bounds condition.
+   Copyright (C) 2017-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+# include <stdlib.h>
+#endif
+
+#include <dynarray.h>
+#include <stdio.h>
+
+void
+__libc_dynarray_at_failure (size_t size, size_t index)
+{
+#ifdef _LIBC
+  char buf[200];
+  __snprintf (buf, sizeof (buf), "Fatal glibc error: "
+              "array index %zu not less than array length %zu\n",
+              index, size);
+  __libc_fatal (buf);
+#else
+ abort ();
+#endif
+}
+libc_hidden_def (__libc_dynarray_at_failure)
deleted file mode 120000 (symlink)
index 904e0eee74849a4dfb7c16eb281e3bd37d0a5f2b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/dynarray_emplace_enlarge.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7bdba1597e0fb3f00c21c02de01ee082ececb934
--- /dev/null
@@ -0,0 +1,77 @@
+/* Increase the size of a dynamic array in preparation of an emplace operation.
+   Copyright (C) 2017-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <dynarray.h>
+#include <errno.h>
+#include <stdckdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+bool
+__libc_dynarray_emplace_enlarge (struct dynarray_header *list,
+                                 void *scratch, size_t element_size)
+{
+  size_t new_allocated;
+  if (list->allocated == 0)
+    {
+      /* No scratch buffer provided.  Choose a reasonable default
+         size.  */
+      if (element_size < 4)
+        new_allocated = 16;
+      else if (element_size < 8)
+        new_allocated = 8;
+      else
+        new_allocated = 4;
+    }
+  else
+    /* Increase the allocated size, using an exponential growth
+       policy.  */
+    {
+      new_allocated = list->allocated + list->allocated / 2 + 1;
+      if (new_allocated <= list->allocated)
+        {
+          /* Overflow.  */
+          __set_errno (ENOMEM);
+          return false;
+        }
+    }
+
+  size_t new_size;
+  if (ckd_mul (&new_size, new_allocated, element_size))
+    return false;
+  void *new_array;
+  if (list->array == scratch)
+    {
+      /* The previous array was not heap-allocated.  */
+      new_array = malloc (new_size);
+      if (new_array != NULL && list->array != NULL)
+        memcpy (new_array, list->array, list->used * element_size);
+    }
+  else
+    new_array = realloc (list->array, new_size);
+  if (new_array == NULL)
+    return false;
+  list->array = new_array;
+  list->allocated = new_allocated;
+  return true;
+}
+libc_hidden_def (__libc_dynarray_emplace_enlarge)
deleted file mode 120000 (symlink)
index b0a2c0ec826c1166689ce3bb2905ecefbad7c9a4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/dynarray_finalize.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..52764f732871e7346aa7662177d9570274408284
--- /dev/null
@@ -0,0 +1,66 @@
+/* Copy the dynamically-allocated area to an explicitly-sized heap allocation.
+   Copyright (C) 2017-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <dynarray.h>
+#include <stdlib.h>
+#include <string.h>
+
+bool
+__libc_dynarray_finalize (struct dynarray_header *list,
+                          void *scratch, size_t element_size,
+                          struct dynarray_finalize_result *result)
+{
+  if (__dynarray_error (list))
+    /* The caller will reported the deferred error.  */
+    return false;
+
+  size_t used = list->used;
+
+  /* Empty list.  */
+  if (used == 0)
+    {
+      /* An empty list could still be backed by a heap-allocated
+         array.  Free it if necessary.  */
+      if (list->array != scratch)
+        free (list->array);
+      *result = (struct dynarray_finalize_result) { NULL, 0 };
+      return true;
+    }
+
+  size_t allocation_size = used * element_size;
+  void *heap_array = malloc (allocation_size);
+  if (heap_array != NULL)
+    {
+      /* The new array takes ownership of the strings.  */
+      if (list->array != NULL)
+        memcpy (heap_array, list->array, allocation_size);
+      if (list->array != scratch)
+        free (list->array);
+      *result = (struct dynarray_finalize_result)
+        { .array = heap_array, .length = used };
+      return true;
+    }
+  else
+    /* The caller will perform the freeing operation.  */
+    return false;
+}
+libc_hidden_def (__libc_dynarray_finalize)
deleted file mode 120000 (symlink)
index 09720aa8b2a4f8bfd68a8e44590d8d5bf2e07bcd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/dynarray_resize.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7323f8eeb0cd5dbc1b52cf1ac02ff201b200b224
--- /dev/null
@@ -0,0 +1,68 @@
+/* Increase the size of a dynamic array.
+   Copyright (C) 2017-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <dynarray.h>
+#include <errno.h>
+#include <stdckdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+bool
+__libc_dynarray_resize (struct dynarray_header *list, size_t size,
+                        void *scratch, size_t element_size)
+{
+  /* The existing allocation provides sufficient room.  */
+  if (size <= list->allocated)
+    {
+      list->used = size;
+      return true;
+    }
+
+  /* Otherwise, use size as the new allocation size.  The caller is
+     expected to provide the final size of the array, so there is no
+     over-allocation here.  */
+
+  size_t new_size_bytes;
+  if (ckd_mul (&new_size_bytes, size, element_size))
+    {
+      /* Overflow.  */
+      __set_errno (ENOMEM);
+      return false;
+    }
+  void *new_array;
+  if (list->array == scratch)
+    {
+      /* The previous array was not heap-allocated.  */
+      new_array = malloc (new_size_bytes);
+      if (new_array != NULL && list->array != NULL)
+        memcpy (new_array, list->array, list->used * element_size);
+    }
+  else
+    new_array = realloc (list->array, new_size_bytes);
+  if (new_array == NULL)
+    return false;
+  list->array = new_array;
+  list->allocated = size;
+  list->used = size;
+  return true;
+}
+libc_hidden_def (__libc_dynarray_resize)
deleted file mode 120000 (symlink)
index 82f3980c333620f70cc62de8e2f0f3959ec68b5e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/dynarray_resize_clear.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aa17f740e57a3faf33c1aa0eb260a29709ac58bc
--- /dev/null
@@ -0,0 +1,39 @@
+/* Increase the size of a dynamic array and clear the new part.
+   Copyright (C) 2017-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <dynarray.h>
+#include <string.h>
+
+bool
+__libc_dynarray_resize_clear (struct dynarray_header *list, size_t size,
+                              void *scratch, size_t element_size)
+{
+  size_t old_size = list->used;
+  if (!__libc_dynarray_resize (list, size, scratch, element_size))
+    return false;
+  /* __libc_dynarray_resize already checked for overflow.  */
+  char *array = list->array;
+  memset (array + (old_size * element_size), 0,
+          (size - old_size) * element_size);
+  return true;
+}
+libc_hidden_def (__libc_dynarray_resize_clear)
deleted file mode 120000 (symlink)
index a16ed1adfc2aa0801893e101a2d5427b69a090a7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/scratch_buffer.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..33fd2b29cd563e3314872b525352bde4aa0a861a
--- /dev/null
@@ -0,0 +1,135 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2015-2023 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SCRATCH_BUFFER_H
+#define _SCRATCH_BUFFER_H
+
+/* Scratch buffers with a default stack allocation and fallback to
+   heap allocation.  It is expected that this function is used in this
+   way:
+
+     struct scratch_buffer tmpbuf;
+     scratch_buffer_init (&tmpbuf);
+
+     while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length))
+       if (!scratch_buffer_grow (&tmpbuf))
+        return -1;
+
+     scratch_buffer_free (&tmpbuf);
+     return 0;
+
+   The allocation functions (scratch_buffer_grow,
+   scratch_buffer_grow_preserve, scratch_buffer_set_array_size) make
+   sure that the heap allocation, if any, is freed, so that the code
+   above does not have a memory leak.  The buffer still remains in a
+   state that can be deallocated using scratch_buffer_free, so a loop
+   like this is valid as well:
+
+     struct scratch_buffer tmpbuf;
+     scratch_buffer_init (&tmpbuf);
+
+     while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length))
+       if (!scratch_buffer_grow (&tmpbuf))
+        break;
+
+     scratch_buffer_free (&tmpbuf);
+
+   scratch_buffer_grow and scratch_buffer_grow_preserve are guaranteed
+   to grow the buffer by at least 512 bytes.  This means that when
+   using the scratch buffer as a backing store for a non-character
+   array whose element size, in bytes, is 512 or smaller, the scratch
+   buffer only has to grow once to make room for at least one more
+   element.
+*/
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+/* Scratch buffer.  Must be initialized with scratch_buffer_init
+   before its use.  */
+struct scratch_buffer {
+  void *data;    /* Pointer to the beginning of the scratch area.  */
+  size_t length; /* Allocated space at the data pointer, in bytes.  */
+  union { max_align_t __align; char __c[1024]; } __space;
+};
+
+/* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space
+   and BUFFER->length reflects the available space.  */
+static inline void
+scratch_buffer_init (struct scratch_buffer *buffer)
+{
+  buffer->data = buffer->__space.__c;
+  buffer->length = sizeof (buffer->__space);
+}
+
+/* Deallocates *BUFFER (if it was heap-allocated).  */
+static inline void
+scratch_buffer_free (struct scratch_buffer *buffer)
+{
+  if (buffer->data != buffer->__space.__c)
+    free (buffer->data);
+}
+
+/* Grow *BUFFER by some arbitrary amount.  The buffer contents is NOT
+   preserved.  Return true on success, false on allocation failure (in
+   which case the old buffer is freed).  On success, the new buffer is
+   larger than the previous size.  On failure, *BUFFER is deallocated,
+   but remains in a free-able state, and errno is set.  */
+bool __libc_scratch_buffer_grow (struct scratch_buffer *buffer);
+libc_hidden_proto (__libc_scratch_buffer_grow)
+
+/* Alias for __libc_scratch_buffer_grow.  */
+static __always_inline bool
+scratch_buffer_grow (struct scratch_buffer *buffer)
+{
+  return __glibc_likely (__libc_scratch_buffer_grow (buffer));
+}
+
+/* Like __libc_scratch_buffer_grow, but preserve the old buffer
+   contents on success, as a prefix of the new buffer.  */
+bool __libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer);
+libc_hidden_proto (__libc_scratch_buffer_grow_preserve)
+
+/* Alias for __libc_scratch_buffer_grow_preserve.  */
+static __always_inline bool
+scratch_buffer_grow_preserve (struct scratch_buffer *buffer)
+{
+  return __glibc_likely (__libc_scratch_buffer_grow_preserve (buffer));
+}
+
+/* Grow *BUFFER so that it can store at least NELEM elements of SIZE
+   bytes.  The buffer contents are NOT preserved.  Both NELEM and SIZE
+   can be zero.  Return true on success, false on allocation failure
+   (in which case the old buffer is freed, but *BUFFER remains in a
+   free-able state, and errno is set).  It is unspecified whether this
+   function can reduce the array size.  */
+bool __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer,
+                                          size_t nelem, size_t size);
+libc_hidden_proto (__libc_scratch_buffer_set_array_size)
+
+/* Alias for __libc_scratch_set_array_size.  */
+static __always_inline bool
+scratch_buffer_set_array_size (struct scratch_buffer *buffer,
+                              size_t nelem, size_t size)
+{
+  return __glibc_likely (__libc_scratch_buffer_set_array_size
+                        (buffer, nelem, size));
+}
+
+#endif /* _SCRATCH_BUFFER_H */
deleted file mode 120000 (symlink)
index 189333cba354a9cb51f4cd05eae6b812ccac05ba..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/scratch_buffer_grow.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a5e8f2f7230ac25a6ede8b639c3eabd33fcaa44c
--- /dev/null
@@ -0,0 +1,56 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2015-2023 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <scratch_buffer.h>
+#include <errno.h>
+
+bool
+__libc_scratch_buffer_grow (struct scratch_buffer *buffer)
+{
+  void *new_ptr;
+  size_t new_length = buffer->length * 2;
+
+  /* Discard old buffer.  */
+  scratch_buffer_free (buffer);
+
+  /* Check for overflow.  */
+  if (__glibc_likely (new_length >= buffer->length))
+    new_ptr = malloc (new_length);
+  else
+    {
+      __set_errno (ENOMEM);
+      new_ptr = NULL;
+    }
+
+  if (__glibc_unlikely (new_ptr == NULL))
+    {
+      /* Buffer must remain valid to free.  */
+      scratch_buffer_init (buffer);
+      return false;
+    }
+
+  /* Install new heap-based buffer.  */
+  buffer->data = new_ptr;
+  buffer->length = new_length;
+  return true;
+}
+libc_hidden_def (__libc_scratch_buffer_grow)
deleted file mode 120000 (symlink)
index 2569c31e55b98ee155c885f7ca9173cb39bbe67d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/scratch_buffer_grow_preserve.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c0b5d87b7e44387fae011cf1b81ea96e3fb14d7a
--- /dev/null
@@ -0,0 +1,67 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2015-2023 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <scratch_buffer.h>
+#include <errno.h>
+#include <string.h>
+
+bool
+__libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer)
+{
+  size_t new_length = 2 * buffer->length;
+  void *new_ptr;
+
+  if (buffer->data == buffer->__space.__c)
+    {
+      /* Move buffer to the heap.  No overflow is possible because
+        buffer->length describes a small buffer on the stack.  */
+      new_ptr = malloc (new_length);
+      if (new_ptr == NULL)
+       return false;
+      memcpy (new_ptr, buffer->__space.__c, buffer->length);
+    }
+  else
+    {
+      /* Buffer was already on the heap.  Check for overflow.  */
+      if (__glibc_likely (new_length >= buffer->length))
+       new_ptr = realloc (buffer->data, new_length);
+      else
+       {
+         __set_errno (ENOMEM);
+         new_ptr = NULL;
+       }
+
+      if (__glibc_unlikely (new_ptr == NULL))
+       {
+         /* Deallocate, but buffer must remain valid to free.  */
+         free (buffer->data);
+         scratch_buffer_init (buffer);
+         return false;
+       }
+    }
+
+  /* Install new heap-based buffer.  */
+  buffer->data = new_ptr;
+  buffer->length = new_length;
+  return true;
+}
+libc_hidden_def (__libc_scratch_buffer_grow_preserve)
deleted file mode 120000 (symlink)
index 6ce334ba231f83424b09c5fbe7b936a5e832c5f3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloc/scratch_buffer_set_array_size.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..24c39350ade7c0ce38c74d2d99da65147c46e4b2
--- /dev/null
@@ -0,0 +1,64 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2015-2023 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <scratch_buffer.h>
+#include <errno.h>
+#include <limits.h>
+
+bool
+__libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer,
+                                     size_t nelem, size_t size)
+{
+  size_t new_length = nelem * size;
+
+  /* Avoid overflow check if both values are small. */
+  if ((nelem | size) >> (sizeof (size_t) * CHAR_BIT / 2) != 0
+      && nelem != 0 && size != new_length / nelem)
+    {
+      /* Overflow.  Discard the old buffer, but it must remain valid
+        to free.  */
+      scratch_buffer_free (buffer);
+      scratch_buffer_init (buffer);
+      __set_errno (ENOMEM);
+      return false;
+    }
+
+  if (new_length <= buffer->length)
+    return true;
+
+  /* Discard old buffer.  */
+  scratch_buffer_free (buffer);
+
+  char *new_ptr = malloc (new_length);
+  if (new_ptr == NULL)
+    {
+      /* Buffer must remain valid to free.  */
+      scratch_buffer_init (buffer);
+      return false;
+    }
+
+  /* Install new heap-based buffer.  */
+  buffer->data = new_ptr;
+  buffer->length = new_length;
+  return true;
+}
+libc_hidden_def (__libc_scratch_buffer_set_array_size)
deleted file mode 120000 (symlink)
index 1d4c0d224518421929878faf9fdeeb17939292f7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloca.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e75c72df84ce4ef35a3c94d71b4b4e8eaffa70d5
--- /dev/null
@@ -0,0 +1,135 @@
+/* Safe automatic memory allocation.
+   Copyright (C) 2003, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2003, 2018.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define _GL_USE_STDLIB_ALLOC 1
+#include <config.h>
+
+/* Specification.  */
+#include "malloca.h"
+
+#include <stdckdint.h>
+#if defined __CHERI_PURE_CAPABILITY__
+# include <cheri.h>
+#endif
+
+#include "idx.h"
+
+/* The speed critical point in this file is freea() applied to an alloca()
+   result: it must be fast, to match the speed of alloca().  The speed of
+   mmalloca() and freea() in the other case are not critical, because they
+   are only invoked for big memory sizes.
+   Here we use a bit in the address as an indicator, an idea by Ondřej Bílka.
+   malloca() can return three types of pointers:
+     - Pointers ≡ 0 mod 2*sa_alignment_max come from stack allocation.
+     - Pointers ≡ sa_alignment_max mod 2*sa_alignment_max come from heap
+       allocation.
+     - NULL comes from a failed heap allocation.  */
+
+#if defined __CHERI_PURE_CAPABILITY__
+/* Type for holding the original malloc() result.  */
+typedef uintptr_t small_t;
+#else
+/* Type for holding very small pointer differences.  */
+typedef unsigned char small_t;
+/* Verify that it is wide enough.  */
+static_assert (2 * sa_alignment_max - 1 <= (small_t) -1);
+#endif
+
+void *
+mmalloca (size_t n)
+{
+#if HAVE_ALLOCA
+  /* Allocate one more word, used to determine the address to pass to freea(),
+     and room for the alignment ≡ sa_alignment_max mod 2*sa_alignment_max.  */
+  uintptr_t alignment2_mask = 2 * sa_alignment_max - 1;
+  int plus = sizeof (small_t) + alignment2_mask;
+  idx_t nplus;
+  if (!ckd_add (&nplus, n, plus) && !xalloc_oversized (nplus, 1))
+    {
+      char *mem = (char *) malloc (nplus);
+
+      if (mem != NULL)
+        {
+          uintptr_t umem = (uintptr_t) mem;
+          /* The ckd_add avoids signed integer overflow on
+             theoretical platforms where UINTPTR_MAX <= INT_MAX.  */
+          uintptr_t umemplus;
+          ckd_add (&umemplus, umem, sizeof (small_t) + sa_alignment_max - 1);
+          idx_t offset = (umemplus - umemplus % (2 * sa_alignment_max)
+                          + sa_alignment_max - umem);
+          void *p = mem + offset;
+          /* Here p >= mem + sizeof (small_t),
+             and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1
+             hence p + n <= mem + nplus.
+             So, the memory range [p, p+n) lies in the allocated memory range
+             [mem, mem + nplus).  */
+          small_t *sp = p;
+# if defined __CHERI_PURE_CAPABILITY__
+          sp[-1] = umem;
+          p = (char *) cheri_bounds_set ((char *) p - sizeof (small_t),
+                                         sizeof (small_t) + n)
+              + sizeof (small_t);
+# else
+          sp[-1] = offset;
+# endif
+          /* p ≡ sa_alignment_max mod 2*sa_alignment_max.  */
+          return p;
+        }
+    }
+  /* Out of memory.  */
+  return NULL;
+#else
+# if !MALLOC_0_IS_NONNULL
+  if (n == 0)
+    n = 1;
+# endif
+  return malloc (n);
+#endif
+}
+
+#if HAVE_ALLOCA
+void
+freea (void *p)
+{
+  /* Check argument.  */
+  uintptr_t u = (uintptr_t) p;
+  if (u & (sa_alignment_max - 1))
+    {
+      /* p was not the result of a malloca() call.  Invalid argument.  */
+      abort ();
+    }
+  /* Determine whether p was a non-NULL pointer returned by mmalloca().  */
+  if (u & sa_alignment_max)
+    {
+      char *cp = p;
+      small_t *sp = p;
+# if defined __CHERI_PURE_CAPABILITY__
+      void *mem = sp[-1];
+# else
+      void *mem = cp - sp[-1];
+# endif
+      free (mem);
+    }
+}
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index d0fffd63e01acb95d01e938d4e2cc3bfa65bd80d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/malloca.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c52084217189efad4f7875d41e47adb7f5e95c46
--- /dev/null
@@ -0,0 +1,147 @@
+/* Safe automatic memory allocation.
+   Copyright (C) 2003-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2003.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _MALLOCA_H
+#define _MALLOCA_H
+
+/* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_DEALLOC,
+   _GL_ATTRIBUTE_MALLOC, HAVE_ALLOCA.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <alloca.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdint.h>
+#if defined __CHERI_PURE_CAPABILITY__
+# include <cheri.h>
+#endif
+
+#include "xalloc-oversized.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call
+   alloca(N); otherwise it returns NULL.  It either returns N bytes of
+   memory allocated on the stack, that lasts until the function returns,
+   or NULL.
+   Use of safe_alloca should be avoided:
+     - inside arguments of function calls - undefined behaviour,
+     - in inline functions - the allocation may actually last until the
+       calling function returns.
+*/
+#if HAVE_ALLOCA
+/* The OS usually guarantees only one guard page at the bottom of the stack,
+   and a page size can be as small as 4096 bytes.  So we cannot safely
+   allocate anything larger than 4096 bytes.  Also care for the possibility
+   of a few compiler-allocated temporary stack slots.
+   This must be a macro, not a function.  */
+# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL)
+#else
+# define safe_alloca(N) ((void) (N), NULL)
+#endif
+
+/* Free a block of memory allocated through malloca().  */
+#if HAVE_ALLOCA
+extern void freea (void *p);
+#else
+# define freea free
+#endif
+
+/* malloca(N) is a safe variant of alloca(N).  It allocates N bytes of
+   memory allocated on the stack, that must be freed using freea() before
+   the function returns.  Upon failure, it returns NULL.  */
+#if HAVE_ALLOCA
+# if defined __CHERI_PURE_CAPABILITY__
+#  define malloca(N) \
+    ((N) < 4032 - (2 * sa_alignment_max - 1)                                  \
+     ? cheri_bounds_set ((void *) (((uintptr_t)                               \
+                                     (char *)                                 \
+                                      alloca ((N) + 2 * sa_alignment_max - 1) \
+                                    + (2 * sa_alignment_max - 1))             \
+                                   & ~(uintptr_t)(2 * sa_alignment_max - 1)), \
+                         (N))                                                 \
+     : mmalloca (N))
+# else
+#  define malloca(N) \
+    ((N) < 4032 - (2 * sa_alignment_max - 1)                                   \
+     ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \
+                  + (2 * sa_alignment_max - 1))                                \
+                 & ~(uintptr_t)(2 * sa_alignment_max - 1))                     \
+     : mmalloca (N))
+# endif
+#else
+# define malloca(N) \
+  mmalloca (N)
+#endif
+extern void *mmalloca (size_t n)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (freea, 1)
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1));
+
+/* nmalloca(N,S) is an overflow-safe variant of malloca (N * S).
+   It allocates an array of N objects, each with S bytes of memory,
+   on the stack.  N and S should be nonnegative and free of side effects.
+   The array must be freed using freea() before the function returns.  */
+#define nmalloca(n, s) \
+  (xalloc_oversized (n, s) ? NULL : malloca ((n) * (size_t) (s)))
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/* ------------------- Auxiliary, non-public definitions ------------------- */
+
+/* Determine the alignment of a type at compile time.  */
+#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__
+# define sa_alignof __alignof__
+#elif defined __cplusplus
+  template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
+# define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2)
+#elif defined __hpux
+  /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
+     values.  */
+# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
+#elif defined _AIX
+  /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof
+     values.  */
+# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
+#else
+# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
+#endif
+
+enum
+{
+/* The desired alignment of memory allocations is the maximum alignment
+   among all elementary types.  */
+  sa_alignment_long = sa_alignof (long),
+  sa_alignment_double = sa_alignof (double),
+  sa_alignment_longlong = sa_alignof (long long),
+  sa_alignment_longdouble = sa_alignof (long double),
+  sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
+                      | (sa_alignment_longlong - 1)
+                      | (sa_alignment_longdouble - 1)
+                     ) + 1
+};
+
+#endif /* _MALLOCA_H */
deleted file mode 120000 (symlink)
index d41fbc70c3247de82081b1d6ba2578c08c43b3d6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/math.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..78da4d4acad4c0c395a837754586263d1f07c59e
--- /dev/null
@@ -0,0 +1,22 @@
+/* Inline functions for <math.h>.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_MATH_INLINE _GL_EXTERN_INLINE
+#include <math.h>
+typedef int dummy;
deleted file mode 120000 (symlink)
index c68d3c030b532b055f440948f7fbee4787f5f41b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/math.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..72a61d704478905ecdb75dd687fd71433c67010b
--- /dev/null
+/* A GNU-like <math.h>.
+
+   Copyright (C) 2002-2003, 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* On Android, in C++ mode, when /usr/include/c++/v1/math.h is being included
+   and /usr/include/math.h has not yet been included, skip this file, since it
+   would lead to many syntax errors.  */
+#if !(defined __ANDROID__ && defined _LIBCPP_MATH_H && !defined INFINITY)
+
+#ifndef _@GUARD_PREFIX@_MATH_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined _GL_INCLUDING_MATH_H
+/* Special invocation convention:
+   - On FreeBSD 12.2 we have a sequence of nested includes
+     <math.h> -> <stdlib.h> -> <sys/wait.h> -> <sys/types.h> -> <sys/select.h>
+       -> <signal.h> -> <pthread.h> -> <stdlib.h> -> <math.h>
+     In this situation, the functions are not yet declared, therefore we cannot
+     provide the C++ aliases.  */
+
+#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
+
+#else
+/* Normal invocation convention.  */
+
+/* The include_next requires a split double-inclusion guard.  */
+#define _GL_INCLUDING_MATH_H
+#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
+#undef _GL_INCLUDING_MATH_H
+
+#ifndef _@GUARD_PREFIX@_MATH_H
+#define _@GUARD_PREFIX@_MATH_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_CONST,
+   GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* On OpenVMS, NAN, INFINITY, and HUGEVAL macros are defined in <fp.h>.  */
+#if defined __VMS && ! defined NAN
+# include <fp.h>
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_MATH_INLINE
+# define _GL_MATH_INLINE _GL_INLINE
+#endif
+
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __const__ was added in gcc 2.95.  */
+#ifndef _GL_ATTRIBUTE_CONST
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__
+#  define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
+# else
+#  define _GL_ATTRIBUTE_CONST /* empty */
+# endif
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+#ifdef __cplusplus
+/* Helper macros to define type-generic function FUNC as overloaded functions,
+   rather than as macros like in C.  POSIX declares these with an argument of
+   real-floating (that is, one of float, double, or long double).  */
+# define _GL_MATH_CXX_REAL_FLOATING_DECL_1(func) \
+static inline int                                                   \
+_gl_cxx_ ## func ## f (float f)                                     \
+{                                                                   \
+  return func (f);                                                  \
+}                                                                   \
+static inline int                                                   \
+_gl_cxx_ ## func ## d (double d)                                    \
+{                                                                   \
+  return func (d);                                                  \
+}                                                                   \
+static inline int                                                   \
+_gl_cxx_ ## func ## l (long double l)                               \
+{                                                                   \
+  return func (l);                                                  \
+}
+# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func,rpl_func,rettype) \
+_GL_BEGIN_NAMESPACE                                                 \
+inline rettype                                                      \
+rpl_func (float f)                                                  \
+{                                                                   \
+  return _gl_cxx_ ## func ## f (f);                                 \
+}                                                                   \
+inline rettype                                                      \
+rpl_func (double d)                                                 \
+{                                                                   \
+  return _gl_cxx_ ## func ## d (d);                                 \
+}                                                                   \
+inline rettype                                                      \
+rpl_func (long double l)                                            \
+{                                                                   \
+  return _gl_cxx_ ## func ## l (l);                                 \
+}                                                                   \
+_GL_END_NAMESPACE
+#endif
+
+/* Helper macros to define a portability warning for the
+   classification macro FUNC called with VALUE.  POSIX declares the
+   classification macros with an argument of real-floating (that is,
+   one of float, double, or long double).  */
+#define _GL_WARN_REAL_FLOATING_DECL(func) \
+_GL_MATH_INLINE int                                                       \
+_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - "                      \
+                           "use gnulib module " #func " for portability") \
+rpl_ ## func ## f (float f)                                               \
+{                                                                         \
+  return func (f);                                                        \
+}                                                                         \
+_GL_MATH_INLINE int                                                       \
+_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - "                      \
+                           "use gnulib module " #func " for portability") \
+rpl_ ## func ## d (double d)                                              \
+{                                                                         \
+  return func (d);                                                        \
+}                                                                         \
+_GL_MATH_INLINE int                                                       \
+_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - "                      \
+                           "use gnulib module " #func " for portability") \
+rpl_ ## func ## l (long double l)                                         \
+{                                                                         \
+  return func (l);                                                        \
+}
+#define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
+  (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value)     \
+   : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value)  \
+   : rpl_ ## func ## l (value))
+
+
+#if @REPLACE_ITOLD@
+/* Pull in a function that fixes the 'int' to 'long double' conversion
+   of glibc 2.7.  */
+_GL_EXTERN_C void _Qp_itoq (long double *, int);
+static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq;
+#endif
+
+
+/* POSIX allows platforms that don't support NAN.  But all major
+   machines in the past 15 years have supported something close to
+   IEEE NaN, so we define this unconditionally.  We also must define
+   it on platforms like Solaris 10, where NAN is present but defined
+   as a function pointer rather than a floating point constant.  */
+#if !defined NAN || @REPLACE_NAN@
+# if !GNULIB_defined_NAN
+#  undef NAN
+  /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler
+     choke on the expression 0.0 / 0.0.  */
+#  if defined __DECC || defined _MSC_VER
+_GL_MATH_INLINE float
+_NaN ()
+{
+  static float zero = 0.0f;
+  return zero / zero;
+}
+#   define NAN (_NaN())
+#  else
+#   define NAN (0.0f / 0.0f)
+#  endif
+#  define GNULIB_defined_NAN 1
+# endif
+#endif
+
+/* Solaris 10 defines HUGE_VAL, but as a function pointer rather
+   than a floating point constant.  */
+#if @REPLACE_HUGE_VAL@
+# undef HUGE_VALF
+# define HUGE_VALF (1.0f / 0.0f)
+# undef HUGE_VAL
+# define HUGE_VAL (1.0 / 0.0)
+# undef HUGE_VALL
+# define HUGE_VALL (1.0L / 0.0L)
+#endif
+
+/* HUGE_VALF is a 'float' Infinity.  */
+#ifndef HUGE_VALF
+# if defined _MSC_VER
+/* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f.  */
+#  define HUGE_VALF (1e25f * 1e25f)
+# else
+#  define HUGE_VALF (1.0f / 0.0f)
+# endif
+#endif
+
+/* HUGE_VAL is a 'double' Infinity.  */
+#ifndef HUGE_VAL
+# if defined _MSC_VER
+/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0.  */
+#  define HUGE_VAL (1e250 * 1e250)
+# else
+#  define HUGE_VAL (1.0 / 0.0)
+# endif
+#endif
+
+/* HUGE_VALL is a 'long double' Infinity.  */
+#ifndef HUGE_VALL
+# if defined _MSC_VER
+/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L.  */
+#  define HUGE_VALL (1e250L * 1e250L)
+# else
+#  define HUGE_VALL (1.0L / 0.0L)
+# endif
+#endif
+
+
+#if defined FP_ILOGB0 && defined FP_ILOGBNAN
+ /* Ensure FP_ILOGB0 and FP_ILOGBNAN are correct.  */
+# if defined __HAIKU__
+  /* Haiku: match what ilogb() does */
+#  undef FP_ILOGB0
+#  undef FP_ILOGBNAN
+#  define FP_ILOGB0   (- 2147483647 - 1) /* INT_MIN */
+#  define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# endif
+#else
+ /* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined.  */
+# if defined __NetBSD__ || defined __sgi
+  /* NetBSD, IRIX 6.5: match what ilogb() does */
+#  define FP_ILOGB0   (- 2147483647 - 1) /* INT_MIN */
+#  define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# elif defined _AIX
+  /* AIX 5.1: match what ilogb() does in AIX >= 5.2 */
+#  define FP_ILOGB0   (- 2147483647 - 1) /* INT_MIN */
+#  define FP_ILOGBNAN 2147483647 /* INT_MAX */
+# elif defined __sun
+  /* Solaris 9: match what ilogb() does */
+#  define FP_ILOGB0   (- 2147483647) /* - INT_MAX */
+#  define FP_ILOGBNAN 2147483647 /* INT_MAX */
+# else
+  /* Gnulib defined values.  */
+#  define FP_ILOGB0   (- 2147483647) /* - INT_MAX */
+#  define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# endif
+#endif
+
+
+#if @GNULIB_ACOSF@
+# if @REPLACE_ACOSF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef acosf
+#   define acosf rpl_acosf
+#  endif
+_GL_FUNCDECL_RPL (acosf, float, (float x));
+_GL_CXXALIAS_RPL (acosf, float, (float x));
+# else
+#  if !@HAVE_ACOSF@
+#   undef acosf
+_GL_FUNCDECL_SYS (acosf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (acosf, float, (float x));
+# endif
+_GL_CXXALIASWARN (acosf);
+#elif defined GNULIB_POSIXCHECK
+# undef acosf
+# if HAVE_RAW_DECL_ACOSF
+_GL_WARN_ON_USE (acosf, "acosf is unportable - "
+                 "use gnulib module acosf for portability");
+# endif
+#endif
+
+#if @GNULIB_ACOSL@
+# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
+#  undef acosl
+_GL_FUNCDECL_SYS (acosl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (acosl, long double, (long double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (acosl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef acosl
+# if HAVE_RAW_DECL_ACOSL
+_GL_WARN_ON_USE (acosl, "acosl is unportable - "
+                 "use gnulib module acosl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ASINF@
+# if @REPLACE_ASINF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef asinf
+#   define asinf rpl_asinf
+#  endif
+_GL_FUNCDECL_RPL (asinf, float, (float x));
+_GL_CXXALIAS_RPL (asinf, float, (float x));
+# else
+#  if !@HAVE_ASINF@
+#   undef asinf
+_GL_FUNCDECL_SYS (asinf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (asinf, float, (float x));
+# endif
+_GL_CXXALIASWARN (asinf);
+#elif defined GNULIB_POSIXCHECK
+# undef asinf
+# if HAVE_RAW_DECL_ASINF
+_GL_WARN_ON_USE (asinf, "asinf is unportable - "
+                 "use gnulib module asinf for portability");
+# endif
+#endif
+
+#if @GNULIB_ASINL@
+# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
+#  undef asinl
+_GL_FUNCDECL_SYS (asinl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (asinl, long double, (long double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (asinl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef asinl
+# if HAVE_RAW_DECL_ASINL
+_GL_WARN_ON_USE (asinl, "asinl is unportable - "
+                 "use gnulib module asinl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ATANF@
+# if @REPLACE_ATANF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef atanf
+#   define atanf rpl_atanf
+#  endif
+_GL_FUNCDECL_RPL (atanf, float, (float x));
+_GL_CXXALIAS_RPL (atanf, float, (float x));
+# else
+#  if !@HAVE_ATANF@
+#   undef atanf
+_GL_FUNCDECL_SYS (atanf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (atanf, float, (float x));
+# endif
+_GL_CXXALIASWARN (atanf);
+#elif defined GNULIB_POSIXCHECK
+# undef atanf
+# if HAVE_RAW_DECL_ATANF
+_GL_WARN_ON_USE (atanf, "atanf is unportable - "
+                 "use gnulib module atanf for portability");
+# endif
+#endif
+
+#if @GNULIB_ATANL@
+# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
+#  undef atanl
+_GL_FUNCDECL_SYS (atanl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (atanl, long double, (long double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (atanl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef atanl
+# if HAVE_RAW_DECL_ATANL
+_GL_WARN_ON_USE (atanl, "atanl is unportable - "
+                 "use gnulib module atanl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ATAN2F@
+# if @REPLACE_ATAN2F@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef atan2f
+#   define atan2f rpl_atan2f
+#  endif
+_GL_FUNCDECL_RPL (atan2f, float, (float y, float x));
+_GL_CXXALIAS_RPL (atan2f, float, (float y, float x));
+# else
+#  if !@HAVE_ATAN2F@
+#   undef atan2f
+_GL_FUNCDECL_SYS (atan2f, float, (float y, float x));
+#  endif
+_GL_CXXALIAS_SYS (atan2f, float, (float y, float x));
+# endif
+_GL_CXXALIASWARN (atan2f);
+#elif defined GNULIB_POSIXCHECK
+# undef atan2f
+# if HAVE_RAW_DECL_ATAN2F
+_GL_WARN_ON_USE (atan2f, "atan2f is unportable - "
+                 "use gnulib module atan2f for portability");
+# endif
+#endif
+
+
+#if @GNULIB_CBRTF@
+# if @REPLACE_CBRTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef cbrtf
+#   define cbrtf rpl_cbrtf
+#  endif
+_GL_FUNCDECL_RPL (cbrtf, float, (float x));
+_GL_CXXALIAS_RPL (cbrtf, float, (float x));
+# else
+#  if !@HAVE_DECL_CBRTF@
+_GL_FUNCDECL_SYS (cbrtf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (cbrtf, float, (float x));
+# endif
+_GL_CXXALIASWARN (cbrtf);
+#elif defined GNULIB_POSIXCHECK
+# undef cbrtf
+# if HAVE_RAW_DECL_CBRTF
+_GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - "
+                 "use gnulib module cbrtf for portability");
+# endif
+#endif
+
+#if @GNULIB_CBRT@
+# if !@HAVE_CBRT@
+_GL_FUNCDECL_SYS (cbrt, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (cbrt, double, (double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (cbrt, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef cbrt
+# if HAVE_RAW_DECL_CBRT
+_GL_WARN_ON_USE (cbrt, "cbrt is unportable - "
+                 "use gnulib module cbrt for portability");
+# endif
+#endif
+
+#if @GNULIB_CBRTL@
+# if @REPLACE_CBRTL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef cbrtl
+#   define cbrtl rpl_cbrtl
+#  endif
+_GL_FUNCDECL_RPL (cbrtl, long double, (long double x));
+_GL_CXXALIAS_RPL (cbrtl, long double, (long double x));
+# else
+#  if !@HAVE_DECL_CBRTL@
+_GL_FUNCDECL_SYS (cbrtl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (cbrtl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (cbrtl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef cbrtl
+# if HAVE_RAW_DECL_CBRTL
+_GL_WARN_ON_USE (cbrtl, "cbrtl is unportable - "
+                 "use gnulib module cbrtl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_CEILF@
+# if @REPLACE_CEILF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ceilf
+#   define ceilf rpl_ceilf
+#  endif
+_GL_FUNCDECL_RPL (ceilf, float, (float x));
+_GL_CXXALIAS_RPL (ceilf, float, (float x));
+# else
+#  if !@HAVE_DECL_CEILF@
+#   undef ceilf
+_GL_FUNCDECL_SYS (ceilf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (ceilf, float, (float x));
+# endif
+_GL_CXXALIASWARN (ceilf);
+#elif defined GNULIB_POSIXCHECK
+# undef ceilf
+# if HAVE_RAW_DECL_CEILF
+_GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
+                 "use gnulib module ceilf for portability");
+# endif
+#endif
+
+#if @GNULIB_CEIL@
+# if @REPLACE_CEIL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ceil
+#   define ceil rpl_ceil
+#  endif
+_GL_FUNCDECL_RPL (ceil, double, (double x));
+_GL_CXXALIAS_RPL (ceil, double, (double x));
+# else
+_GL_CXXALIAS_SYS (ceil, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (ceil, double, (double x));
+# endif
+#endif
+
+#if @GNULIB_CEILL@
+# if @REPLACE_CEILL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ceill
+#   define ceill rpl_ceill
+#  endif
+_GL_FUNCDECL_RPL (ceill, long double, (long double x));
+_GL_CXXALIAS_RPL (ceill, long double, (long double x));
+# else
+#  if !@HAVE_DECL_CEILL@
+#   undef ceill
+_GL_FUNCDECL_SYS (ceill, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (ceill, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (ceill);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ceill
+# if HAVE_RAW_DECL_CEILL
+_GL_WARN_ON_USE (ceill, "ceill is unportable - "
+                 "use gnulib module ceill for portability");
+# endif
+#endif
+
+
+#if @GNULIB_COPYSIGNF@
+# if !@HAVE_DECL_COPYSIGNF@
+#  undef copysignf
+_GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
+# endif
+_GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
+_GL_CXXALIASWARN (copysignf);
+#elif defined GNULIB_POSIXCHECK
+# undef copysignf
+# if HAVE_RAW_DECL_COPYSIGNF
+_GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
+                 "use gnulib module copysignf for portability");
+# endif
+#endif
+
+#if @GNULIB_COPYSIGN@
+# if !@HAVE_COPYSIGN@
+_GL_FUNCDECL_SYS (copysign, double, (double x, double y));
+# endif
+_GL_CXXALIAS_SYS (copysign, double, (double x, double y));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (copysign, double, (double x, double y));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef copysign
+# if HAVE_RAW_DECL_COPYSIGN
+_GL_WARN_ON_USE (copysign, "copysign is unportable - "
+                 "use gnulib module copysign for portability");
+# endif
+#endif
+
+#if @GNULIB_COPYSIGNL@
+# if !@HAVE_COPYSIGNL@
+_GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y));
+# endif
+_GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (copysignl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef copysignl
+# if HAVE_RAW_DECL_COPYSIGNL
+_GL_WARN_ON_USE (copysign, "copysignl is unportable - "
+                 "use gnulib module copysignl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_COSF@
+# if @REPLACE_COSF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef cosf
+#   define cosf rpl_cosf
+#  endif
+_GL_FUNCDECL_RPL (cosf, float, (float x));
+_GL_CXXALIAS_RPL (cosf, float, (float x));
+# else
+#  if !@HAVE_COSF@
+#   undef cosf
+_GL_FUNCDECL_SYS (cosf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (cosf, float, (float x));
+# endif
+_GL_CXXALIASWARN (cosf);
+#elif defined GNULIB_POSIXCHECK
+# undef cosf
+# if HAVE_RAW_DECL_COSF
+_GL_WARN_ON_USE (cosf, "cosf is unportable - "
+                 "use gnulib module cosf for portability");
+# endif
+#endif
+
+#if @GNULIB_COSL@
+# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
+#  undef cosl
+_GL_FUNCDECL_SYS (cosl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (cosl, long double, (long double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (cosl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef cosl
+# if HAVE_RAW_DECL_COSL
+_GL_WARN_ON_USE (cosl, "cosl is unportable - "
+                 "use gnulib module cosl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_COSHF@
+# if @REPLACE_COSHF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef coshf
+#   define coshf rpl_coshf
+#  endif
+_GL_FUNCDECL_RPL (coshf, float, (float x));
+_GL_CXXALIAS_RPL (coshf, float, (float x));
+# else
+#  if !@HAVE_COSHF@
+#   undef coshf
+_GL_FUNCDECL_SYS (coshf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (coshf, float, (float x));
+# endif
+_GL_CXXALIASWARN (coshf);
+#elif defined GNULIB_POSIXCHECK
+# undef coshf
+# if HAVE_RAW_DECL_COSHF
+_GL_WARN_ON_USE (coshf, "coshf is unportable - "
+                 "use gnulib module coshf for portability");
+# endif
+#endif
+
+
+#if @GNULIB_EXPF@
+# if @REPLACE_EXPF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef expf
+#   define expf rpl_expf
+#  endif
+_GL_FUNCDECL_RPL (expf, float, (float x));
+_GL_CXXALIAS_RPL (expf, float, (float x));
+# else
+#  if !@HAVE_EXPF@
+#   undef expf
+_GL_FUNCDECL_SYS (expf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (expf, float, (float x));
+# endif
+_GL_CXXALIASWARN (expf);
+#elif defined GNULIB_POSIXCHECK
+# undef expf
+# if HAVE_RAW_DECL_EXPF
+_GL_WARN_ON_USE (expf, "expf is unportable - "
+                 "use gnulib module expf for portability");
+# endif
+#endif
+
+#if @GNULIB_EXPL@
+# if @REPLACE_EXPL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef expl
+#   define expl rpl_expl
+#  endif
+_GL_FUNCDECL_RPL (expl, long double, (long double x));
+_GL_CXXALIAS_RPL (expl, long double, (long double x));
+# else
+#  if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
+#   undef expl
+_GL_FUNCDECL_SYS (expl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (expl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (expl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef expl
+# if HAVE_RAW_DECL_EXPL
+_GL_WARN_ON_USE (expl, "expl is unportable - "
+                 "use gnulib module expl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_EXP2F@
+# if !@HAVE_DECL_EXP2F@
+_GL_FUNCDECL_SYS (exp2f, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (exp2f, float, (float x));
+_GL_CXXALIASWARN (exp2f);
+#elif defined GNULIB_POSIXCHECK
+# undef exp2f
+# if HAVE_RAW_DECL_EXP2F
+_GL_WARN_ON_USE (exp2f, "exp2f is unportable - "
+                 "use gnulib module exp2f for portability");
+# endif
+#endif
+
+#if @GNULIB_EXP2@
+# if @REPLACE_EXP2@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef exp2
+#   define exp2 rpl_exp2
+#  endif
+_GL_FUNCDECL_RPL (exp2, double, (double x));
+_GL_CXXALIAS_RPL (exp2, double, (double x));
+# else
+#  if !@HAVE_DECL_EXP2@
+_GL_FUNCDECL_SYS (exp2, double, (double x));
+#  endif
+_GL_CXXALIAS_SYS (exp2, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (exp2, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef exp2
+# if HAVE_RAW_DECL_EXP2
+_GL_WARN_ON_USE (exp2, "exp2 is unportable - "
+                 "use gnulib module exp2 for portability");
+# endif
+#endif
+
+#if @GNULIB_EXP2L@
+# if @REPLACE_EXP2L@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef exp2l
+#   define exp2l rpl_exp2l
+#  endif
+_GL_FUNCDECL_RPL (exp2l, long double, (long double x));
+_GL_CXXALIAS_RPL (exp2l, long double, (long double x));
+# else
+#  if !@HAVE_DECL_EXP2L@
+#   undef exp2l
+_GL_FUNCDECL_SYS (exp2l, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (exp2l, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (exp2l);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef exp2l
+# if HAVE_RAW_DECL_EXP2L
+_GL_WARN_ON_USE (exp2l, "exp2l is unportable - "
+                 "use gnulib module exp2l for portability");
+# endif
+#endif
+
+
+#if @GNULIB_EXPM1F@
+# if @REPLACE_EXPM1F@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef expm1f
+#   define expm1f rpl_expm1f
+#  endif
+_GL_FUNCDECL_RPL (expm1f, float, (float x));
+_GL_CXXALIAS_RPL (expm1f, float, (float x));
+# else
+#  if !@HAVE_EXPM1F@
+_GL_FUNCDECL_SYS (expm1f, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (expm1f, float, (float x));
+# endif
+_GL_CXXALIASWARN (expm1f);
+#elif defined GNULIB_POSIXCHECK
+# undef expm1f
+# if HAVE_RAW_DECL_EXPM1F
+_GL_WARN_ON_USE (expm1f, "expm1f is unportable - "
+                 "use gnulib module expm1f for portability");
+# endif
+#endif
+
+#if @GNULIB_EXPM1@
+# if @REPLACE_EXPM1@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef expm1
+#   define expm1 rpl_expm1
+#  endif
+_GL_FUNCDECL_RPL (expm1, double, (double x));
+_GL_CXXALIAS_RPL (expm1, double, (double x));
+# else
+#  if !@HAVE_EXPM1@
+_GL_FUNCDECL_SYS (expm1, double, (double x));
+#  endif
+_GL_CXXALIAS_SYS (expm1, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (expm1, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef expm1
+# if HAVE_RAW_DECL_EXPM1
+_GL_WARN_ON_USE (expm1, "expm1 is unportable - "
+                 "use gnulib module expm1 for portability");
+# endif
+#endif
+
+#if @GNULIB_EXPM1L@
+# if @REPLACE_EXPM1L@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef expm1l
+#   define expm1l rpl_expm1l
+#  endif
+_GL_FUNCDECL_RPL (expm1l, long double, (long double x));
+_GL_CXXALIAS_RPL (expm1l, long double, (long double x));
+# else
+#  if !@HAVE_DECL_EXPM1L@
+#   undef expm1l
+#   if !(defined __cplusplus && defined _AIX)
+_GL_FUNCDECL_SYS (expm1l, long double, (long double x));
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (expm1l, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (expm1l);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef expm1l
+# if HAVE_RAW_DECL_EXPM1L
+_GL_WARN_ON_USE (expm1l, "expm1l is unportable - "
+                 "use gnulib module expm1l for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FABSF@
+# if !@HAVE_FABSF@
+#  undef fabsf
+_GL_FUNCDECL_SYS (fabsf, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (fabsf, float, (float x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fabsf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fabsf
+# if HAVE_RAW_DECL_FABSF
+_GL_WARN_ON_USE (fabsf, "fabsf is unportable - "
+                 "use gnulib module fabsf for portability");
+# endif
+#endif
+
+#if @GNULIB_FABSL@
+# if @REPLACE_FABSL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fabsl
+#   define fabsl rpl_fabsl
+#  endif
+_GL_FUNCDECL_RPL (fabsl, long double, (long double x));
+_GL_CXXALIAS_RPL (fabsl, long double, (long double x));
+# else
+#  if !@HAVE_FABSL@
+#   undef fabsl
+_GL_FUNCDECL_SYS (fabsl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (fabsl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fabsl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fabsl
+# if HAVE_RAW_DECL_FABSL
+_GL_WARN_ON_USE (fabsl, "fabsl is unportable - "
+                 "use gnulib module fabsl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FLOORF@
+# if @REPLACE_FLOORF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef floorf
+#   define floorf rpl_floorf
+#  endif
+_GL_FUNCDECL_RPL (floorf, float, (float x));
+_GL_CXXALIAS_RPL (floorf, float, (float x));
+# else
+#  if !@HAVE_DECL_FLOORF@
+#   undef floorf
+_GL_FUNCDECL_SYS (floorf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (floorf, float, (float x));
+# endif
+_GL_CXXALIASWARN (floorf);
+#elif defined GNULIB_POSIXCHECK
+# undef floorf
+# if HAVE_RAW_DECL_FLOORF
+_GL_WARN_ON_USE (floorf, "floorf is unportable - "
+                 "use gnulib module floorf for portability");
+# endif
+#endif
+
+#if @GNULIB_FLOOR@
+# if @REPLACE_FLOOR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef floor
+#   define floor rpl_floor
+#  endif
+_GL_FUNCDECL_RPL (floor, double, (double x));
+_GL_CXXALIAS_RPL (floor, double, (double x));
+# else
+_GL_CXXALIAS_SYS (floor, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (floor, double, (double x));
+# endif
+#endif
+
+#if @GNULIB_FLOORL@
+# if @REPLACE_FLOORL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef floorl
+#   define floorl rpl_floorl
+#  endif
+_GL_FUNCDECL_RPL (floorl, long double, (long double x));
+_GL_CXXALIAS_RPL (floorl, long double, (long double x));
+# else
+#  if !@HAVE_DECL_FLOORL@
+#   undef floorl
+_GL_FUNCDECL_SYS (floorl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (floorl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (floorl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef floorl
+# if HAVE_RAW_DECL_FLOORL
+_GL_WARN_ON_USE (floorl, "floorl is unportable - "
+                 "use gnulib module floorl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FMAF@
+# if @REPLACE_FMAF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fmaf
+#   define fmaf rpl_fmaf
+#  endif
+_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z));
+_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
+# else
+#  if !@HAVE_FMAF@
+#   undef fmaf
+_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z));
+#  endif
+_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
+# endif
+_GL_CXXALIASWARN (fmaf);
+#elif defined GNULIB_POSIXCHECK
+# undef fmaf
+# if HAVE_RAW_DECL_FMAF
+_GL_WARN_ON_USE (fmaf, "fmaf is unportable - "
+                 "use gnulib module fmaf for portability");
+# endif
+#endif
+
+#if @GNULIB_FMA@
+# if @REPLACE_FMA@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fma
+#   define fma rpl_fma
+#  endif
+_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z));
+_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
+# else
+#  if !@HAVE_FMA@
+#   undef fma
+_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z));
+#  endif
+_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (fma, double, (double x, double y, double z));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fma
+# if HAVE_RAW_DECL_FMA
+_GL_WARN_ON_USE (fma, "fma is unportable - "
+                 "use gnulib module fma for portability");
+# endif
+#endif
+
+#if @GNULIB_FMAL@
+# if @REPLACE_FMAL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fmal
+#   define fmal rpl_fmal
+#  endif
+_GL_FUNCDECL_RPL (fmal, long double,
+                  (long double x, long double y, long double z));
+_GL_CXXALIAS_RPL (fmal, long double,
+                  (long double x, long double y, long double z));
+# else
+#  if !@HAVE_FMAL@
+#   undef fmal
+#   if !(defined __cplusplus && defined _AIX)
+_GL_FUNCDECL_SYS (fmal, long double,
+                  (long double x, long double y, long double z));
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (fmal, long double,
+                  (long double x, long double y, long double z));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fmal);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fmal
+# if HAVE_RAW_DECL_FMAL
+_GL_WARN_ON_USE (fmal, "fmal is unportable - "
+                 "use gnulib module fmal for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FMODF@
+# if @REPLACE_FMODF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fmodf
+#   define fmodf rpl_fmodf
+#  endif
+_GL_FUNCDECL_RPL (fmodf, float, (float x, float y));
+_GL_CXXALIAS_RPL (fmodf, float, (float x, float y));
+# else
+#  if !@HAVE_FMODF@
+#   undef fmodf
+_GL_FUNCDECL_SYS (fmodf, float, (float x, float y));
+#  endif
+_GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
+# endif
+_GL_CXXALIASWARN (fmodf);
+#elif defined GNULIB_POSIXCHECK
+# undef fmodf
+# if HAVE_RAW_DECL_FMODF
+_GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
+                 "use gnulib module fmodf for portability");
+# endif
+#endif
+
+#if @GNULIB_FMOD@
+# if @REPLACE_FMOD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fmod
+#   define fmod rpl_fmod
+#  endif
+_GL_FUNCDECL_RPL (fmod, double, (double x, double y));
+_GL_CXXALIAS_RPL (fmod, double, (double x, double y));
+# else
+_GL_CXXALIAS_SYS (fmod, double, (double x, double y));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (fmod, double, (double x, double y));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fmod
+# if HAVE_RAW_DECL_FMOD
+_GL_WARN_ON_USE (fmod, "fmod has portability problems - "
+                 "use gnulib module fmod for portability");
+# endif
+#endif
+
+#if @GNULIB_FMODL@
+# if @REPLACE_FMODL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fmodl
+#   define fmodl rpl_fmodl
+#  endif
+_GL_FUNCDECL_RPL (fmodl, long double, (long double x, long double y));
+_GL_CXXALIAS_RPL (fmodl, long double, (long double x, long double y));
+# else
+#  if !@HAVE_FMODL@
+#   undef fmodl
+_GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y));
+#  endif
+_GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fmodl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fmodl
+# if HAVE_RAW_DECL_FMODL
+_GL_WARN_ON_USE (fmodl, "fmodl is unportable - "
+                 "use gnulib module fmodl for portability");
+# endif
+#endif
+
+
+/* Write x as
+     x = mantissa * 2^exp
+   where
+     If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
+     If x is zero: mantissa = x, exp = 0.
+     If x is infinite or NaN: mantissa = x, exp unspecified.
+   Store exp in *EXPPTR and return mantissa.  */
+#if @GNULIB_FREXPF@
+# if @REPLACE_FREXPF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef frexpf
+#   define frexpf rpl_frexpf
+#  endif
+_GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr));
+# else
+#  if !@HAVE_FREXPF@
+#   undef frexpf
+_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (frexpf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef frexpf
+# if HAVE_RAW_DECL_FREXPF
+_GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
+                 "use gnulib module frexpf for portability");
+# endif
+#endif
+
+/* Write x as
+     x = mantissa * 2^exp
+   where
+     If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
+     If x is zero: mantissa = x, exp = 0.
+     If x is infinite or NaN: mantissa = x, exp unspecified.
+   Store exp in *EXPPTR and return mantissa.  */
+#if @GNULIB_FREXP@
+# if @REPLACE_FREXP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef frexp
+#   define frexp rpl_frexp
+#  endif
+_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
+# else
+_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef frexp
+/* Assume frexp is always declared.  */
+_GL_WARN_ON_USE (frexp, "frexp is unportable - "
+                 "use gnulib module frexp for portability");
+#endif
+
+/* Write x as
+     x = mantissa * 2^exp
+   where
+     If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
+     If x is zero: mantissa = x, exp = 0.
+     If x is infinite or NaN: mantissa = x, exp unspecified.
+   Store exp in *EXPPTR and return mantissa.  */
+#if @GNULIB_FREXPL@ && @REPLACE_FREXPL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef frexpl
+#  define frexpl rpl_frexpl
+# endif
+_GL_FUNCDECL_RPL (frexpl, long double,
+                  (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
+#else
+# if !@HAVE_DECL_FREXPL@
+_GL_FUNCDECL_SYS (frexpl, long double,
+                  (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
+# endif
+# if @GNULIB_FREXPL@
+_GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
+# endif
+#endif
+#if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@)
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (frexpl);
+# endif
+#endif
+#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
+# undef frexpl
+# if HAVE_RAW_DECL_FREXPL
+_GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
+                 "use gnulib module frexpl for portability");
+# endif
+#endif
+
+
+/* Return sqrt(x^2+y^2).  */
+#if @GNULIB_HYPOTF@
+# if @REPLACE_HYPOTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef hypotf
+#   define hypotf rpl_hypotf
+#  endif
+_GL_FUNCDECL_RPL (hypotf, float, (float x, float y));
+_GL_CXXALIAS_RPL (hypotf, float, (float x, float y));
+# else
+#  if !@HAVE_HYPOTF@
+_GL_FUNCDECL_SYS (hypotf, float, (float x, float y));
+#  endif
+_GL_CXXALIAS_SYS (hypotf, float, (float x, float y));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (hypotf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef hypotf
+# if HAVE_RAW_DECL_HYPOTF
+_GL_WARN_ON_USE (hypotf, "hypotf is unportable - "
+                 "use gnulib module hypotf for portability");
+# endif
+#endif
+
+/* Return sqrt(x^2+y^2).  */
+#if @GNULIB_HYPOT@
+# if @REPLACE_HYPOT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef hypot
+#   define hypot rpl_hypot
+#  endif
+_GL_FUNCDECL_RPL (hypot, double, (double x, double y));
+_GL_CXXALIAS_RPL (hypot, double, (double x, double y));
+# else
+_GL_CXXALIAS_SYS (hypot, double, (double x, double y));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (hypot, double, (double x, double y));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef hypot
+# if HAVE_RAW_DECL_HYPOT
+_GL_WARN_ON_USE (hypotf, "hypot has portability problems - "
+                 "use gnulib module hypot for portability");
+# endif
+#endif
+
+/* Return sqrt(x^2+y^2).  */
+#if @GNULIB_HYPOTL@
+# if @REPLACE_HYPOTL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef hypotl
+#   define hypotl rpl_hypotl
+#  endif
+_GL_FUNCDECL_RPL (hypotl, long double, (long double x, long double y));
+_GL_CXXALIAS_RPL (hypotl, long double, (long double x, long double y));
+# else
+#  if !@HAVE_HYPOTL@
+_GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y));
+#  endif
+_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (hypotl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef hypotl
+# if HAVE_RAW_DECL_HYPOTL
+_GL_WARN_ON_USE (hypotl, "hypotl is unportable - "
+                 "use gnulib module hypotl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ILOGBF@
+# if @REPLACE_ILOGBF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ilogbf
+#   define ilogbf rpl_ilogbf
+#  endif
+_GL_FUNCDECL_RPL (ilogbf, int, (float x));
+_GL_CXXALIAS_RPL (ilogbf, int, (float x));
+# else
+#  if !@HAVE_ILOGBF@
+_GL_FUNCDECL_SYS (ilogbf, int, (float x));
+#  endif
+_GL_CXXALIAS_SYS (ilogbf, int, (float x));
+# endif
+_GL_CXXALIASWARN (ilogbf);
+#elif defined GNULIB_POSIXCHECK
+# undef ilogbf
+# if HAVE_RAW_DECL_ILOGBF
+_GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - "
+                 "use gnulib module ilogbf for portability");
+# endif
+#endif
+
+#if @GNULIB_ILOGB@
+# if @REPLACE_ILOGB@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ilogb
+#   define ilogb rpl_ilogb
+#  endif
+_GL_FUNCDECL_RPL (ilogb, int, (double x));
+_GL_CXXALIAS_RPL (ilogb, int, (double x));
+# else
+#  if !@HAVE_ILOGB@
+_GL_FUNCDECL_SYS (ilogb, int, (double x));
+#  endif
+_GL_CXXALIAS_SYS (ilogb, int, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (ilogb, int, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ilogb
+# if HAVE_RAW_DECL_ILOGB
+_GL_WARN_ON_USE (ilogb, "ilogb is unportable - "
+                 "use gnulib module ilogb for portability");
+# endif
+#endif
+
+#if @GNULIB_ILOGBL@
+# if @REPLACE_ILOGBL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ilogbl
+#   define ilogbl rpl_ilogbl
+#  endif
+_GL_FUNCDECL_RPL (ilogbl, int, (long double x));
+_GL_CXXALIAS_RPL (ilogbl, int, (long double x));
+# else
+#  if !@HAVE_ILOGBL@
+#   undef ilogbl
+_GL_FUNCDECL_SYS (ilogbl, int, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (ilogbl, int, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (ilogbl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ilogbl
+# if HAVE_RAW_DECL_ILOGBL
+_GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - "
+                 "use gnulib module ilogbl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MDA_J0@
+/* On native Windows, map 'j0' to '_j0', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::j0 always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef j0
+#   define j0 _j0
+#  endif
+_GL_CXXALIAS_MDA (j0, double, (double x));
+# else
+_GL_CXXALIAS_SYS (j0, double, (double x));
+# endif
+_GL_CXXALIASWARN (j0);
+#endif
+
+#if @GNULIB_MDA_J1@
+/* On native Windows, map 'j1' to '_j1', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::j1 always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef j1
+#   define j1 _j1
+#  endif
+_GL_CXXALIAS_MDA (j1, double, (double x));
+# else
+_GL_CXXALIAS_SYS (j1, double, (double x));
+# endif
+_GL_CXXALIASWARN (j1);
+#endif
+
+#if @GNULIB_MDA_JN@
+/* On native Windows, map 'jn' to '_jn', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::jn always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef jn
+#   define jn _jn
+#  endif
+_GL_CXXALIAS_MDA (jn, double, (int n, double x));
+# else
+_GL_CXXALIAS_SYS (jn, double, (int n, double x));
+# endif
+_GL_CXXALIASWARN (jn);
+#endif
+
+
+/* Return x * 2^exp.  */
+#if @GNULIB_LDEXPF@
+# if !@HAVE_LDEXPF@
+#  undef ldexpf
+_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp));
+# endif
+_GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (ldexpf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ldexpf
+# if HAVE_RAW_DECL_LDEXPF
+_GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - "
+                 "use gnulib module ldexpf for portability");
+# endif
+#endif
+
+/* Return x * 2^exp.  */
+#if @GNULIB_LDEXP@
+# if @REPLACE_LDEXP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ldexp
+#   define ldexp rpl_ldexp
+#  endif
+_GL_FUNCDECL_RPL (ldexp, double, (double x, int exp));
+_GL_CXXALIAS_RPL (ldexp, double, (double x, int exp));
+# else
+/* Assume ldexp is always declared.  */
+_GL_CXXALIAS_SYS (ldexp, double, (double x, int exp));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (ldexp, double, (double x, int exp));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ldexp
+/* Assume ldexp is always declared.  */
+_GL_WARN_ON_USE (ldexp, "ldexp is unportable - "
+                 "use gnulib module ldexp for portability");
+#endif
+
+/* Return x * 2^exp.  */
+#if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef ldexpl
+#  define ldexpl rpl_ldexpl
+# endif
+_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp));
+_GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
+#else
+# if !@HAVE_DECL_LDEXPL@
+_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp));
+# endif
+# if @GNULIB_LDEXPL@
+_GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
+# endif
+#endif
+#if @GNULIB_LDEXPL@
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (ldexpl);
+# endif
+#endif
+#if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
+# undef ldexpl
+# if HAVE_RAW_DECL_LDEXPL
+_GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
+                 "use gnulib module ldexpl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LOGF@
+# if @REPLACE_LOGF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef logf
+#   define logf rpl_logf
+#  endif
+_GL_FUNCDECL_RPL (logf, float, (float x));
+_GL_CXXALIAS_RPL (logf, float, (float x));
+# else
+#  if !@HAVE_LOGF@
+#   undef logf
+_GL_FUNCDECL_SYS (logf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (logf, float, (float x));
+# endif
+_GL_CXXALIASWARN (logf);
+#elif defined GNULIB_POSIXCHECK
+# undef logf
+# if HAVE_RAW_DECL_LOGF
+_GL_WARN_ON_USE (logf, "logf is unportable - "
+                 "use gnulib module logf for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG@
+# if @REPLACE_LOG@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log
+#   define log rpl_log
+#  endif
+_GL_FUNCDECL_RPL (log, double, (double x));
+_GL_CXXALIAS_RPL (log, double, (double x));
+# else
+_GL_CXXALIAS_SYS (log, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (log, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef log
+# if HAVE_RAW_DECL_LOG
+_GL_WARN_ON_USE (log, "log has portability problems - "
+                 "use gnulib module log for portability");
+# endif
+#endif
+
+#if @GNULIB_LOGL@
+# if @REPLACE_LOGL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef logl
+#   define logl rpl_logl
+#  endif
+_GL_FUNCDECL_RPL (logl, long double, (long double x));
+_GL_CXXALIAS_RPL (logl, long double, (long double x));
+# else
+#  if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
+#   undef logl
+_GL_FUNCDECL_SYS (logl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (logl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (logl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef logl
+# if HAVE_RAW_DECL_LOGL
+_GL_WARN_ON_USE (logl, "logl is unportable - "
+                 "use gnulib module logl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LOG10F@
+# if @REPLACE_LOG10F@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log10f
+#   define log10f rpl_log10f
+#  endif
+_GL_FUNCDECL_RPL (log10f, float, (float x));
+_GL_CXXALIAS_RPL (log10f, float, (float x));
+# else
+#  if !@HAVE_LOG10F@
+#   undef log10f
+_GL_FUNCDECL_SYS (log10f, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (log10f, float, (float x));
+# endif
+_GL_CXXALIASWARN (log10f);
+#elif defined GNULIB_POSIXCHECK
+# undef log10f
+# if HAVE_RAW_DECL_LOG10F
+_GL_WARN_ON_USE (log10f, "log10f is unportable - "
+                 "use gnulib module log10f for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG10@
+# if @REPLACE_LOG10@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log10
+#   define log10 rpl_log10
+#  endif
+_GL_FUNCDECL_RPL (log10, double, (double x));
+_GL_CXXALIAS_RPL (log10, double, (double x));
+# else
+_GL_CXXALIAS_SYS (log10, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (log10, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef log10
+# if HAVE_RAW_DECL_LOG10
+_GL_WARN_ON_USE (log10, "log10 has portability problems - "
+                 "use gnulib module log10 for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG10L@
+# if @REPLACE_LOG10L@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log10l
+#   define log10l rpl_log10l
+#  endif
+_GL_FUNCDECL_RPL (log10l, long double, (long double x));
+_GL_CXXALIAS_RPL (log10l, long double, (long double x));
+# else
+#  if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@
+#   undef log10l
+_GL_FUNCDECL_SYS (log10l, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (log10l, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (log10l);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef log10l
+# if HAVE_RAW_DECL_LOG10L
+_GL_WARN_ON_USE (log10l, "log10l is unportable - "
+                 "use gnulib module log10l for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LOG1PF@
+# if @REPLACE_LOG1PF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log1pf
+#   define log1pf rpl_log1pf
+#  endif
+_GL_FUNCDECL_RPL (log1pf, float, (float x));
+_GL_CXXALIAS_RPL (log1pf, float, (float x));
+# else
+#  if !@HAVE_LOG1PF@
+_GL_FUNCDECL_SYS (log1pf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (log1pf, float, (float x));
+# endif
+_GL_CXXALIASWARN (log1pf);
+#elif defined GNULIB_POSIXCHECK
+# undef log1pf
+# if HAVE_RAW_DECL_LOG1PF
+_GL_WARN_ON_USE (log1pf, "log1pf is unportable - "
+                 "use gnulib module log1pf for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG1P@
+# if @REPLACE_LOG1P@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log1p
+#   define log1p rpl_log1p
+#  endif
+_GL_FUNCDECL_RPL (log1p, double, (double x));
+_GL_CXXALIAS_RPL (log1p, double, (double x));
+# else
+#  if !@HAVE_LOG1P@
+_GL_FUNCDECL_SYS (log1p, double, (double x));
+#  endif
+_GL_CXXALIAS_SYS (log1p, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (log1p, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef log1p
+# if HAVE_RAW_DECL_LOG1P
+_GL_WARN_ON_USE (log1p, "log1p has portability problems - "
+                 "use gnulib module log1p for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG1PL@
+# if @REPLACE_LOG1PL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log1pl
+#   define log1pl rpl_log1pl
+#  endif
+_GL_FUNCDECL_RPL (log1pl, long double, (long double x));
+_GL_CXXALIAS_RPL (log1pl, long double, (long double x));
+# else
+#  if !@HAVE_LOG1PL@
+_GL_FUNCDECL_SYS (log1pl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (log1pl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (log1pl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef log1pl
+# if HAVE_RAW_DECL_LOG1PL
+_GL_WARN_ON_USE (log1pl, "log1pl has portability problems - "
+                 "use gnulib module log1pl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LOG2F@
+# if @REPLACE_LOG2F@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log2f
+#   define log2f rpl_log2f
+#  endif
+_GL_FUNCDECL_RPL (log2f, float, (float x));
+_GL_CXXALIAS_RPL (log2f, float, (float x));
+# else
+#  if !@HAVE_DECL_LOG2F@
+#   undef log2f
+_GL_FUNCDECL_SYS (log2f, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (log2f, float, (float x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (log2f);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef log2f
+# if HAVE_RAW_DECL_LOG2F
+_GL_WARN_ON_USE (log2f, "log2f is unportable - "
+                 "use gnulib module log2f for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG2@
+# if @REPLACE_LOG2@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log2
+#   define log2 rpl_log2
+#  endif
+_GL_FUNCDECL_RPL (log2, double, (double x));
+_GL_CXXALIAS_RPL (log2, double, (double x));
+# else
+#  if !@HAVE_DECL_LOG2@
+#   undef log2
+_GL_FUNCDECL_SYS (log2, double, (double x));
+#  endif
+_GL_CXXALIAS_SYS (log2, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (log2, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef log2
+# if HAVE_RAW_DECL_LOG2
+_GL_WARN_ON_USE (log2, "log2 is unportable - "
+                 "use gnulib module log2 for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG2L@
+# if @REPLACE_LOG2L@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log2l
+#   define log2l rpl_log2l
+#  endif
+_GL_FUNCDECL_RPL (log2l, long double, (long double x));
+_GL_CXXALIAS_RPL (log2l, long double, (long double x));
+# else
+#  if !@HAVE_DECL_LOG2L@
+_GL_FUNCDECL_SYS (log2l, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (log2l, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (log2l);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef log2l
+# if HAVE_RAW_DECL_LOG2L
+_GL_WARN_ON_USE (log2l, "log2l is unportable - "
+                 "use gnulib module log2l for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LOGBF@
+# if @REPLACE_LOGBF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef logbf
+#   define logbf rpl_logbf
+#  endif
+_GL_FUNCDECL_RPL (logbf, float, (float x));
+_GL_CXXALIAS_RPL (logbf, float, (float x));
+# else
+#  if !@HAVE_LOGBF@
+_GL_FUNCDECL_SYS (logbf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (logbf, float, (float x));
+# endif
+_GL_CXXALIASWARN (logbf);
+#elif defined GNULIB_POSIXCHECK
+# undef logbf
+# if HAVE_RAW_DECL_LOGBF
+_GL_WARN_ON_USE (logbf, "logbf is unportable - "
+                 "use gnulib module logbf for portability");
+# endif
+#endif
+
+#if @GNULIB_LOGB@
+# if @REPLACE_LOGB@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef logb
+#   define logb rpl_logb
+#  endif
+_GL_FUNCDECL_RPL (logb, double, (double x));
+_GL_CXXALIAS_RPL (logb, double, (double x));
+# else
+#  if !@HAVE_DECL_LOGB@
+_GL_FUNCDECL_SYS (logb, double, (double x));
+#  endif
+_GL_CXXALIAS_SYS (logb, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (logb, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef logb
+# if HAVE_RAW_DECL_LOGB
+_GL_WARN_ON_USE (logb, "logb is unportable - "
+                 "use gnulib module logb for portability");
+# endif
+#endif
+
+#if @GNULIB_LOGBL@
+# if @REPLACE_LOGBL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef logbl
+#   define logbl rpl_logbl
+#  endif
+_GL_FUNCDECL_RPL (logbl, long double, (long double x));
+_GL_CXXALIAS_RPL (logbl, long double, (long double x));
+# else
+#  if !@HAVE_LOGBL@
+_GL_FUNCDECL_SYS (logbl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (logbl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (logbl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef logbl
+# if HAVE_RAW_DECL_LOGBL
+_GL_WARN_ON_USE (logbl, "logbl is unportable - "
+                 "use gnulib module logbl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MODFF@
+# if @REPLACE_MODFF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef modff
+#   define modff rpl_modff
+#  endif
+_GL_FUNCDECL_RPL (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (modff, float, (float x, float *iptr));
+# else
+#  if !@HAVE_MODFF@
+#   undef modff
+_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (modff, float, (float x, float *iptr));
+# endif
+_GL_CXXALIASWARN (modff);
+#elif defined GNULIB_POSIXCHECK
+# undef modff
+# if HAVE_RAW_DECL_MODFF
+_GL_WARN_ON_USE (modff, "modff is unportable - "
+                 "use gnulib module modff for portability");
+# endif
+#endif
+
+#if @GNULIB_MODF@
+# if @REPLACE_MODF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef modf
+#   define modf rpl_modf
+#  endif
+_GL_FUNCDECL_RPL (modf, double, (double x, double *iptr) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (modf, double, (double x, double *iptr));
+# else
+_GL_CXXALIAS_SYS (modf, double, (double x, double *iptr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (modf, double, (double x, double *iptr));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef modf
+# if HAVE_RAW_DECL_MODF
+_GL_WARN_ON_USE (modf, "modf has portability problems - "
+                 "use gnulib module modf for portability");
+# endif
+#endif
+
+#if @GNULIB_MODFL@
+# if @REPLACE_MODFL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef modfl
+#   define modfl rpl_modfl
+#  endif
+_GL_FUNCDECL_RPL (modfl, long double, (long double x, long double *iptr)
+                                      _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (modfl, long double, (long double x, long double *iptr));
+# else
+#  if !@HAVE_MODFL@
+#   undef modfl
+_GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr)
+                                      _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (modfl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef modfl
+# if HAVE_RAW_DECL_MODFL
+_GL_WARN_ON_USE (modfl, "modfl is unportable - "
+                 "use gnulib module modfl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_POWF@
+# if !@HAVE_POWF@
+#  undef powf
+_GL_FUNCDECL_SYS (powf, float, (float x, float y));
+# endif
+_GL_CXXALIAS_SYS (powf, float, (float x, float y));
+_GL_CXXALIASWARN (powf);
+#elif defined GNULIB_POSIXCHECK
+# undef powf
+# if HAVE_RAW_DECL_POWF
+_GL_WARN_ON_USE (powf, "powf is unportable - "
+                 "use gnulib module powf for portability");
+# endif
+#endif
+
+
+#if @GNULIB_REMAINDERF@
+# if @REPLACE_REMAINDERF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef remainderf
+#   define remainderf rpl_remainderf
+#  endif
+_GL_FUNCDECL_RPL (remainderf, float, (float x, float y));
+_GL_CXXALIAS_RPL (remainderf, float, (float x, float y));
+# else
+#  if !@HAVE_REMAINDERF@
+_GL_FUNCDECL_SYS (remainderf, float, (float x, float y));
+#  endif
+_GL_CXXALIAS_SYS (remainderf, float, (float x, float y));
+# endif
+_GL_CXXALIASWARN (remainderf);
+#elif defined GNULIB_POSIXCHECK
+# undef remainderf
+# if HAVE_RAW_DECL_REMAINDERF
+_GL_WARN_ON_USE (remainderf, "remainderf is unportable - "
+                 "use gnulib module remainderf for portability");
+# endif
+#endif
+
+#if @GNULIB_REMAINDER@
+# if @REPLACE_REMAINDER@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef remainder
+#   define remainder rpl_remainder
+#  endif
+_GL_FUNCDECL_RPL (remainder, double, (double x, double y));
+_GL_CXXALIAS_RPL (remainder, double, (double x, double y));
+# else
+#  if !@HAVE_REMAINDER@ || !@HAVE_DECL_REMAINDER@
+_GL_FUNCDECL_SYS (remainder, double, (double x, double y));
+#  endif
+_GL_CXXALIAS_SYS (remainder, double, (double x, double y));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (remainder, double, (double x, double y));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef remainder
+# if HAVE_RAW_DECL_REMAINDER
+_GL_WARN_ON_USE (remainder, "remainder is unportable - "
+                 "use gnulib module remainder for portability");
+# endif
+#endif
+
+#if @GNULIB_REMAINDERL@
+# if @REPLACE_REMAINDERL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef remainderl
+#   define remainderl rpl_remainderl
+#  endif
+_GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y));
+_GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y));
+# else
+#  if !@HAVE_DECL_REMAINDERL@
+#   undef remainderl
+#   if !(defined __cplusplus && defined _AIX)
+_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y));
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (remainderl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef remainderl
+# if HAVE_RAW_DECL_REMAINDERL
+_GL_WARN_ON_USE (remainderl, "remainderl is unportable - "
+                 "use gnulib module remainderl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_RINTF@
+# if !@HAVE_DECL_RINTF@
+_GL_FUNCDECL_SYS (rintf, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (rintf, float, (float x));
+_GL_CXXALIASWARN (rintf);
+#elif defined GNULIB_POSIXCHECK
+# undef rintf
+# if HAVE_RAW_DECL_RINTF
+_GL_WARN_ON_USE (rintf, "rintf is unportable - "
+                 "use gnulib module rintf for portability");
+# endif
+#endif
+
+#if @GNULIB_RINT@
+# if !@HAVE_RINT@
+_GL_FUNCDECL_SYS (rint, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (rint, double, (double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (rint, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef rint
+# if HAVE_RAW_DECL_RINT
+_GL_WARN_ON_USE (rint, "rint is unportable - "
+                 "use gnulib module rint for portability");
+# endif
+#endif
+
+#if @GNULIB_RINTL@
+# if @REPLACE_RINTL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rintl
+#   define rintl rpl_rintl
+#  endif
+_GL_FUNCDECL_RPL (rintl, long double, (long double x));
+_GL_CXXALIAS_RPL (rintl, long double, (long double x));
+# else
+#  if !@HAVE_RINTL@
+_GL_FUNCDECL_SYS (rintl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (rintl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (rintl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef rintl
+# if HAVE_RAW_DECL_RINTL
+_GL_WARN_ON_USE (rintl, "rintl is unportable - "
+                 "use gnulib module rintl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ROUNDF@
+# if @REPLACE_ROUNDF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef roundf
+#   define roundf rpl_roundf
+#  endif
+_GL_FUNCDECL_RPL (roundf, float, (float x));
+_GL_CXXALIAS_RPL (roundf, float, (float x));
+# else
+#  if !@HAVE_DECL_ROUNDF@
+_GL_FUNCDECL_SYS (roundf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (roundf, float, (float x));
+# endif
+_GL_CXXALIASWARN (roundf);
+#elif defined GNULIB_POSIXCHECK
+# undef roundf
+# if HAVE_RAW_DECL_ROUNDF
+_GL_WARN_ON_USE (roundf, "roundf is unportable - "
+                 "use gnulib module roundf for portability");
+# endif
+#endif
+
+#if @GNULIB_ROUND@
+# if @REPLACE_ROUND@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef round
+#   define round rpl_round
+#  endif
+_GL_FUNCDECL_RPL (round, double, (double x));
+_GL_CXXALIAS_RPL (round, double, (double x));
+# else
+#  if !@HAVE_DECL_ROUND@
+_GL_FUNCDECL_SYS (round, double, (double x));
+#  endif
+_GL_CXXALIAS_SYS (round, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (round, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef round
+# if HAVE_RAW_DECL_ROUND
+_GL_WARN_ON_USE (round, "round is unportable - "
+                 "use gnulib module round for portability");
+# endif
+#endif
+
+#if @GNULIB_ROUNDL@
+# if @REPLACE_ROUNDL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef roundl
+#   define roundl rpl_roundl
+#  endif
+_GL_FUNCDECL_RPL (roundl, long double, (long double x));
+_GL_CXXALIAS_RPL (roundl, long double, (long double x));
+# else
+#  if !@HAVE_DECL_ROUNDL@
+#   undef roundl
+#   if !(defined __cplusplus && defined _AIX)
+_GL_FUNCDECL_SYS (roundl, long double, (long double x));
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (roundl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (roundl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef roundl
+# if HAVE_RAW_DECL_ROUNDL
+_GL_WARN_ON_USE (roundl, "roundl is unportable - "
+                 "use gnulib module roundl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_SINF@
+# if @REPLACE_SINF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sinf
+#   define sinf rpl_sinf
+#  endif
+_GL_FUNCDECL_RPL (sinf, float, (float x));
+_GL_CXXALIAS_RPL (sinf, float, (float x));
+# else
+#  if !@HAVE_SINF@
+#   undef sinf
+_GL_FUNCDECL_SYS (sinf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (sinf, float, (float x));
+# endif
+_GL_CXXALIASWARN (sinf);
+#elif defined GNULIB_POSIXCHECK
+# undef sinf
+# if HAVE_RAW_DECL_SINF
+_GL_WARN_ON_USE (sinf, "sinf is unportable - "
+                 "use gnulib module sinf for portability");
+# endif
+#endif
+
+#if @GNULIB_SINL@
+# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
+#  undef sinl
+_GL_FUNCDECL_SYS (sinl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (sinl, long double, (long double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (sinl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sinl
+# if HAVE_RAW_DECL_SINL
+_GL_WARN_ON_USE (sinl, "sinl is unportable - "
+                 "use gnulib module sinl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_SINHF@
+# if @REPLACE_SINHF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sinhf
+#   define sinhf rpl_sinhf
+#  endif
+_GL_FUNCDECL_RPL (sinhf, float, (float x));
+_GL_CXXALIAS_RPL (sinhf, float, (float x));
+# else
+#  if !@HAVE_SINHF@
+#   undef sinhf
+_GL_FUNCDECL_SYS (sinhf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (sinhf, float, (float x));
+# endif
+_GL_CXXALIASWARN (sinhf);
+#elif defined GNULIB_POSIXCHECK
+# undef sinhf
+# if HAVE_RAW_DECL_SINHF
+_GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
+                 "use gnulib module sinhf for portability");
+# endif
+#endif
+
+
+#if @GNULIB_SQRTF@
+# if @REPLACE_SQRTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sqrtf
+#   define sqrtf rpl_sqrtf
+#  endif
+_GL_FUNCDECL_RPL (sqrtf, float, (float x));
+_GL_CXXALIAS_RPL (sqrtf, float, (float x));
+# else
+#  if !@HAVE_SQRTF@
+#   undef sqrtf
+_GL_FUNCDECL_SYS (sqrtf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (sqrtf, float, (float x));
+# endif
+_GL_CXXALIASWARN (sqrtf);
+#elif defined GNULIB_POSIXCHECK
+# undef sqrtf
+# if HAVE_RAW_DECL_SQRTF
+_GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
+                 "use gnulib module sqrtf for portability");
+# endif
+#endif
+
+#if @GNULIB_SQRTL@
+# if @REPLACE_SQRTL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sqrtl
+#   define sqrtl rpl_sqrtl
+#  endif
+_GL_FUNCDECL_RPL (sqrtl, long double, (long double x));
+_GL_CXXALIAS_RPL (sqrtl, long double, (long double x));
+# else
+#  if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
+#   undef sqrtl
+_GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (sqrtl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sqrtl
+# if HAVE_RAW_DECL_SQRTL
+_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
+                 "use gnulib module sqrtl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_TANF@
+# if @REPLACE_TANF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef tanf
+#   define tanf rpl_tanf
+#  endif
+_GL_FUNCDECL_RPL (tanf, float, (float x));
+_GL_CXXALIAS_RPL (tanf, float, (float x));
+# else
+#  if !@HAVE_TANF@
+#   undef tanf
+_GL_FUNCDECL_SYS (tanf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (tanf, float, (float x));
+# endif
+_GL_CXXALIASWARN (tanf);
+#elif defined GNULIB_POSIXCHECK
+# undef tanf
+# if HAVE_RAW_DECL_TANF
+_GL_WARN_ON_USE (tanf, "tanf is unportable - "
+                 "use gnulib module tanf for portability");
+# endif
+#endif
+
+#if @GNULIB_TANL@
+# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
+#  undef tanl
+_GL_FUNCDECL_SYS (tanl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (tanl, long double, (long double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (tanl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef tanl
+# if HAVE_RAW_DECL_TANL
+_GL_WARN_ON_USE (tanl, "tanl is unportable - "
+                 "use gnulib module tanl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_TANHF@
+# if @REPLACE_TANHF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef tanhf
+#   define tanhf rpl_tanhf
+#  endif
+_GL_FUNCDECL_RPL (tanhf, float, (float x));
+_GL_CXXALIAS_RPL (tanhf, float, (float x));
+# else
+#  if !@HAVE_TANHF@
+#   undef tanhf
+_GL_FUNCDECL_SYS (tanhf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (tanhf, float, (float x));
+# endif
+_GL_CXXALIASWARN (tanhf);
+#elif defined GNULIB_POSIXCHECK
+# undef tanhf
+# if HAVE_RAW_DECL_TANHF
+_GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
+                 "use gnulib module tanhf for portability");
+# endif
+#endif
+
+
+#if @GNULIB_TRUNCF@
+# if @REPLACE_TRUNCF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef truncf
+#   define truncf rpl_truncf
+#  endif
+_GL_FUNCDECL_RPL (truncf, float, (float x));
+_GL_CXXALIAS_RPL (truncf, float, (float x));
+# else
+#  if !@HAVE_DECL_TRUNCF@
+_GL_FUNCDECL_SYS (truncf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (truncf, float, (float x));
+# endif
+_GL_CXXALIASWARN (truncf);
+#elif defined GNULIB_POSIXCHECK
+# undef truncf
+# if HAVE_RAW_DECL_TRUNCF
+_GL_WARN_ON_USE (truncf, "truncf is unportable - "
+                 "use gnulib module truncf for portability");
+# endif
+#endif
+
+#if @GNULIB_TRUNC@
+# if @REPLACE_TRUNC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef trunc
+#   define trunc rpl_trunc
+#  endif
+_GL_FUNCDECL_RPL (trunc, double, (double x));
+_GL_CXXALIAS_RPL (trunc, double, (double x));
+# else
+#  if !@HAVE_DECL_TRUNC@
+_GL_FUNCDECL_SYS (trunc, double, (double x));
+#  endif
+_GL_CXXALIAS_SYS (trunc, double, (double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (trunc, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef trunc
+# if HAVE_RAW_DECL_TRUNC
+_GL_WARN_ON_USE (trunc, "trunc is unportable - "
+                 "use gnulib module trunc for portability");
+# endif
+#endif
+
+#if @GNULIB_TRUNCL@
+# if @REPLACE_TRUNCL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef truncl
+#   define truncl rpl_truncl
+#  endif
+_GL_FUNCDECL_RPL (truncl, long double, (long double x));
+_GL_CXXALIAS_RPL (truncl, long double, (long double x));
+# else
+#  if !@HAVE_DECL_TRUNCL@
+_GL_FUNCDECL_SYS (truncl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (truncl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (truncl);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef truncl
+# if HAVE_RAW_DECL_TRUNCL
+_GL_WARN_ON_USE (truncl, "truncl is unportable - "
+                 "use gnulib module truncl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MDA_Y0@
+/* On native Windows, map 'y0' to '_y0', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::y0 always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef y0
+#   define y0 _y0
+#  endif
+_GL_CXXALIAS_MDA (y0, double, (double x));
+# else
+_GL_CXXALIAS_SYS (y0, double, (double x));
+# endif
+_GL_CXXALIASWARN (y0);
+#endif
+
+#if @GNULIB_MDA_Y1@
+/* On native Windows, map 'y1' to '_y1', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::y1 always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef y1
+#   define y1 _y1
+#  endif
+_GL_CXXALIAS_MDA (y1, double, (double x));
+# else
+_GL_CXXALIAS_SYS (y1, double, (double x));
+# endif
+_GL_CXXALIASWARN (y1);
+#endif
+
+#if @GNULIB_MDA_YN@
+/* On native Windows, map 'yn' to '_yn', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::yn always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef yn
+#   define yn _yn
+#  endif
+_GL_CXXALIAS_MDA (yn, double, (int n, double x));
+# else
+_GL_CXXALIAS_SYS (yn, double, (int n, double x));
+# endif
+_GL_CXXALIASWARN (yn);
+#endif
+
+
+/* Definitions of function-like macros come here, after the function
+   declarations.  */
+
+
+#if @GNULIB_ISFINITE@
+# if @REPLACE_ISFINITE@
+_GL_EXTERN_C int gl_isfinitef (float x);
+_GL_EXTERN_C int gl_isfinited (double x);
+_GL_EXTERN_C int gl_isfinitel (long double x);
+#  undef isfinite
+#  define isfinite(x) \
+   (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
+    sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
+    gl_isfinitef (x))
+# endif
+# ifdef __cplusplus
+#  if defined isfinite || defined GNULIB_NAMESPACE
+_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
+#   undef isfinite
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__)))
+  /* This platform's <cmath> possibly defines isfinite through a set of inline
+     functions.  */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
+#    define isfinite rpl_isfinite
+#    define GNULIB_NAMESPACE_LACKS_ISFINITE 1
+#   else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, isfinite, bool)
+#   endif
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# if defined isfinite
+_GL_WARN_REAL_FLOATING_DECL (isfinite);
+#  undef isfinite
+#  define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x)
+# endif
+#endif
+
+
+#if @GNULIB_ISINF@
+# if @REPLACE_ISINF@
+_GL_EXTERN_C int gl_isinff (float x);
+_GL_EXTERN_C int gl_isinfd (double x);
+_GL_EXTERN_C int gl_isinfl (long double x);
+#  undef isinf
+#  define isinf(x) \
+   (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \
+    sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
+    gl_isinff (x))
+# endif
+# ifdef __cplusplus
+#  if defined isinf || defined GNULIB_NAMESPACE
+_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
+#   undef isinf
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
+  /* This platform's <cmath> possibly defines isinf through a set of inline
+     functions.  */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool)
+#    define isinf rpl_isinf
+#    define GNULIB_NAMESPACE_LACKS_ISINF 1
+#   else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, isinf, bool)
+#   endif
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# if defined isinf
+_GL_WARN_REAL_FLOATING_DECL (isinf);
+#  undef isinf
+#  define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x)
+# endif
+#endif
+
+
+#if @GNULIB_ISNANF@
+/* Test for NaN for 'float' numbers.  */
+# if @HAVE_ISNANF@
+#  if defined __sun || defined __sgi
+/* Solaris and IRIX have isnanf() and declare it in <ieeefp.h>.  We cannot
+   define isnanf as a macro, because that would conflict with <ieeefp.h>.  */
+_GL_EXTERN_C int isnanf (float x);
+#  else
+/* The original <math.h> included above provides a declaration of isnan macro
+   or (older) isnanf function.  */
+#   if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+    /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.
+       GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't.  */
+#    undef isnanf
+#    define isnanf(x) __builtin_isnan ((float)(x))
+#   elif defined isnan
+#    undef isnanf
+#    define isnanf(x) isnan ((float)(x))
+#   endif
+#  endif
+# else
+/* Test whether X is a NaN.  */
+#  undef isnanf
+#  define isnanf rpl_isnanf
+_GL_EXTERN_C int isnanf (float x);
+# endif
+#endif
+
+#if @GNULIB_ISNAND@
+/* Test for NaN for 'double' numbers.
+   This function is a gnulib extension, unlike isnan() which applied only
+   to 'double' numbers earlier but now is a type-generic macro.  */
+# if @HAVE_ISNAND@
+#  if defined __sun || defined __sgi
+/* Solaris and IRIX have isnand() and declare it in <ieeefp.h>.  We cannot
+   define isnand as a macro, because that would conflict with <ieeefp.h>.  */
+_GL_EXTERN_C int isnand (double x);
+#  else
+/* The original <math.h> included above provides a declaration of isnan
+   macro.  */
+#   if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+    /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.  */
+#    undef isnand
+#    define isnand(x) __builtin_isnan ((double)(x))
+#   else
+#    undef isnand
+#    define isnand(x) isnan ((double)(x))
+#   endif
+#  endif
+# else
+/* Test whether X is a NaN.  */
+#  undef isnand
+#  define isnand rpl_isnand
+_GL_EXTERN_C int isnand (double x);
+# endif
+#endif
+
+#if @GNULIB_ISNANL@
+/* Test for NaN for 'long double' numbers.  */
+# if @HAVE_ISNANL@
+/* The original <math.h> included above provides a declaration of isnan
+   macro or (older) isnanl function.  */
+#  if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+    /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.
+       GCC >= 4.0 also provides __builtin_isnanl, but clang doesn't.  */
+#   undef isnanl
+#   define isnanl(x) __builtin_isnan ((long double)(x))
+#  elif defined isnan
+#   undef isnanl
+#   define isnanl(x) isnan ((long double)(x))
+#  endif
+# else
+/* Test whether X is a NaN.  */
+#  undef isnanl
+#  define isnanl rpl_isnanl
+_GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
+# endif
+#endif
+
+/* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL!  */
+#if @GNULIB_ISNAN@
+# if @REPLACE_ISNAN@
+/* We can't just use the isnanf macro (e.g.) as exposed by
+   isnanf.h (e.g.) here, because those may end up being macros
+   that recursively expand back to isnan.  So use the gnulib
+   replacements for them directly. */
+#  if @HAVE_ISNANF@ && (__GNUC__ >= 4) || (__clang_major__ >= 4)
+#   define gl_isnan_f(x) __builtin_isnan ((float)(x))
+#  else
+_GL_EXTERN_C int rpl_isnanf (float x);
+#   define gl_isnan_f(x) rpl_isnanf (x)
+#  endif
+#  if @HAVE_ISNAND@ && (__GNUC__ >= 4) || (__clang_major__ >= 4)
+#   define gl_isnan_d(x) __builtin_isnan ((double)(x))
+#  else
+_GL_EXTERN_C int rpl_isnand (double x);
+#   define gl_isnan_d(x) rpl_isnand (x)
+#  endif
+#  if @HAVE_ISNANL@ && (__GNUC__ >= 4) || (__clang_major__ >= 4)
+#   define gl_isnan_l(x) __builtin_isnan ((long double)(x))
+#  else
+_GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
+#   define gl_isnan_l(x) rpl_isnanl (x)
+#  endif
+#  undef isnan
+#  define isnan(x) \
+   (sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
+    sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
+    gl_isnan_f (x))
+# elif (__GNUC__ >= 4) || (__clang_major__ >= 4)
+#  undef isnan
+#  define isnan(x) \
+   (sizeof (x) == sizeof (long double) ? __builtin_isnan ((long double)(x)) : \
+    sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
+    __builtin_isnan ((float)(x)))
+# endif
+# ifdef __cplusplus
+#  if defined isnan || defined GNULIB_NAMESPACE
+_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
+#   undef isnan
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ != 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
+  /* This platform's <cmath> possibly defines isnan through a set of inline
+     functions.  */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
+#    define isnan rpl_isnan
+#    define GNULIB_NAMESPACE_LACKS_ISNAN 1
+#   elif __clang_major__ >= 14
+  /* Neither of the two possible _GL_MATH_CXX_REAL_FLOATING_DECL_2 invocations
+     works.  Inline functions are already present in /usr/include/c++/v1/math.h,
+     which comes from LLVM.  */
+#    define GNULIB_NAMESPACE_LACKS_ISNAN 1
+#   else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
+#   endif
+#  endif
+# else
+/* Ensure isnan is a macro.  */
+#  ifndef isnan
+#   define isnan isnan
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# if defined isnan
+_GL_WARN_REAL_FLOATING_DECL (isnan);
+#  undef isnan
+#  define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x)
+# endif
+#endif
+
+
+#if @GNULIB_SIGNBIT@
+# if (@REPLACE_SIGNBIT_USING_BUILTINS@ \
+      && (!defined __cplusplus || __cplusplus < 201103))
+#  undef signbit
+   /* GCC >= 4.0 and clang provide three built-ins for signbit.  */
+#  define signbit(x) \
+   (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
+    sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
+    __builtin_signbitf (x))
+# endif
+# if @REPLACE_SIGNBIT@ && !GNULIB_defined_signbit
+#  undef signbit
+_GL_EXTERN_C int gl_signbitf (float arg);
+_GL_EXTERN_C int gl_signbitd (double arg);
+_GL_EXTERN_C int gl_signbitl (long double arg);
+#  if __GNUC__ >= 2 || defined __clang__
+#   define _GL_NUM_UINT_WORDS(type) \
+      ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+#   if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
+#    define gl_signbitf_OPTIMIZED_MACRO
+#    define gl_signbitf(arg) \
+       __extension__                                                    \
+       ({ union { float _value;                                         \
+                  unsigned int _word[_GL_NUM_UINT_WORDS (float)];       \
+                } _m;                                                   \
+          _m._value = (arg);                                            \
+          (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1;          \
+        })
+#   endif
+#   if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd
+#    define gl_signbitd_OPTIMIZED_MACRO
+#    define gl_signbitd(arg) \
+       __extension__                                                    \
+       ({ union { double _value;                                        \
+                  unsigned int _word[_GL_NUM_UINT_WORDS (double)];      \
+                } _m;                                                   \
+          _m._value = (arg);                                            \
+          (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1;          \
+        })
+#   endif
+#   if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl
+#    define gl_signbitl_OPTIMIZED_MACRO
+#    define gl_signbitl(arg) \
+       __extension__                                                    \
+       ({ union { long double _value;                                   \
+                  unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \
+                } _m;                                                   \
+          _m._value = (arg);                                            \
+          (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1;        \
+        })
+#   endif
+#  endif
+#  define signbit(x) \
+   (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
+    sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
+    gl_signbitf (x))
+#  define GNULIB_defined_signbit 1
+# endif
+# ifdef __cplusplus
+#  if defined signbit || defined GNULIB_NAMESPACE
+_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
+#   undef signbit
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__)))
+  /* This platform's <cmath> possibly defines signbit through a set of inline
+     functions.  */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)
+#    define signbit rpl_signbit
+#    define GNULIB_NAMESPACE_LACKS_SIGNBIT 1
+#   else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, signbit, bool)
+#   endif
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# if defined signbit
+_GL_WARN_REAL_FLOATING_DECL (signbit);
+#  undef signbit
+#  define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x)
+# endif
+#endif
+
+
+#if @GNULIB_TOTALORDERF@
+# if @REPLACE_TOTALORDERF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef totalorderf
+#   define totalorderf rpl_totalorderf
+#  endif
+_GL_FUNCDECL_RPL (totalorderf, int, (float const *, float const *));
+_GL_CXXALIAS_RPL (totalorderf, int, (float const *, float const *));
+# else
+#  if !@HAVE_TOTALORDERF@
+_GL_FUNCDECL_SYS (totalorderf, int, (float const *, float const *));
+#  endif
+_GL_CXXALIAS_SYS (totalorderf, int, (float const *, float const *));
+# endif
+_GL_CXXALIASWARN (totalorderf);
+#elif defined GNULIB_POSIXCHECK
+# undef totalorderf
+# if HAVE_RAW_DECL_TOTALORDERF
+_GL_WARN_ON_USE (totalorderf, "totalorderf is unportable - "
+                 "use gnulib module totalorderf for portability");
+# endif
+#endif
+
+#if @GNULIB_TOTALORDER@
+# if @REPLACE_TOTALORDER@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef totalorder
+#   define totalorder rpl_totalorder
+#  endif
+_GL_FUNCDECL_RPL (totalorder, int, (double const *, double const *));
+_GL_CXXALIAS_RPL (totalorder, int, (double const *, double const *));
+# else
+#  if !@HAVE_TOTALORDER@
+_GL_FUNCDECL_SYS (totalorder, int, (double const *, double const *));
+#  endif
+_GL_CXXALIAS_SYS (totalorder, int, (double const *, double const *));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (totalorder, int, (double const *, double const *));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef totalorder
+# if HAVE_RAW_DECL_TOTALORDER
+_GL_WARN_ON_USE (totalorder, "totalorder is unportable - "
+                 "use gnulib module totalorder for portability");
+# endif
+#endif
+
+#if @GNULIB_TOTALORDERL@
+# if @REPLACE_TOTALORDERL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef totalorderl
+#   define totalorderl rpl_totalorderl
+#  endif
+_GL_FUNCDECL_RPL (totalorderl, int,
+                  (long double const *, long double const *));
+_GL_CXXALIAS_RPL (totalorderl, int,
+                  (long double const *, long double const *));
+# else
+#  if !@HAVE_TOTALORDERL@
+_GL_FUNCDECL_SYS (totalorderl, int,
+                  (long double const *, long double const *));
+#  endif
+_GL_CXXALIAS_SYS (totalorderl, int,
+                  (long double const *, long double const *));
+# endif
+_GL_CXXALIASWARN (totalorderl);
+#elif defined GNULIB_POSIXCHECK
+# undef totalorderl
+# if HAVE_RAW_DECL_TOTALORDERL
+_GL_WARN_ON_USE (totalorderl, "totalorderl is unportable - "
+                 "use gnulib module totalorderl for portability");
+# endif
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* _@GUARD_PREFIX@_MATH_H */
+#endif /* _GL_INCLUDING_MATH_H */
+#endif /* _@GUARD_PREFIX@_MATH_H */
+#endif
deleted file mode 120000 (symlink)
index 17ac4948361b1c5fdef1f1c57ab5b9ff60403b58..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbrlen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..67457ef0cb92c3bb852e6bd1cdbebefd5e6197f8
--- /dev/null
@@ -0,0 +1,32 @@
+/* Recognize multibyte character.
+   Copyright (C) 1999-2000, 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+
+static mbstate_t internal_state;
+
+size_t
+mbrlen (const char *s, size_t n, mbstate_t *ps)
+{
+  if (ps == NULL)
+    ps = &internal_state;
+  return mbrtowc (NULL, s, n, ps);
+}
deleted file mode 120000 (symlink)
index bb9e7fecddd831d8eea3536a11a8ebf3df7cd9af..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbrtoc32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..56e4a860117a0797c02c747c008aca667ef0f379
--- /dev/null
@@ -0,0 +1,288 @@
+/* Convert multibyte character to 32-bit wide character.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <uchar.h>
+
+#include "attribute.h"
+
+#include <errno.h>
+#include <stdlib.h>
+
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
+#if GNULIB_defined_mbstate_t /* AIX, IRIX */
+/* Implement mbrtoc32() on top of mbtowc() for the non-UTF-8 locales
+   and directly for the UTF-8 locales.  */
+
+/* Note: On AIX (64-bit) we can implement mbrtoc32 in two equivalent ways:
+   - in a way that parallels the override of mbrtowc; this is the code branch
+     here;
+   - in a way that invokes the overridden mbrtowc; this would be the #else
+     branch below.
+   They are equivalent.  */
+
+# if AVOID_ANY_THREADS
+
+/* The option '--disable-threads' explicitly requests no locking.  */
+
+# elif defined _WIN32 && !defined __CYGWIN__
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+# elif HAVE_PTHREAD_API
+
+#  include <pthread.h>
+#  if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS
+#   include <threads.h>
+#   pragma weak thrd_exit
+#   define c11_threads_in_use() (thrd_exit != NULL)
+#  else
+#   define c11_threads_in_use() 0
+#  endif
+
+# elif HAVE_THREADS_H
+
+#  include <threads.h>
+
+# endif
+
+# include "lc-charset-dispatch.h"
+# include "mbtowc-lock.h"
+
+static_assert (sizeof (mbstate_t) >= 4);
+static char internal_state[4];
+
+size_t
+mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps)
+{
+# define FITS_IN_CHAR_TYPE(wc)  1
+# include "mbrtowc-impl.h"
+}
+
+#else /* glibc, macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, MSVC, Minix, Android */
+
+/* Implement mbrtoc32() based on the original mbrtoc32() or on mbrtowc().  */
+
+# include <wchar.h>
+
+# include "localcharset.h"
+# include "streq.h"
+
+# if MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ
+#  include "hard-locale.h"
+#  include <locale.h>
+# endif
+
+static mbstate_t internal_state;
+
+size_t
+mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps)
+# undef mbrtoc32
+{
+  /* It's simpler to handle the case s == NULL upfront, than to worry about
+     this case later, before every test of pwc and n.  */
+  if (s == NULL)
+    {
+      pwc = NULL;
+      s = "";
+      n = 1;
+    }
+
+# if MBRTOC32_EMPTY_INPUT_BUG || _GL_SMALL_WCHAR_T
+  if (n == 0)
+    return (size_t) -2;
+# endif
+
+  if (ps == NULL)
+    ps = &internal_state;
+
+# if HAVE_WORKING_MBRTOC32
+  /* mbrtoc32() may produce different values for wc than mbrtowc().  Therefore
+     use mbrtoc32().  */
+
+#  if defined _WIN32 && !defined __CYGWIN__
+  char32_t wc;
+  size_t ret = mbrtoc32 (&wc, s, n, ps);
+  if (ret < (size_t) -2 && pwc != NULL)
+    *pwc = wc;
+#  else
+  size_t ret = mbrtoc32 (pwc, s, n, ps);
+#  endif
+
+#  if GNULIB_MBRTOC32_REGULAR
+  /* Verify that mbrtoc32 is regular.  */
+  if (ret < (size_t) -3 && ! mbsinit (ps))
+    /* This occurs on glibc 2.36.  */
+    mbszero (ps);
+  if (ret == (size_t) -3)
+    abort ();
+#  endif
+
+#  if MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ
+  if ((size_t) -2 <= ret && n != 0 && ! hard_locale (LC_CTYPE))
+    {
+      if (pwc != NULL)
+        *pwc = (unsigned char) *s;
+      return 1;
+    }
+#  endif
+
+  return ret;
+
+# elif _GL_SMALL_WCHAR_T
+
+  /* Special-case all encodings that may produce wide character values
+     > WCHAR_MAX.  */
+  const char *encoding = locale_charset ();
+  if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+    {
+      /* Special-case the UTF-8 encoding.  Assume that the wide-character
+         encoding in a UTF-8 locale is UCS-2 or, equivalently, UTF-16.  */
+      /* Here n > 0.  */
+      char *pstate = (char *)ps;
+      size_t nstate = pstate[0];
+      char buf[4];
+      const char *p;
+      size_t m;
+      int res;
+
+      switch (nstate)
+        {
+        case 0:
+          p = s;
+          m = n;
+          break;
+        case 3:
+          buf[2] = pstate[3];
+          FALLTHROUGH;
+        case 2:
+          buf[1] = pstate[2];
+          FALLTHROUGH;
+        case 1:
+          buf[0] = pstate[1];
+          p = buf;
+          m = nstate;
+          buf[m++] = s[0];
+          if (n >= 2 && m < 4)
+            {
+              buf[m++] = s[1];
+              if (n >= 3 && m < 4)
+                buf[m++] = s[2];
+            }
+          break;
+        default:
+          errno = EINVAL;
+          return (size_t)(-1);
+        }
+
+      /* Here m > 0.  */
+
+      {
+#  define FITS_IN_CHAR_TYPE(wc)  1
+#  include "mbrtowc-impl-utf8.h"
+      }
+
+     success:
+      if (nstate >= (res > 0 ? res : 1))
+        abort ();
+      res -= nstate;
+      /* Set *ps to an initial state.  */
+#  if defined _WIN32 && !defined __CYGWIN__
+      /* Native Windows.  */
+      /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4 bytes matter.
+         On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined
+         as an 8-byte struct, of which the first 4 bytes matter.  */
+      *(unsigned int *)pstate = 0;
+#  elif defined __CYGWIN__
+      /* Cygwin defines 'mbstate_t' as an 8-byte struct; the first 4 bytes
+         matter.  */
+      ps->__count = 0;
+#  else
+      pstate[0] = 0;
+#  endif
+      return res;
+
+     incomplete:
+      {
+        size_t k = nstate;
+        /* Here 0 <= k < m < 4.  */
+        pstate[++k] = s[0];
+        if (k < m)
+          {
+            pstate[++k] = s[1];
+            if (k < m)
+              pstate[++k] = s[2];
+          }
+        if (k != m)
+          abort ();
+      }
+      pstate[0] = m;
+      return (size_t)(-2);
+
+     invalid:
+      errno = EILSEQ;
+      /* The conversion state is undefined, says POSIX.  */
+      return (size_t)(-1);
+    }
+  else
+    {
+      wchar_t wc;
+      size_t ret = mbrtowc (&wc, s, n, ps);
+      if (ret < (size_t) -2 && pwc != NULL)
+        *pwc = wc;
+      return ret;
+    }
+
+# else
+
+  /* char32_t and wchar_t are equivalent.  Use mbrtowc().  */
+  wchar_t wc;
+  size_t ret = mbrtowc (&wc, s, n, ps);
+
+#  if GNULIB_MBRTOC32_REGULAR
+  /* Ensure that mbrtoc32 is regular.  */
+  if (ret < (size_t) -2 && ! mbsinit (ps))
+    /* This occurs on glibc 2.12.  */
+    mbszero (ps);
+#  endif
+
+#  if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  if (ret < (size_t) -2 && wc != 0)
+    {
+      wc = locale_encoding_to_unicode (wc);
+      if (wc == 0)
+        {
+          ret = (size_t) -1;
+          errno = EILSEQ;
+        }
+    }
+#  endif
+  if (ret < (size_t) -2 && pwc != NULL)
+    *pwc = wc;
+  return ret;
+
+# endif
+}
+
+#endif
deleted file mode 120000 (symlink)
index 0a935f04b1960ebc12acae73d1e9b3c0557a2e3c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbrtowc-impl-utf8.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3a3ba13c0b18823a1153c38b565efb7a58d8a26b
--- /dev/null
@@ -0,0 +1,138 @@
+/* Convert multibyte character to wide character.
+   Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+/* This file contains the part of the body of the mbrtowc and mbrtoc32 functions
+   that handles the special case of the UTF-8 encoding.  */
+
+        /* Cf. unistr/u8-mbtouc.c.  */
+        unsigned char c = (unsigned char) p[0];
+
+        if (c < 0x80)
+          {
+            if (pwc != NULL)
+              *pwc = c;
+            res = (c == 0 ? 0 : 1);
+            goto success;
+          }
+        if (c >= 0xc2)
+          {
+            if (c < 0xe0)
+              {
+                if (m == 1)
+                  goto incomplete;
+                else /* m >= 2 */
+                  {
+                    unsigned char c2 = (unsigned char) p[1];
+
+                    if ((c2 ^ 0x80) < 0x40)
+                      {
+                        if (pwc != NULL)
+                          *pwc = ((unsigned int) (c & 0x1f) << 6)
+                                 | (unsigned int) (c2 ^ 0x80);
+                        res = 2;
+                        goto success;
+                      }
+                  }
+              }
+            else if (c < 0xf0)
+              {
+                if (m == 1)
+                  goto incomplete;
+                else
+                  {
+                    unsigned char c2 = (unsigned char) p[1];
+
+                    if ((c2 ^ 0x80) < 0x40
+                        && (c >= 0xe1 || c2 >= 0xa0)
+                        && (c != 0xed || c2 < 0xa0))
+                      {
+                        if (m == 2)
+                          goto incomplete;
+                        else /* m >= 3 */
+                          {
+                            unsigned char c3 = (unsigned char) p[2];
+
+                            if ((c3 ^ 0x80) < 0x40)
+                              {
+                                unsigned int wc =
+                                  (((unsigned int) (c & 0x0f) << 12)
+                                   | ((unsigned int) (c2 ^ 0x80) << 6)
+                                   | (unsigned int) (c3 ^ 0x80));
+
+                                if (FITS_IN_CHAR_TYPE (wc))
+                                  {
+                                    if (pwc != NULL)
+                                      *pwc = wc;
+                                    res = 3;
+                                    goto success;
+                                  }
+                              }
+                          }
+                      }
+                  }
+              }
+            else if (c <= 0xf4)
+              {
+                if (m == 1)
+                  goto incomplete;
+                else
+                  {
+                    unsigned char c2 = (unsigned char) p[1];
+
+                    if ((c2 ^ 0x80) < 0x40
+                        && (c >= 0xf1 || c2 >= 0x90)
+                        && (c < 0xf4 || (/* c == 0xf4 && */ c2 < 0x90)))
+                      {
+                        if (m == 2)
+                          goto incomplete;
+                        else
+                          {
+                            unsigned char c3 = (unsigned char) p[2];
+
+                            if ((c3 ^ 0x80) < 0x40)
+                              {
+                                if (m == 3)
+                                  goto incomplete;
+                                else /* m >= 4 */
+                                  {
+                                    unsigned char c4 = (unsigned char) p[3];
+
+                                    if ((c4 ^ 0x80) < 0x40)
+                                      {
+                                        unsigned int wc =
+                                          (((unsigned int) (c & 0x07) << 18)
+                                           | ((unsigned int) (c2 ^ 0x80) << 12)
+                                           | ((unsigned int) (c3 ^ 0x80) << 6)
+                                           | (unsigned int) (c4 ^ 0x80));
+
+                                        if (FITS_IN_CHAR_TYPE (wc))
+                                          {
+                                            if (pwc != NULL)
+                                              *pwc = wc;
+                                            res = 4;
+                                            goto success;
+                                          }
+                                      }
+                                  }
+                              }
+                          }
+                      }
+                  }
+              }
+          }
+        goto invalid;
deleted file mode 120000 (symlink)
index cb913f6b19b2b033ed98fa86cf1532d2a722f37e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbrtowc-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..963631cae59042cea569f6a319b1c81df01a1949
--- /dev/null
@@ -0,0 +1,262 @@
+/* Convert multibyte character to wide character.
+   Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+/* This file contains the body of the mbrtowc and mbrtoc32 functions,
+   when GNULIB_defined_mbstate_t is defined.  */
+
+  char *pstate = (char *)ps;
+
+  if (s == NULL)
+    {
+      pwc = NULL;
+      s = "";
+      n = 1;
+    }
+
+  if (n == 0)
+    return (size_t)(-2);
+
+  /* Here n > 0.  */
+
+  if (pstate == NULL)
+    pstate = internal_state;
+
+  {
+    size_t nstate = pstate[0];
+    char buf[4];
+    const char *p;
+    size_t m;
+    enc_t enc;
+    int res;
+
+    switch (nstate)
+      {
+      case 0:
+        p = s;
+        m = n;
+        break;
+      case 3:
+        buf[2] = pstate[3];
+        FALLTHROUGH;
+      case 2:
+        buf[1] = pstate[2];
+        FALLTHROUGH;
+      case 1:
+        buf[0] = pstate[1];
+        p = buf;
+        m = nstate;
+        buf[m++] = s[0];
+        if (n >= 2 && m < 4)
+          {
+            buf[m++] = s[1];
+            if (n >= 3 && m < 4)
+              buf[m++] = s[2];
+          }
+        break;
+      default:
+        errno = EINVAL;
+        return (size_t)(-1);
+      }
+
+    /* Here m > 0.  */
+
+    enc = locale_encoding_classification ();
+
+    if (enc == enc_utf8) /* UTF-8 */
+      {
+        /* Achieve
+             - multi-thread safety and
+             - the ability to produce wide character values > WCHAR_MAX
+           by not calling mbtowc() at all.  */
+#include "mbrtowc-impl-utf8.h"
+      }
+    else
+      {
+        /* The hidden internal state of mbtowc would make this function not
+           multi-thread safe.  Achieve multi-thread safety through a lock.  */
+        wchar_t wc;
+        res = mbtowc_with_lock (&wc, p, m);
+
+        if (res >= 0)
+          {
+            if ((wc == 0) != (res == 0))
+              abort ();
+            if (pwc != NULL)
+              *pwc = wc;
+            goto success;
+          }
+
+        /* mbtowc does not distinguish between invalid and incomplete multibyte
+           sequences.  But mbrtowc needs to make this distinction.
+           There are two possible approaches:
+             - Use iconv() and its return value.
+             - Use built-in knowledge about the possible encodings.
+           Given the low quality of implementation of iconv() on the systems
+           that lack mbrtowc(), we use the second approach.
+           The possible encodings are:
+             - 8-bit encodings,
+             - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS,
+             - UTF-8 (already handled above).
+           Use specialized code for each.  */
+        if (m >= 4 || m >= MB_CUR_MAX)
+          goto invalid;
+        /* Here MB_CUR_MAX > 1 and 0 < m < 4.  */
+        switch (enc)
+          {
+          /* As a reference for this code, you can use the GNU libiconv
+             implementation.  Look for uses of the RET_TOOFEW macro.  */
+
+          case enc_eucjp: /* EUC-JP */
+            {
+              if (m == 1)
+                {
+                  unsigned char c = (unsigned char) p[0];
+
+                  if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f)
+                    goto incomplete;
+                }
+              if (m == 2)
+                {
+                  unsigned char c = (unsigned char) p[0];
+
+                  if (c == 0x8f)
+                    {
+                      unsigned char c2 = (unsigned char) p[1];
+
+                      if (c2 >= 0xa1 && c2 < 0xff)
+                        goto incomplete;
+                    }
+                }
+              goto invalid;
+            }
+
+          case enc_94: /* EUC-KR, GB2312, BIG5 */
+            {
+              if (m == 1)
+                {
+                  unsigned char c = (unsigned char) p[0];
+
+                  if (c >= 0xa1 && c < 0xff)
+                    goto incomplete;
+                }
+              goto invalid;
+            }
+
+          case enc_euctw: /* EUC-TW */
+            {
+              if (m == 1)
+                {
+                  unsigned char c = (unsigned char) p[0];
+
+                  if ((c >= 0xa1 && c < 0xff) || c == 0x8e)
+                    goto incomplete;
+                }
+              else /* m == 2 || m == 3 */
+                {
+                  unsigned char c = (unsigned char) p[0];
+
+                  if (c == 0x8e)
+                    goto incomplete;
+                }
+              goto invalid;
+            }
+
+          case enc_gb18030: /* GB18030 */
+            {
+              if (m == 1)
+                {
+                  unsigned char c = (unsigned char) p[0];
+
+                  if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe))
+                    goto incomplete;
+                }
+              else /* m == 2 || m == 3 */
+                {
+                  unsigned char c = (unsigned char) p[0];
+
+                  if (c >= 0x90 && c <= 0xe3)
+                    {
+                      unsigned char c2 = (unsigned char) p[1];
+
+                      if (c2 >= 0x30 && c2 <= 0x39)
+                        {
+                          if (m == 2)
+                            goto incomplete;
+                          else /* m == 3 */
+                            {
+                              unsigned char c3 = (unsigned char) p[2];
+
+                              if (c3 >= 0x81 && c3 <= 0xfe)
+                                goto incomplete;
+                            }
+                        }
+                    }
+                }
+              goto invalid;
+            }
+
+          case enc_sjis: /* SJIS */
+            {
+              if (m == 1)
+                {
+                  unsigned char c = (unsigned char) p[0];
+
+                  if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)
+                      || (c >= 0xf0 && c <= 0xf9))
+                    goto incomplete;
+                }
+              goto invalid;
+            }
+
+          default:
+            /* An unknown multibyte encoding.  */
+            goto incomplete;
+          }
+      }
+
+   success:
+    /* res >= 0 is the corrected return value of
+       mbtowc_with_lock (&wc, p, m).  */
+    if (nstate >= (res > 0 ? res : 1))
+      abort ();
+    res -= nstate;
+    pstate[0] = 0;
+    return res;
+
+   incomplete:
+    {
+      size_t k = nstate;
+      /* Here 0 <= k < m < 4.  */
+      pstate[++k] = s[0];
+      if (k < m)
+        {
+          pstate[++k] = s[1];
+          if (k < m)
+            pstate[++k] = s[2];
+        }
+      if (k != m)
+        abort ();
+    }
+    pstate[0] = m;
+    return (size_t)(-2);
+
+   invalid:
+    errno = EILSEQ;
+    /* The conversion state is undefined, says POSIX.  */
+    return (size_t)(-1);
+  }
deleted file mode 120000 (symlink)
index 0b78e1444613f3affc732ebbef1488e2a3385fa0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbrtowc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8a1646d2f7b91f7bf13c72308a135292309184e6
--- /dev/null
@@ -0,0 +1,161 @@
+/* Convert multibyte character to wide character.
+   Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#if GNULIB_defined_mbstate_t
+/* Implement mbrtowc() on top of mbtowc() for the non-UTF-8 locales
+   and directly for the UTF-8 locales.  */
+
+# include <errno.h>
+# include <stdint.h>
+# include <stdlib.h>
+
+# if AVOID_ANY_THREADS
+
+/* The option '--disable-threads' explicitly requests no locking.  */
+
+# elif defined _WIN32 && !defined __CYGWIN__
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+# elif HAVE_PTHREAD_API
+
+#  include <pthread.h>
+#  if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS
+#   include <threads.h>
+#   pragma weak thrd_exit
+#   define c11_threads_in_use() (thrd_exit != NULL)
+#  else
+#   define c11_threads_in_use() 0
+#  endif
+
+# elif HAVE_THREADS_H
+
+#  include <threads.h>
+
+# endif
+
+# include "attribute.h"
+# include "lc-charset-dispatch.h"
+# include "mbtowc-lock.h"
+
+static_assert (sizeof (mbstate_t) >= 4);
+static char internal_state[4];
+
+size_t
+mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
+{
+# define FITS_IN_CHAR_TYPE(wc)  ((wc) <= WCHAR_MAX)
+# include "mbrtowc-impl.h"
+}
+
+#else
+/* Override the system's mbrtowc() function.  */
+
+# if MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ
+#  include "hard-locale.h"
+#  include <locale.h>
+# endif
+
+# undef mbrtowc
+
+size_t
+rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
+{
+  size_t ret;
+  wchar_t wc;
+
+# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG
+  if (s == NULL)
+    {
+      pwc = NULL;
+      s = "";
+      n = 1;
+    }
+# endif
+
+# if MBRTOWC_EMPTY_INPUT_BUG
+  if (n == 0)
+    return (size_t) -2;
+# endif
+
+  if (! pwc)
+    pwc = &wc;
+
+# if MBRTOWC_RETVAL_BUG
+  {
+    static mbstate_t internal_state;
+
+    /* Override mbrtowc's internal state.  We cannot call mbsinit() on the
+       hidden internal state, but we can call it on our variable.  */
+    if (ps == NULL)
+      ps = &internal_state;
+
+    if (!mbsinit (ps))
+      {
+        /* Parse the rest of the multibyte character byte for byte.  */
+        size_t count = 0;
+        for (; n > 0; s++, n--)
+          {
+            ret = mbrtowc (&wc, s, 1, ps);
+
+            if (ret == (size_t)(-1))
+              return (size_t)(-1);
+            count++;
+            if (ret != (size_t)(-2))
+              {
+                /* The multibyte character has been completed.  */
+                *pwc = wc;
+                return (wc == 0 ? 0 : count);
+              }
+          }
+        return (size_t)(-2);
+      }
+  }
+# endif
+
+# if MBRTOWC_STORES_INCOMPLETE_BUG
+  ret = mbrtowc (&wc, s, n, ps);
+  if (ret < (size_t) -2 && pwc != NULL)
+    *pwc = wc;
+# else
+  ret = mbrtowc (pwc, s, n, ps);
+# endif
+
+# if MBRTOWC_NUL_RETVAL_BUG
+  if (ret < (size_t) -2 && !*pwc)
+    return 0;
+# endif
+
+# if MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ
+  if ((size_t) -2 <= ret && n != 0 && ! hard_locale (LC_CTYPE))
+    {
+      unsigned char uc = *s;
+      *pwc = uc;
+      return 1;
+    }
+# endif
+
+  return ret;
+}
+
+#endif
deleted file mode 120000 (symlink)
index e06c1ed059728d9c694b7fb06865c507750f36c5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbscasecmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1abeb129d6a610178b2a8b704d56aea3ab6f4282
--- /dev/null
@@ -0,0 +1,114 @@
+/* Case-insensitive string comparison function.
+   Copyright (C) 1998-1999, 2005-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2005,
+   based on earlier glibc code.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+#include <ctype.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <uchar.h>
+
+#if GNULIB_MCEL_PREFER
+# include "mcel.h"
+#else
+# include "mbuiterf.h"
+#endif
+
+/* Compare the character 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 may, in multibyte locales, return 0 for strings of
+   different lengths!  */
+int
+mbscasecmp (const char *s1, const char *s2)
+{
+  if (s1 == s2)
+    return 0;
+
+  const char *iter1 = s1;
+  const char *iter2 = s2;
+
+  /* Be careful not to look at the entire extent of s1 or s2 until needed.
+     This is useful because when two strings differ, the difference is
+     most often already in the very few first characters.  */
+  if (MB_CUR_MAX > 1)
+    {
+#if GNULIB_MCEL_PREFER
+      while (true)
+        {
+          mcel_t g1 = mcel_scanz (iter1); iter1 += g1.len;
+          mcel_t g2 = mcel_scanz (iter2); iter2 += g2.len;
+          int cmp = mcel_tocmp (c32tolower, g1, g2);
+          if (cmp | !g1.ch)
+            return cmp;
+        }
+#else
+      mbuif_state_t state1;
+      mbuif_init (state1);
+
+      mbuif_state_t state2;
+      mbuif_init (state2);
+
+      while (mbuif_avail (state1, iter1) && mbuif_avail (state2, iter2))
+        {
+          mbchar_t cur1 = mbuif_next (state1, iter1);
+          mbchar_t cur2 = mbuif_next (state2, iter2);
+          int cmp = mb_casecmp (cur1, cur2);
+
+          if (cmp != 0)
+            return cmp;
+
+          iter1 += mb_len (cur1);
+          iter2 += mb_len (cur2);
+        }
+      if (mbuif_avail (state1, iter1))
+        /* s2 terminated before s1.  */
+        return 1;
+      if (mbuif_avail (state2, iter2))
+        /* s1 terminated before s2.  */
+        return -1;
+      return 0;
+#endif
+    }
+  else
+    for (;;)
+      {
+        unsigned char c1 = *iter1++;
+        unsigned char c2 = *iter2++;
+        /* On machines where 'char' and 'int' are types of the same size, the
+           difference of two 'unsigned char' values - including the sign bit -
+           doesn't fit in an 'int'.  */
+        int cmp = UCHAR_MAX <= INT_MAX ? c1 - c2 : _GL_CMP (c1, c2);
+        if (cmp != 0)
+          {
+            c1 = tolower (c1);
+            if (c1 == c2)
+              cmp = 0;
+            else
+              {
+                c2 = tolower (c2);
+                cmp = UCHAR_MAX <= INT_MAX ? c1 - c2 : _GL_CMP (c1, c2);
+              }
+          }
+        if (cmp | !c1)
+          return cmp;
+      }
+}
deleted file mode 120000 (symlink)
index f46697d6970370e6374e86a1eb24f2efa28e350b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbschr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a5f6e386231ba8a01b06d07f63ec5d0844aa7bd1
--- /dev/null
@@ -0,0 +1,69 @@
+/* Searching a string for a character.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2007.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+#include <stdlib.h>
+
+#if GNULIB_MCEL_PREFER
+# include "mcel.h"
+#else
+# include "mbuiterf.h"
+#endif
+
+/* Locate the first single-byte character C in the character string STRING,
+   and return a pointer to it.  Return NULL if C is not found in STRING.  */
+char *
+mbschr (const char *string, int c)
+{
+  if (MB_CUR_MAX > 1
+      /* Optimization: We know that ASCII characters < 0x30 don't occur as
+         part of multibyte characters longer than 1 byte.  Hence, if c < 0x30,
+         the faster unibyte loop can be used.  */
+      && (unsigned char) c >= 0x30)
+    {
+#if GNULIB_MCEL_PREFER
+      while (*string)
+        {
+          mcel_t g = mcel_scanz (string);
+          if (g.len == 1 && (unsigned char) *string == (unsigned char) c)
+            return (char *) string;
+          string += g.len;
+        }
+#else
+      mbuif_state_t state;
+      const char *iter;
+      for (mbuif_init (state), iter = string;; )
+        {
+          if (!mbuif_avail (state, iter))
+            goto notfound;
+          mbchar_t cur = mbuif_next (state, iter);
+          if (mb_len (cur) == 1 && (unsigned char) *iter == (unsigned char) c)
+            break;
+          iter += mb_len (cur);
+        }
+      return (char *) iter;
+     notfound:
+#endif
+      return NULL;
+    }
+  else
+    return strchr (string, c);
+}
deleted file mode 120000 (symlink)
index 0e16d5b7a1c61a3abc3183c37078ef525245eef1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbsinit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d1b8475c780bb288cbec5b40ef8d2226df1e44d1
--- /dev/null
@@ -0,0 +1,69 @@
+/* Test for initial conversion state.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+
+#if GNULIB_defined_mbstate_t
+
+/* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs()
+   and wcrtomb(), wcsrtombs().
+   We assume that
+     - sizeof (mbstate_t) >= 4,
+     - only stateless encodings are supported (such as UTF-8 and EUC-JP, but
+       not ISO-2022 variants),
+     - for each encoding, the number of bytes for a wide character is <= 4.
+       (This maximum is attained for UTF-8, GB18030, EUC-TW.)
+   We define the meaning of mbstate_t as follows:
+     - In mb -> wc direction, mbstate_t's first byte contains the number of
+       buffered bytes (in the range 0..3), followed by up to 3 buffered bytes.
+       See mbrtowc.c.
+     - In wc -> mb direction, mbstate_t contains no information. In other
+       words, it is always in an initial state.  */
+
+static_assert (sizeof (mbstate_t) >= 4);
+
+int
+mbsinit (const mbstate_t *ps)
+{
+  const char *pstate = (const char *)ps;
+
+  return pstate == NULL || pstate[0] == 0;
+}
+
+#else
+
+int
+mbsinit (const mbstate_t *ps)
+{
+# if defined _WIN32 && !defined __CYGWIN__
+  /* Native Windows.  */
+  /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4 bytes matter.
+     On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined as
+     an 8-byte struct, of which the first 4 bytes matter.  */
+  return ps == NULL || *(const unsigned int *)ps == 0;
+# else
+  /* Minix, HP-UX 11.00, Solaris 2.6, Interix, ...  */
+  /* Maybe this definition works, maybe not...  */
+  return ps == NULL || *(const char *)ps == 0;
+# endif
+}
+
+#endif
deleted file mode 120000 (symlink)
index 3877fdb440f945601463ba8b5500e9f6faea0586..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbslen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..171d395475541c95a5722b6ccd858e97625c98bb
--- /dev/null
@@ -0,0 +1,57 @@
+/* Counting the multibyte characters in a string.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2007.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+#include <stdlib.h>
+
+#if GNULIB_MCEL_PREFER
+# include "mcel.h"
+#else
+# include "mbuiterf.h"
+#endif
+
+/* Return the number of multibyte characters in the character string STRING.  */
+size_t
+mbslen (const char *string)
+{
+  if (MB_CUR_MAX > 1)
+    {
+      size_t count = 0;
+
+#if GNULIB_MCEL_PREFER
+      for (; *string; string += mcel_scanz (string).len)
+        count++;
+#else
+      mbuif_state_t state;
+      const char *iter;
+      for (mbuif_init (state), iter = string; mbuif_avail (state, iter); )
+        {
+          mbchar_t cur = mbuif_next (state, iter);
+          count++;
+          iter += mb_len (cur);
+        }
+#endif
+
+      return count;
+    }
+  else
+    return strlen (string);
+}
deleted file mode 120000 (symlink)
index 8954f21d6d759c1b7da76c5cea8b26f84221813f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbsrtoc32s-state.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4f6eeaa9db8ca5dcd6ee0a7c749dd1de20222ac8
--- /dev/null
@@ -0,0 +1,37 @@
+/* Convert string to 32-bit wide string.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2020.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+/* Internal state used by the functions mbsrtoc32s() and mbsnrtoc32s().  */
+mbstate_t _gl_mbsrtoc32s_state
+/* The state must initially be in an "initial state"; so, zero-initialize it.
+   On most systems, putting it into BSS is sufficient.  Not so on Mac OS X 10.3,
+   see <https://lists.gnu.org/r/bug-gnulib/2009-01/msg00329.html>.
+   When it needs an initializer, use 0 or {0} as initializer? 0 only works
+   when mbstate_t is a scalar type (such as when gnulib defines it, or on
+   AIX, IRIX, mingw). {0} works as an initializer in all cases: for a struct
+   or union type, but also for a scalar type (ISO C 99, 6.7.8.(11)).  */
+#if defined __ELF__
+  /* On ELF systems, variables in BSS behave well.  */
+#else
+  /* Use braces, to be on the safe side.  */
+  = { 0 }
+#endif
+  ;
deleted file mode 120000 (symlink)
index 467669e82e96cc54201b09fa16638dd8d74ca38d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbsrtoc32s.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..896dc51207903d569329deb263668d238d7e5883
--- /dev/null
@@ -0,0 +1,65 @@
+/* Convert string to 32-bit wide string.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2020.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define IN_MBSRTOC32S
+/* Specification.  */
+#include <uchar.h>
+
+#include <wchar.h>
+
+#if (HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4) || (GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION) || _GL_SMALL_WCHAR_T
+/* The char32_t encoding of a multibyte character may be different than its
+   wchar_t encoding, or char32_t is wider than wchar_t.  */
+
+# include <errno.h>
+# include <limits.h>
+# include <stdlib.h>
+
+# include "strnlen1.h"
+
+extern mbstate_t _gl_mbsrtoc32s_state;
+
+# define FUNC mbsrtoc32s
+# define DCHAR_T char32_t
+# define INTERNAL_STATE _gl_mbsrtoc32s_state
+# define MBRTOWC mbrtoc32
+# if GNULIB_MBRTOC32_REGULAR
+   /* If the 'mbrtoc32-regular' module is in use, we don't need to handle
+      a (size_t)(-3) return value from mbrtoc32.  */
+#  define USES_C32 0
+# else
+#  define USES_C32 1
+# endif
+# include "mbsrtowcs-impl.h"
+
+#else
+/* char32_t and wchar_t are equivalent.  */
+
+static_assert (sizeof (char32_t) == sizeof (wchar_t));
+
+# if _GL_WCHAR_T_IS_UCS4
+_GL_EXTERN_INLINE
+# endif
+size_t
+mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+{
+  return mbsrtowcs ((wchar_t *) dest, srcp, len, ps);
+}
+
+#endif
deleted file mode 120000 (symlink)
index 9117a8f21e65a244877043d6c370ba0a712252d7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbsrtowcs-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9043fb888edb6ea78df3df357a8aa4cba8d9e228
--- /dev/null
@@ -0,0 +1,123 @@
+/* Convert string to wide string.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+size_t
+FUNC (DCHAR_T *dest, const char **srcp, size_t len, mbstate_t *ps)
+{
+  if (ps == NULL)
+    ps = &INTERNAL_STATE;
+  {
+    const char *src = *srcp;
+
+    if (dest != NULL)
+      {
+        DCHAR_T *destptr = dest;
+
+        for (; len > 0; destptr++, len--)
+          {
+            size_t src_avail;
+            size_t ret;
+
+            /* An optimized variant of
+               src_avail = strnlen1 (src, MB_LEN_MAX);  */
+            if (src[0] == '\0')
+              src_avail = 1;
+            else if (src[1] == '\0')
+              src_avail = 2;
+            else if (src[2] == '\0')
+              src_avail = 3;
+            else if (MB_LEN_MAX <= 4 || src[3] == '\0')
+              src_avail = 4;
+            else
+              src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4);
+
+            /* Parse the next multibyte character.  */
+            ret = MBRTOWC (destptr, src, src_avail, ps);
+
+            if (ret == (size_t)(-2))
+              /* Encountered a multibyte character that extends past a '\0' byte
+                 or that is longer than MB_LEN_MAX bytes.  Cannot happen.  */
+              abort ();
+
+            if (ret == (size_t)(-1))
+              goto bad_input;
+            if (ret == 0)
+              {
+                src = NULL;
+                /* Here mbsinit (ps).  */
+                break;
+              }
+            if (!(USES_C32 && ret == (size_t)(-3)))
+              src += ret;
+          }
+
+        *srcp = src;
+        return destptr - dest;
+      }
+    else
+      {
+        /* Ignore dest and len, don't store *srcp at the end, and
+           don't clobber *ps.  */
+        mbstate_t state = *ps;
+        size_t totalcount = 0;
+
+        for (;; totalcount++)
+          {
+            size_t src_avail;
+            size_t ret;
+
+            /* An optimized variant of
+               src_avail = strnlen1 (src, MB_LEN_MAX);  */
+            if (src[0] == '\0')
+              src_avail = 1;
+            else if (src[1] == '\0')
+              src_avail = 2;
+            else if (src[2] == '\0')
+              src_avail = 3;
+            else if (MB_LEN_MAX <= 4 || src[3] == '\0')
+              src_avail = 4;
+            else
+              src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4);
+
+            /* Parse the next multibyte character.  */
+            ret = MBRTOWC (NULL, src, src_avail, &state);
+
+            if (ret == (size_t)(-2))
+              /* Encountered a multibyte character that extends past a '\0' byte
+                 or that is longer than MB_LEN_MAX bytes.  Cannot happen.  */
+              abort ();
+
+            if (ret == (size_t)(-1))
+              goto bad_input2;
+            if (ret == 0)
+              {
+                /* Here mbsinit (&state).  */
+                break;
+              }
+            src += ret;
+          }
+
+        return totalcount;
+      }
+
+   bad_input:
+    *srcp = src;
+   bad_input2:
+    errno = EILSEQ;
+    return (size_t)(-1);
+  }
+}
deleted file mode 120000 (symlink)
index 883a93e0d7d0e045b1b3c118fae152c22c7f78c7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbsrtowcs-state.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cbb8753b43c1dba96c9b2f59a660a8d635fa72a3
--- /dev/null
@@ -0,0 +1,37 @@
+/* Convert string to wide string.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <wchar.h>
+
+/* Internal state used by the functions mbsrtowcs() and mbsnrtowcs().  */
+mbstate_t _gl_mbsrtowcs_state
+/* The state must initially be in an "initial state"; so, zero-initialize it.
+   On most systems, putting it into BSS is sufficient.  Not so on Mac OS X 10.3,
+   see <https://lists.gnu.org/r/bug-gnulib/2009-01/msg00329.html>.
+   When it needs an initializer, use 0 or {0} as initializer? 0 only works
+   when mbstate_t is a scalar type (such as when gnulib defines it, or on
+   AIX, IRIX, mingw). {0} works as an initializer in all cases: for a struct
+   or union type, but also for a scalar type (ISO C 99, 6.7.8.(11)).  */
+#if defined __ELF__
+  /* On ELF systems, variables in BSS behave well.  */
+#else
+  /* Use braces, to be on the safe side.  */
+  = { 0 }
+#endif
+  ;
deleted file mode 120000 (symlink)
index 639b4312885600bac30686e616939075eef8850e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbsrtowcs.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c77179f60c517fa9133e68a304b02aa843b345e8
--- /dev/null
@@ -0,0 +1,37 @@
+/* Convert string to wide string.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "strnlen1.h"
+
+
+extern mbstate_t _gl_mbsrtowcs_state;
+
+#define FUNC mbsrtowcs
+#define DCHAR_T wchar_t
+#define INTERNAL_STATE _gl_mbsrtowcs_state
+#define MBRTOWC mbrtowc
+#define USES_C32 0
+#include "mbsrtowcs-impl.h"
deleted file mode 120000 (symlink)
index 09e9071672ea5a4cc9b829bb47e9e24fcbdaa69b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbswidth.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..87eee40223c63308302e5ef0de6ebfb370dd3224
--- /dev/null
@@ -0,0 +1,200 @@
+/* Determine the number of screen columns needed for a string.
+   Copyright (C) 2000-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <haible@clisp.cons.org>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "mbswidth.h"
+
+/* Get MB_CUR_MAX.  */
+#include <stdlib.h>
+
+#include <string.h>
+
+/* Get isprint().  */
+#include <ctype.h>
+
+/* Get mbstate_t, mbsinit().  */
+#include <wchar.h>
+
+/* Get char32_t, mbrtoc32(), c32iscntrl(), c32width().  */
+#include <uchar.h>
+
+/* Get INT_MAX.  */
+#include <limits.h>
+
+/* Returns the number of columns needed to represent the multibyte
+   character string pointed to by STRING.  If a non-printable character
+   occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
+   With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is
+   the multibyte analogue of the wcswidth function.  */
+int
+mbswidth (const char *string, int flags)
+{
+  return mbsnwidth (string, strlen (string), flags);
+}
+
+/* Returns the number of columns needed to represent the multibyte
+   character string pointed to by STRING of length NBYTES.  If a
+   non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is
+   specified, -1 is returned.  */
+int
+mbsnwidth (const char *string, size_t nbytes, int flags)
+{
+  const char *p = string;
+  const char *plimit = p + nbytes;
+  int width;
+
+  width = 0;
+  if (MB_CUR_MAX > 1)
+    {
+      while (p < plimit)
+        switch (*p)
+          {
+            case ' ': case '!': case '"': case '#': case '$': case '%':
+            case '&': case '\'': case '(': case ')': case '*':
+            case '+': case ',': case '-': case '.': case '/':
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+            case ':': case ';': case '<': case '=': case '>':
+            case '?': case '@':
+            case 'A': case 'B': case 'C': case 'D': case 'E':
+            case 'F': case 'G': case 'H': case 'I': case 'J':
+            case 'K': case 'L': case 'M': case 'N': case 'O':
+            case 'P': case 'Q': case 'R': case 'S': case 'T':
+            case 'U': case 'V': case 'W': case 'X': case 'Y':
+            case 'Z':
+            case '[': case '\\': case ']': case '^': case '_': case '`':
+            case 'a': case 'b': case 'c': case 'd': case 'e':
+            case 'f': case 'g': case 'h': case 'i': case 'j':
+            case 'k': case 'l': case 'm': case 'n': case 'o':
+            case 'p': case 'q': case 'r': case 's': case 't':
+            case 'u': case 'v': case 'w': case 'x': case 'y':
+            case 'z': case '{': case '|': case '}': case '~':
+              /* These characters are printable ASCII characters.  */
+              p++;
+              width++;
+              break;
+            default:
+              /* If we have a multibyte sequence, scan it up to its end.  */
+              {
+                mbstate_t mbstate;
+                mbszero (&mbstate);
+                for (;;)
+                  {
+                    char32_t wc;
+                    size_t bytes;
+                    int w;
+
+                    bytes = mbrtoc32 (&wc, p, plimit - p, &mbstate);
+
+                    if (bytes == (size_t) -1)
+                      /* An invalid multibyte sequence was encountered.  */
+                      {
+                        if (!(flags & MBSW_REJECT_INVALID))
+                          {
+                            p++;
+                            width++;
+                            break;
+                          }
+                        else
+                          return -1;
+                      }
+
+                    if (bytes == (size_t) -2)
+                      /* An incomplete multibyte character at the end.  */
+                      {
+                        if (!(flags & MBSW_REJECT_INVALID))
+                          {
+                            p = plimit;
+                            width++;
+                            break;
+                          }
+                        else
+                          return -1;
+                      }
+
+                    if (bytes == 0)
+                      /* A null wide character was encountered.  */
+                      bytes = 1;
+                    #if !GNULIB_MBRTOC32_REGULAR
+                    else if (bytes == (size_t) -3)
+                      bytes = 0;
+                    #endif
+
+                    w = c32width (wc);
+                    if (w >= 0)
+                      /* A printable multibyte character.  */
+                      {
+                        if (w > INT_MAX - width)
+                          goto overflow;
+                        width += w;
+                      }
+                    else
+                      /* An unprintable multibyte character.  */
+                      if (!(flags & MBSW_REJECT_UNPRINTABLE))
+                        {
+                          if (!c32iscntrl (wc))
+                            {
+                              if (width == INT_MAX)
+                                goto overflow;
+                              width++;
+                            }
+                        }
+                      else
+                        return -1;
+
+                    p += bytes;
+                    #if !GNULIB_MBRTOC32_REGULAR
+                    if (mbsinit (&mbstate))
+                    #endif
+                      break;
+                  }
+              }
+              break;
+          }
+      return width;
+    }
+
+  while (p < plimit)
+    {
+      unsigned char c = (unsigned char) *p++;
+
+      if (isprint (c))
+        {
+          if (width == INT_MAX)
+            goto overflow;
+          width++;
+        }
+      else if (!(flags & MBSW_REJECT_UNPRINTABLE))
+        {
+          if (!iscntrl (c))
+            {
+              if (width == INT_MAX)
+                goto overflow;
+              width++;
+            }
+        }
+      else
+        return -1;
+    }
+  return width;
+
+ overflow:
+  return INT_MAX;
+}
deleted file mode 120000 (symlink)
index 6a205f0b90dd079bc0b0c4f16860351e246d8dd5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbswidth.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ccd176d6b80e08d4622880db0656c5e3b2e83aed
--- /dev/null
@@ -0,0 +1,60 @@
+/* Determine the number of screen columns needed for a string.
+   Copyright (C) 2000-2004, 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses HAVE_DECL_MBSWIDTH_IN_WCHAR_H.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+/* Avoid a clash of our mbswidth() with a function of the same name defined
+   in UnixWare 7.1.1 <wchar.h>.  We need this #include before the #define
+   below.  */
+#if HAVE_DECL_MBSWIDTH_IN_WCHAR_H
+# include <wchar.h>
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Optional flags to influence mbswidth/mbsnwidth behavior.  */
+
+/* If this bit is set, return -1 upon finding an invalid or incomplete
+   character.  Otherwise, assume invalid characters have width 1.  */
+#define MBSW_REJECT_INVALID 1
+
+/* If this bit is set, return -1 upon finding a non-printable character.
+   Otherwise, assume unprintable characters have width 0 if they are
+   control characters and 1 otherwise.  */
+#define MBSW_REJECT_UNPRINTABLE 2
+
+
+/* Returns the number of screen columns needed for STRING.  */
+#define mbswidth gnu_mbswidth  /* avoid clash with UnixWare 7.1.1 function */
+extern int mbswidth (const char *string, int flags);
+
+/* Returns the number of screen columns needed for the NBYTES bytes
+   starting at BUF.  */
+extern int mbsnwidth (const char *buf, size_t nbytes, int flags);
+
+
+#ifdef __cplusplus
+}
+#endif
deleted file mode 120000 (symlink)
index a325b32e24312a962ceabc556e2d19278f3ef763..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbszero.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..25af2848eae43a83cbc1ae79c932011679e1d03b
--- /dev/null
@@ -0,0 +1,23 @@
+/* Put an mbstate_t into an initial conversion state.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+#define IN_MBSZERO
+/* Specification and implementation.  */
+#include <wchar.h>
deleted file mode 120000 (symlink)
index 5d5d0c53616faa16fa8ed61d439cd050ee8d9a56..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbtowc-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..92efb4a70833ee5f089cbdc23b893d9dcacf9983
--- /dev/null
@@ -0,0 +1,44 @@
+/* Convert multibyte character to wide character.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* We don't need a static internal state, because the encoding is not state
+   dependent, and when mbrtowc returns (size_t)(-2). we throw the result
+   away. */
+
+int
+mbtowc (wchar_t *pwc, const char *s, size_t n)
+{
+  if (s == NULL)
+    return 0;
+  else
+    {
+      mbstate_t state;
+      wchar_t wc;
+      size_t result;
+
+      mbszero (&state);
+      result = mbrtowc (&wc, s, n, &state);
+      if (result == (size_t)-1 || result == (size_t)-2)
+        {
+          errno = EILSEQ;
+          return -1;
+        }
+      if (pwc != NULL)
+        *pwc = wc;
+      return (wc == 0 ? 0 : result);
+    }
+}
deleted file mode 120000 (symlink)
index 5b057bca43a37bec20132b72a8e211be553e3819..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbtowc-lock.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9001c5af1fcce331d372e0b3cb1ca85dedc69935
--- /dev/null
@@ -0,0 +1,151 @@
+/* Return the internal lock used by mbrtowc and mbrtoc32.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019-2020.  */
+
+#include <config.h>
+
+/* The option '--disable-threads' explicitly requests no locking.  */
+/* When it is known that the gl_get_mbtowc_lock function is defined
+   by a dependency library, it should not be defined here.  */
+#if AVOID_ANY_THREADS || OMIT_MBTOWC_LOCK
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#else
+
+/* This file defines the internal lock used by mbrtowc and mbrtoc32.
+   It is a separate compilation unit, so that only one copy of it is
+   present when linking statically.  */
+
+/* Prohibit renaming this symbol.  */
+# undef gl_get_mbtowc_lock
+
+/* Macro for exporting a symbol (function, not variable) defined in this file,
+   when compiled into a shared library.  */
+# ifndef SHLIB_EXPORTED
+#  if HAVE_VISIBILITY
+  /* Override the effect of the compiler option '-fvisibility=hidden'.  */
+#   define SHLIB_EXPORTED __attribute__((__visibility__("default")))
+#  elif defined _WIN32 || defined __CYGWIN__
+#   define SHLIB_EXPORTED __declspec(dllexport)
+#  else
+#   define SHLIB_EXPORTED
+#  endif
+# endif
+
+# if defined _WIN32 && !defined __CYGWIN__
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+#  include "windows-initguard.h"
+
+/* The return type is a 'CRITICAL_SECTION *', not a 'glwthread_mutex_t *',
+   because the latter is not guaranteed to be a stable ABI in the future.  */
+
+/* Make sure the function gets exported from DLLs.  */
+SHLIB_EXPORTED CRITICAL_SECTION *gl_get_mbtowc_lock (void);
+
+static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT;
+static CRITICAL_SECTION lock;
+
+/* Returns the internal lock used by mbrtowc and mbrtoc32.  */
+CRITICAL_SECTION *
+gl_get_mbtowc_lock (void)
+{
+  if (!guard.done)
+    {
+      if (InterlockedIncrement (&guard.started) == 0)
+        {
+          /* This thread is the first one to need the lock.  Initialize it.  */
+          InitializeCriticalSection (&lock);
+          guard.done = 1;
+        }
+      else
+        {
+          /* Don't let guard.started grow and wrap around.  */
+          InterlockedDecrement (&guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this mutex.  */
+          while (!guard.done)
+            Sleep (0);
+        }
+    }
+  return &lock;
+}
+
+# elif HAVE_PTHREAD_API
+
+#  include <pthread.h>
+
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* Make sure the function gets exported from shared libraries.  */
+SHLIB_EXPORTED pthread_mutex_t *gl_get_mbtowc_lock (void);
+
+/* Returns the internal lock used by mbrtowc and mbrtoc32.  */
+pthread_mutex_t *
+gl_get_mbtowc_lock (void)
+{
+  return &mutex;
+}
+
+# elif HAVE_THREADS_H
+
+#  include <threads.h>
+#  include <stdlib.h>
+
+static int volatile init_needed = 1;
+static once_flag init_once = ONCE_FLAG_INIT;
+static mtx_t mutex;
+
+static void
+atomic_init (void)
+{
+  if (mtx_init (&mutex, mtx_plain) != thrd_success)
+    abort ();
+  init_needed = 0;
+}
+
+/* Make sure the function gets exported from shared libraries.  */
+SHLIB_EXPORTED mtx_t *gl_get_mbtowc_lock (void);
+
+/* Returns the internal lock used by mbrtowc and mbrtoc32.  */
+mtx_t *
+gl_get_mbtowc_lock (void)
+{
+  if (init_needed)
+    call_once (&init_once, atomic_init);
+  return &mutex;
+}
+
+# endif
+
+# if (defined _WIN32 || defined __CYGWIN__) && !defined _MSC_VER
+/* Make sure the '__declspec(dllimport)' in mbrtowc.c and mbrtoc32.c does not
+   cause a link failure when no DLLs are involved.  */
+#  if defined _WIN64 || defined _LP64
+#   define IMP(x) __imp_##x
+#  else
+#   define IMP(x) _imp__##x
+#  endif
+void * IMP(gl_get_mbtowc_lock) = &gl_get_mbtowc_lock;
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index 211336bb2167915550a07b9310a9fbfc5d9c140b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbtowc-lock.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..10f7dc7c85d881bb9b1692c387fd776087832d02
--- /dev/null
@@ -0,0 +1,125 @@
+/* Use the internal lock used by mbrtowc and mbrtoc32.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019-2020.  */
+
+/* Use a lock, so that no two threads can invoke mbtowc at the same time.  */
+
+static inline int
+mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m)
+{
+  /* Put the hidden internal state of mbtowc into an initial state.
+     This is needed at least with glibc, uClibc, and MSVC CRT.
+     See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>.  */
+  mbtowc (NULL, NULL, 0);
+
+  return mbtowc (pwc, p, m);
+}
+
+/* Prohibit renaming this symbol.  */
+#undef gl_get_mbtowc_lock
+
+#if AVOID_ANY_THREADS || GNULIB_MBRTOWC_SINGLE_THREAD
+
+/* All uses of this function are in a single thread.  No locking needed.  */
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+  return mbtowc_unlocked (pwc, p, m);
+}
+
+#elif defined _WIN32 && !defined __CYGWIN__
+
+extern __declspec(dllimport) CRITICAL_SECTION *gl_get_mbtowc_lock (void);
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+  CRITICAL_SECTION *lock = gl_get_mbtowc_lock ();
+  int ret;
+
+  EnterCriticalSection (lock);
+  ret = mbtowc_unlocked (pwc, p, m);
+  LeaveCriticalSection (lock);
+
+  return ret;
+}
+
+#elif HAVE_PTHREAD_API /* AIX, IRIX, Cygwin */
+
+extern
+# if defined _WIN32 || defined __CYGWIN__
+  __declspec(dllimport)
+# endif
+  pthread_mutex_t *gl_get_mbtowc_lock (void);
+
+# if HAVE_WEAK_SYMBOLS /* IRIX */
+
+   /* Avoid the need to link with '-lpthread'.  */
+#  pragma weak pthread_mutex_lock
+#  pragma weak pthread_mutex_unlock
+
+   /* Determine whether libpthread is in use.  */
+#  pragma weak pthread_mutexattr_gettype
+   /* See the comments in lock.h.  */
+#  define pthread_in_use() \
+     (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
+
+# else
+#  define pthread_in_use() 1
+# endif
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+  if (pthread_in_use())
+    {
+      pthread_mutex_t *lock = gl_get_mbtowc_lock ();
+      int ret;
+
+      if (pthread_mutex_lock (lock))
+        abort ();
+      ret = mbtowc_unlocked (pwc, p, m);
+      if (pthread_mutex_unlock (lock))
+        abort ();
+
+      return ret;
+    }
+  else
+    return mbtowc_unlocked (pwc, p, m);
+}
+
+#elif HAVE_THREADS_H
+
+extern mtx_t *gl_get_mbtowc_lock (void);
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+  mtx_t *lock = gl_get_mbtowc_lock ();
+  int ret;
+
+  if (mtx_lock (lock) != thrd_success)
+    abort ();
+  ret = mbtowc_unlocked (pwc, p, m);
+  if (mtx_unlock (lock) != thrd_success)
+    abort ();
+
+  return ret;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 00e6c063231da9ced6f9f7aa93eee4a6cdb96bd8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mbtowc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..31a2d635380e9084446699806d232b313b24897c
--- /dev/null
@@ -0,0 +1,26 @@
+/* Convert multibyte character to wide character.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <errno.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "mbtowc-impl.h"
deleted file mode 120000 (symlink)
index 7bc66d6bda9d85d07c77ec166d99b1c0dd7d5289..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mcel.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3c2ae462901c6f6419c3840e9f5f8869442d59ef
--- /dev/null
@@ -0,0 +1,3 @@
+#include <config.h>
+#define MCEL_INLINE _GL_EXTERN_INLINE
+#include "mcel.h"
deleted file mode 120000 (symlink)
index 03932e8c2097c1de169798124a427fb710e7b230..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mcel.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f6f006c90097c0cd2ddd7cf7025c7ee27dc66e8b
--- /dev/null
@@ -0,0 +1,296 @@
+/* Multi-byte characters, Error encodings, and Lengths (MCELs)
+   Copyright 2023-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* The macros in this file implement multi-byte character representation
+   and forward iteration through a multi-byte string.
+   They are simpler and can be faster than the mbiter family.
+   However, they do not support obsolescent encodings like CP864,
+   EBCDIC, Johab, and Shift JIS that glibc also does not support,
+   and it is up to the caller to coalesce encoding-error bytes if desired.
+
+   The mcel_scan function lets code iterate through an array of bytes,
+   supporting character encodings in practical use
+   more simply than using plain mbrtoc32.
+
+   Instead of this single-byte code:
+
+      char *p = ..., *lim = ...;
+      for (; p < lim; p++)
+        process (*p);
+
+   You can use this multi-byte code:
+
+      char *p = ..., *lim = ...;
+      for (mcel_t g; p < lim; p += g.len)
+        {
+          g = mcel_scan (p, lim);
+          process (g);
+        }
+
+   You can select from G using G.ch, G.err, and G.len.
+   G is an encoding error if G.err is nonzero, a character otherwise.
+
+   The mcel_scanz function is similar except it works with a
+   string of unknown but positive length that is terminated with '\0'.
+   Instead of this single-byte code:
+
+      char *p = ...;
+      for (; *p; p++)
+        process (*p);
+
+   You can use this multi-byte code:
+
+      char *p = ...;
+      for (mcel_t g; *p; p += g.len)
+        {
+          g = mcel_scanz (p);
+          process (g);
+        }
+
+   mcel_scant (P, TERMINATOR) is like mcel_scanz (P) except the
+   string is terminated by TERMINATOR.  The C standard says that the
+   TERMINATORs '\0', '\r', '\n', '.', '/' are safe, as they cannot be
+   a part (even a trailing byte) of a multi-byte character.
+   In practice TERMINATOR is safe if 0 <= TERMINATOR <= 0x2f (ASCII '/').
+
+   mcel_ch (CH, LEN) and mcel_err (ERR) construct mcel_t values.
+
+   mcel_cmp (G1, G2) compares two mcel_t values lexicographically by
+   character or by encoding byte value, with encoding bytes sorting
+   after characters.
+
+   Calls like c32isalpha (G.ch) test G; they return false for encoding
+   errors since calls like c32isalpha (0) return false.  Calls like
+   mcel_tocmp (c32tolower, G1, G2) are like mcel_cmp (G1, G2),
+   but transliterate first.
+
+   Although ISO C and POSIX allow encodings that have shift states or
+   that can produce multiple characters from an indivisible byte sequence,
+   POSIX does not require support for these encodings,
+   they are not in practical use on GNUish platforms,
+   and omitting support for them simplifies the API.  */
+
+#ifndef _MCEL_H
+#define _MCEL_H 1
+
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <verify.h>
+
+#include <limits.h>
+#include <stddef.h>
+#include <uchar.h>
+
+/* Pacify GCC re type limits.  */
+#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
+/* The maximum multi-byte character length supported on any platform.
+   This can be less than MB_LEN_MAX because many platforms have a
+   large MB_LEN_MAX to allow for stateful encodings, and mcel does not
+   support these encodings.  MCEL_LEN_MAX is enough for UTF-8, EUC,
+   Shift-JIS, GB18030, etc.  In all multi-byte encodings supported by glibc,
+   0 < MB_CUR_MAX <= MCEL_LEN_MAX <= MB_LEN_MAX.  */
+enum { MCEL_LEN_MAX = MB_LEN_MAX < 4 ? MB_LEN_MAX : 4 };
+
+/* Bounds for mcel_t members.  */
+enum { MCEL_CHAR_MAX = 0x10FFFF };
+enum { MCEL_ERR_MIN = 0x80 };
+
+/* mcel_t is a type representing a character CH or an encoding error byte ERR,
+   along with a count of the LEN bytes that represent CH or ERR.
+   If ERR is zero, CH is a valid character and 0 < LEN <= MCEL_LEN_MAX;
+   otherwise ERR is an encoding error byte, MCEL_ERR_MIN <= ERR,
+   CH == 0, and LEN == 1.  */
+typedef struct
+{
+  char32_t ch;
+  unsigned char err;
+  unsigned char len;
+} mcel_t;
+
+/* Every multi-byte character length fits in mcel_t's LEN.  */
+static_assert (MB_LEN_MAX <= UCHAR_MAX);
+
+/* Shifting an encoding error byte left by this value
+   suffices to sort encoding errors after characters.  */
+enum { MCEL_ERR_SHIFT = 14 };
+static_assert (MCEL_CHAR_MAX < MCEL_ERR_MIN << MCEL_ERR_SHIFT);
+
+/* Unsigned char promotes to int.  */
+static_assert (UCHAR_MAX <= INT_MAX);
+
+/* Bytes have 8 bits, as POSIX requires.  */
+static_assert (CHAR_BIT == 8);
+
+#ifndef _GL_LIKELY
+/* Rely on __builtin_expect, as provided by the module 'builtin-expect'.  */
+# define _GL_LIKELY(cond) __builtin_expect ((cond), 1)
+# define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0)
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef MCEL_INLINE
+# define MCEL_INLINE _GL_INLINE
+#endif
+
+/* mcel_t constructors.  */
+MCEL_INLINE mcel_t
+mcel_ch (char32_t ch, size_t len)
+{
+  assume (0 < len);
+  assume (len <= MCEL_LEN_MAX);
+  assume (ch <= MCEL_CHAR_MAX);
+  return (mcel_t) {.ch = ch, .len = len};
+}
+MCEL_INLINE mcel_t
+mcel_err (unsigned char err)
+{
+  assume (MCEL_ERR_MIN <= err);
+  return (mcel_t) {.err = err, .len = 1};
+}
+
+/* Compare C1 and C2, with encoding errors sorting after characters.
+   Return <0, 0, >0 for <, =, >.  */
+MCEL_INLINE int
+mcel_cmp (mcel_t c1, mcel_t c2)
+{
+  int ch1 = c1.ch, ch2 = c2.ch;
+  return ((c1.err - c2.err) * (1 << MCEL_ERR_SHIFT)) + (ch1 - ch2);
+}
+
+/* Apply the uchar translator TO to C1 and C2 and compare the results,
+   with encoding errors sorting after characters,
+   Return <0, 0, >0 for <, =, >.  */
+MCEL_INLINE int
+mcel_tocmp (wint_t (*to) (wint_t), mcel_t c1, mcel_t c2)
+{
+  int cmp = mcel_cmp (c1, c2);
+  if (_GL_LIKELY ((c1.err - c2.err) | !cmp))
+    return cmp;
+  int ch1 = to (c1.ch), ch2 = to (c2.ch);
+  return ch1 - ch2;
+}
+
+/* Whether C represents itself as a Unicode character
+   when it is the first byte of a single- or multi-byte character.
+   These days it is safe to assume ASCII, so do not support
+   obsolescent encodings like CP864, EBCDIC, Johab, and Shift JIS.  */
+MCEL_INLINE bool
+mcel_isbasic (char c)
+{
+  return _GL_LIKELY (0 <= c && c < MCEL_ERR_MIN);
+}
+
+/* With mcel there should be no need for the performance overhead of
+   replacing glibc mbrtoc32, as callers shouldn't care whether the
+   C locale treats a byte with the high bit set as an encoding error.  */
+#ifdef __GLIBC__
+# undef mbrtoc32
+#endif
+
+/* Scan bytes from P inclusive to LIM exclusive.  P must be less than LIM.
+   Return the character or encoding error starting at P.  */
+MCEL_INLINE mcel_t
+mcel_scan (char const *p, char const *lim)
+{
+  /* Handle ASCII quickly to avoid the overhead of calling mbrtoc32.
+     In supported encodings, the first byte of a multi-byte character
+     cannot be an ASCII byte.  */
+  char c = *p;
+  if (mcel_isbasic (c))
+    return mcel_ch (c, 1);
+
+  /* An initial mbstate_t; initialization optimized for some platforms.
+     For details about these and other platforms, see wchar.in.h.  */
+#if defined __GLIBC__ && 2 < __GLIBC__ + (2 <= __GLIBC_MINOR__)
+  /* Although only a trivial optimization, it's worth it for GNU.  */
+  mbstate_t mbs; mbs.__count = 0;
+#elif (defined __FreeBSD__ || defined __DragonFly__ || defined __OpenBSD__ \
+       || (defined __APPLE__ && defined __MACH__))
+  /* These platforms have 128-byte mbstate_t.  What were they thinking?
+     Initialize just for supported encodings (UTF-8, EUC, etc.).
+     Avoid memset because some compilers generate function call code.  */
+  struct mbhidden { char32_t ch; int utf8_want, euc_want; }
+    _GL_ATTRIBUTE_MAY_ALIAS;
+  union { mbstate_t m; struct mbhidden s; } u;
+  u.s.ch = u.s.utf8_want = u.s.euc_want = 0;
+# define mbs u.m
+#elif defined __NetBSD__
+  /* Experiments on both 32- and 64-bit NetBSD platforms have
+     shown that it doesn't work to clear fewer than 24 bytes.  */
+  struct mbhidden { long long int a, b, c; } _GL_ATTRIBUTE_MAY_ALIAS;
+  union { mbstate_t m; struct mbhidden s; } u;
+  u.s.a = u.s.b = u.s.c = 0;
+# define mbs u.m
+#else
+  /* mbstate_t has unknown structure or is not worth optimizing.  */
+  mbstate_t mbs = {0};
+#endif
+
+  char32_t ch;
+  size_t len = mbrtoc32 (&ch, p, lim - p, &mbs);
+
+#undef mbs
+
+  /* Any LEN with top bit set is an encoding error, as LEN == (size_t) -3
+     is not supported and MB_LEN_MAX is small.  */
+  if (_GL_UNLIKELY ((size_t) -1 / 2 < len))
+    return mcel_err (c);
+
+  /* A multi-byte character.  LEN must be positive,
+     as *P != '\0' and shift sequences are not supported.  */
+  return mcel_ch (ch, len);
+}
+
+/* Scan bytes from P, a byte sequence terminated by TERMINATOR.
+   If *P == TERMINATOR, scan just that byte; otherwise scan
+   bytes up to but not including TERMINATOR.
+   TERMINATOR must be ASCII, and should be '\0', '\r', '\n', '.', or '/'.
+   Return the character or encoding error starting at P.  */
+MCEL_INLINE mcel_t
+mcel_scant (char const *p, char terminator)
+{
+  /* Handle ASCII quickly for speed.  */
+  if (mcel_isbasic (*p))
+    return mcel_ch (*p, 1);
+
+  /* Defer to mcel_scan for non-ASCII.  Compute length with code that
+     is typically faster than strnlen.  */
+  char const *lim = p + 1;
+  for (int i = 0; i < MCEL_LEN_MAX - 1; i++)
+    lim += *lim != terminator;
+  return mcel_scan (p, lim);
+}
+
+/* Scan bytes from P, a byte sequence terminated by '\0'.
+   If *P == '\0', scan just that byte; otherwise scan
+   bytes up to but not including '\0'.
+   Return the character or encoding error starting at P.  */
+MCEL_INLINE mcel_t
+mcel_scanz (char const *p)
+{
+  return mcel_scant (p, '\0');
+}
+
+_GL_INLINE_HEADER_END
+
+#endif /* _MCEL_H */
deleted file mode 120000 (symlink)
index 159635c5ded6ec53cceb3d5b2bc03535e0c16dd6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/md5-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c82f18145e0176d2ecbde9891cb727ff711b5de6
--- /dev/null
@@ -0,0 +1,141 @@
+/* Functions to compute MD5 message digest of files or memory blocks.
+   according to the definition of MD5 in RFC 1321 from April 1992.
+   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2024 Free Software
+   Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_MD5
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "md5.h"
+
+#include <stdlib.h>
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+#include "af_alg.h"
+
+#ifdef _LIBC
+# include <endian.h>
+# if __BYTE_ORDER == __BIG_ENDIAN
+#  define WORDS_BIGENDIAN 1
+# endif
+/* We need to keep the namespace clean so define the MD5 function
+   protected using leading __ .  */
+# define md5_init_ctx __md5_init_ctx
+# define md5_process_block __md5_process_block
+# define md5_process_bytes __md5_process_bytes
+# define md5_finish_ctx __md5_finish_ctx
+# define md5_stream __md5_stream
+#endif
+
+#define BLOCKSIZE 32768
+#if BLOCKSIZE % 64 != 0
+# error "invalid BLOCKSIZE"
+#endif
+
+/* Compute MD5 message digest for bytes read from STREAM.  The
+   resulting message digest number will be written into the 16 bytes
+   beginning at RESBLOCK.  */
+int
+md5_stream (FILE *stream, void *resblock)
+{
+  switch (afalg_stream (stream, "md5", resblock, MD5_DIGEST_SIZE))
+    {
+    case 0: return 0;
+    case -EIO: return 1;
+    }
+
+  char *buffer = malloc (BLOCKSIZE + 72);
+  if (!buffer)
+    return 1;
+
+  struct md5_ctx ctx;
+  md5_init_ctx (&ctx);
+  size_t sum;
+
+  /* Iterate over full file contents.  */
+  while (1)
+    {
+      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
+         computation function processes the whole buffer so that with the
+         next round of the loop another block can be read.  */
+      size_t n;
+      sum = 0;
+
+      /* Read block.  Take care for partial reads.  */
+      while (1)
+        {
+          /* Either process a partial fread() from this loop,
+             or the fread() in afalg_stream may have gotten EOF.
+             We need to avoid a subsequent fread() as EOF may
+             not be sticky.  For details of such systems, see:
+             https://sourceware.org/bugzilla/show_bug.cgi?id=1190  */
+          if (feof (stream))
+            goto process_partial_block;
+
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+          sum += n;
+
+          if (sum == BLOCKSIZE)
+            break;
+
+          if (n == 0)
+            {
+              /* Check for the error flag IFF N == 0, so that we don't
+                 exit the loop after a partial read due to e.g., EAGAIN
+                 or EWOULDBLOCK.  */
+              if (ferror (stream))
+                {
+                  free (buffer);
+                  return 1;
+                }
+              goto process_partial_block;
+            }
+        }
+
+      /* Process buffer with BLOCKSIZE bytes.  Note that
+         BLOCKSIZE % 64 == 0
+       */
+      md5_process_block (buffer, BLOCKSIZE, &ctx);
+    }
+
+process_partial_block:
+
+  /* Process any remaining bytes.  */
+  if (sum > 0)
+    md5_process_bytes (buffer, sum, &ctx);
+
+  /* Construct result in desired memory.  */
+  md5_finish_ctx (&ctx, resblock);
+  free (buffer);
+  return 0;
+}
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 41e86433e13081f8874e6b643c7bcca8e9492475..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/md5.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8e02f15d14d77e9e3440eb053f401c6e4ca65caf
--- /dev/null
@@ -0,0 +1,394 @@
+/* Functions to compute MD5 message digest of files or memory blocks.
+   according to the definition of MD5 in RFC 1321 from April 1992.
+   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2024 Free Software
+   Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_MD5
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "md5.h"
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+
+#ifdef _LIBC
+# include <endian.h>
+# if __BYTE_ORDER == __BIG_ENDIAN
+#  define WORDS_BIGENDIAN 1
+# endif
+/* We need to keep the namespace clean so define the MD5 function
+   protected using leading __ .  */
+# define md5_init_ctx __md5_init_ctx
+# define md5_process_block __md5_process_block
+# define md5_process_bytes __md5_process_bytes
+# define md5_finish_ctx __md5_finish_ctx
+# define md5_read_ctx __md5_read_ctx
+# define md5_buffer __md5_buffer
+#endif
+
+#include <byteswap.h>
+#ifdef WORDS_BIGENDIAN
+# define SWAP(n) bswap_32 (n)
+#else
+# define SWAP(n) (n)
+#endif
+
+#if ! HAVE_OPENSSL_MD5
+
+/* This array contains the bytes used to pad the buffer to the next
+   64-byte boundary.  (RFC 1321, 3.1: Step 1)  */
+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
+
+
+/* Initialize structure containing state of computation.
+   (RFC 1321, 3.3: Step 3)  */
+void
+md5_init_ctx (struct md5_ctx *ctx)
+{
+  ctx->A = 0x67452301;
+  ctx->B = 0xefcdab89;
+  ctx->C = 0x98badcfe;
+  ctx->D = 0x10325476;
+
+  ctx->total[0] = ctx->total[1] = 0;
+  ctx->buflen = 0;
+}
+
+/* Copy the 4 byte value from v into the memory location pointed to by *cp,
+   If your architecture allows unaligned access this is equivalent to
+   * (uint32_t *) cp = v  */
+static void
+set_uint32 (char *cp, uint32_t v)
+{
+  memcpy (cp, &v, sizeof v);
+}
+
+/* Put result from CTX in first 16 bytes following RESBUF.  The result
+   must be in little endian byte order.  */
+void *
+md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
+{
+  char *r = resbuf;
+  set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A));
+  set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B));
+  set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C));
+  set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D));
+
+  return resbuf;
+}
+
+/* Process the remaining bytes in the internal buffer and the usual
+   prolog according to the standard and write the result to RESBUF.  */
+void *
+md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
+{
+  /* Take yet unprocessed bytes into account.  */
+  uint32_t bytes = ctx->buflen;
+  size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
+
+  /* Now count remaining bytes.  */
+  ctx->total[0] += bytes;
+  if (ctx->total[0] < bytes)
+    ++ctx->total[1];
+
+  /* Put the 64-bit file length in *bits* at the end of the buffer.  */
+  ctx->buffer[size - 2] = SWAP (ctx->total[0] << 3);
+  ctx->buffer[size - 1] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
+
+  memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
+
+  /* Process last bytes.  */
+  md5_process_block (ctx->buffer, size * 4, ctx);
+
+  return md5_read_ctx (ctx, resbuf);
+}
+
+/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+void *
+md5_buffer (const char *buffer, size_t len, void *resblock)
+{
+  struct md5_ctx ctx;
+
+  /* Initialize the computation context.  */
+  md5_init_ctx (&ctx);
+
+  /* Process whole buffer but last len % 64 bytes.  */
+  md5_process_bytes (buffer, len, &ctx);
+
+  /* Put result in desired memory area.  */
+  return md5_finish_ctx (&ctx, resblock);
+}
+
+
+void
+md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
+{
+  /* When we already have some bits in our internal buffer concatenate
+     both inputs first.  */
+  if (ctx->buflen != 0)
+    {
+      size_t left_over = ctx->buflen;
+      size_t add = 128 - left_over > len ? len : 128 - left_over;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
+      ctx->buflen += add;
+
+      if (ctx->buflen > 64)
+        {
+          md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+
+          ctx->buflen &= 63;
+          /* The regions in the following copy operation cannot overlap,
+             because ctx->buflen < 64 ≤ (left_over + add) & ~63.  */
+          memcpy (ctx->buffer,
+                  &((char *) ctx->buffer)[(left_over + add) & ~63],
+                  ctx->buflen);
+        }
+
+      buffer = (const char *) buffer + add;
+      len -= add;
+    }
+
+  /* Process available complete blocks.  */
+  if (len >= 64)
+    {
+#if !(_STRING_ARCH_unaligned || _STRING_INLINE_unaligned)
+# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
+      if (UNALIGNED_P (buffer))
+        while (len > 64)
+          {
+            md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+            buffer = (const char *) buffer + 64;
+            len -= 64;
+          }
+      else
+#endif
+        {
+          md5_process_block (buffer, len & ~63, ctx);
+          buffer = (const char *) buffer + (len & ~63);
+          len &= 63;
+        }
+    }
+
+  /* Move remaining bytes in internal buffer.  */
+  if (len > 0)
+    {
+      size_t left_over = ctx->buflen;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
+      left_over += len;
+      if (left_over >= 64)
+        {
+          md5_process_block (ctx->buffer, 64, ctx);
+          left_over -= 64;
+          /* The regions in the following copy operation cannot overlap,
+             because left_over ≤ 64.  */
+          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
+      ctx->buflen = left_over;
+    }
+}
+
+
+/* These are the four functions used in the four steps of the MD5 algorithm
+   and defined in the RFC 1321.  The first function is a little bit optimized
+   (as found in Colin Plumbs public domain implementation).  */
+/* #define FF(b, c, d) ((b & c) | (~b & d)) */
+#define FF(b, c, d) (d ^ (b & (c ^ d)))
+#define FG(b, c, d) FF (d, b, c)
+#define FH(b, c, d) (b ^ c ^ d)
+#define FI(b, c, d) (c ^ (b | ~d))
+
+/* Process LEN bytes of BUFFER, accumulating context into CTX.
+   It is assumed that LEN % 64 == 0.  */
+
+void
+md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
+{
+  uint32_t correct_words[16];
+  const uint32_t *words = buffer;
+  size_t nwords = len / sizeof (uint32_t);
+  const uint32_t *endp = words + nwords;
+  uint32_t A = ctx->A;
+  uint32_t B = ctx->B;
+  uint32_t C = ctx->C;
+  uint32_t D = ctx->D;
+  uint32_t lolen = len;
+
+  /* First increment the byte count.  RFC 1321 specifies the possible
+     length of the file up to 2^64 bits.  Here we only compute the
+     number of bytes.  Do a double word increment.  */
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
+
+  /* Process all bytes in the buffer with 64 bytes in each round of
+     the loop.  */
+  while (words < endp)
+    {
+      uint32_t *cwp = correct_words;
+      uint32_t A_save = A;
+      uint32_t B_save = B;
+      uint32_t C_save = C;
+      uint32_t D_save = D;
+
+      /* First round: using the given function, the context and a constant
+         the next context is computed.  Because the algorithms processing
+         unit is a 32-bit word and it is determined to work on words in
+         little endian byte order we perhaps have to change the byte order
+         before the computation.  To reduce the work for the next steps
+         we store the swapped words in the array CORRECT_WORDS.  */
+
+#define OP(a, b, c, d, s, T)                                            \
+      do                                                                \
+        {                                                               \
+          a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;             \
+          ++words;                                                      \
+          CYCLIC (a, s);                                                \
+          a += b;                                                       \
+        }                                                               \
+      while (0)
+
+      /* It is unfortunate that C does not provide an operator for
+         cyclic rotation.  Hope the C compiler is smart enough.  */
+#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
+
+      /* Before we start, one word to the strange constants.
+         They are defined in RFC 1321 as
+
+         T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
+
+         Here is an equivalent invocation using Perl:
+
+         perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}'
+       */
+
+      /* Round 1.  */
+      OP (A, B, C, D, 7, 0xd76aa478);
+      OP (D, A, B, C, 12, 0xe8c7b756);
+      OP (C, D, A, B, 17, 0x242070db);
+      OP (B, C, D, A, 22, 0xc1bdceee);
+      OP (A, B, C, D, 7, 0xf57c0faf);
+      OP (D, A, B, C, 12, 0x4787c62a);
+      OP (C, D, A, B, 17, 0xa8304613);
+      OP (B, C, D, A, 22, 0xfd469501);
+      OP (A, B, C, D, 7, 0x698098d8);
+      OP (D, A, B, C, 12, 0x8b44f7af);
+      OP (C, D, A, B, 17, 0xffff5bb1);
+      OP (B, C, D, A, 22, 0x895cd7be);
+      OP (A, B, C, D, 7, 0x6b901122);
+      OP (D, A, B, C, 12, 0xfd987193);
+      OP (C, D, A, B, 17, 0xa679438e);
+      OP (B, C, D, A, 22, 0x49b40821);
+
+      /* For the second to fourth round we have the possibly swapped words
+         in CORRECT_WORDS.  Redefine the macro to take an additional first
+         argument specifying the function to use.  */
+#undef OP
+#define OP(f, a, b, c, d, k, s, T)                                      \
+      do                                                                \
+        {                                                               \
+          a += f (b, c, d) + correct_words[k] + T;                      \
+          CYCLIC (a, s);                                                \
+          a += b;                                                       \
+        }                                                               \
+      while (0)
+
+      /* Round 2.  */
+      OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
+      OP (FG, D, A, B, C, 6, 9, 0xc040b340);
+      OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
+      OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
+      OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
+      OP (FG, D, A, B, C, 10, 9, 0x02441453);
+      OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
+      OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
+      OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
+      OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
+      OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
+      OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
+      OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
+      OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
+      OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
+      OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
+
+      /* Round 3.  */
+      OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
+      OP (FH, D, A, B, C, 8, 11, 0x8771f681);
+      OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
+      OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
+      OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
+      OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
+      OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
+      OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
+      OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
+      OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
+      OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
+      OP (FH, B, C, D, A, 6, 23, 0x04881d05);
+      OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
+      OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
+      OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
+      OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
+
+      /* Round 4.  */
+      OP (FI, A, B, C, D, 0, 6, 0xf4292244);
+      OP (FI, D, A, B, C, 7, 10, 0x432aff97);
+      OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
+      OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
+      OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
+      OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
+      OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
+      OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
+      OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
+      OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
+      OP (FI, C, D, A, B, 6, 15, 0xa3014314);
+      OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
+      OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
+      OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
+      OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
+      OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
+
+      /* Add the starting values of the context.  */
+      A += A_save;
+      B += B_save;
+      C += C_save;
+      D += D_save;
+    }
+
+  /* Put checksum in context given as argument.  */
+  ctx->A = A;
+  ctx->B = B;
+  ctx->C = C;
+  ctx->D = D;
+}
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index fdacae3dddd88c3ff57f33e0d23c8dcd2cb4f06a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/md5.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2f470703f5c0815d23b7070c46cf938227d8caa8
--- /dev/null
@@ -0,0 +1,174 @@
+/* Declaration of functions and data types used for MD5 sum computing
+   library functions.
+   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2024 Free Software
+   Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _MD5_H
+#define _MD5_H 1
+
+/* This file uses HAVE_OPENSSL_MD5.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdio.h>
+#include <stdint.h>
+
+# if HAVE_OPENSSL_MD5
+#  ifndef OPENSSL_API_COMPAT
+#   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
+#  endif
+/* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
+#  include <openssl/opensslv.h>
+#  if OPENSSL_VERSION_MAJOR >= 3
+#   include <openssl/configuration.h>
+#   if (OPENSSL_CONFIGURED_API \
+        < (OPENSSL_API_COMPAT < 0x900000L ? OPENSSL_API_COMPAT : \
+           ((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \
+           + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \
+           + ((OPENSSL_API_COMPAT >> 12) & 0xFF)))
+#    undef HAVE_OPENSSL_MD5
+#   endif
+#  endif
+#  if HAVE_OPENSSL_MD5
+#   include <openssl/md5.h>
+#  endif
+# endif
+
+#define MD5_DIGEST_SIZE 16
+#define MD5_BLOCK_SIZE 64
+
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_MINOR__
+#  define __GNUC_PREREQ(maj, min)                                       \
+  ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+# else
+#  define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+
+#ifndef __THROW
+# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
+#  if __cplusplus >= 201103L
+#   define __THROW      noexcept (true)
+#  else
+#   define __THROW      throw ()
+#  endif
+# else
+#  define __THROW
+# endif
+#endif
+
+#ifndef _LIBC
+# define __md5_buffer md5_buffer
+# define __md5_finish_ctx md5_finish_ctx
+# define __md5_init_ctx md5_init_ctx
+# define __md5_process_block md5_process_block
+# define __md5_process_bytes md5_process_bytes
+# define __md5_read_ctx md5_read_ctx
+# define __md5_stream md5_stream
+#endif
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if HAVE_OPENSSL_MD5
+#  define GL_OPENSSL_NAME 5
+#  include "gl_openssl.h"
+# else
+/* Structure to save state of computation between the single steps.  */
+struct md5_ctx
+{
+  uint32_t A;
+  uint32_t B;
+  uint32_t C;
+  uint32_t D;
+
+  uint32_t total[2];
+  uint32_t buflen;     /* ≥ 0, ≤ 128 */
+  uint32_t buffer[32]; /* 128 bytes; the first buflen bytes are in use */
+};
+
+/*
+ * The following three functions are build up the low level used in
+ * the functions 'md5_stream' and 'md5_buffer'.
+ */
+
+/* Initialize structure containing state of computation.
+   (RFC 1321, 3.3: Step 3)  */
+extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is necessary that LEN is a multiple of 64!!! */
+extern void __md5_process_block (const void *buffer, size_t len,
+                                 struct md5_ctx *ctx) __THROW;
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is NOT required that LEN is a multiple of 64.  */
+extern void __md5_process_bytes (const void *buffer, size_t len,
+                                 struct md5_ctx *ctx) __THROW;
+
+/* Process the remaining bytes in the buffer and put result from CTX
+   in first 16 bytes following RESBUF.  The result is always in little
+   endian byte order, so that a byte-wise output yields to the wanted
+   ASCII representation of the message digest.  */
+extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *restrict resbuf)
+     __THROW;
+
+
+/* Put result from CTX in first 16 bytes following RESBUF.  The result is
+   always in little endian byte order, so that a byte-wise output yields
+   to the wanted ASCII representation of the message digest.  */
+extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *restrict resbuf)
+     __THROW;
+
+
+/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+extern void *__md5_buffer (const char *buffer, size_t len,
+                           void *restrict resblock) __THROW;
+
+# endif
+
+/* Compute MD5 message digest for bytes read from STREAM.
+   STREAM is an open file stream.  Regular files are handled more efficiently.
+   The contents of STREAM from its current position to its end will be read.
+   The case that the last operation on STREAM was an 'ungetc' is not supported.
+   The resulting message digest number will be written into the 16 bytes
+   beginning at RESBLOCK.  */
+extern int __md5_stream (FILE *stream, void *resblock) __THROW;
+
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif /* md5.h */
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index b1268cceb45ec6a16a7fb863305d1dd8c60ae960..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memcasecmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4df47c80ad096477db56027f5923fb4dee965bdd
--- /dev/null
@@ -0,0 +1,48 @@
+/* Case-insensitive buffer comparator.
+   Copyright (C) 1996-1997, 2000, 2003, 2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "memcasecmp.h"
+
+#include <ctype.h>
+#include <limits.h>
+
+/* Like memcmp, but ignore differences in case.
+   Convert to upper case (not lower) before comparing so that
+   join -i works with sort -f.  */
+
+int
+memcasecmp (const void *vs1, const void *vs2, size_t n)
+{
+  size_t i;
+  char const *s1 = vs1;
+  char const *s2 = vs2;
+  for (i = 0; i < n; i++)
+    {
+      unsigned char u1 = s1[i];
+      unsigned char u2 = s2[i];
+      int U1 = toupper (u1);
+      int U2 = toupper (u2);
+      int diff = (UCHAR_MAX <= INT_MAX ? U1 - U2 : _GL_CMP (U1, U2));
+      if (diff)
+        return diff;
+    }
+  return 0;
+}
deleted file mode 120000 (symlink)
index f91205b0a61c88efe2d3af916d142feda056af69..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memcasecmp.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..185552850a6104cea9f6de8552a9bcbb4fa7bbfe
--- /dev/null
@@ -0,0 +1,27 @@
+/* Case-insensitive buffer comparator.
+
+   Copyright (C) 1996, 1998, 2003, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+int memcasecmp (const void *vs1, const void *vs2, size_t n) _GL_ATTRIBUTE_PURE;
deleted file mode 120000 (symlink)
index f94157da5989ee7439cdbad885305e8661758e27..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memchr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..67687a8f1721942d783da50cf55b0b2b8d8a605e
--- /dev/null
@@ -0,0 +1,172 @@
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2024
+   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).
+
+   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 file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+#include <string.h>
+
+#include <stddef.h>
+
+#if defined _LIBC
+# include <memcopy.h>
+#else
+# define reg_char char
+#endif
+
+#include <limits.h>
+
+#if HAVE_BP_SYM_H || defined _LIBC
+# include <bp-sym.h>
+#else
+# define BP_SYM(sym) sym
+#endif
+
+#undef __memchr
+#ifdef _LIBC
+# undef memchr
+#endif
+
+#ifndef weak_alias
+# define __memchr memchr
+#endif
+
+/* Search no more than N bytes of S for C.  */
+void *
+__memchr (void const *s, int c_in, size_t n)
+{
+  /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
+     long instead of a 64-bit uintmax_t tends to give better
+     performance.  On 64-bit hardware, unsigned long is generally 64
+     bits already.  Change this typedef to experiment with
+     performance.  */
+  typedef unsigned long int longword;
+
+  const unsigned char *char_ptr;
+  const longword *longword_ptr;
+  longword repeated_one;
+  longword repeated_c;
+  unsigned reg_char c;
+
+  c = (unsigned char) c_in;
+
+  /* Handle the first few bytes by reading one byte at a time.
+     Do this until CHAR_PTR is aligned on a longword boundary.  */
+  for (char_ptr = (const unsigned char *) s;
+       n > 0 && (size_t) char_ptr % sizeof (longword) != 0;
+       --n, ++char_ptr)
+    if (*char_ptr == c)
+      return (void *) char_ptr;
+
+  longword_ptr = (const longword *) char_ptr;
+
+  /* All these elucidatory comments refer to 4-byte longwords,
+     but the theory applies equally well to any size longwords.  */
+
+  /* Compute auxiliary longword values:
+     repeated_one is a value which has a 1 in every byte.
+     repeated_c has c in every byte.  */
+  repeated_one = 0x01010101;
+  repeated_c = c | (c << 8);
+  repeated_c |= repeated_c << 16;
+  if (0xffffffffU < (longword) -1)
+    {
+      repeated_one |= repeated_one << 31 << 1;
+      repeated_c |= repeated_c << 31 << 1;
+      if (8 < sizeof (longword))
+        {
+          size_t i;
+
+          for (i = 64; i < sizeof (longword) * 8; i *= 2)
+            {
+              repeated_one |= repeated_one << i;
+              repeated_c |= repeated_c << i;
+            }
+        }
+    }
+
+  /* Instead of the traditional loop which tests each byte, 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 equal to c.  We first use an xor
+     with repeated_c.  This reduces the task to testing whether *any of the
+     four* bytes in longword1 is zero.
+
+     We compute tmp =
+       ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
+     That is, we perform the following operations:
+       1. Subtract repeated_one.
+       2. & ~longword1.
+       3. & a mask consisting of 0x80 in every byte.
+     Consider what happens in each byte:
+       - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
+         and step 3 transforms it into 0x80.  A carry can also be propagated
+         to more significant bytes.
+       - If a byte of longword1 is nonzero, let its lowest 1 bit be at
+         position k (0 <= k <= 7); so the lowest k bits are 0.  After step 1,
+         the byte ends in a single bit of value 0 and k bits of value 1.
+         After step 2, the result is just k bits of value 1: 2^k - 1.  After
+         step 3, the result is 0.  And no carry is produced.
+     So, if longword1 has only non-zero bytes, tmp is zero.
+     Whereas if longword1 has a zero byte, call j the position of the least
+     significant zero byte.  Then the result has a zero at positions 0, ...,
+     j-1 and a 0x80 at position j.  We cannot predict the result at the more
+     significant bytes (positions j+1..3), but it does not matter since we
+     already have a non-zero bit at position 8*j+7.
+
+     So, the test whether any byte in longword1 is zero is equivalent to
+     testing whether tmp is nonzero.  */
+
+  while (n >= sizeof (longword))
+    {
+      longword longword1 = *longword_ptr ^ repeated_c;
+
+      if ((((longword1 - repeated_one) & ~longword1)
+           & (repeated_one << 7)) != 0)
+        break;
+      longword_ptr++;
+      n -= sizeof (longword);
+    }
+
+  char_ptr = (const unsigned char *) longword_ptr;
+
+  /* At this point, we know that either n < sizeof (longword), or one of the
+     sizeof (longword) bytes starting at char_ptr is == c.  On little-endian
+     machines, we could determine the first such byte without any further
+     memory accesses, just by looking at the tmp result from the last loop
+     iteration.  But this does not work on big-endian machines.  Choose code
+     that works in both cases.  */
+
+  for (; n > 0; --n, ++char_ptr)
+    {
+      if (*char_ptr == c)
+        return (void *) char_ptr;
+    }
+
+  return NULL;
+}
+#ifdef weak_alias
+weak_alias (__memchr, BP_SYM (memchr))
+#endif
deleted file mode 120000 (symlink)
index a6994ab720d97bbb024695b3398e66803a628f27..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memchr.valgrind
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0295d7e62fcbe40d35d89ba7a17aafbf0684058f
--- /dev/null
@@ -0,0 +1,30 @@
+# Suppress a valgrind message about use of uninitialized memory in memchr().
+
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+#
+# This file is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# POSIX states that when the character is found, memchr must not read extra
+# bytes in an overestimated length (for example, where memchr is used to
+# implement strnlen).  However, we use a safe word read to provide a speedup.
+{
+    memchr-value4
+    Memcheck:Value4
+    fun:rpl_memchr
+}
+{
+    memchr-value8
+    Memcheck:Value8
+    fun:rpl_memchr
+}
deleted file mode 120000 (symlink)
index 079584856d19059625f0f3de3d24b18339bed08c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memchr2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..63419976b05ce4b303c470281017ea0230afd500
--- /dev/null
@@ -0,0 +1,169 @@
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2024
+   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 in glibc by Roland McGrath (roland@ai.mit.edu).
+   Extension to memchr2 implemented by Eric Blake (ebb9@byu.net).
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "memchr2.h"
+
+#include <limits.h>
+#include <stdint.h>
+#include <string.h>
+
+/* Return the first address of either C1 or C2 (treated as unsigned
+   char) that occurs within N bytes of the memory region S.  If
+   neither byte appears, return NULL.  */
+void *
+memchr2 (void const *s, int c1_in, int c2_in, size_t n)
+{
+  /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
+     long instead of a 64-bit uintmax_t tends to give better
+     performance.  On 64-bit hardware, unsigned long is generally 64
+     bits already.  Change this typedef to experiment with
+     performance.  */
+  typedef unsigned long int longword;
+
+  const unsigned char *char_ptr;
+  void const *void_ptr;
+  const longword *longword_ptr;
+  longword repeated_one;
+  longword repeated_c1;
+  longword repeated_c2;
+  unsigned char c1;
+  unsigned char c2;
+
+  c1 = (unsigned char) c1_in;
+  c2 = (unsigned char) c2_in;
+
+  if (c1 == c2)
+    return memchr (s, c1, n);
+
+  /* Handle the first few bytes by reading one byte at a time.
+     Do this until VOID_PTR is aligned on a longword boundary.  */
+  for (void_ptr = s;
+       n > 0 && (uintptr_t) void_ptr % sizeof (longword) != 0;
+       --n)
+    {
+      char_ptr = void_ptr;
+      if (*char_ptr == c1 || *char_ptr == c2)
+        return (void *) void_ptr;
+      void_ptr = char_ptr + 1;
+    }
+
+  longword_ptr = void_ptr;
+
+  /* All these elucidatory comments refer to 4-byte longwords,
+     but the theory applies equally well to any size longwords.  */
+
+  /* Compute auxiliary longword values:
+     repeated_one is a value which has a 1 in every byte.
+     repeated_c1 has c1 in every byte.
+     repeated_c2 has c2 in every byte.  */
+  repeated_one = 0x01010101;
+  repeated_c1 = c1 | (c1 << 8);
+  repeated_c2 = c2 | (c2 << 8);
+  repeated_c1 |= repeated_c1 << 16;
+  repeated_c2 |= repeated_c2 << 16;
+  if (0xffffffffU < (longword) -1)
+    {
+      repeated_one |= repeated_one << 31 << 1;
+      repeated_c1 |= repeated_c1 << 31 << 1;
+      repeated_c2 |= repeated_c2 << 31 << 1;
+      if (8 < sizeof (longword))
+        {
+          size_t i;
+
+          for (i = 64; i < sizeof (longword) * 8; i *= 2)
+            {
+              repeated_one |= repeated_one << i;
+              repeated_c1 |= repeated_c1 << i;
+              repeated_c2 |= repeated_c2 << i;
+            }
+        }
+    }
+
+  /* Instead of the traditional loop which tests each byte, 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 equal to c1 or c2.  We first use
+     an xor with repeated_c1 and repeated_c2, respectively.  This reduces
+     the task to testing whether *any of the four* bytes in longword1 or
+     longword2 is zero.
+
+     Let's consider longword1.  We compute tmp1 =
+       ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
+     That is, we perform the following operations:
+       1. Subtract repeated_one.
+       2. & ~longword1.
+       3. & a mask consisting of 0x80 in every byte.
+     Consider what happens in each byte:
+       - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
+         and step 3 transforms it into 0x80.  A carry can also be propagated
+         to more significant bytes.
+       - If a byte of longword1 is nonzero, let its lowest 1 bit be at
+         position k (0 <= k <= 7); so the lowest k bits are 0.  After step 1,
+         the byte ends in a single bit of value 0 and k bits of value 1.
+         After step 2, the result is just k bits of value 1: 2^k - 1.  After
+         step 3, the result is 0.  And no carry is produced.
+     So, if longword1 has only non-zero bytes, tmp1 is zero.
+     Whereas if longword1 has a zero byte, call j the position of the least
+     significant zero byte.  Then the result has a zero at positions 0, ...,
+     j-1 and a 0x80 at position j.  We cannot predict the result at the more
+     significant bytes (positions j+1..3), but it does not matter since we
+     already have a non-zero bit at position 8*j+7.
+
+     Similarly, we compute tmp2 =
+       ((longword2 - repeated_one) & ~longword2) & (repeated_one << 7).
+
+     The test whether any byte in longword1 or longword2 is zero is equivalent
+     to testing whether tmp1 is nonzero or tmp2 is nonzero.  We can combine
+     this into a single test, whether (tmp1 | tmp2) is nonzero.  */
+
+  while (n >= sizeof (longword))
+    {
+      longword longword1 = *longword_ptr ^ repeated_c1;
+      longword longword2 = *longword_ptr ^ repeated_c2;
+
+      if (((((longword1 - repeated_one) & ~longword1)
+            | ((longword2 - repeated_one) & ~longword2))
+           & (repeated_one << 7)) != 0)
+        break;
+      longword_ptr++;
+      n -= sizeof (longword);
+    }
+
+  char_ptr = (const unsigned char *) longword_ptr;
+
+  /* At this point, we know that either n < sizeof (longword), or one of the
+     sizeof (longword) bytes starting at char_ptr is == c1 or == c2.  On
+     little-endian machines, we could determine the first such byte without
+     any further memory accesses, just by looking at the (tmp1 | tmp2) result
+     from the last loop iteration.  But this does not work on big-endian
+     machines.  Choose code that works in both cases.  */
+
+  for (; n > 0; --n, ++char_ptr)
+    {
+      if (*char_ptr == c1 || *char_ptr == c2)
+        return (void *) char_ptr;
+    }
+
+  return NULL;
+}
deleted file mode 120000 (symlink)
index 0bdc8a26915a8c18ab993453c8bdaa6ff79b8d4f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memchr2.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..089936b28bef7402f820c0f2045cfd5939263dc2
--- /dev/null
@@ -0,0 +1,37 @@
+/* Scan memory for the first of two bytes.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Return the first address of either C1 or C2 (treated as unsigned
+   char) that occurs within N bytes of the memory region S.  If
+   neither byte appears, return NULL.  */
+
+extern void *memchr2 (void const *s, int c1, int c2, size_t n)
+  _GL_ATTRIBUTE_PURE;
+
+#ifdef __cplusplus
+}
+#endif
deleted file mode 120000 (symlink)
index b46bb54318f0e77dd7a3443b991ca0877335d3bb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memchr2.valgrind
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..08eccd35087abbb1b57a1251979ce285687d3c3c
--- /dev/null
@@ -0,0 +1,30 @@
+# Suppress a valgrind message about use of uninitialized memory in memchr2().
+
+# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+#
+# This file is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Like memchr, it is safe to overestimate the length when the terminator
+# is guaranteed to be found.  In this case, we may end up reading a word
+# that is partially uninitialized, but this use is OK for a speedup.
+{
+    memchr2-value4
+    Memcheck:Value4
+    fun:memchr2
+}
+{
+    memchr2-value8
+    Memcheck:Value8
+    fun:memchr2
+}
deleted file mode 120000 (symlink)
index 71837729e400e5d86410fb65eaa2319d1bc09c44..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memcmp2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2aaee531da42e5018960982ca2f68be3f6f30930
--- /dev/null
@@ -0,0 +1,31 @@
+/* Compare two memory areas with possibly different lengths.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "memcmp2.h"
+
+#include <string.h>
+
+int
+memcmp2 (const char *s1, size_t n1, const char *s2, size_t n2)
+{
+  int cmp = memcmp (s1, s2, n1 <= n2 ? n1 : n2);
+  if (cmp == 0)
+    cmp = _GL_CMP (n1, n2);
+  return cmp;
+}
deleted file mode 120000 (symlink)
index 3daaa677e2bfcad1011af508649ee7f71a464978..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memcmp2.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5cea70e307d97a7d3b8cc66483baa786e43fde5c
--- /dev/null
@@ -0,0 +1,45 @@
+/* Compare two memory areas with possibly different lengths.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef MEMCMP2_H
+#define MEMCMP2_H
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Compare the memory regions S1 = [s1..s1+N1-1], S2 = [s2..s2+n2-1],
+   lexicographically.
+   This function's result is locale independent, unlike memcoll()'s.
+   Return a negative number if S1 < S2, a positive number if S1 > S2, or
+   0 if S1 and S2 have the same contents.  */
+extern int memcmp2 (const char *s1, size_t n1, const char *s2, size_t n2)
+  _GL_ATTRIBUTE_PURE;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MEMCMP2_H */
deleted file mode 120000 (symlink)
index 8e6f001f6b0d1fcd2e2654537251b7495a57e45a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memcoll.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..27f6f4a169234663a71f5e9e0ff689e93f79442b
--- /dev/null
@@ -0,0 +1,111 @@
+/* Locale-specific memory comparison.
+
+   Copyright (C) 1999, 2002-2004, 2006, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Contributed by Paul Eggert <eggert@twinsun.com>.  */
+
+#include <config.h>
+
+#include "memcoll.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Compare S1 (with size S1SIZE) and S2 (with length S2SIZE) according
+   to the LC_COLLATE locale.  S1 and S2 are both blocks of memory with
+   nonzero sizes, and the last byte in each block must be a null byte.
+   Set errno to an error number if there is an error, and to zero
+   otherwise.  */
+static int
+strcoll_loop (char const *s1, size_t s1size, char const *s2, size_t s2size)
+{
+  int diff;
+
+  while (! (errno = 0, (diff = strcoll (s1, s2)) || errno))
+    {
+      /* strcoll found no difference, but perhaps it was fooled by NUL
+         characters in the data.  Work around this problem by advancing
+         past the NUL chars.  */
+      size_t size1 = strlen (s1) + 1;
+      size_t size2 = strlen (s2) + 1;
+      s1 += size1;
+      s2 += size2;
+      s1size -= size1;
+      s2size -= size2;
+
+      if (s1size == 0)
+        return - (s2size != 0);
+      if (s2size == 0)
+        return 1;
+    }
+
+  return diff;
+}
+
+/* Compare S1 (with length S1LEN) and S2 (with length S2LEN) according
+   to the LC_COLLATE locale.  S1 and S2 do not overlap, and are not
+   adjacent.  Perhaps temporarily modify the bytes after S1 and S2,
+   but restore their original contents before returning.  Set errno to an
+   error number if there is an error, and to zero otherwise.  */
+int
+memcoll (char *s1, size_t s1len, char *s2, size_t s2len)
+{
+  int diff;
+
+  /* strcoll is slow on many platforms, so check for the common case
+     where the arguments are bytewise equal.  Otherwise, walk through
+     the buffers using strcoll on each substring.  */
+
+  if (s1len == s2len && memcmp (s1, s2, s1len) == 0)
+    {
+      errno = 0;
+      diff = 0;
+    }
+  else
+    {
+      char n1 = s1[s1len];
+      char n2 = s2[s2len];
+
+      s1[s1len] = '\0';
+      s2[s2len] = '\0';
+
+      diff = strcoll_loop (s1, s1len + 1, s2, s2len + 1);
+
+      s1[s1len] = n1;
+      s2[s2len] = n2;
+    }
+
+  return diff;
+}
+
+/* Compare S1 (a memory block of size S1SIZE, with a NUL as last byte)
+   and S2 (a memory block of size S2SIZE, with a NUL as last byte)
+   according to the LC_COLLATE locale.  S1SIZE and S2SIZE must be > 0.
+   Set errno to an error number if there is an error, and to zero
+   otherwise.  */
+int
+memcoll0 (char const *s1, size_t s1size, char const *s2, size_t s2size)
+{
+  if (s1size == s2size && memcmp (s1, s2, s1size) == 0)
+    {
+      errno = 0;
+      return 0;
+    }
+  else
+    return strcoll_loop (s1, s1size, s2, s2size);
+}
deleted file mode 120000 (symlink)
index 733a10a9be8da68b5c665f495a345d8efdf6fa30..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memcoll.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..db180b08db17f636701fdc93d3dd982ea6bcb71b
--- /dev/null
@@ -0,0 +1,28 @@
+/* Locale-specific memory comparison.
+
+   Copyright (C) 1999, 2003, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Contributed by Paul Eggert <eggert@twinsun.com>.  */
+
+#ifndef MEMCOLL_H_
+# define MEMCOLL_H_ 1
+
+# include <stddef.h>
+
+int memcoll (char *restrict, size_t, char *restrict, size_t);
+int memcoll0 (char const *, size_t, char const *, size_t);
+
+#endif /* MEMCOLL_H_ */
deleted file mode 120000 (symlink)
index e96a17ec7316486d26093588ec520b587118e235..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mempcpy.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..638867782d626c1ecbdd07ae6be813ebc2a7b4f1
--- /dev/null
@@ -0,0 +1,33 @@
+/* Copy memory area and return pointer after last written byte.
+   Copyright (C) 2003, 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+/* A function definition is only needed if HAVE_MEMPCPY is not defined.  */
+#if !HAVE_MEMPCPY
+
+/* Copy N bytes of SRC to DEST, return pointer to bytes after the
+   last written byte.  */
+void *
+mempcpy (void *dest, const void *src, size_t n)
+{
+  return (char *) memcpy (dest, src, n) + n;
+}
+
+#endif
deleted file mode 120000 (symlink)
index d38b4cfa948e6b2221a1c1838dfb4b348be69aa2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memrchr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3df1f479c782e5c8237c40908f8ef9c921aa37dc
--- /dev/null
@@ -0,0 +1,161 @@
+/* memrchr -- find the last occurrence of a byte in a memory block
+
+   Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2024 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 file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://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
+#ifdef _LIBC
+# undef memrchr
+#endif
+
+#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)
+{
+  /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
+     long instead of a 64-bit uintmax_t tends to give better
+     performance.  On 64-bit hardware, unsigned long is generally 64
+     bits already.  Change this typedef to experiment with
+     performance.  */
+  typedef unsigned long int longword;
+
+  const unsigned char *char_ptr;
+  const longword *longword_ptr;
+  longword repeated_one;
+  longword repeated_c;
+  unsigned reg_char c;
+
+  c = (unsigned char) c_in;
+
+  /* Handle the last few bytes by reading one byte 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;
+
+  longword_ptr = (const void *) char_ptr;
+
+  /* All these elucidatory comments refer to 4-byte longwords,
+     but the theory applies equally well to any size longwords.  */
+
+  /* Compute auxiliary longword values:
+     repeated_one is a value which has a 1 in every byte.
+     repeated_c has c in every byte.  */
+  repeated_one = 0x01010101;
+  repeated_c = c | (c << 8);
+  repeated_c |= repeated_c << 16;
+  if (0xffffffffU < (longword) -1)
+    {
+      repeated_one |= repeated_one << 31 << 1;
+      repeated_c |= repeated_c << 31 << 1;
+      if (8 < sizeof (longword))
+        {
+          size_t i;
+
+          for (i = 64; i < sizeof (longword) * 8; i *= 2)
+            {
+              repeated_one |= repeated_one << i;
+              repeated_c |= repeated_c << i;
+            }
+        }
+    }
+
+  /* Instead of the traditional loop which tests each byte, 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 equal to c.  We first use an xor
+     with repeated_c.  This reduces the task to testing whether *any of the
+     four* bytes in longword1 is zero.
+
+     We compute tmp =
+       ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
+     That is, we perform the following operations:
+       1. Subtract repeated_one.
+       2. & ~longword1.
+       3. & a mask consisting of 0x80 in every byte.
+     Consider what happens in each byte:
+       - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
+         and step 3 transforms it into 0x80.  A carry can also be propagated
+         to more significant bytes.
+       - If a byte of longword1 is nonzero, let its lowest 1 bit be at
+         position k (0 <= k <= 7); so the lowest k bits are 0.  After step 1,
+         the byte ends in a single bit of value 0 and k bits of value 1.
+         After step 2, the result is just k bits of value 1: 2^k - 1.  After
+         step 3, the result is 0.  And no carry is produced.
+     So, if longword1 has only non-zero bytes, tmp is zero.
+     Whereas if longword1 has a zero byte, call j the position of the least
+     significant zero byte.  Then the result has a zero at positions 0, ...,
+     j-1 and a 0x80 at position j.  We cannot predict the result at the more
+     significant bytes (positions j+1..3), but it does not matter since we
+     already have a non-zero bit at position 8*j+7.
+
+     So, the test whether any byte in longword1 is zero is equivalent to
+     testing whether tmp is nonzero.  */
+
+  while (n >= sizeof (longword))
+    {
+      longword longword1 = *--longword_ptr ^ repeated_c;
+
+      if ((((longword1 - repeated_one) & ~longword1)
+           & (repeated_one << 7)) != 0)
+        {
+          longword_ptr++;
+          break;
+        }
+      n -= sizeof (longword);
+    }
+
+  char_ptr = (const unsigned char *) longword_ptr;
+
+  /* At this point, we know that either n < sizeof (longword), or one of the
+     sizeof (longword) bytes starting at char_ptr is == c.  On little-endian
+     machines, we could determine the first such byte without any further
+     memory accesses, just by looking at the tmp result from the last loop
+     iteration.  But this does not work on big-endian machines.  Choose code
+     that works in both cases.  */
+
+  while (n-- > 0)
+    {
+      if (*--char_ptr == c)
+        return (void *) char_ptr;
+    }
+
+  return NULL;
+}
+#ifdef weak_alias
+weak_alias (__memrchr, memrchr)
+#endif
deleted file mode 120000 (symlink)
index 1c4ba1526e9bd4aaf00afc00731c89fefd642675..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/memset_explicit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cf6cc6478477b7ae0f6f6a79d13cebc693735648
--- /dev/null
@@ -0,0 +1,55 @@
+/* Erase sensitive data from memory.
+   Copyright 2022-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* memset_s need this define */
+#if HAVE_MEMSET_S
+# define __STDC_WANT_LIB_EXT1__ 1
+#endif
+
+#include <string.h>
+
+/* Set S's bytes to C, where S has LEN bytes.  The compiler will not
+   optimize effects away, even if S is dead after the call.  */
+void *
+memset_explicit (void *s, int c, size_t len)
+{
+#if HAVE_EXPLICIT_MEMSET
+  return explicit_memset (s, c, len);
+#elif HAVE_MEMSET_S
+  (void) memset_s (s, len, c, len);
+  return s;
+#elif defined __GNUC__ && !defined __clang__
+  memset (s, c, len);
+  /* Compiler barrier.  */
+  __asm__ volatile ("" ::: "memory");
+  return s;
+#elif defined __clang__
+  memset (s, c, len);
+  /* Compiler barrier.  */
+  /* With asm ("" ::: "memory") LLVM analyzes uses of 's' and finds that the
+     whole thing is dead and eliminates it.  Use 'g' to work around this
+     problem.  See <https://bugs.llvm.org/show_bug.cgi?id=15495#c11>.  */
+  __asm__ volatile ("" : : "g"(s) : "memory");
+  return s;
+#else
+  /* Invoke memset through a volatile function pointer.  This defeats compiler
+     optimizations.  */
+  void * (* const volatile volatile_memset) (void *, int, size_t) = memset;
+  return volatile_memset (s, c, len);
+#endif
+}
deleted file mode 120000 (symlink)
index 15db87033b0ec421b9fcb917fe4cc6a07b1358fb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mgetgroups.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..36d5b79bbdc9dacaf02d863a622e5d249b3931af
--- /dev/null
@@ -0,0 +1,197 @@
+/* mgetgroups.c -- return a list of the groups a user or current process is in
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Extracted from coreutils' src/id.c. */
+
+#include <config.h>
+
+#include "mgetgroups.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#if HAVE_GETGROUPLIST
+# include <grp.h>
+#endif
+
+#include "getugroups.h"
+#include "xalloc-oversized.h"
+
+/* Work around an incompatibility of OS X 10.11: getgrouplist
+   accepts int *, not gid_t *, and int and gid_t differ in sign.  */
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) || defined __clang__
+# pragma GCC diagnostic ignored "-Wpointer-sign"
+#endif
+
+static gid_t *
+realloc_groupbuf (gid_t *g, size_t num)
+{
+  if (xalloc_oversized (num, sizeof *g))
+    {
+      errno = ENOMEM;
+      return NULL;
+    }
+
+  return realloc (g, num * sizeof *g);
+}
+
+/* Like getugroups, but store the result in malloc'd storage.
+   Set *GROUPS to the malloc'd list of all group IDs of which USERNAME
+   is a member.  If GID is not -1, store it first.  GID should be the
+   group ID (pw_gid) obtained from getpwuid, in case USERNAME is not
+   listed in the groups database (e.g., /etc/groups).  If USERNAME is
+   NULL, store the supplementary groups of the current process, and GID
+   should be -1 or the effective group ID (getegid).  Upon failure,
+   don't modify *GROUPS, set errno, and return -1.  Otherwise, return
+   the number of groups.  The resulting list may contain duplicates,
+   but adjacent members will be distinct.  */
+
+int
+mgetgroups (char const *username, gid_t gid, gid_t **groups)
+{
+  int max_n_groups;
+  int ng;
+  gid_t *g;
+
+#if HAVE_GETGROUPLIST
+  /* We prefer to use getgrouplist if available, because it has better
+     performance characteristics.
+
+     In glibc 2.3.2, getgrouplist is buggy.  If you pass a zero as the
+     length of the output buffer, getgrouplist will still write to the
+     buffer.  Contrary to what some versions of the getgrouplist
+     manpage say, this doesn't happen with nonzero buffer sizes.
+     Therefore our usage here just avoids a zero sized buffer.  */
+  if (username)
+    {
+      enum { N_GROUPS_INIT = 10 };
+      max_n_groups = N_GROUPS_INIT;
+
+      g = realloc_groupbuf (NULL, max_n_groups);
+      if (g == NULL)
+        return -1;
+
+      while (1)
+        {
+          gid_t *h;
+          int last_n_groups = max_n_groups;
+
+          /* getgrouplist updates max_n_groups to num required.  */
+          ng = getgrouplist (username, gid, g, &max_n_groups);
+
+          /* Some systems (like Darwin) have a bug where they
+             never increase max_n_groups.  */
+          if (ng < 0 && last_n_groups == max_n_groups)
+            max_n_groups *= 2;
+
+          if ((h = realloc_groupbuf (g, max_n_groups)) == NULL)
+            {
+              free (g);
+              return -1;
+            }
+          g = h;
+
+          if (0 <= ng)
+            {
+              *groups = g;
+              /* On success some systems just return 0 from getgrouplist,
+                 so return max_n_groups rather than ng.  */
+              return max_n_groups;
+            }
+        }
+    }
+  /* else no username, so fall through and use getgroups. */
+#endif
+
+  max_n_groups = (username
+                  ? getugroups (0, NULL, username, gid)
+                  : getgroups (0, NULL));
+
+  /* If we failed to count groups because there is no supplemental
+     group support, then return an array containing just GID.
+     Otherwise, we fail for the same reason.  */
+  if (max_n_groups < 0)
+    {
+      if (errno == ENOSYS && (g = realloc_groupbuf (NULL, 1)))
+        {
+          *groups = g;
+          *g = gid;
+          return gid != (gid_t) -1;
+        }
+      return -1;
+    }
+
+  if (max_n_groups == 0 || (!username && gid != (gid_t) -1))
+    max_n_groups++;
+  g = realloc_groupbuf (NULL, max_n_groups);
+  if (g == NULL)
+    return -1;
+
+  ng = (username
+        ? getugroups (max_n_groups, g, username, gid)
+        : getgroups (max_n_groups - (gid != (gid_t) -1),
+                                g + (gid != (gid_t) -1)));
+
+  if (ng < 0)
+    {
+      /* Failure is unexpected, but handle it anyway.  */
+      free (g);
+      return -1;
+    }
+
+  if (!username && gid != (gid_t) -1)
+    {
+      *g = gid;
+      ng++;
+    }
+  *groups = g;
+
+  /* Reduce the number of duplicates.  On some systems, getgroups
+     returns the effective gid twice: once as the first element, and
+     once in its position within the supplementary groups.  On other
+     systems, getgroups does not return the effective gid at all,
+     which is why we provide a GID argument.  Meanwhile, the GID
+     argument, if provided, is typically any member of the
+     supplementary groups, and not necessarily the effective gid.  So,
+     the most likely duplicates are the first element with an
+     arbitrary other element, or pair-wise duplication between the
+     first and second elements returned by getgroups.  It is possible
+     that this O(n) pass will not remove all duplicates, but it is not
+     worth the effort to slow down to an O(n log n) algorithm that
+     sorts the array in place, nor the extra memory needed for
+     duplicate removal via an O(n) hash-table.  Hence, this function
+     is only documented as guaranteeing no pair-wise duplicates,
+     rather than returning the minimal set.  */
+  if (1 < ng)
+    {
+      gid_t first = *g;
+      gid_t *next;
+      gid_t *groups_end = g + ng;
+
+      for (next = g + 1; next < groups_end; next++)
+        {
+          if (*next == first || *next == *g)
+            ng--;
+          else
+            *++g = *next;
+        }
+    }
+
+  return ng;
+}
deleted file mode 120000 (symlink)
index 246e70d41a6ff3684b301801ba142c6c6fab71fd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mgetgroups.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..58fd1a61c479045ec5b5f36cc2ff8fb7564144c4
--- /dev/null
@@ -0,0 +1,22 @@
+/* Get a list of all group IDs associated with a specified user ID.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <sys/types.h>
+
+int mgetgroups (const char *username, gid_t gid, gid_t **groups);
+#if GNULIB_XGETGROUPS
+int xgetgroups (const char *username, gid_t gid, gid_t **groups);
+#endif
deleted file mode 120000 (symlink)
index 4cd87aa641ade0e914b7acf80323cd004d698dc3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mini-gmp-gnulib.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6e02d3cefb6903e0c83f89b7bb0a200236259907
--- /dev/null
@@ -0,0 +1,48 @@
+/* Tailor mini-gmp.c for Gnulib-using applications.
+
+   Copyright 2018-2024 Free Software Foundation, Inc.
+
+   This file is free software.
+   It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
+   You can redistribute it and/or modify it under either
+     - the terms of the GNU Lesser General Public License as published
+       by the Free Software Foundation, either version 3, or (at your
+       option) any later version, or
+     - 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, or
+     - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License and the GNU General Public License
+   for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License and of the GNU General Public License along with this
+   program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdio.h>
+
+#include "mini-gmp.h"
+
+/* Pacify GCC -Wsuggest-attribute=const, pure, malloc.  */
+#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+#endif
+#if 8 <= __GNUC__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc"
+#endif
+
+/* Pacify GCC -Wunused-variable for variables used only in 'assert' calls.  */
+#if (defined NDEBUG \
+     && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || defined __clang__))
+# pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
+
+#include "mini-gmp.c"
deleted file mode 120000 (symlink)
index ebd95486a99b8900f059276c061f81231dc49415..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mini-gmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c580a8fc0253605fc7cfeb569fa03a9ab92cfcf1
--- /dev/null
+/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
+
+   Contributed to the GNU project by Niels Möller
+   Additional functionalities and improvements by Marco Bodrato.
+
+Copyright 1991-1997, 1999-2022 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+  * the GNU Lesser General Public License as published by the Free
+    Software Foundation; either version 3 of the License, or (at your
+    option) any later version.
+
+or
+
+  * the GNU General Public License as published by the Free Software
+    Foundation; either version 2 of the License, or (at your option) any
+    later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
+
+/* NOTE: All functions in this file which are not declared in
+   mini-gmp.h are internal, and are not intended to be compatible
+   with GMP or with future versions of mini-gmp. */
+
+/* Much of the material copied from GMP files, including: gmp-impl.h,
+   longlong.h, mpn/generic/add_n.c, mpn/generic/addmul_1.c,
+   mpn/generic/lshift.c, mpn/generic/mul_1.c,
+   mpn/generic/mul_basecase.c, mpn/generic/rshift.c,
+   mpn/generic/sbpi1_div_qr.c, mpn/generic/sub_n.c,
+   mpn/generic/submul_1.c. */
+
+#include <assert.h>
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mini-gmp.h"
+
+#if !defined(MINI_GMP_DONT_USE_FLOAT_H)
+#include <float.h>
+#endif
+
+\f
+/* Macros */
+#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
+
+#define GMP_LIMB_MAX ((mp_limb_t) ~ (mp_limb_t) 0)
+#define GMP_LIMB_HIGHBIT ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1))
+
+#define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2))
+#define GMP_LLIMB_MASK (GMP_HLIMB_BIT - 1)
+
+#define GMP_ULONG_BITS (sizeof(unsigned long) * CHAR_BIT)
+#define GMP_ULONG_HIGHBIT ((unsigned long) 1 << (GMP_ULONG_BITS - 1))
+
+#define GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
+#define GMP_NEG_CAST(T,x) (-((T)((x) + 1) - 1))
+
+#define GMP_MIN(a, b) ((a) < (b) ? (a) : (b))
+#define GMP_MAX(a, b) ((a) > (b) ? (a) : (b))
+
+#define GMP_CMP(a,b) (((a) > (b)) - ((a) < (b)))
+
+#if defined(DBL_MANT_DIG) && FLT_RADIX == 2
+#define GMP_DBL_MANT_BITS DBL_MANT_DIG
+#else
+#define GMP_DBL_MANT_BITS (53)
+#endif
+
+/* Return non-zero if xp,xsize and yp,ysize overlap.
+   If xp+xsize<=yp there's no overlap, or if yp+ysize<=xp there's no
+   overlap.  If both these are false, there's an overlap. */
+#define GMP_MPN_OVERLAP_P(xp, xsize, yp, ysize)                                \
+  ((xp) + (xsize) > (yp) && (yp) + (ysize) > (xp))
+
+#define gmp_assert_nocarry(x) do { \
+    mp_limb_t __cy = (x);         \
+    assert (__cy == 0);                   \
+    (void) (__cy);                \
+  } while (0)
+
+#define gmp_clz(count, x) do {                                         \
+    mp_limb_t __clz_x = (x);                                           \
+    unsigned __clz_c = 0;                                              \
+    int LOCAL_SHIFT_BITS = 8;                                          \
+    if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)                              \
+      for (;                                                           \
+          (__clz_x & ((mp_limb_t) 0xff << (GMP_LIMB_BITS - 8))) == 0;  \
+          __clz_c += 8)                                                \
+       { __clz_x <<= LOCAL_SHIFT_BITS; }                               \
+    for (; (__clz_x & GMP_LIMB_HIGHBIT) == 0; __clz_c++)               \
+      __clz_x <<= 1;                                                   \
+    (count) = __clz_c;                                                 \
+  } while (0)
+
+#define gmp_ctz(count, x) do {                                         \
+    mp_limb_t __ctz_x = (x);                                           \
+    unsigned __ctz_c = 0;                                              \
+    gmp_clz (__ctz_c, __ctz_x & - __ctz_x);                            \
+    (count) = GMP_LIMB_BITS - 1 - __ctz_c;                             \
+  } while (0)
+
+#define gmp_add_ssaaaa(sh, sl, ah, al, bh, bl) \
+  do {                                                                 \
+    mp_limb_t __x;                                                     \
+    __x = (al) + (bl);                                                 \
+    (sh) = (ah) + (bh) + (__x < (al));                                 \
+    (sl) = __x;                                                                \
+  } while (0)
+
+#define gmp_sub_ddmmss(sh, sl, ah, al, bh, bl) \
+  do {                                                                 \
+    mp_limb_t __x;                                                     \
+    __x = (al) - (bl);                                                 \
+    (sh) = (ah) - (bh) - ((al) < (bl));                                        \
+    (sl) = __x;                                                                \
+  } while (0)
+
+#define gmp_umul_ppmm(w1, w0, u, v)                                    \
+  do {                                                                 \
+    int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;                           \
+    if (sizeof(unsigned int) * CHAR_BIT >= 2 * GMP_LIMB_BITS)          \
+      {                                                                        \
+       unsigned int __ww = (unsigned int) (u) * (v);                   \
+       w0 = (mp_limb_t) __ww;                                          \
+       w1 = (mp_limb_t) (__ww >> LOCAL_GMP_LIMB_BITS);                 \
+      }                                                                        \
+    else if (GMP_ULONG_BITS >= 2 * GMP_LIMB_BITS)                      \
+      {                                                                        \
+       unsigned long int __ww = (unsigned long int) (u) * (v);         \
+       w0 = (mp_limb_t) __ww;                                          \
+       w1 = (mp_limb_t) (__ww >> LOCAL_GMP_LIMB_BITS);                 \
+      }                                                                        \
+    else {                                                             \
+      mp_limb_t __x0, __x1, __x2, __x3;                                        \
+      unsigned __ul, __vl, __uh, __vh;                                 \
+      mp_limb_t __u = (u), __v = (v);                                  \
+      assert (sizeof (unsigned) * 2 >= sizeof (mp_limb_t));            \
+                                                                       \
+      __ul = __u & GMP_LLIMB_MASK;                                     \
+      __uh = __u >> (GMP_LIMB_BITS / 2);                               \
+      __vl = __v & GMP_LLIMB_MASK;                                     \
+      __vh = __v >> (GMP_LIMB_BITS / 2);                               \
+                                                                       \
+      __x0 = (mp_limb_t) __ul * __vl;                                  \
+      __x1 = (mp_limb_t) __ul * __vh;                                  \
+      __x2 = (mp_limb_t) __uh * __vl;                                  \
+      __x3 = (mp_limb_t) __uh * __vh;                                  \
+                                                                       \
+      __x1 += __x0 >> (GMP_LIMB_BITS / 2);/* this can't give carry */  \
+      __x1 += __x2;            /* but this indeed can */               \
+      if (__x1 < __x2)         /* did we get it? */                    \
+       __x3 += GMP_HLIMB_BIT;  /* yes, add it in the proper pos. */    \
+                                                                       \
+      (w1) = __x3 + (__x1 >> (GMP_LIMB_BITS / 2));                     \
+      (w0) = (__x1 << (GMP_LIMB_BITS / 2)) + (__x0 & GMP_LLIMB_MASK);  \
+    }                                                                  \
+  } while (0)
+
+/* If mp_limb_t is of size smaller than int, plain u*v implies
+   automatic promotion to *signed* int, and then multiply may overflow
+   and cause undefined behavior. Explicitly cast to unsigned int for
+   that case. */
+#define gmp_umullo_limb(u, v) \
+  ((sizeof(mp_limb_t) >= sizeof(int)) ? (u)*(v) : (unsigned int)(u) * (v))
+
+#define gmp_udiv_qrnnd_preinv(q, r, nh, nl, d, di)                     \
+  do {                                                                 \
+    mp_limb_t _qh, _ql, _r, _mask;                                     \
+    gmp_umul_ppmm (_qh, _ql, (nh), (di));                              \
+    gmp_add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl));               \
+    _r = (nl) - gmp_umullo_limb (_qh, (d));                            \
+    _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */                \
+    _qh += _mask;                                                      \
+    _r += _mask & (d);                                                 \
+    if (_r >= (d))                                                     \
+      {                                                                        \
+       _r -= (d);                                                      \
+       _qh++;                                                          \
+      }                                                                        \
+                                                                       \
+    (r) = _r;                                                          \
+    (q) = _qh;                                                         \
+  } while (0)
+
+#define gmp_udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv)          \
+  do {                                                                 \
+    mp_limb_t _q0, _t1, _t0, _mask;                                    \
+    gmp_umul_ppmm ((q), _q0, (n2), (dinv));                            \
+    gmp_add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1));                   \
+                                                                       \
+    /* Compute the two most significant limbs of n - q'd */            \
+    (r1) = (n1) - gmp_umullo_limb ((d1), (q));                         \
+    gmp_sub_ddmmss ((r1), (r0), (r1), (n0), (d1), (d0));               \
+    gmp_umul_ppmm (_t1, _t0, (d0), (q));                               \
+    gmp_sub_ddmmss ((r1), (r0), (r1), (r0), _t1, _t0);                 \
+    (q)++;                                                             \
+                                                                       \
+    /* Conditionally adjust q and the remainders */                    \
+    _mask = - (mp_limb_t) ((r1) >= _q0);                               \
+    (q) += _mask;                                                      \
+    gmp_add_ssaaaa ((r1), (r0), (r1), (r0), _mask & (d1), _mask & (d0)); \
+    if ((r1) >= (d1))                                                  \
+      {                                                                        \
+       if ((r1) > (d1) || (r0) >= (d0))                                \
+         {                                                             \
+           (q)++;                                                      \
+           gmp_sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0));        \
+         }                                                             \
+      }                                                                        \
+  } while (0)
+
+/* Swap macros. */
+#define MP_LIMB_T_SWAP(x, y)                                           \
+  do {                                                                 \
+    mp_limb_t __mp_limb_t_swap__tmp = (x);                             \
+    (x) = (y);                                                         \
+    (y) = __mp_limb_t_swap__tmp;                                       \
+  } while (0)
+#define MP_SIZE_T_SWAP(x, y)                                           \
+  do {                                                                 \
+    mp_size_t __mp_size_t_swap__tmp = (x);                             \
+    (x) = (y);                                                         \
+    (y) = __mp_size_t_swap__tmp;                                       \
+  } while (0)
+#define MP_BITCNT_T_SWAP(x,y)                  \
+  do {                                         \
+    mp_bitcnt_t __mp_bitcnt_t_swap__tmp = (x); \
+    (x) = (y);                                 \
+    (y) = __mp_bitcnt_t_swap__tmp;             \
+  } while (0)
+#define MP_PTR_SWAP(x, y)                                              \
+  do {                                                                 \
+    mp_ptr __mp_ptr_swap__tmp = (x);                                   \
+    (x) = (y);                                                         \
+    (y) = __mp_ptr_swap__tmp;                                          \
+  } while (0)
+#define MP_SRCPTR_SWAP(x, y)                                           \
+  do {                                                                 \
+    mp_srcptr __mp_srcptr_swap__tmp = (x);                             \
+    (x) = (y);                                                         \
+    (y) = __mp_srcptr_swap__tmp;                                       \
+  } while (0)
+
+#define MPN_PTR_SWAP(xp,xs, yp,ys)                                     \
+  do {                                                                 \
+    MP_PTR_SWAP (xp, yp);                                              \
+    MP_SIZE_T_SWAP (xs, ys);                                           \
+  } while(0)
+#define MPN_SRCPTR_SWAP(xp,xs, yp,ys)                                  \
+  do {                                                                 \
+    MP_SRCPTR_SWAP (xp, yp);                                           \
+    MP_SIZE_T_SWAP (xs, ys);                                           \
+  } while(0)
+
+#define MPZ_PTR_SWAP(x, y)                                             \
+  do {                                                                 \
+    mpz_ptr __mpz_ptr_swap__tmp = (x);                                 \
+    (x) = (y);                                                         \
+    (y) = __mpz_ptr_swap__tmp;                                         \
+  } while (0)
+#define MPZ_SRCPTR_SWAP(x, y)                                          \
+  do {                                                                 \
+    mpz_srcptr __mpz_srcptr_swap__tmp = (x);                           \
+    (x) = (y);                                                         \
+    (y) = __mpz_srcptr_swap__tmp;                                      \
+  } while (0)
+
+const int mp_bits_per_limb = GMP_LIMB_BITS;
+
+\f
+/* Memory allocation and other helper functions. */
+static void
+gmp_die (const char *msg)
+{
+  fprintf (stderr, "%s\n", msg);
+  abort();
+}
+
+static void *
+gmp_default_alloc (size_t size)
+{
+  void *p;
+
+  assert (size > 0);
+
+  p = malloc (size);
+  if (!p)
+    gmp_die("gmp_default_alloc: Virtual memory exhausted.");
+
+  return p;
+}
+
+static void *
+gmp_default_realloc (void *old, size_t unused_old_size, size_t new_size)
+{
+  void * p;
+
+  p = realloc (old, new_size);
+
+  if (!p)
+    gmp_die("gmp_default_realloc: Virtual memory exhausted.");
+
+  return p;
+}
+
+static void
+gmp_default_free (void *p, size_t unused_size)
+{
+  free (p);
+}
+
+static void * (*gmp_allocate_func) (size_t) = gmp_default_alloc;
+static void * (*gmp_reallocate_func) (void *, size_t, size_t) = gmp_default_realloc;
+static void (*gmp_free_func) (void *, size_t) = gmp_default_free;
+
+void
+mp_get_memory_functions (void *(**alloc_func) (size_t),
+                        void *(**realloc_func) (void *, size_t, size_t),
+                        void (**free_func) (void *, size_t))
+{
+  if (alloc_func)
+    *alloc_func = gmp_allocate_func;
+
+  if (realloc_func)
+    *realloc_func = gmp_reallocate_func;
+
+  if (free_func)
+    *free_func = gmp_free_func;
+}
+
+void
+mp_set_memory_functions (void *(*alloc_func) (size_t),
+                        void *(*realloc_func) (void *, size_t, size_t),
+                        void (*free_func) (void *, size_t))
+{
+  if (!alloc_func)
+    alloc_func = gmp_default_alloc;
+  if (!realloc_func)
+    realloc_func = gmp_default_realloc;
+  if (!free_func)
+    free_func = gmp_default_free;
+
+  gmp_allocate_func = alloc_func;
+  gmp_reallocate_func = realloc_func;
+  gmp_free_func = free_func;
+}
+
+#define gmp_alloc(size) ((*gmp_allocate_func)((size)))
+#define gmp_free(p, size) ((*gmp_free_func) ((p), (size)))
+#define gmp_realloc(ptr, old_size, size) ((*gmp_reallocate_func)(ptr, old_size, size))
+
+static mp_ptr
+gmp_alloc_limbs (mp_size_t size)
+{
+  return (mp_ptr) gmp_alloc (size * sizeof (mp_limb_t));
+}
+
+static mp_ptr
+gmp_realloc_limbs (mp_ptr old, mp_size_t old_size, mp_size_t size)
+{
+  assert (size > 0);
+  return (mp_ptr) gmp_realloc (old, old_size * sizeof (mp_limb_t), size * sizeof (mp_limb_t));
+}
+
+static void
+gmp_free_limbs (mp_ptr old, mp_size_t size)
+{
+  gmp_free (old, size * sizeof (mp_limb_t));
+}
+
+\f
+/* MPN interface */
+
+void
+mpn_copyi (mp_ptr d, mp_srcptr s, mp_size_t n)
+{
+  mp_size_t i;
+  for (i = 0; i < n; i++)
+    d[i] = s[i];
+}
+
+void
+mpn_copyd (mp_ptr d, mp_srcptr s, mp_size_t n)
+{
+  while (--n >= 0)
+    d[n] = s[n];
+}
+
+int
+mpn_cmp (mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  while (--n >= 0)
+    {
+      if (ap[n] != bp[n])
+       return ap[n] > bp[n] ? 1 : -1;
+    }
+  return 0;
+}
+
+static int
+mpn_cmp4 (mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+  if (an != bn)
+    return an < bn ? -1 : 1;
+  else
+    return mpn_cmp (ap, bp, an);
+}
+
+static mp_size_t
+mpn_normalized_size (mp_srcptr xp, mp_size_t n)
+{
+  while (n > 0 && xp[n-1] == 0)
+    --n;
+  return n;
+}
+
+int
+mpn_zero_p(mp_srcptr rp, mp_size_t n)
+{
+  return mpn_normalized_size (rp, n) == 0;
+}
+
+void
+mpn_zero (mp_ptr rp, mp_size_t n)
+{
+  while (--n >= 0)
+    rp[n] = 0;
+}
+
+mp_limb_t
+mpn_add_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
+{
+  mp_size_t i;
+
+  assert (n > 0);
+  i = 0;
+  do
+    {
+      mp_limb_t r = ap[i] + b;
+      /* Carry out */
+      b = (r < b);
+      rp[i] = r;
+    }
+  while (++i < n);
+
+  return b;
+}
+
+mp_limb_t
+mpn_add_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  mp_size_t i;
+  mp_limb_t cy;
+
+  for (i = 0, cy = 0; i < n; i++)
+    {
+      mp_limb_t a, b, r;
+      a = ap[i]; b = bp[i];
+      r = a + cy;
+      cy = (r < cy);
+      r += b;
+      cy += (r < b);
+      rp[i] = r;
+    }
+  return cy;
+}
+
+mp_limb_t
+mpn_add (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+  mp_limb_t cy;
+
+  assert (an >= bn);
+
+  cy = mpn_add_n (rp, ap, bp, bn);
+  if (an > bn)
+    cy = mpn_add_1 (rp + bn, ap + bn, an - bn, cy);
+  return cy;
+}
+
+mp_limb_t
+mpn_sub_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
+{
+  mp_size_t i;
+
+  assert (n > 0);
+
+  i = 0;
+  do
+    {
+      mp_limb_t a = ap[i];
+      /* Carry out */
+      mp_limb_t cy = a < b;
+      rp[i] = a - b;
+      b = cy;
+    }
+  while (++i < n);
+
+  return b;
+}
+
+mp_limb_t
+mpn_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  mp_size_t i;
+  mp_limb_t cy;
+
+  for (i = 0, cy = 0; i < n; i++)
+    {
+      mp_limb_t a, b;
+      a = ap[i]; b = bp[i];
+      b += cy;
+      cy = (b < cy);
+      cy += (a < b);
+      rp[i] = a - b;
+    }
+  return cy;
+}
+
+mp_limb_t
+mpn_sub (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+  mp_limb_t cy;
+
+  assert (an >= bn);
+
+  cy = mpn_sub_n (rp, ap, bp, bn);
+  if (an > bn)
+    cy = mpn_sub_1 (rp + bn, ap + bn, an - bn, cy);
+  return cy;
+}
+
+mp_limb_t
+mpn_mul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+{
+  mp_limb_t ul, cl, hpl, lpl;
+
+  assert (n >= 1);
+
+  cl = 0;
+  do
+    {
+      ul = *up++;
+      gmp_umul_ppmm (hpl, lpl, ul, vl);
+
+      lpl += cl;
+      cl = (lpl < cl) + hpl;
+
+      *rp++ = lpl;
+    }
+  while (--n != 0);
+
+  return cl;
+}
+
+mp_limb_t
+mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+{
+  mp_limb_t ul, cl, hpl, lpl, rl;
+
+  assert (n >= 1);
+
+  cl = 0;
+  do
+    {
+      ul = *up++;
+      gmp_umul_ppmm (hpl, lpl, ul, vl);
+
+      lpl += cl;
+      cl = (lpl < cl) + hpl;
+
+      rl = *rp;
+      lpl = rl + lpl;
+      cl += lpl < rl;
+      *rp++ = lpl;
+    }
+  while (--n != 0);
+
+  return cl;
+}
+
+mp_limb_t
+mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+{
+  mp_limb_t ul, cl, hpl, lpl, rl;
+
+  assert (n >= 1);
+
+  cl = 0;
+  do
+    {
+      ul = *up++;
+      gmp_umul_ppmm (hpl, lpl, ul, vl);
+
+      lpl += cl;
+      cl = (lpl < cl) + hpl;
+
+      rl = *rp;
+      lpl = rl - lpl;
+      cl += lpl > rl;
+      *rp++ = lpl;
+    }
+  while (--n != 0);
+
+  return cl;
+}
+
+mp_limb_t
+mpn_mul (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
+{
+  assert (un >= vn);
+  assert (vn >= 1);
+  assert (!GMP_MPN_OVERLAP_P(rp, un + vn, up, un));
+  assert (!GMP_MPN_OVERLAP_P(rp, un + vn, vp, vn));
+
+  /* We first multiply by the low order limb. This result can be
+     stored, not added, to rp. We also avoid a loop for zeroing this
+     way. */
+
+  rp[un] = mpn_mul_1 (rp, up, un, vp[0]);
+
+  /* Now accumulate the product of up[] and the next higher limb from
+     vp[]. */
+
+  while (--vn >= 1)
+    {
+      rp += 1, vp += 1;
+      rp[un] = mpn_addmul_1 (rp, up, un, vp[0]);
+    }
+  return rp[un];
+}
+
+void
+mpn_mul_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  mpn_mul (rp, ap, n, bp, n);
+}
+
+void
+mpn_sqr (mp_ptr rp, mp_srcptr ap, mp_size_t n)
+{
+  mpn_mul (rp, ap, n, ap, n);
+}
+
+mp_limb_t
+mpn_lshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
+{
+  mp_limb_t high_limb, low_limb;
+  unsigned int tnc;
+  mp_limb_t retval;
+
+  assert (n >= 1);
+  assert (cnt >= 1);
+  assert (cnt < GMP_LIMB_BITS);
+
+  up += n;
+  rp += n;
+
+  tnc = GMP_LIMB_BITS - cnt;
+  low_limb = *--up;
+  retval = low_limb >> tnc;
+  high_limb = (low_limb << cnt);
+
+  while (--n != 0)
+    {
+      low_limb = *--up;
+      *--rp = high_limb | (low_limb >> tnc);
+      high_limb = (low_limb << cnt);
+    }
+  *--rp = high_limb;
+
+  return retval;
+}
+
+mp_limb_t
+mpn_rshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
+{
+  mp_limb_t high_limb, low_limb;
+  unsigned int tnc;
+  mp_limb_t retval;
+
+  assert (n >= 1);
+  assert (cnt >= 1);
+  assert (cnt < GMP_LIMB_BITS);
+
+  tnc = GMP_LIMB_BITS - cnt;
+  high_limb = *up++;
+  retval = (high_limb << tnc);
+  low_limb = high_limb >> cnt;
+
+  while (--n != 0)
+    {
+      high_limb = *up++;
+      *rp++ = low_limb | (high_limb << tnc);
+      low_limb = high_limb >> cnt;
+    }
+  *rp = low_limb;
+
+  return retval;
+}
+
+static mp_bitcnt_t
+mpn_common_scan (mp_limb_t limb, mp_size_t i, mp_srcptr up, mp_size_t un,
+                mp_limb_t ux)
+{
+  unsigned cnt;
+
+  assert (ux == 0 || ux == GMP_LIMB_MAX);
+  assert (0 <= i && i <= un );
+
+  while (limb == 0)
+    {
+      i++;
+      if (i == un)
+       return (ux == 0 ? ~(mp_bitcnt_t) 0 : un * GMP_LIMB_BITS);
+      limb = ux ^ up[i];
+    }
+  gmp_ctz (cnt, limb);
+  return (mp_bitcnt_t) i * GMP_LIMB_BITS + cnt;
+}
+
+mp_bitcnt_t
+mpn_scan1 (mp_srcptr ptr, mp_bitcnt_t bit)
+{
+  mp_size_t i;
+  i = bit / GMP_LIMB_BITS;
+
+  return mpn_common_scan ( ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)),
+                         i, ptr, i, 0);
+}
+
+mp_bitcnt_t
+mpn_scan0 (mp_srcptr ptr, mp_bitcnt_t bit)
+{
+  mp_size_t i;
+  i = bit / GMP_LIMB_BITS;
+
+  return mpn_common_scan (~ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)),
+                         i, ptr, i, GMP_LIMB_MAX);
+}
+
+void
+mpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n)
+{
+  while (--n >= 0)
+    *rp++ = ~ *up++;
+}
+
+mp_limb_t
+mpn_neg (mp_ptr rp, mp_srcptr up, mp_size_t n)
+{
+  while (*up == 0)
+    {
+      *rp = 0;
+      if (!--n)
+       return 0;
+      ++up; ++rp;
+    }
+  *rp = - *up;
+  mpn_com (++rp, ++up, --n);
+  return 1;
+}
+
+\f
+/* MPN division interface. */
+
+/* The 3/2 inverse is defined as
+
+     m = floor( (B^3-1) / (B u1 + u0)) - B
+*/
+mp_limb_t
+mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
+{
+  mp_limb_t r, m;
+
+  {
+    mp_limb_t p, ql;
+    unsigned ul, uh, qh;
+
+    assert (sizeof (unsigned) * 2 >= sizeof (mp_limb_t));
+    /* For notation, let b denote the half-limb base, so that B = b^2.
+       Split u1 = b uh + ul. */
+    ul = u1 & GMP_LLIMB_MASK;
+    uh = u1 >> (GMP_LIMB_BITS / 2);
+
+    /* Approximation of the high half of quotient. Differs from the 2/1
+       inverse of the half limb uh, since we have already subtracted
+       u0. */
+    qh = (u1 ^ GMP_LIMB_MAX) / uh;
+
+    /* Adjust to get a half-limb 3/2 inverse, i.e., we want
+
+       qh' = floor( (b^3 - 1) / u) - b = floor ((b^3 - b u - 1) / u
+          = floor( (b (~u) + b-1) / u),
+
+       and the remainder
+
+       r = b (~u) + b-1 - qh (b uh + ul)
+       = b (~u - qh uh) + b-1 - qh ul
+
+       Subtraction of qh ul may underflow, which implies adjustments.
+       But by normalization, 2 u >= B > qh ul, so we need to adjust by
+       at most 2.
+    */
+
+    r = ((~u1 - (mp_limb_t) qh * uh) << (GMP_LIMB_BITS / 2)) | GMP_LLIMB_MASK;
+
+    p = (mp_limb_t) qh * ul;
+    /* Adjustment steps taken from udiv_qrnnd_c */
+    if (r < p)
+      {
+       qh--;
+       r += u1;
+       if (r >= u1) /* i.e. we didn't get carry when adding to r */
+         if (r < p)
+           {
+             qh--;
+             r += u1;
+           }
+      }
+    r -= p;
+
+    /* Low half of the quotient is
+
+       ql = floor ( (b r + b-1) / u1).
+
+       This is a 3/2 division (on half-limbs), for which qh is a
+       suitable inverse. */
+
+    p = (r >> (GMP_LIMB_BITS / 2)) * qh + r;
+    /* Unlike full-limb 3/2, we can add 1 without overflow. For this to
+       work, it is essential that ql is a full mp_limb_t. */
+    ql = (p >> (GMP_LIMB_BITS / 2)) + 1;
+
+    /* By the 3/2 trick, we don't need the high half limb. */
+    r = (r << (GMP_LIMB_BITS / 2)) + GMP_LLIMB_MASK - ql * u1;
+
+    if (r >= (GMP_LIMB_MAX & (p << (GMP_LIMB_BITS / 2))))
+      {
+       ql--;
+       r += u1;
+      }
+    m = ((mp_limb_t) qh << (GMP_LIMB_BITS / 2)) + ql;
+    if (r >= u1)
+      {
+       m++;
+       r -= u1;
+      }
+  }
+
+  /* Now m is the 2/1 inverse of u1. If u0 > 0, adjust it to become a
+     3/2 inverse. */
+  if (u0 > 0)
+    {
+      mp_limb_t th, tl;
+      r = ~r;
+      r += u0;
+      if (r < u0)
+       {
+         m--;
+         if (r >= u1)
+           {
+             m--;
+             r -= u1;
+           }
+         r -= u1;
+       }
+      gmp_umul_ppmm (th, tl, u0, m);
+      r += th;
+      if (r < th)
+       {
+         m--;
+         m -= ((r > u1) | ((r == u1) & (tl > u0)));
+       }
+    }
+
+  return m;
+}
+
+struct gmp_div_inverse
+{
+  /* Normalization shift count. */
+  unsigned shift;
+  /* Normalized divisor (d0 unused for mpn_div_qr_1) */
+  mp_limb_t d1, d0;
+  /* Inverse, for 2/1 or 3/2. */
+  mp_limb_t di;
+};
+
+static void
+mpn_div_qr_1_invert (struct gmp_div_inverse *inv, mp_limb_t d)
+{
+  unsigned shift;
+
+  assert (d > 0);
+  gmp_clz (shift, d);
+  inv->shift = shift;
+  inv->d1 = d << shift;
+  inv->di = mpn_invert_limb (inv->d1);
+}
+
+static void
+mpn_div_qr_2_invert (struct gmp_div_inverse *inv,
+                    mp_limb_t d1, mp_limb_t d0)
+{
+  unsigned shift;
+
+  assert (d1 > 0);
+  gmp_clz (shift, d1);
+  inv->shift = shift;
+  if (shift > 0)
+    {
+      d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
+      d0 <<= shift;
+    }
+  inv->d1 = d1;
+  inv->d0 = d0;
+  inv->di = mpn_invert_3by2 (d1, d0);
+}
+
+static void
+mpn_div_qr_invert (struct gmp_div_inverse *inv,
+                  mp_srcptr dp, mp_size_t dn)
+{
+  assert (dn > 0);
+
+  if (dn == 1)
+    mpn_div_qr_1_invert (inv, dp[0]);
+  else if (dn == 2)
+    mpn_div_qr_2_invert (inv, dp[1], dp[0]);
+  else
+    {
+      unsigned shift;
+      mp_limb_t d1, d0;
+
+      d1 = dp[dn-1];
+      d0 = dp[dn-2];
+      assert (d1 > 0);
+      gmp_clz (shift, d1);
+      inv->shift = shift;
+      if (shift > 0)
+       {
+         d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
+         d0 = (d0 << shift) | (dp[dn-3] >> (GMP_LIMB_BITS - shift));
+       }
+      inv->d1 = d1;
+      inv->d0 = d0;
+      inv->di = mpn_invert_3by2 (d1, d0);
+    }
+}
+
+/* Not matching current public gmp interface, rather corresponding to
+   the sbpi1_div_* functions. */
+static mp_limb_t
+mpn_div_qr_1_preinv (mp_ptr qp, mp_srcptr np, mp_size_t nn,
+                    const struct gmp_div_inverse *inv)
+{
+  mp_limb_t d, di;
+  mp_limb_t r;
+  mp_ptr tp = NULL;
+  mp_size_t tn = 0;
+
+  if (inv->shift > 0)
+    {
+      /* Shift, reusing qp area if possible. In-place shift if qp == np. */
+      tp = qp;
+      if (!tp)
+        {
+          tn = nn;
+          tp = gmp_alloc_limbs (tn);
+        }
+      r = mpn_lshift (tp, np, nn, inv->shift);
+      np = tp;
+    }
+  else
+    r = 0;
+
+  d = inv->d1;
+  di = inv->di;
+  while (--nn >= 0)
+    {
+      mp_limb_t q;
+
+      gmp_udiv_qrnnd_preinv (q, r, r, np[nn], d, di);
+      if (qp)
+       qp[nn] = q;
+    }
+  if (tn)
+    gmp_free_limbs (tp, tn);
+
+  return r >> inv->shift;
+}
+
+static void
+mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
+                    const struct gmp_div_inverse *inv)
+{
+  unsigned shift;
+  mp_size_t i;
+  mp_limb_t d1, d0, di, r1, r0;
+
+  assert (nn >= 2);
+  shift = inv->shift;
+  d1 = inv->d1;
+  d0 = inv->d0;
+  di = inv->di;
+
+  if (shift > 0)
+    r1 = mpn_lshift (np, np, nn, shift);
+  else
+    r1 = 0;
+
+  r0 = np[nn - 1];
+
+  i = nn - 2;
+  do
+    {
+      mp_limb_t n0, q;
+      n0 = np[i];
+      gmp_udiv_qr_3by2 (q, r1, r0, r1, r0, n0, d1, d0, di);
+
+      if (qp)
+       qp[i] = q;
+    }
+  while (--i >= 0);
+
+  if (shift > 0)
+    {
+      assert ((r0 & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - shift))) == 0);
+      r0 = (r0 >> shift) | (r1 << (GMP_LIMB_BITS - shift));
+      r1 >>= shift;
+    }
+
+  np[1] = r1;
+  np[0] = r0;
+}
+
+static void
+mpn_div_qr_pi1 (mp_ptr qp,
+               mp_ptr np, mp_size_t nn, mp_limb_t n1,
+               mp_srcptr dp, mp_size_t dn,
+               mp_limb_t dinv)
+{
+  mp_size_t i;
+
+  mp_limb_t d1, d0;
+  mp_limb_t cy, cy1;
+  mp_limb_t q;
+
+  assert (dn > 2);
+  assert (nn >= dn);
+
+  d1 = dp[dn - 1];
+  d0 = dp[dn - 2];
+
+  assert ((d1 & GMP_LIMB_HIGHBIT) != 0);
+  /* Iteration variable is the index of the q limb.
+   *
+   * We divide <n1, np[dn-1+i], np[dn-2+i], np[dn-3+i],..., np[i]>
+   * by            <d1,          d0,        dp[dn-3],  ..., dp[0] >
+   */
+
+  i = nn - dn;
+  do
+    {
+      mp_limb_t n0 = np[dn-1+i];
+
+      if (n1 == d1 && n0 == d0)
+       {
+         q = GMP_LIMB_MAX;
+         mpn_submul_1 (np+i, dp, dn, q);
+         n1 = np[dn-1+i];      /* update n1, last loop's value will now be invalid */
+       }
+      else
+       {
+         gmp_udiv_qr_3by2 (q, n1, n0, n1, n0, np[dn-2+i], d1, d0, dinv);
+
+         cy = mpn_submul_1 (np + i, dp, dn-2, q);
+
+         cy1 = n0 < cy;
+         n0 = n0 - cy;
+         cy = n1 < cy1;
+         n1 = n1 - cy1;
+         np[dn-2+i] = n0;
+
+         if (cy != 0)
+           {
+             n1 += d1 + mpn_add_n (np + i, np + i, dp, dn - 1);
+             q--;
+           }
+       }
+
+      if (qp)
+       qp[i] = q;
+    }
+  while (--i >= 0);
+
+  np[dn - 1] = n1;
+}
+
+static void
+mpn_div_qr_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
+                  mp_srcptr dp, mp_size_t dn,
+                  const struct gmp_div_inverse *inv)
+{
+  assert (dn > 0);
+  assert (nn >= dn);
+
+  if (dn == 1)
+    np[0] = mpn_div_qr_1_preinv (qp, np, nn, inv);
+  else if (dn == 2)
+    mpn_div_qr_2_preinv (qp, np, nn, inv);
+  else
+    {
+      mp_limb_t nh;
+      unsigned shift;
+
+      assert (inv->d1 == dp[dn-1]);
+      assert (inv->d0 == dp[dn-2]);
+      assert ((inv->d1 & GMP_LIMB_HIGHBIT) != 0);
+
+      shift = inv->shift;
+      if (shift > 0)
+       nh = mpn_lshift (np, np, nn, shift);
+      else
+       nh = 0;
+
+      mpn_div_qr_pi1 (qp, np, nn, nh, dp, dn, inv->di);
+
+      if (shift > 0)
+       gmp_assert_nocarry (mpn_rshift (np, np, dn, shift));
+    }
+}
+
+static void
+mpn_div_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn)
+{
+  struct gmp_div_inverse inv;
+  mp_ptr tp = NULL;
+
+  assert (dn > 0);
+  assert (nn >= dn);
+
+  mpn_div_qr_invert (&inv, dp, dn);
+  if (dn > 2 && inv.shift > 0)
+    {
+      tp = gmp_alloc_limbs (dn);
+      gmp_assert_nocarry (mpn_lshift (tp, dp, dn, inv.shift));
+      dp = tp;
+    }
+  mpn_div_qr_preinv (qp, np, nn, dp, dn, &inv);
+  if (tp)
+    gmp_free_limbs (tp, dn);
+}
+
+\f
+/* MPN base conversion. */
+static unsigned
+mpn_base_power_of_two_p (unsigned b)
+{
+  switch (b)
+    {
+    case 2: return 1;
+    case 4: return 2;
+    case 8: return 3;
+    case 16: return 4;
+    case 32: return 5;
+    case 64: return 6;
+    case 128: return 7;
+    case 256: return 8;
+    default: return 0;
+    }
+}
+
+struct mpn_base_info
+{
+  /* bb is the largest power of the base which fits in one limb, and
+     exp is the corresponding exponent. */
+  unsigned exp;
+  mp_limb_t bb;
+};
+
+static void
+mpn_get_base_info (struct mpn_base_info *info, mp_limb_t b)
+{
+  mp_limb_t m;
+  mp_limb_t p;
+  unsigned exp;
+
+  m = GMP_LIMB_MAX / b;
+  for (exp = 1, p = b; p <= m; exp++)
+    p *= b;
+
+  info->exp = exp;
+  info->bb = p;
+}
+
+static mp_bitcnt_t
+mpn_limb_size_in_base_2 (mp_limb_t u)
+{
+  unsigned shift;
+
+  assert (u > 0);
+  gmp_clz (shift, u);
+  return GMP_LIMB_BITS - shift;
+}
+
+static size_t
+mpn_get_str_bits (unsigned char *sp, unsigned bits, mp_srcptr up, mp_size_t un)
+{
+  unsigned char mask;
+  size_t sn, j;
+  mp_size_t i;
+  unsigned shift;
+
+  sn = ((un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1])
+       + bits - 1) / bits;
+
+  mask = (1U << bits) - 1;
+
+  for (i = 0, j = sn, shift = 0; j-- > 0;)
+    {
+      unsigned char digit = up[i] >> shift;
+
+      shift += bits;
+
+      if (shift >= GMP_LIMB_BITS && ++i < un)
+       {
+         shift -= GMP_LIMB_BITS;
+         digit |= up[i] << (bits - shift);
+       }
+      sp[j] = digit & mask;
+    }
+  return sn;
+}
+
+/* We generate digits from the least significant end, and reverse at
+   the end. */
+static size_t
+mpn_limb_get_str (unsigned char *sp, mp_limb_t w,
+                 const struct gmp_div_inverse *binv)
+{
+  mp_size_t i;
+  for (i = 0; w > 0; i++)
+    {
+      mp_limb_t h, l, r;
+
+      h = w >> (GMP_LIMB_BITS - binv->shift);
+      l = w << binv->shift;
+
+      gmp_udiv_qrnnd_preinv (w, r, h, l, binv->d1, binv->di);
+      assert ((r & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - binv->shift))) == 0);
+      r >>= binv->shift;
+
+      sp[i] = r;
+    }
+  return i;
+}
+
+static size_t
+mpn_get_str_other (unsigned char *sp,
+                  int base, const struct mpn_base_info *info,
+                  mp_ptr up, mp_size_t un)
+{
+  struct gmp_div_inverse binv;
+  size_t sn;
+  size_t i;
+
+  mpn_div_qr_1_invert (&binv, base);
+
+  sn = 0;
+
+  if (un > 1)
+    {
+      struct gmp_div_inverse bbinv;
+      mpn_div_qr_1_invert (&bbinv, info->bb);
+
+      do
+       {
+         mp_limb_t w;
+         size_t done;
+         w = mpn_div_qr_1_preinv (up, up, un, &bbinv);
+         un -= (up[un-1] == 0);
+         done = mpn_limb_get_str (sp + sn, w, &binv);
+
+         for (sn += done; done < info->exp; done++)
+           sp[sn++] = 0;
+       }
+      while (un > 1);
+    }
+  sn += mpn_limb_get_str (sp + sn, up[0], &binv);
+
+  /* Reverse order */
+  for (i = 0; 2*i + 1 < sn; i++)
+    {
+      unsigned char t = sp[i];
+      sp[i] = sp[sn - i - 1];
+      sp[sn - i - 1] = t;
+    }
+
+  return sn;
+}
+
+size_t
+mpn_get_str (unsigned char *sp, int base, mp_ptr up, mp_size_t un)
+{
+  unsigned bits;
+
+  assert (un > 0);
+  assert (up[un-1] > 0);
+
+  bits = mpn_base_power_of_two_p (base);
+  if (bits)
+    return mpn_get_str_bits (sp, bits, up, un);
+  else
+    {
+      struct mpn_base_info info;
+
+      mpn_get_base_info (&info, base);
+      return mpn_get_str_other (sp, base, &info, up, un);
+    }
+}
+
+static mp_size_t
+mpn_set_str_bits (mp_ptr rp, const unsigned char *sp, size_t sn,
+                 unsigned bits)
+{
+  mp_size_t rn;
+  mp_limb_t limb;
+  unsigned shift;
+
+  for (limb = 0, rn = 0, shift = 0; sn-- > 0; )
+    {
+      limb |= (mp_limb_t) sp[sn] << shift;
+      shift += bits;
+      if (shift >= GMP_LIMB_BITS)
+       {
+         shift -= GMP_LIMB_BITS;
+         rp[rn++] = limb;
+         /* Next line is correct also if shift == 0,
+            bits == 8, and mp_limb_t == unsigned char. */
+         limb = (unsigned int) sp[sn] >> (bits - shift);
+       }
+    }
+  if (limb != 0)
+    rp[rn++] = limb;
+  else
+    rn = mpn_normalized_size (rp, rn);
+  return rn;
+}
+
+/* Result is usually normalized, except for all-zero input, in which
+   case a single zero limb is written at *RP, and 1 is returned. */
+static mp_size_t
+mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn,
+                  mp_limb_t b, const struct mpn_base_info *info)
+{
+  mp_size_t rn;
+  mp_limb_t w;
+  unsigned k;
+  size_t j;
+
+  assert (sn > 0);
+
+  k = 1 + (sn - 1) % info->exp;
+
+  j = 0;
+  w = sp[j++];
+  while (--k != 0)
+    w = w * b + sp[j++];
+
+  rp[0] = w;
+
+  for (rn = 1; j < sn;)
+    {
+      mp_limb_t cy;
+
+      w = sp[j++];
+      for (k = 1; k < info->exp; k++)
+       w = w * b + sp[j++];
+
+      cy = mpn_mul_1 (rp, rp, rn, info->bb);
+      cy += mpn_add_1 (rp, rp, rn, w);
+      if (cy > 0)
+       rp[rn++] = cy;
+    }
+  assert (j == sn);
+
+  return rn;
+}
+
+mp_size_t
+mpn_set_str (mp_ptr rp, const unsigned char *sp, size_t sn, int base)
+{
+  unsigned bits;
+
+  if (sn == 0)
+    return 0;
+
+  bits = mpn_base_power_of_two_p (base);
+  if (bits)
+    return mpn_set_str_bits (rp, sp, sn, bits);
+  else
+    {
+      struct mpn_base_info info;
+
+      mpn_get_base_info (&info, base);
+      return mpn_set_str_other (rp, sp, sn, base, &info);
+    }
+}
+
+\f
+/* MPZ interface */
+void
+mpz_init (mpz_t r)
+{
+  static const mp_limb_t dummy_limb = GMP_LIMB_MAX & 0xc1a0;
+
+  r->_mp_alloc = 0;
+  r->_mp_size = 0;
+  r->_mp_d = (mp_ptr) &dummy_limb;
+}
+
+/* The utility of this function is a bit limited, since many functions
+   assigns the result variable using mpz_swap. */
+void
+mpz_init2 (mpz_t r, mp_bitcnt_t bits)
+{
+  mp_size_t rn;
+
+  bits -= (bits != 0);         /* Round down, except if 0 */
+  rn = 1 + bits / GMP_LIMB_BITS;
+
+  r->_mp_alloc = rn;
+  r->_mp_size = 0;
+  r->_mp_d = gmp_alloc_limbs (rn);
+}
+
+void
+mpz_clear (mpz_t r)
+{
+  if (r->_mp_alloc)
+    gmp_free_limbs (r->_mp_d, r->_mp_alloc);
+}
+
+static mp_ptr
+mpz_realloc (mpz_t r, mp_size_t size)
+{
+  size = GMP_MAX (size, 1);
+
+  if (r->_mp_alloc)
+    r->_mp_d = gmp_realloc_limbs (r->_mp_d, r->_mp_alloc, size);
+  else
+    r->_mp_d = gmp_alloc_limbs (size);
+  r->_mp_alloc = size;
+
+  if (GMP_ABS (r->_mp_size) > size)
+    r->_mp_size = 0;
+
+  return r->_mp_d;
+}
+
+/* Realloc for an mpz_t WHAT if it has less than NEEDED limbs.  */
+#define MPZ_REALLOC(z,n) ((n) > (z)->_mp_alloc                 \
+                         ? mpz_realloc(z,n)                    \
+                         : (z)->_mp_d)
+\f
+/* MPZ assignment and basic conversions. */
+void
+mpz_set_si (mpz_t r, signed long int x)
+{
+  if (x >= 0)
+    mpz_set_ui (r, x);
+  else /* (x < 0) */
+    if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+      {
+       mpz_set_ui (r, GMP_NEG_CAST (unsigned long int, x));
+       mpz_neg (r, r);
+      }
+  else
+    {
+      r->_mp_size = -1;
+      MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (unsigned long int, x);
+    }
+}
+
+void
+mpz_set_ui (mpz_t r, unsigned long int x)
+{
+  if (x > 0)
+    {
+      r->_mp_size = 1;
+      MPZ_REALLOC (r, 1)[0] = x;
+      if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+       {
+         int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;
+         while (x >>= LOCAL_GMP_LIMB_BITS)
+           {
+             ++ r->_mp_size;
+             MPZ_REALLOC (r, r->_mp_size)[r->_mp_size - 1] = x;
+           }
+       }
+    }
+  else
+    r->_mp_size = 0;
+}
+
+void
+mpz_set (mpz_t r, const mpz_t x)
+{
+  /* Allow the NOP r == x */
+  if (r != x)
+    {
+      mp_size_t n;
+      mp_ptr rp;
+
+      n = GMP_ABS (x->_mp_size);
+      rp = MPZ_REALLOC (r, n);
+
+      mpn_copyi (rp, x->_mp_d, n);
+      r->_mp_size = x->_mp_size;
+    }
+}
+
+void
+mpz_init_set_si (mpz_t r, signed long int x)
+{
+  mpz_init (r);
+  mpz_set_si (r, x);
+}
+
+void
+mpz_init_set_ui (mpz_t r, unsigned long int x)
+{
+  mpz_init (r);
+  mpz_set_ui (r, x);
+}
+
+void
+mpz_init_set (mpz_t r, const mpz_t x)
+{
+  mpz_init (r);
+  mpz_set (r, x);
+}
+
+int
+mpz_fits_slong_p (const mpz_t u)
+{
+  return mpz_cmp_si (u, LONG_MAX) <= 0 && mpz_cmp_si (u, LONG_MIN) >= 0;
+}
+
+static int
+mpn_absfits_ulong_p (mp_srcptr up, mp_size_t un)
+{
+  int ulongsize = GMP_ULONG_BITS / GMP_LIMB_BITS;
+  mp_limb_t ulongrem = 0;
+
+  if (GMP_ULONG_BITS % GMP_LIMB_BITS != 0)
+    ulongrem = (mp_limb_t) (ULONG_MAX >> GMP_LIMB_BITS * ulongsize) + 1;
+
+  return un <= ulongsize || (up[ulongsize] < ulongrem && un == ulongsize + 1);
+}
+
+int
+mpz_fits_ulong_p (const mpz_t u)
+{
+  mp_size_t us = u->_mp_size;
+
+  return us >= 0 && mpn_absfits_ulong_p (u->_mp_d, us);
+}
+
+int
+mpz_fits_sint_p (const mpz_t u)
+{
+  return mpz_cmp_si (u, INT_MAX) <= 0 && mpz_cmp_si (u, INT_MIN) >= 0;
+}
+
+int
+mpz_fits_uint_p (const mpz_t u)
+{
+  return u->_mp_size >= 0 && mpz_cmpabs_ui (u, UINT_MAX) <= 0;
+}
+
+int
+mpz_fits_sshort_p (const mpz_t u)
+{
+  return mpz_cmp_si (u, SHRT_MAX) <= 0 && mpz_cmp_si (u, SHRT_MIN) >= 0;
+}
+
+int
+mpz_fits_ushort_p (const mpz_t u)
+{
+  return u->_mp_size >= 0 && mpz_cmpabs_ui (u, USHRT_MAX) <= 0;
+}
+
+long int
+mpz_get_si (const mpz_t u)
+{
+  unsigned long r = mpz_get_ui (u);
+  unsigned long c = -LONG_MAX - LONG_MIN;
+
+  if (u->_mp_size < 0)
+    /* This expression is necessary to properly handle -LONG_MIN */
+    return -(long) c - (long) ((r - c) & LONG_MAX);
+  else
+    return (long) (r & LONG_MAX);
+}
+
+unsigned long int
+mpz_get_ui (const mpz_t u)
+{
+  if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+    {
+      int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;
+      unsigned long r = 0;
+      mp_size_t n = GMP_ABS (u->_mp_size);
+      n = GMP_MIN (n, 1 + (mp_size_t) (GMP_ULONG_BITS - 1) / GMP_LIMB_BITS);
+      while (--n >= 0)
+       r = (r << LOCAL_GMP_LIMB_BITS) + u->_mp_d[n];
+      return r;
+    }
+
+  return u->_mp_size == 0 ? 0 : u->_mp_d[0];
+}
+
+size_t
+mpz_size (const mpz_t u)
+{
+  return GMP_ABS (u->_mp_size);
+}
+
+mp_limb_t
+mpz_getlimbn (const mpz_t u, mp_size_t n)
+{
+  if (n >= 0 && n < GMP_ABS (u->_mp_size))
+    return u->_mp_d[n];
+  else
+    return 0;
+}
+
+void
+mpz_realloc2 (mpz_t x, mp_bitcnt_t n)
+{
+  mpz_realloc (x, 1 + (n - (n != 0)) / GMP_LIMB_BITS);
+}
+
+mp_srcptr
+mpz_limbs_read (mpz_srcptr x)
+{
+  return x->_mp_d;
+}
+
+mp_ptr
+mpz_limbs_modify (mpz_t x, mp_size_t n)
+{
+  assert (n > 0);
+  return MPZ_REALLOC (x, n);
+}
+
+mp_ptr
+mpz_limbs_write (mpz_t x, mp_size_t n)
+{
+  return mpz_limbs_modify (x, n);
+}
+
+void
+mpz_limbs_finish (mpz_t x, mp_size_t xs)
+{
+  mp_size_t xn;
+  xn = mpn_normalized_size (x->_mp_d, GMP_ABS (xs));
+  x->_mp_size = xs < 0 ? -xn : xn;
+}
+
+static mpz_srcptr
+mpz_roinit_normal_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+{
+  x->_mp_alloc = 0;
+  x->_mp_d = (mp_ptr) xp;
+  x->_mp_size = xs;
+  return x;
+}
+
+mpz_srcptr
+mpz_roinit_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+{
+  mpz_roinit_normal_n (x, xp, xs);
+  mpz_limbs_finish (x, xs);
+  return x;
+}
+
+\f
+/* Conversions and comparison to double. */
+void
+mpz_set_d (mpz_t r, double x)
+{
+  int sign;
+  mp_ptr rp;
+  mp_size_t rn, i;
+  double B;
+  double Bi;
+  mp_limb_t f;
+
+  /* x != x is true when x is a NaN, and x == x * 0.5 is true when x is
+     zero or infinity. */
+  if (x != x || x == x * 0.5)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  sign = x < 0.0 ;
+  if (sign)
+    x = - x;
+
+  if (x < 1.0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+  B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
+  Bi = 1.0 / B;
+  for (rn = 1; x >= B; rn++)
+    x *= Bi;
+
+  rp = MPZ_REALLOC (r, rn);
+
+  f = (mp_limb_t) x;
+  x -= f;
+  assert (x < 1.0);
+  i = rn-1;
+  rp[i] = f;
+  while (--i >= 0)
+    {
+      x = B * x;
+      f = (mp_limb_t) x;
+      x -= f;
+      assert (x < 1.0);
+      rp[i] = f;
+    }
+
+  r->_mp_size = sign ? - rn : rn;
+}
+
+void
+mpz_init_set_d (mpz_t r, double x)
+{
+  mpz_init (r);
+  mpz_set_d (r, x);
+}
+
+double
+mpz_get_d (const mpz_t u)
+{
+  int m;
+  mp_limb_t l;
+  mp_size_t un;
+  double x;
+  double B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
+
+  un = GMP_ABS (u->_mp_size);
+
+  if (un == 0)
+    return 0.0;
+
+  l = u->_mp_d[--un];
+  gmp_clz (m, l);
+  m = m + GMP_DBL_MANT_BITS - GMP_LIMB_BITS;
+  if (m < 0)
+    l &= GMP_LIMB_MAX << -m;
+
+  for (x = l; --un >= 0;)
+    {
+      x = B*x;
+      if (m > 0) {
+       l = u->_mp_d[un];
+       m -= GMP_LIMB_BITS;
+       if (m < 0)
+         l &= GMP_LIMB_MAX << -m;
+       x += l;
+      }
+    }
+
+  if (u->_mp_size < 0)
+    x = -x;
+
+  return x;
+}
+
+int
+mpz_cmpabs_d (const mpz_t x, double d)
+{
+  mp_size_t xn;
+  double B, Bi;
+  mp_size_t i;
+
+  xn = x->_mp_size;
+  d = GMP_ABS (d);
+
+  if (xn != 0)
+    {
+      xn = GMP_ABS (xn);
+
+      B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
+      Bi = 1.0 / B;
+
+      /* Scale d so it can be compared with the top limb. */
+      for (i = 1; i < xn; i++)
+       d *= Bi;
+
+      if (d >= B)
+       return -1;
+
+      /* Compare floor(d) to top limb, subtract and cancel when equal. */
+      for (i = xn; i-- > 0;)
+       {
+         mp_limb_t f, xl;
+
+         f = (mp_limb_t) d;
+         xl = x->_mp_d[i];
+         if (xl > f)
+           return 1;
+         else if (xl < f)
+           return -1;
+         d = B * (d - f);
+       }
+    }
+  return - (d > 0.0);
+}
+
+int
+mpz_cmp_d (const mpz_t x, double d)
+{
+  if (x->_mp_size < 0)
+    {
+      if (d >= 0.0)
+       return -1;
+      else
+       return -mpz_cmpabs_d (x, d);
+    }
+  else
+    {
+      if (d < 0.0)
+       return 1;
+      else
+       return mpz_cmpabs_d (x, d);
+    }
+}
+
+\f
+/* MPZ comparisons and the like. */
+int
+mpz_sgn (const mpz_t u)
+{
+  return GMP_CMP (u->_mp_size, 0);
+}
+
+int
+mpz_cmp_si (const mpz_t u, long v)
+{
+  mp_size_t usize = u->_mp_size;
+
+  if (v >= 0)
+    return mpz_cmp_ui (u, v);
+  else if (usize >= 0)
+    return 1;
+  else
+    return - mpz_cmpabs_ui (u, GMP_NEG_CAST (unsigned long int, v));
+}
+
+int
+mpz_cmp_ui (const mpz_t u, unsigned long v)
+{
+  mp_size_t usize = u->_mp_size;
+
+  if (usize < 0)
+    return -1;
+  else
+    return mpz_cmpabs_ui (u, v);
+}
+
+int
+mpz_cmp (const mpz_t a, const mpz_t b)
+{
+  mp_size_t asize = a->_mp_size;
+  mp_size_t bsize = b->_mp_size;
+
+  if (asize != bsize)
+    return (asize < bsize) ? -1 : 1;
+  else if (asize >= 0)
+    return mpn_cmp (a->_mp_d, b->_mp_d, asize);
+  else
+    return mpn_cmp (b->_mp_d, a->_mp_d, -asize);
+}
+
+int
+mpz_cmpabs_ui (const mpz_t u, unsigned long v)
+{
+  mp_size_t un = GMP_ABS (u->_mp_size);
+
+  if (! mpn_absfits_ulong_p (u->_mp_d, un))
+    return 1;
+  else
+    {
+      unsigned long uu = mpz_get_ui (u);
+      return GMP_CMP(uu, v);
+    }
+}
+
+int
+mpz_cmpabs (const mpz_t u, const mpz_t v)
+{
+  return mpn_cmp4 (u->_mp_d, GMP_ABS (u->_mp_size),
+                  v->_mp_d, GMP_ABS (v->_mp_size));
+}
+
+void
+mpz_abs (mpz_t r, const mpz_t u)
+{
+  mpz_set (r, u);
+  r->_mp_size = GMP_ABS (r->_mp_size);
+}
+
+void
+mpz_neg (mpz_t r, const mpz_t u)
+{
+  mpz_set (r, u);
+  r->_mp_size = -r->_mp_size;
+}
+
+void
+mpz_swap (mpz_t u, mpz_t v)
+{
+  MP_SIZE_T_SWAP (u->_mp_alloc, v->_mp_alloc);
+  MPN_PTR_SWAP (u->_mp_d, u->_mp_size, v->_mp_d, v->_mp_size);
+}
+
+\f
+/* MPZ addition and subtraction */
+
+
+void
+mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
+{
+  mpz_t bb;
+  mpz_init_set_ui (bb, b);
+  mpz_add (r, a, bb);
+  mpz_clear (bb);
+}
+
+void
+mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
+{
+  mpz_ui_sub (r, b, a);
+  mpz_neg (r, r);
+}
+
+void
+mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b)
+{
+  mpz_neg (r, b);
+  mpz_add_ui (r, r, a);
+}
+
+static mp_size_t
+mpz_abs_add (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t an = GMP_ABS (a->_mp_size);
+  mp_size_t bn = GMP_ABS (b->_mp_size);
+  mp_ptr rp;
+  mp_limb_t cy;
+
+  if (an < bn)
+    {
+      MPZ_SRCPTR_SWAP (a, b);
+      MP_SIZE_T_SWAP (an, bn);
+    }
+
+  rp = MPZ_REALLOC (r, an + 1);
+  cy = mpn_add (rp, a->_mp_d, an, b->_mp_d, bn);
+
+  rp[an] = cy;
+
+  return an + cy;
+}
+
+static mp_size_t
+mpz_abs_sub (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t an = GMP_ABS (a->_mp_size);
+  mp_size_t bn = GMP_ABS (b->_mp_size);
+  int cmp;
+  mp_ptr rp;
+
+  cmp = mpn_cmp4 (a->_mp_d, an, b->_mp_d, bn);
+  if (cmp > 0)
+    {
+      rp = MPZ_REALLOC (r, an);
+      gmp_assert_nocarry (mpn_sub (rp, a->_mp_d, an, b->_mp_d, bn));
+      return mpn_normalized_size (rp, an);
+    }
+  else if (cmp < 0)
+    {
+      rp = MPZ_REALLOC (r, bn);
+      gmp_assert_nocarry (mpn_sub (rp, b->_mp_d, bn, a->_mp_d, an));
+      return -mpn_normalized_size (rp, bn);
+    }
+  else
+    return 0;
+}
+
+void
+mpz_add (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t rn;
+
+  if ( (a->_mp_size ^ b->_mp_size) >= 0)
+    rn = mpz_abs_add (r, a, b);
+  else
+    rn = mpz_abs_sub (r, a, b);
+
+  r->_mp_size = a->_mp_size >= 0 ? rn : - rn;
+}
+
+void
+mpz_sub (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t rn;
+
+  if ( (a->_mp_size ^ b->_mp_size) >= 0)
+    rn = mpz_abs_sub (r, a, b);
+  else
+    rn = mpz_abs_add (r, a, b);
+
+  r->_mp_size = a->_mp_size >= 0 ? rn : - rn;
+}
+
+\f
+/* MPZ multiplication */
+void
+mpz_mul_si (mpz_t r, const mpz_t u, long int v)
+{
+  if (v < 0)
+    {
+      mpz_mul_ui (r, u, GMP_NEG_CAST (unsigned long int, v));
+      mpz_neg (r, r);
+    }
+  else
+    mpz_mul_ui (r, u, v);
+}
+
+void
+mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+  mpz_t vv;
+  mpz_init_set_ui (vv, v);
+  mpz_mul (r, u, vv);
+  mpz_clear (vv);
+  return;
+}
+
+void
+mpz_mul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  int sign;
+  mp_size_t un, vn, rn;
+  mpz_t t;
+  mp_ptr tp;
+
+  un = u->_mp_size;
+  vn = v->_mp_size;
+
+  if (un == 0 || vn == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  sign = (un ^ vn) < 0;
+
+  un = GMP_ABS (un);
+  vn = GMP_ABS (vn);
+
+  mpz_init2 (t, (un + vn) * GMP_LIMB_BITS);
+
+  tp = t->_mp_d;
+  if (un >= vn)
+    mpn_mul (tp, u->_mp_d, un, v->_mp_d, vn);
+  else
+    mpn_mul (tp, v->_mp_d, vn, u->_mp_d, un);
+
+  rn = un + vn;
+  rn -= tp[rn-1] == 0;
+
+  t->_mp_size = sign ? - rn : rn;
+  mpz_swap (r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_mul_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bits)
+{
+  mp_size_t un, rn;
+  mp_size_t limbs;
+  unsigned shift;
+  mp_ptr rp;
+
+  un = GMP_ABS (u->_mp_size);
+  if (un == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  limbs = bits / GMP_LIMB_BITS;
+  shift = bits % GMP_LIMB_BITS;
+
+  rn = un + limbs + (shift > 0);
+  rp = MPZ_REALLOC (r, rn);
+  if (shift > 0)
+    {
+      mp_limb_t cy = mpn_lshift (rp + limbs, u->_mp_d, un, shift);
+      rp[rn-1] = cy;
+      rn -= (cy == 0);
+    }
+  else
+    mpn_copyd (rp + limbs, u->_mp_d, un);
+
+  mpn_zero (rp, limbs);
+
+  r->_mp_size = (u->_mp_size < 0) ? - rn : rn;
+}
+
+void
+mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+  mpz_t t;
+  mpz_init_set_ui (t, v);
+  mpz_mul (t, u, t);
+  mpz_add (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+  mpz_t t;
+  mpz_init_set_ui (t, v);
+  mpz_mul (t, u, t);
+  mpz_sub (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_addmul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul (t, u, v);
+  mpz_add (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_submul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul (t, u, v);
+  mpz_sub (r, r, t);
+  mpz_clear (t);
+}
+
+\f
+/* MPZ division */
+enum mpz_div_round_mode { GMP_DIV_FLOOR, GMP_DIV_CEIL, GMP_DIV_TRUNC };
+
+/* Allows q or r to be zero. Returns 1 iff remainder is non-zero. */
+static int
+mpz_div_qr (mpz_t q, mpz_t r,
+           const mpz_t n, const mpz_t d, enum mpz_div_round_mode mode)
+{
+  mp_size_t ns, ds, nn, dn, qs;
+  ns = n->_mp_size;
+  ds = d->_mp_size;
+
+  if (ds == 0)
+    gmp_die("mpz_div_qr: Divide by zero.");
+
+  if (ns == 0)
+    {
+      if (q)
+       q->_mp_size = 0;
+      if (r)
+       r->_mp_size = 0;
+      return 0;
+    }
+
+  nn = GMP_ABS (ns);
+  dn = GMP_ABS (ds);
+
+  qs = ds ^ ns;
+
+  if (nn < dn)
+    {
+      if (mode == GMP_DIV_CEIL && qs >= 0)
+       {
+         /* q = 1, r = n - d */
+         if (r)
+           mpz_sub (r, n, d);
+         if (q)
+           mpz_set_ui (q, 1);
+       }
+      else if (mode == GMP_DIV_FLOOR && qs < 0)
+       {
+         /* q = -1, r = n + d */
+         if (r)
+           mpz_add (r, n, d);
+         if (q)
+           mpz_set_si (q, -1);
+       }
+      else
+       {
+         /* q = 0, r = d */
+         if (r)
+           mpz_set (r, n);
+         if (q)
+           q->_mp_size = 0;
+       }
+      return 1;
+    }
+  else
+    {
+      mp_ptr np, qp;
+      mp_size_t qn, rn;
+      mpz_t tq, tr;
+
+      mpz_init_set (tr, n);
+      np = tr->_mp_d;
+
+      qn = nn - dn + 1;
+
+      if (q)
+       {
+         mpz_init2 (tq, qn * GMP_LIMB_BITS);
+         qp = tq->_mp_d;
+       }
+      else
+       qp = NULL;
+
+      mpn_div_qr (qp, np, nn, d->_mp_d, dn);
+
+      if (qp)
+       {
+         qn -= (qp[qn-1] == 0);
+
+         tq->_mp_size = qs < 0 ? -qn : qn;
+       }
+      rn = mpn_normalized_size (np, dn);
+      tr->_mp_size = ns < 0 ? - rn : rn;
+
+      if (mode == GMP_DIV_FLOOR && qs < 0 && rn != 0)
+       {
+         if (q)
+           mpz_sub_ui (tq, tq, 1);
+         if (r)
+           mpz_add (tr, tr, d);
+       }
+      else if (mode == GMP_DIV_CEIL && qs >= 0 && rn != 0)
+       {
+         if (q)
+           mpz_add_ui (tq, tq, 1);
+         if (r)
+           mpz_sub (tr, tr, d);
+       }
+
+      if (q)
+       {
+         mpz_swap (tq, q);
+         mpz_clear (tq);
+       }
+      if (r)
+       mpz_swap (tr, r);
+
+      mpz_clear (tr);
+
+      return rn != 0;
+    }
+}
+
+void
+mpz_cdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, r, n, d, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, r, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, r, n, d, GMP_DIV_TRUNC);
+}
+
+void
+mpz_cdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, NULL, n, d, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, NULL, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC);
+}
+
+void
+mpz_cdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, GMP_DIV_TRUNC);
+}
+
+void
+mpz_mod (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, d->_mp_size >= 0 ? GMP_DIV_FLOOR : GMP_DIV_CEIL);
+}
+
+static void
+mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index,
+               enum mpz_div_round_mode mode)
+{
+  mp_size_t un, qn;
+  mp_size_t limb_cnt;
+  mp_ptr qp;
+  int adjust;
+
+  un = u->_mp_size;
+  if (un == 0)
+    {
+      q->_mp_size = 0;
+      return;
+    }
+  limb_cnt = bit_index / GMP_LIMB_BITS;
+  qn = GMP_ABS (un) - limb_cnt;
+  bit_index %= GMP_LIMB_BITS;
+
+  if (mode == ((un > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* un != 0 here. */
+    /* Note: Below, the final indexing at limb_cnt is valid because at
+       that point we have qn > 0. */
+    adjust = (qn <= 0
+             || !mpn_zero_p (u->_mp_d, limb_cnt)
+             || (u->_mp_d[limb_cnt]
+                 & (((mp_limb_t) 1 << bit_index) - 1)));
+  else
+    adjust = 0;
+
+  if (qn <= 0)
+    qn = 0;
+  else
+    {
+      qp = MPZ_REALLOC (q, qn);
+
+      if (bit_index != 0)
+       {
+         mpn_rshift (qp, u->_mp_d + limb_cnt, qn, bit_index);
+         qn -= qp[qn - 1] == 0;
+       }
+      else
+       {
+         mpn_copyi (qp, u->_mp_d + limb_cnt, qn);
+       }
+    }
+
+  q->_mp_size = qn;
+
+  if (adjust)
+    mpz_add_ui (q, q, 1);
+  if (un < 0)
+    mpz_neg (q, q);
+}
+
+static void
+mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index,
+               enum mpz_div_round_mode mode)
+{
+  mp_size_t us, un, rn;
+  mp_ptr rp;
+  mp_limb_t mask;
+
+  us = u->_mp_size;
+  if (us == 0 || bit_index == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+  rn = (bit_index + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+  assert (rn > 0);
+
+  rp = MPZ_REALLOC (r, rn);
+  un = GMP_ABS (us);
+
+  mask = GMP_LIMB_MAX >> (rn * GMP_LIMB_BITS - bit_index);
+
+  if (rn > un)
+    {
+      /* Quotient (with truncation) is zero, and remainder is
+        non-zero */
+      if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */
+       {
+         /* Have to negate and sign extend. */
+         mp_size_t i;
+
+         gmp_assert_nocarry (! mpn_neg (rp, u->_mp_d, un));
+         for (i = un; i < rn - 1; i++)
+           rp[i] = GMP_LIMB_MAX;
+
+         rp[rn-1] = mask;
+         us = -us;
+       }
+      else
+       {
+         /* Just copy */
+         if (r != u)
+           mpn_copyi (rp, u->_mp_d, un);
+
+         rn = un;
+       }
+    }
+  else
+    {
+      if (r != u)
+       mpn_copyi (rp, u->_mp_d, rn - 1);
+
+      rp[rn-1] = u->_mp_d[rn-1] & mask;
+
+      if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */
+       {
+         /* If r != 0, compute 2^{bit_count} - r. */
+         mpn_neg (rp, rp, rn);
+
+         rp[rn-1] &= mask;
+
+         /* us is not used for anything else, so we can modify it
+            here to indicate flipped sign. */
+         us = -us;
+       }
+    }
+  rn = mpn_normalized_size (rp, rn);
+  r->_mp_size = us < 0 ? -rn : rn;
+}
+
+void
+mpz_cdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_q_2exp (r, u, cnt, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_q_2exp (r, u, cnt, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_q_2exp (r, u, cnt, GMP_DIV_TRUNC);
+}
+
+void
+mpz_cdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_r_2exp (r, u, cnt, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_r_2exp (r, u, cnt, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_r_2exp (r, u, cnt, GMP_DIV_TRUNC);
+}
+
+void
+mpz_divexact (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  gmp_assert_nocarry (mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC));
+}
+
+int
+mpz_divisible_p (const mpz_t n, const mpz_t d)
+{
+  return mpz_div_qr (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0;
+}
+
+int
+mpz_congruent_p (const mpz_t a, const mpz_t b, const mpz_t m)
+{
+  mpz_t t;
+  int res;
+
+  /* a == b (mod 0) iff a == b */
+  if (mpz_sgn (m) == 0)
+    return (mpz_cmp (a, b) == 0);
+
+  mpz_init (t);
+  mpz_sub (t, a, b);
+  res = mpz_divisible_p (t, m);
+  mpz_clear (t);
+
+  return res;
+}
+
+static unsigned long
+mpz_div_qr_ui (mpz_t q, mpz_t r,
+              const mpz_t n, unsigned long d, enum mpz_div_round_mode mode)
+{
+  unsigned long ret;
+  mpz_t rr, dd;
+
+  mpz_init (rr);
+  mpz_init_set_ui (dd, d);
+  mpz_div_qr (q, rr, n, dd, mode);
+  mpz_clear (dd);
+  ret = mpz_get_ui (rr);
+
+  if (r)
+    mpz_swap (r, rr);
+  mpz_clear (rr);
+
+  return ret;
+}
+
+unsigned long
+mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, r, n, d, GMP_DIV_CEIL);
+}
+
+unsigned long
+mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, r, n, d, GMP_DIV_FLOOR);
+}
+
+unsigned long
+mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, r, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_cdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_CEIL);
+}
+
+unsigned long
+mpz_fdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_FLOOR);
+}
+
+unsigned long
+mpz_tdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_cdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_CEIL);
+}
+unsigned long
+mpz_fdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
+}
+unsigned long
+mpz_tdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_cdiv_ui (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_CEIL);
+}
+
+unsigned long
+mpz_fdiv_ui (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_FLOOR);
+}
+
+unsigned long
+mpz_tdiv_ui (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_mod_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_divexact_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  gmp_assert_nocarry (mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC));
+}
+
+int
+mpz_divisible_ui_p (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0;
+}
+
+\f
+/* GCD */
+static mp_limb_t
+mpn_gcd_11 (mp_limb_t u, mp_limb_t v)
+{
+  unsigned shift;
+
+  assert ( (u | v) > 0);
+
+  if (u == 0)
+    return v;
+  else if (v == 0)
+    return u;
+
+  gmp_ctz (shift, u | v);
+
+  u >>= shift;
+  v >>= shift;
+
+  if ( (u & 1) == 0)
+    MP_LIMB_T_SWAP (u, v);
+
+  while ( (v & 1) == 0)
+    v >>= 1;
+
+  while (u != v)
+    {
+      if (u > v)
+       {
+         u -= v;
+         do
+           u >>= 1;
+         while ( (u & 1) == 0);
+       }
+      else
+       {
+         v -= u;
+         do
+           v >>= 1;
+         while ( (v & 1) == 0);
+       }
+    }
+  return u << shift;
+}
+
+unsigned long
+mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v)
+{
+  mpz_t t;
+  mpz_init_set_ui(t, v);
+  mpz_gcd (t, u, t);
+  if (v > 0)
+    v = mpz_get_ui (t);
+
+  if (g)
+    mpz_swap (t, g);
+
+  mpz_clear (t);
+
+  return v;
+}
+
+static mp_bitcnt_t
+mpz_make_odd (mpz_t r)
+{
+  mp_bitcnt_t shift;
+
+  assert (r->_mp_size > 0);
+  /* Count trailing zeros, equivalent to mpn_scan1, because we know that there is a 1 */
+  shift = mpn_scan1 (r->_mp_d, 0);
+  mpz_tdiv_q_2exp (r, r, shift);
+
+  return shift;
+}
+
+void
+mpz_gcd (mpz_t g, const mpz_t u, const mpz_t v)
+{
+  mpz_t tu, tv;
+  mp_bitcnt_t uz, vz, gz;
+
+  if (u->_mp_size == 0)
+    {
+      mpz_abs (g, v);
+      return;
+    }
+  if (v->_mp_size == 0)
+    {
+      mpz_abs (g, u);
+      return;
+    }
+
+  mpz_init (tu);
+  mpz_init (tv);
+
+  mpz_abs (tu, u);
+  uz = mpz_make_odd (tu);
+  mpz_abs (tv, v);
+  vz = mpz_make_odd (tv);
+  gz = GMP_MIN (uz, vz);
+
+  if (tu->_mp_size < tv->_mp_size)
+    mpz_swap (tu, tv);
+
+  mpz_tdiv_r (tu, tu, tv);
+  if (tu->_mp_size == 0)
+    {
+      mpz_swap (g, tv);
+    }
+  else
+    for (;;)
+      {
+       int c;
+
+       mpz_make_odd (tu);
+       c = mpz_cmp (tu, tv);
+       if (c == 0)
+         {
+           mpz_swap (g, tu);
+           break;
+         }
+       if (c < 0)
+         mpz_swap (tu, tv);
+
+       if (tv->_mp_size == 1)
+         {
+           mp_limb_t *gp;
+
+           mpz_tdiv_r (tu, tu, tv);
+           gp = MPZ_REALLOC (g, 1); /* gp = mpz_limbs_modify (g, 1); */
+           *gp = mpn_gcd_11 (tu->_mp_d[0], tv->_mp_d[0]);
+
+           g->_mp_size = *gp != 0; /* mpz_limbs_finish (g, 1); */
+           break;
+         }
+       mpz_sub (tu, tu, tv);
+      }
+  mpz_clear (tu);
+  mpz_clear (tv);
+  mpz_mul_2exp (g, g, gz);
+}
+
+void
+mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
+{
+  mpz_t tu, tv, s0, s1, t0, t1;
+  mp_bitcnt_t uz, vz, gz;
+  mp_bitcnt_t power;
+  int cmp;
+
+  if (u->_mp_size == 0)
+    {
+      /* g = 0 u + sgn(v) v */
+      signed long sign = mpz_sgn (v);
+      mpz_abs (g, v);
+      if (s)
+       s->_mp_size = 0;
+      if (t)
+       mpz_set_si (t, sign);
+      return;
+    }
+
+  if (v->_mp_size == 0)
+    {
+      /* g = sgn(u) u + 0 v */
+      signed long sign = mpz_sgn (u);
+      mpz_abs (g, u);
+      if (s)
+       mpz_set_si (s, sign);
+      if (t)
+       t->_mp_size = 0;
+      return;
+    }
+
+  mpz_init (tu);
+  mpz_init (tv);
+  mpz_init (s0);
+  mpz_init (s1);
+  mpz_init (t0);
+  mpz_init (t1);
+
+  mpz_abs (tu, u);
+  uz = mpz_make_odd (tu);
+  mpz_abs (tv, v);
+  vz = mpz_make_odd (tv);
+  gz = GMP_MIN (uz, vz);
+
+  uz -= gz;
+  vz -= gz;
+
+  /* Cofactors corresponding to odd gcd. gz handled later. */
+  if (tu->_mp_size < tv->_mp_size)
+    {
+      mpz_swap (tu, tv);
+      MPZ_SRCPTR_SWAP (u, v);
+      MPZ_PTR_SWAP (s, t);
+      MP_BITCNT_T_SWAP (uz, vz);
+    }
+
+  /* Maintain
+   *
+   * u = t0 tu + t1 tv
+   * v = s0 tu + s1 tv
+   *
+   * where u and v denote the inputs with common factors of two
+   * eliminated, and det (s0, t0; s1, t1) = 2^p. Then
+   *
+   * 2^p tu =  s1 u - t1 v
+   * 2^p tv = -s0 u + t0 v
+   */
+
+  /* After initial division, tu = q tv + tu', we have
+   *
+   * u = 2^uz (tu' + q tv)
+   * v = 2^vz tv
+   *
+   * or
+   *
+   * t0 = 2^uz, t1 = 2^uz q
+   * s0 = 0,    s1 = 2^vz
+   */
+
+  mpz_tdiv_qr (t1, tu, tu, tv);
+  mpz_mul_2exp (t1, t1, uz);
+
+  mpz_setbit (s1, vz);
+  power = uz + vz;
+
+  if (tu->_mp_size > 0)
+    {
+      mp_bitcnt_t shift;
+      shift = mpz_make_odd (tu);
+      mpz_setbit (t0, uz + shift);
+      power += shift;
+
+      for (;;)
+       {
+         int c;
+         c = mpz_cmp (tu, tv);
+         if (c == 0)
+           break;
+
+         if (c < 0)
+           {
+             /* tv = tv' + tu
+              *
+              * u = t0 tu + t1 (tv' + tu) = (t0 + t1) tu + t1 tv'
+              * v = s0 tu + s1 (tv' + tu) = (s0 + s1) tu + s1 tv' */
+
+             mpz_sub (tv, tv, tu);
+             mpz_add (t0, t0, t1);
+             mpz_add (s0, s0, s1);
+
+             shift = mpz_make_odd (tv);
+             mpz_mul_2exp (t1, t1, shift);
+             mpz_mul_2exp (s1, s1, shift);
+           }
+         else
+           {
+             mpz_sub (tu, tu, tv);
+             mpz_add (t1, t0, t1);
+             mpz_add (s1, s0, s1);
+
+             shift = mpz_make_odd (tu);
+             mpz_mul_2exp (t0, t0, shift);
+             mpz_mul_2exp (s0, s0, shift);
+           }
+         power += shift;
+       }
+    }
+  else
+    mpz_setbit (t0, uz);
+
+  /* Now tv = odd part of gcd, and -s0 and t0 are corresponding
+     cofactors. */
+
+  mpz_mul_2exp (tv, tv, gz);
+  mpz_neg (s0, s0);
+
+  /* 2^p g = s0 u + t0 v. Eliminate one factor of two at a time. To
+     adjust cofactors, we need u / g and v / g */
+
+  mpz_divexact (s1, v, tv);
+  mpz_abs (s1, s1);
+  mpz_divexact (t1, u, tv);
+  mpz_abs (t1, t1);
+
+  while (power-- > 0)
+    {
+      /* s0 u + t0 v = (s0 - v/g) u - (t0 + u/g) v */
+      if (mpz_odd_p (s0) || mpz_odd_p (t0))
+       {
+         mpz_sub (s0, s0, s1);
+         mpz_add (t0, t0, t1);
+       }
+      assert (mpz_even_p (t0) && mpz_even_p (s0));
+      mpz_tdiv_q_2exp (s0, s0, 1);
+      mpz_tdiv_q_2exp (t0, t0, 1);
+    }
+
+  /* Choose small cofactors (they should generally satify
+
+       |s| < |u| / 2g and |t| < |v| / 2g,
+
+     with some documented exceptions). Always choose the smallest s,
+     if there are two choices for s with same absolute value, choose
+     the one with smallest corresponding t (this asymmetric condition
+     is needed to prefer s = 0, |t| = 1 when g = |a| = |b|). */
+  mpz_add (s1, s0, s1);
+  mpz_sub (t1, t0, t1);
+  cmp = mpz_cmpabs (s0, s1);
+  if (cmp > 0 || (cmp == 0 && mpz_cmpabs (t0, t1) > 0))
+    {
+      mpz_swap (s0, s1);
+      mpz_swap (t0, t1);
+    }
+  if (u->_mp_size < 0)
+    mpz_neg (s0, s0);
+  if (v->_mp_size < 0)
+    mpz_neg (t0, t0);
+
+  mpz_swap (g, tv);
+  if (s)
+    mpz_swap (s, s0);
+  if (t)
+    mpz_swap (t, t0);
+
+  mpz_clear (tu);
+  mpz_clear (tv);
+  mpz_clear (s0);
+  mpz_clear (s1);
+  mpz_clear (t0);
+  mpz_clear (t1);
+}
+
+void
+mpz_lcm (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t g;
+
+  if (u->_mp_size == 0 || v->_mp_size == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  mpz_init (g);
+
+  mpz_gcd (g, u, v);
+  mpz_divexact (g, u, g);
+  mpz_mul (r, g, v);
+
+  mpz_clear (g);
+  mpz_abs (r, r);
+}
+
+void
+mpz_lcm_ui (mpz_t r, const mpz_t u, unsigned long v)
+{
+  if (v == 0 || u->_mp_size == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  v /= mpz_gcd_ui (NULL, u, v);
+  mpz_mul_ui (r, u, v);
+
+  mpz_abs (r, r);
+}
+
+int
+mpz_invert (mpz_t r, const mpz_t u, const mpz_t m)
+{
+  mpz_t g, tr;
+  int invertible;
+
+  if (u->_mp_size == 0 || mpz_cmpabs_ui (m, 1) <= 0)
+    return 0;
+
+  mpz_init (g);
+  mpz_init (tr);
+
+  mpz_gcdext (g, tr, NULL, u, m);
+  invertible = (mpz_cmp_ui (g, 1) == 0);
+
+  if (invertible)
+    {
+      if (tr->_mp_size < 0)
+       {
+         if (m->_mp_size >= 0)
+           mpz_add (tr, tr, m);
+         else
+           mpz_sub (tr, tr, m);
+       }
+      mpz_swap (r, tr);
+    }
+
+  mpz_clear (g);
+  mpz_clear (tr);
+  return invertible;
+}
+
+\f
+/* Higher level operations (sqrt, pow and root) */
+
+void
+mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e)
+{
+  unsigned long bit;
+  mpz_t tr;
+  mpz_init_set_ui (tr, 1);
+
+  bit = GMP_ULONG_HIGHBIT;
+  do
+    {
+      mpz_mul (tr, tr, tr);
+      if (e & bit)
+       mpz_mul (tr, tr, b);
+      bit >>= 1;
+    }
+  while (bit > 0);
+
+  mpz_swap (r, tr);
+  mpz_clear (tr);
+}
+
+void
+mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e)
+{
+  mpz_t b;
+
+  mpz_init_set_ui (b, blimb);
+  mpz_pow_ui (r, b, e);
+  mpz_clear (b);
+}
+
+void
+mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
+{
+  mpz_t tr;
+  mpz_t base;
+  mp_size_t en, mn;
+  mp_srcptr mp;
+  struct gmp_div_inverse minv;
+  unsigned shift;
+  mp_ptr tp = NULL;
+
+  en = GMP_ABS (e->_mp_size);
+  mn = GMP_ABS (m->_mp_size);
+  if (mn == 0)
+    gmp_die ("mpz_powm: Zero modulo.");
+
+  if (en == 0)
+    {
+      mpz_set_ui (r, mpz_cmpabs_ui (m, 1));
+      return;
+    }
+
+  mp = m->_mp_d;
+  mpn_div_qr_invert (&minv, mp, mn);
+  shift = minv.shift;
+
+  if (shift > 0)
+    {
+      /* To avoid shifts, we do all our reductions, except the final
+        one, using a *normalized* m. */
+      minv.shift = 0;
+
+      tp = gmp_alloc_limbs (mn);
+      gmp_assert_nocarry (mpn_lshift (tp, mp, mn, shift));
+      mp = tp;
+    }
+
+  mpz_init (base);
+
+  if (e->_mp_size < 0)
+    {
+      if (!mpz_invert (base, b, m))
+       gmp_die ("mpz_powm: Negative exponent and non-invertible base.");
+    }
+  else
+    {
+      mp_size_t bn;
+      mpz_abs (base, b);
+
+      bn = base->_mp_size;
+      if (bn >= mn)
+       {
+         mpn_div_qr_preinv (NULL, base->_mp_d, base->_mp_size, mp, mn, &minv);
+         bn = mn;
+       }
+
+      /* We have reduced the absolute value. Now take care of the
+        sign. Note that we get zero represented non-canonically as
+        m. */
+      if (b->_mp_size < 0)
+       {
+         mp_ptr bp = MPZ_REALLOC (base, mn);
+         gmp_assert_nocarry (mpn_sub (bp, mp, mn, bp, bn));
+         bn = mn;
+       }
+      base->_mp_size = mpn_normalized_size (base->_mp_d, bn);
+    }
+  mpz_init_set_ui (tr, 1);
+
+  while (--en >= 0)
+    {
+      mp_limb_t w = e->_mp_d[en];
+      mp_limb_t bit;
+
+      bit = GMP_LIMB_HIGHBIT;
+      do
+       {
+         mpz_mul (tr, tr, tr);
+         if (w & bit)
+           mpz_mul (tr, tr, base);
+         if (tr->_mp_size > mn)
+           {
+             mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv);
+             tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn);
+           }
+         bit >>= 1;
+       }
+      while (bit > 0);
+    }
+
+  /* Final reduction */
+  if (tr->_mp_size >= mn)
+    {
+      minv.shift = shift;
+      mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv);
+      tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn);
+    }
+  if (tp)
+    gmp_free_limbs (tp, mn);
+
+  mpz_swap (r, tr);
+  mpz_clear (tr);
+  mpz_clear (base);
+}
+
+void
+mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m)
+{
+  mpz_t e;
+
+  mpz_init_set_ui (e, elimb);
+  mpz_powm (r, b, e, m);
+  mpz_clear (e);
+}
+
+/* x=trunc(y^(1/z)), r=y-x^z */
+void
+mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
+{
+  int sgn;
+  mp_bitcnt_t bc;
+  mpz_t t, u;
+
+  sgn = y->_mp_size < 0;
+  if ((~z & sgn) != 0)
+    gmp_die ("mpz_rootrem: Negative argument, with even root.");
+  if (z == 0)
+    gmp_die ("mpz_rootrem: Zeroth root.");
+
+  if (mpz_cmpabs_ui (y, 1) <= 0) {
+    if (x)
+      mpz_set (x, y);
+    if (r)
+      r->_mp_size = 0;
+    return;
+  }
+
+  mpz_init (u);
+  mpz_init (t);
+  bc = (mpz_sizeinbase (y, 2) - 1) / z + 1;
+  mpz_setbit (t, bc);
+
+  if (z == 2) /* simplify sqrt loop: z-1 == 1 */
+    do {
+      mpz_swap (u, t);                 /* u = x */
+      mpz_tdiv_q (t, y, u);            /* t = y/x */
+      mpz_add (t, t, u);               /* t = y/x + x */
+      mpz_tdiv_q_2exp (t, t, 1);       /* x'= (y/x + x)/2 */
+    } while (mpz_cmpabs (t, u) < 0);   /* |x'| < |x| */
+  else /* z != 2 */ {
+    mpz_t v;
+
+    mpz_init (v);
+    if (sgn)
+      mpz_neg (t, t);
+
+    do {
+      mpz_swap (u, t);                 /* u = x */
+      mpz_pow_ui (t, u, z - 1);                /* t = x^(z-1) */
+      mpz_tdiv_q (t, y, t);            /* t = y/x^(z-1) */
+      mpz_mul_ui (v, u, z - 1);                /* v = x*(z-1) */
+      mpz_add (t, t, v);               /* t = y/x^(z-1) + x*(z-1) */
+      mpz_tdiv_q_ui (t, t, z);         /* x'=(y/x^(z-1) + x*(z-1))/z */
+    } while (mpz_cmpabs (t, u) < 0);   /* |x'| < |x| */
+
+    mpz_clear (v);
+  }
+
+  if (r) {
+    mpz_pow_ui (t, u, z);
+    mpz_sub (r, y, t);
+  }
+  if (x)
+    mpz_swap (x, u);
+  mpz_clear (u);
+  mpz_clear (t);
+}
+
+int
+mpz_root (mpz_t x, const mpz_t y, unsigned long z)
+{
+  int res;
+  mpz_t r;
+
+  mpz_init (r);
+  mpz_rootrem (x, r, y, z);
+  res = r->_mp_size == 0;
+  mpz_clear (r);
+
+  return res;
+}
+
+/* Compute s = floor(sqrt(u)) and r = u - s^2. Allows r == NULL */
+void
+mpz_sqrtrem (mpz_t s, mpz_t r, const mpz_t u)
+{
+  mpz_rootrem (s, r, u, 2);
+}
+
+void
+mpz_sqrt (mpz_t s, const mpz_t u)
+{
+  mpz_rootrem (s, NULL, u, 2);
+}
+
+int
+mpz_perfect_square_p (const mpz_t u)
+{
+  if (u->_mp_size <= 0)
+    return (u->_mp_size == 0);
+  else
+    return mpz_root (NULL, u, 2);
+}
+
+int
+mpn_perfect_square_p (mp_srcptr p, mp_size_t n)
+{
+  mpz_t t;
+
+  assert (n > 0);
+  assert (p [n-1] != 0);
+  return mpz_root (NULL, mpz_roinit_normal_n (t, p, n), 2);
+}
+
+mp_size_t
+mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n)
+{
+  mpz_t s, r, u;
+  mp_size_t res;
+
+  assert (n > 0);
+  assert (p [n-1] != 0);
+
+  mpz_init (r);
+  mpz_init (s);
+  mpz_rootrem (s, r, mpz_roinit_normal_n (u, p, n), 2);
+
+  assert (s->_mp_size == (n+1)/2);
+  mpn_copyd (sp, s->_mp_d, s->_mp_size);
+  mpz_clear (s);
+  res = r->_mp_size;
+  if (rp)
+    mpn_copyd (rp, r->_mp_d, res);
+  mpz_clear (r);
+  return res;
+}
+\f
+/* Combinatorics */
+
+void
+mpz_mfac_uiui (mpz_t x, unsigned long n, unsigned long m)
+{
+  mpz_set_ui (x, n + (n == 0));
+  if (m + 1 < 2) return;
+  while (n > m + 1)
+    mpz_mul_ui (x, x, n -= m);
+}
+
+void
+mpz_2fac_ui (mpz_t x, unsigned long n)
+{
+  mpz_mfac_uiui (x, n, 2);
+}
+
+void
+mpz_fac_ui (mpz_t x, unsigned long n)
+{
+  mpz_mfac_uiui (x, n, 1);
+}
+
+void
+mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
+{
+  mpz_t t;
+
+  mpz_set_ui (r, k <= n);
+
+  if (k > (n >> 1))
+    k = (k <= n) ? n - k : 0;
+
+  mpz_init (t);
+  mpz_fac_ui (t, k);
+
+  for (; k > 0; --k)
+    mpz_mul_ui (r, r, n--);
+
+  mpz_divexact (r, r, t);
+  mpz_clear (t);
+}
+
+\f
+/* Primality testing */
+
+/* Computes Kronecker (a/b) with odd b, a!=0 and GCD(a,b) = 1 */
+/* Adapted from JACOBI_BASE_METHOD==4 in mpn/generic/jacbase.c */
+static int
+gmp_jacobi_coprime (mp_limb_t a, mp_limb_t b)
+{
+  int c, bit = 0;
+
+  assert (b & 1);
+  assert (a != 0);
+  /* assert (mpn_gcd_11 (a, b) == 1); */
+
+  /* Below, we represent a and b shifted right so that the least
+     significant one bit is implicit. */
+  b >>= 1;
+
+  gmp_ctz(c, a);
+  a >>= 1;
+
+  for (;;)
+    {
+      a >>= c;
+      /* (2/b) = -1 if b = 3 or 5 mod 8 */
+      bit ^= c & (b ^ (b >> 1));
+      if (a < b)
+       {
+         if (a == 0)
+           return bit & 1 ? -1 : 1;
+         bit ^= a & b;
+         a = b - a;
+         b -= a;
+       }
+      else
+       {
+         a -= b;
+         assert (a != 0);
+       }
+
+      gmp_ctz(c, a);
+      ++c;
+    }
+}
+
+static void
+gmp_lucas_step_k_2k (mpz_t V, mpz_t Qk, const mpz_t n)
+{
+  mpz_mod (Qk, Qk, n);
+  /* V_{2k} <- V_k ^ 2 - 2Q^k */
+  mpz_mul (V, V, V);
+  mpz_submul_ui (V, Qk, 2);
+  mpz_tdiv_r (V, V, n);
+  /* Q^{2k} = (Q^k)^2 */
+  mpz_mul (Qk, Qk, Qk);
+}
+
+/* Computes V_k, Q^k (mod n) for the Lucas' sequence */
+/* with P=1, Q=Q; k = (n>>b0)|1. */
+/* Requires an odd n > 4; b0 > 0; -2*Q must not overflow a long */
+/* Returns (U_k == 0) and sets V=V_k and Qk=Q^k. */
+static int
+gmp_lucas_mod (mpz_t V, mpz_t Qk, long Q,
+              mp_bitcnt_t b0, const mpz_t n)
+{
+  mp_bitcnt_t bs;
+  mpz_t U;
+  int res;
+
+  assert (b0 > 0);
+  assert (Q <= - (LONG_MIN / 2));
+  assert (Q >= - (LONG_MAX / 2));
+  assert (mpz_cmp_ui (n, 4) > 0);
+  assert (mpz_odd_p (n));
+
+  mpz_init_set_ui (U, 1); /* U1 = 1 */
+  mpz_set_ui (V, 1); /* V1 = 1 */
+  mpz_set_si (Qk, Q);
+
+  for (bs = mpz_sizeinbase (n, 2) - 1; --bs >= b0;)
+    {
+      /* U_{2k} <- U_k * V_k */
+      mpz_mul (U, U, V);
+      /* V_{2k} <- V_k ^ 2 - 2Q^k */
+      /* Q^{2k} = (Q^k)^2 */
+      gmp_lucas_step_k_2k (V, Qk, n);
+
+      /* A step k->k+1 is performed if the bit in $n$ is 1     */
+      /* mpz_tstbit(n,bs) or the bit is 0 in $n$ but   */
+      /* should be 1 in $n+1$ (bs == b0)                       */
+      if (b0 == bs || mpz_tstbit (n, bs))
+       {
+         /* Q^{k+1} <- Q^k * Q */
+         mpz_mul_si (Qk, Qk, Q);
+         /* U_{k+1} <- (U_k + V_k) / 2 */
+         mpz_swap (U, V); /* Keep in V the old value of U_k */
+         mpz_add (U, U, V);
+         /* We have to compute U/2, so we need an even value, */
+         /* equivalent (mod n) */
+         if (mpz_odd_p (U))
+           mpz_add (U, U, n);
+         mpz_tdiv_q_2exp (U, U, 1);
+         /* V_{k+1} <-(D*U_k + V_k) / 2 =
+                       U_{k+1} + (D-1)/2*U_k = U_{k+1} - 2Q*U_k */
+         mpz_mul_si (V, V, -2*Q);
+         mpz_add (V, U, V);
+         mpz_tdiv_r (V, V, n);
+       }
+      mpz_tdiv_r (U, U, n);
+    }
+
+  res = U->_mp_size == 0;
+  mpz_clear (U);
+  return res;
+}
+
+/* Performs strong Lucas' test on x, with parameters suggested */
+/* for the BPSW test. Qk is only passed to recycle a variable. */
+/* Requires GCD (x,6) = 1.*/
+static int
+gmp_stronglucas (const mpz_t x, mpz_t Qk)
+{
+  mp_bitcnt_t b0;
+  mpz_t V, n;
+  mp_limb_t maxD, D; /* The absolute value is stored. */
+  long Q;
+  mp_limb_t tl;
+
+  /* Test on the absolute value. */
+  mpz_roinit_normal_n (n, x->_mp_d, GMP_ABS (x->_mp_size));
+
+  assert (mpz_odd_p (n));
+  /* assert (mpz_gcd_ui (NULL, n, 6) == 1); */
+  if (mpz_root (Qk, n, 2))
+    return 0; /* A square is composite. */
+
+  /* Check Ds up to square root (in case, n is prime)
+     or avoid overflows */
+  maxD = (Qk->_mp_size == 1) ? Qk->_mp_d [0] - 1 : GMP_LIMB_MAX;
+
+  D = 3;
+  /* Search a D such that (D/n) = -1 in the sequence 5,-7,9,-11,.. */
+  /* For those Ds we have (D/n) = (n/|D|) */
+  do
+    {
+      if (D >= maxD)
+       return 1 + (D != GMP_LIMB_MAX); /* (1 + ! ~ D) */
+      D += 2;
+      tl = mpz_tdiv_ui (n, D);
+      if (tl == 0)
+       return 0;
+    }
+  while (gmp_jacobi_coprime (tl, D) == 1);
+
+  mpz_init (V);
+
+  /* n-(D/n) = n+1 = d*2^{b0}, with d = (n>>b0) | 1 */
+  b0 = mpn_common_scan (~ n->_mp_d[0], 0, n->_mp_d, n->_mp_size, GMP_LIMB_MAX);
+  /* b0 = mpz_scan0 (n, 0); */
+
+  /* D= P^2 - 4Q; P = 1; Q = (1-D)/4 */
+  Q = (D & 2) ? (long) (D >> 2) + 1 : -(long) (D >> 2);
+
+  if (! gmp_lucas_mod (V, Qk, Q, b0, n))       /* If Ud != 0 */
+    while (V->_mp_size != 0 && --b0 != 0)      /* while Vk != 0 */
+      /* V <- V ^ 2 - 2Q^k */
+      /* Q^{2k} = (Q^k)^2 */
+      gmp_lucas_step_k_2k (V, Qk, n);
+
+  mpz_clear (V);
+  return (b0 != 0);
+}
+
+static int
+gmp_millerrabin (const mpz_t n, const mpz_t nm1, mpz_t y,
+                const mpz_t q, mp_bitcnt_t k)
+{
+  assert (k > 0);
+
+  /* Caller must initialize y to the base. */
+  mpz_powm (y, y, q, n);
+
+  if (mpz_cmp_ui (y, 1) == 0 || mpz_cmp (y, nm1) == 0)
+    return 1;
+
+  while (--k > 0)
+    {
+      mpz_powm_ui (y, y, 2, n);
+      if (mpz_cmp (y, nm1) == 0)
+       return 1;
+    }
+  return 0;
+}
+
+/* This product is 0xc0cfd797, and fits in 32 bits. */
+#define GMP_PRIME_PRODUCT \
+  (3UL*5UL*7UL*11UL*13UL*17UL*19UL*23UL*29UL)
+
+/* Bit (p+1)/2 is set, for each odd prime <= 61 */
+#define GMP_PRIME_MASK 0xc96996dcUL
+
+int
+mpz_probab_prime_p (const mpz_t n, int reps)
+{
+  mpz_t nm1;
+  mpz_t q;
+  mpz_t y;
+  mp_bitcnt_t k;
+  int is_prime;
+  int j;
+
+  /* Note that we use the absolute value of n only, for compatibility
+     with the real GMP. */
+  if (mpz_even_p (n))
+    return (mpz_cmpabs_ui (n, 2) == 0) ? 2 : 0;
+
+  /* Above test excludes n == 0 */
+  assert (n->_mp_size != 0);
+
+  if (mpz_cmpabs_ui (n, 64) < 0)
+    return (GMP_PRIME_MASK >> (n->_mp_d[0] >> 1)) & 2;
+
+  if (mpz_gcd_ui (NULL, n, GMP_PRIME_PRODUCT) != 1)
+    return 0;
+
+  /* All prime factors are >= 31. */
+  if (mpz_cmpabs_ui (n, 31*31) < 0)
+    return 2;
+
+  mpz_init (nm1);
+  mpz_init (q);
+
+  /* Find q and k, where q is odd and n = 1 + 2**k * q.  */
+  mpz_abs (nm1, n);
+  nm1->_mp_d[0] -= 1;
+  /* Count trailing zeros, equivalent to mpn_scan1, because we know that there is a 1 */
+  k = mpn_scan1 (nm1->_mp_d, 0);
+  mpz_tdiv_q_2exp (q, nm1, k);
+
+  /* BPSW test */
+  mpz_init_set_ui (y, 2);
+  is_prime = gmp_millerrabin (n, nm1, y, q, k) && gmp_stronglucas (n, y);
+  reps -= 24; /* skip the first 24 repetitions */
+
+  /* Use Miller-Rabin, with a deterministic sequence of bases, a[j] =
+     j^2 + j + 41 using Euler's polynomial. We potentially stop early,
+     if a[j] >= n - 1. Since n >= 31*31, this can happen only if reps >
+     30 (a[30] == 971 > 31*31 == 961). */
+
+  for (j = 0; is_prime & (j < reps); j++)
+    {
+      mpz_set_ui (y, (unsigned long) j*j+j+41);
+      if (mpz_cmp (y, nm1) >= 0)
+       {
+         /* Don't try any further bases. This "early" break does not affect
+            the result for any reasonable reps value (<=5000 was tested) */
+         assert (j >= 30);
+         break;
+       }
+      is_prime = gmp_millerrabin (n, nm1, y, q, k);
+    }
+  mpz_clear (nm1);
+  mpz_clear (q);
+  mpz_clear (y);
+
+  return is_prime;
+}
+
+\f
+/* Logical operations and bit manipulation. */
+
+/* Numbers are treated as if represented in two's complement (and
+   infinitely sign extended). For a negative values we get the two's
+   complement from -x = ~x + 1, where ~ is bitwise complement.
+   Negation transforms
+
+     xxxx10...0
+
+   into
+
+     yyyy10...0
+
+   where yyyy is the bitwise complement of xxxx. So least significant
+   bits, up to and including the first one bit, are unchanged, and
+   the more significant bits are all complemented.
+
+   To change a bit from zero to one in a negative number, subtract the
+   corresponding power of two from the absolute value. This can never
+   underflow. To change a bit from one to zero, add the corresponding
+   power of two, and this might overflow. E.g., if x = -001111, the
+   two's complement is 110001. Clearing the least significant bit, we
+   get two's complement 110000, and -010000. */
+
+int
+mpz_tstbit (const mpz_t d, mp_bitcnt_t bit_index)
+{
+  mp_size_t limb_index;
+  unsigned shift;
+  mp_size_t ds;
+  mp_size_t dn;
+  mp_limb_t w;
+  int bit;
+
+  ds = d->_mp_size;
+  dn = GMP_ABS (ds);
+  limb_index = bit_index / GMP_LIMB_BITS;
+  if (limb_index >= dn)
+    return ds < 0;
+
+  shift = bit_index % GMP_LIMB_BITS;
+  w = d->_mp_d[limb_index];
+  bit = (w >> shift) & 1;
+
+  if (ds < 0)
+    {
+      /* d < 0. Check if any of the bits below is set: If so, our bit
+        must be complemented. */
+      if (shift > 0 && (mp_limb_t) (w << (GMP_LIMB_BITS - shift)) > 0)
+       return bit ^ 1;
+      while (--limb_index >= 0)
+       if (d->_mp_d[limb_index] > 0)
+         return bit ^ 1;
+    }
+  return bit;
+}
+
+static void
+mpz_abs_add_bit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  mp_size_t dn, limb_index;
+  mp_limb_t bit;
+  mp_ptr dp;
+
+  dn = GMP_ABS (d->_mp_size);
+
+  limb_index = bit_index / GMP_LIMB_BITS;
+  bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS);
+
+  if (limb_index >= dn)
+    {
+      mp_size_t i;
+      /* The bit should be set outside of the end of the number.
+        We have to increase the size of the number. */
+      dp = MPZ_REALLOC (d, limb_index + 1);
+
+      dp[limb_index] = bit;
+      for (i = dn; i < limb_index; i++)
+       dp[i] = 0;
+      dn = limb_index + 1;
+    }
+  else
+    {
+      mp_limb_t cy;
+
+      dp = d->_mp_d;
+
+      cy = mpn_add_1 (dp + limb_index, dp + limb_index, dn - limb_index, bit);
+      if (cy > 0)
+       {
+         dp = MPZ_REALLOC (d, dn + 1);
+         dp[dn++] = cy;
+       }
+    }
+
+  d->_mp_size = (d->_mp_size < 0) ? - dn : dn;
+}
+
+static void
+mpz_abs_sub_bit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  mp_size_t dn, limb_index;
+  mp_ptr dp;
+  mp_limb_t bit;
+
+  dn = GMP_ABS (d->_mp_size);
+  dp = d->_mp_d;
+
+  limb_index = bit_index / GMP_LIMB_BITS;
+  bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS);
+
+  assert (limb_index < dn);
+
+  gmp_assert_nocarry (mpn_sub_1 (dp + limb_index, dp + limb_index,
+                                dn - limb_index, bit));
+  dn = mpn_normalized_size (dp, dn);
+  d->_mp_size = (d->_mp_size < 0) ? - dn : dn;
+}
+
+void
+mpz_setbit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  if (!mpz_tstbit (d, bit_index))
+    {
+      if (d->_mp_size >= 0)
+       mpz_abs_add_bit (d, bit_index);
+      else
+       mpz_abs_sub_bit (d, bit_index);
+    }
+}
+
+void
+mpz_clrbit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  if (mpz_tstbit (d, bit_index))
+    {
+      if (d->_mp_size >= 0)
+       mpz_abs_sub_bit (d, bit_index);
+      else
+       mpz_abs_add_bit (d, bit_index);
+    }
+}
+
+void
+mpz_combit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  if (mpz_tstbit (d, bit_index) ^ (d->_mp_size < 0))
+    mpz_abs_sub_bit (d, bit_index);
+  else
+    mpz_abs_add_bit (d, bit_index);
+}
+
+void
+mpz_com (mpz_t r, const mpz_t u)
+{
+  mpz_add_ui (r, u, 1);
+  mpz_neg (r, r);
+}
+
+void
+mpz_and (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, rn, i;
+  mp_ptr up, vp, rp;
+
+  mp_limb_t ux, vx, rx;
+  mp_limb_t uc, vc, rc;
+  mp_limb_t ul, vl, rl;
+
+  un = GMP_ABS (u->_mp_size);
+  vn = GMP_ABS (v->_mp_size);
+  if (un < vn)
+    {
+      MPZ_SRCPTR_SWAP (u, v);
+      MP_SIZE_T_SWAP (un, vn);
+    }
+  if (vn == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  uc = u->_mp_size < 0;
+  vc = v->_mp_size < 0;
+  rc = uc & vc;
+
+  ux = -uc;
+  vx = -vc;
+  rx = -rc;
+
+  /* If the smaller input is positive, higher limbs don't matter. */
+  rn = vx ? un : vn;
+
+  rp = MPZ_REALLOC (r, rn + (mp_size_t) rc);
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  i = 0;
+  do
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ vx) + vc;
+      vc = vl < vc;
+
+      rl = ( (ul & vl) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  while (++i < vn);
+  assert (vc == 0);
+
+  for (; i < rn; i++)
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      rl = ( (ul & vx) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  if (rc)
+    rp[rn++] = rc;
+  else
+    rn = mpn_normalized_size (rp, rn);
+
+  r->_mp_size = rx ? -rn : rn;
+}
+
+void
+mpz_ior (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, rn, i;
+  mp_ptr up, vp, rp;
+
+  mp_limb_t ux, vx, rx;
+  mp_limb_t uc, vc, rc;
+  mp_limb_t ul, vl, rl;
+
+  un = GMP_ABS (u->_mp_size);
+  vn = GMP_ABS (v->_mp_size);
+  if (un < vn)
+    {
+      MPZ_SRCPTR_SWAP (u, v);
+      MP_SIZE_T_SWAP (un, vn);
+    }
+  if (vn == 0)
+    {
+      mpz_set (r, u);
+      return;
+    }
+
+  uc = u->_mp_size < 0;
+  vc = v->_mp_size < 0;
+  rc = uc | vc;
+
+  ux = -uc;
+  vx = -vc;
+  rx = -rc;
+
+  /* If the smaller input is negative, by sign extension higher limbs
+     don't matter. */
+  rn = vx ? vn : un;
+
+  rp = MPZ_REALLOC (r, rn + (mp_size_t) rc);
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  i = 0;
+  do
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ vx) + vc;
+      vc = vl < vc;
+
+      rl = ( (ul | vl) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  while (++i < vn);
+  assert (vc == 0);
+
+  for (; i < rn; i++)
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      rl = ( (ul | vx) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  if (rc)
+    rp[rn++] = rc;
+  else
+    rn = mpn_normalized_size (rp, rn);
+
+  r->_mp_size = rx ? -rn : rn;
+}
+
+void
+mpz_xor (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, i;
+  mp_ptr up, vp, rp;
+
+  mp_limb_t ux, vx, rx;
+  mp_limb_t uc, vc, rc;
+  mp_limb_t ul, vl, rl;
+
+  un = GMP_ABS (u->_mp_size);
+  vn = GMP_ABS (v->_mp_size);
+  if (un < vn)
+    {
+      MPZ_SRCPTR_SWAP (u, v);
+      MP_SIZE_T_SWAP (un, vn);
+    }
+  if (vn == 0)
+    {
+      mpz_set (r, u);
+      return;
+    }
+
+  uc = u->_mp_size < 0;
+  vc = v->_mp_size < 0;
+  rc = uc ^ vc;
+
+  ux = -uc;
+  vx = -vc;
+  rx = -rc;
+
+  rp = MPZ_REALLOC (r, un + (mp_size_t) rc);
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  i = 0;
+  do
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ vx) + vc;
+      vc = vl < vc;
+
+      rl = (ul ^ vl ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  while (++i < vn);
+  assert (vc == 0);
+
+  for (; i < un; i++)
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      rl = (ul ^ ux) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  if (rc)
+    rp[un++] = rc;
+  else
+    un = mpn_normalized_size (rp, un);
+
+  r->_mp_size = rx ? -un : un;
+}
+
+static unsigned
+gmp_popcount_limb (mp_limb_t x)
+{
+  unsigned c;
+
+  /* Do 16 bits at a time, to avoid limb-sized constants. */
+  int LOCAL_SHIFT_BITS = 16;
+  for (c = 0; x > 0;)
+    {
+      unsigned w = x - ((x >> 1) & 0x5555);
+      w = ((w >> 2) & 0x3333) + (w & 0x3333);
+      w =  (w >> 4) + w;
+      w = ((w >> 8) & 0x000f) + (w & 0x000f);
+      c += w;
+      if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
+       x >>= LOCAL_SHIFT_BITS;
+      else
+       x = 0;
+    }
+  return c;
+}
+
+mp_bitcnt_t
+mpn_popcount (mp_srcptr p, mp_size_t n)
+{
+  mp_size_t i;
+  mp_bitcnt_t c;
+
+  for (c = 0, i = 0; i < n; i++)
+    c += gmp_popcount_limb (p[i]);
+
+  return c;
+}
+
+mp_bitcnt_t
+mpz_popcount (const mpz_t u)
+{
+  mp_size_t un;
+
+  un = u->_mp_size;
+
+  if (un < 0)
+    return ~(mp_bitcnt_t) 0;
+
+  return mpn_popcount (u->_mp_d, un);
+}
+
+mp_bitcnt_t
+mpz_hamdist (const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, i;
+  mp_limb_t uc, vc, ul, vl, comp;
+  mp_srcptr up, vp;
+  mp_bitcnt_t c;
+
+  un = u->_mp_size;
+  vn = v->_mp_size;
+
+  if ( (un ^ vn) < 0)
+    return ~(mp_bitcnt_t) 0;
+
+  comp = - (uc = vc = (un < 0));
+  if (uc)
+    {
+      assert (vn < 0);
+      un = -un;
+      vn = -vn;
+    }
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  if (un < vn)
+    MPN_SRCPTR_SWAP (up, un, vp, vn);
+
+  for (i = 0, c = 0; i < vn; i++)
+    {
+      ul = (up[i] ^ comp) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ comp) + vc;
+      vc = vl < vc;
+
+      c += gmp_popcount_limb (ul ^ vl);
+    }
+  assert (vc == 0);
+
+  for (; i < un; i++)
+    {
+      ul = (up[i] ^ comp) + uc;
+      uc = ul < uc;
+
+      c += gmp_popcount_limb (ul ^ comp);
+    }
+
+  return c;
+}
+
+mp_bitcnt_t
+mpz_scan1 (const mpz_t u, mp_bitcnt_t starting_bit)
+{
+  mp_ptr up;
+  mp_size_t us, un, i;
+  mp_limb_t limb, ux;
+
+  us = u->_mp_size;
+  un = GMP_ABS (us);
+  i = starting_bit / GMP_LIMB_BITS;
+
+  /* Past the end there's no 1 bits for u>=0, or an immediate 1 bit
+     for u<0. Notice this test picks up any u==0 too. */
+  if (i >= un)
+    return (us >= 0 ? ~(mp_bitcnt_t) 0 : starting_bit);
+
+  up = u->_mp_d;
+  ux = 0;
+  limb = up[i];
+
+  if (starting_bit != 0)
+    {
+      if (us < 0)
+       {
+         ux = mpn_zero_p (up, i);
+         limb = ~ limb + ux;
+         ux = - (mp_limb_t) (limb >= ux);
+       }
+
+      /* Mask to 0 all bits before starting_bit, thus ignoring them. */
+      limb &= GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS);
+    }
+
+  return mpn_common_scan (limb, i, up, un, ux);
+}
+
+mp_bitcnt_t
+mpz_scan0 (const mpz_t u, mp_bitcnt_t starting_bit)
+{
+  mp_ptr up;
+  mp_size_t us, un, i;
+  mp_limb_t limb, ux;
+
+  us = u->_mp_size;
+  ux = - (mp_limb_t) (us >= 0);
+  un = GMP_ABS (us);
+  i = starting_bit / GMP_LIMB_BITS;
+
+  /* When past end, there's an immediate 0 bit for u>=0, or no 0 bits for
+     u<0.  Notice this test picks up all cases of u==0 too. */
+  if (i >= un)
+    return (ux ? starting_bit : ~(mp_bitcnt_t) 0);
+
+  up = u->_mp_d;
+  limb = up[i] ^ ux;
+
+  if (ux == 0)
+    limb -= mpn_zero_p (up, i); /* limb = ~(~limb + zero_p) */
+
+  /* Mask all bits before starting_bit, thus ignoring them. */
+  limb &= GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS);
+
+  return mpn_common_scan (limb, i, up, un, ux);
+}
+
+\f
+/* MPZ base conversion. */
+
+size_t
+mpz_sizeinbase (const mpz_t u, int base)
+{
+  mp_size_t un, tn;
+  mp_srcptr up;
+  mp_ptr tp;
+  mp_bitcnt_t bits;
+  struct gmp_div_inverse bi;
+  size_t ndigits;
+
+  assert (base >= 2);
+  assert (base <= 62);
+
+  un = GMP_ABS (u->_mp_size);
+  if (un == 0)
+    return 1;
+
+  up = u->_mp_d;
+
+  bits = (un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1]);
+  switch (base)
+    {
+    case 2:
+      return bits;
+    case 4:
+      return (bits + 1) / 2;
+    case 8:
+      return (bits + 2) / 3;
+    case 16:
+      return (bits + 3) / 4;
+    case 32:
+      return (bits + 4) / 5;
+      /* FIXME: Do something more clever for the common case of base
+        10. */
+    }
+
+  tp = gmp_alloc_limbs (un);
+  mpn_copyi (tp, up, un);
+  mpn_div_qr_1_invert (&bi, base);
+
+  tn = un;
+  ndigits = 0;
+  do
+    {
+      ndigits++;
+      mpn_div_qr_1_preinv (tp, tp, tn, &bi);
+      tn -= (tp[tn-1] == 0);
+    }
+  while (tn > 0);
+
+  gmp_free_limbs (tp, un);
+  return ndigits;
+}
+
+char *
+mpz_get_str (char *sp, int base, const mpz_t u)
+{
+  unsigned bits;
+  const char *digits;
+  mp_size_t un;
+  size_t i, sn, osn;
+
+  digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+  if (base > 1)
+    {
+      if (base <= 36)
+       digits = "0123456789abcdefghijklmnopqrstuvwxyz";
+      else if (base > 62)
+       return NULL;
+    }
+  else if (base >= -1)
+    base = 10;
+  else
+    {
+      base = -base;
+      if (base > 36)
+       return NULL;
+    }
+
+  sn = 1 + mpz_sizeinbase (u, base);
+  if (!sp)
+    {
+      osn = 1 + sn;
+      sp = (char *) gmp_alloc (osn);
+    }
+  else
+    osn = 0;
+  un = GMP_ABS (u->_mp_size);
+
+  if (un == 0)
+    {
+      sp[0] = '0';
+      sn = 1;
+      goto ret;
+    }
+
+  i = 0;
+
+  if (u->_mp_size < 0)
+    sp[i++] = '-';
+
+  bits = mpn_base_power_of_two_p (base);
+
+  if (bits)
+    /* Not modified in this case. */
+    sn = i + mpn_get_str_bits ((unsigned char *) sp + i, bits, u->_mp_d, un);
+  else
+    {
+      struct mpn_base_info info;
+      mp_ptr tp;
+
+      mpn_get_base_info (&info, base);
+      tp = gmp_alloc_limbs (un);
+      mpn_copyi (tp, u->_mp_d, un);
+
+      sn = i + mpn_get_str_other ((unsigned char *) sp + i, base, &info, tp, un);
+      gmp_free_limbs (tp, un);
+    }
+
+  for (; i < sn; i++)
+    sp[i] = digits[(unsigned char) sp[i]];
+
+ret:
+  sp[sn] = '\0';
+  if (osn && osn != sn + 1)
+    sp = (char*) gmp_realloc (sp, osn, sn + 1);
+  return sp;
+}
+
+int
+mpz_set_str (mpz_t r, const char *sp, int base)
+{
+  unsigned bits, value_of_a;
+  mp_size_t rn, alloc;
+  mp_ptr rp;
+  size_t dn, sn;
+  int sign;
+  unsigned char *dp;
+
+  assert (base == 0 || (base >= 2 && base <= 62));
+
+  while (isspace( (unsigned char) *sp))
+    sp++;
+
+  sign = (*sp == '-');
+  sp += sign;
+
+  if (base == 0)
+    {
+      if (sp[0] == '0')
+       {
+         if (sp[1] == 'x' || sp[1] == 'X')
+           {
+             base = 16;
+             sp += 2;
+           }
+         else if (sp[1] == 'b' || sp[1] == 'B')
+           {
+             base = 2;
+             sp += 2;
+           }
+         else
+           base = 8;
+       }
+      else
+       base = 10;
+    }
+
+  if (!*sp)
+    {
+      r->_mp_size = 0;
+      return -1;
+    }
+  sn = strlen(sp);
+  dp = (unsigned char *) gmp_alloc (sn);
+
+  value_of_a = (base > 36) ? 36 : 10;
+  for (dn = 0; *sp; sp++)
+    {
+      unsigned digit;
+
+      if (isspace ((unsigned char) *sp))
+       continue;
+      else if (*sp >= '0' && *sp <= '9')
+       digit = *sp - '0';
+      else if (*sp >= 'a' && *sp <= 'z')
+       digit = *sp - 'a' + value_of_a;
+      else if (*sp >= 'A' && *sp <= 'Z')
+       digit = *sp - 'A' + 10;
+      else
+       digit = base; /* fail */
+
+      if (digit >= (unsigned) base)
+       {
+         gmp_free (dp, sn);
+         r->_mp_size = 0;
+         return -1;
+       }
+
+      dp[dn++] = digit;
+    }
+
+  if (!dn)
+    {
+      gmp_free (dp, sn);
+      r->_mp_size = 0;
+      return -1;
+    }
+  bits = mpn_base_power_of_two_p (base);
+
+  if (bits > 0)
+    {
+      alloc = (dn * bits + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+      rp = MPZ_REALLOC (r, alloc);
+      rn = mpn_set_str_bits (rp, dp, dn, bits);
+    }
+  else
+    {
+      struct mpn_base_info info;
+      mpn_get_base_info (&info, base);
+      alloc = (dn + info.exp - 1) / info.exp;
+      rp = MPZ_REALLOC (r, alloc);
+      rn = mpn_set_str_other (rp, dp, dn, base, &info);
+      /* Normalization, needed for all-zero input. */
+      assert (rn > 0);
+      rn -= rp[rn-1] == 0;
+    }
+  assert (rn <= alloc);
+  gmp_free (dp, sn);
+
+  r->_mp_size = sign ? - rn : rn;
+
+  return 0;
+}
+
+int
+mpz_init_set_str (mpz_t r, const char *sp, int base)
+{
+  mpz_init (r);
+  return mpz_set_str (r, sp, base);
+}
+
+size_t
+mpz_out_str (FILE *stream, int base, const mpz_t x)
+{
+  char *str;
+  size_t len, n;
+
+  str = mpz_get_str (NULL, base, x);
+  if (!str)
+    return 0;
+  len = strlen (str);
+  n = fwrite (str, 1, len, stream);
+  gmp_free (str, len + 1);
+  return n;
+}
+
+\f
+static int
+gmp_detect_endian (void)
+{
+  static const int i = 2;
+  const unsigned char *p = (const unsigned char *) &i;
+  return 1 - *p;
+}
+
+/* Import and export. Does not support nails. */
+void
+mpz_import (mpz_t r, size_t count, int order, size_t size, int endian,
+           size_t nails, const void *src)
+{
+  const unsigned char *p;
+  ptrdiff_t word_step;
+  mp_ptr rp;
+  mp_size_t rn;
+
+  /* The current (partial) limb. */
+  mp_limb_t limb;
+  /* The number of bytes already copied to this limb (starting from
+     the low end). */
+  size_t bytes;
+  /* The index where the limb should be stored, when completed. */
+  mp_size_t i;
+
+  if (nails != 0)
+    gmp_die ("mpz_import: Nails not supported.");
+
+  assert (order == 1 || order == -1);
+  assert (endian >= -1 && endian <= 1);
+
+  if (endian == 0)
+    endian = gmp_detect_endian ();
+
+  p = (unsigned char *) src;
+
+  word_step = (order != endian) ? 2 * size : 0;
+
+  /* Process bytes from the least significant end, so point p at the
+     least significant word. */
+  if (order == 1)
+    {
+      p += size * (count - 1);
+      word_step = - word_step;
+    }
+
+  /* And at least significant byte of that word. */
+  if (endian == 1)
+    p += (size - 1);
+
+  rn = (size * count + sizeof(mp_limb_t) - 1) / sizeof(mp_limb_t);
+  rp = MPZ_REALLOC (r, rn);
+
+  for (limb = 0, bytes = 0, i = 0; count > 0; count--, p += word_step)
+    {
+      size_t j;
+      for (j = 0; j < size; j++, p -= (ptrdiff_t) endian)
+       {
+         limb |= (mp_limb_t) *p << (bytes++ * CHAR_BIT);
+         if (bytes == sizeof(mp_limb_t))
+           {
+             rp[i++] = limb;
+             bytes = 0;
+             limb = 0;
+           }
+       }
+    }
+  assert (i + (bytes > 0) == rn);
+  if (limb != 0)
+    rp[i++] = limb;
+  else
+    i = mpn_normalized_size (rp, i);
+
+  r->_mp_size = i;
+}
+
+void *
+mpz_export (void *r, size_t *countp, int order, size_t size, int endian,
+           size_t nails, const mpz_t u)
+{
+  size_t count;
+  mp_size_t un;
+
+  if (nails != 0)
+    gmp_die ("mpz_export: Nails not supported.");
+
+  assert (order == 1 || order == -1);
+  assert (endian >= -1 && endian <= 1);
+  assert (size > 0 || u->_mp_size == 0);
+
+  un = u->_mp_size;
+  count = 0;
+  if (un != 0)
+    {
+      size_t k;
+      unsigned char *p;
+      ptrdiff_t word_step;
+      /* The current (partial) limb. */
+      mp_limb_t limb;
+      /* The number of bytes left to do in this limb. */
+      size_t bytes;
+      /* The index where the limb was read. */
+      mp_size_t i;
+
+      un = GMP_ABS (un);
+
+      /* Count bytes in top limb. */
+      limb = u->_mp_d[un-1];
+      assert (limb != 0);
+
+      k = (GMP_LIMB_BITS <= CHAR_BIT);
+      if (!k)
+       {
+         do {
+           int LOCAL_CHAR_BIT = CHAR_BIT;
+           k++; limb >>= LOCAL_CHAR_BIT;
+         } while (limb != 0);
+       }
+      /* else limb = 0; */
+
+      count = (k + (un-1) * sizeof (mp_limb_t) + size - 1) / size;
+
+      if (!r)
+       r = gmp_alloc (count * size);
+
+      if (endian == 0)
+       endian = gmp_detect_endian ();
+
+      p = (unsigned char *) r;
+
+      word_step = (order != endian) ? 2 * size : 0;
+
+      /* Process bytes from the least significant end, so point p at the
+        least significant word. */
+      if (order == 1)
+       {
+         p += size * (count - 1);
+         word_step = - word_step;
+       }
+
+      /* And at least significant byte of that word. */
+      if (endian == 1)
+       p += (size - 1);
+
+      for (bytes = 0, i = 0, k = 0; k < count; k++, p += word_step)
+       {
+         size_t j;
+         for (j = 0; j < size; ++j, p -= (ptrdiff_t) endian)
+           {
+             if (sizeof (mp_limb_t) == 1)
+               {
+                 if (i < un)
+                   *p = u->_mp_d[i++];
+                 else
+                   *p = 0;
+               }
+             else
+               {
+                 int LOCAL_CHAR_BIT = CHAR_BIT;
+                 if (bytes == 0)
+                   {
+                     if (i < un)
+                       limb = u->_mp_d[i++];
+                     bytes = sizeof (mp_limb_t);
+                   }
+                 *p = limb;
+                 limb >>= LOCAL_CHAR_BIT;
+                 bytes--;
+               }
+           }
+       }
+      assert (i == un);
+      assert (k == count);
+    }
+
+  if (countp)
+    *countp = count;
+
+  return r;
+}
deleted file mode 120000 (symlink)
index 2afa7cca1bd5b116349a223516fba6002337de71..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mini-gmp.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..59c24cf5111644d17770ed6ee08dccce7c0e4338
--- /dev/null
@@ -0,0 +1,310 @@
+/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
+
+Copyright 2011-2015, 2017, 2019-2021 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+  * the GNU Lesser General Public License as published by the Free
+    Software Foundation; either version 3 of the License, or (at your
+    option) any later version.
+
+or
+
+  * the GNU General Public License as published by the Free Software
+    Foundation; either version 2 of the License, or (at your option) any
+    later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
+
+/* About mini-gmp: This is a minimal implementation of a subset of the
+   GMP interface. It is intended for inclusion into applications which
+   have modest bignums needs, as a fallback when the real GMP library
+   is not installed.
+
+   This file defines the public interface. */
+
+#ifndef __MINI_GMP_H__
+#define __MINI_GMP_H__
+
+/* For size_t */
+#include <stddef.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+void mp_set_memory_functions (void *(*) (size_t),
+                             void *(*) (void *, size_t, size_t),
+                             void (*) (void *, size_t));
+
+void mp_get_memory_functions (void *(**) (size_t),
+                             void *(**) (void *, size_t, size_t),
+                             void (**) (void *, size_t));
+
+#ifndef MINI_GMP_LIMB_TYPE
+#define MINI_GMP_LIMB_TYPE long
+#endif
+
+typedef unsigned MINI_GMP_LIMB_TYPE mp_limb_t;
+typedef long mp_size_t;
+typedef unsigned long mp_bitcnt_t;
+
+typedef mp_limb_t *mp_ptr;
+typedef const mp_limb_t *mp_srcptr;
+
+typedef struct
+{
+  int _mp_alloc;               /* Number of *limbs* allocated and pointed
+                                  to by the _mp_d field.  */
+  int _mp_size;                        /* abs(_mp_size) is the number of limbs the
+                                  last field points to.  If _mp_size is
+                                  negative this is a negative number.  */
+  mp_limb_t *_mp_d;            /* Pointer to the limbs.  */
+} __mpz_struct;
+
+typedef __mpz_struct mpz_t[1];
+
+typedef __mpz_struct *mpz_ptr;
+typedef const __mpz_struct *mpz_srcptr;
+
+extern const int mp_bits_per_limb;
+
+void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
+void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
+void mpn_zero (mp_ptr, mp_size_t);
+
+int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t);
+int mpn_zero_p (mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+
+mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
+int mpn_perfect_square_p (mp_srcptr, mp_size_t);
+mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+
+mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t);
+mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t);
+
+void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
+
+mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_invert_3by2 (mp_limb_t, mp_limb_t);
+#define mpn_invert_limb(x) mpn_invert_3by2 ((x), 0)
+
+size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
+mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
+
+void mpz_init (mpz_t);
+void mpz_init2 (mpz_t, mp_bitcnt_t);
+void mpz_clear (mpz_t);
+
+#define mpz_odd_p(z)   (((z)->_mp_size != 0) & (int) (z)->_mp_d[0])
+#define mpz_even_p(z)  (! mpz_odd_p (z))
+
+int mpz_sgn (const mpz_t);
+int mpz_cmp_si (const mpz_t, long);
+int mpz_cmp_ui (const mpz_t, unsigned long);
+int mpz_cmp (const mpz_t, const mpz_t);
+int mpz_cmpabs_ui (const mpz_t, unsigned long);
+int mpz_cmpabs (const mpz_t, const mpz_t);
+int mpz_cmp_d (const mpz_t, double);
+int mpz_cmpabs_d (const mpz_t, double);
+
+void mpz_abs (mpz_t, const mpz_t);
+void mpz_neg (mpz_t, const mpz_t);
+void mpz_swap (mpz_t, mpz_t);
+
+void mpz_add_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_add (mpz_t, const mpz_t, const mpz_t);
+void mpz_sub_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_ui_sub (mpz_t, unsigned long, const mpz_t);
+void mpz_sub (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_mul_si (mpz_t, const mpz_t, long int);
+void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_mul (mpz_t, const mpz_t, const mpz_t);
+void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_addmul (mpz_t, const mpz_t, const mpz_t);
+void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_submul (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_fdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_tdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_cdiv_q (mpz_t, const mpz_t, const mpz_t);
+void mpz_fdiv_q (mpz_t, const mpz_t, const mpz_t);
+void mpz_tdiv_q (mpz_t, const mpz_t, const mpz_t);
+void mpz_cdiv_r (mpz_t, const mpz_t, const mpz_t);
+void mpz_fdiv_r (mpz_t, const mpz_t, const mpz_t);
+void mpz_tdiv_r (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_cdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_fdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_tdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_cdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_fdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_tdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+
+void mpz_mod (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_divexact (mpz_t, const mpz_t, const mpz_t);
+
+int mpz_divisible_p (const mpz_t, const mpz_t);
+int mpz_congruent_p (const mpz_t, const mpz_t, const mpz_t);
+
+unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_cdiv_ui (const mpz_t, unsigned long);
+unsigned long mpz_fdiv_ui (const mpz_t, unsigned long);
+unsigned long mpz_tdiv_ui (const mpz_t, unsigned long);
+
+unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long);
+
+void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long);
+
+int mpz_divisible_ui_p (const mpz_t, unsigned long);
+
+unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_gcd (mpz_t, const mpz_t, const mpz_t);
+void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_lcm (mpz_t, const mpz_t, const mpz_t);
+int mpz_invert (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t);
+void mpz_sqrt (mpz_t, const mpz_t);
+int mpz_perfect_square_p (const mpz_t);
+
+void mpz_pow_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long);
+void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t);
+void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t);
+
+void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long);
+int mpz_root (mpz_t, const mpz_t, unsigned long);
+
+void mpz_fac_ui (mpz_t, unsigned long);
+void mpz_2fac_ui (mpz_t, unsigned long);
+void mpz_mfac_uiui (mpz_t, unsigned long, unsigned long);
+void mpz_bin_uiui (mpz_t, unsigned long, unsigned long);
+
+int mpz_probab_prime_p (const mpz_t, int);
+
+int mpz_tstbit (const mpz_t, mp_bitcnt_t);
+void mpz_setbit (mpz_t, mp_bitcnt_t);
+void mpz_clrbit (mpz_t, mp_bitcnt_t);
+void mpz_combit (mpz_t, mp_bitcnt_t);
+
+void mpz_com (mpz_t, const mpz_t);
+void mpz_and (mpz_t, const mpz_t, const mpz_t);
+void mpz_ior (mpz_t, const mpz_t, const mpz_t);
+void mpz_xor (mpz_t, const mpz_t, const mpz_t);
+
+mp_bitcnt_t mpz_popcount (const mpz_t);
+mp_bitcnt_t mpz_hamdist (const mpz_t, const mpz_t);
+mp_bitcnt_t mpz_scan0 (const mpz_t, mp_bitcnt_t);
+mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t);
+
+int mpz_fits_slong_p (const mpz_t);
+int mpz_fits_ulong_p (const mpz_t);
+int mpz_fits_sint_p (const mpz_t);
+int mpz_fits_uint_p (const mpz_t);
+int mpz_fits_sshort_p (const mpz_t);
+int mpz_fits_ushort_p (const mpz_t);
+long int mpz_get_si (const mpz_t);
+unsigned long int mpz_get_ui (const mpz_t);
+double mpz_get_d (const mpz_t);
+size_t mpz_size (const mpz_t);
+mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t);
+
+void mpz_realloc2 (mpz_t, mp_bitcnt_t);
+mp_srcptr mpz_limbs_read (mpz_srcptr);
+mp_ptr mpz_limbs_modify (mpz_t, mp_size_t);
+mp_ptr mpz_limbs_write (mpz_t, mp_size_t);
+void mpz_limbs_finish (mpz_t, mp_size_t);
+mpz_srcptr mpz_roinit_n (mpz_t, mp_srcptr, mp_size_t);
+
+#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
+
+void mpz_set_si (mpz_t, signed long int);
+void mpz_set_ui (mpz_t, unsigned long int);
+void mpz_set (mpz_t, const mpz_t);
+void mpz_set_d (mpz_t, double);
+
+void mpz_init_set_si (mpz_t, signed long int);
+void mpz_init_set_ui (mpz_t, unsigned long int);
+void mpz_init_set (mpz_t, const mpz_t);
+void mpz_init_set_d (mpz_t, double);
+
+size_t mpz_sizeinbase (const mpz_t, int);
+char *mpz_get_str (char *, int, const mpz_t);
+int mpz_set_str (mpz_t, const char *, int);
+int mpz_init_set_str (mpz_t, const char *, int);
+
+/* This long list taken from gmp.h. */
+/* For reference, "defined(EOF)" cannot be used here.  In g++ 2.95.4,
+   <iostream> defines EOF but not FILE.  */
+#if defined (FILE)                                              \
+  || defined (H_STDIO)                                          \
+  || defined (_H_STDIO)               /* AIX */                 \
+  || defined (_STDIO_H)               /* glibc, Sun, SCO */     \
+  || defined (_STDIO_H_)              /* BSD, OSF */            \
+  || defined (__STDIO_H)              /* Borland */             \
+  || defined (__STDIO_H__)            /* IRIX */                \
+  || defined (_STDIO_INCLUDED)        /* HPUX */                \
+  || defined (__dj_include_stdio_h_)  /* DJGPP */               \
+  || defined (_FILE_DEFINED)          /* Microsoft */           \
+  || defined (__STDIO__)              /* Apple MPW MrC */       \
+  || defined (_MSL_STDIO_H)           /* Metrowerks */          \
+  || defined (_STDIO_H_INCLUDED)      /* QNX4 */               \
+  || defined (_ISO_STDIO_ISO_H)       /* Sun C++ */            \
+  || defined (__STDIO_LOADED)         /* VMS */                        \
+  || defined (_STDIO)                 /* HPE NonStop */         \
+  || defined (__DEFINED_FILE)         /* musl */
+size_t mpz_out_str (FILE *, int, const mpz_t);
+#endif
+
+void mpz_import (mpz_t, size_t, int, size_t, int, size_t, const void *);
+void *mpz_export (void *, size_t *, int, size_t, int, size_t, const mpz_t);
+
+#if defined (__cplusplus)
+}
+#endif
+#endif /* __MINI_GMP_H__ */
deleted file mode 120000 (symlink)
index d68d98b8da73f3642fdcd25bded37fd9938732cc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/minmax.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f3df58b0d706deb8c8c2b1b2a92586acd0b321c5
--- /dev/null
@@ -0,0 +1,65 @@
+/* MIN, MAX macros.
+   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _MINMAX_H
+#define _MINMAX_H
+
+/* Note: MIN, MAX are also defined in <sys/param.h> on some systems
+   (glibc, IRIX, HP-UX, OSF/1).  Therefore you might get warnings about
+   MIN, MAX macro redefinitions on some systems; the workaround is to
+   #include this file as the last one among the #include list.  */
+
+/* This file uses HAVE_MINMAX_IN_LIMITS_H, HAVE_MINMAX_IN_SYS_PARAM_H.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Before we define the following symbols we get the <limits.h> file
+   since otherwise we get redefinitions on some systems if <limits.h> is
+   included after this file.  Likewise for <sys/param.h>.
+   If more than one of these system headers define MIN and MAX, pick just
+   one of the headers (because the definitions most likely are the same).  */
+#if HAVE_MINMAX_IN_LIMITS_H
+# include <limits.h>
+#elif HAVE_MINMAX_IN_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+/* Note: MIN and MAX should be used with two arguments of the
+   same type.  They might not return the minimum and maximum of their two
+   arguments, if the arguments have different types or have unusual
+   floating-point values.  For example, on a typical host with 32-bit 'int',
+   64-bit 'long long', and 64-bit IEEE 754 'double' types:
+
+     MAX (-1, 2147483648) returns 4294967295.
+     MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0.
+     MAX (NaN, 0.0) returns 0.0.
+     MAX (+0.0, -0.0) returns -0.0.
+
+   and in each case the answer is in some sense bogus.  */
+
+/* MAX(a,b) returns the maximum of A and B.  */
+#ifndef MAX
+# define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+/* MIN(a,b) returns the minimum of A and B.  */
+#ifndef MIN
+# define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#endif /* _MINMAX_H */
deleted file mode 120000 (symlink)
index 1a5eddfb9e9774f21ae720f1b9eae5b9680a7c69..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkancesdirs.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..34312552d5a9759c31d19927c9f4e47196e1448b
--- /dev/null
@@ -0,0 +1,141 @@
+/* Make a file's ancestor directories.
+
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "mkancesdirs.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "filename.h"
+#include "savewd.h"
+
+/* Ensure that the ancestor directories of FILE exist, using an
+   algorithm that should work even if two processes execute this
+   function in parallel.  Modify FILE as necessary to access the
+   ancestor directories, but restore FILE to an equivalent value
+   if successful.
+
+   WD points to the working directory, using the conventions of
+   savewd.
+
+   Create any ancestor directories that don't already exist, by
+   invoking MAKE_DIR (FILE, COMPONENT, MAKE_DIR_ARG).  This function
+   should return 0 if successful, -1 (setting errno) otherwise.  If
+   COMPONENT is relative, it is relative to the temporary working
+   directory, which may differ from *WD.
+
+   Ordinarily MAKE_DIR is executed with the working directory changed
+   to reflect the already-made prefix, and mkancesdirs returns with
+   the working directory changed a prefix of FILE.  However, if the
+   initial working directory cannot be saved in a file descriptor,
+   MAKE_DIR is invoked in a subprocess and this function returns in
+   both the parent and child process, so the caller should not assume
+   any changed state survives other than the EXITMAX component of WD,
+   and the caller should take care that the parent does not attempt to
+   do the work that the child is doing.
+
+   If successful and if this process can go ahead and create FILE,
+   return the length of the prefix of FILE that has already been made.
+   If successful so far but a child process is doing the actual work,
+   return -2.  If unsuccessful, return -1 and set errno.  */
+
+ptrdiff_t
+mkancesdirs (char *file, struct savewd *wd,
+             int (*make_dir) (char const *, char const *, void *),
+             void *make_dir_arg)
+{
+  /* Address of the previous directory separator that follows an
+     ordinary byte in a file name in the left-to-right scan, or NULL
+     if no such separator precedes the current location P.  */
+  char *sep = NULL;
+
+  /* Address of the leftmost file name component that has not yet
+     been processed.  */
+  char *component = file;
+
+  char *p = file + FILE_SYSTEM_PREFIX_LEN (file);
+  char c;
+  bool made_dir = false;
+
+  /* Scan forward through FILE, creating and chdiring into directories
+     along the way.  Try MAKE_DIR before chdir, so that the procedure
+     works even when two or more processes are executing it in
+     parallel.  Isolate each file name component by having COMPONENT
+     point to its start and SEP point just after its end.  */
+
+  while ((c = *p++))
+    if (ISSLASH (*p))
+      {
+        if (! ISSLASH (c))
+          sep = p;
+      }
+    else if (ISSLASH (c) && *p && sep)
+      {
+        /* Don't bother to make or test for "." since it does not
+           affect the algorithm.  */
+        if (! (sep - component == 1 && component[0] == '.'))
+          {
+            int make_dir_errno = 0;
+            int savewd_chdir_options = 0;
+            int chdir_result;
+
+            /* Temporarily modify FILE to isolate this file name
+               component.  */
+            *sep = '\0';
+
+            /* Invoke MAKE_DIR on this component, except don't bother
+               with ".." since it must exist if its "parent" does.  */
+            if (sep - component == 2
+                && component[0] == '.' && component[1] == '.')
+              made_dir = false;
+            else if (make_dir (file, component, make_dir_arg) < 0)
+              make_dir_errno = errno;
+            else
+              made_dir = true;
+
+            if (made_dir)
+              savewd_chdir_options |= SAVEWD_CHDIR_NOFOLLOW;
+
+            chdir_result =
+              savewd_chdir (wd, component, savewd_chdir_options, NULL);
+
+            /* Undo the temporary modification to FILE, unless there
+               was a failure.  */
+            if (chdir_result != -1)
+              *sep = '/';
+
+            if (chdir_result != 0)
+              {
+                if (make_dir_errno != 0 && errno == ENOENT)
+                  errno = make_dir_errno;
+                return chdir_result;
+              }
+          }
+
+        component = p;
+      }
+
+  return component - file;
+}
deleted file mode 120000 (symlink)
index 3c0550d57a2f97951a44619bd7de6d29a20183ba..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkancesdirs.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3024083307e8429bfef3894b42a2fa3dc19890fe
--- /dev/null
@@ -0,0 +1,31 @@
+/* Ensure the existence of the ancestor directories of a file.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, 2006.  */
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct savewd;
+ptrdiff_t mkancesdirs (char *, struct savewd *,
+                       int (*) (char const *, char const *, void *), void *);
+
+#ifdef __cplusplus
+}
+#endif
deleted file mode 120000 (symlink)
index fec531c9d3cb70794ebcaac341eece8d86b03ac0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkdir-p.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f8f3611dda5d1750270b3b8f9e62ed3b6954f073
--- /dev/null
@@ -0,0 +1,202 @@
+/* mkdir-p.c -- Ensure that a directory and its parents exist.
+
+   Copyright (C) 1990, 1997-2000, 2002-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, David MacKenzie, and Jim Meyering.  */
+
+#include <config.h>
+
+#include "mkdir-p.h"
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+#include "dirchownmod.h"
+#include "dirname.h"
+#include <error.h>
+#include "quote.h"
+#include "mkancesdirs.h"
+#include "savewd.h"
+
+#ifndef HAVE_FCHMOD
+# define HAVE_FCHMOD false
+#endif
+
+/* Ensure that the directory DIR exists.
+
+   WD is the working directory, as in savewd.c.
+
+   If MAKE_ANCESTOR is not null, create any ancestor directories that
+   don't already exist, by invoking MAKE_ANCESTOR (DIR, ANCESTOR, OPTIONS).
+   This function should return zero if successful, -1 (setting errno)
+   otherwise.  In this case, DIR may be modified by storing '\0' bytes
+   into it, to access the ancestor directories, and this modification
+   is retained on return if the ancestor directories could not be
+   created.
+
+   Create DIR as a new directory, using mkdir with permissions MODE;
+   here, MODE is affected by the umask in the usual way.  It is also
+   OK if MAKE_ANCESTOR is not null and a directory DIR already exists.
+
+   Call ANNOUNCE (DIR, OPTIONS) just after successfully making DIR,
+   even if some of the following actions fail.
+
+   Set DIR's owner to OWNER and group to GROUP, but leave the owner
+   alone if OWNER is (uid_t) -1, and similarly for GROUP.
+
+   Set DIR's mode bits to MODE, except preserve any of the bits that
+   correspond to zero bits in MODE_BITS.  In other words, MODE_BITS is
+   a mask that specifies which of DIR's mode bits should be set or
+   cleared.  Changing the mode in this way is necessary if DIR already
+   existed, if MODE and MODE_BITS specify non-permissions bits like
+   S_ISUID, or if MODE and MODE_BITS specify permissions bits that are
+   masked out by the umask.  MODE_BITS should be a subset of
+   CHMOD_MODE_BITS.
+
+   However, if PRESERVE_EXISTING is true and DIR already exists,
+   do not attempt to set DIR's ownership and file mode bits.
+
+   Return true if DIR exists as a directory with the proper ownership
+   and file mode bits when done, or if a child process has been
+   dispatched to do the real work (though the child process may not
+   have finished yet -- it is the caller's responsibility to handle
+   this).  Report a diagnostic and return false on failure, storing
+   '\0' into *DIR if an ancestor directory had problems.  */
+
+bool
+make_dir_parents (char *dir,
+                  struct savewd *wd,
+                  int (*make_ancestor) (char const *, char const *, void *),
+                  void *options,
+                  mode_t mode,
+                  void (*announce) (char const *, void *),
+                  mode_t mode_bits,
+                  uid_t owner,
+                  gid_t group,
+                  bool preserve_existing)
+{
+  int mkdir_errno = (IS_ABSOLUTE_FILE_NAME (dir) ? 0 : savewd_errno (wd));
+
+  if (mkdir_errno == 0)
+    {
+      ptrdiff_t prefix_len = 0;
+      int savewd_chdir_options = (HAVE_FCHMOD ? SAVEWD_CHDIR_SKIP_READABLE : 0);
+
+      if (make_ancestor)
+        {
+          prefix_len = mkancesdirs (dir, wd, make_ancestor, options);
+          if (prefix_len < 0)
+            {
+              if (prefix_len < -1)
+                return true;
+              mkdir_errno = errno;
+            }
+        }
+
+      if (0 <= prefix_len)
+        {
+          /* If the ownership might change, or if the directory will be
+             writable to other users and its special mode bits may
+             change after the directory is created, create it with
+             more restrictive permissions at first, so unauthorized
+             users cannot nip in before the directory is ready.  */
+          bool keep_owner = owner == (uid_t) -1 && group == (gid_t) -1;
+          bool keep_special_mode_bits =
+            ((mode_bits & (S_ISUID | S_ISGID)) | (mode & S_ISVTX)) == 0;
+          mode_t mkdir_mode = mode;
+          if (! keep_owner)
+            mkdir_mode &= ~ (S_IRWXG | S_IRWXO);
+          else if (! keep_special_mode_bits)
+            mkdir_mode &= ~ (S_IWGRP | S_IWOTH);
+
+          if (mkdir (dir + prefix_len, mkdir_mode) == 0)
+            {
+              /* True if the caller does not care about the umask's
+                 effect on the permissions.  */
+              bool umask_must_be_ok = (mode & mode_bits & S_IRWXUGO) == 0;
+
+              announce (dir, options);
+              preserve_existing = (keep_owner & keep_special_mode_bits
+                                   & umask_must_be_ok);
+              savewd_chdir_options |= SAVEWD_CHDIR_NOFOLLOW;
+            }
+          else
+            {
+              mkdir_errno = errno;
+              mkdir_mode = -1;
+            }
+
+          if (preserve_existing)
+            {
+              if (mkdir_errno == 0)
+                return true;
+              if (mkdir_errno != ENOENT && make_ancestor)
+                {
+                  struct stat st;
+                  if (stat (dir + prefix_len, &st) == 0)
+                    {
+                      if (S_ISDIR (st.st_mode))
+                        return true;
+                    }
+                  else if (mkdir_errno == EEXIST
+                           && errno != ENOENT && errno != ENOTDIR)
+                    {
+                      error (0, errno, _("cannot stat %s"), quote (dir));
+                      return false;
+                    }
+                }
+            }
+          else
+            {
+              int open_result[2];
+              int chdir_result =
+                savewd_chdir (wd, dir + prefix_len,
+                              savewd_chdir_options, open_result);
+              if (chdir_result < -1)
+                return true;
+              else
+                {
+                  bool chdir_ok = (chdir_result == 0);
+                  char const *subdir = (chdir_ok ? "." : dir + prefix_len);
+                  if (dirchownmod (open_result[0], subdir, mkdir_mode,
+                                   owner, group, mode, mode_bits)
+                      == 0)
+                    return true;
+
+                  if (mkdir_errno == 0
+                      || (mkdir_errno != ENOENT && make_ancestor
+                          && errno != ENOTDIR))
+                    {
+                      error (0, errno,
+                             _(keep_owner
+                               ? "cannot change permissions of %s"
+                               : "cannot change owner and permissions of %s"),
+                             quote (dir));
+                      return false;
+                    }
+                }
+            }
+        }
+    }
+
+  error (0, mkdir_errno, _("cannot create directory %s"), quote (dir));
+  return false;
+}
deleted file mode 120000 (symlink)
index af459b1819e357469c6f74322dc83f35e042054d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkdir-p.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1a10bc308a119c83a11bd178c11cec90282c2323
--- /dev/null
@@ -0,0 +1,34 @@
+/* mkdir-p.h -- Ensure that a directory and its parents exist.
+
+   Copyright (C) 1994-1997, 2000, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, David MacKenzie, and Jim Meyering.  */
+
+#include <sys/types.h>
+
+struct savewd;
+bool make_dir_parents (char *dir,
+                       struct savewd *wd,
+                       int (*make_ancestor) (char const *, char const *,
+                                             void *),
+                       void *options,
+                       mode_t mode,
+                       void (*announce) (char const *, void *),
+                       mode_t mode_bits,
+                       uid_t owner,
+                       gid_t group,
+                       bool preserve_existing);
deleted file mode 120000 (symlink)
index 37ae0c669313dd3f4e274206b6f5babefbb99f2f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..21d77677ee367fa5933bfddbe29f4bcaae540524
--- /dev/null
@@ -0,0 +1,93 @@
+/* On some systems, mkdir ("foo/", 0700) fails because of the trailing
+   slash.  On those systems, this wrapper removes the trailing slash.
+
+   Copyright (C) 2001, 2003, 2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "dirname.h"
+
+/* Disable the definition of mkdir to rpl_mkdir (from the <sys/stat.h>
+   substitute) in this file.  Otherwise, we'd get an endless recursion.  */
+#undef mkdir
+
+/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
+   Additionally, it declares _mkdir (and depending on compile flags, an
+   alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
+   which are included in the <sys/stat.h> override.  */
+#if defined _WIN32 && ! defined __CYGWIN__
+# define mkdir(name,mode) _mkdir (name)
+# define maybe_unused _GL_UNUSED
+#else
+# define maybe_unused /* empty */
+#endif
+
+/* This function is required at least for NetBSD 1.5.2.  */
+
+int
+rpl_mkdir (char const *dir, maybe_unused mode_t mode)
+{
+  int ret_val;
+  char *tmp_dir;
+  size_t len = strlen (dir);
+
+  if (len && dir[len - 1] == '/')
+    {
+      tmp_dir = strdup (dir);
+      if (!tmp_dir)
+        {
+          /* Rather than rely on strdup-posix, we set errno ourselves.  */
+          errno = ENOMEM;
+          return -1;
+        }
+      strip_trailing_slashes (tmp_dir);
+    }
+  else
+    {
+      tmp_dir = (char *) dir;
+    }
+#if FUNC_MKDIR_DOT_BUG
+  /* Additionally, cygwin 1.5 mistakenly creates a directory "d/./".  */
+  {
+    char *last = last_component (tmp_dir);
+    if (*last == '.' && (last[1] == '\0'
+                         || (last[1] == '.' && last[2] == '\0')))
+      {
+        struct stat st;
+        if (stat (tmp_dir, &st) == 0 || errno == EOVERFLOW)
+          errno = EEXIST;
+        return -1;
+      }
+  }
+#endif /* FUNC_MKDIR_DOT_BUG */
+
+  ret_val = mkdir (tmp_dir, mode);
+
+  if (tmp_dir != dir)
+    free (tmp_dir);
+
+  return ret_val;
+}
deleted file mode 120000 (symlink)
index 94624384ad7c1bc6397d034642a33d0c04105f2a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkdirat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9a5e3859f84473fc0eacd650d51c3a35ba1e6046
--- /dev/null
@@ -0,0 +1,38 @@
+/* fd-relative mkdir
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/stat.h>
+
+#include <stdlib.h>
+#include <unistd.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_POST_FILE_PARAM_DECLS , mode_t mode
+#define AT_FUNC_POST_FILE_ARGS        , mode
+#include "at-func.c"
deleted file mode 120000 (symlink)
index 73e02d796d66b067d8d4e9490b21fd3c7fe62fa8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkfifo.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5fc089646c41bf39081d57938c0aa9b3a51f5457
--- /dev/null
@@ -0,0 +1,58 @@
+/* Create a named fifo.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <string.h>
+
+#if !HAVE_MKFIFO
+/* Mingw lacks mkfifo; always fail with ENOSYS.  */
+
+int
+mkfifo (_GL_UNUSED char const *name, _GL_UNUSED mode_t mode)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#else /* HAVE_MKFIFO */
+
+# undef mkfifo
+
+/* Create a named fifo FILE, with access permissions in MODE.  Work
+around trailing slash bugs.  */
+
+int
+rpl_mkfifo (char const *name, mode_t mode)
+{
+# if MKFIFO_TRAILING_SLASH_BUG
+  size_t len = strlen (name);
+  if (len && name[len - 1] == '/')
+    {
+      struct stat st;
+      if (stat (name, &st) == 0 || errno == EOVERFLOW)
+        errno = EEXIST;
+      return -1;
+    }
+# endif
+  return mkfifo (name, mode);
+}
+#endif /* HAVE_MKFIFO */
deleted file mode 120000 (symlink)
index 4d71ba7ef16ed98301c7397bb2b105f7798c6e0b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkfifoat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7bb031babbad589806e58a84f999ca1ab6d9b5f3
--- /dev/null
@@ -0,0 +1,96 @@
+/* Create a named fifo relative to an open directory.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/stat.h>
+
+#include <stdlib.h>
+
+#if HAVE_MKFIFOAT
+
+# include <errno.h>
+# include <fcntl.h>
+# include <string.h>
+
+int
+rpl_mkfifoat (int fd, char const *file, mode_t mode)
+#undef mkfifoat
+{
+  /* Use the original mkfifoat(), but correct the trailing slash handling.  */
+  size_t len = strlen (file);
+  if (len && file[len - 1] == '/')
+    {
+      struct stat st;
+
+      if (fstatat (fd, file, &st, AT_SYMLINK_NOFOLLOW) < 0)
+        {
+          if (errno == EOVERFLOW)
+            /* It's surely a file, not a directory.  */
+            errno = ENOTDIR;
+        }
+      else
+        {
+          /* It's a directory, otherwise fstatat() would have reported an error
+             ENOTDIR.  */
+          errno = EEXIST;
+        }
+      return -1;
+    }
+
+  return mkfifoat (fd, file, mode);
+}
+
+#else
+
+# if !HAVE_MKFIFO
+
+#  include <errno.h>
+
+/* Mingw lacks mkfifo, so this wrapper is trivial.  */
+
+int
+mkfifoat (_GL_UNUSED int fd, _GL_UNUSED char const *path,
+          _GL_UNUSED mode_t mode)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+# else /* HAVE_MKFIFO */
+
+/* Create a named fifo FILE relative to directory FD, with access
+   permissions in MODE.  If possible, do it without changing the
+   working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then mkfifo/restore_cwd.  If either the save_cwd or the restore_cwd
+   fails, then give a diagnostic and exit nonzero.  */
+
+#  define AT_FUNC_NAME mkfifoat
+#  define AT_FUNC_F1 mkfifo
+#  define AT_FUNC_POST_FILE_PARAM_DECLS , mode_t mode
+#  define AT_FUNC_POST_FILE_ARGS        , mode
+#  include "at-func.c"
+#  undef AT_FUNC_NAME
+#  undef AT_FUNC_F1
+#  undef AT_FUNC_POST_FILE_PARAM_DECLS
+#  undef AT_FUNC_POST_FILE_ARGS
+
+# endif /* HAVE_MKFIFO */
+
+#endif /* HAVE_MKFIFOAT */
deleted file mode 120000 (symlink)
index 0c6c06941ad6a912a4818736809f426c641ce40b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mknod.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..65581d7919bb7d890a0fdd0c71ede4313a3b6503
--- /dev/null
@@ -0,0 +1,74 @@
+/* Create a device inode.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <string.h>
+
+#if !HAVE_MKNOD
+/* Mingw lacks mknod; always fail with ENOSYS.  */
+
+int
+mknod (_GL_UNUSED char const *name, _GL_UNUSED mode_t mode,
+       _GL_UNUSED dev_t dev)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#else /* HAVE_MKNOD */
+
+# undef mknod
+
+/* Create a file system node FILE, with access permissions and file
+   type in MODE, and device type in DEV.  Usually, non-root
+   applications can only create named fifos (mode includes S_IFIFO),
+   with DEV set to 0.  Also work around trailing slash bugs.  */
+
+int
+rpl_mknod (char const *name, mode_t mode, dev_t dev)
+{
+# if MKFIFO_TRAILING_SLASH_BUG
+  /* Trailing slash only makes sense for directories.  Of course,
+     using mknod to create a directory is not very portable, so it may
+     still fail later on.  */
+  if (!S_ISDIR (mode))
+    {
+      size_t len = strlen (name);
+      if (len && name[len - 1] == '/')
+        {
+          struct stat st;
+          if (stat (name, &st) == 0 || errno == EOVERFLOW)
+            errno = EEXIST;
+          return -1;
+        }
+    }
+# endif
+# if MKNOD_FIFO_BUG
+  /* POSIX requires mknod to create fifos for non-privileged
+     processes, but BSD implementations fail with EPERM.  */
+  if (S_ISFIFO (mode) && dev == 0)
+    return mkfifo (name, mode & ~S_IFIFO);
+# endif
+  return mknod (name, mode, dev);
+}
+
+#endif /* HAVE_MKNOD */
deleted file mode 120000 (symlink)
index 1231afa659bb4aa5a394fbd5b1d8fd5eb249d899..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mknodat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..66d5b3566f68e8fc3d4e2741f7134e1fd0c46bb4
--- /dev/null
@@ -0,0 +1,98 @@
+/* Create an inode relative to an open directory.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/stat.h>
+
+#include <stdlib.h>
+
+#if HAVE_MKNODAT
+
+# include <errno.h>
+# include <fcntl.h>
+# include <string.h>
+
+int
+rpl_mknodat (int fd, char const *file, mode_t mode, dev_t dev)
+#undef mknodat
+{
+  /* Use the original mknodat(), but correct the trailing slash handling.  */
+  size_t len = strlen (file);
+  if (len && file[len - 1] == '/')
+    {
+      struct stat st;
+
+      if (fstatat (fd, file, &st, AT_SYMLINK_NOFOLLOW) < 0)
+        {
+          if (errno == EOVERFLOW)
+            /* It's surely a file, not a directory.  */
+            errno = ENOTDIR;
+        }
+      else
+        {
+          /* It's a directory, otherwise fstatat() would have reported an error
+             ENOTDIR.  */
+          errno = EEXIST;
+        }
+      return -1;
+    }
+
+  return mknodat (fd, file, mode, dev);
+}
+
+#else
+
+# if !HAVE_MKNOD
+
+#  include <errno.h>
+
+/* Mingw lacks mknod, so this wrapper is trivial.  */
+
+int
+mknodat (_GL_UNUSED int fd, _GL_UNUSED char const *path,
+         _GL_UNUSED mode_t mode, _GL_UNUSED dev_t dev)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+# else
+
+/* Create a file system node FILE relative to directory FD, with
+   access permissions and file type in MODE, and device type in DEV.
+   Usually, non-root applications can only create named fifos, with
+   DEV set to 0.  If possible, create the node without changing the
+   working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then mknod/restore_cwd.  If either the save_cwd or the restore_cwd
+   fails, then give a diagnostic and exit nonzero.  */
+
+#  define AT_FUNC_NAME mknodat
+#  define AT_FUNC_F1 mknod
+#  define AT_FUNC_POST_FILE_PARAM_DECLS , mode_t mode, dev_t dev
+#  define AT_FUNC_POST_FILE_ARGS        , mode, dev
+#  include "at-func.c"
+#  undef AT_FUNC_NAME
+#  undef AT_FUNC_F1
+#  undef AT_FUNC_POST_FILE_PARAM_DECLS
+#  undef AT_FUNC_POST_FILE_ARGS
+
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index 2d6108c35e9ddf625c53678d115845c3f7e45dbb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkostemp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d826627fe585acdd630080c9d893aa2097ae7fdc
--- /dev/null
@@ -0,0 +1,46 @@
+/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2024 Free Software
+   Foundation, Inc.
+   This file is derived from the one in the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if !_LIBC
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+
+#if !_LIBC
+# include "tempname.h"
+# define __gen_tempname gen_tempname
+# ifndef __GTFILE
+#  define __GT_FILE GT_FILE
+# endif
+#endif
+
+#include <stdio.h>
+
+#ifndef __GT_FILE
+# define __GT_FILE 0
+#endif
+
+/* Generate a unique temporary file name from XTEMPLATE.
+   The last six characters of XTEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   Then open the file and return a fd. */
+int
+mkostemp (char *xtemplate, int flags)
+{
+  return __gen_tempname (xtemplate, 0, flags, __GT_FILE);
+}
deleted file mode 120000 (symlink)
index 85b77d0b3c0cfbcab3fbe8fb1fb6d6e4b2668b85..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkstemp-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..03b457c7146138189f2417958ec82889c141a538
--- /dev/null
@@ -0,0 +1,63 @@
+/* Invoke mkstemp, but avoid some glitches.
+
+   Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "stdlib-safer.h"
+
+#include <stdlib.h>
+#include "unistd-safer.h"
+
+/* Like mkstemp, but do not return STDIN_FILENO, STDOUT_FILENO, or
+   STDERR_FILENO.  */
+
+int
+mkstemp_safer (char *templ)
+{
+  return fd_safer (mkstemp (templ));
+}
+
+#if GNULIB_MKOSTEMP
+/* Like mkostemp, but do not return STDIN_FILENO, STDOUT_FILENO, or
+   STDERR_FILENO.  */
+int
+mkostemp_safer (char *templ, int flags)
+{
+  return fd_safer_flag (mkostemp (templ, flags), flags);
+}
+#endif
+
+#if GNULIB_MKOSTEMPS
+/* Like mkostemps, but do not return STDIN_FILENO, STDOUT_FILENO, or
+   STDERR_FILENO.  */
+int
+mkostemps_safer (char *templ, int suffixlen, int flags)
+{
+  return fd_safer_flag (mkostemps (templ, suffixlen, flags), flags);
+}
+#endif
+
+#if GNULIB_MKSTEMPS
+/* Like mkstemps, but do not return STDIN_FILENO, STDOUT_FILENO, or
+   STDERR_FILENO.  */
+int mkstemps_safer (char *templ, int suffixlen)
+{
+  return fd_safer (mkstemps (templ, suffixlen));
+}
+#endif
deleted file mode 120000 (symlink)
index 0638a88bad316bb2cfe39205c8f27ad0d906580f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mkstemp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..724638dfaf5eb062dd50a45e30a85149229d8241
--- /dev/null
@@ -0,0 +1,50 @@
+/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2024 Free Software
+   Foundation, Inc.
+   This file is derived from the one in the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if !_LIBC
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+
+#if !_LIBC
+# include "tempname.h"
+# define __gen_tempname gen_tempname
+# ifndef __GT_FILE
+#  define __GT_FILE GT_FILE
+# endif
+#endif
+
+#include <stdio.h>
+
+#ifndef __GT_FILE
+# define __GT_FILE 0
+#endif
+
+/* Generate a unique temporary file name from XTEMPLATE.
+   The last six characters of XTEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   Then open the file and return a fd.
+
+   If you are creating temporary files which will later be removed,
+   consider using the clean-temp module, which avoids several pitfalls
+   of using mkstemp directly. */
+int
+mkstemp (char *xtemplate)
+{
+  return __gen_tempname (xtemplate, 0, 0, __GT_FILE);
+}
deleted file mode 120000 (symlink)
index e6a61c3c907a381adcd3809301d5f7ca6a041251..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mktime-internal.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..709c36bdf56c8abc522fdfd24e10556df2be4222
--- /dev/null
@@ -0,0 +1,79 @@
+/* Internals of mktime and related functions
+   Copyright 2016-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Paul Eggert <eggert@cs.ucla.edu>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <time.h>
+#endif
+
+/* mktime_offset_t is a signed type wide enough to hold a UTC offset
+   in seconds, and used as part of the type of the offset-guess
+   argument to mktime_internal.  In Glibc, it is always long int.
+   When in Gnulib, use time_t on platforms where time_t
+   is signed, to be compatible with platforms like BeOS that export
+   this implementation detail of mktime.  On platforms where time_t is
+   unsigned, GNU and POSIX code can assume 'int' is at least 32 bits
+   which is wide enough for a UTC offset.  */
+#ifdef _LIBC
+typedef long int mktime_offset_t;
+#elif defined TIME_T_IS_SIGNED
+typedef time_t mktime_offset_t;
+#else
+typedef int mktime_offset_t;
+#endif
+
+/* The source code uses identifiers like __time64_t for glibc
+   timestamps that can contain 64-bit values even when time_t is only
+   32 bits.  These are just macros for the ordinary identifiers unless
+   compiling within glibc when time_t is 32 bits.  */
+#if ! (defined _LIBC && __TIMESIZE != 64)
+# undef __time64_t
+# define __time64_t time_t
+# define __gmtime64_r __gmtime_r
+# define __localtime64_r __localtime_r
+# define __mktime64 mktime
+# define __timegm64 timegm
+#endif
+
+#ifndef _LIBC
+
+/* Although glibc source code uses leading underscores, Gnulib wants
+   ordinary names.
+
+   Portable standalone applications should supply a <time.h> that
+   declares a POSIX-compliant localtime_r, for the benefit of older
+   implementations that lack localtime_r or have a nonstandard one.
+   Similarly for gmtime_r.  See the gnulib time_r module for one way
+   to implement this.  */
+
+# undef __gmtime_r
+# undef __localtime_r
+# define __gmtime_r gmtime_r
+# define __localtime_r localtime_r
+
+# define __mktime_internal mktime_internal
+
+#endif
+
+/* Subroutine of mktime.  Return the time_t representation of TP and
+   normalize TP, given that a struct tm * maps to a time_t as performed
+   by FUNC.  Record next guess for localtime-gmtime offset in *OFFSET.  */
+extern __time64_t __mktime_internal (struct tm *tp,
+                                     struct tm *(*func) (__time64_t const *,
+                                                         struct tm *),
+                                     mktime_offset_t *offset) attribute_hidden;
deleted file mode 120000 (symlink)
index 16bbb0fb3243fb695b85cbd21654f4eb0d378c7a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mktime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c704f41574003dbd80a7a6a9f39409496fb96174
--- /dev/null
@@ -0,0 +1,579 @@
+/* Convert a 'struct tm' to a time_t value.
+   Copyright (C) 1993-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Paul Eggert <eggert@twinsun.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* The following macros influence what gets defined when this file is compiled:
+
+   Macro/expression            Which gnulib module    This compilation unit
+                                                      should define
+
+   _LIBC                       (glibc proper)         mktime
+
+   NEED_MKTIME_WORKING         mktime                 rpl_mktime
+   || NEED_MKTIME_WINDOWS
+
+   NEED_MKTIME_INTERNAL        mktime-internal        mktime_internal
+ */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+/* Assume that leap seconds are possible, unless told otherwise.
+   If the host has a 'zic' command with a '-L leapsecondfilename' option,
+   then it supports leap seconds; otherwise it probably doesn't.  */
+#ifndef LEAP_SECONDS_POSSIBLE
+# define LEAP_SECONDS_POSSIBLE 1
+#endif
+
+#include <time.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdckdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <intprops.h>
+#include <verify.h>
+
+#ifndef NEED_MKTIME_INTERNAL
+# define NEED_MKTIME_INTERNAL 0
+#endif
+#ifndef NEED_MKTIME_WINDOWS
+# define NEED_MKTIME_WINDOWS 0
+#endif
+#ifndef NEED_MKTIME_WORKING
+# define NEED_MKTIME_WORKING 0
+#endif
+
+#include "mktime-internal.h"
+
+#if !defined _LIBC && (NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS)
+static void
+my_tzset (void)
+{
+# if NEED_MKTIME_WINDOWS
+  /* Rectify the value of the environment variable TZ.
+     There are four possible kinds of such values:
+       - Traditional US time zone names, e.g. "PST8PDT".  Syntax: see
+         <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset>
+       - Time zone names based on geography, that contain one or more
+         slashes, e.g. "Europe/Moscow".
+       - Time zone names based on geography, without slashes, e.g.
+         "Singapore".
+       - Time zone names that contain explicit DST rules.  Syntax: see
+         <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03>
+     The Microsoft CRT understands only the first kind.  It produces incorrect
+     results if the value of TZ is of the other kinds.
+     But in a Cygwin environment, /etc/profile.d/tzset.sh sets TZ to a value
+     of the second kind for most geographies, or of the first kind in a few
+     other geographies.  If it is of the second kind, neutralize it.  For the
+     Microsoft CRT, an absent or empty TZ means the time zone that the user
+     has set in the Windows Control Panel.
+     If the value of TZ is of the third or fourth kind -- Cygwin programs
+     understand these syntaxes as well --, it does not matter whether we
+     neutralize it or not, since these values occur only when a Cygwin user
+     has set TZ explicitly; this case is 1. rare and 2. under the user's
+     responsibility.  */
+  const char *tz = getenv ("TZ");
+  if (tz != NULL && strchr (tz, '/') != NULL)
+    _putenv ("TZ=");
+# else
+  tzset ();
+# endif
+}
+# undef __tzset
+# define __tzset() my_tzset ()
+#endif
+
+#if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL
+
+/* A signed type that can represent an integer number of years
+   multiplied by four times the number of seconds in a year.  It is
+   needed when converting a tm_year value times the number of seconds
+   in a year.  The factor of four comes because these products need
+   to be subtracted from each other, and sometimes with an offset
+   added to them, and then with another timestamp added, without
+   worrying about overflow.
+
+   Much of the code uses long_int to represent __time64_t values, to
+   lessen the hassle of dealing with platforms where __time64_t is
+   unsigned, and because long_int should suffice to represent all
+   __time64_t values that mktime can generate even on platforms where
+   __time64_t is wider than the int components of struct tm.  */
+
+#if INT_MAX <= LONG_MAX / 4 / 366 / 24 / 60 / 60
+typedef long int long_int;
+#else
+typedef long long int long_int;
+#endif
+verify (INT_MAX <= TYPE_MAXIMUM (long_int) / 4 / 366 / 24 / 60 / 60);
+
+/* Shift A right by B bits portably, by dividing A by 2**B and
+   truncating towards minus infinity.  B should be in the range 0 <= B
+   <= LONG_INT_BITS - 2, where LONG_INT_BITS is the number of useful
+   bits in a long_int.  LONG_INT_BITS is at least 32.
+
+   ISO C99 says that A >> B is implementation-defined if A < 0.  Some
+   implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
+   right in the usual way when A < 0, so SHR falls back on division if
+   ordinary A >> B doesn't seem to be the usual signed shift.  */
+
+static long_int
+shr (long_int a, int b)
+{
+  long_int one = 1;
+  return (-one >> 1 == -1
+         ? a >> b
+         : (a + (a < 0)) / (one << b) - (a < 0));
+}
+
+/* Bounds for the intersection of __time64_t and long_int.  */
+
+static long_int const mktime_min
+  = ((TYPE_SIGNED (__time64_t)
+      && TYPE_MINIMUM (__time64_t) < TYPE_MINIMUM (long_int))
+     ? TYPE_MINIMUM (long_int) : TYPE_MINIMUM (__time64_t));
+static long_int const mktime_max
+  = (TYPE_MAXIMUM (long_int) < TYPE_MAXIMUM (__time64_t)
+     ? TYPE_MAXIMUM (long_int) : TYPE_MAXIMUM (__time64_t));
+
+#define EPOCH_YEAR 1970
+#define TM_YEAR_BASE 1900
+verify (TM_YEAR_BASE % 100 == 0);
+
+/* Is YEAR + TM_YEAR_BASE a leap year?  */
+static bool
+leapyear (long_int year)
+{
+  /* Don't add YEAR to TM_YEAR_BASE, as that might overflow.
+     Also, work even if YEAR is negative.  */
+  return
+    ((year & 3) == 0
+     && (year % 100 != 0
+        || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
+}
+
+/* How many days come before each month (0-12).  */
+#ifndef _LIBC
+static
+#endif
+const unsigned short int __mon_yday[2][13] =
+  {
+    /* Normal years.  */
+    { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+    /* Leap years.  */
+    { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+  };
+
+
+/* Do the values A and B differ according to the rules for tm_isdst?
+   A and B differ if one is zero and the other positive.  */
+static bool
+isdst_differ (int a, int b)
+{
+  return (!a != !b) && (0 <= a) && (0 <= b);
+}
+
+/* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
+   (YEAR0-YDAY0 HOUR0:MIN0:SEC0) in seconds, assuming that the clocks
+   were not adjusted between the timestamps.
+
+   The YEAR values uses the same numbering as TP->tm_year.  Values
+   need not be in the usual range.  However, YEAR1 - YEAR0 must not
+   overflow even when multiplied by three times the number of seconds
+   in a year, and likewise for YDAY1 - YDAY0 and three times the
+   number of seconds in a day.  */
+
+static long_int
+ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
+           int year0, int yday0, int hour0, int min0, int sec0)
+{
+  verify (-1 / 2 == 0);
+
+  /* Compute intervening leap days correctly even if year is negative.
+     Take care to avoid integer overflow here.  */
+  int a4 = shr (year1, 2) + shr (TM_YEAR_BASE, 2) - ! (year1 & 3);
+  int b4 = shr (year0, 2) + shr (TM_YEAR_BASE, 2) - ! (year0 & 3);
+  int a100 = (a4 + (a4 < 0)) / 25 - (a4 < 0);
+  int b100 = (b4 + (b4 < 0)) / 25 - (b4 < 0);
+  int a400 = shr (a100, 2);
+  int b400 = shr (b100, 2);
+  int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
+
+  /* Compute the desired time without overflowing.  */
+  long_int years = year1 - year0;
+  long_int days = 365 * years + yday1 - yday0 + intervening_leap_days;
+  long_int hours = 24 * days + hour1 - hour0;
+  long_int minutes = 60 * hours + min1 - min0;
+  long_int seconds = 60 * minutes + sec1 - sec0;
+  return seconds;
+}
+
+/* Return the average of A and B, even if A + B would overflow.
+   Round toward positive infinity.  */
+static long_int
+long_int_avg (long_int a, long_int b)
+{
+  return shr (a, 1) + shr (b, 1) + ((a | b) & 1);
+}
+
+/* Return a long_int value corresponding to (YEAR-YDAY HOUR:MIN:SEC)
+   minus *TP seconds, assuming no clock adjustments occurred between
+   the two timestamps.
+
+   YEAR and YDAY must not be so large that multiplying them by three times the
+   number of seconds in a year (or day, respectively) would overflow long_int.
+   *TP should be in the usual range.  */
+static long_int
+tm_diff (long_int year, long_int yday, int hour, int min, int sec,
+        struct tm const *tp)
+{
+  return ydhms_diff (year, yday, hour, min, sec,
+                    tp->tm_year, tp->tm_yday,
+                    tp->tm_hour, tp->tm_min, tp->tm_sec);
+}
+
+/* Use CONVERT to convert T to a struct tm value in *TM.  T must be in
+   range for __time64_t.  Return TM if successful, NULL (setting errno) on
+   failure.  */
+static struct tm *
+convert_time (struct tm *(*convert) (const __time64_t *, struct tm *),
+             long_int t, struct tm *tm)
+{
+  __time64_t x = t;
+  return convert (&x, tm);
+}
+
+/* Use CONVERT to convert *T to a broken down time in *TP.
+   If *T is out of range for conversion, adjust it so that
+   it is the nearest in-range value and then convert that.
+   A value is in range if it fits in both __time64_t and long_int.
+   Return TP on success, NULL (setting errno) on failure.  */
+static struct tm *
+ranged_convert (struct tm *(*convert) (const __time64_t *, struct tm *),
+               long_int *t, struct tm *tp)
+{
+  long_int t1 = (*t < mktime_min ? mktime_min
+                : *t <= mktime_max ? *t : mktime_max);
+  struct tm *r = convert_time (convert, t1, tp);
+  if (r)
+    {
+      *t = t1;
+      return r;
+    }
+  if (errno != EOVERFLOW)
+    return NULL;
+
+  long_int bad = t1;
+  long_int ok = 0;
+  struct tm oktm; oktm.tm_sec = -1;
+
+  /* BAD is a known out-of-range value, and OK is a known in-range one.
+     Use binary search to narrow the range between BAD and OK until
+     they differ by 1.  */
+  while (true)
+    {
+      long_int mid = long_int_avg (ok, bad);
+      if (mid == ok || mid == bad)
+       break;
+      if (convert_time (convert, mid, tp))
+       ok = mid, oktm = *tp;
+      else if (errno != EOVERFLOW)
+       return NULL;
+      else
+       bad = mid;
+    }
+
+  if (oktm.tm_sec < 0)
+    return NULL;
+  *t = ok;
+  *tp = oktm;
+  return tp;
+}
+
+
+/* Convert *TP to a __time64_t value, inverting
+   the monotonic and mostly-unit-linear conversion function CONVERT.
+   Use *OFFSET to keep track of a guess at the offset of the result,
+   compared to what the result would be for UTC without leap seconds.
+   If *OFFSET's guess is correct, only one CONVERT call is needed.
+   If successful, set *TP to the canonicalized struct tm;
+   otherwise leave *TP alone, return ((time_t) -1) and set errno.
+   This function is external because it is used also by timegm.c.  */
+__time64_t
+__mktime_internal (struct tm *tp,
+                  struct tm *(*convert) (const __time64_t *, struct tm *),
+                  mktime_offset_t *offset)
+{
+  struct tm tm;
+
+  /* The maximum number of probes (calls to CONVERT) should be enough
+     to handle any combinations of time zone rule changes, solar time,
+     leap seconds, and oscillations around a spring-forward gap.
+     POSIX.1 prohibits leap seconds, but some hosts have them anyway.  */
+  int remaining_probes = 6;
+
+  /* Time requested.  Copy it in case CONVERT modifies *TP; this can
+     occur if TP is localtime's returned value and CONVERT is localtime.  */
+  int sec = tp->tm_sec;
+  int min = tp->tm_min;
+  int hour = tp->tm_hour;
+  int mday = tp->tm_mday;
+  int mon = tp->tm_mon;
+  int year_requested = tp->tm_year;
+  int isdst = tp->tm_isdst;
+
+  /* 1 if the previous probe was DST.  */
+  int dst2 = 0;
+
+  /* Ensure that mon is in range, and set year accordingly.  */
+  int mon_remainder = mon % 12;
+  int negative_mon_remainder = mon_remainder < 0;
+  int mon_years = mon / 12 - negative_mon_remainder;
+  long_int lyear_requested = year_requested;
+  long_int year = lyear_requested + mon_years;
+
+  /* The other values need not be in range:
+     the remaining code handles overflows correctly.  */
+
+  /* Calculate day of year from year, month, and day of month.
+     The result need not be in range.  */
+  int mon_yday = ((__mon_yday[leapyear (year)]
+                  [mon_remainder + 12 * negative_mon_remainder])
+                 - 1);
+  long_int lmday = mday;
+  long_int yday = mon_yday + lmday;
+
+  mktime_offset_t off = *offset;
+  int negative_offset_guess;
+
+  int sec_requested = sec;
+
+  if (LEAP_SECONDS_POSSIBLE)
+    {
+      /* Handle out-of-range seconds specially,
+        since ydhms_diff assumes every minute has 60 seconds.  */
+      if (sec < 0)
+       sec = 0;
+      if (59 < sec)
+       sec = 59;
+    }
+
+  /* Invert CONVERT by probing.  First assume the same offset as last
+     time.  */
+
+  ckd_sub (&negative_offset_guess, 0, off);
+  long_int t0 = ydhms_diff (year, yday, hour, min, sec,
+                           EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0,
+                           negative_offset_guess);
+  long_int t = t0, t1 = t0, t2 = t0;
+
+  /* Repeatedly use the error to improve the guess.  */
+
+  while (true)
+    {
+      if (! ranged_convert (convert, &t, &tm))
+       return -1;
+      long_int dt = tm_diff (year, yday, hour, min, sec, &tm);
+      if (dt == 0)
+       break;
+
+      if (t == t1 && t != t2
+         && (tm.tm_isdst < 0
+             || (isdst < 0
+                 ? dst2 <= (tm.tm_isdst != 0)
+                 : (isdst != 0) != (tm.tm_isdst != 0))))
+       /* We can't possibly find a match, as we are oscillating
+          between two values.  The requested time probably falls
+          within a spring-forward gap of size DT.  Follow the common
+          practice in this case, which is to return a time that is DT
+          away from the requested time, preferring a time whose
+          tm_isdst differs from the requested value.  (If no tm_isdst
+          was requested and only one of the two values has a nonzero
+          tm_isdst, prefer that value.)  In practice, this is more
+          useful than returning -1.  */
+       goto offset_found;
+
+      remaining_probes--;
+      if (remaining_probes == 0)
+       {
+         __set_errno (EOVERFLOW);
+         return -1;
+       }
+
+      t1 = t2, t2 = t, t += dt, dst2 = tm.tm_isdst != 0;
+    }
+
+  /* We have a match.  Check whether tm.tm_isdst has the requested
+     value, if any.  */
+  if (isdst_differ (isdst, tm.tm_isdst))
+    {
+      /* tm.tm_isdst has the wrong value.  Look for a neighboring
+        time with the right value, and use its UTC offset.
+
+        Heuristic: probe the adjacent timestamps in both directions,
+        looking for the desired isdst.  If none is found within a
+        reasonable duration bound, assume a one-hour DST difference.
+        This should work for all real time zone histories in the tz
+        database.  */
+
+      /* +1 if we wanted standard time but got DST, -1 if the reverse.  */
+      int dst_difference = (isdst == 0) - (tm.tm_isdst == 0);
+
+      /* Distance between probes when looking for a DST boundary.  In
+        tzdata2003a, the shortest period of DST is 601200 seconds
+        (e.g., America/Recife starting 2000-10-08 01:00), and the
+        shortest period of non-DST surrounded by DST is 694800
+        seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
+        minimum of these two values, so we don't miss these short
+        periods when probing.  */
+      int stride = 601200;
+
+      /* In TZDB 2021e, the longest period of DST (or of non-DST), in
+        which the DST (or adjacent DST) difference is not one hour,
+        is 457243209 seconds: e.g., America/Cambridge_Bay with leap
+        seconds, starting 1965-10-31 00:00 in a switch from
+        double-daylight time (-05) to standard time (-07), and
+        continuing to 1980-04-27 02:00 in a switch from standard time
+        (-07) to daylight time (-06).  */
+      int duration_max = 457243209;
+
+      /* Search in both directions, so the maximum distance is half
+        the duration; add the stride to avoid off-by-1 problems.  */
+      int delta_bound = duration_max / 2 + stride;
+
+      int delta, direction;
+
+      for (delta = stride; delta < delta_bound; delta += stride)
+       for (direction = -1; direction <= 1; direction += 2)
+         {
+           long_int ot;
+           if (! ckd_add (&ot, t, delta * direction))
+             {
+               struct tm otm;
+               if (! ranged_convert (convert, &ot, &otm))
+                 return -1;
+               if (! isdst_differ (isdst, otm.tm_isdst))
+                 {
+                   /* We found the desired tm_isdst.
+                      Extrapolate back to the desired time.  */
+                   long_int gt = ot + tm_diff (year, yday, hour, min, sec,
+                                               &otm);
+                   if (mktime_min <= gt && gt <= mktime_max)
+                     {
+                       if (convert_time (convert, gt, &tm))
+                         {
+                           t = gt;
+                           goto offset_found;
+                         }
+                       if (errno != EOVERFLOW)
+                         return -1;
+                     }
+                 }
+             }
+         }
+
+      /* No unusual DST offset was found nearby.  Assume one-hour DST.  */
+      t += 60 * 60 * dst_difference;
+      if (mktime_min <= t && t <= mktime_max && convert_time (convert, t, &tm))
+       goto offset_found;
+
+      __set_errno (EOVERFLOW);
+      return -1;
+    }
+
+ offset_found:
+  /* Set *OFFSET to the low-order bits of T - T0 - NEGATIVE_OFFSET_GUESS.
+     This is just a heuristic to speed up the next mktime call, and
+     correctness is unaffected if integer overflow occurs here.  */
+  ckd_sub (offset, t, t0);
+  ckd_sub (offset, *offset, negative_offset_guess);
+
+  if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
+    {
+      /* Adjust time to reflect the tm_sec requested, not the normalized value.
+        Also, repair any damage from a false match due to a leap second.  */
+      long_int sec_adjustment = sec == 0 && tm.tm_sec == 60;
+      sec_adjustment -= sec;
+      sec_adjustment += sec_requested;
+      if (ckd_add (&t, t, sec_adjustment)
+         || ! (mktime_min <= t && t <= mktime_max))
+       {
+         __set_errno (EOVERFLOW);
+         return -1;
+       }
+      if (! convert_time (convert, t, &tm))
+       return -1;
+    }
+
+  *tp = tm;
+  return t;
+}
+
+#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL */
+
+#if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS
+
+/* Convert *TP to a __time64_t value.  */
+__time64_t
+__mktime64 (struct tm *tp)
+{
+  /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
+     time zone names contained in the external variable 'tzname' shall
+     be set as if the tzset() function had been called.  */
+  __tzset ();
+
+# if defined _LIBC || NEED_MKTIME_WORKING
+  static mktime_offset_t localtime_offset;
+  return __mktime_internal (tp, __localtime64_r, &localtime_offset);
+# else
+#  undef mktime
+  return mktime (tp);
+# endif
+}
+#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */
+
+#if defined _LIBC && __TIMESIZE != 64
+
+libc_hidden_def (__mktime64)
+
+time_t
+mktime (struct tm *tp)
+{
+  struct tm tm = *tp;
+  __time64_t t = __mktime64 (&tm);
+  if (in_time_t_range (t))
+    {
+      *tp = tm;
+      return t;
+    }
+  else
+    {
+      __set_errno (EOVERFLOW);
+      return -1;
+    }
+}
+
+#endif
+
+weak_alias (mktime, timelocal)
+libc_hidden_def (mktime)
+libc_hidden_weak (timelocal)
deleted file mode 120000 (symlink)
index 1c33cd03f79981d6190410d886b7920c469e117c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/modechange.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6d857a1ffd3ef5e60ba5d0ad97d6cf5c318ac319
--- /dev/null
@@ -0,0 +1,414 @@
+/* modechange.c -- file mode manipulation
+
+   Copyright (C) 1989-1990, 1997-1999, 2001, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David MacKenzie <djm@ai.mit.edu> */
+
+/* The ASCII mode string is compiled into an array of 'struct
+   modechange', which can then be applied to each file to be changed.
+   We do this instead of re-parsing the ASCII string for each file
+   because the compiled form requires less computation to use; when
+   changing the mode of many files, this probably results in a
+   performance gain.  */
+
+#include <config.h>
+
+#include "modechange.h"
+#include <sys/stat.h>
+#include "stat-macros.h"
+#include "xalloc.h"
+#include <stdlib.h>
+
+/* The traditional octal values corresponding to each mode bit.  */
+#define SUID 04000
+#define SGID 02000
+#define SVTX 01000
+#define RUSR 00400
+#define WUSR 00200
+#define XUSR 00100
+#define RGRP 00040
+#define WGRP 00020
+#define XGRP 00010
+#define ROTH 00004
+#define WOTH 00002
+#define XOTH 00001
+#define ALLM 07777 /* all octal mode bits */
+
+/* Convert OCTAL, which uses one of the traditional octal values, to
+   an internal mode_t value.  */
+static mode_t
+octal_to_mode (unsigned int octal)
+{
+  /* Help the compiler optimize the usual case where mode_t uses
+     the traditional octal representation.  */
+  return ((S_ISUID == SUID && S_ISGID == SGID && S_ISVTX == SVTX
+           && S_IRUSR == RUSR && S_IWUSR == WUSR && S_IXUSR == XUSR
+           && S_IRGRP == RGRP && S_IWGRP == WGRP && S_IXGRP == XGRP
+           && S_IROTH == ROTH && S_IWOTH == WOTH && S_IXOTH == XOTH)
+          ? octal
+          : (mode_t) ((octal & SUID ? S_ISUID : 0)
+                      | (octal & SGID ? S_ISGID : 0)
+                      | (octal & SVTX ? S_ISVTX : 0)
+                      | (octal & RUSR ? S_IRUSR : 0)
+                      | (octal & WUSR ? S_IWUSR : 0)
+                      | (octal & XUSR ? S_IXUSR : 0)
+                      | (octal & RGRP ? S_IRGRP : 0)
+                      | (octal & WGRP ? S_IWGRP : 0)
+                      | (octal & XGRP ? S_IXGRP : 0)
+                      | (octal & ROTH ? S_IROTH : 0)
+                      | (octal & WOTH ? S_IWOTH : 0)
+                      | (octal & XOTH ? S_IXOTH : 0)));
+}
+
+/* Special operations flags.  */
+enum
+  {
+    /* For the sentinel at the end of the mode changes array.  */
+    MODE_DONE,
+
+    /* The typical case.  */
+    MODE_ORDINARY_CHANGE,
+
+    /* In addition to the typical case, affect the execute bits if at
+       least one execute bit is set already, or if the file is a
+       directory.  */
+    MODE_X_IF_ANY_X,
+
+    /* Instead of the typical case, copy some existing permissions for
+       u, g, or o onto the other two.  Which of u, g, or o is copied
+       is determined by which bits are set in the 'value' field.  */
+    MODE_COPY_EXISTING
+  };
+
+/* Description of a mode change.  */
+struct mode_change
+{
+  char op;                      /* One of "=+-".  */
+  char flag;                    /* Special operations flag.  */
+  mode_t affected;              /* Set for u, g, o, or a.  */
+  mode_t value;                 /* Bits to add/remove.  */
+  mode_t mentioned;             /* Bits explicitly mentioned.  */
+};
+
+/* Return a mode_change array with the specified "=ddd"-style
+   mode change operation, where NEW_MODE is "ddd" and MENTIONED
+   contains the bits explicitly mentioned in the mode are MENTIONED.  */
+
+static struct mode_change *
+make_node_op_equals (mode_t new_mode, mode_t mentioned)
+{
+  struct mode_change *p = xmalloc (2 * sizeof *p);
+  p->op = '=';
+  p->flag = MODE_ORDINARY_CHANGE;
+  p->affected = CHMOD_MODE_BITS;
+  p->value = new_mode;
+  p->mentioned = mentioned;
+  p[1].flag = MODE_DONE;
+  return p;
+}
+
+/* Return a pointer to an array of file mode change operations created from
+   MODE_STRING, an ASCII string that contains either an octal number
+   specifying an absolute mode, or symbolic mode change operations with
+   the form:
+   [ugoa...][[+-=][rwxXstugo...]...][,...]
+
+   Return NULL if 'mode_string' does not contain a valid
+   representation of file mode change operations.  */
+
+struct mode_change *
+mode_compile (char const *mode_string)
+{
+  /* The array of mode-change directives to be returned.  */
+  struct mode_change *mc;
+  size_t used = 0;
+  char const *p;
+
+  if ('0' <= *mode_string && *mode_string < '8')
+    {
+      unsigned int octal_mode = 0;
+      mode_t mode;
+      mode_t mentioned;
+
+      p = mode_string;
+      do
+        {
+          octal_mode = 8 * octal_mode + *p++ - '0';
+          if (ALLM < octal_mode)
+            return NULL;
+        }
+      while ('0' <= *p && *p < '8');
+
+      if (*p)
+        return NULL;
+
+      mode = octal_to_mode (octal_mode);
+      mentioned = (p - mode_string < 5
+                   ? (mode & (S_ISUID | S_ISGID)) | S_ISVTX | S_IRWXUGO
+                   : CHMOD_MODE_BITS);
+      return make_node_op_equals (mode, mentioned);
+    }
+
+  /* Allocate enough space to hold the result.  */
+  {
+    size_t needed = 1;
+    for (p = mode_string; *p; p++)
+      needed += (*p == '=' || *p == '+' || *p == '-');
+    mc = xnmalloc (needed, sizeof *mc);
+  }
+
+  /* One loop iteration for each
+     '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.  */
+  for (p = mode_string; ; p++)
+    {
+      /* Which bits in the mode are operated on.  */
+      mode_t affected = 0;
+
+      /* Turn on all the bits in 'affected' for each group given.  */
+      for (;; p++)
+        switch (*p)
+          {
+          default:
+            goto invalid;
+          case 'u':
+            affected |= S_ISUID | S_IRWXU;
+            break;
+          case 'g':
+            affected |= S_ISGID | S_IRWXG;
+            break;
+          case 'o':
+            affected |= S_ISVTX | S_IRWXO;
+            break;
+          case 'a':
+            affected |= CHMOD_MODE_BITS;
+            break;
+          case '=': case '+': case '-':
+            goto no_more_affected;
+          }
+    no_more_affected:;
+
+      do
+        {
+          char op = *p++;
+          mode_t value;
+          mode_t mentioned = 0;
+          char flag = MODE_COPY_EXISTING;
+          struct mode_change *change;
+
+          switch (*p)
+            {
+            case '0': case '1': case '2': case '3':
+            case '4': case '5': case '6': case '7':
+              {
+                unsigned int octal_mode = 0;
+
+                do
+                  {
+                    octal_mode = 8 * octal_mode + *p++ - '0';
+                    if (ALLM < octal_mode)
+                      goto invalid;
+                  }
+                while ('0' <= *p && *p < '8');
+
+                if (affected || (*p && *p != ','))
+                  goto invalid;
+                affected = mentioned = CHMOD_MODE_BITS;
+                value = octal_to_mode (octal_mode);
+                flag = MODE_ORDINARY_CHANGE;
+                break;
+              }
+
+            case 'u':
+              /* Set the affected bits to the value of the "u" bits
+                 on the same file.  */
+              value = S_IRWXU;
+              p++;
+              break;
+            case 'g':
+              /* Set the affected bits to the value of the "g" bits
+                 on the same file.  */
+              value = S_IRWXG;
+              p++;
+              break;
+            case 'o':
+              /* Set the affected bits to the value of the "o" bits
+                 on the same file.  */
+              value = S_IRWXO;
+              p++;
+              break;
+
+            default:
+              value = 0;
+              flag = MODE_ORDINARY_CHANGE;
+
+              for (;; p++)
+                switch (*p)
+                  {
+                  case 'r':
+                    value |= S_IRUSR | S_IRGRP | S_IROTH;
+                    break;
+                  case 'w':
+                    value |= S_IWUSR | S_IWGRP | S_IWOTH;
+                    break;
+                  case 'x':
+                    value |= S_IXUSR | S_IXGRP | S_IXOTH;
+                    break;
+                  case 'X':
+                    flag = MODE_X_IF_ANY_X;
+                    break;
+                  case 's':
+                    /* Set the setuid/gid bits if 'u' or 'g' is selected.  */
+                    value |= S_ISUID | S_ISGID;
+                    break;
+                  case 't':
+                    /* Set the "save text image" bit if 'o' is selected.  */
+                    value |= S_ISVTX;
+                    break;
+                  default:
+                    goto no_more_values;
+                  }
+            no_more_values:;
+            }
+
+          change = &mc[used++];
+          change->op = op;
+          change->flag = flag;
+          change->affected = affected;
+          change->value = value;
+          change->mentioned =
+            (mentioned ? mentioned : affected ? affected & value : value);
+        }
+      while (*p == '=' || *p == '+' || *p == '-');
+
+      if (*p != ',')
+        break;
+    }
+
+  if (*p == 0)
+    {
+      mc[used].flag = MODE_DONE;
+      return mc;
+    }
+
+invalid:
+  free (mc);
+  return NULL;
+}
+
+/* Return a file mode change operation that sets permissions to match those
+   of REF_FILE.  Return NULL (setting errno) if REF_FILE can't be accessed.  */
+
+struct mode_change *
+mode_create_from_ref (const char *ref_file)
+{
+  struct stat ref_stats;
+
+  if (stat (ref_file, &ref_stats) != 0)
+    return NULL;
+  return make_node_op_equals (ref_stats.st_mode, CHMOD_MODE_BITS);
+}
+
+/* Return the file mode bits of OLDMODE (which is the mode of a
+   directory if DIR), assuming the umask is UMASK_VALUE, adjusted as
+   indicated by the list of change operations CHANGES.  If DIR, the
+   type 'X' change affects the returned value even if no execute bits
+   were set in OLDMODE, and set user and group ID bits are preserved
+   unless CHANGES mentioned them.  If PMODE_BITS is not null, store into
+   *PMODE_BITS a mask denoting file mode bits that are affected by
+   CHANGES.
+
+   The returned value and *PMODE_BITS contain only file mode bits.
+   For example, they have the S_IFMT bits cleared on a standard
+   Unix-like host.  */
+
+mode_t
+mode_adjust (mode_t oldmode, bool dir, mode_t umask_value,
+             struct mode_change const *changes, mode_t *pmode_bits)
+{
+  /* The adjusted mode.  */
+  mode_t newmode = oldmode & CHMOD_MODE_BITS;
+
+  /* File mode bits that CHANGES cares about.  */
+  mode_t mode_bits = 0;
+
+  for (; changes->flag != MODE_DONE; changes++)
+    {
+      mode_t affected = changes->affected;
+      mode_t omit_change =
+        (dir ? S_ISUID | S_ISGID : 0) & ~ changes->mentioned;
+      mode_t value = changes->value;
+
+      switch (changes->flag)
+        {
+        case MODE_ORDINARY_CHANGE:
+          break;
+
+        case MODE_COPY_EXISTING:
+          /* Isolate in 'value' the bits in 'newmode' to copy.  */
+          value &= newmode;
+
+          /* Copy the isolated bits to the other two parts.  */
+          value |= ((value & (S_IRUSR | S_IRGRP | S_IROTH)
+                     ? S_IRUSR | S_IRGRP | S_IROTH : 0)
+                    | (value & (S_IWUSR | S_IWGRP | S_IWOTH)
+                       ? S_IWUSR | S_IWGRP | S_IWOTH : 0)
+                    | (value & (S_IXUSR | S_IXGRP | S_IXOTH)
+                       ? S_IXUSR | S_IXGRP | S_IXOTH : 0));
+          break;
+
+        case MODE_X_IF_ANY_X:
+          /* Affect the execute bits if execute bits are already set
+             or if the file is a directory.  */
+          if ((newmode & (S_IXUSR | S_IXGRP | S_IXOTH)) | dir)
+            value |= S_IXUSR | S_IXGRP | S_IXOTH;
+          break;
+        }
+
+      /* If WHO was specified, limit the change to the affected bits.
+         Otherwise, apply the umask.  Either way, omit changes as
+         requested.  */
+      value &= (affected ? affected : ~umask_value) & ~ omit_change;
+
+      switch (changes->op)
+        {
+        case '=':
+          /* If WHO was specified, preserve the previous values of
+             bits that are not affected by this change operation.
+             Otherwise, clear all the bits.  */
+          {
+            mode_t preserved = (affected ? ~affected : 0) | omit_change;
+            mode_bits |= CHMOD_MODE_BITS & ~preserved;
+            newmode = (newmode & preserved) | value;
+            break;
+          }
+
+        case '+':
+          mode_bits |= value;
+          newmode |= value;
+          break;
+
+        case '-':
+          mode_bits |= value;
+          newmode &= ~value;
+          break;
+        }
+    }
+
+  if (pmode_bits)
+    *pmode_bits = mode_bits;
+  return newmode;
+}
deleted file mode 120000 (symlink)
index 487e555ddc8c0a8a54a63bb61975041880263502..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/modechange.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3ee0bdec9d524dff5d78467336f179299cd8449a
--- /dev/null
@@ -0,0 +1,38 @@
+/* modechange.h -- definitions for file mode manipulation
+
+   Copyright (C) 1989-1990, 1997, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if ! defined MODECHANGE_H_
+# define MODECHANGE_H_
+
+/* This file uses _GL_ATTRIBUTE_MALLOC.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <stdlib.h>
+# include <sys/types.h>
+
+struct mode_change *mode_compile (const char *)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+struct mode_change *mode_create_from_ref (const char *)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+mode_t mode_adjust (mode_t, bool, mode_t, struct mode_change const *,
+                    mode_t *)
+  _GL_ATTRIBUTE_PURE;
+
+#endif
deleted file mode 120000 (symlink)
index 5acfbb11e18466072e0841964b834b2ca806d1ea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mountlist.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..06300d6b73b03ec0646ef5cee010451326787427
--- /dev/null
+/* mountlist.c -- return a list of mounted file systems
+
+   Copyright (C) 1991-1992, 1997-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "mountlist.h"
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+#include "xalloc.h"
+
+#include <errno.h>
+
+#include <fcntl.h>
+
+#include <unistd.h>
+
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+#if MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#elif MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
+#if defined MOUNTED_GETFSSTAT   /* OSF/1, also (obsolete) Apple Darwin 1.3 */
+# if HAVE_SYS_UCRED_H
+#  include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
+                      NGROUPS is used as an array dimension in ucred.h */
+#  include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
+# endif
+# if HAVE_SYS_MOUNT_H
+#  include <sys/mount.h>
+# endif
+# if HAVE_SYS_FS_TYPES_H
+#  include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
+# endif
+# if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
+#  define FS_TYPE(Ent) ((Ent).f_fstypename)
+# else
+#  define FS_TYPE(Ent) mnt_names[(Ent).f_type]
+# endif
+#endif /* MOUNTED_GETFSSTAT */
+
+#ifdef MOUNTED_GETMNTENT1       /* glibc, HP-UX, IRIX, Cygwin, Android,
+                                   also (obsolete) 4.3BSD, SunOS */
+# include <mntent.h>
+# include <sys/types.h>
+# if defined __ANDROID__        /* Android */
+   /* Bionic versions from between 2014-01-09 and 2015-01-08 define MOUNTED to
+      an incorrect value; older Bionic versions don't define it at all.  */
+#  undef MOUNTED
+#  define MOUNTED "/proc/mounts"
+# elif !defined MOUNTED
+#  if defined _PATH_MOUNTED     /* GNU libc  */
+#   define MOUNTED _PATH_MOUNTED
+#  endif
+#  if defined MNT_MNTTAB        /* HP-UX.  */
+#   define MOUNTED MNT_MNTTAB
+#  endif
+# endif
+#endif
+
+#ifdef MOUNTED_GETMNTINFO       /* Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD */
+# include <sys/mount.h>
+#endif
+
+#ifdef MOUNTED_GETMNTINFO2      /* NetBSD, Minix */
+# include <sys/statvfs.h>
+#endif
+
+#ifdef MOUNTED_FS_STAT_DEV      /* Haiku, also (obsolete) BeOS */
+# include <fs_info.h>
+# include <dirent.h>
+#endif
+
+#ifdef MOUNTED_FREAD_FSTYP      /* (obsolete) SVR3 */
+# include <mnttab.h>
+# include <sys/fstyp.h>
+# include <sys/statfs.h>
+#endif
+
+#ifdef MOUNTED_GETEXTMNTENT     /* Solaris >= 8 */
+# include <sys/mnttab.h>
+#endif
+
+#ifdef MOUNTED_GETMNTENT2       /* Solaris < 8, also (obsolete) SVR4 */
+# include <sys/mnttab.h>
+#endif
+
+#ifdef MOUNTED_VMOUNT           /* AIX */
+# include <fshelp.h>
+# include <sys/vfs.h>
+#endif
+
+#ifdef MOUNTED_INTERIX_STATVFS  /* Interix */
+# include <sys/statvfs.h>
+# include <dirent.h>
+#endif
+
+#if HAVE_SYS_MNTENT_H
+/* This is to get MNTOPT_IGNORE on e.g. SVR4.  */
+# include <sys/mntent.h>
+#endif
+
+#ifdef MOUNTED_GETMNTENT1
+# if !HAVE_SETMNTENT            /* Android <= 4.4 */
+#  define setmntent(fp,mode) fopen (fp, mode "e")
+# endif
+# if !HAVE_ENDMNTENT            /* Android <= 4.4 */
+#  define endmntent(fp) fclose (fp)
+# endif
+#endif
+
+#ifndef HAVE_HASMNTOPT
+# define hasmntopt(mnt, opt) ((char *) 0)
+#endif
+
+#undef MNT_IGNORE
+#ifdef MNTOPT_IGNORE
+# if defined __sun && defined __SVR4
+/* Solaris defines hasmntopt(struct mnttab *, char *)
+   while it is otherwise hasmntopt(struct mnttab *, const char *).  */
+#  define MNT_IGNORE(M) hasmntopt (M, (char *) MNTOPT_IGNORE)
+# else
+#  define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE)
+# endif
+#else
+# define MNT_IGNORE(M) 0
+#endif
+
+/* Each of the FILE streams in this file is only used in a single thread.  */
+#include "unlocked-io.h"
+
+/* The results of opendir() in this file are not used with dirfd and fchdir,
+   therefore save some unnecessary work in fchdir.c.  */
+#ifdef GNULIB_defined_DIR
+# undef DIR
+# undef opendir
+# undef closedir
+# undef readdir
+#else
+# ifdef GNULIB_defined_opendir
+#  undef opendir
+# endif
+# ifdef GNULIB_defined_closedir
+#  undef closedir
+# endif
+#endif
+
+#define ME_DUMMY_0(Fs_name, Fs_type)            \
+  (strcmp (Fs_type, "autofs") == 0              \
+   || strcmp (Fs_type, "proc") == 0             \
+   || strcmp (Fs_type, "subfs") == 0            \
+   /* for Linux 2.6/3.x */                      \
+   || strcmp (Fs_type, "debugfs") == 0          \
+   || strcmp (Fs_type, "devpts") == 0           \
+   || strcmp (Fs_type, "fusectl") == 0          \
+   || strcmp (Fs_type, "fuse.portal") == 0      \
+   || strcmp (Fs_type, "mqueue") == 0           \
+   || strcmp (Fs_type, "rpc_pipefs") == 0       \
+   || strcmp (Fs_type, "sysfs") == 0            \
+   /* FreeBSD, Linux 2.4 */                     \
+   || strcmp (Fs_type, "devfs") == 0            \
+   /* for NetBSD 3.0 */                         \
+   || strcmp (Fs_type, "kernfs") == 0           \
+   /* for Irix 6.5 */                           \
+   || strcmp (Fs_type, "ignore") == 0)
+
+/* Historically, we have marked as "dummy" any file system of type "none",
+   but now that programs like du need to know about bind-mounted directories,
+   we grant an exception to any with "bind" in its list of mount options.
+   I.e., those are *not* dummy entries.  */
+#ifdef MOUNTED_GETMNTENT1
+# define ME_DUMMY(Fs_name, Fs_type, Bind) \
+  (ME_DUMMY_0 (Fs_name, Fs_type) \
+   || (strcmp (Fs_type, "none") == 0 && !Bind))
+#else
+# define ME_DUMMY(Fs_name, Fs_type) \
+  (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0)
+#endif
+
+#ifdef __CYGWIN__
+# include <windows.h>
+/* Don't assume that UNICODE is not defined.  */
+# undef GetDriveType
+# define GetDriveType GetDriveTypeA
+# define ME_REMOTE me_remote
+/* All cygwin mount points include ':' or start with '//'; so it
+   requires a native Windows call to determine remote disks.  */
+static bool
+me_remote (char const *fs_name, _GL_UNUSED char const *fs_type)
+{
+  if (fs_name[0] && fs_name[1] == ':')
+    {
+      char drive[4];
+      sprintf (drive, "%c:\\", fs_name[0]);
+      switch (GetDriveType (drive))
+        {
+        case DRIVE_REMOVABLE:
+        case DRIVE_FIXED:
+        case DRIVE_CDROM:
+        case DRIVE_RAMDISK:
+          return false;
+        }
+    }
+  return true;
+}
+#endif
+
+#ifndef ME_REMOTE
+/* A file system is "remote" if its Fs_name contains a ':'
+   or if (it is of type (smbfs or cifs) and its Fs_name starts with '//')
+   or if it is of any other of the listed types
+   or Fs_name is equal to "-hosts" (used by autofs to mount remote fs).
+   "VM" file systems like prl_fs or vboxsf are not considered remote here. */
+# define ME_REMOTE(Fs_name, Fs_type)            \
+    (strchr (Fs_name, ':') != NULL              \
+     || ((Fs_name)[0] == '/'                    \
+         && (Fs_name)[1] == '/'                 \
+         && (strcmp (Fs_type, "smbfs") == 0     \
+             || strcmp (Fs_type, "smb3") == 0   \
+             || strcmp (Fs_type, "cifs") == 0)) \
+     || strcmp (Fs_type, "acfs") == 0           \
+     || strcmp (Fs_type, "afs") == 0            \
+     || strcmp (Fs_type, "coda") == 0           \
+     || strcmp (Fs_type, "auristorfs") == 0     \
+     || strcmp (Fs_type, "fhgfs") == 0          \
+     || strcmp (Fs_type, "gpfs") == 0           \
+     || strcmp (Fs_type, "ibrix") == 0          \
+     || strcmp (Fs_type, "ocfs2") == 0          \
+     || strcmp (Fs_type, "vxfs") == 0           \
+     || strcmp ("-hosts", Fs_name) == 0)
+#endif
+
+#if MOUNTED_GETMNTINFO          /* Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD */
+
+# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME
+static char *
+fstype_to_string (short int t)
+{
+  switch (t)
+    {
+#  ifdef MOUNT_PC
+    case MOUNT_PC:
+      return "pc";
+#  endif
+#  ifdef MOUNT_MFS
+    case MOUNT_MFS:
+      return "mfs";
+#  endif
+#  ifdef MOUNT_LO
+    case MOUNT_LO:
+      return "lo";
+#  endif
+#  ifdef MOUNT_TFS
+    case MOUNT_TFS:
+      return "tfs";
+#  endif
+#  ifdef MOUNT_TMP
+    case MOUNT_TMP:
+      return "tmp";
+#  endif
+#  ifdef MOUNT_UFS
+   case MOUNT_UFS:
+     return "ufs" ;
+#  endif
+#  ifdef MOUNT_NFS
+   case MOUNT_NFS:
+     return "nfs" ;
+#  endif
+#  ifdef MOUNT_MSDOS
+   case MOUNT_MSDOS:
+     return "msdos" ;
+#  endif
+#  ifdef MOUNT_LFS
+   case MOUNT_LFS:
+     return "lfs" ;
+#  endif
+#  ifdef MOUNT_LOFS
+   case MOUNT_LOFS:
+     return "lofs" ;
+#  endif
+#  ifdef MOUNT_FDESC
+   case MOUNT_FDESC:
+     return "fdesc" ;
+#  endif
+#  ifdef MOUNT_PORTAL
+   case MOUNT_PORTAL:
+     return "portal" ;
+#  endif
+#  ifdef MOUNT_NULL
+   case MOUNT_NULL:
+     return "null" ;
+#  endif
+#  ifdef MOUNT_UMAP
+   case MOUNT_UMAP:
+     return "umap" ;
+#  endif
+#  ifdef MOUNT_KERNFS
+   case MOUNT_KERNFS:
+     return "kernfs" ;
+#  endif
+#  ifdef MOUNT_PROCFS
+   case MOUNT_PROCFS:
+     return "procfs" ;
+#  endif
+#  ifdef MOUNT_AFS
+   case MOUNT_AFS:
+     return "afs" ;
+#  endif
+#  ifdef MOUNT_CD9660
+   case MOUNT_CD9660:
+     return "cd9660" ;
+#  endif
+#  ifdef MOUNT_UNION
+   case MOUNT_UNION:
+     return "union" ;
+#  endif
+#  ifdef MOUNT_DEVFS
+   case MOUNT_DEVFS:
+     return "devfs" ;
+#  endif
+#  ifdef MOUNT_EXT2FS
+   case MOUNT_EXT2FS:
+     return "ext2fs" ;
+#  endif
+    default:
+      return "?";
+    }
+}
+# endif
+
+static char *
+fsp_to_string (const struct statfs *fsp)
+{
+# if HAVE_STRUCT_STATFS_F_FSTYPENAME
+  return (char *) (fsp->f_fstypename);
+# else
+  return fstype_to_string (fsp->f_type);
+# endif
+}
+
+#endif /* MOUNTED_GETMNTINFO */
+
+#ifdef MOUNTED_VMOUNT           /* AIX */
+static char *
+fstype_to_string (int t)
+{
+  struct vfs_ent *e;
+
+  e = getvfsbytype (t);
+  if (!e || !e->vfsent_name)
+    return "none";
+  else
+    return e->vfsent_name;
+}
+#endif /* MOUNTED_VMOUNT */
+
+
+#if defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2
+
+/* Return the device number from MOUNT_OPTIONS, if possible.
+   Otherwise return (dev_t) -1.  */
+static dev_t
+dev_from_mount_options (char const *mount_options)
+{
+  /* GNU/Linux allows file system implementations to define their own
+     meaning for "dev=" mount options, so don't trust the meaning
+     here.  */
+# ifndef __linux__
+
+  static char const dev_pattern[] = ",dev=";
+  char const *devopt = strstr (mount_options, dev_pattern);
+
+  if (devopt)
+    {
+      char const *optval = devopt + sizeof dev_pattern - 1;
+      char *optvalend;
+      unsigned long int dev;
+      errno = 0;
+      dev = strtoul (optval, &optvalend, 16);
+      if (optval != optvalend
+          && (*optvalend == '\0' || *optvalend == ',')
+          && ! (dev == ULONG_MAX && errno == ERANGE)
+          && dev == (dev_t) dev)
+        return dev;
+    }
+
+# endif
+  (void) mount_options;
+  return -1;
+}
+
+#endif
+
+#if defined MOUNTED_GETMNTENT1 && (defined __linux__ || defined __ANDROID__) /* GNU/Linux, Android */
+
+/* Unescape the paths in mount tables.
+   STR is updated in place.  */
+
+static void
+unescape_tab (char *str)
+{
+  size_t i, j = 0;
+  size_t len = strlen (str) + 1;
+  for (i = 0; i < len; i++)
+    {
+      if (str[i] == '\\' && (i + 4 < len)
+          && str[i + 1] >= '0' && str[i + 1] <= '3'
+          && str[i + 2] >= '0' && str[i + 2] <= '7'
+          && str[i + 3] >= '0' && str[i + 3] <= '7')
+        {
+          str[j++] = (str[i + 1] - '0') * 64 +
+                     (str[i + 2] - '0') * 8 +
+                     (str[i + 3] - '0');
+          i += 3;
+        }
+      else
+        str[j++] = str[i];
+    }
+}
+
+/* Find the next space in STR, terminate the string there in place,
+   and return that position.  Otherwise return NULL.  */
+
+static char *
+terminate_at_blank (char *str)
+{
+  char *s = strchr (str, ' ');
+  if (s)
+    *s = '\0';
+  return s;
+}
+#endif
+
+/* Return a list of the currently mounted file systems, or NULL on error.
+   Add each entry to the tail of the list so that they stay in order.
+   If NEED_FS_TYPE is true, ensure that the file system type fields in
+   the returned list are valid.  Otherwise, they might not be.  */
+
+struct mount_entry *
+read_file_system_list (bool need_fs_type)
+{
+  struct mount_entry *mount_list;
+  struct mount_entry *me;
+  struct mount_entry **mtail = &mount_list;
+  (void) need_fs_type;
+
+#ifdef MOUNTED_GETMNTENT1       /* glibc, HP-UX, IRIX, Cygwin, Android,
+                                   also (obsolete) 4.3BSD, SunOS */
+  {
+    FILE *fp;
+
+# if defined __linux__ || defined __ANDROID__
+    /* Try parsing mountinfo first, as that make device IDs available.
+       Note we could use libmount routines to simplify this parsing a little
+       (and that code is in previous versions of this function), however
+       libmount depends on libselinux which pulls in many dependencies.  */
+    char const *mountinfo = "/proc/self/mountinfo";
+    fp = fopen (mountinfo, "re");
+    if (fp != NULL)
+      {
+        char *line = NULL;
+        size_t buf_size = 0;
+
+        while (getline (&line, &buf_size, fp) != -1)
+          {
+            unsigned int devmaj, devmin;
+            int rc, mntroot_s;
+
+            rc = sscanf(line, "%*u "        /* id - discarded  */
+                              "%*u "        /* parent - discarded  */
+                              "%u:%u "      /* dev major:minor  */
+                              "%n",         /* mountroot (start)  */
+                              &devmaj, &devmin,
+                              &mntroot_s);
+
+            if (rc != 2 && rc != 3)  /* 3 if %n included in count.  */
+              continue;
+
+            /* find end of MNTROOT.  */
+            char *mntroot = line + mntroot_s;
+            char *blank = terminate_at_blank (mntroot);
+            if (! blank)
+              continue;
+
+            /* find end of TARGET.  */
+            char *target = blank + 1;
+            blank = terminate_at_blank (target);
+            if (! blank)
+              continue;
+
+            /* skip optional fields, terminated by " - "  */
+            char *dash = strstr (blank + 1, " - ");
+            if (! dash)
+              continue;
+
+            /* advance past the " - " separator.  */
+            char *fstype = dash + 3;
+            blank = terminate_at_blank (fstype);
+            if (! blank)
+              continue;
+
+            /* find end of SOURCE.  */
+            char *source = blank + 1;
+            if (! terminate_at_blank (source))
+              continue;
+
+            /* manipulate the sub-strings in place.  */
+            unescape_tab (source);
+            unescape_tab (target);
+            unescape_tab (mntroot);
+            unescape_tab (fstype);
+
+            me = xmalloc (sizeof *me);
+
+            me->me_devname = xstrdup (source);
+            me->me_mountdir = xstrdup (target);
+            me->me_mntroot = xstrdup (mntroot);
+            me->me_type = xstrdup (fstype);
+            me->me_type_malloced = 1;
+            me->me_dev = makedev (devmaj, devmin);
+            /* we pass "false" for the "Bind" option as that's only
+               significant when the Fs_type is "none" which will not be
+               the case when parsing "/proc/self/mountinfo", and only
+               applies for static /etc/mtab files.  */
+            me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, false);
+            me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+
+            /* Add to the linked list. */
+            *mtail = me;
+            mtail = &me->me_next;
+          }
+
+        free (line);
+
+        if (ferror (fp))
+          {
+            int saved_errno = errno;
+            fclose (fp);
+            errno = saved_errno;
+            goto free_then_fail;
+          }
+
+        if (fclose (fp) == EOF)
+          goto free_then_fail;
+      }
+    else /* fallback to /proc/self/mounts (/etc/mtab).  */
+# endif /* __linux __ || __ANDROID__ */
+      {
+        struct mntent *mnt;
+        char const *table = MOUNTED;
+
+        fp = setmntent (table, "r");
+        if (fp == NULL)
+          return NULL;
+
+        while ((mnt = getmntent (fp)))
+          {
+            bool bind = hasmntopt (mnt, "bind");
+
+            me = xmalloc (sizeof *me);
+            me->me_devname = xstrdup (mnt->mnt_fsname);
+            me->me_mountdir = xstrdup (mnt->mnt_dir);
+            me->me_mntroot = NULL;
+            me->me_type = xstrdup (mnt->mnt_type);
+            me->me_type_malloced = 1;
+            me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, bind);
+            me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+            me->me_dev = dev_from_mount_options (mnt->mnt_opts);
+
+            /* Add to the linked list. */
+            *mtail = me;
+            mtail = &me->me_next;
+          }
+
+        if (endmntent (fp) == 0)
+          goto free_then_fail;
+      }
+  }
+#endif /* MOUNTED_GETMNTENT1. */
+
+#ifdef MOUNTED_GETMNTINFO       /* Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD */
+  {
+    struct statfs *fsp;
+    int entries;
+
+    entries = getmntinfo (&fsp, MNT_NOWAIT);
+    if (entries < 0)
+      return NULL;
+    for (; entries-- > 0; fsp++)
+      {
+        char *fs_type = fsp_to_string (fsp);
+
+        me = xmalloc (sizeof *me);
+        me->me_devname = xstrdup (fsp->f_mntfromname);
+        me->me_mountdir = xstrdup (fsp->f_mntonname);
+        me->me_mntroot = NULL;
+        me->me_type = fs_type;
+        me->me_type_malloced = 0;
+        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
+        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+        me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
+
+        /* Add to the linked list. */
+        *mtail = me;
+        mtail = &me->me_next;
+      }
+  }
+#endif /* MOUNTED_GETMNTINFO */
+
+#ifdef MOUNTED_GETMNTINFO2      /* NetBSD, Minix */
+  {
+    struct statvfs *fsp;
+    int entries;
+
+    entries = getmntinfo (&fsp, MNT_NOWAIT);
+    if (entries < 0)
+      return NULL;
+    for (; entries-- > 0; fsp++)
+      {
+        me = xmalloc (sizeof *me);
+        me->me_devname = xstrdup (fsp->f_mntfromname);
+        me->me_mountdir = xstrdup (fsp->f_mntonname);
+        me->me_mntroot = NULL;
+        me->me_type = xstrdup (fsp->f_fstypename);
+        me->me_type_malloced = 1;
+        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
+        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+        me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
+
+        /* Add to the linked list. */
+        *mtail = me;
+        mtail = &me->me_next;
+      }
+  }
+#endif /* MOUNTED_GETMNTINFO2 */
+
+#if defined MOUNTED_FS_STAT_DEV /* Haiku, also (obsolete) BeOS */
+  {
+    /* The next_dev() and fs_stat_dev() system calls give the list of
+       all file systems, including the information returned by statvfs()
+       (fs type, total blocks, free blocks etc.), but without the mount
+       point. But on BeOS all file systems except / are mounted in the
+       rootfs, directly under /.
+       The directory name of the mount point is often, but not always,
+       identical to the volume name of the device.
+       We therefore get the list of subdirectories of /, and the list
+       of all file systems, and match the two lists.  */
+
+    DIR *dirp;
+    struct rootdir_entry
+      {
+        char *name;
+        dev_t dev;
+        ino_t ino;
+        struct rootdir_entry *next;
+      };
+    struct rootdir_entry *rootdir_list;
+    struct rootdir_entry **rootdir_tail;
+    int32 pos;
+    dev_t dev;
+    fs_info fi;
+
+    /* All volumes are mounted in the rootfs, directly under /. */
+    rootdir_list = NULL;
+    rootdir_tail = &rootdir_list;
+    dirp = opendir ("/");
+    if (dirp)
+      {
+        struct dirent *d;
+
+        while ((d = readdir (dirp)) != NULL)
+          {
+            char *name;
+            struct stat statbuf;
+
+            if (strcmp (d->d_name, "..") == 0)
+              continue;
+
+            if (strcmp (d->d_name, ".") == 0)
+              name = xstrdup ("/");
+            else
+              {
+                name = xmalloc (1 + strlen (d->d_name) + 1);
+                name[0] = '/';
+                strcpy (name + 1, d->d_name);
+              }
+
+            if (lstat (name, &statbuf) >= 0 && S_ISDIR (statbuf.st_mode))
+              {
+                struct rootdir_entry *re = xmalloc (sizeof *re);
+                re->name = name;
+                re->dev = statbuf.st_dev;
+                re->ino = statbuf.st_ino;
+
+                /* Add to the linked list.  */
+                *rootdir_tail = re;
+                rootdir_tail = &re->next;
+              }
+            else
+              free (name);
+          }
+        closedir (dirp);
+      }
+    *rootdir_tail = NULL;
+
+    for (pos = 0; (dev = next_dev (&pos)) >= 0; )
+      if (fs_stat_dev (dev, &fi) >= 0)
+        {
+          /* Note: fi.dev == dev. */
+          struct rootdir_entry *re;
+
+          for (re = rootdir_list; re; re = re->next)
+            if (re->dev == fi.dev && re->ino == fi.root)
+              break;
+
+          me = xmalloc (sizeof *me);
+          me->me_devname = xstrdup (fi.device_name[0] != '\0'
+                                    ? fi.device_name : fi.fsh_name);
+          me->me_mountdir = xstrdup (re != NULL ? re->name : fi.fsh_name);
+          me->me_mntroot = NULL;
+          me->me_type = xstrdup (fi.fsh_name);
+          me->me_type_malloced = 1;
+          me->me_dev = fi.dev;
+          me->me_dummy = 0;
+          me->me_remote = (fi.flags & B_FS_IS_SHARED) != 0;
+
+          /* Add to the linked list. */
+          *mtail = me;
+          mtail = &me->me_next;
+        }
+    *mtail = NULL;
+
+    while (rootdir_list != NULL)
+      {
+        struct rootdir_entry *re = rootdir_list;
+        rootdir_list = re->next;
+        free (re->name);
+        free (re);
+      }
+  }
+#endif /* MOUNTED_FS_STAT_DEV */
+
+#if defined MOUNTED_GETFSSTAT   /* OSF/1, also (obsolete) Apple Darwin 1.3 */
+  {
+    int numsys, counter;
+    size_t bufsize;
+    struct statfs *stats;
+
+    numsys = getfsstat (NULL, 0L, MNT_NOWAIT);
+    if (numsys < 0)
+      return NULL;
+    if (SIZE_MAX / sizeof *stats <= numsys)
+      xalloc_die ();
+
+    bufsize = (1 + numsys) * sizeof *stats;
+    stats = xmalloc (bufsize);
+    numsys = getfsstat (stats, bufsize, MNT_NOWAIT);
+
+    if (numsys < 0)
+      {
+        free (stats);
+        return NULL;
+      }
+
+    for (counter = 0; counter < numsys; counter++)
+      {
+        me = xmalloc (sizeof *me);
+        me->me_devname = xstrdup (stats[counter].f_mntfromname);
+        me->me_mountdir = xstrdup (stats[counter].f_mntonname);
+        me->me_mntroot = NULL;
+        me->me_type = xstrdup (FS_TYPE (stats[counter]));
+        me->me_type_malloced = 1;
+        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
+        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+        me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
+
+        /* Add to the linked list. */
+        *mtail = me;
+        mtail = &me->me_next;
+      }
+
+    free (stats);
+  }
+#endif /* MOUNTED_GETFSSTAT */
+
+#if defined MOUNTED_FREAD_FSTYP /* (obsolete) SVR3 */
+  {
+    struct mnttab mnt;
+    char *table = "/etc/mnttab";
+    FILE *fp;
+
+    fp = fopen (table, "re");
+    if (fp == NULL)
+      return NULL;
+
+    while (fread (&mnt, sizeof mnt, 1, fp) > 0)
+      {
+        me = xmalloc (sizeof *me);
+        me->me_devname = xstrdup (mnt.mt_dev);
+        me->me_mountdir = xstrdup (mnt.mt_filsys);
+        me->me_mntroot = NULL;
+        me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
+        me->me_type = "";
+        me->me_type_malloced = 0;
+        if (need_fs_type)
+          {
+            struct statfs fsd;
+            char typebuf[FSTYPSZ];
+
+            if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
+                && sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
+              {
+                me->me_type = xstrdup (typebuf);
+                me->me_type_malloced = 1;
+              }
+          }
+        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
+        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+
+        /* Add to the linked list. */
+        *mtail = me;
+        mtail = &me->me_next;
+      }
+
+    if (ferror (fp))
+      {
+        /* The last fread() call must have failed.  */
+        int saved_errno = errno;
+        fclose (fp);
+        errno = saved_errno;
+        goto free_then_fail;
+      }
+
+    if (fclose (fp) == EOF)
+      goto free_then_fail;
+  }
+#endif /* MOUNTED_FREAD_FSTYP.  */
+
+#ifdef MOUNTED_GETEXTMNTENT     /* Solaris >= 8 */
+  {
+    struct extmnttab mnt;
+    const char *table = MNTTAB;
+    FILE *fp;
+    int ret;
+
+    /* No locking is needed, because the contents of /etc/mnttab is generated
+       by the kernel.  */
+
+    errno = 0;
+    fp = fopen (table, "re");
+    if (fp == NULL)
+      ret = errno;
+    else
+      {
+        while ((ret = getextmntent (fp, &mnt, 1)) == 0)
+          {
+            me = xmalloc (sizeof *me);
+            me->me_devname = xstrdup (mnt.mnt_special);
+            me->me_mountdir = xstrdup (mnt.mnt_mountp);
+            me->me_mntroot = NULL;
+            me->me_type = xstrdup (mnt.mnt_fstype);
+            me->me_type_malloced = 1;
+            me->me_dummy = MNT_IGNORE (&mnt) != 0;
+            me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+            me->me_dev = makedev (mnt.mnt_major, mnt.mnt_minor);
+
+            /* Add to the linked list. */
+            *mtail = me;
+            mtail = &me->me_next;
+          }
+
+        ret = fclose (fp) == EOF ? errno : 0 < ret ? 0 : -1;
+        /* Here ret = -1 means success, ret >= 0 means failure.  */
+      }
+
+    if (0 <= ret)
+      {
+        errno = ret;
+        goto free_then_fail;
+      }
+  }
+#endif /* MOUNTED_GETEXTMNTENT */
+
+#ifdef MOUNTED_GETMNTENT2       /* Solaris < 8, also (obsolete) SVR4 */
+  {
+    struct mnttab mnt;
+    const char *table = MNTTAB;
+    FILE *fp;
+    int ret;
+    int lockfd = -1;
+
+# if defined F_RDLCK && defined F_SETLKW
+    /* MNTTAB_LOCK is a macro name of our own invention; it's not present in
+       e.g. Solaris 2.6.  If the SVR4 folks ever define a macro
+       for this file name, we should use their macro name instead.
+       (Why not just lock MNTTAB directly?  We don't know.)  */
+#  ifndef MNTTAB_LOCK
+#   define MNTTAB_LOCK "/etc/.mnttab.lock"
+#  endif
+    lockfd = open (MNTTAB_LOCK, O_RDONLY | O_CLOEXEC);
+    if (0 <= lockfd)
+      {
+        struct flock flock;
+        flock.l_type = F_RDLCK;
+        flock.l_whence = SEEK_SET;
+        flock.l_start = 0;
+        flock.l_len = 0;
+        while (fcntl (lockfd, F_SETLKW, &flock) == -1)
+          if (errno != EINTR)
+            {
+              int saved_errno = errno;
+              close (lockfd);
+              errno = saved_errno;
+              return NULL;
+            }
+      }
+    else if (errno != ENOENT)
+      return NULL;
+# endif
+
+    errno = 0;
+    fp = fopen (table, "re");
+    if (fp == NULL)
+      ret = errno;
+    else
+      {
+        while ((ret = getmntent (fp, &mnt)) == 0)
+          {
+            me = xmalloc (sizeof *me);
+            me->me_devname = xstrdup (mnt.mnt_special);
+            me->me_mountdir = xstrdup (mnt.mnt_mountp);
+            me->me_mntroot = NULL;
+            me->me_type = xstrdup (mnt.mnt_fstype);
+            me->me_type_malloced = 1;
+            me->me_dummy = MNT_IGNORE (&mnt) != 0;
+            me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+            me->me_dev = dev_from_mount_options (mnt.mnt_mntopts);
+
+            /* Add to the linked list. */
+            *mtail = me;
+            mtail = &me->me_next;
+          }
+
+        ret = fclose (fp) == EOF ? errno : 0 < ret ? 0 : -1;
+        /* Here ret = -1 means success, ret >= 0 means failure.  */
+      }
+
+    if (0 <= lockfd && close (lockfd) != 0)
+      ret = errno;
+
+    if (0 <= ret)
+      {
+        errno = ret;
+        goto free_then_fail;
+      }
+  }
+#endif /* MOUNTED_GETMNTENT2.  */
+
+#ifdef MOUNTED_VMOUNT           /* AIX */
+  {
+    int bufsize;
+    void *entries;
+    char *thisent;
+    struct vmount *vmp;
+    int n_entries;
+    int i;
+
+    /* Ask how many bytes to allocate for the mounted file system info.  */
+    entries = &bufsize;
+    if (mntctl (MCTL_QUERY, sizeof bufsize, entries) != 0)
+      return NULL;
+    entries = xmalloc (bufsize);
+
+    /* Get the list of mounted file systems.  */
+    n_entries = mntctl (MCTL_QUERY, bufsize, entries);
+    if (n_entries < 0)
+      {
+        free (entries);
+        return NULL;
+      }
+
+    for (i = 0, thisent = entries;
+         i < n_entries;
+         i++, thisent += vmp->vmt_length)
+      {
+        char *options, *ignore;
+
+        vmp = (struct vmount *) thisent;
+        me = xmalloc (sizeof *me);
+        if (vmp->vmt_flags & MNT_REMOTE)
+          {
+            char *host, *dir;
+
+            me->me_remote = 1;
+            /* Prepend the remote dirname.  */
+            host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off;
+            dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off;
+            me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2);
+            strcpy (me->me_devname, host);
+            strcat (me->me_devname, ":");
+            strcat (me->me_devname, dir);
+          }
+        else
+          {
+            me->me_remote = 0;
+            me->me_devname = xstrdup (thisent +
+                                      vmp->vmt_data[VMT_OBJECT].vmt_off);
+          }
+        me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
+        me->me_mntroot = NULL;
+        me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
+        me->me_type_malloced = 1;
+        options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
+        ignore = strstr (options, "ignore");
+        me->me_dummy = (ignore
+                        && (ignore == options || ignore[-1] == ',')
+                        && (ignore[sizeof "ignore" - 1] == ','
+                            || ignore[sizeof "ignore" - 1] == '\0'));
+        me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want.  */
+
+        /* Add to the linked list. */
+        *mtail = me;
+        mtail = &me->me_next;
+      }
+    free (entries);
+  }
+#endif /* MOUNTED_VMOUNT. */
+
+#ifdef MOUNTED_INTERIX_STATVFS  /* Interix */
+  {
+    DIR *dirp = opendir ("/dev/fs");
+    char node[9 + NAME_MAX];
+
+    if (!dirp)
+      goto free_then_fail;
+
+    while (1)
+      {
+        struct statvfs dev;
+        struct dirent entry;
+        struct dirent *result;
+
+        /* FIXME: readdir_r is planned to be withdrawn from POSIX and
+           marked obsolescent in glibc.  Use readdir instead.  */
+        if (readdir_r (dirp, &entry, &result) || result == NULL)
+          break;
+
+        strcpy (node, "/dev/fs/");
+        strcat (node, entry.d_name);
+
+        if (statvfs (node, &dev) == 0)
+          {
+            me = xmalloc (sizeof *me);
+            me->me_devname = xstrdup (dev.f_mntfromname);
+            me->me_mountdir = xstrdup (dev.f_mntonname);
+            me->me_mntroot = NULL;
+            me->me_type = xstrdup (dev.f_fstypename);
+            me->me_type_malloced = 1;
+            me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
+            me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+            me->me_dev = (dev_t) -1;        /* Magic; means not known yet. */
+
+            /* Add to the linked list. */
+            *mtail = me;
+            mtail = &me->me_next;
+          }
+      }
+    closedir (dirp);
+  }
+#endif /* MOUNTED_INTERIX_STATVFS */
+
+  *mtail = NULL;
+  return mount_list;
+
+
+ free_then_fail: _GL_UNUSED_LABEL;
+  {
+    int saved_errno = errno;
+    *mtail = NULL;
+
+    while (mount_list)
+      {
+        me = mount_list->me_next;
+        free_mount_entry (mount_list);
+        mount_list = me;
+      }
+
+    errno = saved_errno;
+    return NULL;
+  }
+}
+
+/* Free a mount entry as returned from read_file_system_list ().  */
+
+void
+free_mount_entry (struct mount_entry *me)
+{
+  free (me->me_devname);
+  free (me->me_mountdir);
+  free (me->me_mntroot);
+  if (me->me_type_malloced)
+    free (me->me_type);
+  free (me);
+}
deleted file mode 120000 (symlink)
index b1cdc939d8e895b2b2a327c323b4b82d70dd7dc7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mountlist.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..70b572a6982b5e630e95ac25030c98097f7e52f2
--- /dev/null
@@ -0,0 +1,48 @@
+/* mountlist.h -- declarations for list of mounted file systems
+
+   Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef MOUNTLIST_H_
+# define MOUNTLIST_H_
+
+/* This file uses _GL_ATTRIBUTE_MALLOC.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <sys/types.h>
+
+/* A mount table entry. */
+struct mount_entry
+{
+  char *me_devname;             /* Device node name, including "/dev/". */
+  char *me_mountdir;            /* Mount point directory name. */
+  char *me_mntroot;             /* Directory on filesystem of device used */
+                                /* as root for the (bind) mount. */
+  char *me_type;                /* "nfs", "4.2", etc. */
+  dev_t me_dev;                 /* Device number of me_mountdir. */
+  unsigned int me_dummy : 1;    /* Nonzero for dummy file systems. */
+  unsigned int me_remote : 1;   /* Nonzero for remote file systems. */
+  unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */
+  struct mount_entry *me_next;
+};
+
+struct mount_entry *read_file_system_list (bool need_fs_type)
+  _GL_ATTRIBUTE_MALLOC;
+void free_mount_entry (struct mount_entry *entry);
+
+#endif
deleted file mode 120000 (symlink)
index 962694c05fd70801ae8642aaab92fb2986325b00..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mpsort.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0f9eaccd83c6d5c31d68f2681e4744b08360f359
--- /dev/null
@@ -0,0 +1,156 @@
+/* Sort a vector of pointers to data.
+
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "mpsort.h"
+
+#include <string.h>
+
+/* The type of qsort-style comparison functions.  */
+
+typedef int (*comparison_function) (void const *, void const *);
+
+static void mpsort_with_tmp (void const **restrict, size_t,
+                             void const **restrict, comparison_function);
+
+/* Sort a vector BASE containing N pointers, placing the sorted array
+   into TMP.  Compare pointers with CMP.  N must be at least 2.  */
+
+static void
+mpsort_into_tmp (void const **restrict base, size_t n,
+                 void const **restrict tmp,
+                 comparison_function cmp)
+{
+  size_t n1 = n / 2;
+  size_t n2 = n - n1;
+  size_t a = 0;
+  size_t alim = n1;
+  size_t b = n1;
+  size_t blim = n;
+  void const *ba;
+  void const *bb;
+
+  mpsort_with_tmp (base + n1, n2, tmp, cmp);
+  mpsort_with_tmp (base, n1, tmp, cmp);
+
+  ba = base[a];
+  bb = base[b];
+
+  for (;;)
+    if (cmp (ba, bb) <= 0)
+      {
+        *tmp++ = ba;
+        a++;
+        if (a == alim)
+          {
+            a = b;
+            alim = blim;
+            break;
+          }
+        ba = base[a];
+      }
+    else
+      {
+        *tmp++ = bb;
+        b++;
+        if (b == blim)
+          break;
+        bb = base[b];
+      }
+
+  memcpy (tmp, base + a, (alim - a) * sizeof *base);
+}
+
+/* Sort a vector BASE containing N pointers, in place.  Use TMP
+   (containing N / 2 pointers) for temporary storage.  Compare
+   pointers with CMP.  */
+
+static void
+mpsort_with_tmp (void const **restrict base, size_t n,
+                 void const **restrict tmp,
+                 comparison_function cmp)
+{
+  if (n <= 2)
+    {
+      if (n == 2)
+        {
+          void const *p0 = base[0];
+          void const *p1 = base[1];
+          if (! (cmp (p0, p1) <= 0))
+            {
+              base[0] = p1;
+              base[1] = p0;
+            }
+        }
+    }
+  else
+    {
+      size_t n1 = n / 2;
+      size_t n2 = n - n1;
+      size_t i;
+      size_t t = 0;
+      size_t tlim = n1;
+      size_t b = n1;
+      size_t blim = n;
+      void const *bb;
+      void const *tt;
+
+      mpsort_with_tmp (base + n1, n2, tmp, cmp);
+
+      if (n1 < 2)
+        tmp[0] = base[0];
+      else
+        mpsort_into_tmp (base, n1, tmp, cmp);
+
+      tt = tmp[t];
+      bb = base[b];
+
+      for (i = 0; ; )
+        if (cmp (tt, bb) <= 0)
+          {
+            base[i++] = tt;
+            t++;
+            if (t == tlim)
+              break;
+            tt = tmp[t];
+          }
+        else
+          {
+            base[i++] = bb;
+            b++;
+            if (b == blim)
+              {
+                memcpy (base + i, tmp + t, (tlim - t) * sizeof *base);
+                break;
+              }
+            bb = base[b];
+          }
+    }
+}
+
+/* Sort a vector BASE containing N pointers, in place.  BASE must
+   contain enough storage to hold N + N / 2 vectors; the trailing
+   vectors are used for temporaries.  Compare pointers with CMP.  */
+
+void
+mpsort (void const **base, size_t n, comparison_function cmp)
+{
+  mpsort_with_tmp (base, n, base + n, cmp);
+}
deleted file mode 120000 (symlink)
index 81b3698a682715bcd7e839d4acc1c079d3283274..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/mpsort.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6d135a5e0e539a9d501d0c8b3e094e4a48c9d12c
--- /dev/null
@@ -0,0 +1,20 @@
+/* Sort a vector of pointers to data.
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+
+void mpsort (void const **, size_t, int (*) (void const *, void const *));
deleted file mode 120000 (symlink)
index 8f1ef9b3743f2a3d7251ddd0472f1818ff7c2b4e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/msvc-inval.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..da3fc86ad69bb59d5ccb1d29c663277910cc0e08
--- /dev/null
@@ -0,0 +1,129 @@
+/* Invalid parameter handler for MSVC runtime libraries.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "msvc-inval.h"
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
+    && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
+
+/* Get _invalid_parameter_handler type and _set_invalid_parameter_handler
+   declaration.  */
+# include <stdlib.h>
+
+# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
+
+static void __cdecl
+gl_msvc_invalid_parameter_handler (const wchar_t *expression,
+                                   const wchar_t *function,
+                                   const wchar_t *file,
+                                   unsigned int line,
+                                   uintptr_t dummy)
+{
+}
+
+# else
+
+/* Get declarations of the native Windows API functions.  */
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+
+#  if defined _MSC_VER
+
+static void __cdecl
+gl_msvc_invalid_parameter_handler (const wchar_t *expression,
+                                   const wchar_t *function,
+                                   const wchar_t *file,
+                                   unsigned int line,
+                                   uintptr_t dummy)
+{
+  RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
+}
+
+#  else
+
+/* An index to thread-local storage.  */
+static DWORD tls_index;
+static int tls_initialized /* = 0 */;
+
+/* Used as a fallback only.  */
+static struct gl_msvc_inval_per_thread not_per_thread;
+
+struct gl_msvc_inval_per_thread *
+gl_msvc_inval_current (void)
+{
+  if (!tls_initialized)
+    {
+      tls_index = TlsAlloc ();
+      tls_initialized = 1;
+    }
+  if (tls_index == TLS_OUT_OF_INDEXES)
+    /* TlsAlloc had failed.  */
+    return &not_per_thread;
+  else
+    {
+      struct gl_msvc_inval_per_thread *pointer =
+        (struct gl_msvc_inval_per_thread *) TlsGetValue (tls_index);
+      if (pointer == NULL)
+        {
+          /* First call.  Allocate a new 'struct gl_msvc_inval_per_thread'.  */
+          pointer =
+            (struct gl_msvc_inval_per_thread *)
+            malloc (sizeof (struct gl_msvc_inval_per_thread));
+          if (pointer == NULL)
+            /* Could not allocate memory.  Use the global storage.  */
+            pointer = &not_per_thread;
+          TlsSetValue (tls_index, pointer);
+        }
+      return pointer;
+    }
+}
+
+static void __cdecl
+gl_msvc_invalid_parameter_handler (const wchar_t *expression,
+                                   const wchar_t *function,
+                                   const wchar_t *file,
+                                   unsigned int line,
+                                   uintptr_t dummy)
+{
+  struct gl_msvc_inval_per_thread *current = gl_msvc_inval_current ();
+  if (current->restart_valid)
+    longjmp (current->restart, 1);
+  else
+    /* An invalid parameter notification from outside the gnulib code.
+       Give the caller a chance to intervene.  */
+    RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
+}
+
+#  endif
+
+# endif
+
+static int gl_msvc_inval_initialized /* = 0 */;
+
+void
+gl_msvc_inval_ensure_handler (void)
+{
+  if (gl_msvc_inval_initialized == 0)
+    {
+      _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler);
+      gl_msvc_inval_initialized = 1;
+    }
+}
+
+#endif
deleted file mode 120000 (symlink)
index 809f3560de96d65d8761930b816e04cce4691f31..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/msvc-inval.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7aee6e5d6aa36efa973a2975ad3db3e24c794d49
--- /dev/null
@@ -0,0 +1,227 @@
+/* Invalid parameter handler for MSVC runtime libraries.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _MSVC_INVAL_H
+#define _MSVC_INVAL_H
+
+/* With MSVC runtime libraries with the "invalid parameter handler" concept,
+   functions like fprintf(), dup2(), or close() crash when the caller passes
+   an invalid argument.  But POSIX wants error codes (such as EINVAL or EBADF)
+   instead.
+   This file defines macros that turn such an invalid parameter notification
+   into a non-local exit.  An error code can then be produced at the target
+   of this exit.  You can thus write code like
+
+     TRY_MSVC_INVAL
+       {
+         <Code that can trigger an invalid parameter notification
+          but does not do 'return', 'break', 'continue', nor 'goto'.>
+       }
+     CATCH_MSVC_INVAL
+       {
+         <Code that handles an invalid parameter notification
+          but does not do 'return', 'break', 'continue', nor 'goto'.>
+       }
+     DONE_MSVC_INVAL;
+
+   This entire block expands to a single statement.
+
+   The handling of invalid parameters can be done in three ways:
+
+     * The default way, which is reasonable for programs (not libraries):
+       AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [DEFAULT_HANDLING])
+
+     * The way for libraries that make "hairy" calls (like close(-1), or
+       fclose(fp) where fileno(fp) is closed, or simply getdtablesize()):
+       AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [HAIRY_LIBRARY_HANDLING])
+
+     * The way for libraries that make no "hairy" calls:
+       AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING])
+ */
+
+/* This file uses HAVE_MSVC_INVALID_PARAMETER_HANDLER.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#define DEFAULT_HANDLING       0
+#define HAIRY_LIBRARY_HANDLING 1
+#define SANE_LIBRARY_HANDLING  2
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
+    && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
+/* A native Windows platform with the "invalid parameter handler" concept,
+   and either DEFAULT_HANDLING or HAIRY_LIBRARY_HANDLING.  */
+
+# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
+/* Default handling.  */
+
+#  ifdef __cplusplus
+extern "C" {
+#  endif
+
+/* Ensure that the invalid parameter handler in installed that just returns.
+   Because we assume no other part of the program installs a different
+   invalid parameter handler, this solution is multithread-safe.  */
+extern void gl_msvc_inval_ensure_handler (void);
+
+#  ifdef __cplusplus
+}
+#  endif
+
+#  define TRY_MSVC_INVAL \
+     do                                                                        \
+       {                                                                       \
+         gl_msvc_inval_ensure_handler ();                                      \
+         if (1)
+#  define CATCH_MSVC_INVAL \
+         else
+#  define DONE_MSVC_INVAL \
+       }                                                                       \
+     while (0)
+
+# else
+/* Handling for hairy libraries.  */
+
+#  include <excpt.h>
+
+/* Gnulib can define its own status codes, as described in the page
+   "Raising Software Exceptions" on microsoft.com
+   <https://docs.microsoft.com/en-us/cpp/cpp/raising-software-exceptions>.
+   Our status codes are composed of
+     - 0xE0000000, mandatory for all user-defined status codes,
+     - 0x474E550, a API identifier ("GNU"),
+     - 0, 1, 2, ..., used to distinguish different status codes from the
+       same API.  */
+#  define STATUS_GNULIB_INVALID_PARAMETER (0xE0000000 + 0x474E550 + 0)
+
+#  if defined _MSC_VER
+/* A compiler that supports __try/__except, as described in the page
+   "try-except statement" on microsoft.com
+   <https://docs.microsoft.com/en-us/cpp/cpp/try-except-statement>.
+   With __try/__except, we can use the multithread-safe exception handling.  */
+
+#   ifdef __cplusplus
+extern "C" {
+#   endif
+
+/* Ensure that the invalid parameter handler in installed that raises a
+   software exception with code STATUS_GNULIB_INVALID_PARAMETER.
+   Because we assume no other part of the program installs a different
+   invalid parameter handler, this solution is multithread-safe.  */
+extern void gl_msvc_inval_ensure_handler (void);
+
+#   ifdef __cplusplus
+}
+#   endif
+
+#   define TRY_MSVC_INVAL \
+      do                                                                       \
+        {                                                                      \
+          gl_msvc_inval_ensure_handler ();                                     \
+          __try
+#   define CATCH_MSVC_INVAL \
+          __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER     \
+                    ? EXCEPTION_EXECUTE_HANDLER                                \
+                    : EXCEPTION_CONTINUE_SEARCH)
+#   define DONE_MSVC_INVAL \
+        }                                                                      \
+      while (0)
+
+#  else
+/* Any compiler.
+   We can only use setjmp/longjmp.  */
+
+#   include <setjmp.h>
+
+#   ifdef __cplusplus
+extern "C" {
+#   endif
+
+struct gl_msvc_inval_per_thread
+{
+  /* The restart that will resume execution at the code between
+     CATCH_MSVC_INVAL and DONE_MSVC_INVAL.  It is enabled only between
+     TRY_MSVC_INVAL and CATCH_MSVC_INVAL.  */
+  jmp_buf restart;
+
+  /* Tells whether the contents of restart is valid.  */
+  int restart_valid;
+};
+
+/* Ensure that the invalid parameter handler in installed that passes
+   control to the gl_msvc_inval_restart if it is valid, or raises a
+   software exception with code STATUS_GNULIB_INVALID_PARAMETER otherwise.
+   Because we assume no other part of the program installs a different
+   invalid parameter handler, this solution is multithread-safe.  */
+extern void gl_msvc_inval_ensure_handler (void);
+
+/* Return a pointer to the per-thread data for the current thread.  */
+extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void);
+
+#   ifdef __cplusplus
+}
+#   endif
+
+#   define TRY_MSVC_INVAL \
+      do                                                                       \
+        {                                                                      \
+          struct gl_msvc_inval_per_thread *msvc_inval_current;                 \
+          gl_msvc_inval_ensure_handler ();                                     \
+          msvc_inval_current = gl_msvc_inval_current ();                       \
+          /* First, initialize gl_msvc_inval_restart.  */                      \
+          if (setjmp (msvc_inval_current->restart) == 0)                       \
+            {                                                                  \
+              /* Then, mark it as valid.  */                                   \
+              msvc_inval_current->restart_valid = 1;
+#   define CATCH_MSVC_INVAL \
+              /* Execution completed.                                          \
+                 Mark gl_msvc_inval_restart as invalid.  */                    \
+              msvc_inval_current->restart_valid = 0;                           \
+            }                                                                  \
+          else                                                                 \
+            {                                                                  \
+              /* Execution triggered an invalid parameter notification.        \
+                 Mark gl_msvc_inval_restart as invalid.  */                    \
+              msvc_inval_current->restart_valid = 0;
+#   define DONE_MSVC_INVAL \
+            }                                                                  \
+        }                                                                      \
+      while (0)
+
+#  endif
+
+# endif
+
+#else
+/* A platform that does not need to the invalid parameter handler,
+   or when SANE_LIBRARY_HANDLING is desired.  */
+
+/* The braces here avoid GCC warnings like
+   "warning: suggest explicit braces to avoid ambiguous 'else'".  */
+# define TRY_MSVC_INVAL \
+    do                                                                         \
+      {                                                                        \
+        if (1)
+# define CATCH_MSVC_INVAL \
+        else
+# define DONE_MSVC_INVAL \
+      }                                                                        \
+    while (0)
+
+#endif
+
+#endif /* _MSVC_INVAL_H */
deleted file mode 120000 (symlink)
index be3dc1cc213839ff04cfb52eefdbcad9d56ecb4f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/msvc-nothrow.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..06b35a61dc8529dec1c44d23ab9a952c2b4cb67c
--- /dev/null
@@ -0,0 +1,51 @@
+/* Wrappers that don't throw invalid parameter notifications
+   with MSVC runtime libraries.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "msvc-nothrow.h"
+
+/* Get declarations of the native Windows API functions.  */
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#undef _get_osfhandle
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+intptr_t
+_gl_nothrow_get_osfhandle (int fd)
+{
+  intptr_t result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _get_osfhandle (fd);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = (intptr_t) INVALID_HANDLE_VALUE;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+#endif
deleted file mode 120000 (symlink)
index 12db8ce5ab884625b28e1012893513111d3ed5b4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/msvc-nothrow.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dc6dd35d58e863f6d18b4e60e012cd7a581c9fb2
--- /dev/null
@@ -0,0 +1,48 @@
+/* Wrappers that don't throw invalid parameter notifications
+   with MSVC runtime libraries.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _MSVC_NOTHROW_H
+#define _MSVC_NOTHROW_H
+
+/* With MSVC runtime libraries with the "invalid parameter handler" concept,
+   functions like fprintf(), dup2(), or close() crash when the caller passes
+   an invalid argument.  But POSIX wants error codes (such as EINVAL or EBADF)
+   instead.
+   This file defines wrappers that turn such an invalid parameter notification
+   into an error code.  */
+
+/* This file uses HAVE_MSVC_INVALID_PARAMETER_HANDLER.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+/* Get original declaration of _get_osfhandle.  */
+# include <io.h>
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+
+/* Override _get_osfhandle.  */
+extern intptr_t _gl_nothrow_get_osfhandle (int fd);
+#  define _get_osfhandle _gl_nothrow_get_osfhandle
+
+# endif
+
+#endif
+
+#endif /* _MSVC_NOTHROW_H */
deleted file mode 120000 (symlink)
index dae0b1337b89faaf36f16254863bd03b5bbfe4dc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/nanosleep.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c6a76ec0eb4da72b0c4cabc5a90245abc8b6e790
--- /dev/null
@@ -0,0 +1,192 @@
+/* Provide a replacement for the POSIX nanosleep function.
+
+   Copyright (C) 1999-2000, 2002, 2004-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering
+   and Bruno Haible for the native Windows part */
+
+#include <config.h>
+
+#include <time.h>
+
+#include "intprops.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/select.h>
+#include <signal.h>
+
+#include <errno.h>
+
+#include <unistd.h>
+
+
+enum { BILLION = 1000 * 1000 * 1000 };
+
+#if HAVE_BUG_BIG_NANOSLEEP
+
+int
+nanosleep (const struct timespec *requested_delay,
+           struct timespec *remaining_delay)
+# undef nanosleep
+{
+  /* nanosleep mishandles large sleeps due to internal overflow problems.
+     The worst known case of this is Linux 2.6.9 with glibc 2.3.4, which
+     can't sleep more than 24.85 days (2^31 milliseconds).  Similarly,
+     cygwin 1.5.x, which can't sleep more than 49.7 days (2^32 milliseconds).
+     Solve this by breaking the sleep up into smaller chunks.  */
+
+  if (requested_delay->tv_nsec < 0 || BILLION <= requested_delay->tv_nsec)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  {
+    /* Verify that time_t is large enough.  */
+    static_assert (TYPE_MAXIMUM (time_t) / 24 / 24 / 60 / 60);
+    const time_t limit = 24 * 24 * 60 * 60;
+    time_t seconds = requested_delay->tv_sec;
+    struct timespec intermediate = *requested_delay;
+
+    while (limit < seconds)
+      {
+        int result;
+        intermediate.tv_sec = limit;
+        result = nanosleep (&intermediate, remaining_delay);
+        seconds -= limit;
+        if (result)
+          {
+            if (remaining_delay)
+              remaining_delay->tv_sec += seconds;
+            return result;
+          }
+        intermediate.tv_nsec = 0;
+      }
+    intermediate.tv_sec = seconds;
+    return nanosleep (&intermediate, remaining_delay);
+  }
+}
+
+#elif defined _WIN32 && ! defined __CYGWIN__
+/* Native Windows platforms.  */
+
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+/* The Windows API function Sleep() has a resolution of about 15 ms and takes
+   at least 5 ms to execute.  We use this function for longer time periods.
+   Additionally, we use busy-looping over short time periods, to get a
+   resolution of about 0.01 ms.  In order to measure such short timespans,
+   we use the QueryPerformanceCounter() function.  */
+
+int
+nanosleep (const struct timespec *requested_delay,
+           struct timespec *remaining_delay)
+{
+  static bool initialized;
+  /* Number of performance counter increments per nanosecond,
+     or zero if it could not be determined.  */
+  static double ticks_per_nanosecond;
+
+  if (requested_delay->tv_nsec < 0 || BILLION <= requested_delay->tv_nsec)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  /* For requested delays of one second or more, 15ms resolution is
+     sufficient.  */
+  if (requested_delay->tv_sec == 0)
+    {
+      if (!initialized)
+        {
+          /* Initialize ticks_per_nanosecond.  */
+          LARGE_INTEGER ticks_per_second;
+
+          if (QueryPerformanceFrequency (&ticks_per_second))
+            ticks_per_nanosecond =
+              (double) ticks_per_second.QuadPart / 1000000000.0;
+
+          initialized = true;
+        }
+      if (ticks_per_nanosecond)
+        {
+          /* QueryPerformanceFrequency worked.  We can use
+             QueryPerformanceCounter.  Use a combination of Sleep and
+             busy-looping.  */
+          /* Number of milliseconds to pass to the Sleep function.
+             Since Sleep can take up to 8 ms less or 8 ms more than requested
+             (or maybe more if the system is loaded), we subtract 10 ms.  */
+          int sleep_millis = (int) requested_delay->tv_nsec / 1000000 - 10;
+          /* Determine how many ticks to delay.  */
+          LONGLONG wait_ticks = requested_delay->tv_nsec * ticks_per_nanosecond;
+          /* Start.  */
+          LARGE_INTEGER counter_before;
+          if (QueryPerformanceCounter (&counter_before))
+            {
+              /* Wait until the performance counter has reached this value.
+                 We don't need to worry about overflow, because the performance
+                 counter is reset at reboot, and with a frequency of 3.6E6
+                 ticks per second 63 bits suffice for over 80000 years.  */
+              LONGLONG wait_until = counter_before.QuadPart + wait_ticks;
+              /* Use Sleep for the longest part.  */
+              if (sleep_millis > 0)
+                Sleep (sleep_millis);
+              /* Busy-loop for the rest.  */
+              for (;;)
+                {
+                  LARGE_INTEGER counter_after;
+                  if (!QueryPerformanceCounter (&counter_after))
+                    /* QueryPerformanceCounter failed, but succeeded earlier.
+                       Should not happen.  */
+                    break;
+                  if (counter_after.QuadPart >= wait_until)
+                    /* The requested time has elapsed.  */
+                    break;
+                }
+              goto done;
+            }
+        }
+    }
+  /* Implementation for long delays and as fallback.  */
+  Sleep (requested_delay->tv_sec * 1000 + requested_delay->tv_nsec / 1000000);
+
+ done:
+  /* Sleep is not interruptible.  So there is no remaining delay.  */
+  if (remaining_delay != NULL)
+    {
+      remaining_delay->tv_sec = 0;
+      remaining_delay->tv_nsec = 0;
+    }
+  return 0;
+}
+
+#else
+/* Other platforms lacking nanosleep.
+   It's not clear whether these are still practical porting targets.
+   For now, just fall back on pselect.  */
+
+/* Suspend execution for at least *REQUESTED_DELAY seconds.  The
+   *REMAINING_DELAY part isn't implemented yet.  */
+
+int
+nanosleep (const struct timespec *requested_delay,
+           struct timespec *remaining_delay)
+{
+  return pselect (0, NULL, NULL, NULL, requested_delay, NULL);
+}
+#endif
deleted file mode 120000 (symlink)
index e53af974333447f344bc29f493c92e9e2ca42dc9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/netdb.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..43409b2f033c2b51d55da93e1d788f429bcabbe9
--- /dev/null
@@ -0,0 +1,300 @@
+/* Provide a netdb.h header file for systems lacking it (read: MinGW).
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file is supposed to be used on platforms that lack <netdb.h>.
+   It is intended to provide definitions and prototypes needed by an
+   application.  */
+
+#ifndef _@GUARD_PREFIX@_NETDB_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if @HAVE_NETDB_H@
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_NETDB_H@
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_NETDB_H
+#define _@GUARD_PREFIX@_NETDB_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and
+   'struct hostent' on MinGW.  */
+#include <sys/socket.h>
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* Declarations for a platform that lacks <netdb.h>, or where it is
+   incomplete.  */
+
+#if @GNULIB_GETADDRINFO@
+
+# if !@HAVE_STRUCT_ADDRINFO@
+
+#  ifdef __cplusplus
+extern "C" {
+#  endif
+
+#  if !GNULIB_defined_struct_addrinfo
+/* Structure to contain information about address of a service provider.  */
+struct addrinfo
+{
+  int ai_flags;                 /* Input flags.  */
+  int ai_family;                /* Protocol family for socket.  */
+  int ai_socktype;              /* Socket type.  */
+  int ai_protocol;              /* Protocol for socket.  */
+  socklen_t ai_addrlen;         /* Length of socket address.  */
+  struct sockaddr *ai_addr;     /* Socket address for socket.  */
+  char *ai_canonname;           /* Canonical name for service location.  */
+  struct addrinfo *ai_next;     /* Pointer to next in list.  */
+};
+#   define GNULIB_defined_struct_addrinfo 1
+#  endif
+
+#  ifdef __cplusplus
+}
+#  endif
+
+# endif
+
+/* Possible values for 'ai_flags' field in 'addrinfo' structure.  */
+# ifndef AI_PASSIVE
+#  define AI_PASSIVE    0x0001  /* Socket address is intended for 'bind'.  */
+# endif
+# ifndef AI_CANONNAME
+#  define AI_CANONNAME  0x0002  /* Request for canonical name.  */
+# endif
+# ifndef AI_NUMERICSERV
+#  define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
+# endif
+
+# if 0
+#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
+# endif
+
+/* These symbolic constants are required to be present by POSIX, but
+   our getaddrinfo replacement doesn't use them (yet).  Setting them
+   to 0 on systems that doesn't have them avoids causing problems for
+   system getaddrinfo implementations that would be confused by
+   unknown values.  */
+# ifndef AI_V4MAPPED
+#  define AI_V4MAPPED    0 /* 0x0008: IPv4 mapped addresses are acceptable.  */
+# endif
+# ifndef AI_ALL
+#  define AI_ALL         0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */
+# endif
+# ifndef AI_ADDRCONFIG
+#  define AI_ADDRCONFIG  0 /* 0x0020: Use configuration of this host to choose
+                                      returned address type.  */
+# endif
+
+/* Error values for 'getaddrinfo' function.  */
+# ifndef EAI_BADFLAGS
+#  define EAI_BADFLAGS    -1    /* Invalid value for 'ai_flags' field.  */
+#  define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
+#  define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
+#  define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
+#  define EAI_NODATA      -5    /* No address associated with NAME.  */
+#  define EAI_FAMILY      -6    /* 'ai_family' not supported.  */
+#  define EAI_SOCKTYPE    -7    /* 'ai_socktype' not supported.  */
+#  define EAI_SERVICE     -8    /* SERVICE not supported for 'ai_socktype'.  */
+#  define EAI_MEMORY      -10   /* Memory allocation failure.  */
+# endif
+
+/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
+   FreeBSD, which does define EAI_BADFLAGS) have removed the definition
+   in favor of EAI_NONAME.  */
+# if !defined EAI_NODATA && defined EAI_NONAME
+#  define EAI_NODATA EAI_NONAME
+# endif
+
+# ifndef EAI_OVERFLOW
+/* Not defined on mingw32 and Haiku. */
+#  define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
+# endif
+# ifndef EAI_ADDRFAMILY
+/* Not defined on mingw32. */
+#  define EAI_ADDRFAMILY  -9    /* Address family for NAME not supported.  */
+# endif
+# ifndef EAI_SYSTEM
+/* Not defined on mingw32. */
+#  define EAI_SYSTEM      -11   /* System error returned in 'errno'.  */
+# endif
+
+# if 0
+/* The commented out definitions below are not yet implemented in the
+   GNULIB getaddrinfo() replacement, so are not yet needed.
+
+   If they are restored, be sure to protect the definitions with #ifndef.  */
+#  ifndef EAI_INPROGRESS
+#   define EAI_INPROGRESS       -100    /* Processing request in progress.  */
+#   define EAI_CANCELED         -101    /* Request canceled.  */
+#   define EAI_NOTCANCELED      -102    /* Request not canceled.  */
+#   define EAI_ALLDONE          -103    /* All requests done.  */
+#   define EAI_INTR             -104    /* Interrupted by a signal.  */
+#   define EAI_IDN_ENCODE       -105    /* IDN encoding failed.  */
+#  endif
+# endif
+
+/* Translate name of a service location and/or a service name to set of
+   socket addresses.
+   For more details, see the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>.  */
+# if @REPLACE_GETADDRINFO@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getaddrinfo
+#   define getaddrinfo rpl_getaddrinfo
+#  endif
+_GL_FUNCDECL_RPL (getaddrinfo, int,
+                  (const char *restrict nodename,
+                   const char *restrict servname,
+                   const struct addrinfo *restrict hints,
+                   struct addrinfo **restrict res)
+                  _GL_ARG_NONNULL ((4)));
+_GL_CXXALIAS_RPL (getaddrinfo, int,
+                  (const char *restrict nodename,
+                   const char *restrict servname,
+                   const struct addrinfo *restrict hints,
+                   struct addrinfo **restrict res));
+# else
+#  if !@HAVE_DECL_GETADDRINFO@
+_GL_FUNCDECL_SYS (getaddrinfo, int,
+                  (const char *restrict nodename,
+                   const char *restrict servname,
+                   const struct addrinfo *restrict hints,
+                   struct addrinfo **restrict res)
+                  _GL_ARG_NONNULL ((4)));
+#  endif
+_GL_CXXALIAS_SYS (getaddrinfo, int,
+                  (const char *restrict nodename,
+                   const char *restrict servname,
+                   const struct addrinfo *restrict hints,
+                   struct addrinfo **restrict res));
+# endif
+_GL_CXXALIASWARN (getaddrinfo);
+
+/* Free 'addrinfo' structure AI including associated storage.
+   For more details, see the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>.  */
+# if @REPLACE_GETADDRINFO@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef freeaddrinfo
+#   define freeaddrinfo rpl_freeaddrinfo
+#  endif
+_GL_FUNCDECL_RPL (freeaddrinfo, void, (struct addrinfo *ai)
+                                      _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (freeaddrinfo, void, (struct addrinfo *ai));
+# else
+#  if !@HAVE_DECL_FREEADDRINFO@
+_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
+                                      _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
+# endif
+_GL_CXXALIASWARN (freeaddrinfo);
+
+# if @REPLACE_GAI_STRERROR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gai_strerror
+#   define gai_strerror rpl_gai_strerror
+#  endif
+_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
+_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
+# else
+#  if !@HAVE_DECL_GAI_STRERROR@
+/* Convert error return from getaddrinfo() to a string.
+   For more details, see the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html>.  */
+_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
+#  endif
+_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (gai_strerror);
+# endif
+
+# if !@HAVE_DECL_GETNAMEINFO@
+/* Convert socket address to printable node and service names.
+   For more details, see the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html>.  */
+_GL_FUNCDECL_SYS (getnameinfo, int,
+                  (const struct sockaddr *restrict sa, socklen_t salen,
+                   char *restrict node, socklen_t nodelen,
+                   char *restrict service, socklen_t servicelen,
+                   int flags)
+                  _GL_ARG_NONNULL ((1)));
+# endif
+/* Need to cast, because on glibc systems, the seventh parameter is
+                        unsigned int flags.  */
+_GL_CXXALIAS_SYS_CAST (getnameinfo, int,
+                       (const struct sockaddr *restrict sa, socklen_t salen,
+                        char *restrict node, socklen_t nodelen,
+                        char *restrict service, socklen_t servicelen,
+                        int flags));
+_GL_CXXALIASWARN (getnameinfo);
+
+/* Possible flags for getnameinfo.  */
+# ifndef NI_NUMERICHOST
+#  define NI_NUMERICHOST 1
+# endif
+# ifndef NI_NUMERICSERV
+#  define NI_NUMERICSERV 2
+# endif
+
+#elif defined GNULIB_POSIXCHECK
+
+# undef getaddrinfo
+# if HAVE_RAW_DECL_GETADDRINFO
+_GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - "
+                 "use gnulib module getaddrinfo for portability");
+# endif
+
+# undef freeaddrinfo
+# if HAVE_RAW_DECL_FREEADDRINFO
+_GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - "
+                 "use gnulib module getaddrinfo for portability");
+# endif
+
+# undef gai_strerror
+# if HAVE_RAW_DECL_GAI_STRERROR
+_GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - "
+                 "use gnulib module getaddrinfo for portability");
+# endif
+
+# undef getnameinfo
+# if HAVE_RAW_DECL_GETNAMEINFO
+_GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
+                 "use gnulib module getaddrinfo for portability");
+# endif
+
+#endif
+
+#endif /* _@GUARD_PREFIX@_NETDB_H */
+#endif /* _@GUARD_PREFIX@_NETDB_H */
deleted file mode 120000 (symlink)
index 475edd0954dba84562d259e58495bff9c3cb2d87..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/netinet_in.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4e9f6f2d6118849a4bad3192b4abb3b35a0a96f8
--- /dev/null
@@ -0,0 +1,47 @@
+/* Substitute for <netinet/in.h>.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_NETINET_IN_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if @HAVE_NETINET_IN_H@
+
+/* On many platforms, <netinet/in.h> assumes prior inclusion of
+   <sys/types.h>.  */
+# include <sys/types.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_NETINET_IN_H
+#define _@GUARD_PREFIX@_NETINET_IN_H
+
+#if !@HAVE_NETINET_IN_H@
+
+/* A platform that lacks <netinet/in.h>.  */
+
+# include <sys/socket.h>
+
+#endif
+
+#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
+#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
deleted file mode 120000 (symlink)
index 174093d45337edff396383840e8801faeb4e2138..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/nl_langinfo-lock.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5a248ed8d1083b09a17f09f167aef8d386dafd65
--- /dev/null
@@ -0,0 +1,151 @@
+/* Return the internal lock used by nl_langinfo.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019-2020.  */
+
+#include <config.h>
+
+/* The option '--disable-threads' explicitly requests no locking.  */
+/* When it is known that the gl_get_nl_langinfo_lock function is defined
+   by a dependency library, it should not be defined here.  */
+#if AVOID_ANY_THREADS || OMIT_NL_LANGINFO_LOCK
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#else
+
+/* This file defines the internal lock used by nl_langinfo.
+   It is a separate compilation unit, so that only one copy of it is
+   present when linking statically.  */
+
+/* Prohibit renaming this symbol.  */
+# undef gl_get_nl_langinfo_lock
+
+/* Macro for exporting a symbol (function, not variable) defined in this file,
+   when compiled into a shared library.  */
+# ifndef SHLIB_EXPORTED
+#  if HAVE_VISIBILITY
+  /* Override the effect of the compiler option '-fvisibility=hidden'.  */
+#   define SHLIB_EXPORTED __attribute__((__visibility__("default")))
+#  elif defined _WIN32 || defined __CYGWIN__
+#   define SHLIB_EXPORTED __declspec(dllexport)
+#  else
+#   define SHLIB_EXPORTED
+#  endif
+# endif
+
+# if defined _WIN32 && !defined __CYGWIN__
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+#  include "windows-initguard.h"
+
+/* The return type is a 'CRITICAL_SECTION *', not a 'glwthread_mutex_t *',
+   because the latter is not guaranteed to be a stable ABI in the future.  */
+
+/* Make sure the function gets exported from DLLs.  */
+SHLIB_EXPORTED CRITICAL_SECTION *gl_get_nl_langinfo_lock (void);
+
+static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT;
+static CRITICAL_SECTION lock;
+
+/* Returns the internal lock used by nl_langinfo.  */
+CRITICAL_SECTION *
+gl_get_nl_langinfo_lock (void)
+{
+  if (!guard.done)
+    {
+      if (InterlockedIncrement (&guard.started) == 0)
+        {
+          /* This thread is the first one to need the lock.  Initialize it.  */
+          InitializeCriticalSection (&lock);
+          guard.done = 1;
+        }
+      else
+        {
+          /* Don't let guard.started grow and wrap around.  */
+          InterlockedDecrement (&guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this mutex.  */
+          while (!guard.done)
+            Sleep (0);
+        }
+    }
+  return &lock;
+}
+
+# elif HAVE_PTHREAD_API
+
+#  include <pthread.h>
+
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* Make sure the function gets exported from shared libraries.  */
+SHLIB_EXPORTED pthread_mutex_t *gl_get_nl_langinfo_lock (void);
+
+/* Returns the internal lock used by nl_langinfo.  */
+pthread_mutex_t *
+gl_get_nl_langinfo_lock (void)
+{
+  return &mutex;
+}
+
+# elif HAVE_THREADS_H
+
+#  include <threads.h>
+#  include <stdlib.h>
+
+static int volatile init_needed = 1;
+static once_flag init_once = ONCE_FLAG_INIT;
+static mtx_t mutex;
+
+static void
+atomic_init (void)
+{
+  if (mtx_init (&mutex, mtx_plain) != thrd_success)
+    abort ();
+  init_needed = 0;
+}
+
+/* Make sure the function gets exported from shared libraries.  */
+SHLIB_EXPORTED mtx_t *gl_get_nl_langinfo_lock (void);
+
+/* Returns the internal lock used by nl_langinfo.  */
+mtx_t *
+gl_get_nl_langinfo_lock (void)
+{
+  if (init_needed)
+    call_once (&init_once, atomic_init);
+  return &mutex;
+}
+
+# endif
+
+# if (defined _WIN32 || defined __CYGWIN__) && !defined _MSC_VER
+/* Make sure the '__declspec(dllimport)' in nl_langinfo.c does not cause
+   a link failure when no DLLs are involved.  */
+#  if defined _WIN64 || defined _LP64
+#   define IMP(x) __imp_##x
+#  else
+#   define IMP(x) _imp__##x
+#  endif
+void * IMP(gl_get_nl_langinfo_lock) = &gl_get_nl_langinfo_lock;
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index 6424038070dffe4a15bef590a4a5ea11c801ecf5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/nl_langinfo.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..64ff93b0cb8be3741aa4d0d5d9ba46b1ba3e4e60
--- /dev/null
@@ -0,0 +1,585 @@
+/* nl_langinfo() replacement: query locale dependent information.
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <langinfo.h>
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+# include <stdio.h>
+#endif
+
+#if REPLACE_NL_LANGINFO && !NL_LANGINFO_MTSAFE
+
+# if AVOID_ANY_THREADS
+
+/* The option '--disable-threads' explicitly requests no locking.  */
+
+# elif defined _WIN32 && !defined __CYGWIN__
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+# elif HAVE_PTHREAD_API
+
+#  include <pthread.h>
+#  if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS
+#   include <threads.h>
+#   pragma weak thrd_exit
+#   define c11_threads_in_use() (thrd_exit != NULL)
+#  else
+#   define c11_threads_in_use() 0
+#  endif
+
+# elif HAVE_THREADS_H
+
+#  include <threads.h>
+
+# endif
+
+#endif
+
+/* nl_langinfo() must be multithread-safe.  To achieve this without using
+   thread-local storage:
+     1. We use a specific static buffer for each possible argument.
+        So that different threads can call nl_langinfo with different arguments,
+        without interfering.
+     2. We use a simple strcpy or memcpy to fill this static buffer.  Filling it
+        through, for example, strcpy + strcat would not be guaranteed to leave
+        the buffer's contents intact if another thread is currently accessing
+        it.  If necessary, the contents is first assembled in a stack-allocated
+        buffer.  */
+
+#if !REPLACE_NL_LANGINFO || GNULIB_defined_CODESET
+/* Return the codeset of the current locale, if this is easily deducible.
+   Otherwise, return "".  */
+static char *
+ctype_codeset (void)
+{
+  /* This function is only used on platforms which don't have uselocale().
+     Therefore we don't need to look at the per-thread locale first, here.  */
+  static char result[2 + 10 + 1];
+  char buf[2 + 10 + 1];
+  char locale[SETLOCALE_NULL_MAX];
+  char *codeset;
+  size_t codesetlen;
+
+  if (setlocale_null_r (LC_CTYPE, locale, sizeof (locale)))
+    locale[0] = '\0';
+
+  codeset = buf;
+  codeset[0] = '\0';
+
+  if (locale[0])
+    {
+      /* If the locale name contains an encoding after the dot, return it.  */
+      char *dot = strchr (locale, '.');
+
+      if (dot)
+        {
+          /* Look for the possible @... trailer and remove it, if any.  */
+          char *codeset_start = dot + 1;
+          char const *modifier = strchr (codeset_start, '@');
+
+          if (! modifier)
+            codeset = codeset_start;
+          else
+            {
+              codesetlen = modifier - codeset_start;
+              if (codesetlen < sizeof buf)
+                {
+                  codeset = memcpy (buf, codeset_start, codesetlen);
+                  codeset[codesetlen] = '\0';
+                }
+            }
+        }
+    }
+
+# if defined _WIN32 && ! defined __CYGWIN__
+  /* If setlocale is successful, it returns the number of the
+     codepage, as a string.  Otherwise, fall back on Windows API
+     GetACP, which returns the locale's codepage as a number (although
+     this doesn't change according to what the 'setlocale' call specified).
+     Either way, prepend "CP" to make it a valid codeset name.  */
+  codesetlen = strlen (codeset);
+  if (0 < codesetlen && codesetlen < sizeof buf - 2)
+    memmove (buf + 2, codeset, codesetlen + 1);
+  else
+    sprintf (buf + 2, "%u", GetACP ());
+  /* For a locale name such as "French_France.65001", in Windows 10,
+     setlocale now returns "French_France.utf8" instead.  */
+  if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0)
+    return (char *) "UTF-8";
+  else
+    {
+      memcpy (buf, "CP", 2);
+      strcpy (result, buf);
+      return result;
+    }
+# else
+  strcpy (result, codeset);
+  return result;
+#endif
+}
+#endif
+
+
+#if REPLACE_NL_LANGINFO
+
+/* Override nl_langinfo with support for added nl_item values.  */
+
+# undef nl_langinfo
+
+/* Without locking, on Solaris 11.3, test-nl_langinfo-mt fails, with message
+   "thread5 disturbed by threadN!", even when threadN invokes only
+      nl_langinfo (CODESET);
+      nl_langinfo (CRNCYSTR);
+   Similarly on Solaris 10.  */
+
+# if !NL_LANGINFO_MTSAFE /* Solaris */
+
+#  define ITEMS (MAXSTRMSG + 1)
+#  define MAX_RESULT_LEN 80
+
+static char *
+nl_langinfo_unlocked (nl_item item)
+{
+  static char result[ITEMS][MAX_RESULT_LEN];
+
+  /* The result of nl_langinfo is in storage that can be overwritten by
+     other calls to nl_langinfo.  */
+  char *tmp = nl_langinfo (item);
+  if (item >= 0 && item < ITEMS && tmp != NULL)
+    {
+      size_t tmp_len = strlen (tmp);
+      if (tmp_len < MAX_RESULT_LEN)
+        strcpy (result[item], tmp);
+      else
+        {
+          /* Produce a truncated result.  Oh well...  */
+          result[item][MAX_RESULT_LEN - 1] = '\0';
+          memcpy (result[item], tmp, MAX_RESULT_LEN - 1);
+        }
+      return result[item];
+    }
+  else
+    return tmp;
+}
+
+/* Use a lock, so that no two threads can invoke nl_langinfo_unlocked
+   at the same time.  */
+
+/* Prohibit renaming this symbol.  */
+#  undef gl_get_nl_langinfo_lock
+
+#  if AVOID_ANY_THREADS
+
+/* The option '--disable-threads' explicitly requests no locking.  */
+#   define nl_langinfo_with_lock nl_langinfo_unlocked
+
+#  elif defined _WIN32 && !defined __CYGWIN__
+
+extern __declspec(dllimport) CRITICAL_SECTION *gl_get_nl_langinfo_lock (void);
+
+static char *
+nl_langinfo_with_lock (nl_item item)
+{
+  CRITICAL_SECTION *lock = gl_get_nl_langinfo_lock ();
+  char *ret;
+
+  EnterCriticalSection (lock);
+  ret = nl_langinfo_unlocked (item);
+  LeaveCriticalSection (lock);
+
+  return ret;
+}
+
+#  elif HAVE_PTHREAD_API
+
+extern
+#   if defined _WIN32 || defined __CYGWIN__
+  __declspec(dllimport)
+#   endif
+  pthread_mutex_t *gl_get_nl_langinfo_lock (void);
+
+#   if HAVE_WEAK_SYMBOLS /* musl libc, FreeBSD, NetBSD, OpenBSD, Haiku */
+
+     /* Avoid the need to link with '-lpthread'.  */
+#    pragma weak pthread_mutex_lock
+#    pragma weak pthread_mutex_unlock
+
+     /* Determine whether libpthread is in use.  */
+#    pragma weak pthread_mutexattr_gettype
+     /* See the comments in lock.h.  */
+#    define pthread_in_use() \
+       (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
+
+#   else
+#    define pthread_in_use() 1
+#   endif
+
+static char *
+nl_langinfo_with_lock (nl_item item)
+{
+  if (pthread_in_use())
+    {
+      pthread_mutex_t *lock = gl_get_nl_langinfo_lock ();
+      char *ret;
+
+      if (pthread_mutex_lock (lock))
+        abort ();
+      ret = nl_langinfo_unlocked (item);
+      if (pthread_mutex_unlock (lock))
+        abort ();
+
+      return ret;
+    }
+  else
+    return nl_langinfo_unlocked (item);
+}
+
+#  elif HAVE_THREADS_H
+
+extern mtx_t *gl_get_nl_langinfo_lock (void);
+
+static char *
+nl_langinfo_with_lock (nl_item item)
+{
+  mtx_t *lock = gl_get_nl_langinfo_lock ();
+  char *ret;
+
+  if (mtx_lock (lock) != thrd_success)
+    abort ();
+  ret = nl_langinfo_unlocked (item);
+  if (mtx_unlock (lock) != thrd_success)
+    abort ();
+
+  return ret;
+}
+
+#  endif
+
+# else
+
+/* On other platforms, no lock is needed.  */
+#  define nl_langinfo_with_lock nl_langinfo
+
+# endif
+
+char *
+rpl_nl_langinfo (nl_item item)
+{
+  switch (item)
+    {
+# if GNULIB_defined_CODESET
+    case CODESET:
+      return ctype_codeset ();
+# endif
+# if GNULIB_defined_T_FMT_AMPM
+    case T_FMT_AMPM:
+      return (char *) "%I:%M:%S %p";
+# endif
+# if GNULIB_defined_ALTMON
+    case ALTMON_1:
+    case ALTMON_2:
+    case ALTMON_3:
+    case ALTMON_4:
+    case ALTMON_5:
+    case ALTMON_6:
+    case ALTMON_7:
+    case ALTMON_8:
+    case ALTMON_9:
+    case ALTMON_10:
+    case ALTMON_11:
+    case ALTMON_12:
+      /* We don't ship the appropriate localizations with gnulib.  Therefore,
+         treat ALTMON_i like MON_i.  */
+      item = item - ALTMON_1 + MON_1;
+      break;
+# endif
+# if GNULIB_defined_ERA
+    case ERA:
+      /* The format is not standardized.  In glibc it is a sequence of strings
+         of the form "direction:offset:start_date:end_date:era_name:era_format"
+         with an empty string at the end.  */
+      return (char *) "";
+    case ERA_D_FMT:
+      /* The %Ex conversion in strftime behaves like %x if the locale does not
+         have an alternative time format.  */
+      item = D_FMT;
+      break;
+    case ERA_D_T_FMT:
+      /* The %Ec conversion in strftime behaves like %c if the locale does not
+         have an alternative time format.  */
+      item = D_T_FMT;
+      break;
+    case ERA_T_FMT:
+      /* The %EX conversion in strftime behaves like %X if the locale does not
+         have an alternative time format.  */
+      item = T_FMT;
+      break;
+    case ALT_DIGITS:
+      /* The format is not standardized.  In glibc it is a sequence of 10
+         strings, appended in memory.  */
+      return (char *) "\0\0\0\0\0\0\0\0\0\0";
+# endif
+# if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS
+    case YESEXPR:
+      return (char *) "^[yY]";
+    case NOEXPR:
+      return (char *) "^[nN]";
+# endif
+    default:
+      break;
+    }
+  return nl_langinfo_with_lock (item);
+}
+
+#else
+
+/* Provide nl_langinfo from scratch, either for native MS-Windows, or
+   for old Unix platforms without locales, such as Linux libc5 or
+   BeOS.  */
+
+# include <time.h>
+
+char *
+nl_langinfo (nl_item item)
+{
+  char buf[100];
+  struct tm tmm = { 0 };
+
+  switch (item)
+    {
+    /* nl_langinfo items of the LC_CTYPE category */
+    case CODESET:
+      {
+        char *codeset = ctype_codeset ();
+        if (*codeset)
+          return codeset;
+      }
+# ifdef __BEOS__
+      return (char *) "UTF-8";
+# else
+      return (char *) "ISO-8859-1";
+# endif
+    /* nl_langinfo items of the LC_NUMERIC category */
+    case RADIXCHAR:
+      return localeconv () ->decimal_point;
+    case THOUSEP:
+      return localeconv () ->thousands_sep;
+# ifdef GROUPING
+    case GROUPING:
+      return localeconv () ->grouping;
+# endif
+    /* nl_langinfo items of the LC_TIME category.
+       TODO: Really use the locale.  */
+    case D_T_FMT:
+    case ERA_D_T_FMT:
+      return (char *) "%a %b %e %H:%M:%S %Y";
+    case D_FMT:
+    case ERA_D_FMT:
+      return (char *) "%m/%d/%y";
+    case T_FMT:
+    case ERA_T_FMT:
+      return (char *) "%H:%M:%S";
+    case T_FMT_AMPM:
+      return (char *) "%I:%M:%S %p";
+    case AM_STR:
+      {
+        static char result[80];
+        if (!strftime (buf, sizeof result, "%p", &tmm))
+          return (char *) "AM";
+        strcpy (result, buf);
+        return result;
+      }
+    case PM_STR:
+      {
+        static char result[80];
+        tmm.tm_hour = 12;
+        if (!strftime (buf, sizeof result, "%p", &tmm))
+          return (char *) "PM";
+        strcpy (result, buf);
+        return result;
+      }
+    case DAY_1:
+    case DAY_2:
+    case DAY_3:
+    case DAY_4:
+    case DAY_5:
+    case DAY_6:
+    case DAY_7:
+      {
+        static char result[7][50];
+        static char const days[][sizeof "Wednesday"] = {
+          "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
+          "Friday", "Saturday"
+        };
+        tmm.tm_wday = item - DAY_1;
+        if (!strftime (buf, sizeof result[0], "%A", &tmm))
+          return (char *) days[item - DAY_1];
+        strcpy (result[item - DAY_1], buf);
+        return result[item - DAY_1];
+      }
+    case ABDAY_1:
+    case ABDAY_2:
+    case ABDAY_3:
+    case ABDAY_4:
+    case ABDAY_5:
+    case ABDAY_6:
+    case ABDAY_7:
+      {
+        static char result[7][30];
+        static char const abdays[][sizeof "Sun"] = {
+          "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+        };
+        tmm.tm_wday = item - ABDAY_1;
+        if (!strftime (buf, sizeof result[0], "%a", &tmm))
+          return (char *) abdays[item - ABDAY_1];
+        strcpy (result[item - ABDAY_1], buf);
+        return result[item - ABDAY_1];
+      }
+    {
+      static char const months[][sizeof "September"] = {
+        "January", "February", "March", "April", "May", "June", "July",
+        "August", "September", "October", "November", "December"
+      };
+      case MON_1:
+      case MON_2:
+      case MON_3:
+      case MON_4:
+      case MON_5:
+      case MON_6:
+      case MON_7:
+      case MON_8:
+      case MON_9:
+      case MON_10:
+      case MON_11:
+      case MON_12:
+        {
+          static char result[12][50];
+          tmm.tm_mon = item - MON_1;
+          if (!strftime (buf, sizeof result[0], "%B", &tmm))
+            return (char *) months[item - MON_1];
+          strcpy (result[item - MON_1], buf);
+          return result[item - MON_1];
+        }
+      case ALTMON_1:
+      case ALTMON_2:
+      case ALTMON_3:
+      case ALTMON_4:
+      case ALTMON_5:
+      case ALTMON_6:
+      case ALTMON_7:
+      case ALTMON_8:
+      case ALTMON_9:
+      case ALTMON_10:
+      case ALTMON_11:
+      case ALTMON_12:
+        {
+          static char result[12][50];
+          tmm.tm_mon = item - ALTMON_1;
+          /* The platforms without nl_langinfo() don't support strftime with
+             %OB.  We don't even need to try.  */
+          #if 0
+          if (!strftime (buf, sizeof result[0], "%OB", &tmm))
+          #endif
+            if (!strftime (buf, sizeof result[0], "%B", &tmm))
+              return (char *) months[item - ALTMON_1];
+          strcpy (result[item - ALTMON_1], buf);
+          return result[item - ALTMON_1];
+        }
+    }
+    case ABMON_1:
+    case ABMON_2:
+    case ABMON_3:
+    case ABMON_4:
+    case ABMON_5:
+    case ABMON_6:
+    case ABMON_7:
+    case ABMON_8:
+    case ABMON_9:
+    case ABMON_10:
+    case ABMON_11:
+    case ABMON_12:
+      {
+        static char result[12][30];
+        static char const abmonths[][sizeof "Jan"] = {
+          "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
+          "Aug", "Sep", "Oct", "Nov", "Dec"
+        };
+        tmm.tm_mon = item - ABMON_1;
+        if (!strftime (buf, sizeof result[0], "%b", &tmm))
+          return (char *) abmonths[item - ABMON_1];
+        strcpy (result[item - ABMON_1], buf);
+        return result[item - ABMON_1];
+      }
+    case ERA:
+      return (char *) "";
+    case ALT_DIGITS:
+      return (char *) "\0\0\0\0\0\0\0\0\0\0";
+    /* nl_langinfo items of the LC_MONETARY category.  */
+    case CRNCYSTR:
+      return localeconv () ->currency_symbol;
+# ifdef INT_CURR_SYMBOL
+    case INT_CURR_SYMBOL:
+      return localeconv () ->int_curr_symbol;
+    case MON_DECIMAL_POINT:
+      return localeconv () ->mon_decimal_point;
+    case MON_THOUSANDS_SEP:
+      return localeconv () ->mon_thousands_sep;
+    case MON_GROUPING:
+      return localeconv () ->mon_grouping;
+    case POSITIVE_SIGN:
+      return localeconv () ->positive_sign;
+    case NEGATIVE_SIGN:
+      return localeconv () ->negative_sign;
+    case FRAC_DIGITS:
+      return & localeconv () ->frac_digits;
+    case INT_FRAC_DIGITS:
+      return & localeconv () ->int_frac_digits;
+    case P_CS_PRECEDES:
+      return & localeconv () ->p_cs_precedes;
+    case N_CS_PRECEDES:
+      return & localeconv () ->n_cs_precedes;
+    case P_SEP_BY_SPACE:
+      return & localeconv () ->p_sep_by_space;
+    case N_SEP_BY_SPACE:
+      return & localeconv () ->n_sep_by_space;
+    case P_SIGN_POSN:
+      return & localeconv () ->p_sign_posn;
+    case N_SIGN_POSN:
+      return & localeconv () ->n_sign_posn;
+# endif
+    /* nl_langinfo items of the LC_MESSAGES category
+       TODO: Really use the locale. */
+    case YESEXPR:
+      return (char *) "^[yY]";
+    case NOEXPR:
+      return (char *) "^[nN]";
+    default:
+      return (char *) "";
+    }
+}
+
+#endif
deleted file mode 120000 (symlink)
index 5865ce1100e69da5d1e7ce452439901e78fb356f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/nproc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..92a07e8289007937420208f4038e1dbde40a2801
--- /dev/null
@@ -0,0 +1,404 @@
+/* Detect the number of processors.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Glen Lenker and Bruno Haible.  */
+
+#include <config.h>
+#include "nproc.h"
+
+#include <limits.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#if HAVE_PTHREAD_GETAFFINITY_NP && 0
+# include <pthread.h>
+# include <sched.h>
+#endif
+#if HAVE_SCHED_GETAFFINITY_LIKE_GLIBC || HAVE_SCHED_GETAFFINITY_NP
+# include <sched.h>
+#endif
+
+#include <sys/types.h>
+
+#if HAVE_SYS_PSTAT_H
+# include <sys/pstat.h>
+#endif
+
+#if HAVE_SYS_SYSMP_H
+# include <sys/sysmp.h>
+#endif
+
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+#if HAVE_SYS_SYSCTL_H && !(defined __GLIBC__ && defined __linux__)
+# include <sys/sysctl.h>
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
+#include "c-ctype.h"
+
+#include "minmax.h"
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+/* Return the number of processors available to the current process, based
+   on a modern system call that returns the "affinity" between the current
+   process and each CPU.  Return 0 if unknown or if such a system call does
+   not exist.  */
+static unsigned long
+num_processors_via_affinity_mask (void)
+{
+  /* glibc >= 2.3.3 with NPTL and NetBSD 5 have pthread_getaffinity_np,
+     but with different APIs.  Also it requires linking with -lpthread.
+     Therefore this code is not enabled.
+     glibc >= 2.3.4 has sched_getaffinity whereas NetBSD 5 has
+     sched_getaffinity_np.  */
+#if HAVE_PTHREAD_GETAFFINITY_NP && defined __GLIBC__ && 0
+  {
+    cpu_set_t set;
+
+    if (pthread_getaffinity_np (pthread_self (), sizeof (set), &set) == 0)
+      {
+        unsigned long count;
+
+# ifdef CPU_COUNT
+        /* glibc >= 2.6 has the CPU_COUNT macro.  */
+        count = CPU_COUNT (&set);
+# else
+        size_t i;
+
+        count = 0;
+        for (i = 0; i < CPU_SETSIZE; i++)
+          if (CPU_ISSET (i, &set))
+            count++;
+# endif
+        if (count > 0)
+          return count;
+      }
+  }
+#elif HAVE_PTHREAD_GETAFFINITY_NP && defined __NetBSD__ && 0
+  {
+    cpuset_t *set;
+
+    set = cpuset_create ();
+    if (set != NULL)
+      {
+        unsigned long count = 0;
+
+        if (pthread_getaffinity_np (pthread_self (), cpuset_size (set), set)
+            == 0)
+          {
+            cpuid_t i;
+
+            for (i = 0;; i++)
+              {
+                int ret = cpuset_isset (i, set);
+                if (ret < 0)
+                  break;
+                if (ret > 0)
+                  count++;
+              }
+          }
+        cpuset_destroy (set);
+        if (count > 0)
+          return count;
+      }
+  }
+#elif HAVE_SCHED_GETAFFINITY_LIKE_GLIBC /* glibc >= 2.3.4 */
+  {
+    cpu_set_t set;
+
+    if (sched_getaffinity (0, sizeof (set), &set) == 0)
+      {
+        unsigned long count;
+
+# ifdef CPU_COUNT
+        /* glibc >= 2.6 has the CPU_COUNT macro.  */
+        count = CPU_COUNT (&set);
+# else
+        size_t i;
+
+        count = 0;
+        for (i = 0; i < CPU_SETSIZE; i++)
+          if (CPU_ISSET (i, &set))
+            count++;
+# endif
+        if (count > 0)
+          return count;
+      }
+  }
+#elif HAVE_SCHED_GETAFFINITY_NP /* NetBSD >= 5 */
+  {
+    cpuset_t *set;
+
+    set = cpuset_create ();
+    if (set != NULL)
+      {
+        unsigned long count = 0;
+
+        if (sched_getaffinity_np (getpid (), cpuset_size (set), set) == 0)
+          {
+            cpuid_t i;
+
+            for (i = 0;; i++)
+              {
+                int ret = cpuset_isset (i, set);
+                if (ret < 0)
+                  break;
+                if (ret > 0)
+                  count++;
+              }
+          }
+        cpuset_destroy (set);
+        if (count > 0)
+          return count;
+      }
+  }
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+  { /* This works on native Windows platforms.  */
+    DWORD_PTR process_mask;
+    DWORD_PTR system_mask;
+
+    if (GetProcessAffinityMask (GetCurrentProcess (),
+                                &process_mask, &system_mask))
+      {
+        DWORD_PTR mask = process_mask;
+        unsigned long count = 0;
+
+        for (; mask != 0; mask = mask >> 1)
+          if (mask & 1)
+            count++;
+        if (count > 0)
+          return count;
+      }
+  }
+#endif
+
+  return 0;
+}
+
+
+/* Return the total number of processors.  Here QUERY must be one of
+   NPROC_ALL, NPROC_CURRENT.  The result is guaranteed to be at least 1.  */
+static unsigned long int
+num_processors_ignoring_omp (enum nproc_query query)
+{
+  /* On systems with a modern affinity mask system call, we have
+         sysconf (_SC_NPROCESSORS_CONF)
+            >= sysconf (_SC_NPROCESSORS_ONLN)
+               >= num_processors_via_affinity_mask ()
+     The first number is the number of CPUs configured in the system.
+     The second number is the number of CPUs available to the scheduler.
+     The third number is the number of CPUs available to the current process.
+
+     Note! On Linux systems with glibc, the first and second number come from
+     the /sys and /proc file systems (see
+     glibc/sysdeps/unix/sysv/linux/getsysstats.c).
+     In some situations these file systems are not mounted, and the sysconf call
+     returns 1 or 2 (<https://sourceware.org/bugzilla/show_bug.cgi?id=21542>),
+     which does not reflect the reality.  */
+
+  if (query == NPROC_CURRENT)
+    {
+      /* Try the modern affinity mask system call.  */
+      {
+        unsigned long nprocs = num_processors_via_affinity_mask ();
+
+        if (nprocs > 0)
+          return nprocs;
+      }
+
+#if defined _SC_NPROCESSORS_ONLN
+      { /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
+           Cygwin, Haiku.  */
+        long int nprocs = sysconf (_SC_NPROCESSORS_ONLN);
+        if (nprocs > 0)
+          return nprocs;
+      }
+#endif
+    }
+  else /* query == NPROC_ALL */
+    {
+#if defined _SC_NPROCESSORS_CONF
+      { /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
+           Cygwin, Haiku.  */
+        long int nprocs = sysconf (_SC_NPROCESSORS_CONF);
+
+# if __GLIBC__ >= 2 && defined __linux__
+        /* On Linux systems with glibc, this information comes from the /sys and
+           /proc file systems (see glibc/sysdeps/unix/sysv/linux/getsysstats.c).
+           In some situations these file systems are not mounted, and the
+           sysconf call returns 1 or 2.  But we wish to guarantee that
+           num_processors (NPROC_ALL) >= num_processors (NPROC_CURRENT).  */
+        if (nprocs == 1 || nprocs == 2)
+          {
+            unsigned long nprocs_current = num_processors_via_affinity_mask ();
+
+            if (/* nprocs_current > 0 && */ nprocs_current > nprocs)
+              nprocs = nprocs_current;
+          }
+# endif
+
+        if (nprocs > 0)
+          return nprocs;
+      }
+#endif
+    }
+
+#if HAVE_PSTAT_GETDYNAMIC
+  { /* This works on HP-UX.  */
+    struct pst_dynamic psd;
+    if (pstat_getdynamic (&psd, sizeof psd, 1, 0) >= 0)
+      {
+        /* The field psd_proc_cnt contains the number of active processors.
+           In newer releases of HP-UX 11, the field psd_max_proc_cnt includes
+           deactivated processors.  */
+        if (query == NPROC_CURRENT)
+          {
+            if (psd.psd_proc_cnt > 0)
+              return psd.psd_proc_cnt;
+          }
+        else
+          {
+            if (psd.psd_max_proc_cnt > 0)
+              return psd.psd_max_proc_cnt;
+          }
+      }
+  }
+#endif
+
+#if HAVE_SYSMP && defined MP_NAPROCS && defined MP_NPROCS
+  { /* This works on IRIX.  */
+    /* MP_NPROCS yields the number of installed processors.
+       MP_NAPROCS yields the number of processors available to unprivileged
+       processes.  */
+    int nprocs =
+      sysmp (query == NPROC_CURRENT && getuid () != 0
+             ? MP_NAPROCS
+             : MP_NPROCS);
+    if (nprocs > 0)
+      return nprocs;
+  }
+#endif
+
+  /* Finally, as fallback, use the APIs that don't distinguish between
+     NPROC_CURRENT and NPROC_ALL.  */
+
+#if HAVE_SYSCTL && !(defined __GLIBC__ && defined __linux__) && defined HW_NCPU
+  { /* This works on macOS, FreeBSD, NetBSD, OpenBSD.
+       macOS 10.14 does not allow mib to be const.  */
+    int nprocs;
+    size_t len = sizeof (nprocs);
+    static int mib[][2] = {
+# ifdef HW_NCPUONLINE
+      { CTL_HW, HW_NCPUONLINE },
+# endif
+      { CTL_HW, HW_NCPU }
+    };
+    for (int i = 0; i < ARRAY_SIZE (mib); i++)
+      {
+        if (sysctl (mib[i], ARRAY_SIZE (mib[i]), &nprocs, &len, NULL, 0) == 0
+            && len == sizeof (nprocs)
+            && 0 < nprocs)
+          return nprocs;
+      }
+  }
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+  { /* This works on native Windows platforms.  */
+    SYSTEM_INFO system_info;
+    GetSystemInfo (&system_info);
+    if (0 < system_info.dwNumberOfProcessors)
+      return system_info.dwNumberOfProcessors;
+  }
+#endif
+
+  return 1;
+}
+
+/* Parse OMP environment variables without dependence on OMP.
+   Return 0 for invalid values.  */
+static unsigned long int
+parse_omp_threads (char const* threads)
+{
+  unsigned long int ret = 0;
+
+  if (threads == NULL)
+    return ret;
+
+  /* The OpenMP spec says that the value assigned to the environment variables
+     "may have leading and trailing white space".  */
+  while (*threads != '\0' && c_isspace (*threads))
+    threads++;
+
+  /* Convert it from positive decimal to 'unsigned long'.  */
+  if (c_isdigit (*threads))
+    {
+      char *endptr = NULL;
+      unsigned long int value = strtoul (threads, &endptr, 10);
+
+      if (endptr != NULL)
+        {
+          while (*endptr != '\0' && c_isspace (*endptr))
+            endptr++;
+          if (*endptr == '\0')
+            return value;
+          /* Also accept the first value in a nesting level,
+             since we can't determine the nesting level from env vars.  */
+          else if (*endptr == ',')
+            return value;
+        }
+    }
+
+  return ret;
+}
+
+unsigned long int
+num_processors (enum nproc_query query)
+{
+  unsigned long int omp_env_limit = ULONG_MAX;
+
+  if (query == NPROC_CURRENT_OVERRIDABLE)
+    {
+      unsigned long int omp_env_threads;
+      /* Honor the OpenMP environment variables, recognized also by all
+         programs that are based on OpenMP.  */
+      omp_env_threads = parse_omp_threads (getenv ("OMP_NUM_THREADS"));
+      omp_env_limit = parse_omp_threads (getenv ("OMP_THREAD_LIMIT"));
+      if (! omp_env_limit)
+        omp_env_limit = ULONG_MAX;
+
+      if (omp_env_threads)
+        return MIN (omp_env_threads, omp_env_limit);
+
+      query = NPROC_CURRENT;
+    }
+  /* Here query is one of NPROC_ALL, NPROC_CURRENT.  */
+  {
+    unsigned long nprocs = num_processors_ignoring_omp (query);
+    return MIN (nprocs, omp_env_limit);
+  }
+}
deleted file mode 120000 (symlink)
index f4aa0448c9629dbc01428780b38c8b3316cb5f73..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/nproc.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7054df5f7a3e72a393dfe70e493b91fd636a0b99
--- /dev/null
@@ -0,0 +1,46 @@
+/* Detect the number of processors.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Glen Lenker and Bruno Haible.  */
+
+/* Allow the use in C++ code.  */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* A "processor" in this context means a thread execution unit, that is either
+   - an execution core in a (possibly multi-core) chip, in a (possibly multi-
+     chip) module, in a single computer, or
+   - a thread execution unit inside a core
+     (hyper-threading, see <https://en.wikipedia.org/wiki/Hyper-threading>).
+   Which of the two definitions is used, is unspecified.  */
+
+enum nproc_query
+{
+  NPROC_ALL,                 /* total number of processors */
+  NPROC_CURRENT,             /* processors available to the current process */
+  NPROC_CURRENT_OVERRIDABLE  /* likewise, but overridable through the
+                                OMP_NUM_THREADS environment variable */
+};
+
+/* Return the total number of processors.  The result is guaranteed to
+   be at least 1.  */
+extern unsigned long int num_processors (enum nproc_query query);
+
+#ifdef __cplusplus
+}
+#endif /* C++ */
deleted file mode 120000 (symlink)
index 6c21777d62f415c503d020a7c127293b3f9bd3eb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/nstrftime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..21596329021d2c3abd6b8ecbe053e508cab67b57
--- /dev/null
+/* Copyright (C) 1991-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifdef _LIBC
+# define USE_IN_EXTENDED_LOCALE_MODEL 1
+# define HAVE_STRUCT_ERA_ENTRY 1
+# define HAVE_TM_GMTOFF 1
+# define HAVE_STRUCT_TM_TM_ZONE 1
+# define HAVE_TZNAME 1
+# include "../locale/localeinfo.h"
+#else
+# include <libc-config.h>
+# if FPRINTFTIME
+#  include "fprintftime.h"
+# else
+#  include "strftime.h"
+# endif
+# include "time-internal.h"
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <time.h>
+
+#if HAVE_TZNAME && !HAVE_DECL_TZNAME
+extern char *tzname[];
+#endif
+
+/* Do multibyte processing if multibyte encodings are supported, unless
+   multibyte sequences are safe in formats.  Multibyte sequences are
+   safe if they cannot contain byte sequences that look like format
+   conversion specifications.  The multibyte encodings used by the
+   C library on the various platforms (UTF-8, GB2312, GBK, CP936,
+   GB18030, EUC-TW, BIG5, BIG5-HKSCS, CP950, EUC-JP, EUC-KR, CP949,
+   SHIFT_JIS, CP932, JOHAB) are safe for formats, because the byte '%'
+   cannot occur in a multibyte character except in the first byte.
+
+   The DEC-HANYU encoding used on OSF/1 is not safe for formats, but
+   this encoding has never been seen in real-life use, so we ignore
+   it.  */
+#if !(defined __osf__ && 0)
+# define MULTIBYTE_IS_FORMAT_SAFE 1
+#endif
+#define DO_MULTIBYTE (! MULTIBYTE_IS_FORMAT_SAFE)
+
+#if DO_MULTIBYTE
+# include <wchar.h>
+  static const mbstate_t mbstate_zero;
+#endif
+
+#include <limits.h>
+#include <stdckdint.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "attribute.h"
+#include <intprops.h>
+
+#ifdef COMPILE_WIDE
+# include <endian.h>
+# define CHAR_T wchar_t
+# define UCHAR_T unsigned int
+# define L_(Str) L##Str
+# define NLW(Sym) _NL_W##Sym
+
+# define MEMCPY(d, s, n) __wmemcpy (d, s, n)
+# define STRLEN(s) __wcslen (s)
+
+#else
+# define CHAR_T char
+# define UCHAR_T unsigned char
+# define L_(Str) Str
+# define NLW(Sym) Sym
+# define ABALTMON_1 _NL_ABALTMON_1
+
+# define MEMCPY(d, s, n) memcpy (d, s, n)
+# define STRLEN(s) strlen (s)
+
+#endif
+
+/* Shift A right by B bits portably, by dividing A by 2**B and
+   truncating towards minus infinity.  A and B should be free of side
+   effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
+   INT_BITS is the number of useful bits in an int.  GNU code can
+   assume that INT_BITS is at least 32.
+
+   ISO C99 says that A >> B is implementation-defined if A < 0.  Some
+   implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
+   right in the usual way when A < 0, so SHR falls back on division if
+   ordinary A >> B doesn't seem to be the usual signed shift.  */
+#define SHR(a, b)       \
+  (-1 >> 1 == -1        \
+   ? (a) >> (b)         \
+   : ((a) + ((a) < 0)) / (1 << (b)) - ((a) < 0))
+
+#define TM_YEAR_BASE 1900
+
+#ifndef __isleap
+/* Nonzero if YEAR is a leap year (every 4 years,
+   except every 100th isn't, and every 400th is).  */
+# define __isleap(year) \
+  ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+#endif
+
+
+#ifdef _LIBC
+# define mktime_z(tz, tm) mktime (tm)
+# define tzname __tzname
+# define tzset __tzset
+#endif
+
+#ifndef FPRINTFTIME
+# define FPRINTFTIME 0
+#endif
+
+#if FPRINTFTIME
+# define STREAM_OR_CHAR_T FILE
+# define STRFTIME_ARG(x) /* empty */
+#else
+# define STREAM_OR_CHAR_T CHAR_T
+# define STRFTIME_ARG(x) x,
+#endif
+
+#if FPRINTFTIME
+# define memset_byte(P, Len, Byte) \
+  do { size_t _i; for (_i = 0; _i < Len; _i++) fputc (Byte, P); } while (0)
+# define memset_space(P, Len) memset_byte (P, Len, ' ')
+# define memset_zero(P, Len) memset_byte (P, Len, '0')
+#elif defined COMPILE_WIDE
+# define memset_space(P, Len) (wmemset (P, L' ', Len), (P) += (Len))
+# define memset_zero(P, Len) (wmemset (P, L'0', Len), (P) += (Len))
+#else
+# define memset_space(P, Len) (memset (P, ' ', Len), (P) += (Len))
+# define memset_zero(P, Len) (memset (P, '0', Len), (P) += (Len))
+#endif
+
+#if FPRINTFTIME
+# define advance(P, N)
+#else
+# define advance(P, N) ((P) += (N))
+#endif
+
+#define add(n, f) width_add (width, n, f)
+#define width_add(width, n, f)                                                \
+  do                                                                          \
+    {                                                                         \
+      size_t _n = (n);                                                        \
+      size_t _w = pad == L_('-') || width < 0 ? 0 : width;                    \
+      size_t _incr = _n < _w ? _w : _n;                                       \
+      if (_incr >= maxsize - i)                                               \
+        {                                                                     \
+          errno = ERANGE;                                                     \
+          return 0;                                                           \
+        }                                                                     \
+      if (p)                                                                  \
+        {                                                                     \
+          if (_n < _w)                                                        \
+            {                                                                 \
+              size_t _delta = _w - _n;                                        \
+              if (pad == L_('0') || pad == L_('+'))                           \
+                memset_zero (p, _delta);                                      \
+              else                                                            \
+                memset_space (p, _delta);                                     \
+            }                                                                 \
+          f;                                                                  \
+          advance (p, _n);                                                    \
+        }                                                                     \
+      i += _incr;                                                             \
+    } while (0)
+
+#define add1(c) width_add1 (width, c)
+#if FPRINTFTIME
+# define width_add1(width, c) width_add (width, 1, fputc (c, p))
+#else
+# define width_add1(width, c) width_add (width, 1, *p = c)
+#endif
+
+#define cpy(n, s) width_cpy (width, n, s)
+#if FPRINTFTIME
+# define width_cpy(width, n, s)                                               \
+    width_add (width, n,                                                      \
+     do                                                                       \
+       {                                                                      \
+         if (to_lowcase)                                                      \
+           fwrite_lowcase (p, (s), _n);                                       \
+         else if (to_uppcase)                                                 \
+           fwrite_uppcase (p, (s), _n);                                       \
+         else                                                                 \
+           {                                                                  \
+             /* Ignore the value of fwrite.  The caller can determine whether \
+                an error occurred by inspecting ferror (P).  All known fwrite \
+                implementations set the stream's error indicator when they    \
+                fail due to ENOMEM etc., even though C11 and POSIX.1-2008 do  \
+                not require this.  */                                         \
+             fwrite (s, _n, 1, p);                                            \
+           }                                                                  \
+       }                                                                      \
+     while (0)                                                                \
+    )
+#else
+# define width_cpy(width, n, s)                                               \
+    width_add (width, n,                                                      \
+         if (to_lowcase)                                                      \
+           memcpy_lowcase (p, (s), _n LOCALE_ARG);                            \
+         else if (to_uppcase)                                                 \
+           memcpy_uppcase (p, (s), _n LOCALE_ARG);                            \
+         else                                                                 \
+           MEMCPY ((void *) p, (void const *) (s), _n))
+#endif
+
+#ifdef COMPILE_WIDE
+# ifndef USE_IN_EXTENDED_LOCALE_MODEL
+#  undef __mbsrtowcs_l
+#  define __mbsrtowcs_l(d, s, l, st, loc) __mbsrtowcs (d, s, l, st)
+# endif
+#endif
+
+
+#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
+/* We use this code also for the extended locale handling where the
+   function gets as an additional argument the locale which has to be
+   used.  To access the values we have to redefine the _NL_CURRENT
+   macro.  */
+# define strftime               __strftime_l
+# define wcsftime               __wcsftime_l
+# undef _NL_CURRENT
+# define _NL_CURRENT(category, item) \
+  (current->values[_NL_ITEM_INDEX (item)].string)
+# define LOCALE_PARAM , locale_t loc
+# define LOCALE_ARG , loc
+# define HELPER_LOCALE_ARG  , current
+#else
+# define LOCALE_PARAM
+# define LOCALE_ARG
+# ifdef _LIBC
+#  define HELPER_LOCALE_ARG , _NL_CURRENT_DATA (LC_TIME)
+# else
+#  define HELPER_LOCALE_ARG
+# endif
+#endif
+
+#ifdef COMPILE_WIDE
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+#  define TOUPPER(Ch, L) __towupper_l (Ch, L)
+#  define TOLOWER(Ch, L) __towlower_l (Ch, L)
+# else
+#  define TOUPPER(Ch, L) towupper (Ch)
+#  define TOLOWER(Ch, L) towlower (Ch)
+# endif
+#else
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+#  define TOUPPER(Ch, L) __toupper_l (Ch, L)
+#  define TOLOWER(Ch, L) __tolower_l (Ch, L)
+# else
+#  define TOUPPER(Ch, L) toupper (Ch)
+#  define TOLOWER(Ch, L) tolower (Ch)
+# endif
+#endif
+/* We don't use 'isdigit' here since the locale dependent
+   interpretation is not what we want here.  We only need to accept
+   the arabic digits in the ASCII range.  One day there is perhaps a
+   more reliable way to accept other sets of digits.  */
+#define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9)
+
+/* Avoid false GCC warning "'memset' specified size 18446744073709551615 exceeds
+   maximum object size 9223372036854775807", caused by insufficient data flow
+   analysis and value propagation of the 'width_add' expansion when GCC is not
+   optimizing.  Cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443>.  */
+#if __GNUC__ >= 7 && !__OPTIMIZE__
+# pragma GCC diagnostic ignored "-Wstringop-overflow"
+#endif
+
+#if FPRINTFTIME
+static void
+fwrite_lowcase (FILE *fp, const CHAR_T *src, size_t len)
+{
+  while (len-- > 0)
+    {
+      fputc (TOLOWER ((UCHAR_T) *src, loc), fp);
+      ++src;
+    }
+}
+
+static void
+fwrite_uppcase (FILE *fp, const CHAR_T *src, size_t len)
+{
+  while (len-- > 0)
+    {
+      fputc (TOUPPER ((UCHAR_T) *src, loc), fp);
+      ++src;
+    }
+}
+#else
+static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src,
+                               size_t len LOCALE_PARAM);
+
+static CHAR_T *
+memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM)
+{
+  while (len-- > 0)
+    dest[len] = TOLOWER ((UCHAR_T) src[len], loc);
+  return dest;
+}
+
+static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src,
+                               size_t len LOCALE_PARAM);
+
+static CHAR_T *
+memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM)
+{
+  while (len-- > 0)
+    dest[len] = TOUPPER ((UCHAR_T) src[len], loc);
+  return dest;
+}
+#endif
+
+
+#if ! HAVE_TM_GMTOFF
+/* Yield the difference between *A and *B,
+   measured in seconds, ignoring leap seconds.  */
+# define tm_diff ftime_tm_diff
+static int tm_diff (const struct tm *, const struct tm *);
+static int
+tm_diff (const struct tm *a, const struct tm *b)
+{
+  /* Compute intervening leap days correctly even if year is negative.
+     Take care to avoid int overflow in leap day calculations,
+     but it's OK to assume that A and B are close to each other.  */
+  int a4 = SHR (a->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (a->tm_year & 3);
+  int b4 = SHR (b->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (b->tm_year & 3);
+  int a100 = (a4 + (a4 < 0)) / 25 - (a4 < 0);
+  int b100 = (b4 + (b4 < 0)) / 25 - (b4 < 0);
+  int a400 = SHR (a100, 2);
+  int b400 = SHR (b100, 2);
+  int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
+  int years = a->tm_year - b->tm_year;
+  int days = (365 * years + intervening_leap_days
+              + (a->tm_yday - b->tm_yday));
+  return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+                + (a->tm_min - b->tm_min))
+          + (a->tm_sec - b->tm_sec));
+}
+#endif /* ! HAVE_TM_GMTOFF */
+
+
+
+/* The number of days from the first day of the first ISO week of this
+   year to the year day YDAY with week day WDAY.  ISO weeks start on
+   Monday; the first ISO week has the year's first Thursday.  YDAY may
+   be as small as YDAY_MINIMUM.  */
+#define ISO_WEEK_START_WDAY 1 /* Monday */
+#define ISO_WEEK1_WDAY 4 /* Thursday */
+#define YDAY_MINIMUM (-366)
+static int iso_week_days (int, int);
+static __inline int
+iso_week_days (int yday, int wday)
+{
+  /* Add enough to the first operand of % to make it nonnegative.  */
+  int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
+  return (yday
+          - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
+          + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY);
+}
+
+
+/* When compiling this file, GNU applications can #define my_strftime
+   to a symbol (typically nstrftime) to get an extended strftime with
+   extra arguments TZ and NS.  */
+
+#if FPRINTFTIME
+# undef my_strftime
+# define my_strftime fprintftime
+#endif
+
+#ifdef my_strftime
+# define extra_args , tz, ns
+# define extra_args_spec , timezone_t tz, int ns
+#else
+# if defined COMPILE_WIDE
+#  define my_strftime wcsftime
+#  define nl_get_alt_digit _nl_get_walt_digit
+# else
+#  define my_strftime strftime
+#  define nl_get_alt_digit _nl_get_alt_digit
+# endif
+# define extra_args
+# define extra_args_spec
+/* We don't have this information in general.  */
+# define tz 1
+# define ns 0
+#endif
+
+static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG (size_t)
+                                   const CHAR_T *, const struct tm *,
+                                   bool, int, int, bool *
+                                   extra_args_spec LOCALE_PARAM);
+
+/* Write information from TP into S according to the format
+   string FORMAT, writing no more that MAXSIZE characters
+   (including the terminating '\0') and returning number of
+   characters written.  If S is NULL, nothing will be written
+   anywhere, so to determine how many characters would be
+   written, use NULL for S and (size_t) -1 for MAXSIZE.  */
+size_t
+my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
+             const CHAR_T *format,
+             const struct tm *tp extra_args_spec LOCALE_PARAM)
+{
+  bool tzset_called = false;
+  return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, false,
+                              0, -1, &tzset_called extra_args LOCALE_ARG);
+}
+libc_hidden_def (my_strftime)
+
+/* Just like my_strftime, above, but with more parameters.
+   UPCASE indicates that the result should be converted to upper case.
+   YR_SPEC and WIDTH specify the padding and width for the year.
+   *TZSET_CALLED indicates whether tzset has been called here.  */
+static size_t
+__strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
+                     const CHAR_T *format,
+                     const struct tm *tp, bool upcase,
+                     int yr_spec, int width, bool *tzset_called
+                     extra_args_spec LOCALE_PARAM)
+{
+#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
+  struct __locale_data *const current = loc->__locales[LC_TIME];
+#endif
+#if FPRINTFTIME
+  size_t maxsize = (size_t) -1;
+#endif
+
+  int saved_errno = errno;
+  int hour12 = tp->tm_hour;
+#ifdef _NL_CURRENT
+  /* We cannot make the following values variables since we must delay
+     the evaluation of these values until really needed since some
+     expressions might not be valid in every situation.  The 'struct tm'
+     might be generated by a strptime() call that initialized
+     only a few elements.  Dereference the pointers only if the format
+     requires this.  Then it is ok to fail if the pointers are invalid.  */
+# define a_wkday \
+  ((const CHAR_T *) (tp->tm_wday < 0 || tp->tm_wday > 6                      \
+                     ? "?" : _NL_CURRENT (LC_TIME, NLW(ABDAY_1) + tp->tm_wday)))
+# define f_wkday \
+  ((const CHAR_T *) (tp->tm_wday < 0 || tp->tm_wday > 6                      \
+                     ? "?" : _NL_CURRENT (LC_TIME, NLW(DAY_1) + tp->tm_wday)))
+# define a_month \
+  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11                       \
+                     ? "?" : _NL_CURRENT (LC_TIME, NLW(ABMON_1) + tp->tm_mon)))
+# define f_month \
+  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11                       \
+                     ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)))
+# define a_altmonth \
+  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11                       \
+                     ? "?" : _NL_CURRENT (LC_TIME, NLW(ABALTMON_1) + tp->tm_mon)))
+# define f_altmonth \
+  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11                       \
+                     ? "?" : _NL_CURRENT (LC_TIME, NLW(ALTMON_1) + tp->tm_mon)))
+# define ampm \
+  ((const CHAR_T *) _NL_CURRENT (LC_TIME, tp->tm_hour > 11                    \
+                                 ? NLW(PM_STR) : NLW(AM_STR)))
+
+# define aw_len STRLEN (a_wkday)
+# define am_len STRLEN (a_month)
+# define aam_len STRLEN (a_altmonth)
+# define ap_len STRLEN (ampm)
+#endif
+#if HAVE_TZNAME
+  char **tzname_vec = tzname;
+#endif
+  const char *zone;
+  size_t i = 0;
+  STREAM_OR_CHAR_T *p = s;
+  const CHAR_T *f;
+#if DO_MULTIBYTE && !defined COMPILE_WIDE
+  const char *format_end = NULL;
+#endif
+
+  zone = NULL;
+#if HAVE_STRUCT_TM_TM_ZONE
+  /* The POSIX test suite assumes that setting
+     the environment variable TZ to a new value before calling strftime()
+     will influence the result (the %Z format) even if the information in
+     TP is computed with a totally different time zone.
+     This is bogus: though POSIX allows bad behavior like this,
+     POSIX does not require it.  Do the right thing instead.  */
+  zone = (const char *) tp->tm_zone;
+#endif
+#if HAVE_TZNAME
+  if (!tz)
+    {
+      if (! (zone && *zone))
+        zone = "GMT";
+    }
+  else
+    {
+# if !HAVE_STRUCT_TM_TM_ZONE
+      /* Infer the zone name from *TZ instead of from TZNAME.  */
+      tzname_vec = tz->tzname_copy;
+# endif
+    }
+  /* The tzset() call might have changed the value.  */
+  if (!(zone && *zone) && tp->tm_isdst >= 0)
+    {
+      /* POSIX.1 requires that local time zone information be used as
+         though strftime called tzset.  */
+# ifndef my_strftime
+      if (!*tzset_called)
+        {
+          tzset ();
+          *tzset_called = true;
+        }
+# endif
+      zone = tzname_vec[tp->tm_isdst != 0];
+    }
+#endif
+  if (! zone)
+    zone = "";
+
+  if (hour12 > 12)
+    hour12 -= 12;
+  else
+    if (hour12 == 0)
+      hour12 = 12;
+
+  for (f = format; *f != '\0'; width = -1, f++)
+    {
+      int pad = 0;  /* Padding for number ('_', '-', '+', '0', or 0).  */
+      int modifier;             /* Field modifier ('E', 'O', or 0).  */
+      int digits = 0;           /* Max digits for numeric format.  */
+      int number_value;         /* Numeric value to be printed.  */
+      unsigned int u_number_value; /* (unsigned int) number_value.  */
+      bool negative_number;     /* The number is negative.  */
+      bool always_output_a_sign; /* +/- should always be output.  */
+      int tz_colon_mask;        /* Bitmask of where ':' should appear.  */
+      const CHAR_T *subfmt;
+      CHAR_T *bufp;
+      CHAR_T buf[1
+                 + 2 /* for the two colons in a %::z or %:::z time zone */
+                 + (sizeof (int) < sizeof (time_t)
+                    ? INT_STRLEN_BOUND (time_t)
+                    : INT_STRLEN_BOUND (int))];
+      bool to_lowcase = false;
+      bool to_uppcase = upcase;
+      size_t colons;
+      bool change_case = false;
+      int format_char;
+      int subwidth;
+
+#if DO_MULTIBYTE && !defined COMPILE_WIDE
+      switch (*f)
+        {
+        case L_('%'):
+          break;
+
+        case L_('\b'): case L_('\t'): case L_('\n'):
+        case L_('\v'): case L_('\f'): case L_('\r'):
+        case L_(' '): case L_('!'): case L_('"'): case L_('#'): case L_('&'):
+        case L_('\''): case L_('('): case L_(')'): case L_('*'): case L_('+'):
+        case L_(','): case L_('-'): case L_('.'): case L_('/'): case L_('0'):
+        case L_('1'): case L_('2'): case L_('3'): case L_('4'): case L_('5'):
+        case L_('6'): case L_('7'): case L_('8'): case L_('9'): case L_(':'):
+        case L_(';'): case L_('<'): case L_('='): case L_('>'): case L_('?'):
+        case L_('A'): case L_('B'): case L_('C'): case L_('D'): case L_('E'):
+        case L_('F'): case L_('G'): case L_('H'): case L_('I'): case L_('J'):
+        case L_('K'): case L_('L'): case L_('M'): case L_('N'): case L_('O'):
+        case L_('P'): case L_('Q'): case L_('R'): case L_('S'): case L_('T'):
+        case L_('U'): case L_('V'): case L_('W'): case L_('X'): case L_('Y'):
+        case L_('Z'): case L_('['): case L_('\\'): case L_(']'): case L_('^'):
+        case L_('_'): case L_('a'): case L_('b'): case L_('c'): case L_('d'):
+        case L_('e'): case L_('f'): case L_('g'): case L_('h'): case L_('i'):
+        case L_('j'): case L_('k'): case L_('l'): case L_('m'): case L_('n'):
+        case L_('o'): case L_('p'): case L_('q'): case L_('r'): case L_('s'):
+        case L_('t'): case L_('u'): case L_('v'): case L_('w'): case L_('x'):
+        case L_('y'): case L_('z'): case L_('{'): case L_('|'): case L_('}'):
+        case L_('~'):
+          /* The C Standard requires these 98 characters (plus '%') to
+             be in the basic execution character set.  None of these
+             characters can start a multibyte sequence, so they need
+             not be analyzed further.  */
+          add1 (*f);
+          continue;
+
+        default:
+          /* Copy this multibyte sequence until we reach its end, find
+             an error, or come back to the initial shift state.  */
+          {
+            mbstate_t mbstate = mbstate_zero;
+            size_t len = 0;
+            size_t fsize;
+
+            if (! format_end)
+              format_end = f + strlen (f) + 1;
+            fsize = format_end - f;
+
+            do
+              {
+                size_t bytes = mbrlen (f + len, fsize - len, &mbstate);
+
+                if (bytes == 0)
+                  break;
+
+                if (bytes == (size_t) -2)
+                  {
+                    len += strlen (f + len);
+                    break;
+                  }
+
+                if (bytes == (size_t) -1)
+                  {
+                    len++;
+                    break;
+                  }
+
+                len += bytes;
+              }
+            while (! mbsinit (&mbstate));
+
+            cpy (len, f);
+            f += len - 1;
+            continue;
+          }
+        }
+
+#else /* ! DO_MULTIBYTE */
+
+      /* Either multibyte encodings are not supported, they are
+         safe for formats, so any non-'%' byte can be copied through,
+         or this is the wide character version.  */
+      if (*f != L_('%'))
+        {
+          add1 (*f);
+          continue;
+        }
+
+#endif /* ! DO_MULTIBYTE */
+
+      char const *percent = f;
+
+      /* Check for flags that can modify a format.  */
+      while (1)
+        {
+          switch (*++f)
+            {
+              /* This influences the number formats.  */
+            case L_('_'):
+            case L_('-'):
+            case L_('+'):
+            case L_('0'):
+              pad = *f;
+              continue;
+
+              /* This changes textual output.  */
+            case L_('^'):
+              to_uppcase = true;
+              continue;
+            case L_('#'):
+              change_case = true;
+              continue;
+
+            default:
+              break;
+            }
+          break;
+        }
+
+      if (ISDIGIT (*f))
+        {
+          width = 0;
+          do
+            {
+              if (ckd_mul (&width, width, 10)
+                  || ckd_add (&width, width, *f - L_('0')))
+                width = INT_MAX;
+              ++f;
+            }
+          while (ISDIGIT (*f));
+        }
+
+      /* Check for modifiers.  */
+      switch (*f)
+        {
+        case L_('E'):
+        case L_('O'):
+          modifier = *f++;
+          break;
+
+        default:
+          modifier = 0;
+          break;
+        }
+
+      /* Now do the specified format.  */
+      format_char = *f;
+      switch (format_char)
+        {
+#define DO_NUMBER(d, v) \
+          do                                                                  \
+            {                                                                 \
+              digits = d;                                                     \
+              number_value = v;                                               \
+              goto do_number;                                                 \
+            }                                                                 \
+          while (0)
+#define DO_SIGNED_NUMBER(d, negative, v) \
+          DO_MAYBE_SIGNED_NUMBER (d, negative, v, do_signed_number)
+#define DO_YEARISH(d, negative, v) \
+          DO_MAYBE_SIGNED_NUMBER (d, negative, v, do_yearish)
+#define DO_MAYBE_SIGNED_NUMBER(d, negative, v, label) \
+          do                                                                  \
+            {                                                                 \
+              digits = d;                                                     \
+              negative_number = negative;                                     \
+              u_number_value = v;                                             \
+              goto label;                                                     \
+            }                                                                 \
+          while (0)
+
+          /* The mask is not what you might think.
+             When the ordinal i'th bit is set, insert a colon
+             before the i'th digit of the time zone representation.  */
+#define DO_TZ_OFFSET(d, mask, v) \
+          do                                                                  \
+            {                                                                 \
+              digits = d;                                                     \
+              tz_colon_mask = mask;                                           \
+              u_number_value = v;                                             \
+              goto do_tz_offset;                                              \
+            }                                                                 \
+          while (0)
+#define DO_NUMBER_SPACEPAD(d, v) \
+          do                                                                  \
+            {                                                                 \
+              digits = d;                                                     \
+              number_value = v;                                               \
+              goto do_number_spacepad;                                        \
+            }                                                                 \
+          while (0)
+
+        case L_('%'):
+          if (f - 1 != percent)
+            goto bad_percent;
+          add1 (*f);
+          break;
+
+        case L_('a'):
+          if (modifier != 0)
+            goto bad_format;
+          if (change_case)
+            {
+              to_uppcase = true;
+              to_lowcase = false;
+            }
+#ifdef _NL_CURRENT
+          cpy (aw_len, a_wkday);
+          break;
+#else
+          goto underlying_strftime;
+#endif
+
+        case 'A':
+          if (modifier != 0)
+            goto bad_format;
+          if (change_case)
+            {
+              to_uppcase = true;
+              to_lowcase = false;
+            }
+#ifdef _NL_CURRENT
+          cpy (STRLEN (f_wkday), f_wkday);
+          break;
+#else
+          goto underlying_strftime;
+#endif
+
+        case L_('b'):
+        case L_('h'):
+          if (change_case)
+            {
+              to_uppcase = true;
+              to_lowcase = false;
+            }
+          if (modifier == L_('E'))
+            goto bad_format;
+#ifdef _NL_CURRENT
+          if (modifier == L_('O'))
+            cpy (aam_len, a_altmonth);
+          else
+            cpy (am_len, a_month);
+          break;
+#else
+          goto underlying_strftime;
+#endif
+
+        case L_('B'):
+          if (modifier == L_('E'))
+            goto bad_format;
+          if (change_case)
+            {
+              to_uppcase = true;
+              to_lowcase = false;
+            }
+#ifdef _NL_CURRENT
+          if (modifier == L_('O'))
+            cpy (STRLEN (f_altmonth), f_altmonth);
+          else
+            cpy (STRLEN (f_month), f_month);
+          break;
+#else
+          goto underlying_strftime;
+#endif
+
+        case L_('c'):
+          if (modifier == L_('O'))
+            goto bad_format;
+#ifdef _NL_CURRENT
+          if (! (modifier == L_('E')
+                 && (*(subfmt =
+                       (const CHAR_T *) _NL_CURRENT (LC_TIME,
+                                                     NLW(ERA_D_T_FMT)))
+                     != '\0')))
+            subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_T_FMT));
+#else
+          goto underlying_strftime;
+#endif
+
+        subformat:
+          subwidth = -1;
+        subformat_width:
+          {
+            size_t len = __strftime_internal (NULL, STRFTIME_ARG ((size_t) -1)
+                                              subfmt, tp, to_uppcase,
+                                              pad, subwidth, tzset_called
+                                              extra_args LOCALE_ARG);
+            add (len, __strftime_internal (p,
+                                           STRFTIME_ARG (maxsize - i)
+                                           subfmt, tp, to_uppcase,
+                                           pad, subwidth, tzset_called
+                                           extra_args LOCALE_ARG));
+          }
+          break;
+
+#if !(defined _NL_CURRENT && HAVE_STRUCT_ERA_ENTRY)
+        underlying_strftime:
+          {
+            /* The relevant information is available only via the
+               underlying strftime implementation, so use that.  */
+            char ufmt[5];
+            char *u = ufmt;
+            char ubuf[1024]; /* enough for any single format in practice */
+            size_t len;
+            /* Make sure we're calling the actual underlying strftime.
+               In some cases, config.h contains something like
+               "#define strftime rpl_strftime".  */
+# ifdef strftime
+#  undef strftime
+            size_t strftime (char *, size_t, const char *, struct tm const *);
+# endif
+
+            /* The space helps distinguish strftime failure from empty
+               output.  */
+            *u++ = ' ';
+            *u++ = '%';
+            if (modifier != 0)
+              *u++ = modifier;
+            *u++ = format_char;
+            *u = '\0';
+            len = strftime (ubuf, sizeof ubuf, ufmt, tp);
+            if (len != 0)
+              cpy (len - 1, ubuf + 1);
+          }
+          break;
+#endif
+
+        case L_('C'):
+          if (modifier == L_('E'))
+            {
+#if HAVE_STRUCT_ERA_ENTRY
+              struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
+              if (era)
+                {
+# ifdef COMPILE_WIDE
+                  size_t len = __wcslen (era->era_wname);
+                  cpy (len, era->era_wname);
+# else
+                  size_t len = strlen (era->era_name);
+                  cpy (len, era->era_name);
+# endif
+                  break;
+                }
+#else
+              goto underlying_strftime;
+#endif
+            }
+
+          {
+            bool negative_year = tp->tm_year < - TM_YEAR_BASE;
+            bool zero_thru_1899 = !negative_year & (tp->tm_year < 0);
+            int century = ((tp->tm_year - 99 * zero_thru_1899) / 100
+                           + TM_YEAR_BASE / 100);
+            DO_YEARISH (2, negative_year, century);
+          }
+
+        case L_('x'):
+          if (modifier == L_('O'))
+            goto bad_format;
+#ifdef _NL_CURRENT
+          if (! (modifier == L_('E')
+                 && (*(subfmt =
+                       (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_D_FMT)))
+                     != L_('\0'))))
+            subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_FMT));
+          goto subformat;
+#else
+          goto underlying_strftime;
+#endif
+        case L_('D'):
+          if (modifier != 0)
+            goto bad_format;
+          subfmt = L_("%m/%d/%y");
+          goto subformat;
+
+        case L_('d'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER (2, tp->tm_mday);
+
+        case L_('e'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER_SPACEPAD (2, tp->tm_mday);
+
+          /* All numeric formats set DIGITS and NUMBER_VALUE (or U_NUMBER_VALUE)
+             and then jump to one of these labels.  */
+
+        do_tz_offset:
+          always_output_a_sign = true;
+          goto do_number_body;
+
+        do_yearish:
+          if (pad == 0)
+            pad = yr_spec;
+          always_output_a_sign
+            = (pad == L_('+')
+               && ((digits == 2 ? 99 : 9999) < u_number_value
+                   || digits < width));
+          goto do_maybe_signed_number;
+
+        do_number_spacepad:
+          if (pad == 0)
+            pad = L_('_');
+
+        do_number:
+          /* Format NUMBER_VALUE according to the MODIFIER flag.  */
+          negative_number = number_value < 0;
+          u_number_value = number_value;
+
+        do_signed_number:
+          always_output_a_sign = false;
+
+        do_maybe_signed_number:
+          tz_colon_mask = 0;
+
+        do_number_body:
+          /* Format U_NUMBER_VALUE according to the MODIFIER flag.
+             NEGATIVE_NUMBER is nonzero if the original number was
+             negative; in this case it was converted directly to
+             unsigned int (i.e., modulo (UINT_MAX + 1)) without
+             negating it.  */
+          if (modifier == L_('O') && !negative_number)
+            {
+#ifdef _NL_CURRENT
+              /* Get the locale specific alternate representation of
+                 the number.  If none exist NULL is returned.  */
+              const CHAR_T *cp = nl_get_alt_digit (u_number_value
+                                                   HELPER_LOCALE_ARG);
+
+              if (cp != NULL)
+                {
+                  size_t digitlen = STRLEN (cp);
+                  if (digitlen != 0)
+                    {
+                      cpy (digitlen, cp);
+                      break;
+                    }
+                }
+#else
+              goto underlying_strftime;
+#endif
+            }
+
+          bufp = buf + sizeof (buf) / sizeof (buf[0]);
+
+          if (negative_number)
+            u_number_value = - u_number_value;
+
+          do
+            {
+              if (tz_colon_mask & 1)
+                *--bufp = ':';
+              tz_colon_mask >>= 1;
+              *--bufp = u_number_value % 10 + L_('0');
+              u_number_value /= 10;
+            }
+          while (u_number_value != 0 || tz_colon_mask != 0);
+
+        do_number_sign_and_padding:
+          if (pad == 0)
+            pad = L_('0');
+          if (width < 0)
+            width = digits;
+
+          {
+            CHAR_T sign_char = (negative_number ? L_('-')
+                                : always_output_a_sign ? L_('+')
+                                : 0);
+            int numlen = buf + sizeof buf / sizeof buf[0] - bufp;
+            int shortage = width - !!sign_char - numlen;
+            int padding = pad == L_('-') || shortage <= 0 ? 0 : shortage;
+
+            if (sign_char)
+              {
+                if (pad == L_('_'))
+                  {
+                    if (p)
+                      memset_space (p, padding);
+                    i += padding;
+                    width -= padding;
+                  }
+                width_add1 (0, sign_char);
+                width--;
+              }
+
+            cpy (numlen, bufp);
+          }
+          break;
+
+        case L_('F'):
+          if (modifier != 0)
+            goto bad_format;
+          if (pad == 0 && width < 0)
+            {
+              pad = L_('+');
+              subwidth = 4;
+            }
+          else
+            {
+              subwidth = width - 6;
+              if (subwidth < 0)
+                subwidth = 0;
+            }
+          subfmt = L_("%Y-%m-%d");
+          goto subformat_width;
+
+        case L_('H'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER (2, tp->tm_hour);
+
+        case L_('I'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER (2, hour12);
+
+        case L_('k'):           /* GNU extension.  */
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER_SPACEPAD (2, tp->tm_hour);
+
+        case L_('l'):           /* GNU extension.  */
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER_SPACEPAD (2, hour12);
+
+        case L_('j'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_SIGNED_NUMBER (3, tp->tm_yday < -1, tp->tm_yday + 1U);
+
+        case L_('M'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER (2, tp->tm_min);
+
+        case L_('m'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_SIGNED_NUMBER (2, tp->tm_mon < -1, tp->tm_mon + 1U);
+
+#ifndef _LIBC
+        case L_('N'):           /* GNU extension.  */
+          if (modifier == L_('E'))
+            goto bad_format;
+          {
+            int n = ns, ns_digits = 9;
+            if (width <= 0)
+              width = ns_digits;
+            int ndigs = ns_digits;
+            while (width < ndigs || (1 < ndigs && n % 10 == 0))
+              ndigs--, n /= 10;
+            for (int j = ndigs; 0 < j; j--)
+              buf[j - 1] = n % 10 + L_('0'), n /= 10;
+            if (!pad)
+              pad = L_('0');
+            width_cpy (0, ndigs, buf);
+            width_add (width - ndigs, 0, (void) 0);
+          }
+          break;
+#endif
+
+        case L_('n'):
+          add1 (L_('\n'));
+          break;
+
+        case L_('P'):
+          to_lowcase = true;
+#ifndef _NL_CURRENT
+          format_char = L_('p');
+#endif
+          FALLTHROUGH;
+        case L_('p'):
+          if (change_case)
+            {
+              to_uppcase = false;
+              to_lowcase = true;
+            }
+#ifdef _NL_CURRENT
+          cpy (ap_len, ampm);
+          break;
+#else
+          goto underlying_strftime;
+#endif
+
+        case L_('q'):           /* GNU extension.  */
+          DO_SIGNED_NUMBER (1, false, ((tp->tm_mon * 11) >> 5) + 1);
+
+        case L_('R'):
+          subfmt = L_("%H:%M");
+          goto subformat;
+
+        case L_('r'):
+#ifdef _NL_CURRENT
+          if (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME,
+                                                       NLW(T_FMT_AMPM)))
+              == L_('\0'))
+            subfmt = L_("%I:%M:%S %p");
+          goto subformat;
+#else
+          goto underlying_strftime;
+#endif
+
+        case L_('S'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER (2, tp->tm_sec);
+
+        case L_('s'):           /* GNU extension.  */
+          {
+            struct tm ltm;
+            time_t t;
+
+            ltm = *tp;
+            ltm.tm_yday = -1;
+            t = mktime_z (tz, &ltm);
+            if (ltm.tm_yday < 0)
+              {
+                errno = EOVERFLOW;
+                return 0;
+              }
+
+            /* Generate string value for T using time_t arithmetic;
+               this works even if sizeof (long) < sizeof (time_t).  */
+
+            bufp = buf + sizeof (buf) / sizeof (buf[0]);
+            negative_number = t < 0;
+
+            do
+              {
+                int d = t % 10;
+                t /= 10;
+                *--bufp = (negative_number ? -d : d) + L_('0');
+              }
+            while (t != 0);
+
+            digits = 1;
+            always_output_a_sign = false;
+            goto do_number_sign_and_padding;
+          }
+
+        case L_('X'):
+          if (modifier == L_('O'))
+            goto bad_format;
+#ifdef _NL_CURRENT
+          if (! (modifier == L_('E')
+                 && (*(subfmt =
+                       (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_T_FMT)))
+                     != L_('\0'))))
+            subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(T_FMT));
+          goto subformat;
+#else
+          goto underlying_strftime;
+#endif
+        case L_('T'):
+          subfmt = L_("%H:%M:%S");
+          goto subformat;
+
+        case L_('t'):
+          add1 (L_('\t'));
+          break;
+
+        case L_('u'):
+          DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1);
+
+        case L_('U'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER (2, (tp->tm_yday - tp->tm_wday + 7) / 7);
+
+        case L_('V'):
+        case L_('g'):
+        case L_('G'):
+          if (modifier == L_('E'))
+            goto bad_format;
+          {
+            /* YEAR is a leap year if and only if (tp->tm_year + TM_YEAR_BASE)
+               is a leap year, except that YEAR and YEAR - 1 both work
+               correctly even when (tp->tm_year + TM_YEAR_BASE) would
+               overflow.  */
+            int year = (tp->tm_year
+                        + (tp->tm_year < 0
+                           ? TM_YEAR_BASE % 400
+                           : TM_YEAR_BASE % 400 - 400));
+            int year_adjust = 0;
+            int days = iso_week_days (tp->tm_yday, tp->tm_wday);
+
+            if (days < 0)
+              {
+                /* This ISO week belongs to the previous year.  */
+                year_adjust = -1;
+                days = iso_week_days (tp->tm_yday + (365 + __isleap (year - 1)),
+                                      tp->tm_wday);
+              }
+            else
+              {
+                int d = iso_week_days (tp->tm_yday - (365 + __isleap (year)),
+                                       tp->tm_wday);
+                if (0 <= d)
+                  {
+                    /* This ISO week belongs to the next year.  */
+                    year_adjust = 1;
+                    days = d;
+                  }
+              }
+
+            switch (*f)
+              {
+              case L_('g'):
+                {
+                  int yy = (tp->tm_year % 100 + year_adjust) % 100;
+                  DO_YEARISH (2, false,
+                              (0 <= yy
+                               ? yy
+                               : tp->tm_year < -TM_YEAR_BASE - year_adjust
+                               ? -yy
+                               : yy + 100));
+                }
+
+              case L_('G'):
+                DO_YEARISH (4, tp->tm_year < -TM_YEAR_BASE - year_adjust,
+                            (tp->tm_year + (unsigned int) TM_YEAR_BASE
+                             + year_adjust));
+
+              default:
+                DO_NUMBER (2, days / 7 + 1);
+              }
+          }
+
+        case L_('W'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER (2, (tp->tm_yday - (tp->tm_wday - 1 + 7) % 7 + 7) / 7);
+
+        case L_('w'):
+          if (modifier == L_('E'))
+            goto bad_format;
+
+          DO_NUMBER (1, tp->tm_wday);
+
+        case L_('Y'):
+          if (modifier == L_('E'))
+            {
+#if HAVE_STRUCT_ERA_ENTRY
+              struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
+              if (era)
+                {
+# ifdef COMPILE_WIDE
+                  subfmt = era->era_wformat;
+# else
+                  subfmt = era->era_format;
+# endif
+                  if (pad == 0)
+                    pad = yr_spec;
+                  goto subformat;
+                }
+#else
+              goto underlying_strftime;
+#endif
+            }
+          if (modifier == L_('O'))
+            goto bad_format;
+
+          DO_YEARISH (4, tp->tm_year < -TM_YEAR_BASE,
+                      tp->tm_year + (unsigned int) TM_YEAR_BASE);
+
+        case L_('y'):
+          if (modifier == L_('E'))
+            {
+#if HAVE_STRUCT_ERA_ENTRY
+              struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
+              if (era)
+                {
+                  int delta = tp->tm_year - era->start_date[0];
+                  if (pad == 0)
+                    pad = yr_spec;
+                  DO_NUMBER (2, (era->offset
+                                 + delta * era->absolute_direction));
+                }
+#else
+              goto underlying_strftime;
+#endif
+            }
+
+          {
+            int yy = tp->tm_year % 100;
+            if (yy < 0)
+              yy = tp->tm_year < - TM_YEAR_BASE ? -yy : yy + 100;
+            DO_YEARISH (2, false, yy);
+          }
+
+        case L_('Z'):
+          if (change_case)
+            {
+              to_uppcase = false;
+              to_lowcase = true;
+            }
+
+#ifdef COMPILE_WIDE
+          {
+            /* The zone string is always given in multibyte form.  We have
+               to convert it to wide character.  */
+            size_t w = pad == L_('-') || width < 0 ? 0 : width;
+            char const *z = zone;
+            mbstate_t st = {0};
+            size_t len = __mbsrtowcs_l (p, &z, maxsize - i, &st, loc);
+            if (len == (size_t) -1)
+              return 0;
+            size_t incr = len < w ? w : len;
+            if (incr >= maxsize - i)
+              {
+                errno = ERANGE;
+                return 0;
+              }
+            if (p)
+              {
+                if (len < w)
+                  {
+                    size_t delta = w - len;
+                    __wmemmove (p + delta, p, len);
+                    wchar_t wc = pad == L_('0') || pad == L_('+') ? L'0' : L' ';
+                    wmemset (p, wc, delta);
+                  }
+                p += incr;
+              }
+            i += incr;
+          }
+#else
+          cpy (strlen (zone), zone);
+#endif
+          break;
+
+        case L_(':'):
+          /* :, ::, and ::: are valid only just before 'z'.
+             :::: etc. are rejected later.  */
+          for (colons = 1; f[colons] == L_(':'); colons++)
+            continue;
+          if (f[colons] != L_('z'))
+            goto bad_format;
+          f += colons;
+          goto do_z_conversion;
+
+        case L_('z'):
+          colons = 0;
+
+        do_z_conversion:
+          if (tp->tm_isdst < 0)
+            break;
+
+          {
+            int diff;
+            int hour_diff;
+            int min_diff;
+            int sec_diff;
+#if HAVE_TM_GMTOFF
+            diff = tp->tm_gmtoff;
+#else
+            if (!tz)
+              diff = 0;
+            else
+              {
+                struct tm gtm;
+                struct tm ltm;
+                time_t lt;
+
+                /* POSIX.1 requires that local time zone information be used as
+                   though strftime called tzset.  */
+# ifndef my_strftime
+                if (!*tzset_called)
+                  {
+                    tzset ();
+                    *tzset_called = true;
+                  }
+# endif
+
+                ltm = *tp;
+                ltm.tm_wday = -1;
+                lt = mktime_z (tz, &ltm);
+                if (ltm.tm_wday < 0 || ! localtime_rz (0, &lt, &gtm))
+                  break;
+                diff = tm_diff (&ltm, &gtm);
+              }
+#endif
+
+            negative_number = diff < 0 || (diff == 0 && *zone == '-');
+            hour_diff = diff / 60 / 60;
+            min_diff = diff / 60 % 60;
+            sec_diff = diff % 60;
+
+            switch (colons)
+              {
+              case 0: /* +hhmm */
+                DO_TZ_OFFSET (5, 0, hour_diff * 100 + min_diff);
+
+              case 1: tz_hh_mm: /* +hh:mm */
+                DO_TZ_OFFSET (6, 04, hour_diff * 100 + min_diff);
+
+              case 2: tz_hh_mm_ss: /* +hh:mm:ss */
+                DO_TZ_OFFSET (9, 024,
+                              hour_diff * 10000 + min_diff * 100 + sec_diff);
+
+              case 3: /* +hh if possible, else +hh:mm, else +hh:mm:ss */
+                if (sec_diff != 0)
+                  goto tz_hh_mm_ss;
+                if (min_diff != 0)
+                  goto tz_hh_mm;
+                DO_TZ_OFFSET (3, 0, hour_diff);
+
+              default:
+                goto bad_format;
+              }
+          }
+
+        case L_('\0'):          /* GNU extension: % at end of format.  */
+        bad_percent:
+            --f;
+            FALLTHROUGH;
+        default:
+          /* Unknown format; output the format, including the '%',
+             since this is most likely the right thing to do if a
+             multibyte string has been misparsed.  */
+        bad_format:
+          cpy (f - percent + 1, percent);
+          break;
+        }
+    }
+
+#if ! FPRINTFTIME
+  if (p && maxsize != 0)
+    *p = L_('\0');
+#endif
+
+  errno = saved_errno;
+  return i;
+}
deleted file mode 120000 (symlink)
index 83939617cce022949d58f6d81d6020a5b126af18..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/obstack.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b00cd88e1aca5797c0c71a379ddbc600e23c8dc6
--- /dev/null
@@ -0,0 +1,332 @@
+/* obstack.c - subroutines used implicitly by object stack macros
+   Copyright (C) 1988-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+
+#ifdef _LIBC
+# include <obstack.h>
+#else
+# include <config.h>
+# include "obstack.h"
+#endif
+
+/* NOTE BEFORE MODIFYING THIS FILE IN GNU LIBC: _OBSTACK_INTERFACE_VERSION in
+   gnu-versions.h must be incremented whenever callers compiled using an old
+   obstack.h can no longer properly call the functions in this file.  */
+
+/* If GCC, or if an oddball (testing?) host that #defines __alignof__,
+   use the already-supplied __alignof__.  Otherwise, this must be Gnulib
+   (as glibc assumes GCC); defer to Gnulib's alignof_type.  */
+#if !defined __GNUC__ && !defined __alignof__
+# include <alignof.h>
+# define __alignof__(type) alignof_type (type)
+#endif
+#include <stdlib.h>
+#include <stdint.h>
+
+#ifndef MAX
+# define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+/* Determine default alignment.  */
+
+/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
+   But in fact it might be less smart and round addresses to as much as
+   DEFAULT_ROUNDING.  So we prepare for it to do that.
+
+   DEFAULT_ALIGNMENT cannot be an enum constant; see gnulib's alignof.h.  */
+#define DEFAULT_ALIGNMENT MAX (__alignof__ (long double),                    \
+                               MAX (__alignof__ (uintmax_t),                 \
+                                    __alignof__ (void *)))
+#define DEFAULT_ROUNDING MAX (sizeof (long double),                          \
+                               MAX (sizeof (uintmax_t),                              \
+                                    sizeof (void *)))
+
+/* Call functions with either the traditional malloc/free calling
+   interface, or the mmalloc/mfree interface (that adds an extra first
+   argument), based on the value of use_extra_arg.  */
+
+static void *
+call_chunkfun (struct obstack *h, size_t size)
+{
+  if (h->use_extra_arg)
+    return h->chunkfun.extra (h->extra_arg, size);
+  else
+    return h->chunkfun.plain (size);
+}
+
+static void
+call_freefun (struct obstack *h, void *old_chunk)
+{
+  if (h->use_extra_arg)
+    h->freefun.extra (h->extra_arg, old_chunk);
+  else
+    h->freefun.plain (old_chunk);
+}
+
+
+/* Initialize an obstack H for use.  Specify chunk size SIZE (0 means default).
+   Objects start on multiples of ALIGNMENT (0 means use default).
+
+   Return nonzero if successful, calls obstack_alloc_failed_handler if
+   allocation fails.  */
+
+static int
+_obstack_begin_worker (struct obstack *h,
+                       _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment)
+{
+  struct _obstack_chunk *chunk; /* points to new chunk */
+
+  if (alignment == 0)
+    alignment = DEFAULT_ALIGNMENT;
+  if (size == 0)
+    /* Default size is what GNU malloc can fit in a 4096-byte block.  */
+    {
+      /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
+         Use the values for range checking, because if range checking is off,
+         the extra bytes won't be missed terribly, but if range checking is on
+         and we used a larger request, a whole extra 4096 bytes would be
+         allocated.
+
+         These number are irrelevant to the new GNU malloc.  I suspect it is
+         less sensitive to the size of the request.  */
+      int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
+                    + 4 + DEFAULT_ROUNDING - 1)
+                   & ~(DEFAULT_ROUNDING - 1));
+      size = 4096 - extra;
+    }
+
+  h->chunk_size = size;
+  h->alignment_mask = alignment - 1;
+
+  chunk = h->chunk = call_chunkfun (h, h->chunk_size);
+  if (!chunk)
+    (*obstack_alloc_failed_handler) ();
+  h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
+                                               alignment - 1);
+  h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size;
+  chunk->prev = 0;
+  /* The initial chunk now contains no empty object.  */
+  h->maybe_empty_object = 0;
+  h->alloc_failed = 0;
+  return 1;
+}
+
+int
+_obstack_begin (struct obstack *h,
+                _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment,
+                void *(*chunkfun) (size_t),
+                void (*freefun) (void *))
+{
+  h->chunkfun.plain = chunkfun;
+  h->freefun.plain = freefun;
+  h->use_extra_arg = 0;
+  return _obstack_begin_worker (h, size, alignment);
+}
+
+int
+_obstack_begin_1 (struct obstack *h,
+                  _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment,
+                  void *(*chunkfun) (void *, size_t),
+                  void (*freefun) (void *, void *),
+                  void *arg)
+{
+  h->chunkfun.extra = chunkfun;
+  h->freefun.extra = freefun;
+  h->extra_arg = arg;
+  h->use_extra_arg = 1;
+  return _obstack_begin_worker (h, size, alignment);
+}
+
+/* Allocate a new current chunk for the obstack *H
+   on the assumption that LENGTH bytes need to be added
+   to the current object, or a new object of length LENGTH allocated.
+   Copies any partial object from the end of the old chunk
+   to the beginning of the new one.  */
+
+void
+_obstack_newchunk (struct obstack *h, _OBSTACK_SIZE_T length)
+{
+  struct _obstack_chunk *old_chunk = h->chunk;
+  struct _obstack_chunk *new_chunk = 0;
+  size_t obj_size = h->next_free - h->object_base;
+  char *object_base;
+
+  /* Compute size for new chunk.  */
+  size_t sum1 = obj_size + length;
+  size_t sum2 = sum1 + h->alignment_mask;
+  size_t new_size = sum2 + (obj_size >> 3) + 100;
+  if (new_size < sum2)
+    new_size = sum2;
+  if (new_size < h->chunk_size)
+    new_size = h->chunk_size;
+
+  /* Allocate and initialize the new chunk.  */
+  if (obj_size <= sum1 && sum1 <= sum2)
+    new_chunk = call_chunkfun (h, new_size);
+  if (!new_chunk)
+    (*obstack_alloc_failed_handler)();
+  h->chunk = new_chunk;
+  new_chunk->prev = old_chunk;
+  new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
+
+  /* Compute an aligned object_base in the new chunk */
+  object_base =
+    __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask);
+
+  /* Move the existing object to the new chunk.  */
+  memcpy (object_base, h->object_base, obj_size);
+
+  /* If the object just copied was the only data in OLD_CHUNK,
+     free that chunk and remove it from the chain.
+     But not if that chunk might contain an empty object.  */
+  if (!h->maybe_empty_object
+      && (h->object_base
+          == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents,
+                          h->alignment_mask)))
+    {
+      new_chunk->prev = old_chunk->prev;
+      call_freefun (h, old_chunk);
+    }
+
+  h->object_base = object_base;
+  h->next_free = h->object_base + obj_size;
+  /* The new chunk certainly contains no empty object yet.  */
+  h->maybe_empty_object = 0;
+}
+
+/* Return nonzero if object OBJ has been allocated from obstack H.
+   This is here for debugging.
+   If you use it in a program, you are probably losing.  */
+
+/* Suppress -Wmissing-prototypes warning.  We don't want to declare this in
+   obstack.h because it is just for debugging.  */
+int _obstack_allocated_p (struct obstack *h, void *obj) __attribute_pure__;
+
+int
+_obstack_allocated_p (struct obstack *h, void *obj)
+{
+  struct _obstack_chunk *lp;    /* below addr of any objects in this chunk */
+  struct _obstack_chunk *plp;   /* point to previous chunk if any */
+
+  lp = (h)->chunk;
+  /* We use >= rather than > since the object cannot be exactly at
+     the beginning of the chunk but might be an empty object exactly
+     at the end of an adjacent chunk.  */
+  while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
+    {
+      plp = lp->prev;
+      lp = plp;
+    }
+  return lp != 0;
+}
+
+/* Free objects in obstack H, including OBJ and everything allocate
+   more recently than OBJ.  If OBJ is zero, free everything in H.  */
+
+void
+_obstack_free (struct obstack *h, void *obj)
+{
+  struct _obstack_chunk *lp;    /* below addr of any objects in this chunk */
+  struct _obstack_chunk *plp;   /* point to previous chunk if any */
+
+  lp = h->chunk;
+  /* We use >= because there cannot be an object at the beginning of a chunk.
+     But there can be an empty object at that address
+     at the end of another chunk.  */
+  while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
+    {
+      plp = lp->prev;
+      call_freefun (h, lp);
+      lp = plp;
+      /* If we switch chunks, we can't tell whether the new current
+         chunk contains an empty object, so assume that it may.  */
+      h->maybe_empty_object = 1;
+    }
+  if (lp)
+    {
+      h->object_base = h->next_free = (char *) (obj);
+      h->chunk_limit = lp->limit;
+      h->chunk = lp;
+    }
+  else if (obj != 0)
+    /* obj is not in any of the chunks! */
+    abort ();
+}
+
+_OBSTACK_SIZE_T
+_obstack_memory_used (struct obstack *h)
+{
+  struct _obstack_chunk *lp;
+  _OBSTACK_SIZE_T nbytes = 0;
+
+  for (lp = h->chunk; lp != 0; lp = lp->prev)
+    {
+      nbytes += lp->limit - (char *) lp;
+    }
+  return nbytes;
+}
+
+#ifndef _OBSTACK_NO_ERROR_HANDLER
+/* Define the error handler.  */
+# include <stdio.h>
+
+/* Exit value used when 'print_and_abort' is used.  */
+# ifdef _LIBC
+int obstack_exit_failure = EXIT_FAILURE;
+# else
+#  include "exitfail.h"
+#  define obstack_exit_failure exit_failure
+# endif
+
+# ifdef _LIBC
+#  include <libintl.h>
+# else
+#  include "gettext.h"
+# endif
+# ifndef _
+#  define _(msgid) gettext (msgid)
+# endif
+
+# ifdef _LIBC
+#  include <libio/iolibio.h>
+# endif
+
+static __attribute_noreturn__ void
+print_and_abort (void)
+{
+  /* Don't change any of these strings.  Yes, it would be possible to add
+     the newline to the string and use fputs or so.  But this must not
+     happen because the "memory exhausted" message appears in other places
+     like this and the translation should be reused instead of creating
+     a very similar string which requires a separate translation.  */
+# ifdef _LIBC
+  (void) __fxprintf (NULL, "%s\n", _("memory exhausted"));
+# else
+  fprintf (stderr, "%s\n", _("memory exhausted"));
+# endif
+  exit (obstack_exit_failure);
+}
+
+/* The functions allocating more room by calling 'obstack_chunk_alloc'
+   jump to the handler pointed to by 'obstack_alloc_failed_handler'.
+   This can be set to a user defined function which should either
+   abort gracefully or use longjump - but shouldn't return.  This
+   variable by default points to the internal function
+   'print_and_abort'.  */
+__attribute_noreturn__ void (*obstack_alloc_failed_handler) (void)
+  = print_and_abort;
+#endif /* !_OBSTACK_NO_ERROR_HANDLER */
deleted file mode 120000 (symlink)
index c713dbb52ad52096582aef75b19273a70e3b634c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/obstack.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cf149947be74870ed5aba469336e75605145524f
--- /dev/null
@@ -0,0 +1,553 @@
+/* obstack.h - object stack macros
+   Copyright (C) 1988-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Summary:
+
+   All the apparent functions defined here are macros. The idea
+   is that you would use these pre-tested macros to solve a
+   very specific set of problems, and they would run fast.
+   Caution: no side-effects in arguments please!! They may be
+   evaluated MANY times!!
+
+   These macros operate a stack of objects.  Each object starts life
+   small, and may grow to maturity.  (Consider building a word syllable
+   by syllable.)  An object can move while it is growing.  Once it has
+   been "finished" it never changes address again.  So the "top of the
+   stack" is typically an immature growing object, while the rest of the
+   stack is of mature, fixed size and fixed address objects.
+
+   These routines grab large chunks of memory, using a function you
+   supply, called 'obstack_chunk_alloc'.  On occasion, they free chunks,
+   by calling 'obstack_chunk_free'.  You must define them and declare
+   them before using any obstack macros.
+
+   Each independent stack is represented by a 'struct obstack'.
+   Each of the obstack macros expects a pointer to such a structure
+   as the first argument.
+
+   One motivation for this package is the problem of growing char strings
+   in symbol tables.  Unless you are "fascist pig with a read-only mind"
+   --Gosper's immortal quote from HAKMEM item 154, out of context--you
+   would not like to put any arbitrary upper limit on the length of your
+   symbols.
+
+   In practice this often means you will build many short symbols and a
+   few long symbols.  At the time you are reading a symbol you don't know
+   how long it is.  One traditional method is to read a symbol into a
+   buffer, realloc()ating the buffer every time you try to read a symbol
+   that is longer than the buffer.  This is beaut, but you still will
+   want to copy the symbol from the buffer to a more permanent
+   symbol-table entry say about half the time.
+
+   With obstacks, you can work differently.  Use one obstack for all symbol
+   names.  As you read a symbol, grow the name in the obstack gradually.
+   When the name is complete, finalize it.  Then, if the symbol exists already,
+   free the newly read name.
+
+   The way we do this is to take a large chunk, allocating memory from
+   low addresses.  When you want to build a symbol in the chunk you just
+   add chars above the current "high water mark" in the chunk.  When you
+   have finished adding chars, because you got to the end of the symbol,
+   you know how long the chars are, and you can create a new object.
+   Mostly the chars will not burst over the highest address of the chunk,
+   because you would typically expect a chunk to be (say) 100 times as
+   long as an average object.
+
+   In case that isn't clear, when we have enough chars to make up
+   the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
+   so we just point to it where it lies.  No moving of chars is
+   needed and this is the second win: potentially long strings need
+   never be explicitly shuffled. Once an object is formed, it does not
+   change its address during its lifetime.
+
+   When the chars burst over a chunk boundary, we allocate a larger
+   chunk, and then copy the partly formed object from the end of the old
+   chunk to the beginning of the new larger chunk.  We then carry on
+   accreting characters to the end of the object as we normally would.
+
+   A special macro is provided to add a single char at a time to a
+   growing object.  This allows the use of register variables, which
+   break the ordinary 'growth' macro.
+
+   Summary:
+        We allocate large chunks.
+        We carve out one object at a time from the current chunk.
+        Once carved, an object never moves.
+        We are free to append data of any size to the currently
+          growing object.
+        Exactly one object is growing in an obstack at any one time.
+        You can run one obstack per control block.
+        You may have as many control blocks as you dare.
+        Because of the way we do it, you can "unwind" an obstack
+          back to a previous state. (You may remove objects much
+          as you would with a stack.)
+ */
+
+/* Documentation (part of the GNU libc manual):
+   <https://www.gnu.org/software/libc/manual/html_node/Obstacks.html>  */
+
+
+/* Don't do the contents of this file more than once.  */
+#ifndef _OBSTACK_H
+#define _OBSTACK_H 1
+
+/* This file uses _Noreturn, _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>             /* For size_t and ptrdiff_t.  */
+#include <stdint.h>             /* For uintptr_t.  */
+#include <string.h>             /* For memcpy.  */
+
+#if __STDC_VERSION__ < 199901L || defined __HP_cc
+# define __FLEXIBLE_ARRAY_MEMBER 1
+#else
+# define __FLEXIBLE_ARRAY_MEMBER
+#endif
+
+/* These macros highlight the places where this implementation
+   is different from the one in GNU libc.  */
+#ifdef _LIBC
+# define _OBSTACK_SIZE_T unsigned int
+# define _CHUNK_SIZE_T unsigned long
+# define _OBSTACK_CAST(type, expr) ((type) (expr))
+#else
+/* In Gnulib, we use sane types, especially for 64-bit hosts.  */
+# define _OBSTACK_SIZE_T size_t
+# define _CHUNK_SIZE_T size_t
+# define _OBSTACK_CAST(type, expr) (expr)
+#endif
+
+/* If B is the base of an object addressed by P, return the result of
+   aligning P to the next multiple of A + 1.  B and P must be of type
+   char *.  A + 1 must be a power of 2.
+   If ptrdiff_t is narrower than a pointer (e.g., the AS/400), play it
+   safe and compute the alignment relative to B.  Otherwise, use the
+   faster strategy of computing the alignment through uintptr_t.  */
+
+#define __PTR_ALIGN(B, P, A) \
+  (sizeof (ptrdiff_t) < sizeof (void *) \
+   ? (B) + (((P) - (B) + (A)) & ~(A))   \
+   : (P) + ((- (uintptr_t) (P)) & (A)))
+
+#ifndef __attribute_pure__
+# define __attribute_pure__ _GL_ATTRIBUTE_PURE
+#endif
+
+/* Not the same as _Noreturn, since it also works with function pointers.  */
+#ifndef __attribute_noreturn__
+# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ || 0x5110 <= __SUNPRO_C
+#  define __attribute_noreturn__ __attribute__ ((__noreturn__))
+# else
+#  define __attribute_noreturn__
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _obstack_chunk           /* Lives at front of each chunk. */
+{
+  char *limit;                  /* 1 past end of this chunk */
+  struct _obstack_chunk *prev;  /* address of prior chunk or NULL */
+  char contents[__FLEXIBLE_ARRAY_MEMBER]; /* objects begin here */
+};
+
+struct obstack          /* control current object in current chunk */
+{
+  _CHUNK_SIZE_T chunk_size;     /* preferred size to allocate chunks in */
+  struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
+  char *object_base;            /* address of object we are building */
+  char *next_free;              /* where to add next char to current object */
+  char *chunk_limit;            /* address of char after current chunk */
+  union
+  {
+    _OBSTACK_SIZE_T i;
+    void *p;
+  } temp;                       /* Temporary for some macros.  */
+  _OBSTACK_SIZE_T alignment_mask;  /* Mask of alignment for each object. */
+
+  /* These prototypes vary based on 'use_extra_arg'.  */
+  union
+  {
+    void *(*plain) (size_t);
+    void *(*extra) (void *, size_t);
+  } chunkfun;
+  union
+  {
+    void (*plain) (void *);
+    void (*extra) (void *, void *);
+  } freefun;
+
+  void *extra_arg;              /* first arg for chunk alloc/dealloc funcs */
+  unsigned use_extra_arg : 1;     /* chunk alloc/dealloc funcs take extra arg */
+  unsigned maybe_empty_object : 1; /* There is a possibility that the current
+                                      chunk contains a zero-length object.  This
+                                      prevents freeing the chunk if we allocate
+                                      a bigger chunk to replace it. */
+  unsigned alloc_failed : 1;      /* No longer used, as we now call the failed
+                                     handler on error, but retained for binary
+                                     compatibility.  */
+};
+
+/* Declare the external functions we use; they are in obstack.c.  */
+
+#if @REPLACE_OBSTACK@
+# define _obstack_newchunk rpl_obstack_newchunk
+# define _obstack_free rpl_obstack_free
+# define _obstack_begin rpl_obstack_begin
+# define _obstack_begin_1 rpl_obstack_begin_1
+# define _obstack_memory_used rpl_obstack_memory_used
+# define _obstack_allocated_p rpl_obstack_allocated_p
+#endif
+extern void _obstack_newchunk (struct obstack *, _OBSTACK_SIZE_T);
+extern void _obstack_free (struct obstack *, void *);
+extern int _obstack_begin (struct obstack *,
+                           _OBSTACK_SIZE_T, _OBSTACK_SIZE_T,
+                           void *(*) (size_t), void (*) (void *));
+extern int _obstack_begin_1 (struct obstack *,
+                             _OBSTACK_SIZE_T, _OBSTACK_SIZE_T,
+                             void *(*) (void *, size_t),
+                             void (*) (void *, void *), void *);
+extern _OBSTACK_SIZE_T _obstack_memory_used (struct obstack *)
+  __attribute_pure__;
+
+
+/* Error handler called when 'obstack_chunk_alloc' failed to allocate
+   more memory.  This can be set to a user defined function which
+   should either abort gracefully or use longjump - but shouldn't
+   return.  The default action is to print a message and abort.  */
+extern __attribute_noreturn__ void (*obstack_alloc_failed_handler) (void);
+
+/* Exit value used when 'print_and_abort' is used.  */
+extern int obstack_exit_failure;
+
+/* Pointer to beginning of object being allocated or to be allocated next.
+   Note that this might not be the final address of the object
+   because a new chunk might be needed to hold the final size.  */
+
+#define obstack_base(h) ((void *) (h)->object_base)
+
+/* Size for allocating ordinary chunks.  */
+
+#define obstack_chunk_size(h) ((h)->chunk_size)
+
+/* Pointer to next byte not yet allocated in current chunk.  */
+
+#define obstack_next_free(h) ((void *) (h)->next_free)
+
+/* Mask specifying low bits that should be clear in address of an object.  */
+
+#define obstack_alignment_mask(h) ((h)->alignment_mask)
+
+/* To prevent prototype warnings provide complete argument list.  */
+#define obstack_init(h)                                                              \
+  _obstack_begin ((h), 0, 0,                                                 \
+                  _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc),    \
+                  _OBSTACK_CAST (void (*) (void *), obstack_chunk_free))
+
+#define obstack_begin(h, size)                                               \
+  _obstack_begin ((h), (size), 0,                                            \
+                  _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \
+                  _OBSTACK_CAST (void (*) (void *), obstack_chunk_free))
+
+#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun)     \
+  _obstack_begin ((h), (size), (alignment),                                  \
+                  _OBSTACK_CAST (void *(*) (size_t), chunkfun),                      \
+                  _OBSTACK_CAST (void (*) (void *), freefun))
+
+#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
+  _obstack_begin_1 ((h), (size), (alignment),                                \
+                    _OBSTACK_CAST (void *(*) (void *, size_t), chunkfun),     \
+                    _OBSTACK_CAST (void (*) (void *, void *), freefun), arg)
+
+#define obstack_chunkfun(h, newchunkfun)                                     \
+  ((void) ((h)->chunkfun.extra = (void *(*) (void *, size_t)) (newchunkfun)))
+
+#define obstack_freefun(h, newfreefun)                                       \
+  ((void) ((h)->freefun.extra = (void *(*) (void *, void *)) (newfreefun)))
+
+#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ = (achar)))
+
+#define obstack_blank_fast(h, n) ((void) ((h)->next_free += (n)))
+
+#define obstack_memory_used(h) _obstack_memory_used (h)
+
+#if defined __GNUC__ || defined __clang__
+# if !(defined __GNUC_MINOR__ && __GNUC__ * 1000 + __GNUC_MINOR__ >= 2008 \
+       || defined __clang__)
+#  define __extension__
+# endif
+
+/* For GNU C, if not -traditional,
+   we can define these macros to compute all args only once
+   without using a global variable.
+   Also, we can avoid using the 'temp' slot, to make faster code.  */
+
+# define obstack_object_size(OBSTACK)                                        \
+  __extension__                                                                      \
+    ({ struct obstack const *__o = (OBSTACK);                                \
+       (_OBSTACK_SIZE_T) (__o->next_free - __o->object_base); })
+
+/* The local variable is named __o1 to avoid a shadowed variable
+   warning when invoked from other obstack macros.  */
+# define obstack_room(OBSTACK)                                               \
+  __extension__                                                                      \
+    ({ struct obstack const *__o1 = (OBSTACK);                               \
+       (_OBSTACK_SIZE_T) (__o1->chunk_limit - __o1->next_free); })
+
+# define obstack_make_room(OBSTACK, length)                                  \
+  __extension__                                                                      \
+    ({ struct obstack *__o = (OBSTACK);                                              \
+       _OBSTACK_SIZE_T __len = (length);                                     \
+       if (obstack_room (__o) < __len)                                       \
+         _obstack_newchunk (__o, __len);                                     \
+       (void) 0; })
+
+# define obstack_empty_p(OBSTACK)                                            \
+  __extension__                                                                      \
+    ({ struct obstack const *__o = (OBSTACK);                                \
+       (__o->chunk->prev == 0                                                \
+        && __o->next_free == __PTR_ALIGN ((char *) __o->chunk,               \
+                                          __o->chunk->contents,                      \
+                                          __o->alignment_mask)); })
+
+# define obstack_grow(OBSTACK, where, length)                                \
+  __extension__                                                                      \
+    ({ struct obstack *__o = (OBSTACK);                                              \
+       _OBSTACK_SIZE_T __len = (length);                                     \
+       if (obstack_room (__o) < __len)                                       \
+         _obstack_newchunk (__o, __len);                                     \
+       memcpy (__o->next_free, where, __len);                                \
+       __o->next_free += __len;                                                      \
+       (void) 0; })
+
+# define obstack_grow0(OBSTACK, where, length)                               \
+  __extension__                                                                      \
+    ({ struct obstack *__o = (OBSTACK);                                              \
+       _OBSTACK_SIZE_T __len = (length);                                     \
+       if (obstack_room (__o) < __len + 1)                                   \
+         _obstack_newchunk (__o, __len + 1);                                 \
+       memcpy (__o->next_free, where, __len);                                \
+       __o->next_free += __len;                                                      \
+       *(__o->next_free)++ = 0;                                                      \
+       (void) 0; })
+
+# define obstack_1grow(OBSTACK, datum)                                       \
+  __extension__                                                                      \
+    ({ struct obstack *__o = (OBSTACK);                                              \
+       if (obstack_room (__o) < 1)                                           \
+         _obstack_newchunk (__o, 1);                                         \
+       obstack_1grow_fast (__o, datum); })
+
+/* These assume that the obstack alignment is good enough for pointers
+   or ints, and that the data added so far to the current object
+   shares that much alignment.  */
+
+# define obstack_ptr_grow(OBSTACK, datum)                                    \
+  __extension__                                                                      \
+    ({ struct obstack *__o = (OBSTACK);                                              \
+       if (obstack_room (__o) < sizeof (void *))                             \
+         _obstack_newchunk (__o, sizeof (void *));                           \
+       obstack_ptr_grow_fast (__o, datum); })
+
+# define obstack_int_grow(OBSTACK, datum)                                    \
+  __extension__                                                                      \
+    ({ struct obstack *__o = (OBSTACK);                                              \
+       if (obstack_room (__o) < sizeof (int))                                \
+         _obstack_newchunk (__o, sizeof (int));                                      \
+       obstack_int_grow_fast (__o, datum); })
+
+# define obstack_ptr_grow_fast(OBSTACK, aptr)                                \
+  __extension__                                                                      \
+    ({ struct obstack *__o1 = (OBSTACK);                                     \
+       void *__p1 = __o1->next_free;                                         \
+       *(const void **) __p1 = (aptr);                                       \
+       __o1->next_free += sizeof (const void *);                             \
+       (void) 0; })
+
+# define obstack_int_grow_fast(OBSTACK, aint)                                \
+  __extension__                                                                      \
+    ({ struct obstack *__o1 = (OBSTACK);                                     \
+       void *__p1 = __o1->next_free;                                         \
+       *(int *) __p1 = (aint);                                               \
+       __o1->next_free += sizeof (int);                                              \
+       (void) 0; })
+
+# define obstack_blank(OBSTACK, length)                                              \
+  __extension__                                                                      \
+    ({ struct obstack *__o = (OBSTACK);                                              \
+       _OBSTACK_SIZE_T __len = (length);                                     \
+       if (obstack_room (__o) < __len)                                       \
+         _obstack_newchunk (__o, __len);                                     \
+       obstack_blank_fast (__o, __len); })
+
+# define obstack_alloc(OBSTACK, length)                                              \
+  __extension__                                                                      \
+    ({ struct obstack *__h = (OBSTACK);                                              \
+       obstack_blank (__h, (length));                                        \
+       obstack_finish (__h); })
+
+# define obstack_copy(OBSTACK, where, length)                                \
+  __extension__                                                                      \
+    ({ struct obstack *__h = (OBSTACK);                                              \
+       obstack_grow (__h, (where), (length));                                \
+       obstack_finish (__h); })
+
+# define obstack_copy0(OBSTACK, where, length)                               \
+  __extension__                                                                      \
+    ({ struct obstack *__h = (OBSTACK);                                              \
+       obstack_grow0 (__h, (where), (length));                               \
+       obstack_finish (__h); })
+
+/* The local variable is named __o1 to avoid a shadowed variable
+   warning when invoked from other obstack macros, typically obstack_free.  */
+# define obstack_finish(OBSTACK)                                             \
+  __extension__                                                                      \
+    ({ struct obstack *__o1 = (OBSTACK);                                     \
+       void *__value = (void *) __o1->object_base;                           \
+       if (__o1->next_free == __value)                                       \
+         __o1->maybe_empty_object = 1;                                       \
+       __o1->next_free                                                       \
+         = __PTR_ALIGN (__o1->object_base, __o1->next_free,                  \
+                        __o1->alignment_mask);                               \
+       if ((size_t) (__o1->next_free - (char *) __o1->chunk)                 \
+           > (size_t) (__o1->chunk_limit - (char *) __o1->chunk))            \
+         __o1->next_free = __o1->chunk_limit;                                \
+       __o1->object_base = __o1->next_free;                                  \
+       __value; })
+
+# define obstack_free(OBSTACK, OBJ)                                          \
+  __extension__                                                                      \
+    ({ struct obstack *__o = (OBSTACK);                                              \
+       void *__obj = (void *) (OBJ);                                         \
+       if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit)  \
+         __o->next_free = __o->object_base = (char *) __obj;                 \
+       else                                                                  \
+         _obstack_free (__o, __obj); })
+
+#else /* not __GNUC__ */
+
+# define obstack_object_size(h)                                                      \
+  ((_OBSTACK_SIZE_T) ((h)->next_free - (h)->object_base))
+
+# define obstack_room(h)                                                     \
+  ((_OBSTACK_SIZE_T) ((h)->chunk_limit - (h)->next_free))
+
+# define obstack_empty_p(h)                                                  \
+  ((h)->chunk->prev == 0                                                     \
+   && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk,                    \
+                                     (h)->chunk->contents,                   \
+                                     (h)->alignment_mask))
+
+/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
+   so that we can avoid having void expressions
+   in the arms of the conditional expression.
+   Casting the third operand to void was tried before,
+   but some compilers won't accept it.  */
+
+# define obstack_make_room(h, length)                                        \
+  ((h)->temp.i = (length),                                                   \
+   ((obstack_room (h) < (h)->temp.i)                                         \
+    ? (_obstack_newchunk (h, (h)->temp.i), 0) : 0),                          \
+   (void) 0)
+
+# define obstack_grow(h, where, length)                                              \
+  ((h)->temp.i = (length),                                                   \
+   ((obstack_room (h) < (h)->temp.i)                                         \
+   ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0),                         \
+   memcpy ((h)->next_free, where, (h)->temp.i),                                      \
+   (h)->next_free += (h)->temp.i,                                            \
+   (void) 0)
+
+# define obstack_grow0(h, where, length)                                     \
+  ((h)->temp.i = (length),                                                   \
+   ((obstack_room (h) < (h)->temp.i + 1)                                     \
+   ? (_obstack_newchunk ((h), (h)->temp.i + 1), 0) : 0),                     \
+   memcpy ((h)->next_free, where, (h)->temp.i),                                      \
+   (h)->next_free += (h)->temp.i,                                            \
+   *((h)->next_free)++ = 0,                                                  \
+   (void) 0)
+
+# define obstack_1grow(h, datum)                                             \
+  (((obstack_room (h) < 1)                                                   \
+    ? (_obstack_newchunk ((h), 1), 0) : 0),                                  \
+   obstack_1grow_fast (h, datum))
+
+# define obstack_ptr_grow(h, datum)                                          \
+  (((obstack_room (h) < sizeof (char *))                                     \
+    ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0),                    \
+   obstack_ptr_grow_fast (h, datum))
+
+# define obstack_int_grow(h, datum)                                          \
+  (((obstack_room (h) < sizeof (int))                                        \
+    ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0),                       \
+   obstack_int_grow_fast (h, datum))
+
+# define obstack_ptr_grow_fast(h, aptr)                                              \
+  (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr),       \
+   (void) 0)
+
+# define obstack_int_grow_fast(h, aint)                                              \
+  (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint),                  \
+   (void) 0)
+
+# define obstack_blank(h, length)                                            \
+  ((h)->temp.i = (length),                                                   \
+   ((obstack_room (h) < (h)->temp.i)                                         \
+   ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0),                         \
+   obstack_blank_fast (h, (h)->temp.i))
+
+# define obstack_alloc(h, length)                                            \
+  (obstack_blank ((h), (length)), obstack_finish ((h)))
+
+# define obstack_copy(h, where, length)                                              \
+  (obstack_grow ((h), (where), (length)), obstack_finish ((h)))
+
+# define obstack_copy0(h, where, length)                                     \
+  (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
+
+# define obstack_finish(h)                                                   \
+  (((h)->next_free == (h)->object_base                                       \
+    ? (((h)->maybe_empty_object = 1), 0)                                     \
+    : 0),                                                                    \
+   (h)->temp.p = (h)->object_base,                                           \
+   (h)->next_free                                                            \
+     = __PTR_ALIGN ((h)->object_base, (h)->next_free,                        \
+                    (h)->alignment_mask),                                    \
+   (((size_t) ((h)->next_free - (char *) (h)->chunk)                         \
+     > (size_t) ((h)->chunk_limit - (char *) (h)->chunk))                    \
+   ? ((h)->next_free = (h)->chunk_limit) : 0),                               \
+   (h)->object_base = (h)->next_free,                                        \
+   (h)->temp.p)
+
+# define obstack_free(h, obj)                                                \
+  ((h)->temp.p = (void *) (obj),                                             \
+   (((h)->temp.p > (void *) (h)->chunk                                       \
+     && (h)->temp.p < (void *) (h)->chunk_limit)                             \
+    ? (void) ((h)->next_free = (h)->object_base = (char *) (h)->temp.p)       \
+    : _obstack_free ((h), (h)->temp.p)))
+
+#endif /* not __GNUC__ */
+
+#ifdef __cplusplus
+}       /* C++ */
+#endif
+
+#endif /* _OBSTACK_H */
deleted file mode 120000 (symlink)
index 68c232557cd00250ca723462957d6950840deb5d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/offtostr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e46763ef72e2d74c6b63d8aa248acf9c35903c78
--- /dev/null
@@ -0,0 +1,20 @@
+/* Convert 'off_t' integer to printable string.
+
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define anytostr offtostr
+#define inttype off_t
+#include "anytostr.c"
deleted file mode 120000 (symlink)
index 8359089a5e47826876434c7d5b9c3a4cbbffcb82..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/open-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1adccad9b2795e3fa4cf3e79af9cfec2b6c54dc8
--- /dev/null
@@ -0,0 +1,46 @@
+/* Invoke open, but avoid some glitches.
+
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by 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);
+
+      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+         creates crashing code when 'mode_t' is smaller than 'int'.  */
+      mode = va_arg (ap, PROMOTED_MODE_T);
+
+      va_end (ap);
+    }
+
+  return fd_safer (open (file, flags, mode));
+}
deleted file mode 120000 (symlink)
index 4c91fa2f6b133389000bf64e35ca4071ecdbda9d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/open.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e690c9ea7798c4fcc24acf27fae1525b4f6f0689
--- /dev/null
@@ -0,0 +1,213 @@
+/* Open a descriptor to a file.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+/* If the user's config.h happens to include <fcntl.h>, let it include only
+   the system's <fcntl.h> here, so that orig_open doesn't recurse to
+   rpl_open.  */
+#define __need_system_fcntl_h
+#include <config.h>
+
+/* Get the original definition of open.  It might be defined as a macro.  */
+#include <fcntl.h>
+#include <sys/types.h>
+#undef __need_system_fcntl_h
+
+static int
+orig_open (const char *filename, int flags, mode_t mode)
+{
+#if defined _WIN32 && !defined __CYGWIN__
+  return _open (filename, flags, mode);
+#else
+  return open (filename, flags, mode);
+#endif
+}
+
+/* Specification.  */
+#ifdef __osf__
+/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
+   this include because of the preliminary #include <fcntl.h> above.  */
+# include "fcntl.h"
+#else
+# include <fcntl.h>
+#endif
+
+#include "cloexec.h"
+
+#include <errno.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifndef REPLACE_OPEN_DIRECTORY
+# define REPLACE_OPEN_DIRECTORY 0
+#endif
+
+int
+open (const char *filename, int flags, ...)
+{
+  /* 0 = unknown, 1 = yes, -1 = no.  */
+#if GNULIB_defined_O_CLOEXEC
+  int have_cloexec = -1;
+#else
+  static int have_cloexec;
+#endif
+
+  mode_t mode;
+  int fd;
+
+  mode = 0;
+  if (flags & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, flags);
+
+      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+         creates crashing code when 'mode_t' is smaller than 'int'.  */
+      mode = va_arg (arg, PROMOTED_MODE_T);
+
+      va_end (arg);
+    }
+
+#if GNULIB_defined_O_NONBLOCK
+  /* The only known platform that lacks O_NONBLOCK is mingw, but it
+     also lacks named pipes and Unix sockets, which are the only two
+     file types that require non-blocking handling in open().
+     Therefore, it is safe to ignore O_NONBLOCK here.  It is handy
+     that mingw also lacks openat(), so that is also covered here.  */
+  flags &= ~O_NONBLOCK;
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+  if (strcmp (filename, "/dev/null") == 0)
+    filename = "NUL";
+#endif
+
+#if OPEN_TRAILING_SLASH_BUG
+  /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename
+     ends in a slash, as POSIX says such a filename must name a directory
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>:
+       "A pathname that contains at least one non-<slash> character and that
+        ends with one or more trailing <slash> characters shall not be resolved
+        successfully unless the last pathname component before the trailing
+        <slash> characters names an existing directory"
+     If the named file already exists as a directory, then
+       - if O_CREAT is specified, open() must fail because of the semantics
+         of O_CREAT,
+       - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
+         <https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html>
+         says that it fails with errno = EISDIR in this case.
+     If the named file does not exist or does not name a directory, then
+       - if O_CREAT is specified, open() must fail since open() cannot create
+         directories,
+       - if O_WRONLY or O_RDWR is specified, open() must fail because the
+         file does not contain a '.' directory.  */
+  if ((flags & O_CREAT)
+      || (flags & O_ACCMODE) == O_RDWR
+      || (flags & O_ACCMODE) == O_WRONLY)
+    {
+      size_t len = strlen (filename);
+      if (len > 0 && filename[len - 1] == '/')
+        {
+          errno = EISDIR;
+          return -1;
+        }
+    }
+#endif
+
+  fd = orig_open (filename,
+                  flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode);
+
+  if (flags & O_CLOEXEC)
+    {
+      if (! have_cloexec)
+        {
+          if (0 <= fd)
+            have_cloexec = 1;
+          else if (errno == EINVAL)
+            {
+              fd = orig_open (filename, flags & ~O_CLOEXEC, mode);
+              have_cloexec = -1;
+            }
+        }
+      if (have_cloexec < 0 && 0 <= fd)
+        set_cloexec_flag (fd, true);
+    }
+
+
+#if REPLACE_FCHDIR
+  /* Implementing fchdir and fdopendir requires the ability to open a
+     directory file descriptor.  If open doesn't support that (as on
+     mingw), we use a dummy file that behaves the same as directories
+     on Linux (ie. always reports EOF on attempts to read()), and
+     override fstat() in fchdir.c to hide the fact that we have a
+     dummy.  */
+  if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES
+      && ((flags & O_ACCMODE) == O_RDONLY
+          || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH)))
+    {
+      struct stat statbuf;
+      if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
+        {
+          /* Maximum recursion depth of 1.  */
+          fd = open ("/dev/null", flags, mode);
+          if (0 <= fd)
+            fd = _gl_register_fd (fd, filename);
+        }
+      else
+        errno = EACCES;
+    }
+#endif
+
+#if OPEN_TRAILING_SLASH_BUG
+  /* If the filename ends in a slash and fd does not refer to a directory,
+     then fail.
+     Rationale: POSIX says such a filename must name a directory
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>:
+       "A pathname that contains at least one non-<slash> character and that
+        ends with one or more trailing <slash> characters shall not be resolved
+        successfully unless the last pathname component before the trailing
+        <slash> characters names an existing directory"
+     If the named file without the slash is not a directory, open() must fail
+     with ENOTDIR.  */
+  if (fd >= 0)
+    {
+      /* We know len is positive, since open did not fail with ENOENT.  */
+      size_t len = strlen (filename);
+      if (filename[len - 1] == '/')
+        {
+          struct stat statbuf;
+
+          if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
+            {
+              close (fd);
+              errno = ENOTDIR;
+              return -1;
+            }
+        }
+    }
+#endif
+
+#if REPLACE_FCHDIR
+  if (!REPLACE_OPEN_DIRECTORY && 0 <= fd)
+    fd = _gl_register_fd (fd, filename);
+#endif
+
+  return fd;
+}
deleted file mode 120000 (symlink)
index adbb78cc996ecf6cdd4217a20f83573e9857f962..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/openat-die.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..959c77d0a0814b20fa877a8ce8f70b9038499cca
--- /dev/null
@@ -0,0 +1,62 @@
+/* Report a save- or restore-cwd failure in our openat replacement and then exit.
+
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "openat.h"
+
+#include <stdlib.h>
+
+#ifndef GNULIB_LIBPOSIX
+# include <error.h>
+#endif
+
+#include "exitfail.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+_Noreturn void
+openat_save_fail (int errnum)
+{
+#ifndef GNULIB_LIBPOSIX
+  error (exit_failure, errnum,
+         _("unable to record current working directory"));
+#endif
+  /* _Noreturn 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 ();
+}
+
+
+/* Exit with an error about failure to restore the working directory
+   during an openat emulation.  The caller must ensure that fd 2 is
+   not a just-opened fd, even when openat_safer is not in use.  */
+
+_Noreturn void
+openat_restore_fail (int errnum)
+{
+#ifndef GNULIB_LIBPOSIX
+  error (exit_failure, errnum,
+         _("failed to return to initial working directory"));
+#endif
+
+  /* As above.  */
+  abort ();
+}
deleted file mode 120000 (symlink)
index 69a4e91c9c241cc09598a4a90ebd4f92c125a9f9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/openat-priv.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7fd4beb5a73a9e5750036472a43c0a673e63bbec
--- /dev/null
@@ -0,0 +1,64 @@
+/* Internals for openat-like functions.
+
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#ifndef _GL_HEADER_OPENAT_PRIV
+#define _GL_HEADER_OPENAT_PRIV
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+/* Maximum number of bytes that it is safe to allocate as a single
+   array on the stack, and that is known as a compile-time constant.
+   The assumption is that we'll touch the array very quickly, or a
+   temporary very near the array, provoking an out-of-memory trap.  On
+   some operating systems, there is only one guard page for the stack,
+   and a page size can be as small as 4096 bytes.  Subtract 64 in the
+   hope that this will let the compiler touch a nearby temporary and
+   provoke a trap.  */
+#define SAFER_ALLOCA_MAX (4096 - 64)
+
+#define SAFER_ALLOCA(m) ((m) < SAFER_ALLOCA_MAX ? (m) : SAFER_ALLOCA_MAX)
+
+#if defined PATH_MAX
+# define OPENAT_BUFFER_SIZE SAFER_ALLOCA (PATH_MAX)
+#elif defined _XOPEN_PATH_MAX
+# define OPENAT_BUFFER_SIZE SAFER_ALLOCA (_XOPEN_PATH_MAX)
+#else
+# define OPENAT_BUFFER_SIZE SAFER_ALLOCA (1024)
+#endif
+
+char *openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file);
+
+/* 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 */)
+
+/* Wrapper function shared among linkat and renameat.  */
+int at_func2 (int fd1, char const *file1,
+              int fd2, char const *file2,
+              int (*func) (char const *file1, char const *file2));
+
+#endif /* _GL_HEADER_OPENAT_PRIV */
deleted file mode 120000 (symlink)
index 36ef43b60bd353ca96088e2ad9e268a29b41ffbd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/openat-proc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7ccb734f424d7b603a9a80c77974fad53ab0fd95
--- /dev/null
@@ -0,0 +1,154 @@
+/* Create /proc/self/fd-related names for subfiles of open directories.
+
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "openat-priv.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifdef __KLIBC__ /* OS/2 */
+# include <InnoTekLIBC/backend.h>
+#endif
+#ifdef __MVS__ /* z/OS */
+# include <termios.h>
+#endif
+
+#include "intprops.h"
+
+/* Set BUF to the name of the subfile of the directory identified by
+   FD, where the subfile is named FILE.  If successful, return BUF if
+   the result fits in BUF, dynamically allocated memory otherwise.
+   Return NULL (setting errno) on error.  */
+char *
+openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file)
+{
+  char *result = buf;
+  int dirlen;
+
+  /* Make sure the caller gets ENOENT when appropriate.  */
+  if (!*file)
+    {
+      buf[0] = '\0';
+      return buf;
+    }
+
+#if !(defined __KLIBC__ || defined __MVS__)
+  /* Generic code for Linux, Solaris, and similar platforms.  */
+# define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/"
+  {
+    enum {
+      PROC_SELF_FD_DIR_SIZE_BOUND
+        = (sizeof PROC_SELF_FD_FORMAT - (sizeof "%d" - 1)
+           + INT_STRLEN_BOUND (int))
+    };
+
+    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_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK | O_CLOEXEC);
+        if (proc_self_fd < 0)
+          proc_status = -1;
+        else
+          {
+            /* Detect whether /proc/self/fd/%i/../fd exists, where %i is the
+               number of a file descriptor open on /proc/self/fd.  On Linux,
+               that name resolves to /proc/self/fd, which was opened above.
+               However, on Solaris, it may resolve to /proc/self/fd/fd, which
+               cannot exist, since all names in /proc/self/fd are numeric.  */
+            char dotdot_buf[PROC_SELF_FD_DIR_SIZE_BOUND + sizeof "../fd" - 1];
+            sprintf (dotdot_buf, PROC_SELF_FD_FORMAT "../fd", proc_self_fd);
+            proc_status = access (dotdot_buf, F_OK) ? -1 : 1;
+            close (proc_self_fd);
+          }
+      }
+
+    if (proc_status < 0)
+      return NULL;
+    else
+      {
+        size_t bufsize = PROC_SELF_FD_DIR_SIZE_BOUND + strlen (file);
+        if (OPENAT_BUFFER_SIZE < bufsize)
+          {
+            result = malloc (bufsize);
+            if (! result)
+              return NULL;
+          }
+
+        dirlen = sprintf (result, PROC_SELF_FD_FORMAT, fd);
+      }
+  }
+#else /* (defined __KLIBC__ || defined __MVS__), i.e. OS/2 or z/OS */
+  /* OS/2 kLIBC provides a function to retrieve a path from a fd.  */
+  {
+    size_t bufsize;
+
+# ifdef __KLIBC__
+    char dir[_MAX_PATH];
+    if (__libc_Back_ioFHToPath (fd, dir, sizeof dir))
+      return NULL;
+# endif
+# ifdef __MVS__
+    char dir[_XOPEN_PATH_MAX];
+    /* Documentation:
+       https://www.ibm.com/docs/en/zos/2.2.0?topic=functions-w-ioctl-w-pioctl-control-devices */
+    if (w_ioctl (fd, _IOCC_GPN, sizeof dir, dir) < 0)
+      return NULL;
+    /* Documentation:
+       https://www.ibm.com/docs/en/zos/2.2.0?topic=functions-e2a-l-convert-characters-from-ebcdic-ascii */
+    dirlen = __e2a_l (dir, strlen (dir));
+    if (dirlen < 0 || dirlen >= sizeof dir)
+      return NULL;
+    dir[dirlen] = '\0';
+# endif
+
+    dirlen = strlen (dir);
+    bufsize = dirlen + 1 + strlen (file) + 1; /* 1 for '/', 1 for null */
+    if (OPENAT_BUFFER_SIZE < bufsize)
+      {
+        result = malloc (bufsize);
+        if (! result)
+          return NULL;
+      }
+
+    strcpy (result, dir);
+    result[dirlen++] = '/';
+  }
+#endif
+
+  strcpy (result + dirlen, file);
+  return result;
+}
deleted file mode 120000 (symlink)
index 73bc3e68b8e93eb9add5728543f687d338e0cd89..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/openat-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5bee3931669c44feda32b73f03e29123d8a099f8
--- /dev/null
@@ -0,0 +1,46 @@
+/* Invoke openat, but avoid some glitches.
+
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert for open, ported by Eric Blake for openat.  */
+
+#include <config.h>
+
+#include "fcntl-safer.h"
+
+#include <fcntl.h>
+#include <stdarg.h>
+#include "unistd-safer.h"
+
+int
+openat_safer (int fd, char const *file, int flags, ...)
+{
+  mode_t mode = 0;
+
+  if (flags & O_CREAT)
+    {
+      va_list ap;
+      va_start (ap, flags);
+
+      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+         creates crashing code when 'mode_t' is smaller than 'int'.  */
+      mode = va_arg (ap, PROMOTED_MODE_T);
+
+      va_end (ap);
+    }
+
+  return fd_safer (openat (fd, file, flags, mode));
+}
deleted file mode 120000 (symlink)
index e8bc9d8128ba286b10f73597a83022e2477afabf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/openat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..65cfc5ede42214447681347b03fac57bbc21d3d8
--- /dev/null
@@ -0,0 +1,315 @@
+/* provide a replacement openat function
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+/* If the user's config.h happens to include <fcntl.h>, let it include only
+   the system's <fcntl.h> here, so that orig_openat doesn't recurse to
+   rpl_openat.  */
+#define __need_system_fcntl_h
+#include <config.h>
+
+/* Get the original definition of open.  It might be defined as a macro.  */
+#include <fcntl.h>
+#include <sys/types.h>
+#undef __need_system_fcntl_h
+
+#if HAVE_OPENAT
+static int
+orig_openat (int fd, char const *filename, int flags, mode_t mode)
+{
+  return openat (fd, filename, flags, mode);
+}
+#endif
+
+#ifdef __osf__
+/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
+   this include because of the preliminary #include <fcntl.h> above.  */
+# include "fcntl.h"
+#else
+# include <fcntl.h>
+#endif
+
+#include "openat.h"
+
+#include "cloexec.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+#if HAVE_OPENAT
+
+/* Like openat, but support O_CLOEXEC and work around Solaris 9 bugs
+   with trailing slash.  */
+int
+rpl_openat (int dfd, char const *filename, int flags, ...)
+{
+  /* 0 = unknown, 1 = yes, -1 = no.  */
+#if GNULIB_defined_O_CLOEXEC
+  int have_cloexec = -1;
+#else
+  static int have_cloexec;
+#endif
+
+  mode_t mode;
+  int fd;
+
+  mode = 0;
+  if (flags & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, flags);
+
+      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+         creates crashing code when 'mode_t' is smaller than 'int'.  */
+      mode = va_arg (arg, PROMOTED_MODE_T);
+
+      va_end (arg);
+    }
+
+# if OPEN_TRAILING_SLASH_BUG
+  /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename
+     ends in a slash, as POSIX says such a filename must name a directory
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>:
+       "A pathname that contains at least one non-<slash> character and that
+        ends with one or more trailing <slash> characters shall not be resolved
+        successfully unless the last pathname component before the trailing
+        <slash> characters names an existing directory"
+     If the named file already exists as a directory, then
+       - if O_CREAT is specified, open() must fail because of the semantics
+         of O_CREAT,
+       - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
+         <https://pubs.opengroup.org/onlinepubs/9699919799/functions/openat.html>
+         says that it fails with errno = EISDIR in this case.
+     If the named file does not exist or does not name a directory, then
+       - if O_CREAT is specified, open() must fail since open() cannot create
+         directories,
+       - if O_WRONLY or O_RDWR is specified, open() must fail because the
+         file does not contain a '.' directory.  */
+  if ((flags & O_CREAT)
+      || (flags & O_ACCMODE) == O_RDWR
+      || (flags & O_ACCMODE) == O_WRONLY)
+    {
+      size_t len = strlen (filename);
+      if (len > 0 && filename[len - 1] == '/')
+        {
+          errno = EISDIR;
+          return -1;
+        }
+    }
+# endif
+
+  fd = orig_openat (dfd, filename,
+                    flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode);
+
+  if (flags & O_CLOEXEC)
+    {
+      if (! have_cloexec)
+        {
+          if (0 <= fd)
+            have_cloexec = 1;
+          else if (errno == EINVAL)
+            {
+              fd = orig_openat (dfd, filename, flags & ~O_CLOEXEC, mode);
+              have_cloexec = -1;
+            }
+        }
+      if (have_cloexec < 0 && 0 <= fd)
+        set_cloexec_flag (fd, true);
+    }
+
+
+# if OPEN_TRAILING_SLASH_BUG
+  /* If the filename ends in a slash and fd does not refer to a directory,
+     then fail.
+     Rationale: POSIX says such a filename must name a directory
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>:
+       "A pathname that contains at least one non-<slash> character and that
+        ends with one or more trailing <slash> characters shall not be resolved
+        successfully unless the last pathname component before the trailing
+        <slash> characters names an existing directory"
+     If the named file without the slash is not a directory, open() must fail
+     with ENOTDIR.  */
+  if (fd >= 0)
+    {
+      /* We know len is positive, since open did not fail with ENOENT.  */
+      size_t len = strlen (filename);
+      if (filename[len - 1] == '/')
+        {
+          struct stat statbuf;
+
+          if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
+            {
+              close (fd);
+              errno = ENOTDIR;
+              return -1;
+            }
+        }
+    }
+# endif
+
+  return fd;
+}
+
+#else /* !HAVE_OPENAT */
+
+# include "filename.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+# include "openat-priv.h"
+# include "save-cwd.h"
+
+/* Replacement for Solaris' openat function.
+   <https://www.google.com/search?q=openat+site:docs.oracle.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);
+
+      /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+         creates crashing code when 'mode_t' is smaller than 'int'.  */
+      mode = va_arg (arg, PROMOTED_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;
+    }
+  if (0 <= fd && fd == saved_cwd.desc)
+    {
+      /* If saving the working directory collides with the user's
+         requested fd, then the user's fd must have been closed to
+         begin with.  */
+      free_cwd (&saved_cwd);
+      errno = EBADF;
+      return -1;
+    }
+
+  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)
+            {
+              /* Don't write a message to just-created fd 2.  */
+              saved_errno = errno;
+              if (err == STDERR_FILENO)
+                close (err);
+              openat_restore_fail (saved_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_SEARCH | O_CLOEXEC);
+
+  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;
+}
+
+#endif /* !HAVE_OPENAT */
deleted file mode 120000 (symlink)
index 8e2c659fd27eae5fac1d2258cc16ddedd36ce6eb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/openat.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dc34092bb3f1b48e7b5f72aad2a2d22819545abb
--- /dev/null
@@ -0,0 +1,127 @@
+/* provide a replacement openat function
+   Copyright (C) 2004-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#ifndef _GL_HEADER_OPENAT
+#define _GL_HEADER_OPENAT
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _Noreturn,
+   _GL_ATTRIBUTE_DEPRECATED, HAVE_OPENAT.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+_GL_INLINE_HEADER_BEGIN
+
+#if !HAVE_OPENAT
+
+int openat_permissive (int fd, char const *file, int flags, mode_t mode,
+                       int *cwd_errno);
+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
+
+_Noreturn void openat_restore_fail (int);
+_Noreturn void openat_save_fail (int);
+
+/* Using these function names makes application code
+   slightly more readable than it would be with
+   fchownat (..., 0) or fchownat (..., AT_SYMLINK_NOFOLLOW).  */
+
+#if GNULIB_CHOWNAT
+
+# ifndef CHOWNAT_INLINE
+#  define CHOWNAT_INLINE _GL_INLINE
+# endif
+
+CHOWNAT_INLINE int
+chownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+  return fchownat (fd, file, owner, group, 0);
+}
+
+CHOWNAT_INLINE int
+lchownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+  return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW);
+}
+
+#endif
+
+#if GNULIB_CHMODAT
+
+# ifndef CHMODAT_INLINE
+#  define CHMODAT_INLINE _GL_INLINE
+# endif
+
+CHMODAT_INLINE int
+chmodat (int fd, char const *file, mode_t mode)
+{
+  return fchmodat (fd, file, mode, 0);
+}
+
+CHMODAT_INLINE int
+lchmodat (int fd, char const *file, mode_t mode)
+{
+  return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
+}
+
+#endif
+
+#if GNULIB_STATAT
+
+# ifndef STATAT_INLINE
+#  define STATAT_INLINE _GL_INLINE
+# endif
+
+_GL_ATTRIBUTE_DEPRECATED
+STATAT_INLINE int
+statat (int fd, char const *name, struct stat *st)
+{
+  return fstatat (fd, name, st, 0);
+}
+
+_GL_ATTRIBUTE_DEPRECATED
+STATAT_INLINE int
+lstatat (int fd, char const *name, struct stat *st)
+{
+  return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW);
+}
+
+#endif
+
+/* For now, there are no wrappers named laccessat or leuidaccessat,
+   since gnulib doesn't support faccessat(,AT_SYMLINK_NOFOLLOW) and
+   since access rights on symlinks are of limited utility.  Likewise,
+   wrappers are not provided for accessat or euidaccessat, so as to
+   avoid dragging in -lgen on some platforms.  */
+
+_GL_INLINE_HEADER_END
+
+#endif /* _GL_HEADER_OPENAT */
deleted file mode 120000 (symlink)
index 7e2bc8c51a5195055608d13dcb5b1d97bd7f1a6c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/opendir-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..edb254c19d24c7877236b9c90ac5ac93d6dcd1a7
--- /dev/null
@@ -0,0 +1,76 @@
+/* Invoke opendir, but avoid some glitches.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#include <config.h>
+
+#include "dirent-safer.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* Like opendir, but do not clobber stdin, stdout, or stderr.  */
+
+DIR *
+opendir_safer (char const *name)
+{
+  DIR *dp = opendir (name);
+
+  if (dp)
+    {
+      int fd = dirfd (dp);
+
+      if (0 <= fd && fd <= STDERR_FILENO)
+        {
+          /* If fdopendir is native (as on Linux), then it is safe to
+             assume dirfd(fdopendir(n))==n.  If we are using the
+             gnulib module fdopendir, then this guarantee is not met,
+             but fdopendir recursively calls opendir_safer up to 3
+             times to at least get a safe fd.  If fdopendir is not
+             present but dirfd is accurate (as on cygwin 1.5.x), then
+             we recurse up to 3 times ourselves.  Finally, if dirfd
+             always fails (as on mingw), then we are already safe.  */
+          DIR *newdp;
+          int e;
+#if HAVE_FDOPENDIR || GNULIB_FDOPENDIR
+          int f = fcntl (fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
+          if (f < 0)
+            {
+              e = errno;
+              newdp = NULL;
+            }
+          else
+            {
+              newdp = fdopendir (f);
+              e = errno;
+              if (! newdp)
+                close (f);
+            }
+#else /* !FDOPENDIR */
+          newdp = opendir_safer (name);
+          e = errno;
+#endif
+          closedir (dp);
+          errno = e;
+          dp = newdp;
+        }
+    }
+
+  return dp;
+}
deleted file mode 120000 (symlink)
index 76dc49b984e48a100c188a29d6021c1252e9c746..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/opendir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..df76807631ead321e66355252660d04914521875
--- /dev/null
@@ -0,0 +1,186 @@
+/* Start reading the entries of a directory.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <dirent.h>
+
+#include <errno.h>
+#include <stddef.h>
+
+#if HAVE_OPENDIR
+
+/* Override opendir(), to keep track of the open file descriptors.
+   Needed because there is a function dirfd().  */
+
+#else
+
+# include "filename.h"
+
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#if GNULIB_defined_DIR
+# include "dirent-private.h"
+#endif
+
+#if REPLACE_FCHDIR
+# include <unistd.h>
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Don't assume that UNICODE is not defined.  */
+# undef WIN32_FIND_DATA
+# define WIN32_FIND_DATA WIN32_FIND_DATAA
+# undef GetFullPathName
+# define GetFullPathName GetFullPathNameA
+# undef FindFirstFile
+# define FindFirstFile FindFirstFileA
+#endif
+
+DIR *
+opendir (const char *dir_name)
+#undef opendir
+{
+#if HAVE_DIRENT_H                       /* equivalent to HAVE_OPENDIR */
+  DIR *dirp;
+
+# if GNULIB_defined_DIR
+#  undef DIR
+
+  dirp = (struct gl_directory *) malloc (sizeof (struct gl_directory));
+  if (dirp == NULL)
+    {
+      errno = ENOMEM;
+      return NULL;
+    }
+
+  DIR *real_dirp = opendir (dir_name);
+  if (real_dirp == NULL)
+    {
+      int saved_errno = errno;
+      free (dirp);
+      errno = saved_errno;
+      return NULL;
+    }
+
+  dirp->fd_to_close = -1;
+  dirp->real_dirp = real_dirp;
+# else
+  dirp = opendir (dir_name);
+  if (dirp == NULL)
+    return NULL;
+# endif
+
+#else
+
+  char dir_name_mask[MAX_PATH + 1 + 1 + 1];
+  int status;
+  HANDLE current;
+  WIN32_FIND_DATA entry;
+  struct gl_directory *dirp;
+
+  if (dir_name[0] == '\0')
+    {
+      errno = ENOENT;
+      return NULL;
+    }
+
+  /* Make the dir_name absolute, so that we continue reading the same
+     directory if the current directory changed between this opendir()
+     call and a subsequent rewinddir() call.  */
+  if (!GetFullPathName (dir_name, MAX_PATH, dir_name_mask, NULL))
+    {
+      errno = EINVAL;
+      return NULL;
+    }
+
+  /* Append the mask.
+     "*" and "*.*" appear to be equivalent.  */
+  {
+    char *p;
+
+    p = dir_name_mask + strlen (dir_name_mask);
+    if (p > dir_name_mask && !ISSLASH (p[-1]))
+      *p++ = '\\';
+    *p++ = '*';
+    *p = '\0';
+  }
+
+  /* Start searching the directory.  */
+  status = -1;
+  current = FindFirstFile (dir_name_mask, &entry);
+  if (current == INVALID_HANDLE_VALUE)
+    {
+      switch (GetLastError ())
+        {
+        case ERROR_FILE_NOT_FOUND:
+          status = -2;
+          break;
+        case ERROR_PATH_NOT_FOUND:
+          errno = ENOENT;
+          return NULL;
+        case ERROR_DIRECTORY:
+          errno = ENOTDIR;
+          return NULL;
+        case ERROR_ACCESS_DENIED:
+          errno = EACCES;
+          return NULL;
+        default:
+          errno = EIO;
+          return NULL;
+        }
+    }
+
+  /* Allocate the result.  */
+  dirp =
+    (struct gl_directory *)
+    malloc (offsetof (struct gl_directory, dir_name_mask[0])
+            + strlen (dir_name_mask) + 1);
+  if (dirp == NULL)
+    {
+      if (current != INVALID_HANDLE_VALUE)
+        FindClose (current);
+      errno = ENOMEM;
+      return NULL;
+    }
+  dirp->fd_to_close = -1;
+  dirp->status = status;
+  dirp->current = current;
+  if (status == -1)
+    memcpy (&dirp->entry, &entry, sizeof (WIN32_FIND_DATA));
+  strcpy (dirp->dir_name_mask, dir_name_mask);
+
+#endif
+
+#if REPLACE_FCHDIR
+  {
+    int fd = dirfd (dirp);
+    if (0 <= fd && _gl_register_fd (fd, dir_name) != fd)
+      {
+        int saved_errno = errno;
+        closedir (dirp);
+        errno = saved_errno;
+        return NULL;
+      }
+  }
+#endif
+
+  return dirp;
+}
deleted file mode 120000 (symlink)
index 7a1a10a7a4ac8793eee1192ba8a1ea861b93d16b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/opendirat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d2b567f8e722f37fb939663c0d3fabe0a387ef64
--- /dev/null
@@ -0,0 +1,54 @@
+/* Open a directory relative to another directory.
+
+   Copyright 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Jim Meyering and Paul Eggert.  */
+
+#include <config.h>
+
+#include <opendirat.h>
+
+#include <errno.h>
+#include <fcntl--.h>
+#include <unistd.h>
+
+/* Relative to DIR_FD, open the directory DIR, passing EXTRA_FLAGS to
+   the underlying openat call.  On success, store into *PNEW_FD the
+   underlying file descriptor of the newly opened directory and return
+   the directory stream.  On failure, return NULL and set errno.
+
+   On success, *PNEW_FD is at least 3, so this is a "safer" function.  */
+
+DIR *
+opendirat (int dir_fd, char const *dir, int extra_flags, int *pnew_fd)
+{
+  int open_flags = (O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_NOCTTY
+                    | O_NONBLOCK | extra_flags);
+  int new_fd = openat (dir_fd, dir, open_flags);
+
+  if (new_fd < 0)
+    return NULL;
+  DIR *dirp = fdopendir (new_fd);
+  if (dirp)
+    *pnew_fd = new_fd;
+  else
+    {
+      int fdopendir_errno = errno;
+      close (new_fd);
+      errno = fdopendir_errno;
+    }
+  return dirp;
+}
deleted file mode 120000 (symlink)
index c40a194fb271deadd5e2bcbde6a0fc4baa6f6b97..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/opendirat.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f34291902d4d773c6f3ca8da251f42333efc48d7
--- /dev/null
@@ -0,0 +1,26 @@
+/* Open a directory relative to another directory.
+
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <dirent.h>
+
+DIR *opendirat (int, char const *, int, int *)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1);
deleted file mode 120000 (symlink)
index 57989a35fadf11a88c4cdb83add2d59a764a8317..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/parse-datetime.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9a980f5baac64ade75b14f076f29fa1c91ebd7a8
--- /dev/null
@@ -0,0 +1,30 @@
+/* Parse a string into an internal timestamp.
+
+   Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <time.h>
+
+bool parse_datetime (struct timespec *restrict,
+                     char const *, struct timespec const *);
+
+/* parse_datetime2 flag: if set, print debug/progress information to STDERR */
+#define PARSE_DATETIME_DEBUG 1
+
+/* same as above, supporting additional flags */
+bool parse_datetime2 (struct timespec *restrict,
+                      char const *, struct timespec const *,
+                      unsigned int flags, timezone_t, char const *);
deleted file mode 120000 (symlink)
index ebe2cdb2ca196425e9758a12f926da5b50b2e3ae..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/parse-datetime.y
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b833055a8ca6ceb703d1b36cb74954a680d309bd
--- /dev/null
+%{
+/* Parse a string into an internal timestamp.
+
+   Copyright (C) 1999-2000, 2002-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Originally written by Steven M. Bellovin <smb@research.att.com> while
+   at the University of North Carolina at Chapel Hill.  Later tweaked by
+   a couple of people on Usenet.  Completely overhauled by Rich $alz
+   <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
+
+   Modified by Assaf Gordon <assafgordon@gmail.com> in 2016 to add
+   debug output.
+
+   Modified by Paul Eggert <eggert@twinsun.com> in 1999 to do the
+   right thing about local DST.  Also modified by Paul Eggert
+   <eggert@cs.ucla.edu> in 2004 to support nanosecond-resolution
+   timestamps, in 2004 to support TZ strings in dates, and in 2017 and 2020 to
+   check for integer overflow and to support longer-than-'long'
+   'time_t' and 'tv_nsec'.  */
+
+#include <config.h>
+
+#include "parse-datetime.h"
+
+#include "idx.h"
+#include "intprops.h"
+#include "timespec.h"
+#include "strftime.h"
+
+/* There's no need to extend the stack, so there's no need to involve
+   alloca.  */
+#define YYSTACK_USE_ALLOCA 0
+
+/* Tell Bison how much stack space is needed.  20 should be plenty for
+   this grammar, which is not right recursive.  Beware setting it too
+   high, since that might cause problems on machines whose
+   implementations have lame stack-overflow checking.  */
+#define YYMAXDEPTH 20
+#define YYINITDEPTH YYMAXDEPTH
+
+#include <inttypes.h>
+#include <c-ctype.h>
+#include <stdarg.h>
+#include <stdckdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gettext.h"
+
+#define _(str) gettext (str)
+
+/* Bison's skeleton tests _STDLIB_H, while some stdlib.h headers
+   use _STDLIB_H_ as witness.  Map the latter to the one bison uses.  */
+/* FIXME: this is temporary.  Remove when we have a mechanism to ensure
+   that the version we're using is fixed, too.  */
+#ifdef _STDLIB_H_
+# undef _STDLIB_H
+# define _STDLIB_H 1
+#endif
+
+/* Shift A right by B bits portably, by dividing A by 2**B and
+   truncating towards minus infinity.  A and B should be free of side
+   effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
+   INT_BITS is the number of useful bits in an int.  GNU code can
+   assume that INT_BITS is at least 32.
+
+   ISO C99 says that A >> B is implementation-defined if A < 0.  Some
+   implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
+   right in the usual way when A < 0, so SHR falls back on division if
+   ordinary A >> B doesn't seem to be the usual signed shift.  */
+#define SHR(a, b)       \
+  (-1 >> 1 == -1        \
+   ? (a) >> (b)         \
+   : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
+
+#define HOUR(x) (60 * 60 * (x))
+
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
+/* Verify that time_t is an integer as POSIX requires, and that every
+   time_t value fits in intmax_t.  Please file a bug report if these
+   assumptions are false on your platform.  */
+static_assert (TYPE_IS_INTEGER (time_t));
+static_assert (!TYPE_SIGNED (time_t) || INTMAX_MIN <= TYPE_MINIMUM (time_t));
+static_assert (TYPE_MAXIMUM (time_t) <= INTMAX_MAX);
+
+/* True if N is out of range for time_t.  */
+static bool
+time_overflow (intmax_t n)
+{
+  return ! ((TYPE_SIGNED (time_t) ? TYPE_MINIMUM (time_t) <= n : 0 <= n)
+            && n <= TYPE_MAXIMUM (time_t));
+}
+
+/* Convert a possibly-signed character to an unsigned character.  This is
+   a bit safer than casting to unsigned char, since it catches some type
+   errors that the cast doesn't.  */
+static unsigned char to_uchar (char ch) { return ch; }
+
+static void _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 2))
+dbg_printf (char const *msg, ...)
+{
+  va_list args;
+  /* TODO: use gnulib's 'program_name' instead?  */
+  fputs ("date: ", stderr);
+
+  va_start (args, msg);
+  vfprintf (stderr, msg, args);
+  va_end (args);
+}
+
+
+/* An integer value, and the number of digits in its textual
+   representation.  */
+typedef struct
+{
+  bool negative;
+  intmax_t value;
+  idx_t digits;
+} textint;
+
+/* An entry in the lexical lookup table.  */
+typedef struct
+{
+  char const *name;
+  int type;
+  int value;
+} table;
+
+/* Meridian: am, pm, or 24-hour style.  */
+enum { MERam, MERpm, MER24 };
+
+/* A reasonable upper bound for the buffer used in debug output.  */
+enum { DBGBUFSIZE = 100 };
+
+enum { BILLION = 1000000000, LOG10_BILLION = 9 };
+
+/* Relative times.  */
+typedef struct
+{
+  /* Relative year, month, day, hour, minutes, seconds, and nanoseconds.  */
+  intmax_t year;
+  intmax_t month;
+  intmax_t day;
+  intmax_t hour;
+  intmax_t minutes;
+  intmax_t seconds;
+  int ns;
+} relative_time;
+
+#if HAVE_COMPOUND_LITERALS
+# define RELATIVE_TIME_0 ((relative_time) { 0, 0, 0, 0, 0, 0, 0 })
+#else
+static relative_time const RELATIVE_TIME_0;
+#endif
+
+/* Information passed to and from the parser.  */
+typedef struct
+{
+  /* The input string remaining to be parsed.  */
+  const char *input;
+
+  /* N, if this is the Nth Tuesday.  */
+  intmax_t day_ordinal;
+
+  /* Day of week; Sunday is 0.  */
+  int day_number;
+
+  /* tm_isdst flag for the local zone.  */
+  int local_isdst;
+
+  /* Time zone, in seconds east of UT.  */
+  int time_zone;
+
+  /* Style used for time.  */
+  int meridian;
+
+  /* Gregorian year, month, day, hour, minutes, seconds, and nanoseconds.  */
+  textint year;
+  intmax_t month;
+  intmax_t day;
+  intmax_t hour;
+  intmax_t minutes;
+  struct timespec seconds; /* includes nanoseconds */
+
+  /* Relative year, month, day, hour, minutes, seconds, and nanoseconds.  */
+  relative_time rel;
+
+  /* Presence or counts of nonterminals of various flavors parsed so far.  */
+  bool timespec_seen;
+  bool rels_seen;
+  idx_t dates_seen;
+  idx_t days_seen;
+  idx_t J_zones_seen;
+  idx_t local_zones_seen;
+  idx_t dsts_seen;
+  idx_t times_seen;
+  idx_t zones_seen;
+  bool year_seen;
+
+#ifdef GNULIB_PARSE_DATETIME2
+  /* Print debugging output to stderr.  */
+  bool parse_datetime_debug;
+#endif
+
+  /* Which of the 'seen' parts have been printed when debugging.  */
+  bool debug_dates_seen;
+  bool debug_days_seen;
+  bool debug_local_zones_seen;
+  bool debug_times_seen;
+  bool debug_zones_seen;
+  bool debug_year_seen;
+
+  /* The user specified explicit ordinal day value.  */
+  bool debug_ordinal_day_seen;
+
+  /* Table of local time zone abbreviations, terminated by a null entry.  */
+  table local_time_zone_table[3];
+} parser_control;
+
+static bool
+debugging (parser_control const *pc)
+{
+#ifdef GNULIB_PARSE_DATETIME2
+  return pc->parse_datetime_debug;
+#else
+  return false;
+#endif
+}
+
+union YYSTYPE;
+static int yylex (union YYSTYPE *, parser_control *);
+static int yyerror (parser_control const *, char const *);
+static bool time_zone_hhmm (parser_control *, textint, intmax_t);
+
+/* Extract into *PC any date and time info from a string of digits
+   of the form e.g., YYYYMMDD, YYMMDD, HHMM, HH (and sometimes YYY,
+   YYYY, ...).  */
+static void
+digits_to_date_time (parser_control *pc, textint text_int)
+{
+  if (pc->dates_seen && ! pc->year.digits
+      && ! pc->rels_seen && (pc->times_seen || 2 < text_int.digits))
+    {
+      pc->year_seen = true;
+      pc->year = text_int;
+    }
+  else
+    {
+      if (4 < text_int.digits)
+        {
+          pc->dates_seen++;
+          pc->day = text_int.value % 100;
+          pc->month = (text_int.value / 100) % 100;
+          pc->year.value = text_int.value / 10000;
+          pc->year.digits = text_int.digits - 4;
+        }
+      else
+        {
+          pc->times_seen++;
+          if (text_int.digits <= 2)
+            {
+              pc->hour = text_int.value;
+              pc->minutes = 0;
+            }
+          else
+            {
+              pc->hour = text_int.value / 100;
+              pc->minutes = text_int.value % 100;
+            }
+          pc->seconds = (struct timespec) {0};
+          pc->meridian = MER24;
+        }
+    }
+}
+
+/* Increment PC->rel by FACTOR * REL (FACTOR is 1 or -1).  Return true
+   if successful, false if an overflow occurred.  */
+static bool
+apply_relative_time (parser_control *pc, relative_time rel, int factor)
+{
+  if (factor < 0
+      ? (ckd_sub (&pc->rel.ns, pc->rel.ns, rel.ns)
+         | ckd_sub (&pc->rel.seconds, pc->rel.seconds, rel.seconds)
+         | ckd_sub (&pc->rel.minutes, pc->rel.minutes, rel.minutes)
+         | ckd_sub (&pc->rel.hour, pc->rel.hour, rel.hour)
+         | ckd_sub (&pc->rel.day, pc->rel.day, rel.day)
+         | ckd_sub (&pc->rel.month, pc->rel.month, rel.month)
+         | ckd_sub (&pc->rel.year, pc->rel.year, rel.year))
+      : (ckd_add (&pc->rel.ns, pc->rel.ns, rel.ns)
+         | ckd_add (&pc->rel.seconds, pc->rel.seconds, rel.seconds)
+         | ckd_add (&pc->rel.minutes, pc->rel.minutes, rel.minutes)
+         | ckd_add (&pc->rel.hour, pc->rel.hour, rel.hour)
+         | ckd_add (&pc->rel.day, pc->rel.day, rel.day)
+         | ckd_add (&pc->rel.month, pc->rel.month, rel.month)
+         | ckd_add (&pc->rel.year, pc->rel.year, rel.year)))
+    return false;
+  pc->rels_seen = true;
+  return true;
+}
+
+/* Set PC-> hour, minutes, seconds and nanoseconds members from arguments.  */
+static void
+set_hhmmss (parser_control *pc, intmax_t hour, intmax_t minutes,
+            time_t sec, int nsec)
+{
+  pc->hour = hour;
+  pc->minutes = minutes;
+  pc->seconds = (struct timespec) { .tv_sec = sec, .tv_nsec = nsec };
+}
+
+/* Return a textual representation of the day ordinal/number values
+   in the parser_control struct (e.g., "last wed", "this tues", "thu").  */
+static const char *
+str_days (parser_control *pc, char *buffer, int n)
+{
+  /* TODO: use relative_time_table for reverse lookup.  */
+  static char const ordinal_values[][11] = {
+     "last",
+     "this",
+     "next/first",
+     "(SECOND)", /* SECOND is commented out in relative_time_table.  */
+     "third",
+     "fourth",
+     "fifth",
+     "sixth",
+     "seventh",
+     "eight",
+     "ninth",
+     "tenth",
+     "eleventh",
+     "twelfth"
+  };
+
+  static char const days_values[][4] = {
+     "Sun",
+     "Mon",
+     "Tue",
+     "Wed",
+     "Thu",
+     "Fri",
+     "Sat"
+  };
+
+  int len;
+
+  /* Don't add an ordinal prefix if the user didn't specify it
+     (e.g., "this wed" vs "wed").  */
+  if (pc->debug_ordinal_day_seen)
+    {
+      /* Use word description if possible (e.g., -1 = last, 3 = third).  */
+      len = (-1 <= pc->day_ordinal && pc->day_ordinal <= 12
+             ? snprintf (buffer, n, "%s", ordinal_values[pc->day_ordinal + 1])
+             : snprintf (buffer, n, "%"PRIdMAX, pc->day_ordinal));
+    }
+  else
+    {
+      buffer[0] = '\0';
+      len = 0;
+    }
+
+  /* Add the day name */
+  if (0 <= pc->day_number && pc->day_number <= 6 && 0 <= len && len < n)
+    snprintf (buffer + len, n - len, &" %s"[len == 0],
+              days_values[pc->day_number]);
+  else
+    {
+      /* invalid day_number value - should never happen */
+    }
+  return buffer;
+}
+
+/* Convert a time zone to its string representation.  */
+
+enum { TIME_ZONE_BUFSIZE = INT_STRLEN_BOUND (intmax_t) + sizeof ":MM:SS" } ;
+
+static char const *
+time_zone_str (int time_zone, char time_zone_buf[TIME_ZONE_BUFSIZE])
+{
+  char *p = time_zone_buf;
+  char sign = time_zone < 0 ? '-' : '+';
+  int hour = abs (time_zone / (60 * 60));
+  p += sprintf (time_zone_buf, "%c%02d", sign, hour);
+  int offset_from_hour = abs (time_zone % (60 * 60));
+  if (offset_from_hour != 0)
+    {
+      int mm = offset_from_hour / 60;
+      int ss = offset_from_hour % 60;
+      *p++ = ':';
+      *p++ = '0' + mm / 10;
+      *p++ = '0' + mm % 10;
+      if (ss)
+        {
+          *p++ = ':';
+          *p++ = '0' + ss / 10;
+          *p++ = '0' + ss % 10;
+        }
+      *p = '\0';
+    }
+  return time_zone_buf;
+}
+
+/* debugging: print the current time in the parser_control structure.
+   The parser will increment "*_seen" members for those which were parsed.
+   This function will print only newly seen parts.  */
+static void
+debug_print_current_time (char const *item, parser_control *pc)
+{
+  bool space = false;
+
+  if (!debugging (pc))
+    return;
+
+  /* no newline, more items printed below */
+  dbg_printf (_("parsed %s part: "), item);
+
+  if (pc->dates_seen && !pc->debug_dates_seen)
+    {
+      /*TODO: use pc->year.negative?  */
+      fprintf (stderr, "(Y-M-D) %04"PRIdMAX"-%02"PRIdMAX"-%02"PRIdMAX,
+              pc->year.value, pc->month, pc->day);
+      pc->debug_dates_seen = true;
+      space = true;
+    }
+
+  if (pc->year_seen != pc->debug_year_seen)
+    {
+      if (space)
+        fputc (' ', stderr);
+      fprintf (stderr, _("year: %04"PRIdMAX), pc->year.value);
+
+      pc->debug_year_seen = pc->year_seen;
+      space = true;
+    }
+
+  if (pc->times_seen && !pc->debug_times_seen)
+    {
+      intmax_t sec = pc->seconds.tv_sec;
+      fprintf (stderr, &" %02"PRIdMAX":%02"PRIdMAX":%02"PRIdMAX[!space],
+               pc->hour, pc->minutes, sec);
+      if (pc->seconds.tv_nsec != 0)
+        {
+          int nsec = pc->seconds.tv_nsec;
+          fprintf (stderr, ".%09d", nsec);
+        }
+      if (pc->meridian == MERpm)
+        fputs ("pm", stderr);
+
+      pc->debug_times_seen = true;
+      space = true;
+    }
+
+  if (pc->days_seen && !pc->debug_days_seen)
+    {
+      if (space)
+        fputc (' ', stderr);
+      char tmp[DBGBUFSIZE];
+      fprintf (stderr, _("%s (day ordinal=%"PRIdMAX" number=%d)"),
+               str_days (pc, tmp, sizeof tmp),
+               pc->day_ordinal, pc->day_number);
+      pc->debug_days_seen = true;
+      space = true;
+    }
+
+  /* local zone strings only change the DST settings,
+     not the timezone value.  If seen, inform about the DST.  */
+  if (pc->local_zones_seen && !pc->debug_local_zones_seen)
+    {
+      fprintf (stderr, &" isdst=%d%s"[!space],
+               pc->local_isdst, pc->dsts_seen ? " DST" : "");
+      pc->debug_local_zones_seen = true;
+      space = true;
+    }
+
+  if (pc->zones_seen && !pc->debug_zones_seen)
+    {
+      char time_zone_buf[TIME_ZONE_BUFSIZE];
+      fprintf (stderr, &" UTC%s"[!space],
+               time_zone_str (pc->time_zone, time_zone_buf));
+      pc->debug_zones_seen = true;
+      space = true;
+    }
+
+  if (pc->timespec_seen)
+    {
+      intmax_t sec = pc->seconds.tv_sec;
+      if (space)
+        fputc (' ', stderr);
+      fprintf (stderr, _("number of seconds: %"PRIdMAX), sec);
+    }
+
+  fputc ('\n', stderr);
+}
+
+/* Debugging: print the current relative values.  */
+
+static bool
+print_rel_part (bool space, intmax_t val, char const *name)
+{
+  if (val == 0)
+    return space;
+  fprintf (stderr, &" %+"PRIdMAX" %s"[!space], val, name);
+  return true;
+}
+
+static void
+debug_print_relative_time (char const *item, parser_control const *pc)
+{
+  bool space = false;
+
+  if (!debugging (pc))
+    return;
+
+  /* no newline, more items printed below */
+  dbg_printf (_("parsed %s part: "), item);
+
+  if (pc->rel.year == 0 && pc->rel.month == 0 && pc->rel.day == 0
+      && pc->rel.hour == 0 && pc->rel.minutes == 0 && pc->rel.seconds == 0
+      && pc->rel.ns == 0)
+    {
+      /* Special case: relative time of this/today/now */
+      fputs (_("today/this/now\n"), stderr);
+      return;
+    }
+
+  space = print_rel_part (space, pc->rel.year, "year(s)");
+  space = print_rel_part (space, pc->rel.month, "month(s)");
+  space = print_rel_part (space, pc->rel.day, "day(s)");
+  space = print_rel_part (space, pc->rel.hour, "hour(s)");
+  space = print_rel_part (space, pc->rel.minutes, "minutes");
+  space = print_rel_part (space, pc->rel.seconds, "seconds");
+  print_rel_part (space, pc->rel.ns, "nanoseconds");
+
+  fputc ('\n', stderr);
+}
+
+
+
+%}
+
+/* We want a reentrant parser, even if the TZ manipulation and the calls to
+   localtime and gmtime are not reentrant.  */
+%define api.pure
+%parse-param { parser_control *pc }
+%lex-param { parser_control *pc }
+
+/* This grammar has 31 shift/reduce conflicts.  */
+%expect 31
+
+%union
+{
+  intmax_t intval;
+  textint textintval;
+  struct timespec timespec;
+  relative_time rel;
+}
+
+%token <intval> tAGO
+%token tDST
+
+%token tYEAR_UNIT tMONTH_UNIT tHOUR_UNIT tMINUTE_UNIT tSEC_UNIT
+%token <intval> tDAY_UNIT tDAY_SHIFT
+
+%token <intval> tDAY tDAYZONE tLOCAL_ZONE tMERIDIAN
+%token <intval> tMONTH tORDINAL tZONE
+
+%token <textintval> tSNUMBER tUNUMBER
+%token <timespec> tSDECIMAL_NUMBER tUDECIMAL_NUMBER
+
+%type <intval> o_colon_minutes
+%type <timespec> seconds signed_seconds unsigned_seconds
+
+%type <rel> relunit relunit_snumber dayshift
+
+%%
+
+spec:
+    timespec
+  | items
+  ;
+
+timespec:
+    '@' seconds
+      {
+        pc->seconds = $2;
+        pc->timespec_seen = true;
+        debug_print_current_time (_("number of seconds"), pc);
+      }
+  ;
+
+items:
+    /* empty */
+  | items item
+  ;
+
+item:
+    datetime
+      {
+        pc->times_seen++; pc->dates_seen++;
+        debug_print_current_time (_("datetime"), pc);
+      }
+  | time
+      {
+        pc->times_seen++;
+        debug_print_current_time (_("time"), pc);
+      }
+  | local_zone
+      {
+        pc->local_zones_seen++;
+        debug_print_current_time (_("local_zone"), pc);
+      }
+  | 'J'
+      {
+        pc->J_zones_seen++;
+        debug_print_current_time ("J", pc);
+      }
+  | zone
+      {
+        pc->zones_seen++;
+        debug_print_current_time (_("zone"), pc);
+      }
+  | date
+      {
+        pc->dates_seen++;
+        debug_print_current_time (_("date"), pc);
+      }
+  | day
+      {
+        pc->days_seen++;
+        debug_print_current_time (_("day"), pc);
+      }
+  | rel
+      {
+        debug_print_relative_time (_("relative"), pc);
+      }
+  | number
+      {
+        debug_print_current_time (_("number"), pc);
+      }
+  | hybrid
+      {
+        debug_print_relative_time (_("hybrid"), pc);
+      }
+  ;
+
+datetime:
+    iso_8601_datetime
+  ;
+
+iso_8601_datetime:
+    iso_8601_date 'T' iso_8601_time
+  ;
+
+time:
+    tUNUMBER tMERIDIAN
+      {
+        set_hhmmss (pc, $1.value, 0, 0, 0);
+        pc->meridian = $2;
+      }
+  | tUNUMBER ':' tUNUMBER tMERIDIAN
+      {
+        set_hhmmss (pc, $1.value, $3.value, 0, 0);
+        pc->meridian = $4;
+      }
+  | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tMERIDIAN
+      {
+        set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
+        pc->meridian = $6;
+      }
+  | iso_8601_time
+  ;
+
+iso_8601_time:
+    tUNUMBER zone_offset
+      {
+        set_hhmmss (pc, $1.value, 0, 0, 0);
+        pc->meridian = MER24;
+      }
+  | tUNUMBER ':' tUNUMBER o_zone_offset
+      {
+        set_hhmmss (pc, $1.value, $3.value, 0, 0);
+        pc->meridian = MER24;
+      }
+  | tUNUMBER ':' tUNUMBER ':' unsigned_seconds o_zone_offset
+      {
+        set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
+        pc->meridian = MER24;
+      }
+  ;
+
+o_zone_offset:
+  /* empty */
+  | zone_offset
+  ;
+
+zone_offset:
+    tSNUMBER o_colon_minutes
+      {
+        pc->zones_seen++;
+        if (! time_zone_hhmm (pc, $1, $2)) YYABORT;
+      }
+  ;
+
+/* Local zone strings affect only the DST setting, and take effect
+   only if the current TZ setting is relevant.
+
+   Example 1:
+   'EEST' is parsed as tLOCAL_ZONE, as it relates to the effective TZ:
+        TZ='Europe/Helsinki' date -d '2016-06-30 EEST'
+
+   Example 2:
+   'EEST' is parsed as tDAYZONE:
+        TZ='Asia/Tokyo' date -d '2016-06-30 EEST'
+
+   This is implemented by probing the next three calendar quarters
+   of the effective timezone and looking for DST changes -
+   if found, the timezone name (EEST) is inserted into
+   the lexical lookup table with type tLOCAL_ZONE.
+   (Search for 'quarter' comment in  'parse_datetime2'.)
+*/
+local_zone:
+    tLOCAL_ZONE
+      { pc->local_isdst = $1; }
+  | tLOCAL_ZONE tDST
+      {
+        pc->local_isdst = 1;
+        pc->dsts_seen++;
+      }
+  ;
+
+/* Note 'T' is a special case, as it is used as the separator in ISO
+   8601 date and time of day representation.  */
+zone:
+    tZONE
+      { pc->time_zone = $1; }
+  | 'T'
+      { pc->time_zone = -HOUR (7); }
+  | tZONE relunit_snumber
+      { pc->time_zone = $1;
+        if (! apply_relative_time (pc, $2, 1)) YYABORT;
+        debug_print_relative_time (_("relative"), pc);
+      }
+  | 'T' relunit_snumber
+      { pc->time_zone = -HOUR (7);
+        if (! apply_relative_time (pc, $2, 1)) YYABORT;
+        debug_print_relative_time (_("relative"), pc);
+      }
+  | tZONE tSNUMBER o_colon_minutes
+      { if (! time_zone_hhmm (pc, $2, $3)) YYABORT;
+        if (ckd_add (&pc->time_zone, pc->time_zone, $1)) YYABORT; }
+  | tDAYZONE
+      { pc->time_zone = $1 + 60 * 60; }
+  | tZONE tDST
+      { pc->time_zone = $1 + 60 * 60; }
+  ;
+
+day:
+    tDAY
+      {
+        pc->day_ordinal = 0;
+        pc->day_number = $1;
+      }
+  | tDAY ','
+      {
+        pc->day_ordinal = 0;
+        pc->day_number = $1;
+      }
+  | tORDINAL tDAY
+      {
+        pc->day_ordinal = $1;
+        pc->day_number = $2;
+        pc->debug_ordinal_day_seen = true;
+      }
+  | tUNUMBER tDAY
+      {
+        pc->day_ordinal = $1.value;
+        pc->day_number = $2;
+        pc->debug_ordinal_day_seen = true;
+      }
+  ;
+
+date:
+    tUNUMBER '/' tUNUMBER
+      {
+        pc->month = $1.value;
+        pc->day = $3.value;
+      }
+  | tUNUMBER '/' tUNUMBER '/' tUNUMBER
+      {
+        /* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
+           otherwise as MM/DD/YY.
+           The goal in recognizing YYYY/MM/DD is solely to support legacy
+           machine-generated dates like those in an RCS log listing.  If
+           you want portability, use the ISO 8601 format.  */
+        if (4 <= $1.digits)
+          {
+            if (debugging (pc))
+              {
+                intmax_t digits = $1.digits;
+                dbg_printf (_("warning: value %"PRIdMAX" has %"PRIdMAX" digits. "
+                              "Assuming YYYY/MM/DD\n"),
+                            $1.value, digits);
+              }
+
+            pc->year = $1;
+            pc->month = $3.value;
+            pc->day = $5.value;
+          }
+        else
+          {
+            if (debugging (pc))
+              dbg_printf (_("warning: value %"PRIdMAX" has less than 4 digits. "
+                            "Assuming MM/DD/YY[YY]\n"),
+                          $1.value);
+
+            pc->month = $1.value;
+            pc->day = $3.value;
+            pc->year = $5;
+          }
+      }
+  | tUNUMBER tMONTH tSNUMBER
+      {
+        /* E.g., 17-JUN-1992.  */
+        pc->day = $1.value;
+        pc->month = $2;
+        if (ckd_sub (&pc->year.value, 0, $3.value)) YYABORT;
+        pc->year.digits = $3.digits;
+      }
+  | tMONTH tSNUMBER tSNUMBER
+      {
+        /* E.g., JUN-17-1992.  */
+        pc->month = $1;
+        if (ckd_sub (&pc->day, 0, $2.value)) YYABORT;
+        if (ckd_sub (&pc->year.value, 0, $3.value)) YYABORT;
+        pc->year.digits = $3.digits;
+      }
+  | tMONTH tUNUMBER
+      {
+        pc->month = $1;
+        pc->day = $2.value;
+      }
+  | tMONTH tUNUMBER ',' tUNUMBER
+      {
+        pc->month = $1;
+        pc->day = $2.value;
+        pc->year = $4;
+      }
+  | tUNUMBER tMONTH
+      {
+        pc->day = $1.value;
+        pc->month = $2;
+      }
+  | tUNUMBER tMONTH tUNUMBER
+      {
+        pc->day = $1.value;
+        pc->month = $2;
+        pc->year = $3;
+      }
+  | iso_8601_date
+  ;
+
+iso_8601_date:
+    tUNUMBER tSNUMBER tSNUMBER
+      {
+        /* ISO 8601 format.  YYYY-MM-DD.  */
+        pc->year = $1;
+        if (ckd_sub (&pc->month, 0, $2.value)) YYABORT;
+        if (ckd_sub (&pc->day, 0, $3.value)) YYABORT;
+      }
+  ;
+
+rel:
+    relunit tAGO
+      { if (! apply_relative_time (pc, $1, $2)) YYABORT; }
+  | relunit
+      { if (! apply_relative_time (pc, $1, 1)) YYABORT; }
+  | dayshift
+      { if (! apply_relative_time (pc, $1, 1)) YYABORT; }
+  ;
+
+relunit:
+    tORDINAL tYEAR_UNIT
+      { $$ = RELATIVE_TIME_0; $$.year = $1; }
+  | tUNUMBER tYEAR_UNIT
+      { $$ = RELATIVE_TIME_0; $$.year = $1.value; }
+  | tYEAR_UNIT
+      { $$ = RELATIVE_TIME_0; $$.year = 1; }
+  | tORDINAL tMONTH_UNIT
+      { $$ = RELATIVE_TIME_0; $$.month = $1; }
+  | tUNUMBER tMONTH_UNIT
+      { $$ = RELATIVE_TIME_0; $$.month = $1.value; }
+  | tMONTH_UNIT
+      { $$ = RELATIVE_TIME_0; $$.month = 1; }
+  | tORDINAL tDAY_UNIT
+      { $$ = RELATIVE_TIME_0;
+        if (ckd_mul (&$$.day, $1, $2)) YYABORT; }
+  | tUNUMBER tDAY_UNIT
+      { $$ = RELATIVE_TIME_0;
+        if (ckd_mul (&$$.day, $1.value, $2)) YYABORT; }
+  | tDAY_UNIT
+      { $$ = RELATIVE_TIME_0; $$.day = $1; }
+  | tORDINAL tHOUR_UNIT
+      { $$ = RELATIVE_TIME_0; $$.hour = $1; }
+  | tUNUMBER tHOUR_UNIT
+      { $$ = RELATIVE_TIME_0; $$.hour = $1.value; }
+  | tHOUR_UNIT
+      { $$ = RELATIVE_TIME_0; $$.hour = 1; }
+  | tORDINAL tMINUTE_UNIT
+      { $$ = RELATIVE_TIME_0; $$.minutes = $1; }
+  | tUNUMBER tMINUTE_UNIT
+      { $$ = RELATIVE_TIME_0; $$.minutes = $1.value; }
+  | tMINUTE_UNIT
+      { $$ = RELATIVE_TIME_0; $$.minutes = 1; }
+  | tORDINAL tSEC_UNIT
+      { $$ = RELATIVE_TIME_0; $$.seconds = $1; }
+  | tUNUMBER tSEC_UNIT
+      { $$ = RELATIVE_TIME_0; $$.seconds = $1.value; }
+  | tSDECIMAL_NUMBER tSEC_UNIT
+      { $$ = RELATIVE_TIME_0; $$.seconds = $1.tv_sec; $$.ns = $1.tv_nsec; }
+  | tUDECIMAL_NUMBER tSEC_UNIT
+      { $$ = RELATIVE_TIME_0; $$.seconds = $1.tv_sec; $$.ns = $1.tv_nsec; }
+  | tSEC_UNIT
+      { $$ = RELATIVE_TIME_0; $$.seconds = 1; }
+  | relunit_snumber
+  ;
+
+relunit_snumber:
+    tSNUMBER tYEAR_UNIT
+      { $$ = RELATIVE_TIME_0; $$.year = $1.value; }
+  | tSNUMBER tMONTH_UNIT
+      { $$ = RELATIVE_TIME_0; $$.month = $1.value; }
+  | tSNUMBER tDAY_UNIT
+      { $$ = RELATIVE_TIME_0;
+        if (ckd_mul (&$$.day, $1.value, $2)) YYABORT; }
+  | tSNUMBER tHOUR_UNIT
+      { $$ = RELATIVE_TIME_0; $$.hour = $1.value; }
+  | tSNUMBER tMINUTE_UNIT
+      { $$ = RELATIVE_TIME_0; $$.minutes = $1.value; }
+  | tSNUMBER tSEC_UNIT
+      { $$ = RELATIVE_TIME_0; $$.seconds = $1.value; }
+  ;
+
+dayshift:
+    tDAY_SHIFT
+      { $$ = RELATIVE_TIME_0; $$.day = $1; }
+  ;
+
+seconds: signed_seconds | unsigned_seconds;
+
+signed_seconds:
+    tSDECIMAL_NUMBER
+  | tSNUMBER
+      { if (time_overflow ($1.value)) YYABORT;
+        $$ = (struct timespec) { .tv_sec = $1.value }; }
+  ;
+
+unsigned_seconds:
+    tUDECIMAL_NUMBER
+  | tUNUMBER
+      { if (time_overflow ($1.value)) YYABORT;
+        $$ = (struct timespec) { .tv_sec = $1.value }; }
+  ;
+
+number:
+    tUNUMBER
+      { digits_to_date_time (pc, $1); }
+  ;
+
+hybrid:
+    tUNUMBER relunit_snumber
+      {
+        /* Hybrid all-digit and relative offset, so that we accept e.g.,
+           "YYYYMMDD +N days" as well as "YYYYMMDD N days".  */
+        digits_to_date_time (pc, $1);
+        if (! apply_relative_time (pc, $2, 1)) YYABORT;
+      }
+  ;
+
+o_colon_minutes:
+    /* empty */
+      { $$ = -1; }
+  | ':' tUNUMBER
+      { $$ = $2.value; }
+  ;
+
+%%
+
+static table const meridian_table[] =
+{
+  { "AM",   tMERIDIAN, MERam },
+  { "A.M.", tMERIDIAN, MERam },
+  { "PM",   tMERIDIAN, MERpm },
+  { "P.M.", tMERIDIAN, MERpm },
+  { NULL, 0, 0 }
+};
+
+static table const dst_table[] =
+{
+  { "DST", tDST, 0 }
+};
+
+static table const month_and_day_table[] =
+{
+  { "JANUARY",  tMONTH,  1 },
+  { "FEBRUARY", tMONTH,  2 },
+  { "MARCH",    tMONTH,  3 },
+  { "APRIL",    tMONTH,  4 },
+  { "MAY",      tMONTH,  5 },
+  { "JUNE",     tMONTH,  6 },
+  { "JULY",     tMONTH,  7 },
+  { "AUGUST",   tMONTH,  8 },
+  { "SEPTEMBER",tMONTH,  9 },
+  { "SEPT",     tMONTH,  9 },
+  { "OCTOBER",  tMONTH, 10 },
+  { "NOVEMBER", tMONTH, 11 },
+  { "DECEMBER", tMONTH, 12 },
+  { "SUNDAY",   tDAY,    0 },
+  { "MONDAY",   tDAY,    1 },
+  { "TUESDAY",  tDAY,    2 },
+  { "TUES",     tDAY,    2 },
+  { "WEDNESDAY",tDAY,    3 },
+  { "WEDNES",   tDAY,    3 },
+  { "THURSDAY", tDAY,    4 },
+  { "THUR",     tDAY,    4 },
+  { "THURS",    tDAY,    4 },
+  { "FRIDAY",   tDAY,    5 },
+  { "SATURDAY", tDAY,    6 },
+  { NULL, 0, 0 }
+};
+
+static table const time_units_table[] =
+{
+  { "YEAR",     tYEAR_UNIT,      1 },
+  { "MONTH",    tMONTH_UNIT,     1 },
+  { "FORTNIGHT",tDAY_UNIT,      14 },
+  { "WEEK",     tDAY_UNIT,       7 },
+  { "DAY",      tDAY_UNIT,       1 },
+  { "HOUR",     tHOUR_UNIT,      1 },
+  { "MINUTE",   tMINUTE_UNIT,    1 },
+  { "MIN",      tMINUTE_UNIT,    1 },
+  { "SECOND",   tSEC_UNIT,       1 },
+  { "SEC",      tSEC_UNIT,       1 },
+  { NULL, 0, 0 }
+};
+
+/* Assorted relative-time words.  */
+static table const relative_time_table[] =
+{
+  { "TOMORROW", tDAY_SHIFT,      1 },
+  { "YESTERDAY",tDAY_SHIFT,     -1 },
+  { "TODAY",    tDAY_SHIFT,      0 },
+  { "NOW",      tDAY_SHIFT,      0 },
+  { "LAST",     tORDINAL,       -1 },
+  { "THIS",     tORDINAL,        0 },
+  { "NEXT",     tORDINAL,        1 },
+  { "FIRST",    tORDINAL,        1 },
+/*{ "SECOND",   tORDINAL,        2 }, */
+  { "THIRD",    tORDINAL,        3 },
+  { "FOURTH",   tORDINAL,        4 },
+  { "FIFTH",    tORDINAL,        5 },
+  { "SIXTH",    tORDINAL,        6 },
+  { "SEVENTH",  tORDINAL,        7 },
+  { "EIGHTH",   tORDINAL,        8 },
+  { "NINTH",    tORDINAL,        9 },
+  { "TENTH",    tORDINAL,       10 },
+  { "ELEVENTH", tORDINAL,       11 },
+  { "TWELFTH",  tORDINAL,       12 },
+  { "AGO",      tAGO,           -1 },
+  { "HENCE",    tAGO,            1 },
+  { NULL, 0, 0 }
+};
+
+/* The universal time zone table.  These labels can be used even for
+   timestamps that would not otherwise be valid, e.g., GMT timestamps
+   oin London during summer.  */
+static table const universal_time_zone_table[] =
+{
+  { "GMT",      tZONE,     HOUR ( 0) }, /* Greenwich Mean */
+  { "UT",       tZONE,     HOUR ( 0) }, /* Universal (Coordinated) */
+  { "UTC",      tZONE,     HOUR ( 0) },
+  { NULL, 0, 0 }
+};
+
+/* The time zone table.  This table is necessarily incomplete, as time
+   zone abbreviations are ambiguous; e.g., Australians interpret "EST"
+   as Eastern time in Australia, not as US Eastern Standard Time.
+   You cannot rely on parse_datetime to handle arbitrary time zone
+   abbreviations; use numeric abbreviations like "-0500" instead.  */
+static table const time_zone_table[] =
+{
+  { "WET",      tZONE,     HOUR ( 0) }, /* Western European */
+  { "WEST",     tDAYZONE,  HOUR ( 0) }, /* Western European Summer */
+  { "BST",      tDAYZONE,  HOUR ( 0) }, /* British Summer */
+  { "ART",      tZONE,    -HOUR ( 3) }, /* Argentina */
+  { "BRT",      tZONE,    -HOUR ( 3) }, /* Brazil */
+  { "BRST",     tDAYZONE, -HOUR ( 3) }, /* Brazil Summer */
+  { "NST",      tZONE,   -(HOUR ( 3) + 30 * 60) }, /* Newfoundland Standard */
+  { "NDT",      tDAYZONE,-(HOUR ( 3) + 30 * 60) }, /* Newfoundland Daylight */
+  { "AST",      tZONE,    -HOUR ( 4) }, /* Atlantic Standard */
+  { "ADT",      tDAYZONE, -HOUR ( 4) }, /* Atlantic Daylight */
+  { "CLT",      tZONE,    -HOUR ( 4) }, /* Chile */
+  { "CLST",     tDAYZONE, -HOUR ( 4) }, /* Chile Summer */
+  { "EST",      tZONE,    -HOUR ( 5) }, /* Eastern Standard */
+  { "EDT",      tDAYZONE, -HOUR ( 5) }, /* Eastern Daylight */
+  { "CST",      tZONE,    -HOUR ( 6) }, /* Central Standard */
+  { "CDT",      tDAYZONE, -HOUR ( 6) }, /* Central Daylight */
+  { "MST",      tZONE,    -HOUR ( 7) }, /* Mountain Standard */
+  { "MDT",      tDAYZONE, -HOUR ( 7) }, /* Mountain Daylight */
+  { "PST",      tZONE,    -HOUR ( 8) }, /* Pacific Standard */
+  { "PDT",      tDAYZONE, -HOUR ( 8) }, /* Pacific Daylight */
+  { "AKST",     tZONE,    -HOUR ( 9) }, /* Alaska Standard */
+  { "AKDT",     tDAYZONE, -HOUR ( 9) }, /* Alaska Daylight */
+  { "HST",      tZONE,    -HOUR (10) }, /* Hawaii Standard */
+  { "HAST",     tZONE,    -HOUR (10) }, /* Hawaii-Aleutian Standard */
+  { "HADT",     tDAYZONE, -HOUR (10) }, /* Hawaii-Aleutian Daylight */
+  { "SST",      tZONE,    -HOUR (12) }, /* Samoa Standard */
+  { "WAT",      tZONE,     HOUR ( 1) }, /* West Africa */
+  { "CET",      tZONE,     HOUR ( 1) }, /* Central European */
+  { "CEST",     tDAYZONE,  HOUR ( 1) }, /* Central European Summer */
+  { "MET",      tZONE,     HOUR ( 1) }, /* Middle European */
+  { "MEZ",      tZONE,     HOUR ( 1) }, /* Middle European */
+  { "MEST",     tDAYZONE,  HOUR ( 1) }, /* Middle European Summer */
+  { "MESZ",     tDAYZONE,  HOUR ( 1) }, /* Middle European Summer */
+  { "EET",      tZONE,     HOUR ( 2) }, /* Eastern European */
+  { "EEST",     tDAYZONE,  HOUR ( 2) }, /* Eastern European Summer */
+  { "CAT",      tZONE,     HOUR ( 2) }, /* Central Africa */
+  { "SAST",     tZONE,     HOUR ( 2) }, /* South Africa Standard */
+  { "EAT",      tZONE,     HOUR ( 3) }, /* East Africa */
+  { "MSK",      tZONE,     HOUR ( 3) }, /* Moscow */
+  { "MSD",      tDAYZONE,  HOUR ( 3) }, /* Moscow Daylight */
+  { "IST",      tZONE,    (HOUR ( 5) + 30 * 60) }, /* India Standard */
+  { "SGT",      tZONE,     HOUR ( 8) }, /* Singapore */
+  { "KST",      tZONE,     HOUR ( 9) }, /* Korea Standard */
+  { "JST",      tZONE,     HOUR ( 9) }, /* Japan Standard */
+  { "GST",      tZONE,     HOUR (10) }, /* Guam Standard */
+  { "NZST",     tZONE,     HOUR (12) }, /* New Zealand Standard */
+  { "NZDT",     tDAYZONE,  HOUR (12) }, /* New Zealand Daylight */
+  { NULL, 0, 0 }
+};
+
+/* Military time zone table.
+
+   RFC 822 got these backwards, but RFC 5322 makes the incorrect
+   treatment optional, so do them the right way here.
+
+   'J' is special, as it is local time.
+   'T' is also special, as it is the separator in ISO
+   8601 date and time of day representation.  */
+static table const military_table[] =
+{
+  { "A", tZONE,  HOUR ( 1) },
+  { "B", tZONE,  HOUR ( 2) },
+  { "C", tZONE,  HOUR ( 3) },
+  { "D", tZONE,  HOUR ( 4) },
+  { "E", tZONE,  HOUR ( 5) },
+  { "F", tZONE,  HOUR ( 6) },
+  { "G", tZONE,  HOUR ( 7) },
+  { "H", tZONE,  HOUR ( 8) },
+  { "I", tZONE,  HOUR ( 9) },
+  { "J", 'J',    0 },
+  { "K", tZONE,  HOUR (10) },
+  { "L", tZONE,  HOUR (11) },
+  { "M", tZONE,  HOUR (12) },
+  { "N", tZONE, -HOUR ( 1) },
+  { "O", tZONE, -HOUR ( 2) },
+  { "P", tZONE, -HOUR ( 3) },
+  { "Q", tZONE, -HOUR ( 4) },
+  { "R", tZONE, -HOUR ( 5) },
+  { "S", tZONE, -HOUR ( 6) },
+  { "T", 'T',    0 },
+  { "U", tZONE, -HOUR ( 8) },
+  { "V", tZONE, -HOUR ( 9) },
+  { "W", tZONE, -HOUR (10) },
+  { "X", tZONE, -HOUR (11) },
+  { "Y", tZONE, -HOUR (12) },
+  { "Z", tZONE,  HOUR ( 0) },
+  { NULL, 0, 0 }
+};
+
+\f
+
+/* Convert a time zone expressed as HH:MM into an integer count of
+   seconds.  If MM is negative, then S is of the form HHMM and needs
+   to be picked apart; otherwise, S is of the form HH.  As specified in
+   https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03, allow
+   only valid TZ range, and consider first two digits as hours, if no
+   minutes specified.  Return true if successful.  */
+
+static bool
+time_zone_hhmm (parser_control *pc, textint s, intmax_t mm)
+{
+  intmax_t n_minutes;
+  bool overflow = false;
+
+  /* If the length of S is 1 or 2 and no minutes are specified,
+     interpret it as a number of hours.  */
+  if (s.digits <= 2 && mm < 0)
+    s.value *= 100;
+
+  if (mm < 0)
+    n_minutes = (s.value / 100) * 60 + s.value % 100;
+  else
+    {
+      overflow |= ckd_mul (&n_minutes, s.value, 60);
+      overflow |= (s.negative
+                   ? ckd_sub (&n_minutes, n_minutes, mm)
+                   : ckd_add (&n_minutes, n_minutes, mm));
+    }
+
+  if (overflow || ! (-24 * 60 <= n_minutes && n_minutes <= 24 * 60))
+    return false;
+  pc->time_zone = n_minutes * 60;
+  return true;
+}
+
+static int
+to_hour (intmax_t hours, int meridian)
+{
+  switch (meridian)
+    {
+    default: /* Pacify GCC.  */
+    case MER24:
+      return 0 <= hours && hours < 24 ? hours : -1;
+    case MERam:
+      return 0 < hours && hours < 12 ? hours : hours == 12 ? 0 : -1;
+    case MERpm:
+      return 0 < hours && hours < 12 ? hours + 12 : hours == 12 ? 12 : -1;
+    }
+}
+
+enum { TM_YEAR_BASE = 1900 };
+enum { TM_YEAR_BUFSIZE = INT_BUFSIZE_BOUND (int) + 1 };
+
+/* Convert TM_YEAR, a year minus 1900, to a string that is numerically
+   correct even if subtracting 1900 would overflow.  */
+
+static char const *
+tm_year_str (int tm_year, char buf[TM_YEAR_BUFSIZE])
+{
+  static_assert (TM_YEAR_BASE % 100 == 0);
+  sprintf (buf, &"-%02d%02d"[-TM_YEAR_BASE <= tm_year],
+           abs (tm_year / 100 + TM_YEAR_BASE / 100),
+           abs (tm_year % 100));
+  return buf;
+}
+
+/* Convert a text year number to a year minus 1900, working correctly
+   even if the input is in the range INT_MAX .. INT_MAX + 1900 - 1.  */
+
+static bool
+to_tm_year (textint textyear, bool debug, int *tm_year)
+{
+  intmax_t year = textyear.value;
+
+  /* XPG4 suggests that years 00-68 map to 2000-2068, and
+     years 69-99 map to 1969-1999.  */
+  if (0 <= year && textyear.digits == 2)
+    {
+      year += year < 69 ? 2000 : 1900;
+      if (debug)
+        dbg_printf (_("warning: adjusting year value %"PRIdMAX
+                      " to %"PRIdMAX"\n"),
+                    textyear.value, year);
+    }
+
+  if (year < 0
+      ? ckd_sub (tm_year, -TM_YEAR_BASE, year)
+      : ckd_sub (tm_year, year, TM_YEAR_BASE))
+    {
+      if (debug)
+        dbg_printf (_("error: out-of-range year %"PRIdMAX"\n"), year);
+      return false;
+    }
+
+  return true;
+}
+
+static table const * _GL_ATTRIBUTE_PURE
+lookup_zone (parser_control const *pc, char const *name)
+{
+  table const *tp;
+
+  for (tp = universal_time_zone_table; tp->name; tp++)
+    if (strcmp (name, tp->name) == 0)
+      return tp;
+
+  /* Try local zone abbreviations before those in time_zone_table, as
+     the local ones are more likely to be right.  */
+  for (tp = pc->local_time_zone_table; tp->name; tp++)
+    if (strcmp (name, tp->name) == 0)
+      return tp;
+
+  for (tp = time_zone_table; tp->name; tp++)
+    if (strcmp (name, tp->name) == 0)
+      return tp;
+
+  return NULL;
+}
+
+#if ! HAVE_TM_GMTOFF
+/* Yield the difference between *A and *B,
+   measured in seconds, ignoring leap seconds.
+   The body of this function is taken directly from the GNU C Library;
+   see strftime.c.  */
+static int
+tm_diff (const struct tm *a, const struct tm *b)
+{
+  /* Compute intervening leap days correctly even if year is negative.
+     Take care to avoid int overflow in leap day calculations,
+     but it's OK to assume that A and B are close to each other.  */
+  int a4 = SHR (a->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (a->tm_year & 3);
+  int b4 = SHR (b->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (b->tm_year & 3);
+  int a100 = a4 / 25 - (a4 % 25 < 0);
+  int b100 = b4 / 25 - (b4 % 25 < 0);
+  int a400 = SHR (a100, 2);
+  int b400 = SHR (b100, 2);
+  int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
+  int years = a->tm_year - b->tm_year;
+  int days = (365 * years + intervening_leap_days
+              + (a->tm_yday - b->tm_yday));
+  return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+                + (a->tm_min - b->tm_min))
+          + (a->tm_sec - b->tm_sec));
+}
+#endif /* ! HAVE_TM_GMTOFF */
+
+static table const *
+lookup_word (parser_control const *pc, char *word)
+{
+  char *p;
+  char *q;
+  idx_t wordlen;
+  table const *tp;
+  bool period_found;
+  bool abbrev;
+
+  /* Make it uppercase.  */
+  for (p = word; *p; p++)
+    *p = c_toupper (to_uchar (*p));
+
+  for (tp = meridian_table; tp->name; tp++)
+    if (strcmp (word, tp->name) == 0)
+      return tp;
+
+  /* See if we have an abbreviation for a month.  */
+  wordlen = strlen (word);
+  abbrev = wordlen == 3 || (wordlen == 4 && word[3] == '.');
+
+  for (tp = month_and_day_table; tp->name; tp++)
+    if ((abbrev ? strncmp (word, tp->name, 3) : strcmp (word, tp->name)) == 0)
+      return tp;
+
+  if ((tp = lookup_zone (pc, word)))
+    return tp;
+
+  if (strcmp (word, dst_table[0].name) == 0)
+    return dst_table;
+
+  for (tp = time_units_table; tp->name; tp++)
+    if (strcmp (word, tp->name) == 0)
+      return tp;
+
+  /* Strip off any plural and try the units table again.  */
+  if (word[wordlen - 1] == 'S')
+    {
+      word[wordlen - 1] = '\0';
+      for (tp = time_units_table; tp->name; tp++)
+        if (strcmp (word, tp->name) == 0)
+          return tp;
+      word[wordlen - 1] = 'S';  /* For "this" in relative_time_table.  */
+    }
+
+  for (tp = relative_time_table; tp->name; tp++)
+    if (strcmp (word, tp->name) == 0)
+      return tp;
+
+  /* Military time zones.  */
+  if (wordlen == 1)
+    for (tp = military_table; tp->name; tp++)
+      if (word[0] == tp->name[0])
+        return tp;
+
+  /* Drop out any periods and try the time zone table again.  */
+  for (period_found = false, p = q = word; (*p = *q); q++)
+    if (*q == '.')
+      period_found = true;
+    else
+      p++;
+  if (period_found && (tp = lookup_zone (pc, word)))
+    return tp;
+
+  return NULL;
+}
+
+static int
+yylex (union YYSTYPE *lvalp, parser_control *pc)
+{
+  unsigned char c;
+
+  for (;;)
+    {
+      while (c = *pc->input, c_isspace (c))
+        pc->input++;
+
+      if (c_isdigit (c) || c == '-' || c == '+')
+        {
+          char const *p = pc->input;
+          int sign;
+          if (c == '-' || c == '+')
+            {
+              sign = c == '-' ? -1 : 1;
+              while (c = *(pc->input = ++p), c_isspace (c))
+                continue;
+              if (! c_isdigit (c))
+                /* skip the '-' sign */
+                continue;
+            }
+          else
+            sign = 0;
+
+          time_t value = 0;
+          do
+            {
+              if (ckd_mul (&value, value, 10))
+                return '?';
+              if (ckd_add (&value, value, sign < 0 ? '0' - c : c - '0'))
+                return '?';
+              c = *++p;
+            }
+          while (c_isdigit (c));
+
+          if ((c == '.' || c == ',') && c_isdigit (p[1]))
+            {
+              time_t s = value;
+              int digits;
+
+              /* Accumulate fraction, to ns precision.  */
+              p++;
+              int ns = *p++ - '0';
+              for (digits = 2; digits <= LOG10_BILLION; digits++)
+                {
+                  ns *= 10;
+                  if (c_isdigit (*p))
+                    ns += *p++ - '0';
+                }
+
+              /* Skip excess digits, truncating toward -Infinity.  */
+              if (sign < 0)
+                for (; c_isdigit (*p); p++)
+                  if (*p != '0')
+                    {
+                      ns++;
+                      break;
+                    }
+              while (c_isdigit (*p))
+                p++;
+
+              /* Adjust to the timespec convention, which is that
+                 tv_nsec is always a positive offset even if tv_sec is
+                 negative.  */
+              if (sign < 0 && ns)
+                {
+                  if (ckd_sub (&s, s, 1))
+                    return '?';
+                  ns = BILLION - ns;
+                }
+
+              lvalp->timespec = (struct timespec) { .tv_sec = s,
+                                                    .tv_nsec = ns };
+              pc->input = p;
+              return sign ? tSDECIMAL_NUMBER : tUDECIMAL_NUMBER;
+            }
+          else
+            {
+              lvalp->textintval.negative = sign < 0;
+              lvalp->textintval.value = value;
+              lvalp->textintval.digits = p - pc->input;
+              pc->input = p;
+              return sign ? tSNUMBER : tUNUMBER;
+            }
+        }
+
+      if (c_isalpha (c))
+        {
+          char buff[20];
+          char *p = buff;
+          table const *tp;
+
+          do
+            {
+              if (p < buff + sizeof buff - 1)
+                *p++ = c;
+              c = *++pc->input;
+            }
+          while (c_isalpha (c) || c == '.');
+
+          *p = '\0';
+          tp = lookup_word (pc, buff);
+          if (! tp)
+            {
+              if (debugging (pc))
+                dbg_printf (_("error: unknown word '%s'\n"), buff);
+              return '?';
+            }
+          lvalp->intval = tp->value;
+          return tp->type;
+        }
+
+      if (c != '(')
+        return to_uchar (*pc->input++);
+
+      idx_t count = 0;
+      do
+        {
+          c = *pc->input++;
+          if (c == '\0')
+            return c;
+          if (c == '(')
+            count++;
+          else if (c == ')')
+            count--;
+        }
+      while (count != 0);
+    }
+}
+
+/* Do nothing if the parser reports an error.  */
+static int
+yyerror (_GL_UNUSED parser_control const *pc,
+         _GL_UNUSED char const *s)
+{
+  return 0;
+}
+
+/* If *TM0 is the old and *TM1 is the new value of a struct tm after
+   passing it to mktime_z, return true if it's OK.  It's not OK if
+   mktime failed or if *TM0 has out-of-range mainline members.
+   The caller should set TM1->tm_wday to -1 before calling mktime,
+   as a negative tm_wday is how mktime failure is inferred.  */
+
+static bool
+mktime_ok (struct tm const *tm0, struct tm const *tm1)
+{
+  if (tm1->tm_wday < 0)
+    return false;
+
+  return ! ((tm0->tm_sec ^ tm1->tm_sec)
+            | (tm0->tm_min ^ tm1->tm_min)
+            | (tm0->tm_hour ^ tm1->tm_hour)
+            | (tm0->tm_mday ^ tm1->tm_mday)
+            | (tm0->tm_mon ^ tm1->tm_mon)
+            | (tm0->tm_year ^ tm1->tm_year));
+}
+
+/* Debugging: format a 'struct tm' into a buffer, taking the parser's
+   timezone information into account (if pc != NULL).  */
+static char const *
+debug_strfdatetime (struct tm const *tm, parser_control const *pc,
+                    char *buf, int n)
+{
+  /* TODO:
+     1. find an optimal way to print date string in a clear and unambiguous
+        format.  Currently, always add '(Y-M-D)' prefix.
+        Consider '2016y01m10d'  or 'year(2016) month(01) day(10)'.
+
+        If the user needs debug printing, it means he/she already having
+        issues with the parsing - better to avoid formats that could
+        be mis-interpreted (e.g., just YYYY-MM-DD).
+
+     2. Can strftime be used instead?
+        depends if it is portable and can print invalid dates on all systems.
+
+     3. Print timezone information ?
+
+     4. Print DST information ?
+
+     5. Print nanosecond information ?
+
+     NOTE:
+     Printed date/time values might not be valid, e.g., '2016-02-31'
+     or '2016-19-2016' .  These are the values as parsed from the user
+     string, before validation.
+  */
+  int m = nstrftime (buf, n, "(Y-M-D) %Y-%m-%d %H:%M:%S", tm, 0, 0);
+
+  /* If parser_control information was provided (for timezone),
+     and there's enough space in the buffer, add timezone info.  */
+  if (pc && m < n && pc->zones_seen)
+    {
+      int tz = pc->time_zone;
+
+      /* Account for DST if tLOCAL_ZONE was seen.  */
+      if (pc->local_zones_seen && !pc->zones_seen && 0 < pc->local_isdst)
+        tz += 60 * 60;
+
+      char time_zone_buf[TIME_ZONE_BUFSIZE];
+      snprintf (&buf[m], n - m, " TZ=%s", time_zone_str (tz, time_zone_buf));
+    }
+  return buf;
+}
+
+static char const *
+debug_strfdate (struct tm const *tm, char *buf, int n)
+{
+  char tm_year_buf[TM_YEAR_BUFSIZE];
+  snprintf (buf, n, "(Y-M-D) %s-%02d-%02d",
+            tm_year_str (tm->tm_year, tm_year_buf),
+            tm->tm_mon + 1, tm->tm_mday);
+  return buf;
+}
+
+static char const *
+debug_strftime (struct tm const *tm, char *buf, int n)
+{
+  snprintf (buf, n, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
+  return buf;
+}
+
+/* If mktime_ok failed, display the failed time values,
+   and provide possible hints.  Example output:
+
+    date: error: invalid date/time value:
+    date:     user provided time: '(Y-M-D) 2006-04-02 02:45:00'
+    date:        normalized time: '(Y-M-D) 2006-04-02 03:45:00'
+    date:                                             __
+    date:      possible reasons:
+    date:        nonexistent due to daylight-saving time;
+    date:        numeric values overflow;
+    date:        missing timezone;
+ */
+static void
+debug_mktime_not_ok (struct tm const *tm0, struct tm const *tm1,
+                     parser_control const *pc, bool time_zone_seen)
+{
+  /* TODO: handle t == -1 (as in 'mktime_ok').  */
+  char tmp[DBGBUFSIZE];
+  int i;
+  const bool eq_sec   = (tm0->tm_sec  == tm1->tm_sec);
+  const bool eq_min   = (tm0->tm_min  == tm1->tm_min);
+  const bool eq_hour  = (tm0->tm_hour == tm1->tm_hour);
+  const bool eq_mday  = (tm0->tm_mday == tm1->tm_mday);
+  const bool eq_month = (tm0->tm_mon  == tm1->tm_mon);
+  const bool eq_year  = (tm0->tm_year == tm1->tm_year);
+
+  const bool dst_shift = eq_sec && eq_min && !eq_hour
+                         && eq_mday && eq_month && eq_year;
+
+  if (!debugging (pc))
+    return;
+
+  dbg_printf (_("error: invalid date/time value:\n"));
+  dbg_printf (_("    user provided time: '%s'\n"),
+              debug_strfdatetime (tm0, pc, tmp, sizeof tmp));
+  dbg_printf (_("       normalized time: '%s'\n"),
+              debug_strfdatetime (tm1, pc, tmp, sizeof tmp));
+  /* The format must be aligned with debug_strfdatetime and the two
+     DEBUG statements above.  This string is not translated.  */
+  i = snprintf (tmp, sizeof tmp,
+                "                                 %4s %2s %2s %2s %2s %2s",
+                eq_year ? "" : "----",
+                eq_month ? "" : "--",
+                eq_mday ? "" : "--",
+                eq_hour ? "" : "--",
+                eq_min ? "" : "--",
+                eq_sec ? "" : "--");
+  /* Trim trailing whitespace.  */
+  if (0 <= i)
+    {
+      if (sizeof tmp - 1 < i)
+        i = sizeof tmp - 1;
+      while (0 < i && tmp[i - 1] == ' ')
+        --i;
+      tmp[i] = '\0';
+    }
+  dbg_printf ("%s\n", tmp);
+
+  dbg_printf (_("     possible reasons:\n"));
+  if (dst_shift)
+    dbg_printf (_("       nonexistent due to daylight-saving time;\n"));
+  if (!eq_mday && !eq_month)
+    dbg_printf (_("       invalid day/month combination;\n"));
+  dbg_printf (_("       numeric values overflow;\n"));
+  dbg_printf ("       %s\n", (time_zone_seen ? _("incorrect timezone")
+                              : _("missing timezone")));
+}
+
+/* Parse a date/time string, storing the resulting time value into *RESULT.
+   The string itself is pointed to by P.  Return true if successful.
+   P can be an incomplete or relative time specification; if so, use
+   *NOW as the basis for the returned time.  Default to timezone
+   TZDEFAULT, which corresponds to tzalloc (TZSTRING).  */
+static bool
+parse_datetime_body (struct timespec *result, char const *p,
+                     struct timespec const *now, unsigned int flags,
+                     timezone_t tzdefault, char const *tzstring)
+{
+  struct tm tm;
+  struct tm tm0;
+  char time_zone_buf[TIME_ZONE_BUFSIZE];
+  char dbg_tm[DBGBUFSIZE];
+  bool ok = false;
+  char const *input_sentinel = p + strlen (p);
+  char *tz1alloc = NULL;
+
+  /* A reasonable upper bound for the size of ordinary TZ strings.
+     Use heap allocation if TZ's length exceeds this.  */
+  enum { TZBUFSIZE = 100 };
+  char tz1buf[TZBUFSIZE];
+
+  struct timespec gettime_buffer;
+  if (! now)
+    {
+      gettime (&gettime_buffer);
+      now = &gettime_buffer;
+    }
+
+  time_t Start = now->tv_sec;
+  int Start_ns = now->tv_nsec;
+
+  unsigned char c;
+  while (c = *p, c_isspace (c))
+    p++;
+
+  timezone_t tz = tzdefault;
+
+  /* Store a local copy prior to first "goto".  Without this, a prior use
+     below of RELATIVE_TIME_0 on the RHS might translate to an assignment-
+     to-temporary, which would trigger a -Wjump-misses-init warning.  */
+  const relative_time rel_time_0 = RELATIVE_TIME_0;
+
+  if (strncmp (p, "TZ=\"", 4) == 0)
+    {
+      char const *tzbase = p + 4;
+      idx_t tzsize = 1;
+      char const *s;
+
+      for (s = tzbase; *s; s++, tzsize++)
+        if (*s == '\\')
+          {
+            s++;
+            if (! (*s == '\\' || *s == '"'))
+              break;
+          }
+        else if (*s == '"')
+          {
+            timezone_t tz1;
+            char *tz1string = tz1buf;
+            char *z;
+            if (TZBUFSIZE < tzsize)
+              {
+                tz1alloc = malloc (tzsize);
+                if (!tz1alloc)
+                  goto fail;
+                tz1string = tz1alloc;
+              }
+            z = tz1string;
+            for (s = tzbase; *s != '"'; s++)
+              *z++ = *(s += *s == '\\');
+            *z = '\0';
+            tz1 = tzalloc (tz1string);
+            if (!tz1)
+              goto fail;
+            tz = tz1;
+            tzstring = tz1string;
+
+            p = s + 1;
+            while (c = *p, c_isspace (c))
+              p++;
+
+            break;
+          }
+    }
+
+  struct tm tmp;
+  if (! localtime_rz (tz, &now->tv_sec, &tmp))
+    goto fail;
+
+  /* As documented, be careful to treat the empty string just like
+     a date string of "0".  Without this, an empty string would be
+     declared invalid when parsed during a DST transition.  */
+  if (*p == '\0')
+    p = "0";
+
+  parser_control pc;
+  pc.input = p;
+#ifdef GNULIB_PARSE_DATETIME2
+  pc.parse_datetime_debug = (flags & PARSE_DATETIME_DEBUG) != 0;
+#endif
+  if (ckd_add (&pc.year.value, tmp.tm_year, TM_YEAR_BASE))
+    {
+      if (debugging (&pc))
+        dbg_printf (_("error: initial year out of range\n"));
+      goto fail;
+    }
+  pc.year.digits = 0;
+  pc.month = tmp.tm_mon + 1;
+  pc.day = tmp.tm_mday;
+  pc.hour = tmp.tm_hour;
+  pc.minutes = tmp.tm_min;
+  pc.seconds = (struct timespec) { .tv_sec = tmp.tm_sec, .tv_nsec = Start_ns };
+  tm.tm_isdst = tmp.tm_isdst;
+
+  pc.meridian = MER24;
+  pc.rel = rel_time_0;
+  pc.timespec_seen = false;
+  pc.rels_seen = false;
+  pc.dates_seen = 0;
+  pc.days_seen = 0;
+  pc.times_seen = 0;
+  pc.J_zones_seen = 0;
+  pc.local_zones_seen = 0;
+  pc.dsts_seen = 0;
+  pc.zones_seen = 0;
+  pc.year_seen = false;
+  pc.debug_dates_seen = false;
+  pc.debug_days_seen = false;
+  pc.debug_times_seen = false;
+  pc.debug_local_zones_seen = false;
+  pc.debug_zones_seen = false;
+  pc.debug_year_seen = false;
+  pc.debug_ordinal_day_seen = false;
+
+#if HAVE_STRUCT_TM_TM_ZONE
+  pc.local_time_zone_table[0].name = tmp.tm_zone;
+  pc.local_time_zone_table[0].type = tLOCAL_ZONE;
+  pc.local_time_zone_table[0].value = tmp.tm_isdst;
+  pc.local_time_zone_table[1].name = NULL;
+
+  /* Probe the names used in the next three calendar quarters, looking
+     for a tm_isdst different from the one we already have.  */
+  {
+    int quarter;
+    for (quarter = 1; quarter <= 3; quarter++)
+      {
+        time_t probe;
+        if (ckd_add (&probe, Start, quarter * (90 * 24 * 60 * 60)))
+          break;
+        struct tm probe_tm;
+        if (localtime_rz (tz, &probe, &probe_tm) && probe_tm.tm_zone
+            && probe_tm.tm_isdst != pc.local_time_zone_table[0].value)
+          {
+              {
+                pc.local_time_zone_table[1].name = probe_tm.tm_zone;
+                pc.local_time_zone_table[1].type = tLOCAL_ZONE;
+                pc.local_time_zone_table[1].value = probe_tm.tm_isdst;
+                pc.local_time_zone_table[2].name = NULL;
+              }
+            break;
+          }
+      }
+  }
+#else
+#if HAVE_TZNAME
+  {
+# if !HAVE_DECL_TZNAME
+    extern char *tzname[];
+# endif
+    int i;
+    for (i = 0; i < 2; i++)
+      {
+        pc.local_time_zone_table[i].name = tzname[i];
+        pc.local_time_zone_table[i].type = tLOCAL_ZONE;
+        pc.local_time_zone_table[i].value = i;
+      }
+    pc.local_time_zone_table[i].name = NULL;
+  }
+#else
+  pc.local_time_zone_table[0].name = NULL;
+#endif
+#endif
+
+  if (pc.local_time_zone_table[0].name && pc.local_time_zone_table[1].name
+      && ! strcmp (pc.local_time_zone_table[0].name,
+                   pc.local_time_zone_table[1].name))
+    {
+      /* This locale uses the same abbreviation for standard and
+         daylight times.  So if we see that abbreviation, we don't
+         know whether it's daylight time.  */
+      pc.local_time_zone_table[0].value = -1;
+      pc.local_time_zone_table[1].name = NULL;
+    }
+
+  if (yyparse (&pc) != 0)
+    {
+      if (debugging (&pc))
+        dbg_printf ((input_sentinel <= pc.input
+                     ? _("error: parsing failed\n")
+                     : _("error: parsing failed, stopped at '%s'\n")),
+                    pc.input);
+      goto fail;
+    }
+
+
+  /* Determine effective timezone source.  */
+
+  if (debugging (&pc))
+    {
+      dbg_printf (_("input timezone: "));
+
+      if (pc.timespec_seen)
+        fprintf (stderr, _("'@timespec' - always UTC"));
+      else if (pc.zones_seen)
+        fprintf (stderr, _("parsed date/time string"));
+      else if (tzstring)
+        {
+          if (tz != tzdefault)
+            fprintf (stderr, _("TZ=\"%s\" in date string"), tzstring);
+          else if (STREQ (tzstring, "UTC0"))
+            {
+              /* Special case: 'date -u' sets TZ="UTC0".  */
+              fprintf (stderr, _("TZ=\"UTC0\" environment value or -u"));
+            }
+          else
+            fprintf (stderr, _("TZ=\"%s\" environment value"), tzstring);
+        }
+      else
+        fprintf (stderr, _("system default"));
+
+      /* Account for DST changes if tLOCAL_ZONE was seen.
+         local timezone only changes DST and is relative to the
+         default timezone.*/
+      if (pc.local_zones_seen && !pc.zones_seen && 0 < pc.local_isdst)
+        fprintf (stderr, ", dst");
+
+      if (pc.zones_seen)
+        fprintf (stderr, " (%s)", time_zone_str (pc.time_zone, time_zone_buf));
+
+      fputc ('\n', stderr);
+    }
+
+  if (pc.timespec_seen)
+    *result = pc.seconds;
+  else
+    {
+      if (1 < (pc.times_seen | pc.dates_seen | pc.days_seen | pc.dsts_seen
+               | (pc.J_zones_seen + pc.local_zones_seen + pc.zones_seen)))
+        {
+          if (debugging (&pc))
+            {
+              if (pc.times_seen > 1)
+                dbg_printf ("error: seen multiple time parts\n");
+              if (pc.dates_seen > 1)
+                dbg_printf ("error: seen multiple date parts\n");
+              if (pc.days_seen > 1)
+                dbg_printf ("error: seen multiple days parts\n");
+              if (pc.dsts_seen > 1)
+                dbg_printf ("error: seen multiple daylight-saving parts\n");
+              if ((pc.J_zones_seen + pc.local_zones_seen + pc.zones_seen) > 1)
+                dbg_printf ("error: seen multiple time-zone parts\n");
+            }
+          goto fail;
+        }
+
+      if (! to_tm_year (pc.year, debugging (&pc), &tm.tm_year)
+          || ckd_add (&tm.tm_mon, pc.month, -1)
+          || ckd_add (&tm.tm_mday, pc.day, 0))
+        {
+          if (debugging (&pc))
+            dbg_printf (_("error: year, month, or day overflow\n"));
+          goto fail;
+        }
+      if (pc.times_seen || (pc.rels_seen && ! pc.dates_seen && ! pc.days_seen))
+        {
+          tm.tm_hour = to_hour (pc.hour, pc.meridian);
+          if (tm.tm_hour < 0)
+            {
+              char const *mrd = (pc.meridian == MERam ? "am"
+                                 : pc.meridian == MERpm ?"pm" : "");
+              if (debugging (&pc))
+                dbg_printf (_("error: invalid hour %"PRIdMAX"%s\n"),
+                            pc.hour, mrd);
+              goto fail;
+            }
+          tm.tm_min = pc.minutes;
+          tm.tm_sec = pc.seconds.tv_sec;
+          if (debugging (&pc))
+            dbg_printf ((pc.times_seen
+                         ? _("using specified time as starting value: '%s'\n")
+                         : _("using current time as starting value: '%s'\n")),
+                        debug_strftime (&tm, dbg_tm, sizeof dbg_tm));
+        }
+      else
+        {
+          tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+          pc.seconds.tv_nsec = 0;
+          if (debugging (&pc))
+            dbg_printf ("warning: using midnight as starting time: 00:00:00\n");
+        }
+
+      /* Let mktime deduce tm_isdst if we have an absolute timestamp.  */
+      if (pc.dates_seen | pc.days_seen | pc.times_seen)
+        tm.tm_isdst = -1;
+
+      /* But if the input explicitly specifies local time with or without
+         DST, give mktime that information.  */
+      if (pc.local_zones_seen)
+        tm.tm_isdst = pc.local_isdst;
+
+      tm0.tm_sec = tm.tm_sec;
+      tm0.tm_min = tm.tm_min;
+      tm0.tm_hour = tm.tm_hour;
+      tm0.tm_mday = tm.tm_mday;
+      tm0.tm_mon = tm.tm_mon;
+      tm0.tm_year = tm.tm_year;
+      tm0.tm_isdst = tm.tm_isdst;
+      tm.tm_wday = -1;
+
+      Start = mktime_z (tz, &tm);
+
+      if (! mktime_ok (&tm0, &tm))
+        {
+          bool repaired = false;
+          bool time_zone_seen = pc.zones_seen != 0;
+          if (time_zone_seen)
+            {
+              /* Guard against falsely reporting errors near the time_t
+                 boundaries when parsing times in other time zones.  For
+                 example, suppose the input string "1969-12-31 23:00:00 -0100",
+                 the current time zone is 8 hours ahead of UTC, and the min
+                 time_t value is 1970-01-01 00:00:00 UTC.  Then the min
+                 localtime value is 1970-01-01 08:00:00, and mktime will
+                 therefore fail on 1969-12-31 23:00:00.  To work around the
+                 problem, set the time zone to 1 hour behind UTC temporarily
+                 by setting TZ="XXX1:00" and try mktime again.  */
+
+              char tz2buf[sizeof "XXX" - 1 + TIME_ZONE_BUFSIZE];
+              tz2buf[0] = tz2buf[1] = tz2buf[2] = 'X';
+              time_zone_str (pc.time_zone, &tz2buf[3]);
+              timezone_t tz2 = tzalloc (tz2buf);
+              if (!tz2)
+                {
+                  if (debugging (&pc))
+                    dbg_printf (_("error: tzalloc (\"%s\") failed\n"), tz2buf);
+                  goto fail;
+                }
+              tm.tm_sec = tm0.tm_sec;
+              tm.tm_min = tm0.tm_min;
+              tm.tm_hour = tm0.tm_hour;
+              tm.tm_mday = tm0.tm_mday;
+              tm.tm_mon = tm0.tm_mon;
+              tm.tm_year = tm0.tm_year;
+              tm.tm_isdst = tm0.tm_isdst;
+              tm.tm_wday = -1;
+              Start = mktime_z (tz2, &tm);
+              repaired = mktime_ok (&tm0, &tm);
+              tzfree (tz2);
+            }
+
+          if (! repaired)
+            {
+              debug_mktime_not_ok (&tm0, &tm, &pc, time_zone_seen);
+              goto fail;
+            }
+        }
+
+      char dbg_ord[DBGBUFSIZE];
+
+      if (pc.days_seen && ! pc.dates_seen)
+        {
+          intmax_t dayincr;
+          tm.tm_yday = -1;
+          intmax_t day_ordinal = (pc.day_ordinal
+                                  - (0 < pc.day_ordinal
+                                     && tm.tm_wday != pc.day_number));
+          if (! (ckd_mul (&dayincr, day_ordinal, 7)
+                 || ckd_add (&dayincr, (pc.day_number - tm.tm_wday + 7) % 7,
+                             dayincr)
+                 || ckd_add (&tm.tm_mday, dayincr, tm.tm_mday)))
+            {
+              tm.tm_isdst = -1;
+              Start = mktime_z (tz, &tm);
+            }
+
+          if (tm.tm_yday < 0)
+            {
+              if (debugging (&pc))
+                dbg_printf (_("error: day '%s' "
+                              "(day ordinal=%"PRIdMAX" number=%d) "
+                              "resulted in an invalid date: '%s'\n"),
+                            str_days (&pc, dbg_ord, sizeof dbg_ord),
+                            pc.day_ordinal, pc.day_number,
+                            debug_strfdatetime (&tm, &pc, dbg_tm,
+                                                sizeof dbg_tm));
+              goto fail;
+            }
+
+          if (debugging (&pc))
+            dbg_printf (_("new start date: '%s' is '%s'\n"),
+                        str_days (&pc, dbg_ord, sizeof dbg_ord),
+                        debug_strfdatetime (&tm, &pc, dbg_tm, sizeof dbg_tm));
+
+        }
+
+      if (debugging (&pc))
+        {
+          if (!pc.dates_seen && !pc.days_seen)
+            dbg_printf (_("using current date as starting value: '%s'\n"),
+                        debug_strfdate (&tm, dbg_tm, sizeof dbg_tm));
+
+          if (pc.days_seen && pc.dates_seen)
+            dbg_printf (_("warning: day (%s) ignored when explicit dates "
+                          "are given\n"),
+                        str_days (&pc, dbg_ord, sizeof dbg_ord));
+
+          dbg_printf (_("starting date/time: '%s'\n"),
+                      debug_strfdatetime (&tm, &pc, dbg_tm, sizeof dbg_tm));
+        }
+
+      /* Add relative date.  */
+      if (pc.rel.year | pc.rel.month | pc.rel.day)
+        {
+          if (debugging (&pc))
+            {
+              if ((pc.rel.year != 0 || pc.rel.month != 0) && tm.tm_mday != 15)
+                dbg_printf (_("warning: when adding relative months/years, "
+                              "it is recommended to specify the 15th of the "
+                              "months\n"));
+
+              if (pc.rel.day != 0 && tm.tm_hour != 12)
+                dbg_printf (_("warning: when adding relative days, "
+                              "it is recommended to specify noon\n"));
+            }
+
+          int year, month, day;
+          if (ckd_add (&year, tm.tm_year, pc.rel.year)
+              || ckd_add (&month, tm.tm_mon, pc.rel.month)
+              || ckd_add (&day, tm.tm_mday, pc.rel.day))
+            {
+              if (debugging (&pc))
+                dbg_printf (_("error: %s:%d\n"), __FILE__, __LINE__);
+              goto fail;
+            }
+          tm.tm_year = year;
+          tm.tm_mon = month;
+          tm.tm_mday = day;
+          tm.tm_hour = tm0.tm_hour;
+          tm.tm_min = tm0.tm_min;
+          tm.tm_sec = tm0.tm_sec;
+          tm.tm_isdst = tm0.tm_isdst;
+          tm.tm_wday = -1;
+          Start = mktime_z (tz, &tm);
+          if (tm.tm_wday < 0)
+            {
+              if (debugging (&pc))
+                dbg_printf (_("error: adding relative date resulted "
+                              "in an invalid date: '%s'\n"),
+                            debug_strfdatetime (&tm, &pc, dbg_tm,
+                                                sizeof dbg_tm));
+              goto fail;
+            }
+
+          if (debugging (&pc))
+            {
+              dbg_printf (_("after date adjustment "
+                            "(%+"PRIdMAX" years, %+"PRIdMAX" months, "
+                            "%+"PRIdMAX" days),\n"),
+                          pc.rel.year, pc.rel.month, pc.rel.day);
+              dbg_printf (_("    new date/time = '%s'\n"),
+                          debug_strfdatetime (&tm, &pc, dbg_tm,
+                                              sizeof dbg_tm));
+
+              /* Warn about crossing DST due to time adjustment.
+                 Example: https://bugs.gnu.org/8357
+                 env TZ=Europe/Helsinki \
+                   date --debug \
+                        -d 'Mon Mar 28 00:36:07 2011 EEST 1 day ago'
+
+                 This case is different than DST changes due to time adjustment,
+                 i.e., "1 day ago" vs "24 hours ago" are calculated in different
+                 places.
+
+                 'tm0.tm_isdst' contains the DST of the input date,
+                 'tm.tm_isdst' is the normalized result after calling
+                 mktime (&tm).
+              */
+              if (tm0.tm_isdst != -1 && tm.tm_isdst != tm0.tm_isdst)
+                dbg_printf (_("warning: daylight saving time changed after "
+                              "date adjustment\n"));
+
+              /* Warn if the user did not ask to adjust days but mday changed,
+                 or
+                 user did not ask to adjust months/days but the month changed.
+
+                 Example for first case:
+                 2016-05-31 + 1 month => 2016-06-31 => 2016-07-01.
+                 User asked to adjust month, but the day changed from 31 to 01.
+
+                 Example for second case:
+                 2016-02-29 + 1 year => 2017-02-29 => 2017-03-01.
+                 User asked to adjust year, but the month changed from 02 to 03.
+              */
+              if (pc.rel.day == 0
+                  && (tm.tm_mday != day
+                      || (pc.rel.month == 0 && tm.tm_mon != month)))
+                {
+                  dbg_printf (_("warning: month/year adjustment resulted in "
+                                "shifted dates:\n"));
+                  char tm_year_buf[TM_YEAR_BUFSIZE];
+                  dbg_printf (_("     adjusted Y M D: %s %02d %02d\n"),
+                              tm_year_str (year, tm_year_buf), month + 1, day);
+                  dbg_printf (_("   normalized Y M D: %s %02d %02d\n"),
+                              tm_year_str (tm.tm_year, tm_year_buf),
+                              tm.tm_mon + 1, tm.tm_mday);
+                }
+            }
+
+        }
+
+      /* The only "output" of this if-block is an updated Start value,
+         so this block must follow others that clobber Start.  */
+      if (pc.zones_seen)
+        {
+          bool overflow = false;
+#ifdef HAVE_TM_GMTOFF
+          long int utcoff = tm.tm_gmtoff;
+#else
+          time_t t = Start;
+          struct tm gmt;
+          int utcoff = (gmtime_r (&t, &gmt)
+                        ? tm_diff (&tm, &gmt)
+                        : (overflow = true, 0));
+#endif
+          intmax_t delta;
+          overflow |= ckd_sub (&delta, pc.time_zone, utcoff);
+          time_t t1;
+          overflow |= ckd_sub (&t1, Start, delta);
+          if (overflow)
+            {
+              if (debugging (&pc))
+                dbg_printf (_("error: timezone %d caused time_t overflow\n"),
+                            pc.time_zone);
+              goto fail;
+            }
+          Start = t1;
+        }
+
+      if (debugging (&pc))
+        {
+          intmax_t Starti = Start;
+          dbg_printf (_("'%s' = %"PRIdMAX" epoch-seconds\n"),
+                      debug_strfdatetime (&tm, &pc, dbg_tm, sizeof dbg_tm),
+                      Starti);
+        }
+
+
+      /* Add relative hours, minutes, and seconds.  On hosts that support
+         leap seconds, ignore the possibility of leap seconds; e.g.,
+         "+ 10 minutes" adds 600 seconds, even if one of them is a
+         leap second.  Typically this is not what the user wants, but it's
+         too hard to do it the other way, because the time zone indicator
+         must be applied before relative times, and if mktime is applied
+         again the time zone will be lost.  */
+      {
+        intmax_t orig_ns = pc.seconds.tv_nsec;
+        intmax_t sum_ns = orig_ns + pc.rel.ns;
+        int normalized_ns = (sum_ns % BILLION + BILLION) % BILLION;
+        int d4 = (sum_ns - normalized_ns) / BILLION;
+        intmax_t d1, t1, d2, t2, t3;
+        time_t t4;
+        if (ckd_mul (&d1, pc.rel.hour, 60 * 60)
+            || ckd_add (&t1, Start, d1)
+            || ckd_mul (&d2, pc.rel.minutes, 60)
+            || ckd_add (&t2, t1, d2)
+            || ckd_add (&t3, t2, pc.rel.seconds)
+            || ckd_add (&t4, t3, d4))
+          {
+            if (debugging (&pc))
+              dbg_printf (_("error: adding relative time caused an "
+                            "overflow\n"));
+            goto fail;
+          }
+
+        result->tv_sec = t4;
+        result->tv_nsec = normalized_ns;
+
+        if (debugging (&pc)
+            && (pc.rel.hour | pc.rel.minutes | pc.rel.seconds | pc.rel.ns))
+          {
+            dbg_printf (_("after time adjustment (%+"PRIdMAX" hours, "
+                          "%+"PRIdMAX" minutes, "
+                          "%+"PRIdMAX" seconds, %+d ns),\n"),
+                        pc.rel.hour, pc.rel.minutes, pc.rel.seconds,
+                        pc.rel.ns);
+            intmax_t t4i = t4;
+            dbg_printf (_("    new time = %"PRIdMAX" epoch-seconds\n"), t4i);
+
+            /* Warn about crossing DST due to time adjustment.
+               Example: https://bugs.gnu.org/8357
+               env TZ=Europe/Helsinki           \
+               date --debug                                             \
+               -d 'Mon Mar 28 00:36:07 2011 EEST 24 hours ago'
+
+               This case is different than DST changes due to days adjustment,
+               i.e., "1 day ago" vs "24 hours ago" are calculated in different
+               places.
+
+               'tm.tm_isdst' contains the date after date adjustment.  */
+            struct tm lmt;
+            if (tm.tm_isdst != -1 && localtime_rz (tz, &result->tv_sec, &lmt)
+                && tm.tm_isdst != lmt.tm_isdst)
+              dbg_printf (_("warning: daylight saving time changed after "
+                            "time adjustment\n"));
+          }
+      }
+    }
+
+  if (debugging (&pc))
+    {
+      /* Special case: using 'date -u' simply set TZ=UTC0 */
+      if (! tzstring)
+        dbg_printf (_("timezone: system default\n"));
+      else if (STREQ (tzstring, "UTC0"))
+        dbg_printf (_("timezone: Universal Time\n"));
+      else
+        dbg_printf (_("timezone: TZ=\"%s\" environment value\n"), tzstring);
+
+      intmax_t sec = result->tv_sec;
+      int nsec = result->tv_nsec;
+      dbg_printf (_("final: %"PRIdMAX".%09d (epoch-seconds)\n"),
+                  sec, nsec);
+
+      struct tm gmt, lmt;
+      bool got_utc = !!gmtime_r (&result->tv_sec, &gmt);
+      if (got_utc)
+        dbg_printf (_("final: %s (UTC)\n"),
+                    debug_strfdatetime (&gmt, NULL,
+                                        dbg_tm, sizeof dbg_tm));
+      if (localtime_rz (tz, &result->tv_sec, &lmt))
+        {
+#ifdef HAVE_TM_GMTOFF
+          bool got_utcoff = true;
+          long int utcoff = lmt.tm_gmtoff;
+#else
+          bool got_utcoff = got_utc;
+          int utcoff;
+          if (got_utcoff)
+            utcoff = tm_diff (&lmt, &gmt);
+#endif
+          if (got_utcoff)
+            dbg_printf (_("final: %s (UTC%s)\n"),
+                        debug_strfdatetime (&lmt, NULL, dbg_tm, sizeof dbg_tm),
+                        time_zone_str (utcoff, time_zone_buf));
+          else
+            dbg_printf (_("final: %s (unknown time zone offset)\n"),
+                        debug_strfdatetime (&lmt, NULL, dbg_tm, sizeof dbg_tm));
+        }
+    }
+
+  ok = true;
+
+ fail:
+  if (tz != tzdefault)
+    tzfree (tz);
+  free (tz1alloc);
+  return ok;
+}
+
+#ifdef GNULIB_PARSE_DATETIME2
+/* Parse a date/time string, storing the resulting time value into *RESULT.
+   The string itself is pointed to by P.  Return true if successful.
+   P can be an incomplete or relative time specification; if so, use
+   *NOW as the basis for the returned time.  Default to timezone
+   TZDEFAULT, which corresponds to tzalloc (TZSTRING).  */
+bool
+parse_datetime2 (struct timespec *result, char const *p,
+                 struct timespec const *now, unsigned int flags,
+                 timezone_t tzdefault, char const *tzstring)
+{
+  return parse_datetime_body (result, p, now, flags, tzdefault, tzstring);
+}
+#endif
+
+
+/* The plain interface: run with debug=false and the default timezone.   */
+bool
+parse_datetime (struct timespec *result, char const *p,
+                struct timespec const *now)
+{
+  char const *tzstring = getenv ("TZ");
+  timezone_t tz = tzalloc (tzstring);
+  if (!tz)
+    return false;
+  bool ok = parse_datetime_body (result, p, now, 0, tz, tzstring);
+  tzfree (tz);
+  return ok;
+}
+
+#if TEST
+
+int
+main (int ac, char **av)
+{
+  char buff[BUFSIZ];
+
+  printf ("Enter date, or blank line to exit.\n\t> ");
+  fflush (stdout);
+
+  buff[BUFSIZ - 1] = '\0';
+  while (fgets (buff, BUFSIZ - 1, stdin) && buff[0])
+    {
+      struct timespec d;
+      struct tm const *tm;
+      if (! parse_datetime (&d, buff, NULL))
+        printf ("Bad format - couldn't convert.\n");
+      else if (! (tm = localtime (&d.tv_sec)))
+        {
+          intmax_t sec = d.tv_sec;
+          printf ("localtime (%"PRIdMAX") failed\n", sec);
+        }
+      else
+        {
+          int ns = d.tv_nsec;
+          char tm_year_buf[TM_YEAR_BUFSIZE];
+          printf ("%s-%02d-%02d %02d:%02d:%02d.%09d\n",
+                  tm_year_str (tm->tm_year, tm_year_buf),
+                  tm->tm_mon + 1, tm->tm_mday,
+                  tm->tm_hour, tm->tm_min, tm->tm_sec, ns);
+        }
+      printf ("\t> ");
+      fflush (stdout);
+    }
+  return 0;
+}
+#endif /* TEST */
deleted file mode 120000 (symlink)
index f89f0449545159952af1047fc8d635c462802726..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pathmax.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d6512c6f5704fb642a4ee991eebf5c98837d0e43
--- /dev/null
@@ -0,0 +1,88 @@
+/* Define PATH_MAX somehow.  Requires sys/types.h.
+   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _PATHMAX_H
+# define _PATHMAX_H
+
+/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename,
+   including the terminating NUL byte.
+   <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html>
+   PATH_MAX is not defined on systems which have no limit on filename length,
+   such as GNU/Hurd.
+
+   This file does *not* define PATH_MAX always.  Programs that use this file
+   can handle the GNU/Hurd case in several ways:
+     - Either with a package-wide handling, or with a per-file handling,
+     - Either through a
+         #ifdef PATH_MAX
+       or through a fallback like
+         #ifndef PATH_MAX
+         # define PATH_MAX 8192
+         #endif
+       or through a fallback like
+         #ifndef PATH_MAX
+         # define PATH_MAX pathconf ("/", _PC_PATH_MAX)
+         #endif
+ */
+
+/* This file uses HAVE_SYS_PARAM_H.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <unistd.h>
+
+# include <limits.h>
+
+# ifndef _POSIX_PATH_MAX
+#  define _POSIX_PATH_MAX 256
+# endif
+
+/* Don't include sys/param.h if it already has been.  */
+# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
+#  include <sys/param.h>
+# endif
+
+# if !defined PATH_MAX && defined MAXPATHLEN
+#  define PATH_MAX MAXPATHLEN
+# endif
+
+# ifdef __hpux
+/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename,
+   *not* including the terminating NUL byte, and is set to 1023.
+   Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is
+   not defined at all any more.  */
+#  undef PATH_MAX
+#  define PATH_MAX 1024
+# endif
+
+# if defined _WIN32 && ! defined __CYGWIN__
+/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com,
+   section "Maximum Path Length Limitation",
+   <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation>
+   explains that the maximum size of a filename, including the terminating
+   NUL byte, is 260 = 3 + 256 + 1.
+   This is the same value as
+     - FILENAME_MAX in <stdio.h>,
+     - _MAX_PATH in <stdlib.h>,
+     - MAX_PATH in <windef.h>.
+   Undefine the original value, because mingw's <limits.h> gets it wrong.  */
+#  undef PATH_MAX
+#  define PATH_MAX 260
+# endif
+
+#endif /* _PATHMAX_H */
deleted file mode 120000 (symlink)
index 53cf859a6403c70a051e91d892a33c9256689b03..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/physmem.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e6eb26b5f333f2ea376b2ee7d773950aae9d0284
--- /dev/null
@@ -0,0 +1,334 @@
+/* Calculate the size of physical memory.
+
+   Copyright (C) 2000-2001, 2003, 2005-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "physmem.h"
+
+#include <unistd.h>
+
+#if HAVE_SYS_PSTAT_H
+# include <sys/pstat.h>
+#endif
+
+#if HAVE_SYS_SYSMP_H
+# include <sys/sysmp.h>
+#endif
+
+#if HAVE_SYS_SYSINFO_H
+# include <sys/sysinfo.h>
+#endif
+
+#if HAVE_MACHINE_HAL_SYSINFO_H
+# include <machine/hal_sysinfo.h>
+#endif
+
+#if HAVE_SYS_TABLE_H
+# include <sys/table.h>
+#endif
+
+#include <sys/types.h>
+
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+#if HAVE_SYS_SYSCTL_H && !(defined __GLIBC__ && defined __linux__)
+# include <sys/sysctl.h>
+#endif
+
+#if HAVE_SYS_SYSTEMCFG_H
+# include <sys/systemcfg.h>
+#endif
+
+#ifdef _WIN32
+
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+/* Don't assume that UNICODE is not defined.  */
+# undef GetModuleHandle
+# define GetModuleHandle GetModuleHandleA
+
+/* Avoid warnings from gcc -Wcast-function-type.  */
+# define GetProcAddress \
+   (void *) GetProcAddress
+
+/*  MEMORYSTATUSEX is missing from older windows headers, so define
+    a local replacement.  */
+typedef struct
+{
+  DWORD dwLength;
+  DWORD dwMemoryLoad;
+  DWORDLONG ullTotalPhys;
+  DWORDLONG ullAvailPhys;
+  DWORDLONG ullTotalPageFile;
+  DWORDLONG ullAvailPageFile;
+  DWORDLONG ullTotalVirtual;
+  DWORDLONG ullAvailVirtual;
+  DWORDLONG ullAvailExtendedVirtual;
+} lMEMORYSTATUSEX;
+typedef BOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
+
+#endif
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+/* Return the total amount of physical memory.  */
+double
+physmem_total (void)
+{
+#if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE
+  { /* This works on linux-gnu, kfreebsd-gnu, solaris2, and cygwin.  */
+    double pages = sysconf (_SC_PHYS_PAGES);
+    double pagesize = sysconf (_SC_PAGESIZE);
+    if (0 <= pages && 0 <= pagesize)
+      return pages * pagesize;
+  }
+#endif
+
+#if HAVE_SYSINFO && HAVE_STRUCT_SYSINFO_MEM_UNIT
+  { /* This works on linux.  */
+    struct sysinfo si;
+    if (sysinfo(&si) == 0)
+      return (double) si.totalram * si.mem_unit;
+  }
+#endif
+
+#if HAVE_PSTAT_GETSTATIC
+  { /* This works on hpux11.  */
+    struct pst_static pss;
+    if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0))
+      {
+        double pages = pss.physical_memory;
+        double pagesize = pss.page_size;
+        if (0 <= pages && 0 <= pagesize)
+          return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE
+  { /* This works on irix6. */
+    struct rminfo realmem;
+    if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0)
+      {
+        double pagesize = sysconf (_SC_PAGESIZE);
+        double pages = realmem.physmem;
+        if (0 <= pages && 0 <= pagesize)
+          return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_GETSYSINFO && defined GSI_PHYSMEM
+  { /* This works on Tru64 UNIX V4/5.  */
+    int physmem;
+
+    if (getsysinfo (GSI_PHYSMEM, (caddr_t) &physmem, sizeof (physmem),
+                    NULL, NULL, NULL) == 1)
+      {
+        double kbytes = physmem;
+
+        if (0 <= kbytes)
+          return kbytes * 1024.0;
+      }
+  }
+#endif
+
+#if HAVE_SYSCTL && !(defined __GLIBC__ && defined __linux__) && defined HW_PHYSMEM
+  { /* This works on *bsd, kfreebsd-gnu, and darwin.  */
+    unsigned int physmem;
+    size_t len = sizeof physmem;
+    static int mib[2] = { CTL_HW, HW_PHYSMEM };
+
+    if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0
+        && len == sizeof (physmem))
+      return (double) physmem;
+  }
+#endif
+
+#if HAVE__SYSTEM_CONFIGURATION
+  /* This works on AIX.  */
+  return _system_configuration.physmem;
+#endif
+
+#if defined _WIN32
+  { /* this works on windows */
+    PFN_MS_EX pfnex;
+    HMODULE h = GetModuleHandle ("kernel32.dll");
+
+    if (!h)
+      return 0.0;
+
+    /*  Use GlobalMemoryStatusEx if available.  */
+    if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx")))
+      {
+        lMEMORYSTATUSEX lms_ex;
+        lms_ex.dwLength = sizeof lms_ex;
+        if (!pfnex (&lms_ex))
+          return 0.0;
+        return (double) lms_ex.ullTotalPhys;
+      }
+
+    /*  Fall back to GlobalMemoryStatus which is always available.
+        but returns wrong results for physical memory > 4GB.  */
+    else
+      {
+        MEMORYSTATUS ms;
+        GlobalMemoryStatus (&ms);
+        return (double) ms.dwTotalPhys;
+      }
+  }
+#endif
+
+  /* Guess 64 MB.  It's probably an older host, so guess small.  */
+  return 64 * 1024 * 1024;
+}
+
+/* Return the amount of physical memory available.  */
+double
+physmem_available (void)
+{
+#if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE
+  { /* This works on linux-gnu, kfreebsd-gnu, solaris2, and cygwin.  */
+    double pages = sysconf (_SC_AVPHYS_PAGES);
+    double pagesize = sysconf (_SC_PAGESIZE);
+    if (0 <= pages && 0 <= pagesize)
+      return pages * pagesize;
+  }
+#endif
+
+#if HAVE_SYSINFO && HAVE_STRUCT_SYSINFO_MEM_UNIT
+  { /* This works on linux.  */
+    struct sysinfo si;
+    if (sysinfo(&si) == 0)
+      return ((double) si.freeram + si.bufferram) * si.mem_unit;
+  }
+#endif
+
+#if HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC
+  { /* This works on hpux11.  */
+    struct pst_static pss;
+    struct pst_dynamic psd;
+    if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0)
+        && 0 <= pstat_getdynamic (&psd, sizeof psd, 1, 0))
+      {
+        double pages = psd.psd_free;
+        double pagesize = pss.page_size;
+        if (0 <= pages && 0 <= pagesize)
+          return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE
+  { /* This works on irix6. */
+    struct rminfo realmem;
+    if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0)
+      {
+        double pagesize = sysconf (_SC_PAGESIZE);
+        double pages = realmem.availrmem;
+        if (0 <= pages && 0 <= pagesize)
+          return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_TABLE && defined TBL_VMSTATS
+  { /* This works on Tru64 UNIX V4/5.  */
+    struct tbl_vmstats vmstats;
+
+    if (table (TBL_VMSTATS, 0, &vmstats, 1, sizeof (vmstats)) == 1)
+      {
+        double pages = vmstats.free_count;
+        double pagesize = vmstats.pagesize;
+
+        if (0 <= pages && 0 <= pagesize)
+          return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_SYSCTL && !(defined __GLIBC__ && defined __linux__) && defined HW_USERMEM
+  { /* This works on *bsd, kfreebsd-gnu, and darwin.  */
+    unsigned int usermem;
+    size_t len = sizeof usermem;
+    static int mib[2] = { CTL_HW, HW_USERMEM };
+
+    if (sysctl (mib, ARRAY_SIZE (mib), &usermem, &len, NULL, 0) == 0
+        && len == sizeof (usermem))
+      return (double) usermem;
+  }
+#endif
+
+#if defined _WIN32
+  { /* this works on windows */
+    PFN_MS_EX pfnex;
+    HMODULE h = GetModuleHandle ("kernel32.dll");
+
+    if (!h)
+      return 0.0;
+
+    /*  Use GlobalMemoryStatusEx if available.  */
+    if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx")))
+      {
+        lMEMORYSTATUSEX lms_ex;
+        lms_ex.dwLength = sizeof lms_ex;
+        if (!pfnex (&lms_ex))
+          return 0.0;
+        return (double) lms_ex.ullAvailPhys;
+      }
+
+    /*  Fall back to GlobalMemoryStatus which is always available.
+        but returns wrong results for physical memory > 4GB  */
+    else
+      {
+        MEMORYSTATUS ms;
+        GlobalMemoryStatus (&ms);
+        return (double) ms.dwAvailPhys;
+      }
+  }
+#endif
+
+  /* Guess 25% of physical memory.  */
+  return physmem_total () / 4;
+}
+
+
+#if DEBUG
+
+# include <stdio.h>
+# include <stdlib.h>
+
+int
+main (void)
+{
+  printf ("%12.f %12.f\n", physmem_total (), physmem_available ());
+  exit (0);
+}
+
+#endif /* DEBUG */
+
+/*
+Local Variables:
+compile-command: "gcc -DDEBUG -g -O -Wall -W physmem.c"
+End:
+*/
deleted file mode 120000 (symlink)
index 507ce82018ad120db9190bdc999f459b57880559..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/physmem.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e471e82f5b2fc65e90013623285b13bcd778b008
--- /dev/null
@@ -0,0 +1,26 @@
+/* Calculate the size of physical memory.
+
+   Copyright (C) 2000, 2003, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef PHYSMEM_H_
+# define PHYSMEM_H_ 1
+
+double physmem_total (void);
+double physmem_available (void);
+
+#endif /* PHYSMEM_H_ */
deleted file mode 120000 (symlink)
index 53f483ff6c5c32ceb3c67bfc191621641e2c633e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pipe-safer.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3f2143e5e7ba413ee120cb39b3ad9946ed8162b2
--- /dev/null
@@ -0,0 +1,52 @@
+/* Invoke pipe, but avoid some glitches.
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by 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 (pipe (fd) == 0)
+    {
+      int i;
+      for (i = 0; i < 2; i++)
+        {
+          fd[i] = fd_safer (fd[i]);
+          if (fd[i] < 0)
+            {
+              int saved_errno = errno;
+              close (fd[1 - i]);
+              errno = saved_errno;
+              return -1;
+            }
+        }
+
+      return 0;
+    }
+
+  return -1;
+}
deleted file mode 120000 (symlink)
index 17e48a85aa8dc60ee82a2a60dba2fba2eb0ef61c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pipe.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fa6db541174637f99042283cf00edbe0138850ca
--- /dev/null
@@ -0,0 +1,50 @@
+/* Create a pipe.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Native Windows API.  */
+
+/* Get _pipe().  */
+# include <io.h>
+
+/* Get _O_BINARY.  */
+# include <fcntl.h>
+
+int
+pipe (int fd[2])
+{
+  /* Mingw changes fd to {-1,-1} on failure, but this violates
+     http://austingroupbugs.net/view.php?id=467 */
+  int tmp[2];
+  int result = _pipe (tmp, 4096, _O_BINARY);
+  if (!result)
+    {
+      fd[0] = tmp[0];
+      fd[1] = tmp[1];
+    }
+  return result;
+}
+
+#else
+
+# error "This platform lacks a pipe function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
+
+#endif
deleted file mode 120000 (symlink)
index 2e62ff95fe35fa991bd6f04c1efc2156c1c510b0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pipe2.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7b476df345718e9a3f2658eadd42266d72d0b676
--- /dev/null
@@ -0,0 +1,166 @@
+/* Create a pipe, with specific opening flags.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+
+#include "binary-io.h"
+
+#if GNULIB_defined_O_NONBLOCK
+# include "nonblocking.h"
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Native Windows API.  */
+
+# include <io.h>
+
+#endif
+
+int
+pipe2 (int fd[2], int flags)
+{
+  /* Mingw _pipe() corrupts fd on failure; also, if we succeed at
+     creating the pipe but later fail at changing fcntl, we want
+     to leave fd unchanged: http://austingroupbugs.net/view.php?id=467  */
+  int tmp[2];
+  tmp[0] = fd[0];
+  tmp[1] = fd[1];
+
+#if HAVE_PIPE2
+# undef pipe2
+  /* Try the system call first, if it exists.  (We may be running with a glibc
+     that has the function but with an older kernel that lacks it.)  */
+  {
+    /* Cache the information whether the system call really exists.  */
+    static int have_pipe2_really; /* 0 = unknown, 1 = yes, -1 = no */
+    if (have_pipe2_really >= 0)
+      {
+        int result = pipe2 (fd, flags);
+        if (!(result < 0 && errno == ENOSYS))
+          {
+            have_pipe2_really = 1;
+            return result;
+          }
+        have_pipe2_really = -1;
+      }
+  }
+#endif
+
+  /* Check the supported flags.  */
+  if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_BINARY | O_TEXT)) != 0)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Native Windows API.  */
+
+  if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
+    {
+      fd[0] = tmp[0];
+      fd[1] = tmp[1];
+      return -1;
+    }
+
+  /* O_NONBLOCK handling.
+     On native Windows platforms, O_NONBLOCK is defined by gnulib.  Use the
+     functions defined by the gnulib module 'nonblocking'.  */
+# if GNULIB_defined_O_NONBLOCK
+  if (flags & O_NONBLOCK)
+    {
+      if (set_nonblocking_flag (fd[0], true) != 0
+          || set_nonblocking_flag (fd[1], true) != 0)
+        goto fail;
+    }
+# else
+  {
+    static_assert (O_NONBLOCK == 0);
+  }
+# endif
+
+  return 0;
+
+#else
+/* Unix API.  */
+
+  if (pipe (fd) < 0)
+    return -1;
+
+  /* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pipe.html>
+     says that initially, the O_NONBLOCK and FD_CLOEXEC flags are cleared on
+     both fd[0] and fd[1].  */
+
+  /* O_NONBLOCK handling.
+     On Unix platforms, O_NONBLOCK is defined by the system.  Use fcntl().  */
+  if (flags & O_NONBLOCK)
+    {
+      int fcntl_flags;
+
+      if ((fcntl_flags = fcntl (fd[1], F_GETFL, 0)) < 0
+          || fcntl (fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) == -1
+          || (fcntl_flags = fcntl (fd[0], F_GETFL, 0)) < 0
+          || fcntl (fd[0], F_SETFL, fcntl_flags | O_NONBLOCK) == -1)
+        goto fail;
+    }
+
+  if (flags & O_CLOEXEC)
+    {
+      int fcntl_flags;
+
+      if ((fcntl_flags = fcntl (fd[1], F_GETFD, 0)) < 0
+          || fcntl (fd[1], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1
+          || (fcntl_flags = fcntl (fd[0], F_GETFD, 0)) < 0
+          || fcntl (fd[0], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1)
+        goto fail;
+    }
+
+# if O_BINARY
+  if (flags & O_BINARY)
+    {
+      set_binary_mode (fd[1], O_BINARY);
+      set_binary_mode (fd[0], O_BINARY);
+    }
+  else if (flags & O_TEXT)
+    {
+      set_binary_mode (fd[1], O_TEXT);
+      set_binary_mode (fd[0], O_TEXT);
+    }
+# endif
+
+  return 0;
+
+#endif
+
+#if GNULIB_defined_O_NONBLOCK || !(defined _WIN32 && ! defined __CYGWIN__)
+ fail:
+  {
+    int saved_errno = errno;
+    close (fd[0]);
+    close (fd[1]);
+    fd[0] = tmp[0];
+    fd[1] = tmp[1];
+    errno = saved_errno;
+    return -1;
+  }
+#endif
+}
deleted file mode 120000 (symlink)
index 9d2e00d2068bab2537ce1b6c1e1250967895839c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/posix_memalign.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6a13c56710207d3acc8a8811824cb9a5a3fff630
--- /dev/null
@@ -0,0 +1,35 @@
+/* A posix_memalign() function that works around platform bugs.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+
+int
+posix_memalign (void **memptr, size_t alignment, size_t size)
+#undef posix_memalign
+{
+  /* Round up SIZE to the next multiple of ALIGNMENT, namely
+     (SIZE + ALIGNMENT - 1) & ~(ALIGNMENT - 1).  */
+  size += alignment - 1;
+  if (size >= alignment - 1) /* no overflow? */
+    return posix_memalign (memptr, alignment, size & ~(size_t)(alignment - 1));
+  else
+    return ENOMEM;
+}
deleted file mode 120000 (symlink)
index c061c3bd9ebc02c9fd7aff0a90e692fb8351e3e2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/posixtm.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a072c7cad015527ba548766b3bc2d47f67ab984b
--- /dev/null
@@ -0,0 +1,208 @@
+/* Parse dates for touch and date.
+
+   Copyright (C) 1989-1991, 1998, 2000-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Yacc-based version written by Jim Kingdon and David MacKenzie.
+   Rewritten by Jim Meyering.  */
+
+#include <config.h>
+
+#include "posixtm.h"
+
+#include "c-ctype.h"
+#include "idx.h"
+#include "verify.h"
+
+#include <stdckdint.h>
+#include <string.h>
+
+/*
+  POSIX requires:
+
+  touch -t [[CC]YY]mmddhhmm[.ss] FILE...
+    8, 10, or 12 digits, followed by optional .ss
+    (PDS_CENTURY | PDS_SECONDS)
+
+  touch mmddhhmm[YY] FILE... (obsoleted by POSIX 1003.1-2001)
+    8 or 10 digits, YY (if present) must be in the range 69-99
+    (PDS_TRAILING_YEAR | PDS_PRE_2000)
+
+  date mmddhhmm[[CC]YY]
+    8, 10, or 12 digits
+    (PDS_TRAILING_YEAR | PDS_CENTURY)
+
+*/
+
+static bool
+year (struct tm *tm, const int *digit_pair, idx_t n, unsigned int syntax_bits)
+{
+  switch (n)
+    {
+    case 1:
+      tm->tm_year = *digit_pair;
+      /* Deduce the century based on the year.
+         POSIX requires that 00-68 be interpreted as 2000-2068,
+         and that 69-99 be interpreted as 1969-1999.  */
+      if (digit_pair[0] <= 68)
+        {
+          if (syntax_bits & PDS_PRE_2000)
+            return false;
+          tm->tm_year += 100;
+        }
+      break;
+
+    case 2:
+      if (! (syntax_bits & PDS_CENTURY))
+        return false;
+      tm->tm_year = digit_pair[0] * 100 + digit_pair[1] - 1900;
+      break;
+
+    case 0:
+      {
+        /* Use current year.  */
+        time_t now = time (NULL);
+        struct tm *tmp = localtime (&now);
+        if (! tmp)
+          return false;
+        tm->tm_year = tmp->tm_year;
+      }
+      break;
+
+    default:
+      assume (false);
+    }
+
+  return true;
+}
+
+static bool
+posix_time_parse (struct tm *tm, const char *s, unsigned int syntax_bits)
+{
+  const char *dot = NULL;
+  int pair[6];
+
+  idx_t s_len = strlen (s);
+  idx_t len = s_len;
+
+  if (syntax_bits & PDS_SECONDS)
+    {
+      dot = strchr (s, '.');
+      if (dot)
+        {
+          len = dot - s;
+          if (s_len - len != 3)
+            return false;
+        }
+    }
+
+  if (! (8 <= len && len <= 12 && len % 2 == 0))
+    return false;
+
+  for (idx_t i = 0; i < len; i++)
+    if (!c_isdigit (s[i]))
+      return false;
+
+  len /= 2;
+  for (idx_t i = 0; i < len; i++)
+    pair[i] = 10 * (s[2*i] - '0') + s[2*i + 1] - '0';
+
+  int *p = pair;
+  if (! (syntax_bits & PDS_TRAILING_YEAR))
+    {
+      if (! year (tm, p, len - 4, syntax_bits))
+        return false;
+      p += len - 4;
+      len = 4;
+    }
+
+  /* Handle 8 digits worth of 'MMDDhhmm'.  */
+  tm->tm_mon = *p++ - 1;
+  tm->tm_mday = *p++;
+  tm->tm_hour = *p++;
+  tm->tm_min = *p++;
+  len -= 4;
+
+  /* Handle any trailing year.  */
+  if (syntax_bits & PDS_TRAILING_YEAR)
+    {
+      if (! year (tm, p, len, syntax_bits))
+        return false;
+    }
+
+  /* Handle seconds.  */
+  if (!dot)
+    tm->tm_sec = 0;
+  else if (c_isdigit (dot[1]) && c_isdigit (dot[2]))
+    tm->tm_sec = 10 * (dot[1] - '0') + dot[2] - '0';
+  else
+    return false;
+
+  return true;
+}
+
+/* Parse a POSIX-style date, returning true if successful.  */
+
+bool
+posixtime (time_t *p, const char *s, unsigned int syntax_bits)
+{
+  struct tm tm0;
+  bool leapsec = false;
+
+  if (! posix_time_parse (&tm0, s, syntax_bits))
+    return false;
+
+  while (true)
+    {
+      struct tm tm1;
+      tm1.tm_sec = tm0.tm_sec;
+      tm1.tm_min = tm0.tm_min;
+      tm1.tm_hour = tm0.tm_hour;
+      tm1.tm_mday = tm0.tm_mday;
+      tm1.tm_mon = tm0.tm_mon;
+      tm1.tm_year = tm0.tm_year;
+      tm1.tm_wday = -1;
+      tm1.tm_isdst = -1;
+      time_t t = mktime (&tm1);
+
+      if (tm1.tm_wday < 0)
+        return false;
+
+      /* Reject dates like "September 31" and times like "25:61".
+         However, allow a seconds count of 60 even in time zones that do
+         not support leap seconds, treating it as the following second;
+         POSIX requires this.  */
+      if (! ((tm0.tm_year ^ tm1.tm_year)
+             | (tm0.tm_mon ^ tm1.tm_mon)
+             | (tm0.tm_mday ^ tm1.tm_mday)
+             | (tm0.tm_hour ^ tm1.tm_hour)
+             | (tm0.tm_min ^ tm1.tm_min)
+             | (tm0.tm_sec ^ tm1.tm_sec)))
+        {
+          if (ckd_add (&t, t, +leapsec))
+            return false;
+          *p = t;
+          return true;
+        }
+
+      /* Any mismatch without 60 in the tm_sec field is invalid.  */
+      if (tm0.tm_sec != 60)
+        return false;
+
+      /* Allow times like 01:35:60 or 23:59:60.  */
+      tm0.tm_sec = 59;
+      leapsec = true;
+    }
+}
deleted file mode 120000 (symlink)
index 8a6fc602f39653df68c7eefa7a8cdea074ed2cb2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/posixtm.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f6b677da7ec03a1f2fff9b0d3f65bb3011fc23f7
--- /dev/null
@@ -0,0 +1,38 @@
+/* Parse dates for touch and date.
+
+   Copyright (C) 1998, 2003, 2005, 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Yacc-based version written by Jim Kingdon and David MacKenzie.
+   Rewritten by Jim Meyering.  */
+
+#ifndef POSIXTM_H_
+# define POSIXTM_H_
+
+# include <time.h>
+
+/* POSIX Date Syntax flags.  */
+# define PDS_TRAILING_YEAR 1
+# define PDS_CENTURY 2
+# define PDS_SECONDS 4
+# define PDS_PRE_2000 8
+
+/* For compatibility with older versions of this header, in which
+   PDS_LEADING_YEAR had its own bit.  */
+# define PDS_LEADING_YEAR 0
+
+bool posixtime (time_t *p, const char *s, unsigned int syntax_bits);
+
+#endif
deleted file mode 120000 (symlink)
index 07a83375f2f937b1e358cfe1f5af815102da37f0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/posixver.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ec9ad6682493aff251a6ec527d7ba2b9b0dc17fb
--- /dev/null
@@ -0,0 +1,54 @@
+/* Which POSIX version to conform to, for utilities.
+
+   Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "posixver.h"
+
+#include <limits.h>
+#include <stdlib.h>
+
+#include <unistd.h>
+#ifndef _POSIX2_VERSION
+# define _POSIX2_VERSION 0
+#endif
+
+#ifndef DEFAULT_POSIX2_VERSION
+# define DEFAULT_POSIX2_VERSION _POSIX2_VERSION
+#endif
+
+/* The POSIX version that utilities should conform to.  The default is
+   specified by the system.  */
+
+int
+posix2_version (void)
+{
+  long int v = DEFAULT_POSIX2_VERSION;
+  char const *s = getenv ("_POSIX2_VERSION");
+
+  if (s && *s)
+    {
+      char *e;
+      long int i = strtol (s, &e, 10);
+      if (! *e)
+        v = i;
+    }
+
+  return v < INT_MIN ? INT_MIN : v < INT_MAX ? v : INT_MAX;
+}
deleted file mode 120000 (symlink)
index 58fe82b2aa854ea12a356b11a6b8158f349a4b27..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/posixver.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c02be4605d6da44d664bfa4d36c28918f8aa089d
--- /dev/null
@@ -0,0 +1,18 @@
+/* Which POSIX version to conform to, for utilities.
+
+   Copyright (C) 2002-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+int posix2_version (void);
deleted file mode 120000 (symlink)
index 04f793803899054967d1752d0287887425628f23..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/printf-args.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eb0d2cdc0f4b596a0804c36aa0257f680d7922d8
--- /dev/null
@@ -0,0 +1,306 @@
+/* Decomposed printf argument list.
+   Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file can be parametrized with the following macros:
+     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
+     PRINTF_FETCHARGS   Name of the function to be defined.
+     STATIC             Set to 'static' to declare the function static.  */
+
+#ifndef PRINTF_FETCHARGS
+# include <config.h>
+#endif
+
+/* Specification.  */
+#ifndef PRINTF_FETCHARGS
+# include "printf-args.h"
+#endif
+
+/* Get INT_WIDTH.  */
+#include <limits.h>
+
+#ifdef STATIC
+STATIC
+#endif
+int
+PRINTF_FETCHARGS (va_list args, arguments *a)
+{
+  size_t i;
+  argument *ap;
+
+  for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
+    switch (ap->type)
+      {
+      case TYPE_SCHAR:
+        ap->a.a_schar = va_arg (args, /*signed char*/ int);
+        break;
+      case TYPE_UCHAR:
+        ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
+        break;
+      case TYPE_SHORT:
+        ap->a.a_short = va_arg (args, /*short*/ int);
+        break;
+      case TYPE_USHORT:
+        ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
+        break;
+      case TYPE_INT:
+        ap->a.a_int = va_arg (args, int);
+        break;
+      case TYPE_UINT:
+        ap->a.a_uint = va_arg (args, unsigned int);
+        break;
+      case TYPE_LONGINT:
+        ap->a.a_longint = va_arg (args, long int);
+        break;
+      case TYPE_ULONGINT:
+        ap->a.a_ulongint = va_arg (args, unsigned long int);
+        break;
+      case TYPE_LONGLONGINT:
+        ap->a.a_longlongint = va_arg (args, long long int);
+        break;
+      case TYPE_ULONGLONGINT:
+        ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
+        break;
+      case TYPE_INT8_T:
+        #if INT8_WIDTH < INT_WIDTH
+        ap->a.a_int8_t = va_arg (args, /* int8_t */ int);
+        #else
+        ap->a.a_int8_t = va_arg (args, int8_t);
+        #endif
+        break;
+      case TYPE_UINT8_T:
+        #if UINT8_WIDTH < INT_WIDTH
+        ap->a.a_uint8_t = va_arg (args, /* uint8_t */ int);
+        #else
+        ap->a.a_uint8_t = va_arg (args, uint8_t);
+        #endif
+        break;
+      case TYPE_INT16_T:
+        #if INT16_WIDTH < INT_WIDTH
+        ap->a.a_int16_t = va_arg (args, /* int16_t */ int);
+        #else
+        ap->a.a_int16_t = va_arg (args, int16_t);
+        #endif
+        break;
+      case TYPE_UINT16_T:
+        #if UINT16_WIDTH < INT_WIDTH
+        ap->a.a_uint16_t = va_arg (args, /* uint16_t */ int);
+        #else
+        ap->a.a_uint16_t = va_arg (args, uint16_t);
+        #endif
+        break;
+      case TYPE_INT32_T:
+        #if INT32_WIDTH < INT_WIDTH
+        ap->a.a_int32_t = va_arg (args, /* int32_t */ int);
+        #else
+        ap->a.a_int32_t = va_arg (args, int32_t);
+        #endif
+        break;
+      case TYPE_UINT32_T:
+        #if UINT32_WIDTH < INT_WIDTH
+        ap->a.a_uint32_t = va_arg (args, /* uint32_t */ int);
+        #else
+        ap->a.a_uint32_t = va_arg (args, uint32_t);
+        #endif
+        break;
+      case TYPE_INT64_T:
+        ap->a.a_int64_t = va_arg (args, int64_t);
+        break;
+      case TYPE_UINT64_T:
+        ap->a.a_uint64_t = va_arg (args, uint64_t);
+        break;
+      case TYPE_INT_FAST8_T:
+        #if INT_FAST8_WIDTH < INT_WIDTH
+        ap->a.a_int_fast8_t = va_arg (args, /* int_fast8_t */ int);
+        #else
+        ap->a.a_int_fast8_t = va_arg (args, int_fast8_t);
+        #endif
+        break;
+      case TYPE_UINT_FAST8_T:
+        #if UINT_FAST8_WIDTH < INT_WIDTH
+        ap->a.a_uint_fast8_t = va_arg (args, /* uint_fast8_t */ int);
+        #else
+        ap->a.a_uint_fast8_t = va_arg (args, uint_fast8_t);
+        #endif
+        break;
+      case TYPE_INT_FAST16_T:
+        #if INT_FAST16_WIDTH < INT_WIDTH
+        ap->a.a_int_fast16_t = va_arg (args, /* int_fast16_t */ int);
+        #else
+        ap->a.a_int_fast16_t = va_arg (args, int_fast16_t);
+        #endif
+        break;
+      case TYPE_UINT_FAST16_T:
+        #if UINT_FAST16_WIDTH < INT_WIDTH
+        ap->a.a_uint_fast16_t = va_arg (args, /* uint_fast16_t */ int);
+        #else
+        ap->a.a_uint_fast16_t = va_arg (args, uint_fast16_t);
+        #endif
+        break;
+      case TYPE_INT_FAST32_T:
+        #if INT_FAST32_WIDTH < INT_WIDTH
+        ap->a.a_int_fast32_t = va_arg (args, /* int_fast32_t */ int);
+        #else
+        ap->a.a_int_fast32_t = va_arg (args, int_fast32_t);
+        #endif
+        break;
+      case TYPE_UINT_FAST32_T:
+        #if UINT_FAST32_WIDTH < INT_WIDTH
+        ap->a.a_uint_fast32_t = va_arg (args, /* uint_fast32_t */ int);
+        #else
+        ap->a.a_uint_fast32_t = va_arg (args, uint_fast32_t);
+        #endif
+        break;
+      case TYPE_INT_FAST64_T:
+        ap->a.a_int_fast64_t = va_arg (args, int_fast64_t);
+        break;
+      case TYPE_UINT_FAST64_T:
+        ap->a.a_uint_fast64_t = va_arg (args, uint_fast64_t);
+        break;
+      case TYPE_DOUBLE:
+        ap->a.a_double = va_arg (args, double);
+        break;
+      case TYPE_LONGDOUBLE:
+        ap->a.a_longdouble = va_arg (args, long double);
+        break;
+      case TYPE_CHAR:
+        ap->a.a_char = va_arg (args, int);
+        break;
+#if HAVE_WINT_T
+      case TYPE_WIDE_CHAR:
+        /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
+           default argument promotions", this is not the case in mingw32,
+           where wint_t is 'unsigned short'.  */
+        ap->a.a_wide_char =
+          (sizeof (wint_t) < sizeof (int)
+           ? (wint_t) va_arg (args, int)
+           : va_arg (args, wint_t));
+        break;
+#endif
+      case TYPE_STRING:
+        ap->a.a_string = va_arg (args, const char *);
+        /* A null pointer is an invalid argument for "%s", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_string == NULL)
+          ap->a.a_string = "(NULL)";
+        break;
+#if HAVE_WCHAR_T
+      case TYPE_WIDE_STRING:
+        ap->a.a_wide_string = va_arg (args, const wchar_t *);
+        /* A null pointer is an invalid argument for "%ls", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_wide_string == NULL)
+          {
+            static const wchar_t wide_null_string[] =
+              {
+                (wchar_t)'(',
+                (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
+                (wchar_t)')',
+                (wchar_t)0
+              };
+            ap->a.a_wide_string = wide_null_string;
+          }
+        break;
+#endif
+      case TYPE_POINTER:
+        ap->a.a_pointer = va_arg (args, void *);
+        break;
+      case TYPE_COUNT_SCHAR_POINTER:
+        ap->a.a_count_schar_pointer = va_arg (args, signed char *);
+        break;
+      case TYPE_COUNT_SHORT_POINTER:
+        ap->a.a_count_short_pointer = va_arg (args, short *);
+        break;
+      case TYPE_COUNT_INT_POINTER:
+        ap->a.a_count_int_pointer = va_arg (args, int *);
+        break;
+      case TYPE_COUNT_LONGINT_POINTER:
+        ap->a.a_count_longint_pointer = va_arg (args, long int *);
+        break;
+      case TYPE_COUNT_LONGLONGINT_POINTER:
+        ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
+        break;
+      case TYPE_COUNT_INT8_T_POINTER:
+        ap->a.a_count_int8_t_pointer = va_arg (args, int8_t *);
+        break;
+      case TYPE_COUNT_INT16_T_POINTER:
+        ap->a.a_count_int16_t_pointer = va_arg (args, int16_t *);
+        break;
+      case TYPE_COUNT_INT32_T_POINTER:
+        ap->a.a_count_int32_t_pointer = va_arg (args, int32_t *);
+        break;
+      case TYPE_COUNT_INT64_T_POINTER:
+        ap->a.a_count_int64_t_pointer = va_arg (args, int64_t *);
+        break;
+      case TYPE_COUNT_INT_FAST8_T_POINTER:
+        ap->a.a_count_int_fast8_t_pointer = va_arg (args, int_fast8_t *);
+        break;
+      case TYPE_COUNT_INT_FAST16_T_POINTER:
+        ap->a.a_count_int_fast16_t_pointer = va_arg (args, int_fast16_t *);
+        break;
+      case TYPE_COUNT_INT_FAST32_T_POINTER:
+        ap->a.a_count_int_fast32_t_pointer = va_arg (args, int_fast32_t *);
+        break;
+      case TYPE_COUNT_INT_FAST64_T_POINTER:
+        ap->a.a_count_int_fast64_t_pointer = va_arg (args, int_fast64_t *);
+        break;
+#if ENABLE_UNISTDIO
+      /* The unistdio extensions.  */
+      case TYPE_U8_STRING:
+        ap->a.a_u8_string = va_arg (args, const uint8_t *);
+        /* A null pointer is an invalid argument for "%U", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u8_string == NULL)
+          {
+            static const uint8_t u8_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u8_string = u8_null_string;
+          }
+        break;
+      case TYPE_U16_STRING:
+        ap->a.a_u16_string = va_arg (args, const uint16_t *);
+        /* A null pointer is an invalid argument for "%lU", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u16_string == NULL)
+          {
+            static const uint16_t u16_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u16_string = u16_null_string;
+          }
+        break;
+      case TYPE_U32_STRING:
+        ap->a.a_u32_string = va_arg (args, const uint32_t *);
+        /* A null pointer is an invalid argument for "%llU", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u32_string == NULL)
+          {
+            static const uint32_t u32_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u32_string = u32_null_string;
+          }
+        break;
+#endif
+      default:
+        /* Unknown type.  */
+        return -1;
+      }
+  return 0;
+}
deleted file mode 120000 (symlink)
index 39a033f0761cb18da506a99c49fea7eb3b176515..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/printf-args.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9b80bb39290616a0bc6d3729f6fa51427fbcbe45
--- /dev/null
@@ -0,0 +1,205 @@
+/* Decomposed printf argument list.
+   Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _PRINTF_ARGS_H
+#define _PRINTF_ARGS_H
+
+/* This file can be parametrized with the following macros:
+     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
+     PRINTF_FETCHARGS   Name of the function to be declared.
+     STATIC             Set to 'static' to declare the function static.  */
+
+/* Default parameters.  */
+#ifndef PRINTF_FETCHARGS
+# define PRINTF_FETCHARGS printf_fetchargs
+#endif
+
+/* Get size_t.  */
+#include <stddef.h>
+
+/* Get wchar_t.  */
+#if HAVE_WCHAR_T
+# include <stddef.h>
+#endif
+
+/* Get wint_t.  */
+#if HAVE_WINT_T
+# include <wchar.h>
+#endif
+
+/* Get intN_t, uintN_t, intN_fast_t, uintN_fast_t.  */
+#include <stdint.h>
+
+/* Get va_list.  */
+#include <stdarg.h>
+
+
+/* Argument types */
+typedef enum
+{
+  TYPE_NONE,
+  TYPE_SCHAR,
+  TYPE_UCHAR,
+  TYPE_SHORT,
+  TYPE_USHORT,
+  TYPE_INT,
+  TYPE_UINT,
+  TYPE_LONGINT,
+  TYPE_ULONGINT,
+  TYPE_LONGLONGINT,
+  TYPE_ULONGLONGINT,
+  /* According to ISO C 23 § 7.23.6.1, "all exact-width integer types",
+     "all minimum-width integer types", and "all fastest minimum-width integer
+     types" defined in <stdint.h> should be supported.  But for portability
+     between platforms, we support only those with N = 8, 16, 32, 64.  */
+  TYPE_INT8_T,
+  TYPE_UINT8_T,
+  TYPE_INT16_T,
+  TYPE_UINT16_T,
+  TYPE_INT32_T,
+  TYPE_UINT32_T,
+  TYPE_INT64_T,
+  TYPE_UINT64_T,
+  TYPE_INT_FAST8_T,
+  TYPE_UINT_FAST8_T,
+  TYPE_INT_FAST16_T,
+  TYPE_UINT_FAST16_T,
+  TYPE_INT_FAST32_T,
+  TYPE_UINT_FAST32_T,
+  TYPE_INT_FAST64_T,
+  TYPE_UINT_FAST64_T,
+  TYPE_DOUBLE,
+  TYPE_LONGDOUBLE,
+  TYPE_CHAR,
+#if HAVE_WINT_T
+  TYPE_WIDE_CHAR,
+#endif
+  TYPE_STRING,
+#if HAVE_WCHAR_T
+  TYPE_WIDE_STRING,
+#endif
+  TYPE_POINTER,
+  TYPE_COUNT_SCHAR_POINTER,
+  TYPE_COUNT_SHORT_POINTER,
+  TYPE_COUNT_INT_POINTER,
+  TYPE_COUNT_LONGINT_POINTER,
+  TYPE_COUNT_LONGLONGINT_POINTER,
+  TYPE_COUNT_INT8_T_POINTER,
+  TYPE_COUNT_INT16_T_POINTER,
+  TYPE_COUNT_INT32_T_POINTER,
+  TYPE_COUNT_INT64_T_POINTER,
+  TYPE_COUNT_INT_FAST8_T_POINTER,
+  TYPE_COUNT_INT_FAST16_T_POINTER,
+  TYPE_COUNT_INT_FAST32_T_POINTER,
+  TYPE_COUNT_INT_FAST64_T_POINTER
+#if ENABLE_UNISTDIO
+  /* The unistdio extensions.  */
+, TYPE_U8_STRING
+, TYPE_U16_STRING
+, TYPE_U32_STRING
+#endif
+} arg_type;
+
+/* Polymorphic argument */
+typedef struct
+{
+  arg_type type;
+  union
+  {
+    signed char                 a_schar;
+    unsigned char               a_uchar;
+    short                       a_short;
+    unsigned short              a_ushort;
+    int                         a_int;
+    unsigned int                a_uint;
+    long int                    a_longint;
+    unsigned long int           a_ulongint;
+    long long int               a_longlongint;
+    unsigned long long int      a_ulonglongint;
+    int8_t                      a_int8_t;
+    uint8_t                     a_uint8_t;
+    int16_t                     a_int16_t;
+    uint16_t                    a_uint16_t;
+    int32_t                     a_int32_t;
+    uint32_t                    a_uint32_t;
+    int64_t                     a_int64_t;
+    uint64_t                    a_uint64_t;
+    int_fast8_t                 a_int_fast8_t;
+    uint_fast8_t                a_uint_fast8_t;
+    int_fast16_t                a_int_fast16_t;
+    uint_fast16_t               a_uint_fast16_t;
+    int_fast32_t                a_int_fast32_t;
+    uint_fast32_t               a_uint_fast32_t;
+    int_fast64_t                a_int_fast64_t;
+    uint_fast64_t               a_uint_fast64_t;
+    float                       a_float;                     /* unused */
+    double                      a_double;
+    long double                 a_longdouble;
+    int                         a_char;
+#if HAVE_WINT_T
+    wint_t                      a_wide_char;
+#endif
+    const char*                 a_string;
+#if HAVE_WCHAR_T
+    const wchar_t*              a_wide_string;
+#endif
+    void*                       a_pointer;
+    signed char *               a_count_schar_pointer;
+    short *                     a_count_short_pointer;
+    int *                       a_count_int_pointer;
+    long int *                  a_count_longint_pointer;
+    long long int *             a_count_longlongint_pointer;
+    int8_t *                    a_count_int8_t_pointer;
+    int16_t *                   a_count_int16_t_pointer;
+    int32_t *                   a_count_int32_t_pointer;
+    int64_t *                   a_count_int64_t_pointer;
+    int_fast8_t *               a_count_int_fast8_t_pointer;
+    int_fast16_t *              a_count_int_fast16_t_pointer;
+    int_fast32_t *              a_count_int_fast32_t_pointer;
+    int_fast64_t *              a_count_int_fast64_t_pointer;
+#if ENABLE_UNISTDIO
+    /* The unistdio extensions.  */
+    const uint8_t *             a_u8_string;
+    const uint16_t *            a_u16_string;
+    const uint32_t *            a_u32_string;
+#endif
+  }
+  a;
+}
+argument;
+
+/* Number of directly allocated arguments (no malloc() needed).  */
+#define N_DIRECT_ALLOC_ARGUMENTS 7
+
+typedef struct
+{
+  size_t count;
+  argument *arg;
+  argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS];
+}
+arguments;
+
+
+/* Fetch the arguments, putting them into a. */
+#ifdef STATIC
+STATIC
+#else
+extern
+#endif
+int PRINTF_FETCHARGS (va_list args, arguments *a);
+
+#endif /* _PRINTF_ARGS_H */
deleted file mode 120000 (symlink)
index 17a7050e572cb5c94143aef1dc5089c1e1e34218..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/printf-frexp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..400dd46eae88e2991ef21d114a0793f32442fad4
--- /dev/null
@@ -0,0 +1,190 @@
+/* Split a double into fraction and mantissa, for hexadecimal printf.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if ! defined USE_LONG_DOUBLE
+# include <config.h>
+#endif
+
+/* Specification.  */
+#ifdef USE_LONG_DOUBLE
+# include "printf-frexpl.h"
+#else
+# include "printf-frexp.h"
+#endif
+
+#include <float.h>
+#include <math.h>
+#ifdef USE_LONG_DOUBLE
+# include "fpucw.h"
+#endif
+
+/* This file assumes FLT_RADIX = 2.  If FLT_RADIX is a power of 2 greater
+   than 2, or not even a power of 2, some rounding errors can occur, so that
+   then the returned mantissa is only guaranteed to be <= 2.0, not < 2.0.  */
+
+#ifdef USE_LONG_DOUBLE
+# define FUNC printf_frexpl
+# define DOUBLE long double
+# define MIN_EXP LDBL_MIN_EXP
+# if HAVE_FREXPL_IN_LIBC && HAVE_LDEXPL_IN_LIBC
+#  define USE_FREXP_LDEXP
+#  define FREXP frexpl
+#  define LDEXP ldexpl
+# endif
+# define DECL_ROUNDING DECL_LONG_DOUBLE_ROUNDING
+# define BEGIN_ROUNDING() BEGIN_LONG_DOUBLE_ROUNDING ()
+# define END_ROUNDING() END_LONG_DOUBLE_ROUNDING ()
+# define L_(literal) literal##L
+#else
+# define FUNC printf_frexp
+# define DOUBLE double
+# define MIN_EXP DBL_MIN_EXP
+# if HAVE_FREXP_IN_LIBC && HAVE_LDEXP_IN_LIBC
+#  define USE_FREXP_LDEXP
+#  define FREXP frexp
+#  define LDEXP ldexp
+# endif
+# define DECL_ROUNDING
+# define BEGIN_ROUNDING()
+# define END_ROUNDING()
+# define L_(literal) literal
+#endif
+
+DOUBLE
+FUNC (DOUBLE x, int *expptr)
+{
+  int exponent;
+  DECL_ROUNDING
+
+  BEGIN_ROUNDING ();
+
+#ifdef USE_FREXP_LDEXP
+  /* frexp and ldexp are usually faster than the loop below.  */
+  x = FREXP (x, &exponent);
+
+  x = x + x;
+  exponent -= 1;
+
+  if (exponent < MIN_EXP - 1)
+    {
+      x = LDEXP (x, exponent - (MIN_EXP - 1));
+      exponent = MIN_EXP - 1;
+    }
+#else
+  {
+    /* Since the exponent is an 'int', it fits in 64 bits.  Therefore the
+       loops are executed no more than 64 times.  */
+    DOUBLE pow2[64]; /* pow2[i] = 2^2^i */
+    DOUBLE powh[64]; /* powh[i] = 2^-2^i */
+    int i;
+
+    exponent = 0;
+    if (x >= L_(1.0))
+      {
+        /* A nonnegative exponent.  */
+        {
+          DOUBLE pow2_i; /* = pow2[i] */
+          DOUBLE powh_i; /* = powh[i] */
+
+          /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i,
+             x * 2^exponent = argument, x >= 1.0.  */
+          for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5);
+               ;
+               i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i)
+            {
+              if (x >= pow2_i)
+                {
+                  exponent += (1 << i);
+                  x *= powh_i;
+                }
+              else
+                break;
+
+              pow2[i] = pow2_i;
+              powh[i] = powh_i;
+            }
+        }
+        /* Here 1.0 <= x < 2^2^i.  */
+      }
+    else
+      {
+        /* A negative exponent.  */
+        {
+          DOUBLE pow2_i; /* = pow2[i] */
+          DOUBLE powh_i; /* = powh[i] */
+
+          /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i,
+             x * 2^exponent = argument, x < 1.0, exponent >= MIN_EXP - 1.  */
+          for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5);
+               ;
+               i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i)
+            {
+              if (exponent - (1 << i) < MIN_EXP - 1)
+                break;
+
+              exponent -= (1 << i);
+              x *= pow2_i;
+              if (x >= L_(1.0))
+                break;
+
+              pow2[i] = pow2_i;
+              powh[i] = powh_i;
+            }
+        }
+        /* Here either x < 1.0 and exponent - 2^i < MIN_EXP - 1 <= exponent,
+           or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1.  */
+
+        if (x < L_(1.0))
+          /* Invariants: x * 2^exponent = argument, x < 1.0 and
+             exponent - 2^i < MIN_EXP - 1 <= exponent.  */
+          while (i > 0)
+            {
+              i--;
+              if (exponent - (1 << i) >= MIN_EXP - 1)
+                {
+                  exponent -= (1 << i);
+                  x *= pow2[i];
+                  if (x >= L_(1.0))
+                    break;
+                }
+            }
+
+        /* Here either x < 1.0 and exponent = MIN_EXP - 1,
+           or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1.  */
+      }
+
+    /* Invariants: x * 2^exponent = argument, and
+       either x < 1.0 and exponent = MIN_EXP - 1,
+       or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1.  */
+    while (i > 0)
+      {
+        i--;
+        if (x >= pow2[i])
+          {
+            exponent += (1 << i);
+            x *= powh[i];
+          }
+      }
+    /* Here either x < 1.0 and exponent = MIN_EXP - 1,
+       or 1.0 <= x < 2.0 and exponent >= MIN_EXP - 1.  */
+  }
+#endif
+
+  END_ROUNDING ();
+
+  *expptr = exponent;
+  return x;
+}
deleted file mode 120000 (symlink)
index 5957aa58deb1f54c4aaebc6cde4673b1587604a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/printf-frexp.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4970c137271b638a91c04c1a43fa8270c806ac05
--- /dev/null
@@ -0,0 +1,23 @@
+/* Split a double into fraction and mantissa, for hexadecimal printf.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Write a finite, positive number x as
+     x = mantissa * 2^exp
+   where exp >= DBL_MIN_EXP - 1,
+         mantissa < 2.0,
+         if x is not a denormalized number then mantissa >= 1.0.
+   Store exp in *EXPPTR and return mantissa.  */
+extern double printf_frexp (double x, int *expptr);
deleted file mode 120000 (symlink)
index 3fc8f98aab0860fc843f541d3950e9a3cc3ec064..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/printf-frexpl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5294cedd59c5dafb7d644cf324c3d1c563d93a2d
--- /dev/null
@@ -0,0 +1,37 @@
+/* Split a 'long double' into fraction and mantissa, for hexadecimal printf.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+
+/* Specification.  */
+# include "printf-frexpl.h"
+
+# include "printf-frexp.h"
+
+long double
+printf_frexpl (long double x, int *expptr)
+{
+  return printf_frexp (x, expptr);
+}
+
+#else
+
+# define USE_LONG_DOUBLE
+# include "printf-frexp.c"
+
+#endif
deleted file mode 120000 (symlink)
index a465411e454b64441f943b8f41ff6a8c487309f7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/printf-frexpl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b1adfd7f2767f8a2e7765db2e24eb291e1b1e154
--- /dev/null
@@ -0,0 +1,23 @@
+/* Split a 'long double' into fraction and mantissa, for hexadecimal printf.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Write a finite, positive number x as
+     x = mantissa * 2^exp
+   where exp >= LDBL_MIN_EXP - 1,
+         mantissa < 2.0,
+         if x is not a denormalized number then mantissa >= 1.0.
+   Store exp in *EXPPTR and return mantissa.  */
+extern long double printf_frexpl (long double x, int *expptr);
deleted file mode 120000 (symlink)
index 3f3eb35a6331dd43d3397221f48bc1cc524a55d1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/printf-parse.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c0532900adf8060e48d80f5d2cdcbed290fac14c
--- /dev/null
@@ -0,0 +1,714 @@
+/* Formatted output to strings.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file can be parametrized with the following macros:
+     CHAR_T             The element type of the format string.
+     CHAR_T_ONLY_ASCII  Set to 1 to enable verification that all characters
+                        in the format string are ASCII.
+     DIRECTIVE          Structure denoting a format directive.
+                        Depends on CHAR_T.
+     DIRECTIVES         Structure denoting the set of format directives of a
+                        format string.  Depends on CHAR_T.
+     PRINTF_PARSE       Function that parses a format string.
+                        Depends on CHAR_T.
+     STATIC             Set to 'static' to declare the function static.
+     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.  */
+
+#ifndef PRINTF_PARSE
+# include <config.h>
+#endif
+
+/* Specification.  */
+#ifndef PRINTF_PARSE
+# include "printf-parse.h"
+#endif
+
+/* Default parameters.  */
+#ifndef PRINTF_PARSE
+# define PRINTF_PARSE printf_parse
+# define CHAR_T char
+# define DIRECTIVE char_directive
+# define DIRECTIVES char_directives
+#endif
+
+/* Get size_t, NULL.  */
+#include <stddef.h>
+
+/* Get intmax_t.  */
+#include <stdint.h>
+
+/* malloc(), realloc(), free().  */
+#include <stdlib.h>
+
+/* memcpy().  */
+#include <string.h>
+
+/* errno.  */
+#include <errno.h>
+
+/* Checked size_t computations.  */
+#include "xsize.h"
+
+#if CHAR_T_ONLY_ASCII
+/* c_isascii().  */
+# include "c-ctype.h"
+#endif
+
+#ifdef STATIC
+STATIC
+#endif
+int
+PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
+{
+  const CHAR_T *cp = format;    /* pointer into format */
+  size_t arg_posn = 0;          /* number of regular arguments consumed */
+  size_t d_allocated;           /* allocated elements of d->dir */
+  size_t a_allocated;           /* allocated elements of a->arg */
+  size_t max_width_length = 0;
+  size_t max_precision_length = 0;
+
+  d->count = 0;
+  d_allocated = N_DIRECT_ALLOC_DIRECTIVES;
+  d->dir = d->direct_alloc_dir;
+
+  a->count = 0;
+  a_allocated = N_DIRECT_ALLOC_ARGUMENTS;
+  a->arg = a->direct_alloc_arg;
+
+#define REGISTER_ARG(_index_,_type_) \
+  {                                                                     \
+    size_t n = (_index_);                                               \
+    if (n >= a_allocated)                                               \
+      {                                                                 \
+        size_t memory_size;                                             \
+        argument *memory;                                               \
+                                                                        \
+        a_allocated = xtimes (a_allocated, 2);                          \
+        if (a_allocated <= n)                                           \
+          a_allocated = xsum (n, 1);                                    \
+        memory_size = xtimes (a_allocated, sizeof (argument));          \
+        if (size_overflow_p (memory_size))                              \
+          /* Overflow, would lead to out of memory.  */                 \
+          goto out_of_memory;                                           \
+        memory = (argument *) (a->arg != a->direct_alloc_arg            \
+                               ? realloc (a->arg, memory_size)          \
+                               : malloc (memory_size));                 \
+        if (memory == NULL)                                             \
+          /* Out of memory.  */                                         \
+          goto out_of_memory;                                           \
+        if (a->arg == a->direct_alloc_arg)                              \
+          memcpy (memory, a->arg, a->count * sizeof (argument));        \
+        a->arg = memory;                                                \
+      }                                                                 \
+    while (a->count <= n)                                               \
+      a->arg[a->count++].type = TYPE_NONE;                              \
+    if (a->arg[n].type == TYPE_NONE)                                    \
+      a->arg[n].type = (_type_);                                        \
+    else if (a->arg[n].type != (_type_))                                \
+      /* Ambiguous type for positional argument.  */                    \
+      goto error;                                                       \
+  }
+
+  while (*cp != '\0')
+    {
+      CHAR_T c = *cp++;
+      if (c == '%')
+        {
+          size_t arg_index = ARG_NONE;
+          DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
+
+          /* Initialize the next directive.  */
+          dp->dir_start = cp - 1;
+          dp->flags = 0;
+          dp->width_start = NULL;
+          dp->width_end = NULL;
+          dp->width_arg_index = ARG_NONE;
+          dp->precision_start = NULL;
+          dp->precision_end = NULL;
+          dp->precision_arg_index = ARG_NONE;
+          dp->arg_index = ARG_NONE;
+
+          /* Test for positional argument.  */
+          if (*cp >= '0' && *cp <= '9')
+            {
+              const CHAR_T *np;
+
+              for (np = cp; *np >= '0' && *np <= '9'; np++)
+                ;
+              if (*np == '$')
+                {
+                  size_t n = 0;
+
+                  for (np = cp; *np >= '0' && *np <= '9'; np++)
+                    n = xsum (xtimes (n, 10), *np - '0');
+                  if (n == 0)
+                    /* Positional argument 0.  */
+                    goto error;
+                  if (size_overflow_p (n))
+                    /* n too large, would lead to out of memory later.  */
+                    goto error;
+                  arg_index = n - 1;
+                  cp = np + 1;
+                }
+            }
+
+          /* Read the flags.  */
+          for (;;)
+            {
+              if (*cp == '\'')
+                {
+                  dp->flags |= FLAG_GROUP;
+                  cp++;
+                }
+              else if (*cp == '-')
+                {
+                  dp->flags |= FLAG_LEFT;
+                  cp++;
+                }
+              else if (*cp == '+')
+                {
+                  dp->flags |= FLAG_SHOWSIGN;
+                  cp++;
+                }
+              else if (*cp == ' ')
+                {
+                  dp->flags |= FLAG_SPACE;
+                  cp++;
+                }
+              else if (*cp == '#')
+                {
+                  dp->flags |= FLAG_ALT;
+                  cp++;
+                }
+              else if (*cp == '0')
+                {
+                  dp->flags |= FLAG_ZERO;
+                  cp++;
+                }
+#if __GLIBC__ >= 2 && !defined __UCLIBC__
+              else if (*cp == 'I')
+                {
+                  dp->flags |= FLAG_LOCALIZED;
+                  cp++;
+                }
+#endif
+              else
+                break;
+            }
+
+          /* Parse the field width.  */
+          if (*cp == '*')
+            {
+              dp->width_start = cp;
+              cp++;
+              dp->width_end = cp;
+              if (max_width_length < 1)
+                max_width_length = 1;
+
+              /* Test for positional argument.  */
+              if (*cp >= '0' && *cp <= '9')
+                {
+                  const CHAR_T *np;
+
+                  for (np = cp; *np >= '0' && *np <= '9'; np++)
+                    ;
+                  if (*np == '$')
+                    {
+                      size_t n = 0;
+
+                      for (np = cp; *np >= '0' && *np <= '9'; np++)
+                        n = xsum (xtimes (n, 10), *np - '0');
+                      if (n == 0)
+                        /* Positional argument 0.  */
+                        goto error;
+                      if (size_overflow_p (n))
+                        /* n too large, would lead to out of memory later.  */
+                        goto error;
+                      dp->width_arg_index = n - 1;
+                      cp = np + 1;
+                    }
+                }
+              if (dp->width_arg_index == ARG_NONE)
+                {
+                  dp->width_arg_index = arg_posn++;
+                  if (dp->width_arg_index == ARG_NONE)
+                    /* arg_posn wrapped around.  */
+                    goto error;
+                }
+              REGISTER_ARG (dp->width_arg_index, TYPE_INT);
+            }
+          else if (*cp >= '0' && *cp <= '9')
+            {
+              size_t width_length;
+
+              dp->width_start = cp;
+              for (; *cp >= '0' && *cp <= '9'; cp++)
+                ;
+              dp->width_end = cp;
+              width_length = dp->width_end - dp->width_start;
+              if (max_width_length < width_length)
+                max_width_length = width_length;
+            }
+
+          /* Parse the precision.  */
+          if (*cp == '.')
+            {
+              cp++;
+              if (*cp == '*')
+                {
+                  dp->precision_start = cp - 1;
+                  cp++;
+                  dp->precision_end = cp;
+                  if (max_precision_length < 2)
+                    max_precision_length = 2;
+
+                  /* Test for positional argument.  */
+                  if (*cp >= '0' && *cp <= '9')
+                    {
+                      const CHAR_T *np;
+
+                      for (np = cp; *np >= '0' && *np <= '9'; np++)
+                        ;
+                      if (*np == '$')
+                        {
+                          size_t n = 0;
+
+                          for (np = cp; *np >= '0' && *np <= '9'; np++)
+                            n = xsum (xtimes (n, 10), *np - '0');
+                          if (n == 0)
+                            /* Positional argument 0.  */
+                            goto error;
+                          if (size_overflow_p (n))
+                            /* n too large, would lead to out of memory
+                               later.  */
+                            goto error;
+                          dp->precision_arg_index = n - 1;
+                          cp = np + 1;
+                        }
+                    }
+                  if (dp->precision_arg_index == ARG_NONE)
+                    {
+                      dp->precision_arg_index = arg_posn++;
+                      if (dp->precision_arg_index == ARG_NONE)
+                        /* arg_posn wrapped around.  */
+                        goto error;
+                    }
+                  REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
+                }
+              else
+                {
+                  size_t precision_length;
+
+                  dp->precision_start = cp - 1;
+                  for (; *cp >= '0' && *cp <= '9'; cp++)
+                    ;
+                  dp->precision_end = cp;
+                  precision_length = dp->precision_end - dp->precision_start;
+                  if (max_precision_length < precision_length)
+                    max_precision_length = precision_length;
+                }
+            }
+
+          {
+            arg_type type;
+
+            /* Parse argument type/size specifiers.  */
+            /* Relevant for the conversion characters d, i.  */
+            arg_type signed_type = TYPE_INT;
+            /* Relevant for the conversion characters b, o, u, x, X.  */
+            arg_type unsigned_type = TYPE_UINT;
+            /* Relevant for the conversion characters n.  */
+            arg_type pointer_type = TYPE_COUNT_INT_POINTER;
+            /* Relevant for the conversion characters a, A, e, E, f, F, g, G.  */
+            arg_type floatingpoint_type = TYPE_DOUBLE;
+
+            if (*cp == 'h')
+              {
+                if (cp[1] == 'h')
+                  {
+                    signed_type = TYPE_SCHAR;
+                    unsigned_type = TYPE_UCHAR;
+                    pointer_type = TYPE_COUNT_SCHAR_POINTER;
+                    cp += 2;
+                  }
+                else
+                  {
+                    signed_type = TYPE_SHORT;
+                    unsigned_type = TYPE_USHORT;
+                    pointer_type = TYPE_COUNT_SHORT_POINTER;
+                    cp++;
+                  }
+              }
+            else if (*cp == 'l')
+              {
+                if (cp[1] == 'l')
+                  {
+                    signed_type = TYPE_LONGLONGINT;
+                    unsigned_type = TYPE_ULONGLONGINT;
+                    pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
+                    /* For backward compatibility only.  */
+                    floatingpoint_type = TYPE_LONGDOUBLE;
+                    cp += 2;
+                  }
+                else
+                  {
+                    signed_type = TYPE_LONGINT;
+                    unsigned_type = TYPE_ULONGINT;
+                    pointer_type = TYPE_COUNT_LONGINT_POINTER;
+                    cp++;
+                  }
+              }
+            else if (*cp == 'j')
+              {
+                if (sizeof (intmax_t) > sizeof (long))
+                  {
+                    /* intmax_t = long long */
+                    signed_type = TYPE_LONGLONGINT;
+                    unsigned_type = TYPE_ULONGLONGINT;
+                    pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
+                    /* For backward compatibility only.  */
+                    floatingpoint_type = TYPE_LONGDOUBLE;
+                  }
+                else if (sizeof (intmax_t) > sizeof (int))
+                  {
+                    /* intmax_t = long */
+                    signed_type = TYPE_LONGINT;
+                    unsigned_type = TYPE_ULONGINT;
+                    pointer_type = TYPE_COUNT_LONGINT_POINTER;
+                  }
+                cp++;
+              }
+            else if (*cp == 'z' || *cp == 'Z')
+              {
+                /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
+                   because the warning facility in gcc-2.95.2 understands
+                   only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).  */
+                if (sizeof (size_t) > sizeof (long))
+                  {
+                    /* size_t = unsigned long long */
+                    signed_type = TYPE_LONGLONGINT;
+                    unsigned_type = TYPE_ULONGLONGINT;
+                    pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
+                    /* For backward compatibility only.  */
+                    floatingpoint_type = TYPE_LONGDOUBLE;
+                  }
+                else if (sizeof (size_t) > sizeof (int))
+                  {
+                    /* size_t = unsigned long */
+                    signed_type = TYPE_LONGINT;
+                    unsigned_type = TYPE_ULONGINT;
+                    pointer_type = TYPE_COUNT_LONGINT_POINTER;
+                  }
+                cp++;
+              }
+            else if (*cp == 't')
+              {
+                if (sizeof (ptrdiff_t) > sizeof (long))
+                  {
+                    /* ptrdiff_t = long long */
+                    signed_type = TYPE_LONGLONGINT;
+                    unsigned_type = TYPE_ULONGLONGINT;
+                    pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
+                    /* For backward compatibility only.  */
+                    floatingpoint_type = TYPE_LONGDOUBLE;
+                  }
+                else if (sizeof (ptrdiff_t) > sizeof (int))
+                  {
+                    /* ptrdiff_t = long */
+                    signed_type = TYPE_LONGINT;
+                    unsigned_type = TYPE_ULONGINT;
+                    pointer_type = TYPE_COUNT_LONGINT_POINTER;
+                  }
+                cp++;
+              }
+            else if (*cp == 'w')
+              {
+                /* wN and wfN are standardized in ISO C 23.  */
+                if (cp[1] == 'f')
+                  {
+                    if (cp[2] == '8')
+                      {
+                        signed_type = TYPE_INT_FAST8_T;
+                        unsigned_type = TYPE_UINT_FAST8_T;
+                        pointer_type = TYPE_COUNT_INT_FAST8_T_POINTER;
+                        cp += 3;
+                      }
+                    else if (cp[2] == '1' && cp[3] == '6')
+                      {
+                        signed_type = TYPE_INT_FAST16_T;
+                        unsigned_type = TYPE_UINT_FAST16_T;
+                        pointer_type = TYPE_COUNT_INT_FAST16_T_POINTER;
+                        cp += 4;
+                      }
+                    else if (cp[2] == '3' && cp[3] == '2')
+                      {
+                        signed_type = TYPE_INT_FAST32_T;
+                        unsigned_type = TYPE_UINT_FAST32_T;
+                        pointer_type = TYPE_COUNT_INT_FAST32_T_POINTER;
+                        cp += 4;
+                      }
+                    else if (cp[2] == '6' && cp[3] == '4')
+                      {
+                        signed_type = TYPE_INT_FAST64_T;
+                        unsigned_type = TYPE_UINT_FAST64_T;
+                        pointer_type = TYPE_COUNT_INT_FAST64_T_POINTER;
+                        cp += 4;
+                      }
+                  }
+                else
+                  {
+                    if (cp[1] == '8')
+                      {
+                        signed_type = TYPE_INT8_T;
+                        unsigned_type = TYPE_UINT8_T;
+                        pointer_type = TYPE_COUNT_INT8_T_POINTER;
+                        cp += 2;
+                      }
+                    else if (cp[1] == '1' && cp[2] == '6')
+                      {
+                        signed_type = TYPE_INT16_T;
+                        unsigned_type = TYPE_UINT16_T;
+                        pointer_type = TYPE_COUNT_INT16_T_POINTER;
+                        cp += 3;
+                      }
+                    else if (cp[1] == '3' && cp[2] == '2')
+                      {
+                        signed_type = TYPE_INT32_T;
+                        unsigned_type = TYPE_UINT32_T;
+                        pointer_type = TYPE_COUNT_INT32_T_POINTER;
+                        cp += 3;
+                      }
+                    else if (cp[1] == '6' && cp[2] == '4')
+                      {
+                        signed_type = TYPE_INT64_T;
+                        unsigned_type = TYPE_UINT64_T;
+                        pointer_type = TYPE_COUNT_INT64_T_POINTER;
+                        cp += 3;
+                      }
+                  }
+              }
+            else if (*cp == 'L')
+              {
+                signed_type = TYPE_LONGLONGINT;
+                unsigned_type = TYPE_ULONGLONGINT;
+                pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
+                floatingpoint_type = TYPE_LONGDOUBLE;
+                cp++;
+              }
+#if defined __APPLE__ && defined __MACH__
+            /* On Mac OS X 10.3, PRIdMAX is defined as "qd".
+               We cannot change it to "lld" because PRIdMAX must also
+               be understood by the system's printf routines.  */
+            else if (*cp == 'q')
+              {
+                if (64 / 8 > sizeof (long))
+                  {
+                    /* int64_t = long long */
+                    signed_type = TYPE_LONGLONGINT;
+                    unsigned_type = TYPE_ULONGLONGINT;
+                    pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
+                    /* For backward compatibility only.  */
+                    floatingpoint_type = TYPE_LONGDOUBLE;
+                  }
+                else
+                  {
+                    /* int64_t = long */
+                    signed_type = TYPE_LONGINT;
+                    unsigned_type = TYPE_ULONGINT;
+                    pointer_type = TYPE_COUNT_LONGINT_POINTER;
+                  }
+                cp++;
+              }
+#endif
+#if defined _WIN32 && ! defined __CYGWIN__
+            /* On native Windows, PRIdMAX is defined as "I64d".
+               We cannot change it to "lld" because PRIdMAX must also
+               be understood by the system's printf routines.  */
+            else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
+              {
+                if (64 / 8 > sizeof (long))
+                  {
+                    /* __int64_t = long long */
+                    signed_type = TYPE_LONGLONGINT;
+                    unsigned_type = TYPE_ULONGLONGINT;
+                    pointer_type = TYPE_COUNT_LONGLONGINT_POINTER;
+                    /* For backward compatibility only.  */
+                    floatingpoint_type = TYPE_LONGDOUBLE;
+                  }
+                else
+                  {
+                    /* __int64_t = long */
+                    signed_type = TYPE_LONGINT;
+                    unsigned_type = TYPE_ULONGINT;
+                    pointer_type = TYPE_COUNT_LONGINT_POINTER;
+                  }
+                cp += 3;
+              }
+#endif
+
+            /* Read the conversion character.  */
+            c = *cp++;
+            switch (c)
+              {
+              case 'd': case 'i':
+                type = signed_type;
+                break;
+              case 'b': case 'o': case 'u': case 'x': case 'X':
+              #if SUPPORT_GNU_PRINTF_DIRECTIVES \
+                  || (__GLIBC__ + (__GLIBC_MINOR__ >= 35) > 2)
+              case 'B':
+              #endif
+                type = unsigned_type;
+                break;
+              case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
+              case 'a': case 'A':
+                type = floatingpoint_type;
+                break;
+              case 'c':
+                if (signed_type == TYPE_LONGINT
+                    /* For backward compatibility only.  */
+                    || signed_type == TYPE_LONGLONGINT)
+#if HAVE_WINT_T
+                  type = TYPE_WIDE_CHAR;
+#else
+                  goto error;
+#endif
+                else
+                  type = TYPE_CHAR;
+                break;
+#if HAVE_WINT_T
+              case 'C':
+                type = TYPE_WIDE_CHAR;
+                c = 'c';
+                break;
+#endif
+              case 's':
+                if (signed_type == TYPE_LONGINT
+                    /* For backward compatibility only.  */
+                    || signed_type == TYPE_LONGLONGINT)
+#if HAVE_WCHAR_T
+                  type = TYPE_WIDE_STRING;
+#else
+                  goto error;
+#endif
+                else
+                  type = TYPE_STRING;
+                break;
+#if HAVE_WCHAR_T
+              case 'S':
+                type = TYPE_WIDE_STRING;
+                c = 's';
+                break;
+#endif
+              case 'p':
+                type = TYPE_POINTER;
+                break;
+              case 'n':
+                type = pointer_type;
+                break;
+#if ENABLE_UNISTDIO
+              /* The unistdio extensions.  */
+              case 'U':
+                if (signed_type == TYPE_LONGLONGINT)
+                  type = TYPE_U32_STRING;
+                else if (signed_type == TYPE_LONGINT)
+                  type = TYPE_U16_STRING;
+                else
+                  type = TYPE_U8_STRING;
+                break;
+#endif
+              case '%':
+                type = TYPE_NONE;
+                break;
+              default:
+                /* Unknown conversion character.  */
+                goto error;
+              }
+
+            if (type != TYPE_NONE)
+              {
+                dp->arg_index = arg_index;
+                if (dp->arg_index == ARG_NONE)
+                  {
+                    dp->arg_index = arg_posn++;
+                    if (dp->arg_index == ARG_NONE)
+                      /* arg_posn wrapped around.  */
+                      goto error;
+                  }
+                REGISTER_ARG (dp->arg_index, type);
+              }
+            dp->conversion = c;
+            dp->dir_end = cp;
+          }
+
+          d->count++;
+          if (d->count >= d_allocated)
+            {
+              size_t memory_size;
+              DIRECTIVE *memory;
+
+              d_allocated = xtimes (d_allocated, 2);
+              memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
+              if (size_overflow_p (memory_size))
+                /* Overflow, would lead to out of memory.  */
+                goto out_of_memory;
+              memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir
+                                      ? realloc (d->dir, memory_size)
+                                      : malloc (memory_size));
+              if (memory == NULL)
+                /* Out of memory.  */
+                goto out_of_memory;
+              if (d->dir == d->direct_alloc_dir)
+                memcpy (memory, d->dir, d->count * sizeof (DIRECTIVE));
+              d->dir = memory;
+            }
+        }
+#if CHAR_T_ONLY_ASCII
+      else if (!c_isascii (c))
+        {
+          /* Non-ASCII character.  Not supported.  */
+          goto error;
+        }
+#endif
+    }
+  d->dir[d->count].dir_start = cp;
+
+  d->max_width_length = max_width_length;
+  d->max_precision_length = max_precision_length;
+  return 0;
+
+error:
+  if (a->arg != a->direct_alloc_arg)
+    free (a->arg);
+  if (d->dir != d->direct_alloc_dir)
+    free (d->dir);
+  errno = EINVAL;
+  return -1;
+
+out_of_memory:
+  if (a->arg != a->direct_alloc_arg)
+    free (a->arg);
+  if (d->dir != d->direct_alloc_dir)
+    free (d->dir);
+  errno = ENOMEM;
+  return -1;
+}
+
+#undef PRINTF_PARSE
+#undef DIRECTIVES
+#undef DIRECTIVE
+#undef CHAR_T_ONLY_ASCII
+#undef CHAR_T
deleted file mode 120000 (symlink)
index 7638e47fdf5861e12763992e3c39b32cdb9b9bbc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/printf-parse.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..949b8754cc2f9c08101bc574e0633987cd60b7ba
--- /dev/null
@@ -0,0 +1,193 @@
+/* Parse printf format string.
+   Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _PRINTF_PARSE_H
+#define _PRINTF_PARSE_H
+
+/* This file can be parametrized with the following macros:
+     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
+     STATIC             Set to 'static' to declare the function static.  */
+
+#if HAVE_FEATURES_H
+# include <features.h> /* for __GLIBC__, __UCLIBC__ */
+#endif
+
+#include "printf-args.h"
+
+
+/* Flags */
+#define FLAG_GROUP       1      /* ' flag */
+#define FLAG_LEFT        2      /* - flag */
+#define FLAG_SHOWSIGN    4      /* + flag */
+#define FLAG_SPACE       8      /* space flag */
+#define FLAG_ALT        16      /* # flag */
+#define FLAG_ZERO       32
+#if __GLIBC__ >= 2 && !defined __UCLIBC__
+# define FLAG_LOCALIZED 64      /* I flag, uses localized digits */
+#endif
+
+/* arg_index value indicating that no argument is consumed.  */
+#define ARG_NONE        (~(size_t)0)
+
+/* xxx_directive: A parsed directive.
+   xxx_directives: A parsed format string.  */
+
+/* Number of directly allocated directives (no malloc() needed).  */
+#define N_DIRECT_ALLOC_DIRECTIVES 7
+
+/* A parsed directive.  */
+typedef struct
+{
+  const char* dir_start;
+  const char* dir_end;
+  int flags;
+  const char* width_start;
+  const char* width_end;
+  size_t width_arg_index;
+  const char* precision_start;
+  const char* precision_end;
+  size_t precision_arg_index;
+  char conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */
+  size_t arg_index;
+}
+char_directive;
+
+/* A parsed format string.  */
+typedef struct
+{
+  size_t count;
+  char_directive *dir;
+  size_t max_width_length;
+  size_t max_precision_length;
+  char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
+}
+char_directives;
+
+#if ENABLE_UNISTDIO
+
+/* A parsed directive.  */
+typedef struct
+{
+  const uint8_t* dir_start;
+  const uint8_t* dir_end;
+  int flags;
+  const uint8_t* width_start;
+  const uint8_t* width_end;
+  size_t width_arg_index;
+  const uint8_t* precision_start;
+  const uint8_t* precision_end;
+  size_t precision_arg_index;
+  uint8_t conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */
+  size_t arg_index;
+}
+u8_directive;
+
+/* A parsed format string.  */
+typedef struct
+{
+  size_t count;
+  u8_directive *dir;
+  size_t max_width_length;
+  size_t max_precision_length;
+  u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
+}
+u8_directives;
+
+/* A parsed directive.  */
+typedef struct
+{
+  const uint16_t* dir_start;
+  const uint16_t* dir_end;
+  int flags;
+  const uint16_t* width_start;
+  const uint16_t* width_end;
+  size_t width_arg_index;
+  const uint16_t* precision_start;
+  const uint16_t* precision_end;
+  size_t precision_arg_index;
+  uint16_t conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */
+  size_t arg_index;
+}
+u16_directive;
+
+/* A parsed format string.  */
+typedef struct
+{
+  size_t count;
+  u16_directive *dir;
+  size_t max_width_length;
+  size_t max_precision_length;
+  u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
+}
+u16_directives;
+
+/* A parsed directive.  */
+typedef struct
+{
+  const uint32_t* dir_start;
+  const uint32_t* dir_end;
+  int flags;
+  const uint32_t* width_start;
+  const uint32_t* width_end;
+  size_t width_arg_index;
+  const uint32_t* precision_start;
+  const uint32_t* precision_end;
+  size_t precision_arg_index;
+  uint32_t conversion; /* d i b B o u x X f F e E g G a A c s p n U % but not C S */
+  size_t arg_index;
+}
+u32_directive;
+
+/* A parsed format string.  */
+typedef struct
+{
+  size_t count;
+  u32_directive *dir;
+  size_t max_width_length;
+  size_t max_precision_length;
+  u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
+}
+u32_directives;
+
+#endif
+
+
+/* Parses the format string.  Fills in the number N of directives, and fills
+   in directives[0], ..., directives[N-1], and sets directives[N].dir_start
+   to the end of the format string.  Also fills in the arg_type fields of the
+   arguments and the needed count of arguments.  */
+#if ENABLE_UNISTDIO
+extern int
+       ulc_printf_parse (const char *format, char_directives *d, arguments *a);
+extern int
+       u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
+extern int
+       u16_printf_parse (const uint16_t *format, u16_directives *d,
+                         arguments *a);
+extern int
+       u32_printf_parse (const uint32_t *format, u32_directives *d,
+                         arguments *a);
+#else
+# ifdef STATIC
+STATIC
+# else
+extern
+# endif
+int printf_parse (const char *format, char_directives *d, arguments *a);
+#endif
+
+#endif /* _PRINTF_PARSE_H */
deleted file mode 120000 (symlink)
index f4600d752b11bde2d679ee7230c235ef11666e75..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/priv-set.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2731bc963cd5f5c2a131515a24eb4e1282f227e2
--- /dev/null
@@ -0,0 +1,144 @@
+/* Query, remove, or restore a Solaris privilege.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by David Bartley.  */
+
+#include <config.h>
+
+#define PRIV_SET_INLINE _GL_EXTERN_INLINE
+
+#include "priv-set.h"
+
+#if HAVE_GETPPRIV && HAVE_PRIV_H
+
+# include <errno.h>
+# include <priv.h>
+
+/* Holds a (cached) copy of the effective set.  */
+static priv_set_t *eff_set;
+
+/* Holds a set of privileges that we have removed.  */
+static priv_set_t *rem_set;
+
+static bool initialized;
+
+static int
+priv_set_initialize (void)
+{
+  if (! initialized)
+    {
+      eff_set = priv_allocset ();
+      if (!eff_set)
+        {
+          return -1;
+        }
+      rem_set = priv_allocset ();
+      if (!rem_set)
+        {
+          priv_freeset (eff_set);
+          return -1;
+        }
+      if (getppriv (PRIV_EFFECTIVE, eff_set) != 0)
+        {
+          priv_freeset (eff_set);
+          priv_freeset (rem_set);
+          return -1;
+        }
+      priv_emptyset (rem_set);
+      initialized = true;
+    }
+
+  return 0;
+}
+
+
+/* Check if priv is in the effective set.
+   Returns 1 if priv is a member and 0 if not.
+   Returns -1 on error with errno set appropriately.  */
+int
+priv_set_ismember (const char *priv)
+{
+  if (! initialized && priv_set_initialize () != 0)
+    return -1;
+
+  return priv_ismember (eff_set, priv);
+}
+
+
+/* Try to remove priv from the effective set.
+   Returns 0 if priv was removed.
+   Returns -1 on error with errno set appropriately.  */
+int
+priv_set_remove (const char *priv)
+{
+  if (! initialized && priv_set_initialize () != 0)
+    return -1;
+
+  if (priv_ismember (eff_set, priv))
+    {
+      /* priv_addset/priv_delset can only fail if priv is invalid, which is
+         checked above by the priv_ismember call.  */
+      priv_delset (eff_set, priv);
+      if (setppriv (PRIV_SET, PRIV_EFFECTIVE, eff_set) != 0)
+        {
+          priv_addset (eff_set, priv);
+          return -1;
+        }
+      priv_addset (rem_set, priv);
+    }
+  else
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  return 0;
+}
+
+
+/* Try to restore priv to the effective set.
+   Returns 0 if priv was re-added to the effective set (after being previously
+   removed by a call to priv_set_remove).
+   Returns -1 on error with errno set appropriately.  */
+int
+priv_set_restore (const char *priv)
+{
+  if (! initialized && priv_set_initialize () != 0)
+    return -1;
+
+  if (priv_ismember (rem_set, priv))
+    {
+      /* priv_addset/priv_delset can only fail if priv is invalid, which is
+         checked above by the priv_ismember call.  */
+      priv_addset (eff_set, priv);
+      if (setppriv (PRIV_SET, PRIV_EFFECTIVE, eff_set) != 0)
+        {
+          priv_delset (eff_set, priv);
+          return -1;
+        }
+      priv_delset (rem_set, priv);
+    }
+  else
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  return 0;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 6218ba1318714dba3ccf787283e5ad686701ec66..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/priv-set.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3f040e9e274fb4cb0af5b8a08ec612617deb72a2
--- /dev/null
@@ -0,0 +1,67 @@
+/* Query, remove, or restore a Solaris privilege.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by David Bartley.  */
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, HAVE_PRIV_H,
+   HAVE_GETPPRIV.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef PRIV_SET_INLINE
+# define PRIV_SET_INLINE _GL_INLINE
+#endif
+
+#if HAVE_GETPPRIV && HAVE_PRIV_H
+
+# include <priv.h>
+
+int priv_set_ismember (const char *priv);
+int priv_set_remove (const char *priv);
+int priv_set_restore (const char *priv);
+
+PRIV_SET_INLINE int
+priv_set_remove_linkdir (void)
+{
+  return priv_set_remove (PRIV_SYS_LINKDIR);
+}
+
+PRIV_SET_INLINE int
+priv_set_restore_linkdir (void)
+{
+  return priv_set_restore (PRIV_SYS_LINKDIR);
+}
+
+#else
+
+PRIV_SET_INLINE int
+priv_set_remove_linkdir (void)
+{
+  return -1;
+}
+
+PRIV_SET_INLINE int
+priv_set_restore_linkdir (void)
+{
+  return -1;
+}
+
+#endif
+
+_GL_INLINE_HEADER_END
deleted file mode 120000 (symlink)
index 603f589cd4a62dbbeebd4c218d6c9f46b9a4cd92..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/progname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..db17f5b20854835d8e48be45ba457aa20414b6b2
--- /dev/null
@@ -0,0 +1,92 @@
+/* Program name management.
+   Copyright (C) 2001-2003, 2005-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2001.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+
+#include <config.h>
+
+/* Specification.  */
+#undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */
+#include "progname.h"
+
+#include <errno.h> /* get program_invocation_name declaration */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* String containing name the program is called with.
+   To be initialized by main().  */
+const char *program_name = NULL;
+
+/* Set program_name, based on argv[0].
+   argv0 must be a string allocated with indefinite extent, and must not be
+   modified after this call.  */
+void
+set_program_name (const char *argv0)
+{
+  /* libtool creates a temporary executable whose name is sometimes prefixed
+     with "lt-" (depends on the platform).  It also makes argv[0] absolute.
+     But the name of the temporary executable is a detail that should not be
+     visible to the end user and to the test suite.
+     Remove this "<dirname>/.libs/" or "<dirname>/.libs/lt-" prefix here.  */
+  const char *slash;
+  const char *base;
+
+  /* Sanity check.  POSIX requires the invoking process to pass a non-NULL
+     argv[0].  */
+  if (argv0 == NULL)
+    {
+      /* It's a bug in the invoking program.  Help diagnosing it.  */
+      fputs ("A NULL argv[0] was passed through an exec system call.\n",
+             stderr);
+      abort ();
+    }
+
+  slash = strrchr (argv0, '/');
+  base = (slash != NULL ? slash + 1 : argv0);
+  if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0)
+    {
+      argv0 = base;
+      if (strncmp (base, "lt-", 3) == 0)
+        {
+          argv0 = base + 3;
+          /* On glibc systems, remove the "lt-" prefix from the variable
+             program_invocation_short_name.  */
+#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+          program_invocation_short_name = (char *) argv0;
+#endif
+        }
+    }
+
+  /* But don't strip off a leading <dirname>/ in general, because when the user
+     runs
+         /some/hidden/place/bin/cp foo foo
+     he should get the error message
+         /some/hidden/place/bin/cp: `foo' and `foo' are the same file
+     not
+         cp: `foo' and `foo' are the same file
+   */
+
+  program_name = argv0;
+
+  /* On glibc systems, the error() function comes from libc and uses the
+     variable program_invocation_name, not program_name.  So set this variable
+     as well.  */
+#if HAVE_DECL_PROGRAM_INVOCATION_NAME
+  program_invocation_name = (char *) argv0;
+#endif
+}
deleted file mode 120000 (symlink)
index 1cc9d6bc3fb375c9c40ca7f3c4bb2d8bf54c3321..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/progname.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a61872bfc344d7bfedbb1d96b6b2411bfbbc5b3b
--- /dev/null
@@ -0,0 +1,62 @@
+/* Program name management.
+   Copyright (C) 2001-2004, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2001.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _PROGNAME_H
+#define _PROGNAME_H
+
+/* Programs using this file should do the following in main():
+     set_program_name (argv[0]);
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* String containing name the program is called with.  */
+extern const char *program_name;
+
+/* Set program_name, based on argv[0].
+   argv0 must be a string allocated with indefinite extent, and must not be
+   modified after this call.  */
+extern void set_program_name (const char *argv0);
+
+#if ENABLE_RELOCATABLE
+
+/* Set program_name, based on argv[0], and original installation prefix and
+   directory, for relocatability.  */
+extern void set_program_name_and_installdir (const char *argv0,
+                                             const char *orig_installprefix,
+                                             const char *orig_installdir);
+#undef set_program_name
+#define set_program_name(ARG0) \
+  set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR)
+
+/* Return the full pathname of the current executable, based on the earlier
+   call to set_program_name_and_installdir.  Return NULL if unknown.  */
+extern char *get_full_program_name (void);
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _PROGNAME_H */
deleted file mode 120000 (symlink)
index f905754e334722980961e83ac41d8202207623b1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/propername-lite.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7694a11671233c9bc61d28e3f48139ebbc8600ff
--- /dev/null
@@ -0,0 +1,36 @@
+/* Localization of proper names.
+   Copyright 2023-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "propername.h"
+
+#include "c-strcase.h"
+#include "gettext.h"
+#include "localcharset.h"
+
+/* Return the localization of the name spelled NAME_ASCII in ASCII,
+   and NAME_UTF8 in UTF-8.  */
+
+char const *
+proper_name_lite (char const *name_ascii, char const *name_utf8)
+{
+  char const *translation = gettext (name_ascii);
+  return (translation != name_ascii ? translation
+          : c_strcasecmp (locale_charset (), "UTF-8") == 0 ? name_utf8
+          : name_ascii);
+}
deleted file mode 120000 (symlink)
index 63abdcbe6ad6c61acaae40c1c6874afbbadff232..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/propername.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6247a991389a069ba1116059e24ff15d358f9fba
--- /dev/null
@@ -0,0 +1,134 @@
+/* Localization of proper names.  -*- coding: utf-8 -*-
+   Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2006.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* INTRODUCTION
+
+   What do
+
+      Torbjörn Granlund    (coreutils)
+      François Pinard      (coreutils)
+      Danilo Šegan         (gettext)
+
+   have in common?
+
+   A non-ASCII name. This causes trouble in the --version output. The simple
+   "solution" unfortunately mutilates the name.
+
+     $ du --version | grep Granlund
+     Écrit par Torbjorn Granlund, David MacKenzie, Paul Eggert et Jim Meyering.
+
+     $ ptx --version | grep Pinard
+     Écrit par F. Pinard.
+
+   What is desirable, is to print the full name if the output character set
+   allows it, and the ASCIIfied name only as a fallback.
+
+     $ recode-sr-latin --version
+     ...
+     Written by Danilo Šegan and Bruno Haible.
+
+     $ LC_ALL=C recode-sr-latin --version
+     ...
+     Written by Danilo Segan and Bruno Haible.
+
+   The 'propername' and 'propername-lite' modules do this. Plus, for
+   languages that do not use the Latin alphabet, they allow a translator
+   to write the name using that different writing system. In that case the
+   propername and propername_utf8 output will look like this:
+      <translated name> (<original name in English>)
+   whereas the propername_lite output will just be the translated name
+   if available, otherwise the original name (in UTF-8 if possible and
+   in ASCII if not).
+
+   To use the 'propername' module requires two simple steps:
+
+     1) Add it to the list of gnulib modules to import,
+
+     2) Change the arguments of version_etc(),
+
+          from "Paul Eggert"
+          to   proper_name ("Paul Eggert")
+
+          from "Torbjorn Granlund"
+          to   proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund")
+          or   proper_name_lite ("Torbjorn Granlund", "Torbj\303\266rn Granlund")
+
+          from "F. Pinard"
+          to   proper_name_utf8 ("Franc,ois Pinard", "Fran\303\247ois Pinard")
+          or   proper_name_lite ("Franc,ois Pinard", "Fran\303\247ois Pinard")
+
+        In source code, the second argument of proper_name_lite and
+        proper_name_utf8 should use octal escapes, not UTF-8 - e.g.,
+        "Fran\303\247ois Pinard", not "François Pinard".  Doing it
+        this way can avoid mishandling non-ASCII characters if the
+        source is recoded to non-UTF-8, or if the compiler does not
+        treat UTF-8 as-is in character string contents.
+
+        (Optionally, here you can also add / * TRANSLATORS: ... * / comments
+        explaining how the name is written or pronounced.)
+
+   Here is an example in context.
+
+              char const *author_names[2] = {
+                / * TRANSLATORS: This is the proper name "Danilo Šegan".
+                    In the original Cyrillic it is "Данило Шеган".  * /
+                proper_name_utf8 ("Danilo Segan", "Danilo \305\240egan"),
+                proper_name ("Bruno Haible")
+              };
+
+   Differences between proper_name_utf8 and proper_name_lite:
+   * proper_name_lite uses the localization provided by the translator.
+     If there is no localization, it uses the name with Unicode characters
+     only in UTF-8 locales, otherwise it uses the original name in English.
+   * proper_name_utf8 is more elaborate:
+     - It uses the name with Unicode characters also when the locale encoding
+       is not UTF-8 but contains the necessary characters (e.g. ISO-8859-x or
+       GB18030).
+     - If there is a localization, it produces a better result when the
+       translator has given a poor localization.
+ */
+
+#ifndef _PROPERNAME_H
+#define _PROPERNAME_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Return the localization of NAME.  NAME is written in ASCII.  */
+extern const char * proper_name (const char *name) /* NOT attribute const */;
+
+/* Return the localization of a name whose original writing is not ASCII.
+   NAME_UTF8 is the real name, written in UTF-8 with octal or hexadecimal
+   escape sequences.  NAME_ASCII is a fallback written only with ASCII
+   characters.  */
+extern const char * proper_name_utf8 (const char *name_ascii,
+                                      const char *name_utf8);
+
+/* Return the localization of the name spelled NAME_ASCII in ASCII,
+   and NAME_UTF8 in UTF-8.  This function needs less infrastructure
+   than proper_name and proper_name_utf8.  */
+extern const char *proper_name_lite (const char *name_ascii,
+                                     const char *name_utf8);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _PROPERNAME_H */
deleted file mode 120000 (symlink)
index 975b28e42ff42f7e81b4401c7dc81d94fde56bfe..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pselect.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..54732e5cce35aea1bbb123b865ec92eec85699ce
--- /dev/null
@@ -0,0 +1,118 @@
+/* pselect - synchronous I/O multiplexing
+
+   Copyright 2011-2024 Free Software Foundation, Inc.
+
+   This file is part of gnulib.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+#include <config.h>
+
+#include <sys/select.h>
+
+#include <errno.h>
+#include <signal.h>
+
+/* Examine the size-NFDS file descriptor sets in RFDS, WFDS, and XFDS
+   to see whether some of their descriptors are ready for reading,
+   ready for writing, or have exceptions pending.  Wait for at most
+   TIMEOUT seconds, and use signal mask SIGMASK while waiting.  A null
+   pointer parameter stands for no descriptors, an infinite timeout,
+   or an unaffected signal mask.  */
+
+#if !HAVE_PSELECT
+
+int
+pselect (int nfds, fd_set *restrict rfds,
+         fd_set *restrict wfds, fd_set *restrict xfds,
+         struct timespec const *restrict timeout,
+         sigset_t const *restrict sigmask)
+{
+  int select_result;
+  sigset_t origmask;
+  struct timeval tv, *tvp;
+
+  if (nfds < 0 || nfds > FD_SETSIZE)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if (timeout)
+    {
+      if (! (0 <= timeout->tv_nsec && timeout->tv_nsec < 1000000000))
+        {
+          errno = EINVAL;
+          return -1;
+        }
+
+      tv = (struct timeval) {
+        .tv_sec = timeout->tv_sec,
+        .tv_usec = (timeout->tv_nsec + 999) / 1000
+      };
+      tvp = &tv;
+    }
+  else
+    tvp = NULL;
+
+  /* Signal mask munging should be atomic, but this is the best we can
+     do in this emulation.  */
+  if (sigmask)
+    pthread_sigmask (SIG_SETMASK, sigmask, &origmask);
+
+  select_result = select (nfds, rfds, wfds, xfds, tvp);
+
+  if (sigmask)
+    {
+      int select_errno = errno;
+      pthread_sigmask (SIG_SETMASK, &origmask, NULL);
+      errno = select_errno;
+    }
+
+  return select_result;
+}
+
+#else /* HAVE_PSELECT */
+# include <unistd.h>
+# undef pselect
+
+int
+rpl_pselect (int nfds, fd_set *restrict rfds,
+             fd_set *restrict wfds, fd_set *restrict xfds,
+             struct timespec const *restrict timeout,
+             sigset_t const *restrict sigmask)
+{
+  int i;
+
+  /* FreeBSD 8.2 has a bug: it does not always detect invalid fds.  */
+  if (nfds < 0 || nfds > FD_SETSIZE)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  for (i = 0; i < nfds; i++)
+    {
+      if (((rfds && FD_ISSET (i, rfds))
+           || (wfds && FD_ISSET (i, wfds))
+           || (xfds && FD_ISSET (i, xfds)))
+          && dup2 (i, i) != i)
+        return -1;
+    }
+
+  return pselect (nfds, rfds, wfds, xfds, timeout, sigmask);
+}
+
+#endif
deleted file mode 120000 (symlink)
index c7b6d6199503b5a799cbd56b3f14ca88138b734d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pthread-cond.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..380cdfd3576d04aa9e405b0070d054cfd687d045
--- /dev/null
@@ -0,0 +1,199 @@
+/* POSIX condition variables.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, 2010, and Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <pthread.h>
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# include "windows-thread.h"
+#else
+# include <errno.h>
+# include <limits.h>
+# include <sys/time.h>
+# include <time.h>
+#endif
+
+#if ((defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS) || !HAVE_PTHREAD_H
+
+int
+pthread_condattr_init (pthread_condattr_t *attr)
+{
+  *attr = 0;
+  return 0;
+}
+
+int
+pthread_condattr_destroy (_GL_UNUSED pthread_condattr_t *attr)
+{
+  return 0;
+}
+
+#endif
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+/* Use Windows threads.  */
+
+int
+pthread_cond_init (pthread_cond_t *cond,
+                   _GL_UNUSED const pthread_condattr_t *attr)
+{
+  return glwthread_cond_init (cond);
+}
+
+int
+pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
+{
+  return glwthread_cond_wait (cond, mutex,
+                              (int (*) (void *)) pthread_mutex_lock,
+                              (int (*) (void *)) pthread_mutex_unlock);
+}
+
+int
+pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
+                        const struct timespec *abstime)
+{
+  return glwthread_cond_timedwait (cond, mutex,
+                                   (int (*) (void *)) pthread_mutex_lock,
+                                   (int (*) (void *)) pthread_mutex_unlock,
+                                   abstime);
+}
+
+int
+pthread_cond_signal (pthread_cond_t *cond)
+{
+  return glwthread_cond_signal (cond);
+}
+
+int
+pthread_cond_broadcast (pthread_cond_t *cond)
+{
+  return glwthread_cond_broadcast (cond);
+}
+
+int
+pthread_cond_destroy (pthread_cond_t *cond)
+{
+  return glwthread_cond_destroy (cond);
+}
+
+#elif HAVE_PTHREAD_H
+/* Provide workarounds for POSIX threads.  */
+
+#else
+/* Provide a dummy implementation for single-threaded applications.  */
+
+int
+pthread_cond_init (_GL_UNUSED pthread_cond_t *cond,
+                   _GL_UNUSED const pthread_condattr_t *attr)
+{
+  /* COND is never seriously used.  */
+  return 0;
+}
+
+int
+pthread_cond_wait (_GL_UNUSED pthread_cond_t *cond,
+                   _GL_UNUSED pthread_mutex_t *mutex)
+{
+  /* No other thread can signal this condition variable.
+     Wait endlessly.  */
+  for (;;)
+    {
+      struct timespec duration =
+        {
+          .tv_sec = 86400,
+          .tv_nsec = 0
+        };
+      nanosleep (&duration, NULL);
+    }
+}
+
+int
+pthread_cond_timedwait (_GL_UNUSED pthread_cond_t *cond,
+                        _GL_UNUSED pthread_mutex_t *mutex,
+                        const struct timespec *abstime)
+{
+  /* No other thread can signal this condition variable.
+     Wait until ABSTIME is reached.  */
+  for (;;)
+    {
+      struct timeval currtime;
+      unsigned long remaining;
+
+      gettimeofday (&currtime, NULL);
+
+      if (currtime.tv_sec > abstime->tv_sec)
+        remaining = 0;
+      else
+        {
+          unsigned long seconds = abstime->tv_sec - currtime.tv_sec;
+          remaining = seconds * 1000000000;
+          if (remaining / 1000000000 != seconds) /* overflow? */
+            remaining = ULONG_MAX;
+          else
+            {
+              long nanoseconds =
+                abstime->tv_nsec - currtime.tv_usec * 1000;
+              if (nanoseconds >= 0)
+                {
+                  remaining += nanoseconds;
+                  if (remaining < nanoseconds) /* overflow? */
+                    remaining = ULONG_MAX;
+                }
+              else
+                {
+                  if (remaining >= - nanoseconds)
+                    remaining -= (- nanoseconds);
+                  else
+                    remaining = 0;
+                }
+            }
+        }
+      if (remaining == 0)
+        return ETIMEDOUT;
+
+      /* Sleep up to REMAINING ns.  */
+      struct timespec duration = { .tv_sec  = remaining / 1000000000,
+                                   .tv_nsec = remaining % 1000000000 };
+      nanosleep (&duration, NULL);
+    }
+}
+
+int
+pthread_cond_signal (_GL_UNUSED pthread_cond_t *cond)
+{
+  /* No threads can currently be blocked on COND.  */
+  return 0;
+}
+
+int
+pthread_cond_broadcast (_GL_UNUSED pthread_cond_t *cond)
+{
+  /* No threads can currently be blocked on COND.  */
+  return 0;
+}
+
+int
+pthread_cond_destroy (_GL_UNUSED pthread_cond_t *cond)
+{
+  /* COND is never seriously used.  */
+  return 0;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 8186b5b75e1dedb1295b193559e518158676d986..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pthread-mutex.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9036c00b56d7b03d5db366ccbfcf1ef5e0955504
--- /dev/null
@@ -0,0 +1,258 @@
+/* POSIX mutexes (locks).
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, 2010, and Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <pthread.h>
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# include "windows-timedmutex.h"
+# include "windows-timedrecmutex.h"
+#else
+# include <stdlib.h>
+#endif
+
+#if ((defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS) || !HAVE_PTHREAD_H
+
+int
+pthread_mutexattr_init (pthread_mutexattr_t *attr)
+{
+  *attr = (PTHREAD_MUTEX_STALLED << 2) | PTHREAD_MUTEX_DEFAULT;
+  return 0;
+}
+
+int
+pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *typep)
+{
+  *typep = *attr & (PTHREAD_MUTEX_DEFAULT | PTHREAD_MUTEX_NORMAL
+                    | PTHREAD_MUTEX_ERRORCHECK | PTHREAD_MUTEX_RECURSIVE);
+  return 0;
+}
+
+int
+pthread_mutexattr_settype (pthread_mutexattr_t *attr, int type)
+{
+  if (!(type == PTHREAD_MUTEX_DEFAULT
+        || type == PTHREAD_MUTEX_NORMAL
+        || type == PTHREAD_MUTEX_ERRORCHECK
+        || type == PTHREAD_MUTEX_RECURSIVE))
+    return EINVAL;
+  *attr ^= (*attr ^ type)
+           & (PTHREAD_MUTEX_DEFAULT | PTHREAD_MUTEX_NORMAL
+              | PTHREAD_MUTEX_ERRORCHECK | PTHREAD_MUTEX_RECURSIVE);
+  return 0;
+}
+
+int
+pthread_mutexattr_getrobust (const pthread_mutexattr_t *attr, int *robustp)
+{
+  *robustp = (*attr >> 2) & (PTHREAD_MUTEX_STALLED | PTHREAD_MUTEX_ROBUST);
+  return 0;
+}
+
+int
+pthread_mutexattr_setrobust (pthread_mutexattr_t *attr, int robust)
+{
+  if (!(robust == PTHREAD_MUTEX_STALLED || robust == PTHREAD_MUTEX_ROBUST))
+    return EINVAL;
+  *attr ^= (*attr ^ (robust << 2))
+           & ((PTHREAD_MUTEX_STALLED | PTHREAD_MUTEX_ROBUST) << 2);
+  return 0;
+}
+
+int
+pthread_mutexattr_destroy (_GL_UNUSED pthread_mutexattr_t *attr)
+{
+  return 0;
+}
+
+#elif PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED
+
+int
+pthread_mutexattr_getrobust (const pthread_mutexattr_t *attr, int *robustp)
+{
+  *robustp = PTHREAD_MUTEX_STALLED;
+  return 0;
+}
+
+int
+pthread_mutexattr_setrobust (pthread_mutexattr_t *attr, int robust)
+{
+  if (!(robust == PTHREAD_MUTEX_STALLED || robust == PTHREAD_MUTEX_ROBUST))
+    return EINVAL;
+  if (!(robust == PTHREAD_MUTEX_STALLED))
+    return ENOTSUP;
+  return 0;
+}
+
+#endif
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+/* Use Windows threads.  */
+
+int
+pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
+{
+  /* This implementation does not support PTHREAD_MUTEX_ERRORCHECK
+     and ignores the 'robust' attribute.  */
+  if (attr != NULL
+      && (*attr & (PTHREAD_MUTEX_DEFAULT | PTHREAD_MUTEX_NORMAL
+                   | PTHREAD_MUTEX_ERRORCHECK | PTHREAD_MUTEX_RECURSIVE))
+         == PTHREAD_MUTEX_RECURSIVE)
+    {
+      mutex->type = 2;
+      return glwthread_timedrecmutex_init (&mutex->u.u_timedrecmutex);
+    }
+  else
+    {
+      mutex->type = 1;
+      return glwthread_timedmutex_init (&mutex->u.u_timedmutex);
+    }
+}
+
+int
+pthread_mutex_lock (pthread_mutex_t *mutex)
+{
+  switch (mutex->type)
+    {
+    case 1:
+      return glwthread_timedmutex_lock (&mutex->u.u_timedmutex);
+    case 2:
+      return glwthread_timedrecmutex_lock (&mutex->u.u_timedrecmutex);
+    default:
+      abort ();
+    }
+}
+
+int
+pthread_mutex_trylock (pthread_mutex_t *mutex)
+{
+  switch (mutex->type)
+    {
+    case 1:
+      return glwthread_timedmutex_trylock (&mutex->u.u_timedmutex);
+    case 2:
+      return glwthread_timedrecmutex_trylock (&mutex->u.u_timedrecmutex);
+    default:
+      abort ();
+    }
+}
+
+int
+pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime)
+{
+  switch (mutex->type)
+    {
+    case 1:
+      return glwthread_timedmutex_timedlock (&mutex->u.u_timedmutex, abstime);
+    case 2:
+      return glwthread_timedrecmutex_timedlock (&mutex->u.u_timedrecmutex,
+                                                abstime);
+    default:
+      abort ();
+    }
+}
+
+int
+pthread_mutex_unlock (pthread_mutex_t *mutex)
+{
+  switch (mutex->type)
+    {
+    case 1:
+      return glwthread_timedmutex_unlock (&mutex->u.u_timedmutex);
+    case 2:
+      return glwthread_timedrecmutex_unlock (&mutex->u.u_timedrecmutex);
+    default:
+      abort ();
+    }
+}
+
+int
+pthread_mutex_destroy (pthread_mutex_t *mutex)
+{
+  switch (mutex->type)
+    {
+    case 1:
+      return glwthread_timedmutex_destroy (&mutex->u.u_timedmutex);
+    case 2:
+      return glwthread_timedrecmutex_destroy (&mutex->u.u_timedrecmutex);
+    default:
+      abort ();
+    }
+}
+
+#elif HAVE_PTHREAD_H
+/* Provide workarounds for POSIX threads.  */
+
+/* pthread_mutex_timedlock is defined by the 'pthread_mutex_timedlock'
+   module.  */
+
+#else
+/* Provide a dummy implementation for single-threaded applications.  */
+
+int
+pthread_mutex_init (_GL_UNUSED pthread_mutex_t *mutex,
+                    _GL_UNUSED const pthread_mutexattr_t *attr)
+{
+  /* MUTEX is never seriously used.  */
+  return 0;
+}
+
+int
+pthread_mutex_lock (_GL_UNUSED pthread_mutex_t *mutex)
+{
+  /* There is only one thread, so it always gets the lock.  This
+     implementation does not support PTHREAD_MUTEX_ERRORCHECK.  */
+  return 0;
+}
+
+int
+pthread_mutex_trylock (_GL_UNUSED pthread_mutex_t *mutex)
+{
+  /* There is only one thread, so it always gets the lock.  This
+     implementation does not support PTHREAD_MUTEX_ERRORCHECK.  */
+  return 0;
+}
+
+int
+pthread_mutex_timedlock (_GL_UNUSED pthread_mutex_t *mutex,
+                         _GL_UNUSED const struct timespec *abstime)
+{
+  /* There is only one thread, so it always gets the lock.  This
+     implementation does not support PTHREAD_MUTEX_ERRORCHECK.  */
+  return 0;
+}
+
+int
+pthread_mutex_unlock (_GL_UNUSED pthread_mutex_t *mutex)
+{
+  /* There is only one thread, so it always unlocks successfully.
+     This implementation does not support robust mutexes or
+     PTHREAD_MUTEX_ERRORCHECK.  */
+  return 0;
+}
+
+int
+pthread_mutex_destroy (_GL_UNUSED pthread_mutex_t *mutex)
+{
+  /* MUTEX is never seriously used.  */
+  return 0;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 10422be817f0f928f47b6bd6215db1ff4b9414f9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pthread-thread.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b81748d1be5e7bc3496ff0a94e2ae704fdc2f5fe
--- /dev/null
@@ -0,0 +1,178 @@
+/* Creating and controlling POSIX threads.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, 2010, and Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <pthread.h>
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# include "windows-thread.h"
+#else
+# include <stdlib.h>
+#endif
+
+typedef void * (* pthread_main_function_t) (void *);
+
+#if ((defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS) || !HAVE_PTHREAD_H
+
+int
+pthread_attr_init (pthread_attr_t *attr)
+{
+  *attr = PTHREAD_CREATE_JOINABLE;
+  return 0;
+}
+
+int
+pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstatep)
+{
+  *detachstatep = *attr & (PTHREAD_CREATE_JOINABLE | PTHREAD_CREATE_DETACHED);
+  return 0;
+}
+
+int
+pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate)
+{
+  if (!(detachstate == PTHREAD_CREATE_JOINABLE
+        || detachstate == PTHREAD_CREATE_DETACHED))
+    return EINVAL;
+  *attr ^= (*attr ^ detachstate)
+           & (PTHREAD_CREATE_JOINABLE | PTHREAD_CREATE_DETACHED);
+  return 0;
+}
+
+int
+pthread_attr_destroy (_GL_UNUSED pthread_attr_t *attr)
+{
+  return 0;
+}
+
+#endif
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+/* Use Windows threads.  */
+
+int
+pthread_create (pthread_t *threadp, const pthread_attr_t *attr,
+                pthread_main_function_t mainfunc, void *arg)
+{
+  unsigned int glwthread_attr =
+    (attr != NULL
+     && (*attr & (PTHREAD_CREATE_JOINABLE | PTHREAD_CREATE_DETACHED))
+        != PTHREAD_CREATE_JOINABLE
+     ? GLWTHREAD_ATTR_DETACHED
+     : 0);
+  return glwthread_thread_create (threadp, glwthread_attr, mainfunc, arg);
+}
+
+pthread_t
+pthread_self (void)
+{
+  return glwthread_thread_self ();
+}
+
+int
+pthread_equal (pthread_t thread1, pthread_t thread2)
+{
+  return thread1 == thread2;
+}
+
+int
+pthread_detach (pthread_t thread)
+{
+  return glwthread_thread_detach (thread);
+}
+
+int
+pthread_join (pthread_t thread, void **valuep)
+{
+  return glwthread_thread_join (thread, valuep);
+}
+
+void
+pthread_exit (void *value)
+{
+  glwthread_thread_exit (value);
+}
+
+#elif HAVE_PTHREAD_H
+/* Provide workarounds for POSIX threads.  */
+
+# if PTHREAD_CREATE_IS_INLINE
+int
+pthread_create (pthread_t *threadp, const pthread_attr_t *attr,
+                pthread_main_function_t mainfunc, void *arg)
+#  undef pthread_create
+{
+  return pthread_create (threadp, attr, mainfunc, arg);
+}
+
+int
+pthread_attr_init (pthread_attr_t *attr)
+#  undef pthread_attr_init
+{
+  return pthread_attr_init (attr);
+}
+
+# endif
+
+#else
+/* Provide a dummy implementation for single-threaded applications.  */
+
+int
+pthread_create (pthread_t *threadp, const pthread_attr_t *attr,
+                pthread_main_function_t mainfunc, void *arg)
+{
+  /* The maximum number of threads is reached.  Do not create a thread.  */
+  return EAGAIN;
+}
+
+pthread_t
+pthread_self (void)
+{
+  return 42;
+}
+
+int
+pthread_equal (pthread_t thread1, pthread_t thread2)
+{
+  return thread1 == thread2;
+}
+
+int
+pthread_detach (pthread_t thread)
+{
+  /* There are no joinable threads.  */
+  return EINVAL;
+}
+
+int
+pthread_join (pthread_t thread, void **valuep)
+{
+  /* There are no joinable threads.  */
+  return EINVAL;
+}
+
+void
+pthread_exit (void *value)
+{
+  /* There is just one thread, so the process exits.  */
+  exit (0);
+}
+
+#endif
deleted file mode 120000 (symlink)
index ed82477e40d7b09b31b02b364902b60bdccfed2c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pthread.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cd705fbd18a97d6f2881e7787ed0e085c3da7069
--- /dev/null
+/* Implement the most essential subset of POSIX 1003.1-2008 pthread.h.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, Glen Lenker, and Bruno Haible.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined _GL_ALREADY_INCLUDING_PTHREAD_H
+/* Special invocation convention:
+   On Android, we have a sequence of nested includes
+   <pthread.h> -> <time.h> -> <sys/time.h> -> <sys/select.h> ->
+   <signal.h> -> <pthread.h>.
+   In this situation, PTHREAD_COND_INITIALIZER is not yet defined,
+   therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc.  */
+
+#@INCLUDE_NEXT@ @NEXT_PTHREAD_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_PTHREAD_H_
+
+#if @HAVE_PTHREAD_H@
+
+# define _GL_ALREADY_INCLUDING_PTHREAD_H
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
+
+# undef _GL_ALREADY_INCLUDING_PTHREAD_H
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_PTHREAD_H_
+#define _@GUARD_PREFIX@_PTHREAD_H_
+
+/* This file uses _Noreturn, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
+   HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#define __need_system_stdlib_h
+#include <stdlib.h>
+#undef __need_system_stdlib_h
+
+
+/* The pthreads-win32 <pthread.h> defines a couple of broken macros.  */
+#undef asctime_r
+#undef ctime_r
+#undef gmtime_r
+#undef localtime_r
+#undef rand_r
+#undef strtok_r
+
+#include <errno.h>
+#include <sched.h>
+#include <sys/types.h>
+#include <time.h>
+
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __pure__ was added in gcc 2.96.  */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _Noreturn is copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* =========== Thread types and macros =========== */
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# if @GNULIB_PTHREAD_THREAD@
+#  include "windows-thread.h"
+#  if @HAVE_PTHREAD_T@
+#   define pthread_t rpl_pthread_t
+#   define pthread_attr_t rpl_pthread_attr_t
+#  endif
+#  if !GNULIB_defined_pthread_thread_types
+typedef glwthread_thread_t pthread_t;
+typedef unsigned int pthread_attr_t;
+#   define GNULIB_defined_pthread_thread_types 1
+#  endif
+# else
+#  if @HAVE_PTHREAD_T@
+#   define pthread_t rpl_pthread_t
+#   define pthread_attr_t rpl_pthread_attr_t
+#  endif
+#  if !GNULIB_defined_pthread_thread_types
+typedef int pthread_t;
+typedef unsigned int pthread_attr_t;
+#   define GNULIB_defined_pthread_thread_types 1
+#  endif
+# endif
+# undef PTHREAD_CREATE_JOINABLE
+# undef PTHREAD_CREATE_DETACHED
+# define PTHREAD_CREATE_JOINABLE 0
+# define PTHREAD_CREATE_DETACHED 1
+#else
+# if !@HAVE_PTHREAD_T@
+#  if !GNULIB_defined_pthread_thread_types
+typedef int pthread_t;
+typedef unsigned int pthread_attr_t;
+#   define GNULIB_defined_pthread_thread_types 1
+#  endif
+# endif
+# if !@HAVE_PTHREAD_CREATE_DETACHED@
+#  define PTHREAD_CREATE_JOINABLE 0
+#  define PTHREAD_CREATE_DETACHED 1
+# endif
+#endif
+
+/* =========== Once-only control (initialization) types and macros ========== */
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# if @GNULIB_PTHREAD_ONCE@
+#  include "windows-once.h"
+#  if @HAVE_PTHREAD_T@
+#   define pthread_once_t rpl_pthread_once_t
+#  endif
+#  if !GNULIB_defined_pthread_once_types
+typedef glwthread_once_t pthread_once_t;
+#   define GNULIB_defined_pthread_once_types 1
+#  endif
+#  undef PTHREAD_ONCE_INIT
+#  define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT
+# else
+#  if @HAVE_PTHREAD_T@
+#   define pthread_once_t rpl_pthread_once_t
+#  endif
+#  if !GNULIB_defined_pthread_once_types
+typedef int pthread_once_t;
+#   define GNULIB_defined_pthread_once_types 1
+#  endif
+#  undef PTHREAD_ONCE_INIT
+#  define PTHREAD_ONCE_INIT { 0 }
+# endif
+#else
+# if !@HAVE_PTHREAD_T@
+#  if !GNULIB_defined_pthread_once_types
+typedef int pthread_once_t;
+#   define GNULIB_defined_pthread_once_types 1
+#  endif
+#  undef PTHREAD_ONCE_INIT
+#  define PTHREAD_ONCE_INIT { 0 }
+# endif
+#endif
+
+/* =========== Mutex types and macros =========== */
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# if @GNULIB_PTHREAD_MUTEX@
+#  include "windows-timedmutex.h"
+#  include "windows-timedrecmutex.h"
+#  if @HAVE_PTHREAD_T@
+#   define pthread_mutex_t rpl_pthread_mutex_t
+#   define pthread_mutexattr_t rpl_pthread_mutexattr_t
+#  endif
+#  if !GNULIB_defined_pthread_mutex_types
+typedef struct
+        {
+          int type;
+          union
+            {
+              glwthread_timedmutex_t    u_timedmutex;
+              glwthread_timedrecmutex_t u_timedrecmutex;
+            }
+          u;
+        }
+        pthread_mutex_t;
+typedef unsigned int pthread_mutexattr_t;
+#   define GNULIB_defined_pthread_mutex_types 1
+#  endif
+#  undef PTHREAD_MUTEX_INITIALIZER
+#  define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } }
+# else
+#  if @HAVE_PTHREAD_T@
+#   define pthread_mutex_t rpl_pthread_mutex_t
+#   define pthread_mutexattr_t rpl_pthread_mutexattr_t
+#  endif
+#  if !GNULIB_defined_pthread_mutex_types
+typedef int pthread_mutex_t;
+typedef unsigned int pthread_mutexattr_t;
+#   define GNULIB_defined_pthread_mutex_types 1
+#  endif
+#  undef PTHREAD_MUTEX_INITIALIZER
+#  define PTHREAD_MUTEX_INITIALIZER { 0 }
+# endif
+# undef PTHREAD_MUTEX_DEFAULT
+# undef PTHREAD_MUTEX_NORMAL
+# undef PTHREAD_MUTEX_ERRORCHECK
+# undef PTHREAD_MUTEX_RECURSIVE
+# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
+# define PTHREAD_MUTEX_NORMAL 0
+# define PTHREAD_MUTEX_ERRORCHECK 1
+# define PTHREAD_MUTEX_RECURSIVE 2
+# undef PTHREAD_MUTEX_STALLED
+# undef PTHREAD_MUTEX_ROBUST
+# define PTHREAD_MUTEX_STALLED 0
+# define PTHREAD_MUTEX_ROBUST 1
+#else
+# if !@HAVE_PTHREAD_T@
+#  if !GNULIB_defined_pthread_mutex_types
+typedef int pthread_mutex_t;
+typedef unsigned int pthread_mutexattr_t;
+#   define GNULIB_defined_pthread_mutex_types 1
+#  endif
+#  undef PTHREAD_MUTEX_INITIALIZER
+#  define PTHREAD_MUTEX_INITIALIZER { 0 }
+# endif
+# if !@HAVE_PTHREAD_MUTEX_RECURSIVE@
+#  define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
+#  define PTHREAD_MUTEX_NORMAL 0
+#  define PTHREAD_MUTEX_ERRORCHECK 1
+#  define PTHREAD_MUTEX_RECURSIVE 2
+# endif
+# if !@HAVE_PTHREAD_MUTEX_ROBUST@
+#  define PTHREAD_MUTEX_STALLED 0
+#  define PTHREAD_MUTEX_ROBUST 1
+# endif
+#endif
+
+/* =========== Read-write lock types and macros =========== */
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# if @GNULIB_PTHREAD_RWLOCK@
+#  include "windows-timedrwlock.h"
+#  if @HAVE_PTHREAD_T@
+#   define pthread_rwlock_t rpl_pthread_rwlock_t
+#   define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
+#  endif
+#  if !GNULIB_defined_pthread_rwlock_types
+typedef glwthread_timedrwlock_t pthread_rwlock_t;
+typedef unsigned int pthread_rwlockattr_t;
+#   define GNULIB_defined_pthread_rwlock_types 1
+#  endif
+#  undef PTHREAD_RWLOCK_INITIALIZER
+#  define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT
+# else
+#  if @HAVE_PTHREAD_T@
+#   define pthread_rwlock_t rpl_pthread_rwlock_t
+#   define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
+#  endif
+#  if !GNULIB_defined_pthread_rwlock_types
+typedef int pthread_rwlock_t;
+typedef unsigned int pthread_rwlockattr_t;
+#   define GNULIB_defined_pthread_rwlock_types 1
+#  endif
+#  undef PTHREAD_RWLOCK_INITIALIZER
+#  define PTHREAD_RWLOCK_INITIALIZER { 0 }
+# endif
+#elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */
+# if @HAVE_PTHREAD_T@
+#  define pthread_rwlock_t rpl_pthread_rwlock_t
+#  define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
+# endif
+# if !GNULIB_defined_pthread_rwlock_types
+typedef struct
+        {
+          pthread_mutex_t lock; /* protects the remaining fields */
+          pthread_cond_t waiting_readers; /* waiting readers */
+          pthread_cond_t waiting_writers; /* waiting writers */
+          unsigned int waiting_writers_count; /* number of waiting writers */
+          int runcount; /* number of readers running, or -1 when a writer runs */
+        }
+        pthread_rwlock_t;
+typedef unsigned int pthread_rwlockattr_t;
+#  define GNULIB_defined_pthread_rwlock_types 1
+# endif
+# undef PTHREAD_RWLOCK_INITIALIZER
+# define PTHREAD_RWLOCK_INITIALIZER \
+   { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
+#else
+# if @HAVE_PTHREAD_T@
+#  if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */
+#   define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP
+#  endif
+# else
+#  if !GNULIB_defined_pthread_rwlock_types
+typedef int pthread_rwlock_t;
+typedef unsigned int pthread_rwlockattr_t;
+#   define GNULIB_defined_pthread_rwlock_types 1
+#  endif
+#  undef PTHREAD_RWLOCK_INITIALIZER
+#  define PTHREAD_RWLOCK_INITIALIZER { 0 }
+# endif
+#endif
+
+/* =========== Condition variable types and macros =========== */
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# if @GNULIB_PTHREAD_COND@
+#  include "windows-cond.h"
+#  if @HAVE_PTHREAD_T@
+#   define pthread_cond_t rpl_pthread_cond_t
+#   define pthread_condattr_t rpl_pthread_condattr_t
+#  endif
+#  if !GNULIB_defined_pthread_cond_types
+typedef glwthread_cond_t pthread_cond_t;
+typedef unsigned int pthread_condattr_t;
+#   define GNULIB_defined_pthread_cond_types 1
+#  endif
+#  undef PTHREAD_COND_INITIALIZER
+#  define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT
+# else
+#  if @HAVE_PTHREAD_T@
+#   define pthread_cond_t rpl_pthread_cond_t
+#   define pthread_condattr_t rpl_pthread_condattr_t
+#  endif
+#  if !GNULIB_defined_pthread_cond_types
+typedef int pthread_cond_t;
+typedef unsigned int pthread_condattr_t;
+#   define GNULIB_defined_pthread_cond_types 1
+#  endif
+#  undef PTHREAD_COND_INITIALIZER
+#  define PTHREAD_COND_INITIALIZER { 0 }
+# endif
+#else
+# if !@HAVE_PTHREAD_T@
+#  if !GNULIB_defined_pthread_cond_types
+typedef int pthread_cond_t;
+typedef unsigned int pthread_condattr_t;
+#   define GNULIB_defined_pthread_cond_types 1
+#  endif
+#  undef PTHREAD_COND_INITIALIZER
+#  define PTHREAD_COND_INITIALIZER { 0 }
+# endif
+#endif
+
+/* =========== Thread-specific storage types and macros =========== */
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# if @GNULIB_PTHREAD_TSS@
+#  include "windows-tls.h"
+#  if @HAVE_PTHREAD_T@
+#   define pthread_key_t rpl_pthread_key_t
+#  endif
+#  if !GNULIB_defined_pthread_tss_types
+typedef glwthread_tls_key_t pthread_key_t;
+#   define GNULIB_defined_pthread_tss_types 1
+#  endif
+#  undef PTHREAD_DESTRUCTOR_ITERATIONS
+#  define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS
+# else
+#  if @HAVE_PTHREAD_T@
+#   define pthread_key_t rpl_pthread_key_t
+#  endif
+#  if !GNULIB_defined_pthread_tss_types
+typedef void ** pthread_key_t;
+#   define GNULIB_defined_pthread_tss_types 1
+#  endif
+#  undef PTHREAD_DESTRUCTOR_ITERATIONS
+#  define PTHREAD_DESTRUCTOR_ITERATIONS 0
+# endif
+#else
+# if !@HAVE_PTHREAD_T@
+#  if !GNULIB_defined_pthread_tss_types
+typedef void ** pthread_key_t;
+#   define GNULIB_defined_pthread_tss_types 1
+#  endif
+#  undef PTHREAD_DESTRUCTOR_ITERATIONS
+#  define PTHREAD_DESTRUCTOR_ITERATIONS 0
+# endif
+#endif
+
+/* =========== Spinlock types and macros =========== */
+
+#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
+# if @GNULIB_PTHREAD_SPIN@
+#  include "windows-spin.h"
+#  if @HAVE_PTHREAD_T@
+#   define pthread_spinlock_t rpl_pthread_spinlock_t
+#  endif
+#  if !GNULIB_defined_pthread_spin_types
+typedef glwthread_spinlock_t pthread_spinlock_t;
+#   define GNULIB_defined_pthread_spin_types 1
+#  endif
+# else
+#  if @HAVE_PTHREAD_T@
+#   define pthread_spinlock_t rpl_pthread_spinlock_t
+#  endif
+#  if !GNULIB_defined_pthread_spin_types
+typedef pthread_mutex_t pthread_spinlock_t;
+#   define GNULIB_defined_pthread_spin_types 1
+#  endif
+# endif
+# undef PTHREAD_PROCESS_PRIVATE
+# undef PTHREAD_PROCESS_SHARED
+# define PTHREAD_PROCESS_PRIVATE 0
+# define PTHREAD_PROCESS_SHARED 1
+#else
+# if @HAVE_PTHREAD_SPINLOCK_T@
+/* <pthread.h> exists and defines pthread_spinlock_t.  */
+#  if !(((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \
+          || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \
+         || (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
+              && !defined __ANDROID__) \
+             || __clang_major__ >= 3)) \
+        && !defined __ibmxl__)
+/* We can't use GCC built-ins.  Approximate spinlocks with mutexes.  */
+#   if !GNULIB_defined_pthread_spin_types
+#    define pthread_spinlock_t pthread_mutex_t
+#    define GNULIB_defined_pthread_spin_types 1
+#   endif
+#  endif
+# else
+/* Approximate spinlocks with mutexes.  */
+#  if !GNULIB_defined_pthread_spin_types
+typedef pthread_mutex_t pthread_spinlock_t;
+#   define GNULIB_defined_pthread_spin_types 1
+#  endif
+# endif
+# if !@HAVE_PTHREAD_PROCESS_SHARED@
+#  define PTHREAD_PROCESS_PRIVATE 0
+#  define PTHREAD_PROCESS_SHARED 1
+# endif
+#endif
+
+/* =========== Other types and macros =========== */
+
+#if !@HAVE_PTHREAD_T@
+# if !GNULIB_defined_other_pthread_types
+typedef int pthread_barrier_t;
+typedef unsigned int pthread_barrierattr_t;
+#  define GNULIB_defined_other_pthread_types 1
+# endif
+#endif
+
+#if !defined PTHREAD_CANCELED
+
+# define PTHREAD_BARRIER_SERIAL_THREAD (-1)
+
+# define PTHREAD_CANCEL_DEFERRED 0
+# define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+# define PTHREAD_CANCEL_ENABLE 0
+# define PTHREAD_CANCEL_DISABLE 1
+
+# define PTHREAD_CANCELED ((void *) -1)
+
+# define PTHREAD_INHERIT_SCHED 0
+# define PTHREAD_EXPLICIT_SCHED 1
+
+# define PTHREAD_PRIO_NONE 0
+# define PTHREAD_PRIO_INHERIT 1
+# define PTHREAD_PRIO_PROTECT 2
+
+# define PTHREAD_SCOPE_SYSTEM 0
+# define PTHREAD_SCOPE_PROCESS 1
+
+#endif
+
+/* =========== Thread functions =========== */
+
+#if @GNULIB_PTHREAD_THREAD@
+/* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way.
+   Sigh.  */
+# if @REPLACE_PTHREAD_CREATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_create
+#   define pthread_create rpl_pthread_create
+#  endif
+_GL_FUNCDECL_RPL (pthread_create, int,
+                  (pthread_t *restrict threadp,
+                   const pthread_attr_t *restrict attr,
+                   void * (*mainfunc) (void *), void *restrict arg)
+                  _GL_ARG_NONNULL ((1, 3)));
+_GL_CXXALIAS_RPL (pthread_create, int,
+                  (pthread_t *restrict threadp,
+                   const pthread_attr_t *restrict attr,
+                   void * (*mainfunc) (void *), void *restrict arg));
+# else
+#  if !@HAVE_PTHREAD_CREATE@
+_GL_FUNCDECL_SYS (pthread_create, int,
+                  (pthread_t *restrict threadp,
+                   const pthread_attr_t *restrict attr,
+                   void * (*mainfunc) (void *), void *restrict arg)
+                  _GL_ARG_NONNULL ((1, 3)));
+#  endif
+_GL_CXXALIAS_SYS_CAST (pthread_create, int,
+                       (pthread_t *restrict threadp,
+                        const pthread_attr_t *restrict attr,
+                        void * (*mainfunc) (void *), void *restrict arg));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_create);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_create
+# if HAVE_RAW_DECL_PTHREAD_CREATE
+_GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_THREAD@
+# if @REPLACE_PTHREAD_ATTR_INIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_attr_init
+#   define pthread_attr_init rpl_pthread_attr_init
+#  endif
+_GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr)
+                                          _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr));
+# else
+#  if !@HAVE_PTHREAD_ATTR_INIT@
+_GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr)
+                                          _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_attr_init);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_attr_init
+# if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
+_GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_THREAD@
+# if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_attr_getdetachstate
+#   define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
+#  endif
+_GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
+                  (const pthread_attr_t *attr, int *detachstatep)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
+                  (const pthread_attr_t *attr, int *detachstatep));
+# else
+#  if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
+_GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
+                  (const pthread_attr_t *attr, int *detachstatep)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
+                  (const pthread_attr_t *attr, int *detachstatep));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_attr_getdetachstate);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_attr_getdetachstate
+# if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
+_GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_THREAD@
+# if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_attr_setdetachstate
+#   define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
+#  endif
+_GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int,
+                  (pthread_attr_t *attr, int detachstate)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int,
+                  (pthread_attr_t *attr, int detachstate));
+# else
+#  if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
+_GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int,
+                  (pthread_attr_t *attr, int detachstate)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int,
+                  (pthread_attr_t *attr, int detachstate));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_attr_setdetachstate);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_attr_setdetachstate
+# if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
+_GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_THREAD@
+# if @REPLACE_PTHREAD_ATTR_DESTROY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_attr_destroy
+#   define pthread_attr_destroy rpl_pthread_attr_destroy
+#  endif
+_GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr)
+                                             _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr));
+# else
+#  if !@HAVE_PTHREAD_ATTR_DESTROY@
+_GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr)
+                                             _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_attr_destroy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_attr_destroy
+# if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
+_GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_THREAD@
+# if @REPLACE_PTHREAD_SELF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_self
+#   define pthread_self rpl_pthread_self
+#  endif
+_GL_FUNCDECL_RPL (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
+_GL_CXXALIAS_RPL (pthread_self, pthread_t, (void));
+# else
+#  if !@HAVE_PTHREAD_SELF@
+_GL_FUNCDECL_SYS (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
+#  endif
+_GL_CXXALIAS_SYS (pthread_self, pthread_t, (void));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_self);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_self
+# if HAVE_RAW_DECL_PTHREAD_SELF
+_GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_THREAD@
+# if @REPLACE_PTHREAD_EQUAL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_equal
+#   define pthread_equal rpl_pthread_equal
+#  endif
+_GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
+_GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
+# else
+#  if !@HAVE_PTHREAD_EQUAL@
+_GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
+#  endif
+_GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_equal);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_equal
+# if HAVE_RAW_DECL_PTHREAD_EQUAL
+_GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_THREAD@
+# if @REPLACE_PTHREAD_DETACH@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_detach
+#   define pthread_detach rpl_pthread_detach
+#  endif
+_GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread));
+_GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread));
+# else
+#  if !@HAVE_PTHREAD_DETACH@
+_GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread));
+#  endif
+_GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_detach);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_detach
+# if HAVE_RAW_DECL_PTHREAD_DETACH
+_GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_THREAD@
+# if @REPLACE_PTHREAD_JOIN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_join
+#   define pthread_join rpl_pthread_join
+#  endif
+_GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep));
+_GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep));
+# else
+#  if !@HAVE_PTHREAD_JOIN@
+_GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep));
+#  endif
+_GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_join);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_join
+# if HAVE_RAW_DECL_PTHREAD_JOIN
+_GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_THREAD@
+# if @REPLACE_PTHREAD_EXIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_exit
+#   define pthread_exit rpl_pthread_exit
+#  endif
+_GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value));
+_GL_CXXALIAS_RPL (pthread_exit, void, (void *value));
+# else
+#  if !@HAVE_PTHREAD_EXIT@
+_GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value));
+#  endif
+/* Need to cast because of AIX with xlclang++.  */
+_GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_exit);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_exit
+# if HAVE_RAW_DECL_PTHREAD_EXIT
+_GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - "
+                 "use gnulib module pthread-thread for portability");
+# endif
+#endif
+
+/* =========== Once-only control (initialization) functions =========== */
+
+#if @GNULIB_PTHREAD_ONCE@
+# if @REPLACE_PTHREAD_ONCE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_once
+#   define pthread_once rpl_pthread_once
+#  endif
+_GL_FUNCDECL_RPL (pthread_once, int,
+                  (pthread_once_t *once_control, void (*initfunction) (void))
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (pthread_once, int,
+                  (pthread_once_t *once_control, void (*initfunction) (void)));
+# else
+#  if !@HAVE_PTHREAD_ONCE@
+_GL_FUNCDECL_SYS (pthread_once, int,
+                  (pthread_once_t *once_control, void (*initfunction) (void))
+                   _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS_CAST (pthread_once, int,
+                       (pthread_once_t *once_control,
+                        void (*initfunction) (void)));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_once);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_once
+# if HAVE_RAW_DECL_PTHREAD_ONCE
+_GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - "
+                 "use gnulib module pthread-once for portability");
+# endif
+#endif
+
+/* =========== Mutex functions =========== */
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEX_INIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutex_init
+#   define pthread_mutex_init rpl_pthread_mutex_init
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutex_init, int,
+                  (pthread_mutex_t *restrict mutex,
+                   const pthread_mutexattr_t *restrict attr)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_mutex_init, int,
+                  (pthread_mutex_t *restrict mutex,
+                   const pthread_mutexattr_t *restrict attr));
+# else
+#  if !@HAVE_PTHREAD_MUTEX_INIT@
+_GL_FUNCDECL_SYS (pthread_mutex_init, int,
+                  (pthread_mutex_t *restrict mutex,
+                   const pthread_mutexattr_t *restrict attr)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutex_init, int,
+                  (pthread_mutex_t *restrict mutex,
+                   const pthread_mutexattr_t *restrict attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutex_init);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutex_init
+# if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
+_GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEXATTR_INIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutexattr_init
+#   define pthread_mutexattr_init rpl_pthread_mutexattr_init
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
+                                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
+# else
+#  if !@HAVE_PTHREAD_MUTEXATTR_INIT@
+_GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
+                                               _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutexattr_init);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutexattr_init
+# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
+_GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutexattr_gettype
+#   define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int,
+                  (const pthread_mutexattr_t *restrict attr,
+                   int *restrict typep)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
+                  (const pthread_mutexattr_t *restrict attr,
+                   int *restrict typep));
+# else
+#  if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
+_GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
+                  (const pthread_mutexattr_t *restrict attr,
+                   int *restrict typep)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+/* Need to cast, because on FreeBSD the first parameter is
+                        pthread_mutexattr_t *attr.  */
+_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int,
+                       (const pthread_mutexattr_t *restrict attr,
+                        int *restrict typep));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutexattr_gettype);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutexattr_gettype
+# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
+_GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutexattr_settype
+#   define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutexattr_settype, int,
+                  (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_mutexattr_settype, int,
+                  (pthread_mutexattr_t *attr, int type));
+# else
+#  if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
+_GL_FUNCDECL_SYS (pthread_mutexattr_settype, int,
+                  (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutexattr_settype, int,
+                  (pthread_mutexattr_t *attr, int type));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutexattr_settype);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutexattr_settype
+# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
+_GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutexattr_getrobust
+#   define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int,
+                  (const pthread_mutexattr_t *restrict attr,
+                   int *restrict robustp)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
+                  (const pthread_mutexattr_t *restrict attr,
+                   int *restrict robustp));
+# else
+#  if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
+_GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
+                  (const pthread_mutexattr_t *restrict attr,
+                   int *restrict robustp)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+/* Need to cast, because on FreeBSD the first parameter is
+                        pthread_mutexattr_t *attr.  */
+_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
+                       (const pthread_mutexattr_t *restrict attr,
+                        int *restrict robustp));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutexattr_getrobust);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutexattr_getrobust
+# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
+_GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutexattr_setrobust
+#   define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int,
+                  (pthread_mutexattr_t *attr, int robust)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int,
+                  (pthread_mutexattr_t *attr, int robust));
+# else
+#  if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
+_GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
+                  (pthread_mutexattr_t *attr, int robust)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
+                  (pthread_mutexattr_t *attr, int robust));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutexattr_setrobust);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutexattr_setrobust
+# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
+_GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutexattr_destroy
+#   define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
+                                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
+# else
+#  if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
+_GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
+                                                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutexattr_destroy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutexattr_destroy
+# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
+_GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEX_LOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutex_lock
+#   define pthread_mutex_lock rpl_pthread_mutex_lock
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
+                                           _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
+# else
+#  if !@HAVE_PTHREAD_MUTEX_LOCK@
+_GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
+                                           _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutex_lock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutex_lock
+# if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
+_GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEX_TRYLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutex_trylock
+#   define pthread_mutex_trylock rpl_pthread_mutex_trylock
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
+                                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
+# else
+#  if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
+_GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
+                                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutex_trylock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutex_trylock
+# if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
+_GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
+# if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutex_timedlock
+#   define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutex_timedlock, int,
+                  (pthread_mutex_t *restrict mutex,
+                   const struct timespec *restrict abstime)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
+                  (pthread_mutex_t *restrict mutex,
+                   const struct timespec *restrict abstime));
+# else
+#  if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
+_GL_FUNCDECL_SYS (pthread_mutex_timedlock, int,
+                  (pthread_mutex_t *restrict mutex,
+                   const struct timespec *restrict abstime)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutex_timedlock, int,
+                  (pthread_mutex_t *restrict mutex,
+                   const struct timespec *restrict abstime));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutex_timedlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutex_timedlock
+# if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
+_GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - "
+                 "use gnulib module pthread_mutex_timedlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEX_UNLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutex_unlock
+#   define pthread_mutex_unlock rpl_pthread_mutex_unlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
+                                             _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
+# else
+#  if !@HAVE_PTHREAD_MUTEX_UNLOCK@
+_GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
+                                             _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutex_unlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutex_unlock
+# if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
+_GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_MUTEX@
+# if @REPLACE_PTHREAD_MUTEX_DESTROY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_mutex_destroy
+#   define pthread_mutex_destroy rpl_pthread_mutex_destroy
+#  endif
+_GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
+                                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
+# else
+#  if !@HAVE_PTHREAD_MUTEX_DESTROY@
+_GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
+                                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_mutex_destroy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_mutex_destroy
+# if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
+_GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - "
+                 "use gnulib module pthread-mutex for portability");
+# endif
+#endif
+
+/* =========== Read-write lock functions =========== */
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCK_INIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlock_init
+#   define pthread_rwlock_init rpl_pthread_rwlock_init
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlock_init, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const pthread_rwlockattr_t *restrict attr)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_rwlock_init, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const pthread_rwlockattr_t *restrict attr));
+# else
+#  if !@HAVE_PTHREAD_RWLOCK_INIT@
+_GL_FUNCDECL_SYS (pthread_rwlock_init, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const pthread_rwlockattr_t *restrict attr)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlock_init, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const pthread_rwlockattr_t *restrict attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlock_init);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlock_init
+# if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
+_GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCKATTR_INIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlockattr_init
+#   define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
+                                                _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
+# else
+#  if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
+_GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
+                                                _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlockattr_init);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlockattr_init
+# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
+_GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlockattr_destroy
+#   define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int,
+                  (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int,
+                  (pthread_rwlockattr_t *attr));
+# else
+#  if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
+_GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int,
+                  (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int,
+                  (pthread_rwlockattr_t *attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlockattr_destroy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlockattr_destroy
+# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
+_GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCK_RDLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlock_rdlock
+#   define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
+                                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
+_GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
+                                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlock_rdlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlock_rdlock
+# if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
+_GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCK_WRLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlock_wrlock
+#   define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
+                                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
+_GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
+                                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlock_wrlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlock_wrlock
+# if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
+_GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlock_tryrdlock
+#   define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
+                                                 _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
+_GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
+                                                 _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlock_tryrdlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlock_tryrdlock
+# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
+_GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlock_trywrlock
+#   define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
+                                                 _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
+_GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
+                                                 _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlock_trywrlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlock_trywrlock
+# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
+_GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlock_timedrdlock
+#   define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const struct timespec *restrict abstime)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const struct timespec *restrict abstime));
+# else
+#  if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
+_GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const struct timespec *restrict abstime)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const struct timespec *restrict abstime));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlock_timedrdlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlock_timedrdlock
+# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
+_GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlock_timedwrlock
+#   define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const struct timespec *restrict abstime)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const struct timespec *restrict abstime));
+# else
+#  if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
+_GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const struct timespec *restrict abstime)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int,
+                  (pthread_rwlock_t *restrict lock,
+                   const struct timespec *restrict abstime));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlock_timedwrlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlock_timedwrlock
+# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
+_GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCK_UNLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlock_unlock
+#   define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
+                                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
+_GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
+                                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlock_unlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlock_unlock
+# if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
+_GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_RWLOCK@
+# if @REPLACE_PTHREAD_RWLOCK_DESTROY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_rwlock_destroy
+#   define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
+#  endif
+_GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
+                                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_RWLOCK_DESTROY@
+_GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
+                                               _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_rwlock_destroy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_rwlock_destroy
+# if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
+_GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - "
+                 "use gnulib module pthread-rwlock for portability");
+# endif
+#endif
+
+/* =========== Condition variable functions =========== */
+
+#if @GNULIB_PTHREAD_COND@
+# if @REPLACE_PTHREAD_COND_INIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_cond_init
+#   define pthread_cond_init rpl_pthread_cond_init
+#  endif
+_GL_FUNCDECL_RPL (pthread_cond_init, int,
+                  (pthread_cond_t *restrict cond,
+                   const pthread_condattr_t *restrict attr)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_cond_init, int,
+                  (pthread_cond_t *restrict cond,
+                   const pthread_condattr_t *restrict attr));
+# else
+#  if !@HAVE_PTHREAD_COND_INIT@
+_GL_FUNCDECL_SYS (pthread_cond_init, int,
+                  (pthread_cond_t *restrict cond,
+                   const pthread_condattr_t *restrict attr)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_cond_init, int,
+                  (pthread_cond_t *restrict cond,
+                   const pthread_condattr_t *restrict attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_cond_init);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_cond_init
+# if HAVE_RAW_DECL_PTHREAD_COND_INIT
+_GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - "
+                 "use gnulib module pthread-cond for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_COND@
+# if @REPLACE_PTHREAD_CONDATTR_INIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_condattr_init
+#   define pthread_condattr_init rpl_pthread_condattr_init
+#  endif
+_GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr)
+                                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr));
+# else
+#  if !@HAVE_PTHREAD_CONDATTR_INIT@
+_GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr)
+                                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_condattr_init);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_condattr_init
+# if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
+_GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - "
+                 "use gnulib module pthread-cond for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_COND@
+# if @REPLACE_PTHREAD_CONDATTR_DESTROY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_condattr_destroy
+#   define pthread_condattr_destroy rpl_pthread_condattr_destroy
+#  endif
+_GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
+                                                 _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
+# else
+#  if !@HAVE_PTHREAD_CONDATTR_DESTROY@
+_GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
+                                                 _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_condattr_destroy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_condattr_destroy
+# if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
+_GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - "
+                 "use gnulib module pthread-cond for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_COND@
+# if @REPLACE_PTHREAD_COND_WAIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_cond_wait
+#   define pthread_cond_wait rpl_pthread_cond_wait
+#  endif
+_GL_FUNCDECL_RPL (pthread_cond_wait, int,
+                  (pthread_cond_t *restrict cond,
+                   pthread_mutex_t *restrict mutex)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (pthread_cond_wait, int,
+                  (pthread_cond_t *restrict cond,
+                   pthread_mutex_t *restrict mutex));
+# else
+#  if !@HAVE_PTHREAD_COND_WAIT@
+_GL_FUNCDECL_SYS (pthread_cond_wait, int,
+                  (pthread_cond_t *restrict cond,
+                   pthread_mutex_t *restrict mutex)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_cond_wait, int,
+                  (pthread_cond_t *restrict cond,
+                   pthread_mutex_t *restrict mutex));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_cond_wait);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_cond_wait
+# if HAVE_RAW_DECL_PTHREAD_COND_WAIT
+_GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - "
+                 "use gnulib module pthread-cond for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_COND@
+# if @REPLACE_PTHREAD_COND_TIMEDWAIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_cond_timedwait
+#   define pthread_cond_timedwait rpl_pthread_cond_timedwait
+#  endif
+_GL_FUNCDECL_RPL (pthread_cond_timedwait, int,
+                  (pthread_cond_t *restrict cond,
+                   pthread_mutex_t *restrict mutex,
+                   const struct timespec *restrict abstime)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+_GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
+                  (pthread_cond_t *restrict cond,
+                   pthread_mutex_t *restrict mutex,
+                   const struct timespec *restrict abstime));
+# else
+#  if !@HAVE_PTHREAD_COND_TIMEDWAIT@
+_GL_FUNCDECL_SYS (pthread_cond_timedwait, int,
+                  (pthread_cond_t *restrict cond,
+                   pthread_mutex_t *restrict mutex,
+                   const struct timespec *restrict abstime)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_cond_timedwait, int,
+                  (pthread_cond_t *restrict cond,
+                   pthread_mutex_t *restrict mutex,
+                   const struct timespec *restrict abstime));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_cond_timedwait);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_cond_timedwait
+# if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
+_GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - "
+                 "use gnulib module pthread-cond for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_COND@
+# if @REPLACE_PTHREAD_COND_SIGNAL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_cond_signal
+#   define pthread_cond_signal rpl_pthread_cond_signal
+#  endif
+_GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond)
+                                            _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond));
+# else
+#  if !@HAVE_PTHREAD_COND_SIGNAL@
+_GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond)
+                                            _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_cond_signal);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_cond_signal
+# if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
+_GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - "
+                 "use gnulib module pthread-cond for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_COND@
+# if @REPLACE_PTHREAD_COND_BROADCAST@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_cond_broadcast
+#   define pthread_cond_broadcast rpl_pthread_cond_broadcast
+#  endif
+_GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond)
+                                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond));
+# else
+#  if !@HAVE_PTHREAD_COND_BROADCAST@
+_GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond)
+                                               _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_cond_broadcast);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_cond_broadcast
+# if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
+_GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - "
+                 "use gnulib module pthread-cond for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_COND@
+# if @REPLACE_PTHREAD_COND_DESTROY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_cond_destroy
+#   define pthread_cond_destroy rpl_pthread_cond_destroy
+#  endif
+_GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond)
+                                             _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond));
+# else
+#  if !@HAVE_PTHREAD_COND_DESTROY@
+_GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond)
+                                             _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_cond_destroy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_cond_destroy
+# if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
+_GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - "
+                 "use gnulib module pthread-cond for portability");
+# endif
+#endif
+
+/* =========== Thread-specific storage functions =========== */
+
+#if @GNULIB_PTHREAD_TSS@
+# if @REPLACE_PTHREAD_KEY_CREATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_key_create
+#   define pthread_key_create rpl_pthread_key_create
+#  endif
+_GL_FUNCDECL_RPL (pthread_key_create, int,
+                  (pthread_key_t *keyp, void (*destructor) (void *))
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_key_create, int,
+                  (pthread_key_t *keyp, void (*destructor) (void *)));
+# else
+#  if !@HAVE_PTHREAD_KEY_CREATE@
+_GL_FUNCDECL_SYS (pthread_key_create, int,
+                  (pthread_key_t *keyp, void (*destructor) (void *))
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS_CAST (pthread_key_create, int,
+                       (pthread_key_t *keyp, void (*destructor) (void *)));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_key_create);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_key_create
+# if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
+_GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - "
+                 "use gnulib module pthread-tss for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_TSS@
+# if @REPLACE_PTHREAD_SETSPECIFIC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_setspecific
+#   define pthread_setspecific rpl_pthread_setspecific
+#  endif
+_GL_FUNCDECL_RPL (pthread_setspecific, int,
+                  (pthread_key_t key, const void *value));
+_GL_CXXALIAS_RPL (pthread_setspecific, int,
+                  (pthread_key_t key, const void *value));
+# else
+#  if !@HAVE_PTHREAD_SETSPECIFIC@
+_GL_FUNCDECL_SYS (pthread_setspecific, int,
+                  (pthread_key_t key, const void *value));
+#  endif
+_GL_CXXALIAS_SYS (pthread_setspecific, int,
+                  (pthread_key_t key, const void *value));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_setspecific);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_setspecific
+# if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
+_GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - "
+                 "use gnulib module pthread-tss for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_TSS@
+# if @REPLACE_PTHREAD_GETSPECIFIC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_getspecific
+#   define pthread_getspecific rpl_pthread_getspecific
+#  endif
+_GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key));
+_GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key));
+# else
+#  if !@HAVE_PTHREAD_GETSPECIFIC@
+_GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key));
+#  endif
+_GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_getspecific);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_getspecific
+# if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
+_GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - "
+                 "use gnulib module pthread-tss for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_TSS@
+# if @REPLACE_PTHREAD_KEY_DELETE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_key_delete
+#   define pthread_key_delete rpl_pthread_key_delete
+#  endif
+_GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key));
+_GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key));
+# else
+#  if !@HAVE_PTHREAD_KEY_DELETE@
+_GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key));
+#  endif
+_GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_key_delete);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_key_delete
+# if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
+_GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - "
+                 "use gnulib module pthread-tss for portability");
+# endif
+#endif
+
+/* =========== Spinlock functions =========== */
+
+#if @GNULIB_PTHREAD_SPIN@
+# if @REPLACE_PTHREAD_SPIN_INIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_spin_init
+#   define pthread_spin_init rpl_pthread_spin_init
+#  endif
+_GL_FUNCDECL_RPL (pthread_spin_init, int,
+                  (pthread_spinlock_t *lock, int shared_across_processes)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_spin_init, int,
+                  (pthread_spinlock_t *lock, int shared_across_processes));
+# else
+#  if !@HAVE_PTHREAD_SPIN_INIT@
+_GL_FUNCDECL_SYS (pthread_spin_init, int,
+                  (pthread_spinlock_t *lock, int shared_across_processes)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_spin_init, int,
+                  (pthread_spinlock_t *lock, int shared_across_processes));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_spin_init);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_spin_init
+# if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
+_GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - "
+                 "use gnulib module pthread-spin for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_SPIN@
+# if @REPLACE_PTHREAD_SPIN_LOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_spin_lock
+#   define pthread_spin_lock rpl_pthread_spin_lock
+#  endif
+_GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock)
+                                          _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_SPIN_LOCK@
+_GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock)
+                                          _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_spin_lock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_spin_lock
+# if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
+_GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - "
+                 "use gnulib module pthread-spin for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_SPIN@
+# if @REPLACE_PTHREAD_SPIN_TRYLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_spin_trylock
+#   define pthread_spin_trylock rpl_pthread_spin_trylock
+#  endif
+_GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
+                                             _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_SPIN_TRYLOCK@
+_GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
+                                             _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_spin_trylock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_spin_trylock
+# if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
+_GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - "
+                 "use gnulib module pthread-spin for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_SPIN@
+# if @REPLACE_PTHREAD_SPIN_UNLOCK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_spin_unlock
+#   define pthread_spin_unlock rpl_pthread_spin_unlock
+#  endif
+_GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
+                                            _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_SPIN_UNLOCK@
+_GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
+                                            _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_spin_unlock);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_spin_unlock
+# if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
+_GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - "
+                 "use gnulib module pthread-spin for portability");
+# endif
+#endif
+
+#if @GNULIB_PTHREAD_SPIN@
+# if @REPLACE_PTHREAD_SPIN_DESTROY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_spin_destroy
+#   define pthread_spin_destroy rpl_pthread_spin_destroy
+#  endif
+_GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
+                                             _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
+# else
+#  if !@HAVE_PTHREAD_SPIN_DESTROY@
+_GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
+                                             _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_spin_destroy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_spin_destroy
+# if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
+_GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
+                 "use gnulib module pthread-spin for portability");
+# endif
+#endif
+
+
+#if defined __cplusplus && defined GNULIB_NAMESPACE && !@HAVE_PTHREAD_H@ && defined __MINGW32__
+/* Provide the symbols required by mingw's <bits/gthr-default.h>.  */
+using GNULIB_NAMESPACE::pthread_create;
+using GNULIB_NAMESPACE::pthread_self;
+using GNULIB_NAMESPACE::pthread_equal;
+using GNULIB_NAMESPACE::pthread_detach;
+using GNULIB_NAMESPACE::pthread_join;
+using GNULIB_NAMESPACE::pthread_once;
+using GNULIB_NAMESPACE::pthread_mutex_init;
+using GNULIB_NAMESPACE::pthread_mutexattr_init;
+using GNULIB_NAMESPACE::pthread_mutexattr_settype;
+using GNULIB_NAMESPACE::pthread_mutexattr_destroy;
+using GNULIB_NAMESPACE::pthread_mutex_lock;
+using GNULIB_NAMESPACE::pthread_mutex_trylock;
+using GNULIB_NAMESPACE::pthread_mutex_timedlock;
+using GNULIB_NAMESPACE::pthread_mutex_unlock;
+using GNULIB_NAMESPACE::pthread_mutex_destroy;
+using GNULIB_NAMESPACE::pthread_cond_wait;
+using GNULIB_NAMESPACE::pthread_cond_timedwait;
+using GNULIB_NAMESPACE::pthread_cond_signal;
+using GNULIB_NAMESPACE::pthread_cond_broadcast;
+using GNULIB_NAMESPACE::pthread_cond_destroy;
+using GNULIB_NAMESPACE::pthread_key_create;
+using GNULIB_NAMESPACE::pthread_setspecific;
+using GNULIB_NAMESPACE::pthread_getspecific;
+using GNULIB_NAMESPACE::pthread_key_delete;
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
+#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
+#endif
deleted file mode 120000 (symlink)
index 81bd7d96b7d091fab8f62717473fd0bfb9fe11b8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pthread_mutex_timedlock.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e6c2fb4e2190e933d29eb27108a96f9b68c23102
--- /dev/null
@@ -0,0 +1,91 @@
+/* Lock a mutex, abandoning after a certain time.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <pthread.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <sys/time.h>
+#include <time.h>
+
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+int
+pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime)
+{
+  /* Poll the mutex's state in regular intervals.  Ugh.  */
+  /* POSIX says:
+      "Under no circumstance shall the function fail with a timeout if
+       the mutex can be locked immediately. The validity of the abstime
+       parameter need not be checked if the mutex can be locked
+       immediately."
+     Therefore start the loop with a pthread_mutex_trylock call.  */
+  for (;;)
+    {
+      int err;
+      struct timeval currtime;
+      unsigned long remaining;
+
+      err = pthread_mutex_trylock (mutex);
+      if (err != EBUSY)
+        return err;
+
+      gettimeofday (&currtime, NULL);
+
+      if (currtime.tv_sec > abstime->tv_sec)
+        remaining = 0;
+      else
+        {
+          unsigned long seconds = abstime->tv_sec - currtime.tv_sec;
+          remaining = seconds * 1000000000;
+          if (remaining / 1000000000 != seconds) /* overflow? */
+            remaining = ULONG_MAX;
+          else
+            {
+              long nanoseconds =
+                abstime->tv_nsec - currtime.tv_usec * 1000;
+              if (nanoseconds >= 0)
+                {
+                  remaining += nanoseconds;
+                  if (remaining < nanoseconds) /* overflow? */
+                    remaining = ULONG_MAX;
+                }
+              else
+                {
+                  if (remaining >= - nanoseconds)
+                    remaining -= (- nanoseconds);
+                  else
+                    remaining = 0;
+                }
+            }
+        }
+      if (remaining == 0)
+        return ETIMEDOUT;
+
+      /* Sleep 1 ms.  */
+      struct timespec duration =
+        {
+          .tv_sec = 0,
+          .tv_nsec = MIN (1000000, remaining)
+        };
+      nanosleep (&duration, NULL);
+    }
+}
deleted file mode 120000 (symlink)
index 4d34197de6742ef12fa94c96efbc41080a607c5c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/pthread_sigmask.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3b6e6e454ed238877cf530ce336f28d7d31d84fd
--- /dev/null
@@ -0,0 +1,92 @@
+/* POSIX compatible signal blocking for threads.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <signal.h>
+
+#include <errno.h>
+#include <stddef.h>
+
+#if PTHREAD_SIGMASK_INEFFECTIVE
+# include <string.h>
+#endif
+
+#if PTHREAD_SIGMASK_UNBLOCK_BUG
+# include <unistd.h>
+#endif
+
+int
+pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
+#undef pthread_sigmask
+{
+#if HAVE_PTHREAD_SIGMASK
+  int ret;
+
+# if PTHREAD_SIGMASK_INEFFECTIVE
+  sigset_t omask, omask_copy;
+  sigset_t *old_mask_ptr = &omask;
+  sigemptyset (&omask);
+  /* Add a signal unlikely to be blocked, so that OMASK_COPY
+     is unlikely to match the actual mask.  */
+  sigaddset (&omask, SIGILL);
+  memcpy (&omask_copy, &omask, sizeof omask);
+# else
+  sigset_t *old_mask_ptr = old_mask;
+# endif
+
+  ret = pthread_sigmask (how, new_mask, old_mask_ptr);
+
+# if PTHREAD_SIGMASK_INEFFECTIVE
+  if (ret == 0)
+    {
+      /* Detect whether pthread_sigmask is currently ineffective.
+         Don't cache the information: libpthread.so could be dynamically
+         loaded after the program started and after pthread_sigmask was
+         called for the first time.  */
+      if (memcmp (&omask_copy, &omask, sizeof omask) == 0
+          && pthread_sigmask (1729, &omask_copy, NULL) == 0)
+        {
+          /* pthread_sigmask is currently ineffective.  The program is not
+             linked to -lpthread.  So use sigprocmask instead.  */
+          return (sigprocmask (how, new_mask, old_mask) < 0 ? errno : 0);
+        }
+
+      if (old_mask)
+        memcpy (old_mask, &omask, sizeof omask);
+    }
+# endif
+# if PTHREAD_SIGMASK_FAILS_WITH_ERRNO
+  if (ret == -1)
+    return errno;
+# endif
+# if PTHREAD_SIGMASK_UNBLOCK_BUG
+  if (ret == 0
+      && new_mask != NULL
+      && (how == SIG_UNBLOCK || how == SIG_SETMASK))
+    {
+      /* Give the OS the opportunity to raise signals that were pending before
+         the pthread_sigmask call and have now been unblocked.  */
+      usleep (1);
+    }
+# endif
+  return ret;
+#else
+  int ret = sigprocmask (how, new_mask, old_mask);
+  return (ret < 0 ? errno : 0);
+#endif
+}
deleted file mode 120000 (symlink)
index b3932a4bd5899a2da06e83969bf0e82d870c8d19..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/putenv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2ab6f248db9d2e0c3a3428cda33cbb312289fe9d
--- /dev/null
@@ -0,0 +1,196 @@
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2024 Free Software
+   Foundation, Inc.
+
+   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 file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <stddef.h>
+
+/* Include errno.h *after* sys/types.h to work around header problems
+   on AIX 3.2.5.  */
+#include <errno.h>
+#ifndef __set_errno
+# define __set_errno(ev) ((errno) = (ev))
+#endif
+
+#include <string.h>
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
+#if _LIBC
+# if HAVE_GNU_LD
+#  define environ __environ
+# else
+extern char **environ;
+# endif
+#endif
+
+#if _LIBC
+/* This lock protects against simultaneous modifications of 'environ'.  */
+# include <bits/libc-lock.h>
+__libc_lock_define_initialized (static, envlock)
+# define LOCK   __libc_lock_lock (envlock)
+# define UNLOCK __libc_lock_unlock (envlock)
+#else
+# define LOCK
+# define UNLOCK
+#endif
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Don't assume that UNICODE is not defined.  */
+# undef SetEnvironmentVariable
+# define SetEnvironmentVariable SetEnvironmentVariableA
+#endif
+
+static int
+_unsetenv (const char *name)
+{
+  size_t len;
+#if !HAVE_DECL__PUTENV
+  char **ep;
+#endif
+
+  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  len = strlen (name);
+
+#if HAVE_DECL__PUTENV
+  {
+    int putenv_result;
+    char *name_ = malloc (len + 2);
+    memcpy (name_, name, len);
+    name_[len] = '=';
+    name_[len + 1] = 0;
+    putenv_result = _putenv (name_);
+    free (name_);
+    return putenv_result;
+  }
+#else
+
+  LOCK;
+
+  ep = environ;
+  while (*ep != NULL)
+    if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+      {
+        /* Found it.  Remove this pointer by moving later ones back.  */
+        char **dp = ep;
+
+        do
+          dp[0] = dp[1];
+        while (*dp++);
+        /* Continue the loop in case NAME appears again.  */
+      }
+    else
+      ++ep;
+
+  UNLOCK;
+
+  return 0;
+#endif
+}
+
+
+/* Put STRING, which is of the form "NAME=VALUE", in the environment.
+   If STRING contains no '=', then remove STRING from the environment.  */
+int
+putenv (char *string)
+{
+  const char *name_end = strchr (string, '=');
+  char **ep;
+
+  if (name_end == NULL)
+    {
+      /* Remove the variable from the environment.  */
+      return _unsetenv (string);
+    }
+
+#if HAVE_DECL__PUTENV
+  /* Rely on _putenv to allocate the new environment.  If other
+     parts of the application use _putenv, the !HAVE_DECL__PUTENV code
+     would fight over who owns the environ vector, causing a crash.  */
+  if (name_end[1])
+    return _putenv (string);
+  else
+    {
+      /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ")
+         to allocate the environ vector and then replace the new
+         entry with "NAME=".  */
+      int putenv_result;
+      char *name_x = malloc (name_end - string + sizeof "= ");
+      if (!name_x)
+        return -1;
+      memcpy (name_x, string, name_end - string + 1);
+      name_x[name_end - string + 1] = ' ';
+      name_x[name_end - string + 2] = 0;
+      putenv_result = _putenv (name_x);
+      for (ep = environ; *ep; ep++)
+        if (strcmp (*ep, name_x) == 0)
+          {
+            *ep = string;
+            break;
+          }
+# if defined _WIN32 && ! defined __CYGWIN__
+      if (putenv_result == 0)
+        {
+          /* _putenv propagated "NAME= " into the subprocess environment;
+             fix that by calling SetEnvironmentVariable directly.  */
+          name_x[name_end - string] = 0;
+          putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1;
+          errno = ENOMEM; /* ENOMEM is the only way to fail.  */
+        }
+# endif
+      free (name_x);
+      return putenv_result;
+    }
+#else
+  for (ep = environ; *ep; ep++)
+    if (strncmp (*ep, string, name_end - string) == 0
+        && (*ep)[name_end - string] == '=')
+      break;
+
+  if (*ep)
+    *ep = string;
+  else
+    {
+      static char **last_environ = NULL;
+      size_t size = ep - environ;
+      char **new_environ = malloc ((size + 2) * sizeof *new_environ);
+      if (! new_environ)
+        return -1;
+      new_environ[0] = string;
+      memcpy (new_environ + 1, environ, (size + 1) * sizeof *new_environ);
+      free (last_environ);
+      last_environ = new_environ;
+      environ = new_environ;
+    }
+
+  return 0;
+#endif
+}
deleted file mode 120000 (symlink)
index 4a1da4b6dc1314e01f32564d92442fae7378e3d4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/qcopy-acl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dfc39cead0539d61f0c0d2563350e8aa1f5a5e7e
--- /dev/null
@@ -0,0 +1,85 @@
+/* Copy access control list from one file to another.  -*- coding: utf-8 -*-
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible.  */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include "acl-internal.h"
+
+#if USE_XATTR
+
+# include <attr/libattr.h>
+
+/* Returns 1 if NAME is the name of an extended attribute that is related
+   to permissions, i.e. ACLs.  Returns 0 otherwise.  */
+
+static int
+is_attr_permissions (const char *name, struct error_context *ctx)
+{
+  return attr_copy_action (name, ctx) == ATTR_ACTION_PERMISSIONS;
+}
+
+#endif  /* USE_XATTR */
+
+/* Copy access control lists from one file to another. If SOURCE_DESC is
+   a valid file descriptor, use file descriptor operations, else use
+   filename based operations on SRC_NAME. Likewise for DEST_DESC and
+   DST_NAME.
+   If access control lists are not available, fchmod the target file to
+   MODE.  Also sets the non-permission bits of the destination file
+   (S_ISUID, S_ISGID, S_ISVTX) to those from MODE if any are set.
+   Return 0 if successful.
+   Return -2 and set errno for an error relating to the source file.
+   Return -1 and set errno for an error relating to the destination file.  */
+
+int
+qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
+           int dest_desc, mode_t mode)
+{
+  int ret;
+
+#ifdef USE_XATTR
+  /* in case no ACLs present and also to set higher mode bits
+     we chmod before setting ACLs as doing it after could overwrite them
+     (especially true for NFSv4, posix ACL has that ugly "mask" hack that
+     nobody understands) */
+  ret = chmod_or_fchmod (dst_name, dest_desc, mode);
+  /* Rather than fiddling with acls one by one, we just copy the whole ACL xattrs
+     (Posix or NFSv4). Of course, that won't address ACLs conversion
+     (i.e. posix <-> nfs4) but we can't do it anyway, so for now, we don't care
+     Functions attr_copy_* return 0 in case we copied something OR nothing
+     to copy */
+  if (ret == 0)
+    ret = source_desc <= 0 || dest_desc <= 0
+      ? attr_copy_file (src_name, dst_name, is_attr_permissions, NULL)
+      : attr_copy_fd (src_name, source_desc, dst_name, dest_desc,
+                      is_attr_permissions, NULL);
+#else
+  /* no XATTR, so we proceed the old dusty way */
+  struct permission_context ctx;
+
+  ret = get_permissions (src_name, source_desc, mode, &ctx);
+  if (ret != 0)
+    return -2;
+  ret = set_permissions (&ctx, dst_name, dest_desc);
+  free_permission_context (&ctx);
+#endif
+  return ret;
+}
deleted file mode 120000 (symlink)
index 222c9b694b81ccb5b77e144655100baaf2b435c2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/qset-acl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7318b553c846eeb85a801caf909ebd7805cb9451
--- /dev/null
@@ -0,0 +1,49 @@
+/* qset-acl.c - set access control list equivalent to a mode
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert and Andreas Gruenbacher, and Bruno Haible.  */
+
+#include <config.h>
+
+#define ACL_INTERNAL_INLINE _GL_EXTERN_INLINE
+
+#include <string.h>
+#include "acl.h"
+
+#include "acl-internal.h"
+
+/* Set the access control lists of a file to match *exactly* MODE (this might
+   remove inherited ACLs). Note chmod() tends to honor inherited/default
+   ACLs. If DESC is a valid file descriptor, use file descriptor operations
+   where available, else use filename based operations on NAME.  If access
+   control lists are not available, fchmod the target file to MODE.  Also
+   sets the non-permission bits of the destination file
+   (S_ISUID, S_ISGID, S_ISVTX) to those from MODE if any are set.
+   Return 0 if successful.  Return -1 and set errno upon failure.  */
+
+int
+qset_acl (char const *name, int desc, mode_t mode)
+{
+  struct permission_context ctx;
+  int ret;
+
+  memset (&ctx, 0, sizeof ctx);
+  ctx.mode = mode;
+  ret = set_permissions (&ctx, name, desc);
+  free_permission_context (&ctx);
+  return ret;
+}
deleted file mode 120000 (symlink)
index 5158e9378ca617591428c548e7671a0ff3d744f8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/qsort.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1f4bcb2e88297474d4e4c8db38b2721c9e5dcdee
--- /dev/null
@@ -0,0 +1,258 @@
+/* Copyright (C) 1991-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Written by Douglas C. Schmidt (schmidt@ics.uci.edu).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* If you consider tuning this algorithm, you should consult first:
+   Engineering a sort function; Jon Bentley and M. Douglas McIlroy;
+   Software - Practice and Experience; Vol. 23 (11), 1249-1265, 1993.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef _LIBC
+# define _quicksort qsort_r
+# define __compar_d_fn_t compar_d_fn_t
+typedef int (*compar_d_fn_t) (const void *, const void *, void *);
+#endif
+
+/* Byte-wise swap two items of size SIZE. */
+#define SWAP(a, b, size)                                                     \
+  do                                                                         \
+    {                                                                        \
+      size_t __size = (size);                                                \
+      char *__a = (a), *__b = (b);                                           \
+      do                                                                     \
+       {                                                                     \
+         char __tmp = *__a;                                                  \
+         *__a++ = *__b;                                                      \
+         *__b++ = __tmp;                                                     \
+       } while (--__size > 0);                                               \
+    } while (0)
+
+/* Discontinue quicksort algorithm when partition gets below this size.
+   This particular magic number was chosen to work best on a Sun 4/260. */
+#define MAX_THRESH 4
+
+/* Stack node declarations used to store unfulfilled partition obligations. */
+typedef struct
+  {
+    char *lo;
+    char *hi;
+  } stack_node;
+
+/* The next 4 #defines implement a very fast in-line stack abstraction. */
+/* The stack needs log (total_elements) entries (we could even subtract
+   log(MAX_THRESH)).  Since total_elements has type size_t, we get as
+   upper bound for log (total_elements):
+   bits per byte (CHAR_BIT) * sizeof(size_t).  */
+#define STACK_SIZE     (CHAR_BIT * sizeof(size_t))
+#define PUSH(low, high)        ((void) ((top->lo = (low)), (top->hi = (high)), ++top))
+#define        POP(low, high)  ((void) (--top, (low = top->lo), (high = top->hi)))
+#define        STACK_NOT_EMPTY (stack < top)
+
+
+/* Order size using quicksort.  This implementation incorporates
+   four optimizations discussed in Sedgewick:
+
+   1. Non-recursive, using an explicit stack of pointer that store the
+      next array partition to sort.  To save time, this maximum amount
+      of space required to store an array of SIZE_MAX is allocated on the
+      stack.  Assuming a 32-bit (64 bit) integer for size_t, this needs
+      only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes).
+      Pretty cheap, actually.
+
+   2. Chose the pivot element using a median-of-three decision tree.
+      This reduces the probability of selecting a bad pivot value and
+      eliminates certain extraneous comparisons.
+
+   3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving
+      insertion sort to order the MAX_THRESH items within each partition.
+      This is a big win, since insertion sort is faster for small, mostly
+      sorted array segments.
+
+   4. The larger of the two sub-partitions is always pushed onto the
+      stack first, with the algorithm then concentrating on the
+      smaller partition.  This *guarantees* no more than log (total_elems)
+      stack size is needed (actually O(1) in this case)!  */
+
+void
+_quicksort (void *const pbase, size_t total_elems, size_t size,
+           __compar_d_fn_t cmp, void *arg)
+{
+  char *base_ptr = (char *) pbase;
+
+  const size_t max_thresh = MAX_THRESH * size;
+
+  if (total_elems == 0)
+    /* Avoid lossage with unsigned arithmetic below.  */
+    return;
+
+  if (total_elems > MAX_THRESH)
+    {
+      char *lo = base_ptr;
+      char *hi = &lo[size * (total_elems - 1)];
+      stack_node stack[STACK_SIZE];
+      stack_node *top = stack;
+
+      PUSH (NULL, NULL);
+
+      while (STACK_NOT_EMPTY)
+        {
+          char *left_ptr;
+          char *right_ptr;
+
+         /* Select median value from among LO, MID, and HI. Rearrange
+            LO and HI so the three values are sorted. This lowers the
+            probability of picking a pathological pivot value and
+            skips a comparison for both the LEFT_PTR and RIGHT_PTR in
+            the while loops. */
+
+         char *mid = lo + size * ((hi - lo) / size >> 1);
+
+         if ((*cmp) ((void *) mid, (void *) lo, arg) < 0)
+           SWAP (mid, lo, size);
+         if ((*cmp) ((void *) hi, (void *) mid, arg) < 0)
+           SWAP (mid, hi, size);
+         else
+           goto jump_over;
+         if ((*cmp) ((void *) mid, (void *) lo, arg) < 0)
+           SWAP (mid, lo, size);
+       jump_over:;
+
+         left_ptr  = lo + size;
+         right_ptr = hi - size;
+
+         /* Here's the famous ``collapse the walls'' section of quicksort.
+            Gotta like those tight inner loops!  They are the main reason
+            that this algorithm runs much faster than others. */
+         do
+           {
+             while ((*cmp) ((void *) left_ptr, (void *) mid, arg) < 0)
+               left_ptr += size;
+
+             while ((*cmp) ((void *) mid, (void *) right_ptr, arg) < 0)
+               right_ptr -= size;
+
+             if (left_ptr < right_ptr)
+               {
+                 SWAP (left_ptr, right_ptr, size);
+                 if (mid == left_ptr)
+                   mid = right_ptr;
+                 else if (mid == right_ptr)
+                   mid = left_ptr;
+                 left_ptr += size;
+                 right_ptr -= size;
+               }
+             else if (left_ptr == right_ptr)
+               {
+                 left_ptr += size;
+                 right_ptr -= size;
+                 break;
+               }
+           }
+         while (left_ptr <= right_ptr);
+
+          /* Set up pointers for next iteration.  First determine whether
+             left and right partitions are below the threshold size.  If so,
+             ignore one or both.  Otherwise, push the larger partition's
+             bounds on the stack and continue sorting the smaller one. */
+
+          if ((size_t) (right_ptr - lo) <= max_thresh)
+            {
+              if ((size_t) (hi - left_ptr) <= max_thresh)
+               /* Ignore both small partitions. */
+                POP (lo, hi);
+              else
+               /* Ignore small left partition. */
+                lo = left_ptr;
+            }
+          else if ((size_t) (hi - left_ptr) <= max_thresh)
+           /* Ignore small right partition. */
+            hi = right_ptr;
+          else if ((right_ptr - lo) > (hi - left_ptr))
+            {
+             /* Push larger left partition indices. */
+              PUSH (lo, right_ptr);
+              lo = left_ptr;
+            }
+          else
+            {
+             /* Push larger right partition indices. */
+              PUSH (left_ptr, hi);
+              hi = right_ptr;
+            }
+        }
+    }
+
+  /* Once the BASE_PTR array is partially sorted by quicksort the rest
+     is completely sorted using insertion sort, since this is efficient
+     for partitions below MAX_THRESH size. BASE_PTR points to the beginning
+     of the array to sort, and END_PTR points at the very last element in
+     the array (*not* one beyond it!). */
+
+#define min(x, y) ((x) < (y) ? (x) : (y))
+
+  {
+    char *const end_ptr = &base_ptr[size * (total_elems - 1)];
+    char *tmp_ptr = base_ptr;
+    char *thresh = min(end_ptr, base_ptr + max_thresh);
+    char *run_ptr;
+
+    /* Find smallest element in first threshold and place it at the
+       array's beginning.  This is the smallest array element,
+       and the operation speeds up insertion sort's inner loop. */
+
+    for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size)
+      if ((*cmp) ((void *) run_ptr, (void *) tmp_ptr, arg) < 0)
+        tmp_ptr = run_ptr;
+
+    if (tmp_ptr != base_ptr)
+      SWAP (tmp_ptr, base_ptr, size);
+
+    /* Insertion sort, running from left-hand-side up to right-hand-side.  */
+
+    run_ptr = base_ptr + size;
+    while ((run_ptr += size) <= end_ptr)
+      {
+       tmp_ptr = run_ptr - size;
+       while ((*cmp) ((void *) run_ptr, (void *) tmp_ptr, arg) < 0)
+         tmp_ptr -= size;
+
+       tmp_ptr += size;
+        if (tmp_ptr != run_ptr)
+          {
+            char *trav;
+
+           trav = run_ptr + size;
+           while (--trav >= run_ptr)
+              {
+                char c = *trav;
+                char *hi, *lo;
+
+                for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo)
+                  *hi = *lo;
+                *hi = c;
+              }
+          }
+      }
+  }
+}
deleted file mode 120000 (symlink)
index 37a4d2c07da72b63c5af3913c655612c4e6272d2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/qsort_r.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..61e382ed43984a67df023afd8799d33570dd53e8
--- /dev/null
@@ -0,0 +1,51 @@
+/* Reentrant sort function.
+
+   Copyright 2014-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+/* This file is compiled only when the system has a qsort_r that needs
+   to be replaced because it has the BSD signature rather than the GNU
+   signature.  */
+
+struct thunk
+{
+  int (*cmp) (void const *, void const *, void *);
+  void *arg;
+};
+
+static int
+thunk_cmp (void *thunk, void const *a, void const *b)
+{
+  struct thunk *th = thunk;
+  return th->cmp (a, b, th->arg);
+}
+
+void
+qsort_r (void *base, size_t nmemb, size_t size,
+         int (*cmp) (void const *, void const *, void *),
+         void *arg)
+{
+# undef qsort_r
+  struct thunk thunk;
+  thunk.cmp = cmp;
+  thunk.arg = arg;
+  qsort_r (base, nmemb, size, &thunk, thunk_cmp);
+}
deleted file mode 120000 (symlink)
index 16360bd7f69c73990fe897114f5bb606c96d9124..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/quote.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2a1c58131bd2d5a71b8638e435cf751dec256ee4
--- /dev/null
@@ -0,0 +1,46 @@
+/* quote.h - prototypes for quote.c
+
+   Copyright (C) 1998-2001, 2003, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef QUOTE_H_
+# define QUOTE_H_ 1
+
+# include <stddef.h>
+
+/* The quoting options used by quote_n and quote.  Its type is incomplete,
+   so it's useful only in expressions like '&quote_quoting_options'.  */
+extern struct quoting_options quote_quoting_options;
+
+/* Return an unambiguous printable representation of ARG (of size
+   ARGSIZE), allocated in slot N, suitable for diagnostics.  If
+   ARGSIZE is SIZE_MAX, use the string length of the argument for
+   ARGSIZE.  */
+char const *quote_n_mem (int n, char const *arg, size_t argsize);
+
+/* Return an unambiguous printable representation of ARG (of size
+   ARGSIZE), suitable for diagnostics.  If ARGSIZE is SIZE_MAX, use
+   the string length of the argument for ARGSIZE.  */
+char const *quote_mem (char const *arg, size_t argsize);
+
+/* Return an unambiguous printable representation of ARG, allocated in
+   slot N, suitable for diagnostics.  */
+char const *quote_n (int n, char const *arg);
+
+/* Return an unambiguous printable representation of ARG, suitable for
+   diagnostics.  */
+char const *quote (char const *arg);
+
+#endif /* !QUOTE_H_ */
deleted file mode 120000 (symlink)
index e070795228e0b290599ac96407a2c638617f3a4f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/quotearg.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..847101e6059cb434a79c6680e0bdaeb2ae4472f1
--- /dev/null
+/* quotearg.c - quote arguments for output
+
+   Copyright (C) 1998-2002, 2004-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert <eggert@twinsun.com> */
+
+/* Without this pragma, gcc 4.7.0 20111124 mistakenly suggests that
+   the quoting_options_from_style function might be candidate for
+   attribute 'pure'  */
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+#endif
+
+#include <config.h>
+
+#include "quotearg.h"
+#include "quote.h"
+
+#include "attribute.h"
+#include "minmax.h"
+#include "xalloc.h"
+#include "c-strcaseeq.h"
+#include "localcharset.h"
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <uchar.h>
+#include <wchar.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
+#define INT_BITS (sizeof (int) * CHAR_BIT)
+
+struct quoting_options
+{
+  /* Basic quoting style.  */
+  enum quoting_style style;
+
+  /* Additional flags.  Bitwise combination of enum quoting_flags.  */
+  int flags;
+
+  /* Quote the characters indicated by this bit vector even if the
+     quoting style would not normally require them to be quoted.  */
+  unsigned int quote_these_too[(UCHAR_MAX / INT_BITS) + 1];
+
+  /* The left quote for custom_quoting_style.  */
+  char const *left_quote;
+
+  /* The right quote for custom_quoting_style.  */
+  char const *right_quote;
+};
+
+/* Names of quoting styles.  */
+char const *const quoting_style_args[] =
+{
+  "literal",
+  "shell",
+  "shell-always",
+  "shell-escape",
+  "shell-escape-always",
+  "c",
+  "c-maybe",
+  "escape",
+  "locale",
+  "clocale",
+  0
+};
+
+/* Correspondences to quoting style names.  */
+enum quoting_style const quoting_style_vals[] =
+{
+  literal_quoting_style,
+  shell_quoting_style,
+  shell_always_quoting_style,
+  shell_escape_quoting_style,
+  shell_escape_always_quoting_style,
+  c_quoting_style,
+  c_maybe_quoting_style,
+  escape_quoting_style,
+  locale_quoting_style,
+  clocale_quoting_style
+};
+
+/* The default quoting options.  */
+static struct quoting_options default_quoting_options;
+
+/* Allocate a new set of quoting options, with contents initially identical
+   to O if O is not null, or to the default if O is null.
+   It is the caller's responsibility to free the result.  */
+struct quoting_options *
+clone_quoting_options (struct quoting_options *o)
+{
+  int e = errno;
+  struct quoting_options *p = xmemdup (o ? o : &default_quoting_options,
+                                       sizeof *o);
+  errno = e;
+  return p;
+}
+
+/* Get the value of O's quoting style.  If O is null, use the default.  */
+enum quoting_style
+get_quoting_style (struct quoting_options const *o)
+{
+  return (o ? o : &default_quoting_options)->style;
+}
+
+/* In O (or in the default if O is null),
+   set the value of the quoting style to S.  */
+void
+set_quoting_style (struct quoting_options *o, enum quoting_style s)
+{
+  (o ? o : &default_quoting_options)->style = s;
+}
+
+/* In O (or in the default if O is null),
+   set the value of the quoting options for character C to I.
+   Return the old value.  Currently, the only values defined for I are
+   0 (the default) and 1 (which means to quote the character even if
+   it would not otherwise be quoted).  */
+int
+set_char_quoting (struct quoting_options *o, char c, int i)
+{
+  unsigned char uc = c;
+  unsigned int *p =
+    (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS;
+  int shift = uc % INT_BITS;
+  int r = (*p >> shift) & 1;
+  *p ^= ((i & 1) ^ r) << shift;
+  return r;
+}
+
+/* In O (or in the default if O is null),
+   set the value of the quoting options flag to I, which can be a
+   bitwise combination of enum quoting_flags, or 0 for default
+   behavior.  Return the old value.  */
+int
+set_quoting_flags (struct quoting_options *o, int i)
+{
+  int r;
+  if (!o)
+    o = &default_quoting_options;
+  r = o->flags;
+  o->flags = i;
+  return r;
+}
+
+void
+set_custom_quoting (struct quoting_options *o,
+                    char const *left_quote, char const *right_quote)
+{
+  if (!o)
+    o = &default_quoting_options;
+  o->style = custom_quoting_style;
+  if (!left_quote || !right_quote)
+    abort ();
+  o->left_quote = left_quote;
+  o->right_quote = right_quote;
+}
+
+/* Return quoting options for STYLE, with no extra quoting.  */
+static struct quoting_options /* NOT PURE!! */
+quoting_options_from_style (enum quoting_style style)
+{
+  struct quoting_options o = { literal_quoting_style, 0, { 0 }, NULL, NULL };
+  if (style == custom_quoting_style)
+    abort ();
+  o.style = style;
+  return o;
+}
+
+/* MSGID approximates a quotation mark.  Return its translation if it
+   has one; otherwise, return either it or "\"", depending on S.
+
+   S is either clocale_quoting_style or locale_quoting_style.  */
+static char const *
+gettext_quote (char const *msgid, enum quoting_style s)
+{
+  char const *translation = _(msgid);
+  char const *locale_code;
+
+  if (translation != msgid)
+    return translation;
+
+  /* For UTF-8 and GB-18030, use single quotes U+2018 and U+2019.
+     Here is a list of other locales that include U+2018 and U+2019:
+
+        ISO-8859-7   0xA1                 KOI8-T       0x91
+        CP869        0x8B                 CP874        0x91
+        CP932        0x81 0x65            CP936        0xA1 0xAE
+        CP949        0xA1 0xAE            CP950        0xA1 0xA5
+        CP1250       0x91                 CP1251       0x91
+        CP1252       0x91                 CP1253       0x91
+        CP1254       0x91                 CP1255       0x91
+        CP1256       0x91                 CP1257       0x91
+        EUC-JP       0xA1 0xC6            EUC-KR       0xA1 0xAE
+        EUC-TW       0xA1 0xE4            BIG5         0xA1 0xA5
+        BIG5-HKSCS   0xA1 0xA5            EUC-CN       0xA1 0xAE
+        GBK          0xA1 0xAE            Georgian-PS  0x91
+        PT154        0x91
+
+     None of these is still in wide use; using iconv is overkill.  */
+  locale_code = locale_charset ();
+  if (STRCASEEQ (locale_code, "UTF-8", 'U','T','F','-','8',0,0,0,0))
+    return msgid[0] == '`' ? "\xe2\x80\x98": "\xe2\x80\x99";
+  if (STRCASEEQ (locale_code, "GB18030", 'G','B','1','8','0','3','0',0,0))
+    return msgid[0] == '`' ? "\xa1\ae": "\xa1\xaf";
+
+  return (s == clocale_quoting_style ? "\"" : "'");
+}
+
+/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
+   argument ARG (of size ARGSIZE), using QUOTING_STYLE, FLAGS, and
+   QUOTE_THESE_TOO to control quoting.
+   Terminate the output with a null character, and return the written
+   size of the output, not counting the terminating null.
+   If BUFFERSIZE is too small to store the output string, return the
+   value that would have been returned had BUFFERSIZE been large enough.
+   If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE.
+
+   This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG,
+   ARGSIZE, O), except it breaks O into its component pieces and is
+   not careful about errno.  */
+
+static size_t
+quotearg_buffer_restyled (char *buffer, size_t buffersize,
+                          char const *arg, size_t argsize,
+                          enum quoting_style quoting_style, int flags,
+                          unsigned int const *quote_these_too,
+                          char const *left_quote,
+                          char const *right_quote)
+{
+  size_t i;
+  size_t len = 0;
+  size_t orig_buffersize = 0;
+  char const *quote_string = 0;
+  size_t quote_string_len = 0;
+  bool backslash_escapes = false;
+  bool unibyte_locale = MB_CUR_MAX == 1;
+  bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0;
+  bool pending_shell_escape_end = false;
+  bool encountered_single_quote = false;
+  bool all_c_and_shell_quote_compat = true;
+
+#define STORE(c) \
+    do \
+      { \
+        if (len < buffersize) \
+          buffer[len] = (c); \
+        len++; \
+      } \
+    while (0)
+
+#define START_ESC() \
+    do \
+      { \
+        if (elide_outer_quotes) \
+          goto force_outer_quoting_style; \
+        escaping = true; \
+        if (quoting_style == shell_always_quoting_style \
+            && ! pending_shell_escape_end) \
+          { \
+            STORE ('\''); \
+            STORE ('$'); \
+            STORE ('\''); \
+            pending_shell_escape_end = true; \
+          } \
+        STORE ('\\'); \
+      } \
+    while (0)
+
+#define END_ESC() \
+    do \
+      { \
+        if (pending_shell_escape_end && ! escaping) \
+          { \
+            STORE ('\''); \
+            STORE ('\''); \
+            pending_shell_escape_end = false; \
+          } \
+      } \
+    while (0)
+
+ process_input:
+
+  switch (quoting_style)
+    {
+    case c_maybe_quoting_style:
+      quoting_style = c_quoting_style;
+      elide_outer_quotes = true;
+      FALLTHROUGH;
+    case c_quoting_style:
+      if (!elide_outer_quotes)
+        STORE ('"');
+      backslash_escapes = true;
+      quote_string = "\"";
+      quote_string_len = 1;
+      break;
+
+    case escape_quoting_style:
+      backslash_escapes = true;
+      elide_outer_quotes = false;
+      break;
+
+    case locale_quoting_style:
+    case clocale_quoting_style:
+    case custom_quoting_style:
+      {
+        if (quoting_style != custom_quoting_style)
+          {
+            /* TRANSLATORS:
+               Get translations for open and closing quotation marks.
+               The message catalog should translate "`" to a left
+               quotation mark suitable for the locale, and similarly for
+               "'".  For example, a French Unicode local should translate
+               these to U+00AB (LEFT-POINTING DOUBLE ANGLE
+               QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE
+               QUOTATION MARK), respectively.
+
+               If the catalog has no translation, we will try to
+               use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and
+               Unicode U+2019 (RIGHT SINGLE QUOTATION MARK).  If the
+               current locale is not Unicode, locale_quoting_style
+               will quote 'like this', and clocale_quoting_style will
+               quote "like this".  You should always include translations
+               for "`" and "'" even if U+2018 and U+2019 are appropriate
+               for your locale.
+
+               If you don't know what to put here, please see
+               <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages>
+               and use glyphs suitable for your language.  */
+            left_quote = gettext_quote (N_("`"), quoting_style);
+            right_quote = gettext_quote (N_("'"), quoting_style);
+          }
+        if (!elide_outer_quotes)
+          for (quote_string = left_quote; *quote_string; quote_string++)
+            STORE (*quote_string);
+        backslash_escapes = true;
+        quote_string = right_quote;
+        quote_string_len = strlen (quote_string);
+      }
+      break;
+
+    case shell_escape_quoting_style:
+      backslash_escapes = true;
+      FALLTHROUGH;
+    case shell_quoting_style:
+      elide_outer_quotes = true;
+      FALLTHROUGH;
+    case shell_escape_always_quoting_style:
+      if (!elide_outer_quotes)
+        backslash_escapes = true;
+      FALLTHROUGH;
+    case shell_always_quoting_style:
+      quoting_style = shell_always_quoting_style;
+      if (!elide_outer_quotes)
+        STORE ('\'');
+      quote_string = "'";
+      quote_string_len = 1;
+      break;
+
+    case literal_quoting_style:
+      elide_outer_quotes = false;
+      break;
+
+    default:
+      abort ();
+    }
+
+  for (i = 0;  ! (argsize == SIZE_MAX ? arg[i] == '\0' : i == argsize);  i++)
+    {
+      unsigned char c;
+      unsigned char esc;
+      bool is_right_quote = false;
+      bool escaping = false;
+      bool c_and_shell_quote_compat = false;
+
+      if (backslash_escapes
+          && quoting_style != shell_always_quoting_style
+          && quote_string_len
+          && (i + quote_string_len
+              <= (argsize == SIZE_MAX && 1 < quote_string_len
+                  /* Use strlen only if we must: when argsize is SIZE_MAX,
+                     and when the quote string is more than 1 byte long.
+                     If we do call strlen, save the result.  */
+                  ? (argsize = strlen (arg)) : argsize))
+          && memcmp (arg + i, quote_string, quote_string_len) == 0)
+        {
+          if (elide_outer_quotes)
+            goto force_outer_quoting_style;
+          is_right_quote = true;
+        }
+
+      c = arg[i];
+      switch (c)
+        {
+        case '\0':
+          if (backslash_escapes)
+            {
+              START_ESC ();
+              /* If quote_string were to begin with digits, we'd need to
+                 test for the end of the arg as well.  However, it's
+                 hard to imagine any locale that would use digits in
+                 quotes, and set_custom_quoting is documented not to
+                 accept them.  Use only a single \0 with shell-escape
+                 as currently digits are not printed within $'...'  */
+              if (quoting_style != shell_always_quoting_style
+                  && i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9')
+                {
+                  STORE ('0');
+                  STORE ('0');
+                }
+              c = '0';
+              /* We don't have to worry that this last '0' will be
+                 backslash-escaped because, again, quote_string should
+                 not start with it and because quote_these_too is
+                 documented as not accepting it.  */
+            }
+          else if (flags & QA_ELIDE_NULL_BYTES)
+            continue;
+          break;
+
+        case '?':
+          switch (quoting_style)
+            {
+            case shell_always_quoting_style:
+              if (elide_outer_quotes)
+                goto force_outer_quoting_style;
+              break;
+
+            case c_quoting_style:
+              if ((flags & QA_SPLIT_TRIGRAPHS)
+                  && i + 2 < argsize && arg[i + 1] == '?')
+                switch (arg[i + 2])
+                  {
+                  case '!': case '\'':
+                  case '(': case ')': case '-': case '/':
+                  case '<': case '=': case '>':
+                    /* Escape the second '?' in what would otherwise be
+                       a trigraph.  */
+                    if (elide_outer_quotes)
+                      goto force_outer_quoting_style;
+                    c = arg[i + 2];
+                    i += 2;
+                    STORE ('?');
+                    STORE ('"');
+                    STORE ('"');
+                    STORE ('?');
+                    break;
+
+                  default:
+                    break;
+                  }
+              break;
+
+            default:
+              break;
+            }
+          break;
+
+        case '\a': esc = 'a'; goto c_escape;
+        case '\b': esc = 'b'; goto c_escape;
+        case '\f': esc = 'f'; goto c_escape;
+        case '\n': esc = 'n'; goto c_and_shell_escape;
+        case '\r': esc = 'r'; goto c_and_shell_escape;
+        case '\t': esc = 't'; goto c_and_shell_escape;
+        case '\v': esc = 'v'; goto c_escape;
+        case '\\': esc = c;
+          /* Never need to escape '\' in shell case.  */
+          if (quoting_style == shell_always_quoting_style)
+            {
+              if (elide_outer_quotes)
+                goto force_outer_quoting_style;
+              goto store_c;
+            }
+
+          /* No need to escape the escape if we are trying to elide
+             outer quotes and nothing else is problematic.  */
+          if (backslash_escapes && elide_outer_quotes && quote_string_len)
+            goto store_c;
+
+        c_and_shell_escape:
+          if (quoting_style == shell_always_quoting_style
+              && elide_outer_quotes)
+            goto force_outer_quoting_style;
+          /* fall through */
+        c_escape:
+          if (backslash_escapes)
+            {
+              c = esc;
+              goto store_escape;
+            }
+          break;
+
+        case '{': case '}': /* sometimes special if isolated */
+          if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1))
+            break;
+          FALLTHROUGH;
+        case '#': case '~':
+          if (i != 0)
+            break;
+          FALLTHROUGH;
+        case ' ':
+          c_and_shell_quote_compat = true;
+          FALLTHROUGH;
+        case '!': /* special in bash */
+        case '"': case '$': case '&':
+        case '(': case ')': case '*': case ';':
+        case '<':
+        case '=': /* sometimes special in 0th or (with "set -k") later args */
+        case '>': case '[':
+        case '^': /* special in old /bin/sh, e.g., Solaris 10 */
+        case '`': case '|':
+          /* A shell special character.  */
+          if (quoting_style == shell_always_quoting_style
+              && elide_outer_quotes)
+            goto force_outer_quoting_style;
+          break;
+
+        case '\'':
+          encountered_single_quote = true;
+          c_and_shell_quote_compat = true;
+          if (quoting_style == shell_always_quoting_style)
+            {
+              if (elide_outer_quotes)
+                goto force_outer_quoting_style;
+
+              if (buffersize && ! orig_buffersize)
+                {
+                  /* Just scan string to see if supports a more concise
+                     representation, rather than writing a longer string
+                     but returning the length of the more concise form.  */
+                  orig_buffersize = buffersize;
+                  buffersize = 0;
+                }
+
+              STORE ('\'');
+              STORE ('\\');
+              STORE ('\'');
+              pending_shell_escape_end = false;
+            }
+          break;
+
+        case '%': case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4': case '5':
+        case '6': case '7': case '8': case '9': case ':':
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+        case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+        case 'Y': case 'Z': case ']': case '_': case 'a': case 'b':
+        case 'c': case 'd': case 'e': case 'f': case 'g': case 'h':
+        case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
+        case 'o': case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
+          /* These characters don't cause problems, no matter what the
+             quoting style is.  They cannot start multibyte sequences.
+             A digit or a special letter would cause trouble if it
+             appeared at the beginning of quote_string because we'd then
+             escape by prepending a backslash.  However, it's hard to
+             imagine any locale that would use digits or letters as
+             quotes, and set_custom_quoting is documented not to accept
+             them.  Also, a digit or a special letter would cause
+             trouble if it appeared in quote_these_too, but that's also
+             documented as not accepting them.  */
+          c_and_shell_quote_compat = true;
+          break;
+
+        default:
+          /* If we have a multibyte sequence, copy it until we reach
+             its end, find an error, or come back to the initial shift
+             state.  For C-like styles, if the sequence has
+             unprintable characters, escape the whole sequence, since
+             we can't easily escape single characters within it.  */
+          {
+            /* Length of multibyte sequence found so far.  */
+            size_t m;
+
+            bool printable;
+
+            if (unibyte_locale)
+              {
+                m = 1;
+                printable = isprint (c) != 0;
+              }
+            else
+              {
+                mbstate_t mbstate;
+                mbszero (&mbstate);
+
+                m = 0;
+                printable = true;
+                if (argsize == SIZE_MAX)
+                  argsize = strlen (arg);
+
+                for (;;)
+                  {
+                    char32_t w;
+                    size_t bytes = mbrtoc32 (&w, &arg[i + m],
+                                             argsize - (i + m), &mbstate);
+                    if (bytes == 0)
+                      break;
+                    else if (bytes == (size_t) -1)
+                      {
+                        printable = false;
+                        break;
+                      }
+                    else if (bytes == (size_t) -2)
+                      {
+                        printable = false;
+                        while (i + m < argsize && arg[i + m])
+                          m++;
+                        break;
+                      }
+                    else
+                      {
+                        #if !GNULIB_MBRTOC32_REGULAR
+                        if (bytes == (size_t) -3)
+                          bytes = 0;
+                        #endif
+                        /* Work around a bug with older shells that "see" a '\'
+                           that is really the 2nd byte of a multibyte character.
+                           In practice the problem is limited to ASCII
+                           chars >= '@' that are shell special chars.  */
+                        if ('[' == 0x5b && elide_outer_quotes
+                            && quoting_style == shell_always_quoting_style)
+                          {
+                            size_t j;
+                            for (j = 1; j < bytes; j++)
+                              switch (arg[i + m + j])
+                                {
+                                case '[': case '\\': case '^':
+                                case '`': case '|':
+                                  goto force_outer_quoting_style;
+
+                                default:
+                                  break;
+                                }
+                          }
+
+                        if (! c32isprint (w))
+                          printable = false;
+                        m += bytes;
+                      }
+                    #if !GNULIB_MBRTOC32_REGULAR
+                    if (mbsinit (&mbstate))
+                    #endif
+                      break;
+                  }
+              }
+
+            c_and_shell_quote_compat = printable;
+
+            if (1 < m || (backslash_escapes && ! printable))
+              {
+                /* Output a multibyte sequence, or an escaped
+                   unprintable unibyte character.  */
+                size_t ilim = i + m;
+
+                for (;;)
+                  {
+                    if (backslash_escapes && ! printable)
+                      {
+                        START_ESC ();
+                        STORE ('0' + (c >> 6));
+                        STORE ('0' + ((c >> 3) & 7));
+                        c = '0' + (c & 7);
+                      }
+                    else if (is_right_quote)
+                      {
+                        STORE ('\\');
+                        is_right_quote = false;
+                      }
+                    if (ilim <= i + 1)
+                      break;
+                    END_ESC ();
+                    STORE (c);
+                    c = arg[++i];
+                  }
+
+                goto store_c;
+              }
+          }
+        }
+
+      if (! (((backslash_escapes && quoting_style != shell_always_quoting_style)
+              || elide_outer_quotes)
+             && quote_these_too
+             && quote_these_too[c / INT_BITS] >> (c % INT_BITS) & 1)
+          && !is_right_quote)
+        goto store_c;
+
+    store_escape:
+      START_ESC ();
+
+    store_c:
+      END_ESC ();
+      STORE (c);
+
+      if (! c_and_shell_quote_compat)
+        all_c_and_shell_quote_compat = false;
+    }
+
+  if (len == 0 && quoting_style == shell_always_quoting_style
+      && elide_outer_quotes)
+    goto force_outer_quoting_style;
+
+  /* Single shell quotes (') are commonly enough used as an apostrophe,
+     that we attempt to minimize the quoting in this case.  Note itʼs
+     better to use the apostrophe modifier "\u02BC" if possible, as that
+     renders better and works with the word match regex \W+ etc.  */
+  if (quoting_style == shell_always_quoting_style && ! elide_outer_quotes
+      && encountered_single_quote)
+    {
+      if (all_c_and_shell_quote_compat)
+        return quotearg_buffer_restyled (buffer, orig_buffersize, arg, argsize,
+                                         c_quoting_style,
+                                         flags, quote_these_too,
+                                         left_quote, right_quote);
+      else if (! buffersize && orig_buffersize)
+        {
+          /* Disable read-only scan, and reprocess to write quoted string.  */
+          buffersize = orig_buffersize;
+          len = 0;
+          goto process_input;
+        }
+    }
+
+  if (quote_string && !elide_outer_quotes)
+    for (; *quote_string; quote_string++)
+      STORE (*quote_string);
+
+  if (len < buffersize)
+    buffer[len] = '\0';
+  return len;
+
+ force_outer_quoting_style:
+  /* Don't reuse quote_these_too, since the addition of outer quotes
+     sufficiently quotes the specified characters.  */
+  if (quoting_style == shell_always_quoting_style && backslash_escapes)
+    quoting_style = shell_escape_always_quoting_style;
+  return quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
+                                   quoting_style,
+                                   flags & ~QA_ELIDE_OUTER_QUOTES, NULL,
+                                   left_quote, right_quote);
+}
+
+/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
+   argument ARG (of size ARGSIZE), using O to control quoting.
+   If O is null, use the default.
+   Terminate the output with a null character, and return the written
+   size of the output, not counting the terminating null.
+   If BUFFERSIZE is too small to store the output string, return the
+   value that would have been returned had BUFFERSIZE been large enough.
+   If ARGSIZE is SIZE_MAX, use the string length of the argument for
+   ARGSIZE.  */
+size_t
+quotearg_buffer (char *buffer, size_t buffersize,
+                 char const *arg, size_t argsize,
+                 struct quoting_options const *o)
+{
+  struct quoting_options const *p = o ? o : &default_quoting_options;
+  int e = errno;
+  size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
+                                       p->style, p->flags, p->quote_these_too,
+                                       p->left_quote, p->right_quote);
+  errno = e;
+  return r;
+}
+
+char *
+quotearg_alloc (char const *arg, size_t argsize,
+                struct quoting_options const *o)
+{
+  return quotearg_alloc_mem (arg, argsize, NULL, o);
+}
+
+/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly
+   allocated storage containing the quoted string, and store the
+   resulting size into *SIZE, if non-NULL.  The result can contain
+   embedded null bytes only if ARGSIZE is not SIZE_MAX, SIZE is not
+   NULL, and set_quoting_flags has not set the null byte elision
+   flag.  */
+char *
+quotearg_alloc_mem (char const *arg, size_t argsize, size_t *size,
+                    struct quoting_options const *o)
+{
+  struct quoting_options const *p = o ? o : &default_quoting_options;
+  int e = errno;
+  /* Elide embedded null bytes if we can't return a size.  */
+  int flags = p->flags | (size ? 0 : QA_ELIDE_NULL_BYTES);
+  size_t bufsize = quotearg_buffer_restyled (0, 0, arg, argsize, p->style,
+                                             flags, p->quote_these_too,
+                                             p->left_quote,
+                                             p->right_quote) + 1;
+  char *buf = xcharalloc (bufsize);
+  quotearg_buffer_restyled (buf, bufsize, arg, argsize, p->style, flags,
+                            p->quote_these_too,
+                            p->left_quote, p->right_quote);
+  errno = e;
+  if (size)
+    *size = bufsize - 1;
+  return buf;
+}
+
+/* A storage slot with size and pointer to a value.  */
+struct slotvec
+{
+  size_t size;
+  char *val;
+};
+
+/* Preallocate a slot 0 buffer, so that the caller can always quote
+   one small component of a "memory exhausted" message in slot 0.  */
+static char slot0[256];
+static int nslots = 1;
+static struct slotvec slotvec0 = {sizeof slot0, slot0};
+static struct slotvec *slotvec = &slotvec0;
+
+void
+quotearg_free (void)
+{
+  struct slotvec *sv = slotvec;
+  int i;
+  for (i = 1; i < nslots; i++)
+    free (sv[i].val);
+  if (sv[0].val != slot0)
+    {
+      free (sv[0].val);
+      slotvec0.size = sizeof slot0;
+      slotvec0.val = slot0;
+    }
+  if (sv != &slotvec0)
+    {
+      free (sv);
+      slotvec = &slotvec0;
+    }
+  nslots = 1;
+}
+
+/* Use storage slot N to return a quoted version of argument ARG.
+   ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a
+   null-terminated string.
+   OPTIONS specifies the quoting options.
+   The returned value points to static storage that can be
+   reused by the next call to this function with the same value of N.
+   N must be nonnegative; it is typically small, and must be
+   less than MIN (INT_MAX, IDX_MAX).  The type of N is signed
+   to allow for future extensions (using negative values).  */
+static char *
+quotearg_n_options (int n, char const *arg, size_t argsize,
+                    struct quoting_options const *options)
+{
+  int e = errno;
+
+  struct slotvec *sv = slotvec;
+
+  int nslots_max = MIN (INT_MAX, IDX_MAX);
+  if (! (0 <= n && n < nslots_max))
+    abort ();
+
+  if (nslots <= n)
+    {
+      bool preallocated = (sv == &slotvec0);
+      idx_t new_nslots = nslots;
+
+      slotvec = sv = xpalloc (preallocated ? NULL : sv, &new_nslots,
+                              n - nslots + 1, nslots_max, sizeof *sv);
+      if (preallocated)
+        *sv = slotvec0;
+      memset (sv + nslots, 0, (new_nslots - nslots) * sizeof *sv);
+      nslots = new_nslots;
+    }
+
+  {
+    size_t size = sv[n].size;
+    char *val = sv[n].val;
+    /* Elide embedded null bytes since we don't return a size.  */
+    int flags = options->flags | QA_ELIDE_NULL_BYTES;
+    size_t qsize = quotearg_buffer_restyled (val, size, arg, argsize,
+                                             options->style, flags,
+                                             options->quote_these_too,
+                                             options->left_quote,
+                                             options->right_quote);
+
+    if (size <= qsize)
+      {
+        sv[n].size = size = qsize + 1;
+        if (val != slot0)
+          free (val);
+        sv[n].val = val = xcharalloc (size);
+        quotearg_buffer_restyled (val, size, arg, argsize, options->style,
+                                  flags, options->quote_these_too,
+                                  options->left_quote,
+                                  options->right_quote);
+      }
+
+    errno = e;
+    return val;
+  }
+}
+
+char *
+quotearg_n (int n, char const *arg)
+{
+  return quotearg_n_options (n, arg, SIZE_MAX, &default_quoting_options);
+}
+
+char *
+quotearg_n_mem (int n, char const *arg, size_t argsize)
+{
+  return quotearg_n_options (n, arg, argsize, &default_quoting_options);
+}
+
+char *
+quotearg (char const *arg)
+{
+  return quotearg_n (0, arg);
+}
+
+char *
+quotearg_mem (char const *arg, size_t argsize)
+{
+  return quotearg_n_mem (0, arg, argsize);
+}
+
+char *
+quotearg_n_style (int n, enum quoting_style s, char const *arg)
+{
+  struct quoting_options const o = quoting_options_from_style (s);
+  return quotearg_n_options (n, arg, SIZE_MAX, &o);
+}
+
+char *
+quotearg_n_style_mem (int n, enum quoting_style s,
+                      char const *arg, size_t argsize)
+{
+  struct quoting_options const o = quoting_options_from_style (s);
+  return quotearg_n_options (n, arg, argsize, &o);
+}
+
+char *
+quotearg_style (enum quoting_style s, char const *arg)
+{
+  return quotearg_n_style (0, s, arg);
+}
+
+char *
+quotearg_style_mem (enum quoting_style s, char const *arg, size_t argsize)
+{
+  return quotearg_n_style_mem (0, s, arg, argsize);
+}
+
+char *
+quotearg_char_mem (char const *arg, size_t argsize, char ch)
+{
+  struct quoting_options options;
+  options = default_quoting_options;
+  set_char_quoting (&options, ch, 1);
+  return quotearg_n_options (0, arg, argsize, &options);
+}
+
+char *
+quotearg_char (char const *arg, char ch)
+{
+  return quotearg_char_mem (arg, SIZE_MAX, ch);
+}
+
+char *
+quotearg_colon (char const *arg)
+{
+  return quotearg_char (arg, ':');
+}
+
+char *
+quotearg_colon_mem (char const *arg, size_t argsize)
+{
+  return quotearg_char_mem (arg, argsize, ':');
+}
+
+char *
+quotearg_n_style_colon (int n, enum quoting_style s, char const *arg)
+{
+  struct quoting_options options;
+  options = quoting_options_from_style (s);
+  set_char_quoting (&options, ':', 1);
+  return quotearg_n_options (n, arg, SIZE_MAX, &options);
+}
+
+char *
+quotearg_n_custom (int n, char const *left_quote,
+                   char const *right_quote, char const *arg)
+{
+  return quotearg_n_custom_mem (n, left_quote, right_quote, arg,
+                                SIZE_MAX);
+}
+
+char *
+quotearg_n_custom_mem (int n, char const *left_quote,
+                       char const *right_quote,
+                       char const *arg, size_t argsize)
+{
+  struct quoting_options o = default_quoting_options;
+  set_custom_quoting (&o, left_quote, right_quote);
+  return quotearg_n_options (n, arg, argsize, &o);
+}
+
+char *
+quotearg_custom (char const *left_quote, char const *right_quote,
+                 char const *arg)
+{
+  return quotearg_n_custom (0, left_quote, right_quote, arg);
+}
+
+char *
+quotearg_custom_mem (char const *left_quote, char const *right_quote,
+                     char const *arg, size_t argsize)
+{
+  return quotearg_n_custom_mem (0, left_quote, right_quote, arg,
+                                argsize);
+}
+
+
+/* The quoting option used by the functions of quote.h.  */
+struct quoting_options quote_quoting_options =
+  {
+    locale_quoting_style,
+    0,
+    { 0 },
+    NULL, NULL
+  };
+
+char const *
+quote_n_mem (int n, char const *arg, size_t argsize)
+{
+  return quotearg_n_options (n, arg, argsize, &quote_quoting_options);
+}
+
+char const *
+quote_mem (char const *arg, size_t argsize)
+{
+  return quote_n_mem (0, arg, argsize);
+}
+
+char const *
+quote_n (int n, char const *arg)
+{
+  return quote_n_mem (n, arg, SIZE_MAX);
+}
+
+char const *
+quote (char const *arg)
+{
+  return quote_n (0, arg);
+}
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index b6ad79b54b9e184a282319a97cc7153d9c815cb3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/quotearg.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4e9099fff49304bd2159fc1aebdaaa93cdf4f84c
--- /dev/null
@@ -0,0 +1,436 @@
+/* quotearg.h - quote arguments for output
+
+   Copyright (C) 1998-2002, 2004, 2006, 2008-2024 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert <eggert@twinsun.com> */
+
+#ifndef QUOTEARG_H_
+# define QUOTEARG_H_ 1
+
+/* This file uses _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_RETURNS_NONNULL.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <stdlib.h>
+
+/* Basic quoting styles.  For each style, an example is given on the
+   input strings "simple", "\0 \t\n'\"\033?""?/\\", and "a:b", using
+   quotearg_buffer, quotearg_mem, and quotearg_colon_mem with that
+   style and the default flags and quoted characters.  Note that the
+   examples are shown here as valid C strings rather than what
+   displays on a terminal (with "??/" as a trigraph for "\\").  */
+enum quoting_style
+  {
+    /* Output names as-is (ls --quoting-style=literal).  Can result in
+       embedded null bytes if QA_ELIDE_NULL_BYTES is not in
+       effect.
+
+       quotearg_buffer:
+       "simple", "\0 \t\n'\"\033??/\\", "a:b"
+       quotearg:
+       "simple", " \t\n'\"\033??/\\", "a:b"
+       quotearg_colon:
+       "simple", " \t\n'\"\033??/\\", "a:b"
+    */
+    literal_quoting_style,
+
+    /* Quote names for the shell if they contain shell metacharacters
+       or would cause ambiguous output (ls --quoting-style=shell).
+       Can result in embedded null bytes if QA_ELIDE_NULL_BYTES is not
+       in effect.
+
+       quotearg_buffer:
+       "simple", "'\0 \t\n'\\''\"\033??/\\'", "a:b"
+       quotearg:
+       "simple", "' \t\n'\\''\"\033??/\\'", "a:b"
+       quotearg_colon:
+       "simple", "' \t\n'\\''\"\033??/\\'", "'a:b'"
+    */
+    shell_quoting_style,
+
+    /* Quote names for the shell, even if they would normally not
+       require quoting (ls --quoting-style=shell-always).  Can result
+       in embedded null bytes if QA_ELIDE_NULL_BYTES is not in effect.
+       Behaves like shell_quoting_style if QA_ELIDE_OUTER_QUOTES is in
+       effect.
+
+       quotearg_buffer:
+       "'simple'", "'\0 \t\n'\\''\"\033??/\\'", "'a:b'"
+       quotearg:
+       "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'"
+       quotearg_colon:
+       "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'"
+    */
+    shell_always_quoting_style,
+
+    /* Quote names for the shell if they contain shell metacharacters
+       or other problematic characters (ls --quoting-style=shell-escape).
+       Non printable characters are quoted using the $'...' syntax,
+       which originated in ksh93 and is widely supported by most shells,
+       and proposed for inclusion in POSIX.
+
+       quotearg_buffer:
+       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b"
+       quotearg:
+       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b"
+       quotearg_colon:
+       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "'a:b'"
+    */
+    shell_escape_quoting_style,
+
+    /* Quote names for the shell even if they would normally not
+       require quoting (ls --quoting-style=shell-escape).
+       Non printable characters are quoted using the $'...' syntax,
+       which originated in ksh93 and is widely supported by most shells,
+       and proposed for inclusion in POSIX.  Behaves like
+       shell_escape_quoting_style if QA_ELIDE_OUTER_QUOTES is in effect.
+
+       quotearg_buffer:
+       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b"
+       quotearg:
+       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b"
+       quotearg_colon:
+       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "'a:b'"
+    */
+    shell_escape_always_quoting_style,
+
+    /* Quote names as for a C language string (ls --quoting-style=c).
+       Behaves like c_maybe_quoting_style if QA_ELIDE_OUTER_QUOTES is
+       in effect.  Split into consecutive strings if
+       QA_SPLIT_TRIGRAPHS.
+
+       quotearg_buffer:
+       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
+       quotearg:
+       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
+       quotearg_colon:
+       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\""
+    */
+    c_quoting_style,
+
+    /* Like c_quoting_style except omit the surrounding double-quote
+       characters if no quoted characters are encountered.
+
+       quotearg_buffer:
+       "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b"
+       quotearg:
+       "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b"
+       quotearg_colon:
+       "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
+    */
+    c_maybe_quoting_style,
+
+    /* Like c_quoting_style except always omit the surrounding
+       double-quote characters and ignore QA_SPLIT_TRIGRAPHS
+       (ls --quoting-style=escape).
+
+       quotearg_buffer:
+       "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b"
+       quotearg:
+       "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b"
+       quotearg_colon:
+       "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a\\:b"
+    */
+    escape_quoting_style,
+
+    /* Like clocale_quoting_style, but use single quotes in the
+       default C locale or if the program does not use gettext
+       (ls --quoting-style=locale).  For UTF-8 locales, quote
+       characters will use Unicode.
+
+       LC_MESSAGES=C
+       quotearg_buffer:
+       "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'"
+       quotearg:
+       "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'"
+       quotearg_colon:
+       "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a\\:b'"
+
+       LC_MESSAGES=pt_PT.utf8
+       quotearg_buffer:
+       "\302\253simple\302\273",
+       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
+       quotearg:
+       "\302\253simple\302\273",
+       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
+       quotearg_colon:
+       "\302\253simple\302\273",
+       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273"
+    */
+    locale_quoting_style,
+
+    /* Like c_quoting_style except use quotation marks appropriate for
+       the locale and ignore QA_SPLIT_TRIGRAPHS
+       (ls --quoting-style=clocale).
+
+       LC_MESSAGES=C
+       quotearg_buffer:
+       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
+       quotearg:
+       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
+       quotearg_colon:
+       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\""
+
+       LC_MESSAGES=pt_PT.utf8
+       quotearg_buffer:
+       "\302\253simple\302\273",
+       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
+       quotearg:
+       "\302\253simple\302\273",
+       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
+       quotearg_colon:
+       "\302\253simple\302\273",
+       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273"
+    */
+    clocale_quoting_style,
+
+    /* Like clocale_quoting_style except use the custom quotation marks
+       set by set_custom_quoting.  If custom quotation marks are not
+       set, the behavior is undefined.
+
+       left_quote = right_quote = "'"
+       quotearg_buffer:
+       "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'"
+       quotearg:
+       "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'"
+       quotearg_colon:
+       "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a\\:b'"
+
+       left_quote = "(" and right_quote = ")"
+       quotearg_buffer:
+       "(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a:b)"
+       quotearg:
+       "(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a:b)"
+       quotearg_colon:
+       "(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a\\:b)"
+
+       left_quote = ":" and right_quote = " "
+       quotearg_buffer:
+       ":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a:b "
+       quotearg:
+       ":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a:b "
+       quotearg_colon:
+       ":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a\\:b "
+
+       left_quote = "\"'" and right_quote = "'\""
+       Notice that this is treated as a single level of quotes or two
+       levels where the outer quote need not be escaped within the inner
+       quotes.  For two levels where the outer quote must be escaped
+       within the inner quotes, you must use separate quotearg
+       invocations.
+       quotearg_buffer:
+       "\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a:b'\""
+       quotearg:
+       "\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a:b'\""
+       quotearg_colon:
+       "\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a\\:b'\""
+    */
+    custom_quoting_style
+  };
+
+/* Flags for use in set_quoting_flags.  */
+enum quoting_flags
+  {
+    /* Always elide null bytes from styles that do not quote them,
+       even when the length of the result is available to the
+       caller.  */
+    QA_ELIDE_NULL_BYTES = 0x01,
+
+    /* Omit the surrounding quote characters if no escaped characters
+       are encountered.  Note that if no other character needs
+       escaping, then neither does the escape character.  */
+    QA_ELIDE_OUTER_QUOTES = 0x02,
+
+    /* In the c_quoting_style and c_maybe_quoting_style, split ANSI
+       trigraph sequences into concatenated strings (for example,
+       "?""?/" rather than "??/", which could be confused with
+       "\\").  */
+    QA_SPLIT_TRIGRAPHS = 0x04
+  };
+
+/* For now, --quoting-style=literal is the default, but this may change.  */
+# ifndef DEFAULT_QUOTING_STYLE
+#  define DEFAULT_QUOTING_STYLE literal_quoting_style
+# endif
+
+/* Names of quoting styles and their corresponding values.  */
+extern char const *const quoting_style_args[];
+extern enum quoting_style const quoting_style_vals[];
+
+struct quoting_options;
+
+/* The functions listed below set and use a hidden variable
+   that contains the default quoting style options.  */
+
+/* Allocate a new set of quoting options, with contents initially identical
+   to O if O is not null, or to the default if O is null.
+   It is the caller's responsibility to free the result.  */
+struct quoting_options *clone_quoting_options (struct quoting_options *o)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+/* Get the value of O's quoting style.  If O is null, use the default.  */
+enum quoting_style get_quoting_style (struct quoting_options const *o);
+
+/* In O (or in the default if O is null),
+   set the value of the quoting style to S.  */
+void set_quoting_style (struct quoting_options *o, enum quoting_style s);
+
+/* In O (or in the default if O is null),
+   set the value of the quoting options for character C to I.
+   Return the old value.  Currently, the only values defined for I are
+   0 (the default) and 1 (which means to quote the character even if
+   it would not otherwise be quoted).  C must never be a digit or a
+   letter that has special meaning after a backslash (for example, "\t"
+   for tab).  */
+int set_char_quoting (struct quoting_options *o, char c, int i);
+
+/* In O (or in the default if O is null),
+   set the value of the quoting options flag to I, which can be a
+   bitwise combination of enum quoting_flags, or 0 for default
+   behavior.  Return the old value.  */
+int set_quoting_flags (struct quoting_options *o, int i);
+
+/* In O (or in the default if O is null),
+   set the value of the quoting style to custom_quoting_style,
+   set the left quote to LEFT_QUOTE, and set the right quote to
+   RIGHT_QUOTE.  Each of LEFT_QUOTE and RIGHT_QUOTE must be
+   null-terminated and can be the empty string.  Because backslashes are
+   used for escaping, it does not make sense for RIGHT_QUOTE to contain
+   a backslash.  RIGHT_QUOTE must not begin with a digit or a letter
+   that has special meaning after a backslash (for example, "\t" for
+   tab).  */
+void set_custom_quoting (struct quoting_options *o,
+                         char const *left_quote,
+                         char const *right_quote);
+
+/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
+   argument ARG (of size ARGSIZE), using O to control quoting.
+   If O is null, use the default.
+   Terminate the output with a null character, and return the written
+   size of the output, not counting the terminating null.
+   If BUFFERSIZE is too small to store the output string, return the
+   value that would have been returned had BUFFERSIZE been large enough.
+   If ARGSIZE is -1, use the string length of the argument for ARGSIZE.
+   On output, BUFFER might contain embedded null bytes if ARGSIZE was
+   not -1, the style of O does not use backslash escapes, and the
+   flags of O do not request elision of null bytes.*/
+size_t quotearg_buffer (char *restrict buffer, size_t buffersize,
+                        char const *arg, size_t argsize,
+                        struct quoting_options const *o);
+
+/* Like quotearg_buffer, except return the result in a newly allocated
+   buffer.  It is the caller's responsibility to free the result.  The
+   result will not contain embedded null bytes.  */
+char *quotearg_alloc (char const *arg, size_t argsize,
+                      struct quoting_options const *o)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+/* Like quotearg_alloc, except that the length of the result,
+   excluding the terminating null byte, is stored into SIZE if it is
+   non-NULL.  The result might contain embedded null bytes if ARGSIZE
+   was not -1, SIZE was not NULL, the style of O does not use
+   backslash escapes, and the flags of O do not request elision of
+   null bytes.*/
+char *quotearg_alloc_mem (char const *arg, size_t argsize,
+                          size_t *size, struct quoting_options const *o)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+/* Use storage slot N to return a quoted version of the string ARG.
+   Use the default quoting options.
+   The returned value points to static storage that can be
+   reused by the next call to this function with the same value of N.
+   N must be nonnegative.  The output of all functions in the
+   quotearg_n family are guaranteed to not contain embedded null
+   bytes.*/
+char *quotearg_n (int n, char const *arg);
+
+/* Equivalent to quotearg_n (0, ARG).  */
+char *quotearg (char const *arg);
+
+/* Use storage slot N to return a quoted version of the argument ARG
+   of size ARGSIZE.  This is like quotearg_n (N, ARG), except it can
+   quote null bytes.  */
+char *quotearg_n_mem (int n, char const *arg, size_t argsize);
+
+/* Equivalent to quotearg_n_mem (0, ARG, ARGSIZE).  */
+char *quotearg_mem (char const *arg, size_t argsize);
+
+/* Use style S and storage slot N to return a quoted version of the string ARG.
+   This is like quotearg_n (N, ARG), except that it uses S with no other
+   options to specify the quoting method.  */
+char *quotearg_n_style (int n, enum quoting_style s, char const *arg);
+
+/* Use style S and storage slot N to return a quoted version of the
+   argument ARG of size ARGSIZE.  This is like quotearg_n_style
+   (N, S, ARG), except it can quote null bytes.  */
+char *quotearg_n_style_mem (int n, enum quoting_style s,
+                            char const *arg, size_t argsize);
+
+/* Equivalent to quotearg_n_style (0, S, ARG).  */
+char *quotearg_style (enum quoting_style s, char const *arg);
+
+/* Equivalent to quotearg_n_style_mem (0, S, ARG, ARGSIZE).  */
+char *quotearg_style_mem (enum quoting_style s,
+                          char const *arg, size_t argsize);
+
+/* Like quotearg (ARG), except also quote any instances of CH.
+   See set_char_quoting for a description of acceptable CH values.  */
+char *quotearg_char (char const *arg, char ch);
+
+/* Like quotearg_char (ARG, CH), except it can quote null bytes.  */
+char *quotearg_char_mem (char const *arg, size_t argsize, char ch);
+
+/* Equivalent to quotearg_char (ARG, ':').  */
+char *quotearg_colon (char const *arg);
+
+/* Like quotearg_colon (ARG), except it can quote null bytes.  */
+char *quotearg_colon_mem (char const *arg, size_t argsize);
+
+/* Like quotearg_n_style, except with ':' quoting enabled.  */
+char *quotearg_n_style_colon (int n, enum quoting_style s, char const *arg);
+
+/* Like quotearg_n_style (N, S, ARG) but with S as custom_quoting_style
+   with left quote as LEFT_QUOTE and right quote as RIGHT_QUOTE.  See
+   set_custom_quoting for a description of acceptable LEFT_QUOTE and
+   RIGHT_QUOTE values.  */
+char *quotearg_n_custom (int n, char const *left_quote,
+                         char const *right_quote, char const *arg);
+
+/* Like quotearg_n_custom (N, LEFT_QUOTE, RIGHT_QUOTE, ARG) except it
+   can quote null bytes.  */
+char *quotearg_n_custom_mem (int n, char const *left_quote,
+                             char const *right_quote,
+                             char const *arg, size_t argsize);
+
+/* Equivalent to quotearg_n_custom (0, LEFT_QUOTE, RIGHT_QUOTE, ARG).  */
+char *quotearg_custom (char const *left_quote, char const *right_quote,
+                       char const *arg);
+
+/* Equivalent to quotearg_n_custom_mem (0, LEFT_QUOTE, RIGHT_QUOTE, ARG,
+                                        ARGSIZE).  */
+char *quotearg_custom_mem (char const *left_quote,
+                           char const *right_quote,
+                           char const *arg, size_t argsize);
+
+/* Free any dynamically allocated memory.  */
+void quotearg_free (void);
+
+#endif /* !QUOTEARG_H_ */
deleted file mode 120000 (symlink)
index 03fc44a7650df3e82b756280d594945a85f848c9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/raise.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..891f355a184504d8750cd71e8f71a50b59cd20f1
--- /dev/null
@@ -0,0 +1,83 @@
+/* Provide a non-threads replacement for the POSIX raise function.
+
+   Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering and Bruno Haible */
+
+#include <config.h>
+
+/* Specification.  */
+#include <signal.h>
+
+#if HAVE_RAISE
+/* Native Windows platform.  */
+
+# include <errno.h>
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#  include "msvc-inval.h"
+# endif
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+/* Forward declaration.  */
+static int raise_nothrow (int sig);
+# else
+#  define raise_nothrow raise
+# endif
+
+#else
+/* An old Unix platform.  */
+
+# include <unistd.h>
+
+#endif
+
+int
+raise (int sig)
+#undef raise
+{
+#if GNULIB_defined_signal_blocking && GNULIB_defined_SIGPIPE
+  if (sig == SIGPIPE)
+    return _gl_raise_SIGPIPE ();
+#endif
+
+#if HAVE_RAISE
+  return raise_nothrow (sig);
+#else
+  return kill (getpid (), sig);
+#endif
+}
+
+#if HAVE_RAISE && HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+raise_nothrow (int sig)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = raise (sig);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = -1;
+      errno = EINVAL;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+#endif
deleted file mode 120000 (symlink)
index 81d0f58654c877f3794296ca4c9ced433dcfd8ab..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/rawmemchr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..013e7f8cced7e8ffd563106fb0aa3cd6b18d2da0
--- /dev/null
@@ -0,0 +1,135 @@
+/* Searching in a string.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+/* A function definition is needed only if HAVE_RAWMEMCHR is not defined.  */
+#if !HAVE_RAWMEMCHR
+
+# include <limits.h>
+# include <stdint.h>
+
+
+/* Find the first occurrence of C in S.  */
+void *
+rawmemchr (const void *s, int c_in)
+{
+# ifdef __CHERI_PURE_CAPABILITY__
+  /* Most architectures let you read an aligned word,
+     even if the unsigned char array at S ends in the middle of the word.
+     However CHERI does not, so call memchr
+     with the underlying object's remaining length.
+     This cannot return NULL if S points to a C_IN-terminated array.
+     Use builtins rather than including <cheri.h> which is less stable.  */
+  return memchr (s, c_in, (__builtin_cheri_length_get (s)
+                           - __builtin_cheri_offset_get (s)));
+# else
+
+  /* You can change this typedef to experiment with performance.  */
+  typedef uintptr_t longword;
+  /* Verify that the longword type lacks padding bits.  */
+  static_assert (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (uintptr_t));
+
+  const unsigned char *char_ptr;
+  unsigned char c = c_in;
+
+  /* Handle the first few bytes by reading one byte at a time.
+     Do this until CHAR_PTR is aligned on a natural longword boundary,
+     as using alignof (longword) might be slower.  */
+  for (char_ptr = (const unsigned char *) s;
+       (uintptr_t) char_ptr % sizeof (longword) != 0;
+       ++char_ptr)
+    if (*char_ptr == c)
+      return (void *) char_ptr;
+
+  longword const *longword_ptr = s = char_ptr;
+
+  /* Compute auxiliary longword values:
+     repeated_one is a value which has a 1 in every byte.
+     repeated_c has c in every byte.  */
+  longword repeated_one = (longword) -1 / UCHAR_MAX;
+  longword repeated_c = repeated_one * c;
+  longword repeated_hibit = repeated_one * (UCHAR_MAX / 2 + 1);
+
+  /* Instead of the traditional loop which tests each byte, we will
+     test a longword at a time.  The tricky part is testing if any of
+     the bytes in the longword in question are equal to
+     c.  We first use an xor with repeated_c.  This reduces the task
+     to testing whether any of the bytes in longword1 is zero.
+
+     (The following comments assume 8-bit bytes, as POSIX requires;
+     the code's use of UCHAR_MAX should work even if bytes have more
+     than 8 bits.)
+
+     We compute tmp =
+       ((longword1 - repeated_one) & ~longword1) & (repeated_one * 0x80).
+     That is, we perform the following operations:
+       1. Subtract repeated_one.
+       2. & ~longword1.
+       3. & a mask consisting of 0x80 in every byte.
+     Consider what happens in each byte:
+       - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
+         and step 3 transforms it into 0x80.  A carry can also be propagated
+         to more significant bytes.
+       - If a byte of longword1 is nonzero, let its lowest 1 bit be at
+         position k (0 <= k <= 7); so the lowest k bits are 0.  After step 1,
+         the byte ends in a single bit of value 0 and k bits of value 1.
+         After step 2, the result is just k bits of value 1: 2^k - 1.  After
+         step 3, the result is 0.  And no carry is produced.
+     So, if longword1 has only non-zero bytes, tmp is zero.
+     Whereas if longword1 has a zero byte, call j the position of the least
+     significant zero byte.  Then the result has a zero at positions 0, ...,
+     j-1 and a 0x80 at position j.  We cannot predict the result at the more
+     significant bytes (positions j+1..3), but it does not matter since we
+     already have a non-zero bit at position 8*j+7.
+
+     The test whether any byte in longword1 is zero is equivalent
+     to testing whether tmp is nonzero.
+
+     This test can read beyond the end of a string, depending on where
+     C_IN is encountered.  However, this is considered safe since the
+     initialization phase ensured that the read will be aligned,
+     therefore, the read will not cross page boundaries and will not
+     cause a fault.  */
+
+  while (1)
+    {
+      longword longword1 = *longword_ptr ^ repeated_c;
+
+      if ((((longword1 - repeated_one) & ~longword1) & repeated_hibit) != 0)
+        break;
+      longword_ptr++;
+    }
+
+  char_ptr = s = longword_ptr;
+
+  /* At this point, we know that one of the sizeof (longword) bytes
+     starting at char_ptr is == c.  If we knew endianness, we
+     could determine the first such byte without any further memory
+     accesses, just by looking at the tmp result from the last loop
+     iteration.  However, the following simple and portable code does
+     not attempt this potential optimization.  */
+
+  while (*char_ptr != c)
+    char_ptr++;
+  return (void *) char_ptr;
+# endif
+}
+
+#endif
deleted file mode 120000 (symlink)
index bc879b9c1f569e06a1787bb1b64ee2d49afc93df..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/rawmemchr.valgrind
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bb201f7309321130f6dc85dc0ce2067d0a1abdd2
--- /dev/null
@@ -0,0 +1,28 @@
+# Suppress a valgrind message about use of uninitialized memory in rawmemchr().
+
+# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+#
+# This file is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# This use is OK because it provides only a speedup.
+{
+    rawmemchr-value4
+    Memcheck:Value4
+    fun:rawmemchr
+}
+{
+    rawmemchr-value8
+    Memcheck:Value8
+    fun:rawmemchr
+}
deleted file mode 120000 (symlink)
index 366d40e234bc484211ff9f32488f7159afbce1b5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/read-file.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c4aa093e1c58127d3a5ca7b292cb0f8b7ec89edc
--- /dev/null
@@ -0,0 +1,216 @@
+/* read-file.c -- read file contents into a string
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Simon Josefsson and Bruno Haible.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "read-file.h"
+
+/* Get fstat.  */
+#include <sys/stat.h>
+
+/* Get ftello.  */
+#include <stdio.h>
+
+/* Get PTRDIFF_MAX.  */
+#include <stdint.h>
+
+/* Get malloc, realloc, free. */
+#include <stdlib.h>
+
+/* Get memcpy, memset_explicit. */
+#include <string.h>
+
+/* Get errno. */
+#include <errno.h>
+
+/* Read a STREAM and return a newly allocated string with the content,
+   and set *LENGTH to the length of the string.  The string is
+   zero-terminated, but the terminating zero byte is not counted in
+   *LENGTH.  On errors, *LENGTH is undefined, errno preserves the
+   values set by system functions (if any), and NULL is returned.
+
+   If the RF_SENSITIVE flag is set in FLAGS:
+     - You should control the buffering of STREAM using 'setvbuf'.  Either
+       clear the buffer of STREAM after closing it, or disable buffering of
+       STREAM before calling this function.
+     - The memory buffer internally allocated will be cleared upon failure.  */
+char *
+fread_file (FILE *stream, int flags, size_t *length)
+{
+  char *buf = NULL;
+  size_t alloc = BUFSIZ;
+
+  /* For a regular file, allocate a buffer that has exactly the right
+     size.  This avoids the need to do dynamic reallocations later.  */
+  {
+    struct stat st;
+
+    if (fstat (fileno (stream), &st) >= 0 && S_ISREG (st.st_mode))
+      {
+        off_t pos = ftello (stream);
+
+        if (pos >= 0 && pos < st.st_size)
+          {
+            off_t alloc_off = st.st_size - pos;
+
+            /* '1' below, accounts for the trailing NUL.  */
+            if (PTRDIFF_MAX - 1 < alloc_off)
+              {
+                errno = ENOMEM;
+                return NULL;
+              }
+
+            alloc = alloc_off + 1;
+          }
+      }
+  }
+
+  if (!(buf = malloc (alloc)))
+    return NULL; /* errno is ENOMEM.  */
+
+  {
+    size_t size = 0; /* number of bytes read so far */
+    int save_errno;
+
+    for (;;)
+      {
+        /* This reads 1 more than the size of a regular file
+           so that we get eof immediately.  */
+        size_t requested = alloc - size;
+        size_t count = fread (buf + size, 1, requested, stream);
+        size += count;
+
+        if (count != requested)
+          {
+            save_errno = errno;
+            if (ferror (stream))
+              break;
+
+            /* Shrink the allocated memory if possible.  */
+            if (size < alloc - 1)
+              {
+                if (flags & RF_SENSITIVE)
+                  {
+                    char *smaller_buf = malloc (size + 1);
+                    if (smaller_buf == NULL)
+                      memset_explicit (buf + size, 0, alloc - size);
+                    else
+                      {
+                        memcpy (smaller_buf, buf, size);
+                        memset_explicit (buf, 0, alloc);
+                        free (buf);
+                        buf = smaller_buf;
+                      }
+                  }
+                else
+                  {
+                    char *smaller_buf = realloc (buf, size + 1);
+                    if (smaller_buf != NULL)
+                      buf = smaller_buf;
+                  }
+              }
+
+            buf[size] = '\0';
+            *length = size;
+            return buf;
+          }
+
+        {
+          char *new_buf;
+          size_t save_alloc = alloc;
+
+          if (alloc == PTRDIFF_MAX)
+            {
+              save_errno = ENOMEM;
+              break;
+            }
+
+          if (alloc < PTRDIFF_MAX - alloc / 2)
+            alloc = alloc + alloc / 2;
+          else
+            alloc = PTRDIFF_MAX;
+
+          if (flags & RF_SENSITIVE)
+            {
+              new_buf = malloc (alloc);
+              if (!new_buf)
+                {
+                  /* BUF should be cleared below after the loop.  */
+                  save_errno = errno;
+                  break;
+                }
+              memcpy (new_buf, buf, save_alloc);
+              memset_explicit (buf, 0, save_alloc);
+              free (buf);
+            }
+          else if (!(new_buf = realloc (buf, alloc)))
+            {
+              save_errno = errno;
+              break;
+            }
+
+          buf = new_buf;
+        }
+      }
+
+    if (flags & RF_SENSITIVE)
+      memset_explicit (buf, 0, alloc);
+
+    free (buf);
+    errno = save_errno;
+    return NULL;
+  }
+}
+
+/* Open and read the contents of FILENAME, and return a newly
+   allocated string with the content, and set *LENGTH to the length of
+   the string.  The string is zero-terminated, but the terminating
+   zero byte is not counted in *LENGTH.  On errors, *LENGTH is
+   undefined, errno preserves the values set by system functions (if
+   any), and NULL is returned.
+
+   If the RF_BINARY flag is set in FLAGS, the file is opened in binary
+   mode.  If the RF_SENSITIVE flag is set in FLAGS, the memory buffer
+   internally allocated will be cleared upon failure.  */
+char *
+read_file (const char *filename, int flags, size_t *length)
+{
+  const char *mode = (flags & RF_BINARY) ? "rbe" : "re";
+  FILE *stream = fopen (filename, mode);
+  char *out;
+
+  if (!stream)
+    return NULL;
+
+  if (flags & RF_SENSITIVE)
+    setvbuf (stream, NULL, _IONBF, 0);
+
+  out = fread_file (stream, flags, length);
+
+  if (fclose (stream) != 0)
+    {
+      if (out)
+        {
+          if (flags & RF_SENSITIVE)
+            memset_explicit (out, 0, *length);
+          free (out);
+        }
+      return NULL;
+    }
+
+  return out;
+}
deleted file mode 120000 (symlink)
index f9e48cc5d71d1642c09e8f36bd88e7c49816c733..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/read-file.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..97909ea7944dd5919a5cb9c1cbbdc731f48ebd71
--- /dev/null
@@ -0,0 +1,44 @@
+/* read-file.h -- read file contents into a string
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef READ_FILE_H
+#define READ_FILE_H
+
+/* This file uses _GL_ATTRIBUTE_MALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get size_t, free().  */
+#include <stdlib.h>
+
+/* Get FILE.  */
+#include <stdio.h>
+
+/* Indicate that the file is treated as binary.  */
+#define RF_BINARY 0x1
+
+/* Indicate that the file content contains sensitive information.  */
+#define RF_SENSITIVE 0x2
+
+extern char *fread_file (FILE * stream, int flags, size_t * length)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+
+extern char *read_file (const char *filename, int flags, size_t * length)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+
+#endif /* READ_FILE_H */
deleted file mode 120000 (symlink)
index b6ab42e1865de8b805222a0205aa90aa9fe51861..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/read.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..28fca4430a4598cb461528180a9ef5dddc4560dd
--- /dev/null
@@ -0,0 +1,95 @@
+/* POSIX compatible read() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+# include <errno.h>
+# include <io.h>
+
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#  include "msvc-inval.h"
+# endif
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+
+/* Don't assume that UNICODE is not defined.  */
+# undef GetNamedPipeHandleState
+# define GetNamedPipeHandleState GetNamedPipeHandleStateA
+
+# undef read
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static ssize_t
+read_nothrow (int fd, void *buf, size_t count)
+{
+  ssize_t result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _read (fd, buf, count);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = -1;
+      errno = EBADF;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+# else
+#  define read_nothrow _read
+# endif
+
+ssize_t
+rpl_read (int fd, void *buf, size_t count)
+{
+  ssize_t ret = read_nothrow (fd, buf, count);
+
+# if GNULIB_NONBLOCKING
+  if (ret < 0
+      && GetLastError () == ERROR_NO_DATA)
+    {
+      HANDLE h = (HANDLE) _get_osfhandle (fd);
+      if (GetFileType (h) == FILE_TYPE_PIPE)
+        {
+          /* h is a pipe or socket.  */
+          DWORD state;
+          if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0)
+              && (state & PIPE_NOWAIT) != 0)
+            /* h is a pipe in non-blocking mode.
+               Change errno from EINVAL to EAGAIN.  */
+            errno = EAGAIN;
+        }
+    }
+# endif
+
+  return ret;
+}
+
+#endif
deleted file mode 120000 (symlink)
index dd94db69ff56e7581cfa438a2405d70446066824..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/readdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fab1964308f8a2921f641427483a4f8c03c8c205
--- /dev/null
@@ -0,0 +1,109 @@
+/* Read the next entry of a directory.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <dirent.h>
+
+#include <errno.h>
+#include <stddef.h>
+
+#if GNULIB_defined_DIR
+# include "dirent-private.h"
+#endif
+
+/* Don't assume that UNICODE is not defined.  */
+#undef FindNextFile
+#define FindNextFile FindNextFileA
+
+struct dirent *
+readdir (DIR *dirp)
+#undef readdir
+{
+#if HAVE_DIRENT_H                       /* equivalent to HAVE_READDIR */
+  return readdir (dirp->real_dirp);
+#else
+  char type;
+  struct dirent *result;
+
+  /* There is no need to add code to produce entries for "." and "..".
+     According to the POSIX:2008 section "4.12 Pathname Resolution"
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html>
+     "." and ".." are syntactic entities.
+     POSIX also says:
+       "If entries for dot or dot-dot exist, one entry shall be returned
+        for dot and one entry shall be returned for dot-dot; otherwise,
+        they shall not be returned."  */
+
+  switch (dirp->status)
+    {
+    case -2:
+      /* End of directory already reached.  */
+      return NULL;
+    case -1:
+      break;
+    case 0:
+      if (!FindNextFile (dirp->current, &dirp->entry))
+        {
+          switch (GetLastError ())
+            {
+            case ERROR_NO_MORE_FILES:
+              dirp->status = -2;
+              return NULL;
+            default:
+              errno = EIO;
+              return NULL;
+            }
+        }
+      break;
+    default:
+      errno = dirp->status;
+      return NULL;
+    }
+
+  dirp->status = 0;
+
+  if (dirp->entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+    type = DT_DIR;
+  else if (dirp->entry.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
+    type = DT_LNK;
+  else if ((dirp->entry.dwFileAttributes
+            & ~(FILE_ATTRIBUTE_READONLY
+                | FILE_ATTRIBUTE_HIDDEN
+                | FILE_ATTRIBUTE_SYSTEM
+                | FILE_ATTRIBUTE_ARCHIVE
+                | FILE_ATTRIBUTE_NORMAL
+                | FILE_ATTRIBUTE_TEMPORARY
+                | FILE_ATTRIBUTE_SPARSE_FILE
+                | FILE_ATTRIBUTE_COMPRESSED
+                | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
+                | FILE_ATTRIBUTE_ENCRYPTED)) == 0)
+    /* Devices like COM1, LPT1, NUL would also have the attributes 0x20 but
+       they cannot occur here.  */
+    type = DT_REG;
+  else
+    type = DT_UNKNOWN;
+
+  /* Reuse the memory of dirp->entry for the result.  */
+  result =
+    (struct dirent *)
+    ((char *) dirp->entry.cFileName - offsetof (struct dirent, d_name[0]));
+  result->d_type = type;
+
+  return result;
+#endif
+}
deleted file mode 120000 (symlink)
index 67424ac96fe72d32d8e174158bc1f7671cecd2de..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/readlink.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a5369fa977b8567c28122aed3f711bd3d5d0f5e9
--- /dev/null
@@ -0,0 +1,104 @@
+/* Read the contents of a symbolic link.
+   Copyright (C) 2003-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if !HAVE_READLINK
+
+/* readlink() substitute for systems that don't have a readlink() function,
+   such as DJGPP 2.03 and mingw32.  */
+
+ssize_t
+readlink (char const *file, _GL_UNUSED char *buf,
+          _GL_UNUSED size_t bufsize)
+{
+  struct stat statbuf;
+
+  /* In general we should use lstat() here, not stat().  But on platforms
+     without symbolic links, lstat() - if it exists - would be equivalent to
+     stat(), therefore we can use stat().  This saves us a configure check.  */
+  if (stat (file, &statbuf) >= 0)
+    errno = EINVAL;
+  return -1;
+}
+
+#else /* HAVE_READLINK */
+
+# undef readlink
+
+/* readlink() wrapper that uses correct types, for systems like cygwin
+   1.5.x where readlink returns int, and which rejects trailing slash,
+   for Solaris 9.  */
+
+ssize_t
+rpl_readlink (char const *file, char *buf, size_t bufsize)
+{
+# if READLINK_TRAILING_SLASH_BUG
+  size_t file_len = strlen (file);
+  if (file_len && file[file_len - 1] == '/')
+    {
+      /* Even if FILE without the slash is a symlink to a directory,
+         both lstat() and stat() must resolve the trailing slash to
+         the directory rather than the symlink.  We can therefore
+         safely use stat() to distinguish between EINVAL and
+         ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat().  */
+      struct stat st;
+      if (stat (file, &st) == 0 || errno == EOVERFLOW)
+        errno = EINVAL;
+      return -1;
+    }
+# endif /* READLINK_TRAILING_SLASH_BUG */
+
+  ssize_t r = readlink (file, buf, bufsize);
+
+# if READLINK_TRUNCATE_BUG
+  if (r < 0 && errno == ERANGE)
+    {
+      /* Try again with a bigger buffer.  This is just for test cases;
+         real code invariably discards short reads.  */
+      char stackbuf[4032];
+      r = readlink (file, stackbuf, sizeof stackbuf);
+      if (r < 0)
+        {
+          if (errno == ERANGE)
+            {
+              /* Clear the buffer, which is good enough for real code.
+                 Thankfully, no test cases try short reads of enormous
+                 symlinks and what would be the point anyway?  */
+              r = bufsize;
+              memset (buf, 0, r);
+            }
+        }
+      else
+        {
+          if (bufsize < r)
+            r = bufsize;
+          memcpy (buf, stackbuf, r);
+        }
+    }
+# endif
+
+  return r;
+}
+
+#endif /* HAVE_READLINK */
deleted file mode 120000 (symlink)
index f31f7e7c3ba1fba636a136b1692af72ee7c4a9a3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/readlinkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..faf85401ae6edbe86b23cdb7bb5667fe7516862f
--- /dev/null
@@ -0,0 +1,113 @@
+/* Read a symlink relative to an open directory.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if HAVE_READLINKAT
+
+# undef fstatat
+# undef readlinkat
+
+ssize_t
+rpl_readlinkat (int fd, char const *file, char *buf, size_t bufsize)
+{
+# if READLINK_TRAILING_SLASH_BUG
+  size_t file_len = strlen (file);
+  if (file_len && file[file_len - 1] == '/')
+    {
+      /* Even if FILE without the slash is a symlink to a directory,
+         both lstat() and stat() must resolve the trailing slash to
+         the directory rather than the symlink.  We can therefore
+         safely use fstatat(..., 0) to distinguish between EINVAL and
+         ENOTDIR/ENOENT, avoiding extra overhead of rpl_fstatat().  */
+      struct stat st;
+      if (fstatat (fd, file, &st, 0) == 0 || errno == EOVERFLOW)
+        errno = EINVAL;
+      return -1;
+    }
+# endif /* READLINK_TRAILING_SLASH_BUG */
+
+  ssize_t r = readlinkat (fd, file, buf, bufsize);
+
+# if READLINK_TRUNCATE_BUG
+  if (r < 0 && errno == ERANGE)
+    {
+      /* Try again with a bigger buffer.  This is just for test cases;
+         real code invariably discards short reads.  */
+      char stackbuf[4032];
+      r = readlinkat (fd, file, stackbuf, sizeof stackbuf);
+      if (r < 0)
+        {
+          if (errno == ERANGE)
+            {
+              /* Clear the buffer, which is good enough for real code.
+                 Thankfully, no test cases try short reads of enormous
+                 symlinks and what would be the point anyway?  */
+              r = bufsize;
+              memset (buf, 0, r);
+            }
+        }
+      else
+        {
+          if (bufsize < r)
+            r = bufsize;
+          memcpy (buf, stackbuf, r);
+        }
+    }
+# endif
+
+  return r;
+}
+
+#else
+
+/* Gnulib provides a readlink stub for mingw; use it for distinction
+   between EINVAL and ENOENT, rather than always failing with ENOSYS.  */
+
+/* POSIX 2008 says that unlike readlink, readlinkat returns 0 for
+   success instead of the buffer length.  But this would render
+   readlinkat worthless since readlink does not guarantee a
+   NUL-terminated buffer.  Assume this was a bug in POSIX.  */
+
+/* Read the contents of symlink FILE into buffer BUF of size BUFSIZE, in the
+   directory open on descriptor FD.  If possible, do it without changing
+   the working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then readlink/restore_cwd.  If either the save_cwd or the restore_cwd
+   fails, then give a diagnostic and exit nonzero.  */
+
+# define AT_FUNC_NAME readlinkat
+# define AT_FUNC_F1 readlink
+# define AT_FUNC_POST_FILE_PARAM_DECLS , char *buf, size_t bufsize
+# define AT_FUNC_POST_FILE_ARGS        , buf, bufsize
+# define AT_FUNC_RESULT ssize_t
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+# undef AT_FUNC_RESULT
+
+#endif
deleted file mode 120000 (symlink)
index 3d7fe3a204084f92e784f9770f048c86c65b6ad5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/readtokens.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..14e4b7dac17b3122861a43446ee0e1fadf3913b9
--- /dev/null
@@ -0,0 +1,192 @@
+/* readtokens.c  -- Functions for reading tokens from an input stream.
+
+   Copyright (C) 1990-1991, 1999-2004, 2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Jim Meyering. */
+
+/* This almost supersedes xreadline stuff -- using delim="\n"
+   gives the same functionality, except that these functions
+   would never return empty lines. */
+
+#include <config.h>
+
+#include "readtokens.h"
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "xalloc.h"
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+/* Initialize a tokenbuffer. */
+
+void
+init_tokenbuffer (token_buffer *tokenbuffer)
+{
+  tokenbuffer->size = 0;
+  tokenbuffer->buffer = NULL;
+}
+
+typedef size_t word;
+enum { bits_per_word = sizeof (word) * CHAR_BIT };
+
+static bool
+get_nth_bit (size_t n, word const *bitset)
+{
+  return bitset[n / bits_per_word] >> n % bits_per_word & 1;
+}
+
+static void
+set_nth_bit (size_t n, word *bitset)
+{
+  size_t one = 1;
+  bitset[n / bits_per_word] |= one << n % bits_per_word;
+}
+
+/* Read a token from STREAM into TOKENBUFFER.
+   A token is delimited by any of the N_DELIM bytes in DELIM.
+   Upon return, the token is in tokenbuffer->buffer and
+   has a trailing '\0' instead of any original delimiter.
+   The function value is the length of the token not including
+   the final '\0'.  Upon EOF (i.e. on the call after the last
+   token is read) or error, return -1 without modifying tokenbuffer.
+   The EOF and error conditions may be distinguished in the caller
+   by testing ferror (STREAM).
+
+   This function works properly on lines containing NUL bytes
+   and on files that do not end with a delimiter.  */
+
+size_t
+readtoken (FILE *stream,
+           const char *delim,
+           size_t n_delim,
+           token_buffer *tokenbuffer)
+{
+  int c;
+  idx_t i;
+  word isdelim[(UCHAR_MAX + bits_per_word) / bits_per_word];
+
+  memset (isdelim, 0, sizeof isdelim);
+  for (i = 0; i < n_delim; i++)
+    {
+      unsigned char ch = delim[i];
+      set_nth_bit (ch, isdelim);
+    }
+
+  /* skip over any leading delimiters */
+  for (c = getc (stream); c >= 0 && get_nth_bit (c, isdelim); c = getc (stream))
+    {
+      /* empty */
+    }
+
+  char *p = tokenbuffer->buffer;
+  idx_t n = tokenbuffer->size;
+  i = 0;
+  for (;;)
+    {
+      if (c < 0 && i == 0)
+        return -1;
+
+      if (i == n)
+        p = xpalloc (p, &n, 1, -1, sizeof *p);
+
+      if (c < 0)
+        {
+          p[i] = 0;
+          break;
+        }
+      if (get_nth_bit (c, isdelim))
+        {
+          p[i] = 0;
+          break;
+        }
+      p[i++] = c;
+      c = getc (stream);
+    }
+
+  tokenbuffer->buffer = p;
+  tokenbuffer->size = n;
+  return i;
+}
+
+/* Build a NULL-terminated array of pointers to tokens
+   read from STREAM.  Return the number of tokens read.
+   All storage is obtained through calls to xmalloc-like functions.
+
+   %%% Question: is it worth it to do a single
+   %%% realloc() of 'tokens' just before returning? */
+
+size_t
+readtokens (FILE *stream,
+            size_t projected_n_tokens,
+            const char *delim,
+            size_t n_delim,
+            char ***tokens_out,
+            size_t **token_lengths)
+{
+  token_buffer tb, *token = &tb;
+  char **tokens;
+  size_t *lengths;
+  idx_t sz, n_tokens;
+
+  if (projected_n_tokens == 0)
+    projected_n_tokens = 64;
+  else
+    projected_n_tokens++;       /* add one for trailing NULL pointer */
+
+  sz = projected_n_tokens;
+  tokens = xnmalloc (sz, sizeof *tokens);
+  lengths = xnmalloc (sz, sizeof *lengths);
+
+  n_tokens = 0;
+  init_tokenbuffer (token);
+  for (;;)
+    {
+      char *tmp;
+      size_t token_length = readtoken (stream, delim, n_delim, token);
+      if (n_tokens >= sz)
+        {
+          tokens = xpalloc (tokens, &sz, 1, -1, sizeof *tokens);
+          lengths = xreallocarray (lengths, sz, sizeof *lengths);
+        }
+
+      if (token_length == (size_t) -1)
+        {
+          /* don't increment n_tokens for NULL entry */
+          tokens[n_tokens] = NULL;
+          lengths[n_tokens] = 0;
+          break;
+        }
+      tmp = xnmalloc (token_length + 1, sizeof *tmp);
+      lengths[n_tokens] = token_length;
+      tokens[n_tokens] = memcpy (tmp, token->buffer, token_length + 1);
+      n_tokens++;
+    }
+
+  free (token->buffer);
+  *tokens_out = tokens;
+  if (token_lengths != NULL)
+    *token_lengths = lengths;
+  else
+    free (lengths);
+  return n_tokens;
+}
deleted file mode 120000 (symlink)
index 0e2b35ffcd6ea9c6965fbc0b78ef5528019ff790..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/readtokens.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e0dcc19e1889d83508fcec84b6cf3e8d4c88b106
--- /dev/null
@@ -0,0 +1,45 @@
+/* readtokens.h -- Functions for reading tokens from an input stream.
+
+   Copyright (C) 1990-1991, 1999, 2001-2004, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Jim Meyering. */
+
+#ifndef READTOKENS_H
+# define READTOKENS_H
+
+# include <stdio.h>
+
+/* FIXME: This header should use idx_t, not size_t.  */
+
+struct tokenbuffer
+{
+  size_t size;
+  char *buffer;
+};
+typedef struct tokenbuffer token_buffer;
+
+void init_tokenbuffer (token_buffer *tokenbuffer);
+
+size_t
+  readtoken (FILE *stream, const char *delim, size_t n_delim,
+             token_buffer *tokenbuffer);
+size_t
+  readtokens (FILE *stream, size_t projected_n_tokens,
+              const char *delim, size_t n_delim,
+              char ***tokens_out, size_t **token_lengths);
+
+#endif /* not READTOKENS_H */
deleted file mode 120000 (symlink)
index 4ac83461de7552049b3c0404055834e89f3474aa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/readtokens0.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ebf18f493c1f16e913b47bed29af554635d3e0ca
--- /dev/null
@@ -0,0 +1,99 @@
+/* readtokens0.c -- Read NUL-separated tokens from an input stream.
+
+   Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Jim Meyering. */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "readtokens0.h"
+
+#define obstack_chunk_alloc malloc
+#define obstack_chunk_free free
+
+void
+readtokens0_init (struct Tokens *t)
+{
+  t->n_tok = 0;
+  t->tok = NULL;
+  t->tok_len = NULL;
+  obstack_init (&t->o_data);
+  obstack_init (&t->o_tok);
+  obstack_init (&t->o_tok_len);
+}
+
+void
+readtokens0_free (struct Tokens *t)
+{
+  obstack_free (&t->o_data, NULL);
+  obstack_free (&t->o_tok, NULL);
+  obstack_free (&t->o_tok_len, NULL);
+}
+
+/* Finalize (in the obstack_finish sense) the current token
+   and record its pointer and length.  */
+static void
+save_token (struct Tokens *t)
+{
+  /* Don't count the trailing NUL byte in the length.  */
+  size_t len = obstack_object_size (&t->o_data) - 1;
+  char const *s = obstack_finish (&t->o_data);
+  obstack_ptr_grow (&t->o_tok, s);
+  obstack_grow (&t->o_tok_len, &len, sizeof len);
+  t->n_tok++;
+}
+
+/* Read NUL-separated tokens from stream IN into T until EOF or error.
+   The final NUL is optional.  Always append a NULL pointer to the
+   resulting list of token pointers, but that pointer isn't counted
+   via t->n_tok.  Return true if successful.  */
+bool
+readtokens0 (FILE *in, struct Tokens *t)
+{
+
+  while (1)
+    {
+      int c = fgetc (in);
+      if (c == EOF)
+        {
+          size_t len = obstack_object_size (&t->o_data);
+          /* If the current object has nonzero length, then there
+             was no NUL byte at EOF -- or maybe there was an error,
+             in which case, we need to append a NUL byte to our buffer.  */
+          if (len)
+            {
+              obstack_1grow (&t->o_data, '\0');
+              save_token (t);
+            }
+
+          break;
+        }
+
+      obstack_1grow (&t->o_data, c);
+      if (c == '\0')
+        save_token (t);
+    }
+
+  /* Add a NULL pointer at the end, in case the caller (like du)
+     requires an argv-style array of strings.  */
+  obstack_ptr_grow (&t->o_tok, NULL);
+
+  t->tok = obstack_finish (&t->o_tok);
+  t->tok_len = obstack_finish (&t->o_tok_len);
+  return ! ferror (in);
+}
deleted file mode 120000 (symlink)
index cfbccf58a761ac3fab01c3b154707c0e356008da..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/readtokens0.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8c80bcae90c0d3994d76380be1cccc26d8543627
--- /dev/null
@@ -0,0 +1,41 @@
+/* readtokens0.h -- read NUL-separated tokens from an input stream.
+
+   Copyright (C) 2004, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Jim Meyering. */
+
+#ifndef READTOKENS0_H
+# define READTOKENS0_H 1
+
+# include <stdio.h>
+# include <sys/types.h>
+# include "obstack.h"
+
+struct Tokens
+{
+  size_t n_tok;
+  char **tok;
+  size_t *tok_len;
+  struct obstack o_data; /* Contains data pointed to by each tok[i].  */
+  struct obstack o_tok; /* array of pointers to tokens  */
+  struct obstack o_tok_len; /* array of token lengths  */
+};
+
+void readtokens0_init (struct Tokens *t);
+void readtokens0_free (struct Tokens *t);
+bool readtokens0 (FILE *in, struct Tokens *t);
+
+#endif
deleted file mode 120000 (symlink)
index 1590959e540665fefc605977c222ea4ee0d9485e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/readutmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ae2e3ae8c676f8400b9069b09b6eb83607a85d07
--- /dev/null
@@ -0,0 +1,964 @@
+/* GNU's read utmp module.
+
+   Copyright (C) 1992-2001, 2003-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by jla; revised by djm */
+
+#include <config.h>
+
+#include "readutmp.h"
+
+#include <errno.h>
+#include <stdio.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#if defined __linux__ || defined __ANDROID__
+# include <sys/sysinfo.h>
+# include <time.h>
+#endif
+#if READUTMP_USE_SYSTEMD
+# include <dirent.h>
+# include <systemd/sd-login.h>
+#endif
+
+#if HAVE_SYS_SYSCTL_H && !(defined __GLIBC__ && defined __linux__) && !defined __minix
+# if HAVE_SYS_PARAM_H
+#  include <sys/param.h>
+# endif
+# include <sys/sysctl.h>
+#endif
+
+#if HAVE_OS_H
+# include <OS.h>
+#endif
+
+#include "stat-time.h"
+#include "xalloc.h"
+
+/* Each of the FILE streams in this file is only used in a single thread.  */
+#include "unlocked-io.h"
+
+/* Some helper functions.  */
+#include "boot-time-aux.h"
+
+/* The following macros describe the 'struct UTMP_STRUCT_NAME',
+   *not* 'struct gl_utmp'.  */
+#undef UT_USER
+#undef UT_TIME_MEMBER
+#undef UT_PID
+#undef UT_TYPE_EQ
+#undef UT_TYPE_NOT_DEFINED
+#undef UT_EXIT_E_TERMINATION
+#undef UT_EXIT_E_EXIT
+
+/* Accessor macro for the member named ut_user or ut_name.  */
+#if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_NAME \
+     : HAVE_UTMP_H && HAVE_STRUCT_UTMP_UT_NAME)
+# define UT_USER(UT) ((UT)->ut_name)
+#else
+# define UT_USER(UT) ((UT)->ut_user)
+#endif
+
+/* Accessor macro for the member of type time_t (or 'unsigned int').  */
+#if HAVE_UTMPX_H || (HAVE_UTMP_H && HAVE_STRUCT_UTMP_UT_TV)
+# define UT_TIME_MEMBER(UT) ((UT)->ut_tv.tv_sec)
+#else
+# define UT_TIME_MEMBER(UT) ((UT)->ut_time)
+#endif
+
+/* Accessor macro for the member named ut_pid.  */
+#if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_PID : HAVE_STRUCT_UTMP_UT_PID)
+# define UT_PID(UT) ((UT)->ut_pid)
+#else
+# define UT_PID(UT) 0
+#endif
+
+/* Accessor macros for the member named ut_type.  */
+#if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE)
+# define UT_TYPE_EQ(UT, V) ((UT)->ut_type == (V))
+# define UT_TYPE_NOT_DEFINED 0
+#else
+# define UT_TYPE_EQ(UT, V) 0
+# define UT_TYPE_NOT_DEFINED 1
+#endif
+
+#if HAVE_UTMPX_H
+# if HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION
+#  define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.e_termination)
+# elif HAVE_STRUCT_UTMPX_UT_EXIT_UT_TERMINATION /* OSF/1 */
+#  define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.ut_termination)
+# else
+#  define UT_EXIT_E_TERMINATION(UT) 0
+# endif
+#elif HAVE_UTMP_H
+# if HAVE_STRUCT_UTMP_UT_EXIT_E_TERMINATION
+#  define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.e_termination)
+# else
+#  define UT_EXIT_E_TERMINATION(UT) 0
+# endif
+#endif
+
+#if HAVE_UTMPX_H
+# if HAVE_STRUCT_UTMPX_UT_EXIT_E_EXIT
+#  define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.e_exit)
+# elif HAVE_STRUCT_UTMPX_UT_EXIT_UT_EXIT /* OSF/1 */
+#  define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.ut_exit)
+# else
+#  define UT_EXIT_E_EXIT(UT) 0
+# endif
+#elif HAVE_UTMP_H
+# if HAVE_STRUCT_UTMP_UT_EXIT_E_EXIT
+#  define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.e_exit)
+# else
+#  define UT_EXIT_E_EXIT(UT) 0
+# endif
+#endif
+
+/* Size of the UT_USER (ut) member.  */
+#define UT_USER_SIZE  sizeof UT_USER ((struct UTMP_STRUCT_NAME *) 0)
+/* Size of the ut->ut_id member.  */
+#define UT_ID_SIZE    sizeof (((struct UTMP_STRUCT_NAME *) 0)->ut_id)
+/* Size of the ut->ut_line member.  */
+#define UT_LINE_SIZE  sizeof (((struct UTMP_STRUCT_NAME *) 0)->ut_line)
+/* Size of the ut->ut_host member.  */
+#define UT_HOST_SIZE  sizeof (((struct UTMP_STRUCT_NAME *) 0)->ut_host)
+
+#if 8 <= __GNUC__
+# pragma GCC diagnostic ignored "-Wsizeof-pointer-memaccess"
+#endif
+
+/* Copy UT->ut_user into storage obtained from malloc.  Then remove any
+   trailing spaces from the copy, NUL terminate it, and return the copy.  */
+
+char *
+extract_trimmed_name (const STRUCT_UTMP *ut)
+{
+  char const *name = ut->ut_user;
+  idx_t len = strlen (name);
+  char const *p;
+  for (p = name + len; name < p && p[-1] == ' '; p--)
+    continue;
+  return ximemdup0 (name, p - name);
+}
+
+#if READ_UTMP_SUPPORTED
+
+/* Is the utmp entry UT desired by the user who asked for OPTIONS?  */
+
+static bool
+desirable_utmp_entry (STRUCT_UTMP const *ut, int options)
+{
+# if defined __OpenBSD__ && !HAVE_UTMPX_H
+  /* Eliminate entirely empty entries.  */
+  if (ut->ut_ts.tv_sec == 0 && ut->ut_user[0] == '\0'
+      && ut->ut_line[0] == '\0' && ut->ut_host[0] == '\0')
+    return false;
+# endif
+
+  bool boot_time = UT_TYPE_BOOT_TIME (ut);
+  if ((options & READ_UTMP_BOOT_TIME) && !boot_time)
+    return false;
+  if ((options & READ_UTMP_NO_BOOT_TIME) && boot_time)
+    return false;
+
+  bool user_proc = IS_USER_PROCESS (ut);
+  if ((options & READ_UTMP_USER_PROCESS) && !user_proc)
+    return false;
+# if !(defined __CYGWIN__ || defined _WIN32)
+  if ((options & READ_UTMP_CHECK_PIDS)
+      && user_proc
+      && 0 < UT_PID (ut)
+      && (kill (UT_PID (ut), 0) < 0 && errno == ESRCH))
+    return false;
+# endif
+
+  return true;
+}
+
+/* A memory allocation for an in-progress read_utmp.  */
+
+struct utmp_alloc
+{
+  /* A pointer to a possibly-empty array of utmp entries,
+     followed by a possibly-empty sequence of unused bytes,
+     followed by a possibly-empty sequence of string bytes.
+     UTMP is either null or allocated by malloc.  */
+  struct gl_utmp *utmp;
+
+  /* The number of utmp entries.  */
+  idx_t filled;
+
+  /* The string byte sequence length.  Strings are null-terminated.  */
+  idx_t string_bytes;
+
+  /* The total number of bytes allocated.  This equals
+     FILLED * sizeof *UTMP + [size of free area] + STRING_BYTES.  */
+  idx_t alloc_bytes;
+};
+
+/* Use the memory allocation A, and if the read_utmp options OPTIONS
+   permit it, add a new entry with the given USER, etc.  Grow A as
+   needed, reporting an error and exit on memory allocation failure.
+   Return the resulting memory allocation.  */
+
+static struct utmp_alloc
+add_utmp (struct utmp_alloc a, int options,
+          char const *user, idx_t user_len,
+          char const *id, idx_t id_len,
+          char const *line, idx_t line_len,
+          char const *host, idx_t host_len,
+          pid_t pid, short type, struct timespec ts, long session,
+          int termination, int exit)
+{
+  int entry_bytes = sizeof (struct gl_utmp);
+  idx_t avail = a.alloc_bytes - (entry_bytes * a.filled + a.string_bytes);
+  idx_t needed_string_bytes =
+    (user_len + 1) + (id_len + 1) + (line_len + 1) + (host_len + 1);
+  idx_t needed = entry_bytes + needed_string_bytes;
+  if (avail < needed)
+    {
+      idx_t old_string_offset = a.alloc_bytes - a.string_bytes;
+      void *new = xpalloc (a.utmp, &a.alloc_bytes, needed - avail, -1, 1);
+      idx_t new_string_offset = a.alloc_bytes - a.string_bytes;
+      a.utmp = new;
+      char *q = new;
+      memmove (q + new_string_offset, q + old_string_offset, a.string_bytes);
+    }
+  struct gl_utmp *ut = &a.utmp[a.filled];
+  char *stringlim = (char *) a.utmp + a.alloc_bytes;
+  char *p = stringlim - a.string_bytes;
+  *--p = '\0'; /* NUL-terminate ut->ut_user */
+  ut->ut_user = p = memcpy (p - user_len, user, user_len);
+  *--p = '\0'; /* NUL-terminate ut->ut_id */
+  ut->ut_id   = p = memcpy (p -   id_len,   id,   id_len);
+  *--p = '\0'; /* NUL-terminate ut->ut_line */
+  ut->ut_line = p = memcpy (p - line_len, line, line_len);
+  *--p = '\0'; /* NUL-terminate ut->ut_host */
+  ut->ut_host =     memcpy (p - host_len, host, host_len);
+  ut->ut_ts = ts;
+  ut->ut_pid = pid;
+  ut->ut_session = session;
+  ut->ut_type = type;
+  ut->ut_exit.e_termination = termination;
+  ut->ut_exit.e_exit = exit;
+  if (desirable_utmp_entry (ut, options))
+    {
+      /* Now that UT has been checked, relocate its string slots to be
+         relative to the end of the allocated storage, so that these
+         slots survive realloc.  The slots will be relocated back just
+         before read_utmp returns.  */
+      ut->ut_user = (char *) (intptr_t) (ut->ut_user - stringlim);
+      ut->ut_id   = (char *) (intptr_t) (ut->ut_id   - stringlim);
+      ut->ut_line = (char *) (intptr_t) (ut->ut_line - stringlim);
+      ut->ut_host = (char *) (intptr_t) (ut->ut_host - stringlim);
+      a.filled++;
+      a.string_bytes += needed_string_bytes;
+    }
+  return a;
+}
+
+/* Relocate the string pointers in A back to their natural position.  */
+static struct utmp_alloc
+finish_utmp (struct utmp_alloc a)
+{
+  char *stringlim = (char *) a.utmp + a.alloc_bytes;
+
+  for (idx_t i = 0; i < a.filled; i++)
+    {
+      a.utmp[i].ut_user = (intptr_t) a.utmp[i].ut_user + stringlim;
+      a.utmp[i].ut_id   = (intptr_t) a.utmp[i].ut_id   + stringlim;
+      a.utmp[i].ut_line = (intptr_t) a.utmp[i].ut_line + stringlim;
+      a.utmp[i].ut_host = (intptr_t) a.utmp[i].ut_host + stringlim;
+    }
+
+  return a;
+}
+
+/* Determine whether A already contains an entry of type BOOT_TIME.  */
+_GL_ATTRIBUTE_MAYBE_UNUSED
+static bool
+have_boot_time (struct utmp_alloc a)
+{
+  for (idx_t i = 0; i < a.filled; i++)
+    {
+      struct gl_utmp *ut = &a.utmp[i];
+      if (UT_TYPE_BOOT_TIME (ut))
+        return true;
+    }
+  return false;
+}
+
+#if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION
+# if !HAVE_DECL_ENDUTENT /* Android */
+void endutent (void);
+# endif
+#endif
+
+static int
+read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
+                     int options)
+{
+  if ((options & READ_UTMP_BOOT_TIME) != 0
+      && (options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) != 0)
+    {
+      /* No entries can match the given options.  */
+      *n_entries = 0;
+      *utmp_buf = NULL;
+      return 0;
+    }
+
+  struct utmp_alloc a = {0};
+
+# if READUTMP_USE_SYSTEMD || HAVE_UTMPX_H || HAVE_UTMP_H
+
+#  if defined UTMP_NAME_FUNCTION /* glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, IRIX, Solaris, Cygwin, Android */
+
+  /* Ignore the return value for now.
+     Solaris' utmpname returns 1 upon success -- which is contrary
+     to what the GNU libc version does.  In addition, older GNU libc
+     versions are actually void.   */
+  UTMP_NAME_FUNCTION ((char *) file);
+
+  SET_UTMP_ENT ();
+
+#   if (defined __linux__ && !defined __ANDROID__) || defined __minix
+  bool file_is_utmp = (strcmp (file, UTMP_FILE) == 0);
+  /* Timestamp of the "runlevel" entry, if any.  */
+  struct timespec runlevel_ts = {0};
+#   endif
+
+  void const *entry;
+
+  while ((entry = GET_UTMP_ENT ()) != NULL)
+    {
+      struct UTMP_STRUCT_NAME const *ut = (struct UTMP_STRUCT_NAME const *) entry;
+
+      struct timespec ts =
+        #if (HAVE_UTMPX_H ? 1 : HAVE_STRUCT_UTMP_UT_TV)
+        { .tv_sec = ut->ut_tv.tv_sec, .tv_nsec = ut->ut_tv.tv_usec * 1000 };
+        #else
+        { .tv_sec = ut->ut_time, .tv_nsec = 0 };
+        #endif
+
+      a = add_utmp (a, options,
+                    UT_USER (ut), strnlen (UT_USER (ut), UT_USER_SIZE),
+                    #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_ID : HAVE_STRUCT_UTMP_UT_ID)
+                    ut->ut_id, strnlen (ut->ut_id, UT_ID_SIZE),
+                    #else
+                    "", 0,
+                    #endif
+                    ut->ut_line, strnlen (ut->ut_line, UT_LINE_SIZE),
+                    #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_HOST : HAVE_STRUCT_UTMP_UT_HOST)
+                    ut->ut_host, strnlen (ut->ut_host, UT_HOST_SIZE),
+                    #else
+                    "", 0,
+                    #endif
+                    #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_PID : HAVE_STRUCT_UTMP_UT_PID)
+                    ut->ut_pid,
+                    #else
+                    0,
+                    #endif
+                    #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE)
+                    ut->ut_type,
+                    #else
+                    0,
+                    #endif
+                    ts,
+                    #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_SESSION : HAVE_STRUCT_UTMP_UT_SESSION)
+                    ut->ut_session,
+                    #else
+                    0,
+                    #endif
+                    UT_EXIT_E_TERMINATION (ut), UT_EXIT_E_EXIT (ut)
+                   );
+#   if defined __linux__ && !defined __ANDROID__
+      if (file_is_utmp
+          && memcmp (UT_USER (ut), "runlevel", strlen ("runlevel") + 1) == 0
+          && memcmp (ut->ut_line, "~", strlen ("~") + 1) == 0)
+        runlevel_ts = ts;
+#   endif
+#   if defined __minix
+      if (file_is_utmp
+          && UT_USER (ut)[0] == '\0'
+          && memcmp (ut->ut_line, "run-level ", strlen ("run-level ")) == 0)
+        runlevel_ts = ts;
+#   endif
+    }
+
+  END_UTMP_ENT ();
+
+#   if defined __linux__ && !defined __ANDROID__
+  /* On Alpine Linux, UTMP_FILE is not filled.  It is always empty.
+     So, fake a BOOT_TIME entry, by getting the time stamp of a file that
+     gets touched only during the boot process.
+
+     On Raspbian, which runs on hardware without a real-time clock, during boot,
+       1. the clock gets set to 1970-01-01 00:00:00,
+       2. an entry gets written into /var/run/utmp, with ut_type = BOOT_TIME,
+          ut_user = "reboot", ut_line = "~", time = 1970-01-01 00:00:05 or so,
+       3. the clock gets set to a correct value through NTP,
+       4. an entry gets written into /var/run/utmp, with
+          ut_user = "runlevel", ut_line = "~", time = correct value.
+     In this case, copy the time from the "runlevel" entry to the "reboot"
+     entry.  */
+  if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
+      && file_is_utmp)
+    {
+      for (idx_t i = 0; i < a.filled; i++)
+        {
+          struct gl_utmp *ut = &a.utmp[i];
+          if (UT_TYPE_BOOT_TIME (ut))
+            {
+              /* Workaround for Raspbian:  */
+              if (ut->ut_ts.tv_sec <= 60 && runlevel_ts.tv_sec != 0)
+                ut->ut_ts = runlevel_ts;
+              break;
+            }
+        }
+      if (!have_boot_time (a))
+        {
+          /* Workaround for Alpine Linux:  */
+          struct timespec boot_time;
+          if (get_linux_boot_time_fallback (&boot_time) >= 0)
+            a = add_utmp (a, options,
+                          "reboot", strlen ("reboot"),
+                          "", 0,
+                          "~", strlen ("~"),
+                          "", 0,
+                          0, BOOT_TIME, boot_time, 0, 0, 0);
+        }
+    }
+#   endif
+
+#   if defined __ANDROID__
+  /* On Android, there is no /var, and normal processes don't have access
+     to system files.  Therefore use the kernel's uptime counter, although
+     it produces wrong values after the date has been bumped in the running
+     system.  */
+  if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
+      && strcmp (file, UTMP_FILE) == 0
+      && !have_boot_time (a))
+    {
+      struct timespec boot_time;
+      if (get_android_boot_time (&boot_time) >= 0)
+        a = add_utmp (a, options,
+                      "reboot", strlen ("reboot"),
+                      "", 0,
+                      "", 0,
+                      "", 0,
+                      0, BOOT_TIME, boot_time, 0, 0, 0);
+    }
+#   endif
+
+#   if defined __minix
+  /* On Minix, during boot,
+       1. an entry gets written into /var/run/utmp, with ut_type = BOOT_TIME,
+          ut_user = "", ut_line = "system boot", time = 1970-01-01 00:00:00,
+       2. an entry gets written into /var/run/utmp, with
+          ut_user = "", ut_line = "run-level m", time = correct value.
+     In this case, copy the time from the "run-level m" entry to the
+     "system boot" entry.  */
+  if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
+      && file_is_utmp)
+    {
+      for (idx_t i = 0; i < a.filled; i++)
+        {
+          struct gl_utmp *ut = &a.utmp[i];
+          if (UT_TYPE_BOOT_TIME (ut))
+            {
+              if (ut->ut_ts.tv_sec <= 60 && runlevel_ts.tv_sec != 0)
+                ut->ut_ts = runlevel_ts;
+              break;
+            }
+        }
+    }
+#   endif
+
+#  else /* old FreeBSD, OpenBSD, HP-UX, Haiku */
+
+  FILE *f = fopen (file, "re");
+
+  if (f != NULL)
+    {
+      for (;;)
+        {
+          struct UTMP_STRUCT_NAME ut;
+
+          if (fread (&ut, sizeof ut, 1, f) == 0)
+            break;
+          a = add_utmp (a, options,
+                        UT_USER (&ut), strnlen (UT_USER (&ut), UT_USER_SIZE),
+                        #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_ID : HAVE_STRUCT_UTMP_UT_ID)
+                        ut.ut_id, strnlen (ut.ut_id, UT_ID_SIZE),
+                        #else
+                        "", 0,
+                        #endif
+                        ut.ut_line, strnlen (ut.ut_line, UT_LINE_SIZE),
+                        #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_HOST : HAVE_STRUCT_UTMP_UT_HOST)
+                        ut.ut_host, strnlen (ut.ut_host, UT_HOST_SIZE),
+                        #else
+                        "", 0,
+                        #endif
+                        #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_PID : HAVE_STRUCT_UTMP_UT_PID)
+                        ut.ut_pid,
+                        #else
+                        0,
+                        #endif
+                        #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE)
+                        ut.ut_type,
+                        #else
+                        0,
+                        #endif
+                        #if (HAVE_UTMPX_H ? 1 : HAVE_STRUCT_UTMP_UT_TV)
+                        (struct timespec) { .tv_sec = ut.ut_tv.tv_sec, .tv_nsec = ut.ut_tv.tv_usec * 1000 },
+                        #else
+                        (struct timespec) { .tv_sec = ut.ut_time, .tv_nsec = 0 },
+                        #endif
+                        #if (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_SESSION : HAVE_STRUCT_UTMP_UT_SESSION)
+                        ut.ut_session,
+                        #else
+                        0,
+                        #endif
+                        UT_EXIT_E_TERMINATION (&ut), UT_EXIT_E_EXIT (&ut)
+                       );
+        }
+
+      int saved_errno = ferror (f) ? errno : 0;
+      if (fclose (f) != 0)
+        saved_errno = errno;
+      if (saved_errno != 0)
+        {
+          free (a.utmp);
+          errno = saved_errno;
+          return -1;
+        }
+    }
+  else
+    {
+      if (strcmp (file, UTMP_FILE) != 0)
+        {
+          int saved_errno = errno;
+          free (a.utmp);
+          errno = saved_errno;
+          return -1;
+        }
+    }
+
+#   if defined __OpenBSD__
+  if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
+      && strcmp (file, UTMP_FILE) == 0
+      && !have_boot_time (a))
+    {
+      struct timespec boot_time;
+      if (get_openbsd_boot_time (&boot_time) >= 0)
+        a = add_utmp (a, options,
+                      "reboot", strlen ("reboot"),
+                      "", 0,
+                      "", 0,
+                      "", 0,
+                      0, BOOT_TIME, boot_time, 0, 0, 0);
+    }
+#   endif
+
+#  endif
+
+#  if defined __linux__ && !defined __ANDROID__
+  if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
+      && strcmp (file, UTMP_FILE) == 0
+      && !have_boot_time (a))
+    {
+      struct timespec boot_time;
+      if (get_linux_boot_time_final_fallback (&boot_time) >= 0)
+        a = add_utmp (a, options,
+                      "reboot", strlen ("reboot"),
+                      "", 0,
+                      "~", strlen ("~"),
+                      "", 0,
+                      0, BOOT_TIME, boot_time, 0, 0, 0);
+    }
+
+#  endif
+
+#  if HAVE_SYS_SYSCTL_H && HAVE_SYSCTL \
+      && defined CTL_KERN && defined KERN_BOOTTIME \
+      && !defined __minix
+  if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
+      && strcmp (file, UTMP_FILE) == 0
+      && !have_boot_time (a))
+    {
+      struct timespec boot_time;
+      if (get_bsd_boot_time_final_fallback (&boot_time) >= 0)
+        a = add_utmp (a, options,
+                      "reboot", strlen ("reboot"),
+                      "", 0,
+                      "", 0,
+                      "", 0,
+                      0, BOOT_TIME, boot_time, 0, 0, 0);
+    }
+#  endif
+
+#  if defined __HAIKU__
+  if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
+      && strcmp (file, UTMP_FILE) == 0
+      && !have_boot_time (a))
+    {
+      struct timespec boot_time;
+      if (get_haiku_boot_time (&boot_time) >= 0)
+        a = add_utmp (a, options,
+                      "reboot", strlen ("reboot"),
+                      "", 0,
+                      "", 0,
+                      "", 0,
+                      0, BOOT_TIME, boot_time, 0, 0, 0);
+    }
+#  endif
+
+#  if HAVE_OS_H /* BeOS, Haiku */
+  if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
+      && strcmp (file, UTMP_FILE) == 0
+      && !have_boot_time (a))
+    {
+      struct timespec boot_time;
+      if (get_haiku_boot_time_final_fallback (&boot_time) >= 0)
+        a = add_utmp (a, options,
+                      "reboot", strlen ("reboot"),
+                      "", 0,
+                      "", 0,
+                      "", 0,
+                      0, BOOT_TIME, boot_time, 0, 0, 0);
+    }
+#  endif
+
+# endif
+
+# if defined __CYGWIN__ || defined _WIN32
+  if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
+      && strcmp (file, UTMP_FILE) == 0
+      && !have_boot_time (a))
+    {
+      struct timespec boot_time;
+      if (get_windows_boot_time (&boot_time) >= 0)
+        a = add_utmp (a, options,
+                      "reboot", strlen ("reboot"),
+                      "", 0,
+                      "", 0,
+                      "", 0,
+                      0, BOOT_TIME, boot_time, 0, 0, 0);
+    }
+# endif
+
+  a = finish_utmp (a);
+
+  *n_entries = a.filled;
+  *utmp_buf = a.utmp;
+
+  return 0;
+}
+
+# if READUTMP_USE_SYSTEMD
+/* Use systemd and Linux /proc and kernel APIs.  */
+
+static struct timespec
+get_boot_time_uncached (void)
+{
+  /* Try to find the boot time in the /var/run/utmp file.  */
+  {
+    idx_t n_entries = 0;
+    STRUCT_UTMP *utmp = NULL;
+    read_utmp_from_file (UTMP_FILE, &n_entries, &utmp, READ_UTMP_BOOT_TIME);
+    if (n_entries > 0)
+      {
+        struct timespec result = utmp[0].ut_ts;
+        free (utmp);
+        return result;
+      }
+    free (utmp);
+  }
+
+  /* We shouldn't get here.  */
+  return (struct timespec) {0};
+}
+
+static struct timespec
+get_boot_time (void)
+{
+  static bool volatile cached;
+  static struct timespec volatile boot_time;
+
+  if (!cached)
+    {
+      boot_time = get_boot_time_uncached ();
+      cached = true;
+    }
+  return boot_time;
+}
+
+/* Guess the pty name that was opened for the given user right after
+   the given time AT.  */
+static char *
+guess_pty_name (uid_t uid, const struct timespec at)
+{
+  /* Traverse the entries of the /dev/pts/ directory, looking for devices
+     which are owned by UID and whose ctime is shortly after AT.  */
+  DIR *dirp = opendir ("/dev/pts");
+  if (dirp != NULL)
+    {
+      /* Buffer containing /dev/pts/N.  */
+      char name_buf[9 + 10 + 1];
+      memcpy (name_buf, "/dev/pts/", 9);
+
+      char best_name[9 + 10 + 1];
+      struct timespec best_time = { .tv_sec = 0, .tv_nsec = 0 };
+
+      for (;;)
+        {
+          struct dirent *dp = readdir (dirp);
+          if (dp == NULL)
+            break;
+          if (dp->d_name[0] != '.' && strlen (dp->d_name) <= 10)
+            {
+              /* Compose the absolute file name /dev/pts/N.  */
+              strcpy (name_buf + 9, dp->d_name);
+
+              /* Find its owner and ctime.  */
+              struct stat st;
+              if (stat (name_buf, &st) >= 0
+                  && st.st_uid == uid
+                  && (st.st_ctim.tv_sec > at.tv_sec
+                      || (st.st_ctim.tv_sec == at.tv_sec
+                          && st.st_ctim.tv_nsec >= at.tv_nsec)))
+                {
+                  /* This entry has the owner UID and a ctime >= AT.  */
+                  /* Is this entry the best one so far?  */
+                  if ((best_time.tv_sec == 0 && best_time.tv_nsec == 0)
+                      || (st.st_ctim.tv_sec < best_time.tv_sec
+                          || (st.st_ctim.tv_sec == best_time.tv_sec
+                              && st.st_ctim.tv_nsec < best_time.tv_nsec)))
+                    {
+                      strcpy (best_name, name_buf);
+                      best_time = st.st_ctim;
+                    }
+                }
+            }
+        }
+
+      closedir (dirp);
+
+      /* Did we find an entry owned by ID, and is it at most 5 seconds
+         after AT?  */
+      if (!(best_time.tv_sec == 0 && best_time.tv_nsec == 0)
+          && (best_time.tv_sec < at.tv_sec + 5
+              || (best_time.tv_sec == at.tv_sec + 5
+                  && best_time.tv_nsec <= at.tv_nsec)))
+        return xstrdup (best_name + 5);
+    }
+
+  return NULL;
+}
+
+static int
+read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int options)
+{
+  /* Fill entries, simulating what a utmp file would contain.  */
+  struct utmp_alloc a = {0};
+
+  /* Synthesize a BOOT_TIME entry.  */
+  if (!(options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)))
+    a = add_utmp (a, options,
+                  "reboot", strlen ("reboot"),
+                  "", 0,
+                  "~", strlen ("~"),
+                  "", 0,
+                  0, BOOT_TIME, get_boot_time (), 0, 0, 0);
+
+  /* Synthesize USER_PROCESS entries.  */
+  if (!(options & READ_UTMP_BOOT_TIME))
+    {
+      char **sessions;
+      int num_sessions = sd_get_sessions (&sessions);
+      if (num_sessions >= 0 && sessions != NULL)
+        {
+          char **session_ptr;
+          for (session_ptr = sessions; *session_ptr != NULL; session_ptr++)
+            {
+              char *session = *session_ptr;
+
+              uint64_t start_usec;
+              if (sd_session_get_start_time (session, &start_usec) < 0)
+                start_usec = 0;
+              struct timespec start_ts;
+              start_ts.tv_sec = start_usec / 1000000;
+              start_ts.tv_nsec = start_usec % 1000000 * 1000;
+
+              char *seat;
+              if (sd_session_get_seat (session, &seat) < 0)
+                seat = NULL;
+
+              char missing[] = "";
+
+              char *type = NULL;
+              char *tty;
+              if (sd_session_get_tty (session, &tty) < 0)
+                {
+                  tty = NULL;
+                  /* Try harder to get a sensible value for the tty.  */
+                  if (sd_session_get_type (session, &type) < 0)
+                    type = missing;
+                  if (strcmp (type, "tty") == 0)
+                    {
+                      char *service;
+                      if (sd_session_get_service (session, &service) < 0)
+                        service = NULL;
+
+                      uid_t uid;
+                      char *pty = (sd_session_get_uid (session, &uid) < 0 ? NULL
+                                   : guess_pty_name (uid, start_ts));
+
+                      if (service != NULL && pty != NULL)
+                        {
+                          tty = xmalloc (strlen (service) + 1 + strlen (pty) + 1);
+                          stpcpy (stpcpy (stpcpy (tty, service), " "), pty);
+                          free (pty);
+                          free (service);
+                        }
+                      else if (service != NULL)
+                        tty = service;
+                      else if (pty != NULL)
+                        tty = pty;
+                    }
+                }
+
+              /* Create up to two USER_PROCESS entries: one for the seat,
+                 one for the tty.  */
+              if (seat != NULL || tty != NULL)
+                {
+                  char *user;
+                  if (sd_session_get_username (session, &user) < 0)
+                    user = missing;
+
+                  pid_t leader_pid;
+                  if (sd_session_get_leader (session, &leader_pid) < 0)
+                    leader_pid = 0;
+
+                  char *host;
+                  char *remote_host;
+                  if (sd_session_get_remote_host (session, &remote_host) < 0)
+                    {
+                      host = missing;
+                      /* For backward compatibility, put the X11 display into the
+                         host field.  */
+                      if (!type && sd_session_get_type (session, &type) < 0)
+                        type = missing;
+                      if (strcmp (type, "x11") == 0)
+                        {
+                          char *display;
+                          if (sd_session_get_display (session, &display) < 0)
+                            display = NULL;
+                          /* Workaround: gdm "forgets" to pass the display to
+                             systemd, thus display may be NULL here.  */
+                          if (display != NULL)
+                            host = display;
+                        }
+                    }
+                  else
+                    {
+                      char *remote_user;
+                      if (sd_session_get_remote_user (session, &remote_user) < 0)
+                        host = remote_host;
+                      else
+                        {
+                          host = xmalloc (strlen (remote_user) + 1
+                                          + strlen (remote_host) + 1);
+                          stpcpy (stpcpy (stpcpy (host, remote_user), "@"),
+                                  remote_host);
+                          free (remote_user);
+                          free (remote_host);
+                        }
+                    }
+
+                  if (seat != NULL)
+                    a = add_utmp (a, options,
+                                  user, strlen (user),
+                                  session, strlen (session),
+                                  seat, strlen (seat),
+                                  host, strlen (host),
+                                  leader_pid /* the best we have */,
+                                  USER_PROCESS, start_ts, leader_pid, 0, 0);
+                  if (tty != NULL)
+                    a = add_utmp (a, options,
+                                  user, strlen (user),
+                                  session, strlen (session),
+                                  tty, strlen (tty),
+                                  host, strlen (host),
+                                  leader_pid /* the best we have */,
+                                  USER_PROCESS, start_ts, leader_pid, 0, 0);
+
+                  if (host != missing)
+                    free (host);
+                  if (user != missing)
+                    free (user);
+                }
+
+              if (type != missing)
+                free (type);
+              free (tty);
+              free (seat);
+              free (session);
+            }
+          free (sessions);
+        }
+    }
+
+  a = finish_utmp (a);
+
+  *n_entries = a.filled;
+  *utmp_buf = a.utmp;
+
+  return 0;
+}
+
+# endif
+
+int
+read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
+           int options)
+{
+# if READUTMP_USE_SYSTEMD
+  if (strcmp (file, UTMP_FILE) == 0)
+    /* Imitate reading UTMP_FILE, using systemd and Linux APIs.  */
+    return read_utmp_from_systemd (n_entries, utmp_buf, options);
+# endif
+
+  return read_utmp_from_file (file, n_entries, utmp_buf, options);
+}
+
+#else /* dummy fallback */
+
+int
+read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
+           int options)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#endif
deleted file mode 120000 (symlink)
index b635bad43a1e25c025ab0f215a2e2e9ddf84fbf7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/readutmp.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dcfd44dbbc96e5428ed015224e04b9b82c911743
--- /dev/null
@@ -0,0 +1,338 @@
+/* Declarations for GNU's read utmp module.
+
+   Copyright (C) 1992-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by jla; revised by djm */
+
+#ifndef __READUTMP_H__
+#define __READUTMP_H__
+
+/* This file uses _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_RETURNS_NONNULL,
+   HAVE_UTMP_H, HAVE_UTMPX_H, HAVE_STRUCT_UTMP_*, HAVE_STRUCT_UTMPX_*,
+   HAVE_UTMPNAME, HAVE_UTMPXNAME.  */
+#if !_GL_CONFIG_H_INCLUDED
+# error "Please include config.h first."
+#endif
+
+#include "idx.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <time.h>
+
+/* AIX 4.3.3 has both utmp.h and utmpx.h, but only struct utmp
+   has the ut_exit member.  */
+#if (HAVE_UTMPX_H && HAVE_UTMP_H && HAVE_STRUCT_UTMP_UT_EXIT \
+     && ! HAVE_STRUCT_UTMPX_UT_EXIT)
+# undef HAVE_UTMPX_H
+#endif
+
+/* HPUX 10.20 needs utmp.h, for the definition of e.g., UTMP_FILE.  */
+#if HAVE_UTMP_H
+# include <utmp.h>
+#endif
+
+/* Needed for BOOT_TIME and USER_PROCESS.  */
+#if HAVE_UTMPX_H
+# if defined _THREAD_SAFE && defined UTMP_DATA_INIT
+    /* When including both utmp.h and utmpx.h on AIX 4.3, with _THREAD_SAFE
+       defined, work around the duplicate struct utmp_data declaration.  */
+#  define utmp_data gl_aix_4_3_workaround_utmp_data
+# endif
+# include <utmpx.h>
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Type of entries returned by read_utmp on all platforms.  */
+struct gl_utmp
+{
+  /* All 'char *' here are of arbitrary length and point to storage
+     with lifetime equal to that of this struct.  */
+  char *ut_user;                /* User name */
+  char *ut_id;                  /* Session ID */
+  char *ut_line;                /* seat / device */
+  char *ut_host;                /* for remote sessions: user@host or host,
+                                   for local sessions: the X11 display :N */
+  struct timespec ut_ts;        /* time */
+  pid_t ut_pid;                 /* process ID of ? */
+  pid_t ut_session;             /* process ID of session leader */
+  short ut_type;                /* BOOT_TIME, USER_PROCESS, or other */
+  struct { int e_termination; int e_exit; } ut_exit;
+};
+
+/* The following types, macros, and constants describe the 'struct gl_utmp'.  */
+#define UT_USER(UT) ((UT)->ut_user)
+#define UT_TIME_MEMBER(UT) ((UT)->ut_ts.tv_sec)
+#define UT_PID(UT) ((UT)->ut_pid)
+#define UT_TYPE_EQ(UT, V) ((UT)->ut_type == (V))
+#define UT_TYPE_NOT_DEFINED 0
+#define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.e_termination)
+#define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.e_exit)
+
+/* Type of entry returned by read_utmp().  */
+typedef struct gl_utmp STRUCT_UTMP;
+
+/* Size of the UT_USER (ut) member, or -1 if unbounded.  */
+enum { UT_USER_SIZE = -1 };
+
+/* Size of the ut->ut_id member, or -1 if unbounded.  */
+enum { UT_ID_SIZE = -1 };
+
+/* Size of the ut->ut_line member, or -1 if unbounded.  */
+enum { UT_LINE_SIZE = -1 };
+
+/* Size of the ut->ut_host member, or -1 if unbounded.  */
+enum { UT_HOST_SIZE = -1 };
+
+
+/* When read_utmp accesses a file (as opposed to fetching the information
+   from systemd), it uses the following low-level types and macros.
+   Keep them here, rather than moving them into readutmp.c, for backward
+   compatibility.  */
+
+#if HAVE_UTMPX_H
+
+/* <utmpx.h> defines 'struct utmpx' with the following fields:
+
+     Field        Type                       Platforms
+     ----------   ------                     ---------
+   ⎡ ut_user      char[]                     glibc, musl, macOS, FreeBSD, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+   ⎣ ut_name      char[]                     NetBSD, Minix
+     ut_id        char[]                     glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+     ut_line      char[]                     glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+     ut_pid       pid_t                      glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+     ut_type      short                      glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+   ⎡ ut_tv        struct                     glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+   ⎢              { tv_sec; tv_usec; }
+   ⎣ ut_time      time_t                     Cygwin
+     ut_host      char[]                     glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+     ut_exit      struct                     glibc, musl, NetBSD, Minix, HP-UX, IRIX, Solaris, Android
+                  { e_termination; e_exit; }
+     ut_session   [long] int                 glibc, musl, NetBSD, Minix, IRIX, Solaris, Android
+   ⎡ ut_addr      [long] int                 HP-UX, Cygwin
+   ⎢ ut_addr_v6   [u]int[4]                  glibc, musl, Android
+   ⎣ ut_ss        struct sockaddr_storage    NetBSD, Minix
+ */
+
+# if __GLIBC__ && _TIME_BITS == 64
+/* This is a near-copy of glibc's struct utmpx, which stops working
+   after the year 2038.  Unlike the glibc version, struct utmpx32
+   describes the file format even if time_t is 64 bits.  */
+#define _GL_UT_USER_SIZE  sizeof (((struct utmpx *) 0)->ut_user)
+#define _GL_UT_ID_SIZE    sizeof (((struct utmpx *) 0)->ut_id)
+#define _GL_UT_LINE_SIZE  sizeof (((struct utmpx *) 0)->ut_line)
+#define _GL_UT_HOST_SIZE  sizeof (((struct utmpx *) 0)->ut_host)
+struct utmpx32
+{
+  short int ut_type;               /* Type of login.  */
+  pid_t ut_pid;                    /* Process ID of login process.  */
+  char ut_line[_GL_UT_LINE_SIZE];  /* Devicename.  */
+  char ut_id[_GL_UT_ID_SIZE];      /* Inittab ID.  */
+  char ut_user[_GL_UT_USER_SIZE];  /* Username.  */
+  char ut_host[_GL_UT_HOST_SIZE];  /* Hostname for remote login. */
+  struct __exit_status ut_exit;    /* Exit status of a process marked
+                                      as DEAD_PROCESS.  */
+  /* The fields ut_session and ut_tv must be the same size when compiled
+     32- and 64-bit.  This allows files and shared memory to be shared
+     between 32- and 64-bit applications.  */
+  int ut_session;                  /* Session ID, used for windowing.  */
+  struct
+  {
+    /* Seconds.  Unsigned not signed, as glibc did not exist before 1970,
+       and if the format is still in use after 2038 its timestamps
+       will surely have the sign bit on.  This hack stops working
+       at 2106-02-07 06:28:16 UTC.  */
+    unsigned int tv_sec;
+    int tv_usec;                   /* Microseconds.  */
+  } ut_tv;                         /* Time entry was made.  */
+  int ut_addr_v6[4];               /* Internet address of remote host.  */
+  char ut_reserved[20];            /* Reserved for future use.  */
+};
+#  define UTMP_STRUCT_NAME utmpx32
+# else
+#  define UTMP_STRUCT_NAME utmpx
+# endif
+# define SET_UTMP_ENT setutxent
+# define GET_UTMP_ENT getutxent
+# define END_UTMP_ENT endutxent
+# ifdef HAVE_UTMPXNAME /* glibc, musl, macOS, NetBSD, Minix, IRIX, Solaris, Cygwin */
+#  define UTMP_NAME_FUNCTION utmpxname
+# elif defined UTXDB_ACTIVE /* FreeBSD */
+#  define UTMP_NAME_FUNCTION(x) setutxdb (UTXDB_ACTIVE, x)
+# elif defined __ANDROID__ /* Android */
+/* As of Android NDK r26, the getutxent, setutxent functions are no-ops.
+   Therefore we can ignore the file name.  */
+#  define UTMP_NAME_FUNCTION(x) ((void) (x))
+# endif
+
+#elif HAVE_UTMP_H
+
+/* <utmp.h> defines 'struct utmp' with the following fields:
+
+     Field        Type                       Platforms
+     ----------   ------                     ---------
+   ⎡ ut_user      char[]                     glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+   ⎣ ut_name      char[]                     macOS, old FreeBSD, NetBSD, OpenBSD, Minix
+     ut_id        char[]                     glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+     ut_line      char[]                     glibc, musl, macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+     ut_pid       pid_t                      glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+     ut_type      short                      glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+   ⎡ ut_tv        struct                     glibc, musl, Android
+   ⎢              { tv_sec; tv_usec; }
+   ⎣ ut_time      time_t                     macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
+     ut_host      char[]                     glibc, musl, macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, Cygwin, Android
+     ut_exit      struct                     glibc, musl, AIX, HP-UX, IRIX, Solaris, Android
+                  { e_termination; e_exit; }
+     ut_session   [long] int                 glibc, musl, Android
+   ⎡ ut_addr      [long] int                 HP-UX, Cygwin
+   ⎣ ut_addr_v6   [u]int[4]                  glibc, musl, Android
+ */
+
+# define UTMP_STRUCT_NAME utmp
+# define SET_UTMP_ENT setutent
+# define GET_UTMP_ENT getutent
+# define END_UTMP_ENT endutent
+# ifdef HAVE_UTMPNAME /* glibc, musl, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android */
+#  define UTMP_NAME_FUNCTION utmpname
+# endif
+
+#endif
+
+/* Evaluates to 1 if gl_utmp's ut_id field may ever have a non-zero value.  */
+#define HAVE_STRUCT_XTMP_UT_ID \
+  (READUTMP_USE_SYSTEMD \
+   || (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_ID : HAVE_STRUCT_UTMP_UT_ID))
+
+/* Evaluates to 1 if gl_utmp's ut_pid field may ever have a non-zero value.  */
+#define HAVE_STRUCT_XTMP_UT_PID \
+  (READUTMP_USE_SYSTEMD \
+   || (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_PID : HAVE_STRUCT_UTMP_UT_PID))
+
+/* Evaluates to 1 if gl_utmp's ut_host field may ever be non-empty.  */
+#define HAVE_STRUCT_XTMP_UT_HOST \
+  (READUTMP_USE_SYSTEMD \
+   || (HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_HOST : HAVE_STRUCT_UTMP_UT_HOST))
+
+/* Definition of UTMP_FILE.
+   On glibc systems, UTMP_FILE is "/var/run/utmp".  */
+#if !defined UTMP_FILE && defined _PATH_UTMP
+# define UTMP_FILE _PATH_UTMP
+#endif
+#ifdef UTMPX_FILE /* Solaris, SysVr4 */
+# undef UTMP_FILE
+# define UTMP_FILE UTMPX_FILE
+#endif
+#ifndef UTMP_FILE
+# define UTMP_FILE "/etc/utmp"
+#endif
+
+/* Definition of WTMP_FILE.
+   On glibc systems, UTMP_FILE is "/var/log/wtmp".  */
+#if !defined WTMP_FILE && defined _PATH_WTMP
+# define WTMP_FILE _PATH_WTMP
+#endif
+#ifdef WTMPX_FILE /* Solaris, SysVr4 */
+# undef WTMP_FILE
+# define WTMP_FILE WTMPX_FILE
+#endif
+#ifndef WTMP_FILE
+# define WTMP_FILE "/etc/wtmp"
+#endif
+
+/* In early versions of Android, <utmp.h> did not define BOOT_TIME, only
+   USER_PROCESS.  We need to use the value that is defined in newer versions
+   of Android.  */
+#if defined __ANDROID__ && !defined BOOT_TIME
+# define BOOT_TIME 2
+#endif
+
+/* Some platforms, such as OpenBSD, don't have an ut_type field and don't have
+   the BOOT_TIME and USER_PROCESS macros.  But we want to support them in
+   'struct gl_utmp'.  */
+#if !(HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE)
+# define BOOT_TIME 2
+# define USER_PROCESS 0
+#endif
+
+/* Macros that test (UT)->ut_type.  */
+#ifdef BOOT_TIME
+# define UT_TYPE_BOOT_TIME(UT) ((UT)->ut_type == BOOT_TIME)
+#else
+# define UT_TYPE_BOOT_TIME(UT) 0
+#endif
+#ifdef USER_PROCESS
+# define UT_TYPE_USER_PROCESS(UT) ((UT)->ut_type == USER_PROCESS)
+#else
+# define UT_TYPE_USER_PROCESS(UT) 0
+#endif
+
+/* Determines whether an entry *UT corresponds to a user process.  */
+#define IS_USER_PROCESS(UT)                                    \
+  ((UT)->ut_user[0] && UT_TYPE_USER_PROCESS (UT))
+
+/* Define if read_utmp is not just a dummy.  */
+#if READUTMP_USE_SYSTEMD || HAVE_UTMPX_H || HAVE_UTMP_H || defined __CYGWIN__ || defined _WIN32
+# define READ_UTMP_SUPPORTED 1
+#endif
+
+/* Options for read_utmp.  */
+enum
+  {
+    READ_UTMP_CHECK_PIDS   = 1,
+    READ_UTMP_USER_PROCESS = 2,
+    READ_UTMP_BOOT_TIME    = 4,
+    READ_UTMP_NO_BOOT_TIME = 8
+  };
+
+/* Return a copy of (UT)->ut_user, without trailing spaces,
+   as a freshly allocated string.  */
+char *extract_trimmed_name (const STRUCT_UTMP *ut)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+/* Read the utmp entries corresponding to file FILE into freshly-
+   malloc'd storage, set *UTMP_BUF to that pointer, set *N_ENTRIES to
+   the number of entries, and return zero.  If there is any error,
+   return -1, setting errno, and don't modify the parameters.
+   A good candidate for FILE is UTMP_FILE.
+   If OPTIONS & READ_UTMP_CHECK_PIDS is nonzero, omit entries whose
+   process-IDs do not currently exist.
+   If OPTIONS & READ_UTMP_USER_PROCESS is nonzero, omit entries which
+   do not correspond to a user process.
+   If OPTIONS & READ_UTMP_BOOT_TIME is nonzero, omit all entries except
+   the one that contains the boot time.
+   If OPTIONS & READ_UTMP_NO_BOOT_TIME is nonzero, omit the boot time
+   entries.
+
+   This function is not multithread-safe, since on many platforms it
+   invokes the functions setutxent, getutxent, endutxent.  These
+   functions are needed because they may lock FILE (so that we don't
+   read garbage when a concurrent process writes to FILE), but their
+   drawback is that they have a common global state.  */
+int read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
+               int options);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __READUTMP_H__ */
deleted file mode 120000 (symlink)
index 91f862c1f757d2209311772ae018b6f7c54f5271..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/realloc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0573139625e750c314b23a3b91cec63f658d6113
--- /dev/null
@@ -0,0 +1,63 @@
+/* realloc() function that is glibc compatible.
+
+   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering and Bruno Haible */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <errno.h>
+
+#include "xalloc-oversized.h"
+
+/* Call the system's realloc below.  This file does not define
+   _GL_USE_STDLIB_ALLOC because it needs Gnulib's malloc if present.  */
+#undef realloc
+
+/* Change the size of an allocated block of memory P to N bytes,
+   with error checking.  If P is NULL, use malloc.  Otherwise if N is zero,
+   free P and return NULL.  */
+
+void *
+rpl_realloc (void *p, size_t n)
+{
+  if (p == NULL)
+    return malloc (n);
+
+  if (n == 0)
+    {
+      free (p);
+      return NULL;
+    }
+
+  if (xalloc_oversized (n, 1))
+    {
+      errno = ENOMEM;
+      return NULL;
+    }
+
+  void *result = realloc (p, n);
+
+#if !HAVE_MALLOC_POSIX
+  if (result == NULL)
+    errno = ENOMEM;
+#endif
+
+  return result;
+}
deleted file mode 120000 (symlink)
index 45dc2c8ff1578115eaf9632ee4b691bff815349e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/reallocarray.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..09711a0edeb3dd3870402b29408fea72fd35bace
--- /dev/null
@@ -0,0 +1,38 @@
+/* reallocarray function that is glibc compatible.
+
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Darshit Shah */
+
+#include <config.h>
+
+#include <stdckdint.h>
+#include <stdlib.h>
+#include <errno.h>
+
+void *
+reallocarray (void *ptr, size_t nmemb, size_t size)
+{
+  size_t nbytes;
+  if (ckd_mul (&nbytes, nmemb, size))
+    {
+      errno = ENOMEM;
+      return NULL;
+    }
+
+  /* Rely on the semantics of GNU realloc.  */
+  return realloc (ptr, nbytes);
+}
deleted file mode 120000 (symlink)
index 46350c937137d1c9184295cbf8b916183c45359f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/regcomp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..696cf813f3c5c87456cda5ad1294b5982699f50b
--- /dev/null
+/* Extended regular expression matching and search library.
+   Copyright (C) 2002-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifdef _LIBC
+# include <locale/weight.h>
+#endif
+
+static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
+                                         size_t length, reg_syntax_t syntax);
+static void re_compile_fastmap_iter (regex_t *bufp,
+                                    const re_dfastate_t *init_state,
+                                    char *fastmap);
+static reg_errcode_t init_dfa (re_dfa_t *dfa, size_t pat_len);
+static void free_charset (re_charset_t *cset);
+static void free_workarea_compile (regex_t *preg);
+static reg_errcode_t create_initial_state (re_dfa_t *dfa);
+static void optimize_utf8 (re_dfa_t *dfa);
+static reg_errcode_t analyze (regex_t *preg);
+static reg_errcode_t preorder (bin_tree_t *root,
+                              reg_errcode_t (fn (void *, bin_tree_t *)),
+                              void *extra);
+static reg_errcode_t postorder (bin_tree_t *root,
+                               reg_errcode_t (fn (void *, bin_tree_t *)),
+                               void *extra);
+static reg_errcode_t optimize_subexps (void *extra, bin_tree_t *node);
+static reg_errcode_t lower_subexps (void *extra, bin_tree_t *node);
+static bin_tree_t *lower_subexp (reg_errcode_t *err, regex_t *preg,
+                                bin_tree_t *node);
+static reg_errcode_t calc_first (void *extra, bin_tree_t *node);
+static reg_errcode_t calc_next (void *extra, bin_tree_t *node);
+static reg_errcode_t link_nfa_nodes (void *extra, bin_tree_t *node);
+static Idx duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint);
+static Idx search_duplicated_node (const re_dfa_t *dfa, Idx org_node,
+                                  unsigned int constraint);
+static reg_errcode_t calc_eclosure (re_dfa_t *dfa);
+static reg_errcode_t calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa,
+                                        Idx node, bool root);
+static reg_errcode_t calc_inveclosure (re_dfa_t *dfa);
+static Idx fetch_number (re_string_t *input, re_token_t *token,
+                        reg_syntax_t syntax);
+static int peek_token (re_token_t *token, re_string_t *input,
+                       reg_syntax_t syntax);
+static bin_tree_t *parse (re_string_t *regexp, regex_t *preg,
+                         reg_syntax_t syntax, reg_errcode_t *err);
+static bin_tree_t *parse_reg_exp (re_string_t *regexp, regex_t *preg,
+                                 re_token_t *token, reg_syntax_t syntax,
+                                 Idx nest, reg_errcode_t *err);
+static bin_tree_t *parse_branch (re_string_t *regexp, regex_t *preg,
+                                re_token_t *token, reg_syntax_t syntax,
+                                Idx nest, reg_errcode_t *err);
+static bin_tree_t *parse_expression (re_string_t *regexp, regex_t *preg,
+                                    re_token_t *token, reg_syntax_t syntax,
+                                    Idx nest, reg_errcode_t *err);
+static bin_tree_t *parse_sub_exp (re_string_t *regexp, regex_t *preg,
+                                 re_token_t *token, reg_syntax_t syntax,
+                                 Idx nest, reg_errcode_t *err);
+static bin_tree_t *parse_dup_op (bin_tree_t *dup_elem, re_string_t *regexp,
+                                re_dfa_t *dfa, re_token_t *token,
+                                reg_syntax_t syntax, reg_errcode_t *err);
+static bin_tree_t *parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa,
+                                     re_token_t *token, reg_syntax_t syntax,
+                                     reg_errcode_t *err);
+static reg_errcode_t parse_bracket_element (bracket_elem_t *elem,
+                                           re_string_t *regexp,
+                                           re_token_t *token, int token_len,
+                                           re_dfa_t *dfa,
+                                           reg_syntax_t syntax,
+                                           bool accept_hyphen);
+static reg_errcode_t parse_bracket_symbol (bracket_elem_t *elem,
+                                         re_string_t *regexp,
+                                         re_token_t *token);
+static reg_errcode_t build_equiv_class (bitset_t sbcset,
+                                       re_charset_t *mbcset,
+                                       Idx *equiv_class_alloc,
+                                       const unsigned char *name);
+static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
+                                     bitset_t sbcset,
+                                     re_charset_t *mbcset,
+                                     Idx *char_class_alloc,
+                                     const char *class_name,
+                                     reg_syntax_t syntax);
+static bin_tree_t *build_charclass_op (re_dfa_t *dfa,
+                                      RE_TRANSLATE_TYPE trans,
+                                      const char *class_name,
+                                      const char *extra,
+                                      bool non_match, reg_errcode_t *err);
+static bin_tree_t *create_tree (re_dfa_t *dfa,
+                               bin_tree_t *left, bin_tree_t *right,
+                               re_token_type_t type);
+static bin_tree_t *create_token_tree (re_dfa_t *dfa,
+                                     bin_tree_t *left, bin_tree_t *right,
+                                     const re_token_t *token);
+static bin_tree_t *duplicate_tree (const bin_tree_t *src, re_dfa_t *dfa);
+static void free_token (re_token_t *node);
+static reg_errcode_t free_tree (void *extra, bin_tree_t *node);
+static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node);
+\f
+/* This table gives an error message for each of the error codes listed
+   in regex.h.  Obviously the order here has to be same as there.
+   POSIX doesn't require that we do anything for REG_NOERROR,
+   but why not be nice?  */
+
+static const char __re_error_msgid[] =
+  {
+#define REG_NOERROR_IDX        0
+    gettext_noop ("Success")   /* REG_NOERROR */
+    "\0"
+#define REG_NOMATCH_IDX (REG_NOERROR_IDX + sizeof "Success")
+    gettext_noop ("No match")  /* REG_NOMATCH */
+    "\0"
+#define REG_BADPAT_IDX (REG_NOMATCH_IDX + sizeof "No match")
+    gettext_noop ("Invalid regular expression") /* REG_BADPAT */
+    "\0"
+#define REG_ECOLLATE_IDX (REG_BADPAT_IDX + sizeof "Invalid regular expression")
+    gettext_noop ("Invalid collation character") /* REG_ECOLLATE */
+    "\0"
+#define REG_ECTYPE_IDX (REG_ECOLLATE_IDX + sizeof "Invalid collation character")
+    gettext_noop ("Invalid character class name") /* REG_ECTYPE */
+    "\0"
+#define REG_EESCAPE_IDX        (REG_ECTYPE_IDX + sizeof "Invalid character class name")
+    gettext_noop ("Trailing backslash") /* REG_EESCAPE */
+    "\0"
+#define REG_ESUBREG_IDX        (REG_EESCAPE_IDX + sizeof "Trailing backslash")
+    gettext_noop ("Invalid back reference") /* REG_ESUBREG */
+    "\0"
+#define REG_EBRACK_IDX (REG_ESUBREG_IDX + sizeof "Invalid back reference")
+    gettext_noop ("Unmatched [, [^, [:, [., or [=")    /* REG_EBRACK */
+    "\0"
+#define REG_EPAREN_IDX (REG_EBRACK_IDX + sizeof "Unmatched [, [^, [:, [., or [=")
+    gettext_noop ("Unmatched ( or \\(") /* REG_EPAREN */
+    "\0"
+#define REG_EBRACE_IDX (REG_EPAREN_IDX + sizeof "Unmatched ( or \\(")
+    gettext_noop ("Unmatched \\{") /* REG_EBRACE */
+    "\0"
+#define REG_BADBR_IDX  (REG_EBRACE_IDX + sizeof "Unmatched \\{")
+    gettext_noop ("Invalid content of \\{\\}") /* REG_BADBR */
+    "\0"
+#define REG_ERANGE_IDX (REG_BADBR_IDX + sizeof "Invalid content of \\{\\}")
+    gettext_noop ("Invalid range end") /* REG_ERANGE */
+    "\0"
+#define REG_ESPACE_IDX (REG_ERANGE_IDX + sizeof "Invalid range end")
+    gettext_noop ("Memory exhausted") /* REG_ESPACE */
+    "\0"
+#define REG_BADRPT_IDX (REG_ESPACE_IDX + sizeof "Memory exhausted")
+    gettext_noop ("Invalid preceding regular expression") /* REG_BADRPT */
+    "\0"
+#define REG_EEND_IDX   (REG_BADRPT_IDX + sizeof "Invalid preceding regular expression")
+    gettext_noop ("Premature end of regular expression") /* REG_EEND */
+    "\0"
+#define REG_ESIZE_IDX  (REG_EEND_IDX + sizeof "Premature end of regular expression")
+    gettext_noop ("Regular expression too big") /* REG_ESIZE */
+    "\0"
+#define REG_ERPAREN_IDX        (REG_ESIZE_IDX + sizeof "Regular expression too big")
+    gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */
+  };
+
+static const size_t __re_error_msgid_idx[] =
+  {
+    REG_NOERROR_IDX,
+    REG_NOMATCH_IDX,
+    REG_BADPAT_IDX,
+    REG_ECOLLATE_IDX,
+    REG_ECTYPE_IDX,
+    REG_EESCAPE_IDX,
+    REG_ESUBREG_IDX,
+    REG_EBRACK_IDX,
+    REG_EPAREN_IDX,
+    REG_EBRACE_IDX,
+    REG_BADBR_IDX,
+    REG_ERANGE_IDX,
+    REG_ESPACE_IDX,
+    REG_BADRPT_IDX,
+    REG_EEND_IDX,
+    REG_ESIZE_IDX,
+    REG_ERPAREN_IDX
+  };
+\f
+/* Entry points for GNU code.  */
+
+/* re_compile_pattern is the GNU regular expression compiler: it
+   compiles PATTERN (of length LENGTH) and puts the result in BUFP.
+   Returns 0 if the pattern was valid, otherwise an error string.
+
+   Assumes the 'allocated' (and perhaps 'buffer') and 'translate' fields
+   are set in BUFP on entry.  */
+
+const char *
+re_compile_pattern (const char *pattern, size_t length,
+                   struct re_pattern_buffer *bufp)
+{
+  reg_errcode_t ret;
+
+  /* And GNU code determines whether or not to get register information
+     by passing null for the REGS argument to re_match, etc., not by
+     setting no_sub, unless RE_NO_SUB is set.  */
+  bufp->no_sub = !!(re_syntax_options & RE_NO_SUB);
+
+  /* Match anchors at newline.  */
+  bufp->newline_anchor = 1;
+
+  ret = re_compile_internal (bufp, pattern, length, re_syntax_options);
+
+  if (!ret)
+    return NULL;
+  return gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]);
+}
+weak_alias (__re_compile_pattern, re_compile_pattern)
+
+/* Set by 're_set_syntax' to the current regexp syntax to recognize.  Can
+   also be assigned to arbitrarily: each pattern buffer stores its own
+   syntax, so it can be changed between regex compilations.  */
+/* This has no initializer because initialized variables in Emacs
+   become read-only after dumping.  */
+reg_syntax_t re_syntax_options;
+
+
+/* Specify the precise syntax of regexps for compilation.  This provides
+   for compatibility for various utilities which historically have
+   different, incompatible syntaxes.
+
+   The argument SYNTAX is a bit mask comprised of the various bits
+   defined in regex.h.  We return the old syntax.  */
+
+reg_syntax_t
+re_set_syntax (reg_syntax_t syntax)
+{
+  reg_syntax_t ret = re_syntax_options;
+
+  re_syntax_options = syntax;
+  return ret;
+}
+weak_alias (__re_set_syntax, re_set_syntax)
+
+int
+re_compile_fastmap (struct re_pattern_buffer *bufp)
+{
+  re_dfa_t *dfa = bufp->buffer;
+  char *fastmap = bufp->fastmap;
+
+  memset (fastmap, '\0', sizeof (char) * SBC_MAX);
+  re_compile_fastmap_iter (bufp, dfa->init_state, fastmap);
+  if (dfa->init_state != dfa->init_state_word)
+    re_compile_fastmap_iter (bufp, dfa->init_state_word, fastmap);
+  if (dfa->init_state != dfa->init_state_nl)
+    re_compile_fastmap_iter (bufp, dfa->init_state_nl, fastmap);
+  if (dfa->init_state != dfa->init_state_begbuf)
+    re_compile_fastmap_iter (bufp, dfa->init_state_begbuf, fastmap);
+  bufp->fastmap_accurate = 1;
+  return 0;
+}
+weak_alias (__re_compile_fastmap, re_compile_fastmap)
+
+static __always_inline void
+re_set_fastmap (char *fastmap, bool icase, int ch)
+{
+  fastmap[ch] = 1;
+  if (icase)
+    fastmap[tolower (ch)] = 1;
+}
+
+/* Helper function for re_compile_fastmap.
+   Compile fastmap for the initial_state INIT_STATE.  */
+
+static void
+re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
+                        char *fastmap)
+{
+  re_dfa_t *dfa = bufp->buffer;
+  Idx node_cnt;
+  bool icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
+  for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
+    {
+      Idx node = init_state->nodes.elems[node_cnt];
+      re_token_type_t type = dfa->nodes[node].type;
+
+      if (type == CHARACTER)
+       {
+         re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
+         if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
+           {
+             unsigned char buf[MB_LEN_MAX];
+             unsigned char *p;
+             wchar_t wc;
+             mbstate_t state;
+
+             p = buf;
+             *p++ = dfa->nodes[node].opr.c;
+             while (++node < dfa->nodes_len
+                    && dfa->nodes[node].type == CHARACTER
+                    && dfa->nodes[node].mb_partial)
+               *p++ = dfa->nodes[node].opr.c;
+             memset (&state, '\0', sizeof (state));
+             if (__mbrtowc (&wc, (const char *) buf, p - buf,
+                            &state) == p - buf
+                 && (__wcrtomb ((char *) buf, __towlower (wc), &state)
+                     != (size_t) -1))
+               re_set_fastmap (fastmap, false, buf[0]);
+           }
+       }
+      else if (type == SIMPLE_BRACKET)
+       {
+         int i, ch;
+         for (i = 0, ch = 0; i < BITSET_WORDS; ++i)
+           {
+             int j;
+             bitset_word_t w = dfa->nodes[node].opr.sbcset[i];
+             for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
+               if (w & ((bitset_word_t) 1 << j))
+                 re_set_fastmap (fastmap, icase, ch);
+           }
+       }
+      else if (type == COMPLEX_BRACKET)
+       {
+         re_charset_t *cset = dfa->nodes[node].opr.mbcset;
+         Idx i;
+
+#ifdef _LIBC
+         /* See if we have to try all bytes which start multiple collation
+            elements.
+            e.g. In da_DK, we want to catch 'a' since "aa" is a valid
+                 collation element, and don't catch 'b' since 'b' is
+                 the only collation element which starts from 'b' (and
+                 it is caught by SIMPLE_BRACKET).  */
+             if (_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES) != 0
+                 && (cset->ncoll_syms || cset->nranges))
+               {
+                 const int32_t *table = (const int32_t *)
+                   _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
+                 for (i = 0; i < SBC_MAX; ++i)
+                   if (table[i] < 0)
+                     re_set_fastmap (fastmap, icase, i);
+               }
+#endif /* _LIBC */
+
+         /* See if we have to start the match at all multibyte characters,
+            i.e. where we would not find an invalid sequence.  This only
+            applies to multibyte character sets; for single byte character
+            sets, the SIMPLE_BRACKET again suffices.  */
+         if (dfa->mb_cur_max > 1
+             && (cset->nchar_classes || cset->non_match || cset->nranges
+#ifdef _LIBC
+                 || cset->nequiv_classes
+#endif /* _LIBC */
+                ))
+           {
+             unsigned char c = 0;
+             do
+               {
+                 mbstate_t mbs;
+                 memset (&mbs, 0, sizeof (mbs));
+                 if (__mbrtowc (NULL, (char *) &c, 1, &mbs) == (size_t) -2)
+                   re_set_fastmap (fastmap, false, (int) c);
+               }
+             while (++c != 0);
+           }
+
+         else
+           {
+             /* ... Else catch all bytes which can start the mbchars.  */
+             for (i = 0; i < cset->nmbchars; ++i)
+               {
+                 char buf[256];
+                 mbstate_t state;
+                 memset (&state, '\0', sizeof (state));
+                 if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
+                   re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
+                 if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
+                   {
+                     if (__wcrtomb (buf, __towlower (cset->mbchars[i]), &state)
+                         != (size_t) -1)
+                       re_set_fastmap (fastmap, false, *(unsigned char *) buf);
+                   }
+               }
+           }
+       }
+      else if (type == OP_PERIOD || type == OP_UTF8_PERIOD || type == END_OF_RE)
+       {
+         memset (fastmap, '\1', sizeof (char) * SBC_MAX);
+         if (type == END_OF_RE)
+           bufp->can_be_null = 1;
+         return;
+       }
+    }
+}
+\f
+/* Entry point for POSIX code.  */
+/* regcomp takes a regular expression as a string and compiles it.
+
+   PREG is a regex_t *.  We do not expect any fields to be initialized,
+   since POSIX says we shouldn't.  Thus, we set
+
+     'buffer' to the compiled pattern;
+     'used' to the length of the compiled pattern;
+     'syntax' to RE_SYNTAX_POSIX_EXTENDED if the
+       REG_EXTENDED bit in CFLAGS is set; otherwise, to
+       RE_SYNTAX_POSIX_BASIC;
+     'newline_anchor' to REG_NEWLINE being set in CFLAGS;
+     'fastmap' to an allocated space for the fastmap;
+     'fastmap_accurate' to zero;
+     're_nsub' to the number of subexpressions in PATTERN.
+
+   PATTERN is the address of the pattern string.
+
+   CFLAGS is a series of bits which affect compilation.
+
+     If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
+     use POSIX basic syntax.
+
+     If REG_NEWLINE is set, then . and [^...] don't match newline.
+     Also, regexec will try a match beginning after every newline.
+
+     If REG_ICASE is set, then we considers upper- and lowercase
+     versions of letters to be equivalent when matching.
+
+     If REG_NOSUB is set, then when PREG is passed to regexec, that
+     routine will report only success or failure, and nothing about the
+     registers.
+
+   It returns 0 if it succeeds, nonzero if it doesn't.  (See regex.h for
+   the return codes and their meanings.)  */
+
+int
+regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags)
+{
+  reg_errcode_t ret;
+  reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
+                        : RE_SYNTAX_POSIX_BASIC);
+
+  preg->buffer = NULL;
+  preg->allocated = 0;
+  preg->used = 0;
+
+  /* Try to allocate space for the fastmap.  */
+  preg->fastmap = re_malloc (char, SBC_MAX);
+  if (__glibc_unlikely (preg->fastmap == NULL))
+    return REG_ESPACE;
+
+  syntax |= (cflags & REG_ICASE) ? RE_ICASE : 0;
+
+  /* If REG_NEWLINE is set, newlines are treated differently.  */
+  if (cflags & REG_NEWLINE)
+    { /* REG_NEWLINE implies neither . nor [^...] match newline.  */
+      syntax &= ~RE_DOT_NEWLINE;
+      syntax |= RE_HAT_LISTS_NOT_NEWLINE;
+      /* It also changes the matching behavior.  */
+      preg->newline_anchor = 1;
+    }
+  else
+    preg->newline_anchor = 0;
+  preg->no_sub = !!(cflags & REG_NOSUB);
+  preg->translate = NULL;
+
+  ret = re_compile_internal (preg, pattern, strlen (pattern), syntax);
+
+  /* POSIX doesn't distinguish between an unmatched open-group and an
+     unmatched close-group: both are REG_EPAREN.  */
+  if (ret == REG_ERPAREN)
+    ret = REG_EPAREN;
+
+  /* We have already checked preg->fastmap != NULL.  */
+  if (__glibc_likely (ret == REG_NOERROR))
+    /* Compute the fastmap now, since regexec cannot modify the pattern
+       buffer.  This function never fails in this implementation.  */
+    (void) re_compile_fastmap (preg);
+  else
+    {
+      /* Some error occurred while compiling the expression.  */
+      re_free (preg->fastmap);
+      preg->fastmap = NULL;
+    }
+
+  return (int) ret;
+}
+libc_hidden_def (__regcomp)
+weak_alias (__regcomp, regcomp)
+
+/* Returns a message corresponding to an error code, ERRCODE, returned
+   from either regcomp or regexec.   We don't use PREG here.  */
+
+size_t
+regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf,
+         size_t errbuf_size)
+{
+  const char *msg;
+  size_t msg_size;
+  int nerrcodes = sizeof __re_error_msgid_idx / sizeof __re_error_msgid_idx[0];
+
+  if (__glibc_unlikely (errcode < 0 || errcode >= nerrcodes))
+    /* Only error codes returned by the rest of the code should be passed
+       to this routine.  If we are given anything else, or if other regex
+       code generates an invalid error code, then the program has a bug.
+       Dump core so we can fix it.  */
+    abort ();
+
+  msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]);
+
+  msg_size = strlen (msg) + 1; /* Includes the null.  */
+
+  if (__glibc_likely (errbuf_size != 0))
+    {
+      size_t cpy_size = msg_size;
+      if (__glibc_unlikely (msg_size > errbuf_size))
+       {
+         cpy_size = errbuf_size - 1;
+         errbuf[cpy_size] = '\0';
+       }
+      memcpy (errbuf, msg, cpy_size);
+    }
+
+  return msg_size;
+}
+weak_alias (__regerror, regerror)
+
+
+/* This static array is used for the map to single-byte characters when
+   UTF-8 is used.  Otherwise we would allocate memory just to initialize
+   it the same all the time.  UTF-8 is the preferred encoding so this is
+   a worthwhile optimization.  */
+static const bitset_t utf8_sb_map =
+{
+  /* Set the first 128 bits.  */
+#if (defined __GNUC__ || __clang_major__ >= 4) && !defined __STRICT_ANSI__
+  [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
+#else
+# if 4 * BITSET_WORD_BITS < ASCII_CHARS
+#  error "bitset_word_t is narrower than 32 bits"
+# elif 3 * BITSET_WORD_BITS < ASCII_CHARS
+  BITSET_WORD_MAX, BITSET_WORD_MAX, BITSET_WORD_MAX,
+# elif 2 * BITSET_WORD_BITS < ASCII_CHARS
+  BITSET_WORD_MAX, BITSET_WORD_MAX,
+# elif 1 * BITSET_WORD_BITS < ASCII_CHARS
+  BITSET_WORD_MAX,
+# endif
+  (BITSET_WORD_MAX
+   >> (SBC_MAX % BITSET_WORD_BITS == 0
+       ? 0
+       : BITSET_WORD_BITS - SBC_MAX % BITSET_WORD_BITS))
+#endif
+};
+
+
+static void
+free_dfa_content (re_dfa_t *dfa)
+{
+  Idx i, j;
+
+  if (dfa->nodes)
+    for (i = 0; i < dfa->nodes_len; ++i)
+      free_token (dfa->nodes + i);
+  re_free (dfa->nexts);
+  for (i = 0; i < dfa->nodes_len; ++i)
+    {
+      if (dfa->eclosures != NULL)
+       re_node_set_free (dfa->eclosures + i);
+      if (dfa->inveclosures != NULL)
+       re_node_set_free (dfa->inveclosures + i);
+      if (dfa->edests != NULL)
+       re_node_set_free (dfa->edests + i);
+    }
+  re_free (dfa->edests);
+  re_free (dfa->eclosures);
+  re_free (dfa->inveclosures);
+  re_free (dfa->nodes);
+
+  if (dfa->state_table)
+    for (i = 0; i <= dfa->state_hash_mask; ++i)
+      {
+       struct re_state_table_entry *entry = dfa->state_table + i;
+       for (j = 0; j < entry->num; ++j)
+         {
+           re_dfastate_t *state = entry->array[j];
+           free_state (state);
+         }
+       re_free (entry->array);
+      }
+  re_free (dfa->state_table);
+  if (dfa->sb_char != utf8_sb_map)
+    re_free (dfa->sb_char);
+  re_free (dfa->subexp_map);
+#ifdef DEBUG
+  re_free (dfa->re_str);
+#endif
+
+  re_free (dfa);
+}
+
+
+/* Free dynamically allocated space used by PREG.  */
+
+void
+regfree (regex_t *preg)
+{
+  re_dfa_t *dfa = preg->buffer;
+  if (__glibc_likely (dfa != NULL))
+    {
+      lock_fini (dfa->lock);
+      free_dfa_content (dfa);
+    }
+  preg->buffer = NULL;
+  preg->allocated = 0;
+
+  re_free (preg->fastmap);
+  preg->fastmap = NULL;
+
+  re_free (preg->translate);
+  preg->translate = NULL;
+}
+libc_hidden_def (__regfree)
+weak_alias (__regfree, regfree)
+\f
+/* Entry points compatible with 4.2 BSD regex library.  We don't define
+   them unless specifically requested.  */
+
+#if defined _REGEX_RE_COMP || defined _LIBC
+
+/* BSD has one and only one pattern buffer.  */
+static struct re_pattern_buffer re_comp_buf;
+
+char *
+# ifdef _LIBC
+/* Make these definitions weak in libc, so POSIX programs can redefine
+   these names if they don't use our functions, and still use
+   regcomp/regexec above without link errors.  */
+weak_function
+# endif
+re_comp (const char *s)
+{
+  reg_errcode_t ret;
+  char *fastmap;
+
+  if (!s)
+    {
+      if (!re_comp_buf.buffer)
+       return gettext ("No previous regular expression");
+      return 0;
+    }
+
+  if (re_comp_buf.buffer)
+    {
+      fastmap = re_comp_buf.fastmap;
+      re_comp_buf.fastmap = NULL;
+      __regfree (&re_comp_buf);
+      memset (&re_comp_buf, '\0', sizeof (re_comp_buf));
+      re_comp_buf.fastmap = fastmap;
+    }
+
+  if (re_comp_buf.fastmap == NULL)
+    {
+      re_comp_buf.fastmap = re_malloc (char, SBC_MAX);
+      if (re_comp_buf.fastmap == NULL)
+       return (char *) gettext (__re_error_msgid
+                                + __re_error_msgid_idx[(int) REG_ESPACE]);
+    }
+
+  /* Since 're_exec' always passes NULL for the 'regs' argument, we
+     don't need to initialize the pattern buffer fields which affect it.  */
+
+  /* Match anchors at newlines.  */
+  re_comp_buf.newline_anchor = 1;
+
+  ret = re_compile_internal (&re_comp_buf, s, strlen (s), re_syntax_options);
+
+  if (!ret)
+    return NULL;
+
+  /* Yes, we're discarding 'const' here if !HAVE_LIBINTL.  */
+  return (char *) gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]);
+}
+
+#ifdef _LIBC
+libc_freeres_fn (free_mem)
+{
+  __regfree (&re_comp_buf);
+}
+#endif
+
+#endif /* _REGEX_RE_COMP */
+\f
+/* Internal entry point.
+   Compile the regular expression PATTERN, whose length is LENGTH.
+   SYNTAX indicate regular expression's syntax.  */
+
+static reg_errcode_t
+re_compile_internal (regex_t *preg, const char * pattern, size_t length,
+                    reg_syntax_t syntax)
+{
+  reg_errcode_t err = REG_NOERROR;
+  re_dfa_t *dfa;
+  re_string_t regexp;
+
+  /* Initialize the pattern buffer.  */
+  preg->fastmap_accurate = 0;
+  preg->syntax = syntax;
+  preg->not_bol = preg->not_eol = 0;
+  preg->used = 0;
+  preg->re_nsub = 0;
+  preg->can_be_null = 0;
+  preg->regs_allocated = REGS_UNALLOCATED;
+
+  /* Initialize the dfa.  */
+  dfa = preg->buffer;
+  if (__glibc_unlikely (preg->allocated < sizeof (re_dfa_t)))
+    {
+      /* If zero allocated, but buffer is non-null, try to realloc
+        enough space.  This loses if buffer's address is bogus, but
+        that is the user's responsibility.  If ->buffer is NULL this
+        is a simple allocation.  */
+      dfa = re_realloc (preg->buffer, re_dfa_t, 1);
+      if (dfa == NULL)
+       return REG_ESPACE;
+      preg->allocated = sizeof (re_dfa_t);
+      preg->buffer = dfa;
+    }
+  preg->used = sizeof (re_dfa_t);
+
+  err = init_dfa (dfa, length);
+  if (__glibc_unlikely (err == REG_NOERROR && lock_init (dfa->lock) != 0))
+    err = REG_ESPACE;
+  if (__glibc_unlikely (err != REG_NOERROR))
+    {
+      free_dfa_content (dfa);
+      preg->buffer = NULL;
+      preg->allocated = 0;
+      return err;
+    }
+#ifdef DEBUG
+  /* Note: length+1 will not overflow since it is checked in init_dfa.  */
+  dfa->re_str = re_malloc (char, length + 1);
+  strncpy (dfa->re_str, pattern, length + 1);
+#endif
+
+  err = re_string_construct (&regexp, pattern, length, preg->translate,
+                            (syntax & RE_ICASE) != 0, dfa);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    {
+    re_compile_internal_free_return:
+      free_workarea_compile (preg);
+      re_string_destruct (&regexp);
+      lock_fini (dfa->lock);
+      free_dfa_content (dfa);
+      preg->buffer = NULL;
+      preg->allocated = 0;
+      return err;
+    }
+
+  /* Parse the regular expression, and build a structure tree.  */
+  preg->re_nsub = 0;
+  dfa->str_tree = parse (&regexp, preg, syntax, &err);
+  if (__glibc_unlikely (dfa->str_tree == NULL))
+    goto re_compile_internal_free_return;
+
+  /* Analyze the tree and create the nfa.  */
+  err = analyze (preg);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    goto re_compile_internal_free_return;
+
+  /* If possible, do searching in single byte encoding to speed things up.  */
+  if (dfa->is_utf8 && !(syntax & RE_ICASE) && preg->translate == NULL)
+    optimize_utf8 (dfa);
+
+  /* Then create the initial state of the dfa.  */
+  err = create_initial_state (dfa);
+
+  /* Release work areas.  */
+  free_workarea_compile (preg);
+  re_string_destruct (&regexp);
+
+  if (__glibc_unlikely (err != REG_NOERROR))
+    {
+      lock_fini (dfa->lock);
+      free_dfa_content (dfa);
+      preg->buffer = NULL;
+      preg->allocated = 0;
+    }
+
+  return err;
+}
+
+/* Initialize DFA.  We use the length of the regular expression PAT_LEN
+   as the initial length of some arrays.  */
+
+static reg_errcode_t
+init_dfa (re_dfa_t *dfa, size_t pat_len)
+{
+  __re_size_t table_size;
+#ifndef _LIBC
+  const char *codeset_name;
+#endif
+  size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t));
+  size_t max_object_size =
+    MAX (sizeof (struct re_state_table_entry),
+        MAX (sizeof (re_token_t),
+             MAX (sizeof (re_node_set),
+                  MAX (sizeof (regmatch_t),
+                       max_i18n_object_size))));
+
+  memset (dfa, '\0', sizeof (re_dfa_t));
+
+  /* Force allocation of str_tree_storage the first time.  */
+  dfa->str_tree_storage_idx = BIN_TREE_STORAGE_SIZE;
+
+  /* Avoid overflows.  The extra "/ 2" is for the table_size doubling
+     calculation below, and for similar doubling calculations
+     elsewhere.  And it's <= rather than <, because some of the
+     doubling calculations add 1 afterwards.  */
+  if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / max_object_size) / 2
+                       <= pat_len))
+    return REG_ESPACE;
+
+  dfa->nodes_alloc = pat_len + 1;
+  dfa->nodes = re_malloc (re_token_t, dfa->nodes_alloc);
+
+  /*  table_size = 2 ^ ceil(log pat_len) */
+  for (table_size = 1; ; table_size <<= 1)
+    if (table_size > pat_len)
+      break;
+
+  dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size);
+  dfa->state_hash_mask = table_size - 1;
+
+  dfa->mb_cur_max = MB_CUR_MAX;
+#ifdef _LIBC
+  if (dfa->mb_cur_max == 6
+      && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
+    dfa->is_utf8 = 1;
+  dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
+                      != 0);
+#else
+  codeset_name = nl_langinfo (CODESET);
+  if ((codeset_name[0] == 'U' || codeset_name[0] == 'u')
+      && (codeset_name[1] == 'T' || codeset_name[1] == 't')
+      && (codeset_name[2] == 'F' || codeset_name[2] == 'f')
+      && strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0)
+    dfa->is_utf8 = 1;
+
+  /* We check exhaustively in the loop below if this charset is a
+     superset of ASCII.  */
+  dfa->map_notascii = 0;
+#endif
+
+  if (dfa->mb_cur_max > 1)
+    {
+      if (dfa->is_utf8)
+       dfa->sb_char = (re_bitset_ptr_t) utf8_sb_map;
+      else
+       {
+         int i, j, ch;
+
+         dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
+         if (__glibc_unlikely (dfa->sb_char == NULL))
+           return REG_ESPACE;
+
+         /* Set the bits corresponding to single byte chars.  */
+         for (i = 0, ch = 0; i < BITSET_WORDS; ++i)
+           for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
+             {
+               wint_t wch = __btowc (ch);
+               if (wch != WEOF)
+                 dfa->sb_char[i] |= (bitset_word_t) 1 << j;
+#ifndef _LIBC
+               if (isascii (ch) && wch != ch)
+                 dfa->map_notascii = 1;
+#endif
+             }
+       }
+    }
+
+  if (__glibc_unlikely (dfa->nodes == NULL || dfa->state_table == NULL))
+    return REG_ESPACE;
+  return REG_NOERROR;
+}
+
+/* Initialize WORD_CHAR table, which indicate which character is
+   "word".  In this case "word" means that it is the word construction
+   character used by some operators like "\<", "\>", etc.  */
+
+static void
+init_word_char (re_dfa_t *dfa)
+{
+  int i = 0;
+  int j;
+  int ch = 0;
+  dfa->word_ops_used = 1;
+  if (__glibc_likely (dfa->map_notascii == 0))
+    {
+      bitset_word_t bits0 = 0x00000000;
+      bitset_word_t bits1 = 0x03ff0000;
+      bitset_word_t bits2 = 0x87fffffe;
+      bitset_word_t bits3 = 0x07fffffe;
+      if (BITSET_WORD_BITS == 64)
+       {
+         /* Pacify gcc -Woverflow on 32-bit platforms.  */
+         dfa->word_char[0] = bits1 << 31 << 1 | bits0;
+         dfa->word_char[1] = bits3 << 31 << 1 | bits2;
+         i = 2;
+       }
+      else if (BITSET_WORD_BITS == 32)
+       {
+         dfa->word_char[0] = bits0;
+         dfa->word_char[1] = bits1;
+         dfa->word_char[2] = bits2;
+         dfa->word_char[3] = bits3;
+         i = 4;
+       }
+      else
+        goto general_case;
+      ch = 128;
+
+      if (__glibc_likely (dfa->is_utf8))
+       {
+         memset (&dfa->word_char[i], '\0', (SBC_MAX - ch) / 8);
+         return;
+       }
+    }
+
+ general_case:
+  for (; i < BITSET_WORDS; ++i)
+    for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
+      if (isalnum (ch) || ch == '_')
+       dfa->word_char[i] |= (bitset_word_t) 1 << j;
+}
+
+/* Free the work area which are only used while compiling.  */
+
+static void
+free_workarea_compile (regex_t *preg)
+{
+  re_dfa_t *dfa = preg->buffer;
+  bin_tree_storage_t *storage, *next;
+  for (storage = dfa->str_tree_storage; storage; storage = next)
+    {
+      next = storage->next;
+      re_free (storage);
+    }
+  dfa->str_tree_storage = NULL;
+  dfa->str_tree_storage_idx = BIN_TREE_STORAGE_SIZE;
+  dfa->str_tree = NULL;
+  re_free (dfa->org_indices);
+  dfa->org_indices = NULL;
+}
+
+/* Create initial states for all contexts.  */
+
+static reg_errcode_t
+create_initial_state (re_dfa_t *dfa)
+{
+  Idx first, i;
+  reg_errcode_t err;
+  re_node_set init_nodes;
+
+  /* Initial states have the epsilon closure of the node which is
+     the first node of the regular expression.  */
+  first = dfa->str_tree->first->node_idx;
+  dfa->init_node = first;
+  err = re_node_set_init_copy (&init_nodes, dfa->eclosures + first);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    return err;
+
+  /* The back-references which are in initial states can epsilon transit,
+     since in this case all of the subexpressions can be null.
+     Then we add epsilon closures of the nodes which are the next nodes of
+     the back-references.  */
+  if (dfa->nbackref > 0)
+    for (i = 0; i < init_nodes.nelem; ++i)
+      {
+       Idx node_idx = init_nodes.elems[i];
+       re_token_type_t type = dfa->nodes[node_idx].type;
+
+       Idx clexp_idx;
+       if (type != OP_BACK_REF)
+         continue;
+       for (clexp_idx = 0; clexp_idx < init_nodes.nelem; ++clexp_idx)
+         {
+           re_token_t *clexp_node;
+           clexp_node = dfa->nodes + init_nodes.elems[clexp_idx];
+           if (clexp_node->type == OP_CLOSE_SUBEXP
+               && clexp_node->opr.idx == dfa->nodes[node_idx].opr.idx)
+             break;
+         }
+       if (clexp_idx == init_nodes.nelem)
+         continue;
+
+       if (type == OP_BACK_REF)
+         {
+           Idx dest_idx = dfa->edests[node_idx].elems[0];
+           if (!re_node_set_contains (&init_nodes, dest_idx))
+             {
+               reg_errcode_t merge_err
+                  = re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx);
+               if (merge_err != REG_NOERROR)
+                 return merge_err;
+               i = 0;
+             }
+         }
+      }
+
+  /* It must be the first time to invoke acquire_state.  */
+  dfa->init_state = re_acquire_state_context (&err, dfa, &init_nodes, 0);
+  /* We don't check ERR here, since the initial state must not be NULL.  */
+  if (__glibc_unlikely (dfa->init_state == NULL))
+    return err;
+  if (dfa->init_state->has_constraint)
+    {
+      dfa->init_state_word = re_acquire_state_context (&err, dfa, &init_nodes,
+                                                      CONTEXT_WORD);
+      dfa->init_state_nl = re_acquire_state_context (&err, dfa, &init_nodes,
+                                                    CONTEXT_NEWLINE);
+      dfa->init_state_begbuf = re_acquire_state_context (&err, dfa,
+                                                        &init_nodes,
+                                                        CONTEXT_NEWLINE
+                                                        | CONTEXT_BEGBUF);
+      if (__glibc_unlikely (dfa->init_state_word == NULL
+                           || dfa->init_state_nl == NULL
+                           || dfa->init_state_begbuf == NULL))
+       return err;
+    }
+  else
+    dfa->init_state_word = dfa->init_state_nl
+      = dfa->init_state_begbuf = dfa->init_state;
+
+  re_node_set_free (&init_nodes);
+  return REG_NOERROR;
+}
+\f
+/* If it is possible to do searching in single byte encoding instead of UTF-8
+   to speed things up, set dfa->mb_cur_max to 1, clear is_utf8 and change
+   DFA nodes where needed.  */
+
+static void
+optimize_utf8 (re_dfa_t *dfa)
+{
+  Idx node;
+  int i;
+  bool mb_chars = false;
+  bool has_period = false;
+
+  for (node = 0; node < dfa->nodes_len; ++node)
+    switch (dfa->nodes[node].type)
+      {
+      case CHARACTER:
+       if (dfa->nodes[node].opr.c >= ASCII_CHARS)
+         mb_chars = true;
+       break;
+      case ANCHOR:
+       switch (dfa->nodes[node].opr.ctx_type)
+         {
+         case LINE_FIRST:
+         case LINE_LAST:
+         case BUF_FIRST:
+         case BUF_LAST:
+           break;
+         default:
+           /* Word anchors etc. cannot be handled.  It's okay to test
+              opr.ctx_type since constraints (for all DFA nodes) are
+              created by ORing one or more opr.ctx_type values.  */
+           return;
+         }
+       break;
+      case OP_PERIOD:
+       has_period = true;
+       break;
+      case OP_BACK_REF:
+      case OP_ALT:
+      case END_OF_RE:
+      case OP_DUP_ASTERISK:
+      case OP_OPEN_SUBEXP:
+      case OP_CLOSE_SUBEXP:
+       break;
+      case COMPLEX_BRACKET:
+       return;
+      case SIMPLE_BRACKET:
+       /* Just double check.  */
+       {
+         int rshift = (ASCII_CHARS % BITSET_WORD_BITS == 0
+                       ? 0
+                       : BITSET_WORD_BITS - ASCII_CHARS % BITSET_WORD_BITS);
+         for (i = ASCII_CHARS / BITSET_WORD_BITS; i < BITSET_WORDS; ++i)
+           {
+             if (dfa->nodes[node].opr.sbcset[i] >> rshift != 0)
+               return;
+             rshift = 0;
+           }
+       }
+       break;
+      default:
+       abort ();
+      }
+
+  if (mb_chars || has_period)
+    for (node = 0; node < dfa->nodes_len; ++node)
+      {
+       if (dfa->nodes[node].type == CHARACTER
+           && dfa->nodes[node].opr.c >= ASCII_CHARS)
+         dfa->nodes[node].mb_partial = 0;
+       else if (dfa->nodes[node].type == OP_PERIOD)
+         dfa->nodes[node].type = OP_UTF8_PERIOD;
+      }
+
+  /* The search can be in single byte locale.  */
+  dfa->mb_cur_max = 1;
+  dfa->is_utf8 = 0;
+  dfa->has_mb_node = dfa->nbackref > 0 || has_period;
+}
+\f
+/* Analyze the structure tree, and calculate "first", "next", "edest",
+   "eclosure", and "inveclosure".  */
+
+static reg_errcode_t
+analyze (regex_t *preg)
+{
+  re_dfa_t *dfa = preg->buffer;
+  reg_errcode_t ret;
+
+  /* Allocate arrays.  */
+  dfa->nexts = re_malloc (Idx, dfa->nodes_alloc);
+  dfa->org_indices = re_malloc (Idx, dfa->nodes_alloc);
+  dfa->edests = re_malloc (re_node_set, dfa->nodes_alloc);
+  dfa->eclosures = re_malloc (re_node_set, dfa->nodes_alloc);
+  if (__glibc_unlikely (dfa->nexts == NULL || dfa->org_indices == NULL
+                       || dfa->edests == NULL || dfa->eclosures == NULL))
+    return REG_ESPACE;
+
+  dfa->subexp_map = re_malloc (Idx, preg->re_nsub);
+  if (dfa->subexp_map != NULL)
+    {
+      Idx i;
+      for (i = 0; i < preg->re_nsub; i++)
+       dfa->subexp_map[i] = i;
+      preorder (dfa->str_tree, optimize_subexps, dfa);
+      for (i = 0; i < preg->re_nsub; i++)
+       if (dfa->subexp_map[i] != i)
+         break;
+      if (i == preg->re_nsub)
+       {
+         re_free (dfa->subexp_map);
+         dfa->subexp_map = NULL;
+       }
+    }
+
+  ret = postorder (dfa->str_tree, lower_subexps, preg);
+  if (__glibc_unlikely (ret != REG_NOERROR))
+    return ret;
+  ret = postorder (dfa->str_tree, calc_first, dfa);
+  if (__glibc_unlikely (ret != REG_NOERROR))
+    return ret;
+  preorder (dfa->str_tree, calc_next, dfa);
+  ret = preorder (dfa->str_tree, link_nfa_nodes, dfa);
+  if (__glibc_unlikely (ret != REG_NOERROR))
+    return ret;
+  ret = calc_eclosure (dfa);
+  if (__glibc_unlikely (ret != REG_NOERROR))
+    return ret;
+
+  /* We only need this during the prune_impossible_nodes pass in regexec.c;
+     skip it if p_i_n will not run, as calc_inveclosure can be quadratic.  */
+  if ((!preg->no_sub && preg->re_nsub > 0 && dfa->has_plural_match)
+      || dfa->nbackref)
+    {
+      dfa->inveclosures = re_malloc (re_node_set, dfa->nodes_len);
+      if (__glibc_unlikely (dfa->inveclosures == NULL))
+       return REG_ESPACE;
+      ret = calc_inveclosure (dfa);
+    }
+
+  return ret;
+}
+
+/* Our parse trees are very unbalanced, so we cannot use a stack to
+   implement parse tree visits.  Instead, we use parent pointers and
+   some hairy code in these two functions.  */
+static reg_errcode_t
+postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
+          void *extra)
+{
+  bin_tree_t *node, *prev;
+
+  for (node = root; ; )
+    {
+      /* Descend down the tree, preferably to the left (or to the right
+        if that's the only child).  */
+      while (node->left || node->right)
+       if (node->left)
+         node = node->left;
+       else
+         node = node->right;
+
+      do
+       {
+         reg_errcode_t err = fn (extra, node);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+         if (node->parent == NULL)
+           return REG_NOERROR;
+         prev = node;
+         node = node->parent;
+       }
+      /* Go up while we have a node that is reached from the right.  */
+      while (node->right == prev || node->right == NULL);
+      node = node->right;
+    }
+}
+
+static reg_errcode_t
+preorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
+         void *extra)
+{
+  bin_tree_t *node;
+
+  for (node = root; ; )
+    {
+      reg_errcode_t err = fn (extra, node);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       return err;
+
+      /* Go to the left node, or up and to the right.  */
+      if (node->left)
+       node = node->left;
+      else
+       {
+         bin_tree_t *prev = NULL;
+         while (node->right == prev || node->right == NULL)
+           {
+             prev = node;
+             node = node->parent;
+             if (!node)
+               return REG_NOERROR;
+           }
+         node = node->right;
+       }
+    }
+}
+
+/* Optimization pass: if a SUBEXP is entirely contained, strip it and tell
+   re_search_internal to map the inner one's opr.idx to this one's.  Adjust
+   backreferences as well.  Requires a preorder visit.  */
+static reg_errcode_t
+optimize_subexps (void *extra, bin_tree_t *node)
+{
+  re_dfa_t *dfa = (re_dfa_t *) extra;
+
+  if (node->token.type == OP_BACK_REF && dfa->subexp_map)
+    {
+      int idx = node->token.opr.idx;
+      node->token.opr.idx = dfa->subexp_map[idx];
+      dfa->used_bkref_map |= 1 << node->token.opr.idx;
+    }
+
+  else if (node->token.type == SUBEXP
+          && node->left && node->left->token.type == SUBEXP)
+    {
+      Idx other_idx = node->left->token.opr.idx;
+
+      node->left = node->left->left;
+      if (node->left)
+       node->left->parent = node;
+
+      dfa->subexp_map[other_idx] = dfa->subexp_map[node->token.opr.idx];
+      if (other_idx < BITSET_WORD_BITS)
+       dfa->used_bkref_map &= ~((bitset_word_t) 1 << other_idx);
+    }
+
+  return REG_NOERROR;
+}
+
+/* Lowering pass: Turn each SUBEXP node into the appropriate concatenation
+   of OP_OPEN_SUBEXP, the body of the SUBEXP (if any) and OP_CLOSE_SUBEXP.  */
+static reg_errcode_t
+lower_subexps (void *extra, bin_tree_t *node)
+{
+  regex_t *preg = (regex_t *) extra;
+  reg_errcode_t err = REG_NOERROR;
+
+  if (node->left && node->left->token.type == SUBEXP)
+    {
+      node->left = lower_subexp (&err, preg, node->left);
+      if (node->left)
+       node->left->parent = node;
+    }
+  if (node->right && node->right->token.type == SUBEXP)
+    {
+      node->right = lower_subexp (&err, preg, node->right);
+      if (node->right)
+       node->right->parent = node;
+    }
+
+  return err;
+}
+
+static bin_tree_t *
+lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node)
+{
+  re_dfa_t *dfa = preg->buffer;
+  bin_tree_t *body = node->left;
+  bin_tree_t *op, *cls, *tree1, *tree;
+
+  if (preg->no_sub
+      /* We do not optimize empty subexpressions, because otherwise we may
+        have bad CONCAT nodes with NULL children.  This is obviously not
+        very common, so we do not lose much.  An example that triggers
+        this case is the sed "script" /\(\)/x.  */
+      && node->left != NULL
+      && (node->token.opr.idx >= BITSET_WORD_BITS
+         || !(dfa->used_bkref_map
+              & ((bitset_word_t) 1 << node->token.opr.idx))))
+    return node->left;
+
+  /* Convert the SUBEXP node to the concatenation of an
+     OP_OPEN_SUBEXP, the contents, and an OP_CLOSE_SUBEXP.  */
+  op = create_tree (dfa, NULL, NULL, OP_OPEN_SUBEXP);
+  cls = create_tree (dfa, NULL, NULL, OP_CLOSE_SUBEXP);
+  tree1 = body ? create_tree (dfa, body, cls, CONCAT) : cls;
+  tree = create_tree (dfa, op, tree1, CONCAT);
+  if (__glibc_unlikely (tree == NULL || tree1 == NULL
+                       || op == NULL || cls == NULL))
+    {
+      *err = REG_ESPACE;
+      return NULL;
+    }
+
+  op->token.opr.idx = cls->token.opr.idx = node->token.opr.idx;
+  op->token.opt_subexp = cls->token.opt_subexp = node->token.opt_subexp;
+  return tree;
+}
+
+/* Pass 1 in building the NFA: compute FIRST and create unlinked automaton
+   nodes.  Requires a postorder visit.  */
+static reg_errcode_t
+calc_first (void *extra, bin_tree_t *node)
+{
+  re_dfa_t *dfa = (re_dfa_t *) extra;
+  if (node->token.type == CONCAT)
+    {
+      node->first = node->left->first;
+      node->node_idx = node->left->node_idx;
+    }
+  else
+    {
+      node->first = node;
+      node->node_idx = re_dfa_add_node (dfa, node->token);
+      if (__glibc_unlikely (node->node_idx == -1))
+       return REG_ESPACE;
+      if (node->token.type == ANCHOR)
+       dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type;
+    }
+  return REG_NOERROR;
+}
+
+/* Pass 2: compute NEXT on the tree.  Preorder visit.  */
+static reg_errcode_t
+calc_next (void *extra, bin_tree_t *node)
+{
+  switch (node->token.type)
+    {
+    case OP_DUP_ASTERISK:
+      node->left->next = node;
+      break;
+    case CONCAT:
+      node->left->next = node->right->first;
+      node->right->next = node->next;
+      break;
+    default:
+      if (node->left)
+       node->left->next = node->next;
+      if (node->right)
+       node->right->next = node->next;
+      break;
+    }
+  return REG_NOERROR;
+}
+
+/* Pass 3: link all DFA nodes to their NEXT node (any order will do).  */
+static reg_errcode_t
+link_nfa_nodes (void *extra, bin_tree_t *node)
+{
+  re_dfa_t *dfa = (re_dfa_t *) extra;
+  Idx idx = node->node_idx;
+  reg_errcode_t err = REG_NOERROR;
+
+  switch (node->token.type)
+    {
+    case CONCAT:
+      break;
+
+    case END_OF_RE:
+      DEBUG_ASSERT (node->next == NULL);
+      break;
+
+    case OP_DUP_ASTERISK:
+    case OP_ALT:
+      {
+       Idx left, right;
+       dfa->has_plural_match = 1;
+       if (node->left != NULL)
+         left = node->left->first->node_idx;
+       else
+         left = node->next->node_idx;
+       if (node->right != NULL)
+         right = node->right->first->node_idx;
+       else
+         right = node->next->node_idx;
+       DEBUG_ASSERT (left > -1);
+       DEBUG_ASSERT (right > -1);
+       err = re_node_set_init_2 (dfa->edests + idx, left, right);
+      }
+      break;
+
+    case ANCHOR:
+    case OP_OPEN_SUBEXP:
+    case OP_CLOSE_SUBEXP:
+      err = re_node_set_init_1 (dfa->edests + idx, node->next->node_idx);
+      break;
+
+    case OP_BACK_REF:
+      dfa->nexts[idx] = node->next->node_idx;
+      if (node->token.type == OP_BACK_REF)
+       err = re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]);
+      break;
+
+    default:
+      DEBUG_ASSERT (!IS_EPSILON_NODE (node->token.type));
+      dfa->nexts[idx] = node->next->node_idx;
+      break;
+    }
+
+  return err;
+}
+
+/* Duplicate the epsilon closure of the node ROOT_NODE.
+   Note that duplicated nodes have constraint INIT_CONSTRAINT in addition
+   to their own constraint.  */
+
+static reg_errcode_t
+duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node,
+                       Idx root_node, unsigned int init_constraint)
+{
+  Idx org_node, clone_node;
+  bool ok;
+  unsigned int constraint = init_constraint;
+  for (org_node = top_org_node, clone_node = top_clone_node;;)
+    {
+      Idx org_dest, clone_dest;
+      if (dfa->nodes[org_node].type == OP_BACK_REF)
+       {
+         /* If the back reference epsilon-transit, its destination must
+            also have the constraint.  Then duplicate the epsilon closure
+            of the destination of the back reference, and store it in
+            edests of the back reference.  */
+         org_dest = dfa->nexts[org_node];
+         re_node_set_empty (dfa->edests + clone_node);
+         clone_dest = duplicate_node (dfa, org_dest, constraint);
+         if (__glibc_unlikely (clone_dest == -1))
+           return REG_ESPACE;
+         dfa->nexts[clone_node] = dfa->nexts[org_node];
+         ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
+         if (__glibc_unlikely (! ok))
+           return REG_ESPACE;
+       }
+      else if (dfa->edests[org_node].nelem == 0)
+       {
+         /* In case of the node can't epsilon-transit, don't duplicate the
+            destination and store the original destination as the
+            destination of the node.  */
+         dfa->nexts[clone_node] = dfa->nexts[org_node];
+         break;
+       }
+      else if (dfa->edests[org_node].nelem == 1)
+       {
+         /* In case of the node can epsilon-transit, and it has only one
+            destination.  */
+         org_dest = dfa->edests[org_node].elems[0];
+         re_node_set_empty (dfa->edests + clone_node);
+         /* If the node is root_node itself, it means the epsilon closure
+            has a loop.  Then tie it to the destination of the root_node.  */
+         if (org_node == root_node && clone_node != org_node)
+           {
+             ok = re_node_set_insert (dfa->edests + clone_node, org_dest);
+             if (__glibc_unlikely (! ok))
+               return REG_ESPACE;
+             break;
+           }
+         /* In case the node has another constraint, append it.  */
+         constraint |= dfa->nodes[org_node].constraint;
+         clone_dest = duplicate_node (dfa, org_dest, constraint);
+         if (__glibc_unlikely (clone_dest == -1))
+           return REG_ESPACE;
+         ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
+         if (__glibc_unlikely (! ok))
+           return REG_ESPACE;
+       }
+      else /* dfa->edests[org_node].nelem == 2 */
+       {
+         /* In case of the node can epsilon-transit, and it has two
+            destinations. In the bin_tree_t and DFA, that's '|' and '*'.   */
+         org_dest = dfa->edests[org_node].elems[0];
+         re_node_set_empty (dfa->edests + clone_node);
+         /* Search for a duplicated node which satisfies the constraint.  */
+         clone_dest = search_duplicated_node (dfa, org_dest, constraint);
+         if (clone_dest == -1)
+           {
+             /* There is no such duplicated node, create a new one.  */
+             reg_errcode_t err;
+             clone_dest = duplicate_node (dfa, org_dest, constraint);
+             if (__glibc_unlikely (clone_dest == -1))
+               return REG_ESPACE;
+             ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
+             if (__glibc_unlikely (! ok))
+               return REG_ESPACE;
+             err = duplicate_node_closure (dfa, org_dest, clone_dest,
+                                           root_node, constraint);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               return err;
+           }
+         else
+           {
+             /* There is a duplicated node which satisfies the constraint,
+                use it to avoid infinite loop.  */
+             ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
+             if (__glibc_unlikely (! ok))
+               return REG_ESPACE;
+           }
+
+         org_dest = dfa->edests[org_node].elems[1];
+         clone_dest = duplicate_node (dfa, org_dest, constraint);
+         if (__glibc_unlikely (clone_dest == -1))
+           return REG_ESPACE;
+         ok = re_node_set_insert (dfa->edests + clone_node, clone_dest);
+         if (__glibc_unlikely (! ok))
+           return REG_ESPACE;
+       }
+      org_node = org_dest;
+      clone_node = clone_dest;
+    }
+  return REG_NOERROR;
+}
+
+/* Search for a node which is duplicated from the node ORG_NODE, and
+   satisfies the constraint CONSTRAINT.  */
+
+static Idx
+search_duplicated_node (const re_dfa_t *dfa, Idx org_node,
+                       unsigned int constraint)
+{
+  Idx idx;
+  for (idx = dfa->nodes_len - 1; dfa->nodes[idx].duplicated && idx > 0; --idx)
+    {
+      if (org_node == dfa->org_indices[idx]
+         && constraint == dfa->nodes[idx].constraint)
+       return idx; /* Found.  */
+    }
+  return -1; /* Not found.  */
+}
+
+/* Duplicate the node whose index is ORG_IDX and set the constraint CONSTRAINT.
+   Return the index of the new node, or -1 if insufficient storage is
+   available.  */
+
+static Idx
+duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint)
+{
+  Idx dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx]);
+  if (__glibc_likely (dup_idx != -1))
+    {
+      dfa->nodes[dup_idx].constraint = constraint;
+      dfa->nodes[dup_idx].constraint |= dfa->nodes[org_idx].constraint;
+      dfa->nodes[dup_idx].duplicated = 1;
+
+      /* Store the index of the original node.  */
+      dfa->org_indices[dup_idx] = org_idx;
+    }
+  return dup_idx;
+}
+
+static reg_errcode_t
+calc_inveclosure (re_dfa_t *dfa)
+{
+  Idx src, idx;
+  bool ok;
+  for (idx = 0; idx < dfa->nodes_len; ++idx)
+    re_node_set_init_empty (dfa->inveclosures + idx);
+
+  for (src = 0; src < dfa->nodes_len; ++src)
+    {
+      Idx *elems = dfa->eclosures[src].elems;
+      for (idx = 0; idx < dfa->eclosures[src].nelem; ++idx)
+       {
+         ok = re_node_set_insert_last (dfa->inveclosures + elems[idx], src);
+         if (__glibc_unlikely (! ok))
+           return REG_ESPACE;
+       }
+    }
+
+  return REG_NOERROR;
+}
+
+/* Calculate "eclosure" for all the node in DFA.  */
+
+static reg_errcode_t
+calc_eclosure (re_dfa_t *dfa)
+{
+  Idx node_idx;
+  bool incomplete;
+  DEBUG_ASSERT (dfa->nodes_len > 0);
+  incomplete = false;
+  /* For each nodes, calculate epsilon closure.  */
+  for (node_idx = 0; ; ++node_idx)
+    {
+      reg_errcode_t err;
+      re_node_set eclosure_elem;
+      if (node_idx == dfa->nodes_len)
+       {
+         if (!incomplete)
+           break;
+         incomplete = false;
+         node_idx = 0;
+       }
+
+      DEBUG_ASSERT (dfa->eclosures[node_idx].nelem != -1);
+
+      /* If we have already calculated, skip it.  */
+      if (dfa->eclosures[node_idx].nelem != 0)
+       continue;
+      /* Calculate epsilon closure of 'node_idx'.  */
+      err = calc_eclosure_iter (&eclosure_elem, dfa, node_idx, true);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       return err;
+
+      if (dfa->eclosures[node_idx].nelem == 0)
+       {
+         incomplete = true;
+         re_node_set_free (&eclosure_elem);
+       }
+    }
+  return REG_NOERROR;
+}
+
+/* Calculate epsilon closure of NODE.  */
+
+static reg_errcode_t
+calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
+{
+  reg_errcode_t err;
+  Idx i;
+  re_node_set eclosure;
+  bool incomplete = false;
+  err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    return err;
+
+  /* An epsilon closure includes itself.  */
+  eclosure.elems[eclosure.nelem++] = node;
+
+  /* This indicates that we are calculating this node now.
+     We reference this value to avoid infinite loop.  */
+  dfa->eclosures[node].nelem = -1;
+
+  /* If the current node has constraints, duplicate all nodes
+     since they must inherit the constraints.  */
+  if (dfa->nodes[node].constraint
+      && dfa->edests[node].nelem
+      && !dfa->nodes[dfa->edests[node].elems[0]].duplicated)
+    {
+      err = duplicate_node_closure (dfa, node, node, node,
+                                   dfa->nodes[node].constraint);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       return err;
+    }
+
+  /* Expand each epsilon destination nodes.  */
+  if (IS_EPSILON_NODE(dfa->nodes[node].type))
+    for (i = 0; i < dfa->edests[node].nelem; ++i)
+      {
+       re_node_set eclosure_elem;
+       Idx edest = dfa->edests[node].elems[i];
+       /* If calculating the epsilon closure of 'edest' is in progress,
+          return intermediate result.  */
+       if (dfa->eclosures[edest].nelem == -1)
+         {
+           incomplete = true;
+           continue;
+         }
+       /* If we haven't calculated the epsilon closure of 'edest' yet,
+          calculate now. Otherwise use calculated epsilon closure.  */
+       if (dfa->eclosures[edest].nelem == 0)
+         {
+           err = calc_eclosure_iter (&eclosure_elem, dfa, edest, false);
+           if (__glibc_unlikely (err != REG_NOERROR))
+             return err;
+         }
+       else
+         eclosure_elem = dfa->eclosures[edest];
+       /* Merge the epsilon closure of 'edest'.  */
+       err = re_node_set_merge (&eclosure, &eclosure_elem);
+       if (__glibc_unlikely (err != REG_NOERROR))
+         return err;
+       /* If the epsilon closure of 'edest' is incomplete,
+          the epsilon closure of this node is also incomplete.  */
+       if (dfa->eclosures[edest].nelem == 0)
+         {
+           incomplete = true;
+           re_node_set_free (&eclosure_elem);
+         }
+      }
+
+  if (incomplete && !root)
+    dfa->eclosures[node].nelem = 0;
+  else
+    dfa->eclosures[node] = eclosure;
+  *new_set = eclosure;
+  return REG_NOERROR;
+}
+\f
+/* Functions for token which are used in the parser.  */
+
+/* Fetch a token from INPUT.
+   We must not use this function inside bracket expressions.  */
+
+static void
+fetch_token (re_token_t *result, re_string_t *input, reg_syntax_t syntax)
+{
+  re_string_skip_bytes (input, peek_token (result, input, syntax));
+}
+
+/* Peek a token from INPUT, and return the length of the token.
+   We must not use this function inside bracket expressions.  */
+
+static int
+peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
+{
+  unsigned char c;
+
+  if (re_string_eoi (input))
+    {
+      token->type = END_OF_RE;
+      return 0;
+    }
+
+  c = re_string_peek_byte (input, 0);
+  token->opr.c = c;
+
+  token->word_char = 0;
+  token->mb_partial = 0;
+  if (input->mb_cur_max > 1
+      && !re_string_first_byte (input, re_string_cur_idx (input)))
+    {
+      token->type = CHARACTER;
+      token->mb_partial = 1;
+      return 1;
+    }
+  if (c == '\\')
+    {
+      unsigned char c2;
+      if (re_string_cur_idx (input) + 1 >= re_string_length (input))
+       {
+         token->type = BACK_SLASH;
+         return 1;
+       }
+
+      c2 = re_string_peek_byte_case (input, 1);
+      token->opr.c = c2;
+      token->type = CHARACTER;
+      if (input->mb_cur_max > 1)
+       {
+         wint_t wc = re_string_wchar_at (input,
+                                         re_string_cur_idx (input) + 1);
+         token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
+       }
+      else
+       token->word_char = IS_WORD_CHAR (c2) != 0;
+
+      switch (c2)
+       {
+       case '|':
+         if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_NO_BK_VBAR))
+           token->type = OP_ALT;
+         break;
+       case '1': case '2': case '3': case '4': case '5':
+       case '6': case '7': case '8': case '9':
+         if (!(syntax & RE_NO_BK_REFS))
+           {
+             token->type = OP_BACK_REF;
+             token->opr.idx = c2 - '1';
+           }
+         break;
+       case '<':
+         if (!(syntax & RE_NO_GNU_OPS))
+           {
+             token->type = ANCHOR;
+             token->opr.ctx_type = WORD_FIRST;
+           }
+         break;
+       case '>':
+         if (!(syntax & RE_NO_GNU_OPS))
+           {
+             token->type = ANCHOR;
+             token->opr.ctx_type = WORD_LAST;
+           }
+         break;
+       case 'b':
+         if (!(syntax & RE_NO_GNU_OPS))
+           {
+             token->type = ANCHOR;
+             token->opr.ctx_type = WORD_DELIM;
+           }
+         break;
+       case 'B':
+         if (!(syntax & RE_NO_GNU_OPS))
+           {
+             token->type = ANCHOR;
+             token->opr.ctx_type = NOT_WORD_DELIM;
+           }
+         break;
+       case 'w':
+         if (!(syntax & RE_NO_GNU_OPS))
+           token->type = OP_WORD;
+         break;
+       case 'W':
+         if (!(syntax & RE_NO_GNU_OPS))
+           token->type = OP_NOTWORD;
+         break;
+       case 's':
+         if (!(syntax & RE_NO_GNU_OPS))
+           token->type = OP_SPACE;
+         break;
+       case 'S':
+         if (!(syntax & RE_NO_GNU_OPS))
+           token->type = OP_NOTSPACE;
+         break;
+       case '`':
+         if (!(syntax & RE_NO_GNU_OPS))
+           {
+             token->type = ANCHOR;
+             token->opr.ctx_type = BUF_FIRST;
+           }
+         break;
+       case '\'':
+         if (!(syntax & RE_NO_GNU_OPS))
+           {
+             token->type = ANCHOR;
+             token->opr.ctx_type = BUF_LAST;
+           }
+         break;
+       case '(':
+         if (!(syntax & RE_NO_BK_PARENS))
+           token->type = OP_OPEN_SUBEXP;
+         break;
+       case ')':
+         if (!(syntax & RE_NO_BK_PARENS))
+           token->type = OP_CLOSE_SUBEXP;
+         break;
+       case '+':
+         if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_BK_PLUS_QM))
+           token->type = OP_DUP_PLUS;
+         break;
+       case '?':
+         if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_BK_PLUS_QM))
+           token->type = OP_DUP_QUESTION;
+         break;
+       case '{':
+         if ((syntax & RE_INTERVALS) && (!(syntax & RE_NO_BK_BRACES)))
+           token->type = OP_OPEN_DUP_NUM;
+         break;
+       case '}':
+         if ((syntax & RE_INTERVALS) && (!(syntax & RE_NO_BK_BRACES)))
+           token->type = OP_CLOSE_DUP_NUM;
+         break;
+       default:
+         break;
+       }
+      return 2;
+    }
+
+  token->type = CHARACTER;
+  if (input->mb_cur_max > 1)
+    {
+      wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input));
+      token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
+    }
+  else
+    token->word_char = IS_WORD_CHAR (token->opr.c);
+
+  switch (c)
+    {
+    case '\n':
+      if (syntax & RE_NEWLINE_ALT)
+       token->type = OP_ALT;
+      break;
+    case '|':
+      if (!(syntax & RE_LIMITED_OPS) && (syntax & RE_NO_BK_VBAR))
+       token->type = OP_ALT;
+      break;
+    case '*':
+      token->type = OP_DUP_ASTERISK;
+      break;
+    case '+':
+      if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_BK_PLUS_QM))
+       token->type = OP_DUP_PLUS;
+      break;
+    case '?':
+      if (!(syntax & RE_LIMITED_OPS) && !(syntax & RE_BK_PLUS_QM))
+       token->type = OP_DUP_QUESTION;
+      break;
+    case '{':
+      if ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
+       token->type = OP_OPEN_DUP_NUM;
+      break;
+    case '}':
+      if ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
+       token->type = OP_CLOSE_DUP_NUM;
+      break;
+    case '(':
+      if (syntax & RE_NO_BK_PARENS)
+       token->type = OP_OPEN_SUBEXP;
+      break;
+    case ')':
+      if (syntax & RE_NO_BK_PARENS)
+       token->type = OP_CLOSE_SUBEXP;
+      break;
+    case '[':
+      token->type = OP_OPEN_BRACKET;
+      break;
+    case '.':
+      token->type = OP_PERIOD;
+      break;
+    case '^':
+      if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE))
+         && re_string_cur_idx (input) != 0)
+       {
+         char prev = re_string_peek_byte (input, -1);
+         if (!(syntax & RE_NEWLINE_ALT) || prev != '\n')
+           break;
+       }
+      token->type = ANCHOR;
+      token->opr.ctx_type = LINE_FIRST;
+      break;
+    case '$':
+      if (!(syntax & RE_CONTEXT_INDEP_ANCHORS)
+         && re_string_cur_idx (input) + 1 != re_string_length (input))
+       {
+         re_token_t next;
+         re_string_skip_bytes (input, 1);
+         peek_token (&next, input, syntax);
+         re_string_skip_bytes (input, -1);
+         if (next.type != OP_ALT && next.type != OP_CLOSE_SUBEXP)
+           break;
+       }
+      token->type = ANCHOR;
+      token->opr.ctx_type = LINE_LAST;
+      break;
+    default:
+      break;
+    }
+  return 1;
+}
+
+/* Peek a token from INPUT, and return the length of the token.
+   We must not use this function out of bracket expressions.  */
+
+static int
+peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
+{
+  unsigned char c;
+  if (re_string_eoi (input))
+    {
+      token->type = END_OF_RE;
+      return 0;
+    }
+  c = re_string_peek_byte (input, 0);
+  token->opr.c = c;
+
+  if (input->mb_cur_max > 1
+      && !re_string_first_byte (input, re_string_cur_idx (input)))
+    {
+      token->type = CHARACTER;
+      return 1;
+    }
+
+  if (c == '\\' && (syntax & RE_BACKSLASH_ESCAPE_IN_LISTS)
+      && re_string_cur_idx (input) + 1 < re_string_length (input))
+    {
+      /* In this case, '\' escape a character.  */
+      unsigned char c2;
+      re_string_skip_bytes (input, 1);
+      c2 = re_string_peek_byte (input, 0);
+      token->opr.c = c2;
+      token->type = CHARACTER;
+      return 1;
+    }
+  if (c == '[') /* '[' is a special char in a bracket exps.  */
+    {
+      unsigned char c2;
+      int token_len;
+      if (re_string_cur_idx (input) + 1 < re_string_length (input))
+       c2 = re_string_peek_byte (input, 1);
+      else
+       c2 = 0;
+      token->opr.c = c2;
+      token_len = 2;
+      switch (c2)
+       {
+       case '.':
+         token->type = OP_OPEN_COLL_ELEM;
+         break;
+
+       case '=':
+         token->type = OP_OPEN_EQUIV_CLASS;
+         break;
+
+       case ':':
+         if (syntax & RE_CHAR_CLASSES)
+           {
+             token->type = OP_OPEN_CHAR_CLASS;
+             break;
+           }
+         FALLTHROUGH;
+       default:
+         token->type = CHARACTER;
+         token->opr.c = c;
+         token_len = 1;
+         break;
+       }
+      return token_len;
+    }
+  switch (c)
+    {
+    case ']':
+      token->type = OP_CLOSE_BRACKET;
+      break;
+    case '^':
+      token->type = OP_NON_MATCH_LIST;
+      break;
+    case '-':
+      /* In V7 Unix grep and Unix awk and mawk, [...---...]
+         (3 adjacent minus signs) stands for a single minus sign.
+         Support that without breaking anything else.  */
+      if (! (re_string_cur_idx (input) + 2 < re_string_length (input)
+             && re_string_peek_byte (input, 1) == '-'
+             && re_string_peek_byte (input, 2) == '-'))
+        {
+          token->type = OP_CHARSET_RANGE;
+          break;
+        }
+      re_string_skip_bytes (input, 2);
+      FALLTHROUGH;
+    default:
+      token->type = CHARACTER;
+    }
+  return 1;
+}
+\f
+/* Functions for parser.  */
+
+/* Entry point of the parser.
+   Parse the regular expression REGEXP and return the structure tree.
+   If an error occurs, ERR is set by error code, and return NULL.
+   This function build the following tree, from regular expression <reg_exp>:
+          CAT
+          / \
+         /   \
+   <reg_exp>  EOR
+
+   CAT means concatenation.
+   EOR means end of regular expression.  */
+
+static bin_tree_t *
+parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax,
+       reg_errcode_t *err)
+{
+  re_dfa_t *dfa = preg->buffer;
+  bin_tree_t *tree, *eor, *root;
+  re_token_t current_token;
+  dfa->syntax = syntax;
+  fetch_token (&current_token, regexp, syntax | RE_CARET_ANCHORS_HERE);
+  tree = parse_reg_exp (regexp, preg, &current_token, syntax, 0, err);
+  if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL))
+    return NULL;
+  eor = create_tree (dfa, NULL, NULL, END_OF_RE);
+  if (tree != NULL)
+    root = create_tree (dfa, tree, eor, CONCAT);
+  else
+    root = eor;
+  if (__glibc_unlikely (eor == NULL || root == NULL))
+    {
+      *err = REG_ESPACE;
+      return NULL;
+    }
+  return root;
+}
+
+/* This function build the following tree, from regular expression
+   <branch1>|<branch2>:
+          ALT
+          / \
+         /   \
+   <branch1> <branch2>
+
+   ALT means alternative, which represents the operator '|'.  */
+
+static bin_tree_t *
+parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
+              reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
+{
+  re_dfa_t *dfa = preg->buffer;
+  bin_tree_t *tree, *branch = NULL;
+  bitset_word_t initial_bkref_map = dfa->completed_bkref_map;
+  tree = parse_branch (regexp, preg, token, syntax, nest, err);
+  if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL))
+    return NULL;
+
+  while (token->type == OP_ALT)
+    {
+      fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE);
+      if (token->type != OP_ALT && token->type != END_OF_RE
+         && (nest == 0 || token->type != OP_CLOSE_SUBEXP))
+       {
+         bitset_word_t accumulated_bkref_map = dfa->completed_bkref_map;
+         dfa->completed_bkref_map = initial_bkref_map;
+         branch = parse_branch (regexp, preg, token, syntax, nest, err);
+         if (__glibc_unlikely (*err != REG_NOERROR && branch == NULL))
+           {
+             if (tree != NULL)
+               postorder (tree, free_tree, NULL);
+             return NULL;
+           }
+         dfa->completed_bkref_map |= accumulated_bkref_map;
+       }
+      else
+       branch = NULL;
+      tree = create_tree (dfa, tree, branch, OP_ALT);
+      if (__glibc_unlikely (tree == NULL))
+       {
+         *err = REG_ESPACE;
+         return NULL;
+       }
+    }
+  return tree;
+}
+
+/* This function build the following tree, from regular expression
+   <exp1><exp2>:
+       CAT
+       / \
+       /   \
+   <exp1> <exp2>
+
+   CAT means concatenation.  */
+
+static bin_tree_t *
+parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
+             reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
+{
+  bin_tree_t *tree, *expr;
+  re_dfa_t *dfa = preg->buffer;
+  tree = parse_expression (regexp, preg, token, syntax, nest, err);
+  if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL))
+    return NULL;
+
+  while (token->type != OP_ALT && token->type != END_OF_RE
+        && (nest == 0 || token->type != OP_CLOSE_SUBEXP))
+    {
+      expr = parse_expression (regexp, preg, token, syntax, nest, err);
+      if (__glibc_unlikely (*err != REG_NOERROR && expr == NULL))
+       {
+         if (tree != NULL)
+           postorder (tree, free_tree, NULL);
+         return NULL;
+       }
+      if (tree != NULL && expr != NULL)
+       {
+         bin_tree_t *newtree = create_tree (dfa, tree, expr, CONCAT);
+         if (newtree == NULL)
+           {
+             postorder (expr, free_tree, NULL);
+             postorder (tree, free_tree, NULL);
+             *err = REG_ESPACE;
+             return NULL;
+           }
+         tree = newtree;
+       }
+      else if (tree == NULL)
+       tree = expr;
+      /* Otherwise expr == NULL, we don't need to create new tree.  */
+    }
+  return tree;
+}
+
+/* This function build the following tree, from regular expression a*:
+        *
+        |
+        a
+*/
+
+static bin_tree_t *
+parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
+                 reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
+{
+  re_dfa_t *dfa = preg->buffer;
+  bin_tree_t *tree;
+  switch (token->type)
+    {
+    case CHARACTER:
+      tree = create_token_tree (dfa, NULL, NULL, token);
+      if (__glibc_unlikely (tree == NULL))
+       {
+         *err = REG_ESPACE;
+         return NULL;
+       }
+      if (dfa->mb_cur_max > 1)
+       {
+         while (!re_string_eoi (regexp)
+                && !re_string_first_byte (regexp, re_string_cur_idx (regexp)))
+           {
+             bin_tree_t *mbc_remain;
+             fetch_token (token, regexp, syntax);
+             mbc_remain = create_token_tree (dfa, NULL, NULL, token);
+             tree = create_tree (dfa, tree, mbc_remain, CONCAT);
+             if (__glibc_unlikely (mbc_remain == NULL || tree == NULL))
+               {
+                 *err = REG_ESPACE;
+                 return NULL;
+               }
+           }
+       }
+      break;
+
+    case OP_OPEN_SUBEXP:
+      tree = parse_sub_exp (regexp, preg, token, syntax, nest + 1, err);
+      if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL))
+       return NULL;
+      break;
+
+    case OP_OPEN_BRACKET:
+      tree = parse_bracket_exp (regexp, dfa, token, syntax, err);
+      if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL))
+       return NULL;
+      break;
+
+    case OP_BACK_REF:
+      if (!__glibc_likely (dfa->completed_bkref_map & (1 << token->opr.idx)))
+       {
+         *err = REG_ESUBREG;
+         return NULL;
+       }
+      dfa->used_bkref_map |= 1 << token->opr.idx;
+      tree = create_token_tree (dfa, NULL, NULL, token);
+      if (__glibc_unlikely (tree == NULL))
+       {
+         *err = REG_ESPACE;
+         return NULL;
+       }
+      ++dfa->nbackref;
+      dfa->has_mb_node = 1;
+      break;
+
+    case OP_OPEN_DUP_NUM:
+      if (syntax & RE_CONTEXT_INVALID_DUP)
+       {
+         *err = REG_BADRPT;
+         return NULL;
+       }
+      FALLTHROUGH;
+    case OP_DUP_ASTERISK:
+    case OP_DUP_PLUS:
+    case OP_DUP_QUESTION:
+      if (syntax & RE_CONTEXT_INVALID_OPS)
+       {
+         *err = REG_BADRPT;
+         return NULL;
+       }
+      else if (syntax & RE_CONTEXT_INDEP_OPS)
+       {
+         fetch_token (token, regexp, syntax);
+         return parse_expression (regexp, preg, token, syntax, nest, err);
+       }
+      FALLTHROUGH;
+    case OP_CLOSE_SUBEXP:
+      if ((token->type == OP_CLOSE_SUBEXP)
+         && !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD))
+       {
+         *err = REG_ERPAREN;
+         return NULL;
+       }
+      FALLTHROUGH;
+    case OP_CLOSE_DUP_NUM:
+      /* We treat it as a normal character.  */
+
+      /* Then we can these characters as normal characters.  */
+      token->type = CHARACTER;
+      /* mb_partial and word_char bits should be initialized already
+        by peek_token.  */
+      tree = create_token_tree (dfa, NULL, NULL, token);
+      if (__glibc_unlikely (tree == NULL))
+       {
+         *err = REG_ESPACE;
+         return NULL;
+       }
+      break;
+
+    case ANCHOR:
+      if ((token->opr.ctx_type
+          & (WORD_DELIM | NOT_WORD_DELIM | WORD_FIRST | WORD_LAST))
+         && dfa->word_ops_used == 0)
+       init_word_char (dfa);
+      if (token->opr.ctx_type == WORD_DELIM
+         || token->opr.ctx_type == NOT_WORD_DELIM)
+       {
+         bin_tree_t *tree_first, *tree_last;
+         if (token->opr.ctx_type == WORD_DELIM)
+           {
+             token->opr.ctx_type = WORD_FIRST;
+             tree_first = create_token_tree (dfa, NULL, NULL, token);
+             token->opr.ctx_type = WORD_LAST;
+           }
+         else
+           {
+             token->opr.ctx_type = INSIDE_WORD;
+             tree_first = create_token_tree (dfa, NULL, NULL, token);
+             token->opr.ctx_type = INSIDE_NOTWORD;
+           }
+         tree_last = create_token_tree (dfa, NULL, NULL, token);
+         tree = create_tree (dfa, tree_first, tree_last, OP_ALT);
+         if (__glibc_unlikely (tree_first == NULL || tree_last == NULL
+                               || tree == NULL))
+           {
+             *err = REG_ESPACE;
+             return NULL;
+           }
+       }
+      else
+       {
+         tree = create_token_tree (dfa, NULL, NULL, token);
+         if (__glibc_unlikely (tree == NULL))
+           {
+             *err = REG_ESPACE;
+             return NULL;
+           }
+       }
+      /* We must return here, since ANCHORs can't be followed
+        by repetition operators.
+        eg. RE"^*" is invalid or "<ANCHOR(^)><CHAR(*)>",
+            it must not be "<ANCHOR(^)><REPEAT(*)>".  */
+      fetch_token (token, regexp, syntax);
+      return tree;
+
+    case OP_PERIOD:
+      tree = create_token_tree (dfa, NULL, NULL, token);
+      if (__glibc_unlikely (tree == NULL))
+       {
+         *err = REG_ESPACE;
+         return NULL;
+       }
+      if (dfa->mb_cur_max > 1)
+       dfa->has_mb_node = 1;
+      break;
+
+    case OP_WORD:
+    case OP_NOTWORD:
+      tree = build_charclass_op (dfa, regexp->trans,
+                                "alnum",
+                                "_",
+                                token->type == OP_NOTWORD, err);
+      if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL))
+       return NULL;
+      break;
+
+    case OP_SPACE:
+    case OP_NOTSPACE:
+      tree = build_charclass_op (dfa, regexp->trans,
+                                "space",
+                                "",
+                                token->type == OP_NOTSPACE, err);
+      if (__glibc_unlikely (*err != REG_NOERROR && tree == NULL))
+       return NULL;
+      break;
+
+    case OP_ALT:
+    case END_OF_RE:
+      return NULL;
+
+    case BACK_SLASH:
+      *err = REG_EESCAPE;
+      return NULL;
+
+    default:
+      /* Must not happen?  */
+      DEBUG_ASSERT (false);
+      return NULL;
+    }
+  fetch_token (token, regexp, syntax);
+
+  while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS
+        || token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM)
+    {
+      bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token,
+                                          syntax, err);
+      if (__glibc_unlikely (*err != REG_NOERROR && dup_tree == NULL))
+       {
+         if (tree != NULL)
+           postorder (tree, free_tree, NULL);
+         return NULL;
+       }
+      tree = dup_tree;
+      /* In BRE consecutive duplications are not allowed.  */
+      if ((syntax & RE_CONTEXT_INVALID_DUP)
+         && (token->type == OP_DUP_ASTERISK
+             || token->type == OP_OPEN_DUP_NUM))
+       {
+         if (tree != NULL)
+           postorder (tree, free_tree, NULL);
+         *err = REG_BADRPT;
+         return NULL;
+       }
+    }
+
+  return tree;
+}
+
+/* This function build the following tree, from regular expression
+   (<reg_exp>):
+        SUBEXP
+           |
+       <reg_exp>
+*/
+
+static bin_tree_t *
+parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
+              reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
+{
+  re_dfa_t *dfa = preg->buffer;
+  bin_tree_t *tree;
+  size_t cur_nsub;
+  cur_nsub = preg->re_nsub++;
+
+  fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE);
+
+  /* The subexpression may be a null string.  */
+  if (token->type == OP_CLOSE_SUBEXP)
+    tree = NULL;
+  else
+    {
+      tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);
+      if (__glibc_unlikely (*err == REG_NOERROR
+                           && token->type != OP_CLOSE_SUBEXP))
+       {
+         if (tree != NULL)
+           postorder (tree, free_tree, NULL);
+         *err = REG_EPAREN;
+       }
+      if (__glibc_unlikely (*err != REG_NOERROR))
+       return NULL;
+    }
+
+  if (cur_nsub <= '9' - '1')
+    dfa->completed_bkref_map |= 1 << cur_nsub;
+
+  tree = create_tree (dfa, tree, NULL, SUBEXP);
+  if (__glibc_unlikely (tree == NULL))
+    {
+      *err = REG_ESPACE;
+      return NULL;
+    }
+  tree->token.opr.idx = cur_nsub;
+  return tree;
+}
+
+/* This function parse repetition operators like "*", "+", "{1,3}" etc.  */
+
+static bin_tree_t *
+parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
+             re_token_t *token, reg_syntax_t syntax, reg_errcode_t *err)
+{
+  bin_tree_t *tree = NULL, *old_tree = NULL;
+  Idx i, start, end, start_idx = re_string_cur_idx (regexp);
+  re_token_t start_token = *token;
+
+  if (token->type == OP_OPEN_DUP_NUM)
+    {
+      end = 0;
+      start = fetch_number (regexp, token, syntax);
+      if (start == -1)
+       {
+         if (token->type == CHARACTER && token->opr.c == ',')
+           start = 0; /* We treat "{,m}" as "{0,m}".  */
+         else
+           {
+             *err = REG_BADBR; /* <re>{} is invalid.  */
+             return NULL;
+           }
+       }
+      if (__glibc_likely (start != -2))
+       {
+         /* We treat "{n}" as "{n,n}".  */
+         end = ((token->type == OP_CLOSE_DUP_NUM) ? start
+                : ((token->type == CHARACTER && token->opr.c == ',')
+                   ? fetch_number (regexp, token, syntax) : -2));
+       }
+      if (__glibc_unlikely (start == -2 || end == -2))
+       {
+         /* Invalid sequence.  */
+         if (__glibc_unlikely (!(syntax & RE_INVALID_INTERVAL_ORD)))
+           {
+             if (token->type == END_OF_RE)
+               *err = REG_EBRACE;
+             else
+               *err = REG_BADBR;
+
+             return NULL;
+           }
+
+         /* If the syntax bit is set, rollback.  */
+         re_string_set_index (regexp, start_idx);
+         *token = start_token;
+         token->type = CHARACTER;
+         /* mb_partial and word_char bits should be already initialized by
+            peek_token.  */
+         return elem;
+       }
+
+      if (__glibc_unlikely ((end != -1 && start > end)
+                           || token->type != OP_CLOSE_DUP_NUM))
+       {
+         /* First number greater than second.  */
+         *err = REG_BADBR;
+         return NULL;
+       }
+
+      if (__glibc_unlikely (RE_DUP_MAX < (end == -1 ? start : end)))
+       {
+         *err = REG_ESIZE;
+         return NULL;
+       }
+    }
+  else
+    {
+      start = (token->type == OP_DUP_PLUS) ? 1 : 0;
+      end = (token->type == OP_DUP_QUESTION) ? 1 : -1;
+    }
+
+  fetch_token (token, regexp, syntax);
+
+  if (__glibc_unlikely (elem == NULL))
+    return NULL;
+  if (__glibc_unlikely (start == 0 && end == 0))
+    {
+      postorder (elem, free_tree, NULL);
+      return NULL;
+    }
+
+  /* Extract "<re>{n,m}" to "<re><re>...<re><re>{0,<m-n>}".  */
+  if (__glibc_unlikely (start > 0))
+    {
+      tree = elem;
+      for (i = 2; i <= start; ++i)
+       {
+         elem = duplicate_tree (elem, dfa);
+         tree = create_tree (dfa, tree, elem, CONCAT);
+         if (__glibc_unlikely (elem == NULL || tree == NULL))
+           goto parse_dup_op_espace;
+       }
+
+      if (start == end)
+       return tree;
+
+      /* Duplicate ELEM before it is marked optional.  */
+      elem = duplicate_tree (elem, dfa);
+      if (__glibc_unlikely (elem == NULL))
+        goto parse_dup_op_espace;
+      old_tree = tree;
+    }
+  else
+    old_tree = NULL;
+
+  if (elem->token.type == SUBEXP)
+    {
+      uintptr_t subidx = elem->token.opr.idx;
+      postorder (elem, mark_opt_subexp, (void *) subidx);
+    }
+
+  tree = create_tree (dfa, elem, NULL,
+                     (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
+  if (__glibc_unlikely (tree == NULL))
+    goto parse_dup_op_espace;
+
+  /* This loop is actually executed only when end != -1,
+     to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?...  We have
+     already created the start+1-th copy.  */
+  if (TYPE_SIGNED (Idx) || end != -1)
+    for (i = start + 2; i <= end; ++i)
+      {
+       elem = duplicate_tree (elem, dfa);
+       tree = create_tree (dfa, tree, elem, CONCAT);
+       if (__glibc_unlikely (elem == NULL || tree == NULL))
+         goto parse_dup_op_espace;
+
+       tree = create_tree (dfa, tree, NULL, OP_ALT);
+       if (__glibc_unlikely (tree == NULL))
+         goto parse_dup_op_espace;
+      }
+
+  if (old_tree)
+    tree = create_tree (dfa, old_tree, tree, CONCAT);
+
+  return tree;
+
+ parse_dup_op_espace:
+  *err = REG_ESPACE;
+  return NULL;
+}
+
+/* Size of the names for collating symbol/equivalence_class/character_class.
+   I'm not sure, but maybe enough.  */
+#define BRACKET_NAME_BUF_SIZE 32
+
+#ifndef _LIBC
+
+/* Convert the byte B to the corresponding wide character.  In a
+   unibyte locale, treat B as itself.  In a multibyte locale, return
+   WEOF if B is an encoding error.  */
+static wint_t
+parse_byte (unsigned char b, re_dfa_t const *dfa)
+{
+  return dfa->mb_cur_max > 1 ? __btowc (b) : b;
+}
+
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Build the range expression which starts from START_ELEM, and ends
+   at END_ELEM.  The result are written to MBCSET and SBCSET.
+   RANGE_ALLOC is the allocated size of mbcset->range_starts, and
+   mbcset->range_ends, is a pointer argument since we may
+   update it.  */
+
+static reg_errcode_t
+build_range_exp (bitset_t sbcset, re_charset_t *mbcset, Idx *range_alloc,
+                bracket_elem_t *start_elem, bracket_elem_t *end_elem,
+                re_dfa_t *dfa, reg_syntax_t syntax, uint_fast32_t nrules,
+                const unsigned char *collseqmb, const char *collseqwc,
+                int_fast32_t table_size, const void *symb_table,
+                const unsigned char *extra)
+{
+  /* Equivalence Classes and Character Classes can't be a range start/end.  */
+  if (__glibc_unlikely (start_elem->type == EQUIV_CLASS
+                       || start_elem->type == CHAR_CLASS
+                       || end_elem->type == EQUIV_CLASS
+                       || end_elem->type == CHAR_CLASS))
+    return REG_ERANGE;
+
+  /* We can handle no multi character collating elements without libc
+     support.  */
+  if (__glibc_unlikely ((start_elem->type == COLL_SYM
+                        && strlen ((char *) start_elem->opr.name) > 1)
+                       || (end_elem->type == COLL_SYM
+                           && strlen ((char *) end_elem->opr.name) > 1)))
+    return REG_ECOLLATE;
+
+  unsigned int
+    start_ch = ((start_elem->type == SB_CHAR) ? start_elem->opr.ch
+               : ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0]
+                  : 0)),
+    end_ch = ((end_elem->type == SB_CHAR) ? end_elem->opr.ch
+             : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0]
+                : 0));
+  wint_t
+    start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM)
+               ? parse_byte (start_ch, dfa) : start_elem->opr.wch),
+    end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM)
+             ? parse_byte (end_ch, dfa) : end_elem->opr.wch);
+
+  if (start_wc == WEOF || end_wc == WEOF)
+    return REG_ECOLLATE;
+  else if (__glibc_unlikely ((syntax & RE_NO_EMPTY_RANGES)
+                             && start_wc > end_wc))
+    return REG_ERANGE;
+
+  /* Got valid collation sequence values, add them as a new entry.
+     However, for !_LIBC we have no collation elements: if the
+     character set is single byte, the single byte character set
+     that we build below suffices.  parse_bracket_exp passes
+     no MBCSET if dfa->mb_cur_max == 1.  */
+  if (dfa->mb_cur_max > 1)
+    {
+      /* Check the space of the arrays.  */
+      if (__glibc_unlikely (*range_alloc == mbcset->nranges))
+        {
+          /* There is not enough space, need realloc.  */
+          wchar_t *new_array_start, *new_array_end;
+          Idx new_nranges;
+
+          /* +1 in case of mbcset->nranges is 0.  */
+          new_nranges = 2 * mbcset->nranges + 1;
+          /* Use realloc since mbcset->range_starts and mbcset->range_ends
+             are NULL if *range_alloc == 0.  */
+          new_array_start = re_realloc (mbcset->range_starts, wchar_t,
+                                        new_nranges);
+          new_array_end = re_realloc (mbcset->range_ends, wchar_t,
+                                      new_nranges);
+
+          if (__glibc_unlikely (new_array_start == NULL
+                                || new_array_end == NULL))
+            {
+              re_free (new_array_start);
+              re_free (new_array_end);
+              return REG_ESPACE;
+            }
+
+          mbcset->range_starts = new_array_start;
+          mbcset->range_ends = new_array_end;
+          *range_alloc = new_nranges;
+        }
+
+      mbcset->range_starts[mbcset->nranges] = start_wc;
+      mbcset->range_ends[mbcset->nranges++] = end_wc;
+    }
+
+  /* Build the table for single byte characters.  */
+  for (wchar_t wc = 0; wc < SBC_MAX; ++wc)
+    {
+      if (start_wc <= wc && wc <= end_wc)
+        bitset_set (sbcset, wc);
+    }
+
+  return REG_NOERROR;
+}
+#endif /* not _LIBC */
+
+#ifndef _LIBC
+/* Helper function for parse_bracket_exp only used in case of NOT _LIBC.
+   Build the collating element which is represented by NAME.
+   The result are written to MBCSET and SBCSET.
+   COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
+   pointer argument since we may update it.  */
+
+static reg_errcode_t
+build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
+                       Idx *coll_sym_alloc, const unsigned char *name,
+                       uint_fast32_t nrules, int_fast32_t table_size,
+                       const void *symb_table, const unsigned char *extra)
+{
+  size_t name_len = strlen ((const char *) name);
+  if (__glibc_unlikely (name_len != 1))
+    return REG_ECOLLATE;
+  else
+    {
+      bitset_set (sbcset, name[0]);
+      return REG_NOERROR;
+    }
+}
+#endif /* not _LIBC */
+
+#ifdef _LIBC
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Seek the collating symbol entry corresponding to NAME.
+   Return the index of the symbol in the SYMB_TABLE,
+   or -1 if not found.  */
+
+static __always_inline int32_t
+seek_collating_symbol_entry (const unsigned char *name, size_t name_len,
+                            const int32_t *symb_table,
+                            int_fast32_t table_size,
+                            const unsigned char *extra)
+{
+  int_fast32_t elem;
+
+  for (elem = 0; elem < table_size; elem++)
+    if (symb_table[2 * elem] != 0)
+      {
+       int32_t idx = symb_table[2 * elem + 1];
+       /* Skip the name of collating element name.  */
+       idx += 1 + extra[idx];
+       if (/* Compare the length of the name.  */
+           name_len == extra[idx]
+           /* Compare the name.  */
+           && memcmp (name, &extra[idx + 1], name_len) == 0)
+         /* Yep, this is the entry.  */
+         return elem;
+      }
+  return -1;
+}
+
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Look up the collation sequence value of BR_ELEM.
+   Return the value if succeeded, UINT_MAX otherwise.  */
+
+static __always_inline unsigned int
+lookup_collation_sequence_value (bracket_elem_t *br_elem, uint32_t nrules,
+                                const unsigned char *collseqmb,
+                                const char *collseqwc,
+                                int_fast32_t table_size,
+                                const int32_t *symb_table,
+                                const unsigned char *extra)
+{
+  if (br_elem->type == SB_CHAR)
+    {
+      /* if (MB_CUR_MAX == 1) */
+      if (nrules == 0)
+       return collseqmb[br_elem->opr.ch];
+      else
+       {
+         wint_t wc = __btowc (br_elem->opr.ch);
+         return __collseq_table_lookup (collseqwc, wc);
+       }
+    }
+  else if (br_elem->type == MB_CHAR)
+    {
+      if (nrules != 0)
+       return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
+    }
+  else if (br_elem->type == COLL_SYM)
+    {
+      size_t sym_name_len = strlen ((char *) br_elem->opr.name);
+      if (nrules != 0)
+       {
+         int32_t elem, idx;
+         elem = seek_collating_symbol_entry (br_elem->opr.name,
+                                             sym_name_len,
+                                             symb_table, table_size,
+                                             extra);
+         if (elem != -1)
+           {
+             /* We found the entry.  */
+             idx = symb_table[2 * elem + 1];
+             /* Skip the name of collating element name.  */
+             idx += 1 + extra[idx];
+             /* Skip the byte sequence of the collating element.  */
+             idx += 1 + extra[idx];
+             /* Adjust for the alignment.  */
+             idx = (idx + 3) & ~3;
+             /* Skip the multibyte collation sequence value.  */
+             idx += sizeof (unsigned int);
+             /* Skip the wide char sequence of the collating element.  */
+             idx += sizeof (unsigned int) *
+               (1 + *(unsigned int *) (extra + idx));
+             /* Return the collation sequence value.  */
+             return *(unsigned int *) (extra + idx);
+           }
+         else if (sym_name_len == 1)
+           {
+             /* No valid character.  Match it as a single byte
+                character.  */
+             return collseqmb[br_elem->opr.name[0]];
+           }
+       }
+      else if (sym_name_len == 1)
+       return collseqmb[br_elem->opr.name[0]];
+    }
+  return UINT_MAX;
+}
+
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Build the range expression which starts from START_ELEM, and ends
+   at END_ELEM.  The result are written to MBCSET and SBCSET.
+   RANGE_ALLOC is the allocated size of mbcset->range_starts, and
+   mbcset->range_ends, is a pointer argument since we may
+   update it.  */
+
+static __always_inline reg_errcode_t
+build_range_exp (bitset_t sbcset, re_charset_t *mbcset, Idx *range_alloc,
+                bracket_elem_t *start_elem, bracket_elem_t *end_elem,
+                re_dfa_t *dfa, reg_syntax_t syntax, uint32_t nrules,
+                const unsigned char *collseqmb, const char *collseqwc,
+                int_fast32_t table_size, const int32_t *symb_table,
+                const unsigned char *extra)
+{
+  unsigned int ch;
+  uint32_t start_collseq;
+  uint32_t end_collseq;
+
+  /* Equivalence Classes and Character Classes can't be a range
+     start/end.  */
+  if (__glibc_unlikely (start_elem->type == EQUIV_CLASS
+                        || start_elem->type == CHAR_CLASS
+                        || end_elem->type == EQUIV_CLASS
+                        || end_elem->type == CHAR_CLASS))
+    return REG_ERANGE;
+
+  /* FIXME: Implement rational ranges here, too.  */
+  start_collseq = lookup_collation_sequence_value (start_elem, nrules, collseqmb, collseqwc,
+                                                  table_size, symb_table, extra);
+  end_collseq = lookup_collation_sequence_value (end_elem, nrules, collseqmb, collseqwc,
+                                                table_size, symb_table, extra);
+  /* Check start/end collation sequence values.  */
+  if (__glibc_unlikely (start_collseq == UINT_MAX
+                        || end_collseq == UINT_MAX))
+    return REG_ECOLLATE;
+  if (__glibc_unlikely ((syntax & RE_NO_EMPTY_RANGES)
+                        && start_collseq > end_collseq))
+    return REG_ERANGE;
+
+  /* Got valid collation sequence values, add them as a new entry.
+     However, if we have no collation elements, and the character set
+     is single byte, the single byte character set that we
+     build below suffices. */
+  if (nrules > 0 || dfa->mb_cur_max > 1)
+    {
+      /* Check the space of the arrays.  */
+      if (__glibc_unlikely (*range_alloc == mbcset->nranges))
+       {
+         /* There is not enough space, need realloc.  */
+         uint32_t *new_array_start;
+         uint32_t *new_array_end;
+         int new_nranges;
+
+         /* +1 in case of mbcset->nranges is 0.  */
+         new_nranges = 2 * mbcset->nranges + 1;
+         new_array_start = re_realloc (mbcset->range_starts, uint32_t,
+                                       new_nranges);
+         new_array_end = re_realloc (mbcset->range_ends, uint32_t,
+                                     new_nranges);
+
+          if (__glibc_unlikely (new_array_start == NULL
+                                || new_array_end == NULL))
+           return REG_ESPACE;
+
+         mbcset->range_starts = new_array_start;
+         mbcset->range_ends = new_array_end;
+         *range_alloc = new_nranges;
+       }
+
+      mbcset->range_starts[mbcset->nranges] = start_collseq;
+      mbcset->range_ends[mbcset->nranges++] = end_collseq;
+    }
+
+  /* Build the table for single byte characters.  */
+  for (ch = 0; ch < SBC_MAX; ch++)
+    {
+      uint32_t ch_collseq;
+      /* if (MB_CUR_MAX == 1) */
+      if (nrules == 0)
+       ch_collseq = collseqmb[ch];
+      else
+       ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch));
+      if (start_collseq <= ch_collseq && ch_collseq <= end_collseq)
+       bitset_set (sbcset, ch);
+    }
+  return REG_NOERROR;
+}
+
+/* Local function for parse_bracket_exp used in _LIBC environment.
+   Build the collating element which is represented by NAME.
+   The result are written to MBCSET and SBCSET.
+   COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
+   pointer argument since we may update it.  */
+
+static __always_inline reg_errcode_t
+build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
+                       Idx *coll_sym_alloc, const unsigned char *name,
+                       uint_fast32_t nrules, int_fast32_t table_size,
+                       const int32_t *symb_table, const unsigned char *extra)
+{
+  int32_t elem, idx;
+  size_t name_len = strlen ((const char *) name);
+  if (nrules != 0)
+    {
+      elem = seek_collating_symbol_entry (name, name_len, symb_table,
+                                         table_size, extra);
+      if (elem != -1)
+       {
+         /* We found the entry.  */
+         idx = symb_table[2 * elem + 1];
+         /* Skip the name of collating element name.  */
+         idx += 1 + extra[idx];
+       }
+      else if (name_len == 1)
+       {
+         /* No valid character, treat it as a normal
+            character.  */
+         bitset_set (sbcset, name[0]);
+         return REG_NOERROR;
+       }
+      else
+       return REG_ECOLLATE;
+
+      /* Got valid collation sequence, add it as a new entry.  */
+      /* Check the space of the arrays.  */
+      if (__glibc_unlikely (*coll_sym_alloc == mbcset->ncoll_syms))
+       {
+         /* Not enough, realloc it.  */
+         /* +1 in case of mbcset->ncoll_syms is 0.  */
+         int new_coll_sym_alloc = 2 * mbcset->ncoll_syms + 1;
+         /* Use realloc since mbcset->coll_syms is NULL
+            if *alloc == 0.  */
+         int32_t *new_coll_syms = re_realloc (mbcset->coll_syms, int32_t,
+                                              new_coll_sym_alloc);
+          if (__glibc_unlikely (new_coll_syms == NULL))
+           return REG_ESPACE;
+         mbcset->coll_syms = new_coll_syms;
+         *coll_sym_alloc = new_coll_sym_alloc;
+       }
+      mbcset->coll_syms[mbcset->ncoll_syms++] = idx;
+      return REG_NOERROR;
+    }
+  else
+    {
+      if (__glibc_unlikely (name_len != 1))
+       return REG_ECOLLATE;
+      else
+       {
+         bitset_set (sbcset, name[0]);
+         return REG_NOERROR;
+       }
+    }
+}
+#endif /* _LIBC */
+
+/* This function parse bracket expression like "[abc]", "[a-c]",
+   "[[.a-a.]]" etc.  */
+
+static bin_tree_t *
+parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
+                  reg_syntax_t syntax, reg_errcode_t *err)
+{
+  const unsigned char *collseqmb = NULL;
+  const char *collseqwc = NULL;
+  uint_fast32_t nrules = 0;
+  int_fast32_t table_size = 0;
+  const void *symb_table = NULL;
+  const unsigned char *extra = NULL;
+
+  re_token_t br_token;
+  re_bitset_ptr_t sbcset;
+  re_charset_t *mbcset;
+  Idx coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0;
+  Idx equiv_class_alloc = 0, char_class_alloc = 0;
+  bool non_match = false;
+  bin_tree_t *work_tree;
+  int token_len;
+  bool first_round = true;
+#ifdef _LIBC
+  collseqmb = (const unsigned char *)
+    _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB);
+  nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+  if (nrules)
+    {
+      /*
+      if (MB_CUR_MAX > 1)
+      */
+      collseqwc = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQWC);
+      table_size = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_SYMB_HASH_SIZEMB);
+      symb_table = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_TABLEMB);
+      extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
+                                                  _NL_COLLATE_SYMB_EXTRAMB);
+    }
+#endif
+  sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
+  mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
+  if (__glibc_unlikely (sbcset == NULL || mbcset == NULL))
+    {
+      re_free (sbcset);
+      re_free (mbcset);
+      *err = REG_ESPACE;
+      return NULL;
+    }
+
+  token_len = peek_token_bracket (token, regexp, syntax);
+  if (__glibc_unlikely (token->type == END_OF_RE))
+    {
+      *err = REG_BADPAT;
+      goto parse_bracket_exp_free_return;
+    }
+  if (token->type == OP_NON_MATCH_LIST)
+    {
+      mbcset->non_match = 1;
+      non_match = true;
+      if (syntax & RE_HAT_LISTS_NOT_NEWLINE)
+       bitset_set (sbcset, '\n');
+      re_string_skip_bytes (regexp, token_len); /* Skip a token.  */
+      token_len = peek_token_bracket (token, regexp, syntax);
+      if (__glibc_unlikely (token->type == END_OF_RE))
+       {
+         *err = REG_BADPAT;
+         goto parse_bracket_exp_free_return;
+       }
+    }
+
+  /* We treat the first ']' as a normal character.  */
+  if (token->type == OP_CLOSE_BRACKET)
+    token->type = CHARACTER;
+
+  while (1)
+    {
+      bracket_elem_t start_elem, end_elem;
+      unsigned char start_name_buf[BRACKET_NAME_BUF_SIZE];
+      unsigned char end_name_buf[BRACKET_NAME_BUF_SIZE];
+      reg_errcode_t ret;
+      int token_len2 = 0;
+      bool is_range_exp = false;
+      re_token_t token2;
+
+      start_elem.opr.name = start_name_buf;
+      start_elem.type = COLL_SYM;
+      ret = parse_bracket_element (&start_elem, regexp, token, token_len, dfa,
+                                  syntax, first_round);
+      if (__glibc_unlikely (ret != REG_NOERROR))
+       {
+         *err = ret;
+         goto parse_bracket_exp_free_return;
+       }
+      first_round = false;
+
+      /* Get information about the next token.  We need it in any case.  */
+      token_len = peek_token_bracket (token, regexp, syntax);
+
+      /* Do not check for ranges if we know they are not allowed.  */
+      if (start_elem.type != CHAR_CLASS && start_elem.type != EQUIV_CLASS)
+       {
+         if (__glibc_unlikely (token->type == END_OF_RE))
+           {
+             *err = REG_EBRACK;
+             goto parse_bracket_exp_free_return;
+           }
+         if (token->type == OP_CHARSET_RANGE)
+           {
+             re_string_skip_bytes (regexp, token_len); /* Skip '-'.  */
+             token_len2 = peek_token_bracket (&token2, regexp, syntax);
+             if (__glibc_unlikely (token2.type == END_OF_RE))
+               {
+                 *err = REG_EBRACK;
+                 goto parse_bracket_exp_free_return;
+               }
+             if (token2.type == OP_CLOSE_BRACKET)
+               {
+                 /* We treat the last '-' as a normal character.  */
+                 re_string_skip_bytes (regexp, -token_len);
+                 token->type = CHARACTER;
+               }
+             else
+               is_range_exp = true;
+           }
+       }
+
+      if (is_range_exp == true)
+       {
+         end_elem.opr.name = end_name_buf;
+         end_elem.type = COLL_SYM;
+         ret = parse_bracket_element (&end_elem, regexp, &token2, token_len2,
+                                      dfa, syntax, true);
+         if (__glibc_unlikely (ret != REG_NOERROR))
+           {
+             *err = ret;
+             goto parse_bracket_exp_free_return;
+           }
+
+         token_len = peek_token_bracket (token, regexp, syntax);
+
+         *err = build_range_exp (sbcset, mbcset, &range_alloc,
+                                 &start_elem, &end_elem,
+                                 dfa, syntax, nrules, collseqmb, collseqwc,
+                                 table_size, symb_table, extra);
+         if (__glibc_unlikely (*err != REG_NOERROR))
+           goto parse_bracket_exp_free_return;
+       }
+      else
+       {
+         switch (start_elem.type)
+           {
+           case SB_CHAR:
+             bitset_set (sbcset, start_elem.opr.ch);
+             break;
+           case MB_CHAR:
+             /* Check whether the array has enough space.  */
+             if (__glibc_unlikely (mbchar_alloc == mbcset->nmbchars))
+               {
+                 wchar_t *new_mbchars;
+                 /* Not enough, realloc it.  */
+                 /* +1 in case of mbcset->nmbchars is 0.  */
+                 mbchar_alloc = 2 * mbcset->nmbchars + 1;
+                 /* Use realloc since array is NULL if *alloc == 0.  */
+                 new_mbchars = re_realloc (mbcset->mbchars, wchar_t,
+                                           mbchar_alloc);
+                 if (__glibc_unlikely (new_mbchars == NULL))
+                   goto parse_bracket_exp_espace;
+                 mbcset->mbchars = new_mbchars;
+               }
+             mbcset->mbchars[mbcset->nmbchars++] = start_elem.opr.wch;
+             break;
+           case EQUIV_CLASS:
+             *err = build_equiv_class (sbcset,
+                                       mbcset, &equiv_class_alloc,
+                                       start_elem.opr.name);
+             if (__glibc_unlikely (*err != REG_NOERROR))
+               goto parse_bracket_exp_free_return;
+             break;
+           case COLL_SYM:
+             *err = build_collating_symbol (sbcset,
+                                            mbcset, &coll_sym_alloc,
+                                            start_elem.opr.name,
+                                            nrules, table_size, symb_table, extra);
+             if (__glibc_unlikely (*err != REG_NOERROR))
+               goto parse_bracket_exp_free_return;
+             break;
+           case CHAR_CLASS:
+             *err = build_charclass (regexp->trans, sbcset,
+                                     mbcset, &char_class_alloc,
+                                     (const char *) start_elem.opr.name,
+                                     syntax);
+             if (__glibc_unlikely (*err != REG_NOERROR))
+              goto parse_bracket_exp_free_return;
+             break;
+           default:
+             DEBUG_ASSERT (false);
+             break;
+           }
+       }
+      if (__glibc_unlikely (token->type == END_OF_RE))
+       {
+         *err = REG_EBRACK;
+         goto parse_bracket_exp_free_return;
+       }
+      if (token->type == OP_CLOSE_BRACKET)
+       break;
+    }
+
+  re_string_skip_bytes (regexp, token_len); /* Skip a token.  */
+
+  /* If it is non-matching list.  */
+  if (non_match)
+    bitset_not (sbcset);
+
+  /* Ensure only single byte characters are set.  */
+  if (dfa->mb_cur_max > 1)
+    bitset_mask (sbcset, dfa->sb_char);
+
+  if (mbcset->nmbchars || mbcset->ncoll_syms || mbcset->nequiv_classes
+      || mbcset->nranges || (dfa->mb_cur_max > 1 && (mbcset->nchar_classes
+                                                    || mbcset->non_match)))
+    {
+      bin_tree_t *mbc_tree;
+      int sbc_idx;
+      /* Build a tree for complex bracket.  */
+      dfa->has_mb_node = 1;
+      br_token.type = COMPLEX_BRACKET;
+      br_token.opr.mbcset = mbcset;
+      mbc_tree = create_token_tree (dfa, NULL, NULL, &br_token);
+      if (__glibc_unlikely (mbc_tree == NULL))
+       goto parse_bracket_exp_espace;
+      for (sbc_idx = 0; sbc_idx < BITSET_WORDS; ++sbc_idx)
+       if (sbcset[sbc_idx])
+         break;
+      /* If there are no bits set in sbcset, there is no point
+        of having both SIMPLE_BRACKET and COMPLEX_BRACKET.  */
+      if (sbc_idx < BITSET_WORDS)
+       {
+         /* Build a tree for simple bracket.  */
+         br_token.type = SIMPLE_BRACKET;
+         br_token.opr.sbcset = sbcset;
+         work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
+         if (__glibc_unlikely (work_tree == NULL))
+           goto parse_bracket_exp_espace;
+
+         /* Then join them by ALT node.  */
+         work_tree = create_tree (dfa, work_tree, mbc_tree, OP_ALT);
+         if (__glibc_unlikely (work_tree == NULL))
+           goto parse_bracket_exp_espace;
+       }
+      else
+       {
+         re_free (sbcset);
+         work_tree = mbc_tree;
+       }
+    }
+  else
+    {
+      free_charset (mbcset);
+      /* Build a tree for simple bracket.  */
+      br_token.type = SIMPLE_BRACKET;
+      br_token.opr.sbcset = sbcset;
+      work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
+      if (__glibc_unlikely (work_tree == NULL))
+       goto parse_bracket_exp_espace;
+    }
+  return work_tree;
+
+ parse_bracket_exp_espace:
+  *err = REG_ESPACE;
+ parse_bracket_exp_free_return:
+  re_free (sbcset);
+  free_charset (mbcset);
+  return NULL;
+}
+
+/* Parse an element in the bracket expression.  */
+
+static reg_errcode_t
+parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
+                      re_token_t *token, int token_len, re_dfa_t *dfa,
+                      reg_syntax_t syntax, bool accept_hyphen)
+{
+  int cur_char_size;
+  cur_char_size = re_string_char_size_at (regexp, re_string_cur_idx (regexp));
+  if (cur_char_size > 1)
+    {
+      elem->type = MB_CHAR;
+      elem->opr.wch = re_string_wchar_at (regexp, re_string_cur_idx (regexp));
+      re_string_skip_bytes (regexp, cur_char_size);
+      return REG_NOERROR;
+    }
+  re_string_skip_bytes (regexp, token_len); /* Skip a token.  */
+  if (token->type == OP_OPEN_COLL_ELEM || token->type == OP_OPEN_CHAR_CLASS
+      || token->type == OP_OPEN_EQUIV_CLASS)
+    return parse_bracket_symbol (elem, regexp, token);
+  if (__glibc_unlikely (token->type == OP_CHARSET_RANGE) && !accept_hyphen)
+    {
+      /* A '-' must only appear as anything but a range indicator before
+        the closing bracket.  Everything else is an error.  */
+      re_token_t token2;
+      (void) peek_token_bracket (&token2, regexp, syntax);
+      if (token2.type != OP_CLOSE_BRACKET)
+       /* The actual error value is not standardized since this whole
+          case is undefined.  But ERANGE makes good sense.  */
+       return REG_ERANGE;
+    }
+  elem->type = SB_CHAR;
+  elem->opr.ch = token->opr.c;
+  return REG_NOERROR;
+}
+
+/* Parse a bracket symbol in the bracket expression.  Bracket symbols are
+   such as [:<character_class>:], [.<collating_element>.], and
+   [=<equivalent_class>=].  */
+
+static reg_errcode_t
+parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
+                     re_token_t *token)
+{
+  unsigned char ch, delim = token->opr.c;
+  int i = 0;
+  if (re_string_eoi(regexp))
+    return REG_EBRACK;
+  for (;; ++i)
+    {
+      if (i >= BRACKET_NAME_BUF_SIZE)
+       return REG_EBRACK;
+      if (token->type == OP_OPEN_CHAR_CLASS)
+       ch = re_string_fetch_byte_case (regexp);
+      else
+       ch = re_string_fetch_byte (regexp);
+      if (re_string_eoi(regexp))
+       return REG_EBRACK;
+      if (ch == delim && re_string_peek_byte (regexp, 0) == ']')
+       break;
+      elem->opr.name[i] = ch;
+    }
+  re_string_skip_bytes (regexp, 1);
+  elem->opr.name[i] = '\0';
+  switch (token->type)
+    {
+    case OP_OPEN_COLL_ELEM:
+      elem->type = COLL_SYM;
+      break;
+    case OP_OPEN_EQUIV_CLASS:
+      elem->type = EQUIV_CLASS;
+      break;
+    case OP_OPEN_CHAR_CLASS:
+      elem->type = CHAR_CLASS;
+      break;
+    default:
+      break;
+    }
+  return REG_NOERROR;
+}
+
+  /* Helper function for parse_bracket_exp.
+     Build the equivalence class which is represented by NAME.
+     The result are written to MBCSET and SBCSET.
+     EQUIV_CLASS_ALLOC is the allocated size of mbcset->equiv_classes,
+     is a pointer argument since we may update it.  */
+
+static reg_errcode_t
+build_equiv_class (bitset_t sbcset, re_charset_t *mbcset,
+                  Idx *equiv_class_alloc, const unsigned char *name)
+{
+#ifdef _LIBC
+  uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+  if (nrules != 0)
+    {
+      const int32_t *table, *indirect;
+      const unsigned char *weights, *extra, *cp;
+      unsigned char char_buf[2];
+      int32_t idx1, idx2;
+      unsigned int ch;
+      size_t len;
+      /* Calculate the index for equivalence class.  */
+      cp = name;
+      table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
+      weights = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
+                                              _NL_COLLATE_WEIGHTMB);
+      extra = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
+                                                  _NL_COLLATE_EXTRAMB);
+      indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
+                                               _NL_COLLATE_INDIRECTMB);
+      idx1 = findidx (table, indirect, extra, &cp, -1);
+      if (__glibc_unlikely (idx1 == 0 || *cp != '\0'))
+       /* This isn't a valid character.  */
+       return REG_ECOLLATE;
+
+      /* Build single byte matching table for this equivalence class.  */
+      len = weights[idx1 & 0xffffff];
+      for (ch = 0; ch < SBC_MAX; ++ch)
+       {
+         char_buf[0] = ch;
+         cp = char_buf;
+         idx2 = findidx (table, indirect, extra, &cp, 1);
+/*
+         idx2 = table[ch];
+*/
+         if (idx2 == 0)
+           /* This isn't a valid character.  */
+           continue;
+         /* Compare only if the length matches and the collation rule
+            index is the same.  */
+         if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24)
+             && memcmp (weights + (idx1 & 0xffffff) + 1,
+                        weights + (idx2 & 0xffffff) + 1, len) == 0)
+           bitset_set (sbcset, ch);
+       }
+      /* Check whether the array has enough space.  */
+      if (__glibc_unlikely (*equiv_class_alloc == mbcset->nequiv_classes))
+       {
+         /* Not enough, realloc it.  */
+         /* +1 in case of mbcset->nequiv_classes is 0.  */
+         Idx new_equiv_class_alloc = 2 * mbcset->nequiv_classes + 1;
+         /* Use realloc since the array is NULL if *alloc == 0.  */
+         int32_t *new_equiv_classes = re_realloc (mbcset->equiv_classes,
+                                                  int32_t,
+                                                  new_equiv_class_alloc);
+         if (__glibc_unlikely (new_equiv_classes == NULL))
+           return REG_ESPACE;
+         mbcset->equiv_classes = new_equiv_classes;
+         *equiv_class_alloc = new_equiv_class_alloc;
+       }
+      mbcset->equiv_classes[mbcset->nequiv_classes++] = idx1;
+    }
+  else
+#endif /* _LIBC */
+    {
+      if (__glibc_unlikely (strlen ((const char *) name) != 1))
+       return REG_ECOLLATE;
+      bitset_set (sbcset, *name);
+    }
+  return REG_NOERROR;
+}
+
+  /* Helper function for parse_bracket_exp.
+     Build the character class which is represented by NAME.
+     The result are written to MBCSET and SBCSET.
+     CHAR_CLASS_ALLOC is the allocated size of mbcset->char_classes,
+     is a pointer argument since we may update it.  */
+
+static reg_errcode_t
+build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
+                re_charset_t *mbcset, Idx *char_class_alloc,
+                const char *class_name, reg_syntax_t syntax)
+{
+  int i;
+  const char *name = class_name;
+
+  /* In case of REG_ICASE "upper" and "lower" match the both of
+     upper and lower cases.  */
+  if ((syntax & RE_ICASE)
+      && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0))
+    name = "alpha";
+
+  /* Check the space of the arrays.  */
+  if (__glibc_unlikely (*char_class_alloc == mbcset->nchar_classes))
+    {
+      /* Not enough, realloc it.  */
+      /* +1 in case of mbcset->nchar_classes is 0.  */
+      Idx new_char_class_alloc = 2 * mbcset->nchar_classes + 1;
+      /* Use realloc since array is NULL if *alloc == 0.  */
+      wctype_t *new_char_classes = re_realloc (mbcset->char_classes, wctype_t,
+                                              new_char_class_alloc);
+      if (__glibc_unlikely (new_char_classes == NULL))
+       return REG_ESPACE;
+      mbcset->char_classes = new_char_classes;
+      *char_class_alloc = new_char_class_alloc;
+    }
+  mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name);
+
+#define BUILD_CHARCLASS_LOOP(ctype_func)       \
+  do {                                         \
+    if (__glibc_unlikely (trans != NULL))                      \
+      {                                                \
+       for (i = 0; i < SBC_MAX; ++i)           \
+         if (ctype_func (i))                   \
+           bitset_set (sbcset, trans[i]);      \
+      }                                                \
+    else                                       \
+      {                                                \
+       for (i = 0; i < SBC_MAX; ++i)           \
+         if (ctype_func (i))                   \
+           bitset_set (sbcset, i);             \
+      }                                                \
+  } while (0)
+
+  if (strcmp (name, "alnum") == 0)
+    BUILD_CHARCLASS_LOOP (isalnum);
+  else if (strcmp (name, "cntrl") == 0)
+    BUILD_CHARCLASS_LOOP (iscntrl);
+  else if (strcmp (name, "lower") == 0)
+    BUILD_CHARCLASS_LOOP (islower);
+  else if (strcmp (name, "space") == 0)
+    BUILD_CHARCLASS_LOOP (isspace);
+  else if (strcmp (name, "alpha") == 0)
+    BUILD_CHARCLASS_LOOP (isalpha);
+  else if (strcmp (name, "digit") == 0)
+    BUILD_CHARCLASS_LOOP (isdigit);
+  else if (strcmp (name, "print") == 0)
+    BUILD_CHARCLASS_LOOP (isprint);
+  else if (strcmp (name, "upper") == 0)
+    BUILD_CHARCLASS_LOOP (isupper);
+  else if (strcmp (name, "blank") == 0)
+    BUILD_CHARCLASS_LOOP (isblank);
+  else if (strcmp (name, "graph") == 0)
+    BUILD_CHARCLASS_LOOP (isgraph);
+  else if (strcmp (name, "punct") == 0)
+    BUILD_CHARCLASS_LOOP (ispunct);
+  else if (strcmp (name, "xdigit") == 0)
+    BUILD_CHARCLASS_LOOP (isxdigit);
+  else
+    return REG_ECTYPE;
+
+  return REG_NOERROR;
+}
+
+static bin_tree_t *
+build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
+                   const char *class_name,
+                   const char *extra, bool non_match,
+                   reg_errcode_t *err)
+{
+  re_bitset_ptr_t sbcset;
+  re_charset_t *mbcset;
+  Idx alloc = 0;
+  reg_errcode_t ret;
+  bin_tree_t *tree;
+
+  sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
+  if (__glibc_unlikely (sbcset == NULL))
+    {
+      *err = REG_ESPACE;
+      return NULL;
+    }
+  mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
+  if (__glibc_unlikely (mbcset == NULL))
+    {
+      re_free (sbcset);
+      *err = REG_ESPACE;
+      return NULL;
+    }
+  mbcset->non_match = non_match;
+
+  /* We don't care the syntax in this case.  */
+  ret = build_charclass (trans, sbcset, mbcset, &alloc, class_name, 0);
+
+  if (__glibc_unlikely (ret != REG_NOERROR))
+    {
+      re_free (sbcset);
+      free_charset (mbcset);
+      *err = ret;
+      return NULL;
+    }
+  /* \w match '_' also.  */
+  for (; *extra; extra++)
+    bitset_set (sbcset, *extra);
+
+  /* If it is non-matching list.  */
+  if (non_match)
+    bitset_not (sbcset);
+
+  /* Ensure only single byte characters are set.  */
+  if (dfa->mb_cur_max > 1)
+    bitset_mask (sbcset, dfa->sb_char);
+
+  /* Build a tree for simple bracket.  */
+  re_token_t br_token = { .type = SIMPLE_BRACKET, .opr.sbcset = sbcset };
+  tree = create_token_tree (dfa, NULL, NULL, &br_token);
+  if (__glibc_unlikely (tree == NULL))
+    goto build_word_op_espace;
+
+  if (dfa->mb_cur_max > 1)
+    {
+      bin_tree_t *mbc_tree;
+      /* Build a tree for complex bracket.  */
+      br_token.type = COMPLEX_BRACKET;
+      br_token.opr.mbcset = mbcset;
+      dfa->has_mb_node = 1;
+      mbc_tree = create_token_tree (dfa, NULL, NULL, &br_token);
+      if (__glibc_unlikely (mbc_tree == NULL))
+       goto build_word_op_espace;
+      /* Then join them by ALT node.  */
+      tree = create_tree (dfa, tree, mbc_tree, OP_ALT);
+      if (__glibc_likely (mbc_tree != NULL))
+       return tree;
+    }
+  else
+    {
+      free_charset (mbcset);
+      return tree;
+    }
+
+ build_word_op_espace:
+  re_free (sbcset);
+  free_charset (mbcset);
+  *err = REG_ESPACE;
+  return NULL;
+}
+
+/* This is intended for the expressions like "a{1,3}".
+   Fetch a number from 'input', and return the number.
+   Return -1 if the number field is empty like "{,1}".
+   Return RE_DUP_MAX + 1 if the number field is too large.
+   Return -2 if an error occurred.  */
+
+static Idx
+fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax)
+{
+  Idx num = -1;
+  unsigned char c;
+  while (1)
+    {
+      fetch_token (token, input, syntax);
+      c = token->opr.c;
+      if (__glibc_unlikely (token->type == END_OF_RE))
+       return -2;
+      if (token->type == OP_CLOSE_DUP_NUM || c == ',')
+       break;
+      num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2)
+            ? -2
+            : num == -1
+            ? c - '0'
+            : MIN (RE_DUP_MAX + 1, num * 10 + c - '0'));
+    }
+  return num;
+}
+\f
+static void
+free_charset (re_charset_t *cset)
+{
+  re_free (cset->mbchars);
+#ifdef _LIBC
+  re_free (cset->coll_syms);
+  re_free (cset->equiv_classes);
+#endif
+  re_free (cset->range_starts);
+  re_free (cset->range_ends);
+  re_free (cset->char_classes);
+  re_free (cset);
+}
+\f
+/* Functions for binary tree operation.  */
+
+/* Create a tree node.  */
+
+static bin_tree_t *
+create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
+            re_token_type_t type)
+{
+  re_token_t t = { .type = type };
+  return create_token_tree (dfa, left, right, &t);
+}
+
+static bin_tree_t *
+create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
+                  const re_token_t *token)
+{
+  bin_tree_t *tree;
+  if (__glibc_unlikely (dfa->str_tree_storage_idx == BIN_TREE_STORAGE_SIZE))
+    {
+      bin_tree_storage_t *storage = re_malloc (bin_tree_storage_t, 1);
+
+      if (storage == NULL)
+       return NULL;
+      storage->next = dfa->str_tree_storage;
+      dfa->str_tree_storage = storage;
+      dfa->str_tree_storage_idx = 0;
+    }
+  tree = &dfa->str_tree_storage->data[dfa->str_tree_storage_idx++];
+
+  tree->parent = NULL;
+  tree->left = left;
+  tree->right = right;
+  tree->token = *token;
+  tree->token.duplicated = 0;
+  tree->token.opt_subexp = 0;
+  tree->first = NULL;
+  tree->next = NULL;
+  tree->node_idx = -1;
+
+  if (left != NULL)
+    left->parent = tree;
+  if (right != NULL)
+    right->parent = tree;
+  return tree;
+}
+
+/* Mark the tree SRC as an optional subexpression.
+   To be called from preorder or postorder.  */
+
+static reg_errcode_t
+mark_opt_subexp (void *extra, bin_tree_t *node)
+{
+  Idx idx = (uintptr_t) extra;
+  if (node->token.type == SUBEXP && node->token.opr.idx == idx)
+    node->token.opt_subexp = 1;
+
+  return REG_NOERROR;
+}
+
+/* Free the allocated memory inside NODE. */
+
+static void
+free_token (re_token_t *node)
+{
+  if (node->type == COMPLEX_BRACKET && node->duplicated == 0)
+    free_charset (node->opr.mbcset);
+  else if (node->type == SIMPLE_BRACKET && node->duplicated == 0)
+    re_free (node->opr.sbcset);
+}
+
+/* Worker function for tree walking.  Free the allocated memory inside NODE
+   and its children. */
+
+static reg_errcode_t
+free_tree (void *extra, bin_tree_t *node)
+{
+  free_token (&node->token);
+  return REG_NOERROR;
+}
+
+
+/* Duplicate the node SRC, and return new node.  This is a preorder
+   visit similar to the one implemented by the generic visitor, but
+   we need more infrastructure to maintain two parallel trees --- so,
+   it's easier to duplicate.  */
+
+static bin_tree_t *
+duplicate_tree (const bin_tree_t *root, re_dfa_t *dfa)
+{
+  const bin_tree_t *node;
+  bin_tree_t *dup_root;
+  bin_tree_t **p_new = &dup_root, *dup_node = root->parent;
+
+  for (node = root; ; )
+    {
+      /* Create a new tree and link it back to the current parent.  */
+      *p_new = create_token_tree (dfa, NULL, NULL, &node->token);
+      if (*p_new == NULL)
+       return NULL;
+      (*p_new)->parent = dup_node;
+      (*p_new)->token.duplicated = 1;
+      dup_node = *p_new;
+
+      /* Go to the left node, or up and to the right.  */
+      if (node->left)
+       {
+         node = node->left;
+         p_new = &dup_node->left;
+       }
+      else
+       {
+         const bin_tree_t *prev = NULL;
+         while (node->right == prev || node->right == NULL)
+           {
+             prev = node;
+             node = node->parent;
+             dup_node = dup_node->parent;
+             if (!node)
+               return dup_root;
+           }
+         node = node->right;
+         p_new = &dup_node->right;
+       }
+    }
+}
deleted file mode 120000 (symlink)
index f176239a5ead87423a693fa11c77aac1c37e7b6a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/regex.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3beb0deb98717e9b684b4069d60d490780ce4fb6
--- /dev/null
@@ -0,0 +1,84 @@
+/* Extended regular expression matching and search library.
+   Copyright (C) 2002-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#define __STDC_WANT_IEC_60559_BFP_EXT__
+
+#ifndef _LIBC
+# include <libc-config.h>
+
+# if __GNUC_PREREQ (4, 6)
+#  pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+#  pragma GCC diagnostic ignored "-Wvla"
+# endif
+# if __GNUC_PREREQ (4, 3)
+#  pragma GCC diagnostic ignored "-Wold-style-definition"
+#  pragma GCC diagnostic ignored "-Wtype-limits"
+# endif
+#endif
+
+/* Make sure no one compiles this code with a C++ compiler.  */
+#if defined __cplusplus && defined _LIBC
+# error "This is C code, use a C compiler"
+#endif
+
+#ifdef _LIBC
+/* We have to keep the namespace clean.  */
+# define regfree(preg) __regfree (preg)
+# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
+# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
+# define regerror(errcode, preg, errbuf, errbuf_size) \
+       __regerror(errcode, preg, errbuf, errbuf_size)
+# define re_set_registers(bu, re, nu, st, en) \
+       __re_set_registers (bu, re, nu, st, en)
+# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
+       __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
+# define re_match(bufp, string, size, pos, regs) \
+       __re_match (bufp, string, size, pos, regs)
+# define re_search(bufp, string, size, startpos, range, regs) \
+       __re_search (bufp, string, size, startpos, range, regs)
+# define re_compile_pattern(pattern, length, bufp) \
+       __re_compile_pattern (pattern, length, bufp)
+# define re_set_syntax(syntax) __re_set_syntax (syntax)
+# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
+       __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
+# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
+
+# include "../locale/localeinfo.h"
+#endif
+
+/* On some systems, limits.h sets RE_DUP_MAX to a lower value than
+   GNU regex allows.  Include it before <regex.h>, which correctly
+   #undefs RE_DUP_MAX and sets it to the right value.  */
+#include <limits.h>
+
+#include <regex.h>
+#include "regex_internal.h"
+
+#include "regex_internal.c"
+#include "regcomp.c"
+#include "regexec.c"
+
+/* Binary backward compatibility.  */
+#if _LIBC
+# include <shlib-compat.h>
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
+link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
+int re_max_failures = 2000;
+# endif
+#endif
deleted file mode 120000 (symlink)
index 55946a69e425b351aedb5ce684e4974fe87634ff..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/regex.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9ef0252ffff2c63684ba4b9af2b3d328c04f4bae
--- /dev/null
@@ -0,0 +1,699 @@
+/* Definitions for data structures and routines for the regular
+   expression library.
+   Copyright (C) 1985, 1989-2023 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _REGEX_H
+#define _REGEX_H 1
+
+#include <sys/types.h>
+
+/* Allow the use in C++ code.  */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Define __USE_GNU to declare GNU extensions that violate the
+   POSIX name space rules.  */
+#ifdef _GNU_SOURCE
+# define __USE_GNU 1
+#endif
+
+#ifdef _REGEX_LARGE_OFFSETS
+
+/* Use types and values that are wide enough to represent signed and
+   unsigned byte offsets in memory.  This currently works only when
+   the regex code is used outside of the GNU C library; it is not yet
+   supported within glibc itself, and glibc users should not define
+   _REGEX_LARGE_OFFSETS.  */
+
+/* The type of object sizes.  */
+typedef size_t __re_size_t;
+
+/* The type of object sizes, in places where the traditional code
+   uses unsigned long int.  */
+typedef size_t __re_long_size_t;
+
+#else
+
+/* The traditional GNU regex implementation mishandles strings longer
+   than INT_MAX.  */
+typedef unsigned int __re_size_t;
+typedef unsigned long int __re_long_size_t;
+
+#endif
+
+/* The following two types have to be signed and unsigned integer type
+   wide enough to hold a value of a pointer.  For most ANSI compilers
+   ptrdiff_t and size_t should be likely OK.  Still size of these two
+   types is 2 for Microsoft C.  Ugh... */
+typedef long int s_reg_t;
+typedef unsigned long int active_reg_t;
+
+/* The following bits are used to determine the regexp syntax we
+   recognize.  The set/not-set meanings are chosen so that Emacs syntax
+   remains the value 0.  The bits are given in alphabetical order, and
+   the definitions shifted by one from the previous bit; thus, when we
+   add or remove a bit, only one other definition need change.  */
+typedef unsigned long int reg_syntax_t;
+
+#ifdef __USE_GNU
+/* If this bit is not set, then \ inside a bracket expression is literal.
+   If set, then such a \ quotes the following character.  */
+# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
+
+/* If this bit is not set, then + and ? are operators, and \+ and \? are
+     literals.
+   If set, then \+ and \? are operators and + and ? are literals.  */
+# define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
+
+/* If this bit is set, then character classes are supported.  They are:
+     [:alpha:], [:upper:], [:lower:],  [:digit:], [:alnum:], [:xdigit:],
+     [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
+   If not set, then character classes are not supported.  */
+# define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
+
+/* If this bit is set, then ^ and $ are always anchors (outside bracket
+     expressions, of course).
+   If this bit is not set, then it depends:
+       ^  is an anchor if it is at the beginning of a regular
+          expression or after an open-group or an alternation operator;
+       $  is an anchor if it is at the end of a regular expression, or
+          before a close-group or an alternation operator.
+
+   This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
+   POSIX draft 11.2 says that * etc. in leading positions is undefined.
+   We already implemented a previous draft which made those constructs
+   invalid, though, so we haven't changed the code back.  */
+# define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
+
+/* If this bit is set, then special characters are always special
+     regardless of where they are in the pattern.
+   If this bit is not set, then special characters are special only in
+     some contexts; otherwise they are ordinary.  Specifically,
+     * + ? and intervals are only special when not after the beginning,
+     open-group, or alternation operator.  */
+# define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
+
+/* If this bit is set, then *, +, ?, and { cannot be first in an re or
+     immediately after an alternation or begin-group operator.  */
+# define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
+
+/* If this bit is set, then . matches newline.
+   If not set, then it doesn't.  */
+# define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
+
+/* If this bit is set, then . doesn't match NUL.
+   If not set, then it does.  */
+# define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
+
+/* If this bit is set, nonmatching lists [^...] do not match newline.
+   If not set, they do.  */
+# define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
+
+/* If this bit is set, either \{...\} or {...} defines an
+     interval, depending on RE_NO_BK_BRACES.
+   If not set, \{, \}, {, and } are literals.  */
+# define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
+
+/* If this bit is set, +, ? and | aren't recognized as operators.
+   If not set, they are.  */
+# define RE_LIMITED_OPS (RE_INTERVALS << 1)
+
+/* If this bit is set, newline is an alternation operator.
+   If not set, newline is literal.  */
+# define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
+
+/* If this bit is set, then '{...}' defines an interval, and \{ and \}
+     are literals.
+  If not set, then '\{...\}' defines an interval.  */
+# define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
+
+/* If this bit is set, (...) defines a group, and \( and \) are literals.
+   If not set, \(...\) defines a group, and ( and ) are literals.  */
+# define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
+
+/* If this bit is set, then \<digit> matches <digit>.
+   If not set, then \<digit> is a back-reference.  */
+# define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
+
+/* If this bit is set, then | is an alternation operator, and \| is literal.
+   If not set, then \| is an alternation operator, and | is literal.  */
+# define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
+
+/* If this bit is set, then an ending range point collating higher
+     than the starting range point, as in [z-a], is invalid.
+   If not set, then when ending range point collates higher than the
+     starting range point, the range is ignored.  */
+# define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
+
+/* If this bit is set, then an unmatched ) is ordinary.
+   If not set, then an unmatched ) is invalid.  */
+# define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
+
+/* If this bit is set, succeed as soon as we match the whole pattern,
+   without further backtracking.  */
+# define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
+
+/* If this bit is set, do not process the GNU regex operators.
+   If not set, then the GNU regex operators are recognized. */
+# define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
+
+/* If this bit is set, turn on internal regex debugging.
+   If not set, and debugging was on, turn it off.
+   This only works if regex.c is compiled -DDEBUG.
+   We define this bit always, so that all that's needed to turn on
+   debugging is to recompile regex.c; the calling code can always have
+   this bit set, and it won't affect anything in the normal case. */
+# define RE_DEBUG (RE_NO_GNU_OPS << 1)
+
+/* If this bit is set, a syntactically invalid interval is treated as
+   a string of ordinary characters.  For example, the ERE 'a{1' is
+   treated as 'a\{1'.  */
+# define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
+
+/* If this bit is set, then ignore case when matching.
+   If not set, then case is significant.  */
+# define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
+
+/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
+   for ^, because it is difficult to scan the regex backwards to find
+   whether ^ should be special.  */
+# define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
+
+/* If this bit is set, then \{ cannot be first in a regex or
+   immediately after an alternation, open-group or \} operator.  */
+# define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
+
+/* If this bit is set, then no_sub will be set to 1 during
+   re_compile_pattern.  */
+# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
+#endif
+
+/* This global variable defines the particular regexp syntax to use (for
+   some interfaces).  When a regexp is compiled, the syntax used is
+   stored in the pattern buffer, so changing this does not affect
+   already-compiled regexps.  */
+extern reg_syntax_t re_syntax_options;
+\f
+#ifdef __USE_GNU
+/* Define combinations of the above bits for the standard possibilities.
+   (The [[[ comments delimit what gets put into the Texinfo file, so
+   don't delete them!)  */
+/* [[[begin syntaxes]]] */
+# define RE_SYNTAX_EMACS 0
+
+# define RE_SYNTAX_AWK                                                 \
+  (RE_BACKSLASH_ESCAPE_IN_LISTS   | RE_DOT_NOT_NULL                    \
+   | RE_NO_BK_PARENS              | RE_NO_BK_REFS                      \
+   | RE_NO_BK_VBAR                | RE_NO_EMPTY_RANGES                 \
+   | RE_DOT_NEWLINE              | RE_CONTEXT_INDEP_ANCHORS            \
+   | RE_CHAR_CLASSES                                                   \
+   | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
+
+# define RE_SYNTAX_GNU_AWK                                             \
+  ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS            \
+    | RE_INVALID_INTERVAL_ORD)                                         \
+   & ~(RE_DOT_NOT_NULL | RE_CONTEXT_INDEP_OPS                          \
+      | RE_CONTEXT_INVALID_OPS ))
+
+# define RE_SYNTAX_POSIX_AWK                                           \
+  (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS             \
+   | RE_INTERVALS          | RE_NO_GNU_OPS                             \
+   | RE_INVALID_INTERVAL_ORD)
+
+# define RE_SYNTAX_GREP                                                        \
+  ((RE_SYNTAX_POSIX_BASIC | RE_NEWLINE_ALT)                            \
+   & ~(RE_CONTEXT_INVALID_DUP | RE_DOT_NOT_NULL))
+
+# define RE_SYNTAX_EGREP                                               \
+  ((RE_SYNTAX_POSIX_EXTENDED | RE_INVALID_INTERVAL_ORD | RE_NEWLINE_ALT) \
+   & ~(RE_CONTEXT_INVALID_OPS | RE_DOT_NOT_NULL))
+
+/* POSIX grep -E behavior is no longer incompatible with GNU.  */
+# define RE_SYNTAX_POSIX_EGREP                                         \
+  RE_SYNTAX_EGREP
+
+/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */
+# define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
+
+# define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
+
+/* Syntax bits common to both basic and extended POSIX regex syntax.  */
+# define _RE_SYNTAX_POSIX_COMMON                                       \
+  (RE_CHAR_CLASSES | RE_DOT_NEWLINE      | RE_DOT_NOT_NULL             \
+   | RE_INTERVALS  | RE_NO_EMPTY_RANGES)
+
+# define RE_SYNTAX_POSIX_BASIC                                         \
+  (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
+
+/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
+   RE_LIMITED_OPS, i.e., \? \+ \| are not recognized.  Actually, this
+   isn't minimal, since other operators, such as \`, aren't disabled.  */
+# define RE_SYNTAX_POSIX_MINIMAL_BASIC                                 \
+  (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
+
+# define RE_SYNTAX_POSIX_EXTENDED                                      \
+  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS                 \
+   | RE_CONTEXT_INDEP_OPS   | RE_NO_BK_BRACES                          \
+   | RE_NO_BK_PARENS        | RE_NO_BK_VBAR                            \
+   | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
+
+/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
+   removed and RE_NO_BK_REFS is added.  */
+# define RE_SYNTAX_POSIX_MINIMAL_EXTENDED                              \
+  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS                 \
+   | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES                          \
+   | RE_NO_BK_PARENS        | RE_NO_BK_REFS                            \
+   | RE_NO_BK_VBAR         | RE_UNMATCHED_RIGHT_PAREN_ORD)
+/* [[[end syntaxes]]] */
+
+/* Maximum number of duplicates an interval can allow.  POSIX-conforming
+   systems might define this in <limits.h>, but we want our
+   value, so remove any previous define.  */
+# ifdef _REGEX_INCLUDE_LIMITS_H
+#  include <limits.h>
+# endif
+# ifdef RE_DUP_MAX
+#  undef RE_DUP_MAX
+# endif
+
+/* RE_DUP_MAX is 2**15 - 1 because an earlier implementation stored
+   the counter as a 2-byte signed integer.  This is no longer true, so
+   RE_DUP_MAX could be increased to (INT_MAX / 10 - 1), or to
+   ((SIZE_MAX - 9) / 10) if _REGEX_LARGE_OFFSETS is defined.
+   However, there would be a huge performance problem if someone
+   actually used a pattern like a\{214748363\}, so RE_DUP_MAX retains
+   its historical value.  */
+# define RE_DUP_MAX (0x7fff)
+#endif
+
+
+/* POSIX 'cflags' bits (i.e., information for 'regcomp').  */
+
+/* If this bit is set, then use extended regular expression syntax.
+   If not set, then use basic regular expression syntax.  */
+#define REG_EXTENDED 1
+
+/* If this bit is set, then ignore case when matching.
+   If not set, then case is significant.  */
+#define REG_ICASE (1 << 1)
+
+/* If this bit is set, then anchors do not match at newline
+     characters in the string.
+   If not set, then anchors do match at newlines.  */
+#define REG_NEWLINE (1 << 2)
+
+/* If this bit is set, then report only success or fail in regexec.
+   If not set, then returns differ between not matching and errors.  */
+#define REG_NOSUB (1 << 3)
+
+
+/* POSIX 'eflags' bits (i.e., information for regexec).  */
+
+/* If this bit is set, then the beginning-of-line operator doesn't match
+     the beginning of the string (presumably because it's not the
+     beginning of a line).
+   If not set, then the beginning-of-line operator does match the
+     beginning of the string.  */
+#define REG_NOTBOL 1
+
+/* Like REG_NOTBOL, except for the end-of-line.  */
+#define REG_NOTEOL (1 << 1)
+
+/* Use PMATCH[0] to delimit the start and end of the search in the
+   buffer.  */
+#define REG_STARTEND (1 << 2)
+
+
+/* If any error codes are removed, changed, or added, update the
+   '__re_error_msgid' table in regcomp.c.  */
+
+typedef enum
+{
+  _REG_ENOSYS = -1,    /* This will never happen for this implementation.  */
+  _REG_NOERROR = 0,    /* Success.  */
+  _REG_NOMATCH,                /* Didn't find a match (for regexec).  */
+
+  /* POSIX regcomp return error codes.  (In the order listed in the
+     standard.)  */
+  _REG_BADPAT,         /* Invalid pattern.  */
+  _REG_ECOLLATE,       /* Invalid collating element.  */
+  _REG_ECTYPE,         /* Invalid character class name.  */
+  _REG_EESCAPE,                /* Trailing backslash.  */
+  _REG_ESUBREG,                /* Invalid back reference.  */
+  _REG_EBRACK,         /* Unmatched left bracket.  */
+  _REG_EPAREN,         /* Parenthesis imbalance.  */
+  _REG_EBRACE,         /* Unmatched \{.  */
+  _REG_BADBR,          /* Invalid contents of \{\}.  */
+  _REG_ERANGE,         /* Invalid range end.  */
+  _REG_ESPACE,         /* Ran out of memory.  */
+  _REG_BADRPT,         /* No preceding re for repetition op.  */
+
+  /* Error codes we've added.  */
+  _REG_EEND,           /* Premature end.  */
+  _REG_ESIZE,          /* Too large (e.g., repeat count too large).  */
+  _REG_ERPAREN         /* Unmatched ) or \); not returned from regcomp.  */
+} reg_errcode_t;
+
+#if defined _XOPEN_SOURCE || defined __USE_XOPEN2K
+# define REG_ENOSYS    _REG_ENOSYS
+#endif
+#define REG_NOERROR    _REG_NOERROR
+#define REG_NOMATCH    _REG_NOMATCH
+#define REG_BADPAT     _REG_BADPAT
+#define REG_ECOLLATE   _REG_ECOLLATE
+#define REG_ECTYPE     _REG_ECTYPE
+#define REG_EESCAPE    _REG_EESCAPE
+#define REG_ESUBREG    _REG_ESUBREG
+#define REG_EBRACK     _REG_EBRACK
+#define REG_EPAREN     _REG_EPAREN
+#define REG_EBRACE     _REG_EBRACE
+#define REG_BADBR      _REG_BADBR
+#define REG_ERANGE     _REG_ERANGE
+#define REG_ESPACE     _REG_ESPACE
+#define REG_BADRPT     _REG_BADRPT
+#define REG_EEND       _REG_EEND
+#define REG_ESIZE      _REG_ESIZE
+#define REG_ERPAREN    _REG_ERPAREN
+\f
+/* This data structure represents a compiled pattern.  Before calling
+   the pattern compiler, the fields 'buffer', 'allocated', 'fastmap',
+   and 'translate' can be set.  After the pattern has been compiled,
+   the fields 're_nsub', 'not_bol' and 'not_eol' are available.  All
+   other fields are private to the regex routines.  */
+
+#ifndef RE_TRANSLATE_TYPE
+# define __RE_TRANSLATE_TYPE unsigned char *
+# ifdef __USE_GNU
+#  define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE
+# endif
+#endif
+
+#ifdef __USE_GNU
+# define __REPB_PREFIX(name) name
+#else
+# define __REPB_PREFIX(name) __##name
+#endif
+
+struct re_pattern_buffer
+{
+  /* Space that holds the compiled pattern.  The type
+     'struct re_dfa_t' is private and is not declared here.  */
+  struct re_dfa_t *__REPB_PREFIX(buffer);
+
+  /* Number of bytes to which 'buffer' points.  */
+  __re_long_size_t __REPB_PREFIX(allocated);
+
+  /* Number of bytes actually used in 'buffer'.  */
+  __re_long_size_t __REPB_PREFIX(used);
+
+  /* Syntax setting with which the pattern was compiled.  */
+  reg_syntax_t __REPB_PREFIX(syntax);
+
+  /* Pointer to a fastmap, if any, otherwise zero.  re_search uses the
+     fastmap, if there is one, to skip over impossible starting points
+     for matches.  */
+  char *__REPB_PREFIX(fastmap);
+
+  /* Either a translate table to apply to all characters before
+     comparing them, or zero for no translation.  The translation is
+     applied to a pattern when it is compiled and to a string when it
+     is matched.  */
+  __RE_TRANSLATE_TYPE __REPB_PREFIX(translate);
+
+  /* Number of subexpressions found by the compiler.  */
+  size_t re_nsub;
+
+  /* Zero if this pattern cannot match the empty string, one else.
+     Well, in truth it's used only in 're_search_2', to see whether or
+     not we should use the fastmap, so we don't set this absolutely
+     perfectly; see 're_compile_fastmap' (the "duplicate" case).  */
+  unsigned __REPB_PREFIX(can_be_null) : 1;
+
+  /* If REGS_UNALLOCATED, allocate space in the 'regs' structure
+     for 'max (RE_NREGS, re_nsub + 1)' groups.
+     If REGS_REALLOCATE, reallocate space if necessary.
+     If REGS_FIXED, use what's there.  */
+#ifdef __USE_GNU
+# define REGS_UNALLOCATED 0
+# define REGS_REALLOCATE 1
+# define REGS_FIXED 2
+#endif
+  unsigned __REPB_PREFIX(regs_allocated) : 2;
+
+  /* Set to zero when 're_compile_pattern' compiles a pattern; set to
+     one by 're_compile_fastmap' if it updates the fastmap.  */
+  unsigned __REPB_PREFIX(fastmap_accurate) : 1;
+
+  /* If set, 're_match_2' does not return information about
+     subexpressions.  */
+  unsigned __REPB_PREFIX(no_sub) : 1;
+
+  /* If set, a beginning-of-line anchor doesn't match at the beginning
+     of the string.  */
+  unsigned __REPB_PREFIX(not_bol) : 1;
+
+  /* Similarly for an end-of-line anchor.  */
+  unsigned __REPB_PREFIX(not_eol) : 1;
+
+  /* If true, an anchor at a newline matches.  */
+  unsigned __REPB_PREFIX(newline_anchor) : 1;
+};
+
+typedef struct re_pattern_buffer regex_t;
+\f
+/* Type for byte offsets within the string.  POSIX mandates this.  */
+#ifdef _REGEX_LARGE_OFFSETS
+/* POSIX 1003.1-2008 requires that regoff_t be at least as wide as
+   ptrdiff_t and ssize_t.  We don't know of any hosts where ptrdiff_t
+   is wider than ssize_t, so ssize_t is safe.  ptrdiff_t is not
+   visible here, so use ssize_t.  */
+typedef ssize_t regoff_t;
+#else
+/* The traditional GNU regex implementation mishandles strings longer
+   than INT_MAX.  */
+typedef int regoff_t;
+#endif
+
+
+#ifdef __USE_GNU
+/* This is the structure we store register match data in.  See
+   regex.texinfo for a full description of what registers match.  */
+struct re_registers
+{
+  __re_size_t num_regs;
+  regoff_t *start;
+  regoff_t *end;
+};
+
+
+/* If 'regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
+   're_match_2' returns information about at least this many registers
+   the first time a 'regs' structure is passed.  */
+# ifndef RE_NREGS
+#  define RE_NREGS 30
+# endif
+#endif
+
+
+/* POSIX specification for registers.  Aside from the different names than
+   're_registers', POSIX uses an array of structures, instead of a
+   structure of arrays.  */
+typedef struct
+{
+  regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */
+  regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */
+} regmatch_t;
+\f
+/* Declarations for routines.  */
+
+#ifndef _REGEX_NELTS
+# if (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
+       && !defined __STDC_NO_VLA__)
+#  define _REGEX_NELTS(n) n
+# else
+#  define _REGEX_NELTS(n)
+# endif
+#endif
+
+#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wvla"
+#endif
+
+#ifndef _Attr_access_
+# ifdef __attr_access
+#  define _Attr_access_(arg) __attr_access (arg)
+# elif defined __GNUC__ && 10 <= __GNUC__
+#  define _Attr_access_(x) __attribute__ ((__access__ x))
+# else
+#  define _Attr_access_(x)
+# endif
+#endif
+
+#ifdef __USE_GNU
+/* Sets the current default syntax to SYNTAX, and return the old syntax.
+   You can also simply assign to the 're_syntax_options' variable.  */
+extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
+
+/* Compile the regular expression PATTERN, with length LENGTH
+   and syntax given by the global 're_syntax_options', into the buffer
+   BUFFER.  Return NULL if successful, and an error string if not.
+
+   To free the allocated storage, you must call 'regfree' on BUFFER.
+   Note that the translate table must either have been initialized by
+   'regcomp', with a malloc'ed value, or set to NULL before calling
+   'regfree'.  */
+extern const char *re_compile_pattern (const char *__pattern, size_t __length,
+                                      struct re_pattern_buffer *__buffer)
+    _Attr_access_ ((__read_only__, 1, 2));
+
+
+/* Compile a fastmap for the compiled pattern in BUFFER; used to
+   accelerate searches.  Return 0 if successful and -2 if was an
+   internal error.  */
+extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
+
+
+/* Search in the string STRING (with length LENGTH) for the pattern
+   compiled into BUFFER.  Start searching at position START, for RANGE
+   characters.  Return the starting position of the match, -1 for no
+   match, or -2 for an internal error.  Also return register
+   information in REGS (if REGS and BUFFER->no_sub are nonzero).  */
+extern regoff_t re_search (struct re_pattern_buffer *__buffer,
+                          const char *__String, regoff_t __length,
+                          regoff_t __start, regoff_t __range,
+                          struct re_registers *__regs)
+    _Attr_access_ ((__read_only__, 2, 3));
+
+
+/* Like 're_search', but search in the concatenation of STRING1 and
+   STRING2.  Also, stop searching at index START + STOP.  */
+extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer,
+                            const char *__string1, regoff_t __length1,
+                            const char *__string2, regoff_t __length2,
+                            regoff_t __start, regoff_t __range,
+                            struct re_registers *__regs,
+                            regoff_t __stop)
+    _Attr_access_ ((__read_only__, 2, 3))
+    _Attr_access_ ((__read_only__, 4, 5));
+
+
+/* Like 're_search', but return how many characters in STRING the regexp
+   in BUFFER matched, starting at position START.  */
+extern regoff_t re_match (struct re_pattern_buffer *__buffer,
+                         const char *__String, regoff_t __length,
+                         regoff_t __start, struct re_registers *__regs)
+    _Attr_access_ ((__read_only__, 2, 3));
+
+
+/* Relates to 're_match' as 're_search_2' relates to 're_search'.  */
+extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
+                           const char *__string1, regoff_t __length1,
+                           const char *__string2, regoff_t __length2,
+                           regoff_t __start, struct re_registers *__regs,
+                           regoff_t __stop)
+    _Attr_access_ ((__read_only__, 2, 3))
+    _Attr_access_ ((__read_only__, 4, 5));
+
+
+/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
+   ENDS.  Subsequent matches using BUFFER and REGS will use this memory
+   for recording register information.  STARTS and ENDS must be
+   allocated with malloc, and must each be at least 'NUM_REGS * sizeof
+   (regoff_t)' bytes long.
+
+   If NUM_REGS == 0, then subsequent matches should allocate their own
+   register data.
+
+   Unless this function is called, the first search or match using
+   BUFFER will allocate its own register data, without
+   freeing the old data.  */
+extern void re_set_registers (struct re_pattern_buffer *__buffer,
+                             struct re_registers *__regs,
+                             __re_size_t __num_regs,
+                             regoff_t *__starts, regoff_t *__ends);
+#endif /* Use GNU */
+
+#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_MISC)
+/* 4.2 bsd compatibility.  */
+extern char *re_comp (const char *);
+extern int re_exec (const char *);
+#endif
+
+/* For plain 'restrict', use glibc's __restrict if defined.
+   Otherwise, GCC 2.95 and later have "__restrict"; C99 compilers have
+   "restrict", and "configure" may have defined "restrict".
+   Other compilers use __restrict, __restrict__, and _Restrict, and
+   'configure' might #define 'restrict' to those words, so pick a
+   different name.  */
+#ifndef _Restrict_
+# if defined __restrict \
+     || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
+     || __clang_major__ >= 3
+#  define _Restrict_ __restrict
+# elif 199901L <= __STDC_VERSION__ || defined restrict
+#  define _Restrict_ restrict
+# else
+#  define _Restrict_
+# endif
+#endif
+/* For the ISO C99 syntax
+     array_name[restrict]
+   use glibc's __restrict_arr if available.
+   Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode).
+   Other ISO C99 compilers support it as well.  */
+#ifndef _Restrict_arr_
+# ifdef __restrict_arr
+#  define _Restrict_arr_ __restrict_arr
+# elif ((199901L <= __STDC_VERSION__ \
+         || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \
+         || __clang_major__ >= 3) \
+        && !defined __cplusplus)
+#  define _Restrict_arr_ _Restrict_
+# else
+#  define _Restrict_arr_
+# endif
+#endif
+
+/* POSIX compatibility.  */
+extern int regcomp (regex_t *_Restrict_ __preg,
+                   const char *_Restrict_ __pattern,
+                   int __cflags);
+
+extern int regexec (const regex_t *_Restrict_ __preg,
+                   const char *_Restrict_ __String, size_t __nmatch,
+                   regmatch_t __pmatch[_Restrict_arr_
+                                       _REGEX_NELTS (__nmatch)],
+                   int __eflags);
+
+extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
+                       char *_Restrict_ __errbuf, size_t __errbuf_size)
+    _Attr_access_ ((__write_only__, 3, 4));
+
+extern void regfree (regex_t *__preg);
+
+#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+# pragma GCC diagnostic pop
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* C++ */
+
+#endif /* regex.h */
deleted file mode 120000 (symlink)
index be57ec5af15f62d1eb3c3572880f64cfac659433..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/regex_internal.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8cd096ebcfb054aebdb61d2fc2105de4aa042e60
--- /dev/null
+/* Extended regular expression matching and search library.
+   Copyright (C) 2002-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+static void re_string_construct_common (const char *str, Idx len,
+                                       re_string_t *pstr,
+                                       RE_TRANSLATE_TYPE trans, bool icase,
+                                       const re_dfa_t *dfa);
+static re_dfastate_t *create_ci_newstate (const re_dfa_t *dfa,
+                                         const re_node_set *nodes,
+                                         re_hashval_t hash);
+static re_dfastate_t *create_cd_newstate (const re_dfa_t *dfa,
+                                         const re_node_set *nodes,
+                                         unsigned int context,
+                                         re_hashval_t hash);
+static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
+                                               Idx new_buf_len);
+static void build_wcs_buffer (re_string_t *pstr);
+static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr);
+static void build_upper_buffer (re_string_t *pstr);
+static void re_string_translate_buffer (re_string_t *pstr);
+static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
+                                         int eflags) __attribute__ ((pure));
+\f
+/* Functions for string operation.  */
+
+/* This function allocate the buffers.  It is necessary to call
+   re_string_reconstruct before using the object.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_string_allocate (re_string_t *pstr, const char *str, Idx len, Idx init_len,
+                   RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa)
+{
+  reg_errcode_t ret;
+  Idx init_buf_len;
+
+  /* Ensure at least one character fits into the buffers.  */
+  if (init_len < dfa->mb_cur_max)
+    init_len = dfa->mb_cur_max;
+  init_buf_len = (len + 1 < init_len) ? len + 1: init_len;
+  re_string_construct_common (str, len, pstr, trans, icase, dfa);
+
+  ret = re_string_realloc_buffers (pstr, init_buf_len);
+  if (__glibc_unlikely (ret != REG_NOERROR))
+    return ret;
+
+  pstr->word_char = dfa->word_char;
+  pstr->word_ops_used = dfa->word_ops_used;
+  pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str;
+  pstr->valid_len = (pstr->mbs_allocated || dfa->mb_cur_max > 1) ? 0 : len;
+  pstr->valid_raw_len = pstr->valid_len;
+  return REG_NOERROR;
+}
+
+/* This function allocate the buffers, and initialize them.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_string_construct (re_string_t *pstr, const char *str, Idx len,
+                    RE_TRANSLATE_TYPE trans, bool icase, const re_dfa_t *dfa)
+{
+  reg_errcode_t ret;
+  memset (pstr, '\0', sizeof (re_string_t));
+  re_string_construct_common (str, len, pstr, trans, icase, dfa);
+
+  if (len > 0)
+    {
+      ret = re_string_realloc_buffers (pstr, len + 1);
+      if (__glibc_unlikely (ret != REG_NOERROR))
+       return ret;
+    }
+  pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str;
+
+  if (icase)
+    {
+      if (dfa->mb_cur_max > 1)
+       {
+         while (1)
+           {
+             ret = build_wcs_upper_buffer (pstr);
+             if (__glibc_unlikely (ret != REG_NOERROR))
+               return ret;
+             if (pstr->valid_raw_len >= len)
+               break;
+             if (pstr->bufs_len > pstr->valid_len + dfa->mb_cur_max)
+               break;
+             ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
+             if (__glibc_unlikely (ret != REG_NOERROR))
+               return ret;
+           }
+       }
+      else
+       build_upper_buffer (pstr);
+    }
+  else
+    {
+      if (dfa->mb_cur_max > 1)
+       build_wcs_buffer (pstr);
+      else
+       {
+         if (trans != NULL)
+           re_string_translate_buffer (pstr);
+         else
+           {
+             pstr->valid_len = pstr->bufs_len;
+             pstr->valid_raw_len = pstr->bufs_len;
+           }
+       }
+    }
+
+  return REG_NOERROR;
+}
+
+/* Helper functions for re_string_allocate, and re_string_construct.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len)
+{
+  if (pstr->mb_cur_max > 1)
+    {
+      wint_t *new_wcs;
+
+      /* Avoid overflow in realloc.  */
+      const size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx));
+      if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / max_object_size)
+                           < new_buf_len))
+       return REG_ESPACE;
+
+      new_wcs = re_realloc (pstr->wcs, wint_t, new_buf_len);
+      if (__glibc_unlikely (new_wcs == NULL))
+       return REG_ESPACE;
+      pstr->wcs = new_wcs;
+      if (pstr->offsets != NULL)
+       {
+         Idx *new_offsets = re_realloc (pstr->offsets, Idx, new_buf_len);
+         if (__glibc_unlikely (new_offsets == NULL))
+           return REG_ESPACE;
+         pstr->offsets = new_offsets;
+       }
+    }
+  if (pstr->mbs_allocated)
+    {
+      unsigned char *new_mbs = re_realloc (pstr->mbs, unsigned char,
+                                          new_buf_len);
+      if (__glibc_unlikely (new_mbs == NULL))
+       return REG_ESPACE;
+      pstr->mbs = new_mbs;
+    }
+  pstr->bufs_len = new_buf_len;
+  return REG_NOERROR;
+}
+
+
+static void
+re_string_construct_common (const char *str, Idx len, re_string_t *pstr,
+                           RE_TRANSLATE_TYPE trans, bool icase,
+                           const re_dfa_t *dfa)
+{
+  pstr->raw_mbs = (const unsigned char *) str;
+  pstr->len = len;
+  pstr->raw_len = len;
+  pstr->trans = trans;
+  pstr->icase = icase;
+  pstr->mbs_allocated = (trans != NULL || icase);
+  pstr->mb_cur_max = dfa->mb_cur_max;
+  pstr->is_utf8 = dfa->is_utf8;
+  pstr->map_notascii = dfa->map_notascii;
+  pstr->stop = pstr->len;
+  pstr->raw_stop = pstr->stop;
+}
+
+
+/* Build wide character buffer PSTR->WCS.
+   If the byte sequence of the string are:
+     <mb1>(0), <mb1>(1), <mb2>(0), <mb2>(1), <sb3>
+   Then wide character buffer will be:
+     <wc1>   , WEOF    , <wc2>   , WEOF    , <wc3>
+   We use WEOF for padding, they indicate that the position isn't
+   a first byte of a multibyte character.
+
+   Note that this function assumes PSTR->VALID_LEN elements are already
+   built and starts from PSTR->VALID_LEN.  */
+
+static void
+build_wcs_buffer (re_string_t *pstr)
+{
+#ifdef _LIBC
+  unsigned char buf[MB_LEN_MAX];
+  DEBUG_ASSERT (MB_LEN_MAX >= pstr->mb_cur_max);
+#else
+  unsigned char buf[64];
+#endif
+  mbstate_t prev_st;
+  Idx byte_idx, end_idx, remain_len;
+  size_t mbclen;
+
+  /* Build the buffers from pstr->valid_len to either pstr->len or
+     pstr->bufs_len.  */
+  end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
+  for (byte_idx = pstr->valid_len; byte_idx < end_idx;)
+    {
+      wchar_t wc;
+      const char *p;
+
+      remain_len = end_idx - byte_idx;
+      prev_st = pstr->cur_state;
+      /* Apply the translation if we need.  */
+      if (__glibc_unlikely (pstr->trans != NULL))
+       {
+         int i, ch;
+
+         for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
+           {
+             ch = pstr->raw_mbs [pstr->raw_mbs_idx + byte_idx + i];
+             buf[i] = pstr->mbs[byte_idx + i] = pstr->trans[ch];
+           }
+         p = (const char *) buf;
+       }
+      else
+       p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx;
+      mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
+      if (__glibc_unlikely (mbclen == (size_t) -1 || mbclen == 0
+                           || (mbclen == (size_t) -2
+                               && pstr->bufs_len >= pstr->len)))
+       {
+         /* We treat these cases as a singlebyte character.  */
+         mbclen = 1;
+         wc = (wchar_t) pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
+         if (__glibc_unlikely (pstr->trans != NULL))
+           wc = pstr->trans[wc];
+         pstr->cur_state = prev_st;
+       }
+      else if (__glibc_unlikely (mbclen == (size_t) -2))
+       {
+         /* The buffer doesn't have enough space, finish to build.  */
+         pstr->cur_state = prev_st;
+         break;
+       }
+
+      /* Write wide character and padding.  */
+      pstr->wcs[byte_idx++] = wc;
+      /* Write paddings.  */
+      for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
+       pstr->wcs[byte_idx++] = WEOF;
+    }
+  pstr->valid_len = byte_idx;
+  pstr->valid_raw_len = byte_idx;
+}
+
+/* Build wide character buffer PSTR->WCS like build_wcs_buffer,
+   but for REG_ICASE.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+build_wcs_upper_buffer (re_string_t *pstr)
+{
+  mbstate_t prev_st;
+  Idx src_idx, byte_idx, end_idx, remain_len;
+  size_t mbclen;
+#ifdef _LIBC
+  char buf[MB_LEN_MAX];
+  DEBUG_ASSERT (pstr->mb_cur_max <= MB_LEN_MAX);
+#else
+  char buf[64];
+#endif
+
+  byte_idx = pstr->valid_len;
+  end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
+
+  /* The following optimization assumes that ASCII characters can be
+     mapped to wide characters with a simple cast.  */
+  if (! pstr->map_notascii && pstr->trans == NULL && !pstr->offsets_needed)
+    {
+      while (byte_idx < end_idx)
+       {
+         wchar_t wc;
+         unsigned char ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
+
+         if (isascii (ch) && mbsinit (&pstr->cur_state))
+           {
+             /* The next step uses the assumption that wchar_t is encoded
+                ASCII-safe: all ASCII values can be converted like this.  */
+             wchar_t wcu = __towupper (ch);
+             if (isascii (wcu))
+               {
+                 pstr->mbs[byte_idx] = wcu;
+                 pstr->wcs[byte_idx] = wcu;
+                 byte_idx++;
+                 continue;
+               }
+           }
+
+         remain_len = end_idx - byte_idx;
+         prev_st = pstr->cur_state;
+         mbclen = __mbrtowc (&wc,
+                             ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx
+                              + byte_idx), remain_len, &pstr->cur_state);
+         if (__glibc_likely (0 < mbclen && mbclen < (size_t) -2))
+           {
+             wchar_t wcu = __towupper (wc);
+             if (wcu != wc)
+               {
+                 size_t mbcdlen;
+
+                 mbcdlen = __wcrtomb (buf, wcu, &prev_st);
+                 if (__glibc_likely (mbclen == mbcdlen))
+                   memcpy (pstr->mbs + byte_idx, buf, mbclen);
+                 else
+                   {
+                     src_idx = byte_idx;
+                     goto offsets_needed;
+                   }
+               }
+             else
+               memcpy (pstr->mbs + byte_idx,
+                       pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx, mbclen);
+             pstr->wcs[byte_idx++] = wcu;
+             /* Write paddings.  */
+             for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
+               pstr->wcs[byte_idx++] = WEOF;
+           }
+         else if (mbclen == (size_t) -1 || mbclen == 0
+                  || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
+           {
+             /* It is an invalid character, an incomplete character
+                at the end of the string, or '\0'.  Just use the byte.  */
+             pstr->mbs[byte_idx] = ch;
+             /* And also cast it to wide char.  */
+             pstr->wcs[byte_idx++] = (wchar_t) ch;
+             if (__glibc_unlikely (mbclen == (size_t) -1))
+               pstr->cur_state = prev_st;
+           }
+         else
+           {
+             /* The buffer doesn't have enough space, finish to build.  */
+             pstr->cur_state = prev_st;
+             break;
+           }
+       }
+      pstr->valid_len = byte_idx;
+      pstr->valid_raw_len = byte_idx;
+      return REG_NOERROR;
+    }
+  else
+    for (src_idx = pstr->valid_raw_len; byte_idx < end_idx;)
+      {
+       wchar_t wc;
+       const char *p;
+      offsets_needed:
+       remain_len = end_idx - byte_idx;
+       prev_st = pstr->cur_state;
+       if (__glibc_unlikely (pstr->trans != NULL))
+         {
+           int i, ch;
+
+           for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
+             {
+               ch = pstr->raw_mbs [pstr->raw_mbs_idx + src_idx + i];
+               buf[i] = pstr->trans[ch];
+             }
+           p = (const char *) buf;
+         }
+       else
+         p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx;
+       mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
+       if (__glibc_likely (0 < mbclen && mbclen < (size_t) -2))
+         {
+           wchar_t wcu = __towupper (wc);
+           if (wcu != wc)
+             {
+               size_t mbcdlen;
+
+               mbcdlen = __wcrtomb ((char *) buf, wcu, &prev_st);
+               if (__glibc_likely (mbclen == mbcdlen))
+                 memcpy (pstr->mbs + byte_idx, buf, mbclen);
+               else if (mbcdlen != (size_t) -1)
+                 {
+                   size_t i;
+
+                   if (byte_idx + mbcdlen > pstr->bufs_len)
+                     {
+                       pstr->cur_state = prev_st;
+                       break;
+                     }
+
+                   if (pstr->offsets == NULL)
+                     {
+                       pstr->offsets = re_malloc (Idx, pstr->bufs_len);
+
+                       if (pstr->offsets == NULL)
+                         return REG_ESPACE;
+                     }
+                   if (!pstr->offsets_needed)
+                     {
+                       for (i = 0; i < (size_t) byte_idx; ++i)
+                         pstr->offsets[i] = i;
+                       pstr->offsets_needed = 1;
+                     }
+
+                   memcpy (pstr->mbs + byte_idx, buf, mbcdlen);
+                   pstr->wcs[byte_idx] = wcu;
+                   pstr->offsets[byte_idx] = src_idx;
+                   for (i = 1; i < mbcdlen; ++i)
+                     {
+                       pstr->offsets[byte_idx + i]
+                         = src_idx + (i < mbclen ? i : mbclen - 1);
+                       pstr->wcs[byte_idx + i] = WEOF;
+                     }
+                   pstr->len += mbcdlen - mbclen;
+                   if (pstr->raw_stop > src_idx)
+                     pstr->stop += mbcdlen - mbclen;
+                   end_idx = (pstr->bufs_len > pstr->len)
+                             ? pstr->len : pstr->bufs_len;
+                   byte_idx += mbcdlen;
+                   src_idx += mbclen;
+                   continue;
+                 }
+               else
+                 memcpy (pstr->mbs + byte_idx, p, mbclen);
+             }
+           else
+             memcpy (pstr->mbs + byte_idx, p, mbclen);
+
+           if (__glibc_unlikely (pstr->offsets_needed != 0))
+             {
+               size_t i;
+               for (i = 0; i < mbclen; ++i)
+                 pstr->offsets[byte_idx + i] = src_idx + i;
+             }
+           src_idx += mbclen;
+
+           pstr->wcs[byte_idx++] = wcu;
+           /* Write paddings.  */
+           for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
+             pstr->wcs[byte_idx++] = WEOF;
+         }
+       else if (mbclen == (size_t) -1 || mbclen == 0
+                || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
+         {
+           /* It is an invalid character or '\0'.  Just use the byte.  */
+           int ch = pstr->raw_mbs[pstr->raw_mbs_idx + src_idx];
+
+           if (__glibc_unlikely (pstr->trans != NULL))
+             ch = pstr->trans [ch];
+           pstr->mbs[byte_idx] = ch;
+
+           if (__glibc_unlikely (pstr->offsets_needed != 0))
+             pstr->offsets[byte_idx] = src_idx;
+           ++src_idx;
+
+           /* And also cast it to wide char.  */
+           pstr->wcs[byte_idx++] = (wchar_t) ch;
+           if (__glibc_unlikely (mbclen == (size_t) -1))
+             pstr->cur_state = prev_st;
+         }
+       else
+         {
+           /* The buffer doesn't have enough space, finish to build.  */
+           pstr->cur_state = prev_st;
+           break;
+         }
+      }
+  pstr->valid_len = byte_idx;
+  pstr->valid_raw_len = src_idx;
+  return REG_NOERROR;
+}
+
+/* Skip characters until the index becomes greater than NEW_RAW_IDX.
+   Return the index.  */
+
+static Idx
+re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc)
+{
+  mbstate_t prev_st;
+  Idx rawbuf_idx;
+  size_t mbclen;
+  wint_t wc = WEOF;
+
+  /* Skip the characters which are not necessary to check.  */
+  for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_raw_len;
+       rawbuf_idx < new_raw_idx;)
+    {
+      wchar_t wc2;
+      Idx remain_len = pstr->raw_len - rawbuf_idx;
+      prev_st = pstr->cur_state;
+      mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx,
+                         remain_len, &pstr->cur_state);
+      if (__glibc_unlikely (mbclen == (size_t) -2 || mbclen == (size_t) -1
+                           || mbclen == 0))
+       {
+         /* We treat these cases as a single byte character.  */
+         if (mbclen == 0 || remain_len == 0)
+           wc = L'\0';
+         else
+           wc = *(unsigned char *) (pstr->raw_mbs + rawbuf_idx);
+         mbclen = 1;
+         pstr->cur_state = prev_st;
+       }
+      else
+       wc = wc2;
+      /* Then proceed the next character.  */
+      rawbuf_idx += mbclen;
+    }
+  *last_wc = wc;
+  return rawbuf_idx;
+}
+
+/* Build the buffer PSTR->MBS, and apply the translation if we need.
+   This function is used in case of REG_ICASE.  */
+
+static void
+build_upper_buffer (re_string_t *pstr)
+{
+  Idx char_idx, end_idx;
+  end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
+
+  for (char_idx = pstr->valid_len; char_idx < end_idx; ++char_idx)
+    {
+      int ch = pstr->raw_mbs[pstr->raw_mbs_idx + char_idx];
+      if (__glibc_unlikely (pstr->trans != NULL))
+       ch = pstr->trans[ch];
+      pstr->mbs[char_idx] = toupper (ch);
+    }
+  pstr->valid_len = char_idx;
+  pstr->valid_raw_len = char_idx;
+}
+
+/* Apply TRANS to the buffer in PSTR.  */
+
+static void
+re_string_translate_buffer (re_string_t *pstr)
+{
+  Idx buf_idx, end_idx;
+  end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len;
+
+  for (buf_idx = pstr->valid_len; buf_idx < end_idx; ++buf_idx)
+    {
+      int ch = pstr->raw_mbs[pstr->raw_mbs_idx + buf_idx];
+      pstr->mbs[buf_idx] = pstr->trans[ch];
+    }
+
+  pstr->valid_len = buf_idx;
+  pstr->valid_raw_len = buf_idx;
+}
+
+/* This function re-construct the buffers.
+   Concretely, convert to wide character in case of pstr->mb_cur_max > 1,
+   convert to upper case in case of REG_ICASE, apply translation.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
+{
+  Idx offset;
+
+  if (__glibc_unlikely (pstr->raw_mbs_idx <= idx))
+    offset = idx - pstr->raw_mbs_idx;
+  else
+    {
+      /* Reset buffer.  */
+      if (pstr->mb_cur_max > 1)
+       memset (&pstr->cur_state, '\0', sizeof (mbstate_t));
+      pstr->len = pstr->raw_len;
+      pstr->stop = pstr->raw_stop;
+      pstr->valid_len = 0;
+      pstr->raw_mbs_idx = 0;
+      pstr->valid_raw_len = 0;
+      pstr->offsets_needed = 0;
+      pstr->tip_context = ((eflags & REG_NOTBOL) ? CONTEXT_BEGBUF
+                          : CONTEXT_NEWLINE | CONTEXT_BEGBUF);
+      if (!pstr->mbs_allocated)
+       pstr->mbs = (unsigned char *) pstr->raw_mbs;
+      offset = idx;
+    }
+
+  if (__glibc_likely (offset != 0))
+    {
+      /* Should the already checked characters be kept?  */
+      if (__glibc_likely (offset < pstr->valid_raw_len))
+       {
+         /* Yes, move them to the front of the buffer.  */
+         if (__glibc_unlikely (pstr->offsets_needed))
+           {
+             Idx low = 0, high = pstr->valid_len, mid;
+             do
+               {
+                 mid = (high + low) / 2;
+                 if (pstr->offsets[mid] > offset)
+                   high = mid;
+                 else if (pstr->offsets[mid] < offset)
+                   low = mid + 1;
+                 else
+                   break;
+               }
+             while (low < high);
+             if (pstr->offsets[mid] < offset)
+               ++mid;
+             pstr->tip_context = re_string_context_at (pstr, mid - 1,
+                                                       eflags);
+             /* This can be quite complicated, so handle specially
+                only the common and easy case where the character with
+                different length representation of lower and upper
+                case is present at or after offset.  */
+             if (pstr->valid_len > offset
+                 && mid == offset && pstr->offsets[mid] == offset)
+               {
+                 memmove (pstr->wcs, pstr->wcs + offset,
+                          (pstr->valid_len - offset) * sizeof (wint_t));
+                 memmove (pstr->mbs, pstr->mbs + offset, pstr->valid_len - offset);
+                 pstr->valid_len -= offset;
+                 pstr->valid_raw_len -= offset;
+                 for (low = 0; low < pstr->valid_len; low++)
+                   pstr->offsets[low] = pstr->offsets[low + offset] - offset;
+               }
+             else
+               {
+                 /* Otherwise, just find out how long the partial multibyte
+                    character at offset is and fill it with WEOF/255.  */
+                 pstr->len = pstr->raw_len - idx + offset;
+                 pstr->stop = pstr->raw_stop - idx + offset;
+                 pstr->offsets_needed = 0;
+                 while (mid > 0 && pstr->offsets[mid - 1] == offset)
+                   --mid;
+                 while (mid < pstr->valid_len)
+                   if (pstr->wcs[mid] != WEOF)
+                     break;
+                   else
+                     ++mid;
+                 if (mid == pstr->valid_len)
+                   pstr->valid_len = 0;
+                 else
+                   {
+                     pstr->valid_len = pstr->offsets[mid] - offset;
+                     if (pstr->valid_len)
+                       {
+                         for (low = 0; low < pstr->valid_len; ++low)
+                           pstr->wcs[low] = WEOF;
+                         memset (pstr->mbs, 255, pstr->valid_len);
+                       }
+                   }
+                 pstr->valid_raw_len = pstr->valid_len;
+               }
+           }
+         else
+           {
+             pstr->tip_context = re_string_context_at (pstr, offset - 1,
+                                                       eflags);
+             if (pstr->mb_cur_max > 1)
+               memmove (pstr->wcs, pstr->wcs + offset,
+                        (pstr->valid_len - offset) * sizeof (wint_t));
+             if (__glibc_unlikely (pstr->mbs_allocated))
+               memmove (pstr->mbs, pstr->mbs + offset,
+                        pstr->valid_len - offset);
+             pstr->valid_len -= offset;
+             pstr->valid_raw_len -= offset;
+             DEBUG_ASSERT (pstr->valid_len > 0);
+           }
+       }
+      else
+       {
+         /* No, skip all characters until IDX.  */
+         Idx prev_valid_len = pstr->valid_len;
+
+         if (__glibc_unlikely (pstr->offsets_needed))
+           {
+             pstr->len = pstr->raw_len - idx + offset;
+             pstr->stop = pstr->raw_stop - idx + offset;
+             pstr->offsets_needed = 0;
+           }
+         pstr->valid_len = 0;
+         if (pstr->mb_cur_max > 1)
+           {
+             Idx wcs_idx;
+             wint_t wc = WEOF;
+
+             if (pstr->is_utf8)
+               {
+                 const unsigned char *raw, *p, *end;
+
+                 /* Special case UTF-8.  Multi-byte chars start with any
+                    byte other than 0x80 - 0xbf.  */
+                 raw = pstr->raw_mbs + pstr->raw_mbs_idx;
+                 end = raw + (offset - pstr->mb_cur_max);
+                 if (end < pstr->raw_mbs)
+                   end = pstr->raw_mbs;
+                 p = raw + offset - 1;
+#ifdef _LIBC
+                 /* We know the wchar_t encoding is UCS4, so for the simple
+                    case, ASCII characters, skip the conversion step.  */
+                 if (isascii (*p) && __glibc_likely (pstr->trans == NULL))
+                   {
+                     memset (&pstr->cur_state, '\0', sizeof (mbstate_t));
+                     /* pstr->valid_len = 0; */
+                     wc = (wchar_t) *p;
+                   }
+                 else
+#endif
+                   for (; p >= end; --p)
+                     if ((*p & 0xc0) != 0x80)
+                       {
+                         mbstate_t cur_state;
+                         wchar_t wc2;
+                         Idx mlen = raw + pstr->len - p;
+                         unsigned char buf[6];
+                         size_t mbclen;
+
+                         const unsigned char *pp = p;
+                         if (__glibc_unlikely (pstr->trans != NULL))
+                           {
+                             int i = mlen < 6 ? mlen : 6;
+                             while (--i >= 0)
+                               buf[i] = pstr->trans[p[i]];
+                             pp = buf;
+                           }
+                         /* XXX Don't use mbrtowc, we know which conversion
+                            to use (UTF-8 -> UCS4).  */
+                         memset (&cur_state, 0, sizeof (cur_state));
+                         mbclen = __mbrtowc (&wc2, (const char *) pp, mlen,
+                                             &cur_state);
+                         if (raw + offset - p <= mbclen
+                             && mbclen < (size_t) -2)
+                           {
+                             memset (&pstr->cur_state, '\0',
+                                     sizeof (mbstate_t));
+                             pstr->valid_len = mbclen - (raw + offset - p);
+                             wc = wc2;
+                           }
+                         break;
+                       }
+               }
+
+             if (wc == WEOF)
+               pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx;
+             if (wc == WEOF)
+               pstr->tip_context
+                 = re_string_context_at (pstr, prev_valid_len - 1, eflags);
+             else
+               pstr->tip_context = ((__glibc_unlikely (pstr->word_ops_used != 0)
+                                     && IS_WIDE_WORD_CHAR (wc))
+                                    ? CONTEXT_WORD
+                                    : ((IS_WIDE_NEWLINE (wc)
+                                        && pstr->newline_anchor)
+                                       ? CONTEXT_NEWLINE : 0));
+             if (__glibc_unlikely (pstr->valid_len))
+               {
+                 for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx)
+                   pstr->wcs[wcs_idx] = WEOF;
+                 if (pstr->mbs_allocated)
+                   memset (pstr->mbs, 255, pstr->valid_len);
+               }
+             pstr->valid_raw_len = pstr->valid_len;
+           }
+         else
+           {
+             int c = pstr->raw_mbs[pstr->raw_mbs_idx + offset - 1];
+             pstr->valid_raw_len = 0;
+             if (pstr->trans)
+               c = pstr->trans[c];
+             pstr->tip_context = (bitset_contain (pstr->word_char, c)
+                                  ? CONTEXT_WORD
+                                  : ((IS_NEWLINE (c) && pstr->newline_anchor)
+                                     ? CONTEXT_NEWLINE : 0));
+           }
+       }
+      if (!__glibc_unlikely (pstr->mbs_allocated))
+       pstr->mbs += offset;
+    }
+  pstr->raw_mbs_idx = idx;
+  pstr->len -= offset;
+  pstr->stop -= offset;
+
+  /* Then build the buffers.  */
+  if (pstr->mb_cur_max > 1)
+    {
+      if (pstr->icase)
+       {
+         reg_errcode_t ret = build_wcs_upper_buffer (pstr);
+         if (__glibc_unlikely (ret != REG_NOERROR))
+           return ret;
+       }
+      else
+       build_wcs_buffer (pstr);
+    }
+  else
+    if (__glibc_unlikely (pstr->mbs_allocated))
+      {
+       if (pstr->icase)
+         build_upper_buffer (pstr);
+       else if (pstr->trans != NULL)
+         re_string_translate_buffer (pstr);
+      }
+    else
+      pstr->valid_len = pstr->len;
+
+  pstr->cur_idx = 0;
+  return REG_NOERROR;
+}
+
+static unsigned char
+__attribute__ ((pure))
+re_string_peek_byte_case (const re_string_t *pstr, Idx idx)
+{
+  int ch;
+  Idx off;
+
+  /* Handle the common (easiest) cases first.  */
+  if (__glibc_likely (!pstr->mbs_allocated))
+    return re_string_peek_byte (pstr, idx);
+
+  if (pstr->mb_cur_max > 1
+      && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx))
+    return re_string_peek_byte (pstr, idx);
+
+  off = pstr->cur_idx + idx;
+  if (pstr->offsets_needed)
+    off = pstr->offsets[off];
+
+  ch = pstr->raw_mbs[pstr->raw_mbs_idx + off];
+
+  /* Ensure that e.g. for tr_TR.UTF-8 BACKSLASH DOTLESS SMALL LETTER I
+     this function returns CAPITAL LETTER I instead of first byte of
+     DOTLESS SMALL LETTER I.  The latter would confuse the parser,
+     since peek_byte_case doesn't advance cur_idx in any way.  */
+  if (pstr->offsets_needed && !isascii (ch))
+    return re_string_peek_byte (pstr, idx);
+
+  return ch;
+}
+
+static unsigned char
+re_string_fetch_byte_case (re_string_t *pstr)
+{
+  if (__glibc_likely (!pstr->mbs_allocated))
+    return re_string_fetch_byte (pstr);
+
+  if (pstr->offsets_needed)
+    {
+      Idx off;
+      int ch;
+
+      /* For tr_TR.UTF-8 [[:islower:]] there is
+        [[: CAPITAL LETTER I WITH DOT lower:]] in mbs.  Skip
+        in that case the whole multi-byte character and return
+        the original letter.  On the other side, with
+        [[: DOTLESS SMALL LETTER I return [[:I, as doing
+        anything else would complicate things too much.  */
+
+      if (!re_string_first_byte (pstr, pstr->cur_idx))
+       return re_string_fetch_byte (pstr);
+
+      off = pstr->offsets[pstr->cur_idx];
+      ch = pstr->raw_mbs[pstr->raw_mbs_idx + off];
+
+      if (! isascii (ch))
+       return re_string_fetch_byte (pstr);
+
+      re_string_skip_bytes (pstr,
+                           re_string_char_size_at (pstr, pstr->cur_idx));
+      return ch;
+    }
+
+  return pstr->raw_mbs[pstr->raw_mbs_idx + pstr->cur_idx++];
+}
+
+static void
+re_string_destruct (re_string_t *pstr)
+{
+  re_free (pstr->wcs);
+  re_free (pstr->offsets);
+  if (pstr->mbs_allocated)
+    re_free (pstr->mbs);
+}
+
+/* Return the context at IDX in INPUT.  */
+
+static unsigned int
+re_string_context_at (const re_string_t *input, Idx idx, int eflags)
+{
+  int c;
+  if (__glibc_unlikely (idx < 0))
+    /* In this case, we use the value stored in input->tip_context,
+       since we can't know the character in input->mbs[-1] here.  */
+    return input->tip_context;
+  if (__glibc_unlikely (idx == input->len))
+    return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF
+           : CONTEXT_NEWLINE | CONTEXT_ENDBUF);
+  if (input->mb_cur_max > 1)
+    {
+      wint_t wc;
+      Idx wc_idx = idx;
+      while(input->wcs[wc_idx] == WEOF)
+       {
+         DEBUG_ASSERT (wc_idx >= 0);
+         --wc_idx;
+         if (wc_idx < 0)
+           return input->tip_context;
+       }
+      wc = input->wcs[wc_idx];
+      if (__glibc_unlikely (input->word_ops_used != 0)
+         && IS_WIDE_WORD_CHAR (wc))
+       return CONTEXT_WORD;
+      return (IS_WIDE_NEWLINE (wc) && input->newline_anchor
+             ? CONTEXT_NEWLINE : 0);
+    }
+  else
+    {
+      c = re_string_byte_at (input, idx);
+      if (bitset_contain (input->word_char, c))
+       return CONTEXT_WORD;
+      return IS_NEWLINE (c) && input->newline_anchor ? CONTEXT_NEWLINE : 0;
+    }
+}
+\f
+/* Functions for set operation.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_node_set_alloc (re_node_set *set, Idx size)
+{
+  set->alloc = size;
+  set->nelem = 0;
+  set->elems = re_malloc (Idx, size);
+  if (__glibc_unlikely (set->elems == NULL)
+      && (MALLOC_0_IS_NONNULL || size != 0))
+    return REG_ESPACE;
+  return REG_NOERROR;
+}
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_node_set_init_1 (re_node_set *set, Idx elem)
+{
+  set->alloc = 1;
+  set->nelem = 1;
+  set->elems = re_malloc (Idx, 1);
+  if (__glibc_unlikely (set->elems == NULL))
+    {
+      set->alloc = set->nelem = 0;
+      return REG_ESPACE;
+    }
+  set->elems[0] = elem;
+  return REG_NOERROR;
+}
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_node_set_init_2 (re_node_set *set, Idx elem1, Idx elem2)
+{
+  set->alloc = 2;
+  set->elems = re_malloc (Idx, 2);
+  if (__glibc_unlikely (set->elems == NULL))
+    return REG_ESPACE;
+  if (elem1 == elem2)
+    {
+      set->nelem = 1;
+      set->elems[0] = elem1;
+    }
+  else
+    {
+      set->nelem = 2;
+      if (elem1 < elem2)
+       {
+         set->elems[0] = elem1;
+         set->elems[1] = elem2;
+       }
+      else
+       {
+         set->elems[0] = elem2;
+         set->elems[1] = elem1;
+       }
+    }
+  return REG_NOERROR;
+}
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_node_set_init_copy (re_node_set *dest, const re_node_set *src)
+{
+  dest->nelem = src->nelem;
+  if (src->nelem > 0)
+    {
+      dest->alloc = dest->nelem;
+      dest->elems = re_malloc (Idx, dest->alloc);
+      if (__glibc_unlikely (dest->elems == NULL))
+       {
+         dest->alloc = dest->nelem = 0;
+         return REG_ESPACE;
+       }
+      memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx));
+    }
+  else
+    re_node_set_init_empty (dest);
+  return REG_NOERROR;
+}
+
+/* Calculate the intersection of the sets SRC1 and SRC2. And merge it to
+   DEST. Return value indicate the error code or REG_NOERROR if succeeded.
+   Note: We assume dest->elems is NULL, when dest->alloc is 0.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1,
+                          const re_node_set *src2)
+{
+  Idx i1, i2, is, id, delta, sbase;
+  if (src1->nelem == 0 || src2->nelem == 0)
+    return REG_NOERROR;
+
+  /* We need dest->nelem + 2 * elems_in_intersection; this is a
+     conservative estimate.  */
+  if (src1->nelem + src2->nelem + dest->nelem > dest->alloc)
+    {
+      Idx new_alloc = src1->nelem + src2->nelem + dest->alloc;
+      Idx *new_elems = re_realloc (dest->elems, Idx, new_alloc);
+      if (__glibc_unlikely (new_elems == NULL))
+       return REG_ESPACE;
+      dest->elems = new_elems;
+      dest->alloc = new_alloc;
+    }
+
+  /* Find the items in the intersection of SRC1 and SRC2, and copy
+     into the top of DEST those that are not already in DEST itself.  */
+  sbase = dest->nelem + src1->nelem + src2->nelem;
+  i1 = src1->nelem - 1;
+  i2 = src2->nelem - 1;
+  id = dest->nelem - 1;
+  for (;;)
+    {
+      if (src1->elems[i1] == src2->elems[i2])
+       {
+         /* Try to find the item in DEST.  Maybe we could binary search?  */
+         while (id >= 0 && dest->elems[id] > src1->elems[i1])
+           --id;
+
+         if (id < 0 || dest->elems[id] != src1->elems[i1])
+            dest->elems[--sbase] = src1->elems[i1];
+
+         if (--i1 < 0 || --i2 < 0)
+           break;
+       }
+
+      /* Lower the highest of the two items.  */
+      else if (src1->elems[i1] < src2->elems[i2])
+       {
+         if (--i2 < 0)
+           break;
+       }
+      else
+       {
+         if (--i1 < 0)
+           break;
+       }
+    }
+
+  id = dest->nelem - 1;
+  is = dest->nelem + src1->nelem + src2->nelem - 1;
+  delta = is - sbase + 1;
+
+  /* Now copy.  When DELTA becomes zero, the remaining
+     DEST elements are already in place; this is more or
+     less the same loop that is in re_node_set_merge.  */
+  dest->nelem += delta;
+  if (delta > 0 && id >= 0)
+    for (;;)
+      {
+       if (dest->elems[is] > dest->elems[id])
+         {
+           /* Copy from the top.  */
+           dest->elems[id + delta--] = dest->elems[is--];
+           if (delta == 0)
+             break;
+         }
+       else
+         {
+           /* Slide from the bottom.  */
+           dest->elems[id + delta] = dest->elems[id];
+           if (--id < 0)
+             break;
+         }
+      }
+
+  /* Copy remaining SRC elements.  */
+  memcpy (dest->elems, dest->elems + sbase, delta * sizeof (Idx));
+
+  return REG_NOERROR;
+}
+
+/* Calculate the union set of the sets SRC1 and SRC2. And store it to
+   DEST. Return value indicate the error code or REG_NOERROR if succeeded.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_node_set_init_union (re_node_set *dest, const re_node_set *src1,
+                       const re_node_set *src2)
+{
+  Idx i1, i2, id;
+  if (src1 != NULL && src1->nelem > 0 && src2 != NULL && src2->nelem > 0)
+    {
+      dest->alloc = src1->nelem + src2->nelem;
+      dest->elems = re_malloc (Idx, dest->alloc);
+      if (__glibc_unlikely (dest->elems == NULL))
+       return REG_ESPACE;
+    }
+  else
+    {
+      if (src1 != NULL && src1->nelem > 0)
+       return re_node_set_init_copy (dest, src1);
+      else if (src2 != NULL && src2->nelem > 0)
+       return re_node_set_init_copy (dest, src2);
+      else
+       re_node_set_init_empty (dest);
+      return REG_NOERROR;
+    }
+  for (i1 = i2 = id = 0 ; i1 < src1->nelem && i2 < src2->nelem ;)
+    {
+      if (src1->elems[i1] > src2->elems[i2])
+       {
+         dest->elems[id++] = src2->elems[i2++];
+         continue;
+       }
+      if (src1->elems[i1] == src2->elems[i2])
+       ++i2;
+      dest->elems[id++] = src1->elems[i1++];
+    }
+  if (i1 < src1->nelem)
+    {
+      memcpy (dest->elems + id, src1->elems + i1,
+            (src1->nelem - i1) * sizeof (Idx));
+      id += src1->nelem - i1;
+    }
+  else if (i2 < src2->nelem)
+    {
+      memcpy (dest->elems + id, src2->elems + i2,
+            (src2->nelem - i2) * sizeof (Idx));
+      id += src2->nelem - i2;
+    }
+  dest->nelem = id;
+  return REG_NOERROR;
+}
+
+/* Calculate the union set of the sets DEST and SRC. And store it to
+   DEST. Return value indicate the error code or REG_NOERROR if succeeded.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_node_set_merge (re_node_set *dest, const re_node_set *src)
+{
+  Idx is, id, sbase, delta;
+  if (src == NULL || src->nelem == 0)
+    return REG_NOERROR;
+  if (dest->alloc < 2 * src->nelem + dest->nelem)
+    {
+      Idx new_alloc = 2 * (src->nelem + dest->alloc);
+      Idx *new_buffer = re_realloc (dest->elems, Idx, new_alloc);
+      if (__glibc_unlikely (new_buffer == NULL))
+       return REG_ESPACE;
+      dest->elems = new_buffer;
+      dest->alloc = new_alloc;
+    }
+
+  if (__glibc_unlikely (dest->nelem == 0))
+    {
+      /* Although we already guaranteed above that dest->alloc != 0 and
+         therefore dest->elems != NULL, add a debug assertion to pacify
+         GCC 11.2.1's -fanalyzer.  */
+      DEBUG_ASSERT (dest->elems);
+      dest->nelem = src->nelem;
+      memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx));
+      return REG_NOERROR;
+    }
+
+  /* Copy into the top of DEST the items of SRC that are not
+     found in DEST.  Maybe we could binary search in DEST?  */
+  for (sbase = dest->nelem + 2 * src->nelem,
+       is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; )
+    {
+      if (dest->elems[id] == src->elems[is])
+       is--, id--;
+      else if (dest->elems[id] < src->elems[is])
+       dest->elems[--sbase] = src->elems[is--];
+      else /* if (dest->elems[id] > src->elems[is]) */
+       --id;
+    }
+
+  if (is >= 0)
+    {
+      /* If DEST is exhausted, the remaining items of SRC must be unique.  */
+      sbase -= is + 1;
+      memcpy (dest->elems + sbase, src->elems, (is + 1) * sizeof (Idx));
+    }
+
+  id = dest->nelem - 1;
+  is = dest->nelem + 2 * src->nelem - 1;
+  delta = is - sbase + 1;
+  if (delta == 0)
+    return REG_NOERROR;
+
+  /* Now copy.  When DELTA becomes zero, the remaining
+     DEST elements are already in place.  */
+  dest->nelem += delta;
+  for (;;)
+    {
+      if (dest->elems[is] > dest->elems[id])
+       {
+         /* Copy from the top.  */
+         dest->elems[id + delta--] = dest->elems[is--];
+         if (delta == 0)
+           break;
+       }
+      else
+       {
+         /* Slide from the bottom.  */
+         dest->elems[id + delta] = dest->elems[id];
+         if (--id < 0)
+           {
+             /* Copy remaining SRC elements.  */
+             memcpy (dest->elems, dest->elems + sbase,
+                     delta * sizeof (Idx));
+             break;
+           }
+       }
+    }
+
+  return REG_NOERROR;
+}
+
+/* Insert the new element ELEM to the re_node_set* SET.
+   SET should not already have ELEM.
+   Return true if successful.  */
+
+static bool
+__attribute_warn_unused_result__
+re_node_set_insert (re_node_set *set, Idx elem)
+{
+  Idx idx;
+  /* In case the set is empty.  */
+  if (set->alloc == 0)
+    return __glibc_likely (re_node_set_init_1 (set, elem) == REG_NOERROR);
+
+  if (__glibc_unlikely (set->nelem) == 0)
+    {
+      /* Although we already guaranteed above that set->alloc != 0 and
+         therefore set->elems != NULL, add a debug assertion to pacify
+         GCC 11.2 -fanalyzer.  */
+      DEBUG_ASSERT (set->elems);
+      set->elems[0] = elem;
+      ++set->nelem;
+      return true;
+    }
+
+  /* Realloc if we need.  */
+  if (set->alloc == set->nelem)
+    {
+      Idx *new_elems;
+      set->alloc = set->alloc * 2;
+      new_elems = re_realloc (set->elems, Idx, set->alloc);
+      if (__glibc_unlikely (new_elems == NULL))
+       return false;
+      set->elems = new_elems;
+    }
+
+  /* Move the elements which follows the new element.  Test the
+     first element separately to skip a check in the inner loop.  */
+  if (elem < set->elems[0])
+    {
+      for (idx = set->nelem; idx > 0; idx--)
+       set->elems[idx] = set->elems[idx - 1];
+    }
+  else
+    {
+      for (idx = set->nelem; set->elems[idx - 1] > elem; idx--)
+       set->elems[idx] = set->elems[idx - 1];
+      DEBUG_ASSERT (set->elems[idx - 1] < elem);
+    }
+
+  /* Insert the new element.  */
+  set->elems[idx] = elem;
+  ++set->nelem;
+  return true;
+}
+
+/* Insert the new element ELEM to the re_node_set* SET.
+   SET should not already have any element greater than or equal to ELEM.
+   Return true if successful.  */
+
+static bool
+__attribute_warn_unused_result__
+re_node_set_insert_last (re_node_set *set, Idx elem)
+{
+  /* Realloc if we need.  */
+  if (set->alloc == set->nelem)
+    {
+      Idx *new_elems;
+      set->alloc = (set->alloc + 1) * 2;
+      new_elems = re_realloc (set->elems, Idx, set->alloc);
+      if (__glibc_unlikely (new_elems == NULL))
+       return false;
+      set->elems = new_elems;
+    }
+
+  /* Insert the new element.  */
+  set->elems[set->nelem++] = elem;
+  return true;
+}
+
+/* Compare two node sets SET1 and SET2.
+   Return true if SET1 and SET2 are equivalent.  */
+
+static bool
+__attribute__ ((pure))
+re_node_set_compare (const re_node_set *set1, const re_node_set *set2)
+{
+  Idx i;
+  if (set1 == NULL || set2 == NULL || set1->nelem != set2->nelem)
+    return false;
+  for (i = set1->nelem ; --i >= 0 ; )
+    if (set1->elems[i] != set2->elems[i])
+      return false;
+  return true;
+}
+
+/* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise.  */
+
+static Idx
+__attribute__ ((pure))
+re_node_set_contains (const re_node_set *set, Idx elem)
+{
+  __re_size_t idx, right, mid;
+  if (set->nelem <= 0)
+    return 0;
+
+  /* Binary search the element.  */
+  idx = 0;
+  right = set->nelem - 1;
+  while (idx < right)
+    {
+      mid = (idx + right) / 2;
+      if (set->elems[mid] < elem)
+       idx = mid + 1;
+      else
+       right = mid;
+    }
+  return set->elems[idx] == elem ? idx + 1 : 0;
+}
+
+static void
+re_node_set_remove_at (re_node_set *set, Idx idx)
+{
+  if (idx < 0 || idx >= set->nelem)
+    return;
+  --set->nelem;
+  for (; idx < set->nelem; idx++)
+    set->elems[idx] = set->elems[idx + 1];
+}
+\f
+
+/* Add the token TOKEN to dfa->nodes, and return the index of the token.
+   Or return -1 if an error occurred.  */
+
+static Idx
+re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
+{
+  if (__glibc_unlikely (dfa->nodes_len >= dfa->nodes_alloc))
+    {
+      size_t new_nodes_alloc = dfa->nodes_alloc * 2;
+      Idx *new_nexts, *new_indices;
+      re_node_set *new_edests, *new_eclosures;
+      re_token_t *new_nodes;
+
+      /* Avoid overflows in realloc.  */
+      const size_t max_object_size = MAX (sizeof (re_token_t),
+                                         MAX (sizeof (re_node_set),
+                                              sizeof (Idx)));
+      if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / max_object_size)
+                           < new_nodes_alloc))
+       return -1;
+
+      new_nodes = re_realloc (dfa->nodes, re_token_t, new_nodes_alloc);
+      if (__glibc_unlikely (new_nodes == NULL))
+       return -1;
+      dfa->nodes = new_nodes;
+      dfa->nodes_alloc = new_nodes_alloc;
+      new_nexts = re_realloc (dfa->nexts, Idx, new_nodes_alloc);
+      if (new_nexts != NULL)
+       dfa->nexts = new_nexts;
+      new_indices = re_realloc (dfa->org_indices, Idx, new_nodes_alloc);
+      if (new_indices != NULL)
+       dfa->org_indices = new_indices;
+      new_edests = re_realloc (dfa->edests, re_node_set, new_nodes_alloc);
+      if (new_edests != NULL)
+       dfa->edests = new_edests;
+      new_eclosures = re_realloc (dfa->eclosures, re_node_set, new_nodes_alloc);
+      if (new_eclosures != NULL)
+       dfa->eclosures = new_eclosures;
+      if (__glibc_unlikely (new_nexts == NULL || new_indices == NULL
+                           || new_edests == NULL || new_eclosures == NULL))
+       return -1;
+    }
+  dfa->nodes[dfa->nodes_len] = token;
+  dfa->nodes[dfa->nodes_len].constraint = 0;
+  dfa->nodes[dfa->nodes_len].accept_mb =
+    ((token.type == OP_PERIOD && dfa->mb_cur_max > 1)
+     || token.type == COMPLEX_BRACKET);
+  dfa->nexts[dfa->nodes_len] = -1;
+  re_node_set_init_empty (dfa->edests + dfa->nodes_len);
+  re_node_set_init_empty (dfa->eclosures + dfa->nodes_len);
+  return dfa->nodes_len++;
+}
+
+static re_hashval_t
+calc_state_hash (const re_node_set *nodes, unsigned int context)
+{
+  re_hashval_t hash = nodes->nelem + context;
+  Idx i;
+  for (i = 0 ; i < nodes->nelem ; i++)
+    hash += nodes->elems[i];
+  return hash;
+}
+
+/* Search for the state whose node_set is equivalent to NODES.
+   Return the pointer to the state, if we found it in the DFA.
+   Otherwise create the new one and return it.  In case of an error
+   return NULL and set the error code in ERR.
+   Note: - We assume NULL as the invalid state, then it is possible that
+          return value is NULL and ERR is REG_NOERROR.
+        - We never return non-NULL value in case of any errors, it is for
+          optimization.  */
+
+static re_dfastate_t *
+__attribute_warn_unused_result__
+re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
+                 const re_node_set *nodes)
+{
+  re_hashval_t hash;
+  re_dfastate_t *new_state;
+  struct re_state_table_entry *spot;
+  Idx i;
+#if defined GCC_LINT || defined lint
+  /* Suppress bogus uninitialized-variable warnings.  */
+  *err = REG_NOERROR;
+#endif
+  if (__glibc_unlikely (nodes->nelem == 0))
+    {
+      *err = REG_NOERROR;
+      return NULL;
+    }
+  hash = calc_state_hash (nodes, 0);
+  spot = dfa->state_table + (hash & dfa->state_hash_mask);
+
+  for (i = 0 ; i < spot->num ; i++)
+    {
+      re_dfastate_t *state = spot->array[i];
+      if (hash != state->hash)
+       continue;
+      if (re_node_set_compare (&state->nodes, nodes))
+       return state;
+    }
+
+  /* There are no appropriate state in the dfa, create the new one.  */
+  new_state = create_ci_newstate (dfa, nodes, hash);
+  if (__glibc_unlikely (new_state == NULL))
+    *err = REG_ESPACE;
+
+  return new_state;
+}
+
+/* Search for the state whose node_set is equivalent to NODES and
+   whose context is equivalent to CONTEXT.
+   Return the pointer to the state, if we found it in the DFA.
+   Otherwise create the new one and return it.  In case of an error
+   return NULL and set the error code in ERR.
+   Note: - We assume NULL as the invalid state, then it is possible that
+          return value is NULL and ERR is REG_NOERROR.
+        - We never return non-NULL value in case of any errors, it is for
+          optimization.  */
+
+static re_dfastate_t *
+__attribute_warn_unused_result__
+re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa,
+                         const re_node_set *nodes, unsigned int context)
+{
+  re_hashval_t hash;
+  re_dfastate_t *new_state;
+  struct re_state_table_entry *spot;
+  Idx i;
+#if defined GCC_LINT || defined lint
+  /* Suppress bogus uninitialized-variable warnings.  */
+  *err = REG_NOERROR;
+#endif
+  if (nodes->nelem == 0)
+    {
+      *err = REG_NOERROR;
+      return NULL;
+    }
+  hash = calc_state_hash (nodes, context);
+  spot = dfa->state_table + (hash & dfa->state_hash_mask);
+
+  for (i = 0 ; i < spot->num ; i++)
+    {
+      re_dfastate_t *state = spot->array[i];
+      if (state->hash == hash
+         && state->context == context
+         && re_node_set_compare (state->entrance_nodes, nodes))
+       return state;
+    }
+  /* There are no appropriate state in 'dfa', create the new one.  */
+  new_state = create_cd_newstate (dfa, nodes, context, hash);
+  if (__glibc_unlikely (new_state == NULL))
+    *err = REG_ESPACE;
+
+  return new_state;
+}
+
+/* Finish initialization of the new state NEWSTATE, and using its hash value
+   HASH put in the appropriate bucket of DFA's state table.  Return value
+   indicates the error code if failed.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
+               re_hashval_t hash)
+{
+  struct re_state_table_entry *spot;
+  reg_errcode_t err;
+  Idx i;
+
+  newstate->hash = hash;
+  err = re_node_set_alloc (&newstate->non_eps_nodes, newstate->nodes.nelem);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    return REG_ESPACE;
+  for (i = 0; i < newstate->nodes.nelem; i++)
+    {
+      Idx elem = newstate->nodes.elems[i];
+      if (!IS_EPSILON_NODE (dfa->nodes[elem].type))
+       if (! re_node_set_insert_last (&newstate->non_eps_nodes, elem))
+         return REG_ESPACE;
+    }
+
+  spot = dfa->state_table + (hash & dfa->state_hash_mask);
+  if (__glibc_unlikely (spot->alloc <= spot->num))
+    {
+      Idx new_alloc = 2 * spot->num + 2;
+      re_dfastate_t **new_array = re_realloc (spot->array, re_dfastate_t *,
+                                             new_alloc);
+      if (__glibc_unlikely (new_array == NULL))
+       return REG_ESPACE;
+      spot->array = new_array;
+      spot->alloc = new_alloc;
+    }
+  spot->array[spot->num++] = newstate;
+  return REG_NOERROR;
+}
+
+static void
+free_state (re_dfastate_t *state)
+{
+  re_node_set_free (&state->non_eps_nodes);
+  re_node_set_free (&state->inveclosure);
+  if (state->entrance_nodes != &state->nodes)
+    {
+      re_node_set_free (state->entrance_nodes);
+      re_free (state->entrance_nodes);
+    }
+  re_node_set_free (&state->nodes);
+  re_free (state->word_trtable);
+  re_free (state->trtable);
+  re_free (state);
+}
+
+/* Create the new state which is independent of contexts.
+   Return the new state if succeeded, otherwise return NULL.  */
+
+static re_dfastate_t *
+__attribute_warn_unused_result__
+create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
+                   re_hashval_t hash)
+{
+  Idx i;
+  reg_errcode_t err;
+  re_dfastate_t *newstate;
+
+  newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1);
+  if (__glibc_unlikely (newstate == NULL))
+    return NULL;
+  err = re_node_set_init_copy (&newstate->nodes, nodes);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    {
+      re_free (newstate);
+      return NULL;
+    }
+
+  newstate->entrance_nodes = &newstate->nodes;
+  for (i = 0 ; i < nodes->nelem ; i++)
+    {
+      re_token_t *node = dfa->nodes + nodes->elems[i];
+      re_token_type_t type = node->type;
+      if (type == CHARACTER && !node->constraint)
+       continue;
+      newstate->accept_mb |= node->accept_mb;
+
+      /* If the state has the halt node, the state is a halt state.  */
+      if (type == END_OF_RE)
+       newstate->halt = 1;
+      else if (type == OP_BACK_REF)
+       newstate->has_backref = 1;
+      else if (type == ANCHOR || node->constraint)
+       newstate->has_constraint = 1;
+    }
+  err = register_state (dfa, newstate, hash);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    {
+      free_state (newstate);
+      newstate = NULL;
+    }
+  return newstate;
+}
+
+/* Create the new state which is depend on the context CONTEXT.
+   Return the new state if succeeded, otherwise return NULL.  */
+
+static re_dfastate_t *
+__attribute_warn_unused_result__
+create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
+                   unsigned int context, re_hashval_t hash)
+{
+  Idx i, nctx_nodes = 0;
+  reg_errcode_t err;
+  re_dfastate_t *newstate;
+
+  newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1);
+  if (__glibc_unlikely (newstate == NULL))
+    return NULL;
+  err = re_node_set_init_copy (&newstate->nodes, nodes);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    {
+      re_free (newstate);
+      return NULL;
+    }
+
+  newstate->context = context;
+  newstate->entrance_nodes = &newstate->nodes;
+
+  for (i = 0 ; i < nodes->nelem ; i++)
+    {
+      re_token_t *node = dfa->nodes + nodes->elems[i];
+      re_token_type_t type = node->type;
+      unsigned int constraint = node->constraint;
+
+      if (type == CHARACTER && !constraint)
+       continue;
+      newstate->accept_mb |= node->accept_mb;
+
+      /* If the state has the halt node, the state is a halt state.  */
+      if (type == END_OF_RE)
+       newstate->halt = 1;
+      else if (type == OP_BACK_REF)
+       newstate->has_backref = 1;
+
+      if (constraint)
+       {
+         if (newstate->entrance_nodes == &newstate->nodes)
+           {
+             re_node_set *entrance_nodes = re_malloc (re_node_set, 1);
+             if (__glibc_unlikely (entrance_nodes == NULL))
+               {
+                 free_state (newstate);
+                 return NULL;
+               }
+             newstate->entrance_nodes = entrance_nodes;
+             if (re_node_set_init_copy (newstate->entrance_nodes, nodes)
+                 != REG_NOERROR)
+               {
+                 free_state (newstate);
+                 return NULL;
+               }
+             nctx_nodes = 0;
+             newstate->has_constraint = 1;
+           }
+
+         if (NOT_SATISFY_PREV_CONSTRAINT (constraint,context))
+           {
+             re_node_set_remove_at (&newstate->nodes, i - nctx_nodes);
+             ++nctx_nodes;
+           }
+       }
+    }
+  err = register_state (dfa, newstate, hash);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    {
+      free_state (newstate);
+      newstate = NULL;
+    }
+  return  newstate;
+}
deleted file mode 120000 (symlink)
index efa08f435151ec7000ba5ce21a63df02957d687c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/regex_internal.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6165cb17c7079685160a03fed46878f4b459b622
--- /dev/null
@@ -0,0 +1,832 @@
+/* Extended regular expression matching and search library.
+   Copyright (C) 2002-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _REGEX_INTERNAL_H
+#define _REGEX_INTERNAL_H 1
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <langinfo.h>
+#include <locale.h>
+#include <wchar.h>
+#include <wctype.h>
+#include <stdckdint.h>
+#include <stdint.h>
+
+#ifndef _LIBC
+# include <dynarray.h>
+#endif
+
+#include <intprops.h>
+#include <verify.h>
+
+#if defined DEBUG && DEBUG != 0
+# include <assert.h>
+# define DEBUG_ASSERT(x) assert (x)
+#else
+# define DEBUG_ASSERT(x) assume (x)
+#endif
+
+#ifdef _LIBC
+# include <libc-lock.h>
+# define lock_define(name) __libc_lock_define (, name)
+# define lock_init(lock) (__libc_lock_init (lock), 0)
+# define lock_fini(lock) ((void) 0)
+# define lock_lock(lock) __libc_lock_lock (lock)
+# define lock_unlock(lock) __libc_lock_unlock (lock)
+#elif defined GNULIB_LOCK && !defined GNULIB_REGEX_SINGLE_THREAD
+# include "glthread/lock.h"
+# define lock_define(name) gl_lock_define (, name)
+# define lock_init(lock) glthread_lock_init (&(lock))
+# define lock_fini(lock) glthread_lock_destroy (&(lock))
+# define lock_lock(lock) glthread_lock_lock (&(lock))
+# define lock_unlock(lock) glthread_lock_unlock (&(lock))
+#elif defined GNULIB_PTHREAD && !defined GNULIB_REGEX_SINGLE_THREAD
+# include <pthread.h>
+# define lock_define(name) pthread_mutex_t name;
+# define lock_init(lock) pthread_mutex_init (&(lock), 0)
+# define lock_fini(lock) pthread_mutex_destroy (&(lock))
+# define lock_lock(lock) pthread_mutex_lock (&(lock))
+# define lock_unlock(lock) pthread_mutex_unlock (&(lock))
+#else
+# define lock_define(name)
+# define lock_init(lock) 0
+# define lock_fini(lock) ((void) 0)
+  /* The 'dfa' avoids an "unused variable 'dfa'" warning from GCC.  */
+# define lock_lock(lock) ((void) dfa)
+# define lock_unlock(lock) ((void) 0)
+#endif
+
+/* In case that the system doesn't have isblank().  */
+#if !defined _LIBC && ! (defined isblank || (HAVE_ISBLANK && HAVE_DECL_ISBLANK))
+# define isblank(ch) ((ch) == ' ' || (ch) == '\t')
+#endif
+
+/* regex code assumes isascii has its usual numeric meaning,
+   even if the portable character set uses EBCDIC encoding,
+   and even if wint_t is wider than int.  */
+#ifndef _LIBC
+# undef isascii
+# define isascii(c) (((c) & ~0x7f) == 0)
+#endif
+
+#ifdef _LIBC
+# ifndef _RE_DEFINE_LOCALE_FUNCTIONS
+#  define _RE_DEFINE_LOCALE_FUNCTIONS 1
+#   include <locale/localeinfo.h>
+#   include <locale/coll-lookup.h>
+# endif
+#endif
+
+/* This is for other GNU distributions with internationalized messages.  */
+#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
+# include <libintl.h>
+# ifdef _LIBC
+#  undef gettext
+#  define gettext(msgid) \
+  __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES)
+# endif
+#else
+# undef gettext
+# define gettext(msgid) (msgid)
+#endif
+
+#ifndef gettext_noop
+/* This define is so xgettext can find the internationalizable
+   strings.  */
+# define gettext_noop(String) String
+#endif
+
+/* Number of ASCII characters.  */
+#define ASCII_CHARS 0x80
+
+/* Number of single byte characters.  */
+#define SBC_MAX (UCHAR_MAX + 1)
+
+#define COLL_ELEM_LEN_MAX 8
+
+/* The character which represents newline.  */
+#define NEWLINE_CHAR '\n'
+#define WIDE_NEWLINE_CHAR L'\n'
+
+/* Rename to standard API for using out of glibc.  */
+#ifndef _LIBC
+# undef __wctype
+# undef __iswalnum
+# undef __iswctype
+# undef __towlower
+# undef __towupper
+# define __wctype wctype
+# define __iswalnum iswalnum
+# define __iswctype iswctype
+# define __towlower towlower
+# define __towupper towupper
+# define __btowc btowc
+# define __mbrtowc mbrtowc
+# define __wcrtomb wcrtomb
+# define __regfree regfree
+#endif /* not _LIBC */
+
+/* Types related to integers.  Unless protected by #ifdef _LIBC, the
+   regex code should avoid exact-width types like int32_t and uint64_t
+   as some non-GCC platforms lack them, an issue when this code is
+   used in Gnulib.  */
+
+#ifndef ULONG_WIDTH
+# define ULONG_WIDTH REGEX_UINTEGER_WIDTH (ULONG_MAX)
+/* The number of usable bits in an unsigned integer type with maximum
+   value MAX, as an int expression suitable in #if.  Cover all known
+   practical hosts.  This implementation exploits the fact that MAX is
+   1 less than a power of 2, and merely counts the number of 1 bits in
+   MAX; "COBn" means "count the number of 1 bits in the low-order n bits".  */
+# define REGEX_UINTEGER_WIDTH(max) REGEX_COB128 (max)
+# define REGEX_COB128(n) (REGEX_COB64 ((n) >> 31 >> 31 >> 2) + REGEX_COB64 (n))
+# define REGEX_COB64(n) (REGEX_COB32 ((n) >> 31 >> 1) + REGEX_COB32 (n))
+# define REGEX_COB32(n) (REGEX_COB16 ((n) >> 16) + REGEX_COB16 (n))
+# define REGEX_COB16(n) (REGEX_COB8 ((n) >> 8) + REGEX_COB8 (n))
+# define REGEX_COB8(n) (REGEX_COB4 ((n) >> 4) + REGEX_COB4 (n))
+# define REGEX_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + ((n) & 1))
+# if ULONG_MAX / 2 + 1 != 1ul << (ULONG_WIDTH - 1)
+#  error "ULONG_MAX out of range"
+# endif
+#endif
+
+/* The type of indexes into strings.  This is signed, not size_t,
+   since the API requires indexes to fit in regoff_t anyway, and using
+   signed integers makes the code a bit smaller and presumably faster.
+   The traditional GNU regex implementation uses int for indexes.
+   The POSIX-compatible implementation uses a possibly-wider type.
+   The name 'Idx' is three letters to minimize the hassle of
+   reindenting a lot of regex code that formerly used 'int'.  */
+typedef regoff_t Idx;
+#ifdef _REGEX_LARGE_OFFSETS
+# define IDX_MAX SSIZE_MAX
+#else
+# define IDX_MAX INT_MAX
+#endif
+
+/* A hash value, suitable for computing hash tables.  */
+typedef __re_size_t re_hashval_t;
+
+/* An integer used to represent a set of bits.  It must be unsigned,
+   and must be at least as wide as unsigned int.  */
+typedef unsigned long int bitset_word_t;
+/* All bits set in a bitset_word_t.  */
+#define BITSET_WORD_MAX ULONG_MAX
+/* Number of bits in a bitset_word_t.  */
+#define BITSET_WORD_BITS ULONG_WIDTH
+
+/* Number of bitset_word_t values in a bitset_t.  */
+#define BITSET_WORDS ((SBC_MAX + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
+
+typedef bitset_word_t bitset_t[BITSET_WORDS];
+typedef bitset_word_t *re_bitset_ptr_t;
+typedef const bitset_word_t *re_const_bitset_ptr_t;
+
+#define PREV_WORD_CONSTRAINT 0x0001
+#define PREV_NOTWORD_CONSTRAINT 0x0002
+#define NEXT_WORD_CONSTRAINT 0x0004
+#define NEXT_NOTWORD_CONSTRAINT 0x0008
+#define PREV_NEWLINE_CONSTRAINT 0x0010
+#define NEXT_NEWLINE_CONSTRAINT 0x0020
+#define PREV_BEGBUF_CONSTRAINT 0x0040
+#define NEXT_ENDBUF_CONSTRAINT 0x0080
+#define WORD_DELIM_CONSTRAINT 0x0100
+#define NOT_WORD_DELIM_CONSTRAINT 0x0200
+
+typedef enum
+{
+  INSIDE_WORD = PREV_WORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
+  WORD_FIRST = PREV_NOTWORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
+  WORD_LAST = PREV_WORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
+  INSIDE_NOTWORD = PREV_NOTWORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
+  LINE_FIRST = PREV_NEWLINE_CONSTRAINT,
+  LINE_LAST = NEXT_NEWLINE_CONSTRAINT,
+  BUF_FIRST = PREV_BEGBUF_CONSTRAINT,
+  BUF_LAST = NEXT_ENDBUF_CONSTRAINT,
+  WORD_DELIM = WORD_DELIM_CONSTRAINT,
+  NOT_WORD_DELIM = NOT_WORD_DELIM_CONSTRAINT
+} re_context_type;
+
+typedef struct
+{
+  Idx alloc;
+  Idx nelem;
+  Idx *elems;
+} re_node_set;
+
+typedef enum
+{
+  NON_TYPE = 0,
+
+  /* Node type, These are used by token, node, tree.  */
+  CHARACTER = 1,
+  END_OF_RE = 2,
+  SIMPLE_BRACKET = 3,
+  OP_BACK_REF = 4,
+  OP_PERIOD = 5,
+  COMPLEX_BRACKET = 6,
+  OP_UTF8_PERIOD = 7,
+
+  /* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used
+     when the debugger shows values of this enum type.  */
+#define EPSILON_BIT 8
+  OP_OPEN_SUBEXP = EPSILON_BIT | 0,
+  OP_CLOSE_SUBEXP = EPSILON_BIT | 1,
+  OP_ALT = EPSILON_BIT | 2,
+  OP_DUP_ASTERISK = EPSILON_BIT | 3,
+  ANCHOR = EPSILON_BIT | 4,
+
+  /* Tree type, these are used only by tree. */
+  CONCAT = 16,
+  SUBEXP = 17,
+
+  /* Token type, these are used only by token.  */
+  OP_DUP_PLUS = 18,
+  OP_DUP_QUESTION,
+  OP_OPEN_BRACKET,
+  OP_CLOSE_BRACKET,
+  OP_CHARSET_RANGE,
+  OP_OPEN_DUP_NUM,
+  OP_CLOSE_DUP_NUM,
+  OP_NON_MATCH_LIST,
+  OP_OPEN_COLL_ELEM,
+  OP_CLOSE_COLL_ELEM,
+  OP_OPEN_EQUIV_CLASS,
+  OP_CLOSE_EQUIV_CLASS,
+  OP_OPEN_CHAR_CLASS,
+  OP_CLOSE_CHAR_CLASS,
+  OP_WORD,
+  OP_NOTWORD,
+  OP_SPACE,
+  OP_NOTSPACE,
+  BACK_SLASH
+
+} re_token_type_t;
+
+typedef struct
+{
+  /* Multibyte characters.  */
+  wchar_t *mbchars;
+
+#ifdef _LIBC
+  /* Collating symbols.  */
+  int32_t *coll_syms;
+#endif
+
+#ifdef _LIBC
+  /* Equivalence classes. */
+  int32_t *equiv_classes;
+#endif
+
+  /* Range expressions. */
+#ifdef _LIBC
+  uint32_t *range_starts;
+  uint32_t *range_ends;
+#else
+  wchar_t *range_starts;
+  wchar_t *range_ends;
+#endif
+
+  /* Character classes. */
+  wctype_t *char_classes;
+
+  /* If this character set is the non-matching list.  */
+  unsigned int non_match : 1;
+
+  /* # of multibyte characters.  */
+  Idx nmbchars;
+
+  /* # of collating symbols.  */
+  Idx ncoll_syms;
+
+  /* # of equivalence classes. */
+  Idx nequiv_classes;
+
+  /* # of range expressions. */
+  Idx nranges;
+
+  /* # of character classes. */
+  Idx nchar_classes;
+} re_charset_t;
+
+typedef struct
+{
+  union
+  {
+    unsigned char c;           /* for CHARACTER */
+    re_bitset_ptr_t sbcset;    /* for SIMPLE_BRACKET */
+    re_charset_t *mbcset;      /* for COMPLEX_BRACKET */
+    Idx idx;                   /* for BACK_REF */
+    re_context_type ctx_type;  /* for ANCHOR */
+  } opr;
+#if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__
+  re_token_type_t type : 8;
+#else
+  re_token_type_t type;
+#endif
+  unsigned int constraint : 10;        /* context constraint */
+  unsigned int duplicated : 1;
+  unsigned int opt_subexp : 1;
+  unsigned int accept_mb : 1;
+  /* These 2 bits can be moved into the union if needed (e.g. if running out
+     of bits; move opr.c to opr.c.c and move the flags to opr.c.flags).  */
+  unsigned int mb_partial : 1;
+  unsigned int word_char : 1;
+} re_token_t;
+
+#define IS_EPSILON_NODE(type) ((type) & EPSILON_BIT)
+
+struct re_string_t
+{
+  /* Indicate the raw buffer which is the original string passed as an
+     argument of regexec(), re_search(), etc..  */
+  const unsigned char *raw_mbs;
+  /* Store the multibyte string.  In case of "case insensitive mode" like
+     REG_ICASE, upper cases of the string are stored, otherwise MBS points
+     the same address that RAW_MBS points.  */
+  unsigned char *mbs;
+  /* Store the wide character string which is corresponding to MBS.  */
+  wint_t *wcs;
+  Idx *offsets;
+  mbstate_t cur_state;
+  /* Index in RAW_MBS.  Each character mbs[i] corresponds to
+     raw_mbs[raw_mbs_idx + i].  */
+  Idx raw_mbs_idx;
+  /* The length of the valid characters in the buffers.  */
+  Idx valid_len;
+  /* The corresponding number of bytes in raw_mbs array.  */
+  Idx valid_raw_len;
+  /* The length of the buffers MBS and WCS.  */
+  Idx bufs_len;
+  /* The index in MBS, which is updated by re_string_fetch_byte.  */
+  Idx cur_idx;
+  /* length of RAW_MBS array.  */
+  Idx raw_len;
+  /* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN.  */
+  Idx len;
+  /* End of the buffer may be shorter than its length in the cases such
+     as re_match_2, re_search_2.  Then, we use STOP for end of the buffer
+     instead of LEN.  */
+  Idx raw_stop;
+  /* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS.  */
+  Idx stop;
+
+  /* The context of mbs[0].  We store the context independently, since
+     the context of mbs[0] may be different from raw_mbs[0], which is
+     the beginning of the input string.  */
+  unsigned int tip_context;
+  /* The translation passed as a part of an argument of re_compile_pattern.  */
+  RE_TRANSLATE_TYPE trans;
+  /* Copy of re_dfa_t's word_char.  */
+  re_const_bitset_ptr_t word_char;
+  /* true if REG_ICASE.  */
+  unsigned char icase;
+  unsigned char is_utf8;
+  unsigned char map_notascii;
+  unsigned char mbs_allocated;
+  unsigned char offsets_needed;
+  unsigned char newline_anchor;
+  unsigned char word_ops_used;
+  int mb_cur_max;
+};
+typedef struct re_string_t re_string_t;
+
+
+struct re_dfa_t;
+typedef struct re_dfa_t re_dfa_t;
+
+#ifndef _LIBC
+# define IS_IN(libc) false
+#endif
+
+#define re_string_peek_byte(pstr, offset) \
+  ((pstr)->mbs[(pstr)->cur_idx + offset])
+#define re_string_fetch_byte(pstr) \
+  ((pstr)->mbs[(pstr)->cur_idx++])
+#define re_string_first_byte(pstr, idx) \
+  ((idx) == (pstr)->valid_len || (pstr)->wcs[idx] != WEOF)
+#define re_string_is_single_byte_char(pstr, idx) \
+  ((pstr)->wcs[idx] != WEOF && ((pstr)->valid_len == (idx) + 1 \
+                               || (pstr)->wcs[(idx) + 1] != WEOF))
+#define re_string_eoi(pstr) ((pstr)->stop <= (pstr)->cur_idx)
+#define re_string_cur_idx(pstr) ((pstr)->cur_idx)
+#define re_string_get_buffer(pstr) ((pstr)->mbs)
+#define re_string_length(pstr) ((pstr)->len)
+#define re_string_byte_at(pstr,idx) ((pstr)->mbs[idx])
+#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
+#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
+
+#ifdef _LIBC
+# define MALLOC_0_IS_NONNULL 1
+#elif !defined MALLOC_0_IS_NONNULL
+# define MALLOC_0_IS_NONNULL 0
+#endif
+
+#ifndef MAX
+# define MAX(a,b) ((a) < (b) ? (b) : (a))
+#endif
+#ifndef MIN
+# define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
+#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
+#define re_free(p) free (p)
+
+struct bin_tree_t
+{
+  struct bin_tree_t *parent;
+  struct bin_tree_t *left;
+  struct bin_tree_t *right;
+  struct bin_tree_t *first;
+  struct bin_tree_t *next;
+
+  re_token_t token;
+
+  /* 'node_idx' is the index in dfa->nodes, if 'type' == 0.
+     Otherwise 'type' indicate the type of this node.  */
+  Idx node_idx;
+};
+typedef struct bin_tree_t bin_tree_t;
+
+#define BIN_TREE_STORAGE_SIZE \
+  ((1024 - sizeof (void *)) / sizeof (bin_tree_t))
+
+struct bin_tree_storage_t
+{
+  struct bin_tree_storage_t *next;
+  bin_tree_t data[BIN_TREE_STORAGE_SIZE];
+};
+typedef struct bin_tree_storage_t bin_tree_storage_t;
+
+#define CONTEXT_WORD 1
+#define CONTEXT_NEWLINE (CONTEXT_WORD << 1)
+#define CONTEXT_BEGBUF (CONTEXT_NEWLINE << 1)
+#define CONTEXT_ENDBUF (CONTEXT_BEGBUF << 1)
+
+#define IS_WORD_CONTEXT(c) ((c) & CONTEXT_WORD)
+#define IS_NEWLINE_CONTEXT(c) ((c) & CONTEXT_NEWLINE)
+#define IS_BEGBUF_CONTEXT(c) ((c) & CONTEXT_BEGBUF)
+#define IS_ENDBUF_CONTEXT(c) ((c) & CONTEXT_ENDBUF)
+#define IS_ORDINARY_CONTEXT(c) ((c) == 0)
+
+#define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_')
+#define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR)
+#define IS_WIDE_WORD_CHAR(ch) (__iswalnum (ch) || (ch) == L'_')
+#define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR)
+
+#define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \
+ ((((constraint) & PREV_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
+  || ((constraint & PREV_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
+  || ((constraint & PREV_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context))\
+  || ((constraint & PREV_BEGBUF_CONSTRAINT) && !IS_BEGBUF_CONTEXT (context)))
+
+#define NOT_SATISFY_NEXT_CONSTRAINT(constraint,context) \
+ ((((constraint) & NEXT_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
+  || (((constraint) & NEXT_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
+  || (((constraint) & NEXT_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context)) \
+  || (((constraint) & NEXT_ENDBUF_CONSTRAINT) && !IS_ENDBUF_CONTEXT (context)))
+
+struct re_dfastate_t
+{
+  re_hashval_t hash;
+  re_node_set nodes;
+  re_node_set non_eps_nodes;
+  re_node_set inveclosure;
+  re_node_set *entrance_nodes;
+  struct re_dfastate_t **trtable, **word_trtable;
+  unsigned int context : 4;
+  unsigned int halt : 1;
+  /* If this state can accept "multi byte".
+     Note that we refer to multibyte characters, and multi character
+     collating elements as "multi byte".  */
+  unsigned int accept_mb : 1;
+  /* If this state has backreference node(s).  */
+  unsigned int has_backref : 1;
+  unsigned int has_constraint : 1;
+};
+typedef struct re_dfastate_t re_dfastate_t;
+
+struct re_state_table_entry
+{
+  Idx num;
+  Idx alloc;
+  re_dfastate_t **array;
+};
+
+/* Array type used in re_sub_match_last_t and re_sub_match_top_t.  */
+
+typedef struct
+{
+  Idx next_idx;
+  Idx alloc;
+  re_dfastate_t **array;
+} state_array_t;
+
+/* Store information about the node NODE whose type is OP_CLOSE_SUBEXP.  */
+
+typedef struct
+{
+  Idx node;
+  Idx str_idx; /* The position NODE match at.  */
+  state_array_t path;
+} re_sub_match_last_t;
+
+/* Store information about the node NODE whose type is OP_OPEN_SUBEXP.
+   And information about the node, whose type is OP_CLOSE_SUBEXP,
+   corresponding to NODE is stored in LASTS.  */
+
+typedef struct
+{
+  Idx str_idx;
+  Idx node;
+  state_array_t *path;
+  Idx alasts; /* Allocation size of LASTS.  */
+  Idx nlasts; /* The number of LASTS.  */
+  re_sub_match_last_t **lasts;
+} re_sub_match_top_t;
+
+struct re_backref_cache_entry
+{
+  Idx node;
+  Idx str_idx;
+  Idx subexp_from;
+  Idx subexp_to;
+  bitset_word_t eps_reachable_subexps_map;
+  char more;
+};
+
+typedef struct
+{
+  /* The string object corresponding to the input string.  */
+  re_string_t input;
+  const re_dfa_t *const dfa;
+  /* EFLAGS of the argument of regexec.  */
+  int eflags;
+  /* Where the matching ends.  */
+  Idx match_last;
+  Idx last_node;
+  /* The state log used by the matcher.  */
+  re_dfastate_t **state_log;
+  Idx state_log_top;
+  /* Back reference cache.  */
+  Idx nbkref_ents;
+  Idx abkref_ents;
+  struct re_backref_cache_entry *bkref_ents;
+  int max_mb_elem_len;
+  Idx nsub_tops;
+  Idx asub_tops;
+  re_sub_match_top_t **sub_tops;
+} re_match_context_t;
+
+typedef struct
+{
+  re_dfastate_t **sifted_states;
+  re_dfastate_t **limited_states;
+  Idx last_node;
+  Idx last_str_idx;
+  re_node_set limits;
+} re_sift_context_t;
+
+struct re_fail_stack_ent_t
+{
+  Idx idx;
+  Idx node;
+  regmatch_t *regs;
+  re_node_set eps_via_nodes;
+};
+
+struct re_fail_stack_t
+{
+  Idx num;
+  Idx alloc;
+  struct re_fail_stack_ent_t *stack;
+};
+
+struct re_dfa_t
+{
+  re_token_t *nodes;
+  size_t nodes_alloc;
+  size_t nodes_len;
+  Idx *nexts;
+  Idx *org_indices;
+  re_node_set *edests;
+  re_node_set *eclosures;
+  re_node_set *inveclosures;
+  struct re_state_table_entry *state_table;
+  re_dfastate_t *init_state;
+  re_dfastate_t *init_state_word;
+  re_dfastate_t *init_state_nl;
+  re_dfastate_t *init_state_begbuf;
+  bin_tree_t *str_tree;
+  bin_tree_storage_t *str_tree_storage;
+  re_bitset_ptr_t sb_char;
+  int str_tree_storage_idx;
+
+  /* number of subexpressions 're_nsub' is in regex_t.  */
+  re_hashval_t state_hash_mask;
+  Idx init_node;
+  Idx nbackref; /* The number of backreference in this dfa.  */
+
+  /* Bitmap expressing which backreference is used.  */
+  bitset_word_t used_bkref_map;
+  bitset_word_t completed_bkref_map;
+
+  unsigned int has_plural_match : 1;
+  /* If this dfa has "multibyte node", which is a backreference or
+     a node which can accept multibyte character or multi character
+     collating element.  */
+  unsigned int has_mb_node : 1;
+  unsigned int is_utf8 : 1;
+  unsigned int map_notascii : 1;
+  unsigned int word_ops_used : 1;
+  int mb_cur_max;
+  bitset_t word_char;
+  reg_syntax_t syntax;
+  Idx *subexp_map;
+#ifdef DEBUG
+  char* re_str;
+#endif
+  lock_define (lock)
+};
+
+#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
+#define re_node_set_remove(set,id) \
+  (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
+#define re_node_set_empty(p) ((p)->nelem = 0)
+#define re_node_set_free(set) re_free ((set)->elems)
+\f
+
+typedef enum
+{
+  SB_CHAR,
+  MB_CHAR,
+  EQUIV_CLASS,
+  COLL_SYM,
+  CHAR_CLASS
+} bracket_elem_type;
+
+typedef struct
+{
+  bracket_elem_type type;
+  union
+  {
+    unsigned char ch;
+    unsigned char *name;
+    wchar_t wch;
+  } opr;
+} bracket_elem_t;
+
+
+/* Functions for bitset_t operation.  */
+
+static inline void
+bitset_set (bitset_t set, Idx i)
+{
+  set[i / BITSET_WORD_BITS] |= (bitset_word_t) 1 << i % BITSET_WORD_BITS;
+}
+
+static inline void
+bitset_clear (bitset_t set, Idx i)
+{
+  set[i / BITSET_WORD_BITS] &= ~ ((bitset_word_t) 1 << i % BITSET_WORD_BITS);
+}
+
+static inline bool
+bitset_contain (const bitset_t set, Idx i)
+{
+  return (set[i / BITSET_WORD_BITS] >> i % BITSET_WORD_BITS) & 1;
+}
+
+static inline void
+bitset_empty (bitset_t set)
+{
+  memset (set, '\0', sizeof (bitset_t));
+}
+
+static inline void
+bitset_set_all (bitset_t set)
+{
+  memset (set, -1, sizeof (bitset_word_t) * (SBC_MAX / BITSET_WORD_BITS));
+  if (SBC_MAX % BITSET_WORD_BITS != 0)
+    set[BITSET_WORDS - 1] =
+      ((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1;
+}
+
+static inline void
+bitset_copy (bitset_t dest, const bitset_t src)
+{
+  memcpy (dest, src, sizeof (bitset_t));
+}
+
+static inline void
+bitset_not (bitset_t set)
+{
+  int bitset_i;
+  for (bitset_i = 0; bitset_i < SBC_MAX / BITSET_WORD_BITS; ++bitset_i)
+    set[bitset_i] = ~set[bitset_i];
+  if (SBC_MAX % BITSET_WORD_BITS != 0)
+    set[BITSET_WORDS - 1] =
+      ((((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1)
+       & ~set[BITSET_WORDS - 1]);
+}
+
+static inline void
+bitset_merge (bitset_t dest, const bitset_t src)
+{
+  int bitset_i;
+  for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
+    dest[bitset_i] |= src[bitset_i];
+}
+
+static inline void
+bitset_mask (bitset_t dest, const bitset_t src)
+{
+  int bitset_i;
+  for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
+    dest[bitset_i] &= src[bitset_i];
+}
+
+/* Functions for re_string.  */
+static int
+__attribute__ ((pure, unused))
+re_string_char_size_at (const re_string_t *pstr, Idx idx)
+{
+  int byte_idx;
+  if (pstr->mb_cur_max == 1)
+    return 1;
+  for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
+    if (pstr->wcs[idx + byte_idx] != WEOF)
+      break;
+  return byte_idx;
+}
+
+static wint_t
+__attribute__ ((pure, unused))
+re_string_wchar_at (const re_string_t *pstr, Idx idx)
+{
+  if (pstr->mb_cur_max == 1)
+    return (wint_t) pstr->mbs[idx];
+  return (wint_t) pstr->wcs[idx];
+}
+
+#ifdef _LIBC
+# include <locale/weight.h>
+#endif
+
+static int
+__attribute__ ((pure, unused))
+re_string_elem_size_at (const re_string_t *pstr, Idx idx)
+{
+#ifdef _LIBC
+  const unsigned char *p, *extra;
+  const int32_t *table, *indirect;
+  uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+
+  if (nrules != 0)
+    {
+      table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
+      extra = (const unsigned char *)
+       _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
+      indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
+                                               _NL_COLLATE_INDIRECTMB);
+      p = pstr->mbs + idx;
+      findidx (table, indirect, extra, &p, pstr->len - idx);
+      return p - pstr->mbs - idx;
+    }
+#endif /* _LIBC */
+
+  return 1;
+}
+
+#ifdef _LIBC
+# if __glibc_has_attribute (__fallthrough__)
+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define FALLTHROUGH ((void) 0)
+# endif
+#else
+# include "attribute.h"
+#endif
+
+#endif /*  _REGEX_INTERNAL_H */
deleted file mode 120000 (symlink)
index 5be8b9d9353fd8abcab9c8b417c5afe455946474..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/regexec.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9f065dfa020ce1d740d7985e2d0d60db1bc1986d
--- /dev/null
+/* Extended regular expression matching and search library.
+   Copyright (C) 2002-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
+                                    Idx n);
+static void match_ctx_clean (re_match_context_t *mctx);
+static void match_ctx_free (re_match_context_t *cache);
+static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, Idx node,
+                                         Idx str_idx, Idx from, Idx to);
+static Idx search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx);
+static reg_errcode_t match_ctx_add_subtop (re_match_context_t *mctx, Idx node,
+                                          Idx str_idx);
+static re_sub_match_last_t * match_ctx_add_sublast (re_sub_match_top_t *subtop,
+                                                   Idx node, Idx str_idx);
+static void sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts,
+                          re_dfastate_t **limited_sts, Idx last_node,
+                          Idx last_str_idx);
+static reg_errcode_t re_search_internal (const regex_t *preg,
+                                        const char *string, Idx length,
+                                        Idx start, Idx last_start, Idx stop,
+                                        size_t nmatch, regmatch_t pmatch[],
+                                        int eflags);
+static regoff_t re_search_2_stub (struct re_pattern_buffer *bufp,
+                                 const char *string1, Idx length1,
+                                 const char *string2, Idx length2,
+                                 Idx start, regoff_t range,
+                                 struct re_registers *regs,
+                                 Idx stop, bool ret_len);
+static regoff_t re_search_stub (struct re_pattern_buffer *bufp,
+                               const char *string, Idx length, Idx start,
+                               regoff_t range, Idx stop,
+                               struct re_registers *regs,
+                               bool ret_len);
+static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
+                              Idx nregs, int regs_allocated);
+static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx);
+static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match,
+                          Idx *p_match_first);
+static Idx check_halt_state_context (const re_match_context_t *mctx,
+                                    const re_dfastate_t *state, Idx idx);
+static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch,
+                        regmatch_t *prev_idx_match, Idx cur_node,
+                        Idx cur_idx, Idx nmatch);
+static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs,
+                                     Idx str_idx, Idx dest_node, Idx nregs,
+                                     regmatch_t *regs, regmatch_t *prevregs,
+                                     re_node_set *eps_via_nodes);
+static reg_errcode_t set_regs (const regex_t *preg,
+                              const re_match_context_t *mctx,
+                              size_t nmatch, regmatch_t *pmatch,
+                              bool fl_backtrack);
+static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs);
+
+static int sift_states_iter_mb (const re_match_context_t *mctx,
+                               re_sift_context_t *sctx,
+                               Idx node_idx, Idx str_idx, Idx max_str_idx);
+static reg_errcode_t sift_states_backward (const re_match_context_t *mctx,
+                                          re_sift_context_t *sctx);
+static reg_errcode_t build_sifted_states (const re_match_context_t *mctx,
+                                         re_sift_context_t *sctx, Idx str_idx,
+                                         re_node_set *cur_dest);
+static reg_errcode_t update_cur_sifted_state (const re_match_context_t *mctx,
+                                             re_sift_context_t *sctx,
+                                             Idx str_idx,
+                                             re_node_set *dest_nodes);
+static reg_errcode_t add_epsilon_src_nodes (const re_dfa_t *dfa,
+                                           re_node_set *dest_nodes,
+                                           const re_node_set *candidates);
+static bool check_dst_limits (const re_match_context_t *mctx,
+                             const re_node_set *limits,
+                             Idx dst_node, Idx dst_idx, Idx src_node,
+                             Idx src_idx);
+static int check_dst_limits_calc_pos_1 (const re_match_context_t *mctx,
+                                       int boundaries, Idx subexp_idx,
+                                       Idx from_node, Idx bkref_idx);
+static int check_dst_limits_calc_pos (const re_match_context_t *mctx,
+                                     Idx limit, Idx subexp_idx,
+                                     Idx node, Idx str_idx,
+                                     Idx bkref_idx);
+static reg_errcode_t check_subexp_limits (const re_dfa_t *dfa,
+                                         re_node_set *dest_nodes,
+                                         const re_node_set *candidates,
+                                         re_node_set *limits,
+                                         struct re_backref_cache_entry *bkref_ents,
+                                         Idx str_idx);
+static reg_errcode_t sift_states_bkref (const re_match_context_t *mctx,
+                                       re_sift_context_t *sctx,
+                                       Idx str_idx, const re_node_set *candidates);
+static reg_errcode_t merge_state_array (const re_dfa_t *dfa,
+                                       re_dfastate_t **dst,
+                                       re_dfastate_t **src, Idx num);
+static re_dfastate_t *find_recover_state (reg_errcode_t *err,
+                                        re_match_context_t *mctx);
+static re_dfastate_t *transit_state (reg_errcode_t *err,
+                                    re_match_context_t *mctx,
+                                    re_dfastate_t *state);
+static re_dfastate_t *merge_state_with_log (reg_errcode_t *err,
+                                           re_match_context_t *mctx,
+                                           re_dfastate_t *next_state);
+static reg_errcode_t check_subexp_matching_top (re_match_context_t *mctx,
+                                               re_node_set *cur_nodes,
+                                               Idx str_idx);
+#if 0
+static re_dfastate_t *transit_state_sb (reg_errcode_t *err,
+                                       re_match_context_t *mctx,
+                                       re_dfastate_t *pstate);
+#endif
+static reg_errcode_t transit_state_mb (re_match_context_t *mctx,
+                                      re_dfastate_t *pstate);
+static reg_errcode_t transit_state_bkref (re_match_context_t *mctx,
+                                         const re_node_set *nodes);
+static reg_errcode_t get_subexp (re_match_context_t *mctx,
+                                Idx bkref_node, Idx bkref_str_idx);
+static reg_errcode_t get_subexp_sub (re_match_context_t *mctx,
+                                    const re_sub_match_top_t *sub_top,
+                                    re_sub_match_last_t *sub_last,
+                                    Idx bkref_node, Idx bkref_str);
+static Idx find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
+                            Idx subexp_idx, int type);
+static reg_errcode_t check_arrival (re_match_context_t *mctx,
+                                   state_array_t *path, Idx top_node,
+                                   Idx top_str, Idx last_node, Idx last_str,
+                                   int type);
+static reg_errcode_t check_arrival_add_next_nodes (re_match_context_t *mctx,
+                                                  Idx str_idx,
+                                                  re_node_set *cur_nodes,
+                                                  re_node_set *next_nodes);
+static reg_errcode_t check_arrival_expand_ecl (const re_dfa_t *dfa,
+                                              re_node_set *cur_nodes,
+                                              Idx ex_subexp, int type);
+static reg_errcode_t check_arrival_expand_ecl_sub (const re_dfa_t *dfa,
+                                                  re_node_set *dst_nodes,
+                                                  Idx target, Idx ex_subexp,
+                                                  int type);
+static reg_errcode_t expand_bkref_cache (re_match_context_t *mctx,
+                                        re_node_set *cur_nodes, Idx cur_str,
+                                        Idx subexp_num, int type);
+static bool build_trtable (const re_dfa_t *dfa, re_dfastate_t *state);
+static int check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
+                                   const re_string_t *input, Idx idx);
+#ifdef _LIBC
+static unsigned int find_collation_sequence_value (const unsigned char *mbs,
+                                                  size_t name_len);
+#endif
+static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa,
+                                      const re_dfastate_t *state,
+                                      re_node_set *states_node,
+                                      bitset_t *states_ch);
+static bool check_node_accept (const re_match_context_t *mctx,
+                              const re_token_t *node, Idx idx);
+static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len);
+\f
+/* Entry point for POSIX code.  */
+
+/* regexec searches for a given pattern, specified by PREG, in the
+   string STRING.
+
+   If NMATCH is zero or REG_NOSUB was set in the cflags argument to
+   'regcomp', we ignore PMATCH.  Otherwise, we assume PMATCH has at
+   least NMATCH elements, and we set them to the offsets of the
+   corresponding matched substrings.
+
+   EFLAGS specifies "execution flags" which affect matching: if
+   REG_NOTBOL is set, then ^ does not match at the beginning of the
+   string; if REG_NOTEOL is set, then $ does not match at the end.
+
+   Return 0 if a match is found, REG_NOMATCH if not, REG_BADPAT if
+   EFLAGS is invalid.  */
+
+int
+regexec (const regex_t *__restrict preg, const char *__restrict string,
+        size_t nmatch, regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags)
+{
+  reg_errcode_t err;
+  Idx start, length;
+  re_dfa_t *dfa = preg->buffer;
+
+  if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
+    return REG_BADPAT;
+
+  if (eflags & REG_STARTEND)
+    {
+      start = pmatch[0].rm_so;
+      length = pmatch[0].rm_eo;
+    }
+  else
+    {
+      start = 0;
+      length = strlen (string);
+    }
+
+  lock_lock (dfa->lock);
+  if (preg->no_sub)
+    err = re_search_internal (preg, string, length, start, length,
+                             length, 0, NULL, eflags);
+  else
+    err = re_search_internal (preg, string, length, start, length,
+                             length, nmatch, pmatch, eflags);
+  lock_unlock (dfa->lock);
+  return err != REG_NOERROR;
+}
+
+#ifdef _LIBC
+libc_hidden_def (__regexec)
+
+# include <shlib-compat.h>
+versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
+
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+__typeof__ (__regexec) __compat_regexec;
+
+int
+attribute_compat_text_section
+__compat_regexec (const regex_t *__restrict preg,
+                 const char *__restrict string, size_t nmatch,
+                 regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags)
+{
+  return regexec (preg, string, nmatch, pmatch,
+                 eflags & (REG_NOTBOL | REG_NOTEOL));
+}
+compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
+# endif
+#endif
+
+/* Entry points for GNU code.  */
+
+/* re_match, re_search, re_match_2, re_search_2
+
+   The former two functions operate on STRING with length LENGTH,
+   while the later two operate on concatenation of STRING1 and STRING2
+   with lengths LENGTH1 and LENGTH2, respectively.
+
+   re_match() matches the compiled pattern in BUFP against the string,
+   starting at index START.
+
+   re_search() first tries matching at index START, then it tries to match
+   starting from index START + 1, and so on.  The last start position tried
+   is START + RANGE.  (Thus RANGE = 0 forces re_search to operate the same
+   way as re_match().)
+
+   The parameter STOP of re_{match,search}_2 specifies that no match exceeding
+   the first STOP characters of the concatenation of the strings should be
+   concerned.
+
+   If REGS is not NULL, and BUFP->no_sub is not set, the offsets of the match
+   and all groups is stored in REGS.  (For the "_2" variants, the offsets are
+   computed relative to the concatenation, not relative to the individual
+   strings.)
+
+   On success, re_match* functions return the length of the match, re_search*
+   return the position of the start of the match.  They return -1 on
+   match failure, -2 on error.  */
+
+regoff_t
+re_match (struct re_pattern_buffer *bufp, const char *string, Idx length,
+         Idx start, struct re_registers *regs)
+{
+  return re_search_stub (bufp, string, length, start, 0, length, regs, true);
+}
+#ifdef _LIBC
+weak_alias (__re_match, re_match)
+#endif
+
+regoff_t
+re_search (struct re_pattern_buffer *bufp, const char *string, Idx length,
+          Idx start, regoff_t range, struct re_registers *regs)
+{
+  return re_search_stub (bufp, string, length, start, range, length, regs,
+                        false);
+}
+#ifdef _LIBC
+weak_alias (__re_search, re_search)
+#endif
+
+regoff_t
+re_match_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1,
+           const char *string2, Idx length2, Idx start,
+           struct re_registers *regs, Idx stop)
+{
+  return re_search_2_stub (bufp, string1, length1, string2, length2,
+                          start, 0, regs, stop, true);
+}
+#ifdef _LIBC
+weak_alias (__re_match_2, re_match_2)
+#endif
+
+regoff_t
+re_search_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1,
+            const char *string2, Idx length2, Idx start, regoff_t range,
+            struct re_registers *regs, Idx stop)
+{
+  return re_search_2_stub (bufp, string1, length1, string2, length2,
+                          start, range, regs, stop, false);
+}
+#ifdef _LIBC
+weak_alias (__re_search_2, re_search_2)
+#endif
+
+static regoff_t
+re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1,
+                 Idx length1, const char *string2, Idx length2, Idx start,
+                 regoff_t range, struct re_registers *regs,
+                 Idx stop, bool ret_len)
+{
+  const char *str;
+  regoff_t rval;
+  Idx len;
+  char *s = NULL;
+
+  if (__glibc_unlikely ((length1 < 0 || length2 < 0 || stop < 0
+                        || ckd_add (&len, length1, length2))))
+    return -2;
+
+  /* Concatenate the strings.  */
+  if (length2 > 0)
+    if (length1 > 0)
+      {
+       s = re_malloc (char, len);
+
+       if (__glibc_unlikely (s == NULL))
+         return -2;
+#ifdef _LIBC
+       memcpy (__mempcpy (s, string1, length1), string2, length2);
+#else
+       memcpy (s, string1, length1);
+       memcpy (s + length1, string2, length2);
+#endif
+       str = s;
+      }
+    else
+      str = string2;
+  else
+    str = string1;
+
+  rval = re_search_stub (bufp, str, len, start, range, stop, regs,
+                        ret_len);
+  re_free (s);
+  return rval;
+}
+
+/* The parameters have the same meaning as those of re_search.
+   Additional parameters:
+   If RET_LEN is true the length of the match is returned (re_match style);
+   otherwise the position of the match is returned.  */
+
+static regoff_t
+re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length,
+               Idx start, regoff_t range, Idx stop, struct re_registers *regs,
+               bool ret_len)
+{
+  reg_errcode_t result;
+  regmatch_t *pmatch;
+  Idx nregs;
+  regoff_t rval;
+  int eflags = 0;
+  re_dfa_t *dfa = bufp->buffer;
+  Idx last_start = start + range;
+
+  /* Check for out-of-range.  */
+  if (__glibc_unlikely (start < 0 || start > length))
+    return -1;
+  if (__glibc_unlikely (length < last_start
+                       || (0 <= range && last_start < start)))
+    last_start = length;
+  else if (__glibc_unlikely (last_start < 0
+                            || (range < 0 && start <= last_start)))
+    last_start = 0;
+
+  lock_lock (dfa->lock);
+
+  eflags |= (bufp->not_bol) ? REG_NOTBOL : 0;
+  eflags |= (bufp->not_eol) ? REG_NOTEOL : 0;
+
+  /* Compile fastmap if we haven't yet.  */
+  if (start < last_start && bufp->fastmap != NULL && !bufp->fastmap_accurate)
+    re_compile_fastmap (bufp);
+
+  if (__glibc_unlikely (bufp->no_sub))
+    regs = NULL;
+
+  /* We need at least 1 register.  */
+  if (regs == NULL)
+    nregs = 1;
+  else if (__glibc_unlikely (bufp->regs_allocated == REGS_FIXED
+                            && regs->num_regs <= bufp->re_nsub))
+    {
+      nregs = regs->num_regs;
+      if (__glibc_unlikely (nregs < 1))
+       {
+         /* Nothing can be copied to regs.  */
+         regs = NULL;
+         nregs = 1;
+       }
+    }
+  else
+    nregs = bufp->re_nsub + 1;
+  pmatch = re_malloc (regmatch_t, nregs);
+  if (__glibc_unlikely (pmatch == NULL))
+    {
+      rval = -2;
+      goto out;
+    }
+
+  result = re_search_internal (bufp, string, length, start, last_start, stop,
+                              nregs, pmatch, eflags);
+
+  rval = 0;
+
+  /* I hope we needn't fill their regs with -1's when no match was found.  */
+  if (result != REG_NOERROR)
+    rval = result == REG_NOMATCH ? -1 : -2;
+  else if (regs != NULL)
+    {
+      /* If caller wants register contents data back, copy them.  */
+      bufp->regs_allocated = re_copy_regs (regs, pmatch, nregs,
+                                          bufp->regs_allocated);
+      if (__glibc_unlikely (bufp->regs_allocated == REGS_UNALLOCATED))
+       rval = -2;
+    }
+
+  if (__glibc_likely (rval == 0))
+    {
+      if (ret_len)
+       {
+         DEBUG_ASSERT (pmatch[0].rm_so == start);
+         rval = pmatch[0].rm_eo - start;
+       }
+      else
+       rval = pmatch[0].rm_so;
+    }
+  re_free (pmatch);
+ out:
+  lock_unlock (dfa->lock);
+  return rval;
+}
+
+static unsigned
+re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs,
+             int regs_allocated)
+{
+  int rval = REGS_REALLOCATE;
+  Idx i;
+  Idx need_regs = nregs + 1;
+  /* We need one extra element beyond 'num_regs' for the '-1' marker GNU code
+     uses.  */
+
+  /* Have the register data arrays been allocated?  */
+  if (regs_allocated == REGS_UNALLOCATED)
+    { /* No.  So allocate them with malloc.  */
+      regs->start = re_malloc (regoff_t, need_regs);
+      if (__glibc_unlikely (regs->start == NULL))
+       return REGS_UNALLOCATED;
+      regs->end = re_malloc (regoff_t, need_regs);
+      if (__glibc_unlikely (regs->end == NULL))
+       {
+         re_free (regs->start);
+         return REGS_UNALLOCATED;
+       }
+      regs->num_regs = need_regs;
+    }
+  else if (regs_allocated == REGS_REALLOCATE)
+    { /* Yes.  If we need more elements than were already
+        allocated, reallocate them.  If we need fewer, just
+        leave it alone.  */
+      if (__glibc_unlikely (need_regs > regs->num_regs))
+       {
+         regoff_t *new_start = re_realloc (regs->start, regoff_t, need_regs);
+         regoff_t *new_end;
+         if (__glibc_unlikely (new_start == NULL))
+           return REGS_UNALLOCATED;
+         new_end = re_realloc (regs->end, regoff_t, need_regs);
+         if (__glibc_unlikely (new_end == NULL))
+           {
+             re_free (new_start);
+             return REGS_UNALLOCATED;
+           }
+         regs->start = new_start;
+         regs->end = new_end;
+         regs->num_regs = need_regs;
+       }
+    }
+  else
+    {
+      DEBUG_ASSERT (regs_allocated == REGS_FIXED);
+      /* This function may not be called with REGS_FIXED and nregs too big.  */
+      DEBUG_ASSERT (nregs <= regs->num_regs);
+      rval = REGS_FIXED;
+    }
+
+  /* Copy the regs.  */
+  for (i = 0; i < nregs; ++i)
+    {
+      regs->start[i] = pmatch[i].rm_so;
+      regs->end[i] = pmatch[i].rm_eo;
+    }
+  for ( ; i < regs->num_regs; ++i)
+    regs->start[i] = regs->end[i] = -1;
+
+  return rval;
+}
+
+/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
+   ENDS.  Subsequent matches using PATTERN_BUFFER and REGS will use
+   this memory for recording register information.  STARTS and ENDS
+   must be allocated using the malloc library routine, and must each
+   be at least NUM_REGS * sizeof (regoff_t) bytes long.
+
+   If NUM_REGS == 0, then subsequent matches should allocate their own
+   register data.
+
+   Unless this function is called, the first search or match using
+   PATTERN_BUFFER will allocate its own register data, without
+   freeing the old data.  */
+
+void
+re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs,
+                 __re_size_t num_regs, regoff_t *starts, regoff_t *ends)
+{
+  if (num_regs)
+    {
+      bufp->regs_allocated = REGS_REALLOCATE;
+      regs->num_regs = num_regs;
+      regs->start = starts;
+      regs->end = ends;
+    }
+  else
+    {
+      bufp->regs_allocated = REGS_UNALLOCATED;
+      regs->num_regs = 0;
+      regs->start = regs->end = NULL;
+    }
+}
+#ifdef _LIBC
+weak_alias (__re_set_registers, re_set_registers)
+#endif
+\f
+/* Entry points compatible with 4.2 BSD regex library.  We don't define
+   them unless specifically requested.  */
+
+#if defined _REGEX_RE_COMP || defined _LIBC
+int
+# ifdef _LIBC
+weak_function
+# endif
+re_exec (const char *s)
+{
+  return 0 == regexec (&re_comp_buf, s, 0, NULL, 0);
+}
+#endif /* _REGEX_RE_COMP */
+\f
+/* Internal entry point.  */
+
+/* Searches for a compiled pattern PREG in the string STRING, whose
+   length is LENGTH.  NMATCH, PMATCH, and EFLAGS have the same
+   meaning as with regexec.  LAST_START is START + RANGE, where
+   START and RANGE have the same meaning as with re_search.
+   Return REG_NOERROR if we find a match, and REG_NOMATCH if not,
+   otherwise return the error code.
+   Note: We assume front end functions already check ranges.
+   (0 <= LAST_START && LAST_START <= LENGTH)  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+re_search_internal (const regex_t *preg, const char *string, Idx length,
+                   Idx start, Idx last_start, Idx stop, size_t nmatch,
+                   regmatch_t pmatch[], int eflags)
+{
+  reg_errcode_t err;
+  const re_dfa_t *dfa = preg->buffer;
+  Idx left_lim, right_lim;
+  int incr;
+  bool fl_longest_match;
+  int match_kind;
+  Idx match_first;
+  Idx match_last = -1;
+  Idx extra_nmatch;
+  bool sb;
+  int ch;
+  re_match_context_t mctx = { .dfa = dfa };
+  char *fastmap = ((preg->fastmap != NULL && preg->fastmap_accurate
+                   && start != last_start && !preg->can_be_null)
+                  ? preg->fastmap : NULL);
+  RE_TRANSLATE_TYPE t = preg->translate;
+
+  extra_nmatch = (nmatch > preg->re_nsub) ? nmatch - (preg->re_nsub + 1) : 0;
+  nmatch -= extra_nmatch;
+
+  /* Check if the DFA haven't been compiled.  */
+  if (__glibc_unlikely (preg->used == 0 || dfa->init_state == NULL
+                       || dfa->init_state_word == NULL
+                       || dfa->init_state_nl == NULL
+                       || dfa->init_state_begbuf == NULL))
+    return REG_NOMATCH;
+
+  /* We assume front-end functions already check them.  */
+  DEBUG_ASSERT (0 <= last_start && last_start <= length);
+
+  /* If initial states with non-begbuf contexts have no elements,
+     the regex must be anchored.  If preg->newline_anchor is set,
+     we'll never use init_state_nl, so do not check it.  */
+  if (dfa->init_state->nodes.nelem == 0
+      && dfa->init_state_word->nodes.nelem == 0
+      && (dfa->init_state_nl->nodes.nelem == 0
+         || !preg->newline_anchor))
+    {
+      if (start != 0 && last_start != 0)
+        return REG_NOMATCH;
+      start = last_start = 0;
+    }
+
+  /* We must check the longest matching, if nmatch > 0.  */
+  fl_longest_match = (nmatch != 0 || dfa->nbackref);
+
+  err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1,
+                           preg->translate, (preg->syntax & RE_ICASE) != 0,
+                           dfa);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    goto free_return;
+  mctx.input.stop = stop;
+  mctx.input.raw_stop = stop;
+  mctx.input.newline_anchor = preg->newline_anchor;
+
+  err = match_ctx_init (&mctx, eflags, dfa->nbackref * 2);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    goto free_return;
+
+  /* We will log all the DFA states through which the dfa pass,
+     if nmatch > 1, or this dfa has "multibyte node", which is a
+     back-reference or a node which can accept multibyte character or
+     multi character collating element.  */
+  if (nmatch > 1 || dfa->has_mb_node)
+    {
+      /* Avoid overflow.  */
+      if (__glibc_unlikely ((MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *))
+                            <= mctx.input.bufs_len)))
+       {
+         err = REG_ESPACE;
+         goto free_return;
+       }
+
+      mctx.state_log = re_malloc (re_dfastate_t *, mctx.input.bufs_len + 1);
+      if (__glibc_unlikely (mctx.state_log == NULL))
+       {
+         err = REG_ESPACE;
+         goto free_return;
+       }
+    }
+
+  match_first = start;
+  mctx.input.tip_context = (eflags & REG_NOTBOL) ? CONTEXT_BEGBUF
+                          : CONTEXT_NEWLINE | CONTEXT_BEGBUF;
+
+  /* Check incrementally whether the input string matches.  */
+  incr = (last_start < start) ? -1 : 1;
+  left_lim = (last_start < start) ? last_start : start;
+  right_lim = (last_start < start) ? start : last_start;
+  sb = dfa->mb_cur_max == 1;
+  match_kind =
+    (fastmap
+     ? ((sb || !(preg->syntax & RE_ICASE || t) ? 4 : 0)
+       | (start <= last_start ? 2 : 0)
+       | (t != NULL ? 1 : 0))
+     : 8);
+
+  for (;; match_first += incr)
+    {
+      err = REG_NOMATCH;
+      if (match_first < left_lim || right_lim < match_first)
+       goto free_return;
+
+      /* Advance as rapidly as possible through the string, until we
+        find a plausible place to start matching.  This may be done
+        with varying efficiency, so there are various possibilities:
+        only the most common of them are specialized, in order to
+        save on code size.  We use a switch statement for speed.  */
+      switch (match_kind)
+       {
+       case 8:
+         /* No fastmap.  */
+         break;
+
+       case 7:
+         /* Fastmap with single-byte translation, match forward.  */
+         while (__glibc_likely (match_first < right_lim)
+                && !fastmap[t[(unsigned char) string[match_first]]])
+           ++match_first;
+         goto forward_match_found_start_or_reached_end;
+
+       case 6:
+         /* Fastmap without translation, match forward.  */
+         while (__glibc_likely (match_first < right_lim)
+                && !fastmap[(unsigned char) string[match_first]])
+           ++match_first;
+
+       forward_match_found_start_or_reached_end:
+         if (__glibc_unlikely (match_first == right_lim))
+           {
+             ch = match_first >= length
+                      ? 0 : (unsigned char) string[match_first];
+             if (!fastmap[t ? t[ch] : ch])
+               goto free_return;
+           }
+         break;
+
+       case 4:
+       case 5:
+         /* Fastmap without multi-byte translation, match backwards.  */
+         while (match_first >= left_lim)
+           {
+             ch = match_first >= length
+                      ? 0 : (unsigned char) string[match_first];
+             if (fastmap[t ? t[ch] : ch])
+               break;
+             --match_first;
+           }
+         if (match_first < left_lim)
+           goto free_return;
+         break;
+
+       default:
+         /* In this case, we can't determine easily the current byte,
+            since it might be a component byte of a multibyte
+            character.  Then we use the constructed buffer instead.  */
+         for (;;)
+           {
+             /* If MATCH_FIRST is out of the valid range, reconstruct the
+                buffers.  */
+             __re_size_t offset = match_first - mctx.input.raw_mbs_idx;
+             if (__glibc_unlikely (offset
+                                   >= (__re_size_t) mctx.input.valid_raw_len))
+               {
+                 err = re_string_reconstruct (&mctx.input, match_first,
+                                              eflags);
+                 if (__glibc_unlikely (err != REG_NOERROR))
+                   goto free_return;
+
+                 offset = match_first - mctx.input.raw_mbs_idx;
+               }
+             /* Use buffer byte if OFFSET is in buffer, otherwise '\0'.  */
+             ch = (offset < mctx.input.valid_len
+                   ? re_string_byte_at (&mctx.input, offset) : 0);
+             if (fastmap[ch])
+               break;
+             match_first += incr;
+             if (match_first < left_lim || match_first > right_lim)
+               {
+                 err = REG_NOMATCH;
+                 goto free_return;
+               }
+           }
+         break;
+       }
+
+      /* Reconstruct the buffers so that the matcher can assume that
+        the matching starts from the beginning of the buffer.  */
+      err = re_string_reconstruct (&mctx.input, match_first, eflags);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       goto free_return;
+
+      /* Don't consider this char as a possible match start if it part,
+         yet isn't the head, of a multibyte character.  */
+      if (!sb && !re_string_first_byte (&mctx.input, 0))
+       continue;
+
+      /* It seems to be appropriate one, then use the matcher.  */
+      /* We assume that the matching starts from 0.  */
+      mctx.state_log_top = mctx.nbkref_ents = mctx.max_mb_elem_len = 0;
+      match_last = check_matching (&mctx, fl_longest_match,
+                                  start <= last_start ? &match_first : NULL);
+      if (match_last != -1)
+       {
+         if (__glibc_unlikely (match_last == -2))
+           {
+             err = REG_ESPACE;
+             goto free_return;
+           }
+         else
+           {
+             mctx.match_last = match_last;
+             if ((!preg->no_sub && nmatch > 1) || dfa->nbackref)
+               {
+                 re_dfastate_t *pstate = mctx.state_log[match_last];
+                 mctx.last_node = check_halt_state_context (&mctx, pstate,
+                                                            match_last);
+               }
+             if ((!preg->no_sub && nmatch > 1 && dfa->has_plural_match)
+                 || dfa->nbackref)
+               {
+                 err = prune_impossible_nodes (&mctx);
+                 if (err == REG_NOERROR)
+                   break;
+                 if (__glibc_unlikely (err != REG_NOMATCH))
+                   goto free_return;
+                 match_last = -1;
+               }
+             else
+               break; /* We found a match.  */
+           }
+       }
+
+      match_ctx_clean (&mctx);
+    }
+
+  DEBUG_ASSERT (match_last != -1);
+  DEBUG_ASSERT (err == REG_NOERROR);
+
+  /* Set pmatch[] if we need.  */
+  if (nmatch > 0)
+    {
+      Idx reg_idx;
+
+      /* Initialize registers.  */
+      for (reg_idx = 1; reg_idx < nmatch; ++reg_idx)
+       pmatch[reg_idx].rm_so = pmatch[reg_idx].rm_eo = -1;
+
+      /* Set the points where matching start/end.  */
+      pmatch[0].rm_so = 0;
+      pmatch[0].rm_eo = mctx.match_last;
+      /* FIXME: This function should fail if mctx.match_last exceeds
+        the maximum possible regoff_t value.  We need a new error
+        code REG_OVERFLOW.  */
+
+      if (!preg->no_sub && nmatch > 1)
+       {
+         err = set_regs (preg, &mctx, nmatch, pmatch,
+                         dfa->has_plural_match && dfa->nbackref > 0);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           goto free_return;
+       }
+
+      /* At last, add the offset to each register, since we slid
+        the buffers so that we could assume that the matching starts
+        from 0.  */
+      for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
+       if (pmatch[reg_idx].rm_so != -1)
+         {
+           if (__glibc_unlikely (mctx.input.offsets_needed != 0))
+             {
+               pmatch[reg_idx].rm_so =
+                 (pmatch[reg_idx].rm_so == mctx.input.valid_len
+                  ? mctx.input.valid_raw_len
+                  : mctx.input.offsets[pmatch[reg_idx].rm_so]);
+               pmatch[reg_idx].rm_eo =
+                 (pmatch[reg_idx].rm_eo == mctx.input.valid_len
+                  ? mctx.input.valid_raw_len
+                  : mctx.input.offsets[pmatch[reg_idx].rm_eo]);
+             }
+           pmatch[reg_idx].rm_so += match_first;
+           pmatch[reg_idx].rm_eo += match_first;
+         }
+      for (reg_idx = 0; reg_idx < extra_nmatch; ++reg_idx)
+       {
+         pmatch[nmatch + reg_idx].rm_so = -1;
+         pmatch[nmatch + reg_idx].rm_eo = -1;
+       }
+
+      if (dfa->subexp_map)
+       for (reg_idx = 0; reg_idx + 1 < nmatch; reg_idx++)
+         if (dfa->subexp_map[reg_idx] != reg_idx)
+           {
+             pmatch[reg_idx + 1].rm_so
+               = pmatch[dfa->subexp_map[reg_idx] + 1].rm_so;
+             pmatch[reg_idx + 1].rm_eo
+               = pmatch[dfa->subexp_map[reg_idx] + 1].rm_eo;
+           }
+    }
+
+ free_return:
+  re_free (mctx.state_log);
+  if (dfa->nbackref)
+    match_ctx_free (&mctx);
+  re_string_destruct (&mctx.input);
+  return err;
+}
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+prune_impossible_nodes (re_match_context_t *mctx)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  Idx halt_node, match_last;
+  reg_errcode_t ret;
+  re_dfastate_t **sifted_states;
+  re_dfastate_t **lim_states = NULL;
+  re_sift_context_t sctx;
+  DEBUG_ASSERT (mctx->state_log != NULL);
+  match_last = mctx->match_last;
+  halt_node = mctx->last_node;
+
+  /* Avoid overflow.  */
+  if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *))
+                       <= match_last))
+    return REG_ESPACE;
+
+  sifted_states = re_malloc (re_dfastate_t *, match_last + 1);
+  if (__glibc_unlikely (sifted_states == NULL))
+    {
+      ret = REG_ESPACE;
+      goto free_return;
+    }
+  if (dfa->nbackref)
+    {
+      lim_states = re_malloc (re_dfastate_t *, match_last + 1);
+      if (__glibc_unlikely (lim_states == NULL))
+       {
+         ret = REG_ESPACE;
+         goto free_return;
+       }
+      while (1)
+       {
+         memset (lim_states, '\0',
+                 sizeof (re_dfastate_t *) * (match_last + 1));
+         sift_ctx_init (&sctx, sifted_states, lim_states, halt_node,
+                        match_last);
+         ret = sift_states_backward (mctx, &sctx);
+         re_node_set_free (&sctx.limits);
+         if (__glibc_unlikely (ret != REG_NOERROR))
+             goto free_return;
+         if (sifted_states[0] != NULL || lim_states[0] != NULL)
+           break;
+         do
+           {
+             --match_last;
+             if (match_last < 0)
+               {
+                 ret = REG_NOMATCH;
+                 goto free_return;
+               }
+           } while (mctx->state_log[match_last] == NULL
+                    || !mctx->state_log[match_last]->halt);
+         halt_node = check_halt_state_context (mctx,
+                                               mctx->state_log[match_last],
+                                               match_last);
+       }
+      ret = merge_state_array (dfa, sifted_states, lim_states,
+                              match_last + 1);
+      re_free (lim_states);
+      lim_states = NULL;
+      if (__glibc_unlikely (ret != REG_NOERROR))
+       goto free_return;
+    }
+  else
+    {
+      sift_ctx_init (&sctx, sifted_states, lim_states, halt_node, match_last);
+      ret = sift_states_backward (mctx, &sctx);
+      re_node_set_free (&sctx.limits);
+      if (__glibc_unlikely (ret != REG_NOERROR))
+       goto free_return;
+      if (sifted_states[0] == NULL)
+       {
+         ret = REG_NOMATCH;
+         goto free_return;
+       }
+    }
+  re_free (mctx->state_log);
+  mctx->state_log = sifted_states;
+  sifted_states = NULL;
+  mctx->last_node = halt_node;
+  mctx->match_last = match_last;
+  ret = REG_NOERROR;
+ free_return:
+  re_free (sifted_states);
+  re_free (lim_states);
+  return ret;
+}
+
+/* Acquire an initial state and return it.
+   We must select appropriate initial state depending on the context,
+   since initial states may have constraints like "\<", "^", etc..  */
+
+static __always_inline re_dfastate_t *
+acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
+                           Idx idx)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  if (dfa->init_state->has_constraint)
+    {
+      unsigned int context;
+      context = re_string_context_at (&mctx->input, idx - 1, mctx->eflags);
+      if (IS_WORD_CONTEXT (context))
+       return dfa->init_state_word;
+      else if (IS_ORDINARY_CONTEXT (context))
+       return dfa->init_state;
+      else if (IS_BEGBUF_CONTEXT (context) && IS_NEWLINE_CONTEXT (context))
+       return dfa->init_state_begbuf;
+      else if (IS_NEWLINE_CONTEXT (context))
+       return dfa->init_state_nl;
+      else if (IS_BEGBUF_CONTEXT (context))
+       {
+         /* It is relatively rare case, then calculate on demand.  */
+         return re_acquire_state_context (err, dfa,
+                                          dfa->init_state->entrance_nodes,
+                                          context);
+       }
+      else
+       /* Must not happen?  */
+       return dfa->init_state;
+    }
+  else
+    return dfa->init_state;
+}
+
+/* Check whether the regular expression match input string INPUT or not,
+   and return the index where the matching end.  Return -1 if
+   there is no match, and return -2 in case of an error.
+   FL_LONGEST_MATCH means we want the POSIX longest matching.
+   If P_MATCH_FIRST is not NULL, and the match fails, it is set to the
+   next place where we may want to try matching.
+   Note that the matcher assumes that the matching starts from the current
+   index of the buffer.  */
+
+static Idx
+__attribute_warn_unused_result__
+check_matching (re_match_context_t *mctx, bool fl_longest_match,
+               Idx *p_match_first)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  reg_errcode_t err;
+  Idx match = 0;
+  Idx match_last = -1;
+  Idx cur_str_idx = re_string_cur_idx (&mctx->input);
+  re_dfastate_t *cur_state;
+  bool at_init_state = p_match_first != NULL;
+  Idx next_start_idx = cur_str_idx;
+
+  err = REG_NOERROR;
+  cur_state = acquire_init_state_context (&err, mctx, cur_str_idx);
+  /* An initial state must not be NULL (invalid).  */
+  if (__glibc_unlikely (cur_state == NULL))
+    {
+      DEBUG_ASSERT (err == REG_ESPACE);
+      return -2;
+    }
+
+  if (mctx->state_log != NULL)
+    {
+      mctx->state_log[cur_str_idx] = cur_state;
+
+      /* Check OP_OPEN_SUBEXP in the initial state in case that we use them
+        later.  E.g. Processing back references.  */
+      if (__glibc_unlikely (dfa->nbackref))
+       {
+         at_init_state = false;
+         err = check_subexp_matching_top (mctx, &cur_state->nodes, 0);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+
+         if (cur_state->has_backref)
+           {
+             err = transit_state_bkref (mctx, &cur_state->nodes);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               return err;
+           }
+       }
+    }
+
+  /* If the RE accepts NULL string.  */
+  if (__glibc_unlikely (cur_state->halt))
+    {
+      if (!cur_state->has_constraint
+         || check_halt_state_context (mctx, cur_state, cur_str_idx))
+       {
+         if (!fl_longest_match)
+           return cur_str_idx;
+         else
+           {
+             match_last = cur_str_idx;
+             match = 1;
+           }
+       }
+    }
+
+  while (!re_string_eoi (&mctx->input))
+    {
+      re_dfastate_t *old_state = cur_state;
+      Idx next_char_idx = re_string_cur_idx (&mctx->input) + 1;
+
+      if ((__glibc_unlikely (next_char_idx >= mctx->input.bufs_len)
+          && mctx->input.bufs_len < mctx->input.len)
+         || (__glibc_unlikely (next_char_idx >= mctx->input.valid_len)
+             && mctx->input.valid_len < mctx->input.len))
+       {
+         err = extend_buffers (mctx, next_char_idx + 1);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           {
+             DEBUG_ASSERT (err == REG_ESPACE);
+             return -2;
+           }
+       }
+
+      cur_state = transit_state (&err, mctx, cur_state);
+      if (mctx->state_log != NULL)
+       cur_state = merge_state_with_log (&err, mctx, cur_state);
+
+      if (cur_state == NULL)
+       {
+         /* Reached the invalid state or an error.  Try to recover a valid
+            state using the state log, if available and if we have not
+            already found a valid (even if not the longest) match.  */
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return -2;
+
+         if (mctx->state_log == NULL
+             || (match && !fl_longest_match)
+             || (cur_state = find_recover_state (&err, mctx)) == NULL)
+           break;
+       }
+
+      if (__glibc_unlikely (at_init_state))
+       {
+         if (old_state == cur_state)
+           next_start_idx = next_char_idx;
+         else
+           at_init_state = false;
+       }
+
+      if (cur_state->halt)
+       {
+         /* Reached a halt state.
+            Check the halt state can satisfy the current context.  */
+         if (!cur_state->has_constraint
+             || check_halt_state_context (mctx, cur_state,
+                                          re_string_cur_idx (&mctx->input)))
+           {
+             /* We found an appropriate halt state.  */
+             match_last = re_string_cur_idx (&mctx->input);
+             match = 1;
+
+             /* We found a match, do not modify match_first below.  */
+             p_match_first = NULL;
+             if (!fl_longest_match)
+               break;
+           }
+       }
+    }
+
+  if (p_match_first)
+    *p_match_first += next_start_idx;
+
+  return match_last;
+}
+
+/* Check NODE match the current context.  */
+
+static bool
+check_halt_node_context (const re_dfa_t *dfa, Idx node, unsigned int context)
+{
+  re_token_type_t type = dfa->nodes[node].type;
+  unsigned int constraint = dfa->nodes[node].constraint;
+  if (type != END_OF_RE)
+    return false;
+  if (!constraint)
+    return true;
+  if (NOT_SATISFY_NEXT_CONSTRAINT (constraint, context))
+    return false;
+  return true;
+}
+
+/* Check the halt state STATE match the current context.
+   Return 0 if not match, if the node, STATE has, is a halt node and
+   match the context, return the node.  */
+
+static Idx
+check_halt_state_context (const re_match_context_t *mctx,
+                         const re_dfastate_t *state, Idx idx)
+{
+  Idx i;
+  unsigned int context;
+  DEBUG_ASSERT (state->halt);
+  context = re_string_context_at (&mctx->input, idx, mctx->eflags);
+  for (i = 0; i < state->nodes.nelem; ++i)
+    if (check_halt_node_context (mctx->dfa, state->nodes.elems[i], context))
+      return state->nodes.elems[i];
+  return 0;
+}
+
+/* Compute the next node to which "NFA" transit from NODE("NFA" is a NFA
+   corresponding to the DFA).
+   Return the destination node, and update EPS_VIA_NODES;
+   return -1 on match failure, -2 on error.  */
+
+static Idx
+proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
+                  regmatch_t *prevregs,
+                  Idx *pidx, Idx node, re_node_set *eps_via_nodes,
+                  struct re_fail_stack_t *fs)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  if (IS_EPSILON_NODE (dfa->nodes[node].type))
+    {
+      re_node_set *cur_nodes = &mctx->state_log[*pidx]->nodes;
+      re_node_set *edests = &dfa->edests[node];
+
+      if (! re_node_set_contains (eps_via_nodes, node))
+        {
+          bool ok = re_node_set_insert (eps_via_nodes, node);
+          if (__glibc_unlikely (! ok))
+            return -2;
+        }
+
+      /* Pick a valid destination, or return -1 if none is found.  */
+      Idx dest_node = -1;
+      for (Idx i = 0; i < edests->nelem; i++)
+       {
+         Idx candidate = edests->elems[i];
+         if (!re_node_set_contains (cur_nodes, candidate))
+           continue;
+          if (dest_node == -1)
+           dest_node = candidate;
+
+         else
+           {
+             /* In order to avoid infinite loop like "(a*)*", return the second
+                epsilon-transition if the first was already considered.  */
+             if (re_node_set_contains (eps_via_nodes, dest_node))
+               return candidate;
+
+             /* Otherwise, push the second epsilon-transition on the fail stack.  */
+             else if (fs != NULL
+                      && push_fail_stack (fs, *pidx, candidate, nregs, regs,
+                                          prevregs, eps_via_nodes))
+               return -2;
+
+             /* We know we are going to exit.  */
+             break;
+           }
+       }
+      return dest_node;
+    }
+  else
+    {
+      Idx naccepted = 0;
+      re_token_type_t type = dfa->nodes[node].type;
+
+      if (dfa->nodes[node].accept_mb)
+       naccepted = check_node_accept_bytes (dfa, node, &mctx->input, *pidx);
+      else if (type == OP_BACK_REF)
+       {
+         Idx subexp_idx = dfa->nodes[node].opr.idx + 1;
+         if (subexp_idx < nregs)
+           naccepted = regs[subexp_idx].rm_eo - regs[subexp_idx].rm_so;
+         if (fs != NULL)
+           {
+             if (subexp_idx >= nregs
+                 || regs[subexp_idx].rm_so == -1
+                 || regs[subexp_idx].rm_eo == -1)
+               return -1;
+             else if (naccepted)
+               {
+                 char *buf = (char *) re_string_get_buffer (&mctx->input);
+                 if (mctx->input.valid_len - *pidx < naccepted
+                     || (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx,
+                                 naccepted)
+                         != 0))
+                   return -1;
+               }
+           }
+
+         if (naccepted == 0)
+           {
+             Idx dest_node;
+             bool ok = re_node_set_insert (eps_via_nodes, node);
+             if (__glibc_unlikely (! ok))
+               return -2;
+             dest_node = dfa->edests[node].elems[0];
+             if (re_node_set_contains (&mctx->state_log[*pidx]->nodes,
+                                       dest_node))
+               return dest_node;
+           }
+       }
+
+      if (naccepted != 0
+         || check_node_accept (mctx, dfa->nodes + node, *pidx))
+       {
+         Idx dest_node = dfa->nexts[node];
+         *pidx = (naccepted == 0) ? *pidx + 1 : *pidx + naccepted;
+         if (fs && (*pidx > mctx->match_last || mctx->state_log[*pidx] == NULL
+                    || !re_node_set_contains (&mctx->state_log[*pidx]->nodes,
+                                              dest_node)))
+           return -1;
+         re_node_set_empty (eps_via_nodes);
+         return dest_node;
+       }
+    }
+  return -1;
+}
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node,
+                Idx nregs, regmatch_t *regs, regmatch_t *prevregs,
+                re_node_set *eps_via_nodes)
+{
+  reg_errcode_t err;
+  Idx num = fs->num;
+  if (num == fs->alloc)
+    {
+      struct re_fail_stack_ent_t *new_array;
+      new_array = re_realloc (fs->stack, struct re_fail_stack_ent_t,
+                              fs->alloc * 2);
+      if (new_array == NULL)
+       return REG_ESPACE;
+      fs->alloc *= 2;
+      fs->stack = new_array;
+    }
+  fs->stack[num].idx = str_idx;
+  fs->stack[num].node = dest_node;
+  fs->stack[num].regs = re_malloc (regmatch_t, 2 * nregs);
+  if (fs->stack[num].regs == NULL)
+    return REG_ESPACE;
+  fs->num = num + 1;
+  memcpy (fs->stack[num].regs, regs, sizeof (regmatch_t) * nregs);
+  memcpy (fs->stack[num].regs + nregs, prevregs, sizeof (regmatch_t) * nregs);
+  err = re_node_set_init_copy (&fs->stack[num].eps_via_nodes, eps_via_nodes);
+  return err;
+}
+
+static Idx
+pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs,
+               regmatch_t *regs, regmatch_t *prevregs,
+               re_node_set *eps_via_nodes)
+{
+  if (fs == NULL || fs->num == 0)
+    return -1;
+  Idx num = --fs->num;
+  *pidx = fs->stack[num].idx;
+  memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs);
+  memcpy (prevregs, fs->stack[num].regs + nregs, sizeof (regmatch_t) * nregs);
+  re_node_set_free (eps_via_nodes);
+  re_free (fs->stack[num].regs);
+  *eps_via_nodes = fs->stack[num].eps_via_nodes;
+  DEBUG_ASSERT (0 <= fs->stack[num].node);
+  return fs->stack[num].node;
+}
+
+
+#define DYNARRAY_STRUCT  regmatch_list
+#define DYNARRAY_ELEMENT regmatch_t
+#define DYNARRAY_PREFIX  regmatch_list_
+#include <malloc/dynarray-skeleton.c>
+
+/* Set the positions where the subexpressions are starts/ends to registers
+   PMATCH.
+   Note: We assume that pmatch[0] is already set, and
+   pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
+         regmatch_t *pmatch, bool fl_backtrack)
+{
+  const re_dfa_t *dfa = preg->buffer;
+  Idx idx, cur_node;
+  re_node_set eps_via_nodes;
+  struct re_fail_stack_t *fs;
+  struct re_fail_stack_t fs_body = { 0, 2, NULL };
+  struct regmatch_list prev_match;
+  regmatch_list_init (&prev_match);
+
+  DEBUG_ASSERT (nmatch > 1);
+  DEBUG_ASSERT (mctx->state_log != NULL);
+  if (fl_backtrack)
+    {
+      fs = &fs_body;
+      fs->stack = re_malloc (struct re_fail_stack_ent_t, fs->alloc);
+      if (fs->stack == NULL)
+       return REG_ESPACE;
+    }
+  else
+    fs = NULL;
+
+  cur_node = dfa->init_node;
+  re_node_set_init_empty (&eps_via_nodes);
+
+  if (!regmatch_list_resize (&prev_match, nmatch))
+    {
+      regmatch_list_free (&prev_match);
+      free_fail_stack_return (fs);
+      return REG_ESPACE;
+    }
+  regmatch_t *prev_idx_match = regmatch_list_begin (&prev_match);
+  memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch);
+
+  for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;)
+    {
+      update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch);
+
+      if ((idx == pmatch[0].rm_eo && cur_node == mctx->last_node)
+         || (fs && re_node_set_contains (&eps_via_nodes, cur_node)))
+       {
+         Idx reg_idx;
+         cur_node = -1;
+         if (fs)
+           {
+             for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
+               if (pmatch[reg_idx].rm_so > -1 && pmatch[reg_idx].rm_eo == -1)
+                 {
+                   cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
+                                              prev_idx_match, &eps_via_nodes);
+                   break;
+                 }
+           }
+         if (cur_node < 0)
+           {
+             re_node_set_free (&eps_via_nodes);
+             regmatch_list_free (&prev_match);
+             return free_fail_stack_return (fs);
+           }
+       }
+
+      /* Proceed to next node.  */
+      cur_node = proceed_next_node (mctx, nmatch, pmatch, prev_idx_match,
+                                   &idx, cur_node,
+                                   &eps_via_nodes, fs);
+
+      if (__glibc_unlikely (cur_node < 0))
+       {
+         if (__glibc_unlikely (cur_node == -2))
+           {
+             re_node_set_free (&eps_via_nodes);
+             regmatch_list_free (&prev_match);
+             free_fail_stack_return (fs);
+             return REG_ESPACE;
+           }
+         cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
+                                    prev_idx_match, &eps_via_nodes);
+         if (cur_node < 0)
+           {
+             re_node_set_free (&eps_via_nodes);
+             regmatch_list_free (&prev_match);
+             free_fail_stack_return (fs);
+             return REG_NOMATCH;
+           }
+       }
+    }
+  re_node_set_free (&eps_via_nodes);
+  regmatch_list_free (&prev_match);
+  return free_fail_stack_return (fs);
+}
+
+static reg_errcode_t
+free_fail_stack_return (struct re_fail_stack_t *fs)
+{
+  if (fs)
+    {
+      Idx fs_idx;
+      for (fs_idx = 0; fs_idx < fs->num; ++fs_idx)
+       {
+         re_node_set_free (&fs->stack[fs_idx].eps_via_nodes);
+         re_free (fs->stack[fs_idx].regs);
+       }
+      re_free (fs->stack);
+    }
+  return REG_NOERROR;
+}
+
+static void
+update_regs (const re_dfa_t *dfa, regmatch_t *pmatch,
+            regmatch_t *prev_idx_match, Idx cur_node, Idx cur_idx, Idx nmatch)
+{
+  int type = dfa->nodes[cur_node].type;
+  if (type == OP_OPEN_SUBEXP)
+    {
+      Idx reg_num = dfa->nodes[cur_node].opr.idx + 1;
+
+      /* We are at the first node of this sub expression.  */
+      if (reg_num < nmatch)
+       {
+         pmatch[reg_num].rm_so = cur_idx;
+         pmatch[reg_num].rm_eo = -1;
+       }
+    }
+  else if (type == OP_CLOSE_SUBEXP)
+    {
+      /* We are at the last node of this sub expression.  */
+      Idx reg_num = dfa->nodes[cur_node].opr.idx + 1;
+      if (reg_num < nmatch)
+       {
+         if (pmatch[reg_num].rm_so < cur_idx)
+           {
+             pmatch[reg_num].rm_eo = cur_idx;
+             /* This is a non-empty match or we are not inside an optional
+                subexpression.  Accept this right away.  */
+             memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch);
+           }
+         else
+           {
+             if (dfa->nodes[cur_node].opt_subexp
+                 && prev_idx_match[reg_num].rm_so != -1)
+               /* We transited through an empty match for an optional
+                  subexpression, like (a?)*, and this is not the subexp's
+                  first match.  Copy back the old content of the registers
+                  so that matches of an inner subexpression are undone as
+                  well, like in ((a?))*.  */
+               memcpy (pmatch, prev_idx_match, sizeof (regmatch_t) * nmatch);
+             else
+               /* We completed a subexpression, but it may be part of
+                  an optional one, so do not update PREV_IDX_MATCH.  */
+               pmatch[reg_num].rm_eo = cur_idx;
+           }
+       }
+    }
+}
+
+/* This function checks the STATE_LOG from the SCTX->last_str_idx to 0
+   and sift the nodes in each states according to the following rules.
+   Updated state_log will be wrote to STATE_LOG.
+
+   Rules: We throw away the Node 'a' in the STATE_LOG[STR_IDX] if...
+     1. When STR_IDX == MATCH_LAST(the last index in the state_log):
+       If 'a' isn't the LAST_NODE and 'a' can't epsilon transit to
+       the LAST_NODE, we throw away the node 'a'.
+     2. When 0 <= STR_IDX < MATCH_LAST and 'a' accepts
+       string 's' and transit to 'b':
+       i. If 'b' isn't in the STATE_LOG[STR_IDX+strlen('s')], we throw
+          away the node 'a'.
+       ii. If 'b' is in the STATE_LOG[STR_IDX+strlen('s')] but 'b' is
+           thrown away, we throw away the node 'a'.
+     3. When 0 <= STR_IDX < MATCH_LAST and 'a' epsilon transit to 'b':
+       i. If 'b' isn't in the STATE_LOG[STR_IDX], we throw away the
+          node 'a'.
+       ii. If 'b' is in the STATE_LOG[STR_IDX] but 'b' is thrown away,
+           we throw away the node 'a'.  */
+
+#define STATE_NODE_CONTAINS(state,node) \
+  ((state) != NULL && re_node_set_contains (&(state)->nodes, node))
+
+static reg_errcode_t
+sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx)
+{
+  reg_errcode_t err;
+  int null_cnt = 0;
+  Idx str_idx = sctx->last_str_idx;
+  re_node_set cur_dest;
+
+  DEBUG_ASSERT (mctx->state_log != NULL && mctx->state_log[str_idx] != NULL);
+
+  /* Build sifted state_log[str_idx].  It has the nodes which can epsilon
+     transit to the last_node and the last_node itself.  */
+  err = re_node_set_init_1 (&cur_dest, sctx->last_node);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    return err;
+  err = update_cur_sifted_state (mctx, sctx, str_idx, &cur_dest);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    goto free_return;
+
+  /* Then check each states in the state_log.  */
+  while (str_idx > 0)
+    {
+      /* Update counters.  */
+      null_cnt = (sctx->sifted_states[str_idx] == NULL) ? null_cnt + 1 : 0;
+      if (null_cnt > mctx->max_mb_elem_len)
+       {
+         memset (sctx->sifted_states, '\0',
+                 sizeof (re_dfastate_t *) * str_idx);
+         re_node_set_free (&cur_dest);
+         return REG_NOERROR;
+       }
+      re_node_set_empty (&cur_dest);
+      --str_idx;
+
+      if (mctx->state_log[str_idx])
+       {
+         err = build_sifted_states (mctx, sctx, str_idx, &cur_dest);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           goto free_return;
+       }
+
+      /* Add all the nodes which satisfy the following conditions:
+        - It can epsilon transit to a node in CUR_DEST.
+        - It is in CUR_SRC.
+        And update state_log.  */
+      err = update_cur_sifted_state (mctx, sctx, str_idx, &cur_dest);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       goto free_return;
+    }
+  err = REG_NOERROR;
+ free_return:
+  re_node_set_free (&cur_dest);
+  return err;
+}
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx,
+                    Idx str_idx, re_node_set *cur_dest)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  const re_node_set *cur_src = &mctx->state_log[str_idx]->non_eps_nodes;
+  Idx i;
+
+  /* Then build the next sifted state.
+     We build the next sifted state on 'cur_dest', and update
+     'sifted_states[str_idx]' with 'cur_dest'.
+     Note:
+     'cur_dest' is the sifted state from 'state_log[str_idx + 1]'.
+     'cur_src' points the node_set of the old 'state_log[str_idx]'
+     (with the epsilon nodes pre-filtered out).  */
+  for (i = 0; i < cur_src->nelem; i++)
+    {
+      Idx prev_node = cur_src->elems[i];
+      int naccepted = 0;
+      bool ok;
+      DEBUG_ASSERT (!IS_EPSILON_NODE (dfa->nodes[prev_node].type));
+
+      /* If the node may accept "multi byte".  */
+      if (dfa->nodes[prev_node].accept_mb)
+       naccepted = sift_states_iter_mb (mctx, sctx, prev_node,
+                                        str_idx, sctx->last_str_idx);
+
+      /* We don't check backreferences here.
+        See update_cur_sifted_state().  */
+      if (!naccepted
+         && check_node_accept (mctx, dfa->nodes + prev_node, str_idx)
+         && STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + 1],
+                                 dfa->nexts[prev_node]))
+       naccepted = 1;
+
+      if (naccepted == 0)
+       continue;
+
+      if (sctx->limits.nelem)
+       {
+         Idx to_idx = str_idx + naccepted;
+         if (check_dst_limits (mctx, &sctx->limits,
+                               dfa->nexts[prev_node], to_idx,
+                               prev_node, str_idx))
+           continue;
+       }
+      ok = re_node_set_insert (cur_dest, prev_node);
+      if (__glibc_unlikely (! ok))
+       return REG_ESPACE;
+    }
+
+  return REG_NOERROR;
+}
+
+/* Helper functions.  */
+
+static reg_errcode_t
+clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx)
+{
+  Idx top = mctx->state_log_top;
+
+  if ((next_state_log_idx >= mctx->input.bufs_len
+       && mctx->input.bufs_len < mctx->input.len)
+      || (next_state_log_idx >= mctx->input.valid_len
+         && mctx->input.valid_len < mctx->input.len))
+    {
+      reg_errcode_t err;
+      err = extend_buffers (mctx, next_state_log_idx + 1);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       return err;
+    }
+
+  if (top < next_state_log_idx)
+    {
+      DEBUG_ASSERT (mctx->state_log != NULL);
+      memset (mctx->state_log + top + 1, '\0',
+             sizeof (re_dfastate_t *) * (next_state_log_idx - top));
+      mctx->state_log_top = next_state_log_idx;
+    }
+  return REG_NOERROR;
+}
+
+static reg_errcode_t
+merge_state_array (const re_dfa_t *dfa, re_dfastate_t **dst,
+                  re_dfastate_t **src, Idx num)
+{
+  Idx st_idx;
+  reg_errcode_t err;
+  for (st_idx = 0; st_idx < num; ++st_idx)
+    {
+      if (dst[st_idx] == NULL)
+       dst[st_idx] = src[st_idx];
+      else if (src[st_idx] != NULL)
+       {
+         re_node_set merged_set;
+         err = re_node_set_init_union (&merged_set, &dst[st_idx]->nodes,
+                                       &src[st_idx]->nodes);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+         dst[st_idx] = re_acquire_state (&err, dfa, &merged_set);
+         re_node_set_free (&merged_set);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+       }
+    }
+  return REG_NOERROR;
+}
+
+static reg_errcode_t
+update_cur_sifted_state (const re_match_context_t *mctx,
+                        re_sift_context_t *sctx, Idx str_idx,
+                        re_node_set *dest_nodes)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  reg_errcode_t err = REG_NOERROR;
+  const re_node_set *candidates;
+  candidates = ((mctx->state_log[str_idx] == NULL) ? NULL
+               : &mctx->state_log[str_idx]->nodes);
+
+  if (dest_nodes->nelem == 0)
+    sctx->sifted_states[str_idx] = NULL;
+  else
+    {
+      if (candidates)
+       {
+         /* At first, add the nodes which can epsilon transit to a node in
+            DEST_NODE.  */
+         err = add_epsilon_src_nodes (dfa, dest_nodes, candidates);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+
+         /* Then, check the limitations in the current sift_context.  */
+         if (sctx->limits.nelem)
+           {
+             err = check_subexp_limits (dfa, dest_nodes, candidates, &sctx->limits,
+                                        mctx->bkref_ents, str_idx);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               return err;
+           }
+       }
+
+      sctx->sifted_states[str_idx] = re_acquire_state (&err, dfa, dest_nodes);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       return err;
+    }
+
+  if (candidates && mctx->state_log[str_idx]->has_backref)
+    {
+      err = sift_states_bkref (mctx, sctx, str_idx, candidates);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       return err;
+    }
+  return REG_NOERROR;
+}
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes,
+                      const re_node_set *candidates)
+{
+  reg_errcode_t err = REG_NOERROR;
+  Idx i;
+
+  re_dfastate_t *state = re_acquire_state (&err, dfa, dest_nodes);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    return err;
+
+  if (!state->inveclosure.alloc)
+    {
+      err = re_node_set_alloc (&state->inveclosure, dest_nodes->nelem);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       return REG_ESPACE;
+      for (i = 0; i < dest_nodes->nelem; i++)
+       {
+         err = re_node_set_merge (&state->inveclosure,
+                                  dfa->inveclosures + dest_nodes->elems[i]);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return REG_ESPACE;
+       }
+    }
+  return re_node_set_add_intersect (dest_nodes, candidates,
+                                   &state->inveclosure);
+}
+
+static reg_errcode_t
+sub_epsilon_src_nodes (const re_dfa_t *dfa, Idx node, re_node_set *dest_nodes,
+                      const re_node_set *candidates)
+{
+    Idx ecl_idx;
+    reg_errcode_t err;
+    re_node_set *inv_eclosure = dfa->inveclosures + node;
+    re_node_set except_nodes;
+    re_node_set_init_empty (&except_nodes);
+    for (ecl_idx = 0; ecl_idx < inv_eclosure->nelem; ++ecl_idx)
+      {
+       Idx cur_node = inv_eclosure->elems[ecl_idx];
+       if (cur_node == node)
+         continue;
+       if (IS_EPSILON_NODE (dfa->nodes[cur_node].type))
+         {
+           Idx edst1 = dfa->edests[cur_node].elems[0];
+           Idx edst2 = ((dfa->edests[cur_node].nelem > 1)
+                        ? dfa->edests[cur_node].elems[1] : -1);
+           if ((!re_node_set_contains (inv_eclosure, edst1)
+                && re_node_set_contains (dest_nodes, edst1))
+               || (edst2 > 0
+                   && !re_node_set_contains (inv_eclosure, edst2)
+                   && re_node_set_contains (dest_nodes, edst2)))
+             {
+               err = re_node_set_add_intersect (&except_nodes, candidates,
+                                                dfa->inveclosures + cur_node);
+               if (__glibc_unlikely (err != REG_NOERROR))
+                 {
+                   re_node_set_free (&except_nodes);
+                   return err;
+                 }
+             }
+         }
+      }
+    for (ecl_idx = 0; ecl_idx < inv_eclosure->nelem; ++ecl_idx)
+      {
+       Idx cur_node = inv_eclosure->elems[ecl_idx];
+       if (!re_node_set_contains (&except_nodes, cur_node))
+         {
+           Idx idx = re_node_set_contains (dest_nodes, cur_node) - 1;
+           re_node_set_remove_at (dest_nodes, idx);
+         }
+      }
+    re_node_set_free (&except_nodes);
+    return REG_NOERROR;
+}
+
+static bool
+check_dst_limits (const re_match_context_t *mctx, const re_node_set *limits,
+                 Idx dst_node, Idx dst_idx, Idx src_node, Idx src_idx)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  Idx lim_idx, src_pos, dst_pos;
+
+  Idx dst_bkref_idx = search_cur_bkref_entry (mctx, dst_idx);
+  Idx src_bkref_idx = search_cur_bkref_entry (mctx, src_idx);
+  for (lim_idx = 0; lim_idx < limits->nelem; ++lim_idx)
+    {
+      Idx subexp_idx;
+      struct re_backref_cache_entry *ent;
+      ent = mctx->bkref_ents + limits->elems[lim_idx];
+      subexp_idx = dfa->nodes[ent->node].opr.idx;
+
+      dst_pos = check_dst_limits_calc_pos (mctx, limits->elems[lim_idx],
+                                          subexp_idx, dst_node, dst_idx,
+                                          dst_bkref_idx);
+      src_pos = check_dst_limits_calc_pos (mctx, limits->elems[lim_idx],
+                                          subexp_idx, src_node, src_idx,
+                                          src_bkref_idx);
+
+      /* In case of:
+        <src> <dst> ( <subexp> )
+        ( <subexp> ) <src> <dst>
+        ( <subexp1> <src> <subexp2> <dst> <subexp3> )  */
+      if (src_pos == dst_pos)
+       continue; /* This is unrelated limitation.  */
+      else
+       return true;
+    }
+  return false;
+}
+
+static int
+check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries,
+                            Idx subexp_idx, Idx from_node, Idx bkref_idx)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  const re_node_set *eclosures = dfa->eclosures + from_node;
+  Idx node_idx;
+
+  /* Else, we are on the boundary: examine the nodes on the epsilon
+     closure.  */
+  for (node_idx = 0; node_idx < eclosures->nelem; ++node_idx)
+    {
+      Idx node = eclosures->elems[node_idx];
+      switch (dfa->nodes[node].type)
+       {
+       case OP_BACK_REF:
+         if (bkref_idx != -1)
+           {
+             struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx;
+             do
+               {
+                 Idx dst;
+                 int cpos;
+
+                 if (ent->node != node)
+                   continue;
+
+                 if (subexp_idx < BITSET_WORD_BITS
+                     && !(ent->eps_reachable_subexps_map
+                          & ((bitset_word_t) 1 << subexp_idx)))
+                   continue;
+
+                 /* Recurse trying to reach the OP_OPEN_SUBEXP and
+                    OP_CLOSE_SUBEXP cases below.  But, if the
+                    destination node is the same node as the source
+                    node, don't recurse because it would cause an
+                    infinite loop: a regex that exhibits this behavior
+                    is ()\1*\1*  */
+                 dst = dfa->edests[node].elems[0];
+                 if (dst == from_node)
+                   {
+                     if (boundaries & 1)
+                       return -1;
+                     else /* if (boundaries & 2) */
+                       return 0;
+                   }
+
+                 cpos =
+                   check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx,
+                                                dst, bkref_idx);
+                 if (cpos == -1 /* && (boundaries & 1) */)
+                   return -1;
+                 if (cpos == 0 && (boundaries & 2))
+                   return 0;
+
+                 if (subexp_idx < BITSET_WORD_BITS)
+                   ent->eps_reachable_subexps_map
+                     &= ~((bitset_word_t) 1 << subexp_idx);
+               }
+             while (ent++->more);
+           }
+         break;
+
+       case OP_OPEN_SUBEXP:
+         if ((boundaries & 1) && subexp_idx == dfa->nodes[node].opr.idx)
+           return -1;
+         break;
+
+       case OP_CLOSE_SUBEXP:
+         if ((boundaries & 2) && subexp_idx == dfa->nodes[node].opr.idx)
+           return 0;
+         break;
+
+       default:
+           break;
+       }
+    }
+
+  return (boundaries & 2) ? 1 : 0;
+}
+
+static int
+check_dst_limits_calc_pos (const re_match_context_t *mctx, Idx limit,
+                          Idx subexp_idx, Idx from_node, Idx str_idx,
+                          Idx bkref_idx)
+{
+  struct re_backref_cache_entry *lim = mctx->bkref_ents + limit;
+  int boundaries;
+
+  /* If we are outside the range of the subexpression, return -1 or 1.  */
+  if (str_idx < lim->subexp_from)
+    return -1;
+
+  if (lim->subexp_to < str_idx)
+    return 1;
+
+  /* If we are within the subexpression, return 0.  */
+  boundaries = (str_idx == lim->subexp_from);
+  boundaries |= (str_idx == lim->subexp_to) << 1;
+  if (boundaries == 0)
+    return 0;
+
+  /* Else, examine epsilon closure.  */
+  return check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx,
+                                     from_node, bkref_idx);
+}
+
+/* Check the limitations of sub expressions LIMITS, and remove the nodes
+   which are against limitations from DEST_NODES. */
+
+static reg_errcode_t
+check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes,
+                    const re_node_set *candidates, re_node_set *limits,
+                    struct re_backref_cache_entry *bkref_ents, Idx str_idx)
+{
+  reg_errcode_t err;
+  Idx node_idx, lim_idx;
+
+  for (lim_idx = 0; lim_idx < limits->nelem; ++lim_idx)
+    {
+      Idx subexp_idx;
+      struct re_backref_cache_entry *ent;
+      ent = bkref_ents + limits->elems[lim_idx];
+
+      if (str_idx <= ent->subexp_from || ent->str_idx < str_idx)
+       continue; /* This is unrelated limitation.  */
+
+      subexp_idx = dfa->nodes[ent->node].opr.idx;
+      if (ent->subexp_to == str_idx)
+       {
+         Idx ops_node = -1;
+         Idx cls_node = -1;
+         for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx)
+           {
+             Idx node = dest_nodes->elems[node_idx];
+             re_token_type_t type = dfa->nodes[node].type;
+             if (type == OP_OPEN_SUBEXP
+                 && subexp_idx == dfa->nodes[node].opr.idx)
+               ops_node = node;
+             else if (type == OP_CLOSE_SUBEXP
+                      && subexp_idx == dfa->nodes[node].opr.idx)
+               cls_node = node;
+           }
+
+         /* Check the limitation of the open subexpression.  */
+         /* Note that (ent->subexp_to = str_idx != ent->subexp_from).  */
+         if (ops_node >= 0)
+           {
+             err = sub_epsilon_src_nodes (dfa, ops_node, dest_nodes,
+                                          candidates);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               return err;
+           }
+
+         /* Check the limitation of the close subexpression.  */
+         if (cls_node >= 0)
+           for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx)
+             {
+               Idx node = dest_nodes->elems[node_idx];
+               if (!re_node_set_contains (dfa->inveclosures + node,
+                                          cls_node)
+                   && !re_node_set_contains (dfa->eclosures + node,
+                                             cls_node))
+                 {
+                   /* It is against this limitation.
+                      Remove it form the current sifted state.  */
+                   err = sub_epsilon_src_nodes (dfa, node, dest_nodes,
+                                                candidates);
+                   if (__glibc_unlikely (err != REG_NOERROR))
+                     return err;
+                   --node_idx;
+                 }
+             }
+       }
+      else /* (ent->subexp_to != str_idx)  */
+       {
+         for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx)
+           {
+             Idx node = dest_nodes->elems[node_idx];
+             re_token_type_t type = dfa->nodes[node].type;
+             if (type == OP_CLOSE_SUBEXP || type == OP_OPEN_SUBEXP)
+               {
+                 if (subexp_idx != dfa->nodes[node].opr.idx)
+                   continue;
+                 /* It is against this limitation.
+                    Remove it form the current sifted state.  */
+                 err = sub_epsilon_src_nodes (dfa, node, dest_nodes,
+                                              candidates);
+                 if (__glibc_unlikely (err != REG_NOERROR))
+                   return err;
+               }
+           }
+       }
+    }
+  return REG_NOERROR;
+}
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx,
+                  Idx str_idx, const re_node_set *candidates)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  reg_errcode_t err;
+  Idx node_idx, node;
+  re_sift_context_t local_sctx;
+  Idx first_idx = search_cur_bkref_entry (mctx, str_idx);
+
+  if (first_idx == -1)
+    return REG_NOERROR;
+
+  local_sctx.sifted_states = NULL; /* Mark that it hasn't been initialized.  */
+
+  for (node_idx = 0; node_idx < candidates->nelem; ++node_idx)
+    {
+      Idx enabled_idx;
+      re_token_type_t type;
+      struct re_backref_cache_entry *entry;
+      node = candidates->elems[node_idx];
+      type = dfa->nodes[node].type;
+      /* Avoid infinite loop for the REs like "()\1+".  */
+      if (node == sctx->last_node && str_idx == sctx->last_str_idx)
+       continue;
+      if (type != OP_BACK_REF)
+       continue;
+
+      entry = mctx->bkref_ents + first_idx;
+      enabled_idx = first_idx;
+      do
+       {
+         Idx subexp_len;
+         Idx to_idx;
+         Idx dst_node;
+         bool ok;
+         re_dfastate_t *cur_state;
+
+         if (entry->node != node)
+           continue;
+         subexp_len = entry->subexp_to - entry->subexp_from;
+         to_idx = str_idx + subexp_len;
+         dst_node = (subexp_len ? dfa->nexts[node]
+                     : dfa->edests[node].elems[0]);
+
+         if (to_idx > sctx->last_str_idx
+             || sctx->sifted_states[to_idx] == NULL
+             || !STATE_NODE_CONTAINS (sctx->sifted_states[to_idx], dst_node)
+             || check_dst_limits (mctx, &sctx->limits, node,
+                                  str_idx, dst_node, to_idx))
+           continue;
+
+         if (local_sctx.sifted_states == NULL)
+           {
+             local_sctx = *sctx;
+             err = re_node_set_init_copy (&local_sctx.limits, &sctx->limits);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               goto free_return;
+           }
+         local_sctx.last_node = node;
+         local_sctx.last_str_idx = str_idx;
+         ok = re_node_set_insert (&local_sctx.limits, enabled_idx);
+         if (__glibc_unlikely (! ok))
+           {
+             err = REG_ESPACE;
+             goto free_return;
+           }
+         cur_state = local_sctx.sifted_states[str_idx];
+         err = sift_states_backward (mctx, &local_sctx);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           goto free_return;
+         if (sctx->limited_states != NULL)
+           {
+             err = merge_state_array (dfa, sctx->limited_states,
+                                      local_sctx.sifted_states,
+                                      str_idx + 1);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               goto free_return;
+           }
+         local_sctx.sifted_states[str_idx] = cur_state;
+         re_node_set_remove (&local_sctx.limits, enabled_idx);
+
+         /* mctx->bkref_ents may have changed, reload the pointer.  */
+         entry = mctx->bkref_ents + enabled_idx;
+       }
+      while (enabled_idx++, entry++->more);
+    }
+  err = REG_NOERROR;
+ free_return:
+  if (local_sctx.sifted_states != NULL)
+    {
+      re_node_set_free (&local_sctx.limits);
+    }
+
+  return err;
+}
+
+
+static int
+sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
+                    Idx node_idx, Idx str_idx, Idx max_str_idx)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  int naccepted;
+  /* Check the node can accept "multi byte".  */
+  naccepted = check_node_accept_bytes (dfa, node_idx, &mctx->input, str_idx);
+  if (naccepted > 0 && str_idx + naccepted <= max_str_idx
+      && !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted],
+                              dfa->nexts[node_idx]))
+    /* The node can't accept the "multi byte", or the
+       destination was already thrown away, then the node
+       couldn't accept the current input "multi byte".   */
+    naccepted = 0;
+  /* Otherwise, it is sure that the node could accept
+     'naccepted' bytes input.  */
+  return naccepted;
+}
+\f
+/* Functions for state transition.  */
+
+/* Return the next state to which the current state STATE will transit by
+   accepting the current input byte, and update STATE_LOG if necessary.
+   Return NULL on failure.
+   If STATE can accept a multibyte char/collating element/back reference
+   update the destination of STATE_LOG.  */
+
+static re_dfastate_t *
+__attribute_warn_unused_result__
+transit_state (reg_errcode_t *err, re_match_context_t *mctx,
+              re_dfastate_t *state)
+{
+  re_dfastate_t **trtable;
+  unsigned char ch;
+
+  /* If the current state can accept multibyte.  */
+  if (__glibc_unlikely (state->accept_mb))
+    {
+      *err = transit_state_mb (mctx, state);
+      if (__glibc_unlikely (*err != REG_NOERROR))
+       return NULL;
+    }
+
+  /* Then decide the next state with the single byte.  */
+#if 0
+  if (0)
+    /* don't use transition table  */
+    return transit_state_sb (err, mctx, state);
+#endif
+
+  /* Use transition table  */
+  ch = re_string_fetch_byte (&mctx->input);
+  for (;;)
+    {
+      trtable = state->trtable;
+      if (__glibc_likely (trtable != NULL))
+       return trtable[ch];
+
+      trtable = state->word_trtable;
+      if (__glibc_likely (trtable != NULL))
+       {
+         unsigned int context;
+         context
+           = re_string_context_at (&mctx->input,
+                                   re_string_cur_idx (&mctx->input) - 1,
+                                   mctx->eflags);
+         if (IS_WORD_CONTEXT (context))
+           return trtable[ch + SBC_MAX];
+         else
+           return trtable[ch];
+       }
+
+      if (!build_trtable (mctx->dfa, state))
+       {
+         *err = REG_ESPACE;
+         return NULL;
+       }
+
+      /* Retry, we now have a transition table.  */
+    }
+}
+
+/* Update the state_log if we need */
+static re_dfastate_t *
+merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
+                     re_dfastate_t *next_state)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  Idx cur_idx = re_string_cur_idx (&mctx->input);
+
+  if (cur_idx > mctx->state_log_top)
+    {
+      mctx->state_log[cur_idx] = next_state;
+      mctx->state_log_top = cur_idx;
+    }
+  else if (mctx->state_log[cur_idx] == 0)
+    {
+      mctx->state_log[cur_idx] = next_state;
+    }
+  else
+    {
+      re_dfastate_t *pstate;
+      unsigned int context;
+      re_node_set next_nodes, *log_nodes, *table_nodes = NULL;
+      /* If (state_log[cur_idx] != 0), it implies that cur_idx is
+        the destination of a multibyte char/collating element/
+        back reference.  Then the next state is the union set of
+        these destinations and the results of the transition table.  */
+      pstate = mctx->state_log[cur_idx];
+      log_nodes = pstate->entrance_nodes;
+      if (next_state != NULL)
+       {
+         table_nodes = next_state->entrance_nodes;
+         *err = re_node_set_init_union (&next_nodes, table_nodes,
+                                            log_nodes);
+         if (__glibc_unlikely (*err != REG_NOERROR))
+           return NULL;
+       }
+      else
+       next_nodes = *log_nodes;
+      /* Note: We already add the nodes of the initial state,
+        then we don't need to add them here.  */
+
+      context = re_string_context_at (&mctx->input,
+                                     re_string_cur_idx (&mctx->input) - 1,
+                                     mctx->eflags);
+      next_state = mctx->state_log[cur_idx]
+       = re_acquire_state_context (err, dfa, &next_nodes, context);
+      /* We don't need to check errors here, since the return value of
+        this function is next_state and ERR is already set.  */
+
+      if (table_nodes != NULL)
+       re_node_set_free (&next_nodes);
+    }
+
+  if (__glibc_unlikely (dfa->nbackref) && next_state != NULL)
+    {
+      /* Check OP_OPEN_SUBEXP in the current state in case that we use them
+        later.  We must check them here, since the back references in the
+        next state might use them.  */
+      *err = check_subexp_matching_top (mctx, &next_state->nodes,
+                                       cur_idx);
+      if (__glibc_unlikely (*err != REG_NOERROR))
+       return NULL;
+
+      /* If the next state has back references.  */
+      if (next_state->has_backref)
+       {
+         *err = transit_state_bkref (mctx, &next_state->nodes);
+         if (__glibc_unlikely (*err != REG_NOERROR))
+           return NULL;
+         next_state = mctx->state_log[cur_idx];
+       }
+    }
+
+  return next_state;
+}
+
+/* Skip bytes in the input that correspond to part of a
+   multi-byte match, then look in the log for a state
+   from which to restart matching.  */
+static re_dfastate_t *
+find_recover_state (reg_errcode_t *err, re_match_context_t *mctx)
+{
+  re_dfastate_t *cur_state;
+  do
+    {
+      Idx max = mctx->state_log_top;
+      Idx cur_str_idx = re_string_cur_idx (&mctx->input);
+
+      do
+       {
+         if (++cur_str_idx > max)
+           return NULL;
+         re_string_skip_bytes (&mctx->input, 1);
+       }
+      while (mctx->state_log[cur_str_idx] == NULL);
+
+      cur_state = merge_state_with_log (err, mctx, NULL);
+    }
+  while (*err == REG_NOERROR && cur_state == NULL);
+  return cur_state;
+}
+
+/* Helper functions for transit_state.  */
+
+/* From the node set CUR_NODES, pick up the nodes whose types are
+   OP_OPEN_SUBEXP and which have corresponding back references in the regular
+   expression. And register them to use them later for evaluating the
+   corresponding back references.  */
+
+static reg_errcode_t
+check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes,
+                          Idx str_idx)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  Idx node_idx;
+  reg_errcode_t err;
+
+  /* TODO: This isn't efficient.
+          Because there might be more than one nodes whose types are
+          OP_OPEN_SUBEXP and whose index is SUBEXP_IDX, we must check all
+          nodes.
+          E.g. RE: (a){2}  */
+  for (node_idx = 0; node_idx < cur_nodes->nelem; ++node_idx)
+    {
+      Idx node = cur_nodes->elems[node_idx];
+      if (dfa->nodes[node].type == OP_OPEN_SUBEXP
+         && dfa->nodes[node].opr.idx < BITSET_WORD_BITS
+         && (dfa->used_bkref_map
+             & ((bitset_word_t) 1 << dfa->nodes[node].opr.idx)))
+       {
+         err = match_ctx_add_subtop (mctx, node, str_idx);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+       }
+    }
+  return REG_NOERROR;
+}
+
+#if 0
+/* Return the next state to which the current state STATE will transit by
+   accepting the current input byte.  Return NULL on failure.  */
+
+static re_dfastate_t *
+transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx,
+                 re_dfastate_t *state)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  re_node_set next_nodes;
+  re_dfastate_t *next_state;
+  Idx node_cnt, cur_str_idx = re_string_cur_idx (&mctx->input);
+  unsigned int context;
+
+  *err = re_node_set_alloc (&next_nodes, state->nodes.nelem + 1);
+  if (__glibc_unlikely (*err != REG_NOERROR))
+    return NULL;
+  for (node_cnt = 0; node_cnt < state->nodes.nelem; ++node_cnt)
+    {
+      Idx cur_node = state->nodes.elems[node_cnt];
+      if (check_node_accept (mctx, dfa->nodes + cur_node, cur_str_idx))
+       {
+         *err = re_node_set_merge (&next_nodes,
+                                   dfa->eclosures + dfa->nexts[cur_node]);
+         if (__glibc_unlikely (*err != REG_NOERROR))
+           {
+             re_node_set_free (&next_nodes);
+             return NULL;
+           }
+       }
+    }
+  context = re_string_context_at (&mctx->input, cur_str_idx, mctx->eflags);
+  next_state = re_acquire_state_context (err, dfa, &next_nodes, context);
+  /* We don't need to check errors here, since the return value of
+     this function is next_state and ERR is already set.  */
+
+  re_node_set_free (&next_nodes);
+  re_string_skip_bytes (&mctx->input, 1);
+  return next_state;
+}
+#endif
+
+static reg_errcode_t
+transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  reg_errcode_t err;
+  Idx i;
+
+  for (i = 0; i < pstate->nodes.nelem; ++i)
+    {
+      re_node_set dest_nodes, *new_nodes;
+      Idx cur_node_idx = pstate->nodes.elems[i];
+      int naccepted;
+      Idx dest_idx;
+      unsigned int context;
+      re_dfastate_t *dest_state;
+
+      if (!dfa->nodes[cur_node_idx].accept_mb)
+       continue;
+
+      if (dfa->nodes[cur_node_idx].constraint)
+       {
+         context = re_string_context_at (&mctx->input,
+                                         re_string_cur_idx (&mctx->input),
+                                         mctx->eflags);
+         if (NOT_SATISFY_NEXT_CONSTRAINT (dfa->nodes[cur_node_idx].constraint,
+                                          context))
+           continue;
+       }
+
+      /* How many bytes the node can accept?  */
+      naccepted = check_node_accept_bytes (dfa, cur_node_idx, &mctx->input,
+                                          re_string_cur_idx (&mctx->input));
+      if (naccepted == 0)
+       continue;
+
+      /* The node can accepts 'naccepted' bytes.  */
+      dest_idx = re_string_cur_idx (&mctx->input) + naccepted;
+      mctx->max_mb_elem_len = ((mctx->max_mb_elem_len < naccepted) ? naccepted
+                              : mctx->max_mb_elem_len);
+      err = clean_state_log_if_needed (mctx, dest_idx);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       return err;
+      DEBUG_ASSERT (dfa->nexts[cur_node_idx] != -1);
+      new_nodes = dfa->eclosures + dfa->nexts[cur_node_idx];
+
+      dest_state = mctx->state_log[dest_idx];
+      if (dest_state == NULL)
+       dest_nodes = *new_nodes;
+      else
+       {
+         err = re_node_set_init_union (&dest_nodes,
+                                       dest_state->entrance_nodes, new_nodes);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+       }
+      context = re_string_context_at (&mctx->input, dest_idx - 1,
+                                     mctx->eflags);
+      mctx->state_log[dest_idx]
+       = re_acquire_state_context (&err, dfa, &dest_nodes, context);
+      if (dest_state != NULL)
+       re_node_set_free (&dest_nodes);
+      if (__glibc_unlikely (mctx->state_log[dest_idx] == NULL
+                           && err != REG_NOERROR))
+       return err;
+    }
+  return REG_NOERROR;
+}
+
+static reg_errcode_t
+transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  reg_errcode_t err;
+  Idx i;
+  Idx cur_str_idx = re_string_cur_idx (&mctx->input);
+
+  for (i = 0; i < nodes->nelem; ++i)
+    {
+      Idx dest_str_idx, prev_nelem, bkc_idx;
+      Idx node_idx = nodes->elems[i];
+      unsigned int context;
+      const re_token_t *node = dfa->nodes + node_idx;
+      re_node_set *new_dest_nodes;
+
+      /* Check whether 'node' is a backreference or not.  */
+      if (node->type != OP_BACK_REF)
+       continue;
+
+      if (node->constraint)
+       {
+         context = re_string_context_at (&mctx->input, cur_str_idx,
+                                         mctx->eflags);
+         if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context))
+           continue;
+       }
+
+      /* 'node' is a backreference.
+        Check the substring which the substring matched.  */
+      bkc_idx = mctx->nbkref_ents;
+      err = get_subexp (mctx, node_idx, cur_str_idx);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       goto free_return;
+
+      /* And add the epsilon closures (which is 'new_dest_nodes') of
+        the backreference to appropriate state_log.  */
+      DEBUG_ASSERT (dfa->nexts[node_idx] != -1);
+      for (; bkc_idx < mctx->nbkref_ents; ++bkc_idx)
+       {
+         Idx subexp_len;
+         re_dfastate_t *dest_state;
+         struct re_backref_cache_entry *bkref_ent;
+         bkref_ent = mctx->bkref_ents + bkc_idx;
+         if (bkref_ent->node != node_idx || bkref_ent->str_idx != cur_str_idx)
+           continue;
+         subexp_len = bkref_ent->subexp_to - bkref_ent->subexp_from;
+         new_dest_nodes = (subexp_len == 0
+                           ? dfa->eclosures + dfa->edests[node_idx].elems[0]
+                           : dfa->eclosures + dfa->nexts[node_idx]);
+         dest_str_idx = (cur_str_idx + bkref_ent->subexp_to
+                         - bkref_ent->subexp_from);
+         context = re_string_context_at (&mctx->input, dest_str_idx - 1,
+                                         mctx->eflags);
+         dest_state = mctx->state_log[dest_str_idx];
+         prev_nelem = ((mctx->state_log[cur_str_idx] == NULL) ? 0
+                       : mctx->state_log[cur_str_idx]->nodes.nelem);
+         /* Add 'new_dest_node' to state_log.  */
+         if (dest_state == NULL)
+           {
+             mctx->state_log[dest_str_idx]
+               = re_acquire_state_context (&err, dfa, new_dest_nodes,
+                                           context);
+             if (__glibc_unlikely (mctx->state_log[dest_str_idx] == NULL
+                                   && err != REG_NOERROR))
+               goto free_return;
+           }
+         else
+           {
+             re_node_set dest_nodes;
+             err = re_node_set_init_union (&dest_nodes,
+                                           dest_state->entrance_nodes,
+                                           new_dest_nodes);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               {
+                 re_node_set_free (&dest_nodes);
+                 goto free_return;
+               }
+             mctx->state_log[dest_str_idx]
+               = re_acquire_state_context (&err, dfa, &dest_nodes, context);
+             re_node_set_free (&dest_nodes);
+             if (__glibc_unlikely (mctx->state_log[dest_str_idx] == NULL
+                                   && err != REG_NOERROR))
+               goto free_return;
+           }
+         /* We need to check recursively if the backreference can epsilon
+            transit.  */
+         if (subexp_len == 0
+             && mctx->state_log[cur_str_idx]->nodes.nelem > prev_nelem)
+           {
+             err = check_subexp_matching_top (mctx, new_dest_nodes,
+                                              cur_str_idx);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               goto free_return;
+             err = transit_state_bkref (mctx, new_dest_nodes);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               goto free_return;
+           }
+       }
+    }
+  err = REG_NOERROR;
+ free_return:
+  return err;
+}
+
+/* Enumerate all the candidates which the backreference BKREF_NODE can match
+   at BKREF_STR_IDX, and register them by match_ctx_add_entry().
+   Note that we might collect inappropriate candidates here.
+   However, the cost of checking them strictly here is too high, then we
+   delay these checking for prune_impossible_nodes().  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  Idx subexp_num, sub_top_idx;
+  const char *buf = (const char *) re_string_get_buffer (&mctx->input);
+  /* Return if we have already checked BKREF_NODE at BKREF_STR_IDX.  */
+  Idx cache_idx = search_cur_bkref_entry (mctx, bkref_str_idx);
+  if (cache_idx != -1)
+    {
+      const struct re_backref_cache_entry *entry
+       = mctx->bkref_ents + cache_idx;
+      do
+       if (entry->node == bkref_node)
+         return REG_NOERROR; /* We already checked it.  */
+      while (entry++->more);
+    }
+
+  subexp_num = dfa->nodes[bkref_node].opr.idx;
+
+  /* For each sub expression  */
+  for (sub_top_idx = 0; sub_top_idx < mctx->nsub_tops; ++sub_top_idx)
+    {
+      reg_errcode_t err;
+      re_sub_match_top_t *sub_top = mctx->sub_tops[sub_top_idx];
+      re_sub_match_last_t *sub_last;
+      Idx sub_last_idx, sl_str, bkref_str_off;
+
+      if (dfa->nodes[sub_top->node].opr.idx != subexp_num)
+       continue; /* It isn't related.  */
+
+      sl_str = sub_top->str_idx;
+      bkref_str_off = bkref_str_idx;
+      /* At first, check the last node of sub expressions we already
+        evaluated.  */
+      for (sub_last_idx = 0; sub_last_idx < sub_top->nlasts; ++sub_last_idx)
+       {
+         regoff_t sl_str_diff;
+         sub_last = sub_top->lasts[sub_last_idx];
+         sl_str_diff = sub_last->str_idx - sl_str;
+         /* The matched string by the sub expression match with the substring
+            at the back reference?  */
+         if (sl_str_diff > 0)
+           {
+             if (__glibc_unlikely (bkref_str_off + sl_str_diff
+                                   > mctx->input.valid_len))
+               {
+                 /* Not enough chars for a successful match.  */
+                 if (bkref_str_off + sl_str_diff > mctx->input.len)
+                   break;
+
+                 err = clean_state_log_if_needed (mctx,
+                                                  bkref_str_off
+                                                  + sl_str_diff);
+                 if (__glibc_unlikely (err != REG_NOERROR))
+                   return err;
+                 buf = (const char *) re_string_get_buffer (&mctx->input);
+               }
+             if (memcmp (buf + bkref_str_off, buf + sl_str, sl_str_diff) != 0)
+               /* We don't need to search this sub expression any more.  */
+               break;
+           }
+         bkref_str_off += sl_str_diff;
+         sl_str += sl_str_diff;
+         err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node,
+                               bkref_str_idx);
+
+         /* Reload buf, since the preceding call might have reallocated
+            the buffer.  */
+         buf = (const char *) re_string_get_buffer (&mctx->input);
+
+         if (err == REG_NOMATCH)
+           continue;
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+       }
+
+      if (sub_last_idx < sub_top->nlasts)
+       continue;
+      if (sub_last_idx > 0)
+       ++sl_str;
+      /* Then, search for the other last nodes of the sub expression.  */
+      for (; sl_str <= bkref_str_idx; ++sl_str)
+       {
+         Idx cls_node;
+         regoff_t sl_str_off;
+         const re_node_set *nodes;
+         sl_str_off = sl_str - sub_top->str_idx;
+         /* The matched string by the sub expression match with the substring
+            at the back reference?  */
+         if (sl_str_off > 0)
+           {
+             if (__glibc_unlikely (bkref_str_off >= mctx->input.valid_len))
+               {
+                 /* If we are at the end of the input, we cannot match.  */
+                 if (bkref_str_off >= mctx->input.len)
+                   break;
+
+                 err = extend_buffers (mctx, bkref_str_off + 1);
+                 if (__glibc_unlikely (err != REG_NOERROR))
+                   return err;
+
+                 buf = (const char *) re_string_get_buffer (&mctx->input);
+               }
+             if (buf [bkref_str_off++] != buf[sl_str - 1])
+               break; /* We don't need to search this sub expression
+                         any more.  */
+           }
+         if (mctx->state_log[sl_str] == NULL)
+           continue;
+         /* Does this state have a ')' of the sub expression?  */
+         nodes = &mctx->state_log[sl_str]->nodes;
+         cls_node = find_subexp_node (dfa, nodes, subexp_num,
+                                      OP_CLOSE_SUBEXP);
+         if (cls_node == -1)
+           continue; /* No.  */
+         if (sub_top->path == NULL)
+           {
+             sub_top->path = calloc (sizeof (state_array_t),
+                                     sl_str - sub_top->str_idx + 1);
+             if (sub_top->path == NULL)
+               return REG_ESPACE;
+           }
+         /* Can the OP_OPEN_SUBEXP node arrive the OP_CLOSE_SUBEXP node
+            in the current context?  */
+         err = check_arrival (mctx, sub_top->path, sub_top->node,
+                              sub_top->str_idx, cls_node, sl_str,
+                              OP_CLOSE_SUBEXP);
+         if (err == REG_NOMATCH)
+             continue;
+         if (__glibc_unlikely (err != REG_NOERROR))
+             return err;
+         sub_last = match_ctx_add_sublast (sub_top, cls_node, sl_str);
+         if (__glibc_unlikely (sub_last == NULL))
+           return REG_ESPACE;
+         err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node,
+                               bkref_str_idx);
+         buf = (const char *) re_string_get_buffer (&mctx->input);
+         if (err == REG_NOMATCH)
+           continue;
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+       }
+    }
+  return REG_NOERROR;
+}
+
+/* Helper functions for get_subexp().  */
+
+/* Check SUB_LAST can arrive to the back reference BKREF_NODE at BKREF_STR.
+   If it can arrive, register the sub expression expressed with SUB_TOP
+   and SUB_LAST.  */
+
+static reg_errcode_t
+get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top,
+               re_sub_match_last_t *sub_last, Idx bkref_node, Idx bkref_str)
+{
+  reg_errcode_t err;
+  Idx to_idx;
+  /* Can the subexpression arrive the back reference?  */
+  err = check_arrival (mctx, &sub_last->path, sub_last->node,
+                      sub_last->str_idx, bkref_node, bkref_str,
+                      OP_OPEN_SUBEXP);
+  if (err != REG_NOERROR)
+    return err;
+  err = match_ctx_add_entry (mctx, bkref_node, bkref_str, sub_top->str_idx,
+                            sub_last->str_idx);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    return err;
+  to_idx = bkref_str + sub_last->str_idx - sub_top->str_idx;
+  return clean_state_log_if_needed (mctx, to_idx);
+}
+
+/* Find the first node which is '(' or ')' and whose index is SUBEXP_IDX.
+   Search '(' if FL_OPEN, or search ')' otherwise.
+   TODO: This function isn't efficient...
+        Because there might be more than one nodes whose types are
+        OP_OPEN_SUBEXP and whose index is SUBEXP_IDX, we must check all
+        nodes.
+        E.g. RE: (a){2}  */
+
+static Idx
+find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
+                 Idx subexp_idx, int type)
+{
+  Idx cls_idx;
+  for (cls_idx = 0; cls_idx < nodes->nelem; ++cls_idx)
+    {
+      Idx cls_node = nodes->elems[cls_idx];
+      const re_token_t *node = dfa->nodes + cls_node;
+      if (node->type == type
+         && node->opr.idx == subexp_idx)
+       return cls_node;
+    }
+  return -1;
+}
+
+/* Check whether the node TOP_NODE at TOP_STR can arrive to the node
+   LAST_NODE at LAST_STR.  We record the path onto PATH since it will be
+   heavily reused.
+   Return REG_NOERROR if it can arrive, REG_NOMATCH if it cannot,
+   REG_ESPACE if memory is exhausted.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node,
+              Idx top_str, Idx last_node, Idx last_str, int type)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  reg_errcode_t err = REG_NOERROR;
+  Idx subexp_num, backup_cur_idx, str_idx, null_cnt;
+  re_dfastate_t *cur_state = NULL;
+  re_node_set *cur_nodes, next_nodes;
+  re_dfastate_t **backup_state_log;
+  unsigned int context;
+
+  subexp_num = dfa->nodes[top_node].opr.idx;
+  /* Extend the buffer if we need.  */
+  if (__glibc_unlikely (path->alloc < last_str + mctx->max_mb_elem_len + 1))
+    {
+      re_dfastate_t **new_array;
+      Idx old_alloc = path->alloc;
+      Idx incr_alloc = last_str + mctx->max_mb_elem_len + 1;
+      Idx new_alloc;
+      if (__glibc_unlikely (IDX_MAX - old_alloc < incr_alloc))
+       return REG_ESPACE;
+      new_alloc = old_alloc + incr_alloc;
+      if (__glibc_unlikely (SIZE_MAX / sizeof (re_dfastate_t *) < new_alloc))
+       return REG_ESPACE;
+      new_array = re_realloc (path->array, re_dfastate_t *, new_alloc);
+      if (__glibc_unlikely (new_array == NULL))
+       return REG_ESPACE;
+      path->array = new_array;
+      path->alloc = new_alloc;
+      memset (new_array + old_alloc, '\0',
+             sizeof (re_dfastate_t *) * (path->alloc - old_alloc));
+    }
+
+  str_idx = path->next_idx ? path->next_idx : top_str;
+
+  /* Temporary modify MCTX.  */
+  backup_state_log = mctx->state_log;
+  backup_cur_idx = mctx->input.cur_idx;
+  mctx->state_log = path->array;
+  mctx->input.cur_idx = str_idx;
+
+  /* Setup initial node set.  */
+  context = re_string_context_at (&mctx->input, str_idx - 1, mctx->eflags);
+  if (str_idx == top_str)
+    {
+      err = re_node_set_init_1 (&next_nodes, top_node);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       return err;
+      err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, type);
+      if (__glibc_unlikely (err != REG_NOERROR))
+       {
+         re_node_set_free (&next_nodes);
+         return err;
+       }
+    }
+  else
+    {
+      cur_state = mctx->state_log[str_idx];
+      if (cur_state && cur_state->has_backref)
+       {
+         err = re_node_set_init_copy (&next_nodes, &cur_state->nodes);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+       }
+      else
+       re_node_set_init_empty (&next_nodes);
+    }
+  if (str_idx == top_str || (cur_state && cur_state->has_backref))
+    {
+      if (next_nodes.nelem)
+       {
+         err = expand_bkref_cache (mctx, &next_nodes, str_idx,
+                                   subexp_num, type);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           {
+             re_node_set_free (&next_nodes);
+             return err;
+           }
+       }
+      cur_state = re_acquire_state_context (&err, dfa, &next_nodes, context);
+      if (__glibc_unlikely (cur_state == NULL && err != REG_NOERROR))
+       {
+         re_node_set_free (&next_nodes);
+         return err;
+       }
+      mctx->state_log[str_idx] = cur_state;
+    }
+
+  for (null_cnt = 0; str_idx < last_str && null_cnt <= mctx->max_mb_elem_len;)
+    {
+      re_node_set_empty (&next_nodes);
+      if (mctx->state_log[str_idx + 1])
+       {
+         err = re_node_set_merge (&next_nodes,
+                                  &mctx->state_log[str_idx + 1]->nodes);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           {
+             re_node_set_free (&next_nodes);
+             return err;
+           }
+       }
+      if (cur_state)
+       {
+         err = check_arrival_add_next_nodes (mctx, str_idx,
+                                             &cur_state->non_eps_nodes,
+                                             &next_nodes);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           {
+             re_node_set_free (&next_nodes);
+             return err;
+           }
+       }
+      ++str_idx;
+      if (next_nodes.nelem)
+       {
+         err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, type);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           {
+             re_node_set_free (&next_nodes);
+             return err;
+           }
+         err = expand_bkref_cache (mctx, &next_nodes, str_idx,
+                                   subexp_num, type);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           {
+             re_node_set_free (&next_nodes);
+             return err;
+           }
+       }
+      context = re_string_context_at (&mctx->input, str_idx - 1, mctx->eflags);
+      cur_state = re_acquire_state_context (&err, dfa, &next_nodes, context);
+      if (__glibc_unlikely (cur_state == NULL && err != REG_NOERROR))
+       {
+         re_node_set_free (&next_nodes);
+         return err;
+       }
+      mctx->state_log[str_idx] = cur_state;
+      null_cnt = cur_state == NULL ? null_cnt + 1 : 0;
+    }
+  re_node_set_free (&next_nodes);
+  cur_nodes = (mctx->state_log[last_str] == NULL ? NULL
+              : &mctx->state_log[last_str]->nodes);
+  path->next_idx = str_idx;
+
+  /* Fix MCTX.  */
+  mctx->state_log = backup_state_log;
+  mctx->input.cur_idx = backup_cur_idx;
+
+  /* Then check the current node set has the node LAST_NODE.  */
+  if (cur_nodes != NULL && re_node_set_contains (cur_nodes, last_node))
+    return REG_NOERROR;
+
+  return REG_NOMATCH;
+}
+
+/* Helper functions for check_arrival.  */
+
+/* Calculate the destination nodes of CUR_NODES at STR_IDX, and append them
+   to NEXT_NODES.
+   TODO: This function is similar to the functions transit_state*(),
+        however this function has many additional works.
+        Can't we unify them?  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx,
+                             re_node_set *cur_nodes, re_node_set *next_nodes)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  bool ok;
+  Idx cur_idx;
+  reg_errcode_t err = REG_NOERROR;
+  re_node_set union_set;
+  re_node_set_init_empty (&union_set);
+  for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx)
+    {
+      int naccepted = 0;
+      Idx cur_node = cur_nodes->elems[cur_idx];
+      DEBUG_ASSERT (!IS_EPSILON_NODE (dfa->nodes[cur_node].type));
+
+      /* If the node may accept "multi byte".  */
+      if (dfa->nodes[cur_node].accept_mb)
+       {
+         naccepted = check_node_accept_bytes (dfa, cur_node, &mctx->input,
+                                              str_idx);
+         if (naccepted > 1)
+           {
+             re_dfastate_t *dest_state;
+             Idx next_node = dfa->nexts[cur_node];
+             Idx next_idx = str_idx + naccepted;
+             dest_state = mctx->state_log[next_idx];
+             re_node_set_empty (&union_set);
+             if (dest_state)
+               {
+                 err = re_node_set_merge (&union_set, &dest_state->nodes);
+                 if (__glibc_unlikely (err != REG_NOERROR))
+                   {
+                     re_node_set_free (&union_set);
+                     return err;
+                   }
+               }
+             ok = re_node_set_insert (&union_set, next_node);
+             if (__glibc_unlikely (! ok))
+               {
+                 re_node_set_free (&union_set);
+                 return REG_ESPACE;
+               }
+             mctx->state_log[next_idx] = re_acquire_state (&err, dfa,
+                                                           &union_set);
+             if (__glibc_unlikely (mctx->state_log[next_idx] == NULL
+                                   && err != REG_NOERROR))
+               {
+                 re_node_set_free (&union_set);
+                 return err;
+               }
+           }
+       }
+
+      if (naccepted
+         || check_node_accept (mctx, dfa->nodes + cur_node, str_idx))
+       {
+         ok = re_node_set_insert (next_nodes, dfa->nexts[cur_node]);
+         if (__glibc_unlikely (! ok))
+           {
+             re_node_set_free (&union_set);
+             return REG_ESPACE;
+           }
+       }
+    }
+  re_node_set_free (&union_set);
+  return REG_NOERROR;
+}
+
+/* For all the nodes in CUR_NODES, add the epsilon closures of them to
+   CUR_NODES, however exclude the nodes which are:
+    - inside the sub expression whose number is EX_SUBEXP, if FL_OPEN.
+    - out of the sub expression whose number is EX_SUBEXP, if !FL_OPEN.
+*/
+
+static reg_errcode_t
+check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes,
+                         Idx ex_subexp, int type)
+{
+  reg_errcode_t err;
+  Idx idx, outside_node;
+  re_node_set new_nodes;
+  DEBUG_ASSERT (cur_nodes->nelem);
+  err = re_node_set_alloc (&new_nodes, cur_nodes->nelem);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    return err;
+  /* Create a new node set NEW_NODES with the nodes which are epsilon
+     closures of the node in CUR_NODES.  */
+
+  for (idx = 0; idx < cur_nodes->nelem; ++idx)
+    {
+      Idx cur_node = cur_nodes->elems[idx];
+      const re_node_set *eclosure = dfa->eclosures + cur_node;
+      outside_node = find_subexp_node (dfa, eclosure, ex_subexp, type);
+      if (outside_node == -1)
+       {
+         /* There are no problematic nodes, just merge them.  */
+         err = re_node_set_merge (&new_nodes, eclosure);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           {
+             re_node_set_free (&new_nodes);
+             return err;
+           }
+       }
+      else
+       {
+         /* There are problematic nodes, re-calculate incrementally.  */
+         err = check_arrival_expand_ecl_sub (dfa, &new_nodes, cur_node,
+                                             ex_subexp, type);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           {
+             re_node_set_free (&new_nodes);
+             return err;
+           }
+       }
+    }
+  re_node_set_free (cur_nodes);
+  *cur_nodes = new_nodes;
+  return REG_NOERROR;
+}
+
+/* Helper function for check_arrival_expand_ecl.
+   Check incrementally the epsilon closure of TARGET, and if it isn't
+   problematic append it to DST_NODES.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes,
+                             Idx target, Idx ex_subexp, int type)
+{
+  Idx cur_node;
+  for (cur_node = target; !re_node_set_contains (dst_nodes, cur_node);)
+    {
+      bool ok;
+
+      if (dfa->nodes[cur_node].type == type
+         && dfa->nodes[cur_node].opr.idx == ex_subexp)
+       {
+         if (type == OP_CLOSE_SUBEXP)
+           {
+             ok = re_node_set_insert (dst_nodes, cur_node);
+             if (__glibc_unlikely (! ok))
+               return REG_ESPACE;
+           }
+         break;
+       }
+      ok = re_node_set_insert (dst_nodes, cur_node);
+      if (__glibc_unlikely (! ok))
+       return REG_ESPACE;
+      if (dfa->edests[cur_node].nelem == 0)
+       break;
+      if (dfa->edests[cur_node].nelem == 2)
+       {
+         reg_errcode_t err;
+         err = check_arrival_expand_ecl_sub (dfa, dst_nodes,
+                                             dfa->edests[cur_node].elems[1],
+                                             ex_subexp, type);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
+       }
+      cur_node = dfa->edests[cur_node].elems[0];
+    }
+  return REG_NOERROR;
+}
+
+
+/* For all the back references in the current state, calculate the
+   destination of the back references by the appropriate entry
+   in MCTX->BKREF_ENTS.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes,
+                   Idx cur_str, Idx subexp_num, int type)
+{
+  const re_dfa_t *const dfa = mctx->dfa;
+  reg_errcode_t err;
+  Idx cache_idx_start = search_cur_bkref_entry (mctx, cur_str);
+  struct re_backref_cache_entry *ent;
+
+  if (cache_idx_start == -1)
+    return REG_NOERROR;
+
+ restart:
+  ent = mctx->bkref_ents + cache_idx_start;
+  do
+    {
+      Idx to_idx, next_node;
+
+      /* Is this entry ENT is appropriate?  */
+      if (!re_node_set_contains (cur_nodes, ent->node))
+       continue; /* No.  */
+
+      to_idx = cur_str + ent->subexp_to - ent->subexp_from;
+      /* Calculate the destination of the back reference, and append it
+        to MCTX->STATE_LOG.  */
+      if (to_idx == cur_str)
+       {
+         /* The backreference did epsilon transit, we must re-check all the
+            node in the current state.  */
+         re_node_set new_dests;
+         reg_errcode_t err2, err3;
+         next_node = dfa->edests[ent->node].elems[0];
+         if (re_node_set_contains (cur_nodes, next_node))
+           continue;
+         err = re_node_set_init_1 (&new_dests, next_node);
+         err2 = check_arrival_expand_ecl (dfa, &new_dests, subexp_num, type);
+         err3 = re_node_set_merge (cur_nodes, &new_dests);
+         re_node_set_free (&new_dests);
+         if (__glibc_unlikely (err != REG_NOERROR || err2 != REG_NOERROR
+                               || err3 != REG_NOERROR))
+           {
+             err = (err != REG_NOERROR ? err
+                    : (err2 != REG_NOERROR ? err2 : err3));
+             return err;
+           }
+         /* TODO: It is still inefficient...  */
+         goto restart;
+       }
+      else
+       {
+         re_node_set union_set;
+         next_node = dfa->nexts[ent->node];
+         if (mctx->state_log[to_idx])
+           {
+             bool ok;
+             if (re_node_set_contains (&mctx->state_log[to_idx]->nodes,
+                                       next_node))
+               continue;
+             err = re_node_set_init_copy (&union_set,
+                                          &mctx->state_log[to_idx]->nodes);
+             ok = re_node_set_insert (&union_set, next_node);
+             if (__glibc_unlikely (err != REG_NOERROR || ! ok))
+               {
+                 re_node_set_free (&union_set);
+                 err = err != REG_NOERROR ? err : REG_ESPACE;
+                 return err;
+               }
+           }
+         else
+           {
+             err = re_node_set_init_1 (&union_set, next_node);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               return err;
+           }
+         mctx->state_log[to_idx] = re_acquire_state (&err, dfa, &union_set);
+         re_node_set_free (&union_set);
+         if (__glibc_unlikely (mctx->state_log[to_idx] == NULL
+                               && err != REG_NOERROR))
+           return err;
+       }
+    }
+  while (ent++->more);
+  return REG_NOERROR;
+}
+
+/* Build transition table for the state.
+   Return true if successful.  */
+
+static bool __attribute_noinline__
+build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
+{
+  reg_errcode_t err;
+  Idx i, j;
+  int ch;
+  bool need_word_trtable = false;
+  bitset_word_t elem, mask;
+  Idx ndests; /* Number of the destination states from 'state'.  */
+  re_dfastate_t **trtable;
+  re_dfastate_t *dest_states[SBC_MAX];
+  re_dfastate_t *dest_states_word[SBC_MAX];
+  re_dfastate_t *dest_states_nl[SBC_MAX];
+  re_node_set follows;
+  bitset_t acceptable;
+
+  /* We build DFA states which corresponds to the destination nodes
+     from 'state'.  'dests_node[i]' represents the nodes which i-th
+     destination state contains, and 'dests_ch[i]' represents the
+     characters which i-th destination state accepts.  */
+  re_node_set dests_node[SBC_MAX];
+  bitset_t dests_ch[SBC_MAX];
+
+  /* Initialize transition table.  */
+  state->word_trtable = state->trtable = NULL;
+
+  /* At first, group all nodes belonging to 'state' into several
+     destinations.  */
+  ndests = group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch);
+  if (__glibc_unlikely (ndests <= 0))
+    {
+      /* Return false in case of an error, true otherwise.  */
+      if (ndests == 0)
+       {
+         state->trtable = (re_dfastate_t **)
+           calloc (sizeof (re_dfastate_t *), SBC_MAX);
+          if (__glibc_unlikely (state->trtable == NULL))
+            return false;
+         return true;
+       }
+      return false;
+    }
+
+  err = re_node_set_alloc (&follows, ndests + 1);
+  if (__glibc_unlikely (err != REG_NOERROR))
+    {
+    out_free:
+      re_node_set_free (&follows);
+      for (i = 0; i < ndests; ++i)
+       re_node_set_free (dests_node + i);
+      return false;
+    }
+
+  bitset_empty (acceptable);
+
+  /* Then build the states for all destinations.  */
+  for (i = 0; i < ndests; ++i)
+    {
+      Idx next_node;
+      re_node_set_empty (&follows);
+      /* Merge the follows of this destination states.  */
+      for (j = 0; j < dests_node[i].nelem; ++j)
+       {
+         next_node = dfa->nexts[dests_node[i].elems[j]];
+         if (next_node != -1)
+           {
+             err = re_node_set_merge (&follows, dfa->eclosures + next_node);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               goto out_free;
+           }
+       }
+      dest_states[i] = re_acquire_state_context (&err, dfa, &follows, 0);
+      if (__glibc_unlikely (dest_states[i] == NULL && err != REG_NOERROR))
+       goto out_free;
+      /* If the new state has context constraint,
+        build appropriate states for these contexts.  */
+      if (dest_states[i]->has_constraint)
+       {
+         dest_states_word[i] = re_acquire_state_context (&err, dfa, &follows,
+                                                         CONTEXT_WORD);
+         if (__glibc_unlikely (dest_states_word[i] == NULL
+                               && err != REG_NOERROR))
+           goto out_free;
+
+         if (dest_states[i] != dest_states_word[i] && dfa->mb_cur_max > 1)
+           need_word_trtable = true;
+
+         dest_states_nl[i] = re_acquire_state_context (&err, dfa, &follows,
+                                                       CONTEXT_NEWLINE);
+         if (__glibc_unlikely (dest_states_nl[i] == NULL && err != REG_NOERROR))
+           goto out_free;
+       }
+      else
+       {
+         dest_states_word[i] = dest_states[i];
+         dest_states_nl[i] = dest_states[i];
+       }
+      bitset_merge (acceptable, dests_ch[i]);
+    }
+
+  if (!__glibc_unlikely (need_word_trtable))
+    {
+      /* We don't care about whether the following character is a word
+        character, or we are in a single-byte character set so we can
+        discern by looking at the character code: allocate a
+        256-entry transition table.  */
+      trtable = state->trtable =
+       (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX);
+      if (__glibc_unlikely (trtable == NULL))
+       goto out_free;
+
+      /* For all characters ch...:  */
+      for (i = 0; i < BITSET_WORDS; ++i)
+       for (ch = i * BITSET_WORD_BITS, elem = acceptable[i], mask = 1;
+            elem;
+            mask <<= 1, elem >>= 1, ++ch)
+         if (__glibc_unlikely (elem & 1))
+           {
+             /* There must be exactly one destination which accepts
+                character ch.  See group_nodes_into_DFAstates.  */
+             for (j = 0; (dests_ch[j][i] & mask) == 0; ++j)
+               ;
+
+             /* j-th destination accepts the word character ch.  */
+             if (dfa->word_char[i] & mask)
+               trtable[ch] = dest_states_word[j];
+             else
+               trtable[ch] = dest_states[j];
+           }
+    }
+  else
+    {
+      /* We care about whether the following character is a word
+        character, and we are in a multi-byte character set: discern
+        by looking at the character code: build two 256-entry
+        transition tables, one starting at trtable[0] and one
+        starting at trtable[SBC_MAX].  */
+      trtable = state->word_trtable =
+       (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX);
+      if (__glibc_unlikely (trtable == NULL))
+       goto out_free;
+
+      /* For all characters ch...:  */
+      for (i = 0; i < BITSET_WORDS; ++i)
+       for (ch = i * BITSET_WORD_BITS, elem = acceptable[i], mask = 1;
+            elem;
+            mask <<= 1, elem >>= 1, ++ch)
+         if (__glibc_unlikely (elem & 1))
+           {
+             /* There must be exactly one destination which accepts
+                character ch.  See group_nodes_into_DFAstates.  */
+             for (j = 0; (dests_ch[j][i] & mask) == 0; ++j)
+               ;
+
+             /* j-th destination accepts the word character ch.  */
+             trtable[ch] = dest_states[j];
+             trtable[ch + SBC_MAX] = dest_states_word[j];
+           }
+    }
+
+  /* new line */
+  if (bitset_contain (acceptable, NEWLINE_CHAR))
+    {
+      /* The current state accepts newline character.  */
+      for (j = 0; j < ndests; ++j)
+       if (bitset_contain (dests_ch[j], NEWLINE_CHAR))
+         {
+           /* k-th destination accepts newline character.  */
+           trtable[NEWLINE_CHAR] = dest_states_nl[j];
+           if (need_word_trtable)
+             trtable[NEWLINE_CHAR + SBC_MAX] = dest_states_nl[j];
+           /* There must be only one destination which accepts
+              newline.  See group_nodes_into_DFAstates.  */
+           break;
+         }
+    }
+
+  re_node_set_free (&follows);
+  for (i = 0; i < ndests; ++i)
+    re_node_set_free (dests_node + i);
+  return true;
+}
+
+/* Group all nodes belonging to STATE into several destinations.
+   Then for all destinations, set the nodes belonging to the destination
+   to DESTS_NODE[i] and set the characters accepted by the destination
+   to DEST_CH[i].  Return the number of destinations if successful,
+   -1 on internal error.  */
+
+static Idx
+group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
+                           re_node_set *dests_node, bitset_t *dests_ch)
+{
+  reg_errcode_t err;
+  bool ok;
+  Idx i, j, k;
+  Idx ndests; /* Number of the destinations from 'state'.  */
+  bitset_t accepts; /* Characters a node can accept.  */
+  const re_node_set *cur_nodes = &state->nodes;
+  bitset_empty (accepts);
+  ndests = 0;
+
+  /* For all the nodes belonging to 'state',  */
+  for (i = 0; i < cur_nodes->nelem; ++i)
+    {
+      re_token_t *node = &dfa->nodes[cur_nodes->elems[i]];
+      re_token_type_t type = node->type;
+      unsigned int constraint = node->constraint;
+
+      /* Enumerate all single byte character this node can accept.  */
+      if (type == CHARACTER)
+       bitset_set (accepts, node->opr.c);
+      else if (type == SIMPLE_BRACKET)
+       {
+         bitset_merge (accepts, node->opr.sbcset);
+       }
+      else if (type == OP_PERIOD)
+       {
+         if (dfa->mb_cur_max > 1)
+           bitset_merge (accepts, dfa->sb_char);
+         else
+           bitset_set_all (accepts);
+         if (!(dfa->syntax & RE_DOT_NEWLINE))
+           bitset_clear (accepts, '\n');
+         if (dfa->syntax & RE_DOT_NOT_NULL)
+           bitset_clear (accepts, '\0');
+       }
+      else if (type == OP_UTF8_PERIOD)
+       {
+         if (ASCII_CHARS % BITSET_WORD_BITS == 0)
+           memset (accepts, -1, ASCII_CHARS / CHAR_BIT);
+         else
+           bitset_merge (accepts, utf8_sb_map);
+         if (!(dfa->syntax & RE_DOT_NEWLINE))
+           bitset_clear (accepts, '\n');
+         if (dfa->syntax & RE_DOT_NOT_NULL)
+           bitset_clear (accepts, '\0');
+       }
+      else
+       continue;
+
+      /* Check the 'accepts' and sift the characters which are not
+        match it the context.  */
+      if (constraint)
+       {
+         if (constraint & NEXT_NEWLINE_CONSTRAINT)
+           {
+             bool accepts_newline = bitset_contain (accepts, NEWLINE_CHAR);
+             bitset_empty (accepts);
+             if (accepts_newline)
+               bitset_set (accepts, NEWLINE_CHAR);
+             else
+               continue;
+           }
+         if (constraint & NEXT_ENDBUF_CONSTRAINT)
+           {
+             bitset_empty (accepts);
+             continue;
+           }
+
+         if (constraint & NEXT_WORD_CONSTRAINT)
+           {
+             bitset_word_t any_set = 0;
+             if (type == CHARACTER && !node->word_char)
+               {
+                 bitset_empty (accepts);
+                 continue;
+               }
+             if (dfa->mb_cur_max > 1)
+               for (j = 0; j < BITSET_WORDS; ++j)
+                 any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j]));
+             else
+               for (j = 0; j < BITSET_WORDS; ++j)
+                 any_set |= (accepts[j] &= dfa->word_char[j]);
+             if (!any_set)
+               continue;
+           }
+         if (constraint & NEXT_NOTWORD_CONSTRAINT)
+           {
+             bitset_word_t any_set = 0;
+             if (type == CHARACTER && node->word_char)
+               {
+                 bitset_empty (accepts);
+                 continue;
+               }
+             if (dfa->mb_cur_max > 1)
+               for (j = 0; j < BITSET_WORDS; ++j)
+                 any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j]));
+             else
+               for (j = 0; j < BITSET_WORDS; ++j)
+                 any_set |= (accepts[j] &= ~dfa->word_char[j]);
+             if (!any_set)
+               continue;
+           }
+       }
+
+      /* Then divide 'accepts' into DFA states, or create a new
+        state.  Above, we make sure that accepts is not empty.  */
+      for (j = 0; j < ndests; ++j)
+       {
+         bitset_t intersec; /* Intersection sets, see below.  */
+         bitset_t remains;
+         /* Flags, see below.  */
+         bitset_word_t has_intersec, not_subset, not_consumed;
+
+         /* Optimization, skip if this state doesn't accept the character.  */
+         if (type == CHARACTER && !bitset_contain (dests_ch[j], node->opr.c))
+           continue;
+
+         /* Enumerate the intersection set of this state and 'accepts'.  */
+         has_intersec = 0;
+         for (k = 0; k < BITSET_WORDS; ++k)
+           has_intersec |= intersec[k] = accepts[k] & dests_ch[j][k];
+         /* And skip if the intersection set is empty.  */
+         if (!has_intersec)
+           continue;
+
+         /* Then check if this state is a subset of 'accepts'.  */
+         not_subset = not_consumed = 0;
+         for (k = 0; k < BITSET_WORDS; ++k)
+           {
+             not_subset |= remains[k] = ~accepts[k] & dests_ch[j][k];
+             not_consumed |= accepts[k] = accepts[k] & ~dests_ch[j][k];
+           }
+
+         /* If this state isn't a subset of 'accepts', create a
+            new group state, which has the 'remains'. */
+         if (not_subset)
+           {
+             bitset_copy (dests_ch[ndests], remains);
+             bitset_copy (dests_ch[j], intersec);
+             err = re_node_set_init_copy (dests_node + ndests, &dests_node[j]);
+             if (__glibc_unlikely (err != REG_NOERROR))
+               goto error_return;
+             ++ndests;
+           }
+
+         /* Put the position in the current group. */
+         ok = re_node_set_insert (&dests_node[j], cur_nodes->elems[i]);
+         if (__glibc_unlikely (! ok))
+           goto error_return;
+
+         /* If all characters are consumed, go to next node. */
+         if (!not_consumed)
+           break;
+       }
+      /* Some characters remain, create a new group. */
+      if (j == ndests)
+       {
+         bitset_copy (dests_ch[ndests], accepts);
+         err = re_node_set_init_1 (dests_node + ndests, cur_nodes->elems[i]);
+         if (__glibc_unlikely (err != REG_NOERROR))
+           goto error_return;
+         ++ndests;
+         bitset_empty (accepts);
+       }
+    }
+  assume (ndests <= SBC_MAX);
+  return ndests;
+ error_return:
+  for (j = 0; j < ndests; ++j)
+    re_node_set_free (dests_node + j);
+  return -1;
+}
+
+/* Check how many bytes the node 'dfa->nodes[node_idx]' accepts.
+   Return the number of the bytes the node accepts.
+   STR_IDX is the current index of the input string.
+
+   This function handles the nodes which can accept one character, or
+   one collating element like '.', '[a-z]', opposite to the other nodes
+   can only accept one byte.  */
+
+#ifdef _LIBC
+# include <locale/weight.h>
+#endif
+
+static int
+check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
+                        const re_string_t *input, Idx str_idx)
+{
+  const re_token_t *node = dfa->nodes + node_idx;
+  int char_len, elem_len;
+  Idx i;
+
+  if (__glibc_unlikely (node->type == OP_UTF8_PERIOD))
+    {
+      unsigned char c = re_string_byte_at (input, str_idx), d;
+      if (__glibc_likely (c < 0xc2))
+       return 0;
+
+      if (str_idx + 2 > input->len)
+       return 0;
+
+      d = re_string_byte_at (input, str_idx + 1);
+      if (c < 0xe0)
+       return (d < 0x80 || d > 0xbf) ? 0 : 2;
+      else if (c < 0xf0)
+       {
+         char_len = 3;
+         if (c == 0xe0 && d < 0xa0)
+           return 0;
+       }
+      else if (c < 0xf8)
+       {
+         char_len = 4;
+         if (c == 0xf0 && d < 0x90)
+           return 0;
+       }
+      else if (c < 0xfc)
+       {
+         char_len = 5;
+         if (c == 0xf8 && d < 0x88)
+           return 0;
+       }
+      else if (c < 0xfe)
+       {
+         char_len = 6;
+         if (c == 0xfc && d < 0x84)
+           return 0;
+       }
+      else
+       return 0;
+
+      if (str_idx + char_len > input->len)
+       return 0;
+
+      for (i = 1; i < char_len; ++i)
+       {
+         d = re_string_byte_at (input, str_idx + i);
+         if (d < 0x80 || d > 0xbf)
+           return 0;
+       }
+      return char_len;
+    }
+
+  char_len = re_string_char_size_at (input, str_idx);
+  if (node->type == OP_PERIOD)
+    {
+      if (char_len <= 1)
+       return 0;
+      /* FIXME: I don't think this if is needed, as both '\n'
+        and '\0' are char_len == 1.  */
+      /* '.' accepts any one character except the following two cases.  */
+      if ((!(dfa->syntax & RE_DOT_NEWLINE)
+          && re_string_byte_at (input, str_idx) == '\n')
+         || ((dfa->syntax & RE_DOT_NOT_NULL)
+             && re_string_byte_at (input, str_idx) == '\0'))
+       return 0;
+      return char_len;
+    }
+
+  elem_len = re_string_elem_size_at (input, str_idx);
+  if ((elem_len <= 1 && char_len <= 1) || char_len == 0)
+    return 0;
+
+  if (node->type == COMPLEX_BRACKET)
+    {
+      const re_charset_t *cset = node->opr.mbcset;
+#ifdef _LIBC
+      const unsigned char *pin
+       = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
+      Idx j;
+      uint32_t nrules;
+#endif
+      int match_len = 0;
+      wchar_t wc = ((cset->nranges || cset->nchar_classes || cset->nmbchars)
+                   ? re_string_wchar_at (input, str_idx) : 0);
+
+      /* match with multibyte character?  */
+      for (i = 0; i < cset->nmbchars; ++i)
+       if (wc == cset->mbchars[i])
+         {
+           match_len = char_len;
+           goto check_node_accept_bytes_match;
+         }
+      /* match with character_class?  */
+      for (i = 0; i < cset->nchar_classes; ++i)
+       {
+         wctype_t wt = cset->char_classes[i];
+         if (__iswctype (wc, wt))
+           {
+             match_len = char_len;
+             goto check_node_accept_bytes_match;
+           }
+       }
+
+#ifdef _LIBC
+      nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+      if (nrules != 0)
+       {
+         unsigned int in_collseq = 0;
+         const int32_t *table, *indirect;
+         const unsigned char *weights, *extra;
+         const char *collseqwc;
+
+         /* match with collating_symbol?  */
+         if (cset->ncoll_syms)
+           extra = (const unsigned char *)
+             _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
+         for (i = 0; i < cset->ncoll_syms; ++i)
+           {
+             const unsigned char *coll_sym = extra + cset->coll_syms[i];
+             /* Compare the length of input collating element and
+                the length of current collating element.  */
+             if (*coll_sym != elem_len)
+               continue;
+             /* Compare each bytes.  */
+             for (j = 0; j < *coll_sym; j++)
+               if (pin[j] != coll_sym[1 + j])
+                 break;
+             if (j == *coll_sym)
+               {
+                 /* Match if every bytes is equal.  */
+                 match_len = j;
+                 goto check_node_accept_bytes_match;
+               }
+           }
+
+         if (cset->nranges)
+           {
+             if (elem_len <= char_len)
+               {
+                 collseqwc = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQWC);
+                 in_collseq = __collseq_table_lookup (collseqwc, wc);
+               }
+             else
+               in_collseq = find_collation_sequence_value (pin, elem_len);
+           }
+         /* match with range expression?  */
+         /* FIXME: Implement rational ranges here, too.  */
+         for (i = 0; i < cset->nranges; ++i)
+           if (cset->range_starts[i] <= in_collseq
+               && in_collseq <= cset->range_ends[i])
+             {
+               match_len = elem_len;
+               goto check_node_accept_bytes_match;
+             }
+
+         /* match with equivalence_class?  */
+         if (cset->nequiv_classes)
+           {
+             const unsigned char *cp = pin;
+             table = (const int32_t *)
+               _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
+             weights = (const unsigned char *)
+               _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
+             extra = (const unsigned char *)
+               _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
+             indirect = (const int32_t *)
+               _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
+             int32_t idx = findidx (table, indirect, extra, &cp, elem_len);
+             int32_t rule = idx >> 24;
+             idx &= 0xffffff;
+             if (idx > 0)
+               {
+                 size_t weight_len = weights[idx];
+                 for (i = 0; i < cset->nequiv_classes; ++i)
+                   {
+                     int32_t equiv_class_idx = cset->equiv_classes[i];
+                     int32_t equiv_class_rule = equiv_class_idx >> 24;
+                     equiv_class_idx &= 0xffffff;
+                     if (weights[equiv_class_idx] == weight_len
+                         && equiv_class_rule == rule
+                         && memcmp (weights + idx + 1,
+                                    weights + equiv_class_idx + 1,
+                                    weight_len) == 0)
+                       {
+                         match_len = elem_len;
+                         goto check_node_accept_bytes_match;
+                       }
+                   }
+               }
+           }
+       }
+      else
+#endif /* _LIBC */
+       {
+         /* match with range expression?  */
+         for (i = 0; i < cset->nranges; ++i)
+           {
+             if (cset->range_starts[i] <= wc && wc <= cset->range_ends[i])
+               {
+                 match_len = char_len;
+                 goto check_node_accept_bytes_match;
+               }
+           }
+       }
+    check_node_accept_bytes_match:
+      if (!cset->non_match)
+       return match_len;
+      else
+       {
+         if (match_len > 0)
+           return 0;
+         else
+           return (elem_len > char_len) ? elem_len : char_len;
+       }
+    }
+  return 0;
+}
+
+#ifdef _LIBC
+static unsigned int
+find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
+{
+  uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
+  if (nrules == 0)
+    {
+      if (mbs_len == 1)
+       {
+         /* No valid character.  Match it as a single byte character.  */
+         const unsigned char *collseq = (const unsigned char *)
+           _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB);
+         return collseq[mbs[0]];
+       }
+      return UINT_MAX;
+    }
+  else
+    {
+      int32_t idx;
+      const unsigned char *extra = (const unsigned char *)
+       _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
+      int32_t extrasize = (const unsigned char *)
+       _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB + 1) - extra;
+
+      for (idx = 0; idx < extrasize;)
+       {
+         int mbs_cnt;
+         bool found = false;
+         int32_t elem_mbs_len;
+         /* Skip the name of collating element name.  */
+         idx = idx + extra[idx] + 1;
+         elem_mbs_len = extra[idx++];
+         if (mbs_len == elem_mbs_len)
+           {
+             for (mbs_cnt = 0; mbs_cnt < elem_mbs_len; ++mbs_cnt)
+               if (extra[idx + mbs_cnt] != mbs[mbs_cnt])
+                 break;
+             if (mbs_cnt == elem_mbs_len)
+               /* Found the entry.  */
+               found = true;
+           }
+         /* Skip the byte sequence of the collating element.  */
+         idx += elem_mbs_len;
+         /* Adjust for the alignment.  */
+         idx = (idx + 3) & ~3;
+         /* Skip the collation sequence value.  */
+         idx += sizeof (uint32_t);
+         /* Skip the wide char sequence of the collating element.  */
+         idx = idx + sizeof (uint32_t) * (*(int32_t *) (extra + idx) + 1);
+         /* If we found the entry, return the sequence value.  */
+         if (found)
+           return *(uint32_t *) (extra + idx);
+         /* Skip the collation sequence value.  */
+         idx += sizeof (uint32_t);
+       }
+      return UINT_MAX;
+    }
+}
+#endif /* _LIBC */
+
+/* Check whether the node accepts the byte which is IDX-th
+   byte of the INPUT.  */
+
+static bool
+check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
+                  Idx idx)
+{
+  unsigned char ch;
+  ch = re_string_byte_at (&mctx->input, idx);
+  switch (node->type)
+    {
+    case CHARACTER:
+      if (node->opr.c != ch)
+        return false;
+      break;
+
+    case SIMPLE_BRACKET:
+      if (!bitset_contain (node->opr.sbcset, ch))
+        return false;
+      break;
+
+    case OP_UTF8_PERIOD:
+      if (ch >= ASCII_CHARS)
+        return false;
+      FALLTHROUGH;
+    case OP_PERIOD:
+      if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE))
+         || (ch == '\0' && (mctx->dfa->syntax & RE_DOT_NOT_NULL)))
+       return false;
+      break;
+
+    default:
+      return false;
+    }
+
+  if (node->constraint)
+    {
+      /* The node has constraints.  Check whether the current context
+        satisfies the constraints.  */
+      unsigned int context = re_string_context_at (&mctx->input, idx,
+                                                  mctx->eflags);
+      if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context))
+       return false;
+    }
+
+  return true;
+}
+
+/* Extend the buffers, if the buffers have run out.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+extend_buffers (re_match_context_t *mctx, int min_len)
+{
+  reg_errcode_t ret;
+  re_string_t *pstr = &mctx->input;
+
+  /* Avoid overflow.  */
+  if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) / 2
+                       <= pstr->bufs_len))
+    return REG_ESPACE;
+
+  /* Double the lengths of the buffers, but allocate at least MIN_LEN.  */
+  ret = re_string_realloc_buffers (pstr,
+                                  MAX (min_len,
+                                       MIN (pstr->len, pstr->bufs_len * 2)));
+  if (__glibc_unlikely (ret != REG_NOERROR))
+    return ret;
+
+  if (mctx->state_log != NULL)
+    {
+      /* And double the length of state_log.  */
+      /* XXX We have no indication of the size of this buffer.  If this
+        allocation fail we have no indication that the state_log array
+        does not have the right size.  */
+      re_dfastate_t **new_array = re_realloc (mctx->state_log, re_dfastate_t *,
+                                             pstr->bufs_len + 1);
+      if (__glibc_unlikely (new_array == NULL))
+       return REG_ESPACE;
+      mctx->state_log = new_array;
+    }
+
+  /* Then reconstruct the buffers.  */
+  if (pstr->icase)
+    {
+      if (pstr->mb_cur_max > 1)
+       {
+         ret = build_wcs_upper_buffer (pstr);
+         if (__glibc_unlikely (ret != REG_NOERROR))
+           return ret;
+       }
+      else
+       build_upper_buffer (pstr);
+    }
+  else
+    {
+      if (pstr->mb_cur_max > 1)
+       build_wcs_buffer (pstr);
+      else
+       {
+         if (pstr->trans != NULL)
+           re_string_translate_buffer (pstr);
+       }
+    }
+  return REG_NOERROR;
+}
+
+\f
+/* Functions for matching context.  */
+
+/* Initialize MCTX.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+match_ctx_init (re_match_context_t *mctx, int eflags, Idx n)
+{
+  mctx->eflags = eflags;
+  mctx->match_last = -1;
+  if (n > 0)
+    {
+      /* Avoid overflow.  */
+      size_t max_object_size =
+       MAX (sizeof (struct re_backref_cache_entry),
+            sizeof (re_sub_match_top_t *));
+      if (__glibc_unlikely (MIN (IDX_MAX, SIZE_MAX / max_object_size) < n))
+       return REG_ESPACE;
+
+      mctx->bkref_ents = re_malloc (struct re_backref_cache_entry, n);
+      mctx->sub_tops = re_malloc (re_sub_match_top_t *, n);
+      if (__glibc_unlikely (mctx->bkref_ents == NULL || mctx->sub_tops == NULL))
+       return REG_ESPACE;
+    }
+  /* Already zero-ed by the caller.
+     else
+       mctx->bkref_ents = NULL;
+     mctx->nbkref_ents = 0;
+     mctx->nsub_tops = 0;  */
+  mctx->abkref_ents = n;
+  mctx->max_mb_elem_len = 1;
+  mctx->asub_tops = n;
+  return REG_NOERROR;
+}
+
+/* Clean the entries which depend on the current input in MCTX.
+   This function must be invoked when the matcher changes the start index
+   of the input, or changes the input string.  */
+
+static void
+match_ctx_clean (re_match_context_t *mctx)
+{
+  Idx st_idx;
+  for (st_idx = 0; st_idx < mctx->nsub_tops; ++st_idx)
+    {
+      Idx sl_idx;
+      re_sub_match_top_t *top = mctx->sub_tops[st_idx];
+      for (sl_idx = 0; sl_idx < top->nlasts; ++sl_idx)
+       {
+         re_sub_match_last_t *last = top->lasts[sl_idx];
+         re_free (last->path.array);
+         re_free (last);
+       }
+      re_free (top->lasts);
+      if (top->path)
+       {
+         re_free (top->path->array);
+         re_free (top->path);
+       }
+      re_free (top);
+    }
+
+  mctx->nsub_tops = 0;
+  mctx->nbkref_ents = 0;
+}
+
+/* Free all the memory associated with MCTX.  */
+
+static void
+match_ctx_free (re_match_context_t *mctx)
+{
+  /* First, free all the memory associated with MCTX->SUB_TOPS.  */
+  match_ctx_clean (mctx);
+  re_free (mctx->sub_tops);
+  re_free (mctx->bkref_ents);
+}
+
+/* Add a new backreference entry to MCTX.
+   Note that we assume that caller never call this function with duplicate
+   entry, and call with STR_IDX which isn't smaller than any existing entry.
+*/
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from,
+                    Idx to)
+{
+  if (mctx->nbkref_ents >= mctx->abkref_ents)
+    {
+      struct re_backref_cache_entry* new_entry;
+      new_entry = re_realloc (mctx->bkref_ents, struct re_backref_cache_entry,
+                             mctx->abkref_ents * 2);
+      if (__glibc_unlikely (new_entry == NULL))
+       {
+         re_free (mctx->bkref_ents);
+         return REG_ESPACE;
+       }
+      mctx->bkref_ents = new_entry;
+      memset (mctx->bkref_ents + mctx->nbkref_ents, '\0',
+             sizeof (struct re_backref_cache_entry) * mctx->abkref_ents);
+      mctx->abkref_ents *= 2;
+    }
+  if (mctx->nbkref_ents > 0
+      && mctx->bkref_ents[mctx->nbkref_ents - 1].str_idx == str_idx)
+    mctx->bkref_ents[mctx->nbkref_ents - 1].more = 1;
+
+  mctx->bkref_ents[mctx->nbkref_ents].node = node;
+  mctx->bkref_ents[mctx->nbkref_ents].str_idx = str_idx;
+  mctx->bkref_ents[mctx->nbkref_ents].subexp_from = from;
+  mctx->bkref_ents[mctx->nbkref_ents].subexp_to = to;
+
+  /* This is a cache that saves negative results of check_dst_limits_calc_pos.
+     If bit N is clear, means that this entry won't epsilon-transition to
+     an OP_OPEN_SUBEXP or OP_CLOSE_SUBEXP for the N+1-th subexpression.  If
+     it is set, check_dst_limits_calc_pos_1 will recurse and try to find one
+     such node.
+
+     A backreference does not epsilon-transition unless it is empty, so set
+     to all zeros if FROM != TO.  */
+  mctx->bkref_ents[mctx->nbkref_ents].eps_reachable_subexps_map
+    = (from == to ? -1 : 0);
+
+  mctx->bkref_ents[mctx->nbkref_ents++].more = 0;
+  if (mctx->max_mb_elem_len < to - from)
+    mctx->max_mb_elem_len = to - from;
+  return REG_NOERROR;
+}
+
+/* Return the first entry with the same str_idx, or -1 if none is
+   found.  Note that MCTX->BKREF_ENTS is already sorted by MCTX->STR_IDX.  */
+
+static Idx
+search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx)
+{
+  Idx left, right, mid, last;
+  last = right = mctx->nbkref_ents;
+  for (left = 0; left < right;)
+    {
+      mid = (left + right) / 2;
+      if (mctx->bkref_ents[mid].str_idx < str_idx)
+       left = mid + 1;
+      else
+       right = mid;
+    }
+  if (left < last && mctx->bkref_ents[left].str_idx == str_idx)
+    return left;
+  else
+    return -1;
+}
+
+/* Register the node NODE, whose type is OP_OPEN_SUBEXP, and which matches
+   at STR_IDX.  */
+
+static reg_errcode_t
+__attribute_warn_unused_result__
+match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx)
+{
+  DEBUG_ASSERT (mctx->sub_tops != NULL);
+  DEBUG_ASSERT (mctx->asub_tops > 0);
+  if (__glibc_unlikely (mctx->nsub_tops == mctx->asub_tops))
+    {
+      Idx new_asub_tops = mctx->asub_tops * 2;
+      re_sub_match_top_t **new_array = re_realloc (mctx->sub_tops,
+                                                  re_sub_match_top_t *,
+                                                  new_asub_tops);
+      if (__glibc_unlikely (new_array == NULL))
+       return REG_ESPACE;
+      mctx->sub_tops = new_array;
+      mctx->asub_tops = new_asub_tops;
+    }
+  mctx->sub_tops[mctx->nsub_tops] = calloc (1, sizeof (re_sub_match_top_t));
+  if (__glibc_unlikely (mctx->sub_tops[mctx->nsub_tops] == NULL))
+    return REG_ESPACE;
+  mctx->sub_tops[mctx->nsub_tops]->node = node;
+  mctx->sub_tops[mctx->nsub_tops++]->str_idx = str_idx;
+  return REG_NOERROR;
+}
+
+/* Register the node NODE, whose type is OP_CLOSE_SUBEXP, and which matches
+   at STR_IDX, whose corresponding OP_OPEN_SUBEXP is SUB_TOP.
+   Return the new entry if successful, NULL if memory is exhausted.  */
+
+static re_sub_match_last_t *
+match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx)
+{
+  re_sub_match_last_t *new_entry;
+  if (__glibc_unlikely (subtop->nlasts == subtop->alasts))
+    {
+      Idx new_alasts = 2 * subtop->alasts + 1;
+      re_sub_match_last_t **new_array = re_realloc (subtop->lasts,
+                                                   re_sub_match_last_t *,
+                                                   new_alasts);
+      if (__glibc_unlikely (new_array == NULL))
+       return NULL;
+      subtop->lasts = new_array;
+      subtop->alasts = new_alasts;
+    }
+  new_entry = calloc (1, sizeof (re_sub_match_last_t));
+  if (__glibc_likely (new_entry != NULL))
+    {
+      subtop->lasts[subtop->nlasts] = new_entry;
+      new_entry->node = node;
+      new_entry->str_idx = str_idx;
+      ++subtop->nlasts;
+    }
+  return new_entry;
+}
+
+static void
+sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts,
+              re_dfastate_t **limited_sts, Idx last_node, Idx last_str_idx)
+{
+  sctx->sifted_states = sifted_sts;
+  sctx->limited_states = limited_sts;
+  sctx->last_node = last_node;
+  sctx->last_str_idx = last_str_idx;
+  re_node_set_init_empty (&sctx->limits);
+}
deleted file mode 120000 (symlink)
index 2fdf39b15c3ffa4f4ac0469b1075059f8e5b942f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/remove.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..279b1ef98b52eb745dbf0566ae72760ef284bddf
--- /dev/null
@@ -0,0 +1,43 @@
+/* Remove a file or directory.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+#undef remove
+
+/* Remove NAME from the file system.  This works around C89 platforms
+   that don't handle directories like POSIX requires; it also works
+   around Solaris 9 bugs with trailing slash.  */
+int
+rpl_remove (char const *name)
+{
+  /* It is faster to just try rmdir, and fall back on unlink, than it
+     is to use lstat to see what we are about to remove.  Technically,
+     it is more likely that we want unlink, not rmdir, but we cannot
+     guarantee the safety of unlink on directories.  Trailing slash
+     bugs are handled by our rmdir and unlink wrappers.  */
+  int result = rmdir (name);
+  if (result && errno == ENOTDIR)
+    result = unlink (name);
+  return result;
+}
deleted file mode 120000 (symlink)
index d83cd5dbab5e9a25f17d8466e0af9c2991086089..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/rename.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b6c93db474eabe6ba981aa90195ae5226a8215aa
--- /dev/null
@@ -0,0 +1,476 @@
+/* Work around rename bugs in some systems.
+
+   Copyright (C) 2001-2003, 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Volker Borchert, Eric Blake.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#undef rename
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* The mingw rename has problems with trailing slashes; it also
+   requires use of native Windows calls to allow atomic renames over
+   existing files.  */
+
+# include <errno.h>
+# include <stdlib.h>
+# include <sys/stat.h>
+# include <unistd.h>
+
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+# include "dirname.h"
+
+/* Don't assume that UNICODE is not defined.  */
+# undef MoveFileEx
+# define MoveFileEx MoveFileExA
+
+/* Rename the file SRC to DST.  This replacement is necessary on
+   Windows, on which the system rename function will not replace
+   an existing DST.  */
+int
+rpl_rename (char const *src, char const *dst)
+{
+  int error;
+  size_t src_len = strlen (src);
+  size_t dst_len = strlen (dst);
+  char *src_base = last_component (src);
+  char *dst_base = last_component (dst);
+  bool src_slash;
+  bool dst_slash;
+  bool dst_exists;
+  struct stat src_st;
+  struct stat dst_st;
+
+  /* Filter out dot as last component.  */
+  if (!src_len || !dst_len)
+    {
+      errno = ENOENT;
+      return -1;
+    }
+  if (*src_base == '.')
+    {
+      size_t len = base_len (src_base);
+      if (len == 1 || (len == 2 && src_base[1] == '.'))
+        {
+          errno = EINVAL;
+          return -1;
+        }
+    }
+  if (*dst_base == '.')
+    {
+      size_t len = base_len (dst_base);
+      if (len == 1 || (len == 2 && dst_base[1] == '.'))
+        {
+          errno = EINVAL;
+          return -1;
+        }
+    }
+
+  /* Presence of a trailing slash requires directory semantics.  If
+     the source does not exist, or if the destination cannot be turned
+     into a directory, give up now.  Otherwise, strip trailing slashes
+     before calling rename.  There are no symlinks on mingw, so stat
+     works instead of lstat.  */
+  src_slash = ISSLASH (src[src_len - 1]);
+  dst_slash = ISSLASH (dst[dst_len - 1]);
+  if (stat (src, &src_st))
+    return -1;
+  if (stat (dst, &dst_st))
+    {
+      if (errno != ENOENT || (!S_ISDIR (src_st.st_mode) && dst_slash))
+        return -1;
+      dst_exists = false;
+    }
+  else
+    {
+      if (S_ISDIR (dst_st.st_mode) != S_ISDIR (src_st.st_mode))
+        {
+          errno = S_ISDIR (dst_st.st_mode) ? EISDIR : ENOTDIR;
+          return -1;
+        }
+      dst_exists = true;
+    }
+
+  /* There are no symlinks, so if a file existed with a trailing
+     slash, it must be a directory, and we don't have to worry about
+     stripping strip trailing slash.  However, mingw refuses to
+     replace an existing empty directory, so we have to help it out.
+     And canonicalize_file_name is not yet ported to mingw; however,
+     for directories, getcwd works as a viable alternative.  Ensure
+     that we can get back to where we started before using it; later
+     attempts to return are fatal.  Note that we can end up losing a
+     directory if rename then fails, but it was empty, so not much
+     damage was done.  */
+  if (dst_exists && S_ISDIR (dst_st.st_mode))
+    {
+      char *cwd = getcwd (NULL, 0);
+      char *src_temp;
+      char *dst_temp;
+      if (!cwd || chdir (cwd))
+        return -1;
+      if (IS_ABSOLUTE_FILE_NAME (src))
+        {
+          dst_temp = chdir (dst) ? NULL : getcwd (NULL, 0);
+          src_temp = chdir (src) ? NULL : getcwd (NULL, 0);
+        }
+      else
+        {
+          src_temp = chdir (src) ? NULL : getcwd (NULL, 0);
+          if (!IS_ABSOLUTE_FILE_NAME (dst) && chdir (cwd))
+            abort ();
+          dst_temp = chdir (dst) ? NULL : getcwd (NULL, 0);
+        }
+      if (chdir (cwd))
+        abort ();
+      free (cwd);
+      if (!src_temp || !dst_temp)
+        {
+          free (src_temp);
+          free (dst_temp);
+          errno = ENOMEM;
+          return -1;
+        }
+      src_len = strlen (src_temp);
+      if (strncmp (src_temp, dst_temp, src_len) == 0
+          && (ISSLASH (dst_temp[src_len]) || dst_temp[src_len] == '\0'))
+        {
+          error = dst_temp[src_len];
+          free (src_temp);
+          free (dst_temp);
+          if (error)
+            {
+              errno = EINVAL;
+              return -1;
+            }
+          return 0;
+        }
+      if (rmdir (dst))
+        {
+          free (src_temp);
+          free (dst_temp);
+          return -1;
+        }
+      free (src_temp);
+      free (dst_temp);
+    }
+
+  /* MoveFileEx works if SRC is a directory without any flags, but
+     fails with MOVEFILE_REPLACE_EXISTING, so try without flags first.
+     Thankfully, MoveFileEx handles hard links correctly, even though
+     rename() does not.  */
+  if (MoveFileEx (src, dst, 0))
+    return 0;
+
+  /* Retry with MOVEFILE_REPLACE_EXISTING if the move failed
+     due to the destination already existing.  */
+  error = GetLastError ();
+  if (error == ERROR_FILE_EXISTS || error == ERROR_ALREADY_EXISTS)
+    {
+      if (MoveFileEx (src, dst, MOVEFILE_REPLACE_EXISTING))
+        return 0;
+
+      error = GetLastError ();
+    }
+
+  switch (error)
+    {
+    case ERROR_FILE_NOT_FOUND:
+    case ERROR_PATH_NOT_FOUND:
+    case ERROR_BAD_PATHNAME:
+    case ERROR_DIRECTORY:
+      errno = ENOENT;
+      break;
+
+    case ERROR_ACCESS_DENIED:
+    case ERROR_SHARING_VIOLATION:
+      errno = EACCES;
+      break;
+
+    case ERROR_OUTOFMEMORY:
+      errno = ENOMEM;
+      break;
+
+    case ERROR_CURRENT_DIRECTORY:
+      errno = EBUSY;
+      break;
+
+    case ERROR_NOT_SAME_DEVICE:
+      errno = EXDEV;
+      break;
+
+    case ERROR_WRITE_PROTECT:
+      errno = EROFS;
+      break;
+
+    case ERROR_WRITE_FAULT:
+    case ERROR_READ_FAULT:
+    case ERROR_GEN_FAILURE:
+      errno = EIO;
+      break;
+
+    case ERROR_HANDLE_DISK_FULL:
+    case ERROR_DISK_FULL:
+    case ERROR_DISK_TOO_FRAGMENTED:
+      errno = ENOSPC;
+      break;
+
+    case ERROR_FILE_EXISTS:
+    case ERROR_ALREADY_EXISTS:
+      errno = EEXIST;
+      break;
+
+    case ERROR_BUFFER_OVERFLOW:
+    case ERROR_FILENAME_EXCED_RANGE:
+      errno = ENAMETOOLONG;
+      break;
+
+    case ERROR_INVALID_NAME:
+    case ERROR_DELETE_PENDING:
+      errno = EPERM;        /* ? */
+      break;
+
+# ifndef ERROR_FILE_TOO_LARGE
+/* This value is documented but not defined in all versions of windows.h.  */
+#  define ERROR_FILE_TOO_LARGE 223
+# endif
+    case ERROR_FILE_TOO_LARGE:
+      errno = EFBIG;
+      break;
+
+    default:
+      errno = EINVAL;
+      break;
+    }
+
+  return -1;
+}
+
+#else /* ! W32 platform */
+
+# include <errno.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+# include <sys/stat.h>
+# include <unistd.h>
+
+# include "dirname.h"
+# include "same-inode.h"
+
+/* Rename the file SRC to DST, fixing any trailing slash bugs.  */
+
+int
+rpl_rename (char const *src, char const *dst)
+{
+  size_t src_len = strlen (src);
+  size_t dst_len = strlen (dst);
+  char *src_temp = (char *) src;
+  char *dst_temp = (char *) dst;
+  bool src_slash;
+  bool dst_slash;
+  _GL_UNUSED bool dst_exists;
+  int ret_val = -1;
+  int rename_errno = ENOTDIR;
+  struct stat src_st;
+  struct stat dst_st;
+
+  if (!src_len || !dst_len)
+    return rename (src, dst); /* Let strace see the ENOENT failure.  */
+
+# if RENAME_DEST_EXISTS_BUG
+  {
+    char *src_base = last_component (src);
+    char *dst_base = last_component (dst);
+    if (*src_base == '.')
+      {
+        size_t len = base_len (src_base);
+        if (len == 1 || (len == 2 && src_base[1] == '.'))
+          {
+            errno = EINVAL;
+            return -1;
+          }
+      }
+    if (*dst_base == '.')
+      {
+        size_t len = base_len (dst_base);
+        if (len == 1 || (len == 2 && dst_base[1] == '.'))
+          {
+            errno = EINVAL;
+            return -1;
+          }
+      }
+  }
+# endif /* RENAME_DEST_EXISTS_BUG */
+
+  src_slash = src[src_len - 1] == '/';
+  dst_slash = dst[dst_len - 1] == '/';
+
+# if !RENAME_HARD_LINK_BUG && !RENAME_DEST_EXISTS_BUG
+  /* If there are no trailing slashes, then trust the native
+     implementation unless we also suspect issues with hard link
+     detection or file/directory conflicts.  */
+  if (!src_slash && !dst_slash)
+    return rename (src, dst);
+# endif /* !RENAME_HARD_LINK_BUG && !RENAME_DEST_EXISTS_BUG */
+
+  /* Presence of a trailing slash requires directory semantics.  If
+     the source does not exist, or if the destination cannot be turned
+     into a directory, give up now.  Otherwise, strip trailing slashes
+     before calling rename.  */
+  if (lstat (src, &src_st))
+    return -1;
+  if (lstat (dst, &dst_st))
+    {
+      if (errno != ENOENT || (!S_ISDIR (src_st.st_mode) && dst_slash))
+        return -1;
+      dst_exists = false;
+    }
+  else
+    {
+      if (S_ISDIR (dst_st.st_mode) != S_ISDIR (src_st.st_mode))
+        {
+          errno = S_ISDIR (dst_st.st_mode) ? EISDIR : ENOTDIR;
+          return -1;
+        }
+# if RENAME_HARD_LINK_BUG
+      if (psame_inode (&src_st, &dst_st))
+        return 0;
+# endif /* RENAME_HARD_LINK_BUG */
+      dst_exists = true;
+    }
+
+# if (RENAME_TRAILING_SLASH_SOURCE_BUG || RENAME_DEST_EXISTS_BUG        \
+      || RENAME_HARD_LINK_BUG)
+  /* If the only bug was that a trailing slash was allowed on a
+     nonexistent file destination, as in Solaris 10, then we've
+     already covered that situation.  But if there is any problem with
+     a trailing slash on an existing source or destination, as in
+     Solaris 9, or if a directory can overwrite a symlink, as on
+     Cygwin 1.5, or if directories cannot be created with trailing
+     slash, as on NetBSD 1.6, then we must strip the offending slash
+     and check that we have not encountered a symlink instead of a
+     directory.
+
+     Stripping a trailing slash interferes with POSIX semantics, where
+     rename behavior on a symlink with a trailing slash operates on
+     the corresponding target directory.  We prefer the GNU semantics
+     of rejecting any use of a symlink with trailing slash, but do not
+     enforce them, since Solaris 10 is able to obey POSIX semantics
+     and there might be clients expecting it, as counter-intuitive as
+     those semantics are.
+
+     Technically, we could also follow the POSIX behavior by chasing a
+     readlink trail, but that is harder to implement.  */
+  if (src_slash)
+    {
+      src_temp = strdup (src);
+      if (!src_temp)
+        {
+          /* Rather than rely on strdup-posix, we set errno ourselves.  */
+          rename_errno = ENOMEM;
+          goto out;
+        }
+      strip_trailing_slashes (src_temp);
+      if (lstat (src_temp, &src_st))
+        {
+          rename_errno = errno;
+          goto out;
+        }
+      if (S_ISLNK (src_st.st_mode))
+        goto out;
+    }
+  if (dst_slash)
+    {
+      dst_temp = strdup (dst);
+      if (!dst_temp)
+        {
+          rename_errno = ENOMEM;
+          goto out;
+        }
+      strip_trailing_slashes (dst_temp);
+      if (lstat (dst_temp, &dst_st))
+        {
+          if (errno != ENOENT)
+            {
+              rename_errno = errno;
+              goto out;
+            }
+        }
+      else if (S_ISLNK (dst_st.st_mode))
+        goto out;
+    }
+# endif /* RENAME_TRAILING_SLASH_SOURCE_BUG || RENAME_DEST_EXISTS_BUG
+           || RENAME_HARD_LINK_BUG */
+
+# if RENAME_DEST_EXISTS_BUG
+  /* Cygwin 1.5 sometimes behaves oddly when moving a non-empty
+     directory on top of an empty one (the old directory name can
+     reappear if the new directory tree is removed).  Work around this
+     by removing the target first, but don't remove the target if it
+     is a subdirectory of the source.  Note that we can end up losing
+     a directory if rename then fails, but it was empty, so not much
+     damage was done.  */
+  if (dst_exists && S_ISDIR (dst_st.st_mode))
+    {
+      if (src_st.st_dev != dst_st.st_dev)
+        {
+          rename_errno = EXDEV;
+          goto out;
+        }
+      if (src_temp != src)
+        free (src_temp);
+      src_temp = canonicalize_file_name (src);
+      if (dst_temp != dst)
+        free (dst_temp);
+      dst_temp = canonicalize_file_name (dst);
+      if (!src_temp || !dst_temp)
+        {
+          rename_errno = ENOMEM;
+          goto out;
+        }
+      src_len = strlen (src_temp);
+      if (strncmp (src_temp, dst_temp, src_len) == 0
+          && dst_temp[src_len] == '/')
+        {
+          rename_errno = EINVAL;
+          goto out;
+        }
+      if (rmdir (dst))
+        {
+          rename_errno = errno;
+          goto out;
+        }
+    }
+# endif /* RENAME_DEST_EXISTS_BUG */
+
+  ret_val = rename (src_temp, dst_temp);
+  rename_errno = errno;
+
+ out: _GL_UNUSED_LABEL;
+
+  if (src_temp != src)
+    free (src_temp);
+  if (dst_temp != dst)
+    free (dst_temp);
+  errno = rename_errno;
+  return ret_val;
+}
+#endif /* ! W32 platform */
deleted file mode 120000 (symlink)
index 34180eb21dd6072cc2ebdc75375c62e2cd3e0f2f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/renameat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d1ab89dbe8ce96360c87495bc2525b5ac4834532
--- /dev/null
@@ -0,0 +1,25 @@
+/* Rename a file relative to open directories.
+   Copyright 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+#include <stdio.h>
+#include "renameatu.h"
+
+int
+renameat (int fd1, char const *src, int fd2, char const *dst)
+{
+  return renameatu (fd1, src, fd2, dst, 0);
+}
deleted file mode 120000 (symlink)
index fa9280424d659af76f95964249334b55febec25b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/renameatu.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..174081c16b0d3c3cc122274ed7fc564738f81fe6
--- /dev/null
@@ -0,0 +1,254 @@
+/* Rename a file relative to open directories.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake and Paul Eggert */
+
+#include <config.h>
+
+#include "renameatu.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifdef __linux__
+# include <sys/syscall.h>
+#endif
+
+static int
+errno_fail (int e)
+{
+  errno = e;
+  return -1;
+}
+
+#if HAVE_RENAMEAT
+
+# include <stdlib.h>
+# include <string.h>
+
+# include "dirname.h"
+# include "openat.h"
+
+#else
+# include "openat-priv.h"
+
+static int
+rename_noreplace (char const *src, char const *dst)
+{
+  /* This has a race between the call to lstat and the call to rename.  */
+  struct stat st;
+  return (lstat (dst, &st) == 0 || errno == EOVERFLOW ? errno_fail (EEXIST)
+          : errno == ENOENT ? rename (src, dst)
+          : -1);
+}
+#endif
+
+#undef renameat
+
+#if HAVE_RENAMEAT
+
+/* Act like renameat (FD1, SRC, FD2, DST), except fail with EEXIST if
+   FLAGS is nonzero and it is easy to fail atomically if DST already exists.
+   This lets renameatu be atomic when it can be implemented in terms
+   of renameatx_np.  */
+static int
+renameat2ish (int fd1, char const *src, int fd2, char const *dst,
+              unsigned int flags)
+{
+# ifdef RENAME_EXCL
+  if (flags)
+    {
+      int r = renameatx_np (fd1, src, fd2, dst, RENAME_EXCL);
+      if (r == 0 || errno != ENOTSUP)
+        return r;
+    }
+# endif
+
+  return renameat (fd1, src, fd2, dst);
+}
+#endif
+
+/* Rename FILE1, in the directory open on descriptor FD1, to FILE2, in
+   the directory open on descriptor FD2.  If possible, do it without
+   changing the working directory.  Otherwise, resort to using
+   save_cwd/fchdir, then rename/restore_cwd.  If either the save_cwd or
+   the restore_cwd fails, then give a diagnostic and exit nonzero.
+
+   Obey FLAGS when doing the renaming.  If FLAGS is zero, this
+   function is equivalent to renameat (FD1, SRC, FD2, DST).
+   Otherwise, attempt to implement FLAGS even if the implementation is
+   not atomic; this differs from the GNU/Linux native renameat2,
+   which fails if it cannot guarantee atomicity.  */
+
+int
+renameatu (int fd1, char const *src, int fd2, char const *dst,
+           unsigned int flags)
+{
+  int ret_val = -1;
+  int err = EINVAL;
+
+#ifdef HAVE_RENAMEAT2
+  ret_val = renameat2 (fd1, src, fd2, dst, flags);
+  err = errno;
+#elif defined SYS_renameat2
+  ret_val = syscall (SYS_renameat2, fd1, src, fd2, dst, flags);
+  err = errno;
+#endif
+
+  if (! (ret_val < 0 && (err == EINVAL || err == ENOSYS || err == ENOTSUP)))
+    return ret_val;
+
+#if HAVE_RENAMEAT
+  {
+  size_t src_len;
+  size_t dst_len;
+  char *src_temp = (char *) src;
+  char *dst_temp = (char *) dst;
+  bool src_slash;
+  bool dst_slash;
+  int rename_errno = ENOTDIR;
+  struct stat src_st;
+  struct stat dst_st;
+  bool dst_found_nonexistent = false;
+
+  switch (flags)
+    {
+    case 0:
+      break;
+
+    case RENAME_NOREPLACE:
+      /* This has a race between the call to fstatat and the calls to
+         renameat below.  This fstatat is needed even if RENAME_EXCL
+         is defined, because RENAME_EXCL is buggy on macOS 11.2:
+         renameatx_np (fd, "X", fd, "X", RENAME_EXCL) incorrectly
+         succeeds when X exists.  */
+      if (fstatat (fd2, dst, &dst_st, AT_SYMLINK_NOFOLLOW) == 0
+          || errno == EOVERFLOW)
+        return errno_fail (EEXIST);
+      if (errno != ENOENT)
+        return -1;
+      dst_found_nonexistent = true;
+      break;
+
+    default:
+      return errno_fail (ENOTSUP);
+    }
+
+  /* Let strace see any ENOENT failure.  */
+  src_len = strlen (src);
+  dst_len = strlen (dst);
+  if (!src_len || !dst_len)
+    return renameat2ish (fd1, src, fd2, dst, flags);
+
+  src_slash = src[src_len - 1] == '/';
+  dst_slash = dst[dst_len - 1] == '/';
+  if (!src_slash && !dst_slash)
+    return renameat2ish (fd1, src, fd2, dst, flags);
+
+  /* Presence of a trailing slash requires directory semantics.  If
+     the source does not exist, or if the destination cannot be turned
+     into a directory, give up now.  Otherwise, strip trailing slashes
+     before calling rename.  */
+  if (fstatat (fd1, src, &src_st, AT_SYMLINK_NOFOLLOW))
+    return -1;
+  if (dst_found_nonexistent)
+    {
+      if (!S_ISDIR (src_st.st_mode))
+        return errno_fail (ENOENT);
+    }
+  else if (fstatat (fd2, dst, &dst_st, AT_SYMLINK_NOFOLLOW))
+    {
+      if (errno != ENOENT || !S_ISDIR (src_st.st_mode))
+        return -1;
+    }
+  else if (!S_ISDIR (dst_st.st_mode))
+    return errno_fail (ENOTDIR);
+  else if (!S_ISDIR (src_st.st_mode))
+    return errno_fail (EISDIR);
+
+# if RENAME_TRAILING_SLASH_SOURCE_BUG
+  /* See the lengthy comment in rename.c why Solaris 9 is forced to
+     GNU behavior, while Solaris 10 is left with POSIX behavior,
+     regarding symlinks with trailing slash.  */
+  ret_val = -1;
+  if (src_slash)
+    {
+      src_temp = strdup (src);
+      if (!src_temp)
+        {
+          /* Rather than rely on strdup-posix, we set errno ourselves.  */
+          rename_errno = ENOMEM;
+          goto out;
+        }
+      strip_trailing_slashes (src_temp);
+      if (fstatat (fd1, src_temp, &src_st, AT_SYMLINK_NOFOLLOW))
+        {
+          rename_errno = errno;
+          goto out;
+        }
+      if (S_ISLNK (src_st.st_mode))
+        goto out;
+    }
+  if (dst_slash)
+    {
+      dst_temp = strdup (dst);
+      if (!dst_temp)
+        {
+          rename_errno = ENOMEM;
+          goto out;
+        }
+      strip_trailing_slashes (dst_temp);
+      char readlink_buf[1];
+      if (readlinkat (fd2, dst_temp, readlink_buf, sizeof readlink_buf) < 0)
+        {
+          if (errno != ENOENT && errno != EINVAL)
+            {
+              rename_errno = errno;
+              goto out;
+            }
+        }
+      else
+        goto out;
+    }
+# endif /* RENAME_TRAILING_SLASH_SOURCE_BUG */
+
+  /* renameat does not honor trailing / on Solaris 10.  Solve it in a
+     similar manner to rename.  No need to worry about bugs not present
+     on Solaris, since all other systems either lack renameat or honor
+     trailing slash correctly.  */
+
+  ret_val = renameat2ish (fd1, src_temp, fd2, dst_temp, flags);
+  rename_errno = errno;
+  goto out;
+ out:
+  if (src_temp != src)
+    free (src_temp);
+  if (dst_temp != dst)
+    free (dst_temp);
+  errno = rename_errno;
+  return ret_val;
+  }
+#else /* !HAVE_RENAMEAT */
+
+  /* RENAME_NOREPLACE is the only flag currently supported.  */
+  if (flags & ~RENAME_NOREPLACE)
+    return errno_fail (ENOTSUP);
+  return at_func2 (fd1, src, fd2, dst, flags ? rename_noreplace : rename);
+
+#endif /* !HAVE_RENAMEAT */
+}
deleted file mode 120000 (symlink)
index b1c1bea647108680ba1c805b36c93453f997f547..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/renameatu.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1be335b63bc6c2f061bd416bf534b13526e6a498
--- /dev/null
@@ -0,0 +1,28 @@
+/* Rename a file relative to open directories.
+   Copyright 2017-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+/* Get RENAME_* macros from <stdio.h> if present, otherwise supply
+   the traditional Linux values.  */
+#include <stdio.h>
+#ifndef RENAME_NOREPLACE
+# define RENAME_NOREPLACE  (1 << 0)
+# define RENAME_EXCHANGE   (1 << 1)
+# define RENAME_WHITEOUT   (1 << 2)
+#endif
+
+extern int renameatu (int, char const *, int, char const *, unsigned int);
deleted file mode 120000 (symlink)
index 2bfc937fef8d4d0d3566ccf602a51899f813dba2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/rewinddir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..82ebc7f8dc5473285c35243d69a7084bc5f5ff80
--- /dev/null
@@ -0,0 +1,60 @@
+/* Restart reading the entries of a directory from the beginning.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <dirent.h>
+
+#include <errno.h>
+
+#if GNULIB_defined_DIR
+# include "dirent-private.h"
+#endif
+
+/* Don't assume that UNICODE is not defined.  */
+#undef FindFirstFile
+#define FindFirstFile FindFirstFileA
+
+void
+rewinddir (DIR *dirp)
+#undef rewinddir
+{
+#if HAVE_DIRENT_H                       /* equivalent to HAVE_REWINDDIR */
+  rewinddir (dirp->real_dirp);
+#else
+  /* Like in closedir().  */
+  if (dirp->current != INVALID_HANDLE_VALUE)
+    FindClose (dirp->current);
+
+  /* Like in opendir().  */
+  dirp->status = -1;
+  dirp->current = FindFirstFile (dirp->dir_name_mask, &dirp->entry);
+  if (dirp->current == INVALID_HANDLE_VALUE)
+    {
+      switch (GetLastError ())
+        {
+        case ERROR_FILE_NOT_FOUND:
+          dirp->status = -2;
+          break;
+        default:
+          /* Save the error code for the next readdir() call.  */
+          dirp->status = ENOENT;
+          break;
+        }
+    }
+#endif
+}
deleted file mode 120000 (symlink)
index 2f64f1935d2d496dfd46399ddff33a37264ae5c6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/rmdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..04e43162d0e83dcae55087c138d8a1c49437f382
--- /dev/null
@@ -0,0 +1,56 @@
+/* Work around rmdir bugs.
+
+   Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <string.h>
+
+#include "filename.h"
+
+#undef rmdir
+#if defined _WIN32 && !defined __CYGWIN__
+# define rmdir _rmdir
+#endif
+
+/* Remove directory DIR.
+   Return 0 if successful, -1 if not.  */
+
+int
+rpl_rmdir (char const *dir)
+{
+  /* Work around cygwin 1.5.x bug where rmdir("dir/./") succeeds.  */
+  size_t len = strlen (dir);
+  int result;
+  while (len && ISSLASH (dir[len - 1]))
+    len--;
+  if (len && dir[len - 1] == '.' && (1 == len || ISSLASH (dir[len - 2])))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  result = rmdir (dir);
+  /* Work around mingw bug, where rmdir("file/") fails with EINVAL
+     instead of ENOTDIR.  We've already filtered out trailing ., the
+     only reason allowed by POSIX for EINVAL.  */
+  if (result == -1 && errno == EINVAL)
+    errno = ENOTDIR;
+  return result;
+}
deleted file mode 120000 (symlink)
index d2f15bc207afd9a4b8503099bff0dcd756d8bcaa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/root-uid.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ba50bfd4e6ae1a4587e745128a726f1ee72d8ab1
--- /dev/null
@@ -0,0 +1,30 @@
+/* The user ID that always has appropriate privileges in the POSIX sense.
+
+   Copyright 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef ROOT_UID_H_
+#define ROOT_UID_H_
+
+/* The user ID that always has appropriate privileges in the POSIX sense.  */
+#ifdef __TANDEM
+# define ROOT_UID 65535
+#else
+# define ROOT_UID 0
+#endif
+
+#endif
deleted file mode 120000 (symlink)
index 9d863a3fd35f5d95a8bb4db688ec21f8caa134e4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/rpmatch.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ac16fbf0cab84d97310fc181ef6c39db53336b76
--- /dev/null
@@ -0,0 +1,175 @@
+/* Determine whether string value is affirmation or negative response
+   according to current locale's data.
+
+   Copyright (C) 1996, 1998, 2000, 2002-2003, 2006-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <stddef.h>
+
+#if ENABLE_NLS
+# include <sys/types.h>
+# include <limits.h>
+# include <string.h>
+# if HAVE_LANGINFO_YESEXPR
+#  include <langinfo.h>
+# endif
+# include <regex.h>
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+# define N_(msgid) gettext_noop (msgid)
+
+# if HAVE_LANGINFO_YESEXPR
+/* Return the localized regular expression pattern corresponding to
+   ENGLISH_PATTERN.  NL_INDEX can be used with nl_langinfo.
+   The resulting string may only be used until the next nl_langinfo call.  */
+static const char *
+localized_pattern (const char *english_pattern, nl_item nl_index,
+                   bool posixly_correct)
+{
+  const char *translated_pattern;
+
+  /* We prefer to get the patterns from a PO file.  It would be possible to
+     always use nl_langinfo (YESEXPR) instead of _("^[yY]"), and
+     nl_langinfo (NOEXPR) instead of _("^[nN]"), if we could assume that the
+     system's locale support is good.  But this is not the case e.g. on Cygwin.
+     The localizations of gnulib.pot are of better quality in general.
+     Also, if we use locale info from non-free systems that don't have a
+     'localedef' command, we deprive the users of the freedom to localize
+     this pattern for their preferred language.
+     But some programs, such as 'cp', 'mv', 'rm', 'find', 'xargs', are
+     specified by POSIX to use nl_langinfo (YESEXPR).  We implement this
+     behaviour if POSIXLY_CORRECT is set, for the sake of these programs.  */
+
+  /* If the user wants strict POSIX compliance, use nl_langinfo.  */
+  if (posixly_correct)
+    {
+      translated_pattern = nl_langinfo (nl_index);
+      /* Check against a broken system return value.  */
+      if (translated_pattern != NULL && translated_pattern[0] != '\0')
+        return translated_pattern;
+   }
+
+  /* Look in the gnulib message catalog.  */
+  translated_pattern = _(english_pattern);
+  if (translated_pattern == english_pattern)
+    {
+      /* The gnulib message catalog provides no translation.
+         Try the system's message catalog.  */
+      translated_pattern = nl_langinfo (nl_index);
+      /* Check against a broken system return value.  */
+      if (translated_pattern != NULL && translated_pattern[0] != '\0')
+        return translated_pattern;
+      /* Fall back to English.  */
+      translated_pattern = english_pattern;
+    }
+  return translated_pattern;
+}
+# else
+#  define localized_pattern(english_pattern,nl_index,posixly_correct) \
+     _(english_pattern)
+# endif
+
+static int
+try (const char *response, const char *pattern, char **lastp, regex_t *re)
+{
+  if (*lastp == NULL || strcmp (pattern, *lastp) != 0)
+    {
+      char *safe_pattern;
+
+      /* The pattern has changed.  */
+      if (*lastp != NULL)
+        {
+          /* Free the old compiled pattern.  */
+          regfree (re);
+          free (*lastp);
+          *lastp = NULL;
+        }
+      /* Put the PATTERN into safe memory before calling regcomp.
+         (regcomp may call nl_langinfo, overwriting PATTERN's storage.  */
+      safe_pattern = strdup (pattern);
+      if (safe_pattern == NULL)
+        return -1;
+      /* Compile the pattern and cache it for future runs.  */
+      if (regcomp (re, safe_pattern, REG_EXTENDED) != 0)
+        {
+          free (safe_pattern);
+          return -1;
+        }
+      *lastp = safe_pattern;
+    }
+
+  /* See if the regular expression matches RESPONSE.  */
+  return regexec (re, response, 0, NULL, 0) == 0;
+}
+#endif
+
+
+int
+rpmatch (const char *response)
+{
+#if ENABLE_NLS
+  /* Match against one of the response patterns, compiling the pattern
+     first if necessary.  */
+
+  /* We cache the response patterns and compiled regexps here.  */
+  static char *last_yesexpr, *last_noexpr;
+  static regex_t cached_yesre, cached_nore;
+
+# if HAVE_LANGINFO_YESEXPR
+  bool posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
+# endif
+
+  const char *yesexpr, *noexpr;
+  int result;
+
+  /* TRANSLATORS: A regular expression testing for an affirmative answer
+     (english: "yes").  Testing the first character may be sufficient.
+     Take care to consider upper and lower case.
+     To enquire the regular expression that your system uses for this
+     purpose, you can use the command
+       locale -k LC_MESSAGES | grep '^yesexpr='  */
+  yesexpr = localized_pattern (N_("^[yY]"), YESEXPR, posixly_correct);
+  result = try (response, yesexpr, &last_yesexpr, &cached_yesre);
+  if (result < 0)
+    return -1;
+  if (result)
+    return 1;
+
+  /* TRANSLATORS: A regular expression testing for a negative answer
+     (english: "no").  Testing the first character may be sufficient.
+     Take care to consider upper and lower case.
+     To enquire the regular expression that your system uses for this
+     purpose, you can use the command
+       locale -k LC_MESSAGES | grep '^noexpr='  */
+  noexpr = localized_pattern (N_("^[nN]"), NOEXPR, posixly_correct);
+  result = try (response, noexpr, &last_noexpr, &cached_nore);
+  if (result < 0)
+    return -1;
+  if (result)
+    return 0;
+
+  return -1;
+#else
+  /* Test against "^[yY]" and "^[nN]", hardcoded to avoid requiring regex */
+  return (*response == 'y' || *response == 'Y' ? 1
+          : *response == 'n' || *response == 'N' ? 0 : -1);
+#endif
+}
deleted file mode 120000 (symlink)
index d6b9636d70b109eb54e2cdb8153b3e3a07e5c95c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/safe-read.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a389b57bfb3864c8df980eacba8d4127157e6b8f
--- /dev/null
@@ -0,0 +1,71 @@
+/* An interface to read and write that retries after interrupts.
+
+   Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#ifdef SAFE_WRITE
+# include "safe-write.h"
+#else
+# include "safe-read.h"
+#endif
+
+/* Get ssize_t.  */
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <errno.h>
+
+#ifdef EINTR
+# define IS_EINTR(x) ((x) == EINTR)
+#else
+# define IS_EINTR(x) 0
+#endif
+
+#include "sys-limits.h"
+
+#ifdef SAFE_WRITE
+# define safe_rw safe_write
+# define rw write
+#else
+# define safe_rw safe_read
+# define rw read
+# undef const
+# define const /* empty */
+#endif
+
+/* Read(write) up to COUNT bytes at BUF from(to) descriptor FD, retrying if
+   interrupted.  Return the actual number of bytes read(written), zero for EOF,
+   or SAFE_READ_ERROR(SAFE_WRITE_ERROR) upon error.  */
+size_t
+safe_rw (int fd, void const *buf, size_t count)
+{
+  for (;;)
+    {
+      ssize_t result = rw (fd, buf, count);
+
+      if (0 <= result)
+        return result;
+      else if (IS_EINTR (errno))
+        continue;
+      else if (errno == EINVAL && SYS_BUFSIZE_MAX < count)
+        count = SYS_BUFSIZE_MAX;
+      else
+        return result;
+    }
+}
deleted file mode 120000 (symlink)
index d361604a74c56e5350b011f1d1530806a8eaa963..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/safe-read.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..df7acfd479393df4d2e874f9c48fcc743d39d35d
--- /dev/null
@@ -0,0 +1,47 @@
+/* An interface to read() that retries after interrupts.
+   Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Some system calls may be interrupted and fail with errno = EINTR in the
+   following situations:
+     - The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
+       types Ctrl-Z) on some platforms: Mac OS X.
+     - The process receives a signal for which a signal handler was installed
+       with sigaction() with an sa_flags field that does not contain
+       SA_RESTART.
+     - The process receives a signal for which a signal handler was installed
+       with signal() and for which no call to siginterrupt(sig,0) was done,
+       on some platforms: AIX, HP-UX, IRIX, OSF/1, Solaris.
+
+   This module provides a wrapper around read() that handles EINTR.  */
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define SAFE_READ_ERROR ((size_t) -1)
+
+/* Read up to COUNT bytes at BUF from descriptor FD, retrying if interrupted.
+   Return the actual number of bytes read, zero for EOF, or SAFE_READ_ERROR
+   upon error.  */
+extern size_t safe_read (int fd, void *buf, size_t count);
+
+
+#ifdef __cplusplus
+}
+#endif
deleted file mode 120000 (symlink)
index 70239ed1a45f32ccb1d27cab2bee4e4427220212..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/safe-write.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fc1da8c9d34f6908c03bc62ea7645c35f2ec1002
--- /dev/null
@@ -0,0 +1,18 @@
+/* An interface to write that retries after interrupts.
+   Copyright (C) 2002, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define SAFE_WRITE
+#include "safe-read.c"
deleted file mode 120000 (symlink)
index 1b273f2d77ab394a10c3986991d992b12cfac3fc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/safe-write.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c10a9ae45517b1f7fd2084107843d241923b5ff6
--- /dev/null
@@ -0,0 +1,37 @@
+/* An interface to write() that retries after interrupts.
+   Copyright (C) 2002, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Some system calls may be interrupted and fail with errno = EINTR in the
+   following situations:
+     - The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
+       types Ctrl-Z) on some platforms: Mac OS X.
+     - The process receives a signal for which a signal handler was installed
+       with sigaction() with an sa_flags field that does not contain
+       SA_RESTART.
+     - The process receives a signal for which a signal handler was installed
+       with signal() and for which no call to siginterrupt(sig,0) was done,
+       on some platforms: AIX, HP-UX, IRIX, OSF/1, Solaris.
+
+   This module provides a wrapper around write() that handles EINTR.  */
+
+#include <stddef.h>
+
+#define SAFE_WRITE_ERROR ((size_t) -1)
+
+/* Write up to COUNT bytes at BUF to descriptor FD, retrying if interrupted.
+   Return the actual number of bytes written, zero for EOF, or SAFE_WRITE_ERROR
+   upon error.  */
+extern size_t safe_write (int fd, const void *buf, size_t count);
deleted file mode 120000 (symlink)
index f71c6085ad526ee0678bf29c28f5519296f3f86a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/same-inode.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..08c66a258693adf8d444c41bbf3f5fed542ba091
--- /dev/null
@@ -0,0 +1,3 @@
+#include <config.h>
+#define SAME_INODE_INLINE _GL_EXTERN_INLINE
+#include "same-inode.h"
deleted file mode 120000 (symlink)
index efc3f414ccfb7a212d71bb6303baddfb16573cd0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/same-inode.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..62dd088e538e1134365b7992357e696c1ed9a653
--- /dev/null
@@ -0,0 +1,85 @@
+/* Determine whether two stat buffers are known to refer to the same file.
+
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef SAME_INODE_H
+#define SAME_INODE_H 1
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <sys/stat.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef SAME_INODE_INLINE
+# define SAME_INODE_INLINE _GL_INLINE
+#endif
+
+/* True if A and B point to structs with st_dev and st_ino members
+   that are known to represent the same file.
+
+   Use | and ^ to shorten generated code, and to lessen the
+   probability of screwups if st_ino is an array.  */
+
+#if defined __VMS && __CRTL_VER < 80200000
+# define PSAME_INODE(a, b) (! (((a)->st_dev ^ (b)->st_dev) \
+                               | ((a)->st_ino[0] ^ (b)->st_ino[0]) \
+                               | ((a)->st_ino[1] ^ (b)->st_ino[1]) \
+                               | ((a)->st_ino[2] ^ (b)->st_ino[2])))
+#elif defined _WIN32 && ! defined __CYGWIN__
+  /* Native Windows.  */
+# if _GL_WINDOWS_STAT_INODES
+  /* stat() and fstat() set st_dev and st_ino to 0 if information about
+     the inode is not available.  */
+#  if _GL_WINDOWS_STAT_INODES == 2
+#   define PSAME_INODE(a, b) \
+     (! (! ((a)->st_dev | (a)->st_ino._gl_ino[0] | (a)->st_ino._gl_ino[1]) \
+         | ((a)->st_dev ^ (b)->st_dev) \
+         | ((a)->st_ino._gl_ino[0] ^ (b)->st_ino._gl_ino[0]) \
+         | ((a)->st_ino._gl_ino[1] ^ (b)->st_ino._gl_ino[1])))
+#  else
+#   define PSAME_INODE(a, b) (! (! ((a)->st_dev | (a)->st_ino) \
+                                 | ((a)->st_dev ^ (b)->st_dev) \
+                                 | ((a)->st_ino ^ (b)->st_ino)))
+#  endif
+# else
+  /* stat() and fstat() set st_ino to 0 always.  */
+#  define PSAME_INODE(a, b) 0
+# endif
+#else
+  /* POSIX.  */
+# define PSAME_INODE(a, b) (! (((a)->st_dev ^ (b)->st_dev) \
+                               | ((a)->st_ino ^ (b)->st_ino)))
+#endif
+
+/* True if struct objects A and B are known to represent the same file.  */
+
+#define SAME_INODE(a, b) PSAME_INODE (&(a), &(b))
+
+/* True if *A and *B represent the same file.  Unlike PSAME_INODE,
+   args are evaluated once and must point to struct stat.  */
+
+SAME_INODE_INLINE bool
+psame_inode (struct stat const *a, struct stat const *b)
+{
+  return PSAME_INODE (a, b);
+}
+
+_GL_INLINE_HEADER_END
+
+#endif
deleted file mode 120000 (symlink)
index 2fa292ff52753bb7c9853c60bab0248034673ce6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/same.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..929e07d21cae76e5db873acf1e1ae311eebdf7e9
--- /dev/null
@@ -0,0 +1,148 @@
+/* Determine whether two file names refer to the same file.
+
+   Copyright (C) 1997-2000, 2002-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <fcntl.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"
+
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+/* Whether file name components are silently truncated (behavior that
+   POSIX stopped allowing in 2008).  This enables checks whether
+   truncated base names are the same, while checking the directories.  */
+#if !_POSIX_NO_TRUNC && HAVE_FPATHCONF && defined _PC_NAME_MAX
+# define CHECK_TRUNCATION true
+#else
+# define CHECK_TRUNCATION false
+#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)
+{
+  return same_nameat (AT_FDCWD, source, AT_FDCWD, dest);
+}
+
+/* Likewise, but interpret the file names relative to SOURCE_FD and DEST_FD,
+   in the style of openat.  */
+
+bool
+same_nameat (int source_dfd, char const *source,
+             int dest_dfd, char const *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 CHECK_TRUNCATION
+  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;
+
+      /* Compare the parent directories (via the device and inode numbers).  */
+      char *source_dirname = dir_name (source);
+      int flags = AT_SYMLINK_NOFOLLOW;
+      if (fstatat (source_dfd, source_dirname, &source_dir_stats, flags) != 0)
+        {
+          /* Shouldn't happen.  */
+          error (1, errno, "%s", source_dirname);
+        }
+      free (source_dirname);
+
+      char *dest_dirname = dir_name (dest);
+
+#if CHECK_TRUNCATION
+      int destdir_errno = 0;
+      int open_flags = O_SEARCH | O_CLOEXEC | O_DIRECTORY;
+      int destdir_fd = openat (dest_dfd, dest_dirname, open_flags);
+      if (destdir_fd < 0 || fstat (destdir_fd, &dest_dir_stats) != 0)
+        destdir_errno = errno;
+      else if (psame_inode (&source_dir_stats, &dest_dir_stats))
+        {
+          same = identical_basenames;
+          if (! same)
+            {
+              errno = 0;
+              long name_max = fpathconf (destdir_fd, _PC_NAME_MAX);
+              if (name_max < 0)
+                destdir_errno = errno;
+              else
+                same = (name_max <= min_baselen
+                        && (memcmp (source_basename, dest_basename, name_max)
+                            == 0));
+            }
+        }
+      close (destdir_fd);
+      if (destdir_errno != 0)
+        {
+          /* Shouldn't happen.  */
+          error (1, destdir_errno, "%s", dest_dirname);
+        }
+#else
+      if (fstatat (dest_dfd, dest_dirname, &dest_dir_stats, flags) != 0)
+        {
+          /* Shouldn't happen.  */
+          error (1, errno, "%s", dest_dirname);
+        }
+      same = psame_inode (&source_dir_stats, &dest_dir_stats);
+#endif
+
+      free (dest_dirname);
+    }
+
+  return same;
+}
deleted file mode 120000 (symlink)
index 7c4c11df6a2bd3cea6ae29863bf0dfece9a1dc69..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/same.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..efd2433f9695d80b88a3bec4b6deaf94057de3fd
--- /dev/null
@@ -0,0 +1,24 @@
+/* Determine whether two file names refer to the same file.
+
+   Copyright (C) 1997-2000, 2003-2004, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef SAME_H_
+# define SAME_H_ 1
+
+bool same_name (const char *source, const char *dest);
+bool same_nameat (int, char const *, int, char const *);
+
+#endif /* SAME_H_ */
deleted file mode 120000 (symlink)
index 1a617bba6104b590e1f4e57b9d8f7f619be0bf68..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/save-cwd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..47f888c0bbd6695c59051360970c32abebbb152c
--- /dev/null
@@ -0,0 +1,96 @@
+/* save-cwd.c -- Save and restore current working directory.
+
+   Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "save-cwd.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "chdir-long.h"
+#include "unistd--.h"
+
+#if GNULIB_FCNTL_SAFER
+# include "fcntl--.h"
+#else
+# define GNULIB_FCNTL_SAFER 0
+#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 getcwd) 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.  This module works for most cases with just
+   the getcwd-lgpl module, but to be truly robust, use the getcwd module.
+
+   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_SEARCH | O_CLOEXEC);
+  if (!GNULIB_FCNTL_SAFER)
+    cwd->desc = fd_safer_flag (cwd->desc, O_CLOEXEC);
+  if (cwd->desc < 0)
+    {
+      cwd->name = getcwd (NULL, 0);
+      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);
+  free (cwd->name);
+}
deleted file mode 120000 (symlink)
index 7c7d10834ff51c7c31d9ae8c0ddf1f90ad7d368c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/save-cwd.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..692e4b97be2e7ef71072226163119df0af1a2243
--- /dev/null
@@ -0,0 +1,34 @@
+/* Save and restore current working directory.
+
+   Copyright (C) 1995, 1997-1998, 2003, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by 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 */
deleted file mode 120000 (symlink)
index 8c8b8edfdd7c4e39096277c1738a1a38f871a32a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/savedir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ca53bed7368808c74e4638696a86b43f54588cfd
--- /dev/null
@@ -0,0 +1,194 @@
+/* savedir.c -- save the list of files in a directory in a string
+
+   Copyright (C) 1990, 1997-2001, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
+
+#include <config.h>
+
+#include "savedir.h"
+
+#include <sys/types.h>
+
+#include <errno.h>
+
+#include "dirent--.h"
+#ifndef _D_EXACT_NAMLEN
+# define _D_EXACT_NAMLEN(dp)    strlen ((dp)->d_name)
+#endif
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "attribute.h"
+#include "xalloc.h"
+
+typedef struct
+{
+  /* Offset of file name in name_space.  */
+  idx_t name;
+
+#if D_INO_IN_DIRENT
+  /* File inode number.  */
+  ino_t ino;
+#endif
+} direntry_t;
+
+/* Compare the names of two directory entries */
+
+static int
+direntry_cmp_name (void const *a, void const *b, void *arg)
+{
+  direntry_t const *dea = a;
+  direntry_t const *deb = b;
+  char const *name_space = arg;
+
+  return strcmp (name_space + dea->name, name_space + deb->name);
+}
+
+#if D_INO_IN_DIRENT
+/* Compare the inode numbers of two directory entries */
+
+static int
+direntry_cmp_inode (void const *a, void const *b, MAYBE_UNUSED void *arg)
+{
+  direntry_t const *dea = a;
+  direntry_t const *deb = b;
+
+  return _GL_CMP (dea->ino, deb->ino);
+}
+#endif
+
+typedef int (*comparison_function) (void const *, void const *, void *);
+
+static comparison_function const comparison_function_table[] =
+  {
+    0,
+    direntry_cmp_name
+#if D_INO_IN_DIRENT
+    , direntry_cmp_inode
+#endif
+  };
+
+/* Return a freshly allocated string containing the file names
+   in directory DIRP, separated by '\0' characters;
+   the end is marked by two '\0' characters in a row.
+   Returned values are sorted according to OPTION.
+   Return NULL (setting errno) if DIRP cannot be read.
+   If DIRP is NULL, return NULL without affecting errno.  */
+
+char *
+streamsavedir (DIR *dirp, enum savedir_option option)
+{
+  char *name_space = NULL;
+  idx_t allocated = 0;
+  direntry_t *entries = NULL;
+  idx_t entries_allocated = 0;
+  idx_t entries_used = 0;
+  idx_t used = 0;
+  comparison_function cmp = comparison_function_table[option];
+
+  if (dirp == NULL)
+    return NULL;
+
+  for (;;)
+    {
+      struct dirent const *dp;
+      char const *entry;
+
+      errno = 0;
+      dp = readdir (dirp);
+      if (! dp)
+        break;
+
+      /* Skip "", ".", and "..".  "" is returned by at least one buggy
+         implementation: Solaris 2.4 readdir on NFS file systems.  */
+      entry = dp->d_name;
+      if (entry[entry[0] != '.' ? 0 : entry[1] != '.' ? 1 : 2] != '\0')
+        {
+          idx_t entry_size = _D_EXACT_NAMLEN (dp) + 1;
+          if (allocated - used <= entry_size)
+            name_space = xpalloc (name_space, &allocated,
+                                  entry_size - (allocated - used),
+                                  IDX_MAX - 1, sizeof *name_space);
+          memcpy (name_space + used, entry, entry_size);
+          if (cmp)
+            {
+              if (entries_allocated == entries_used)
+                entries = xpalloc (entries, &entries_allocated, 1, -1,
+                                   sizeof *entries);
+              entries[entries_used].name = used;
+#if D_INO_IN_DIRENT
+              entries[entries_used].ino = dp->d_ino;
+#endif
+              entries_used++;
+            }
+          used += entry_size;
+        }
+    }
+
+  if (errno != 0)
+    {
+      free (name_space);
+      name_space = NULL;
+    }
+  else if (cmp)
+    {
+      if (entries_used)
+        qsort_r (entries, entries_used, sizeof *entries, cmp, name_space);
+      char *sorted_name_space = ximalloc (used + 1);
+      char *p = sorted_name_space;
+      for (idx_t i = 0; i < entries_used; i++)
+        p = stpcpy (p, name_space + entries[i].name) + 1;
+      *p = '\0';
+      free (name_space);
+      name_space = sorted_name_space;
+    }
+  else
+    {
+      if (used == allocated)
+        name_space = xirealloc (name_space, used + 1);
+      name_space[used] = '\0';
+    }
+
+  free (entries);
+  return name_space;
+}
+
+/* Return a freshly allocated string containing the file names
+   in directory DIR, separated by '\0' characters;
+   the end is marked by two '\0' characters in a row.
+   Return NULL (setting errno) if DIR cannot be opened, read, or closed.  */
+
+char *
+savedir (char const *dir, enum savedir_option option)
+{
+  DIR *dirp = opendir (dir);
+  if (! dirp)
+    return NULL;
+  else
+    {
+      char *name_space = streamsavedir (dirp, option);
+      if (closedir (dirp) != 0)
+        {
+          free (name_space);
+          return NULL;
+        }
+      return name_space;
+    }
+}
deleted file mode 120000 (symlink)
index d2f213cb66665ec3164a2c455b6cdd6f85f647e8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/savedir.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c292b270f07dd72e329587f3536e30d805719590
--- /dev/null
@@ -0,0 +1,49 @@
+/* Save the list of files in a directory in a string.
+
+   Copyright (C) 1997, 1999, 2001, 2003, 2005, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
+
+#ifndef _GL_SAVEDIR_H
+#define _GL_SAVEDIR_H
+
+/* This file uses _GL_ATTRIBUTE_MALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <dirent.h>
+#include <stdlib.h>
+
+enum savedir_option
+  {
+    SAVEDIR_SORT_NONE,
+    SAVEDIR_SORT_NAME,
+#if D_INO_IN_DIRENT
+    SAVEDIR_SORT_INODE,
+    SAVEDIR_SORT_FASTREAD = SAVEDIR_SORT_INODE
+#else
+    SAVEDIR_SORT_FASTREAD = SAVEDIR_SORT_NONE
+#endif
+  };
+
+char *streamsavedir (DIR *, enum savedir_option)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+char *savedir (char const *, enum savedir_option)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+
+#endif
deleted file mode 120000 (symlink)
index 93239b640a7cad4852365e22f1828903b0b85a06..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/savewd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..57692c0b3d9166b585d0b65068eefdb16c522d14
--- /dev/null
@@ -0,0 +1,307 @@
+/* Save and restore the working directory, possibly using a child process.
+
+   Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#define SAVEWD_INLINE _GL_EXTERN_INLINE
+
+#include "savewd.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include "assure.h"
+#include "attribute.h"
+#include "fcntl-safer.h"
+#include "filename.h"
+
+/* Save the working directory into *WD, if it hasn't been saved
+   already.  Return true if a child has been forked to do the real
+   work.  */
+static bool
+savewd_save (struct savewd *wd)
+{
+  switch (wd->state)
+    {
+    case INITIAL_STATE:
+      /* Save the working directory, or prepare to fall back if possible.  */
+      {
+        int fd = open_safer (".", O_SEARCH);
+        if (0 <= fd)
+          {
+            wd->state = FD_STATE;
+            wd->val.fd = fd;
+            break;
+          }
+        if (errno != EACCES && errno != ESTALE)
+          {
+            wd->state = ERROR_STATE;
+            wd->val.errnum = errno;
+            break;
+          }
+      }
+      wd->state = FORKING_STATE;
+      wd->val.child = -1;
+      FALLTHROUGH;
+    case FORKING_STATE:
+      if (wd->val.child < 0)
+        {
+          /* "Save" the initial working directory by forking a new
+             subprocess that will attempt all the work from the chdir
+             until the next savewd_restore.  */
+          wd->val.child = fork ();
+          if (wd->val.child != 0)
+            {
+              if (0 < wd->val.child)
+                return true;
+              wd->state = ERROR_STATE;
+              wd->val.errnum = errno;
+            }
+        }
+      break;
+
+    case FD_STATE:
+    case FD_POST_CHDIR_STATE:
+    case ERROR_STATE:
+    case FINAL_STATE:
+      break;
+
+    default:
+      assure (false);
+    }
+
+  return false;
+}
+
+int
+savewd_chdir (struct savewd *wd, char const *dir, int options,
+              int open_result[2])
+{
+  int fd = -1;
+  int result = 0;
+
+  /* Open the directory if requested, or if avoiding a race condition
+     is requested and possible.  */
+  if (open_result
+      || (options & (HAVE_WORKING_O_NOFOLLOW ? SAVEWD_CHDIR_NOFOLLOW : 0)))
+    {
+      fd = open (dir,
+                 (O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
+                  | (options & SAVEWD_CHDIR_NOFOLLOW ? O_NOFOLLOW : 0)));
+
+      if (open_result)
+        {
+          open_result[0] = fd;
+          open_result[1] = errno;
+        }
+
+      if (fd < 0 && errno != EACCES)
+        result = -1;
+    }
+
+  if (result == 0 && ! (0 <= fd && options & SAVEWD_CHDIR_SKIP_READABLE))
+    {
+      if (savewd_save (wd))
+        {
+          open_result = NULL;
+          result = -2;
+        }
+      else
+        {
+          result = (fd < 0 ? chdir (dir) : fchdir (fd));
+
+          if (result == 0)
+            switch (wd->state)
+              {
+              case FD_STATE:
+                wd->state = FD_POST_CHDIR_STATE;
+                break;
+
+              case ERROR_STATE:
+              case FD_POST_CHDIR_STATE:
+              case FINAL_STATE:
+                break;
+
+              case FORKING_STATE:
+                assure (wd->val.child == 0);
+                break;
+
+              default:
+                assure (false);
+              }
+        }
+    }
+
+  if (0 <= fd && ! open_result)
+    {
+      int e = errno;
+      close (fd);
+      errno = e;
+    }
+
+  return result;
+}
+
+int
+savewd_restore (struct savewd *wd, int status)
+{
+  switch (wd->state)
+    {
+    case INITIAL_STATE:
+    case FD_STATE:
+      /* The working directory is the desired directory, so there's no
+         work to do.  */
+      break;
+
+    case FD_POST_CHDIR_STATE:
+      /* Restore the working directory using fchdir.  */
+      if (fchdir (wd->val.fd) == 0)
+        {
+          wd->state = FD_STATE;
+          break;
+        }
+      else
+        {
+          int chdir_errno = errno;
+          close (wd->val.fd);
+          wd->state = ERROR_STATE;
+          wd->val.errnum = chdir_errno;
+        }
+      FALLTHROUGH;
+    case ERROR_STATE:
+      /* Report an error if asked to restore the working directory.  */
+      errno = wd->val.errnum;
+      return -1;
+
+    case FORKING_STATE:
+      /* "Restore" the working directory by waiting for the subprocess
+         to finish.  */
+      {
+        pid_t child = wd->val.child;
+        if (child == 0)
+          _exit (status);
+        if (0 < child)
+          {
+            int child_status;
+            while (waitpid (child, &child_status, 0) < 0)
+              assure (errno == EINTR);
+            wd->val.child = -1;
+            if (! WIFEXITED (child_status))
+              raise (WTERMSIG (child_status));
+            return WEXITSTATUS (child_status);
+          }
+      }
+      break;
+
+    default:
+      assure (false);
+    }
+
+  return 0;
+}
+
+void
+savewd_finish (struct savewd *wd)
+{
+  switch (wd->state)
+    {
+    case INITIAL_STATE:
+    case ERROR_STATE:
+      break;
+
+    case FD_STATE:
+    case FD_POST_CHDIR_STATE:
+      close (wd->val.fd);
+      break;
+
+    case FORKING_STATE:
+      assure (wd->val.child < 0);
+      break;
+
+    default:
+      assure (false);
+    }
+
+  wd->state = FINAL_STATE;
+}
+
+/* Return true if the actual work is currently being done by a
+   subprocess.
+
+   A true return means that the caller and the subprocess should
+   resynchronize later with savewd_restore, using only their own
+   memory to decide when to resynchronize; they should not consult the
+   file system to decide, because that might lead to race conditions.
+   This is why savewd_chdir is broken out into another function;
+   savewd_chdir's callers _can_ inspect the file system to decide
+   whether to call savewd_chdir.  */
+static bool
+savewd_delegating (struct savewd const *wd)
+{
+  return wd->state == FORKING_STATE && 0 < wd->val.child;
+}
+
+int
+savewd_process_files (int n_files, char **file,
+                      int (*act) (char *, struct savewd *, void *),
+                      void *options)
+{
+  int i = 0;
+  int last_relative;
+  int exit_status = EXIT_SUCCESS;
+  struct savewd wd;
+  savewd_init (&wd);
+
+  for (last_relative = n_files - 1; 0 <= last_relative; last_relative--)
+    if (! IS_ABSOLUTE_FILE_NAME (file[last_relative]))
+      break;
+
+  for (; i < last_relative; i++)
+    {
+      if (! savewd_delegating (&wd))
+        {
+          int s = act (file[i], &wd, options);
+          if (exit_status < s)
+            exit_status = s;
+        }
+
+      if (! IS_ABSOLUTE_FILE_NAME (file[i + 1]))
+        {
+          int r = savewd_restore (&wd, exit_status);
+          if (exit_status < r)
+            exit_status = r;
+        }
+    }
+
+  savewd_finish (&wd);
+
+  for (; i < n_files; i++)
+    {
+      int s = act (file[i], &wd, options);
+      if (exit_status < s)
+        exit_status = s;
+    }
+
+  return exit_status;
+}
deleted file mode 120000 (symlink)
index 0915b540f548648b2815f90340b243f42be2ec3b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/savewd.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b79fcec3eb495b5d213a39ab00a1509b6183e8ae
--- /dev/null
@@ -0,0 +1,154 @@
+/* Save and restore the working directory, possibly using a subprocess.
+
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef SAVEWD_H
+#define SAVEWD_H 1
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <sys/types.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef SAVEWD_INLINE
+# define SAVEWD_INLINE _GL_INLINE
+#endif
+
+/* A saved working directory.  The member names and constants defined
+   by this structure are private to the savewd module.  */
+struct savewd
+{
+  /* The state of this object.  */
+  enum
+    {
+      /* This object has been created but does not yet represent
+         the working directory.  */
+      INITIAL_STATE,
+
+      /* val.fd is the original working directory's file descriptor.
+         It is still the working directory.  */
+      FD_STATE,
+
+      /* Like FD_STATE, but the working directory has changed, so
+         restoring it will require a fchdir.  */
+      FD_POST_CHDIR_STATE,
+
+      /* Fork and let the subprocess do the work.  val.child is 0 in a
+         child, negative in a childless parent, and the child process
+         ID in a parent with a child.  */
+      FORKING_STATE,
+
+      /* A serious problem argues against further efforts.  val.errnum
+         contains the error number (e.g., EIO).  */
+      ERROR_STATE,
+
+      /* savewd_finish has been called, so the application no longer
+         cares whether the working directory is saved, and there is no
+         more work to do.  */
+      FINAL_STATE
+    } state;
+
+  /* The object's value.  */
+  union
+  {
+    int fd;
+    int errnum;
+    pid_t child;
+  } val;
+};
+
+/* Initialize a saved working directory object.  */
+SAVEWD_INLINE void
+savewd_init (struct savewd *wd)
+{
+  wd->state = INITIAL_STATE;
+}
+
+
+/* Options for savewd_chdir.  Can be ORed together.  */
+enum
+  {
+    /* Do not follow symbolic links, if supported.  */
+    SAVEWD_CHDIR_NOFOLLOW = 1,
+
+    /* Do not chdir if the directory is readable; simply succeed
+       without invoking chdir if the directory was opened.  */
+    SAVEWD_CHDIR_SKIP_READABLE = 2
+  };
+
+/* Change the directory, and if successful, record into *WD the fact
+   that the process chdired into DIR.  A process using this module
+   should use savewd_chdir rather than chdir or fchdir.  Obey the
+   options specified in OPTIONS.
+
+   If OPEN_RESULT is not null, store into OPEN_RESULT[0] a file
+   descriptor that accesses DIR if a file descriptor is successfully
+   obtained.  Store -1 otherwise, setting OPEN_RESULT[1] to the error
+   number.  Store through OPEN_RESULT regardless of whether the chdir
+   is successful.  However, when -2 is returned, the contents of
+   OPEN_RESULT are indeterminate since the file descriptor is closed
+   in the parent.
+
+   Return -2 if a subprocess was spun off to do the real work, -1
+   (setting errno) if unsuccessful, 0 if successful.  */
+int savewd_chdir (struct savewd *wd, char const *dir, int options,
+                  int open_result[2]);
+
+/* Restore the working directory from *WD.  STATUS indicates the exit
+   status corresponding to the work done since the last save; this is
+   used when the caller is in a subprocess.  Return 0 if successful,
+   -1 (setting errno) on our failure, a positive subprocess exit
+   status if the working directory was restored in the parent but the
+   subprocess failed.  */
+int savewd_restore (struct savewd *wd, int status);
+
+/* Return WD's error number, or 0 if WD is not in an error state.  */
+SAVEWD_INLINE int _GL_ATTRIBUTE_PURE
+savewd_errno (struct savewd const *wd)
+{
+  return (wd->state == ERROR_STATE ? wd->val.errnum : 0);
+}
+
+/* Deallocate any resources associated with WD.  A program that chdirs
+   should restore before finishing.  */
+void savewd_finish (struct savewd *wd);
+
+/* Process N_FILES file names, FILE[0] through FILE[N_FILES - 1].
+   For each file name F, call ACT (F, WD, OPTIONS); ACT should invoke
+   savewd_chdir as needed, and should return an exit status.  WD
+   represents the working directory; it may be in an error state when
+   ACT is called.
+
+   Save and restore the working directory as needed by the file name
+   vector; assume that ACT does not require access to any relative
+   file names other than its first argument, and that it is OK if the
+   working directory is changed when this function returns.  Some
+   actions may be applied in a subprocess.
+
+   Return the maximum exit status that any call to ACT returned, or
+   EXIT_SUCCESS (i.e., 0) if no calls were made.  */
+int savewd_process_files (int n_files, char **file,
+                          int (*act) (char *, struct savewd *, void *),
+                          void *options);
+
+_GL_INLINE_HEADER_END
+
+#endif
deleted file mode 120000 (symlink)
index 767c670a41368bd19cc078e811ba84c6ba071a8d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sched.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..838fb12bdc5a399ba59e4e71e485c5cc4182242f
--- /dev/null
@@ -0,0 +1,111 @@
+/* A GNU-like <sched.h>.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_SCHED_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* This file uses #include_next of a system file that defines time_t.
+   For the 'year2038' module to work right, <config.h> needs to have been
+   included before.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_SCHED_H@
+# if @HAVE_SYS_CDEFS_H@
+#  include <sys/cdefs.h>
+# endif
+# @INCLUDE_NEXT@ @NEXT_SCHED_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_SCHED_H
+#define _@GUARD_PREFIX@_SCHED_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get pid_t.
+   This is needed on glibc 2.11 (see
+   glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=13198>)
+   and Mac OS X 10.5.  */
+#include <sys/types.h>
+
+#ifdef __KLIBC__
+/* On OS/2 kLIBC, struct sched_param is in spawn.h.  */
+# include <spawn.h>
+#endif
+
+#ifdef __VMS
+/* On OpenVMS, struct sched_param is in <pthread.h>.  */
+# include <pthread.h>
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+#if !@HAVE_STRUCT_SCHED_PARAM@
+
+# if !GNULIB_defined_struct_sched_param
+struct sched_param
+{
+  int sched_priority;
+};
+#  define GNULIB_defined_struct_sched_param 1
+# endif
+
+#endif
+
+#if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER)
+# define SCHED_FIFO   1
+# define SCHED_RR     2
+# define SCHED_OTHER  0
+#endif
+
+#if @GNULIB_SCHED_YIELD@
+# if @REPLACE_SCHED_YIELD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sched_yield
+#   define sched_yield rpl_sched_yield
+#  endif
+_GL_FUNCDECL_RPL (sched_yield, int, (void));
+_GL_CXXALIAS_RPL (sched_yield, int, (void));
+# else
+#  if !@HAVE_SCHED_YIELD@
+_GL_FUNCDECL_SYS (sched_yield, int, (void));
+#  endif
+_GL_CXXALIAS_SYS (sched_yield, int, (void));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (sched_yield);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sched_yield
+# if HAVE_RAW_DECL_SCHED_YIELD
+_GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - "
+                 "use gnulib module sched_yield for portability");
+# endif
+#endif
+
+#endif /* _@GUARD_PREFIX@_SCHED_H */
+#endif /* _@GUARD_PREFIX@_SCHED_H */
deleted file mode 120000 (symlink)
index 78ac830ade6e84be4f39aba475b459832e74478d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/scratch_buffer.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4f28203a46932d3b91ef2680f3422098ffe996cb
--- /dev/null
@@ -0,0 +1,117 @@
+/* Variable-sized buffer with on-stack default allocation.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, 2017.  */
+
+#ifndef _GL_SCRATCH_BUFFER_H
+#define _GL_SCRATCH_BUFFER_H
+
+/* Scratch buffers with a default stack allocation and fallback to
+   heap allocation.  It is expected that this function is used in this
+   way:
+
+     struct scratch_buffer tmpbuf;
+     scratch_buffer_init (&tmpbuf);
+
+     while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length))
+       if (!scratch_buffer_grow (&tmpbuf))
+         return -1;
+
+     scratch_buffer_free (&tmpbuf);
+     return 0;
+
+   The allocation functions (scratch_buffer_grow,
+   scratch_buffer_grow_preserve, scratch_buffer_set_array_size) make
+   sure that the heap allocation, if any, is freed, so that the code
+   above does not have a memory leak.  The buffer still remains in a
+   state that can be deallocated using scratch_buffer_free, so a loop
+   like this is valid as well:
+
+     struct scratch_buffer tmpbuf;
+     scratch_buffer_init (&tmpbuf);
+
+     while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length))
+       if (!scratch_buffer_grow (&tmpbuf))
+         break;
+
+     scratch_buffer_free (&tmpbuf);
+
+   scratch_buffer_grow and scratch_buffer_grow_preserve are guaranteed
+   to grow the buffer by at least 512 bytes.  This means that when
+   using the scratch buffer as a backing store for a non-character
+   array whose element size, in bytes, is 512 or smaller, the scratch
+   buffer only has to grow once to make room for at least one more
+   element.
+*/
+
+/* Scratch buffer.  Must be initialized with scratch_buffer_init
+   before its use.  */
+struct scratch_buffer;
+
+/* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space
+   and BUFFER->length reflects the available space.  */
+#if 0
+extern void scratch_buffer_init (struct scratch_buffer *buffer);
+#endif
+
+/* Deallocates *BUFFER (if it was heap-allocated).  */
+#if 0
+extern void scratch_buffer_free (struct scratch_buffer *buffer);
+#endif
+
+/* Grow *BUFFER by some arbitrary amount.  The buffer contents is NOT
+   preserved.  Return true on success, false on allocation failure (in
+   which case the old buffer is freed).  On success, the new buffer is
+   larger than the previous size.  On failure, *BUFFER is deallocated,
+   but remains in a free-able state, and errno is set.  */
+#if 0
+extern bool scratch_buffer_grow (struct scratch_buffer *buffer);
+#endif
+
+/* Like scratch_buffer_grow, but preserve the old buffer
+   contents on success, as a prefix of the new buffer.  */
+#if 0
+extern bool scratch_buffer_grow_preserve (struct scratch_buffer *buffer);
+#endif
+
+/* Grow *BUFFER so that it can store at least NELEM elements of SIZE
+   bytes.  The buffer contents are NOT preserved.  Both NELEM and SIZE
+   can be zero.  Return true on success, false on allocation failure
+   (in which case the old buffer is freed, but *BUFFER remains in a
+   free-able state, and errno is set).  It is unspecified whether this
+   function can reduce the array size.  */
+#if 0
+extern bool scratch_buffer_set_array_size (struct scratch_buffer *buffer,
+                                           size_t nelem, size_t size);
+#endif
+
+
+/* The implementation is imported from glibc.  */
+
+/* Avoid possible conflicts with symbols exported by the GNU libc.  */
+#define __libc_scratch_buffer_grow gl_scratch_buffer_grow
+#define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve
+#define __libc_scratch_buffer_set_array_size gl_scratch_buffer_set_array_size
+
+#ifndef _GL_LIKELY
+/* Rely on __builtin_expect, as provided by the module 'builtin-expect'.  */
+# define _GL_LIKELY(cond) __builtin_expect ((cond), 1)
+# define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0)
+#endif
+
+#include <malloc/scratch_buffer.gl.h>
+
+#endif /* _GL_SCRATCH_BUFFER_H */
deleted file mode 120000 (symlink)
index 3ce67bac3c73df6847a56ea6090f7fadde4a2458..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/se-context.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bc5ca927649778ccd1beb0d7323fb2ff4ae3fd16
--- /dev/null
@@ -0,0 +1,21 @@
+/* Replacements for <selinux/context.h> functions.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define SE_CONTEXT_INLINE _GL_EXTERN_INLINE
+#include <selinux/context.h>
deleted file mode 120000 (symlink)
index 16061bc4ed7cd1dd5ed7a12791562871ea759c26..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/se-context.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..689df0be7ce65384ab30d76a970f4fa123fb909e
--- /dev/null
@@ -0,0 +1,88 @@
+/* SELinux-related headers.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering, 2007.  */
+
+#ifndef SELINUX_CONTEXT_H
+#define SELINUX_CONTEXT_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
+   _GL_ATTRIBUTE_MAYBE_UNUSED.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <errno.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef SE_CONTEXT_INLINE
+# define SE_CONTEXT_INLINE _GL_INLINE
+#endif
+
+/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
+   the entity is not used.  The compiler should not warn if the entity is not
+   used.  */
+#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+# if 0 /* no GCC or clang version supports this yet */
+#  define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+# elif defined __GNUC__ || defined __clang__
+#  define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
+# else
+#  define _GL_ATTRIBUTE_MAYBE_UNUSED
+# endif
+#endif
+
+typedef int context_t;
+SE_CONTEXT_INLINE context_t
+context_new (_GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
+  { errno = ENOTSUP; return 0; }
+SE_CONTEXT_INLINE char *
+context_str (_GL_ATTRIBUTE_MAYBE_UNUSED context_t con)
+  { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE void context_free (_GL_ATTRIBUTE_MAYBE_UNUSED context_t c) {}
+
+SE_CONTEXT_INLINE int
+context_user_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
+                  _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
+  { errno = ENOTSUP; return -1; }
+SE_CONTEXT_INLINE int
+context_role_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
+                  _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
+  { errno = ENOTSUP; return -1; }
+SE_CONTEXT_INLINE int
+context_range_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
+                   _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
+  { errno = ENOTSUP; return -1; }
+SE_CONTEXT_INLINE int
+context_type_set (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc,
+                  _GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
+  { errno = ENOTSUP; return -1; }
+SE_CONTEXT_INLINE char *
+context_type_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
+  { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE char *
+context_range_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
+  { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE char *
+context_role_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
+  { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE char *
+context_user_get (_GL_ATTRIBUTE_MAYBE_UNUSED context_t sc)
+  { errno = ENOTSUP; return (void *) 0; }
+
+_GL_INLINE_HEADER_END
+
+#endif
deleted file mode 120000 (symlink)
index 088bdfdf9b88fe6cdc75c1995a0e0ba2cb8cd0c5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/se-label.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9ba5f24f0de1ef369bce17d1a32711a505efed25
--- /dev/null
@@ -0,0 +1,21 @@
+/* Replacements for <selinux/label.h> functions.
+
+   Copyright 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define SE_LABEL_INLINE _GL_EXTERN_INLINE
+#include <selinux/label.h>
deleted file mode 120000 (symlink)
index dc69f198f1b262820f810a3dfa116b96907eb07d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/se-label.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ce1ac335e17a7bf0f79822598019a66957f19584
--- /dev/null
@@ -0,0 +1,79 @@
+/* Replacement <selinux/label.h> for platforms that lack it.
+   Copyright 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef SELINUX_LABEL_H
+#define SELINUX_LABEL_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
+   _GL_ATTRIBUTE_MAYBE_UNUSED.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <selinux/selinux.h>
+#include <errno.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef SE_LABEL_INLINE
+# define SE_LABEL_INLINE _GL_INLINE
+#endif
+
+/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
+   the entity is not used.  The compiler should not warn if the entity is not
+   used.  */
+#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+# if 0 /* no GCC or clang version supports this yet */
+#  define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+# elif defined __GNUC__ || defined __clang__
+#  define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
+# else
+#  define _GL_ATTRIBUTE_MAYBE_UNUSED
+# endif
+#endif
+
+#define SELABEL_CTX_FILE 0
+
+struct selabel_handle;
+
+SE_LABEL_INLINE int
+selabel_lookup (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd,
+                _GL_ATTRIBUTE_MAYBE_UNUSED char **context,
+                _GL_ATTRIBUTE_MAYBE_UNUSED char const *key,
+                _GL_ATTRIBUTE_MAYBE_UNUSED int type)
+{ errno = ENOTSUP; return -1; }
+
+SE_LABEL_INLINE int
+selabel_lookup_raw (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd,
+                    _GL_ATTRIBUTE_MAYBE_UNUSED char **context,
+                    _GL_ATTRIBUTE_MAYBE_UNUSED char const *key,
+                    _GL_ATTRIBUTE_MAYBE_UNUSED int type)
+{ errno = ENOTSUP; return -1; }
+
+SE_LABEL_INLINE struct selabel_handle *
+selabel_open (_GL_ATTRIBUTE_MAYBE_UNUSED int backend,
+              _GL_ATTRIBUTE_MAYBE_UNUSED struct selinux_opt *options,
+              _GL_ATTRIBUTE_MAYBE_UNUSED unsigned nopt)
+{ errno = ENOTSUP; return 0; }
+
+SE_LABEL_INLINE void
+selabel_close (_GL_ATTRIBUTE_MAYBE_UNUSED struct selabel_handle *hnd)
+{ errno = ENOTSUP; }
+
+_GL_INLINE_HEADER_END
+
+#endif
deleted file mode 120000 (symlink)
index cdcfaa0896adc516861595610727445a9a925737..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/se-selinux.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b704bf0c7b92bfa5d9787124b259c0bca2b29f90
--- /dev/null
@@ -0,0 +1,21 @@
+/* Replacements for <selinux/selinux.h> functions.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define SE_SELINUX_INLINE _GL_EXTERN_INLINE
+#include <selinux/selinux.h>
deleted file mode 120000 (symlink)
index cfd32df39885cc3dcff3f102b4682bbf6b59eb4b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/se-selinux.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..76d3762fd473644e25715bf84a056912598ba6d4
--- /dev/null
@@ -0,0 +1,174 @@
+/* Replacement <selinux/selinux.h> for platforms that lack it.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if @HAVE_SELINUX_SELINUX_H@
+
+#@INCLUDE_NEXT@ @NEXT_SELINUX_SELINUX_H@
+
+#else
+# if !defined _@GUARD_PREFIX@_SELINUX_SELINUX_H
+#  define _@GUARD_PREFIX@_SELINUX_SELINUX_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
+   _GL_ATTRIBUTE_MAYBE_UNUSED.  */
+#  if !_GL_CONFIG_H_INCLUDED
+#   error "Please include config.h first."
+#  endif
+
+#  include <sys/types.h>
+#  include <errno.h>
+
+_GL_INLINE_HEADER_BEGIN
+#  ifndef SE_SELINUX_INLINE
+#   define SE_SELINUX_INLINE _GL_INLINE
+#  endif
+
+/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
+   the entity is not used.  The compiler should not warn if the entity is not
+   used.  */
+#  ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+#   if 0 /* no GCC or clang version supports this yet */
+#    define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+#   elif defined __GNUC__ || defined __clang__
+#    define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
+#   else
+#    define _GL_ATTRIBUTE_MAYBE_UNUSED
+#   endif
+#  endif
+
+#  if !GNULIB_defined_security_types
+
+typedef unsigned short security_class_t;
+struct selinux_opt;
+#   define is_selinux_enabled() 0
+
+SE_SELINUX_INLINE int
+getcon (_GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+getcon_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE void
+freecon (_GL_ATTRIBUTE_MAYBE_UNUSED char *con) {}
+
+SE_SELINUX_INLINE int
+getfscreatecon (_GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+getfscreatecon_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+setfscreatecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+setfscreatecon_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+matchpathcon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+              _GL_ATTRIBUTE_MAYBE_UNUSED mode_t m,
+              _GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+getfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+            _GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+getfilecon_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+                _GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+lgetfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+             _GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+lgetfilecon_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+                 _GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+fgetfilecon (int fd,_GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+fgetfilecon_raw (int fd,_GL_ATTRIBUTE_MAYBE_UNUSED char **con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+setfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+            _GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+setfilecon_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+                _GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+lsetfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+             _GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+lsetfilecon_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *file,
+                 _GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+fsetfilecon (_GL_ATTRIBUTE_MAYBE_UNUSED int fd,
+             _GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+fsetfilecon_raw (_GL_ATTRIBUTE_MAYBE_UNUSED int fd,
+                 _GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+
+SE_SELINUX_INLINE int
+security_check_context (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+security_check_context_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+setexeccon (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+setexeccon_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *con)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+security_compute_create (_GL_ATTRIBUTE_MAYBE_UNUSED char const *scon,
+                         _GL_ATTRIBUTE_MAYBE_UNUSED char const *tcon,
+                         _GL_ATTRIBUTE_MAYBE_UNUSED security_class_t tclass,
+                         _GL_ATTRIBUTE_MAYBE_UNUSED char **newcon)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE int
+security_compute_create_raw (_GL_ATTRIBUTE_MAYBE_UNUSED char const *scon,
+                             _GL_ATTRIBUTE_MAYBE_UNUSED char const *tcon,
+                             _GL_ATTRIBUTE_MAYBE_UNUSED security_class_t tclass,
+                             _GL_ATTRIBUTE_MAYBE_UNUSED char **newcon)
+  { errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE security_class_t
+string_to_security_class (char const *name)
+  { errno = ENOTSUP; return 0; }
+SE_SELINUX_INLINE int
+matchpathcon_init_prefix (_GL_ATTRIBUTE_MAYBE_UNUSED char const *path,
+                          _GL_ATTRIBUTE_MAYBE_UNUSED char const *prefix)
+  { errno = ENOTSUP; return -1; }
+
+#   define GNULIB_defined_security_types 1
+#  endif
+
+_GL_INLINE_HEADER_END
+
+# endif /* _@GUARD_PREFIX@_SELINUX_SELINUX_H */
+#endif
deleted file mode 120000 (symlink)
index 116ff562a68228dab79858d0442f54877c875438..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/secure_getenv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1ee98bffe4a1c2844e604e27f6226008db285331
--- /dev/null
@@ -0,0 +1,54 @@
+/* Look up an environment variable, returning NULL in insecure situations.
+
+   Copyright 2013-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#if !HAVE___SECURE_GETENV
+# if HAVE_ISSETUGID || (HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID)
+#  include <unistd.h>
+# endif
+#endif
+
+char *
+secure_getenv (char const *name)
+{
+#if HAVE___SECURE_GETENV /* glibc */
+  return __secure_getenv (name);
+#elif HAVE_ISSETUGID /* musl, OS X, FreeBSD, NetBSD, OpenBSD, Solaris, Minix */
+  if (issetugid ())
+    return NULL;
+  return getenv (name);
+#elif HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID /* other Unix */
+  if (geteuid () != getuid () || getegid () != getgid ())
+    return NULL;
+  return getenv (name);
+#elif defined _WIN32 && ! defined __CYGWIN__ /* native Windows */
+  /* On native Windows, there is no such concept as setuid or setgid binaries.
+     - Programs launched as system services have high privileges, but they don't
+       inherit environment variables from a user.
+     - Programs launched by a user with "Run as Administrator" have high
+       privileges and use the environment variables, but the user has been asked
+       whether he agrees.
+     - Programs launched by a user without "Run as Administrator" cannot gain
+       high privileges, therefore there is no risk. */
+  return getenv (name);
+#else
+  return NULL;
+#endif
+}
deleted file mode 120000 (symlink)
index 61fca586c8eea6047afe1370c70a703dd83968f5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/select.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5f7a5d007dc7fcc8da7ed497bd16fa8d48e008b8
--- /dev/null
@@ -0,0 +1,601 @@
+/* Emulation for select(2)
+   Contributed by Paolo Bonzini.
+
+   Copyright 2008-2024 Free Software Foundation, Inc.
+
+   This file is part of gnulib.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/select.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Native Windows.  */
+
+#include <alloca.h>
+#include <assert.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <limits.h>
+
+#include <winsock2.h>
+#include <windows.h>
+#include <io.h>
+#include <stdio.h>
+#include <conio.h>
+#include <time.h>
+
+/* Get the overridden 'struct timeval'.  */
+#include <sys/time.h>
+
+#if GNULIB_MSVC_NOTHROW
+# include "msvc-nothrow.h"
+#else
+# include <io.h>
+#endif
+
+#undef select
+
+/* Don't assume that UNICODE is not defined.  */
+#undef GetModuleHandle
+#define GetModuleHandle GetModuleHandleA
+#undef PeekConsoleInput
+#define PeekConsoleInput PeekConsoleInputA
+#undef CreateEvent
+#define CreateEvent CreateEventA
+#undef PeekMessage
+#define PeekMessage PeekMessageA
+#undef DispatchMessage
+#define DispatchMessage DispatchMessageA
+
+/* Avoid warnings from gcc -Wcast-function-type.  */
+#define GetProcAddress \
+  (void *) GetProcAddress
+
+struct bitset {
+  unsigned char in[FD_SETSIZE / CHAR_BIT];
+  unsigned char out[FD_SETSIZE / CHAR_BIT];
+};
+
+/* Declare data structures for ntdll functions.  */
+typedef struct _FILE_PIPE_LOCAL_INFORMATION {
+  ULONG NamedPipeType;
+  ULONG NamedPipeConfiguration;
+  ULONG MaximumInstances;
+  ULONG CurrentInstances;
+  ULONG InboundQuota;
+  ULONG ReadDataAvailable;
+  ULONG OutboundQuota;
+  ULONG WriteQuotaAvailable;
+  ULONG NamedPipeState;
+  ULONG NamedPipeEnd;
+} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
+
+typedef struct _IO_STATUS_BLOCK
+{
+  union {
+    DWORD Status;
+    PVOID Pointer;
+  } u;
+  ULONG_PTR Information;
+} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
+
+typedef enum _FILE_INFORMATION_CLASS {
+  FilePipeLocalInformation = 24
+} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
+
+typedef DWORD (WINAPI *PNtQueryInformationFile)
+         (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
+
+#ifndef PIPE_BUF
+#define PIPE_BUF        512
+#endif
+
+static BOOL IsConsoleHandle (HANDLE h)
+{
+  DWORD mode;
+  return GetConsoleMode (h, &mode) != 0;
+}
+
+static BOOL
+IsSocketHandle (HANDLE h)
+{
+  WSANETWORKEVENTS ev;
+
+  if (IsConsoleHandle (h))
+    return FALSE;
+
+  /* Under Wine, it seems that getsockopt returns 0 for pipes too.
+     WSAEnumNetworkEvents instead distinguishes the two correctly.  */
+  ev.lNetworkEvents = 0xDEADBEEF;
+  WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev);
+  return ev.lNetworkEvents != 0xDEADBEEF;
+}
+
+/* Compute output fd_sets for libc descriptor FD (whose Windows handle is
+   H).  */
+
+static int
+windows_poll_handle (HANDLE h, int fd,
+                     struct bitset *rbits,
+                     struct bitset *wbits,
+                     struct bitset *xbits)
+{
+  BOOL read, write, except;
+  int i, ret;
+  INPUT_RECORD *irbuffer;
+  DWORD avail, nbuffer;
+  BOOL bRet;
+  IO_STATUS_BLOCK iosb;
+  FILE_PIPE_LOCAL_INFORMATION fpli;
+  static PNtQueryInformationFile NtQueryInformationFile;
+  static BOOL once_only;
+
+  read = write = except = FALSE;
+  switch (GetFileType (h))
+    {
+    case FILE_TYPE_DISK:
+      read = TRUE;
+      write = TRUE;
+      break;
+
+    case FILE_TYPE_PIPE:
+      if (!once_only)
+        {
+          NtQueryInformationFile = (PNtQueryInformationFile)
+            GetProcAddress (GetModuleHandle ("ntdll.dll"),
+                            "NtQueryInformationFile");
+          once_only = TRUE;
+        }
+
+      if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0)
+        {
+          if (avail)
+            read = TRUE;
+        }
+      else if (GetLastError () == ERROR_BROKEN_PIPE)
+        ;
+
+      else
+        {
+          /* It was the write-end of the pipe.  Check if it is writable.
+             If NtQueryInformationFile fails, optimistically assume the pipe is
+             writable.  This could happen on Windows 9x, where
+             NtQueryInformationFile is not available, or if we inherit a pipe
+             that doesn't permit FILE_READ_ATTRIBUTES access on the write end
+             (I think this should not happen since Windows XP SP2; WINE seems
+             fine too).  Otherwise, ensure that enough space is available for
+             atomic writes.  */
+          memset (&iosb, 0, sizeof (iosb));
+          memset (&fpli, 0, sizeof (fpli));
+
+          if (!NtQueryInformationFile
+              || NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
+                                         FilePipeLocalInformation)
+              || fpli.WriteQuotaAvailable >= PIPE_BUF
+              || (fpli.OutboundQuota < PIPE_BUF &&
+                  fpli.WriteQuotaAvailable == fpli.OutboundQuota))
+            write = TRUE;
+        }
+      break;
+
+    case FILE_TYPE_CHAR:
+      write = TRUE;
+      if (!(rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
+        break;
+
+      ret = WaitForSingleObject (h, 0);
+      if (ret == WAIT_OBJECT_0)
+        {
+          if (!IsConsoleHandle (h))
+            {
+              read = TRUE;
+              break;
+            }
+
+          nbuffer = avail = 0;
+          bRet = GetNumberOfConsoleInputEvents (h, &nbuffer);
+
+          /* Screen buffers handles are filtered earlier.  */
+          assert (bRet);
+          if (nbuffer == 0)
+            {
+              except = TRUE;
+              break;
+            }
+
+          irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
+          bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
+          if (!bRet || avail == 0)
+            {
+              except = TRUE;
+              break;
+            }
+
+          for (i = 0; i < avail; i++)
+            if (irbuffer[i].EventType == KEY_EVENT)
+              read = TRUE;
+        }
+      break;
+
+    default:
+      ret = WaitForSingleObject (h, 0);
+      write = TRUE;
+      if (ret == WAIT_OBJECT_0)
+        read = TRUE;
+
+      break;
+    }
+
+  ret = 0;
+  if (read && (rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
+    {
+      rbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
+      ret++;
+    }
+
+  if (write && (wbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
+    {
+      wbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
+      ret++;
+    }
+
+  if (except && (xbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
+    {
+      xbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1)));
+      ret++;
+    }
+
+  return ret;
+}
+
+int
+rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
+            struct timeval *timeout)
+#undef timeval
+{
+  static struct timeval tv0;
+  static HANDLE hEvent;
+  HANDLE h, handle_array[FD_SETSIZE + 2];
+  fd_set handle_rfds, handle_wfds, handle_xfds;
+  struct bitset rbits, wbits, xbits;
+  unsigned char anyfds_in[FD_SETSIZE / CHAR_BIT];
+  DWORD ret, wait_timeout, nhandles, nsock, nbuffer;
+  MSG msg;
+  int i, fd, rc;
+  clock_t tend;
+
+  if (nfds < 0 || nfds > FD_SETSIZE)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if (!timeout)
+    wait_timeout = INFINITE;
+  else
+    {
+      wait_timeout = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
+
+      /* select is also used as a portable usleep.  */
+      if (!rfds && !wfds && !xfds)
+        {
+          Sleep (wait_timeout);
+          return 0;
+        }
+    }
+
+  if (!hEvent)
+    hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
+
+  handle_array[0] = hEvent;
+  nhandles = 1;
+  nsock = 0;
+
+  /* Copy descriptors to bitsets.  At the same time, eliminate
+     bits in the "wrong" direction for console input buffers
+     and screen buffers, because screen buffers are waitable
+     and they will block until a character is available.  */
+  memset (&rbits, 0, sizeof (rbits));
+  memset (&wbits, 0, sizeof (wbits));
+  memset (&xbits, 0, sizeof (xbits));
+  memset (anyfds_in, 0, sizeof (anyfds_in));
+  if (rfds)
+    for (i = 0; i < rfds->fd_count; i++)
+      {
+        fd = rfds->fd_array[i];
+        h = (HANDLE) _get_osfhandle (fd);
+        if (IsConsoleHandle (h)
+            && !GetNumberOfConsoleInputEvents (h, &nbuffer))
+          continue;
+
+        rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
+        anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
+      }
+  else
+    rfds = (fd_set *) alloca (sizeof (fd_set));
+
+  if (wfds)
+    for (i = 0; i < wfds->fd_count; i++)
+      {
+        fd = wfds->fd_array[i];
+        h = (HANDLE) _get_osfhandle (fd);
+        if (IsConsoleHandle (h)
+            && GetNumberOfConsoleInputEvents (h, &nbuffer))
+          continue;
+
+        wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
+        anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
+      }
+  else
+    wfds = (fd_set *) alloca (sizeof (fd_set));
+
+  if (xfds)
+    for (i = 0; i < xfds->fd_count; i++)
+      {
+        fd = xfds->fd_array[i];
+        xbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
+        anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
+      }
+  else
+    xfds = (fd_set *) alloca (sizeof (fd_set));
+
+  /* Zero all the fd_sets, including the application's.  */
+  FD_ZERO (rfds);
+  FD_ZERO (wfds);
+  FD_ZERO (xfds);
+  FD_ZERO (&handle_rfds);
+  FD_ZERO (&handle_wfds);
+  FD_ZERO (&handle_xfds);
+
+  /* Classify handles.  Create fd sets for sockets, poll the others. */
+  for (i = 0; i < nfds; i++)
+    {
+      if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
+        continue;
+
+      h = (HANDLE) _get_osfhandle (i);
+      if (!h)
+        {
+          errno = EBADF;
+          return -1;
+        }
+
+      if (IsSocketHandle (h))
+        {
+          int requested = FD_CLOSE;
+
+          /* See above; socket handles are mapped onto select, but we
+             need to map descriptors to handles.  */
+          if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
+            {
+              requested |= FD_READ | FD_ACCEPT;
+              FD_SET ((SOCKET) h, rfds);
+              FD_SET ((SOCKET) h, &handle_rfds);
+            }
+          if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
+            {
+              requested |= FD_WRITE | FD_CONNECT;
+              FD_SET ((SOCKET) h, wfds);
+              FD_SET ((SOCKET) h, &handle_wfds);
+            }
+          if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
+            {
+              requested |= FD_OOB;
+              FD_SET ((SOCKET) h, xfds);
+              FD_SET ((SOCKET) h, &handle_xfds);
+            }
+
+          WSAEventSelect ((SOCKET) h, hEvent, requested);
+          nsock++;
+        }
+      else
+        {
+          handle_array[nhandles++] = h;
+
+          /* Poll now.  If we get an event, do not wait below.  */
+          if (wait_timeout != 0
+              && windows_poll_handle (h, i, &rbits, &wbits, &xbits))
+            wait_timeout = 0;
+        }
+    }
+
+  /* Place a sentinel at the end of the array.  */
+  handle_array[nhandles] = NULL;
+
+  /* When will the waiting period expire?  */
+  if (wait_timeout != INFINITE)
+    tend = clock () + wait_timeout;
+
+restart:
+  if (wait_timeout == 0 || nsock == 0)
+    rc = 0;
+  else
+    {
+      /* See if we need to wait in the loop below.  If any select is ready,
+         do MsgWaitForMultipleObjects anyway to dispatch messages, but
+         no need to call select again.  */
+      rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
+      if (rc == 0)
+        {
+          /* Restore the fd_sets for the other select we do below.  */
+          memcpy (&handle_rfds, rfds, sizeof (fd_set));
+          memcpy (&handle_wfds, wfds, sizeof (fd_set));
+          memcpy (&handle_xfds, xfds, sizeof (fd_set));
+        }
+      else
+        wait_timeout = 0;
+    }
+
+  /* How much is left to wait?  */
+  if (wait_timeout != INFINITE)
+    {
+      clock_t tnow = clock ();
+      if (tend >= tnow)
+        wait_timeout = tend - tnow;
+      else
+        wait_timeout = 0;
+    }
+
+  for (;;)
+    {
+      ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE,
+                                       wait_timeout, QS_ALLINPUT);
+
+      if (ret == WAIT_OBJECT_0 + nhandles)
+        {
+          /* new input of some other kind */
+          BOOL bRet;
+          while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0)
+            {
+              TranslateMessage (&msg);
+              DispatchMessage (&msg);
+            }
+        }
+      else
+        break;
+    }
+
+  /* If we haven't done it yet, check the status of the sockets.  */
+  if (rc == 0 && nsock > 0)
+    rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
+
+  if (nhandles > 1)
+    {
+      /* Count results that are not counted in the return value of select.  */
+      nhandles = 1;
+      for (i = 0; i < nfds; i++)
+        {
+          if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
+            continue;
+
+          h = (HANDLE) _get_osfhandle (i);
+          if (h == handle_array[nhandles])
+            {
+              /* Not a socket.  */
+              nhandles++;
+              windows_poll_handle (h, i, &rbits, &wbits, &xbits);
+              if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
+                  || wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))
+                  || xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
+                rc++;
+            }
+        }
+
+      if (rc == 0
+          && (wait_timeout == INFINITE
+              /* If NHANDLES > 1, but no bits are set, it means we've
+                 been told incorrectly that some handle was signaled.
+                 This happens with anonymous pipes, which always cause
+                 MsgWaitForMultipleObjects to exit immediately, but no
+                 data is found ready to be read by windows_poll_handle.
+                 To avoid a total failure (whereby we return zero and
+                 don't wait at all), let's poll in a more busy loop.  */
+              || (wait_timeout != 0 && nhandles > 1)))
+        {
+          /* Sleep 1 millisecond to avoid busy wait and retry with the
+             original fd_sets.  */
+          memcpy (&handle_rfds, rfds, sizeof (fd_set));
+          memcpy (&handle_wfds, wfds, sizeof (fd_set));
+          memcpy (&handle_xfds, xfds, sizeof (fd_set));
+          SleepEx (1, TRUE);
+          goto restart;
+        }
+      if (timeout && wait_timeout == 0 && rc == 0)
+        timeout->tv_sec = timeout->tv_usec = 0;
+    }
+
+  /* Now fill in the results.  */
+  FD_ZERO (rfds);
+  FD_ZERO (wfds);
+  FD_ZERO (xfds);
+  nhandles = 1;
+  for (i = 0; i < nfds; i++)
+    {
+      if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
+        continue;
+
+      h = (HANDLE) _get_osfhandle (i);
+      if (h != handle_array[nhandles])
+        {
+          /* Perform handle->descriptor mapping.  */
+          SOCKET s = (SOCKET) h;
+          WSAEventSelect (s, NULL, 0);
+          if (FD_ISSET (s, &handle_rfds))
+            FD_SET (i, rfds);
+          if (FD_ISSET (s, &handle_wfds))
+            FD_SET (i, wfds);
+          if (FD_ISSET (s, &handle_xfds))
+            FD_SET (i, xfds);
+        }
+      else
+        {
+          /* Not a socket.  */
+          nhandles++;
+          if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
+            FD_SET (i, rfds);
+          if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
+            FD_SET (i, wfds);
+          if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
+            FD_SET (i, xfds);
+        }
+    }
+
+  return rc;
+}
+
+#else /* ! Native Windows.  */
+
+#include <stddef.h> /* NULL */
+#include <errno.h>
+#include <unistd.h>
+
+#undef select
+
+int
+rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
+            struct timeval *timeout)
+{
+  int i;
+
+  /* FreeBSD 8.2 has a bug: it does not always detect invalid fds.  */
+  if (nfds < 0 || nfds > FD_SETSIZE)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  for (i = 0; i < nfds; i++)
+    {
+      if (((rfds && FD_ISSET (i, rfds))
+           || (wfds && FD_ISSET (i, wfds))
+           || (xfds && FD_ISSET (i, xfds)))
+          && dup2 (i, i) != i)
+        return -1;
+    }
+
+  /* Interix 3.5 has a bug: it does not support nfds == 0.  */
+  if (nfds == 0)
+    {
+      nfds = 1;
+      rfds = NULL;
+      wfds = NULL;
+      xfds = NULL;
+    }
+  return select (nfds, rfds, wfds, xfds, timeout);
+}
+
+#endif
deleted file mode 120000 (symlink)
index dd9640ea837b6464951fec228fd051a74b41d9bb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/selinux-at.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..82674dae8645bddad186dadb779beb330e21a84d
--- /dev/null
@@ -0,0 +1,71 @@
+/* openat-style fd-relative functions for SE Linux
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "selinux-at.h"
+#include "openat.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include "save-cwd.h"
+
+#include "openat-priv.h"
+
+#define AT_FUNC_NAME getfileconat
+#define AT_FUNC_F1 getfilecon
+#define AT_FUNC_POST_FILE_PARAM_DECLS , char **con
+#define AT_FUNC_POST_FILE_ARGS        , con
+#include "at-func.c"
+#undef AT_FUNC_NAME
+#undef AT_FUNC_F1
+#undef AT_FUNC_POST_FILE_PARAM_DECLS
+#undef AT_FUNC_POST_FILE_ARGS
+
+#define AT_FUNC_NAME lgetfileconat
+#define AT_FUNC_F1 lgetfilecon
+#define AT_FUNC_POST_FILE_PARAM_DECLS , char **con
+#define AT_FUNC_POST_FILE_ARGS        , con
+#include "at-func.c"
+#undef AT_FUNC_NAME
+#undef AT_FUNC_F1
+#undef AT_FUNC_POST_FILE_PARAM_DECLS
+#undef AT_FUNC_POST_FILE_ARGS
+
+#define AT_FUNC_NAME setfileconat
+#define AT_FUNC_F1 setfilecon
+#define AT_FUNC_POST_FILE_PARAM_DECLS , char const *con
+#define AT_FUNC_POST_FILE_ARGS        , con
+#include "at-func.c"
+#undef AT_FUNC_NAME
+#undef AT_FUNC_F1
+#undef AT_FUNC_POST_FILE_PARAM_DECLS
+#undef AT_FUNC_POST_FILE_ARGS
+
+#define AT_FUNC_NAME lsetfileconat
+#define AT_FUNC_F1 lsetfilecon
+#define AT_FUNC_POST_FILE_PARAM_DECLS , char const *con
+#define AT_FUNC_POST_FILE_ARGS        , con
+#include "at-func.c"
+#undef AT_FUNC_NAME
+#undef AT_FUNC_F1
+#undef AT_FUNC_POST_FILE_PARAM_DECLS
+#undef AT_FUNC_POST_FILE_ARGS
deleted file mode 120000 (symlink)
index 88038a2ce007bb12100f74c4f8972bd3741162fa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/selinux-at.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5cb00e3c0feaf4928737852421b122edbbc51f8c
--- /dev/null
@@ -0,0 +1,52 @@
+/* Prototypes for openat-style fd-relative SELinux functions
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <selinux/selinux.h>
+#include <selinux/context.h>
+
+/* These are the dir-fd-relative variants of the functions without the
+   "at" suffix.  For example, getfileconat (AT_FDCWD, file, &c) is usually
+   equivalent to getfilecon (file, &c).  The emulation is accomplished
+   by first attempting getfilecon ("/proc/self/fd/DIR_FD/FILE", &c).
+   Failing that, simulate it via save_cwd/fchdir/getfilecon/restore_cwd.
+   If either the save_cwd or the restore_cwd fails (relatively unlikely),
+   then give a diagnostic and exit nonzero.  */
+
+/* dir-fd-relative getfilecon.  Set *CON to the SELinux security context
+   of the file specified by DIR_FD and FILE and return the length of *CON.
+   DIR_FD and FILE are interpreted as for fstatat[*].  A non-NULL *CON
+   must be freed with freecon.  Upon error, set *CON to NULL, set errno
+   and return -1.
+   [*] with flags=0 here, with flags=AT_SYMLINK_NOFOLLOW for lgetfileconat  */
+int  getfileconat (int dir_fd, char const *file, char **con);
+
+/* dir-fd-relative lgetfilecon.  This function is just like getfileconat,
+   except when DIR_FD and FILE specify a symlink:  lgetfileconat operates on
+   the symlink, while getfileconat operates on the referent of the symlink.  */
+int lgetfileconat (int dir_fd, char const *file, char **con);
+
+/* dir-fd-relative setfilecon.  Set the SELinux security context of
+   the file specified by DIR_FD and FILE to CON.  DIR_FD and FILE are
+   interpreted as for fstatat[*].  Upon success, return 0.
+   Otherwise, return -1 and set errno.  */
+int  setfileconat (int dir_fd, char const *file, char const *con);
+
+/* dir-fd-relative lsetfilecon.  This function is just like setfileconat,
+   except that rather than dereferencing a symlink, this function affects it. */
+/* dir-fd-relative lsetfilecon.  This function is just like setfileconat,
+   except when DIR_FD and FILE specify a symlink:  lsetfileconat operates on
+   the symlink, while setfileconat operates on the referent of the symlink.  */
+int lsetfileconat (int dir_fd, char const *file, char const *con);
deleted file mode 120000 (symlink)
index e275419f50a0381bc4fd081b54d9d8e5b79d1e98..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/set-acl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dd3b596805c74278817f638797498af9f78c505d
--- /dev/null
@@ -0,0 +1,48 @@
+/* set-acl.c - set access control list equivalent to a mode
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert and Andreas Gruenbacher, and Bruno Haible.  */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include <errno.h>
+
+#include "quote.h"
+#include <error.h>
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+/* Set the access control lists of a file to match *exactly* MODE (this might
+   remove inherited ACLs). Note chmod() tends to honor inherited/default
+   ACLs. If DESC is a valid file descriptor, use file descriptor operations
+   where available, else use filename based operations on NAME.  If access
+   control lists are not available, fchmod the target file to MODE.  Also
+   sets the non-permission bits of the destination file
+   (S_ISUID, S_ISGID, S_ISVTX) to those from MODE if any are set.
+    Return 0 if successful.  On failure, output a diagnostic, set errno and
+    return -1.  */
+
+int
+set_acl (char const *name, int desc, mode_t mode)
+{
+  int ret = qset_acl (name, desc, mode);
+  if (ret != 0)
+    error (0, errno, _("setting permissions for %s"), quote (name));
+  return ret;
+}
deleted file mode 120000 (symlink)
index f90b6cad5366171553882e07cf68dc04ce8ee35b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/set-permissions.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..83a355faa5ce4aefbce312240a4a6ef5048afe99
--- /dev/null
@@ -0,0 +1,848 @@
+/* Set permissions of a file.  -*- coding: utf-8 -*-
+
+   Copyright (C) 2002-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+   Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible.  */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include "acl-internal.h"
+#include "minmax.h"
+
+#if USE_ACL
+# if ! defined HAVE_ACL_FROM_MODE && defined HAVE_ACL_FROM_TEXT /* FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */
+#  if HAVE_ACL_GET_FILE && !HAVE_ACL_TYPE_EXTENDED
+
+static acl_t
+acl_from_mode (mode_t mode)
+{
+#  if HAVE_ACL_FREE_TEXT /* Tru64 */
+  char acl_text[] = "u::---,g::---,o::---,";
+#  else /* FreeBSD, IRIX, Cygwin >= 2.5 */
+  char acl_text[] = "u::---,g::---,o::---";
+#  endif
+
+  if (mode & S_IRUSR) acl_text[ 3] = 'r';
+  if (mode & S_IWUSR) acl_text[ 4] = 'w';
+  if (mode & S_IXUSR) acl_text[ 5] = 'x';
+  if (mode & S_IRGRP) acl_text[10] = 'r';
+  if (mode & S_IWGRP) acl_text[11] = 'w';
+  if (mode & S_IXGRP) acl_text[12] = 'x';
+  if (mode & S_IROTH) acl_text[17] = 'r';
+  if (mode & S_IWOTH) acl_text[18] = 'w';
+  if (mode & S_IXOTH) acl_text[19] = 'x';
+
+  return acl_from_text (acl_text);
+}
+#  endif
+# endif
+
+# if HAVE_FACL && defined GETACL /* Solaris, Cygwin < 2.5, not HP-UX */
+static int
+set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod)
+{
+#  ifdef ACE_GETACL
+  /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
+     file systems (whereas the other ones are used in UFS file systems).  */
+
+  /* The flags in the ace_t structure changed in a binary incompatible way
+     when ACL_NO_TRIVIAL etc. were introduced in <sys/acl.h> version 1.15.
+     How to distinguish the two conventions at runtime?
+     We fetch the existing ACL.  In the old convention, usually three ACEs have
+     a_flags = ACE_OWNER / ACE_GROUP / ACE_OTHER, in the range 0x0100..0x0400.
+     In the new convention, these values are not used.  */
+  int convention;
+
+  {
+    /* Initially, try to read the entries into a stack-allocated buffer.
+       Use malloc if it does not fit.  */
+    enum
+      {
+        alloc_init = 4000 / sizeof (ace_t), /* >= 3 */
+        alloc_max = MIN (INT_MAX, SIZE_MAX / sizeof (ace_t))
+      };
+    ace_t buf[alloc_init];
+    size_t alloc = alloc_init;
+    ace_t *entries = buf;
+    ace_t *malloced = NULL;
+    int count;
+
+    for (;;)
+      {
+        count = (desc != -1
+                 ? facl (desc, ACE_GETACL, alloc, entries)
+                 : acl (name, ACE_GETACL, alloc, entries));
+        if (count < 0 && errno == ENOSPC)
+          {
+            /* Increase the size of the buffer.  */
+            free (malloced);
+            if (alloc > alloc_max / 2)
+              {
+                errno = ENOMEM;
+                return -1;
+              }
+            alloc = 2 * alloc; /* <= alloc_max */
+            entries = malloced = (ace_t *) malloc (alloc * sizeof (ace_t));
+            if (entries == NULL)
+              {
+                errno = ENOMEM;
+                return -1;
+              }
+            continue;
+          }
+        break;
+      }
+
+    if (count <= 0)
+      convention = -1;
+    else
+      {
+        int i;
+
+        convention = 0;
+        for (i = 0; i < count; i++)
+          if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
+            {
+              convention = 1;
+              break;
+            }
+      }
+    free (malloced);
+  }
+
+  if (convention >= 0)
+    {
+      ace_t entries[6];
+      int count;
+      int ret;
+
+      if (convention)
+        {
+          /* Running on Solaris 10.  */
+          entries[0].a_type = OLD_ALLOW;
+          entries[0].a_flags = OLD_ACE_OWNER;
+          entries[0].a_who = 0; /* irrelevant */
+          entries[0].a_access_mask = (mode >> 6) & 7;
+          entries[1].a_type = OLD_ALLOW;
+          entries[1].a_flags = OLD_ACE_GROUP;
+          entries[1].a_who = 0; /* irrelevant */
+          entries[1].a_access_mask = (mode >> 3) & 7;
+          entries[2].a_type = OLD_ALLOW;
+          entries[2].a_flags = OLD_ACE_OTHER;
+          entries[2].a_who = 0;
+          entries[2].a_access_mask = mode & 7;
+          count = 3;
+        }
+      else
+        {
+          /* Running on Solaris 10 (newer version) or Solaris 11.
+             The details here were found through "/bin/ls -lvd somefiles".  */
+          entries[0].a_type = NEW_ACE_ACCESS_DENIED_ACE_TYPE;
+          entries[0].a_flags = NEW_ACE_OWNER;
+          entries[0].a_who = 0; /* irrelevant */
+          entries[0].a_access_mask = 0;
+          entries[1].a_type = NEW_ACE_ACCESS_ALLOWED_ACE_TYPE;
+          entries[1].a_flags = NEW_ACE_OWNER;
+          entries[1].a_who = 0; /* irrelevant */
+          entries[1].a_access_mask = NEW_ACE_WRITE_NAMED_ATTRS
+                                     | NEW_ACE_WRITE_ATTRIBUTES
+                                     | NEW_ACE_WRITE_ACL
+                                     | NEW_ACE_WRITE_OWNER;
+          if (mode & 0400)
+            entries[1].a_access_mask |= NEW_ACE_READ_DATA;
+          else
+            entries[0].a_access_mask |= NEW_ACE_READ_DATA;
+          if (mode & 0200)
+            entries[1].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+          else
+            entries[0].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+          if (mode & 0100)
+            entries[1].a_access_mask |= NEW_ACE_EXECUTE;
+          else
+            entries[0].a_access_mask |= NEW_ACE_EXECUTE;
+          entries[2].a_type = NEW_ACE_ACCESS_DENIED_ACE_TYPE;
+          entries[2].a_flags = NEW_ACE_GROUP | NEW_ACE_IDENTIFIER_GROUP;
+          entries[2].a_who = 0; /* irrelevant */
+          entries[2].a_access_mask = 0;
+          entries[3].a_type = NEW_ACE_ACCESS_ALLOWED_ACE_TYPE;
+          entries[3].a_flags = NEW_ACE_GROUP | NEW_ACE_IDENTIFIER_GROUP;
+          entries[3].a_who = 0; /* irrelevant */
+          entries[3].a_access_mask = 0;
+          if (mode & 0040)
+            entries[3].a_access_mask |= NEW_ACE_READ_DATA;
+          else
+            entries[2].a_access_mask |= NEW_ACE_READ_DATA;
+          if (mode & 0020)
+            entries[3].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+          else
+            entries[2].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+          if (mode & 0010)
+            entries[3].a_access_mask |= NEW_ACE_EXECUTE;
+          else
+            entries[2].a_access_mask |= NEW_ACE_EXECUTE;
+          entries[4].a_type = NEW_ACE_ACCESS_DENIED_ACE_TYPE;
+          entries[4].a_flags = NEW_ACE_EVERYONE;
+          entries[4].a_who = 0;
+          entries[4].a_access_mask = NEW_ACE_WRITE_NAMED_ATTRS
+                                     | NEW_ACE_WRITE_ATTRIBUTES
+                                     | NEW_ACE_WRITE_ACL
+                                     | NEW_ACE_WRITE_OWNER;
+          entries[5].a_type = NEW_ACE_ACCESS_ALLOWED_ACE_TYPE;
+          entries[5].a_flags = NEW_ACE_EVERYONE;
+          entries[5].a_who = 0;
+          entries[5].a_access_mask = NEW_ACE_READ_NAMED_ATTRS
+                                     | NEW_ACE_READ_ATTRIBUTES
+                                     | NEW_ACE_READ_ACL
+                                     | NEW_ACE_SYNCHRONIZE;
+          if (mode & 0004)
+            entries[5].a_access_mask |= NEW_ACE_READ_DATA;
+          else
+            entries[4].a_access_mask |= NEW_ACE_READ_DATA;
+          if (mode & 0002)
+            entries[5].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+          else
+            entries[4].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+          if (mode & 0001)
+            entries[5].a_access_mask |= NEW_ACE_EXECUTE;
+          else
+            entries[4].a_access_mask |= NEW_ACE_EXECUTE;
+          count = 6;
+        }
+      if (desc != -1)
+        ret = facl (desc, ACE_SETACL, count, entries);
+      else
+        ret = acl (name, ACE_SETACL, count, entries);
+      if (ret < 0 && errno != EINVAL && errno != ENOTSUP)
+        {
+          if (errno == ENOSYS)
+            {
+              *must_chmod = true;
+              return 0;
+            }
+          return -1;
+        }
+      if (ret == 0)
+        return 0;
+    }
+#  endif
+
+  {
+    aclent_t entries[3];
+    int ret;
+
+    entries[0].a_type = USER_OBJ;
+    entries[0].a_id = 0; /* irrelevant */
+    entries[0].a_perm = (mode >> 6) & 7;
+    entries[1].a_type = GROUP_OBJ;
+    entries[1].a_id = 0; /* irrelevant */
+    entries[1].a_perm = (mode >> 3) & 7;
+    entries[2].a_type = OTHER_OBJ;
+    entries[2].a_id = 0;
+    entries[2].a_perm = mode & 7;
+
+    if (desc != -1)
+      ret = facl (desc, SETACL,
+                  sizeof (entries) / sizeof (aclent_t), entries);
+    else
+      ret = acl (name, SETACL,
+                 sizeof (entries) / sizeof (aclent_t), entries);
+    if (ret < 0)
+      {
+        if (errno == ENOSYS || errno == EOPNOTSUPP)
+          {
+            *must_chmod = true;
+            return 0;
+          }
+        return -1;
+      }
+    return 0;
+  }
+}
+
+# elif HAVE_GETACL /* HP-UX */
+static int
+context_acl_from_mode (struct permission_context *ctx, const char *name, int desc)
+{
+  struct stat statbuf;
+  int ret;
+
+  if (desc != -1)
+    ret = fstat (desc, &statbuf);
+  else
+    ret = stat (name, &statbuf);
+  if (ret < 0)
+    return -1;
+
+  ctx->entries[0].uid = statbuf.st_uid;
+  ctx->entries[0].gid = ACL_NSGROUP;
+  ctx->entries[0].mode = (ctx->mode >> 6) & 7;
+  ctx->entries[1].uid = ACL_NSUSER;
+  ctx->entries[1].gid = statbuf.st_gid;
+  ctx->entries[1].mode = (ctx->mode >> 3) & 7;
+  ctx->entries[2].uid = ACL_NSUSER;
+  ctx->entries[2].gid = ACL_NSGROUP;
+  ctx->entries[2].mode = ctx->mode & 7;
+  ctx->count = 3;
+  return 0;
+}
+
+#  if HAVE_ACLV_H /* HP-UX >= 11.11 */
+static int
+context_aclv_from_mode (struct permission_context *ctx)
+{
+  int ret;
+
+  ctx->aclv_entries[0].a_type = USER_OBJ;
+  ctx->aclv_entries[0].a_id = 0; /* irrelevant */
+  ctx->aclv_entries[0].a_perm = (ctx->mode >> 6) & 7;
+  ctx->aclv_entries[1].a_type = GROUP_OBJ;
+  ctx->aclv_entries[1].a_id = 0; /* irrelevant */
+  ctx->aclv_entries[1].a_perm = (ctx->mode >> 3) & 7;
+  ctx->aclv_entries[2].a_type = CLASS_OBJ;
+  ctx->aclv_entries[2].a_id = 0;
+  ctx->aclv_entries[2].a_perm = (ctx->mode >> 3) & 7;
+  ctx->aclv_entries[3].a_type = OTHER_OBJ;
+  ctx->aclv_entries[3].a_id = 0;
+  ctx->aclv_entries[3].a_perm = ctx->mode & 7;
+  ctx->aclv_count = 4;
+
+  ret = aclsort (ctx->aclv_count, 1, ctx->aclv_entries);
+  if (ret > 0)
+    abort ();
+  return ret;
+}
+#  endif
+
+# elif HAVE_ACLX_GET && defined ACL_AIX_WIP /* AIX */
+static int
+set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod)
+{
+  acl_type_list_t types;
+  size_t types_size = sizeof (types);
+  acl_type_t type;
+
+  if (aclx_gettypes (name, &types, &types_size) < 0
+      || types.num_entries == 0)
+    {
+      *must_chmod = true;
+      return 0;
+    }
+
+  /* XXX Do we need to clear all types of ACLs for the given file, or is it
+     sufficient to clear the first one?  */
+  type = types.entries[0];
+  if (type.u64 == ACL_AIXC)
+    {
+      union { struct acl a; char room[128]; } u;
+      int ret;
+
+      u.a.acl_len = (char *) &u.a.acl_ext[0] - (char *) &u.a; /* no entries */
+      u.a.acl_mode = mode & ~(S_IXACL | 0777);
+      u.a.u_access = (mode >> 6) & 7;
+      u.a.g_access = (mode >> 3) & 7;
+      u.a.o_access = mode & 7;
+
+      if (desc != -1)
+        ret = aclx_fput (desc, SET_ACL | SET_MODE_S_BITS,
+                         type, &u.a, u.a.acl_len, mode);
+      else
+        ret = aclx_put (name, SET_ACL | SET_MODE_S_BITS,
+                        type, &u.a, u.a.acl_len, mode);
+      if (!(ret < 0 && errno == ENOSYS))
+        return ret;
+    }
+  else if (type.u64 == ACL_NFS4)
+    {
+      union { nfs4_acl_int_t a; char room[128]; } u;
+      nfs4_ace_int_t *ace;
+      int ret;
+
+      u.a.aclVersion = NFS4_ACL_INT_STRUCT_VERSION;
+      u.a.aclEntryN = 0;
+      ace = &u.a.aclEntry[0];
+      {
+        ace->flags = ACE4_ID_SPECIAL;
+        ace->aceWho.special_whoid = ACE4_WHO_OWNER;
+        ace->aceType = ACE4_ACCESS_ALLOWED_ACE_TYPE;
+        ace->aceFlags = 0;
+        ace->aceMask =
+          (mode & 0400 ? ACE4_READ_DATA | ACE4_LIST_DIRECTORY : 0)
+          | (mode & 0200
+             ? ACE4_WRITE_DATA | ACE4_ADD_FILE | ACE4_APPEND_DATA
+               | ACE4_ADD_SUBDIRECTORY
+             : 0)
+          | (mode & 0100 ? ACE4_EXECUTE : 0);
+        ace->aceWhoString[0] = '\0';
+        ace->entryLen = (char *) &ace->aceWhoString[4] - (char *) ace;
+        ace = (nfs4_ace_int_t *) (char *) &ace->aceWhoString[4];
+        u.a.aclEntryN++;
+      }
+      {
+        ace->flags = ACE4_ID_SPECIAL;
+        ace->aceWho.special_whoid = ACE4_WHO_GROUP;
+        ace->aceType = ACE4_ACCESS_ALLOWED_ACE_TYPE;
+        ace->aceFlags = 0;
+        ace->aceMask =
+          (mode & 0040 ? ACE4_READ_DATA | ACE4_LIST_DIRECTORY : 0)
+          | (mode & 0020
+             ? ACE4_WRITE_DATA | ACE4_ADD_FILE | ACE4_APPEND_DATA
+               | ACE4_ADD_SUBDIRECTORY
+             : 0)
+          | (mode & 0010 ? ACE4_EXECUTE : 0);
+        ace->aceWhoString[0] = '\0';
+        ace->entryLen = (char *) &ace->aceWhoString[4] - (char *) ace;
+        ace = (nfs4_ace_int_t *) (char *) &ace->aceWhoString[4];
+        u.a.aclEntryN++;
+      }
+      {
+        ace->flags = ACE4_ID_SPECIAL;
+        ace->aceWho.special_whoid = ACE4_WHO_EVERYONE;
+        ace->aceType = ACE4_ACCESS_ALLOWED_ACE_TYPE;
+        ace->aceFlags = 0;
+        ace->aceMask =
+          (mode & 0004 ? ACE4_READ_DATA | ACE4_LIST_DIRECTORY : 0)
+          | (mode & 0002
+             ? ACE4_WRITE_DATA | ACE4_ADD_FILE | ACE4_APPEND_DATA
+               | ACE4_ADD_SUBDIRECTORY
+             : 0)
+          | (mode & 0001 ? ACE4_EXECUTE : 0);
+        ace->aceWhoString[0] = '\0';
+        ace->entryLen = (char *) &ace->aceWhoString[4] - (char *) ace;
+        ace = (nfs4_ace_int_t *) (char *) &ace->aceWhoString[4];
+        u.a.aclEntryN++;
+      }
+      u.a.aclLength = (char *) ace - (char *) &u.a;
+
+      if (desc != -1)
+        ret = aclx_fput (desc, SET_ACL | SET_MODE_S_BITS,
+                         type, &u.a, u.a.aclLength, mode);
+      else
+        ret = aclx_put (name, SET_ACL | SET_MODE_S_BITS,
+                        type, &u.a, u.a.aclLength, mode);
+      if (!(ret < 0 && errno == ENOSYS))
+        return ret;
+    }
+
+  *must_chmod = true;
+  return 0;
+}
+
+# elif HAVE_STATACL /* older AIX */
+static int
+context_acl_from_mode (struct permission_context *ctx)
+{
+  ctx->u.a.acl_len = (char *) &ctx->u.a.acl_ext[0] - (char *) &ctx->u.a; /* no entries */
+  ctx->u.a.acl_mode = ctx->mode & ~(S_IXACL | 0777);
+  ctx->u.a.u_access = (ctx->mode >> 6) & 7;
+  ctx->u.a.g_access = (ctx->mode >> 3) & 7;
+  ctx->u.a.o_access = ctx->mode & 7;
+  ctx->have_u = true;
+  return 0;
+}
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+static int
+context_acl_from_mode (struct permission_context *ctx)
+{
+  int ret;
+
+  ctx->entries[0].a_type = USER_OBJ;
+  ctx->entries[0].a_id = 0; /* irrelevant */
+  ctx->entries[0].a_perm = (ctx->mode >> 6) & 7;
+  ctx->entries[1].a_type = GROUP_OBJ;
+  ctx->entries[1].a_id = 0; /* irrelevant */
+  ctx->entries[1].a_perm = (ctx->mode >> 3) & 7;
+  ctx->entries[2].a_type = CLASS_OBJ;
+  ctx->entries[2].a_id = 0;
+  ctx->entries[2].a_perm = (ctx->mode >> 3) & 7;
+  ctx->entries[3].a_type = OTHER_OBJ;
+  ctx->entries[3].a_id = 0;
+  ctx->entries[3].a_perm = ctx->mode & 7;
+  ctx->count = 4;
+
+  ret = aclsort (ctx->count, 1, entries);
+  if (ret > 0)
+    abort ();
+  return ret;
+}
+# endif
+
+static int
+set_acls (struct permission_context *ctx, const char *name, int desc,
+          int from_mode, bool *must_chmod, bool *acls_set)
+{
+  int ret = 0;
+
+# if HAVE_ACL_GET_FILE
+  /* POSIX 1003.1e (draft 17 -- abandoned) specific version.  */
+  /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+#  if !HAVE_ACL_TYPE_EXTENDED
+  /* Linux, FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */
+
+#   ifndef HAVE_ACL_FROM_TEXT
+#    error Must have acl_from_text (see POSIX 1003.1e draft 17).
+#   endif
+#   ifndef HAVE_ACL_DELETE_DEF_FILE
+#    error Must have acl_delete_def_file (see POSIX 1003.1e draft 17).
+#   endif
+
+  if (! ctx->acls_not_supported)
+    {
+      if (ret == 0 && from_mode)
+        {
+          if (ctx->acl)
+            acl_free (ctx->acl);
+          ctx->acl = acl_from_mode (ctx->mode);
+          if (ctx->acl == NULL)
+            ret = -1;
+        }
+
+      if (ret == 0 && ctx->acl)
+        {
+          if (HAVE_ACL_SET_FD && desc != -1)
+            ret = acl_set_fd (desc, ctx->acl);
+          else
+            ret = acl_set_file (name, ACL_TYPE_ACCESS, ctx->acl);
+          if (ret != 0)
+            {
+              if (! acl_errno_valid (errno))
+                {
+                  ctx->acls_not_supported = true;
+                  if (from_mode || acl_access_nontrivial (ctx->acl) == 0)
+                    ret = 0;
+                }
+            }
+          else
+            {
+              *acls_set = true;
+              if (S_ISDIR(ctx->mode))
+                {
+                  if (! from_mode && ctx->default_acl &&
+                      acl_default_nontrivial (ctx->default_acl))
+                    ret = acl_set_file (name, ACL_TYPE_DEFAULT,
+                                        ctx->default_acl);
+                  else
+                    ret = acl_delete_def_file (name);
+                }
+            }
+        }
+    }
+
+#   if HAVE_ACL_TYPE_NFS4  /* FreeBSD */
+
+  /* File systems either support POSIX ACLs (for example, ufs) or NFS4 ACLs
+     (for example, zfs). */
+
+  /* TODO: Implement setting ACLs once get_permissions() reads them. */
+
+#   endif
+
+#  else /* HAVE_ACL_TYPE_EXTENDED */
+  /* Mac OS X */
+
+  /* On Mac OS X,  acl_get_file (name, ACL_TYPE_ACCESS)
+     and           acl_get_file (name, ACL_TYPE_DEFAULT)
+     always return NULL / EINVAL.  You have to use
+                   acl_get_file (name, ACL_TYPE_EXTENDED)
+     or            acl_get_fd (open (name, ...))
+     to retrieve an ACL.
+     On the other hand,
+                   acl_set_file (name, ACL_TYPE_ACCESS, acl)
+     and           acl_set_file (name, ACL_TYPE_DEFAULT, acl)
+     have the same effect as
+                   acl_set_file (name, ACL_TYPE_EXTENDED, acl):
+     Each of these calls sets the file's ACL.  */
+
+  if (ctx->acl == NULL)
+    {
+      acl_t acl;
+
+      /* Remove ACLs if the file has ACLs.  */
+      if (HAVE_ACL_GET_FD && desc != -1)
+        acl = acl_get_fd (desc);
+      else
+        acl = acl_get_file (name, ACL_TYPE_EXTENDED);
+      if (acl)
+        {
+          acl_free (acl);
+
+          acl = acl_init (0);
+          if (acl)
+            {
+              if (HAVE_ACL_SET_FD && desc != -1)
+                ret = acl_set_fd (desc, acl);
+              else
+                ret = acl_set_file (name, ACL_TYPE_EXTENDED, acl);
+              acl_free (acl);
+            }
+          else
+            ret = -1;
+        }
+    }
+  else
+    {
+      if (HAVE_ACL_SET_FD && desc != -1)
+        ret = acl_set_fd (desc, ctx->acl);
+      else
+        ret = acl_set_file (name, ACL_TYPE_EXTENDED, ctx->acl);
+      if (ret != 0)
+        {
+          if (! acl_errno_valid (errno)
+              && ! acl_extended_nontrivial (ctx->acl))
+            ret = 0;
+        }
+    }
+  *acls_set = true;
+
+#  endif
+
+# elif defined GETACL /* Solaris, Cygwin, not HP-UX */
+
+  /* Solaris 2.5 through Solaris 10, Cygwin, and contemporaneous versions
+     of Unixware.  The acl() call returns the access and default ACL both
+     at once.  */
+
+  /* If both ace_entries and entries are available, try SETACL before
+     ACE_SETACL, because SETACL cannot fail with ENOTSUP whereas ACE_SETACL
+     can.  */
+
+  if (from_mode)
+    return set_acls_from_mode (name, desc, ctx->mode, must_chmod);
+
+  if (ret == 0 && ctx->count)
+    {
+      if (desc != -1)
+        ret = facl (desc, SETACL, ctx->count, ctx->entries);
+      else
+        ret = acl (name, SETACL, ctx->count, ctx->entries);
+      if (ret < 0)
+        {
+          if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+              && acl_nontrivial (ctx->count, ctx->entries) == 0)
+            ret = 0;
+        }
+      else
+        *acls_set = true;
+    }
+
+#  ifdef ACE_GETACL
+  if (ret == 0 && ctx->ace_count)
+    {
+      if (desc != -1)
+        ret = facl (desc, ACE_SETACL, ctx->ace_count, ctx->ace_entries);
+      else
+        ret = acl (name, ACE_SETACL, ctx->ace_count, ctx->ace_entries);
+      if (ret < 0)
+        {
+          if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP)
+              && acl_ace_nontrivial (ctx->ace_count, ctx->ace_entries) == 0)
+            ret = 0;
+        }
+      else
+        *acls_set = true;
+    }
+#  endif
+
+# elif HAVE_GETACL /* HP-UX */
+
+  if (from_mode)
+    ret = context_acl_from_mode (ctx, name, desc);
+
+  if (ret == 0 && ctx->count > 0)
+    {
+      if (desc != -1)
+        ret = fsetacl (desc, ctx->count, ctx->entries);
+      else
+        ret = setacl (name, ctx->count, ctx->entries);
+      if (ret < 0)
+        {
+          if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+              && (from_mode || !acl_nontrivial (ctx->count, ctx->entries)))
+            ret = 0;
+        }
+      else
+        *acls_set = true;
+    }
+
+#  if HAVE_ACLV_H
+  if (from_mode)
+    ret = context_aclv_from_mode (ctx);
+
+  if (ret == 0 && ctx->aclv_count > 0)
+    {
+      ret = acl ((char *) name, ACL_SET, ctx->aclv_count, ctx->aclv_entries);
+      if (ret < 0)
+        {
+          if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+              && (from_mode || !aclv_nontrivial (ctx->aclv_count, ctx->aclv_entries)))
+            ret = 0;
+        }
+      else
+        *acls_set = true;
+    }
+#  endif
+
+# elif HAVE_ACLX_GET && ACL_AIX_WIP /* AIX */
+
+  /* TODO: Implement setting ACLs once get_permissions() reads them. */
+
+  if (from_mode)
+    ret = set_acls_from_mode (name, desc, mode, must_chmod);
+
+# elif HAVE_STATACL /* older AIX */
+
+  if (from_mode)
+    ret = context_acl_from_mode (ctx);
+
+  if (ret == 0 && ctx->have_u)
+    {
+      if (desc != -1)
+        ret = fchacl (desc, &ctx->u.a, ctx->u.a.acl_len);
+      else
+        ret = chacl ((char *) name, &ctx->u.a, ctx->u.a.acl_len);
+      if (ret < 0)
+        {
+          if (errno == ENOSYS && from_mode)
+            ret = 0;
+        }
+      else
+        *acls_set = true;
+    }
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+
+  if (from_mode)
+    ret = context_acl_from_mode (ctx);
+
+  if (ret == 0 && ctx->count)
+    {
+      ret = acl ((char *) name, ACL_SET, ctx->count, ctx->entries);
+      if (ret != 0)
+        {
+          if (!acl_nontrivial (ctx->count, ctx->entries))
+            ret = 0;
+        }
+      else
+        *acls_set = true;
+    }
+
+# else  /* No ACLs */
+
+  /* Nothing to do. */
+
+# endif
+
+  return ret;
+}
+#endif
+
+/* If DESC is a valid file descriptor use fchmod to change the
+   file's mode to MODE on systems that have fchmod. On systems
+   that don't have fchmod and if DESC is invalid, use chmod on
+   NAME instead.
+   Return 0 if successful.  Return -1 and set errno upon failure.  */
+
+int
+chmod_or_fchmod (const char *name, int desc, mode_t mode)
+{
+  if (HAVE_FCHMOD && desc != -1)
+    return fchmod (desc, mode);
+  else
+    return chmod (name, mode);
+}
+
+/* Set the permissions in CTX on a file. If DESC is a valid file descriptor,
+   use file descriptor operations, else use filename based operations on NAME.
+   If access control lists are not available, fchmod the target file to the
+   mode in CTX.  Also sets the non-permission bits of the destination file
+   (S_ISUID, S_ISGID, S_ISVTX) to those from the mode in CTX if any are set.
+   Return 0 if successful.  Return -1 and set errno upon failure.  */
+
+int
+set_permissions (struct permission_context *ctx, const char *name, int desc)
+{
+  _GL_UNUSED bool acls_set = false;
+  bool early_chmod;
+  bool must_chmod = false;
+  int ret = 0;
+
+#if USE_ACL
+# if HAVE_STATACL
+  /* older AIX */
+  /* There is no need to call chmod_or_fchmod, since the mode
+     bits S_ISUID, S_ISGID, S_ISVTX are also stored in the ACL.  */
+
+  early_chmod = false;
+# else
+  /* All other platforms */
+  /* On Cygwin, it is necessary to call chmod before acl, because
+     chmod can change the contents of the ACL (in ways that don't
+     change the allowed accesses, but still visible).  */
+
+  early_chmod = (! MODE_INSIDE_ACL || (ctx->mode & (S_ISUID | S_ISGID | S_ISVTX)));
+# endif
+#else
+  /* No ACLs */
+
+  early_chmod = true;
+#endif
+
+  if (early_chmod)
+    {
+      ret = chmod_or_fchmod (name, desc, ctx->mode);
+      if (ret != 0)
+        return -1;
+    }
+
+#if USE_ACL
+  ret = set_acls (ctx, name, desc, false, &must_chmod, &acls_set);
+  if (! acls_set)
+    {
+      int saved_errno = ret ? errno : 0;
+
+      /* If we can't set an acl which we expect to be able to set, try setting
+         the permissions to ctx->mode. Due to possible inherited permissions,
+         we cannot simply chmod.  */
+
+      ret = set_acls (ctx, name, desc, true, &must_chmod, &acls_set);
+      if (! acls_set)
+        must_chmod = true;
+
+      if (saved_errno)
+        {
+          errno = saved_errno;
+          ret = -1;
+        }
+    }
+#endif
+
+  if (must_chmod && ! early_chmod)
+    {
+      int saved_errno = ret ? errno : 0;
+
+      ret = chmod_or_fchmod (name, desc, ctx->mode);
+
+      if (saved_errno)
+        {
+          errno = saved_errno;
+          ret = -1;
+        }
+    }
+
+  return ret;
+}
deleted file mode 120000 (symlink)
index ab07479fce72d791934b07d11c5eecdd2ff1028e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/setenv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9e2e9e2f0fd3891bc11b604ee96993724bb35323
--- /dev/null
@@ -0,0 +1,396 @@
+/* Copyright (C) 1992, 1995-2003, 2005-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if !_LIBC
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the name == NULL test below.  */
+# define _GL_ARG_NONNULL(params)
+
+# define _GL_USE_STDLIB_ALLOC 1
+# include <config.h>
+#endif
+
+#include <alloca.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#ifndef __set_errno
+# define __set_errno(ev) ((errno) = (ev))
+#endif
+
+#include <string.h>
+#if _LIBC || HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if !_LIBC
+# include "malloca.h"
+#endif
+
+#if _LIBC || !HAVE_SETENV
+
+#if !_LIBC
+# define __environ      environ
+#endif
+
+#if _LIBC
+/* This lock protects against simultaneous modifications of 'environ'.  */
+# include <bits/libc-lock.h>
+__libc_lock_define_initialized (static, envlock)
+# define LOCK   __libc_lock_lock (envlock)
+# define UNLOCK __libc_lock_unlock (envlock)
+#else
+# define LOCK
+# define UNLOCK
+#endif
+
+/* In the GNU C library we must keep the namespace clean.  */
+#ifdef _LIBC
+# define setenv __setenv
+# define clearenv __clearenv
+# define tfind __tfind
+# define tsearch __tsearch
+#endif
+
+/* In the GNU C library implementation we try to be more clever and
+   allow arbitrarily many changes of the environment given that the used
+   values are from a small set.  Outside glibc this will eat up all
+   memory after a while.  */
+#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
+                      && (defined __GNUC__ || defined __clang__))
+# define USE_TSEARCH    1
+# include <search.h>
+typedef int (*compar_fn_t) (const void *, const void *);
+
+/* This is a pointer to the root of the search tree with the known
+   values.  */
+static void *known_values;
+
+# define KNOWN_VALUE(Str) \
+  __extension__                                                               \
+  ({                                                                          \
+    void *value = tfind (Str, &known_values, (compar_fn_t) strcmp);           \
+    value != NULL ? *(char **) value : NULL;                                  \
+  })
+# define STORE_VALUE(Str) \
+  tsearch (Str, &known_values, (compar_fn_t) strcmp)
+
+#else
+# undef USE_TSEARCH
+
+# define KNOWN_VALUE(Str) NULL
+# define STORE_VALUE(Str) do { } while (0)
+
+#endif
+
+
+/* If this variable is not a null pointer we allocated the current
+   environment.  */
+static char **last_environ;
+
+
+/* This function is used by 'setenv' and 'putenv'.  The difference between
+   the two functions is that for the former must create a new string which
+   is then placed in the environment, while the argument of 'putenv'
+   must be used directly.  This is all complicated by the fact that we try
+   to reuse values once generated for a 'setenv' call since we can never
+   free the strings.  */
+int
+__add_to_environ (const char *name, const char *value, const char *combined,
+                  int replace)
+{
+  char **ep;
+  size_t size;
+  const size_t namelen = strlen (name);
+  const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
+
+  LOCK;
+
+  /* We have to get the pointer now that we have the lock and not earlier
+     since another thread might have created a new environment.  */
+  ep = __environ;
+
+  size = 0;
+  if (ep != NULL)
+    {
+      for (; *ep != NULL; ++ep)
+        if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
+          break;
+        else
+          ++size;
+    }
+
+  if (ep == NULL || *ep == NULL)
+    {
+      char **new_environ;
+#ifdef USE_TSEARCH
+      char *new_value;
+#endif
+
+      /* We allocated this space; we can extend it.  */
+      new_environ =
+        (char **) (last_environ == NULL
+                   ? malloc ((size + 2) * sizeof (char *))
+                   : realloc (last_environ, (size + 2) * sizeof (char *)));
+      if (new_environ == NULL)
+        {
+          /* It's easier to set errno to ENOMEM than to rely on the
+             'malloc-posix' and 'realloc-posix' gnulib modules.  */
+          __set_errno (ENOMEM);
+          UNLOCK;
+          return -1;
+        }
+
+      /* If the whole entry is given add it.  */
+      if (combined != NULL)
+        /* We must not add the string to the search tree since it belongs
+           to the user.  */
+        new_environ[size] = (char *) combined;
+      else
+        {
+          /* See whether the value is already known.  */
+#ifdef USE_TSEARCH
+# ifdef _LIBC
+          new_value = (char *) alloca (namelen + 1 + vallen);
+          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
+                     value, vallen);
+# else
+          new_value = (char *) malloca (namelen + 1 + vallen);
+          if (new_value == NULL)
+            {
+              __set_errno (ENOMEM);
+              UNLOCK;
+              return -1;
+            }
+          memcpy (new_value, name, namelen);
+          new_value[namelen] = '=';
+          memcpy (&new_value[namelen + 1], value, vallen);
+# endif
+
+          new_environ[size] = KNOWN_VALUE (new_value);
+          if (new_environ[size] == NULL)
+#endif
+            {
+              new_environ[size] = (char *) malloc (namelen + 1 + vallen);
+              if (new_environ[size] == NULL)
+                {
+#if defined USE_TSEARCH && !defined _LIBC
+                  freea (new_value);
+#endif
+                  __set_errno (ENOMEM);
+                  UNLOCK;
+                  return -1;
+                }
+
+#ifdef USE_TSEARCH
+              memcpy (new_environ[size], new_value, namelen + 1 + vallen);
+#else
+              memcpy (new_environ[size], name, namelen);
+              new_environ[size][namelen] = '=';
+              memcpy (&new_environ[size][namelen + 1], value, vallen);
+#endif
+              /* And save the value now.  We cannot do this when we remove
+                 the string since then we cannot decide whether it is a
+                 user string or not.  */
+              STORE_VALUE (new_environ[size]);
+            }
+#if defined USE_TSEARCH && !defined _LIBC
+          freea (new_value);
+#endif
+        }
+
+      if (__environ != last_environ)
+        memcpy ((char *) new_environ, (char *) __environ,
+                size * sizeof (char *));
+
+      new_environ[size + 1] = NULL;
+
+      last_environ = __environ = new_environ;
+    }
+  else if (replace)
+    {
+      char *np;
+
+      /* Use the user string if given.  */
+      if (combined != NULL)
+        np = (char *) combined;
+      else
+        {
+#ifdef USE_TSEARCH
+          char *new_value;
+# ifdef _LIBC
+          new_value = alloca (namelen + 1 + vallen);
+          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
+                     value, vallen);
+# else
+          new_value = malloca (namelen + 1 + vallen);
+          if (new_value == NULL)
+            {
+              __set_errno (ENOMEM);
+              UNLOCK;
+              return -1;
+            }
+          memcpy (new_value, name, namelen);
+          new_value[namelen] = '=';
+          memcpy (&new_value[namelen + 1], value, vallen);
+# endif
+
+          np = KNOWN_VALUE (new_value);
+          if (np == NULL)
+#endif
+            {
+              np = (char *) malloc (namelen + 1 + vallen);
+              if (np == NULL)
+                {
+#if defined USE_TSEARCH && !defined _LIBC
+                  freea (new_value);
+#endif
+                  __set_errno (ENOMEM);
+                  UNLOCK;
+                  return -1;
+                }
+
+#ifdef USE_TSEARCH
+              memcpy (np, new_value, namelen + 1 + vallen);
+#else
+              memcpy (np, name, namelen);
+              np[namelen] = '=';
+              memcpy (&np[namelen + 1], value, vallen);
+#endif
+              /* And remember the value.  */
+              STORE_VALUE (np);
+            }
+#if defined USE_TSEARCH && !defined _LIBC
+          freea (new_value);
+#endif
+        }
+
+      *ep = np;
+    }
+
+  UNLOCK;
+
+  return 0;
+}
+
+int
+setenv (const char *name, const char *value, int replace)
+{
+  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __add_to_environ (name, value, NULL, replace);
+}
+
+/* The 'clearenv' was planned to be added to POSIX.1 but probably
+   never made it.  Nevertheless the POSIX.9 standard (POSIX bindings
+   for Fortran 77) requires this function.  */
+int
+clearenv (void)
+{
+  LOCK;
+
+  if (__environ == last_environ && __environ != NULL)
+    {
+      /* We allocated this environment so we can free it.  */
+      free (__environ);
+      last_environ = NULL;
+    }
+
+  /* Clear the environment pointer removes the whole environment.  */
+  __environ = NULL;
+
+  UNLOCK;
+
+  return 0;
+}
+
+#ifdef _LIBC
+static void
+free_mem (void)
+{
+  /* Remove all traces.  */
+  clearenv ();
+
+  /* Now remove the search tree.  */
+  __tdestroy (known_values, free);
+  known_values = NULL;
+}
+text_set_element (__libc_subfreeres, free_mem);
+
+
+# undef setenv
+# undef clearenv
+weak_alias (__setenv, setenv)
+weak_alias (__clearenv, clearenv)
+#endif
+
+#endif /* _LIBC || !HAVE_SETENV */
+
+/* The rest of this file is called into use when replacing an existing
+   but buggy setenv.  Known bugs include failure to diagnose invalid
+   name, and consuming a leading '=' from value.  */
+#if HAVE_SETENV
+
+# undef setenv
+# if !HAVE_DECL_SETENV
+extern int setenv (const char *, const char *, int);
+# endif
+# define STREQ(a, b) (strcmp (a, b) == 0)
+
+int
+rpl_setenv (const char *name, const char *value, int replace)
+{
+  int result;
+  if (!name || !*name || strchr (name, '='))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  /* Call the real setenv even if replace is 0, in case implementation
+     has underlying data to update, such as when environ changes.  */
+  result = setenv (name, value, replace);
+  if (result == 0 && replace && *value == '=')
+    {
+      char *tmp = getenv (name);
+      if (!STREQ (tmp, value))
+        {
+          int saved_errno;
+          size_t len = strlen (value);
+          tmp = malloca (len + 2);
+          if (tmp == NULL)
+            {
+              errno = ENOMEM;
+              return -1;
+            }
+          /* Since leading '=' is eaten, double it up.  */
+          *tmp = '=';
+          memcpy (tmp + 1, value, len + 1);
+          result = setenv (name, tmp, replace);
+          saved_errno = errno;
+          freea (tmp);
+          errno = saved_errno;
+        }
+    }
+  return result;
+}
+
+#endif /* HAVE_SETENV */
deleted file mode 120000 (symlink)
index 542ed0b6f0ef021409f2651d5e4cd2ffef6f1bd5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/setlocale-lock.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..192489c4ab9308fb50cb93939e050be67df788cc
--- /dev/null
@@ -0,0 +1,151 @@
+/* Return the internal lock used by setlocale_null_r.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* The option '--disable-threads' explicitly requests no locking.  */
+/* When it is known that the gl_get_setlocale_null_lock function is defined
+   by a dependency library, it should not be defined here.  */
+#if AVOID_ANY_THREADS || OMIT_SETLOCALE_LOCK
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#else
+
+/* This file defines the internal lock used by setlocale_null_r.
+   It is a separate compilation unit, so that only one copy of it is
+   present when linking statically.  */
+
+/* Prohibit renaming this symbol.  */
+# undef gl_get_setlocale_null_lock
+
+/* Macro for exporting a symbol (function, not variable) defined in this file,
+   when compiled into a shared library.  */
+# ifndef SHLIB_EXPORTED
+#  if HAVE_VISIBILITY
+  /* Override the effect of the compiler option '-fvisibility=hidden'.  */
+#   define SHLIB_EXPORTED __attribute__((__visibility__("default")))
+#  elif defined _WIN32 || defined __CYGWIN__
+#   define SHLIB_EXPORTED __declspec(dllexport)
+#  else
+#   define SHLIB_EXPORTED
+#  endif
+# endif
+
+# if defined _WIN32 && !defined __CYGWIN__
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+#  include "windows-initguard.h"
+
+/* The return type is a 'CRITICAL_SECTION *', not a 'glwthread_mutex_t *',
+   because the latter is not guaranteed to be a stable ABI in the future.  */
+
+/* Make sure the function gets exported from DLLs.  */
+SHLIB_EXPORTED CRITICAL_SECTION *gl_get_setlocale_null_lock (void);
+
+static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT;
+static CRITICAL_SECTION lock;
+
+/* Returns the internal lock used by setlocale_null_r.  */
+CRITICAL_SECTION *
+gl_get_setlocale_null_lock (void)
+{
+  if (!guard.done)
+    {
+      if (InterlockedIncrement (&guard.started) == 0)
+        {
+          /* This thread is the first one to need the lock.  Initialize it.  */
+          InitializeCriticalSection (&lock);
+          guard.done = 1;
+        }
+      else
+        {
+          /* Don't let guard.started grow and wrap around.  */
+          InterlockedDecrement (&guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this mutex.  */
+          while (!guard.done)
+            Sleep (0);
+        }
+    }
+  return &lock;
+}
+
+# elif HAVE_PTHREAD_API
+
+#  include <pthread.h>
+
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* Make sure the function gets exported from shared libraries.  */
+SHLIB_EXPORTED pthread_mutex_t *gl_get_setlocale_null_lock (void);
+
+/* Returns the internal lock used by setlocale_null_r.  */
+pthread_mutex_t *
+gl_get_setlocale_null_lock (void)
+{
+  return &mutex;
+}
+
+# elif HAVE_THREADS_H
+
+#  include <threads.h>
+#  include <stdlib.h>
+
+static int volatile init_needed = 1;
+static once_flag init_once = ONCE_FLAG_INIT;
+static mtx_t mutex;
+
+static void
+atomic_init (void)
+{
+  if (mtx_init (&mutex, mtx_plain) != thrd_success)
+    abort ();
+  init_needed = 0;
+}
+
+/* Make sure the function gets exported from shared libraries.  */
+SHLIB_EXPORTED mtx_t *gl_get_setlocale_null_lock (void);
+
+/* Returns the internal lock used by setlocale_null_r.  */
+mtx_t *
+gl_get_setlocale_null_lock (void)
+{
+  if (init_needed)
+    call_once (&init_once, atomic_init);
+  return &mutex;
+}
+
+# endif
+
+# if (defined _WIN32 || defined __CYGWIN__) && !defined _MSC_VER
+/* Make sure the '__declspec(dllimport)' in setlocale_null.c does not cause
+   a link failure when no DLLs are involved.  */
+#  if defined _WIN64 || defined _LP64
+#   define IMP(x) __imp_##x
+#  else
+#   define IMP(x) _imp__##x
+#  endif
+void * IMP(gl_get_setlocale_null_lock) = &gl_get_setlocale_null_lock;
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index f05ebcc108416ea10b25bf7964447062ee9688f8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/setlocale_null.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..697502fbfe8bb088234a7fbfbabb5dfe04aca748
--- /dev/null
@@ -0,0 +1,422 @@
+/* Query the name of the current global locale.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "setlocale_null.h"
+
+#include <errno.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined _WIN32 && !defined __CYGWIN__
+# include <wchar.h>
+#endif
+
+#if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE)
+
+# if AVOID_ANY_THREADS
+
+/* The option '--disable-threads' explicitly requests no locking.  */
+
+# elif defined _WIN32 && !defined __CYGWIN__
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+# elif HAVE_PTHREAD_API
+
+#  include <pthread.h>
+#  if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS
+#   include <threads.h>
+#   pragma weak thrd_exit
+#   define c11_threads_in_use() (thrd_exit != NULL)
+#  else
+#   define c11_threads_in_use() 0
+#  endif
+
+# elif HAVE_THREADS_H
+
+#  include <threads.h>
+
+# endif
+
+#endif
+
+/* Use the system's setlocale() function, not the gnulib override, here.  */
+#undef setlocale
+
+static const char *
+setlocale_null_androidfix (int category)
+{
+  const char *result = setlocale (category, NULL);
+
+#ifdef __ANDROID__
+  if (result == NULL)
+    switch (category)
+      {
+      case LC_CTYPE:
+      case LC_NUMERIC:
+      case LC_TIME:
+      case LC_COLLATE:
+      case LC_MONETARY:
+      case LC_MESSAGES:
+      case LC_ALL:
+      case LC_PAPER:
+      case LC_NAME:
+      case LC_ADDRESS:
+      case LC_TELEPHONE:
+      case LC_MEASUREMENT:
+        result = "C";
+        break;
+      default:
+        break;
+      }
+#endif
+
+  return result;
+}
+
+static int
+setlocale_null_unlocked (int category, char *buf, size_t bufsize)
+{
+#if defined _WIN32 && !defined __CYGWIN__ && defined _MSC_VER
+  /* On native Windows, nowadays, the setlocale() implementation is based
+     on _wsetlocale() and uses malloc() for the result.  We are better off
+     using _wsetlocale() directly.  */
+  const wchar_t *result = _wsetlocale (category, NULL);
+
+  if (result == NULL)
+    {
+      /* CATEGORY is invalid.  */
+      if (bufsize > 0)
+        /* Return an empty string in BUF.
+           This is a convenience for callers that don't want to write explicit
+           code for handling EINVAL.  */
+        buf[0] = '\0';
+      return EINVAL;
+    }
+  else
+    {
+      size_t length = wcslen (result);
+      if (length < bufsize)
+        {
+          size_t i;
+
+          /* Convert wchar_t[] -> char[], assuming plain ASCII.  */
+          for (i = 0; i <= length; i++)
+            buf[i] = result[i];
+
+          return 0;
+        }
+      else
+        {
+          if (bufsize > 0)
+            {
+              /* Return a truncated result in BUF.
+                 This is a convenience for callers that don't want to write
+                 explicit code for handling ERANGE.  */
+              size_t i;
+
+              /* Convert wchar_t[] -> char[], assuming plain ASCII.  */
+              for (i = 0; i < bufsize; i++)
+                buf[i] = result[i];
+              buf[bufsize - 1] = '\0';
+            }
+          return ERANGE;
+        }
+    }
+#else
+  const char *result = setlocale_null_androidfix (category);
+
+  if (result == NULL)
+    {
+      /* CATEGORY is invalid.  */
+      if (bufsize > 0)
+        /* Return an empty string in BUF.
+           This is a convenience for callers that don't want to write explicit
+           code for handling EINVAL.  */
+        buf[0] = '\0';
+      return EINVAL;
+    }
+  else
+    {
+      size_t length = strlen (result);
+      if (length < bufsize)
+        {
+          memcpy (buf, result, length + 1);
+          return 0;
+        }
+      else
+        {
+          if (bufsize > 0)
+            {
+              /* Return a truncated result in BUF.
+                 This is a convenience for callers that don't want to write
+                 explicit code for handling ERANGE.  */
+              memcpy (buf, result, bufsize - 1);
+              buf[bufsize - 1] = '\0';
+            }
+          return ERANGE;
+        }
+    }
+#endif
+}
+
+#if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin < 3.4.6 */
+
+/* Use a lock, so that no two threads can invoke setlocale_null_unlocked
+   at the same time.  */
+
+/* Prohibit renaming this symbol.  */
+# undef gl_get_setlocale_null_lock
+
+# if AVOID_ANY_THREADS
+
+/* The option '--disable-threads' explicitly requests no locking.  */
+#  define setlocale_null_with_lock setlocale_null_unlocked
+
+# elif defined _WIN32 && !defined __CYGWIN__
+
+extern __declspec(dllimport) CRITICAL_SECTION *gl_get_setlocale_null_lock (void);
+
+static int
+setlocale_null_with_lock (int category, char *buf, size_t bufsize)
+{
+  CRITICAL_SECTION *lock = gl_get_setlocale_null_lock ();
+  int ret;
+
+  EnterCriticalSection (lock);
+  ret = setlocale_null_unlocked (category, buf, bufsize);
+  LeaveCriticalSection (lock);
+
+  return ret;
+}
+
+# elif HAVE_PTHREAD_API /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin < 3.4.6 */
+
+extern
+#  if defined _WIN32 || defined __CYGWIN__
+  __declspec(dllimport)
+#  endif
+  pthread_mutex_t *gl_get_setlocale_null_lock (void);
+
+#  if HAVE_WEAK_SYMBOLS /* musl libc, FreeBSD, NetBSD, OpenBSD, Haiku */
+
+    /* Avoid the need to link with '-lpthread'.  */
+#   pragma weak pthread_mutex_lock
+#   pragma weak pthread_mutex_unlock
+
+    /* Determine whether libpthread is in use.  */
+#   pragma weak pthread_mutexattr_gettype
+    /* See the comments in lock.h.  */
+#   define pthread_in_use() \
+      (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
+
+#  else
+#   define pthread_in_use() 1
+#  endif
+
+static int
+setlocale_null_with_lock (int category, char *buf, size_t bufsize)
+{
+  if (pthread_in_use())
+    {
+      pthread_mutex_t *lock = gl_get_setlocale_null_lock ();
+      int ret;
+
+      if (pthread_mutex_lock (lock))
+        abort ();
+      ret = setlocale_null_unlocked (category, buf, bufsize);
+      if (pthread_mutex_unlock (lock))
+        abort ();
+
+      return ret;
+    }
+  else
+    return setlocale_null_unlocked (category, buf, bufsize);
+}
+
+# elif HAVE_THREADS_H
+
+extern mtx_t *gl_get_setlocale_null_lock (void);
+
+static int
+setlocale_null_with_lock (int category, char *buf, size_t bufsize)
+{
+  mtx_t *lock = gl_get_setlocale_null_lock ();
+  int ret;
+
+  if (mtx_lock (lock) != thrd_success)
+    abort ();
+  ret = setlocale_null_unlocked (category, buf, bufsize);
+  if (mtx_unlock (lock) != thrd_success)
+    abort ();
+
+  return ret;
+}
+
+# endif
+
+#endif
+
+int
+setlocale_null_r (int category, char *buf, size_t bufsize)
+{
+#if SETLOCALE_NULL_ALL_MTSAFE
+# if SETLOCALE_NULL_ONE_MTSAFE
+
+  return setlocale_null_unlocked (category, buf, bufsize);
+
+# else
+
+  if (category == LC_ALL)
+    return setlocale_null_unlocked (category, buf, bufsize);
+  else
+    return setlocale_null_with_lock (category, buf, bufsize);
+
+# endif
+#else
+# if SETLOCALE_NULL_ONE_MTSAFE
+
+  if (category == LC_ALL)
+    return setlocale_null_with_lock (category, buf, bufsize);
+  else
+    return setlocale_null_unlocked (category, buf, bufsize);
+
+# else
+
+  return setlocale_null_with_lock (category, buf, bufsize);
+
+# endif
+#endif
+}
+
+const char *
+setlocale_null (int category)
+{
+#if SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE
+  return setlocale_null_androidfix (category);
+#else
+
+  /* This call must be multithread-safe.  To achieve this without using
+     thread-local storage:
+       1. We use a specific static buffer for each possible CATEGORY
+          argument.  So that different threads can call setlocale_mtsafe
+          with different CATEGORY arguments, without interfering.
+       2. We use a simple strcpy or memcpy to fill this static buffer.
+          Filling it through, for example, strcpy + strcat would not be
+          guaranteed to leave the buffer's contents intact if another thread
+          is currently accessing it.  If necessary, the contents is first
+          assembled in a stack-allocated buffer.  */
+  if (category == LC_ALL)
+    {
+# if SETLOCALE_NULL_ALL_MTSAFE
+      return setlocale_null_androidfix (LC_ALL);
+# else
+      char buf[SETLOCALE_NULL_ALL_MAX];
+      static char resultbuf[SETLOCALE_NULL_ALL_MAX];
+
+      if (setlocale_null_r (LC_ALL, buf, sizeof (buf)))
+        return "C";
+      strcpy (resultbuf, buf);
+      return resultbuf;
+# endif
+    }
+  else
+    {
+# if SETLOCALE_NULL_ONE_MTSAFE
+      return setlocale_null_androidfix (category);
+# else
+      enum
+        {
+          LC_CTYPE_INDEX,
+          LC_NUMERIC_INDEX,
+          LC_TIME_INDEX,
+          LC_COLLATE_INDEX,
+          LC_MONETARY_INDEX,
+          LC_MESSAGES_INDEX,
+#  ifdef LC_PAPER
+          LC_PAPER_INDEX,
+#  endif
+#  ifdef LC_NAME
+          LC_NAME_INDEX,
+#  endif
+#  ifdef LC_ADDRESS
+          LC_ADDRESS_INDEX,
+#  endif
+#  ifdef LC_TELEPHONE
+          LC_TELEPHONE_INDEX,
+#  endif
+#  ifdef LC_MEASUREMENT
+          LC_MEASUREMENT_INDEX,
+#  endif
+#  ifdef LC_IDENTIFICATION
+          LC_IDENTIFICATION_INDEX,
+#  endif
+          LC_INDICES_COUNT
+        }
+        i;
+      char buf[SETLOCALE_NULL_MAX];
+      static char resultbuf[LC_INDICES_COUNT][SETLOCALE_NULL_MAX];
+      int err;
+
+      err = setlocale_null_r (category, buf, sizeof (buf));
+      if (err == EINVAL)
+        return NULL;
+      if (err)
+        return "C";
+
+      switch (category)
+        {
+        case LC_CTYPE:          i = LC_CTYPE_INDEX;          break;
+        case LC_NUMERIC:        i = LC_NUMERIC_INDEX;        break;
+        case LC_TIME:           i = LC_TIME_INDEX;           break;
+        case LC_COLLATE:        i = LC_COLLATE_INDEX;        break;
+        case LC_MONETARY:       i = LC_MONETARY_INDEX;       break;
+        case LC_MESSAGES:       i = LC_MESSAGES_INDEX;       break;
+#  ifdef LC_PAPER
+        case LC_PAPER:          i = LC_PAPER_INDEX;          break;
+#  endif
+#  ifdef LC_NAME
+        case LC_NAME:           i = LC_NAME_INDEX;           break;
+#  endif
+#  ifdef LC_ADDRESS
+        case LC_ADDRESS:        i = LC_ADDRESS_INDEX;        break;
+#  endif
+#  ifdef LC_TELEPHONE
+        case LC_TELEPHONE:      i = LC_TELEPHONE_INDEX;      break;
+#  endif
+#  ifdef LC_MEASUREMENT
+        case LC_MEASUREMENT:    i = LC_MEASUREMENT_INDEX;    break;
+#  endif
+#  ifdef LC_IDENTIFICATION
+        case LC_IDENTIFICATION: i = LC_IDENTIFICATION_INDEX; break;
+#  endif
+        default:
+          /* If you get here, a #ifdef LC_xxx is missing.  */
+          abort ();
+        }
+
+      strcpy (resultbuf[i], buf);
+      return resultbuf[i];
+# endif
+    }
+#endif
+}
deleted file mode 120000 (symlink)
index 23a50a70959db3057fb955e99b7c844637c1ea2b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/setlocale_null.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..defa2b41a634adbaa94e2aaf8c84248504a1ab26
--- /dev/null
@@ -0,0 +1,82 @@
+/* Query the name of the current global locale.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#ifndef _SETLOCALE_NULL_H
+#define _SETLOCALE_NULL_H
+
+#include <stddef.h>
+
+#include "arg-nonnull.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Recommended size of a buffer for a locale name for a single category.
+   On glibc systems, you can have locale names that are relative file names;
+   assume a maximum length 256.
+   In native Windows, in 2018 the longest locale name was of length 58
+   ("FYRO Macedonian_Former Yugoslav Republic of Macedonia.1251").  */
+#define SETLOCALE_NULL_MAX (256+1)
+
+/* Recommended size of a buffer for a locale name with all categories.
+   On glibc systems, you can have locale names that are relative file names;
+   assume maximum length 256 for each.  There are 12 categories; so, the
+   maximum total length is 148+12*256.
+   In native Windows, there are 5 categories, and the maximum total length is
+   55+5*58.  */
+#define SETLOCALE_NULL_ALL_MAX (148+12*256+1)
+
+/* setlocale_null_r (CATEGORY, BUF, BUFSIZE) is like setlocale (CATEGORY, NULL),
+   except that
+     - it is guaranteed to be multithread-safe,
+     - it returns the resulting locale category name or locale name in the
+       user-supplied buffer BUF, which must be BUFSIZE bytes long.
+   The recommended minimum buffer size is
+     - SETLOCALE_NULL_MAX for CATEGORY != LC_ALL, and
+     - SETLOCALE_NULL_ALL_MAX for CATEGORY == LC_ALL.
+   The return value is an error code: 0 if the call is successful, EINVAL if
+   CATEGORY is invalid, or ERANGE if BUFSIZE is smaller than the length needed
+   size (including the trailing NUL byte).  In the latter case, a truncated
+   result is returned in BUF, but still NUL-terminated if BUFSIZE > 0.
+   For this call to be multithread-safe, *all* calls to
+   setlocale (CATEGORY, NULL) in all other threads must have been converted
+   to use setlocale_null_r or setlocale_null as well, and the other threads
+   must not make other setlocale invocations (since changing the global locale
+   has side effects on all threads).  */
+extern int setlocale_null_r (int category, char *buf, size_t bufsize)
+  _GL_ARG_NONNULL ((2));
+
+/* setlocale_null (CATEGORY) is like setlocale (CATEGORY, NULL), except that
+   it is guaranteed to be multithread-safe.
+   The return value is NULL if CATEGORY is invalid.
+   For this call to be multithread-safe, *all* calls to
+   setlocale (CATEGORY, NULL) in all other threads must have been converted
+   to use setlocale_null_r or setlocale_null as well, and the other threads
+   must not make other setlocale invocations (since changing the global locale
+   has side effects on all threads).  */
+extern const char *setlocale_null (int category);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SETLOCALE_NULL_H */
deleted file mode 120000 (symlink)
index ea7c0820807088ee8f272aef361f3c489959c52a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/settime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..493bf0f57afbd3297d6c96ad0071737be14df6ae
--- /dev/null
@@ -0,0 +1,57 @@
+/* settime -- set the system clock
+
+   Copyright (C) 2002, 2004-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "timespec.h"
+
+#include <sys/time.h>
+#include <unistd.h>
+
+#include <errno.h>
+
+/* Set the system time.  */
+
+int
+settime (struct timespec const *ts)
+{
+#if defined CLOCK_REALTIME && HAVE_CLOCK_SETTIME
+  {
+    int r = clock_settime (CLOCK_REALTIME, ts);
+    if (r == 0 || errno == EPERM)
+      return r;
+  }
+#endif
+
+#if HAVE_SETTIMEOFDAY
+  {
+    struct timeval tv = { .tv_sec = ts->tv_sec,
+                          .tv_usec = ts->tv_nsec / 1000 };
+    return settimeofday (&tv, 0);
+  }
+#elif HAVE_STIME
+  /* This fails to compile on OSF1 V5.1, due to stime requiring
+     a 'long int*' and tv_sec is 'int'.  But that system does provide
+     settimeofday.  */
+  return stime (&ts->tv_sec);
+#else
+  errno = ENOSYS;
+  return -1;
+#endif
+}
deleted file mode 120000 (symlink)
index 79924feab4a8babd5a984065d5d2258a45267911..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sha1-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7bf44e5ea3f779b2960c8bf66e98e280a999a81d
--- /dev/null
@@ -0,0 +1,129 @@
+/* sha1.c - Functions to compute SHA1 message digest of files or
+   memory blocks according to the NIST specification FIPS-180-1.
+
+   Copyright (C) 2000-2001, 2003-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Scott G. Miller
+   Credits:
+      Robert Klep <robert@ilse.nl>  -- Expansion function fix
+*/
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_SHA1
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "sha1.h"
+
+#include <stdlib.h>
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+#include "af_alg.h"
+
+#define BLOCKSIZE 32768
+#if BLOCKSIZE % 64 != 0
+# error "invalid BLOCKSIZE"
+#endif
+
+/* Compute SHA1 message digest for bytes read from STREAM.  The
+   resulting message digest number will be written into the 20 bytes
+   beginning at RESBLOCK.  */
+int
+sha1_stream (FILE *stream, void *resblock)
+{
+  switch (afalg_stream (stream, "sha1", resblock, SHA1_DIGEST_SIZE))
+    {
+    case 0: return 0;
+    case -EIO: return 1;
+    }
+
+  char *buffer = malloc (BLOCKSIZE + 72);
+  if (!buffer)
+    return 1;
+
+  struct sha1_ctx ctx;
+  sha1_init_ctx (&ctx);
+  size_t sum;
+
+  /* Iterate over full file contents.  */
+  while (1)
+    {
+      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
+         computation function processes the whole buffer so that with the
+         next round of the loop another block can be read.  */
+      size_t n;
+      sum = 0;
+
+      /* Read block.  Take care for partial reads.  */
+      while (1)
+        {
+          /* Either process a partial fread() from this loop,
+             or the fread() in afalg_stream may have gotten EOF.
+             We need to avoid a subsequent fread() as EOF may
+             not be sticky.  For details of such systems, see:
+             https://sourceware.org/bugzilla/show_bug.cgi?id=1190  */
+          if (feof (stream))
+            goto process_partial_block;
+
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+          sum += n;
+
+          if (sum == BLOCKSIZE)
+            break;
+
+          if (n == 0)
+            {
+              /* Check for the error flag IFF N == 0, so that we don't
+                 exit the loop after a partial read due to e.g., EAGAIN
+                 or EWOULDBLOCK.  */
+              if (ferror (stream))
+                {
+                  free (buffer);
+                  return 1;
+                }
+              goto process_partial_block;
+            }
+        }
+
+      /* Process buffer with BLOCKSIZE bytes.  Note that
+                        BLOCKSIZE % 64 == 0
+       */
+      sha1_process_block (buffer, BLOCKSIZE, &ctx);
+    }
+
+ process_partial_block:;
+
+  /* Process any remaining bytes.  */
+  if (sum > 0)
+    sha1_process_bytes (buffer, sum, &ctx);
+
+  /* Construct result in desired memory.  */
+  sha1_finish_ctx (&ctx, resblock);
+  free (buffer);
+  return 0;
+}
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 9484aba60bcdd1de2e2941a8f9c93d2ccf7e5be0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sha1.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..24fcd0b0139321819eda32db010678a2111579e0
--- /dev/null
@@ -0,0 +1,360 @@
+/* sha1.c - Functions to compute SHA1 message digest of files or
+   memory blocks according to the NIST specification FIPS-180-1.
+
+   Copyright (C) 2000-2001, 2003-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Scott G. Miller
+   Credits:
+      Robert Klep <robert@ilse.nl>  -- Expansion function fix
+*/
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_SHA1
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "sha1.h"
+
+#include <stdint.h>
+#include <string.h>
+
+#include <byteswap.h>
+#ifdef WORDS_BIGENDIAN
+# define SWAP(n) (n)
+#else
+# define SWAP(n) bswap_32 (n)
+#endif
+
+#if ! HAVE_OPENSSL_SHA1
+
+/* This array contains the bytes used to pad the buffer to the next
+   64-byte boundary.  (RFC 1321, 3.1: Step 1)  */
+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
+
+
+/* Take a pointer to a 160 bit block of data (five 32 bit ints) and
+   initialize it to the start constants of the SHA1 algorithm.  This
+   must be called before using hash in the call to sha1_hash.  */
+void
+sha1_init_ctx (struct sha1_ctx *ctx)
+{
+  ctx->A = 0x67452301;
+  ctx->B = 0xefcdab89;
+  ctx->C = 0x98badcfe;
+  ctx->D = 0x10325476;
+  ctx->E = 0xc3d2e1f0;
+
+  ctx->total[0] = ctx->total[1] = 0;
+  ctx->buflen = 0;
+}
+
+/* Copy the 4 byte value from v into the memory location pointed to by *cp,
+   If your architecture allows unaligned access this is equivalent to
+   * (uint32_t *) cp = v  */
+static void
+set_uint32 (char *cp, uint32_t v)
+{
+  memcpy (cp, &v, sizeof v);
+}
+
+/* Put result from CTX in first 20 bytes following RESBUF.  The result
+   must be in little endian byte order.  */
+void *
+sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
+{
+  char *r = resbuf;
+  set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A));
+  set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B));
+  set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C));
+  set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D));
+  set_uint32 (r + 4 * sizeof ctx->E, SWAP (ctx->E));
+
+  return resbuf;
+}
+
+/* Process the remaining bytes in the internal buffer and the usual
+   prolog according to the standard and write the result to RESBUF.  */
+void *
+sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
+{
+  /* Take yet unprocessed bytes into account.  */
+  uint32_t bytes = ctx->buflen;
+  size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
+
+  /* Now count remaining bytes.  */
+  ctx->total[0] += bytes;
+  if (ctx->total[0] < bytes)
+    ++ctx->total[1];
+
+  /* Put the 64-bit file length in *bits* at the end of the buffer.  */
+  ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
+  ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
+
+  memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
+
+  /* Process last bytes.  */
+  sha1_process_block (ctx->buffer, size * 4, ctx);
+
+  return sha1_read_ctx (ctx, resbuf);
+}
+
+/* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+void *
+sha1_buffer (const char *buffer, size_t len, void *resblock)
+{
+  struct sha1_ctx ctx;
+
+  /* Initialize the computation context.  */
+  sha1_init_ctx (&ctx);
+
+  /* Process whole buffer but last len % 64 bytes.  */
+  sha1_process_bytes (buffer, len, &ctx);
+
+  /* Put result in desired memory area.  */
+  return sha1_finish_ctx (&ctx, resblock);
+}
+
+void
+sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
+{
+  /* When we already have some bits in our internal buffer concatenate
+     both inputs first.  */
+  if (ctx->buflen != 0)
+    {
+      size_t left_over = ctx->buflen;
+      size_t add = 128 - left_over > len ? len : 128 - left_over;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
+      ctx->buflen += add;
+
+      if (ctx->buflen > 64)
+        {
+          sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+
+          ctx->buflen &= 63;
+          /* The regions in the following copy operation cannot overlap,
+             because ctx->buflen < 64 ≤ (left_over + add) & ~63.  */
+          memcpy (ctx->buffer,
+                  &((char *) ctx->buffer)[(left_over + add) & ~63],
+                  ctx->buflen);
+        }
+
+      buffer = (const char *) buffer + add;
+      len -= add;
+    }
+
+  /* Process available complete blocks.  */
+  if (len >= 64)
+    {
+#if !(_STRING_ARCH_unaligned || _STRING_INLINE_unaligned)
+# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
+      if (UNALIGNED_P (buffer))
+        while (len > 64)
+          {
+            sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+            buffer = (const char *) buffer + 64;
+            len -= 64;
+          }
+      else
+#endif
+        {
+          sha1_process_block (buffer, len & ~63, ctx);
+          buffer = (const char *) buffer + (len & ~63);
+          len &= 63;
+        }
+    }
+
+  /* Move remaining bytes in internal buffer.  */
+  if (len > 0)
+    {
+      size_t left_over = ctx->buflen;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
+      left_over += len;
+      if (left_over >= 64)
+        {
+          sha1_process_block (ctx->buffer, 64, ctx);
+          left_over -= 64;
+          /* The regions in the following copy operation cannot overlap,
+             because left_over ≤ 64.  */
+          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
+      ctx->buflen = left_over;
+    }
+}
+
+/* --- Code below is the primary difference between md5.c and sha1.c --- */
+
+/* SHA1 round constants */
+#define K1 0x5a827999
+#define K2 0x6ed9eba1
+#define K3 0x8f1bbcdc
+#define K4 0xca62c1d6
+
+/* Round functions.  Note that F2 is the same as F4.  */
+#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
+#define F2(B,C,D) (B ^ C ^ D)
+#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) )
+#define F4(B,C,D) (B ^ C ^ D)
+
+/* Process LEN bytes of BUFFER, accumulating context into CTX.
+   It is assumed that LEN % 64 == 0.
+   Most of this code comes from GnuPG's cipher/sha1.c.  */
+
+void
+sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
+{
+  const uint32_t *words = buffer;
+  size_t nwords = len / sizeof (uint32_t);
+  const uint32_t *endp = words + nwords;
+  uint32_t x[16];
+  uint32_t a = ctx->A;
+  uint32_t b = ctx->B;
+  uint32_t c = ctx->C;
+  uint32_t d = ctx->D;
+  uint32_t e = ctx->E;
+  uint32_t lolen = len;
+
+  /* First increment the byte count.  RFC 1321 specifies the possible
+     length of the file up to 2^64 bits.  Here we only compute the
+     number of bytes.  Do a double word increment.  */
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
+
+#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
+
+#define M(I) ( tm =   x[I&0x0f] ^ x[(I-14)&0x0f] \
+                    ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
+               , (x[I&0x0f] = rol(tm, 1)) )
+
+#define R(A,B,C,D,E,F,K,M)  do { E += rol( A, 5 )     \
+                                      + F( B, C, D )  \
+                                      + K             \
+                                      + M;            \
+                                 B = rol( B, 30 );    \
+                               } while(0)
+
+  while (words < endp)
+    {
+      uint32_t tm;
+      int t;
+      for (t = 0; t < 16; t++)
+        {
+          x[t] = SWAP (*words);
+          words++;
+        }
+
+      R( a, b, c, d, e, F1, K1, x[ 0] );
+      R( e, a, b, c, d, F1, K1, x[ 1] );
+      R( d, e, a, b, c, F1, K1, x[ 2] );
+      R( c, d, e, a, b, F1, K1, x[ 3] );
+      R( b, c, d, e, a, F1, K1, x[ 4] );
+      R( a, b, c, d, e, F1, K1, x[ 5] );
+      R( e, a, b, c, d, F1, K1, x[ 6] );
+      R( d, e, a, b, c, F1, K1, x[ 7] );
+      R( c, d, e, a, b, F1, K1, x[ 8] );
+      R( b, c, d, e, a, F1, K1, x[ 9] );
+      R( a, b, c, d, e, F1, K1, x[10] );
+      R( e, a, b, c, d, F1, K1, x[11] );
+      R( d, e, a, b, c, F1, K1, x[12] );
+      R( c, d, e, a, b, F1, K1, x[13] );
+      R( b, c, d, e, a, F1, K1, x[14] );
+      R( a, b, c, d, e, F1, K1, x[15] );
+      R( e, a, b, c, d, F1, K1, M(16) );
+      R( d, e, a, b, c, F1, K1, M(17) );
+      R( c, d, e, a, b, F1, K1, M(18) );
+      R( b, c, d, e, a, F1, K1, M(19) );
+      R( a, b, c, d, e, F2, K2, M(20) );
+      R( e, a, b, c, d, F2, K2, M(21) );
+      R( d, e, a, b, c, F2, K2, M(22) );
+      R( c, d, e, a, b, F2, K2, M(23) );
+      R( b, c, d, e, a, F2, K2, M(24) );
+      R( a, b, c, d, e, F2, K2, M(25) );
+      R( e, a, b, c, d, F2, K2, M(26) );
+      R( d, e, a, b, c, F2, K2, M(27) );
+      R( c, d, e, a, b, F2, K2, M(28) );
+      R( b, c, d, e, a, F2, K2, M(29) );
+      R( a, b, c, d, e, F2, K2, M(30) );
+      R( e, a, b, c, d, F2, K2, M(31) );
+      R( d, e, a, b, c, F2, K2, M(32) );
+      R( c, d, e, a, b, F2, K2, M(33) );
+      R( b, c, d, e, a, F2, K2, M(34) );
+      R( a, b, c, d, e, F2, K2, M(35) );
+      R( e, a, b, c, d, F2, K2, M(36) );
+      R( d, e, a, b, c, F2, K2, M(37) );
+      R( c, d, e, a, b, F2, K2, M(38) );
+      R( b, c, d, e, a, F2, K2, M(39) );
+      R( a, b, c, d, e, F3, K3, M(40) );
+      R( e, a, b, c, d, F3, K3, M(41) );
+      R( d, e, a, b, c, F3, K3, M(42) );
+      R( c, d, e, a, b, F3, K3, M(43) );
+      R( b, c, d, e, a, F3, K3, M(44) );
+      R( a, b, c, d, e, F3, K3, M(45) );
+      R( e, a, b, c, d, F3, K3, M(46) );
+      R( d, e, a, b, c, F3, K3, M(47) );
+      R( c, d, e, a, b, F3, K3, M(48) );
+      R( b, c, d, e, a, F3, K3, M(49) );
+      R( a, b, c, d, e, F3, K3, M(50) );
+      R( e, a, b, c, d, F3, K3, M(51) );
+      R( d, e, a, b, c, F3, K3, M(52) );
+      R( c, d, e, a, b, F3, K3, M(53) );
+      R( b, c, d, e, a, F3, K3, M(54) );
+      R( a, b, c, d, e, F3, K3, M(55) );
+      R( e, a, b, c, d, F3, K3, M(56) );
+      R( d, e, a, b, c, F3, K3, M(57) );
+      R( c, d, e, a, b, F3, K3, M(58) );
+      R( b, c, d, e, a, F3, K3, M(59) );
+      R( a, b, c, d, e, F4, K4, M(60) );
+      R( e, a, b, c, d, F4, K4, M(61) );
+      R( d, e, a, b, c, F4, K4, M(62) );
+      R( c, d, e, a, b, F4, K4, M(63) );
+      R( b, c, d, e, a, F4, K4, M(64) );
+      R( a, b, c, d, e, F4, K4, M(65) );
+      R( e, a, b, c, d, F4, K4, M(66) );
+      R( d, e, a, b, c, F4, K4, M(67) );
+      R( c, d, e, a, b, F4, K4, M(68) );
+      R( b, c, d, e, a, F4, K4, M(69) );
+      R( a, b, c, d, e, F4, K4, M(70) );
+      R( e, a, b, c, d, F4, K4, M(71) );
+      R( d, e, a, b, c, F4, K4, M(72) );
+      R( c, d, e, a, b, F4, K4, M(73) );
+      R( b, c, d, e, a, F4, K4, M(74) );
+      R( a, b, c, d, e, F4, K4, M(75) );
+      R( e, a, b, c, d, F4, K4, M(76) );
+      R( d, e, a, b, c, F4, K4, M(77) );
+      R( c, d, e, a, b, F4, K4, M(78) );
+      R( b, c, d, e, a, F4, K4, M(79) );
+
+      a = ctx->A += a;
+      b = ctx->B += b;
+      c = ctx->C += c;
+      d = ctx->D += d;
+      e = ctx->E += e;
+    }
+}
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 85f76275ebd5796d4b939792e7be4de2f054bdcd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sha1.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..940163eb528a39ef22cc1c6303e1a2447f9ebbda
--- /dev/null
@@ -0,0 +1,134 @@
+/* Declarations of functions and data types used for SHA1 sum
+   library functions.
+   Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef SHA1_H
+# define SHA1_H 1
+
+/* This file uses HAVE_OPENSSL_SHA1.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <stdio.h>
+# include <stdint.h>
+
+# if HAVE_OPENSSL_SHA1
+#  ifndef OPENSSL_API_COMPAT
+#   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
+#  endif
+/* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
+#  include <openssl/opensslv.h>
+#  if OPENSSL_VERSION_MAJOR >= 3
+#   include <openssl/configuration.h>
+#   if (OPENSSL_CONFIGURED_API \
+        < (OPENSSL_API_COMPAT < 0x900000L ? OPENSSL_API_COMPAT : \
+           ((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \
+           + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \
+           + ((OPENSSL_API_COMPAT >> 12) & 0xFF)))
+#    undef HAVE_OPENSSL_SHA1
+#   endif
+#  endif
+#  if HAVE_OPENSSL_SHA1
+#   include <openssl/sha.h>
+#  endif
+# endif
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# define SHA1_DIGEST_SIZE 20
+
+# if HAVE_OPENSSL_SHA1
+#  define GL_OPENSSL_NAME 1
+#  include "gl_openssl.h"
+# else
+/* Structure to save state of computation between the single steps.  */
+struct sha1_ctx
+{
+  uint32_t A;
+  uint32_t B;
+  uint32_t C;
+  uint32_t D;
+  uint32_t E;
+
+  uint32_t total[2];
+  uint32_t buflen;     /* ≥ 0, ≤ 128 */
+  uint32_t buffer[32]; /* 128 bytes; the first buflen bytes are in use */
+};
+
+/* Initialize structure containing state of computation. */
+extern void sha1_init_ctx (struct sha1_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is necessary that LEN is a multiple of 64!!! */
+extern void sha1_process_block (const void *buffer, size_t len,
+                                struct sha1_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is NOT required that LEN is a multiple of 64.  */
+extern void sha1_process_bytes (const void *buffer, size_t len,
+                                struct sha1_ctx *ctx);
+
+/* Process the remaining bytes in the buffer and put result from CTX
+   in first 20 bytes following RESBUF.  The result is always in little
+   endian byte order, so that a byte-wise output yields to the wanted
+   ASCII representation of the message digest.  */
+extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *restrict resbuf);
+
+
+/* Put result from CTX in first 20 bytes following RESBUF.  The result is
+   always in little endian byte order, so that a byte-wise output yields
+   to the wanted ASCII representation of the message digest.  */
+extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *restrict resbuf);
+
+
+/* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+extern void *sha1_buffer (const char *buffer, size_t len,
+                          void *restrict resblock);
+
+# endif
+
+/* Compute SHA1 message digest for bytes read from STREAM.
+   STREAM is an open file stream.  Regular files are handled more efficiently.
+   The contents of STREAM from its current position to its end will be read.
+   The case that the last operation on STREAM was an 'ungetc' is not supported.
+   The resulting message digest number will be written into the 20 bytes
+   beginning at RESBLOCK.  */
+extern int sha1_stream (FILE *stream, void *resblock);
+
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index fde7f09cad7dd6b20b35651a7d9d5a4beb42a13d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sha256-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..08d24b7bfc90cb8a1d8b26576b4b7d53064a4db4
--- /dev/null
@@ -0,0 +1,145 @@
+/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
+   memory blocks according to the NIST specification FIPS-180-2.
+
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David Madore, considerably copypasting from
+   Scott G. Miller's sha1.c
+*/
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_SHA256
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "sha256.h"
+
+#include <stdlib.h>
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+#include "af_alg.h"
+
+#define BLOCKSIZE 32768
+#if BLOCKSIZE % 64 != 0
+# error "invalid BLOCKSIZE"
+#endif
+
+/* Compute message digest for bytes read from STREAM using algorithm ALG.
+   Write the message digest into RESBLOCK, which contains HASHLEN bytes.
+   The initial and finishing operations are INIT_CTX and FINISH_CTX.
+   Return zero if and only if successful.  */
+static int
+shaxxx_stream (FILE *stream, char const *alg, void *resblock,
+               ssize_t hashlen, void (*init_ctx) (struct sha256_ctx *),
+               void *(*finish_ctx) (struct sha256_ctx *, void *))
+{
+  switch (afalg_stream (stream, alg, resblock, hashlen))
+    {
+    case 0: return 0;
+    case -EIO: return 1;
+    }
+
+  char *buffer = malloc (BLOCKSIZE + 72);
+  if (!buffer)
+    return 1;
+
+  struct sha256_ctx ctx;
+  init_ctx (&ctx);
+  size_t sum;
+
+  /* Iterate over full file contents.  */
+  while (1)
+    {
+      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
+         computation function processes the whole buffer so that with the
+         next round of the loop another block can be read.  */
+      size_t n;
+      sum = 0;
+
+      /* Read block.  Take care for partial reads.  */
+      while (1)
+        {
+          /* Either process a partial fread() from this loop,
+             or the fread() in afalg_stream may have gotten EOF.
+             We need to avoid a subsequent fread() as EOF may
+             not be sticky.  For details of such systems, see:
+             https://sourceware.org/bugzilla/show_bug.cgi?id=1190  */
+          if (feof (stream))
+            goto process_partial_block;
+
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+          sum += n;
+
+          if (sum == BLOCKSIZE)
+            break;
+
+          if (n == 0)
+            {
+              /* Check for the error flag IFF N == 0, so that we don't
+                 exit the loop after a partial read due to e.g., EAGAIN
+                 or EWOULDBLOCK.  */
+              if (ferror (stream))
+                {
+                  free (buffer);
+                  return 1;
+                }
+              goto process_partial_block;
+            }
+        }
+
+      /* Process buffer with BLOCKSIZE bytes.  Note that
+                        BLOCKSIZE % 64 == 0
+       */
+      sha256_process_block (buffer, BLOCKSIZE, &ctx);
+    }
+
+ process_partial_block:;
+
+  /* Process any remaining bytes.  */
+  if (sum > 0)
+    sha256_process_bytes (buffer, sum, &ctx);
+
+  /* Construct result in desired memory.  */
+  finish_ctx (&ctx, resblock);
+  free (buffer);
+  return 0;
+}
+
+int
+sha256_stream (FILE *stream, void *resblock)
+{
+  return shaxxx_stream (stream, "sha256", resblock, SHA256_DIGEST_SIZE,
+                        sha256_init_ctx, sha256_finish_ctx);
+}
+
+int
+sha224_stream (FILE *stream, void *resblock)
+{
+  return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE,
+                        sha224_init_ctx, sha224_finish_ctx);
+}
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index a7f4621e19c386e3acc75fd4e52dbc60b67bcf52..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sha256.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fe7c5446dafbce404f6623fbc0f13e6af6bf52bc
--- /dev/null
@@ -0,0 +1,432 @@
+/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
+   memory blocks according to the NIST specification FIPS-180-2.
+
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David Madore, considerably copypasting from
+   Scott G. Miller's sha1.c
+*/
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_SHA256
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "sha256.h"
+
+#include <stdint.h>
+#include <string.h>
+
+#include <byteswap.h>
+#ifdef WORDS_BIGENDIAN
+# define SWAP(n) (n)
+#else
+# define SWAP(n) bswap_32 (n)
+#endif
+
+#if ! HAVE_OPENSSL_SHA256
+
+/* This array contains the bytes used to pad the buffer to the next
+   64-byte boundary.  */
+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
+
+
+/*
+  Takes a pointer to a 256 bit block of data (eight 32 bit ints) and
+  initializes it to the start constants of the SHA256 algorithm.  This
+  must be called before using hash in the call to sha256_hash
+*/
+void
+sha256_init_ctx (struct sha256_ctx *ctx)
+{
+  ctx->state[0] = 0x6a09e667UL;
+  ctx->state[1] = 0xbb67ae85UL;
+  ctx->state[2] = 0x3c6ef372UL;
+  ctx->state[3] = 0xa54ff53aUL;
+  ctx->state[4] = 0x510e527fUL;
+  ctx->state[5] = 0x9b05688cUL;
+  ctx->state[6] = 0x1f83d9abUL;
+  ctx->state[7] = 0x5be0cd19UL;
+
+  ctx->total[0] = ctx->total[1] = 0;
+  ctx->buflen = 0;
+}
+
+void
+sha224_init_ctx (struct sha256_ctx *ctx)
+{
+  ctx->state[0] = 0xc1059ed8UL;
+  ctx->state[1] = 0x367cd507UL;
+  ctx->state[2] = 0x3070dd17UL;
+  ctx->state[3] = 0xf70e5939UL;
+  ctx->state[4] = 0xffc00b31UL;
+  ctx->state[5] = 0x68581511UL;
+  ctx->state[6] = 0x64f98fa7UL;
+  ctx->state[7] = 0xbefa4fa4UL;
+
+  ctx->total[0] = ctx->total[1] = 0;
+  ctx->buflen = 0;
+}
+
+/* Copy the value from v into the memory location pointed to by *CP,
+   If your architecture allows unaligned access, this is equivalent to
+   * (__typeof__ (v) *) cp = v  */
+static void
+set_uint32 (char *cp, uint32_t v)
+{
+  memcpy (cp, &v, sizeof v);
+}
+
+/* Put result from CTX in first 32 bytes following RESBUF.
+   The result must be in little endian byte order.  */
+void *
+sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
+{
+  int i;
+  char *r = resbuf;
+
+  for (i = 0; i < 8; i++)
+    set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
+
+  return resbuf;
+}
+
+void *
+sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
+{
+  int i;
+  char *r = resbuf;
+
+  for (i = 0; i < 7; i++)
+    set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
+
+  return resbuf;
+}
+
+/* Process the remaining bytes in the internal buffer and the usual
+   prolog according to the standard and write the result to RESBUF.  */
+static void
+sha256_conclude_ctx (struct sha256_ctx *ctx)
+{
+  /* Take yet unprocessed bytes into account.  */
+  size_t bytes = ctx->buflen;
+  size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
+
+  /* Now count remaining bytes.  */
+  ctx->total[0] += bytes;
+  if (ctx->total[0] < bytes)
+    ++ctx->total[1];
+
+  /* Put the 64-bit file length in *bits* at the end of the buffer.
+     Use set_uint32 rather than a simple assignment, to avoid risk of
+     unaligned access.  */
+  set_uint32 ((char *) &ctx->buffer[size - 2],
+              SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)));
+  set_uint32 ((char *) &ctx->buffer[size - 1],
+              SWAP (ctx->total[0] << 3));
+
+  memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
+
+  /* Process last bytes.  */
+  sha256_process_block (ctx->buffer, size * 4, ctx);
+}
+
+void *
+sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
+{
+  sha256_conclude_ctx (ctx);
+  return sha256_read_ctx (ctx, resbuf);
+}
+
+void *
+sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
+{
+  sha256_conclude_ctx (ctx);
+  return sha224_read_ctx (ctx, resbuf);
+}
+
+/* Compute SHA256 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+void *
+sha256_buffer (const char *buffer, size_t len, void *resblock)
+{
+  struct sha256_ctx ctx;
+
+  /* Initialize the computation context.  */
+  sha256_init_ctx (&ctx);
+
+  /* Process whole buffer but last len % 64 bytes.  */
+  sha256_process_bytes (buffer, len, &ctx);
+
+  /* Put result in desired memory area.  */
+  return sha256_finish_ctx (&ctx, resblock);
+}
+
+void *
+sha224_buffer (const char *buffer, size_t len, void *resblock)
+{
+  struct sha256_ctx ctx;
+
+  /* Initialize the computation context.  */
+  sha224_init_ctx (&ctx);
+
+  /* Process whole buffer but last len % 64 bytes.  */
+  sha256_process_bytes (buffer, len, &ctx);
+
+  /* Put result in desired memory area.  */
+  return sha224_finish_ctx (&ctx, resblock);
+}
+
+void
+sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx)
+{
+  /* When we already have some bits in our internal buffer concatenate
+     both inputs first.  */
+  if (ctx->buflen != 0)
+    {
+      size_t left_over = ctx->buflen;
+      size_t add = 128 - left_over > len ? len : 128 - left_over;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
+      ctx->buflen += add;
+
+      if (ctx->buflen > 64)
+        {
+          sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+
+          ctx->buflen &= 63;
+          /* The regions in the following copy operation cannot overlap,
+             because ctx->buflen < 64 ≤ (left_over + add) & ~63.  */
+          memcpy (ctx->buffer,
+                  &((char *) ctx->buffer)[(left_over + add) & ~63],
+                  ctx->buflen);
+        }
+
+      buffer = (const char *) buffer + add;
+      len -= add;
+    }
+
+  /* Process available complete blocks.  */
+  if (len >= 64)
+    {
+#if !(_STRING_ARCH_unaligned || _STRING_INLINE_unaligned)
+# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
+      if (UNALIGNED_P (buffer))
+        while (len > 64)
+          {
+            sha256_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+            buffer = (const char *) buffer + 64;
+            len -= 64;
+          }
+      else
+#endif
+        {
+          sha256_process_block (buffer, len & ~63, ctx);
+          buffer = (const char *) buffer + (len & ~63);
+          len &= 63;
+        }
+    }
+
+  /* Move remaining bytes in internal buffer.  */
+  if (len > 0)
+    {
+      size_t left_over = ctx->buflen;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
+      left_over += len;
+      if (left_over >= 64)
+        {
+          sha256_process_block (ctx->buffer, 64, ctx);
+          left_over -= 64;
+          /* The regions in the following copy operation cannot overlap,
+             because left_over ≤ 64.  */
+          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
+      ctx->buflen = left_over;
+    }
+}
+
+/* --- Code below is the primary difference between sha1.c and sha256.c --- */
+
+/* SHA256 round constants */
+#define K(I) sha256_round_constants[I]
+static const uint32_t sha256_round_constants[64] = {
+  0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
+  0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
+  0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
+  0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
+  0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
+  0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
+  0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
+  0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
+  0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
+  0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
+  0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
+  0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
+  0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
+  0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
+  0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
+  0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL,
+};
+
+/* Round functions.  */
+#define F2(A,B,C) ( ( A & B ) | ( C & ( A | B ) ) )
+#define F1(E,F,G) ( G ^ ( E & ( F ^ G ) ) )
+
+/* Process LEN bytes of BUFFER, accumulating context into CTX.
+   It is assumed that LEN % 64 == 0.
+   Most of this code comes from GnuPG's cipher/sha1.c.  */
+
+void
+sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
+{
+  const uint32_t *words = buffer;
+  size_t nwords = len / sizeof (uint32_t);
+  const uint32_t *endp = words + nwords;
+  uint32_t x[16];
+  uint32_t a = ctx->state[0];
+  uint32_t b = ctx->state[1];
+  uint32_t c = ctx->state[2];
+  uint32_t d = ctx->state[3];
+  uint32_t e = ctx->state[4];
+  uint32_t f = ctx->state[5];
+  uint32_t g = ctx->state[6];
+  uint32_t h = ctx->state[7];
+  uint32_t lolen = len;
+
+  /* First increment the byte count.  FIPS PUB 180-2 specifies the possible
+     length of the file up to 2^64 bits.  Here we only compute the
+     number of bytes.  Do a double word increment.  */
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
+
+#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+#define S0(x) (rol(x,25)^rol(x,14)^(x>>3))
+#define S1(x) (rol(x,15)^rol(x,13)^(x>>10))
+#define SS0(x) (rol(x,30)^rol(x,19)^rol(x,10))
+#define SS1(x) (rol(x,26)^rol(x,21)^rol(x,7))
+
+#define M(I) ( tm =   S1(x[(I-2)&0x0f]) + x[(I-7)&0x0f] \
+                    + S0(x[(I-15)&0x0f]) + x[I&0x0f]    \
+               , x[I&0x0f] = tm )
+
+#define R(A,B,C,D,E,F,G,H,K,M)  do { t0 = SS0(A) + F2(A,B,C); \
+                                     t1 = H + SS1(E)  \
+                                      + F1(E,F,G)     \
+                                      + K             \
+                                      + M;            \
+                                     D += t1;  H = t0 + t1; \
+                               } while(0)
+
+  while (words < endp)
+    {
+      uint32_t tm;
+      uint32_t t0, t1;
+      int t;
+      /* FIXME: see sha1.c for a better implementation.  */
+      for (t = 0; t < 16; t++)
+        {
+          x[t] = SWAP (*words);
+          words++;
+        }
+
+      R( a, b, c, d, e, f, g, h, K( 0), x[ 0] );
+      R( h, a, b, c, d, e, f, g, K( 1), x[ 1] );
+      R( g, h, a, b, c, d, e, f, K( 2), x[ 2] );
+      R( f, g, h, a, b, c, d, e, K( 3), x[ 3] );
+      R( e, f, g, h, a, b, c, d, K( 4), x[ 4] );
+      R( d, e, f, g, h, a, b, c, K( 5), x[ 5] );
+      R( c, d, e, f, g, h, a, b, K( 6), x[ 6] );
+      R( b, c, d, e, f, g, h, a, K( 7), x[ 7] );
+      R( a, b, c, d, e, f, g, h, K( 8), x[ 8] );
+      R( h, a, b, c, d, e, f, g, K( 9), x[ 9] );
+      R( g, h, a, b, c, d, e, f, K(10), x[10] );
+      R( f, g, h, a, b, c, d, e, K(11), x[11] );
+      R( e, f, g, h, a, b, c, d, K(12), x[12] );
+      R( d, e, f, g, h, a, b, c, K(13), x[13] );
+      R( c, d, e, f, g, h, a, b, K(14), x[14] );
+      R( b, c, d, e, f, g, h, a, K(15), x[15] );
+      R( a, b, c, d, e, f, g, h, K(16), M(16) );
+      R( h, a, b, c, d, e, f, g, K(17), M(17) );
+      R( g, h, a, b, c, d, e, f, K(18), M(18) );
+      R( f, g, h, a, b, c, d, e, K(19), M(19) );
+      R( e, f, g, h, a, b, c, d, K(20), M(20) );
+      R( d, e, f, g, h, a, b, c, K(21), M(21) );
+      R( c, d, e, f, g, h, a, b, K(22), M(22) );
+      R( b, c, d, e, f, g, h, a, K(23), M(23) );
+      R( a, b, c, d, e, f, g, h, K(24), M(24) );
+      R( h, a, b, c, d, e, f, g, K(25), M(25) );
+      R( g, h, a, b, c, d, e, f, K(26), M(26) );
+      R( f, g, h, a, b, c, d, e, K(27), M(27) );
+      R( e, f, g, h, a, b, c, d, K(28), M(28) );
+      R( d, e, f, g, h, a, b, c, K(29), M(29) );
+      R( c, d, e, f, g, h, a, b, K(30), M(30) );
+      R( b, c, d, e, f, g, h, a, K(31), M(31) );
+      R( a, b, c, d, e, f, g, h, K(32), M(32) );
+      R( h, a, b, c, d, e, f, g, K(33), M(33) );
+      R( g, h, a, b, c, d, e, f, K(34), M(34) );
+      R( f, g, h, a, b, c, d, e, K(35), M(35) );
+      R( e, f, g, h, a, b, c, d, K(36), M(36) );
+      R( d, e, f, g, h, a, b, c, K(37), M(37) );
+      R( c, d, e, f, g, h, a, b, K(38), M(38) );
+      R( b, c, d, e, f, g, h, a, K(39), M(39) );
+      R( a, b, c, d, e, f, g, h, K(40), M(40) );
+      R( h, a, b, c, d, e, f, g, K(41), M(41) );
+      R( g, h, a, b, c, d, e, f, K(42), M(42) );
+      R( f, g, h, a, b, c, d, e, K(43), M(43) );
+      R( e, f, g, h, a, b, c, d, K(44), M(44) );
+      R( d, e, f, g, h, a, b, c, K(45), M(45) );
+      R( c, d, e, f, g, h, a, b, K(46), M(46) );
+      R( b, c, d, e, f, g, h, a, K(47), M(47) );
+      R( a, b, c, d, e, f, g, h, K(48), M(48) );
+      R( h, a, b, c, d, e, f, g, K(49), M(49) );
+      R( g, h, a, b, c, d, e, f, K(50), M(50) );
+      R( f, g, h, a, b, c, d, e, K(51), M(51) );
+      R( e, f, g, h, a, b, c, d, K(52), M(52) );
+      R( d, e, f, g, h, a, b, c, K(53), M(53) );
+      R( c, d, e, f, g, h, a, b, K(54), M(54) );
+      R( b, c, d, e, f, g, h, a, K(55), M(55) );
+      R( a, b, c, d, e, f, g, h, K(56), M(56) );
+      R( h, a, b, c, d, e, f, g, K(57), M(57) );
+      R( g, h, a, b, c, d, e, f, K(58), M(58) );
+      R( f, g, h, a, b, c, d, e, K(59), M(59) );
+      R( e, f, g, h, a, b, c, d, K(60), M(60) );
+      R( d, e, f, g, h, a, b, c, K(61), M(61) );
+      R( c, d, e, f, g, h, a, b, K(62), M(62) );
+      R( b, c, d, e, f, g, h, a, K(63), M(63) );
+
+      a = ctx->state[0] += a;
+      b = ctx->state[1] += b;
+      c = ctx->state[2] += c;
+      d = ctx->state[3] += d;
+      e = ctx->state[4] += e;
+      f = ctx->state[5] += f;
+      g = ctx->state[6] += g;
+      h = ctx->state[7] += h;
+    }
+}
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 1e5cfb29a53ca5dbbb072c40b6fc6bd206d13a2a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sha256.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a9d7abb8a2cb6f26fb5bbda174d3edce085834bd
--- /dev/null
@@ -0,0 +1,140 @@
+/* Declarations of functions and data types used for SHA256 and SHA224 sum
+   library functions.
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef SHA256_H
+# define SHA256_H 1
+
+/* This file uses HAVE_OPENSSL_SHA256.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <stdio.h>
+# include <stdint.h>
+
+# if HAVE_OPENSSL_SHA256
+#  ifndef OPENSSL_API_COMPAT
+#   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
+#  endif
+/* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
+#  include <openssl/opensslv.h>
+#  if OPENSSL_VERSION_MAJOR >= 3
+#   include <openssl/configuration.h>
+#   if (OPENSSL_CONFIGURED_API \
+        < (OPENSSL_API_COMPAT < 0x900000L ? OPENSSL_API_COMPAT : \
+           ((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \
+           + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \
+           + ((OPENSSL_API_COMPAT >> 12) & 0xFF)))
+#    undef HAVE_OPENSSL_SHA256
+#   endif
+#  endif
+#  if HAVE_OPENSSL_SHA256
+#   include <openssl/sha.h>
+#  endif
+# endif
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+enum { SHA224_DIGEST_SIZE = 224 / 8 };
+enum { SHA256_DIGEST_SIZE = 256 / 8 };
+
+# if HAVE_OPENSSL_SHA256
+#  define GL_OPENSSL_NAME 224
+#  include "gl_openssl.h"
+#  define GL_OPENSSL_NAME 256
+#  include "gl_openssl.h"
+# else
+/* Structure to save state of computation between the single steps.  */
+struct sha256_ctx
+{
+  uint32_t state[8];
+
+  uint32_t total[2];
+  size_t buflen;       /* ≥ 0, ≤ 128 */
+  uint32_t buffer[32]; /* 128 bytes; the first buflen bytes are in use */
+};
+
+/* Initialize structure containing state of computation. */
+extern void sha256_init_ctx (struct sha256_ctx *ctx);
+extern void sha224_init_ctx (struct sha256_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is necessary that LEN is a multiple of 64!!! */
+extern void sha256_process_block (const void *buffer, size_t len,
+                                  struct sha256_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is NOT required that LEN is a multiple of 64.  */
+extern void sha256_process_bytes (const void *buffer, size_t len,
+                                  struct sha256_ctx *ctx);
+
+/* Process the remaining bytes in the buffer and put result from CTX
+   in first 32 (28) bytes following RESBUF.  The result is always in little
+   endian byte order, so that a byte-wise output yields to the wanted
+   ASCII representation of the message digest.  */
+extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *restrict resbuf);
+extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *restrict resbuf);
+
+
+/* Put result from CTX in first 32 (28) bytes following RESBUF.  The result is
+   always in little endian byte order, so that a byte-wise output yields
+   to the wanted ASCII representation of the message digest.  */
+extern void *sha256_read_ctx (const struct sha256_ctx *ctx,
+                              void *restrict resbuf);
+extern void *sha224_read_ctx (const struct sha256_ctx *ctx,
+                              void *restrict resbuf);
+
+
+/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER.
+   The result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+extern void *sha256_buffer (const char *buffer, size_t len,
+                            void *restrict resblock);
+extern void *sha224_buffer (const char *buffer, size_t len,
+                            void *restrict resblock);
+
+# endif
+
+/* Compute SHA256 (SHA224) message digest for bytes read from STREAM.
+   STREAM is an open file stream.  Regular files are handled more efficiently.
+   The contents of STREAM from its current position to its end will be read.
+   The case that the last operation on STREAM was an 'ungetc' is not supported.
+   The resulting message digest number will be written into the 32 (28) bytes
+   beginning at RESBLOCK.  */
+extern int sha256_stream (FILE *stream, void *resblock);
+extern int sha224_stream (FILE *stream, void *resblock);
+
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 8a7c90727d4c18589083953cbfd3c4ef41da8e97..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sha512-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..74fdd5047dc6132a5fec9049fc32e240ca87fcbe
--- /dev/null
@@ -0,0 +1,145 @@
+/* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
+   memory blocks according to the NIST specification FIPS-180-2.
+
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David Madore, considerably copypasting from
+   Scott G. Miller's sha1.c
+*/
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_SHA512
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "sha512.h"
+
+#include <stdlib.h>
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+#include "af_alg.h"
+
+#define BLOCKSIZE 32768
+#if BLOCKSIZE % 128 != 0
+# error "invalid BLOCKSIZE"
+#endif
+
+/* Compute message digest for bytes read from STREAM using algorithm ALG.
+   Write the message digest into RESBLOCK, which contains HASHLEN bytes.
+   The initial and finishing operations are INIT_CTX and FINISH_CTX.
+   Return zero if and only if successful.  */
+static int
+shaxxx_stream (FILE *stream, char const *alg, void *resblock,
+               ssize_t hashlen, void (*init_ctx) (struct sha512_ctx *),
+               void *(*finish_ctx) (struct sha512_ctx *, void *))
+{
+  switch (afalg_stream (stream, alg, resblock, hashlen))
+    {
+    case 0: return 0;
+    case -EIO: return 1;
+    }
+
+  char *buffer = malloc (BLOCKSIZE + 72);
+  if (!buffer)
+    return 1;
+
+  struct sha512_ctx ctx;
+  init_ctx (&ctx);
+  size_t sum;
+
+  /* Iterate over full file contents.  */
+  while (1)
+    {
+      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
+         computation function processes the whole buffer so that with the
+         next round of the loop another block can be read.  */
+      size_t n;
+      sum = 0;
+
+      /* Read block.  Take care for partial reads.  */
+      while (1)
+        {
+          /* Either process a partial fread() from this loop,
+             or the fread() in afalg_stream may have gotten EOF.
+             We need to avoid a subsequent fread() as EOF may
+             not be sticky.  For details of such systems, see:
+             https://sourceware.org/bugzilla/show_bug.cgi?id=1190  */
+          if (feof (stream))
+            goto process_partial_block;
+
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+          sum += n;
+
+          if (sum == BLOCKSIZE)
+            break;
+
+          if (n == 0)
+            {
+              /* Check for the error flag IFF N == 0, so that we don't
+                 exit the loop after a partial read due to e.g., EAGAIN
+                 or EWOULDBLOCK.  */
+              if (ferror (stream))
+                {
+                  free (buffer);
+                  return 1;
+                }
+              goto process_partial_block;
+            }
+        }
+
+      /* Process buffer with BLOCKSIZE bytes.  Note that
+                        BLOCKSIZE % 128 == 0
+       */
+      sha512_process_block (buffer, BLOCKSIZE, &ctx);
+    }
+
+ process_partial_block:;
+
+  /* Process any remaining bytes.  */
+  if (sum > 0)
+    sha512_process_bytes (buffer, sum, &ctx);
+
+  /* Construct result in desired memory.  */
+  finish_ctx (&ctx, resblock);
+  free (buffer);
+  return 0;
+}
+
+int
+sha512_stream (FILE *stream, void *resblock)
+{
+  return shaxxx_stream (stream, "sha512", resblock, SHA512_DIGEST_SIZE,
+                        sha512_init_ctx, sha512_finish_ctx);
+}
+
+int
+sha384_stream (FILE *stream, void *resblock)
+{
+  return shaxxx_stream (stream, "sha384", resblock, SHA384_DIGEST_SIZE,
+                        sha384_init_ctx, sha384_finish_ctx);
+}
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 982d197ec1b0b0b08601fac3679fc1e1078c78f9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sha512.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9eb036fb3273c42a43172845353a9bca8f1e9632
--- /dev/null
@@ -0,0 +1,477 @@
+/* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
+   memory blocks according to the NIST specification FIPS-180-2.
+
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David Madore, considerably copypasting from
+   Scott G. Miller's sha1.c
+*/
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_SHA512
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "sha512.h"
+
+#include <stdint.h>
+#include <string.h>
+
+#include <byteswap.h>
+#ifdef WORDS_BIGENDIAN
+# define SWAP(n) (n)
+#else
+# define SWAP(n) bswap_64 (n)
+#endif
+
+#if ! HAVE_OPENSSL_SHA512
+
+/* This array contains the bytes used to pad the buffer to the next
+   128-byte boundary.  */
+static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ...  */ };
+
+
+/*
+  Takes a pointer to a 512 bit block of data (eight 64 bit ints) and
+  initializes it to the start constants of the SHA512 algorithm.  This
+  must be called before using hash in the call to sha512_hash
+*/
+void
+sha512_init_ctx (struct sha512_ctx *ctx)
+{
+  ctx->state[0] = u64hilo (0x6a09e667, 0xf3bcc908);
+  ctx->state[1] = u64hilo (0xbb67ae85, 0x84caa73b);
+  ctx->state[2] = u64hilo (0x3c6ef372, 0xfe94f82b);
+  ctx->state[3] = u64hilo (0xa54ff53a, 0x5f1d36f1);
+  ctx->state[4] = u64hilo (0x510e527f, 0xade682d1);
+  ctx->state[5] = u64hilo (0x9b05688c, 0x2b3e6c1f);
+  ctx->state[6] = u64hilo (0x1f83d9ab, 0xfb41bd6b);
+  ctx->state[7] = u64hilo (0x5be0cd19, 0x137e2179);
+
+  ctx->total[0] = ctx->total[1] = u64lo (0);
+  ctx->buflen = 0;
+}
+
+void
+sha384_init_ctx (struct sha512_ctx *ctx)
+{
+  ctx->state[0] = u64hilo (0xcbbb9d5d, 0xc1059ed8);
+  ctx->state[1] = u64hilo (0x629a292a, 0x367cd507);
+  ctx->state[2] = u64hilo (0x9159015a, 0x3070dd17);
+  ctx->state[3] = u64hilo (0x152fecd8, 0xf70e5939);
+  ctx->state[4] = u64hilo (0x67332667, 0xffc00b31);
+  ctx->state[5] = u64hilo (0x8eb44a87, 0x68581511);
+  ctx->state[6] = u64hilo (0xdb0c2e0d, 0x64f98fa7);
+  ctx->state[7] = u64hilo (0x47b5481d, 0xbefa4fa4);
+
+  ctx->total[0] = ctx->total[1] = u64lo (0);
+  ctx->buflen = 0;
+}
+
+/* Copy the value from V into the memory location pointed to by *CP,
+   If your architecture allows unaligned access, this is equivalent to
+   * (__typeof__ (v) *) cp = v  */
+static void
+set_uint64 (char *cp, u64 v)
+{
+  memcpy (cp, &v, sizeof v);
+}
+
+/* Put result from CTX in first 64 bytes following RESBUF.
+   The result must be in little endian byte order.  */
+void *
+sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
+{
+  int i;
+  char *r = resbuf;
+
+  for (i = 0; i < 8; i++)
+    set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
+
+  return resbuf;
+}
+
+void *
+sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
+{
+  int i;
+  char *r = resbuf;
+
+  for (i = 0; i < 6; i++)
+    set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
+
+  return resbuf;
+}
+
+/* Process the remaining bytes in the internal buffer and the usual
+   prolog according to the standard and write the result to RESBUF.  */
+static void
+sha512_conclude_ctx (struct sha512_ctx *ctx)
+{
+  /* Take yet unprocessed bytes into account.  */
+  size_t bytes = ctx->buflen;
+  size_t size = (bytes < 112) ? 128 / 8 : 128 * 2 / 8;
+
+  /* Now count remaining bytes.  */
+  ctx->total[0] = u64plus (ctx->total[0], u64lo (bytes));
+  if (u64lt (ctx->total[0], u64lo (bytes)))
+    ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
+
+  /* Put the 128-bit file length in *bits* at the end of the buffer.
+     Use set_uint64 rather than a simple assignment, to avoid risk of
+     unaligned access.  */
+  set_uint64 ((char *) &ctx->buffer[size - 2],
+              SWAP (u64or (u64shl (ctx->total[1], 3),
+                           u64shr (ctx->total[0], 61))));
+  set_uint64 ((char *) &ctx->buffer[size - 1],
+              SWAP (u64shl (ctx->total[0], 3)));
+
+  memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 8 - bytes);
+
+  /* Process last bytes.  */
+  sha512_process_block (ctx->buffer, size * 8, ctx);
+}
+
+void *
+sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
+{
+  sha512_conclude_ctx (ctx);
+  return sha512_read_ctx (ctx, resbuf);
+}
+
+void *
+sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
+{
+  sha512_conclude_ctx (ctx);
+  return sha384_read_ctx (ctx, resbuf);
+}
+
+/* Compute SHA512 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+void *
+sha512_buffer (const char *buffer, size_t len, void *resblock)
+{
+  struct sha512_ctx ctx;
+
+  /* Initialize the computation context.  */
+  sha512_init_ctx (&ctx);
+
+  /* Process whole buffer but last len % 128 bytes.  */
+  sha512_process_bytes (buffer, len, &ctx);
+
+  /* Put result in desired memory area.  */
+  return sha512_finish_ctx (&ctx, resblock);
+}
+
+void *
+sha384_buffer (const char *buffer, size_t len, void *resblock)
+{
+  struct sha512_ctx ctx;
+
+  /* Initialize the computation context.  */
+  sha384_init_ctx (&ctx);
+
+  /* Process whole buffer but last len % 128 bytes.  */
+  sha512_process_bytes (buffer, len, &ctx);
+
+  /* Put result in desired memory area.  */
+  return sha384_finish_ctx (&ctx, resblock);
+}
+
+void
+sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx)
+{
+  /* When we already have some bits in our internal buffer concatenate
+     both inputs first.  */
+  if (ctx->buflen != 0)
+    {
+      size_t left_over = ctx->buflen;
+      size_t add = 256 - left_over > len ? len : 256 - left_over;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
+      ctx->buflen += add;
+
+      if (ctx->buflen > 128)
+        {
+          sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx);
+
+          ctx->buflen &= 127;
+          /* The regions in the following copy operation cannot overlap,
+             because ctx->buflen < 128 ≤ (left_over + add) & ~127.  */
+          memcpy (ctx->buffer,
+                  &((char *) ctx->buffer)[(left_over + add) & ~127],
+                  ctx->buflen);
+        }
+
+      buffer = (const char *) buffer + add;
+      len -= add;
+    }
+
+  /* Process available complete blocks.  */
+  if (len >= 128)
+    {
+#if !(_STRING_ARCH_unaligned || _STRING_INLINE_unaligned)
+# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (u64) != 0)
+      if (UNALIGNED_P (buffer))
+        while (len > 128)
+          {
+            sha512_process_block (memcpy (ctx->buffer, buffer, 128), 128, ctx);
+            buffer = (const char *) buffer + 128;
+            len -= 128;
+          }
+      else
+#endif
+        {
+          sha512_process_block (buffer, len & ~127, ctx);
+          buffer = (const char *) buffer + (len & ~127);
+          len &= 127;
+        }
+    }
+
+  /* Move remaining bytes in internal buffer.  */
+  if (len > 0)
+    {
+      size_t left_over = ctx->buflen;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
+      left_over += len;
+      if (left_over >= 128)
+        {
+          sha512_process_block (ctx->buffer, 128, ctx);
+          left_over -= 128;
+          /* The regions in the following copy operation cannot overlap,
+             because left_over ≤ 128.  */
+          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
+      ctx->buflen = left_over;
+    }
+}
+
+/* --- Code below is the primary difference between sha1.c and sha512.c --- */
+
+/* SHA512 round constants */
+#define K(I) sha512_round_constants[I]
+static u64 const sha512_round_constants[80] = {
+  u64init (0x428a2f98, 0xd728ae22), u64init (0x71374491, 0x23ef65cd),
+  u64init (0xb5c0fbcf, 0xec4d3b2f), u64init (0xe9b5dba5, 0x8189dbbc),
+  u64init (0x3956c25b, 0xf348b538), u64init (0x59f111f1, 0xb605d019),
+  u64init (0x923f82a4, 0xaf194f9b), u64init (0xab1c5ed5, 0xda6d8118),
+  u64init (0xd807aa98, 0xa3030242), u64init (0x12835b01, 0x45706fbe),
+  u64init (0x243185be, 0x4ee4b28c), u64init (0x550c7dc3, 0xd5ffb4e2),
+  u64init (0x72be5d74, 0xf27b896f), u64init (0x80deb1fe, 0x3b1696b1),
+  u64init (0x9bdc06a7, 0x25c71235), u64init (0xc19bf174, 0xcf692694),
+  u64init (0xe49b69c1, 0x9ef14ad2), u64init (0xefbe4786, 0x384f25e3),
+  u64init (0x0fc19dc6, 0x8b8cd5b5), u64init (0x240ca1cc, 0x77ac9c65),
+  u64init (0x2de92c6f, 0x592b0275), u64init (0x4a7484aa, 0x6ea6e483),
+  u64init (0x5cb0a9dc, 0xbd41fbd4), u64init (0x76f988da, 0x831153b5),
+  u64init (0x983e5152, 0xee66dfab), u64init (0xa831c66d, 0x2db43210),
+  u64init (0xb00327c8, 0x98fb213f), u64init (0xbf597fc7, 0xbeef0ee4),
+  u64init (0xc6e00bf3, 0x3da88fc2), u64init (0xd5a79147, 0x930aa725),
+  u64init (0x06ca6351, 0xe003826f), u64init (0x14292967, 0x0a0e6e70),
+  u64init (0x27b70a85, 0x46d22ffc), u64init (0x2e1b2138, 0x5c26c926),
+  u64init (0x4d2c6dfc, 0x5ac42aed), u64init (0x53380d13, 0x9d95b3df),
+  u64init (0x650a7354, 0x8baf63de), u64init (0x766a0abb, 0x3c77b2a8),
+  u64init (0x81c2c92e, 0x47edaee6), u64init (0x92722c85, 0x1482353b),
+  u64init (0xa2bfe8a1, 0x4cf10364), u64init (0xa81a664b, 0xbc423001),
+  u64init (0xc24b8b70, 0xd0f89791), u64init (0xc76c51a3, 0x0654be30),
+  u64init (0xd192e819, 0xd6ef5218), u64init (0xd6990624, 0x5565a910),
+  u64init (0xf40e3585, 0x5771202a), u64init (0x106aa070, 0x32bbd1b8),
+  u64init (0x19a4c116, 0xb8d2d0c8), u64init (0x1e376c08, 0x5141ab53),
+  u64init (0x2748774c, 0xdf8eeb99), u64init (0x34b0bcb5, 0xe19b48a8),
+  u64init (0x391c0cb3, 0xc5c95a63), u64init (0x4ed8aa4a, 0xe3418acb),
+  u64init (0x5b9cca4f, 0x7763e373), u64init (0x682e6ff3, 0xd6b2b8a3),
+  u64init (0x748f82ee, 0x5defb2fc), u64init (0x78a5636f, 0x43172f60),
+  u64init (0x84c87814, 0xa1f0ab72), u64init (0x8cc70208, 0x1a6439ec),
+  u64init (0x90befffa, 0x23631e28), u64init (0xa4506ceb, 0xde82bde9),
+  u64init (0xbef9a3f7, 0xb2c67915), u64init (0xc67178f2, 0xe372532b),
+  u64init (0xca273ece, 0xea26619c), u64init (0xd186b8c7, 0x21c0c207),
+  u64init (0xeada7dd6, 0xcde0eb1e), u64init (0xf57d4f7f, 0xee6ed178),
+  u64init (0x06f067aa, 0x72176fba), u64init (0x0a637dc5, 0xa2c898a6),
+  u64init (0x113f9804, 0xbef90dae), u64init (0x1b710b35, 0x131c471b),
+  u64init (0x28db77f5, 0x23047d84), u64init (0x32caab7b, 0x40c72493),
+  u64init (0x3c9ebe0a, 0x15c9bebc), u64init (0x431d67c4, 0x9c100d4c),
+  u64init (0x4cc5d4be, 0xcb3e42b6), u64init (0x597f299c, 0xfc657e2a),
+  u64init (0x5fcb6fab, 0x3ad6faec), u64init (0x6c44198c, 0x4a475817),
+};
+
+/* Round functions.  */
+#define F2(A, B, C) u64or (u64and (A, B), u64and (C, u64or (A, B)))
+#define F1(E, F, G) u64xor (G, u64and (E, u64xor (F, G)))
+
+/* Process LEN bytes of BUFFER, accumulating context into CTX.
+   It is assumed that LEN % 128 == 0.
+   Most of this code comes from GnuPG's cipher/sha1.c.  */
+
+void
+sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
+{
+  u64 const *words = buffer;
+  u64 const *endp = words + len / sizeof (u64);
+  u64 x[16];
+  u64 a = ctx->state[0];
+  u64 b = ctx->state[1];
+  u64 c = ctx->state[2];
+  u64 d = ctx->state[3];
+  u64 e = ctx->state[4];
+  u64 f = ctx->state[5];
+  u64 g = ctx->state[6];
+  u64 h = ctx->state[7];
+  u64 lolen = u64size (len);
+
+  /* First increment the byte count.  FIPS PUB 180-2 specifies the possible
+     length of the file up to 2^128 bits.  Here we only compute the
+     number of bytes.  Do a double word increment.  */
+  ctx->total[0] = u64plus (ctx->total[0], lolen);
+  ctx->total[1] = u64plus (ctx->total[1],
+                           u64plus (u64size (len >> 31 >> 31 >> 2),
+                                    u64lo (u64lt (ctx->total[0], lolen))));
+
+#define S0(x) u64xor (u64rol(x, 63), u64xor (u64rol (x, 56), u64shr (x, 7)))
+#define S1(x) u64xor (u64rol (x, 45), u64xor (u64rol (x, 3), u64shr (x, 6)))
+#define SS0(x) u64xor (u64rol (x, 36), u64xor (u64rol (x, 30), u64rol (x, 25)))
+#define SS1(x) u64xor (u64rol(x, 50), u64xor (u64rol (x, 46), u64rol (x, 23)))
+
+#define M(I) (x[(I) & 15]                                                 \
+              = u64plus (x[(I) & 15],                                     \
+                         u64plus (S1 (x[((I) - 2) & 15]),                 \
+                                  u64plus (x[((I) - 7) & 15],             \
+                                           S0 (x[((I) - 15) & 15])))))
+
+#define R(A, B, C, D, E, F, G, H, K, M)                                   \
+  do                                                                      \
+    {                                                                     \
+      u64 t0 = u64plus (SS0 (A), F2 (A, B, C));                           \
+      u64 t1 =                                                            \
+        u64plus (H, u64plus (SS1 (E),                                     \
+                             u64plus (F1 (E, F, G), u64plus (K, M))));    \
+      D = u64plus (D, t1);                                                \
+      H = u64plus (t0, t1);                                               \
+    }                                                                     \
+  while (0)
+
+  while (words < endp)
+    {
+      int t;
+      /* FIXME: see sha1.c for a better implementation.  */
+      for (t = 0; t < 16; t++)
+        {
+          x[t] = SWAP (*words);
+          words++;
+        }
+
+      R( a, b, c, d, e, f, g, h, K( 0), x[ 0] );
+      R( h, a, b, c, d, e, f, g, K( 1), x[ 1] );
+      R( g, h, a, b, c, d, e, f, K( 2), x[ 2] );
+      R( f, g, h, a, b, c, d, e, K( 3), x[ 3] );
+      R( e, f, g, h, a, b, c, d, K( 4), x[ 4] );
+      R( d, e, f, g, h, a, b, c, K( 5), x[ 5] );
+      R( c, d, e, f, g, h, a, b, K( 6), x[ 6] );
+      R( b, c, d, e, f, g, h, a, K( 7), x[ 7] );
+      R( a, b, c, d, e, f, g, h, K( 8), x[ 8] );
+      R( h, a, b, c, d, e, f, g, K( 9), x[ 9] );
+      R( g, h, a, b, c, d, e, f, K(10), x[10] );
+      R( f, g, h, a, b, c, d, e, K(11), x[11] );
+      R( e, f, g, h, a, b, c, d, K(12), x[12] );
+      R( d, e, f, g, h, a, b, c, K(13), x[13] );
+      R( c, d, e, f, g, h, a, b, K(14), x[14] );
+      R( b, c, d, e, f, g, h, a, K(15), x[15] );
+      R( a, b, c, d, e, f, g, h, K(16), M(16) );
+      R( h, a, b, c, d, e, f, g, K(17), M(17) );
+      R( g, h, a, b, c, d, e, f, K(18), M(18) );
+      R( f, g, h, a, b, c, d, e, K(19), M(19) );
+      R( e, f, g, h, a, b, c, d, K(20), M(20) );
+      R( d, e, f, g, h, a, b, c, K(21), M(21) );
+      R( c, d, e, f, g, h, a, b, K(22), M(22) );
+      R( b, c, d, e, f, g, h, a, K(23), M(23) );
+      R( a, b, c, d, e, f, g, h, K(24), M(24) );
+      R( h, a, b, c, d, e, f, g, K(25), M(25) );
+      R( g, h, a, b, c, d, e, f, K(26), M(26) );
+      R( f, g, h, a, b, c, d, e, K(27), M(27) );
+      R( e, f, g, h, a, b, c, d, K(28), M(28) );
+      R( d, e, f, g, h, a, b, c, K(29), M(29) );
+      R( c, d, e, f, g, h, a, b, K(30), M(30) );
+      R( b, c, d, e, f, g, h, a, K(31), M(31) );
+      R( a, b, c, d, e, f, g, h, K(32), M(32) );
+      R( h, a, b, c, d, e, f, g, K(33), M(33) );
+      R( g, h, a, b, c, d, e, f, K(34), M(34) );
+      R( f, g, h, a, b, c, d, e, K(35), M(35) );
+      R( e, f, g, h, a, b, c, d, K(36), M(36) );
+      R( d, e, f, g, h, a, b, c, K(37), M(37) );
+      R( c, d, e, f, g, h, a, b, K(38), M(38) );
+      R( b, c, d, e, f, g, h, a, K(39), M(39) );
+      R( a, b, c, d, e, f, g, h, K(40), M(40) );
+      R( h, a, b, c, d, e, f, g, K(41), M(41) );
+      R( g, h, a, b, c, d, e, f, K(42), M(42) );
+      R( f, g, h, a, b, c, d, e, K(43), M(43) );
+      R( e, f, g, h, a, b, c, d, K(44), M(44) );
+      R( d, e, f, g, h, a, b, c, K(45), M(45) );
+      R( c, d, e, f, g, h, a, b, K(46), M(46) );
+      R( b, c, d, e, f, g, h, a, K(47), M(47) );
+      R( a, b, c, d, e, f, g, h, K(48), M(48) );
+      R( h, a, b, c, d, e, f, g, K(49), M(49) );
+      R( g, h, a, b, c, d, e, f, K(50), M(50) );
+      R( f, g, h, a, b, c, d, e, K(51), M(51) );
+      R( e, f, g, h, a, b, c, d, K(52), M(52) );
+      R( d, e, f, g, h, a, b, c, K(53), M(53) );
+      R( c, d, e, f, g, h, a, b, K(54), M(54) );
+      R( b, c, d, e, f, g, h, a, K(55), M(55) );
+      R( a, b, c, d, e, f, g, h, K(56), M(56) );
+      R( h, a, b, c, d, e, f, g, K(57), M(57) );
+      R( g, h, a, b, c, d, e, f, K(58), M(58) );
+      R( f, g, h, a, b, c, d, e, K(59), M(59) );
+      R( e, f, g, h, a, b, c, d, K(60), M(60) );
+      R( d, e, f, g, h, a, b, c, K(61), M(61) );
+      R( c, d, e, f, g, h, a, b, K(62), M(62) );
+      R( b, c, d, e, f, g, h, a, K(63), M(63) );
+      R( a, b, c, d, e, f, g, h, K(64), M(64) );
+      R( h, a, b, c, d, e, f, g, K(65), M(65) );
+      R( g, h, a, b, c, d, e, f, K(66), M(66) );
+      R( f, g, h, a, b, c, d, e, K(67), M(67) );
+      R( e, f, g, h, a, b, c, d, K(68), M(68) );
+      R( d, e, f, g, h, a, b, c, K(69), M(69) );
+      R( c, d, e, f, g, h, a, b, K(70), M(70) );
+      R( b, c, d, e, f, g, h, a, K(71), M(71) );
+      R( a, b, c, d, e, f, g, h, K(72), M(72) );
+      R( h, a, b, c, d, e, f, g, K(73), M(73) );
+      R( g, h, a, b, c, d, e, f, K(74), M(74) );
+      R( f, g, h, a, b, c, d, e, K(75), M(75) );
+      R( e, f, g, h, a, b, c, d, K(76), M(76) );
+      R( d, e, f, g, h, a, b, c, K(77), M(77) );
+      R( c, d, e, f, g, h, a, b, K(78), M(78) );
+      R( b, c, d, e, f, g, h, a, K(79), M(79) );
+
+      a = ctx->state[0] = u64plus (ctx->state[0], a);
+      b = ctx->state[1] = u64plus (ctx->state[1], b);
+      c = ctx->state[2] = u64plus (ctx->state[2], c);
+      d = ctx->state[3] = u64plus (ctx->state[3], d);
+      e = ctx->state[4] = u64plus (ctx->state[4], e);
+      f = ctx->state[5] = u64plus (ctx->state[5], f);
+      g = ctx->state[6] = u64plus (ctx->state[6], g);
+      h = ctx->state[7] = u64plus (ctx->state[7], h);
+    }
+}
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index bbcc8c3a53a1c1a269f2a050ac92dc4dc88ced08..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sha512.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f6bac85488eea7a3deafd6737372ac9ba2ce64dd
--- /dev/null
@@ -0,0 +1,143 @@
+/* Declarations of functions and data types used for SHA512 and SHA384 sum
+   library functions.
+   Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef SHA512_H
+# define SHA512_H 1
+
+/* This file uses HAVE_OPENSSL_SHA512.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <stdio.h>
+# include "u64.h"
+
+# if HAVE_OPENSSL_SHA512
+#  ifndef OPENSSL_API_COMPAT
+#   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
+#  endif
+/* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
+#  include <openssl/opensslv.h>
+#  if OPENSSL_VERSION_MAJOR >= 3
+#   include <openssl/configuration.h>
+#   if (OPENSSL_CONFIGURED_API \
+        < (OPENSSL_API_COMPAT < 0x900000L ? OPENSSL_API_COMPAT : \
+           ((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \
+           + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \
+           + ((OPENSSL_API_COMPAT >> 12) & 0xFF)))
+#    undef HAVE_OPENSSL_SHA512
+#   endif
+#  endif
+#  if HAVE_OPENSSL_SHA512
+#   include <openssl/sha.h>
+#  endif
+# endif
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+enum { SHA384_DIGEST_SIZE = 384 / 8 };
+enum { SHA512_DIGEST_SIZE = 512 / 8 };
+
+# if HAVE_OPENSSL_SHA512
+#  define GL_OPENSSL_NAME 384
+#  include "gl_openssl.h"
+#  define GL_OPENSSL_NAME 512
+#  include "gl_openssl.h"
+# else
+/* Structure to save state of computation between the single steps.  */
+struct sha512_ctx
+{
+  u64 state[8];
+
+  u64 total[2];
+  size_t buflen;  /* ≥ 0, ≤ 256 */
+  u64 buffer[32]; /* 256 bytes; the first buflen bytes are in use */
+};
+
+/* Initialize structure containing state of computation. */
+extern void sha512_init_ctx (struct sha512_ctx *ctx);
+extern void sha384_init_ctx (struct sha512_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is necessary that LEN is a multiple of 128!!! */
+extern void sha512_process_block (const void *buffer, size_t len,
+                                  struct sha512_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is NOT required that LEN is a multiple of 128.  */
+extern void sha512_process_bytes (const void *buffer, size_t len,
+                                  struct sha512_ctx *ctx);
+
+/* Process the remaining bytes in the buffer and put result from CTX
+   in first 64 (48) bytes following RESBUF.  The result is always in little
+   endian byte order, so that a byte-wise output yields to the wanted
+   ASCII representation of the message digest.  */
+extern void *sha512_finish_ctx (struct sha512_ctx *ctx, void *restrict resbuf);
+extern void *sha384_finish_ctx (struct sha512_ctx *ctx, void *restrict resbuf);
+
+
+/* Put result from CTX in first 64 (48) bytes following RESBUF.  The result is
+   always in little endian byte order, so that a byte-wise output yields
+   to the wanted ASCII representation of the message digest.
+
+   IMPORTANT: On some systems it is required that RESBUF is correctly
+   aligned for a 32 bits value.  */
+extern void *sha512_read_ctx (const struct sha512_ctx *ctx,
+                              void *restrict resbuf);
+extern void *sha384_read_ctx (const struct sha512_ctx *ctx,
+                              void *restrict resbuf);
+
+
+/* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFER.
+   The result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+extern void *sha512_buffer (const char *buffer, size_t len,
+                            void *restrict resblock);
+extern void *sha384_buffer (const char *buffer, size_t len,
+                            void *restrict resblock);
+
+# endif
+
+/* Compute SHA512 (SHA384) message digest for bytes read from STREAM.
+   STREAM is an open file stream.  Regular files are handled more efficiently.
+   The contents of STREAM from its current position to its end will be read.
+   The case that the last operation on STREAM was an 'ungetc' is not supported.
+   The resulting message digest number will be written into the 64 (48) bytes
+   beginning at RESBLOCK.  */
+extern int sha512_stream (FILE *stream, void *resblock);
+extern int sha384_stream (FILE *stream, void *resblock);
+
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index f23ab8d32b8bcc39db14de6cf3528889745c5444..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sig-handler.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fcf82d1575b311fe9d6c4e63c0b201dc05d3b368
--- /dev/null
@@ -0,0 +1,21 @@
+/* Convenience declarations when working with <signal.h>.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define SIG_HANDLER_INLINE _GL_EXTERN_INLINE
+#include "sig-handler.h"
deleted file mode 120000 (symlink)
index 48f8727d42bf034355ba08e73037f432400d2061..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sig-handler.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..076d0abeaddc2e77f55b77e4ea9102db1e39a5f3
--- /dev/null
@@ -0,0 +1,53 @@
+/* Convenience declarations when working with <signal.h>.
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_SIG_HANDLER_H
+#define _GL_SIG_HANDLER_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <signal.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef SIG_HANDLER_INLINE
+# define SIG_HANDLER_INLINE _GL_INLINE
+#endif
+
+/* Convenience type when working with signal handlers.  */
+typedef void (*sa_handler_t) (int);
+
+/* Return the handler of a signal, as a sa_handler_t value regardless
+   of its true type.  The resulting function can be compared to
+   special values like SIG_IGN but it is not portable to call it.  */
+SIG_HANDLER_INLINE sa_handler_t _GL_ATTRIBUTE_PURE
+get_handler (struct sigaction const *a)
+{
+  /* POSIX says that special values like SIG_IGN can only occur when
+     action.sa_flags does not contain SA_SIGINFO.  But in Linux 2.4,
+     for example, sa_sigaction and sa_handler are aliases and a signal
+     is ignored if sa_sigaction (after casting) equals SIG_IGN.  In
+     this case, this implementation relies on the fact that the two
+     are aliases, and simply returns sa_handler.  */
+  return a->sa_handler;
+}
+
+_GL_INLINE_HEADER_END
+
+#endif /* _GL_SIG_HANDLER_H */
deleted file mode 120000 (symlink)
index 54b5eae85114a05ffbde46f96bb228aa2f310dbb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sig2str.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c6b91e384980d76b34f474bd2367a7698bf98d89
--- /dev/null
@@ -0,0 +1,364 @@
+/* sig2str.c -- convert between signal names and numbers
+
+   Copyright (C) 2002, 2004, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include <limits.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "sig2str.h"
+
+#ifndef SIGRTMIN
+# define SIGRTMIN 0
+# undef SIGRTMAX
+#endif
+#ifndef SIGRTMAX
+# define SIGRTMAX (SIGRTMIN - 1)
+#endif
+
+#define NUMNAME(name) { SIG##name, #name }
+
+/* Signal names and numbers.  Put the preferred name first.  */
+static struct numname { int num; char const name[8]; } numname_table[] =
+  {
+    /* Signals required by POSIX 1003.1-2001 base, listed in
+       traditional numeric order where possible.  */
+#ifdef SIGHUP
+    NUMNAME (HUP),
+#endif
+#ifdef SIGINT
+    NUMNAME (INT),
+#endif
+#ifdef SIGQUIT
+    NUMNAME (QUIT),
+#endif
+#ifdef SIGILL
+    NUMNAME (ILL),
+#endif
+#ifdef SIGTRAP
+    NUMNAME (TRAP),
+#endif
+#ifdef SIGABRT
+    NUMNAME (ABRT),
+#endif
+#ifdef SIGFPE
+    NUMNAME (FPE),
+#endif
+#ifdef SIGKILL
+    NUMNAME (KILL),
+#endif
+#ifdef SIGSEGV
+    NUMNAME (SEGV),
+#endif
+    /* On Haiku, SIGSEGV == SIGBUS, but we prefer SIGSEGV to match
+       strsignal.c output, so SIGBUS must be listed second.  */
+#ifdef SIGBUS
+    NUMNAME (BUS),
+#endif
+#ifdef SIGPIPE
+    NUMNAME (PIPE),
+#endif
+#ifdef SIGALRM
+    NUMNAME (ALRM),
+#endif
+#ifdef SIGTERM
+    NUMNAME (TERM),
+#endif
+#ifdef SIGUSR1
+    NUMNAME (USR1),
+#endif
+#ifdef SIGUSR2
+    NUMNAME (USR2),
+#endif
+#ifdef SIGCHLD
+    NUMNAME (CHLD),
+#endif
+#ifdef SIGURG
+    NUMNAME (URG),
+#endif
+#ifdef SIGSTOP
+    NUMNAME (STOP),
+#endif
+#ifdef SIGTSTP
+    NUMNAME (TSTP),
+#endif
+#ifdef SIGCONT
+    NUMNAME (CONT),
+#endif
+#ifdef SIGTTIN
+    NUMNAME (TTIN),
+#endif
+#ifdef SIGTTOU
+    NUMNAME (TTOU),
+#endif
+
+    /* Signals required by POSIX 1003.1-2001 with the XSI extension.  */
+#ifdef SIGSYS
+    NUMNAME (SYS),
+#endif
+#ifdef SIGPOLL
+    NUMNAME (POLL),
+#endif
+#ifdef SIGVTALRM
+    NUMNAME (VTALRM),
+#endif
+#ifdef SIGPROF
+    NUMNAME (PROF),
+#endif
+#ifdef SIGXCPU
+    NUMNAME (XCPU),
+#endif
+#ifdef SIGXFSZ
+    NUMNAME (XFSZ),
+#endif
+
+    /* Unix Version 7.  */
+#ifdef SIGIOT
+    NUMNAME (IOT),      /* Older name for ABRT.  */
+#endif
+#ifdef SIGEMT
+    NUMNAME (EMT),
+#endif
+
+    /* USG Unix.  */
+#ifdef SIGPHONE
+    NUMNAME (PHONE),
+#endif
+#ifdef SIGWIND
+    NUMNAME (WIND),
+#endif
+
+    /* Unix System V.  */
+#ifdef SIGCLD
+    NUMNAME (CLD),
+#endif
+#ifdef SIGPWR
+    NUMNAME (PWR),
+#endif
+
+    /* GNU/Linux 2.2 and Solaris 8.  */
+#ifdef SIGCANCEL
+    NUMNAME (CANCEL),
+#endif
+#ifdef SIGLWP
+    NUMNAME (LWP),
+#endif
+#ifdef SIGWAITING
+    NUMNAME (WAITING),
+#endif
+#ifdef SIGFREEZE
+    NUMNAME (FREEZE),
+#endif
+#ifdef SIGTHAW
+    NUMNAME (THAW),
+#endif
+#ifdef SIGLOST
+    NUMNAME (LOST),
+#endif
+#ifdef SIGWINCH
+    NUMNAME (WINCH),
+#endif
+
+    /* GNU/Linux 2.2.  */
+#ifdef SIGINFO
+    NUMNAME (INFO),
+#endif
+#ifdef SIGIO
+    NUMNAME (IO),
+#endif
+#ifdef SIGSTKFLT
+    NUMNAME (STKFLT),
+#endif
+
+    /* AIX 7.  */
+#ifdef SIGCPUFAIL
+    NUMNAME (CPUFAIL),
+#endif
+
+    /* AIX 5L.  */
+#ifdef SIGDANGER
+    NUMNAME (DANGER),
+#endif
+#ifdef SIGGRANT
+    NUMNAME (GRANT),
+#endif
+#ifdef SIGMIGRATE
+    NUMNAME (MIGRATE),
+#endif
+#ifdef SIGMSG
+    NUMNAME (MSG),
+#endif
+#ifdef SIGPRE
+    NUMNAME (PRE),
+#endif
+#ifdef SIGRETRACT
+    NUMNAME (RETRACT),
+#endif
+#ifdef SIGSAK
+    NUMNAME (SAK),
+#endif
+#ifdef SIGSOUND
+    NUMNAME (SOUND),
+#endif
+
+    /* Older AIX versions.  */
+#ifdef SIGALRM1
+    NUMNAME (ALRM1),    /* unknown; taken from Bash 2.05 */
+#endif
+#ifdef SIGKAP
+    NUMNAME (KAP),      /* Older name for SIGGRANT.  */
+#endif
+#ifdef SIGVIRT
+    NUMNAME (VIRT),     /* unknown; taken from Bash 2.05 */
+#endif
+#ifdef SIGWINDOW
+    NUMNAME (WINDOW),   /* Older name for SIGWINCH.  */
+#endif
+
+    /* OpenBSD.  */
+#ifdef SIGTHR
+    NUMNAME (THR),
+#endif
+
+    /* BeOS, Haiku */
+#ifdef SIGKILLTHR
+    NUMNAME (KILLTHR),
+#endif
+
+    /* Older HP-UX versions.  */
+#ifdef SIGDIL
+    NUMNAME (DIL),
+#endif
+
+    /* native Windows */
+#ifdef SIGBREAK
+    NUMNAME (BREAK),
+#endif
+
+    /* Korn shell and Bash, of uncertain vintage.  */
+    { 0, "EXIT" }
+  };
+
+#define NUMNAME_ENTRIES (sizeof numname_table / sizeof numname_table[0])
+
+/* ISDIGIT differs from isdigit, as follows:
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+     or EOF.
+   - It's typically faster.
+   POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
+   isdigit unless it's important to use the locale's definition
+   of "digit" even when the host does not conform to POSIX.  */
+#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
+
+/* Convert the signal name SIGNAME to a signal number.  Return the
+   signal number if successful, -1 otherwise.  */
+
+static int
+str2signum (char const *signame)
+{
+  if (ISDIGIT (*signame))
+    {
+      char *endp;
+      long int n = strtol (signame, &endp, 10);
+      if (! *endp && n <= SIGNUM_BOUND)
+        return n;
+    }
+  else
+    {
+      unsigned int i;
+      for (i = 0; i < NUMNAME_ENTRIES; i++)
+        if (strcmp (numname_table[i].name, signame) == 0)
+          return numname_table[i].num;
+
+      {
+        char *endp;
+        int rtmin = SIGRTMIN;
+        int rtmax = SIGRTMAX;
+
+        if (0 < rtmin && strncmp (signame, "RTMIN", 5) == 0)
+          {
+            long int n = strtol (signame + 5, &endp, 10);
+            if (! *endp && 0 <= n && n <= rtmax - rtmin)
+              return rtmin + n;
+          }
+        else if (0 < rtmax && strncmp (signame, "RTMAX", 5) == 0)
+          {
+            long int n = strtol (signame + 5, &endp, 10);
+            if (! *endp && rtmin - rtmax <= n && n <= 0)
+              return rtmax + n;
+          }
+      }
+    }
+
+  return -1;
+}
+
+/* Convert the signal name SIGNAME to the signal number *SIGNUM.
+   Return 0 if successful, -1 otherwise.  */
+
+int
+str2sig (char const *signame, int *signum)
+{
+  *signum = str2signum (signame);
+  return *signum < 0 ? -1 : 0;
+}
+
+/* Convert SIGNUM to a signal name in SIGNAME.  SIGNAME must point to
+   a buffer of at least SIG2STR_MAX bytes.  Return 0 if successful, -1
+   otherwise.  */
+
+int
+sig2str (int signum, char *signame)
+{
+  unsigned int i;
+  for (i = 0; i < NUMNAME_ENTRIES; i++)
+    if (numname_table[i].num == signum)
+      {
+        strcpy (signame, numname_table[i].name);
+        return 0;
+      }
+
+  {
+    int rtmin = SIGRTMIN;
+    int rtmax = SIGRTMAX;
+    int base, delta;
+
+    if (! (rtmin <= signum && signum <= rtmax))
+      return -1;
+
+    if (signum <= rtmin + (rtmax - rtmin) / 2)
+      {
+        strcpy (signame, "RTMIN");
+        base = rtmin;
+      }
+    else
+      {
+        strcpy (signame, "RTMAX");
+        base = rtmax;
+      }
+
+    delta = signum - base;
+    if (delta != 0)
+      sprintf (signame + 5, "%+d", delta);
+    return 0;
+  }
+}
deleted file mode 120000 (symlink)
index d69df5f015801afebc9a6257538a9a2a38b0cef1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sig2str.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..391da4b1d1ce1967ec20d7fef5d006e154ba5bc3
--- /dev/null
@@ -0,0 +1,53 @@
+/* sig2str.h -- convert between signal names and numbers
+
+   Copyright (C) 2002, 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <signal.h>
+
+/* Don't override system declarations of SIG2STR_MAX, sig2str, str2sig.  */
+#ifndef SIG2STR_MAX
+
+# include "intprops.h"
+
+/* Size of a buffer needed to hold a signal name like "HUP".  */
+# define SIG2STR_MAX (sizeof "SIGRTMAX" + INT_STRLEN_BOUND (int) - 1)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int sig2str (int, char *);
+int str2sig (char const *, int *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* An upper bound on signal numbers allowed by the system.  */
+
+#if defined _sys_nsig
+# define SIGNUM_BOUND (_sys_nsig - 1)
+#elif defined _SIG_MAXSIG
+# define SIGNUM_BOUND (_SIG_MAXSIG - 2) /* FreeBSD >= 7.  */
+#elif defined NSIG
+# define SIGNUM_BOUND (NSIG - 1)
+#else
+# define SIGNUM_BOUND 64
+#endif
deleted file mode 120000 (symlink)
index 1e8add3b019760373b8b2d7e4ce62ba4bfa37558..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sigaction.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1b2ceb522ece70374b1abf322849d0263a5e6c70
--- /dev/null
@@ -0,0 +1,204 @@
+/* POSIX compatible signal blocking.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Eric Blake <ebb9@byu.net>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <signal.h>
+
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/* This implementation of sigaction is tailored to native Windows behavior:
+   signal() has SysV semantics (ie. the handler is uninstalled before
+   it is invoked).  This is an inherent data race if an asynchronous
+   signal is sent twice in a row before we can reinstall our handler,
+   but there's nothing we can do about it.  Meanwhile, sigprocmask()
+   is not present, and while we can use the gnulib replacement to
+   provide critical sections, it too suffers from potential data races
+   in the face of an ill-timed asynchronous signal.  And we compound
+   the situation by reading static storage in a signal handler, which
+   POSIX warns is not generically async-signal-safe.  Oh well.
+
+   Additionally:
+     - We don't implement SA_NOCLDSTOP or SA_NOCLDWAIT, because SIGCHLD
+       is not defined.
+     - We don't implement SA_ONSTACK, because sigaltstack() is not present.
+     - We ignore SA_RESTART, because blocking native Windows API calls are
+       not interrupted anyway when an asynchronous signal occurs, and the
+       MSVCRT runtime never sets errno to EINTR.
+     - We don't implement SA_SIGINFO because it is impossible to do so
+       portably.
+
+   POSIX states that an application should not mix signal() and
+   sigaction().  We support the use of signal() within the gnulib
+   sigprocmask() substitute, but all other application code linked
+   with this module should stick with only sigaction().  */
+
+/* Check some of our assumptions.  */
+#if defined SIGCHLD || defined HAVE_SIGALTSTACK || defined HAVE_SIGINTERRUPT
+# error "Revisit the assumptions made in the sigaction module"
+#endif
+
+/* Out-of-range substitutes make a good fallback for uncatchable
+   signals.  */
+#ifndef SIGKILL
+# define SIGKILL (-1)
+#endif
+#ifndef SIGSTOP
+# define SIGSTOP (-1)
+#endif
+
+/* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias
+   for the signal SIGABRT.  Only one signal handler is stored for both
+   SIGABRT and SIGABRT_COMPAT.  SIGABRT_COMPAT is not a signal of its own.  */
+#if defined _WIN32 && ! defined __CYGWIN__
+# undef SIGABRT_COMPAT
+# define SIGABRT_COMPAT 6
+#endif
+
+/* A signal handler.  */
+typedef void (*handler_t) (int signal);
+
+/* Set of current actions.  If sa_handler for an entry is NULL, then
+   that signal is not currently handled by the sigaction handler.  */
+static struct sigaction volatile action_array[NSIG] /* = 0 */;
+
+/* Signal handler that is installed for signals.  */
+static void
+sigaction_handler (int sig)
+{
+  handler_t handler;
+  sigset_t mask;
+  sigset_t oldmask;
+  int saved_errno = errno;
+  if (sig < 0 || NSIG <= sig || !action_array[sig].sa_handler)
+    {
+      /* Unexpected situation; be careful to avoid recursive abort.  */
+      if (sig == SIGABRT)
+        signal (SIGABRT, SIG_DFL);
+      abort ();
+    }
+
+  /* Reinstall the signal handler when required; otherwise update the
+     bookkeeping so that the user's handler may call sigaction and get
+     accurate results.  We know the signal isn't currently blocked, or
+     we wouldn't be in its handler, therefore we know that we are not
+     interrupting a sigaction() call.  There is a race where any
+     asynchronous instance of the same signal occurring before we
+     reinstall the handler will trigger the default handler; oh
+     well.  */
+  handler = action_array[sig].sa_handler;
+  if ((action_array[sig].sa_flags & SA_RESETHAND) == 0)
+    signal (sig, sigaction_handler);
+  else
+    action_array[sig].sa_handler = NULL;
+
+  /* Block appropriate signals.  */
+  mask = action_array[sig].sa_mask;
+  if ((action_array[sig].sa_flags & SA_NODEFER) == 0)
+    sigaddset (&mask, sig);
+  sigprocmask (SIG_BLOCK, &mask, &oldmask);
+
+  /* Invoke the user's handler, then restore prior mask.  */
+  errno = saved_errno;
+  handler (sig);
+  saved_errno = errno;
+  sigprocmask (SIG_SETMASK, &oldmask, NULL);
+  errno = saved_errno;
+}
+
+/* Change and/or query the action that will be taken on delivery of
+   signal SIG.  If not NULL, ACT describes the new behavior.  If not
+   NULL, OACT is set to the prior behavior.  Return 0 on success, or
+   set errno and return -1 on failure.  */
+int
+sigaction (int sig, const struct sigaction *restrict act,
+           struct sigaction *restrict oact)
+{
+  sigset_t mask;
+  sigset_t oldmask;
+  int saved_errno;
+
+  if (sig < 0 || NSIG <= sig || sig == SIGKILL || sig == SIGSTOP
+      || (act && act->sa_handler == SIG_ERR))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+#ifdef SIGABRT_COMPAT
+  if (sig == SIGABRT_COMPAT)
+    sig = SIGABRT;
+#endif
+
+  /* POSIX requires sigaction() to be async-signal-safe.  In other
+     words, if an asynchronous signal can occur while we are anywhere
+     inside this function, the user's handler could then call
+     sigaction() recursively and expect consistent results.  We meet
+     this rule by using sigprocmask to block all signals before
+     modifying any data structure that could be read from a signal
+     handler; this works since we know that the gnulib sigprocmask
+     replacement does not try to use sigaction() from its handler.  */
+  if (!act && !oact)
+    return 0;
+  sigfillset (&mask);
+  sigprocmask (SIG_BLOCK, &mask, &oldmask);
+  if (oact)
+    {
+      if (action_array[sig].sa_handler)
+        *oact = action_array[sig];
+      else
+        {
+          /* Safe to change the handler at will here, since all
+             signals are currently blocked.  */
+          oact->sa_handler = signal (sig, SIG_DFL);
+          if (oact->sa_handler == SIG_ERR)
+            goto failure;
+          signal (sig, oact->sa_handler);
+          oact->sa_flags = SA_RESETHAND | SA_NODEFER;
+          sigemptyset (&oact->sa_mask);
+        }
+    }
+
+  if (act)
+    {
+      /* Safe to install the handler before updating action_array,
+         since all signals are currently blocked.  */
+      if (act->sa_handler == SIG_DFL || act->sa_handler == SIG_IGN)
+        {
+          if (signal (sig, act->sa_handler) == SIG_ERR)
+            goto failure;
+          action_array[sig].sa_handler = NULL;
+        }
+      else
+        {
+          if (signal (sig, sigaction_handler) == SIG_ERR)
+            goto failure;
+          action_array[sig] = *act;
+        }
+    }
+  sigprocmask (SIG_SETMASK, &oldmask, NULL);
+  return 0;
+
+ failure:
+  saved_errno = errno;
+  sigprocmask (SIG_SETMASK, &oldmask, NULL);
+  errno = saved_errno;
+  return -1;
+}
deleted file mode 120000 (symlink)
index 91e6f242248be99e4754f14647004a973f5085b5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/siglist.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8d06e9b50f581285c96fcf5be67bc656e1c39294
--- /dev/null
@@ -0,0 +1,132 @@
+/* Canonical list of all signal names.
+   Copyright (C) 1996-1999, 2008-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file should be usable for any platform, since it just associates
+   the SIG* macros with text names and descriptions.  The actual values
+   come from <bits/signum.h> (via <signal.h>).  For any signal macros do not
+   exist on every platform, we can use #ifdef tests here and still use
+   this single common file for all platforms.  */
+
+/* This file is included multiple times.  */
+
+/* Duplicate values (such as SIGBUS==SIGSEGV on Haiku) favor the last
+   list entry.  */
+
+/* Standard signals  */
+#ifdef SIGHUP
+  init_sig (SIGHUP, "HUP", N_("Hangup"))
+#endif
+#ifdef SIGINT
+  init_sig (SIGINT, "INT", N_("Interrupt"))
+#endif
+#ifdef SIGQUIT
+  init_sig (SIGQUIT, "QUIT", N_("Quit"))
+#endif
+#ifdef SIGILL
+  init_sig (SIGILL, "ILL", N_("Illegal instruction"))
+#endif
+#ifdef SIGTRAP
+  init_sig (SIGTRAP, "TRAP", N_("Trace/breakpoint trap"))
+#endif
+#ifdef SIGABRT
+  init_sig (SIGABRT, "ABRT", N_("Aborted"))
+#endif
+#ifdef SIGFPE
+  init_sig (SIGFPE, "FPE", N_("Floating point exception"))
+#endif
+#ifdef SIGKILL
+  init_sig (SIGKILL, "KILL", N_("Killed"))
+#endif
+#ifdef SIGBUS
+  init_sig (SIGBUS, "BUS", N_("Bus error"))
+#endif
+#ifdef SIGSEGV
+  init_sig (SIGSEGV, "SEGV", N_("Segmentation fault"))
+#endif
+#ifdef SIGPIPE
+  init_sig (SIGPIPE, "PIPE", N_("Broken pipe"))
+#endif
+#ifdef SIGALRM
+  init_sig (SIGALRM, "ALRM", N_("Alarm clock"))
+#endif
+#ifdef SIGTERM
+  init_sig (SIGTERM, "TERM", N_("Terminated"))
+#endif
+#ifdef SIGURG
+  init_sig (SIGURG, "URG", N_("Urgent I/O condition"))
+#endif
+#ifdef SIGSTOP
+  init_sig (SIGSTOP, "STOP", N_("Stopped (signal)"))
+#endif
+#ifdef SIGTSTP
+  init_sig (SIGTSTP, "TSTP", N_("Stopped"))
+#endif
+#ifdef SIGCONT
+  init_sig (SIGCONT, "CONT", N_("Continued"))
+#endif
+#ifdef SIGCHLD
+  init_sig (SIGCHLD, "CHLD", N_("Child exited"))
+#endif
+#ifdef SIGTTIN
+  init_sig (SIGTTIN, "TTIN", N_("Stopped (tty input)"))
+#endif
+#ifdef SIGTTOU
+  init_sig (SIGTTOU, "TTOU", N_("Stopped (tty output)"))
+#endif
+#ifdef SIGIO
+  init_sig (SIGIO, "IO", N_("I/O possible"))
+#endif
+#ifdef SIGXCPU
+  init_sig (SIGXCPU, "XCPU", N_("CPU time limit exceeded"))
+#endif
+#ifdef SIGXFSZ
+  init_sig (SIGXFSZ, "XFSZ", N_("File size limit exceeded"))
+#endif
+#ifdef SIGVTALRM
+  init_sig (SIGVTALRM, "VTALRM", N_("Virtual timer expired"))
+#endif
+#ifdef SIGPROF
+  init_sig (SIGPROF, "PROF", N_("Profiling timer expired"))
+#endif
+#ifdef SIGWINCH
+  init_sig (SIGWINCH, "WINCH", N_("Window changed"))
+#endif
+#ifdef SIGUSR1
+  init_sig (SIGUSR1, "USR1", N_("User defined signal 1"))
+#endif
+#ifdef SIGUSR2
+  init_sig (SIGUSR2, "USR2", N_("User defined signal 2"))
+#endif
+
+/* Variations  */
+#ifdef SIGEMT
+  init_sig (SIGEMT, "EMT", N_("EMT trap"))
+#endif
+#ifdef SIGSYS
+  init_sig (SIGSYS, "SYS", N_("Bad system call"))
+#endif
+#ifdef SIGSTKFLT
+  init_sig (SIGSTKFLT, "STKFLT", N_("Stack fault"))
+#endif
+#ifdef SIGINFO
+  init_sig (SIGINFO, "INFO", N_("Information request"))
+#elif defined(SIGPWR) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
+  init_sig (SIGPWR, "PWR", N_("Power failure"))
+#endif
+#ifdef SIGLOST
+  init_sig (SIGLOST, "LOST", N_("Resource lost"))
+#endif
deleted file mode 120000 (symlink)
index c5a7d53efc21a58ba4ff549988053d0bf0bf34cf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/signal.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..107226e3dcf7860f311df0d2097a1642d63d53c7
--- /dev/null
@@ -0,0 +1,500 @@
+/* A GNU-like <signal.h>.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T)
+/* Special invocation convention:
+   - Inside glibc header files.
+   - On glibc systems we have a sequence of nested includes
+     <signal.h> -> <ucontext.h> -> <signal.h>.
+     In this situation, the functions are not yet declared, therefore we cannot
+     provide the C++ aliases.
+   - On glibc systems with GCC 4.3 we have a sequence of nested includes
+     <csignal> -> </usr/include/signal.h> -> <sys/ucontext.h> -> <signal.h>.
+     In this situation, some of the functions are not yet declared, therefore
+     we cannot provide the C++ aliases.  */
+
+# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_SIGNAL_H
+
+#define _GL_ALREADY_INCLUDING_SIGNAL_H
+
+/* Define pid_t, uid_t.
+   Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.
+   On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes
+   us; so include <sys/types.h> now, before the second inclusion guard.  */
+#include <sys/types.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@
+
+#undef _GL_ALREADY_INCLUDING_SIGNAL_H
+
+#ifndef _@GUARD_PREFIX@_SIGNAL_H
+#define _@GUARD_PREFIX@_SIGNAL_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* For testing the OpenBSD version.  */
+#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
+    && defined __OpenBSD__
+# include <sys/param.h>
+#endif
+
+/* Mac OS X 10.3, FreeBSD < 8.0, OpenBSD < 5.1, OSF/1 4.0, Solaris 2.6, Android,
+   OS/2 kLIBC declare pthread_sigmask in <pthread.h>, not in <signal.h>.
+   But avoid namespace pollution on glibc systems.*/
+#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
+    && ((defined __APPLE__ && defined __MACH__) \
+        || (defined __FreeBSD__ && __FreeBSD__ < 8) \
+        || (defined __OpenBSD__ && OpenBSD < 201205) \
+        || defined __osf__ || defined __sun || defined __ANDROID__ \
+        || defined __KLIBC__) \
+    && ! defined __GLIBC__
+# include <pthread.h>
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* On AIX, sig_atomic_t already includes volatile.  C99 requires that
+   'volatile sig_atomic_t' ignore the extra modifier, but C89 did not.
+   Hence, redefine this to a non-volatile type as needed.  */
+#if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
+# if !GNULIB_defined_sig_atomic_t
+typedef int rpl_sig_atomic_t;
+#  undef sig_atomic_t
+#  define sig_atomic_t rpl_sig_atomic_t
+#  define GNULIB_defined_sig_atomic_t 1
+# endif
+#endif
+
+/* A set or mask of signals.  */
+#if !@HAVE_SIGSET_T@
+# if !GNULIB_defined_sigset_t
+typedef unsigned int sigset_t;
+#  define GNULIB_defined_sigset_t 1
+# endif
+#endif
+
+/* Define sighandler_t, the type of signal handlers.  A GNU extension.  */
+#if !@HAVE_SIGHANDLER_T@
+# ifdef __cplusplus
+extern "C" {
+# endif
+# if !GNULIB_defined_sighandler_t
+typedef void (*sighandler_t) (int);
+#  define GNULIB_defined_sighandler_t 1
+# endif
+# ifdef __cplusplus
+}
+# endif
+#endif
+
+
+#if @GNULIB_SIGNAL_H_SIGPIPE@
+# ifndef SIGPIPE
+/* Define SIGPIPE to a value that does not overlap with other signals.  */
+#  define SIGPIPE 13
+#  define GNULIB_defined_SIGPIPE 1
+/* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
+   'write', 'stdio'.  */
+# endif
+#endif
+
+
+/* Maximum signal number + 1.  */
+#ifndef NSIG
+# if defined __TANDEM
+#  define NSIG 32
+# endif
+#endif
+
+
+#if @GNULIB_PTHREAD_SIGMASK@
+# if @REPLACE_PTHREAD_SIGMASK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pthread_sigmask
+#   define pthread_sigmask rpl_pthread_sigmask
+#  endif
+_GL_FUNCDECL_RPL (pthread_sigmask, int,
+                  (int how,
+                   const sigset_t *restrict new_mask,
+                   sigset_t *restrict old_mask));
+_GL_CXXALIAS_RPL (pthread_sigmask, int,
+                  (int how,
+                   const sigset_t *restrict new_mask,
+                   sigset_t *restrict old_mask));
+# else
+#  if !(@HAVE_PTHREAD_SIGMASK@ || defined pthread_sigmask)
+_GL_FUNCDECL_SYS (pthread_sigmask, int,
+                  (int how,
+                   const sigset_t *restrict new_mask,
+                   sigset_t *restrict old_mask));
+#  endif
+_GL_CXXALIAS_SYS (pthread_sigmask, int,
+                  (int how,
+                   const sigset_t *restrict new_mask,
+                   sigset_t *restrict old_mask));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pthread_sigmask);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_sigmask
+# if HAVE_RAW_DECL_PTHREAD_SIGMASK
+_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - "
+                 "use gnulib module pthread_sigmask for portability");
+# endif
+#endif
+
+
+#if @GNULIB_RAISE@
+# if @REPLACE_RAISE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef raise
+#   define raise rpl_raise
+#  endif
+_GL_FUNCDECL_RPL (raise, int, (int sig));
+_GL_CXXALIAS_RPL (raise, int, (int sig));
+# else
+#  if !@HAVE_RAISE@
+_GL_FUNCDECL_SYS (raise, int, (int sig));
+#  endif
+_GL_CXXALIAS_SYS (raise, int, (int sig));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (raise);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef raise
+/* Assume raise is always declared.  */
+_GL_WARN_ON_USE (raise, "raise can crash on native Windows - "
+                 "use gnulib module raise for portability");
+#endif
+
+
+#if @GNULIB_SIGPROCMASK@
+# if !@HAVE_POSIX_SIGNALBLOCKING@
+
+#  ifndef GNULIB_defined_signal_blocking
+#   define GNULIB_defined_signal_blocking 1
+#  endif
+
+/* Maximum signal number + 1.  */
+#  ifndef NSIG
+#   define NSIG 32
+#  endif
+
+/* This code supports only 32 signals.  */
+#  if !GNULIB_defined_verify_NSIG_constraint
+typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
+#   define GNULIB_defined_verify_NSIG_constraint 1
+#  endif
+
+# endif
+
+/* When also using extern inline, suppress the use of static inline in
+   standard headers of problematic Apple configurations, as Libc at
+   least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
+   <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>.
+   Perhaps Apple will fix this some day.  */
+#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
+     && (defined __i386__ || defined __x86_64__))
+# undef sigaddset
+# undef sigdelset
+# undef sigemptyset
+# undef sigfillset
+# undef sigismember
+#endif
+
+/* Test whether a given signal is contained in a signal set.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on Mac OS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigismember
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
+                                    _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
+_GL_CXXALIASWARN (sigismember);
+
+/* Initialize a signal set to the empty set.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on Mac OS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigemptyset
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
+_GL_CXXALIASWARN (sigemptyset);
+
+/* Add a signal to a signal set.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on Mac OS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigaddset
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
+                                  _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
+_GL_CXXALIASWARN (sigaddset);
+
+/* Remove a signal from a signal set.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on Mac OS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigdelset
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
+                                  _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
+_GL_CXXALIASWARN (sigdelset);
+
+/* Fill a signal set with all possible signals.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on Mac OS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigfillset
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
+_GL_CXXALIASWARN (sigfillset);
+
+/* Return the set of those blocked signals that are pending.  */
+# if !@HAVE_POSIX_SIGNALBLOCKING@
+_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
+_GL_CXXALIASWARN (sigpending);
+
+/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
+   Then, if SET is not NULL, affect the current set of blocked signals by
+   combining it with *SET as indicated in OPERATION.
+   In this implementation, you are not allowed to change a signal handler
+   while the signal is blocked.  */
+# if !@HAVE_POSIX_SIGNALBLOCKING@
+#  define SIG_BLOCK   0  /* blocked_set = blocked_set | *set; */
+#  define SIG_SETMASK 1  /* blocked_set = *set; */
+#  define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
+_GL_FUNCDECL_SYS (sigprocmask, int,
+                  (int operation,
+                   const sigset_t *restrict set,
+                   sigset_t *restrict old_set));
+# endif
+_GL_CXXALIAS_SYS (sigprocmask, int,
+                  (int operation,
+                   const sigset_t *restrict set,
+                   sigset_t *restrict old_set));
+_GL_CXXALIASWARN (sigprocmask);
+
+/* Install the handler FUNC for signal SIG, and return the previous
+   handler.  */
+# ifdef __cplusplus
+extern "C" {
+# endif
+# if !GNULIB_defined_function_taking_int_returning_void_t
+typedef void (*_gl_function_taking_int_returning_void_t) (int);
+#  define GNULIB_defined_function_taking_int_returning_void_t 1
+# endif
+# ifdef __cplusplus
+}
+# endif
+# if !@HAVE_POSIX_SIGNALBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define signal rpl_signal
+#  endif
+_GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t,
+                  (int sig, _gl_function_taking_int_returning_void_t func));
+_GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
+                  (int sig, _gl_function_taking_int_returning_void_t func));
+# else
+/* On OpenBSD, the declaration of 'signal' may not be present at this point,
+   because it occurs in <sys/signal.h>, not <signal.h> directly.  */
+#  if defined __OpenBSD__
+_GL_FUNCDECL_SYS (signal, _gl_function_taking_int_returning_void_t,
+                  (int sig, _gl_function_taking_int_returning_void_t func));
+#  endif
+_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
+                  (int sig, _gl_function_taking_int_returning_void_t func));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (signal);
+# endif
+
+# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
+/* Raise signal SIGPIPE.  */
+_GL_EXTERN_C int _gl_raise_SIGPIPE (void);
+# endif
+
+#elif defined GNULIB_POSIXCHECK
+# undef sigaddset
+# if HAVE_RAW_DECL_SIGADDSET
+_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigdelset
+# if HAVE_RAW_DECL_SIGDELSET
+_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigemptyset
+# if HAVE_RAW_DECL_SIGEMPTYSET
+_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigfillset
+# if HAVE_RAW_DECL_SIGFILLSET
+_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigismember
+# if HAVE_RAW_DECL_SIGISMEMBER
+_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigpending
+# if HAVE_RAW_DECL_SIGPENDING
+_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigprocmask
+# if HAVE_RAW_DECL_SIGPROCMASK
+_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+#endif /* @GNULIB_SIGPROCMASK@ */
+
+
+#if @GNULIB_SIGACTION@
+# if !@HAVE_SIGACTION@
+
+#  if !@HAVE_SIGINFO_T@
+
+#   if !GNULIB_defined_siginfo_types
+
+/* Present to allow compilation, but unsupported by gnulib.  */
+union sigval
+{
+  int sival_int;
+  void *sival_ptr;
+};
+
+/* Present to allow compilation, but unsupported by gnulib.  */
+struct siginfo_t
+{
+  int si_signo;
+  int si_code;
+  int si_errno;
+  pid_t si_pid;
+  uid_t si_uid;
+  void *si_addr;
+  int si_status;
+  long si_band;
+  union sigval si_value;
+};
+typedef struct siginfo_t siginfo_t;
+
+#    define GNULIB_defined_siginfo_types 1
+#   endif
+
+#  endif /* !@HAVE_SIGINFO_T@ */
+
+/* We assume that platforms which lack the sigaction() function also lack
+   the 'struct sigaction' type, and vice versa.  */
+
+#  if !GNULIB_defined_struct_sigaction
+
+struct sigaction
+{
+  union
+  {
+    void (*_sa_handler) (int);
+    /* Present to allow compilation, but unsupported by gnulib.  POSIX
+       says that implementations may, but not must, make sa_sigaction
+       overlap with sa_handler, but we know of no implementation where
+       they do not overlap.  */
+    void (*_sa_sigaction) (int, siginfo_t *, void *);
+  } _sa_func;
+  sigset_t sa_mask;
+  /* Not all POSIX flags are supported.  */
+  int sa_flags;
+};
+#   define sa_handler _sa_func._sa_handler
+#   define sa_sigaction _sa_func._sa_sigaction
+/* Unsupported flags are not present.  */
+#   define SA_RESETHAND 1
+#   define SA_NODEFER 2
+#   define SA_RESTART 4
+
+#   define GNULIB_defined_struct_sigaction 1
+#  endif
+
+_GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict,
+                                   struct sigaction *restrict));
+
+# elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
+
+#  define sa_sigaction sa_handler
+
+# endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
+
+_GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict,
+                                   struct sigaction *restrict));
+_GL_CXXALIASWARN (sigaction);
+
+#elif defined GNULIB_POSIXCHECK
+# undef sigaction
+# if HAVE_RAW_DECL_SIGACTION
+_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
+                 "use the gnulib module sigaction for portability");
+# endif
+#endif
+
+/* Some systems don't have SA_NODEFER.  */
+#ifndef SA_NODEFER
+# define SA_NODEFER 0
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SIGNAL_H */
+#endif /* _@GUARD_PREFIX@_SIGNAL_H */
+#endif
deleted file mode 120000 (symlink)
index 138bb876cb82d0f5116d354691bd12229e2c3280..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/signbitd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d662192a3be69dcf06d0ca16660f9ee66fbf1fb6
--- /dev/null
@@ -0,0 +1,64 @@
+/* signbit() macro: Determine the sign bit of a floating-point number.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <math.h>
+
+#include <string.h>
+#include "isnand-nolibm.h"
+#include "float+.h"
+
+#ifdef gl_signbitd_OPTIMIZED_MACRO
+# undef gl_signbitd
+#endif
+
+int
+gl_signbitd (double arg)
+{
+#if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT
+  /* The use of a union to extract the bits of the representation of a
+     'long double' is safe in practice, despite of the "aliasing rules" of
+     C99, because the GCC docs say
+       "Even with '-fstrict-aliasing', type-punning is allowed, provided the
+        memory is accessed through the union type."
+     and similarly for other compilers.  */
+# define NWORDS \
+    ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+  union { double value; unsigned int word[NWORDS]; } m;
+  m.value = arg;
+  return (m.word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1;
+#elif HAVE_COPYSIGN_IN_LIBC
+  return copysign (1.0, arg) < 0;
+#else
+  /* This does not do the right thing for NaN, but this is irrelevant for
+     most use cases.  */
+  if (isnand (arg))
+    return 0;
+  if (arg < 0.0)
+    return 1;
+  else if (arg == 0.0)
+    {
+      /* Distinguish 0.0 and -0.0.  */
+      static double plus_zero = 0.0;
+      double arg_mem = arg;
+      return (memcmp (&plus_zero, &arg_mem, SIZEOF_DBL) != 0);
+    }
+  else
+    return 0;
+#endif
+}
deleted file mode 120000 (symlink)
index b3ad2d38000e67149e0f588021b32226551baabb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/signbitf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f24caf4a123eb302a8a2b73089d81d7a9c8c7b18
--- /dev/null
@@ -0,0 +1,64 @@
+/* signbit() macro: Determine the sign bit of a floating-point number.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <math.h>
+
+#include <string.h>
+#include "isnanf-nolibm.h"
+#include "float+.h"
+
+#ifdef gl_signbitf_OPTIMIZED_MACRO
+# undef gl_signbitf
+#endif
+
+int
+gl_signbitf (float arg)
+{
+#if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT
+  /* The use of a union to extract the bits of the representation of a
+     'long double' is safe in practice, despite of the "aliasing rules" of
+     C99, because the GCC docs say
+       "Even with '-fstrict-aliasing', type-punning is allowed, provided the
+        memory is accessed through the union type."
+     and similarly for other compilers.  */
+# define NWORDS \
+    ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+  union { float value; unsigned int word[NWORDS]; } m;
+  m.value = arg;
+  return (m.word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1;
+#elif HAVE_COPYSIGNF_IN_LIBC
+  return copysignf (1.0f, arg) < 0;
+#else
+  /* This does not do the right thing for NaN, but this is irrelevant for
+     most use cases.  */
+  if (isnanf (arg))
+    return 0;
+  if (arg < 0.0f)
+    return 1;
+  else if (arg == 0.0f)
+    {
+      /* Distinguish 0.0f and -0.0f.  */
+      static float plus_zero = 0.0f;
+      float arg_mem = arg;
+      return (memcmp (&plus_zero, &arg_mem, SIZEOF_FLT) != 0);
+    }
+  else
+    return 0;
+#endif
+}
deleted file mode 120000 (symlink)
index 254b8f8c6b64c35b5bafe38a654dea6881a8472f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/signbitl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..164b89acc4b904a62636bc57b57ac68ee68544a8
--- /dev/null
@@ -0,0 +1,64 @@
+/* signbit() macro: Determine the sign bit of a floating-point number.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <math.h>
+
+#include <string.h>
+#include "isnanl-nolibm.h"
+#include "float+.h"
+
+#ifdef gl_signbitl_OPTIMIZED_MACRO
+# undef gl_signbitl
+#endif
+
+int
+gl_signbitl (long double arg)
+{
+#if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT
+  /* The use of a union to extract the bits of the representation of a
+     'long double' is safe in practice, despite of the "aliasing rules" of
+     C99, because the GCC docs say
+       "Even with '-fstrict-aliasing', type-punning is allowed, provided the
+        memory is accessed through the union type."
+     and similarly for other compilers.  */
+# define NWORDS \
+    ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+  union { long double value; unsigned int word[NWORDS]; } m;
+  m.value = arg;
+  return (m.word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1;
+#elif HAVE_COPYSIGNL_IN_LIBC
+  return copysignl (1.0L, arg) < 0;
+#else
+  /* This does not do the right thing for NaN, but this is irrelevant for
+     most use cases.  */
+  if (isnanl (arg))
+    return 0;
+  if (arg < 0.0L)
+    return 1;
+  else if (arg == 0.0L)
+    {
+      /* Distinguish 0.0L and -0.0L.  */
+      static long double plus_zero = 0.0L;
+      long double arg_mem = arg;
+      return (memcmp (&plus_zero, &arg_mem, SIZEOF_LDBL) != 0);
+    }
+  else
+    return 0;
+#endif
+}
deleted file mode 120000 (symlink)
index 4ed51fdc7234dd36c0e47e9ca3248b71865139b1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sigprocmask.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3df69b51e541ccd54b2190e82179998db749322f
--- /dev/null
@@ -0,0 +1,349 @@
+/* POSIX compatible signal blocking.
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2006.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <signal.h>
+
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+/* We assume that a platform without POSIX signal blocking functions
+   also does not have the POSIX sigaction() function, only the
+   signal() function.  We also assume signal() has SysV semantics,
+   where any handler is uninstalled prior to being invoked.  This is
+   true for native Windows platforms.  */
+
+/* We use raw signal(), but also provide a wrapper rpl_signal() so
+   that applications can query or change a blocked signal.  */
+#undef signal
+
+/* Provide invalid signal numbers as fallbacks if the uncatchable
+   signals are not defined.  */
+#ifndef SIGKILL
+# define SIGKILL (-1)
+#endif
+#ifndef SIGSTOP
+# define SIGSTOP (-1)
+#endif
+
+/* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias
+   for the signal SIGABRT.  Only one signal handler is stored for both
+   SIGABRT and SIGABRT_COMPAT.  SIGABRT_COMPAT is not a signal of its own.  */
+#if defined _WIN32 && ! defined __CYGWIN__
+# undef SIGABRT_COMPAT
+# define SIGABRT_COMPAT 6
+#endif
+#ifdef SIGABRT_COMPAT
+# define SIGABRT_COMPAT_MASK (1U << SIGABRT_COMPAT)
+#else
+# define SIGABRT_COMPAT_MASK 0
+#endif
+
+typedef void (*handler_t) (int);
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static handler_t
+signal_nothrow (int sig, handler_t handler)
+{
+  handler_t result;
+
+  TRY_MSVC_INVAL
+    {
+      result = signal (sig, handler);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = SIG_ERR;
+      errno = EINVAL;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+# define signal signal_nothrow
+#endif
+
+/* Handling of gnulib defined signals.  */
+
+#if GNULIB_defined_SIGPIPE
+static handler_t SIGPIPE_handler = SIG_DFL;
+#endif
+
+#if GNULIB_defined_SIGPIPE
+static handler_t
+ext_signal (int sig, handler_t handler)
+{
+  switch (sig)
+    {
+    case SIGPIPE:
+      {
+        handler_t old_handler = SIGPIPE_handler;
+        SIGPIPE_handler = handler;
+        return old_handler;
+      }
+    default: /* System defined signal */
+      return signal (sig, handler);
+    }
+}
+# undef signal
+# define signal ext_signal
+#endif
+
+int
+sigismember (const sigset_t *set, int sig)
+{
+  if (sig >= 0 && sig < NSIG)
+    {
+      #ifdef SIGABRT_COMPAT
+      if (sig == SIGABRT_COMPAT)
+        sig = SIGABRT;
+      #endif
+
+      return (*set >> sig) & 1;
+    }
+  else
+    return 0;
+}
+
+int
+sigemptyset (sigset_t *set)
+{
+  *set = 0;
+  return 0;
+}
+
+int
+sigaddset (sigset_t *set, int sig)
+{
+  if (sig >= 0 && sig < NSIG)
+    {
+      #ifdef SIGABRT_COMPAT
+      if (sig == SIGABRT_COMPAT)
+        sig = SIGABRT;
+      #endif
+
+      *set |= 1U << sig;
+      return 0;
+    }
+  else
+    {
+      errno = EINVAL;
+      return -1;
+    }
+}
+
+int
+sigdelset (sigset_t *set, int sig)
+{
+  if (sig >= 0 && sig < NSIG)
+    {
+      #ifdef SIGABRT_COMPAT
+      if (sig == SIGABRT_COMPAT)
+        sig = SIGABRT;
+      #endif
+
+      *set &= ~(1U << sig);
+      return 0;
+    }
+  else
+    {
+      errno = EINVAL;
+      return -1;
+    }
+}
+
+
+int
+sigfillset (sigset_t *set)
+{
+  *set = ((2U << (NSIG - 1)) - 1) & ~ SIGABRT_COMPAT_MASK;
+  return 0;
+}
+
+/* Set of currently blocked signals.  */
+static volatile sigset_t blocked_set /* = 0 */;
+
+/* Set of currently blocked and pending signals.  */
+static volatile sig_atomic_t pending_array[NSIG] /* = { 0 } */;
+
+/* Signal handler that is installed for blocked signals.  */
+static void
+blocked_handler (int sig)
+{
+  /* Reinstall the handler, in case the signal occurs multiple times
+     while blocked.  There is an inherent race where an asynchronous
+     signal in between when the kernel uninstalled the handler and
+     when we reinstall it will trigger the default handler; oh
+     well.  */
+  signal (sig, blocked_handler);
+  if (sig >= 0 && sig < NSIG)
+    pending_array[sig] = 1;
+}
+
+int
+sigpending (sigset_t *set)
+{
+  sigset_t pending = 0;
+  int sig;
+
+  for (sig = 0; sig < NSIG; sig++)
+    if (pending_array[sig])
+      pending |= 1U << sig;
+  *set = pending;
+  return 0;
+}
+
+/* The previous signal handlers.
+   Only the array elements corresponding to blocked signals are relevant.  */
+static volatile handler_t old_handlers[NSIG];
+
+int
+sigprocmask (int operation, const sigset_t *set, sigset_t *old_set)
+{
+  if (old_set != NULL)
+    *old_set = blocked_set;
+
+  if (set != NULL)
+    {
+      sigset_t new_blocked_set;
+      sigset_t to_unblock;
+      sigset_t to_block;
+
+      switch (operation)
+        {
+        case SIG_BLOCK:
+          new_blocked_set = blocked_set | *set;
+          break;
+        case SIG_SETMASK:
+          new_blocked_set = *set;
+          break;
+        case SIG_UNBLOCK:
+          new_blocked_set = blocked_set & ~*set;
+          break;
+        default:
+          errno = EINVAL;
+          return -1;
+        }
+      to_unblock = blocked_set & ~new_blocked_set;
+      to_block = new_blocked_set & ~blocked_set;
+
+      if (to_block != 0)
+        {
+          int sig;
+
+          for (sig = 0; sig < NSIG; sig++)
+            if ((to_block >> sig) & 1)
+              {
+                pending_array[sig] = 0;
+                if ((old_handlers[sig] = signal (sig, blocked_handler)) != SIG_ERR)
+                  blocked_set |= 1U << sig;
+              }
+        }
+
+      if (to_unblock != 0)
+        {
+          sig_atomic_t received[NSIG];
+          int sig;
+
+          for (sig = 0; sig < NSIG; sig++)
+            if ((to_unblock >> sig) & 1)
+              {
+                if (signal (sig, old_handlers[sig]) != blocked_handler)
+                  /* The application changed a signal handler while the signal
+                     was blocked, bypassing our rpl_signal replacement.
+                     We don't support this.  */
+                  abort ();
+                received[sig] = pending_array[sig];
+                blocked_set &= ~(1U << sig);
+                pending_array[sig] = 0;
+              }
+            else
+              received[sig] = 0;
+
+          for (sig = 0; sig < NSIG; sig++)
+            if (received[sig])
+              raise (sig);
+        }
+    }
+  return 0;
+}
+
+/* Install the handler FUNC for signal SIG, and return the previous
+   handler.  */
+handler_t
+rpl_signal (int sig, handler_t handler)
+{
+  /* We must provide a wrapper, so that a user can query what handler
+     they installed even if that signal is currently blocked.  */
+  if (sig >= 0 && sig < NSIG && sig != SIGKILL && sig != SIGSTOP
+      && handler != SIG_ERR)
+    {
+      #ifdef SIGABRT_COMPAT
+      if (sig == SIGABRT_COMPAT)
+        sig = SIGABRT;
+      #endif
+
+      if (blocked_set & (1U << sig))
+        {
+          /* POSIX states that sigprocmask and signal are both
+             async-signal-safe.  This is not true of our
+             implementation - there is a slight data race where an
+             asynchronous interrupt on signal A can occur after we
+             install blocked_handler but before we have updated
+             old_handlers for signal B, such that handler A can see
+             stale information if it calls signal(B).  Oh well -
+             signal handlers really shouldn't try to manipulate the
+             installed handlers of unrelated signals.  */
+          handler_t result = old_handlers[sig];
+          old_handlers[sig] = handler;
+          return result;
+        }
+      else
+        return signal (sig, handler);
+    }
+  else
+    {
+      errno = EINVAL;
+      return SIG_ERR;
+    }
+}
+
+#if GNULIB_defined_SIGPIPE
+/* Raise the signal SIGPIPE.  */
+int
+_gl_raise_SIGPIPE (void)
+{
+  if (blocked_set & (1U << SIGPIPE))
+    pending_array[SIGPIPE] = 1;
+  else
+    {
+      handler_t handler = SIGPIPE_handler;
+      if (handler == SIG_DFL)
+        exit (128 + SIGPIPE);
+      else if (handler != SIG_IGN)
+        (*handler) (SIGPIPE);
+    }
+  return 0;
+}
+#endif
deleted file mode 120000 (symlink)
index 9c71dadae35bec16b5f677f8873cb8b2e8562c31..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/size_max.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bd2eb43e8df2fd0f415067f5612a2308a7756444
--- /dev/null
@@ -0,0 +1,35 @@
+/* size_max.h -- declare SIZE_MAX through system headers
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef GNULIB_SIZE_MAX_H
+#define GNULIB_SIZE_MAX_H
+
+/* This file uses HAVE_STDINT_H.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get SIZE_MAX declaration on systems like Solaris 7/8/9.  */
+# include <limits.h>
+/* Get SIZE_MAX declaration on systems like glibc 2.  */
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+/* On systems where these include files don't define it, SIZE_MAX is defined
+   in config.h.  */
+
+#endif /* GNULIB_SIZE_MAX_H */
deleted file mode 120000 (symlink)
index 20f01ff590b805c7c6ab12ab07e0ea072395ccfb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sm3-stream.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c534edb12650f2f652b08e5f3b1f198e93ab7a0e
--- /dev/null
@@ -0,0 +1,123 @@
+/* sm3.c - Functions to compute SM3 message digest of files or memory blocks
+   according to the specification GM/T 004-2012 Cryptographic Hash Algorithm
+   SM3, published by State Encryption Management Bureau, China.
+
+   SM3 cryptographic hash algorithm.
+   <http://www.sca.gov.cn/sca/xwdt/2010-12/17/content_1002389.shtml>
+
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jia Zhang <qianyue.zj@alibaba-inc.com>, 2017,
+   considerably copypasting from David Madore's sha256.c */
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_SM3
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "sm3.h"
+
+#include <stdlib.h>
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+#define BLOCKSIZE 32768
+#if BLOCKSIZE % 64 != 0
+# error "invalid BLOCKSIZE"
+#endif
+
+/* Compute SM3 message digest for bytes read from STREAM.  The
+   resulting message digest number will be written into the 32 bytes
+   beginning at RESBLOCK.  */
+int
+sm3_stream (FILE *stream, void *resblock)
+{
+  struct sm3_ctx ctx;
+  size_t sum;
+
+  char *buffer = malloc (BLOCKSIZE + 72);
+  if (!buffer)
+    return 1;
+
+  /* Initialize the computation context.  */
+  sm3_init_ctx (&ctx);
+
+  /* Iterate over full file contents.  */
+  while (1)
+    {
+      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
+         computation function processes the whole buffer so that with the
+         next round of the loop another block can be read.  */
+      size_t n;
+      sum = 0;
+
+      /* Read block.  Take care for partial reads.  */
+      while (1)
+        {
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+          sum += n;
+
+          if (sum == BLOCKSIZE)
+            break;
+
+          if (n == 0)
+            {
+              /* Check for the error flag IFF N == 0, so that we don't
+                 exit the loop after a partial read due to e.g., EAGAIN
+                 or EWOULDBLOCK.  */
+              if (ferror (stream))
+                {
+                  free (buffer);
+                  return 1;
+                }
+              goto process_partial_block;
+            }
+
+          /* We've read at least one byte, so ignore errors.  But always
+             check for EOF, since feof may be true even though N > 0.
+             Otherwise, we could end up calling fread after EOF.  */
+          if (feof (stream))
+            goto process_partial_block;
+        }
+
+      /* Process buffer with BLOCKSIZE bytes.  Note that
+                        BLOCKSIZE % 64 == 0
+       */
+      sm3_process_block (buffer, BLOCKSIZE, &ctx);
+    }
+
+ process_partial_block:;
+
+  /* Process any remaining bytes.  */
+  if (sum > 0)
+    sm3_process_bytes (buffer, sum, &ctx);
+
+  /* Construct result in desired memory.  */
+  sm3_finish_ctx (&ctx, resblock);
+  free (buffer);
+  return 0;
+}
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index fa701dc5c0043a94aca1407b050a5d5eb08ddf6e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sm3.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..816c71cc7a1d0a363080e7f638082a55865c883d
--- /dev/null
@@ -0,0 +1,415 @@
+/* sm3.c - Functions to compute SM3 message digest of files or memory blocks
+   according to the specification GM/T 004-2012 Cryptographic Hash Algorithm
+   SM3, published by State Encryption Management Bureau, China.
+
+   SM3 cryptographic hash algorithm.
+   <http://www.sca.gov.cn/sca/xwdt/2010-12/17/content_1002389.shtml>
+
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jia Zhang <qianyue.zj@alibaba-inc.com>, 2017,
+   considerably copypasting from David Madore's sha256.c */
+
+#include <config.h>
+
+/* Specification.  */
+#if HAVE_OPENSSL_SM3
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
+#include "sm3.h"
+
+#include <stdint.h>
+#include <string.h>
+
+#include <byteswap.h>
+#ifdef WORDS_BIGENDIAN
+# define SWAP(n) (n)
+#else
+# define SWAP(n) bswap_32 (n)
+#endif
+
+#ifndef DEBUG_SM3
+# define DEBUG_SM3 0
+#endif
+
+#if ! DEBUG_SM3
+# define dbg_printf(fmt, ...) do { } while (0)
+#else
+# define dbg_printf printf
+#endif
+
+#if ! HAVE_OPENSSL_SM3
+
+/* This array contains the bytes used to pad the buffer to the next
+   64-byte boundary.  */
+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
+
+
+/*
+  Takes a pointer to a 256 bit block of data (eight 32 bit ints) and
+  initializes it to the start constants of the SM3 algorithm.  This
+  must be called before using hash in the call to sm3_hash
+*/
+void
+sm3_init_ctx (struct sm3_ctx *ctx)
+{
+  ctx->state[0] = 0x7380166fUL;
+  ctx->state[1] = 0x4914b2b9UL;
+  ctx->state[2] = 0x172442d7UL;
+  ctx->state[3] = 0xda8a0600UL;
+  ctx->state[4] = 0xa96f30bcUL;
+  ctx->state[5] = 0x163138aaUL;
+  ctx->state[6] = 0xe38dee4dUL;
+  ctx->state[7] = 0xb0fb0e4eUL;
+
+  ctx->total[0] = ctx->total[1] = 0;
+  ctx->buflen = 0;
+}
+
+/* Copy the value from v into the memory location pointed to by *cp,
+   If your architecture allows unaligned access this is equivalent to
+   * (uint32_t *) cp = v  */
+static void
+set_uint32 (char *cp, uint32_t v)
+{
+  memcpy (cp, &v, sizeof v);
+}
+
+/* Put result from CTX in first 32 bytes following RESBUF.  The result
+   must be in little endian byte order.  */
+void *
+sm3_read_ctx (const struct sm3_ctx *ctx, void *resbuf)
+{
+  int i;
+  char *r = resbuf;
+
+  for (i = 0; i < 8; i++)
+    set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
+
+  return resbuf;
+}
+
+/* Process the remaining bytes in the internal buffer and the usual
+   prolog according to the standard and write the result to RESBUF.  */
+static void
+sm3_conclude_ctx (struct sm3_ctx *ctx)
+{
+  /* Take yet unprocessed bytes into account.  */
+  size_t bytes = ctx->buflen;
+  size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
+
+  /* Now count remaining bytes.  */
+  ctx->total[0] += bytes;
+  if (ctx->total[0] < bytes)
+    ++ctx->total[1];
+
+  /* Put the 64-bit file length in *bits* at the end of the buffer.
+     Use set_uint32 rather than a simple assignment, to avoid risk of
+     unaligned access.  */
+  set_uint32 ((char *) &ctx->buffer[size - 2],
+              SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)));
+  set_uint32 ((char *) &ctx->buffer[size - 1],
+              SWAP (ctx->total[0] << 3));
+
+  memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
+
+  /* Process last bytes.  */
+  sm3_process_block (ctx->buffer, size * 4, ctx);
+}
+
+void *
+sm3_finish_ctx (struct sm3_ctx *ctx, void *resbuf)
+{
+  sm3_conclude_ctx (ctx);
+  return sm3_read_ctx (ctx, resbuf);
+}
+
+/* Compute SM3 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+void *
+sm3_buffer (const char *buffer, size_t len, void *resblock)
+{
+  struct sm3_ctx ctx;
+
+  /* Initialize the computation context.  */
+  sm3_init_ctx (&ctx);
+
+  /* Process whole buffer but last len % 64 bytes.  */
+  sm3_process_bytes (buffer, len, &ctx);
+
+  /* Put result in desired memory area.  */
+  return sm3_finish_ctx (&ctx, resblock);
+}
+
+void
+sm3_process_bytes (const void *buffer, size_t len, struct sm3_ctx *ctx)
+{
+  /* When we already have some bits in our internal buffer concatenate
+     both inputs first.  */
+  if (ctx->buflen != 0)
+    {
+      size_t left_over = ctx->buflen;
+      size_t add = 128 - left_over > len ? len : 128 - left_over;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
+      ctx->buflen += add;
+
+      if (ctx->buflen > 64)
+        {
+          sm3_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+
+          ctx->buflen &= 63;
+          /* The regions in the following copy operation cannot overlap,
+             because ctx->buflen < 64 ≤ (left_over + add) & ~63.  */
+          memcpy (ctx->buffer,
+                  &((char *) ctx->buffer)[(left_over + add) & ~63],
+                  ctx->buflen);
+        }
+
+      buffer = (const char *) buffer + add;
+      len -= add;
+    }
+
+  /* Process available complete blocks.  */
+  if (len >= 64)
+    {
+#if !(_STRING_ARCH_unaligned || _STRING_INLINE_unaligned)
+# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
+      if (UNALIGNED_P (buffer))
+        while (len > 64)
+          {
+            sm3_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+            buffer = (const char *) buffer + 64;
+            len -= 64;
+          }
+      else
+#endif
+        {
+          sm3_process_block (buffer, len & ~63, ctx);
+          buffer = (const char *) buffer + (len & ~63);
+          len &= 63;
+        }
+    }
+
+  /* Move remaining bytes in internal buffer.  */
+  if (len > 0)
+    {
+      size_t left_over = ctx->buflen;
+
+      memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
+      left_over += len;
+      if (left_over >= 64)
+        {
+          sm3_process_block (ctx->buffer, 64, ctx);
+          left_over -= 64;
+          /* The regions in the following copy operation cannot overlap,
+             because left_over ≤ 64.  */
+          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
+      ctx->buflen = left_over;
+    }
+}
+
+/* --- Code below is the primary difference between sha256.c and sm3.c --- */
+
+/* SM3 round constants */
+#define T(j) sm3_round_constants[j]
+static const uint32_t sm3_round_constants[64] = {
+  0x79cc4519UL, 0xf3988a32UL, 0xe7311465UL, 0xce6228cbUL,
+  0x9cc45197UL, 0x3988a32fUL, 0x7311465eUL, 0xe6228cbcUL,
+  0xcc451979UL, 0x988a32f3UL, 0x311465e7UL, 0x6228cbceUL,
+  0xc451979cUL, 0x88a32f39UL, 0x11465e73UL, 0x228cbce6UL,
+  0x9d8a7a87UL, 0x3b14f50fUL, 0x7629ea1eUL, 0xec53d43cUL,
+  0xd8a7a879UL, 0xb14f50f3UL, 0x629ea1e7UL, 0xc53d43ceUL,
+  0x8a7a879dUL, 0x14f50f3bUL, 0x29ea1e76UL, 0x53d43cecUL,
+  0xa7a879d8UL, 0x4f50f3b1UL, 0x9ea1e762UL, 0x3d43cec5UL,
+  0x7a879d8aUL, 0xf50f3b14UL, 0xea1e7629UL, 0xd43cec53UL,
+  0xa879d8a7UL, 0x50f3b14fUL, 0xa1e7629eUL, 0x43cec53dUL,
+  0x879d8a7aUL, 0x0f3b14f5UL, 0x1e7629eaUL, 0x3cec53d4UL,
+  0x79d8a7a8UL, 0xf3b14f50UL, 0xe7629ea1UL, 0xcec53d43UL,
+  0x9d8a7a87UL, 0x3b14f50fUL, 0x7629ea1eUL, 0xec53d43cUL,
+  0xd8a7a879UL, 0xb14f50f3UL, 0x629ea1e7UL, 0xc53d43ceUL,
+  0x8a7a879dUL, 0x14f50f3bUL, 0x29ea1e76UL, 0x53d43cecUL,
+  0xa7a879d8UL, 0x4f50f3b1UL, 0x9ea1e762UL, 0x3d43cec5UL,
+};
+
+/* Round functions.  */
+#define FF1(X,Y,Z) ( X ^ Y ^ Z )
+#define FF2(X,Y,Z) ( ( X & Y ) | ( X & Z ) | ( Y & Z ) )
+#define GG1(X,Y,Z) ( X ^ Y ^ Z )
+#define GG2(X,Y,Z) ( ( X & Y ) | ( ~X & Z ) )
+
+/* Process LEN bytes of BUFFER, accumulating context into CTX.
+   It is assumed that LEN % 64 == 0.
+   Most of this code comes from David Madore's sha256.c.  */
+
+void
+sm3_process_block (const void *buffer, size_t len, struct sm3_ctx *ctx)
+{
+  const uint32_t *words = buffer;
+  size_t nwords = len / sizeof (uint32_t);
+  const uint32_t *endp = words + nwords;
+  uint32_t x[16];
+  uint32_t a = ctx->state[0];
+  uint32_t b = ctx->state[1];
+  uint32_t c = ctx->state[2];
+  uint32_t d = ctx->state[3];
+  uint32_t e = ctx->state[4];
+  uint32_t f = ctx->state[5];
+  uint32_t g = ctx->state[6];
+  uint32_t h = ctx->state[7];
+  uint32_t lolen = len;
+
+  /* First increment the byte count.  GM/T 004-2012 specifies the possible
+     length of the file up to 2^64 bits.  Here we only compute the
+     number of bytes.  Do a double word increment.  */
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
+
+#define rol(x, n) (((x) << ((n) & 31)) | ((x) >> ((32 - (n)) & 31)))
+#define P0(x) ((x)^rol(x,9)^rol(x,17))
+#define P1(x) ((x)^rol(x,15)^rol(x,23))
+
+#define W1(I) ( x[I&0x0f] )
+#define W2(I) ( tw =   P1(x[I&0x0f]^x[(I-9)&0x0f]^rol(x[(I-3)&0x0f],15)) \
+                     ^ rol(x[(I-13)&0x0f],7) ^ x[(I-6)&0x0f] \
+                , x[I&0x0f] = tw )
+
+#define R(i,A,B,C,D,E,F,G,H,T,W1,W2) \
+  do { \
+       if (++j) \
+         dbg_printf("%2d %08x %08x %08x %08x %08x %08x %08x %08x\n", \
+                    j-1, A, B, C, D, E, F, G, H); \
+       ss1 = rol(rol(A,12) + E + T,7); \
+       ss2 = ss1 ^ rol(A,12); \
+       D += FF##i(A,B,C) + ss2 + (W1 ^ W2); \
+       H += GG##i(E,F,G) + ss1 + W1; \
+       B = rol(B,9); \
+       F = rol(F,19); \
+       H = P0(H); \
+     } while(0)
+
+#define R1(A,B,C,D,E,F,G,H,T,W1,W2) R(1,A,B,C,D,E,F,G,H,T,W1,W2)
+#define R2(A,B,C,D,E,F,G,H,T,W1,W2) R(2,A,B,C,D,E,F,G,H,T,W1,W2)
+
+  while (words < endp)
+    {
+      uint32_t tw;
+      uint32_t ss1, ss2;
+      int j;
+
+      for (j = 0; j < 16; j++)
+        {
+          x[j] = SWAP (*words);
+          words++;
+        }
+
+      j = -1;
+
+      dbg_printf (" j    A        B        C        D        E  "
+                  "      F        G        H\n"
+                  "   %08x %08x %08x %08x %08x %08x %08x %08x\n",
+                  a, b, c, d, e, f, g, h);
+
+      R1( a, b, c, d, e, f, g, h, T( 0), W1( 0), W1( 4) );
+      R1( d, a, b, c, h, e, f, g, T( 1), W1( 1), W1( 5) );
+      R1( c, d, a, b, g, h, e, f, T( 2), W1( 2), W1( 6) );
+      R1( b, c, d, a, f, g, h, e, T( 3), W1( 3), W1( 7) );
+      R1( a, b, c, d, e, f, g, h, T( 4), W1( 4), W1( 8) );
+      R1( d, a, b, c, h, e, f, g, T( 5), W1( 5), W1( 9) );
+      R1( c, d, a, b, g, h, e, f, T( 6), W1( 6), W1(10) );
+      R1( b, c, d, a, f, g, h, e, T( 7), W1( 7), W1(11) );
+      R1( a, b, c, d, e, f, g, h, T( 8), W1( 8), W1(12) );
+      R1( d, a, b, c, h, e, f, g, T( 9), W1( 9), W1(13) );
+      R1( c, d, a, b, g, h, e, f, T(10), W1(10), W1(14) );
+      R1( b, c, d, a, f, g, h, e, T(11), W1(11), W1(15) );
+      R1( a, b, c, d, e, f, g, h, T(12), W1(12), W2(16) );
+      R1( d, a, b, c, h, e, f, g, T(13), W1(13), W2(17) );
+      R1( c, d, a, b, g, h, e, f, T(14), W1(14), W2(18) );
+      R1( b, c, d, a, f, g, h, e, T(15), W1(15), W2(19) );
+      R2( a, b, c, d, e, f, g, h, T(16), W1(16), W2(20) );
+      R2( d, a, b, c, h, e, f, g, T(17), W1(17), W2(21) );
+      R2( c, d, a, b, g, h, e, f, T(18), W1(18), W2(22) );
+      R2( b, c, d, a, f, g, h, e, T(19), W1(19), W2(23) );
+      R2( a, b, c, d, e, f, g, h, T(20), W1(20), W2(24) );
+      R2( d, a, b, c, h, e, f, g, T(21), W1(21), W2(25) );
+      R2( c, d, a, b, g, h, e, f, T(22), W1(22), W2(26) );
+      R2( b, c, d, a, f, g, h, e, T(23), W1(23), W2(27) );
+      R2( a, b, c, d, e, f, g, h, T(24), W1(24), W2(28) );
+      R2( d, a, b, c, h, e, f, g, T(25), W1(25), W2(29) );
+      R2( c, d, a, b, g, h, e, f, T(26), W1(26), W2(30) );
+      R2( b, c, d, a, f, g, h, e, T(27), W1(27), W2(31) );
+      R2( a, b, c, d, e, f, g, h, T(28), W1(28), W2(32) );
+      R2( d, a, b, c, h, e, f, g, T(29), W1(29), W2(33) );
+      R2( c, d, a, b, g, h, e, f, T(30), W1(30), W2(34) );
+      R2( b, c, d, a, f, g, h, e, T(31), W1(31), W2(35) );
+      R2( a, b, c, d, e, f, g, h, T(32), W1(32), W2(36) );
+      R2( d, a, b, c, h, e, f, g, T(33), W1(33), W2(37) );
+      R2( c, d, a, b, g, h, e, f, T(34), W1(34), W2(38) );
+      R2( b, c, d, a, f, g, h, e, T(35), W1(35), W2(39) );
+      R2( a, b, c, d, e, f, g, h, T(36), W1(36), W2(40) );
+      R2( d, a, b, c, h, e, f, g, T(37), W1(37), W2(41) );
+      R2( c, d, a, b, g, h, e, f, T(38), W1(38), W2(42) );
+      R2( b, c, d, a, f, g, h, e, T(39), W1(39), W2(43) );
+      R2( a, b, c, d, e, f, g, h, T(40), W1(40), W2(44) );
+      R2( d, a, b, c, h, e, f, g, T(41), W1(41), W2(45) );
+      R2( c, d, a, b, g, h, e, f, T(42), W1(42), W2(46) );
+      R2( b, c, d, a, f, g, h, e, T(43), W1(43), W2(47) );
+      R2( a, b, c, d, e, f, g, h, T(44), W1(44), W2(48) );
+      R2( d, a, b, c, h, e, f, g, T(45), W1(45), W2(49) );
+      R2( c, d, a, b, g, h, e, f, T(46), W1(46), W2(50) );
+      R2( b, c, d, a, f, g, h, e, T(47), W1(47), W2(51) );
+      R2( a, b, c, d, e, f, g, h, T(48), W1(48), W2(52) );
+      R2( d, a, b, c, h, e, f, g, T(49), W1(49), W2(53) );
+      R2( c, d, a, b, g, h, e, f, T(50), W1(50), W2(54) );
+      R2( b, c, d, a, f, g, h, e, T(51), W1(51), W2(55) );
+      R2( a, b, c, d, e, f, g, h, T(52), W1(52), W2(56) );
+      R2( d, a, b, c, h, e, f, g, T(53), W1(53), W2(57) );
+      R2( c, d, a, b, g, h, e, f, T(54), W1(54), W2(58) );
+      R2( b, c, d, a, f, g, h, e, T(55), W1(55), W2(59) );
+      R2( a, b, c, d, e, f, g, h, T(56), W1(56), W2(60) );
+      R2( d, a, b, c, h, e, f, g, T(57), W1(57), W2(61) );
+      R2( c, d, a, b, g, h, e, f, T(58), W1(58), W2(62) );
+      R2( b, c, d, a, f, g, h, e, T(59), W1(59), W2(63) );
+      R2( a, b, c, d, e, f, g, h, T(60), W1(60), W2(64) );
+      R2( d, a, b, c, h, e, f, g, T(61), W1(61), W2(65) );
+      R2( c, d, a, b, g, h, e, f, T(62), W1(62), W2(66) );
+      R2( b, c, d, a, f, g, h, e, T(63), W1(63), W2(67) );
+
+      dbg_printf("%2d %08x %08x %08x %08x %08x %08x %08x %08x\n",
+                 j, a, b, c, d, e, f, g, h);
+
+      a = ctx->state[0] ^= a;
+      b = ctx->state[1] ^= b;
+      c = ctx->state[2] ^= c;
+      d = ctx->state[3] ^= d;
+      e = ctx->state[4] ^= e;
+      f = ctx->state[5] ^= f;
+      g = ctx->state[6] ^= g;
+      h = ctx->state[7] ^= h;
+    }
+}
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 22615c7a8efeaa0dadeae4943c9fd86601d65114..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sm3.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..216246b0f142d862a8bb4f9f5e07dddb9dfddfd1
--- /dev/null
@@ -0,0 +1,133 @@
+/* Declarations of functions and data types used for SM3 sum library
+   function.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This module can be used to compute SM3 message digest of files or
+   memory blocks according to the specification GM/T 004-2012
+   Cryptographic Hash Algorithm SM3, published by State Cryptography
+   Administration, China.
+
+   The official SM3 cryptographic hash algorithm specification is
+   available at
+   <http://www.sca.gov.cn/sca/xwdt/2010-12/17/content_1002389.shtml>. */
+
+#ifndef SM3_H
+# define SM3_H 1
+
+/* This file uses HAVE_OPENSSL_SM3.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <stdio.h>
+# include <stdint.h>
+
+# if HAVE_OPENSSL_SM3
+#  ifndef OPENSSL_API_COMPAT
+#   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
+#  endif
+/* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
+#  include <openssl/opensslv.h>
+#  if OPENSSL_VERSION_MAJOR >= 3
+#   include <openssl/configuration.h>
+#   if (OPENSSL_CONFIGURED_API \
+        < (OPENSSL_API_COMPAT < 0x900000L ? OPENSSL_API_COMPAT : \
+           ((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \
+           + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \
+           + ((OPENSSL_API_COMPAT >> 12) & 0xFF)))
+#    undef HAVE_OPENSSL_SM3
+#   endif
+#  endif
+#  if HAVE_OPENSSL_SM3
+#   include <openssl/sm3.h>
+#  endif
+# endif
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+enum { SM3_DIGEST_SIZE = 256 / 8 };
+
+# if HAVE_OPENSSL_SM3
+#  define GL_OPENSSL_NAME 3
+#  include "gl_openssl.h"
+# else
+/* Structure to save state of computation between the single steps.  */
+struct sm3_ctx
+{
+  uint32_t state[8];
+
+  uint32_t total[2];
+  size_t buflen;       /* ≥ 0, ≤ 128 */
+  uint32_t buffer[32]; /* 128 bytes; the first buflen bytes are in use */
+};
+
+/* Initialize structure containing state of computation. */
+extern void sm3_init_ctx (struct sm3_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is necessary that LEN is a multiple of 64!!! */
+extern void sm3_process_block (const void *buffer, size_t len,
+                               struct sm3_ctx *ctx);
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is NOT required that LEN is a multiple of 64.  */
+extern void sm3_process_bytes (const void *buffer, size_t len,
+                               struct sm3_ctx *ctx);
+
+/* Process the remaining bytes in the buffer and put result from CTX
+   in first 32 bytes following RESBUF.  The result is always in little
+   endian byte order, so that a byte-wise output yields to the wanted
+   ASCII representation of the message digest.  */
+extern void *sm3_finish_ctx (struct sm3_ctx *ctx, void *restrict resbuf);
+
+/* Put result from CTX in first 32 bytes following RESBUF.  The result is
+   always in little endian byte order, so that a byte-wise output yields
+   to the wanted ASCII representation of the message digest.  */
+extern void *sm3_read_ctx (const struct sm3_ctx *ctx, void *restrict resbuf);
+
+/* Compute SM3 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+extern void *sm3_buffer (const char *buffer, size_t len,
+                         void *restrict resblock);
+
+# endif
+
+/* Compute SM3 message digest for bytes read from STREAM.  The
+   resulting message digest number will be written into the 32 bytes
+   beginning at RESBLOCK.  */
+extern int sm3_stream (FILE *stream, void *resblock);
+
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/*
+ * Hey Emacs!
+ * Local Variables:
+ * coding: utf-8
+ * End:
+ */
deleted file mode 120000 (symlink)
index 74cb7c6f4c49dafc3c5e83b523b85cb877aec622..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/snprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c1b93562ec50b0efa564dfab05420b8b43f386ba
--- /dev/null
@@ -0,0 +1,71 @@
+/* Formatted output to strings.
+   Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc.
+   Written by Simon Josefsson and Paul Eggert.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "vasnprintf.h"
+
+/* Print formatted output to string STR.  Similar to sprintf, but
+   additional length SIZE limit how much is written into STR.  Returns
+   string length of formatted string (which may be larger than SIZE).
+   STR may be NULL, in which case nothing will be written.  On error,
+   return a negative value.  */
+int
+snprintf (char *str, size_t size, const char *format, ...)
+{
+  char *output;
+  size_t len;
+  size_t lenbuf = size;
+  va_list args;
+
+  va_start (args, format);
+  output = vasnprintf (str, &lenbuf, format, args);
+  len = lenbuf;
+  va_end (args);
+
+  if (!output)
+    return -1;
+
+  if (output != str)
+    {
+      if (size)
+        {
+          size_t pruned_len = (len < size ? len : size - 1);
+          memcpy (str, output, pruned_len);
+          str[pruned_len] = '\0';
+        }
+
+      free (output);
+    }
+
+  if (INT_MAX < len)
+    {
+      errno = EOVERFLOW;
+      return -1;
+    }
+
+  return len;
+}
deleted file mode 120000 (symlink)
index 4db2f2cbbb5e34d2c453ce5014db54e189cf7954..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sockets.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..92beb7d33b397f54d7b54e4bd0fff48b085afbe6
--- /dev/null
@@ -0,0 +1,161 @@
+/* sockets.c --- wrappers for Windows socket functions
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson */
+
+#include <config.h>
+
+/* Specification.  */
+#include "sockets.h"
+
+#if WINDOWS_SOCKETS
+
+/* This includes winsock2.h on MinGW. */
+# include <sys/socket.h>
+
+# include "fd-hook.h"
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+# include "w32sock.h"
+
+static int
+close_fd_maybe_socket (const struct fd_hook *remaining_list,
+                       gl_close_fn primary,
+                       int fd)
+{
+  /* Note about multithread-safety: There is a race condition where, between
+     our calls to closesocket() and the primary close(), some other thread
+     could make system calls that allocate precisely the same HANDLE value
+     as sock; then the primary close() would call CloseHandle() on it.  */
+  SOCKET sock;
+  WSANETWORKEVENTS ev;
+
+  /* Test whether fd refers to a socket.  */
+  sock = FD_TO_SOCKET (fd);
+  ev.lNetworkEvents = 0xDEADBEEF;
+  WSAEnumNetworkEvents (sock, NULL, &ev);
+  if (ev.lNetworkEvents != 0xDEADBEEF)
+    {
+      /* fd refers to a socket.  */
+      /* FIXME: other applications, like squid, use an undocumented
+         _free_osfhnd free function.  But this is not enough: The 'osfile'
+         flags for fd also needs to be cleared, but it is hard to access it.
+         Instead, here we just close twice the file descriptor.  */
+      if (closesocket (sock))
+        {
+          set_winsock_errno ();
+          return -1;
+        }
+      else
+        {
+          /* This call frees the file descriptor and does a
+             CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails.  */
+          _close (fd);
+          return 0;
+        }
+    }
+  else
+    /* Some other type of file descriptor.  */
+    return execute_close_hooks (remaining_list, primary, fd);
+}
+
+static int
+ioctl_fd_maybe_socket (const struct fd_hook *remaining_list,
+                       gl_ioctl_fn primary,
+                       int fd, int request, void *arg)
+{
+  SOCKET sock;
+  WSANETWORKEVENTS ev;
+
+  /* Test whether fd refers to a socket.  */
+  sock = FD_TO_SOCKET (fd);
+  ev.lNetworkEvents = 0xDEADBEEF;
+  WSAEnumNetworkEvents (sock, NULL, &ev);
+  if (ev.lNetworkEvents != 0xDEADBEEF)
+    {
+      /* fd refers to a socket.  */
+      if (ioctlsocket (sock, request, arg) < 0)
+        {
+          set_winsock_errno ();
+          return -1;
+        }
+      else
+        return 0;
+    }
+  else
+    /* Some other type of file descriptor.  */
+    return execute_ioctl_hooks (remaining_list, primary, fd, request, arg);
+}
+
+static struct fd_hook fd_sockets_hook;
+
+static int initialized_sockets_version /* = 0 */;
+
+#endif /* WINDOWS_SOCKETS */
+
+int
+gl_sockets_startup (_GL_UNUSED int version)
+{
+#if WINDOWS_SOCKETS
+  if (version > initialized_sockets_version)
+    {
+      WSADATA data;
+      int err;
+
+      err = WSAStartup (version, &data);
+      if (err != 0)
+        return 1;
+
+      if (data.wVersion != version)
+        {
+          WSACleanup ();
+          return 2;
+        }
+
+      if (initialized_sockets_version == 0)
+        register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket,
+                          &fd_sockets_hook);
+
+      initialized_sockets_version = version;
+    }
+#endif
+
+  return 0;
+}
+
+int
+gl_sockets_cleanup (void)
+{
+#if WINDOWS_SOCKETS
+  int err;
+
+  initialized_sockets_version = 0;
+
+  unregister_fd_hook (&fd_sockets_hook);
+
+  err = WSACleanup ();
+  if (err != 0)
+    return 1;
+#endif
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 66bda550d6a375044ce63a8ffd99606ca17a6165..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sockets.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..99d6efca5216034eccc3e349f4f280e5048012fe
--- /dev/null
@@ -0,0 +1,71 @@
+/* sockets.h - wrappers for Windows socket functions
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson */
+
+#ifndef SOCKETS_H
+#define SOCKETS_H 1
+
+/* This file uses _GL_ATTRIBUTE_CONST.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#define SOCKETS_1_0 0x0001
+#define SOCKETS_1_1 0x0101
+#define SOCKETS_2_0 0x0002
+#define SOCKETS_2_1 0x0102
+#define SOCKETS_2_2 0x0202
+
+int gl_sockets_startup (int version)
+#ifndef WINDOWS_SOCKETS
+  _GL_ATTRIBUTE_CONST
+#endif
+  ;
+
+int gl_sockets_cleanup (void)
+#ifndef WINDOWS_SOCKETS
+  _GL_ATTRIBUTE_CONST
+#endif
+  ;
+
+/* This function is useful it you create a socket using gnulib's
+   Winsock wrappers but needs to pass on the socket handle to some
+   other library that only accepts sockets. */
+#ifdef WINDOWS_SOCKETS
+
+# include <sys/socket.h>
+
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+
+static inline SOCKET
+gl_fd_to_handle (int fd)
+{
+  return _get_osfhandle (fd);
+}
+
+#else
+
+# define gl_fd_to_handle(x) (x)
+
+#endif /* WINDOWS_SOCKETS */
+
+#endif /* SOCKETS_H */
deleted file mode 120000 (symlink)
index 1ebdf0ce2416a1dcf235d140a6a2b720421e4758..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stat-macros.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8ab44ab24e69ba61ecaeebd2d3ad279d1d0de202
--- /dev/null
@@ -0,0 +1,20 @@
+/* stat-related macros
+
+   Copyright (C) 1993-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* All the mode bits that can be affected by chmod.  */
+#define CHMOD_MODE_BITS \
+  (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
deleted file mode 120000 (symlink)
index 0e7a4fcb8bd7ea677160203da3482860e566d42e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stat-size.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8ec324bae8a591ea0b8d5ae91934cabe398c3004
--- /dev/null
@@ -0,0 +1,94 @@
+/* Yield size-related values in struct stat.
+   Copyright (C) 1989, 1991-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef STAT_SIZE_H
+#define STAT_SIZE_H
+
+/* This file uses HAVE_SYS_PARAM_H, HAVE_STRUCT_STAT_ST_BLOCKS.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* sys/param.h may define DEV_BSIZE */
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+/* The device blocksize, or a faked version thereof.
+   But use ST_NBLOCKSIZE instead.
+   Usually defined by sys/param.h (if at all).  */
+#if !defined DEV_BSIZE && defined BSIZE
+# define DEV_BSIZE BSIZE
+#endif
+#if !defined DEV_BSIZE && defined BBSIZE /* SGI sys/param.h */
+# define DEV_BSIZE BBSIZE
+#endif
+#ifndef DEV_BSIZE
+# define DEV_BSIZE 4096
+#endif
+
+/* Extract or fake data from a struct stat *st.
+   STP_BLKSIZE(st): Preferred performance I/O blocksize, in bytes.
+   STP_NBLOCKS(st): Number of blocks, including indirect blocks.
+   ST_NBLOCKSIZE: Size of blocks used when calculating ST_NBLOCKS.  */
+#ifndef HAVE_STRUCT_STAT_ST_BLOCKS
+# define STP_BLKSIZE(st) DEV_BSIZE
+  /* coreutils' fileblocks.c also uses BSIZE.  */
+# if defined _POSIX_SOURCE || !defined BSIZE
+#  define STP_NBLOCKS(st) \
+    ((st)->st_size / ST_NBLOCKSIZE + ((st)->st_size % ST_NBLOCKSIZE != 0))
+# else
+   /* This definition calls st_blocks, which is in the fileblocks module. */
+#  define STP_NBLOCKS(st) \
+    (S_ISREG ((st)->st_mode) || S_ISDIR ((st)->st_mode) \
+     ? st_blocks ((st)->st_size) : 0)
+# endif
+#else
+/* When running 'rsh hpux11-system cat any-file', cat would
+   determine that the output stream had an st_blksize of 2147421096.
+   Conversely st_blksize can be 2 GiB (or maybe even larger) with XFS
+   on 64-bit hosts.  Somewhat arbitrarily, limit the "optimal" block
+   size to SIZE_MAX / 8 + 1.  (Dividing SIZE_MAX by only 4 wouldn't
+   suffice, since "cat" sometimes multiplies the result by 4.)  If
+   anyone knows of a system for which this limit is too small, please
+   report it as a bug in this code.  */
+# define STP_BLKSIZE(st) ((0 < (st)->st_blksize \
+                           && (st)->st_blksize <= (size_t) -1 / 8 + 1)  \
+                          ? (st)->st_blksize : DEV_BSIZE)
+# if defined hpux || defined __hpux__ || defined __hpux
+  /* HP-UX counts st_blocks in 1024-byte units.
+     This loses when mixing HP-UX and BSD file systems with NFS.  */
+#  define ST_NBLOCKSIZE 1024
+# endif
+#endif
+
+#ifndef STP_NBLOCKS
+# define STP_NBLOCKS(st) ((st)->st_blocks)
+#endif
+
+#ifndef ST_NBLOCKSIZE
+# ifdef S_BLKSIZE
+#  define ST_NBLOCKSIZE S_BLKSIZE
+# else
+#  define ST_NBLOCKSIZE 512
+# endif
+#endif
+
+/* Preferred blocksize and number of blocks for a struct stat object.  */
+#define ST_BLKSIZE(statbuf) STP_BLKSIZE (&(statbuf))
+#define ST_NBLOCKS(statbuf) STP_NBLOCKS (&(statbuf))
+
+#endif /* STAT_SIZE_H */
deleted file mode 120000 (symlink)
index ffd350bb38d9c1a4bbf8503977c10611783e542d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stat-time.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1ab01f532cd486220a4e8490fb24596653553fee
--- /dev/null
@@ -0,0 +1,21 @@
+/* stat-related time functions.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE
+#include "stat-time.h"
deleted file mode 120000 (symlink)
index 88c75584cd6cb53296f56b7d238a1e9c006035a9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stat-time.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3cd8478f3100b9d34fa3d854e0532c313931ffe3
--- /dev/null
@@ -0,0 +1,245 @@
+/* stat-related time functions.
+
+   Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef STAT_TIME_H
+#define STAT_TIME_H 1
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_UNUSED,
+   _GL_ATTRIBUTE_PURE, HAVE_STRUCT_STAT_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <errno.h>
+#include <stdckdint.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <time.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_STAT_TIME_INLINE
+# define _GL_STAT_TIME_INLINE _GL_INLINE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type
+   struct timespec, if available.  If not, then STAT_TIMESPEC_NS (ST,
+   ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST,
+   if available.  ST_XTIM can be st_atim, st_ctim, st_mtim, or st_birthtim
+   for access, status change, data modification, or birth (creation)
+   time respectively.
+
+   These macros are private to stat-time.h.  */
+#if _GL_WINDOWS_STAT_TIMESPEC || defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
+# if _GL_WINDOWS_STAT_TIMESPEC || defined TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC
+#  define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim)
+#  define STAT_TIMESPEC_OFFSETOF(st_xtim) offsetof (struct stat, st_xtim)
+# else
+#  define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec)
+# endif
+#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
+# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec)
+# define STAT_TIMESPEC_OFFSETOF(st_xtim) offsetof (struct stat, st_xtim##espec)
+#elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC
+# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim##ensec)
+#elif defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC
+# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.st__tim.tv_nsec)
+#endif
+
+/* Return the nanosecond component of *ST's access time.  */
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
+get_stat_atime_ns (struct stat const *st)
+{
+# if defined STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_atim).tv_nsec;
+# elif defined STAT_TIMESPEC_NS
+  return STAT_TIMESPEC_NS (st, st_atim);
+# else
+  return 0;
+# endif
+}
+
+/* Return the nanosecond component of *ST's status change time.  */
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
+get_stat_ctime_ns (struct stat const *st)
+{
+# if defined STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_ctim).tv_nsec;
+# elif defined STAT_TIMESPEC_NS
+  return STAT_TIMESPEC_NS (st, st_ctim);
+# else
+  return 0;
+# endif
+}
+
+/* Return the nanosecond component of *ST's data modification time.  */
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
+get_stat_mtime_ns (struct stat const *st)
+{
+# if defined STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_mtim).tv_nsec;
+# elif defined STAT_TIMESPEC_NS
+  return STAT_TIMESPEC_NS (st, st_mtim);
+# else
+  return 0;
+# endif
+}
+
+/* Return the nanosecond component of *ST's birth time.  */
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
+get_stat_birthtime_ns (_GL_UNUSED struct stat const *st)
+{
+# if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
+  return STAT_TIMESPEC (st, st_birthtim).tv_nsec;
+# elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
+  return STAT_TIMESPEC_NS (st, st_birthtim);
+# else
+  return 0;
+# endif
+}
+
+/* Return *ST's access time.  */
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
+get_stat_atime (struct stat const *st)
+{
+#ifdef STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_atim);
+#else
+  return (struct timespec) { .tv_sec = st->st_atime,
+                             .tv_nsec = get_stat_atime_ns (st) };
+#endif
+}
+
+/* Return *ST's status change time.  */
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
+get_stat_ctime (struct stat const *st)
+{
+#ifdef STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_ctim);
+#else
+  return (struct timespec) { .tv_sec = st->st_ctime,
+                             .tv_nsec = get_stat_ctime_ns (st) };
+#endif
+}
+
+/* Return *ST's data modification time.  */
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
+get_stat_mtime (struct stat const *st)
+{
+#ifdef STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_mtim);
+#else
+  return (struct timespec) { .tv_sec = st->st_mtime,
+                             .tv_nsec = get_stat_mtime_ns (st) };
+#endif
+}
+
+/* Return *ST's birth time, if available; otherwise return a value
+   with tv_sec and tv_nsec both equal to -1.  */
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
+get_stat_birthtime (_GL_UNUSED struct stat const *st)
+{
+  struct timespec t;
+
+#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \
+     || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC)
+  t = STAT_TIMESPEC (st, st_birthtim);
+#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
+  t = (struct timespec) { .tv_sec = st->st_birthtime,
+                          .tv_nsec = st->st_birthtimensec };
+#elif defined _WIN32 && ! defined __CYGWIN__
+  /* Native Windows platforms (but not Cygwin) put the "file creation
+     time" in st_ctime (!).  See
+     <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions>.  */
+# if _GL_WINDOWS_STAT_TIMESPEC
+  t = st->st_ctim;
+# else
+  t = (struct timespec) { .tv_sec = st->st_ctime };
+# endif
+#else
+  /* Birth time is not supported.  */
+  t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 };
+#endif
+
+#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \
+     || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC \
+     || defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC)
+  /* FreeBSD and NetBSD sometimes signal the absence of knowledge by
+     using zero.  Attempt to work around this problem.  Alas, this can
+     report failure even for valid timestamps.  Also, NetBSD
+     sometimes returns junk in the birth time fields; work around this
+     bug if it is detected.  */
+  if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000))
+    t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 };
+#endif
+
+  return t;
+}
+
+/* If a stat-like function returned RESULT, normalize the timestamps
+   in *ST, if this platform suffers from a macOS and Solaris bug where
+   tv_nsec might be negative.  Return the adjusted RESULT, setting
+   errno to EOVERFLOW if normalization overflowed.  This function
+   is intended to be private to this .h file.  */
+_GL_STAT_TIME_INLINE int
+stat_time_normalize (int result, _GL_UNUSED struct stat *st)
+{
+#if (((defined __APPLE__ && defined __MACH__) || defined __sun) \
+     && defined STAT_TIMESPEC_OFFSETOF)
+  if (result == 0)
+    {
+      long int timespec_hz = 1000000000;
+      short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim),
+                                   STAT_TIMESPEC_OFFSETOF (st_mtim),
+                                   STAT_TIMESPEC_OFFSETOF (st_ctim) };
+      int i;
+      for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++)
+        {
+          struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]);
+          long int q = ts->tv_nsec / timespec_hz;
+          long int r = ts->tv_nsec % timespec_hz;
+          if (r < 0)
+            {
+              r += timespec_hz;
+              q--;
+            }
+          ts->tv_nsec = r;
+          /* Overflow is possible, as Solaris 11 stat can yield
+             tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000.  */
+          if (ckd_add (&ts->tv_sec, q, ts->tv_sec))
+            {
+              errno = EOVERFLOW;
+              return -1;
+            }
+        }
+    }
+#endif
+  return result;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif
deleted file mode 120000 (symlink)
index e81363eec5fdaf3109282df01f09677240be56cc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stat-w32.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ddd6f5985664399443660746fca2b7c7733015d2
--- /dev/null
@@ -0,0 +1,460 @@
+/* Core of implementation of fstat and stat for native Windows.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible.  */
+
+#include <config.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+/* Attempt to make <windows.h> define FILE_ID_INFO.
+   But ensure that the redefinition of _WIN32_WINNT does not make us assume
+   Windows Vista or newer when building for an older version of Windows.  */
+#if HAVE_SDKDDKVER_H
+# include <sdkddkver.h>
+# if _WIN32_WINNT >= _WIN32_WINNT_VISTA
+#  define WIN32_ASSUME_VISTA 1
+# else
+#  define WIN32_ASSUME_VISTA 0
+# endif
+# if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT _WIN32_WINNT_WIN8
+# endif
+#else
+# define WIN32_ASSUME_VISTA (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+#include <windows.h>
+
+/* Specification.  */
+#include "stat-w32.h"
+
+#include "pathmax.h"
+
+/* Don't assume that UNICODE is not defined.  */
+#undef LoadLibrary
+#define LoadLibrary LoadLibraryA
+#undef GetFinalPathNameByHandle
+#define GetFinalPathNameByHandle GetFinalPathNameByHandleA
+
+/* Older mingw headers do not define VOLUME_NAME_NONE.  */
+#ifndef VOLUME_NAME_NONE
+# define VOLUME_NAME_NONE 4
+#endif
+
+#if !WIN32_ASSUME_VISTA
+
+/* Avoid warnings from gcc -Wcast-function-type.  */
+# define GetProcAddress \
+   (void *) GetProcAddress
+
+# if _GL_WINDOWS_STAT_INODES == 2
+/* GetFileInformationByHandleEx was introduced only in Windows Vista.  */
+typedef DWORD (WINAPI * GetFileInformationByHandleExFuncType) (HANDLE hFile,
+                                                               FILE_INFO_BY_HANDLE_CLASS fiClass,
+                                                               LPVOID lpBuffer,
+                                                               DWORD dwBufferSize);
+static GetFileInformationByHandleExFuncType GetFileInformationByHandleExFunc = NULL;
+# endif
+/* GetFinalPathNameByHandle was introduced only in Windows Vista.  */
+typedef DWORD (WINAPI * GetFinalPathNameByHandleFuncType) (HANDLE hFile,
+                                                           LPSTR lpFilePath,
+                                                           DWORD lenFilePath,
+                                                           DWORD dwFlags);
+static GetFinalPathNameByHandleFuncType GetFinalPathNameByHandleFunc = NULL;
+static BOOL initialized = FALSE;
+
+static void
+initialize (void)
+{
+  HMODULE kernel32 = LoadLibrary ("kernel32.dll");
+  if (kernel32 != NULL)
+    {
+# if _GL_WINDOWS_STAT_INODES == 2
+      GetFileInformationByHandleExFunc =
+        (GetFileInformationByHandleExFuncType) GetProcAddress (kernel32, "GetFileInformationByHandleEx");
+# endif
+      GetFinalPathNameByHandleFunc =
+        (GetFinalPathNameByHandleFuncType) GetProcAddress (kernel32, "GetFinalPathNameByHandleA");
+    }
+  initialized = TRUE;
+}
+
+#else
+
+# define GetFileInformationByHandleExFunc GetFileInformationByHandleEx
+# define GetFinalPathNameByHandleFunc GetFinalPathNameByHandle
+
+#endif
+
+/* Converts a FILETIME to GMT time since 1970-01-01 00:00:00.  */
+#if _GL_WINDOWS_STAT_TIMESPEC
+struct timespec
+_gl_convert_FILETIME_to_timespec (const FILETIME *ft)
+{
+  struct timespec result;
+  /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */
+  unsigned long long since_1601 =
+    ((unsigned long long) ft->dwHighDateTime << 32)
+    | (unsigned long long) ft->dwLowDateTime;
+  if (since_1601 == 0)
+    {
+      result.tv_sec = 0;
+      result.tv_nsec = 0;
+    }
+  else
+    {
+      /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89
+         leap years, in total 134774 days.  */
+      unsigned long long since_1970 =
+        since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000;
+      result.tv_sec = since_1970 / (unsigned long long) 10000000;
+      result.tv_nsec = (unsigned long) (since_1970 % (unsigned long long) 10000000) * 100;
+    }
+  return result;
+}
+#else
+time_t
+_gl_convert_FILETIME_to_POSIX (const FILETIME *ft)
+{
+  /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */
+  unsigned long long since_1601 =
+    ((unsigned long long) ft->dwHighDateTime << 32)
+    | (unsigned long long) ft->dwLowDateTime;
+  if (since_1601 == 0)
+    return 0;
+  else
+    {
+      /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89
+         leap years, in total 134774 days.  */
+      unsigned long long since_1970 =
+        since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000;
+      return since_1970 / (unsigned long long) 10000000;
+    }
+}
+#endif
+
+/* Fill *BUF with information about the file designated by H.
+   PATH is the file name, if known, otherwise NULL.
+   Return 0 if successful, or -1 with errno set upon failure.  */
+int
+_gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf)
+{
+  /* GetFileType
+     <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfiletype> */
+  DWORD type = GetFileType (h);
+  if (type == FILE_TYPE_DISK)
+    {
+#if !WIN32_ASSUME_VISTA
+      if (!initialized)
+        initialize ();
+#endif
+
+      /* st_mode can be determined through
+         GetFileAttributesEx
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileattributesexa>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_win32_file_attribute_data>
+         or through
+         GetFileInformationByHandle
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information>
+         or through
+         GetFileInformationByHandleEx with argument FileBasicInfo
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_basic_info>
+         The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher.  */
+      BY_HANDLE_FILE_INFORMATION info;
+      if (! GetFileInformationByHandle (h, &info))
+        goto failed;
+
+      /* Test for error conditions before starting to fill *buf.  */
+      if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0)
+        {
+          errno = EOVERFLOW;
+          return -1;
+        }
+
+#if _GL_WINDOWS_STAT_INODES
+      /* st_ino can be determined through
+         GetFileInformationByHandle
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information>
+         as 64 bits, or through
+         GetFileInformationByHandleEx with argument FileIdInfo
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_id_info>
+         as 128 bits.
+         The latter requires -D_WIN32_WINNT=_WIN32_WINNT_WIN8 or higher.  */
+      /* Experiments show that GetFileInformationByHandleEx does not provide
+         much more information than GetFileInformationByHandle:
+           * The dwVolumeSerialNumber from GetFileInformationByHandle is equal
+             to the low 32 bits of the 64-bit VolumeSerialNumber from
+             GetFileInformationByHandleEx, and is apparently sufficient for
+             identifying the device.
+           * The nFileIndex from GetFileInformationByHandle is equal to the low
+             64 bits of the 128-bit FileId from GetFileInformationByHandleEx,
+             and the high 64 bits of this 128-bit FileId are zero.
+           * On a FAT file system, GetFileInformationByHandleEx fails with error
+             ERROR_INVALID_PARAMETER, whereas GetFileInformationByHandle
+             succeeds.
+           * On a CIFS/SMB file system, GetFileInformationByHandleEx fails with
+             error ERROR_INVALID_LEVEL, whereas GetFileInformationByHandle
+             succeeds.  */
+# if _GL_WINDOWS_STAT_INODES == 2
+      if (GetFileInformationByHandleExFunc != NULL)
+        {
+          FILE_ID_INFO id;
+          if (GetFileInformationByHandleExFunc (h, FileIdInfo, &id, sizeof (id)))
+            {
+              buf->st_dev = id.VolumeSerialNumber;
+              static_assert (sizeof (ino_t) == sizeof (id.FileId));
+              memcpy (&buf->st_ino, &id.FileId, sizeof (ino_t));
+              goto ino_done;
+            }
+          else
+            {
+              switch (GetLastError ())
+                {
+                case ERROR_INVALID_PARAMETER: /* older Windows version, or FAT */
+                case ERROR_INVALID_LEVEL: /* CIFS/SMB file system */
+                  goto fallback;
+                default:
+                  goto failed;
+                }
+            }
+        }
+     fallback: ;
+      /* Fallback for older Windows versions.  */
+      buf->st_dev = info.dwVolumeSerialNumber;
+      buf->st_ino._gl_ino[0] = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow;
+      buf->st_ino._gl_ino[1] = 0;
+     ino_done: ;
+# else /* _GL_WINDOWS_STAT_INODES == 1 */
+      buf->st_dev = info.dwVolumeSerialNumber;
+      buf->st_ino = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow;
+# endif
+#else
+      /* st_ino is not wide enough for identifying a file on a device.
+         Without st_ino, st_dev is pointless.  */
+      buf->st_dev = 0;
+      buf->st_ino = 0;
+#endif
+
+      /* st_mode.  */
+      unsigned int mode =
+        /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ?  */
+        ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG)
+        | S_IREAD_UGO
+        | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO);
+      if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+        {
+          /* Determine whether the file is executable by looking at the file
+             name suffix.
+             If the file name is already known, use it. Otherwise, for
+             non-empty files, it can be determined through
+             GetFinalPathNameByHandle
+             <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfinalpathnamebyhandlea>
+             or through
+             GetFileInformationByHandleEx with argument FileNameInfo
+             <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex>
+             <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_name_info>
+             Both require -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher.  */
+          if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0)
+            {
+              char fpath[PATH_MAX];
+              if (path != NULL
+                  || (GetFinalPathNameByHandleFunc != NULL
+                      && GetFinalPathNameByHandleFunc (h, fpath, sizeof (fpath), VOLUME_NAME_NONE)
+                         < sizeof (fpath)
+                      && (path = fpath, 1)))
+                {
+                  const char *last_dot = NULL;
+                  const char *p;
+                  for (p = path; *p != '\0'; p++)
+                    if (*p == '.')
+                      last_dot = p;
+                  if (last_dot != NULL)
+                    {
+                      const char *suffix = last_dot + 1;
+                      if (_stricmp (suffix, "exe") == 0
+                          || _stricmp (suffix, "bat") == 0
+                          || _stricmp (suffix, "cmd") == 0
+                          || _stricmp (suffix, "com") == 0)
+                        mode |= S_IEXEC_UGO;
+                    }
+                }
+              else
+                /* Cannot determine file name.  Pretend that it is executable.  */
+                mode |= S_IEXEC_UGO;
+            }
+        }
+      buf->st_mode = mode;
+
+      /* st_nlink can be determined through
+         GetFileInformationByHandle
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information>
+         or through
+         GetFileInformationByHandleEx with argument FileStandardInfo
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_standard_info>
+         The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher.  */
+      buf->st_nlink = (info.nNumberOfLinks > SHRT_MAX ? SHRT_MAX : info.nNumberOfLinks);
+
+      /* There's no easy way to map the Windows SID concept to an integer.  */
+      buf->st_uid = 0;
+      buf->st_gid = 0;
+
+      /* st_rdev is irrelevant for normal files and directories.  */
+      buf->st_rdev = 0;
+
+      /* st_size can be determined through
+         GetFileSizeEx
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfilesizeex>
+         or through
+         GetFileAttributesEx
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileattributesexa>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_win32_file_attribute_data>
+         or through
+         GetFileInformationByHandle
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information>
+         or through
+         GetFileInformationByHandleEx with argument FileStandardInfo
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_standard_info>
+         The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher.  */
+      if (sizeof (buf->st_size) <= 4)
+        /* Range check already done above.  */
+        buf->st_size = info.nFileSizeLow;
+      else
+        buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow;
+
+      /* st_atime, st_mtime, st_ctime can be determined through
+         GetFileTime
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfiletime>
+         or through
+         GetFileAttributesEx
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileattributesexa>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_win32_file_attribute_data>
+         or through
+         GetFileInformationByHandle
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileinformationbyhandle>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/ns-fileapi-_by_handle_file_information>
+         or through
+         GetFileInformationByHandleEx with argument FileBasicInfo
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_basic_info>
+         The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher.  */
+#if _GL_WINDOWS_STAT_TIMESPEC
+      buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime);
+      buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime);
+      buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime);
+#else
+      buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime);
+      buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime);
+      buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime);
+#endif
+
+      return 0;
+    }
+  else if (type == FILE_TYPE_CHAR || type == FILE_TYPE_PIPE)
+    {
+      buf->st_dev = 0;
+#if _GL_WINDOWS_STAT_INODES == 2
+      buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0;
+#else
+      buf->st_ino = 0;
+#endif
+      buf->st_mode = (type == FILE_TYPE_PIPE ? _S_IFIFO : _S_IFCHR);
+      buf->st_nlink = 1;
+      buf->st_uid = 0;
+      buf->st_gid = 0;
+      buf->st_rdev = 0;
+      if (type == FILE_TYPE_PIPE)
+        {
+          /* PeekNamedPipe
+             <https://msdn.microsoft.com/en-us/library/aa365779.aspx> */
+          DWORD bytes_available;
+          if (PeekNamedPipe (h, NULL, 0, NULL, &bytes_available, NULL))
+            buf->st_size = bytes_available;
+          else
+            buf->st_size = 0;
+        }
+      else
+        buf->st_size = 0;
+#if _GL_WINDOWS_STAT_TIMESPEC
+      buf->st_atim.tv_sec = 0; buf->st_atim.tv_nsec = 0;
+      buf->st_mtim.tv_sec = 0; buf->st_mtim.tv_nsec = 0;
+      buf->st_ctim.tv_sec = 0; buf->st_ctim.tv_nsec = 0;
+#else
+      buf->st_atime = 0;
+      buf->st_mtime = 0;
+      buf->st_ctime = 0;
+#endif
+      return 0;
+    }
+  else
+    {
+      errno = ENOENT;
+      return -1;
+    }
+
+ failed:
+  {
+    DWORD error = GetLastError ();
+    #if 0
+    fprintf (stderr, "_gl_fstat_by_handle error 0x%x\n", (unsigned int) error);
+    #endif
+    switch (error)
+      {
+      case ERROR_ACCESS_DENIED:
+      case ERROR_SHARING_VIOLATION:
+        errno = EACCES;
+        break;
+
+      case ERROR_OUTOFMEMORY:
+        errno = ENOMEM;
+        break;
+
+      case ERROR_WRITE_FAULT:
+      case ERROR_READ_FAULT:
+      case ERROR_GEN_FAILURE:
+        errno = EIO;
+        break;
+
+      default:
+        errno = EINVAL;
+        break;
+      }
+    return -1;
+  }
+}
+
+#else
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#endif
deleted file mode 120000 (symlink)
index 73405ac474ce0597ca48a1e1ed60916442849185..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stat-w32.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..392faed1681c7687e825507216ffb15ef6288b73
--- /dev/null
@@ -0,0 +1,37 @@
+/* Core of implementation of fstat and stat for native Windows.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _STAT_W32_H
+#define _STAT_W32_H 1
+
+/* Converts a FILETIME to GMT time since 1970-01-01 00:00:00.  */
+#if _GL_WINDOWS_STAT_TIMESPEC
+extern struct timespec _gl_convert_FILETIME_to_timespec (const FILETIME *ft);
+#else
+extern time_t _gl_convert_FILETIME_to_POSIX (const FILETIME *ft);
+#endif
+
+/* Fill *BUF with information about the file designated by H.
+   PATH is the file name, if known, otherwise NULL.
+   Return 0 if successful, or -1 with errno set upon failure.  */
+extern int _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf);
+
+/* Bitmasks for st_mode.  */
+#define S_IREAD_UGO  (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6))
+#define S_IWRITE_UGO (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6))
+#define S_IEXEC_UGO  (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6))
+
+#endif /* _STAT_W32_H */
deleted file mode 120000 (symlink)
index 0d45fb37efb61ba417d24ff90e762fc07ec3b320..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ecf9f9bbe9dd66c187cb8fc9d3db31e252479d1a
--- /dev/null
@@ -0,0 +1,438 @@
+/* Work around platform bugs in stat.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake and Bruno Haible.  */
+
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+   the system's <sys/stat.h> here, so that orig_stat doesn't recurse to
+   rpl_stat.  */
+#define __need_system_sys_stat_h
+#include <config.h>
+
+/* Get the original definition of stat.  It might be defined as a macro.  */
+#include <sys/types.h>
+#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WINDOWS_NATIVE
+#endif
+
+#if !defined WINDOWS_NATIVE
+
+static int
+orig_stat (const char *filename, struct stat *buf)
+{
+  return stat (filename, buf);
+}
+
+#endif
+
+/* Specification.  */
+#ifdef __osf__
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+   eliminates this include because of the preliminary #include <sys/stat.h>
+   above.  */
+# include "sys/stat.h"
+#else
+# include <sys/stat.h>
+#endif
+
+#include "stat-time.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include "filename.h"
+#include "malloca.h"
+
+#ifdef WINDOWS_NATIVE
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# include "stat-w32.h"
+/* Don't assume that UNICODE is not defined.  */
+# undef WIN32_FIND_DATA
+# define WIN32_FIND_DATA WIN32_FIND_DATAA
+# undef CreateFile
+# define CreateFile CreateFileA
+# undef FindFirstFile
+# define FindFirstFile FindFirstFileA
+#endif
+
+#ifdef WINDOWS_NATIVE
+/* Return TRUE if the given file name denotes an UNC root.  */
+static BOOL
+is_unc_root (const char *rname)
+{
+  /* Test whether it has the syntax '\\server\share'.  */
+  if (ISSLASH (rname[0]) && ISSLASH (rname[1]))
+    {
+      /* It starts with two slashes.  Find the next slash.  */
+      const char *p = rname + 2;
+      const char *q = p;
+      while (*q != '\0' && !ISSLASH (*q))
+        q++;
+      if (q > p && *q != '\0')
+        {
+          /* Found the next slash at q.  */
+          q++;
+          const char *r = q;
+          while (*r != '\0' && !ISSLASH (*r))
+            r++;
+          if (r > q && *r == '\0')
+            return TRUE;
+        }
+    }
+  return FALSE;
+}
+#endif
+
+/* Store information about NAME into ST.  Work around bugs with
+   trailing slashes.  Mingw has other bugs (such as st_ino always
+   being 0 on success) which this wrapper does not work around.  But
+   at least this implementation provides the ability to emulate fchdir
+   correctly.  */
+
+int
+rpl_stat (char const *name, struct stat *buf)
+{
+#ifdef WINDOWS_NATIVE
+  /* Fill the fields ourselves, because the original stat function returns
+     values for st_atime, st_mtime, st_ctime that depend on the current time
+     zone.  See
+     <https://lists.gnu.org/r/bug-gnulib/2017-04/msg00134.html>  */
+  /* XXX Should we convert to wchar_t* and prepend '\\?\', in order to work
+     around length limitations
+     <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file> ?  */
+
+  /* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>
+     specifies: "More than two leading <slash> characters shall be treated as
+     a single <slash> character."  */
+  if (ISSLASH (name[0]) && ISSLASH (name[1]) && ISSLASH (name[2]))
+    {
+      name += 2;
+      while (ISSLASH (name[1]))
+        name++;
+    }
+
+  size_t len = strlen (name);
+  size_t drive_prefix_len = (HAS_DEVICE (name) ? 2 : 0);
+
+  /* Remove trailing slashes (except the very first one, at position
+     drive_prefix_len), but remember their presence.  */
+  size_t rlen;
+  bool check_dir = false;
+
+  rlen = len;
+  while (rlen > drive_prefix_len && ISSLASH (name[rlen-1]))
+    {
+      check_dir = true;
+      if (rlen == drive_prefix_len + 1)
+        break;
+      rlen--;
+    }
+
+  /* Handle '' and 'C:'.  */
+  if (!check_dir && rlen == drive_prefix_len)
+    {
+      errno = ENOENT;
+      return -1;
+    }
+
+  /* Handle '\\'.  */
+  if (rlen == 1 && ISSLASH (name[0]) && len >= 2)
+    {
+      errno = ENOENT;
+      return -1;
+    }
+
+  const char *rname;
+  char *malloca_rname;
+  if (rlen == len)
+    {
+      rname = name;
+      malloca_rname = NULL;
+    }
+  else
+    {
+      malloca_rname = malloca (rlen + 1);
+      if (malloca_rname == NULL)
+        {
+          errno = ENOMEM;
+          return -1;
+        }
+      memcpy (malloca_rname, name, rlen);
+      malloca_rname[rlen] = '\0';
+      rname = malloca_rname;
+    }
+
+  /* There are two ways to get at the requested information:
+       - by scanning the parent directory and examining the relevant
+         directory entry,
+       - by opening the file directly.
+     The first approach fails for root directories (e.g. 'C:\') and
+     UNC root directories (e.g. '\\server\share').
+     The second approach fails for some system files (e.g. 'C:\pagefile.sys'
+     and 'C:\hiberfil.sys'): ERROR_SHARING_VIOLATION.
+     The second approach gives more information (in particular, correct
+     st_dev, st_ino, st_nlink fields).
+     So we use the second approach and, as a fallback except for root and
+     UNC root directories, also the first approach.  */
+  {
+    int ret;
+
+    {
+      /* Approach based on the file.  */
+
+      /* Open a handle to the file.
+         CreateFile
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilea>
+         <https://docs.microsoft.com/en-us/windows/desktop/FileIO/creating-and-opening-files>  */
+      HANDLE h =
+        CreateFile (rname,
+                    FILE_READ_ATTRIBUTES,
+                    FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+                    NULL,
+                    OPEN_EXISTING,
+                    /* FILE_FLAG_POSIX_SEMANTICS (treat file names that differ only
+                       in case as different) makes sense only when applied to *all*
+                       filesystem operations.  */
+                    FILE_FLAG_BACKUP_SEMANTICS /* | FILE_FLAG_POSIX_SEMANTICS */,
+                    NULL);
+      if (h != INVALID_HANDLE_VALUE)
+        {
+          ret = _gl_fstat_by_handle (h, rname, buf);
+          CloseHandle (h);
+          goto done;
+        }
+    }
+
+    /* Test for root and UNC root directories.  */
+    if ((rlen == drive_prefix_len + 1 && ISSLASH (rname[drive_prefix_len]))
+        || is_unc_root (rname))
+      goto failed;
+
+    /* Fallback.  */
+    {
+      /* Approach based on the directory entry.  */
+
+      if (strchr (rname, '?') != NULL || strchr (rname, '*') != NULL)
+        {
+          /* Other Windows API functions would fail with error
+             ERROR_INVALID_NAME.  */
+          if (malloca_rname != NULL)
+            freea (malloca_rname);
+          errno = ENOENT;
+          return -1;
+        }
+
+      /* Get the details about the directory entry.  This can be done through
+         FindFirstFile
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstfilea>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-_win32_find_dataa>
+         or through
+         FindFirstFileEx with argument FindExInfoBasic
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstfileexa>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ne-minwinbase-findex_info_levels>
+         <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-_win32_find_dataa>  */
+      WIN32_FIND_DATA info;
+      HANDLE h = FindFirstFile (rname, &info);
+      if (h == INVALID_HANDLE_VALUE)
+        goto failed;
+
+      /* Test for error conditions before starting to fill *buf.  */
+      if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0)
+        {
+          FindClose (h);
+          if (malloca_rname != NULL)
+            freea (malloca_rname);
+          errno = EOVERFLOW;
+          return -1;
+        }
+
+# if _GL_WINDOWS_STAT_INODES
+      buf->st_dev = 0;
+#  if _GL_WINDOWS_STAT_INODES == 2
+      buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0;
+#  else /* _GL_WINDOWS_STAT_INODES == 1 */
+      buf->st_ino = 0;
+#  endif
+# else
+      /* st_ino is not wide enough for identifying a file on a device.
+         Without st_ino, st_dev is pointless.  */
+      buf->st_dev = 0;
+      buf->st_ino = 0;
+# endif
+
+      /* st_mode.  */
+      unsigned int mode =
+        /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ?  */
+        ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG)
+        | S_IREAD_UGO
+        | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO);
+      if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+        {
+          /* Determine whether the file is executable by looking at the file
+             name suffix.  */
+          if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0)
+            {
+              const char *last_dot = NULL;
+              const char *p;
+              for (p = info.cFileName; *p != '\0'; p++)
+                if (*p == '.')
+                  last_dot = p;
+              if (last_dot != NULL)
+                {
+                  const char *suffix = last_dot + 1;
+                  if (_stricmp (suffix, "exe") == 0
+                      || _stricmp (suffix, "bat") == 0
+                      || _stricmp (suffix, "cmd") == 0
+                      || _stricmp (suffix, "com") == 0)
+                    mode |= S_IEXEC_UGO;
+                }
+            }
+        }
+      buf->st_mode = mode;
+
+      /* st_nlink.  Ignore hard links here.  */
+      buf->st_nlink = 1;
+
+      /* There's no easy way to map the Windows SID concept to an integer.  */
+      buf->st_uid = 0;
+      buf->st_gid = 0;
+
+      /* st_rdev is irrelevant for normal files and directories.  */
+      buf->st_rdev = 0;
+
+      /* st_size.  */
+      if (sizeof (buf->st_size) <= 4)
+        /* Range check already done above.  */
+        buf->st_size = info.nFileSizeLow;
+      else
+        buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow;
+
+      /* st_atime, st_mtime, st_ctime.  */
+# if _GL_WINDOWS_STAT_TIMESPEC
+      buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime);
+      buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime);
+      buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime);
+# else
+      buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime);
+      buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime);
+      buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime);
+# endif
+
+      FindClose (h);
+
+      ret = 0;
+    }
+
+   done:
+    if (ret >= 0 && check_dir && !S_ISDIR (buf->st_mode))
+      {
+        errno = ENOTDIR;
+        ret = -1;
+      }
+    if (malloca_rname != NULL)
+      {
+        int saved_errno = errno;
+        freea (malloca_rname);
+        errno = saved_errno;
+      }
+    return ret;
+  }
+
+ failed:
+  {
+    DWORD error = GetLastError ();
+    #if 0
+    fprintf (stderr, "rpl_stat error 0x%x\n", (unsigned int) error);
+    #endif
+
+    if (malloca_rname != NULL)
+      freea (malloca_rname);
+
+    switch (error)
+      {
+      /* Some of these errors probably cannot happen with the specific flags
+         that we pass to CreateFile.  But who knows...  */
+      case ERROR_FILE_NOT_FOUND: /* The last component of rname does not exist.  */
+      case ERROR_PATH_NOT_FOUND: /* Some directory component in rname does not exist.  */
+      case ERROR_BAD_PATHNAME:   /* rname is such as '\\server'.  */
+      case ERROR_BAD_NET_NAME:   /* rname is such as '\\server\nonexistentshare'.  */
+      case ERROR_INVALID_NAME:   /* rname contains wildcards, misplaced colon, etc.  */
+      case ERROR_DIRECTORY:
+        errno = ENOENT;
+        break;
+
+      case ERROR_ACCESS_DENIED:  /* rname is such as 'C:\System Volume Information\foo'.  */
+      case ERROR_SHARING_VIOLATION: /* rname is such as 'C:\pagefile.sys' (second approach only).  */
+                                    /* XXX map to EACCES or EPERM? */
+        errno = EACCES;
+        break;
+
+      case ERROR_OUTOFMEMORY:
+        errno = ENOMEM;
+        break;
+
+      case ERROR_WRITE_PROTECT:
+        errno = EROFS;
+        break;
+
+      case ERROR_WRITE_FAULT:
+      case ERROR_READ_FAULT:
+      case ERROR_GEN_FAILURE:
+        errno = EIO;
+        break;
+
+      case ERROR_BUFFER_OVERFLOW:
+      case ERROR_FILENAME_EXCED_RANGE:
+        errno = ENAMETOOLONG;
+        break;
+
+      case ERROR_DELETE_PENDING: /* XXX map to EACCES or EPERM? */
+        errno = EPERM;
+        break;
+
+      default:
+        errno = EINVAL;
+        break;
+      }
+
+    return -1;
+  }
+#else
+  int result = orig_stat (name, buf);
+  if (result == 0)
+    {
+# if REPLACE_FUNC_STAT_FILE
+      /* Solaris 9 mistakenly succeeds when given a non-directory with a
+         trailing slash.  */
+      if (!S_ISDIR (buf->st_mode))
+        {
+          size_t len = strlen (name);
+          if (ISSLASH (name[len - 1]))
+            {
+              errno = ENOTDIR;
+              return -1;
+            }
+        }
+# endif /* REPLACE_FUNC_STAT_FILE */
+      result = stat_time_normalize (result, buf);
+    }
+  return result;
+#endif
+}
deleted file mode 120000 (symlink)
index b51de606408f713f066640838330d8866ed18efd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdarg.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..65a397759ce2c8247e6d2a653b2c39bd544ef94f
--- /dev/null
@@ -0,0 +1,40 @@
+/* Substitute for and wrapper around <stdarg.h>.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_STDARG_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_STDARG_H@
+
+#ifndef _@GUARD_PREFIX@_STDARG_H
+#define _@GUARD_PREFIX@_STDARG_H
+
+/* This file uses va_copy.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#ifndef va_copy
+# define va_copy(a,b) ((a) = (b))
+#endif
+
+#endif /* _@GUARD_PREFIX@_STDARG_H */
+#endif /* _@GUARD_PREFIX@_STDARG_H */
deleted file mode 120000 (symlink)
index 02f73c8540ff613b0a7c619f42e5fda1b3610119..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdckdint.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..91848806d8dca59c3f476b757b5bc358f80244ee
--- /dev/null
@@ -0,0 +1,35 @@
+/* stdckdint.h -- checked integer arithmetic
+
+   Copyright 2022-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_STDCKDINT_H
+#define _GL_STDCKDINT_H
+
+#include "intprops-internal.h"
+
+/* Store into *R the low-order bits of A + B, A - B, A * B, respectively.
+   Return 1 if the result overflows, 0 otherwise.
+   A, B, and *R can have any integer type other than char, bool, a
+   bit-precise integer type, or an enumeration type.
+
+   These are like the standard macros introduced in C23, except that
+   arguments should not have side effects.  */
+
+#define ckd_add(r, a, b) ((bool) _GL_INT_ADD_WRAPV (a, b, r))
+#define ckd_sub(r, a, b) ((bool) _GL_INT_SUBTRACT_WRAPV (a, b, r))
+#define ckd_mul(r, a, b) ((bool) _GL_INT_MULTIPLY_WRAPV (a, b, r))
+
+#endif /* _GL_STDCKDINT_H */
deleted file mode 120000 (symlink)
index e3c22001fc37bd3006b85463903c9bde154a21bb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stddef.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fa8998d9b72097fb78745aa5eaf5fb2506fc7084
--- /dev/null
@@ -0,0 +1,213 @@
+/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+/*
+ * POSIX 2008 and ISO C 23 <stddef.h> for platforms that have issues.
+ * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html>
+ */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined __need_wchar_t || defined __need_size_t  \
+  || defined __need_ptrdiff_t || defined __need_NULL \
+  || defined __need_wint_t
+/* Special invocation convention inside gcc header files.  In
+   particular, gcc provides a version of <stddef.h> that blindly
+   redefines NULL even when __need_wint_t was defined, even though
+   wint_t is not normally provided by <stddef.h>.  Hence, we must
+   remember if special invocation has ever been used to obtain wint_t,
+   in which case we need to clean up NULL yet again.  */
+
+# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _@GUARD_PREFIX@_STDDEF_WINT_T)
+#  ifdef __need_wint_t
+#   define _@GUARD_PREFIX@_STDDEF_WINT_T
+#  endif
+#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+   /* On TinyCC, make sure that the macros that indicate the special invocation
+      convention get undefined.  */
+#  undef __need_wchar_t
+#  undef __need_size_t
+#  undef __need_ptrdiff_t
+#  undef __need_NULL
+#  undef __need_wint_t
+# endif
+
+#else
+/* Normal invocation convention.  */
+
+# ifndef _@GUARD_PREFIX@_STDDEF_H
+
+/* On AIX 7.2, with xlc in 64-bit mode, <stddef.h> defines max_align_t to a
+   type with alignment 4, but 'long' has alignment 8.  */
+#  if defined _AIX && defined __LP64__ && !@HAVE_MAX_ALIGN_T@
+#   if !GNULIB_defined_max_align_t
+#    ifdef _MAX_ALIGN_T
+/* /usr/include/stddef.h has already defined max_align_t.  Override it.  */
+typedef long rpl_max_align_t;
+#     define max_align_t rpl_max_align_t
+#    else
+/* Prevent /usr/include/stddef.h from defining max_align_t.  */
+typedef long max_align_t;
+#     define _MAX_ALIGN_T
+#    endif
+#    define __CLANG_MAX_ALIGN_T_DEFINED
+#    define GNULIB_defined_max_align_t 1
+#   endif
+#  endif
+
+/* The include_next requires a split double-inclusion guard.  */
+
+#  @INCLUDE_NEXT@ @NEXT_STDDEF_H@
+
+/* On NetBSD 5.0, the definition of NULL lacks proper parentheses.  */
+#  if (@REPLACE_NULL@ \
+       && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _@GUARD_PREFIX@_STDDEF_WINT_T))
+#   undef NULL
+#   ifdef __cplusplus
+   /* ISO C++ says that the macro NULL must expand to an integer constant
+      expression, hence '((void *) 0)' is not allowed in C++.  */
+#    if __GNUG__ >= 3
+    /* GNU C++ has a __null macro that behaves like an integer ('int' or
+       'long') but has the same size as a pointer.  Use that, to avoid
+       warnings.  */
+#     define NULL __null
+#    else
+#     define NULL 0L
+#    endif
+#   else
+#    define NULL ((void *) 0)
+#   endif
+#  endif
+
+#  ifndef _@GUARD_PREFIX@_STDDEF_H
+#   define _@GUARD_PREFIX@_STDDEF_H
+
+/* This file uses _Noreturn, _GL_ATTRIBUTE_NOTHROW.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
+ */
+#ifndef _GL_ATTRIBUTE_NOTHROW
+# if defined __cplusplus
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#   if __cplusplus >= 201103L
+#    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
+#   else
+#    define _GL_ATTRIBUTE_NOTHROW throw ()
+#   endif
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# else
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
+#   define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# endif
+#endif
+
+/* Some platforms lack wchar_t.  */
+#if !@HAVE_WCHAR_T@
+# define wchar_t int
+#endif
+
+/* Some platforms lack max_align_t.  The check for _GCC_MAX_ALIGN_T is
+   a hack in case the configure-time test was done with g++ even though
+   we are currently compiling with gcc.
+   On MSVC, max_align_t is defined only in C++ mode, after <cstddef> was
+   included.  Its definition is good since it has an alignment of 8 (on x86
+   and x86_64).
+   Similarly on OS/2 kLIBC.  */
+#if (defined _MSC_VER || (defined __KLIBC__ && !defined __LIBCN__)) \
+    && defined __cplusplus
+# include <cstddef>
+#else
+# if ! (@HAVE_MAX_ALIGN_T@ || (defined _GCC_MAX_ALIGN_T && !defined __clang__))
+#  if !GNULIB_defined_max_align_t
+/* On the x86, the maximum storage alignment of double, long, etc. is 4,
+   but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8,
+   and the C11 standard allows this.  Work around this problem by
+   using __alignof__ (which returns 8 for double) rather than _Alignof
+   (which returns 4), and align each union member accordingly.  */
+#   if defined __GNUC__ || (__clang_major__ >= 4)
+#    define _GL_STDDEF_ALIGNAS(type) \
+       __attribute__ ((__aligned__ (__alignof__ (type))))
+#   else
+#    define _GL_STDDEF_ALIGNAS(type) /* */
+#   endif
+typedef union
+{
+  char *__p _GL_STDDEF_ALIGNAS (char *);
+  double __d _GL_STDDEF_ALIGNAS (double);
+  long double __ld _GL_STDDEF_ALIGNAS (long double);
+  long int __i _GL_STDDEF_ALIGNAS (long int);
+} rpl_max_align_t;
+#   define max_align_t rpl_max_align_t
+#   define __CLANG_MAX_ALIGN_T_DEFINED
+#   define GNULIB_defined_max_align_t 1
+#  endif
+# endif
+#endif
+
+/* ISO C 23 § 7.21.1 The unreachable macro  */
+#ifndef unreachable
+
+/* Code borrowed from verify.h.  */
+# ifndef _GL_HAS_BUILTIN_UNREACHABLE
+#  if defined __clang_major__ && __clang_major__ < 5
+#   define _GL_HAS_BUILTIN_UNREACHABLE 0
+#  elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__)
+#   define _GL_HAS_BUILTIN_UNREACHABLE 1
+#  elif defined __has_builtin
+#   define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable)
+#  else
+#   define _GL_HAS_BUILTIN_UNREACHABLE 0
+#  endif
+# endif
+
+# if _GL_HAS_BUILTIN_UNREACHABLE
+#  define unreachable() __builtin_unreachable ()
+# elif 1200 <= _MSC_VER
+#  define unreachable() __assume (0)
+# else
+/* Declare abort(), without including <stdlib.h>.  */
+extern
+#  if defined __cplusplus
+"C"
+#  endif
+_Noreturn
+void abort (void)
+#  if defined __cplusplus && (__GLIBC__ >= 2)
+_GL_ATTRIBUTE_NOTHROW
+#  endif
+;
+#  define unreachable() abort ()
+# endif
+
+#endif
+
+#  endif /* _@GUARD_PREFIX@_STDDEF_H */
+# endif /* _@GUARD_PREFIX@_STDDEF_H */
+#endif /* __need_XXX */
deleted file mode 120000 (symlink)
index 1d4bb0fe1d6fd75079dcdd1e85ae4e773277dc33..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdint.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fea7483b9cc5d463697d99fae9d87a6b2166e261
--- /dev/null
@@ -0,0 +1,742 @@
+/* Copyright (C) 2001-2002, 2004-2024 Free Software Foundation, Inc.
+   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
+   This file is part of gnulib.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/*
+ * ISO C 99 <stdint.h> for platforms that lack it.
+ * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html>
+ */
+
+#ifndef _@GUARD_PREFIX@_STDINT_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* When including a system file that in turn includes <inttypes.h>,
+   use the system <inttypes.h>, not our substitute.  This avoids
+   problems with (for example) VMS, whose <sys/bitypes.h> includes
+   <inttypes.h>.  */
+#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+
+/* On Android (Bionic libc), <sys/types.h> includes this file before
+   having defined 'time_t'.  Therefore in this case avoid including
+   other system header files; just include the system's <stdint.h>.
+   Ideally we should test __BIONIC__ here, but it is only defined after
+   <sys/cdefs.h> has been included; hence test __ANDROID__ instead.  */
+#if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H
+# @INCLUDE_NEXT@ @NEXT_STDINT_H@
+#else
+
+/* Get those types that are already defined in other system include
+   files, so that we can "#define int8_t signed char" below without
+   worrying about a later system include file containing a "typedef
+   signed char int8_t;" that will get messed up by our macro.  Our
+   macros should all be consistent with the system versions, except
+   for the "fast" types and macros, which we recommend against using
+   in public interfaces due to compiler differences.  */
+
+#if @HAVE_STDINT_H@
+# if defined __sgi && ! defined __c99
+   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
+      with "This header file is to be used only for c99 mode compilations"
+      diagnostics.  */
+#  define __STDINT_H__
+# endif
+
+  /* Some pre-C++11 <stdint.h> implementations need this.  */
+# ifdef __cplusplus
+#  ifndef __STDC_CONSTANT_MACROS
+#   define __STDC_CONSTANT_MACROS 1
+#  endif
+#  ifndef __STDC_LIMIT_MACROS
+#   define __STDC_LIMIT_MACROS 1
+#  endif
+# endif
+
+  /* Other systems may have an incomplete or buggy <stdint.h>.
+     Include it before <inttypes.h>, since any "#include <stdint.h>"
+     in <inttypes.h> would reinclude us, skipping our contents because
+     _@GUARD_PREFIX@_STDINT_H is defined.
+     The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_STDINT_H@
+#endif
+
+#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
+#define _@GUARD_PREFIX@_STDINT_H
+
+/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
+   LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH.  */
+#include <limits.h>
+
+/* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides
+   wint_t.  */
+#if @GNULIBHEADERS_OVERRIDE_WINT_T@
+# undef WINT_MIN
+# undef WINT_MAX
+# define WINT_MIN 0x0U
+# define WINT_MAX 0xffffffffU
+#endif
+
+#if ! @HAVE_C99_STDINT_H@
+
+/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
+   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
+   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
+   Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
+   relies on the system <stdint.h> definitions, so include
+   <sys/types.h> after @NEXT_STDINT_H@.  */
+# if @HAVE_SYS_TYPES_H@ && ! defined _AIX
+#  include <sys/types.h>
+# endif
+
+# if @HAVE_INTTYPES_H@
+  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
+     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
+     <inttypes.h> also defines intptr_t and uintptr_t.  */
+#  include <inttypes.h>
+# elif @HAVE_SYS_INTTYPES_H@
+  /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
+     the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
+#  include <sys/inttypes.h>
+# endif
+
+# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
+  /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
+     int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
+     included by <sys/types.h>.  */
+#  include <sys/bitypes.h>
+# endif
+
+# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+
+/* Minimum and maximum values for an integer type under the usual assumption.
+   Return an unspecified value if BITS == 0, adding a check to pacify
+   picky compilers.  */
+
+/* These are separate macros, because if you try to merge these macros into
+   a single one, HP-UX cc rejects the resulting expression in constant
+   expressions.  */
+# define _STDINT_UNSIGNED_MIN(bits, zero) \
+    (zero)
+# define _STDINT_SIGNED_MIN(bits, zero) \
+    (~ _STDINT_MAX (1, bits, zero))
+
+# define _STDINT_MAX(signed, bits, zero) \
+    (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
+
+#if !GNULIB_defined_stdint_types
+
+/* 7.18.1.1. Exact-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits.  */
+
+# undef int8_t
+# undef uint8_t
+typedef signed char gl_int8_t;
+typedef unsigned char gl_uint8_t;
+# define int8_t gl_int8_t
+# define uint8_t gl_uint8_t
+
+# undef int16_t
+# undef uint16_t
+typedef short int gl_int16_t;
+typedef unsigned short int gl_uint16_t;
+# define int16_t gl_int16_t
+# define uint16_t gl_uint16_t
+
+# undef int32_t
+# undef uint32_t
+typedef int gl_int32_t;
+typedef unsigned int gl_uint32_t;
+# define int32_t gl_int32_t
+# define uint32_t gl_uint32_t
+
+/* If the system defines INT64_MAX, assume int64_t works.  That way,
+   if the underlying platform defines int64_t to be a 64-bit long long
+   int, the code below won't mistakenly define it to be a 64-bit long
+   int, which would mess up C++ name mangling.  We must use #ifdef
+   rather than #if, to avoid an error with HP-UX 10.20 cc.  */
+
+# ifdef INT64_MAX
+#  define GL_INT64_T
+# else
+/* Do not undefine int64_t if gnulib is not being used with 64-bit
+   types, since otherwise it breaks platforms like Tandem/NSK.  */
+#  if LONG_MAX >> 31 >> 31 == 1
+#   undef int64_t
+typedef long int gl_int64_t;
+#   define int64_t gl_int64_t
+#   define GL_INT64_T
+#  elif defined _MSC_VER
+#   undef int64_t
+typedef __int64 gl_int64_t;
+#   define int64_t gl_int64_t
+#   define GL_INT64_T
+#  else
+#   undef int64_t
+typedef long long int gl_int64_t;
+#   define int64_t gl_int64_t
+#   define GL_INT64_T
+#  endif
+# endif
+
+# ifdef UINT64_MAX
+#  define GL_UINT64_T
+# else
+#  if ULONG_MAX >> 31 >> 31 >> 1 == 1
+#   undef uint64_t
+typedef unsigned long int gl_uint64_t;
+#   define uint64_t gl_uint64_t
+#   define GL_UINT64_T
+#  elif defined _MSC_VER
+#   undef uint64_t
+typedef unsigned __int64 gl_uint64_t;
+#   define uint64_t gl_uint64_t
+#   define GL_UINT64_T
+#  else
+#   undef uint64_t
+typedef unsigned long long int gl_uint64_t;
+#   define uint64_t gl_uint64_t
+#   define GL_UINT64_T
+#  endif
+# endif
+
+/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
+# define _UINT8_T
+# define _UINT32_T
+# define _UINT64_T
+
+
+/* 7.18.1.2. Minimum-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
+   are the same as the corresponding N_t types.  */
+
+# undef int_least8_t
+# undef uint_least8_t
+# undef int_least16_t
+# undef uint_least16_t
+# undef int_least32_t
+# undef uint_least32_t
+# undef int_least64_t
+# undef uint_least64_t
+# define int_least8_t int8_t
+# define uint_least8_t uint8_t
+# define int_least16_t int16_t
+# define uint_least16_t uint16_t
+# define int_least32_t int32_t
+# define uint_least32_t uint32_t
+# ifdef GL_INT64_T
+#  define int_least64_t int64_t
+# endif
+# ifdef GL_UINT64_T
+#  define uint_least64_t uint64_t
+# endif
+
+/* 7.18.1.3. Fastest minimum-width integer types */
+
+/* Note: Other <stdint.h> substitutes may define these types differently.
+   It is not recommended to use these types in public header files. */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
+   are taken from the same list of types.  The following code normally
+   uses types consistent with glibc, as that lessens the chance of
+   incompatibility with older GNU hosts.  */
+
+# undef int_fast8_t
+# undef uint_fast8_t
+# undef int_fast16_t
+# undef uint_fast16_t
+# undef int_fast32_t
+# undef uint_fast32_t
+# undef int_fast64_t
+# undef uint_fast64_t
+typedef signed char gl_int_fast8_t;
+typedef unsigned char gl_uint_fast8_t;
+
+# ifdef __sun
+/* Define types compatible with SunOS 5.10, so that code compiled under
+   earlier SunOS versions works with code compiled under SunOS 5.10.  */
+typedef int gl_int_fast32_t;
+typedef unsigned int gl_uint_fast32_t;
+# else
+typedef long int gl_int_fast32_t;
+typedef unsigned long int gl_uint_fast32_t;
+# endif
+typedef gl_int_fast32_t gl_int_fast16_t;
+typedef gl_uint_fast32_t gl_uint_fast16_t;
+
+# define int_fast8_t gl_int_fast8_t
+# define uint_fast8_t gl_uint_fast8_t
+# define int_fast16_t gl_int_fast16_t
+# define uint_fast16_t gl_uint_fast16_t
+# define int_fast32_t gl_int_fast32_t
+# define uint_fast32_t gl_uint_fast32_t
+# ifdef GL_INT64_T
+#  define int_fast64_t int64_t
+# endif
+# ifdef GL_UINT64_T
+#  define uint_fast64_t uint64_t
+# endif
+
+/* 7.18.1.4. Integer types capable of holding object pointers */
+
+/* kLIBC's <stdint.h> defines _INTPTR_T_DECLARED and needs its own
+   definitions of intptr_t and uintptr_t (which use int and unsigned)
+   to avoid clashes with declarations of system functions like sbrk.
+   Similarly, MinGW WSL-5.4.1 <stdint.h> needs its own intptr_t and
+   uintptr_t to avoid conflicting declarations of system functions like
+   _findclose in <io.h>.  */
+# if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \
+       || (defined __INTPTR_WIDTH__ \
+           && __INTPTR_WIDTH__ != (defined _WIN64 ? LLONG_WIDTH : LONG_WIDTH)) \
+       || defined __MINGW32__)
+#  undef intptr_t
+#  undef uintptr_t
+#  ifdef _WIN64
+typedef long long int gl_intptr_t;
+typedef unsigned long long int gl_uintptr_t;
+#  else
+typedef long int gl_intptr_t;
+typedef unsigned long int gl_uintptr_t;
+#  endif
+#  define intptr_t gl_intptr_t
+#  define uintptr_t gl_uintptr_t
+# endif
+
+/* 7.18.1.5. Greatest-width integer types */
+
+/* Note: These types are compiler dependent. It may be unwise to use them in
+   public header files. */
+
+/* If the system defines INTMAX_MAX, assume that intmax_t works, and
+   similarly for UINTMAX_MAX and uintmax_t.  This avoids problems with
+   assuming one type where another is used by the system.  */
+
+# ifndef INTMAX_MAX
+#  undef INTMAX_C
+#  undef intmax_t
+#  if LONG_MAX >> 30 == 1
+typedef long long int gl_intmax_t;
+#   define intmax_t gl_intmax_t
+#  elif defined GL_INT64_T
+#   define intmax_t int64_t
+#  else
+typedef long int gl_intmax_t;
+#   define intmax_t gl_intmax_t
+#  endif
+# endif
+
+# ifndef UINTMAX_MAX
+#  undef UINTMAX_C
+#  undef uintmax_t
+#  if ULONG_MAX >> 31 == 1
+typedef unsigned long long int gl_uintmax_t;
+#   define uintmax_t gl_uintmax_t
+#  elif defined GL_UINT64_T
+#   define uintmax_t uint64_t
+#  else
+typedef unsigned long int gl_uintmax_t;
+#   define uintmax_t gl_uintmax_t
+#  endif
+# 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[sizeof (intmax_t) == sizeof (uintmax_t)
+                                ? 1 : -1];
+
+# define GNULIB_defined_stdint_types 1
+# endif /* !GNULIB_defined_stdint_types */
+
+/* 7.18.2. Limits of specified-width integer types */
+
+/* 7.18.2.1. Limits of exact-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits.  */
+
+# undef INT8_MIN
+# undef INT8_MAX
+# undef UINT8_MAX
+# define INT8_MIN  (~ INT8_MAX)
+# define INT8_MAX  127
+# define UINT8_MAX  255
+
+# undef INT16_MIN
+# undef INT16_MAX
+# undef UINT16_MAX
+# define INT16_MIN  (~ INT16_MAX)
+# define INT16_MAX  32767
+# define UINT16_MAX  65535
+
+# undef INT32_MIN
+# undef INT32_MAX
+# undef UINT32_MAX
+# define INT32_MIN  (~ INT32_MAX)
+# define INT32_MAX  2147483647
+# define UINT32_MAX  4294967295U
+
+# if defined GL_INT64_T && ! defined INT64_MAX
+/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
+   evaluates the latter incorrectly in preprocessor expressions.  */
+#  define INT64_MIN  (- INTMAX_C (1) << 63)
+#  define INT64_MAX  INTMAX_C (9223372036854775807)
+# endif
+
+# if defined GL_UINT64_T && ! defined UINT64_MAX
+#  define UINT64_MAX  UINTMAX_C (18446744073709551615)
+# endif
+
+/* 7.18.2.2. Limits of minimum-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
+   are the same as the corresponding N_t types.  */
+
+# undef INT_LEAST8_MIN
+# undef INT_LEAST8_MAX
+# undef UINT_LEAST8_MAX
+# define INT_LEAST8_MIN  INT8_MIN
+# define INT_LEAST8_MAX  INT8_MAX
+# define UINT_LEAST8_MAX  UINT8_MAX
+
+# undef INT_LEAST16_MIN
+# undef INT_LEAST16_MAX
+# undef UINT_LEAST16_MAX
+# define INT_LEAST16_MIN  INT16_MIN
+# define INT_LEAST16_MAX  INT16_MAX
+# define UINT_LEAST16_MAX  UINT16_MAX
+
+# undef INT_LEAST32_MIN
+# undef INT_LEAST32_MAX
+# undef UINT_LEAST32_MAX
+# define INT_LEAST32_MIN  INT32_MIN
+# define INT_LEAST32_MAX  INT32_MAX
+# define UINT_LEAST32_MAX  UINT32_MAX
+
+# undef INT_LEAST64_MIN
+# undef INT_LEAST64_MAX
+# ifdef GL_INT64_T
+#  define INT_LEAST64_MIN  INT64_MIN
+#  define INT_LEAST64_MAX  INT64_MAX
+# endif
+
+# undef UINT_LEAST64_MAX
+# ifdef GL_UINT64_T
+#  define UINT_LEAST64_MAX  UINT64_MAX
+# endif
+
+/* 7.18.2.3. Limits of fastest minimum-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
+   are taken from the same list of types.  */
+
+# undef INT_FAST8_MIN
+# undef INT_FAST8_MAX
+# undef UINT_FAST8_MAX
+# define INT_FAST8_MIN  SCHAR_MIN
+# define INT_FAST8_MAX  SCHAR_MAX
+# define UINT_FAST8_MAX  UCHAR_MAX
+
+# undef INT_FAST16_MIN
+# undef INT_FAST16_MAX
+# undef UINT_FAST16_MAX
+# define INT_FAST16_MIN  INT_FAST32_MIN
+# define INT_FAST16_MAX  INT_FAST32_MAX
+# define UINT_FAST16_MAX  UINT_FAST32_MAX
+
+# undef INT_FAST32_MIN
+# undef INT_FAST32_MAX
+# undef UINT_FAST32_MAX
+# ifdef __sun
+#  define INT_FAST32_MIN  INT_MIN
+#  define INT_FAST32_MAX  INT_MAX
+#  define UINT_FAST32_MAX  UINT_MAX
+# else
+#  define INT_FAST32_MIN  LONG_MIN
+#  define INT_FAST32_MAX  LONG_MAX
+#  define UINT_FAST32_MAX  ULONG_MAX
+# endif
+
+# undef INT_FAST64_MIN
+# undef INT_FAST64_MAX
+# ifdef GL_INT64_T
+#  define INT_FAST64_MIN  INT64_MIN
+#  define INT_FAST64_MAX  INT64_MAX
+# endif
+
+# undef UINT_FAST64_MAX
+# ifdef GL_UINT64_T
+#  define UINT_FAST64_MAX  UINT64_MAX
+# endif
+
+/* 7.18.2.4. Limits of integer types capable of holding object pointers */
+
+# undef INTPTR_MIN
+# undef INTPTR_MAX
+# undef UINTPTR_MAX
+# ifdef _WIN64
+#  define INTPTR_MIN  LLONG_MIN
+#  define INTPTR_MAX  LLONG_MAX
+#  define UINTPTR_MAX  ULLONG_MAX
+# else
+#  define INTPTR_MIN  LONG_MIN
+#  define INTPTR_MAX  LONG_MAX
+#  define UINTPTR_MAX  ULONG_MAX
+# endif
+
+/* 7.18.2.5. Limits of greatest-width integer types */
+
+# ifndef INTMAX_MAX
+#  undef INTMAX_MIN
+#  ifdef INT64_MAX
+#   define INTMAX_MIN  INT64_MIN
+#   define INTMAX_MAX  INT64_MAX
+#  else
+#   define INTMAX_MIN  INT32_MIN
+#   define INTMAX_MAX  INT32_MAX
+#  endif
+# endif
+
+# ifndef UINTMAX_MAX
+#  ifdef UINT64_MAX
+#   define UINTMAX_MAX  UINT64_MAX
+#  else
+#   define UINTMAX_MAX  UINT32_MAX
+#  endif
+# endif
+
+/* 7.18.3. Limits of other integer types */
+
+/* ptrdiff_t limits */
+# undef PTRDIFF_MIN
+# undef PTRDIFF_MAX
+# if @APPLE_UNIVERSAL_BUILD@
+#  ifdef _LP64
+#   define PTRDIFF_MIN  _STDINT_SIGNED_MIN (64, 0l)
+#   define PTRDIFF_MAX  _STDINT_MAX (1, 64, 0l)
+#  else
+#   define PTRDIFF_MIN  _STDINT_SIGNED_MIN (32, 0)
+#   define PTRDIFF_MAX  _STDINT_MAX (1, 32, 0)
+#  endif
+# else
+#  define PTRDIFF_MIN  \
+    _STDINT_SIGNED_MIN (@BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+#  define PTRDIFF_MAX  \
+    _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+# endif
+
+/* sig_atomic_t limits */
+# undef SIG_ATOMIC_MIN
+# undef SIG_ATOMIC_MAX
+# if @HAVE_SIGNED_SIG_ATOMIC_T@
+#  define SIG_ATOMIC_MIN  \
+    _STDINT_SIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@)
+# else
+#  define SIG_ATOMIC_MIN  \
+    _STDINT_UNSIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@)
+# endif
+# define SIG_ATOMIC_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
+                0@SIG_ATOMIC_T_SUFFIX@)
+
+
+/* size_t limit */
+# undef SIZE_MAX
+# if @APPLE_UNIVERSAL_BUILD@
+#  ifdef _LP64
+#   define SIZE_MAX  _STDINT_MAX (0, 64, 0ul)
+#  else
+#   define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
+#  endif
+# else
+#  define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
+# endif
+
+/* wchar_t limits */
+/* Get WCHAR_MIN, WCHAR_MAX.
+   This include is not on the top, above, because on OSF/1 4.0 we have a
+   sequence of nested includes
+   <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
+   <stdint.h> and assumes its types are already defined.  */
+# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
+#  define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+#  include <wchar.h>
+#  undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+# endif
+# undef WCHAR_MIN
+# undef WCHAR_MAX
+# if @HAVE_SIGNED_WCHAR_T@
+#  define WCHAR_MIN  \
+    _STDINT_SIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
+# else
+#  define WCHAR_MIN  \
+    _STDINT_UNSIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
+# endif
+# define WCHAR_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
+
+/* wint_t limits */
+/* If gnulib's <wchar.h> or <wctype.h> overrides wint_t, @WINT_T_SUFFIX@ is not
+   accurate, therefore use the definitions from above.  */
+# if !@GNULIBHEADERS_OVERRIDE_WINT_T@
+#  undef WINT_MIN
+#  undef WINT_MAX
+#  if @HAVE_SIGNED_WINT_T@
+#   define WINT_MIN  \
+     _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+#  else
+#   define WINT_MIN  \
+     _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+#  endif
+#  define WINT_MAX  \
+    _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+# endif
+
+/* 7.18.4. Macros for integer constants */
+
+/* 7.18.4.1. Macros for minimum-width integer constants */
+/* According to ISO C 99 Technical Corrigendum 1 */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
+
+# undef INT8_C
+# undef UINT8_C
+# define INT8_C(x) x
+# define UINT8_C(x) x
+
+# undef INT16_C
+# undef UINT16_C
+# define INT16_C(x) x
+# define UINT16_C(x) x
+
+# undef INT32_C
+# undef UINT32_C
+# define INT32_C(x) x
+# define UINT32_C(x) x ## U
+
+# undef INT64_C
+# undef UINT64_C
+# if LONG_MAX >> 31 >> 31 == 1
+#  define INT64_C(x) x##L
+# elif defined _MSC_VER
+#  define INT64_C(x) x##i64
+# else
+#  define INT64_C(x) x##LL
+# endif
+# if ULONG_MAX >> 31 >> 31 >> 1 == 1
+#  define UINT64_C(x) x##UL
+# elif defined _MSC_VER
+#  define UINT64_C(x) x##ui64
+# else
+#  define UINT64_C(x) x##ULL
+# endif
+
+/* 7.18.4.2. Macros for greatest-width integer constants */
+
+# ifndef INTMAX_C
+#  if LONG_MAX >> 30 == 1
+#   define INTMAX_C(x)   x##LL
+#  elif defined GL_INT64_T
+#   define INTMAX_C(x)   INT64_C(x)
+#  else
+#   define INTMAX_C(x)   x##L
+#  endif
+# endif
+
+# ifndef UINTMAX_C
+#  if ULONG_MAX >> 31 == 1
+#   define UINTMAX_C(x)  x##ULL
+#  elif defined GL_UINT64_T
+#   define UINTMAX_C(x)  UINT64_C(x)
+#  else
+#   define UINTMAX_C(x)  x##UL
+#  endif
+# endif
+
+#endif /* !@HAVE_C99_STDINT_H@ */
+
+/* Macros specified by ISO/IEC TS 18661-1:2014.  */
+
+#if (!defined UINTMAX_WIDTH \
+     && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
+# ifdef INT8_MAX
+#  define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX)
+# endif
+# ifdef UINT8_MAX
+#  define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX)
+# endif
+# ifdef INT16_MAX
+#  define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX)
+# endif
+# ifdef UINT16_MAX
+#  define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX)
+# endif
+# ifdef INT32_MAX
+#  define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX)
+# endif
+# ifdef UINT32_MAX
+#  define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX)
+# endif
+# ifdef INT64_MAX
+#  define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX)
+# endif
+# ifdef UINT64_MAX
+#  define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX)
+# endif
+# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX)
+# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX)
+# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX)
+# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX)
+# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX)
+# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX)
+# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX)
+# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX)
+# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX)
+# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX)
+# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX)
+# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX)
+# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX)
+# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX)
+# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX)
+# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX)
+# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX)
+# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX)
+# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX)
+# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX)
+# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX)
+# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX)
+# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX)
+# ifdef WINT_MAX
+#  define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX)
+# endif
+# ifdef SIG_ATOMIC_MAX
+#  define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX)
+# endif
+#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
+
+#endif /* _@GUARD_PREFIX@_STDINT_H */
+#endif /* !(defined __ANDROID__ && ...) */
+#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
deleted file mode 120000 (symlink)
index e3fd99619df4cea2608306ed84c1232ea4c1a056..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdio--.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0be7ef6c627f29dc982715021fe8736c54d36e51
--- /dev/null
@@ -0,0 +1,41 @@
+/* Like stdio.h, but redefine some names to avoid glitches.
+
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <stdio.h>
+#include "stdio-safer.h"
+
+#if GNULIB_FOPEN_SAFER
+# undef fopen
+# define fopen fopen_safer
+#endif
+
+#if GNULIB_FREOPEN_SAFER
+# undef freopen
+# define freopen freopen_safer
+#endif
+
+#if GNULIB_TMPFILE_SAFER
+# undef tmpfile
+# define tmpfile tmpfile_safer
+#endif
+
+#if GNULIB_POPEN_SAFER
+# undef popen
+# define popen popen_safer
+#endif
deleted file mode 120000 (symlink)
index b130c50aaf0b29339cfd1410554cd50a0d505ed5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdio-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..63ebf7c64b74dd05f461a71fb96e6921dbf2f161
--- /dev/null
@@ -0,0 +1,218 @@
+/* Implementation details of FILE streams.
+   Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Many stdio implementations have the same logic and therefore can share
+   the same implementation of stdio extension API, except that some fields
+   have different naming conventions, or their access requires some casts.  */
+
+/* Glibc 2.28 made _IO_UNBUFFERED and _IO_IN_BACKUP private.  For now, work
+   around this problem by defining them ourselves.  FIXME: Do not rely on glibc
+   internals.  */
+#if defined _IO_EOF_SEEN
+# if !defined _IO_UNBUFFERED
+#  define _IO_UNBUFFERED 0x2
+# endif
+# if !defined _IO_IN_BACKUP
+#  define _IO_IN_BACKUP 0x100
+# endif
+#endif
+
+/* BSD stdio derived implementations.  */
+
+#if defined __NetBSD__                         /* NetBSD */
+/* Get __NetBSD_Version__.  */
+# include <sys/param.h>
+#endif
+
+#include <errno.h>                             /* For detecting Plan9.  */
+
+#if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+
+# if defined __DragonFly__          /* DragonFly */
+  /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/lib/libc/stdio/priv_stdio.h>.  */
+#  define fp_ ((struct { struct __FILE_public pub; \
+                         struct { unsigned char *_base; int _size; } _bf; \
+                         void *cookie; \
+                         void *_close; \
+                         void *_read; \
+                         void *_seek; \
+                         void *_write; \
+                         struct { unsigned char *_base; int _size; } _ub; \
+                         int _ur; \
+                         unsigned char _ubuf[3]; \
+                         unsigned char _nbuf[1]; \
+                         struct { unsigned char *_base; int _size; } _lb; \
+                         int _blksize; \
+                         fpos_t _offset; \
+                         /* More fields, not relevant here.  */ \
+                       } *) fp)
+  /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/include/stdio.h>.  */
+#  define _p pub._p
+#  define _flags pub._flags
+#  define _r pub._r
+#  define _w pub._w
+# elif defined __ANDROID__ /* Android */
+#  ifdef __LP64__
+#   define _gl_flags_file_t int
+#  else
+#   define _gl_flags_file_t short
+#  endif
+#  ifdef __LP64__
+#   define _gl_file_offset_t int64_t
+#  else
+    /* see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
+#   define _gl_file_offset_t __kernel_off_t
+#  endif
+  /* Up to this commit from 2015-10-12
+     <https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a>
+     the innards of FILE were public, and fp_ub could be defined like for OpenBSD,
+     see <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/fileext.h>
+     and <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/local.h>.
+     After this commit, the innards of FILE are hidden.  */
+#  define fp_ ((struct { unsigned char *_p; \
+                         int _r; \
+                         int _w; \
+                         _gl_flags_file_t _flags; \
+                         _gl_flags_file_t _file; \
+                         struct { unsigned char *_base; size_t _size; } _bf; \
+                         int _lbfsize; \
+                         void *_cookie; \
+                         void *_close; \
+                         void *_read; \
+                         void *_seek; \
+                         void *_write; \
+                         struct { unsigned char *_base; size_t _size; } _ext; \
+                         unsigned char *_up; \
+                         int _ur; \
+                         unsigned char _ubuf[3]; \
+                         unsigned char _nbuf[1]; \
+                         struct { unsigned char *_base; size_t _size; } _lb; \
+                         int _blksize; \
+                         _gl_file_offset_t _offset; \
+                         /* More fields, not relevant here.  */ \
+                       } *) fp)
+# else
+#  define fp_ fp
+# endif
+
+# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */
+  /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
+     and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
+     and <https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/master/lib/libc/stdio/fileext.h> */
+  struct __sfileext
+    {
+      struct  __sbuf _ub; /* ungetc buffer */
+      /* More fields, not relevant here.  */
+    };
+#  define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
+# elif defined __ANDROID__                     /* Android */
+  struct __sfileext
+    {
+      struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */
+      /* More fields, not relevant here.  */
+    };
+#  define fp_ub ((struct __sfileext *) fp_->_ext._base)->_ub
+# else                                         /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin */
+#  define fp_ub fp_->_ub
+# endif
+
+# define HASUB(fp) (fp_ub._base != NULL)
+
+# if defined __ANDROID__ /* Android */
+  /* Needed after this commit from 2016-01-25
+     <https://android.googlesource.com/platform/bionic.git/+/e70e0e9267d069bf56a5078c99307e08a7280de7> */
+#  ifndef __SEOF
+#   define __SLBF 1
+#   define __SNBF 2
+#   define __SRD 4
+#   define __SWR 8
+#   define __SRW 0x10
+#   define __SEOF 0x20
+#   define __SERR 0x40
+#  endif
+#  ifndef __SOFF
+#   define __SOFF 0x1000
+#  endif
+# endif
+
+#endif
+
+
+/* SystemV derived implementations.  */
+
+#ifdef __TANDEM                     /* NonStop Kernel */
+# ifndef _IOERR
+/* These values were determined by the program 'stdioext-flags' at
+   <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>.  */
+#  define _IOERR   0x40
+#  define _IOREAD  0x80
+#  define _IOWRT    0x4
+#  define _IORW   0x100
+# endif
+#endif
+
+#if defined _IOERR
+
+# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
+#  define fp_ ((struct { unsigned char *_ptr; \
+                         unsigned char *_base; \
+                         unsigned char *_end; \
+                         long _cnt; \
+                         int _file; \
+                         unsigned int _flag; \
+                       } *) fp)
+# elif defined __VMS                /* OpenVMS */
+#  define fp_ ((struct _iobuf *) fp)
+# else
+#  define fp_ fp
+# endif
+
+# if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__)  /* OpenServer 5, OpenServer 6, UnixWare 7 */
+#  define _cnt __cnt
+#  define _ptr __ptr
+#  define _base __base
+#  define _flag __flag
+# endif
+
+#elif defined _WIN32 && ! defined __CYGWIN__  /* newer Windows with MSVC */
+
+/* <stdio.h> does not define the innards of FILE any more.  */
+# define WINDOWS_OPAQUE_FILE
+
+struct _gl_real_FILE
+{
+  /* Note: Compared to older Windows and to mingw, it has the fields
+     _base and _cnt swapped. */
+  unsigned char *_ptr;
+  unsigned char *_base;
+  int _cnt;
+  int _flag;
+  int _file;
+  int _charbuf;
+  int _bufsiz;
+};
+# define fp_ ((struct _gl_real_FILE *) fp)
+
+/* These values were determined by a program similar to the one at
+   <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>.  */
+# define _IOREAD   0x1
+# define _IOWRT    0x2
+# define _IORW     0x4
+# define _IOEOF    0x8
+# define _IOERR   0x10
+
+#endif
deleted file mode 120000 (symlink)
index 2f4252964165c3534dd30fb0d5cc08f21f187748..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdio-read.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..253b8aa43f20aadf256fae018c6e5983e1d9213a
--- /dev/null
@@ -0,0 +1,168 @@
+/* POSIX compatible FILE stream read function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+/* Replace these functions only if module 'nonblocking' is requested.  */
+#if GNULIB_NONBLOCKING
+
+/* On native Windows platforms, when read() is called on a non-blocking pipe
+   with an empty buffer, ReadFile() fails with error GetLastError() =
+   ERROR_NO_DATA, and read() in consequence fails with error EINVAL.  This
+   read() function is at the basis of the function which fills the buffer of
+   a FILE stream.  */
+
+# if defined _WIN32 && ! defined __CYGWIN__
+
+#  include <errno.h>
+#  include <io.h>
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+#  if GNULIB_MSVC_NOTHROW
+#   include "msvc-nothrow.h"
+#  else
+#   include <io.h>
+#  endif
+
+/* Don't assume that UNICODE is not defined.  */
+#  undef GetNamedPipeHandleState
+#  define GetNamedPipeHandleState GetNamedPipeHandleStateA
+
+#  define CALL_WITH_ERRNO_FIX(RETTYPE, EXPRESSION, FAILED) \
+  if (ferror (stream))                                                        \
+    return (EXPRESSION);                                                      \
+  else                                                                        \
+    {                                                                         \
+      RETTYPE ret;                                                            \
+      SetLastError (0);                                                       \
+      ret = (EXPRESSION);                                                     \
+      if (FAILED)                                                             \
+        {                                                                     \
+          if (GetLastError () == ERROR_NO_DATA && ferror (stream))            \
+            {                                                                 \
+              int fd = fileno (stream);                                       \
+              if (fd >= 0)                                                    \
+                {                                                             \
+                  HANDLE h = (HANDLE) _get_osfhandle (fd);                    \
+                  if (GetFileType (h) == FILE_TYPE_PIPE)                      \
+                    {                                                         \
+                      /* h is a pipe or socket.  */                           \
+                      DWORD state;                                            \
+                      if (GetNamedPipeHandleState (h, &state, NULL, NULL,     \
+                                                   NULL, NULL, 0)             \
+                          && (state & PIPE_NOWAIT) != 0)                      \
+                        /* h is a pipe in non-blocking mode.                  \
+                           Change errno from EINVAL to EAGAIN.  */            \
+                        errno = EAGAIN;                                       \
+                    }                                                         \
+                }                                                             \
+            }                                                                 \
+        }                                                                     \
+      return ret;                                                             \
+    }
+
+/* Enable this function definition only if gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_SCANF
+int
+scanf (const char *format, ...)
+{
+  int retval;
+  va_list args;
+
+  va_start (args, format);
+  retval = vfscanf (stdin, format, args);
+  va_end (args);
+
+  return retval;
+}
+#  endif
+
+/* Enable this function definition only if gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_FSCANF
+int
+fscanf (FILE *stream, const char *format, ...)
+{
+  int retval;
+  va_list args;
+
+  va_start (args, format);
+  retval = vfscanf (stream, format, args);
+  va_end (args);
+
+  return retval;
+}
+#  endif
+
+/* Enable this function definition only if gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_VSCANF
+int
+vscanf (const char *format, va_list args)
+{
+  return vfscanf (stdin, format, args);
+}
+#  endif
+
+/* Enable this function definition only if gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_VFSCANF
+int
+vfscanf (FILE *stream, const char *format, va_list args)
+#undef vfscanf
+{
+  CALL_WITH_ERRNO_FIX (int, vfscanf (stream, format, args), ret == EOF)
+}
+#  endif
+
+int
+getchar (void)
+{
+  return fgetc (stdin);
+}
+
+int
+fgetc (FILE *stream)
+#undef fgetc
+{
+  CALL_WITH_ERRNO_FIX (int, fgetc (stream), ret == EOF)
+}
+
+char *
+fgets (char *s, int n, FILE *stream)
+#undef fgets
+{
+  CALL_WITH_ERRNO_FIX (char *, fgets (s, n, stream), ret == NULL)
+}
+
+/* We intentionally don't bother to fix gets.  */
+
+size_t
+fread (void *ptr, size_t s, size_t n, FILE *stream)
+#undef fread
+{
+  CALL_WITH_ERRNO_FIX (size_t, fread (ptr, s, n, stream), ret < n)
+}
+
+# endif
+#endif
deleted file mode 120000 (symlink)
index a012406e94b2866e60429166f3001da106238268..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdio-safer.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..03d1545667e41168f251a4e4eebebcea8c30bb18
--- /dev/null
@@ -0,0 +1,45 @@
+/* Invoke stdio functions, but avoid some glitches.
+
+   Copyright (C) 2001, 2003, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdio.h>
+
+#if GNULIB_FOPEN_SAFER
+FILE *fopen_safer (char const *, char const *)
+  _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1);
+#endif
+
+#if GNULIB_FREOPEN_SAFER
+FILE *freopen_safer (char const *, char const *, FILE *)
+  _GL_ARG_NONNULL ((2, 3));
+#endif
+
+#if GNULIB_POPEN_SAFER
+FILE *popen_safer (char const *, char const *)
+  _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1);
+#endif
+
+#if GNULIB_TMPFILE_SAFER
+FILE *tmpfile_safer (void)
+  _GL_ATTRIBUTE_DEALLOC (fclose, 1);
+#endif
deleted file mode 120000 (symlink)
index 4290529c706643963cdc572cf1412992cab449d2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdio-write.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ca6aa00ceea2eae8c3939a6369ed83ddcf329243
--- /dev/null
@@ -0,0 +1,206 @@
+/* POSIX compatible FILE stream write function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+/* Replace these functions only if module 'nonblocking' or module 'sigpipe' is
+   requested.  */
+#if GNULIB_NONBLOCKING || GNULIB_SIGPIPE
+
+/* On native Windows platforms, SIGPIPE does not exist.  When write() is
+   called on a pipe with no readers, WriteFile() fails with error
+   GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
+   error EINVAL.  This write() function is at the basis of the function
+   which flushes the buffer of a FILE stream.  */
+
+# if defined _WIN32 && ! defined __CYGWIN__
+
+#  include <errno.h>
+#  include <signal.h>
+#  include <io.h>
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+#  if GNULIB_MSVC_NOTHROW
+#   include "msvc-nothrow.h"
+#  else
+#   include <io.h>
+#  endif
+
+/* Don't assume that UNICODE is not defined.  */
+#  undef GetNamedPipeHandleState
+#  define GetNamedPipeHandleState GetNamedPipeHandleStateA
+
+#  if GNULIB_NONBLOCKING
+#   define CLEAR_ERRNO \
+      errno = 0;
+#   define HANDLE_ENOSPC \
+          if (errno == ENOSPC && ferror (stream))                             \
+            {                                                                 \
+              int fd = fileno (stream);                                       \
+              if (fd >= 0)                                                    \
+                {                                                             \
+                  HANDLE h = (HANDLE) _get_osfhandle (fd);                    \
+                  if (GetFileType (h) == FILE_TYPE_PIPE)                      \
+                    {                                                         \
+                      /* h is a pipe or socket.  */                           \
+                      DWORD state;                                            \
+                      if (GetNamedPipeHandleState (h, &state, NULL, NULL,     \
+                                                   NULL, NULL, 0)             \
+                          && (state & PIPE_NOWAIT) != 0)                      \
+                        /* h is a pipe in non-blocking mode.                  \
+                           Change errno from ENOSPC to EAGAIN.  */            \
+                        errno = EAGAIN;                                       \
+                    }                                                         \
+                }                                                             \
+            }                                                                 \
+          else
+#  else
+#   define CLEAR_ERRNO
+#   define HANDLE_ENOSPC
+#  endif
+
+#  if GNULIB_SIGPIPE
+#   define CLEAR_LastError \
+      SetLastError (0);
+#   define HANDLE_ERROR_NO_DATA \
+          if (GetLastError () == ERROR_NO_DATA && ferror (stream))            \
+            {                                                                 \
+              int fd = fileno (stream);                                       \
+              if (fd >= 0                                                     \
+                  && GetFileType ((HANDLE) _get_osfhandle (fd))               \
+                     == FILE_TYPE_PIPE)                                       \
+                {                                                             \
+                  /* Try to raise signal SIGPIPE.  */                         \
+                  raise (SIGPIPE);                                            \
+                  /* If it is currently blocked or ignored, change errno from \
+                     EINVAL to EPIPE.  */                                     \
+                  errno = EPIPE;                                              \
+                }                                                             \
+            }                                                                 \
+          else
+#  else
+#   define CLEAR_LastError
+#   define HANDLE_ERROR_NO_DATA
+#  endif
+
+#  define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
+  if (ferror (stream))                                                        \
+    return (EXPRESSION);                                                      \
+  else                                                                        \
+    {                                                                         \
+      RETTYPE ret;                                                            \
+      CLEAR_ERRNO                                                             \
+      CLEAR_LastError                                                         \
+      ret = (EXPRESSION);                                                     \
+      if (FAILED)                                                             \
+        {                                                                     \
+          HANDLE_ENOSPC                                                       \
+          HANDLE_ERROR_NO_DATA                                                \
+          ;                                                                   \
+        }                                                                     \
+      return ret;                                                             \
+    }
+
+#  if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
+int
+printf (const char *format, ...)
+{
+  int retval;
+  va_list args;
+
+  va_start (args, format);
+  retval = vfprintf (stdout, format, args);
+  va_end (args);
+
+  return retval;
+}
+#  endif
+
+#  if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */
+int
+fprintf (FILE *stream, const char *format, ...)
+{
+  int retval;
+  va_list args;
+
+  va_start (args, format);
+  retval = vfprintf (stream, format, args);
+  va_end (args);
+
+  return retval;
+}
+#  endif
+
+#  if !REPLACE_VPRINTF_POSIX /* avoid collision with vprintf.c */
+int
+vprintf (const char *format, va_list args)
+{
+  return vfprintf (stdout, format, args);
+}
+#  endif
+
+#  if !REPLACE_VFPRINTF_POSIX /* avoid collision with vfprintf.c */
+int
+vfprintf (FILE *stream, const char *format, va_list args)
+#undef vfprintf
+{
+  CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
+}
+#  endif
+
+int
+putchar (int c)
+{
+  return fputc (c, stdout);
+}
+
+int
+fputc (int c, FILE *stream)
+#undef fputc
+{
+  CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF)
+}
+
+int
+fputs (const char *string, FILE *stream)
+#undef fputs
+{
+  CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF)
+}
+
+int
+puts (const char *string)
+#undef puts
+{
+  FILE *stream = stdout;
+  CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF)
+}
+
+size_t
+fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
+#undef fwrite
+{
+  CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
+}
+
+# endif
+#endif
deleted file mode 120000 (symlink)
index b16d83c6c6fc6279cb3c130ff27aea39fad355a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdio.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4947307e578e9ffc6417fa9adb2e83caf1b32224
--- /dev/null
+/* A GNU-like <stdio.h>.
+
+   Copyright (C) 2004, 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
+/* Special invocation convention:
+   - Inside glibc header files.
+   - On OSF/1 5.1 we have a sequence of nested includes
+     <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
+     <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
+     In this situation, the functions are not yet declared, therefore we cannot
+     provide the C++ aliases.  */
+
+#@INCLUDE_NEXT@ @NEXT_STDIO_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_STDIO_H
+
+/* Suppress macOS deprecation warnings for sprintf and vsprintf.  */
+#if (defined __APPLE__ && defined __MACH__) && !defined _POSIX_C_SOURCE
+# ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+#  include <AvailabilityMacros.h>
+# endif
+# if (defined MAC_OS_X_VERSION_MIN_REQUIRED \
+      && 130000 <= MAC_OS_X_VERSION_MIN_REQUIRED)
+#  define _POSIX_C_SOURCE 200809L
+#  define _GL_DEFINED__POSIX_C_SOURCE
+# endif
+#endif
+
+#define _GL_ALREADY_INCLUDING_STDIO_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_STDIO_H@
+
+#undef _GL_ALREADY_INCLUDING_STDIO_H
+
+#ifdef _GL_DEFINED__POSIX_C_SOURCE
+# undef _GL_DEFINED__POSIX_C_SOURCE
+# undef _POSIX_C_SOURCE
+#endif
+
+#ifndef _@GUARD_PREFIX@_STDIO_H
+#define _@GUARD_PREFIX@_STDIO_H
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT,
+   _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK,
+   HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get va_list.  Needed on many systems, including glibc 2.8.  */
+#include <stdarg.h>
+
+#include <stddef.h>
+
+/* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8
+   and eglibc 2.11.2.
+   May also define off_t to a 64-bit type on native Windows.  */
+#include <sys/types.h>
+
+/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>.  */
+/* But in any case avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \
+    && ! defined __GLIBC__
+# include <unistd.h>
+#endif
+
+/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>.  */
+/* But in any case avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+    && ! defined __GLIBC__
+# include <sys/stat.h>
+#endif
+
+/* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>.  We must include
+   it before we  #define perror rpl_perror.  */
+/* But in any case avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \
+    && (defined _WIN32 && ! defined __CYGWIN__) \
+    && ! defined __GLIBC__
+# include <stdlib.h>
+#endif
+
+/* MSVC declares 'remove' in <io.h>, not in <stdio.h>.  We must include
+   it before we  #define remove rpl_remove.  */
+/* MSVC declares 'rename' in <io.h>, not in <stdio.h>.  We must include
+   it before we  #define rename rpl_rename.  */
+/* But in any case avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \
+    && (defined _WIN32 && ! defined __CYGWIN__) \
+    && ! defined __GLIBC__
+# include <io.h>
+#endif
+
+
+/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
+   that can be freed by passing them as the Ith argument to the
+   function F.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# if __GNUC__ >= 11
+#  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+# else
+#  define _GL_ATTRIBUTE_DEALLOC(f, i)
+# endif
+#endif
+
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
+#ifndef _GL_ATTRIBUTE_FORMAT
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__
+#  define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+# else
+#  define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
+   allocated memory.  */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if __GNUC__ >= 3 || defined __clang__
+#  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define _GL_ATTRIBUTE_MALLOC
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
+ */
+#ifndef _GL_ATTRIBUTE_NOTHROW
+# if defined __cplusplus
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#   if __cplusplus >= 201103L
+#    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
+#   else
+#    define _GL_ATTRIBUTE_NOTHROW throw ()
+#   endif
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# else
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
+#   define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# endif
+#endif
+
+/* An __attribute__ __format__ specifier for a function that takes a format
+   string and arguments, where the format string directives are the ones
+   standardized by ISO C99 and POSIX.
+   _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD  */
+/* __gnu_printf__ is supported in GCC >= 4.4.  */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
+#else
+# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
+#endif
+
+/* An __attribute__ __format__ specifier for a function that takes a format
+   string and arguments, where the format string directives are the ones of the
+   system printf(), rather than the ones standardized by ISO C99 and POSIX.
+   _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM  */
+/* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to
+   the standards.  The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates
+   whether this change is effective.  On older mingw, it is not.  */
+#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
+# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD
+#else
+# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__
+#endif
+
+/* _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD
+   indicates to GCC that the function takes a format string and arguments,
+   where the format string directives are the ones standardized by ISO C99
+   and POSIX.  */
+#define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \
+  _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument))
+
+/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD,
+   except that it indicates to GCC that the supported format string directives
+   are the ones of the system printf(), rather than the ones standardized by
+   ISO C99 and POSIX.  */
+#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
+  _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, formatstring_parameter, first_argument))
+
+/* _GL_ATTRIBUTE_FORMAT_SCANF
+   indicates to GCC that the function takes a format string and arguments,
+   where the format string directives are the ones standardized by ISO C99
+   and POSIX.  */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
+   _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
+#else
+# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
+   _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
+#endif
+
+/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
+   except that it indicates to GCC that the supported format string directives
+   are the ones of the system scanf(), rather than the ones standardized by
+   ISO C99 and POSIX.  */
+#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
+  _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* Macros for stringification.  */
+#define _GL_STDIO_STRINGIZE(token) #token
+#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
+
+/* When also using extern inline, suppress the use of static inline in
+   standard headers of problematic Apple configurations, as Libc at
+   least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
+   <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>.
+   Perhaps Apple will fix this some day.  */
+#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
+     && defined __GNUC__ && defined __STDC__)
+# undef putc_unlocked
+#endif
+
+
+/* Maximum number of characters produced by printing a NaN value.  */
+#ifndef _PRINTF_NAN_LEN_MAX
+# if defined __FreeBSD__ || defined __DragonFly__ \
+     || defined __NetBSD__ \
+     || (defined __APPLE__ && defined __MACH__)
+/* On BSD systems, a NaN value prints as just "nan", without a sign.  */
+#  define _PRINTF_NAN_LEN_MAX 3
+# elif (__GLIBC__ >= 2) || MUSL_LIBC || defined __OpenBSD__ || defined __sun || defined __CYGWIN__
+/* glibc, musl libc, OpenBSD, Solaris libc, and Cygwin produce "[-]nan".  */
+#  define _PRINTF_NAN_LEN_MAX 4
+# elif defined _AIX
+/* AIX produces "[-]NaNQ".  */
+#  define _PRINTF_NAN_LEN_MAX 5
+# elif defined _WIN32 && !defined __CYGWIN__
+/* On native Windows, the output can be:
+   - with MSVC ucrt: "[-]nan" or "[-]nan(ind)" or "[-]nan(snan)",
+   - with mingw: "[-]1.#IND" or "[-]1.#QNAN".  */
+#  define _PRINTF_NAN_LEN_MAX 10
+# elif defined __sgi
+/* On IRIX, the output typically is "[-]nan0xNNNNNNNN" with 8 hexadecimal
+   digits.  */
+#  define _PRINTF_NAN_LEN_MAX 14
+# else
+/* We don't know, but 32 should be a safe maximum.  */
+#  define _PRINTF_NAN_LEN_MAX 32
+# endif
+#endif
+
+
+#if @GNULIB_DPRINTF@
+# if @REPLACE_DPRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define dprintf rpl_dprintf
+#  endif
+_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...)
+                                _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+                                _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
+# else
+#  if !@HAVE_DPRINTF@
+_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...)
+                                _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+                                _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (dprintf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef dprintf
+# if HAVE_RAW_DECL_DPRINTF
+_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
+                 "use gnulib module dprintf for portability");
+# endif
+#endif
+
+#if @GNULIB_FCLOSE@
+/* Close STREAM and its underlying file descriptor.  */
+# if @REPLACE_FCLOSE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define fclose rpl_fclose
+#  endif
+_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fclose);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fclose
+/* Assume fclose is always declared.  */
+_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
+                 "use gnulib module fclose for portable POSIX compliance");
+#endif
+
+#if @GNULIB_MDA_FCLOSEALL@
+/* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is
+   not required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have
+   it.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fcloseall
+#   define fcloseall _fcloseall
+#  endif
+_GL_CXXALIAS_MDA (fcloseall, int, (void));
+# else
+#  if @HAVE_DECL_FCLOSEALL@
+#   if defined __FreeBSD__ || defined __DragonFly__
+_GL_CXXALIAS_SYS (fcloseall, void, (void));
+#   else
+_GL_CXXALIAS_SYS (fcloseall, int, (void));
+#   endif
+#  endif
+# endif
+# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@
+_GL_CXXALIASWARN (fcloseall);
+# endif
+#endif
+
+#if @GNULIB_FDOPEN@
+# if @REPLACE_FDOPEN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fdopen
+#   define fdopen rpl_fdopen
+#  endif
+_GL_FUNCDECL_RPL (fdopen, FILE *,
+                  (int fd, const char *mode)
+                  _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+                  _GL_ATTRIBUTE_MALLOC);
+_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fdopen
+#   define fdopen _fdopen
+#  endif
+_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
+# else
+#  if __GNUC__ >= 11
+/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose.  */
+#   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (fdopen, FILE *,
+                  (int fd, const char *mode)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+                  _GL_ATTRIBUTE_MALLOC);
+#   else
+_GL_FUNCDECL_SYS (fdopen, FILE *,
+                  (int fd, const char *mode)
+                  _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+                  _GL_ATTRIBUTE_MALLOC);
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
+# endif
+_GL_CXXALIASWARN (fdopen);
+#else
+# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen
+/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose.  */
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (fdopen, FILE *,
+                  (int fd, const char *mode)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+                  _GL_ATTRIBUTE_MALLOC);
+#  else
+_GL_FUNCDECL_SYS (fdopen, FILE *,
+                  (int fd, const char *mode)
+                  _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+                  _GL_ATTRIBUTE_MALLOC);
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef fdopen
+/* Assume fdopen is always declared.  */
+_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
+                 "use gnulib module fdopen for portability");
+# elif @GNULIB_MDA_FDOPEN@
+/* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fdopen always.  */
+#  if defined _WIN32 && !defined __CYGWIN__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef fdopen
+#    define fdopen _fdopen
+#   endif
+_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
+#  else
+_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
+#  endif
+_GL_CXXALIASWARN (fdopen);
+# endif
+#endif
+
+#if @GNULIB_FFLUSH@
+/* Flush all pending data on STREAM according to POSIX rules.  Both
+   output and seekable input streams are supported.
+   Note! LOSS OF DATA can occur if fflush is applied on an input stream
+   that is _not_seekable_ or on an update stream that is _not_seekable_
+   and in which the most recent operation was input.  Seekability can
+   be tested with lseek(fileno(fp),0,SEEK_CUR).  */
+# if @REPLACE_FFLUSH@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define fflush rpl_fflush
+#  endif
+_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
+_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
+# else
+_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fflush);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fflush
+/* Assume fflush is always declared.  */
+_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
+                 "use gnulib module fflush for portable POSIX compliance");
+#endif
+
+#if @GNULIB_FGETC@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fgetc
+#   define fgetc rpl_fgetc
+#  endif
+_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fgetc);
+# endif
+#endif
+
+#if @GNULIB_FGETS@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fgets
+#   define fgets rpl_fgets
+#  endif
+_GL_FUNCDECL_RPL (fgets, char *,
+                  (char *restrict s, int n, FILE *restrict stream)
+                  _GL_ARG_NONNULL ((1, 3)));
+_GL_CXXALIAS_RPL (fgets, char *,
+                  (char *restrict s, int n, FILE *restrict stream));
+# else
+_GL_CXXALIAS_SYS (fgets, char *,
+                  (char *restrict s, int n, FILE *restrict stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fgets);
+# endif
+#endif
+
+#if @GNULIB_MDA_FILENO@
+/* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fileno always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fileno
+#   define fileno _fileno
+#  endif
+_GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream));
+# else
+_GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream));
+# endif
+_GL_CXXALIASWARN (fileno);
+#endif
+
+#if @GNULIB_FOPEN@
+# if (@GNULIB_FOPEN@ && @REPLACE_FOPEN@) \
+     || (@GNULIB_FOPEN_GNU@ && @REPLACE_FOPEN_FOR_FOPEN_GNU@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fopen
+#   define fopen rpl_fopen
+#  endif
+_GL_FUNCDECL_RPL (fopen, FILE *,
+                  (const char *restrict filename, const char *restrict mode)
+                  _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+                  _GL_ATTRIBUTE_MALLOC);
+_GL_CXXALIAS_RPL (fopen, FILE *,
+                  (const char *restrict filename, const char *restrict mode));
+# else
+#  if __GNUC__ >= 11
+/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose.  */
+_GL_FUNCDECL_SYS (fopen, FILE *,
+                  (const char *restrict filename, const char *restrict mode)
+                  _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
+#  endif
+_GL_CXXALIAS_SYS (fopen, FILE *,
+                  (const char *restrict filename, const char *restrict mode));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fopen);
+# endif
+#else
+# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen
+/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose.  */
+_GL_FUNCDECL_SYS (fopen, FILE *,
+                  (const char *restrict filename, const char *restrict mode)
+                  _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef fopen
+/* Assume fopen is always declared.  */
+_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
+                 "use gnulib module fopen for portability");
+# endif
+#endif
+
+#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
+# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
+     || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define fprintf rpl_fprintf
+#  endif
+#  define GNULIB_overrides_fprintf 1
+#  if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
+_GL_FUNCDECL_RPL (fprintf, int,
+                  (FILE *restrict fp, const char *restrict format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  else
+_GL_FUNCDECL_RPL (fprintf, int,
+                  (FILE *restrict fp, const char *restrict format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_RPL (fprintf, int,
+                  (FILE *restrict fp, const char *restrict format, ...));
+# else
+_GL_CXXALIAS_SYS (fprintf, int,
+                  (FILE *restrict fp, const char *restrict format, ...));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fprintf);
+# endif
+#endif
+#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_fprintf
+#  undef fprintf
+# endif
+/* Assume fprintf is always declared.  */
+_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
+                 "use gnulib module fprintf-posix for portable "
+                 "POSIX compliance");
+#endif
+
+#if @GNULIB_FPURGE@
+/* Discard all pending buffered I/O data on STREAM.
+   STREAM must not be wide-character oriented.
+   When discarding pending output, the file position is set back to where it
+   was before the write calls.  When discarding pending input, the file
+   position is advanced to match the end of the previously read input.
+   Return 0 if successful.  Upon error, return -1 and set errno.  */
+# if @REPLACE_FPURGE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define fpurge rpl_fpurge
+#  endif
+_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
+# else
+#  if !@HAVE_DECL_FPURGE@
+_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
+# endif
+_GL_CXXALIASWARN (fpurge);
+#elif defined GNULIB_POSIXCHECK
+# undef fpurge
+# if HAVE_RAW_DECL_FPURGE
+_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
+                 "use gnulib module fpurge for portability");
+# endif
+#endif
+
+#if @GNULIB_FPUTC@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fputc
+#   define fputc rpl_fputc
+#  endif
+_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fputc);
+# endif
+#endif
+
+#if @GNULIB_FPUTS@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fputs
+#   define fputs rpl_fputs
+#  endif
+_GL_FUNCDECL_RPL (fputs, int,
+                  (const char *restrict string, FILE *restrict stream)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fputs, int,
+                  (const char *restrict string, FILE *restrict stream));
+# else
+_GL_CXXALIAS_SYS (fputs, int,
+                  (const char *restrict string, FILE *restrict stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fputs);
+# endif
+#endif
+
+#if @GNULIB_FREAD@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fread
+#   define fread rpl_fread
+#  endif
+_GL_FUNCDECL_RPL (fread, size_t,
+                  (void *restrict ptr, size_t s, size_t n,
+                   FILE *restrict stream)
+                  _GL_ARG_NONNULL ((4)));
+_GL_CXXALIAS_RPL (fread, size_t,
+                  (void *restrict ptr, size_t s, size_t n,
+                   FILE *restrict stream));
+# else
+_GL_CXXALIAS_SYS (fread, size_t,
+                  (void *restrict ptr, size_t s, size_t n,
+                   FILE *restrict stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fread);
+# endif
+#endif
+
+#if @GNULIB_FREOPEN@
+# if @REPLACE_FREOPEN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef freopen
+#   define freopen rpl_freopen
+#  endif
+_GL_FUNCDECL_RPL (freopen, FILE *,
+                  (const char *restrict filename, const char *restrict mode,
+                   FILE *restrict stream)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (freopen, FILE *,
+                  (const char *restrict filename, const char *restrict mode,
+                   FILE *restrict stream));
+# else
+_GL_CXXALIAS_SYS (freopen, FILE *,
+                  (const char *restrict filename, const char *restrict mode,
+                   FILE *restrict stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (freopen);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef freopen
+/* Assume freopen is always declared.  */
+_GL_WARN_ON_USE (freopen,
+                 "freopen on native Windows platforms is not POSIX compliant - "
+                 "use gnulib module freopen for portability");
+#endif
+
+#if @GNULIB_FSCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fscanf
+#   define fscanf rpl_fscanf
+#  endif
+_GL_FUNCDECL_RPL (fscanf, int,
+                  (FILE *restrict stream, const char *restrict format, ...)
+                  _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fscanf, int,
+                  (FILE *restrict stream, const char *restrict format, ...));
+# else
+_GL_CXXALIAS_SYS (fscanf, int,
+                  (FILE *restrict stream, const char *restrict format, ...));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fscanf);
+# endif
+#endif
+
+
+/* Set up the following warnings, based on which modules are in use.
+   GNU Coding Standards discourage the use of fseek, since it imposes
+   an arbitrary limitation on some 32-bit hosts.  Remember that the
+   fseek module depends on the fseeko module, so we only have three
+   cases to consider:
+
+   1. The developer is not using either module.  Issue a warning under
+   GNULIB_POSIXCHECK for both functions, to remind them that both
+   functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
+   impact on this warning.
+
+   2. The developer is using both modules.  They may be unaware of the
+   arbitrary limitations of fseek, so issue a warning under
+   GNULIB_POSIXCHECK.  On the other hand, they may be using both
+   modules intentionally, so the developer can define
+   _GL_NO_LARGE_FILES in the compilation units where the use of fseek
+   is safe, to silence the warning.
+
+   3. The developer is using the fseeko module, but not fseek.  Gnulib
+   guarantees that fseek will still work around platform bugs in that
+   case, but we presume that the developer is aware of the pitfalls of
+   fseek and was trying to avoid it, so issue a warning even when
+   GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
+   defined to silence the warning in particular compilation units.
+   In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
+   fseek gets defined as a macro, it is recommended that the developer
+   uses the fseek module, even if he is not calling the fseek function.
+
+   Most gnulib clients that perform stream operations should fall into
+   category 3.  */
+
+#if @GNULIB_FSEEK@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 2, above.  */
+#  undef fseek
+# endif
+# if @REPLACE_FSEEK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fseek
+#   define fseek rpl_fseek
+#  endif
+_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
+# else
+_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fseek);
+# endif
+#endif
+
+#if @GNULIB_FSEEKO@
+# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 3, above.  */
+#  undef fseek
+# endif
+# if @REPLACE_FSEEKO@
+/* Provide an fseeko function that is aware of a preceding fflush(), and which
+   detects pipes.  */
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fseeko
+#   define fseeko rpl_fseeko
+#  endif
+_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
+# else
+#  if ! @HAVE_DECL_FSEEKO@
+_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
+                               _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
+# endif
+_GL_CXXALIASWARN (fseeko);
+#elif defined GNULIB_POSIXCHECK
+# define _GL_FSEEK_WARN /* Category 1, above.  */
+# undef fseek
+# undef fseeko
+# if HAVE_RAW_DECL_FSEEKO
+_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
+                 "use gnulib module fseeko for portability");
+# endif
+#endif
+
+#ifdef _GL_FSEEK_WARN
+# undef _GL_FSEEK_WARN
+/* Here, either fseek is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_fseek (declared above).  */
+_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use fseeko function for handling of large files");
+#endif
+
+
+/* ftell, ftello.  See the comments on fseek/fseeko.  */
+
+#if @GNULIB_FTELL@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 2, above.  */
+#  undef ftell
+# endif
+# if @REPLACE_FTELL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ftell
+#   define ftell rpl_ftell
+#  endif
+_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
+# else
+_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (ftell);
+# endif
+#endif
+
+#if @GNULIB_FTELLO@
+# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 3, above.  */
+#  undef ftell
+# endif
+# if @REPLACE_FTELLO@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ftello
+#   define ftello rpl_ftello
+#  endif
+_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
+# else
+#  if ! @HAVE_DECL_FTELLO@
+_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
+# endif
+_GL_CXXALIASWARN (ftello);
+#elif defined GNULIB_POSIXCHECK
+# define _GL_FTELL_WARN /* Category 1, above.  */
+# undef ftell
+# undef ftello
+# if HAVE_RAW_DECL_FTELLO
+_GL_WARN_ON_USE (ftello, "ftello is unportable - "
+                 "use gnulib module ftello for portability");
+# endif
+#endif
+
+#ifdef _GL_FTELL_WARN
+# undef _GL_FTELL_WARN
+/* Here, either ftell is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_ftell (declared above).  */
+_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use ftello function for handling of large files");
+#endif
+
+
+#if @GNULIB_FWRITE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fwrite
+#   define fwrite rpl_fwrite
+#  endif
+_GL_FUNCDECL_RPL (fwrite, size_t,
+                  (const void *restrict ptr, size_t s, size_t n,
+                   FILE *restrict stream)
+                  _GL_ARG_NONNULL ((1, 4)));
+_GL_CXXALIAS_RPL (fwrite, size_t,
+                  (const void *restrict ptr, size_t s, size_t n,
+                   FILE *restrict stream));
+# else
+_GL_CXXALIAS_SYS (fwrite, size_t,
+                  (const void *restrict ptr, size_t s, size_t n,
+                   FILE *restrict stream));
+
+/* Work around bug 11959 when fortifying glibc 2.4 through 2.15
+   <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>,
+   which sometimes causes an unwanted diagnostic for fwrite calls.
+   This affects only function declaration attributes under certain
+   versions of gcc and clang, and is not needed for C++.  */
+#  if (0 < __USE_FORTIFY_LEVEL                                          \
+       && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
+       && 3 < __GNUC__ + (4 <= __GNUC_MINOR__)                          \
+       && !defined __cplusplus)
+#   undef fwrite
+#   undef fwrite_unlocked
+extern size_t __REDIRECT (rpl_fwrite,
+                          (const void *__restrict, size_t, size_t,
+                           FILE *__restrict),
+                          fwrite);
+extern size_t __REDIRECT (rpl_fwrite_unlocked,
+                          (const void *__restrict, size_t, size_t,
+                           FILE *__restrict),
+                          fwrite_unlocked);
+#   define fwrite rpl_fwrite
+#   define fwrite_unlocked rpl_fwrite_unlocked
+#  endif
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fwrite);
+# endif
+#endif
+
+#if @GNULIB_GETC@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getc
+#   define getc rpl_fgetc
+#  endif
+_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
+# else
+_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getc);
+# endif
+#endif
+
+#if @GNULIB_GETCHAR@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getchar
+#   define getchar rpl_getchar
+#  endif
+_GL_FUNCDECL_RPL (getchar, int, (void));
+_GL_CXXALIAS_RPL (getchar, int, (void));
+# else
+_GL_CXXALIAS_SYS (getchar, int, (void));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getchar);
+# endif
+#endif
+
+#if @GNULIB_GETDELIM@
+/* 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.  */
+# if @REPLACE_GETDELIM@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getdelim
+#   define getdelim rpl_getdelim
+#  endif
+_GL_FUNCDECL_RPL (getdelim, ssize_t,
+                  (char **restrict lineptr, size_t *restrict linesize,
+                   int delimiter,
+                   FILE *restrict stream)
+                  _GL_ARG_NONNULL ((1, 2, 4)));
+_GL_CXXALIAS_RPL (getdelim, ssize_t,
+                  (char **restrict lineptr, size_t *restrict linesize,
+                   int delimiter,
+                   FILE *restrict stream));
+# else
+#  if !@HAVE_DECL_GETDELIM@
+_GL_FUNCDECL_SYS (getdelim, ssize_t,
+                  (char **restrict lineptr, size_t *restrict linesize,
+                   int delimiter,
+                   FILE *restrict stream)
+                  _GL_ARG_NONNULL ((1, 2, 4)));
+#  endif
+_GL_CXXALIAS_SYS (getdelim, ssize_t,
+                  (char **restrict lineptr, size_t *restrict linesize,
+                   int delimiter,
+                   FILE *restrict stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getdelim);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getdelim
+# if HAVE_RAW_DECL_GETDELIM
+_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
+                 "use gnulib module getdelim for portability");
+# endif
+#endif
+
+#if @GNULIB_GETLINE@
+/* 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.  */
+# if @REPLACE_GETLINE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getline
+#   define getline rpl_getline
+#  endif
+_GL_FUNCDECL_RPL (getline, ssize_t,
+                  (char **restrict lineptr, size_t *restrict linesize,
+                   FILE *restrict stream)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+_GL_CXXALIAS_RPL (getline, ssize_t,
+                  (char **restrict lineptr, size_t *restrict linesize,
+                   FILE *restrict stream));
+# else
+#  if !@HAVE_DECL_GETLINE@
+_GL_FUNCDECL_SYS (getline, ssize_t,
+                  (char **restrict lineptr, size_t *restrict linesize,
+                   FILE *restrict stream)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (getline, ssize_t,
+                  (char **restrict lineptr, size_t *restrict linesize,
+                   FILE *restrict stream));
+# endif
+# if __GLIBC__ >= 2 && @HAVE_DECL_GETLINE@
+_GL_CXXALIASWARN (getline);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getline
+# if HAVE_RAW_DECL_GETLINE
+_GL_WARN_ON_USE (getline, "getline is unportable - "
+                 "use gnulib module getline for portability");
+# endif
+#endif
+
+/* It is very rare that the developer ever has full control of stdin,
+   so any use of gets warrants an unconditional warning; besides, C11
+   removed it.  */
+#undef gets
+#if HAVE_RAW_DECL_GETS && !defined __cplusplus
+_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
+
+#if @GNULIB_MDA_GETW@
+/* On native Windows, map 'getw' to '_getw', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::getw always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getw
+#   define getw _getw
+#  endif
+_GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream));
+# else
+#  if @HAVE_DECL_GETW@
+#   if defined __APPLE__ && defined __MACH__
+/* The presence of the declaration depends on _POSIX_C_SOURCE.  */
+_GL_FUNCDECL_SYS (getw, int, (FILE *restrict stream));
+#   endif
+_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream));
+#  endif
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getw);
+# endif
+#endif
+
+#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
+struct obstack;
+/* Grow an obstack with formatted output.  Return the number of
+   bytes added to OBS.  No trailing nul byte is added, and the
+   object should be closed with obstack_finish before use.  Upon
+   memory allocation error, call obstack_alloc_failed_handler.  Upon
+   other error, return -1.  */
+# if @REPLACE_OBSTACK_PRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define obstack_printf rpl_obstack_printf
+#  endif
+_GL_FUNCDECL_RPL (obstack_printf, int,
+                  (struct obstack *obs, const char *format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (obstack_printf, int,
+                  (struct obstack *obs, const char *format, ...));
+# else
+#  if !@HAVE_DECL_OBSTACK_PRINTF@
+_GL_FUNCDECL_SYS (obstack_printf, int,
+                  (struct obstack *obs, const char *format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (obstack_printf, int,
+                  (struct obstack *obs, const char *format, ...));
+# endif
+_GL_CXXALIASWARN (obstack_printf);
+# if @REPLACE_OBSTACK_PRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define obstack_vprintf rpl_obstack_vprintf
+#  endif
+_GL_FUNCDECL_RPL (obstack_vprintf, int,
+                  (struct obstack *obs, const char *format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (obstack_vprintf, int,
+                  (struct obstack *obs, const char *format, va_list args));
+# else
+#  if !@HAVE_DECL_OBSTACK_PRINTF@
+_GL_FUNCDECL_SYS (obstack_vprintf, int,
+                  (struct obstack *obs, const char *format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (obstack_vprintf, int,
+                  (struct obstack *obs, const char *format, va_list args));
+# endif
+_GL_CXXALIASWARN (obstack_vprintf);
+#endif
+
+#if @GNULIB_PCLOSE@
+# if !@HAVE_PCLOSE@
+_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
+_GL_CXXALIASWARN (pclose);
+#elif defined GNULIB_POSIXCHECK
+# undef pclose
+# if HAVE_RAW_DECL_PCLOSE
+_GL_WARN_ON_USE (pclose, "pclose is unportable - "
+                 "use gnulib module pclose for more portability");
+# endif
+#endif
+
+#if @GNULIB_PERROR@
+/* Print a message to standard error, describing the value of ERRNO,
+   (if STRING is not NULL and not empty) prefixed with STRING and ": ",
+   and terminated with a newline.  */
+# if @REPLACE_PERROR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define perror rpl_perror
+#  endif
+_GL_FUNCDECL_RPL (perror, void, (const char *string));
+_GL_CXXALIAS_RPL (perror, void, (const char *string));
+# else
+_GL_CXXALIAS_SYS (perror, void, (const char *string));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (perror);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef perror
+/* Assume perror is always declared.  */
+_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
+                 "use gnulib module perror for portability");
+#endif
+
+#if @GNULIB_POPEN@
+# if @REPLACE_POPEN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef popen
+#   define popen rpl_popen
+#  endif
+_GL_FUNCDECL_RPL (popen, FILE *,
+                  (const char *cmd, const char *mode)
+                  _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
+                  _GL_ATTRIBUTE_MALLOC);
+_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
+# else
+#  if !@HAVE_POPEN@ || __GNUC__ >= 11
+_GL_FUNCDECL_SYS (popen, FILE *,
+                  (const char *cmd, const char *mode)
+                  _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
+                  _GL_ATTRIBUTE_MALLOC);
+#  endif
+_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
+# endif
+_GL_CXXALIASWARN (popen);
+#else
+# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen
+/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose.  */
+_GL_FUNCDECL_SYS (popen, FILE *,
+                  (const char *cmd, const char *mode)
+                  _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
+                  _GL_ATTRIBUTE_MALLOC);
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef popen
+#  if HAVE_RAW_DECL_POPEN
+_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
+                 "use gnulib module popen or pipe for more portability");
+#  endif
+# endif
+#endif
+
+#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
+# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
+     || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
+#  if defined __GNUC__ || defined __clang__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+/* Don't break __attribute__((format(printf,M,N))).  */
+#    define printf __printf__
+#   endif
+#   if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
+_GL_FUNCDECL_RPL_1 (__printf__, int,
+                    (const char *restrict format, ...)
+                    __asm__ (@ASM_SYMBOL_PREFIX@
+                             _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
+                    _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
+                    _GL_ARG_NONNULL ((1)));
+#   else
+_GL_FUNCDECL_RPL_1 (__printf__, int,
+                    (const char *restrict format, ...)
+                    __asm__ (@ASM_SYMBOL_PREFIX@
+                             _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
+                    _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
+                    _GL_ARG_NONNULL ((1)));
+#   endif
+_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
+#  else
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    define printf rpl_printf
+#   endif
+_GL_FUNCDECL_RPL (printf, int,
+                  (const char *restrict format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
+#  endif
+#  define GNULIB_overrides_printf 1
+# else
+_GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (printf);
+# endif
+#endif
+#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_printf
+#  undef printf
+# endif
+/* Assume printf is always declared.  */
+_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
+                 "use gnulib module printf-posix for portable "
+                 "POSIX compliance");
+#endif
+
+#if @GNULIB_PUTC@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putc
+#   define putc rpl_fputc
+#  endif
+_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (putc);
+# endif
+#endif
+
+#if @GNULIB_PUTCHAR@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putchar
+#   define putchar rpl_putchar
+#  endif
+_GL_FUNCDECL_RPL (putchar, int, (int c));
+_GL_CXXALIAS_RPL (putchar, int, (int c));
+# else
+_GL_CXXALIAS_SYS (putchar, int, (int c));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (putchar);
+# endif
+#endif
+
+#if @GNULIB_PUTS@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef puts
+#   define puts rpl_puts
+#  endif
+_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (puts, int, (const char *string));
+# else
+_GL_CXXALIAS_SYS (puts, int, (const char *string));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (puts);
+# endif
+#endif
+
+#if @GNULIB_MDA_PUTW@
+/* On native Windows, map 'putw' to '_putw', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::putw always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putw
+#   define putw _putw
+#  endif
+_GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream));
+# else
+#  if @HAVE_DECL_PUTW@
+#   if defined __APPLE__ && defined __MACH__
+/* The presence of the declaration depends on _POSIX_C_SOURCE.  */
+_GL_FUNCDECL_SYS (putw, int, (int w, FILE *restrict stream));
+#   endif
+_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream));
+#  endif
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (putw);
+# endif
+#endif
+
+#if @GNULIB_REMOVE@
+# if @REPLACE_REMOVE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef remove
+#   define remove rpl_remove
+#  endif
+_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (remove, int, (const char *name));
+# else
+_GL_CXXALIAS_SYS (remove, int, (const char *name));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (remove);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef remove
+/* Assume remove is always declared.  */
+_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
+                 "use gnulib module remove for more portability");
+#endif
+
+#if @GNULIB_RENAME@
+# if @REPLACE_RENAME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rename
+#   define rename rpl_rename
+#  endif
+_GL_FUNCDECL_RPL (rename, int,
+                  (const char *old_filename, const char *new_filename)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (rename, int,
+                  (const char *old_filename, const char *new_filename));
+# else
+_GL_CXXALIAS_SYS (rename, int,
+                  (const char *old_filename, const char *new_filename));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (rename);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef rename
+/* Assume rename is always declared.  */
+_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
+                 "use gnulib module rename for more portability");
+#endif
+
+#if @GNULIB_RENAMEAT@
+# if @REPLACE_RENAMEAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef renameat
+#   define renameat rpl_renameat
+#  endif
+_GL_FUNCDECL_RPL (renameat, int,
+                  (int fd1, char const *file1, int fd2, char const *file2)
+                  _GL_ARG_NONNULL ((2, 4)));
+_GL_CXXALIAS_RPL (renameat, int,
+                  (int fd1, char const *file1, int fd2, char const *file2));
+# else
+#  if !@HAVE_RENAMEAT@
+_GL_FUNCDECL_SYS (renameat, int,
+                  (int fd1, char const *file1, int fd2, char const *file2)
+                  _GL_ARG_NONNULL ((2, 4)));
+#  endif
+_GL_CXXALIAS_SYS (renameat, int,
+                  (int fd1, char const *file1, int fd2, char const *file2));
+# endif
+_GL_CXXALIASWARN (renameat);
+#elif defined GNULIB_POSIXCHECK
+# undef renameat
+# if HAVE_RAW_DECL_RENAMEAT
+_GL_WARN_ON_USE (renameat, "renameat is not portable - "
+                 "use gnulib module renameat for portability");
+# endif
+#endif
+
+#if @GNULIB_SCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if defined __GNUC__ || defined __clang__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef scanf
+/* Don't break __attribute__((format(scanf,M,N))).  */
+#    define scanf __scanf__
+#   endif
+_GL_FUNCDECL_RPL_1 (__scanf__, int,
+                    (const char *restrict format, ...)
+                    __asm__ (@ASM_SYMBOL_PREFIX@
+                             _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
+                    _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
+                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...));
+#  else
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef scanf
+#    define scanf rpl_scanf
+#   endif
+_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...)
+                              _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
+#  endif
+# else
+_GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (scanf);
+# endif
+#endif
+
+#if @GNULIB_SNPRINTF@
+# if @REPLACE_SNPRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define snprintf rpl_snprintf
+#  endif
+#  define GNULIB_overrides_snprintf 1
+_GL_FUNCDECL_RPL (snprintf, int,
+                  (char *restrict str, size_t size,
+                   const char *restrict format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
+                  _GL_ARG_NONNULL ((3)));
+_GL_CXXALIAS_RPL (snprintf, int,
+                  (char *restrict str, size_t size,
+                   const char *restrict format, ...));
+# else
+#  if !@HAVE_DECL_SNPRINTF@
+_GL_FUNCDECL_SYS (snprintf, int,
+                  (char *restrict str, size_t size,
+                   const char *restrict format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
+                  _GL_ARG_NONNULL ((3)));
+#  endif
+_GL_CXXALIAS_SYS (snprintf, int,
+                  (char *restrict str, size_t size,
+                   const char *restrict format, ...));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (snprintf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef snprintf
+# if HAVE_RAW_DECL_SNPRINTF
+_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+                 "use gnulib module snprintf for portability");
+# endif
+#endif
+
+/* Some people would argue that all sprintf uses should be warned about
+   (for example, OpenBSD issues a link warning for it),
+   since it can cause security holes due to buffer overruns.
+   However, we believe that sprintf can be used safely, and is more
+   efficient than snprintf in those safe cases; and as proof of our
+   belief, we use sprintf in several gnulib modules.  So this header
+   intentionally avoids adding a warning to sprintf except when
+   GNULIB_POSIXCHECK is defined.  */
+
+#if @GNULIB_SPRINTF_POSIX@
+# if @REPLACE_SPRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define sprintf rpl_sprintf
+#  endif
+#  define GNULIB_overrides_sprintf 1
+_GL_FUNCDECL_RPL (sprintf, int,
+                  (char *restrict str, const char *restrict format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (sprintf, int,
+                  (char *restrict str, const char *restrict format, ...));
+# else
+_GL_CXXALIAS_SYS (sprintf, int,
+                  (char *restrict str, const char *restrict format, ...));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (sprintf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sprintf
+/* Assume sprintf is always declared.  */
+_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
+                 "use gnulib module sprintf-posix for portable "
+                 "POSIX compliance");
+#endif
+
+#if @GNULIB_MDA_TEMPNAM@
+/* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::tempnam always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef tempnam
+#   define tempnam _tempnam
+#  endif
+_GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix));
+# else
+_GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix));
+# endif
+_GL_CXXALIASWARN (tempnam);
+#endif
+
+#if @GNULIB_TMPFILE@
+# if @REPLACE_TMPFILE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define tmpfile rpl_tmpfile
+#  endif
+_GL_FUNCDECL_RPL (tmpfile, FILE *, (void)
+                                   _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+                                   _GL_ATTRIBUTE_MALLOC);
+_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
+# else
+#  if __GNUC__ >= 11
+/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose.  */
+_GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
+                                   _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+                                   _GL_ATTRIBUTE_MALLOC);
+#  endif
+_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (tmpfile);
+# endif
+#else
+# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile
+/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose.  */
+_GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
+                                   _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+                                   _GL_ATTRIBUTE_MALLOC);
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef tmpfile
+#  if HAVE_RAW_DECL_TMPFILE
+_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
+                 "use gnulib module tmpfile for portability");
+#  endif
+# endif
+#endif
+
+#if @GNULIB_VASPRINTF@
+/* Write formatted output to a string dynamically allocated with malloc().
+   If the memory allocation succeeds, store the address of the string in
+   *RESULT and return the number of resulting bytes, excluding the trailing
+   NUL.  Upon memory allocation error, or some other error, return -1.  */
+# if @REPLACE_VASPRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define asprintf rpl_asprintf
+#  endif
+#  define GNULIB_overrides_asprintf
+_GL_FUNCDECL_RPL (asprintf, int,
+                  (char **result, const char *format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (asprintf, int,
+                  (char **result, const char *format, ...));
+# else
+#  if !@HAVE_VASPRINTF@
+_GL_FUNCDECL_SYS (asprintf, int,
+                  (char **result, const char *format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (asprintf, int,
+                  (char **result, const char *format, ...));
+# endif
+_GL_CXXALIASWARN (asprintf);
+# if @REPLACE_VASPRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vasprintf rpl_vasprintf
+#  endif
+#  define GNULIB_overrides_vasprintf 1
+_GL_FUNCDECL_RPL (vasprintf, int,
+                  (char **result, const char *format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (vasprintf, int,
+                  (char **result, const char *format, va_list args));
+# else
+#  if !@HAVE_VASPRINTF@
+_GL_FUNCDECL_SYS (vasprintf, int,
+                  (char **result, const char *format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (vasprintf, int,
+                  (char **result, const char *format, va_list args));
+# endif
+_GL_CXXALIASWARN (vasprintf);
+#endif
+
+#if @GNULIB_VDPRINTF@
+# if @REPLACE_VDPRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vdprintf rpl_vdprintf
+#  endif
+_GL_FUNCDECL_RPL (vdprintf, int,
+                  (int fd, const char *restrict format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (vdprintf, int,
+                  (int fd, const char *restrict format, va_list args));
+# else
+#  if !@HAVE_VDPRINTF@
+_GL_FUNCDECL_SYS (vdprintf, int,
+                  (int fd, const char *restrict format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+/* Need to cast, because on Solaris, the third parameter will likely be
+                                                    __va_list args.  */
+_GL_CXXALIAS_SYS_CAST (vdprintf, int,
+                       (int fd, const char *restrict format, va_list args));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (vdprintf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vdprintf
+# if HAVE_RAW_DECL_VDPRINTF
+_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
+                 "use gnulib module vdprintf for portability");
+# endif
+#endif
+
+#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
+# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
+     || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vfprintf rpl_vfprintf
+#  endif
+#  define GNULIB_overrides_vfprintf 1
+#  if @GNULIB_VFPRINTF_POSIX@
+_GL_FUNCDECL_RPL (vfprintf, int,
+                  (FILE *restrict fp,
+                   const char *restrict format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  else
+_GL_FUNCDECL_RPL (vfprintf, int,
+                  (FILE *restrict fp,
+                   const char *restrict format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_RPL (vfprintf, int,
+                  (FILE *restrict fp,
+                   const char *restrict format, va_list args));
+# else
+/* Need to cast, because on Solaris, the third parameter is
+                                                      __va_list args
+   and GCC's fixincludes did not change this to __gnuc_va_list.  */
+_GL_CXXALIAS_SYS_CAST (vfprintf, int,
+                       (FILE *restrict fp,
+                        const char *restrict format, va_list args));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (vfprintf);
+# endif
+#endif
+#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_vfprintf
+#  undef vfprintf
+# endif
+/* Assume vfprintf is always declared.  */
+_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
+                 "use gnulib module vfprintf-posix for portable "
+                      "POSIX compliance");
+#endif
+
+#if @GNULIB_VFSCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef vfscanf
+#   define vfscanf rpl_vfscanf
+#  endif
+_GL_FUNCDECL_RPL (vfscanf, int,
+                  (FILE *restrict stream,
+                   const char *restrict format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (vfscanf, int,
+                  (FILE *restrict stream,
+                   const char *restrict format, va_list args));
+# else
+_GL_CXXALIAS_SYS (vfscanf, int,
+                  (FILE *restrict stream,
+                   const char *restrict format, va_list args));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (vfscanf);
+# endif
+#endif
+
+#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
+# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
+     || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vprintf rpl_vprintf
+#  endif
+#  define GNULIB_overrides_vprintf 1
+#  if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
+_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
+                                _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
+                                _GL_ARG_NONNULL ((1)));
+#  else
+_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
+                                _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
+                                _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args));
+# else
+/* Need to cast, because on Solaris, the second parameter is
+                                                          __va_list args
+   and GCC's fixincludes did not change this to __gnuc_va_list.  */
+_GL_CXXALIAS_SYS_CAST (vprintf, int,
+                       (const char *restrict format, va_list args));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (vprintf);
+# endif
+#endif
+#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_vprintf
+#  undef vprintf
+# endif
+/* Assume vprintf is always declared.  */
+_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
+                 "use gnulib module vprintf-posix for portable "
+                 "POSIX compliance");
+#endif
+
+#if @GNULIB_VSCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef vscanf
+#   define vscanf rpl_vscanf
+#  endif
+_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args)
+                               _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
+# else
+_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (vscanf);
+# endif
+#endif
+
+#if @GNULIB_VSNPRINTF@
+# if @REPLACE_VSNPRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vsnprintf rpl_vsnprintf
+#  endif
+#  define GNULIB_overrides_vsnprintf 1
+_GL_FUNCDECL_RPL (vsnprintf, int,
+                  (char *restrict str, size_t size,
+                   const char *restrict format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
+                  _GL_ARG_NONNULL ((3)));
+_GL_CXXALIAS_RPL (vsnprintf, int,
+                  (char *restrict str, size_t size,
+                   const char *restrict format, va_list args));
+# else
+#  if !@HAVE_DECL_VSNPRINTF@
+_GL_FUNCDECL_SYS (vsnprintf, int,
+                  (char *restrict str, size_t size,
+                   const char *restrict format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
+                  _GL_ARG_NONNULL ((3)));
+#  endif
+_GL_CXXALIAS_SYS (vsnprintf, int,
+                  (char *restrict str, size_t size,
+                   const char *restrict format, va_list args));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (vsnprintf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vsnprintf
+# if HAVE_RAW_DECL_VSNPRINTF
+_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
+                 "use gnulib module vsnprintf for portability");
+# endif
+#endif
+
+#if @GNULIB_VSPRINTF_POSIX@
+# if @REPLACE_VSPRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vsprintf rpl_vsprintf
+#  endif
+#  define GNULIB_overrides_vsprintf 1
+_GL_FUNCDECL_RPL (vsprintf, int,
+                  (char *restrict str,
+                   const char *restrict format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (vsprintf, int,
+                  (char *restrict str,
+                   const char *restrict format, va_list args));
+# else
+/* Need to cast, because on Solaris, the third parameter is
+                                                       __va_list args
+   and GCC's fixincludes did not change this to __gnuc_va_list.  */
+_GL_CXXALIAS_SYS_CAST (vsprintf, int,
+                       (char *restrict str,
+                        const char *restrict format, va_list args));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (vsprintf);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vsprintf
+/* Assume vsprintf is always declared.  */
+_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
+                 "use gnulib module vsprintf-posix for portable "
+                      "POSIX compliance");
+#endif
+
+#endif /* _@GUARD_PREFIX@_STDIO_H */
+#endif /* _@GUARD_PREFIX@_STDIO_H */
+#endif
deleted file mode 120000 (symlink)
index fba4464f13b68c1a7216d760f5a248cf358126e0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdlib--.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..13a80b146bc341c8cb951df786900880706ee662
--- /dev/null
@@ -0,0 +1,36 @@
+/* Like stdlib.h, but redefine some names to avoid glitches.
+
+   Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <stdlib.h>
+#include "stdlib-safer.h"
+
+#undef mkstemp
+#define mkstemp mkstemp_safer
+
+#if GNULIB_MKOSTEMP
+# define mkostemp mkostemp_safer
+#endif
+
+#if GNULIB_MKOSTEMPS
+# define mkostemps mkostemps_safer
+#endif
+
+#if GNULIB_MKSTEMPS
+# define mkstemps mkstemps_safer
+#endif
deleted file mode 120000 (symlink)
index 713cfbd8d57a8edc1aa611857bde556c08ded92b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdlib-safer.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d47d1640eda98170a1b13769f1beffa9aa57449b
--- /dev/null
@@ -0,0 +1,32 @@
+/* Invoke stdlib.h functions, but avoid some glitches.
+
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+int mkstemp_safer (char *);
+
+#if GNULIB_MKOSTEMP
+int mkostemp_safer (char *, int);
+#endif
+
+#if GNULIB_MKOSTEMPS
+int mkostemps_safer (char *, int, int);
+#endif
+
+#if GNULIB_MKSTEMPS
+int mkstemps_safer (char *, int);
+#endif
deleted file mode 120000 (symlink)
index fca12aeb96151a21580bf81c9713f89332f330e4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stdlib.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b901d175aebf33b759951287162b4eea90519832
--- /dev/null
+/* A GNU-like <stdlib.h>.
+
+   Copyright (C) 1995, 2001-2004, 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
+/* Special invocation conventions inside some gnulib header files,
+   and inside some glibc header files, respectively.  */
+
+#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_STDLIB_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
+
+#ifndef _@GUARD_PREFIX@_STDLIB_H
+#define _@GUARD_PREFIX@_STDLIB_H
+
+/* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
+   _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
+   HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
+
+/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.  */
+#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
+# include <sys/wait.h>
+#endif
+
+/* Solaris declares getloadavg() in <sys/loadavg.h>.  */
+#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
+/* OpenIndiana has a bug: <sys/time.h> must be included before
+   <sys/loadavg.h>.  */
+# include <sys/time.h>
+# include <sys/loadavg.h>
+#endif
+
+/* Native Windows platforms declare _mktemp() in <io.h>.  */
+#if defined _WIN32 && !defined __CYGWIN__
+# include <io.h>
+#endif
+
+#if @GNULIB_RANDOM_R@
+
+/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
+   from <stdlib.h> if _REENTRANT is defined.  Include it whenever we need
+   'struct random_data'.  */
+# if @HAVE_RANDOM_H@
+#  include <random.h>
+# endif
+
+# include <stdint.h>
+
+# if !@HAVE_STRUCT_RANDOM_DATA@
+/* Define 'struct random_data'.
+   But allow multiple gnulib generated <stdlib.h> replacements to coexist.  */
+#  if !GNULIB_defined_struct_random_data
+struct random_data
+{
+  int32_t *fptr;                /* Front pointer.  */
+  int32_t *rptr;                /* Rear pointer.  */
+  int32_t *state;               /* Array of state values.  */
+  int rand_type;                /* Type of random number generator.  */
+  int rand_deg;                 /* Degree of random number generator.  */
+  int rand_sep;                 /* Distance between front and rear.  */
+  int32_t *end_ptr;             /* Pointer behind state table.  */
+};
+#   define GNULIB_defined_struct_random_data 1
+#  endif
+# endif
+#endif
+
+#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
+/* On Mac OS X 10.3, only <unistd.h> declares mkstemp.  */
+/* On Mac OS X 10.5, only <unistd.h> declares mkstemps.  */
+/* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps.  */
+/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
+/* But avoid namespace pollution on glibc systems and native Windows.  */
+# include <unistd.h>
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
+   that can be freed by passing them as the Ith argument to the
+   function F.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# if __GNUC__ >= 11
+#  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+# else
+#  define _GL_ATTRIBUTE_DEALLOC(f, i)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+   can be freed via 'free'; it can be used only after declaring 'free'.  */
+/* Applies to: functions.  Cannot be used on inline functions.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
+# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
+#endif
+
+/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
+   allocated memory.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if __GNUC__ >= 3 || defined __clang__
+#  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define _GL_ATTRIBUTE_MALLOC
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
+ */
+#ifndef _GL_ATTRIBUTE_NOTHROW
+# if defined __cplusplus
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#   if __cplusplus >= 201103L
+#    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
+#   else
+#    define _GL_ATTRIBUTE_NOTHROW throw ()
+#   endif
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# else
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
+#   define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# endif
+#endif
+
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __pure__ was added in gcc 2.96.  */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
+/* The definition of _Noreturn is copied here.  */
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+#endif
+/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
+   with proper operation of xargs.  */
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#elif EXIT_FAILURE != 1
+# undef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+
+#if @GNULIB__EXIT@
+/* Terminate the current process with the given return code, without running
+   the 'atexit' handlers.  */
+# if @REPLACE__EXIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef _Exit
+#   define _Exit rpl__Exit
+#  endif
+_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status));
+_GL_CXXALIAS_RPL (_Exit, void, (int status));
+# else
+#  if !@HAVE__EXIT@
+_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
+#  endif
+_GL_CXXALIAS_SYS (_Exit, void, (int status));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (_Exit);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef _Exit
+# if HAVE_RAW_DECL__EXIT
+_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
+                 "use gnulib module _Exit for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FREE_POSIX@
+# if @REPLACE_FREE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef free
+#   define free rpl_free
+#  endif
+#  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW);
+#  else
+_GL_FUNCDECL_RPL (free, void, (void *ptr));
+#  endif
+_GL_CXXALIAS_RPL (free, void, (void *ptr));
+# else
+_GL_CXXALIAS_SYS (free, void, (void *ptr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (free);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef free
+/* Assume free is always declared.  */
+_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
+                 "use gnulib module free for portability");
+#endif
+
+
+/* Allocate memory with indefinite extent and specified alignment.  */
+#if @GNULIB_ALIGNED_ALLOC@
+# if @REPLACE_ALIGNED_ALLOC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef aligned_alloc
+#   define aligned_alloc rpl_aligned_alloc
+#  endif
+_GL_FUNCDECL_RPL (aligned_alloc, void *,
+                  (size_t alignment, size_t size)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
+# else
+#  if @HAVE_ALIGNED_ALLOC@
+#   if __GNUC__ >= 11
+/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free.  */
+#    if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
+_GL_FUNCDECL_SYS (aligned_alloc, void *,
+                  (size_t alignment, size_t size)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#    else
+_GL_FUNCDECL_SYS (aligned_alloc, void *,
+                  (size_t alignment, size_t size)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#    endif
+#   endif
+_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
+#  endif
+# endif
+# if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@
+_GL_CXXALIASWARN (aligned_alloc);
+# endif
+#else
+# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc
+/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free.  */
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
+_GL_FUNCDECL_SYS (aligned_alloc, void *,
+                  (size_t alignment, size_t size)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  else
+_GL_FUNCDECL_SYS (aligned_alloc, void *,
+                  (size_t alignment, size_t size)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef aligned_alloc
+#  if HAVE_RAW_DECL_ALIGNED_ALLOC
+_GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
+                 "use gnulib module aligned_alloc for portability");
+#  endif
+# endif
+#endif
+
+#if @GNULIB_ATOLL@
+/* Parse a signed decimal integer.
+   Returns the value of the integer.  Errors are not detected.  */
+# if !@HAVE_ATOLL@
+_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
+                                    _GL_ATTRIBUTE_PURE
+                                    _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
+_GL_CXXALIASWARN (atoll);
+#elif defined GNULIB_POSIXCHECK
+# undef atoll
+# if HAVE_RAW_DECL_ATOLL
+_GL_WARN_ON_USE (atoll, "atoll is unportable - "
+                 "use gnulib module atoll for portability");
+# endif
+#endif
+
+#if @GNULIB_CALLOC_POSIX@
+# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
+     || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef calloc
+#   define calloc rpl_calloc
+#  endif
+_GL_FUNCDECL_RPL (calloc, void *,
+                  (size_t nmemb, size_t size)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
+# else
+#  if __GNUC__ >= 11
+/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free.  */
+#   if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
+_GL_FUNCDECL_SYS (calloc, void *,
+                  (size_t nmemb, size_t size)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   else
+_GL_FUNCDECL_SYS (calloc, void *,
+                  (size_t nmemb, size_t size)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (calloc);
+# endif
+#else
+# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc
+/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free.  */
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
+_GL_FUNCDECL_SYS (calloc, void *,
+                  (size_t nmemb, size_t size)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  else
+_GL_FUNCDECL_SYS (calloc, void *,
+                  (size_t nmemb, size_t size)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef calloc
+/* Assume calloc is always declared.  */
+_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
+                 "use gnulib module calloc-posix for portability");
+# endif
+#endif
+
+#if @GNULIB_CANONICALIZE_FILE_NAME@
+# if @REPLACE_CANONICALIZE_FILE_NAME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define canonicalize_file_name rpl_canonicalize_file_name
+#  endif
+_GL_FUNCDECL_RPL (canonicalize_file_name, char *,
+                  (const char *name)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
+# else
+#  if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
+#   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
+                  (const char *name)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   else
+_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
+                  (const char *name)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
+# endif
+# ifndef GNULIB_defined_canonicalize_file_name
+#  define GNULIB_defined_canonicalize_file_name \
+     (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
+# endif
+_GL_CXXALIASWARN (canonicalize_file_name);
+#else
+# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
+/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
+   rpl_free.  */
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
+                  (const char *name)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  else
+_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
+                  (const char *name)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef canonicalize_file_name
+#  if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
+_GL_WARN_ON_USE (canonicalize_file_name,
+                 "canonicalize_file_name is unportable - "
+                 "use gnulib module canonicalize-lgpl for portability");
+#  endif
+# endif
+#endif
+
+#if @GNULIB_MDA_ECVT@
+/* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
+   it.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ecvt
+#   define ecvt _ecvt
+#  endif
+_GL_CXXALIAS_MDA (ecvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+# else
+#  if @HAVE_DECL_ECVT@
+_GL_CXXALIAS_SYS (ecvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+#  endif
+# endif
+# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
+_GL_CXXALIASWARN (ecvt);
+# endif
+#endif
+
+#if @GNULIB_MDA_FCVT@
+/* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
+   it.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fcvt
+#   define fcvt _fcvt
+#  endif
+_GL_CXXALIAS_MDA (fcvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+# else
+#  if @HAVE_DECL_FCVT@
+_GL_CXXALIAS_SYS (fcvt, char *,
+                  (double number, int ndigits, int *decptp, int *signp));
+#  endif
+# endif
+# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
+_GL_CXXALIASWARN (fcvt);
+# endif
+#endif
+
+#if @GNULIB_MDA_GCVT@
+/* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
+   it.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gcvt
+#   define gcvt _gcvt
+#  endif
+_GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
+# else
+#  if @HAVE_DECL_GCVT@
+_GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
+#  endif
+# endif
+# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
+_GL_CXXALIASWARN (gcvt);
+# endif
+#endif
+
+#if @GNULIB_GETLOADAVG@
+/* Store max(NELEM,3) load average numbers in LOADAVG[].
+   The three numbers are the load average of the last 1 minute, the last 5
+   minutes, and the last 15 minutes, respectively.
+   LOADAVG is an array of NELEM numbers.  */
+# if @REPLACE_GETLOADAVG@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getloadavg
+#   define getloadavg rpl_getloadavg
+#  endif
+_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem)
+                                   _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
+# else
+#  if !@HAVE_DECL_GETLOADAVG@
+_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
+                                   _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getloadavg);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getloadavg
+# if HAVE_RAW_DECL_GETLOADAVG
+_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
+                 "use gnulib module getloadavg for portability");
+# endif
+#endif
+
+#if @GNULIB_GETPROGNAME@
+/* Return the base name of the executing program.
+   On native Windows this will usually end in ".exe" or ".EXE". */
+# if @REPLACE_GETPROGNAME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getprogname
+#   define getprogname rpl_getprogname
+#  endif
+#  if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
+_GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
+#  else
+_GL_FUNCDECL_RPL (getprogname, const char *, (void));
+#  endif
+_GL_CXXALIAS_RPL (getprogname, const char *, (void));
+# else
+#  if !@HAVE_GETPROGNAME@
+#   if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
+_GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
+#   else
+_GL_FUNCDECL_SYS (getprogname, const char *, (void));
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (getprogname, const char *, (void));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getprogname);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getprogname
+# if HAVE_RAW_DECL_GETPROGNAME
+_GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
+                 "use gnulib module getprogname for portability");
+# endif
+#endif
+
+#if @GNULIB_GETSUBOPT@
+/* Assuming *OPTIONP is a comma separated list of elements of the form
+   "token" or "token=value", getsubopt parses the first of these elements.
+   If the first element refers to a "token" that is member of the given
+   NULL-terminated array of tokens:
+     - It replaces the comma with a NUL byte, updates *OPTIONP to point past
+       the first option and the comma, sets *VALUEP to the value of the
+       element (or NULL if it doesn't contain an "=" sign),
+     - It returns the index of the "token" in the given array of tokens.
+   Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
+   For more details see the POSIX specification.
+   https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
+# if @REPLACE_GETSUBOPT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getsubopt
+#   define getsubopt rpl_getsubopt
+#  endif
+_GL_FUNCDECL_RPL (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+_GL_CXXALIAS_RPL (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep));
+# else
+#  if !@HAVE_GETSUBOPT@
+_GL_FUNCDECL_SYS (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getsubopt);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getsubopt
+# if HAVE_RAW_DECL_GETSUBOPT
+_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
+                 "use gnulib module getsubopt for portability");
+# endif
+#endif
+
+#if @GNULIB_GRANTPT@
+/* Change the ownership and access permission of the slave side of the
+   pseudo-terminal whose master side is specified by FD.  */
+# if !@HAVE_GRANTPT@
+_GL_FUNCDECL_SYS (grantpt, int, (int fd));
+# endif
+_GL_CXXALIAS_SYS (grantpt, int, (int fd));
+_GL_CXXALIASWARN (grantpt);
+#elif defined GNULIB_POSIXCHECK
+# undef grantpt
+# if HAVE_RAW_DECL_GRANTPT
+_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
+                 "use gnulib module grantpt for portability");
+# endif
+#endif
+
+/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
+   rely on GNU or POSIX semantics for malloc and realloc (for example,
+   by never specifying a zero size), so it does not need malloc or
+   realloc to be redefined.  */
+#if @GNULIB_MALLOC_POSIX@
+# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
+     || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
+#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
+        || _GL_USE_STDLIB_ALLOC)
+#   undef malloc
+#   define malloc rpl_malloc
+#  endif
+_GL_FUNCDECL_RPL (malloc, void *,
+                  (size_t size)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
+# else
+#  if __GNUC__ >= 11
+/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free.  */
+#   if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
+_GL_FUNCDECL_SYS (malloc, void *,
+                  (size_t size)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   else
+_GL_FUNCDECL_SYS (malloc, void *,
+                  (size_t size)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (malloc);
+# endif
+#else
+# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc
+/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free.  */
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
+_GL_FUNCDECL_SYS (malloc, void *,
+                  (size_t size)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  else
+_GL_FUNCDECL_SYS (malloc, void *,
+                  (size_t size)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
+#  undef malloc
+/* Assume malloc is always declared.  */
+_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
+                 "use gnulib module malloc-posix for portability");
+# endif
+#endif
+
+/* Return maximum number of bytes of a multibyte character.  */
+#if @REPLACE_MB_CUR_MAX@
+# if !GNULIB_defined_MB_CUR_MAX
+static inline
+int gl_MB_CUR_MAX (void)
+{
+  /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding.  */
+  return MB_CUR_MAX + (MB_CUR_MAX == 3);
+}
+#  undef MB_CUR_MAX
+#  define MB_CUR_MAX gl_MB_CUR_MAX ()
+#  define GNULIB_defined_MB_CUR_MAX 1
+# endif
+#endif
+
+/* Convert a string to a wide string.  */
+#if @GNULIB_MBSTOWCS@
+# if @REPLACE_MBSTOWCS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbstowcs
+#   define mbstowcs rpl_mbstowcs
+#  endif
+_GL_FUNCDECL_RPL (mbstowcs, size_t,
+                  (wchar_t *restrict dest, const char *restrict src,
+                   size_t len)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (mbstowcs, size_t,
+                  (wchar_t *restrict dest, const char *restrict src,
+                   size_t len));
+# else
+_GL_CXXALIAS_SYS (mbstowcs, size_t,
+                  (wchar_t *restrict dest, const char *restrict src,
+                   size_t len));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mbstowcs);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbstowcs
+# if HAVE_RAW_DECL_MBSTOWCS
+_GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
+                 "use gnulib module mbstowcs for portability");
+# endif
+#endif
+
+/* Convert a multibyte character to a wide character.  */
+#if @GNULIB_MBTOWC@
+# if @REPLACE_MBTOWC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbtowc
+#   define mbtowc rpl_mbtowc
+#  endif
+_GL_FUNCDECL_RPL (mbtowc, int,
+                  (wchar_t *restrict pwc, const char *restrict s, size_t n));
+_GL_CXXALIAS_RPL (mbtowc, int,
+                  (wchar_t *restrict pwc, const char *restrict s, size_t n));
+# else
+#  if !@HAVE_MBTOWC@
+_GL_FUNCDECL_SYS (mbtowc, int,
+                  (wchar_t *restrict pwc, const char *restrict s, size_t n));
+#  endif
+_GL_CXXALIAS_SYS (mbtowc, int,
+                  (wchar_t *restrict pwc, const char *restrict s, size_t n));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mbtowc);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbtowc
+# if HAVE_RAW_DECL_MBTOWC
+_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
+                 "use gnulib module mbtowc for portability");
+# endif
+#endif
+
+#if @GNULIB_MKDTEMP@
+/* Create a unique temporary directory from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the directory name unique.
+   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
+   The directory is created mode 700.  */
+# if !@HAVE_MKDTEMP@
+_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
+_GL_CXXALIASWARN (mkdtemp);
+#elif defined GNULIB_POSIXCHECK
+# undef mkdtemp
+# if HAVE_RAW_DECL_MKDTEMP
+_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
+                 "use gnulib module mkdtemp for portability");
+# endif
+#endif
+
+#if @GNULIB_MKOSTEMP@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   The file is then created, with the specified flags, ensuring it didn't exist
+   before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+# if @REPLACE_MKOSTEMP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mkostemp
+#   define mkostemp rpl_mkostemp
+#  endif
+_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)
+                                 _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/));
+# else
+#  if !@HAVE_MKOSTEMP@
+_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
+                                 _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mkostemp);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkostemp
+# if HAVE_RAW_DECL_MKOSTEMP
+_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
+                 "use gnulib module mkostemp for portability");
+# endif
+#endif
+
+#if @GNULIB_MKOSTEMPS@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE before a suffix of length
+   SUFFIXLEN must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   The file is then created, with the specified flags, ensuring it didn't exist
+   before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+# if @REPLACE_MKOSTEMPS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mkostemps
+#   define mkostemps rpl_mkostemps
+#  endif
+_GL_FUNCDECL_RPL (mkostemps, int,
+                  (char * /*template*/, int /*suffixlen*/, int /*flags*/)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mkostemps, int,
+                  (char * /*template*/, int /*suffixlen*/, int /*flags*/));
+# else
+#  if !@HAVE_MKOSTEMPS@
+_GL_FUNCDECL_SYS (mkostemps, int,
+                  (char * /*template*/, int /*suffixlen*/, int /*flags*/)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (mkostemps, int,
+                  (char * /*template*/, int /*suffixlen*/, int /*flags*/));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mkostemps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkostemps
+# if HAVE_RAW_DECL_MKOSTEMPS
+_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
+                 "use gnulib module mkostemps for portability");
+# endif
+#endif
+
+#if @GNULIB_MKSTEMP@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The file is then created, ensuring it didn't exist before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+# if @REPLACE_MKSTEMP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mkstemp rpl_mkstemp
+#  endif
+_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
+# else
+#  if ! @HAVE_MKSTEMP@
+_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
+# endif
+_GL_CXXALIASWARN (mkstemp);
+#elif defined GNULIB_POSIXCHECK
+# undef mkstemp
+# if HAVE_RAW_DECL_MKSTEMP
+_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
+                 "use gnulib module mkstemp for portability");
+# endif
+#endif
+
+#if @GNULIB_MKSTEMPS@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE prior to a suffix of length
+   SUFFIXLEN must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The file is then created, ensuring it didn't exist before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+# if !@HAVE_MKSTEMPS@
+_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
+                                 _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
+_GL_CXXALIASWARN (mkstemps);
+#elif defined GNULIB_POSIXCHECK
+# undef mkstemps
+# if HAVE_RAW_DECL_MKSTEMPS
+_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
+                 "use gnulib module mkstemps for portability");
+# endif
+#endif
+
+#if @GNULIB_MDA_MKTEMP@
+/* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::mktemp always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mktemp
+#   define mktemp _mktemp
+#  endif
+_GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
+# else
+_GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
+# endif
+_GL_CXXALIASWARN (mktemp);
+#endif
+
+/* Allocate memory with indefinite extent and specified alignment.  */
+#if @GNULIB_POSIX_MEMALIGN@
+# if @REPLACE_POSIX_MEMALIGN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef posix_memalign
+#   define posix_memalign rpl_posix_memalign
+#  endif
+_GL_FUNCDECL_RPL (posix_memalign, int,
+                  (void **memptr, size_t alignment, size_t size)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (posix_memalign, int,
+                  (void **memptr, size_t alignment, size_t size));
+# else
+#  if @HAVE_POSIX_MEMALIGN@
+_GL_CXXALIAS_SYS (posix_memalign, int,
+                  (void **memptr, size_t alignment, size_t size));
+#  endif
+# endif
+# if __GLIBC__ >= 2 && @HAVE_POSIX_MEMALIGN@
+_GL_CXXALIASWARN (posix_memalign);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_memalign
+# if HAVE_RAW_DECL_POSIX_MEMALIGN
+_GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
+                 "use gnulib module posix_memalign for portability");
+# endif
+#endif
+
+#if @GNULIB_POSIX_OPENPT@
+/* Return an FD open to the master side of a pseudo-terminal.  Flags should
+   include O_RDWR, and may also include O_NOCTTY.  */
+# if @REPLACE_POSIX_OPENPT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef posix_openpt
+#   define posix_openpt rpl_posix_openpt
+#  endif
+_GL_FUNCDECL_RPL (posix_openpt, int, (int flags));
+_GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
+# else
+#  if !@HAVE_POSIX_OPENPT@
+_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
+#  endif
+_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (posix_openpt);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_openpt
+# if HAVE_RAW_DECL_POSIX_OPENPT
+_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
+                 "use gnulib module posix_openpt for portability");
+# endif
+#endif
+
+#if @GNULIB_PTSNAME@
+/* Return the pathname of the pseudo-terminal slave associated with
+   the master FD is open on, or NULL on errors.  */
+# if @REPLACE_PTSNAME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ptsname
+#   define ptsname rpl_ptsname
+#  endif
+_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
+_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
+# else
+#  if !@HAVE_PTSNAME@
+_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
+#  endif
+_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
+# endif
+_GL_CXXALIASWARN (ptsname);
+#elif defined GNULIB_POSIXCHECK
+# undef ptsname
+# if HAVE_RAW_DECL_PTSNAME
+_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
+                 "use gnulib module ptsname for portability");
+# endif
+#endif
+
+#if @GNULIB_PTSNAME_R@
+/* Set the pathname of the pseudo-terminal slave associated with
+   the master FD is open on and return 0, or set errno and return
+   non-zero on errors.  */
+# if @REPLACE_PTSNAME_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ptsname_r
+#   define ptsname_r rpl_ptsname_r
+#  endif
+_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+# else
+#  if !@HAVE_PTSNAME_R@
+_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
+#  endif
+_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
+# endif
+# ifndef GNULIB_defined_ptsname_r
+#  define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
+# endif
+_GL_CXXALIASWARN (ptsname_r);
+#elif defined GNULIB_POSIXCHECK
+# undef ptsname_r
+# if HAVE_RAW_DECL_PTSNAME_R
+_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
+                 "use gnulib module ptsname_r for portability");
+# endif
+#endif
+
+#if @GNULIB_PUTENV@
+# if @REPLACE_PUTENV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putenv
+#   define putenv rpl_putenv
+#  endif
+_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (putenv, int, (char *string));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putenv
+#   define putenv _putenv
+#  endif
+_GL_CXXALIAS_MDA (putenv, int, (char *string));
+# elif defined __KLIBC__
+/* Need to cast, because on OS/2 kLIBC, the first parameter is
+                                     const char *string.  */
+_GL_CXXALIAS_SYS_CAST (putenv, int, (char *string));
+# else
+_GL_CXXALIAS_SYS (putenv, int, (char *string));
+# endif
+_GL_CXXALIASWARN (putenv);
+#elif @GNULIB_MDA_PUTENV@
+/* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::putenv always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putenv
+#   define putenv _putenv
+#  endif
+/* Need to cast, because on mingw, the parameter is either
+   'const char *string' or 'char *string'.  */
+_GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
+# elif defined __KLIBC__
+/* Need to cast, because on OS/2 kLIBC, the first parameter is
+                                     const char *string.  */
+_GL_CXXALIAS_SYS_CAST (putenv, int, (char *string));
+# else
+_GL_CXXALIAS_SYS (putenv, int, (char *string));
+# endif
+_GL_CXXALIASWARN (putenv);
+#endif
+
+#if @GNULIB_QSORT_R@
+/* Sort an array of NMEMB elements, starting at address BASE, each element
+   occupying SIZE bytes, in ascending order according to the comparison
+   function COMPARE.  */
+# ifdef __cplusplus
+extern "C" {
+# endif
+# if !GNULIB_defined_qsort_r_fn_types
+typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
+#  define GNULIB_defined_qsort_r_fn_types 1
+# endif
+# ifdef __cplusplus
+}
+# endif
+# if @REPLACE_QSORT_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef qsort_r
+#   define qsort_r rpl_qsort_r
+#  endif
+_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
+                                  _gl_qsort_r_compar_fn compare,
+                                  void *arg) _GL_ARG_NONNULL ((1, 4)));
+_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
+                                  _gl_qsort_r_compar_fn compare,
+                                  void *arg));
+# else
+#  if !@HAVE_QSORT_R@
+_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
+                                  _gl_qsort_r_compar_fn compare,
+                                  void *arg) _GL_ARG_NONNULL ((1, 4)));
+#  endif
+_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
+                                  _gl_qsort_r_compar_fn compare,
+                                  void *arg));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (qsort_r);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef qsort_r
+# if HAVE_RAW_DECL_QSORT_R
+_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
+                 "use gnulib module qsort_r for portability");
+# endif
+#endif
+
+
+#if @GNULIB_RAND@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@)
+# ifndef RAND_MAX
+#  define RAND_MAX 2147483647
+# endif
+#endif
+
+
+#if @GNULIB_RAND@
+# if @REPLACE_RAND@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rand
+#   define rand rpl_rand
+#  endif
+_GL_FUNCDECL_RPL (rand, int, (void));
+_GL_CXXALIAS_RPL (rand, int, (void));
+# else
+_GL_CXXALIAS_SYS (rand, int, (void));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (rand);
+# endif
+#endif
+
+
+#if @GNULIB_RANDOM@
+# if @REPLACE_RANDOM@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef random
+#   define random rpl_random
+#  endif
+_GL_FUNCDECL_RPL (random, long, (void));
+_GL_CXXALIAS_RPL (random, long, (void));
+# else
+#  if !@HAVE_RANDOM@
+_GL_FUNCDECL_SYS (random, long, (void));
+#  endif
+/* Need to cast, because on Haiku, the return type is
+                               int.  */
+_GL_CXXALIAS_SYS_CAST (random, long, (void));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (random);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef random
+# if HAVE_RAW_DECL_RANDOM
+_GL_WARN_ON_USE (random, "random is unportable - "
+                 "use gnulib module random for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM@
+# if @REPLACE_RANDOM@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef srandom
+#   define srandom rpl_srandom
+#  endif
+_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
+_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
+# else
+#  if !@HAVE_RANDOM@
+_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
+#  endif
+/* Need to cast, because on FreeBSD, the first parameter is
+                                       unsigned long seed.  */
+_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (srandom);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef srandom
+# if HAVE_RAW_DECL_SRANDOM
+_GL_WARN_ON_USE (srandom, "srandom is unportable - "
+                 "use gnulib module random for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM@
+# if @REPLACE_INITSTATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef initstate
+#   define initstate rpl_initstate
+#  endif
+_GL_FUNCDECL_RPL (initstate, char *,
+                  (unsigned int seed, char *buf, size_t buf_size)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (initstate, char *,
+                  (unsigned int seed, char *buf, size_t buf_size));
+# else
+#  if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
+_GL_FUNCDECL_SYS (initstate, char *,
+                  (unsigned int seed, char *buf, size_t buf_size)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+/* Need to cast, because on FreeBSD, the first parameter is
+                        unsigned long seed.  */
+_GL_CXXALIAS_SYS_CAST (initstate, char *,
+                       (unsigned int seed, char *buf, size_t buf_size));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (initstate);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef initstate
+# if HAVE_RAW_DECL_INITSTATE
+_GL_WARN_ON_USE (initstate, "initstate is unportable - "
+                 "use gnulib module random for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM@
+# if @REPLACE_SETSTATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setstate
+#   define setstate rpl_setstate
+#  endif
+_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
+# else
+#  if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
+_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
+#  endif
+/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
+   is                                     const char *arg_state.  */
+_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (setstate);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef setstate
+# if HAVE_RAW_DECL_SETSTATE
+_GL_WARN_ON_USE (setstate, "setstate is unportable - "
+                 "use gnulib module random for portability");
+# endif
+#endif
+
+
+#if @GNULIB_RANDOM_R@
+# if @REPLACE_RANDOM_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef random_r
+#   define random_r rpl_random_r
+#  endif
+_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
+                                 _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
+# else
+#  if !@HAVE_RANDOM_R@
+_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
+                                 _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
+# endif
+_GL_CXXALIASWARN (random_r);
+#elif defined GNULIB_POSIXCHECK
+# undef random_r
+# if HAVE_RAW_DECL_RANDOM_R
+_GL_WARN_ON_USE (random_r, "random_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if @REPLACE_RANDOM_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef srandom_r
+#   define srandom_r rpl_srandom_r
+#  endif
+_GL_FUNCDECL_RPL (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state));
+# else
+#  if !@HAVE_RANDOM_R@
+_GL_FUNCDECL_SYS (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state));
+# endif
+_GL_CXXALIASWARN (srandom_r);
+#elif defined GNULIB_POSIXCHECK
+# undef srandom_r
+# if HAVE_RAW_DECL_SRANDOM_R
+_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if @REPLACE_RANDOM_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef initstate_r
+#   define initstate_r rpl_initstate_r
+#  endif
+_GL_FUNCDECL_RPL (initstate_r, int,
+                  (unsigned int seed, char *buf, size_t buf_size,
+                   struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2, 4)));
+_GL_CXXALIAS_RPL (initstate_r, int,
+                  (unsigned int seed, char *buf, size_t buf_size,
+                   struct random_data *rand_state));
+# else
+#  if !@HAVE_RANDOM_R@
+_GL_FUNCDECL_SYS (initstate_r, int,
+                  (unsigned int seed, char *buf, size_t buf_size,
+                   struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2, 4)));
+#  endif
+/* Need to cast, because on Haiku, the third parameter is
+                                                     unsigned long buf_size.  */
+_GL_CXXALIAS_SYS_CAST (initstate_r, int,
+                       (unsigned int seed, char *buf, size_t buf_size,
+                        struct random_data *rand_state));
+# endif
+_GL_CXXALIASWARN (initstate_r);
+#elif defined GNULIB_POSIXCHECK
+# undef initstate_r
+# if HAVE_RAW_DECL_INITSTATE_R
+_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if @REPLACE_RANDOM_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setstate_r
+#   define setstate_r rpl_setstate_r
+#  endif
+_GL_FUNCDECL_RPL (setstate_r, int,
+                  (char *arg_state, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (setstate_r, int,
+                  (char *arg_state, struct random_data *rand_state));
+# else
+#  if !@HAVE_RANDOM_R@
+_GL_FUNCDECL_SYS (setstate_r, int,
+                  (char *arg_state, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+/* Need to cast, because on Haiku, the first parameter is
+                        void *arg_state.  */
+_GL_CXXALIAS_SYS_CAST (setstate_r, int,
+                       (char *arg_state, struct random_data *rand_state));
+# endif
+_GL_CXXALIASWARN (setstate_r);
+#elif defined GNULIB_POSIXCHECK
+# undef setstate_r
+# if HAVE_RAW_DECL_SETSTATE_R
+_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+
+#if @GNULIB_REALLOC_POSIX@
+# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
+     || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
+#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
+        || _GL_USE_STDLIB_ALLOC)
+#   undef realloc
+#   define realloc rpl_realloc
+#  endif
+_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
+                                   _GL_ATTRIBUTE_DEALLOC_FREE);
+_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
+# else
+#  if __GNUC__ >= 11
+/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free.  */
+#   if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
+_GL_FUNCDECL_SYS (realloc, void *,
+                  (void *ptr, size_t size)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_DEALLOC_FREE);
+#   else
+_GL_FUNCDECL_SYS (realloc, void *,
+                  (void *ptr, size_t size)
+                  _GL_ATTRIBUTE_DEALLOC_FREE);
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (realloc);
+# endif
+#else
+# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
+/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free.  */
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
+_GL_FUNCDECL_SYS (realloc, void *,
+                  (void *ptr, size_t size)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_DEALLOC_FREE);
+#  else
+_GL_FUNCDECL_SYS (realloc, void *,
+                  (void *ptr, size_t size)
+                  _GL_ATTRIBUTE_DEALLOC_FREE);
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
+#  undef realloc
+/* Assume realloc is always declared.  */
+_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
+                 "use gnulib module realloc-posix for portability");
+# endif
+#endif
+
+
+#if @GNULIB_REALLOCARRAY@
+# if @REPLACE_REALLOCARRAY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef reallocarray
+#   define reallocarray rpl_reallocarray
+#  endif
+_GL_FUNCDECL_RPL (reallocarray, void *,
+                  (void *ptr, size_t nmemb, size_t size));
+_GL_CXXALIAS_RPL (reallocarray, void *,
+                  (void *ptr, size_t nmemb, size_t size));
+# else
+#  if ! @HAVE_REALLOCARRAY@
+_GL_FUNCDECL_SYS (reallocarray, void *,
+                  (void *ptr, size_t nmemb, size_t size));
+#  endif
+_GL_CXXALIAS_SYS (reallocarray, void *,
+                  (void *ptr, size_t nmemb, size_t size));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (reallocarray);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef reallocarray
+# if HAVE_RAW_DECL_REALLOCARRAY
+_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
+                 "use gnulib module reallocarray for portability");
+# endif
+#endif
+
+#if @GNULIB_REALPATH@
+# if @REPLACE_REALPATH@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define realpath rpl_realpath
+#  endif
+_GL_FUNCDECL_RPL (realpath, char *,
+                  (const char *restrict name, char *restrict resolved)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (realpath, char *,
+                  (const char *restrict name, char *restrict resolved));
+# else
+#  if !@HAVE_REALPATH@
+_GL_FUNCDECL_SYS (realpath, char *,
+                  (const char *restrict name, char *restrict resolved)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (realpath, char *,
+                  (const char *restrict name, char *restrict resolved));
+# endif
+_GL_CXXALIASWARN (realpath);
+#elif defined GNULIB_POSIXCHECK
+# undef realpath
+# if HAVE_RAW_DECL_REALPATH
+_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
+                 "canonicalize or canonicalize-lgpl for portability");
+# endif
+#endif
+
+#if @GNULIB_RPMATCH@
+/* Test a user response to a question.
+   Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
+# if !@HAVE_RPMATCH@
+_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
+_GL_CXXALIASWARN (rpmatch);
+#elif defined GNULIB_POSIXCHECK
+# undef rpmatch
+# if HAVE_RAW_DECL_RPMATCH
+_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
+                 "use gnulib module rpmatch for portability");
+# endif
+#endif
+
+#if @GNULIB_SECURE_GETENV@
+/* Look up NAME in the environment, returning 0 in insecure situations.  */
+# if !@HAVE_SECURE_GETENV@
+_GL_FUNCDECL_SYS (secure_getenv, char *,
+                  (char const *name) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
+_GL_CXXALIASWARN (secure_getenv);
+#elif defined GNULIB_POSIXCHECK
+# undef secure_getenv
+# if HAVE_RAW_DECL_SECURE_GETENV
+_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
+                 "use gnulib module secure_getenv for portability");
+# endif
+#endif
+
+#if @GNULIB_SETENV@
+/* Set NAME to VALUE in the environment.
+   If REPLACE is nonzero, overwrite an existing value.  */
+# if @REPLACE_SETENV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setenv
+#   define setenv rpl_setenv
+#  endif
+_GL_FUNCDECL_RPL (setenv, int,
+                  (const char *name, const char *value, int replace)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (setenv, int,
+                  (const char *name, const char *value, int replace));
+# else
+#  if !@HAVE_DECL_SETENV@
+_GL_FUNCDECL_SYS (setenv, int,
+                  (const char *name, const char *value, int replace)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (setenv, int,
+                  (const char *name, const char *value, int replace));
+# endif
+# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
+_GL_CXXALIASWARN (setenv);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef setenv
+# if HAVE_RAW_DECL_SETENV
+_GL_WARN_ON_USE (setenv, "setenv is unportable - "
+                 "use gnulib module setenv for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOD@
+ /* Parse a double from STRING, updating ENDP if appropriate.  */
+# if @REPLACE_STRTOD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strtod rpl_strtod
+#  endif
+#  define GNULIB_defined_strtod_function 1
+_GL_FUNCDECL_RPL (strtod, double,
+                  (const char *restrict str, char **restrict endp)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtod, double,
+                  (const char *restrict str, char **restrict endp));
+# else
+#  if !@HAVE_STRTOD@
+_GL_FUNCDECL_SYS (strtod, double,
+                  (const char *restrict str, char **restrict endp)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtod, double,
+                  (const char *restrict str, char **restrict endp));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (strtod);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtod
+# if HAVE_RAW_DECL_STRTOD
+_GL_WARN_ON_USE (strtod, "strtod is unportable - "
+                 "use gnulib module strtod for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOLD@
+ /* Parse a 'long double' from STRING, updating ENDP if appropriate.  */
+# if @REPLACE_STRTOLD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strtold rpl_strtold
+#  endif
+#  define GNULIB_defined_strtold_function 1
+_GL_FUNCDECL_RPL (strtold, long double,
+                  (const char *restrict str, char **restrict endp)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtold, long double,
+                  (const char *restrict str, char **restrict endp));
+# else
+#  if !@HAVE_STRTOLD@
+_GL_FUNCDECL_SYS (strtold, long double,
+                  (const char *restrict str, char **restrict endp)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtold, long double,
+                  (const char *restrict str, char **restrict endp));
+# endif
+_GL_CXXALIASWARN (strtold);
+#elif defined GNULIB_POSIXCHECK
+# undef strtold
+# if HAVE_RAW_DECL_STRTOLD
+_GL_WARN_ON_USE (strtold, "strtold is unportable - "
+                 "use gnulib module strtold for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOL@
+/* Parse a signed integer whose textual representation starts at STRING.
+   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
+   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
+   "0x").
+   If ENDPTR is not NULL, the address of the first byte after the integer is
+   stored in *ENDPTR.
+   Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
+   to ERANGE.  */
+# if @REPLACE_STRTOL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strtol rpl_strtol
+#  endif
+#  define GNULIB_defined_strtol_function 1
+_GL_FUNCDECL_RPL (strtol, long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtol, long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base));
+# else
+#  if !@HAVE_STRTOL@
+_GL_FUNCDECL_SYS (strtol, long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtol, long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (strtol);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtol
+# if HAVE_RAW_DECL_STRTOL
+_GL_WARN_ON_USE (strtol, "strtol is unportable - "
+                 "use gnulib module strtol for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOLL@
+/* Parse a signed integer whose textual representation starts at STRING.
+   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
+   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
+   "0x").
+   If ENDPTR is not NULL, the address of the first byte after the integer is
+   stored in *ENDPTR.
+   Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
+   to ERANGE.  */
+# if @REPLACE_STRTOLL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strtoll rpl_strtoll
+#  endif
+#  define GNULIB_defined_strtoll_function 1
+_GL_FUNCDECL_RPL (strtoll, long long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoll, long long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base));
+# else
+#  if !@HAVE_STRTOLL@
+_GL_FUNCDECL_SYS (strtoll, long long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtoll, long long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base));
+# endif
+_GL_CXXALIASWARN (strtoll);
+#elif defined GNULIB_POSIXCHECK
+# undef strtoll
+# if HAVE_RAW_DECL_STRTOLL
+_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
+                 "use gnulib module strtoll for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOUL@
+/* Parse an unsigned integer whose textual representation starts at STRING.
+   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
+   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
+   "0x").
+   If ENDPTR is not NULL, the address of the first byte after the integer is
+   stored in *ENDPTR.
+   Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE.  */
+# if @REPLACE_STRTOUL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strtoul rpl_strtoul
+#  endif
+#  define GNULIB_defined_strtoul_function 1
+_GL_FUNCDECL_RPL (strtoul, unsigned long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoul, unsigned long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base));
+# else
+#  if !@HAVE_STRTOUL@
+_GL_FUNCDECL_SYS (strtoul, unsigned long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtoul, unsigned long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (strtoul);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtoul
+# if HAVE_RAW_DECL_STRTOUL
+_GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
+                 "use gnulib module strtoul for portability");
+# endif
+#endif
+
+#if @GNULIB_STRTOULL@
+/* Parse an unsigned integer whose textual representation starts at STRING.
+   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
+   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
+   "0x").
+   If ENDPTR is not NULL, the address of the first byte after the integer is
+   stored in *ENDPTR.
+   Upon overflow, the return value is ULLONG_MAX, and errno is set to
+   ERANGE.  */
+# if @REPLACE_STRTOULL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strtoull rpl_strtoull
+#  endif
+#  define GNULIB_defined_strtoull_function 1
+_GL_FUNCDECL_RPL (strtoull, unsigned long long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoull, unsigned long long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base));
+# else
+#  if !@HAVE_STRTOULL@
+_GL_FUNCDECL_SYS (strtoull, unsigned long long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtoull, unsigned long long,
+                  (const char *restrict string, char **restrict endptr,
+                   int base));
+# endif
+_GL_CXXALIASWARN (strtoull);
+#elif defined GNULIB_POSIXCHECK
+# undef strtoull
+# if HAVE_RAW_DECL_STRTOULL
+_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
+                 "use gnulib module strtoull for portability");
+# endif
+#endif
+
+#if @GNULIB_UNLOCKPT@
+/* Unlock the slave side of the pseudo-terminal whose master side is specified
+   by FD, so that it can be opened.  */
+# if !@HAVE_UNLOCKPT@
+_GL_FUNCDECL_SYS (unlockpt, int, (int fd));
+# endif
+_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
+_GL_CXXALIASWARN (unlockpt);
+#elif defined GNULIB_POSIXCHECK
+# undef unlockpt
+# if HAVE_RAW_DECL_UNLOCKPT
+_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
+                 "use gnulib module unlockpt for portability");
+# endif
+#endif
+
+#if @GNULIB_UNSETENV@
+/* Remove the variable NAME from the environment.  */
+# if @REPLACE_UNSETENV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unsetenv
+#   define unsetenv rpl_unsetenv
+#  endif
+_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
+# else
+#  if !@HAVE_DECL_UNSETENV@
+_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
+# endif
+# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
+_GL_CXXALIASWARN (unsetenv);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef unsetenv
+# if HAVE_RAW_DECL_UNSETENV
+_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
+                 "use gnulib module unsetenv for portability");
+# endif
+#endif
+
+/* Convert a wide character to a multibyte character.  */
+#if @GNULIB_WCTOMB@
+# if @REPLACE_WCTOMB@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wctomb
+#   define wctomb rpl_wctomb
+#  endif
+_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
+_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
+# else
+_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wctomb);
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_STDLIB_H */
+#endif /* _@GUARD_PREFIX@_STDLIB_H */
+#endif
deleted file mode 120000 (symlink)
index 5e74f3598d59873ae1d49366f4ab6a6f420317e9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stpcpy.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d4510054bf5e76b4b3978bb5926877f29ead5c7f
--- /dev/null
@@ -0,0 +1,49 @@
+/* stpcpy.c -- copy a string and return pointer to end of new string
+   Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   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 file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#undef __stpcpy
+#ifdef _LIBC
+# undef stpcpy
+#endif
+
+#ifndef weak_alias
+# define __stpcpy stpcpy
+#endif
+
+/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
+char *
+__stpcpy (char *dest, const char *src)
+{
+  register char *d = dest;
+  register const char *s = src;
+
+  do
+    *d++ = *s;
+  while (*s++ != '\0');
+
+  return d - 1;
+}
+#ifdef weak_alias
+weak_alias (__stpcpy, stpcpy)
+#endif
deleted file mode 120000 (symlink)
index 3003bebd811e7377601846023e8e12312ea87d21..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/str-two-way.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cf85e26817ca8b1c18ade0236e807bd0aa6084a2
--- /dev/null
@@ -0,0 +1,452 @@
+/* Byte-wise substring search, using the Two-Way algorithm.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Written by Eric Blake <ebb9@byu.net>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Before including this file, you need to include <config.h> and
+   <string.h>, and define:
+     RETURN_TYPE             A macro that expands to the return type.
+     AVAILABLE(h, h_l, j, n_l)
+                             A macro that returns nonzero if there are
+                             at least N_L bytes left starting at H[J].
+                             H is 'unsigned char *', H_L, J, and N_L
+                             are 'size_t'; H_L is an lvalue.  For
+                             NUL-terminated searches, H_L can be
+                             modified each iteration to avoid having
+                             to compute the end of H up front.
+
+  For case-insensitivity, you may optionally define:
+     CMP_FUNC(p1, p2, l)     A macro that returns 0 iff the first L
+                             characters of P1 and P2 are equal.
+     CANON_ELEMENT(c)        A macro that canonicalizes an element right after
+                             it has been fetched from one of the two strings.
+                             The argument is an 'unsigned char'; the result
+                             must be an 'unsigned char' as well.
+
+  This file undefines the macros documented above, and defines
+  LONG_NEEDLE_THRESHOLD.
+*/
+
+#include <limits.h>
+#include <stdint.h>
+
+/* We use the Two-Way string matching algorithm (also known as
+   Chrochemore-Perrin), which guarantees linear complexity with
+   constant space.  Additionally, for long needles, we also use a bad
+   character shift table similar to the Boyer-Moore algorithm to
+   achieve improved (potentially sub-linear) performance.
+
+   See https://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260,
+   https://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm,
+   https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf
+*/
+
+/* Point at which computing a bad-byte shift table is likely to be
+   worthwhile.  Small needles should not compute a table, since it
+   adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a
+   speedup no greater than a factor of NEEDLE_LEN.  The larger the
+   needle, the better the potential performance gain.  On the other
+   hand, on non-POSIX systems with CHAR_BIT larger than eight, the
+   memory required for the table is prohibitive.  */
+#if CHAR_BIT < 10
+# define LONG_NEEDLE_THRESHOLD 32U
+#else
+# define LONG_NEEDLE_THRESHOLD SIZE_MAX
+#endif
+
+#ifndef MAX
+# define MAX(a, b) ((a < b) ? (b) : (a))
+#endif
+
+#ifndef CANON_ELEMENT
+# define CANON_ELEMENT(c) c
+#endif
+#ifndef CMP_FUNC
+# define CMP_FUNC memcmp
+#endif
+
+/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN.
+   Return the index of the first byte in the right half, and set
+   *PERIOD to the global period of the right half.
+
+   The global period of a string is the smallest index (possibly its
+   length) at which all remaining bytes in the string are repetitions
+   of the prefix (the last repetition may be a subset of the prefix).
+
+   When NEEDLE is factored into two halves, a local period is the
+   length of the smallest word that shares a suffix with the left half
+   and shares a prefix with the right half.  All factorizations of a
+   non-empty NEEDLE have a local period of at least 1 and no greater
+   than NEEDLE_LEN.
+
+   A critical factorization has the property that the local period
+   equals the global period.  All strings have at least one critical
+   factorization with the left half smaller than the global period.
+   And while some strings have more than one critical factorization,
+   it is provable that with an ordered alphabet, at least one of the
+   critical factorizations corresponds to a maximal suffix.
+
+   Given an ordered alphabet, a critical factorization can be computed
+   in linear time, with 2 * NEEDLE_LEN comparisons, by computing the
+   shorter of two ordered maximal suffixes.  The ordered maximal
+   suffixes are determined by lexicographic comparison while tracking
+   periodicity.  */
+static size_t
+critical_factorization (const unsigned char *needle, size_t needle_len,
+                        size_t *period)
+{
+  /* Index of last byte of left half, or SIZE_MAX.  */
+  size_t max_suffix, max_suffix_rev;
+  size_t j; /* Index into NEEDLE for current candidate suffix.  */
+  size_t k; /* Offset into current period.  */
+  size_t p; /* Intermediate period.  */
+  unsigned char a, b; /* Current comparison bytes.  */
+
+  /* Special case NEEDLE_LEN of 1 or 2 (all callers already filtered
+     out 0-length needles.  */
+  if (needle_len < 3)
+    {
+      *period = 1;
+      return needle_len - 1;
+    }
+
+  /* Invariants:
+     0 <= j < NEEDLE_LEN - 1
+     -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed)
+     min(max_suffix, max_suffix_rev) < global period of NEEDLE
+     1 <= p <= global period of NEEDLE
+     p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j]
+     1 <= k <= p
+  */
+
+  /* Perform lexicographic search.  */
+  max_suffix = SIZE_MAX;
+  j = 0;
+  k = p = 1;
+  while (j + k < needle_len)
+    {
+      a = CANON_ELEMENT (needle[j + k]);
+      b = CANON_ELEMENT (needle[max_suffix + k]);
+      if (a < b)
+        {
+          /* Suffix is smaller, period is entire prefix so far.  */
+          j += k;
+          k = 1;
+          p = j - max_suffix;
+        }
+      else if (a == b)
+        {
+          /* Advance through repetition of the current period.  */
+          if (k != p)
+            ++k;
+          else
+            {
+              j += p;
+              k = 1;
+            }
+        }
+      else /* b < a */
+        {
+          /* Suffix is larger, start over from current location.  */
+          max_suffix = j++;
+          k = p = 1;
+        }
+    }
+  *period = p;
+
+  /* Perform reverse lexicographic search.  */
+  max_suffix_rev = SIZE_MAX;
+  j = 0;
+  k = p = 1;
+  while (j + k < needle_len)
+    {
+      a = CANON_ELEMENT (needle[j + k]);
+      b = CANON_ELEMENT (needle[max_suffix_rev + k]);
+      if (b < a)
+        {
+          /* Suffix is smaller, period is entire prefix so far.  */
+          j += k;
+          k = 1;
+          p = j - max_suffix_rev;
+        }
+      else if (a == b)
+        {
+          /* Advance through repetition of the current period.  */
+          if (k != p)
+            ++k;
+          else
+            {
+              j += p;
+              k = 1;
+            }
+        }
+      else /* a < b */
+        {
+          /* Suffix is larger, start over from current location.  */
+          max_suffix_rev = j++;
+          k = p = 1;
+        }
+    }
+
+  /* Choose the shorter suffix.  Return the index of the first byte of
+     the right half, rather than the last byte of the left half.
+
+     For some examples, 'banana' has two critical factorizations, both
+     exposed by the two lexicographic extreme suffixes of 'anana' and
+     'nana', where both suffixes have a period of 2.  On the other
+     hand, with 'aab' and 'bba', both strings have a single critical
+     factorization of the last byte, with the suffix having a period
+     of 1.  While the maximal lexicographic suffix of 'aab' is 'b',
+     the maximal lexicographic suffix of 'bba' is 'ba', which is not a
+     critical factorization.  Conversely, the maximal reverse
+     lexicographic suffix of 'a' works for 'bba', but not 'ab' for
+     'aab'.  The shorter suffix of the two will always be a critical
+     factorization.  */
+  if (max_suffix_rev + 1 < max_suffix + 1)
+    return max_suffix + 1;
+  *period = p;
+  return max_suffix_rev + 1;
+}
+
+/* Return the first location of non-empty NEEDLE within HAYSTACK, or
+   NULL.  HAYSTACK_LEN is the minimum known length of HAYSTACK.  This
+   method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD.
+   Performance is guaranteed to be linear, with an initialization cost
+   of 2 * NEEDLE_LEN comparisons.
+
+   If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
+   most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.
+   If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
+   HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.  */
+static RETURN_TYPE _GL_ATTRIBUTE_PURE
+two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
+                      const unsigned char *needle, size_t needle_len)
+{
+  size_t i; /* Index into current byte of NEEDLE.  */
+  size_t j; /* Index into current window of HAYSTACK.  */
+  size_t period; /* The period of the right half of needle.  */
+  size_t suffix; /* The index of the right half of needle.  */
+
+  /* Factor the needle into two halves, such that the left half is
+     smaller than the global period, and the right half is
+     periodic (with a period as large as NEEDLE_LEN - suffix).  */
+  suffix = critical_factorization (needle, needle_len, &period);
+
+  /* Perform the search.  Each iteration compares the right half
+     first.  */
+  if (CMP_FUNC (needle, needle + period, suffix) == 0)
+    {
+      /* Entire needle is periodic; a mismatch in the left half can
+         only advance by the period, so use memory to avoid rescanning
+         known occurrences of the period in the right half.  */
+      size_t memory = 0;
+      j = 0;
+      while (AVAILABLE (haystack, haystack_len, j, needle_len))
+        {
+          /* Scan for matches in right half.  */
+          i = MAX (suffix, memory);
+          while (i < needle_len && (CANON_ELEMENT (needle[i])
+                                    == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (memory < i + 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i + 1 < memory + 1)
+                return (RETURN_TYPE) (haystack + j);
+              /* No match, so remember how many repetitions of period
+                 on the right half were scanned.  */
+              j += period;
+              memory = needle_len - period;
+            }
+          else
+            {
+              j += i - suffix + 1;
+              memory = 0;
+            }
+        }
+    }
+  else
+    {
+      /* The two halves of needle are distinct; no extra memory is
+         required, and any mismatch results in a maximal shift.  */
+      period = MAX (suffix, needle_len - suffix) + 1;
+      j = 0;
+      while (AVAILABLE (haystack, haystack_len, j, needle_len))
+        {
+          /* Scan for matches in right half.  */
+          i = suffix;
+          while (i < needle_len && (CANON_ELEMENT (needle[i])
+                                    == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
+                                       == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i == SIZE_MAX)
+                return (RETURN_TYPE) (haystack + j);
+              j += period;
+            }
+          else
+            j += i - suffix + 1;
+        }
+    }
+  return NULL;
+}
+
+/* Return the first location of non-empty NEEDLE within HAYSTACK, or
+   NULL.  HAYSTACK_LEN is the minimum known length of HAYSTACK.  This
+   method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN.
+   Performance is guaranteed to be linear, with an initialization cost
+   of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations.
+
+   If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
+   most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching,
+   and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible.
+   If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
+   HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and
+   sublinear performance is not possible.  */
+static RETURN_TYPE _GL_ATTRIBUTE_PURE
+two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
+                     const unsigned char *needle, size_t needle_len)
+{
+  size_t i; /* Index into current byte of NEEDLE.  */
+  size_t j; /* Index into current window of HAYSTACK.  */
+  size_t period; /* The period of the right half of needle.  */
+  size_t suffix; /* The index of the right half of needle.  */
+  size_t shift_table[1U << CHAR_BIT]; /* See below.  */
+
+  /* Factor the needle into two halves, such that the left half is
+     smaller than the global period, and the right half is
+     periodic (with a period as large as NEEDLE_LEN - suffix).  */
+  suffix = critical_factorization (needle, needle_len, &period);
+
+  /* Populate shift_table.  For each possible byte value c,
+     shift_table[c] is the distance from the last occurrence of c to
+     the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
+     shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0.  */
+  for (i = 0; i < 1U << CHAR_BIT; i++)
+    shift_table[i] = needle_len;
+  for (i = 0; i < needle_len; i++)
+    shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
+
+  /* Perform the search.  Each iteration compares the right half
+     first.  */
+  if (CMP_FUNC (needle, needle + period, suffix) == 0)
+    {
+      /* Entire needle is periodic; a mismatch in the left half can
+         only advance by the period, so use memory to avoid rescanning
+         known occurrences of the period in the right half.  */
+      size_t memory = 0;
+      size_t shift;
+      j = 0;
+      while (AVAILABLE (haystack, haystack_len, j, needle_len))
+        {
+          /* Check the last byte first; if it does not match, then
+             shift to the next possible match location.  */
+          shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
+          if (0 < shift)
+            {
+              if (memory && shift < period)
+                {
+                  /* Since needle is periodic, but the last period has
+                     a byte out of place, there can be no match until
+                     after the mismatch.  */
+                  shift = needle_len - period;
+                }
+              memory = 0;
+              j += shift;
+              continue;
+            }
+          /* Scan for matches in right half.  The last byte has
+             already been matched, by virtue of the shift table.  */
+          i = MAX (suffix, memory);
+          while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len - 1 <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (memory < i + 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i + 1 < memory + 1)
+                return (RETURN_TYPE) (haystack + j);
+              /* No match, so remember how many repetitions of period
+                 on the right half were scanned.  */
+              j += period;
+              memory = needle_len - period;
+            }
+          else
+            {
+              j += i - suffix + 1;
+              memory = 0;
+            }
+        }
+    }
+  else
+    {
+      /* The two halves of needle are distinct; no extra memory is
+         required, and any mismatch results in a maximal shift.  */
+      size_t shift;
+      period = MAX (suffix, needle_len - suffix) + 1;
+      j = 0;
+      while (AVAILABLE (haystack, haystack_len, j, needle_len))
+        {
+          /* Check the last byte first; if it does not match, then
+             shift to the next possible match location.  */
+          shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
+          if (0 < shift)
+            {
+              j += shift;
+              continue;
+            }
+          /* Scan for matches in right half.  The last byte has
+             already been matched, by virtue of the shift table.  */
+          i = suffix;
+          while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len - 1 <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
+                                       == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i == SIZE_MAX)
+                return (RETURN_TYPE) (haystack + j);
+              j += period;
+            }
+          else
+            j += i - suffix + 1;
+        }
+    }
+  return NULL;
+}
+
+#undef AVAILABLE
+#undef CANON_ELEMENT
+#undef CMP_FUNC
+#undef MAX
+#undef RETURN_TYPE
deleted file mode 120000 (symlink)
index dc1c82315d9912f5dcc07d426b75b77cfeed43e7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strdup.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8d9e7c57dd07b81d83242689ee0da8d700c2e3c1
--- /dev/null
@@ -0,0 +1,54 @@
+/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+/* Get specification.  */
+#include <string.h>
+
+#include <stdlib.h>
+
+#undef __strdup
+#ifdef _LIBC
+# undef strdup
+#endif
+
+#ifndef weak_alias
+# define __strdup strdup
+#endif
+
+/* Duplicate S, returning an identical malloc'd string.  */
+char *
+__strdup (const char *s)
+{
+  size_t len = strlen (s) + 1;
+  void *new = malloc (len);
+
+  if (new == NULL)
+    return NULL;
+
+  return (char *) memcpy (new, s, len);
+}
+#ifdef libc_hidden_def
+libc_hidden_def (__strdup)
+#endif
+#ifdef weak_alias
+weak_alias (__strdup, strdup)
+#endif
deleted file mode 120000 (symlink)
index c9847bc5d384d96c7f7394162d5e4907e5b298eb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/streq.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..123434637f5b6f2e9cdcf62b84c084eacb19c78a
--- /dev/null
@@ -0,0 +1,176 @@
+/* Optimized string comparison.
+   Copyright (C) 2001-2002, 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>.  */
+
+#ifndef _GL_STREQ_H
+#define _GL_STREQ_H
+
+#include <string.h>
+
+/* STREQ_OPT allows to optimize string comparison with a small literal string.
+     STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
+   is semantically equivalent to
+     strcmp (s, "EUC-KR") == 0
+   just faster.  */
+
+/* Help GCC to generate good code for string comparisons with
+   immediate strings. */
+#if (defined __GNUC__ || defined __clang__) && defined __OPTIMIZE__
+
+static inline int
+streq9 (const char *s1, const char *s2)
+{
+  return strcmp (s1 + 9, s2 + 9) == 0;
+}
+
+static inline int
+streq8 (const char *s1, const char *s2, char s28)
+{
+  if (s1[8] == s28)
+    {
+      if (s28 == 0)
+        return 1;
+      else
+        return streq9 (s1, s2);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq7 (const char *s1, const char *s2, char s27, char s28)
+{
+  if (s1[7] == s27)
+    {
+      if (s27 == 0)
+        return 1;
+      else
+        return streq8 (s1, s2, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
+{
+  if (s1[6] == s26)
+    {
+      if (s26 == 0)
+        return 1;
+      else
+        return streq7 (s1, s2, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
+{
+  if (s1[5] == s25)
+    {
+      if (s25 == 0)
+        return 1;
+      else
+        return streq6 (s1, s2, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[4] == s24)
+    {
+      if (s24 == 0)
+        return 1;
+      else
+        return streq5 (s1, s2, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[3] == s23)
+    {
+      if (s23 == 0)
+        return 1;
+      else
+        return streq4 (s1, s2, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[2] == s22)
+    {
+      if (s22 == 0)
+        return 1;
+      else
+        return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[1] == s21)
+    {
+      if (s21 == 0)
+        return 1;
+      else
+        return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+static inline int
+streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
+{
+  if (s1[0] == s20)
+    {
+      if (s20 == 0)
+        return 1;
+      else
+        return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
+    }
+  else
+    return 0;
+}
+
+#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+  streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
+
+#else
+
+#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+  (strcmp (s1, s2) == 0)
+
+#endif
+
+#endif /* _GL_STREQ_H */
deleted file mode 120000 (symlink)
index a38f95c706ba85815d6edaf02a80403745db44c7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strerror-override.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b9c1c7aba83ebd6a6bdec0a7c7de6e1bcbec94dc
--- /dev/null
@@ -0,0 +1,306 @@
+/* strerror-override.c --- POSIX compatible system error routine
+
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include "strerror-override.h"
+
+#include <errno.h>
+
+#if GNULIB_defined_EWINSOCK /* native Windows platforms */
+# if HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif
+#endif
+
+#if !GNULIB_defined_strerror_override_macro
+
+/* If ERRNUM maps to an errno value defined by gnulib, return a string
+   describing the error.  Otherwise return NULL.  */
+const char *
+strerror_override (int errnum)
+{
+  /* These error messages are taken from glibc/sysdeps/gnu/errlist.c.  */
+  switch (errnum)
+    {
+# if REPLACE_STRERROR_0
+    case 0:
+      return "Success";
+# endif
+
+# if GNULIB_defined_ESOCK /* native Windows platforms with older <errno.h> */
+    case EINPROGRESS:
+      return "Operation now in progress";
+    case EALREADY:
+      return "Operation already in progress";
+    case ENOTSOCK:
+      return "Socket operation on non-socket";
+    case EDESTADDRREQ:
+      return "Destination address required";
+    case EMSGSIZE:
+      return "Message too long";
+    case EPROTOTYPE:
+      return "Protocol wrong type for socket";
+    case ENOPROTOOPT:
+      return "Protocol not available";
+    case EPROTONOSUPPORT:
+      return "Protocol not supported";
+    case EOPNOTSUPP:
+      return "Operation not supported";
+    case EAFNOSUPPORT:
+      return "Address family not supported by protocol";
+    case EADDRINUSE:
+      return "Address already in use";
+    case EADDRNOTAVAIL:
+      return "Cannot assign requested address";
+    case ENETDOWN:
+      return "Network is down";
+    case ENETUNREACH:
+      return "Network is unreachable";
+    case ECONNRESET:
+      return "Connection reset by peer";
+    case ENOBUFS:
+      return "No buffer space available";
+    case EISCONN:
+      return "Transport endpoint is already connected";
+    case ENOTCONN:
+      return "Transport endpoint is not connected";
+    case ETIMEDOUT:
+      return "Connection timed out";
+    case ECONNREFUSED:
+      return "Connection refused";
+    case ELOOP:
+      return "Too many levels of symbolic links";
+    case EHOSTUNREACH:
+      return "No route to host";
+    case EWOULDBLOCK:
+      return "Operation would block";
+# endif
+# if GNULIB_defined_ESTREAMS /* native Windows platforms with older <errno.h> */
+    case ETXTBSY:
+      return "Text file busy";
+    case ENODATA:
+      return "No data available";
+    case ENOSR:
+      return "Out of streams resources";
+    case ENOSTR:
+      return "Device not a stream";
+    case ETIME:
+      return "Timer expired";
+    case EOTHER:
+      return "Other error";
+# endif
+# if GNULIB_defined_EWINSOCK /* native Windows platforms */
+    case ESOCKTNOSUPPORT:
+      return "Socket type not supported";
+    case EPFNOSUPPORT:
+      return "Protocol family not supported";
+    case ESHUTDOWN:
+      return "Cannot send after transport endpoint shutdown";
+    case ETOOMANYREFS:
+      return "Too many references: cannot splice";
+    case EHOSTDOWN:
+      return "Host is down";
+    case EPROCLIM:
+      return "Too many processes";
+    case EUSERS:
+      return "Too many users";
+    case EDQUOT:
+      return "Disk quota exceeded";
+    case ESTALE:
+      return "Stale NFS file handle";
+    case EREMOTE:
+      return "Object is remote";
+#  if HAVE_WINSOCK2_H
+      /* WSA_INVALID_HANDLE maps to EBADF */
+      /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */
+      /* WSA_INVALID_PARAMETER maps to EINVAL */
+    case WSA_OPERATION_ABORTED:
+      return "Overlapped operation aborted";
+    case WSA_IO_INCOMPLETE:
+      return "Overlapped I/O event object not in signaled state";
+    case WSA_IO_PENDING:
+      return "Overlapped operations will complete later";
+      /* WSAEINTR maps to EINTR */
+      /* WSAEBADF maps to EBADF */
+      /* WSAEACCES maps to EACCES */
+      /* WSAEFAULT maps to EFAULT */
+      /* WSAEINVAL maps to EINVAL */
+      /* WSAEMFILE maps to EMFILE */
+      /* WSAEWOULDBLOCK maps to EWOULDBLOCK */
+      /* WSAEINPROGRESS maps to EINPROGRESS */
+      /* WSAEALREADY maps to EALREADY */
+      /* WSAENOTSOCK maps to ENOTSOCK */
+      /* WSAEDESTADDRREQ maps to EDESTADDRREQ */
+      /* WSAEMSGSIZE maps to EMSGSIZE */
+      /* WSAEPROTOTYPE maps to EPROTOTYPE */
+      /* WSAENOPROTOOPT maps to ENOPROTOOPT */
+      /* WSAEPROTONOSUPPORT maps to EPROTONOSUPPORT */
+      /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */
+      /* WSAEOPNOTSUPP maps to EOPNOTSUPP */
+      /* WSAEPFNOSUPPORT is EPFNOSUPPORT */
+      /* WSAEAFNOSUPPORT maps to EAFNOSUPPORT */
+      /* WSAEADDRINUSE maps to EADDRINUSE */
+      /* WSAEADDRNOTAVAIL maps to EADDRNOTAVAIL */
+      /* WSAENETDOWN maps to ENETDOWN */
+      /* WSAENETUNREACH maps to ENETUNREACH */
+      /* WSAENETRESET maps to ENETRESET */
+      /* WSAECONNABORTED maps to ECONNABORTED */
+      /* WSAECONNRESET maps to ECONNRESET */
+      /* WSAENOBUFS maps to ENOBUFS */
+      /* WSAEISCONN maps to EISCONN */
+      /* WSAENOTCONN maps to ENOTCONN */
+      /* WSAESHUTDOWN is ESHUTDOWN */
+      /* WSAETOOMANYREFS is ETOOMANYREFS */
+      /* WSAETIMEDOUT maps to ETIMEDOUT */
+      /* WSAECONNREFUSED maps to ECONNREFUSED */
+      /* WSAELOOP maps to ELOOP */
+      /* WSAENAMETOOLONG maps to ENAMETOOLONG */
+      /* WSAEHOSTDOWN is EHOSTDOWN */
+      /* WSAEHOSTUNREACH maps to EHOSTUNREACH */
+      /* WSAENOTEMPTY maps to ENOTEMPTY */
+      /* WSAEPROCLIM is EPROCLIM */
+      /* WSAEUSERS is EUSERS */
+      /* WSAEDQUOT is EDQUOT */
+      /* WSAESTALE is ESTALE */
+      /* WSAEREMOTE is EREMOTE */
+    case WSASYSNOTREADY:
+      return "Network subsystem is unavailable";
+    case WSAVERNOTSUPPORTED:
+      return "Winsock.dll version out of range";
+    case WSANOTINITIALISED:
+      return "Successful WSAStartup not yet performed";
+    case WSAEDISCON:
+      return "Graceful shutdown in progress";
+    case WSAENOMORE: case WSA_E_NO_MORE:
+      return "No more results";
+    case WSAECANCELLED: case WSA_E_CANCELLED:
+      return "Call was canceled";
+    case WSAEINVALIDPROCTABLE:
+      return "Procedure call table is invalid";
+    case WSAEINVALIDPROVIDER:
+      return "Service provider is invalid";
+    case WSAEPROVIDERFAILEDINIT:
+      return "Service provider failed to initialize";
+    case WSASYSCALLFAILURE:
+      return "System call failure";
+    case WSASERVICE_NOT_FOUND:
+      return "Service not found";
+    case WSATYPE_NOT_FOUND:
+      return "Class type not found";
+    case WSAEREFUSED:
+      return "Database query was refused";
+    case WSAHOST_NOT_FOUND:
+      return "Host not found";
+    case WSATRY_AGAIN:
+      return "Nonauthoritative host not found";
+    case WSANO_RECOVERY:
+      return "Nonrecoverable error";
+    case WSANO_DATA:
+      return "Valid name, no data record of requested type";
+      /* WSA_QOS_* omitted */
+#  endif
+# endif
+
+# if GNULIB_defined_ENOMSG
+    case ENOMSG:
+      return "No message of desired type";
+# endif
+
+# if GNULIB_defined_EIDRM
+    case EIDRM:
+      return "Identifier removed";
+# endif
+
+# if GNULIB_defined_ENOLINK
+    case ENOLINK:
+      return "Link has been severed";
+# endif
+
+# if GNULIB_defined_EPROTO
+    case EPROTO:
+      return "Protocol error";
+# endif
+
+# if GNULIB_defined_EMULTIHOP
+    case EMULTIHOP:
+      return "Multihop attempted";
+# endif
+
+# if GNULIB_defined_EBADMSG
+    case EBADMSG:
+      return "Bad message";
+# endif
+
+# if GNULIB_defined_EOVERFLOW
+    case EOVERFLOW:
+      return "Value too large for defined data type";
+# endif
+
+# if GNULIB_defined_ENOTSUP
+    case ENOTSUP:
+      return "Not supported";
+# endif
+
+# if GNULIB_defined_ENETRESET
+    case ENETRESET:
+      return "Network dropped connection on reset";
+# endif
+
+# if GNULIB_defined_ECONNABORTED
+    case ECONNABORTED:
+      return "Software caused connection abort";
+# endif
+
+# if GNULIB_defined_ESTALE
+    case ESTALE:
+      return "Stale NFS file handle";
+# endif
+
+# if GNULIB_defined_EDQUOT
+    case EDQUOT:
+      return "Disk quota exceeded";
+# endif
+
+# if GNULIB_defined_ECANCELED
+    case ECANCELED:
+      return "Operation canceled";
+# endif
+
+# if GNULIB_defined_EOWNERDEAD
+    case EOWNERDEAD:
+      return "Owner died";
+# endif
+
+# if GNULIB_defined_ENOTRECOVERABLE
+    case ENOTRECOVERABLE:
+      return "State not recoverable";
+# endif
+
+# if GNULIB_defined_EILSEQ
+    case EILSEQ:
+      return "Invalid or incomplete multibyte or wide character";
+# endif
+
+    default:
+      return NULL;
+    }
+}
+
+#endif
deleted file mode 120000 (symlink)
index 6d93cf864aa61d904310361b3cbf23ae7ca2b5f4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strerror-override.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..872fa7d6c78d6aac0aff7e3a03c85f9db2cb6510
--- /dev/null
@@ -0,0 +1,62 @@
+/* strerror-override.h --- POSIX compatible system error routine
+
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_STRERROR_OVERRIDE_H
+# define _GL_STRERROR_OVERRIDE_H
+
+/* This file uses _GL_ATTRIBUTE_CONST.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <errno.h>
+# include <stddef.h>
+
+/* Reasonable buffer size that should never trigger ERANGE; if this
+   proves too small, we intentionally abort(), to remind us to fix
+   this value.  */
+# define STACKBUF_LEN 256
+
+/* If ERRNUM maps to an errno value defined by gnulib, return a string
+   describing the error.  Otherwise return NULL.  */
+# if REPLACE_STRERROR_0 \
+     || GNULIB_defined_ESOCK \
+     || GNULIB_defined_ESTREAMS \
+     || GNULIB_defined_EWINSOCK \
+     || GNULIB_defined_ENOMSG \
+     || GNULIB_defined_EIDRM \
+     || GNULIB_defined_ENOLINK \
+     || GNULIB_defined_EPROTO \
+     || GNULIB_defined_EMULTIHOP \
+     || GNULIB_defined_EBADMSG \
+     || GNULIB_defined_EOVERFLOW \
+     || GNULIB_defined_ENOTSUP \
+     || GNULIB_defined_ENETRESET \
+     || GNULIB_defined_ECONNABORTED \
+     || GNULIB_defined_ESTALE \
+     || GNULIB_defined_EDQUOT \
+     || GNULIB_defined_ECANCELED \
+     || GNULIB_defined_EOWNERDEAD \
+     || GNULIB_defined_ENOTRECOVERABLE \
+     || GNULIB_defined_EILSEQ
+extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST;
+# else
+#  define strerror_override(ignored) NULL
+#  define GNULIB_defined_strerror_override_macro 1
+# endif
+
+#endif /* _GL_STRERROR_OVERRIDE_H */
deleted file mode 120000 (symlink)
index 4afba53d011a6a8e38f9545939054e10654997db..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strerror.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6b760ff45c0e6a4b4f17f7ce6b6061923983eada
--- /dev/null
@@ -0,0 +1,70 @@
+/* strerror.c --- POSIX compatible system error routine
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <string.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "intprops.h"
+#include "strerror-override.h"
+
+/* Use the system functions, not the gnulib overrides in this file.  */
+#undef sprintf
+
+char *
+strerror (int n)
+#undef strerror
+{
+  static char buf[STACKBUF_LEN];
+  size_t len;
+
+  /* Cast away const, due to the historical signature of strerror;
+     callers should not be modifying the string.  */
+  const char *msg = strerror_override (n);
+  if (msg)
+    return (char *) msg;
+
+  msg = strerror (n);
+
+  /* Our strerror_r implementation might use the system's strerror
+     buffer, so all other clients of strerror have to see the error
+     copied into a buffer that we manage.  This is not thread-safe,
+     even if the system strerror is, but portable programs shouldn't
+     be using strerror if they care about thread-safety.  */
+  if (!msg || !*msg)
+    {
+      static char const fmt[] = "Unknown error %d";
+      static_assert (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n));
+      sprintf (buf, fmt, n);
+      errno = EINVAL;
+      return buf;
+    }
+
+  /* Fix STACKBUF_LEN if this ever aborts.  */
+  len = strlen (msg);
+  if (sizeof buf <= len)
+    abort ();
+
+  memcpy (buf, msg, len + 1);
+  return buf;
+}
deleted file mode 120000 (symlink)
index cad2793c5d5fcb71d7d580d94dea8e710272d494..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strftime.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d6efdb848a3cc3b112d59422fc83dfd468b759fa
--- /dev/null
@@ -0,0 +1,38 @@
+/* declarations for strftime.c
+
+   Copyright (C) 2002, 2004, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Just like strftime, but with two more arguments:
+   POSIX requires that strftime use the local timezone information.
+   Use the timezone __TZ instead.  Use __NS as the number of
+   nanoseconds in the %N directive.
+
+   On error, set errno and return 0.  Otherwise, return the number of
+   bytes generated (not counting the trailing NUL), preserving errno
+   if the number is 0.  This errno behavior is in draft POSIX 202x
+   plus some requested changes to POSIX.  */
+size_t nstrftime (char *restrict, size_t, char const *, struct tm const *,
+                  timezone_t __tz, int __ns);
+
+#ifdef __cplusplus
+}
+#endif
deleted file mode 120000 (symlink)
index 11bbdabf076b9dacd2a7c6a0d48fa1493d80b6b2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/string.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..44ec2e7ecdb5070ddf684d739f298e37cceedb17
--- /dev/null
+/* A GNU-like <string.h>.
+
+   Copyright (C) 1995-1996, 2001-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined _GL_ALREADY_INCLUDING_STRING_H
+/* Special invocation convention:
+   - On OS X/NetBSD we have a sequence of nested includes
+       <string.h> -> <strings.h> -> "string.h"
+     In this situation system _chk variants due to -D_FORTIFY_SOURCE
+     might be used after any replacements defined here.  */
+
+#@INCLUDE_NEXT@ @NEXT_STRING_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_STRING_H
+
+#define _GL_ALREADY_INCLUDING_STRING_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_STRING_H@
+
+#undef _GL_ALREADY_INCLUDING_STRING_H
+
+#ifndef _@GUARD_PREFIX@_STRING_H
+#define _@GUARD_PREFIX@_STRING_H
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
+   _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
+   HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* NetBSD 5.0 mis-defines NULL.  */
+#include <stddef.h>
+
+/* MirBSD defines mbslen as a macro.  */
+#if @GNULIB_MBSLEN@ && defined __MirBSD__
+# include <wchar.h>
+#endif
+
+/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>.  */
+/* But in any case avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
+    && ! defined __GLIBC__
+# include <unistd.h>
+#endif
+
+/* AIX 7.2 and Android 13 declare ffsl and ffsll in <strings.h>, not in
+   <string.h>.  */
+/* But in any case avoid namespace pollution on glibc systems.  */
+#if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \
+     && (defined _AIX || defined __ANDROID__)) \
+    && ! defined __GLIBC__
+# include <strings.h>
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
+   that can be freed by passing them as the Ith argument to the
+   function F.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# if __GNUC__ >= 11
+#  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+# else
+#  define _GL_ATTRIBUTE_DEALLOC(f, i)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+   can be freed via 'free'; it can be used only after declaring 'free'.  */
+/* Applies to: functions.  Cannot be used on inline functions.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
+# if defined __cplusplus && defined __GNUC__ && !defined __clang__
+/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
+#  define _GL_ATTRIBUTE_DEALLOC_FREE \
+     _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
+# else
+#  define _GL_ATTRIBUTE_DEALLOC_FREE \
+     _GL_ATTRIBUTE_DEALLOC (free, 1)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
+   allocated memory.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if __GNUC__ >= 3 || defined __clang__
+#  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define _GL_ATTRIBUTE_MALLOC
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
+ */
+#ifndef _GL_ATTRIBUTE_NOTHROW
+# if defined __cplusplus
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#   if __cplusplus >= 201103L
+#    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
+#   else
+#    define _GL_ATTRIBUTE_NOTHROW throw ()
+#   endif
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# else
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
+#   define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# endif
+#endif
+
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __pure__ was added in gcc 2.96.  */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
+   been included yet.  */
+#if @GNULIB_FREE_POSIX@
+# if (@REPLACE_FREE@ && !defined free \
+      && !(defined __cplusplus && defined GNULIB_NAMESPACE))
+/* We can't do '#define free rpl_free' here.  */
+#  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void rpl_free (void *) _GL_ATTRIBUTE_NOTHROW;
+#  else
+_GL_EXTERN_C void rpl_free (void *);
+#  endif
+#  undef _GL_ATTRIBUTE_DEALLOC_FREE
+#  define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
+# else
+#  if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
+#  else
+#   if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
+#   else
+_GL_EXTERN_C void free (void *);
+#   endif
+#  endif
+# endif
+#else
+# if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
+# else
+#  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
+#  else
+_GL_EXTERN_C void free (void *);
+#  endif
+# endif
+#endif
+
+/* Clear a block of memory.  The compiler will not delete a call to
+   this function, even if the block is dead after the call.  */
+#if @GNULIB_EXPLICIT_BZERO@
+# if ! @HAVE_EXPLICIT_BZERO@
+_GL_FUNCDECL_SYS (explicit_bzero, void,
+                  (void *__dest, size_t __n) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n));
+_GL_CXXALIASWARN (explicit_bzero);
+#elif defined GNULIB_POSIXCHECK
+# undef explicit_bzero
+# if HAVE_RAW_DECL_EXPLICIT_BZERO
+_GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - "
+                 "use gnulib module explicit_bzero for portability");
+# endif
+#endif
+
+/* Find the index of the least-significant set bit.  */
+#if @GNULIB_FFSL@
+# if !@HAVE_FFSL@
+_GL_FUNCDECL_SYS (ffsl, int, (long int i));
+# endif
+_GL_CXXALIAS_SYS (ffsl, int, (long int i));
+_GL_CXXALIASWARN (ffsl);
+#elif defined GNULIB_POSIXCHECK
+# undef ffsl
+# if HAVE_RAW_DECL_FFSL
+_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
+# endif
+#endif
+
+
+/* Find the index of the least-significant set bit.  */
+#if @GNULIB_FFSLL@
+# if @REPLACE_FFSLL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define ffsll rpl_ffsll
+#  endif
+_GL_FUNCDECL_RPL (ffsll, int, (long long int i));
+_GL_CXXALIAS_RPL (ffsll, int, (long long int i));
+# else
+#  if !@HAVE_FFSLL@
+_GL_FUNCDECL_SYS (ffsll, int, (long long int i));
+#  endif
+_GL_CXXALIAS_SYS (ffsll, int, (long long int i));
+# endif
+_GL_CXXALIASWARN (ffsll);
+#elif defined GNULIB_POSIXCHECK
+# undef ffsll
+# if HAVE_RAW_DECL_FFSLL
+_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
+# endif
+#endif
+
+
+#if @GNULIB_MDA_MEMCCPY@
+/* On native Windows, map 'memccpy' to '_memccpy', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::memccpy always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef memccpy
+#   define memccpy _memccpy
+#  endif
+_GL_CXXALIAS_MDA (memccpy, void *,
+                  (void *dest, const void *src, int c, size_t n));
+# else
+_GL_CXXALIAS_SYS (memccpy, void *,
+                  (void *dest, const void *src, int c, size_t n));
+# endif
+_GL_CXXALIASWARN (memccpy);
+#endif
+
+
+/* Return the first instance of C within N bytes of S, or NULL.  */
+#if @GNULIB_MEMCHR@
+# if @REPLACE_MEMCHR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef memchr
+#   define memchr rpl_memchr
+#  endif
+_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
+                                  _GL_ATTRIBUTE_PURE
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
+# else
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C" { const void * std::memchr (const void *, int, size_t); }
+       extern "C++" { void * std::memchr (void *, int, size_t); }  */
+_GL_CXXALIAS_SYS_CAST2 (memchr,
+                        void *, (void const *__s, int __c, size_t __n),
+                        void const *, (void const *__s, int __c, size_t __n));
+# endif
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
+         || defined __clang__)
+_GL_CXXALIASWARN1 (memchr, void *,
+                   (void *__s, int __c, size_t __n)
+                   _GL_ATTRIBUTE_NOTHROW);
+_GL_CXXALIASWARN1 (memchr, void const *,
+                   (void const *__s, int __c, size_t __n)
+                   _GL_ATTRIBUTE_NOTHROW);
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (memchr);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef memchr
+/* Assume memchr is always declared.  */
+_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
+                 "use gnulib module memchr for portability" );
+#endif
+
+/* Return the first occurrence of NEEDLE in HAYSTACK.  */
+#if @GNULIB_MEMMEM@
+# if @REPLACE_MEMMEM@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define memmem rpl_memmem
+#  endif
+_GL_FUNCDECL_RPL (memmem, void *,
+                  (void const *__haystack, size_t __haystack_len,
+                   void const *__needle, size_t __needle_len)
+                  _GL_ATTRIBUTE_PURE
+                  _GL_ARG_NONNULL ((1, 3)));
+_GL_CXXALIAS_RPL (memmem, void *,
+                  (void const *__haystack, size_t __haystack_len,
+                   void const *__needle, size_t __needle_len));
+# else
+#  if ! @HAVE_DECL_MEMMEM@
+_GL_FUNCDECL_SYS (memmem, void *,
+                  (void const *__haystack, size_t __haystack_len,
+                   void const *__needle, size_t __needle_len)
+                  _GL_ATTRIBUTE_PURE
+                  _GL_ARG_NONNULL ((1, 3)));
+#  endif
+_GL_CXXALIAS_SYS (memmem, void *,
+                  (void const *__haystack, size_t __haystack_len,
+                   void const *__needle, size_t __needle_len));
+# endif
+_GL_CXXALIASWARN (memmem);
+#elif defined GNULIB_POSIXCHECK
+# undef memmem
+# if HAVE_RAW_DECL_MEMMEM
+_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
+                 "use gnulib module memmem-simple for portability, "
+                 "and module memmem for speed" );
+# endif
+#endif
+
+/* Copy N bytes of SRC to DEST, return pointer to bytes after the
+   last written byte.  */
+#if @GNULIB_MEMPCPY@
+# if @REPLACE_MEMPCPY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mempcpy
+#   define mempcpy rpl_mempcpy
+#  endif
+_GL_FUNCDECL_RPL (mempcpy, void *,
+                  (void *restrict __dest, void const *restrict __src,
+                   size_t __n)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (mempcpy, void *,
+                  (void *restrict __dest, void const *restrict __src,
+                   size_t __n));
+# else
+#  if !@HAVE_MEMPCPY@
+_GL_FUNCDECL_SYS (mempcpy, void *,
+                  (void *restrict __dest, void const *restrict __src,
+                   size_t __n)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (mempcpy, void *,
+                  (void *restrict __dest, void const *restrict __src,
+                   size_t __n));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mempcpy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mempcpy
+# if HAVE_RAW_DECL_MEMPCPY
+_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
+                 "use gnulib module mempcpy for portability");
+# endif
+#endif
+
+/* Search backwards through a block for a byte (specified as an int).  */
+#if @GNULIB_MEMRCHR@
+# if ! @HAVE_DECL_MEMRCHR@
+_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1)));
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const void * std::memrchr (const void *, int, size_t); }
+       extern "C++" { void * std::memrchr (void *, int, size_t); }  */
+_GL_CXXALIAS_SYS_CAST2 (memrchr,
+                        void *, (void const *, int, size_t),
+                        void const *, (void const *, int, size_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
+         || defined __clang__)
+_GL_CXXALIASWARN1 (memrchr, void *,
+                   (void *, int, size_t)
+                   _GL_ATTRIBUTE_NOTHROW);
+_GL_CXXALIASWARN1 (memrchr, void const *,
+                   (void const *, int, size_t)
+                   _GL_ATTRIBUTE_NOTHROW);
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (memrchr);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef memrchr
+# if HAVE_RAW_DECL_MEMRCHR
+_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
+                 "use gnulib module memrchr for portability");
+# endif
+#endif
+
+/* Overwrite a block of memory.  The compiler will not optimize
+   effects away, even if the block is dead after the call.  */
+#if @GNULIB_MEMSET_EXPLICIT@
+# if @REPLACE_MEMSET_EXPLICIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef memset_explicit
+#   define memset_explicit rpl_memset_explicit
+#  endif
+_GL_FUNCDECL_RPL (memset_explicit, void *,
+                  (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n));
+# else
+#  if !@HAVE_MEMSET_EXPLICIT@
+_GL_FUNCDECL_SYS (memset_explicit, void *,
+                  (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
+# endif
+_GL_CXXALIASWARN (memset_explicit);
+#elif defined GNULIB_POSIXCHECK
+# undef memset_explicit
+# if HAVE_RAW_DECL_MEMSET_EXPLICIT
+_GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - "
+                 "use gnulib module memset_explicit for portability");
+# endif
+#endif
+
+/* Find the first occurrence of C in S.  More efficient than
+   memchr(S,C,N), at the expense of undefined behavior if C does not
+   occur within N bytes.  */
+#if @GNULIB_RAWMEMCHR@
+# if ! @HAVE_RAWMEMCHR@
+_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
+                                     _GL_ATTRIBUTE_PURE
+                                     _GL_ARG_NONNULL ((1)));
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const void * std::rawmemchr (const void *, int); }
+       extern "C++" { void * std::rawmemchr (void *, int); }  */
+_GL_CXXALIAS_SYS_CAST2 (rawmemchr,
+                        void *, (void const *__s, int __c_in),
+                        void const *, (void const *__s, int __c_in));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
+         || defined __clang__)
+_GL_CXXALIASWARN1 (rawmemchr, void *,
+                   (void *__s, int __c_in)
+                   _GL_ATTRIBUTE_NOTHROW);
+_GL_CXXALIASWARN1 (rawmemchr, void const *,
+                   (void const *__s, int __c_in)
+                   _GL_ATTRIBUTE_NOTHROW);
+# else
+_GL_CXXALIASWARN (rawmemchr);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef rawmemchr
+# if HAVE_RAW_DECL_RAWMEMCHR
+_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
+                 "use gnulib module rawmemchr for portability");
+# endif
+#endif
+
+/* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
+#if @GNULIB_STPCPY@
+# if @REPLACE_STPCPY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef stpcpy
+#   define stpcpy rpl_stpcpy
+#  endif
+_GL_FUNCDECL_RPL (stpcpy, char *,
+                  (char *restrict __dst, char const *restrict __src)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (stpcpy, char *,
+                  (char *restrict __dst, char const *restrict __src));
+# else
+#  if !@HAVE_STPCPY@
+_GL_FUNCDECL_SYS (stpcpy, char *,
+                  (char *restrict __dst, char const *restrict __src)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (stpcpy, char *,
+                  (char *restrict __dst, char const *restrict __src));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (stpcpy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef stpcpy
+# if HAVE_RAW_DECL_STPCPY
+_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
+                 "use gnulib module stpcpy for portability");
+# endif
+#endif
+
+/* Copy no more than N bytes of SRC to DST, returning a pointer past the
+   last non-NUL byte written into DST.  */
+#if @GNULIB_STPNCPY@
+# if @REPLACE_STPNCPY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef stpncpy
+#   define stpncpy rpl_stpncpy
+#  endif
+_GL_FUNCDECL_RPL (stpncpy, char *,
+                  (char *restrict __dst, char const *restrict __src,
+                   size_t __n)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (stpncpy, char *,
+                  (char *restrict __dst, char const *restrict __src,
+                   size_t __n));
+# else
+#  if ! @HAVE_STPNCPY@
+_GL_FUNCDECL_SYS (stpncpy, char *,
+                  (char *restrict __dst, char const *restrict __src,
+                   size_t __n)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (stpncpy, char *,
+                  (char *restrict __dst, char const *restrict __src,
+                   size_t __n));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (stpncpy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef stpncpy
+# if HAVE_RAW_DECL_STPNCPY
+_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
+                 "use gnulib module stpncpy for portability");
+# endif
+#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.  */
+# undef strchr
+/* Assume strchr is always declared.  */
+_GL_WARN_ON_USE_CXX (strchr,
+                     const char *, char *, (const char *, int),
+                     "strchr cannot work correctly on character strings "
+                     "in some multibyte locales - "
+                     "use mbschr if you care about internationalization");
+#endif
+
+/* Find the first occurrence of C in S or the final NUL byte.  */
+#if @GNULIB_STRCHRNUL@
+# if @REPLACE_STRCHRNUL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strchrnul rpl_strchrnul
+#  endif
+_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
+                                     _GL_ATTRIBUTE_PURE
+                                     _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strchrnul, char *,
+                  (const char *str, int ch));
+# else
+#  if ! @HAVE_STRCHRNUL@
+_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
+                                     _GL_ATTRIBUTE_PURE
+                                     _GL_ARG_NONNULL ((1)));
+#  endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const char * std::strchrnul (const char *, int); }
+       extern "C++" { char * std::strchrnul (char *, int); }  */
+_GL_CXXALIAS_SYS_CAST2 (strchrnul,
+                        char *, (char const *__s, int __c_in),
+                        char const *, (char const *__s, int __c_in));
+# endif
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
+         || defined __clang__)
+_GL_CXXALIASWARN1 (strchrnul, char *,
+                   (char *__s, int __c_in)
+                   _GL_ATTRIBUTE_NOTHROW);
+_GL_CXXALIASWARN1 (strchrnul, char const *,
+                   (char const *__s, int __c_in)
+                   _GL_ATTRIBUTE_NOTHROW);
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (strchrnul);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strchrnul
+# if HAVE_RAW_DECL_STRCHRNUL
+_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
+                 "use gnulib module strchrnul for portability");
+# endif
+#endif
+
+/* Duplicate S, returning an identical malloc'd string.  */
+#if @GNULIB_STRDUP@
+# if @REPLACE_STRDUP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strdup
+#   define strdup rpl_strdup
+#  endif
+_GL_FUNCDECL_RPL (strdup, char *,
+                  (char const *__s)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strdup
+#   define strdup _strdup
+#  endif
+_GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
+# else
+#  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
+    /* strdup exists as a function and as a macro.  Get rid of the macro.  */
+#   undef strdup
+#  endif
+#  if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup
+#   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (strdup, char *,
+                  (char const *__s)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   else
+_GL_FUNCDECL_SYS (strdup, char *,
+                  (char const *__s)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
+# endif
+_GL_CXXALIASWARN (strdup);
+#else
+# if __GNUC__ >= 11 && !defined strdup
+/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free.  */
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (strdup, char *,
+                  (char const *__s)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  else
+_GL_FUNCDECL_SYS (strdup, char *,
+                  (char const *__s)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef strdup
+#  if HAVE_RAW_DECL_STRDUP
+_GL_WARN_ON_USE (strdup, "strdup is unportable - "
+                 "use gnulib module strdup for portability");
+#  endif
+# elif @GNULIB_MDA_STRDUP@
+/* On native Windows, map 'creat' to '_creat', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::strdup always.  */
+#  if defined _WIN32 && !defined __CYGWIN__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef strdup
+#    define strdup _strdup
+#   endif
+_GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
+#  else
+#   if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
+#    undef strdup
+#   endif
+_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
+#  endif
+_GL_CXXALIASWARN (strdup);
+# endif
+#endif
+
+/* Append no more than N characters from SRC onto DEST.  */
+#if @GNULIB_STRNCAT@
+# if @REPLACE_STRNCAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strncat
+#   define strncat rpl_strncat
+#  endif
+_GL_FUNCDECL_RPL (strncat, char *,
+                  (char *restrict dest, const char *restrict src, size_t n)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (strncat, char *,
+                  (char *restrict dest, const char *restrict src, size_t n));
+# else
+_GL_CXXALIAS_SYS (strncat, char *,
+                  (char *restrict dest, const char *restrict src, size_t n));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (strncat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strncat
+# if HAVE_RAW_DECL_STRNCAT
+_GL_WARN_ON_USE (strncat, "strncat is unportable - "
+                 "use gnulib module strncat for portability");
+# endif
+#endif
+
+/* Return a newly allocated copy of at most N bytes of STRING.  */
+#if @GNULIB_STRNDUP@
+# if @REPLACE_STRNDUP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strndup
+#   define strndup rpl_strndup
+#  endif
+_GL_FUNCDECL_RPL (strndup, char *,
+                  (char const *__s, size_t __n)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
+# else
+#  if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup)
+#   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (strndup, char *,
+                  (char const *__s, size_t __n)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   else
+_GL_FUNCDECL_SYS (strndup, char *,
+                  (char const *__s, size_t __n)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
+# endif
+_GL_CXXALIASWARN (strndup);
+#else
+# if __GNUC__ >= 11 && !defined strndup
+/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free.  */
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (strndup, char *,
+                  (char const *__s, size_t __n)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  else
+_GL_FUNCDECL_SYS (strndup, char *,
+                  (char const *__s, size_t __n)
+                  _GL_ARG_NONNULL ((1))
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef strndup
+#  if HAVE_RAW_DECL_STRNDUP
+_GL_WARN_ON_USE (strndup, "strndup is unportable - "
+                 "use gnulib module strndup for portability");
+#  endif
+# endif
+#endif
+
+/* Find the length (number of bytes) of STRING, but scan at most
+   MAXLEN bytes.  If no '\0' terminator is found in that many bytes,
+   return MAXLEN.  */
+#if @GNULIB_STRNLEN@
+# if @REPLACE_STRNLEN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strnlen
+#   define strnlen rpl_strnlen
+#  endif
+_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
+# else
+#  if ! @HAVE_DECL_STRNLEN@
+_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen));
+# endif
+_GL_CXXALIASWARN (strnlen);
+#elif defined GNULIB_POSIXCHECK
+# undef strnlen
+# if HAVE_RAW_DECL_STRNLEN
+_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
+                 "use gnulib module strnlen for portability");
+# endif
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strcspn() assumes the second argument is a list of single-byte characters.
+   Even in this simple case, it does not work with multibyte strings if the
+   locale encoding is GB18030 and one of the characters to be searched is a
+   digit.  */
+# undef strcspn
+/* Assume strcspn is always declared.  */
+_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbscspn if you care about internationalization");
+#endif
+
+/* Find the first occurrence in S of any character in ACCEPT.  */
+#if @GNULIB_STRPBRK@
+# if ! @HAVE_STRPBRK@
+_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1, 2)));
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C" { const char * strpbrk (const char *, const char *); }
+       extern "C++" { char * strpbrk (char *, const char *); }  */
+_GL_CXXALIAS_SYS_CAST2 (strpbrk,
+                        char *, (char const *__s, char const *__accept),
+                        const char *, (char const *__s, char const *__accept));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
+         || defined __clang__)
+_GL_CXXALIASWARN1 (strpbrk, char *,
+                   (char *__s, char const *__accept)
+                   _GL_ATTRIBUTE_NOTHROW);
+_GL_CXXALIASWARN1 (strpbrk, char const *,
+                   (char const *__s, char const *__accept)
+                   _GL_ATTRIBUTE_NOTHROW);
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (strpbrk);
+# endif
+# if defined GNULIB_POSIXCHECK
+/* strpbrk() assumes the second argument is a list of single-byte characters.
+   Even in this simple case, it does not work with multibyte strings if the
+   locale encoding is GB18030 and one of the characters to be searched is a
+   digit.  */
+#  undef strpbrk
+_GL_WARN_ON_USE_CXX (strpbrk,
+                     const char *, char *, (const char *, const char *),
+                     "strpbrk cannot work correctly on character strings "
+                     "in multibyte locales - "
+                     "use mbspbrk if you care about internationalization");
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strpbrk
+# if HAVE_RAW_DECL_STRPBRK
+_GL_WARN_ON_USE_CXX (strpbrk,
+                     const char *, char *, (const char *, const char *),
+                     "strpbrk is unportable - "
+                     "use gnulib module strpbrk for portability");
+# endif
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strspn() assumes the second argument is a list of single-byte characters.
+   Even in this simple case, it cannot work with multibyte strings.  */
+# undef strspn
+/* Assume strspn is always declared.  */
+_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbsspn if you care about internationalization");
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strrchr() does not work with multibyte strings if the locale encoding is
+   GB18030 and the character to be searched is a digit.  */
+# undef strrchr
+/* Assume strrchr is always declared.  */
+_GL_WARN_ON_USE_CXX (strrchr,
+                     const char *, char *, (const char *, int),
+                     "strrchr cannot work correctly on character strings "
+                     "in some multibyte locales - "
+                     "use mbsrchr if you care about internationalization");
+#endif
+
+/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
+   If one is found, overwrite it with a NUL, and advance *STRINGP
+   to point to the next char after it.  Otherwise, set *STRINGP to NULL.
+   If *STRINGP was already NULL, nothing happens.
+   Return the old value of *STRINGP.
+
+   This is a variant of strtok() that is multithread-safe and supports
+   empty fields.
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+   Caveat: It doesn't work with multibyte strings unless all of the delimiter
+           characters are ASCII characters < 0x30.
+
+   See also strtok_r().  */
+#if @GNULIB_STRSEP@
+# if ! @HAVE_STRSEP@
+_GL_FUNCDECL_SYS (strsep, char *,
+                  (char **restrict __stringp, char const *restrict __delim)
+                  _GL_ARG_NONNULL ((1, 2)));
+# endif
+_GL_CXXALIAS_SYS (strsep, char *,
+                  (char **restrict __stringp, char const *restrict __delim));
+_GL_CXXALIASWARN (strsep);
+# if defined GNULIB_POSIXCHECK
+#  undef strsep
+_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbssep if you care about internationalization");
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strsep
+# if HAVE_RAW_DECL_STRSEP
+_GL_WARN_ON_USE (strsep, "strsep is unportable - "
+                 "use gnulib module strsep for portability");
+# endif
+#endif
+
+#if @GNULIB_STRSTR@
+# if @REPLACE_STRSTR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strstr rpl_strstr
+#  endif
+_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
+                                  _GL_ATTRIBUTE_PURE
+                                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
+# else
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const char * strstr (const char *, const char *); }
+       extern "C++" { char * strstr (char *, const char *); }  */
+_GL_CXXALIAS_SYS_CAST2 (strstr,
+                        char *, (const char *haystack, const char *needle),
+                        const char *, (const char *haystack, const char *needle));
+# endif
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
+         || defined __clang__)
+_GL_CXXALIASWARN1 (strstr, char *,
+                   (char *haystack, const char *needle)
+                   _GL_ATTRIBUTE_NOTHROW);
+_GL_CXXALIASWARN1 (strstr, const char *,
+                   (const char *haystack, const char *needle)
+                   _GL_ATTRIBUTE_NOTHROW);
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (strstr);
+# endif
+#elif defined GNULIB_POSIXCHECK
+/* strstr() does not work with multibyte strings if the locale encoding is
+   different from UTF-8:
+   POSIX says that it operates on "strings", and "string" in POSIX is defined
+   as a sequence of bytes, not of characters.  */
+# undef strstr
+/* Assume strstr is always declared.  */
+_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
+                 "work correctly on character strings in most "
+                 "multibyte locales - "
+                 "use mbsstr if you care about internationalization, "
+                 "or use strstr if you care about speed");
+#endif
+
+/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
+   comparison.  */
+#if @GNULIB_STRCASESTR@
+# if @REPLACE_STRCASESTR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strcasestr rpl_strcasestr
+#  endif
+_GL_FUNCDECL_RPL (strcasestr, char *,
+                  (const char *haystack, const char *needle)
+                  _GL_ATTRIBUTE_PURE
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (strcasestr, char *,
+                  (const char *haystack, const char *needle));
+# else
+#  if ! @HAVE_STRCASESTR@
+_GL_FUNCDECL_SYS (strcasestr, char *,
+                  (const char *haystack, const char *needle)
+                  _GL_ATTRIBUTE_PURE
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const char * strcasestr (const char *, const char *); }
+       extern "C++" { char * strcasestr (char *, const char *); }  */
+_GL_CXXALIAS_SYS_CAST2 (strcasestr,
+                        char *, (const char *haystack, const char *needle),
+                        const char *, (const char *haystack, const char *needle));
+# endif
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
+         || defined __clang__)
+_GL_CXXALIASWARN1 (strcasestr, char *,
+                   (char *haystack, const char *needle)
+                   _GL_ATTRIBUTE_NOTHROW);
+_GL_CXXALIASWARN1 (strcasestr, const char *,
+                   (const char *haystack, const char *needle)
+                   _GL_ATTRIBUTE_NOTHROW);
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (strcasestr);
+# endif
+#elif defined GNULIB_POSIXCHECK
+/* strcasestr() does not work with multibyte strings:
+   It is a glibc extension, and glibc implements it only for unibyte
+   locales.  */
+# undef strcasestr
+# if HAVE_RAW_DECL_STRCASESTR
+_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasestr if you care about "
+                 "internationalization, or use c-strcasestr if you want "
+                 "a locale independent function");
+# endif
+#endif
+
+/* Parse S into tokens separated by characters in DELIM.
+   If S is NULL, the saved pointer in SAVE_PTR is used as
+   the next starting point.  For example:
+        char s[] = "-abc-=-def";
+        char *sp;
+        x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+        x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+        x = strtok_r(NULL, "=", &sp);   // x = NULL
+                // s = "abc\0-def\0"
+
+   This is a variant of strtok() that is multithread-safe.
+
+   For the POSIX documentation for this function, see:
+   https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+   Caveat: It doesn't work with multibyte strings unless all of the delimiter
+           characters are ASCII characters < 0x30.
+
+   See also strsep().  */
+#if @GNULIB_STRTOK_R@
+# if @REPLACE_STRTOK_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strtok_r
+#   define strtok_r rpl_strtok_r
+#  endif
+_GL_FUNCDECL_RPL (strtok_r, char *,
+                  (char *restrict s, char const *restrict delim,
+                   char **restrict save_ptr)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (strtok_r, char *,
+                  (char *restrict s, char const *restrict delim,
+                   char **restrict save_ptr));
+# else
+#  if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
+#   undef strtok_r
+#  endif
+#  if ! @HAVE_DECL_STRTOK_R@
+_GL_FUNCDECL_SYS (strtok_r, char *,
+                  (char *restrict s, char const *restrict delim,
+                   char **restrict save_ptr)
+                  _GL_ARG_NONNULL ((2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (strtok_r, char *,
+                  (char *restrict s, char const *restrict delim,
+                   char **restrict save_ptr));
+# endif
+_GL_CXXALIASWARN (strtok_r);
+# if defined GNULIB_POSIXCHECK
+_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbstok_r if you care about internationalization");
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtok_r
+# if HAVE_RAW_DECL_STRTOK_R
+_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
+                 "use gnulib module strtok_r for portability");
+# endif
+#endif
+
+
+/* The following functions are not specified by POSIX.  They are gnulib
+   extensions.  */
+
+#if @GNULIB_MBSLEN@
+/* Return the number of multibyte characters in the character string STRING.
+   This considers multibyte characters, unlike strlen, which counts bytes.  */
+# ifdef __MirBSD__  /* MirBSD defines mbslen as a macro.  Override it.  */
+#  undef mbslen
+# endif
+# if @HAVE_MBSLEN@  /* AIX, OSF/1, MirBSD define mbslen already in libc.  */
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mbslen rpl_mbslen
+#  endif
+_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
+                                  _GL_ATTRIBUTE_PURE
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
+# else
+_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
+                                  _GL_ATTRIBUTE_PURE
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mbslen);
+# endif
+#endif
+
+#if @GNULIB_MBSNLEN@
+/* Return the number of multibyte characters in the character string starting
+   at STRING and ending at STRING + LEN.  */
+_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
+     _GL_ATTRIBUTE_PURE
+     _GL_ARG_NONNULL ((1));
+#endif
+
+#if @GNULIB_MBSCHR@
+/* Locate the first single-byte character C in the character string STRING,
+   and return a pointer to it.  Return NULL if C is not found in STRING.
+   Unlike strchr(), this function works correctly in multibyte locales with
+   encodings such as GB18030.  */
+# if defined __hpux
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mbschr rpl_mbschr /* avoid collision with HP-UX function */
+#  endif
+_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
+                                  _GL_ATTRIBUTE_PURE
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
+# else
+_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
+                                  _GL_ATTRIBUTE_PURE
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
+# endif
+_GL_CXXALIASWARN (mbschr);
+#endif
+
+#if @GNULIB_MBSRCHR@
+/* Locate the last single-byte character C in the character string STRING,
+   and return a pointer to it.  Return NULL if C is not found in STRING.
+   Unlike strrchr(), this function works correctly in multibyte locales with
+   encodings such as GB18030.  */
+# if defined __hpux || defined __INTERIX
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mbsrchr rpl_mbsrchr /* avoid collision with system function */
+#  endif
+_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
+# else
+_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
+# endif
+_GL_CXXALIASWARN (mbsrchr);
+#endif
+
+#if @GNULIB_MBSSTR@
+/* Find the first occurrence of the character string NEEDLE in the character
+   string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
+   Unlike strstr(), this function works correctly in multibyte locales with
+   encodings different from UTF-8.  */
+_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
+     _GL_ATTRIBUTE_PURE
+     _GL_ARG_NONNULL ((1, 2));
+#endif
+
+#if @GNULIB_MBSCASECMP@
+/* Compare the character 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 may, in multibyte locales, return 0 for strings of
+   different lengths!
+   Unlike strcasecmp(), this function works correctly in multibyte locales.  */
+_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
+     _GL_ATTRIBUTE_PURE
+     _GL_ARG_NONNULL ((1, 2));
+#endif
+
+#if @GNULIB_MBSNCASECMP@
+/* Compare the initial segment of the character string S1 consisting of at most
+   N characters with the initial segment of the character string S2 consisting
+   of at most N characters, ignoring case, returning less than, equal to or
+   greater than zero if the initial segment of S1 is lexicographically less
+   than, equal to or greater than the initial segment of S2.
+   Note: This function may, in multibyte locales, return 0 for initial segments
+   of different lengths!
+   Unlike strncasecmp(), this function works correctly in multibyte locales.
+   But beware that N is not a byte count but a character count!  */
+_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
+     _GL_ATTRIBUTE_PURE
+     _GL_ARG_NONNULL ((1, 2));
+#endif
+
+#if @GNULIB_MBSPCASECMP@
+/* Compare the initial segment of the character string STRING consisting of
+   at most mbslen (PREFIX) characters with the character string PREFIX,
+   ignoring case.  If the two match, return a pointer to the first byte
+   after this prefix in STRING.  Otherwise, return NULL.
+   Note: This function may, in multibyte locales, return non-NULL if STRING
+   is of smaller length than PREFIX!
+   Unlike strncasecmp(), this function works correctly in multibyte
+   locales.  */
+_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
+     _GL_ATTRIBUTE_PURE
+     _GL_ARG_NONNULL ((1, 2));
+#endif
+
+#if @GNULIB_MBSCASESTR@
+/* Find the first occurrence of the character string NEEDLE in the character
+   string HAYSTACK, using case-insensitive comparison.
+   Note: This function may, in multibyte locales, return success even if
+   strlen (haystack) < strlen (needle) !
+   Unlike strcasestr(), this function works correctly in multibyte locales.  */
+_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
+     _GL_ATTRIBUTE_PURE
+     _GL_ARG_NONNULL ((1, 2));
+#endif
+
+#if @GNULIB_MBSCSPN@
+/* Find the first occurrence in the character string STRING of any character
+   in the character string ACCEPT.  Return the number of bytes from the
+   beginning of the string to this occurrence, or to the end of the string
+   if none exists.
+   Unlike strcspn(), this function works correctly in multibyte locales.  */
+_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
+     _GL_ATTRIBUTE_PURE
+     _GL_ARG_NONNULL ((1, 2));
+#endif
+
+#if @GNULIB_MBSPBRK@
+/* Find the first occurrence in the character string STRING of any character
+   in the character string ACCEPT.  Return the pointer to it, or NULL if none
+   exists.
+   Unlike strpbrk(), this function works correctly in multibyte locales.  */
+# if defined __hpux
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
+#  endif
+_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
+# else
+_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
+# endif
+_GL_CXXALIASWARN (mbspbrk);
+#endif
+
+#if @GNULIB_MBSSPN@
+/* Find the first occurrence in the character string STRING of any character
+   not in the character string REJECT.  Return the number of bytes from the
+   beginning of the string to this occurrence, or to the end of the string
+   if none exists.
+   Unlike strspn(), this function works correctly in multibyte locales.  */
+_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
+     _GL_ATTRIBUTE_PURE
+     _GL_ARG_NONNULL ((1, 2));
+#endif
+
+#if @GNULIB_MBSSEP@
+/* Search the next delimiter (multibyte character listed in the character
+   string DELIM) starting at the character string *STRINGP.
+   If one is found, overwrite it with a NUL, and advance *STRINGP to point
+   to the next multibyte character after it.  Otherwise, set *STRINGP to NULL.
+   If *STRINGP was already NULL, nothing happens.
+   Return the old value of *STRINGP.
+
+   This is a variant of mbstok_r() that supports empty fields.
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+
+   See also mbstok_r().  */
+_GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
+     _GL_ARG_NONNULL ((1, 2));
+#endif
+
+#if @GNULIB_MBSTOK_R@
+/* Parse the character string STRING into tokens separated by characters in
+   the character string DELIM.
+   If STRING is NULL, the saved pointer in SAVE_PTR is used as
+   the next starting point.  For example:
+        char s[] = "-abc-=-def";
+        char *sp;
+        x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+        x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+        x = mbstok_r(NULL, "=", &sp);   // x = NULL
+                // s = "abc\0-def\0"
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+
+   See also mbssep().  */
+_GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
+                              char **save_ptr)
+     _GL_ARG_NONNULL ((2, 3));
+#endif
+
+/* Map any int, typically from errno, into an error message.  */
+#if @GNULIB_STRERROR@
+# if @REPLACE_STRERROR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strerror
+#   define strerror rpl_strerror
+#  endif
+_GL_FUNCDECL_RPL (strerror, char *, (int));
+_GL_CXXALIAS_RPL (strerror, char *, (int));
+# else
+_GL_CXXALIAS_SYS (strerror, char *, (int));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (strerror);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strerror
+/* Assume strerror is always declared.  */
+_GL_WARN_ON_USE (strerror, "strerror is unportable - "
+                 "use gnulib module strerror to guarantee non-NULL result");
+#endif
+
+/* Map any int, typically from errno, into an error message.  Multithread-safe.
+   Uses the POSIX declaration, not the glibc declaration.  */
+#if @GNULIB_STRERROR_R@
+# if @REPLACE_STRERROR_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strerror_r
+#   define strerror_r rpl_strerror_r
+#  endif
+_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
+                                   _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
+# else
+#  if !@HAVE_DECL_STRERROR_R@
+_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
+                                   _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
+# endif
+# if __GLIBC__ >= 2 && @HAVE_DECL_STRERROR_R@
+_GL_CXXALIASWARN (strerror_r);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strerror_r
+# if HAVE_RAW_DECL_STRERROR_R
+_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
+                 "use gnulib module strerror_r-posix for portability");
+# endif
+#endif
+
+/* Return the name of the system error code ERRNUM.  */
+#if @GNULIB_STRERRORNAME_NP@
+# if @REPLACE_STRERRORNAME_NP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strerrorname_np
+#   define strerrorname_np rpl_strerrorname_np
+#  endif
+_GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum));
+_GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum));
+# else
+#  if !@HAVE_STRERRORNAME_NP@
+_GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum));
+#  endif
+_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
+# endif
+_GL_CXXALIASWARN (strerrorname_np);
+#elif defined GNULIB_POSIXCHECK
+# undef strerrorname_np
+# if HAVE_RAW_DECL_STRERRORNAME_NP
+_GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - "
+                 "use gnulib module strerrorname_np for portability");
+# endif
+#endif
+
+/* Return an abbreviation string for the signal number SIG.  */
+#if @GNULIB_SIGABBREV_NP@
+# if ! @HAVE_SIGABBREV_NP@
+_GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig));
+# endif
+_GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig));
+_GL_CXXALIASWARN (sigabbrev_np);
+#elif defined GNULIB_POSIXCHECK
+# undef sigabbrev_np
+# if HAVE_RAW_DECL_SIGABBREV_NP
+_GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - "
+                 "use gnulib module sigabbrev_np for portability");
+# endif
+#endif
+
+/* Return an English description string for the signal number SIG.  */
+#if @GNULIB_SIGDESCR_NP@
+# if ! @HAVE_SIGDESCR_NP@
+_GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig));
+# endif
+_GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig));
+_GL_CXXALIASWARN (sigdescr_np);
+#elif defined GNULIB_POSIXCHECK
+# undef sigdescr_np
+# if HAVE_RAW_DECL_SIGDESCR_NP
+_GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - "
+                 "use gnulib module sigdescr_np for portability");
+# endif
+#endif
+
+#if @GNULIB_STRSIGNAL@
+# if @REPLACE_STRSIGNAL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strsignal rpl_strsignal
+#  endif
+_GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
+_GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
+# else
+#  if ! @HAVE_DECL_STRSIGNAL@
+_GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
+#  endif
+/* Need to cast, because on Cygwin 1.5.x systems, the return type is
+   'const char *'.  */
+_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
+# endif
+_GL_CXXALIASWARN (strsignal);
+#elif defined GNULIB_POSIXCHECK
+# undef strsignal
+# if HAVE_RAW_DECL_STRSIGNAL
+_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
+                 "use gnulib module strsignal for portability");
+# endif
+#endif
+
+#if @GNULIB_STRVERSCMP@
+# if @REPLACE_STRVERSCMP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strverscmp rpl_strverscmp
+#  endif
+_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *));
+# else
+#  if !@HAVE_STRVERSCMP@
+_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
+                                   _GL_ATTRIBUTE_PURE
+                                   _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
+# endif
+_GL_CXXALIASWARN (strverscmp);
+#elif defined GNULIB_POSIXCHECK
+# undef strverscmp
+# if HAVE_RAW_DECL_STRVERSCMP
+_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
+                 "use gnulib module strverscmp for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_STRING_H */
+#endif /* _@GUARD_PREFIX@_STRING_H */
+#endif
deleted file mode 120000 (symlink)
index 83082f1c09f4fecd09ab676680ebe134b6383982..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/stripslash.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c127ce7e6308010b77f2c53c128be3281e37db91
--- /dev/null
@@ -0,0 +1,45 @@
+/* stripslash.c -- remove redundant trailing slashes from a file name
+
+   Copyright (C) 1990, 2001, 2003-2006, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "dirname.h"
+
+/* Remove trailing slashes from FILE.  Return true if a trailing slash
+   was removed.  This is useful when using file name completion from a
+   shell that adds a "/" after directory names (such as tcsh and
+   bash), because on symlinks to directories, several system calls
+   have different semantics according to whether a trailing slash is
+   present.  */
+
+bool
+strip_trailing_slashes (char *file)
+{
+  char *base = last_component (file);
+  char *base_lim;
+  bool had_slash;
+
+  /* last_component returns "" for file system roots, but we need to turn
+     "///" into "/".  */
+  if (! *base)
+    base = file;
+  base_lim = base + base_len (base);
+  had_slash = (*base_lim != '\0');
+  *base_lim = '\0';
+  return had_slash;
+}
deleted file mode 120000 (symlink)
index f53648dfbde73010812d76ae391a0365913e1492..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strnlen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..80857ec22b038fc51f2d2ad304e7aab35af0ff3c
--- /dev/null
@@ -0,0 +1,30 @@
+/* Find the length of STRING, but scan at most MAXLEN characters.
+   Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <string.h>
+
+/* Find the length of STRING, but scan at most MAXLEN characters.
+   If no '\0' terminator is found in that many characters, return MAXLEN.  */
+
+size_t
+strnlen (const char *string, size_t maxlen)
+{
+  const char *end = memchr (string, '\0', maxlen);
+  return end ? (size_t) (end - string) : maxlen;
+}
deleted file mode 120000 (symlink)
index d6e37963f72394304d2e197294bd123829eed34c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strnlen1.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..27c832ad7d76f423b4b0fccc23dfc6f67d7c673c
--- /dev/null
@@ -0,0 +1,35 @@
+/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "strnlen1.h"
+
+#include <string.h>
+
+/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
+   If no '\0' terminator is found in that many characters, return MAXLEN.  */
+/* This is the same as strnlen (string, maxlen - 1) + 1.  */
+size_t
+strnlen1 (const char *string, size_t maxlen)
+{
+  const char *end = (const char *) memchr (string, '\0', maxlen);
+  if (end != NULL)
+    return end - string + 1;
+  else
+    return maxlen;
+}
deleted file mode 120000 (symlink)
index 202f9def7996044c59a9cf9b91db33ba52bc9706..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strnlen1.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8943f3edff1e96b2509b91b6bb09ba68621fba38
--- /dev/null
@@ -0,0 +1,45 @@
+/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _STRNLEN1_H
+#define _STRNLEN1_H
+
+/* This file uses _GL_ATTRIBUTE_PURE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
+   If no '\0' terminator is found in that many characters, return MAXLEN.  */
+/* This is the same as strnlen (string, maxlen - 1) + 1.  */
+extern size_t strnlen1 (const char *string, size_t maxlen)
+  _GL_ATTRIBUTE_PURE;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _STRNLEN1_H */
deleted file mode 120000 (symlink)
index 0f888232a2f3af664e22c77929954572f7c95eba..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strsignal.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dc7415bf3218752df8ddaf023a6af59de0368776
--- /dev/null
@@ -0,0 +1,200 @@
+/* Copyright (C) 1991, 1994-2002, 2005, 2008-2024 Free Software Foundation,
+   Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include <string.h>
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef _LIBC
+# include <libintl.h>
+#else /* !_LIBC */
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+# define N_(msgid) gettext_noop (msgid)
+#endif /* _LIBC */
+
+#ifdef _LIBC
+# include <bits/libc-lock.h>
+#else /* !_LIBC */
+# include "glthread/lock.h"
+# include "glthread/tls.h"
+# define __libc_once_define(CLASS, NAME) gl_once_define (CLASS, NAME)
+# define __libc_once(NAME, INIT) gl_once ((NAME), (INIT))
+# define __libc_key_t gl_tls_key_t
+# define __libc_getspecific(NAME) gl_tls_get ((NAME))
+# define __libc_setspecific(NAME, POINTER) gl_tls_set ((NAME), (POINTER))
+# define __snprintf snprintf
+#endif /* _LIBC */
+
+#ifdef _LIBC
+
+/* Defined in siglist.c.  */
+extern const char *const _sys_siglist[];
+extern const char *const _sys_siglist_internal[] attribute_hidden;
+
+#else /* !_LIBC */
+
+/* NetBSD declares sys_siglist in unistd.h. */
+# if HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
+
+# define INTUSE(x) (x)
+
+# if HAVE_DECL_SYS_SIGLIST
+#  undef _sys_siglist
+#  define _sys_siglist sys_siglist
+# else /* !HAVE_DECL_SYS_SIGLIST */
+#  ifndef NSIG
+#   define NSIG 32
+#  endif /* NSIG */
+#  if !HAVE_DECL__SYS_SIGLIST
+static const char *_sys_siglist[NSIG];
+#  endif
+# endif /* !HAVE_DECL_SYS_SIGLIST */
+
+#endif /* _LIBC */
+
+static __libc_key_t key;
+
+/* If nonzero the key allocation failed and we should better use a
+   static buffer than fail.  */
+#define BUFFERSIZ       100
+static char local_buf[BUFFERSIZ];
+static char *static_buf;
+
+/* Destructor for the thread-specific data.  */
+static void init (void);
+static void free_key_mem (void *mem);
+static char *getbuffer (void);
+
+
+/* Return a string describing the meaning of the signal number SIGNUM.  */
+char *
+strsignal (int signum)
+{
+  const char *desc;
+  __libc_once_define (static, once);
+
+  /* If we have not yet initialized the buffer do it now.  */
+  __libc_once (once, init);
+
+  if (
+#ifdef SIGRTMIN
+      (signum >= SIGRTMIN && signum <= SIGRTMAX) ||
+#endif
+      signum < 0 || signum >= NSIG
+      || (desc = INTUSE(_sys_siglist)[signum]) == NULL)
+    {
+      char *buffer = getbuffer ();
+      int len;
+#ifdef SIGRTMIN
+      if (signum >= SIGRTMIN && signum <= SIGRTMAX)
+        len = __snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"),
+                          signum - (int) SIGRTMIN);
+      else
+#endif
+        len = __snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"),
+                          signum);
+      if (len >= BUFFERSIZ)
+        buffer = NULL;
+      else
+        buffer[len] = '\0';
+
+      return buffer;
+    }
+
+  return (char *) _(desc);
+}
+
+
+/* Initialize buffer.  */
+static void
+init (void)
+{
+#ifdef _LIBC
+  if (__libc_key_create (&key, free_key_mem))
+    /* Creating the key failed.  This means something really went
+       wrong.  In any case use a static buffer which is better than
+       nothing.  */
+    static_buf = local_buf;
+#else /* !_LIBC */
+  gl_tls_key_init (key, free_key_mem);
+
+# if !HAVE_DECL_SYS_SIGLIST
+  memset (_sys_siglist, 0, NSIG * sizeof *_sys_siglist);
+
+  /* No need to use a do {} while (0) here since init_sig(...) must expand
+     to a complete statement.  (We cannot use the ISO C99 designated array
+     initializer syntax since it is not supported by ANSI C compilers and
+     since some signal numbers might exceed NSIG.)  */
+#  define init_sig(sig, abbrev, desc) \
+  if (sig >= 0 && sig < NSIG) \
+    _sys_siglist[sig] = desc;
+
+#  include "siglist.h"
+
+#  undef init_sig
+
+# endif /* !HAVE_DECL_SYS_SIGLIST */
+#endif /* !_LIBC */
+}
+
+
+/* Free the thread specific data, this is done if a thread terminates.  */
+static void
+free_key_mem (void *mem)
+{
+  free (mem);
+  __libc_setspecific (key, NULL);
+}
+
+
+/* Return the buffer to be used.  */
+static char *
+getbuffer (void)
+{
+  char *result;
+
+  if (static_buf != NULL)
+    result = static_buf;
+  else
+    {
+      /* We don't use the static buffer and so we have a key.  Use it
+         to get the thread-specific buffer.  */
+      result = __libc_getspecific (key);
+      if (result == NULL)
+        {
+          /* No buffer allocated so far.  */
+          result = malloc (BUFFERSIZ);
+          if (result == NULL)
+            /* No more memory available.  We use the static buffer.  */
+            result = local_buf;
+          else
+            __libc_setspecific (key, result);
+        }
+    }
+
+  return result;
+}
deleted file mode 120000 (symlink)
index ea9bc440d5480935f570031df2027cb0c943c6e4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strstr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7ea28603978f3803f78952e3f7b239fe83b87bdb
--- /dev/null
@@ -0,0 +1,76 @@
+/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2024 Free Software
+   Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This particular implementation was written by Eric Blake, 2008.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+/* Specification of strstr.  */
+#include <string.h>
+
+#define RETURN_TYPE char *
+#define AVAILABLE(h, h_l, j, n_l)                       \
+  (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l))     \
+   && ((h_l) = (j) + (n_l)))
+#include "str-two-way.h"
+
+/* Return the first occurrence of NEEDLE in HAYSTACK.  Return HAYSTACK
+   if NEEDLE is empty, otherwise NULL if NEEDLE is not found in
+   HAYSTACK.  */
+char *
+strstr (const char *haystack_start, const char *needle_start)
+{
+  const char *haystack = haystack_start;
+  const char *needle = needle_start;
+  size_t needle_len; /* Length of NEEDLE.  */
+  size_t haystack_len; /* Known minimum length of HAYSTACK.  */
+  bool ok = true; /* True if NEEDLE is prefix of HAYSTACK.  */
+
+  /* Determine length of NEEDLE, and in the process, make sure
+     HAYSTACK is at least as long (no point processing all of a long
+     NEEDLE if HAYSTACK is too short).  */
+  while (*haystack && *needle)
+    ok &= *haystack++ == *needle++;
+  if (*needle)
+    return NULL;
+  if (ok)
+    return (char *) haystack_start;
+
+  /* Reduce the size of haystack using strchr, since it has a smaller
+     linear coefficient than the Two-Way algorithm.  */
+  needle_len = needle - needle_start;
+  haystack = strchr (haystack_start + 1, *needle_start);
+  if (!haystack || __builtin_expect (needle_len == 1, 0))
+    return (char *) haystack;
+  needle -= needle_len;
+  haystack_len = (haystack > haystack_start + needle_len ? 1
+                  : needle_len + haystack_start - haystack);
+
+  /* Perform the search.  Abstract memory is considered to be an array
+     of 'unsigned char' values, not an array of 'char' values.  See
+     ISO C 99 section 6.2.6.1.  */
+  if (needle_len < LONG_NEEDLE_THRESHOLD)
+    return two_way_short_needle ((const unsigned char *) haystack,
+                                 haystack_len,
+                                 (const unsigned char *) needle, needle_len);
+  return two_way_long_needle ((const unsigned char *) haystack, haystack_len,
+                              (const unsigned char *) needle, needle_len);
+}
+
+#undef LONG_NEEDLE_THRESHOLD
deleted file mode 120000 (symlink)
index 575b5e619604254f7968553fbf41bc4c2f69a76f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strtoimax.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1bc62621ec5b202004b67adb703a8461dd4c749c
--- /dev/null
@@ -0,0 +1,70 @@
+/* Convert string representation of a number into an intmax_t value.
+
+   Copyright (C) 1999, 2001-2004, 2006, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert. */
+
+#include <config.h>
+
+/* Verify interface.  */
+#include <inttypes.h>
+
+#include <stdlib.h>
+
+#ifdef UNSIGNED
+# ifndef HAVE_DECL_STRTOULL
+"this configure-time declaration test was not run"
+# endif
+# if !HAVE_DECL_STRTOULL
+unsigned long long int strtoull (char const *, char **, int);
+# endif
+
+#else
+
+# ifndef HAVE_DECL_STRTOLL
+"this configure-time declaration test was not run"
+# endif
+# if !HAVE_DECL_STRTOLL
+long long int strtoll (char const *, char **, int);
+# endif
+#endif
+
+#ifdef UNSIGNED
+# define Int uintmax_t
+# define Strtoimax strtoumax
+# define Strtol strtoul
+# define Strtoll strtoull
+# define Unsigned unsigned
+#else
+# define Int intmax_t
+# define Strtoimax strtoimax
+# define Strtol strtol
+# define Strtoll strtoll
+# define Unsigned
+#endif
+
+Int
+Strtoimax (char const *ptr, char **endptr, int base)
+{
+  static_assert (sizeof (Int) == sizeof (Unsigned long int)
+                 || sizeof (Int) == sizeof (Unsigned long long int));
+
+  if (sizeof (Int) != sizeof (Unsigned long int))
+    return Strtoll (ptr, endptr, base);
+
+  return Strtol (ptr, endptr, base);
+}
deleted file mode 120000 (symlink)
index 6929f61c199f32995353b524b18d1a6522115d37..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strtol.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..914cf5b57abeaeb83ec387bb13f361b630619e9f
--- /dev/null
@@ -0,0 +1,416 @@
+/* Convert string representation of a number into an integer value.
+
+   Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   NOTE: The canonical source of this file is maintained with the GNU C
+   Library.  Bugs can be reported to bug-glibc@gnu.org.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifdef _LIBC
+# define USE_NUMBER_GROUPING
+#else
+# include <config.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef USE_NUMBER_GROUPING
+# include "../locale/localeinfo.h"
+#endif
+
+/* Nonzero if we are defining 'strtoul' or 'strtoull', operating on
+   unsigned integers.  */
+#ifndef UNSIGNED
+# define UNSIGNED 0
+# define INT LONG int
+#else
+# define INT unsigned LONG int
+#endif
+
+/* Determine the name.  */
+#ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# undef strtol
+# if UNSIGNED
+#  ifdef USE_WIDE_CHAR
+#   ifdef QUAD
+#    define strtol __wcstoull_l
+#   else
+#    define strtol __wcstoul_l
+#   endif
+#  else
+#   ifdef QUAD
+#    define strtol __strtoull_l
+#   else
+#    define strtol __strtoul_l
+#   endif
+#  endif
+# else
+#  ifdef USE_WIDE_CHAR
+#   ifdef QUAD
+#    define strtol __wcstoll_l
+#   else
+#    define strtol __wcstol_l
+#   endif
+#  else
+#   ifdef QUAD
+#    define strtol __strtoll_l
+#   else
+#    define strtol __strtol_l
+#   endif
+#  endif
+# endif
+#else
+# if UNSIGNED
+#  undef strtol
+#  ifdef USE_WIDE_CHAR
+#   ifdef QUAD
+#    define strtol wcstoull
+#   else
+#    define strtol wcstoul
+#   endif
+#  else
+#   ifdef QUAD
+#    define strtol strtoull
+#   else
+#    define strtol strtoul
+#   endif
+#  endif
+# else
+#  ifdef USE_WIDE_CHAR
+#   undef strtol
+#   ifdef QUAD
+#    define strtol wcstoll
+#   else
+#    define strtol wcstol
+#   endif
+#  else
+#   ifdef QUAD
+#    undef strtol
+#    define strtol strtoll
+#   endif
+#  endif
+# endif
+#endif
+
+/* If QUAD is defined, we are defining 'strtoll' or 'strtoull',
+   operating on 'long long int's.  */
+#ifdef QUAD
+# define LONG long long
+# define STRTOL_LONG_MIN LLONG_MIN
+# define STRTOL_LONG_MAX LLONG_MAX
+# define STRTOL_ULONG_MAX ULLONG_MAX
+# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
+   /* Work around gcc bug with using this constant.  */
+   static const unsigned long long int maxquad = ULLONG_MAX;
+#  undef STRTOL_ULONG_MAX
+#  define STRTOL_ULONG_MAX maxquad
+# endif
+#else
+# define LONG long
+# define STRTOL_LONG_MIN LONG_MIN
+# define STRTOL_LONG_MAX LONG_MAX
+# define STRTOL_ULONG_MAX ULONG_MAX
+#endif
+
+
+#ifdef USE_NUMBER_GROUPING
+# define GROUP_PARAM_PROTO , int group
+#else
+# define GROUP_PARAM_PROTO
+#endif
+
+/* We use this code also for the extended locale handling where the
+   function gets as an additional argument the locale which has to be
+   used.  To access the values we have to redefine the _NL_CURRENT
+   macro.  */
+#ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# undef _NL_CURRENT
+# define _NL_CURRENT(category, item) \
+  (current->values[_NL_ITEM_INDEX (item)].string)
+# define LOCALE_PARAM , loc
+# define LOCALE_PARAM_PROTO , __locale_t loc
+#else
+# define LOCALE_PARAM
+# define LOCALE_PARAM_PROTO
+#endif
+
+#ifdef USE_WIDE_CHAR
+# include <wchar.h>
+# include <wctype.h>
+# define L_(Ch) L##Ch
+# define UCHAR_TYPE wint_t
+# define STRING_TYPE wchar_t
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+#  define ISSPACE(Ch) __iswspace_l ((Ch), loc)
+#  define ISALPHA(Ch) __iswalpha_l ((Ch), loc)
+#  define TOUPPER(Ch) __towupper_l ((Ch), loc)
+# else
+#  define ISSPACE(Ch) iswspace (Ch)
+#  define ISALPHA(Ch) iswalpha (Ch)
+#  define TOUPPER(Ch) towupper (Ch)
+# endif
+#else
+# define L_(Ch) Ch
+# define UCHAR_TYPE unsigned char
+# define STRING_TYPE char
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+#  define ISSPACE(Ch) __isspace_l ((unsigned char) (Ch), loc)
+#  define ISALPHA(Ch) __isalpha_l ((unsigned char) (Ch), loc)
+#  define TOUPPER(Ch) __toupper_l ((unsigned char) (Ch), loc)
+# else
+#  define ISSPACE(Ch) isspace ((unsigned char) (Ch))
+#  define ISALPHA(Ch) isalpha ((unsigned char) (Ch))
+#  define TOUPPER(Ch) toupper ((unsigned char) (Ch))
+# endif
+#endif
+
+#ifdef USE_NUMBER_GROUPING
+# define INTERNAL(X) INTERNAL1(X)
+# define INTERNAL1(X) __##X##_internal
+# define WEAKNAME(X) WEAKNAME1(X)
+#else
+# define INTERNAL(X) X
+#endif
+
+#ifdef USE_NUMBER_GROUPING
+/* This file defines a function to check for correct grouping.  */
+# include "grouping.h"
+#endif
+
+
+
+/* Convert NPTR to an 'unsigned long int' or 'long int' in base BASE.
+   If BASE is 0 the base is determined by the presence of a leading
+   zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
+   If BASE is < 2 or > 36, it is reset to 10.
+   If ENDPTR is not NULL, a pointer to the character after the last
+   one converted is stored in *ENDPTR.  */
+
+INT
+INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
+                   int base GROUP_PARAM_PROTO LOCALE_PARAM_PROTO)
+{
+  int negative;
+  register unsigned LONG int cutoff;
+  register unsigned int cutlim;
+  register unsigned LONG int i;
+  register const STRING_TYPE *s;
+  register UCHAR_TYPE c;
+  const STRING_TYPE *save, *end;
+  int overflow;
+
+#ifdef USE_NUMBER_GROUPING
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+  struct locale_data *current = loc->__locales[LC_NUMERIC];
+# endif
+  /* The thousands character of the current locale.  */
+  wchar_t thousands = L'\0';
+  /* The numeric grouping specification of the current locale,
+     in the format described in <locale.h>.  */
+  const char *grouping;
+
+  if (group)
+    {
+      grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
+      if (*grouping <= 0 || *grouping == CHAR_MAX)
+        grouping = NULL;
+      else
+        {
+          /* Figure out the thousands separator character.  */
+# if defined _LIBC || defined _HAVE_BTOWC
+          thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP));
+          if (thousands == WEOF)
+            thousands = L'\0';
+# endif
+          if (thousands == L'\0')
+            grouping = NULL;
+        }
+    }
+  else
+    grouping = NULL;
+#endif
+
+  if (base < 0 || base == 1 || base > 36)
+    {
+      __set_errno (EINVAL);
+      return 0;
+    }
+
+  save = s = nptr;
+
+  /* Skip white space.  */
+  while (ISSPACE (*s))
+    ++s;
+  if (*s == L_('\0'))
+    goto noconv;
+
+  /* Check for a sign.  */
+  if (*s == L_('-'))
+    {
+      negative = 1;
+      ++s;
+    }
+  else if (*s == L_('+'))
+    {
+      negative = 0;
+      ++s;
+    }
+  else
+    negative = 0;
+
+  /* Recognize number prefix and if BASE is zero, figure it out ourselves.  */
+  if (*s == L_('0'))
+    {
+      if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))
+        {
+          s += 2;
+          base = 16;
+        }
+      else if ((base == 0 || base == 2) && TOUPPER (s[1]) == L_('B'))
+        {
+          s += 2;
+          base = 2;
+        }
+      else if (base == 0)
+        base = 8;
+    }
+  else if (base == 0)
+    base = 10;
+
+  /* Save the pointer so we can check later if anything happened.  */
+  save = s;
+
+#ifdef USE_NUMBER_GROUPING
+  if (group)
+    {
+      /* Find the end of the digit string and check its grouping.  */
+      end = s;
+      for (c = *end; c != L_('\0'); c = *++end)
+        if ((wchar_t) c != thousands
+            && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9'))
+            && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base))
+          break;
+      if (*s == thousands)
+        end = s;
+      else
+        end = correctly_grouped_prefix (s, end, thousands, grouping);
+    }
+  else
+#endif
+    end = NULL;
+
+  cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base;
+  cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base;
+
+  overflow = 0;
+  i = 0;
+  for (c = *s; c != L_('\0'); c = *++s)
+    {
+      if (s == end)
+        break;
+      if (c >= L_('0') && c <= L_('9'))
+        c -= L_('0');
+      else if (ISALPHA (c))
+        c = TOUPPER (c) - L_('A') + 10;
+      else
+        break;
+      if ((int) c >= base)
+        break;
+      /* Check for overflow.  */
+      if (i > cutoff || (i == cutoff && c > cutlim))
+        overflow = 1;
+      else
+        {
+          i *= (unsigned LONG int) base;
+          i += c;
+        }
+    }
+
+  /* Check if anything actually happened.  */
+  if (s == save)
+    goto noconv;
+
+  /* Store in ENDPTR the address of one character
+     past the last character we converted.  */
+  if (endptr != NULL)
+    *endptr = (STRING_TYPE *) s;
+
+#if !UNSIGNED
+  /* Check for a value that is within the range of
+     'unsigned LONG int', but outside the range of 'LONG int'.  */
+  if (overflow == 0
+      && i > (negative
+              ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
+              : (unsigned LONG int) STRTOL_LONG_MAX))
+    overflow = 1;
+#endif
+
+  if (overflow)
+    {
+      __set_errno (ERANGE);
+#if UNSIGNED
+      return STRTOL_ULONG_MAX;
+#else
+      return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX;
+#endif
+    }
+
+  /* Return the result of the appropriate sign.  */
+  return negative ? -i : i;
+
+noconv:
+  /* We must handle a special case here: the base is 0 or 16 and the
+     first two characters are '0' and 'x', but the rest are no
+     hexadecimal digits.  Likewise when the base is 0 or 2 and the
+     first two characters are '0' and 'b', but the rest are no binary
+     digits.  This is no error case.  We return 0 and ENDPTR points to
+     the 'x' or 'b'.  */
+  if (endptr != NULL)
+    {
+      if (save - nptr >= 2
+          && (TOUPPER (save[-1]) == L_('X') || TOUPPER (save[-1]) == L_('B'))
+          && save[-2] == L_('0'))
+        *endptr = (STRING_TYPE *) &save[-1];
+      else
+        /*  There was no number to convert.  */
+        *endptr = (STRING_TYPE *) nptr;
+    }
+
+  return 0L;
+}
+\f
+#ifdef USE_NUMBER_GROUPING
+/* External user entry point.  */
+
+INT
+# ifdef weak_function
+weak_function
+# endif
+strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr,
+        int base LOCALE_PARAM_PROTO)
+{
+  return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);
+}
+#endif
deleted file mode 120000 (symlink)
index cabe2ff34efbf9b8c5b2e83895e25897e101acf3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strtoll.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d3f5e47fc123e6db404cc052d4e5c145b8611a6a
--- /dev/null
@@ -0,0 +1,33 @@
+/* Function to parse a 'long long int' from text.
+   Copyright (C) 1995-1997, 1999, 2001, 2009-2024 Free Software Foundation,
+   Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define QUAD    1
+
+#include <strtol.c>
+
+#ifdef _LIBC
+# ifdef SHARED
+#  include <shlib-compat.h>
+
+#  if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0);
+#  endif
+
+# endif
+weak_alias (strtoll, strtoq)
+#endif
deleted file mode 120000 (symlink)
index ec6f6aa862d3b7ee9eb4096f7e094c43f642c98e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strtoul.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5d00118f62389df8868d3a3a40fb480b1b3c3bd3
--- /dev/null
@@ -0,0 +1,19 @@
+/* Copyright (C) 1991, 1997, 2009-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define UNSIGNED        1
+
+#include "strtol.c"
deleted file mode 120000 (symlink)
index e810ceb5633a55b9667ae08a571ed71b5b26acc6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strtoull.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7158b3559eb5af46b1a1a468940fe3b412083687
--- /dev/null
@@ -0,0 +1,26 @@
+/* Function to parse an 'unsigned long long int' from text.
+   Copyright (C) 1995-1997, 1999, 2009-2024 Free Software Foundation, Inc.
+   NOTE: The canonical source of this file is maintained with the GNU C
+   Library.  Bugs can be reported to bug-glibc@gnu.org.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define QUAD 1
+
+#include "strtoul.c"
+
+#ifdef _LIBC
+strong_alias (__strtoull_internal, __strtouq_internal)
+weak_alias (strtoull, strtouq)
+#endif
deleted file mode 120000 (symlink)
index 820b86ffa0710c7926c4470cf520a100a69e7146..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/strtoumax.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ca6cc02ed8accc65aa9df709f3354009abc59b31
--- /dev/null
@@ -0,0 +1,19 @@
+/* Convert string representation of a number into a uintmax_t value.
+
+   Copyright (C) 1999-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define UNSIGNED 1
+#include "strtoimax.c"
deleted file mode 120000 (symlink)
index 7702e368ba76be43c96cb5feab6a30037eaa6771..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/symlink.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6ba83666e17ed9a291376aa0073c08e2814cb0d7
--- /dev/null
@@ -0,0 +1,57 @@
+/* Stub for symlink().
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+
+
+#if HAVE_SYMLINK
+
+# undef symlink
+
+/* Create a symlink, but reject trailing slash.  */
+int
+rpl_symlink (char const *contents, char const *name)
+{
+  size_t len = strlen (name);
+  if (len && name[len - 1] == '/')
+    {
+      struct stat st;
+      if (lstat (name, &st) == 0 || errno == EOVERFLOW)
+        errno = EEXIST;
+      return -1;
+    }
+  return symlink (contents, name);
+}
+
+#else /* !HAVE_SYMLINK */
+
+/* The system does not support symlinks.  */
+int
+symlink (_GL_UNUSED char const *contents,
+         _GL_UNUSED char const *name)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#endif /* !HAVE_SYMLINK */
deleted file mode 120000 (symlink)
index 1c4d6a28309485fb52fe959df1f79cbe58914d91..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/symlinkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..920001a6fa0fa03ab334f772b58156c1629cf93c
--- /dev/null
@@ -0,0 +1,101 @@
+/* Create a symlink relative to an open directory.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+
+#if HAVE_SYMLINKAT
+# undef symlinkat
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <string.h>
+
+/* Create a symlink, but reject trailing slash.  */
+int
+rpl_symlinkat (char const *contents, int fd, char const *name)
+{
+  size_t len = strlen (name);
+  if (len && name[len - 1] == '/')
+    {
+      struct stat st;
+      if (fstatat (fd, name, &st, AT_SYMLINK_NOFOLLOW) == 0
+          || errno == EOVERFLOW)
+        errno = EEXIST;
+      return -1;
+    }
+  return symlinkat (contents, fd, name);
+}
+
+#elif !HAVE_SYMLINK
+/* Mingw lacks symlink, and it is more efficient to provide a trivial
+   wrapper than to go through at-func.c to call rpl_symlink.  */
+
+int
+symlinkat (_GL_UNUSED char const *path1, _GL_UNUSED int fd,
+           _GL_UNUSED char const *path2)
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+#else /* HAVE_SYMLINK */
+
+/* Our openat helper functions expect the directory parameter first,
+   not second.  These shims make life easier.  */
+
+/* Like symlink, but with arguments reversed.  */
+static int
+symlink_reversed (char const *file, char const *contents)
+{
+  return symlink (contents, file);
+}
+
+/* Like symlinkat, but with arguments reversed.  */
+
+static int
+symlinkat_reversed (int fd, char const *file, char const *contents);
+
+# define AT_FUNC_NAME symlinkat_reversed
+# define AT_FUNC_F1 symlink_reversed
+# define AT_FUNC_POST_FILE_PARAM_DECLS , char const *contents
+# define AT_FUNC_POST_FILE_ARGS        , contents
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+/* Create a symlink FILE, in the directory open on descriptor FD,
+   holding CONTENTS.  If possible, do it without changing the
+   working directory.  Otherwise, resort to using save_cwd/fchdir,
+   then symlink/restore_cwd.  If either the save_cwd or the restore_cwd
+   fails, then give a diagnostic and exit nonzero.  */
+
+int
+symlinkat (char const *contents, int fd, char const *file)
+{
+  return symlinkat_reversed (fd, file, contents);
+}
+
+#endif /* HAVE_SYMLINK */
deleted file mode 120000 (symlink)
index b337ddff48d73a9c6673e148990e4ced1faf0768..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys-limits.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d2f29d808d6c12800e844e6d28cfb2d39378a933
--- /dev/null
@@ -0,0 +1,42 @@
+/* System call limits
+
+   Copyright 2018-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_SYS_LIMITS_H
+#define _GL_SYS_LIMITS_H
+
+#include <limits.h>
+
+/* Maximum number of bytes to read or write in a single system call.
+   This can be useful for system calls like sendfile on GNU/Linux,
+   which do not handle more than MAX_RW_COUNT bytes correctly.
+   The Linux kernel MAX_RW_COUNT is at least INT_MAX >> 20 << 20,
+   where the 20 comes from the Hexagon port with 1 MiB pages; use that
+   as an approximation, as the exact value may not be available to us.
+
+   Using this also works around a serious Linux bug before 2.6.16; see
+   <https://bugzilla.redhat.com/show_bug.cgi?id=612839>.
+
+   Using this also works around a Tru64 5.1 bug, where attempting
+   to read INT_MAX bytes fails with errno == EINVAL.  See
+   <https://lists.gnu.org/r/bug-gnu-utils/2002-04/msg00010.html>.
+
+   Using this is likely to work around similar bugs in other operating
+   systems.  */
+
+enum { SYS_BUFSIZE_MAX = INT_MAX >> 20 << 20 };
+
+#endif
deleted file mode 120000 (symlink)
index 80f214296e52e14f36f1895a7094f6a5353d5b2f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_ioctl.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..787d35f75bd52e48f7f1c510bf0b0a66b4446c9d
--- /dev/null
@@ -0,0 +1,86 @@
+/* Substitute for and wrapper around <sys/ioctl.h>.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_SYS_IOCTL_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_SYS_IOCTL_H@
+# @INCLUDE_NEXT@ @NEXT_SYS_IOCTL_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_IOCTL_H
+#define _@GUARD_PREFIX@_SYS_IOCTL_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>,
+   but not in <sys/ioctl.h>.
+   Haiku declares ioctl() in <unistd.h>, but not in <sys/ioctl.h>.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <unistd.h>
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Declare overridden functions.  */
+
+#if @GNULIB_IOCTL@
+# if @REPLACE_IOCTL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ioctl
+#   define ioctl rpl_ioctl
+#  endif
+_GL_FUNCDECL_RPL (ioctl, int,
+                  (int fd, int request, ... /* {void *,char *} arg */));
+_GL_CXXALIAS_RPL (ioctl, int,
+                  (int fd, int request, ... /* {void *,char *} arg */));
+# else
+#  if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || 1
+_GL_FUNCDECL_SYS (ioctl, int,
+                  (int fd, int request, ... /* {void *,char *} arg */));
+#  endif
+_GL_CXXALIAS_SYS (ioctl, int,
+                  (int fd, int request, ... /* {void *,char *} arg */));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (ioctl);
+# endif
+#elif @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
+# undef ioctl
+# define ioctl ioctl_used_without_requesting_gnulib_module_ioctl
+#elif defined GNULIB_POSIXCHECK
+# undef ioctl
+# if HAVE_RAW_DECL_IOCTL
+_GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - "
+                 "use gnulib module ioctl for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SYS_IOCTL_H */
+#endif /* _@GUARD_PREFIX@_SYS_IOCTL_H */
deleted file mode 120000 (symlink)
index 8e85f7283223772a925a0f971b75ee8e811ceb4a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_random.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..22f67b17635876e2693bd7067b48f2c4ff1d93d5
--- /dev/null
@@ -0,0 +1,105 @@
+/* Substitute for <sys/random.h>.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
+@PRAGMA_COLUMNS@
+
+#ifndef _@GUARD_PREFIX@_SYS_RANDOM_H
+
+#if @HAVE_SYS_RANDOM_H@
+
+/* On uClibc < 1.0.35, <sys/random.h> assumes prior inclusion of <stddef.h>.
+   Do not use __UCLIBC__ here, as it might not be defined yet.
+   But avoid namespace pollution on glibc systems.  */
+# ifndef __GLIBC__
+#  include <stddef.h>
+# endif
+/* On Mac OS X 10.5, <sys/random.h> assumes prior inclusion of <sys/types.h>.
+   On Max OS X 10.13, <sys/random.h> assumes prior inclusion of a file that
+   includes <Availability.h>, such as <stdlib.h> or <unistd.h>.  */
+# if defined __APPLE__ && defined __MACH__                  /* Mac OS X */
+#  include <sys/types.h>
+#  include <stdlib.h>
+# endif
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_SYS_RANDOM_H@
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_RANDOM_H
+#define _@GUARD_PREFIX@_SYS_RANDOM_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <sys/types.h>
+
+/* Define the GRND_* constants.  */
+#ifndef GRND_NONBLOCK
+# define GRND_NONBLOCK 1
+# define GRND_RANDOM 2
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Declare overridden functions.  */
+
+
+#if @GNULIB_GETRANDOM@
+/* Fill a buffer with random bytes.  */
+# if @REPLACE_GETRANDOM@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getrandom
+#   define getrandom rpl_getrandom
+#  endif
+_GL_FUNCDECL_RPL (getrandom, ssize_t,
+                  (void *buffer, size_t length, unsigned int flags)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (getrandom, ssize_t,
+                  (void *buffer, size_t length, unsigned int flags));
+# else
+#  if !@HAVE_GETRANDOM@
+_GL_FUNCDECL_SYS (getrandom, ssize_t,
+                  (void *buffer, size_t length, unsigned int flags)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (getrandom, ssize_t,
+                  (void *buffer, size_t length, unsigned int flags));
+# endif
+# if __GLIBC__ + (__GLIBC_MINOR__ >= 25) > 2
+_GL_CXXALIASWARN (getrandom);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getrandom
+# if HAVE_RAW_DECL_GETRANDOM
+_GL_WARN_ON_USE (getrandom, "getrandom is unportable - "
+                 "use gnulib module getrandom for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SYS_RANDOM_H */
+#endif /* _@GUARD_PREFIX@_SYS_RANDOM_H */
deleted file mode 120000 (symlink)
index e9e2018cbec029f3b043b6eeb1f4d74c17d046e6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_resource.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c15450cef15ad6a084733bf03d02f9c300db11db
--- /dev/null
@@ -0,0 +1,128 @@
+/* Substitute for <sys/resource.h>.
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
+@PRAGMA_COLUMNS@
+
+#ifndef _@GUARD_PREFIX@_SYS_RESOURCE_H
+
+#if @HAVE_SYS_RESOURCE_H@
+
+/* On FreeBSD 5.0, <sys/resource.h> assumes prior inclusion of <sys/types.h>
+   and <sys/time.h>.  */
+# include <sys/types.h>
+# include <sys/time.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_SYS_RESOURCE_H@
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_RESOURCE_H
+#define _@GUARD_PREFIX@_SYS_RESOURCE_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if !@HAVE_SYS_RESOURCE_H@
+/* A platform that lacks <sys/resource.h>.  */
+
+/* Get 'struct timeval'.  */
+# include <sys/time.h>
+
+/* Define the RUSAGE_* constants.  */
+# define RUSAGE_SELF 0
+# define RUSAGE_CHILDREN -1
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if !GNULIB_defined_struct_rusage
+/* All known platforms that lack <sys/resource.h> also lack any declaration
+   of struct rusage in any other header.  */
+struct rusage
+{
+  struct timeval ru_utime;      /* CPU time used in user mode */
+  struct timeval ru_stime;      /* CPU time used in system mode (kernel) */
+  long ru_maxrss;
+  long ru_ixrss;
+  long ru_idrss;
+  long ru_isrss;
+  long ru_minflt;
+  long ru_majflt;
+  long ru_nswap;
+  long ru_inblock;
+  long ru_oublock;
+  long ru_msgsnd;
+  long ru_msgrcv;
+  long ru_nsignals;
+  long ru_nvcsw;
+  long ru_nivcsw;
+};
+#  define GNULIB_defined_struct_rusage 1
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
+#else
+
+# ifdef __VMS                      /* OpenVMS */
+/* Define the RUSAGE_* constants.  */
+#  ifndef RUSAGE_SELF
+#   define RUSAGE_SELF 0
+#  endif
+#  ifndef RUSAGE_CHILDREN
+#   define RUSAGE_CHILDREN -1
+#  endif
+# endif
+
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Declare overridden functions.  */
+
+
+#if @GNULIB_GETRUSAGE@
+# if !@HAVE_GETRUSAGE@
+_GL_FUNCDECL_SYS (getrusage, int, (int who, struct rusage *usage_p)
+                                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (getrusage, int, (int who, struct rusage *usage_p));
+_GL_CXXALIASWARN (getrusage);
+#elif defined GNULIB_POSIXCHECK
+# undef getrusage
+# if HAVE_RAW_DECL_GETRUSAGE
+_GL_WARN_ON_USE (getrusage, "getrusage is unportable - "
+                 "use gnulib module getrusage for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */
+#endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */
deleted file mode 120000 (symlink)
index c82246a4b6c62cf3c6fb1410715e7685ddc47f72..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_select.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..de29c77949af528c7d00a0e4e8ac641da0c8821e
--- /dev/null
@@ -0,0 +1,346 @@
+/* Substitute for <sys/select.h>.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
+@PRAGMA_COLUMNS@
+
+/* This file uses #include_next of a system file that defines time_t.
+   For the 'year2038' module to work right, <config.h> needs to have been
+   included before.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h>
+   both include <sys/select.h>.
+   On Cygwin and OpenBSD, <sys/time.h> includes <sys/select.h>.
+   Simply delegate to the system's header in this case.  */
+#if (@HAVE_SYS_SELECT_H@                                                \
+     && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H             \
+     && ((defined __osf__ && defined _SYS_TYPES_H_                      \
+          && defined _OSF_SOURCE)                                       \
+         || (defined __sun && defined _SYS_TYPES_H                      \
+             && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE)   \
+                 || defined __EXTENSIONS__))))
+
+# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+#elif (@HAVE_SYS_SELECT_H@                                              \
+       && (defined _CYGWIN_SYS_TIME_H                                   \
+           || (!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H       \
+               && ((defined __osf__ && defined _SYS_TIME_H_             \
+                    && defined _OSF_SOURCE)                             \
+                   || (defined __OpenBSD__ && defined _SYS_TIME_H_)     \
+                   || (defined __sun && defined _SYS_TIME_H             \
+                       && (! (defined _XOPEN_SOURCE                     \
+                              || defined _POSIX_C_SOURCE)               \
+                           || defined __EXTENSIONS__))))))
+
+# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+/* On IRIX 6.5, <sys/timespec.h> includes <sys/types.h>, which includes
+   <sys/bsd_types.h>, which includes <sys/select.h>.  At this point we cannot
+   include <signal.h>, because that includes <internal/signal_core.h>, which
+   gives a syntax error because <sys/timespec.h> has not been completely
+   processed.  Simply delegate to the system's header in this case.  */
+#elif @HAVE_SYS_SELECT_H@ && defined __sgi && (defined _SYS_BSD_TYPES_H && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H)
+
+# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+/* On OpenBSD 5.0, <pthread.h> includes <sys/types.h>, which includes
+   <sys/select.h>.  At this point we cannot include <signal.h>, because that
+   includes gnulib's pthread.h override, which gives a syntax error because
+   /usr/include/pthread.h has not been completely processed.  Simply delegate
+   to the system's header in this case.  */
+#elif @HAVE_SYS_SELECT_H@ && defined __OpenBSD__ && (defined _PTHREAD_H_ && !defined PTHREAD_MUTEX_INITIALIZER)
+
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+#else
+
+#ifndef _@GUARD_PREFIX@_SYS_SELECT_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* On many platforms, <sys/select.h> assumes prior inclusion of
+   <sys/types.h>.  Also, mingw defines sigset_t there, instead of
+   in <signal.h> where it belongs.  */
+#include <sys/types.h>
+
+#if @HAVE_SYS_SELECT_H@
+
+/* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
+   of 'struct timeval', and no definition of this type.
+   Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select()
+   in <sys/time.h>.
+   But avoid namespace pollution on glibc systems, a circular include
+   <sys/select.h> -> <sys/time.h> -> <sys/select.h> on FreeBSD 13.1, and
+   "unknown type name" problems on Cygwin.  */
+# if !(defined __GLIBC__ || defined __FreeBSD__ || defined __CYGWIN__)
+#  include <sys/time.h>
+# endif
+
+/* On AIX 7 and Solaris 10, <sys/select.h> provides an FD_ZERO implementation
+   that relies on memset(), but without including <string.h>.
+   But in any case avoid namespace pollution on glibc systems.  */
+# if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \
+     && ! defined __GLIBC__
+#  include <string.h>
+# endif
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+#endif
+
+/* Get definition of 'sigset_t'.
+   But avoid namespace pollution on glibc systems and "unknown type
+   name" problems on Cygwin.
+   On OS/2 kLIBC, sigset_t is defined in <sys/select.h>, too. In addition,
+   if <sys/param.h> is included, <types.h> -> <sys/types.h> -> <sys/select.h>
+   are included. Then <signal.h> -> <pthread.h> are included by GNULIB. By the
+   way, <pthread.h> requires PAGE_SIZE defined in <sys/param.h>. However,
+   <sys/param.h> has not been processed, yet. As a result, 'PAGE_SIZE'
+   undeclared error occurs in <pthread.h>.
+   Do this after the include_next (for the sake of OpenBSD 5.0) but before
+   the split double-inclusion guard (for the sake of Solaris).  */
+#if !((defined __GLIBC__ || defined __CYGWIN__ || defined __KLIBC__) \
+      && !defined __UCLIBC__)
+# include <signal.h>
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_SELECT_H
+#define _@GUARD_PREFIX@_SYS_SELECT_H
+
+#if !@HAVE_SYS_SELECT_H@
+/* A platform that lacks <sys/select.h>.  */
+/* Get the 'struct timeval' and 'fd_set' types and the FD_* macros
+   on most platforms.  */
+# include <sys/time.h>
+/* On HP-UX 11, <sys/time.h> provides an FD_ZERO implementation
+   that relies on memset(), but without including <string.h>.  */
+# if defined __hpux
+#  include <string.h>
+# endif
+/* On native Windows platforms:
+   Get the 'fd_set' type.
+   Get the close() declaration before we override it.  */
+# if @HAVE_WINSOCK2_H@
+#  if !defined _GL_INCLUDING_WINSOCK2_H
+#   define _GL_INCLUDING_WINSOCK2_H
+#   include <winsock2.h>
+#   undef _GL_INCLUDING_WINSOCK2_H
+#  endif
+#  include <io.h>
+# endif
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Fix some definitions from <winsock2.h>.  */
+
+#if @HAVE_WINSOCK2_H@
+
+# if !GNULIB_defined_rpl_fd_isset
+
+/* Re-define FD_ISSET to avoid a WSA call while we are not using
+   network sockets.  */
+static int
+rpl_fd_isset (SOCKET fd, fd_set * set)
+{
+  u_int i;
+  if (set == NULL)
+    return 0;
+
+  for (i = 0; i < set->fd_count; i++)
+    if (set->fd_array[i] == fd)
+      return 1;
+
+  return 0;
+}
+
+#  define GNULIB_defined_rpl_fd_isset 1
+# endif
+
+# undef FD_ISSET
+# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
+
+#endif
+
+/* Hide some function declarations from <winsock2.h>.  */
+
+#if @HAVE_WINSOCK2_H@
+# if !defined _@GUARD_PREFIX@_UNISTD_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close close_used_without_including_unistd_h
+#  elif !defined __clang__
+    _GL_WARN_ON_USE (close,
+                     "close() used without including <unistd.h>");
+#  endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gethostname
+#   define gethostname gethostname_used_without_including_unistd_h
+#  elif !defined __clang__
+    _GL_WARN_ON_USE (gethostname,
+                     "gethostname() used without including <unistd.h>");
+#  endif
+# endif
+# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef socket
+#   define socket              socket_used_without_including_sys_socket_h
+#   undef connect
+#   define connect             connect_used_without_including_sys_socket_h
+#   undef accept
+#   define accept              accept_used_without_including_sys_socket_h
+#   undef bind
+#   define bind                bind_used_without_including_sys_socket_h
+#   undef getpeername
+#   define getpeername         getpeername_used_without_including_sys_socket_h
+#   undef getsockname
+#   define getsockname         getsockname_used_without_including_sys_socket_h
+#   undef getsockopt
+#   define getsockopt          getsockopt_used_without_including_sys_socket_h
+#   undef listen
+#   define listen              listen_used_without_including_sys_socket_h
+#   undef recv
+#   define recv                recv_used_without_including_sys_socket_h
+#   undef send
+#   define send                send_used_without_including_sys_socket_h
+#   undef recvfrom
+#   define recvfrom            recvfrom_used_without_including_sys_socket_h
+#   undef sendto
+#   define sendto              sendto_used_without_including_sys_socket_h
+#   undef setsockopt
+#   define setsockopt          setsockopt_used_without_including_sys_socket_h
+#   undef shutdown
+#   define shutdown            shutdown_used_without_including_sys_socket_h
+#  elif !defined __clang__
+    _GL_WARN_ON_USE (socket,
+                     "socket() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (connect,
+                     "connect() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (accept,
+                     "accept() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (bind,
+                     "bind() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (getpeername,
+                     "getpeername() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (getsockname,
+                     "getsockname() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (getsockopt,
+                     "getsockopt() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (listen,
+                     "listen() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (recv,
+                     "recv() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (send,
+                     "send() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (recvfrom,
+                     "recvfrom() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (sendto,
+                     "sendto() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (setsockopt,
+                     "setsockopt() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (shutdown,
+                     "shutdown() used without including <sys/socket.h>");
+#  endif
+# endif
+#endif
+
+
+#if @GNULIB_PSELECT@
+# if @REPLACE_PSELECT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pselect
+#   define pselect rpl_pselect
+#  endif
+_GL_FUNCDECL_RPL (pselect, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   struct timespec const *restrict, const sigset_t *restrict));
+_GL_CXXALIAS_RPL (pselect, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   struct timespec const *restrict, const sigset_t *restrict));
+# else
+#  if !@HAVE_PSELECT@
+_GL_FUNCDECL_SYS (pselect, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   struct timespec const *restrict, const sigset_t *restrict));
+#  endif
+/* Need to cast, because on AIX 7, the second, third, fourth argument may be
+                        void *restrict,   void *restrict,   void *restrict.  */
+_GL_CXXALIAS_SYS_CAST (pselect, int,
+                       (int,
+                        fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                        struct timespec const *restrict,
+                        const sigset_t *restrict));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pselect);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pselect
+# if HAVE_RAW_DECL_PSELECT
+_GL_WARN_ON_USE (pselect, "pselect is not portable - "
+                 "use gnulib module pselect for portability");
+# endif
+#endif
+
+#if @GNULIB_SELECT@
+# if @REPLACE_SELECT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef select
+#   define select rpl_select
+#  endif
+_GL_FUNCDECL_RPL (select, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   struct timeval *restrict));
+_GL_CXXALIAS_RPL (select, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   timeval *restrict));
+# else
+_GL_CXXALIAS_SYS (select, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   timeval *restrict));
+# endif
+_GL_CXXALIASWARN (select);
+#elif @HAVE_WINSOCK2_H@
+# undef select
+# define select select_used_without_requesting_gnulib_module_select
+#elif defined GNULIB_POSIXCHECK
+# undef select
+# if HAVE_RAW_DECL_SELECT
+_GL_WARN_ON_USE (select, "select is not always POSIX compliant - "
+                 "use gnulib module select for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
+#endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
+#endif /* OSF/1 */
deleted file mode 120000 (symlink)
index 37e192ea0a9c2e2a745e9f9119e53f4db4478375..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_socket.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..672d3aace6dcffb50a237879348df270a19bfe1d
--- /dev/null
@@ -0,0 +1,22 @@
+/* Inline functions for <sys/socket.h>.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
+#include <sys/socket.h>
+typedef int dummy;
deleted file mode 120000 (symlink)
index 152681d5231809d3a49a8504e870b11cba195879..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_socket.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..13833c0fa6735b76b36ed25de078d2d7a1cbfe44
--- /dev/null
@@ -0,0 +1,744 @@
+/* Provide a sys/socket header file for systems lacking it (read: MinGW)
+   and for systems where it is incomplete.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file is supposed to be used on platforms that lack <sys/socket.h>,
+   on platforms where <sys/socket.h> cannot be included standalone, and on
+   platforms where <sys/socket.h> does not provide all necessary definitions.
+   It is intended to provide definitions and prototypes needed by an
+   application.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
+/* Special invocation convention:
+   - On Cygwin 1.5.x we have a sequence of nested includes
+     <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
+     and the latter includes <sys/socket.h>.  In this situation, the functions
+     are not yet declared, therefore we cannot provide the C++ aliases.  */
+
+#@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
+
+#if @HAVE_SYS_SOCKET_H@
+
+# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
+
+/* On many platforms, <sys/socket.h> assumes prior inclusion of
+   <sys/types.h>.  */
+# include <sys/types.h>
+
+/* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL
+   is defined.  */
+# include <stddef.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
+
+# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
+#define _@GUARD_PREFIX@_SYS_SOCKET_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK,
+   HAVE_RAW_DECL_*, alignof.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_SYS_SOCKET_INLINE
+# define _GL_SYS_SOCKET_INLINE _GL_INLINE
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+#if !@HAVE_SA_FAMILY_T@
+# if !GNULIB_defined_sa_family_t
+/* On OS/2 kLIBC, sa_family_t is unsigned char unless TCPV40HDRS is defined. */
+#  if !defined __KLIBC__ || defined TCPV40HDRS
+typedef unsigned short  sa_family_t;
+#  else
+typedef unsigned char   sa_family_t;
+#  endif
+#  define GNULIB_defined_sa_family_t 1
+# endif
+#endif
+
+#if @HAVE_STRUCT_SOCKADDR_STORAGE@
+/* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1.  */
+# if !@HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@
+#  ifndef ss_family
+#   define ss_family __ss_family
+#  endif
+# endif
+#else
+/* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
+   2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
+# define __ss_aligntype unsigned long int
+# define _SS_SIZE 256
+# define _SS_PADSIZE \
+    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)      \
+                  ? sizeof (sa_family_t)                                \
+                  : alignof (__ss_aligntype))                           \
+                 + sizeof (__ss_aligntype)))
+
+# if !GNULIB_defined_struct_sockaddr_storage
+struct sockaddr_storage
+{
+  sa_family_t ss_family;      /* Address family, etc.  */
+  __ss_aligntype __ss_align;  /* Force desired alignment.  */
+  char __ss_padding[_SS_PADSIZE];
+};
+#  define GNULIB_defined_struct_sockaddr_storage 1
+# endif
+
+#endif
+
+/* Get struct iovec.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if ! defined __GLIBC__
+# include <sys/uio.h>
+#endif
+
+#if @HAVE_SYS_SOCKET_H@
+
+/* A platform that has <sys/socket.h>.  */
+
+/* For shutdown().  */
+# if !defined SHUT_RD
+#  define SHUT_RD 0
+# endif
+# if !defined SHUT_WR
+#  define SHUT_WR 1
+# endif
+# if !defined SHUT_RDWR
+#  define SHUT_RDWR 2
+# endif
+
+# ifdef __VMS                        /* OpenVMS */
+#  ifndef CMSG_SPACE
+#   define CMSG_SPACE(length) _CMSG_SPACE(length)
+#  endif
+#  ifndef CMSG_LEN
+#   define CMSG_LEN(length) _CMSG_LEN(length)
+#  endif
+# endif
+
+#else
+
+# ifdef __CYGWIN__
+#  error "Cygwin does have a sys/socket.h, doesn't it?!?"
+# endif
+
+/* A platform that lacks <sys/socket.h>.
+
+   Currently only MinGW is supported.  See the gnulib manual regarding
+   Windows sockets.  MinGW has the header files winsock2.h and
+   ws2tcpip.h that declare the sys/socket.h definitions we need.  Note
+   that you can influence which definitions you get by setting the
+   WINVER symbol before including these two files.  For example,
+   getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
+   symbol is set indirectly through WINVER).  You can set this by
+   adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
+   code may not run on older Windows releases then.  My Windows 2000
+   box was not able to run the code, for example.  The situation is
+   slightly confusing because
+   <https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
+   suggests that getaddrinfo should be available on all Windows
+   releases. */
+
+# if @HAVE_WINSOCK2_H@
+#  include <winsock2.h>
+# endif
+# if @HAVE_WS2TCPIP_H@
+#  include <ws2tcpip.h>
+# endif
+
+/* For shutdown(). */
+# if !defined SHUT_RD && defined SD_RECEIVE
+#  define SHUT_RD SD_RECEIVE
+# endif
+# if !defined SHUT_WR && defined SD_SEND
+#  define SHUT_WR SD_SEND
+# endif
+# if !defined SHUT_RDWR && defined SD_BOTH
+#  define SHUT_RDWR SD_BOTH
+# endif
+
+# if @HAVE_WINSOCK2_H@
+/* Include headers needed by the emulation code.  */
+#  include <sys/types.h>
+#  include <io.h>
+/* If these headers don't define socklen_t, <config.h> does.  */
+# endif
+
+/* Rudimentary 'struct msghdr'; this works as long as you don't try to
+   access msg_control or msg_controllen.  */
+struct msghdr {
+  void *msg_name;
+  socklen_t msg_namelen;
+  struct iovec *msg_iov;
+  int msg_iovlen;
+  int msg_flags;
+};
+
+#endif
+
+/* Ensure SO_REUSEPORT is defined.  */
+/* For the subtle differences between SO_REUSEPORT and SO_REUSEADDR, see
+   https://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t
+   and https://lwn.net/Articles/542629/
+ */
+#ifndef SO_REUSEPORT
+# define SO_REUSEPORT SO_REUSEADDR
+#endif
+
+/* Fix some definitions from <winsock2.h>.  */
+
+#if @HAVE_WINSOCK2_H@
+
+# if !GNULIB_defined_rpl_fd_isset
+
+/* Re-define FD_ISSET to avoid a WSA call while we are not using
+   network sockets.  */
+_GL_SYS_SOCKET_INLINE int
+rpl_fd_isset (SOCKET fd, fd_set * set)
+{
+  u_int i;
+  if (set == NULL)
+    return 0;
+
+  for (i = 0; i < set->fd_count; i++)
+    if (set->fd_array[i] == fd)
+      return 1;
+
+  return 0;
+}
+
+#  define GNULIB_defined_rpl_fd_isset 1
+# endif
+
+# undef FD_ISSET
+# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
+
+#endif
+
+/* Hide some function declarations from <winsock2.h>.  */
+
+#if @HAVE_WINSOCK2_H@
+# if !defined _@GUARD_PREFIX@_UNISTD_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close close_used_without_including_unistd_h
+#  elif !defined __clang__
+    _GL_WARN_ON_USE (close,
+                     "close() used without including <unistd.h>");
+#  endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gethostname
+#   define gethostname gethostname_used_without_including_unistd_h
+#  else
+    _GL_WARN_ON_USE (gethostname,
+                     "gethostname() used without including <unistd.h>");
+#  endif
+# endif
+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef select
+#   define select select_used_without_including_sys_select_h
+#  else
+    _GL_WARN_ON_USE (select,
+                     "select() used without including <sys/select.h>");
+#  endif
+# endif
+#endif
+
+/* Wrap everything else to use libc file descriptors for sockets.  */
+
+#if @GNULIB_SOCKET@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef socket
+#   define socket rpl_socket
+#  endif
+_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol));
+_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
+# else
+_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
+# endif
+_GL_CXXALIASWARN (socket);
+#elif @HAVE_WINSOCK2_H@
+# undef socket
+# define socket socket_used_without_requesting_gnulib_module_socket
+#elif defined GNULIB_POSIXCHECK
+# undef socket
+# if HAVE_RAW_DECL_SOCKET
+_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
+                 "use gnulib module socket for portability");
+# endif
+#endif
+
+#if @GNULIB_CONNECT@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef connect
+#   define connect rpl_connect
+#  endif
+_GL_FUNCDECL_RPL (connect, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (connect, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
+# else
+/* Need to cast, because on NonStop Kernel, the third parameter is
+                                                     size_t addrlen.  */
+_GL_CXXALIAS_SYS_CAST (connect, int,
+                       (int fd,
+                        const struct sockaddr *addr, socklen_t addrlen));
+# endif
+_GL_CXXALIASWARN (connect);
+#elif @HAVE_WINSOCK2_H@
+# undef connect
+# define connect socket_used_without_requesting_gnulib_module_connect
+#elif defined GNULIB_POSIXCHECK
+# undef connect
+# if HAVE_RAW_DECL_CONNECT
+_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
+                 "use gnulib module connect for portability");
+# endif
+#endif
+
+#if @GNULIB_ACCEPT@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef accept
+#   define accept rpl_accept
+#  endif
+_GL_FUNCDECL_RPL (accept, int,
+                  (int fd,
+                   struct sockaddr *restrict addr,
+                   socklen_t *restrict addrlen));
+_GL_CXXALIAS_RPL (accept, int,
+                  (int fd,
+                   struct sockaddr *restrict addr,
+                   socklen_t *restrict addrlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the third parameter is
+                        void *addrlen.  */
+_GL_CXXALIAS_SYS_CAST (accept, int,
+                       (int fd,
+                        struct sockaddr *restrict addr,
+                        socklen_t *restrict addrlen));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (accept);
+# endif
+#elif @HAVE_WINSOCK2_H@
+# undef accept
+# define accept accept_used_without_requesting_gnulib_module_accept
+#elif defined GNULIB_POSIXCHECK
+# undef accept
+# if HAVE_RAW_DECL_ACCEPT
+_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
+                 "use gnulib module accept for portability");
+# endif
+#endif
+
+#if @GNULIB_BIND@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef bind
+#   define bind rpl_bind
+#  endif
+_GL_FUNCDECL_RPL (bind, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (bind, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
+# else
+/* Need to cast, because on NonStop Kernel, the third parameter is
+                                                     size_t addrlen.  */
+_GL_CXXALIAS_SYS_CAST (bind, int,
+                       (int fd,
+                        const struct sockaddr *addr, socklen_t addrlen));
+# endif
+_GL_CXXALIASWARN (bind);
+#elif @HAVE_WINSOCK2_H@
+# undef bind
+# define bind bind_used_without_requesting_gnulib_module_bind
+#elif defined GNULIB_POSIXCHECK
+# undef bind
+# if HAVE_RAW_DECL_BIND
+_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
+                 "use gnulib module bind for portability");
+# endif
+#endif
+
+#if @GNULIB_GETPEERNAME@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getpeername
+#   define getpeername rpl_getpeername
+#  endif
+_GL_FUNCDECL_RPL (getpeername, int,
+                  (int fd, struct sockaddr *restrict addr,
+                   socklen_t *restrict addrlen)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (getpeername, int,
+                  (int fd, struct sockaddr *restrict addr,
+                   socklen_t *restrict addrlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the third parameter is
+                        void *addrlen.  */
+_GL_CXXALIAS_SYS_CAST (getpeername, int,
+                       (int fd, struct sockaddr *restrict addr,
+                        socklen_t *restrict addrlen));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getpeername);
+# endif
+#elif @HAVE_WINSOCK2_H@
+# undef getpeername
+# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
+#elif defined GNULIB_POSIXCHECK
+# undef getpeername
+# if HAVE_RAW_DECL_GETPEERNAME
+_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
+                 "use gnulib module getpeername for portability");
+# endif
+#endif
+
+#if @GNULIB_GETSOCKNAME@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getsockname
+#   define getsockname rpl_getsockname
+#  endif
+_GL_FUNCDECL_RPL (getsockname, int,
+                  (int fd, struct sockaddr *restrict addr,
+                   socklen_t *restrict addrlen)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (getsockname, int,
+                  (int fd, struct sockaddr *restrict addr,
+                   socklen_t *restrict addrlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the third parameter is
+                        void *addrlen.  */
+_GL_CXXALIAS_SYS_CAST (getsockname, int,
+                       (int fd, struct sockaddr *restrict addr,
+                        socklen_t *restrict addrlen));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getsockname);
+# endif
+#elif @HAVE_WINSOCK2_H@
+# undef getsockname
+# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
+#elif defined GNULIB_POSIXCHECK
+# undef getsockname
+# if HAVE_RAW_DECL_GETSOCKNAME
+_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
+                 "use gnulib module getsockname for portability");
+# endif
+#endif
+
+#if @GNULIB_GETSOCKOPT@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getsockopt
+#   define getsockopt rpl_getsockopt
+#  endif
+_GL_FUNCDECL_RPL (getsockopt, int,
+                  (int fd, int level, int optname,
+                   void *restrict optval, socklen_t *restrict optlen)
+                  _GL_ARG_NONNULL ((4, 5)));
+_GL_CXXALIAS_RPL (getsockopt, int,
+                  (int fd, int level, int optname,
+                   void *restrict optval, socklen_t *restrict optlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the fifth parameter is
+                                                       void *optlen.  */
+_GL_CXXALIAS_SYS_CAST (getsockopt, int,
+                       (int fd, int level, int optname,
+                        void *restrict optval, socklen_t *restrict optlen));
+# endif
+_GL_CXXALIASWARN (getsockopt);
+#elif @HAVE_WINSOCK2_H@
+# undef getsockopt
+# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
+#elif defined GNULIB_POSIXCHECK
+# undef getsockopt
+# if HAVE_RAW_DECL_GETSOCKOPT
+_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
+                 "use gnulib module getsockopt for portability");
+# endif
+#endif
+
+#if @GNULIB_LISTEN@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef listen
+#   define listen rpl_listen
+#  endif
+_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog));
+_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
+# else
+_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
+# endif
+_GL_CXXALIASWARN (listen);
+#elif @HAVE_WINSOCK2_H@
+# undef listen
+# define listen listen_used_without_requesting_gnulib_module_listen
+#elif defined GNULIB_POSIXCHECK
+# undef listen
+# if HAVE_RAW_DECL_LISTEN
+_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
+                 "use gnulib module listen for portability");
+# endif
+#endif
+
+#if @GNULIB_RECV@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef recv
+#   define recv rpl_recv
+#  endif
+_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
+# else
+/* Need to cast, because on HP-UX 11.31 the return type may be
+                             int,
+   depending on compiler options.  */
+_GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
+# endif
+_GL_CXXALIASWARN (recv);
+#elif @HAVE_WINSOCK2_H@
+# undef recv
+# define recv recv_used_without_requesting_gnulib_module_recv
+#elif defined GNULIB_POSIXCHECK
+# undef recv
+# if HAVE_RAW_DECL_RECV
+_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
+                 "use gnulib module recv for portability");
+# endif
+#endif
+
+#if @GNULIB_SEND@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef send
+#   define send rpl_send
+#  endif
+_GL_FUNCDECL_RPL (send, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (send, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags));
+# else
+/* Need to cast, because on HP-UX 11.31 the return type may be
+                             int,
+   depending on compiler options.  */
+_GL_CXXALIAS_SYS_CAST (send, ssize_t,
+                       (int fd, const void *buf, size_t len, int flags));
+# endif
+_GL_CXXALIASWARN (send);
+#elif @HAVE_WINSOCK2_H@
+# undef send
+# define send send_used_without_requesting_gnulib_module_send
+#elif defined GNULIB_POSIXCHECK
+# undef send
+# if HAVE_RAW_DECL_SEND
+_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
+                 "use gnulib module send for portability");
+# endif
+#endif
+
+#if @GNULIB_RECVFROM@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef recvfrom
+#   define recvfrom rpl_recvfrom
+#  endif
+_GL_FUNCDECL_RPL (recvfrom, ssize_t,
+                  (int fd, void *restrict buf, size_t len, int flags,
+                   struct sockaddr *restrict from,
+                   socklen_t *restrict fromlen)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (recvfrom, ssize_t,
+                  (int fd, void *restrict buf, size_t len, int flags,
+                   struct sockaddr *restrict from,
+                   socklen_t *restrict fromlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the sixth parameter is
+                                               void *fromlen.  */
+_GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
+                       (int fd, void *restrict buf, size_t len, int flags,
+                        struct sockaddr *restrict from,
+                        socklen_t *restrict fromlen));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (recvfrom);
+# endif
+#elif @HAVE_WINSOCK2_H@
+# undef recvfrom
+# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
+#elif defined GNULIB_POSIXCHECK
+# undef recvfrom
+# if HAVE_RAW_DECL_RECVFROM
+_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
+                 "use gnulib module recvfrom for portability");
+# endif
+#endif
+
+#if @GNULIB_SENDTO@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sendto
+#   define sendto rpl_sendto
+#  endif
+_GL_FUNCDECL_RPL (sendto, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags,
+                   const struct sockaddr *to, socklen_t tolen)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (sendto, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags,
+                   const struct sockaddr *to, socklen_t tolen));
+# else
+/* Need to cast, because on NonStop Kernel, the sixth parameter is
+                                                   size_t tolen.  */
+_GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
+                       (int fd, const void *buf, size_t len, int flags,
+                        const struct sockaddr *to, socklen_t tolen));
+# endif
+_GL_CXXALIASWARN (sendto);
+#elif @HAVE_WINSOCK2_H@
+# undef sendto
+# define sendto sendto_used_without_requesting_gnulib_module_sendto
+#elif defined GNULIB_POSIXCHECK
+# undef sendto
+# if HAVE_RAW_DECL_SENDTO
+_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
+                 "use gnulib module sendto for portability");
+# endif
+#endif
+
+#if @GNULIB_SETSOCKOPT@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setsockopt
+#   define setsockopt rpl_setsockopt
+#  endif
+_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
+                                    const void * optval, socklen_t optlen)
+                                   _GL_ARG_NONNULL ((4)));
+_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
+                                    const void * optval, socklen_t optlen));
+# else
+/* Need to cast, because on NonStop Kernel, the fifth parameter is
+                                             size_t optlen.  */
+_GL_CXXALIAS_SYS_CAST (setsockopt, int,
+                       (int fd, int level, int optname,
+                        const void * optval, socklen_t optlen));
+# endif
+_GL_CXXALIASWARN (setsockopt);
+#elif @HAVE_WINSOCK2_H@
+# undef setsockopt
+# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
+#elif defined GNULIB_POSIXCHECK
+# undef setsockopt
+# if HAVE_RAW_DECL_SETSOCKOPT
+_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
+                 "use gnulib module setsockopt for portability");
+# endif
+#endif
+
+#if @GNULIB_SHUTDOWN@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef shutdown
+#   define shutdown rpl_shutdown
+#  endif
+_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how));
+_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
+# else
+_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
+# endif
+_GL_CXXALIASWARN (shutdown);
+#elif @HAVE_WINSOCK2_H@
+# undef shutdown
+# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
+#elif defined GNULIB_POSIXCHECK
+# undef shutdown
+# if HAVE_RAW_DECL_SHUTDOWN
+_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
+                 "use gnulib module shutdown for portability");
+# endif
+#endif
+
+#if @GNULIB_ACCEPT4@
+/* Accept a connection on a socket, with specific opening flags.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   See also the Linux man page at
+   <https://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>.  */
+# if @HAVE_ACCEPT4@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define accept4 rpl_accept4
+#  endif
+_GL_FUNCDECL_RPL (accept4, int,
+                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
+                   int flags));
+_GL_CXXALIAS_RPL (accept4, int,
+                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
+                   int flags));
+# else
+_GL_FUNCDECL_SYS (accept4, int,
+                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
+                   int flags));
+_GL_CXXALIAS_SYS (accept4, int,
+                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
+                   int flags));
+# endif
+_GL_CXXALIASWARN (accept4);
+#elif defined GNULIB_POSIXCHECK
+# undef accept4
+# if HAVE_RAW_DECL_ACCEPT4
+_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
+                 "use gnulib module accept4 for portability");
+# endif
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
+#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
+#endif
deleted file mode 120000 (symlink)
index 55b70444dd3ae4ef33f2febe3e914312f9d20282..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_stat.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bf08f33536d2f0e1378142cd8d8baa42f083900b
--- /dev/null
@@ -0,0 +1,998 @@
+/* Provide a more complete sys/stat.h header file.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
+
+/* This file is supposed to be used on platforms where <sys/stat.h> is
+   incomplete.  It is intended to provide definitions and prototypes
+   needed by an application.  Start with what the system provides.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* This file uses #include_next of a system file that defines time_t.
+   For the 'year2038' module to work right, <config.h> needs to have been
+   included before.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if defined __need_system_sys_stat_h
+/* Special invocation convention.  */
+
+#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_SYS_STAT_H
+
+/* Get nlink_t.
+   May also define off_t to a 64-bit type on native Windows.  */
+#include <sys/types.h>
+
+/* Get struct timespec.  */
+#include <time.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
+
+#ifndef _@GUARD_PREFIX@_SYS_STAT_H
+#define _@GUARD_PREFIX@_SYS_STAT_H
+
+/* This file uses _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+
+/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
+ */
+#ifndef _GL_ATTRIBUTE_NOTHROW
+# if defined __cplusplus
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#   if __cplusplus >= 201103L
+#    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
+#   else
+#    define _GL_ATTRIBUTE_NOTHROW throw ()
+#   endif
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# else
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
+#   define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# endif
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Before doing "#define mknod rpl_mknod" below, we need to include all
+   headers that may declare mknod().  OS/2 kLIBC declares mknod() in
+   <unistd.h>, not in <sys/stat.h>.  */
+#ifdef __KLIBC__
+# include <unistd.h>
+#endif
+
+/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
+   headers that may declare mkdir().  Native Windows platforms declare mkdir
+   in <io.h> and/or <direct.h>, not in <sys/stat.h>.  */
+#if defined _WIN32 && ! defined __CYGWIN__
+# include <io.h>     /* mingw32, mingw64 */
+# include <direct.h> /* mingw64, MSVC 9 */
+#endif
+
+/* Native Windows platforms declare umask() in <io.h>.  */
+#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
+/* Large File Support on native Windows.  */
+#if @WINDOWS_64_BIT_ST_SIZE@
+# define stat _stati64
+#endif
+
+/* Optionally, override 'struct stat' on native Windows.  */
+#if @GNULIB_OVERRIDES_STRUCT_STAT@
+
+# undef stat
+# if @GNULIB_STAT@
+#  define stat rpl_stat
+# else
+   /* Provoke a clear link error if stat() is used as a function and
+      module 'stat' is not in use.  */
+#  define stat stat_used_without_requesting_gnulib_module_stat
+# endif
+
+# if !GNULIB_defined_struct_stat
+struct stat
+{
+  dev_t st_dev;
+  ino_t st_ino;
+  mode_t st_mode;
+  nlink_t st_nlink;
+#  if 0
+  uid_t st_uid;
+#  else /* uid_t is not defined by default on native Windows.  */
+  short st_uid;
+#  endif
+#  if 0
+  gid_t st_gid;
+#  else /* gid_t is not defined by default on native Windows.  */
+  short st_gid;
+#  endif
+  dev_t st_rdev;
+  off_t st_size;
+#  if 0
+  blksize_t st_blksize;
+  blkcnt_t st_blocks;
+#  endif
+
+#  if @WINDOWS_STAT_TIMESPEC@
+  struct timespec st_atim;
+  struct timespec st_mtim;
+  struct timespec st_ctim;
+#  else
+  time_t st_atime;
+  time_t st_mtime;
+  time_t st_ctime;
+#  endif
+};
+#  if @WINDOWS_STAT_TIMESPEC@
+#   define st_atime st_atim.tv_sec
+#   define st_mtime st_mtim.tv_sec
+#   define st_ctime st_ctim.tv_sec
+    /* Indicator, for gnulib internal purposes.  */
+#   define _GL_WINDOWS_STAT_TIMESPEC 1
+#  endif
+#  define GNULIB_defined_struct_stat 1
+# endif
+
+/* Other possible values of st_mode.  */
+# if 0
+#  define _S_IFBLK  0x6000
+# endif
+# if 0
+#  define _S_IFLNK  0xA000
+# endif
+# if 0
+#  define _S_IFSOCK 0xC000
+# endif
+
+#endif
+
+#ifndef S_IFIFO
+# ifdef _S_IFIFO
+#  define S_IFIFO _S_IFIFO
+# endif
+#endif
+
+#ifndef S_IFMT
+# define S_IFMT 0170000
+#endif
+
+#if STAT_MACROS_BROKEN
+# undef S_ISBLK
+# undef S_ISCHR
+# undef S_ISDIR
+# undef S_ISFIFO
+# undef S_ISLNK
+# undef S_ISNAM
+# undef S_ISMPB
+# undef S_ISMPC
+# undef S_ISNWK
+# undef S_ISREG
+# undef S_ISSOCK
+#endif
+
+#ifndef S_ISBLK
+# ifdef S_IFBLK
+#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+# else
+#  define S_ISBLK(m) 0
+# endif
+#endif
+
+#ifndef S_ISCHR
+# ifdef S_IFCHR
+#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+# else
+#  define S_ISCHR(m) 0
+# endif
+#endif
+
+#ifndef S_ISDIR
+# ifdef S_IFDIR
+#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# else
+#  define S_ISDIR(m) 0
+# endif
+#endif
+
+#ifndef S_ISDOOR /* Solaris 2.5 and up */
+# define S_ISDOOR(m) 0
+#endif
+
+#ifndef S_ISFIFO
+# ifdef S_IFIFO
+#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+# else
+#  define S_ISFIFO(m) 0
+# endif
+#endif
+
+#ifndef S_ISLNK
+# ifdef S_IFLNK
+#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+# else
+#  define S_ISLNK(m) 0
+# endif
+#endif
+
+#ifndef S_ISMPB /* V7 */
+# ifdef S_IFMPB
+#  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
+#  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
+# else
+#  define S_ISMPB(m) 0
+#  define S_ISMPC(m) 0
+# endif
+#endif
+
+#ifndef S_ISMPX /* AIX */
+# define S_ISMPX(m) 0
+#endif
+
+#ifndef S_ISNAM /* Xenix */
+# ifdef S_IFNAM
+#  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
+# else
+#  define S_ISNAM(m) 0
+# endif
+#endif
+
+#ifndef S_ISNWK /* HP/UX */
+# ifdef S_IFNWK
+#  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
+# else
+#  define S_ISNWK(m) 0
+# endif
+#endif
+
+#ifndef S_ISPORT /* Solaris 10 and up */
+# define S_ISPORT(m) 0
+#endif
+
+#ifndef S_ISREG
+# ifdef S_IFREG
+#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+# else
+#  define S_ISREG(m) 0
+# endif
+#endif
+
+#ifndef S_ISSOCK
+# ifdef S_IFSOCK
+#  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+# else
+#  define S_ISSOCK(m) 0
+# endif
+#endif
+
+
+#ifndef S_TYPEISMQ
+# define S_TYPEISMQ(p) 0
+#endif
+
+#ifndef S_TYPEISTMO
+# define S_TYPEISTMO(p) 0
+#endif
+
+
+#ifndef S_TYPEISSEM
+# ifdef S_INSEM
+#  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
+# else
+#  define S_TYPEISSEM(p) 0
+# endif
+#endif
+
+#ifndef S_TYPEISSHM
+# ifdef S_INSHD
+#  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
+# else
+#  define S_TYPEISSHM(p) 0
+# endif
+#endif
+
+/* high performance ("contiguous data") */
+#ifndef S_ISCTG
+# define S_ISCTG(p) 0
+#endif
+
+/* Cray DMF (data migration facility): off line, with data  */
+#ifndef S_ISOFD
+# define S_ISOFD(p) 0
+#endif
+
+/* Cray DMF (data migration facility): off line, with no data  */
+#ifndef S_ISOFL
+# define S_ISOFL(p) 0
+#endif
+
+/* 4.4BSD whiteout */
+#ifndef S_ISWHT
+# define S_ISWHT(m) 0
+#endif
+
+/* If any of the following are undefined,
+   define them to their de facto standard values.  */
+#if !S_ISUID
+# define S_ISUID 04000
+#endif
+#if !S_ISGID
+# define S_ISGID 02000
+#endif
+
+/* S_ISVTX is a common extension to POSIX.  */
+#ifndef S_ISVTX
+# define S_ISVTX 01000
+#endif
+
+#if !S_IRUSR && S_IREAD
+# define S_IRUSR S_IREAD
+#endif
+#if !S_IRUSR
+# define S_IRUSR 00400
+#endif
+#if !S_IRGRP
+# define S_IRGRP (S_IRUSR >> 3)
+#endif
+#if !S_IROTH
+# define S_IROTH (S_IRUSR >> 6)
+#endif
+
+#if !S_IWUSR && S_IWRITE
+# define S_IWUSR S_IWRITE
+#endif
+#if !S_IWUSR
+# define S_IWUSR 00200
+#endif
+#if !S_IWGRP
+# define S_IWGRP (S_IWUSR >> 3)
+#endif
+#if !S_IWOTH
+# define S_IWOTH (S_IWUSR >> 6)
+#endif
+
+#if !S_IXUSR && S_IEXEC
+# define S_IXUSR S_IEXEC
+#endif
+#if !S_IXUSR
+# define S_IXUSR 00100
+#endif
+#if !S_IXGRP
+# define S_IXGRP (S_IXUSR >> 3)
+#endif
+#if !S_IXOTH
+# define S_IXOTH (S_IXUSR >> 6)
+#endif
+
+#if !S_IRWXU
+# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
+#endif
+#if !S_IRWXG
+# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
+#endif
+#if !S_IRWXO
+# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
+#endif
+
+/* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are
+   not implemented in GNU/Linux, some Gnulib-using apps use the macros.  */
+#if !S_IXUGO
+# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
+#endif
+#ifndef S_IRWXUGO
+# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
+#endif
+
+/* Macros for futimens and utimensat.  */
+#ifndef UTIME_NOW
+# define UTIME_NOW (-1)
+# define UTIME_OMIT (-2)
+#endif
+
+
+#if @GNULIB_CHMOD@
+# if @REPLACE_CHMOD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chmod
+#   define chmod rpl_chmod
+#  endif
+_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chmod
+#   define chmod _chmod
+#  endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
+# endif
+_GL_CXXALIASWARN (chmod);
+#elif defined GNULIB_POSIXCHECK
+# undef chmod
+# if HAVE_RAW_DECL_CHMOD
+_GL_WARN_ON_USE (chmod, "chmod has portability problems - "
+                 "use gnulib module chmod for portability");
+# endif
+#elif @GNULIB_MDA_CHMOD@
+/* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::chmod always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chmod
+#   define chmod _chmod
+#  endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
+# endif
+_GL_CXXALIASWARN (chmod);
+#endif
+
+
+#if @GNULIB_FCHMODAT@
+# if @REPLACE_FCHMODAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fchmodat
+#   define fchmodat rpl_fchmodat
+#  endif
+_GL_FUNCDECL_RPL (fchmodat, int,
+                  (int fd, char const *file, mode_t mode, int flag)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (fchmodat, int,
+                  (int fd, char const *file, mode_t mode, int flag));
+# else
+#  if !@HAVE_FCHMODAT@
+_GL_FUNCDECL_SYS (fchmodat, int,
+                  (int fd, char const *file, mode_t mode, int flag)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (fchmodat, int,
+                  (int fd, char const *file, mode_t mode, int flag));
+# endif
+_GL_CXXALIASWARN (fchmodat);
+#elif defined GNULIB_POSIXCHECK
+# undef fchmodat
+# if HAVE_RAW_DECL_FCHMODAT
+_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FSTAT@
+# if @REPLACE_FSTAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fstat
+#   define fstat rpl_fstat
+#  endif
+_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
+# else
+_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fstat);
+# endif
+#elif @GNULIB_OVERRIDES_STRUCT_STAT@
+# undef fstat
+# define fstat fstat_used_without_requesting_gnulib_module_fstat
+#elif @WINDOWS_64_BIT_ST_SIZE@
+/* Above, we define stat to _stati64.  */
+# define fstat _fstati64
+#elif defined GNULIB_POSIXCHECK
+# undef fstat
+# if HAVE_RAW_DECL_FSTAT
+_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
+                 "use gnulib module fstat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FSTATAT@
+# if @REPLACE_FSTATAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fstatat
+#   define fstatat rpl_fstatat
+#  endif
+_GL_FUNCDECL_RPL (fstatat, int,
+                  (int fd, char const *restrict name, struct stat *restrict st,
+                   int flags)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (fstatat, int,
+                  (int fd, char const *restrict name, struct stat *restrict st,
+                   int flags));
+# else
+#  if !@HAVE_FSTATAT@
+_GL_FUNCDECL_SYS (fstatat, int,
+                  (int fd, char const *restrict name, struct stat *restrict st,
+                   int flags)
+                  _GL_ARG_NONNULL ((2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (fstatat, int,
+                  (int fd, char const *restrict name, struct stat *restrict st,
+                   int flags));
+# endif
+_GL_CXXALIASWARN (fstatat);
+#elif @GNULIB_OVERRIDES_STRUCT_STAT@
+# undef fstatat
+# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
+#elif defined GNULIB_POSIXCHECK
+# undef fstatat
+# if HAVE_RAW_DECL_FSTATAT
+_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FUTIMENS@
+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
+   implementation relies on futimesat, which on Solaris 10 makes an invocation
+   to futimens that is meant to invoke the libc's futimens(), not gnulib's
+   futimens().  */
+# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef futimens
+#   define futimens rpl_futimens
+#  endif
+_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
+_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
+# else
+#  if !@HAVE_FUTIMENS@
+_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
+#  endif
+_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
+# endif
+# if __GLIBC__ >= 2 && @HAVE_FUTIMENS@
+_GL_CXXALIASWARN (futimens);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef futimens
+# if HAVE_RAW_DECL_FUTIMENS
+_GL_WARN_ON_USE (futimens, "futimens is not portable - "
+                 "use gnulib module futimens for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETUMASK@
+# if !@HAVE_GETUMASK@
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (getumask, mode_t, (void) _GL_ATTRIBUTE_NOTHROW);
+#  else
+_GL_FUNCDECL_SYS (getumask, mode_t, (void));
+#  endif
+# endif
+_GL_CXXALIAS_SYS (getumask, mode_t, (void));
+# if @HAVE_GETUMASK@
+_GL_CXXALIASWARN (getumask);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getumask
+# if HAVE_RAW_DECL_GETUMASK
+_GL_WARN_ON_USE (getumask, "getumask is not portable - "
+                 "use gnulib module getumask for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LCHMOD@
+/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
+   denotes a symbolic link.  */
+# if !@HAVE_LCHMOD@ || defined __hpux
+_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
+                               _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
+_GL_CXXALIASWARN (lchmod);
+#elif defined GNULIB_POSIXCHECK
+# undef lchmod
+# if HAVE_RAW_DECL_LCHMOD
+_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
+                 "use gnulib module lchmod for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MKDIR@
+# if @REPLACE_MKDIR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mkdir
+#   define mkdir rpl_mkdir
+#  endif
+_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
+   Additionally, it declares _mkdir (and depending on compile flags, an
+   alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
+   which are included above.  */
+#  if !GNULIB_defined_rpl_mkdir
+static int
+rpl_mkdir (char const *name, mode_t mode)
+{
+  return _mkdir (name);
+}
+#   define GNULIB_defined_rpl_mkdir 1
+#  endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mkdir
+#   define mkdir rpl_mkdir
+#  endif
+_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
+# endif
+_GL_CXXALIASWARN (mkdir);
+#elif defined GNULIB_POSIXCHECK
+# undef mkdir
+# if HAVE_RAW_DECL_MKDIR
+_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
+                 "use gnulib module mkdir for portability");
+# endif
+#elif @GNULIB_MDA_MKDIR@
+/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::mkdir always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !GNULIB_defined_rpl_mkdir
+static int
+rpl_mkdir (char const *name, mode_t mode)
+{
+  return _mkdir (name);
+}
+#   define GNULIB_defined_rpl_mkdir 1
+#  endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mkdir
+#   define mkdir rpl_mkdir
+#  endif
+_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
+# endif
+_GL_CXXALIASWARN (mkdir);
+#endif
+
+
+#if @GNULIB_MKDIRAT@
+# if !@HAVE_MKDIRAT@
+_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
+                                _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
+_GL_CXXALIASWARN (mkdirat);
+#elif defined GNULIB_POSIXCHECK
+# undef mkdirat
+# if HAVE_RAW_DECL_MKDIRAT
+_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MKFIFO@
+# if @REPLACE_MKFIFO@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mkfifo
+#   define mkfifo rpl_mkfifo
+#  endif
+_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
+# else
+#  if !@HAVE_MKFIFO@
+_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
+                               _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
+# endif
+_GL_CXXALIASWARN (mkfifo);
+#elif defined GNULIB_POSIXCHECK
+# undef mkfifo
+# if HAVE_RAW_DECL_MKFIFO
+_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
+                 "use gnulib module mkfifo for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MKFIFOAT@
+# if @REPLACE_MKFIFOAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mkfifoat
+#   define mkfifoat rpl_mkfifoat
+#  endif
+_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
+# else
+#  if !@HAVE_MKFIFOAT@
+_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
+                                 _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mkfifoat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkfifoat
+# if HAVE_RAW_DECL_MKFIFOAT
+_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MKNOD@
+# if @REPLACE_MKNOD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mknod
+#   define mknod rpl_mknod
+#  endif
+_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
+# else
+#  if !@HAVE_MKNOD@
+_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
+                              _GL_ARG_NONNULL ((1)));
+#  endif
+/* Need to cast, because on OSF/1 5.1, the third parameter is '...'.  */
+_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
+# endif
+_GL_CXXALIASWARN (mknod);
+#elif defined GNULIB_POSIXCHECK
+# undef mknod
+# if HAVE_RAW_DECL_MKNOD
+_GL_WARN_ON_USE (mknod, "mknod is not portable - "
+                 "use gnulib module mknod for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MKNODAT@
+# if @REPLACE_MKNODAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mknodat
+#   define mknodat rpl_mknodat
+#  endif
+_GL_FUNCDECL_RPL (mknodat, int,
+                  (int fd, char const *file, mode_t mode, dev_t dev)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (mknodat, int,
+                  (int fd, char const *file, mode_t mode, dev_t dev));
+# else
+#  if !@HAVE_MKNODAT@
+_GL_FUNCDECL_SYS (mknodat, int,
+                  (int fd, char const *file, mode_t mode, dev_t dev)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (mknodat, int,
+                  (int fd, char const *file, mode_t mode, dev_t dev));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mknodat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mknodat
+# if HAVE_RAW_DECL_MKNODAT
+_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_STAT@
+# if @REPLACE_STAT@
+#  if !@GNULIB_OVERRIDES_STRUCT_STAT@
+    /* We can't use the object-like #define stat rpl_stat, because of
+       struct stat.  This means that rpl_stat will not be used if the user
+       does (stat)(a,b).  Oh well.  */
+#   if defined _AIX && defined stat && defined _LARGE_FILES
+     /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
+        so we have to replace stat64() instead of stat(). */
+#    undef stat64
+#    define stat64(name, st) rpl_stat (name, st)
+#   elif @WINDOWS_64_BIT_ST_SIZE@
+     /* Above, we define stat to _stati64.  */
+#    if defined __MINGW32__ && defined _stati64
+#     ifndef _USE_32BIT_TIME_T
+       /* The system headers define _stati64 to _stat64.  */
+#      undef _stat64
+#      define _stat64(name, st) rpl_stat (name, st)
+#     endif
+#    elif defined _MSC_VER && defined _stati64
+#     ifdef _USE_32BIT_TIME_T
+       /* The system headers define _stati64 to _stat32i64.  */
+#      undef _stat32i64
+#      define _stat32i64(name, st) rpl_stat (name, st)
+#     else
+       /* The system headers define _stati64 to _stat64.  */
+#      undef _stat64
+#      define _stat64(name, st) rpl_stat (name, st)
+#     endif
+#    else
+#     undef _stati64
+#     define _stati64(name, st) rpl_stat (name, st)
+#    endif
+#   elif defined __MINGW32__ && defined stat
+#    ifdef _USE_32BIT_TIME_T
+      /* The system headers define stat to _stat32i64.  */
+#     undef _stat32i64
+#     define _stat32i64(name, st) rpl_stat (name, st)
+#    else
+      /* The system headers define stat to _stat64.  */
+#     undef _stat64
+#     define _stat64(name, st) rpl_stat (name, st)
+#    endif
+#   elif defined _MSC_VER && defined stat
+#    ifdef _USE_32BIT_TIME_T
+      /* The system headers define stat to _stat32.  */
+#     undef _stat32
+#     define _stat32(name, st) rpl_stat (name, st)
+#    else
+      /* The system headers define stat to _stat64i32.  */
+#     undef _stat64i32
+#     define _stat64i32(name, st) rpl_stat (name, st)
+#    endif
+#   else /* !(_AIX || __MINGW32__ || _MSC_VER) */
+#    undef stat
+#    define stat(name, st) rpl_stat (name, st)
+#   endif /* !_LARGE_FILES */
+#  endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */
+_GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf)
+                      _GL_ARG_NONNULL ((1, 2));
+# endif
+#elif @GNULIB_OVERRIDES_STRUCT_STAT@
+/* see above:
+  #define stat stat_used_without_requesting_gnulib_module_stat
+ */
+#elif defined GNULIB_POSIXCHECK
+# undef stat
+# if HAVE_RAW_DECL_STAT
+_GL_WARN_ON_USE (stat, "stat is unportable - "
+                 "use gnulib module stat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LSTAT@
+# if ! @HAVE_LSTAT@
+/* mingw does not support symlinks, therefore it does not have lstat.  But
+   without links, stat does just fine.  */
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define lstat stat
+#  endif
+_GL_CXXALIAS_RPL_1 (lstat, stat, int,
+                    (const char *restrict name, struct stat *restrict buf));
+# elif @REPLACE_LSTAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lstat
+#   define lstat rpl_lstat
+#  endif
+_GL_FUNCDECL_RPL (lstat, int,
+                  (const char *restrict name, struct stat *restrict buf)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (lstat, int,
+                  (const char *restrict name, struct stat *restrict buf));
+# else
+_GL_CXXALIAS_SYS (lstat, int,
+                  (const char *restrict name, struct stat *restrict buf));
+# endif
+# if @HAVE_LSTAT@
+_GL_CXXALIASWARN (lstat);
+# endif
+#elif @GNULIB_OVERRIDES_STRUCT_STAT@
+# undef lstat
+# define lstat lstat_used_without_requesting_gnulib_module_lstat
+#elif defined GNULIB_POSIXCHECK
+# undef lstat
+# if HAVE_RAW_DECL_LSTAT
+_GL_WARN_ON_USE (lstat, "lstat is unportable - "
+                 "use gnulib module lstat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MDA_UMASK@
+/* On native Windows, map 'umask' to '_umask', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::umask always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef umask
+#   define umask _umask
+#  endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask));
+# else
+_GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask));
+# endif
+_GL_CXXALIASWARN (umask);
+#endif
+
+
+#if @GNULIB_UTIMENSAT@
+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
+   implementation relies on futimesat, which on Solaris 10 makes an invocation
+   to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
+   utimensat().  */
+# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef utimensat
+#   define utimensat rpl_utimensat
+#  endif
+_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
+                                   struct timespec const times[2], int flag)
+                                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
+                                   struct timespec const times[2], int flag));
+# else
+#  if !@HAVE_UTIMENSAT@
+_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
+                                   struct timespec const times[2], int flag)
+                                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
+                                   struct timespec const times[2], int flag));
+# endif
+# if __GLIBC__ >= 2 && @HAVE_UTIMENSAT@
+_GL_CXXALIASWARN (utimensat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef utimensat
+# if HAVE_RAW_DECL_UTIMENSAT
+_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
+                 "use gnulib module utimensat for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
+#endif
deleted file mode 120000 (symlink)
index 4cdcc0318070fa20b994836316d029583c9fe389..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_time.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4a301c48ba12145760029cc83e66675e7dde0290
--- /dev/null
@@ -0,0 +1,236 @@
+/* Provide a more complete sys/time.h.
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef _@GUARD_PREFIX@_SYS_TIME_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* This file uses #include_next of a system file that defines time_t.
+   For the 'year2038' module to work right, <config.h> needs to have been
+   included before.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
+   recursively via <sys/select.h>.
+   Simply delegate to the system's header in this case; it is a no-op.
+   Without this extra ifdef, the C++ gettimeofday declaration below
+   would be a forward declaration in gnulib's nested <sys/time.h>.  */
+#if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+#else
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_SYS_TIME_H@
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_TIME_H
+#define _@GUARD_PREFIX@_SYS_TIME_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if ! @HAVE_SYS_TIME_H@
+# include <time.h>
+#endif
+
+/* On native Windows with MSVC, get the 'struct timeval' type.
+   Also, on native Windows with a 64-bit time_t, where we are overriding the
+   'struct timeval' type, get all declarations of system functions whose
+   signature contains 'struct timeval'.  */
+#if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
+# define _GL_INCLUDING_WINSOCK2_H
+# include <winsock2.h>
+# undef _GL_INCLUDING_WINSOCK2_H
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
+
+# if @REPLACE_STRUCT_TIMEVAL@
+#  define timeval rpl_timeval
+# endif
+
+# if !GNULIB_defined_struct_timeval
+struct timeval
+{
+  time_t tv_sec;
+  long int tv_usec;
+};
+#  define GNULIB_defined_struct_timeval 1
+# endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#if @GNULIB_GETTIMEOFDAY@
+# if @REPLACE_GETTIMEOFDAY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gettimeofday
+#   define gettimeofday rpl_gettimeofday
+#  endif
+_GL_FUNCDECL_RPL (gettimeofday, int,
+                  (struct timeval *restrict, void *restrict)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (gettimeofday, int,
+                  (struct timeval *restrict, void *restrict));
+# else
+#  if !@HAVE_GETTIMEOFDAY@
+_GL_FUNCDECL_SYS (gettimeofday, int,
+                  (struct timeval *restrict, void *restrict)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+/* Need to cast, because on glibc systems, by default, the second argument is
+                                                  struct timezone *.  */
+_GL_CXXALIAS_SYS_CAST (gettimeofday, int,
+                       (struct timeval *restrict, void *restrict));
+# endif
+_GL_CXXALIASWARN (gettimeofday);
+# if defined __cplusplus && defined GNULIB_NAMESPACE
+namespace GNULIB_NAMESPACE {
+  typedef ::timeval
+#  undef timeval
+    timeval;
+#  if @REPLACE_STRUCT_TIMEVAL@
+#   define timeval rpl_timeval
+  typedef ::timeval timeval;
+#  endif
+}
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef gettimeofday
+# if HAVE_RAW_DECL_GETTIMEOFDAY
+_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
+                 "use gnulib module gettimeofday for portability");
+# endif
+#endif
+
+/* Hide some function declarations from <winsock2.h>.  */
+
+#if defined _MSC_VER && @HAVE_WINSOCK2_H@
+# if !defined _@GUARD_PREFIX@_UNISTD_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close close_used_without_including_unistd_h
+#  elif !defined __clang__
+     _GL_WARN_ON_USE (close,
+                      "close() used without including <unistd.h>");
+#  endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gethostname
+#   define gethostname gethostname_used_without_including_unistd_h
+#  else
+     _GL_WARN_ON_USE (gethostname,
+                      "gethostname() used without including <unistd.h>");
+#  endif
+# endif
+# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef socket
+#   define socket              socket_used_without_including_sys_socket_h
+#   undef connect
+#   define connect             connect_used_without_including_sys_socket_h
+#   undef accept
+#   define accept              accept_used_without_including_sys_socket_h
+#   undef bind
+#   define bind                bind_used_without_including_sys_socket_h
+#   undef getpeername
+#   define getpeername         getpeername_used_without_including_sys_socket_h
+#   undef getsockname
+#   define getsockname         getsockname_used_without_including_sys_socket_h
+#   undef getsockopt
+#   define getsockopt          getsockopt_used_without_including_sys_socket_h
+#   undef listen
+#   define listen              listen_used_without_including_sys_socket_h
+#   undef recv
+#   define recv                recv_used_without_including_sys_socket_h
+#   undef send
+#   define send                send_used_without_including_sys_socket_h
+#   undef recvfrom
+#   define recvfrom            recvfrom_used_without_including_sys_socket_h
+#   undef sendto
+#   define sendto              sendto_used_without_including_sys_socket_h
+#   undef setsockopt
+#   define setsockopt          setsockopt_used_without_including_sys_socket_h
+#   undef shutdown
+#   define shutdown            shutdown_used_without_including_sys_socket_h
+#  else
+     _GL_WARN_ON_USE (socket,
+                      "socket() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (connect,
+                      "connect() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (accept,
+                      "accept() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (bind,
+                      "bind() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (getpeername,
+                      "getpeername() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (getsockname,
+                      "getsockname() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (getsockopt,
+                      "getsockopt() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (listen,
+                      "listen() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (recv,
+                      "recv() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (send,
+                      "send() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (recvfrom,
+                      "recvfrom() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (sendto,
+                      "sendto() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (setsockopt,
+                      "setsockopt() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (shutdown,
+                      "shutdown() used without including <sys/socket.h>");
+#  endif
+# endif
+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef select
+#   define select select_used_without_including_sys_select_h
+#  else
+     _GL_WARN_ON_USE (select,
+                      "select() used without including <sys/select.h>");
+#  endif
+# endif
+#endif
+
+#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
+#endif /* _CYGWIN_SYS_TIME_H */
+#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
deleted file mode 120000 (symlink)
index 6e1fae3454fcecdcbcca6f2703a23bf9126bf06d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_types.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0a0ccc3c3791171425b77395ee002eceb4bc9f87
--- /dev/null
@@ -0,0 +1,113 @@
+/* Provide a more complete sys/types.h.
+
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* This file uses #include_next of a system file that defines time_t.
+   For the 'year2038' module to work right, <config.h> needs to have been
+   included before.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__ \
+    && (defined __need_off_t || defined __need___off64_t \
+        || defined __need_ssize_t || defined __need_time_t)
+
+/* Special invocation convention inside mingw header files.  */
+
+#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
+
+/* The include_next requires a split double-inclusion guard.  */
+# define _GL_INCLUDING_SYS_TYPES_H
+#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
+# undef _GL_INCLUDING_SYS_TYPES_H
+
+#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
+#define _@GUARD_PREFIX@_SYS_TYPES_H
+
+/* Override off_t if Large File Support is requested on native Windows.  */
+#if @WINDOWS_64_BIT_OFF_T@
+/* Same as int64_t in <stdint.h>.  */
+# if defined _MSC_VER
+#  define off_t __int64
+# else
+#  define off_t long long int
+# endif
+/* Indicator, for gnulib internal purposes.  */
+# define _GL_WINDOWS_64_BIT_OFF_T 1
+#endif
+
+/* Override dev_t and ino_t if distinguishable inodes support is requested
+   on native Windows.  */
+#if @WINDOWS_STAT_INODES@
+
+# if @WINDOWS_STAT_INODES@ == 2
+/* Experimental, not useful in Windows 10.  */
+
+/* Define dev_t to a 64-bit type.  */
+#  if !defined GNULIB_defined_dev_t
+typedef unsigned long long int rpl_dev_t;
+#   undef dev_t
+#   define dev_t rpl_dev_t
+#   define GNULIB_defined_dev_t 1
+#  endif
+
+/* Define ino_t to a 128-bit type.  */
+#  if !defined GNULIB_defined_ino_t
+/* MSVC does not have a 128-bit integer type.
+   GCC has a 128-bit integer type __int128, but only on 64-bit targets.  */
+typedef struct { unsigned long long int _gl_ino[2]; } rpl_ino_t;
+#   undef ino_t
+#   define ino_t rpl_ino_t
+#   define GNULIB_defined_ino_t 1
+#  endif
+
+# else /* @WINDOWS_STAT_INODES@ == 1 */
+
+/* Define ino_t to a 64-bit type.  */
+#  if !defined GNULIB_defined_ino_t
+typedef unsigned long long int rpl_ino_t;
+#   undef ino_t
+#   define ino_t rpl_ino_t
+#   define GNULIB_defined_ino_t 1
+#  endif
+
+# endif
+
+/* Indicator, for gnulib internal purposes.  */
+# define _GL_WINDOWS_STAT_INODES @WINDOWS_STAT_INODES@
+
+#endif
+
+/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (defined _WIN32 && ! defined __CYGWIN__) && ! defined __GLIBC__
+# include <stddef.h>
+#endif
+
+#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
+#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
+#endif /* __need_XXX */
deleted file mode 120000 (symlink)
index b0cbb86b88ba5c463c7d72b865840f44e98dcb75..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_uio.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5e71859d4b602331a6ab4d301a23fe826f5f2381
--- /dev/null
@@ -0,0 +1,63 @@
+/* Substitute for <sys/uio.h>.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
+@PRAGMA_COLUMNS@
+
+#ifndef _@GUARD_PREFIX@_SYS_UIO_H
+
+#if @HAVE_SYS_UIO_H@
+
+/* On OpenBSD 4.4, <sys/uio.h> assumes prior inclusion of <sys/types.h>.  */
+# include <sys/types.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_UIO_H
+#define _@GUARD_PREFIX@_SYS_UIO_H
+
+#if !@HAVE_SYS_UIO_H@
+/* A platform that lacks <sys/uio.h>.  */
+/* Get 'size_t' and 'ssize_t'.  */
+# include <sys/types.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if !GNULIB_defined_struct_iovec
+/* All known platforms that lack <sys/uio.h> also lack any declaration
+   of struct iovec in any other header.  */
+struct iovec {
+  void *iov_base;
+  size_t iov_len;
+};
+#  define GNULIB_defined_struct_iovec 1
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
+#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
deleted file mode 120000 (symlink)
index 70398aaa1be516babe8fffea61d72f15d6d696b8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_utsname.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..45ba592763838d72a69c52f76b58961a9d14f78d
--- /dev/null
@@ -0,0 +1,116 @@
+/* Substitute for <sys/utsname.h>.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_SYS_UTSNAME_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_SYS_UTSNAME_H@
+
+/* Minix 3.1.8 has a bug: <stddef.h> must be included before <sys/utsname.h>.
+   But avoid namespace pollution on glibc systems.  */
+# if defined __minix && !defined __GLIBC__
+#  include <stddef.h>
+# endif
+
+# @INCLUDE_NEXT@ @NEXT_SYS_UTSNAME_H@
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_UTSNAME_H
+#define _@GUARD_PREFIX@_SYS_UTSNAME_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !@HAVE_STRUCT_UTSNAME@
+/* Length of the entries in 'struct utsname' is 256.  */
+# define _UTSNAME_LENGTH 256
+
+# ifndef _UTSNAME_NODENAME_LENGTH
+#  define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
+# endif
+# ifndef _UTSNAME_SYSNAME_LENGTH
+#  define _UTSNAME_SYSNAME_LENGTH _UTSNAME_LENGTH
+# endif
+# ifndef _UTSNAME_RELEASE_LENGTH
+#  define _UTSNAME_RELEASE_LENGTH _UTSNAME_LENGTH
+# endif
+# ifndef _UTSNAME_VERSION_LENGTH
+#  define _UTSNAME_VERSION_LENGTH _UTSNAME_LENGTH
+# endif
+# ifndef _UTSNAME_MACHINE_LENGTH
+#  define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
+# endif
+
+# if !GNULIB_defined_struct_utsname
+/* Structure describing the system and machine.  */
+struct utsname
+  {
+    /* Name of this node on the network.  */
+    char nodename[_UTSNAME_NODENAME_LENGTH];
+
+    /* Name of the implementation of the operating system.  */
+    char sysname[_UTSNAME_SYSNAME_LENGTH];
+    /* Current release level of this implementation.  */
+    char release[_UTSNAME_RELEASE_LENGTH];
+    /* Current version level of this release.  */
+    char version[_UTSNAME_VERSION_LENGTH];
+
+    /* Name of the hardware type the system is running on.  */
+    char machine[_UTSNAME_MACHINE_LENGTH];
+  };
+#  define GNULIB_defined_struct_utsname 1
+# endif
+
+#endif /* !@HAVE_STRUCT_UTSNAME@ */
+
+
+#if @GNULIB_UNAME@
+# if !@HAVE_UNAME@
+extern int uname (struct utsname *buf) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef uname
+# if HAVE_RAW_DECL_UNAME
+_GL_WARN_ON_USE (uname, "uname is unportable - "
+                 "use gnulib module uname for portability");
+# endif
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SYS_UTSNAME_H */
+#endif /* _@GUARD_PREFIX@_SYS_UTSNAME_H */
deleted file mode 120000 (symlink)
index 0b6cf178b09c375ffb6923e7ce4d066633bfc55c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/sys_wait.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0d87631c0db4835a1956cd026faebe563b402215
--- /dev/null
@@ -0,0 +1,136 @@
+/* A POSIX-like <sys/wait.h>.
+   Copyright (C) 2001-2003, 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+
+#ifndef _@GUARD_PREFIX@_SYS_WAIT_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#if !(defined _WIN32 && ! defined __CYGWIN__)
+# @INCLUDE_NEXT@ @NEXT_SYS_WAIT_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_WAIT_H
+#define _@GUARD_PREFIX@_SYS_WAIT_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get pid_t.  */
+#include <sys/types.h>
+
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+#if !(defined _WIN32 && ! defined __CYGWIN__)
+/* Unix API.  */
+
+/* The following macros apply to an argument x, that is a status of a process,
+   as returned by waitpid().
+   On nearly all systems, including Linux/x86, WEXITSTATUS are bits 15..8 and
+   WTERMSIG are bits 7..0, while BeOS uses the opposite.  Therefore programs
+   have to use the abstract macros.  */
+
+/* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x)
+   is true.  */
+# ifndef WIFSIGNALED
+#  define WIFSIGNALED(x) (WTERMSIG (x) != 0 && WTERMSIG(x) != 0x7f)
+# endif
+# ifndef WIFEXITED
+#  define WIFEXITED(x) (WTERMSIG (x) == 0)
+# endif
+# ifndef WIFSTOPPED
+#  define WIFSTOPPED(x) (WTERMSIG (x) == 0x7f)
+# endif
+
+/* The termination signal. Only to be accessed if WIFSIGNALED(x) is true.  */
+# ifndef WTERMSIG
+#  define WTERMSIG(x) ((x) & 0x7f)
+# endif
+
+/* The exit status. Only to be accessed if WIFEXITED(x) is true.  */
+# ifndef WEXITSTATUS
+#  define WEXITSTATUS(x) (((x) >> 8) & 0xff)
+# endif
+
+/* The stopping signal. Only to be accessed if WIFSTOPPED(x) is true.  */
+# ifndef WSTOPSIG
+#  define WSTOPSIG(x) (((x) >> 8) & 0x7f)
+# endif
+
+/* True if the process dumped core.  Not standardized by POSIX.  */
+# ifndef WCOREDUMP
+#  define WCOREDUMP(x) ((x) & 0x80)
+# endif
+
+#else
+/* Native Windows API.  */
+
+# include <signal.h> /* for SIGTERM */
+
+/* The following macros apply to an argument x, that is a status of a process,
+   as returned by waitpid() or, equivalently, _cwait() or GetExitCodeProcess().
+   This value is simply an 'int', not composed of bit fields.  */
+
+/* When an unhandled fatal signal terminates a process, the exit code is 3.  */
+# define WIFSIGNALED(x) ((x) == 3)
+# define WIFEXITED(x) ((x) != 3)
+# define WIFSTOPPED(x) 0
+
+/* The signal that terminated a process is not known posthum.  */
+# define WTERMSIG(x) SIGTERM
+
+# define WEXITSTATUS(x) (x)
+
+/* There are no stopping signals.  */
+# define WSTOPSIG(x) 0
+
+/* There are no core dumps.  */
+# define WCOREDUMP(x) 0
+
+#endif
+
+
+/* Declarations of functions.  */
+
+#if @GNULIB_WAITPID@
+# if defined _WIN32 && ! defined __CYGWIN__
+_GL_FUNCDECL_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
+# endif
+/* Need to cast, because on Cygwin, the second parameter is
+                                                __wait_status_ptr_t statusp.  */
+_GL_CXXALIAS_SYS_CAST (waitpid, pid_t, (pid_t pid, int *statusp, int options));
+_GL_CXXALIASWARN (waitpid);
+#elif defined GNULIB_POSIXCHECK
+# undef waitpid
+# if HAVE_RAW_DECL_WAITPID
+_GL_WARN_ON_USE (waitpid, "waitpid is unportable - "
+                 "use gnulib module sys_wait for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */
+#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */
deleted file mode 120000 (symlink)
index 65b1b973bc6c6e3cbacdd6cfd3d3d73a5819ce88..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/tempname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fec5f7b29d6cdab9bb56f0acea072f39101e90b4
--- /dev/null
@@ -0,0 +1,286 @@
+/* Copyright (C) 1991-2024 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#if !_LIBC
+# include <libc-config.h>
+# include "tempname.h"
+#endif
+
+#include <errno.h>
+
+#include <stdio.h>
+#ifndef TMP_MAX
+# define TMP_MAX 238328
+#endif
+#ifndef __GT_FILE
+# define __GT_FILE      0
+# define __GT_DIR       1
+# define __GT_NOCREATE  2
+#endif
+#if !_LIBC && (GT_FILE != __GT_FILE || GT_DIR != __GT_DIR       \
+               || GT_NOCREATE != __GT_NOCREATE)
+# error report this to bug-gnulib@gnu.org
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <fcntl.h>
+#include <stdint.h>
+#include <sys/random.h>
+#include <sys/stat.h>
+#include <time.h>
+
+#if _LIBC
+# define struct_stat64 struct __stat64_t64
+#else
+# define struct_stat64 struct stat
+# define __gen_tempname gen_tempname
+# define __mkdir mkdir
+# define __open open
+# define __lstat64_time64(file, buf) lstat (file, buf)
+# define __getrandom getrandom
+# define __clock_gettime64 clock_gettime
+# define __timespec64 timespec
+#endif
+
+/* Use getrandom if it works, falling back on a 64-bit linear
+   congruential generator that starts with Var's value
+   mixed in with a clock's low-order bits if available.  */
+typedef uint_fast64_t random_value;
+#define RANDOM_VALUE_MAX UINT_FAST64_MAX
+#define BASE_62_DIGITS 10 /* 62**10 < UINT_FAST64_MAX */
+#define BASE_62_POWER (62LL * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62)
+
+/* Return the result of mixing the entropy from R and S.
+   Assume that R and S are not particularly random,
+   and that the result should look randomish to an untrained eye.  */
+
+static random_value
+mix_random_values (random_value r, random_value s)
+{
+  /* As this code is used only when high-quality randomness is neither
+     available nor necessary, there is no need for fancier polynomials
+     such as those in the Linux kernel's 'random' driver.  */
+  return (2862933555777941757 * r + 3037000493) ^ s;
+}
+
+/* Set *R to a random value.
+   Return true if *R is set to high-quality value taken from getrandom.
+   Otherwise return false, falling back to a low-quality *R that might
+   depend on S.
+
+   This function returns false only when getrandom fails.
+   On GNU systems this should happen only early in the boot process,
+   when the fallback should be good enough for programs using tempname
+   because any attacker likely has root privileges already.  */
+
+static bool
+random_bits (random_value *r, random_value s)
+{
+  /* Without GRND_NONBLOCK it can be blocked for minutes on some systems.  */
+  if (__getrandom (r, sizeof *r, GRND_NONBLOCK) == sizeof *r)
+    return true;
+
+  /* If getrandom did not work, use ersatz entropy based on low-order
+     clock bits.  On GNU systems getrandom should fail only
+     early in booting, when ersatz should be good enough.
+     Do not use ASLR-based entropy, as that would leak ASLR info into
+     the resulting file name which is typically public.
+
+     Of course we are in a state of sin here.  */
+
+  random_value v = s;
+
+#if _LIBC || (defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME)
+  struct __timespec64 tv;
+  __clock_gettime64 (CLOCK_REALTIME, &tv);
+  v = mix_random_values (v, tv.tv_sec);
+  v = mix_random_values (v, tv.tv_nsec);
+#endif
+
+  *r = mix_random_values (v, clock ());
+  return false;
+}
+
+#if _LIBC
+static int try_tempname_len (char *, int, void *, int (*) (char *, void *),
+                             size_t);
+#endif
+
+static int
+try_file (char *tmpl, void *flags)
+{
+  int *openflags = flags;
+  return __open (tmpl,
+                 (*openflags & ~O_ACCMODE)
+                 | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+}
+
+static int
+try_dir (char *tmpl, _GL_UNUSED void *flags)
+{
+  return __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
+}
+
+static int
+try_nocreate (char *tmpl, _GL_UNUSED void *flags)
+{
+  struct_stat64 st;
+
+  if (__lstat64_time64 (tmpl, &st) == 0 || errno == EOVERFLOW)
+    __set_errno (EEXIST);
+  return errno == ENOENT ? 0 : -1;
+}
+
+/* These are the characters used in temporary file names.  */
+static const char letters[] =
+"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
+/* Generate a temporary file name based on TMPL.  TMPL must match the
+   rules for mk[s]temp (i.e., end in at least X_SUFFIX_LEN "X"s,
+   possibly with a suffix).
+   The name constructed does not exist at the time of the call to
+   this function.  TMPL is overwritten with the result.
+
+   KIND may be one of:
+   __GT_NOCREATE:       simply verify that the name does not exist
+                        at the time of the call.
+   __GT_FILE:           create the file using open(O_CREAT|O_EXCL)
+                        and return a read-write fd.  The file is mode 0600.
+   __GT_DIR:            create a directory, which will be mode 0700.
+
+   */
+#ifdef _LIBC
+static
+#endif
+int
+gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+                  size_t x_suffix_len)
+{
+  static int (*const tryfunc[]) (char *, void *) =
+    {
+      [__GT_FILE] = try_file,
+      [__GT_DIR] = try_dir,
+      [__GT_NOCREATE] = try_nocreate
+    };
+  return try_tempname_len (tmpl, suffixlen, &flags, tryfunc[kind],
+                           x_suffix_len);
+}
+
+#ifdef _LIBC
+static
+#endif
+int
+try_tempname_len (char *tmpl, int suffixlen, void *args,
+                  int (*tryfunc) (char *, void *), size_t x_suffix_len)
+{
+  size_t len;
+  char *XXXXXX;
+  unsigned int count;
+  int fd = -1;
+  int save_errno = errno;
+
+  /* A lower bound on the number of temporary files to attempt to
+     generate.  The maximum total number of temporary file names that
+     can exist for a given template is 62**6.  It should never be
+     necessary to try all of these combinations.  Instead if a reasonable
+     number of names is tried (we define reasonable as 62**3) fail to
+     give the system administrator the chance to remove the problems.
+     This value requires that X_SUFFIX_LEN be at least 3.  */
+#define ATTEMPTS_MIN (62 * 62 * 62)
+
+  /* The number of times to attempt to generate a temporary file.  To
+     conform to POSIX, this must be no smaller than TMP_MAX.  */
+#if ATTEMPTS_MIN < TMP_MAX
+  unsigned int attempts = TMP_MAX;
+#else
+  unsigned int attempts = ATTEMPTS_MIN;
+#endif
+
+  /* A random variable.  */
+  random_value v = 0;
+
+  /* A value derived from the random variable, and how many random
+     base-62 digits can currently be extracted from VDIGBUF.  */
+  random_value vdigbuf;
+  int vdigits = 0;
+
+  /* Least biased value for V.  If V is less than this, V can generate
+     BASE_62_DIGITS unbiased digits.  Otherwise the digits are biased.  */
+  random_value const biased_min
+    = RANDOM_VALUE_MAX - RANDOM_VALUE_MAX % BASE_62_POWER;
+
+  len = strlen (tmpl);
+  if (len < x_suffix_len + suffixlen
+      || strspn (&tmpl[len - x_suffix_len - suffixlen], "X") < x_suffix_len)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* This is where the Xs start.  */
+  XXXXXX = &tmpl[len - x_suffix_len - suffixlen];
+
+  for (count = 0; count < attempts; ++count)
+    {
+      for (size_t i = 0; i < x_suffix_len; i++)
+        {
+          if (vdigits == 0)
+            {
+              /* Worry about bias only if the bits are high quality.  */
+              while (random_bits (&v, v) && biased_min <= v)
+                continue;
+
+              vdigbuf = v;
+              vdigits = BASE_62_DIGITS;
+            }
+
+          XXXXXX[i] = letters[vdigbuf % 62];
+          vdigbuf /= 62;
+          vdigits--;
+        }
+
+      fd = tryfunc (tmpl, args);
+      if (fd >= 0)
+        {
+          __set_errno (save_errno);
+          return fd;
+        }
+      else if (errno != EEXIST)
+        return -1;
+    }
+
+  /* We got out of the loop because we ran out of combinations to try.  */
+  __set_errno (EEXIST);
+  return -1;
+}
+
+int
+__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
+{
+  return gen_tempname_len (tmpl, suffixlen, flags, kind, 6);
+}
+
+#if !_LIBC
+int
+try_tempname (char *tmpl, int suffixlen, void *args,
+              int (*tryfunc) (char *, void *))
+{
+  return try_tempname_len (tmpl, suffixlen, args, tryfunc, 6);
+}
+#endif
deleted file mode 120000 (symlink)
index 6a7f97fe020b04d16c21a79398567ec319de563a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/tempname.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7cbdac95dea97a95ac65a0ffe224acb22066aadf
--- /dev/null
@@ -0,0 +1,72 @@
+/* Create a temporary file or directory.
+
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* header written by Eric Blake */
+
+#ifndef GL_TEMPNAME_H
+# define GL_TEMPNAME_H
+
+# include <stdio.h>
+
+# ifdef __GT_FILE
+#  define GT_FILE     __GT_FILE
+#  define GT_DIR      __GT_DIR
+#  define GT_NOCREATE __GT_NOCREATE
+# else
+#  define GT_FILE     0
+#  define GT_DIR      1
+#  define GT_NOCREATE 2
+# endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Generate a temporary file name based on TMPL.  TMPL must match the
+   rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
+   The name constructed does not exist at the time of the call to
+   gen_tempname.  TMPL is overwritten with the result.
+
+   KIND may be one of:
+   GT_NOCREATE:         simply verify that the name does not exist
+                        at the time of the call.
+   GT_FILE:             create a large file using open(O_CREAT|O_EXCL)
+                        and return a read-write fd.  The file is mode 0600.
+   GT_DIR:              create a directory, which will be mode 0700.
+
+   */
+extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
+/* Similar, except X_SUFFIX_LEN gives the number of Xs.  */
+extern int gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+                             size_t x_suffix_len);
+
+/* Similar to gen_tempname, but TRYFUNC is called for each temporary
+   name to try.  If TRYFUNC returns a non-negative number, TRY_GEN_TEMPNAME
+   returns with this value.  Otherwise, if errno is set to EEXIST, another
+   name is tried, or else TRY_GEN_TEMPNAME returns -1. */
+extern int try_tempname (char *tmpl, int suffixlen, void *args,
+                         int (*tryfunc) (char *, void *));
+/* Similar, except X_SUFFIX_LEN gives the number of Xs.  */
+extern int try_tempname_len (char *tmpl, int suffixlen, void *args,
+                             int (*tryfunc) (char *, void *),
+                             size_t x_suffix_len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GL_TEMPNAME_H */
deleted file mode 120000 (symlink)
index 74048cc8c799257813e9ce2f8b4406afa50777e6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/termios.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a7c1f3f90a2c78495c6794a7024aaf06a2098f2a
--- /dev/null
@@ -0,0 +1,78 @@
+/* Substitute for and wrapper around <termios.h>.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_TERMIOS_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* On HP-UX 11.00, some of the function declarations in <sys/termio.h>,
+   included by <termios.h>, are not protected by extern "C".  Enforce
+   "C" linkage for these functions nevertheless.  */
+#if defined __hpux && defined __cplusplus
+# include <sys/types.h>
+# include <sys/ioctl.h>
+extern "C" {
+# include <sys/termio.h>
+}
+#endif
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_TERMIOS_H@
+# @INCLUDE_NEXT@ @NEXT_TERMIOS_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_TERMIOS_H
+#define _@GUARD_PREFIX@_TERMIOS_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get pid_t.  */
+#include <sys/types.h>
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Declare overridden functions.  */
+
+#if @GNULIB_TCGETSID@
+/* Return the session ID of the controlling terminal of the current process.
+   The argument is a descriptor if this controlling terminal.
+   Return -1, with errno set, upon failure.  errno = ENOSYS means that the
+   function is unsupported.  */
+# if !@HAVE_DECL_TCGETSID@
+_GL_FUNCDECL_SYS (tcgetsid, pid_t, (int fd));
+# endif
+_GL_CXXALIAS_SYS (tcgetsid, pid_t, (int fd));
+_GL_CXXALIASWARN (tcgetsid);
+#elif defined GNULIB_POSIXCHECK
+# undef tcgetsid
+# if HAVE_RAW_DECL_TCGETSID
+_GL_WARN_ON_USE (tcgetsid, "tcgetsid is not portable - "
+                 "use gnulib module tcgetsid for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_TERMIOS_H */
+#endif /* _@GUARD_PREFIX@_TERMIOS_H */
deleted file mode 120000 (symlink)
index 1fe8992ccad18e97c74ef1ca7af501cf056a5ce5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/time-internal.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..816684a11726828f1b345bf0426fb3bd5dde6103
--- /dev/null
@@ -0,0 +1,49 @@
+/* Time internal interface
+
+   Copyright 2015-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* A time zone rule.  */
+struct tm_zone
+{
+  /* More abbreviations, should they be needed.  Their TZ_IS_SET
+     members are zero.  */
+  struct tm_zone *next;
+
+#if HAVE_TZNAME && !HAVE_STRUCT_TM_TM_ZONE
+  /* Copies of recent strings taken from tzname[0] and tzname[1].
+     The copies are in ABBRS, so that they survive tzset.  Null if unknown.  */
+  char *tzname_copy[2];
+#endif
+
+  /* If nonzero, the rule represents the TZ environment variable set
+     to the first "abbreviation" (this may be the empty string).
+     Otherwise, it represents an unset TZ.  */
+  char tz_is_set;
+
+  /* A sequence of null-terminated strings packed next to each other.
+     The strings are followed by an extra null byte.  If TZ_IS_SET,
+     there must be at least one string and the first string (which is
+     actually a TZ environment value) may be empty.  Otherwise all
+     strings must be nonempty.
+
+     Abbreviations are stored here because otherwise the values of
+     tm_zone and/or tzname would be dead after changing TZ and calling
+     tzset.  Abbreviations never move once allocated, and are live
+     until tzfree is called.  */
+  char abbrs[FLEXIBLE_ARRAY_MEMBER];
+};
deleted file mode 120000 (symlink)
index ac7b2b714d91b5075ff09999ae040b17c7330cb2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/time.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..573199c2bb678b22833ed5d9dec417cde2d1add6
--- /dev/null
@@ -0,0 +1,41 @@
+/* Provide time() for systems for which it's broken.
+   Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <time.h>
+
+#include <stdlib.h>
+#include <sys/time.h>
+
+time_t
+time (time_t *tp)
+{
+  struct timeval tv;
+  time_t tt;
+
+  if (gettimeofday (&tv, NULL) < 0)
+    abort ();
+  tt = tv.tv_sec;
+
+  if (tp)
+    *tp = tt;
+
+  return tt;
+}
deleted file mode 120000 (symlink)
index 8ea1d8c0525dc075c6116f0fc6131c586500f193..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/time.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..df99c8abca9b932e8427e1c37e931e563cb885f0
--- /dev/null
@@ -0,0 +1,589 @@
+/* A more-standard <time.h>.
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* This file uses #include_next of a system file that defines time_t.
+   For the 'year2038' module to work right, <config.h> needs to have been
+   included before.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Don't get in the way of glibc when it includes time.h merely to
+   declare a few standard symbols, rather than to declare all the
+   symbols.  (However, skip this for MinGW as it treats __need_time_t
+   incompatibly.)  Also, Solaris 8 <time.h> eventually includes itself
+   recursively; if that is happening, just include the system <time.h>
+   without adding our own declarations.  */
+#if (((defined __need_time_t || defined __need_clock_t \
+       || defined __need_timespec)                     \
+      && !defined __MINGW32__)                         \
+     || defined _@GUARD_PREFIX@_TIME_H)
+
+# @INCLUDE_NEXT@ @NEXT_TIME_H@
+
+#else
+
+# define _@GUARD_PREFIX@_TIME_H
+
+/* mingw's <time.h> provides the functions asctime_r, ctime_r, gmtime_r,
+   localtime_r only if <unistd.h> or <pthread.h> has been included before.  */
+# if defined __MINGW32__
+#  include <unistd.h>
+# endif
+
+# @INCLUDE_NEXT@ @NEXT_TIME_H@
+
+/* This file uses _GL_ATTRIBUTE_DEPRECATED, GNULIB_POSIXCHECK,
+   HAVE_RAW_DECL_*.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+/* NetBSD 5.0 mis-defines NULL.  */
+# include <stddef.h>
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* Some systems don't define struct timespec (e.g., AIX 4.1).
+   Or they define it with the wrong member names or define it in <sys/time.h>
+   (e.g., FreeBSD circa 1997).  Stock Mingw prior to 3.0 does not define it,
+   but the pthreads-win32 library defines it in <pthread.h>.  */
+# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
+#  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
+#   include <sys/time.h>
+#  elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
+#   include <pthread.h>
+#  elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
+#   include <unistd.h>
+#  else
+
+#   ifdef __cplusplus
+extern "C" {
+#   endif
+
+#   if !GNULIB_defined_struct_timespec
+#    undef timespec
+#    define timespec rpl_timespec
+struct timespec
+{
+  time_t tv_sec;
+  long int tv_nsec;
+};
+#    define GNULIB_defined_struct_timespec 1
+#   endif
+
+#   ifdef __cplusplus
+}
+#   endif
+
+#  endif
+# endif
+
+# if !GNULIB_defined_struct_time_t_must_be_integral
+/* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
+   requires time_t to be an integer type, even though C99 permits floating
+   point.  We don't know of any implementation that uses floating
+   point, and it is much easier to write code that doesn't have to
+   worry about that corner case, so we force the issue.  */
+struct __time_t_must_be_integral {
+  unsigned int __floating_time_t_unsupported : (time_t) 1;
+};
+#  define GNULIB_defined_struct_time_t_must_be_integral 1
+# endif
+
+/* Define TIME_UTC, a positive integer constant used for timespec_get().  */
+# if ! @TIME_H_DEFINES_TIME_UTC@
+#  if !GNULIB_defined_TIME_UTC
+#   define TIME_UTC 1
+#   define GNULIB_defined_TIME_UTC 1
+#  endif
+# endif
+
+/* Set *TS to the current time, and return BASE.
+   Upon failure, return 0.  */
+# if @GNULIB_TIMESPEC_GET@
+#  if @REPLACE_TIMESPEC_GET@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef timespec_get
+#    define timespec_get rpl_timespec_get
+#   endif
+_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base)
+                                     _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base));
+#  else
+#   if !@HAVE_TIMESPEC_GET@
+_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base)
+                                     _GL_ARG_NONNULL ((1)));
+#   endif
+_GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base));
+#  endif
+#  if __GLIBC__ >= 2
+_GL_CXXALIASWARN (timespec_get);
+#  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef timespec_get
+#  if HAVE_RAW_DECL_TIMESPEC_GET
+_GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - "
+                 "use gnulib module timespec_get for portability");
+#  endif
+# endif
+
+/* Set *TS to the current time resolution, and return BASE.
+   Upon failure, return 0.  */
+# if @GNULIB_TIMESPEC_GETRES@
+#  if @REPLACE_TIMESPEC_GETRES@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef timespec_getres
+#    define timespec_getres rpl_timespec_getres
+#   endif
+_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base)
+                                        _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base));
+#  else
+#   if !@HAVE_TIMESPEC_GETRES@
+_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base)
+                                        _GL_ARG_NONNULL ((1)));
+#   endif
+_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
+#  endif
+_GL_CXXALIASWARN (timespec_getres);
+# elif defined GNULIB_POSIXCHECK
+#  undef timespec_getres
+#  if HAVE_RAW_DECL_TIMESPEC_GETRES
+_GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - "
+                 "use gnulib module timespec_getres for portability");
+#  endif
+# endif
+
+/* Return the number of seconds that have elapsed since the Epoch.  */
+# if @GNULIB_TIME@
+#  if @REPLACE_TIME@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    define time rpl_time
+#   endif
+_GL_FUNCDECL_RPL (time, time_t, (time_t *__tp));
+_GL_CXXALIAS_RPL (time, time_t, (time_t *__tp));
+#  else
+_GL_CXXALIAS_SYS (time, time_t, (time_t *__tp));
+#  endif
+#  if __GLIBC__ >= 2
+_GL_CXXALIASWARN (time);
+#  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef time
+#  if HAVE_RAW_DECL_TIME
+_GL_WARN_ON_USE (time, "time has consistency problems - "
+                 "use gnulib module time for portability");
+#  endif
+# endif
+
+/* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
+   return -1 and store the remaining time into RMTP.  See
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/nanosleep.html>.  */
+# if @GNULIB_NANOSLEEP@
+#  if @REPLACE_NANOSLEEP@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    define nanosleep rpl_nanosleep
+#   endif
+_GL_FUNCDECL_RPL (nanosleep, int,
+                  (struct timespec const *__rqtp, struct timespec *__rmtp)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (nanosleep, int,
+                  (struct timespec const *__rqtp, struct timespec *__rmtp));
+#  else
+#   if ! @HAVE_NANOSLEEP@
+_GL_FUNCDECL_SYS (nanosleep, int,
+                  (struct timespec const *__rqtp, struct timespec *__rmtp)
+                  _GL_ARG_NONNULL ((1)));
+#   endif
+_GL_CXXALIAS_SYS (nanosleep, int,
+                  (struct timespec const *__rqtp, struct timespec *__rmtp));
+#  endif
+_GL_CXXALIASWARN (nanosleep);
+# elif defined GNULIB_POSIXCHECK
+#  undef nanosleep
+#  if HAVE_RAW_DECL_NANOSLEEP
+_GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - "
+                 "use gnulib module nanosleep for portability");
+#  endif
+# endif
+
+/* Initialize time conversion information.  */
+# if @GNULIB_TZSET@
+#  if @REPLACE_TZSET@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef tzset
+#    define tzset rpl_tzset
+#   endif
+_GL_FUNCDECL_RPL (tzset, void, (void));
+_GL_CXXALIAS_RPL (tzset, void, (void));
+#  elif defined _WIN32 && !defined __CYGWIN__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef tzset
+#    define tzset _tzset
+#   endif
+_GL_CXXALIAS_MDA (tzset, void, (void));
+#  else
+_GL_CXXALIAS_SYS (tzset, void, (void));
+#  endif
+_GL_CXXALIASWARN (tzset);
+# elif @GNULIB_MDA_TZSET@
+/* On native Windows, map 'tzset' to '_tzset', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::tzset always.  */
+#  if defined _WIN32 && !defined __CYGWIN__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef tzset
+#    define tzset _tzset
+#   endif
+_GL_CXXALIAS_MDA (tzset, void, (void));
+#  else
+_GL_CXXALIAS_SYS (tzset, void, (void));
+#  endif
+_GL_CXXALIASWARN (tzset);
+# elif defined GNULIB_POSIXCHECK
+#  undef tzset
+#  if HAVE_RAW_DECL_TZSET
+_GL_WARN_ON_USE (tzset, "tzset has portability problems - "
+                 "use gnulib module tzset for portability");
+#  endif
+# endif
+
+/* Return the 'time_t' representation of TP and normalize TP.  */
+# if @GNULIB_MKTIME@
+#  if @REPLACE_MKTIME@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    define mktime rpl_mktime
+#   endif
+_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
+#  else
+_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
+#  endif
+#  if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mktime);
+#  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef mktime
+#  if HAVE_RAW_DECL_MKTIME
+_GL_WARN_ON_USE (mktime, "mktime has portability problems - "
+                 "use gnulib module mktime for portability");
+#  endif
+# endif
+
+/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime_r.html> and
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime_r.html>.  */
+# if @GNULIB_TIME_R@
+#  if @REPLACE_LOCALTIME_R@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef localtime_r
+#    define localtime_r rpl_localtime_r
+#   endif
+_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
+                                             struct tm *restrict __result)
+                                            _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
+                                             struct tm *restrict __result));
+#  else
+#   if ! @HAVE_DECL_LOCALTIME_R@
+_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
+                                             struct tm *restrict __result)
+                                            _GL_ARG_NONNULL ((1, 2)));
+#   endif
+_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
+                                             struct tm *restrict __result));
+#  endif
+#  if @HAVE_DECL_LOCALTIME_R@
+_GL_CXXALIASWARN (localtime_r);
+#  endif
+#  if @REPLACE_LOCALTIME_R@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef gmtime_r
+#    define gmtime_r rpl_gmtime_r
+#   endif
+_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
+                                          struct tm *restrict __result)
+                                         _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
+                                          struct tm *restrict __result));
+#  else
+#   if ! @HAVE_DECL_LOCALTIME_R@
+_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
+                                          struct tm *restrict __result)
+                                         _GL_ARG_NONNULL ((1, 2)));
+#   endif
+_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
+                                          struct tm *restrict __result));
+#  endif
+#  if @HAVE_DECL_LOCALTIME_R@
+_GL_CXXALIASWARN (gmtime_r);
+#  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef localtime_r
+#  if HAVE_RAW_DECL_LOCALTIME_R
+_GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - "
+                 "use gnulib module time_r for portability");
+#  endif
+#  undef gmtime_r
+#  if HAVE_RAW_DECL_GMTIME_R
+_GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - "
+                 "use gnulib module time_r for portability");
+#  endif
+# endif
+
+/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime.html> and
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime.html>.  */
+# if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@
+#  if @REPLACE_LOCALTIME@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef localtime
+#    define localtime rpl_localtime
+#   endif
+_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
+                                          _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
+#  else
+_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
+#  endif
+#  if __GLIBC__ >= 2
+_GL_CXXALIASWARN (localtime);
+#  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef localtime
+#  if HAVE_RAW_DECL_LOCALTIME
+_GL_WARN_ON_USE (localtime, "localtime has portability problems - "
+                 "use gnulib module localtime for portability");
+#  endif
+# endif
+
+# if 0 || @REPLACE_GMTIME@
+#  if @REPLACE_GMTIME@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef gmtime
+#    define gmtime rpl_gmtime
+#   endif
+_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer)
+                                       _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
+#  else
+_GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer));
+#  endif
+_GL_CXXALIASWARN (gmtime);
+# endif
+
+/* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store
+   the resulting broken-down time into TM.  See
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html>.  */
+# if @GNULIB_STRPTIME@
+#  if ! @HAVE_STRPTIME@
+_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
+                                     char const *restrict __format,
+                                     struct tm *restrict __tm)
+                                    _GL_ARG_NONNULL ((1, 2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
+                                     char const *restrict __format,
+                                     struct tm *restrict __tm));
+_GL_CXXALIASWARN (strptime);
+# elif defined GNULIB_POSIXCHECK
+#  undef strptime
+#  if HAVE_RAW_DECL_STRPTIME
+_GL_WARN_ON_USE (strptime, "strptime is unportable - "
+                 "use gnulib module strptime for portability");
+#  endif
+# endif
+
+/* Convert *TP to a date and time string.  See
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html>.  */
+# if @GNULIB_CTIME@
+#  if @REPLACE_CTIME@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    define ctime rpl_ctime
+#   endif
+#   ifndef __cplusplus
+_GL_ATTRIBUTE_DEPRECATED
+#   endif
+_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp)
+                                 _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
+#  else
+_GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp));
+#  endif
+#  if __GLIBC__ >= 2
+_GL_CXXALIASWARN (ctime);
+#  endif
+# elif defined GNULIB_POSIXCHECK
+/* No need to warn about portability, as a more serious warning is below.  */
+# endif
+
+/* Convert *TP to a date and time string.  See
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html>.  */
+# if @GNULIB_STRFTIME@
+#  if @REPLACE_STRFTIME@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    define strftime rpl_strftime
+#   endif
+_GL_FUNCDECL_RPL (strftime, size_t,
+                  (char *restrict __buf, size_t __bufsize,
+                   const char *restrict __fmt, const struct tm *restrict __tp)
+                  _GL_ARG_NONNULL ((1, 3, 4)));
+_GL_CXXALIAS_RPL (strftime, size_t,
+                  (char *restrict __buf, size_t __bufsize,
+                   const char *restrict __fmt, const struct tm *restrict __tp));
+#  else
+_GL_CXXALIAS_SYS (strftime, size_t,
+                  (char *restrict __buf, size_t __bufsize,
+                   const char *restrict __fmt, const struct tm *restrict __tp));
+#  endif
+#  if __GLIBC__ >= 2
+_GL_CXXALIASWARN (strftime);
+#  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef strftime
+#  if HAVE_RAW_DECL_STRFTIME
+_GL_WARN_ON_USE (strftime, "strftime has portability problems - "
+                 "use gnulib module strftime-fixes for portability");
+#  endif
+# endif
+
+# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@
+/* Functions that use a first-class time zone data type, instead of
+   relying on an implicit global time zone.
+   Inspired by NetBSD.  */
+
+/* Represents a time zone.
+   (timezone_t) NULL stands for UTC.  */
+typedef struct tm_zone *timezone_t;
+
+/* tzalloc (name)
+   Returns a time zone object for the given time zone NAME.  This object
+   represents the time zone that other functions would use it the TZ
+   environment variable was set to NAME.
+   If NAME is NULL, the result represents the time zone that other functions
+   would use it the TZ environment variable was unset.
+   May return NULL if NAME is invalid (this is platform dependent) or
+   upon memory allocation failure.  */
+_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name));
+_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name));
+
+/* tzfree (tz)
+   Frees a time zone object.
+   The argument must have been returned by tzalloc().  */
+_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz));
+_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz));
+
+/* localtime_rz (tz, &t, &result)
+   Converts an absolute time T to a broken-down time RESULT, assuming the
+   time zone TZ.
+   This function is like 'localtime_r', but relies on the argument TZ instead
+   of an implicit global time zone.  */
+_GL_FUNCDECL_SYS (localtime_rz, struct tm *,
+                  (timezone_t __tz, time_t const *restrict __timer,
+                   struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_SYS (localtime_rz, struct tm *,
+                  (timezone_t __tz, time_t const *restrict __timer,
+                   struct tm *restrict __result));
+
+/* mktime_z (tz, &tm)
+   Normalizes the broken-down time TM and converts it to an absolute time,
+   assuming the time zone TZ.  Returns the absolute time.
+   This function is like 'mktime', but relies on the argument TZ instead
+   of an implicit global time zone.  */
+_GL_FUNCDECL_SYS (mktime_z, time_t,
+                  (timezone_t __tz, struct tm *restrict __tm)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_SYS (mktime_z, time_t,
+                  (timezone_t __tz, struct tm *restrict __tm));
+
+/* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z'
+   in the 'tm_zone' member of 'struct tm') are valid as long as
+     - the 'struct tm' argument is not destroyed or overwritten,
+   and
+     - the 'timezone_t' argument is not freed through tzfree().  */
+
+# endif
+
+/* Convert TM to a time_t value, assuming UTC.  */
+# if @GNULIB_TIMEGM@
+#  if @REPLACE_TIMEGM@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef timegm
+#    define timegm rpl_timegm
+#   endif
+_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
+#  else
+#   if ! @HAVE_TIMEGM@
+_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
+#   endif
+_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
+#  endif
+#  if __GLIBC__ >= 2
+_GL_CXXALIASWARN (timegm);
+#  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef timegm
+#  if HAVE_RAW_DECL_TIMEGM
+_GL_WARN_ON_USE (timegm, "timegm is unportable - "
+                 "use gnulib module timegm for portability");
+#  endif
+# endif
+
+/* Encourage applications to avoid unsafe functions that can overrun
+   buffers when given outlandish struct tm values.  Portable
+   applications should use strftime (or even sprintf) instead.  */
+# if defined GNULIB_POSIXCHECK
+#  undef asctime
+#  if HAVE_RAW_DECL_ASCTIME
+_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
+                 "better use strftime (or even sprintf) instead");
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef asctime_r
+#  if HAVE_RAW_DECL_ASCTIME_R
+_GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - "
+                 "better use strftime (or even sprintf) instead");
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef ctime
+#  if HAVE_RAW_DECL_CTIME
+_GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - "
+                 "better use strftime (or even sprintf) instead");
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef ctime_r
+#  if HAVE_RAW_DECL_CTIME_R
+_GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - "
+                 "better use strftime (or even sprintf) instead");
+#  endif
+# endif
+
+#endif
deleted file mode 120000 (symlink)
index f3e72e4ddb5f2b0066bfe03df35e46f5a9d0634a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/time_r.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3ef0b36802c543c0a42866ebb9e9a290270e128e
--- /dev/null
@@ -0,0 +1,44 @@
+/* Reentrant time functions like localtime_r.
+
+   Copyright (C) 2003, 2006-2007, 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include <time.h>
+
+static struct tm *
+copy_tm_result (struct tm *dest, struct tm const *src)
+{
+  if (! src)
+    return 0;
+  *dest = *src;
+  return dest;
+}
+
+
+struct tm *
+gmtime_r (time_t const * restrict t, struct tm * restrict tp)
+{
+  return copy_tm_result (tp, gmtime (t));
+}
+
+struct tm *
+localtime_r (time_t const * restrict t, struct tm * restrict tp)
+{
+  return copy_tm_result (tp, localtime (t));
+}
deleted file mode 120000 (symlink)
index f5224e51f7adf33f2f57a6f830fe47b1c0689d00..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/time_rz.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..468d7539ce17a694f333090998bc3c602dcad9ab
--- /dev/null
@@ -0,0 +1,316 @@
+/* Time zone functions such as tzalloc and localtime_rz
+
+   Copyright 2015-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* Although this module is not thread-safe, any races should be fairly
+   rare and reasonably benign.  For complete thread-safety, use a C
+   library with a working timezone_t type, so that this module is not
+   needed.  */
+
+#include <config.h>
+
+#include <time.h>
+
+#include <errno.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "flexmember.h"
+#include "idx.h"
+#include "time-internal.h"
+
+/* The approximate size to use for small allocation requests.  This is
+   the largest "small" request for the GNU C library malloc.  */
+enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 };
+
+/* Minimum size of the ABBRS member of struct tm_zone.  ABBRS is larger
+   only in the unlikely case where an abbreviation longer than this is
+   used.  */
+enum { ABBR_SIZE_MIN = DEFAULT_MXFAST - offsetof (struct tm_zone, abbrs) };
+
+/* Magic cookie timezone_t value, for local time.  It differs from
+   NULL and from all other timezone_t values.  Only the address
+   matters; the pointer is never dereferenced.  */
+static timezone_t const local_tz = (timezone_t) 1;
+
+/* Copy to ABBRS the abbreviation at ABBR with size ABBR_SIZE (this
+   includes its trailing null byte).  Append an extra null byte to
+   mark the end of ABBRS.  */
+static void
+extend_abbrs (char *abbrs, char const *abbr, size_t abbr_size)
+{
+  memcpy (abbrs, abbr, abbr_size);
+  abbrs[abbr_size] = '\0';
+}
+
+/* Return a newly allocated time zone for NAME, or NULL on failure.
+   A null NAME stands for wall clock time (which is like unset TZ).  */
+timezone_t
+tzalloc (char const *name)
+{
+  size_t name_size = name ? strlen (name) + 1 : 0;
+  size_t abbr_size = name_size < ABBR_SIZE_MIN ? ABBR_SIZE_MIN : name_size + 1;
+  timezone_t tz = malloc (FLEXSIZEOF (struct tm_zone, abbrs, abbr_size));
+  if (tz)
+    {
+      tz->next = NULL;
+#if HAVE_TZNAME && !HAVE_STRUCT_TM_TM_ZONE
+      tz->tzname_copy[0] = tz->tzname_copy[1] = NULL;
+#endif
+      tz->tz_is_set = !!name;
+      tz->abbrs[0] = '\0';
+      if (name)
+        extend_abbrs (tz->abbrs, name, name_size);
+    }
+  return tz;
+}
+
+/* Save into TZ any nontrivial time zone abbreviation used by TM, and
+   update *TM (if HAVE_STRUCT_TM_TM_ZONE) or *TZ (if
+   !HAVE_STRUCT_TM_TM_ZONE && HAVE_TZNAME) if they use the abbreviation.
+   Return true if successful, false (setting errno) otherwise.  */
+static bool
+save_abbr (timezone_t tz, struct tm *tm)
+{
+#if HAVE_STRUCT_TM_TM_ZONE || HAVE_TZNAME
+  char const *zone = NULL;
+  char *zone_copy = (char *) "";
+
+# if HAVE_TZNAME
+  int tzname_index = -1;
+# endif
+
+# if HAVE_STRUCT_TM_TM_ZONE
+  zone = tm->tm_zone;
+# endif
+
+# if HAVE_TZNAME
+  if (! (zone && *zone) && 0 <= tm->tm_isdst)
+    {
+      tzname_index = tm->tm_isdst != 0;
+      zone = tzname[tzname_index];
+    }
+# endif
+
+  /* No need to replace null zones, or zones within the struct tm.  */
+  if (!zone || ((char *) tm <= zone && zone < (char *) (tm + 1)))
+    return true;
+
+  if (*zone)
+    {
+      zone_copy = tz->abbrs;
+
+      while (strcmp (zone_copy, zone) != 0)
+        {
+          if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set)))
+            {
+              idx_t zone_size = strlen (zone) + 1;
+              if (zone_size < tz->abbrs + ABBR_SIZE_MIN - zone_copy)
+                extend_abbrs (zone_copy, zone, zone_size);
+              else
+                {
+                  tz = tz->next = tzalloc (zone);
+                  if (!tz)
+                    return false;
+                  tz->tz_is_set = 0;
+                  zone_copy = tz->abbrs;
+                }
+              break;
+            }
+
+          zone_copy += strlen (zone_copy) + 1;
+          if (!*zone_copy && tz->next)
+            {
+              tz = tz->next;
+              zone_copy = tz->abbrs;
+            }
+        }
+    }
+
+  /* Replace the zone name so that its lifetime matches that of TZ.  */
+# if HAVE_STRUCT_TM_TM_ZONE
+  tm->tm_zone = zone_copy;
+# else
+  if (0 <= tzname_index)
+    tz->tzname_copy[tzname_index] = zone_copy;
+# endif
+#endif
+
+  return true;
+}
+
+/* Free a time zone.  */
+void
+tzfree (timezone_t tz)
+{
+  if (tz != local_tz)
+    while (tz)
+      {
+        timezone_t next = tz->next;
+        free (tz);
+        tz = next;
+      }
+}
+
+/* Get and set the TZ environment variable.  These functions can be
+   overridden by programs like Emacs that manage their own environment.  */
+
+#ifndef getenv_TZ
+static char *
+getenv_TZ (void)
+{
+  return getenv ("TZ");
+}
+#endif
+
+#ifndef setenv_TZ
+static int
+setenv_TZ (char const *tz)
+{
+  return tz ? setenv ("TZ", tz, 1) : unsetenv ("TZ");
+}
+#endif
+
+/* Change the environment to match the specified timezone_t value.
+   Return true if successful, false (setting errno) otherwise.  */
+static bool
+change_env (timezone_t tz)
+{
+  if (setenv_TZ (tz->tz_is_set ? tz->abbrs : NULL) != 0)
+    return false;
+  tzset ();
+  return true;
+}
+
+/* Temporarily set the time zone to TZ, which must not be null.
+   Return LOCAL_TZ if the time zone setting is already correct.
+   Otherwise return a newly allocated time zone representing the old
+   setting, or NULL (setting errno) on failure.  */
+static timezone_t
+set_tz (timezone_t tz)
+{
+  char *env_tz = getenv_TZ ();
+  if (env_tz
+      ? tz->tz_is_set && strcmp (tz->abbrs, env_tz) == 0
+      : !tz->tz_is_set)
+    return local_tz;
+  else
+    {
+      timezone_t old_tz = tzalloc (env_tz);
+      if (!old_tz)
+        return old_tz;
+      if (! change_env (tz))
+        {
+          int saved_errno = errno;
+          tzfree (old_tz);
+          errno = saved_errno;
+          return NULL;
+        }
+      return old_tz;
+    }
+}
+
+/* Restore an old setting returned by set_tz.  It must not be null.
+   Return true (preserving errno) if successful, false (setting errno)
+   otherwise.  */
+static bool
+revert_tz (timezone_t tz)
+{
+  if (tz == local_tz)
+    return true;
+  else
+    {
+      int saved_errno = errno;
+      bool ok = change_env (tz);
+      if (!ok)
+        saved_errno = errno;
+      tzfree (tz);
+      errno = saved_errno;
+      return ok;
+    }
+}
+
+/* Use time zone TZ to compute localtime_r (T, TM).  */
+struct tm *
+localtime_rz (timezone_t tz, time_t const *t, struct tm *tm)
+{
+#ifdef HAVE_LOCALTIME_INFLOOP_BUG
+  /* The -67768038400665599 comes from:
+     https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html
+     On affected platforms the greatest POSIX-compatible time_t value
+     that could return nonnull is 67768036191766798 (when
+     TZ="XXX24:59:59" it resolves to the year 2**31 - 1 + 1900, on
+     12-31 at 23:59:59), so test for that too while we're in the
+     neighborhood.  */
+  if (! (-67768038400665599 <= *t && *t <= 67768036191766798))
+    {
+      errno = EOVERFLOW;
+      return NULL;
+    }
+#endif
+
+  if (!tz)
+    return gmtime_r (t, tm);
+  else
+    {
+      timezone_t old_tz = set_tz (tz);
+      if (old_tz)
+        {
+          bool abbr_saved = localtime_r (t, tm) && save_abbr (tz, tm);
+          if (revert_tz (old_tz) && abbr_saved)
+            return tm;
+        }
+      return NULL;
+    }
+}
+
+/* Use time zone TZ to compute mktime (TM).  */
+time_t
+mktime_z (timezone_t tz, struct tm *tm)
+{
+  if (!tz)
+    return timegm (tm);
+  else
+    {
+      timezone_t old_tz = set_tz (tz);
+      if (old_tz)
+        {
+          struct tm tm_1;
+          tm_1.tm_sec = tm->tm_sec;
+          tm_1.tm_min = tm->tm_min;
+          tm_1.tm_hour = tm->tm_hour;
+          tm_1.tm_mday = tm->tm_mday;
+          tm_1.tm_mon = tm->tm_mon;
+          tm_1.tm_year = tm->tm_year;
+          tm_1.tm_yday = -1;
+          tm_1.tm_isdst = tm->tm_isdst;
+          time_t t = mktime (&tm_1);
+          bool ok = 0 <= tm_1.tm_yday;
+#if HAVE_STRUCT_TM_TM_ZONE || HAVE_TZNAME
+          ok = ok && save_abbr (tz, &tm_1);
+#endif
+          if (revert_tz (old_tz) && ok)
+            {
+              *tm = tm_1;
+              return t;
+            }
+        }
+      return -1;
+    }
+}
deleted file mode 120000 (symlink)
index bac94375228fd46add1b7719539a00576cfb480b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/timegm.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b47025a0545a79fffbcfd7dd43d411ce4454435c
--- /dev/null
@@ -0,0 +1,58 @@
+/* Convert UTC calendar time to simple time.  Like mktime but assumes UTC.
+
+   Copyright (C) 1994-2023 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
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBC
+# include <libc-config.h>
+#endif
+
+#include <time.h>
+#include <errno.h>
+
+#include "mktime-internal.h"
+
+__time64_t
+__timegm64 (struct tm *tmp)
+{
+  static mktime_offset_t gmtime_offset;
+  tmp->tm_isdst = 0;
+  return __mktime_internal (tmp, __gmtime64_r, &gmtime_offset);
+}
+
+#if defined _LIBC && __TIMESIZE != 64
+
+libc_hidden_def (__timegm64)
+
+time_t
+timegm (struct tm *tmp)
+{
+  struct tm tm = *tmp;
+  __time64_t t = __timegm64 (&tm);
+  if (in_time_t_range (t))
+    {
+      *tmp = tm;
+      return t;
+    }
+  else
+    {
+      __set_errno (EOVERFLOW);
+      return -1;
+    }
+}
+
+#endif
deleted file mode 120000 (symlink)
index 0049f947756d01605cde963572e21729ac3fcde9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/timespec.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8cee9870c716f84d50a3a09da5115cc7ef023a39
--- /dev/null
@@ -0,0 +1,21 @@
+/* Inline functions for <timespec.h>.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_TIMESPEC_INLINE _GL_EXTERN_INLINE
+#include "timespec.h"
deleted file mode 120000 (symlink)
index b2b90159e0f950b05040b77b6e44557c251a53cc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/timespec.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..69ce348569d76446223c7c7f99b51e9bb6b520cb
--- /dev/null
@@ -0,0 +1,102 @@
+/* timespec -- System time interface
+
+   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#if ! defined TIMESPEC_H
+#define TIMESPEC_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_CONST,
+   _GL_ATTRIBUTE_PURE, _GL_CMP.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <time.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_TIMESPEC_INLINE
+# define _GL_TIMESPEC_INLINE _GL_INLINE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "arg-nonnull.h"
+
+/* Inverse resolution of timespec timestamps (in units per second),
+   and log base 10 of the inverse resolution.  */
+
+enum { TIMESPEC_HZ = 1000000000 };
+enum { LOG10_TIMESPEC_HZ = 9 };
+
+/* Obsolescent names for backward compatibility.
+   They are misnomers, because TIMESPEC_RESOLUTION is not a resolution.  */
+
+enum { TIMESPEC_RESOLUTION = TIMESPEC_HZ };
+enum { LOG10_TIMESPEC_RESOLUTION = LOG10_TIMESPEC_HZ };
+
+/* Return a timespec with seconds S and nanoseconds NS.  */
+
+_GL_TIMESPEC_INLINE struct timespec
+make_timespec (time_t s, long int ns)
+{
+  return (struct timespec) { .tv_sec = s, .tv_nsec = ns };
+}
+
+/* Return negative, zero, positive if A < B, A == B, A > B, respectively.  */
+
+_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
+timespec_cmp (struct timespec a, struct timespec b)
+{
+  return 2 * _GL_CMP (a.tv_sec, b.tv_sec) + _GL_CMP (a.tv_nsec, b.tv_nsec);
+}
+
+/* Return -1, 0, 1, depending on the sign of A.  A.tv_nsec must be
+   nonnegative.  */
+_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
+timespec_sign (struct timespec a)
+{
+  return _GL_CMP (a.tv_sec, 0) + (!a.tv_sec & !!a.tv_nsec);
+}
+
+struct timespec timespec_add (struct timespec, struct timespec)
+  _GL_ATTRIBUTE_CONST;
+struct timespec timespec_sub (struct timespec, struct timespec)
+  _GL_ATTRIBUTE_CONST;
+struct timespec dtotimespec (double)
+  _GL_ATTRIBUTE_CONST;
+
+/* Return an approximation to A, of type 'double'.  */
+_GL_TIMESPEC_INLINE double
+timespectod (struct timespec a)
+{
+  return a.tv_sec + a.tv_nsec / 1e9;
+}
+
+long int gettime_res (void);
+struct timespec current_timespec (void);
+void gettime (struct timespec *) _GL_ARG_NONNULL ((1));
+int settime (struct timespec const *) _GL_ARG_NONNULL ((1));
+
+#ifdef __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif
deleted file mode 120000 (symlink)
index edfe28f2a5b867f07f886a6f9392a76f688b619c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/tmpdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dd43fe22c1be664b8447ba15a21f2d92e5e4b833
--- /dev/null
@@ -0,0 +1,164 @@
+/* Copyright (C) 1999, 2001-2002, 2006, 2009-2024 Free Software Foundation,
+   Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Extracted from sysdeps/posix/tempname.c.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "tmpdir.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <errno.h>
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+
+#include <stdio.h>
+#ifndef P_tmpdir
+# ifdef _P_tmpdir /* native Windows */
+#  define P_tmpdir _P_tmpdir
+# else
+#  define P_tmpdir "/tmp"
+# endif
+#endif
+
+#include <sys/stat.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+#endif
+
+#include "pathmax.h"
+
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Don't assume that UNICODE is not defined.  */
+# undef GetTempPath
+# define GetTempPath GetTempPathA
+#endif
+
+#if _LIBC
+# define struct_stat64 struct stat64
+#else
+# define struct_stat64 struct stat
+# define __libc_secure_getenv secure_getenv
+# define __xstat64(version, path, buf) stat (path, buf)
+#endif
+
+/* Pathname support.
+   ISSLASH(C)           tests whether C is a directory separator character.
+ */
+#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
+  /* Native Windows, Cygwin, OS/2, DOS */
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#else
+  /* Unix */
+# define ISSLASH(C) ((C) == '/')
+#endif
+
+
+/* Return nonzero if DIR is an existent directory.  */
+static bool
+direxists (const char *dir)
+{
+  struct_stat64 buf;
+  return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
+}
+
+/* Path search algorithm, for tmpnam, tmpfile, etc.  If DIR is
+   non-null and exists, uses it; otherwise uses the first of $TMPDIR,
+   P_tmpdir, /tmp that exists.  Copies into TMPL a template suitable
+   for use with mk[s]temp.  Will fail (-1) if DIR is non-null and
+   doesn't exist, none of the searched dirs exists, or there's not
+   enough space in TMPL. */
+int
+path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
+             bool try_tmpdir)
+{
+  const char *d;
+  size_t dlen, plen;
+  bool add_slash;
+
+  if (!pfx || !pfx[0])
+    {
+      pfx = "file";
+      plen = 4;
+    }
+  else
+    {
+      plen = strlen (pfx);
+      if (plen > 5)
+        plen = 5;
+    }
+
+  if (try_tmpdir)
+    {
+      d = __libc_secure_getenv ("TMPDIR");
+      if (d != NULL && direxists (d))
+        dir = d;
+      else if (dir != NULL && direxists (dir))
+        /* nothing */ ;
+      else
+        dir = NULL;
+    }
+  if (dir == NULL)
+    {
+#if defined _WIN32 && ! defined __CYGWIN__
+      char dirbuf[PATH_MAX];
+      DWORD retval;
+
+      /* Find Windows temporary file directory.
+         We try this before P_tmpdir because Windows defines P_tmpdir to "\\"
+         and will therefore try to put all temporary files in the root
+         directory (unless $TMPDIR is set).  */
+      retval = GetTempPath (PATH_MAX, dirbuf);
+      if (retval > 0 && retval < PATH_MAX && direxists (dirbuf))
+        dir = dirbuf;
+      else
+#endif
+      if (direxists (P_tmpdir))
+        dir = P_tmpdir;
+      else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
+        dir = "/tmp";
+      else
+        {
+          __set_errno (ENOENT);
+          return -1;
+        }
+    }
+
+  dlen = strlen (dir);
+#ifdef __VMS
+  add_slash = 0;
+#else
+  add_slash = dlen != 0 && !ISSLASH (dir[dlen - 1]);
+#endif
+
+  /* check we have room for "${dir}/${pfx}XXXXXX\0" */
+  if (tmpl_len < dlen + add_slash + plen + 6 + 1)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  memcpy (tmpl, dir, dlen);
+  sprintf (tmpl + dlen, &"/%.*sXXXXXX"[!add_slash], (int) plen, pfx);
+  return 0;
+}
deleted file mode 120000 (symlink)
index 294f53e55dd828f02ef284ee8c0ae99efbb4dab4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/tmpdir.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ffbf34088b5d23d8d02f217672d72eba9d9f6cf8
--- /dev/null
@@ -0,0 +1,25 @@
+/* Determine a temporary directory.
+   Copyright (C) 2001-2002, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+
+/* Path search algorithm, for tmpnam, tmpfile, etc.  If DIR is
+   non-null and exists, uses it; otherwise uses the first of $TMPDIR,
+   P_tmpdir, /tmp that exists.  Copies into TMPL a template suitable
+   for use with mk[s]temp.  Will fail (-1) if DIR is non-null and
+   doesn't exist, none of the searched dirs exists, or there's not
+   enough space in TMPL. */
+extern int path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, bool try_tmpdir);
deleted file mode 120000 (symlink)
index dd7fe01bde8a65626dce733eca70cd47cca7a4b8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/tzset.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0eb8c161f4a5d488f4a61f6b73d27a42a90db7fa
--- /dev/null
@@ -0,0 +1,66 @@
+/* Provide tzset for systems that don't have it or for which it's broken.
+
+   Copyright (C) 2001-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <time.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+void
+rpl_tzset (void)
+#undef tzset
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+  /* Rectify the value of the environment variable TZ.
+     There are four possible kinds of such values:
+       - Traditional US time zone names, e.g. "PST8PDT".  Syntax: see
+         <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset>
+       - Time zone names based on geography, that contain one or more
+         slashes, e.g. "Europe/Moscow".
+       - Time zone names based on geography, without slashes, e.g.
+         "Singapore".
+       - Time zone names that contain explicit DST rules.  Syntax: see
+         <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03>
+     The Microsoft CRT understands only the first kind.  It produces incorrect
+     results if the value of TZ is of the other kinds.
+     But in a Cygwin environment, /etc/profile.d/tzset.sh sets TZ to a value
+     of the second kind for most geographies, or of the first kind in a few
+     other geographies.  If it is of the second kind, neutralize it.  For the
+     Microsoft CRT, an absent or empty TZ means the time zone that the user
+     has set in the Windows Control Panel.
+     If the value of TZ is of the third or fourth kind -- Cygwin programs
+     understand these syntaxes as well --, it does not matter whether we
+     neutralize it or not, since these values occur only when a Cygwin user
+     has set TZ explicitly; this case is 1. rare and 2. under the user's
+     responsibility.  */
+  const char *tz = getenv ("TZ");
+  if (tz != NULL && strchr (tz, '/') != NULL)
+    _putenv ("TZ=");
+
+  /* On native Windows, tzset() is deprecated.  Use _tzset() instead.  See
+     <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/posix-tzset>
+     <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset>  */
+  _tzset ();
+#else
+  tzset ();
+#endif
+}
deleted file mode 120000 (symlink)
index b781577f800ae4ecfb46074397eb5ff75fbd3477..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/u64.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f788470b8f47ed1df92cb663e7e5871cf4d90a82
--- /dev/null
@@ -0,0 +1,22 @@
+/* uint64_t-like operations that work even on hosts lacking uint64_t
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_U64_INLINE _GL_EXTERN_INLINE
+#include "u64.h"
+typedef int dummy;
deleted file mode 120000 (symlink)
index 840662d7eff439bf3468d34dffbf6ea792a1b420..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/u64.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..63339cca0fca41a095ece3e1e59bb9a95f41d681
--- /dev/null
@@ -0,0 +1,181 @@
+/* uint64_t-like operations that work even on hosts lacking uint64_t
+
+   Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdint.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_U64_INLINE
+# define _GL_U64_INLINE _GL_INLINE
+#endif
+
+/* Return X rotated left by N bits, where 0 < N < 64.  */
+#define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n))
+
+#ifdef UINT64_MAX
+
+/* Native implementations are trivial.  See below for comments on what
+   these operations do.  */
+typedef uint64_t u64;
+# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo)))
+# define u64init(hi, lo) u64hilo (hi, lo)
+# define u64lo(x) ((u64) (x))
+# define u64size(x) u64lo (x)
+# define u64lt(x, y) ((x) < (y))
+# define u64and(x, y) ((x) & (y))
+# define u64or(x, y) ((x) | (y))
+# define u64xor(x, y) ((x) ^ (y))
+# define u64plus(x, y) ((x) + (y))
+# define u64shl(x, n) ((x) << (n))
+# define u64shr(x, n) ((x) >> (n))
+
+#else
+
+/* u64 is a 64-bit unsigned integer value.
+   u64init (HI, LO), is like u64hilo (HI, LO), but for use in
+   initializer contexts.  */
+# ifdef WORDS_BIGENDIAN
+typedef struct { uint32_t hi, lo; } u64;
+#  define u64init(hi, lo) { hi, lo }
+# else
+typedef struct { uint32_t lo, hi; } u64;
+#  define u64init(hi, lo) { lo, hi }
+# endif
+
+/* Given the high and low-order 32-bit quantities HI and LO, return a u64
+   value representing (HI << 32) + LO.  */
+_GL_U64_INLINE u64
+u64hilo (uint32_t hi, uint32_t lo)
+{
+  u64 r;
+  r.hi = hi;
+  r.lo = lo;
+  return r;
+}
+
+/* Return a u64 value representing LO.  */
+_GL_U64_INLINE u64
+u64lo (uint32_t lo)
+{
+  u64 r;
+  r.hi = 0;
+  r.lo = lo;
+  return r;
+}
+
+/* Return a u64 value representing SIZE.  */
+_GL_U64_INLINE u64
+u64size (size_t size)
+{
+  u64 r;
+  r.hi = size >> 31 >> 1;
+  r.lo = size;
+  return r;
+}
+
+/* Return X < Y.  */
+_GL_U64_INLINE int
+u64lt (u64 x, u64 y)
+{
+  return x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo);
+}
+
+/* Return X & Y.  */
+_GL_U64_INLINE u64
+u64and (u64 x, u64 y)
+{
+  u64 r;
+  r.hi = x.hi & y.hi;
+  r.lo = x.lo & y.lo;
+  return r;
+}
+
+/* Return X | Y.  */
+_GL_U64_INLINE u64
+u64or (u64 x, u64 y)
+{
+  u64 r;
+  r.hi = x.hi | y.hi;
+  r.lo = x.lo | y.lo;
+  return r;
+}
+
+/* Return X ^ Y.  */
+_GL_U64_INLINE u64
+u64xor (u64 x, u64 y)
+{
+  u64 r;
+  r.hi = x.hi ^ y.hi;
+  r.lo = x.lo ^ y.lo;
+  return r;
+}
+
+/* Return X + Y.  */
+_GL_U64_INLINE u64
+u64plus (u64 x, u64 y)
+{
+  u64 r;
+  r.lo = x.lo + y.lo;
+  r.hi = x.hi + y.hi + (r.lo < x.lo);
+  return r;
+}
+
+/* Return X << N.  */
+_GL_U64_INLINE u64
+u64shl (u64 x, int n)
+{
+  u64 r;
+  if (n < 32)
+    {
+      r.hi = (x.hi << n) | (x.lo >> (32 - n));
+      r.lo = x.lo << n;
+    }
+  else
+    {
+      r.hi = x.lo << (n - 32);
+      r.lo = 0;
+    }
+  return r;
+}
+
+/* Return X >> N.  */
+_GL_U64_INLINE u64
+u64shr (u64 x, int n)
+{
+  u64 r;
+  if (n < 32)
+    {
+      r.hi = x.hi >> n;
+      r.lo = (x.hi << (32 - n)) | (x.lo >> n);
+    }
+  else
+    {
+      r.hi = 0;
+      r.lo = x.hi >> (n - 32);
+    }
+  return r;
+}
+
+#endif
+
+_GL_INLINE_HEADER_END
deleted file mode 120000 (symlink)
index d61f7f59865b64ba81c1bbe7e7159ccd15f9ac99..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/uchar.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..166cbeccf8d5a0a667d4dddf49b778c89c14397d
--- /dev/null
@@ -0,0 +1,910 @@
+/* <uchar.h> substitute - 16-bit and 32-bit wide character types.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+/*
+ * ISO C 23 <uchar.h> for platforms that lack it.
+ */
+
+#ifndef _@GUARD_PREFIX@_UCHAR_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_UCHAR_H@
+# if defined __HAIKU__
+/* Work around <https://dev.haiku-os.org/ticket/17040>.  */
+#  include <stdint.h>
+# endif
+/* On AIX 7.2 with xlclang++, /usr/include/uchar.h produces compilation errors
+   because it contains typedef definitions of char16_t and char32_t, however
+   char16_t and char32_t are keywords in this situation.  To work around it,
+   define char16_t and char32_t as macros.  */
+# if defined __cplusplus && defined _AIX && defined __ibmxl__ && defined __clang__
+#  define char16_t gl_char16_t
+#  define char32_t gl_char32_t
+# endif
+# @INCLUDE_NEXT@ @NEXT_UCHAR_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_UCHAR_H
+#define _@GUARD_PREFIX@_UCHAR_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_BEGIN_C_LINKAGE,
+   _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get uint_least16_t, uint_least32_t.  */
+#include <stdint.h>
+
+/* Get mbstate_t, size_t.  */
+#include <wchar.h>
+
+/* For the inline functions.  */
+#include <string.h>
+#include <wctype.h>
+
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __pure__ was added in gcc 2.96.  */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+_GL_INLINE_HEADER_BEGIN
+
+
+#if !(@HAVE_UCHAR_H@ || (defined __cplusplus && @CXX_HAS_CHAR8_TYPE@))
+
+/* An 8-bit variant of wchar_t.
+   Note: This type is only mandated by ISO C 23 or newer, and it does
+   denote UTF-8 units.  */
+typedef unsigned char char8_t;
+
+#elif @GNULIBHEADERS_OVERRIDE_CHAR8_T@
+
+typedef unsigned char gl_char8_t;
+# define char8_t gl_char8_t
+
+#endif
+
+#if !(@HAVE_UCHAR_H@ || (defined __cplusplus && @CXX_HAS_UCHAR_TYPES@))
+
+/* A 16-bit variant of wchar_t.
+   Note: This type is only mandated by ISO C 11 or newer.  In ISO C 23
+   and newer, it denotes UTF-16 units; in older versions of ISO C it did
+   so only on platforms on which __STDC_UTF_16__ was defined.  */
+typedef uint_least16_t char16_t;
+
+#elif @GNULIBHEADERS_OVERRIDE_CHAR16_T@
+
+typedef uint_least16_t gl_char16_t;
+# define char16_t gl_char16_t
+
+#endif
+
+#if !(@HAVE_UCHAR_H@ || (defined __cplusplus && @CXX_HAS_UCHAR_TYPES@))
+
+/* A 32-bit variant of wchar_t.
+   Note: This type is only mandated by ISO C 11 or newer.  In ISO C 23
+   and newer, it denotes UTF-32 code points; in older versions of ISO C
+   it did so only on platforms on which __STDC_UTF_32__ was defined.
+   In gnulib, we guarantee that it denotes UTF-32 code points if and
+   only if the module 'uchar-c23' is in use.  */
+typedef uint_least32_t char32_t;
+
+#elif @GNULIBHEADERS_OVERRIDE_CHAR32_T@
+
+typedef uint_least32_t gl_char32_t;
+# define char32_t gl_char32_t
+
+#endif
+
+/* Define if a 'char32_t' can hold more characters than a 'wchar_t'.  */
+#if @SMALL_WCHAR_T@                    /* 32-bit AIX, Cygwin, native Windows */
+# define _GL_SMALL_WCHAR_T 1
+#endif
+
+/* Define if 'wchar_t', like 'char32_t',
+     - is a 32-bit type, and
+     - represents Unicode code points.
+   For this test, we can use __STDC_ISO_10646__ (defined by glibc, musl libc,
+   Cygwin) but need to consider _GL_SMALL_WCHAR_T, so as to exclude Cygwin.
+   We cannot use __STDC_UTF_16__ or __STDC_UTF_32__
+     - because these macros provide info about char16_t and char32_t (not
+       wchar_t!), and
+     - because GCC >= 4.9 defines these macros on all platforms, even on
+       FreeBSD and Solaris.
+   We should better not use __STD_UTF_16__, __STD_UTF_32__ either, because
+   these macros are misspellings, only defined by Android's <uchar.h>.  */
+#if defined __STDC_ISO_10646__ && !_GL_SMALL_WCHAR_T
+/* glibc, musl libc */
+# define _GL_WCHAR_T_IS_UCS4 1
+#endif
+#if _GL_WCHAR_T_IS_UCS4
+static_assert (sizeof (char32_t) == sizeof (wchar_t));
+#endif
+
+
+/* Convert a single-byte character to a 32-bit wide character.  */
+#if @GNULIB_BTOC32@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_BTOC32
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ATTRIBUTE_PURE wint_t
+btoc32 (int c)
+{
+  return
+#  if @GNULIB_BTOWC@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         btowc (c);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (btoc32, wint_t, (int c) _GL_ATTRIBUTE_PURE);
+# endif
+_GL_CXXALIAS_SYS (btoc32, wint_t, (int c));
+_GL_CXXALIASWARN (btoc32);
+#endif
+
+
+/* Test a specific property of a 32-bit wide character.  */
+#if @GNULIB_C32ISALNUM@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALNUM
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32isalnum (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswalnum (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32isalnum, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32isalnum, int, (wint_t wc));
+_GL_CXXALIASWARN (c32isalnum);
+#endif
+#if @GNULIB_C32ISALPHA@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALPHA
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32isalpha (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswalpha (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32isalpha, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32isalpha, int, (wint_t wc));
+_GL_CXXALIASWARN (c32isalpha);
+#endif
+#if @GNULIB_C32ISBLANK@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISBLANK
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32isblank (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswblank (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32isblank, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32isblank, int, (wint_t wc));
+_GL_CXXALIASWARN (c32isblank);
+#endif
+#if @GNULIB_C32ISCNTRL@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISCNTRL
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32iscntrl (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswcntrl (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32iscntrl, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32iscntrl, int, (wint_t wc));
+_GL_CXXALIASWARN (c32iscntrl);
+#endif
+#if @GNULIB_C32ISDIGIT@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISDIGIT
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32isdigit (wint_t wc)
+{
+  return
+#  if @GNULIB_ISWDIGIT@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswdigit (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32isdigit, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32isdigit, int, (wint_t wc));
+_GL_CXXALIASWARN (c32isdigit);
+#endif
+#if @GNULIB_C32ISGRAPH@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISGRAPH
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32isgraph (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswgraph (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32isgraph, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32isgraph, int, (wint_t wc));
+_GL_CXXALIASWARN (c32isgraph);
+#endif
+#if @GNULIB_C32ISLOWER@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISLOWER
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32islower (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswlower (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32islower, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32islower, int, (wint_t wc));
+_GL_CXXALIASWARN (c32islower);
+#endif
+#if @GNULIB_C32ISPRINT@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPRINT
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32isprint (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswprint (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32isprint, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32isprint, int, (wint_t wc));
+_GL_CXXALIASWARN (c32isprint);
+#endif
+#if @GNULIB_C32ISPUNCT@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPUNCT
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32ispunct (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswpunct (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32ispunct, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32ispunct, int, (wint_t wc));
+_GL_CXXALIASWARN (c32ispunct);
+#endif
+#if @GNULIB_C32ISSPACE@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISSPACE
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32isspace (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswspace (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32isspace, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32isspace, int, (wint_t wc));
+_GL_CXXALIASWARN (c32isspace);
+#endif
+#if @GNULIB_C32ISUPPER@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISUPPER
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32isupper (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswupper (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32isupper, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32isupper, int, (wint_t wc));
+_GL_CXXALIASWARN (c32isupper);
+#endif
+#if @GNULIB_C32ISXDIGIT@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISXDIGIT
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32isxdigit (wint_t wc)
+{
+  return
+#  if @GNULIB_ISWXDIGIT@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswxdigit (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32isxdigit, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32isxdigit, int, (wint_t wc));
+_GL_CXXALIASWARN (c32isxdigit);
+#endif
+
+
+/* Case mapping of a 32-bit wide character.  */
+#if @GNULIB_C32TOLOWER@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOLOWER
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE wint_t
+c32tolower (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         towlower (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32tolower, wint_t, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32tolower, wint_t, (wint_t wc));
+_GL_CXXALIASWARN (c32tolower);
+#endif
+#if @GNULIB_C32TOUPPER@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOUPPER
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE wint_t
+c32toupper (wint_t wc)
+{
+  return
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         towupper (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32toupper, wint_t, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32toupper, wint_t, (wint_t wc));
+_GL_CXXALIASWARN (c32toupper);
+#endif
+
+
+/* Number of screen columns needed for a 32-bit wide character.  */
+#if @GNULIB_C32WIDTH@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32WIDTH
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32width (char32_t wc)
+{
+  return
+#  if @GNULIB_WCWIDTH@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         wcwidth (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32width, int, (char32_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32width, int, (char32_t wc));
+_GL_CXXALIASWARN (c32width);
+#endif
+
+
+/* Converts a 32-bit wide character to a multibyte character.  */
+#if @GNULIB_C32RTOMB@
+# if @REPLACE_C32RTOMB@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef c32rtomb
+#   define c32rtomb rpl_c32rtomb
+#  endif
+_GL_FUNCDECL_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps));
+_GL_CXXALIAS_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps));
+# else
+#  if !@HAVE_C32RTOMB@
+_GL_FUNCDECL_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps));
+#  endif
+_GL_CXXALIAS_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps));
+# endif
+# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
+_GL_CXXALIASWARN (c32rtomb);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef c32rtomb
+# if HAVE_RAW_DECL_C32RTOMB
+_GL_WARN_ON_USE (c32rtomb, "c32rtomb is not portable - "
+                 "use gnulib module c32rtomb for portability");
+# endif
+#endif
+
+
+/* Convert a 32-bit wide string to a string.  */
+#if @GNULIB_C32SNRTOMBS@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SNRTOMBS
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
+c32snrtombs (char *dest, const char32_t **srcp, size_t srclen, size_t len,
+             mbstate_t *ps)
+{
+  return
+#  if @GNULIB_WCSNRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         wcsnrtombs (dest, (const wchar_t **) srcp, srclen, len, ps);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32snrtombs, size_t,
+                  (char *dest, const char32_t **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (c32snrtombs, size_t,
+                  (char *dest, const char32_t **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps));
+_GL_CXXALIASWARN (c32snrtombs);
+#endif
+
+
+/* Convert a 32-bit wide string to a string.  */
+#if @GNULIB_C32SRTOMBS@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SRTOMBS
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
+c32srtombs (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps)
+{
+  return
+#  if @GNULIB_WCSRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         wcsrtombs (dest, (const wchar_t **) srcp, len, ps);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32srtombs, size_t,
+                  (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (c32srtombs, size_t,
+                  (char *dest, const char32_t **srcp, size_t len,
+                   mbstate_t *ps));
+_GL_CXXALIASWARN (c32srtombs);
+#endif
+
+
+/* Convert a 32-bit wide string to a string.  */
+#if @GNULIB_C32STOMBS@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32STOMBS
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
+c32stombs (char *dest, const char32_t *src, size_t len)
+{
+  mbstate_t state;
+
+  mbszero (&state);
+  return c32srtombs (dest, &src, len, &state);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32stombs, size_t,
+                  (char *dest, const char32_t *src, size_t len)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (c32stombs, size_t,
+                  (char *dest, const char32_t *src, size_t len));
+_GL_CXXALIASWARN (c32stombs);
+#endif
+
+
+/* Number of screen columns needed for a size-bounded 32-bit wide string.  */
+#if @GNULIB_C32SWIDTH@
+# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32SWIDTH
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((1)) int
+c32swidth (const char32_t *s, size_t n)
+{
+  return
+#  if @GNULIB_WCSWIDTH@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         wcswidth ((const wchar_t *) s, n);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32swidth, int, (const char32_t *s, size_t n)
+                                  _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (c32swidth, int, (const char32_t *s, size_t n));
+_GL_CXXALIASWARN (c32swidth);
+#endif
+
+
+/* Converts a 32-bit wide character to unibyte character.
+   Returns the single-byte representation of WC if it exists,
+   or EOF otherwise.  */
+#if @GNULIB_C32TOB@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32TOB
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32tob (wint_t wc)
+{
+  return
+#  if @GNULIB_WCTOB@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         wctob (wc);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32tob, int, (wint_t wc));
+# endif
+_GL_CXXALIAS_SYS (c32tob, int, (wint_t wc));
+_GL_CXXALIASWARN (c32tob);
+#endif
+
+
+/* Converts a multibyte character to a 32-bit wide character.  */
+#if @GNULIB_MBRTOC32@
+# if @REPLACE_MBRTOC32@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbrtoc32
+#   define mbrtoc32 rpl_mbrtoc32
+#  endif
+_GL_FUNCDECL_RPL (mbrtoc32, size_t,
+                  (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
+_GL_CXXALIAS_RPL (mbrtoc32, size_t,
+                  (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
+# else
+#  if !@HAVE_MBRTOC32@
+_GL_FUNCDECL_SYS (mbrtoc32, size_t,
+                  (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
+#  endif
+_GL_CXXALIAS_SYS (mbrtoc32, size_t,
+                  (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
+# endif
+# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
+_GL_CXXALIASWARN (mbrtoc32);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbrtoc32
+# if HAVE_RAW_DECL_MBRTOC32
+_GL_WARN_ON_USE (mbrtoc32, "mbrtoc32 is not portable - "
+                 "use gnulib module mbrtoc32 for portability");
+# endif
+#endif
+
+
+/* Converts a multibyte character and returns the next 16-bit wide
+   character.  */
+#if @GNULIB_MBRTOC16@
+# if @REPLACE_MBRTOC16@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbrtoc16
+#   define mbrtoc16 rpl_mbrtoc16
+#  endif
+_GL_FUNCDECL_RPL (mbrtoc16, size_t,
+                  (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
+_GL_CXXALIAS_RPL (mbrtoc16, size_t,
+                  (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
+# else
+#  if !@HAVE_MBRTOC32@
+_GL_FUNCDECL_SYS (mbrtoc16, size_t,
+                  (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
+#  endif
+_GL_CXXALIAS_SYS (mbrtoc16, size_t,
+                  (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
+# endif
+# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
+_GL_CXXALIASWARN (mbrtoc16);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbrtoc16
+# if HAVE_RAW_DECL_MBRTOC16
+_GL_WARN_ON_USE (mbrtoc16, "mbrtoc16 is not portable - "
+                 "use gnulib module mbrtoc16 for portability");
+# endif
+#endif
+
+
+/* Convert a string to a 32-bit wide string.  */
+#if @GNULIB_MBSNRTOC32S@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSNRTOC32S
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
+mbsnrtoc32s (char32_t *dest, const char **srcp, size_t srclen, size_t len,
+             mbstate_t *ps)
+{
+  return
+#  if @GNULIB_MBSNRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         mbsnrtowcs ((wchar_t *) dest, srcp, srclen, len, ps);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (mbsnrtoc32s, size_t,
+                  (char32_t *dest, const char **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (mbsnrtoc32s, size_t,
+                  (char32_t *dest, const char **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps));
+_GL_CXXALIASWARN (mbsnrtoc32s);
+#endif
+
+
+/* Convert a string to a 32-bit wide string.  */
+#if @GNULIB_MBSRTOC32S@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSRTOC32S
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
+mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+{
+  return
+#  if @GNULIB_MBSRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         mbsrtowcs ((wchar_t *) dest, srcp, len, ps);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (mbsrtoc32s, size_t,
+                  (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (mbsrtoc32s, size_t,
+                  (char32_t *dest, const char **srcp, size_t len,
+                   mbstate_t *ps));
+_GL_CXXALIASWARN (mbsrtoc32s);
+#endif
+
+
+/* Convert a string to a 32-bit wide string.  */
+#if @GNULIB_MBSTOC32S@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSTOC32S
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
+mbstoc32s (char32_t *dest, const char *src, size_t len)
+{
+  mbstate_t state;
+
+  mbszero (&state);
+  return mbsrtoc32s (dest, &src, len, &state);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (mbstoc32s, size_t,
+                  (char32_t *dest, const char *src, size_t len)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (mbstoc32s, size_t,
+                  (char32_t *dest, const char *src, size_t len));
+_GL_CXXALIASWARN (mbstoc32s);
+#endif
+
+
+#if @GNULIB_C32_GET_TYPE_TEST@ || @GNULIB_C32_APPLY_TYPE_TEST@
+/* A scalar type.  Instances of this type, other than (c32_type_test_t) 0,
+   represent a character property, sometimes also viewed as a "character class".
+   It can be applied to 32-bit wide characters.  It is the counterpart of
+   type 'wctype_t' for wide characters.
+   To test whether a given character has a certain property, use the function
+   'c32_apply_type_test'.  */
+# if _GL_WCHAR_T_IS_UCS4
+typedef wctype_t c32_type_test_t;
+# else
+typedef /*bool*/int (*c32_type_test_t) (wint_t wc);
+# endif
+#endif
+
+/* Return a character property with the given name, or (c32_type_test_t) 0
+   if the designated property does not exist.
+   This function is the counterpart of function 'wctype' for wide characters.
+ */
+#if @GNULIB_C32_GET_TYPE_TEST@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_TYPE_TEST
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((1)) c32_type_test_t
+c32_get_type_test (const char *name)
+{
+  return
+#  if @GNULIB_WCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         wctype (name);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name)
+                                                      _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name));
+_GL_CXXALIASWARN (c32_get_type_test);
+#endif
+
+/* Test whether a given 32-bit wide character has the specified character
+   property.
+   Return non-zero if true, zero if false or if the argument is WEOF.
+   This function is the counterpart of function 'iswctype' for wide characters.
+ */
+#if @GNULIB_C32_APPLY_TYPE_TEST@
+# if _GL_WCHAR_T_IS_UCS4
+#  if !defined IN_C32_APPLY_TYPE_TEST
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE int
+c32_apply_type_test (wint_t wc, c32_type_test_t property)
+{
+  return
+#  if @GNULIB_ISWCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         iswctype (wc, property);
+}
+_GL_END_C_LINKAGE
+#  else
+_GL_FUNCDECL_SYS (c32_apply_type_test, int,
+                  (wint_t wc, c32_type_test_t property));
+#  endif
+# else
+_GL_FUNCDECL_SYS (c32_apply_type_test, int,
+                  (wint_t wc, c32_type_test_t property)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (c32_apply_type_test, int,
+                  (wint_t wc, c32_type_test_t property));
+_GL_CXXALIASWARN (c32_apply_type_test);
+#endif
+
+
+#if @GNULIB_C32_GET_MAPPING@ || @GNULIB_C32_APPLY_MAPPING@
+/* A scalar type.  Instances of this type, other than (c32_mapping_t) 0,
+   represent a character mapping.  It can be applied to 32-bit wide characters.
+   It is the counterpart of type 'wctrans_t' for wide characters.
+   To apply a certain mapping to a given character, use the function
+   'c32_apply_mapping'.  */
+# if _GL_WCHAR_T_IS_UCS4
+typedef wctrans_t c32_mapping_t;
+# else
+typedef wint_t (*c32_mapping_t) (wint_t wc);
+# endif
+#endif
+
+/* Return a character mapping with the given name, or (c32_mapping_t) 0
+   if the designated mapping does not exist.
+   This function is the counterpart of function 'wctrans' for wide characters.
+ */
+#if @GNULIB_C32_GET_MAPPING@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_MAPPING
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((1)) c32_mapping_t
+c32_get_mapping (const char *name)
+{
+  return
+#  if @GNULIB_WCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         wctrans (name);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32_get_mapping, c32_mapping_t, (const char *name)
+                                                  _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (c32_get_mapping, c32_mapping_t, (const char *name));
+_GL_CXXALIASWARN (c32_get_mapping);
+#endif
+
+/* Apply the specified character mapping to a given 32-bit wide character.
+   Return the result of this mapping.  Return the WC argument unchanged if it is
+   WEOF.
+   This function is the counterpart of function 'towctrans' for wide characters.
+ */
+#if @GNULIB_C32_APPLY_MAPPING@
+# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_APPLY_MAPPING
+_GL_BEGIN_C_LINKAGE
+_GL_INLINE _GL_ARG_NONNULL ((2)) wint_t
+c32_apply_mapping (wint_t wc, c32_mapping_t mapping)
+{
+  return
+#  if @GNULIB_TOWCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE
+         GNULIB_NAMESPACE::
+#  endif
+         towctrans (wc, mapping);
+}
+_GL_END_C_LINKAGE
+# else
+_GL_FUNCDECL_SYS (c32_apply_mapping, wint_t,
+                  (wint_t wc, c32_mapping_t mapping)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (c32_apply_mapping, wint_t,
+                  (wint_t wc, c32_mapping_t mapping));
+_GL_CXXALIASWARN (c32_apply_mapping);
+#endif
+
+
+_GL_INLINE_HEADER_END
+
+#endif /* _@GUARD_PREFIX@_UCHAR_H */
+#endif /* _@GUARD_PREFIX@_UCHAR_H */
deleted file mode 120000 (symlink)
index 6f4c2f53a3dc0481ea015a1b51cd1cf6fbca0be2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/uinttostr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..be56c85bdd5f2fa524f908a0a53a800561198548
--- /dev/null
@@ -0,0 +1,20 @@
+/* Convert 'unsigned int' integer to printable string.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define anytostr uinttostr
+#define inttype unsigned int
+#include "anytostr.c"
deleted file mode 120000 (symlink)
index c0edb87b39ee134d566479685ba78889d1c04433..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/umaxtostr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0458b4af6c46f4588f6942def9a2ceb26db3f3e2
--- /dev/null
@@ -0,0 +1,20 @@
+/* Convert 'uintmax_t' integer to printable string.
+
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define anytostr umaxtostr
+#define inttype uintmax_t
+#include "anytostr.c"
deleted file mode 120000 (symlink)
index 9ce5f28e389f65b9818e9ce01727cee9ae8fc26e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/uname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2d798ef7b17e0d5e3bb9b551376055fde7898f06
--- /dev/null
@@ -0,0 +1,274 @@
+/* uname replacement.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/utsname.h>
+
+/* This file provides an implementation only for the native Windows API.  */
+#if defined _WIN32 && ! defined __CYGWIN__
+
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+# include <unistd.h>
+# include <windows.h>
+
+/* Mingw headers don't have all the platform codes.  */
+# ifndef VER_PLATFORM_WIN32_CE
+#  define VER_PLATFORM_WIN32_CE 3
+# endif
+
+/* Some headers don't have all the processor architecture codes.  */
+# ifndef PROCESSOR_ARCHITECTURE_AMD64
+#  define PROCESSOR_ARCHITECTURE_AMD64 9
+# endif
+# ifndef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
+#  define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
+# endif
+
+/* Mingw headers don't have the latest processor codes.  */
+# ifndef PROCESSOR_AMD_X8664
+#  define PROCESSOR_AMD_X8664 8664
+# endif
+
+/* Don't assume that UNICODE is not defined.  */
+# undef OSVERSIONINFO
+# define OSVERSIONINFO OSVERSIONINFOA
+# undef GetVersionEx
+# define GetVersionEx GetVersionExA
+
+int
+uname (struct utsname *buf)
+{
+  OSVERSIONINFO version;
+  OSVERSIONINFOEX versionex;
+  BOOL have_versionex; /* indicates whether versionex is filled */
+  const char *super_version;
+
+  /* Preparation: Fill version and, if possible, also versionex.
+     But try to call GetVersionEx only once in the common case.  */
+  versionex.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
+  have_versionex = GetVersionEx ((OSVERSIONINFO *) &versionex);
+  if (have_versionex)
+    {
+      /* We know that OSVERSIONINFO is a subset of OSVERSIONINFOEX.  */
+      memcpy (&version, &versionex, sizeof (OSVERSIONINFO));
+    }
+  else
+    {
+      version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
+      if (!GetVersionEx (&version))
+        abort ();
+    }
+
+  /* Fill in nodename.  */
+  if (gethostname (buf->nodename, sizeof (buf->nodename)) < 0)
+    strcpy (buf->nodename, "localhost");
+
+  /* Determine major-major Windows version.  */
+  if (version.dwPlatformId == VER_PLATFORM_WIN32_NT)
+    {
+      /* Windows NT or newer.  */
+      super_version = "NT";
+    }
+  else if (version.dwPlatformId == VER_PLATFORM_WIN32_CE)
+    {
+      /* Windows CE or Embedded CE.  */
+      super_version = "CE";
+    }
+  else if (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
+    {
+      /* Windows 95/98/ME.  */
+      switch (version.dwMinorVersion)
+        {
+        case 0:
+          super_version = "95";
+          break;
+        case 10:
+          super_version = "98";
+          break;
+        case 90:
+          super_version = "ME";
+          break;
+        default:
+          super_version = "";
+          break;
+        }
+    }
+  else
+    super_version = "";
+
+  /* Fill in sysname.  */
+# ifdef __MINGW32__
+  /* Returns a string compatible with the MSYS uname.exe program,
+     so that no further changes are needed to GNU config.guess.
+     For example,
+       $ ./uname.exe -s      => MINGW32_NT-5.1
+   */
+  sprintf (buf->sysname, "MINGW32_%s-%u.%u", super_version,
+           (unsigned int) version.dwMajorVersion,
+           (unsigned int) version.dwMinorVersion);
+# else
+  sprintf (buf->sysname, "Windows%s", super_version);
+# endif
+
+  /* Fill in release, version.  */
+  /* The MSYS uname.exe programs uses strings from a modified Cygwin runtime:
+       $ ./uname.exe -r      => 1.0.11(0.46/3/2)
+       $ ./uname.exe -v      => 2008-08-25 23:40
+     There is no point in imitating this behaviour.  */
+  if (version.dwPlatformId == VER_PLATFORM_WIN32_NT)
+    {
+      /* Windows NT or newer.  */
+      struct windows_version
+        {
+          int major;
+          int minor;
+          unsigned int server_offset;
+          const char *name;
+        };
+
+      /* Storing the workstation and server version names in a single
+         stream does not waste memory when they are the same.  These
+         macros abstract the representation.  VERSION1 is used if
+         version.wProductType does not matter, VERSION2 if it does.  */
+      #define VERSION1(major, minor, name) \
+        { major, minor, 0, name }
+      #define VERSION2(major, minor, workstation, server) \
+        { major, minor, sizeof workstation, workstation "\0" server }
+      static const struct windows_version versions[] =
+        {
+          VERSION2 (3, -1, "Windows NT Workstation", "Windows NT Server"),
+          VERSION2 (4, -1, "Windows NT Workstation", "Windows NT Server"),
+          VERSION1 (5, 0, "Windows 2000"),
+          VERSION1 (5, 1, "Windows XP"),
+          VERSION1 (5, 2, "Windows Server 2003"),
+          VERSION2 (6, 0, "Windows Vista", "Windows Server 2008"),
+          VERSION2 (6, 1, "Windows 7", "Windows Server 2008 R2"),
+          VERSION2 (-1, -1, "Windows", "Windows Server")
+        };
+      const char *base;
+      const struct windows_version *v = versions;
+
+      /* Find a version that matches ours.  The last element is a
+         wildcard that always ends the loop.  */
+      while ((v->major != version.dwMajorVersion && v->major != -1)
+             || (v->minor != version.dwMinorVersion && v->minor != -1))
+        v++;
+
+      if (have_versionex && versionex.wProductType != VER_NT_WORKSTATION)
+        base = v->name + v->server_offset;
+      else
+        base = v->name;
+      if (v->major == -1 || v->minor == -1)
+        sprintf (buf->release, "%s %u.%u",
+                 base,
+                 (unsigned int) version.dwMajorVersion,
+                 (unsigned int) version.dwMinorVersion);
+      else
+        strcpy (buf->release, base);
+    }
+  else if (version.dwPlatformId == VER_PLATFORM_WIN32_CE)
+    {
+      /* Windows CE or Embedded CE.  */
+      sprintf (buf->release, "Windows CE %u.%u",
+               (unsigned int) version.dwMajorVersion,
+               (unsigned int) version.dwMinorVersion);
+    }
+  else
+    {
+      /* Windows 95/98/ME.  */
+      sprintf (buf->release, "Windows %s", super_version);
+    }
+  strcpy (buf->version, version.szCSDVersion);
+
+  /* Fill in machine.  */
+  {
+    SYSTEM_INFO info;
+
+    GetSystemInfo (&info);
+    /* Check for Windows NT or CE, since the info.wProcessorLevel is
+       garbage on Windows 95. */
+    if (version.dwPlatformId == VER_PLATFORM_WIN32_NT
+        || version.dwPlatformId == VER_PLATFORM_WIN32_CE)
+      {
+        /* Windows NT or newer, or Windows CE or Embedded CE.  */
+        switch (info.wProcessorArchitecture)
+          {
+          case PROCESSOR_ARCHITECTURE_AMD64:
+            strcpy (buf->machine, "x86_64");
+            break;
+          case PROCESSOR_ARCHITECTURE_IA64:
+            strcpy (buf->machine, "ia64");
+            break;
+          case PROCESSOR_ARCHITECTURE_INTEL:
+            strcpy (buf->machine, "i386");
+            if (info.wProcessorLevel >= 3)
+              buf->machine[1] =
+                '0' + (info.wProcessorLevel <= 6 ? info.wProcessorLevel : 6);
+            break;
+          case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
+            strcpy (buf->machine, "i686");
+            break;
+          case PROCESSOR_ARCHITECTURE_MIPS:
+            strcpy (buf->machine, "mips");
+            break;
+          case PROCESSOR_ARCHITECTURE_ALPHA:
+          case PROCESSOR_ARCHITECTURE_ALPHA64:
+            strcpy (buf->machine, "alpha");
+            break;
+          case PROCESSOR_ARCHITECTURE_PPC:
+            strcpy (buf->machine, "powerpc");
+            break;
+          case PROCESSOR_ARCHITECTURE_SHX:
+            strcpy (buf->machine, "sh");
+            break;
+          case PROCESSOR_ARCHITECTURE_ARM:
+            strcpy (buf->machine, "arm");
+            break;
+          default:
+            strcpy (buf->machine, "unknown");
+            break;
+          }
+      }
+    else
+      {
+        /* Windows 95/98/ME.  */
+        switch (info.dwProcessorType)
+          {
+          case PROCESSOR_AMD_X8664:
+            strcpy (buf->machine, "x86_64");
+            break;
+          case PROCESSOR_INTEL_IA64:
+            strcpy (buf->machine, "ia64");
+            break;
+          default:
+            if (info.dwProcessorType % 100 == 86)
+              sprintf (buf->machine, "i%u",
+                       (unsigned int) info.dwProcessorType);
+            else
+              strcpy (buf->machine, "unknown");
+            break;
+          }
+      }
+  }
+
+  return 0;
+}
+
+#endif
deleted file mode 120000 (symlink)
index 32bc32cef0d9825ab814ddab73a47443ba90092b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unicase.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bd705baf01755a1ea25ba4e0be43518c8cfc9293
--- /dev/null
@@ -0,0 +1,471 @@
+/* Unicode character case mappings.
+   Copyright (C) 2002, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _UNICASE_H
+#define _UNICASE_H
+
+#include "unitypes.h"
+
+/* Get bool.  */
+#include <stdbool.h>
+
+/* Get size_t.  */
+#include <stddef.h>
+
+/* Get uninorm_t.  */
+#include "uninorm.h"
+
+#if @HAVE_UNISTRING_WOE32DLL_H@
+# include <unistring/woe32dll.h>
+#else
+# define LIBUNISTRING_DLL_VARIABLE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================= */
+
+/* Character case mappings.
+   These mappings are locale and context independent.
+   WARNING! These functions are not sufficient for languages such as German.
+   Better use the functions below that treat an entire string at once and are
+   language aware.  */
+
+/* Return the uppercase mapping of a Unicode character.  */
+extern ucs4_t
+       uc_toupper (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the lowercase mapping of a Unicode character.  */
+extern ucs4_t
+       uc_tolower (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the titlecase mapping of a Unicode character.  */
+extern ucs4_t
+       uc_totitle (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* String case mappings.  */
+
+/* These functions are locale dependent.  The iso639_language argument
+   identifies the language (e.g. "tr" for Turkish).  NULL means to use
+   locale independent case mappings.  */
+
+/* Return the ISO 639 language code of the current locale.
+   Return "" if it is unknown, or in the "C" locale.  */
+extern const char *
+       uc_locale_language (void)
+       _UC_ATTRIBUTE_PURE;
+
+/* Conventions:
+
+   All functions prefixed with u8_ operate on UTF-8 encoded strings.
+   Their unit is an uint8_t (1 byte).
+
+   All functions prefixed with u16_ operate on UTF-16 encoded strings.
+   Their unit is an uint16_t (a 2-byte word).
+
+   All functions prefixed with u32_ operate on UCS-4 encoded strings.
+   Their unit is an uint32_t (a 4-byte word).
+
+   All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly
+   n units.
+
+   Functions returning a string result take a (resultbuf, lengthp) argument
+   pair.  If resultbuf is not NULL and the result fits into *lengthp units,
+   it is put in resultbuf, and resultbuf is returned.  Otherwise, a freshly
+   allocated string is returned.  In both cases, *lengthp is set to the
+   length (number of units) of the returned string.  In case of error,
+   NULL is returned and errno is set.  */
+
+/* Return the uppercase mapping of a string.
+   The nf argument identifies the normalization form to apply after the
+   case-mapping.  It can also be NULL, for no normalization.  */
+extern uint8_t *
+       u8_toupper (const uint8_t *s, size_t n, const char *iso639_language,
+                   uninorm_t nf,
+                   uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint16_t *
+       u16_toupper (const uint16_t *s, size_t n, const char *iso639_language,
+                    uninorm_t nf,
+                    uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint32_t *
+       u32_toupper (const uint32_t *s, size_t n, const char *iso639_language,
+                    uninorm_t nf,
+                    uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+
+/* Return the lowercase mapping of a string.
+   The nf argument identifies the normalization form to apply after the
+   case-mapping.  It can also be NULL, for no normalization.  */
+extern uint8_t *
+       u8_tolower (const uint8_t *s, size_t n, const char *iso639_language,
+                   uninorm_t nf,
+                   uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint16_t *
+       u16_tolower (const uint16_t *s, size_t n, const char *iso639_language,
+                    uninorm_t nf,
+                    uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint32_t *
+       u32_tolower (const uint32_t *s, size_t n, const char *iso639_language,
+                    uninorm_t nf,
+                    uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+
+/* Return the titlecase mapping of a string.
+   The nf argument identifies the normalization form to apply after the
+   case-mapping.  It can also be NULL, for no normalization.  */
+extern uint8_t *
+       u8_totitle (const uint8_t *s, size_t n, const char *iso639_language,
+                   uninorm_t nf,
+                   uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint16_t *
+       u16_totitle (const uint16_t *s, size_t n, const char *iso639_language,
+                    uninorm_t nf,
+                    uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint32_t *
+       u32_totitle (const uint32_t *s, size_t n, const char *iso639_language,
+                    uninorm_t nf,
+                    uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+
+/* The case-mapping context given by a prefix string.  */
+typedef struct casing_prefix_context
+        {
+          /* These fields are private, undocumented.  */
+          uint32_t last_char_except_ignorable;
+          uint32_t last_char_normal_or_above;
+        }
+        casing_prefix_context_t;
+/* The case-mapping context of the empty prefix string.  */
+extern @GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE@ const casing_prefix_context_t unicase_empty_prefix_context;
+/* Return the case-mapping context of a given prefix string.  */
+extern casing_prefix_context_t
+       u8_casing_prefix_context (const uint8_t *s, size_t n);
+extern casing_prefix_context_t
+       u16_casing_prefix_context (const uint16_t *s, size_t n);
+extern casing_prefix_context_t
+       u32_casing_prefix_context (const uint32_t *s, size_t n);
+/* Return the case-mapping context of the prefix concat(A, S), given the
+   case-mapping context of the prefix A.  */
+extern casing_prefix_context_t
+       u8_casing_prefixes_context (const uint8_t *s, size_t n,
+                                   casing_prefix_context_t a_context);
+extern casing_prefix_context_t
+       u16_casing_prefixes_context (const uint16_t *s, size_t n,
+                                    casing_prefix_context_t a_context);
+extern casing_prefix_context_t
+       u32_casing_prefixes_context (const uint32_t *s, size_t n,
+                                    casing_prefix_context_t a_context);
+
+/* The case-mapping context given by a suffix string.  */
+typedef struct casing_suffix_context
+        {
+          /* These fields are private, undocumented.  */
+          uint32_t first_char_except_ignorable;
+          uint32_t bits;
+        }
+        casing_suffix_context_t;
+/* The case-mapping context of the empty suffix string.  */
+extern @GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE@ const casing_suffix_context_t unicase_empty_suffix_context;
+/* Return the case-mapping context of a given suffix string.  */
+extern casing_suffix_context_t
+       u8_casing_suffix_context (const uint8_t *s, size_t n);
+extern casing_suffix_context_t
+       u16_casing_suffix_context (const uint16_t *s, size_t n);
+extern casing_suffix_context_t
+       u32_casing_suffix_context (const uint32_t *s, size_t n);
+/* Return the case-mapping context of the suffix concat(S, A), given the
+   case-mapping context of the suffix A.  */
+extern casing_suffix_context_t
+       u8_casing_suffixes_context (const uint8_t *s, size_t n,
+                                   casing_suffix_context_t a_context);
+extern casing_suffix_context_t
+       u16_casing_suffixes_context (const uint16_t *s, size_t n,
+                                    casing_suffix_context_t a_context);
+extern casing_suffix_context_t
+       u32_casing_suffixes_context (const uint32_t *s, size_t n,
+                                    casing_suffix_context_t a_context);
+
+/* Return the uppercase mapping of a string that is surrounded by a prefix
+   and a suffix.  */
+extern uint8_t *
+       u8_ct_toupper (const uint8_t *s, size_t n,
+                      casing_prefix_context_t prefix_context,
+                      casing_suffix_context_t suffix_context,
+                      const char *iso639_language,
+                      uninorm_t nf,
+                      uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint16_t *
+       u16_ct_toupper (const uint16_t *s, size_t n,
+                      casing_prefix_context_t prefix_context,
+                      casing_suffix_context_t suffix_context,
+                      const char *iso639_language,
+                      uninorm_t nf,
+                      uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint32_t *
+       u32_ct_toupper (const uint32_t *s, size_t n,
+                      casing_prefix_context_t prefix_context,
+                      casing_suffix_context_t suffix_context,
+                      const char *iso639_language,
+                      uninorm_t nf,
+                      uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+
+/* Return the lowercase mapping of a string that is surrounded by a prefix
+   and a suffix.  */
+extern uint8_t *
+       u8_ct_tolower (const uint8_t *s, size_t n,
+                      casing_prefix_context_t prefix_context,
+                      casing_suffix_context_t suffix_context,
+                      const char *iso639_language,
+                      uninorm_t nf,
+                      uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint16_t *
+       u16_ct_tolower (const uint16_t *s, size_t n,
+                      casing_prefix_context_t prefix_context,
+                      casing_suffix_context_t suffix_context,
+                      const char *iso639_language,
+                      uninorm_t nf,
+                      uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint32_t *
+       u32_ct_tolower (const uint32_t *s, size_t n,
+                      casing_prefix_context_t prefix_context,
+                      casing_suffix_context_t suffix_context,
+                      const char *iso639_language,
+                      uninorm_t nf,
+                      uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+
+/* Return the titlecase mapping of a string that is surrounded by a prefix
+   and a suffix.  */
+extern uint8_t *
+       u8_ct_totitle (const uint8_t *s, size_t n,
+                      casing_prefix_context_t prefix_context,
+                      casing_suffix_context_t suffix_context,
+                      const char *iso639_language,
+                      uninorm_t nf,
+                      uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint16_t *
+       u16_ct_totitle (const uint16_t *s, size_t n,
+                      casing_prefix_context_t prefix_context,
+                      casing_suffix_context_t suffix_context,
+                      const char *iso639_language,
+                      uninorm_t nf,
+                      uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint32_t *
+       u32_ct_totitle (const uint32_t *s, size_t n,
+                      casing_prefix_context_t prefix_context,
+                      casing_suffix_context_t suffix_context,
+                      const char *iso639_language,
+                      uninorm_t nf,
+                      uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+
+/* Return the case folded string.
+   Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equivalent
+   to comparing S1 and S2 with uN_casecmp().
+   The nf argument identifies the normalization form to apply after the
+   case-mapping.  It can also be NULL, for no normalization.  */
+extern uint8_t *
+       u8_casefold (const uint8_t *s, size_t n, const char *iso639_language,
+                    uninorm_t nf,
+                    uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint16_t *
+       u16_casefold (const uint16_t *s, size_t n, const char *iso639_language,
+                     uninorm_t nf,
+                     uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint32_t *
+       u32_casefold (const uint32_t *s, size_t n, const char *iso639_language,
+                     uninorm_t nf,
+                     uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+/* Likewise, for a string that is surrounded by a prefix and a suffix.  */
+extern uint8_t *
+       u8_ct_casefold (const uint8_t *s, size_t n,
+                       casing_prefix_context_t prefix_context,
+                       casing_suffix_context_t suffix_context,
+                       const char *iso639_language,
+                       uninorm_t nf,
+                       uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint16_t *
+       u16_ct_casefold (const uint16_t *s, size_t n,
+                        casing_prefix_context_t prefix_context,
+                        casing_suffix_context_t suffix_context,
+                        const char *iso639_language,
+                        uninorm_t nf,
+                        uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint32_t *
+       u32_ct_casefold (const uint32_t *s, size_t n,
+                        casing_prefix_context_t prefix_context,
+                        casing_suffix_context_t suffix_context,
+                        const char *iso639_language,
+                        uninorm_t nf,
+                        uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+
+/* Compare S1 and S2, ignoring differences in case and normalization.
+   The nf argument identifies the normalization form to apply after the
+   case-mapping.  It can also be NULL, for no normalization.
+   If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
+   return 0.  Upon failure, return -1 with errno set.  */
+extern int
+       u8_casecmp (const uint8_t *s1, size_t n1,
+                   const uint8_t *s2, size_t n2,
+                   const char *iso639_language, uninorm_t nf, int *resultp);
+extern int
+       u16_casecmp (const uint16_t *s1, size_t n1,
+                    const uint16_t *s2, size_t n2,
+                    const char *iso639_language, uninorm_t nf, int *resultp);
+extern int
+       u32_casecmp (const uint32_t *s1, size_t n1,
+                    const uint32_t *s2, size_t n2,
+                    const char *iso639_language, uninorm_t nf, int *resultp);
+extern int
+       ulc_casecmp (const char *s1, size_t n1,
+                    const char *s2, size_t n2,
+                    const char *iso639_language, uninorm_t nf, int *resultp);
+
+/* Convert the string S of length N to a NUL-terminated byte sequence, in such
+   a way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with the gnulib
+   function memcmp2() is equivalent to comparing S1 and S2 with uN_casecoll().
+   NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalization.  */
+extern char *
+       u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language,
+                    uninorm_t nf,
+                    char *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern char *
+       u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_language,
+                     uninorm_t nf,
+                     char *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern char *
+       u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_language,
+                     uninorm_t nf,
+                     char *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern char *
+       ulc_casexfrm (const char *s, size_t n, const char *iso639_language,
+                     uninorm_t nf,
+                     char *_UC_RESTRICT resultbuf, size_t *lengthp);
+
+/* Compare S1 and S2, ignoring differences in case and normalization, using the
+   collation rules of the current locale.
+   The nf argument identifies the normalization form to apply after the
+   case-mapping.  It must be either UNINORM_NFC or UNINORM_NFKC.  It can also
+   be NULL, for no normalization.
+   If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
+   return 0.  Upon failure, return -1 with errno set.  */
+extern int
+       u8_casecoll (const uint8_t *s1, size_t n1,
+                    const uint8_t *s2, size_t n2,
+                    const char *iso639_language, uninorm_t nf, int *resultp);
+extern int
+       u16_casecoll (const uint16_t *s1, size_t n1,
+                     const uint16_t *s2, size_t n2,
+                     const char *iso639_language, uninorm_t nf, int *resultp);
+extern int
+       u32_casecoll (const uint32_t *s1, size_t n1,
+                     const uint32_t *s2, size_t n2,
+                     const char *iso639_language, uninorm_t nf, int *resultp);
+extern int
+       ulc_casecoll (const char *s1, size_t n1,
+                     const char *s2, size_t n2,
+                     const char *iso639_language, uninorm_t nf, int *resultp);
+
+
+/* Set *RESULTP to true if mapping NFD(S) to upper case is a no-op, or to false
+   otherwise, and return 0.  Upon failure, return -1 with errno set.  */
+extern int
+       u8_is_uppercase (const uint8_t *s, size_t n,
+                        const char *iso639_language,
+                        bool *resultp);
+extern int
+       u16_is_uppercase (const uint16_t *s, size_t n,
+                         const char *iso639_language,
+                         bool *resultp);
+extern int
+       u32_is_uppercase (const uint32_t *s, size_t n,
+                         const char *iso639_language,
+                         bool *resultp);
+
+/* Set *RESULTP to true if mapping NFD(S) to lower case is a no-op, or to false
+   otherwise, and return 0.  Upon failure, return -1 with errno set.  */
+extern int
+       u8_is_lowercase (const uint8_t *s, size_t n,
+                        const char *iso639_language,
+                        bool *resultp);
+extern int
+       u16_is_lowercase (const uint16_t *s, size_t n,
+                         const char *iso639_language,
+                         bool *resultp);
+extern int
+       u32_is_lowercase (const uint32_t *s, size_t n,
+                         const char *iso639_language,
+                         bool *resultp);
+
+/* Set *RESULTP to true if mapping NFD(S) to title case is a no-op, or to false
+   otherwise, and return 0.  Upon failure, return -1 with errno set.  */
+extern int
+       u8_is_titlecase (const uint8_t *s, size_t n,
+                        const char *iso639_language,
+                        bool *resultp);
+extern int
+       u16_is_titlecase (const uint16_t *s, size_t n,
+                         const char *iso639_language,
+                         bool *resultp);
+extern int
+       u32_is_titlecase (const uint32_t *s, size_t n,
+                         const char *iso639_language,
+                         bool *resultp);
+
+/* Set *RESULTP to true if applying case folding to NFD(S) is a no-op, or to
+   false otherwise, and return 0.  Upon failure, return -1 with errno set.  */
+extern int
+       u8_is_casefolded (const uint8_t *s, size_t n,
+                         const char *iso639_language,
+                         bool *resultp);
+extern int
+       u16_is_casefolded (const uint16_t *s, size_t n,
+                          const char *iso639_language,
+                          bool *resultp);
+extern int
+       u32_is_casefolded (const uint32_t *s, size_t n,
+                          const char *iso639_language,
+                          bool *resultp);
+
+/* Set *RESULTP to true if case matters for S, that is, if mapping NFD(S) to
+   either upper case or lower case or title case is not a no-op.
+   Set *RESULTP to false if NFD(S) maps to itself under the upper case mapping,
+   under the lower case mapping, and under the title case mapping; in other
+   words, when NFD(S) consists entirely of caseless characters.
+   Upon failure, return -1 with errno set.  */
+extern int
+       u8_is_cased (const uint8_t *s, size_t n,
+                    const char *iso639_language,
+                    bool *resultp);
+extern int
+       u16_is_cased (const uint16_t *s, size_t n,
+                     const char *iso639_language,
+                     bool *resultp);
+extern int
+       u32_is_cased (const uint32_t *s, size_t n,
+                     const char *iso639_language,
+                     bool *resultp);
+
+
+/* ========================================================================= */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UNICASE_H */
deleted file mode 120000 (symlink)
index c4ab9370d57d724be3b752af9fa1da31f7394b3b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unicase/simple-mapping.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6102b7684358de580184003376e3044e469d582f
--- /dev/null
@@ -0,0 +1,39 @@
+/* Simple case mapping for Unicode characters.
+   Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+ucs4_t
+FUNC (ucs4_t uc)
+{
+  unsigned int index1 = uc >> mapping_header_0;
+  if (index1 < mapping_header_1)
+    {
+      int lookup1 = u_mapping.level1[index1];
+      if (lookup1 >= 0)
+        {
+          unsigned int index2 = (uc >> mapping_header_2) & mapping_header_3;
+          int lookup2 = u_mapping.level2[lookup1 + index2];
+          if (lookup2 >= 0)
+            {
+              unsigned int index3 = (uc & mapping_header_4);
+              int lookup3 = u_mapping.level3[lookup2 + index3];
+
+              return uc + lookup3;
+            }
+        }
+    }
+  return uc;
+}
deleted file mode 120000 (symlink)
index 85c6af9f011c4c61028755b1853763a64f28e29b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unicase/tolower.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0a62cd50669e2ecafdad18ecdb572d26a063637c
--- /dev/null
@@ -0,0 +1,27 @@
+/* Lowercase mapping for Unicode characters (locale and context independent).
+   Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unicase.h"
+
+/* Define u_mapping table.  */
+#include "tolower.h"
+
+#define FUNC uc_tolower
+#include "simple-mapping.h"
deleted file mode 120000 (symlink)
index d72efc11cd94fccda89c3238df72f2460881e3e7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unicase/tolower.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6fa031c91131629f90d72c19f083f4abcf21dae8
--- /dev/null
@@ -0,0 +1,727 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Simple character mapping of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define mapping_header_0 16
+#define mapping_header_1 2
+#define mapping_header_2 7
+#define mapping_header_3 511
+#define mapping_header_4 127
+static const
+struct
+  {
+    int level1[2];
+    short level2[2 << 9];
+    int level3[35 << 7];
+  }
+u_mapping =
+{
+  {     0,   512 },
+  {
+        0,   128,   256,   384,   512,    -1,   640,   768,
+      896,  1024,  1152,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,  1280,    -1,    -1,    -1,    -1,    -1,  1408,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,  1536,    -1,    -1,  1664,  1792,  1920,  2048,
+       -1,    -1,  2176,  2304,    -1,    -1,    -1,    -1,
+       -1,  2432,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     2560,  2688,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,  2816,  2944,  3072,  3200,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,  3328,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     3456,  3584,  3712,  3840,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,  3968,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,  4096,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,  4224,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,  4352,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1
+  },
+  {
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,     0,
+       32,    32,    32,    32,    32,    32,    32,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+     -199,     0,     1,     0,     1,     0,     1,     0,
+        0,     1,     0,     1,     0,     1,     0,     1,
+        0,     1,     0,     1,     0,     1,     0,     1,
+        0,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+     -121,     1,     0,     1,     0,     1,     0,     0,
+        0,   210,     1,     0,     1,     0,   206,     1,
+        0,   205,   205,     1,     0,     0,    79,   202,
+      203,     1,     0,   205,   207,     0,   211,   209,
+        1,     0,     0,     0,   211,   213,     0,   214,
+        1,     0,     1,     0,     1,     0,   218,     1,
+        0,   218,     0,     0,     1,     0,   218,     1,
+        0,   217,   217,     1,     0,     1,     0,   219,
+        1,     0,     0,     0,     1,     0,     0,     0,
+        0,     0,     0,     0,     2,     1,     0,     2,
+        1,     0,     2,     1,     0,     1,     0,     1,
+        0,     1,     0,     1,     0,     1,     0,     1,
+        0,     1,     0,     1,     0,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        0,     2,     1,     0,     1,     0,   -97,   -56,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+     -130,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     0,     0,     0,     0,
+        0,     0, 10795,     1,     0,  -163, 10792,     0,
+        0,     1,     0,  -195,    69,    71,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        1,     0,     1,     0,     0,     0,     1,     0,
+        0,     0,     0,     0,     0,     0,     0,   116,
+        0,     0,     0,     0,     0,     0,    38,     0,
+       37,    37,    37,     0,    64,     0,    63,    63,
+        0,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,     0,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     8,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        0,     0,     0,     0,   -60,     0,     0,     1,
+        0,    -7,     1,     0,     0,  -130,  -130,  -130,
+       80,    80,    80,    80,    80,    80,    80,    80,
+       80,    80,    80,    80,    80,    80,    80,    80,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+       15,     1,     0,     1,     0,     1,     0,     1,
+        0,     1,     0,     1,     0,     1,     0,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        0,    48,    48,    48,    48,    48,    48,    48,
+       48,    48,    48,    48,    48,    48,    48,    48,
+       48,    48,    48,    48,    48,    48,    48,    48,
+       48,    48,    48,    48,    48,    48,    48,    48,
+       48,    48,    48,    48,    48,    48,    48,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+     7264,  7264,  7264,  7264,  7264,  7264,  7264,  7264,
+     7264,  7264,  7264,  7264,  7264,  7264,  7264,  7264,
+     7264,  7264,  7264,  7264,  7264,  7264,  7264,  7264,
+     7264,  7264,  7264,  7264,  7264,  7264,  7264,  7264,
+     7264,  7264,  7264,  7264,  7264,  7264,     0,  7264,
+        0,     0,     0,     0,     0,  7264,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+    38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
+        8,     8,     8,     8,     8,     8,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+    -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
+    -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
+    -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
+    -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
+    -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
+    -3008, -3008, -3008,     0,     0, -3008, -3008, -3008,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     0,     0,
+        0,     0,     0,     0,     0,     0, -7615,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,    -8,    -8,    -8,    -8,    -8,    -8,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,    -8,    -8,    -8,    -8,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,    -8,    -8,    -8,    -8,    -8,    -8,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,    -8,    -8,    -8,    -8,    -8,    -8,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,    -8,    -8,    -8,    -8,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,    -8,     0,    -8,     0,    -8,     0,    -8,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,    -8,    -8,    -8,    -8,    -8,    -8,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,    -8,    -8,    -8,    -8,    -8,    -8,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,    -8,    -8,    -8,    -8,    -8,    -8,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,    -8,    -8,    -8,    -8,    -8,    -8,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,   -74,   -74,    -9,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+      -86,   -86,   -86,   -86,    -9,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,  -100,  -100,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       -8,    -8,  -112,  -112,    -7,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+     -128,  -128,  -126,  -126,    -9,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0, -7517,     0,
+        0,     0, -8383, -8262,     0,     0,     0,     0,
+        0,     0,    28,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       16,    16,    16,    16,    16,    16,    16,    16,
+       16,    16,    16,    16,    16,    16,    16,    16,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     1,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,    26,    26,
+       26,    26,    26,    26,    26,    26,    26,    26,
+       26,    26,    26,    26,    26,    26,    26,    26,
+       26,    26,    26,    26,    26,    26,    26,    26,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       48,    48,    48,    48,    48,    48,    48,    48,
+       48,    48,    48,    48,    48,    48,    48,    48,
+       48,    48,    48,    48,    48,    48,    48,    48,
+       48,    48,    48,    48,    48,    48,    48,    48,
+       48,    48,    48,    48,    48,    48,    48,    48,
+       48,    48,    48,    48,    48,    48,    48,    48,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        1,     0, -10743, -3814, -10727,     0,     0,     1,
+        0,     1,     0,     1,     0, -10780, -10749, -10783,
+    -10782,     0,     1,     0,     0,     1,     0,     0,
+        0,     0,     0,     0,     0,     0, -10815, -10815,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     0,     0,     0,     0,
+        0,     0,     0,     1,     0,     1,     0,     0,
+        0,     0,     1,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        0,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     1,     0,     1,     0, -35332,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        0,     0,     0,     1,     0, -42280,     0,     0,
+        1,     0,     1,     0,     0,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0, -42308, -42319, -42315, -42305, -42308,     0,
+    -42258, -42282, -42261,   928,     1,     0,     1,     0,
+        1,     0,     1,     0,     1,     0,     1,     0,
+        1,     0,     1,     0,   -48, -42307, -35384,     1,
+        0,     1,     0,     0,     0,     0,     0,     0,
+        1,     0,     0,     0,     0,     0,     1,     0,
+        1,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     1,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       40,    40,    40,    40,    40,    40,    40,    40,
+       40,    40,    40,    40,    40,    40,    40,    40,
+       40,    40,    40,    40,    40,    40,    40,    40,
+       40,    40,    40,    40,    40,    40,    40,    40,
+       40,    40,    40,    40,    40,    40,    40,    40,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       40,    40,    40,    40,    40,    40,    40,    40,
+       40,    40,    40,    40,    40,    40,    40,    40,
+       40,    40,    40,    40,    40,    40,    40,    40,
+       40,    40,    40,    40,    40,    40,    40,    40,
+       40,    40,    40,    40,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       39,    39,    39,    39,    39,    39,    39,    39,
+       39,    39,    39,     0,    39,    39,    39,    39,
+       39,    39,    39,    39,    39,    39,    39,    39,
+       39,    39,    39,     0,    39,    39,    39,    39,
+       39,    39,    39,     0,    39,    39,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       64,    64,    64,    64,    64,    64,    64,    64,
+       64,    64,    64,    64,    64,    64,    64,    64,
+       64,    64,    64,    64,    64,    64,    64,    64,
+       64,    64,    64,    64,    64,    64,    64,    64,
+       64,    64,    64,    64,    64,    64,    64,    64,
+       64,    64,    64,    64,    64,    64,    64,    64,
+       64,    64,    64,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+       32,    32,    32,    32,    32,    32,    32,    32,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+       34,    34,    34,    34,    34,    34,    34,    34,
+       34,    34,    34,    34,    34,    34,    34,    34,
+       34,    34,    34,    34,    34,    34,    34,    34,
+       34,    34,    34,    34,    34,    34,    34,    34,
+       34,    34,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0
+  }
+};
deleted file mode 120000 (symlink)
index 81ece567ffba968944791e83b9d90b125bf20f54..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unicodeio.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9ed3875f93900d488b27643446e35e2b9368e56a
--- /dev/null
@@ -0,0 +1,232 @@
+/* Unicode character output to streams with locale dependent encoding.
+
+   Copyright (C) 2000-2003, 2006, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <haible@clisp.cons.org>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unicodeio.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#if HAVE_ICONV
+# include <iconv.h>
+#endif
+
+#include <error.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+#include "localcharset.h"
+#include "unistr.h"
+
+/* When we pass a Unicode character to iconv(), we must pass it in a
+   suitable encoding. The standardized Unicode encodings are
+   UTF-8, UCS-2, UCS-4, UTF-16, UTF-16BE, UTF-16LE, UTF-7.
+   UCS-2 supports only characters up to \U0000FFFF.
+   UTF-16 and variants support only characters up to \U0010FFFF.
+   UTF-7 is way too complex and not supported by glibc-2.1.
+   UCS-4 specification leaves doubts about endianness and byte order
+   mark. glibc currently interprets it as big endian without byte order
+   mark, but this is not backed by an RFC.
+   So we use UTF-8. It supports characters up to \U7FFFFFFF and is
+   unambiguously defined.  */
+
+/* Luckily, the encoding's name is platform independent.  */
+#define UTF8_NAME "UTF-8"
+
+/* Converts the Unicode character CODE to its multibyte representation
+   in the current locale and calls the SUCCESS callback on the resulting
+   byte sequence.  If an error occurs, invokes the FAILURE callback instead,
+   passing it CODE and an English error string.
+   Returns whatever the callback returned.
+   Assumes that the locale doesn't change between two calls.  */
+long
+unicode_to_mb (unsigned int code,
+               long (*success) (const char *buf, size_t buflen,
+                                void *callback_arg),
+               long (*failure) (unsigned int code, const char *msg,
+                                void *callback_arg),
+               void *callback_arg)
+{
+  static int initialized;
+  static int is_utf8;
+#if HAVE_ICONV
+  static iconv_t utf8_to_local;
+#endif
+
+  char inbuf[6];
+  int count;
+
+  if (!initialized)
+    {
+      const char *charset = locale_charset ();
+
+      is_utf8 = !strcmp (charset, UTF8_NAME);
+#if HAVE_ICONV
+      if (!is_utf8)
+        {
+          utf8_to_local = iconv_open (charset, UTF8_NAME);
+          if (utf8_to_local == (iconv_t)(-1))
+            /* For an unknown encoding, assume ASCII.  */
+            utf8_to_local = iconv_open ("ASCII", UTF8_NAME);
+        }
+#endif
+      initialized = 1;
+    }
+
+  /* Test whether the utf8_to_local converter is available at all.  */
+  if (!is_utf8)
+    {
+#if HAVE_ICONV
+      if (utf8_to_local == (iconv_t)(-1))
+        return failure (code, N_("iconv function not usable"), callback_arg);
+#else
+      return failure (code, N_("iconv function not available"), callback_arg);
+#endif
+    }
+
+  /* Convert the character to UTF-8.  */
+  count = u8_uctomb ((unsigned char *) inbuf, code, sizeof (inbuf));
+  if (count < 0)
+    return failure (code, N_("character out of range"), callback_arg);
+
+#if HAVE_ICONV
+  if (!is_utf8)
+    {
+      char outbuf[25];
+      const char *inptr;
+      size_t inbytesleft;
+      char *outptr;
+      size_t outbytesleft;
+      size_t res;
+
+      inptr = inbuf;
+      inbytesleft = count;
+      outptr = outbuf;
+      outbytesleft = sizeof (outbuf);
+
+      /* Convert the character from UTF-8 to the locale's charset.  */
+      res = iconv (utf8_to_local,
+                   (ICONV_CONST char **)&inptr, &inbytesleft,
+                   &outptr, &outbytesleft);
+      /* Analyze what iconv() actually did and distinguish replacements
+         that are OK (no need to invoke the FAILURE callback), such as
+           - replacing GREEK SMALL LETTER MU with MICRO SIGN, or
+           - replacing FULLWIDTH COLON with ':', or
+           - replacing a Unicode TAG character (U+E00xx) with an empty string,
+         from replacements that are worse than the FAILURE callback, such as
+           - replacing 'ç' with '?' (NetBSD, Solaris 11) or '*' (musl) or
+             NUL (IRIX).  */
+      if (inbytesleft > 0 || res == (size_t)(-1)
+          /* Irix iconv() inserts a NUL byte if it cannot convert.  */
+# if !defined _LIBICONV_VERSION && (defined sgi || defined __sgi)
+          || (res > 0 && code != 0 && outptr - outbuf == 1 && *outbuf == '\0')
+# endif
+          /* FreeBSD iconv(), NetBSD iconv(), and Solaris 11 iconv() insert
+             a '?' if they cannot convert.  */
+# if !defined _LIBICONV_VERSION || (_LIBICONV_VERSION == 0x10b && defined __APPLE__)
+          || (res > 0 && outptr - outbuf == 1 && *outbuf == '?')
+# endif
+          /* musl libc iconv() inserts a '*' if it cannot convert.  */
+# if !defined _LIBICONV_VERSION && MUSL_LIBC
+          || (res > 0 && outptr - outbuf == 1 && *outbuf == '*')
+# endif
+         )
+        return failure (code, NULL, callback_arg);
+
+      /* Avoid glibc-2.1 bug and Solaris 7 bug.  */
+# if defined _LIBICONV_VERSION \
+    || !(((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) \
+          && !defined __UCLIBC__) \
+         || defined __sun)
+
+      /* Get back to the initial shift state.  */
+      res = iconv (utf8_to_local, NULL, NULL, &outptr, &outbytesleft);
+      if (res == (size_t)(-1))
+        return failure (code, NULL, callback_arg);
+# endif
+
+      return success (outbuf, outptr - outbuf, callback_arg);
+    }
+#endif
+
+  /* At this point, is_utf8 is true, so no conversion is needed.  */
+  return success (inbuf, count, callback_arg);
+}
+
+/* Simple success callback that outputs the converted string.
+   The STREAM is passed as callback_arg.  */
+long
+fwrite_success_callback (const char *buf, size_t buflen, void *callback_arg)
+{
+  FILE *stream = (FILE *) callback_arg;
+
+  /* The return value of fwrite can be ignored here, because under normal
+     conditions (STREAM is an open stream and not wide-character oriented)
+     when fwrite() returns a value != buflen it also sets STREAM's error
+     indicator.  */
+  fwrite (buf, 1, buflen, stream);
+  return 0;
+}
+
+/* Simple failure callback that displays an error and exits.  */
+static long
+exit_failure_callback (unsigned int code, const char *msg,
+                       _GL_UNUSED void *callback_arg)
+{
+  if (msg == NULL)
+    error (1, 0, _("cannot convert U+%04X to local character set"), code);
+  else
+    error (1, 0, _("cannot convert U+%04X to local character set: %s"), code,
+           gettext (msg));
+  return -1;
+}
+
+/* Simple failure callback that displays a fallback representation in plain
+   ASCII, using the same notation as ISO C99 strings.  */
+static long
+fallback_failure_callback (unsigned int code,
+                           _GL_UNUSED const char *msg,
+                           void *callback_arg)
+{
+  FILE *stream = (FILE *) callback_arg;
+
+  if (code < 0x10000)
+    fprintf (stream, "\\u%04X", code);
+  else
+    fprintf (stream, "\\U%08X", code);
+  return -1;
+}
+
+/* Outputs the Unicode character CODE to the output stream STREAM.
+   Upon failure, exit if exit_on_error is true, otherwise output a fallback
+   notation.  */
+void
+print_unicode_char (FILE *stream, unsigned int code, int exit_on_error)
+{
+  unicode_to_mb (code, fwrite_success_callback,
+                 exit_on_error
+                 ? exit_failure_callback
+                 : fallback_failure_callback,
+                 stream);
+}
deleted file mode 120000 (symlink)
index be8e11fa2f7919553204a5afd9b28bd5991926bd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unicodeio.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3c36d08e677d512300d31f9e231cc68c46406750
--- /dev/null
@@ -0,0 +1,48 @@
+/* Unicode character output to streams with locale dependent encoding.
+
+   Copyright (C) 2000-2003, 2005, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef UNICODEIO_H
+# define UNICODEIO_H
+
+# include <stddef.h>
+# include <stdio.h>
+
+/* Converts the Unicode character CODE to its multibyte representation
+   in the current locale and calls the SUCCESS callback on the resulting
+   byte sequence.  If an error occurs, invokes the FAILURE callback instead,
+   passing it CODE and an English error string.
+   Returns whatever the callback returned.
+   Assumes that the locale doesn't change between two calls.  */
+extern long unicode_to_mb (unsigned int code,
+                           long (*success) (const char *buf, size_t buflen,
+                                            void *callback_arg),
+                           long (*failure) (unsigned int code, const char *msg,
+                                            void *callback_arg),
+                           void *callback_arg);
+
+/* Outputs the Unicode character CODE to the output stream STREAM.
+   Upon failure, exit if exit_on_error is true, otherwise output a fallback
+   notation.  */
+extern void print_unicode_char (FILE *stream, unsigned int code,
+                                int exit_on_error);
+
+/* Simple success callback that outputs the converted string.
+   The STREAM is passed as callback_arg.  */
+extern long fwrite_success_callback (const char *buf, size_t buflen,
+                                     void *callback_arg);
+
+#endif
deleted file mode 120000 (symlink)
index a887f3d6e9a44961b373162dbbe7cb00d7c37b44..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..52b31c4daecd9047a70b9e309466abbc1ddf7b4b
--- /dev/null
+/* Unicode character classification and properties.
+   Copyright (C) 2002, 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _UNICTYPE_H
+#define _UNICTYPE_H
+
+#include "unitypes.h"
+
+/* Get bool.  */
+#include <stdbool.h>
+
+/* Get size_t.  */
+#include <stddef.h>
+
+#if @HAVE_UNISTRING_WOE32DLL_H@
+# include <unistring/woe32dll.h>
+#else
+# define LIBUNISTRING_DLL_VARIABLE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================= */
+
+/* Field 1 of Unicode Character Database: Character name.
+   See "uniname.h".  */
+
+/* ========================================================================= */
+
+/* Field 2 of Unicode Character Database: General category.  */
+
+/* Data type denoting a General category value.  This is not just a bitmask,
+   but rather a bitmask and a pointer to the lookup table, so that programs
+   that use only the predefined bitmasks (i.e. don't combine bitmasks with &
+   and |) don't have a link-time dependency towards the big general table.  */
+typedef struct
+{
+  uint32_t bitmask : 31;
+  /*bool*/ unsigned int generic : 1;
+  union
+  {
+    const void *table;                               /* when generic is 0 */
+    bool (*lookup_fn) (ucs4_t uc, uint32_t bitmask); /* when generic is 1 */
+  } lookup;
+}
+uc_general_category_t;
+
+/* Bits and bit masks denoting General category values.  UnicodeData-3.2.0.html
+   says a 32-bit integer will always suffice to represent them.
+   These bit masks can only be used with the uc_is_general_category_withtable
+   function.  */
+enum
+{
+  UC_CATEGORY_MASK_L  = 0x0000001f,
+  UC_CATEGORY_MASK_LC = 0x00000007,
+  UC_CATEGORY_MASK_Lu = 0x00000001,
+  UC_CATEGORY_MASK_Ll = 0x00000002,
+  UC_CATEGORY_MASK_Lt = 0x00000004,
+  UC_CATEGORY_MASK_Lm = 0x00000008,
+  UC_CATEGORY_MASK_Lo = 0x00000010,
+  UC_CATEGORY_MASK_M  = 0x000000e0,
+  UC_CATEGORY_MASK_Mn = 0x00000020,
+  UC_CATEGORY_MASK_Mc = 0x00000040,
+  UC_CATEGORY_MASK_Me = 0x00000080,
+  UC_CATEGORY_MASK_N  = 0x00000700,
+  UC_CATEGORY_MASK_Nd = 0x00000100,
+  UC_CATEGORY_MASK_Nl = 0x00000200,
+  UC_CATEGORY_MASK_No = 0x00000400,
+  UC_CATEGORY_MASK_P  = 0x0003f800,
+  UC_CATEGORY_MASK_Pc = 0x00000800,
+  UC_CATEGORY_MASK_Pd = 0x00001000,
+  UC_CATEGORY_MASK_Ps = 0x00002000,
+  UC_CATEGORY_MASK_Pe = 0x00004000,
+  UC_CATEGORY_MASK_Pi = 0x00008000,
+  UC_CATEGORY_MASK_Pf = 0x00010000,
+  UC_CATEGORY_MASK_Po = 0x00020000,
+  UC_CATEGORY_MASK_S  = 0x003c0000,
+  UC_CATEGORY_MASK_Sm = 0x00040000,
+  UC_CATEGORY_MASK_Sc = 0x00080000,
+  UC_CATEGORY_MASK_Sk = 0x00100000,
+  UC_CATEGORY_MASK_So = 0x00200000,
+  UC_CATEGORY_MASK_Z  = 0x01c00000,
+  UC_CATEGORY_MASK_Zs = 0x00400000,
+  UC_CATEGORY_MASK_Zl = 0x00800000,
+  UC_CATEGORY_MASK_Zp = 0x01000000,
+  UC_CATEGORY_MASK_C  = 0x3e000000,
+  UC_CATEGORY_MASK_Cc = 0x02000000,
+  UC_CATEGORY_MASK_Cf = 0x04000000,
+  UC_CATEGORY_MASK_Cs = 0x08000000,
+  UC_CATEGORY_MASK_Co = 0x10000000,
+  UC_CATEGORY_MASK_Cn = 0x20000000
+};
+
+/* Predefined General category values.  */
+extern @GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_L;
+extern @GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_LC;
+extern @GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lu;
+extern @GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Ll;
+extern @GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lt;
+extern @GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lm;
+extern @GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lo;
+extern @GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_M;
+extern @GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Mn;
+extern @GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Mc;
+extern @GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Me;
+extern @GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_N;
+extern @GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Nd;
+extern @GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Nl;
+extern @GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_No;
+extern @GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_P;
+extern @GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pc;
+extern @GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pd;
+extern @GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Ps;
+extern @GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pe;
+extern @GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pi;
+extern @GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pf;
+extern @GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Po;
+extern @GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_S;
+extern @GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sm;
+extern @GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sc;
+extern @GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sk;
+extern @GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_So;
+extern @GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Z;
+extern @GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zs;
+extern @GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zl;
+extern @GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zp;
+extern @GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_C;
+extern @GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cc;
+extern @GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cf;
+extern @GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cs;
+extern @GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Co;
+extern @GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cn;
+/* Non-public.  */
+extern const uc_general_category_t _UC_CATEGORY_NONE;
+
+/* Alias names for predefined General category values.  */
+#define UC_LETTER                    UC_CATEGORY_L
+#define UC_CASED_LETTER              UC_CATEGORY_LC
+#define UC_UPPERCASE_LETTER          UC_CATEGORY_Lu
+#define UC_LOWERCASE_LETTER          UC_CATEGORY_Ll
+#define UC_TITLECASE_LETTER          UC_CATEGORY_Lt
+#define UC_MODIFIER_LETTER           UC_CATEGORY_Lm
+#define UC_OTHER_LETTER              UC_CATEGORY_Lo
+#define UC_MARK                      UC_CATEGORY_M
+#define UC_NON_SPACING_MARK          UC_CATEGORY_Mn
+#define UC_COMBINING_SPACING_MARK    UC_CATEGORY_Mc
+#define UC_ENCLOSING_MARK            UC_CATEGORY_Me
+#define UC_NUMBER                    UC_CATEGORY_N
+#define UC_DECIMAL_DIGIT_NUMBER      UC_CATEGORY_Nd
+#define UC_LETTER_NUMBER             UC_CATEGORY_Nl
+#define UC_OTHER_NUMBER              UC_CATEGORY_No
+#define UC_PUNCTUATION               UC_CATEGORY_P
+#define UC_CONNECTOR_PUNCTUATION     UC_CATEGORY_Pc
+#define UC_DASH_PUNCTUATION          UC_CATEGORY_Pd
+#define UC_OPEN_PUNCTUATION          UC_CATEGORY_Ps /* a.k.a. UC_START_PUNCTUATION */
+#define UC_CLOSE_PUNCTUATION         UC_CATEGORY_Pe /* a.k.a. UC_END_PUNCTUATION */
+#define UC_INITIAL_QUOTE_PUNCTUATION UC_CATEGORY_Pi
+#define UC_FINAL_QUOTE_PUNCTUATION   UC_CATEGORY_Pf
+#define UC_OTHER_PUNCTUATION         UC_CATEGORY_Po
+#define UC_SYMBOL                    UC_CATEGORY_S
+#define UC_MATH_SYMBOL               UC_CATEGORY_Sm
+#define UC_CURRENCY_SYMBOL           UC_CATEGORY_Sc
+#define UC_MODIFIER_SYMBOL           UC_CATEGORY_Sk
+#define UC_OTHER_SYMBOL              UC_CATEGORY_So
+#define UC_SEPARATOR                 UC_CATEGORY_Z
+#define UC_SPACE_SEPARATOR           UC_CATEGORY_Zs
+#define UC_LINE_SEPARATOR            UC_CATEGORY_Zl
+#define UC_PARAGRAPH_SEPARATOR       UC_CATEGORY_Zp
+#define UC_OTHER                     UC_CATEGORY_C
+#define UC_CONTROL                   UC_CATEGORY_Cc
+#define UC_FORMAT                    UC_CATEGORY_Cf
+#define UC_SURROGATE                 UC_CATEGORY_Cs /* all of them are invalid characters */
+#define UC_PRIVATE_USE               UC_CATEGORY_Co
+#define UC_UNASSIGNED                UC_CATEGORY_Cn /* some of them are invalid characters */
+
+/* Return the union of two general categories.
+   This corresponds to the unions of the two sets of characters.  */
+extern uc_general_category_t
+       uc_general_category_or (uc_general_category_t category1,
+                               uc_general_category_t category2);
+
+/* Return the intersection of two general categories as bit masks.
+   This *does*not* correspond to the intersection of the two sets of
+   characters.  */
+extern uc_general_category_t
+       uc_general_category_and (uc_general_category_t category1,
+                                uc_general_category_t category2);
+
+/* Return the intersection of a general category with the complement of a
+   second general category, as bit masks.
+   This *does*not* correspond to the intersection with complement, when
+   viewing the categories as sets of characters.  */
+extern uc_general_category_t
+       uc_general_category_and_not (uc_general_category_t category1,
+                                    uc_general_category_t category2);
+
+/* Return the name of a general category.  */
+extern const char *
+       uc_general_category_name (uc_general_category_t category)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the long name of a general category.  */
+extern const char *
+       uc_general_category_long_name (uc_general_category_t category)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the general category given by name, e.g. "Lu", or by long name,
+   e.g. "Uppercase Letter".  */
+extern uc_general_category_t
+       uc_general_category_byname (const char *category_name)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the general category of a Unicode character.  */
+extern uc_general_category_t
+       uc_general_category (ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+
+/* Test whether a Unicode character belongs to a given category.
+   The CATEGORY argument can be the combination of several predefined
+   general categories.  */
+extern bool
+       uc_is_general_category (ucs4_t uc, uc_general_category_t category)
+       _UC_ATTRIBUTE_PURE;
+/* Likewise.  This function uses a big table comprising all categories.  */
+extern bool
+       uc_is_general_category_withtable (ucs4_t uc, uint32_t bitmask)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* Field 3 of Unicode Character Database: Canonical combining class.  */
+
+/* The possible results of uc_combining_class (0..255) are described in
+   UCD.html.  The list here is not definitive; more values can be added
+   in future versions.  */
+enum
+{
+  UC_CCC_NR   =   0, /* Not Reordered */
+  UC_CCC_OV   =   1, /* Overlay */
+  UC_CCC_NK   =   7, /* Nukta */
+  UC_CCC_KV   =   8, /* Kana Voicing */
+  UC_CCC_VR   =   9, /* Virama */
+  UC_CCC_ATBL = 200, /* Attached Below Left */
+  UC_CCC_ATB  = 202, /* Attached Below */
+  UC_CCC_ATA  = 214, /* Attached Above */
+  UC_CCC_ATAR = 216, /* Attached Above Right */
+  UC_CCC_BL   = 218, /* Below Left */
+  UC_CCC_B    = 220, /* Below */
+  UC_CCC_BR   = 222, /* Below Right */
+  UC_CCC_L    = 224, /* Left */
+  UC_CCC_R    = 226, /* Right */
+  UC_CCC_AL   = 228, /* Above Left */
+  UC_CCC_A    = 230, /* Above */
+  UC_CCC_AR   = 232, /* Above Right */
+  UC_CCC_DB   = 233, /* Double Below */
+  UC_CCC_DA   = 234, /* Double Above */
+  UC_CCC_IS   = 240  /* Iota Subscript */
+};
+
+/* Return the canonical combining class of a Unicode character.  */
+extern int
+       uc_combining_class (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the name of a canonical combining class.  */
+extern const char *
+       uc_combining_class_name (int ccc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the long name of a canonical combining class.  */
+extern const char *
+       uc_combining_class_long_name (int ccc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the canonical combining class given by name, e.g. "BL", or by long
+   name, e.g. "Below Left".  */
+extern int
+       uc_combining_class_byname (const char *ccc_name)
+       _UC_ATTRIBUTE_PURE;
+
+/* ========================================================================= */
+
+/* Field 4 of Unicode Character Database: Bidi class.
+   Before Unicode 4.0, this field was called "Bidirectional category".  */
+
+enum
+{
+  UC_BIDI_L,   /* Left-to-Right */
+  UC_BIDI_LRE, /* Left-to-Right Embedding */
+  UC_BIDI_LRO, /* Left-to-Right Override */
+  UC_BIDI_R,   /* Right-to-Left */
+  UC_BIDI_AL,  /* Right-to-Left Arabic */
+  UC_BIDI_RLE, /* Right-to-Left Embedding */
+  UC_BIDI_RLO, /* Right-to-Left Override */
+  UC_BIDI_PDF, /* Pop Directional Format */
+  UC_BIDI_EN,  /* European Number */
+  UC_BIDI_ES,  /* European Number Separator */
+  UC_BIDI_ET,  /* European Number Terminator */
+  UC_BIDI_AN,  /* Arabic Number */
+  UC_BIDI_CS,  /* Common Number Separator */
+  UC_BIDI_NSM, /* Non-Spacing Mark */
+  UC_BIDI_BN,  /* Boundary Neutral */
+  UC_BIDI_B,   /* Paragraph Separator */
+  UC_BIDI_S,   /* Segment Separator */
+  UC_BIDI_WS,  /* Whitespace */
+  UC_BIDI_ON,  /* Other Neutral */
+  UC_BIDI_LRI, /* Left-to-Right Isolate */
+  UC_BIDI_RLI, /* Right-to-Left Isolate */
+  UC_BIDI_FSI, /* First Strong Isolate */
+  UC_BIDI_PDI  /* Pop Directional Isolate */
+};
+
+/* Return the name of a bidi class.  */
+extern const char *
+       uc_bidi_class_name (int bidi_class)
+       _UC_ATTRIBUTE_CONST;
+/* Same; obsolete function name.  */
+extern const char *
+       uc_bidi_category_name (int category)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the long name of a bidi class.  */
+extern const char *
+       uc_bidi_class_long_name (int bidi_class)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the bidi class given by name, e.g. "LRE", or by long name, e.g.
+   "Left-to-Right Embedding".  */
+extern int
+       uc_bidi_class_byname (const char *bidi_class_name)
+       _UC_ATTRIBUTE_PURE;
+/* Same; obsolete function name.  */
+extern int
+       uc_bidi_category_byname (const char *category_name)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the bidi class of a Unicode character.  */
+extern int
+       uc_bidi_class (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+/* Same; obsolete function name.  */
+extern int
+       uc_bidi_category (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test whether a Unicode character belongs to a given bidi class.  */
+extern bool
+       uc_is_bidi_class (ucs4_t uc, int bidi_class)
+       _UC_ATTRIBUTE_CONST;
+/* Same; obsolete function name.  */
+extern bool
+       uc_is_bidi_category (ucs4_t uc, int category)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* Field 5 of Unicode Character Database: Character decomposition mapping.
+   See "uninorm.h".  */
+
+/* ========================================================================= */
+
+/* Field 6 of Unicode Character Database: Decimal digit value.  */
+
+/* Return the decimal digit value of a Unicode character.  */
+extern int
+       uc_decimal_value (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* Field 7 of Unicode Character Database: Digit value.  */
+
+/* Return the digit value of a Unicode character.  */
+extern int
+       uc_digit_value (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* Field 8 of Unicode Character Database: Numeric value.  */
+
+/* Return the numeric value of a Unicode character.  */
+typedef struct
+{
+  int numerator;
+  int denominator;
+}
+uc_fraction_t;
+extern uc_fraction_t
+       uc_numeric_value (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* Field 9 of Unicode Character Database: Mirrored.  */
+
+/* Return the mirrored character of a Unicode character UC in *PUC.  */
+extern bool
+       uc_mirror_char (ucs4_t uc, ucs4_t *puc);
+
+/* ========================================================================= */
+
+/* Field 10 of Unicode Character Database: Unicode 1.0 Name.
+   Not available in this library.  */
+
+/* ========================================================================= */
+
+/* Field 11 of Unicode Character Database: ISO 10646 comment.
+   Not available in this library.  */
+
+/* ========================================================================= */
+
+/* Field 12, 13, 14 of Unicode Character Database: Uppercase mapping,
+   lowercase mapping, titlecase mapping.  See "unicase.h".  */
+
+/* ========================================================================= */
+
+/* Field 2 of the file ArabicShaping.txt in the Unicode Character Database.  */
+
+/* Possible joining types.  */
+enum
+{
+  UC_JOINING_TYPE_U, /* Non_Joining */
+  UC_JOINING_TYPE_T, /* Transparent */
+  UC_JOINING_TYPE_C, /* Join_Causing */
+  UC_JOINING_TYPE_L, /* Left_Joining */
+  UC_JOINING_TYPE_R, /* Right_Joining */
+  UC_JOINING_TYPE_D  /* Dual_Joining */
+};
+
+/* Return the name of a joining type.  */
+extern const char *
+       uc_joining_type_name (int joining_type)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the long name of a joining type.  */
+extern const char *
+       uc_joining_type_long_name (int joining_type)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the joining type given by name, e.g. "D", or by long name, e.g.
+   "Dual Joining".  */
+extern int
+       uc_joining_type_byname (const char *joining_type_name)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the joining type of a Unicode character.  */
+extern int
+       uc_joining_type (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* Field 3 of the file ArabicShaping.txt in the Unicode Character Database.  */
+
+/* Possible joining groups.
+   This enumeration may be extended in the future.  */
+enum
+{
+  UC_JOINING_GROUP_NONE,                     /* No_Joining_Group */
+  UC_JOINING_GROUP_AIN,                      /* Ain */
+  UC_JOINING_GROUP_ALAPH,                    /* Alaph */
+  UC_JOINING_GROUP_ALEF,                     /* Alef */
+  UC_JOINING_GROUP_BEH,                      /* Beh */
+  UC_JOINING_GROUP_BETH,                     /* Beth */
+  UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE,    /* Burushaski_Yeh_Barree */
+  UC_JOINING_GROUP_DAL,                      /* Dal */
+  UC_JOINING_GROUP_DALATH_RISH,              /* Dalath_Rish */
+  UC_JOINING_GROUP_E,                        /* E */
+  UC_JOINING_GROUP_FARSI_YEH,                /* Farsi_Yeh */
+  UC_JOINING_GROUP_FE,                       /* Fe */
+  UC_JOINING_GROUP_FEH,                      /* Feh */
+  UC_JOINING_GROUP_FINAL_SEMKATH,            /* Final_Semkath */
+  UC_JOINING_GROUP_GAF,                      /* Gaf */
+  UC_JOINING_GROUP_GAMAL,                    /* Gamal */
+  UC_JOINING_GROUP_HAH,                      /* Hah */
+  UC_JOINING_GROUP_HE,                       /* He */
+  UC_JOINING_GROUP_HEH,                      /* Heh */
+  UC_JOINING_GROUP_HEH_GOAL,                 /* Heh_Goal */
+  UC_JOINING_GROUP_HETH,                     /* Heth */
+  UC_JOINING_GROUP_KAF,                      /* Kaf */
+  UC_JOINING_GROUP_KAPH,                     /* Kaph */
+  UC_JOINING_GROUP_KHAPH,                    /* Khaph */
+  UC_JOINING_GROUP_KNOTTED_HEH,              /* Knotted_Heh */
+  UC_JOINING_GROUP_LAM,                      /* Lam */
+  UC_JOINING_GROUP_LAMADH,                   /* Lamadh */
+  UC_JOINING_GROUP_MEEM,                     /* Meem */
+  UC_JOINING_GROUP_MIM,                      /* Mim */
+  UC_JOINING_GROUP_NOON,                     /* Noon */
+  UC_JOINING_GROUP_NUN,                      /* Nun */
+  UC_JOINING_GROUP_NYA,                      /* Nya */
+  UC_JOINING_GROUP_PE,                       /* Pe */
+  UC_JOINING_GROUP_QAF,                      /* Qaf */
+  UC_JOINING_GROUP_QAPH,                     /* Qaph */
+  UC_JOINING_GROUP_REH,                      /* Reh */
+  UC_JOINING_GROUP_REVERSED_PE,              /* Reversed_Pe */
+  UC_JOINING_GROUP_SAD,                      /* Sad */
+  UC_JOINING_GROUP_SADHE,                    /* Sadhe */
+  UC_JOINING_GROUP_SEEN,                     /* Seen */
+  UC_JOINING_GROUP_SEMKATH,                  /* Semkath */
+  UC_JOINING_GROUP_SHIN,                     /* Shin */
+  UC_JOINING_GROUP_SWASH_KAF,                /* Swash_Kaf */
+  UC_JOINING_GROUP_SYRIAC_WAW,               /* Syriac_Waw */
+  UC_JOINING_GROUP_TAH,                      /* Tah */
+  UC_JOINING_GROUP_TAW,                      /* Taw */
+  UC_JOINING_GROUP_TEH_MARBUTA,              /* Teh_Marbuta */
+  UC_JOINING_GROUP_TEH_MARBUTA_GOAL,         /* Teh_Marbuta_Goal */
+  UC_JOINING_GROUP_TETH,                     /* Teth */
+  UC_JOINING_GROUP_WAW,                      /* Waw */
+  UC_JOINING_GROUP_YEH,                      /* Yeh */
+  UC_JOINING_GROUP_YEH_BARREE,               /* Yeh_Barree */
+  UC_JOINING_GROUP_YEH_WITH_TAIL,            /* Yeh_With_Tail */
+  UC_JOINING_GROUP_YUDH,                     /* Yudh */
+  UC_JOINING_GROUP_YUDH_HE,                  /* Yudh_He */
+  UC_JOINING_GROUP_ZAIN,                     /* Zain */
+  UC_JOINING_GROUP_ZHAIN,                    /* Zhain */
+  UC_JOINING_GROUP_ROHINGYA_YEH,             /* Rohingya_Yeh */
+  UC_JOINING_GROUP_STRAIGHT_WAW,             /* Straight_Waw */
+  UC_JOINING_GROUP_MANICHAEAN_ALEPH,         /* Manichaean_Aleph */
+  UC_JOINING_GROUP_MANICHAEAN_BETH,          /* Manichaean_Beth */
+  UC_JOINING_GROUP_MANICHAEAN_GIMEL,         /* Manichaean_Gimel */
+  UC_JOINING_GROUP_MANICHAEAN_DALETH,        /* Manichaean_Daleth */
+  UC_JOINING_GROUP_MANICHAEAN_WAW,           /* Manichaean_Waw */
+  UC_JOINING_GROUP_MANICHAEAN_ZAYIN,         /* Manichaean_Zayin */
+  UC_JOINING_GROUP_MANICHAEAN_HETH,          /* Manichaean_Heth */
+  UC_JOINING_GROUP_MANICHAEAN_TETH,          /* Manichaean_Teth */
+  UC_JOINING_GROUP_MANICHAEAN_YODH,          /* Manichaean_Yodh */
+  UC_JOINING_GROUP_MANICHAEAN_KAPH,          /* Manichaean_Kaph */
+  UC_JOINING_GROUP_MANICHAEAN_LAMEDH,        /* Manichaean_Lamedh */
+  UC_JOINING_GROUP_MANICHAEAN_DHAMEDH,       /* Manichaean_Dhamedh */
+  UC_JOINING_GROUP_MANICHAEAN_THAMEDH,       /* Manichaean_Thamedh */
+  UC_JOINING_GROUP_MANICHAEAN_MEM,           /* Manichaean_Mem */
+  UC_JOINING_GROUP_MANICHAEAN_NUN,           /* Manichaean_Nun */
+  UC_JOINING_GROUP_MANICHAEAN_SAMEKH,        /* Manichaean_Aleph */
+  UC_JOINING_GROUP_MANICHAEAN_AYIN,          /* Manichaean_Ayin */
+  UC_JOINING_GROUP_MANICHAEAN_PE,            /* Manichaean_Pe */
+  UC_JOINING_GROUP_MANICHAEAN_SADHE,         /* Manichaean_Sadhe */
+  UC_JOINING_GROUP_MANICHAEAN_QOPH,          /* Manichaean_Qoph */
+  UC_JOINING_GROUP_MANICHAEAN_RESH,          /* Manichaean_Resh */
+  UC_JOINING_GROUP_MANICHAEAN_TAW,           /* Manichaean_Taw */
+  UC_JOINING_GROUP_MANICHAEAN_ONE,           /* Manichaean_One */
+  UC_JOINING_GROUP_MANICHAEAN_FIVE,          /* Manichaean_Five */
+  UC_JOINING_GROUP_MANICHAEAN_TEN,           /* Manichaean_Ten */
+  UC_JOINING_GROUP_MANICHAEAN_TWENTY,        /* Manichaean_Twenty */
+  UC_JOINING_GROUP_MANICHAEAN_HUNDRED,       /* Manichaean_Hundred */
+  UC_JOINING_GROUP_AFRICAN_FEH,              /* African_Feh */
+  UC_JOINING_GROUP_AFRICAN_QAF,              /* African_Qaf */
+  UC_JOINING_GROUP_AFRICAN_NOON,             /* African_Noon */
+  UC_JOINING_GROUP_MALAYALAM_NGA,            /* Malayalam_Nga */
+  UC_JOINING_GROUP_MALAYALAM_JA,             /* Malayalam_Ja */
+  UC_JOINING_GROUP_MALAYALAM_NYA,            /* Malayalam_Nya */
+  UC_JOINING_GROUP_MALAYALAM_TTA,            /* Malayalam_Tta */
+  UC_JOINING_GROUP_MALAYALAM_NNA,            /* Malayalam_Nna */
+  UC_JOINING_GROUP_MALAYALAM_NNNA,           /* Malayalam_Nnna */
+  UC_JOINING_GROUP_MALAYALAM_BHA,            /* Malayalam_Bha */
+  UC_JOINING_GROUP_MALAYALAM_RA,             /* Malayalam_Ra */
+  UC_JOINING_GROUP_MALAYALAM_LLA,            /* Malayalam_Lla */
+  UC_JOINING_GROUP_MALAYALAM_LLLA,           /* Malayalam_Llla */
+  UC_JOINING_GROUP_MALAYALAM_SSA,            /* Malayalam_Ssa */
+  UC_JOINING_GROUP_HANIFI_ROHINGYA_PA,       /* Hanifi_Rohingya_Pa */
+  UC_JOINING_GROUP_HANIFI_ROHINGYA_KINNA_YA, /* Hanifi_Rohingya_Kinna_Ya */
+  UC_JOINING_GROUP_THIN_YEH,                 /* Thin_Yeh */
+  UC_JOINING_GROUP_VERTICAL_TAIL             /* Vertical_Tail */
+};
+
+/* Return the name of a joining group.  */
+extern const char *
+       uc_joining_group_name (int joining_group)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the joining group given by name, e.g. "Teh_Marbuta".  */
+extern int
+       uc_joining_group_byname (const char *joining_group_name)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the joining group of a Unicode character.  */
+extern int
+       uc_joining_group (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* Common API for properties.  */
+
+/* Data type denoting a property.  This is not just a number, but rather a
+   pointer to the test functions, so that programs that use only few of the
+   properties don't have a link-time dependency towards all the tables.  */
+typedef struct
+{
+  bool (*test_fn) (ucs4_t uc);
+}
+uc_property_t;
+
+/* Predefined properties.  */
+/* General.  */
+extern @GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_WHITE_SPACE;
+extern @GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ALPHABETIC;
+extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ALPHABETIC;
+extern @GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NOT_A_CHARACTER;
+extern @GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT;
+extern @GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT;
+extern @GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEPRECATED;
+extern @GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOGICAL_ORDER_EXCEPTION;
+extern @GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_VARIATION_SELECTOR;
+extern @GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PRIVATE_USE;
+extern @GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNASSIGNED_CODE_VALUE;
+/* Case.  */
+extern @GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UPPERCASE;
+extern @GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_UPPERCASE;
+extern @GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOWERCASE;
+extern @GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_LOWERCASE;
+extern @GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TITLECASE;
+extern @GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASED;
+extern @GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASE_IGNORABLE;
+extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_LOWERCASED;
+extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_UPPERCASED;
+extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_TITLECASED;
+extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEFOLDED;
+extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEMAPPED;
+extern @GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SOFT_DOTTED;
+/* Identifiers.  */
+extern @GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_START;
+extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_START;
+extern @GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_CONTINUE;
+extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_CONTINUE;
+extern @GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_START;
+extern @GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_CONTINUE;
+extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_WHITE_SPACE;
+extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_SYNTAX;
+/* Shaping and rendering.  */
+extern @GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_JOIN_CONTROL;
+extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_BASE;
+extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_EXTEND;
+extern @GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_GRAPHEME_EXTEND;
+extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_LINK;
+/* Bidi.  */
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_CONTROL;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_LEFT_TO_RIGHT;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUROPEAN_DIGIT;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_DIGIT;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_COMMON_SEPARATOR;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BLOCK_SEPARATOR;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_SEGMENT_SEPARATOR;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_WHITESPACE;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_NON_SPACING_MARK;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_PDF;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE;
+extern @GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_OTHER_NEUTRAL;
+/* Numeric.  */
+extern @GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HEX_DIGIT;
+extern @GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ASCII_HEX_DIGIT;
+/* CJK.  */
+extern @GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDEOGRAPHIC;
+extern @GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNIFIED_IDEOGRAPH;
+extern @GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_RADICAL;
+extern @GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_BINARY_OPERATOR;
+extern @GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_TRINARY_OPERATOR;
+/* Emoji.  */
+extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI;
+extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_PRESENTATION;
+extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER;
+extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER_BASE;
+extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_COMPONENT;
+extern @GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDED_PICTOGRAPHIC;
+/* Misc.  */
+extern @GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ZERO_WIDTH;
+extern @GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SPACE;
+extern @GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NON_BREAK;
+extern @GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ISO_CONTROL;
+extern @GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_FORMAT_CONTROL;
+extern @GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DASH;
+extern @GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HYPHEN;
+extern @GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PUNCTUATION;
+extern @GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LINE_SEPARATOR;
+extern @GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PARAGRAPH_SEPARATOR;
+extern @GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_QUOTATION_MARK;
+extern @GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SENTENCE_TERMINAL;
+extern @GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TERMINAL_PUNCTUATION;
+extern @GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CURRENCY_SYMBOL;
+extern @GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_MATH;
+extern @GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_MATH;
+extern @GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PAIRED_PUNCTUATION;
+extern @GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LEFT_OF_PAIR;
+extern @GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMBINING;
+extern @GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMPOSITE;
+extern @GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DECIMAL_DIGIT;
+extern @GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NUMERIC;
+extern @GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DIACRITIC;
+extern @GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDER;
+extern @GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IGNORABLE_CONTROL;
+extern @GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_REGIONAL_INDICATOR;
+
+/* Return the property given by name, e.g. "White space".  */
+extern uc_property_t
+       uc_property_byname (const char *property_name);
+
+/* Test whether a property is valid.  */
+#define uc_property_is_valid(property) ((property).test_fn != NULL)
+
+/* Test whether a Unicode character has a given property.  */
+extern bool
+       uc_is_property (ucs4_t uc, uc_property_t property);
+extern bool uc_is_property_white_space (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_alphabetic (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_other_alphabetic (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_not_a_character (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_default_ignorable_code_point (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_other_default_ignorable_code_point (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_deprecated (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_logical_order_exception (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_variation_selector (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_private_use (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_unassigned_code_value (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_uppercase (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_other_uppercase (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_lowercase (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_other_lowercase (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_titlecase (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_cased (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_case_ignorable (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_changes_when_lowercased (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_changes_when_uppercased (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_changes_when_titlecased (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_changes_when_casefolded (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_changes_when_casemapped (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_soft_dotted (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_id_start (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_other_id_start (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_id_continue (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_other_id_continue (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_xid_start (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_xid_continue (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_pattern_white_space (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_pattern_syntax (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_join_control (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_grapheme_base (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_grapheme_extend (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_other_grapheme_extend (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_grapheme_link (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_control (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_left_to_right (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_hebrew_right_to_left (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_arabic_right_to_left (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_european_digit (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_eur_num_separator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_eur_num_terminator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_arabic_digit (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_common_separator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_block_separator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_segment_separator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_whitespace (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_non_spacing_mark (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_boundary_neutral (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_pdf (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_embedding_or_override (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_bidi_other_neutral (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_hex_digit (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_ascii_hex_digit (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_ideographic (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_unified_ideograph (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_radical (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_ids_binary_operator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_ids_trinary_operator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_emoji (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_emoji_presentation (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_emoji_modifier (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_emoji_modifier_base (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_emoji_component (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_extended_pictographic (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_zero_width (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_space (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_non_break (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_iso_control (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_format_control (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_dash (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_hyphen (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_punctuation (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_line_separator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_paragraph_separator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_quotation_mark (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_sentence_terminal (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_terminal_punctuation (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_currency_symbol (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_math (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_other_math (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_paired_punctuation (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_left_of_pair (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_combining (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_composite (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_decimal_digit (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_numeric (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_diacritic (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_extender (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_ignorable_control (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+extern bool uc_is_property_regional_indicator (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* Subdivision of the Unicode characters into scripts.  */
+
+typedef struct
+{
+  unsigned int code : 21;
+  unsigned int start : 1;
+  unsigned int end : 1;
+}
+uc_interval_t;
+typedef struct
+{
+  unsigned int nintervals;
+  const uc_interval_t *intervals;
+  const char *name;
+}
+uc_script_t;
+
+/* Return the script of a Unicode character.  */
+extern const uc_script_t *
+       uc_script (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the script given by name, e.g. "HAN".  */
+extern const uc_script_t *
+       uc_script_byname (const char *script_name)
+       _UC_ATTRIBUTE_PURE;
+
+/* Test whether a Unicode character belongs to a given script.  */
+extern bool
+       uc_is_script (ucs4_t uc, const uc_script_t *script)
+       _UC_ATTRIBUTE_PURE;
+
+/* Get the list of all scripts.  */
+extern void
+       uc_all_scripts (const uc_script_t **scripts, size_t *count);
+
+/* ========================================================================= */
+
+/* Subdivision of the Unicode character range into blocks.  */
+
+typedef struct
+{
+  ucs4_t start;
+  ucs4_t end;
+  const char *name;
+}
+uc_block_t;
+
+/* Return the block a character belongs to.  */
+extern const uc_block_t *
+       uc_block (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test whether a Unicode character belongs to a given block.  */
+extern bool
+       uc_is_block (ucs4_t uc, const uc_block_t *block)
+       _UC_ATTRIBUTE_PURE;
+
+/* Get the list of all blocks.  */
+extern void
+       uc_all_blocks (const uc_block_t **blocks, size_t *count);
+
+/* ========================================================================= */
+
+/* Properties taken from language standards.  */
+
+/* Test whether a Unicode character is considered whitespace in ISO C 99.  */
+extern bool
+       uc_is_c_whitespace (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test whether a Unicode character is considered whitespace in Java.  */
+extern bool
+       uc_is_java_whitespace (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+enum
+{
+  UC_IDENTIFIER_START,    /* valid as first or subsequent character */
+  UC_IDENTIFIER_VALID,    /* valid as subsequent character only */
+  UC_IDENTIFIER_INVALID,  /* not valid */
+  UC_IDENTIFIER_IGNORABLE /* ignorable (Java only) */
+};
+
+/* Return the categorization of a Unicode character w.r.t. the ISO C 99
+   identifier syntax.  */
+extern int
+       uc_c_ident_category (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Return the categorization of a Unicode character w.r.t. the Java
+   identifier syntax.  */
+extern int
+       uc_java_ident_category (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+/* Like ISO C <ctype.h> and <wctype.h>.  These functions are deprecated,
+   because this set of functions was designed with ASCII in mind and cannot
+   reflect the more diverse reality of the Unicode character set.  But they
+   can be a quick-and-dirty porting aid when migrating from wchar_t APIs
+   to Unicode strings.  */
+
+/* Test for any character for which 'uc_is_alpha' or 'uc_is_digit' is true.  */
+extern bool
+       uc_is_alnum (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any character for which 'uc_is_upper' or 'uc_is_lower' is true,
+   or any character that is one of a locale-specific set of characters for
+   which none of 'uc_is_cntrl', 'uc_is_digit', 'uc_is_punct', or 'uc_is_space'
+   is true.  */
+extern bool
+       uc_is_alpha (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any control character.  */
+extern bool
+       uc_is_cntrl (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any character that corresponds to a decimal-digit character.  */
+extern bool
+       uc_is_digit (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any character for which 'uc_is_print' is true and 'uc_is_space'
+   is false.  */
+extern bool
+       uc_is_graph (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any character that corresponds to a lowercase letter or is one
+   of a locale-specific set of characters for which none of 'uc_is_cntrl',
+   'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true.  */
+extern bool
+       uc_is_lower (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any printing character.  */
+extern bool
+       uc_is_print (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any printing character that is one of a locale-specific set of
+   characters for which neither 'uc_is_space' nor 'uc_is_alnum' is true.  */
+extern bool
+       uc_is_punct (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any character that corresponds to a locale-specific set of
+   characters for which none of 'uc_is_alnum', 'uc_is_graph', or 'uc_is_punct'
+   is true.  */
+extern bool
+       uc_is_space (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any character that corresponds to an uppercase letter or is one
+   of a locale-specific set of character for which none of 'uc_is_cntrl',
+   'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true.  */
+extern bool
+       uc_is_upper (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* Test for any character that corresponds to a hexadecimal-digit
+   character.  */
+extern bool
+       uc_is_xdigit (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* GNU extension. */
+/* Test for any character that corresponds to a standard blank character or
+   a locale-specific set of characters for which 'uc_is_alnum' is false.  */
+extern bool
+       uc_is_blank (ucs4_t uc)
+       _UC_ATTRIBUTE_CONST;
+
+/* ========================================================================= */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UNICTYPE_H */
deleted file mode 120000 (symlink)
index eedb0943273409b42b6f0adcbcf99e94e0568b38..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/bitmap.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dba236551681a0f4eb072e7e52306e72e4e4587f
--- /dev/null
@@ -0,0 +1,48 @@
+/* Three-level bitmap lookup.
+   Copyright (C) 2000-2002, 2005-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2000-2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+static inline int bitmap_lookup (const void *table, ucs4_t uc);
+
+/* These values are currently hardcoded into gen-uni-tables.c, function
+   output_predicate().  */
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+
+static inline int
+bitmap_lookup (const void *table, ucs4_t uc)
+{
+  unsigned int index1 = uc >> header_0;
+  if (index1 < ((const int *) table)[0])
+    {
+      int lookup1 = ((const int *) table)[1 + index1];
+      if (lookup1 >= 0)
+        {
+          unsigned int index2 = (uc >> header_2) & header_3;
+          int lookup2 = ((const short *) table)[lookup1 + index2];
+          if (lookup2 >= 0)
+            {
+              unsigned int index3 = (uc >> 5) & header_4;
+              unsigned int lookup3 = ((const unsigned int *) table)[lookup2 + index3];
+
+              return (lookup3 >> (uc & 0x1f)) & 1;
+            }
+        }
+    }
+  return 0;
+}
deleted file mode 120000 (symlink)
index 842e66bdea40a3bfae8cc9d49b27229dd432ae0a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_alnum.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1f69c14ada99e2859007bc53e6d2286d0c047785
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_alnum table.  */
+#include "ctype_alnum.h"
+
+bool
+uc_is_alnum (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_alnum, uc);
+}
deleted file mode 120000 (symlink)
index 20aad17eb673f00601d6151ffb0c85224d039e19..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_alnum.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4629789862536f9d3f3a8fdaa5d51c4a2cd9a090
--- /dev/null
@@ -0,0 +1,877 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[4];
+    short level2[4 << 7];
+    unsigned int level3[80 << 4];
+  }
+u_is_alnum =
+{
+  { 4 },
+  {
+        5 * sizeof (int) / sizeof (short) +     0,
+        5 * sizeof (int) / sizeof (short) +   128,
+        5 * sizeof (int) / sizeof (short) +   256,
+        5 * sizeof (int) / sizeof (short) +   384
+  },
+  {
+        5 +   512 * sizeof (short) / sizeof (int) +     0,
+        5 +   512 * sizeof (short) / sizeof (int) +    16,
+        5 +   512 * sizeof (short) / sizeof (int) +    32,
+        5 +   512 * sizeof (short) / sizeof (int) +    48,
+        5 +   512 * sizeof (short) / sizeof (int) +    64,
+        5 +   512 * sizeof (short) / sizeof (int) +    80,
+        5 +   512 * sizeof (short) / sizeof (int) +    96,
+        5 +   512 * sizeof (short) / sizeof (int) +   112,
+        5 +   512 * sizeof (short) / sizeof (int) +   128,
+        5 +   512 * sizeof (short) / sizeof (int) +   144,
+        5 +   512 * sizeof (short) / sizeof (int) +   160,
+        5 +   512 * sizeof (short) / sizeof (int) +   176,
+        5 +   512 * sizeof (short) / sizeof (int) +   192,
+        5 +   512 * sizeof (short) / sizeof (int) +   208,
+        5 +   512 * sizeof (short) / sizeof (int) +   224,
+        5 +   512 * sizeof (short) / sizeof (int) +   240,
+        5 +   512 * sizeof (short) / sizeof (int) +   256,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   272,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   288,
+        5 +   512 * sizeof (short) / sizeof (int) +   304,
+        5 +   512 * sizeof (short) / sizeof (int) +   320,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   352,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   368,
+        5 +   512 * sizeof (short) / sizeof (int) +   384,
+        5 +   512 * sizeof (short) / sizeof (int) +   400,
+        5 +   512 * sizeof (short) / sizeof (int) +   416,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   432,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   448,
+        5 +   512 * sizeof (short) / sizeof (int) +   464,
+        5 +   512 * sizeof (short) / sizeof (int) +   480,
+        5 +   512 * sizeof (short) / sizeof (int) +   496,
+        5 +   512 * sizeof (short) / sizeof (int) +   512,
+        5 +   512 * sizeof (short) / sizeof (int) +   528,
+        5 +   512 * sizeof (short) / sizeof (int) +   544,
+        5 +   512 * sizeof (short) / sizeof (int) +   560,
+        5 +   512 * sizeof (short) / sizeof (int) +   576,
+        5 +   512 * sizeof (short) / sizeof (int) +   592,
+        5 +   512 * sizeof (short) / sizeof (int) +   608,
+        5 +   512 * sizeof (short) / sizeof (int) +   624,
+        5 +   512 * sizeof (short) / sizeof (int) +   640,
+        5 +   512 * sizeof (short) / sizeof (int) +   656,
+        5 +   512 * sizeof (short) / sizeof (int) +   672,
+        5 +   512 * sizeof (short) / sizeof (int) +   688,
+        5 +   512 * sizeof (short) / sizeof (int) +   704,
+        5 +   512 * sizeof (short) / sizeof (int) +   720,
+        5 +   512 * sizeof (short) / sizeof (int) +   736,
+        5 +   512 * sizeof (short) / sizeof (int) +   752,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   768,
+        5 +   512 * sizeof (short) / sizeof (int) +   784,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   800,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   816,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   832,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   848,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   864,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   880,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   896,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   912,
+        5 +   512 * sizeof (short) / sizeof (int) +   928,
+        5 +   512 * sizeof (short) / sizeof (int) +   944,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   960,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   976,
+        5 +   512 * sizeof (short) / sizeof (int) +   992,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +  1008,
+        5 +   512 * sizeof (short) / sizeof (int) +  1024,
+        5 +   512 * sizeof (short) / sizeof (int) +  1040,
+        5 +   512 * sizeof (short) / sizeof (int) +  1056,
+        5 +   512 * sizeof (short) / sizeof (int) +  1072,
+        5 +   512 * sizeof (short) / sizeof (int) +  1088,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +  1104,
+        5 +   512 * sizeof (short) / sizeof (int) +  1120,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +  1136,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1152,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1168,
+        5 +   512 * sizeof (short) / sizeof (int) +  1184,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1200,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1216,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1232,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1248,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1264,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0x00000000U, 0x03FF0000U, 0x07FFFFFEU, 0x07FFFFFEU,
+    0x00000000U, 0x04200400U, 0xFF7FFFFFU, 0xFF7FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0003FFC3U, 0x0000501FU,
+    0x00000000U, 0x00000000U, 0x00000020U, 0xBCDF0000U,
+    0xFFFFD740U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFBFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFC03U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFEFFFFU, 0x027FFFFFU, 0xFFFFFFFFU,
+    0x000001FFU, 0x00000000U, 0xFFFF0000U, 0x000787FFU,
+    0x00000000U, 0xFFFFFFFFU, 0x000007FFU, 0xFFFEC3FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x002FFFFFU, 0x9FFFC060U,
+    0xFFFD0000U, 0x0000FFFFU, 0xFFFFE000U, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0002003FU, 0xFFFFFFFFU, 0x043007FFU,
+    0x043FFFFFU, 0x00000110U, 0x01FFFFFFU, 0xFFFF07FFU,
+    0x00007EFFU, 0xFFFFFFFFU, 0x000003FFU, 0x00000000U,
+    0xFFFFFFF0U, 0x23FFFFFFU, 0xFF010000U, 0xFFFEFFC3U,
+    0xFFF99FE1U, 0x23C5FDFFU, 0xB0004000U, 0x1003FFC3U,
+    0xFFF987E0U, 0x036DFDFFU, 0x5E000000U, 0x001CFFC0U,
+    0xFFFBBFE0U, 0x23EDFDFFU, 0x00010000U, 0x0200FFC3U,
+    0xFFF99FE0U, 0x23EDFDFFU, 0xB0000000U, 0x0002FFC3U,
+    0xD63DC7E8U, 0x03FFC718U, 0x00010000U, 0x0000FFC0U,
+    0xFFFDDFE0U, 0x23FFFDFFU, 0x27000000U, 0x0000FFC3U,
+    0xFFFDDFE1U, 0x23EFFDFFU, 0x60000000U, 0x0006FFC3U,
+    0xFFFDDFF0U, 0x27FFFFFFU, 0x80704000U, 0xFC00FFC3U,
+    0xFC7FFFE0U, 0x2FFBFFFFU, 0x0000007FU, 0x0000FFC0U,
+    0xFFFFFFFEU, 0x07FF7FFFU, 0x03FF7FBFU, 0x00000000U,
+    0xFFFFF7D6U, 0x200DFFAFU, 0xF3FF005FU, 0x00000000U,
+    0x00000001U, 0x000003FFU, 0xFFFFFEFFU, 0x00001FFFU,
+    0x00001F00U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x800007FFU, 0x3C3F03FFU, 0xFFE1C062U,
+    0x03FF4003U, 0xFFFFFFFFU, 0xFFFF20BFU, 0xF7FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU,
+    0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU,
+    0xFF3DFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, 0x00000000U,
+    0x0000FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU,
+    0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF9FFFU,
+    0x07FFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFC7FFU,
+    0x8003FFFFU, 0x0003FFFFU, 0x0003FFFFU, 0x0001DFFFU,
+    0xFFFFFFFFU, 0x000FFFFFU, 0x10800000U, 0x000003FFU,
+    0x03FF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0xFFFFFF9FU, 0xFFFF05FFU, 0xFFFFFFFFU, 0x003FFFFFU,
+    0x7FFFFFFFU, 0x00000000U, 0xFFFFFFC0U, 0x001F3FFFU,
+    0xFFFFFFFFU, 0xFFFF0FFFU, 0x03FF03FFU, 0x00000000U,
+    0x007FFFFFU, 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U,
+    0x03FF03FFU, 0x00000080U, 0x00000000U, 0x00000000U,
+    0xFFFFFFE0U, 0x000FFFFFU, 0x03FF1FE0U, 0x00000000U,
+    0xFFFFFFF8U, 0xFFFFC001U, 0xFFFFFFFFU, 0x0000003FU,
+    0xFFFFFFFFU, 0x0000000FU, 0xFFFFE3FFU, 0x3FFFFFFFU,
+    0xFFFF01FFU, 0xE7FFFFFFU, 0x00000000U, 0x046FDE00U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU,
+    0xFFFFFFFFU, 0x5FDFFFFFU, 0x0FCF1FDCU, 0x1FDC1FFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x80020000U,
+    0x1FFF0000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x3E2FFC84U, 0xF3FFBF50U, 0x000043E0U, 0xFFFFFFFFU,
+    0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xF0000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000003FFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000C781FU,
+    0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x000080FFU,
+    0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0x00000000U,
+    0x00000000U, 0x00008000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x000000E0U, 0x1F3E03FEU, 0xFFFFFFFEU, 0xFFFFFFFFU,
+    0xE07FFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU, 0xF7FFFFFFU,
+    0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00007FFFU, 0xFFFFFFFFU, 0x00000000U, 0xFFFF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00001FFFU, 0x00000000U, 0xFFFF0000U, 0x3FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFF1FFFU, 0x00000FFFU, 0xFFFFFFFFU, 0x80007FFFU,
+    0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
+    0xFF800000U, 0xFFFFFFFCU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFF9FFU, 0xFFFFFFFFU, 0x03EB07FFU, 0xFFFC0000U,
+    0xFFFFF7BBU, 0x00000007U, 0xFFFFFFFFU, 0x000FFFFFU,
+    0xFFFFFFFCU, 0x000FFFFFU, 0x03FF0000U, 0x68FC0000U,
+    0xFFFFFFFFU, 0xFFFF003FU, 0x0000007FU, 0x1FFFFFFFU,
+    0xFFFFFFF0U, 0x0007FFFFU, 0x03FF8000U, 0x7FFFFFDFU,
+    0xFFFFFFFFU, 0x000001FFU, 0x03FF0FF7U, 0xC47FFFFFU,
+    0xFFFFFFFFU, 0x3E62FFFFU, 0x38000005U, 0x001C07FFU,
+    0x007E7E7EU, 0xFFFF7F7FU, 0xF7FFFFFFU, 0xFFFF03FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF0007U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U,
+    0xA0F8007FU, 0x5F7FFDFFU, 0xFFFFFFDBU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0003FFFFU, 0xFFF80000U, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x3FFFFFFFU, 0xFFFF0000U, 0xFFFFFFFFU,
+    0xFFFCFFFFU, 0xFFFFFFFFU, 0x000000FFU, 0x0FFF0000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xFFDF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU,
+    0x03FF0000U, 0x07FFFFFEU, 0x07FFFFFEU, 0xFFFFFFC0U,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x00000000U,
+    0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x001FFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFE000U, 0xFFFF07FFU, 0x003FFFFFU,
+    0x3FFFFFFFU, 0xFFFFFFFFU, 0x003EFF0FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF000FU,
+    0xFFB7F7FFU, 0x1BFBFFFBU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU,
+    0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFD3FU, 0x91BFFFFFU, 0x003FFFFFU, 0x007FFFFFU,
+    0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x0037FFFFU,
+    0x003FFFFFU, 0x03FFFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xC0FFFFFFU, 0x00000000U, 0x00000000U,
+    0xFEEF0001U, 0x003FFFFFU, 0x00000000U, 0x1FFFFFFFU,
+    0x1FFFFFFFU, 0x00000000U, 0xFFFFFEFFU, 0x0000001FU,
+    0xFFFFFFFFU, 0x003FFFFFU, 0x003FFFFFU, 0x0007FFFFU,
+    0x0003FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U,
+    0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
+    0xFFFFFFFFU, 0x03FF000FU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x000303FFU, 0x00000000U, 0x00000000U,
+    0x1FFFFFFFU, 0xFFFF0080U, 0x0000003FU, 0xFFFF0000U,
+    0x00000003U, 0xFFFF0000U, 0x0000001FU, 0x007FFFFFU,
+    0xFFFFFFF8U, 0x00FFFFFFU, 0x00000000U, 0x0026FFC0U,
+    0xFFFFFFF8U, 0x0000FFFFU, 0xFFFF0000U, 0x03FF01FFU,
+    0xFFFFFFF8U, 0xFFC0007FU, 0xFFFF0090U, 0x0047FFFFU,
+    0xFFFFFFF8U, 0x0007FFFFU, 0x17FF001EU, 0x00000000U,
+    0xFFFBFFFFU, 0x80000FFFU, 0x00000001U, 0x00000000U,
+    0xBFFFBD7FU, 0xFFFF01FFU, 0x7FFFFFFFU, 0x03FF0000U,
+    0xFFF99FE0U, 0x23EDFDFFU, 0xE0010000U, 0x00000003U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x001FFFFFU, 0x83FF0780U, 0x00000003U,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x03FF00B0U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x00007FFFU, 0x0F000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x03FF0010U, 0x00000000U,
+    0xFFFFFFFFU, 0x010007FFU, 0x000003FFU, 0x00000000U,
+    0x07FFFFFFU, 0x03FF0000U, 0x0000007FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x00000FFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800003FFU,
+    0xFF6FF27FU, 0x8000FFFFU, 0x03FF0002U, 0x00000000U,
+    0x00000000U, 0xFFFFFCFFU, 0x0001FFFFU, 0x0000000AU,
+    0xFFFFF801U, 0x0407FFFFU, 0xF0010000U, 0xFFFFFFFFU,
+    0x200003FFU, 0xFFFF0000U, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFDFFU, 0x00007FFFU, 0x03FF0001U, 0xFFFC0000U,
+    0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFB7FU, 0x0001FFFFU, 0x03FF0040U, 0xFFFFFDBFU,
+    0x010003FFU, 0x000003FFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x0007FFFFU,
+    0xFFFDFFF4U, 0x000FFFFFU, 0x03FF0000U, 0x00000000U,
+    0x00000000U, 0x00010000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00007FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x0000007EU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x00003FFFU,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x03FF000FU, 0xE0FFFFF8U,
+    0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x000107FFU, 0x00000000U,
+    0xFFF80000U, 0x00000000U, 0x00000000U, 0x0000000BU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U,
+    0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
+    0x03FF01FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
+    0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
+    0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFF3FU, 0xF7FFFFFDU, 0xF7FFFFFFU,
+    0xFFDFFFFFU, 0xFFDFFFFFU, 0xFFFF7FFFU, 0xFFFF7FFFU,
+    0xFFFFFDFFU, 0xFFFFFDFFU, 0xFFFFCFF7U, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00003FFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x3F801FFFU, 0x000043FFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0x00003FFFU, 0xFFFFFFFFU, 0x03FF0FFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FF0FFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000001FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF080FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
+    0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0xFFFF1FFFU, 0xFFFF03FFU, 0xFFFF03FFU,
+    0x000007FFU, 0x00000020U, 0x00000000U, 0xFFFFFFC0U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x03FF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000001U,
+    0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index 8beab6c94ae6d4fef772243e8b026c679f45b491..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_alpha.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..16cddc9204cba19cb6d7b4f32d9992bd3cbd6c05
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_alpha table.  */
+#include "ctype_alpha.h"
+
+bool
+uc_is_alpha (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_alpha, uc);
+}
deleted file mode 120000 (symlink)
index a4d6c1a4d0e0093344880f2885ba699e581f0c11..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_alpha.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..91a5e8225705736e8609e86f33b920659aad33a1
--- /dev/null
@@ -0,0 +1,877 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[4];
+    short level2[4 << 7];
+    unsigned int level3[80 << 4];
+  }
+u_is_alpha =
+{
+  { 4 },
+  {
+        5 * sizeof (int) / sizeof (short) +     0,
+        5 * sizeof (int) / sizeof (short) +   128,
+        5 * sizeof (int) / sizeof (short) +   256,
+        5 * sizeof (int) / sizeof (short) +   384
+  },
+  {
+        5 +   512 * sizeof (short) / sizeof (int) +     0,
+        5 +   512 * sizeof (short) / sizeof (int) +    16,
+        5 +   512 * sizeof (short) / sizeof (int) +    32,
+        5 +   512 * sizeof (short) / sizeof (int) +    48,
+        5 +   512 * sizeof (short) / sizeof (int) +    64,
+        5 +   512 * sizeof (short) / sizeof (int) +    80,
+        5 +   512 * sizeof (short) / sizeof (int) +    96,
+        5 +   512 * sizeof (short) / sizeof (int) +   112,
+        5 +   512 * sizeof (short) / sizeof (int) +   128,
+        5 +   512 * sizeof (short) / sizeof (int) +   144,
+        5 +   512 * sizeof (short) / sizeof (int) +   160,
+        5 +   512 * sizeof (short) / sizeof (int) +   176,
+        5 +   512 * sizeof (short) / sizeof (int) +   192,
+        5 +   512 * sizeof (short) / sizeof (int) +   208,
+        5 +   512 * sizeof (short) / sizeof (int) +   224,
+        5 +   512 * sizeof (short) / sizeof (int) +   240,
+        5 +   512 * sizeof (short) / sizeof (int) +   256,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   272,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   288,
+        5 +   512 * sizeof (short) / sizeof (int) +   304,
+        5 +   512 * sizeof (short) / sizeof (int) +   320,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   352,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   368,
+        5 +   512 * sizeof (short) / sizeof (int) +   384,
+        5 +   512 * sizeof (short) / sizeof (int) +   400,
+        5 +   512 * sizeof (short) / sizeof (int) +   416,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   432,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   448,
+        5 +   512 * sizeof (short) / sizeof (int) +   464,
+        5 +   512 * sizeof (short) / sizeof (int) +   480,
+        5 +   512 * sizeof (short) / sizeof (int) +   496,
+        5 +   512 * sizeof (short) / sizeof (int) +   512,
+        5 +   512 * sizeof (short) / sizeof (int) +   528,
+        5 +   512 * sizeof (short) / sizeof (int) +   544,
+        5 +   512 * sizeof (short) / sizeof (int) +   560,
+        5 +   512 * sizeof (short) / sizeof (int) +   576,
+        5 +   512 * sizeof (short) / sizeof (int) +   592,
+        5 +   512 * sizeof (short) / sizeof (int) +   608,
+        5 +   512 * sizeof (short) / sizeof (int) +   624,
+        5 +   512 * sizeof (short) / sizeof (int) +   640,
+        5 +   512 * sizeof (short) / sizeof (int) +   656,
+        5 +   512 * sizeof (short) / sizeof (int) +   672,
+        5 +   512 * sizeof (short) / sizeof (int) +   688,
+        5 +   512 * sizeof (short) / sizeof (int) +   704,
+        5 +   512 * sizeof (short) / sizeof (int) +   720,
+        5 +   512 * sizeof (short) / sizeof (int) +   736,
+        5 +   512 * sizeof (short) / sizeof (int) +   752,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   768,
+        5 +   512 * sizeof (short) / sizeof (int) +   784,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   800,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   816,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   832,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   848,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   864,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   880,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   896,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   912,
+        5 +   512 * sizeof (short) / sizeof (int) +   928,
+        5 +   512 * sizeof (short) / sizeof (int) +   944,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   960,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   976,
+        5 +   512 * sizeof (short) / sizeof (int) +   992,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +  1008,
+        5 +   512 * sizeof (short) / sizeof (int) +  1024,
+        5 +   512 * sizeof (short) / sizeof (int) +  1040,
+        5 +   512 * sizeof (short) / sizeof (int) +  1056,
+        5 +   512 * sizeof (short) / sizeof (int) +  1072,
+        5 +   512 * sizeof (short) / sizeof (int) +  1088,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +  1104,
+        5 +   512 * sizeof (short) / sizeof (int) +  1120,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +  1136,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1152,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1168,
+        5 +   512 * sizeof (short) / sizeof (int) +  1184,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1200,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1216,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1232,
+       -1,
+       -1,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1248,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +   336,
+        5 +   512 * sizeof (short) / sizeof (int) +  1264,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0x00000000U, 0x00000000U, 0x07FFFFFEU, 0x07FFFFFEU,
+    0x00000000U, 0x04200400U, 0xFF7FFFFFU, 0xFF7FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0003FFC3U, 0x0000501FU,
+    0x00000000U, 0x00000000U, 0x00000020U, 0xBCDF0000U,
+    0xFFFFD740U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFBFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFC03U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFEFFFFU, 0x027FFFFFU, 0xFFFFFFFFU,
+    0x000001FFU, 0x00000000U, 0xFFFF0000U, 0x000787FFU,
+    0x00000000U, 0xFFFFFFFFU, 0x000007FFU, 0xFFFEC3FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x002FFFFFU, 0x9FFFC060U,
+    0xFFFD0000U, 0x0000FFFFU, 0xFFFFE000U, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0002003FU, 0xFFFFFFFFU, 0x043007FFU,
+    0x043FFFFFU, 0x00000110U, 0x01FFFFFFU, 0xFFFF07FFU,
+    0x00007EFFU, 0xFFFFFFFFU, 0x000003FFU, 0x00000000U,
+    0xFFFFFFF0U, 0x23FFFFFFU, 0xFF010000U, 0xFFFEFFC3U,
+    0xFFF99FE1U, 0x23C5FDFFU, 0xB0004000U, 0x1003FFC3U,
+    0xFFF987E0U, 0x036DFDFFU, 0x5E000000U, 0x001CFFC0U,
+    0xFFFBBFE0U, 0x23EDFDFFU, 0x00010000U, 0x0200FFC3U,
+    0xFFF99FE0U, 0x23EDFDFFU, 0xB0000000U, 0x0002FFC3U,
+    0xD63DC7E8U, 0x03FFC718U, 0x00010000U, 0x0000FFC0U,
+    0xFFFDDFE0U, 0x23FFFDFFU, 0x27000000U, 0x0000FFC3U,
+    0xFFFDDFE1U, 0x23EFFDFFU, 0x60000000U, 0x0006FFC3U,
+    0xFFFDDFF0U, 0x27FFFFFFU, 0x80704000U, 0xFC00FFC3U,
+    0xFC7FFFE0U, 0x2FFBFFFFU, 0x0000007FU, 0x0000FFC0U,
+    0xFFFFFFFEU, 0x07FF7FFFU, 0x03FF7FBFU, 0x00000000U,
+    0xFFFFF7D6U, 0x200DFFAFU, 0xF3FF005FU, 0x00000000U,
+    0x00000001U, 0x000003FFU, 0xFFFFFEFFU, 0x00001FFFU,
+    0x00001F00U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x800007FFU, 0x3C3F03FFU, 0xFFE1C062U,
+    0x03FF4003U, 0xFFFFFFFFU, 0xFFFF20BFU, 0xF7FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU,
+    0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU,
+    0xFF3DFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, 0x00000000U,
+    0x0000FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU,
+    0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF9FFFU,
+    0x07FFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFC7FFU,
+    0x8003FFFFU, 0x0003FFFFU, 0x0003FFFFU, 0x0001DFFFU,
+    0xFFFFFFFFU, 0x000FFFFFU, 0x10800000U, 0x000003FFU,
+    0x03FF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0xFFFFFF9FU, 0xFFFF05FFU, 0xFFFFFFFFU, 0x003FFFFFU,
+    0x7FFFFFFFU, 0x00000000U, 0xFFFFFFC0U, 0x001F3FFFU,
+    0xFFFFFFFFU, 0xFFFF0FFFU, 0x03FF03FFU, 0x00000000U,
+    0x007FFFFFU, 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U,
+    0x03FF03FFU, 0x00000080U, 0x00000000U, 0x00000000U,
+    0xFFFFFFE0U, 0x000FFFFFU, 0x03FF1FE0U, 0x00000000U,
+    0xFFFFFFF8U, 0xFFFFC001U, 0xFFFFFFFFU, 0x0000003FU,
+    0xFFFFFFFFU, 0x0000000FU, 0xFFFFE3FFU, 0x3FFFFFFFU,
+    0xFFFF01FFU, 0xE7FFFFFFU, 0x00000000U, 0x046FDE00U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU,
+    0xFFFFFFFFU, 0x5FDFFFFFU, 0x0FCF1FDCU, 0x1FDC1FFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x80020000U,
+    0x1FFF0000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x3E2FFC84U, 0xF3FFBF50U, 0x000043E0U, 0xFFFFFFFFU,
+    0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xF0000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000003FFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000C781FU,
+    0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x000080FFU,
+    0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0x00000000U,
+    0x00000000U, 0x00008000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x000000E0U, 0x1F3E03FEU, 0xFFFFFFFEU, 0xFFFFFFFFU,
+    0xE07FFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU, 0xF7FFFFFFU,
+    0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00007FFFU, 0xFFFFFFFFU, 0x00000000U, 0xFFFF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00001FFFU, 0x00000000U, 0xFFFF0000U, 0x3FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFF1FFFU, 0x00000FFFU, 0xFFFFFFFFU, 0x80007FFFU,
+    0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
+    0xFF800000U, 0xFFFFFFFCU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFF9FFU, 0xFFFFFFFFU, 0x03EB07FFU, 0xFFFC0000U,
+    0xFFFFF7BBU, 0x00000007U, 0xFFFFFFFFU, 0x000FFFFFU,
+    0xFFFFFFFCU, 0x000FFFFFU, 0x03FF0000U, 0x68FC0000U,
+    0xFFFFFFFFU, 0xFFFF003FU, 0x0000007FU, 0x1FFFFFFFU,
+    0xFFFFFFF0U, 0x0007FFFFU, 0x03FF8000U, 0x7FFFFFDFU,
+    0xFFFFFFFFU, 0x000001FFU, 0x03FF0FF7U, 0xC47FFFFFU,
+    0xFFFFFFFFU, 0x3E62FFFFU, 0x38000005U, 0x001C07FFU,
+    0x007E7E7EU, 0xFFFF7F7FU, 0xF7FFFFFFU, 0xFFFF03FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF0007U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U,
+    0xA0F8007FU, 0x5F7FFDFFU, 0xFFFFFFDBU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0003FFFFU, 0xFFF80000U, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x3FFFFFFFU, 0xFFFF0000U, 0xFFFFFFFFU,
+    0xFFFCFFFFU, 0xFFFFFFFFU, 0x000000FFU, 0x0FFF0000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xFFDF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU,
+    0x03FF0000U, 0x07FFFFFEU, 0x07FFFFFEU, 0xFFFFFFC0U,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x00000000U,
+    0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x001FFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFE000U, 0xFFFF07FFU, 0x003FFFFFU,
+    0x3FFFFFFFU, 0xFFFFFFFFU, 0x003EFF0FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF000FU,
+    0xFFB7F7FFU, 0x1BFBFFFBU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU,
+    0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFD3FU, 0x91BFFFFFU, 0x003FFFFFU, 0x007FFFFFU,
+    0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x0037FFFFU,
+    0x003FFFFFU, 0x03FFFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xC0FFFFFFU, 0x00000000U, 0x00000000U,
+    0xFEEF0001U, 0x003FFFFFU, 0x00000000U, 0x1FFFFFFFU,
+    0x1FFFFFFFU, 0x00000000U, 0xFFFFFEFFU, 0x0000001FU,
+    0xFFFFFFFFU, 0x003FFFFFU, 0x003FFFFFU, 0x0007FFFFU,
+    0x0003FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U,
+    0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
+    0xFFFFFFFFU, 0x03FF000FU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x000303FFU, 0x00000000U, 0x00000000U,
+    0x1FFFFFFFU, 0xFFFF0080U, 0x0000003FU, 0xFFFF0000U,
+    0x00000003U, 0xFFFF0000U, 0x0000001FU, 0x007FFFFFU,
+    0xFFFFFFF8U, 0x00FFFFFFU, 0x00000000U, 0x0026FFC0U,
+    0xFFFFFFF8U, 0x0000FFFFU, 0xFFFF0000U, 0x03FF01FFU,
+    0xFFFFFFF8U, 0xFFC0007FU, 0xFFFF0090U, 0x0047FFFFU,
+    0xFFFFFFF8U, 0x0007FFFFU, 0x17FF001EU, 0x00000000U,
+    0xFFFBFFFFU, 0x80000FFFU, 0x00000001U, 0x00000000U,
+    0xBFFFBD7FU, 0xFFFF01FFU, 0x7FFFFFFFU, 0x03FF0000U,
+    0xFFF99FE0U, 0x23EDFDFFU, 0xE0010000U, 0x00000003U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x001FFFFFU, 0x83FF0780U, 0x00000003U,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x03FF00B0U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x00007FFFU, 0x0F000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x03FF0010U, 0x00000000U,
+    0xFFFFFFFFU, 0x010007FFU, 0x000003FFU, 0x00000000U,
+    0x07FFFFFFU, 0x03FF0000U, 0x0000007FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x00000FFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800003FFU,
+    0xFF6FF27FU, 0x8000FFFFU, 0x03FF0002U, 0x00000000U,
+    0x00000000U, 0xFFFFFCFFU, 0x0001FFFFU, 0x0000000AU,
+    0xFFFFF801U, 0x0407FFFFU, 0xF0010000U, 0xFFFFFFFFU,
+    0x200003FFU, 0xFFFF0000U, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFDFFU, 0x00007FFFU, 0x03FF0001U, 0xFFFC0000U,
+    0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFB7FU, 0x0001FFFFU, 0x03FF0040U, 0xFFFFFDBFU,
+    0x010003FFU, 0x000003FFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x0007FFFFU,
+    0xFFFDFFF4U, 0x000FFFFFU, 0x03FF0000U, 0x00000000U,
+    0x00000000U, 0x00010000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00007FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x0000007EU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x00003FFFU,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x03FF000FU, 0xE0FFFFF8U,
+    0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x000107FFU, 0x00000000U,
+    0xFFF80000U, 0x00000000U, 0x00000000U, 0x0000000BU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U,
+    0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
+    0x03FF01FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
+    0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
+    0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFF3FU, 0xF7FFFFFDU, 0xF7FFFFFFU,
+    0xFFDFFFFFU, 0xFFDFFFFFU, 0xFFFF7FFFU, 0xFFFF7FFFU,
+    0xFFFFFDFFU, 0xFFFFFDFFU, 0xFFFFCFF7U, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00003FFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x3F801FFFU, 0x000043FFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0x00003FFFU, 0xFFFFFFFFU, 0x03FF0FFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FF0FFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000001FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF080FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
+    0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0xFFFF1FFFU, 0xFFFF03FFU, 0xFFFF03FFU,
+    0x000007FFU, 0x00000020U, 0x00000000U, 0xFFFFFFC0U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x03FF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000001U,
+    0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index bbde3667187be0bebf6a37ca59d832dce87566d2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_blank.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cec8e023caf6fca151d9802fbb1ebb345b78ce80
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_blank table.  */
+#include "ctype_blank.h"
+
+bool
+uc_is_blank (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_blank, uc);
+}
deleted file mode 120000 (symlink)
index 8c9f3f5430d00f5d011cc76ca362d6e02431b3bc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_blank.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5ed5fbbed821dee51193ad59149ceacfadc7757f
--- /dev/null
@@ -0,0 +1,184 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[1];
+    short level2[1 << 7];
+    unsigned int level3[4 << 4];
+  }
+u_is_blank =
+{
+  { 1 },
+  {     2 * sizeof (int) / sizeof (short) +     0 },
+  {
+        2 +   128 * sizeof (short) / sizeof (int) +     0,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        2 +   128 * sizeof (short) / sizeof (int) +    16,
+       -1,
+       -1,
+       -1,
+       -1,
+        2 +   128 * sizeof (short) / sizeof (int) +    32,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        2 +   128 * sizeof (short) / sizeof (int) +    48,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0x00000200U, 0x00000001U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x0000077FU, 0x00000000U, 0x80000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index 35849c65d9d406c482297dfefeffff8c57cea414..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_cntrl.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6ed527399c98db3aaa56b98ac1f1b63743b933b9
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_cntrl table.  */
+#include "ctype_cntrl.h"
+
+bool
+uc_is_cntrl (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_cntrl, uc);
+}
deleted file mode 120000 (symlink)
index 15f4c57cf71c3a4a077706fddc5aae595eb55967..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_cntrl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c1c179418ca838ccac285b451456410df35d7dd3
--- /dev/null
@@ -0,0 +1,176 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[1];
+    short level2[1 << 7];
+    unsigned int level3[2 << 4];
+  }
+u_is_cntrl =
+{
+  { 1 },
+  {     2 * sizeof (int) / sizeof (short) +     0 },
+  {
+        2 +   128 * sizeof (short) / sizeof (int) +     0,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        2 +   128 * sizeof (short) / sizeof (int) +    16,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0xFFFFFFFFU, 0x00000000U, 0x00000000U, 0x80000000U,
+    0xFFFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000300U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index 9b7a6388bf2ffdb1a7ba7abafff82b69512833c9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_digit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..906e73756bee2581c4b3fda1ba7c6635acc0422a
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_digit table.  */
+#include "ctype_digit.h"
+
+bool
+uc_is_digit (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_digit, uc);
+}
deleted file mode 120000 (symlink)
index 86e7734cdecaa4c4a5a269ad4025985abc40a546..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_digit.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3111b9ade1d9da4beed47d5dab046720d69394bd
--- /dev/null
@@ -0,0 +1,172 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[1];
+    short level2[1 << 7];
+    unsigned int level3[1 << 4];
+  }
+u_is_digit =
+{
+  { 1 },
+  {     2 * sizeof (int) / sizeof (short) +     0 },
+  {
+        2 +   128 * sizeof (short) / sizeof (int) +     0,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0x00000000U, 0x03FF0000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index 59a2e70ea31c7273f6151c921713871d62d37ca2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_graph.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e58f69e4d0acd5bb4ef11751eec378203ebdb9fc
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_graph table.  */
+#include "ctype_graph.h"
+
+bool
+uc_is_graph (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_graph, uc);
+}
deleted file mode 120000 (symlink)
index e968704d47811d77463a80dcc89c40f35d7c12c2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_graph.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d95722e1a32a0d07789d40ebe1750ba35a1c1a96
--- /dev/null
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[17];
+    short level2[6 << 7];
+    unsigned int level3[89 << 4];
+  }
+u_is_graph =
+{
+  { 17 },
+  {
+       18 * sizeof (int) / sizeof (short) +     0,
+       18 * sizeof (int) / sizeof (short) +   128,
+       18 * sizeof (int) / sizeof (short) +   256,
+       18 * sizeof (int) / sizeof (short) +   384,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 * sizeof (int) / sizeof (short) +   512,
+       18 * sizeof (int) / sizeof (short) +   640,
+       18 * sizeof (int) / sizeof (short) +   640
+  },
+  {
+       18 +   768 * sizeof (short) / sizeof (int) +     0,
+       18 +   768 * sizeof (short) / sizeof (int) +    16,
+       18 +   768 * sizeof (short) / sizeof (int) +    32,
+       18 +   768 * sizeof (short) / sizeof (int) +    48,
+       18 +   768 * sizeof (short) / sizeof (int) +    64,
+       18 +   768 * sizeof (short) / sizeof (int) +    80,
+       18 +   768 * sizeof (short) / sizeof (int) +    96,
+       18 +   768 * sizeof (short) / sizeof (int) +   112,
+       18 +   768 * sizeof (short) / sizeof (int) +   128,
+       18 +   768 * sizeof (short) / sizeof (int) +   144,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   176,
+       18 +   768 * sizeof (short) / sizeof (int) +   192,
+       18 +   768 * sizeof (short) / sizeof (int) +   208,
+       18 +   768 * sizeof (short) / sizeof (int) +   224,
+       18 +   768 * sizeof (short) / sizeof (int) +   240,
+       18 +   768 * sizeof (short) / sizeof (int) +   256,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   272,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   288,
+       18 +   768 * sizeof (short) / sizeof (int) +   304,
+       18 +   768 * sizeof (short) / sizeof (int) +   320,
+       18 +   768 * sizeof (short) / sizeof (int) +   336,
+       18 +   768 * sizeof (short) / sizeof (int) +   352,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   368,
+       18 +   768 * sizeof (short) / sizeof (int) +   384,
+       18 +   768 * sizeof (short) / sizeof (int) +   400,
+       18 +   768 * sizeof (short) / sizeof (int) +   416,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   432,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   448,
+       18 +   768 * sizeof (short) / sizeof (int) +   464,
+       18 +   768 * sizeof (short) / sizeof (int) +   480,
+       18 +   768 * sizeof (short) / sizeof (int) +   496,
+       18 +   768 * sizeof (short) / sizeof (int) +   512,
+       18 +   768 * sizeof (short) / sizeof (int) +   528,
+       18 +   768 * sizeof (short) / sizeof (int) +   544,
+       18 +   768 * sizeof (short) / sizeof (int) +   560,
+       18 +   768 * sizeof (short) / sizeof (int) +   576,
+       18 +   768 * sizeof (short) / sizeof (int) +   592,
+       18 +   768 * sizeof (short) / sizeof (int) +   608,
+       18 +   768 * sizeof (short) / sizeof (int) +   624,
+       18 +   768 * sizeof (short) / sizeof (int) +   640,
+       18 +   768 * sizeof (short) / sizeof (int) +   656,
+       18 +   768 * sizeof (short) / sizeof (int) +   672,
+       18 +   768 * sizeof (short) / sizeof (int) +   688,
+       18 +   768 * sizeof (short) / sizeof (int) +   704,
+       18 +   768 * sizeof (short) / sizeof (int) +   720,
+       18 +   768 * sizeof (short) / sizeof (int) +   736,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   752,
+       18 +   768 * sizeof (short) / sizeof (int) +   768,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   784,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   800,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   816,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   832,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   848,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   864,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   880,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   896,
+       18 +   768 * sizeof (short) / sizeof (int) +   912,
+       18 +   768 * sizeof (short) / sizeof (int) +   928,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   944,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   960,
+       18 +   768 * sizeof (short) / sizeof (int) +   976,
+       18 +   768 * sizeof (short) / sizeof (int) +   992,
+       18 +   768 * sizeof (short) / sizeof (int) +  1008,
+       18 +   768 * sizeof (short) / sizeof (int) +  1024,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1040,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +  1056,
+       18 +   768 * sizeof (short) / sizeof (int) +  1072,
+       18 +   768 * sizeof (short) / sizeof (int) +  1088,
+       18 +   768 * sizeof (short) / sizeof (int) +  1104,
+       18 +   768 * sizeof (short) / sizeof (int) +  1120,
+       18 +   768 * sizeof (short) / sizeof (int) +  1136,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +  1152,
+       18 +   768 * sizeof (short) / sizeof (int) +  1168,
+       18 +   768 * sizeof (short) / sizeof (int) +  1184,
+       18 +   768 * sizeof (short) / sizeof (int) +  1200,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1216,
+       18 +   768 * sizeof (short) / sizeof (int) +  1232,
+       18 +   768 * sizeof (short) / sizeof (int) +  1248,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1264,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1280,
+       18 +   768 * sizeof (short) / sizeof (int) +  1296,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1312,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1328,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1344,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1360,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1376,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +  1392,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1408
+  },
+  {
+    0x00000000U, 0xFFFFFFFEU, 0xFFFFFFFFU, 0x7FFFFFFFU,
+    0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFCFFFFFFU,
+    0xFFFFD7F0U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFEFFFFU, 0xFE7FFFFFU, 0xFFFFFFFFU,
+    0xFFFEE7FFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0x001F87FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFBFFFU, 0xFFFFFFFFU, 0xFFFFE7FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0003FFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU,
+    0xFFFFFFFFU, 0x7FFF3FFFU, 0x4FFFFFFFU, 0xFFFF07FFU,
+    0xFF037FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFF99FEFU, 0xF3C5FDFFU, 0xB080799FU, 0x7FFFFFCFU,
+    0xFFF987EEU, 0xD36DFDFFU, 0x5E023987U, 0x007FFFC0U,
+    0xFFFBBFEEU, 0xF3EDFDFFU, 0x00013BBFU, 0xFE03FFCFU,
+    0xFFF99FEEU, 0xF3EDFDFFU, 0xB0E0399FU, 0x00FFFFCFU,
+    0xD63DC7ECU, 0xC3FFC718U, 0x00813DC7U, 0x07FFFFC0U,
+    0xFFFDDFFFU, 0xF3FFFDFFU, 0x27603DDFU, 0xFF80FFCFU,
+    0xFFFDDFFFU, 0xF3EFFDFFU, 0x60603DDFU, 0x000EFFCFU,
+    0xFFFDDFFFU, 0xFFFFFFFFU, 0xFFF0FDDFU, 0xFFFFFFCFU,
+    0xFC7FFFEEU, 0x2FFBFFFFU, 0xFF5F847FU, 0x001CFFC0U,
+    0xFFFFFFFEU, 0x87FFFFFFU, 0x0FFFFFFFU, 0x00000000U,
+    0xFFFFF7D6U, 0x3FFFFFAFU, 0xF3FF7F5FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFEFFU, 0xFFFE1FFFU,
+    0xFEFFFFFFU, 0xDFFFFFFFU, 0x07FFDFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU,
+    0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU,
+    0xFF3DFFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU, 0x1FFFFFFFU,
+    0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x1FFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0x803FFFFFU, 0x007FFFFFU, 0x000FFFFFU, 0x000DDFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x03FF03FFU,
+    0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, 0x003FFFFFU,
+    0x7FFFFFFFU, 0x0FFF0FFFU, 0xFFFFFFF1U, 0x001F3FFFU,
+    0xFFFFFFFFU, 0xFFFF0FFFU, 0xC7FF03FFU, 0xFFFFFFFFU,
+    0xCFFFFFFFU, 0xFFFFFFFFU, 0x7FFFFFFFU, 0x9FFFFFFFU,
+    0x03FF03FFU, 0xFFFF3FFFU, 0x00007FFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF1FFFU, 0x7FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF00FFFFFU,
+    0xFFFFFFFFU, 0xF8FFFFFFU, 0xFFFFE3FFU, 0xFFFFFFFFU,
+    0xFFFF01FFU, 0xE7FFFFFFU, 0xFFFF00FFU, 0x07FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU,
+    0xFFFFFFFFU, 0xFFDFFFFFU, 0xEFCFFFDFU, 0x7FDCFFFFU,
+    0xFFFFF880U, 0xFFFFFCFFU, 0x7FFFFFFFU, 0xFFF3FFDFU,
+    0x1FFF7FFFU, 0xFFFFFFFFU, 0xFFFF0001U, 0x0001FFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0000007FU, 0x000007FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFCFFFFFU,
+    0xFFBFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFE0FFFFFU,
+    0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x800180FFU,
+    0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
+    0xFBFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x0FFF0000U,
+    0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU,
+    0xFE7FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFF7FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF000FU,
+    0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFF1FFFU, 0xFFFFFFFFU, 0xFFFF007FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00000FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03EB07FFU, 0xFFFC0000U,
+    0xFFFFFFFFU, 0x03FF1FFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFC03FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x800FFFFFU, 0x1FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FFBFFFU, 0x7FFFFFFFU,
+    0xFFFFFFFFU, 0x007FFFFFU, 0xF3FF3FFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xF8000007U, 0x007FFFFFU,
+    0x007E7E7EU, 0xFFFF7F7FU, 0xFFFFFFFFU, 0xFFFF0FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF3FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U,
+    0xE0F8007FU, 0x5F7FFFFFU, 0xFFFFFFDBU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFF80007U, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFCFFFFU, 0xFFFFFFFFU, 0x000080FFU, 0xFFFF0000U,
+    0x03FFFFFFU, 0xFFFFFFFFU, 0xFFF7FFFFU, 0xFFDF0F7FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x9FFFFFFFU,
+    0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x3E007F7FU,
+    0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
+    0xFFFFFF87U, 0xFF8FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x1FFF7FFFU, 0x00000001U, 0xFFFF0000U, 0x3FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x0FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFE00FU, 0xFFFF07FFU, 0x07FFFFFFU,
+    0xBFFFFFFFU, 0xFFFFFFFFU, 0x003FFF0FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF800FU,
+    0xFFB7F7FFU, 0x1BFBFFFBU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU,
+    0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFD3FU, 0x91BFFFFFU, 0xFFBFFFFFU, 0xFFFFFFFFU,
+    0x7FFFFFFFU, 0x0000FF80U, 0x00000000U, 0xF837FFFFU,
+    0x8FFFFFFFU, 0x83FFFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xF0FFFFFFU, 0xFFFCFFFFU, 0xFFFFFFFFU,
+    0xFEEFF06FU, 0x873FFFFFU, 0x01FF01FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00000000U, 0xFFFFFFFFU, 0x007FF87FU,
+    0xFFFFFFFFU, 0xFE3FFFFFU, 0xFF3FFFFFU, 0xFF07FFFFU,
+    0x1E03FFFFU, 0x0000FE00U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U,
+    0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0xFC07FFFFU,
+    0xFFFFFFFFU, 0x03FF00FFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x7FFFFFFFU,
+    0xFFFFFFFFU, 0x00033BFFU, 0x00000000U, 0xE0000000U,
+    0xFFFFFFFFU, 0xFFFF00FFU, 0x03FFFFFFU, 0xFFFF0000U,
+    0x000003FFU, 0xFFFF0000U, 0x00000FFFU, 0x007FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFC3FFFU, 0x803FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF2007U, 0x03FF01FFU,
+    0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFF00FFU, 0x007FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001FFFFEU,
+    0xFFFBFFFFU, 0xFFFFFFFFU, 0x00000003U, 0x00000000U,
+    0xBFFFBD7FU, 0xFFFF03FFU, 0xFFFFFFFFU, 0x03FF07FFU,
+    0xFFF99FEFU, 0xFBEDFDFFU, 0xE081399FU, 0x001F1FCFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xEFFFFFFFU, 0x00000003U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFF3FFFFFU, 0x3FFFFFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF001FU, 0x00001FFFU,
+    0xFFFFFFFFU, 0x03FFFFFFU, 0x000003FFU, 0x00000000U,
+    0xE7FFFFFFU, 0xFFFF0FFFU, 0x0000007FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x0FFFFFFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x8007FFFFU,
+    0xFF6FF27FU, 0xF9BFFFFFU, 0x03FF007FU, 0x00000000U,
+    0x00000000U, 0xFFFFFCFFU, 0xFCFFFFFFU, 0x0000001FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF0007U, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0x000003FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFDFFU, 0xFF7FFFFFU, 0xFFFF003FU, 0xFFFF1FFFU,
+    0xFFFCFFFFU, 0x007FFEFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFB7FU, 0xB47FFFFFU, 0x03FF00FFU, 0xFFFFFDBFU,
+    0x01FB7FFFU, 0x000003FFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x01FFFFFFU,
+    0xFFFDFFFFU, 0xC7FFFFFFU, 0x03FFFFFFU, 0x00000000U,
+    0x00000000U, 0x00010000U, 0xFFFFFFFFU, 0x8003FFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001F7FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFFC3FFU,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x003F3FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFBFF003FU, 0xE0FFFFFBU,
+    0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x07FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF87FFU, 0xFFFFFFFFU,
+    0xFFFF80FFU, 0x00000000U, 0x00000000U, 0x0003001FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U,
+    0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
+    0xF3FF01FFU, 0x0000000FU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
+    0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
+    0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFF3FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFCFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xF9FFFF7FU, 0xFFFF07DBU, 0xFFFFFFFFU, 0x00003FFFU,
+    0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x3FFF1FFFU, 0x0000C3FFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0x00007FFFU, 0xFFFFFFFFU, 0x83FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFF9FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FF0FFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U,
+    0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
+    0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00030000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00003FFFU, 0x00000000U, 0xFFFFFFC0U,
+    0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xF0FFFFFFU, 0x1FFF1FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF87FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU,
+    0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU,
+    0xFFFF00FFU, 0x00033FFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, 0x1FFF3FFFU,
+    0xFFFF01FFU, 0xBFFFFFFFU, 0x0FFFC03FU, 0x01FF01FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFF7FFFFU, 0xFFFFFFFFU, 0x000007FFU, 0x03FF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000001U,
+    0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U,
+    0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU
+  }
+};
deleted file mode 120000 (symlink)
index ce1bc23fc5218557cc9d49bbaa018aeecd7eb54f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_lower.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..76c67635df018a4ab0a1b521b1bfc2b545c6639b
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_lower table.  */
+#include "ctype_lower.h"
+
+bool
+uc_is_lower (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_lower, uc);
+}
deleted file mode 120000 (symlink)
index 8af6f4816b311a2a69b884f356d859551b206b10..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_lower.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c487a16922a8705b28ff08849993cac111ad6455
--- /dev/null
@@ -0,0 +1,371 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[2];
+    short level2[2 << 7];
+    unsigned int level3[18 << 4];
+  }
+u_is_lower =
+{
+  { 2 },
+  {
+        3 * sizeof (int) / sizeof (short) +     0,
+        3 * sizeof (int) / sizeof (short) +   128
+  },
+  {
+        3 +   256 * sizeof (short) / sizeof (int) +     0,
+        3 +   256 * sizeof (short) / sizeof (int) +    16,
+        3 +   256 * sizeof (short) / sizeof (int) +    32,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +    48,
+        3 +   256 * sizeof (short) / sizeof (int) +    64,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +    80,
+        3 +   256 * sizeof (short) / sizeof (int) +    96,
+        3 +   256 * sizeof (short) / sizeof (int) +   112,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   128,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   144,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   160,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   176,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   192,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   208,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   224,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   240,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   256,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   272,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0x00000000U, 0x00000000U, 0x00000000U, 0x07FFFFFEU,
+    0x00000000U, 0x00200000U, 0x80000000U, 0xFF7FFFFFU,
+    0xAAAAAAAAU, 0x54AAAAAAU, 0xAAAAA955U, 0xD4AAAAAAU,
+    0x46241129U, 0xA251212AU, 0xB5555B60U, 0xAA2CAAAAU,
+    0xAAAAAAAAU, 0x900AAAA8U, 0x1ADFAA85U, 0x20269F6BU,
+    0x60041F8DU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000020U, 0x388A0000U,
+    0x00000000U, 0xFFFEF000U, 0xAAE37FFFU, 0x092FAAAAU,
+    0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0xAAAAAAAAU,
+    0xAAAAA802U, 0xAAAAAAAAU, 0xAAAAD554U, 0xAAAAAAAAU,
+    0xAAAAAAAAU, 0x0000AAAAU, 0x00000000U, 0xFFFFFFFEU,
+    0x0000007FU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFF0000U, 0xE7FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x3F000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x22000000U,
+    0x00004000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU,
+    0x082AAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU,
+    0x003F00FFU, 0x00FF00FFU, 0x00AA003FU, 0x3FFF00FFU,
+    0x00FF00FFU, 0x400B00FFU, 0x00030008U, 0x00080023U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00004000U, 0xFFFF0000U,
+    0x00000010U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFF0000U, 0x000003FFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00481562U,
+    0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, 0x0008500AU,
+    0xFFFFFFFFU, 0x000020BFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xAAAAAAAAU, 0x00002AAAU,
+    0x0AAAAAAAU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xAAA8AAA8U, 0xAAAAAAAAU, 0x9400AAAAU,
+    0xAA9A10AAU, 0xAAA002AAU, 0x0282050AU, 0x00400000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00080000U, 0xFFFF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x07FFFFFEU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFFFF00U, 0x0000FFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFF000000U, 0x0FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFF800000U, 0x1BFBFFFBU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x0007FFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFFFFFCU, 0x0000000FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index 71ca594a5c7a830c38c51955f36b300f4b9294d9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_print.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5e73e42db5c859946059ff38f17e7804882dfe8b
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_print table.  */
+#include "ctype_print.h"
+
+bool
+uc_is_print (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_print, uc);
+}
deleted file mode 120000 (symlink)
index 18ecda4422e716ec0f4c709bc5f832586f0ceefd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_print.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7dce963ef5ec40da968bb5b7663b9b4b3ab9c74e
--- /dev/null
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[17];
+    short level2[6 << 7];
+    unsigned int level3[89 << 4];
+  }
+u_is_print =
+{
+  { 17 },
+  {
+       18 * sizeof (int) / sizeof (short) +     0,
+       18 * sizeof (int) / sizeof (short) +   128,
+       18 * sizeof (int) / sizeof (short) +   256,
+       18 * sizeof (int) / sizeof (short) +   384,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 * sizeof (int) / sizeof (short) +   512,
+       18 * sizeof (int) / sizeof (short) +   640,
+       18 * sizeof (int) / sizeof (short) +   640
+  },
+  {
+       18 +   768 * sizeof (short) / sizeof (int) +     0,
+       18 +   768 * sizeof (short) / sizeof (int) +    16,
+       18 +   768 * sizeof (short) / sizeof (int) +    32,
+       18 +   768 * sizeof (short) / sizeof (int) +    48,
+       18 +   768 * sizeof (short) / sizeof (int) +    64,
+       18 +   768 * sizeof (short) / sizeof (int) +    80,
+       18 +   768 * sizeof (short) / sizeof (int) +    96,
+       18 +   768 * sizeof (short) / sizeof (int) +   112,
+       18 +   768 * sizeof (short) / sizeof (int) +   128,
+       18 +   768 * sizeof (short) / sizeof (int) +   144,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   176,
+       18 +   768 * sizeof (short) / sizeof (int) +   192,
+       18 +   768 * sizeof (short) / sizeof (int) +   208,
+       18 +   768 * sizeof (short) / sizeof (int) +   224,
+       18 +   768 * sizeof (short) / sizeof (int) +   240,
+       18 +   768 * sizeof (short) / sizeof (int) +   256,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   272,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   288,
+       18 +   768 * sizeof (short) / sizeof (int) +   304,
+       18 +   768 * sizeof (short) / sizeof (int) +   320,
+       18 +   768 * sizeof (short) / sizeof (int) +   336,
+       18 +   768 * sizeof (short) / sizeof (int) +   352,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   368,
+       18 +   768 * sizeof (short) / sizeof (int) +   384,
+       18 +   768 * sizeof (short) / sizeof (int) +   400,
+       18 +   768 * sizeof (short) / sizeof (int) +   416,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   432,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   448,
+       18 +   768 * sizeof (short) / sizeof (int) +   464,
+       18 +   768 * sizeof (short) / sizeof (int) +   480,
+       18 +   768 * sizeof (short) / sizeof (int) +   496,
+       18 +   768 * sizeof (short) / sizeof (int) +   512,
+       18 +   768 * sizeof (short) / sizeof (int) +   528,
+       18 +   768 * sizeof (short) / sizeof (int) +   544,
+       18 +   768 * sizeof (short) / sizeof (int) +   560,
+       18 +   768 * sizeof (short) / sizeof (int) +   576,
+       18 +   768 * sizeof (short) / sizeof (int) +   592,
+       18 +   768 * sizeof (short) / sizeof (int) +   608,
+       18 +   768 * sizeof (short) / sizeof (int) +   624,
+       18 +   768 * sizeof (short) / sizeof (int) +   640,
+       18 +   768 * sizeof (short) / sizeof (int) +   656,
+       18 +   768 * sizeof (short) / sizeof (int) +   672,
+       18 +   768 * sizeof (short) / sizeof (int) +   688,
+       18 +   768 * sizeof (short) / sizeof (int) +   704,
+       18 +   768 * sizeof (short) / sizeof (int) +   720,
+       18 +   768 * sizeof (short) / sizeof (int) +   736,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   752,
+       18 +   768 * sizeof (short) / sizeof (int) +   768,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   784,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   800,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   816,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   832,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   848,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   864,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   880,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   896,
+       18 +   768 * sizeof (short) / sizeof (int) +   912,
+       18 +   768 * sizeof (short) / sizeof (int) +   928,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   944,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   960,
+       18 +   768 * sizeof (short) / sizeof (int) +   976,
+       18 +   768 * sizeof (short) / sizeof (int) +   992,
+       18 +   768 * sizeof (short) / sizeof (int) +  1008,
+       18 +   768 * sizeof (short) / sizeof (int) +  1024,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1040,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +  1056,
+       18 +   768 * sizeof (short) / sizeof (int) +  1072,
+       18 +   768 * sizeof (short) / sizeof (int) +  1088,
+       18 +   768 * sizeof (short) / sizeof (int) +  1104,
+       18 +   768 * sizeof (short) / sizeof (int) +  1120,
+       18 +   768 * sizeof (short) / sizeof (int) +  1136,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +  1152,
+       18 +   768 * sizeof (short) / sizeof (int) +  1168,
+       18 +   768 * sizeof (short) / sizeof (int) +  1184,
+       18 +   768 * sizeof (short) / sizeof (int) +  1200,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1216,
+       18 +   768 * sizeof (short) / sizeof (int) +  1232,
+       18 +   768 * sizeof (short) / sizeof (int) +  1248,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1264,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1280,
+       18 +   768 * sizeof (short) / sizeof (int) +  1296,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1312,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1328,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1344,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1360,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1376,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +  1392,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +   160,
+       18 +   768 * sizeof (short) / sizeof (int) +  1408
+  },
+  {
+    0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x7FFFFFFFU,
+    0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFCFFFFFFU,
+    0xFFFFD7F0U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFEFFFFU, 0xFE7FFFFFU, 0xFFFFFFFFU,
+    0xFFFEE7FFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0x001F87FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFBFFFU, 0xFFFFFFFFU, 0xFFFFE7FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0003FFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU,
+    0xFFFFFFFFU, 0x7FFF3FFFU, 0x4FFFFFFFU, 0xFFFF07FFU,
+    0xFF037FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFF99FEFU, 0xF3C5FDFFU, 0xB080799FU, 0x7FFFFFCFU,
+    0xFFF987EEU, 0xD36DFDFFU, 0x5E023987U, 0x007FFFC0U,
+    0xFFFBBFEEU, 0xF3EDFDFFU, 0x00013BBFU, 0xFE03FFCFU,
+    0xFFF99FEEU, 0xF3EDFDFFU, 0xB0E0399FU, 0x00FFFFCFU,
+    0xD63DC7ECU, 0xC3FFC718U, 0x00813DC7U, 0x07FFFFC0U,
+    0xFFFDDFFFU, 0xF3FFFDFFU, 0x27603DDFU, 0xFF80FFCFU,
+    0xFFFDDFFFU, 0xF3EFFDFFU, 0x60603DDFU, 0x000EFFCFU,
+    0xFFFDDFFFU, 0xFFFFFFFFU, 0xFFF0FDDFU, 0xFFFFFFCFU,
+    0xFC7FFFEEU, 0x2FFBFFFFU, 0xFF5F847FU, 0x001CFFC0U,
+    0xFFFFFFFEU, 0x87FFFFFFU, 0x0FFFFFFFU, 0x00000000U,
+    0xFFFFF7D6U, 0x3FFFFFAFU, 0xF3FF7F5FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFEFFU, 0xFFFE1FFFU,
+    0xFEFFFFFFU, 0xDFFFFFFFU, 0x07FFDFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU,
+    0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU,
+    0xFF3DFFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU, 0x1FFFFFFFU,
+    0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x1FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0x803FFFFFU, 0x007FFFFFU, 0x000FFFFFU, 0x000DDFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x03FF03FFU,
+    0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, 0x003FFFFFU,
+    0x7FFFFFFFU, 0x0FFF0FFFU, 0xFFFFFFF1U, 0x001F3FFFU,
+    0xFFFFFFFFU, 0xFFFF0FFFU, 0xC7FF03FFU, 0xFFFFFFFFU,
+    0xCFFFFFFFU, 0xFFFFFFFFU, 0x7FFFFFFFU, 0x9FFFFFFFU,
+    0x03FF03FFU, 0xFFFF3FFFU, 0x00007FFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF1FFFU, 0x7FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF00FFFFFU,
+    0xFFFFFFFFU, 0xF8FFFFFFU, 0xFFFFE3FFU, 0xFFFFFFFFU,
+    0xFFFF01FFU, 0xE7FFFFFFU, 0xFFFF00FFU, 0x07FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU,
+    0xFFFFFFFFU, 0xFFDFFFFFU, 0xEFCFFFDFU, 0x7FDCFFFFU,
+    0xFFFFFFFFU, 0xFFFFFCFFU, 0xFFFFFFFFU, 0xFFF3FFDFU,
+    0x1FFF7FFFU, 0xFFFFFFFFU, 0xFFFF0001U, 0x0001FFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0000007FU, 0x000007FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFCFFFFFU,
+    0xFFBFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFE0FFFFFU,
+    0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x800180FFU,
+    0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
+    0xFBFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x0FFF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU,
+    0xFE7FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFF7FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF000FU,
+    0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFF1FFFU, 0xFFFFFFFFU, 0xFFFF007FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00000FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03EB07FFU, 0xFFFC0000U,
+    0xFFFFFFFFU, 0x03FF1FFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFC03FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x800FFFFFU, 0x1FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FFBFFFU, 0x7FFFFFFFU,
+    0xFFFFFFFFU, 0x007FFFFFU, 0xF3FF3FFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xF8000007U, 0x007FFFFFU,
+    0x007E7E7EU, 0xFFFF7F7FU, 0xFFFFFFFFU, 0xFFFF0FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF3FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U,
+    0xE0F8007FU, 0x5F7FFFFFU, 0xFFFFFFDBU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFF80007U, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFCFFFFU, 0xFFFFFFFFU, 0x000080FFU, 0xFFFF0000U,
+    0x03FFFFFFU, 0xFFFFFFFFU, 0xFFF7FFFFU, 0xFFDF0F7FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x9FFFFFFFU,
+    0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x3E007F7FU,
+    0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
+    0xFFFFFF87U, 0xFF8FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x1FFF7FFFU, 0x00000001U, 0xFFFF0000U, 0x3FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x0FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFE00FU, 0xFFFF07FFU, 0x07FFFFFFU,
+    0xBFFFFFFFU, 0xFFFFFFFFU, 0x003FFF0FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF800FU,
+    0xFFB7F7FFU, 0x1BFBFFFBU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU,
+    0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFD3FU, 0x91BFFFFFU, 0xFFBFFFFFU, 0xFFFFFFFFU,
+    0x7FFFFFFFU, 0x0000FF80U, 0x00000000U, 0xF837FFFFU,
+    0x8FFFFFFFU, 0x83FFFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xF0FFFFFFU, 0xFFFCFFFFU, 0xFFFFFFFFU,
+    0xFEEFF06FU, 0x873FFFFFU, 0x01FF01FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00000000U, 0xFFFFFFFFU, 0x007FF87FU,
+    0xFFFFFFFFU, 0xFE3FFFFFU, 0xFF3FFFFFU, 0xFF07FFFFU,
+    0x1E03FFFFU, 0x0000FE00U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U,
+    0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0xFC07FFFFU,
+    0xFFFFFFFFU, 0x03FF00FFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x7FFFFFFFU,
+    0xFFFFFFFFU, 0x00033BFFU, 0x00000000U, 0xE0000000U,
+    0xFFFFFFFFU, 0xFFFF00FFU, 0x03FFFFFFU, 0xFFFF0000U,
+    0x000003FFU, 0xFFFF0000U, 0x00000FFFU, 0x007FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFC3FFFU, 0x803FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF2007U, 0x03FF01FFU,
+    0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFF00FFU, 0x007FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001FFFFEU,
+    0xFFFBFFFFU, 0xFFFFFFFFU, 0x00000003U, 0x00000000U,
+    0xBFFFBD7FU, 0xFFFF03FFU, 0xFFFFFFFFU, 0x03FF07FFU,
+    0xFFF99FEFU, 0xFBEDFDFFU, 0xE081399FU, 0x001F1FCFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xEFFFFFFFU, 0x00000003U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFF3FFFFFU, 0x3FFFFFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF001FU, 0x00001FFFU,
+    0xFFFFFFFFU, 0x03FFFFFFU, 0x000003FFU, 0x00000000U,
+    0xE7FFFFFFU, 0xFFFF0FFFU, 0x0000007FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x0FFFFFFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x8007FFFFU,
+    0xFF6FF27FU, 0xF9BFFFFFU, 0x03FF007FU, 0x00000000U,
+    0x00000000U, 0xFFFFFCFFU, 0xFCFFFFFFU, 0x0000001FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF0007U, 0xFFFFFFFFU, 0x01FFFFFFU,
+    0x000003FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFDFFU, 0xFF7FFFFFU, 0xFFFF003FU, 0xFFFF1FFFU,
+    0xFFFCFFFFU, 0x007FFEFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFB7FU, 0xB47FFFFFU, 0x03FF00FFU, 0xFFFFFDBFU,
+    0x01FB7FFFU, 0x000003FFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x01FFFFFFU,
+    0xFFFDFFFFU, 0xC7FFFFFFU, 0x03FFFFFFU, 0x00000000U,
+    0x00000000U, 0x00010000U, 0xFFFFFFFFU, 0x8003FFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001F7FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFFC3FFU,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x003F3FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFBFF003FU, 0xE0FFFFFBU,
+    0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x07FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF87FFU, 0xFFFFFFFFU,
+    0xFFFF80FFU, 0x00000000U, 0x00000000U, 0x0003001FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U,
+    0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
+    0xF3FF01FFU, 0x0000000FU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
+    0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
+    0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFF3FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFCFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xF9FFFF7FU, 0xFFFF07DBU, 0xFFFFFFFFU, 0x00003FFFU,
+    0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x3FFF1FFFU, 0x0000C3FFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0x00007FFFU, 0xFFFFFFFFU, 0x83FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFF9FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FF0FFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U,
+    0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
+    0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00030000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00003FFFU, 0x00000000U, 0xFFFFFFC0U,
+    0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xF0FFFFFFU, 0x1FFF1FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF87FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU,
+    0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU,
+    0xFFFF00FFU, 0x00033FFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, 0x1FFF3FFFU,
+    0xFFFF01FFU, 0xBFFFFFFFU, 0x0FFFC03FU, 0x01FF01FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFF7FFFFU, 0xFFFFFFFFU, 0x000007FFU, 0x03FF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000001U,
+    0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U,
+    0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU
+  }
+};
deleted file mode 120000 (symlink)
index 7dcd116889a0ce83c154720f26e4bd6fdf29a1d6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_punct.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3991feed31a67de35741cf75163c878d1fba9d74
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_punct table.  */
+#include "ctype_punct.h"
+
+bool
+uc_is_punct (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_punct, uc);
+}
deleted file mode 120000 (symlink)
index c40dfa6af176637d719862ef829eaf96214323bb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_punct.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..22f66f0139239620957cd9d3e82b0ce74e040101
--- /dev/null
@@ -0,0 +1,858 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[17];
+    short level2[4 << 7];
+    unsigned int level3[72 << 4];
+  }
+u_is_punct =
+{
+  { 17 },
+  {
+       18 * sizeof (int) / sizeof (short) +     0,
+       18 * sizeof (int) / sizeof (short) +   128,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 * sizeof (int) / sizeof (short) +   256,
+       18 * sizeof (int) / sizeof (short) +   384,
+       18 * sizeof (int) / sizeof (short) +   384
+  },
+  {
+       18 +   512 * sizeof (short) / sizeof (int) +     0,
+       18 +   512 * sizeof (short) / sizeof (int) +    16,
+       18 +   512 * sizeof (short) / sizeof (int) +    32,
+       18 +   512 * sizeof (short) / sizeof (int) +    48,
+       18 +   512 * sizeof (short) / sizeof (int) +    64,
+       18 +   512 * sizeof (short) / sizeof (int) +    80,
+       18 +   512 * sizeof (short) / sizeof (int) +    96,
+       18 +   512 * sizeof (short) / sizeof (int) +   112,
+       18 +   512 * sizeof (short) / sizeof (int) +   128,
+       18 +   512 * sizeof (short) / sizeof (int) +   144,
+       18 +   512 * sizeof (short) / sizeof (int) +   160,
+       18 +   512 * sizeof (short) / sizeof (int) +   176,
+       18 +   512 * sizeof (short) / sizeof (int) +   192,
+       18 +   512 * sizeof (short) / sizeof (int) +   208,
+       18 +   512 * sizeof (short) / sizeof (int) +   224,
+       18 +   512 * sizeof (short) / sizeof (int) +   240,
+       18 +   512 * sizeof (short) / sizeof (int) +   256,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   288,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   304,
+       18 +   512 * sizeof (short) / sizeof (int) +   320,
+       18 +   512 * sizeof (short) / sizeof (int) +   336,
+       18 +   512 * sizeof (short) / sizeof (int) +   352,
+       18 +   512 * sizeof (short) / sizeof (int) +   368,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   384,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   400,
+       18 +   512 * sizeof (short) / sizeof (int) +   416,
+       18 +   512 * sizeof (short) / sizeof (int) +   432,
+       18 +   512 * sizeof (short) / sizeof (int) +   448,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   464,
+       18 +   512 * sizeof (short) / sizeof (int) +   480,
+       18 +   512 * sizeof (short) / sizeof (int) +   496,
+       18 +   512 * sizeof (short) / sizeof (int) +   512,
+       18 +   512 * sizeof (short) / sizeof (int) +   528,
+       18 +   512 * sizeof (short) / sizeof (int) +   544,
+       18 +   512 * sizeof (short) / sizeof (int) +   560,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   576,
+       18 +   512 * sizeof (short) / sizeof (int) +   592,
+       18 +   512 * sizeof (short) / sizeof (int) +   608,
+       18 +   512 * sizeof (short) / sizeof (int) +   624,
+       18 +   512 * sizeof (short) / sizeof (int) +   640,
+       18 +   512 * sizeof (short) / sizeof (int) +   656,
+       18 +   512 * sizeof (short) / sizeof (int) +   672,
+       18 +   512 * sizeof (short) / sizeof (int) +   688,
+       18 +   512 * sizeof (short) / sizeof (int) +   704,
+       18 +   512 * sizeof (short) / sizeof (int) +   720,
+       18 +   512 * sizeof (short) / sizeof (int) +   736,
+       18 +   512 * sizeof (short) / sizeof (int) +   752,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   768,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   784,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   800,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   816,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   832,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   848,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   864,
+       18 +   512 * sizeof (short) / sizeof (int) +   880,
+       18 +   512 * sizeof (short) / sizeof (int) +   896,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   912,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   928,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   944,
+       18 +   512 * sizeof (short) / sizeof (int) +   960,
+       18 +   512 * sizeof (short) / sizeof (int) +   976,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   992,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +  1008,
+       18 +   512 * sizeof (short) / sizeof (int) +  1024,
+       18 +   512 * sizeof (short) / sizeof (int) +  1040,
+       18 +   512 * sizeof (short) / sizeof (int) +  1056,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +  1072,
+       18 +   512 * sizeof (short) / sizeof (int) +  1088,
+       18 +   512 * sizeof (short) / sizeof (int) +  1104,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +  1120,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +   272,
+       18 +   512 * sizeof (short) / sizeof (int) +  1136
+  },
+  {
+    0x00000000U, 0xFC00FFFEU, 0xF8000001U, 0x78000001U,
+    0x00000000U, 0xFBDFFBFFU, 0x00800000U, 0x00800000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFC003CU, 0xFFFFAFE0U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFDFU, 0x4020FFFFU,
+    0x000000B0U, 0x00000000U, 0x00000000U, 0x00400000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x000003FCU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFC000000U, 0x00000000U,
+    0xFFFEE600U, 0xFFFFFFFFU, 0x000000FFU, 0x00180000U,
+    0xFFFFFFFFU, 0x00000000U, 0xFFFFF800U, 0x00013C00U,
+    0x00000000U, 0x00000000U, 0xFFD00000U, 0x60003F9FU,
+    0x0002BFFFU, 0xFFFF0000U, 0x000007FFU, 0x00000000U,
+    0x00000000U, 0x0001FFC0U, 0x00000000U, 0xE3CFF800U,
+    0xFBC00000U, 0x7FFF3EEFU, 0x4E000000U, 0x00000000U,
+    0xFF030100U, 0x00000000U, 0xFFFFFC00U, 0xFFFFFFFFU,
+    0x0000000FU, 0xDC000000U, 0x00FEFFFFU, 0x0001003CU,
+    0x0000000EU, 0xD0000000U, 0x0080399FU, 0x6FFC000CU,
+    0x0000000EU, 0xD0000000U, 0x00023987U, 0x00630000U,
+    0x0000000EU, 0xD0000000U, 0x00003BBFU, 0xFC03000CU,
+    0x0000000EU, 0xD0000000U, 0x00E0399FU, 0x00FD000CU,
+    0x00000004U, 0xC0000000U, 0x00803DC7U, 0x07FF0000U,
+    0x0000001FU, 0xD0000000U, 0x00603DDFU, 0xFF80000CU,
+    0x0000001EU, 0xD0000000U, 0x00603DDFU, 0x0008000CU,
+    0x0000000FU, 0xD8000000U, 0x7F80BDDFU, 0x03FF000CU,
+    0x0000000EU, 0x00000000U, 0xFF5F8400U, 0x001C0000U,
+    0x00000000U, 0x80008000U, 0x0C008040U, 0x00000000U,
+    0x00000000U, 0x1FF20000U, 0x00007F00U, 0x00000000U,
+    0xFFFFFFFEU, 0xFFFFFC00U, 0x00000000U, 0xFFFE0000U,
+    0xFEFFE0FFU, 0xDFFFFFFFU, 0x07FFDFFFU, 0x00000000U,
+    0x00000000U, 0x7FFFF800U, 0xC3C0FC00U, 0x001E3F9DU,
+    0xFC00BFFCU, 0x00000000U, 0x00000000U, 0x08000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xE0000000U, 0x1FFFFFFFU,
+    0x03FF0000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00006000U,
+    0x18000000U, 0x00000000U, 0x00000000U, 0x00003800U,
+    0x003C0000U, 0x007C0000U, 0x000C0000U, 0x000C0000U,
+    0x00000000U, 0xFFF00000U, 0x2F7FFFFFU, 0x03FF0000U,
+    0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000060U, 0x00000200U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x0FFF0FFFU, 0x00000031U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xC4000000U, 0xFFFFFFFFU,
+    0xCF800000U, 0x00000000U, 0x7FE00000U, 0x9FFFFFFFU,
+    0x00000000U, 0xFFFF3F7FU, 0x00007FFFU, 0x00000000U,
+    0x0000001FU, 0xFFF00000U, 0xFC00001FU, 0x7FFFFFFFU,
+    0x00000007U, 0x00003FFEU, 0x00000000U, 0xF00FFFC0U,
+    0x00000000U, 0xF8FFFFF0U, 0x00000000U, 0xC0000000U,
+    0x00000000U, 0x00000000U, 0xFFFF00FFU, 0x039021FFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xA0000000U, 0xE000E003U, 0x6000E000U,
+    0xFFFFF880U, 0xFFFFFCFFU, 0x7FFFFFFFU, 0x7FF1FFDFU,
+    0x00007FFFU, 0xFFFFFFFFU, 0xFFFF0001U, 0x0001FFFFU,
+    0xC1D0037BU, 0x0C0040AFU, 0xFFFFBC1FU, 0x00000000U,
+    0xFFFF0E00U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0000007FU, 0x000007FFU, 0xFFFFFFFFU,
+    0x0FFFFFFFU, 0x00000000U, 0x00000000U, 0xFFFFFC00U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFCFFFFFU,
+    0xFFBFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xFE0387E0U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x80010000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFF7FFFU, 0x3FFFFFFFU, 0x00000000U,
+    0xFBFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x0FFF0000U,
+    0xFFFFFF1EU, 0xE0C1FC01U, 0x00000000U, 0x00000000U,
+    0x1E000000U, 0x00000001U, 0x00000000U, 0x08000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0x00000000U, 0xFFFFFFFFU, 0x0000000FU,
+    0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0xFFFFFFFFU, 0x0000007FU, 0xC0000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x0000E000U, 0x00000000U, 0x00000000U, 0x7FFF8000U,
+    0xC0000000U, 0x00000000U, 0x00000000U, 0x00FF0000U,
+    0x007FFFFFU, 0x00000003U, 0x00000000U, 0x00000000U,
+    0x00000600U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000844U, 0x03FF1FF8U, 0x00000000U, 0x00F00000U,
+    0x00000003U, 0xFFF00000U, 0x0000C03FU, 0x9703FFFFU,
+    0x00000000U, 0x0000FFC0U, 0x800FFF80U, 0x00000000U,
+    0x0000000FU, 0xFFF80000U, 0xC0003FFFU, 0x00000020U,
+    0x00000000U, 0x007FFE00U, 0xF0003008U, 0x3B800000U,
+    0x00000000U, 0xC19D0000U, 0xC0000002U, 0x0063F800U,
+    0x00000000U, 0x00000000U, 0x08000000U, 0x00000C00U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00003FF8U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x40000000U, 0x00000200U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFC0000U, 0x00000007U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xC0000000U, 0x0000FFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00008000U, 0xF0000000U,
+    0x03FFFFFFU, 0xFFFFFFFFU, 0xFFF7FFFFU, 0x00000F7FU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x80000000U,
+    0xFC00FFFEU, 0xF8000001U, 0xF8000001U, 0x0000003FU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x3E007F7FU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFF87U, 0xFF8FFFFFU, 0x00000000U, 0xFFE00000U,
+    0x1FFF7FFFU, 0x00000001U, 0xFFFF0000U, 0x3FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x0FFFFFFFU,
+    0x00000000U, 0x0000000FU, 0x00000000U, 0x07C00000U,
+    0x80000000U, 0x00000000U, 0x00010000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00008000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFF800000U, 0xFF800000U,
+    0x00000000U, 0x0000FF80U, 0x00000000U, 0xF8000000U,
+    0x8FC00000U, 0x80000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x30000000U, 0xFFFCFFFFU, 0xFFFFFFFFU,
+    0x0000F06EU, 0x87000000U, 0x01FF01FFU, 0xE0000000U,
+    0xE0000000U, 0x00000000U, 0x00000100U, 0x007FF860U,
+    0x00000000U, 0xFE000000U, 0xFF000000U, 0xFF000000U,
+    0x1E000000U, 0x0000FE00U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xFC000000U,
+    0x00000000U, 0x000000F0U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x7FFFFFFFU,
+    0x00000000U, 0x00003800U, 0x00000000U, 0xE0000000U,
+    0xE0000000U, 0x0000007FU, 0x03FFFFC0U, 0x00000000U,
+    0x000003FCU, 0x00000000U, 0x00000FE0U, 0x00000000U,
+    0x00000007U, 0xFF000000U, 0xFFFC3FFFU, 0x8019003FU,
+    0x00000007U, 0xFFFF0000U, 0x00002007U, 0x00000000U,
+    0x00000007U, 0x001FFF80U, 0x0000006FU, 0x00380000U,
+    0x00000007U, 0xFFF80000U, 0xE800FFE1U, 0x001FFFFEU,
+    0x00000000U, 0x7FFFF000U, 0x00000002U, 0x00000000U,
+    0x00000000U, 0x00000200U, 0x80000000U, 0x000007FFU,
+    0x0000000FU, 0xD8000000U, 0x0080399FU, 0x001F1FCCU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFE00000U, 0x6C00F87FU, 0x00000000U,
+    0x00000000U, 0xFFFF0000U, 0x0000004FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFF3F8000U, 0x30FFFFFFU, 0x00000000U,
+    0x00000000U, 0xFFFF0000U, 0x0000000FU, 0x00001FFFU,
+    0x00000000U, 0x02FFF800U, 0x00000000U, 0x00000000U,
+    0xE0000000U, 0xFC000FFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x0FFFF000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x0007FC00U,
+    0x00000000U, 0x79BF0000U, 0x0000007DU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFCFE0000U, 0x00000015U,
+    0x000007FEU, 0xFBF80000U, 0x0FFE00FFU, 0x00000000U,
+    0xDFFFFC00U, 0x00000007U, 0x00000000U, 0x00000000U,
+    0x000003FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFF7F8000U, 0xFC00003EU, 0x00031FFFU,
+    0xFFFC0000U, 0x007FFEFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xB47E0000U, 0x000000BFU, 0x00000000U,
+    0x00FB7C00U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x01F80000U,
+    0x0000000BU, 0xC7F00000U, 0x0000FFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x8003FFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x001F0000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00060000U,
+    0x00000000U, 0xFFFF0000U, 0x003FFF81U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x0000C000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x003F0000U,
+    0x00000000U, 0xFFFF0000U, 0xF8000030U, 0x00000003U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x07FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFE8000U, 0xFFFFFFFFU,
+    0x000780FFU, 0x00000000U, 0x00000000U, 0x00030014U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xF0000000U, 0x0000000FU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x08000002U, 0x08000000U,
+    0x00200000U, 0x00200000U, 0x00008000U, 0x00008000U,
+    0x00000200U, 0x00000200U, 0x00000008U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xF9FFFF7FU, 0x000007DBU, 0x00000000U, 0x00000000U,
+    0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x007F0000U, 0x00008000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00004000U, 0x00000000U, 0x8000F000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x0000F000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x007FFF80U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xC00007F0U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U,
+    0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00030000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU,
+    0x0000FFFFU, 0x0000E000U, 0x0000FC00U, 0x0000FC00U,
+    0xFFFFF800U, 0x00003FDFU, 0x00000000U, 0x00000000U,
+    0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xF0FFFFFFU, 0x1FFF1FFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF87FFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU,
+    0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU,
+    0xFFFF00FFU, 0x00033FFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, 0x1FFF3FFFU,
+    0xFFFF01FFU, 0xBFFFFFFFU, 0x0FFFC03FU, 0x01FF01FFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFF7FFFFU, 0xFFFFFFFFU, 0x000007FFU, 0x00000000U,
+    0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU
+  }
+};
deleted file mode 120000 (symlink)
index b624805b2e54b7f05a31a8400df594455bdf2411..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_space.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cdfe54d99aeea43f4c9db9ed0881e5ce9c831887
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_space table.  */
+#include "ctype_space.h"
+
+bool
+uc_is_space (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_space, uc);
+}
deleted file mode 120000 (symlink)
index c6f58f536c1e5724e676230b1d686fa75a86937a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_space.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..69521a5a0cbf1192c4c1184db5e649aaf8c7344f
--- /dev/null
@@ -0,0 +1,184 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[1];
+    short level2[1 << 7];
+    unsigned int level3[4 << 4];
+  }
+u_is_space =
+{
+  { 1 },
+  {     2 * sizeof (int) / sizeof (short) +     0 },
+  {
+        2 +   128 * sizeof (short) / sizeof (int) +     0,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        2 +   128 * sizeof (short) / sizeof (int) +    16,
+       -1,
+       -1,
+       -1,
+       -1,
+        2 +   128 * sizeof (short) / sizeof (int) +    32,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        2 +   128 * sizeof (short) / sizeof (int) +    48,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0x00003E00U, 0x00000001U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x0000077FU, 0x00000300U, 0x80000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index bcec578fd9deb8b16e95878d54b6c19fe70aa45a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_upper.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..02110cc6afbcd4fb5eb651aa0acf762ddcfacc92
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_upper table.  */
+#include "ctype_upper.h"
+
+bool
+uc_is_upper (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_upper, uc);
+}
deleted file mode 120000 (symlink)
index fee5abef6e761c9877caedb79351f2ce1bad281e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_upper.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dbe1da4d54d5fa8f7c7fa5adccd328135c17a5ec
--- /dev/null
@@ -0,0 +1,367 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[2];
+    short level2[2 << 7];
+    unsigned int level3[17 << 4];
+  }
+u_is_upper =
+{
+  { 2 },
+  {
+        3 * sizeof (int) / sizeof (short) +     0,
+        3 * sizeof (int) / sizeof (short) +   128
+  },
+  {
+        3 +   256 * sizeof (short) / sizeof (int) +     0,
+        3 +   256 * sizeof (short) / sizeof (int) +    16,
+        3 +   256 * sizeof (short) / sizeof (int) +    32,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +    48,
+        3 +   256 * sizeof (short) / sizeof (int) +    64,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +    80,
+        3 +   256 * sizeof (short) / sizeof (int) +    96,
+        3 +   256 * sizeof (short) / sizeof (int) +   112,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   128,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   144,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   160,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   176,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   192,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   208,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   224,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   240,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        3 +   256 * sizeof (short) / sizeof (int) +   256,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0x00000000U, 0x00000000U, 0x07FFFFFEU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x7F7FFFFFU, 0x00000000U,
+    0x55555555U, 0xAA555555U, 0x555554AAU, 0x2B555555U,
+    0xB1DBCED6U, 0x11AED2D5U, 0x4AAAADB0U, 0x55D65555U,
+    0x55555555U, 0x6C055555U, 0x0000557AU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x80450000U,
+    0xFFFED740U, 0x00000FFBU, 0x55008000U, 0xE6905555U,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x55555555U,
+    0x55555401U, 0x55555555U, 0x55552AABU, 0x55555555U,
+    0x55555555U, 0xFFFE5555U, 0x007FFFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFFFFFFU, 0x000020BFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0xE7FFFFFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x55555555U, 0x55555555U, 0x55555555U, 0x55555555U,
+    0x40155555U, 0x55555555U, 0x55555555U, 0x55555555U,
+    0x3F00FF00U, 0xFF00FF00U, 0xAA003F00U, 0x0000FF00U,
+    0xFF00FF00U, 0x1F00FF00U, 0x0F001F00U, 0x1F001F00U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00040C40U, 0x00000000U, 0x0000FFFFU,
+    0x00000008U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFC00000U, 0x0000FFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0xC025EA9DU,
+    0x55555555U, 0x55555555U, 0x55555555U, 0x00042805U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x55555555U, 0x00001555U,
+    0x05555555U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x55545554U, 0x55555555U, 0x6A005555U,
+    0x55452855U, 0x555F7D55U, 0x014102F5U, 0x00200000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x07FFFFFEU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x000000FFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFF0000U, 0x000FFFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0xF7FF0000U,
+    0x0037F7FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x0007FFFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0x00000003U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index 6b262c8f7b88b8f2ae5828594551062d00ac557c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_xdigit.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1e5a162704dfa45391cd1d7d6880be77553d8a37
--- /dev/null
@@ -0,0 +1,32 @@
+/* ISO C <ctype.h> like properties of Unicode characters.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unictype.h"
+
+#include "bitmap.h"
+
+/* Define u_is_xdigit table.  */
+#include "ctype_xdigit.h"
+
+bool
+uc_is_xdigit (ucs4_t uc)
+{
+  return bitmap_lookup (&u_is_xdigit, uc);
+}
deleted file mode 120000 (symlink)
index 8ccec33a82cecacf382c37456dde07f388db508c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unictype/ctype_xdigit.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1438f94f8bfaf5117e7c202b238a5a5cc47d46d5
--- /dev/null
@@ -0,0 +1,172 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* ISO C <ctype.h> like properties of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[1];
+    short level2[1 << 7];
+    unsigned int level3[1 << 4];
+  }
+u_is_xdigit =
+{
+  { 1 },
+  {     2 * sizeof (int) / sizeof (short) +     0 },
+  {
+        2 +   128 * sizeof (short) / sizeof (int) +     0,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1
+  },
+  {
+    0x00000000U, 0x03FF0000U, 0x0000007EU, 0x0000007EU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index 89ec711487770f869846651885f3aef3bfd6ac64..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/uninorm.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a7f6ec3a767e815fec7b3220781738b6b09da68b
--- /dev/null
@@ -0,0 +1,255 @@
+/* Normalization forms (composition and decomposition) of Unicode strings.
+   Copyright (C) 2001-2002, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _UNINORM_H
+#define _UNINORM_H
+
+/* Get size_t.  */
+#include <stddef.h>
+
+#include "unitypes.h"
+
+#if @HAVE_UNISTRING_WOE32DLL_H@
+# include <unistring/woe32dll.h>
+#else
+# define LIBUNISTRING_DLL_VARIABLE
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Conventions:
+
+   All functions prefixed with u8_ operate on UTF-8 encoded strings.
+   Their unit is an uint8_t (1 byte).
+
+   All functions prefixed with u16_ operate on UTF-16 encoded strings.
+   Their unit is an uint16_t (a 2-byte word).
+
+   All functions prefixed with u32_ operate on UCS-4 encoded strings.
+   Their unit is an uint32_t (a 4-byte word).
+
+   All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly
+   n units.
+
+   Functions returning a string result take a (resultbuf, lengthp) argument
+   pair.  If resultbuf is not NULL and the result fits into *lengthp units,
+   it is put in resultbuf, and resultbuf is returned.  Otherwise, a freshly
+   allocated string is returned.  In both cases, *lengthp is set to the
+   length (number of units) of the returned string.  In case of error,
+   NULL is returned and errno is set.  */
+
+
+enum
+{
+  UC_DECOMP_CANONICAL,/*            Canonical decomposition.                  */
+  UC_DECOMP_FONT,    /*   <font>    A font variant (e.g. a blackletter form). */
+  UC_DECOMP_NOBREAK, /* <noBreak>   A no-break version of a space or hyphen.  */
+  UC_DECOMP_INITIAL, /* <initial>   An initial presentation form (Arabic).    */
+  UC_DECOMP_MEDIAL,  /*  <medial>   A medial presentation form (Arabic).      */
+  UC_DECOMP_FINAL,   /*  <final>    A final presentation form (Arabic).       */
+  UC_DECOMP_ISOLATED,/* <isolated>  An isolated presentation form (Arabic).   */
+  UC_DECOMP_CIRCLE,  /*  <circle>   An encircled form.                        */
+  UC_DECOMP_SUPER,   /*  <super>    A superscript form.                       */
+  UC_DECOMP_SUB,     /*   <sub>     A subscript form.                         */
+  UC_DECOMP_VERTICAL,/* <vertical>  A vertical layout presentation form.      */
+  UC_DECOMP_WIDE,    /*   <wide>    A wide (or zenkaku) compatibility character. */
+  UC_DECOMP_NARROW,  /*  <narrow>   A narrow (or hankaku) compatibility character. */
+  UC_DECOMP_SMALL,   /*  <small>    A small variant form (CNS compatibility). */
+  UC_DECOMP_SQUARE,  /*  <square>   A CJK squared font variant.               */
+  UC_DECOMP_FRACTION,/* <fraction>  A vulgar fraction form.                   */
+  UC_DECOMP_COMPAT   /*  <compat>   Otherwise unspecified compatibility character. */
+};
+
+/* Maximum size of decomposition of a single Unicode character.  */
+#define UC_DECOMPOSITION_MAX_LENGTH 32
+
+/* Return the character decomposition mapping of a Unicode character.
+   DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH
+   ucs_t elements.
+   When a decomposition exists, DECOMPOSITION[0..N-1] and *DECOMP_TAG are
+   filled and N is returned.  Otherwise -1 is returned.  */
+extern int
+       uc_decomposition (ucs4_t uc, int *decomp_tag, ucs4_t *decomposition);
+
+/* Return the canonical character decomposition mapping of a Unicode character.
+   DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH
+   ucs_t elements.
+   When a decomposition exists, DECOMPOSITION[0..N-1] is filled and N is
+   returned.  Otherwise -1 is returned.  */
+extern int
+       uc_canonical_decomposition (ucs4_t uc, ucs4_t *decomposition);
+
+
+/* Attempt to combine the Unicode characters uc1, uc2.
+   uc1 is known to have canonical combining class 0.
+   Return the combination of uc1 and uc2, if it exists.
+   Return 0 otherwise.
+   Not all decompositions can be recombined using this function.  See the
+   Unicode file CompositionExclusions.txt for details.  */
+extern ucs4_t
+       uc_composition (ucs4_t uc1, ucs4_t uc2)
+       _UC_ATTRIBUTE_CONST;
+
+
+/* An object of type uninorm_t denotes a Unicode normalization form.  */
+struct unicode_normalization_form;
+typedef const struct unicode_normalization_form *uninorm_t;
+
+/* UNINORM_NFD: Normalization form D: canonical decomposition.  */
+extern @GNULIB_UNINORM_NFD_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfd;
+#define UNINORM_NFD (&uninorm_nfd)
+
+/* UNINORM_NFC: Normalization form C: canonical decomposition, then
+   canonical composition.  */
+extern @GNULIB_UNINORM_NFC_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfc;
+#define UNINORM_NFC (&uninorm_nfc)
+
+/* UNINORM_NFKD: Normalization form KD: compatibility decomposition.  */
+extern @GNULIB_UNINORM_NFKD_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfkd;
+#define UNINORM_NFKD (&uninorm_nfkd)
+
+/* UNINORM_NFKC: Normalization form KC: compatibility decomposition, then
+   canonical composition.  */
+extern @GNULIB_UNINORM_NFKC_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfkc;
+#define UNINORM_NFKC (&uninorm_nfkc)
+
+/* Test whether a normalization form does compatibility decomposition.  */
+#define uninorm_is_compat_decomposing(nf) \
+  ((* (const unsigned int *) (nf) >> 0) & 1)
+
+/* Test whether a normalization form includes canonical composition.  */
+#define uninorm_is_composing(nf) \
+  ((* (const unsigned int *) (nf) >> 1) & 1)
+
+/* Return the decomposing variant of a normalization form.
+   This maps NFC,NFD -> NFD and NFKC,NFKD -> NFKD.  */
+extern uninorm_t
+       uninorm_decomposing_form (uninorm_t nf)
+       _UC_ATTRIBUTE_PURE;
+
+
+/* Return the specified normalization form of a string.  */
+extern uint8_t *
+       u8_normalize (uninorm_t nf, const uint8_t *s, size_t n,
+                     uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint16_t *
+       u16_normalize (uninorm_t nf, const uint16_t *s, size_t n,
+                      uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+extern uint32_t *
+       u32_normalize (uninorm_t nf, const uint32_t *s, size_t n,
+                      uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
+
+
+/* Compare S1 and S2, ignoring differences in normalization.
+   NF must be either UNINORM_NFD or UNINORM_NFKD.
+   If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
+   return 0.  Upon failure, return -1 with errno set.  */
+extern int
+       u8_normcmp (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2,
+                   uninorm_t nf, int *resultp);
+extern int
+       u16_normcmp (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2,
+                    uninorm_t nf, int *resultp);
+extern int
+       u32_normcmp (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2,
+                    uninorm_t nf, int *resultp);
+
+
+/* Converts the string S of length N to a NUL-terminated byte sequence, in such
+   a way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with uN_cmp2() is
+   equivalent to comparing S1 and S2 with uN_normcoll().
+   NF must be either UNINORM_NFC or UNINORM_NFKC.  */
+extern char *
+       u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf,
+                    char *resultbuf, size_t *lengthp);
+extern char *
+       u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf,
+                     char *resultbuf, size_t *lengthp);
+extern char *
+       u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf,
+                     char *resultbuf, size_t *lengthp);
+
+
+/* Compare S1 and S2, ignoring differences in normalization, using the
+   collation rules of the current locale.
+   NF must be either UNINORM_NFC or UNINORM_NFKC.
+   If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
+   return 0.  Upon failure, return -1 with errno set.  */
+extern int
+       u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2,
+                    uninorm_t nf, int *resultp);
+extern int
+       u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2,
+                     uninorm_t nf, int *resultp);
+extern int
+       u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2,
+                     uninorm_t nf, int *resultp);
+
+
+/* Normalization of a stream of Unicode characters.
+
+   A "stream of Unicode characters" is essentially a function that accepts an
+   ucs4_t argument repeatedly, optionally combined with a function that
+   "flushes" the stream.  */
+
+/* Data type of a stream of Unicode characters that normalizes its input
+   according to a given normalization form and passes the normalized character
+   sequence to the encapsulated stream of Unicode characters.  */
+struct uninorm_filter;
+
+/* Bring data buffered in the filter to its destination, the encapsulated
+   stream, then close and free the filter.
+   Return 0 if successful, or -1 with errno set upon failure.  */
+extern int
+       uninorm_filter_free (struct uninorm_filter *filter);
+
+/* Create and return a normalization filter for Unicode characters.
+   The pair (stream_func, stream_data) is the encapsulated stream.
+   stream_func (stream_data, uc) receives the Unicode character uc
+   and returns 0 if successful, or -1 with errno set upon failure.
+   Return the new filter, or NULL with errno set upon failure.  */
+extern struct uninorm_filter *
+       uninorm_filter_create (uninorm_t nf,
+                              int (*stream_func) (void *stream_data, ucs4_t uc),
+                              void *stream_data)
+       _GL_ATTRIBUTE_DEALLOC (uninorm_filter_free, 1);
+
+/* Stuff a Unicode character into a normalizing filter.
+   Return 0 if successful, or -1 with errno set upon failure.  */
+extern int
+       uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc);
+
+/* Bring data buffered in the filter to its destination, the encapsulated
+   stream.
+   Return 0 if successful, or -1 with errno set upon failure.
+   Note! If after calling this function, additional characters are written
+   into the filter, the resulting character sequence in the encapsulated stream
+   will not necessarily be normalized.  */
+extern int
+       uninorm_filter_flush (struct uninorm_filter *filter);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _UNINORM_H */
deleted file mode 120000 (symlink)
index 16e1149dc42bf7666b048fa546ae4d0162183194..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistd--.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4c555d49230c11d4809080c374c00331b6403fda
--- /dev/null
@@ -0,0 +1,32 @@
+/* Like unistd.h, but redefine some names to avoid glitches.
+
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <unistd.h>
+#include "unistd-safer.h"
+
+#undef dup
+#define dup dup_safer
+
+#undef pipe
+#define pipe pipe_safer
+
+#if GNULIB_PIPE2_SAFER
+# undef pipe2
+# define pipe2 pipe2_safer
+#endif
deleted file mode 120000 (symlink)
index e3389fa3e78a19acfbf89229188d28ce61efc331..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistd-safer.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c1179267061cc9bc839ee8db7aeb6a9768975953
--- /dev/null
@@ -0,0 +1,31 @@
+/* Invoke unistd-like functions, but avoid some glitches.
+
+   Copyright (C) 2001, 2003, 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Eric Blake.  */
+
+int dup_safer (int);
+int fd_safer (int);
+int pipe_safer (int[2]);
+
+#if GNULIB_FD_SAFER_FLAG
+int dup_safer_flag (int, int);
+int fd_safer_flag (int, int);
+#endif
+
+#if GNULIB_PIPE2_SAFER
+int pipe2_safer (int[2], int);
+#endif
deleted file mode 120000 (symlink)
index c0517594dae82f102d409ddf9b011c285d02fe19..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f3b3f7bd2fe7ebbe5660d2d1266b7701ceb17aaa
--- /dev/null
@@ -0,0 +1,22 @@
+/* Inline functions for <unistd.h>.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
+#include <unistd.h>
+typedef int dummy;
deleted file mode 120000 (symlink)
index 6044c7225ccb3339168c63f9ef373a9b36e97286..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistd.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b412966367d40c04b139816bbcd509cf5f2c5e29
--- /dev/null
+/* Substitute for and wrapper around <unistd.h>.
+   Copyright (C) 2003-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_UNISTD_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if @HAVE_UNISTD_H@ && defined _GL_INCLUDING_UNISTD_H
+/* Special invocation convention:
+   - On Mac OS X 10.3.9 we have a sequence of nested includes
+     <unistd.h> -> <signal.h> -> <pthread.h> -> <unistd.h>
+     In this situation, the functions are not yet declared, therefore we cannot
+     provide the C++ aliases.  */
+
+#@INCLUDE_NEXT@ @NEXT_UNISTD_H@
+
+#else
+/* Normal invocation convention.  */
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_UNISTD_H@
+# define _GL_INCLUDING_UNISTD_H
+# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
+# undef _GL_INCLUDING_UNISTD_H
+#endif
+
+/* Avoid lseek bugs in FreeBSD, macOS <https://bugs.gnu.org/61386>.
+   This bug is fixed after FreeBSD 13; see <https://bugs.freebsd.org/256205>.
+   Use macOS "9999" to stand for a future fixed macOS version.  */
+#if defined __FreeBSD__ && __FreeBSD__ < 14
+# undef SEEK_DATA
+# undef SEEK_HOLE
+#elif defined __APPLE__ && defined __MACH__ && defined SEEK_DATA
+# ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+#  include <AvailabilityMacros.h>
+# endif
+# if (!defined MAC_OS_X_VERSION_MIN_REQUIRED \
+      || MAC_OS_X_VERSION_MIN_REQUIRED < 99990000)
+#  include <sys/fcntl.h> /* It also defines the two macros.  */
+#  undef SEEK_DATA
+#  undef SEEK_HOLE
+# endif
+#endif
+
+/* Get all possible declarations of gethostname().  */
+#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
+  && !defined _GL_INCLUDING_WINSOCK2_H
+# define _GL_INCLUDING_WINSOCK2_H
+# include <winsock2.h>
+# undef _GL_INCLUDING_WINSOCK2_H
+#endif
+
+#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
+#define _@GUARD_PREFIX@_UNISTD_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK,
+   HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* NetBSD 5.0 mis-defines NULL.  Also get size_t.  */
+/* But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+#endif
+
+/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>.  */
+/* MSVC declares 'unlink' in <stdio.h>, not in <unistd.h>.  We must include
+   it before we  #define unlink rpl_unlink.  */
+/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
+     || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \
+         && (defined _WIN32 && ! defined __CYGWIN__)) \
+     || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
+         && defined __CYGWIN__)) \
+    && ! defined __GLIBC__
+# include <stdio.h>
+#endif
+
+/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
+   <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
+    && (defined __CYGWIN__ || defined __ANDROID__) \
+    && ! defined __GLIBC__
+# include <fcntl.h>
+#endif
+
+/* mingw fails to declare _exit in <unistd.h>.  */
+/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
+   <unistd.h>.  */
+/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
+/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
+   included here.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if !defined __GLIBC__ && !defined __osf__
+# define __need_system_stdlib_h
+# include <stdlib.h>
+# undef __need_system_stdlib_h
+#endif
+
+/* Native Windows platforms declare _chdir, _getcwd, _rmdir in
+   <io.h> and/or <direct.h>, not in <unistd.h>.
+   They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
+   _lseek(), _read(), _unlink(), _write() in <io.h>.  */
+#if defined _WIN32 && !defined __CYGWIN__
+# include <io.h>
+# include <direct.h>
+#endif
+
+/* Native Windows platforms declare _execl*, _execv* in <process.h>.  */
+#if defined _WIN32 && !defined __CYGWIN__
+# include <process.h>
+#endif
+
+/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
+   NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
+     || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
+    && !defined __GLIBC__
+# include <netdb.h>
+#endif
+
+/* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in
+   <sys/random.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \
+    && ((defined __APPLE__ && defined __MACH__) || defined __sun \
+        || defined __ANDROID__) \
+    && @UNISTD_H_HAVE_SYS_RANDOM_H@ \
+    && !defined __GLIBC__
+# include <sys/random.h>
+#endif
+
+/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+    && !defined __GLIBC__
+# include <sys/stat.h>
+#endif
+
+/* MSVC defines off_t in <sys/types.h>.
+   May also define off_t to a 64-bit type on native Windows.  */
+/* Get off_t, ssize_t, mode_t.  */
+#include <sys/types.h>
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Get getopt(), optarg, optind, opterr, optopt.  */
+#if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
+# include <getopt-cdefs.h>
+# include <getopt-pfx-core.h>
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_UNISTD_INLINE
+# define _GL_UNISTD_INLINE _GL_INLINE
+#endif
+
+/* Hide some function declarations from <winsock2.h>.  */
+
+#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
+# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef socket
+#   define socket              socket_used_without_including_sys_socket_h
+#   undef connect
+#   define connect             connect_used_without_including_sys_socket_h
+#   undef accept
+#   define accept              accept_used_without_including_sys_socket_h
+#   undef bind
+#   define bind                bind_used_without_including_sys_socket_h
+#   undef getpeername
+#   define getpeername         getpeername_used_without_including_sys_socket_h
+#   undef getsockname
+#   define getsockname         getsockname_used_without_including_sys_socket_h
+#   undef getsockopt
+#   define getsockopt          getsockopt_used_without_including_sys_socket_h
+#   undef listen
+#   define listen              listen_used_without_including_sys_socket_h
+#   undef recv
+#   define recv                recv_used_without_including_sys_socket_h
+#   undef send
+#   define send                send_used_without_including_sys_socket_h
+#   undef recvfrom
+#   define recvfrom            recvfrom_used_without_including_sys_socket_h
+#   undef sendto
+#   define sendto              sendto_used_without_including_sys_socket_h
+#   undef setsockopt
+#   define setsockopt          setsockopt_used_without_including_sys_socket_h
+#   undef shutdown
+#   define shutdown            shutdown_used_without_including_sys_socket_h
+#  else
+    _GL_WARN_ON_USE (socket,
+                     "socket() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (connect,
+                     "connect() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (accept,
+                     "accept() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (bind,
+                     "bind() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (getpeername,
+                     "getpeername() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (getsockname,
+                     "getsockname() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (getsockopt,
+                     "getsockopt() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (listen,
+                     "listen() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (recv,
+                     "recv() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (send,
+                     "send() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (recvfrom,
+                     "recvfrom() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (sendto,
+                     "sendto() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (setsockopt,
+                     "setsockopt() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (shutdown,
+                     "shutdown() used without including <sys/socket.h>");
+#  endif
+# endif
+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef select
+#   define select              select_used_without_including_sys_select_h
+#  else
+    _GL_WARN_ON_USE (select,
+                     "select() used without including <sys/select.h>");
+#  endif
+# endif
+#endif
+
+
+/* OS/2 EMX lacks these macros.  */
+#ifndef STDIN_FILENO
+# define STDIN_FILENO 0
+#endif
+#ifndef STDOUT_FILENO
+# define STDOUT_FILENO 1
+#endif
+#ifndef STDERR_FILENO
+# define STDERR_FILENO 2
+#endif
+
+/* Ensure *_OK macros exist.  */
+#ifndef F_OK
+# define F_OK 0
+# define X_OK 1
+# define W_OK 2
+# define R_OK 4
+#endif
+
+
+/* Declare overridden functions.  */
+
+
+#if @GNULIB_ACCESS@
+# if @REPLACE_ACCESS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef access
+#   define access rpl_access
+#  endif
+_GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef access
+#   define access _access
+#  endif
+_GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
+# else
+_GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
+# endif
+_GL_CXXALIASWARN (access);
+#elif defined GNULIB_POSIXCHECK
+# undef access
+# if HAVE_RAW_DECL_ACCESS
+/* The access() function is a security risk.  */
+_GL_WARN_ON_USE (access, "access does not always support X_OK - "
+                 "use gnulib module access for portability; "
+                 "also, this function is a security risk - "
+                 "use the gnulib module faccessat instead");
+# endif
+#elif @GNULIB_MDA_ACCESS@
+/* On native Windows, map 'access' to '_access', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::access always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef access
+#   define access _access
+#  endif
+_GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
+# else
+_GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
+# endif
+_GL_CXXALIASWARN (access);
+#endif
+
+
+#if @GNULIB_CHDIR@
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chdir
+#   define chdir _chdir
+#  endif
+_GL_CXXALIAS_MDA (chdir, int, (const char *file));
+# else
+_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIASWARN (chdir);
+#elif defined GNULIB_POSIXCHECK
+# undef chdir
+# if HAVE_RAW_DECL_CHDIR
+_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
+                 "use gnulib module chdir for portability");
+# endif
+#elif @GNULIB_MDA_CHDIR@
+/* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::chdir always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chdir
+#   define chdir _chdir
+#  endif
+_GL_CXXALIAS_MDA (chdir, int, (const char *file));
+# else
+_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIASWARN (chdir);
+#endif
+
+
+#if @GNULIB_CHOWN@
+/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
+   to GID (if GID is not -1).  Follow symbolic links.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html.  */
+# if @REPLACE_CHOWN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chown
+#   define chown rpl_chown
+#  endif
+_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
+# else
+#  if !@HAVE_CHOWN@
+_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
+                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
+# endif
+_GL_CXXALIASWARN (chown);
+#elif defined GNULIB_POSIXCHECK
+# undef chown
+# if HAVE_RAW_DECL_CHOWN
+_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
+                 "doesn't treat a uid or gid of -1 on some systems - "
+                 "use gnulib module chown for portability");
+# endif
+#endif
+
+
+#if @GNULIB_CLOSE@
+# if @REPLACE_CLOSE@
+/* Automatically included by modules that need a replacement for close.  */
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close rpl_close
+#  endif
+_GL_FUNCDECL_RPL (close, int, (int fd));
+_GL_CXXALIAS_RPL (close, int, (int fd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close _close
+#  endif
+_GL_CXXALIAS_MDA (close, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (close, int, (int fd));
+# endif
+_GL_CXXALIASWARN (close);
+#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
+# undef close
+# define close close_used_without_requesting_gnulib_module_close
+#elif defined GNULIB_POSIXCHECK
+# undef close
+/* Assume close is always declared.  */
+_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
+                 "use gnulib module close for portability");
+#elif @GNULIB_MDA_CLOSE@
+/* On native Windows, map 'close' to '_close', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::close always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close _close
+#  endif
+_GL_CXXALIAS_MDA (close, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (close, int, (int fd));
+# endif
+_GL_CXXALIASWARN (close);
+#endif
+
+
+#if @GNULIB_COPY_FILE_RANGE@
+# if @REPLACE_COPY_FILE_RANGE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef copy_file_range
+#   define copy_file_range rpl_copy_file_range
+#  endif
+_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
+                                             int ofd, off_t *opos,
+                                             size_t len, unsigned flags));
+_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
+                                             int ofd, off_t *opos,
+                                             size_t len, unsigned flags));
+# else
+#  if !@HAVE_COPY_FILE_RANGE@
+_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
+                                             int ofd, off_t *opos,
+                                             size_t len, unsigned flags));
+#  endif
+_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
+                                             int ofd, off_t *opos,
+                                             size_t len, unsigned flags));
+# endif
+_GL_CXXALIASWARN (copy_file_range);
+#elif defined GNULIB_POSIXCHECK
+# undef copy_file_range
+# if HAVE_RAW_DECL_COPY_FILE_RANGE
+_GL_WARN_ON_USE (copy_file_range,
+                 "copy_file_range is unportable - "
+                 "use gnulib module copy_file_range for portability");
+# endif
+#endif
+
+
+#if @GNULIB_DUP@
+# if @REPLACE_DUP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define dup rpl_dup
+#  endif
+_GL_FUNCDECL_RPL (dup, int, (int oldfd));
+_GL_CXXALIAS_RPL (dup, int, (int oldfd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup
+#   define dup _dup
+#  endif
+_GL_CXXALIAS_MDA (dup, int, (int oldfd));
+# else
+_GL_CXXALIAS_SYS (dup, int, (int oldfd));
+# endif
+_GL_CXXALIASWARN (dup);
+#elif defined GNULIB_POSIXCHECK
+# undef dup
+# if HAVE_RAW_DECL_DUP
+_GL_WARN_ON_USE (dup, "dup is unportable - "
+                 "use gnulib module dup for portability");
+# endif
+#elif @GNULIB_MDA_DUP@
+/* On native Windows, map 'dup' to '_dup', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::dup always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup
+#   define dup _dup
+#  endif
+_GL_CXXALIAS_MDA (dup, int, (int oldfd));
+# else
+_GL_CXXALIAS_SYS (dup, int, (int oldfd));
+# endif
+_GL_CXXALIASWARN (dup);
+#endif
+
+
+#if @GNULIB_DUP2@
+/* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
+   NEWFD = OLDFD, otherwise close NEWFD first if it is open.
+   Return newfd if successful, otherwise -1 and errno set.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>.  */
+# if @REPLACE_DUP2@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define dup2 rpl_dup2
+#  endif
+_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
+_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup2
+#   define dup2 _dup2
+#  endif
+_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
+# else
+_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
+# endif
+_GL_CXXALIASWARN (dup2);
+#elif defined GNULIB_POSIXCHECK
+# undef dup2
+# if HAVE_RAW_DECL_DUP2
+_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
+                 "use gnulib module dup2 for portability");
+# endif
+#elif @GNULIB_MDA_DUP2@
+/* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::dup2 always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup2
+#   define dup2 _dup2
+#  endif
+_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
+# else
+_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
+# endif
+_GL_CXXALIASWARN (dup2);
+#endif
+
+
+#if @GNULIB_DUP3@
+/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
+   specified flags.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   Close NEWFD first if it is open.
+   Return newfd if successful, otherwise -1 and errno set.
+   See the Linux man page at
+   <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>.  */
+# if @REPLACE_DUP3@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef dup3
+#   define dup3 rpl_dup3
+#  endif
+_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
+_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
+# else
+#  if !@HAVE_DUP3@
+_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
+#  endif
+_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (dup3);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef dup3
+# if HAVE_RAW_DECL_DUP3
+_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
+                 "use gnulib module dup3 for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ENVIRON@
+# if defined __CYGWIN__ && !defined __i386__
+/* The 'environ' variable is defined in a DLL. Therefore its declaration needs
+   the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it.
+   This leads to a link error on 64-bit Cygwin when the option
+   -Wl,--disable-auto-import is in use.  */
+_GL_EXTERN_C __declspec(dllimport) char **environ;
+# endif
+# if !@HAVE_DECL_ENVIRON@
+/* Set of environment variables and values.  An array of strings of the form
+   "VARIABLE=VALUE", terminated with a NULL.  */
+#  if defined __APPLE__ && defined __MACH__
+#   include <TargetConditionals.h>
+#   if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
+#    define _GL_USE_CRT_EXTERNS
+#   endif
+#  endif
+#  ifdef _GL_USE_CRT_EXTERNS
+#   include <crt_externs.h>
+#   define environ (*_NSGetEnviron ())
+#  else
+#   ifdef __cplusplus
+extern "C" {
+#   endif
+extern char **environ;
+#   ifdef __cplusplus
+}
+#   endif
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# if HAVE_RAW_DECL_ENVIRON
+_GL_UNISTD_INLINE char ***
+_GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - "
+                           "use gnulib module environ for portability")
+rpl_environ (void)
+{
+  return &environ;
+}
+#  undef environ
+#  define environ (*rpl_environ ())
+# endif
+#endif
+
+
+#if @GNULIB_EUIDACCESS@
+/* Like access(), except that it uses the effective user id and group id of
+   the current process.  */
+# if !@HAVE_EUIDACCESS@
+_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
+                                   _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
+_GL_CXXALIASWARN (euidaccess);
+# if defined GNULIB_POSIXCHECK
+/* Like access(), this function is a security risk.  */
+_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
+                 "use the gnulib module faccessat instead");
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef euidaccess
+# if HAVE_RAW_DECL_EUIDACCESS
+_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
+                 "use gnulib module euidaccess for portability");
+# endif
+#endif
+
+
+#if @GNULIB_EXECL@
+# if @REPLACE_EXECL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execl
+#   define execl rpl_execl
+#  endif
+_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execl);
+#elif defined GNULIB_POSIXCHECK
+# undef execl
+# if HAVE_RAW_DECL_EXECL
+_GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - "
+                 "use gnulib module execl for portability");
+# endif
+#elif @GNULIB_MDA_EXECL@
+/* On native Windows, map 'execl' to '_execl', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execl always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execl
+#   define execl _execl
+#  endif
+_GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execl);
+#endif
+
+#if @GNULIB_EXECLE@
+# if @REPLACE_EXECLE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execle
+#   define execle rpl_execle
+#  endif
+_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execle);
+#elif defined GNULIB_POSIXCHECK
+# undef execle
+# if HAVE_RAW_DECL_EXECLE
+_GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - "
+                 "use gnulib module execle for portability");
+# endif
+#elif @GNULIB_MDA_EXECLE@
+/* On native Windows, map 'execle' to '_execle', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execle always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execle
+#   define execle _execle
+#  endif
+_GL_CXXALIAS_MDA (execle, intptr_t,
+                  (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execle);
+#endif
+
+#if @GNULIB_EXECLP@
+# if @REPLACE_EXECLP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execlp
+#   define execlp rpl_execlp
+#  endif
+_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execlp);
+#elif defined GNULIB_POSIXCHECK
+# undef execlp
+# if HAVE_RAW_DECL_EXECLP
+_GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - "
+                 "use gnulib module execlp for portability");
+# endif
+#elif @GNULIB_MDA_EXECLP@
+/* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execlp always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execlp
+#   define execlp _execlp
+#  endif
+_GL_CXXALIAS_MDA (execlp, intptr_t,
+                  (const char *program, const char *arg, ...));
+# else
+_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
+# endif
+_GL_CXXALIASWARN (execlp);
+#endif
+
+
+#if @GNULIB_EXECV@
+# if @REPLACE_EXECV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execv
+#   define execv rpl_execv
+#  endif
+_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv)
+                              _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
+# else
+_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
+# endif
+_GL_CXXALIASWARN (execv);
+#elif defined GNULIB_POSIXCHECK
+# undef execv
+# if HAVE_RAW_DECL_EXECV
+_GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - "
+                 "use gnulib module execv for portability");
+# endif
+#elif @GNULIB_MDA_EXECV@
+/* On native Windows, map 'execv' to '_execv', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execv always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execv
+#   define execv _execv
+#  endif
+_GL_CXXALIAS_MDA_CAST (execv, intptr_t,
+                       (const char *program, char * const *argv));
+# else
+_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
+# endif
+_GL_CXXALIASWARN (execv);
+#endif
+
+#if @GNULIB_EXECVE@
+# if @REPLACE_EXECVE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execve
+#   define execve rpl_execve
+#  endif
+_GL_FUNCDECL_RPL (execve, int,
+                  (const char *program, char * const *argv, char * const *env)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (execve, int,
+                  (const char *program, char * const *argv, char * const *env));
+# else
+_GL_CXXALIAS_SYS (execve, int,
+                  (const char *program, char * const *argv, char * const *env));
+# endif
+_GL_CXXALIASWARN (execve);
+#elif defined GNULIB_POSIXCHECK
+# undef execve
+# if HAVE_RAW_DECL_EXECVE
+_GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - "
+                 "use gnulib module execve for portability");
+# endif
+#elif @GNULIB_MDA_EXECVE@
+/* On native Windows, map 'execve' to '_execve', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execve always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execve
+#   define execve _execve
+#  endif
+_GL_CXXALIAS_MDA_CAST (execve, intptr_t,
+                       (const char *program, char * const *argv,
+                        char * const *env));
+# else
+_GL_CXXALIAS_SYS (execve, int,
+                  (const char *program, char * const *argv, char * const *env));
+# endif
+_GL_CXXALIASWARN (execve);
+#endif
+
+#if @GNULIB_EXECVP@
+# if @REPLACE_EXECVP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execvp
+#   define execvp rpl_execvp
+#  endif
+_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv)
+                               _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
+# else
+_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
+# endif
+_GL_CXXALIASWARN (execvp);
+#elif defined GNULIB_POSIXCHECK
+# undef execvp
+# if HAVE_RAW_DECL_EXECVP
+_GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - "
+                 "use gnulib module execvp for portability");
+# endif
+#elif @GNULIB_MDA_EXECVP@
+/* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execvp always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execvp
+#   define execvp _execvp
+#  endif
+_GL_CXXALIAS_MDA_CAST (execvp, intptr_t,
+                       (const char *program, char * const *argv));
+# else
+_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
+# endif
+_GL_CXXALIASWARN (execvp);
+#endif
+
+#if @GNULIB_EXECVPE@
+# if @REPLACE_EXECVPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execvpe
+#   define execvpe rpl_execvpe
+#  endif
+_GL_FUNCDECL_RPL (execvpe, int,
+                  (const char *program, char * const *argv, char * const *env)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (execvpe, int,
+                  (const char *program, char * const *argv, char * const *env));
+# else
+#  if !@HAVE_DECL_EXECVPE@
+_GL_FUNCDECL_SYS (execvpe, int,
+                  (const char *program, char * const *argv, char * const *env)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (execvpe, int,
+                  (const char *program, char * const *argv, char * const *env));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (execvpe);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef execvpe
+# if HAVE_RAW_DECL_EXECVPE
+_GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - "
+                 "use gnulib module execvpe for portability");
+# endif
+#elif @GNULIB_MDA_EXECVPE@
+/* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have
+   it.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef execvpe
+#   define execvpe _execvpe
+#  endif
+_GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
+                       (const char *program, char * const *argv,
+                        char * const *env));
+# elif @HAVE_EXECVPE@
+#  if !@HAVE_DECL_EXECVPE@
+_GL_FUNCDECL_SYS (execvpe, int,
+                  (const char *program, char * const *argv, char * const *env)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (execvpe, int,
+                  (const char *program, char * const *argv, char * const *env));
+# endif
+# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_EXECVPE@
+_GL_CXXALIASWARN (execvpe);
+# endif
+#endif
+
+
+#if @GNULIB_FACCESSAT@
+# if @REPLACE_FACCESSAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef faccessat
+#   define faccessat rpl_faccessat
+#  endif
+_GL_FUNCDECL_RPL (faccessat, int,
+                  (int fd, char const *name, int mode, int flag)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (faccessat, int,
+                  (int fd, char const *name, int mode, int flag));
+# else
+#  if !@HAVE_FACCESSAT@
+_GL_FUNCDECL_SYS (faccessat, int,
+                  (int fd, char const *file, int mode, int flag)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (faccessat, int,
+                  (int fd, char const *file, int mode, int flag));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (faccessat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef faccessat
+# if HAVE_RAW_DECL_FACCESSAT
+_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
+                 "use gnulib module faccessat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FCHDIR@
+/* Change the process' current working directory to the directory on which
+   the given file descriptor is open.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>.  */
+# if @REPLACE_FCHDIR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fchdir
+#   define fchdir rpl_fchdir
+#  endif
+_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/));
+_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
+# else
+#  if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
+_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
+#  endif
+_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
+# endif
+_GL_CXXALIASWARN (fchdir);
+# if @REPLACE_FCHDIR@ || !@HAVE_FCHDIR@
+/* Gnulib internal hooks needed to maintain the fchdir metadata.  */
+_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
+     _GL_ARG_NONNULL ((2));
+_GL_EXTERN_C void _gl_unregister_fd (int fd);
+_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
+_GL_EXTERN_C const char *_gl_directory_name (int fd);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fchdir
+# if HAVE_RAW_DECL_FCHDIR
+_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
+                 "use gnulib module fchdir for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FCHOWNAT@
+# if @REPLACE_FCHOWNAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fchownat
+#   define fchownat rpl_fchownat
+#  endif
+_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
+                                  uid_t owner, gid_t group, int flag)
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
+                                  uid_t owner, gid_t group, int flag));
+# else
+#  if !@HAVE_FCHOWNAT@
+_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
+                                  uid_t owner, gid_t group, int flag)
+                                 _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
+                                  uid_t owner, gid_t group, int flag));
+# endif
+_GL_CXXALIASWARN (fchownat);
+#elif defined GNULIB_POSIXCHECK
+# undef fchownat
+# if HAVE_RAW_DECL_FCHOWNAT
+_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
+                 "use gnulib module fchownat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FDATASYNC@
+/* Synchronize changes to a file.
+   Return 0 if successful, otherwise -1 and errno set.
+   See POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>.  */
+# if @REPLACE_FDATASYNC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fdatasync
+#   define fdatasync rpl_fdatasync
+#  endif
+_GL_FUNCDECL_RPL (fdatasync, int, (int fd));
+_GL_CXXALIAS_RPL (fdatasync, int, (int fd));
+# else
+#  if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@
+_GL_FUNCDECL_SYS (fdatasync, int, (int fd));
+#  endif
+_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (fdatasync);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fdatasync
+# if HAVE_RAW_DECL_FDATASYNC
+_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
+                 "use gnulib module fdatasync for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FSYNC@
+/* Synchronize changes, including metadata, to a file.
+   Return 0 if successful, otherwise -1 and errno set.
+   See POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>.  */
+# if !@HAVE_FSYNC@
+_GL_FUNCDECL_SYS (fsync, int, (int fd));
+# endif
+_GL_CXXALIAS_SYS (fsync, int, (int fd));
+_GL_CXXALIASWARN (fsync);
+#elif defined GNULIB_POSIXCHECK
+# undef fsync
+# if HAVE_RAW_DECL_FSYNC
+_GL_WARN_ON_USE (fsync, "fsync is unportable - "
+                 "use gnulib module fsync for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FTRUNCATE@
+/* Change the size of the file to which FD is opened to become equal to LENGTH.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>.  */
+# if @REPLACE_FTRUNCATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ftruncate
+#   define ftruncate rpl_ftruncate
+#  endif
+_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
+_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
+# else
+#  if !@HAVE_FTRUNCATE@
+_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
+#  endif
+_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (ftruncate);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ftruncate
+# if HAVE_RAW_DECL_FTRUNCATE
+_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
+                 "use gnulib module ftruncate for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETCWD@
+/* Get the name of the current working directory, and put it in SIZE bytes
+   of BUF.
+   Return BUF if successful, or NULL if the directory couldn't be determined
+   or SIZE was too small.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
+   Additionally, the gnulib module 'getcwd' or 'getcwd-lgpl' guarantees the
+   following GNU extension: If BUF is NULL, an array is allocated with
+   'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case
+   it is as big as necessary.  */
+# if @REPLACE_GETCWD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define getcwd rpl_getcwd
+#  endif
+_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
+_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getcwd
+#   define getcwd _getcwd
+#  endif
+_GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
+# else
+/* Need to cast, because on mingw, the second parameter is
+                                                   int size.  */
+_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
+# endif
+_GL_CXXALIASWARN (getcwd);
+#elif defined GNULIB_POSIXCHECK
+# undef getcwd
+# if HAVE_RAW_DECL_GETCWD
+_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
+                 "use gnulib module getcwd for portability");
+# endif
+#elif @GNULIB_MDA_GETCWD@
+/* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::getcwd always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getcwd
+#   define getcwd _getcwd
+#  endif
+/* Need to cast, because on mingw, the second parameter is either
+   'int size' or 'size_t size'.  */
+_GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size));
+# else
+_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
+# endif
+_GL_CXXALIASWARN (getcwd);
+#endif
+
+
+#if @GNULIB_GETDOMAINNAME@
+/* Return the NIS domain name of the machine.
+   WARNING! The NIS domain name is unrelated to the fully qualified host name
+            of the machine.  It is also unrelated to email addresses.
+   WARNING! The NIS domain name is usually the empty string or "(none)" when
+            not using NIS.
+
+   Put up to LEN bytes of the NIS domain name into NAME.
+   Null terminate it if the name is shorter than LEN.
+   If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
+   Return 0 if successful, otherwise set errno and return -1.  */
+# if @REPLACE_GETDOMAINNAME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getdomainname
+#   define getdomainname rpl_getdomainname
+#  endif
+_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
+                                      _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
+# else
+#  if !@HAVE_DECL_GETDOMAINNAME@
+_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
+                                      _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getdomainname);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getdomainname
+# if HAVE_RAW_DECL_GETDOMAINNAME
+_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
+                 "use gnulib module getdomainname for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETDTABLESIZE@
+/* Return the maximum number of file descriptors in the current process.
+   In POSIX, this is same as sysconf (_SC_OPEN_MAX).  */
+# if @REPLACE_GETDTABLESIZE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getdtablesize
+#   define getdtablesize rpl_getdtablesize
+#  endif
+_GL_FUNCDECL_RPL (getdtablesize, int, (void));
+_GL_CXXALIAS_RPL (getdtablesize, int, (void));
+# else
+#  if !@HAVE_GETDTABLESIZE@
+_GL_FUNCDECL_SYS (getdtablesize, int, (void));
+#  endif
+/* Need to cast, because on AIX, the parameter list is
+                                           (...).  */
+_GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
+# endif
+_GL_CXXALIASWARN (getdtablesize);
+#elif defined GNULIB_POSIXCHECK
+# undef getdtablesize
+# if HAVE_RAW_DECL_GETDTABLESIZE
+_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
+                 "use gnulib module getdtablesize for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETENTROPY@
+/* Fill a buffer with random bytes.  */
+# if @REPLACE_GETENTROPY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getentropy
+#   define getentropy rpl_getentropy
+#  endif
+_GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length));
+_GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length));
+# else
+#  if !@HAVE_GETENTROPY@
+_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
+#  endif
+_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getentropy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getentropy
+# if HAVE_RAW_DECL_GETENTROPY
+_GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
+                 "use gnulib module getentropy for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETGROUPS@
+/* Return the supplemental groups that the current process belongs to.
+   It is unspecified whether the effective group id is in the list.
+   If N is 0, return the group count; otherwise, N describes how many
+   entries are available in GROUPS.  Return -1 and set errno if N is
+   not 0 and not large enough.  Fails with ENOSYS on some systems.  */
+# if @REPLACE_GETGROUPS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getgroups
+#   define getgroups rpl_getgroups
+#  endif
+_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
+_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
+# else
+#  if !@HAVE_GETGROUPS@
+_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
+#  endif
+_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
+# endif
+_GL_CXXALIASWARN (getgroups);
+#elif defined GNULIB_POSIXCHECK
+# undef getgroups
+# if HAVE_RAW_DECL_GETGROUPS
+_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
+                 "use gnulib module getgroups for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETHOSTNAME@
+/* Return the standard host name of the machine.
+   WARNING! The host name may or may not be fully qualified.
+
+   Put up to LEN bytes of the host name into NAME.
+   Null terminate it if the name is shorter than LEN.
+   If the host name is longer than LEN, set errno = EINVAL and return -1.
+   Return 0 if successful, otherwise set errno and return -1.  */
+# if @UNISTD_H_HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gethostname
+#   define gethostname rpl_gethostname
+#  endif
+_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
+                                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
+# else
+#  if !@HAVE_GETHOSTNAME@
+_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
+                                    _GL_ARG_NONNULL ((1)));
+#  endif
+/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
+   parameter is
+                                                      int len.  */
+_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
+# endif
+_GL_CXXALIASWARN (gethostname);
+#elif @UNISTD_H_HAVE_WINSOCK2_H@
+# undef gethostname
+# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
+#elif defined GNULIB_POSIXCHECK
+# undef gethostname
+# if HAVE_RAW_DECL_GETHOSTNAME
+_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
+                 "use gnulib module gethostname for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETLOGIN@
+/* Returns the user's login name, or NULL if it cannot be found.  Upon error,
+   returns NULL with errno set.
+
+   See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
+ */
+# if !@HAVE_DECL_GETLOGIN@
+_GL_FUNCDECL_SYS (getlogin, char *, (void));
+# endif
+_GL_CXXALIAS_SYS (getlogin, char *, (void));
+_GL_CXXALIASWARN (getlogin);
+#elif defined GNULIB_POSIXCHECK
+# undef getlogin
+# if HAVE_RAW_DECL_GETLOGIN
+_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
+                 "use gnulib module getlogin for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETLOGIN_R@
+/* Copies the user's login name to NAME.
+   The array pointed to by NAME has room for SIZE bytes.
+
+   Returns 0 if successful.  Upon error, an error number is returned, or -1 in
+   the case that the login name cannot be found but no specific error is
+   provided (this case is hopefully rare but is left open by the POSIX spec).
+
+   See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
+ */
+# if @REPLACE_GETLOGIN_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define getlogin_r rpl_getlogin_r
+#  endif
+_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
+                                   _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
+# else
+#  if !@HAVE_DECL_GETLOGIN_R@
+_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
+                                   _GL_ARG_NONNULL ((1)));
+#  endif
+/* Need to cast, because on Solaris 10 systems, the second argument is
+                                                     int size.  */
+_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (getlogin_r);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getlogin_r
+# if HAVE_RAW_DECL_GETLOGIN_R
+_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
+                 "use gnulib module getlogin_r for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETPAGESIZE@
+# if @REPLACE_GETPAGESIZE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define getpagesize rpl_getpagesize
+#  endif
+_GL_FUNCDECL_RPL (getpagesize, int, (void));
+_GL_CXXALIAS_RPL (getpagesize, int, (void));
+# else
+/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
+   the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used.  */
+#  if defined __hpux
+_GL_FUNCDECL_SYS (getpagesize, int, (void));
+#  endif
+#  if !@HAVE_GETPAGESIZE@
+#   if !defined getpagesize
+/* This is for POSIX systems.  */
+#    if !defined _gl_getpagesize && defined _SC_PAGESIZE
+#     if ! (defined __VMS && __VMS_VER < 70000000)
+#      define _gl_getpagesize() sysconf (_SC_PAGESIZE)
+#     endif
+#    endif
+/* This is for older VMS.  */
+#    if !defined _gl_getpagesize && defined __VMS
+#     ifdef __ALPHA
+#      define _gl_getpagesize() 8192
+#     else
+#      define _gl_getpagesize() 512
+#     endif
+#    endif
+/* This is for BeOS.  */
+#    if !defined _gl_getpagesize && @HAVE_OS_H@
+#     include <OS.h>
+#     if defined B_PAGE_SIZE
+#      define _gl_getpagesize() B_PAGE_SIZE
+#     endif
+#    endif
+/* This is for AmigaOS4.0.  */
+#    if !defined _gl_getpagesize && defined __amigaos4__
+#     define _gl_getpagesize() 2048
+#    endif
+/* This is for older Unix systems.  */
+#    if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
+#     include <sys/param.h>
+#     ifdef EXEC_PAGESIZE
+#      define _gl_getpagesize() EXEC_PAGESIZE
+#     else
+#      ifdef NBPG
+#       ifndef CLSIZE
+#        define CLSIZE 1
+#       endif
+#       define _gl_getpagesize() (NBPG * CLSIZE)
+#      else
+#       ifdef NBPC
+#        define _gl_getpagesize() NBPC
+#       endif
+#      endif
+#     endif
+#    endif
+#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#     define getpagesize() _gl_getpagesize ()
+#    else
+#     if !GNULIB_defined_getpagesize_function
+_GL_UNISTD_INLINE int
+getpagesize ()
+{
+  return _gl_getpagesize ();
+}
+#      define GNULIB_defined_getpagesize_function 1
+#     endif
+#    endif
+#   endif
+#  endif
+/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t.  */
+_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
+# endif
+# if @HAVE_DECL_GETPAGESIZE@
+_GL_CXXALIASWARN (getpagesize);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getpagesize
+# if HAVE_RAW_DECL_GETPAGESIZE
+_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
+                 "use gnulib module getpagesize for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETPASS@
+/* Function getpass() from module 'getpass':
+     Read a password from /dev/tty or stdin.
+   Function getpass() from module 'getpass-gnu':
+     Read a password of arbitrary length from /dev/tty or stdin.  */
+# if (@GNULIB_GETPASS@ && @REPLACE_GETPASS@) \
+     || (@GNULIB_GETPASS_GNU@ && @REPLACE_GETPASS_FOR_GETPASS_GNU@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getpass
+#   define getpass rpl_getpass
+#  endif
+_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
+                                   _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
+# else
+#  if !@HAVE_GETPASS@
+_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
+                                   _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
+# endif
+_GL_CXXALIASWARN (getpass);
+#elif defined GNULIB_POSIXCHECK
+# undef getpass
+# if HAVE_RAW_DECL_GETPASS
+_GL_WARN_ON_USE (getpass, "getpass is unportable - "
+                 "use gnulib module getpass or getpass-gnu for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MDA_GETPID@
+/* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::getpid always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getpid
+#   define getpid _getpid
+#  endif
+_GL_CXXALIAS_MDA (getpid, int, (void));
+# else
+_GL_CXXALIAS_SYS (getpid, pid_t, (void));
+# endif
+_GL_CXXALIASWARN (getpid);
+#endif
+
+
+#if @GNULIB_GETUSERSHELL@
+/* Return the next valid login shell on the system, or NULL when the end of
+   the list has been reached.  */
+# if !@HAVE_DECL_GETUSERSHELL@
+_GL_FUNCDECL_SYS (getusershell, char *, (void));
+# endif
+_GL_CXXALIAS_SYS (getusershell, char *, (void));
+_GL_CXXALIASWARN (getusershell);
+#elif defined GNULIB_POSIXCHECK
+# undef getusershell
+# if HAVE_RAW_DECL_GETUSERSHELL
+_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
+#endif
+
+#if @GNULIB_GETUSERSHELL@
+/* Rewind to pointer that is advanced at each getusershell() call.  */
+# if !@HAVE_DECL_GETUSERSHELL@
+_GL_FUNCDECL_SYS (setusershell, void, (void));
+# endif
+_GL_CXXALIAS_SYS (setusershell, void, (void));
+_GL_CXXALIASWARN (setusershell);
+#elif defined GNULIB_POSIXCHECK
+# undef setusershell
+# if HAVE_RAW_DECL_SETUSERSHELL
+_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
+#endif
+
+#if @GNULIB_GETUSERSHELL@
+/* Free the pointer that is advanced at each getusershell() call and
+   associated resources.  */
+# if !@HAVE_DECL_GETUSERSHELL@
+_GL_FUNCDECL_SYS (endusershell, void, (void));
+# endif
+_GL_CXXALIAS_SYS (endusershell, void, (void));
+_GL_CXXALIASWARN (endusershell);
+#elif defined GNULIB_POSIXCHECK
+# undef endusershell
+# if HAVE_RAW_DECL_ENDUSERSHELL
+_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GROUP_MEMBER@
+/* Determine whether group id is in calling user's group list.  */
+# if !@HAVE_GROUP_MEMBER@
+_GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
+# endif
+_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
+_GL_CXXALIASWARN (group_member);
+#elif defined GNULIB_POSIXCHECK
+# undef group_member
+# if HAVE_RAW_DECL_GROUP_MEMBER
+_GL_WARN_ON_USE (group_member, "group_member is unportable - "
+                 "use gnulib module group-member for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ISATTY@
+# if @REPLACE_ISATTY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef isatty
+#   define isatty rpl_isatty
+#  endif
+#  define GNULIB_defined_isatty 1
+_GL_FUNCDECL_RPL (isatty, int, (int fd));
+_GL_CXXALIAS_RPL (isatty, int, (int fd));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef isatty
+#   define isatty _isatty
+#  endif
+_GL_CXXALIAS_MDA (isatty, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (isatty, int, (int fd));
+# endif
+_GL_CXXALIASWARN (isatty);
+#elif defined GNULIB_POSIXCHECK
+# undef isatty
+# if HAVE_RAW_DECL_ISATTY
+_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
+                 "use gnulib module isatty for portability");
+# endif
+#elif @GNULIB_MDA_ISATTY@
+/* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::isatty always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef isatty
+#   define isatty _isatty
+#  endif
+_GL_CXXALIAS_MDA (isatty, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (isatty, int, (int fd));
+# endif
+_GL_CXXALIASWARN (isatty);
+#endif
+
+
+#if @GNULIB_LCHOWN@
+/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
+   to GID (if GID is not -1).  Do not follow symbolic links.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>.  */
+# if @REPLACE_LCHOWN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lchown
+#   define lchown rpl_lchown
+#  endif
+_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
+# else
+#  if !@HAVE_LCHOWN@
+_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
+                               _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
+# endif
+_GL_CXXALIASWARN (lchown);
+#elif defined GNULIB_POSIXCHECK
+# undef lchown
+# if HAVE_RAW_DECL_LCHOWN
+_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
+                 "use gnulib module lchown for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LINK@
+/* Create a new hard link for an existing file.
+   Return 0 if successful, otherwise -1 and errno set.
+   See POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>.  */
+# if @REPLACE_LINK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define link rpl_link
+#  endif
+_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
+                             _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
+# else
+#  if !@HAVE_LINK@
+_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
+                             _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
+# endif
+_GL_CXXALIASWARN (link);
+#elif defined GNULIB_POSIXCHECK
+# undef link
+# if HAVE_RAW_DECL_LINK
+_GL_WARN_ON_USE (link, "link is unportable - "
+                 "use gnulib module link for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LINKAT@
+/* Create a new hard link for an existing file, relative to two
+   directories.  FLAG controls whether symlinks are followed.
+   Return 0 if successful, otherwise -1 and errno set.  */
+# if @REPLACE_LINKAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef linkat
+#   define linkat rpl_linkat
+#  endif
+_GL_FUNCDECL_RPL (linkat, int,
+                  (int fd1, const char *path1, int fd2, const char *path2,
+                   int flag)
+                  _GL_ARG_NONNULL ((2, 4)));
+_GL_CXXALIAS_RPL (linkat, int,
+                  (int fd1, const char *path1, int fd2, const char *path2,
+                   int flag));
+# else
+#  if !@HAVE_LINKAT@
+_GL_FUNCDECL_SYS (linkat, int,
+                  (int fd1, const char *path1, int fd2, const char *path2,
+                   int flag)
+                  _GL_ARG_NONNULL ((2, 4)));
+#  endif
+_GL_CXXALIAS_SYS (linkat, int,
+                  (int fd1, const char *path1, int fd2, const char *path2,
+                   int flag));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (linkat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef linkat
+# if HAVE_RAW_DECL_LINKAT
+_GL_WARN_ON_USE (linkat, "linkat is unportable - "
+                 "use gnulib module linkat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LSEEK@
+/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
+   Return the new offset if successful, otherwise -1 and errno set.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>.  */
+# if @REPLACE_LSEEK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define lseek rpl_lseek
+#  endif
+_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
+_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lseek
+#   define lseek _lseek
+#  endif
+_GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
+# else
+_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
+# endif
+_GL_CXXALIASWARN (lseek);
+#elif defined GNULIB_POSIXCHECK
+# undef lseek
+# if HAVE_RAW_DECL_LSEEK
+_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
+                 "systems - use gnulib module lseek for portability");
+# endif
+#elif @GNULIB_MDA_LSEEK@
+/* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::lseek always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lseek
+#   define lseek _lseek
+#  endif
+_GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence));
+# else
+_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
+# endif
+_GL_CXXALIASWARN (lseek);
+#endif
+
+
+#if @GNULIB_PIPE@
+/* Create a pipe, defaulting to O_BINARY mode.
+   Store the read-end as fd[0] and the write-end as fd[1].
+   Return 0 upon success, or -1 with errno set upon failure.  */
+# if !@HAVE_PIPE@
+_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
+_GL_CXXALIASWARN (pipe);
+#elif defined GNULIB_POSIXCHECK
+# undef pipe
+# if HAVE_RAW_DECL_PIPE
+_GL_WARN_ON_USE (pipe, "pipe is unportable - "
+                 "use gnulib module pipe-posix for portability");
+# endif
+#endif
+
+
+#if @GNULIB_PIPE2@
+/* Create a pipe, applying the given flags when opening the read-end of the
+   pipe and the write-end of the pipe.
+   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
+   and O_TEXT, O_BINARY (defined in "binary-io.h").
+   Store the read-end as fd[0] and the write-end as fd[1].
+   Return 0 upon success, or -1 with errno set upon failure.
+   See also the Linux man page at
+   <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>.  */
+# if @REPLACE_PIPE2@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pipe2
+#   define pipe2 rpl_pipe2
+#  endif
+_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
+# else
+_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pipe2);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pipe2
+# if HAVE_RAW_DECL_PIPE2
+_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
+                 "use gnulib module pipe2 for portability");
+# endif
+#endif
+
+
+#if @GNULIB_PREAD@
+/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
+   Return the number of bytes placed into BUF if successful, otherwise
+   set errno and return -1.  0 indicates EOF.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>.  */
+# if @REPLACE_PREAD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pread
+#   define pread rpl_pread
+#  endif
+_GL_FUNCDECL_RPL (pread, ssize_t,
+                  (int fd, void *buf, size_t bufsize, off_t offset)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (pread, ssize_t,
+                  (int fd, void *buf, size_t bufsize, off_t offset));
+# else
+#  if !@HAVE_PREAD@
+_GL_FUNCDECL_SYS (pread, ssize_t,
+                  (int fd, void *buf, size_t bufsize, off_t offset)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (pread, ssize_t,
+                  (int fd, void *buf, size_t bufsize, off_t offset));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pread);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pread
+# if HAVE_RAW_DECL_PREAD
+_GL_WARN_ON_USE (pread, "pread is unportable - "
+                 "use gnulib module pread for portability");
+# endif
+#endif
+
+
+#if @GNULIB_PWRITE@
+/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
+   Return the number of bytes written if successful, otherwise
+   set errno and return -1.  0 indicates nothing written.  See the
+   POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>.  */
+# if @REPLACE_PWRITE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pwrite
+#   define pwrite rpl_pwrite
+#  endif
+_GL_FUNCDECL_RPL (pwrite, ssize_t,
+                  (int fd, const void *buf, size_t bufsize, off_t offset)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (pwrite, ssize_t,
+                  (int fd, const void *buf, size_t bufsize, off_t offset));
+# else
+#  if !@HAVE_PWRITE@
+_GL_FUNCDECL_SYS (pwrite, ssize_t,
+                  (int fd, const void *buf, size_t bufsize, off_t offset)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (pwrite, ssize_t,
+                  (int fd, const void *buf, size_t bufsize, off_t offset));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (pwrite);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pwrite
+# if HAVE_RAW_DECL_PWRITE
+_GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
+                 "use gnulib module pwrite for portability");
+# endif
+#endif
+
+
+#if @GNULIB_READ@
+/* Read up to COUNT bytes from file descriptor FD into the buffer starting
+   at BUF.  See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>.  */
+# if @REPLACE_READ@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef read
+#   define read rpl_read
+#  endif
+_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef read
+#   define read _read
+#  endif
+_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
+# else
+_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (read);
+#elif @GNULIB_MDA_READ@
+/* On native Windows, map 'read' to '_read', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::read always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef read
+#   define read _read
+#  endif
+#  ifdef __MINGW32__
+_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
+#  else
+_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
+#  endif
+# else
+_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (read);
+#endif
+
+
+#if @GNULIB_READLINK@
+/* Read the contents of the symbolic link FILE and place the first BUFSIZE
+   bytes of it into BUF.  Return the number of bytes placed into BUF if
+   successful, otherwise -1 and errno set.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>.  */
+# if @REPLACE_READLINK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define readlink rpl_readlink
+#  endif
+_GL_FUNCDECL_RPL (readlink, ssize_t,
+                  (const char *restrict file,
+                   char *restrict buf, size_t bufsize)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (readlink, ssize_t,
+                  (const char *restrict file,
+                   char *restrict buf, size_t bufsize));
+# else
+#  if !@HAVE_READLINK@
+_GL_FUNCDECL_SYS (readlink, ssize_t,
+                  (const char *restrict file,
+                   char *restrict buf, size_t bufsize)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (readlink, ssize_t,
+                  (const char *restrict file,
+                   char *restrict buf, size_t bufsize));
+# endif
+_GL_CXXALIASWARN (readlink);
+#elif defined GNULIB_POSIXCHECK
+# undef readlink
+# if HAVE_RAW_DECL_READLINK
+_GL_WARN_ON_USE (readlink, "readlink is unportable - "
+                 "use gnulib module readlink for portability");
+# endif
+#endif
+
+
+#if @GNULIB_READLINKAT@
+# if @REPLACE_READLINKAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define readlinkat rpl_readlinkat
+#  endif
+_GL_FUNCDECL_RPL (readlinkat, ssize_t,
+                  (int fd, char const *restrict file,
+                   char *restrict buf, size_t len)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (readlinkat, ssize_t,
+                  (int fd, char const *restrict file,
+                   char *restrict buf, size_t len));
+# else
+#  if !@HAVE_READLINKAT@
+_GL_FUNCDECL_SYS (readlinkat, ssize_t,
+                  (int fd, char const *restrict file,
+                   char *restrict buf, size_t len)
+                  _GL_ARG_NONNULL ((2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (readlinkat, ssize_t,
+                  (int fd, char const *restrict file,
+                   char *restrict buf, size_t len));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (readlinkat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef readlinkat
+# if HAVE_RAW_DECL_READLINKAT
+_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
+                 "use gnulib module readlinkat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_RMDIR@
+/* Remove the directory DIR.  */
+# if @REPLACE_RMDIR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define rmdir rpl_rmdir
+#  endif
+_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rmdir
+#   define rmdir _rmdir
+#  endif
+_GL_CXXALIAS_MDA (rmdir, int, (char const *name));
+# else
+_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
+# endif
+_GL_CXXALIASWARN (rmdir);
+#elif defined GNULIB_POSIXCHECK
+# undef rmdir
+# if HAVE_RAW_DECL_RMDIR
+_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
+                 "use gnulib module rmdir for portability");
+# endif
+#elif @GNULIB_MDA_RMDIR@
+/* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::rmdir always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rmdir
+#   define rmdir _rmdir
+#  endif
+_GL_CXXALIAS_MDA (rmdir, int, (char const *name));
+# else
+_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
+# endif
+_GL_CXXALIASWARN (rmdir);
+#endif
+
+
+#if @GNULIB_SETHOSTNAME@
+/* Set the host name of the machine.
+   The host name may or may not be fully qualified.
+
+   Put LEN bytes of NAME into the host name.
+   Return 0 if successful, otherwise, set errno and return -1.
+
+   Platforms with no ability to set the hostname return -1 and set
+   errno = ENOSYS.  */
+# if @REPLACE_SETHOSTNAME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sethostname
+#   define sethostname rpl_sethostname
+#  endif
+_GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len)
+                                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (sethostname, int, (const char *name, size_t len));
+# else
+#  if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
+_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
+                                    _GL_ARG_NONNULL ((1)));
+#  endif
+/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
+   and FreeBSD 6.4 the second parameter is int.  On Solaris 11
+   2011-10, the first parameter is not const.  */
+_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (sethostname);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sethostname
+# if HAVE_RAW_DECL_SETHOSTNAME
+_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
+                 "use gnulib module sethostname for portability");
+# endif
+#endif
+
+
+#if @GNULIB_SLEEP@
+/* Pause the execution of the current thread for N seconds.
+   Returns the number of seconds left to sleep.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>.  */
+# if @REPLACE_SLEEP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sleep
+#   define sleep rpl_sleep
+#  endif
+_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
+_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
+# else
+#  if !@HAVE_SLEEP@
+_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
+#  endif
+_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
+# endif
+_GL_CXXALIASWARN (sleep);
+#elif defined GNULIB_POSIXCHECK
+# undef sleep
+# if HAVE_RAW_DECL_SLEEP
+_GL_WARN_ON_USE (sleep, "sleep is unportable - "
+                 "use gnulib module sleep for portability");
+# endif
+#endif
+
+
+#if @GNULIB_MDA_SWAB@
+/* On native Windows, map 'swab' to '_swab', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::swab always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef swab
+#   define swab _swab
+#  endif
+/* Need to cast, because in old mingw the arguments are
+                             (const char *from, char *to, size_t n).  */
+_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
+# else
+#  if defined __hpux /* HP-UX */
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
+#  elif defined __sun && (defined __SunOS_5_10 || defined __XOPEN_OR_POSIX) && !defined _XPG4 /* Solaris */
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
+#  else
+_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
+#  endif
+# endif
+_GL_CXXALIASWARN (swab);
+#endif
+
+
+#if @GNULIB_SYMLINK@
+# if @REPLACE_SYMLINK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef symlink
+#   define symlink rpl_symlink
+#  endif
+_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
+                                _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
+# else
+#  if !@HAVE_SYMLINK@
+_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
+                                _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
+# endif
+_GL_CXXALIASWARN (symlink);
+#elif defined GNULIB_POSIXCHECK
+# undef symlink
+# if HAVE_RAW_DECL_SYMLINK
+_GL_WARN_ON_USE (symlink, "symlink is not portable - "
+                 "use gnulib module symlink for portability");
+# endif
+#endif
+
+
+#if @GNULIB_SYMLINKAT@
+# if @REPLACE_SYMLINKAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef symlinkat
+#   define symlinkat rpl_symlinkat
+#  endif
+_GL_FUNCDECL_RPL (symlinkat, int,
+                  (char const *contents, int fd, char const *file)
+                  _GL_ARG_NONNULL ((1, 3)));
+_GL_CXXALIAS_RPL (symlinkat, int,
+                  (char const *contents, int fd, char const *file));
+# else
+#  if !@HAVE_SYMLINKAT@
+_GL_FUNCDECL_SYS (symlinkat, int,
+                  (char const *contents, int fd, char const *file)
+                  _GL_ARG_NONNULL ((1, 3)));
+#  endif
+_GL_CXXALIAS_SYS (symlinkat, int,
+                  (char const *contents, int fd, char const *file));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (symlinkat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef symlinkat
+# if HAVE_RAW_DECL_SYMLINKAT
+_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_TRUNCATE@
+/* Change the size of the file designated by FILENAME to become equal to LENGTH.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>.  */
+# if @REPLACE_TRUNCATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef truncate
+#   define truncate rpl_truncate
+#  endif
+_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
+                                 _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
+# else
+#  if !@HAVE_DECL_TRUNCATE@
+_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
+                                 _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (truncate);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef truncate
+# if HAVE_RAW_DECL_TRUNCATE
+_GL_WARN_ON_USE (truncate, "truncate is unportable - "
+                 "use gnulib module truncate for portability");
+# endif
+#endif
+
+
+#if @GNULIB_TTYNAME_R@
+/* Store at most BUFLEN characters of the pathname of the terminal FD is
+   open on in BUF.  Return 0 on success, otherwise an error number.  */
+# if @REPLACE_TTYNAME_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ttyname_r
+#   define ttyname_r rpl_ttyname_r
+#  endif
+_GL_FUNCDECL_RPL (ttyname_r, int,
+                  (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (ttyname_r, int,
+                  (int fd, char *buf, size_t buflen));
+# else
+#  if !@HAVE_DECL_TTYNAME_R@
+_GL_FUNCDECL_SYS (ttyname_r, int,
+                  (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (ttyname_r, int,
+                  (int fd, char *buf, size_t buflen));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (ttyname_r);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ttyname_r
+# if HAVE_RAW_DECL_TTYNAME_R
+_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
+                 "use gnulib module ttyname_r for portability");
+# endif
+#endif
+
+
+#if @GNULIB_UNLINK@
+# if @REPLACE_UNLINK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlink
+#   define unlink rpl_unlink
+#  endif
+_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (unlink, int, (char const *file));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlink
+#   define unlink _unlink
+#  endif
+_GL_CXXALIAS_MDA (unlink, int, (char const *file));
+# else
+_GL_CXXALIAS_SYS (unlink, int, (char const *file));
+# endif
+_GL_CXXALIASWARN (unlink);
+#elif defined GNULIB_POSIXCHECK
+# undef unlink
+# if HAVE_RAW_DECL_UNLINK
+_GL_WARN_ON_USE (unlink, "unlink is not portable - "
+                 "use gnulib module unlink for portability");
+# endif
+#elif @GNULIB_MDA_UNLINK@
+/* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::unlink always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlink
+#   define unlink _unlink
+#  endif
+_GL_CXXALIAS_MDA (unlink, int, (char const *file));
+# else
+_GL_CXXALIAS_SYS (unlink, int, (char const *file));
+# endif
+_GL_CXXALIASWARN (unlink);
+#endif
+
+
+#if @GNULIB_UNLINKAT@
+# if @REPLACE_UNLINKAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlinkat
+#   define unlinkat rpl_unlinkat
+#  endif
+_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
+# else
+#  if !@HAVE_UNLINKAT@
+_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
+                                 _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
+# endif
+_GL_CXXALIASWARN (unlinkat);
+#elif defined GNULIB_POSIXCHECK
+# undef unlinkat
+# if HAVE_RAW_DECL_UNLINKAT
+_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
+                 "use gnulib module unlinkat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_USLEEP@
+/* Pause the execution of the current thread for N microseconds.
+   Returns 0 on completion, or -1 on range error.
+   See the POSIX:2001 specification
+   <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>.  */
+# if @REPLACE_USLEEP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef usleep
+#   define usleep rpl_usleep
+#  endif
+_GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
+_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
+# else
+#  if !@HAVE_USLEEP@
+_GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
+#  endif
+/* Need to cast, because on Haiku, the first parameter is
+                                     unsigned int n.  */
+_GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
+# endif
+_GL_CXXALIASWARN (usleep);
+#elif defined GNULIB_POSIXCHECK
+# undef usleep
+# if HAVE_RAW_DECL_USLEEP
+_GL_WARN_ON_USE (usleep, "usleep is unportable - "
+                 "use gnulib module usleep for portability");
+# endif
+#endif
+
+
+#if @GNULIB_WRITE@
+/* Write up to COUNT bytes starting at BUF to file descriptor FD.
+   See the POSIX:2008 specification
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>.  */
+# if @REPLACE_WRITE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef write
+#   define write rpl_write
+#  endif
+_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
+                                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef write
+#   define write _write
+#  endif
+_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
+# else
+_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (write);
+#elif @GNULIB_MDA_WRITE@
+/* On native Windows, map 'write' to '_write', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::write always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef write
+#   define write _write
+#  endif
+#  ifdef __MINGW32__
+_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count));
+#  else
+_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
+#  endif
+# else
+_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (write);
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* _@GUARD_PREFIX@_UNISTD_H */
+#endif /* _GL_INCLUDING_UNISTD_H */
+#endif /* _@GUARD_PREFIX@_UNISTD_H */
deleted file mode 120000 (symlink)
index d24eb7d27765e0988a60ebc2e671cb3d9cdce966..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..424678fc6fc74abd4c2edc9eb991eabdabe1b474
--- /dev/null
@@ -0,0 +1,762 @@
+/* Elementary Unicode string functions.
+   Copyright (C) 2001-2002, 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _UNISTR_H
+#define _UNISTR_H
+
+#include "unitypes.h"
+
+/* Get bool.  */
+#include <stdbool.h>
+
+/* Get size_t, ptrdiff_t.  */
+#include <stddef.h>
+
+/* Get free().  */
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Conventions:
+
+   All functions prefixed with u8_ operate on UTF-8 encoded strings.
+   Their unit is an uint8_t (1 byte).
+
+   All functions prefixed with u16_ operate on UTF-16 encoded strings.
+   Their unit is an uint16_t (a 2-byte word).
+
+   All functions prefixed with u32_ operate on UCS-4 encoded strings.
+   Their unit is an uint32_t (a 4-byte word).
+
+   All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly
+   n units.
+
+   All arguments starting with "str" and the arguments of functions starting
+   with u8_str/u16_str/u32_str denote a NUL terminated string, i.e. a string
+   which terminates at the first NUL unit.  This termination unit is
+   considered part of the string for all memory allocation purposes, but
+   is not considered part of the string for all other logical purposes.
+
+   Functions returning a string result take a (resultbuf, lengthp) argument
+   pair.  If resultbuf is not NULL and the result fits into *lengthp units,
+   it is put in resultbuf, and resultbuf is returned.  Otherwise, a freshly
+   allocated string is returned.  In both cases, *lengthp is set to the
+   length (number of units) of the returned string.  In case of error,
+   NULL is returned and errno is set.  */
+
+
+/* Elementary string checks.  */
+
+/* Check whether an UTF-8 string is well-formed.
+   Return NULL if valid, or a pointer to the first invalid unit otherwise.  */
+extern const uint8_t *
+       u8_check (const uint8_t *s, size_t n)
+       _UC_ATTRIBUTE_PURE;
+
+/* Check whether an UTF-16 string is well-formed.
+   Return NULL if valid, or a pointer to the first invalid unit otherwise.  */
+extern const uint16_t *
+       u16_check (const uint16_t *s, size_t n)
+       _UC_ATTRIBUTE_PURE;
+
+/* Check whether an UCS-4 string is well-formed.
+   Return NULL if valid, or a pointer to the first invalid unit otherwise.  */
+extern const uint32_t *
+       u32_check (const uint32_t *s, size_t n)
+       _UC_ATTRIBUTE_PURE;
+
+
+/* Elementary string conversions.  */
+
+/* Convert an UTF-8 string to an UTF-16 string.  */
+extern uint16_t *
+       u8_to_u16 (const uint8_t *s, size_t n, uint16_t *resultbuf,
+                  size_t *lengthp);
+
+/* Convert an UTF-8 string to an UCS-4 string.  */
+extern uint32_t *
+       u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf,
+                  size_t *lengthp);
+
+/* Convert an UTF-16 string to an UTF-8 string.  */
+extern uint8_t *
+       u16_to_u8 (const uint16_t *s, size_t n, uint8_t *resultbuf,
+                  size_t *lengthp);
+
+/* Convert an UTF-16 string to an UCS-4 string.  */
+extern uint32_t *
+       u16_to_u32 (const uint16_t *s, size_t n, uint32_t *resultbuf,
+                   size_t *lengthp);
+
+/* Convert an UCS-4 string to an UTF-8 string.  */
+extern uint8_t *
+       u32_to_u8 (const uint32_t *s, size_t n, uint8_t *resultbuf,
+                  size_t *lengthp);
+
+/* Convert an UCS-4 string to an UTF-16 string.  */
+extern uint16_t *
+       u32_to_u16 (const uint32_t *s, size_t n, uint16_t *resultbuf,
+                   size_t *lengthp);
+
+
+/* Elementary string functions.  */
+
+/* Return the length (number of units) of the first character in S, which is
+   no longer than N.  Return 0 if it is the NUL character.  Return -1 upon
+   failure.  */
+/* Similar to mblen(), except that s must not be NULL.  */
+extern int
+       u8_mblen (const uint8_t *s, size_t n)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u16_mblen (const uint16_t *s, size_t n)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u32_mblen (const uint32_t *s, size_t n)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the length (number of units) of the first character in S, putting
+   its 'ucs4_t' representation in *PUC.  Upon failure, *PUC is set to 0xfffd,
+   and an appropriate number of units is returned.
+   The number of available units, N, must be > 0.  */
+/* Similar to mbtowc(), except that puc and s must not be NULL, n must be > 0,
+   and the NUL character is not treated specially.  */
+/* The variants with _unsafe suffix are for backward compatibility with
+   libunistring versions < 0.9.7.  */
+
+#if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
+# if !HAVE_INLINE
+extern int
+       u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n);
+# else
+extern int
+       u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n);
+static inline int
+u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
+{
+  uint8_t c = *s;
+
+  if (c < 0x80)
+    {
+      *puc = c;
+      return 1;
+    }
+  else
+    return u8_mbtouc_unsafe_aux (puc, s, n);
+}
+# endif
+#endif
+
+#if GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
+# if !HAVE_INLINE
+extern int
+       u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n);
+# else
+extern int
+       u16_mbtouc_unsafe_aux (ucs4_t *puc, const uint16_t *s, size_t n);
+static inline int
+u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n)
+{
+  uint16_t c = *s;
+
+  if (c < 0xd800 || c >= 0xe000)
+    {
+      *puc = c;
+      return 1;
+    }
+  else
+    return u16_mbtouc_unsafe_aux (puc, s, n);
+}
+# endif
+#endif
+
+#if GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
+# if !HAVE_INLINE
+extern int
+       u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
+# else
+static inline int
+u32_mbtouc_unsafe (ucs4_t *puc,
+                   const uint32_t *s, _GL_ATTRIBUTE_MAYBE_UNUSED size_t n)
+{
+  uint32_t c = *s;
+
+  if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
+    *puc = c;
+  else
+    /* invalid multibyte character */
+    *puc = 0xfffd;
+  return 1;
+}
+# endif
+#endif
+
+#if GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING
+# if !HAVE_INLINE
+extern int
+       u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n);
+# else
+extern int
+       u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n);
+static inline int
+u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
+{
+  uint8_t c = *s;
+
+  if (c < 0x80)
+    {
+      *puc = c;
+      return 1;
+    }
+  else
+    return u8_mbtouc_aux (puc, s, n);
+}
+# endif
+#endif
+
+#if GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING
+# if !HAVE_INLINE
+extern int
+       u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n);
+# else
+extern int
+       u16_mbtouc_aux (ucs4_t *puc, const uint16_t *s, size_t n);
+static inline int
+u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n)
+{
+  uint16_t c = *s;
+
+  if (c < 0xd800 || c >= 0xe000)
+    {
+      *puc = c;
+      return 1;
+    }
+  else
+    return u16_mbtouc_aux (puc, s, n);
+}
+# endif
+#endif
+
+#if GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING
+# if !HAVE_INLINE
+extern int
+       u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
+# else
+static inline int
+u32_mbtouc (ucs4_t *puc, const uint32_t *s,
+            _GL_ATTRIBUTE_MAYBE_UNUSED size_t n)
+{
+  uint32_t c = *s;
+
+  if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
+    *puc = c;
+  else
+    /* invalid multibyte character */
+    *puc = 0xfffd;
+  return 1;
+}
+# endif
+#endif
+
+/* Return the length (number of units) of the first character in S, putting
+   its 'ucs4_t' representation in *PUC.  Upon failure, *PUC is set to 0xfffd,
+   and -1 is returned for an invalid sequence of units, -2 is returned for an
+   incomplete sequence of units.
+   The number of available units, N, must be > 0.  */
+/* Similar to u*_mbtouc(), except that the return value gives more details
+   about the failure, similar to mbrtowc().  */
+
+#if GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING
+extern int
+       u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n);
+#endif
+
+#if GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING
+extern int
+       u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n);
+#endif
+
+#if GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING
+extern int
+       u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n);
+#endif
+
+/* Put the multibyte character represented by UC in S, returning its
+   length.  Return -1 upon failure, -2 if the number of available units, N,
+   is too small.  The latter case cannot occur if N >= 6/2/1, respectively.  */
+/* Similar to wctomb(), except that s must not be NULL, and the argument n
+   must be specified.  */
+
+#if GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING
+/* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr.  */
+extern int
+       u8_uctomb_aux (uint8_t *s, ucs4_t uc, ptrdiff_t n);
+# if !HAVE_INLINE
+extern int
+       u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n);
+# else
+static inline int
+u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n)
+{
+  if (uc < 0x80 && n > 0)
+    {
+      s[0] = uc;
+      return 1;
+    }
+  else
+    return u8_uctomb_aux (s, uc, n);
+}
+# endif
+#endif
+
+#if GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING
+/* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr.  */
+extern int
+       u16_uctomb_aux (uint16_t *s, ucs4_t uc, ptrdiff_t n);
+# if !HAVE_INLINE
+extern int
+       u16_uctomb (uint16_t *s, ucs4_t uc, ptrdiff_t n);
+# else
+static inline int
+u16_uctomb (uint16_t *s, ucs4_t uc, ptrdiff_t n)
+{
+  if (uc < 0xd800 && n > 0)
+    {
+      s[0] = uc;
+      return 1;
+    }
+  else
+    return u16_uctomb_aux (s, uc, n);
+}
+# endif
+#endif
+
+#if GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING
+# if !HAVE_INLINE
+extern int
+       u32_uctomb (uint32_t *s, ucs4_t uc, ptrdiff_t n);
+# else
+static inline int
+u32_uctomb (uint32_t *s, ucs4_t uc, ptrdiff_t n)
+{
+  if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000))
+    {
+      if (n > 0)
+        {
+          *s = uc;
+          return 1;
+        }
+      else
+        return -2;
+    }
+  else
+    return -1;
+}
+# endif
+#endif
+
+/* Copy N units from SRC to DEST.  */
+/* Similar to memcpy().  */
+extern uint8_t *
+       u8_cpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
+extern uint16_t *
+       u16_cpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);
+extern uint32_t *
+       u32_cpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);
+
+/* Copy N units from SRC to DEST, returning pointer after last written unit.  */
+/* Similar to mempcpy().  */
+extern uint8_t *
+       u8_pcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
+extern uint16_t *
+       u16_pcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);
+extern uint32_t *
+       u32_pcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);
+
+/* Copy N units from SRC to DEST, guaranteeing correct behavior for
+   overlapping memory areas.  */
+/* Similar to memmove().  */
+extern uint8_t *
+       u8_move (uint8_t *dest, const uint8_t *src, size_t n);
+extern uint16_t *
+       u16_move (uint16_t *dest, const uint16_t *src, size_t n);
+extern uint32_t *
+       u32_move (uint32_t *dest, const uint32_t *src, size_t n);
+
+/* Set the first N characters of S to UC.  UC should be a character that
+   occupies only 1 unit.  */
+/* Similar to memset().  */
+extern uint8_t *
+       u8_set (uint8_t *s, ucs4_t uc, size_t n);
+extern uint16_t *
+       u16_set (uint16_t *s, ucs4_t uc, size_t n);
+extern uint32_t *
+       u32_set (uint32_t *s, ucs4_t uc, size_t n);
+
+/* Compare S1 and S2, each of length N.  */
+/* Similar to memcmp().  */
+extern int
+       u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n)
+       _UC_ATTRIBUTE_PURE;
+
+/* Compare S1 and S2.  */
+/* Similar to the gnulib function memcmp2().  */
+extern int
+       u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2)
+       _UC_ATTRIBUTE_PURE;
+
+/* Search the string at S for UC.  */
+/* Similar to memchr().  */
+extern uint8_t *
+       u8_chr (const uint8_t *s, size_t n, ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+extern uint16_t *
+       u16_chr (const uint16_t *s, size_t n, ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+extern uint32_t *
+       u32_chr (const uint32_t *s, size_t n, ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+
+/* Count the number of Unicode characters in the N units from S.  */
+/* Similar to mbsnlen().  */
+extern size_t
+       u8_mbsnlen (const uint8_t *s, size_t n)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u16_mbsnlen (const uint16_t *s, size_t n)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u32_mbsnlen (const uint32_t *s, size_t n)
+       _UC_ATTRIBUTE_PURE;
+
+/* Elementary string functions with memory allocation.  */
+
+/* Make a freshly allocated copy of S, of length N.  */
+extern uint8_t *
+       u8_cpy_alloc (const uint8_t *s, size_t n);
+extern uint16_t *
+       u16_cpy_alloc (const uint16_t *s, size_t n);
+extern uint32_t *
+       u32_cpy_alloc (const uint32_t *s, size_t n);
+
+/* Elementary string functions on NUL terminated strings.  */
+
+/* Return the length (number of units) of the first character in S.
+   Return 0 if it is the NUL character.  Return -1 upon failure.  */
+extern int
+       u8_strmblen (const uint8_t *s)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u16_strmblen (const uint16_t *s)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u32_strmblen (const uint32_t *s)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the length (number of units) of the first character in S, putting
+   its 'ucs4_t' representation in *PUC.  Return 0 if it is the NUL
+   character.  Return -1 upon failure.  */
+extern int
+       u8_strmbtouc (ucs4_t *puc, const uint8_t *s);
+extern int
+       u16_strmbtouc (ucs4_t *puc, const uint16_t *s);
+extern int
+       u32_strmbtouc (ucs4_t *puc, const uint32_t *s);
+
+/* Forward iteration step.  Advances the pointer past the next character,
+   or returns NULL if the end of the string has been reached.  Puts the
+   character's 'ucs4_t' representation in *PUC.  */
+extern const uint8_t *
+       u8_next (ucs4_t *puc, const uint8_t *s);
+extern const uint16_t *
+       u16_next (ucs4_t *puc, const uint16_t *s);
+extern const uint32_t *
+       u32_next (ucs4_t *puc, const uint32_t *s);
+
+/* Backward iteration step.  Advances the pointer to point to the previous
+   character, or returns NULL if the beginning of the string had been reached.
+   Puts the character's 'ucs4_t' representation in *PUC.  */
+extern const uint8_t *
+       u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start);
+extern const uint16_t *
+       u16_prev (ucs4_t *puc, const uint16_t *s, const uint16_t *start);
+extern const uint32_t *
+       u32_prev (ucs4_t *puc, const uint32_t *s, const uint32_t *start);
+
+/* Return the number of units in S.  */
+/* Similar to strlen(), wcslen().  */
+extern size_t
+       u8_strlen (const uint8_t *s)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u16_strlen (const uint16_t *s)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u32_strlen (const uint32_t *s)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the number of units in S, but at most MAXLEN.  */
+/* Similar to strnlen(), wcsnlen().  */
+extern size_t
+       u8_strnlen (const uint8_t *s, size_t maxlen)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u16_strnlen (const uint16_t *s, size_t maxlen)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u32_strnlen (const uint32_t *s, size_t maxlen)
+       _UC_ATTRIBUTE_PURE;
+
+/* Copy SRC to DEST.  */
+/* Similar to strcpy(), wcscpy().  */
+extern uint8_t *
+       u8_strcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src);
+extern uint16_t *
+       u16_strcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src);
+extern uint32_t *
+       u32_strcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src);
+
+/* Copy SRC to DEST, returning the address of the terminating NUL in DEST.  */
+/* Similar to stpcpy().  */
+extern uint8_t *
+       u8_stpcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src);
+extern uint16_t *
+       u16_stpcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src);
+extern uint32_t *
+       u32_stpcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src);
+
+/* Copy no more than N units of SRC to DEST.  */
+/* Similar to strncpy(), wcsncpy().  */
+extern uint8_t *
+       u8_strncpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
+extern uint16_t *
+       u16_strncpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);
+extern uint32_t *
+       u32_strncpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);
+
+/* Copy no more than N units of SRC to DEST.  Return a pointer past the last
+   non-NUL unit written into DEST.  */
+/* Similar to stpncpy().  */
+extern uint8_t *
+       u8_stpncpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
+extern uint16_t *
+       u16_stpncpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);
+extern uint32_t *
+       u32_stpncpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);
+
+/* Append SRC onto DEST.  */
+/* Similar to strcat(), wcscat().  */
+extern uint8_t *
+       u8_strcat (uint8_t *_UC_RESTRICT dest, const uint8_t *src);
+extern uint16_t *
+       u16_strcat (uint16_t *_UC_RESTRICT dest, const uint16_t *src);
+extern uint32_t *
+       u32_strcat (uint32_t *_UC_RESTRICT dest, const uint32_t *src);
+
+/* Append no more than N units of SRC onto DEST.  */
+/* Similar to strncat(), wcsncat().  */
+extern uint8_t *
+       u8_strncat (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
+extern uint16_t *
+       u16_strncat (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);
+extern uint32_t *
+       u32_strncat (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);
+
+/* Compare S1 and S2.  */
+/* Similar to strcmp(), wcscmp().  */
+#ifdef __sun
+/* Avoid a collision with the u8_strcmp() function in Solaris 11 libc.  */
+extern int
+       u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2)
+       _UC_ATTRIBUTE_PURE;
+# define u8_strcmp u8_strcmp_gnu
+#else
+extern int
+       u8_strcmp (const uint8_t *s1, const uint8_t *s2)
+       _UC_ATTRIBUTE_PURE;
+#endif
+extern int
+       u16_strcmp (const uint16_t *s1, const uint16_t *s2)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u32_strcmp (const uint32_t *s1, const uint32_t *s2)
+       _UC_ATTRIBUTE_PURE;
+
+/* Compare S1 and S2 using the collation rules of the current locale.
+   Return -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2.
+   Upon failure, set errno and return any value.  */
+/* Similar to strcoll(), wcscoll().  */
+extern int
+       u8_strcoll (const uint8_t *s1, const uint8_t *s2);
+extern int
+       u16_strcoll (const uint16_t *s1, const uint16_t *s2);
+extern int
+       u32_strcoll (const uint32_t *s1, const uint32_t *s2);
+
+/* Compare no more than N units of S1 and S2.  */
+/* Similar to strncmp(), wcsncmp().  */
+extern int
+       u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n)
+       _UC_ATTRIBUTE_PURE;
+
+/* Duplicate S, returning an identical malloc'd string.  */
+/* Similar to strdup(), wcsdup().  */
+extern uint8_t *
+       u8_strdup (const uint8_t *s)
+       _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+extern uint16_t *
+       u16_strdup (const uint16_t *s)
+       _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+extern uint32_t *
+       u32_strdup (const uint32_t *s)
+       _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+
+/* Find the first occurrence of UC in STR.  */
+/* Similar to strchr(), wcschr().  */
+extern uint8_t *
+       u8_strchr (const uint8_t *str, ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+extern uint16_t *
+       u16_strchr (const uint16_t *str, ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+extern uint32_t *
+       u32_strchr (const uint32_t *str, ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+
+/* Find the last occurrence of UC in STR.  */
+/* Similar to strrchr(), wcsrchr().  */
+extern uint8_t *
+       u8_strrchr (const uint8_t *str, ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+extern uint16_t *
+       u16_strrchr (const uint16_t *str, ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+extern uint32_t *
+       u32_strrchr (const uint32_t *str, ucs4_t uc)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the length of the initial segment of STR which consists entirely
+   of Unicode characters not in REJECT.  */
+/* Similar to strcspn(), wcscspn().  */
+extern size_t
+       u8_strcspn (const uint8_t *str, const uint8_t *reject)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u16_strcspn (const uint16_t *str, const uint16_t *reject)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u32_strcspn (const uint32_t *str, const uint32_t *reject)
+       _UC_ATTRIBUTE_PURE;
+
+/* Return the length of the initial segment of STR which consists entirely
+   of Unicode characters in ACCEPT.  */
+/* Similar to strspn(), wcsspn().  */
+extern size_t
+       u8_strspn (const uint8_t *str, const uint8_t *accept)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u16_strspn (const uint16_t *str, const uint16_t *accept)
+       _UC_ATTRIBUTE_PURE;
+extern size_t
+       u32_strspn (const uint32_t *str, const uint32_t *accept)
+       _UC_ATTRIBUTE_PURE;
+
+/* Find the first occurrence in STR of any character in ACCEPT.  */
+/* Similar to strpbrk(), wcspbrk().  */
+extern uint8_t *
+       u8_strpbrk (const uint8_t *str, const uint8_t *accept)
+       _UC_ATTRIBUTE_PURE;
+extern uint16_t *
+       u16_strpbrk (const uint16_t *str, const uint16_t *accept)
+       _UC_ATTRIBUTE_PURE;
+extern uint32_t *
+       u32_strpbrk (const uint32_t *str, const uint32_t *accept)
+       _UC_ATTRIBUTE_PURE;
+
+/* Find the first occurrence of NEEDLE in HAYSTACK.  */
+/* Similar to strstr(), wcsstr().  */
+extern uint8_t *
+       u8_strstr (const uint8_t *haystack, const uint8_t *needle)
+       _UC_ATTRIBUTE_PURE;
+extern uint16_t *
+       u16_strstr (const uint16_t *haystack, const uint16_t *needle)
+       _UC_ATTRIBUTE_PURE;
+extern uint32_t *
+       u32_strstr (const uint32_t *haystack, const uint32_t *needle)
+       _UC_ATTRIBUTE_PURE;
+
+/* Test whether STR starts with PREFIX.  */
+extern bool
+       u8_startswith (const uint8_t *str, const uint8_t *prefix)
+       _UC_ATTRIBUTE_PURE;
+extern bool
+       u16_startswith (const uint16_t *str, const uint16_t *prefix)
+       _UC_ATTRIBUTE_PURE;
+extern bool
+       u32_startswith (const uint32_t *str, const uint32_t *prefix)
+       _UC_ATTRIBUTE_PURE;
+
+/* Test whether STR ends with SUFFIX.  */
+extern bool
+       u8_endswith (const uint8_t *str, const uint8_t *suffix)
+       _UC_ATTRIBUTE_PURE;
+extern bool
+       u16_endswith (const uint16_t *str, const uint16_t *suffix)
+       _UC_ATTRIBUTE_PURE;
+extern bool
+       u32_endswith (const uint32_t *str, const uint32_t *suffix)
+       _UC_ATTRIBUTE_PURE;
+
+/* Divide STR into tokens separated by characters in DELIM.
+   This interface is actually more similar to wcstok than to strtok.  */
+/* Similar to strtok_r(), wcstok().  */
+extern uint8_t *
+       u8_strtok (uint8_t *_UC_RESTRICT str, const uint8_t *delim,
+                  uint8_t **ptr);
+extern uint16_t *
+       u16_strtok (uint16_t *_UC_RESTRICT str, const uint16_t *delim,
+                   uint16_t **ptr);
+extern uint32_t *
+       u32_strtok (uint32_t *_UC_RESTRICT str, const uint32_t *delim,
+                   uint32_t **ptr);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UNISTR_H */
deleted file mode 120000 (symlink)
index 71f62c2f8e110a0cd53728b37080ba32579d78bc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u-cpy.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4848c1460ffebac4e185e26f577dbfb8eff80cc0
--- /dev/null
@@ -0,0 +1,33 @@
+/* Copy piece of UTF-8/UTF-16/UTF-32 string.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <string.h>
+
+UNIT *
+FUNC (UNIT *dest, const UNIT *src, size_t n)
+{
+#if 0
+  UNIT *destptr = dest;
+
+  for (; n > 0; n--)
+    *destptr++ = *src++;
+#else
+  if (n > 0)
+    memcpy ((char *) dest, (const char *) src, n * sizeof (UNIT));
+#endif
+  return dest;
+}
deleted file mode 120000 (symlink)
index e94b74b03195d503a3fc893fe02cf382ca2d736c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u-pcpy.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..812419758acec9d17255b7327acafdb6f5a152b8
--- /dev/null
@@ -0,0 +1,22 @@
+/* Copy piece of UTF-8/16/32 string, return pointer after last written unit.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2023.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+UNIT *
+FUNC (UNIT *dest, const UNIT *src, size_t n)
+{
+  return U_CPY (dest, src, n) + n;
+}
deleted file mode 120000 (symlink)
index f6c499e7b93073aad595e97c4f9f75373a1c832a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u-strcat.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a4a4e93130f01b2e83be3eb45ae76356abb6048b
--- /dev/null
@@ -0,0 +1,26 @@
+/* Concatenate UTF-8/UTF-16/UTF-32 strings.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+UNIT *
+FUNC (UNIT *dest, const UNIT *src)
+{
+  UNIT *destptr = dest + U_STRLEN (dest);
+
+  for (; (*destptr = *src) != 0; src++, destptr++)
+    ;
+  return dest;
+}
deleted file mode 120000 (symlink)
index b8dbfbd1a905d6e8cc4972c8ad5e27d43d6f8122..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u-strlen.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..03106a15fcf24aaaf9f9726ad3258c2385d219c2
--- /dev/null
@@ -0,0 +1,26 @@
+/* Determine length of UTF-8/UTF-16/UTF-32 string.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+size_t
+FUNC (const UNIT *s)
+{
+  const UNIT *ptr;
+
+  for (ptr = s; *ptr != 0; ptr++)
+    ;
+  return ptr - s;
+}
deleted file mode 120000 (symlink)
index 1dc3e498bb8df3dc9ad7c4a5e968600b218599c6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u32-chr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..65500d8386a7feb9bba26696be82b70a51d938b4
--- /dev/null
@@ -0,0 +1,32 @@
+/* Search character in piece of UTF-32 string.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+uint32_t *
+u32_chr (const uint32_t *s, size_t n, ucs4_t uc)
+{
+  for (; n > 0; s++, n--)
+    {
+      if (*s == uc)
+        return (uint32_t *) s;
+    }
+  return NULL;
+}
deleted file mode 120000 (symlink)
index 12fabbcd2e39097506b760ff5e7cc4b138ef10db..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u32-cpy.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a1a840f733c3a989e0dc4a2b056fb76f20927859
--- /dev/null
@@ -0,0 +1,25 @@
+/* Copy piece of UTF-32 string.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+#define FUNC u32_cpy
+#define UNIT uint32_t
+#include "u-cpy.h"
deleted file mode 120000 (symlink)
index 3aabd5c82c4ef378d2a9232dcc6df97b5e3c3ed3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u32-pcpy.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..922f704cfc1debc4ee3f4cc5395a895ba866a622
--- /dev/null
@@ -0,0 +1,26 @@
+/* Copy piece of UTF-32 string, return pointer after last written unit.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2023.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+#define FUNC u32_pcpy
+#define UNIT uint32_t
+#define U_CPY u32_cpy
+#include "u-pcpy.h"
deleted file mode 120000 (symlink)
index 63a535080917ec40fc0e780844cba7012d80f4d3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u32-strcat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2da08b186a1184232c58ffade9a668785e169c92
--- /dev/null
@@ -0,0 +1,26 @@
+/* Concatenate UTF-32 strings.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+#define FUNC u32_strcat
+#define UNIT uint32_t
+#define U_STRLEN u32_strlen
+#include "u-strcat.h"
deleted file mode 120000 (symlink)
index afc4ab72bc4f18c42c77def94d8954b3c454bfb8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u32-strlen.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1c43a30ad86f4047605dd32c74d4ae8af64752e1
--- /dev/null
@@ -0,0 +1,25 @@
+/* Determine length of UTF-32 string.
+   Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+#define FUNC u32_strlen
+#define UNIT uint32_t
+#include "u-strlen.h"
deleted file mode 120000 (symlink)
index b55bc7d76ce6ce753c76d150ba6549e47bd28ade..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u8-mbtoucr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..564e47e91dec0647173510ba2316304a371901b8
--- /dev/null
@@ -0,0 +1,142 @@
+/* Look at first character in UTF-8 string, returning an error code.
+   Copyright (C) 1999-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2001.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+int
+u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n)
+{
+  uint8_t c = *s;
+
+  if (c < 0x80)
+    {
+      *puc = c;
+      return 1;
+    }
+  else if (c >= 0xc2)
+    {
+      if (c < 0xe0)
+        {
+          if (n >= 2)
+            {
+              if ((s[1] ^ 0x80) < 0x40)
+                {
+                  *puc = ((unsigned int) (c & 0x1f) << 6)
+                         | (unsigned int) (s[1] ^ 0x80);
+                  return 2;
+                }
+              /* invalid multibyte character */
+            }
+          else
+            {
+              /* incomplete multibyte character */
+              *puc = 0xfffd;
+              return -2;
+            }
+        }
+      else if (c < 0xf0)
+        {
+          if (n >= 2)
+            {
+              if ((s[1] ^ 0x80) < 0x40
+                  && (c >= 0xe1 || s[1] >= 0xa0)
+                  && (c != 0xed || s[1] < 0xa0))
+                {
+                  if (n >= 3)
+                    {
+                      if ((s[2] ^ 0x80) < 0x40)
+                        {
+                          *puc = ((unsigned int) (c & 0x0f) << 12)
+                                 | ((unsigned int) (s[1] ^ 0x80) << 6)
+                                 | (unsigned int) (s[2] ^ 0x80);
+                          return 3;
+                        }
+                      /* invalid multibyte character */
+                    }
+                  else
+                    {
+                      /* incomplete multibyte character */
+                      *puc = 0xfffd;
+                      return -2;
+                    }
+                }
+              /* invalid multibyte character */
+            }
+          else
+            {
+              /* incomplete multibyte character */
+              *puc = 0xfffd;
+              return -2;
+            }
+        }
+      else if (c <= 0xf4)
+        {
+          if (n >= 2)
+            {
+              if ((s[1] ^ 0x80) < 0x40
+                  && (c >= 0xf1 || s[1] >= 0x90)
+                  && (c < 0xf4 || (/* c == 0xf4 && */ s[1] < 0x90)))
+                {
+                  if (n >= 3)
+                    {
+                      if ((s[2] ^ 0x80) < 0x40)
+                        {
+                          if (n >= 4)
+                            {
+                              if ((s[3] ^ 0x80) < 0x40)
+                                {
+                                  *puc = ((unsigned int) (c & 0x07) << 18)
+                                         | ((unsigned int) (s[1] ^ 0x80) << 12)
+                                         | ((unsigned int) (s[2] ^ 0x80) << 6)
+                                         | (unsigned int) (s[3] ^ 0x80);
+                                  return 4;
+                                }
+                              /* invalid multibyte character */
+                            }
+                          else
+                            {
+                              /* incomplete multibyte character */
+                              *puc = 0xfffd;
+                              return -2;
+                            }
+                        }
+                      /* invalid multibyte character */
+                    }
+                  else
+                    {
+                      /* incomplete multibyte character */
+                      *puc = 0xfffd;
+                      return -2;
+                    }
+                }
+              /* invalid multibyte character */
+            }
+          else
+            {
+              /* incomplete multibyte character */
+              *puc = 0xfffd;
+              return -2;
+            }
+        }
+    }
+  /* invalid multibyte character */
+  *puc = 0xfffd;
+  return -1;
+}
deleted file mode 120000 (symlink)
index 21b451060dfbc7bbb5a2348b33450c01bbb14526..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u8-uctomb-aux.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ffe567d92f7bb04274ea95dbc28d19796e6860fb
--- /dev/null
@@ -0,0 +1,60 @@
+/* Conversion UCS-4 to UTF-8.
+   Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+#include "attribute.h"
+
+int
+u8_uctomb_aux (uint8_t *s, ucs4_t uc, ptrdiff_t n)
+{
+  int count;
+
+  if (uc < 0x80)
+    /* The case n >= 1 is already handled by the caller.  */
+    return -2;
+  else if (uc < 0x800)
+    count = 2;
+  else if (uc < 0x10000)
+    {
+      if (uc < 0xd800 || uc >= 0xe000)
+        count = 3;
+      else
+        return -1;
+    }
+  else if (uc < 0x110000)
+    count = 4;
+  else
+    return -1;
+
+  if (n < count)
+    return -2;
+
+  switch (count) /* note: code falls through cases! */
+    {
+    case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000;
+      FALLTHROUGH;
+    case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800;
+      FALLTHROUGH;
+    case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0;
+  /*case 1:*/ s[0] = uc;
+    }
+  return count;
+}
deleted file mode 120000 (symlink)
index bbbb4e674a51757ba9dd709ae34fd76f021bccca..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unistr/u8-uctomb.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0f903fdbd67cb7be7f7ca59d62d114733c758922
--- /dev/null
@@ -0,0 +1,79 @@
+/* Store a character in UTF-8 string.
+   Copyright (C) 2002, 2005-2006, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#if defined IN_LIBUNISTRING
+/* Tell unistr.h to declare u8_uctomb as 'extern', not 'static inline'.  */
+# include "unistring-notinline.h"
+#endif
+
+/* Specification.  */
+#include "unistr.h"
+
+#include "attribute.h"
+
+#if !HAVE_INLINE
+
+int
+u8_uctomb (uint8_t *s, ucs4_t uc, ptrdiff_t n)
+{
+  if (uc < 0x80)
+    {
+      if (n > 0)
+        {
+          s[0] = uc;
+          return 1;
+        }
+      /* else return -2, below.  */
+    }
+  else
+    {
+      int count;
+
+      if (uc < 0x800)
+        count = 2;
+      else if (uc < 0x10000)
+        {
+          if (uc < 0xd800 || uc >= 0xe000)
+            count = 3;
+          else
+            return -1;
+        }
+      else if (uc < 0x110000)
+        count = 4;
+      else
+        return -1;
+
+      if (n >= count)
+        {
+          switch (count) /* note: code falls through cases! */
+            {
+            case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000;
+              FALLTHROUGH;
+            case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800;
+              FALLTHROUGH;
+            case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0;
+          /*case 1:*/ s[0] = uc;
+            }
+          return count;
+        }
+    }
+  return -2;
+}
+
+#endif
deleted file mode 120000 (symlink)
index cdd4ea958f65a6ddde69a5a28006109ab81c745f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unitypes.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1b14d3b631d2ee2fab2b44c151b056261163113a
--- /dev/null
@@ -0,0 +1,61 @@
+/* Elementary types and macros for the GNU UniString library.
+   Copyright (C) 2002, 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _UNITYPES_H
+#define _UNITYPES_H
+
+/* Get uint8_t, uint16_t, uint32_t.  */
+#include <stdint.h>
+
+/* Type representing a Unicode character.  */
+typedef uint32_t ucs4_t;
+
+/* Attribute of a function whose result depends only on the arguments
+   (not pointers!) and which has no side effects.  */
+#ifndef _UC_ATTRIBUTE_CONST
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__
+#  define _UC_ATTRIBUTE_CONST __attribute__ ((__const__))
+# else
+#  define _UC_ATTRIBUTE_CONST
+# endif
+#endif
+
+/* Attribute of a function whose result depends only on the arguments
+   (possibly pointers) and global memory, and which has no side effects.  */
+#ifndef _UC_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+#  define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _UC_ATTRIBUTE_PURE
+# endif
+#endif
+
+/* Qualifier in a function declaration, that asserts that the caller must
+   pass a pointer to a different object in the specified pointer argument
+   than in the other pointer arguments.  */
+#ifndef _UC_RESTRICT
+# if defined __restrict \
+     || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
+     || __clang_major__ >= 3
+#  define _UC_RESTRICT __restrict
+# elif 199901L <= __STDC_VERSION__ || defined restrict
+#  define _UC_RESTRICT restrict
+# else
+#  define _UC_RESTRICT
+# endif
+#endif
+
+#endif /* _UNITYPES_H */
deleted file mode 120000 (symlink)
index 775775876c9c05782026c39d5b7dea8299fa15f4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/uniwidth.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..58bfe9c1ea7cf51fe1b551c88f520f945b5567d6
--- /dev/null
@@ -0,0 +1,72 @@
+/* Display width functions.
+   Copyright (C) 2001-2002, 2005, 2007, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _UNIWIDTH_H
+#define _UNIWIDTH_H
+
+#include "unitypes.h"
+
+/* Get size_t.  */
+#include <stddef.h>
+
+/* Get locale_charset() declaration.  */
+#include "localcharset.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Display width.  */
+
+/* These functions are locale dependent.  The encoding argument identifies
+   the encoding (e.g. "ISO-8859-2" for Polish).  */
+
+/* Determine number of column positions required for UC.  */
+extern int
+       uc_width (ucs4_t uc, const char *encoding)
+       _UC_ATTRIBUTE_PURE;
+
+/* Determine number of column positions required for first N units
+   (or fewer if S ends before this) in S.  */
+extern int
+       u8_width (const uint8_t *s, size_t n, const char *encoding)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u16_width (const uint16_t *s, size_t n, const char *encoding)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u32_width (const uint32_t *s, size_t n, const char *encoding)
+       _UC_ATTRIBUTE_PURE;
+
+/* Determine number of column positions required for S.  */
+extern int
+       u8_strwidth (const uint8_t *s, const char *encoding)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u16_strwidth (const uint16_t *s, const char *encoding)
+       _UC_ATTRIBUTE_PURE;
+extern int
+       u32_strwidth (const uint32_t *s, const char *encoding)
+       _UC_ATTRIBUTE_PURE;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UNIWIDTH_H */
deleted file mode 120000 (symlink)
index 9c389a5115d12a62716c29531ac5b550961e3825..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/uniwidth/cjk.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5fab365f978b0fb469a93cb746bf1f7596196967
--- /dev/null
@@ -0,0 +1,37 @@
+/* Test for CJK encoding.
+   Copyright (C) 2001-2002, 2005-2007, 2009-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include "streq.h"
+
+static int
+is_cjk_encoding (const char *encoding)
+{
+  if (0
+      /* Legacy Japanese encodings */
+      || STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)
+      /* Legacy Chinese encodings */
+      || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
+      || STREQ_OPT (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0)
+      || STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)
+      || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)
+      /* Legacy Korean encodings */
+      || STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
+      || STREQ_OPT (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0)
+      || STREQ_OPT (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0))
+    return 1;
+  return 0;
+}
deleted file mode 120000 (symlink)
index f54797a4eaef0625485d1c9580cd140ef4d7ea1a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/uniwidth/width.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4942aa1e787294603653a09e9c22be9aa4c998cc
--- /dev/null
@@ -0,0 +1,95 @@
+/* Determine display width of Unicode character.
+   Copyright (C) 2001-2002, 2006-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2002.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "uniwidth.h"
+
+#include "cjk.h"
+
+/* The non-spacing attribute table consists of:
+   * Non-spacing characters; generated from PropList.txt or
+     "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt"
+   * Format control characters; generated from
+     "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt"
+   * Zero width characters; generated from
+     "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt"
+   * Hangul Jamo characters that have conjoining behaviour:
+       - jungseong = syllable-middle vowels
+       - jongseong = syllable-final consonants
+     Rationale:
+     1) These characters act like combining characters. They have no
+     equivalent in legacy character sets. Therefore the EastAsianWidth.txt
+     file does not really matter for them; UAX #11 East Asian Width
+     <https://www.unicode.org/reports/tr11/> makes it clear that it focus
+     is on compatibility with traditional Japanese layout.
+     By contrast, the same glyphs without conjoining behaviour are available
+     in the U+3130..U+318F block, and these characters are mapped to legacy
+     character sets, and traditional Japanese layout matters for them.
+     2) glibc does the same thing, see
+     <https://sourceware.org/bugzilla/show_bug.cgi?id=21750>
+     <https://sourceware.org/bugzilla/show_bug.cgi?id=26120>
+ */
+#include "uniwidth/width0.h"
+
+#include "uniwidth/width2.h"
+#include "unictype/bitmap.h"
+
+#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
+
+
+/* Determine number of column positions required for UC.  */
+int
+uc_width (ucs4_t uc, const char *encoding)
+{
+  /* Test for non-spacing or control character.  */
+  if ((uc >> 9) < SIZEOF (nonspacing_table_ind))
+    {
+      int ind = nonspacing_table_ind[uc >> 9];
+      if (ind >= 0)
+        if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1)
+          {
+            if (uc > 0 && uc < 0xa0)
+              return -1;
+            else
+              return 0;
+          }
+    }
+  else if ((uc >> 9) == (0xe0000 >> 9))
+    {
+      if (uc >= 0xe0100)
+        {
+          if (uc <= 0xe01ef)
+            return 0;
+        }
+      else
+        {
+          if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001)
+            return 0;
+        }
+    }
+  /* Test for double-width character.  */
+  if (bitmap_lookup (&u_width2, uc))
+    return 2;
+  /* In ancient CJK encodings, Cyrillic and most other characters are
+     double-width as well.  */
+  if (uc >= 0x00A1 && uc < 0xFF61 && uc != 0x20A9
+      && is_cjk_encoding (encoding))
+    return 2;
+  return 1;
+}
deleted file mode 120000 (symlink)
index 51c4085bfd053369896daa5f75779802187261ca..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/uniwidth/width0.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0c1713ac524283ec871f823d2a0fecc1daa6adb1
--- /dev/null
@@ -0,0 +1,486 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Table of non-spacing or control characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+static const unsigned char nonspacing_table_data[48*64] = {
+  /* 0x0000-0x01ff */
+  0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */
+  0xff, 0xff, 0xff, 0xff, 0x00, 0x20, 0x00, 0x00, /* 0x0080-0x00bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00c0-0x00ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0100-0x013f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0140-0x017f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0180-0x01bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x01c0-0x01ff */
+  /* 0x0200-0x03ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0200-0x023f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0240-0x027f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0280-0x02bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x02c0-0x02ff */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x0300-0x033f */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* 0x0340-0x037f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0380-0x03bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x03c0-0x03ff */
+  /* 0x0400-0x05ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0400-0x043f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0440-0x047f */
+  0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0480-0x04bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04c0-0x04ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0500-0x053f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0540-0x057f */
+  0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, /* 0x0580-0x05bf */
+  0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */
+  /* 0x0600-0x07ff */
+  0x3f, 0x00, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */
+  0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */
+  0x00, 0x00, 0xc0, 0xbf, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */
+  0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x0700-0x073f */
+  0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0740-0x077f */
+  0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, /* 0x0780-0x07bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x20, /* 0x07c0-0x07ff */
+  /* 0x0800-0x09ff */
+  0x00, 0x00, 0xc0, 0xfb, 0xef, 0x3e, 0x00, 0x00, /* 0x0800-0x083f */
+  0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */
+  0x00, 0x00, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */
+  0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x08c0-0x08ff */
+  0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, /* 0x0900-0x093f */
+  0xfe, 0x21, 0xfe, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */
+  0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x40, /* 0x09c0-0x09ff */
+  /* 0x0a00-0x0bff */
+  0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a00-0x0a3f */
+  0x86, 0x39, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, /* 0x0a40-0x0a7f */
+  0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a80-0x0abf */
+  0xbe, 0x21, 0x00, 0x00, 0x0c, 0x00, 0x00, 0xfc, /* 0x0ac0-0x0aff */
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0x0b00-0x0b3f */
+  0x1e, 0x20, 0x60, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0b40-0x0b7f */
+  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b80-0x0bbf */
+  0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0bc0-0x0bff */
+  /* 0x0c00-0x0dff */
+  0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, /* 0x0c00-0x0c3f */
+  0xc1, 0x3d, 0x60, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0c40-0x0c7f */
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */
+  0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0cc0-0x0cff */
+  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, /* 0x0d00-0x0d3f */
+  0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0d40-0x0d7f */
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d80-0x0dbf */
+  0x00, 0x04, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0dc0-0x0dff */
+  /* 0x0e00-0x0fff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x07, /* 0x0e00-0x0e3f */
+  0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0e40-0x0e7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1f, /* 0x0e80-0x0ebf */
+  0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0ec0-0x0eff */
+  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xa0, 0x02, /* 0x0f00-0x0f3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, /* 0x0f40-0x0f7f */
+  0xdf, 0xe0, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */
+  0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0fc0-0x0fff */
+  /* 0x1000-0x11ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xfd, 0x66, /* 0x1000-0x103f */
+  0x00, 0x00, 0x00, 0xc3, 0x01, 0x00, 0x1e, 0x00, /* 0x1040-0x107f */
+  0x64, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */
+  0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x1140-0x117f */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x1180-0x11bf */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x11c0-0x11ff */
+  /* 0x1200-0x13ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1200-0x123f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1240-0x127f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1280-0x12bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x12c0-0x12ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1300-0x133f */
+  0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, /* 0x1340-0x137f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1380-0x13bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13c0-0x13ff */
+  /* 0x1600-0x17ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1600-0x163f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1640-0x167f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1680-0x16bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16c0-0x16ff */
+  0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1700-0x173f */
+  0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1740-0x177f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f, /* 0x1780-0x17bf */
+  0x40, 0xfe, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x17c0-0x17ff */
+  /* 0x1800-0x19ff */
+  0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */
+  0x60, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */
+  0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x04, 0x0e, /* 0x1900-0x193f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1940-0x197f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1980-0x19bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */
+  /* 0x1a00-0x1bff */
+  0x00, 0x00, 0x80, 0x09, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */
+  0x00, 0x00, 0x40, 0x7f, 0xe5, 0x1f, 0xf8, 0x9f, /* 0x1a40-0x1a7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x1a80-0x1abf */
+  0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ac0-0x1aff */
+  0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x17, /* 0x1b00-0x1b3f */
+  0x04, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x1b40-0x1b7f */
+  0x03, 0x00, 0x00, 0x00, 0x3c, 0x3b, 0x00, 0x00, /* 0x1b80-0x1bbf */
+  0x00, 0x00, 0x00, 0x00, 0x40, 0xa3, 0x03, 0x00, /* 0x1bc0-0x1bff */
+  /* 0x1c00-0x1dff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0x00, /* 0x1c00-0x1c3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c40-0x1c7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c80-0x1cbf */
+  0x00, 0x00, 0xf7, 0xff, 0xfd, 0x21, 0x10, 0x03, /* 0x1cc0-0x1cff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x1dc0-0x1dff */
+  /* 0x2000-0x21ff */
+  0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */
+  0x00, 0x00, 0x00, 0x00, 0xdf, 0xff, 0x00, 0x00, /* 0x2040-0x207f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2080-0x20bf */
+  0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* 0x20c0-0x20ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2100-0x213f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2140-0x217f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2180-0x21bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x21c0-0x21ff */
+  /* 0x2c00-0x2dff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c00-0x2c3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c40-0x2c7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c80-0x2cbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, /* 0x2cc0-0x2cff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d00-0x2d3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x2d40-0x2d7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d80-0x2dbf */
+  0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x2dc0-0x2dff */
+  /* 0x3000-0x31ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x3000-0x303f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3040-0x307f */
+  0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, /* 0x3080-0x30bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30c0-0x30ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3100-0x313f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3140-0x317f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3180-0x31bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x31c0-0x31ff */
+  /* 0xa600-0xa7ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa600-0xa63f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf7, 0x3f, /* 0xa640-0xa67f */
+  0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, /* 0xa680-0xa6bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0xa6c0-0xa6ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa700-0xa73f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa740-0xa77f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa780-0xa7bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa7c0-0xa7ff */
+  /* 0xa800-0xa9ff */
+  0x44, 0x08, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, /* 0xa800-0xa83f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa840-0xa87f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa880-0xa8bf */
+  0x30, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x80, /* 0xa8c0-0xa8ff */
+  0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, /* 0xa900-0xa93f */
+  0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */
+  0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x33, /* 0xa980-0xa9bf */
+  0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */
+  /* 0xaa00-0xabff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x66, 0x00, /* 0xaa00-0xaa3f */
+  0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0xaa40-0xaa7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0xc1, /* 0xaa80-0xaabf */
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x30, 0x40, 0x00, /* 0xaac0-0xaaff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab00-0xab3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab40-0xab7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab80-0xabbf */
+  0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x00, 0x00, /* 0xabc0-0xabff */
+  /* 0xd600-0xd7ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd600-0xd63f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd640-0xd67f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd680-0xd6bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd6c0-0xd6ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd700-0xd73f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd740-0xd77f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0xd780-0xd7bf */
+  0x7f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, /* 0xd7c0-0xd7ff */
+  /* 0xfa00-0xfbff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa80-0xfabf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfac0-0xfaff */
+  0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0xfb00-0xfb3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb40-0xfb7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb80-0xfbbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfbc0-0xfbff */
+  /* 0xfe00-0xffff */
+  0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, /* 0xfe00-0xfe3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe40-0xfe7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe80-0xfebf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0xfec0-0xfeff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff00-0xff3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff40-0xff7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff80-0xffbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, /* 0xffc0-0xffff */
+  /* 0x10000-0x101ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10000-0x1003f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10040-0x1007f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10080-0x100bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x100c0-0x100ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10100-0x1013f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10140-0x1017f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10180-0x101bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, /* 0x101c0-0x101ff */
+  /* 0x10200-0x103ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10200-0x1023f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10240-0x1027f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10280-0x102bf */
+  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* 0x102c0-0x102ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10300-0x1033f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, /* 0x10340-0x1037f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10380-0x103bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x103c0-0x103ff */
+  /* 0x10a00-0x10bff */
+  0x6e, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, /* 0x10a00-0x10a3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a40-0x10a7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a80-0x10abf */
+  0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0x10ac0-0x10aff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b00-0x10b3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b40-0x10b7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b80-0x10bbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10bc0-0x10bff */
+  /* 0x10c00-0x10dff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c00-0x10c3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c40-0x10c7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c80-0x10cbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10cc0-0x10cff */
+  0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, /* 0x10d00-0x10d3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10d40-0x10d7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10d80-0x10dbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10dc0-0x10dff */
+  /* 0x10e00-0x10fff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10e00-0x10e3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10e40-0x10e7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, /* 0x10e80-0x10ebf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, /* 0x10ec0-0x10eff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10f00-0x10f3f */
+  0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10f40-0x10f7f */
+  0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10f80-0x10fbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10fc0-0x10fff */
+  /* 0x11000-0x111ff */
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11000-0x1103f */
+  0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x80, /* 0x11040-0x1107f */
+  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x26, /* 0x11080-0x110bf */
+  0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x110c0-0x110ff */
+  0x07, 0x00, 0x00, 0x00, 0x80, 0xef, 0x1f, 0x00, /* 0x11100-0x1113f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, /* 0x11140-0x1117f */
+  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, /* 0x11180-0x111bf */
+  0x00, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x111c0-0x111ff */
+  /* 0x11200-0x113ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd3, 0x40, /* 0x11200-0x1123f */
+  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11240-0x1127f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11280-0x112bf */
+  0x00, 0x00, 0x00, 0x80, 0xf8, 0x07, 0x00, 0x00, /* 0x112c0-0x112ff */
+  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, /* 0x11300-0x1133f */
+  0x01, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x1f, 0x00, /* 0x11340-0x1137f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11380-0x113bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x113c0-0x113ff */
+  /* 0x11400-0x115ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11400-0x1143f */
+  0x5c, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0x11440-0x1147f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x85, /* 0x11480-0x114bf */
+  0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x114c0-0x114ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11500-0x1153f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11540-0x1157f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xb0, /* 0x11580-0x115bf */
+  0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, /* 0x115c0-0x115ff */
+  /* 0x11600-0x117ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xa7, /* 0x11600-0x1163f */
+  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11640-0x1167f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0xbf, 0x00, /* 0x11680-0x116bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x116c0-0x116ff */
+  0x00, 0x00, 0x00, 0xe0, 0xbc, 0x0f, 0x00, 0x00, /* 0x11700-0x1173f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11740-0x1177f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11780-0x117bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x117c0-0x117ff */
+  /* 0x11800-0x119ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x06, /* 0x11800-0x1183f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11840-0x1187f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11880-0x118bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x118c0-0x118ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, /* 0x11900-0x1193f */
+  0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11940-0x1197f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11980-0x119bf */
+  0x00, 0x00, 0xf0, 0x0c, 0x01, 0x00, 0x00, 0x00, /* 0x119c0-0x119ff */
+  /* 0x11a00-0x11bff */
+  0x7e, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x79, /* 0x11a00-0x11a3f */
+  0x80, 0x00, 0x7e, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x11a40-0x11a7f */
+  0x00, 0xfc, 0x7f, 0x03, 0x00, 0x00, 0x00, 0x00, /* 0x11a80-0x11abf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11ac0-0x11aff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11b00-0x11b3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11b40-0x11b7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11b80-0x11bbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11bc0-0x11bff */
+  /* 0x11c00-0x11dff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x3f, /* 0x11c00-0x11c3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c40-0x11c7f */
+  0x00, 0x00, 0xfc, 0xff, 0xff, 0xfc, 0x6d, 0x00, /* 0x11c80-0x11cbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11cc0-0x11cff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xb4, /* 0x11d00-0x11d3f */
+  0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d40-0x11d7f */
+  0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d80-0x11dbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11dc0-0x11dff */
+  /* 0x11e00-0x11fff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11e00-0x11e3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11e40-0x11e7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11e80-0x11ebf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, /* 0x11ec0-0x11eff */
+  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, /* 0x11f00-0x11f3f */
+  0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11f40-0x11f7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11f80-0x11fbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11fc0-0x11fff */
+  /* 0x13400-0x135ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x13400-0x1343f */
+  0x81, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13440-0x1347f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13480-0x134bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x134c0-0x134ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13500-0x1353f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13540-0x1357f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13580-0x135bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x135c0-0x135ff */
+  /* 0x16a00-0x16bff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a00-0x16a3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a40-0x16a7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a80-0x16abf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, /* 0x16ac0-0x16aff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, /* 0x16b00-0x16b3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b40-0x16b7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b80-0x16bbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16bc0-0x16bff */
+  /* 0x16e00-0x16fff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e00-0x16e3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e40-0x16e7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e80-0x16ebf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16ec0-0x16eff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f00-0x16f3f */
+  0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f40-0x16f7f */
+  0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f80-0x16fbf */
+  0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, /* 0x16fc0-0x16fff */
+  /* 0x1bc00-0x1bdff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc00-0x1bc3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc40-0x1bc7f */
+  0x00, 0x00, 0x00, 0x60, 0x0f, 0x00, 0x00, 0x00, /* 0x1bc80-0x1bcbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bcc0-0x1bcff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd00-0x1bd3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd40-0x1bd7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd80-0x1bdbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bdc0-0x1bdff */
+  /* 0x1ce00-0x1cfff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ce00-0x1ce3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ce40-0x1ce7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ce80-0x1cebf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cec0-0x1ceff */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, /* 0x1cf00-0x1cf3f */
+  0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cf40-0x1cf7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cf80-0x1cfbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cfc0-0x1cfff */
+  /* 0x1d000-0x1d1ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d080-0x1d0bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d0c0-0x1d0ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d100-0x1d13f */
+  0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xf8, 0xff, /* 0x1d140-0x1d17f */
+  0xe7, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x1d180-0x1d1bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d1c0-0x1d1ff */
+  /* 0x1d200-0x1d3ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d200-0x1d23f */
+  0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d240-0x1d27f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d280-0x1d2bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d2c0-0x1d2ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d300-0x1d33f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d340-0x1d37f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d380-0x1d3bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d3c0-0x1d3ff */
+  /* 0x1da00-0x1dbff */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf8, /* 0x1da00-0x1da3f */
+  0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x20, 0x00, /* 0x1da40-0x1da7f */
+  0x10, 0x00, 0x00, 0xf8, 0xfe, 0xff, 0x00, 0x00, /* 0x1da80-0x1dabf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dac0-0x1daff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db00-0x1db3f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db40-0x1db7f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db80-0x1dbbf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dbc0-0x1dbff */
+  /* 0x1e000-0x1e1ff */
+  0x7f, 0xff, 0xff, 0xf9, 0xdb, 0x07, 0x00, 0x00, /* 0x1e000-0x1e03f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e040-0x1e07f */
+  0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e080-0x1e0bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e0c0-0x1e0ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, /* 0x1e100-0x1e13f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e140-0x1e17f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e180-0x1e1bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e1c0-0x1e1ff */
+  /* 0x1e200-0x1e3ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e200-0x1e23f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e240-0x1e27f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, /* 0x1e280-0x1e2bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, /* 0x1e2c0-0x1e2ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e300-0x1e33f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e340-0x1e37f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e380-0x1e3bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e3c0-0x1e3ff */
+  /* 0x1e400-0x1e5ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e400-0x1e43f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e440-0x1e47f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e480-0x1e4bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, /* 0x1e4c0-0x1e4ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e500-0x1e53f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e540-0x1e57f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e580-0x1e5bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e5c0-0x1e5ff */
+  /* 0x1e800-0x1e9ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e800-0x1e83f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e840-0x1e87f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e880-0x1e8bf */
+  0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e8c0-0x1e8ff */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e900-0x1e93f */
+  0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e940-0x1e97f */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e980-0x1e9bf */
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  /* 0x1e9c0-0x1e9ff */
+};
+static const signed char nonspacing_table_ind[248] = {
+   0,  1,  2,  3,  4,  5,  6,  7, /* 0x0000-0x0fff */
+   8,  9, -1, 10, 11, 12, 13, -1, /* 0x1000-0x1fff */
+  14, -1, -1, -1, -1, -1, 15, -1, /* 0x2000-0x2fff */
+  16, -1, -1, -1, -1, -1, -1, -1, /* 0x3000-0x3fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x4000-0x4fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x5000-0x5fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x6000-0x6fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x7000-0x7fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x8000-0x8fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9000-0x9fff */
+  -1, -1, -1, 17, 18, 19, -1, -1, /* 0xa000-0xafff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */
+  -1, -1, -1, 20, -1, -1, -1, -1, /* 0xd000-0xdfff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */
+  -1, -1, -1, -1, -1, 21, -1, 22, /* 0xf000-0xffff */
+  23, 24, -1, -1, -1, 25, 26, 27, /* 0x10000-0x10fff */
+  28, 29, 30, 31, 32, 33, 34, 35, /* 0x11000-0x11fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */
+  -1, -1, 36, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */
+  -1, -1, -1, -1, -1, 37, -1, 38, /* 0x16000-0x16fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */
+  -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */
+  -1, -1, -1, -1, -1, -1, 39, -1, /* 0x1b000-0x1bfff */
+  -1, -1, -1, -1, -1, -1, -1, 40, /* 0x1c000-0x1cfff */
+  41, 42, -1, -1, -1, 43, -1, -1, /* 0x1d000-0x1dfff */
+  44, 45, 46, -1, 47, -1, -1, -1  /* 0x1e000-0x1efff */
+};
deleted file mode 120000 (symlink)
index 78238cba90ed6a2af13175fb5422392dd5c2bf09..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/uniwidth/width2.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..19c8c02a51cab339b6324b894b6259a418ed1c40
--- /dev/null
@@ -0,0 +1,541 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/* Width 2 property of Unicode characters.  */
+/* Generated automatically by gen-uni-tables.c for Unicode 15.0.0.  */
+
+/* Copyright (C) 2000-2022 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define header_0 16
+#define header_2 9
+#define header_3 127
+#define header_4 15
+static const
+struct
+  {
+    int header[1];
+    int level1[4];
+    short level2[3 << 7];
+    unsigned int level3[28 << 4];
+  }
+u_width2 =
+{
+  { 4 },
+  {
+        5 * sizeof (int) / sizeof (short) +     0,
+        5 * sizeof (int) / sizeof (short) +   128,
+        5 * sizeof (int) / sizeof (short) +   256,
+        5 * sizeof (int) / sizeof (short) +   256
+  },
+  {
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +     0,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +    16,
+        5 +   384 * sizeof (short) / sizeof (int) +    32,
+        5 +   384 * sizeof (short) / sizeof (int) +    48,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +    64,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +    80,
+        5 +   384 * sizeof (short) / sizeof (int) +    96,
+        5 +   384 * sizeof (short) / sizeof (int) +   112,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   144,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   160,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +   176,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   192,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +   208,
+        5 +   384 * sizeof (short) / sizeof (int) +   224,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +   240,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +   256,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   272,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   288,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +   304,
+        5 +   384 * sizeof (short) / sizeof (int) +   320,
+        5 +   384 * sizeof (short) / sizeof (int) +   336,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +   352,
+        5 +   384 * sizeof (short) / sizeof (int) +   368,
+        5 +   384 * sizeof (short) / sizeof (int) +   384,
+        5 +   384 * sizeof (short) / sizeof (int) +   400,
+        5 +   384 * sizeof (short) / sizeof (int) +   416,
+        5 +   384 * sizeof (short) / sizeof (int) +   432,
+       -1,
+       -1,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128,
+        5 +   384 * sizeof (short) / sizeof (int) +   128
+  },
+  {
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x0C000000U, 0x00000600U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00091E00U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x60000000U,
+    0x00300000U, 0x00000000U, 0x000FFF00U, 0x80000000U,
+    0x00080000U, 0x60000C02U, 0x00104030U, 0x242C0400U,
+    0x00000C20U, 0x00000100U, 0x00B85000U, 0x00000000U,
+    0x00E00000U, 0x80010000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x18000000U, 0x00000000U, 0x00210000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x1FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x0000000FU, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFF0000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x0000FFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000001U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x0000007FU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x0003000FU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U,
+    0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0x00000007U, 0x00070000U, 0xFFFF00F0U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000010U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00008000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x07FE4000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFBFE001U, 0xFFFFFFFFU, 0xDFFFFFFFU,
+    0x000FFFFFU, 0xFFFFFFFFU, 0x000F87FFU, 0xFF11FFFFU,
+    0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFFFFFDU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x9FFFFFFFU,
+    0xFFFFFFFFU, 0x3FFFFFFFU, 0xFFFF7800U, 0x040000FFU,
+    0x00600000U, 0x00000010U, 0x00000000U, 0xF8000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xE0E7103FU, 0x1FF01800U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00010FFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0xFFFFF000U, 0xF7FFFFFFU, 0xFFFFFFBFU, 0xFFFFFFFFU,
+    0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x1F1F0000U,
+    0xFFFF007FU, 0x07FF1FFFU, 0x03FF003FU, 0x007F00FFU,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
+    0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
+  }
+};
deleted file mode 120000 (symlink)
index 8006b9eb11b79975acc2b8e058f7888666b93324..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unlink.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ca656e3999e9d86e3473e4af40a11fd106cf697f
--- /dev/null
@@ -0,0 +1,98 @@
+/* Work around unlink bugs.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "filename.h"
+
+#undef unlink
+#if defined _WIN32 && !defined __CYGWIN__
+# define unlink _unlink
+#endif
+
+/* Remove file NAME.
+   Return 0 if successful, -1 if not.  */
+
+int
+rpl_unlink (char const *name)
+{
+  /* Work around Solaris 9 bug where unlink("file/") succeeds.  */
+  size_t len = strlen (name);
+  int result = 0;
+  if (len && ISSLASH (name[len - 1]))
+    {
+      /* We can't unlink(2) something if it doesn't exist.  If it does
+         exist, then it resolved to a directory, due to the trailing
+         slash, and POSIX requires that the unlink attempt to remove
+         that directory (which would leave the symlink dangling).
+         Unfortunately, Solaris 9 is one of the platforms where the
+         root user can unlink directories, and we don't want to
+         cripple this behavior on real directories, even if it is
+         seldom needed (at any rate, it's nicer to let coreutils'
+         unlink(1) give the correct errno for non-root users).  But we
+         don't know whether name was an actual directory, or a symlink
+         to a directory; and due to the bug of ignoring trailing
+         slash, Solaris 9 would end up successfully unlinking the
+         symlink instead of the directory.  Technically, we could use
+         realpath to find the canonical directory name to attempt
+         deletion on.  But that is a lot of work for a corner case; so
+         we instead just use an lstat on the shortened name, and
+         reject symlinks with trailing slashes.  The root user of
+         unlink(1) will just have to live with the rule that they
+         can't delete a directory via a symlink.  */
+      struct stat st;
+      result = lstat (name, &st);
+      if (result == 0 || errno == EOVERFLOW)
+        {
+          /* Trailing NUL will overwrite the trailing slash.  */
+          char *short_name = malloc (len);
+          if (!short_name)
+            return -1;
+          memcpy (short_name, name, len);
+          while (len && ISSLASH (short_name[len - 1]))
+            short_name[--len] = '\0';
+          if (len && (lstat (short_name, &st) || S_ISLNK (st.st_mode)))
+            {
+              free (short_name);
+              errno = EPERM;
+              return -1;
+            }
+          free (short_name);
+          result = 0;
+        }
+    }
+  if (!result)
+    {
+#if UNLINK_PARENT_BUG
+      if (len >= 2 && name[len - 1] == '.' && name[len - 2] == '.'
+          && (len == 2 || ISSLASH (name[len - 3])))
+        {
+          errno = EISDIR; /* could also use EPERM */
+          return -1;
+        }
+#endif
+      result = unlink (name);
+    }
+  return result;
+}
deleted file mode 120000 (symlink)
index 25182fd043668f6fe3e82036b0b333d6719c6272..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unlinkat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f797f152dd3d94c3d150c5e6c3c4603842a6538d
--- /dev/null
@@ -0,0 +1,124 @@
+/* Work around unlinkat bugs on Solaris 9 and Hurd.
+
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <stdlib.h>
+
+#include "filename.h"
+#include "openat.h"
+
+#if HAVE_UNLINKAT
+
+# undef unlinkat
+
+/* unlinkat without AT_REMOVEDIR does not honor trailing / on Solaris 9.
+   Hurd has the same issue.
+
+   unlinkat without AT_REMOVEDIR erroneously ignores ".." on Darwin 14.
+
+   Solve these in a similar manner to unlink.  */
+
+int
+rpl_unlinkat (int fd, char const *name, int flag)
+{
+  size_t len;
+  int result = 0;
+  /* rmdir behavior has no problems with trailing slash.  */
+  if (flag & AT_REMOVEDIR)
+    return unlinkat (fd, name, flag);
+
+  len = strlen (name);
+  if (len && ISSLASH (name[len - 1]))
+    {
+      /* See the lengthy comment in unlink.c why we disobey the POSIX
+         rule of letting unlink("link-to-dir/") attempt to unlink a
+         directory.  */
+      struct stat st;
+      result = fstatat (fd, name, &st, AT_SYMLINK_NOFOLLOW);
+      if (result == 0 || errno == EOVERFLOW)
+        {
+          /* Trailing NUL will overwrite the trailing slash.  */
+          char *short_name = malloc (len);
+          if (!short_name)
+            {
+              errno = EPERM;
+              return -1;
+            }
+          memcpy (short_name, name, len);
+          while (len && ISSLASH (short_name[len - 1]))
+            short_name[--len] = '\0';
+          if (len && (fstatat (fd, short_name, &st, AT_SYMLINK_NOFOLLOW)
+                      || S_ISLNK (st.st_mode)))
+            {
+              free (short_name);
+              errno = EPERM;
+              return -1;
+            }
+          free (short_name);
+          result = 0;
+        }
+    }
+  if (!result)
+    {
+# if UNLINK_PARENT_BUG
+      if (len >= 2 && name[len - 1] == '.' && name[len - 2] == '.'
+          && (len == 2 || ISSLASH (name[len - 3])))
+        {
+          errno = EISDIR; /* could also use EPERM */
+          return -1;
+        }
+# endif
+      result = unlinkat (fd, name, flag);
+    }
+  return result;
+}
+
+#else /* !HAVE_UNLINKAT */
+
+/* Replacement for Solaris' function by the same name.
+   <https://www.google.com/search?q=unlinkat+site:docs.oracle.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 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
+
+#endif /* !HAVE_UNLINKAT */
deleted file mode 120000 (symlink)
index c5d15c7c69ecfe0741e6b6e5b9e0dcfd45619f78..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unlinkdir.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bb71cb88b2a3d7b2e5270afaf708cd381d2ecbaf
--- /dev/null
@@ -0,0 +1,55 @@
+/* unlinkdir.c - determine whether we can unlink directories
+
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, Jim Meyering, and David Bartley.  */
+
+#include <config.h>
+
+#include "unlinkdir.h"
+#include "priv-set.h"
+#include "root-uid.h"
+#include <unistd.h>
+
+#if ! UNLINK_CANNOT_UNLINK_DIR
+
+/* Return true if we cannot unlink directories, false if we might be
+   able to unlink directories.  */
+
+bool
+cannot_unlink_dir (void)
+{
+  static bool initialized;
+  static bool cannot;
+
+  if (! initialized)
+    {
+# if defined PRIV_SYS_LINKDIR
+      /* We might be able to unlink directories if we cannot
+         determine our privileges, or if we have the
+         PRIV_SYS_LINKDIR privilege.  */
+      cannot = (priv_set_ismember (PRIV_SYS_LINKDIR) == 0);
+# else
+      /* In traditional Unix, only root can unlink directories.  */
+      cannot = (geteuid () != ROOT_UID);
+# endif
+      initialized = true;
+    }
+
+  return cannot;
+}
+
+#endif
deleted file mode 120000 (symlink)
index d01e91893f2cd13e53c88017996cf80051c1cfd9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unlinkdir.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..955ea48b860c4d60bfcfb8b99d721370d80eb393
--- /dev/null
@@ -0,0 +1,24 @@
+/* unlinkdir.h - determine (and maybe change) whether we can unlink directories
+
+   Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Jim Meyering.  */
+
+#if UNLINK_CANNOT_UNLINK_DIR
+# define cannot_unlink_dir() true
+#else
+bool cannot_unlink_dir (void);
+#endif
deleted file mode 120000 (symlink)
index a141761d9d6f7debca558ffb00779a2785bca245..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unlocked-io.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0cd9bbf3c98c51254f3f99253f0436c213110a96
--- /dev/null
@@ -0,0 +1,141 @@
+/* Prefer faster, non-thread-safe stdio functions if available.
+
+   Copyright (C) 2001-2004, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#ifndef UNLOCKED_IO_H
+# define UNLOCKED_IO_H 1
+
+/* These are wrappers for functions/macros from the GNU C library, and
+   from other C libraries supporting POSIX's optional thread-safe functions.
+
+   The standard I/O functions are thread-safe.  These *_unlocked ones are
+   more efficient but not thread-safe.  That they're not thread-safe is
+   fine since all of the applications in this package are single threaded.
+
+   Also, some code that is shared with the GNU C library may invoke
+   the *_unlocked functions directly.  On hosts that lack those
+   functions, invoke the non-thread-safe versions instead.  */
+
+/* This file uses HAVE_DECL_*_UNLOCKED.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <stdio.h>
+
+# if HAVE_DECL_CLEARERR_UNLOCKED || defined clearerr_unlocked
+#  undef clearerr
+#  define clearerr(x) clearerr_unlocked (x)
+# else
+#  define clearerr_unlocked(x) clearerr (x)
+# endif
+
+# if HAVE_DECL_FEOF_UNLOCKED || defined feof_unlocked
+#  undef feof
+#  define feof(x) feof_unlocked (x)
+# else
+#  define feof_unlocked(x) feof (x)
+# endif
+
+# if HAVE_DECL_FERROR_UNLOCKED || defined ferror_unlocked
+#  undef ferror
+#  define ferror(x) ferror_unlocked (x)
+# else
+#  define ferror_unlocked(x) ferror (x)
+# endif
+
+# if HAVE_DECL_FFLUSH_UNLOCKED || defined fflush_unlocked
+#  undef fflush
+#  define fflush(x) fflush_unlocked (x)
+# else
+#  define fflush_unlocked(x) fflush (x)
+# endif
+
+# if HAVE_DECL_FGETS_UNLOCKED || defined fgets_unlocked
+#  undef fgets
+#  define fgets(x,y,z) fgets_unlocked (x,y,z)
+# else
+#  define fgets_unlocked(x,y,z) fgets (x,y,z)
+# endif
+
+# if HAVE_DECL_FPUTC_UNLOCKED || defined fputc_unlocked
+#  undef fputc
+#  define fputc(x,y) fputc_unlocked (x,y)
+# else
+#  define fputc_unlocked(x,y) fputc (x,y)
+# endif
+
+# if HAVE_DECL_FPUTS_UNLOCKED || defined fputs_unlocked
+#  undef fputs
+#  define fputs(x,y) fputs_unlocked (x,y)
+# else
+#  define fputs_unlocked(x,y) fputs (x,y)
+# endif
+
+# if HAVE_DECL_FREAD_UNLOCKED || defined fread_unlocked
+#  undef fread
+#  define fread(w,x,y,z) fread_unlocked (w,x,y,z)
+# else
+#  define fread_unlocked(w,x,y,z) fread (w,x,y,z)
+# endif
+
+# if HAVE_DECL_FWRITE_UNLOCKED || defined fwrite_unlocked
+#  undef fwrite
+#  define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
+# else
+#  define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
+# endif
+
+# if HAVE_DECL_GETC_UNLOCKED || defined getc_unlocked
+#  undef getc
+#  define getc(x) getc_unlocked (x)
+# else
+#  define getc_unlocked(x) getc (x)
+# endif
+
+# if HAVE_DECL_GETCHAR_UNLOCKED || defined getchar_unlocked
+#  undef getchar
+#  define getchar() getchar_unlocked ()
+# else
+#  define getchar_unlocked() getchar ()
+# endif
+
+# if HAVE_DECL_PUTC_UNLOCKED || defined putc_unlocked
+#  undef putc
+#  define putc(x,y) putc_unlocked (x,y)
+# else
+#  define putc_unlocked(x,y) putc (x,y)
+# endif
+
+# if HAVE_DECL_PUTCHAR_UNLOCKED || defined putchar_unlocked
+#  undef putchar
+#  define putchar(x) putchar_unlocked (x)
+# else
+#  define putchar_unlocked(x) putchar (x)
+# endif
+
+# undef flockfile
+# define flockfile(x) ((void) 0)
+
+# undef ftrylockfile
+# define ftrylockfile(x) 0
+
+# undef funlockfile
+# define funlockfile(x) ((void) 0)
+
+#endif /* UNLOCKED_IO_H */
deleted file mode 120000 (symlink)
index 3cccf2a9d136de0d726a14d3c016f2791689aad5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/unsetenv.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d8ada2aaed83ce17dc07e557c48498e51ccbd8eb
--- /dev/null
@@ -0,0 +1,127 @@
+/* Copyright (C) 1992, 1995-2002, 2005-2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the name == NULL test below.  */
+#define _GL_ARG_NONNULL(params)
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdlib.h>
+
+#include <errno.h>
+#if !_LIBC
+# define __set_errno(ev) ((errno) = (ev))
+#endif
+
+#include <string.h>
+#include <unistd.h>
+
+#if !_LIBC
+# define __environ      environ
+#endif
+
+#if _LIBC
+/* This lock protects against simultaneous modifications of 'environ'.  */
+# include <bits/libc-lock.h>
+__libc_lock_define_initialized (static, envlock)
+# define LOCK   __libc_lock_lock (envlock)
+# define UNLOCK __libc_lock_unlock (envlock)
+#else
+# define LOCK
+# define UNLOCK
+#endif
+
+/* In the GNU C library we must keep the namespace clean.  */
+#ifdef _LIBC
+# define unsetenv __unsetenv
+#endif
+
+#if _LIBC || !HAVE_UNSETENV
+
+int
+unsetenv (const char *name)
+{
+  size_t len;
+  char **ep;
+
+  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  len = strlen (name);
+
+  LOCK;
+
+  ep = __environ;
+  while (*ep != NULL)
+    if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+      {
+        /* Found it.  Remove this pointer by moving later ones back.  */
+        char **dp = ep;
+
+        do
+          dp[0] = dp[1];
+        while (*dp++);
+        /* Continue the loop in case NAME appears again.  */
+      }
+    else
+      ++ep;
+
+  UNLOCK;
+
+  return 0;
+}
+
+#ifdef _LIBC
+# undef unsetenv
+weak_alias (__unsetenv, unsetenv)
+#endif
+
+#else /* HAVE_UNSETENV */
+
+# undef unsetenv
+# if !HAVE_DECL_UNSETENV
+#  if VOID_UNSETENV
+extern void unsetenv (const char *);
+#  else
+extern int unsetenv (const char *);
+#  endif
+# endif
+
+/* Call the underlying unsetenv, in case there is hidden bookkeeping
+   that needs updating beyond just modifying environ.  */
+int
+rpl_unsetenv (const char *name)
+{
+  int result = 0;
+  if (!name || !*name || strchr (name, '='))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  while (getenv (name))
+# if !VOID_UNSETENV
+    result =
+# endif
+      unsetenv (name);
+  return result;
+}
+
+#endif /* HAVE_UNSETENV */
deleted file mode 120000 (symlink)
index e0fea18001fac42d65d93e7ebdae2011244eeb15..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/userspec.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..833f7f58d77e06ea05c6d6b2f2f3fde94d9644ca
--- /dev/null
@@ -0,0 +1,335 @@
+/* userspec.c -- Parse a user and group string.
+   Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "userspec.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <grp.h>
+
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <unistd.h>
+
+#include "intprops.h"
+#include "inttostr.h"
+#include "xalloc.h"
+#include "xstrtol.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+#ifndef HAVE_ENDGRENT
+# define endgrent() ((void) 0)
+#endif
+
+#ifndef HAVE_ENDPWENT
+# define endpwent() ((void) 0)
+#endif
+
+#ifndef UID_T_MAX
+# define UID_T_MAX TYPE_MAXIMUM (uid_t)
+#endif
+
+#ifndef GID_T_MAX
+# define GID_T_MAX TYPE_MAXIMUM (gid_t)
+#endif
+
+/* MAXUID may come from limits.h or sys/params.h.  */
+#ifndef MAXUID
+# define MAXUID UID_T_MAX
+#endif
+#ifndef MAXGID
+# define MAXGID GID_T_MAX
+#endif
+
+#ifdef __DJGPP__
+
+/* ISDIGIT differs from isdigit, as follows:
+   - Its arg may be any int or unsigned int; it need not be an unsigned char
+     or EOF.
+   - It's typically faster.
+   POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
+   isdigit unless it's important to use the locale's definition
+   of "digit" even when the host does not conform to POSIX.  */
+# define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
+
+/* Return true if STR represents an unsigned decimal integer.  */
+
+static bool
+is_number (const char *str)
+{
+  do
+    {
+      if (!ISDIGIT (*str))
+        return false;
+    }
+  while (*++str);
+
+  return true;
+}
+#endif
+
+static char const *
+parse_with_separator (char const *spec, char const *separator,
+                      uid_t *uid, gid_t *gid,
+                      char **username, char **groupname)
+{
+  const char *error_msg;
+  struct passwd *pwd;
+  struct group *grp;
+  char *u;
+  char const *g;
+  char *gname = NULL;
+  uid_t unum = *uid;
+  gid_t gnum = gid ? *gid : -1;
+
+  error_msg = NULL;
+  if (username)
+    *username = NULL;
+  if (groupname)
+    *groupname = NULL;
+
+  /* Set U and G to nonzero length strings corresponding to user and
+     group specifiers or to NULL.  If U is not NULL, it is a newly
+     allocated string.  */
+
+  u = NULL;
+  if (separator == NULL)
+    {
+      if (*spec)
+        u = xstrdup (spec);
+    }
+  else
+    {
+      idx_t ulen = separator - spec;
+      if (ulen != 0)
+        {
+          u = ximemdup (spec, ulen + 1);
+          u[ulen] = '\0';
+        }
+    }
+
+  g = (separator == NULL || *(separator + 1) == '\0'
+       ? NULL
+       : separator + 1);
+
+#ifdef __DJGPP__
+  /* Pretend that we are the user U whose group is G.  This makes
+     pwd and grp functions "know" about the UID and GID of these.  */
+  if (u && !is_number (u))
+    setenv ("USER", u, 1);
+  if (g && !is_number (g))
+    setenv ("GROUP", g, 1);
+#endif
+
+  if (u != NULL)
+    {
+      /* If it starts with "+", skip the look-up.  */
+      pwd = (*u == '+' ? NULL : getpwnam (u));
+      if (pwd == NULL)
+        {
+          username = NULL;
+          bool use_login_group = (separator != NULL && g == NULL);
+          if (use_login_group)
+            {
+              /* If there is no group,
+                 then there may not be a trailing ":", either.  */
+              error_msg = N_("invalid spec");
+            }
+          else
+            {
+              unsigned long int tmp;
+              if (xstrtoul (u, NULL, 10, &tmp, "") == LONGINT_OK
+                  && tmp <= MAXUID && (uid_t) tmp != (uid_t) -1)
+                unum = tmp;
+              else
+                error_msg = N_("invalid user");
+            }
+        }
+      else
+        {
+          unum = pwd->pw_uid;
+          if (g == NULL && separator != NULL)
+            {
+              /* A separator was given, but a group was not specified,
+                 so get the login group.  */
+              char buf[INT_BUFSIZE_BOUND (uintmax_t)];
+              gnum = pwd->pw_gid;
+              grp = getgrgid (gnum);
+              gname = xstrdup (grp ? grp->gr_name : umaxtostr (gnum, buf));
+              endgrent ();
+            }
+        }
+      endpwent ();
+    }
+
+  if (g != NULL && error_msg == NULL)
+    {
+      /* Explicit group.  */
+      /* If it starts with "+", skip the look-up.  */
+      grp = (*g == '+' ? NULL : getgrnam (g));
+      if (grp == NULL)
+        {
+          groupname = NULL;
+          unsigned long int tmp;
+          if (xstrtoul (g, NULL, 10, &tmp, "") == LONGINT_OK
+              && tmp <= MAXGID && (gid_t) tmp != (gid_t) -1)
+            gnum = tmp;
+          else
+            error_msg = N_("invalid group");
+        }
+      else
+        gnum = grp->gr_gid;
+      endgrent ();              /* Save a file descriptor.  */
+      gname = xstrdup (g);
+    }
+
+  if (error_msg == NULL)
+    {
+      *uid = unum;
+      if (gid)
+        *gid = gnum;
+      if (username)
+        {
+          *username = u;
+          u = NULL;
+        }
+      if (groupname)
+        {
+          *groupname = gname;
+          gname = NULL;
+        }
+    }
+
+  free (u);
+  free (gname);
+  return error_msg ? _(error_msg) : NULL;
+}
+
+/* Extract from SPEC, which has the form "[user][:.][group]",
+   a USERNAME, UID U, GROUPNAME, and GID G.
+   If the GID parameter is NULL the entire SPEC is treated as a user.
+   If the USERNAME and GROUPNAME parameters are NULL they're ignored.
+   Either user or group, or both, must be present.
+   If the group is omitted but the separator is given,
+   use the given user's login group.
+   If SPEC contains a ':', then use that as the separator, ignoring
+   any '.'s.  If there is no ':', but there is a '.', then first look
+   up the entire SPEC as a login name.  If that look-up fails, then
+   try again interpreting the '.'  as a separator.
+
+   USERNAME and GROUPNAME will be in newly malloc'd memory.
+   Either one might be NULL instead, indicating that it was not
+   given and the corresponding numeric ID was left unchanged.
+
+   Return NULL if successful, a static error message string if not.
+   If PWARN is null, return NULL instead of a warning;
+   otherwise, set *PWARN to true depending on whether returning a warning.  */
+
+char const *
+parse_user_spec_warn (char const *spec, uid_t *uid, gid_t *gid,
+                      char **username, char **groupname, bool *pwarn)
+{
+  char const *colon = gid ? strchr (spec, ':') : NULL;
+  char const *error_msg =
+    parse_with_separator (spec, colon, uid, gid, username, groupname);
+  bool warn = false;
+
+  if (gid && !colon && error_msg)
+    {
+      /* If there's no colon but there is a dot, and if looking up the
+         whole spec failed (i.e., the spec is not an owner name that
+         includes a dot), then try again, but interpret the dot as a
+         separator.  This is a compatible extension to POSIX, since
+         the POSIX-required behavior is always tried first.  */
+
+      char const *dot = strchr (spec, '.');
+      if (dot
+          && ! parse_with_separator (spec, dot, uid, gid, username, groupname))
+        {
+          warn = true;
+          error_msg = pwarn ? N_("warning: '.' should be ':'") : NULL;
+        }
+    }
+
+  if (pwarn)
+    *pwarn = warn;
+  return error_msg;
+}
+
+/* Like parse_user_spec_warn, but generate only errors; no warnings.  */
+
+char const *
+parse_user_spec (char const *spec, uid_t *uid, gid_t *gid,
+                 char **username, char **groupname)
+{
+  return parse_user_spec_warn (spec, uid, gid, username, groupname, NULL);
+}
+
+#ifdef TEST
+
+# define NULL_CHECK(s) ((s) == NULL ? "(null)" : (s))
+
+int
+main (int argc, char **argv)
+{
+  int i;
+
+  for (i = 1; i < argc; i++)
+    {
+      const char *e;
+      char *username, *groupname;
+      uid_t uid;
+      gid_t gid;
+      char *tmp;
+
+      tmp = strdup (argv[i]);
+      e = parse_user_spec (tmp, &uid, &gid, &username, &groupname);
+      free (tmp);
+      printf ("%s: %lu %lu %s %s %s\n",
+              argv[i],
+              (unsigned long int) uid,
+              (unsigned long int) gid,
+              NULL_CHECK (username),
+              NULL_CHECK (groupname),
+              NULL_CHECK (e));
+    }
+
+  exit (0);
+}
+
+#endif
+
+/*
+Local Variables:
+indent-tabs-mode: nil
+End:
+*/
deleted file mode 120000 (symlink)
index ecd8630364b6dc219203ec1aa1c167ebf6de3c40..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/userspec.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..edf911e3f1308534302563d3a661a9d3d4b5a6b6
--- /dev/null
@@ -0,0 +1,31 @@
+/* Parse a 'user:group' specifier (e.g. the first argument of chown utility).
+   Copyright (C) 2003-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering, 2003.  */
+
+#ifndef USERSPEC_H
+# define USERSPEC_H 1
+
+# include <sys/types.h>
+
+char const *
+parse_user_spec (char const *spec_arg, uid_t *uid, gid_t *gid,
+                 char **username_arg, char **groupname_arg);
+char const *
+parse_user_spec_warn (char const *spec_arg, uid_t *uid, gid_t *gid,
+                      char **username_arg, char **groupname_arg, bool *pwarn);
+
+#endif
deleted file mode 120000 (symlink)
index 622b031cb37e53ba02d3c168577010b0686a8e1b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/utime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3535764a2ff3b7a8f83740ecfb3a16f2b1597e7f
--- /dev/null
@@ -0,0 +1,287 @@
+/* Work around platform bugs in utime.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <utime.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+# include <errno.h>
+# include <windows.h>
+# include "filename.h"
+# include "malloca.h"
+
+/* Don't assume that UNICODE is not defined.  */
+# undef CreateFile
+# define CreateFile CreateFileA
+# undef GetFileAttributes
+# define GetFileAttributes GetFileAttributesA
+
+int
+_gl_utimens_windows (const char *name, struct timespec ts[2])
+{
+  /* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>
+     specifies: "More than two leading <slash> characters shall be treated as
+     a single <slash> character."  */
+  if (ISSLASH (name[0]) && ISSLASH (name[1]) && ISSLASH (name[2]))
+    {
+      name += 2;
+      while (ISSLASH (name[1]))
+        name++;
+    }
+
+  size_t len = strlen (name);
+  size_t drive_prefix_len = (HAS_DEVICE (name) ? 2 : 0);
+
+  /* Remove trailing slashes (except the very first one, at position
+     drive_prefix_len), but remember their presence.  */
+  size_t rlen;
+  bool check_dir = false;
+
+  rlen = len;
+  while (rlen > drive_prefix_len && ISSLASH (name[rlen-1]))
+    {
+      check_dir = true;
+      if (rlen == drive_prefix_len + 1)
+        break;
+      rlen--;
+    }
+
+  const char *rname;
+  char *malloca_rname;
+  if (rlen == len)
+    {
+      rname = name;
+      malloca_rname = NULL;
+    }
+  else
+    {
+      malloca_rname = malloca (rlen + 1);
+      if (malloca_rname == NULL)
+        {
+          errno = ENOMEM;
+          return -1;
+        }
+      memcpy (malloca_rname, name, rlen);
+      malloca_rname[rlen] = '\0';
+      rname = malloca_rname;
+    }
+
+  DWORD error;
+
+  /* Open a handle to the file.
+     CreateFile
+     <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilea>
+     <https://docs.microsoft.com/en-us/windows/desktop/FileIO/creating-and-opening-files>  */
+  HANDLE handle =
+    CreateFile (rname,
+                FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES,
+                FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+                NULL,
+                OPEN_EXISTING,
+                /* FILE_FLAG_POSIX_SEMANTICS (treat file names that differ only
+                   in case as different) makes sense only when applied to *all*
+                   filesystem operations.  */
+                FILE_FLAG_BACKUP_SEMANTICS /* | FILE_FLAG_POSIX_SEMANTICS */,
+                NULL);
+  if (handle == INVALID_HANDLE_VALUE)
+    {
+      error = GetLastError ();
+      goto failed;
+    }
+
+  if (check_dir)
+    {
+      /* GetFileAttributes
+         <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getfileattributesa>  */
+      DWORD attributes = GetFileAttributes (rname);
+      if (attributes == INVALID_FILE_ATTRIBUTES)
+        {
+          error = GetLastError ();
+          CloseHandle (handle);
+          goto failed;
+        }
+      if ((attributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
+        {
+          CloseHandle (handle);
+          if (malloca_rname != NULL)
+            freea (malloca_rname);
+          errno = ENOTDIR;
+          return -1;
+        }
+    }
+
+  {
+    /* Use SetFileTime(). See
+       <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-setfiletime>
+       <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime>  */
+    FILETIME last_access_time;
+    FILETIME last_write_time;
+    if (ts == NULL)
+      {
+        /* GetSystemTimeAsFileTime is the same as
+           GetSystemTime followed by SystemTimeToFileTime.
+           <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>.
+           It would be overkill to use
+           GetSystemTimePreciseAsFileTime
+           <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>.  */
+        FILETIME current_time;
+        GetSystemTimeAsFileTime (&current_time);
+        last_access_time = current_time;
+        last_write_time = current_time;
+      }
+    else
+      {
+        {
+          ULONGLONG time_since_16010101 =
+            (ULONGLONG) ts[0].tv_sec * 10000000 + ts[0].tv_nsec / 100 + 116444736000000000LL;
+          last_access_time.dwLowDateTime = (DWORD) time_since_16010101;
+          last_access_time.dwHighDateTime = time_since_16010101 >> 32;
+        }
+        {
+          ULONGLONG time_since_16010101 =
+            (ULONGLONG) ts[1].tv_sec * 10000000 + ts[1].tv_nsec / 100 + 116444736000000000LL;
+          last_write_time.dwLowDateTime = (DWORD) time_since_16010101;
+          last_write_time.dwHighDateTime = time_since_16010101 >> 32;
+        }
+      }
+    if (SetFileTime (handle, NULL, &last_access_time, &last_write_time))
+      {
+        CloseHandle (handle);
+        if (malloca_rname != NULL)
+          freea (malloca_rname);
+        return 0;
+      }
+    else
+      {
+        #if 0
+        DWORD sft_error = GetLastError ();
+        fprintf (stderr, "utimens SetFileTime error 0x%x\n", (unsigned int) sft_error);
+        #endif
+        CloseHandle (handle);
+        if (malloca_rname != NULL)
+          freea (malloca_rname);
+        errno = EINVAL;
+        return -1;
+      }
+  }
+
+ failed:
+  {
+    #if 0
+    fprintf (stderr, "utimens CreateFile/GetFileAttributes error 0x%x\n", (unsigned int) error);
+    #endif
+    if (malloca_rname != NULL)
+      freea (malloca_rname);
+
+    switch (error)
+      {
+      /* Some of these errors probably cannot happen with the specific flags
+         that we pass to CreateFile.  But who knows...  */
+      case ERROR_FILE_NOT_FOUND: /* The last component of rname does not exist.  */
+      case ERROR_PATH_NOT_FOUND: /* Some directory component in rname does not exist.  */
+      case ERROR_BAD_PATHNAME:   /* rname is such as '\\server'.  */
+      case ERROR_BAD_NETPATH:    /* rname is such as '\\nonexistentserver\share'.  */
+      case ERROR_BAD_NET_NAME:   /* rname is such as '\\server\nonexistentshare'.  */
+      case ERROR_INVALID_NAME:   /* rname contains wildcards, misplaced colon, etc.  */
+      case ERROR_DIRECTORY:
+        errno = ENOENT;
+        break;
+
+      case ERROR_ACCESS_DENIED:  /* rname is such as 'C:\System Volume Information\foo'.  */
+      case ERROR_SHARING_VIOLATION: /* rname is such as 'C:\pagefile.sys'.  */
+        errno = (ts != NULL ? EPERM : EACCES);
+        break;
+
+      case ERROR_OUTOFMEMORY:
+        errno = ENOMEM;
+        break;
+
+      case ERROR_WRITE_PROTECT:
+        errno = EROFS;
+        break;
+
+      case ERROR_WRITE_FAULT:
+      case ERROR_READ_FAULT:
+      case ERROR_GEN_FAILURE:
+        errno = EIO;
+        break;
+
+      case ERROR_BUFFER_OVERFLOW:
+      case ERROR_FILENAME_EXCED_RANGE:
+        errno = ENAMETOOLONG;
+        break;
+
+      case ERROR_DELETE_PENDING: /* XXX map to EACCES or EPERM? */
+        errno = EPERM;
+        break;
+
+      default:
+        errno = EINVAL;
+        break;
+      }
+
+    return -1;
+  }
+}
+
+int
+utime (const char *name, const struct utimbuf *ts)
+{
+  if (ts == NULL)
+    return _gl_utimens_windows (name, NULL);
+  else
+    {
+      struct timespec ts_with_nanoseconds[2];
+      ts_with_nanoseconds[0].tv_sec = ts->actime;
+      ts_with_nanoseconds[0].tv_nsec = 0;
+      ts_with_nanoseconds[1].tv_sec = ts->modtime;
+      ts_with_nanoseconds[1].tv_nsec = 0;
+      return _gl_utimens_windows (name, ts_with_nanoseconds);
+    }
+}
+
+#else
+
+# include <errno.h>
+# include <sys/stat.h>
+# include "filename.h"
+
+int
+utime (const char *name, const struct utimbuf *ts)
+#undef utime
+{
+# if REPLACE_FUNC_UTIME_FILE
+  /* macOS 10.13 mistakenly succeeds when given a symbolic link to a
+     non-directory with a trailing slash.  */
+  size_t len = strlen (name);
+  if (len > 0 && ISSLASH (name[len - 1]))
+    {
+      struct stat buf;
+
+      if (stat (name, &buf) == -1 && errno != EOVERFLOW)
+        return -1;
+    }
+# endif /* REPLACE_FUNC_UTIME_FILE */
+
+  return utime (name, ts);
+}
+
+#endif
deleted file mode 120000 (symlink)
index 77d916ba74e980ca2a709bd01364cfb8574a7e4f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/utime.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..378427fe6e823d02930a4fd36dac6a2f96dfdc63
--- /dev/null
@@ -0,0 +1,124 @@
+/* Substitute for and wrapper around <utime.h>.
+   Copyright (C) 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _@GUARD_PREFIX@_UTIME_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* This file uses #include_next of a system file that defines time_t.
+   For the 'year2038' module to work right, <config.h> needs to have been
+   included before.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_UTIME_H@
+# @INCLUDE_NEXT@ @NEXT_UTIME_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_UTIME_H
+#define _@GUARD_PREFIX@_UTIME_H
+
+/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if !@HAVE_UTIME_H@
+# include <sys/utime.h>
+#endif
+
+#if @GNULIB_UTIME@
+/* Get struct timespec.  */
+# include <time.h>
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+/* Define 'struct utimbuf' as an alias of 'struct _utimbuf'
+   (or possibly, if present, 'struct __utimbuf64').  */
+# define utimbuf _utimbuf
+
+#endif
+
+
+#if @GNULIB_UTIME@
+# if @REPLACE_UTIME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define utime rpl_utime
+#  endif
+_GL_FUNCDECL_RPL (utime, int, (const char *filename, const struct utimbuf *ts)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (utime, int, (const char *filename, const struct utimbuf *ts));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef utime
+#   define utime _utime
+#  endif
+_GL_CXXALIAS_MDA (utime, int, (const char *filename, const struct utimbuf *ts));
+# else
+#  if !@HAVE_UTIME@
+_GL_FUNCDECL_SYS (utime, int, (const char *filename, const struct utimbuf *ts)
+                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (utime, int, (const char *filename, const struct utimbuf *ts));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (utime);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef utime
+# if HAVE_RAW_DECL_UTIME
+_GL_WARN_ON_USE (utime,
+                 "utime is unportable - "
+                 "use gnulib module canonicalize-lgpl for portability");
+# endif
+#elif @GNULIB_MDA_UTIME@
+/* On native Windows, map 'utime' to '_utime', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::utime always.  */
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef utime
+#   define utime _utime
+#  endif
+_GL_CXXALIAS_MDA (utime, int, (const char *filename, const struct utimbuf *ts));
+# else
+_GL_CXXALIAS_SYS (utime, int, (const char *filename, const struct utimbuf *ts));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (utime);
+# endif
+#endif
+
+#if @GNULIB_UTIME@
+extern int _gl_utimens_windows (const char *filename, struct timespec ts[2]);
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_UTIME_H */
+#endif /* _@GUARD_PREFIX@_UTIME_H */
deleted file mode 120000 (symlink)
index 4897664209163f942e4ddae384a445e234cf7eb8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/utimecmp.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..606e5cdece77e4dfb7d4263b0921a3786405bf6e
--- /dev/null
@@ -0,0 +1,410 @@
+/* utimecmp.c -- compare file timestamps
+
+   Copyright (C) 2004-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "utimecmp.h"
+
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "dirname.h"
+#include "hash.h"
+#include "intprops.h"
+#include "stat-time.h"
+
+#ifndef MAX
+# define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+#define BILLION (1000 * 1000 * 1000)
+
+/* Best possible resolution that utimens can set and stat can return,
+   due to system-call limitations.  It must be a power of 10 that is
+   no greater than 1 billion.  */
+#if HAVE_UTIMENSAT
+enum { SYSCALL_RESOLUTION = 1 };
+#elif defined _WIN32 && ! defined __CYGWIN__
+/* On native Windows, file times have 100 ns resolution. See
+   <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime>  */
+enum { SYSCALL_RESOLUTION = 100 };
+#elif ((HAVE_FUTIMESAT || HAVE_WORKING_UTIMES)                  \
+       && (defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC             \
+           || defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC     \
+           || defined HAVE_STRUCT_STAT_ST_ATIMENSEC             \
+           || defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC))
+enum { SYSCALL_RESOLUTION = 1000 };
+#else
+enum { SYSCALL_RESOLUTION = BILLION };
+#endif
+
+/* Describe a file system and its timestamp resolution in nanoseconds.  */
+struct fs_res
+{
+  /* Device number of file system.  */
+  dev_t dev;
+
+  /* An upper bound on the timestamp resolution of this file system,
+     ignoring any resolution that cannot be set via utimens.  It is
+     represented by an integer count of nanoseconds.  It must be
+     either 2 billion, or a power of 10 that is no greater than a
+     billion and is no less than SYSCALL_RESOLUTION.  */
+  int resolution;
+
+  /* True if RESOLUTION is known to be exact, and is not merely an
+     upper bound on the true resolution.  */
+  bool exact;
+};
+
+/* Hash some device info.  */
+static size_t
+dev_info_hash (void const *x, size_t table_size)
+{
+  struct fs_res const *p = x;
+
+  /* Beware signed arithmetic gotchas.  */
+  if (TYPE_SIGNED (dev_t) && SIZE_MAX < MAX (INT_MAX, TYPE_MAXIMUM (dev_t)))
+    {
+      uintmax_t dev = p->dev;
+      return dev % table_size;
+    }
+
+  return p->dev % table_size;
+}
+
+/* Compare two dev_info structs.  */
+static bool
+dev_info_compare (void const *x, void const *y)
+{
+  struct fs_res const *a = x;
+  struct fs_res const *b = y;
+  return a->dev == b->dev;
+}
+
+/* Return -1, 0, 1 based on whether the destination file (relative
+   to openat-like directory file descriptor DFD with name
+   DST_NAME and status DST_STAT) is older than SRC_STAT, the same age
+   as SRC_STAT, or newer than SRC_STAT, respectively.
+
+   DST_NAME may be NULL if OPTIONS is 0.
+
+   If OPTIONS & UTIMECMP_TRUNCATE_SOURCE, do the comparison after SRC is
+   converted to the destination's timestamp resolution as filtered through
+   utimens.  In this case, return -2 if the exact answer cannot be
+   determined; this can happen only if the timestamps are very close and
+   there is some trouble accessing the file system (e.g., the user does not
+   have permission to futz with the destination's timestamps).  */
+
+int
+utimecmp (char const *dst_name,
+          struct stat const *dst_stat,
+          struct stat const *src_stat,
+          int options)
+{
+  return utimecmpat (AT_FDCWD, dst_name, dst_stat, src_stat, options);
+}
+
+int
+utimecmpat (int dfd, char const *dst_name,
+            struct stat const *dst_stat,
+            struct stat const *src_stat,
+            int options)
+{
+  /* Things to watch out for:
+
+     The code uses a static hash table internally and is not safe in the
+     presence of signals, multiple threads, etc.  However, memory pressure
+     that prevents use of the hash table is not fatal - we just fall back
+     to redoing the computations on every call in that case.
+
+     int and long int might be 32 bits.  Many of the calculations store
+     numbers up to 2 billion, and multiply by 10; they have to avoid
+     multiplying 2 billion by 10, as this exceeds 32-bit capabilities.
+
+     time_t might be unsigned.  */
+
+  static_assert (TYPE_IS_INTEGER (time_t));
+
+  /* Destination and source timestamps.  */
+  time_t dst_s = dst_stat->st_mtime;
+  time_t src_s = src_stat->st_mtime;
+  int dst_ns = get_stat_mtime_ns (dst_stat);
+  int src_ns = get_stat_mtime_ns (src_stat);
+
+  if (options & UTIMECMP_TRUNCATE_SOURCE)
+    {
+#if defined _AIX
+      /* On AIX 7.2, on a jfs2 file system, the times may differ by up to
+         0.01 seconds in either direction.  But it does not seem to come
+         from clock ticks of 0.01 seconds each.  */
+      long long difference =
+        ((long long) dst_s - (long long) src_s) * BILLION
+        + ((long long) dst_ns - (long long) src_ns);
+      if (difference < 10000000 && difference > -10000000)
+        return 0;
+#endif
+
+      /* Look up the timestamp resolution for the destination device.  */
+
+      /* Hash table for caching information learned about devices.  */
+      static Hash_table *ht;
+
+      /* Information about the destination file system.  */
+      static struct fs_res *new_dst_res;
+      struct fs_res *dst_res = NULL;
+      struct fs_res tmp_dst_res;
+
+      /* timestamp resolution in nanoseconds.  */
+      int res;
+
+      /* Quick exit, if possible.  Since the worst resolution is 2
+         seconds, anything that differs by more than that does not
+         needs source truncation.  */
+      if (dst_s == src_s && dst_ns == src_ns)
+        return 0;
+      if (dst_s <= src_s - 2)
+        return -1;
+      if (src_s <= dst_s - 2)
+        return 1;
+
+      /* Try to do a hash lookup, but fall back to stack variables and
+         recomputation on low memory situations.  */
+      if (! ht)
+        ht = hash_initialize (16, NULL, dev_info_hash, dev_info_compare, free);
+      if (ht)
+        {
+          if (! new_dst_res)
+            {
+              new_dst_res = malloc (sizeof *new_dst_res);
+              if (!new_dst_res)
+                goto low_memory;
+              new_dst_res->resolution = 2 * BILLION;
+              new_dst_res->exact = false;
+            }
+          new_dst_res->dev = dst_stat->st_dev;
+          dst_res = hash_insert (ht, new_dst_res);
+          if (! dst_res)
+            goto low_memory;
+
+          if (dst_res == new_dst_res)
+            {
+              /* NEW_DST_RES is now in use in the hash table, so allocate a
+                 new entry next time.  */
+              new_dst_res = NULL;
+            }
+        }
+      else
+        {
+        low_memory:
+          if (ht)
+            {
+              tmp_dst_res.dev = dst_stat->st_dev;
+              dst_res = hash_lookup (ht, &tmp_dst_res);
+            }
+          if (!dst_res)
+            {
+              dst_res = &tmp_dst_res;
+              dst_res->resolution = 2 * BILLION;
+              dst_res->exact = false;
+            }
+        }
+
+      res = dst_res->resolution;
+
+#ifdef _PC_TIMESTAMP_RESOLUTION
+      /* If the system will tell us the resolution, we're set!  */
+      if (! dst_res->exact)
+        {
+          res = -1;
+          if (dfd == AT_FDCWD)
+            res = pathconf (dst_name, _PC_TIMESTAMP_RESOLUTION);
+          else
+            {
+              char *dstdir = mdir_name (dst_name);
+              if (dstdir)
+                {
+                  int destdirfd = openat (dfd, dstdir,
+                                          O_SEARCH | O_CLOEXEC | O_DIRECTORY);
+                  if (0 <= destdirfd)
+                    {
+                      res = fpathconf (destdirfd, _PC_TIMESTAMP_RESOLUTION);
+                      close (destdirfd);
+                    }
+                  free (dstdir);
+                }
+            }
+          if (0 < res)
+            {
+              dst_res->resolution = res;
+              dst_res->exact = true;
+            }
+        }
+#endif
+
+      if (! dst_res->exact)
+        {
+          /* This file system's resolution is not known exactly.
+             Deduce it, and store the result in the hash table.  */
+
+          time_t dst_a_s = dst_stat->st_atime;
+          time_t dst_c_s = dst_stat->st_ctime;
+          time_t dst_m_s = dst_s;
+          int dst_a_ns = get_stat_atime_ns (dst_stat);
+          int dst_c_ns = get_stat_ctime_ns (dst_stat);
+          int dst_m_ns = dst_ns;
+
+          /* Set RES to an upper bound on the file system resolution
+             (after truncation due to SYSCALL_RESOLUTION) by inspecting
+             the atime, ctime and mtime of the existing destination.
+             We don't know of any file system that stores atime or
+             ctime with a higher precision than mtime, so it's valid to
+             look at them too.  */
+          {
+            bool odd_second = (dst_a_s | dst_c_s | dst_m_s) & 1;
+
+            if (SYSCALL_RESOLUTION == BILLION)
+              {
+                if (odd_second | dst_a_ns | dst_c_ns | dst_m_ns)
+                  res = BILLION;
+              }
+            else
+              {
+                int a = dst_a_ns;
+                int c = dst_c_ns;
+                int m = dst_m_ns;
+
+                /* Write it this way to avoid mistaken GCC warning
+                   about integer overflow in constant expression.  */
+                int SR10 = SYSCALL_RESOLUTION;  SR10 *= 10;
+
+                if ((a % SR10 | c % SR10 | m % SR10) != 0)
+                  res = SYSCALL_RESOLUTION;
+                else
+                  for (res = SR10, a /= SR10, c /= SR10, m /= SR10;
+                       (res < dst_res->resolution
+                        && (a % 10 | c % 10 | m % 10) == 0);
+                       res *= 10, a /= 10, c /= 10, m /= 10)
+                    if (res == BILLION)
+                      {
+                        if (! odd_second)
+                          res *= 2;
+                        break;
+                      }
+              }
+
+            dst_res->resolution = res;
+          }
+
+          if (SYSCALL_RESOLUTION < res)
+            {
+              struct stat dst_status;
+
+              /* Ignore source timestamp information that must necessarily
+                 be lost when filtered through utimens.  */
+              src_ns -= src_ns % SYSCALL_RESOLUTION;
+
+              /* If the timestamps disagree widely enough, there's no need
+                 to interrogate the file system to deduce the exact
+                 timestamp resolution; return the answer directly.  */
+              {
+                time_t s = src_s & ~ (res == 2 * BILLION ? 1 : 0);
+                if (src_s < dst_s || (src_s == dst_s && src_ns <= dst_ns))
+                  return 1;
+                if (dst_s < s
+                    || (dst_s == s && dst_ns < src_ns - src_ns % res))
+                  return -1;
+              }
+
+              /* Determine the actual timestamp resolution for the
+                 destination file system (after truncation due to
+                 SYSCALL_RESOLUTION) by setting the access timestamp of the
+                 destination to the existing access time, except with
+                 trailing nonzero digits.  */
+
+              struct timespec timespec[2] = {
+                [0].tv_sec = dst_a_s,
+                [0].tv_nsec = dst_a_ns,
+                [1].tv_sec = dst_m_s | (res == 2 * BILLION),
+                [1].tv_nsec = dst_m_ns + res / 9
+              };
+
+              if (utimensat (dfd, dst_name, timespec, AT_SYMLINK_NOFOLLOW))
+                return -2;
+
+              /* Read the modification time that was set.  */
+              {
+                int stat_result
+                  = fstatat (dfd, dst_name, &dst_status, AT_SYMLINK_NOFOLLOW);
+
+                if (stat_result
+                    | (dst_status.st_mtime ^ dst_m_s)
+                    | (get_stat_mtime_ns (&dst_status) ^ dst_m_ns))
+                  {
+                    /* The modification time changed, or we can't tell whether
+                       it changed.  Change it back as best we can.  */
+                    timespec[1].tv_sec = dst_m_s;
+                    timespec[1].tv_nsec = dst_m_ns;
+                    utimensat (dfd, dst_name, timespec, AT_SYMLINK_NOFOLLOW);
+                  }
+
+                if (stat_result != 0)
+                  return -2;
+              }
+
+              /* Determine the exact resolution from the modification time
+                 that was read back.  */
+              {
+                int old_res = res;
+                int a = (BILLION * (dst_status.st_mtime & 1)
+                         + get_stat_mtime_ns (&dst_status));
+
+                res = SYSCALL_RESOLUTION;
+
+                for (a /= res; a % 10 == 0; a /= 10)
+                  {
+                    if (res == BILLION)
+                      {
+                        res *= 2;
+                        break;
+                      }
+                    res *= 10;
+                    if (res == old_res)
+                      break;
+                  }
+              }
+            }
+
+          dst_res->resolution = res;
+          dst_res->exact = true;
+        }
+
+      /* Truncate the source's timestamp according to the resolution.  */
+      src_s &= ~ (res == 2 * BILLION ? 1 : 0);
+      src_ns -= src_ns % res;
+    }
+
+  /* Compare the timestamps and return -1, 0, 1 accordingly.  */
+  return (_GL_CMP (dst_s, src_s)
+          + ((dst_s == src_s ? ~0 : 0) & _GL_CMP (dst_ns, src_ns)));
+}
deleted file mode 120000 (symlink)
index f73a898652aaefda2d94fbd4dd71dc5372f00edc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/utimecmp.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bf730cb07c180379067bab363db2a5add757c193
--- /dev/null
@@ -0,0 +1,39 @@
+/* utimecmp.h -- compare file timestamps
+
+   Copyright (C) 2004, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef UTIMECMP_H
+#define UTIMECMP_H 1
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/* Options for utimecmp.  */
+enum
+{
+  /* Before comparing, truncate the source timestamp to the
+     resolution of the destination file system and to the resolution
+     of utimens.  */
+  UTIMECMP_TRUNCATE_SOURCE = 1
+};
+
+int utimecmp (char const *, struct stat const *, struct stat const *, int);
+int utimecmpat (int, char const *, struct stat const *, struct stat const *,
+                int);
+
+#endif
deleted file mode 120000 (symlink)
index 7f25d31c176f7a0939952f9caf4d59de110feaea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/utimens.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4bfb9c91a7bb786a8c2e4089d3b4d90569ab780c
--- /dev/null
@@ -0,0 +1,646 @@
+/* Set file access and modification times.
+
+   Copyright (C) 2003-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* derived from a function in touch.c */
+
+#include <config.h>
+
+#define _GL_UTIMENS_INLINE _GL_EXTERN_INLINE
+#include "utimens.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <utime.h>
+
+#include "stat-time.h"
+#include "timespec.h"
+
+/* On native Windows, use SetFileTime; but avoid this when compiling
+   GNU Emacs, which arranges for this in some other way and which
+   defines WIN32_LEAN_AND_MEAN itself.  */
+
+#if defined _WIN32 && ! defined __CYGWIN__ && ! defined EMACS_CONFIGURATION
+# define USE_SETFILETIME
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+#endif
+
+/* Avoid recursion with rpl_futimens or rpl_utimensat.  */
+#undef futimens
+#if !HAVE_NEARLY_WORKING_UTIMENSAT
+# undef utimensat
+#endif
+
+/* Solaris 9 mistakenly succeeds when given a non-directory with a
+   trailing slash.  Force the use of rpl_stat for a fix.  */
+#ifndef REPLACE_FUNC_STAT_FILE
+# define REPLACE_FUNC_STAT_FILE 0
+#endif
+
+#if HAVE_UTIMENSAT || HAVE_FUTIMENS
+/* Cache variables for whether the utimensat syscall works; used to
+   avoid calling the syscall if we know it will just fail with ENOSYS,
+   and to avoid unnecessary work in massaging timestamps if the
+   syscall will work.  Multiple variables are needed, to distinguish
+   between the following scenarios on Linux:
+   utimensat doesn't exist, or is in glibc but kernel 2.6.18 fails with ENOSYS
+   kernel 2.6.22 and earlier rejects AT_SYMLINK_NOFOLLOW
+   kernel 2.6.25 and earlier reject UTIME_NOW/UTIME_OMIT with non-zero tv_sec
+   kernel 2.6.32 used with xfs or ntfs-3g fail to honor UTIME_OMIT
+   utimensat completely works
+   For each cache variable: 0 = unknown, 1 = yes, -1 = no.  */
+static int utimensat_works_really;
+static int lutimensat_works_really;
+#endif /* HAVE_UTIMENSAT || HAVE_FUTIMENS */
+
+/* Validate the requested timestamps.  Return 0 if the resulting
+   timespec can be used for utimensat (after possibly modifying it to
+   work around bugs in utimensat).  Return a positive value if the
+   timespec needs further adjustment based on stat results: 1 if any
+   adjustment is needed for utimes, and 2 if any adjustment is needed
+   for Linux utimensat.  Return -1, with errno set to EINVAL, if
+   timespec is out of range.  */
+static int
+validate_timespec (struct timespec timespec[2])
+{
+  int result = 0;
+  int utime_omit_count = 0;
+  if ((timespec[0].tv_nsec != UTIME_NOW
+       && timespec[0].tv_nsec != UTIME_OMIT
+       && ! (0 <= timespec[0].tv_nsec
+             && timespec[0].tv_nsec < TIMESPEC_HZ))
+      || (timespec[1].tv_nsec != UTIME_NOW
+          && timespec[1].tv_nsec != UTIME_OMIT
+          && ! (0 <= timespec[1].tv_nsec
+                && timespec[1].tv_nsec < TIMESPEC_HZ)))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  /* Work around Linux kernel 2.6.25 bug, where utimensat fails with
+     EINVAL if tv_sec is not 0 when using the flag values of tv_nsec.
+     Flag a Linux kernel 2.6.32 bug, where an mtime of UTIME_OMIT
+     fails to bump ctime.  */
+  if (timespec[0].tv_nsec == UTIME_NOW
+      || timespec[0].tv_nsec == UTIME_OMIT)
+    {
+      timespec[0].tv_sec = 0;
+      result = 1;
+      if (timespec[0].tv_nsec == UTIME_OMIT)
+        utime_omit_count++;
+    }
+  if (timespec[1].tv_nsec == UTIME_NOW
+      || timespec[1].tv_nsec == UTIME_OMIT)
+    {
+      timespec[1].tv_sec = 0;
+      result = 1;
+      if (timespec[1].tv_nsec == UTIME_OMIT)
+        utime_omit_count++;
+    }
+  return result + (utime_omit_count == 1);
+}
+
+/* Normalize any UTIME_NOW or UTIME_OMIT values in (*TS)[0] and (*TS)[1],
+   using STATBUF to obtain the current timestamps of the file.  If
+   both times are UTIME_NOW, set *TS to NULL (as this can avoid some
+   permissions issues).  If both times are UTIME_OMIT, return true
+   (nothing further beyond the prior collection of STATBUF is
+   necessary); otherwise return false.  */
+static bool
+update_timespec (struct stat const *statbuf, struct timespec **ts)
+{
+  struct timespec *timespec = *ts;
+  if (timespec[0].tv_nsec == UTIME_OMIT
+      && timespec[1].tv_nsec == UTIME_OMIT)
+    return true;
+  if (timespec[0].tv_nsec == UTIME_NOW
+      && timespec[1].tv_nsec == UTIME_NOW)
+    {
+      *ts = NULL;
+      return false;
+    }
+
+  if (timespec[0].tv_nsec == UTIME_OMIT)
+    timespec[0] = get_stat_atime (statbuf);
+  else if (timespec[0].tv_nsec == UTIME_NOW)
+    gettime (&timespec[0]);
+
+  if (timespec[1].tv_nsec == UTIME_OMIT)
+    timespec[1] = get_stat_mtime (statbuf);
+  else if (timespec[1].tv_nsec == UTIME_NOW)
+    gettime (&timespec[1]);
+
+  return false;
+}
+
+/* Set the access and modification timestamps of FD (a.k.a. FILE) to be
+   TIMESPEC[0] and TIMESPEC[1], respectively.
+   FD must be either negative -- in which case it is ignored --
+   or a file descriptor that is open on FILE.
+   If FD is nonnegative, then FILE can be NULL, which means
+   use just futimes (or equivalent) instead of utimes (or equivalent),
+   and fail if on an old system without futimes (or equivalent).
+   If TIMESPEC is null, set the timestamps to the current time.
+   Return 0 on success, -1 (setting errno) on failure.  */
+
+int
+fdutimens (int fd, char const *file, struct timespec const timespec[2])
+{
+  struct timespec adjusted_timespec[2];
+  struct timespec *ts = timespec ? adjusted_timespec : NULL;
+  int adjustment_needed = 0;
+  struct stat st;
+
+  if (ts)
+    {
+      adjusted_timespec[0] = timespec[0];
+      adjusted_timespec[1] = timespec[1];
+      adjustment_needed = validate_timespec (ts);
+    }
+  if (adjustment_needed < 0)
+    return -1;
+
+  /* Require that at least one of FD or FILE are potentially valid, to avoid
+     a Linux bug where futimens (AT_FDCWD, NULL) changes "." rather
+     than failing.  */
+  if (fd < 0 && !file)
+    {
+      errno = EBADF;
+      return -1;
+    }
+
+  /* Some Linux-based NFS clients are buggy, and mishandle timestamps
+     of files in NFS file systems in some cases.  We have no
+     configure-time test for this, but please see
+     <https://bugs.gentoo.org/show_bug.cgi?id=132673> for references to
+     some of the problems with Linux 2.6.16.  If this affects you,
+     compile with -DHAVE_BUGGY_NFS_TIME_STAMPS; this is reported to
+     help in some cases, albeit at a cost in performance.  But you
+     really should upgrade your kernel to a fixed version, since the
+     problem affects many applications.  */
+
+#if HAVE_BUGGY_NFS_TIME_STAMPS
+  if (fd < 0)
+    sync ();
+  else
+    fsync (fd);
+#endif
+
+  /* POSIX 2008 added two interfaces to set file timestamps with
+     nanosecond resolution; newer Linux implements both functions via
+     a single syscall.  We provide a fallback for ENOSYS (for example,
+     compiling against Linux 2.6.25 kernel headers and glibc 2.7, but
+     running on Linux 2.6.18 kernel).  */
+#if HAVE_UTIMENSAT || HAVE_FUTIMENS
+  if (0 <= utimensat_works_really)
+    {
+      int result;
+# if __linux__ || __sun
+      /* As recently as Linux kernel 2.6.32 (Dec 2009), several file
+         systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
+         but work if both times are either explicitly specified or
+         UTIME_NOW.  Work around it with a preparatory [f]stat prior
+         to calling futimens/utimensat; fortunately, there is not much
+         timing impact due to the extra syscall even on file systems
+         where UTIME_OMIT would have worked.
+
+         The same bug occurs in Solaris 11.1 (Apr 2013).
+
+         FIXME: Simplify this in 2024, when these file system bugs are
+         no longer common on Gnulib target platforms.  */
+      if (adjustment_needed == 2)
+        {
+          if (fd < 0 ? stat (file, &st) : fstat (fd, &st))
+            return -1;
+          if (ts[0].tv_nsec == UTIME_OMIT)
+            ts[0] = get_stat_atime (&st);
+          else if (ts[1].tv_nsec == UTIME_OMIT)
+            ts[1] = get_stat_mtime (&st);
+          /* Note that st is good, in case utimensat gives ENOSYS.  */
+          adjustment_needed++;
+        }
+# endif
+# if HAVE_UTIMENSAT
+      if (fd < 0)
+        {
+#  if defined __APPLE__ && defined __MACH__
+          size_t len = strlen (file);
+          if (len > 0 && file[len - 1] == '/')
+            {
+              struct stat statbuf;
+              if (stat (file, &statbuf) < 0)
+                return -1;
+              if (!S_ISDIR (statbuf.st_mode))
+                {
+                  errno = ENOTDIR;
+                  return -1;
+                }
+            }
+#  endif
+          result = utimensat (AT_FDCWD, file, ts, 0);
+#  ifdef __linux__
+          /* Work around a kernel bug:
+             https://bugzilla.redhat.com/show_bug.cgi?id=442352
+             https://bugzilla.redhat.com/show_bug.cgi?id=449910
+             It appears that utimensat can mistakenly return 280 rather
+             than -1 upon ENOSYS failure.
+             FIXME: remove in 2010 or whenever the offending kernels
+             are no longer in common use.  */
+          if (0 < result)
+            errno = ENOSYS;
+#  endif /* __linux__ */
+          if (result == 0 || errno != ENOSYS)
+            {
+              utimensat_works_really = 1;
+              return result;
+            }
+        }
+# endif /* HAVE_UTIMENSAT */
+# if HAVE_FUTIMENS
+      if (0 <= fd)
+        {
+          result = futimens (fd, ts);
+#  ifdef __linux__
+          /* Work around the same bug as above.  */
+          if (0 < result)
+            errno = ENOSYS;
+#  endif /* __linux__ */
+          if (result == 0 || errno != ENOSYS)
+            {
+              utimensat_works_really = 1;
+              return result;
+            }
+        }
+# endif /* HAVE_FUTIMENS */
+    }
+  utimensat_works_really = -1;
+  lutimensat_works_really = -1;
+#endif /* HAVE_UTIMENSAT || HAVE_FUTIMENS */
+
+#ifdef USE_SETFILETIME
+  /* On native Windows, use SetFileTime(). See
+     <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-setfiletime>
+     <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime>  */
+  if (0 <= fd)
+    {
+      HANDLE handle;
+      FILETIME current_time;
+      FILETIME last_access_time;
+      FILETIME last_write_time;
+
+      handle = (HANDLE) _get_osfhandle (fd);
+      if (handle == INVALID_HANDLE_VALUE)
+        {
+          errno = EBADF;
+          return -1;
+        }
+
+      if (ts == NULL || ts[0].tv_nsec == UTIME_NOW || ts[1].tv_nsec == UTIME_NOW)
+        {
+          /* GetSystemTimeAsFileTime
+             <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>.
+             It would be overkill to use
+             GetSystemTimePreciseAsFileTime
+             <https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>.  */
+          GetSystemTimeAsFileTime (&current_time);
+        }
+
+      if (ts == NULL || ts[0].tv_nsec == UTIME_NOW)
+        {
+          last_access_time = current_time;
+        }
+      else if (ts[0].tv_nsec == UTIME_OMIT)
+        {
+          last_access_time.dwLowDateTime = 0;
+          last_access_time.dwHighDateTime = 0;
+        }
+      else
+        {
+          ULONGLONG time_since_16010101 =
+            (ULONGLONG) ts[0].tv_sec * 10000000 + ts[0].tv_nsec / 100 + 116444736000000000LL;
+          last_access_time.dwLowDateTime = (DWORD) time_since_16010101;
+          last_access_time.dwHighDateTime = time_since_16010101 >> 32;
+        }
+
+      if (ts == NULL || ts[1].tv_nsec == UTIME_NOW)
+        {
+          last_write_time = current_time;
+        }
+      else if (ts[1].tv_nsec == UTIME_OMIT)
+        {
+          last_write_time.dwLowDateTime = 0;
+          last_write_time.dwHighDateTime = 0;
+        }
+      else
+        {
+          ULONGLONG time_since_16010101 =
+            (ULONGLONG) ts[1].tv_sec * 10000000 + ts[1].tv_nsec / 100 + 116444736000000000LL;
+          last_write_time.dwLowDateTime = (DWORD) time_since_16010101;
+          last_write_time.dwHighDateTime = time_since_16010101 >> 32;
+        }
+
+      if (SetFileTime (handle, NULL, &last_access_time, &last_write_time))
+        return 0;
+      else
+        {
+          DWORD sft_error = GetLastError ();
+          #if 0
+          fprintf (stderr, "fdutimens SetFileTime error 0x%x\n", (unsigned int) sft_error);
+          #endif
+          switch (sft_error)
+            {
+            case ERROR_ACCESS_DENIED: /* fd was opened without O_RDWR */
+              errno = EACCES; /* not specified by POSIX */
+              break;
+            default:
+              errno = EINVAL;
+              break;
+            }
+          return -1;
+        }
+    }
+#endif
+
+  /* The platform lacks an interface to set file timestamps with
+     nanosecond resolution, so do the best we can, discarding any
+     fractional part of the timestamp.  */
+
+  if (adjustment_needed || (REPLACE_FUNC_STAT_FILE && fd < 0))
+    {
+      if (adjustment_needed != 3
+          && (fd < 0 ? stat (file, &st) : fstat (fd, &st)))
+        return -1;
+      if (ts && update_timespec (&st, &ts))
+        return 0;
+    }
+
+  {
+#if HAVE_FUTIMESAT || HAVE_WORKING_UTIMES
+    struct timeval timeval[2];
+    struct timeval *t;
+    if (ts)
+      {
+        timeval[0] = (struct timeval) { .tv_sec  = ts[0].tv_sec,
+                                        .tv_usec = ts[0].tv_nsec / 1000 };
+        timeval[1] = (struct timeval) { .tv_sec  = ts[1].tv_sec,
+                                        .tv_usec = ts[1].tv_nsec / 1000 };
+        t = timeval;
+      }
+    else
+      t = NULL;
+
+    if (fd < 0)
+      {
+# if HAVE_FUTIMESAT
+        return futimesat (AT_FDCWD, file, t);
+# endif
+      }
+    else
+      {
+        /* If futimesat or futimes fails here, don't try to speed things
+           up by returning right away.  glibc can incorrectly fail with
+           errno == ENOENT if /proc isn't mounted.  Also, Mandrake 10.0
+           in high security mode doesn't allow ordinary users to read
+           /proc/self, so glibc incorrectly fails with errno == EACCES.
+           If errno == EIO, EPERM, or EROFS, it's probably safe to fail
+           right away, but these cases are rare enough that they're not
+           worth optimizing, and who knows what other messed-up systems
+           are out there?  So play it safe and fall back on the code
+           below.  */
+
+# if (HAVE_FUTIMESAT && !FUTIMESAT_NULL_BUG) || HAVE_FUTIMES
+#  if HAVE_FUTIMESAT && !FUTIMESAT_NULL_BUG
+#   undef futimes
+#   define futimes(fd, t) futimesat (fd, NULL, t)
+#  endif
+        if (futimes (fd, t) == 0)
+          {
+#  if __linux__ && __GLIBC__
+            /* Work around a longstanding glibc bug, still present as
+               of 2010-12-27.  On older Linux kernels that lack both
+               utimensat and utimes, glibc's futimes rounds instead of
+               truncating when falling back on utime.  The same bug
+               occurs in futimesat with a null 2nd arg.  */
+            if (t)
+              {
+                bool abig = 500000 <= t[0].tv_usec;
+                bool mbig = 500000 <= t[1].tv_usec;
+                if ((abig | mbig) && fstat (fd, &st) == 0)
+                  {
+                    /* If these two subtractions overflow, they'll
+                       track the overflows inside the buggy glibc.  */
+                    time_t adiff = st.st_atime - t[0].tv_sec;
+                    time_t mdiff = st.st_mtime - t[1].tv_sec;
+
+                    struct timeval *tt = NULL;
+                    struct timeval truncated_timeval[2];
+                    truncated_timeval[0] = t[0];
+                    truncated_timeval[1] = t[1];
+                    if (abig && adiff == 1 && get_stat_atime_ns (&st) == 0)
+                      {
+                        tt = truncated_timeval;
+                        tt[0].tv_usec = 0;
+                      }
+                    if (mbig && mdiff == 1 && get_stat_mtime_ns (&st) == 0)
+                      {
+                        tt = truncated_timeval;
+                        tt[1].tv_usec = 0;
+                      }
+                    if (tt)
+                      futimes (fd, tt);
+                  }
+              }
+#  endif
+
+            return 0;
+          }
+# endif
+      }
+#endif /* HAVE_FUTIMESAT || HAVE_WORKING_UTIMES */
+
+    if (!file)
+      {
+#if ! ((HAVE_FUTIMESAT && !FUTIMESAT_NULL_BUG)          \
+        || (HAVE_WORKING_UTIMES && HAVE_FUTIMES))
+        errno = ENOSYS;
+#endif
+        return -1;
+      }
+
+#ifdef USE_SETFILETIME
+    return _gl_utimens_windows (file, ts);
+#elif HAVE_WORKING_UTIMES
+    return utimes (file, t);
+#else
+    {
+      struct utimbuf utimbuf;
+      struct utimbuf *ut;
+      if (ts)
+        {
+          utimbuf = (struct utimbuf) { .actime  = ts[0].tv_sec,
+                                       .modtime = ts[1].tv_sec };
+          ut = &utimbuf;
+        }
+      else
+        ut = NULL;
+
+      return utime (file, ut);
+    }
+#endif /* !HAVE_WORKING_UTIMES */
+  }
+}
+
+/* Set the access and modification timestamps of FILE to be
+   TIMESPEC[0] and TIMESPEC[1], respectively.  */
+int
+utimens (char const *file, struct timespec const timespec[2])
+{
+  return fdutimens (-1, file, timespec);
+}
+
+/* Set the access and modification timestamps of FILE to be
+   TIMESPEC[0] and TIMESPEC[1], respectively, without dereferencing
+   symlinks.  Fail with ENOSYS if the platform does not support
+   changing symlink timestamps, but FILE was a symlink.  */
+int
+lutimens (char const *file, struct timespec const timespec[2])
+{
+  struct timespec adjusted_timespec[2];
+  struct timespec *ts = timespec ? adjusted_timespec : NULL;
+  int adjustment_needed = 0;
+  struct stat st;
+
+  if (ts)
+    {
+      adjusted_timespec[0] = timespec[0];
+      adjusted_timespec[1] = timespec[1];
+      adjustment_needed = validate_timespec (ts);
+    }
+  if (adjustment_needed < 0)
+    return -1;
+
+  /* The Linux kernel did not support symlink timestamps until
+     utimensat, in version 2.6.22, so we don't need to mimic
+     fdutimens' worry about buggy NFS clients.  But we do have to
+     worry about bogus return values.  */
+
+#if HAVE_UTIMENSAT
+  if (0 <= lutimensat_works_really)
+    {
+      int result;
+# if __linux__ || __sun
+      /* As recently as Linux kernel 2.6.32 (Dec 2009), several file
+         systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
+         but work if both times are either explicitly specified or
+         UTIME_NOW.  Work around it with a preparatory lstat prior to
+         calling utimensat; fortunately, there is not much timing
+         impact due to the extra syscall even on file systems where
+         UTIME_OMIT would have worked.
+
+         The same bug occurs in Solaris 11.1 (Apr 2013).
+
+         FIXME: Simplify this for Linux in 2016 and for Solaris in
+         2024, when file system bugs are no longer common.  */
+      if (adjustment_needed == 2)
+        {
+          if (lstat (file, &st))
+            return -1;
+          if (ts[0].tv_nsec == UTIME_OMIT)
+            ts[0] = get_stat_atime (&st);
+          else if (ts[1].tv_nsec == UTIME_OMIT)
+            ts[1] = get_stat_mtime (&st);
+          /* Note that st is good, in case utimensat gives ENOSYS.  */
+          adjustment_needed++;
+        }
+# endif
+      result = utimensat (AT_FDCWD, file, ts, AT_SYMLINK_NOFOLLOW);
+# ifdef __linux__
+      /* Work around a kernel bug:
+         https://bugzilla.redhat.com/show_bug.cgi?id=442352
+         https://bugzilla.redhat.com/show_bug.cgi?id=449910
+         It appears that utimensat can mistakenly return 280 rather
+         than -1 upon ENOSYS failure.
+         FIXME: remove in 2010 or whenever the offending kernels
+         are no longer in common use.  */
+      if (0 < result)
+        errno = ENOSYS;
+# endif
+      if (result == 0 || errno != ENOSYS)
+        {
+          utimensat_works_really = 1;
+          lutimensat_works_really = 1;
+          return result;
+        }
+    }
+  lutimensat_works_really = -1;
+#endif /* HAVE_UTIMENSAT */
+
+  /* The platform lacks an interface to set file timestamps with
+     nanosecond resolution, so do the best we can, discarding any
+     fractional part of the timestamp.  */
+
+  if (adjustment_needed || REPLACE_FUNC_STAT_FILE)
+    {
+      if (adjustment_needed != 3 && lstat (file, &st))
+        return -1;
+      if (ts && update_timespec (&st, &ts))
+        return 0;
+    }
+
+  /* On Linux, lutimes is a thin wrapper around utimensat, so there is
+     no point trying lutimes if utimensat failed with ENOSYS.  */
+#if HAVE_LUTIMES && !HAVE_UTIMENSAT
+  {
+    struct timeval timeval[2];
+    struct timeval *t;
+    int result;
+    if (ts)
+      {
+        timeval[0] = (struct timeval) { .tv_sec = ts[0].tv_sec,
+                                        .tv_usec = ts[0].tv_nsec / 1000 };
+        timeval[1] = (struct timeval) { .tv_sec = ts[1].tv_sec,
+                                        .tv_usec = ts[1].tv_nsec / 1000 };
+        t = timeval;
+      }
+    else
+      t = NULL;
+
+    result = lutimes (file, t);
+    if (result == 0 || errno != ENOSYS)
+      return result;
+  }
+#endif /* HAVE_LUTIMES && !HAVE_UTIMENSAT */
+
+  /* Out of luck for symlinks, but we still handle regular files.  */
+  if (!(adjustment_needed || REPLACE_FUNC_STAT_FILE) && lstat (file, &st))
+    return -1;
+  if (!S_ISLNK (st.st_mode))
+    return fdutimens (-1, file, ts);
+  errno = ENOSYS;
+  return -1;
+}
deleted file mode 120000 (symlink)
index 8382db1666e860a30e98b86731296f397807ba9f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/utimens.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7c740afd36d064cc1b877b64e39e5f88275cdf49
--- /dev/null
@@ -0,0 +1,51 @@
+/* Set file access and modification times.
+
+   Copyright 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <time.h>
+int fdutimens (int, char const *, struct timespec const [2]);
+int utimens (char const *, struct timespec const [2]);
+int lutimens (char const *, struct timespec const [2]);
+
+#if GNULIB_FDUTIMENSAT
+# include <fcntl.h>
+# include <sys/stat.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_UTIMENS_INLINE
+# define _GL_UTIMENS_INLINE _GL_INLINE
+#endif
+
+int fdutimensat (int fd, int dir, char const *name, struct timespec const [2],
+                 int atflag);
+
+/* Using this function makes application code slightly more readable.  */
+_GL_UTIMENS_INLINE int
+lutimensat (int dir, char const *file, struct timespec const times[2])
+{
+  return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW);
+}
+
+_GL_INLINE_HEADER_END
+
+#endif
deleted file mode 120000 (symlink)
index 84bcd7bfdd39e921a3fd4953e08be33cc34cd18d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/utimensat.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1321264269e1c710464e3fcd0065b4897aae6be4
--- /dev/null
@@ -0,0 +1,217 @@
+/* Set the access and modification time of a file relative to directory fd.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Eric Blake */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "stat-time.h"
+#include "timespec.h"
+#include "utimens.h"
+
+#if HAVE_NEARLY_WORKING_UTIMENSAT
+
+/* Use the original utimensat(), but correct the trailing slash handling.  */
+int
+rpl_utimensat (int fd, char const *file, struct timespec const times[2],
+               int flag)
+# undef utimensat
+{
+  size_t len = strlen (file);
+  if (len && file[len - 1] == '/')
+    {
+      struct stat st;
+      if (fstatat (fd, file, &st, flag & AT_SYMLINK_NOFOLLOW) < 0)
+        return -1;
+      if (!S_ISDIR (st.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
+    }
+
+  return utimensat (fd, file, times, flag);
+}
+
+#else
+
+# if HAVE_UTIMENSAT
+
+/* If we have a native utimensat, but are compiling this file, then
+   utimensat was defined to rpl_utimensat by our replacement
+   sys/stat.h.  We assume the native version might fail with ENOSYS,
+   or succeed without properly affecting ctime (as is the case when
+   using newer glibc but older Linux kernel).  In this scenario,
+   rpl_utimensat checks whether the native version is usable, and
+   local_utimensat provides the fallback manipulation.  */
+
+static int local_utimensat (int, char const *, struct timespec const[2], int);
+#  define AT_FUNC_NAME local_utimensat
+
+/* Like utimensat, but work around native bugs.  */
+
+int
+rpl_utimensat (int fd, char const *file, struct timespec const times[2],
+               int flag)
+#  undef utimensat
+{
+#  if defined __linux__ || defined __sun
+  struct timespec ts[2];
+#  endif
+
+  /* See comments in utimens.c for details.  */
+  static int utimensat_works_really; /* 0 = unknown, 1 = yes, -1 = no.  */
+  if (0 <= utimensat_works_really)
+    {
+      int result;
+#  if defined __linux__ || defined __sun
+      struct stat st;
+      /* As recently as Linux kernel 2.6.32 (Dec 2009), several file
+         systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
+         but work if both times are either explicitly specified or
+         UTIME_NOW.  Work around it with a preparatory [l]stat prior
+         to calling utimensat; fortunately, there is not much timing
+         impact due to the extra syscall even on file systems where
+         UTIME_OMIT would have worked.
+
+         The same bug occurs in Solaris 11.1 (Apr 2013).
+
+         FIXME: Simplify this in 2024, when these file system bugs are
+         no longer common on Gnulib target platforms.  */
+      if (times && (times[0].tv_nsec == UTIME_OMIT
+                    || times[1].tv_nsec == UTIME_OMIT))
+        {
+          if (fstatat (fd, file, &st, flag))
+            return -1;
+          if (times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT)
+            return 0;
+          if (times[0].tv_nsec == UTIME_OMIT)
+            ts[0] = get_stat_atime (&st);
+          else
+            ts[0] = times[0];
+          if (times[1].tv_nsec == UTIME_OMIT)
+            ts[1] = get_stat_mtime (&st);
+          else
+            ts[1] = times[1];
+          times = ts;
+        }
+#   ifdef __hppa__
+      /* Linux kernel 2.6.22.19 on hppa does not reject invalid tv_nsec
+         values.  */
+      else if (times
+               && ((times[0].tv_nsec != UTIME_NOW
+                    && ! (0 <= times[0].tv_nsec
+                          && times[0].tv_nsec < TIMESPEC_HZ))
+                   || (times[1].tv_nsec != UTIME_NOW
+                       && ! (0 <= times[1].tv_nsec
+                             && times[1].tv_nsec < TIMESPEC_HZ))))
+        {
+          errno = EINVAL;
+          return -1;
+        }
+#   endif
+#  endif
+#  if defined __APPLE__ && defined __MACH__
+      /* macOS 10.13 does not reject invalid tv_nsec values either.  */
+      if (times
+          && ((times[0].tv_nsec != UTIME_OMIT
+               && times[0].tv_nsec != UTIME_NOW
+               && ! (0 <= times[0].tv_nsec
+                     && times[0].tv_nsec < TIMESPEC_HZ))
+              || (times[1].tv_nsec != UTIME_OMIT
+                  && times[1].tv_nsec != UTIME_NOW
+                  && ! (0 <= times[1].tv_nsec
+                        && times[1].tv_nsec < TIMESPEC_HZ))))
+        {
+          errno = EINVAL;
+          return -1;
+        }
+      size_t len = strlen (file);
+      if (len > 0 && file[len - 1] == '/')
+        {
+          struct stat statbuf;
+          if (fstatat (fd, file, &statbuf, 0) < 0)
+            return -1;
+          if (!S_ISDIR (statbuf.st_mode))
+            {
+              errno = ENOTDIR;
+              return -1;
+            }
+        }
+#  endif
+      result = utimensat (fd, file, times, flag);
+      /* Linux kernel 2.6.25 has a bug where it returns EINVAL for
+         UTIME_NOW or UTIME_OMIT with non-zero tv_sec, which
+         local_utimensat works around.  Meanwhile, EINVAL for a bad
+         flag is indeterminate whether the native utimensat works, but
+         local_utimensat will also reject it.  */
+      if (result == -1 && errno == EINVAL && (flag & ~AT_SYMLINK_NOFOLLOW))
+        return result;
+      if (result == 0 || (errno != ENOSYS && errno != EINVAL))
+        {
+          utimensat_works_really = 1;
+          return result;
+        }
+    }
+  /* No point in trying openat/futimens, since on Linux, futimens is
+     implemented with the same syscall as utimensat.  Only avoid the
+     native utimensat due to an ENOSYS failure; an EINVAL error was
+     data-dependent, and the next caller may pass valid data.  */
+  if (0 <= utimensat_works_really && errno == ENOSYS)
+    utimensat_works_really = -1;
+  return local_utimensat (fd, file, times, flag);
+}
+
+# else /* !HAVE_UTIMENSAT */
+
+#  define AT_FUNC_NAME utimensat
+
+# endif /* !HAVE_UTIMENSAT */
+
+/* Set the access and modification timestamps of FILE to be
+   TIMESPEC[0] and TIMESPEC[1], respectively; relative to directory
+   FD.  If flag is AT_SYMLINK_NOFOLLOW, change the times of a symlink,
+   or fail with ENOSYS if not possible.  If TIMESPEC is null, set the
+   timestamps to the current time.  If possible, do it without
+   changing the working directory.  Otherwise, resort to using
+   save_cwd/fchdir, then utimens/restore_cwd.  If either the save_cwd
+   or the restore_cwd fails, then give a diagnostic and exit nonzero.
+   Return 0 on success, -1 (setting errno) on failure.  */
+
+/* AT_FUNC_NAME is now utimensat or local_utimensat.  */
+# define AT_FUNC_F1 lutimens
+# define AT_FUNC_F2 utimens
+# define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
+# define AT_FUNC_POST_FILE_PARAM_DECLS , struct timespec const ts[2], int flag
+# define AT_FUNC_POST_FILE_ARGS        , ts
+# 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
+
+#endif /* !HAVE_NEARLY_WORKING_UTIMENSAT */
deleted file mode 120000 (symlink)
index 33657bd2fffcedfb840f80e22044f113f0b60777..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/vasnprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..544ae62d9ff871b8231586b4e47da6f3ad70abd8
--- /dev/null
+/* vsprintf with automatic memory allocation.
+   Copyright (C) 1999, 2002-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file can be parametrized with the following macros:
+     VASNPRINTF         The name of the function being defined.
+     FCHAR_T            The element type of the format string.
+     DCHAR_T            The element type of the destination (result) string.
+     FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters
+                        in the format string are ASCII. MUST be set if
+                        FCHAR_T and DCHAR_T are not the same type.
+     DIRECTIVE          Structure denoting a format directive.
+                        Depends on FCHAR_T.
+     DIRECTIVES         Structure denoting the set of format directives of a
+                        format string.  Depends on FCHAR_T.
+     PRINTF_PARSE       Function that parses a format string.
+                        Depends on FCHAR_T.
+     DCHAR_CPY          memcpy like function for DCHAR_T[] arrays.
+     DCHAR_SET          memset like function for DCHAR_T[] arrays.
+     DCHAR_MBSNLEN      mbsnlen like function for DCHAR_T[] arrays.
+     SNPRINTF           The system's snprintf (or similar) function.
+                        This may be either snprintf or swprintf.
+     TCHAR_T            The element type of the argument and result string
+                        of the said SNPRINTF function.  This may be either
+                        char or wchar_t.  The code exploits that
+                        sizeof (TCHAR_T) | sizeof (DCHAR_T) and
+                        alignof (TCHAR_T) <= alignof (DCHAR_T).
+     DCHAR_IS_TCHAR     Set to 1 if DCHAR_T and TCHAR_T are the same type.
+     DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[].
+     DCHAR_IS_UINT8_T   Set to 1 if DCHAR_T is uint8_t.
+     DCHAR_IS_UINT16_T  Set to 1 if DCHAR_T is uint16_t.
+     DCHAR_IS_UINT32_T  Set to 1 if DCHAR_T is uint32_t.
+     ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
+     ENABLE_WCHAR_FALLBACK  Set to 1 to avoid EILSEQ during conversion of wide
+                        characters (wchar_t) and wide character strings
+                        (wchar_t[]) to multibyte sequences.  The fallback is the
+                        hexadecimal escape syntax (\unnnn or \Unnnnnnnn) or,
+                        if wchar_t is not Unicode encoded, \wnnnn or \Wnnnnnnnn.
+ */
+
+/* Tell glibc's <stdio.h> to provide a prototype for snprintf().
+   This must come before <config.h> because <config.h> may include
+   <features.h>, and once <features.h> has been included, it's too late.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE    1
+#endif
+
+#ifndef VASNPRINTF
+# include <config.h>
+#endif
+
+/* As of GCC 11.2.1, gcc -Wanalyzer-too-complex reports that main's
+   use of CHECK macros expands to code that is too complicated for gcc
+   -fanalyzer.  Suppress the resulting bogus warnings.  */
+#if 10 <= __GNUC__
+# pragma GCC diagnostic ignored "-Wanalyzer-null-argument"
+#endif
+
+#include <alloca.h>
+
+/* Specification.  */
+#ifndef VASNPRINTF
+# if WIDE_CHAR_VERSION
+#  include "vasnwprintf.h"
+# else
+#  include "vasnprintf.h"
+# endif
+#endif
+
+#include <locale.h>     /* localeconv() */
+#include <stdio.h>      /* snprintf(), sprintf() */
+#include <stdlib.h>     /* abort(), malloc(), realloc(), free() */
+#include <string.h>     /* memcpy(), strlen() */
+#include <wchar.h>      /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb(), mbszero() */
+#include <errno.h>      /* errno */
+#include <limits.h>     /* CHAR_BIT, INT_WIDTH, LONG_WIDTH */
+#include <float.h>      /* DBL_MAX_EXP, LDBL_MAX_EXP */
+#if HAVE_NL_LANGINFO
+# include <langinfo.h>
+#endif
+#ifndef VASNPRINTF
+# if WIDE_CHAR_VERSION
+#  include "wprintf-parse.h"
+# else
+#  include "printf-parse.h"
+# endif
+#endif
+
+/* Checked size_t computations.  */
+#include "xsize.h"
+
+#include "attribute.h"
+
+#if NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION)
+# include <math.h>
+# include "float+.h"
+#endif
+
+#if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
+# include <math.h>
+# include "isnand-nolibm.h"
+#endif
+
+#if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION)
+# include <math.h>
+# include "isnanl-nolibm.h"
+# include "fpucw.h"
+#endif
+
+#if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
+# include <math.h>
+# include "isnand-nolibm.h"
+# include "printf-frexp.h"
+#endif
+
+#if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION)
+# include <math.h>
+# include "isnanl-nolibm.h"
+# include "printf-frexpl.h"
+# include "fpucw.h"
+#endif
+
+/* Default parameters.  */
+#ifndef VASNPRINTF
+# if WIDE_CHAR_VERSION
+#  define VASNPRINTF vasnwprintf
+#  define FCHAR_T wchar_t
+#  define DCHAR_T wchar_t
+#  define DIRECTIVE wchar_t_directive
+#  define DIRECTIVES wchar_t_directives
+#  define PRINTF_PARSE wprintf_parse
+#  define DCHAR_CPY wmemcpy
+#  define DCHAR_SET wmemset
+# else
+#  define VASNPRINTF vasnprintf
+#  define FCHAR_T char
+#  define DCHAR_T char
+#  define TCHAR_T char
+#  define DCHAR_IS_TCHAR 1
+#  define DIRECTIVE char_directive
+#  define DIRECTIVES char_directives
+#  define PRINTF_PARSE printf_parse
+#  define DCHAR_CPY memcpy
+#  define DCHAR_SET memset
+# endif
+#endif
+#if WIDE_CHAR_VERSION
+  /* DCHAR_T is wchar_t.  */
+# if HAVE_DECL__SNWPRINTF || (HAVE_SWPRINTF && HAVE_WORKING_SWPRINTF)
+#  define TCHAR_T wchar_t
+#  define DCHAR_IS_TCHAR 1
+#  define USE_SNPRINTF 1
+#  if HAVE_DECL__SNWPRINTF
+    /* On Windows, the function swprintf() has a different signature than
+       on Unix; we use the function _snwprintf() or - on mingw - snwprintf()
+       instead.  The mingw function snwprintf() has fewer bugs than the
+       MSVCRT function _snwprintf(), so prefer that.  */
+#   if defined __MINGW32__
+#    define SNPRINTF snwprintf
+#   else
+#    define SNPRINTF _snwprintf
+#    define USE_MSVC__SNPRINTF 1
+#   endif
+#  else
+    /* Unix.  */
+#   define SNPRINTF swprintf
+#  endif
+# else
+   /* Old platforms such as NetBSD 3.0, OpenBSD 3.8, HP-UX 11.00, IRIX 6.5.  */
+#   define TCHAR_T char
+# endif
+#endif
+#if !WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR
+  /* TCHAR_T is char.  */
+  /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
+     But don't use it on BeOS, since BeOS snprintf produces no output if the
+     size argument is >= 0x3000000.
+     Also don't use it on Linux libc5, since there snprintf with size = 1
+     writes any output without bounds, like sprintf.  */
+# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1)
+#  define USE_SNPRINTF 1
+# else
+#  define USE_SNPRINTF 0
+# endif
+# if HAVE_DECL__SNPRINTF
+   /* Windows.  The mingw function snprintf() has fewer bugs than the MSVCRT
+      function _snprintf(), so prefer that.  */
+#  if defined __MINGW32__
+#   define SNPRINTF snprintf
+    /* Here we need to call the native snprintf, not rpl_snprintf.  */
+#   undef snprintf
+#  else
+    /* MSVC versions < 14 did not have snprintf, only _snprintf.  */
+#   define SNPRINTF _snprintf
+#   define USE_MSVC__SNPRINTF 1
+#  endif
+# else
+   /* Unix.  */
+#  define SNPRINTF snprintf
+   /* Here we need to call the native snprintf, not rpl_snprintf.  */
+#  undef snprintf
+# endif
+#endif
+/* Here we need to call the native sprintf, not rpl_sprintf.  */
+#undef sprintf
+
+/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized"
+   warnings in this file.  Use -Dlint to suppress them.  */
+#if defined GCC_LINT || defined lint
+# define IF_LINT(Code) Code
+#else
+# define IF_LINT(Code) /* empty */
+#endif
+
+/* Avoid some warnings from "gcc -Wshadow".
+   This file doesn't use the exp() and remainder() functions.  */
+#undef exp
+#define exp expo
+#undef remainder
+#define remainder rem
+
+#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && !WIDE_CHAR_VERSION
+# if (HAVE_STRNLEN && !defined _AIX)
+#  define local_strnlen strnlen
+# else
+#  ifndef local_strnlen_defined
+#   define local_strnlen_defined 1
+static size_t
+local_strnlen (const char *string, size_t maxlen)
+{
+  const char *end = memchr (string, '\0', maxlen);
+  return end ? (size_t) (end - string) : maxlen;
+}
+#  endif
+# endif
+#endif
+
+#if (((!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_WPRINTF_DIRECTIVE_LC) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T
+# if HAVE_WCSLEN
+#  define local_wcslen wcslen
+# else
+   /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
+      a dependency towards this library, here is a local substitute.
+      Define this substitute only once, even if this file is included
+      twice in the same compilation unit.  */
+#  ifndef local_wcslen_defined
+#   define local_wcslen_defined 1
+static size_t
+local_wcslen (const wchar_t *s)
+{
+  const wchar_t *ptr;
+
+  for (ptr = s; *ptr != (wchar_t) 0; ptr++)
+    ;
+  return ptr - s;
+}
+#  endif
+# endif
+#endif
+
+#if (!USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && HAVE_WCHAR_T && WIDE_CHAR_VERSION
+# if HAVE_WCSNLEN && HAVE_DECL_WCSNLEN
+#  define local_wcsnlen wcsnlen
+# else
+#  ifndef local_wcsnlen_defined
+#   define local_wcsnlen_defined 1
+static size_t
+local_wcsnlen (const wchar_t *s, size_t maxlen)
+{
+  const wchar_t *ptr;
+
+  for (ptr = s; maxlen > 0 && *ptr != (wchar_t) 0; ptr++, maxlen--)
+    ;
+  return ptr - s;
+}
+#  endif
+# endif
+#endif
+
+#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || ((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T)) && !WIDE_CHAR_VERSION
+# if ENABLE_WCHAR_FALLBACK
+static size_t
+wctomb_fallback (char *s, wchar_t wc)
+{
+  static char const hex[16] = "0123456789ABCDEF";
+
+  s[0] = '\\';
+  if (sizeof (wchar_t) > 2 && wc > 0xffff)
+    {
+#  if __STDC_ISO_10646__ || (__GLIBC__ >= 2) || (defined _WIN32 || defined __CYGWIN__)
+      s[1] = 'U';
+#  else
+      s[1] = 'W';
+#  endif
+      s[2] = hex[(wc & 0xf0000000U) >> 28];
+      s[3] = hex[(wc & 0xf000000U) >> 24];
+      s[4] = hex[(wc & 0xf00000U) >> 20];
+      s[5] = hex[(wc & 0xf0000U) >> 16];
+      s[6] = hex[(wc & 0xf000U) >> 12];
+      s[7] = hex[(wc & 0xf00U) >> 8];
+      s[8] = hex[(wc & 0xf0U) >> 4];
+      s[9] = hex[wc & 0xfU];
+      return 10;
+    }
+  else
+    {
+#  if __STDC_ISO_10646__ || (__GLIBC__ >= 2) || (defined _WIN32 || defined __CYGWIN__)
+      s[1] = 'u';
+#  else
+      s[1] = 'w';
+#  endif
+      s[2] = hex[(wc & 0xf000U) >> 12];
+      s[3] = hex[(wc & 0xf00U) >> 8];
+      s[4] = hex[(wc & 0xf0U) >> 4];
+      s[5] = hex[wc & 0xfU];
+      return 6;
+    }
+}
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+static size_t
+local_wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
+{
+  size_t count = wcrtomb (s, wc, ps);
+  if (count == (size_t)(-1))
+    count = wctomb_fallback (s, wc);
+  return count;
+}
+#  else
+static int
+local_wctomb (char *s, wchar_t wc)
+{
+  int count = wctomb (s, wc);
+  if (count < 0)
+    count = wctomb_fallback (s, wc);
+  return count;
+}
+#   define local_wcrtomb(S, WC, PS)  local_wctomb ((S), (WC))
+#  endif
+# else
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+#   define local_wcrtomb(S, WC, PS)  wcrtomb ((S), (WC), (PS))
+#  else
+#   define local_wcrtomb(S, WC, PS)  wctomb ((S), (WC))
+#  endif
+# endif
+#endif
+
+#if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION)
+/* Determine the decimal-point character according to the current locale.  */
+# ifndef decimal_point_char_defined
+#  define decimal_point_char_defined 1
+static char
+decimal_point_char (void)
+{
+  const char *point;
+  /* Determine it in a multithread-safe way.  We know nl_langinfo is
+     multithread-safe on glibc systems and Mac OS X systems, but is not required
+     to be multithread-safe by POSIX.  sprintf(), however, is multithread-safe.
+     localeconv() is rarely multithread-safe.  */
+#  if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__))
+  point = nl_langinfo (RADIXCHAR);
+#  elif 1
+  char pointbuf[5];
+  sprintf (pointbuf, "%#.0f", 1.0);
+  point = &pointbuf[1];
+#  else
+  point = localeconv () -> decimal_point;
+#  endif
+  /* The decimal point is always a single byte: either '.' or ','.  */
+  return (point[0] != '\0' ? point[0] : '.');
+}
+# endif
+#endif
+
+#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE
+
+/* Equivalent to !isfinite(x) || x == 0, but does not require libm.  */
+static int
+is_infinite_or_zero (double x)
+{
+  return isnand (x) || x + x == x;
+}
+
+#endif
+
+#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE
+
+/* Equivalent to !isfinite(x) || x == 0, but does not require libm.  */
+static int
+is_infinite_or_zerol (long double x)
+{
+  return isnanl (x) || x + x == x;
+}
+
+#endif
+
+#if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE
+
+/* Converting 'long double' to decimal without rare rounding bugs requires
+   real bignums.  We use the naming conventions of GNU gmp, but vastly simpler
+   (and slower) algorithms.  */
+
+typedef unsigned int mp_limb_t;
+# define GMP_LIMB_BITS 32
+static_assert (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS);
+
+typedef unsigned long long mp_twolimb_t;
+# define GMP_TWOLIMB_BITS 64
+static_assert (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS);
+
+/* Representation of a bignum >= 0.  */
+typedef struct
+{
+  size_t nlimbs;
+  mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc().  */
+} mpn_t;
+
+/* Compute the product of two bignums >= 0.
+   Return the allocated memory in case of success, NULL in case of memory
+   allocation failure.  */
+static void *
+multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
+{
+  const mp_limb_t *p1;
+  const mp_limb_t *p2;
+  size_t len1;
+  size_t len2;
+
+  if (src1.nlimbs <= src2.nlimbs)
+    {
+      len1 = src1.nlimbs;
+      p1 = src1.limbs;
+      len2 = src2.nlimbs;
+      p2 = src2.limbs;
+    }
+  else
+    {
+      len1 = src2.nlimbs;
+      p1 = src2.limbs;
+      len2 = src1.nlimbs;
+      p2 = src1.limbs;
+    }
+  /* Now 0 <= len1 <= len2.  */
+  if (len1 == 0)
+    {
+      /* src1 or src2 is zero.  */
+      dest->nlimbs = 0;
+      dest->limbs = (mp_limb_t *) malloc (1);
+    }
+  else
+    {
+      /* Here 1 <= len1 <= len2.  */
+      size_t dlen;
+      mp_limb_t *dp;
+      size_t k, i, j;
+
+      dlen = len1 + len2;
+      dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
+      if (dp == NULL)
+        return NULL;
+      for (k = len2; k > 0; )
+        dp[--k] = 0;
+      for (i = 0; i < len1; i++)
+        {
+          mp_limb_t digit1 = p1[i];
+          mp_twolimb_t carry = 0;
+          for (j = 0; j < len2; j++)
+            {
+              mp_limb_t digit2 = p2[j];
+              carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+              carry += dp[i + j];
+              dp[i + j] = (mp_limb_t) carry;
+              carry = carry >> GMP_LIMB_BITS;
+            }
+          dp[i + len2] = (mp_limb_t) carry;
+        }
+      /* Normalise.  */
+      while (dlen > 0 && dp[dlen - 1] == 0)
+        dlen--;
+      dest->nlimbs = dlen;
+      dest->limbs = dp;
+    }
+  return dest->limbs;
+}
+
+/* Compute the quotient of a bignum a >= 0 and a bignum b > 0.
+   a is written as  a = q * b + r  with 0 <= r < b.  q is the quotient, r
+   the remainder.
+   Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd,
+   q is incremented.
+   Return the allocated memory in case of success, NULL in case of memory
+   allocation failure.  */
+static void *
+divide (mpn_t a, mpn_t b, mpn_t *q)
+{
+  /* Algorithm:
+     First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]]
+     with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS).
+     If m<n, then q:=0 and r:=a.
+     If m>=n=1, perform a single-precision division:
+       r:=0, j:=m,
+       while j>0 do
+         {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j =
+               = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r<b[0]<beta}
+         j:=j-1, r:=r*beta+a[j], q[j]:=floor(r/b[0]), r:=r-b[0]*q[j].
+       Normalise [q[m-1],...,q[0]], yields q.
+     If m>=n>1, perform a multiple-precision division:
+       We have a/b < beta^(m-n+1).
+       s:=intDsize-1-(highest bit in b[n-1]), 0<=s<intDsize.
+       Shift a and b left by s bits, copying them. r:=a.
+       r=[r[m],...,r[0]], b=[b[n-1],...,b[0]] with b[n-1]>=beta/2.
+       For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).}
+         Compute q* :
+           q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]).
+           In case of overflow (q* >= beta) set q* := beta-1.
+           Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2]
+           and c3 := b[n-2] * q*.
+           {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow
+            occurred.  Furthermore 0 <= c3 < beta^2.
+            If there was overflow and
+            r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2,
+            the next test can be skipped.}
+           While c3 > c2, {Here 0 <= c2 < c3 < beta^2}
+             Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2].
+           If q* > 0:
+             Put r := r - b * q* * beta^j. In detail:
+               [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]].
+               hence: u:=0, for i:=0 to n-1 do
+                              u := u + q* * b[i],
+                              r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry),
+                              u:=u div beta (+ 1, if carry in subtraction)
+                      r[n+j]:=r[n+j]-u.
+               {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1
+                               < q* + 1 <= beta,
+                the carry u does not overflow.}
+             If a negative carry occurs, put q* := q* - 1
+               and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]].
+         Set q[j] := q*.
+       Normalise [q[m-n],..,q[0]]; this yields the quotient q.
+       Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the
+       rest r.
+       The room for q[j] can be allocated at the memory location of r[n+j].
+     Finally, round-to-even:
+       Shift r left by 1 bit.
+       If r > b or if r = b and q[0] is odd, q := q+1.
+   */
+  const mp_limb_t *a_ptr = a.limbs;
+  size_t a_len = a.nlimbs;
+  const mp_limb_t *b_ptr = b.limbs;
+  size_t b_len = b.nlimbs;
+  mp_limb_t *roomptr;
+  mp_limb_t *tmp_roomptr = NULL;
+  mp_limb_t *q_ptr;
+  size_t q_len;
+  mp_limb_t *r_ptr;
+  size_t r_len;
+
+  /* Allocate room for a_len+2 digits.
+     (Need a_len+1 digits for the real division and 1 more digit for the
+     final rounding of q.)  */
+  roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t));
+  if (roomptr == NULL)
+    return NULL;
+
+  /* Normalise a.  */
+  while (a_len > 0 && a_ptr[a_len - 1] == 0)
+    a_len--;
+
+  /* Normalise b.  */
+  for (;;)
+    {
+      if (b_len == 0)
+        /* Division by zero.  */
+        abort ();
+      if (b_ptr[b_len - 1] == 0)
+        b_len--;
+      else
+        break;
+    }
+
+  /* Here m = a_len >= 0 and n = b_len > 0.  */
+
+  if (a_len < b_len)
+    {
+      /* m<n: trivial case.  q=0, r := copy of a.  */
+      r_ptr = roomptr;
+      r_len = a_len;
+      memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
+      q_ptr = roomptr + a_len;
+      q_len = 0;
+    }
+  else if (b_len == 1)
+    {
+      /* n=1: single precision division.
+         beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
+      r_ptr = roomptr;
+      q_ptr = roomptr + 1;
+      {
+        mp_limb_t den = b_ptr[0];
+        mp_limb_t remainder = 0;
+        const mp_limb_t *sourceptr = a_ptr + a_len;
+        mp_limb_t *destptr = q_ptr + a_len;
+        size_t count;
+        for (count = a_len; count > 0; count--)
+          {
+            mp_twolimb_t num =
+              ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
+            *--destptr = num / den;
+            remainder = num % den;
+          }
+        /* Normalise and store r.  */
+        if (remainder > 0)
+          {
+            r_ptr[0] = remainder;
+            r_len = 1;
+          }
+        else
+          r_len = 0;
+        /* Normalise q.  */
+        q_len = a_len;
+        if (q_ptr[q_len - 1] == 0)
+          q_len--;
+      }
+    }
+  else
+    {
+      /* n>1: multiple precision division.
+         beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
+         beta^(m-n-1) <= a/b < beta^(m-n+1).  */
+      /* Determine s.  */
+      size_t s;
+      {
+        mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
+        /* Determine s = GMP_LIMB_BITS - integer_length (msd).
+           Code copied from gnulib's integer_length.c.  */
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) \
+     || (__clang_major__ >= 4)
+        s = __builtin_clz (msd);
+# else
+#  if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
+        if (GMP_LIMB_BITS <= DBL_MANT_BIT)
+          {
+            /* Use 'double' operations.
+               Assumes an IEEE 754 'double' implementation.  */
+#   define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
+#   define DBL_EXP_BIAS (DBL_EXP_MASK / 2 - 1)
+#   define NWORDS \
+     ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+            union { double value; unsigned int word[NWORDS]; } m;
+
+            /* Use a single integer to floating-point conversion.  */
+            m.value = msd;
+
+            s = GMP_LIMB_BITS
+                - (((m.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT) & DBL_EXP_MASK)
+                   - DBL_EXP_BIAS);
+          }
+        else
+#   undef NWORDS
+#  endif
+          {
+            s = 31;
+            if (msd >= 0x10000)
+              {
+                msd = msd >> 16;
+                s -= 16;
+              }
+            if (msd >= 0x100)
+              {
+                msd = msd >> 8;
+                s -= 8;
+              }
+            if (msd >= 0x10)
+              {
+                msd = msd >> 4;
+                s -= 4;
+              }
+            if (msd >= 0x4)
+              {
+                msd = msd >> 2;
+                s -= 2;
+              }
+            if (msd >= 0x2)
+              {
+                msd = msd >> 1;
+                s -= 1;
+              }
+          }
+# endif
+      }
+      /* 0 <= s < GMP_LIMB_BITS.
+         Copy b, shifting it left by s bits.  */
+      if (s > 0)
+        {
+          tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
+          if (tmp_roomptr == NULL)
+            {
+              free (roomptr);
+              return NULL;
+            }
+          {
+            const mp_limb_t *sourceptr = b_ptr;
+            mp_limb_t *destptr = tmp_roomptr;
+            mp_twolimb_t accu = 0;
+            size_t count;
+            for (count = b_len; count > 0; count--)
+              {
+                accu += (mp_twolimb_t) *sourceptr++ << s;
+                *destptr++ = (mp_limb_t) accu;
+                accu = accu >> GMP_LIMB_BITS;
+              }
+            /* accu must be zero, since that was how s was determined.  */
+            if (accu != 0)
+              abort ();
+          }
+          b_ptr = tmp_roomptr;
+        }
+      /* Copy a, shifting it left by s bits, yields r.
+         Memory layout:
+         At the beginning: r = roomptr[0..a_len],
+         at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
+      r_ptr = roomptr;
+      if (s == 0)
+        {
+          memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
+          r_ptr[a_len] = 0;
+        }
+      else
+        {
+          const mp_limb_t *sourceptr = a_ptr;
+          mp_limb_t *destptr = r_ptr;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = a_len; count > 0; count--)
+            {
+              accu += (mp_twolimb_t) *sourceptr++ << s;
+              *destptr++ = (mp_limb_t) accu;
+              accu = accu >> GMP_LIMB_BITS;
+            }
+          *destptr++ = (mp_limb_t) accu;
+        }
+      q_ptr = roomptr + b_len;
+      q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */
+      {
+        size_t j = a_len - b_len; /* m-n */
+        mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
+        mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
+        mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
+          ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
+        /* Division loop, traversed m-n+1 times.
+           j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
+        for (;;)
+          {
+            mp_limb_t q_star;
+            mp_limb_t c1;
+            if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
+              {
+                /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
+                mp_twolimb_t num =
+                  ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
+                  | r_ptr[j + b_len - 1];
+                q_star = num / b_msd;
+                c1 = num % b_msd;
+              }
+            else
+              {
+                /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
+                q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
+                /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
+                   <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
+                   <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
+                        {<= beta !}.
+                   If yes, jump directly to the subtraction loop.
+                   (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
+                    <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
+                if (r_ptr[j + b_len] > b_msd
+                    || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
+                  /* r[j+n] >= b[n-1]+1 or
+                     r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
+                     carry.  */
+                  goto subtract;
+              }
+            /* q_star = q*,
+               c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
+            {
+              mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
+                ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
+              mp_twolimb_t c3 = /* b[n-2] * q* */
+                (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
+              /* While c2 < c3, increase c2 and decrease c3.
+                 Consider c3-c2.  While it is > 0, decrease it by
+                 b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
+                 this can happen only twice.  */
+              if (c3 > c2)
+                {
+                  q_star = q_star - 1; /* q* := q* - 1 */
+                  if (c3 - c2 > b_msdd)
+                    q_star = q_star - 1; /* q* := q* - 1 */
+                }
+            }
+            if (q_star > 0)
+              subtract:
+              {
+                /* Subtract r := r - b * q* * beta^j.  */
+                mp_limb_t cr;
+                {
+                  const mp_limb_t *sourceptr = b_ptr;
+                  mp_limb_t *destptr = r_ptr + j;
+                  mp_twolimb_t carry = 0;
+                  size_t count;
+                  for (count = b_len; count > 0; count--)
+                    {
+                      /* Here 0 <= carry <= q*.  */
+                      carry =
+                        carry
+                        + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
+                        + (mp_limb_t) ~(*destptr);
+                      /* Here 0 <= carry <= beta*q* + beta-1.  */
+                      *destptr++ = ~(mp_limb_t) carry;
+                      carry = carry >> GMP_LIMB_BITS; /* <= q* */
+                    }
+                  cr = (mp_limb_t) carry;
+                }
+                /* Subtract cr from r_ptr[j + b_len], then forget about
+                   r_ptr[j + b_len].  */
+                if (cr > r_ptr[j + b_len])
+                  {
+                    /* Subtraction gave a carry.  */
+                    q_star = q_star - 1; /* q* := q* - 1 */
+                    /* Add b back.  */
+                    {
+                      const mp_limb_t *sourceptr = b_ptr;
+                      mp_limb_t *destptr = r_ptr + j;
+                      mp_limb_t carry = 0;
+                      size_t count;
+                      for (count = b_len; count > 0; count--)
+                        {
+                          mp_limb_t source1 = *sourceptr++;
+                          mp_limb_t source2 = *destptr;
+                          *destptr++ = source1 + source2 + carry;
+                          carry =
+                            (carry
+                             ? source1 >= (mp_limb_t) ~source2
+                             : source1 > (mp_limb_t) ~source2);
+                        }
+                    }
+                    /* Forget about the carry and about r[j+n].  */
+                  }
+              }
+            /* q* is determined.  Store it as q[j].  */
+            q_ptr[j] = q_star;
+            if (j == 0)
+              break;
+            j--;
+          }
+      }
+      r_len = b_len;
+      /* Normalise q.  */
+      if (q_ptr[q_len - 1] == 0)
+        q_len--;
+# if 0 /* Not needed here, since we need r only to compare it with b/2, and
+          b is shifted left by s bits.  */
+      /* Shift r right by s bits.  */
+      if (s > 0)
+        {
+          mp_limb_t ptr = r_ptr + r_len;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = r_len; count > 0; count--)
+            {
+              accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
+              accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
+              *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
+            }
+        }
+# endif
+      /* Normalise r.  */
+      while (r_len > 0 && r_ptr[r_len - 1] == 0)
+        r_len--;
+    }
+  /* Compare r << 1 with b.  */
+  if (r_len > b_len)
+    goto increment_q;
+  {
+    size_t i;
+    for (i = b_len;;)
+      {
+        mp_limb_t r_i =
+          (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
+          | (i < r_len ? r_ptr[i] << 1 : 0);
+        mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
+        if (r_i > b_i)
+          goto increment_q;
+        if (r_i < b_i)
+          goto keep_q;
+        if (i == 0)
+          break;
+        i--;
+      }
+  }
+  if (q_len > 0 && ((q_ptr[0] & 1) != 0))
+    /* q is odd.  */
+    increment_q:
+    {
+      size_t i;
+      for (i = 0; i < q_len; i++)
+        if (++(q_ptr[i]) != 0)
+          goto keep_q;
+      q_ptr[q_len++] = 1;
+    }
+  keep_q:
+  free (tmp_roomptr);
+  q->limbs = q_ptr;
+  q->nlimbs = q_len;
+  return roomptr;
+}
+
+/* Avoid pointless GCC warning "argument 1 value '18446744073709551615' exceeds
+   maximum object size 9223372036854775807", triggered by the use of xsum as
+   argument of malloc.  */
+# if __GNUC__ >= 7
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Walloc-size-larger-than="
+# endif
+
+/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal
+   representation.
+   Destroys the contents of a.
+   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 *
+convert_to_decimal (mpn_t a, size_t extra_zeroes)
+{
+  mp_limb_t *a_ptr = a.limbs;
+  size_t a_len = a.nlimbs;
+  /* 0.03345 is slightly larger than log(2)/(9*log(10)).  */
+  size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1);
+  /* We need extra_zeroes bytes for zeroes, followed by c_len bytes for the
+     digits of a, followed by 1 byte for the terminating NUL.  */
+  char *c_ptr = (char *) malloc (xsum (xsum (extra_zeroes, c_len), 1));
+  if (c_ptr != NULL)
+    {
+      char *d_ptr = c_ptr;
+      for (; extra_zeroes > 0; extra_zeroes--)
+        *d_ptr++ = '0';
+      while (a_len > 0)
+        {
+          /* Divide a by 10^9, in-place.  */
+          mp_limb_t remainder = 0;
+          mp_limb_t *ptr = a_ptr + a_len;
+          size_t count;
+          for (count = a_len; count > 0; count--)
+            {
+              mp_twolimb_t num =
+                ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
+              *ptr = num / 1000000000;
+              remainder = num % 1000000000;
+            }
+          /* Store the remainder as 9 decimal digits.  */
+          for (count = 9; count > 0; count--)
+            {
+              *d_ptr++ = '0' + (remainder % 10);
+              remainder = remainder / 10;
+            }
+          /* Normalize a.  */
+          if (a_ptr[a_len - 1] == 0)
+            a_len--;
+        }
+      /* Remove leading zeroes.  */
+      while (d_ptr > c_ptr && d_ptr[-1] == '0')
+        d_ptr--;
+      /* But keep at least one zero.  */
+      if (d_ptr == c_ptr)
+        *d_ptr++ = '0';
+      /* Terminate the string.  */
+      *d_ptr = '\0';
+    }
+  return c_ptr;
+}
+
+# if __GNUC__ >= 7
+#  pragma GCC diagnostic pop
+# endif
+
+# 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
+   allocation failure.  */
+static void *
+decode_long_double (long double x, int *ep, mpn_t *mp)
+{
+  mpn_t m;
+  int exp;
+  long double y;
+  size_t i;
+
+  /* Allocate memory for result.  */
+  m.nlimbs = (LDBL_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 = frexpl (x, &exp);
+  if (!(y >= 0.0L && y < 1.0L))
+    abort ();
+  /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the
+     latter is an integer.  */
+  /* Convert the mantissa (y * 2^LDBL_MANT_BIT) to a sequence of limbs.
+     I'm not sure whether it's safe to cast a 'long double' value between
+     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
+    {
+      mp_limb_t hi, lo;
+      y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2));
+      hi = (int) y;
+      y -= hi;
+      if (!(y >= 0.0L && y < 1.0L))
+        abort ();
+      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+      lo = (int) y;
+      y -= lo;
+      if (!(y >= 0.0L && y < 1.0L))
+        abort ();
+      m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
+    }
+#   else
+    {
+      mp_limb_t d;
+      y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS);
+      d = (int) y;
+      y -= d;
+      if (!(y >= 0.0L && y < 1.0L))
+        abort ();
+      m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
+    }
+#   endif
+#  endif
+  for (i = LDBL_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.0L && y < 1.0L))
+        abort ();
+      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+      lo = (int) y;
+      y -= lo;
+      if (!(y >= 0.0L && y < 1.0L))
+        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--;
+  *mp = m;
+  *ep = exp - LDBL_MANT_BIT;
+  return m.limbs;
+}
+
+# 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 * 2^DBL_MANT_BIT), and the
+     latter is an integer.  */
+  /* Convert the mantissa (y * 2^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_decoded (int e, mpn_t m, void *memory, int n)
+{
+  int s;
+  size_t extra_zeroes;
+  unsigned int abs_n;
+  unsigned int abs_s;
+  mp_limb_t *pow5_ptr;
+  size_t pow5_len;
+  unsigned int s_limbs;
+  unsigned int s_bits;
+  mpn_t pow5;
+  mpn_t z;
+  void *z_memory;
+  char *digits;
+
+  /* x = 2^e * m, hence
+     y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m)
+       = round (2^s * 5^n * m).  */
+  s = e + n;
+  extra_zeroes = 0;
+  /* Factor out a common power of 10 if possible.  */
+  if (s > 0 && n > 0)
+    {
+      extra_zeroes = (s < n ? s : n);
+      s -= extra_zeroes;
+      n -= extra_zeroes;
+    }
+  /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes.
+     Before converting to decimal, we need to compute
+     z = round (2^s * 5^n * m).  */
+  /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same
+     sign.  2.322 is slightly larger than log(5)/log(2).  */
+  abs_n = (n >= 0 ? n : -n);
+  abs_s = (s >= 0 ? s : -s);
+  pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1
+                                    + abs_s / GMP_LIMB_BITS + 1)
+                                   * sizeof (mp_limb_t));
+  if (pow5_ptr == NULL)
+    {
+      free (memory);
+      return NULL;
+    }
+  /* Initialize with 1.  */
+  pow5_ptr[0] = 1;
+  pow5_len = 1;
+  /* Multiply with 5^|n|.  */
+  if (abs_n > 0)
+    {
+      static mp_limb_t const small_pow5[13 + 1] =
+        {
+          1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
+          48828125, 244140625, 1220703125
+        };
+      unsigned int n13;
+      for (n13 = 0; n13 <= abs_n; n13 += 13)
+        {
+          mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
+          size_t j;
+          mp_twolimb_t carry = 0;
+          for (j = 0; j < pow5_len; j++)
+            {
+              mp_limb_t digit2 = pow5_ptr[j];
+              carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+              pow5_ptr[j] = (mp_limb_t) carry;
+              carry = carry >> GMP_LIMB_BITS;
+            }
+          if (carry > 0)
+            pow5_ptr[pow5_len++] = (mp_limb_t) carry;
+        }
+    }
+  s_limbs = abs_s / GMP_LIMB_BITS;
+  s_bits = abs_s % GMP_LIMB_BITS;
+  if (n >= 0 ? s >= 0 : s <= 0)
+    {
+      /* Multiply with 2^|s|.  */
+      if (s_bits > 0)
+        {
+          mp_limb_t *ptr = pow5_ptr;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = pow5_len; count > 0; count--)
+            {
+              accu += (mp_twolimb_t) *ptr << s_bits;
+              *ptr++ = (mp_limb_t) accu;
+              accu = accu >> GMP_LIMB_BITS;
+            }
+          if (accu > 0)
+            {
+              *ptr = (mp_limb_t) accu;
+              pow5_len++;
+            }
+        }
+      if (s_limbs > 0)
+        {
+          size_t count;
+          for (count = pow5_len; count > 0;)
+            {
+              count--;
+              pow5_ptr[s_limbs + count] = pow5_ptr[count];
+            }
+          for (count = s_limbs; count > 0;)
+            {
+              count--;
+              pow5_ptr[count] = 0;
+            }
+          pow5_len += s_limbs;
+        }
+      pow5.limbs = pow5_ptr;
+      pow5.nlimbs = pow5_len;
+      if (n >= 0)
+        {
+          /* Multiply m with pow5.  No division needed.  */
+          z_memory = multiply (m, pow5, &z);
+        }
+      else
+        {
+          /* Divide m by pow5 and round.  */
+          z_memory = divide (m, pow5, &z);
+        }
+    }
+  else
+    {
+      pow5.limbs = pow5_ptr;
+      pow5.nlimbs = pow5_len;
+      if (n >= 0)
+        {
+          /* n >= 0, s < 0.
+             Multiply m with pow5, then divide by 2^|s|.  */
+          mpn_t numerator;
+          mpn_t denominator;
+          void *tmp_memory;
+          tmp_memory = multiply (m, pow5, &numerator);
+          if (tmp_memory == NULL)
+            {
+              free (pow5_ptr);
+              free (memory);
+              return NULL;
+            }
+          /* Construct 2^|s|.  */
+          {
+            mp_limb_t *ptr = pow5_ptr + pow5_len;
+            size_t i;
+            for (i = 0; i < s_limbs; i++)
+              ptr[i] = 0;
+            ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
+            denominator.limbs = ptr;
+            denominator.nlimbs = s_limbs + 1;
+          }
+          z_memory = divide (numerator, denominator, &z);
+          free (tmp_memory);
+        }
+      else
+        {
+          /* n < 0, s > 0.
+             Multiply m with 2^s, then divide by pow5.  */
+          mpn_t numerator;
+          mp_limb_t *num_ptr;
+          num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
+                                          * sizeof (mp_limb_t));
+          if (num_ptr == NULL)
+            {
+              free (pow5_ptr);
+              free (memory);
+              return NULL;
+            }
+          {
+            mp_limb_t *destptr = num_ptr;
+            {
+              size_t i;
+              for (i = 0; i < s_limbs; i++)
+                *destptr++ = 0;
+            }
+            if (s_bits > 0)
+              {
+                const mp_limb_t *sourceptr = m.limbs;
+                mp_twolimb_t accu = 0;
+                size_t count;
+                for (count = m.nlimbs; count > 0; count--)
+                  {
+                    accu += (mp_twolimb_t) *sourceptr++ << s_bits;
+                    *destptr++ = (mp_limb_t) accu;
+                    accu = accu >> GMP_LIMB_BITS;
+                  }
+                if (accu > 0)
+                  *destptr++ = (mp_limb_t) accu;
+              }
+            else
+              {
+                const mp_limb_t *sourceptr = m.limbs;
+                size_t count;
+                for (count = m.nlimbs; count > 0; count--)
+                  *destptr++ = *sourceptr++;
+              }
+            numerator.limbs = num_ptr;
+            numerator.nlimbs = destptr - num_ptr;
+          }
+          z_memory = divide (numerator, pow5, &z);
+          free (num_ptr);
+        }
+    }
+  free (pow5_ptr);
+  free (memory);
+
+  /* Here y = round (x * 10^n) = z * 10^extra_zeroes.  */
+
+  if (z_memory == NULL)
+    return NULL;
+  digits = convert_to_decimal (z, extra_zeroes);
+  free (z_memory);
+  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);
+  if (memory != NULL)
+    return scale10_round_decimal_decoded (e, m, memory, n);
+  else
+    return NULL;
+}
+
+# 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);
+  if (memory != NULL)
+    return scale10_round_decimal_decoded (e, m, memory, n);
+  else
+    return NULL;
+}
+
+# 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.  */
+static int
+floorlog10l (long double x)
+{
+  int exp;
+  long double y;
+  double z;
+  double l;
+
+  /* Split into exponential part and mantissa.  */
+  y = frexpl (x, &exp);
+  if (!(y >= 0.0L && y < 1.0L))
+    abort ();
+  if (y == 0.0L)
+    return INT_MIN;
+  if (y < 0.5L)
+    {
+      while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
+        {
+          y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+          exp -= GMP_LIMB_BITS;
+        }
+      if (y < (1.0L / (1 << 16)))
+        {
+          y *= 1.0L * (1 << 16);
+          exp -= 16;
+        }
+      if (y < (1.0L / (1 << 8)))
+        {
+          y *= 1.0L * (1 << 8);
+          exp -= 8;
+        }
+      if (y < (1.0L / (1 << 4)))
+        {
+          y *= 1.0L * (1 << 4);
+          exp -= 4;
+        }
+      if (y < (1.0L / (1 << 2)))
+        {
+          y *= 1.0L * (1 << 2);
+          exp -= 2;
+        }
+      if (y < (1.0L / (1 << 1)))
+        {
+          y *= 1.0L * (1 << 1);
+          exp -= 1;
+        }
+    }
+  if (!(y >= 0.5L && y < 1.0L))
+    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;
+  /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
+     Four terms are enough to get an approximation with error < 10^-7.  */
+  l -= 1.4426950408889634074 * 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
+
+# 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;
+  /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
+     Four terms are enough to get an approximation with error < 10^-7.  */
+  l -= 1.4426950408889634074 * 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
+
+/* Tests whether a string of digits consists of exactly PRECISION zeroes and
+   a single '1' digit.  */
+static int
+is_borderline (const char *digits, size_t precision)
+{
+  for (; precision > 0; precision--, digits++)
+    if (*digits != '0')
+      return 0;
+  if (*digits != '1')
+    return 0;
+  digits++;
+  return *digits == '\0';
+}
+
+#endif
+
+#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF
+
+/* Use a different function name, to make it possible that the 'wchar_t'
+   parametrization and the 'char' parametrization get compiled in the same
+   translation unit.  */
+# if WIDE_CHAR_VERSION
+#  define MAX_ROOM_NEEDED wmax_room_needed
+# else
+#  define MAX_ROOM_NEEDED max_room_needed
+# endif
+
+/* Returns the number of TCHAR_T units needed as temporary space for the result
+   of sprintf or SNPRINTF of a single conversion directive.  */
+static size_t
+MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
+                 arg_type type, int flags, size_t width, int has_precision,
+                 size_t precision, int pad_ourselves)
+{
+  size_t tmp_length;
+
+  switch (conversion)
+    {
+    case 'd': case 'i': case 'u':
+      switch (type)
+        {
+        default:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_LONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (long int) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_ULONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned long int) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_LONGLONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (long long int) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_ULONGLONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_INT8_T:
+          tmp_length =
+            (unsigned int) (sizeof (int8_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT8_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint8_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_INT16_T:
+          tmp_length =
+            (unsigned int) (sizeof (int16_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT16_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint16_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_INT32_T:
+          tmp_length =
+            (unsigned int) (sizeof (int32_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT32_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint32_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_INT64_T:
+          tmp_length =
+            (unsigned int) (sizeof (int64_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT64_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint64_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_INT_FAST8_T:
+          tmp_length =
+            (unsigned int) (sizeof (int_fast8_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST8_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_INT_FAST16_T:
+          tmp_length =
+            (unsigned int) (sizeof (int_fast16_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST16_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_INT_FAST32_T:
+          tmp_length =
+            (unsigned int) (sizeof (int_fast32_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST32_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_INT_FAST64_T:
+          tmp_length =
+            (unsigned int) (sizeof (int_fast64_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST64_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT
+                            * 0.30103 /* binary -> decimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        }
+      if (tmp_length < precision)
+        tmp_length = precision;
+      /* Multiply by 2, as an estimate for FLAG_GROUP.  */
+      tmp_length = xsum (tmp_length, tmp_length);
+      /* Add 1, to account for a leading sign.  */
+      tmp_length = xsum (tmp_length, 1);
+      break;
+
+    case 'b':
+    #if SUPPORT_GNU_PRINTF_DIRECTIVES \
+        || (__GLIBC__ + (__GLIBC_MINOR__ >= 35) > 2)
+    case 'B':
+    #endif
+      switch (type)
+        {
+        default:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned int) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_ULONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned long int) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_ULONGLONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT8_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint8_t) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT16_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint16_t) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT32_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint32_t) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT64_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint64_t) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST8_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST16_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST32_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST64_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT)
+            + 1; /* turn floor into ceil */
+          break;
+        }
+      if (tmp_length < precision)
+        tmp_length = precision;
+      /* Add 2, to account for a prefix from the alternate form.  */
+      tmp_length = xsum (tmp_length, 2);
+      break;
+
+    case 'o':
+      switch (type)
+        {
+        default:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_ULONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned long int) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_ULONGLONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT8_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint8_t) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT16_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint16_t) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT32_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint32_t) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT64_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint64_t) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST8_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST16_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST32_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST64_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT
+                            * 0.333334 /* binary -> octal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        }
+      if (tmp_length < precision)
+        tmp_length = precision;
+      /* Add 1, to account for a leading sign.  */
+      tmp_length = xsum (tmp_length, 1);
+      break;
+
+    case 'x': case 'X':
+      switch (type)
+        {
+        default:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_ULONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned long int) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_ULONGLONGINT:
+          tmp_length =
+            (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT8_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint8_t) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT16_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint16_t) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT32_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint32_t) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT64_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint64_t) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST8_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST16_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST32_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        case TYPE_UINT_FAST64_T:
+          tmp_length =
+            (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT
+                            * 0.25 /* binary -> hexadecimal */
+                           )
+            + 1; /* turn floor into ceil */
+          break;
+        }
+      if (tmp_length < precision)
+        tmp_length = precision;
+      /* Add 2, to account for a prefix from the alternate form.  */
+      tmp_length = xsum (tmp_length, 2);
+      break;
+
+    case 'f': case 'F':
+      if (type == TYPE_LONGDOUBLE)
+        tmp_length =
+          (unsigned int) (LDBL_MAX_EXP
+                          * 0.30103 /* binary -> decimal */
+                          * 2 /* estimate for FLAG_GROUP */
+                         )
+          + 1 /* turn floor into ceil */
+          + 10; /* sign, decimal point etc. */
+      else
+        tmp_length =
+          (unsigned int) (DBL_MAX_EXP
+                          * 0.30103 /* binary -> decimal */
+                          * 2 /* estimate for FLAG_GROUP */
+                         )
+          + 1 /* turn floor into ceil */
+          + 10; /* sign, decimal point etc. */
+      tmp_length = xsum (tmp_length, precision);
+      break;
+
+    case 'e': case 'E': case 'g': case 'G':
+      tmp_length =
+        12; /* sign, decimal point, exponent etc. */
+      tmp_length = xsum (tmp_length, precision);
+      break;
+
+    case 'a': case 'A':
+      if (type == TYPE_LONGDOUBLE)
+        tmp_length =
+          (unsigned int) (LDBL_DIG
+                          * 0.831 /* decimal -> hexadecimal */
+                         )
+          + 1; /* turn floor into ceil */
+      else
+        tmp_length =
+          (unsigned int) (DBL_DIG
+                          * 0.831 /* decimal -> hexadecimal */
+                         )
+          + 1; /* turn floor into ceil */
+      if (tmp_length < precision)
+        tmp_length = precision;
+      /* Account for sign, decimal point etc. */
+      tmp_length = xsum (tmp_length, 12);
+      break;
+
+    case 'c':
+# if HAVE_WINT_T && !WIDE_CHAR_VERSION
+      if (type == TYPE_WIDE_CHAR)
+        {
+          tmp_length = MB_CUR_MAX;
+#  if ENABLE_WCHAR_FALLBACK
+          if (tmp_length < (sizeof (wchar_t) > 2 ? 10 : 6))
+            tmp_length = (sizeof (wchar_t) > 2 ? 10 : 6);
+#  endif
+        }
+      else
+# endif
+        tmp_length = 1;
+      break;
+
+    case 's':
+# if HAVE_WCHAR_T
+      if (type == TYPE_WIDE_STRING)
+        {
+#  if WIDE_CHAR_VERSION
+          /* ISO C says about %ls in fwprintf:
+               "If the precision is not specified or is greater than the size
+                of the array, the array shall contain a null wide character."
+             So if there is a precision, we must not use wcslen.  */
+          const wchar_t *arg = ap->arg[arg_index].a.a_wide_string;
+
+          if (has_precision)
+            tmp_length = local_wcsnlen (arg, precision);
+          else
+            tmp_length = local_wcslen (arg);
+#  else
+          /* ISO C says about %ls in fprintf:
+               "If a precision is specified, no more than that many bytes are
+                written (including shift sequences, if any), and the array
+                shall contain a null wide character if, to equal the multibyte
+                character sequence length given by the precision, the function
+                would need to access a wide character one past the end of the
+                array."
+             So if there is a precision, we must not use wcslen.  */
+          /* This case has already been handled separately in VASNPRINTF.  */
+          abort ();
+#  endif
+        }
+      else
+# endif
+        {
+# if WIDE_CHAR_VERSION
+          /* ISO C says about %s in fwprintf:
+               "If the precision is not specified or is greater than the size
+                of the converted array, the converted array shall contain a
+                null wide character."
+             So if there is a precision, we must not use strlen.  */
+          /* This case has already been handled separately in VASNPRINTF.  */
+          abort ();
+# else
+          /* ISO C says about %s in fprintf:
+               "If the precision is not specified or greater than the size of
+                the array, the array shall contain a null character."
+             So if there is a precision, we must not use strlen.  */
+          const char *arg = ap->arg[arg_index].a.a_string;
+
+          if (has_precision)
+            tmp_length = local_strnlen (arg, precision);
+          else
+            tmp_length = strlen (arg);
+# endif
+        }
+      break;
+
+    case 'p':
+      tmp_length =
+        (unsigned int) (sizeof (void *) * CHAR_BIT
+                        * 0.25 /* binary -> hexadecimal */
+                       )
+          + 1 /* turn floor into ceil */
+          + 2; /* account for leading 0x */
+      break;
+
+    default:
+      abort ();
+    }
+
+  if (!pad_ourselves)
+    {
+# if ENABLE_UNISTDIO
+      /* Padding considers the number of characters, therefore the number of
+         elements after padding may be
+           > max (tmp_length, width)
+         but is certainly
+           <= tmp_length + width.  */
+      tmp_length = xsum (tmp_length, width);
+# else
+      /* Padding considers the number of elements, says POSIX.  */
+      if (tmp_length < width)
+        tmp_length = width;
+# endif
+    }
+
+  tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
+
+  return tmp_length;
+}
+
+#endif
+
+DCHAR_T *
+VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
+            const FCHAR_T *format, va_list args)
+{
+  DIRECTIVES d;
+  arguments a;
+
+  if (PRINTF_PARSE (format, &d, &a) < 0)
+    /* errno is already set.  */
+    return NULL;
+
+  /* Frees the memory allocated by this function.  Preserves errno.  */
+#define CLEANUP() \
+  if (d.dir != d.direct_alloc_dir)                                      \
+    free (d.dir);                                                       \
+  if (a.arg != a.direct_alloc_arg)                                      \
+    free (a.arg);
+
+  if (PRINTF_FETCHARGS (args, &a) < 0)
+    goto fail_1_with_EINVAL;
+
+  {
+    size_t buf_neededlength;
+    TCHAR_T *buf;
+    TCHAR_T *buf_malloced;
+    const FCHAR_T *cp;
+    size_t i;
+    DIRECTIVE *dp;
+    /* Output string accumulator.  */
+    DCHAR_T *result;
+    size_t allocated;
+    size_t length;
+
+    /* Allocate a small buffer that will hold a directive passed to
+       sprintf or snprintf.  */
+    buf_neededlength =
+      xsum4 (7, d.max_width_length, d.max_precision_length, 6);
+#if HAVE_ALLOCA
+    if (buf_neededlength < 4000 / sizeof (TCHAR_T))
+      {
+        buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
+        buf_malloced = NULL;
+      }
+    else
+#endif
+      {
+        size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
+        if (size_overflow_p (buf_memsize))
+          goto out_of_memory_1;
+        buf = (TCHAR_T *) malloc (buf_memsize);
+        if (buf == NULL)
+          goto out_of_memory_1;
+        buf_malloced = buf;
+      }
+
+    result = resultbuf;
+    allocated = (resultbuf != NULL ? *lengthp : 0);
+    length = 0;
+    /* Invariants:
+       result is either == resultbuf or malloc-allocated.
+       If result == NULL, resultbuf is == NULL as well.
+       If length > 0, then result != NULL.  */
+
+    /* Ensures that allocated >= needed.  Aborts through a jump to
+       out_of_memory if needed is SIZE_MAX or otherwise too big.  */
+#define ENSURE_ALLOCATION_ELSE(needed, oom_statement) \
+    if ((needed) > allocated)                                                \
+      {                                                                      \
+        size_t memory_size;                                                  \
+        DCHAR_T *memory;                                                     \
+                                                                             \
+        allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
+        if ((needed) > allocated)                                            \
+          allocated = (needed);                                              \
+        memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
+        if (size_overflow_p (memory_size))                                   \
+          oom_statement                                                      \
+        if (result == resultbuf)                                             \
+          memory = (DCHAR_T *) malloc (memory_size);                         \
+        else                                                                 \
+          memory = (DCHAR_T *) realloc (result, memory_size);                \
+        if (memory == NULL)                                                  \
+          oom_statement                                                      \
+        if (result == resultbuf && length > 0)                               \
+          DCHAR_CPY (memory, result, length);                                \
+        result = memory;                                                     \
+      }
+#define ENSURE_ALLOCATION(needed) \
+  ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; )
+
+    for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
+      {
+        if (cp != dp->dir_start)
+          {
+            size_t n = dp->dir_start - cp;
+            size_t augmented_length = xsum (length, n);
+
+            ENSURE_ALLOCATION (augmented_length);
+            /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
+               need that the format string contains only ASCII characters
+               if FCHAR_T and DCHAR_T are not the same type.  */
+            if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
+              {
+                DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
+                length = augmented_length;
+              }
+            else
+              {
+                do
+                  result[length++] = *cp++;
+                while (--n > 0);
+              }
+          }
+        if (i == d.count)
+          break;
+
+        /* Execute a single directive.  */
+        if (dp->conversion == '%')
+          {
+            size_t augmented_length;
+
+            if (!(dp->arg_index == ARG_NONE))
+              abort ();
+            augmented_length = xsum (length, 1);
+            ENSURE_ALLOCATION (augmented_length);
+            result[length] = '%';
+            length = augmented_length;
+          }
+        else
+          {
+            if (!(dp->arg_index != ARG_NONE))
+              abort ();
+
+            if (dp->conversion == 'n')
+              {
+                switch (a.arg[dp->arg_index].type)
+                  {
+                  case TYPE_COUNT_SCHAR_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
+                    break;
+                  case TYPE_COUNT_SHORT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_short_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int_pointer = length;
+                    break;
+                  case TYPE_COUNT_LONGINT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
+                    break;
+                  case TYPE_COUNT_LONGLONGINT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT8_T_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int8_t_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT16_T_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int16_t_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT32_T_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int32_t_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT64_T_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int64_t_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT_FAST8_T_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int_fast8_t_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT_FAST16_T_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int_fast16_t_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT_FAST32_T_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int_fast32_t_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT_FAST64_T_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int_fast64_t_pointer = length;
+                    break;
+                  default:
+                    abort ();
+                  }
+              }
+#if ENABLE_UNISTDIO
+            /* The unistdio extensions.  */
+            else if (dp->conversion == 'U')
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        width = arg;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = -width;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                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;
+                      }
+                  }
+
+                switch (type)
+                  {
+                  case TYPE_U8_STRING:
+                    {
+                      const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
+                      const uint8_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u8_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                goto fail_with_EILSEQ;
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u8_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                goto fail_with_EILSEQ;
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u8_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (characters < width && !(flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+
+# if DCHAR_IS_UINT8_T
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
+# else
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
+#  if DCHAR_IS_TCHAR
+                        /* Convert from UTF-8 to locale encoding.  */
+                        converted =
+                          u8_conv_to_encoding (locale_charset (),
+                                               iconveh_question_mark,
+                                               arg, arg_end - arg, NULL,
+                                               converted, &converted_len);
+#  else
+                        /* Convert from UTF-8 to UTF-16/UTF-32.  */
+                        converted =
+                          U8_TO_DCHAR (arg, arg_end - arg,
+                                       converted, &converted_len);
+#  endif
+                        if (converted == NULL)
+                          goto fail_with_errno;
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
+                                                    { free (converted); goto out_of_memory; });
+                            DCHAR_CPY (result + length, converted, converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
+# endif
+
+                      if (characters < width && (flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  case TYPE_U16_STRING:
+                    {
+                      const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
+                      const uint16_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u16_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                goto fail_with_EILSEQ;
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u16_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                goto fail_with_EILSEQ;
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u16_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (characters < width && !(flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+
+# if DCHAR_IS_UINT16_T
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
+# else
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
+#  if DCHAR_IS_TCHAR
+                        /* Convert from UTF-16 to locale encoding.  */
+                        converted =
+                          u16_conv_to_encoding (locale_charset (),
+                                                iconveh_question_mark,
+                                                arg, arg_end - arg, NULL,
+                                                converted, &converted_len);
+#  else
+                        /* Convert from UTF-16 to UTF-8/UTF-32.  */
+                        converted =
+                          U16_TO_DCHAR (arg, arg_end - arg,
+                                        converted, &converted_len);
+#  endif
+                        if (converted == NULL)
+                          goto fail_with_errno;
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
+                                                    { free (converted); goto out_of_memory; });
+                            DCHAR_CPY (result + length, converted, converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
+# endif
+
+                      if (characters < width && (flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  case TYPE_U32_STRING:
+                    {
+                      const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
+                      const uint32_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u32_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                goto fail_with_EILSEQ;
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u32_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                goto fail_with_EILSEQ;
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u32_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (characters < width && !(flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+
+# if DCHAR_IS_UINT32_T
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
+# else
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
+#  if DCHAR_IS_TCHAR
+                        /* Convert from UTF-32 to locale encoding.  */
+                        converted =
+                          u32_conv_to_encoding (locale_charset (),
+                                                iconveh_question_mark,
+                                                arg, arg_end - arg, NULL,
+                                                converted, &converted_len);
+#  else
+                        /* Convert from UTF-32 to UTF-8/UTF-16.  */
+                        converted =
+                          U32_TO_DCHAR (arg, arg_end - arg,
+                                        converted, &converted_len);
+#  endif
+                        if (converted == NULL)
+                          goto fail_with_errno;
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
+                                                    { free (converted); goto out_of_memory; });
+                            DCHAR_CPY (result + length, converted, converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
+# endif
+
+                      if (characters < width && (flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  default:
+                    abort ();
+                  }
+              }
+#endif
+#if WIDE_CHAR_VERSION && (!DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC)
+            else if ((dp->conversion == 's'
+                      && a.arg[dp->arg_index].type == TYPE_WIDE_STRING)
+                     || (dp->conversion == 'c'
+                         && a.arg[dp->arg_index].type == TYPE_WIDE_CHAR))
+              {
+                /* %ls or %lc in vasnwprintf.  See the specification of
+                   fwprintf.  */
+                /* It would be silly to use snprintf ("%ls", ...) and then
+                   convert back the result from a char[] to a wchar_t[].
+                   Instead, just copy the argument wchar_t[] to the result.  */
+                int flags = dp->flags;
+                size_t width;
+
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        width = arg;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = -width;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                  }
+
+                {
+                  const wchar_t *ls_arg;
+                  wchar_t lc_arg[1];
+                  size_t characters;
+
+                  if (dp->conversion == 's')
+                    {
+                      int has_precision;
+                      size_t 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;
+                            }
+                        }
+
+                      ls_arg = a.arg[dp->arg_index].a.a_wide_string;
+
+                      if (has_precision)
+                        {
+                          /* Use only at most PRECISION wide characters, from
+                             the left.  */
+                          const wchar_t *ls_arg_end;
+
+                          ls_arg_end = ls_arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              if (*ls_arg_end == 0)
+                                /* Found the terminating null wide character.  */
+                                break;
+                              ls_arg_end++;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string, and count the number of wide
+                             characters.  */
+                          characters = local_wcslen (ls_arg);
+                        }
+                    }
+                  else /* dp->conversion == 'c' */
+                    {
+                      lc_arg[0] = (wchar_t) a.arg[dp->arg_index].a.a_wide_char;
+                      ls_arg = lc_arg;
+                      characters = 1;
+                    }
+
+                  {
+                    size_t total = (characters < width ? width : characters);
+                    ENSURE_ALLOCATION (xsum (length, total));
+
+                    if (characters < width && !(flags & FLAG_LEFT))
+                      {
+                        size_t n = width - characters;
+                        DCHAR_SET (result + length, ' ', n);
+                        length += n;
+                      }
+
+                    if (characters > 0)
+                      {
+                        DCHAR_CPY (result + length, ls_arg, characters);
+                        length += characters;
+                      }
+
+                    if (characters < width && (flags & FLAG_LEFT))
+                      {
+                        size_t n = width - characters;
+                        DCHAR_SET (result + length, ' ', n);
+                        length += n;
+                      }
+                  }
+                }
+              }
+#endif
+#if (!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T
+            else if (dp->conversion == 's'
+# if WIDE_CHAR_VERSION
+                     && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
+# else
+                     && a.arg[dp->arg_index].type == TYPE_WIDE_STRING
+# endif
+                    )
+              {
+                /* The normal handling of the 's' directive below requires
+                   allocating a temporary buffer.  The determination of its
+                   length (tmp_length), in the case when a precision is
+                   specified, below requires a conversion between a char[]
+                   string and a wchar_t[] wide string.  It could be done, but
+                   we have no guarantee that the implementation of sprintf will
+                   use the exactly same algorithm.  Without this guarantee, it
+                   is possible to have buffer overrun bugs.  In order to avoid
+                   such bugs, we implement the entire processing of the 's'
+                   directive ourselves.  */
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        width = arg;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = -width;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                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;
+                      }
+                  }
+
+# if WIDE_CHAR_VERSION
+                /* %s in vasnwprintf.  See the specification of fwprintf.  */
+                {
+                  const char *arg = a.arg[dp->arg_index].a.a_string;
+                  const char *arg_end;
+                  size_t characters;
+
+                  if (has_precision)
+                    {
+                      /* Use only as many bytes as needed to produce PRECISION
+                         wide characters, from the left.  */
+#  if HAVE_MBRTOWC
+                      mbstate_t state;
+                      mbszero (&state);
+#  endif
+                      arg_end = arg;
+                      characters = 0;
+                      for (; precision > 0; precision--)
+                        {
+                          int count;
+#  if HAVE_MBRTOWC
+                          count = mbrlen (arg_end, MB_CUR_MAX, &state);
+#  else
+                          count = mblen (arg_end, MB_CUR_MAX);
+#  endif
+                          if (count == 0)
+                            /* Found the terminating NUL.  */
+                            break;
+                          if (count < 0)
+                            /* Invalid or incomplete multibyte character.  */
+                            goto fail_with_EILSEQ;
+                          arg_end += count;
+                          characters++;
+                        }
+                    }
+                  else if (has_width)
+                    {
+                      /* Use the entire string, and count the number of wide
+                         characters.  */
+#  if HAVE_MBRTOWC
+                      mbstate_t state;
+                      mbszero (&state);
+#  endif
+                      arg_end = arg;
+                      characters = 0;
+                      for (;;)
+                        {
+                          int count;
+#  if HAVE_MBRTOWC
+                          count = mbrlen (arg_end, MB_CUR_MAX, &state);
+#  else
+                          count = mblen (arg_end, MB_CUR_MAX);
+#  endif
+                          if (count == 0)
+                            /* Found the terminating NUL.  */
+                            break;
+                          if (count < 0)
+                            /* Invalid or incomplete multibyte character.  */
+                            goto fail_with_EILSEQ;
+                          arg_end += count;
+                          characters++;
+                        }
+                    }
+                  else
+                    {
+                      /* Use the entire string.  */
+                      arg_end = arg + strlen (arg);
+                      /* The number of characters doesn't matter.  */
+                      characters = 0;
+                    }
+
+                  if (characters < width && !(flags & FLAG_LEFT))
+                    {
+                      size_t n = width - characters;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+
+                  if (has_precision || has_width)
+                    {
+                      /* We know the number of wide characters in advance.  */
+                      size_t remaining;
+#  if HAVE_MBRTOWC
+                      mbstate_t state;
+                      mbszero (&state);
+#  endif
+                      ENSURE_ALLOCATION (xsum (length, characters));
+                      for (remaining = characters; remaining > 0; remaining--)
+                        {
+                          wchar_t wc;
+                          int count;
+#  if HAVE_MBRTOWC
+                          count = mbrtowc (&wc, arg, arg_end - arg, &state);
+#  else
+                          count = mbtowc (&wc, arg, arg_end - arg);
+#  endif
+                          if (count <= 0)
+                            /* mbrtowc not consistent with mbrlen, or mbtowc
+                               not consistent with mblen.  */
+                            abort ();
+                          result[length++] = wc;
+                          arg += count;
+                        }
+                      if (!(arg == arg_end))
+                        abort ();
+                    }
+                  else
+                    {
+#  if HAVE_MBRTOWC
+                      mbstate_t state;
+                      mbszero (&state);
+#  endif
+                      while (arg < arg_end)
+                        {
+                          wchar_t wc;
+                          int count;
+#  if HAVE_MBRTOWC
+                          count = mbrtowc (&wc, arg, arg_end - arg, &state);
+#  else
+                          count = mbtowc (&wc, arg, arg_end - arg);
+#  endif
+                          if (count == 0)
+                            /* mbrtowc not consistent with strlen.  */
+                            abort ();
+                          if (count < 0)
+                            /* Invalid or incomplete multibyte character.  */
+                            goto fail_with_EILSEQ;
+                          ENSURE_ALLOCATION (xsum (length, 1));
+                          result[length++] = wc;
+                          arg += count;
+                        }
+                    }
+
+                  if (characters < width && (flags & FLAG_LEFT))
+                    {
+                      size_t n = width - characters;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
+# else
+                /* %ls in vasnprintf.  See the specification of fprintf.  */
+                {
+                  const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
+                  const wchar_t *arg_end;
+                  size_t characters;
+#  if !DCHAR_IS_TCHAR
+                  /* This code assumes that TCHAR_T is 'char'.  */
+                  static_assert (sizeof (TCHAR_T) == 1);
+                  TCHAR_T *tmpsrc;
+                  DCHAR_T *tmpdst;
+                  size_t tmpdst_len;
+#  endif
+                  size_t w;
+
+                  if (has_precision)
+                    {
+                      /* Use only as many wide characters as needed to produce
+                         at most PRECISION bytes, from the left.  */
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      mbszero (&state);
+#  endif
+                      arg_end = arg;
+                      characters = 0;
+                      while (precision > 0)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg_end == 0)
+                            /* Found the terminating null wide character.  */
+                            break;
+                          count = local_wcrtomb (cbuf, *arg_end, &state);
+                          if (count < 0)
+                            /* Cannot convert.  */
+                            goto fail_with_EILSEQ;
+                          if (precision < (unsigned int) count)
+                            break;
+                          arg_end++;
+                          characters += count;
+                          precision -= count;
+                        }
+                    }
+#  if DCHAR_IS_TCHAR
+                  else if (has_width)
+#  else
+                  else
+#  endif
+                    {
+                      /* Use the entire string, and count the number of
+                         bytes.  */
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      mbszero (&state);
+#  endif
+                      arg_end = arg;
+                      characters = 0;
+                      for (;;)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg_end == 0)
+                            /* Found the terminating null wide character.  */
+                            break;
+                          count = local_wcrtomb (cbuf, *arg_end, &state);
+                          if (count < 0)
+                            /* Cannot convert.  */
+                            goto fail_with_EILSEQ;
+                          arg_end++;
+                          characters += count;
+                        }
+                    }
+#  if DCHAR_IS_TCHAR
+                  else
+                    {
+                      /* Use the entire string.  */
+                      arg_end = arg + local_wcslen (arg);
+                      /* The number of bytes doesn't matter.  */
+                      characters = 0;
+                    }
+#  endif
+
+#  if !DCHAR_IS_TCHAR
+                  /* Convert the string into a piece of temporary memory.  */
+                  tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
+                  if (tmpsrc == NULL)
+                    goto out_of_memory;
+                  {
+                    TCHAR_T *tmpptr = tmpsrc;
+                    size_t remaining;
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                    mbstate_t state;
+                    mbszero (&state);
+#   endif
+                    for (remaining = characters; remaining > 0; )
+                      {
+                        char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                        int count;
+
+                        if (*arg == 0)
+                          abort ();
+                        count = local_wcrtomb (cbuf, *arg, &state);
+                        if (count <= 0)
+                          /* Inconsistency.  */
+                          abort ();
+                        memcpy (tmpptr, cbuf, count);
+                        tmpptr += count;
+                        arg++;
+                        remaining -= count;
+                      }
+                    if (!(arg == arg_end))
+                      abort ();
+                  }
+
+                  /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                  tmpdst =
+                    DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                              iconveh_question_mark,
+                                              tmpsrc, characters,
+                                              NULL,
+                                              NULL, &tmpdst_len);
+                  if (tmpdst == NULL)
+                    {
+                      free (tmpsrc);
+                      goto fail_with_errno;
+                    }
+                  free (tmpsrc);
+#  endif
+
+                  if (has_width)
+                    {
+#  if ENABLE_UNISTDIO
+                      /* Outside POSIX, it's preferable to compare the width
+                         against the number of _characters_ of the converted
+                         value.  */
+                      w = DCHAR_MBSNLEN (result + length, characters);
+#  else
+                      /* The width is compared against the number of _bytes_
+                         of the converted value, says POSIX.  */
+                      w = characters;
+#  endif
+                    }
+                  else
+                    /* w doesn't matter.  */
+                    w = 0;
+
+                  if (w < width && !(flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+
+#  if DCHAR_IS_TCHAR
+                  if (has_precision || has_width)
+                    {
+                      /* We know the number of bytes in advance.  */
+                      size_t remaining;
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      mbszero (&state);
+#   endif
+                      ENSURE_ALLOCATION (xsum (length, characters));
+                      for (remaining = characters; remaining > 0; )
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg == 0)
+                            abort ();
+                          count = local_wcrtomb (cbuf, *arg, &state);
+                          if (count <= 0)
+                            /* Inconsistency.  */
+                            abort ();
+                          memcpy (result + length, cbuf, count);
+                          length += count;
+                          arg++;
+                          remaining -= count;
+                        }
+                      if (!(arg == arg_end))
+                        abort ();
+                    }
+                  else
+                    {
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      mbszero (&state);
+#   endif
+                      while (arg < arg_end)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg == 0)
+                            abort ();
+                          count = local_wcrtomb (cbuf, *arg, &state);
+                          if (count <= 0)
+                            /* Cannot convert.  */
+                            goto fail_with_EILSEQ;
+                          ENSURE_ALLOCATION (xsum (length, count));
+                          memcpy (result + length, cbuf, count);
+                          length += count;
+                          arg++;
+                        }
+                    }
+#  else
+                  ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
+                                          { free (tmpdst); goto out_of_memory; });
+                  DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                  free (tmpdst);
+                  length += tmpdst_len;
+#  endif
+
+                  if (w < width && (flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
+# endif
+              }
+#endif
+#if (NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T && !WIDE_CHAR_VERSION
+            else if (dp->conversion == 'c'
+                     && a.arg[dp->arg_index].type == TYPE_WIDE_CHAR)
+              {
+                /* Implement the 'lc' directive ourselves, in order to provide
+                   a correct behaviour for the null wint_t argument and/or the
+                   fallback that avoids EILSEQ.  */
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        width = arg;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = -width;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                /* %lc in vasnprintf.  See the specification of fprintf.  */
+                {
+                  wchar_t arg = (wchar_t) a.arg[dp->arg_index].a.a_wide_char;
+                  size_t characters;
+# if !DCHAR_IS_TCHAR
+                  /* This code assumes that TCHAR_T is 'char'.  */
+                  static_assert (sizeof (TCHAR_T) == 1);
+                  TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64.  */
+                  DCHAR_T *tmpdst;
+                  size_t tmpdst_len;
+# endif
+                  size_t w;
+
+# if DCHAR_IS_TCHAR
+                  if (has_width)
+# endif
+                    {
+                      /* Count the number of bytes.  */
+                      characters = 0;
+                      char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                      int count;
+# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      mbszero (&state);
+# endif
+
+                      count = local_wcrtomb (cbuf, arg, &state);
+                      if (count < 0)
+                        /* Cannot convert.  */
+                        goto fail_with_EILSEQ;
+                      characters = count;
+                    }
+# if DCHAR_IS_TCHAR
+                  else
+                    {
+                      /* The number of bytes doesn't matter.  */
+                      characters = 0;
+                    }
+# endif
+
+# if !DCHAR_IS_TCHAR
+                  /* Convert the string into a piece of temporary memory.  */
+                  if (characters > 0)
+                    {
+                      char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                      int count;
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      mbszero (&state);
+#  endif
+
+                      count = local_wcrtomb (cbuf, arg, &state);
+                      if (count <= 0)
+                        /* Inconsistency.  */
+                        abort ();
+                      memcpy (tmpsrc, cbuf, count);
+                    }
+
+                  /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                  tmpdst =
+                    DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                              iconveh_question_mark,
+                                              tmpsrc, characters,
+                                              NULL,
+                                              NULL, &tmpdst_len);
+                  if (tmpdst == NULL)
+                    goto fail_with_errno;
+# endif
+
+                  if (has_width)
+                    {
+# if ENABLE_UNISTDIO
+                      /* Outside POSIX, it's preferable to compare the width
+                         against the number of _characters_ of the converted
+                         value.  */
+                      w = DCHAR_MBSNLEN (result + length, characters);
+# else
+                      /* The width is compared against the number of _bytes_
+                         of the converted value, says POSIX.  */
+                      w = characters;
+# endif
+                    }
+                  else
+                    /* w doesn't matter.  */
+                    w = 0;
+
+                  if (w < width && !(flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+
+# if DCHAR_IS_TCHAR
+                  if (has_width)
+                    {
+                      /* We know the number of bytes in advance.  */
+                      ENSURE_ALLOCATION (xsum (length, characters));
+                      if (characters > 0)
+                        {
+                          int count;
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          mbstate_t state;
+                          mbszero (&state);
+#  endif
+
+                          count = local_wcrtomb (result + length, arg, &state);
+                          if (count <= 0)
+                            /* Inconsistency.  */
+                            abort ();
+                          length += count;
+                        }
+                    }
+                  else
+                    {
+                      char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                      int count;
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      mbszero (&state);
+#  endif
+
+                      count = local_wcrtomb (cbuf, arg, &state);
+                      if (count < 0)
+                        /* Cannot convert.  */
+                        goto fail_with_EILSEQ;
+                      ENSURE_ALLOCATION (xsum (length, count));
+                      memcpy (result + length, cbuf, count);
+                      length += count;
+                    }
+# else
+                  ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
+                                          { free (tmpdst); goto out_of_memory; });
+                  DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                  free (tmpdst);
+                  length += tmpdst_len;
+# endif
+
+                  if (w < width && (flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
+              }
+#endif
+#if NEED_WPRINTF_DIRECTIVE_C && WIDE_CHAR_VERSION
+            else if (dp->conversion == 'c'
+                     && a.arg[dp->arg_index].type != TYPE_WIDE_CHAR)
+              {
+                /* Implement the 'c' directive ourselves, in order to avoid
+                   EILSEQ in the "C" locale.  */
+                int flags = dp->flags;
+                size_t width;
+
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        width = arg;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = -width;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                  }
+
+                /* %c in vasnwprintf.  See the specification of fwprintf.  */
+                {
+                  char arg = (char) a.arg[dp->arg_index].a.a_char;
+                  mbstate_t state;
+                  wchar_t wc;
+
+                  mbszero (&state);
+                  int count = mbrtowc (&wc, &arg, 1, &state);
+                  if (count < 0)
+                    /* Invalid or incomplete multibyte character.  */
+                    goto fail_with_EILSEQ;
+
+                  if (1 < width && !(flags & FLAG_LEFT))
+                    {
+                      size_t n = width - 1;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+
+                  ENSURE_ALLOCATION (xsum (length, 1));
+                  result[length++] = wc;
+
+                  if (1 < width && (flags & FLAG_LEFT))
+                    {
+                      size_t n = width - 1;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
+              }
+#endif
+#if NEED_PRINTF_DIRECTIVE_B || NEED_PRINTF_DIRECTIVE_UPPERCASE_B
+            else if (0
+# if NEED_PRINTF_DIRECTIVE_B
+                     || (dp->conversion == 'b')
+# endif
+# if NEED_PRINTF_DIRECTIVE_UPPERCASE_B
+                     || (dp->conversion == 'B')
+# endif
+                    )
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+                size_t tmp_length;
+                size_t count;
+                DCHAR_T tmpbuf[700];
+                DCHAR_T *tmp;
+                DCHAR_T *tmp_end;
+                DCHAR_T *tmp_start;
+                DCHAR_T *pad_ptr;
+                DCHAR_T *p;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        width = arg;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = -width;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 1;
+                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;
+                      }
+                  }
+
+                /* Allocate a temporary buffer of sufficient size.  */
+                switch (type)
+                  {
+                  default:
+                    tmp_length =
+                      (unsigned int) (sizeof (unsigned int) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_ULONGINT:
+                    tmp_length =
+                      (unsigned int) (sizeof (unsigned long int) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_ULONGLONGINT:
+                    tmp_length =
+                      (unsigned int) (sizeof (unsigned long long int) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_UINT8_T:
+                    tmp_length =
+                      (unsigned int) (sizeof (uint8_t) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_UINT16_T:
+                    tmp_length =
+                      (unsigned int) (sizeof (uint16_t) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_UINT32_T:
+                    tmp_length =
+                      (unsigned int) (sizeof (uint32_t) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_UINT64_T:
+                    tmp_length =
+                      (unsigned int) (sizeof (uint64_t) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_UINT_FAST8_T:
+                    tmp_length =
+                      (unsigned int) (sizeof (uint_fast8_t) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_UINT_FAST16_T:
+                    tmp_length =
+                      (unsigned int) (sizeof (uint_fast16_t) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_UINT_FAST32_T:
+                    tmp_length =
+                      (unsigned int) (sizeof (uint_fast32_t) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  case TYPE_UINT_FAST64_T:
+                    tmp_length =
+                      (unsigned int) (sizeof (uint_fast64_t) * CHAR_BIT)
+                      + 1; /* turn floor into ceil */
+                    break;
+                  }
+                if (tmp_length < precision)
+                  tmp_length = precision;
+                /* Add 2, to account for a prefix from the alternate form.  */
+                tmp_length = xsum (tmp_length, 2);
+
+                if (tmp_length < width)
+                  tmp_length = width;
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (DCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
+
+                tmp_end = tmp + tmp_length;
+
+                unsigned long long arg;
+                switch (type)
+                  {
+                  case TYPE_UCHAR:
+                    arg = a.arg[dp->arg_index].a.a_uchar;
+                    break;
+                  case TYPE_USHORT:
+                    arg = a.arg[dp->arg_index].a.a_ushort;
+                    break;
+                  case TYPE_UINT:
+                    arg = a.arg[dp->arg_index].a.a_uint;
+                    break;
+                  case TYPE_ULONGINT:
+                    arg = a.arg[dp->arg_index].a.a_ulongint;
+                    break;
+                  case TYPE_ULONGLONGINT:
+                    arg = a.arg[dp->arg_index].a.a_ulonglongint;
+                    break;
+                  case TYPE_UINT8_T:
+                    arg = a.arg[dp->arg_index].a.a_uint8_t;
+                    break;
+                  case TYPE_UINT16_T:
+                    arg = a.arg[dp->arg_index].a.a_uint16_t;
+                    break;
+                  case TYPE_UINT32_T:
+                    arg = a.arg[dp->arg_index].a.a_uint32_t;
+                    break;
+                  case TYPE_UINT64_T:
+                    arg = a.arg[dp->arg_index].a.a_uint64_t;
+                    break;
+                  case TYPE_UINT_FAST8_T:
+                    arg = a.arg[dp->arg_index].a.a_uint_fast8_t;
+                    break;
+                  case TYPE_UINT_FAST16_T:
+                    arg = a.arg[dp->arg_index].a.a_uint_fast16_t;
+                    break;
+                  case TYPE_UINT_FAST32_T:
+                    arg = a.arg[dp->arg_index].a.a_uint_fast32_t;
+                    break;
+                  case TYPE_UINT_FAST64_T:
+                    arg = a.arg[dp->arg_index].a.a_uint_fast64_t;
+                    break;
+                  default:
+                    abort ();
+                  }
+                int need_prefix = ((flags & FLAG_ALT) && arg != 0);
+
+                p = tmp_end;
+                /* "The result of converting a zero value with a precision
+                   of zero is no characters."  */
+                if (!(has_precision && precision == 0 && arg == 0))
+                  {
+                    do
+                      {
+                        *--p = '0' + (arg & 1);
+                        arg = arg >> 1;
+                      }
+                    while (arg != 0);
+                  }
+
+                if (has_precision)
+                  {
+                    DCHAR_T *digits_start = tmp_end - precision;
+                    while (p > digits_start)
+                      *--p = '0';
+                  }
+
+                pad_ptr = p;
+
+                if (need_prefix)
+                  {
+# if NEED_PRINTF_DIRECTIVE_B && !NEED_PRINTF_DIRECTIVE_UPPERCASE_B
+                    *--p = 'b';
+# elif NEED_PRINTF_DIRECTIVE_UPPERCASE_B && !NEED_PRINTF_DIRECTIVE_B
+                    *--p = 'B';
+# else
+                    *--p = dp->conversion;
+# endif
+                    *--p = '0';
+                  }
+                tmp_start = p;
+
+                /* The generated string now extends from tmp_start to tmp_end,
+                   with the zero padding insertion point being at pad_ptr,
+                   tmp_start <= pad_ptr <= tmp_end.  */
+                count = tmp_end - tmp_start;
+
+                if (count < width)
+                  {
+                    size_t pad = width - count;
+
+                    if (flags & FLAG_LEFT)
+                      {
+                        /* Pad with spaces on the right.  */
+                        for (p = tmp_start; p < tmp_end; p++)
+                          *(p - pad) = *p;
+                        for (p = tmp_end - pad; p < tmp_end; p++)
+                          *p = ' ';
+                      }
+                    else if ((flags & FLAG_ZERO)
+                             /* Neither ISO C nor POSIX specify that the '0'
+                                flag is ignored when a width and a precision
+                                are both present.  But most implementations
+                                do so.  */
+                             && !(has_width && has_precision))
+                      {
+                        /* Pad with zeroes.  */
+                        for (p = tmp_start; p < pad_ptr; p++)
+                          *(p - pad) = *p;
+                        for (p = pad_ptr - pad; p < pad_ptr; p++)
+                          *p = '0';
+                      }
+                    else
+                      {
+                        /* Pad with spaces on the left.  */
+                        for (p = tmp_start - pad; p < tmp_start; p++)
+                          *p = ' ';
+                      }
+
+                    tmp_start = tmp_start - pad;
+                  }
+
+                count = tmp_end - tmp_start;
+
+                if (count > tmp_length)
+                  /* tmp_length was incorrectly calculated - fix the
+                     code above!  */
+                  abort ();
+
+                /* Make room for the result.  */
+                if (count >= allocated - length)
+                  {
+                    size_t n = xsum (length, count);
+
+                    ENSURE_ALLOCATION (n);
+                  }
+
+                /* Append the result.  */
+                memcpy (result + length, tmp_start, count * sizeof (DCHAR_T));
+                if (tmp != tmpbuf)
+                  free (tmp);
+                length += count;
+              }
+#endif
+#if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION)
+            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 || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION)
+                         || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+#  endif
+                        )
+# endif
+                    )
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+                size_t width;
+                int has_precision;
+                size_t precision;
+                size_t tmp_length;
+                size_t count;
+                DCHAR_T tmpbuf[700];
+                DCHAR_T *tmp;
+                DCHAR_T *pad_ptr;
+                DCHAR_T *p;
+
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        width = arg;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = -width;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                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;
+                      }
+                  }
+
+                /* Allocate a temporary buffer of sufficient size.  */
+                if (type == TYPE_LONGDOUBLE)
+                  tmp_length =
+                    (unsigned int) ((LDBL_DIG + 1)
+                                    * 0.831 /* decimal -> hexadecimal */
+                                   )
+                    + 1; /* turn floor into ceil */
+                else
+                  tmp_length =
+                    (unsigned int) ((DBL_DIG + 1)
+                                    * 0.831 /* decimal -> hexadecimal */
+                                   )
+                    + 1; /* turn floor into ceil */
+                if (tmp_length < precision)
+                  tmp_length = precision;
+                /* Account for sign, decimal point etc. */
+                tmp_length = xsum (tmp_length, 12);
+
+                if (tmp_length < width)
+                  tmp_length = width;
+
+                tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (DCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
+
+                pad_ptr = NULL;
+                p = tmp;
+                if (type == TYPE_LONGDOUBLE)
+                  {
+# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION)
+                    long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                    if (isnanl (arg))
+                      {
+                        if (dp->conversion == 'A')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+                        DECL_LONG_DOUBLE_ROUNDING
+
+                        BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                        if (signbit (arg)) /* arg < 0.0L or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0L && arg + arg == arg)
+                          {
+                            if (dp->conversion == 'A')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
+                            int exponent;
+                            long double mantissa;
+
+                            if (arg > 0.0L)
+                              mantissa = printf_frexpl (arg, &exponent);
+                            else
+                              {
+                                exponent = 0;
+                                mantissa = 0.0L;
+                              }
+
+                            if (has_precision
+                                && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1)
+                              {
+                                /* Round the mantissa.  */
+                                long double tail = mantissa;
+                                size_t q;
+
+                                for (q = precision; ; q--)
+                                  {
+                                    int digit = (int) tail;
+                                    tail -= digit;
+                                    if (q == 0)
+                                      {
+                                        if (digit & 1 ? tail >= 0.5L : tail > 0.5L)
+                                          tail = 1 - tail;
+                                        else
+                                          tail = - tail;
+                                        break;
+                                      }
+                                    tail *= 16.0L;
+                                  }
+                                if (tail != 0.0L)
+                                  for (q = precision; q > 0; q--)
+                                    tail *= 0.0625L;
+                                mantissa += tail;
+                              }
+
+                            *p++ = '0';
+                            *p++ = dp->conversion - 'A' + 'X';
+                            pad_ptr = p;
+                            {
+                              int digit;
+
+                              digit = (int) mantissa;
+                              mantissa -= digit;
+                              *p++ = '0' + digit;
+                              if ((flags & FLAG_ALT)
+                                  || mantissa > 0.0L || precision > 0)
+                                {
+                                  *p++ = decimal_point_char ();
+                                  /* This loop terminates because we assume
+                                     that FLT_RADIX is a power of 2.  */
+                                  while (mantissa > 0.0L)
+                                    {
+                                      mantissa *= 16.0L;
+                                      digit = (int) mantissa;
+                                      mantissa -= digit;
+                                      *p++ = digit
+                                             + (digit < 10
+                                                ? '0'
+                                                : dp->conversion - 10);
+                                      if (precision > 0)
+                                        precision--;
+                                    }
+                                  while (precision > 0)
+                                    {
+                                      *p++ = '0';
+                                      precision--;
+                                    }
+                                }
+                              }
+                              *p++ = dp->conversion - 'A' + 'P';
+#  if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR
+                              {
+                                static const wchar_t decimal_format[] =
+                                  { '%', '+', 'd', '\0' };
+                                SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                              }
+                              while (*p != '\0')
+                                p++;
+#  else
+                              if (sizeof (DCHAR_T) == 1)
+                                {
+                                  sprintf ((char *) p, "%+d", exponent);
+                                  while (*p != '\0')
+                                    p++;
+                                }
+                              else
+                                {
+                                  char expbuf[6 + 1];
+                                  const char *ep;
+                                  sprintf (expbuf, "%+d", exponent);
+                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                    p++;
+                                }
+#  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 (isnand (arg))
+                      {
+                        if (dp->conversion == 'A')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+
+                        if (signbit (arg)) /* arg < 0.0 or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0 && arg + arg == arg)
+                          {
+                            if (dp->conversion == 'A')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
+                            int exponent;
+                            double mantissa;
+
+                            if (arg > 0.0)
+                              mantissa = printf_frexp (arg, &exponent);
+                            else
+                              {
+                                exponent = 0;
+                                mantissa = 0.0;
+                              }
+
+                            if (has_precision
+                                && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1)
+                              {
+                                /* Round the mantissa.  */
+                                double tail = mantissa;
+                                size_t q;
+
+                                for (q = precision; ; q--)
+                                  {
+                                    int digit = (int) tail;
+                                    tail -= digit;
+                                    if (q == 0)
+                                      {
+                                        if (digit & 1 ? tail >= 0.5 : tail > 0.5)
+                                          tail = 1 - tail;
+                                        else
+                                          tail = - tail;
+                                        break;
+                                      }
+                                    tail *= 16.0;
+                                  }
+                                if (tail != 0.0)
+                                  for (q = precision; q > 0; q--)
+                                    tail *= 0.0625;
+                                mantissa += tail;
+                              }
+
+                            *p++ = '0';
+                            *p++ = dp->conversion - 'A' + 'X';
+                            pad_ptr = p;
+                            {
+                              int digit;
+
+                              digit = (int) mantissa;
+                              mantissa -= digit;
+                              *p++ = '0' + digit;
+                              if ((flags & FLAG_ALT)
+                                  || mantissa > 0.0 || precision > 0)
+                                {
+                                  *p++ = decimal_point_char ();
+                                  /* This loop terminates because we assume
+                                     that FLT_RADIX is a power of 2.  */
+                                  while (mantissa > 0.0)
+                                    {
+                                      mantissa *= 16.0;
+                                      digit = (int) mantissa;
+                                      mantissa -= digit;
+                                      *p++ = digit
+                                             + (digit < 10
+                                                ? '0'
+                                                : dp->conversion - 10);
+                                      if (precision > 0)
+                                        precision--;
+                                    }
+                                  while (precision > 0)
+                                    {
+                                      *p++ = '0';
+                                      precision--;
+                                    }
+                                }
+                              }
+                              *p++ = dp->conversion - 'A' + 'P';
+#  if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR
+                              {
+                                static const wchar_t decimal_format[] =
+                                  { '%', '+', 'd', '\0' };
+                                SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                              }
+                              while (*p != '\0')
+                                p++;
+#  else
+                              if (sizeof (DCHAR_T) == 1)
+                                {
+                                  sprintf ((char *) p, "%+d", exponent);
+                                  while (*p != '\0')
+                                    p++;
+                                }
+                              else
+                                {
+                                  char expbuf[6 + 1];
+                                  const char *ep;
+                                  sprintf (expbuf, "%+d", exponent);
+                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                    p++;
+                                }
+#  endif
+                          }
+                      }
+# else
+                    abort ();
+# endif
+                  }
+
+                /* The generated string now extends from tmp to p, with the
+                   zero padding insertion point being at pad_ptr.  */
+                count = p - tmp;
+
+                if (count < width)
+                  {
+                    size_t pad = width - count;
+                    DCHAR_T *end = p + pad;
+
+                    if (flags & FLAG_LEFT)
+                      {
+                        /* Pad with spaces on the right.  */
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+                    else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                      {
+                        /* Pad with zeroes.  */
+                        DCHAR_T *q = end;
+
+                        while (p > pad_ptr)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = '0';
+                      }
+                    else
+                      {
+                        /* Pad with spaces on the left.  */
+                        DCHAR_T *q = end;
+
+                        while (p > tmp)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+
+                    p = end;
+                  }
+
+                count = p - tmp;
+
+                if (count >= tmp_length)
+                  /* tmp_length was incorrectly calculated - fix the
+                     code above!  */
+                  abort ();
+
+                /* Make room for the result.  */
+                if (count >= allocated - length)
+                  {
+                    size_t n = xsum (length, count);
+
+                    ENSURE_ALLOCATION (n);
+                  }
+
+                /* Append the result.  */
+                memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                if (tmp != tmpbuf)
+                  free (tmp);
+                length += count;
+              }
+#endif
+#if NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE
+            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_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.
+                                Therefore we treat this case here as well.  */
+                             && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double))
+# endif
+# if NEED_PRINTF_LONG_DOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+# elif NEED_PRINTF_INFINITE_LONG_DOUBLE
+                         || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                             /* Some systems produce wrong output for Inf,
+                                -Inf, and NaN.  Some systems in this category
+                                (IRIX 5.3) also do so for -0.0.  Therefore we
+                                treat this case here as well.  */
+                             && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
+# endif
+                        ))
+              {
+# 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;
+                size_t width;
+                size_t count;
+                int has_precision;
+                size_t precision;
+                size_t tmp_length;
+                DCHAR_T tmpbuf[700];
+                DCHAR_T *tmp;
+                DCHAR_T *pad_ptr;
+                DCHAR_T *p;
+
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        width = arg;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = -width;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                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;
+                      }
+                  }
+
+                /* POSIX specifies the default precision to be 6 for %f, %F,
+                   %e, %E, but not for %g, %G.  Implementations appear to use
+                   the same default precision also for %g, %G.  But for %a, %A,
+                   the default precision is 0.  */
+                if (!has_precision)
+                  if (!(dp->conversion == 'a' || dp->conversion == 'A'))
+                    precision = 6;
+
+                /* Allocate a temporary buffer of sufficient size.  */
+# 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_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
+                if (type == TYPE_LONGDOUBLE)
+#  endif
+                  if (dp->conversion == 'f' || dp->conversion == 'F')
+                    {
+                      long double arg = a.arg[dp->arg_index].a.a_longdouble;
+                      if (!(isnanl (arg) || arg + arg == arg))
+                        {
+                          /* arg is finite and nonzero.  */
+                          int exponent = floorlog10l (arg < 0 ? -arg : arg);
+                          if (exponent >= 0 && tmp_length < exponent + precision)
+                            tmp_length = exponent + precision;
+                        }
+                    }
+# 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 (!(isnand (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);
+
+                if (tmp_length < width)
+                  tmp_length = width;
+
+                tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (DCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
+
+                pad_ptr = NULL;
+                p = tmp;
+
+# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
+#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
+                if (type == TYPE_LONGDOUBLE)
+#  endif
+                  {
+                    long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                    if (isnanl (arg))
+                      {
+                        if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+                        DECL_LONG_DOUBLE_ROUNDING
+
+                        BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                        if (signbit (arg)) /* arg < 0.0L or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0L && arg + arg == arg)
+                          {
+                            if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
+#  if NEED_PRINTF_LONG_DOUBLE
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                char *digits;
+                                size_t ndigits;
+
+                                digits =
+                                  scale10_round_decimal_long_double (arg, precision);
+                                if (digits == NULL)
+                                  {
+                                    END_LONG_DOUBLE_ROUNDING ();
+                                    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.0L)
+                                  {
+                                    exponent = 0;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        for (; precision > 0; precision--)
+                                          *p++ = '0';
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0L.  */
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+
+                                    exponent = floorlog10l (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)precision - exponent);
+                                        if (digits == NULL)
+                                          {
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            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.  */
+                                    if (is_borderline (digits, precision))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)precision - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision + 1)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* 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 && DCHAR_IS_TCHAR
+                                {
+                                  static const wchar_t decimal_format[] =
+                                    { '%', '+', '.', '2', 'd', '\0' };
+                                  SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                }
+                                while (*p != '\0')
+                                  p++;
+#   else
+                                if (sizeof (DCHAR_T) == 1)
+                                  {
+                                    sprintf ((char *) p, "%+.2d", exponent);
+                                    while (*p != '\0')
+                                      p++;
+                                  }
+                                else
+                                  {
+                                    char expbuf[6 + 1];
+                                    const char *ep;
+                                    sprintf (expbuf, "%+.2d", 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.0L)
+                                  /* 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.0L.  */
+                                    int exponent;
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+                                    size_t nzeroes;
+
+                                    exponent = floorlog10l (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)(precision - 1) - exponent);
+                                        if (digits == NULL)
+                                          {
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            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.  */
+                                    if (is_borderline (digits, precision - 1))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)(precision - 1) - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* 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 ecount = exponent + 1;
+                                            /* Note: count <= precision = ndigits.  */
+                                            for (; ecount > 0; ecount--)
+                                              *p++ = digits[--ndigits];
+                                            if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                              {
+                                                *p++ = decimal_point_char ();
+                                                while (ndigits > nzeroes)
+                                                  {
+                                                    --ndigits;
+                                                    *p++ = digits[ndigits];
+                                                  }
+                                              }
+                                          }
+                                        else
+                                          {
+                                            size_t ecount = -exponent - 1;
+                                            *p++ = '0';
+                                            *p++ = decimal_point_char ();
+                                            for (; ecount > 0; ecount--)
+                                              *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 && DCHAR_IS_TCHAR
+                                        {
+                                          static const wchar_t decimal_format[] =
+                                            { '%', '+', '.', '2', 'd', '\0' };
+                                          SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                        }
+                                        while (*p != '\0')
+                                          p++;
+#   else
+                                        if (sizeof (DCHAR_T) == 1)
+                                          {
+                                            sprintf ((char *) p, "%+.2d", exponent);
+                                            while (*p != '\0')
+                                              p++;
+                                          }
+                                        else
+                                          {
+                                            char expbuf[6 + 1];
+                                            const char *ep;
+                                            sprintf (expbuf, "%+.2d", exponent);
+                                            for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                              p++;
+                                          }
+#   endif
+                                      }
+
+                                    free (digits);
+                                  }
+                              }
+                            else
+                              abort ();
+#  else
+                            /* arg is finite.  */
+                            if (!(arg == 0.0L))
+                              abort ();
+
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion; /* 'e' or 'E' */
+                                *p++ = '+';
+                                *p++ = '0';
+                                *p++ = '0';
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                *p++ = '0';
+                                if (flags & FLAG_ALT)
+                                  {
+                                    size_t ndigits =
+                                      (precision > 0 ? precision - 1 : 0);
+                                    *p++ = decimal_point_char ();
+                                    for (; ndigits > 0; --ndigits)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'a' || dp->conversion == 'A')
+                              {
+                                *p++ = '0';
+                                *p++ = dp->conversion - 'A' + 'X';
+                                pad_ptr = p;
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion - 'A' + 'P';
+                                *p++ = '+';
+                                *p++ = '0';
+                              }
+                            else
+                              abort ();
+#  endif
+                          }
+
+                        END_LONG_DOUBLE_ROUNDING ();
+                      }
+                  }
+#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
+                else
+#  endif
+# endif
+# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
+                  {
+                    double arg = a.arg[dp->arg_index].a.a_double;
+
+                    if (isnand (arg))
+                      {
+                        if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+
+                        if (signbit (arg)) /* arg < 0.0 or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0 && arg + arg == arg)
+                          {
+                            if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        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.  */
+                                    if (is_borderline (digits, precision))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)precision - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision + 1)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* 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 && DCHAR_IS_TCHAR
+                                {
+                                  static const wchar_t decimal_format[] =
+                                    /* Produce the same number of exponent digits
+                                       as the native printf implementation.  */
+#    if 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 __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.  */
+                                    if (is_borderline (digits, precision - 1))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)(precision - 1) - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* 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 ecount = exponent + 1;
+                                            /* Note: ecount <= precision = ndigits.  */
+                                            for (; ecount > 0; ecount--)
+                                              *p++ = digits[--ndigits];
+                                            if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                              {
+                                                *p++ = decimal_point_char ();
+                                                while (ndigits > nzeroes)
+                                                  {
+                                                    --ndigits;
+                                                    *p++ = digits[ndigits];
+                                                  }
+                                              }
+                                          }
+                                        else
+                                          {
+                                            size_t ecount = -exponent - 1;
+                                            *p++ = '0';
+                                            *p++ = decimal_point_char ();
+                                            for (; ecount > 0; ecount--)
+                                              *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 && DCHAR_IS_TCHAR
+                                        {
+                                          static const wchar_t decimal_format[] =
+                                            /* Produce the same number of exponent digits
+                                               as the native printf implementation.  */
+#    if 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 __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 ();
+
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion; /* 'e' or 'E' */
+                                *p++ = '+';
+                                /* Produce the same number of exponent digits as
+                                   the native printf implementation.  */
+#   if defined _WIN32 && ! defined __CYGWIN__
+                                *p++ = '0';
+#   endif
+                                *p++ = '0';
+                                *p++ = '0';
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                *p++ = '0';
+                                if (flags & FLAG_ALT)
+                                  {
+                                    size_t ndigits =
+                                      (precision > 0 ? precision - 1 : 0);
+                                    *p++ = decimal_point_char ();
+                                    for (; ndigits > 0; --ndigits)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else
+                              abort ();
+#  endif
+                          }
+                      }
+                  }
+# endif
+
+                /* The generated string now extends from tmp to p, with the
+                   zero padding insertion point being at pad_ptr.  */
+                count = p - tmp;
+
+                if (count < width)
+                  {
+                    size_t pad = width - count;
+                    DCHAR_T *end = p + pad;
+
+                    if (flags & FLAG_LEFT)
+                      {
+                        /* Pad with spaces on the right.  */
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+                    else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                      {
+                        /* Pad with zeroes.  */
+                        DCHAR_T *q = end;
+
+                        while (p > pad_ptr)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = '0';
+                      }
+                    else
+                      {
+                        /* Pad with spaces on the left.  */
+                        DCHAR_T *q = end;
+
+                        while (p > tmp)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+
+                    p = end;
+                  }
+
+                count = p - tmp;
+
+                if (count >= tmp_length)
+                  /* tmp_length was incorrectly calculated - fix the
+                     code above!  */
+                  abort ();
+
+                /* Make room for the result.  */
+                if (count >= allocated - length)
+                  {
+                    size_t n = xsum (length, count);
+
+                    ENSURE_ALLOCATION (n);
+                  }
+
+                /* Append the result.  */
+                memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                if (tmp != tmpbuf)
+                  free (tmp);
+                length += count;
+              }
+#endif
+            else
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                int has_width;
+#endif
+#if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                size_t width;
+#endif
+#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                int has_precision;
+                size_t precision;
+#endif
+#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                int prec_ourselves;
+#else
+#               define prec_ourselves 0
+#endif
+#if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST
+#               define pad_ourselves 1
+#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                int pad_ourselves;
+#else
+#               define pad_ourselves 0
+#endif
+                TCHAR_T *fbp;
+                unsigned int prefix_count;
+                int prefixes[2] IF_LINT (= { 0 });
+                int orig_errno;
+#if !USE_SNPRINTF
+                size_t tmp_length;
+                TCHAR_T tmpbuf[700];
+                TCHAR_T *tmp;
+#endif
+
+#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                has_width = 0;
+#endif
+#if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        width = arg;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = -width;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+# if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                    has_width = 1;
+# endif
+                  }
+#endif
+
+#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || 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
+
+                /* Decide whether to handle the precision ourselves.  */
+#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                switch (dp->conversion)
+                  {
+# if NEED_PRINTF_UNBOUNDED_PRECISION
+                  case 'd': case 'i': case 'u':
+                  case 'b':
+                  #if SUPPORT_GNU_PRINTF_DIRECTIVES \
+                      || (__GLIBC__ + (__GLIBC_MINOR__ >= 35) > 2)
+                  case 'B':
+                  #endif
+                  case 'o':
+                    prec_ourselves = has_precision && (precision > 0);
+                    break;
+# endif
+                  case 'x': case 'X': case 'p':
+                    prec_ourselves =
+                      has_precision
+                      && (0
+# if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO
+                          || (precision == 0)
+# endif
+# if NEED_PRINTF_UNBOUNDED_PRECISION
+                          || (precision > 0)
+# endif
+                         );
+                    break;
+                  default:
+                    prec_ourselves = 0;
+                    break;
+                  }
+#endif
+
+                /* Decide whether to perform the padding ourselves.  */
+#if !((WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST) && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
+                switch (dp->conversion)
+                  {
+# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
+                  /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
+                     to perform the padding after this conversion.  Functions
+                     with unistdio extensions perform the padding based on
+                     character count rather than element count.  */
+                  case 'c': case 's':
+# endif
+# if NEED_PRINTF_FLAG_ZERO
+                  case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
+                  case 'a': case 'A':
+# endif
+                    pad_ourselves = 1;
+                    break;
+                  default:
+                    pad_ourselves = prec_ourselves;
+                    break;
+                  }
+#endif
+
+#if !USE_SNPRINTF
+                /* Allocate a temporary buffer of sufficient size for calling
+                   sprintf.  */
+                tmp_length =
+                  MAX_ROOM_NEEDED (&a, dp->arg_index, dp->conversion, type,
+                                   flags, width, has_precision, precision,
+                                   pad_ourselves);
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (TCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
+#endif
+
+                /* Construct the format string for calling snprintf or
+                   sprintf.  */
+                fbp = buf;
+                *fbp++ = '%';
+#if NEED_PRINTF_FLAG_GROUPING
+                /* The underlying implementation doesn't support the ' flag.
+                   Produce no grouping characters in this case; this is
+                   acceptable because the grouping is locale dependent.  */
+#else
+                if (flags & FLAG_GROUP)
+                  *fbp++ = '\'';
+#endif
+                if (flags & FLAG_LEFT)
+                  *fbp++ = '-';
+                if (flags & FLAG_SHOWSIGN)
+                  *fbp++ = '+';
+                if (flags & FLAG_SPACE)
+                  *fbp++ = ' ';
+                if (flags & FLAG_ALT)
+                  *fbp++ = '#';
+#if __GLIBC__ >= 2 && !defined __UCLIBC__
+                if (flags & FLAG_LOCALIZED)
+                  *fbp++ = 'I';
+#endif
+                if (!pad_ourselves)
+                  {
+                    if (flags & FLAG_ZERO)
+                      *fbp++ = '0';
+                    if (dp->width_start != dp->width_end)
+                      {
+                        size_t n = dp->width_end - dp->width_start;
+                        /* The width specification is known to consist only
+                           of standard ASCII characters.  */
+                        if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                          {
+                            memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
+                            fbp += n;
+                          }
+                        else
+                          {
+                            const FCHAR_T *mp = dp->width_start;
+                            do
+                              *fbp++ = *mp++;
+                            while (--n > 0);
+                          }
+                      }
+                  }
+                if (!prec_ourselves)
+                  {
+                    if (dp->precision_start != dp->precision_end)
+                      {
+                        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++ = *mp++;
+                            while (--n > 0);
+                          }
+                      }
+                  }
+
+                switch (type)
+                  {
+                  case TYPE_LONGLONGINT:
+                  case TYPE_ULONGLONGINT:
+                  #if INT8_WIDTH > LONG_WIDTH
+                  case TYPE_INT8_T:
+                  #endif
+                  #if UINT8_WIDTH > LONG_WIDTH
+                  case TYPE_UINT8_T:
+                  #endif
+                  #if INT16_WIDTH > LONG_WIDTH
+                  case TYPE_INT16_T:
+                  #endif
+                  #if UINT16_WIDTH > LONG_WIDTH
+                  case TYPE_UINT16_T:
+                  #endif
+                  #if INT32_WIDTH > LONG_WIDTH
+                  case TYPE_INT32_T:
+                  #endif
+                  #if UINT32_WIDTH > LONG_WIDTH
+                  case TYPE_UINT32_T:
+                  #endif
+                  #if INT64_WIDTH > LONG_WIDTH
+                  case TYPE_INT64_T:
+                  #endif
+                  #if UINT64_WIDTH > LONG_WIDTH
+                  case TYPE_UINT64_T:
+                  #endif
+                  #if INT_FAST8_WIDTH > LONG_WIDTH
+                  case TYPE_INT_FAST8_T:
+                  #endif
+                  #if UINT_FAST8_WIDTH > LONG_WIDTH
+                  case TYPE_UINT_FAST8_T:
+                  #endif
+                  #if INT_FAST16_WIDTH > LONG_WIDTH
+                  case TYPE_INT_FAST16_T:
+                  #endif
+                  #if UINT_FAST16_WIDTH > LONG_WIDTH
+                  case TYPE_UINT_FAST16_T:
+                  #endif
+                  #if INT_FAST32_WIDTH > LONG_WIDTH
+                  case TYPE_INT3_FAST2_T:
+                  #endif
+                  #if UINT_FAST32_WIDTH > LONG_WIDTH
+                  case TYPE_UINT_FAST32_T:
+                  #endif
+                  #if INT_FAST64_WIDTH > LONG_WIDTH
+                  case TYPE_INT_FAST64_T:
+                  #endif
+                  #if UINT_FAST64_WIDTH > LONG_WIDTH
+                  case TYPE_UINT_FAST64_T:
+                  #endif
+#if defined _WIN32 && ! defined __CYGWIN__
+                    *fbp++ = 'I';
+                    *fbp++ = '6';
+                    *fbp++ = '4';
+                    break;
+#else
+                    *fbp++ = 'l';
+#endif
+                    FALLTHROUGH;
+                  case TYPE_LONGINT:
+                  case TYPE_ULONGINT:
+                  #if INT8_WIDTH > INT_WIDTH && INT8_WIDTH <= LONG_WIDTH
+                  case TYPE_INT8_T:
+                  #endif
+                  #if UINT8_WIDTH > INT_WIDTH && UINT8_WIDTH <= LONG_WIDTH
+                  case TYPE_UINT8_T:
+                  #endif
+                  #if INT16_WIDTH > INT_WIDTH && INT16_WIDTH <= LONG_WIDTH
+                  case TYPE_INT16_T:
+                  #endif
+                  #if UINT16_WIDTH > INT_WIDTH && UINT16_WIDTH <= LONG_WIDTH
+                  case TYPE_UINT16_T:
+                  #endif
+                  #if INT32_WIDTH > INT_WIDTH && INT32_WIDTH <= LONG_WIDTH
+                  case TYPE_INT32_T:
+                  #endif
+                  #if UINT32_WIDTH > INT_WIDTH && UINT32_WIDTH <= LONG_WIDTH
+                  case TYPE_UINT32_T:
+                  #endif
+                  #if INT64_WIDTH > INT_WIDTH && INT64_WIDTH <= LONG_WIDTH
+                  case TYPE_INT64_T:
+                  #endif
+                  #if UINT64_WIDTH > INT_WIDTH && UINT64_WIDTH <= LONG_WIDTH
+                  case TYPE_UINT64_T:
+                  #endif
+                  #if INT_FAST8_WIDTH > INT_WIDTH && INT_FAST8_WIDTH <= LONG_WIDTH
+                  case TYPE_INT_FAST8_T:
+                  #endif
+                  #if UINT_FAST8_WIDTH > INT_WIDTH && UINT_FAST8_WIDTH <= LONG_WIDTH
+                  case TYPE_UINT_FAST8_T:
+                  #endif
+                  #if INT_FAST16_WIDTH > INT_WIDTH && INT_FAST16_WIDTH <= LONG_WIDTH
+                  case TYPE_INT_FAST16_T:
+                  #endif
+                  #if UINT_FAST16_WIDTH > INT_WIDTH && UINT_FAST16_WIDTH <= LONG_WIDTH
+                  case TYPE_UINT_FAST16_T:
+                  #endif
+                  #if INT_FAST32_WIDTH > INT_WIDTH && INT_FAST32_WIDTH <= LONG_WIDTH
+                  case TYPE_INT_FAST32_T:
+                  #endif
+                  #if UINT_FAST32_WIDTH > INT_WIDTH && UINT_FAST32_WIDTH <= LONG_WIDTH
+                  case TYPE_UINT_FAST32_T:
+                  #endif
+                  #if INT_FAST64_WIDTH > INT_WIDTH && INT_FAST64_WIDTH <= LONG_WIDTH
+                  case TYPE_INT_FAST64_T:
+                  #endif
+                  #if UINT_FAST64_WIDTH > INT_WIDTH && UINT_FAST64_WIDTH <= LONG_WIDTH
+                  case TYPE_UINT_FAST64_T:
+                  #endif
+                  #if HAVE_WINT_T
+                  case TYPE_WIDE_CHAR:
+                  #endif
+                  #if HAVE_WCHAR_T
+                  case TYPE_WIDE_STRING:
+                  #endif
+                    *fbp++ = 'l';
+                    break;
+                  case TYPE_LONGDOUBLE:
+                    *fbp++ = 'L';
+                    break;
+                  default:
+                    break;
+                  }
+#if NEED_PRINTF_DIRECTIVE_F
+                if (dp->conversion == 'F')
+                  *fbp = 'f';
+                else
+#endif
+                  *fbp = dp->conversion;
+#if USE_SNPRINTF
+                /* Decide whether to pass %n in the format string
+                   to SNPRINTF.  */
+# if (((!WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR)                              \
+       && (HAVE_SNPRINTF_RETVAL_C99 && HAVE_SNPRINTF_TRUNCATION_C99))       \
+      || ((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))       \
+          && !defined __UCLIBC__)                                           \
+      || (defined __APPLE__ && defined __MACH__)                            \
+      || defined __OpenBSD__                                                \
+      || defined __ANDROID__                                                \
+      || (defined _WIN32 && ! defined __CYGWIN__))                          \
+      || (WIDE_CHAR_VERSION && MUSL_LIBC)
+                /* We can avoid passing %n and instead rely on SNPRINTF's
+                   return value if
+                     - !WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR, because otherwise,
+                       when WIDE_CHAR_VERSION && DCHAR_IS_TCHAR,
+                       snwprintf()/_snwprintf() (Windows) and swprintf() (Unix)
+                       don't return the needed buffer size,
+                     and
+                     - we're compiling for a system where we know
+                       - that snprintf's return value conforms to ISO C 99
+                         (HAVE_SNPRINTF_RETVAL_C99) and
+                       - that snprintf always produces NUL-terminated strings
+                         (HAVE_SNPRINTF_TRUNCATION_C99).
+                   And it is desirable to do so, because more and more platforms
+                   no longer support %n, for "security reasons".  */
+                /* On specific platforms, listed below, we *must* avoid %n.
+                   In the case
+                     !WIDE_CHAR_VERSION && HAVE_SNPRINTF_RETVAL_C99 && !USE_MSVC__SNPRINTF
+                   we can rely on the return value of snprintf instead.  Whereas
+                   in the opposite case
+                     WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF
+                   we need to make room based on an estimation, computed by
+                   MAX_ROOM_NEEDED.  */
+                /* The following platforms forbid %n:
+                     - 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).
+                     - On macOS 10.13 or newer, the use of %n in format
+                       strings in writable memory by default crashes the
+                       program.
+                     - On OpenBSD, since 2021-08-30, the use of %n in format
+                       strings produces an abort (see
+                       <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/vfprintf.c.diff?r1=1.79&r2=1.80&f=h>,
+                       <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/vfwprintf.c.diff?r1=1.20&r2=1.21&f=h>).
+                     - On Android, starting on 2018-03-07, the use of %n in
+                       format strings produces a fatal error (see
+                       <https://android.googlesource.com/platform/bionic/+/41398d03b7e8e0dfb951660ae713e682e9fc0336>).
+                     - On native Windows systems (such as mingw) where the OS is
+                       Windows Vista, the use of %n in format strings by default
+                       crashes the program. See
+                         <https://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
+                         <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-printf-count-output>
+                   On the first four of these platforms, if !WIDE_CHAR_VERSION,
+                   it is not a big deal to avoid %n, because on these platforms,
+                   HAVE_SNPRINTF_RETVAL_C99 and HAVE_SNPRINTF_TRUNCATION_C99 are
+                   1.
+                   On native Windows, if !WIDE_CHAR_VERSION, it's not a big deal
+                   either because:
+                     - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
+                       snprintf does not write more than the specified number
+                       of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
+                       '4', '5', '6' into buf, not '4', '5', '\0'.)
+                     - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
+                       allows us to recognize the case of an insufficient
+                       buffer size: it returns -1 in this case.  */
+                /* Additionally, in the WIDE_CHAR_VERSION case, we cannot use %n
+                   on musl libc because we would run into an swprintf() bug.
+                   See <https://www.openwall.com/lists/musl/2023/03/19/1>.  */
+                fbp[1] = '\0';
+# else           /* AIX <= 5.1, HP-UX, IRIX, OSF/1, Solaris <= 9, BeOS */
+                fbp[1] = '%';
+                fbp[2] = 'n';
+                fbp[3] = '\0';
+# endif
+#else
+                fbp[1] = '\0';
+#endif
+
+                /* Construct the arguments for calling snprintf or sprintf.  */
+                prefix_count = 0;
+                if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
+                  {
+                    if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                      abort ();
+                    prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
+                  }
+                if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
+                  {
+                    if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                      abort ();
+                    prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
+                  }
+
+#if USE_SNPRINTF
+                /* The SNPRINTF result is appended after result[0..length].
+                   The latter is an array of DCHAR_T; SNPRINTF appends an
+                   array of TCHAR_T to it.  This is possible because
+                   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.  */
+                *(TCHAR_T *) (result + length) = '\0';
+#endif
+
+                orig_errno = errno;
+
+                for (;;)
+                  {
+                    int count = -1;
+
+#if USE_SNPRINTF
+                    int retcount = 0;
+                    size_t maxlen = allocated - length;
+                    /* SNPRINTF can fail if its second argument is
+                       > INT_MAX.  */
+                    if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
+                      maxlen = INT_MAX / TCHARS_PER_DCHAR;
+                    maxlen = maxlen * TCHARS_PER_DCHAR;
+# define SNPRINTF_BUF(arg) \
+                    switch (prefix_count)                                   \
+                      {                                                     \
+                      case 0:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             arg, &count);                  \
+                        break;                                              \
+                      case 1:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             prefixes[0], arg, &count);     \
+                        break;                                              \
+                      case 2:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             prefixes[0], prefixes[1], arg, \
+                                             &count);                       \
+                        break;                                              \
+                      default:                                              \
+                        abort ();                                           \
+                      }
+#else
+# define SNPRINTF_BUF(arg) \
+                    switch (prefix_count)                                   \
+                      {                                                     \
+                      case 0:                                               \
+                        count = sprintf (tmp, buf, arg);                    \
+                        break;                                              \
+                      case 1:                                               \
+                        count = sprintf (tmp, buf, prefixes[0], arg);       \
+                        break;                                              \
+                      case 2:                                               \
+                        count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
+                                         arg);                              \
+                        break;                                              \
+                      default:                                              \
+                        abort ();                                           \
+                      }
+#endif
+
+                    errno = 0;
+                    switch (type)
+                      {
+                      case TYPE_SCHAR:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_schar;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UCHAR:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_SHORT:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_short;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_USHORT:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_int;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_uint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_LONGINT:
+                        {
+                          long int arg = a.arg[dp->arg_index].a.a_longint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_ULONGINT:
+                        {
+                          unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_LONGLONGINT:
+                        {
+                          long long int arg = a.arg[dp->arg_index].a.a_longlongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_ULONGLONGINT:
+                        {
+                          unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT8_T:
+                        {
+                          int8_t arg = a.arg[dp->arg_index].a.a_int8_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT8_T:
+                        {
+                          uint8_t arg = a.arg[dp->arg_index].a.a_uint8_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT16_T:
+                        {
+                          int16_t arg = a.arg[dp->arg_index].a.a_int16_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT16_T:
+                        {
+                          uint16_t arg = a.arg[dp->arg_index].a.a_uint16_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT32_T:
+                        {
+                          int32_t arg = a.arg[dp->arg_index].a.a_int32_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT32_T:
+                        {
+                          uint32_t arg = a.arg[dp->arg_index].a.a_uint32_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT64_T:
+                        {
+                          int64_t arg = a.arg[dp->arg_index].a.a_int64_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT64_T:
+                        {
+                          uint64_t arg = a.arg[dp->arg_index].a.a_uint64_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT_FAST8_T:
+                        {
+                          int_fast8_t arg = a.arg[dp->arg_index].a.a_int_fast8_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT_FAST8_T:
+                        {
+                          uint_fast8_t arg = a.arg[dp->arg_index].a.a_uint_fast8_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT_FAST16_T:
+                        {
+                          int_fast16_t arg = a.arg[dp->arg_index].a.a_int_fast16_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT_FAST16_T:
+                        {
+                          uint_fast16_t arg = a.arg[dp->arg_index].a.a_uint_fast16_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT_FAST32_T:
+                        {
+                          int_fast32_t arg = a.arg[dp->arg_index].a.a_int_fast32_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT_FAST32_T:
+                        {
+                          uint_fast32_t arg = a.arg[dp->arg_index].a.a_uint_fast32_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT_FAST64_T:
+                        {
+                          int_fast64_t arg = a.arg[dp->arg_index].a.a_int_fast64_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT_FAST64_T:
+                        {
+                          uint_fast64_t arg = a.arg[dp->arg_index].a.a_uint_fast64_t;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_DOUBLE:
+                        {
+                          double arg = a.arg[dp->arg_index].a.a_double;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_LONGDOUBLE:
+                        {
+                          long double arg = a.arg[dp->arg_index].a.a_longdouble;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_CHAR:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_char;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+#if HAVE_WINT_T
+                      case TYPE_WIDE_CHAR:
+                        {
+                          wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+#endif
+                      case TYPE_STRING:
+                        {
+                          const char *arg = a.arg[dp->arg_index].a.a_string;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+#if HAVE_WCHAR_T
+                      case TYPE_WIDE_STRING:
+                        {
+                          const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+#endif
+                      case TYPE_POINTER:
+                        {
+                          void *arg = a.arg[dp->arg_index].a.a_pointer;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      default:
+                        abort ();
+                      }
+
+#if USE_SNPRINTF
+                    /* Portability: Not all implementations of snprintf()
+                       are ISO C 99 compliant.  Determine the number of
+                       bytes that snprintf() has produced or would have
+                       produced.  */
+                    if (count >= 0)
+                      {
+                        /* Verify that snprintf() has NUL-terminated its
+                           result.  */
+                        if ((unsigned int) count < maxlen
+                            && ((TCHAR_T *) (result + length)) [count] != '\0')
+                          abort ();
+                        /* Portability hack.  */
+                        if (retcount > count)
+                          count = retcount;
+                      }
+                    else
+                      {
+                        /* snprintf() doesn't understand the '%n'
+                           directive.  */
+                        if (fbp[1] != '\0')
+                          {
+                            /* Don't use the '%n' directive; instead, look
+                               at the snprintf() return value.  */
+                            fbp[1] = '\0';
+                            continue;
+                          }
+                        else
+                          {
+                            /* Look at the snprintf() return value.  */
+                            if (retcount < 0)
+                              {
+# if (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF
+                                /* HP-UX 10.20 snprintf() is doubly deficient:
+                                   It doesn't understand the '%n' directive,
+                                   *and* it returns -1 (rather than the length
+                                   that would have been required) when the
+                                   buffer is too small.
+                                   Likewise, in case of
+                                   WIDE_CHAR_VERSION && DCHAR_IS_TCHAR, the
+                                   functions snwprintf()/_snwprintf() (Windows)
+                                   or swprintf() (Unix).
+                                   But a failure at this point can also come
+                                   from other reasons than a too small buffer,
+                                   such as an invalid wide string argument to
+                                   the %ls directive, or possibly an invalid
+                                   floating-point argument.  */
+                                size_t tmp_length =
+                                  MAX_ROOM_NEEDED (&a, dp->arg_index,
+                                                   dp->conversion, type, flags,
+                                                   width,
+                                                   has_precision,
+                                                   precision, pad_ourselves);
+
+                                if (maxlen < tmp_length)
+                                  {
+                                    /* Make more room.  But try to do through
+                                       this reallocation only once.  */
+                                    size_t bigger_need =
+                                      xsum (length,
+                                            xsum (tmp_length,
+                                                  TCHARS_PER_DCHAR - 1)
+                                            / TCHARS_PER_DCHAR);
+                                    /* And always grow proportionally.
+                                       (There may be several arguments, each
+                                       needing a little more room than the
+                                       previous one.)  */
+                                    size_t bigger_need2 =
+                                      xsum (xtimes (allocated, 2), 12);
+                                    if (bigger_need < bigger_need2)
+                                      bigger_need = bigger_need2;
+                                    ENSURE_ALLOCATION (bigger_need);
+                                    continue;
+                                  }
+# endif
+                              }
+                            else
+                              {
+                                count = retcount;
+# if WIDE_CHAR_VERSION && defined __MINGW32__
+                                if (count == 0 && dp->conversion == 'c')
+                                  /* snwprintf returned 0 instead of 1.  But it
+                                     wrote a null wide character.  */
+                                  count = 1;
+# endif
+                              }
+                          }
+                      }
+#endif
+
+                    /* Attempt to handle failure.  */
+                    if (count < 0)
+                      {
+                        /* SNPRINTF or sprintf failed.  Use the errno that it
+                           has set, if any.  */
+                        if (errno == 0)
+                          {
+                            if (dp->conversion == 'c' || dp->conversion == 's')
+                              errno = EILSEQ;
+                            else
+                              errno = EINVAL;
+                          }
+
+                        goto fail_with_errno;
+                      }
+
+#if USE_SNPRINTF
+                    /* 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)
+                      {
+                        /* 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
+
+#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || 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;
+                          }
+# if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO
+                        else if (precision == 0
+                                 && move == 1
+                                 && prec_ptr[prefix_count] == '0')
+                          {
+                            /* Replace the "0" result with an empty string.  */
+                            count = prefix_count;
+                          }
+# endif
+                      }
+#endif
+
+#if !USE_SNPRINTF
+                    if (count >= tmp_length)
+                      /* tmp_length was incorrectly calculated - fix the
+                         code above!  */
+                      abort ();
+#endif
+
+#if !DCHAR_IS_TCHAR
+                    /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                    if (dp->conversion == 'c' || dp->conversion == 's'
+# if __GLIBC__ >= 2 && !defined __UCLIBC__
+                        || (flags & FLAG_LOCALIZED)
+# endif
+                       )
+                      {
+                        /* The result string is not guaranteed to be ASCII.  */
+                        const TCHAR_T *tmpsrc;
+                        DCHAR_T *tmpdst;
+                        size_t tmpdst_len;
+                        /* This code assumes that TCHAR_T is 'char'.  */
+                        static_assert (sizeof (TCHAR_T) == 1);
+# if USE_SNPRINTF
+                        tmpsrc = (TCHAR_T *) (result + length);
+# else
+                        tmpsrc = tmp;
+# endif
+# if WIDE_CHAR_VERSION
+                        /* Convert tmpsrc[0..count-1] to a freshly allocated
+                           wide character array.  */
+                        mbstate_t state;
+
+                        mbszero (&state);
+                        tmpdst_len = 0;
+                        {
+                          const TCHAR_T *src = tmpsrc;
+                          size_t srclen = count;
+
+                          for (; srclen > 0; tmpdst_len++)
+                            {
+                              /* Parse the next multibyte character.  */
+                              size_t ret = mbrtowc (NULL, src, srclen, &state);
+                              if (ret == (size_t)(-2) || ret == (size_t)(-1))
+                                goto fail_with_EILSEQ;
+                              if (ret == 0)
+                                ret = 1;
+                              src += ret;
+                              srclen -= ret;
+                            }
+                        }
+
+                        tmpdst =
+                          (wchar_t *) malloc ((tmpdst_len + 1) * sizeof (wchar_t));
+                        if (tmpdst == NULL)
+                          goto out_of_memory;
+
+                        mbszero (&state);
+                        {
+                          DCHAR_T *destptr = tmpdst;
+                          const TCHAR_T *src = tmpsrc;
+                          size_t srclen = count;
+
+                          for (; srclen > 0; destptr++)
+                            {
+                              /* Parse the next multibyte character.  */
+                              size_t ret = mbrtowc (destptr, src, srclen, &state);
+                              if (ret == (size_t)(-2) || ret == (size_t)(-1))
+                                /* Should already have been caught in the first
+                                   loop, above.  */
+                                abort ();
+                              if (ret == 0)
+                                ret = 1;
+                              src += ret;
+                              srclen -= ret;
+                            }
+                        }
+# else
+                        tmpdst =
+                          DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                                    iconveh_question_mark,
+                                                    tmpsrc, count,
+                                                    NULL,
+                                                    NULL, &tmpdst_len);
+                        if (tmpdst == NULL)
+                          goto fail_with_errno;
+# endif
+                        ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
+                                                { free (tmpdst); goto out_of_memory; });
+                        DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                        free (tmpdst);
+                        count = tmpdst_len;
+                      }
+                    else
+                      {
+                        /* The result string is ASCII.
+                           Simple 1:1 conversion.  */
+# if USE_SNPRINTF
+                        /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
+                           no-op conversion, in-place on the array starting
+                           at (result + length).  */
+                        if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
+# endif
+                          {
+                            const TCHAR_T *tmpsrc;
+                            DCHAR_T *tmpdst;
+                            size_t n;
+
+# if USE_SNPRINTF
+                            if (result == resultbuf)
+                              {
+                                tmpsrc = (TCHAR_T *) (result + length);
+                                /* ENSURE_ALLOCATION will not move tmpsrc
+                                   (because it's part of resultbuf).  */
+                                ENSURE_ALLOCATION (xsum (length, count));
+                              }
+                            else
+                              {
+                                /* ENSURE_ALLOCATION will move the array
+                                   (because it uses realloc().  */
+                                ENSURE_ALLOCATION (xsum (length, count));
+                                tmpsrc = (TCHAR_T *) (result + length);
+                              }
+# else
+                            tmpsrc = tmp;
+                            ENSURE_ALLOCATION (xsum (length, count));
+# endif
+                            tmpdst = result + length;
+                            /* Copy backwards, because of overlapping.  */
+                            tmpsrc += count;
+                            tmpdst += count;
+                            for (n = count; n > 0; n--)
+                              *--tmpdst = *--tmpsrc;
+                          }
+                      }
+#endif
+
+#if DCHAR_IS_TCHAR && !USE_SNPRINTF
+                    /* Make room for the result.  */
+                    if (count > allocated - length)
+                      {
+                        /* Need at least count elements.  But allocate
+                           proportionally.  */
+                        size_t n =
+                          xmax (xsum (length, count), xtimes (allocated, 2));
+
+                        ENSURE_ALLOCATION (n);
+                      }
+#endif
+
+                    /* Here count <= allocated - length.  */
+
+                    /* Perform padding.  */
+#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+                    if (pad_ourselves && has_width)
+                      {
+                        size_t w;
+# if ENABLE_UNISTDIO
+                        /* Outside POSIX, it's preferable to compare the width
+                           against the number of _characters_ of the converted
+                           value.  */
+                        w = DCHAR_MBSNLEN (result + length, count);
+# else
+                        /* The width is compared against the number of _bytes_
+                           of the converted value, says POSIX.  */
+                        w = count;
+# endif
+                        if (w < width)
+                          {
+                            size_t pad = width - w;
+
+                            /* Make room for the result.  */
+                            if (xsum (count, pad) > allocated - length)
+                              {
+                                /* Need at least count + pad elements.  But
+                                   allocate proportionally.  */
+                                size_t n =
+                                  xmax (xsum3 (length, count, pad),
+                                        xtimes (allocated, 2));
+
+# if USE_SNPRINTF
+                                length += count;
+                                ENSURE_ALLOCATION (n);
+                                length -= count;
+# else
+                                ENSURE_ALLOCATION (n);
+# endif
+                              }
+                            /* Here count + pad <= allocated - length.  */
+
+                            {
+# if !DCHAR_IS_TCHAR || USE_SNPRINTF
+                              DCHAR_T * const rp = result + length;
+# else
+                              DCHAR_T * const rp = tmp;
+# endif
+                              DCHAR_T *p = rp + count;
+                              DCHAR_T *end = p + pad;
+                              DCHAR_T *pad_ptr;
+# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
+                              if (dp->conversion == 'c'
+                                  || dp->conversion == 's')
+                                /* No zero-padding for string directives.  */
+                                pad_ptr = NULL;
+                              else
+# endif
+                                {
+                                  pad_ptr = (*rp == '-' ? rp + 1 : rp);
+                                  /* No zero-padding of "inf" and "nan".  */
+                                  if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
+                                      || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
+                                    pad_ptr = NULL;
+                                  else
+                                    /* Do the zero-padding after the "0x" or
+                                       "0b" prefix, not before.  */
+                                    if (p - rp >= 2
+                                        && *rp == '0'
+                                        && (((dp->conversion == 'a'
+                                              || dp->conversion == 'x')
+                                             && rp[1] == 'x')
+                                            || ((dp->conversion == 'A'
+                                                 || dp->conversion == 'X')
+                                                && rp[1] == 'X')
+                                            || (dp->conversion == 'b'
+                                                && rp[1] == 'b')
+                                            || (dp->conversion == 'B'
+                                                && rp[1] == 'B')))
+                                      pad_ptr += 2;
+                                }
+                              /* The generated string now extends from rp to p,
+                                 with the zero padding insertion point being at
+                                 pad_ptr.  */
+
+                              count = count + pad; /* = end - rp */
+
+                              if (flags & FLAG_LEFT)
+                                {
+                                  /* Pad with spaces on the right.  */
+                                  for (; pad > 0; pad--)
+                                    *p++ = ' ';
+                                }
+                              else if ((flags & FLAG_ZERO) && pad_ptr != NULL
+                                       /* ISO C says: "For d, i, o, u, x, and X
+                                          conversions, if a precision is
+                                          specified, the 0 flag is ignored.  */
+                                       && !(has_precision
+                                            && (dp->conversion == 'd'
+                                                || dp->conversion == 'i'
+                                                || dp->conversion == 'o'
+                                                || dp->conversion == 'u'
+                                                || dp->conversion == 'x'
+                                                || dp->conversion == 'X'
+                                                /* Although ISO C does not
+                                                   require it, treat 'b' and 'B'
+                                                   like 'x' and 'X'.  */
+                                                || dp->conversion == 'b'
+                                                || dp->conversion == 'B')))
+                                {
+                                  /* Pad with zeroes.  */
+                                  DCHAR_T *q = end;
+
+                                  while (p > pad_ptr)
+                                    *--q = *--p;
+                                  for (; pad > 0; pad--)
+                                    *p++ = '0';
+                                }
+                              else
+                                {
+                                  /* Pad with spaces on the left.  */
+                                  DCHAR_T *q = end;
+
+                                  while (p > rp)
+                                    *--q = *--p;
+                                  for (; pad > 0; pad--)
+                                    *p++ = ' ';
+                                }
+                            }
+                          }
+                      }
+#endif
+
+                    /* Here still count <= allocated - length.  */
+
+#if !DCHAR_IS_TCHAR || USE_SNPRINTF
+                    /* The snprintf() result did fit.  */
+#else
+                    /* Append the sprintf() result.  */
+                    memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+#endif
+#if !USE_SNPRINTF
+                    if (tmp != tmpbuf)
+                      free (tmp);
+#endif
+
+#if NEED_PRINTF_DIRECTIVE_F
+                    if (dp->conversion == 'F')
+                      {
+                        /* Convert the %f result to upper case for %F.  */
+                        DCHAR_T *rp = result + length;
+                        size_t rc;
+                        for (rc = count; rc > 0; rc--, rp++)
+                          if (*rp >= 'a' && *rp <= 'z')
+                            *rp = *rp - 'a' + 'A';
+                      }
+#endif
+
+                    length += count;
+                    break;
+                  }
+                errno = orig_errno;
+#undef pad_ourselves
+#undef prec_ourselves
+              }
+          }
+      }
+
+    /* Add the final NUL.  */
+    ENSURE_ALLOCATION (xsum (length, 1));
+    result[length] = '\0';
+
+    if (result != resultbuf && length + 1 < allocated)
+      {
+        /* Shrink the allocated memory if possible.  */
+        DCHAR_T *memory;
+
+        memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
+        if (memory != NULL)
+          result = memory;
+      }
+
+    if (buf_malloced != NULL)
+      free (buf_malloced);
+    CLEANUP ();
+    *lengthp = length;
+    /* Note that we can produce a big string of a length > INT_MAX.  POSIX
+       says that snprintf() fails with errno = EOVERFLOW in this case, but
+       that's only because snprintf() returns an 'int'.  This function does
+       not have this limitation.  */
+    return result;
+
+#if USE_SNPRINTF
+  overflow:
+    errno = EOVERFLOW;
+    goto fail_with_errno;
+#endif
+
+  out_of_memory:
+    errno = ENOMEM;
+    goto fail_with_errno;
+
+#if ENABLE_UNISTDIO || ((!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || ((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T && !WIDE_CHAR_VERSION) || (NEED_WPRINTF_DIRECTIVE_C && WIDE_CHAR_VERSION)
+  fail_with_EILSEQ:
+    errno = EILSEQ;
+    goto fail_with_errno;
+#endif
+
+  fail_with_errno:
+    if (result != resultbuf)
+      free (result);
+    if (buf_malloced != NULL)
+      free (buf_malloced);
+    CLEANUP ();
+    return NULL;
+  }
+
+ out_of_memory_1:
+  errno = ENOMEM;
+  goto fail_1_with_errno;
+
+ fail_1_with_EINVAL:
+  errno = EINVAL;
+  goto fail_1_with_errno;
+
+ fail_1_with_errno:
+  CLEANUP ();
+  return NULL;
+}
+
+#undef MAX_ROOM_NEEDED
+#undef TCHARS_PER_DCHAR
+#undef SNPRINTF
+#undef USE_SNPRINTF
+#undef DCHAR_SET
+#undef DCHAR_CPY
+#undef PRINTF_PARSE
+#undef DIRECTIVES
+#undef DIRECTIVE
+#undef DCHAR_IS_TCHAR
+#undef TCHAR_T
+#undef DCHAR_T
+#undef FCHAR_T
+#undef VASNPRINTF
deleted file mode 120000 (symlink)
index 5524f2f95f21758774366ddae7ac18eb3d86c776..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/vasnprintf.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7ed9145c03e67ad6b16c03fe1a348493c8c6fdcb
--- /dev/null
@@ -0,0 +1,77 @@
+/* vsprintf with automatic memory allocation.
+   Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _VASNPRINTF_H
+#define _VASNPRINTF_H
+
+/* This file uses _GL_ATTRIBUTE_FORMAT.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get va_list.  */
+#include <stdarg.h>
+
+/* Get size_t.  */
+#include <stddef.h>
+
+/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD.  */
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Write formatted output to a string dynamically allocated with malloc().
+   You can pass a preallocated buffer for the result in RESULTBUF and its
+   size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
+   If successful, return the address of the string (this may be = RESULTBUF
+   if no dynamic memory allocation was necessary) and set *LENGTHP to the
+   number of resulting bytes, excluding the trailing NUL.  Upon error, set
+   errno and return NULL.
+
+   When dynamic memory allocation occurs, the preallocated buffer is left
+   alone (with possibly modified contents).  This makes it possible to use
+   a statically allocated or stack-allocated buffer, like this:
+
+          char buf[100];
+          size_t len = sizeof (buf);
+          char *output = vasnprintf (buf, &len, format, args);
+          if (output == NULL)
+            ... error handling ...;
+          else
+            {
+              ... use the output string ...;
+              if (output != buf)
+                free (output);
+            }
+  */
+#if REPLACE_VASNPRINTF
+# define asnprintf rpl_asnprintf
+# define vasnprintf rpl_vasnprintf
+#endif
+extern char * asnprintf (char *restrict resultbuf, size_t *lengthp,
+                         const char *format, ...)
+       _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 4));
+extern char * vasnprintf (char *restrict resultbuf, size_t *lengthp,
+                          const char *format, va_list args)
+       _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 0));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _VASNPRINTF_H */
deleted file mode 120000 (symlink)
index 858be2d5c769a888919e46f36624294a5ab4b538..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/vasprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e52aaca5864ad30105aa4adef9b2fdba8bab5294
--- /dev/null
@@ -0,0 +1,50 @@
+/* Formatted output to strings.
+   Copyright (C) 1999, 2002, 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#ifdef IN_LIBASPRINTF
+# include "vasprintf.h"
+#else
+# include <stdio.h>
+#endif
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "vasnprintf.h"
+
+int
+vasprintf (char **resultp, const char *format, va_list args)
+{
+  size_t length;
+  char *result = vasnprintf (NULL, &length, format, args);
+  if (result == NULL)
+    return -1;
+
+  if (length > INT_MAX)
+    {
+      free (result);
+      errno = EOVERFLOW;
+      return -1;
+    }
+
+  *resultp = result;
+  /* Return the number of resulting bytes, excluding the trailing NUL.  */
+  return length;
+}
deleted file mode 120000 (symlink)
index c04b3187cb63d3ebbc991cb2eb17eceda854e0a6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/verify.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..08268c2498f6d25948749dd742e7759d66b241f2
--- /dev/null
@@ -0,0 +1,375 @@
+/* Compile-time assert-like macros.
+
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
+
+#ifndef _GL_VERIFY_H
+#define _GL_VERIFY_H
+
+
+/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC)
+   works as per C11.  This is supported by GCC 4.6.0+ and by clang 4+.
+
+   Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as
+   per C23.  This is supported by GCC 9.1+.
+
+   Support compilers claiming conformance to the relevant standard,
+   and also support GCC when not pedantic.  If we were willing to slow
+   'configure' down we could also use it with other compilers, but
+   since this affects only the quality of diagnostics, why bother?  */
+#ifndef __cplusplus
+# if (201112 <= __STDC_VERSION__ \
+      || (!defined __STRICT_ANSI__ \
+          && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__)))
+#  define _GL_HAVE__STATIC_ASSERT 1
+# endif
+# if (202311 <= __STDC_VERSION__ \
+      || (!defined __STRICT_ANSI__ && 9 <= __GNUC__))
+#  define _GL_HAVE__STATIC_ASSERT1 1
+# endif
+#endif
+
+/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
+   system headers, defines a conflicting _Static_assert that is no
+   better than ours; override it.  */
+#ifndef _GL_HAVE__STATIC_ASSERT
+# include <stddef.h>
+# undef _Static_assert
+#endif
+
+/* Each of these macros verifies that its argument R is nonzero.  To
+   be portable, R should be an integer constant expression.  Unlike
+   assert (R), there is no run-time overhead.
+
+   If _Static_assert works, verify (R) uses it directly.  Similarly,
+   _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct
+   that is an operand of sizeof.
+
+   The code below uses several ideas for C++ compilers, and for C
+   compilers that do not support _Static_assert:
+
+   * The first step is ((R) ? 1 : -1).  Given an expression R, of
+     integral or boolean or floating-point type, this yields an
+     expression of integral type, whose value is later verified to be
+     constant and nonnegative.
+
+   * Next this expression W is wrapped in a type
+     struct _gl_verify_type {
+       unsigned int _gl_verify_error_if_negative: W;
+     }.
+     If W is negative, this yields a compile-time error.  No compiler can
+     deal with a bit-field of negative size.
+
+     One might think that an array size check would have the same
+     effect, that is, that the type struct { unsigned int dummy[W]; }
+     would work as well.  However, inside a function, some compilers
+     (such as C++ compilers and GNU C) allow local parameters and
+     variables inside array size expressions.  With these compilers,
+     an array size check would not properly diagnose this misuse of
+     the verify macro:
+
+       void function (int n) { verify (n < 0); }
+
+   * For the verify macro, the struct _gl_verify_type will need to
+     somehow be embedded into a declaration.  To be portable, this
+     declaration must declare an object, a constant, a function, or a
+     typedef name.  If the declared entity uses the type directly,
+     such as in
+
+       struct dummy {...};
+       typedef struct {...} dummy;
+       extern struct {...} *dummy;
+       extern void dummy (struct {...} *);
+       extern struct {...} *dummy (void);
+
+     two uses of the verify macro would yield colliding declarations
+     if the entity names are not disambiguated.  A workaround is to
+     attach the current line number to the entity name:
+
+       #define _GL_CONCAT0(x, y) x##y
+       #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
+       extern struct {...} * _GL_CONCAT (dummy, __LINE__);
+
+     But this has the problem that two invocations of verify from
+     within the same macro would collide, since the __LINE__ value
+     would be the same for both invocations.  (The GCC __COUNTER__
+     macro solves this problem, but is not portable.)
+
+     A solution is to use the sizeof operator.  It yields a number,
+     getting rid of the identity of the type.  Declarations like
+
+       extern int dummy [sizeof (struct {...})];
+       extern void dummy (int [sizeof (struct {...})]);
+       extern int (*dummy (void)) [sizeof (struct {...})];
+
+     can be repeated.
+
+   * Should the implementation use a named struct or an unnamed struct?
+     Which of the following alternatives can be used?
+
+       extern int dummy [sizeof (struct {...})];
+       extern int dummy [sizeof (struct _gl_verify_type {...})];
+       extern void dummy (int [sizeof (struct {...})]);
+       extern void dummy (int [sizeof (struct _gl_verify_type {...})]);
+       extern int (*dummy (void)) [sizeof (struct {...})];
+       extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})];
+
+     In the second and sixth case, the struct type is exported to the
+     outer scope; two such declarations therefore collide.  GCC warns
+     about the first, third, and fourth cases.  So the only remaining
+     possibility is the fifth case:
+
+       extern int (*dummy (void)) [sizeof (struct {...})];
+
+   * GCC warns about duplicate declarations of the dummy function if
+     -Wredundant-decls is used.  GCC 4.3 and later have a builtin
+     __COUNTER__ macro that can let us generate unique identifiers for
+     each dummy function, to suppress this warning.
+
+   * This implementation exploits the fact that older versions of GCC,
+     which do not support _Static_assert, also do not warn about the
+     last declaration mentioned above.
+
+   * GCC warns if -Wnested-externs is enabled and 'verify' is used
+     within a function body; but inside a function, you can always
+     arrange to use verify_expr instead.
+
+   * In C++, any struct definition inside sizeof is invalid.
+     Use a template type to work around the problem.  */
+
+/* Concatenate two preprocessor tokens.  */
+#define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
+#define _GL_CONCAT0(x, y) x##y
+
+/* _GL_COUNTER is an integer, preferably one that changes each time we
+   use it.  Use __COUNTER__ if it works, falling back on __LINE__
+   otherwise.  __LINE__ isn't perfect, but it's better than a
+   constant.  */
+#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
+# define _GL_COUNTER __COUNTER__
+#else
+# define _GL_COUNTER __LINE__
+#endif
+
+/* Generate a symbol with the given prefix, making it unique if
+   possible.  */
+#define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
+
+/* Verify requirement R at compile-time, as an integer constant expression
+   that returns 1.  If R is false, fail at compile-time, preferably
+   with a diagnostic that includes the string-literal DIAGNOSTIC.  */
+
+#define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
+   (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
+
+#ifdef __cplusplus
+# if !GNULIB_defined_struct__gl_verify_type
+template <int w>
+  struct _gl_verify_type {
+    unsigned int _gl_verify_error_if_negative: w;
+  };
+#  define GNULIB_defined_struct__gl_verify_type 1
+# endif
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+    _gl_verify_type<(R) ? 1 : -1>
+#elif defined _GL_HAVE__STATIC_ASSERT
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+    struct { \
+      _Static_assert (R, DIAGNOSTIC); \
+      int _gl_dummy; \
+    }
+#else
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+    struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
+#endif
+
+/* Verify requirement R at compile-time, as a declaration without a
+   trailing ';'.  If R is false, fail at compile-time.
+
+   This macro requires three or more arguments but uses at most the first
+   two, so that the _Static_assert macro optionally defined below supports
+   both the C11 two-argument syntax and the C23 one-argument syntax.
+
+   Unfortunately, unlike C11, this implementation must appear as an
+   ordinary declaration, and cannot appear inside struct { ... }.  */
+
+#if 202311 <= __STDC_VERSION__ || 200410 <= __cpp_static_assert
+# define _GL_VERIFY(R, DIAGNOSTIC, ...) static_assert (R, DIAGNOSTIC)
+#elif defined _GL_HAVE__STATIC_ASSERT
+# define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC)
+#else
+# define _GL_VERIFY(R, DIAGNOSTIC, ...) \
+    extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
+      [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
+# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+#  pragma GCC diagnostic ignored "-Wnested-externs"
+# endif
+#endif
+
+/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h.  */
+#ifdef _GL_STATIC_ASSERT_H
+/* Define _Static_assert if needed.  */
+/* With clang ≥ 3.8.0 in C++ mode, _Static_assert already works and accepts
+   1 or 2 arguments.  We better don't override it, because clang's standard
+   C++ library uses static_assert inside classes in several places, and our
+   replacement via _GL_VERIFY does not work in these contexts.  */
+# if (defined __cplusplus && defined __clang__ \
+      && (4 <= __clang_major__ + (8 <= __clang_minor__)))
+#  if 5 <= __clang_major__
+/* Avoid "warning: 'static_assert' with no message is a C++17 extension".  */
+#   pragma clang diagnostic ignored "-Wc++17-extensions"
+#  else
+/* Avoid "warning: static_assert with no message is a C++1z extension".  */
+#   pragma clang diagnostic ignored "-Wc++1z-extensions"
+#  endif
+# elif !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert
+#  if !defined _MSC_VER || defined __clang__
+#   define _Static_assert(...) \
+      _GL_VERIFY (__VA_ARGS__, "static assertion failed", -)
+#  else
+#   if defined __cplusplus && _MSC_VER >= 1910
+     /* In MSVC 14.1 or newer, static_assert accepts one or two arguments,
+        but _Static_assert is not defined.  */
+#    define _Static_assert static_assert
+#   else
+     /* Work around MSVC preprocessor incompatibility with ISO C; see
+        <https://stackoverflow.com/questions/5134523/>.  */
+#    define _Static_assert(R, ...) \
+       _GL_VERIFY ((R), "static assertion failed", -)
+#   endif
+#  endif
+# endif
+/* Define static_assert if needed.  */
+# if (!defined static_assert \
+      && __STDC_VERSION__ < 202311 \
+      && (!defined __cplusplus \
+          || (__cpp_static_assert < 201411 \
+              && __GNUG__ < 6 && __clang_major__ < 6 && _MSC_VER < 1910)))
+#  if defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__
+/* MSVC 14 in C++ mode supports the two-arguments static_assert but not
+   the one-argument static_assert, and it does not support _Static_assert.
+   We have to play preprocessor tricks to distinguish the two cases.
+   Since the MSVC preprocessor is not ISO C compliant (see above),.
+   the solution is specific to MSVC.  */
+#   define _GL_EXPAND(x) x
+#   define _GL_SA1(a1) static_assert ((a1), "static assertion failed")
+#   define _GL_SA2 static_assert
+#   define _GL_SA3 static_assert
+#   define _GL_SA_PICK(x1,x2,x3,x4,...) x4
+#   define static_assert(...) _GL_EXPAND(_GL_SA_PICK(__VA_ARGS__,_GL_SA3,_GL_SA2,_GL_SA1)) (__VA_ARGS__)
+/* Avoid "fatal error C1189: #error:  The C++ Standard Library forbids macroizing keywords."  */
+#   define _ALLOW_KEYWORD_MACROS 1
+#  else
+#   define static_assert _Static_assert /* C11 requires this #define. */
+#  endif
+# endif
+#endif
+
+/* @assert.h omit start@  */
+
+#if defined __clang_major__ && __clang_major__ < 5
+# define _GL_HAS_BUILTIN_TRAP 0
+#elif 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))
+# define _GL_HAS_BUILTIN_TRAP 1
+#elif defined __has_builtin
+# define _GL_HAS_BUILTIN_TRAP __has_builtin (__builtin_trap)
+#else
+# define _GL_HAS_BUILTIN_TRAP 0
+#endif
+
+#ifndef _GL_HAS_BUILTIN_UNREACHABLE
+# if defined __clang_major__ && __clang_major__ < 5
+#  define _GL_HAS_BUILTIN_UNREACHABLE 0
+# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__)
+#  define _GL_HAS_BUILTIN_UNREACHABLE 1
+# elif defined __has_builtin
+#  define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable)
+# else
+#  define _GL_HAS_BUILTIN_UNREACHABLE 0
+# endif
+#endif
+
+/* Each of these macros verifies that its argument R is nonzero.  To
+   be portable, R should be an integer constant expression.  Unlike
+   assert (R), there is no run-time overhead.
+
+   There are two macros, since no single macro can be used in all
+   contexts in C.  verify_expr (R, E) is for scalar contexts, including
+   integer constant expression contexts.  verify (R) is for declaration
+   contexts, e.g., the top level.  */
+
+/* Verify requirement R at compile-time.  Return the value of the
+   expression E.  */
+
+#define verify_expr(R, E) \
+   (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
+
+/* Verify requirement R at compile-time, as a declaration without a
+   trailing ';'.  verify (R) acts like static_assert (R) except that
+   it is portable to C11/C++14 and earlier, it can issue better
+   diagnostics, and its name is shorter and may be more convenient.  */
+
+#ifdef __PGI
+/* PGI barfs if R is long.  */
+# define verify(R) _GL_VERIFY (R, "verify (...)", -)
+#else
+# define verify(R) _GL_VERIFY (R, "verify (" #R ")", -)
+#endif
+
+/* Assume that R always holds.  Behavior is undefined if R is false,
+   fails to evaluate, or has side effects.
+
+   'assume (R)' is a directive from the programmer telling the
+   compiler that R is true so the compiler needn't generate code to
+   test R.  This is why 'assume' is in verify.h: it's related to
+   static checking (in this case, static checking done by the
+   programmer), not dynamic checking.
+
+   'assume (R)' can affect compilation of all the code, not just code
+   that happens to be executed after the assume (R) is "executed".
+   For example, if the code mistakenly does 'assert (R); assume (R);'
+   the compiler is entitled to optimize away the 'assert (R)'.
+
+   Although assuming R can help a compiler generate better code or
+   diagnostics, performance can suffer if R uses hard-to-optimize
+   features such as function calls not inlined by the compiler.
+
+   Avoid Clang's __builtin_assume, as it breaks GNU Emacs master
+   as of 2020-08-23T21:09:49Z!eggert@cs.ucla.edu; see
+   <https://bugs.gnu.org/43152#71>.  It's not known whether this breakage
+   is a Clang bug or an Emacs bug; play it safe for now.  */
+
+#if _GL_HAS_BUILTIN_UNREACHABLE
+# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
+#elif 1200 <= _MSC_VER
+# define assume(R) __assume (R)
+#elif 202311 <= __STDC_VERSION__
+# include <stddef.h>
+# define assume(R) ((R) ? (void) 0 : unreachable ())
+#elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP
+  /* Doing it this way helps various packages when configured with
+     --enable-gcc-warnings, which compiles with -Dlint.  It's nicer
+     if 'assume' silences warnings with GCC 3.4 through GCC 4.4.7 (2012).  */
+# define assume(R) ((R) ? (void) 0 : __builtin_trap ())
+#else
+  /* Some older tools grok NOTREACHED, e.g., Oracle Studio 12.6 (2017).  */
+# define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0)
+#endif
+
+/* @assert.h omit end@  */
+
+#endif
deleted file mode 120000 (symlink)
index cb1e964698cfad5066c00880209c9238877d452d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/verror.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..69f606c0a4bae78343e4b29788f3f46380d15042
--- /dev/null
@@ -0,0 +1,80 @@
+/* va_list error handler for noninteractive utilities
+   Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "verror.h"
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include <error.h>
+#include "xvasprintf.h"
+
+#if ENABLE_NLS
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+#endif
+
+#ifndef _
+# define _(String) String
+#endif
+
+/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
+   if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+   If STATUS is nonzero, terminate the program with 'exit (STATUS)'.
+   Use the globals error_print_progname and error_message_count similarly
+   to error().  */
+void
+verror (int status, int errnum, const char *format, va_list args)
+{
+  verror_at_line (status, errnum, NULL, 0, format, args);
+}
+
+/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
+   if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+   If STATUS is nonzero, terminate the program with 'exit (STATUS)'.
+   If FNAME is not NULL, prepend the message with "FNAME:LINENO:".
+   Use the globals error_print_progname, error_message_count, and
+   error_one_per_line similarly to error_at_line().  */
+void
+verror_at_line (int status, int errnum, const char *file,
+                unsigned int line_number, const char *format, va_list args)
+{
+  char *message = xvasprintf (format, args);
+  if (message)
+    {
+      /* Until https://sourceware.org/bugzilla/show_bug.cgi?id=2997 is fixed,
+         glibc violates GNU Coding Standards when the file argument to
+         error_at_line is NULL.  */
+      if (file)
+        error_at_line (status, errnum, file, line_number, "%s", message);
+      else
+        error (status, errnum, "%s", message);
+    }
+  else
+    {
+      /* EOVERFLOW, EINVAL, and EILSEQ from xvasprintf are signs of
+         serious programmer errors.  */
+      error (0, errno, _("unable to display error message"));
+      abort ();
+    }
+  free (message);
+}
deleted file mode 120000 (symlink)
index 51fb07b61d9a947825e3251b9621c80d398732dc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/verror.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..deeec966fdf632ab05478c021cdc45d09f66fe23
--- /dev/null
@@ -0,0 +1,60 @@
+/* Declaration for va_list error-reporting function
+   Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _VERROR_H
+#define _VERROR_H 1
+
+/* This file uses _GL_ATTRIBUTE_FORMAT.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdarg.h>
+
+/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD.  */
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
+   if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+   If STATUS is nonzero, terminate the program with 'exit (STATUS)'.
+   Use the globals error_print_progname and error_message_count similarly
+   to error().  */
+
+extern void verror (int __status, int __errnum, const char *__format,
+                    va_list __args)
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 0));
+
+/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
+   if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+   If STATUS is nonzero, terminate the program with 'exit (STATUS)'.
+   If FNAME is not NULL, prepend the message with "FNAME:LINENO:".
+   Use the globals error_print_progname, error_message_count, and
+   error_one_per_line similarly to error_at_line().  */
+
+extern void verror_at_line (int __status, int __errnum, const char *__fname,
+                            unsigned int __lineno, const char *__format,
+                            va_list __args)
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 5, 0));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* verror.h */
deleted file mode 120000 (symlink)
index fb73711cb64818087a3fc6ce7e16d713e2a2ec57..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/version-etc-fsf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..894b1c3fcd1de5fdf423818a7edb4bc91c4c38e3
--- /dev/null
@@ -0,0 +1,30 @@
+/* Variable with FSF copyright information, for version-etc.
+   Copyright (C) 1999-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+/* Specification.  */
+#include "version-etc.h"
+
+/* Default copyright goes to the FSF. */
+
+const char version_etc_copyright[] =
+  /* Do *not* mark this string for translation.  %s is a copyright
+     symbol suitable for this locale, and %d is the copyright
+     year.  */
+  "Copyright %s %d Free Software Foundation, Inc.";
deleted file mode 120000 (symlink)
index e9903fddcb7070c11c950ff4cc584ff5beb6dcc1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/version-etc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..45d0c93cf1c8343ed65825e23f9c24d5e4607b63
--- /dev/null
@@ -0,0 +1,262 @@
+/* Print --version and bug-reporting information in a consistent format.
+   Copyright (C) 1999-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+/* Specification.  */
+#include "version-etc.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+/* If you use AM_INIT_AUTOMAKE's no-define option,
+   PACKAGE is not defined.  Use PACKAGE_TARNAME instead.  */
+#if ! defined PACKAGE && defined PACKAGE_TARNAME
+# define PACKAGE PACKAGE_TARNAME
+#endif
+
+enum { COPYRIGHT_YEAR = 2024 };
+
+/* The three functions below display the --version information the
+   standard way.
+
+   If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
+   the program.  The formats are therefore:
+
+   PACKAGE VERSION
+
+   or
+
+   COMMAND_NAME (PACKAGE) VERSION.
+
+   The functions differ in the way they are passed author names. */
+
+/* Display the --version information the standard way.
+
+   Author names are given in the array AUTHORS. N_AUTHORS is the
+   number of elements in the array. */
+void
+version_etc_arn (FILE *stream,
+                 const char *command_name, const char *package,
+                 const char *version,
+                 const char * const * authors, size_t n_authors)
+{
+  if (command_name)
+    fprintf (stream, "%s (%s) %s\n", command_name, package, version);
+  else
+    fprintf (stream, "%s %s\n", package, version);
+
+#ifdef PACKAGE_PACKAGER
+# ifdef PACKAGE_PACKAGER_VERSION
+  fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER,
+           PACKAGE_PACKAGER_VERSION);
+# else
+  fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER);
+# endif
+#endif
+
+  /* TRANSLATORS: Translate "(C)" to the copyright symbol
+     (C-in-a-circle), if this symbol is available in the user's
+     locale.  Otherwise, do not translate "(C)"; leave it as-is.  */
+  fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR);
+
+  fputs ("\n", stream);
+
+  /* TRANSLATORS: The %s placeholder is the web address of the GPL license.  */
+  fprintf (stream, _("\
+License GPLv3+: GNU GPL version 3 or later <%s>.\n\
+This is free software: you are free to change and redistribute it.\n\
+There is NO WARRANTY, to the extent permitted by law.\n\
+"),
+           "https://gnu.org/licenses/gpl.html");
+
+  fputs ("\n", stream);
+
+  switch (n_authors)
+    {
+    case 0:
+      /* No authors are given.  The caller should output authorship
+         info after calling this function.  */
+      break;
+    case 1:
+      /* TRANSLATORS: %s denotes an author name.  */
+      fprintf (stream, _("Written by %s.\n"), authors[0]);
+      break;
+    case 2:
+      /* TRANSLATORS: Each %s denotes an author name.  */
+      fprintf (stream, _("Written by %s and %s.\n"), authors[0], authors[1]);
+      break;
+    case 3:
+      /* TRANSLATORS: Each %s denotes an author name.  */
+      fprintf (stream, _("Written by %s, %s, and %s.\n"),
+               authors[0], authors[1], authors[2]);
+      break;
+    case 4:
+      /* TRANSLATORS: Each %s denotes an author name.
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+      fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"),
+               authors[0], authors[1], authors[2], authors[3]);
+      break;
+    case 5:
+      /* TRANSLATORS: Each %s denotes an author name.
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+      fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"),
+               authors[0], authors[1], authors[2], authors[3], authors[4]);
+      break;
+    case 6:
+      /* TRANSLATORS: Each %s denotes an author name.
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+      fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5]);
+      break;
+    case 7:
+      /* TRANSLATORS: Each %s denotes an author name.
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+      fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5], authors[6]);
+      break;
+    case 8:
+      /* TRANSLATORS: Each %s denotes an author name.
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+      fprintf (stream, _("\
+Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
+                authors[0], authors[1], authors[2], authors[3], authors[4],
+                authors[5], authors[6], authors[7]);
+      break;
+    case 9:
+      /* TRANSLATORS: Each %s denotes an author name.
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+      fprintf (stream, _("\
+Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5], authors[6], authors[7], authors[8]);
+      break;
+    default:
+      /* 10 or more authors.  Use an abbreviation, since the human reader
+         will probably not want to read the entire list anyway.  */
+      /* TRANSLATORS: Each %s denotes an author name.
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+      fprintf (stream, _("\
+Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
+                authors[0], authors[1], authors[2], authors[3], authors[4],
+                authors[5], authors[6], authors[7], authors[8]);
+      break;
+    }
+}
+
+/* Display the --version information the standard way.  See the initial
+   comment to this module, for more information.
+
+   Author names are given in the NULL-terminated array AUTHORS. */
+void
+version_etc_ar (FILE *stream,
+                const char *command_name, const char *package,
+                const char *version, const char * const * authors)
+{
+  size_t n_authors;
+
+  for (n_authors = 0; authors[n_authors]; n_authors++)
+    ;
+  version_etc_arn (stream, command_name, package, version, authors, n_authors);
+}
+
+/* Display the --version information the standard way.  See the initial
+   comment to this module, for more information.
+
+   Author names are given in the NULL-terminated va_list AUTHORS. */
+void
+version_etc_va (FILE *stream,
+                const char *command_name, const char *package,
+                const char *version, va_list authors)
+{
+  size_t n_authors;
+  const char *authtab[10];
+
+  for (n_authors = 0;
+       n_authors < 10
+         && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
+       n_authors++)
+    ;
+  version_etc_arn (stream, command_name, package, version,
+                   authtab, n_authors);
+}
+
+
+/* Display the --version information the standard way.
+
+   If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
+   the program.  The formats are therefore:
+
+   PACKAGE VERSION
+
+   or
+
+   COMMAND_NAME (PACKAGE) VERSION.
+
+   The authors names are passed as separate arguments, with an additional
+   NULL argument at the end.  */
+void
+version_etc (FILE *stream,
+             const char *command_name, const char *package,
+             const char *version, /* const char *author1, ...*/ ...)
+{
+  va_list authors;
+
+  va_start (authors, version);
+  version_etc_va (stream, command_name, package, version, authors);
+  va_end (authors);
+}
+
+void
+emit_bug_reporting_address (void)
+{
+  fputs ("\n", stdout);
+  /* TRANSLATORS: The placeholder indicates the bug-reporting address
+     for this package.  Please add _another line_ saying
+     "Report translation bugs to <...>\n" with the address for translation
+     bugs (typically your translation team's web or email address).  */
+  printf (_("Report bugs to: %s\n"), PACKAGE_BUGREPORT);
+#ifdef PACKAGE_PACKAGER_BUG_REPORTS
+  printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER,
+          PACKAGE_PACKAGER_BUG_REPORTS);
+#endif
+#ifdef PACKAGE_URL
+  printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
+#else
+  printf (_("%s home page: <%s>\n"),
+          PACKAGE_NAME, "https://www.gnu.org/software/" PACKAGE "/");
+#endif
+  printf (_("General help using GNU software: <%s>\n"),
+          "https://www.gnu.org/gethelp/");
+}
deleted file mode 120000 (symlink)
index 2ebfd0984ae43fb70bc64db85c5932e2135fd80f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/version-etc.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..505d2fa7fd9abfe4cae37d3b2dad435e55a18d84
--- /dev/null
@@ -0,0 +1,83 @@
+/* Print --version and bug-reporting information in a consistent format.
+   Copyright (C) 1999, 2003, 2005, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering. */
+
+#ifndef VERSION_ETC_H
+# define VERSION_ETC_H 1
+
+/* This file uses _GL_ATTRIBUTE_SENTINEL.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include <stdarg.h>
+# include <stdio.h>
+
+# ifdef __cplusplus
+extern "C"
+{
+# endif
+
+extern const char version_etc_copyright[];
+
+/* The three functions below display the --version information in the
+   standard way: command and package names, package version, followed
+   by a short GPLv3+ notice and a list of up to 10 author names.
+
+   If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
+   the program.  The formats are therefore:
+
+   PACKAGE VERSION
+
+   or
+
+   COMMAND_NAME (PACKAGE) VERSION.
+
+   The functions differ in the way they are passed author names: */
+
+/* N_AUTHORS names are supplied in array AUTHORS.  */
+extern void version_etc_arn (FILE *stream,
+                             const char *command_name, const char *package,
+                             const char *version,
+                             const char * const * authors, size_t n_authors);
+
+/* Names are passed in the NULL-terminated array AUTHORS.  */
+extern void version_etc_ar (FILE *stream,
+                            const char *command_name, const char *package,
+                            const char *version, const char * const * authors);
+
+/* Names are passed in the NULL-terminated va_list.  */
+extern void version_etc_va (FILE *stream,
+                            const char *command_name, const char *package,
+                            const char *version, va_list authors);
+
+/* Names are passed as separate arguments, with an additional
+   NULL argument at the end.  */
+extern void version_etc (FILE *stream,
+                         const char *command_name, const char *package,
+                         const char *version,
+                         /* const char *author1, ..., NULL */ ...)
+  _GL_ATTRIBUTE_SENTINEL ((0));
+
+/* Display the usual "Report bugs to" stanza.  */
+extern void emit_bug_reporting_address (void);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif /* VERSION_ETC_H */
deleted file mode 120000 (symlink)
index 8cf454f36daf55871be605cda1751df03673d3a4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/w32sock.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..166a5f777e6908489802eb62bb50c7df4ba9b78b
--- /dev/null
@@ -0,0 +1,140 @@
+/* w32sock.h --- internal auxiliary functions for Windows socket functions
+
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paolo Bonzini */
+
+#include <errno.h>
+
+/* Get O_RDWR and O_BINARY.  */
+#include <fcntl.h>
+
+/* Get _open_osfhandle().  */
+#include <io.h>
+
+/* Get _get_osfhandle().  */
+#if GNULIB_MSVC_NOTHROW
+# include "msvc-nothrow.h"
+#else
+# include <io.h>
+#endif
+
+#define FD_TO_SOCKET(fd)   ((SOCKET) _get_osfhandle ((fd)))
+#define SOCKET_TO_FD(fh)   (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY))
+
+static inline void
+set_winsock_errno (void)
+{
+  int err = WSAGetLastError ();
+
+  /* Map some WSAE* errors to the runtime library's error codes.  */
+  switch (err)
+    {
+    case WSA_INVALID_HANDLE:
+      errno = EBADF;
+      break;
+    case WSA_NOT_ENOUGH_MEMORY:
+      errno = ENOMEM;
+      break;
+    case WSA_INVALID_PARAMETER:
+      errno = EINVAL;
+      break;
+    case WSAENAMETOOLONG:
+      errno = ENAMETOOLONG;
+      break;
+    case WSAENOTEMPTY:
+      errno = ENOTEMPTY;
+      break;
+    case WSAEWOULDBLOCK:
+      errno = EWOULDBLOCK;
+      break;
+    case WSAEINPROGRESS:
+      errno = EINPROGRESS;
+      break;
+    case WSAEALREADY:
+      errno = EALREADY;
+      break;
+    case WSAENOTSOCK:
+      errno = ENOTSOCK;
+      break;
+    case WSAEDESTADDRREQ:
+      errno = EDESTADDRREQ;
+      break;
+    case WSAEMSGSIZE:
+      errno = EMSGSIZE;
+      break;
+    case WSAEPROTOTYPE:
+      errno = EPROTOTYPE;
+      break;
+    case WSAENOPROTOOPT:
+      errno = ENOPROTOOPT;
+      break;
+    case WSAEPROTONOSUPPORT:
+      errno = EPROTONOSUPPORT;
+      break;
+    case WSAEOPNOTSUPP:
+      errno = EOPNOTSUPP;
+      break;
+    case WSAEAFNOSUPPORT:
+      errno = EAFNOSUPPORT;
+      break;
+    case WSAEADDRINUSE:
+      errno = EADDRINUSE;
+      break;
+    case WSAEADDRNOTAVAIL:
+      errno = EADDRNOTAVAIL;
+      break;
+    case WSAENETDOWN:
+      errno = ENETDOWN;
+      break;
+    case WSAENETUNREACH:
+      errno = ENETUNREACH;
+      break;
+    case WSAENETRESET:
+      errno = ENETRESET;
+      break;
+    case WSAECONNABORTED:
+      errno = ECONNABORTED;
+      break;
+    case WSAECONNRESET:
+      errno = ECONNRESET;
+      break;
+    case WSAENOBUFS:
+      errno = ENOBUFS;
+      break;
+    case WSAEISCONN:
+      errno = EISCONN;
+      break;
+    case WSAENOTCONN:
+      errno = ENOTCONN;
+      break;
+    case WSAETIMEDOUT:
+      errno = ETIMEDOUT;
+      break;
+    case WSAECONNREFUSED:
+      errno = ECONNREFUSED;
+      break;
+    case WSAELOOP:
+      errno = ELOOP;
+      break;
+    case WSAEHOSTUNREACH:
+      errno = EHOSTUNREACH;
+      break;
+    default:
+      errno = (err > 10000 && err < 10025) ? err - 10000 : err;
+      break;
+    }
+}
deleted file mode 120000 (symlink)
index 2141d9af03ca04725b54396370a3a6d62606ffab..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/warn-on-use.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8f4d40dcbebdef9ff00d64d988396745836f59b6
--- /dev/null
@@ -0,0 +1,149 @@
+/* A C macro for emitting warnings if a function is used.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 2 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
+   for FUNCTION which will then trigger a compiler warning containing
+   the text of "literal string" anywhere that function is called, if
+   supported by the compiler.  If the compiler does not support this
+   feature, the macro expands to an unused extern declaration.
+
+   _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
+   attribute used in _GL_WARN_ON_USE.  If the compiler does not support
+   this feature, it expands to empty.
+
+   These macros are useful for marking a function as a potential
+   portability trap, with the intent that "literal string" include
+   instructions on the replacement function that should be used
+   instead.
+   _GL_WARN_ON_USE is for functions with 'extern' linkage.
+   _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
+   linkage.
+
+   However, one of the reasons that a function is a portability trap is
+   if it has the wrong signature.  Declaring FUNCTION with a different
+   signature in C is a compilation error, so this macro must use the
+   same type as any existing declaration so that programs that avoid
+   the problematic FUNCTION do not fail to compile merely because they
+   included a header that poisoned the function.  But this implies that
+   _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
+   have a declaration.  Use of this macro implies that there must not
+   be any other macro hiding the declaration of FUNCTION; but
+   undefining FUNCTION first is part of the poisoning process anyway
+   (although for symbols that are provided only via a macro, the result
+   is a compilation error rather than a warning containing
+   "literal string").  Also note that in C++, it is only safe to use if
+   FUNCTION has no overloads.
+
+   For an example, it is possible to poison 'getline' by:
+   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
+     [getline]) in configure.ac, which potentially defines
+     HAVE_RAW_DECL_GETLINE
+   - adding this code to a header that wraps the system <stdio.h>:
+     #undef getline
+     #if HAVE_RAW_DECL_GETLINE
+     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
+       "not universally present; use the gnulib module getline");
+     #endif
+
+   It is not possible to directly poison global variables.  But it is
+   possible to write a wrapper accessor function, and poison that
+   (less common usage, like &environ, will cause a compilation error
+   rather than issue the nice warning, but the end result of informing
+   the developer about their portability problem is still achieved):
+     #if HAVE_RAW_DECL_ENVIRON
+     static char ***
+     rpl_environ (void) { return &environ; }
+     _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
+     # undef environ
+     # define environ (*rpl_environ ())
+     #endif
+   or better (avoiding contradictory use of 'static' and 'extern'):
+     #if HAVE_RAW_DECL_ENVIRON
+     static char ***
+     _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
+     rpl_environ (void) { return &environ; }
+     # undef environ
+     # define environ (*rpl_environ ())
+     #endif
+   */
+#ifndef _GL_WARN_ON_USE
+
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
+#  define _GL_WARN_ON_USE(function, message) \
+_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
+#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
+  __attribute__ ((__warning__ (message)))
+# elif __clang_major__ >= 4
+/* Another compiler attribute is available in clang.  */
+#  define _GL_WARN_ON_USE(function, message) \
+_GL_WARN_EXTERN_C __typeof__ (function) function \
+  __attribute__ ((__diagnose_if__ (1, message, "warning")))
+#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
+  __attribute__ ((__diagnose_if__ (1, message, "warning")))
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+/* Verify the existence of the function.  */
+#  define _GL_WARN_ON_USE(function, message) \
+_GL_WARN_EXTERN_C __typeof__ (function) function
+#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
+# else /* Unsupported.  */
+#  define _GL_WARN_ON_USE(function, message) \
+_GL_WARN_EXTERN_C int _gl_warn_on_use
+#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
+# endif
+#endif
+
+/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
+   is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
+   function is declared with the given prototype, consisting of return type,
+   parameters, and attributes.
+   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
+   not work in this case.  */
+#ifndef _GL_WARN_ON_USE_CXX
+# if !defined __cplusplus
+#  define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+     _GL_WARN_ON_USE (function, msg)
+# else
+#  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
+#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+extern rettype_gcc function parameters_and_attributes \
+  __attribute__ ((__warning__ (msg)))
+#  elif __clang_major__ >= 4
+/* Another compiler attribute is available in clang.  */
+#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+extern rettype_clang function parameters_and_attributes \
+  __attribute__ ((__diagnose_if__ (1, msg, "warning")))
+#  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+/* Verify the existence of the function.  */
+#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+extern rettype_gcc function parameters_and_attributes
+#  else /* Unsupported.  */
+#   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
+_GL_WARN_EXTERN_C int _gl_warn_on_use
+#  endif
+# endif
+#endif
+
+/* _GL_WARN_EXTERN_C declaration;
+   performs the declaration with C linkage.  */
+#ifndef _GL_WARN_EXTERN_C
+# if defined __cplusplus
+#  define _GL_WARN_EXTERN_C extern "C"
+# else
+#  define _GL_WARN_EXTERN_C extern
+# endif
+#endif
deleted file mode 120000 (symlink)
index 6f29e886d2041c4dd1c2b2917a259423210a4931..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wchar.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a33a10f7472f42dfbc1d555a3b710c0dae6f274c
--- /dev/null
+/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake.  */
+
+/*
+ * ISO C 99 <wchar.h> for platforms that have issues.
+ * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html>
+ *
+ * For now, this just ensures proper prerequisite inclusion order and
+ * the declaration of wcwidth().
+ */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if (((defined __need_mbstate_t || defined __need_wint_t)               \
+      && !defined __MINGW32__)                                          \
+     || (defined __hpux                                                 \
+         && ((defined _INTTYPES_INCLUDED                                \
+              && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H)     \
+             || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
+     || (defined __MINGW32__ && defined __STRING_H_SOURCED__)           \
+     || defined _GL_ALREADY_INCLUDING_WCHAR_H)
+/* Special invocation convention:
+   - Inside glibc and uClibc header files, but not MinGW.
+   - On HP-UX 11.00 we have a sequence of nested includes
+     <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
+     once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
+     and once directly.  In both situations 'wint_t' is not yet defined,
+     therefore we cannot provide the function overrides; instead include only
+     the system's <wchar.h>.
+   - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of
+     <wchar.h> is actually processed, and that doesn't include 'mbstate_t'.
+   - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
+     the latter includes <wchar.h>.  But here, we have no way to detect whether
+     <wctype.h> is completely included or is still being included.  */
+
+#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_WCHAR_H
+
+#define _GL_ALREADY_INCLUDING_WCHAR_H
+
+#if @HAVE_FEATURES_H@
+# include <features.h> /* for __GLIBC__ */
+#endif
+
+/* In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
+   by <stddef.h>.
+   But avoid namespace pollution on glibc systems.  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <stddef.h>
+#endif
+
+/* Include the original <wchar.h> if it exists.
+   Some builds of uClibc lack it.  */
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_WCHAR_H@
+# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
+#endif
+
+#undef _GL_ALREADY_INCLUDING_WCHAR_H
+
+#ifndef _@GUARD_PREFIX@_WCHAR_H
+#define _@GUARD_PREFIX@_WCHAR_H
+
+/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
+   _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
+   HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
+   that can be freed by passing them as the Ith argument to the
+   function F.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# if __GNUC__ >= 11
+#  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+# else
+#  define _GL_ATTRIBUTE_DEALLOC(f, i)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+   can be freed via 'free'; it can be used only after declaring 'free'.  */
+/* Applies to: functions.  Cannot be used on inline functions.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
+# if defined __cplusplus && defined __GNUC__ && !defined __clang__
+/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
+#  define _GL_ATTRIBUTE_DEALLOC_FREE \
+     _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
+# else
+#  define _GL_ATTRIBUTE_DEALLOC_FREE \
+     _GL_ATTRIBUTE_DEALLOC (free, 1)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
+   allocated memory.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if __GNUC__ >= 3 || defined __clang__
+#  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define _GL_ATTRIBUTE_MALLOC
+# endif
+#endif
+
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __pure__ was added in gcc 2.96.  */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
+ */
+#ifndef _GL_ATTRIBUTE_NOTHROW
+# if defined __cplusplus
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+#   if __cplusplus >= 201103L
+#    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
+#   else
+#    define _GL_ATTRIBUTE_NOTHROW throw ()
+#   endif
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# else
+#  if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
+#   define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# endif
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Define wint_t and WEOF.  (Also done in wctype.in.h.)  */
+#if !@HAVE_WINT_T@ && !defined wint_t
+# define wint_t int
+# ifndef WEOF
+#  define WEOF -1
+# endif
+#else
+/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
+   <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
+   wint_t must be "unchanged by default argument promotions".  Override it.  */
+# if @GNULIBHEADERS_OVERRIDE_WINT_T@
+#  if !GNULIB_defined_wint_t
+#   if @HAVE_CRTDEFS_H@
+#    include <crtdefs.h>
+#   else
+#    include <stddef.h>
+#   endif
+typedef unsigned int rpl_wint_t;
+#   undef wint_t
+#   define wint_t rpl_wint_t
+#   define GNULIB_defined_wint_t 1
+#  endif
+# endif
+# ifndef WEOF
+#  define WEOF ((wint_t) -1)
+# endif
+#endif
+
+
+/* Override mbstate_t if it is too small.
+   On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
+   implementing mbrtowc for encodings like UTF-8.
+   On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is
+   large enough and overriding it would cause problems in C++ mode.  */
+#if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
+# if !GNULIB_defined_mbstate_t
+#  if !(defined _AIX || defined _MSC_VER)
+typedef int rpl_mbstate_t;
+#   undef mbstate_t
+#   define mbstate_t rpl_mbstate_t
+#  endif
+#  define GNULIB_defined_mbstate_t 1
+# endif
+#endif
+
+/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
+   been included yet.  */
+#if @GNULIB_FREE_POSIX@
+# if (@REPLACE_FREE@ && !defined free \
+      && !(defined __cplusplus && defined GNULIB_NAMESPACE))
+/* We can't do '#define free rpl_free' here.  */
+#  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void rpl_free (void *) _GL_ATTRIBUTE_NOTHROW;
+#  else
+_GL_EXTERN_C void rpl_free (void *);
+#  endif
+#  undef _GL_ATTRIBUTE_DEALLOC_FREE
+#  define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
+# else
+#  if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
+#  else
+#   if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
+#   else
+_GL_EXTERN_C void free (void *);
+#   endif
+#  endif
+# endif
+#else
+# if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
+# else
+#  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
+_GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
+#  else
+_GL_EXTERN_C void free (void *);
+#  endif
+# endif
+#endif
+
+
+#if @GNULIB_MBSZERO@
+/* Get memset().  */
+# include <string.h>
+#endif
+
+
+/* Convert a single-byte character to a wide character.  */
+#if @GNULIB_BTOWC@
+# if @REPLACE_BTOWC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef btowc
+#   define btowc rpl_btowc
+#  endif
+_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
+_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
+# else
+#  if !@HAVE_BTOWC@
+_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
+#  endif
+/* Need to cast, because on mingw, the return type is 'unsigned short'.  */
+_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (btowc);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef btowc
+# if HAVE_RAW_DECL_BTOWC
+_GL_WARN_ON_USE (btowc, "btowc is unportable - "
+                 "use gnulib module btowc for portability");
+# endif
+#endif
+
+
+/* Convert a wide character to a single-byte character.  */
+#if @GNULIB_WCTOB@
+# if @REPLACE_WCTOB@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wctob
+#   define wctob rpl_wctob
+#  endif
+_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
+_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
+# else
+#  if !defined wctob && !@HAVE_DECL_WCTOB@
+/* wctob is provided by gnulib, or wctob exists but is not declared.  */
+_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
+#  endif
+_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wctob);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wctob
+# if HAVE_RAW_DECL_WCTOB
+_GL_WARN_ON_USE (wctob, "wctob is unportable - "
+                 "use gnulib module wctob for portability");
+# endif
+#endif
+
+
+/* Test whether *PS is in an initial state.  */
+#if @GNULIB_MBSINIT@
+# if @REPLACE_MBSINIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbsinit
+#   define mbsinit rpl_mbsinit
+#  endif
+_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
+_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
+# else
+#  if !@HAVE_MBSINIT@
+_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
+#  endif
+_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mbsinit);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbsinit
+# if HAVE_RAW_DECL_MBSINIT
+_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
+                 "use gnulib module mbsinit for portability");
+# endif
+#endif
+
+
+/* Put *PS into an initial state.  */
+#if @GNULIB_MBSZERO@
+/* ISO C 23 § 7.31.6.(3) says that zeroing an mbstate_t is a way to put the
+   mbstate_t into an initial state.  However, on many platforms an mbstate_t
+   is large, and it is possible - as an optimization - to get away with zeroing
+   only part of it.  So, instead of
+
+        mbstate_t state = { 0 };
+
+   or
+
+        mbstate_t state;
+        memset (&state, 0, sizeof (mbstate_t));
+
+   we can write this faster code:
+
+        mbstate_t state;
+        mbszero (&state);
+ */
+/* _GL_MBSTATE_INIT_SIZE describes how mbsinit() behaves: It is the number of
+   bytes at the beginning of an mbstate_t that need to be zero, for mbsinit()
+   to return true.
+   _GL_MBSTATE_ZERO_SIZE is the number of bytes at the beginning of an mbstate_t
+   that need to be zero,
+     - for mbsinit() to return true, and
+     - for all other multibyte-aware functions to operate properly.
+   0 < _GL_MBSTATE_INIT_SIZE <= _GL_MBSTATE_ZERO_SIZE <= sizeof (mbstate_t).
+   These values are determined by source code inspection, where possible, and
+   by running the gnulib unit tests.
+   We need _GL_MBSTATE_INIT_SIZE because if we define _GL_MBSTATE_ZERO_SIZE
+   without considering what mbsinit() does, we get test failures such as
+     assertion "mbsinit (&iter->state)" failed
+ */
+# if GNULIB_defined_mbstate_t                             /* AIX, IRIX */
+/* mbstate_t has at least 4 bytes.  They are used as coded in
+   gnulib/lib/mbrtowc.c.  */
+#  define _GL_MBSTATE_INIT_SIZE 1
+/* define _GL_MBSTATE_ZERO_SIZE 4
+   does not work: it causes test failures.
+   So, use the safe fallback value, below.  */
+# elif __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2             /* glibc */
+/* mbstate_t is defined in <bits/types/__mbstate_t.h>.
+   For more details, see glibc/iconv/skeleton.c.  */
+#  define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (((mbstate_t) {0}).__count) */
+#  define _GL_MBSTATE_ZERO_SIZE /* 8 */ sizeof (mbstate_t)
+# elif defined MUSL_LIBC                                  /* musl libc */
+/* mbstate_t is defined in <bits/alltypes.h>.
+   It is an opaque aligned 8-byte struct, of which at most the first
+   4 bytes are used.
+   For more details, see src/multibyte/mbrtowc.c.  */
+#  define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (unsigned) */
+#  define _GL_MBSTATE_ZERO_SIZE 4
+# elif defined __APPLE__ && defined __MACH__              /* macOS */
+/* On macOS, mbstate_t is defined in <machine/_types.h>.
+   It is an opaque aligned 128-byte struct, of which at most the first
+   12 bytes are used.
+   For more details, see the __mbsinit implementations in
+   Libc-<version>/locale/FreeBSD/
+   {ascii,none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8,utf2}.c.  */
+/* File       INIT_SIZE  ZERO_SIZE
+   ascii.c        0          0
+   none.c         0          0
+   euc.c         12         12
+   mskanji.c      4          4
+   big5.c         4          4
+   gb2312.c       4          6
+   gbk.c          4          4
+   gb18030.c      4          8
+   utf8.c         8         10
+   utf2.c         8         12 */
+#  define _GL_MBSTATE_INIT_SIZE 12
+#  define _GL_MBSTATE_ZERO_SIZE 12
+# elif defined __FreeBSD__                                /* FreeBSD */
+/* On FreeBSD, mbstate_t is defined in src/sys/sys/_types.h.
+   It is an opaque aligned 128-byte struct, of which at most the first
+   12 bytes are used.
+   For more details, see the __mbsinit implementations in
+   src/lib/libc/locale/
+   {ascii,none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8}.c.  */
+/* File       INIT_SIZE  ZERO_SIZE
+   ascii.c        0          0
+   none.c         0          0
+   euc.c         12         12
+   mskanji.c      4          4
+   big5.c         4          4
+   gb2312.c       4          6
+   gbk.c          4          4
+   gb18030.c      4          8
+   utf8.c         8         12 */
+#  define _GL_MBSTATE_INIT_SIZE 12
+#  define _GL_MBSTATE_ZERO_SIZE 12
+# elif defined __NetBSD__                                 /* NetBSD */
+/* On NetBSD, mbstate_t is defined in src/sys/sys/ansi.h.
+   It is an opaque aligned 128-byte struct, of which at most the first
+   28 bytes are used.
+   For more details, see the *State types in
+   src/lib/libc/citrus/modules/citrus_*.c
+   (ignoring citrus_{hz,iso2022,utf7,viqr,zw}.c, since these implement
+   stateful encodings, not usable as locale encodings).  */
+/* File                                ZERO_SIZE
+   citrus/citrus_none.c                    0
+   citrus/modules/citrus_euc.c             8
+   citrus/modules/citrus_euctw.c           8
+   citrus/modules/citrus_mskanji.c         8
+   citrus/modules/citrus_big5.c            8
+   citrus/modules/citrus_gbk2k.c           8
+   citrus/modules/citrus_dechanyu.c        8
+   citrus/modules/citrus_johab.c           6
+   citrus/modules/citrus_utf8.c           12 */
+/* But 12 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test
+   failures for values < 28.  */
+#  define _GL_MBSTATE_ZERO_SIZE 28
+# elif defined __OpenBSD__                                /* OpenBSD */
+/* On OpenBSD, mbstate_t is defined in src/sys/sys/_types.h.
+   It is an opaque aligned 128-byte struct, of which at most the first
+   12 bytes are used.
+   For more details, see src/lib/libc/citrus/citrus_*.c.  */
+/* File           INIT_SIZE  ZERO_SIZE
+   citrus_none.c      0          0
+   citrus_utf8.c     12         12 */
+#  define _GL_MBSTATE_INIT_SIZE 12
+#  define _GL_MBSTATE_ZERO_SIZE 12
+# elif defined __minix                                    /* Minix */
+/* On Minix, mbstate_t is defined in sys/sys/ansi.h.
+   It is an opaque aligned 128-byte struct.
+   For more details, see the *State types in
+   lib/libc/citrus/citrus_*.c.  */
+/* File           INIT_SIZE  ZERO_SIZE
+   citrus_none.c      0          0 */
+/* But 1 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test
+   failures for values < 4.  */
+#  define _GL_MBSTATE_ZERO_SIZE 4
+# elif defined __sun                                      /* Solaris */
+/* On Solaris, mbstate_t is defined in <wchar_impl.h>.
+   It is an opaque aligned 24-byte or 32-byte struct, of which at most the first
+   20 or 28 bytes are used.
+   For more details on OpenSolaris derivatives, see the *State types in
+   illumos-gate/usr/src/lib/libc/port/locale/
+   {none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8}.c.  */
+/* File       INIT_SIZE  ZERO_SIZE
+   none.c         0          0
+   euc.c         12         12
+   mskanji.c      4          4
+   big5.c         4          4
+   gb2312.c       4          6
+   gbk.c          4          4
+   gb18030.c      4          8
+   utf8.c        12         12 */
+/* But 12 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test
+   failures
+     - in OpenIndiana and OmniOS: for values < 16,
+     - in Solaris 10 and 11: for values < 20 (in 32-bit mode)
+       or < 28 (in 64-bit mode).
+   Since we don't have a good way to distinguish the OpenSolaris derivatives
+   from the proprietary Solaris versions, and can't inspect the Solaris source
+   code, use the safe fallback values, below.  */
+# elif defined __CYGWIN__                                 /* Cygwin */
+/* On Cygwin, mbstate_t is defined in <sys/_types.h>.
+   For more details, see newlib/libc/stdlib/mbtowc_r.c and
+   winsup/cygwin/strfuncs.cc.  */
+#  define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (int) */
+#  define _GL_MBSTATE_ZERO_SIZE 8
+# elif defined _WIN32 && !defined __CYGWIN__              /* Native Windows.  */
+/* MSVC defines 'mbstate_t' as an aligned 8-byte struct.
+   On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined
+   as an aligned 8-byte struct, of which the first 4 bytes matter.
+   Use the safe values, below.  */
+# elif defined __ANDROID__                                /* Android */
+/* Android defines 'mbstate_t' in <bits/mbstate_t.h>.
+   It is an opaque 4-byte or 8-byte struct.
+   For more details, see
+   bionic/libc/private/bionic_mbstate.h
+   bionic/libc/bionic/mbrtoc32.cpp
+   bionic/libc/bionic/mbrtoc16.cpp
+ */
+#  define _GL_MBSTATE_INIT_SIZE 4
+#  define _GL_MBSTATE_ZERO_SIZE 4
+# endif
+/* Use safe values as defaults.  */
+# ifndef _GL_MBSTATE_INIT_SIZE
+#  define _GL_MBSTATE_INIT_SIZE sizeof (mbstate_t)
+# endif
+# ifndef _GL_MBSTATE_ZERO_SIZE
+#  define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t)
+# endif
+_GL_BEGIN_C_LINKAGE
+# if defined IN_MBSZERO
+_GL_EXTERN_INLINE
+# else
+_GL_INLINE
+# endif
+_GL_ARG_NONNULL ((1)) void
+mbszero (mbstate_t *ps)
+{
+  memset (ps, 0, _GL_MBSTATE_ZERO_SIZE);
+}
+_GL_END_C_LINKAGE
+_GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps));
+_GL_CXXALIASWARN (mbszero);
+#endif
+
+
+/* Convert a multibyte character to a wide character.  */
+#if @GNULIB_MBRTOWC@
+# if @REPLACE_MBRTOWC@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbrtowc
+#   define mbrtowc rpl_mbrtowc
+#  endif
+_GL_FUNCDECL_RPL (mbrtowc, size_t,
+                  (wchar_t *restrict pwc, const char *restrict s, size_t n,
+                   mbstate_t *restrict ps));
+_GL_CXXALIAS_RPL (mbrtowc, size_t,
+                  (wchar_t *restrict pwc, const char *restrict s, size_t n,
+                   mbstate_t *restrict ps));
+# else
+#  if !@HAVE_MBRTOWC@
+_GL_FUNCDECL_SYS (mbrtowc, size_t,
+                  (wchar_t *restrict pwc, const char *restrict s, size_t n,
+                   mbstate_t *restrict ps));
+#  endif
+_GL_CXXALIAS_SYS (mbrtowc, size_t,
+                  (wchar_t *restrict pwc, const char *restrict s, size_t n,
+                   mbstate_t *restrict ps));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mbrtowc);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbrtowc
+# if HAVE_RAW_DECL_MBRTOWC
+_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
+                 "use gnulib module mbrtowc for portability");
+# endif
+#endif
+
+
+/* Recognize a multibyte character.  */
+#if @GNULIB_MBRLEN@
+# if @REPLACE_MBRLEN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbrlen
+#   define mbrlen rpl_mbrlen
+#  endif
+_GL_FUNCDECL_RPL (mbrlen, size_t,
+                  (const char *restrict s, size_t n, mbstate_t *restrict ps));
+_GL_CXXALIAS_RPL (mbrlen, size_t,
+                  (const char *restrict s, size_t n, mbstate_t *restrict ps));
+# else
+#  if !@HAVE_MBRLEN@
+_GL_FUNCDECL_SYS (mbrlen, size_t,
+                  (const char *restrict s, size_t n, mbstate_t *restrict ps));
+#  endif
+_GL_CXXALIAS_SYS (mbrlen, size_t,
+                  (const char *restrict s, size_t n, mbstate_t *restrict ps));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mbrlen);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbrlen
+# if HAVE_RAW_DECL_MBRLEN
+_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
+                 "use gnulib module mbrlen for portability");
+# endif
+#endif
+
+
+/* Convert a string to a wide string.  */
+#if @GNULIB_MBSRTOWCS@
+# if @REPLACE_MBSRTOWCS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbsrtowcs
+#   define mbsrtowcs rpl_mbsrtowcs
+#  endif
+_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
+                  (wchar_t *restrict dest,
+                   const char **restrict srcp, size_t len,
+                   mbstate_t *restrict ps)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
+                  (wchar_t *restrict dest,
+                   const char **restrict srcp, size_t len,
+                   mbstate_t *restrict ps));
+# else
+#  if !@HAVE_MBSRTOWCS@
+_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
+                  (wchar_t *restrict dest,
+                   const char **restrict srcp, size_t len,
+                   mbstate_t *restrict ps)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
+                  (wchar_t *restrict dest,
+                   const char **restrict srcp, size_t len,
+                   mbstate_t *restrict ps));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mbsrtowcs);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbsrtowcs
+# if HAVE_RAW_DECL_MBSRTOWCS
+_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
+                 "use gnulib module mbsrtowcs for portability");
+# endif
+#endif
+
+
+/* Convert a string to a wide string.  */
+#if @GNULIB_MBSNRTOWCS@
+# if @REPLACE_MBSNRTOWCS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbsnrtowcs
+#   define mbsnrtowcs rpl_mbsnrtowcs
+#  endif
+_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
+                  (wchar_t *restrict dest,
+                   const char **restrict srcp, size_t srclen, size_t len,
+                   mbstate_t *restrict ps)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
+                  (wchar_t *restrict dest,
+                   const char **restrict srcp, size_t srclen, size_t len,
+                   mbstate_t *restrict ps));
+# else
+#  if !@HAVE_MBSNRTOWCS@
+_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
+                  (wchar_t *restrict dest,
+                   const char **restrict srcp, size_t srclen, size_t len,
+                   mbstate_t *restrict ps)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
+                  (wchar_t *restrict dest,
+                   const char **restrict srcp, size_t srclen, size_t len,
+                   mbstate_t *restrict ps));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (mbsnrtowcs);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbsnrtowcs
+# if HAVE_RAW_DECL_MBSNRTOWCS
+_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
+                 "use gnulib module mbsnrtowcs for portability");
+# endif
+#endif
+
+
+/* Convert a wide character to a multibyte character.  */
+#if @GNULIB_WCRTOMB@
+# if @REPLACE_WCRTOMB@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcrtomb
+#   define wcrtomb rpl_wcrtomb
+#  endif
+_GL_FUNCDECL_RPL (wcrtomb, size_t,
+                  (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
+_GL_CXXALIAS_RPL (wcrtomb, size_t,
+                  (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
+# else
+#  if !@HAVE_WCRTOMB@
+_GL_FUNCDECL_SYS (wcrtomb, size_t,
+                  (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
+#  endif
+_GL_CXXALIAS_SYS (wcrtomb, size_t,
+                  (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcrtomb);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcrtomb
+# if HAVE_RAW_DECL_WCRTOMB
+_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
+                 "use gnulib module wcrtomb for portability");
+# endif
+#endif
+
+
+/* Convert a wide string to a string.  */
+#if @GNULIB_WCSRTOMBS@
+# if @REPLACE_WCSRTOMBS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsrtombs
+#   define wcsrtombs rpl_wcsrtombs
+#  endif
+_GL_FUNCDECL_RPL (wcsrtombs, size_t,
+                  (char *restrict dest, const wchar_t **restrict srcp,
+                   size_t len,
+                   mbstate_t *restrict ps)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (wcsrtombs, size_t,
+                  (char *restrict dest, const wchar_t **restrict srcp,
+                   size_t len,
+                   mbstate_t *restrict ps));
+# else
+#  if !@HAVE_WCSRTOMBS@
+_GL_FUNCDECL_SYS (wcsrtombs, size_t,
+                  (char *restrict dest, const wchar_t **restrict srcp,
+                   size_t len,
+                   mbstate_t *restrict ps)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (wcsrtombs, size_t,
+                  (char *restrict dest, const wchar_t **restrict srcp,
+                   size_t len,
+                   mbstate_t *restrict ps));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsrtombs);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsrtombs
+# if HAVE_RAW_DECL_WCSRTOMBS
+_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
+                 "use gnulib module wcsrtombs for portability");
+# endif
+#endif
+
+
+/* Convert a wide string to a string.  */
+#if @GNULIB_WCSNRTOMBS@
+# if @REPLACE_WCSNRTOMBS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsnrtombs
+#   define wcsnrtombs rpl_wcsnrtombs
+#  endif
+_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
+                  (char *restrict dest,
+                   const wchar_t **restrict srcp, size_t srclen,
+                   size_t len,
+                   mbstate_t *restrict ps)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
+                  (char *restrict dest,
+                   const wchar_t **restrict srcp, size_t srclen,
+                   size_t len,
+                   mbstate_t *restrict ps));
+# else
+#  if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
+_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
+                  (char *restrict dest,
+                   const wchar_t **restrict srcp, size_t srclen,
+                   size_t len,
+                   mbstate_t *restrict ps)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
+                  (char *restrict dest,
+                   const wchar_t **restrict srcp, size_t srclen,
+                   size_t len,
+                   mbstate_t *restrict ps));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsnrtombs);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsnrtombs
+# if HAVE_RAW_DECL_WCSNRTOMBS
+_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
+                 "use gnulib module wcsnrtombs for portability");
+# endif
+#endif
+
+
+/* Return the number of screen columns needed for WC.  */
+#if @GNULIB_WCWIDTH@
+# if @REPLACE_WCWIDTH@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcwidth
+#   define wcwidth rpl_wcwidth
+#  endif
+_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
+_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
+# else
+#  if !@HAVE_DECL_WCWIDTH@
+/* wcwidth exists but is not declared.  */
+_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
+#  endif
+_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcwidth);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcwidth
+# if HAVE_RAW_DECL_WCWIDTH
+_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
+                 "use gnulib module wcwidth for portability");
+# endif
+#endif
+
+
+/* Search N wide characters of S for C.  */
+#if @GNULIB_WMEMCHR@
+# if !@HAVE_WMEMCHR@
+_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
+                                      _GL_ATTRIBUTE_PURE);
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
+         wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wmemchr,
+                        wchar_t *, (const wchar_t *, wchar_t, size_t),
+                        const wchar_t *, (const wchar_t *, wchar_t, size_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
+_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
+                   (const wchar_t *s, wchar_t c, size_t n));
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (wmemchr);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wmemchr
+# if HAVE_RAW_DECL_WMEMCHR
+_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
+                 "use gnulib module wmemchr for portability");
+# endif
+#endif
+
+
+/* Compare N wide characters of S1 and S2.  */
+#if @GNULIB_WMEMCMP@
+# if @REPLACE_WMEMCMP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wmemcmp
+#   define wmemcmp rpl_wmemcmp
+#  endif
+_GL_FUNCDECL_RPL (wmemcmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n)
+                  _GL_ATTRIBUTE_PURE);
+_GL_CXXALIAS_RPL (wmemcmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+# else
+#  if !@HAVE_WMEMCMP@
+_GL_FUNCDECL_SYS (wmemcmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n)
+                  _GL_ATTRIBUTE_PURE);
+#  endif
+_GL_CXXALIAS_SYS (wmemcmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wmemcmp);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wmemcmp
+# if HAVE_RAW_DECL_WMEMCMP
+_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
+                 "use gnulib module wmemcmp for portability");
+# endif
+#endif
+
+
+/* Copy N wide characters of SRC to DEST.  */
+#if @GNULIB_WMEMCPY@
+# if !@HAVE_WMEMCPY@
+_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wmemcpy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wmemcpy
+# if HAVE_RAW_DECL_WMEMCPY
+_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
+                 "use gnulib module wmemcpy for portability");
+# endif
+#endif
+
+
+/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
+   overlapping memory areas.  */
+#if @GNULIB_WMEMMOVE@
+# if !@HAVE_WMEMMOVE@
+_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
+                  (wchar_t *dest, const wchar_t *src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
+                  (wchar_t *dest, const wchar_t *src, size_t n));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wmemmove);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wmemmove
+# if HAVE_RAW_DECL_WMEMMOVE
+_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
+                 "use gnulib module wmemmove for portability");
+# endif
+#endif
+
+
+/* Copy N wide characters of SRC to DEST.
+   Return pointer to wide characters after the last written wide character.  */
+#if @GNULIB_WMEMPCPY@
+# if @REPLACE_WMEMPCPY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wmempcpy
+#   define wmempcpy rpl_wmempcpy
+#  endif
+_GL_FUNCDECL_RPL (wmempcpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+_GL_CXXALIAS_RPL (wmempcpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+# else
+#  if !@HAVE_WMEMPCPY@
+_GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+#  endif
+_GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wmempcpy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wmempcpy
+# if HAVE_RAW_DECL_WMEMPCPY
+_GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
+                 "use gnulib module wmempcpy for portability");
+# endif
+#endif
+
+
+/* Set N wide characters of S to C.  */
+#if @GNULIB_WMEMSET@
+# if !@HAVE_WMEMSET@
+_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wmemset);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wmemset
+# if HAVE_RAW_DECL_WMEMSET
+_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
+                 "use gnulib module wmemset for portability");
+# endif
+#endif
+
+
+/* Return the number of wide characters in S.  */
+#if @GNULIB_WCSLEN@
+# if !@HAVE_WCSLEN@
+_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
+# endif
+_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcslen);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcslen
+# if HAVE_RAW_DECL_WCSLEN
+_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
+                 "use gnulib module wcslen for portability");
+# endif
+#endif
+
+
+/* Return the number of wide characters in S, but at most MAXLEN.  */
+#if @GNULIB_WCSNLEN@
+/* On Solaris 11.3, the header files declare the function in the std::
+   namespace, not in the global namespace.  So, force a declaration in
+   the global namespace.  */
+# if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus)
+_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
+                                   _GL_ATTRIBUTE_PURE);
+# endif
+_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
+_GL_CXXALIASWARN (wcsnlen);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsnlen
+# if HAVE_RAW_DECL_WCSNLEN
+_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
+                 "use gnulib module wcsnlen for portability");
+# endif
+#endif
+
+
+/* Copy SRC to DEST.  */
+#if @GNULIB_WCSCPY@
+# if !@HAVE_WCSCPY@
+_GL_FUNCDECL_SYS (wcscpy, wchar_t *,
+                  (wchar_t *restrict dest, const wchar_t *restrict src));
+# endif
+_GL_CXXALIAS_SYS (wcscpy, wchar_t *,
+                  (wchar_t *restrict dest, const wchar_t *restrict src));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcscpy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcscpy
+# if HAVE_RAW_DECL_WCSCPY
+_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
+                 "use gnulib module wcscpy for portability");
+# endif
+#endif
+
+
+/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST.  */
+#if @GNULIB_WCPCPY@
+/* On Solaris 11.3, the header files declare the function in the std::
+   namespace, not in the global namespace.  So, force a declaration in
+   the global namespace.  */
+# if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus)
+_GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
+                  (wchar_t *restrict dest, const wchar_t *restrict src));
+# endif
+_GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
+                  (wchar_t *restrict dest, const wchar_t *restrict src));
+_GL_CXXALIASWARN (wcpcpy);
+#elif defined GNULIB_POSIXCHECK
+# undef wcpcpy
+# if HAVE_RAW_DECL_WCPCPY
+_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
+                 "use gnulib module wcpcpy for portability");
+# endif
+#endif
+
+
+/* Copy no more than N wide characters of SRC to DEST.  */
+#if @GNULIB_WCSNCPY@
+# if !@HAVE_WCSNCPY@
+_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsncpy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsncpy
+# if HAVE_RAW_DECL_WCSNCPY
+_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
+                 "use gnulib module wcsncpy for portability");
+# endif
+#endif
+
+
+/* Copy no more than N characters of SRC to DEST, returning the address of
+   the last character written into DEST.  */
+#if @GNULIB_WCPNCPY@
+/* On Solaris 11.3, the header files declare the function in the std::
+   namespace, not in the global namespace.  So, force a declaration in
+   the global namespace.  */
+# if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus)
+_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
+                  (wchar_t *restrict dest,
+                   const wchar_t *restrict src, size_t n));
+_GL_CXXALIASWARN (wcpncpy);
+#elif defined GNULIB_POSIXCHECK
+# undef wcpncpy
+# if HAVE_RAW_DECL_WCPNCPY
+_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
+                 "use gnulib module wcpncpy for portability");
+# endif
+#endif
+
+
+/* Append SRC onto DEST.  */
+#if @GNULIB_WCSCAT@
+# if !@HAVE_WCSCAT@
+_GL_FUNCDECL_SYS (wcscat, wchar_t *,
+                  (wchar_t *restrict dest, const wchar_t *restrict src));
+# endif
+_GL_CXXALIAS_SYS (wcscat, wchar_t *,
+                  (wchar_t *restrict dest, const wchar_t *restrict src));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcscat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcscat
+# if HAVE_RAW_DECL_WCSCAT
+_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
+                 "use gnulib module wcscat for portability");
+# endif
+#endif
+
+
+/* Append no more than N wide characters of SRC onto DEST.  */
+#if @GNULIB_WCSNCAT@
+# if !@HAVE_WCSNCAT@
+_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
+                  (wchar_t *restrict dest, const wchar_t *restrict src,
+                   size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
+                  (wchar_t *restrict dest, const wchar_t *restrict src,
+                   size_t n));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsncat);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsncat
+# if HAVE_RAW_DECL_WCSNCAT
+_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
+                 "use gnulib module wcsncat for portability");
+# endif
+#endif
+
+
+/* Compare S1 and S2.  */
+#if @GNULIB_WCSCMP@
+# if @REPLACE_WCSCMP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcscmp
+#   define wcscmp rpl_wcscmp
+#  endif
+_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
+                               _GL_ATTRIBUTE_PURE);
+_GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
+# else
+#  if !@HAVE_WCSCMP@
+_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
+                               _GL_ATTRIBUTE_PURE);
+#  endif
+_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcscmp);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcscmp
+# if HAVE_RAW_DECL_WCSCMP
+_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
+                 "use gnulib module wcscmp for portability");
+# endif
+#endif
+
+
+/* Compare no more than N wide characters of S1 and S2.  */
+#if @GNULIB_WCSNCMP@
+# if @REPLACE_WCSNCMP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsncmp
+#   define wcsncmp rpl_wcsncmp
+#  endif
+_GL_FUNCDECL_RPL (wcsncmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n)
+                  _GL_ATTRIBUTE_PURE);
+_GL_CXXALIAS_RPL (wcsncmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+# else
+#  if !@HAVE_WCSNCMP@
+_GL_FUNCDECL_SYS (wcsncmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n)
+                  _GL_ATTRIBUTE_PURE);
+#  endif
+_GL_CXXALIAS_SYS (wcsncmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsncmp);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsncmp
+# if HAVE_RAW_DECL_WCSNCMP
+_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
+                 "use gnulib module wcsncmp for portability");
+# endif
+#endif
+
+
+/* Compare S1 and S2, ignoring case.  */
+#if @GNULIB_WCSCASECMP@
+/* On Solaris 11.3, the header files declare the function in the std::
+   namespace, not in the global namespace.  So, force a declaration in
+   the global namespace.  */
+# if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus)
+_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
+                                   _GL_ATTRIBUTE_PURE);
+# endif
+_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
+_GL_CXXALIASWARN (wcscasecmp);
+#elif defined GNULIB_POSIXCHECK
+# undef wcscasecmp
+# if HAVE_RAW_DECL_WCSCASECMP
+_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
+                 "use gnulib module wcscasecmp for portability");
+# endif
+#endif
+
+
+/* Compare no more than N chars of S1 and S2, ignoring case.  */
+#if @GNULIB_WCSNCASECMP@
+/* On Solaris 11.3, the header files declare the function in the std::
+   namespace, not in the global namespace.  So, force a declaration in
+   the global namespace.  */
+# if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus)
+_GL_FUNCDECL_SYS (wcsncasecmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n)
+                  _GL_ATTRIBUTE_PURE);
+# endif
+_GL_CXXALIAS_SYS (wcsncasecmp, int,
+                  (const wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_CXXALIASWARN (wcsncasecmp);
+#elif defined GNULIB_POSIXCHECK
+# undef wcsncasecmp
+# if HAVE_RAW_DECL_WCSNCASECMP
+_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
+                 "use gnulib module wcsncasecmp for portability");
+# endif
+#endif
+
+
+/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
+   category of the current locale.  */
+#if @GNULIB_WCSCOLL@
+# if !@HAVE_WCSCOLL@
+_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
+# endif
+_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcscoll);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcscoll
+# if HAVE_RAW_DECL_WCSCOLL
+_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
+                 "use gnulib module wcscoll for portability");
+# endif
+#endif
+
+
+/* Transform S2 into array pointed to by S1 such that if wcscmp is applied
+   to two transformed strings the result is the as applying 'wcscoll' to the
+   original strings.  */
+#if @GNULIB_WCSXFRM@
+# if !@HAVE_WCSXFRM@
+_GL_FUNCDECL_SYS (wcsxfrm, size_t,
+                  (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wcsxfrm, size_t,
+                  (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsxfrm);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsxfrm
+# if HAVE_RAW_DECL_WCSXFRM
+_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
+                 "use gnulib module wcsxfrm for portability");
+# endif
+#endif
+
+
+/* Duplicate S, returning an identical malloc'd string.  */
+#if @GNULIB_WCSDUP@
+# if defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsdup
+#   define wcsdup _wcsdup
+#  endif
+_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
+# else
+/* On Solaris 11.3, the header files declare the function in the std::
+   namespace, not in the global namespace.  So, force a declaration in
+   the global namespace.  */
+#  if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11
+#   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
+                  (const wchar_t *s)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   else
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
+                  (const wchar_t *s)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   endif
+#  endif
+_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+# endif
+_GL_CXXALIASWARN (wcsdup);
+#else
+# if __GNUC__ >= 11 && !defined wcsdup
+/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free.  */
+#  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
+                  (const wchar_t *s)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  else
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
+                  (const wchar_t *s)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#  endif
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef wcsdup
+#  if HAVE_RAW_DECL_WCSDUP
+_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
+                 "use gnulib module wcsdup for portability");
+#  endif
+# elif @GNULIB_MDA_WCSDUP@
+/* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not
+   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
+   platforms by defining GNULIB_NAMESPACE::wcsdup always.  */
+#  if defined _WIN32 && !defined __CYGWIN__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef wcsdup
+#    define wcsdup _wcsdup
+#   endif
+_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
+#  else
+#   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
+                  (const wchar_t *s)
+                  _GL_ATTRIBUTE_NOTHROW
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   else
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
+                  (const wchar_t *s)
+                  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+#   endif
+#   if @HAVE_DECL_WCSDUP@
+_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+#   endif
+#  endif
+#  if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
+_GL_CXXALIASWARN (wcsdup);
+#  endif
+# endif
+#endif
+
+
+/* Find the first occurrence of WC in WCS.  */
+#if @GNULIB_WCSCHR@
+# if !@HAVE_WCSCHR@
+_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
+                                     _GL_ATTRIBUTE_PURE);
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wcschr (const wchar_t *, wchar_t);
+         wchar_t * std::wcschr (wchar_t *, wchar_t);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wcschr,
+                        wchar_t *, (const wchar_t *, wchar_t),
+                        const wchar_t *, (const wchar_t *, wchar_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcschr);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcschr
+# if HAVE_RAW_DECL_WCSCHR
+_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
+                 "use gnulib module wcschr for portability");
+# endif
+#endif
+
+
+/* Find the last occurrence of WC in WCS.  */
+#if @GNULIB_WCSRCHR@
+# if !@HAVE_WCSRCHR@
+_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
+                                      _GL_ATTRIBUTE_PURE);
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
+         wchar_t * std::wcsrchr (wchar_t *, wchar_t);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wcsrchr,
+                        wchar_t *, (const wchar_t *, wchar_t),
+                        const wchar_t *, (const wchar_t *, wchar_t));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
+_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsrchr);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsrchr
+# if HAVE_RAW_DECL_WCSRCHR
+_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
+                 "use gnulib module wcsrchr for portability");
+# endif
+#endif
+
+
+/* Return the length of the initial segment of WCS which consists entirely
+   of wide characters not in REJECT.  */
+#if @GNULIB_WCSCSPN@
+# if !@HAVE_WCSCSPN@
+_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
+                                   _GL_ATTRIBUTE_PURE);
+# endif
+_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcscspn);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcscspn
+# if HAVE_RAW_DECL_WCSCSPN
+_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
+                 "use gnulib module wcscspn for portability");
+# endif
+#endif
+
+
+/* Return the length of the initial segment of WCS which consists entirely
+   of wide characters in ACCEPT.  */
+#if @GNULIB_WCSSPN@
+# if !@HAVE_WCSSPN@
+_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
+                                  _GL_ATTRIBUTE_PURE);
+# endif
+_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsspn);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsspn
+# if HAVE_RAW_DECL_WCSSPN
+_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
+                 "use gnulib module wcsspn for portability");
+# endif
+#endif
+
+
+/* Find the first occurrence in WCS of any character in ACCEPT.  */
+#if @GNULIB_WCSPBRK@
+# if !@HAVE_WCSPBRK@
+_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
+                  (const wchar_t *wcs, const wchar_t *accept)
+                  _GL_ATTRIBUTE_PURE);
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
+         wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wcspbrk,
+                        wchar_t *, (const wchar_t *, const wchar_t *),
+                        const wchar_t *, (const wchar_t *, const wchar_t *));
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
+                   (wchar_t *wcs, const wchar_t *accept));
+_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
+                   (const wchar_t *wcs, const wchar_t *accept));
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcspbrk);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcspbrk
+# if HAVE_RAW_DECL_WCSPBRK
+_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
+                 "use gnulib module wcspbrk for portability");
+# endif
+#endif
+
+
+/* Find the first occurrence of NEEDLE in HAYSTACK.  */
+#if @GNULIB_WCSSTR@
+# if @REPLACE_WCSSTR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsstr
+#   define wcsstr rpl_wcsstr
+#  endif
+_GL_FUNCDECL_RPL (wcsstr, wchar_t *,
+                  (const wchar_t *restrict haystack,
+                   const wchar_t *restrict needle)
+                  _GL_ATTRIBUTE_PURE);
+_GL_CXXALIAS_RPL (wcsstr, wchar_t *,
+                  (const wchar_t *restrict haystack,
+                   const wchar_t *restrict needle));
+# else
+#  if !@HAVE_WCSSTR@
+_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
+                  (const wchar_t *restrict haystack,
+                   const wchar_t *restrict needle)
+                  _GL_ATTRIBUTE_PURE);
+#  endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" {
+         const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
+         wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
+       }  */
+_GL_CXXALIAS_SYS_CAST2 (wcsstr,
+                        wchar_t *,
+                        (const wchar_t *restrict, const wchar_t *restrict),
+                        const wchar_t *,
+                        (const wchar_t *restrict, const wchar_t *restrict));
+# endif
+# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
+                   (wchar_t *restrict haystack,
+                    const wchar_t *restrict needle));
+_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
+                   (const wchar_t *restrict haystack,
+                    const wchar_t *restrict needle));
+# elif __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsstr);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsstr
+# if HAVE_RAW_DECL_WCSSTR
+_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
+                 "use gnulib module wcsstr for portability");
+# endif
+#endif
+
+
+/* Divide WCS into tokens separated by characters in DELIM.  */
+#if @GNULIB_WCSTOK@
+# if @REPLACE_WCSTOK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcstok
+#   define wcstok rpl_wcstok
+#  endif
+_GL_FUNCDECL_RPL (wcstok, wchar_t *,
+                  (wchar_t *restrict wcs, const wchar_t *restrict delim,
+                   wchar_t **restrict ptr));
+_GL_CXXALIAS_RPL (wcstok, wchar_t *,
+                  (wchar_t *restrict wcs, const wchar_t *restrict delim,
+                   wchar_t **restrict ptr));
+# else
+#  if !@HAVE_WCSTOK@
+_GL_FUNCDECL_SYS (wcstok, wchar_t *,
+                  (wchar_t *restrict wcs, const wchar_t *restrict delim,
+                   wchar_t **restrict ptr));
+#  endif
+_GL_CXXALIAS_SYS (wcstok, wchar_t *,
+                  (wchar_t *restrict wcs, const wchar_t *restrict delim,
+                   wchar_t **restrict ptr));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcstok);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcstok
+# if HAVE_RAW_DECL_WCSTOK
+_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
+                 "use gnulib module wcstok for portability");
+# endif
+#endif
+
+
+/* Determine number of column positions required for first N wide
+   characters (or fewer if S ends before this) in S.  */
+#if @GNULIB_WCSWIDTH@
+# if @REPLACE_WCSWIDTH@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcswidth
+#   define wcswidth rpl_wcswidth
+#  endif
+_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
+                                 _GL_ATTRIBUTE_PURE);
+_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
+# else
+#  if !@HAVE_WCSWIDTH@
+_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
+                                 _GL_ATTRIBUTE_PURE);
+#  endif
+_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcswidth);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcswidth
+# if HAVE_RAW_DECL_WCSWIDTH
+_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
+                 "use gnulib module wcswidth for portability");
+# endif
+#endif
+
+
+/* Convert *TP to a date and time wide string.  See
+   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>.  */
+#if @GNULIB_WCSFTIME@
+# if @REPLACE_WCSFTIME@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsftime
+#   define wcsftime rpl_wcsftime
+#  endif
+_GL_FUNCDECL_RPL (wcsftime, size_t,
+                  (wchar_t *restrict __buf, size_t __bufsize,
+                   const wchar_t *restrict __fmt,
+                   const struct tm *restrict __tp)
+                  _GL_ARG_NONNULL ((1, 3, 4)));
+_GL_CXXALIAS_RPL (wcsftime, size_t,
+                  (wchar_t *restrict __buf, size_t __bufsize,
+                   const wchar_t *restrict __fmt,
+                   const struct tm *restrict __tp));
+# else
+#  if !@HAVE_WCSFTIME@
+_GL_FUNCDECL_SYS (wcsftime, size_t,
+                  (wchar_t *restrict __buf, size_t __bufsize,
+                   const wchar_t *restrict __fmt,
+                   const struct tm *restrict __tp)
+                  _GL_ARG_NONNULL ((1, 3, 4)));
+#  endif
+_GL_CXXALIAS_SYS (wcsftime, size_t,
+                  (wchar_t *restrict __buf, size_t __bufsize,
+                   const wchar_t *restrict __fmt,
+                   const struct tm *restrict __tp));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wcsftime);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcsftime
+# if HAVE_RAW_DECL_WCSFTIME
+_GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
+                 "use gnulib module wcsftime for portability");
+# endif
+#endif
+
+
+#if @GNULIB_WGETCWD@ && (defined _WIN32 && !defined __CYGWIN__)
+/* Gets the name of the current working directory.
+   (a) If BUF is non-NULL, it is assumed to have room for SIZE wide characters.
+       This function stores the working directory (NUL-terminated) in BUF and
+       returns BUF.
+   (b) If BUF is NULL, an array is allocated with 'malloc'.  The array is SIZE
+       wide characters long, unless SIZE == 0, in which case it is as big as
+       necessary.
+   If the directory couldn't be determined or SIZE was too small, this function
+   returns NULL and sets errno.  For a directory of length LEN, SIZE should be
+   >= LEN + 3 in case (a) or >= LEN + 1 in case (b).
+   Possible errno values include:
+     - ERANGE if SIZE is too small.
+     - ENOMEM if the memory could no be allocated.  */
+_GL_FUNCDECL_SYS (wgetcwd, wchar_t *, (wchar_t *buf, size_t size));
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_WCHAR_H */
+#endif /* _@GUARD_PREFIX@_WCHAR_H */
+#endif
deleted file mode 120000 (symlink)
index 16d9df839d7260021cc94ee0b1282acd7670c5f0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wcrtomb.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..197b020e2801601c54b51e9ae4eed93340ee6f95
--- /dev/null
@@ -0,0 +1,80 @@
+/* Convert wide character to multibyte character.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include <errno.h>
+#include <stdlib.h>
+
+
+size_t
+wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
+#undef wcrtomb
+{
+  /* This implementation of wcrtomb supports only stateless encodings.
+     ps must be in an initial state.  */
+  if (ps != NULL && !mbsinit (ps))
+    {
+      errno = EINVAL;
+      return (size_t)(-1);
+    }
+
+#if !HAVE_WCRTOMB                       /* IRIX 6.5 */ \
+    || WCRTOMB_RETVAL_BUG               /* Solaris 11.3, MSVC */ \
+    || WCRTOMB_C_LOCALE_BUG             /* Android */
+  if (s == NULL)
+    /* We know the NUL wide character corresponds to the NUL character.  */
+    return 1;
+  else
+#endif
+    {
+#if HAVE_WCRTOMB
+# if WCRTOMB_C_LOCALE_BUG               /* Android */
+      /* Implement consistently with mbrtowc(): through a 1:1 correspondence,
+         as in ISO-8859-1.  */
+      if (wc >= 0 && wc <= 0xff)
+        {
+          *s = (unsigned char) wc;
+          return 1;
+        }
+      else
+        {
+          errno = EILSEQ;
+          return (size_t)(-1);
+        }
+# else
+      return wcrtomb (s, wc, ps);
+# endif
+#else                                   /* IRIX 6.5 */
+      /* Fallback for platforms that don't have wcrtomb().
+         Implement on top of wctomb().
+         This code is not multithread-safe.  */
+      int ret = wctomb (s, wc);
+
+      if (ret >= 0)
+        return ret;
+      else
+        {
+          errno = EILSEQ;
+          return (size_t)(-1);
+        }
+#endif
+    }
+}
deleted file mode 120000 (symlink)
index e7e8bdb42b0c0f2bcf7887ae5c7c4b8bd8ec66cb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wctype-h.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7e4ff13a71f4f62dd548679cbea535a3a061e9d2
--- /dev/null
@@ -0,0 +1,23 @@
+/* Inline functions for <wctype.h>.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Normally this would be wctype.c, but that name's already taken.  */
+
+#include <config.h>
+
+#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE
+#include <wctype.h>
deleted file mode 120000 (symlink)
index 4e9e3593225ceedf13dd61734f95af1030baad7c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wctype-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..26d68b41b9c75493c378c93d7cabea1ae340da29
--- /dev/null
@@ -0,0 +1,96 @@
+/* Get descriptor for a wide character property.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+wctype_t
+wctype (const char* name)
+{
+  switch (name[0])
+    {
+    case 'a':
+      switch (name[1])
+        {
+        case 'l':
+          switch (name[2])
+            {
+            case 'n':
+              if (strcmp (name + 3, "um") == 0)
+                return (wctype_t) iswalnum;
+              break;
+            case 'p':
+              if (strcmp (name + 3, "ha") == 0)
+                return (wctype_t) iswalpha;
+              break;
+            default:
+              break;
+            }
+          break;
+        default:
+          break;
+        }
+      break;
+    case 'b':
+      if (strcmp (name + 1, "lank") == 0)
+        return (wctype_t) iswblank;
+      break;
+    case 'c':
+      if (strcmp (name + 1, "ntrl") == 0)
+        return (wctype_t) iswcntrl;
+      break;
+    case 'd':
+      if (strcmp (name + 1, "igit") == 0)
+        return (wctype_t) iswdigit;
+      break;
+    case 'g':
+      if (strcmp (name + 1, "raph") == 0)
+        return (wctype_t) iswgraph;
+      break;
+    case 'l':
+      if (strcmp (name + 1, "ower") == 0)
+        return (wctype_t) iswlower;
+      break;
+    case 'p':
+      switch (name[1])
+        {
+        case 'r':
+          if (strcmp (name + 2, "int") == 0)
+            return (wctype_t) iswprint;
+          break;
+        case 'u':
+          if (strcmp (name + 2, "nct") == 0)
+            return (wctype_t) iswpunct;
+          break;
+        default:
+          break;
+        }
+      break;
+    case 's':
+      if (strcmp (name + 1, "pace") == 0)
+        return (wctype_t) iswspace;
+      break;
+    case 'u':
+      if (strcmp (name + 1, "pper") == 0)
+        return (wctype_t) iswupper;
+      break;
+    case 'x':
+      if (strcmp (name + 1, "digit") == 0)
+        return (wctype_t) iswxdigit;
+      break;
+    default:
+      break;
+    }
+  return NULL;
+}
deleted file mode 120000 (symlink)
index 1a3d093308af2a3525a01d417fa1540b964f8662..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wctype.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..914f6847d9a342d529fb54c2e63365971325d8f3
--- /dev/null
@@ -0,0 +1,25 @@
+/* Get descriptor for a wide character property.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wctype.h>
+
+#include <string.h>
+
+#include "wctype-impl.h"
deleted file mode 120000 (symlink)
index 6ae1c498c00fd30e6d6551c6816e843e81c61e91..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wctype.in.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..851c4f4eb21b85a5ced81de0ab25724be15edd9b
--- /dev/null
@@ -0,0 +1,797 @@
+/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible and Paul Eggert.  */
+
+/*
+ * ISO C 99 <wctype.h> for platforms that lack it.
+ * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html>
+ *
+ * iswctype, towctrans, towlower, towupper, wctrans, wctype,
+ * wctrans_t, and wctype_t are not yet implemented.
+ */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if (defined __MINGW32__ && defined __CTYPE_H_SOURCED__)
+
+/* Special invocation convention:
+   - With MinGW 3.22, when <ctype.h> includes <wctype.h>, only some part of
+     <wctype.h> is being processed, which doesn't include the idempotency
+     guard.   */
+
+#@INCLUDE_NEXT@ @NEXT_WCTYPE_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_WCTYPE_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK,
+   HAVE_RAW_DECL_*.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#if @HAVE_WINT_T@
+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */
+# include <wchar.h>
+#endif
+
+/* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and
+   isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>.  Include
+   <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the
+   declarations.  */
+#if defined _WIN32 && ! defined __CYGWIN__
+# include <ctype.h>
+# include <wchar.h>
+#endif
+
+/* Include the original <wctype.h> if it exists.
+   BeOS 5 has the functions but no <wctype.h>.  */
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_WCTYPE_H@
+# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
+#endif
+
+#ifndef _@GUARD_PREFIX@_WCTYPE_H
+#define _@GUARD_PREFIX@_WCTYPE_H
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_WCTYPE_INLINE
+# define _GL_WCTYPE_INLINE _GL_INLINE
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
+   #defines a number of identifiers in the application namespace.  Revert
+   these #defines.  */
+#ifdef __sun
+# undef multibyte
+# undef eucw1
+# undef eucw2
+# undef eucw3
+# undef scrw1
+# undef scrw2
+# undef scrw3
+#endif
+
+/* Define wint_t and WEOF.  (Also done in wchar.in.h.)  */
+#if !@HAVE_WINT_T@ && !defined wint_t
+# define wint_t int
+# ifndef WEOF
+#  define WEOF -1
+# endif
+#else
+/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
+   <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
+   wint_t must be "unchanged by default argument promotions".  Override it.  */
+# if @GNULIBHEADERS_OVERRIDE_WINT_T@
+#  if !GNULIB_defined_wint_t
+#   if @HAVE_CRTDEFS_H@
+#    include <crtdefs.h>
+#   else
+#    include <stddef.h>
+#   endif
+typedef unsigned int rpl_wint_t;
+#   undef wint_t
+#   define wint_t rpl_wint_t
+#   define GNULIB_defined_wint_t 1
+#  endif
+# endif
+# ifndef WEOF
+#  define WEOF ((wint_t) -1)
+# endif
+#endif
+
+
+#if !GNULIB_defined_wctype_functions
+
+/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
+   Linux libc5 has <wctype.h> and the functions but they are broken.
+   mingw and MSVC have <wctype.h> and the functions but they take a wchar_t
+   as argument, not an rpl_wint_t.  Additionally, the mingw iswprint function
+   and the Android iswpunct function are broken.
+   Assume all 11 functions (all isw* except iswblank) are implemented the
+   same way, or not at all.  */
+# if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
+
+#  if @GNULIBHEADERS_OVERRIDE_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */
+
+_GL_WCTYPE_INLINE int
+rpl_iswalnum (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? iswalnum ((wchar_t) wc) : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswalpha (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? iswalpha ((wchar_t) wc) : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswblank (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? iswblank ((wchar_t) wc) : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswcntrl (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? iswcntrl ((wchar_t) wc) : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswdigit (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? wc >= '0' && wc <= '9' : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswgraph (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? iswgraph ((wchar_t) wc) : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswlower (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? iswlower ((wchar_t) wc) : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswprint (wint_t wc)
+{
+#   ifdef __MINGW32__
+  return ((wchar_t) wc == wc ? wc == ' ' || iswgraph ((wchar_t) wc) : 0);
+#   else
+  return ((wchar_t) wc == wc ? iswprint ((wchar_t) wc) : 0);
+#   endif
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswpunct (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? iswpunct ((wchar_t) wc) : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswspace (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? iswspace ((wchar_t) wc) : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswupper (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? iswupper ((wchar_t) wc) : 0);
+}
+
+_GL_WCTYPE_INLINE int
+rpl_iswxdigit (wint_t wc)
+{
+  return ((wchar_t) wc == wc
+          ? (wc >= '0' && wc <= '9')
+            || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')
+          : 0);
+}
+
+_GL_WCTYPE_INLINE wint_t
+rpl_towlower (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? (wchar_t) towlower ((wchar_t) wc) : wc);
+}
+
+_GL_WCTYPE_INLINE wint_t
+rpl_towupper (wint_t wc)
+{
+  return ((wchar_t) wc == wc ? (wchar_t) towupper ((wchar_t) wc) : wc);
+}
+
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef iswalnum
+#    undef iswalpha
+#    undef iswblank
+#    undef iswcntrl
+#    undef iswdigit
+#    undef iswgraph
+#    undef iswlower
+#    undef iswprint
+#    undef iswpunct
+#    undef iswspace
+#    undef iswupper
+#    undef iswxdigit
+#    undef towlower
+#    undef towupper
+#    define iswalnum rpl_iswalnum
+#    define iswalpha rpl_iswalpha
+#    define iswblank rpl_iswblank
+#    define iswcntrl rpl_iswcntrl
+#    define iswdigit rpl_iswdigit
+#    define iswgraph rpl_iswgraph
+#    define iswlower rpl_iswlower
+#    define iswprint rpl_iswprint
+#    define iswpunct rpl_iswpunct
+#    define iswspace rpl_iswspace
+#    define iswupper rpl_iswupper
+#    define iswxdigit rpl_iswxdigit
+#    define towlower rpl_towlower
+#    define towupper rpl_towupper
+#   endif
+
+#  else
+
+/* IRIX 5.3 has macros but no functions, its isw* macros refer to an
+   undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
+   refer to system functions like _iswctype that are not in the
+   standard C library.  Rather than try to get ancient buggy
+   implementations like this to work, just disable them.  */
+#   undef iswalnum
+#   undef iswalpha
+#   undef iswblank
+#   undef iswcntrl
+#   undef iswdigit
+#   undef iswgraph
+#   undef iswlower
+#   undef iswprint
+#   undef iswpunct
+#   undef iswspace
+#   undef iswupper
+#   undef iswxdigit
+#   undef towlower
+#   undef towupper
+
+/* Linux libc5 has <wctype.h> and the functions but they are broken.  */
+#   if @REPLACE_ISWCNTRL@
+#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#     define iswalnum rpl_iswalnum
+#     define iswalpha rpl_iswalpha
+#     define iswblank rpl_iswblank
+#     define iswcntrl rpl_iswcntrl
+#     define iswdigit rpl_iswdigit
+#     define iswgraph rpl_iswgraph
+#     define iswlower rpl_iswlower
+#     define iswprint rpl_iswprint
+#     define iswpunct rpl_iswpunct
+#     define iswspace rpl_iswspace
+#     define iswupper rpl_iswupper
+#     define iswxdigit rpl_iswxdigit
+#    endif
+#   endif
+#   if @REPLACE_TOWLOWER@
+#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#     define towlower rpl_towlower
+#     define towupper rpl_towupper
+#    endif
+#   endif
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswalnum
+#   else
+iswalnum
+#   endif
+         (wint_t wc)
+{
+  return ((wc >= '0' && wc <= '9')
+          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswalpha
+#   else
+iswalpha
+#   endif
+         (wint_t wc)
+{
+  return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswblank
+#   else
+iswblank
+#   endif
+         (wint_t wc)
+{
+  return wc == ' ' || wc == '\t';
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswcntrl
+#   else
+iswcntrl
+#   endif
+        (wint_t wc)
+{
+  return (wc & ~0x1f) == 0 || wc == 0x7f;
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWDIGIT@
+rpl_iswdigit
+#   else
+iswdigit
+#   endif
+         (wint_t wc)
+{
+  return wc >= '0' && wc <= '9';
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswgraph
+#   else
+iswgraph
+#   endif
+         (wint_t wc)
+{
+  return wc >= '!' && wc <= '~';
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswlower
+#   else
+iswlower
+#   endif
+         (wint_t wc)
+{
+  return wc >= 'a' && wc <= 'z';
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswprint
+#   else
+iswprint
+#   endif
+         (wint_t wc)
+{
+  return wc >= ' ' && wc <= '~';
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswpunct
+#   else
+iswpunct
+#   endif
+         (wint_t wc)
+{
+  return (wc >= '!' && wc <= '~'
+          && !((wc >= '0' && wc <= '9')
+               || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswspace
+#   else
+iswspace
+#   endif
+         (wint_t wc)
+{
+  return (wc == ' ' || wc == '\t'
+          || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWCNTRL@
+rpl_iswupper
+#   else
+iswupper
+#   endif
+         (wint_t wc)
+{
+  return wc >= 'A' && wc <= 'Z';
+}
+
+_GL_WCTYPE_INLINE int
+#   if @REPLACE_ISWXDIGIT@
+rpl_iswxdigit
+#   else
+iswxdigit
+#   endif
+          (wint_t wc)
+{
+  return ((wc >= '0' && wc <= '9')
+          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
+}
+
+_GL_WCTYPE_INLINE wint_t
+#   if @REPLACE_TOWLOWER@
+rpl_towlower
+#   else
+towlower
+#   endif
+         (wint_t wc)
+{
+  return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
+}
+
+_GL_WCTYPE_INLINE wint_t
+#   if @REPLACE_TOWLOWER@
+rpl_towupper
+#   else
+towupper
+#   endif
+         (wint_t wc)
+{
+  return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
+}
+
+#  endif
+
+# else
+/* Only some of the functions are missing or broken.  */
+
+#  if @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@)
+/* Only the iswblank function is missing.  */
+#   if @REPLACE_ISWBLANK@
+#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#     define iswblank rpl_iswblank
+#    endif
+_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
+#   else
+_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
+#   endif
+#  endif
+
+#  if @GNULIB_ISWDIGIT@
+#   if @REPLACE_ISWDIGIT@
+#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#     undef iswdigit
+#     define iswdigit rpl_iswdigit
+#    endif
+_GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc));
+#   endif
+#  endif
+
+#  if @GNULIB_ISWPUNCT@
+#   if @REPLACE_ISWPUNCT@
+#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#     undef iswpunct
+#     define iswpunct rpl_iswpunct
+#    endif
+_GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc));
+#   endif
+#  endif
+
+#  if @GNULIB_ISWXDIGIT@
+#   if @REPLACE_ISWXDIGIT@
+#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#     undef iswxdigit
+#     define iswxdigit rpl_iswxdigit
+#    endif
+_GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc));
+#   endif
+#  endif
+
+# endif
+
+# if defined __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@
+
+/* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
+   The functions towlower and towupper are implemented in the MSVCRT library
+   to take a wchar_t argument and return a wchar_t result.  mingw declares
+   these functions to take a wint_t argument and return a wint_t result.
+   This means that:
+   1. When the user passes an argument outside the range 0x0000..0xFFFF, the
+      function will look only at the lower 16 bits.  This is allowed according
+      to POSIX.
+   2. The return value is returned in the lower 16 bits of the result register.
+      The upper 16 bits are random: whatever happened to be in that part of the
+      result register.  We need to fix this by adding a zero-extend from
+      wchar_t to wint_t after the call.  */
+
+_GL_WCTYPE_INLINE wint_t
+rpl_towlower (wint_t wc)
+{
+  return (wint_t) (wchar_t) towlower (wc);
+}
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define towlower rpl_towlower
+#  endif
+
+_GL_WCTYPE_INLINE wint_t
+rpl_towupper (wint_t wc)
+{
+  return (wint_t) (wchar_t) towupper (wc);
+}
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define towupper rpl_towupper
+#  endif
+
+# endif /* __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ */
+
+# define GNULIB_defined_wctype_functions 1
+#endif
+
+#if @REPLACE_ISWCNTRL@
+_GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
+#endif
+#if @REPLACE_ISWCNTRL@
+_GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
+#endif
+#if @REPLACE_ISWCNTRL@
+_GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
+#endif
+#if @GNULIB_ISWDIGIT@
+# if @REPLACE_ISWDIGIT@
+_GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
+# else
+_GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
+# endif
+#endif
+#if @REPLACE_ISWCNTRL@
+_GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
+#endif
+#if @REPLACE_ISWCNTRL@
+_GL_CXXALIAS_RPL (iswlower, int, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (iswlower, int, (wint_t wc));
+#endif
+#if @REPLACE_ISWCNTRL@
+_GL_CXXALIAS_RPL (iswprint, int, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (iswprint, int, (wint_t wc));
+#endif
+#if @REPLACE_ISWCNTRL@
+_GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc));
+#endif
+#if @REPLACE_ISWCNTRL@
+_GL_CXXALIAS_RPL (iswspace, int, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
+#endif
+#if @REPLACE_ISWCNTRL@
+_GL_CXXALIAS_RPL (iswupper, int, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
+#endif
+#if @GNULIB_ISWXDIGIT@
+# if @REPLACE_ISWXDIGIT@
+_GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
+# else
+_GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
+# endif
+#endif
+#if __GLIBC__ >= 2
+_GL_CXXALIASWARN (iswalnum);
+_GL_CXXALIASWARN (iswalpha);
+_GL_CXXALIASWARN (iswcntrl);
+_GL_CXXALIASWARN (iswdigit);
+_GL_CXXALIASWARN (iswgraph);
+_GL_CXXALIASWARN (iswlower);
+_GL_CXXALIASWARN (iswprint);
+_GL_CXXALIASWARN (iswpunct);
+_GL_CXXALIASWARN (iswspace);
+_GL_CXXALIASWARN (iswupper);
+_GL_CXXALIASWARN (iswxdigit);
+#endif
+
+#if @GNULIB_ISWBLANK@
+# if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@
+_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
+# else
+_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (iswblank);
+# endif
+#endif
+
+#if !@HAVE_WCTYPE_T@
+# if !GNULIB_defined_wctype_t
+typedef void * wctype_t;
+#  define GNULIB_defined_wctype_t 1
+# endif
+#elif @REPLACE_WCTYPE@
+# if !GNULIB_defined_wctype_t
+typedef void *rpl_wctype_t;
+#  undef wctype_t
+#  define wctype_t rpl_wctype_t
+#  define GNULIB_defined_wctype_t 1
+# endif
+#endif
+
+/* Get a descriptor for a wide character property.  */
+#if @GNULIB_WCTYPE@
+# if @REPLACE_WCTYPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wctype
+#   define wctype rpl_wctype
+#  endif
+_GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name)
+                                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name));
+# else
+#  if !@HAVE_WCTYPE_T@
+_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)
+                                    _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wctype);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wctype
+# if HAVE_RAW_DECL_WCTYPE
+_GL_WARN_ON_USE (wctype, "wctype is unportable - "
+                 "use gnulib module wctype for portability");
+# endif
+#endif
+
+/* Test whether a wide character has a given property.
+   The argument WC must be either a wchar_t value or WEOF.
+   The argument DESC must have been returned by the wctype() function.  */
+#if @GNULIB_ISWCTYPE@
+# if @GNULIBHEADERS_OVERRIDE_WINT_T@ || @REPLACE_WCTYPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef iswctype
+#   define iswctype rpl_iswctype
+#  endif
+_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc));
+_GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc));
+# else
+#  if !@HAVE_WCTYPE_T@
+_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
+#  endif
+_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (iswctype);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef iswctype
+# if HAVE_RAW_DECL_ISWCTYPE
+_GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
+                 "use gnulib module iswctype for portability");
+# endif
+#endif
+
+#if @REPLACE_TOWLOWER@ || defined __MINGW32__
+_GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
+_GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
+#else
+_GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
+_GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
+#endif
+#if __GLIBC__ >= 2
+_GL_CXXALIASWARN (towlower);
+_GL_CXXALIASWARN (towupper);
+#endif
+
+#if !@HAVE_WCTRANS_T@
+# if !GNULIB_defined_wctrans_t
+typedef void * wctrans_t;
+#  define GNULIB_defined_wctrans_t 1
+# endif
+#elif @REPLACE_WCTRANS@
+# if !GNULIB_defined_wctrans_t
+typedef void *rpl_wctrans_t;
+#  undef wctrans_t
+#  define wctrans_t rpl_wctrans_t
+#  define GNULIB_defined_wctrans_t 1
+# endif
+#endif
+
+/* Get a descriptor for a wide character case conversion.  */
+#if @GNULIB_WCTRANS@
+# if @REPLACE_WCTRANS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wctrans
+#   define wctrans rpl_wctrans
+#  endif
+_GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name)
+                                      _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name));
+# else
+#  if !@HAVE_WCTRANS_T@
+_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)
+                                      _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wctrans);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wctrans
+# if HAVE_RAW_DECL_WCTRANS
+_GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
+                 "use gnulib module wctrans for portability");
+# endif
+#endif
+
+/* Perform a given case conversion on a wide character.
+   The argument WC must be either a wchar_t value or WEOF.
+   The argument DESC must have been returned by the wctrans() function.  */
+#if @GNULIB_TOWCTRANS@
+# if @REPLACE_WCTRANS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef towctrans
+#   define towctrans rpl_towctrans
+#  endif
+_GL_FUNCDECL_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc));
+_GL_CXXALIAS_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc));
+# else
+#  if !@HAVE_WCTRANS_T@
+_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
+#  endif
+_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (towctrans);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef towctrans
+# if HAVE_RAW_DECL_TOWCTRANS
+_GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
+                 "use gnulib module towctrans for portability");
+# endif
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* _@GUARD_PREFIX@_WCTYPE_H */
+#endif /* _@GUARD_PREFIX@_WCTYPE_H */
+#endif
deleted file mode 120000 (symlink)
index b1ee0e3fdedfd41d4bca8a2572e3888b01c1be66..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wcwidth.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..328a89306c924f2df105465a4f23c8e786ae78d9
--- /dev/null
@@ -0,0 +1,73 @@
+/* Determine the number of screen columns needed for a character.
+   Copyright (C) 2006-2007, 2010-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+/* Get iswprint.  */
+#include <wctype.h>
+
+#include "localcharset.h"
+#include "streq.h"
+#include "uniwidth.h"
+
+/* Returns 1 if the current locale is an UTF-8 locale, 0 otherwise.  */
+static inline int
+is_locale_utf8 (void)
+{
+  const char *encoding = locale_charset ();
+  return STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0);
+}
+
+#if GNULIB_WCHAR_SINGLE_LOCALE
+/* When we know that the locale does not change, provide a speedup by
+   caching the value of is_locale_utf8.  */
+static int cached_is_locale_utf8 = -1;
+static inline int
+is_locale_utf8_cached (void)
+{
+  if (cached_is_locale_utf8 < 0)
+    cached_is_locale_utf8 = is_locale_utf8 ();
+  return cached_is_locale_utf8;
+}
+#else
+/* By default, don't make assumptions, hence no caching.  */
+# define is_locale_utf8_cached is_locale_utf8
+#endif
+
+int
+wcwidth (wchar_t wc)
+#undef wcwidth
+{
+  /* In UTF-8 locales, use a Unicode aware width function.  */
+  if (is_locale_utf8_cached ())
+    {
+      /* We assume that in a UTF-8 locale, a wide character is the same as a
+         Unicode character.  */
+      return uc_width (wc, "UTF-8");
+    }
+  else
+    {
+      /* Otherwise, fall back to the system's wcwidth function.  */
+#if HAVE_WCWIDTH
+      return wcwidth (wc);
+#else
+      return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
+#endif
+    }
+}
deleted file mode 120000 (symlink)
index fffc75a362119125a748f8e64b5e5faa0580a552..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-cond.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5d04d51c43e6ee29bdde0f9282d0594575bf90ed
--- /dev/null
@@ -0,0 +1,428 @@
+/* Condition variables (native Windows implementation).
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Yoann Vandoorselaere <yoann@prelude-ids.org>, 2008,
+   and Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "windows-cond.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+/* Don't assume that UNICODE is not defined.  */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
+/* In this file, the waitqueues are implemented as linked lists.  */
+#define glwthread_waitqueue_t glwthread_linked_waitqueue_t
+
+/* All links of a circular list, except the anchor, are of this type, carrying
+   a payload.  */
+struct glwthread_waitqueue_element
+{
+  struct glwthread_waitqueue_link link; /* must be the first field! */
+  HANDLE event; /* Waiting thread, represented by an event.
+                   This field is immutable once initialized. */
+};
+
+static void
+glwthread_waitqueue_init (glwthread_waitqueue_t *wq)
+{
+  wq->wq_list.wql_next = &wq->wq_list;
+  wq->wq_list.wql_prev = &wq->wq_list;
+}
+
+/* Enqueues the current thread, represented by an event, in a wait queue.
+   Returns NULL if an allocation failure occurs.  */
+static struct glwthread_waitqueue_element *
+glwthread_waitqueue_add (glwthread_waitqueue_t *wq)
+{
+  struct glwthread_waitqueue_element *elt;
+  HANDLE event;
+
+  /* Allocate the memory for the waitqueue element on the heap, not on the
+     thread's stack.  If the thread exits unexpectedly, we prefer to leak
+     some memory rather than to access unavailable memory and crash.  */
+  elt =
+    (struct glwthread_waitqueue_element *)
+    malloc (sizeof (struct glwthread_waitqueue_element));
+  if (elt == NULL)
+    /* No more memory.  */
+    return NULL;
+
+  /* Whether the created event is a manual-reset one or an auto-reset one,
+     does not matter, since we will wait on it only once.  */
+  event = CreateEvent (NULL, TRUE, FALSE, NULL);
+  if (event == INVALID_HANDLE_VALUE)
+    {
+      /* No way to allocate an event.  */
+      free (elt);
+      return NULL;
+    }
+  elt->event = event;
+  /* Insert elt at the end of the circular list.  */
+  (elt->link.wql_prev = wq->wq_list.wql_prev)->wql_next = &elt->link;
+  (elt->link.wql_next = &wq->wq_list)->wql_prev = &elt->link;
+  return elt;
+}
+
+/* Removes the current thread, represented by a
+   'struct glwthread_waitqueue_element *', from a wait queue.
+   Returns true if is was found and removed, false if it was not present.  */
+static bool
+glwthread_waitqueue_remove (glwthread_waitqueue_t *wq,
+                            struct glwthread_waitqueue_element *elt)
+{
+  if (elt->link.wql_next != NULL && elt->link.wql_prev != NULL)
+    {
+      /* Remove elt from the circular list.  */
+      struct glwthread_waitqueue_link *prev = elt->link.wql_prev;
+      struct glwthread_waitqueue_link *next = elt->link.wql_next;
+      prev->wql_next = next;
+      next->wql_prev = prev;
+      elt->link.wql_next = NULL;
+      elt->link.wql_prev = NULL;
+      return true;
+    }
+  else
+    return false;
+}
+
+/* Notifies the first thread from a wait queue and dequeues it.  */
+static void
+glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq)
+{
+  if (wq->wq_list.wql_next != &wq->wq_list)
+    {
+      struct glwthread_waitqueue_element *elt =
+        (struct glwthread_waitqueue_element *) wq->wq_list.wql_next;
+      struct glwthread_waitqueue_link *prev;
+      struct glwthread_waitqueue_link *next;
+
+      /* Remove elt from the circular list.  */
+      prev = &wq->wq_list; /* = elt->link.wql_prev; */
+      next = elt->link.wql_next;
+      prev->wql_next = next;
+      next->wql_prev = prev;
+      elt->link.wql_next = NULL;
+      elt->link.wql_prev = NULL;
+
+      SetEvent (elt->event);
+      /* After the SetEvent, this thread cannot access *elt any more, because
+         the woken-up thread will quickly call  free (elt).  */
+    }
+}
+
+/* Notifies all threads from a wait queue and dequeues them all.  */
+static void
+glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq)
+{
+  struct glwthread_waitqueue_link *l;
+
+  for (l = wq->wq_list.wql_next; l != &wq->wq_list; )
+    {
+      struct glwthread_waitqueue_element *elt =
+        (struct glwthread_waitqueue_element *) l;
+      struct glwthread_waitqueue_link *prev;
+      struct glwthread_waitqueue_link *next;
+
+      /* Remove elt from the circular list.  */
+      prev = &wq->wq_list; /* = elt->link.wql_prev; */
+      next = elt->link.wql_next;
+      prev->wql_next = next;
+      next->wql_prev = prev;
+      elt->link.wql_next = NULL;
+      elt->link.wql_prev = NULL;
+
+      SetEvent (elt->event);
+      /* After the SetEvent, this thread cannot access *elt any more, because
+         the woken-up thread will quickly call  free (elt).  */
+
+      l = next;
+    }
+  if (!(wq->wq_list.wql_next == &wq->wq_list
+        && wq->wq_list.wql_prev == &wq->wq_list))
+    abort ();
+}
+
+int
+glwthread_cond_init (glwthread_cond_t *cond)
+{
+  InitializeCriticalSection (&cond->lock);
+  glwthread_waitqueue_init (&cond->waiters);
+
+  cond->guard.done = 1;
+  return 0;
+}
+
+int
+glwthread_cond_wait (glwthread_cond_t *cond,
+                     void *mutex, int (*mutex_lock) (void *), int (*mutex_unlock) (void *))
+{
+  if (!cond->guard.done)
+    {
+      if (InterlockedIncrement (&cond->guard.started) == 0)
+        /* This thread is the first one to need this condition variable.
+           Initialize it.  */
+        glwthread_cond_init (cond);
+      else
+        {
+          /* Don't let cond->guard.started grow and wrap around.  */
+          InterlockedDecrement (&cond->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this condition variable.  */
+          while (!cond->guard.done)
+            Sleep (0);
+        }
+    }
+
+  EnterCriticalSection (&cond->lock);
+  {
+    struct glwthread_waitqueue_element *elt =
+      glwthread_waitqueue_add (&cond->waiters);
+    LeaveCriticalSection (&cond->lock);
+    if (elt == NULL)
+      {
+        /* Allocation failure.  Weird.  */
+        return EAGAIN;
+      }
+    else
+      {
+        HANDLE event = elt->event;
+        int err;
+        DWORD result;
+
+        /* Now release the mutex and let any other thread take it.  */
+        err = mutex_unlock (mutex);
+        if (err != 0)
+          {
+            EnterCriticalSection (&cond->lock);
+            glwthread_waitqueue_remove (&cond->waiters, elt);
+            LeaveCriticalSection (&cond->lock);
+            CloseHandle (event);
+            free (elt);
+            return err;
+          }
+        /* POSIX says:
+            "If another thread is able to acquire the mutex after the
+             about-to-block thread has released it, then a subsequent call to
+             pthread_cond_broadcast() or pthread_cond_signal() in that thread
+             shall behave as if it were issued after the about-to-block thread
+             has blocked."
+           This is fulfilled here, because the thread signalling is done
+           through SetEvent, not PulseEvent.  */
+        /* Wait until another thread signals this event.  */
+        result = WaitForSingleObject (event, INFINITE);
+        if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
+          abort ();
+        CloseHandle (event);
+        free (elt);
+        /* The thread which signalled the event already did the bookkeeping:
+           removed us from the waiters.  */
+        return mutex_lock (mutex);
+      }
+  }
+}
+
+int
+glwthread_cond_timedwait (glwthread_cond_t *cond,
+                          void *mutex, int (*mutex_lock) (void *), int (*mutex_unlock) (void *),
+                          const struct timespec *abstime)
+{
+  if (!cond->guard.done)
+    {
+      if (InterlockedIncrement (&cond->guard.started) == 0)
+        /* This thread is the first one to need this condition variable.
+           Initialize it.  */
+        glwthread_cond_init (cond);
+      else
+        {
+          /* Don't let cond->guard.started grow and wrap around.  */
+          InterlockedDecrement (&cond->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this condition variable.  */
+          while (!cond->guard.done)
+            Sleep (0);
+        }
+    }
+
+  {
+    struct timeval currtime;
+
+    gettimeofday (&currtime, NULL);
+    if (currtime.tv_sec > abstime->tv_sec
+        || (currtime.tv_sec == abstime->tv_sec
+            && currtime.tv_usec * 1000 >= abstime->tv_nsec))
+      return ETIMEDOUT;
+
+    EnterCriticalSection (&cond->lock);
+    {
+      struct glwthread_waitqueue_element *elt =
+        glwthread_waitqueue_add (&cond->waiters);
+      LeaveCriticalSection (&cond->lock);
+      if (elt == NULL)
+        {
+          /* Allocation failure.  Weird.  */
+          return EAGAIN;
+        }
+      else
+        {
+          HANDLE event = elt->event;
+          int err;
+          DWORD timeout;
+          DWORD result;
+
+          /* Now release the mutex and let any other thread take it.  */
+          err = mutex_unlock (mutex);
+          if (err != 0)
+            {
+              EnterCriticalSection (&cond->lock);
+              glwthread_waitqueue_remove (&cond->waiters, elt);
+              LeaveCriticalSection (&cond->lock);
+              CloseHandle (event);
+              free (elt);
+              return err;
+            }
+          /* POSIX says:
+              "If another thread is able to acquire the mutex after the
+               about-to-block thread has released it, then a subsequent call to
+               pthread_cond_broadcast() or pthread_cond_signal() in that thread
+               shall behave as if it were issued after the about-to-block thread
+               has blocked."
+             This is fulfilled here, because the thread signalling is done
+             through SetEvent, not PulseEvent.  */
+          /* Wait until another thread signals this event or until the abstime
+             passes.  */
+          gettimeofday (&currtime, NULL);
+          if (currtime.tv_sec > abstime->tv_sec)
+            timeout = 0;
+          else
+            {
+              unsigned long seconds = abstime->tv_sec - currtime.tv_sec;
+              timeout = seconds * 1000;
+              if (timeout / 1000 != seconds) /* overflow? */
+                timeout = INFINITE;
+              else
+                {
+                  long milliseconds =
+                    abstime->tv_nsec / 1000000 - currtime.tv_usec / 1000;
+                  if (milliseconds >= 0)
+                    {
+                      timeout += milliseconds;
+                      if (timeout < milliseconds) /* overflow? */
+                        timeout = INFINITE;
+                    }
+                  else
+                    {
+                      if (timeout >= - milliseconds)
+                        timeout -= (- milliseconds);
+                      else
+                        timeout = 0;
+                    }
+                }
+            }
+          result = WaitForSingleObject (event, timeout);
+          if (result == WAIT_FAILED)
+            abort ();
+          if (result == WAIT_TIMEOUT)
+            {
+              EnterCriticalSection (&cond->lock);
+              if (glwthread_waitqueue_remove (&cond->waiters, elt))
+                {
+                  /* The event was not signaled between the WaitForSingleObject
+                     call and the EnterCriticalSection call.  */
+                  if (!(WaitForSingleObject (event, 0) == WAIT_TIMEOUT))
+                    abort ();
+                }
+              else
+                {
+                  /* The event was signaled between the WaitForSingleObject
+                     call and the EnterCriticalSection call.  */
+                  if (!(WaitForSingleObject (event, 0) == WAIT_OBJECT_0))
+                    abort ();
+                  /* Produce the right return value.  */
+                  result = WAIT_OBJECT_0;
+                }
+              LeaveCriticalSection (&cond->lock);
+            }
+          else
+            {
+              /* The thread which signalled the event already did the
+                 bookkeeping: removed us from the waiters.  */
+            }
+          CloseHandle (event);
+          free (elt);
+          /* Take the mutex again.  It does not matter whether this is done
+             before or after the bookkeeping for WAIT_TIMEOUT.  */
+          err = mutex_lock (mutex);
+          return (err ? err :
+                  result == WAIT_OBJECT_0 ? 0 :
+                  result == WAIT_TIMEOUT ? ETIMEDOUT :
+                  /* WAIT_FAILED shouldn't happen */ EAGAIN);
+        }
+    }
+  }
+}
+
+int
+glwthread_cond_signal (glwthread_cond_t *cond)
+{
+  if (!cond->guard.done)
+    return EINVAL;
+
+  EnterCriticalSection (&cond->lock);
+  /* POSIX says:
+      "The pthread_cond_broadcast() and pthread_cond_signal() functions shall
+       have no effect if there are no threads currently blocked on cond."  */
+  if (cond->waiters.wq_list.wql_next != &cond->waiters.wq_list)
+    glwthread_waitqueue_notify_first (&cond->waiters);
+  LeaveCriticalSection (&cond->lock);
+
+  return 0;
+}
+
+int
+glwthread_cond_broadcast (glwthread_cond_t *cond)
+{
+  if (!cond->guard.done)
+    return EINVAL;
+
+  EnterCriticalSection (&cond->lock);
+  /* POSIX says:
+      "The pthread_cond_broadcast() and pthread_cond_signal() functions shall
+       have no effect if there are no threads currently blocked on cond."
+     glwthread_waitqueue_notify_all is a nop in this case.  */
+  glwthread_waitqueue_notify_all (&cond->waiters);
+  LeaveCriticalSection (&cond->lock);
+
+  return 0;
+}
+
+int
+glwthread_cond_destroy (glwthread_cond_t *cond)
+{
+  if (!cond->guard.done)
+    return EINVAL;
+  if (cond->waiters.wq_list.wql_next != &cond->waiters.wq_list)
+    return EBUSY;
+  DeleteCriticalSection (&cond->lock);
+  cond->guard.done = 0;
+  return 0;
+}
deleted file mode 120000 (symlink)
index eb4791d26a3911d32a59c8c94913e917b453e855..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-cond.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cfc160f5b9165332c0a19ca39c8902e53fcf6bcc
--- /dev/null
@@ -0,0 +1,79 @@
+/* Condition variables (native Windows implementation).
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Yoann Vandoorselaere <yoann@prelude-ids.org>, 2008.
+   Based on Bruno Haible <bruno@clisp.org> lock.h */
+
+#ifndef _WINDOWS_COND_H
+#define _WINDOWS_COND_H
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+#include <time.h>
+
+#include "windows-initguard.h"
+
+#ifndef _glwthread_linked_waitqueue_link_defined
+#define _glwthread_linked_waitqueue_link_defined
+struct glwthread_waitqueue_link
+{
+  struct glwthread_waitqueue_link *wql_next;
+  struct glwthread_waitqueue_link *wql_prev;
+};
+#endif /* _glwthread_linked_waitqueue_link_defined */
+
+typedef struct
+        {
+          struct glwthread_waitqueue_link wq_list; /* circular list of waiting threads */
+        }
+        glwthread_linked_waitqueue_t;
+
+typedef struct
+        {
+          glwthread_initguard_t guard; /* protects the initialization */
+          CRITICAL_SECTION lock; /* protects the remaining fields */
+          glwthread_linked_waitqueue_t waiters; /* waiting threads */
+        }
+        glwthread_cond_t;
+
+#define GLWTHREAD_COND_INIT { GLWTHREAD_INITGUARD_INIT }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int glwthread_cond_init (glwthread_cond_t *cond);
+/* Here, to cope with the various types of mutexes, the mutex is a 'void *', and
+   the caller needs to pass the corresponding *_lock and *_unlock functions.  */
+extern int glwthread_cond_wait (glwthread_cond_t *cond,
+                                void *mutex,
+                                int (*mutex_lock) (void *),
+                                int (*mutex_unlock) (void *));
+extern int glwthread_cond_timedwait (glwthread_cond_t *cond,
+                                     void *mutex,
+                                     int (*mutex_lock) (void *),
+                                     int (*mutex_unlock) (void *),
+                                     const struct timespec *abstime);
+extern int glwthread_cond_signal (glwthread_cond_t *cond);
+extern int glwthread_cond_broadcast (glwthread_cond_t *cond);
+extern int glwthread_cond_destroy (glwthread_cond_t *cond);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_COND_H */
deleted file mode 120000 (symlink)
index fd4a453aac6b6610b84c89c3d4fedb7908031c1e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-initguard.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6bace3f047cbba5868c63993f0a1ba6885e39f7f
--- /dev/null
@@ -0,0 +1,35 @@
+/* Init guards, somewhat like spinlocks (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#ifndef _WINDOWS_INITGUARD_H
+#define _WINDOWS_INITGUARD_H
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+typedef struct
+        {
+          volatile int done;
+          volatile LONG started;
+        }
+        glwthread_initguard_t;
+
+#define GLWTHREAD_INITGUARD_INIT { 0, -1 }
+
+#endif /* _WINDOWS_INITGUARD_H */
deleted file mode 120000 (symlink)
index 665d35c437b3bd5ea5958d29544ef28db16d88f4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-mutex.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b112e13b6b9ec913afcf53b5f556735e907cd180
--- /dev/null
@@ -0,0 +1,95 @@
+/* Plain mutexes (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "windows-mutex.h"
+
+#include <errno.h>
+
+void
+glwthread_mutex_init (glwthread_mutex_t *mutex)
+{
+  InitializeCriticalSection (&mutex->lock);
+  mutex->guard.done = 1;
+}
+
+int
+glwthread_mutex_lock (glwthread_mutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        /* This thread is the first one to need this mutex.  Initialize it.  */
+        glwthread_mutex_init (mutex);
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this mutex.  */
+          while (!mutex->guard.done)
+            Sleep (0);
+        }
+    }
+  EnterCriticalSection (&mutex->lock);
+  return 0;
+}
+
+int
+glwthread_mutex_trylock (glwthread_mutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        /* This thread is the first one to need this mutex.  Initialize it.  */
+        glwthread_mutex_init (mutex);
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Let another thread finish initializing this mutex, and let it also
+             lock this mutex.  */
+          return EBUSY;
+        }
+    }
+  if (!TryEnterCriticalSection (&mutex->lock))
+    return EBUSY;
+  return 0;
+}
+
+int
+glwthread_mutex_unlock (glwthread_mutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    return EINVAL;
+  LeaveCriticalSection (&mutex->lock);
+  return 0;
+}
+
+int
+glwthread_mutex_destroy (glwthread_mutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    return EINVAL;
+  DeleteCriticalSection (&mutex->lock);
+  mutex->guard.done = 0;
+  return 0;
+}
deleted file mode 120000 (symlink)
index 65b483478e6e1bc0ae1f2aa44af4aacb4ee9a387..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-mutex.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..88de4bdcadd00a4be076769e449ba6266cd10e5c
--- /dev/null
@@ -0,0 +1,51 @@
+/* Plain mutexes (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#ifndef _WINDOWS_MUTEX_H
+#define _WINDOWS_MUTEX_H
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+#include "windows-initguard.h"
+
+typedef struct
+        {
+          glwthread_initguard_t guard; /* protects the initialization */
+          CRITICAL_SECTION lock;
+        }
+        glwthread_mutex_t;
+
+#define GLWTHREAD_MUTEX_INIT { GLWTHREAD_INITGUARD_INIT }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void glwthread_mutex_init (glwthread_mutex_t *mutex);
+extern int glwthread_mutex_lock (glwthread_mutex_t *mutex);
+extern int glwthread_mutex_trylock (glwthread_mutex_t *mutex);
+extern int glwthread_mutex_unlock (glwthread_mutex_t *mutex);
+extern int glwthread_mutex_destroy (glwthread_mutex_t *mutex);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_MUTEX_H */
deleted file mode 120000 (symlink)
index 8f62cbe3b9f2871ab4cc57e19a3c43b44bf0345a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-once.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..17854f5c093f7ffb4bb5251683073a9679711210
--- /dev/null
@@ -0,0 +1,62 @@
+/* Once-only control (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "windows-once.h"
+
+#include <stdlib.h>
+
+void
+glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void))
+{
+  if (once_control->inited <= 0)
+    {
+      if (InterlockedIncrement (&once_control->started) == 0)
+        {
+          /* This thread is the first one to come to this once_control.  */
+          InitializeCriticalSection (&once_control->lock);
+          EnterCriticalSection (&once_control->lock);
+          once_control->inited = 0;
+          initfunction ();
+          once_control->inited = 1;
+          LeaveCriticalSection (&once_control->lock);
+        }
+      else
+        {
+          /* Don't let once_control->started grow and wrap around.  */
+          InterlockedDecrement (&once_control->started);
+          /* Some other thread has already started the initialization.
+             Yield the CPU while waiting for the other thread to finish
+             initializing and taking the lock.  */
+          while (once_control->inited < 0)
+            Sleep (0);
+          if (once_control->inited <= 0)
+            {
+              /* Take the lock.  This blocks until the other thread has
+                 finished calling the initfunction.  */
+              EnterCriticalSection (&once_control->lock);
+              LeaveCriticalSection (&once_control->lock);
+              if (!(once_control->inited > 0))
+                abort ();
+            }
+        }
+    }
+}
deleted file mode 120000 (symlink)
index ed33b526a94c7181d014befb2d5ac98126f492d9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-once.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c5bbcd573c8068049f18d2af27126ae77c3d336c
--- /dev/null
@@ -0,0 +1,47 @@
+/* Once-only control (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#ifndef _WINDOWS_ONCE_H
+#define _WINDOWS_ONCE_H
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+typedef struct
+        {
+          volatile int inited;
+          volatile LONG started;
+          CRITICAL_SECTION lock;
+        }
+        glwthread_once_t;
+
+#define GLWTHREAD_ONCE_INIT { -1, -1 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void glwthread_once (glwthread_once_t *once_control,
+                            void (*initfunction) (void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_ONCE_H */
deleted file mode 120000 (symlink)
index 9aaa6290aa629d4e830a9d3be6eb54441020a937..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-recmutex.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e5672baf6ead0968ed583f45bac4ad59dad6a460
--- /dev/null
@@ -0,0 +1,127 @@
+/* Plain recursive mutexes (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "windows-recmutex.h"
+
+#include <errno.h>
+
+void
+glwthread_recmutex_init (glwthread_recmutex_t *mutex)
+{
+  mutex->owner = 0;
+  mutex->depth = 0;
+  InitializeCriticalSection (&mutex->lock);
+  mutex->guard.done = 1;
+}
+
+int
+glwthread_recmutex_lock (glwthread_recmutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        /* This thread is the first one to need this mutex.  Initialize it.  */
+        glwthread_recmutex_init (mutex);
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this mutex.  */
+          while (!mutex->guard.done)
+            Sleep (0);
+        }
+    }
+  {
+    DWORD self = GetCurrentThreadId ();
+    if (mutex->owner != self)
+      {
+        EnterCriticalSection (&mutex->lock);
+        mutex->owner = self;
+      }
+    if (++(mutex->depth) == 0) /* wraparound? */
+      {
+        mutex->depth--;
+        return EAGAIN;
+      }
+  }
+  return 0;
+}
+
+int
+glwthread_recmutex_trylock (glwthread_recmutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        /* This thread is the first one to need this mutex.  Initialize it.  */
+        glwthread_recmutex_init (mutex);
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Let another thread finish initializing this mutex, and let it also
+             lock this mutex.  */
+          return EBUSY;
+        }
+    }
+  {
+    DWORD self = GetCurrentThreadId ();
+    if (mutex->owner != self)
+      {
+        if (!TryEnterCriticalSection (&mutex->lock))
+          return EBUSY;
+        mutex->owner = self;
+      }
+    if (++(mutex->depth) == 0) /* wraparound? */
+      {
+        mutex->depth--;
+        return EAGAIN;
+      }
+  }
+  return 0;
+}
+
+int
+glwthread_recmutex_unlock (glwthread_recmutex_t *mutex)
+{
+  if (mutex->owner != GetCurrentThreadId ())
+    return EPERM;
+  if (mutex->depth == 0)
+    return EINVAL;
+  if (--(mutex->depth) == 0)
+    {
+      mutex->owner = 0;
+      LeaveCriticalSection (&mutex->lock);
+    }
+  return 0;
+}
+
+int
+glwthread_recmutex_destroy (glwthread_recmutex_t *mutex)
+{
+  if (mutex->owner != 0)
+    return EBUSY;
+  DeleteCriticalSection (&mutex->lock);
+  mutex->guard.done = 0;
+  return 0;
+}
deleted file mode 120000 (symlink)
index ebcaeb20c8cac0738f232321c6c69c052e0681c4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-recmutex.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9fa445b3d84ee8f556b7419c4cd82d0c665d3f3d
--- /dev/null
@@ -0,0 +1,57 @@
+/* Plain recursive mutexes (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#ifndef _WINDOWS_RECMUTEX_H
+#define _WINDOWS_RECMUTEX_H
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+#include "windows-initguard.h"
+
+/* The native Windows documentation says that CRITICAL_SECTION already
+   implements a recursive lock.  But we need not rely on it: It's easy to
+   implement a recursive lock without this assumption.  */
+
+typedef struct
+        {
+          glwthread_initguard_t guard; /* protects the initialization */
+          DWORD owner;
+          unsigned long depth;
+          CRITICAL_SECTION lock;
+        }
+        glwthread_recmutex_t;
+
+#define GLWTHREAD_RECMUTEX_INIT { GLWTHREAD_INITGUARD_INIT, 0, 0 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void glwthread_recmutex_init (glwthread_recmutex_t *mutex);
+extern int glwthread_recmutex_lock (glwthread_recmutex_t *mutex);
+extern int glwthread_recmutex_trylock (glwthread_recmutex_t *mutex);
+extern int glwthread_recmutex_unlock (glwthread_recmutex_t *mutex);
+extern int glwthread_recmutex_destroy (glwthread_recmutex_t *mutex);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_RECMUTEX_H */
deleted file mode 120000 (symlink)
index 9dd2499f2a4bf194d93ec8319e70d0ce447f0362..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-rwlock.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e60c4efcee21456ccf300449f708ffef1e6e6162
--- /dev/null
@@ -0,0 +1,377 @@
+/* Read-write locks (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "windows-rwlock.h"
+
+#include <errno.h>
+#include <stdlib.h>
+
+/* Don't assume that UNICODE is not defined.  */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
+/* In this file, the waitqueues are implemented as circular arrays.  */
+#define glwthread_waitqueue_t glwthread_carray_waitqueue_t
+
+static void
+glwthread_waitqueue_init (glwthread_waitqueue_t *wq)
+{
+  wq->array = NULL;
+  wq->count = 0;
+  wq->alloc = 0;
+  wq->offset = 0;
+}
+
+/* Enqueues the current thread, represented by an event, in a wait queue.
+   Returns INVALID_HANDLE_VALUE if an allocation failure occurs.  */
+static HANDLE
+glwthread_waitqueue_add (glwthread_waitqueue_t *wq)
+{
+  HANDLE event;
+  unsigned int index;
+
+  if (wq->count == wq->alloc)
+    {
+      unsigned int new_alloc = 2 * wq->alloc + 1;
+      HANDLE *new_array =
+        (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE));
+      if (new_array == NULL)
+        /* No more memory.  */
+        return INVALID_HANDLE_VALUE;
+      /* Now is a good opportunity to rotate the array so that its contents
+         starts at offset 0.  */
+      if (wq->offset > 0)
+        {
+          unsigned int old_count = wq->count;
+          unsigned int old_alloc = wq->alloc;
+          unsigned int old_offset = wq->offset;
+          unsigned int i;
+          if (old_offset + old_count > old_alloc)
+            {
+              unsigned int limit = old_offset + old_count - old_alloc;
+              for (i = 0; i < limit; i++)
+                new_array[old_alloc + i] = new_array[i];
+            }
+          for (i = 0; i < old_count; i++)
+            new_array[i] = new_array[old_offset + i];
+          wq->offset = 0;
+        }
+      wq->array = new_array;
+      wq->alloc = new_alloc;
+    }
+  /* Whether the created event is a manual-reset one or an auto-reset one,
+     does not matter, since we will wait on it only once.  */
+  event = CreateEvent (NULL, TRUE, FALSE, NULL);
+  if (event == INVALID_HANDLE_VALUE)
+    /* No way to allocate an event.  */
+    return INVALID_HANDLE_VALUE;
+  index = wq->offset + wq->count;
+  if (index >= wq->alloc)
+    index -= wq->alloc;
+  wq->array[index] = event;
+  wq->count++;
+  return event;
+}
+
+/* Notifies the first thread from a wait queue and dequeues it.  */
+static void
+glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq)
+{
+  SetEvent (wq->array[wq->offset + 0]);
+  wq->offset++;
+  wq->count--;
+  if (wq->count == 0 || wq->offset == wq->alloc)
+    wq->offset = 0;
+}
+
+/* Notifies all threads from a wait queue and dequeues them all.  */
+static void
+glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq)
+{
+  unsigned int i;
+
+  for (i = 0; i < wq->count; i++)
+    {
+      unsigned int index = wq->offset + i;
+      if (index >= wq->alloc)
+        index -= wq->alloc;
+      SetEvent (wq->array[index]);
+    }
+  wq->count = 0;
+  wq->offset = 0;
+}
+
+void
+glwthread_rwlock_init (glwthread_rwlock_t *lock)
+{
+  InitializeCriticalSection (&lock->lock);
+  glwthread_waitqueue_init (&lock->waiting_readers);
+  glwthread_waitqueue_init (&lock->waiting_writers);
+  lock->runcount = 0;
+  lock->guard.done = 1;
+}
+
+int
+glwthread_rwlock_rdlock (glwthread_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    {
+      if (InterlockedIncrement (&lock->guard.started) == 0)
+        /* This thread is the first one to need this lock.  Initialize it.  */
+        glwthread_rwlock_init (lock);
+      else
+        {
+          /* Don't let lock->guard.started grow and wrap around.  */
+          InterlockedDecrement (&lock->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this lock.  */
+          while (!lock->guard.done)
+            Sleep (0);
+        }
+    }
+  EnterCriticalSection (&lock->lock);
+  /* Test whether only readers are currently running, and whether the runcount
+     field will not overflow, and whether no writer is waiting.  The latter
+     condition is because POSIX recommends that "write locks shall take
+     precedence over read locks", to avoid "writer starvation".  */
+  if (!(lock->runcount + 1 > 0 && lock->waiting_writers.count == 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+         waiting_readers.  */
+      HANDLE event = glwthread_waitqueue_add (&lock->waiting_readers);
+      if (event != INVALID_HANDLE_VALUE)
+        {
+          DWORD result;
+          LeaveCriticalSection (&lock->lock);
+          /* Wait until another thread signals this event.  */
+          result = WaitForSingleObject (event, INFINITE);
+          if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
+            abort ();
+          CloseHandle (event);
+          /* The thread which signalled the event already did the bookkeeping:
+             removed us from the waiting_readers, incremented lock->runcount.  */
+          if (!(lock->runcount > 0))
+            abort ();
+          return 0;
+        }
+      else
+        {
+          /* Allocation failure.  Weird.  */
+          do
+            {
+              LeaveCriticalSection (&lock->lock);
+              Sleep (1);
+              EnterCriticalSection (&lock->lock);
+            }
+          while (!(lock->runcount + 1 > 0));
+        }
+    }
+  lock->runcount++;
+  LeaveCriticalSection (&lock->lock);
+  return 0;
+}
+
+int
+glwthread_rwlock_wrlock (glwthread_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    {
+      if (InterlockedIncrement (&lock->guard.started) == 0)
+        /* This thread is the first one to need this lock.  Initialize it.  */
+        glwthread_rwlock_init (lock);
+      else
+        {
+          /* Don't let lock->guard.started grow and wrap around.  */
+          InterlockedDecrement (&lock->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this lock.  */
+          while (!lock->guard.done)
+            Sleep (0);
+        }
+    }
+  EnterCriticalSection (&lock->lock);
+  /* Test whether no readers or writers are currently running.  */
+  if (!(lock->runcount == 0))
+    {
+      /* This thread has to wait for a while.  Enqueue it among the
+         waiting_writers.  */
+      HANDLE event = glwthread_waitqueue_add (&lock->waiting_writers);
+      if (event != INVALID_HANDLE_VALUE)
+        {
+          DWORD result;
+          LeaveCriticalSection (&lock->lock);
+          /* Wait until another thread signals this event.  */
+          result = WaitForSingleObject (event, INFINITE);
+          if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
+            abort ();
+          CloseHandle (event);
+          /* The thread which signalled the event already did the bookkeeping:
+             removed us from the waiting_writers, set lock->runcount = -1.  */
+          if (!(lock->runcount == -1))
+            abort ();
+          return 0;
+        }
+      else
+        {
+          /* Allocation failure.  Weird.  */
+          do
+            {
+              LeaveCriticalSection (&lock->lock);
+              Sleep (1);
+              EnterCriticalSection (&lock->lock);
+            }
+          while (!(lock->runcount == 0));
+        }
+    }
+  lock->runcount--; /* runcount becomes -1 */
+  LeaveCriticalSection (&lock->lock);
+  return 0;
+}
+
+int
+glwthread_rwlock_tryrdlock (glwthread_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    {
+      if (InterlockedIncrement (&lock->guard.started) == 0)
+        /* This thread is the first one to need this lock.  Initialize it.  */
+        glwthread_rwlock_init (lock);
+      else
+        {
+          /* Don't let lock->guard.started grow and wrap around.  */
+          InterlockedDecrement (&lock->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this lock.  */
+          while (!lock->guard.done)
+            Sleep (0);
+        }
+    }
+  /* It's OK to wait for this critical section, because it is never taken for a
+     long time.  */
+  EnterCriticalSection (&lock->lock);
+  /* Test whether only readers are currently running, and whether the runcount
+     field will not overflow, and whether no writer is waiting.  The latter
+     condition is because POSIX recommends that "write locks shall take
+     precedence over read locks", to avoid "writer starvation".  */
+  if (!(lock->runcount + 1 > 0 && lock->waiting_writers.count == 0))
+    {
+      /* This thread would have to wait for a while.  Return instead.  */
+      LeaveCriticalSection (&lock->lock);
+      return EBUSY;
+    }
+  lock->runcount++;
+  LeaveCriticalSection (&lock->lock);
+  return 0;
+}
+
+int
+glwthread_rwlock_trywrlock (glwthread_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    {
+      if (InterlockedIncrement (&lock->guard.started) == 0)
+        /* This thread is the first one to need this lock.  Initialize it.  */
+        glwthread_rwlock_init (lock);
+      else
+        {
+          /* Don't let lock->guard.started grow and wrap around.  */
+          InterlockedDecrement (&lock->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this lock.  */
+          while (!lock->guard.done)
+            Sleep (0);
+        }
+    }
+  /* It's OK to wait for this critical section, because it is never taken for a
+     long time.  */
+  EnterCriticalSection (&lock->lock);
+  /* Test whether no readers or writers are currently running.  */
+  if (!(lock->runcount == 0))
+    {
+      /* This thread would have to wait for a while.  Return instead.  */
+      LeaveCriticalSection (&lock->lock);
+      return EBUSY;
+    }
+  lock->runcount--; /* runcount becomes -1 */
+  LeaveCriticalSection (&lock->lock);
+  return 0;
+}
+
+int
+glwthread_rwlock_unlock (glwthread_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    return EINVAL;
+  EnterCriticalSection (&lock->lock);
+  if (lock->runcount < 0)
+    {
+      /* Drop a writer lock.  */
+      if (!(lock->runcount == -1))
+        abort ();
+      lock->runcount = 0;
+    }
+  else
+    {
+      /* Drop a reader lock.  */
+      if (!(lock->runcount > 0))
+        {
+          LeaveCriticalSection (&lock->lock);
+          return EPERM;
+        }
+      lock->runcount--;
+    }
+  if (lock->runcount == 0)
+    {
+      /* POSIX recommends that "write locks shall take precedence over read
+         locks", to avoid "writer starvation".  */
+      if (lock->waiting_writers.count > 0)
+        {
+          /* Wake up one of the waiting writers.  */
+          lock->runcount--;
+          glwthread_waitqueue_notify_first (&lock->waiting_writers);
+        }
+      else
+        {
+          /* Wake up all waiting readers.  */
+          lock->runcount += lock->waiting_readers.count;
+          glwthread_waitqueue_notify_all (&lock->waiting_readers);
+        }
+    }
+  LeaveCriticalSection (&lock->lock);
+  return 0;
+}
+
+int
+glwthread_rwlock_destroy (glwthread_rwlock_t *lock)
+{
+  if (!lock->guard.done)
+    return EINVAL;
+  if (lock->runcount != 0)
+    return EBUSY;
+  DeleteCriticalSection (&lock->lock);
+  if (lock->waiting_readers.array != NULL)
+    free (lock->waiting_readers.array);
+  if (lock->waiting_writers.array != NULL)
+    free (lock->waiting_writers.array);
+  lock->guard.done = 0;
+  return 0;
+}
deleted file mode 120000 (symlink)
index fd06c9228e47b1bd7088d4bd44b20cbfdcb3576d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-rwlock.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..08d677501c3f1132b5e29e00b680b5aa23e729d8
--- /dev/null
@@ -0,0 +1,68 @@
+/* Read-write locks (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#ifndef _WINDOWS_RWLOCK_H
+#define _WINDOWS_RWLOCK_H
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+#include "windows-initguard.h"
+
+/* It is impossible to implement read-write locks using plain locks, without
+   introducing an extra thread dedicated to managing read-write locks.
+   Therefore here we need to use the low-level Event type.  */
+
+typedef struct
+        {
+          HANDLE *array; /* array of waiting threads, each represented by an event */
+          unsigned int count; /* number of waiting threads */
+          unsigned int alloc; /* length of allocated array */
+          unsigned int offset; /* index of first waiting thread in array */
+        }
+        glwthread_carray_waitqueue_t;
+typedef struct
+        {
+          glwthread_initguard_t guard; /* protects the initialization */
+          CRITICAL_SECTION lock; /* protects the remaining fields */
+          glwthread_carray_waitqueue_t waiting_readers; /* waiting readers */
+          glwthread_carray_waitqueue_t waiting_writers; /* waiting writers */
+          int runcount; /* number of readers running, or -1 when a writer runs */
+        }
+        glwthread_rwlock_t;
+
+#define GLWTHREAD_RWLOCK_INIT { GLWTHREAD_INITGUARD_INIT }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void glwthread_rwlock_init (glwthread_rwlock_t *lock);
+extern int glwthread_rwlock_rdlock (glwthread_rwlock_t *lock);
+extern int glwthread_rwlock_wrlock (glwthread_rwlock_t *lock);
+extern int glwthread_rwlock_tryrdlock (glwthread_rwlock_t *lock);
+extern int glwthread_rwlock_trywrlock (glwthread_rwlock_t *lock);
+extern int glwthread_rwlock_unlock (glwthread_rwlock_t *lock);
+extern int glwthread_rwlock_destroy (glwthread_rwlock_t *lock);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_RWLOCK_H */
deleted file mode 120000 (symlink)
index 3a3cec22b8578dfa908de358453aff65c545c227..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-thread.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6a47a31f9c131258e2583ad0fc64ad5dc7bbe876
--- /dev/null
@@ -0,0 +1,243 @@
+/* Creating and controlling threads (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "windows-thread.h"
+
+#include <errno.h>
+#include <process.h>
+#include <stdlib.h>
+
+#include "windows-once.h"
+#include "windows-tls.h"
+
+/* The Thread-Local Storage (TLS) key that allows to access each thread's
+   'struct glwthread_thread_struct *' pointer.  */
+static DWORD self_key = (DWORD)-1;
+
+/* Initializes self_key.  This function must only be called once.  */
+static void
+do_init_self_key (void)
+{
+  self_key = TlsAlloc ();
+  /* If this fails, we're hosed.  */
+  if (self_key == (DWORD)-1)
+    abort ();
+}
+
+/* Initializes self_key.  */
+static void
+init_self_key (void)
+{
+  static glwthread_once_t once = GLWTHREAD_ONCE_INIT;
+  glwthread_once (&once, do_init_self_key);
+}
+
+/* This structure contains information about a thread.
+   It is stored in TLS under key self_key.  */
+struct glwthread_thread_struct
+{
+  /* Fields for managing the handle.  */
+  HANDLE volatile handle;
+  CRITICAL_SECTION handle_lock;
+  /* Fields for managing the exit value.  */
+  BOOL volatile detached;
+  void * volatile result;
+  /* Fields for managing the thread start.  */
+  void * (*func) (void *);
+  void *arg;
+};
+
+/* Return a real HANDLE object for the current thread.  */
+static HANDLE
+get_current_thread_handle (void)
+{
+  HANDLE this_handle;
+
+  /* GetCurrentThread() returns a pseudo-handle, i.e. only a symbolic
+     identifier, not a real handle.  */
+  if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
+                        GetCurrentProcess (), &this_handle,
+                        0, FALSE, DUPLICATE_SAME_ACCESS))
+    abort ();
+  return this_handle;
+}
+
+glwthread_thread_t
+glwthread_thread_self (void)
+{
+  glwthread_thread_t thread;
+
+  if (self_key == (DWORD)-1)
+    init_self_key ();
+  thread = TlsGetValue (self_key);
+  if (thread == NULL)
+    {
+      /* This happens only in threads that have not been created through
+         glthread_create(), such as the main thread.  */
+      for (;;)
+        {
+          thread =
+            (struct glwthread_thread_struct *)
+            malloc (sizeof (struct glwthread_thread_struct));
+          if (thread != NULL)
+            break;
+          /* Memory allocation failed.  There is not much we can do.  Have to
+             busy-loop, waiting for the availability of memory.  */
+          Sleep (1);
+        }
+
+      thread->handle = get_current_thread_handle ();
+      InitializeCriticalSection (&thread->handle_lock);
+      thread->detached = FALSE; /* This can lead to a memory leak.  */
+      thread->result = NULL; /* just to be deterministic */
+      TlsSetValue (self_key, thread);
+    }
+  return thread;
+}
+
+/* The main function of a freshly creating thread.  It's a wrapper around
+   the FUNC and ARG arguments passed to glthread_create_func.  */
+static unsigned int WINAPI
+wrapper_func (void *varg)
+{
+  struct glwthread_thread_struct *thread =
+    (struct glwthread_thread_struct *) varg;
+
+  EnterCriticalSection (&thread->handle_lock);
+  /* Create a new handle for the thread only if the parent thread did not yet
+     fill in the handle.  */
+  if (thread->handle == NULL)
+    thread->handle = get_current_thread_handle ();
+  LeaveCriticalSection (&thread->handle_lock);
+
+  if (self_key == (DWORD)-1)
+    init_self_key ();
+  TlsSetValue (self_key, thread);
+
+  /* Run the thread.  Store the exit value if the thread was not terminated
+     otherwise.  */
+  thread->result = thread->func (thread->arg);
+
+  /* Process the TLS destructors.  */
+  glwthread_tls_process_destructors ();
+
+  if (thread->detached)
+    {
+      /* Clean up the thread, like thrd_join would do.  */
+      DeleteCriticalSection (&thread->handle_lock);
+      CloseHandle (thread->handle);
+      free (thread);
+    }
+
+  return 0;
+}
+
+int
+glwthread_thread_create (glwthread_thread_t *threadp, unsigned int attr,
+                         void * (*func) (void *), void *arg)
+{
+  struct glwthread_thread_struct *thread =
+    (struct glwthread_thread_struct *)
+    malloc (sizeof (struct glwthread_thread_struct));
+  if (thread == NULL)
+    return ENOMEM;
+  thread->handle = NULL;
+  InitializeCriticalSection (&thread->handle_lock);
+  thread->detached = (attr & GLWTHREAD_ATTR_DETACHED ? TRUE : FALSE);
+  thread->result = NULL; /* just to be deterministic */
+  thread->func = func;
+  thread->arg = arg;
+
+  {
+    unsigned int thread_id;
+    HANDLE thread_handle;
+
+    thread_handle = (HANDLE)
+      _beginthreadex (NULL, 100000, wrapper_func, thread, 0, &thread_id);
+      /* calls CreateThread with the same arguments */
+    if (thread_handle == NULL)
+      {
+        DeleteCriticalSection (&thread->handle_lock);
+        free (thread);
+        return EAGAIN;
+      }
+
+    EnterCriticalSection (&thread->handle_lock);
+    if (thread->handle == NULL)
+      thread->handle = thread_handle;
+    else
+      /* thread->handle was already set by the thread itself.  */
+      CloseHandle (thread_handle);
+    LeaveCriticalSection (&thread->handle_lock);
+
+    *threadp = thread;
+    return 0;
+  }
+}
+
+int
+glwthread_thread_join (glwthread_thread_t thread, void **retvalp)
+{
+  if (thread == NULL)
+    return EINVAL;
+
+  if (thread == glwthread_thread_self ())
+    return EDEADLK;
+
+  if (thread->detached)
+    return EINVAL;
+
+  if (WaitForSingleObject (thread->handle, INFINITE) == WAIT_FAILED)
+    return EINVAL;
+
+  if (retvalp != NULL)
+    *retvalp = thread->result;
+
+  DeleteCriticalSection (&thread->handle_lock);
+  CloseHandle (thread->handle);
+  free (thread);
+
+  return 0;
+}
+
+int
+glwthread_thread_detach (glwthread_thread_t thread)
+{
+  if (thread == NULL)
+    return EINVAL;
+
+  if (thread->detached)
+    return EINVAL;
+
+  thread->detached = TRUE;
+  return 0;
+}
+
+void
+glwthread_thread_exit (void *retval)
+{
+  glwthread_thread_t thread = glwthread_thread_self ();
+  thread->result = retval;
+  glwthread_tls_process_destructors ();
+  _endthreadex (0); /* calls ExitThread (0) */
+  abort ();
+}
deleted file mode 120000 (symlink)
index 2e9d4db413551cd9912ebe122bfb9ab188122264..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-thread.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..154bdfaef216c0c7bd83f6c194c018482fa208f2
--- /dev/null
@@ -0,0 +1,60 @@
+/* Creating and controlling threads (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+   Based on GCC's gthr-win32.h.  */
+
+#ifndef _WINDOWS_THREAD_H
+#define _WINDOWS_THREAD_H
+
+/* This file uses _Noreturn.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+/* The glwthread_thread_t is a pointer to a structure in memory.
+   Why not the thread handle?  If it were the thread handle, it would be hard
+   to implement glwthread_thread_self() (since GetCurrentThread () returns a
+   pseudo-handle, DuplicateHandle (GetCurrentThread ()) returns a handle that
+   must be closed afterwards, and there is no function for quickly retrieving
+   a thread handle from its id).
+   Why not the thread id?  I tried it.  It did not work: Sometimes ids appeared
+   that did not belong to running threads, and glthread_join failed with ESRCH.
+ */
+typedef struct glwthread_thread_struct *glwthread_thread_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* attr is a bit mask, consisting of the following bits: */
+#define GLWTHREAD_ATTR_DETACHED 1
+extern int glwthread_thread_create (glwthread_thread_t *threadp,
+                                    unsigned int attr,
+                                    void * (*func) (void *), void *arg);
+extern int glwthread_thread_join (glwthread_thread_t thread, void **retvalp);
+extern int glwthread_thread_detach (glwthread_thread_t thread);
+extern glwthread_thread_t glwthread_thread_self (void);
+extern _Noreturn void glwthread_thread_exit (void *retval);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_THREAD_H */
deleted file mode 120000 (symlink)
index 6fdda898ac830325e3b3e204ca9c965a7559eac8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-timedmutex.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3dfff56dbe8fc31c56433c72de07984506046199
--- /dev/null
@@ -0,0 +1,227 @@
+/* Timed mutexes (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005, 2019.
+   Based on GCC's gthr-win32.h.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "windows-timedmutex.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+/* Don't assume that UNICODE is not defined.  */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
+int
+glwthread_timedmutex_init (glwthread_timedmutex_t *mutex)
+{
+  /* Attempt to allocate an auto-reset event object.  */
+  /* CreateEvent
+     <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-createeventa> */
+  HANDLE event = CreateEvent (NULL, FALSE, FALSE, NULL);
+  if (event == INVALID_HANDLE_VALUE)
+    return EAGAIN;
+  mutex->event = event;
+  InitializeCriticalSection (&mutex->lock);
+  mutex->guard.done = 1;
+  return 0;
+}
+
+int
+glwthread_timedmutex_lock (glwthread_timedmutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        {
+          /* This thread is the first one to need this mutex.
+             Initialize it.  */
+          int err = glwthread_timedmutex_init (mutex);
+          if (err != 0)
+            {
+              /* Undo increment.  */
+              InterlockedDecrement (&mutex->guard.started);
+              return err;
+            }
+        }
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this mutex.  */
+          while (!mutex->guard.done)
+            Sleep (0);
+        }
+    }
+  EnterCriticalSection (&mutex->lock);
+  return 0;
+}
+
+int
+glwthread_timedmutex_trylock (glwthread_timedmutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        {
+          /* This thread is the first one to need this mutex.
+             Initialize it.  */
+          int err = glwthread_timedmutex_init (mutex);
+          if (err != 0)
+            {
+              /* Undo increment.  */
+              InterlockedDecrement (&mutex->guard.started);
+              return err;
+            }
+        }
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Let another thread finish initializing this mutex, and let it also
+             lock this mutex.  */
+          return EBUSY;
+        }
+    }
+  if (!TryEnterCriticalSection (&mutex->lock))
+    return EBUSY;
+  return 0;
+}
+
+int
+glwthread_timedmutex_timedlock (glwthread_timedmutex_t *mutex,
+                                const struct timespec *abstime)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        {
+          /* This thread is the first one to need this mutex.
+             Initialize it.  */
+          int err = glwthread_timedmutex_init (mutex);
+          if (err != 0)
+            {
+              /* Undo increment.  */
+              InterlockedDecrement (&mutex->guard.started);
+              return err;
+            }
+        }
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this mutex.  */
+          while (!mutex->guard.done)
+            Sleep (0);
+        }
+    }
+
+  /* POSIX says:
+      "Under no circumstance shall the function fail with a timeout if
+       the mutex can be locked immediately. The validity of the abstime
+       parameter need not be checked if the mutex can be locked
+       immediately."
+     Therefore start the loop with a TryEnterCriticalSection call.  */
+  for (;;)
+    {
+      if (TryEnterCriticalSection (&mutex->lock))
+        break;
+
+      {
+        struct timeval currtime;
+        DWORD timeout;
+        DWORD result;
+
+        gettimeofday (&currtime, NULL);
+
+        /* Wait until another thread signals the event or until the
+           abstime passes.  */
+        if (currtime.tv_sec > abstime->tv_sec)
+          timeout = 0;
+        else
+          {
+            unsigned long seconds = abstime->tv_sec - currtime.tv_sec;
+            timeout = seconds * 1000;
+            if (timeout / 1000 != seconds) /* overflow? */
+              timeout = INFINITE;
+            else
+              {
+                long milliseconds =
+                  abstime->tv_nsec / 1000000 - currtime.tv_usec / 1000;
+                if (milliseconds >= 0)
+                  {
+                    timeout += milliseconds;
+                    if (timeout < milliseconds) /* overflow? */
+                      timeout = INFINITE;
+                  }
+                else
+                  {
+                    if (timeout >= - milliseconds)
+                      timeout -= (- milliseconds);
+                    else
+                      timeout = 0;
+                  }
+              }
+          }
+        if (timeout == 0)
+          return ETIMEDOUT;
+
+        /* WaitForSingleObject
+           <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-waitforsingleobject> */
+        result = WaitForSingleObject (mutex->event, timeout);
+        if (result == WAIT_FAILED)
+          abort ();
+        if (result == WAIT_TIMEOUT)
+          return ETIMEDOUT;
+        /* Another thread has just unlocked the mutex.  We have good chances at
+           locking it now.  */
+      }
+    }
+  return 0;
+}
+
+int
+glwthread_timedmutex_unlock (glwthread_timedmutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    return EINVAL;
+  LeaveCriticalSection (&mutex->lock);
+  /* Notify one of the threads that were waiting with a timeout.  */
+  /* SetEvent
+     <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-setevent> */
+  SetEvent (mutex->event);
+  return 0;
+}
+
+int
+glwthread_timedmutex_destroy (glwthread_timedmutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    return EINVAL;
+  DeleteCriticalSection (&mutex->lock);
+  /* CloseHandle
+     <https://docs.microsoft.com/en-us/windows/desktop/api/handleapi/nf-handleapi-closehandle> */
+  CloseHandle (mutex->event);
+  mutex->guard.done = 0;
+  return 0;
+}
deleted file mode 120000 (symlink)
index d912240e199788a8e2c4c3a2bee7d45aabbdbb40..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-timedmutex.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e21879e1a1b273a0b96615f3a95d5a4202a42973
--- /dev/null
@@ -0,0 +1,56 @@
+/* Timed mutexes (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005, 2019.
+   Based on GCC's gthr-win32.h.  */
+
+#ifndef _WINDOWS_TIMEDMUTEX_H
+#define _WINDOWS_TIMEDMUTEX_H
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+#include <time.h>
+
+#include "windows-initguard.h"
+
+typedef struct
+        {
+          glwthread_initguard_t guard; /* protects the initialization */
+          HANDLE event;
+          CRITICAL_SECTION lock;
+        }
+        glwthread_timedmutex_t;
+
+#define GLWTHREAD_TIMEDMUTEX_INIT { GLWTHREAD_INITGUARD_INIT }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int glwthread_timedmutex_init (glwthread_timedmutex_t *mutex);
+extern int glwthread_timedmutex_lock (glwthread_timedmutex_t *mutex);
+extern int glwthread_timedmutex_trylock (glwthread_timedmutex_t *mutex);
+extern int glwthread_timedmutex_timedlock (glwthread_timedmutex_t *mutex,
+                                           const struct timespec *abstime);
+extern int glwthread_timedmutex_unlock (glwthread_timedmutex_t *mutex);
+extern int glwthread_timedmutex_destroy (glwthread_timedmutex_t *mutex);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_TIMEDMUTEX_H */
deleted file mode 120000 (symlink)
index cceb742c9d4a1db5ffc36edf35e8a52cd14d7471..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-timedrecmutex.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5c9ca78d96dd33290454a1f0f9caffd78f2c7b4b
--- /dev/null
@@ -0,0 +1,271 @@
+/* Timed recursive mutexes (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005, 2019.
+   Based on GCC's gthr-win32.h.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "windows-timedrecmutex.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+/* Don't assume that UNICODE is not defined.  */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
+int
+glwthread_timedrecmutex_init (glwthread_timedrecmutex_t *mutex)
+{
+  mutex->owner = 0;
+  mutex->depth = 0;
+  /* Attempt to allocate an auto-reset event object.  */
+  /* CreateEvent
+     <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-createeventa> */
+  HANDLE event = CreateEvent (NULL, FALSE, FALSE, NULL);
+  if (event == INVALID_HANDLE_VALUE)
+    return EAGAIN;
+  mutex->event = event;
+  InitializeCriticalSection (&mutex->lock);
+  mutex->guard.done = 1;
+  return 0;
+}
+
+int
+glwthread_timedrecmutex_lock (glwthread_timedrecmutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        {
+          /* This thread is the first one to need this mutex.
+             Initialize it.  */
+          int err = glwthread_timedrecmutex_init (mutex);
+          if (err != 0)
+            {
+              /* Undo increment.  */
+              InterlockedDecrement (&mutex->guard.started);
+              return err;
+            }
+        }
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this mutex.  */
+          while (!mutex->guard.done)
+            Sleep (0);
+        }
+    }
+  {
+    DWORD self = GetCurrentThreadId ();
+    if (mutex->owner != self)
+      {
+        EnterCriticalSection (&mutex->lock);
+        mutex->owner = self;
+      }
+    if (++(mutex->depth) == 0) /* wraparound? */
+      {
+        mutex->depth--;
+        return EAGAIN;
+      }
+  }
+  return 0;
+}
+
+int
+glwthread_timedrecmutex_trylock (glwthread_timedrecmutex_t *mutex)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        {
+          /* This thread is the first one to need this mutex.
+             Initialize it.  */
+          int err = glwthread_timedrecmutex_init (mutex);
+          if (err != 0)
+            {
+              /* Undo increment.  */
+              InterlockedDecrement (&mutex->guard.started);
+              return err;
+            }
+        }
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Let another thread finish initializing this mutex, and let it also
+             lock this mutex.  */
+          return EBUSY;
+        }
+    }
+  {
+    DWORD self = GetCurrentThreadId ();
+    if (mutex->owner != self)
+      {
+        if (!TryEnterCriticalSection (&mutex->lock))
+          return EBUSY;
+        mutex->owner = self;
+      }
+    if (++(mutex->depth) == 0) /* wraparound? */
+      {
+        mutex->depth--;
+        return EAGAIN;
+      }
+  }
+  return 0;
+}
+
+int
+glwthread_timedrecmutex_timedlock (glwthread_timedrecmutex_t *mutex,
+                                   const struct timespec *abstime)
+{
+  if (!mutex->guard.done)
+    {
+      if (InterlockedIncrement (&mutex->guard.started) == 0)
+        {
+          /* This thread is the first one to need this mutex.
+             Initialize it.  */
+          int err = glwthread_timedrecmutex_init (mutex);
+          if (err != 0)
+            {
+              /* Undo increment.  */
+              InterlockedDecrement (&mutex->guard.started);
+              return err;
+            }
+        }
+      else
+        {
+          /* Don't let mutex->guard.started grow and wrap around.  */
+          InterlockedDecrement (&mutex->guard.started);
+          /* Yield the CPU while waiting for another thread to finish
+             initializing this mutex.  */
+          while (!mutex->guard.done)
+            Sleep (0);
+        }
+    }
+
+  {
+    DWORD self = GetCurrentThreadId ();
+    if (mutex->owner != self)
+      {
+        /* POSIX says:
+            "Under no circumstance shall the function fail with a timeout if
+             the mutex can be locked immediately. The validity of the abstime
+             parameter need not be checked if the mutex can be locked
+             immediately."
+           Therefore start the loop with a TryEnterCriticalSection call.  */
+        for (;;)
+          {
+            if (TryEnterCriticalSection (&mutex->lock))
+              break;
+
+            {
+              struct timeval currtime;
+              DWORD timeout;
+              DWORD result;
+
+              gettimeofday (&currtime, NULL);
+
+              /* Wait until another thread signals the event or until the
+                 abstime passes.  */
+              if (currtime.tv_sec > abstime->tv_sec)
+                timeout = 0;
+              else
+                {
+                  unsigned long seconds = abstime->tv_sec - currtime.tv_sec;
+                  timeout = seconds * 1000;
+                  if (timeout / 1000 != seconds) /* overflow? */
+                    timeout = INFINITE;
+                  else
+                    {
+                      long milliseconds =
+                        abstime->tv_nsec / 1000000 - currtime.tv_usec / 1000;
+                      if (milliseconds >= 0)
+                        {
+                          timeout += milliseconds;
+                          if (timeout < milliseconds) /* overflow? */
+                            timeout = INFINITE;
+                        }
+                      else
+                        {
+                          if (timeout >= - milliseconds)
+                            timeout -= (- milliseconds);
+                          else
+                            timeout = 0;
+                        }
+                    }
+                }
+              if (timeout == 0)
+                return ETIMEDOUT;
+
+              /* WaitForSingleObject
+                 <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-waitforsingleobject> */
+              result = WaitForSingleObject (mutex->event, timeout);
+              if (result == WAIT_FAILED)
+                abort ();
+              if (result == WAIT_TIMEOUT)
+                return ETIMEDOUT;
+              /* Another thread has just unlocked the mutex.  We have good chances at
+                 locking it now.  */
+            }
+          }
+        mutex->owner = self;
+      }
+    if (++(mutex->depth) == 0) /* wraparound? */
+      {
+        mutex->depth--;
+        return EAGAIN;
+      }
+  }
+  return 0;
+}
+
+int
+glwthread_timedrecmutex_unlock (glwthread_timedrecmutex_t *mutex)
+{
+  if (mutex->owner != GetCurrentThreadId ())
+    return EPERM;
+  if (mutex->depth == 0)
+    return EINVAL;
+  if (--(mutex->depth) == 0)
+    {
+      mutex->owner = 0;
+      LeaveCriticalSection (&mutex->lock);
+      /* Notify one of the threads that were waiting with a timeout.  */
+      /* SetEvent
+         <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-setevent> */
+      SetEvent (mutex->event);
+    }
+  return 0;
+}
+
+int
+glwthread_timedrecmutex_destroy (glwthread_timedrecmutex_t *mutex)
+{
+  if (mutex->owner != 0)
+    return EBUSY;
+  DeleteCriticalSection (&mutex->lock);
+  /* CloseHandle
+     <https://docs.microsoft.com/en-us/windows/desktop/api/handleapi/nf-handleapi-closehandle> */
+  CloseHandle (mutex->event);
+  mutex->guard.done = 0;
+  return 0;
+}
deleted file mode 120000 (symlink)
index db8cc6eb1abd43740da0c1a1374aed688c794482..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-timedrecmutex.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..537070fa2b0d4b284be22223c1e603119a5214ec
--- /dev/null
@@ -0,0 +1,62 @@
+/* Timed recursive mutexes (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005, 2019.
+   Based on GCC's gthr-win32.h.  */
+
+#ifndef _WINDOWS_TIMEDRECMUTEX_H
+#define _WINDOWS_TIMEDRECMUTEX_H
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+#include <time.h>
+
+#include "windows-initguard.h"
+
+/* The native Windows documentation says that CRITICAL_SECTION already
+   implements a recursive lock.  But we need not rely on it: It's easy to
+   implement a recursive lock without this assumption.  */
+
+typedef struct
+        {
+          glwthread_initguard_t guard; /* protects the initialization */
+          DWORD owner;
+          unsigned long depth;
+          HANDLE event;
+          CRITICAL_SECTION lock;
+        }
+        glwthread_timedrecmutex_t;
+
+#define GLWTHREAD_TIMEDRECMUTEX_INIT { GLWTHREAD_INITGUARD_INIT, 0, 0 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int glwthread_timedrecmutex_init (glwthread_timedrecmutex_t *mutex);
+extern int glwthread_timedrecmutex_lock (glwthread_timedrecmutex_t *mutex);
+extern int glwthread_timedrecmutex_trylock (glwthread_timedrecmutex_t *mutex);
+extern int glwthread_timedrecmutex_timedlock (glwthread_timedrecmutex_t *mutex,
+                                              const struct timespec *abstime);
+extern int glwthread_timedrecmutex_unlock (glwthread_timedrecmutex_t *mutex);
+extern int glwthread_timedrecmutex_destroy (glwthread_timedrecmutex_t *mutex);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_TIMEDRECMUTEX_H */
deleted file mode 120000 (symlink)
index 575504d2e26a9870252aadce1035cfba606dad8c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-tls.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6b73074d0e22afc48c9f5cdb2bf24f04e5587d4b
--- /dev/null
@@ -0,0 +1,339 @@
+/* Thread-local storage (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "windows-tls.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "windows-once.h"
+
+void *
+glwthread_tls_get (glwthread_tls_key_t key)
+{
+  return TlsGetValue (key);
+}
+
+int
+glwthread_tls_set (glwthread_tls_key_t key, void *value)
+{
+  if (!TlsSetValue (key, value))
+    return EINVAL;
+  return 0;
+}
+
+/* The following variables keep track of TLS keys with non-NULL destructor.  */
+
+static glwthread_once_t dtor_table_init_once = GLWTHREAD_ONCE_INIT;
+
+static CRITICAL_SECTION dtor_table_lock;
+
+struct dtor { glwthread_tls_key_t key; void (*destructor) (void *); };
+
+/* The table of dtors.  */
+static struct dtor *dtor_table;
+/* Number of active entries in the dtor_table.  */
+static unsigned int dtors_count;
+/* Valid indices into dtor_table are 0..dtors_used-1.  */
+static unsigned int dtors_used;
+/* Allocation size of dtor_table.  */
+static unsigned int dtors_allocated;
+/* Invariant: 0 <= dtors_count <= dtors_used <= dtors_allocated.  */
+
+/* Number of threads that are currently processing destructors.  */
+static unsigned int dtor_processing_threads;
+
+static void
+dtor_table_initialize (void)
+{
+  InitializeCriticalSection (&dtor_table_lock);
+  /* The other variables are already initialized to NULL or 0, respectively.  */
+}
+
+static void
+dtor_table_ensure_initialized (void)
+{
+  glwthread_once (&dtor_table_init_once, dtor_table_initialize);
+}
+
+/* Shrinks dtors_used down to dtors_count, by replacing inactive entries
+   with active ones.  */
+static void
+dtor_table_shrink_used (void)
+{
+  unsigned int i = 0;
+  unsigned int j = dtors_used;
+
+  for (;;)
+    {
+      BOOL i_found = FALSE;
+      BOOL j_found = FALSE;
+      /* Find the next inactive entry, from the left.  */
+      for (; i < dtors_count;)
+        {
+          if (dtor_table[i].destructor == NULL)
+            {
+              i_found = TRUE;
+              break;
+            }
+          i++;
+        }
+
+      /* Find the next active entry, from the right.  */
+      for (; j > dtors_count;)
+        {
+          j--;
+          if (dtor_table[j].destructor != NULL)
+            {
+              j_found = TRUE;
+              break;
+            }
+        }
+
+      if (i_found != j_found)
+        /* dtors_count was apparently wrong.  */
+        abort ();
+
+      if (!i_found)
+        break;
+
+      /* i_found and j_found are TRUE.  Swap the two entries.  */
+      dtor_table[i] = dtor_table[j];
+
+      i++;
+    }
+
+  dtors_used = dtors_count;
+}
+
+void
+glwthread_tls_process_destructors (void)
+{
+  unsigned int repeat;
+
+  dtor_table_ensure_initialized ();
+
+  EnterCriticalSection (&dtor_table_lock);
+  if (dtor_processing_threads == 0)
+    {
+      /* Now it's the appropriate time for shrinking dtors_used.  */
+      if (dtors_used > dtors_count)
+        dtor_table_shrink_used ();
+    }
+  dtor_processing_threads++;
+
+  for (repeat = GLWTHREAD_DESTRUCTOR_ITERATIONS; repeat > 0; repeat--)
+    {
+      unsigned int destructors_run = 0;
+
+      /* Iterate across dtor_table.  We don't need to make a copy of dtor_table,
+         because
+           * When another thread calls glwthread_tls_key_create with a non-NULL
+             destructor argument, this will possibly reallocate the dtor_table
+             array and increase dtors_allocated as well as dtors_used and
+             dtors_count, but it will not change dtors_used nor the contents of
+             the first dtors_used entries of dtor_table.
+           * When another thread calls glwthread_tls_key_delete, this will
+             possibly set some 'destructor' member to NULL, thus marking an
+             entry as inactive, but it will not otherwise change dtors_used nor
+             the contents of the first dtors_used entries of dtor_table.  */
+      unsigned int i_limit = dtors_used;
+      unsigned int i;
+
+      for (i = 0; i < i_limit; i++)
+        {
+          struct dtor current = dtor_table[i];
+          if (current.destructor != NULL)
+            {
+              /* The current dtor has not been deleted yet.  */
+              void *current_value = glwthread_tls_get (current.key);
+              if (current_value != NULL)
+                {
+                  /* The current value is non-NULL.  Run the destructor.  */
+                  glwthread_tls_set (current.key, NULL);
+                  LeaveCriticalSection (&dtor_table_lock);
+                  current.destructor (current_value);
+                  EnterCriticalSection (&dtor_table_lock);
+                  destructors_run++;
+                }
+            }
+        }
+
+      /* When all TLS values were already NULL, no further iterations are
+         needed.  */
+      if (destructors_run == 0)
+        break;
+    }
+
+  dtor_processing_threads--;
+  LeaveCriticalSection (&dtor_table_lock);
+}
+
+int
+glwthread_tls_key_create (glwthread_tls_key_t *keyp, void (*destructor) (void *))
+{
+  if (destructor != NULL)
+    {
+      dtor_table_ensure_initialized ();
+
+      EnterCriticalSection (&dtor_table_lock);
+      if (dtor_processing_threads == 0)
+        {
+          /* Now it's the appropriate time for shrinking dtors_used.  */
+          if (dtors_used > dtors_count)
+            dtor_table_shrink_used ();
+        }
+
+      while (dtors_used == dtors_allocated)
+        {
+          /* Need to grow the dtor_table.  */
+          unsigned int new_allocated = 2 * dtors_allocated + 1;
+          if (new_allocated < 7)
+            new_allocated = 7;
+          if (new_allocated <= dtors_allocated) /* overflow? */
+            new_allocated = UINT_MAX;
+
+          LeaveCriticalSection (&dtor_table_lock);
+          {
+            struct dtor *new_table =
+              (struct dtor *) malloc (new_allocated * sizeof (struct dtor));
+            if (new_table == NULL)
+              return ENOMEM;
+            EnterCriticalSection (&dtor_table_lock);
+            /* Attention! dtors_used, dtors_allocated may have changed!  */
+            if (dtors_used < new_allocated)
+              {
+                if (dtors_allocated < new_allocated)
+                  {
+                    /* The new_table is useful.  */
+                    memcpy (new_table, dtor_table,
+                            dtors_used * sizeof (struct dtor));
+                    dtor_table = new_table;
+                    dtors_allocated = new_allocated;
+                  }
+                else
+                  {
+                    /* The new_table is not useful, since another thread
+                       meanwhile allocated a drop_table that is at least
+                       as large.  */
+                    free (new_table);
+                  }
+                break;
+              }
+            /* The new_table is not useful, since other threads increased
+               dtors_used.  Free it any retry.  */
+            free (new_table);
+          }
+        }
+      /* Here dtors_used < dtors_allocated.  */
+      {
+        /* Allocate a new key.  */
+        glwthread_tls_key_t key = TlsAlloc ();
+        if (key == (DWORD)-1)
+          {
+            LeaveCriticalSection (&dtor_table_lock);
+            return EAGAIN;
+          }
+        /* Store the new dtor in the dtor_table, after all used entries.
+           Do not overwrite inactive entries with indices < dtors_used, in order
+           not to disturb glwthread_tls_process_destructors invocations that may
+           be executing in other threads.  */
+        dtor_table[dtors_used].key = key;
+        dtor_table[dtors_used].destructor = destructor;
+        dtors_used++;
+        dtors_count++;
+        LeaveCriticalSection (&dtor_table_lock);
+        *keyp = key;
+      }
+    }
+  else
+    {
+      /* Allocate a new key.  */
+      glwthread_tls_key_t key = TlsAlloc ();
+      if (key == (DWORD)-1)
+        return EAGAIN;
+      *keyp = key;
+    }
+  return 0;
+}
+
+int
+glwthread_tls_key_delete (glwthread_tls_key_t key)
+{
+  /* Should the destructor be called for all threads that are currently running?
+     Probably not, because
+       - ISO C does not specify when the destructor is to be invoked at all.
+       - In POSIX, the destructor functions specified with pthread_key_create()
+         are invoked at thread exit.
+       - It would be hard to implement, because there are no primitives for
+         accessing thread-specific values from a different thread.  */
+  dtor_table_ensure_initialized ();
+
+  EnterCriticalSection (&dtor_table_lock);
+  if (dtor_processing_threads == 0)
+    {
+      /* Now it's the appropriate time for shrinking dtors_used.  */
+      if (dtors_used > dtors_count)
+        dtor_table_shrink_used ();
+      /* Here dtors_used == dtors_count.  */
+
+      /* Find the key in dtor_table.  */
+      {
+        unsigned int i_limit = dtors_used;
+        unsigned int i;
+
+        for (i = 0; i < i_limit; i++)
+          if (dtor_table[i].key == key)
+            {
+              if (i < dtors_used - 1)
+                /* Swap the entries i and dtors_used - 1.  */
+                dtor_table[i] = dtor_table[dtors_used - 1];
+              dtors_count = dtors_used = dtors_used - 1;
+              break;
+            }
+      }
+    }
+  else
+    {
+      /* Be careful not to disturb the glwthread_tls_process_destructors
+         invocations that are executing in other threads.  */
+      unsigned int i_limit = dtors_used;
+      unsigned int i;
+
+      for (i = 0; i < i_limit; i++)
+        if (dtor_table[i].destructor != NULL /* skip inactive entries */
+            && dtor_table[i].key == key)
+          {
+            /* Mark this entry as inactive.  */
+            dtor_table[i].destructor = NULL;
+            dtors_count = dtors_count - 1;
+            break;
+          }
+    }
+  LeaveCriticalSection (&dtor_table_lock);
+  /* Now we have ensured that glwthread_tls_process_destructors will no longer
+     use this key.  */
+
+  if (!TlsFree (key))
+    return EINVAL;
+  return 0;
+}
deleted file mode 120000 (symlink)
index 55cd7268661510978b062e1665a71bc0c44e8746..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/windows-tls.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d9393fe9a2fea20b4f45700648bd15057729f2b1
--- /dev/null
@@ -0,0 +1,42 @@
+/* Thread-local storage (native Windows implementation).
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#ifndef _WINDOWS_TLS_H
+#define _WINDOWS_TLS_H
+
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+
+typedef DWORD glwthread_tls_key_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int glwthread_tls_key_create (glwthread_tls_key_t *keyp, void (*destructor) (void *));
+extern void *glwthread_tls_get (glwthread_tls_key_t key);
+extern int glwthread_tls_set (glwthread_tls_key_t key, void *value);
+extern int glwthread_tls_key_delete (glwthread_tls_key_t key);
+extern void glwthread_tls_process_destructors (void);
+#define GLWTHREAD_DESTRUCTOR_ITERATIONS 4
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_TLS_H */
deleted file mode 120000 (symlink)
index 2e8623fe5f2fad1435bfd3fbe0a94301da95dd85..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wmemchr-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0cdecb8a2398254e22b6840801098791a4ece83a
--- /dev/null
@@ -0,0 +1,27 @@
+/* Search wide character array for a wide character.
+   Copyright (C) 1999, 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+wchar_t *
+wmemchr (const wchar_t *s, wchar_t c, size_t n)
+{
+  for (; n > 0; s++, n--)
+    {
+      if (*s == c)
+        return (wchar_t *) s;
+    }
+  return NULL;
+}
deleted file mode 120000 (symlink)
index b54098ff7f58a10b45b6314e1ce4fa9e635c51ac..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wmemchr.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..268d81b168492a7578bea119793c3a13381cf9ec
--- /dev/null
@@ -0,0 +1,23 @@
+/* Search wide character array for a wide character.
+   Copyright (C) 2011-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+#include "wmemchr-impl.h"
deleted file mode 120000 (symlink)
index b5864b953a8a6f9fc747c57b0142bfeab59ddb22..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/wmempcpy.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d0163f526587816595f91b9238209ecf0abd0dee
--- /dev/null
@@ -0,0 +1,28 @@
+/* Copy wide character array, return pointer after last written wide character.
+   Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <wchar.h>
+
+/* Copy N wide characters of SRC to DEST.
+   Return pointer to wide characters after the last written wide character.  */
+wchar_t *
+wmempcpy (wchar_t *dest, const wchar_t *src, size_t n)
+{
+  return wmemcpy (dest, src, n) + n;
+}
deleted file mode 120000 (symlink)
index 73a97ae092e376929e4fcf26d818390aebc2d3bf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/write-any-file.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..27ca2c47c55741fcbe7cebe2a77d67fef0eb8d8c
--- /dev/null
@@ -0,0 +1,51 @@
+/* Determine whether we can write any file.
+
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "write-any-file.h"
+#include "priv-set.h"
+#include "root-uid.h"
+
+#include <unistd.h>
+
+/* Return true if we know that we can write any file, including
+   writing directories.  */
+
+bool
+can_write_any_file (void)
+{
+  static bool initialized;
+  static bool can_write;
+
+  if (! initialized)
+    {
+      bool can = false;
+#if defined PRIV_FILE_DAC_WRITE
+      can = (priv_set_ismember (PRIV_FILE_DAC_WRITE) == 1);
+#else
+      /* In traditional Unix, only root can unlink directories.  */
+      can = (geteuid () == ROOT_UID);
+#endif
+      can_write = can;
+      initialized = true;
+    }
+
+  return can_write;
+}
deleted file mode 120000 (symlink)
index f58cd1da7df138bb3757b73e84c9e9bf09b34179..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/write-any-file.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..959fe267b3b6381580c321ebbdfafcb8fcbe4711
--- /dev/null
@@ -0,0 +1,18 @@
+/* Determine whether we can write any file.
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+bool can_write_any_file (void);
deleted file mode 120000 (symlink)
index 90e0a232aec5b2404ae1b290adb49b4b957f68fe..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/write.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..59b3a7796a2d9bba0aae036f424f882fa03c1683
--- /dev/null
@@ -0,0 +1,155 @@
+/* POSIX compatible write() function.
+   Copyright (C) 2008-2024 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+/* On native Windows platforms, SIGPIPE does not exist.  When write() is
+   called on a pipe with no readers, WriteFile() fails with error
+   GetLastError() = ERROR_NO_DATA, and write() in consequence fails with
+   error EINVAL.  */
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+# include <errno.h>
+# include <signal.h>
+# include <io.h>
+
+# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+# include <windows.h>
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+#  include "msvc-inval.h"
+# endif
+# if GNULIB_MSVC_NOTHROW
+#  include "msvc-nothrow.h"
+# else
+#  include <io.h>
+# endif
+
+/* Don't assume that UNICODE is not defined.  */
+# undef GetNamedPipeHandleState
+# define GetNamedPipeHandleState GetNamedPipeHandleStateA
+
+# undef write
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static ssize_t
+write_nothrow (int fd, const void *buf, size_t count)
+{
+  ssize_t result;
+
+  TRY_MSVC_INVAL
+    {
+      result = _write (fd, buf, count);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = -1;
+      errno = EBADF;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+# else
+#  define write_nothrow _write
+# endif
+
+ssize_t
+rpl_write (int fd, const void *buf, size_t count)
+{
+  for (;;)
+    {
+      ssize_t ret = write_nothrow (fd, buf, count);
+
+      if (ret < 0)
+        {
+# if GNULIB_NONBLOCKING
+          if (errno == ENOSPC)
+            {
+              HANDLE h = (HANDLE) _get_osfhandle (fd);
+              if (GetFileType (h) == FILE_TYPE_PIPE)
+                {
+                  /* h is a pipe or socket.  */
+                  DWORD state;
+                  if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL,
+                                               NULL, 0)
+                      && (state & PIPE_NOWAIT) != 0)
+                    {
+                      /* h is a pipe in non-blocking mode.
+                         We can get here in four situations:
+                           1. When the pipe buffer is full.
+                           2. When count <= pipe_buf_size and the number of
+                              free bytes in the pipe buffer is < count.
+                           3. When count > pipe_buf_size and the number of free
+                              bytes in the pipe buffer is > 0, < pipe_buf_size.
+                           4. When count > pipe_buf_size and the pipe buffer is
+                              entirely empty.
+                         The cases 1 and 2 are POSIX compliant.  In cases 3 and
+                         4 POSIX specifies that write() must split the request
+                         and succeed with a partial write.  We fix case 4.
+                         We don't fix case 3 because it is not essential for
+                         programs.  */
+                      DWORD out_size; /* size of the buffer for outgoing data */
+                      DWORD in_size;  /* size of the buffer for incoming data */
+                      if (GetNamedPipeInfo (h, NULL, &out_size, &in_size, NULL))
+                        {
+                          size_t reduced_count = count;
+                          /* In theory we need only one of out_size, in_size.
+                             But I don't know which of the two.  The description
+                             is ambiguous.  */
+                          if (out_size != 0 && out_size < reduced_count)
+                            reduced_count = out_size;
+                          if (in_size != 0 && in_size < reduced_count)
+                            reduced_count = in_size;
+                          if (reduced_count < count)
+                            {
+                              /* Attempt to write only the first part.  */
+                              count = reduced_count;
+                              continue;
+                            }
+                        }
+                      /* Change errno from ENOSPC to EAGAIN.  */
+                      errno = EAGAIN;
+                    }
+                }
+            }
+          else
+# endif
+            {
+# if GNULIB_SIGPIPE
+              if (GetLastError () == ERROR_NO_DATA
+                  && GetFileType ((HANDLE) _get_osfhandle (fd))
+                     == FILE_TYPE_PIPE)
+                {
+                  /* Try to raise signal SIGPIPE.  */
+                  raise (SIGPIPE);
+                  /* If it is currently blocked or ignored, change errno from
+                     EINVAL to EPIPE.  */
+                  errno = EPIPE;
+                }
+# endif
+            }
+        }
+      return ret;
+    }
+}
+
+#endif
deleted file mode 120000 (symlink)
index 56779c274827cbb36582f1bc4e3933c861be82ef..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xalignalloc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b40dba5cbad3356d175f6e770db2a9fe51ce44da
--- /dev/null
@@ -0,0 +1,33 @@
+/* checked aligned memory allocation
+
+   Copyright 2022-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "alignalloc.h"
+
+#include "xalloc.h"
+
+void *
+xalignalloc (idx_t alignment, idx_t size)
+{
+  void *p = alignalloc (alignment, size);
+  if (!p)
+    xalloc_die ();
+  return p;
+}
deleted file mode 120000 (symlink)
index c9a5d4619e0019daafd0ca09cc78f0bd2800cdf5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xalloc-die.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c053c7a8db27154fdb9b09a159dd88ea96ab9caa
--- /dev/null
@@ -0,0 +1,41 @@
+/* Report a memory allocation failure and exit.
+
+   Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "xalloc.h"
+
+#include <stdlib.h>
+
+#include <error.h>
+#include "exitfail.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+void
+xalloc_die (void)
+{
+  error (exit_failure, 0, "%s", _("memory exhausted"));
+
+  /* _Noreturn cannot be given to error, since it may return if
+     its first argument is 0.  To help compilers understand the
+     xalloc_die does not return, call abort.  Also, the abort is a
+     safety feature if exit_failure is 0 (which shouldn't happen).  */
+  abort ();
+}
deleted file mode 120000 (symlink)
index 8fbb1ca6552d791d539b87197a1fa40306a72d76..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xalloc-oversized.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0b7bb2cee85ae0845b413598f4b33ffd70bfab16
--- /dev/null
@@ -0,0 +1,65 @@
+/* xalloc-oversized.h -- memory allocation size checking
+
+   Copyright (C) 1990-2000, 2003-2004, 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef XALLOC_OVERSIZED_H_
+#define XALLOC_OVERSIZED_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* True if N * S does not fit into both ptrdiff_t and size_t.
+   N and S should be nonnegative and free of side effects.
+   This expands to a constant expression if N and S are both constants.
+   By gnulib convention, SIZE_MAX represents overflow in size_t
+   calculations, so the conservative size_t-based dividend to use here
+   is SIZE_MAX - 1.  */
+#define __xalloc_oversized(n, s) \
+  ((s) != 0 \
+   && ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) \
+       < (n)))
+
+/* Return 1 if and only if an array of N objects, each of size S,
+   cannot exist reliably because its total size in bytes would exceed
+   MIN (PTRDIFF_MAX, SIZE_MAX - 1).
+
+   N and S should be nonnegative and free of side effects.
+
+   Warning: (xalloc_oversized (N, S) ? NULL : malloc (N * S)) can
+   misbehave if N and S are both narrower than ptrdiff_t and size_t,
+   and can be rewritten as (xalloc_oversized (N, S) ?  NULL
+   : malloc (N * (size_t) S)).
+
+   This is a macro, not a function, so that it works even if an
+   argument exceeds MAX (PTRDIFF_MAX, SIZE_MAX).  */
+#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX
+# define xalloc_oversized(n, s) \
+   __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1)
+#elif 5 <= __GNUC__ && !defined __ICC && PTRDIFF_MAX < SIZE_MAX
+# define xalloc_oversized(n, s) \
+   (__builtin_constant_p (n) && __builtin_constant_p (s) \
+    ? __xalloc_oversized (n, s) \
+    : __extension__ \
+        ({ ptrdiff_t __xalloc_count; \
+           __builtin_mul_overflow (n, s, &__xalloc_count); }))
+
+/* Other compilers use integer division; this may be slower but is
+   more portable.  */
+#else
+# define xalloc_oversized(n, s) __xalloc_oversized (n, s)
+#endif
+
+#endif /* !XALLOC_OVERSIZED_H_ */
deleted file mode 120000 (symlink)
index 220f400a7c945a99a7c863ac2d4df3ec63621f98..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xalloc.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..75a5db30bb90f468538df17ffd08dd8706a4534b
--- /dev/null
@@ -0,0 +1,215 @@
+/* xalloc.h -- malloc with out-of-memory checking
+
+   Copyright (C) 1990-2000, 2003-2004, 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef XALLOC_H_
+#define XALLOC_H_
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _Noreturn,
+   _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_MALLOC,
+   _GL_ATTRIBUTE_RETURNS_NONNULL.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#if GNULIB_XALLOC
+# include "idx.h"
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef XALLOC_INLINE
+# define XALLOC_INLINE _GL_INLINE
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if GNULIB_XALLOC_DIE
+
+/* This function is always triggered when memory is exhausted.
+   It must be defined by the application, either explicitly
+   or by using gnulib's xalloc-die module.  This is the
+   function to call when one wants the program to die because of a
+   memory allocation failure.  */
+_Noreturn void xalloc_die (void);
+
+#endif /* GNULIB_XALLOC_DIE */
+
+#if GNULIB_XALLOC
+
+void *xmalloc (size_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *ximalloc (idx_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *xinmalloc (idx_t n, idx_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *xzalloc (size_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *xizalloc (idx_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *xcalloc (size_t n, size_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *xicalloc (idx_t n, idx_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *xrealloc (void *p, size_t s)
+  _GL_ATTRIBUTE_ALLOC_SIZE ((2));
+void *xirealloc (void *p, idx_t s)
+  _GL_ATTRIBUTE_ALLOC_SIZE ((2)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *xreallocarray (void *p, size_t n, size_t s)
+  _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3));
+void *xireallocarray (void *p, idx_t n, idx_t s)
+  _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *x2realloc (void *p, size_t *ps) /* superseded by xpalloc */
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *x2nrealloc (void *p, size_t *pn, size_t s) /* superseded by xpalloc */
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s)
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *xmemdup (void const *p, size_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((2)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+void *ximemdup (void const *p, idx_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((2)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+char *ximemdup0 (void const *p, idx_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+char *xstrdup (char const *str)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+/* In the following macros, T must be an elementary or structure/union or
+   typedef'ed type, or a pointer to such a type.  To apply one of the
+   following macros to a function pointer or array type, you need to typedef
+   it first and use the typedef name.  */
+
+/* Allocate an object of type T dynamically, with error checking.  */
+/* extern t *XMALLOC (typename t); */
+# define XMALLOC(t) ((t *) xmalloc (sizeof (t)))
+
+/* Allocate memory for N elements of type T, with error checking.  */
+/* extern t *XNMALLOC (size_t n, typename t); */
+# define XNMALLOC(n, t) \
+    ((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t))))
+
+/* Allocate an object of type T dynamically, with error checking,
+   and zero it.  */
+/* extern t *XZALLOC (typename t); */
+# define XZALLOC(t) ((t *) xzalloc (sizeof (t)))
+
+/* Allocate memory for N elements of type T, with error checking,
+   and zero it.  */
+/* extern t *XCALLOC (size_t n, typename t); */
+# define XCALLOC(n, t) \
+    ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t))))
+
+
+/* Allocate an array of N objects, each with S bytes of memory,
+   dynamically, with error checking.  S must be nonzero.  */
+
+void *xnmalloc (size_t n, size_t s)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+/* FIXME: Deprecate this in favor of xreallocarray?  */
+/* Change the size of an allocated block of memory P to an array of N
+   objects each of S bytes, with error checking.  S must be nonzero.  */
+
+XALLOC_INLINE void *xnrealloc (void *p, size_t n, size_t s)
+  _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3));
+XALLOC_INLINE void *
+xnrealloc (void *p, size_t n, size_t s)
+{
+  return xreallocarray (p, n, s);
+}
+
+/* Return a pointer to a new buffer of N bytes.  This is like xmalloc,
+   except it returns char *.  */
+
+char *xcharalloc (size_t n)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL;
+
+#endif /* GNULIB_XALLOC */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#if GNULIB_XALLOC && defined __cplusplus
+
+/* C++ does not allow conversions from void * to other pointer types
+   without a cast.  Use templates to work around the problem when
+   possible.  */
+
+template <typename T> inline T *
+xrealloc (T *p, size_t s)
+{
+  return (T *) xrealloc ((void *) p, s);
+}
+
+template <typename T> inline T *
+xreallocarray (T *p, size_t n, size_t s)
+{
+  return (T *) xreallocarray ((void *) p, n, s);
+}
+
+/* FIXME: Deprecate this in favor of xreallocarray?  */
+template <typename T> inline T *
+xnrealloc (T *p, size_t n, size_t s)
+{
+  return xreallocarray (p, n, s);
+}
+
+template <typename T> inline T *
+x2realloc (T *p, size_t *pn)
+{
+  return (T *) x2realloc ((void *) p, pn);
+}
+
+template <typename T> inline T *
+x2nrealloc (T *p, size_t *pn, size_t s)
+{
+  return (T *) x2nrealloc ((void *) p, pn, s);
+}
+
+template <typename T> inline T *
+xmemdup (T const *p, size_t s)
+{
+  return (T *) xmemdup ((void const *) p, s);
+}
+
+#endif /* GNULIB_XALLOC && C++ */
+
+
+_GL_INLINE_HEADER_END
+
+#endif /* !XALLOC_H_ */
deleted file mode 120000 (symlink)
index 1ec07a18b574b4c1406abe773593a7561259bd41..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xasprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..db70619f6b6c81ac88593550437bf115918397c3
--- /dev/null
@@ -0,0 +1,34 @@
+/* vasprintf and asprintf with out-of-memory checking.
+   Copyright (C) 1999, 2002-2004, 2006, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "xvasprintf.h"
+
+char *
+xasprintf (const char *format, ...)
+{
+  va_list args;
+  char *result;
+
+  va_start (args, format);
+  result = xvasprintf (format, args);
+  va_end (args);
+
+  return result;
+}
deleted file mode 120000 (symlink)
index 97757bf85d68a64a665c106eff6c6a50b1b010b0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xbinary-io.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..85e50cd7f8187e026223e2b4ae4580ea207301c7
--- /dev/null
@@ -0,0 +1,40 @@
+/* Binary mode I/O with checking
+   Copyright 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define XBINARY_IO_INLINE _GL_EXTERN_INLINE
+#include "xbinary-io.h"
+
+#include <errno.h>
+#include <error.h>
+#include "exitfail.h"
+#include "verify.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+#if O_BINARY
+
+_Noreturn void
+xset_binary_mode_error (void)
+{
+  error (exit_failure, errno,
+         _("failed to set file descriptor text/binary mode"));
+  assume (false);
+}
+
+#endif
deleted file mode 120000 (symlink)
index bb565581bd624015bc0c1f93e3b161b4bb085ef5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xbinary-io.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..67d3334ce2e6bb6c9b818ec78cc70abc15b96f6e
--- /dev/null
@@ -0,0 +1,50 @@
+/* Binary mode I/O with checking
+   Copyright 2017-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _XBINARY_IO_H
+#define _XBINARY_IO_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _Noreturn.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include "binary-io.h"
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef XBINARY_IO_INLINE
+# define XBINARY_IO_INLINE _GL_INLINE
+#endif
+
+#if O_BINARY
+extern _Noreturn void xset_binary_mode_error (void);
+#else
+XBINARY_IO_INLINE void xset_binary_mode_error (void) {}
+#endif
+
+/* Set the mode of FD to MODE, which should be either O_TEXT or O_BINARY.
+   Report an error and exit if this fails.  */
+
+XBINARY_IO_INLINE void
+xset_binary_mode (int fd, int mode)
+{
+  if (set_binary_mode (fd, mode) < 0)
+    xset_binary_mode_error ();
+}
+
+_GL_INLINE_HEADER_END
+
+#endif /* _XBINARY_IO_H */
deleted file mode 120000 (symlink)
index 85918c5fb16c37e41a475f4ed135c51691800e08..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xgetaname-impl.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4a764300a1748ebd86b22ad87c0a877295c76668
--- /dev/null
@@ -0,0 +1,63 @@
+/* xgetaname-impl.c -- common implementation of xgethostname and xgetdomainname
+
+   Copyright (C) 1992, 1996, 2000-2001, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering and Paul Eggert */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "xalloc.h"
+
+/* Return the current host or domain name in malloc'd storage.
+   If malloc fails, exit.
+   Upon any other failure, return NULL and set errno.  */
+char *
+XGETANAME (void)
+{
+  char buf[100];
+  idx_t size = sizeof buf;
+  char *name = buf;
+  char *alloc = NULL;
+
+  while (1)
+    {
+      /* Use SIZE_1 here rather than SIZE to work around the bug in
+         SunOS 5.5's gethostname whereby it NUL-terminates HOSTNAME
+         even when the name is as long as the supplied buffer.  */
+      idx_t size_1 = size - 1;
+      name[size_1] = '\0';
+      errno = 0;
+      if (GETANAME (name, size_1) == 0)
+        {
+          /* Check whether the name was possibly truncated; POSIX does not
+             specify whether a truncated name is null-terminated.  */
+          idx_t actual_size = strlen (name) + 1;
+          if (actual_size < size_1)
+            return alloc ? alloc : ximemdup (name, actual_size);
+          errno = 0;
+        }
+      free (alloc);
+      if (errno != 0 && errno != ENAMETOOLONG && errno != EINVAL
+          /* macOS/Darwin does this when SIZE_1 is too small.  */
+          && errno != ENOMEM)
+        return NULL;
+      name = alloc = xpalloc (NULL, &size, 1, -1, 1);
+    }
+}
deleted file mode 120000 (symlink)
index 4ecfda863810d3620a143f99916c80a1bd871e1c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xgetcwd.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dc0d2968fa28f73208bb72d603620ed559371203
--- /dev/null
@@ -0,0 +1,41 @@
+/* xgetcwd.c -- return current directory with unlimited length
+
+   Copyright (C) 2001, 2003-2004, 2006-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "xgetcwd.h"
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "xalloc.h"
+
+/* Return the current directory, newly allocated.
+   Upon an out-of-memory error, call xalloc_die.
+   Upon any other type of error, return NULL with errno set.  */
+
+char *
+xgetcwd (void)
+{
+  char *cwd = getcwd (NULL, 0);
+  if (! cwd && errno == ENOMEM)
+    xalloc_die ();
+  return cwd;
+}
deleted file mode 120000 (symlink)
index 0c70bdca7e01fa076181486d842e19960c1599c6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xgetcwd.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..425ea16fdf8e471cb5257685cb5f62259ac1ec3b
--- /dev/null
@@ -0,0 +1,25 @@
+/* prototype for xgetcwd
+   Copyright (C) 1995, 2001, 2003, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses _GL_ATTRIBUTE_MALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdlib.h>
+
+extern char *xgetcwd (void)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
deleted file mode 120000 (symlink)
index ac9992b4a1d5e266be57d9cf44aa38f46a71685e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xgetgroups.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..91c6db221c042b139a6d14d34a8490c6c84a128a
--- /dev/null
@@ -0,0 +1,37 @@
+/* xgetgroups.c -- return a list of the groups a user or current process is in
+
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Extracted from coreutils' src/id.c. */
+
+#include <config.h>
+
+#include "mgetgroups.h"
+
+#include <errno.h>
+
+#include "xalloc.h"
+
+/* Like mgetgroups, but call xalloc_die on allocation failure.  */
+
+int
+xgetgroups (char const *username, gid_t gid, gid_t **groups)
+{
+  int result = mgetgroups (username, gid, groups);
+  if (result == -1 && errno == ENOMEM)
+    xalloc_die ();
+  return result;
+}
deleted file mode 120000 (symlink)
index 478005ee17fd5c99770a6fdbb098807ec269ebe3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xgethostname.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..be04dd6e7884f5ef37ac817a8f90cbc2a043dfe1
--- /dev/null
@@ -0,0 +1,28 @@
+/* xgethostname.c -- return current hostname with unlimited length
+
+   Copyright (C) 1992, 1996, 2000-2001, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering and Paul Eggert */
+
+#include <config.h>
+
+/* Specification.  */
+#include "xgethostname.h"
+
+#define GETANAME gethostname
+#define XGETANAME xgethostname
+#include "xgetaname-impl.h"
deleted file mode 120000 (symlink)
index edc48238344430a1f9eb222648d87b9a0af29271..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xgethostname.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6f0d6b00590b588c1649ed7c0c2445a7f0e6a6cd
--- /dev/null
@@ -0,0 +1,26 @@
+/* Return current hostname with unlimited length.
+
+   Copyright (C) 2003-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This file uses _GL_ATTRIBUTE_MALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdlib.h>
+
+char *xgethostname (void)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
deleted file mode 120000 (symlink)
index af54ca000ebe75e32ccdd94bf9481895ede4e895..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xmalloc.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..82e54ef1a5931327e29d37262dee02ba302e9227
--- /dev/null
@@ -0,0 +1,340 @@
+/* xmalloc.c -- malloc with out of memory checking
+
+   Copyright (C) 1990-2000, 2002-2006, 2008-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define XALLOC_INLINE _GL_EXTERN_INLINE
+
+#include "xalloc.h"
+
+#include "ialloc.h"
+#include "minmax.h"
+
+#include <stdckdint.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+static void * _GL_ATTRIBUTE_PURE
+nonnull (void *p)
+{
+  if (!p)
+    xalloc_die ();
+  return p;
+}
+
+/* Allocate S bytes of memory dynamically, with error checking.  */
+
+void *
+xmalloc (size_t s)
+{
+  return nonnull (malloc (s));
+}
+
+void *
+ximalloc (idx_t s)
+{
+  return nonnull (imalloc (s));
+}
+
+char *
+xcharalloc (size_t n)
+{
+  return XNMALLOC (n, char);
+}
+
+/* Change the size of an allocated block of memory P to S bytes,
+   with error checking.  */
+
+void *
+xrealloc (void *p, size_t s)
+{
+  void *r = realloc (p, s);
+  if (!r && (!p || s))
+    xalloc_die ();
+  return r;
+}
+
+void *
+xirealloc (void *p, idx_t s)
+{
+  return nonnull (irealloc (p, s));
+}
+
+/* Change the size of an allocated block of memory P to an array of N
+   objects each of S bytes, with error checking.  */
+
+void *
+xreallocarray (void *p, size_t n, size_t s)
+{
+  void *r = reallocarray (p, n, s);
+  if (!r && (!p || (n && s)))
+    xalloc_die ();
+  return r;
+}
+
+void *
+xireallocarray (void *p, idx_t n, idx_t s)
+{
+  return nonnull (ireallocarray (p, n, s));
+}
+
+/* Allocate an array of N objects, each with S bytes of memory,
+   dynamically, with error checking.  S must be nonzero.  */
+
+void *
+xnmalloc (size_t n, size_t s)
+{
+  return xreallocarray (NULL, n, s);
+}
+
+void *
+xinmalloc (idx_t n, idx_t s)
+{
+  return xireallocarray (NULL, n, s);
+}
+
+/* If P is null, allocate a block of at least *PS bytes; otherwise,
+   reallocate P so that it contains more than *PS bytes.  *PS must be
+   nonzero unless P is null.  Set *PS to the new block's size, and
+   return the pointer to the new block.  *PS is never set to zero, and
+   the returned pointer is never null.  */
+
+void *
+x2realloc (void *p, size_t *ps)
+{
+  return x2nrealloc (p, ps, 1);
+}
+
+/* If P is null, allocate a block of at least *PN such objects;
+   otherwise, reallocate P so that it contains more than *PN objects
+   each of S bytes.  S must be nonzero.  Set *PN to the new number of
+   objects, and return the pointer to the new block.  *PN is never set
+   to zero, and the returned pointer is never null.
+
+   Repeated reallocations are guaranteed to make progress, either by
+   allocating an initial block with a nonzero size, or by allocating a
+   larger block.
+
+   In the following implementation, nonzero sizes are increased by a
+   factor of approximately 1.5 so that repeated reallocations have
+   O(N) overall cost rather than O(N**2) cost, but the
+   specification for this function does not guarantee that rate.
+
+   Here is an example of use:
+
+     int *p = NULL;
+     size_t used = 0;
+     size_t allocated = 0;
+
+     void
+     append_int (int value)
+       {
+         if (used == allocated)
+           p = x2nrealloc (p, &allocated, sizeof *p);
+         p[used++] = value;
+       }
+
+   This causes x2nrealloc to allocate a block of some nonzero size the
+   first time it is called.
+
+   To have finer-grained control over the initial size, set *PN to a
+   nonzero value before calling this function with P == NULL.  For
+   example:
+
+     int *p = NULL;
+     size_t used = 0;
+     size_t allocated = 0;
+     size_t allocated1 = 1000;
+
+     void
+     append_int (int value)
+       {
+         if (used == allocated)
+           {
+             p = x2nrealloc (p, &allocated1, sizeof *p);
+             allocated = allocated1;
+           }
+         p[used++] = value;
+       }
+
+   */
+
+void *
+x2nrealloc (void *p, size_t *pn, size_t s)
+{
+  size_t n = *pn;
+
+  if (! p)
+    {
+      if (! n)
+        {
+          /* The approximate size to use for initial small allocation
+             requests, when the invoking code specifies an old size of
+             zero.  This is the largest "small" request for the GNU C
+             library malloc.  */
+          enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 };
+
+          n = DEFAULT_MXFAST / s;
+          n += !n;
+        }
+    }
+  else
+    {
+      /* Set N = floor (1.5 * N) + 1 to make progress even if N == 0.  */
+      if (ckd_add (&n, n, (n >> 1) + 1))
+        xalloc_die ();
+    }
+
+  p = xreallocarray (p, n, s);
+  *pn = n;
+  return p;
+}
+
+/* Grow PA, which points to an array of *PN items, and return the
+   location of the reallocated array, updating *PN to reflect its
+   new size.  The new array will contain at least N_INCR_MIN more
+   items, but will not contain more than N_MAX items total.
+   S is the size of each item, in bytes.
+
+   S and N_INCR_MIN must be positive.  *PN must be
+   nonnegative.  If N_MAX is -1, it is treated as if it were
+   infinity.
+
+   If PA is null, then allocate a new array instead of reallocating
+   the old one.
+
+   Thus, to grow an array A without saving its old contents, do
+   { free (A); A = xpalloc (NULL, &AITEMS, ...); }.  */
+
+void *
+xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s)
+{
+  idx_t n0 = *pn;
+
+  /* The approximate size to use for initial small allocation
+     requests.  This is the largest "small" request for the GNU C
+     library malloc.  */
+  enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 };
+
+  /* If the array is tiny, grow it to about (but no greater than)
+     DEFAULT_MXFAST bytes.  Otherwise, grow it by about 50%.
+     Adjust the growth according to three constraints: N_INCR_MIN,
+     N_MAX, and what the C language can represent safely.  */
+
+  idx_t n;
+  if (ckd_add (&n, n0, n0 >> 1))
+    n = IDX_MAX;
+  if (0 <= n_max && n_max < n)
+    n = n_max;
+
+  /* NBYTES is of a type suitable for holding the count of bytes in an object.
+     This is typically idx_t, but it should be size_t on (theoretical?)
+     platforms where SIZE_MAX < IDX_MAX so xpalloc does not pass
+     values greater than SIZE_MAX to xrealloc.  */
+#if IDX_MAX <= SIZE_MAX
+  idx_t nbytes;
+#else
+  size_t nbytes;
+#endif
+  idx_t adjusted_nbytes
+    = (ckd_mul (&nbytes, n, s)
+       ? MIN (IDX_MAX, SIZE_MAX)
+       : nbytes < DEFAULT_MXFAST ? DEFAULT_MXFAST : 0);
+  if (adjusted_nbytes)
+    {
+      n = adjusted_nbytes / s;
+      nbytes = adjusted_nbytes - adjusted_nbytes % s;
+    }
+
+  if (! pa)
+    *pn = 0;
+  if (n - n0 < n_incr_min
+      && (ckd_add (&n, n0, n_incr_min)
+          || (0 <= n_max && n_max < n)
+          || ckd_mul (&nbytes, n, s)))
+    xalloc_die ();
+  pa = xrealloc (pa, nbytes);
+  *pn = n;
+  return pa;
+}
+
+/* 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 xcalloc (s, 1);
+}
+
+void *
+xizalloc (idx_t s)
+{
+  return xicalloc (s, 1);
+}
+
+/* Allocate zeroed memory for N elements of S bytes, with error
+   checking.  S must be nonzero.  */
+
+void *
+xcalloc (size_t n, size_t s)
+{
+  return nonnull (calloc (n, s));
+}
+
+void *
+xicalloc (idx_t n, idx_t s)
+{
+  return nonnull (icalloc (n, s));
+}
+
+/* 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);
+}
+
+void *
+ximemdup (void const *p, idx_t s)
+{
+  return memcpy (ximalloc (s), p, s);
+}
+
+/* Clone an object P of size S, with error checking.  Append
+   a terminating NUL byte.  */
+
+char *
+ximemdup0 (void const *p, idx_t s)
+{
+  char *result = ximalloc (s + 1);
+  result[s] = 0;
+  return memcpy (result, p, s);
+}
+
+/* Clone STRING.  */
+
+char *
+xstrdup (char const *string)
+{
+  return xmemdup (string, strlen (string) + 1);
+}
deleted file mode 120000 (symlink)
index 06fa093d176fa4cd50051843aff1b7e3b6bff970..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xmemcoll.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..52a1b9149ee678a58754a003e6a41e5c61428a39
--- /dev/null
@@ -0,0 +1,76 @@
+/* Locale-specific memory comparison.
+
+   Copyright (C) 2002-2004, 2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Contributed by Paul Eggert <eggert@twinsun.com>.  */
+
+#include <config.h>
+
+#include <errno.h>
+#include <stdlib.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+#include <error.h>
+#include "exitfail.h"
+#include "memcoll.h"
+#include "quotearg.h"
+#include "xmemcoll.h"
+
+static void
+collate_error (int collation_errno,
+               char const *s1, size_t s1len,
+               char const *s2, size_t s2len)
+{
+  error (0, collation_errno, _("string comparison failed"));
+  error (0, 0, _("Set LC_ALL='C' to work around the problem."));
+  error (exit_failure, 0,
+         _("The strings compared were %s and %s."),
+         quotearg_n_style_mem (0, locale_quoting_style, s1, s1len),
+         quotearg_n_style_mem (1, locale_quoting_style, s2, s2len));
+}
+
+/* Compare S1 (with length S1LEN) and S2 (with length S2LEN) according
+   to the LC_COLLATE locale.  S1 and S2 do not overlap, and are not
+   adjacent.  Temporarily modify the bytes after S1 and S2, but
+   restore their original contents before returning.  Report an error
+   and exit if there is an error.  */
+
+int
+xmemcoll (char *s1, size_t s1len, char *s2, size_t s2len)
+{
+  int diff = memcoll (s1, s1len, s2, s2len);
+  int collation_errno = errno;
+  if (collation_errno)
+    collate_error (collation_errno, s1, s1len, s2, s2len);
+  return diff;
+}
+
+/* Compare S1 (a memory block of size S1SIZE, with a NUL as last byte)
+   and S2 (a memory block of size S2SIZE, with a NUL as last byte)
+   according to the LC_COLLATE locale.  S1SIZE and S2SIZE must be > 0.
+   Report an error and exit if there is an error.  */
+
+int
+xmemcoll0 (char const *s1, size_t s1size, char const *s2, size_t s2size)
+{
+  int diff = memcoll0 (s1, s1size, s2, s2size);
+  int collation_errno = errno;
+  if (collation_errno)
+    collate_error (collation_errno, s1, s1size - 1, s2, s2size - 1);
+  return diff;
+}
deleted file mode 120000 (symlink)
index b1c2a9189b444ff4db72761873f6ca7635c1b590..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xmemcoll.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..13b6a02cb9b3ed1126ebd7cbd8b18b6c0a69ba45
--- /dev/null
@@ -0,0 +1,21 @@
+/* Locale-specific memory comparison.
+
+   Copyright (C) 2002-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+
+int xmemcoll (char *restrict, size_t, char *restrict, size_t);
+int xmemcoll0 (char const *, size_t, char const *, size_t);
deleted file mode 120000 (symlink)
index d5cfe8f307faae804b60ba488a2091b43d1ec390..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xnanosleep.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..baf88db8baef794ae2c5f49417490455446a3d67
--- /dev/null
@@ -0,0 +1,76 @@
+/* A variant of nanosleep that takes a 'double' argument and handles EINTR.
+
+   Copyright (C) 2002-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Mostly written (for sleep.c) by Paul Eggert.
+   Factored out (creating this file) by Jim Meyering.  */
+
+#include <config.h>
+
+#include "xnanosleep.h"
+
+#include <intprops.h>
+#include <timespec.h>
+
+#include <errno.h>
+#include <time.h>
+#include <unistd.h>
+
+/* Sleep until the time (call it WAKE_UP_TIME) specified as
+   SECONDS seconds after the time this function is called.
+   SECONDS must be non-negative.  If SECONDS is so large that
+   it is not representable as a 'struct timespec', then use
+   the maximum value for that interval.  Return -1 on failure
+   (setting errno), 0 on success.  */
+
+int
+xnanosleep (double seconds)
+{
+#if HAVE_PAUSE
+  if (1.0 + TYPE_MAXIMUM (time_t) <= seconds)
+    {
+      do
+        pause ();
+      while (errno == EINTR);
+
+      /* pause failed (!); fall back on repeated nanosleep calls.  */
+    }
+#endif
+
+  struct timespec ts_sleep = dtotimespec (seconds);
+
+  for (;;)
+    {
+      /* Linux-2.6.8.1's nanosleep returns -1, but doesn't set errno
+         when resumed after being suspended.  Earlier versions would
+         set errno to EINTR.  nanosleep from linux-2.6.10, as well as
+         implementations by (all?) other vendors, doesn't return -1
+         in that case;  either it continues sleeping (if time remains)
+         or it returns zero (if the wake-up time has passed).
+
+         Gnulib's replacement nanosleep sometimes does not update
+         TS_SLEEP, and it is possible some kernels have a similar bug.
+         However, this merely causes xnanosleep to sleep longer than
+         necessary, which is not a correctness bug.  */
+      errno = 0;
+      if (nanosleep (&ts_sleep, &ts_sleep) == 0)
+        break;
+      if (errno != EINTR && errno != 0)
+        return -1;
+    }
+
+  return 0;
+}
deleted file mode 120000 (symlink)
index 93f3a866a8b7c31173944caf8815c1c590a08aaa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xnanosleep.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dcf2551f4a243d6a92d7ee6f534e3a9590f8f464
--- /dev/null
@@ -0,0 +1,25 @@
+/* A variant of nanosleep that takes a 'double' argument and handles EINTR.
+   Copyright (C) 2004-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int xnanosleep (double);
+
+#ifdef __cplusplus
+}
+#endif
deleted file mode 120000 (symlink)
index b11299d41867bf838d0d4e7ece3fc3c28cc7d239..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1957131f49c68fb6261bb3b53d5f971721beb1ae
--- /dev/null
@@ -0,0 +1,79 @@
+/* printf wrappers that fail immediately for non-file-related errors
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "xprintf.h"
+
+#include <errno.h>
+
+#include <error.h>
+#include "exitfail.h"
+#include "gettext.h"
+
+/* written by Jim Meyering */
+
+/* Just like printf, but call error if it fails without setting the
+   stream's error indicator.  */
+int
+xprintf (char const *restrict format, ...)
+{
+  va_list args;
+  int retval;
+  va_start (args, format);
+  retval = xvprintf (format, args);
+  va_end (args);
+
+  return retval;
+}
+
+/* Just like vprintf, but call error if it fails without setting the
+   stream's error indicator.  */
+int
+xvprintf (char const *restrict format, va_list args)
+{
+  int retval = vprintf (format, args);
+  if (retval < 0 && ! ferror (stdout))
+    error (exit_failure, errno, gettext ("cannot perform formatted output"));
+
+  return retval;
+}
+
+/* Just like fprintf, but call error if it fails without setting the
+   stream's error indicator.  */
+int
+xfprintf (FILE *restrict stream, char const *restrict format, ...)
+{
+  va_list args;
+  int retval;
+  va_start (args, format);
+  retval = xvfprintf (stream, format, args);
+  va_end (args);
+
+  return retval;
+}
+
+/* Just like vfprintf, but call error if it fails without setting the
+   stream's error indicator.  */
+int
+xvfprintf (FILE *restrict stream, char const *restrict format, va_list args)
+{
+  int retval = vfprintf (stream, format, args);
+  if (retval < 0 && ! ferror (stream))
+    error (exit_failure, errno, gettext ("cannot perform formatted output"));
+
+  return retval;
+}
deleted file mode 120000 (symlink)
index 1417ecc19b65efab0d43d812142a0b1f5baef375..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xprintf.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9e7d1e802a1e9d7d2363e6f3b039b4316d93fc2e
--- /dev/null
@@ -0,0 +1,61 @@
+/* printf wrappers that fail immediately for non-file-related errors
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _XPRINTF_H
+#define _XPRINTF_H
+
+/* This file uses _GL_ATTRIBUTE_FORMAT.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdarg.h>
+#include <stdio.h>
+
+extern int xprintf (char const *restrict format, ...)
+#if GNULIB_VPRINTF_POSIX
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2))
+#else
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 1, 2))
+#endif
+     ;
+
+extern int xvprintf (char const *restrict format, va_list args)
+#if GNULIB_VPRINTF_POSIX
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0))
+#else
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 1, 0))
+#endif
+     ;
+
+extern int xfprintf (FILE *restrict stream, char const *restrict format, ...)
+#if GNULIB_VFPRINTF_POSIX
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 2, 3))
+#else
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 2, 3))
+#endif
+     ;
+
+extern int xvfprintf (FILE *restrict stream, char const *restrict format,
+                      va_list args)
+#if GNULIB_VFPRINTF_POSIX
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 2, 0))
+#else
+     _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 2, 0))
+#endif
+     ;
+
+#endif
deleted file mode 120000 (symlink)
index 8e5afc537813602e6234e7caa83e403d5095d980..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xreadlink.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f01bdd621d19c799eb2cfebebcb6eba064adaa60
--- /dev/null
@@ -0,0 +1,44 @@
+/* xreadlink.c -- readlink wrapper to return the link name in malloc'd storage
+
+   Copyright (C) 2001, 2003-2007, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering <jim@meyering.net>
+   and Bruno Haible <bruno@clisp.org>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "xreadlink.h"
+
+#include <errno.h>
+
+#include "areadlink.h"
+#include "xalloc.h"
+
+/* Call readlink to get the symbolic link value of FILENAME.
+   Return a pointer to that NUL-terminated string in malloc'd storage.
+   If readlink fails, return NULL and set errno.
+   If realloc fails, or if the link value is longer than SIZE_MAX :-),
+   give a diagnostic and exit.  */
+
+char *
+xreadlink (char const *filename)
+{
+  char *result = areadlink (filename);
+  if (result == NULL && errno == ENOMEM)
+    xalloc_die ();
+  return result;
+}
deleted file mode 120000 (symlink)
index cd7dba434c12880819e0d07a9a960d3a28135a16..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xreadlink.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6dce9bcc29b7f767e6acdbba1fd322728b32a0de
--- /dev/null
@@ -0,0 +1,34 @@
+/* Reading symbolic links without size limitation.
+
+   Copyright (C) 2001, 2003-2004, 2007, 2009-2024 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering <jim@meyering.net>  */
+
+/* This file uses _GL_ATTRIBUTE_MALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stdlib.h>
+
+extern char *xreadlink (char const *filename)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+
+#if GNULIB_XREADLINKAT
+extern char *xreadlinkat (int fd, char const *filename)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+#endif
deleted file mode 120000 (symlink)
index 0286e7fa0cb42eada7485c7d71d135a4cc6ad8f8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xsize.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8774467536014c7202db3329bdc16fe6b5cccbee
--- /dev/null
@@ -0,0 +1,21 @@
+/* Checked size_t computations.
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define XSIZE_INLINE _GL_EXTERN_INLINE
+#include "xsize.h"
deleted file mode 120000 (symlink)
index 342e58980f1c766ed4f80c40e110402ab9f26b23..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xsize.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..71c9c07322e5b7e10dcb6e536e02d7f8a85a173c
--- /dev/null
@@ -0,0 +1,110 @@
+/* xsize.h -- Checked size_t computations.
+
+   Copyright (C) 2003, 2008-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _XSIZE_H
+#define _XSIZE_H
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, HAVE_STDINT_H.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get size_t.  */
+#include <stddef.h>
+
+/* Get SIZE_MAX.  */
+#include <limits.h>
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+/* Get ATTRIBUTE_PURE.  */
+#include "attribute.h"
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef XSIZE_INLINE
+# define XSIZE_INLINE _GL_INLINE
+#endif
+
+/* The size of memory objects is often computed through expressions of
+   type size_t. Example:
+      void* p = malloc (header_size + n * element_size).
+   These computations can lead to overflow.  When this happens, malloc()
+   returns a piece of memory that is way too small, and the program then
+   crashes while attempting to fill the memory.
+   To avoid this, the functions and macros in this file check for overflow.
+   The convention is that SIZE_MAX represents overflow.
+   malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
+   implementation that uses mmap --, it's recommended to use size_overflow_p()
+   or size_in_bounds_p() before invoking malloc().
+   The example thus becomes:
+      size_t size = xsum (header_size, xtimes (n, element_size));
+      void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
+*/
+
+/* Convert an arbitrary value >= 0 to type size_t.  */
+#define xcast_size_t(N) \
+  ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
+
+/* Sum of two sizes, with overflow check.  */
+XSIZE_INLINE size_t ATTRIBUTE_PURE
+xsum (size_t size1, size_t size2)
+{
+  size_t sum = size1 + size2;
+  return (sum >= size1 ? sum : SIZE_MAX);
+}
+
+/* Sum of three sizes, with overflow check.  */
+XSIZE_INLINE size_t ATTRIBUTE_PURE
+xsum3 (size_t size1, size_t size2, size_t size3)
+{
+  return xsum (xsum (size1, size2), size3);
+}
+
+/* Sum of four sizes, with overflow check.  */
+XSIZE_INLINE size_t ATTRIBUTE_PURE
+xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
+{
+  return xsum (xsum (xsum (size1, size2), size3), size4);
+}
+
+/* Maximum of two sizes, with overflow check.  */
+XSIZE_INLINE size_t ATTRIBUTE_PURE
+xmax (size_t size1, size_t size2)
+{
+  /* No explicit check is needed here, because for any n:
+     max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX.  */
+  return (size1 >= size2 ? size1 : size2);
+}
+
+/* Multiplication of a count with an element size, with overflow check.
+   The count must be >= 0 and the element size must be > 0.
+   This is a macro, not a function, so that it works correctly even
+   when N is of a wider type and N > SIZE_MAX.  */
+#define xtimes(N, ELSIZE) \
+  ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
+
+/* Check for overflow.  */
+#define size_overflow_p(SIZE) \
+  ((SIZE) == SIZE_MAX)
+/* Check against overflow.  */
+#define size_in_bounds_p(SIZE) \
+  ((SIZE) != SIZE_MAX)
+
+_GL_INLINE_HEADER_END
+
+#endif /* _XSIZE_H */
deleted file mode 120000 (symlink)
index d3efa1ca6a0b6fa66a952e2428164acff473e2d9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtod.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..55b4bb4a8f2005708e546be055f5786f43dbd744
--- /dev/null
@@ -0,0 +1,71 @@
+/* error-checking interface to strtod-like functions
+
+   Copyright (C) 1996, 1999-2000, 2003-2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#include <config.h>
+
+#include "xstrtod.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+
+#if LONG
+# define XSTRTOD xstrtold
+# define DOUBLE long double
+#else
+# define XSTRTOD xstrtod
+# define DOUBLE double
+#endif
+
+/* An interface to a string-to-floating-point conversion function that
+   encapsulates all the error checking one should usually perform.
+   Like strtod/strtold, but stores the conversion in *RESULT,
+   and returns true upon successful conversion.
+   CONVERT specifies the conversion function, e.g., strtod itself.  */
+
+bool
+XSTRTOD (char const *str, char const **ptr, DOUBLE *result,
+         DOUBLE (*convert) (char const *, char **))
+{
+  DOUBLE val;
+  char *terminator;
+  bool ok = true;
+
+  errno = 0;
+  val = convert (str, &terminator);
+
+  /* Having a non-zero terminator is an error only when PTR is NULL. */
+  if (terminator == str || (ptr == NULL && *terminator != '\0'))
+    ok = false;
+  else
+    {
+      /* Allow underflow (in which case CONVERT returns zero),
+         but flag overflow as an error.  The user can decide
+         to use the limits in RESULT upon ERANGE.  */
+      if (val != 0 && errno == ERANGE)
+        ok = false;
+    }
+
+  if (ptr != NULL)
+    *ptr = terminator;
+
+  *result = val;
+  return ok;
+}
deleted file mode 120000 (symlink)
index b0fa386719260b26e3d4cef68b4b92004886079a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtod.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0780f5fe1483c779cb1750438ed481e20c9bddca
--- /dev/null
@@ -0,0 +1,29 @@
+/* Error-checking interface to strtod-like functions.
+
+   Copyright (C) 1996, 1998, 2003-2004, 2006, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+#ifndef XSTRTOD_H
+# define XSTRTOD_H 1
+
+bool xstrtod (const char *str, const char **ptr, double *result,
+              double (*convert) (char const *, char **));
+bool xstrtold (const char *str, const char **ptr, long double *result,
+               long double (*convert) (char const *, char **));
+
+#endif /* not XSTRTOD_H */
deleted file mode 120000 (symlink)
index 9ca9e337d317ce80ae20a868077a80d83e15715a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtoimax.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..72a0aae21cbd11a7de9a32e6ced7bb4d3bb23012
--- /dev/null
@@ -0,0 +1,24 @@
+/* A more useful interface to strtoimax.
+
+   Copyright (C) 2001-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define __strtol strtoimax
+#define __strtol_t intmax_t
+#define __xstrtol xstrtoimax
+#define STRTOL_T_MINIMUM INTMAX_MIN
+#define STRTOL_T_MAXIMUM INTMAX_MAX
+#define XSTRTOL_INCLUDE_INTTYPES_H 1
+#include "xstrtol.c"
deleted file mode 120000 (symlink)
index 2617e104326fb58a346a89944a4df72aa931712c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtol-error.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..16d817a467c77338907590122046ee229c9401b0
--- /dev/null
@@ -0,0 +1,98 @@
+/* A more useful interface to strtol.
+
+   Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+#include "xstrtol-error.h"
+
+#include <stdlib.h>
+
+#include <error.h>
+#include "exitfail.h"
+#include "gettext.h"
+
+#define N_(msgid) msgid
+
+/* Report an error for an invalid integer in an option argument.
+
+   ERR is the error code returned by one of the xstrto* functions.
+
+   Use OPT_IDX to decide whether to print the short option string "C"
+   or "-C" or a long option string derived from LONG_OPTION.  OPT_IDX
+   is -2 if the short option "C" was used, without any leading "-"; it
+   is -1 if the short option "-C" was used; otherwise it is an index
+   into LONG_OPTIONS, which should have a name preceded by two '-'
+   characters.
+
+   ARG is the option-argument containing the integer.
+
+   After reporting an error, exit with status EXIT_STATUS if it is
+   nonzero.  */
+
+static void
+xstrtol_error (enum strtol_error err,
+               int opt_idx, char c, struct option const *long_options,
+               char const *arg,
+               int exit_status)
+{
+  char const *hyphens = "--";
+  char const *msgid;
+  char const *option;
+  char option_buffer[2];
+
+  switch (err)
+    {
+    default:
+      abort ();
+
+    case LONGINT_INVALID:
+      msgid = N_("invalid %s%s argument '%s'");
+      break;
+
+    case LONGINT_INVALID_SUFFIX_CHAR:
+    case LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW:
+      msgid = N_("invalid suffix in %s%s argument '%s'");
+      break;
+
+    case LONGINT_OVERFLOW:
+      msgid = N_("%s%s argument '%s' too large");
+      break;
+    }
+
+  if (opt_idx < 0)
+    {
+      hyphens -= opt_idx;
+      option_buffer[0] = c;
+      option_buffer[1] = '\0';
+      option = option_buffer;
+    }
+  else
+    option = long_options[opt_idx].name;
+
+  error (exit_status, 0, gettext (msgid), hyphens, option, arg);
+}
+
+/* Like xstrtol_error, except exit with a failure status.  */
+
+void
+xstrtol_fatal (enum strtol_error err,
+               int opt_idx, char c, struct option const *long_options,
+               char const *arg)
+{
+  xstrtol_error (err, opt_idx, c, long_options, arg, exit_failure);
+  abort ();
+}
deleted file mode 120000 (symlink)
index 6f263a3171df49fc272164102d0273103f2560b2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtol-error.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ace787b9951250a622bc08fa7928ec303b0507d6
--- /dev/null
@@ -0,0 +1,51 @@
+/* Error reporting interface for xstrto* functions.
+
+   Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef XSTRTOL_ERROR_H_
+# define XSTRTOL_ERROR_H_ 1
+
+/* This file uses _Noreturn.  */
+# if !_GL_CONFIG_H_INCLUDED
+#  error "Please include config.h first."
+# endif
+
+# include "xstrtol.h"
+
+# include <getopt.h>
+
+/* Report an error for an invalid integer in an option argument.
+
+   ERR is the error code returned by one of the xstrto* functions.
+
+   Use OPT_IDX to decide whether to print the short option string "C"
+   or "-C" or a long option string derived from LONG_OPTIONS.  OPT_IDX
+   is -2 if the short option "C" was used, without any leading "-"; it
+   is -1 if the short option "-C" was used; otherwise it is an index
+   into LONG_OPTIONS, which should have a name preceded by two '-'
+   characters.
+
+   ARG is the option-argument containing the integer.
+
+   After reporting an error, exit with a failure status.  */
+
+_Noreturn void xstrtol_fatal (enum strtol_error /* err */,
+                              int /* opt_idx */, char /* c */,
+                              struct option const * /* long_options */,
+                              char const * /* arg */);
+
+#endif /* not XSTRTOL_ERROR_H_ */
deleted file mode 120000 (symlink)
index e2562b227817f58f47c78a0a6f16be42a68571a1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtol.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e4bce436813f13306c47d20555679480a3fe5363
--- /dev/null
@@ -0,0 +1,247 @@
+/* A more useful interface to strtol.
+
+   Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering. */
+
+#ifndef __strtol
+# define __strtol strtol
+# define __strtol_t long int
+# define __xstrtol xstrtol
+# define STRTOL_T_MINIMUM LONG_MIN
+# define STRTOL_T_MAXIMUM LONG_MAX
+#endif
+
+#include <config.h>
+
+#include "xstrtol.h"
+
+/* Some pre-ANSI implementations (e.g. SunOS 4)
+   need stderr defined if assertion checking is enabled.  */
+#include <stdio.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdckdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if XSTRTOL_INCLUDE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+#include "assure.h"
+#include "intprops.h"
+
+static strtol_error
+bkm_scale (__strtol_t *x, int scale_factor)
+{
+  __strtol_t scaled;
+  if (ckd_mul (&scaled, *x, scale_factor))
+    {
+      *x = *x < 0 ? TYPE_MINIMUM (__strtol_t) : TYPE_MAXIMUM (__strtol_t);
+      return LONGINT_OVERFLOW;
+    }
+
+  *x = scaled;
+
+  return LONGINT_OK;
+}
+
+static strtol_error
+bkm_scale_by_power (__strtol_t *x, int base, int power)
+{
+  strtol_error err = LONGINT_OK;
+  while (power--)
+    err |= bkm_scale (x, base);
+  return err;
+}
+
+/* FIXME: comment.  */
+
+strtol_error
+__xstrtol (const char *s, char **ptr, int strtol_base,
+           __strtol_t *val, const char *valid_suffixes)
+{
+  char *t_ptr;
+  char **p;
+  __strtol_t tmp;
+  strtol_error err = LONGINT_OK;
+
+  assure (0 <= strtol_base && strtol_base <= 36);
+
+  p = (ptr ? ptr : &t_ptr);
+
+  errno = 0;
+
+  if (! TYPE_SIGNED (__strtol_t))
+    {
+      const char *q = s;
+      unsigned char ch = *q;
+      while (isspace (ch))
+        ch = *++q;
+      if (ch == '-')
+        return LONGINT_INVALID;
+    }
+
+  tmp = __strtol (s, p, strtol_base);
+
+  if (*p == s)
+    {
+      /* If there is no number but there is a valid suffix, assume the
+         number is 1.  The string is invalid otherwise.  */
+      if (valid_suffixes && **p && strchr (valid_suffixes, **p))
+        tmp = 1;
+      else
+        return LONGINT_INVALID;
+    }
+  else if (errno != 0)
+    {
+      if (errno != ERANGE)
+        return LONGINT_INVALID;
+      err = LONGINT_OVERFLOW;
+    }
+
+  /* Let valid_suffixes == NULL mean "allow any suffix".  */
+  /* FIXME: update all callers except the ones that allow suffixes
+     after the number, changing last parameter NULL to "".  */
+  if (!valid_suffixes)
+    {
+      *val = tmp;
+      return err;
+    }
+
+  if (**p != '\0')
+    {
+      int base = 1024;
+      int suffixes = 1;
+      strtol_error overflow;
+
+      if (!strchr (valid_suffixes, **p))
+        {
+          *val = tmp;
+          return err | LONGINT_INVALID_SUFFIX_CHAR;
+        }
+
+      switch (**p)
+        {
+        case 'E': case 'G': case 'g': case 'k': case 'K': case 'M': case 'm':
+        case 'P': case 'Q': case 'R': case 'T': case 't': case 'Y': case 'Z':
+
+          /* The "valid suffix" '0' is a special flag meaning that
+             an optional second suffix is allowed, which can change
+             the base.  A suffix "B" (e.g. "100MB") stands for a power
+             of 1000, whereas a suffix "iB" (e.g. "100MiB") stands for
+             a power of 1024.  If no suffix (e.g. "100M"), assume
+             power-of-1024.  */
+
+          if (strchr (valid_suffixes, '0'))
+            switch (p[0][1])
+              {
+              case 'i':
+                if (p[0][2] == 'B')
+                  suffixes += 2;
+                break;
+
+              case 'B':
+              case 'D': /* 'D' is obsolescent */
+                base = 1000;
+                suffixes++;
+                break;
+              }
+        }
+
+      switch (**p)
+        {
+        case 'b':
+          overflow = bkm_scale (&tmp, 512);
+          break;
+
+        case 'B':
+          /* This obsolescent first suffix is distinct from the 'B'
+             second suffix above.  E.g., 'tar -L 1000B' means change
+             the tape after writing 1000 KiB of data.  */
+          overflow = bkm_scale (&tmp, 1024);
+          break;
+
+        case 'c':
+          overflow = LONGINT_OK;
+          break;
+
+        case 'E': /* exa or exbi */
+          overflow = bkm_scale_by_power (&tmp, base, 6);
+          break;
+
+        case 'G': /* giga or gibi */
+        case 'g': /* 'g' is undocumented; for compatibility only */
+          overflow = bkm_scale_by_power (&tmp, base, 3);
+          break;
+
+        case 'k': /* kilo */
+        case 'K': /* kibi */
+          overflow = bkm_scale_by_power (&tmp, base, 1);
+          break;
+
+        case 'M': /* mega or mebi */
+        case 'm': /* 'm' is undocumented; for compatibility only */
+          overflow = bkm_scale_by_power (&tmp, base, 2);
+          break;
+
+        case 'P': /* peta or pebi */
+          overflow = bkm_scale_by_power (&tmp, base, 5);
+          break;
+
+        case 'Q': /* quetta or 2**100 */
+          overflow = bkm_scale_by_power (&tmp, base, 10);
+          break;
+
+        case 'R': /* ronna or 2**90 */
+          overflow = bkm_scale_by_power (&tmp, base, 9);
+          break;
+
+        case 'T': /* tera or tebi */
+        case 't': /* 't' is undocumented; for compatibility only */
+          overflow = bkm_scale_by_power (&tmp, base, 4);
+          break;
+
+        case 'w':
+          overflow = bkm_scale (&tmp, 2);
+          break;
+
+        case 'Y': /* yotta or 2**80 */
+          overflow = bkm_scale_by_power (&tmp, base, 8);
+          break;
+
+        case 'Z': /* zetta or 2**70 */
+          overflow = bkm_scale_by_power (&tmp, base, 7);
+          break;
+
+        default:
+          *val = tmp;
+          return err | LONGINT_INVALID_SUFFIX_CHAR;
+        }
+
+      err |= overflow;
+      *p += suffixes;
+      if (**p)
+        err |= LONGINT_INVALID_SUFFIX_CHAR;
+    }
+
+  *val = tmp;
+  return err;
+}
deleted file mode 120000 (symlink)
index 14cb0a95af3fcbc37cb02a1ed2eff9a09b250f51..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtol.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..44b1cb47a3fc40d884c0de5dd0ca234704ac4cd6
--- /dev/null
@@ -0,0 +1,51 @@
+/* A more useful interface to strtol.
+
+   Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2024 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef XSTRTOL_H_
+# define XSTRTOL_H_ 1
+
+/* Get intmax_t, uintmax_t.  */
+# include <stdint.h>
+
+# ifndef _STRTOL_ERROR
+enum strtol_error
+  {
+    LONGINT_OK = 0,
+
+    /* These two values can be ORed together, to indicate that both
+       errors occurred.  */
+    LONGINT_OVERFLOW = 1,
+    LONGINT_INVALID_SUFFIX_CHAR = 2,
+
+    LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW = (LONGINT_INVALID_SUFFIX_CHAR
+                                                 | LONGINT_OVERFLOW),
+    LONGINT_INVALID = 4
+  };
+typedef enum strtol_error strtol_error;
+# endif
+
+# define _DECLARE_XSTRTOL(name, type) \
+  strtol_error name (const char *, char **, int, type *, const char *);
+_DECLARE_XSTRTOL (xstrtol, long int)
+_DECLARE_XSTRTOL (xstrtoul, unsigned long int)
+_DECLARE_XSTRTOL (xstrtoll, long long int)
+_DECLARE_XSTRTOL (xstrtoull, unsigned long long int)
+_DECLARE_XSTRTOL (xstrtoimax, intmax_t)
+_DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
+
+#endif /* not XSTRTOL_H_ */
deleted file mode 120000 (symlink)
index 6b7bbe6200f45fa113665695b2e8dca4aa0fce8a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtold.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8cdf33707e07a1a37720d0ce41196e054db38e3e
--- /dev/null
@@ -0,0 +1,19 @@
+/* Convert string to 'long double', with error checking.
+
+   Copyright (C) 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define LONG 1
+#include "xstrtod.c"
deleted file mode 120000 (symlink)
index 2f032bf00cc7653036721b6758bb4ad8174d0905..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtoul.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6162af400ae812befb4d368ed99c20b17144e5ac
--- /dev/null
@@ -0,0 +1,23 @@
+/* Convert string to 'unsigned long', with error checking.
+
+   Copyright (C) 1994-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define __strtol strtoul
+#define __strtol_t unsigned long int
+#define __xstrtol xstrtoul
+#define STRTOL_T_MINIMUM 0
+#define STRTOL_T_MAXIMUM ULONG_MAX
+#include "xstrtol.c"
deleted file mode 120000 (symlink)
index cf33f1a3d5ed9a0a1d7dd71766db65a0b036d1b5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xstrtoumax.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1323ec0d8ef5e32b7f1e0635e9549cb76ffcaf70
--- /dev/null
@@ -0,0 +1,24 @@
+/* A more useful interface to strtoumax.
+
+   Copyright (C) 1999-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define __strtol strtoumax
+#define __strtol_t uintmax_t
+#define __xstrtol xstrtoumax
+#define STRTOL_T_MINIMUM 0
+#define STRTOL_T_MAXIMUM UINTMAX_MAX
+#define XSTRTOL_INCLUDE_INTTYPES_H 1
+#include "xstrtol.c"
deleted file mode 120000 (symlink)
index 5b8733d7ba346f467ff2532a1135e3fcecff9144..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xtime.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4a15433ff4810800c1fa4eb8f3d6459d1e47e2ba
--- /dev/null
@@ -0,0 +1,21 @@
+/* xtime -- extended-resolution integer timestamps
+
+   Copyright (C) 2012-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define XTIME_INLINE _GL_EXTERN_INLINE
+#include "xtime.h"
deleted file mode 120000 (symlink)
index b70327d54973c05fbfdbf52030bca9f2a63b45a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xtime.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..39cc5bee925d8e70bed62e7480f7b03eb33762a3
--- /dev/null
@@ -0,0 +1,92 @@
+/* xtime -- extended-resolution integer timestamps
+
+   Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef XTIME_H_
+#define XTIME_H_ 1
+
+/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef XTIME_INLINE
+# define XTIME_INLINE _GL_INLINE
+#endif
+
+/* xtime_t is a signed type used for timestamps.  It is an integer
+   type that is a count of nanoseconds.  */
+typedef long long int xtime_t;
+#define XTIME_PRECISION 1000000000
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* Return an extended time value that contains S seconds and NS
+   nanoseconds.  S and NS should be nonnegative; otherwise, integer
+   overflow can occur even if the result is in range.  */
+XTIME_INLINE xtime_t
+xtime_make (xtime_t s, long int ns)
+{
+  return XTIME_PRECISION * s + ns;
+}
+
+/* The following functions split an extended time value:
+   T = XTIME_PRECISION * xtime_sec (T) + xtime_nsec (T)
+   with  0 <= xtime_nsec (T) < XTIME_PRECISION.  */
+
+/* Return the number of seconds in T, which must be nonnegative.  */
+XTIME_INLINE xtime_t
+xtime_nonnegative_sec (xtime_t t)
+{
+  return t / XTIME_PRECISION;
+}
+
+/* Return the number of seconds in T.  */
+XTIME_INLINE xtime_t
+xtime_sec (xtime_t t)
+{
+  return (t + (t < 0)) / XTIME_PRECISION - (t < 0);
+}
+
+/* Return the number of nanoseconds in T, which must be nonnegative.  */
+XTIME_INLINE long int
+xtime_nonnegative_nsec (xtime_t t)
+{
+  return t % XTIME_PRECISION;
+}
+
+/* Return the number of nanoseconds in T.  */
+XTIME_INLINE long int
+xtime_nsec (xtime_t t)
+{
+  long int ns = t % XTIME_PRECISION;
+  if (ns < 0)
+    ns += XTIME_PRECISION;
+  return ns;
+}
+
+#ifdef  __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif
deleted file mode 120000 (symlink)
index 00aa1d9ce9244680e368062b3e34fbb0c2e72666..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xvasprintf.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6cf6d36a58d89e9b78be75dd5ab15157077a824a
--- /dev/null
@@ -0,0 +1,110 @@
+/* vasprintf and asprintf with out-of-memory checking.
+   Copyright (C) 1999, 2002-2004, 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "xvasprintf.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xalloc.h"
+
+/* Checked size_t computations.  */
+#include "xsize.h"
+
+static char *
+xstrcat (size_t argcount, va_list args)
+{
+  char *result;
+  va_list ap;
+  size_t totalsize;
+  size_t i;
+  char *p;
+
+  /* Determine the total size.  */
+  totalsize = 0;
+  va_copy (ap, args);
+  for (i = argcount; i > 0; i--)
+    {
+      const char *next = va_arg (ap, const char *);
+      totalsize = xsum (totalsize, strlen (next));
+    }
+  va_end (ap);
+
+  /* Test for overflow in the summing pass above or in (totalsize + 1) below.
+     Also, don't return a string longer than INT_MAX, for consistency with
+     vasprintf().  */
+  if (totalsize == SIZE_MAX || totalsize > INT_MAX)
+    {
+      errno = EOVERFLOW;
+      return NULL;
+    }
+
+  /* Allocate and fill the result string.  */
+  result = XNMALLOC (totalsize + 1, char);
+  p = result;
+  for (i = argcount; i > 0; i--)
+    {
+      const char *next = va_arg (args, const char *);
+      size_t len = strlen (next);
+      memcpy (p, next, len);
+      p += len;
+    }
+  *p = '\0';
+
+  return result;
+}
+
+char *
+xvasprintf (const char *format, va_list args)
+{
+  char *result;
+
+  /* Recognize the special case format = "%s...%s".  It is a frequently used
+     idiom for string concatenation and needs to be fast.  We don't want to
+     have a separate function xstrcat() for this purpose.  */
+  {
+    size_t argcount = 0;
+    const char *f;
+
+    for (f = format;;)
+      {
+        if (*f == '\0')
+          /* Recognized the special case of string concatenation.  */
+          return xstrcat (argcount, args);
+        if (*f != '%')
+          break;
+        f++;
+        if (*f != 's')
+          break;
+        f++;
+        argcount++;
+      }
+  }
+
+  if (vasprintf (&result, format, args) < 0)
+    {
+      if (errno == ENOMEM)
+        xalloc_die ();
+      return NULL;
+    }
+
+  return result;
+}
deleted file mode 120000 (symlink)
index 7829bfd5675524dc747d3d01abba4c42525d13d9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/xvasprintf.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..937f97ba4bcc5d2c7392a73e0828fbbf754a6bf3
--- /dev/null
@@ -0,0 +1,56 @@
+/* vasprintf and asprintf with out-of-memory checking.
+   Copyright (C) 2002-2004, 2006-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _XVASPRINTF_H
+#define _XVASPRINTF_H
+
+/* This file uses _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_MALLOC.  */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+/* Get va_list.  */
+#include <stdarg.h>
+
+/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD.  */
+#include <stdio.h>
+
+/* Get 'free'.  */
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Write formatted output to a string dynamically allocated with malloc(),
+   and return it.  Upon [ENOMEM] memory allocation error, call xalloc_die.
+   On some other error
+     - [EOVERFLOW] resulting string length is > INT_MAX,
+     - [EINVAL] invalid format string,
+     - [EILSEQ] error during conversion between wide and multibyte characters,
+   return NULL.  */
+extern char *xasprintf (const char *format, ...)
+       _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+       _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2));
+extern char *xvasprintf (const char *format, va_list args)
+       _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+       _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XVASPRINTF_H */
deleted file mode 120000 (symlink)
index 04f41e61473d0a362688b7257757d5efbf76d5b0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/yesno.c
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d1a67b5a437ab53ed51070ee24397bdc9144666e
--- /dev/null
@@ -0,0 +1,63 @@
+/* yesno.c -- read a yes/no response from stdin
+
+   Copyright (C) 1990, 1998, 2001, 2003-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "yesno.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+
+/* Return true if we read an affirmative line from standard input.
+
+   Since this function uses stdin, it is suggested that the caller not
+   use STDIN_FILENO directly, and also that the line
+   atexit(close_stdin) be added to main().  */
+
+bool
+yesno (void)
+{
+  bool yes;
+
+#if ENABLE_NLS
+  char *response = NULL;
+  size_t response_size = 0;
+  ssize_t response_len = getline (&response, &response_size, stdin);
+
+  if (response_len <= 0)
+    yes = false;
+  else
+    {
+      /* Remove EOL if present as that's not part of the matched response,
+         and not matched by $ for example.  */
+      if (response[response_len - 1] == '\n')
+        response[response_len - 1] = '\0';
+      yes = (0 < rpmatch (response));
+    }
+
+  free (response);
+#else
+  /* Test against "^[yY]", hardcoded to avoid requiring getline,
+     regex, and rpmatch.  */
+  int c = getchar ();
+  yes = (c == 'y' || c == 'Y');
+  while (c != '\n' && c != EOF)
+    c = getchar ();
+#endif
+
+  return yes;
+}
deleted file mode 120000 (symlink)
index 3a603edd73c8b454ad4b2ecc84e8cd7cd93d4f4c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/lib/yesno.h
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..14a86585dd94c0a7ba1417264d1e29475d0da3fd
--- /dev/null
@@ -0,0 +1,22 @@
+/* declare yesno
+   Copyright (C) 2004, 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef YESNO_H_
+# define YESNO_H_
+
+bool yesno (void);
+
+#endif
deleted file mode 120000 (symlink)
index dba60dd356ed8c4820187b081105fefaa41964c6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/00gnulib.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3448c40bbd65a915e59a135f8d75c53d0583f7da
--- /dev/null
@@ -0,0 +1,85 @@
+# 00gnulib.m4 serial 8
+dnl Copyright (C) 2009-2024 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 This file must be named something that sorts before all other
+dnl gnulib-provided .m4 files.  It is needed until the clang fix has
+dnl been included in Autoconf.
+
+# The following definitions arrange to use a compiler option
+# -Werror=implicit-function-declaration in AC_CHECK_DECL, when the
+# compiler is clang.  Without it, clang implicitly declares "known"
+# library functions in C mode, but not in C++ mode, which would cause
+# Gnulib to omit a declaration and thus later produce an error in C++
+# mode.  As of clang 9.0, these "known" functions are identified through
+# LIBBUILTIN invocations in the LLVM source file
+# llvm/tools/clang/include/clang/Basic/Builtins.def.
+# It's not possible to AC_REQUIRE the extra tests from AC_CHECK_DECL,
+# because AC_CHECK_DECL, like other Autoconf built-ins, is not supposed
+# to AC_REQUIRE anything: some configure.ac files have their first
+# AC_CHECK_DECL executed conditionally.  Therefore append the extra tests
+# to AC_PROG_CC.
+AC_DEFUN([gl_COMPILER_CLANG],
+[
+dnl AC_REQUIRE([AC_PROG_CC])
+  AC_CACHE_CHECK([whether the compiler is clang],
+    [gl_cv_compiler_clang],
+    [dnl Use _AC_COMPILE_IFELSE instead of AC_EGREP_CPP, to avoid error
+     dnl "circular dependency of AC_LANG_COMPILER(C)" if AC_PROG_CC has
+     dnl not yet been invoked.
+     _AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[
+           #ifdef __clang__
+           barfbarf
+           #endif
+           ]],[[]])
+        ],
+        [gl_cv_compiler_clang=no],
+        [gl_cv_compiler_clang=yes])
+    ])
+])
+AC_DEFUN([gl_COMPILER_PREPARE_CHECK_DECL],
+[
+dnl AC_REQUIRE([AC_PROG_CC])
+dnl AC_REQUIRE([gl_COMPILER_CLANG])
+  AC_CACHE_CHECK([for compiler option needed when checking for declarations],
+    [gl_cv_compiler_check_decl_option],
+    [if test $gl_cv_compiler_clang = yes; then
+       dnl Test whether the compiler supports the option
+       dnl '-Werror=implicit-function-declaration'.
+       save_ac_compile="$ac_compile"
+       ac_compile="$ac_compile -Werror=implicit-function-declaration"
+       dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a
+       dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
+       _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
+         [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'],
+         [gl_cv_compiler_check_decl_option=none])
+       ac_compile="$save_ac_compile"
+     else
+       gl_cv_compiler_check_decl_option=none
+     fi
+    ])
+  if test "x$gl_cv_compiler_check_decl_option" != xnone; then
+    ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option"
+  else
+    ac_compile_for_check_decl="$ac_compile"
+  fi
+])
+dnl Redefine _AC_CHECK_DECL_BODY so that it references ac_compile_for_check_decl
+dnl instead of ac_compile.  If, for whatever reason, the override of AC_PROG_CC
+dnl in zzgnulib.m4 is inactive, use the original ac_compile.
+m4_define([_AC_CHECK_DECL_BODY],
+[  ac_save_ac_compile="$ac_compile"
+  if test -n "$ac_compile_for_check_decl"; then
+    ac_compile="$ac_compile_for_check_decl"
+  fi]
+m4_defn([_AC_CHECK_DECL_BODY])[  ac_compile="$ac_save_ac_compile"
+])
+
+# gl_00GNULIB
+# -----------
+# Witness macro that this file has been included.  Needed to force
+# Automake to include this file prior to all other gnulib .m4 files.
+AC_DEFUN([gl_00GNULIB])
deleted file mode 120000 (symlink)
index 40ac3c7c964963862e253546a6461362ff4c88ed..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/__inline.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..992e16f4ea7015b3c7b0e50c6a674ad7ce4902f3
--- /dev/null
@@ -0,0 +1,22 @@
+# Test for __inline keyword
+dnl Copyright 2017-2024 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___INLINE],
+[
+  AC_CACHE_CHECK([whether the compiler supports the __inline keyword],
+    [gl_cv_c___inline],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+         [[typedef int foo_t;
+           static __inline foo_t foo (void) { return 0; }]],
+         [[return foo ();]])],
+       [gl_cv_c___inline=yes],
+       [gl_cv_c___inline=no])])
+  if test $gl_cv_c___inline = yes; then
+    AC_DEFINE([HAVE___INLINE], [1],
+      [Define to 1 if the compiler supports the keyword '__inline'.])
+  fi
+])
deleted file mode 120000 (symlink)
index a10280d553c5a776f4ff7620f14d89d95789d669..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/absolute-header.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0e9f9ba763af19083e02f292494d4e264d3f711e
--- /dev/null
@@ -0,0 +1,100 @@
+# absolute-header.m4 serial 18
+dnl Copyright (C) 2006-2024 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 Derek Price.
+
+# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
+# ---------------------------------------
+# Find the absolute name of a header file, testing first if the header exists.
+# If the header were sys/inttypes.h, this macro would define
+# ABSOLUTE_SYS_INTTYPES_H to the '""' quoted absolute name of sys/inttypes.h
+# in config.h
+# (e.g. '#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"').
+# The three "///" are to pacify Sun C 5.8, which otherwise would say
+# "warning: #include of /usr/include/... may be non-portable".
+# Use '""', not '<>', so that the /// cannot be confused with a C99 comment.
+# Note: This macro assumes that the header file is not empty after
+# preprocessing, i.e. it does not only define preprocessor macros but also
+# provides some type/enum definitions or function/variable declarations.
+AC_DEFUN([gl_ABSOLUTE_HEADER],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_PREPROC_REQUIRE()dnl
+m4_foreach_w([gl_HEADER_NAME], [$1],
+  [AS_VAR_PUSHDEF([gl_absolute_header],
+                  [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl
+  AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>],
+    [gl_absolute_header],
+    [AS_VAR_PUSHDEF([ac_header_exists],
+                    [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl
+    AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl
+    if test AS_VAR_GET([ac_header_exists]) = yes; then
+      gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME]))
+    fi
+    AS_VAR_POPDEF([ac_header_exists])dnl
+    ])dnl
+  AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])),
+                     ["AS_VAR_GET([gl_absolute_header])"],
+                     [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.])
+  AS_VAR_POPDEF([gl_absolute_header])dnl
+])dnl
+])# gl_ABSOLUTE_HEADER
+
+# gl_ABSOLUTE_HEADER_ONE(HEADER)
+# ------------------------------
+# Like gl_ABSOLUTE_HEADER, except that:
+#   - it assumes that the header exists,
+#   - it uses the current CPPFLAGS,
+#   - it does not cache the result,
+#   - it is silent.
+AC_DEFUN([gl_ABSOLUTE_HEADER_ONE],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])])
+  dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
+  dnl that contain only a #include of other header files and no
+  dnl non-comment tokens of their own. This leads to a failure to
+  dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
+  dnl and others. The workaround is to force preservation of comments
+  dnl through option -C. This ensures all necessary #line directives
+  dnl are present. GCC supports option -C as well.
+  case "$host_os" in
+    aix*) gl_absname_cpp="$ac_cpp -C" ;;
+    *)    gl_absname_cpp="$ac_cpp" ;;
+  esac
+changequote(,)
+  case "$host_os" in
+    mingw* | windows*)
+      dnl For the sake of native Windows compilers (excluding gcc),
+      dnl treat backslash as a directory separator, like /.
+      dnl Actually, these compilers use a double-backslash as
+      dnl directory separator, inside the
+      dnl   # line "filename"
+      dnl directives.
+      gl_dirsep_regex='[/\\]'
+      ;;
+    *)
+      gl_dirsep_regex='\/'
+      ;;
+  esac
+  dnl A sed expression that turns a string into a basic regular
+  dnl expression, for use within "/.../".
+  gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
+  gl_header_literal_regex=`echo '$1' \
+                           | sed -e "$gl_make_literal_regex_sed"`
+  gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+      s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
+      s|^/[^/]|//&|
+      p
+      q
+    }'
+changequote([,])
+  dnl eval is necessary to expand gl_absname_cpp.
+  dnl Ultrix and Pyramid sh refuse to redirect output of eval,
+  dnl so use subshell.
+  AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]),
+[`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+  sed -n "$gl_absolute_header_sed"`])
+])
deleted file mode 120000 (symlink)
index 839b42158e76505b3513306c585e71ffbcb5b976..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/access.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c2c347f6f7683f949f534f0cc1ff8fb023531170
--- /dev/null
@@ -0,0 +1,65 @@
+# access.m4 serial 3
+dnl Copyright (C) 2019-2024 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_ACCESS],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  dnl On native Windows, access (= _access) does not support the X_OK mode.
+  dnl It works by chance on some versions of mingw.
+  case "$host_os" in
+    mingw* | windows*)
+      REPLACE_ACCESS=1
+      ;;
+    *)
+      dnl Mac OS X 10.5 mistakenly allows access("link-to-file/",amode).
+      AC_CHECK_FUNCS_ONCE([lstat])
+      AC_CACHE_CHECK([whether access honors trailing slash],
+        [gl_cv_func_access_slash_works],
+        [# Assume that if we have lstat, we can also check symlinks.
+         if test $ac_cv_func_lstat = yes; then
+           rm -rf conftest.f conftest.lnk
+           touch conftest.f || AC_MSG_ERROR([cannot create temporary files])
+           ln -s conftest.f conftest.lnk
+           AC_RUN_IFELSE(
+             [AC_LANG_PROGRAM([[
+                #include <unistd.h>
+                ]],
+                [[int result = 0;
+                  if (access ("conftest.lnk/", R_OK) == 0)
+                    result |= 1;
+                  return result;
+                ]])],
+             [gl_cv_func_access_slash_works=yes],
+             [gl_cv_func_access_slash_works=no],
+             dnl When crosscompiling, assume access is broken.
+             [case "$host_os" in
+                                   # Guess yes on Linux systems.
+                linux-* | linux)   gl_cv_func_access_slash_works="guessing yes" ;;
+                                   # Guess yes on systems that emulate the Linux system calls.
+                midipix*)          gl_cv_func_access_slash_works="guessing yes" ;;
+                                   # Guess yes on glibc systems.
+                *-gnu*)            gl_cv_func_access_slash_works="guessing yes" ;;
+                                   # If we don't know, obey --enable-cross-guesses.
+                *)                 gl_cv_func_access_slash_works="$gl_cross_guess_normal" ;;
+              esac
+             ])
+           rm -rf conftest.f conftest.lnk
+         else
+           gl_cv_func_access_slash_works="guessing yes"
+         fi
+      ])
+      case "$gl_cv_func_access_slash_works" in
+        *yes) ;;
+        *)
+          REPLACE_ACCESS=1
+          AC_DEFINE([ACCESS_TRAILING_SLASH_BUG], [1],
+            [Define if access does not correctly handle trailing slashes.])
+          ;;
+      esac
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 3826727c2fd7ffdf491bb53806397517c122edd7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/acl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..199bf67cbc59c54b3d0ee651fba12f2fc11605cd
--- /dev/null
@@ -0,0 +1,199 @@
+# acl.m4 - check for access control list (ACL) primitives
+# serial 29
+
+# Copyright (C) 2002, 2004-2024 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.
+
+# Written by Paul Eggert and Jim Meyering.
+
+AC_DEFUN([gl_FUNC_ACL_ARG],
+[
+  gl_need_lib_has_acl=
+  AC_ARG_ENABLE([acl],
+    AS_HELP_STRING([[--disable-acl]], [do not support ACLs]),
+    , [enable_acl=auto])
+])
+
+
+AC_DEFUN_ONCE([gl_FUNC_ACL],
+[
+  AC_REQUIRE([gl_FUNC_ACL_ARG])
+  AC_CHECK_FUNCS_ONCE([fchmod])
+  LIB_ACL=
+  use_acl=0
+  if test "$enable_acl" != no; then
+    dnl On all platforms, the ACL related API is declared in <sys/acl.h>.
+    AC_CHECK_HEADERS([sys/acl.h])
+    if test $ac_cv_header_sys_acl_h = yes; then
+      ac_save_LIBS=$LIBS
+
+      dnl Test for POSIX-draft-like API (GNU/Linux, FreeBSD, Mac OS X,
+      dnl IRIX, Tru64, Cygwin >= 2.5).
+      dnl -lacl is needed on GNU/Linux, -lpacl on OSF/1.
+      if test $use_acl = 0; then
+        AC_SEARCH_LIBS([acl_get_file], [acl pacl],
+          [if test "$ac_cv_search_acl_get_file" != "none required"; then
+             LIB_ACL=$ac_cv_search_acl_get_file
+           fi
+           AC_CHECK_FUNCS(
+             [acl_get_file acl_get_fd acl_set_file acl_set_fd \
+              acl_free acl_from_mode acl_from_text \
+              acl_delete_def_file acl_extended_file \
+              acl_delete_fd_np acl_delete_file_np \
+              acl_copy_ext_native acl_create_entry_np \
+              acl_to_short_text acl_free_text])
+           # If the acl_get_file bug is detected, don't enable the ACL support.
+           gl_ACL_GET_FILE([use_acl=1], [])
+           if test $use_acl = 1; then
+             dnl On GNU/Linux, an additional API is declared in <acl/libacl.h>.
+             AC_CHECK_HEADERS([acl/libacl.h])
+             AC_REPLACE_FUNCS([acl_entries])
+             AC_CACHE_CHECK([for ACL_FIRST_ENTRY],
+               [gl_cv_acl_ACL_FIRST_ENTRY],
+               [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#include <sys/types.h>
+#include <sys/acl.h>
+int type = ACL_FIRST_ENTRY;]])],
+                  [gl_cv_acl_ACL_FIRST_ENTRY=yes],
+                  [gl_cv_acl_ACL_FIRST_ENTRY=no])])
+             if test $gl_cv_acl_ACL_FIRST_ENTRY = yes; then
+               AC_DEFINE([HAVE_ACL_FIRST_ENTRY], [1],
+                 [Define to 1 if the constant ACL_FIRST_ENTRY exists.])
+             fi
+             dnl On Mac OS X, other types of ACLs are supported.
+             AC_CACHE_CHECK([for ACL_TYPE_EXTENDED],
+               [gl_cv_acl_ACL_TYPE_EXTENDED],
+               [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#include <sys/types.h>
+#include <sys/acl.h>
+int type = ACL_TYPE_EXTENDED;]])],
+                  [gl_cv_acl_ACL_TYPE_EXTENDED=yes],
+                  [gl_cv_acl_ACL_TYPE_EXTENDED=no])])
+             if test $gl_cv_acl_ACL_TYPE_EXTENDED = yes; then
+               AC_DEFINE([HAVE_ACL_TYPE_EXTENDED], [1],
+                 [Define to 1 if the ACL type ACL_TYPE_EXTENDED exists.])
+             fi
+           else
+             LIB_ACL=
+           fi
+          ])
+      fi
+
+      dnl Test for Solaris API (Solaris, Cygwin).
+      if test $use_acl = 0; then
+        AC_CHECK_FUNCS([facl])
+        if test $ac_cv_func_facl = yes; then
+          AC_SEARCH_LIBS([acl_trivial], [sec],
+            [if test "$ac_cv_search_acl_trivial" != "none required"; then
+               LIB_ACL=$ac_cv_search_acl_trivial
+             fi
+            ])
+          AC_CHECK_FUNCS([acl_trivial])
+          use_acl=1
+        fi
+      fi
+
+      dnl Test for HP-UX API.
+      if test $use_acl = 0; then
+        AC_CHECK_FUNCS([getacl])
+        if test $ac_cv_func_getacl = yes; then
+          use_acl=1
+        fi
+        dnl Test for HP-UX 11.11 API.
+        AC_CHECK_HEADERS([aclv.h], [], [], [#include <sys/types.h>])
+      fi
+
+      dnl Test for AIX API (AIX 5.3 or newer).
+      if test $use_acl = 0; then
+        AC_CHECK_FUNCS([aclx_get])
+        if test $ac_cv_func_aclx_get = yes; then
+          use_acl=1
+        fi
+      fi
+
+      dnl Test for older AIX API.
+      if test $use_acl = 0 || test "$ac_cv_func_aclx_get" = yes; then
+        AC_CHECK_FUNCS([statacl])
+        if test $ac_cv_func_statacl = yes; then
+          use_acl=1
+        fi
+      fi
+
+      dnl Test for NonStop Kernel API.
+      if test $use_acl = 0; then
+        AC_CHECK_FUNCS([aclsort])
+        if test $ac_cv_func_aclsort = yes; then
+          use_acl=1
+        fi
+      fi
+
+      LIBS=$ac_save_LIBS
+    fi
+
+    if test "$enable_acl$use_acl" = yes0; then
+      AC_MSG_ERROR([ACLs enabled but support not detected])
+    elif test "$enable_acl$use_acl" = auto0; then
+      AC_MSG_WARN([libacl development library was not found or not usable.])
+      AC_MSG_WARN([AC_PACKAGE_NAME will be built without ACL support.])
+    fi
+  fi
+  if test -n "$gl_need_lib_has_acl"; then
+    FILE_HAS_ACL_LIB=$LIB_ACL
+  fi
+  AC_SUBST([LIB_ACL])
+  AC_DEFINE_UNQUOTED([USE_ACL], [$use_acl],
+    [Define to nonzero if you want access control list support.])
+  USE_ACL=$use_acl
+  AC_SUBST([USE_ACL])
+])
+
+# gl_ACL_GET_FILE(IF-WORKS, IF-NOT)
+# ---------------------------------
+# If 'acl_get_file' works (does not have a particular bug),
+# run IF-WORKS, otherwise, IF-NOT.
+# When building natively, test for a Darwin 8.7.0 bug, whereby acl_get_file
+# returns NULL, but sets errno = ENOENT for an existing file or directory.
+# When cross-compiling, assume that this old bug no longer applies.
+AC_DEFUN([gl_ACL_GET_FILE],
+[
+  AC_CACHE_CHECK([for working acl_get_file], [gl_cv_func_working_acl_get_file],
+    [gl_cv_func_working_acl_get_file=no
+     AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <sys/types.h>
+           #include <sys/acl.h>
+           #include <errno.h>
+          ]],
+          [[acl_t acl = acl_get_file (".", ACL_TYPE_ACCESS);
+            return acl ? acl_free (acl) != 0 : errno == ENOENT;
+          ]])],
+       [if test $cross_compiling = yes; then
+          gl_cv_func_working_acl_get_file="guessing yes"
+        elif ./conftest$ac_exeext; then
+          gl_cv_func_working_acl_get_file=yes
+        fi])])
+  AS_IF([test "$gl_cv_func_working_acl_get_file" != no], [$1], [$2])
+])
+
+# On GNU/Linux, testing if a file has an acl can be done with the
+# listxattr and getxattr syscalls, which don't require linking
+# against additional libraries.  Assume this works if linux/attr.h
+# and listxattr are present.
+AC_DEFUN([gl_FILE_HAS_ACL],
+[
+  AC_REQUIRE([gl_FUNC_ACL_ARG])
+  AC_CHECK_HEADERS_ONCE([linux/xattr.h])
+  AC_CHECK_FUNCS_ONCE([listxattr])
+  FILE_HAS_ACL_LIB=
+  AS_CASE([$enable_acl,$ac_cv_header_linux_xattr_h,$ac_cv_func_listxattr],
+    [no,*,*], [],
+    [*,yes,yes], [],
+    [*],
+      [dnl Set gl_need_lib_has_acl to a nonempty value, so that any
+       dnl later gl_FUNC_ACL call will set FILE_HAS_ACL_LIB=$LIB_ACL.
+       gl_need_lib_has_acl=1
+       FILE_HAS_ACL_LIB=$LIB_ACL])
+  AC_SUBST([FILE_HAS_ACL_LIB])
+])
deleted file mode 120000 (symlink)
index 35236b20ab9dc5c02522432efa06772f45bd2ba4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/af_alg.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e88d62449d22d10e66e9eee2bb279d3fa6f6cdcd
--- /dev/null
@@ -0,0 +1,57 @@
+# af_alg.m4 serial 6
+dnl Copyright 2018-2024 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 Matteo Croce.
+
+AC_DEFUN_ONCE([gl_AF_ALG],
+[
+  AC_REQUIRE([gl_SYS_SOCKET_H])
+  AC_REQUIRE([AC_C_INLINE])
+
+  dnl Check whether linux/if_alg.h has needed features.
+  AC_CACHE_CHECK([whether linux/if_alg.h has struct sockaddr_alg.],
+    [gl_cv_header_linux_if_alg_salg],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[#include <sys/socket.h>
+                          #include <linux/if_alg.h>
+                          struct sockaddr_alg salg = {
+                            .salg_family = AF_ALG,
+                            .salg_type = "hash",
+                            .salg_name = "sha1",
+                          };]])],
+       [gl_cv_header_linux_if_alg_salg=yes],
+       [gl_cv_header_linux_if_alg_salg=no])])
+  if test "$gl_cv_header_linux_if_alg_salg" = yes; then
+    AC_DEFINE([HAVE_LINUX_IF_ALG_H], [1],
+      [Define to 1 if you have 'struct sockaddr_alg' defined.])
+  fi
+
+  dnl The default is to not use AF_ALG if available,
+  dnl as it's system dependent as to whether the kernel
+  dnl routines are faster than libcrypto for example.
+  use_af_alg=no
+  AC_ARG_WITH([linux-crypto],
+    [AS_HELP_STRING([[--with-linux-crypto]],
+       [use Linux kernel cryptographic API (if available) for the hash functions
+        MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512 on files])],
+    [use_af_alg=$withval],
+    [use_af_alg=no])
+  dnl We cannot use it if it is not available.
+  if test "$gl_cv_header_linux_if_alg_salg" != yes; then
+    if test "$use_af_alg" != no; then
+      AC_MSG_WARN([Linux kernel cryptographic API not found])
+    fi
+    use_af_alg=no
+  fi
+
+  if test "$use_af_alg" != no; then
+    USE_AF_ALG=1
+  else
+    USE_AF_ALG=0
+  fi
+  AC_DEFINE_UNQUOTED([USE_LINUX_CRYPTO_API], [$USE_AF_ALG],
+    [Define to 1 if you want to use the Linux kernel cryptographic API.])
+])
deleted file mode 120000 (symlink)
index 98d17646bcf5cf81d892dfd75916706dc2533398..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/alignalloc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1afd6eb07791070c9263a7a23cd57b6b4ddfb490
--- /dev/null
@@ -0,0 +1,11 @@
+# alignalloc.m4 serial 1
+dnl Copyright 2022-2024 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_ALIGNALLOC],
+[
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+  gl_CHECK_FUNCS_ANDROID([posix_memalign], [[#include <stdlib.h>]])
+])
deleted file mode 120000 (symlink)
index 4a2f30203d4cfb99ffec9ecd356955b4913f5e25..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/alloca.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..909602153820bcba9f787988d5a99a495bc768af
--- /dev/null
@@ -0,0 +1,106 @@
+# alloca.m4 serial 21
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2024 Free Software Foundation,
+dnl 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_ALLOCA],
+[
+  AC_REQUIRE([AC_FUNC_ALLOCA])
+  if test $ac_cv_func_alloca_works = no; then
+    gl_PREREQ_ALLOCA
+  fi
+
+  # Define an additional variable used in the Makefile substitution.
+  if test $ac_cv_working_alloca_h = yes; then
+    AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
+      AC_EGREP_CPP([Need own alloca], [
+#if defined __GNUC__ || defined _AIX || defined _MSC_VER
+        Need own alloca
+#endif
+        ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
+    ])
+    if test $gl_cv_rpl_alloca = yes; then
+      dnl OK, alloca can be implemented through a compiler built-in.
+      AC_DEFINE([HAVE_ALLOCA], [1],
+        [Define to 1 if you have 'alloca' after including <alloca.h>,
+         a header that may be supplied by this distribution.])
+      GL_GENERATE_ALLOCA_H=true
+    else
+      dnl alloca exists as a library function, i.e. it is slow and probably
+      dnl a memory leak. Don't define HAVE_ALLOCA in this case.
+      GL_GENERATE_ALLOCA_H=false
+    fi
+  else
+    GL_GENERATE_ALLOCA_H=true
+  fi
+
+  if test $ac_cv_working_alloca_h = yes; then
+    HAVE_ALLOCA_H=1
+  else
+    HAVE_ALLOCA_H=0
+  fi
+  AC_SUBST([HAVE_ALLOCA_H])
+])
+
+# Prerequisites of lib/alloca.c.
+# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
+AC_DEFUN([gl_PREREQ_ALLOCA], [:])
+
+m4_version_prereq([2.70], [], [
+
+# This works around a bug in autoconf <= 2.68 and has simplifications
+# from 2.70.  See:
+# https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html
+# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497
+# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=15edf7fd8094fd14a89d9891dd72a9624762597a
+
+# _AC_LIBOBJ_ALLOCA
+# -----------------
+# Set up the LIBOBJ replacement of 'alloca'.  Well, not exactly
+# AC_LIBOBJ since we actually set the output variable 'ALLOCA'.
+# Nevertheless, for Automake, AC_LIBSOURCES it.
+m4_define([_AC_LIBOBJ_ALLOCA],
+[# The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble.  Some versions do not even contain alloca or
+# contain a buggy version.  If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+AC_LIBSOURCES(alloca.c)
+AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl
+AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.])
+
+AC_CACHE_CHECK([stack direction for C alloca],
+               [ac_cv_c_stack_direction],
+[AC_RUN_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+int
+find_stack_direction (int *addr, int depth)
+{
+  int dir, dummy = 0;
+  if (! addr)
+    addr = &dummy;
+  *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
+  dir = depth ? find_stack_direction (addr, depth - 1) : 0;
+  return dir + dummy;
+}
+
+int
+main (int argc, char **argv)
+{
+  return find_stack_direction (0, argc + !argv + 20) < 0;
+}])],
+               [ac_cv_c_stack_direction=1],
+               [ac_cv_c_stack_direction=-1],
+               [ac_cv_c_stack_direction=0])])
+AH_VERBATIM([STACK_DIRECTION],
+[/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at runtime.
+        STACK_DIRECTION > 0 => grows toward higher addresses
+        STACK_DIRECTION < 0 => grows toward lower addresses
+        STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION])dnl
+AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
+])# _AC_LIBOBJ_ALLOCA
+])
deleted file mode 120000 (symlink)
index 83ba4f102ade2b3ddafefde69c40e567be53590e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/arpa_inet_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..754b38ebc61bdc7dece1b6cd470055aac873b905
--- /dev/null
@@ -0,0 +1,74 @@
+# arpa_inet_h.m4 serial 17
+dnl Copyright (C) 2006, 2008-2024 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 Simon Josefsson and Bruno Haible
+
+AC_DEFUN_ONCE([gl_ARPA_INET_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+
+  AC_CHECK_HEADERS_ONCE([arpa/inet.h])
+  if test $ac_cv_header_arpa_inet_h = yes; then
+    HAVE_ARPA_INET_H=1
+  else
+    HAVE_ARPA_INET_H=0
+  fi
+  AC_SUBST([HAVE_ARPA_INET_H])
+  dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([arpa/inet.h])
+
+  AC_REQUIRE([gl_FEATURES_H])
+
+  gl_PREREQ_SYS_H_WS2TCPIP
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* On some systems, this header is not self-consistent.  */
+#if !(defined __GLIBC__ || defined __UCLIBC__)
+# include <sys/socket.h>
+#endif
+#ifdef __TANDEM
+# include <netdb.h>
+#endif
+#include <arpa/inet.h>
+    ]], [inet_ntop inet_pton])
+])
+
+# gl_ARPA_INET_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_ARPA_INET_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_NTOP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_PTON])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_DECL_INET_NTOP=1;  AC_SUBST([HAVE_DECL_INET_NTOP])
+  HAVE_DECL_INET_PTON=1;  AC_SUBST([HAVE_DECL_INET_PTON])
+  REPLACE_INET_NTOP=0;    AC_SUBST([REPLACE_INET_NTOP])
+  REPLACE_INET_PTON=0;    AC_SUBST([REPLACE_INET_PTON])
+])
deleted file mode 120000 (symlink)
index 6555cf78e8fbb25996d49e5bd29c5086fdddedcf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/assert.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6219c058c16875a43eee22df8922895bcd8ff097
--- /dev/null
@@ -0,0 +1,24 @@
+#serial 8
+
+# Copyright (C) 1998-1999, 2001, 2004, 2008-2024 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 based on code from Eleftherios Gkioulekas
+dnl Autoconf 2.60 provides AC_HEADER_ASSERT for the same purpose, but
+dnl it has broken semantics for --enable-assert until 2.64.
+AC_DEFUN([gl_ASSERT],
+[
+  AC_MSG_CHECKING([whether to enable assertions])
+  AC_ARG_ENABLE([assert],
+    [AS_HELP_STRING([[--disable-assert]], [turn off assertions])],
+    [AS_IF([test "x$enableval" = xno],
+      [AC_DEFINE([NDEBUG], [1],
+        [Define to 1 if assertions should be disabled.])],
+      [test "x$enableval" != xyes],
+      [AC_MSG_WARN([invalid argument supplied to --enable-assert])
+      enable_assert=yes])],
+    [enable_assert=yes])
+  AC_MSG_RESULT([$enable_assert])
+])
deleted file mode 120000 (symlink)
index 69534293d0ac69c6c4a69394a905e2c18c095ca1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/assert_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a73e45f06419ef531edcf4e525c1e0e285c56d6f
--- /dev/null
@@ -0,0 +1,73 @@
+# assert-h.m4
+dnl Copyright (C) 2011-2024 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.
+
+AC_DEFUN([gl_ASSERT_H],
+[
+  AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert],
+    [gl_save_CFLAGS=$CFLAGS
+     for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do
+      AS_CASE([$gl_working],
+        [*assert.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_ASSERT_H"])
+
+      AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#if defined __clang__ && __STDC_VERSION__ < 202311
+             #pragma clang diagnostic error "-Wc2x-extensions"
+             #pragma clang diagnostic error "-Wc++1z-extensions"
+            #endif
+            #ifdef INCLUDE_ASSERT_H
+             #include <assert.h>
+            #endif
+            static_assert (2 + 2 == 4, "arithmetic does not work");
+            static_assert (2 + 2 == 4);
+          ]],
+          [[
+            static_assert (sizeof (char) == 1, "sizeof does not work");
+            static_assert (sizeof (char) == 1);
+          ]])],
+       [gl_cv_static_assert=$gl_working],
+       [gl_cv_static_assert=no])
+      CFLAGS=$gl_save_CFLAGS
+      test "$gl_cv_static_assert" != no && break
+     done])
+
+  GL_GENERATE_ASSERT_H=false
+  AS_CASE([$gl_cv_static_assert],
+    [yes*keyword*],
+      [AC_DEFINE([HAVE_C_STATIC_ASSERT], [1],
+         [Define to 1 if the static_assert keyword works.])],
+    [no],
+      [GL_GENERATE_ASSERT_H=true
+       gl_NEXT_HEADERS([assert.h])])
+
+  dnl The "zz" puts this toward config.h's end, to avoid potential
+  dnl collisions with other definitions.
+  dnl #undef assert so that programs are not tempted to use it without
+  dnl specifically including assert.h.
+  dnl #undef __ASSERT_H__ so that on IRIX, when programs later include
+  dnl <assert.h>, this include actually defines assert.
+  dnl Break the #undef_s apart with a comment so that 'configure' does
+  dnl not comment them out.
+  AH_VERBATIM([zzstatic_assert],
+[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \
+     && (!defined __cplusplus \
+         || (__cpp_static_assert < 201411 \
+             && __GNUG__ < 6 && __clang_major__ < 6)))
+ #include <assert.h>
+ #undef/**/assert
+ #ifdef __sgi
+  #undef/**/__ASSERT_H__
+ #endif
+ /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments.
+    We need it also to be invocable with a single argument.  */
+ #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
+  #undef/**/static_assert
+  #define static_assert _Static_assert
+ #endif
+#endif])
+])
deleted file mode 120000 (symlink)
index a28c5d03438bb09b081c14bcded4c90b0bd4f64f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/atoll.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5123a92d145834e17301e4ff57c939687d9429a8
--- /dev/null
@@ -0,0 +1,19 @@
+# atoll.m4 serial 3
+dnl Copyright (C) 2008-2024 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_ATOLL],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_CHECK_FUNCS([atoll])
+  if test $ac_cv_func_atoll = no; then
+    HAVE_ATOLL=0
+  fi
+])
+
+# Prerequisites of lib/atoll.c.
+AC_DEFUN([gl_PREREQ_ATOLL], [
+  :
+])
deleted file mode 120000 (symlink)
index 0c1180b3bf24897d45f2074f7cb61646bc3a8a89..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/autobuild.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..814bc192cc56c5cc9c44ea29f8c1276f7436980a
--- /dev/null
@@ -0,0 +1,39 @@
+# autobuild.m4 serial 8
+dnl Copyright (C) 2004, 2006-2024 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 Simon Josefsson
+
+# Usage: AB_INIT([MODE]).
+AC_DEFUN([AB_INIT],
+[
+  AC_REQUIRE([AC_CANONICAL_BUILD])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  if test -z "$AB_PACKAGE"; then
+    AB_PACKAGE=${PACKAGE_NAME:-$PACKAGE}
+  fi
+  AC_MSG_NOTICE([autobuild project... $AB_PACKAGE])
+
+  if test -z "$AB_VERSION"; then
+    AB_VERSION=${PACKAGE_VERSION:-$VERSION}
+  fi
+  AC_MSG_NOTICE([autobuild revision... $AB_VERSION])
+
+  hostname=`hostname`
+  if test "$hostname"; then
+    AC_MSG_NOTICE([autobuild hostname... $hostname])
+  fi
+
+  m4_if([$1],[],,[AC_MSG_NOTICE([autobuild mode... $1])])
+
+  date=`TZ=UTC0 date +%Y%m%dT%H%M%SZ`
+  if test "$?" != 0; then
+    date=`date`
+  fi
+  if test "$date"; then
+    AC_MSG_NOTICE([autobuild timestamp... $date])
+  fi
+])
deleted file mode 120000 (symlink)
index c8519639c3633be6fc261d1700f7c46b1c606164..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/backupfile.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..16e3d33660fa7e83278a3f65c08640770f79fa95
--- /dev/null
@@ -0,0 +1,13 @@
+# backupfile.m4 serial 14
+dnl Copyright (C) 2002-2006, 2009-2024 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 Prerequisites of lib/backupfile.c.
+AC_DEFUN([gl_BACKUPFILE],
+[
+  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
+  AC_REQUIRE([AC_SYS_LONG_FILE_NAMES])
+  AC_CHECK_FUNCS_ONCE([pathconf])
+])
deleted file mode 120000 (symlink)
index 07138e63120870ed3a154c817d2a0b3b7f11d1b5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/base32.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dd768cf885089b7bed4b5f62917f5c3ea82d4401
--- /dev/null
@@ -0,0 +1,15 @@
+# base32.m4 serial 4
+dnl Copyright (C) 2004, 2006, 2009-2024 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_BASE32],
+[
+  gl_PREREQ_BASE32
+])
+
+# Prerequisites of lib/base32.c.
+AC_DEFUN([gl_PREREQ_BASE32], [
+  AC_REQUIRE([AC_C_RESTRICT])
+])
deleted file mode 120000 (symlink)
index d127b4a6aed3563928166c2efa263b50307ce1fb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/base64.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b5db8af4fec7d23c8d1f393a487a107a31ed302f
--- /dev/null
@@ -0,0 +1,15 @@
+# base64.m4 serial 4
+dnl Copyright (C) 2004, 2006, 2009-2024 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_BASE64],
+[
+  gl_PREREQ_BASE64
+])
+
+# Prerequisites of lib/base64.c.
+AC_DEFUN([gl_PREREQ_BASE64], [
+  AC_REQUIRE([AC_C_RESTRICT])
+])
deleted file mode 120000 (symlink)
index 26fdeffebbc835f2dc00f5cb6e0b01bf897f00e1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/bison.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f98416e54efc6f0481c5a91be5c0685d2cd3beea
--- /dev/null
@@ -0,0 +1,92 @@
+# serial 10
+
+# Copyright (C) 2002-2006, 2008-2024 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.
+
+# There are two types of parser skeletons:
+#
+# * Those that can be used with any Yacc implementation, including bison.
+#   For these, in the configure.ac, up to Autoconf 2.69, you could use
+#     AC_PROG_YACC
+#   In newer Autoconf versions, however, this macro is broken. See
+#     https://lists.gnu.org/archive/html/autoconf-patches/2013-03/msg00000.html
+#     https://lists.gnu.org/archive/html/bug-autoconf/2018-12/msg00001.html
+#   In the Makefile.am you could use
+#     $(SHELL) $(YLWRAP) $(srcdir)/foo.y \
+#                        y.tab.c foo.c \
+#                        y.tab.h foo.h \
+#                        y.output foo.output \
+#                        -- $(YACC) $(YFLAGS) $(AM_YFLAGS)
+#   or similar.
+#
+# * Those that make use of Bison extensions. For example,
+#     - %define api.pure   requires bison 2.7 or newer,
+#     - %precedence        requires bison 3.0 or newer.
+#   For these, in the configure.ac you will need an invocation of
+#     gl_PROG_BISON([VARIABLE], [MIN_BISON_VERSION])
+#   Example:
+#     gl_PROG_BISON([PARSE_DATETIME_BISON], [2.4])
+#   With this preparation, in the Makefile.am there are two ways to formulate
+#   the invocation. Both are direct, without use of 'ylwrap'.
+#   (a) You can invoke
+#         $(VARIABLE) -d $(SOME_BISON_OPTIONS) --output foo.c $(srcdir)/foo.y
+#       or similar.
+#   (b) If you want the invocation to honor an YFLAGS=... parameter passed to
+#       'configure' or an YFLAGS environment variable present at 'configure'
+#       time, add an invocation of gl_BISON to the configure.ac, and write
+#         $(VARIABLE) -d $(YFLAGS) $(AM_YFLAGS) $(srcdir)/foo.y
+#       or similar.
+
+# This macro defines the autoconf variable VARIABLE to 'bison' if the specified
+# minimum version of bison is found in $PATH, or to ':' otherwise.
+AC_DEFUN([gl_PROG_BISON],
+[
+  AC_CHECK_PROGS([$1], [bison])
+  if test -z "$[$1]"; then
+    ac_verc_fail=yes
+  else
+    cat >conftest.y <<_ACEOF
+%require "$2"
+%%
+exp:
+_ACEOF
+    AC_MSG_CHECKING([for bison $2 or newer])
+    ac_prog_version=`$$1 --version 2>&1 | sed -n 's/^.*GNU Bison.* \([[0-9]]*\.[[0-9.]]*\).*$/\1/p'`
+    : ${ac_prog_version:='v. ?.??'}
+    if $$1 conftest.y -o conftest.c 2>/dev/null; then
+      ac_prog_version="$ac_prog_version, ok"
+      ac_verc_fail=no
+    else
+      ac_prog_version="$ac_prog_version, bad"
+      ac_verc_fail=yes
+    fi
+    rm -f conftest.y conftest.c
+    AC_MSG_RESULT([$ac_prog_version])
+  fi
+  if test $ac_verc_fail = yes; then
+    [$1]=:
+  fi
+  AC_SUBST([$1])
+])
+
+# This macro sets the autoconf variables YACC (for old-style yacc Makefile
+# rules) and YFLAGS (to allow options to be passed as 'configure' time).
+AC_DEFUN([gl_BISON],
+[
+  : ${YACC='bison -o y.tab.c'}
+dnl
+dnl Declaring YACC & YFLAGS precious will not be necessary after GNULIB
+dnl requires an Autoconf greater than 2.59c, but it will probably still be
+dnl useful to override the description of YACC in the --help output, re
+dnl parse-datetime.y assuming 'bison -o y.tab.c'.
+  AC_ARG_VAR([YACC],
+[The "Yet Another C Compiler" implementation to use.  Defaults to
+'bison -o y.tab.c'.  Values other than 'bison -o y.tab.c' will most likely
+break on most systems.])dnl
+  AC_ARG_VAR([YFLAGS],
+[YFLAGS contains the list arguments that will be passed by default to Bison.
+This script will default YFLAGS to the empty string to avoid a default value of
+'-d' given by some make applications.])dnl
+])
deleted file mode 120000 (symlink)
index a4a1888961507a9d975ca83f60e73c5bbc5e75a6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/btowc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8bb55dc8f6f46a30148d1e77150353d2cea67d6d
--- /dev/null
@@ -0,0 +1,161 @@
+# btowc.m4 serial 14
+dnl Copyright (C) 2008-2024 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_BTOWC],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  dnl Check whether <wchar.h> is usable at all, first. Otherwise the test
+  dnl program below may lead to an endless loop. See
+  dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>.
+  AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
+
+  AC_CHECK_FUNCS_ONCE([btowc])
+  if test $ac_cv_func_btowc = no; then
+    HAVE_BTOWC=0
+  else
+
+    AC_REQUIRE([AC_PROG_CC])
+    AC_REQUIRE([gt_LOCALE_FR])
+    AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+    dnl Cygwin 1.7.2 btowc('\0') is WEOF, not 0.
+    AC_CACHE_CHECK([whether btowc(0) is correct],
+      [gl_cv_func_btowc_nul],
+      [
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <wchar.h>
+int main ()
+{
+  if (btowc ('\0') != 0)
+    return 1;
+  return 0;
+}]])],
+          [gl_cv_func_btowc_nul=yes],
+          [gl_cv_func_btowc_nul=no],
+          [
+changequote(,)dnl
+           case "$host_os" in
+                                # Guess no on Cygwin.
+             cygwin*)           gl_cv_func_btowc_nul="guessing no" ;;
+                                # Guess yes on native Windows.
+             mingw* | windows*) gl_cv_func_btowc_nul="guessing yes" ;;
+                                # Guess yes otherwise.
+             *)                 gl_cv_func_btowc_nul="guessing yes" ;;
+           esac
+changequote([,])dnl
+          ])
+      ])
+
+    dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
+    AC_CACHE_CHECK([whether btowc(EOF) is correct],
+      [gl_cv_func_btowc_eof],
+      [
+        dnl Initial guess, used when cross-compiling or when no suitable locale
+        dnl is present.
+changequote(,)dnl
+        case "$host_os" in
+                             # Guess no on IRIX.
+          irix*)             gl_cv_func_btowc_eof="guessing no" ;;
+                             # Guess yes on native Windows.
+          mingw* | windows*) gl_cv_func_btowc_eof="guessing yes" ;;
+                             # Guess yes otherwise.
+          *)                 gl_cv_func_btowc_eof="guessing yes" ;;
+        esac
+changequote([,])dnl
+        if test $LOCALE_FR != none; then
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdio.h>
+#include <wchar.h>
+int main ()
+{
+  if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+    {
+      if (btowc (EOF) != WEOF)
+        return 1;
+    }
+  return 0;
+}]])],
+            [gl_cv_func_btowc_eof=yes],
+            [gl_cv_func_btowc_eof=no],
+            [:])
+        fi
+      ])
+
+    dnl On mingw, in the C locale, btowc is inconsistent with mbrtowc:
+    dnl mbrtowc avoids calling MultiByteToWideChar when MB_CUR_MAX is 1 and
+    dnl ___lc_codepage_func() is 0, but btowc is lacking this special case.
+    AC_CHECK_FUNCS_ONCE([mbrtowc])
+    AC_CACHE_CHECK([whether btowc is consistent with mbrtowc in the C locale],
+      [gl_cv_func_btowc_consistent],
+      [
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+#if HAVE_MBRTOWC
+  wint_t wc1 = btowc (0x80);
+  wchar_t wc2 = (wchar_t) 0xbadface;
+  char buf[1] = { 0x80 };
+  mbstate_t state;
+  memset (&state, 0, sizeof (mbstate_t));
+  if (mbrtowc (&wc2, buf, 1, &state) != 1 || wc1 != wc2)
+    return 1;
+#endif
+  return 0;
+}]])],
+          [gl_cv_func_btowc_consistent=yes],
+          [gl_cv_func_btowc_consistent=no],
+          [case "$host_os" in
+               # Guess no on mingw.
+             mingw* | windows*)
+               AC_EGREP_CPP([Problem], [
+#ifdef __MINGW32__
+ Problem
+#endif
+                 ],
+                 [gl_cv_func_btowc_consistent="guessing no"],
+                 [gl_cv_func_btowc_consistent="guessing yes"])
+               ;;
+               # Guess yes otherwise.
+             *) gl_cv_func_btowc_consistent="guessing yes" ;;
+           esac
+          ])
+      ])
+
+    case "$gl_cv_func_btowc_nul" in
+      *yes) ;;
+      *) REPLACE_BTOWC=1 ;;
+    esac
+    case "$gl_cv_func_btowc_eof" in
+      *yes) ;;
+      *) REPLACE_BTOWC=1 ;;
+    esac
+    case "$gl_cv_func_btowc_consistent" in
+      *yes) ;;
+      *) REPLACE_BTOWC=1 ;;
+    esac
+    if test $REPLACE_BTOWC = 0; then
+      gl_MBRTOWC_C_LOCALE
+      case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in
+        *yes) ;;
+        *) REPLACE_BTOWC=1 ;;
+      esac
+    fi
+  fi
+])
+
+# Prerequisites of lib/btowc.c.
+AC_DEFUN([gl_PREREQ_BTOWC], [
+  :
+  AC_CHECK_FUNCS_ONCE([mbrtowc])
+])
deleted file mode 120000 (symlink)
index 329c6fcae3220adbac9d2e69584372d057914e6b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/build-to-host.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f928e9ab403b3633e3d1d974abcf478e65d4b0aa
--- /dev/null
@@ -0,0 +1,79 @@
+# build-to-host.m4 serial 3
+dnl Copyright (C) 2023-2024 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 Bruno Haible.
+
+dnl When the build environment ($build_os) is different from the target runtime
+dnl environment ($host_os), file names may need to be converted from the build
+dnl environment syntax to the target runtime environment syntax. This is
+dnl because the Makefiles are executed (mostly) by build environment tools and
+dnl therefore expect file names in build environment syntax, whereas the runtime
+dnl expects file names in target runtime environment syntax.
+dnl
+dnl For example, if $build_os = cygwin and $host_os = mingw32, filenames need
+dnl be converted from Cygwin syntax to native Windows syntax:
+dnl   /cygdrive/c/foo/bar -> C:\foo\bar
+dnl   /usr/local/share    -> C:\cygwin64\usr\local\share
+dnl
+dnl gl_BUILD_TO_HOST([somedir])
+dnl This macro takes as input an AC_SUBSTed variable 'somedir', which must
+dnl already have its final value assigned, and produces two additional
+dnl AC_SUBSTed variables 'somedir_c' and 'somedir_c_make', that designate the
+dnl same file name value, just in different syntax:
+dnl   - somedir_c       is the file name in target runtime environment syntax,
+dnl                     as a C string (starting and ending with a double-quote,
+dnl                     and with escaped backslashes and double-quotes in
+dnl                     between).
+dnl   - somedir_c_make  is the same thing, escaped for use in a Makefile.
+
+AC_DEFUN([gl_BUILD_TO_HOST],
+[
+  AC_REQUIRE([AC_CANONICAL_BUILD])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_BUILD_TO_HOST_INIT])
+
+  dnl Define somedir_c.
+  gl_final_[$1]="$[$1]"
+  dnl Translate it from build syntax to host syntax.
+  case "$build_os" in
+    cygwin*)
+      case "$host_os" in
+        mingw* | windows*)
+          gl_final_[$1]=`cygpath -w "$gl_final_[$1]"` ;;
+      esac
+      ;;
+  esac
+  dnl Convert it to C string syntax.
+  [$1]_c=`printf '%s\n' "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"`
+  [$1]_c='"'"$[$1]_c"'"'
+  AC_SUBST([$1_c])
+
+  dnl Define somedir_c_make.
+  [$1]_c_make=`printf '%s\n' "$[$1]_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2" | tr -d "$gl_tr_cr"`
+  dnl Use the substituted somedir variable, when possible, so that the user
+  dnl may adjust somedir a posteriori when there are no special characters.
+  if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then
+    [$1]_c_make='\"$([$1])\"'
+  fi
+  AC_SUBST([$1_c_make])
+])
+
+dnl Some initializations for gl_BUILD_TO_HOST.
+AC_DEFUN([gl_BUILD_TO_HOST_INIT],
+[
+  gl_sed_double_backslashes='s/\\/\\\\/g'
+  gl_sed_escape_doublequotes='s/"/\\"/g'
+changequote(,)dnl
+  gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g"
+changequote([,])dnl
+  gl_sed_escape_for_make_2='s,\$,\\$$,g'
+  dnl Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+  dnl does not understand '\r'.
+  case `echo r | tr -d '\r'` in
+    '') gl_tr_cr='\015' ;;
+    *)  gl_tr_cr='\r' ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 34d70db5e017c6706e94a0208ef5d44ce9b36830..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/builtin-expect.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8faffc503543c812c4ec8fb33af340add8c663d1
--- /dev/null
@@ -0,0 +1,49 @@
+dnl Check for __builtin_expect.
+
+dnl Copyright 2016-2024 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___BUILTIN_EXPECT],
+[
+  AC_CACHE_CHECK([for __builtin_expect],
+    [gl_cv___builtin_expect],
+    [AC_LINK_IFELSE(
+       [AC_LANG_SOURCE([[
+         int
+         main (int argc, char **argv)
+         {
+           argc = __builtin_expect (argc, 100);
+           return argv[argc != 100][0];
+         }]])],
+       [gl_cv___builtin_expect=yes],
+       [AC_LINK_IFELSE(
+          [AC_LANG_SOURCE([[
+             #include <builtins.h>
+             int
+             main (int argc, char **argv)
+             {
+               argc = __builtin_expect (argc, 100);
+               return argv[argc != 100][0];
+             }]])],
+          [gl_cv___builtin_expect="in <builtins.h>"],
+          [gl_cv___builtin_expect=no])])])
+  if test "$gl_cv___builtin_expect" = yes; then
+    AC_DEFINE([HAVE___BUILTIN_EXPECT], [1])
+  elif test "$gl_cv___builtin_expect" = "in <builtins.h>"; then
+    AC_DEFINE([HAVE___BUILTIN_EXPECT], [2])
+  fi
+  AH_VERBATIM([HAVE___BUILTIN_EXPECT],
+    [/* Define to 1 if the compiler supports __builtin_expect,
+   and to 2 if <builtins.h> does.  */
+#undef HAVE___BUILTIN_EXPECT
+#ifndef HAVE___BUILTIN_EXPECT
+# define __builtin_expect(e, c) (e)
+#elif HAVE___BUILTIN_EXPECT == 2
+# include <builtins.h>
+#endif
+    ])
+])
deleted file mode 120000 (symlink)
index 19e3238c239f4a9d10c4c13b09a78d441066b855..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/byteswap.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5493d9019166eb9558e9ac435fd521fb71b7ee64
--- /dev/null
@@ -0,0 +1,17 @@
+# byteswap.m4 serial 5
+dnl Copyright (C) 2005, 2007, 2009-2024 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 Oskar Liljeblad.
+
+AC_DEFUN([gl_BYTESWAP],
+[
+  dnl Prerequisites of lib/byteswap.in.h.
+  AC_CHECK_HEADERS([byteswap.h], [
+    GL_GENERATE_BYTESWAP_H=false
+  ], [
+    GL_GENERATE_BYTESWAP_H=true
+  ])
+])
deleted file mode 120000 (symlink)
index 546160ae1562c7325968ba258319f95d0b77e438..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/c-bool.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..44fba3c012fcf7677e8bb0452cd761dbe12b3b2e
--- /dev/null
@@ -0,0 +1,51 @@
+# Check for bool that conforms to C2023.
+
+dnl Copyright 2022-2024 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_C_BOOL],
+[
+  AC_CACHE_CHECK([for bool, true, false], [gl_cv_c_bool],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_SOURCE([[
+          #if true == false
+           #error "true == false"
+          #endif
+          extern bool b;
+          bool b = true == false;]])],
+       [gl_cv_c_bool=yes],
+       [gl_cv_c_bool=no])])
+  if test "$gl_cv_c_bool" = yes; then
+    AC_DEFINE([HAVE_C_BOOL], [1],
+      [Define to 1 if bool, true and false work as per C2023.])
+  fi
+
+  AC_CHECK_HEADERS_ONCE([stdbool.h])
+
+  dnl The "zz" puts this toward config.h's end, to avoid potential
+  dnl collisions with other definitions.
+  dnl If 'bool', 'true' and 'false' do not work, arrange for them to work.
+  dnl In C, this means including <stdbool.h> if it is not already included.
+  dnl However, if the preprocessor mistakenly treats 'true' as 0,
+  dnl define it to a bool expression equal to 1; this is needed in
+  dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older.
+  AH_VERBATIM([zzbool],
+[#ifndef HAVE_C_BOOL
+# if !defined __cplusplus && !defined __bool_true_false_are_defined
+#  if HAVE_STDBOOL_H
+#   include <stdbool.h>
+#  else
+#   if defined __SUNPRO_C
+#    error "<stdbool.h> is not usable with this configuration. To make it usable, add -D_STDC_C99= to $CC."
+#   else
+#    error "<stdbool.h> does not exist on this platform. Use gnulib module 'stdbool-c99' instead of gnulib module 'stdbool'."
+#   endif
+#  endif
+# endif
+# if !true
+#  define true (!false)
+# endif
+#endif])
+])
deleted file mode 120000 (symlink)
index 9d3a7af3ed74db2c85dfb9ee5489c177a584c6b3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/c32rtomb.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..56faaa578f4b46b1350ef62793aef9f87e2deb8f
--- /dev/null
@@ -0,0 +1,88 @@
+# c32rtomb.m4 serial 7
+dnl Copyright (C) 2020-2024 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_C32RTOMB],
+[
+  AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+
+  dnl Cf. gl_CHECK_FUNCS_ANDROID
+  AC_CHECK_DECL([c32rtomb], , ,
+    [[#ifdef __HAIKU__
+       #include <stdint.h>
+      #endif
+      #include <uchar.h>
+    ]])
+  if test $ac_cv_have_decl_c32rtomb = yes; then
+    dnl We can't use AC_CHECK_FUNC here, because c32rtomb() is defined as a
+    dnl static inline function on Haiku 2020.
+    AC_CACHE_CHECK([for c32rtomb], [gl_cv_func_c32rtomb],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <stdlib.h>
+              #ifdef __HAIKU__
+               #include <stdint.h>
+              #endif
+              #include <uchar.h>
+            ]],
+            [[char buf[8];
+              return c32rtomb (buf, 0, NULL) == 0;
+            ]])
+         ],
+         [gl_cv_func_c32rtomb=yes],
+         [gl_cv_func_c32rtomb=no])
+      ])
+  else
+    gl_cv_func_c32rtomb=no
+  fi
+  if test $gl_cv_func_c32rtomb = no; then
+    HAVE_C32RTOMB=0
+  else
+    dnl When we override mbrtoc32, redefining the meaning of the char32_t
+    dnl values, we need to override c32rtomb as well, for consistency.
+    if test $HAVE_WORKING_MBRTOC32 = 0; then
+      REPLACE_C32RTOMB=1
+    fi
+    AC_CACHE_CHECK([whether c32rtomb return value is correct],
+      [gl_cv_func_c32rtomb_retval],
+      [
+        dnl Initial guess, used when cross-compiling.
+changequote(,)dnl
+        case "$host_os" in
+          # Guess no on AIX.
+          aix*) gl_cv_func_c32rtomb_retval="guessing no" ;;
+          # Guess yes otherwise.
+          *)    gl_cv_func_c32rtomb_retval="guessing yes" ;;
+        esac
+changequote([,])dnl
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <stddef.h>
+#ifdef __HAIKU__
+ #include <stdint.h>
+#endif
+#include <uchar.h>
+int main ()
+{
+  int result = 0;
+  if (c32rtomb (NULL, 0, NULL) != 1)
+    result |= 1;
+  return result;
+}]])],
+          [gl_cv_func_c32rtomb_retval=yes],
+          [gl_cv_func_c32rtomb_retval=no],
+          [:])
+      ])
+    case "$gl_cv_func_c32rtomb_retval" in
+      *yes) ;;
+      *) AC_DEFINE([C32RTOMB_RETVAL_BUG], [1],
+           [Define if the c32rtomb function has an incorrect return value.])
+         REPLACE_C32RTOMB=1 ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 84e3cba3c8e1752e97da8410c707d3285aea32bd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/calloc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..49303d96d6a329af4350d151173749192d31dcef
--- /dev/null
@@ -0,0 +1,83 @@
+# calloc.m4 serial 31
+
+# Copyright (C) 2004-2024 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.
+
+# Written by Jim Meyering.
+
+# Determine whether calloc (N, S) returns non-NULL when N*S is zero,
+# and returns NULL when N*S overflows.
+# If so, define HAVE_CALLOC.  Otherwise, define calloc to rpl_calloc
+# and arrange to use a calloc wrapper function that does work in that case.
+
+# _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT])
+# -------------------------------------
+# If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT.
+AC_DEFUN([_AC_FUNC_CALLOC_IF],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull],
+    [ac_cv_func_calloc_0_nonnull],
+    [if test $cross_compiling != yes; then
+       ac_cv_func_calloc_0_nonnull=yes
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [AC_INCLUDES_DEFAULT],
+            [[int result = 0;
+              char * volatile p = calloc (0, 0);
+              if (!p)
+                result |= 1;
+              free (p);
+              return result;
+            ]])],
+         [],
+         [ac_cv_func_calloc_0_nonnull=no])
+     else
+       case "$host_os" in
+                             # Guess yes on glibc systems.
+         *-gnu* | gnu*)      ac_cv_func_calloc_0_nonnull="guessing yes" ;;
+                             # Guess yes on musl systems.
+         *-musl* | midipix*) ac_cv_func_calloc_0_nonnull="guessing yes" ;;
+                             # Guess yes on native Windows.
+         mingw* | windows*)  ac_cv_func_calloc_0_nonnull="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+         *)                  ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;;
+       esac
+     fi
+    ])
+  AS_CASE([$ac_cv_func_calloc_0_nonnull], [*yes], [$1], [$2])
+])
+
+
+# gl_FUNC_CALLOC_GNU
+# ------------------
+# Replace calloc if it is not compatible with GNU libc.
+AC_DEFUN([gl_FUNC_CALLOC_GNU],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_CALLOC_POSIX])
+  REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX"
+  if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then
+    _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1])
+  fi
+])# gl_FUNC_CALLOC_GNU
+
+# gl_FUNC_CALLOC_POSIX
+# --------------------
+# Test whether 'calloc' is POSIX compliant (sets errno to ENOMEM when it
+# fails, and doesn't mess up with ptrdiff_t or size_t overflow),
+# and replace calloc if it is not.
+AC_DEFUN([gl_FUNC_CALLOC_POSIX],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
+  if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then
+    REPLACE_CALLOC_FOR_CALLOC_POSIX=1
+  fi
+  dnl Although in theory we should also test for size_t overflow,
+  dnl in practice testing for ptrdiff_t overflow suffices
+  dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets.
+  dnl A separate size_t test would slow down 'configure'.
+])
deleted file mode 120000 (symlink)
index c0e4579c3d15093ff1c56aef476a9b27f31f9ea2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/canon-host.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a76097ee331f78b69a8ce71170bc54831c5d11f2
--- /dev/null
@@ -0,0 +1,9 @@
+# canon-host.m4 serial 10
+dnl Copyright (C) 2002-2007, 2009-2024 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_PREREQ_CANON_HOST], [
+  :
+])
deleted file mode 120000 (symlink)
index 199957868fd4eab0d5df2fdba53d702f8e0cb7df..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/canonicalize.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..05dc6dd264dcc341dac55976f2251badacdc5987
--- /dev/null
@@ -0,0 +1,185 @@
+# canonicalize.m4 serial 39
+
+dnl Copyright (C) 2003-2007, 2009-2024 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.
+
+# Provides canonicalize_file_name and canonicalize_filename_mode, but does
+# not provide or fix realpath.
+AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE],
+[
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  AC_CHECK_FUNCS_ONCE([canonicalize_file_name])
+  gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]])
+  AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
+  AC_REQUIRE([gl_FUNC_REALPATH_WORKS])
+  if test $ac_cv_func_canonicalize_file_name = no; then
+    HAVE_CANONICALIZE_FILE_NAME=0
+  else
+    case "$gl_cv_func_realpath_works" in
+      *yes) ;;
+      *)    REPLACE_CANONICALIZE_FILE_NAME=1 ;;
+    esac
+  fi
+])
+
+# Provides canonicalize_file_name and realpath.
+AC_DEFUN([gl_CANONICALIZE_LGPL],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_CANONICALIZE_LGPL_SEPARATE])
+  if test $ac_cv_func_canonicalize_file_name = no; then
+    HAVE_CANONICALIZE_FILE_NAME=0
+    if test $ac_cv_func_realpath = no; then
+      HAVE_REALPATH=0
+    else
+      case "$gl_cv_func_realpath_works" in
+        *yes) ;;
+        *)    REPLACE_REALPATH=1 ;;
+      esac
+    fi
+  else
+    case "$gl_cv_func_realpath_works" in
+      *yes)
+        ;;
+      *)
+        REPLACE_CANONICALIZE_FILE_NAME=1
+        REPLACE_REALPATH=1
+        ;;
+    esac
+  fi
+])
+
+# Like gl_CANONICALIZE_LGPL, except prepare for separate compilation
+# (no REPLACE_CANONICALIZE_FILE_NAME, no REPLACE_REALPATH, no AC_LIBOBJ).
+AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
+[
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  AC_CHECK_FUNCS_ONCE([canonicalize_file_name])
+  gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]])
+
+  dnl On native Windows, we use _getcwd(), regardless whether getcwd() is
+  dnl available through the linker option '-loldnames'.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw* | windows*) ;;
+    *) AC_CHECK_FUNCS([getcwd]) ;;
+  esac
+
+  AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
+  AC_REQUIRE([gl_FUNC_REALPATH_WORKS])
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
+])
+
+# Check whether realpath works.  Assume that if a platform has both
+# realpath and canonicalize_file_name, but the former is broken, then
+# so is the latter.
+AC_DEFUN([gl_FUNC_REALPATH_WORKS],
+[
+  AC_CHECK_FUNCS_ONCE([realpath lstat])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [
+    rm -rf conftest.a conftest.d
+    touch conftest.a
+    # Assume that if we have lstat, we can also check symlinks.
+    if test $ac_cv_func_lstat = yes; then
+      ln -s conftest.a conftest.l
+    fi
+    mkdir conftest.d
+    AC_RUN_IFELSE([
+      AC_LANG_PROGRAM([[
+        ]GL_NOCRASH[
+        #include <errno.h>
+        #include <stdlib.h>
+        #include <string.h>
+      ]], [[
+        int result = 0;
+        /* This test fails on Solaris 10.  */
+        {
+          char *name = realpath ("conftest.a", NULL);
+          if (!(name && *name == '/'))
+            result |= 1;
+          free (name);
+        }
+        /* This test fails on older versions of Cygwin.  */
+        {
+          char *name = realpath ("conftest.b/../conftest.a", NULL);
+          if (name != NULL)
+            result |= 2;
+          free (name);
+        }
+        /* This test fails on Cygwin 2.9.  */
+        #if HAVE_LSTAT
+        {
+          char *name = realpath ("conftest.l/../conftest.a", NULL);
+          if (name != NULL || errno != ENOTDIR)
+            result |= 4;
+          free (name);
+        }
+        #endif
+        /* This test fails on Mac OS X 10.13, OpenBSD 6.0.  */
+        {
+          char *name = realpath ("conftest.a/", NULL);
+          if (name != NULL)
+            result |= 8;
+          free (name);
+        }
+        /* This test fails on AIX 7, Solaris 10.  */
+        {
+          char *name1 = realpath (".", NULL);
+          char *name2 = realpath ("conftest.d//./..", NULL);
+          if (! name1 || ! name2 || strcmp (name1, name2))
+            result |= 16;
+          free (name1);
+          free (name2);
+        }
+        #ifdef __linux__
+        /* On Linux, // is the same as /. See also double-slash-root.m4.
+           realpath() should respect this.
+           This test fails on musl libc 1.2.2.  */
+        {
+          char *name = realpath ("//", NULL);
+          if (! name || strcmp (name, "/"))
+            result |= 32;
+          free (name);
+        }
+        #endif
+        return result;
+      ]])
+     ],
+     [gl_cv_func_realpath_works=yes],
+     [case $? in
+        32) gl_cv_func_realpath_works=nearly ;;
+        *)  gl_cv_func_realpath_works=no ;;
+      esac
+     ],
+     [case "$host_os" in
+                           # Guess yes on glibc systems.
+        *-gnu* | gnu*)     gl_cv_func_realpath_works="guessing yes" ;;
+                           # Guess 'nearly' on musl systems.
+        *-musl*)           gl_cv_func_realpath_works="guessing nearly" ;;
+                           # Guess no on Cygwin.
+        cygwin*)           gl_cv_func_realpath_works="guessing no" ;;
+                           # Guess no on native Windows.
+        mingw* | windows*) gl_cv_func_realpath_works="guessing no" ;;
+                           # If we don't know, obey --enable-cross-guesses.
+        *)                 gl_cv_func_realpath_works="$gl_cross_guess_normal" ;;
+      esac
+     ])
+    rm -rf conftest.a conftest.l conftest.d
+  ])
+  case "$gl_cv_func_realpath_works" in
+    *yes)
+      AC_DEFINE([FUNC_REALPATH_WORKS], [1],
+        [Define to 1 if realpath() can malloc memory, always gives an absolute path, and handles leading slashes and a trailing slash correctly.])
+      ;;
+    *nearly)
+      AC_DEFINE([FUNC_REALPATH_NEARLY_WORKS], [1],
+        [Define to 1 if realpath() can malloc memory, always gives an absolute path, and handles a trailing slash correctly.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index fa2e6b0204e7e10a51034eb01b8698099520e6c6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/chdir-long.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..62c7a79c612000a965007428b81990ad89f5f941
--- /dev/null
@@ -0,0 +1,30 @@
+#serial 17
+
+# 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-2007, 2009-2024 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_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ])
+  AC_CACHE_CHECK([whether this system supports file names of any length],
+    [gl_cv_have_unlimited_file_name_length],
+    [AC_EGREP_CPP([have_arbitrary_file_name_length_limit],
+                  gl_PATHMAX_SNIPPET[
+#ifdef PATH_MAX
+have_arbitrary_file_name_length_limit
+#endif],
+    [gl_cv_have_unlimited_file_name_length=no],
+    [gl_cv_have_unlimited_file_name_length=yes])])
+])
+
+AC_DEFUN([gl_PREREQ_CHDIR_LONG], [:])
deleted file mode 120000 (symlink)
index d1885260c5d8cc964e591cdf949f8f14f405c029..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/chmod.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..16a91e0da20278898ecfe8dace2ba0845beabc32
--- /dev/null
@@ -0,0 +1,87 @@
+# chmod.m4 serial 3
+dnl Copyright (C) 2004-2024 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 Bruno Haible.
+
+AC_DEFUN([gl_FUNC_CHMOD],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether chmod works],
+    [gl_cv_func_chmod_works],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [
+            AC_INCLUDES_DEFAULT[
+            #if defined _WIN32 && !defined __CYGWIN__
+             #include <io.h>
+            #endif
+            #include <errno.h>
+            #include <fcntl.h>
+            #ifndef S_IRUSR
+             #define S_IRUSR 0400
+            #endif
+            #ifndef S_IWUSR
+             #define S_IWUSR 0200
+            #endif
+            #ifndef S_IRWXU
+             #define S_IRWXU 0700
+            #endif
+            #ifndef S_IRWXG
+             #define S_IRWXG 0070
+            #endif
+            #ifndef S_IRWXO
+             #define S_IRWXO 0007
+            #endif
+          ]GL_MDA_DEFINES],
+          [[
+            int permissive = S_IRWXU | S_IRWXG | S_IRWXO;
+            int desired = S_IRUSR | S_IWUSR;
+            int result = 0;
+            #define file "conftest.chmod"
+            if (open (file, O_CREAT | O_WRONLY | O_TRUNC, permissive) < 0)
+              return 1;
+            /* Test whether chmod rejects a trailing slash on a non-directory,
+               with error ENOTDIR.
+               This test fails on AIX 7.2, IRIX 6.5 (no error) and
+               native Windows (error EINVAL).  */
+            errno = 0;
+            if (chmod (file "/", desired) == 0)
+              result |= 2;
+            else if (errno != ENOTDIR)
+              result |= 4;
+            return result;
+          ]])],
+       [gl_cv_func_chmod_works=yes],
+       [gl_cv_func_chmod_works=no],
+       [case "$host_os" in
+          # Guess no on AIX, IRIX, native Windows.
+          aix* | irix* | mingw* | windows*)
+            gl_cv_func_chmod_works="guessing no" ;;
+          # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, OpenBSD, Solaris, Haiku, Cygwin.
+          *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | solaris* | haiku* | cygwin*)
+            gl_cv_func_chmod_works="guessing yes" ;;
+          # Guess yes on systems that emulate the Linux system calls.
+          midipix*)
+            gl_cv_func_chmod_works="guessing yes" ;;
+          # If we don't know, obey --enable-cross-guesses.
+          *)
+            gl_cv_func_chmod_works="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -f conftest.chmod
+    ])
+  case "$gl_cv_func_chmod_works" in
+    *yes) ;;
+    *) REPLACE_CHMOD=1 ;;
+  esac
+])
+
+# Prerequisites of lib/chmod.c.
+AC_DEFUN([gl_PREREQ_CHMOD],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 6ebe5b99e79f03651fa4e6ef970ef519dd1fc5e5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/chown.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0f5f760ad1a65a1ef930672280e644c1947401b7
--- /dev/null
@@ -0,0 +1,218 @@
+# serial 36
+# Determine whether we need the chown wrapper.
+
+dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2024 Free Software
+dnl 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.
+
+# This is taken from the following Autoconf patch:
+# https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
+AC_DEFUN([AC_FUNC_CHOWN],
+[
+  AC_REQUIRE([AC_TYPE_UID_T])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+  AC_CHECK_HEADERS([unistd.h])
+  AC_CACHE_CHECK([for working chown],
+    [ac_cv_func_chown_works],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [AC_INCLUDES_DEFAULT
+           [#include <fcntl.h>
+          ]GL_MDA_DEFINES],
+          [[
+            char *f = "conftest.chown";
+            struct stat before, after;
+
+            if (creat (f, 0600) < 0)
+              return 1;
+            if (stat (f, &before) < 0)
+              return 1;
+            if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
+              return 1;
+            if (stat (f, &after) < 0)
+              return 1;
+            return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
+          ]])
+       ],
+       [ac_cv_func_chown_works=yes],
+       [ac_cv_func_chown_works=no],
+       [case "$host_os" in # ((
+                             # Guess yes on Linux systems.
+          linux-* | linux)   ac_cv_func_chown_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+          *-gnu* | gnu*)     ac_cv_func_chown_works="guessing yes" ;;
+                             # Guess no on native Windows.
+          mingw* | windows*) ac_cv_func_chown_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+          *)                 ac_cv_func_chown_works="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -f conftest.chown
+    ])
+  case "$ac_cv_func_chown_works" in
+    *yes)
+      AC_DEFINE([HAVE_CHOWN], [1],
+        [Define to 1 if your system has a working `chown' function.])
+      ;;
+  esac
+])# AC_FUNC_CHOWN
+
+AC_DEFUN_ONCE([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])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([chown fchown])
+
+  dnl mingw lacks chown altogether.
+  if test $ac_cv_func_chown = no; then
+    HAVE_CHOWN=0
+  else
+    dnl Some old systems treated chown like lchown.
+    case "$gl_cv_func_chown_follows_symlink" in
+      *yes) ;;
+      *) REPLACE_CHOWN=1 ;;
+    esac
+
+    dnl Some old systems tried to use uid/gid -1 literally.
+    case "$ac_cv_func_chown_works" in
+      *no)
+        AC_DEFINE([CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE], [1],
+          [Define if chown is not POSIX compliant regarding IDs of -1.])
+        REPLACE_CHOWN=1
+        ;;
+    esac
+
+    dnl Solaris 9 ignores trailing slash.
+    dnl FreeBSD 7.2 mishandles trailing slash on symlinks.
+    dnl Likewise for AIX 7.1.
+    AC_CACHE_CHECK([whether chown honors trailing slash],
+      [gl_cv_func_chown_slash_works],
+      [touch conftest.file && rm -f conftest.link
+       AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+]GL_MDA_DEFINES],
+        [[if (symlink ("conftest.file", "conftest.link")) return 1;
+          if (chown ("conftest.link/", getuid (), getgid ()) == 0) return 2;
+        ]])],
+        [gl_cv_func_chown_slash_works=yes],
+        [gl_cv_func_chown_slash_works=no],
+        [case "$host_os" in
+                    # Guess yes on glibc systems.
+           *-gnu*)  gl_cv_func_chown_slash_works="guessing yes" ;;
+                    # Guess yes on musl systems.
+           *-musl*) gl_cv_func_chown_slash_works="guessing yes" ;;
+                    # If we don't know, obey --enable-cross-guesses.
+           *)       gl_cv_func_chown_slash_works="$gl_cross_guess_normal" ;;
+         esac
+        ])
+      rm -f conftest.link conftest.file])
+    case "$gl_cv_func_chown_slash_works" in
+      *yes) ;;
+      *)
+        AC_DEFINE([CHOWN_TRAILING_SLASH_BUG], [1],
+          [Define to 1 if chown mishandles trailing slash.])
+        REPLACE_CHOWN=1
+        ;;
+    esac
+
+    dnl OpenBSD fails to update ctime if ownership does not change.
+    AC_CACHE_CHECK([whether chown always updates ctime],
+      [gl_cv_func_chown_ctime_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+]GL_MDA_DEFINES],
+        [[struct stat st1, st2;
+          if (close (creat ("conftest.file", 0600))) return 1;
+          if (stat ("conftest.file", &st1)) return 2;
+          sleep (1);
+          if (chown ("conftest.file", st1.st_uid, st1.st_gid)) return 3;
+          if (stat ("conftest.file", &st2)) return 4;
+          if (st2.st_ctime <= st1.st_ctime) return 5;
+        ]])],
+        [gl_cv_func_chown_ctime_works=yes],
+        [gl_cv_func_chown_ctime_works=no],
+        [case "$host_os" in
+                    # Guess yes on glibc systems.
+           *-gnu*)  gl_cv_func_chown_ctime_works="guessing yes" ;;
+                    # Guess yes on musl systems.
+           *-musl*) gl_cv_func_chown_ctime_works="guessing yes" ;;
+                    # If we don't know, obey --enable-cross-guesses.
+           *)       gl_cv_func_chown_ctime_works="$gl_cross_guess_normal" ;;
+         esac
+        ])
+      rm -f conftest.file])
+    case "$gl_cv_func_chown_ctime_works" in
+      *yes) ;;
+      *)
+        AC_DEFINE([CHOWN_CHANGE_TIME_BUG], [1], [Define to 1 if chown fails
+          to change ctime when at least one argument was not -1.])
+        REPLACE_CHOWN=1
+        ;;
+    esac
+  fi
+])
+
+# Determine whether chown follows symlinks (it should).
+AC_DEFUN_ONCE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK],
+[
+  AC_CACHE_CHECK(
+    [whether chown dereferences symlinks],
+    [gl_cv_func_chown_follows_symlink],
+    [
+      AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+]GL_MDA_DEFINES[
+        int
+        main ()
+        {
+          int result = 0;
+          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.  */
+          if (chown (dangling_symlink, getuid (), getgid ()) == 0)
+            result |= 1;
+          if (errno != ENOENT)
+            result |= 2;
+          return result;
+        }
+        ]])],
+        [gl_cv_func_chown_follows_symlink=yes],
+        [gl_cv_func_chown_follows_symlink=no],
+        [gl_cv_func_chown_follows_symlink="guessing yes"]
+      )
+    ]
+  )
+
+  case "$gl_cv_func_chown_follows_symlink" in
+    *yes) ;;
+    *)
+      AC_DEFINE([CHOWN_MODIFIES_SYMLINK], [1],
+        [Define if chown modifies symlinks.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 9ef24d7a530eacfbfb6b82ff389c592497c7a59e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/clock_time.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c016575c8eadfb9d8c7e6633521fbfa2f05b9b64
--- /dev/null
@@ -0,0 +1,53 @@
+# clock_time.m4 serial 14
+dnl Copyright (C) 2002-2006, 2009-2024 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.
+
+# Check for clock_getres, clock_gettime and clock_settime,
+# and set CLOCK_TIME_LIB.
+# For a program named, say foo, you should add a line like the following
+# in the corresponding Makefile.am file:
+# foo_LDADD = $(LDADD) $(CLOCK_TIME_LIB)
+
+AC_DEFUN([gl_CLOCK_TIME],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl Persuade glibc and Solaris <time.h> to declare these functions.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  # On mingw, these functions are defined in the libwinpthread library,
+  # which is better avoided.  In fact, the clock_gettime function is buggy
+  # in 32-bit mingw, when -D__MINGW_USE_VC2005_COMPAT is used (which Gnulib's
+  # year2038 module does): It leaves the upper 32 bits of the tv_sec field
+  # of the result uninitialized.
+
+  # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
+  # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
+
+  # Save and restore LIBS so e.g., -lrt, isn't added to it.  Otherwise, *all*
+  # programs in the package would end up linked with that potentially-shared
+  # library, inducing unnecessary run-time overhead.
+  CLOCK_TIME_LIB=
+  AC_SUBST([CLOCK_TIME_LIB])
+  case "$host_os" in
+    mingw* | windows*)
+      ac_cv_func_clock_getres=no
+      ac_cv_func_clock_gettime=no
+      ac_cv_func_clock_settime=no
+      ;;
+    *)
+      gl_saved_libs=$LIBS
+        AC_SEARCH_LIBS([clock_gettime], [rt posix4],
+                       [test "$ac_cv_search_clock_gettime" = "none required" ||
+                        CLOCK_TIME_LIB=$ac_cv_search_clock_gettime])
+        AC_CHECK_FUNCS([clock_getres clock_gettime clock_settime])
+      LIBS=$gl_saved_libs
+      ;;
+  esac
+
+  # For backward compatibility.
+  LIB_CLOCK_GETTIME="$CLOCK_TIME_LIB"
+  AC_SUBST([LIB_CLOCK_GETTIME])
+])
deleted file mode 120000 (symlink)
index 7b7b13b6fd418b6c9045a1000a6ad9637403e963..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/close.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6b6d38213911b76e076c0d6d5eebff6d2b64b4a6
--- /dev/null
@@ -0,0 +1,35 @@
+# close.m4 serial 10
+dnl Copyright (C) 2008-2024 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_ONCE([gl_FUNC_CLOSE],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_CLOSE=1
+    fi
+  ])
+  m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [
+    gl_PREREQ_SYS_H_WINSOCK2
+    if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then
+      dnl Even if the 'socket' module is not used here, another part of the
+      dnl application may use it and pass file descriptors that refer to
+      dnl sockets to the close() function. So enable the support for sockets.
+      REPLACE_CLOSE=1
+    fi
+  ])
+  dnl Replace close() for supporting the gnulib-defined fchdir() function,
+  dnl to keep fchdir's bookkeeping up-to-date.
+  m4_ifdef([gl_FUNC_FCHDIR], [
+    if test $REPLACE_CLOSE = 0; then
+      gl_TEST_FCHDIR
+      if test $HAVE_FCHDIR = 0; then
+        REPLACE_CLOSE=1
+      fi
+    fi
+  ])
+])
deleted file mode 120000 (symlink)
index 83c2c9655c91f6a5243880fa1373ac90c3ed7763..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/closedir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3774806fb76c00bb43181a7eaec7d533dd33607e
--- /dev/null
@@ -0,0 +1,31 @@
+# closedir.m4 serial 8
+dnl Copyright (C) 2011-2024 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_CLOSEDIR],
+[
+  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_CHECK_FUNCS([closedir])
+  if test $ac_cv_func_closedir = no; then
+    HAVE_CLOSEDIR=0
+  else
+    dnl Replace closedir() on native Windows and OS/2 kLIBC,
+    dnl to support fdopendir().
+    AC_REQUIRE([gl_DIRENT_DIR])
+    if test $DIR_HAS_FD_MEMBER = 0; then
+      REPLACE_CLOSEDIR=1
+    fi
+    dnl Replace closedir() for supporting the gnulib-defined fchdir() function,
+    dnl to keep fchdir's bookkeeping up-to-date.
+    m4_ifdef([gl_FUNC_FCHDIR], [
+      gl_TEST_FCHDIR
+      if test $HAVE_FCHDIR = 0; then
+        REPLACE_CLOSEDIR=1
+      fi
+    ])
+  fi
+])
deleted file mode 120000 (symlink)
index bbc07cb0dcb261a3501d77250175634461e7eaf6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/codeset.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..94dccce7775175e2ef26a3f6bbeb66141ba7bc69
--- /dev/null
@@ -0,0 +1,24 @@
+# codeset.m4 serial 5 (gettext-0.18.2)
+dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2024 Free Software
+dnl 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 Bruno Haible.
+
+AC_DEFUN([AM_LANGINFO_CODESET],
+[
+  AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <langinfo.h>]],
+          [[char* cs = nl_langinfo(CODESET); return !cs;]])],
+       [am_cv_langinfo_codeset=yes],
+       [am_cv_langinfo_codeset=no])
+    ])
+  if test $am_cv_langinfo_codeset = yes; then
+    AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
+      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
+  fi
+])
deleted file mode 120000 (symlink)
index 9fc35c869d0a9ad96401a5851b6c540630122baa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/config-h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9f3ab6ae5387bcbf14cc5855e23b4ba510156b79
--- /dev/null
@@ -0,0 +1,13 @@
+# Say that -DHAVE_CONFIG_H is not needed.
+
+dnl Copyright (C) 2006, 2009-2024 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.
+
+# This package's source files all include config.h unconditionally,
+# so there's no need to pass -DHAVE_CONFIG_H to the compiler.
+AC_DEFUN([gl_CONFIG_H],
+  [AC_CONFIG_COMMANDS_PRE([test "X$DEFS" = X-DHAVE_CONFIG_H && DEFS=])])
deleted file mode 120000 (symlink)
index 7b89c8deba261957b03f46d2bbc16e290155d3d9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/configmake.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..57774504dfceeee964a93d288ba3665cc0bc3589
--- /dev/null
@@ -0,0 +1,168 @@
+# configmake.m4 serial 5
+dnl Copyright (C) 2010-2024 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_PREREQ([2.60])
+
+# gl_CONFIGMAKE_PREP
+# ------------------
+# Guarantee all of the standard directory variables, even when used with
+# autoconf 2.64 (runstatedir wasn't supported before 2.70) or
+# automake 1.11 (runstatedir isn't supported even in 1.16.1).
+AC_DEFUN([gl_CONFIGMAKE_PREP],
+[
+  if test "x$lispdir" = x; then
+    AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp'])
+  fi
+  dnl Added in autoconf 2.70.
+  if test "x$runstatedir" = x; then
+    AC_SUBST([runstatedir], ['${localstatedir}/run'])
+  fi
+
+  dnl Automake 1.11 provides the pkg*dir variables merely without AC_SUBST,
+  dnl that is, only at the Makefile.am level.  AC_SUBST them, so that
+  dnl gl_CONFIGMAKE can compute the final values at configure time.
+  dnl Blindly assigning the value at configure time is OK, since configure
+  dnl does not have --pkg*dir=... options.
+  AC_SUBST([pkgdatadir], ['${datadir}/${PACKAGE}'])
+  AC_SUBST([pkgincludedir], ['${includedir}/${PACKAGE}'])
+  AC_SUBST([pkglibdir], ['${libdir}/${PACKAGE}'])
+  AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}'])
+])
+
+# gl_CONFIGMAKE
+# -------------
+# Find the final values of the standard directory variables, and create
+# AC_SUBSTed *_c and *_c_make variables with the corresponding values in
+# target runtime environment ($host_os) syntax.
+AC_DEFUN([gl_CONFIGMAKE],
+[
+  AC_REQUIRE([gl_CONFIGMAKE_PREP])
+
+  dnl Save the values.
+  gl_save_prefix="${prefix}"
+  gl_save_exec_prefix="${exec_prefix}"
+  gl_save_bindir="${bindir}"
+  gl_save_sbindir="${sbindir}"
+  gl_save_libexecdir="${libexecdir}"
+  gl_save_datarootdir="${datarootdir}"
+  gl_save_datadir="${datadir}"
+  gl_save_sysconfdir="${sysconfdir}"
+  gl_save_sharedstatedir="${sharedstatedir}"
+  gl_save_localstatedir="${localstatedir}"
+  gl_save_runstatedir="${runstatedir}"
+  gl_save_includedir="${includedir}"
+  gl_save_oldincludedir="${oldincludedir}"
+  gl_save_docdir="${docdir}"
+  gl_save_infodir="${infodir}"
+  gl_save_htmldir="${htmldir}"
+  gl_save_dvidir="${dvidir}"
+  gl_save_pdfdir="${pdfdir}"
+  gl_save_psdir="${psdir}"
+  gl_save_libdir="${libdir}"
+  gl_save_lispdir="${lispdir}"
+  gl_save_localedir="${localedir}"
+  gl_save_mandir="${mandir}"
+  gl_save_pkgdatadir="${pkgdatadir}"
+  gl_save_pkgincludedir="${pkgincludedir}"
+  gl_save_pkglibdir="${pkglibdir}"
+  gl_save_pkglibexecdir="${pkglibexecdir}"
+
+  dnl Find the final values.
+  dnl Unfortunately, prefix gets only finally determined at the end of
+  dnl configure.
+  if test "X$prefix" = "XNONE"; then
+    prefix="$ac_default_prefix"
+  fi
+  dnl Unfortunately, exec_prefix gets only finally determined at the end of
+  dnl configure.
+  if test "X$exec_prefix" = "XNONE"; then
+    exec_prefix='${prefix}'
+  fi
+  eval exec_prefix="$exec_prefix"
+  eval bindir="$bindir"
+  eval sbindir="$sbindir"
+  eval libexecdir="$libexecdir"
+  eval datarootdir="$datarootdir"
+  eval datadir="$datadir"
+  eval sysconfdir="$sysconfdir"
+  eval sharedstatedir="$sharedstatedir"
+  eval localstatedir="$localstatedir"
+  eval runstatedir="$runstatedir"
+  eval includedir="$includedir"
+  eval oldincludedir="$oldincludedir"
+  eval docdir="$docdir"
+  eval infodir="$infodir"
+  eval htmldir="$htmldir"
+  eval dvidir="$dvidir"
+  eval pdfdir="$pdfdir"
+  eval psdir="$psdir"
+  eval libdir="$libdir"
+  eval lispdir="$lispdir"
+  eval localedir="$localedir"
+  eval mandir="$mandir"
+  eval pkgdatadir="$pkgdatadir"
+  eval pkgincludedir="$pkgincludedir"
+  eval pkglibdir="$pkglibdir"
+  eval pkglibexecdir="$pkglibexecdir"
+
+  dnl Transform the final values.
+  gl_BUILD_TO_HOST([prefix])
+  gl_BUILD_TO_HOST([exec_prefix])
+  gl_BUILD_TO_HOST([bindir])
+  gl_BUILD_TO_HOST([sbindir])
+  gl_BUILD_TO_HOST([libexecdir])
+  gl_BUILD_TO_HOST([datarootdir])
+  gl_BUILD_TO_HOST([datadir])
+  gl_BUILD_TO_HOST([sysconfdir])
+  gl_BUILD_TO_HOST([sharedstatedir])
+  gl_BUILD_TO_HOST([localstatedir])
+  gl_BUILD_TO_HOST([runstatedir])
+  gl_BUILD_TO_HOST([includedir])
+  gl_BUILD_TO_HOST([oldincludedir])
+  gl_BUILD_TO_HOST([docdir])
+  gl_BUILD_TO_HOST([infodir])
+  gl_BUILD_TO_HOST([htmldir])
+  gl_BUILD_TO_HOST([dvidir])
+  gl_BUILD_TO_HOST([pdfdir])
+  gl_BUILD_TO_HOST([psdir])
+  gl_BUILD_TO_HOST([libdir])
+  gl_BUILD_TO_HOST([lispdir])
+  gl_BUILD_TO_HOST([localedir])
+  gl_BUILD_TO_HOST([mandir])
+  gl_BUILD_TO_HOST([pkgdatadir])
+  gl_BUILD_TO_HOST([pkgincludedir])
+  gl_BUILD_TO_HOST([pkglibdir])
+  gl_BUILD_TO_HOST([pkglibexecdir])
+
+  dnl Restore the values.
+  pkglibexecdir="${gl_save_pkglibexecdir}"
+  pkglibdir="${gl_save_pkglibdir}"
+  pkgincludedir="${gl_save_pkgincludedir}"
+  pkgdatadir="${gl_save_pkgdatadir}"
+  mandir="${gl_save_mandir}"
+  localedir="${gl_save_localedir}"
+  lispdir="${gl_save_lispdir}"
+  libdir="${gl_save_libdir}"
+  psdir="${gl_save_psdir}"
+  pdfdir="${gl_save_pdfdir}"
+  dvidir="${gl_save_dvidir}"
+  htmldir="${gl_save_htmldir}"
+  infodir="${gl_save_infodir}"
+  docdir="${gl_save_docdir}"
+  oldincludedir="${gl_save_oldincludedir}"
+  includedir="${gl_save_includedir}"
+  runstatedir="${gl_save_runstatedir}"
+  localstatedir="${gl_save_localstatedir}"
+  sharedstatedir="${gl_save_sharedstatedir}"
+  sysconfdir="${gl_save_sysconfdir}"
+  datadir="${gl_save_datadir}"
+  datarootdir="${gl_save_datarootdir}"
+  libexecdir="${gl_save_libexecdir}"
+  sbindir="${gl_save_sbindir}"
+  bindir="${gl_save_bindir}"
+  exec_prefix="${gl_save_exec_prefix}"
+  prefix="${gl_save_prefix}"
+])
deleted file mode 120000 (symlink)
index 267f996b017c5d5f1229cce7964597d70e43fec8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/copy-file-range.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..443e598ba55e895645add2d93cd6b12fb018e72e
--- /dev/null
@@ -0,0 +1,58 @@
+# copy-file-range.m4 serial 5
+dnl Copyright 2019-2024 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_COPY_FILE_RANGE],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl Persuade glibc <unistd.h> to declare copy_file_range.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl Use AC_LINK_IFELSE, rather than AC_CHECK_FUNCS or a variant,
+  dnl since we don't want AC_CHECK_FUNCS's checks for glibc stubs.
+  dnl Programs that use copy_file_range must fall back on read+write
+  dnl anyway, and there's little point to substituting the Gnulib stub
+  dnl for a glibc stub.
+  case "$host_os" in
+    *-gnu* | gnu*)
+      AC_CACHE_CHECK([for copy_file_range], [gl_cv_func_copy_file_range],
+        [AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <unistd.h>
+              ]],
+              [[ssize_t (*func) (int, off_t *, int, off_t *, size_t, unsigned)
+                  = copy_file_range;
+                return func (0, 0, 0, 0, 0, 0) & 127;
+              ]])
+           ],
+           [gl_cv_func_copy_file_range=yes],
+           [gl_cv_func_copy_file_range=no])
+        ])
+      gl_cv_onwards_func_copy_file_range="$gl_cv_func_copy_file_range"
+      ;;
+    *)
+      gl_CHECK_FUNCS_ANDROID([copy_file_range], [[#include <unistd.h>]])
+      gl_cv_func_copy_file_range="$ac_cv_func_copy_file_range"
+      ;;
+  esac
+  if test "$gl_cv_func_copy_file_range" != yes; then
+    HAVE_COPY_FILE_RANGE=0
+    case "$gl_cv_onwards_func_copy_file_range" in
+      future*) REPLACE_COPY_FILE_RANGE=1 ;;
+    esac
+  else
+    AC_DEFINE([HAVE_COPY_FILE_RANGE], 1,
+      [Define to 1 if the function copy_file_range exists.])
+
+    case $host_os in
+      linux*)
+        # See copy-file-range.c comment re pre-5.3 Linux kernel bugs.
+        # We should be able to remove this hack in 2025.
+        REPLACE_COPY_FILE_RANGE=1;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index fc3bd4a0350d0438a6209046652c79310652b7e5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/creat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..11c10d2413ec8c3f866698f9cae50993e61160cb
--- /dev/null
@@ -0,0 +1,23 @@
+# creat.m4 serial 2
+dnl Copyright (C) 2019-2024 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_CREAT],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw* | windows*)
+      REPLACE_CREAT=1
+      ;;
+    *)
+      gl_OPEN_TRAILING_SLASH_BUG
+      case "$gl_cv_func_open_slash" in
+        *no)
+          REPLACE_CREAT=1
+          ;;
+      esac
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 9db9853f4317e324d6d74f52053a8d79780eeadf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/ctype_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ef0ee7f25f013f312243afc15714a6a577b1095f
--- /dev/null
@@ -0,0 +1,47 @@
+# ctype_h.m4 serial 9
+dnl Copyright (C) 2009-2024 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_ONCE([gl_CTYPE_H],
+[
+  AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+
+  dnl <ctype.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_NEXT_HEADERS([ctype.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <ctype.h>
+    ]], [isblank])
+])
+
+# gl_CTYPE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_CTYPE_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_CTYPE_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_CTYPE_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_CTYPE_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISBLANK])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_CTYPE_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_CTYPE_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_ISBLANK=1;   AC_SUBST([HAVE_ISBLANK])
+])
deleted file mode 120000 (symlink)
index 09839c90b57dc64b6ee9260f966f592277b641d1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/cycle-check.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9d35a60a1a79ea9e4840d4f04e7dcf9931b4ad72
--- /dev/null
@@ -0,0 +1,7 @@
+#serial 7
+dnl Copyright (C) 2005-2007, 2009-2024 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], [:])
deleted file mode 120000 (symlink)
index d9863b8b7241762637e3f07d7a3c1d90beb472ea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/d-ino.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b127ab24059d6037b43afe7d23b3018ce8db1e6d
--- /dev/null
@@ -0,0 +1,62 @@
+# serial 22
+
+dnl From Jim Meyering.
+dnl
+dnl Check whether struct dirent has a member named d_ino.
+dnl
+
+# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2024 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_CHECK_TYPE_STRUCT_DIRENT_D_INO],
+  [AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+   AC_CACHE_CHECK([for d_ino member in directory struct],
+                  [gl_cv_struct_dirent_d_ino],
+     [AC_RUN_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <sys/types.h>
+             #include <sys/stat.h>
+             #include <dirent.h>
+           ]],
+           [[DIR *dp = opendir (".");
+             struct dirent *e;
+             struct stat st;
+             if (! dp)
+               return 1;
+             e = readdir (dp);
+             if (! e)
+               { closedir (dp); return 2; }
+             if (lstat (e->d_name, &st) != 0)
+               { closedir (dp); return 3; }
+             if (e->d_ino != st.st_ino)
+               { closedir (dp); return 4; }
+             closedir (dp);
+             return 0;
+           ]])],
+           [gl_cv_struct_dirent_d_ino=yes],
+           [gl_cv_struct_dirent_d_ino=no],
+           [case "$host_os" in
+                                 # Guess yes on glibc systems with Linux kernel.
+              linux*-gnu*)       gl_cv_struct_dirent_d_ino="guessing yes" ;;
+                                 # Guess yes on musl systems with Linux kernel.
+              linux*-musl*)      gl_cv_struct_dirent_d_ino="guessing yes" ;;
+                                 # Guess yes on systems that emulate the Linux system calls.
+              midipix*)          gl_cv_struct_dirent_d_ino="guessing yes" ;;
+                                 # Guess no on native Windows.
+              mingw* | windows*) gl_cv_struct_dirent_d_ino="guessing no" ;;
+                                 # If we don't know, obey --enable-cross-guesses.
+              *)                 gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;;
+            esac
+           ])])
+   case "$gl_cv_struct_dirent_d_ino" in
+     *yes)
+       AC_DEFINE([D_INO_IN_DIRENT], [1],
+         [Define if struct dirent has a member d_ino that actually works.])
+       ;;
+   esac
+  ]
+)
deleted file mode 120000 (symlink)
index d77b4f19eaa41f15de0ef6fef6f429b3b7ff40f2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/d-type.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b06bca5a7dc310d1aa6ab646cde724985ac2aee0
--- /dev/null
@@ -0,0 +1,32 @@
+# serial 12
+
+dnl From Jim Meyering.
+dnl
+dnl Check whether struct dirent has a member named d_type.
+dnl
+
+# Copyright (C) 1997, 1999-2004, 2006, 2009-2024 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_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
+  [AC_CACHE_CHECK([for d_type member in directory struct],
+                  [gl_cv_struct_dirent_d_type],
+     [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <dirent.h>
+         ]],
+         [[struct dirent dp; dp.d_type = 0;]])],
+       [gl_cv_struct_dirent_d_type=yes],
+       [gl_cv_struct_dirent_d_type=no])
+     ]
+   )
+   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.])
+   fi
+  ]
+)
deleted file mode 120000 (symlink)
index f7891e026c4d14680821e70a0a7ddc833d268cb6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/dirent-safer.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d584ea7be6e9c8353cd01f0c5e2127fa02ab87eb
--- /dev/null
@@ -0,0 +1,10 @@
+#serial 2
+dnl Copyright (C) 2009-2024 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_DIRENT_SAFER],
+[
+  AC_CHECK_FUNCS_ONCE([fdopendir])
+])
deleted file mode 120000 (symlink)
index f5f31bc4c8f0d86cee2a90c7dec215d2acd6f5cb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/dirent_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3e3d967f4993eae3e8b154960bf8063999446f72
--- /dev/null
@@ -0,0 +1,97 @@
+# dirent_h.m4 serial 22
+dnl Copyright (C) 2008-2024 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 Bruno Haible.
+
+AC_DEFUN_ONCE([gl_DIRENT_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+
+  dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([dirent.h])
+  if test $ac_cv_header_dirent_h = yes; then
+    HAVE_DIRENT_H=1
+  else
+    HAVE_DIRENT_H=0
+  fi
+  AC_SUBST([HAVE_DIRENT_H])
+
+  gl_DIRENT_DIR
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <dirent.h>
+    ]], [alphasort closedir dirfd fdopendir opendir readdir rewinddir scandir])
+])
+
+dnl Determine whether <dirent.h> needs to override the DIR type.
+AC_DEFUN_ONCE([gl_DIRENT_DIR],
+[
+  dnl Set DIR_HAS_FD_MEMBER if dirfd() works, i.e. not always returns -1.
+  dnl We could use the findings from gl_FUNC_DIRFD and gl_PREREQ_DIRFD, but
+  dnl it's simpler since we know the affected platforms.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw* | windows* | os2*) DIR_HAS_FD_MEMBER=0 ;;
+    *)                        DIR_HAS_FD_MEMBER=1 ;;
+  esac
+  AC_SUBST([DIR_HAS_FD_MEMBER])
+])
+
+# gl_DIRENT_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_DIRENT_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_DIRENT_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_DIRENT_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REWINDDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSEDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DIRFD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPENDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALPHASORT])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_DIRENT_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_OPENDIR=1;       AC_SUBST([HAVE_OPENDIR])
+  HAVE_READDIR=1;       AC_SUBST([HAVE_READDIR])
+  HAVE_REWINDDIR=1;     AC_SUBST([HAVE_REWINDDIR])
+  HAVE_CLOSEDIR=1;      AC_SUBST([HAVE_CLOSEDIR])
+  HAVE_DECL_DIRFD=1;    AC_SUBST([HAVE_DECL_DIRFD])
+  HAVE_DECL_FDOPENDIR=1;AC_SUBST([HAVE_DECL_FDOPENDIR])
+  HAVE_FDOPENDIR=1;     AC_SUBST([HAVE_FDOPENDIR])
+  HAVE_SCANDIR=1;       AC_SUBST([HAVE_SCANDIR])
+  HAVE_ALPHASORT=1;     AC_SUBST([HAVE_ALPHASORT])
+  REPLACE_OPENDIR=0;    AC_SUBST([REPLACE_OPENDIR])
+  REPLACE_READDIR=0;    AC_SUBST([REPLACE_READDIR])
+  REPLACE_REWINDDIR=0;  AC_SUBST([REPLACE_REWINDDIR])
+  REPLACE_CLOSEDIR=0;   AC_SUBST([REPLACE_CLOSEDIR])
+  REPLACE_DIRFD=0;      AC_SUBST([REPLACE_DIRFD])
+  REPLACE_FDOPENDIR=0;  AC_SUBST([REPLACE_FDOPENDIR])
+])
deleted file mode 120000 (symlink)
index 6cea626878d8538a826e228488f637655fec2474..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/dirfd.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d4c4e6bec7f9443401e8dbd966ee380c5e3d24fe
--- /dev/null
@@ -0,0 +1,88 @@
+# serial 29   -*- Autoconf -*-
+
+dnl Find out how to get the file descriptor associated with an open DIR*.
+
+# Copyright (C) 2001-2006, 2008-2024 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_DIRFD],
+[
+  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl Persuade glibc <dirent.h> to declare dirfd().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_FUNCS([dirfd])
+  AC_CHECK_DECLS([dirfd], , ,
+    [[#include <sys/types.h>
+      #include <dirent.h>]])
+  if test $ac_cv_have_decl_dirfd = no; then
+    HAVE_DECL_DIRFD=0
+  fi
+
+  AC_CACHE_CHECK([whether dirfd is a macro],
+    [gl_cv_func_dirfd_macro],
+    [AC_EGREP_CPP([dirent_header_defines_dirfd], [
+#include <sys/types.h>
+#include <dirent.h>
+#ifdef dirfd
+ dirent_header_defines_dirfd
+#endif],
+       [gl_cv_func_dirfd_macro=yes],
+       [gl_cv_func_dirfd_macro=no])])
+
+  if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no; then
+    HAVE_DIRFD=0
+  else
+    HAVE_DIRFD=1
+    dnl Replace dirfd() on native Windows and OS/2 kLIBC,
+    dnl to support fdopendir().
+    AC_REQUIRE([gl_DIRENT_DIR])
+    if test $DIR_HAS_FD_MEMBER = 0; then
+      REPLACE_DIRFD=1
+    fi
+  fi
+])
+
+dnl Prerequisites of lib/dirfd.c.
+AC_DEFUN([gl_PREREQ_DIRFD],
+[
+  AC_CACHE_CHECK([how to get the file descriptor associated with an open DIR*],
+                 [gl_cv_sys_dir_fd_member_name],
+    [
+      dirfd_save_CFLAGS=$CFLAGS
+      for ac_expr in d_fd dd_fd; do
+
+        CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+           #include <sys/types.h>
+           #include <dirent.h>]],
+          [[DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;]])],
+          [dir_fd_found=yes]
+        )
+        CFLAGS=$dirfd_save_CFLAGS
+        test "$dir_fd_found" = yes && break
+      done
+      test "$dir_fd_found" = yes || ac_expr=no_such_member
+
+      gl_cv_sys_dir_fd_member_name=$ac_expr
+    ]
+  )
+  if test $gl_cv_sys_dir_fd_member_name != no_such_member; then
+    AC_DEFINE_UNQUOTED([DIR_FD_MEMBER_NAME],
+      [$gl_cv_sys_dir_fd_member_name],
+      [the name of the file descriptor member of DIR])
+  fi
+  AH_VERBATIM([DIR_TO_FD],
+              [#ifdef DIR_FD_MEMBER_NAME
+# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME)
+#else
+# define DIR_TO_FD(Dir_p) -1
+#endif
+])
+])
deleted file mode 120000 (symlink)
index deb1a48d114a2e9342048d5aad623bbdff24583e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/double-slash-root.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..00f23a70b0cad04ba894dad83b0c93f4798a79c9
--- /dev/null
@@ -0,0 +1,38 @@
+# double-slash-root.m4 serial 4   -*- Autoconf -*-
+dnl Copyright (C) 2006, 2008-2024 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_DOUBLE_SLASH_ROOT],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root],
+    [ if test x"$cross_compiling" = xyes ; then
+        # When cross-compiling, there is no way to tell whether // is special
+        # short of a list of hosts.  However, the only known hosts to date
+        # that have a distinct // are Apollo DomainOS (too old to port to),
+        # Cygwin, and z/OS.  If anyone knows of another system for which // has
+        # special semantics and is distinct from /, please report it to
+        # <bug-gnulib@gnu.org>.
+        case $host in
+          *-cygwin | i370-ibm-openedition)
+            gl_cv_double_slash_root=yes ;;
+          *)
+            # Be optimistic and assume that / and // are the same when we
+            # don't know.
+            gl_cv_double_slash_root='unknown, assuming no' ;;
+        esac
+      else
+        set x `ls -di / // 2>/dev/null`
+        if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then
+          gl_cv_double_slash_root=no
+        else
+          gl_cv_double_slash_root=yes
+        fi
+      fi])
+  if test "$gl_cv_double_slash_root" = yes; then
+    AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1],
+      [Define to 1 if // is a file system root distinct from /.])
+  fi
+])
deleted file mode 120000 (symlink)
index fdb1072ef6f97ad5b1a5cc122b14a1933bf9c491..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/dup.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eafef02cac3bdaaa59c3d7482192e85312eab47d
--- /dev/null
@@ -0,0 +1,54 @@
+# dup.m4 serial 8
+dnl Copyright (C) 2011-2024 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_DUP],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_DUP=1
+    fi
+  ])
+  dnl Replace dup() for supporting the gnulib-defined fchdir() function,
+  dnl to keep fchdir's bookkeeping up-to-date.
+  m4_ifdef([gl_FUNC_FCHDIR], [
+    gl_TEST_FCHDIR
+    if test $HAVE_FCHDIR = 0; then
+      REPLACE_DUP=1
+    fi
+  ])
+  AC_CACHE_CHECK([whether dup works], [gl_cv_func_dup_works],
+    [AC_RUN_IFELSE(
+      [AC_LANG_PROGRAM([[#include <unistd.h>
+                         #include <fcntl.h>
+                         #include <errno.h>
+                       ]GL_MDA_DEFINES],
+         [[/* On OS/2 kLIBC, dup does not work on a directory fd.  */
+           int fd = open (".", O_RDONLY);
+           return fd < 0 ? 1 : dup (fd) < 0 ? 2 : 0;
+         ]])
+      ],
+      [gl_cv_func_dup_works=yes],
+      [gl_cv_func_dup_works=no],
+      [case "$host_os" in
+                            # Guess no on native Windows.
+         mingw* | windows*) gl_cv_func_dup_works="guessing no" ;;
+         *)                 gl_cv_func_dup_works="guessing yes" ;;
+       esac
+      ])
+    ])
+  case "$gl_cv_func_dup_works" in
+    *yes) ;;
+    *)
+      REPLACE_DUP=1
+      ;;
+  esac
+])
+
+# Prerequisites of lib/dup.c.
+AC_DEFUN([gl_PREREQ_DUP], [:])
deleted file mode 120000 (symlink)
index f3555f949a29ac4ac14f12829c057b346d497375..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/dup2.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f6759b647a62c4ebe74f04854a29dd413c6af56f
--- /dev/null
@@ -0,0 +1,105 @@
+#serial 28
+dnl Copyright (C) 2002, 2005, 2007, 2009-2024 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_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works],
+    [AC_RUN_IFELSE([
+       AC_LANG_PROGRAM(
+         [[#include <errno.h>
+           #include <fcntl.h>
+           #include <limits.h>
+           #include <sys/resource.h>
+           #include <unistd.h>
+           ]GL_MDA_DEFINES[
+           #ifndef RLIM_SAVED_CUR
+           # define RLIM_SAVED_CUR RLIM_INFINITY
+           #endif
+           #ifndef RLIM_SAVED_MAX
+           # define RLIM_SAVED_MAX RLIM_INFINITY
+           #endif
+         ]],
+         [[int result = 0;
+           int bad_fd = INT_MAX;
+           struct rlimit rlim;
+           if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
+               && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX
+               && rlim.rlim_cur != RLIM_INFINITY
+               && rlim.rlim_cur != RLIM_SAVED_MAX
+               && rlim.rlim_cur != RLIM_SAVED_CUR)
+             bad_fd = rlim.rlim_cur;
+           #ifdef FD_CLOEXEC
+             if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1)
+               result |= 1;
+           #endif
+           if (dup2 (1, 1) != 1)
+             result |= 2;
+           #ifdef FD_CLOEXEC
+             if (fcntl (1, F_GETFD) != FD_CLOEXEC)
+               result |= 4;
+           #endif
+           close (0);
+           if (dup2 (0, 0) != -1)
+             result |= 8;
+           /* Many gnulib modules require POSIX conformance of EBADF.  */
+           if (dup2 (2, bad_fd) == -1 && errno != EBADF)
+             result |= 16;
+           /* Flush out some cygwin core dumps.  */
+           if (dup2 (2, -1) != -1 || errno != EBADF)
+             result |= 32;
+           dup2 (2, 255);
+           dup2 (2, 256);
+           /* On OS/2 kLIBC, dup2() does not work on a directory fd.  */
+           {
+             int fd = open (".", O_RDONLY);
+             if (fd == -1)
+               result |= 64;
+             else if (dup2 (fd, fd + 1) == -1)
+               result |= 128;
+             close (fd);
+           }
+           return result;]])
+      ],
+      [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
+      [case "$host_os" in
+         mingw* | windows*) # on this platform, dup2 always returns 0 for success
+           gl_cv_func_dup2_works="guessing no" ;;
+         cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
+           gl_cv_func_dup2_works="guessing no" ;;
+         aix* | freebsd*)
+                 # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE,
+                 # not EBADF.
+           gl_cv_func_dup2_works="guessing no" ;;
+         haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC.
+           gl_cv_func_dup2_works="guessing no" ;;
+         *-android*) # implemented using dup3(), which fails if oldfd == newfd
+           gl_cv_func_dup2_works="guessing no" ;;
+         os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd.
+           gl_cv_func_dup2_works="guessing no" ;;
+         *) gl_cv_func_dup2_works="guessing yes" ;;
+       esac])
+    ])
+  case "$gl_cv_func_dup2_works" in
+    *yes) ;;
+    *)
+      REPLACE_DUP2=1
+      AC_CHECK_FUNCS([setdtablesize])
+      ;;
+  esac
+  dnl Replace dup2() for supporting the gnulib-defined fchdir() function,
+  dnl to keep fchdir's bookkeeping up-to-date.
+  m4_ifdef([gl_FUNC_FCHDIR], [
+    gl_TEST_FCHDIR
+    if test $HAVE_FCHDIR = 0; then
+      REPLACE_DUP2=1
+    fi
+  ])
+])
+
+# Prerequisites of lib/dup2.c.
+AC_DEFUN([gl_PREREQ_DUP2], [])
deleted file mode 120000 (symlink)
index f41707474b9f45c15cb5f23836d12986dde72ed5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/eealloc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d8862a1e0f3d5e0cd3445f894bb6ae1574d3dfa4
--- /dev/null
@@ -0,0 +1,31 @@
+# eealloc.m4 serial 3
+dnl Copyright (C) 2003, 2009-2024 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_EEALLOC],
+[
+  AC_REQUIRE([gl_EEMALLOC])
+  AC_REQUIRE([gl_EEREALLOC])
+])
+
+AC_DEFUN([gl_EEMALLOC],
+[
+  _AC_FUNC_MALLOC_IF(
+    [gl_cv_func_malloc_0_nonnull=1],
+    [gl_cv_func_malloc_0_nonnull=0])
+  AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull],
+    [If malloc(0) is != NULL, define this to 1.  Otherwise define this
+     to 0.])
+])
+
+AC_DEFUN([gl_EEREALLOC],
+[
+  _AC_FUNC_REALLOC_IF(
+    [gl_cv_func_realloc_0_nonnull=1],
+    [gl_cv_func_realloc_0_nonnull=0])
+  AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull],
+    [If realloc(NULL,0) is != NULL, define this to 1.  Otherwise define this
+     to 0.])
+])
deleted file mode 120000 (symlink)
index 3f69aa94e8175c0ac21be43b215736e6ae032057..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/environ.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5b9e06b0088dc3b17e1aceb37e6393cc3686757e
--- /dev/null
@@ -0,0 +1,46 @@
+# environ.m4 serial 8
+dnl Copyright (C) 2001-2004, 2006-2024 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_ONCE([gl_ENVIRON],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  dnl Persuade glibc <unistd.h> to declare environ.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  gt_CHECK_VAR_DECL(
+    [#if HAVE_UNISTD_H
+     #include <unistd.h>
+     #endif
+     /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
+     #include <stdlib.h>
+    ],
+    [environ])
+  if test $gt_cv_var_environ_declaration != yes; then
+    HAVE_DECL_ENVIRON=0
+  fi
+])
+
+# Check if a variable is properly declared.
+# gt_CHECK_VAR_DECL(includes,variable)
+AC_DEFUN([gt_CHECK_VAR_DECL],
+[
+  define([gt_cv_var], [gt_cv_var_]$2[_declaration])
+  AC_CACHE_CHECK([if $2 is properly declared], [gt_cv_var],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[$1
+            typedef struct { int foo; } foo_t;
+            extern foo_t $2;]],
+          [[$2.foo = 1;]])],
+       [gt_cv_var=no],
+       [gt_cv_var=yes])])
+  if test $gt_cv_var = yes; then
+    AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1,
+              [Define if you have the declaration of $2.])
+  fi
+  undefine([gt_cv_var])
+])
deleted file mode 120000 (symlink)
index 7bf2202f37b5efa8be925fe59bac87ab6adee6db..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/errno_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8900d6c7257011b9da37ae7f5d3825b9973c60e1
--- /dev/null
@@ -0,0 +1,131 @@
+# errno_h.m4 serial 14
+dnl Copyright (C) 2004, 2006, 2008-2024 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_PREREQ([2.61])
+
+AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
+    AC_EGREP_CPP([booboo],[
+#include <errno.h>
+#if !defined ETXTBSY
+booboo
+#endif
+#if !defined ENOMSG
+booboo
+#endif
+#if !defined EIDRM
+booboo
+#endif
+#if !defined ENOLINK
+booboo
+#endif
+#if !defined EPROTO
+booboo
+#endif
+#if !defined EMULTIHOP
+booboo
+#endif
+#if !defined EBADMSG
+booboo
+#endif
+#if !defined EOVERFLOW
+booboo
+#endif
+#if !defined ENOTSUP
+booboo
+#endif
+#if !defined ENETRESET
+booboo
+#endif
+#if !defined ECONNABORTED
+booboo
+#endif
+#if !defined ESTALE
+booboo
+#endif
+#if !defined EDQUOT
+booboo
+#endif
+#if !defined ECANCELED
+booboo
+#endif
+#if !defined EOWNERDEAD
+booboo
+#endif
+#if !defined ENOTRECOVERABLE
+booboo
+#endif
+#if !defined EILSEQ
+booboo
+#endif
+      ],
+      [gl_cv_header_errno_h_complete=no],
+      [gl_cv_header_errno_h_complete=yes])
+  ])
+  if test $gl_cv_header_errno_h_complete = yes; then
+    GL_GENERATE_ERRNO_H=false
+  else
+    gl_NEXT_HEADERS([errno.h])
+    GL_GENERATE_ERRNO_H=true
+  fi
+  gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
+  gl_REPLACE_ERRNO_VALUE([ENOLINK])
+  gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
+])
+
+# Assuming $1 = EOVERFLOW.
+# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
+# POSIX.  But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
+# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
+# Check for the value of EOVERFLOW.
+# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
+AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
+[
+  if $GL_GENERATE_ERRNO_H; then
+    AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
+      AC_EGREP_CPP([yes],[
+#include <errno.h>
+#ifdef ]$1[
+yes
+#endif
+      ],
+      [gl_cv_header_errno_h_]$1[=yes],
+      [gl_cv_header_errno_h_]$1[=no])
+      if test $gl_cv_header_errno_h_]$1[ = no; then
+        AC_EGREP_CPP([yes],[
+#define _XOPEN_SOURCE_EXTENDED 1
+#include <errno.h>
+#ifdef ]$1[
+yes
+#endif
+          ], [gl_cv_header_errno_h_]$1[=hidden])
+        if test $gl_cv_header_errno_h_]$1[ = hidden; then
+          dnl The macro exists but is hidden.
+          dnl Define it to the same value.
+          AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
+#define _XOPEN_SOURCE_EXTENDED 1
+#include <errno.h>
+/* The following two lines are a workaround against an autoconf-2.52 bug.  */
+#include <stdio.h>
+#include <stdlib.h>
+])
+        fi
+      fi
+    ])
+    case $gl_cv_header_errno_h_]$1[ in
+      yes | no)
+        ]$1[_HIDDEN=0; ]$1[_VALUE=
+        ;;
+      *)
+        ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
+        ;;
+    esac
+    AC_SUBST($1[_HIDDEN])
+    AC_SUBST($1[_VALUE])
+  fi
+])
deleted file mode 120000 (symlink)
index ff4e61c5f42e70a5069eab6f524ba9c5ed3dde48..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/error.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5688afcf49c29087bf9c66dc853157ba6a3c8161
--- /dev/null
@@ -0,0 +1,22 @@
+#serial 16
+
+# Copyright (C) 1996-1998, 2001-2004, 2009-2024 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_ERROR],
+[
+])
+
+# Prerequisites of lib/error.c.
+AC_DEFUN([gl_PREREQ_ERROR],
+[
+  dnl Use system extensions on Android, so that AC_FUNC_STRERROR_R
+  dnl discovers the GNU API for strerror_r on Android API level 23 and later.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([AC_FUNC_STRERROR_R])
+  :
+])
deleted file mode 120000 (symlink)
index 2e612b4cf554704e4988863ceccbf6f23ddade1c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/error_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..006770c4d354e7730b92b2976b91ac86b9bb5d4f
--- /dev/null
@@ -0,0 +1,124 @@
+# error_h.m4 serial 4
+dnl Copyright (C) 1996-2024 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 Bruno Haible.
+dnl Provide a working <error.h>.
+
+AC_DEFUN_ONCE([gl_ERROR_H],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  gl_CHECK_NEXT_HEADERS([error.h])
+  if test $ac_cv_header_error_h = yes; then
+    HAVE_ERROR_H=1
+  else
+    HAVE_ERROR_H=0
+  fi
+  AC_SUBST([HAVE_ERROR_H])
+
+  REPLACE_ERROR=0
+
+  gl_CHECK_FUNCS_ANDROID([error], [[#include <error.h>]])
+  if test $ac_cv_func_error = yes; then
+    HAVE_ERROR=1
+  else
+    HAVE_ERROR=0
+    case "$gl_cv_onwards_func_error" in
+      future*) REPLACE_ERROR=1 ;;
+    esac
+  fi
+
+  dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer
+  dnl maintained in Autoconf and because it invokes AC_LIBOBJ.
+  dnl We need to notice a missing declaration, like gl_CHECK_FUNCS_ANDROID does.
+  AC_CHECK_DECL([error_at_line], , , [[#include <error.h>]])
+  if test $ac_cv_have_decl_error_at_line = yes; then
+    AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <error.h>]],
+            [[error_at_line (0, 0, "", 0, "an error occurred");]])],
+         [ac_cv_lib_error_at_line=yes],
+         [ac_cv_lib_error_at_line=no])])
+  else
+    ac_cv_lib_error_at_line=no
+  fi
+  if test $ac_cv_lib_error_at_line = yes; then
+    HAVE_ERROR_AT_LINE=1
+  else
+    HAVE_ERROR_AT_LINE=0
+  fi
+  REPLACE_ERROR_AT_LINE=0
+
+  if test $ac_cv_func_error = yes && test $ac_cv_lib_error_at_line = yes; then
+    dnl On Android 11, when error_print_progname is set, the output of the
+    dnl error() function contains an extra space.
+    AC_CACHE_CHECK([for working error function],
+      [gl_cv_func_working_error],
+      [if test $cross_compiling != yes; then
+         AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM([[
+              #include <error.h>
+              static void print_no_progname (void) {}
+            ]], [[
+              error_print_progname = print_no_progname;
+              error (0, 0, "foo");
+            ]])
+           ],
+           [rm -f conftest.out
+            if test -s conftest$ac_exeext \
+               && ./conftest$ac_exeext 2> conftest.out; then
+              if grep ' ' conftest.out >/dev/null; then
+                gl_cv_func_working_error=no
+              else
+                gl_cv_func_working_error=yes
+              fi
+            else
+              gl_cv_func_working_error=no
+            fi
+            rm -f conftest.out
+           ],
+           [gl_cv_func_working_error=no])
+       else
+         AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM([[
+              #include <error.h>
+            ]], [[
+              error (0, 0, "foo");
+            ]])
+           ],
+           [case "$host_os" in
+                               # Guess yes on glibc systems.
+              *-gnu* | gnu*)   gl_cv_func_working_error="guessing yes" ;;
+                               # Guess no on Android.
+              linux*-android*) gl_cv_func_working_error="guessing no" ;;
+                               # If we don't know, obey --enable-cross-guesses.
+              *)               gl_cv_func_working_error="$gl_cross_guess_normal" ;;
+            esac
+           ],
+           [gl_cv_func_working_error=no])
+       fi
+      ])
+    case "$gl_cv_func_working_error" in
+      *no)
+        REPLACE_ERROR=1
+        REPLACE_ERROR_AT_LINE=1
+        ;;
+    esac
+  fi
+
+  if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \
+     || test $HAVE_ERROR_AT_LINE = 0 || test $REPLACE_ERROR_AT_LINE = 1; then
+    COMPILE_ERROR_C=1
+  else
+    COMPILE_ERROR_C=0
+  fi
+
+  AC_SUBST([HAVE_ERROR])
+  AC_SUBST([HAVE_ERROR_AT_LINE])
+  AC_SUBST([REPLACE_ERROR])
+  AC_SUBST([REPLACE_ERROR_AT_LINE])
+])
deleted file mode 120000 (symlink)
index 6d22aafa727cbd63fd23b1634e57a96e42e6ffa5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/euidaccess.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e3d828f6ca55986fdf9d50a6cc7d79da0897143e
--- /dev/null
@@ -0,0 +1,55 @@
+# euidaccess.m4 serial 17
+dnl Copyright (C) 2002-2024 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_NONREENTRANT_EUIDACCESS],
+[
+  AC_REQUIRE([gl_FUNC_EUIDACCESS])
+  AC_CHECK_DECLS([setregid])
+  AC_DEFINE([PREFER_NONREENTRANT_EUIDACCESS], [1],
+    [Define this if you prefer euidaccess to return the correct result
+     even if this would make it nonreentrant.  Define this only if your
+     entire application is safe even if the uid or gid might temporarily
+     change.  If your application uses signal handlers or threads it
+     is probably not safe.])
+])
+
+AC_DEFUN([gl_FUNC_EUIDACCESS],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
+  dnl Persuade glibc <unistd.h> to declare euidaccess().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_FUNCS([euidaccess])
+  if test $ac_cv_func_euidaccess = no; then
+    HAVE_EUIDACCESS=0
+  fi
+])
+
+# Prerequisites of lib/euidaccess.c.
+AC_DEFUN([gl_PREREQ_EUIDACCESS], [
+  dnl Prefer POSIX faccessat over non-standard euidaccess.
+  gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]])
+  dnl Try various other non-standard fallbacks.
+  AC_CHECK_HEADERS([libgen.h])
+  AC_FUNC_GETGROUPS
+
+  # Solaris 9 and 10 need -lgen to get the eaccess function.
+  # Save and restore LIBS so -lgen isn't added to it.  Otherwise, *all*
+  # programs in the package would end up linked with that potentially-shared
+  # library, inducing unnecessary run-time overhead.
+  EUIDACCESS_LIBGEN=
+  AC_SUBST([EUIDACCESS_LIBGEN])
+  gl_saved_libs=$LIBS
+    AC_SEARCH_LIBS([eaccess], [gen],
+                   [test "$ac_cv_search_eaccess" = "none required" ||
+                    EUIDACCESS_LIBGEN=$ac_cv_search_eaccess])
+    AC_CHECK_FUNCS([eaccess])
+  LIBS=$gl_saved_libs
+  # For backward compatibility.
+  LIB_EACCESS="$EUIDACCESS_LIBGEN"
+  AC_SUBST([LIB_EACCESS])
+])
deleted file mode 120000 (symlink)
index 419660b712d19d4165125117ffc7f14e4d538336..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/explicit_bzero.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3b5af5eea38652ae604276a7c6810334363021ae
--- /dev/null
@@ -0,0 +1,17 @@
+dnl Copyright 2017-2024 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_EXPLICIT_BZERO],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+
+  dnl Persuade glibc <string.h> to declare explicit_bzero.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_FUNCS_ONCE([explicit_bzero])
+  if test $ac_cv_func_explicit_bzero = no; then
+    HAVE_EXPLICIT_BZERO=0
+  fi
+])
deleted file mode 120000 (symlink)
index ae09a247603f9b3f85f21f2f0585f9e03033b382..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/exponentd.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0a4b1b6c3e76d56c02f42c729bd4246582a5f2c5
--- /dev/null
@@ -0,0 +1,116 @@
+# exponentd.m4 serial 4
+dnl Copyright (C) 2007-2008, 2010-2024 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_ONCE([gl_DOUBLE_EXPONENT_LOCATION],
+[
+  AC_CACHE_CHECK([where to find the exponent in a 'double'],
+    [gl_cv_cc_double_expbit0],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#define NWORDS \
+  ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { double value; unsigned int word[NWORDS]; } memory_double;
+static unsigned int ored_words[NWORDS];
+static unsigned int anded_words[NWORDS];
+static void add_to_ored_words (double x)
+{
+  memory_double m;
+  size_t i;
+  /* Clear it first, in case sizeof (double) < sizeof (memory_double).  */
+  memset (&m, 0, sizeof (memory_double));
+  m.value = x;
+  for (i = 0; i < NWORDS; i++)
+    {
+      ored_words[i] |= m.word[i];
+      anded_words[i] &= m.word[i];
+    }
+}
+int main ()
+{
+  size_t j;
+  FILE *fp = fopen ("conftest.out", "w");
+  if (fp == NULL)
+    return 1;
+  for (j = 0; j < NWORDS; j++)
+    anded_words[j] = ~ (unsigned int) 0;
+  add_to_ored_words (0.25);
+  add_to_ored_words (0.5);
+  add_to_ored_words (1.0);
+  add_to_ored_words (2.0);
+  add_to_ored_words (4.0);
+  /* Remove bits that are common (e.g. if representation of the first mantissa
+     bit is explicit).  */
+  for (j = 0; j < NWORDS; j++)
+    ored_words[j] &= ~anded_words[j];
+  /* Now find the nonzero word.  */
+  for (j = 0; j < NWORDS; j++)
+    if (ored_words[j] != 0)
+      break;
+  if (j < NWORDS)
+    {
+      size_t i;
+      for (i = j + 1; i < NWORDS; i++)
+        if (ored_words[i] != 0)
+          {
+            fprintf (fp, "unknown");
+            return (fclose (fp) != 0);
+          }
+      for (i = 0; ; i++)
+        if ((ored_words[j] >> i) & 1)
+          {
+            fprintf (fp, "word %d bit %d", (int) j, (int) i);
+            return (fclose (fp) != 0);
+          }
+    }
+  fprintf (fp, "unknown");
+  return (fclose (fp) != 0);
+}
+        ]])],
+        [gl_cv_cc_double_expbit0=`cat conftest.out`],
+        [gl_cv_cc_double_expbit0="unknown"],
+        [
+          dnl On ARM, there are two 'double' floating-point formats, used by
+          dnl different sets of instructions: The older FPA instructions assume
+          dnl that they are stored in big-endian word order, while the words
+          dnl (like integer types) are stored in little-endian byte order.
+          dnl The newer VFP instructions assume little-endian order
+          dnl consistently.
+          AC_EGREP_CPP([mixed_endianness], [
+#if defined arm || defined __arm || defined __arm__
+  mixed_endianness
+#endif
+            ],
+            [gl_cv_cc_double_expbit0="unknown"],
+            [
+              pushdef([AC_MSG_CHECKING],[:])dnl
+              pushdef([AC_MSG_RESULT],[:])dnl
+              pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl
+              AC_C_BIGENDIAN(
+                [gl_cv_cc_double_expbit0="word 0 bit 20"],
+                [gl_cv_cc_double_expbit0="word 1 bit 20"],
+                [gl_cv_cc_double_expbit0="unknown"])
+              popdef([AC_MSG_RESULT_UNQUOTED])dnl
+              popdef([AC_MSG_RESULT])dnl
+              popdef([AC_MSG_CHECKING])dnl
+            ])
+        ])
+      rm -f conftest.out
+    ])
+  case "$gl_cv_cc_double_expbit0" in
+    word*bit*)
+      word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
+      bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'`
+      AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word],
+        [Define as the word index where to find the exponent of 'double'.])
+      AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit],
+        [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 7d054f4d878b8ad2e158ee911de546449f3f3528..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/exponentf.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a46eee2914a89a2148f7a7969ebee4ab006b5eea
--- /dev/null
@@ -0,0 +1,92 @@
+# exponentf.m4 serial 3
+dnl Copyright (C) 2007-2008, 2010-2024 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_ONCE([gl_FLOAT_EXPONENT_LOCATION],
+[
+  AC_CACHE_CHECK([where to find the exponent in a 'float'],
+    [gl_cv_cc_float_expbit0],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#define NWORDS \
+  ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { float value; unsigned int word[NWORDS]; } memory_float;
+static unsigned int ored_words[NWORDS];
+static unsigned int anded_words[NWORDS];
+static void add_to_ored_words (float x)
+{
+  memory_float m;
+  size_t i;
+  /* Clear it first, in case
+     sizeof (float) < sizeof (memory_float).  */
+  memset (&m, 0, sizeof (memory_float));
+  m.value = x;
+  for (i = 0; i < NWORDS; i++)
+    {
+      ored_words[i] |= m.word[i];
+      anded_words[i] &= m.word[i];
+    }
+}
+int main ()
+{
+  size_t j;
+  FILE *fp = fopen ("conftest.out", "w");
+  if (fp == NULL)
+    return 1;
+  for (j = 0; j < NWORDS; j++)
+    anded_words[j] = ~ (unsigned int) 0;
+  add_to_ored_words (0.25f);
+  add_to_ored_words (0.5f);
+  add_to_ored_words (1.0f);
+  add_to_ored_words (2.0f);
+  add_to_ored_words (4.0f);
+  /* Remove bits that are common (e.g. if representation of the first mantissa
+     bit is explicit).  */
+  for (j = 0; j < NWORDS; j++)
+    ored_words[j] &= ~anded_words[j];
+  /* Now find the nonzero word.  */
+  for (j = 0; j < NWORDS; j++)
+    if (ored_words[j] != 0)
+      break;
+  if (j < NWORDS)
+    {
+      size_t i;
+      for (i = j + 1; i < NWORDS; i++)
+        if (ored_words[i] != 0)
+          {
+            fprintf (fp, "unknown");
+            return (fclose (fp) != 0);
+          }
+      for (i = 0; ; i++)
+        if ((ored_words[j] >> i) & 1)
+          {
+            fprintf (fp, "word %d bit %d", (int) j, (int) i);
+            return (fclose (fp) != 0);
+          }
+    }
+  fprintf (fp, "unknown");
+  return (fclose (fp) != 0);
+}
+        ]])],
+        [gl_cv_cc_float_expbit0=`cat conftest.out`],
+        [gl_cv_cc_float_expbit0="unknown"],
+        [gl_cv_cc_float_expbit0="word 0 bit 23"])
+      rm -f conftest.out
+    ])
+  case "$gl_cv_cc_float_expbit0" in
+    word*bit*)
+      word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
+      bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'`
+      AC_DEFINE_UNQUOTED([FLT_EXPBIT0_WORD], [$word],
+        [Define as the word index where to find the exponent of 'float'.])
+      AC_DEFINE_UNQUOTED([FLT_EXPBIT0_BIT], [$bit],
+        [Define as the bit index in the word where to find bit 0 of the exponent of 'float'.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 348cbcb087e9afc4f209f71e4f080422bf2b7010..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/exponentl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..06c8ae3f5cbdb81e0f13386d7b4e296796dc30f8
--- /dev/null
@@ -0,0 +1,113 @@
+# exponentl.m4 serial 7
+dnl Copyright (C) 2007-2024 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_ONCE([gl_LONG_DOUBLE_EXPONENT_LOCATION],
+[
+  AC_REQUIRE([gl_BIGENDIAN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([where to find the exponent in a 'long double'],
+    [gl_cv_cc_long_double_expbit0],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#define NWORDS \
+  ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { long double value; unsigned int word[NWORDS]; }
+        memory_long_double;
+static unsigned int ored_words[NWORDS];
+static unsigned int anded_words[NWORDS];
+static void add_to_ored_words (long double *x)
+{
+  memory_long_double m;
+  size_t i;
+  /* Clear it first, in case
+     sizeof (long double) < sizeof (memory_long_double).  */
+  memset (&m, 0, sizeof (memory_long_double));
+  m.value = *x;
+  for (i = 0; i < NWORDS; i++)
+    {
+      ored_words[i] |= m.word[i];
+      anded_words[i] &= m.word[i];
+    }
+}
+int main ()
+{
+  static long double samples[5] = { 0.25L, 0.5L, 1.0L, 2.0L, 4.0L };
+  size_t j;
+  FILE *fp = fopen ("conftest.out", "w");
+  if (fp == NULL)
+    return 1;
+  for (j = 0; j < NWORDS; j++)
+    anded_words[j] = ~ (unsigned int) 0;
+  for (j = 0; j < 5; j++)
+    add_to_ored_words (&samples[j]);
+  /* Remove bits that are common (e.g. if representation of the first mantissa
+     bit is explicit).  */
+  for (j = 0; j < NWORDS; j++)
+    ored_words[j] &= ~anded_words[j];
+  /* Now find the nonzero word.  */
+  for (j = 0; j < NWORDS; j++)
+    if (ored_words[j] != 0)
+      break;
+  if (j < NWORDS)
+    {
+      size_t i;
+      for (i = j + 1; i < NWORDS; i++)
+        if (ored_words[i] != 0)
+          {
+            fprintf (fp, "unknown");
+            return (fclose (fp) != 0);
+          }
+      for (i = 0; ; i++)
+        if ((ored_words[j] >> i) & 1)
+          {
+            fprintf (fp, "word %d bit %d", (int) j, (int) i);
+            return (fclose (fp) != 0);
+          }
+    }
+  fprintf (fp, "unknown");
+  return (fclose (fp) != 0);
+}
+        ]])],
+        [gl_cv_cc_long_double_expbit0=`cat conftest.out`],
+        [gl_cv_cc_long_double_expbit0="unknown"],
+        [
+          dnl When cross-compiling, in general we don't know. It depends on the
+          dnl ABI and compiler version. There are too many cases.
+          gl_cv_cc_long_double_expbit0="unknown"
+          case "$host_os" in
+            mingw* | windows*)
+              # On native Windows (little-endian), we know the result
+              # in two cases: mingw, MSVC.
+              AC_EGREP_CPP([Known], [
+#ifdef __MINGW32__
+ Known
+#endif
+                ], [gl_cv_cc_long_double_expbit0="word 2 bit 0"])
+              AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                ], [gl_cv_cc_long_double_expbit0="word 1 bit 20"])
+              ;;
+          esac
+        ])
+      rm -f conftest.out
+    ])
+  case "$gl_cv_cc_long_double_expbit0" in
+    word*bit*)
+      word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
+      bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'`
+      AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_WORD], [$word],
+        [Define as the word index where to find the exponent of 'long double'.])
+      AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_BIT], [$bit],
+        [Define as the bit index in the word where to find bit 0 of the exponent of 'long double'.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 26500230e0686b76162d0e83f00c889acaefc29f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/extensions.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6fc2e300e0ae409e59adaebc3e16e79eb252c66d
--- /dev/null
@@ -0,0 +1,232 @@
+# serial 23  -*- Autoconf -*-
+# Enable extensions on systems that normally disable them.
+
+# Copyright (C) 2003, 2006-2024 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 Define to empty for the benefit of Autoconf 2.69 and earlier, so that
+dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+.
+m4_ifndef([AC_CHECK_INCLUDES_DEFAULT],
+  [AC_DEFUN([AC_CHECK_INCLUDES_DEFAULT], [])])
+
+# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
+# Autoconf.  Perhaps we can remove this once we can assume Autoconf
+# is recent-enough everywhere, but since Autoconf mutates rapidly
+# enough in this area it's likely we'll need to redefine
+# AC_USE_SYSTEM_EXTENSIONS for quite some time.
+
+# If autoconf reports a warning
+#     warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# or  warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# the fix is
+#   1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
+#      but always AC_REQUIREd,
+#   2) to ensure that for each occurrence of
+#        AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+#      or
+#        AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+#      the corresponding gnulib module description has 'extensions' among
+#      its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
+#      invocation occurs in gl_EARLY, not in gl_INIT.
+
+m4_version_prereq([2.72], [], [
+
+# AC_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+# We unconditionally define as many of the known feature-enabling
+# as possible, reserving conditional behavior for macros that are
+# known to cause problems on some platforms (such as __EXTENSIONS__).
+AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
+[AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl
+AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+AC_BEFORE([$0], [AC_LINK_IFELSE])dnl
+AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
+AC_BEFORE([$0], [AC_CHECK_INCLUDES_DEFAULT])dnl
+dnl #undef in AH_VERBATIM gets replaced with #define by AC_DEFINE.
+dnl Use a different key than __EXTENSIONS__, as that name broke existing
+dnl configure.ac when using autoheader 2.62.
+dnl The macros below are in alphabetical order ignoring leading _ or __
+dnl prefixes.
+AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
+[/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable general extensions on macOS.  */
+#ifndef _DARWIN_C_SOURCE
+# undef _DARWIN_C_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable X/Open compliant socket functions that do not require linking
+   with -lxnet on HP-UX 11.11.  */
+#ifndef _HPUX_ALT_XOPEN_SOCKET_API
+# undef _HPUX_ALT_XOPEN_SOCKET_API
+#endif
+/* Identify the host operating system as Minix.
+   This macro does not affect the system headers' behavior.
+   A future release of Autoconf may stop defining this macro.  */
+#ifndef _MINIX
+# undef _MINIX
+#endif
+/* Enable general extensions on NetBSD.
+   Enable NetBSD compatibility extensions on Minix.  */
+#ifndef _NETBSD_SOURCE
+# undef _NETBSD_SOURCE
+#endif
+/* Enable OpenBSD compatibility extensions on NetBSD.
+   Oddly enough, this does nothing on OpenBSD.  */
+#ifndef _OPENBSD_SOURCE
+# undef _OPENBSD_SOURCE
+#endif
+/* Define to 1 if needed for POSIX-compatible behavior.  */
+#ifndef _POSIX_SOURCE
+# undef _POSIX_SOURCE
+#endif
+/* Define to 2 if needed for POSIX-compatible behavior.  */
+#ifndef _POSIX_1_SOURCE
+# undef _POSIX_1_SOURCE
+#endif
+/* Enable POSIX-compatible threading on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-5:2014.  */
+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-1:2014.  */
+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+# undef __STDC_WANT_IEC_60559_BFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-2:2015.  */
+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
+# undef __STDC_WANT_IEC_60559_DFP_EXT__
+#endif
+/* Enable extensions specified by C23 Annex F.  */
+#ifndef __STDC_WANT_IEC_60559_EXT__
+# undef __STDC_WANT_IEC_60559_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-4:2015.  */
+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
+#endif
+/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015.  */
+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
+# undef __STDC_WANT_IEC_60559_TYPES_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TR 24731-2:2010.  */
+#ifndef __STDC_WANT_LIB_EXT2__
+# undef __STDC_WANT_LIB_EXT2__
+#endif
+/* Enable extensions specified by ISO/IEC 24747:2009.  */
+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
+# undef __STDC_WANT_MATH_SPEC_FUNCS__
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable X/Open extensions.  Define to 500 only if necessary
+   to make mbstate_t available.  */
+#ifndef _XOPEN_SOURCE
+# undef _XOPEN_SOURCE
+#endif
+])dnl
+
+  AC_REQUIRE([AC_CHECK_INCLUDES_DEFAULT])dnl
+  _AC_CHECK_HEADER_ONCE([wchar.h])
+  _AC_CHECK_HEADER_ONCE([minix/config.h])
+
+dnl Defining __EXTENSIONS__ may break the system headers on some systems.
+dnl (FIXME: Which ones?)
+  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+    [ac_cv_safe_to_define___extensions__],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+#         define __EXTENSIONS__ 1
+          ]AC_INCLUDES_DEFAULT])],
+       [ac_cv_safe_to_define___extensions__=yes],
+       [ac_cv_safe_to_define___extensions__=no])])
+
+dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to
+dnl 500, regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1.
+dnl But defining _XOPEN_SOURCE may turn *off* extensions on platforms
+dnl not covered by turn-on-extensions macros (notably Dragonfly, Free,
+dnl and OpenBSD, which don't have any equivalent of _NETBSD_SOURCE) so
+dnl it should only be defined when necessary.
+  AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
+    [ac_cv_should_define__xopen_source],
+    [ac_cv_should_define__xopen_source=no
+    AS_IF([test $ac_cv_header_wchar_h = yes],
+      [AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[
+          #include <wchar.h>
+          mbstate_t x;]])],
+        [],
+        [AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([[
+            #define _XOPEN_SOURCE 500
+            #include <wchar.h>
+            mbstate_t x;]])],
+          [ac_cv_should_define__xopen_source=yes])])])])
+
+  AC_DEFINE([_ALL_SOURCE])
+  AC_DEFINE([_DARWIN_C_SOURCE])
+  AC_DEFINE([_GNU_SOURCE])
+  AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API])
+  AC_DEFINE([_NETBSD_SOURCE])
+  AC_DEFINE([_OPENBSD_SOURCE])
+  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+  AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__])
+  AC_DEFINE([__STDC_WANT_LIB_EXT2__])
+  AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__])
+  AC_DEFINE([_TANDEM_SOURCE])
+  AS_IF([test $ac_cv_header_minix_config_h = yes],
+    [MINIX=yes
+    AC_DEFINE([_MINIX])
+    AC_DEFINE([_POSIX_SOURCE])
+    AC_DEFINE([_POSIX_1_SOURCE], [2])],
+    [MINIX=])
+  AS_IF([test $ac_cv_safe_to_define___extensions__ = yes],
+    [AC_DEFINE([__EXTENSIONS__])])
+  AS_IF([test $ac_cv_should_define__xopen_source = yes],
+    [AC_DEFINE([_XOPEN_SOURCE], [500])])
+])# AC_USE_SYSTEM_EXTENSIONS
+])
+
+# gl_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
+[
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl On OpenBSD 6.8 with GCC, the include files contain a couple of
+  dnl definitions that are only activated with an explicit -D_ISOC11_SOURCE.
+  dnl That's because this version of GCC (4.2.1) supports the option
+  dnl '-std=gnu99' but not the option '-std=gnu11'.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    openbsd*)
+      AC_DEFINE([_ISOC11_SOURCE], [1],
+        [Define to enable the declarations of ISO C 11 types and functions.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 527bcf2b09c9c6b26da40c9ef52935b78c825218..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/extern-inline.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..680250ec77452f62208ad165d2bdd6f9ae2fe8d6
--- /dev/null
@@ -0,0 +1,132 @@
+dnl 'extern inline' a la ISO C99.
+
+dnl Copyright 2012-2024 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_EXTERN_INLINE],
+[
+  AC_CACHE_CHECK([whether ctype.h defines __header_inline],
+    [gl_cv_have___header_inline],
+    [AC_PREPROC_IFELSE(
+       [AC_LANG_SOURCE([[#include <ctype.h>
+                         #ifndef __header_inline
+                          #error "<ctype.h> does not define __header_inline"
+                         #endif
+                        ]])],
+       [gl_cv_have___header_inline=yes],
+       [gl_cv_have___header_inline=no])])
+  if test "$gl_cv_have___header_inline" = yes; then
+    AC_DEFINE([HAVE___HEADER_INLINE], [1],
+      [Define to 1 if ctype.h defines __header_inline.])
+  fi
+
+  AH_VERBATIM([HAVE___HEADER_INLINE_1],
+[/* Please see the Gnulib manual for how to use these macros.
+
+   Suppress extern inline with HP-UX cc, as it appears to be broken; see
+   <https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>.
+
+   Suppress extern inline with Sun C in standards-conformance mode, as it
+   mishandles inline functions that call each other.  E.g., for 'inline void f
+   (void) { } inline void g (void) { f (); }', c99 incorrectly complains
+   'reference to static identifier "f" in extern inline function'.
+   This bug was observed with Oracle Developer Studio 12.6
+   (Sun C 5.15 SunOS_sparc 2017/05/30).
+
+   Suppress extern inline (with or without __attribute__ ((__gnu_inline__)))
+   on configurations that mistakenly use 'static inline' to implement
+   functions or macros in standard C headers like <ctype.h>.  For example,
+   if isdigit is mistakenly implemented via a static inline function,
+   a program containing an extern inline function that calls isdigit
+   may not work since the C standard prohibits extern inline functions
+   from calling static functions (ISO C 99 section 6.7.4.(3).
+   This bug is known to occur on:
+
+     OS X 10.8 and earlier; see:
+     https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html
+
+     DragonFly; see
+     http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log
+
+     FreeBSD; see:
+     https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html
+
+   OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
+   for clang but remains for g++; see <https://trac.macports.org/ticket/41033>.
+   Assume DragonFly and FreeBSD will be similar.
+
+   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 __APPLE__ && defined __MACH__) \
+      || defined __DragonFly__ || defined __FreeBSD__) \
+     && (defined HAVE___HEADER_INLINE \
+         ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
+            && ! defined __clang__) \
+         : ((! defined _DONT_USE_CTYPE_INLINE_ \
+             && (defined __GNUC__ || defined __cplusplus)) \
+            || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
+                && defined __GNUC__ && ! defined __cplusplus))))
+# define _GL_EXTERN_INLINE_STDHEADER_BUG
+#endif
+#if ((__GNUC__ \
+      ? (defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
+         && !defined __PCC__) \
+      : (199901L <= __STDC_VERSION__ \
+         && !defined __HP_cc \
+         && !defined __PGI \
+         && !(defined __SUNPRO_C && __STDC__))) \
+     && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
+# define _GL_INLINE inline
+# define _GL_EXTERN_INLINE extern inline
+# define _GL_EXTERN_INLINE_IN_USE
+#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
+       && !defined __PCC__ \
+       && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
+# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
+   /* __gnu_inline__ suppresses a GCC 4.2 diagnostic.  */
+#  define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
+# else
+#  define _GL_INLINE extern inline
+# endif
+# define _GL_EXTERN_INLINE extern
+# define _GL_EXTERN_INLINE_IN_USE
+#else
+# define _GL_INLINE _GL_UNUSED static
+# define _GL_EXTERN_INLINE _GL_UNUSED static
+#endif
+
+/* In GCC 4.6 (inclusive) to 5.1 (exclusive),
+   suppress bogus "no previous prototype for 'FOO'"
+   and "no previous declaration for 'FOO'" diagnostics,
+   when FOO is an inline function in the header; see
+   <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
+   <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>.  */
+#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
+# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
+#  define _GL_INLINE_HEADER_CONST_PRAGMA
+# else
+#  define _GL_INLINE_HEADER_CONST_PRAGMA \
+     _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
+# endif
+# define _GL_INLINE_HEADER_BEGIN \
+    _Pragma ("GCC diagnostic push") \
+    _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
+    _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
+    _GL_INLINE_HEADER_CONST_PRAGMA
+# define _GL_INLINE_HEADER_END \
+    _Pragma ("GCC diagnostic pop")
+#else
+# define _GL_INLINE_HEADER_BEGIN
+# define _GL_INLINE_HEADER_END
+#endif])
+])
deleted file mode 120000 (symlink)
index 0b81ac4359a47dc9ea4c3f9e30719926fe2e1e23..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/faccessat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b8c058cef2826912532d94917436c064d57c5aaa
--- /dev/null
@@ -0,0 +1,37 @@
+# serial 12
+# See if we need to provide faccessat replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_FACCESSAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+
+  dnl Persuade glibc <unistd.h> to declare faccessat().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]])
+  if test $ac_cv_func_faccessat = no; then
+    HAVE_FACCESSAT=0
+    case "$gl_cv_onwards_func_faccessat" in
+      future*) REPLACE_FACCESSAT=1 ;;
+    esac
+  else
+    case $gl_cv_func_lstat_dereferences_slashed_symlink in
+      *yes) ;;
+      *)    REPLACE_FACCESSAT=1 ;;
+    esac
+  fi
+])
+
+# Prerequisites of lib/faccessat.c.
+AC_DEFUN([gl_PREREQ_FACCESSAT],
+[
+  AC_CHECK_FUNCS([access])
+])
deleted file mode 120000 (symlink)
index 8848c1021d9470d712d649dbf8fdea6370eb48f0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fchdir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fc0ed337f422232de8b9c971760637247d6da8bf
--- /dev/null
@@ -0,0 +1,76 @@
+# fchdir.m4 serial 32
+dnl Copyright (C) 2006-2024 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_REQUIRE([gl_DIRENT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_CHECK_DECLS_ONCE([fchdir])
+  if test $ac_cv_have_decl_fchdir = no; then
+    HAVE_DECL_FCHDIR=0
+  fi
+
+  AC_REQUIRE([gl_TEST_FCHDIR])
+  if test $HAVE_FCHDIR = 1; then
+    AC_REQUIRE([gl_DIRENT_DIR])
+    if test $DIR_HAS_FD_MEMBER = 0; then
+      dnl fchdir() should be replaced if dirfd() does not work.
+      REPLACE_FCHDIR=1
+    fi
+  fi
+
+  if test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1; then
+    AC_DEFINE([REPLACE_FCHDIR], [1],
+      [Define to 1 if gnulib's fchdir() replacement is used.])
+    dnl We must also replace anything that can manipulate a directory fd,
+    dnl to keep our bookkeeping up-to-date.  We don't have to replace
+    dnl fstatat, since no platform has fstatat but lacks fchdir.
+    AC_CACHE_CHECK([whether open can visit directories],
+      [gl_cv_func_open_directory_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <fcntl.h>
+            ]GL_MDA_DEFINES],
+            [[return open(".", O_RDONLY) < 0;]])],
+         [gl_cv_func_open_directory_works=yes],
+         [gl_cv_func_open_directory_works=no],
+         [case "$host_os" in
+                               # Guess yes on Linux systems.
+            linux-* | linux)   gl_cv_func_open_directory_works="guessing yes" ;;
+                               # Guess yes on systems that emulate the Linux system calls.
+            midipix*)          gl_cv_func_open_directory_works="guessing yes" ;;
+                               # Guess yes on glibc systems.
+            *-gnu* | gnu*)     gl_cv_func_open_directory_works="guessing yes" ;;
+                               # Guess no on native Windows.
+            mingw* | windows*) gl_cv_func_open_directory_works="guessing no" ;;
+                               # If we don't know, obey --enable-cross-guesses.
+            *)                 gl_cv_func_open_directory_works="$gl_cross_guess_normal" ;;
+          esac
+         ])])
+    case "$gl_cv_func_open_directory_works" in
+      *yes) ;;
+      *)
+        AC_DEFINE([REPLACE_OPEN_DIRECTORY], [1], [Define to 1 if open() should
+work around the inability to open a directory.])
+        ;;
+    esac
+  fi
+])
+
+# Determine whether to use the overrides in lib/fchdir.c.
+AC_DEFUN([gl_TEST_FCHDIR],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([fchdir])
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+])
+
+# Prerequisites of lib/fchdir.c.
+AC_DEFUN([gl_PREREQ_FCHDIR], [:])
deleted file mode 120000 (symlink)
index b404a6870f7210bcbd25b11caac63c0ea91b0ba1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fchmodat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9750572a5a3f38aeaacffca6ea7cdb39d595af68
--- /dev/null
@@ -0,0 +1,102 @@
+# fchmodat.m4 serial 8
+dnl Copyright (C) 2004-2024 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_FCHMODAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([fchmodat lchmod])
+  if test $ac_cv_func_fchmodat != yes; then
+    HAVE_FCHMODAT=0
+  else
+    AC_CACHE_CHECK(
+      [whether fchmodat works],
+      [gl_cv_func_fchmodat_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [
+              AC_INCLUDES_DEFAULT[
+              #include <fcntl.h>
+              #ifndef S_IRUSR
+               #define S_IRUSR 0400
+              #endif
+              #ifndef S_IWUSR
+               #define S_IWUSR 0200
+              #endif
+              #ifndef S_IRWXU
+               #define S_IRWXU 0700
+              #endif
+              #ifndef S_IRWXG
+               #define S_IRWXG 0070
+              #endif
+              #ifndef S_IRWXO
+               #define S_IRWXO 0007
+              #endif
+            ]GL_MDA_DEFINES],
+            [[
+              int permissive = S_IRWXU | S_IRWXG | S_IRWXO;
+              int desired = S_IRUSR | S_IWUSR;
+              int result = 0;
+              #define file "conftest.fchmodat"
+              struct stat st;
+              if (creat (file, permissive) < 0)
+                return 1;
+              /* Test whether fchmodat rejects a trailing slash on a non-directory.
+                 This test fails on AIX 7.2.  */
+              if (fchmodat (AT_FDCWD, file "/", desired, 0) == 0)
+                result |= 2;
+              /* Test whether fchmodat+AT_SYMLINK_NOFOLLOW works on non-symlinks.
+                 This test fails on GNU/Linux with glibc 2.31 (but not on
+                 GNU/kFreeBSD nor GNU/Hurd) and Cygwin 2.9.  */
+              if (fchmodat (AT_FDCWD, file, desired, AT_SYMLINK_NOFOLLOW) != 0)
+                result |= 4;
+              if (stat (file, &st) != 0)
+                return 1;
+              if ((st.st_mode & permissive) != desired)
+                result |= 4;
+              return result;
+            ]])],
+         [gl_cv_func_fchmodat_works=yes],
+         [case $? in
+            2) gl_cv_func_fchmodat_works='nearly' ;;
+            *) gl_cv_func_fchmodat_works=no ;;
+          esac
+         ],
+         [case "$host_os" in
+                                  # Guess no on Linux with glibc and Cygwin.
+            linux-gnu* | cygwin*) gl_cv_func_fchmodat_works="guessing no" ;;
+                                  # Guess 'nearly' on AIX.
+            aix*)                 gl_cv_func_fchmodat_works="guessing nearly" ;;
+                                  # If we don't know, obey --enable-cross-guesses.
+            *)                    gl_cv_func_fchmodat_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+       rm -f conftest.fchmodat])
+    case "$gl_cv_func_fchmodat_works" in
+      *yes) ;;
+      *nearly)
+        AC_DEFINE([HAVE_NEARLY_WORKING_FCHMODAT], [1],
+          [Define to 1 if fchmodat works, except for the trailing slash handling.])
+        REPLACE_FCHMODAT=1
+        ;;
+      *)
+        AC_DEFINE([NEED_FCHMODAT_NONSYMLINK_FIX], [1],
+          [Define to 1 if fchmodat+AT_SYMLINK_NOFOLLOW does not work right on non-symlinks.])
+        REPLACE_FCHMODAT=1
+        ;;
+    esac
+  fi
+])
+
+# Prerequisites of lib/fchmodat.c.
+AC_DEFUN([gl_PREREQ_FCHMODAT],
+[
+  gl_CHECK_FUNCS_ANDROID([readlinkat], [[#include <unistd.h>]])
+  :
+])
deleted file mode 120000 (symlink)
index fbbd0777ec4bac9a01cca4dedcd2362fab588aca..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fchownat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..591993479e2bf36afa404da06f1f54b10cc57cdb
--- /dev/null
@@ -0,0 +1,111 @@
+# fchownat.m4 serial 7
+dnl Copyright (C) 2004-2024 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.
+
+# 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 if the fchownat function, like chown, has the trailing slash bug,
+# use the replacement function.
+# Also use the replacement function if fchownat is simply not available.
+AC_DEFUN([gl_FUNC_FCHOWNAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_FUNC_CHOWN])
+  AC_CHECK_FUNC([fchownat],
+    [gl_FUNC_FCHOWNAT_DEREF_BUG(
+       [REPLACE_FCHOWNAT=1
+        AC_DEFINE([FCHOWNAT_NOFOLLOW_BUG], [1],
+                  [Define to 1 if your platform has fchownat, but it cannot
+                   perform lchown tasks.])
+       ])
+     gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG(
+       [REPLACE_FCHOWNAT=1
+        AC_DEFINE([FCHOWNAT_EMPTY_FILENAME_BUG], [1],
+                  [Define to 1 if your platform has fchownat, but it does
+                   not reject an empty file name.])
+       ])
+     if test $REPLACE_CHOWN = 1; then
+       REPLACE_FCHOWNAT=1
+     fi],
+    [HAVE_FCHOWNAT=0])
+])
+
+# gl_FUNC_FCHOWNAT_DEREF_BUG([ACTION-IF-BUGGY[, ACTION-IF-NOT_BUGGY]])
+AC_DEFUN([gl_FUNC_FCHOWNAT_DEREF_BUG],
+[
+  dnl Persuade glibc's <unistd.h> to declare fchownat().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  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>
+/* Android 4.3 declares fchownat() in <sys/stat.h> instead.  */
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+int
+main ()
+{
+  return (fchownat (AT_FDCWD, "$gl_dangle", (uid_t)(-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="$gl_cross_guess_normal"])
+  ])
+  AS_IF([test "$gl_cv_func_fchownat_nofollow_works" != yes], [$1], [$2])
+])
+
+# gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG([ACTION-IF-BUGGY[, ACTION-IF-NOT_BUGGY]])
+AC_DEFUN([gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG],
+[
+  dnl Persuade glibc's <unistd.h> to declare fchownat().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_CACHE_CHECK([whether fchownat works with an empty file name],
+    [gl_cv_func_fchownat_empty_filename_works],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <unistd.h>
+            #include <fcntl.h>
+            /* Android 4.3 declares fchownat() in <sys/stat.h> instead.  */
+            #include <sys/stat.h>
+          ]GL_MDA_DEFINES],
+          [[int fd;
+            int ret;
+            if (mkdir ("conftestdir", 0700) < 0)
+              return 2;
+            fd = open ("conftestdir", O_RDONLY);
+            if (fd < 0)
+              return 3;
+            ret = fchownat (fd, "", (uid_t)(-1), (gid_t)(-1), 0);
+            close (fd);
+            rmdir ("conftestdir");
+            return ret == 0;
+          ]])],
+       [gl_cv_func_fchownat_empty_filename_works=yes],
+       [gl_cv_func_fchownat_empty_filename_works=no],
+       [gl_cv_func_fchownat_empty_filename_works="$gl_cross_guess_normal"])
+    ])
+  AS_IF([test "$gl_cv_func_fchownat_empty_filename_works" != yes], [$1], [$2])
+])
deleted file mode 120000 (symlink)
index 51d4b710e6948e3bf2a87e7255688fc4c3237ca7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fclose.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9547f03e8ef82a539ed0a872be117ebbbc4e1451
--- /dev/null
@@ -0,0 +1,98 @@
+# fclose.m4 serial 12
+dnl Copyright (C) 2008-2024 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_ONCE([gl_FUNC_FCLOSE],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  gl_FUNC_FFLUSH_STDIN
+  case "$gl_cv_func_fflush_stdin" in
+    *yes) ;;
+    *) REPLACE_FCLOSE=1 ;;
+  esac
+
+  AC_REQUIRE([gl_FUNC_CLOSE])
+  if test $REPLACE_CLOSE = 1; then
+    REPLACE_FCLOSE=1
+  fi
+
+  case "$host_os" in
+    openedition) REPLACE_FCLOSE=1 ;;
+  esac
+
+  if test $REPLACE_FCLOSE = 0; then
+    gl_FUNC_FCLOSE_STDIN
+    case "$gl_cv_func_fclose_stdin" in
+      *yes) ;;
+      *) REPLACE_FCLOSE=1 ;;
+    esac
+  fi
+])
+
+dnl Determine whether fclose works on input streams.
+dnl Sets gl_cv_func_fclose_stdin.
+
+AC_DEFUN([gl_FUNC_FCLOSE_STDIN],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CACHE_CHECK([whether fclose works on input streams],
+    [gl_cv_func_fclose_stdin],
+    [echo hello world > conftest.txt
+     AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <fcntl.h>
+            #include <stdio.h>
+            #if HAVE_UNISTD_H
+            # include <unistd.h>
+            #else /* on Windows with MSVC */
+            # include <io.h>
+            #endif
+           ]GL_MDA_DEFINES],
+          [[int fd;
+            int fd2;
+            FILE *fp;
+            fd = open ("conftest.txt", O_RDONLY);
+            if (fd < 0)
+              return 1;
+            if (lseek (fd, 1, SEEK_SET) != 1)
+              return 2;
+            fd2 = dup (fd);
+            if (fd2 < 0)
+              return 3;
+            fp = fdopen (fd2, "r");
+            if (fp == NULL)
+              return 4;
+            if (fgetc (fp) != 'e')
+              { fclose (fp); return 5; }
+            /* This fclose() call should reposition the underlying file
+               descriptor.  */
+            if (fclose (fp) != 0)
+              return 6;
+            if (lseek (fd2, 0, SEEK_CUR) != -1) /* should fail with EBADF */
+              return 7;
+            /* Verify the file position.  */
+            if (lseek (fd, 0, SEEK_CUR) != 2)
+              return 8;
+            return 0;
+          ]])],
+       [gl_cv_func_fclose_stdin=yes],
+       [gl_cv_func_fclose_stdin=no],
+       [case "$host_os" in
+                              # Guess no on glibc systems.
+          *-gnu* | gnu*)      gl_cv_func_fclose_stdin="guessing no" ;;
+                              # Guess yes on musl systems.
+          *-musl* | midipix*) gl_cv_func_fclose_stdin="guessing yes" ;;
+                              # Guess no on native Windows.
+          mingw* | windows*)  gl_cv_func_fclose_stdin="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+          *)                  gl_cv_func_fclose_stdin="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm conftest.txt
+    ])
+])
deleted file mode 120000 (symlink)
index 74f4d3fed92b8f89497f26be7ae29a3a925e94c8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fcntl-o.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..49ab34d8e2144ea22249ef7f3be4cc536259bb6e
--- /dev/null
@@ -0,0 +1,140 @@
+# fcntl-o.m4 serial 8
+dnl Copyright (C) 2006, 2009-2024 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_PREREQ([2.60])
+
+# Test whether the flags O_NOATIME and O_NOFOLLOW actually work.
+# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise.
+# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise.
+AC_DEFUN([gl_FCNTL_O_FLAGS],
+[
+  dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CHECK_FUNCS_ONCE([symlink])
+  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>
+           #if HAVE_UNISTD_H
+           # include <unistd.h>
+           #else /* on Windows with MSVC */
+           # include <io.h>
+           # include <stdlib.h>
+           # defined sleep(n) _sleep ((n) * 1000)
+           #endif
+           #include <fcntl.h>
+           ]GL_MDA_DEFINES[
+           #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 result = !constants;
+            #if HAVE_SYMLINK
+            {
+              static char const sym[] = "conftest.sym";
+              if (symlink ("/dev/null", sym) != 0)
+                result |= 2;
+              else
+                {
+                  int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0);
+                  if (fd >= 0)
+                    {
+                      close (fd);
+                      result |= 4;
+                    }
+                }
+              if (unlink (sym) != 0 || symlink (".", sym) != 0)
+                result |= 2;
+              else
+                {
+                  int fd = open (sym, O_RDONLY | O_NOFOLLOW);
+                  if (fd >= 0)
+                    {
+                      close (fd);
+                      result |= 4;
+                    }
+                }
+              unlink (sym);
+            }
+            #endif
+            {
+              static char const file[] = "confdefs.h";
+              int fd = open (file, O_RDONLY | O_NOATIME);
+              if (fd < 0)
+                result |= 8;
+              else
+                {
+                  struct stat st0;
+                  if (fstat (fd, &st0) != 0)
+                    result |= 16;
+                  else
+                    {
+                      char c;
+                      sleep (1);
+                      if (read (fd, &c, 1) != 1)
+                        result |= 24;
+                      else
+                        {
+                          if (close (fd) != 0)
+                            result |= 32;
+                          else
+                            {
+                              struct stat st1;
+                              if (stat (file, &st1) != 0)
+                                result |= 40;
+                              else
+                                if (st0.st_atime != st1.st_atime)
+                                  result |= 64;
+                            }
+                        }
+                    }
+                }
+            }
+            return result;]])],
+       [gl_cv_header_working_fcntl_h=yes],
+       [case $? in #(
+        4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
+        64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
+        68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
+         *) gl_cv_header_working_fcntl_h='no';;
+        esac],
+       [case "$host_os" in
+                             # Guess 'no' on native Windows.
+          mingw* | windows*) gl_cv_header_working_fcntl_h='no' ;;
+          *)                 gl_cv_header_working_fcntl_h=cross-compiling ;;
+        esac
+       ])
+    ])
+
+  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.])
+])
deleted file mode 120000 (symlink)
index 839c2e4a93dcb6c4781b87e20dec614ffad26301..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fcntl-safer.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7426fba6d4c936cd8e6f4d15b51565740378bdb9
--- /dev/null
@@ -0,0 +1,16 @@
+#serial 9
+dnl Copyright (C) 2005-2007, 2009-2024 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_FCNTL_SAFER],
+[
+  dnl Prerequisites of lib/open-safer.c.
+  AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
+])
+
+AC_DEFUN([gl_OPENAT_SAFER],
+[
+  AC_REQUIRE([gl_FCNTL_SAFER])
+])
deleted file mode 120000 (symlink)
index 649b97b71c7074c1c1da222ba68f918e1f2da058..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fcntl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..02b93f8357cda19ec7aeb4e3bd8c9cd968276e7c
--- /dev/null
@@ -0,0 +1,151 @@
+# fcntl.m4 serial 11
+dnl Copyright (C) 2009-2024 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.
+
+# For now, this module ensures that fcntl()
+# - supports F_DUPFD correctly
+# - supports or emulates F_DUPFD_CLOEXEC
+# - supports F_GETFD
+# Still to be ported to mingw:
+# - F_SETFD
+# - F_GETFL, F_SETFL
+# - F_GETOWN, F_SETOWN
+# - F_GETLK, F_SETLK, F_SETLKW
+AC_DEFUN([gl_FUNC_FCNTL],
+[
+  dnl Persuade glibc to expose F_DUPFD_CLOEXEC.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS_ONCE([fcntl])
+  if test $ac_cv_func_fcntl = no; then
+    gl_REPLACE_FCNTL
+  else
+    dnl cygwin 1.5.x F_DUPFD has wrong errno, and allows negative target
+    dnl haiku alpha 2 F_DUPFD has wrong errno
+    AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly],
+      [gl_cv_func_fcntl_f_dupfd_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <errno.h>
+              #include <fcntl.h>
+              #include <limits.h>
+              #include <sys/resource.h>
+              #include <unistd.h>
+              ]GL_MDA_DEFINES[
+              #ifndef RLIM_SAVED_CUR
+              # define RLIM_SAVED_CUR RLIM_INFINITY
+              #endif
+              #ifndef RLIM_SAVED_MAX
+              # define RLIM_SAVED_MAX RLIM_INFINITY
+              #endif
+            ]],
+            [[int result = 0;
+              int bad_fd = INT_MAX;
+              struct rlimit rlim;
+              if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
+                  && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX
+                  && rlim.rlim_cur != RLIM_INFINITY
+                  && rlim.rlim_cur != RLIM_SAVED_MAX
+                  && rlim.rlim_cur != RLIM_SAVED_CUR)
+                bad_fd = rlim.rlim_cur;
+              if (fcntl (0, F_DUPFD, -1) != -1) result |= 1;
+              if (errno != EINVAL) result |= 2;
+              if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4;
+              if (errno != EINVAL) result |= 8;
+              /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */
+              {
+                int fd;
+                fd = open (".", O_RDONLY);
+                if (fd == -1)
+                  result |= 16;
+                else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1)
+                  result |= 32;
+
+                close (fd);
+              }
+              return result;]])],
+         [gl_cv_func_fcntl_f_dupfd_works=yes],
+         [gl_cv_func_fcntl_f_dupfd_works=no],
+         [case $host_os in
+            aix* | cygwin* | haiku*)
+               gl_cv_func_fcntl_f_dupfd_works="guessing no" ;;
+            *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;;
+          esac])])
+    case $gl_cv_func_fcntl_f_dupfd_works in
+      *yes) ;;
+      *) gl_REPLACE_FCNTL
+        AC_DEFINE([FCNTL_DUPFD_BUGGY], [1], [Define this to 1 if F_DUPFD
+          behavior does not match POSIX]) ;;
+    esac
+
+    dnl Many systems lack F_DUPFD_CLOEXEC.
+    dnl NetBSD 9.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD.
+    AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC],
+      [gl_cv_func_fcntl_f_dupfd_cloexec],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE(
+            [[#include <fcntl.h>
+              #include <unistd.h>
+              int main (int argc, char *argv[])
+              {
+                if (argc == 1)
+                  /* parent process */
+                  {
+                    if (fcntl (1, F_DUPFD_CLOEXEC, 10) < 0)
+                      return 1;
+                    return execl ("./conftest", "./conftest", "child", NULL);
+                  }
+                else
+                  /* child process */
+                  return (fcntl (10, F_GETFL) < 0 ? 0 : 42);
+              }
+            ]])
+         ],
+         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef __linux__
+/* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace
+   it to support the semantics on older kernels that failed with EINVAL.  */
+choke me
+#endif
+           ]])],
+           [gl_cv_func_fcntl_f_dupfd_cloexec=yes],
+           [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"])
+         ],
+         [gl_cv_func_fcntl_f_dupfd_cloexec=no],
+         [case "$host_os" in
+                     # Guess no on NetBSD.
+            netbsd*) gl_cv_func_fcntl_f_dupfd_cloexec="guessing no" ;;
+            *)       gl_cv_func_fcntl_f_dupfd_cloexec="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_fcntl_f_dupfd_cloexec" in
+      *yes) ;;
+      *)    gl_REPLACE_FCNTL
+            dnl No witness macro needed for this bug.
+            ;;
+    esac
+  fi
+  dnl Replace fcntl() for supporting the gnulib-defined fchdir() function,
+  dnl to keep fchdir's bookkeeping up-to-date.
+  m4_ifdef([gl_FUNC_FCHDIR], [
+    gl_TEST_FCHDIR
+    if test $HAVE_FCHDIR = 0; then
+      gl_REPLACE_FCNTL
+    fi
+  ])
+])
+
+AC_DEFUN([gl_REPLACE_FCNTL],
+[
+  AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([fcntl])
+  if test $ac_cv_func_fcntl = no; then
+    HAVE_FCNTL=0
+  else
+    REPLACE_FCNTL=1
+  fi
+])
deleted file mode 120000 (symlink)
index 39b428fa8b0044135383d50f3714fc000edd349f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fcntl_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ba4eb4494dbb5213015bdae7f301678c596ba521
--- /dev/null
@@ -0,0 +1,70 @@
+# serial 20
+# Configure fcntl.h.
+dnl Copyright (C) 2006-2007, 2009-2024 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_ONCE([gl_FCNTL_H],
+[
+  AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+  AC_REQUIRE([gl_FCNTL_O_FLAGS])
+  gl_NEXT_HEADERS([fcntl.h])
+
+  dnl Ensure the type pid_t gets defined.
+  AC_REQUIRE([AC_TYPE_PID_T])
+
+  dnl Ensure the type mode_t gets defined.
+  AC_REQUIRE([AC_TYPE_MODE_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, if it is not common
+  dnl enough to be declared everywhere.
+  gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
+    ]], [fcntl openat])
+])
+
+# gl_FCNTL_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_FCNTL_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_FCNTL_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_FCNTL=1;          AC_SUBST([HAVE_FCNTL])
+  HAVE_OPENAT=1;         AC_SUBST([HAVE_OPENAT])
+  REPLACE_CREAT=0;       AC_SUBST([REPLACE_CREAT])
+  REPLACE_FCNTL=0;       AC_SUBST([REPLACE_FCNTL])
+  REPLACE_OPEN=0;        AC_SUBST([REPLACE_OPEN])
+  REPLACE_OPENAT=0;      AC_SUBST([REPLACE_OPENAT])
+])
deleted file mode 120000 (symlink)
index 744b7e24d7c8c0ec56bb47eed506b610d0d76af8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fdatasync.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..15343799c974ae7914c5c320964555660125fe1a
--- /dev/null
@@ -0,0 +1,57 @@
+# fdatasync.m4 serial 9
+dnl Copyright (C) 2008-2024 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_FDATASYNC],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl Using AC_CHECK_FUNCS_ONCE would break our subsequent AC_SEARCH_LIBS
+  AC_CHECK_DECLS_ONCE([fdatasync])
+  FDATASYNC_LIB=
+  AC_SUBST([FDATASYNC_LIB])
+
+  if test $ac_cv_have_decl_fdatasync = no; then
+    HAVE_DECL_FDATASYNC=0
+    dnl Mac OS X 10.7 has fdatasync but does not declare it.
+    dnl Likewise Android with API level < 9.
+    gl_CHECK_FUNCS_ANDROID([fdatasync], [[#include <unistd.h>]])
+    if test $ac_cv_func_fdatasync = no; then
+      HAVE_FDATASYNC=0
+      case "$gl_cv_onwards_func_fdatasync" in
+        future*) REPLACE_FDATASYNC=1 ;;
+      esac
+    fi
+  else
+    case "$host_os" in
+      solaris*)
+        dnl Solaris <= 2.6 has fdatasync() in libposix4.
+        dnl Solaris 7..9 has it in librt.
+        dnl Solaris 10 sometimes has it in librt <https://bugs.gnu.org/21059>.
+        gl_saved_libs=$LIBS
+        AC_SEARCH_LIBS([fdatasync], [rt posix4],
+          [test "$ac_cv_search_fdatasync" = "none required" ||
+           FDATASYNC_LIB=$ac_cv_search_fdatasync])
+        LIBS=$gl_saved_libs
+        ;;
+      *)
+        dnl Android 4.3 does not have fdatasync but declares it, and future
+        dnl Android versions have it.
+        gl_CHECK_FUNCS_ANDROID([fdatasync], [[#include <unistd.h>]])
+        if test $ac_cv_func_fdatasync = no; then
+          HAVE_FDATASYNC=0
+          case "$gl_cv_onwards_func_fdatasync" in
+            future*) REPLACE_FDATASYNC=1 ;;
+          esac
+        fi
+        ;;
+    esac
+  fi
+
+  dnl For backward compatibility.
+  LIB_FDATASYNC="$FDATASYNC_LIB"
+  AC_SUBST([LIB_FDATASYNC])
+])
deleted file mode 120000 (symlink)
index 432a33cac89908823b7a4da2c51baac37710f0e8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fdopen.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5b94047e6ca3cf69792573837bb51f7aeb1d2e48
--- /dev/null
@@ -0,0 +1,51 @@
+# fdopen.m4 serial 6
+dnl Copyright (C) 2011-2024 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_FDOPEN],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_FDOPEN=1
+    fi
+  ])
+  if test $REPLACE_FDOPEN = 0; then
+    dnl Test whether fdopen() sets errno when it fails due to a bad fd argument.
+    AC_CACHE_CHECK([whether fdopen sets errno], [gl_cv_func_fdopen_works],
+      [
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <errno.h>
+]GL_MDA_DEFINES[
+int
+main (void)
+{
+  FILE *fp;
+  errno = 0;
+  fp = fdopen (-1, "r");
+  if (fp == NULL && errno == 0)
+    return 1;
+  return 0;
+}]])],
+          [gl_cv_func_fdopen_works=yes],
+          [gl_cv_func_fdopen_works=no],
+          [case "$host_os" in
+             mingw* | windows*) gl_cv_func_fdopen_works="guessing no" ;;
+             *)                 gl_cv_func_fdopen_works="guessing yes" ;;
+           esac
+          ])
+      ])
+    case "$gl_cv_func_fdopen_works" in
+      *no) REPLACE_FDOPEN=1 ;;
+    esac
+  fi
+])
+
+dnl Prerequisites of lib/fdopen.c.
+AC_DEFUN([gl_PREREQ_FDOPEN], [])
deleted file mode 120000 (symlink)
index d4d0be837ba48cbf9747763b62d452ddcdc64ed9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fdopendir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bf361ff154c1264e86f816b126fbbae2acc2f65c
--- /dev/null
@@ -0,0 +1,67 @@
+# serial 15
+# See if we need to provide fdopendir.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_FDOPENDIR],
+[
+  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl FreeBSD 7.3 has the function, but failed to declare it.
+  AC_CHECK_DECLS([fdopendir], [], [HAVE_DECL_FDOPENDIR=0], [[
+#include <dirent.h>
+    ]])
+  AC_CHECK_FUNCS_ONCE([fdopendir])
+  if test $ac_cv_func_fdopendir = no; then
+    HAVE_FDOPENDIR=0
+  else
+    AC_CACHE_CHECK([whether fdopendir works],
+      [gl_cv_func_fdopendir_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[
+#include <dirent.h>
+#include <fcntl.h>
+#include <unistd.h>
+]GL_MDA_DEFINES[
+#if !HAVE_DECL_FDOPENDIR
+extern
+# ifdef __cplusplus
+"C"
+# endif
+DIR *fdopendir (int);
+#endif
+]],
+            [[int result = 0;
+              int fd = open ("conftest.c", O_RDONLY);
+              if (fd < 0) result |= 1;
+              if (fdopendir (fd)) result |= 2;
+              if (close (fd)) result |= 4;
+              return result;
+            ]])],
+         [gl_cv_func_fdopendir_works=yes],
+         [gl_cv_func_fdopendir_works=no],
+         [case "$host_os" in
+                                # Guess yes on glibc systems.
+            *-gnu*)             gl_cv_func_fdopendir_works="guessing yes" ;;
+                                # Guess yes on musl systems.
+            *-musl* | midipix*) gl_cv_func_fdopendir_works="guessing yes" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+            *)                  gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;;
+          esac
+         ])])
+    case "$gl_cv_func_fdopendir_works" in
+      *yes) ;;
+      *)
+        REPLACE_FDOPENDIR=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 51011fd8574e4768c84918590ed90a80df8ed46e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fflush.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..85cf3be210d0e49fa9ebefa9223f1685d6aa562b
--- /dev/null
@@ -0,0 +1,100 @@
+# fflush.m4 serial 19
+
+# Copyright (C) 2007-2024 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 Eric Blake
+
+dnl Find out how to obey POSIX semantics of fflush(stdin) discarding
+dnl unread input on seekable streams, rather than C99 undefined semantics.
+
+AC_DEFUN([gl_FUNC_FFLUSH],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  gl_FUNC_FFLUSH_STDIN
+  case "$gl_cv_func_fflush_stdin" in
+    *yes) ;;
+    *) REPLACE_FFLUSH=1 ;;
+  esac
+])
+
+dnl Determine whether fflush works on input streams.
+dnl Sets gl_cv_func_fflush_stdin.
+
+AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CACHE_CHECK([whether fflush works on input streams],
+    [gl_cv_func_fflush_stdin],
+    [echo hello world > conftest.txt
+     AC_RUN_IFELSE([AC_LANG_PROGRAM(
+       [[
+#include <stdio.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#else /* on Windows with MSVC */
+# include <io.h>
+#endif
+       ]GL_MDA_DEFINES],
+       [[FILE *f = fopen ("conftest.txt", "r");
+         char buffer[10];
+         int fd;
+         int c;
+         if (f == NULL)
+           return 1;
+         fd = fileno (f);
+         if (fd < 0 || fread (buffer, 1, 5, f) != 5)
+           { fclose (f); return 2; }
+         /* For deterministic results, ensure f read a bigger buffer.  */
+         if (lseek (fd, 0, SEEK_CUR) == 5)
+           { fclose (f); return 3; }
+         /* POSIX requires fflush-fseek to set file offset of fd.  This fails
+            on BSD systems and on mingw.  */
+         if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0)
+           { fclose (f); return 4; }
+         if (lseek (fd, 0, SEEK_CUR) != 5)
+           { fclose (f); return 5; }
+         /* Verify behaviour of fflush after ungetc. See
+            <https://www.opengroup.org/austin/aardvark/latest/xshbug3.txt>  */
+         /* Verify behaviour of fflush after a backup ungetc.  This fails on
+            mingw.  */
+         c = fgetc (f);
+         ungetc (c, f);
+         fflush (f);
+         if (fgetc (f) != c)
+           { fclose (f); return 6; }
+         /* Verify behaviour of fflush after a non-backup ungetc.  This fails
+            on glibc 2.8 and on BSD systems.  */
+         c = fgetc (f);
+         ungetc ('@', f);
+         fflush (f);
+         if (fgetc (f) != c)
+           { fclose (f); return 7; }
+         fclose (f);
+         return 0;
+       ]])],
+       [gl_cv_func_fflush_stdin=yes],
+       [gl_cv_func_fflush_stdin=no],
+       [case "$host_os" in
+                             # Guess no on native Windows.
+          mingw* | windows*) gl_cv_func_fflush_stdin="guessing no" ;;
+          *)                 gl_cv_func_fflush_stdin=cross ;;
+        esac
+       ])
+     rm conftest.txt
+    ])
+  case "$gl_cv_func_fflush_stdin" in
+    *yes) gl_func_fflush_stdin=1 ;;
+    *no)  gl_func_fflush_stdin=0 ;;
+    *)    gl_func_fflush_stdin='(-1)' ;;
+  esac
+  AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin],
+    [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008,
+     0 if fflush is known to not work, -1 if unknown.])
+])
+
+# Prerequisites of lib/fflush.c.
+AC_DEFUN([gl_PREREQ_FFLUSH], [:])
deleted file mode 120000 (symlink)
index cfee7d2599b13072b9b03b2cf5ee8879ba5174a3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fileblocks.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f02808e0010761c41df2ac7eaa5529aa73ddcd8a
--- /dev/null
@@ -0,0 +1,23 @@
+# fileblocks.m4 serial 6
+dnl Copyright (C) 2002, 2005-2006, 2009-2024 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_FILEBLOCKS],
+[
+  m4_pushdef([AC_LIBOBJ], [:])
+  dnl Note: AC_STRUCT_ST_BLOCKS does AC_LIBOBJ([fileblocks]).
+  AC_STRUCT_ST_BLOCKS
+  m4_popdef([AC_LIBOBJ])
+  dnl The stat-size module depends on this one and also assumes that
+  dnl HAVE_STRUCT_STAT_ST_BLOCKS is correctly defined.  So if you
+  dnl remove the call above, please make sure that this does not
+  dnl introduce a bug into lib/stat-size.h.
+])
+
+# Prerequisites of lib/fileblocks.c.
+AC_DEFUN([gl_PREREQ_FILEBLOCKS], [
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
+  :
+])
deleted file mode 120000 (symlink)
index 10e1583c0ec2a6c830042a192fb3a02d9383382c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/filemode.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b72317281b3fd383714bebd5c8495e1329d3b668
--- /dev/null
@@ -0,0 +1,10 @@
+# filemode.m4 serial 9
+dnl Copyright (C) 2002, 2005-2006, 2009-2024 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_FILEMODE],
+[
+  AC_CHECK_DECLS_ONCE([strmode])
+])
deleted file mode 120000 (symlink)
index 89b54e02930f9704bdbd00ad47476a1c53da4d27..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/filenamecat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7feb7f8cc89d45b631afacce8293d70f01ccf455
--- /dev/null
@@ -0,0 +1,16 @@
+# filenamecat.m4 serial 12
+dnl Copyright (C) 2002-2006, 2009-2024 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_FILE_NAME_CONCAT],
+[
+  AC_REQUIRE([gl_FILE_NAME_CONCAT_LGPL])
+])
+
+AC_DEFUN([gl_FILE_NAME_CONCAT_LGPL],
+[
+  dnl Prerequisites of lib/filenamecat-lgpl.c.
+  gl_CHECK_FUNCS_ANDROID([mempcpy], [[#include <string.h>]])
+])
deleted file mode 120000 (symlink)
index 0d81208f6f90b4db10525256792f33c44c0539d6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/flexmember.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9df6c03cd3bab4c4ab40dbc1309b39ba6643a8ee
--- /dev/null
@@ -0,0 +1,44 @@
+# serial 5
+# Check for flexible array member support.
+
+# Copyright (C) 2006, 2009-2024 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.
+
+# Written by Paul Eggert.
+
+AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER],
+[
+  AC_CACHE_CHECK([for flexible array member],
+    ac_cv_c_flexmember,
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdlib.h>
+            #include <stdio.h>
+            #include <stddef.h>
+            struct m { struct m *next, **list; char name[]; };
+            struct s { struct s *p; struct m *m; int n; double d[]; };]],
+          [[int m = getchar ();
+            size_t nbytes = offsetof (struct s, d) + m * sizeof (double);
+            nbytes += sizeof (struct s) - 1;
+            nbytes -= nbytes % sizeof (struct s);
+            struct s *p = malloc (nbytes);
+            p->p = p;
+            p->m = NULL;
+            p->d[0] = 0.0;
+            return p->d != (double *) NULL;]])],
+       [ac_cv_c_flexmember=yes],
+       [ac_cv_c_flexmember=no])])
+  if test $ac_cv_c_flexmember = yes; then
+    AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [],
+      [Define to nothing if C supports flexible array members, and to
+       1 if it does not.  That way, with a declaration like 'struct s
+       { int n; short d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack
+       can be used with pre-C99 compilers.
+       Use 'FLEXSIZEOF (struct s, d, N * sizeof (short))' to calculate
+       the size in bytes of such a struct containing an N-element array.])
+  else
+    AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1])
+  fi
+])
deleted file mode 120000 (symlink)
index 3998ecbab3bf9a7782955da391d681efbbee64db..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/float_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..60e814474edf745246ccb5027c2c197fd2869961
--- /dev/null
@@ -0,0 +1,108 @@
+# float_h.m4 serial 14
+dnl Copyright (C) 2007, 2009-2024 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_FLOAT_H],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  GL_GENERATE_FLOAT_H=false
+  REPLACE_FLOAT_LDBL=0
+  case "$host_os" in
+    aix* | beos* | openbsd* | mirbsd* | irix*)
+      GL_GENERATE_FLOAT_H=true
+      ;;
+    freebsd* | dragonfly*)
+      case "$host_cpu" in
+changequote(,)dnl
+        i[34567]86 )
+changequote([,])dnl
+          GL_GENERATE_FLOAT_H=true
+          ;;
+        x86_64 )
+          # On x86_64 systems, the C compiler may still be generating
+          # 32-bit code.
+          AC_COMPILE_IFELSE(
+            [AC_LANG_SOURCE(
+               [[#if defined __LP64__ || defined __x86_64__ || defined __amd64__
+                  int ok;
+                 #else
+                  error fail
+                 #endif
+               ]])],
+            [],
+            [GL_GENERATE_FLOAT_H=true])
+          ;;
+      esac
+      ;;
+    linux*)
+      case "$host_cpu" in
+        powerpc*)
+          GL_GENERATE_FLOAT_H=true
+          ;;
+      esac
+      ;;
+  esac
+  case "$host_os" in
+    aix* | freebsd* | dragonfly* | linux*)
+      if $GL_GENERATE_FLOAT_H; then
+        REPLACE_FLOAT_LDBL=1
+      fi
+      ;;
+  esac
+
+  dnl Test against glibc-2.7 Linux/SPARC64 bug.
+  REPLACE_ITOLD=0
+  AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works],
+    [gl_cv_func_itold_works],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+int i = -1;
+volatile long double ld;
+int main ()
+{
+  ld += i * 1.0L;
+  if (ld > 0)
+    return 1;
+  return 0;
+}]])],
+        [gl_cv_func_itold_works=yes],
+        [gl_cv_func_itold_works=no],
+        [case "$host" in
+           sparc*-*-linux*)
+             AC_COMPILE_IFELSE(
+               [AC_LANG_SOURCE(
+                 [[#if defined __LP64__ || defined __arch64__
+                    int ok;
+                   #else
+                    error fail
+                   #endif
+                 ]])],
+               [gl_cv_func_itold_works="guessing no"],
+               [gl_cv_func_itold_works="guessing yes"])
+             ;;
+             # Guess yes on native Windows.
+           mingw* | windows*)
+             gl_cv_func_itold_works="guessing yes" ;;
+           *)
+             gl_cv_func_itold_works="guessing yes" ;;
+         esac
+        ])
+    ])
+  case "$gl_cv_func_itold_works" in
+    *no)
+      REPLACE_ITOLD=1
+      dnl We add the workaround to <float.h> but also to <math.h>,
+      dnl to increase the chances that the fix function gets pulled in.
+      GL_GENERATE_FLOAT_H=true
+      ;;
+  esac
+
+  if $GL_GENERATE_FLOAT_H; then
+    gl_NEXT_HEADERS([float.h])
+  fi
+  AC_SUBST([REPLACE_ITOLD])
+])
deleted file mode 120000 (symlink)
index 5dc0910bf99db76b06f4a417c4db689dc73ab556..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fnmatch.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..54d5c7bbdf837bfe79537be295b60c46b00ea822
--- /dev/null
@@ -0,0 +1,209 @@
+# Check for fnmatch - serial 20  -*- coding: utf-8 -*-
+
+# Copyright (C) 2000-2007, 2009-2024 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.
+
+# Autoconf defines AC_FUNC_FNMATCH, but that is obsolescent.
+# New applications should use the macros below instead.
+
+# Request a POSIX compliant fnmatch function.
+AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
+[
+  m4_divert_text([DEFAULTS], [gl_fnmatch_required=POSIX])
+
+  AC_REQUIRE([gl_FNMATCH_H])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  gl_fnmatch_required_lowercase=`
+    echo $gl_fnmatch_required | LC_ALL=C tr '[[A-Z]]' '[[a-z]]'
+  `
+  AC_CHECK_FUNCS_ONCE([fnmatch])
+  if test $ac_cv_func_fnmatch = no; then
+    HAVE_FNMATCH=0
+  else
+    gl_fnmatch_cache_var="gl_cv_func_fnmatch_${gl_fnmatch_required_lowercase}"
+    AC_CACHE_CHECK([for working $gl_fnmatch_required fnmatch],
+      [$gl_fnmatch_cache_var],
+      [dnl Some versions of Solaris, SCO, and the GNU C Library
+       dnl have a broken or incompatible fnmatch.
+       dnl So we run a test program.  If we are cross-compiling, take no chance.
+       dnl Thanks to John Oleynick, François Pinard, and Paul Eggert for this
+       dnl test.
+       if test $gl_fnmatch_required = GNU; then
+         gl_fnmatch_gnu_start=
+         gl_fnmatch_gnu_end=
+       else
+         gl_fnmatch_gnu_start='#if 0'
+         gl_fnmatch_gnu_end='#endif'
+       fi
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <fnmatch.h>
+              #include <locale.h>
+              #include <stddef.h>
+              static int
+              y (char const *pattern, char const *string, int flags)
+              {
+                return fnmatch (pattern, string, flags) == 0;
+              }
+              static int
+              n (char const *pattern, char const *string, int flags)
+              {
+                return fnmatch (pattern, string, flags) == FNM_NOMATCH;
+              }
+            ]],
+            [[char const *Apat = 'A' < '\\\\' ? "[A-\\\\\\\\]" : "[\\\\\\\\-A]";
+              char const *apat = 'a' < '\\\\' ? "[a-\\\\\\\\]" : "[\\\\\\\\-a]";
+              static char const A_1[] = { 'A' - 1, 0 };
+              static char const A01[] = { 'A' + 1, 0 };
+              static char const a_1[] = { 'a' - 1, 0 };
+              static char const a01[] = { 'a' + 1, 0 };
+              static char const bs_1[] = { '\\\\' - 1, 0 };
+              static char const bs01[] = { '\\\\' + 1, 0 };
+              int result = 0;
+              /* ==== Start of tests in the "C" locale ==== */
+              /* These are sanity checks. They all succeed on current platforms.  */
+              if (!n ("a*", "", 0))
+                return 1;
+              if (!y ("a*", "abc", 0))
+                return 1;
+              if (!n ("d*/*1", "d/s/1", FNM_PATHNAME))
+                return 1;
+              if (!y ("a\\\\bc", "abc", 0))
+                return 1;
+              if (!n ("a\\\\bc", "abc", FNM_NOESCAPE))
+                return 1;
+              if (!y ("*x", ".x", 0))
+                return 1;
+              if (!n ("*x", ".x", FNM_PERIOD))
+                return 1;
+              /* glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=361>
+                 exists in glibc 2.3.3, fixed in glibc 2.5.  */
+              if (!y (Apat, "\\\\", 0))
+                result |= 2;
+              if (!y (Apat, "A", 0))
+                result |= 2;
+              if (!y (apat, "\\\\", 0))
+                result |= 2;
+              if (!y (apat, "a", 0))
+                result |= 2;
+              if (!(n (Apat, A_1, 0) == ('A' < '\\\\')))
+                result |= 2;
+              if (!(n (apat, a_1, 0) == ('a' < '\\\\')))
+                result |= 2;
+              if (!(y (Apat, A01, 0) == ('A' < '\\\\')))
+                result |= 2;
+              if (!(y (apat, a01, 0) == ('a' < '\\\\')))
+                result |= 2;
+              if (!(y (Apat, bs_1, 0) == ('A' < '\\\\')))
+                result |= 2;
+              if (!(y (apat, bs_1, 0) == ('a' < '\\\\')))
+                result |= 2;
+              if (!(n (Apat, bs01, 0) == ('A' < '\\\\')))
+                result |= 2;
+              if (!(n (apat, bs01, 0) == ('a' < '\\\\')))
+                result |= 2;
+              /* glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=12378>
+                 exists in glibc 2.12, fixed in glibc 2.13.  */
+              if (!y ("[/b", "[/b", 0)) /*"]]"*/
+                result |= 4;
+              /* glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=17062>
+                 is fixed in glibc 2.20.
+                 glibc bugs <https://sourceware.org/bugzilla/show_bug.cgi?id=18032>
+                            <https://sourceware.org/bugzilla/show_bug.cgi?id=18036>
+                 are fixed in glibc 2.22.
+                 These bugs are not easy to test for reliably (without mmap),
+                 therefore test the glibc version.  */
+              #if defined __GLIBC__
+              if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 22)
+                result |= 4;
+              #endif
+              /* This test fails on FreeBSD 13.2, NetBSD 9.3, Cygwin 3.4.6.  */
+              if (!y ("[[:alnum:]]", "a", 0))
+                result |= 8;
+              $gl_fnmatch_gnu_start /* ==== Start of GNU extensions tests ==== */
+              /* Sanity checks, mainly to check the presence of the FNM_* macros.  */
+              if (!y ("xxXX", "xXxX", FNM_CASEFOLD))
+                result |= 64;
+              if (!y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH))
+                result |= 64;
+              if (!n ("d*/*1", "d/s/1", FNM_FILE_NAME))
+                result |= 64;
+              if (!y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR))
+                result |= 64;
+              if (!y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR))
+                result |= 64;
+              if (!y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR))
+                result |= 64;
+              $gl_fnmatch_gnu_end /* ==== End of GNU extensions tests ==== */
+              /* ==== End of tests in the "C" locale ==== */
+              /* ==== Start of tests that require a specific locale ==== */
+              /* This test fails on Solaris 11.4.  */
+              if (setlocale (LC_ALL, "en_US.UTF-8") != NULL)
+                {
+                  if (!n ("[!a-z]", "", 0))
+                    result |= 16;
+                }
+              /* This test fails on NetBSD 9.3, Android 13.  */
+              if (setlocale (LC_ALL, "C.UTF-8") != NULL)
+                {
+                  if (!y ("x?y", "x\\303\\274y", 0))
+                    result |= 32;
+                }
+              /* ==== End of tests that require a specific locale ==== */
+              return result;
+            ]])],
+         [eval "$gl_fnmatch_cache_var=yes"],
+         [eval "$gl_fnmatch_cache_var=no"],
+         [case "$host_os" in
+                                # Guess yes on musl systems.
+            *-musl* | midipix*) eval "$gl_fnmatch_cache_var=\"guessing yes\"" ;;
+                                # Guess no otherwise, even on glibc systems.
+            *)                  eval "$gl_fnmatch_cache_var=\"guessing no\"" ;;
+          esac
+         ])
+      ])
+    eval "gl_fnmatch_result=\"\$$gl_fnmatch_cache_var\""
+    case "$gl_fnmatch_result" in
+      *yes) ;;
+      *) REPLACE_FNMATCH=1 ;;
+    esac
+    dnl On AIX 7.2 in 32-bit mode, fnmatch()'s only POSIX compliance problem is
+    dnl that is does not support characters outside the Unicode BMP correctly.
+    dnl Test case: fnmatch ("x?y", "x\360\237\230\213y", 0) == 0
+    dnl This is due to wchar_t being only 16 bits wide.
+    AC_REQUIRE([gl_UCHAR_H])
+    if test $SMALL_WCHAR_T = 1; then
+      case "$host_os" in
+        cygwin*)
+          dnl On Cygwin < 3.5.0, the above $gl_fnmatch_result came out as 'no',
+          dnl On Cygwin >= 3.5.0, fnmatch supports all Unicode characters,
+          dnl despite wchar_t being only 16 bits wide (because internally it
+          dnl works on wint_t values).
+          ;;
+        *)
+          REPLACE_FNMATCH=1
+          ;;
+      esac
+    fi
+  fi
+  if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then
+    gl_REPLACE_FNMATCH_H
+  fi
+])
+
+# Request a POSIX compliant fnmatch function with GNU extensions.
+AC_DEFUN([gl_FUNC_FNMATCH_GNU],
+[
+  m4_divert_text([INIT_PREPARE], [gl_fnmatch_required=GNU])
+
+  AC_REQUIRE([gl_FUNC_FNMATCH_POSIX])
+])
+
+AC_DEFUN([gl_PREREQ_FNMATCH],
+[
+  dnl Prerequisites of lib/fnmatch.c.
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  AC_CHECK_FUNCS_ONCE([mbsrtowcs])
+])
deleted file mode 120000 (symlink)
index 681553594640abdf3fa09cb4620b33de92d68d71..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fnmatch_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..58cd7dcbd27d814e01914ce5af5b80ab72edb236
--- /dev/null
@@ -0,0 +1,87 @@
+# fnmatch_h.m4 serial 8
+dnl Copyright (C) 2009-2024 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 Bruno Haible.
+
+AC_DEFUN_ONCE([gl_FNMATCH_H],
+[
+  AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
+  m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
+  AC_CHECK_HEADERS_ONCE([fnmatch.h])
+  gl_CHECK_NEXT_HEADERS([fnmatch.h])
+
+  dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
+  dnl This is only needed if gl_fnmatch_required = GNU. It would be possible
+  dnl to avoid this dependency for gl_FUNC_FNMATCH_POSIX by putting
+  dnl gl_FUNC_FNMATCH_GNU into a separate .m4 file.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  if test $ac_cv_header_fnmatch_h = yes; then
+    HAVE_FNMATCH_H=1
+  else
+    HAVE_FNMATCH_H=0
+  fi
+  AC_SUBST([HAVE_FNMATCH_H])
+
+  m4_ifdef([gl_POSIXCHECK],
+    [GL_GENERATE_FNMATCH_H=true],
+    [GL_GENERATE_FNMATCH_H=false
+     if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
+       dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE.
+       GL_GENERATE_FNMATCH_H=true
+     else
+       if test $ac_cv_header_fnmatch_h != yes; then
+         dnl Provide a substitute <fnmatch.h> file.
+         GL_GENERATE_FNMATCH_H=true
+       fi
+     fi
+    ])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <fnmatch.h>
+    ]],
+    [fnmatch])
+])
+
+dnl Unconditionally enables the replacement of <fnmatch.h>.
+AC_DEFUN([gl_REPLACE_FNMATCH_H],
+[
+  gl_FNMATCH_H_REQUIRE_DEFAULTS
+  GL_GENERATE_FNMATCH_H=true
+])
+
+# gl_FNMATCH_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_FNMATCH_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_FNMATCH_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_FNMATCH_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_FNMATCH_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FNMATCH])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_FNMATCH_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_FNMATCH_H_DEFAULTS],
+[
+  dnl Assume POSIX behavior unless another module says otherwise.
+  HAVE_FNMATCH=1;            AC_SUBST([HAVE_FNMATCH])
+  REPLACE_FNMATCH=0;         AC_SUBST([REPLACE_FNMATCH])
+])
deleted file mode 120000 (symlink)
index 574fa69e87d1aaee2bcb7eb5b8fd79f27a4562d7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fopen.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1fcffa4087f404c999d435021b34b257aa6e9063
--- /dev/null
@@ -0,0 +1,158 @@
+# fopen.m4 serial 16
+dnl Copyright (C) 2007-2024 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_FOPEN_ITSELF],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw* | windows* | pw*)
+      dnl Replace fopen, for handling of "/dev/null".
+      REPLACE_FOPEN=1
+      dnl fopen on mingw also has the trailing slash bug.
+      gl_cv_func_fopen_slash="guessing no"
+      ;;
+    *)
+      dnl fopen("foo/", "w") should not create a file when the file name has a
+      dnl trailing slash.
+      AC_CACHE_CHECK([whether fopen recognizes a trailing slash],
+        [gl_cv_func_fopen_slash],
+        [
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#include <stddef.h>
+#include <stdio.h>
+int main ()
+{
+  FILE *fp = fopen ("conftest.sl/", "w");
+  int result = (fp != NULL);
+  if (fp != NULL)
+    fclose (fp);
+  return result;
+}]])],
+            [gl_cv_func_fopen_slash=yes],
+            [gl_cv_func_fopen_slash=no],
+            [
+changequote(,)dnl
+             case "$host_os" in
+               aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*)
+                 gl_cv_func_fopen_slash="guessing no" ;;
+               *)
+                 gl_cv_func_fopen_slash="guessing yes" ;;
+             esac
+changequote([,])dnl
+            ])
+          rm -f conftest.sl
+        ])
+      ;;
+  esac
+  case "$gl_cv_func_fopen_slash" in
+    *no)
+      AC_DEFINE([FOPEN_TRAILING_SLASH_BUG], [1],
+        [Define to 1 if fopen() fails to recognize a trailing slash.])
+      REPLACE_FOPEN=1
+      ;;
+  esac
+])
+
+AC_DEFUN([gl_FUNC_FOPEN],
+[
+  AC_REQUIRE([gl_FUNC_FOPEN_ITSELF])
+  AC_REQUIRE([gl_FUNC_FCLOSE])
+  if test $REPLACE_FCLOSE = 1; then
+    REPLACE_FOPEN=1
+  fi
+])
+
+AC_DEFUN([gl_FUNC_FOPEN_GNU],
+[
+  AC_REQUIRE([gl_FUNC_FOPEN])
+  AC_CACHE_CHECK([whether fopen supports the mode character 'x'],
+    [gl_cv_func_fopen_mode_x],
+    [rm -f conftest.x
+     AC_RUN_IFELSE(
+       [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <errno.h>
+int main ()
+{
+  FILE *fp;
+  fp = fopen ("conftest.x", "w");
+  fclose (fp);
+  fp = fopen ("conftest.x", "wx");
+  if (fp != NULL)
+    /* 'x' ignored */
+    return 1;
+  else if (errno == EEXIST)
+    return 0;
+  else
+    /* 'x' rejected */
+    return 2;
+}]])],
+       [gl_cv_func_fopen_mode_x=yes],
+       [gl_cv_func_fopen_mode_x=no],
+       [case "$host_os" in
+          # Guess yes on glibc and musl systems.
+          linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl* | midipix*)
+            gl_cv_func_fopen_mode_x="guessing yes" ;;
+          # If we don't know, obey --enable-cross-guesses.
+          *)
+            gl_cv_func_fopen_mode_x="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -f conftest.x
+    ])
+  AC_CACHE_CHECK([whether fopen supports the mode character 'e'],
+    [gl_cv_func_fopen_mode_e],
+    [echo foo > conftest.x
+     AC_RUN_IFELSE(
+       [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+]GL_MDA_DEFINES[
+int main ()
+{
+  FILE *fp = fopen ("conftest.x", "re");
+  if (fp != NULL)
+    {
+      if (fcntl (fileno (fp), F_GETFD) & FD_CLOEXEC)
+        return 0;
+      else
+        /* 'e' ignored */
+        return 1;
+    }
+  else
+    /* 'e' rejected */
+    return 2;
+}]])],
+       [gl_cv_func_fopen_mode_e=yes],
+       [gl_cv_func_fopen_mode_e=no],
+       [case "$host_os" in
+          # Guess yes on glibc and musl systems.
+          linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl* | midipix*)
+            gl_cv_func_fopen_mode_e="guessing yes" ;;
+          # Guess no on native Windows.
+          mingw* | windows*)
+            gl_cv_func_fopen_mode_e="guessing no" ;;
+          # If we don't know, obey --enable-cross-guesses.
+          *)
+            gl_cv_func_fopen_mode_e="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -f conftest.x
+    ])
+  REPLACE_FOPEN_FOR_FOPEN_GNU="$REPLACE_FOPEN"
+  case "$gl_cv_func_fopen_mode_x" in
+    *no) REPLACE_FOPEN_FOR_FOPEN_GNU=1 ;;
+  esac
+  case "$gl_cv_func_fopen_mode_e" in
+    *no) REPLACE_FOPEN_FOR_FOPEN_GNU=1 ;;
+  esac
+])
+
+# Prerequisites of lib/fopen.c.
+AC_DEFUN([gl_PREREQ_FOPEN], [:])
deleted file mode 120000 (symlink)
index 613fa28596ff571c39c8826c1aed4236f8a186be..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fpending.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..05064b851ecb76b1fe3a6fdb4e464b4740b60685
--- /dev/null
@@ -0,0 +1,36 @@
+# serial 23
+
+# Copyright (C) 2000-2001, 2004-2024 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
+dnl Using code from emacs, based on suggestions from Paul Eggert
+dnl and Ulrich Drepper.
+
+dnl Find out how to determine the number of pending output bytes on a stream.
+dnl glibc (2.1.93 and newer) and Solaris provide __fpending.  On other systems,
+dnl we have to grub around in the (possibly opaque) FILE struct.
+
+AC_DEFUN([gl_FUNC_FPENDING],
+[
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
+  fp_headers='
+    #include <stdio.h>
+    #if HAVE_STDIO_EXT_H
+    # include <stdio_ext.h>
+    #endif
+  '
+  AC_CACHE_CHECK([for __fpending], [gl_cv_func___fpending],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM([[$fp_headers]],
+           [[return ! __fpending (stdin);]])],
+        [gl_cv_func___fpending=yes],
+        [gl_cv_func___fpending=no])
+    ])
+  if test $gl_cv_func___fpending = yes; then
+    AC_CHECK_DECLS([__fpending], [], [], [$fp_headers])
+  fi
+])
deleted file mode 120000 (symlink)
index 2965e98b9bb10ee71d759487e8eb1b3d35eaf5fc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fpieee.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..239cf4a7e2d7226305a74037f83169b3796afc24
--- /dev/null
@@ -0,0 +1,54 @@
+# fpieee.m4 serial 2  -*- coding: utf-8 -*-
+dnl Copyright (C) 2007, 2009-2024 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 IEEE 754 standardized three items:
+dnl - The formats of single-float and double-float - nowadays commonly
+dnl   available as 'float' and 'double' in C and C++.
+dnl   No autoconf test needed.
+dnl - The overflow and division by zero behaviour: The result are values
+dnl   '±Inf' and 'NaN', rather than exceptions as it was before.
+dnl   This file provides an autoconf macro for ensuring this behaviour of
+dnl   floating-point operations.
+dnl - A set of conditions (overflow, underflow, inexact, etc.) which can
+dnl   be configured to trigger an exception.
+dnl   This cannot be done in a portable way: it depends on the compiler,
+dnl   libc, kernel, and CPU.  No autoconf macro is provided for this.
+
+dnl Ensure non-trapping behaviour of floating-point overflow and
+dnl floating-point division by zero.
+dnl (For integer overflow, see gcc's -ftrapv option; for integer division by
+dnl zero, see the autoconf macro in intdiv0.m4.)
+
+AC_DEFUN([gl_FP_IEEE],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  # IEEE behaviour is the default on all CPUs except Alpha and SH
+  # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4
+  # and the GCC 4.1.2 manual).
+  case "$host_cpu" in
+    alpha*)
+      # On Alpha systems, a compiler option provides the behaviour.
+      # See the ieee(3) manual page, also available at
+      # <https://backdrift.org/man/tru64/man3/ieee.3.html>
+      if test -n "$GCC"; then
+        # GCC has the option -mieee.
+        # For full IEEE compliance (rarely needed), use option -mieee-with-inexact.
+        CPPFLAGS="$CPPFLAGS -mieee"
+      else
+        # Compaq (ex-DEC) C has the option -ieee, equivalent to -ieee_with_no_inexact.
+        # For full IEEE compliance (rarely needed), use option -ieee_with_inexact.
+        CPPFLAGS="$CPPFLAGS -ieee"
+      fi
+      ;;
+    sh*)
+      if test -n "$GCC"; then
+        # GCC has the option -mieee.
+        CPPFLAGS="$CPPFLAGS -mieee"
+      fi
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 8bc248297a297376c226ead59e9edfc40244f174..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fpurge.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e9b7050b31fb5602a840896fe11e9fa3beaccd97
--- /dev/null
@@ -0,0 +1,73 @@
+# fpurge.m4 serial 14
+dnl Copyright (C) 2007, 2009-2024 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_FPURGE],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
+  AC_CHECK_FUNCS_ONCE([fpurge])
+  gl_CHECK_FUNCS_ANDROID([__fpurge], [[#include <stdio_ext.h>]])
+  AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]])
+  if test "x$ac_cv_func_fpurge" = xyes; then
+    HAVE_FPURGE=1
+    # Detect BSD bug.  Only cygwin 1.7 and musl are known to be immune.
+    AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <stdio.h>
+]],
+            [[FILE *f = fopen ("conftest.txt", "w+");
+              if (!f)
+                return 1;
+              if (fputc ('a', f) != 'a')
+                { fclose (f); return 2; }
+              rewind (f);
+              if (fgetc (f) != 'a')
+                { fclose (f); return 3; }
+              if (fgetc (f) != EOF)
+                { fclose (f); return 4; }
+              if (fpurge (f) != 0)
+                { fclose (f); return 5; }
+              if (putc ('b', f) != 'b')
+                { fclose (f); return 6; }
+              if (fclose (f) != 0)
+                return 7;
+              if ((f = fopen ("conftest.txt", "r")) == NULL)
+                return 8;
+              if (fgetc (f) != 'a')
+                { fclose (f); return 9; }
+              if (fgetc (f) != 'b')
+                { fclose (f); return 10; }
+              if (fgetc (f) != EOF)
+                { fclose (f); return 11; }
+              if (fclose (f) != 0)
+                return 12;
+              if (remove ("conftest.txt") != 0)
+                return 13;
+              return 0;
+            ]])],
+         [gl_cv_func_fpurge_works=yes],
+         [gl_cv_func_fpurge_works=no],
+         [case "$host_os" in
+                                # Guess yes on musl systems.
+            *-musl* | midipix*) gl_cv_func_fpurge_works="guessing yes" ;;
+                                # Otherwise obey --enable-cross-guesses.
+            *)                  gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_fpurge_works" in
+      *yes) ;;
+      *) REPLACE_FPURGE=1 ;;
+    esac
+  else
+    HAVE_FPURGE=0
+  fi
+  if test "x$ac_cv_have_decl_fpurge" = xno; then
+    HAVE_DECL_FPURGE=0
+  fi
+])
deleted file mode 120000 (symlink)
index 9af9cd21214c6e467edd83d13e4727dd902bb379..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/freadahead.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..df7aaa29feee0b1379a442d75236b3895bd964c1
--- /dev/null
@@ -0,0 +1,10 @@
+# freadahead.m4 serial 2
+dnl Copyright (C) 2012-2024 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_FREADAHEAD],
+[
+  gl_CHECK_FUNCS_ANDROID([__freadahead], [[#include <stdio_ext.h>]])
+])
deleted file mode 120000 (symlink)
index 1ba90194a0e67a180ca121846ba5e420095a2402..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/freading.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9a95cba1e5a83802da7f12bcde3c6030b2fdd66a
--- /dev/null
@@ -0,0 +1,14 @@
+# freading.m4 serial 3
+dnl Copyright (C) 2007, 2009-2024 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_FREADING],
+[
+  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
+  gl_CHECK_FUNCS_ANDROID([__freading],
+    [[#include <stdio.h>
+      #include <stdio_ext.h>
+    ]])
+])
deleted file mode 120000 (symlink)
index 2c8ccf30fc0572f029c0bdee41f889e839ac2850..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/freadptr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7c0e73baaf23fd0d00abfca02fc944ba92397e39
--- /dev/null
@@ -0,0 +1,10 @@
+# freadptr.m4 serial 1
+dnl Copyright (C) 2012-2024 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_FREADPTR],
+[
+  AC_CHECK_FUNCS_ONCE([__freadptr])
+])
deleted file mode 120000 (symlink)
index c8dd65f17a29694ce541407920e4e20460f759b8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/freadseek.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..413b911c122bf100bf98d4d0c4b56c7e8f16974a
--- /dev/null
@@ -0,0 +1,10 @@
+# freadseek.m4 serial 2
+dnl Copyright (C) 2012-2024 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_FREADSEEK],
+[
+  AC_CHECK_FUNCS_ONCE([__freadptrinc])
+])
deleted file mode 120000 (symlink)
index 72951408f1ab2166a45e63a5540a2b001ca99dcc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/free.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4f6dc2e256d90555de2dfa31c2a99efc33442930
--- /dev/null
@@ -0,0 +1,52 @@
+# free.m4 serial 6
+# Copyright (C) 2003-2005, 2009-2024 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.
+
+# Written by Paul Eggert and Bruno Haible.
+
+AC_DEFUN([gl_FUNC_FREE],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+  dnl In the next release of POSIX, free must preserve errno.
+  dnl https://www.austingroupbugs.net/view.php?id=385
+  dnl https://sourceware.org/bugzilla/show_bug.cgi?id=17924
+  dnl So far, we know of three platforms that do this:
+  dnl * glibc >= 2.33, thanks to the fix for this bug:
+  dnl   <https://sourceware.org/bugzilla/show_bug.cgi?id=17924>
+  dnl * OpenBSD >= 4.5, thanks to this commit:
+  dnl   <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h>
+  dnl * Solaris, because its malloc() implementation is based on brk(),
+  dnl   not mmap(); hence its free() implementation makes no system calls.
+  dnl For other platforms, you can only be sure if they state it in their
+  dnl documentation, or by code inspection of the free() implementation in libc.
+  AC_CACHE_CHECK([whether free is known to preserve errno],
+    [gl_cv_func_free_preserves_errno],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdlib.h>
+          ]],
+          [[#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__)
+            #elif defined __OpenBSD__
+            #elif defined __sun
+            #else
+              #error "'free' is not known to preserve errno"
+            #endif
+          ]])],
+       [gl_cv_func_free_preserves_errno=yes],
+       [gl_cv_func_free_preserves_errno=no])
+    ])
+
+  case $gl_cv_func_free_preserves_errno in
+   *yes)
+    AC_DEFINE([HAVE_FREE_POSIX], [1],
+      [Define if the 'free' function is guaranteed to preserve errno.])
+    ;;
+   *) REPLACE_FREE=1 ;;
+  esac
+])
+
+# Prerequisites of lib/free.c.
+AC_DEFUN([gl_PREREQ_FREE], [:])
deleted file mode 120000 (symlink)
index 0660f8c526557b418453b6522eacc3f325cea439..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/freopen.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2edf10fc75e03cd17f6ada263d83123470f331e9
--- /dev/null
@@ -0,0 +1,40 @@
+# freopen.m4 serial 8
+dnl Copyright (C) 2007-2024 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_FREOPEN],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw* | windows* | pw* | os2*)
+      REPLACE_FREOPEN=1
+      ;;
+    *)
+      AC_CACHE_CHECK([whether freopen works on closed fds],
+        [gl_cv_func_freopen_works_on_closed],
+        [AC_RUN_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <stdio.h>
+                #include <unistd.h>
+              ]GL_MDA_DEFINES],
+              [[close (0);
+                return !(freopen ("/dev/null", "r", stdin)
+                         && getchar () == EOF
+                         && !ferror (stdin) && feof (stdin));]])],
+           [gl_cv_func_freopen_works_on_closed=yes],
+           [gl_cv_func_freopen_works_on_closed=no],
+           [case $host_os in
+              *gnu*) gl_cv_func_freopen_works_on_closed="guessing no" ;;
+              *)     gl_cv_func_freopen_works_on_closed="guessing yes";;
+            esac])])
+      case $gl_cv_func_freopen_works_on_closed in
+        *no) REPLACE_FREOPEN=1;;
+      esac
+  esac
+])
+
+# Prerequisites of lib/freopen.c.
+AC_DEFUN([gl_PREREQ_FREOPEN], [:])
deleted file mode 120000 (symlink)
index ddb58be07e9366502f94ec37ee0ad8f9da680d1e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/frexp.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c1f2be88c91062bc7f2c98b800498f11e1d28679
--- /dev/null
@@ -0,0 +1,186 @@
+# frexp.m4 serial 19
+dnl Copyright (C) 2007-2024 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_FREXP],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM])
+  FREXP_LIBM=
+  if test $gl_cv_func_frexp_no_libm = no; then
+    AC_CACHE_CHECK([whether frexp() can be used with libm],
+      [gl_cv_func_frexp_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_LINK_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[#include <math.h>
+               double x;]],
+             [[int e; return frexp (x, &e) > 0;]])],
+          [gl_cv_func_frexp_in_libm=yes],
+          [gl_cv_func_frexp_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_frexp_in_libm = yes; then
+      FREXP_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_frexp_no_libm = yes \
+     || test $gl_cv_func_frexp_in_libm = yes; then
+    save_LIBS="$LIBS"
+    LIBS="$LIBS $FREXP_LIBM"
+    gl_FUNC_FREXP_WORKS
+    LIBS="$save_LIBS"
+    case "$gl_cv_func_frexp_works" in
+      *yes) gl_func_frexp=yes ;;
+      *)    gl_func_frexp=no; REPLACE_FREXP=1; FREXP_LIBM= ;;
+    esac
+  else
+    gl_func_frexp=no
+  fi
+  if test $gl_func_frexp = yes; then
+    AC_DEFINE([HAVE_FREXP], [1],
+      [Define if the frexp() function is available and works.])
+  fi
+  AC_SUBST([FREXP_LIBM])
+])
+
+AC_DEFUN([gl_FUNC_FREXP_NO_LIBM],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM])
+  if test $gl_cv_func_frexp_no_libm = yes; then
+    gl_FUNC_FREXP_WORKS
+    case "$gl_cv_func_frexp_works" in
+      *yes) gl_func_frexp_no_libm=yes ;;
+      *)    gl_func_frexp_no_libm=no; REPLACE_FREXP=1 ;;
+    esac
+  else
+    gl_func_frexp_no_libm=no
+    dnl Set REPLACE_FREXP here because the system may have frexp in libm.
+    REPLACE_FREXP=1
+  fi
+  if test $gl_func_frexp_no_libm = yes; then
+    AC_DEFINE([HAVE_FREXP_IN_LIBC], [1],
+      [Define if the frexp() function is available in libc.])
+  fi
+])
+
+dnl Test whether frexp() can be used without linking with libm.
+dnl Set gl_cv_func_frexp_no_libm to 'yes' or 'no' accordingly.
+AC_DEFUN([gl_CHECK_FREXP_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether frexp() can be used without linking with libm],
+    [gl_cv_func_frexp_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             double x;]],
+           [[int e; return frexp (x, &e) > 0;]])],
+        [gl_cv_func_frexp_no_libm=yes],
+        [gl_cv_func_frexp_no_libm=no])
+    ])
+])
+
+dnl Test whether frexp() works also on denormalized numbers (this fails e.g. on
+dnl NetBSD 3.0), on infinite numbers (this fails e.g. on IRIX 6.5 and mingw),
+dnl and on negative zero (this fails e.g. on NetBSD 4.99 and mingw).
+AC_DEFUN([gl_FUNC_FREXP_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_DECLS_ONCE([alarm])
+  AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <math.h>
+#include <string.h>
+#if HAVE_DECL_ALARM
+# include <signal.h>
+# include <unistd.h>
+#endif
+/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
+   ICC 10.0 has a bug when optimizing the expression -zero.
+   The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
+   to PowerPC on Mac OS X 10.5.  */
+#if defined __hpux || defined __sgi || defined __ICC
+static double
+compute_minus_zero (void)
+{
+  return -DBL_MIN * DBL_MIN;
+}
+# define minus_zero compute_minus_zero ()
+#else
+double minus_zero = -0.0;
+#endif
+int main()
+{
+  int result = 0;
+  int i;
+  volatile double x;
+  double zero = 0.0;
+#if HAVE_DECL_ALARM
+  /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite
+     number.  Let the test fail in this case.  */
+  signal (SIGALRM, SIG_DFL);
+  alarm (5);
+#endif
+  /* Test on denormalized numbers.  */
+  for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
+    ;
+  if (x > 0.0)
+    {
+      int exp;
+      double y = frexp (x, &exp);
+      /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022.
+         On NetBSD: y = 0.75. Correct: y = 0.5.  */
+      if (y != 0.5)
+        result |= 1;
+    }
+  /* Test on infinite numbers.  */
+  x = 1.0 / zero;
+  {
+    int exp;
+    double y = frexp (x, &exp);
+    if (y != x)
+      result |= 2;
+  }
+  /* Test on negative zero.  */
+  x = minus_zero;
+  {
+    int exp;
+    double y = frexp (x, &exp);
+    double x1 = x;
+    if (memcmp (&y, &x1, sizeof x1))
+      result |= 4;
+  }
+  return result;
+}]])],
+        [gl_cv_func_frexp_works=yes],
+        [gl_cv_func_frexp_works=no],
+        [case "$host_os" in
+           netbsd* | irix*) gl_cv_func_frexp_works="guessing no" ;;
+           # Guess yes with MSVC, no with mingw.
+           windows*-msvc*)
+             gl_cv_func_frexp_works="guessing yes"
+             ;;
+           mingw* | windows*)
+             AC_EGREP_CPP([Good], [
+#ifdef _MSC_VER
+ Good
+#endif
+               ],
+               [gl_cv_func_frexp_works="guessing yes"],
+               [gl_cv_func_frexp_works="guessing no"])
+             ;;
+           *) gl_cv_func_frexp_works="guessing yes" ;;
+         esac
+        ])
+    ])
+])
deleted file mode 120000 (symlink)
index f8f8892147967c12cd3192d99706efc68e359e42..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/frexpl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..11fd3017e34d616f5733b59503bb5039b76dfe11
--- /dev/null
@@ -0,0 +1,233 @@
+# frexpl.m4 serial 23
+dnl Copyright (C) 2007-2024 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_FREXPL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+
+  dnl Persuade glibc <math.h> to declare frexpl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl Check whether it's declared.
+  dnl Mac OS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>.
+  AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]])
+
+  FREXPL_LIBM=
+  if test $HAVE_DECL_FREXPL = 1; then
+    gl_CHECK_FREXPL_NO_LIBM
+    if test $gl_cv_func_frexpl_no_libm = no; then
+      AC_CACHE_CHECK([whether frexpl() can be used with libm],
+        [gl_cv_func_frexpl_in_libm],
+        [
+          save_LIBS="$LIBS"
+          LIBS="$LIBS -lm"
+          AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM(
+               [[#include <math.h>
+                 long double x;]],
+               [[int e; return frexpl (x, &e) > 0;]])],
+            [gl_cv_func_frexpl_in_libm=yes],
+            [gl_cv_func_frexpl_in_libm=no])
+          LIBS="$save_LIBS"
+        ])
+      if test $gl_cv_func_frexpl_in_libm = yes; then
+        FREXPL_LIBM=-lm
+      fi
+    fi
+    if test $gl_cv_func_frexpl_no_libm = yes \
+       || test $gl_cv_func_frexpl_in_libm = yes; then
+      save_LIBS="$LIBS"
+      LIBS="$LIBS $FREXPL_LIBM"
+      gl_FUNC_FREXPL_WORKS
+      LIBS="$save_LIBS"
+      case "$gl_cv_func_frexpl_works" in
+        *yes) gl_func_frexpl=yes ;;
+        *)    gl_func_frexpl=no; REPLACE_FREXPL=1 ;;
+      esac
+    else
+      gl_func_frexpl=no
+    fi
+    if test $gl_func_frexpl = yes; then
+      AC_DEFINE([HAVE_FREXPL], [1],
+        [Define if the frexpl() function is available.])
+    fi
+  fi
+  if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then
+    dnl Find libraries needed to link lib/frexpl.c.
+    if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
+      AC_REQUIRE([gl_FUNC_FREXP])
+      FREXPL_LIBM="$FREXP_LIBM"
+    else
+      FREXPL_LIBM=
+    fi
+  fi
+  AC_SUBST([FREXPL_LIBM])
+])
+
+AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+  dnl Check whether it's declared.
+  dnl Mac OS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>.
+  AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]])
+  if test $HAVE_DECL_FREXPL = 1; then
+    gl_CHECK_FREXPL_NO_LIBM
+    if test $gl_cv_func_frexpl_no_libm = yes; then
+      gl_FUNC_FREXPL_WORKS
+      case "$gl_cv_func_frexpl_works" in
+        *yes) gl_func_frexpl_no_libm=yes ;;
+        *)    gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;;
+      esac
+    else
+      gl_func_frexpl_no_libm=no
+      dnl Set REPLACE_FREXPL here because the system may have frexpl in libm.
+      REPLACE_FREXPL=1
+    fi
+    if test $gl_func_frexpl_no_libm = yes; then
+      AC_DEFINE([HAVE_FREXPL_IN_LIBC], [1],
+        [Define if the frexpl() function is available in libc.])
+    fi
+  fi
+])
+
+dnl Test whether frexpl() can be used without linking with libm.
+dnl Set gl_cv_func_frexpl_no_libm to 'yes' or 'no' accordingly.
+AC_DEFUN([gl_CHECK_FREXPL_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether frexpl() can be used without linking with libm],
+    [gl_cv_func_frexpl_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             long double x;]],
+           [[int e; return frexpl (x, &e) > 0;]])],
+        [gl_cv_func_frexpl_no_libm=yes],
+        [gl_cv_func_frexpl_no_libm=no])
+    ])
+])
+
+dnl Test whether frexpl() works on finite numbers (this fails on
+dnl Mac OS X 10.4/PowerPC, on AIX 5.1, and on BeOS), on denormalized numbers
+dnl (this fails on Mac OS X 10.5/i386), and also on infinite numbers (this
+dnl fails e.g. on IRIX 6.5 and mingw).
+AC_DEFUN([gl_FUNC_FREXPL_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether frexpl works], [gl_cv_func_frexpl_works],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <math.h>
+/* Override the values of <float.h>, like done in float.in.h.  */
+#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP    (-16381)
+#endif
+#if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__)
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP    (-16381)
+#endif
+#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP DBL_MIN_EXP
+#endif
+#if defined __sgi && (LDBL_MANT_DIG >= 106)
+# if defined __GNUC__
+#  undef LDBL_MIN_EXP
+#  define LDBL_MIN_EXP DBL_MIN_EXP
+# endif
+#endif
+extern
+#ifdef __cplusplus
+"C"
+#endif
+long double frexpl (long double, int *);
+long double zero = 0.0L;
+int main()
+{
+  int result = 0;
+  volatile long double x;
+  /* Test on finite numbers that fails on AIX 5.1.  */
+  x = 16.0L;
+  {
+    int exp = -9999;
+    frexpl (x, &exp);
+    if (exp != 5)
+      result |= 1;
+  }
+  /* Test on finite numbers that fails on Mac OS X 10.4, because its frexpl
+     function returns an invalid (incorrectly normalized) value: it returns
+               y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 }
+     but the correct result is
+          0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 }  */
+  x = 1.01L;
+  {
+    int exp = -9999;
+    long double y = frexpl (x, &exp);
+    if (!(exp == 1 && y == 0.505L))
+      result |= 2;
+  }
+  /* Test on large finite numbers.  This fails on BeOS at i = 16322, while
+     LDBL_MAX_EXP = 16384.
+     In the loop end test, we test x against Infinity, rather than comparing
+     i with LDBL_MAX_EXP, because BeOS <float.h> has a wrong LDBL_MAX_EXP.  */
+  {
+    int i;
+    for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L)
+      {
+        int exp = -9999;
+        frexpl (x, &exp);
+        if (exp != i)
+          {
+            result |= 4;
+            break;
+          }
+      }
+  }
+  /* Test on denormalized numbers.  */
+  {
+    int i;
+    for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L)
+      ;
+    if (x > 0.0L)
+      {
+        int exp;
+        long double y = frexpl (x, &exp);
+        /* On machines with IEEE854 arithmetic: x = 1.68105e-4932,
+           exp = -16382, y = 0.5.  On Mac OS X 10.5: exp = -16384, y = 0.5.  */
+        if (exp != LDBL_MIN_EXP - 1)
+          result |= 8;
+      }
+  }
+  /* Test on infinite numbers.  */
+  /* The Microsoft MSVC 14 compiler chokes on the expression 1.0 / 0.0.  */
+  x = 1.0L / zero;
+  {
+    int exp;
+    long double y = frexpl (x, &exp);
+    if (y != x)
+      result |= 16;
+  }
+  return result;
+}]])],
+        [gl_cv_func_frexpl_works=yes],
+        [gl_cv_func_frexpl_works=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+           aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | windows* | pw*)
+              gl_cv_func_frexpl_works="guessing no";;
+           *) gl_cv_func_frexpl_works="guessing yes";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
deleted file mode 120000 (symlink)
index 724fb723ee7c81a88f1f2687352e3bbe251abf89..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fseek.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4d72ac529365575346c3cab2d2119652cecea1b6
--- /dev/null
@@ -0,0 +1,15 @@
+# fseek.m4 serial 4
+dnl Copyright (C) 2007, 2009-2024 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_FSEEK],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_FSEEKO])
+  dnl When fseeko needs fixes, fseek needs them too.
+  if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
+    REPLACE_FSEEK=1
+  fi
+])
deleted file mode 120000 (symlink)
index 60436a2f2266365b7e2498f618932a8b1080460e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fseeko.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cf11a9ce049d54b286428651d3b4cc9ab51a5bb2
--- /dev/null
@@ -0,0 +1,77 @@
+# fseeko.m4 serial 20
+dnl Copyright (C) 2007-2024 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_FSEEKO],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
+  AC_REQUIRE([gl_SYS_TYPES_H])
+  AC_REQUIRE([AC_PROG_CC])
+
+  dnl Persuade glibc <stdio.h> to declare fseeko().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
+    [
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
+]], [[fseeko (stdin, 0, 0);]])],
+        [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
+    ])
+
+  AC_CHECK_DECLS_ONCE([fseeko])
+  if test $ac_cv_have_decl_fseeko = no; then
+    HAVE_DECL_FSEEKO=0
+  fi
+
+  if test $gl_cv_func_fseeko = no; then
+    HAVE_FSEEKO=0
+  else
+    if test $WINDOWS_64_BIT_OFF_T = 1; then
+      REPLACE_FSEEKO=1
+    fi
+    if test $gl_cv_var_stdin_large_offset = no; then
+      REPLACE_FSEEKO=1
+    fi
+    m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
+      gl_FUNC_FFLUSH_STDIN
+      case "$gl_cv_func_fflush_stdin" in
+        *yes) ;;
+        *) REPLACE_FSEEKO=1 ;;
+      esac
+    ])
+  fi
+])
+
+dnl Code shared by fseeko and ftello.  Determine if large files are supported,
+dnl but stdin does not start as a large file by default.
+AC_DEFUN([gl_STDIN_LARGE_OFFSET],
+  [
+    AC_CACHE_CHECK([whether stdin defaults to large file offsets],
+      [gl_cv_var_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 in 1.5.25, and
+     it is easier to do a version check than building a runtime test.  */
+# include <cygwin/version.h>
+# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
+  choke me
+# endif
+#endif]])],
+        [gl_cv_var_stdin_large_offset=yes],
+        [gl_cv_var_stdin_large_offset=no])])
+])
+
+# Prerequisites of lib/fseeko.c.
+AC_DEFUN([gl_PREREQ_FSEEKO],
+[
+  dnl Native Windows has the function _fseeki64. mingw hides it in some
+  dnl circumstances, but mingw64 makes it usable again.
+  AC_CHECK_FUNCS([_fseeki64])
+  if test $ac_cv_func__fseeki64 = yes; then
+    AC_CHECK_DECLS([_fseeki64])
+  fi
+])
deleted file mode 120000 (symlink)
index bfc1ee0ccd7a5a36e449c9ef792e4538d2ee6441..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fseterr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b43ddc5a61b8a3882e870124cc8b604209d159d6
--- /dev/null
@@ -0,0 +1,13 @@
+# fseterr.m4 serial 2
+dnl Copyright (C) 2012-2024 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_FSETERR],
+[
+  gl_CHECK_FUNCS_ANDROID([__fseterr],
+    [[#include <stdio.h>
+      #include <stdio_ext.h>
+    ]])
+])
deleted file mode 120000 (symlink)
index ebd119d2200bf580fbdc99cbe37b89138d5472a5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fstat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5e73b4ed9f75b9a6bb761a51da9a2cd0362658db
--- /dev/null
@@ -0,0 +1,40 @@
+# fstat.m4 serial 10
+dnl Copyright (C) 2011-2024 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_FSTAT],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+
+  case "$host_os" in
+    darwin* | mingw* | windows* | solaris*)
+      dnl macOS and Solaris stat can return a negative tv_nsec.
+      dnl On MinGW, the original stat() returns st_atime, st_mtime,
+      dnl st_ctime values that are affected by the time zone.
+      REPLACE_FSTAT=1
+      ;;
+  esac
+
+  dnl Replace fstat() for supporting the gnulib-defined open() on directories.
+  m4_ifdef([gl_FUNC_FCHDIR], [
+    gl_TEST_FCHDIR
+    if test $HAVE_FCHDIR = 0; then
+      case "$gl_cv_func_open_directory_works" in
+        *yes) ;;
+        *)
+          REPLACE_FSTAT=1
+          ;;
+      esac
+    fi
+  ])
+])
+
+# Prerequisites of lib/fstat.c and lib/stat-w32.c.
+AC_DEFUN([gl_PREREQ_FSTAT], [
+  AC_REQUIRE([gl_SYS_STAT_H])
+  AC_REQUIRE([gl_PREREQ_STAT_W32])
+  :
+])
deleted file mode 120000 (symlink)
index 76d3df8b723d76a98b2b2b4b7e4e7fc7b49067e7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fstatat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c22569b7961093781427d9af83644199c9757556
--- /dev/null
@@ -0,0 +1,65 @@
+# fstatat.m4 serial 5
+dnl Copyright (C) 2004-2024 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.
+
+# If we have the fstatat function, and it has the bug (in AIX 7.1)
+# that it does not fill in st_size correctly, use the replacement function.
+AC_DEFUN([gl_FUNC_FSTATAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS_ONCE([fstatat])
+
+  if test $ac_cv_func_fstatat = no; then
+    HAVE_FSTATAT=0
+  else
+    dnl Test for an AIX 7.1 bug; see
+    dnl <https://lists.gnu.org/r/bug-tar/2011-09/msg00015.html>.
+    AC_CACHE_CHECK([whether fstatat (..., 0) works],
+      [gl_cv_func_fstatat_zero_flag],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE(
+            [[
+              #include <fcntl.h>
+              #include <sys/stat.h>
+              int
+              main (void)
+              {
+                struct stat a;
+                return fstatat (AT_FDCWD, ".", &a, 0) != 0;
+              }
+            ]])],
+         [gl_cv_func_fstatat_zero_flag=yes],
+         [gl_cv_func_fstatat_zero_flag=no],
+         [case "$host_os" in
+            aix*) gl_cv_func_fstatat_zero_flag="guessing no";;
+            *)    gl_cv_func_fstatat_zero_flag="guessing yes";;
+          esac
+         ])
+      ])
+
+    case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in
+    *yes+*yes) ;;
+    *) REPLACE_FSTATAT=1 ;;
+    esac
+
+    case $host_os in
+      darwin* | solaris*)
+        REPLACE_FSTATAT=1 ;;
+    esac
+
+    case $REPLACE_FSTATAT,$gl_cv_func_fstatat_zero_flag in
+      1,*yes)
+         AC_DEFINE([HAVE_WORKING_FSTATAT_ZERO_FLAG], [1],
+           [Define to 1 if fstatat (..., 0) works.
+            For example, it does not work in AIX 7.1.])
+         ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 3ad6c945df741365c6775d50e82f5cd2dc6b0c6b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fstypename.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fc5ab7a596a19db234116b85be4f9c59dd4a371c
--- /dev/null
@@ -0,0 +1,23 @@
+#serial 6
+
+dnl From Jim Meyering.
+dnl
+dnl See if struct statfs has the f_fstypename member.
+dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME.
+dnl
+
+# Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2024 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_FSTYPENAME],
+[
+  AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,
+    [
+      #include <sys/types.h>
+      #include <sys/param.h>
+      #include <sys/mount.h>
+    ])
+])
deleted file mode 120000 (symlink)
index 7c95bcccd40695b6580054d520996e6ed556359b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fsusage.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..31d424c857dfe2ae6208d758aea190e8b1fe8e22
--- /dev/null
@@ -0,0 +1,306 @@
+# serial 35
+# Obtaining file system usage information.
+
+# Copyright (C) 1997-1998, 2000-2001, 2003-2024 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.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FSUSAGE],
+[
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
+  AC_CHECK_HEADERS_ONCE([sys/vfs.h sys/fs_types.h])
+  AC_CHECK_HEADERS([sys/mount.h], [], [],
+    [AC_INCLUDES_DEFAULT
+     [#if HAVE_SYS_PARAM_H
+       #include <sys/param.h>
+      #endif]])
+  gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
+])
+
+# Try to determine how a program can obtain file system usage information.
+# If successful, define the appropriate symbol (see fsusage.c) and
+# execute ACTION-IF-FOUND.  Otherwise, execute ACTION-IF-NOT-FOUND.
+#
+# gl_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+
+AC_DEFUN([gl_FILE_SYSTEM_USAGE],
+[
+  dnl Enable large-file support. This has the effect of changing the size
+  dnl of field f_blocks in 'struct statvfs' from 32 bit to 64 bit on
+  dnl glibc/Hurd, HP-UX 11, Solaris (32-bit mode). It also changes the size
+  dnl of field f_blocks in 'struct statfs' from 32 bit to 64 bit on
+  dnl Mac OS X >= 10.5 (32-bit mode).
+  AC_REQUIRE([AC_SYS_LARGEFILE])
+
+  ac_fsusage_space=no
+
+  # Perform only the link test since it seems there are no variants of the
+  # statvfs function.  This check is more than just AC_CHECK_FUNCS([statvfs])
+  # because that got a false positive on SCO OSR5.  Adding the declaration
+  # of a 'struct statvfs' causes this test to fail (as it should) on such
+  # systems.  That system is reported to work fine with STAT_STATFS4 which
+  # is what it gets when this test fails.
+  if test $ac_fsusage_space = no; then
+    # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
+    # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS.
+    AC_CACHE_CHECK([for statvfs function (SVR4)],
+      [fu_cv_sys_stat_statvfs],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#ifdef __osf__
+"Do not use Tru64's statvfs implementation"
+#endif
+
+#include <sys/statvfs.h>
+
+struct statvfs fsd;
+
+#if defined __APPLE__ && defined __MACH__
+#include <limits.h>
+/* On Mac OS X >= 10.5, f_blocks in 'struct statvfs' is a 32-bit quantity;
+   that commonly limits file systems to 4 TiB.  Whereas f_blocks in
+   'struct statfs' is a 64-bit type, thanks to the large-file support
+   that was enabled above.  In this case, don't use statvfs(); use statfs()
+   instead.  */
+int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
+#endif
+]],
+            [[statvfs (0, &fsd);]])],
+         [fu_cv_sys_stat_statvfs=yes],
+         [fu_cv_sys_stat_statvfs=no])
+      ])
+    if test $fu_cv_sys_stat_statvfs = yes; then
+      ac_fsusage_space=yes
+      # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs.
+      # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems
+      # statvfs with large-file support is already equivalent to statvfs64.
+      AC_CACHE_CHECK([whether to use statvfs64],
+        [fu_cv_sys_stat_statvfs64],
+        [AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <sys/types.h>
+                #include <sys/statvfs.h>
+                struct statvfs64 fsd;
+                int check_f_blocks_larger_in_statvfs64
+                  [sizeof (((struct statvfs64 *) 0)->f_blocks)
+                   > sizeof (((struct statvfs *) 0)->f_blocks)
+                   ? 1 : -1];
+              ]],
+              [[statvfs64 (0, &fsd);]])],
+           [fu_cv_sys_stat_statvfs64=yes],
+           [fu_cv_sys_stat_statvfs64=no])
+        ])
+      if test $fu_cv_sys_stat_statvfs64 = yes; then
+        AC_DEFINE([STAT_STATVFS64], [1],
+          [Define if statvfs64 should be preferred over statvfs.])
+      else
+        AC_DEFINE([STAT_STATVFS], [1],
+          [Define if there is a function named statvfs.  (SVR4)])
+      fi
+    fi
+  fi
+
+  # Check for this unconditionally so we have a
+  # good fallback on glibc/Linux > 2.6 < 2.6.36
+  AC_CACHE_CHECK([for two-argument statfs with statfs.f_frsize member],
+    [fu_cv_sys_stat_statfs2_frsize],
+    [AC_RUN_IFELSE(
+       [AC_LANG_SOURCE([[
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+  int
+  main ()
+  {
+    struct statfs fsd;
+    fsd.f_frsize = 0;
+    return statfs (".", &fsd) != 0;
+  }]])],
+       [fu_cv_sys_stat_statfs2_frsize=yes],
+       [fu_cv_sys_stat_statfs2_frsize=no],
+       [fu_cv_sys_stat_statfs2_frsize=no])
+    ])
+  if test $fu_cv_sys_stat_statfs2_frsize = yes; then
+    ac_fsusage_space=yes
+    AC_DEFINE([STAT_STATFS2_FRSIZE], [1],
+      [Define if statfs takes 2 args and struct statfs has a field named f_frsize.
+       (glibc/Linux > 2.6)])
+  fi
+
+  if test $ac_fsusage_space = no; then
+    # DEC Alpha running OSF/1
+    AC_CACHE_CHECK([for 3-argument statfs function (DEC OSF/1)],
+      [fu_cv_sys_stat_statfs3_osf1],
+      [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/mount.h>
+  int
+  main ()
+  {
+    struct statfs fsd;
+    fsd.f_fsize = 0;
+    return statfs (".", &fsd, sizeof (struct statfs)) != 0;
+  }]])],
+         [fu_cv_sys_stat_statfs3_osf1=yes],
+         [fu_cv_sys_stat_statfs3_osf1=no],
+         [fu_cv_sys_stat_statfs3_osf1=no])
+      ])
+    if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
+      ac_fsusage_space=yes
+      AC_DEFINE([STAT_STATFS3_OSF1], [1],
+        [Define if statfs takes 3 args.  (DEC Alpha running OSF/1)])
+    fi
+  fi
+
+  if test $ac_fsusage_space = no; then
+    # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
+    # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
+    # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.)
+    # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and
+    # <sys/vfs.h>.)
+    # (On Solaris, statfs has 4 arguments.)
+    AC_CACHE_CHECK([for two-argument statfs with statfs.f_bsize member (AIX, 4.3BSD)],
+      [fu_cv_sys_stat_statfs2_bsize],
+      [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+  int
+  main ()
+  {
+    struct statfs fsd;
+    fsd.f_bsize = 0;
+    return statfs (".", &fsd) != 0;
+  }]])],
+         [fu_cv_sys_stat_statfs2_bsize=yes],
+         [fu_cv_sys_stat_statfs2_bsize=no],
+         [fu_cv_sys_stat_statfs2_bsize=no])
+      ])
+    if test $fu_cv_sys_stat_statfs2_bsize = yes; then
+      ac_fsusage_space=yes
+      AC_DEFINE([STAT_STATFS2_BSIZE], [1],
+        [Define if statfs takes 2 args and struct statfs has a field named f_bsize.
+         (4.3BSD, SunOS 4, HP-UX)])
+    fi
+  fi
+
+  if test $ac_fsusage_space = no; then
+    # SVR3
+    # (Solaris already handled above.)
+    AC_CACHE_CHECK([for four-argument statfs (SVR3)],
+      [fu_cv_sys_stat_statfs4],
+      [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
+#include <sys/statfs.h>
+  int
+  main ()
+  {
+    struct statfs fsd;
+    return statfs (".", &fsd, sizeof fsd, 0) != 0;
+  }]])],
+         [fu_cv_sys_stat_statfs4=yes],
+         [fu_cv_sys_stat_statfs4=no],
+         [fu_cv_sys_stat_statfs4=no])
+      ])
+    if test $fu_cv_sys_stat_statfs4 = yes; then
+      ac_fsusage_space=yes
+      AC_DEFINE([STAT_STATFS4], [1],
+        [Define if statfs takes 4 args.  (SVR3, old Irix)])
+    fi
+  fi
+
+  if test $ac_fsusage_space = no; then
+    # 4.4BSD and older NetBSD
+    # (OSF/1 already handled above.)
+    # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.)
+    # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in
+    # <sys/mount.h>.)
+    AC_CACHE_CHECK([for two-argument statfs with statfs.f_fsize member (4.4BSD and NetBSD)],
+      [fu_cv_sys_stat_statfs2_fsize],
+      [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+  int
+  main ()
+  {
+    struct statfs fsd;
+    fsd.f_fsize = 0;
+    return statfs (".", &fsd) != 0;
+  }]])],
+         [fu_cv_sys_stat_statfs2_fsize=yes],
+         [fu_cv_sys_stat_statfs2_fsize=no],
+         [fu_cv_sys_stat_statfs2_fsize=no])
+      ])
+    if test $fu_cv_sys_stat_statfs2_fsize = yes; then
+      ac_fsusage_space=yes
+      AC_DEFINE([STAT_STATFS2_FSIZE], [1],
+        [Define if statfs takes 2 args and struct statfs has a field named f_fsize.
+         (4.4BSD, NetBSD)])
+    fi
+  fi
+
+  AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
+
+])
+
+
+# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
+# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
+# enable the workaround code in fsusage.c.
+AC_DEFUN([gl_STATFS_TRUNCATES],
+[
+  AC_CACHE_CHECK([for statfs that truncates block counts],
+    [fu_cv_sys_truncating_statfs],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+#if !defined(sun) && !defined(__sun)
+choke -- this is a workaround for a Sun-specific problem
+#endif
+#include <sys/types.h>
+#include <sys/vfs.h>
+         ]],
+         [[struct statfs t; long c = *(t.f_spare);
+           if (c) return 0;
+         ]])],
+       [fu_cv_sys_truncating_statfs=yes],
+       [fu_cv_sys_truncating_statfs=no])
+    ])
+  if test $fu_cv_sys_truncating_statfs = yes; then
+    AC_DEFINE([STATFS_TRUNCATES_BLOCK_COUNTS], [1],
+      [Define if the block counts reported by statfs may be truncated to 2GB
+       and the correct values may be stored in the f_spare array.
+       (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
+       SunOS 4.1.1 seems not to be affected.)])
+  fi
+])
+
+
+# Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE.
+AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
+[
+  AC_CHECK_HEADERS([sys/fs/s5param.h sys/statfs.h])
+  gl_STATFS_TRUNCATES
+])
deleted file mode 120000 (symlink)
index 8f2442099fffb84815b9746f24370b33575e414c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fsync.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..08e3db8931e8b49fb83e461a0f6fb1645f9ec16e
--- /dev/null
@@ -0,0 +1,17 @@
+# fsync.m4 serial 2
+dnl Copyright (C) 2008-2024 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_FSYNC],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([fsync])
+  if test $ac_cv_func_fsync = no; then
+    HAVE_FSYNC=0
+  fi
+])
+
+# Prerequisites of lib/fsync.c.
+AC_DEFUN([gl_PREREQ_FSYNC], [:])
deleted file mode 120000 (symlink)
index 508fa55a827b4fbb211ba3a44d9cb9ea89dbc8a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/ftell.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a38ec5fb1dc72a28ddeb7db1b769596aa1703d2a
--- /dev/null
@@ -0,0 +1,15 @@
+# ftell.m4 serial 3
+dnl Copyright (C) 2007, 2009-2024 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_FTELL],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_FTELLO])
+  dnl When ftello needs fixes, ftell needs them too.
+  if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
+    REPLACE_FTELL=1
+  fi
+])
deleted file mode 120000 (symlink)
index 7889405956b265f8be9c13e77f1bf37433c0ca34..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/ftello.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bda8d6aed0988c348e8ba5d48af2f04ee78afff2
--- /dev/null
@@ -0,0 +1,162 @@
+# ftello.m4 serial 16
+dnl Copyright (C) 2007-2024 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_FTELLO],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
+  AC_REQUIRE([gl_SYS_TYPES_H])
+
+  dnl Persuade glibc <stdio.h> to declare ftello().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_DECLS_ONCE([ftello])
+  if test $ac_cv_have_decl_ftello = no; then
+    HAVE_DECL_FTELLO=0
+  fi
+
+  AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <stdio.h>]],
+           [[ftello (stdin);]])],
+        [gl_cv_func_ftello=yes],
+        [gl_cv_func_ftello=no])
+    ])
+  if test $gl_cv_func_ftello = no; then
+    HAVE_FTELLO=0
+  else
+    if test $WINDOWS_64_BIT_OFF_T = 1; then
+      REPLACE_FTELLO=1
+    fi
+    if test $gl_cv_var_stdin_large_offset = no; then
+      REPLACE_FTELLO=1
+    fi
+    AC_REQUIRE([AC_CANONICAL_HOST])
+    if test $REPLACE_FTELLO = 0; then
+      dnl On native Windows, in some circumstances, ftell(), ftello(),
+      dnl fgetpos(), lseek(), _lseeki64() all succeed on devices of type
+      dnl FILE_TYPE_PIPE. However, to match POSIX behaviour, we want
+      dnl ftell(), ftello(), fgetpos(), lseek() to fail when the argument fd
+      dnl designates a pipe. See also
+      dnl https://github.com/python/cpython/issues/78961#issuecomment-1093800325
+      case "$host_os" in
+        mingw* | windows*) REPLACE_FTELLO=1 ;;
+      esac
+    fi
+    if test $REPLACE_FTELLO = 0; then
+      dnl Detect bug on Solaris.
+      dnl ftell and ftello produce incorrect results after putc that followed a
+      dnl getc call that reached EOF on Solaris. This is because the _IOREAD
+      dnl flag does not get cleared in this case, even though _IOWRT gets set,
+      dnl and ftell and ftello look whether the _IOREAD flag is set.
+      AC_CACHE_CHECK([whether ftello works],
+        [gl_cv_func_ftello_works],
+        [
+          dnl Initial guess, used when cross-compiling or when /dev/tty cannot
+          dnl be opened.
+changequote(,)dnl
+          case "$host_os" in
+                               # Guess no on Solaris.
+            solaris*)          gl_cv_func_ftello_works="guessing no" ;;
+                               # Guess yes on native Windows.
+            mingw* | windows*) gl_cv_func_ftello_works="guessing yes" ;;
+                               # Guess yes otherwise.
+            *)                 gl_cv_func_ftello_works="guessing yes" ;;
+          esac
+changequote([,])dnl
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define TESTFILE "conftest.tmp"
+int
+main (void)
+{
+  FILE *fp;
+
+  /* Create a file with some contents.  */
+  fp = fopen (TESTFILE, "w");
+  if (fp == NULL)
+    return 70;
+  if (fwrite ("foogarsh", 1, 8, fp) < 8)
+    { fclose (fp); return 71; }
+  if (fclose (fp))
+    return 72;
+
+  /* The file's contents is now "foogarsh".  */
+
+  /* Try writing after reading to EOF.  */
+  fp = fopen (TESTFILE, "r+");
+  if (fp == NULL)
+    return 73;
+  if (fseek (fp, -1, SEEK_END))
+    { fclose (fp); return 74; }
+  if (!(getc (fp) == 'h'))
+    { fclose (fp); return 1; }
+  if (!(getc (fp) == EOF))
+    { fclose (fp); return 2; }
+  if (!(ftell (fp) == 8))
+    { fclose (fp); return 3; }
+  if (!(ftell (fp) == 8))
+    { fclose (fp); return 4; }
+  if (!(putc ('!', fp) == '!'))
+    { fclose (fp); return 5; }
+  if (!(ftell (fp) == 9))
+    { fclose (fp); return 6; }
+  if (!(fclose (fp) == 0))
+    return 7;
+  fp = fopen (TESTFILE, "r");
+  if (fp == NULL)
+    return 75;
+  {
+    char buf[10];
+    if (!(fread (buf, 1, 10, fp) == 9))
+      { fclose (fp); return 10; }
+    if (!(memcmp (buf, "foogarsh!", 9) == 0))
+      { fclose (fp); return 11; }
+  }
+  if (!(fclose (fp) == 0))
+    return 12;
+
+  /* The file's contents is now "foogarsh!".  */
+
+  return 0;
+}]])],
+            [gl_cv_func_ftello_works=yes],
+            [gl_cv_func_ftello_works=no], [:])
+        ])
+      case "$gl_cv_func_ftello_works" in
+        *yes) ;;
+        *)
+          REPLACE_FTELLO=1
+          AC_DEFINE([FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE], [1],
+            [Define to 1 if the system's ftello function has the Solaris bug.])
+          ;;
+      esac
+    fi
+    if test $REPLACE_FTELLO = 0; then
+      dnl Detect bug on macOS >= 10.15.
+      gl_FUNC_UNGETC_WORKS
+      if test $gl_ftello_broken_after_ungetc = yes; then
+        REPLACE_FTELLO=1
+        AC_DEFINE([FTELLO_BROKEN_AFTER_UNGETC], [1],
+          [Define to 1 if the system's ftello function has the macOS bug.])
+      fi
+    fi
+  fi
+])
+
+# Prerequisites of lib/ftello.c.
+AC_DEFUN([gl_PREREQ_FTELLO],
+[
+  dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64
+  dnl makes it usable again.
+  AC_CHECK_FUNCS([_ftelli64])
+])
deleted file mode 120000 (symlink)
index 69e5ab33867839dfaa212163a9c746044150c0c5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/ftruncate.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f547a95d0b94f806571748214ad4324820c5cdf9
--- /dev/null
@@ -0,0 +1,43 @@
+# serial 24
+
+# See if we need to emulate a missing ftruncate function using _chsize.
+
+# Copyright (C) 2000-2001, 2003-2007, 2009-2024 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_FUNC_FTRUNCATE],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  gl_CHECK_FUNCS_ANDROID([ftruncate], [[#include <unistd.h>]])
+  if test $ac_cv_func_ftruncate = yes; then
+    m4_ifdef([gl_LARGEFILE], [
+      AC_REQUIRE([AC_CANONICAL_HOST])
+      case "$host_os" in
+        mingw* | windows*)
+          dnl Native Windows, and Large File Support is requested.
+          dnl The MSVCRT _chsize() function only accepts a 32-bit file size,
+          dnl and the mingw64 ftruncate64() function is unreliable (it may
+          dnl delete the file, see
+          dnl <https://web.archive.org/web/20160425005423/http://mingw-w64.sourcearchive.com/documentation/2.0-1/ftruncate64_8c_source.html>).
+          dnl Use gnulib's ftruncate() implementation instead.
+          REPLACE_FTRUNCATE=1
+          ;;
+      esac
+    ], [
+      :
+    ])
+  else
+    HAVE_FTRUNCATE=0
+    case "$gl_cv_onwards_func_ftruncate" in
+      future*) REPLACE_FTRUNCATE=1 ;;
+    esac
+  fi
+])
+
+# Prerequisites of lib/ftruncate.c.
+AC_DEFUN([gl_PREREQ_FTRUNCATE],
+[
+  AC_CHECK_FUNCS([_chsize])
+])
deleted file mode 120000 (symlink)
index dc4602bee04d41d6b5c3ce2d17109e7de2d6f678..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/fts.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6bacc967ad61bbda80c5e618cb109b24179513b0
--- /dev/null
@@ -0,0 +1,53 @@
+#serial 24
+dnl Copyright (C) 2005-2024 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_FTS],
+[
+  gl_FUNC_FTS_CORE
+])
+
+AC_DEFUN([gl_FUNC_FTS_CORE],
+[
+  dnl Prerequisites of lib/fts.c.
+  gl_FUNC_OPENAT
+
+  AC_CHECK_FUNCS_ONCE([fstatfs])
+  AC_CHECK_HEADERS_ONCE([sys/param.h sys/vfs.h])dnl
+  if test "$ac_cv_func_fstatfs,$ac_cv_header_sys_vfs_h" = yes,yes; then
+    AC_CHECK_MEMBERS([struct statfs.f_type], [], [],
+      [[$ac_includes_default
+        #include <sys/vfs.h>
+      ]])
+    if test "$ac_cv_member_struct_statfs_f_type" = yes; then
+      AC_CHECK_TYPES([__fsword_t], [], [],
+        [[$ac_includes_default
+          #include <sys/vfs.h>
+        ]])
+    fi
+  fi
+
+  gl_CHECK_FUNCS_ANDROID([fts_open], [[#include <fts.h>]])
+  if case "$gl_cv_onwards_func_fts_open" in \
+       yes | future*) true ;; \
+       *) false ;; \
+     esac; then
+    dnl The system already has the symbols fts_open, etc. or will have them
+    dnl in a future version.
+    dnl Avoid conflicts between these symbols and ours at the linker level.
+    AC_DEFINE([fts_open], [rpl_fts_open],
+      [Define to the overridden function name])
+    AC_DEFINE([fts_close], [rpl_fts_close],
+      [Define to the overridden function name])
+    AC_DEFINE([fts_read], [rpl_fts_read],
+      [Define to the overridden function name])
+    AC_DEFINE([fts_set], [rpl_fts_set],
+      [Define to the overridden function name])
+    AC_DEFINE([fts_children], [rpl_fts_children],
+      [Define to the overridden function name])
+    AC_DEFINE([fts_cross_check], [rpl_fts_cross_check],
+      [Define to the overridden function name])
+  fi
+])
deleted file mode 120000 (symlink)
index b697918086d34256a6a2598d829ec6fa800c5df1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/futimens.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ac961e7bde5f4cf252bba9500f20480691bb59c0
--- /dev/null
@@ -0,0 +1,69 @@
+# serial 11
+# See if we need to provide futimens replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_FUTIMENS],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  gl_CHECK_FUNCS_ANDROID([futimens], [[#include <sys/stat.h>]])
+  if test $ac_cv_func_futimens = no; then
+    HAVE_FUTIMENS=0
+    case "$gl_cv_onwards_func_futimens" in
+      future*) REPLACE_FUTIMENS=1 ;;
+    esac
+  else
+    AC_CACHE_CHECK([whether futimens works],
+      [gl_cv_func_futimens_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+]GL_MDA_DEFINES],
+     [[struct timespec ts[2];
+      int fd = creat ("conftest.file", 0600);
+      struct stat st;
+      if (fd < 0) return 1;
+      ts[0].tv_sec = 1;
+      ts[0].tv_nsec = UTIME_OMIT;
+      ts[1].tv_sec = 1;
+      ts[1].tv_nsec = UTIME_NOW;
+      errno = 0;
+      if (futimens (AT_FDCWD, NULL) == 0) return 2;
+      if (errno != EBADF) return 3;
+      if (futimens (fd, ts)) return 4;
+      sleep (1);
+      ts[0].tv_nsec = UTIME_NOW;
+      ts[1].tv_nsec = UTIME_OMIT;
+      if (futimens (fd, ts)) return 5;
+      if (fstat (fd, &st)) return 6;
+      if (st.st_ctime < st.st_atime) return 7;
+      ]])],
+         [gl_cv_func_futimens_works=yes],
+         [gl_cv_func_futimens_works=no],
+         [case "$host_os" in
+                           # Guess no on glibc systems.
+            *-gnu* | gnu*) gl_cv_func_futimens_works="guessing no" ;;
+                           # Guess no on musl systems.
+            *-musl*)       gl_cv_func_futimens_works="guessing no" ;;
+                           # Guess yes otherwise.
+            *)             gl_cv_func_futimens_works="guessing yes" ;;
+          esac
+         ])
+      rm -f conftest.file])
+    case "$gl_cv_func_futimens_works" in
+      *yes) ;;
+      *)
+        REPLACE_FUTIMENS=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 9bdfa5a68b689345ee32fe9c1a39c89c03670efb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getaddrinfo.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..30816308ab7ec825c649cf98bd43a383ac9a6e25
--- /dev/null
@@ -0,0 +1,238 @@
+# getaddrinfo.m4 serial 34
+dnl Copyright (C) 2004-2024 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_GETADDRINFO],
+[
+  AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+  AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H
+  GETADDRINFO_LIB=
+  gai_saved_LIBS="$LIBS"
+
+  dnl Where is getaddrinfo()?
+  dnl - On Solaris, it is in libsocket.
+  dnl - On Haiku, it is in libnetwork.
+  dnl - On BeOS, it is in libnet.
+  dnl - On native Windows, it is in ws2_32.dll.
+  dnl - Otherwise it is in libc.
+  AC_SEARCH_LIBS([getaddrinfo], [socket network net],
+    [if test "$ac_cv_search_getaddrinfo" != "none required"; then
+       GETADDRINFO_LIB="$ac_cv_search_getaddrinfo"
+     fi])
+  LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
+
+  HAVE_GETADDRINFO=1
+  AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#include <stddef.h>
+]], [[getaddrinfo("", "", NULL, NULL);]])],
+      [gl_cv_func_getaddrinfo=yes],
+      [gl_cv_func_getaddrinfo=no])])
+  if test $gl_cv_func_getaddrinfo = no; then
+    AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32],
+                   gl_cv_w32_getaddrinfo, [
+      gl_cv_w32_getaddrinfo=no
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS -lws2_32"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes])
+      LIBS="$am_save_LIBS"
+    ])
+    if test "$gl_cv_w32_getaddrinfo" = "yes"; then
+      GETADDRINFO_LIB="-lws2_32"
+      LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
+      dnl Check for correct signature, in particular for a cdecl-compatible
+      dnl calling convention.
+      AC_CACHE_CHECK([for getaddrinfo with POSIX signature],
+        [gl_cv_func_getaddrinfo_posix_signature],
+        [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+int getaddrinfo (const char *, const char *, const struct addrinfo *, struct addrinfo **);
+]])],
+           [gl_cv_func_getaddrinfo_posix_signature=yes],
+           [gl_cv_func_getaddrinfo_posix_signature=no])
+        ])
+      if test $gl_cv_func_getaddrinfo_posix_signature = no; then
+        REPLACE_GETADDRINFO=1
+      fi
+    else
+      HAVE_GETADDRINFO=0
+    fi
+  fi
+  AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO],
+    [Define to 1 if getaddrinfo exists, or to 0 otherwise.])
+
+  # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
+  # inline function declared in ws2tcpip.h, so we need to get that
+  # header included somehow.
+  AC_CHECK_DECLS([gai_strerror], [], [], [[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+]])
+  if test $ac_cv_have_decl_gai_strerror = yes; then
+    AC_CHECK_DECLS([gai_strerrorA], [], [], [[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+]])
+    dnl check for correct signature
+    AC_CACHE_CHECK([for gai_strerror with POSIX signature],
+     [gl_cv_func_gai_strerror_posix_signature], [
+      AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *gai_strerror(int);]])],
+        [gl_cv_func_gai_strerror_posix_signature=yes],
+        [gl_cv_func_gai_strerror_posix_signature=no])])
+    if test $gl_cv_func_gai_strerror_posix_signature = no; then
+      REPLACE_GAI_STRERROR=1
+    fi
+  fi
+
+  LIBS="$gai_saved_LIBS"
+
+  gl_PREREQ_GETADDRINFO
+
+  AC_SUBST([GETADDRINFO_LIB])
+])
+
+# Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c.
+AC_DEFUN([gl_PREREQ_GETADDRINFO], [
+  AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+  AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+  AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB
+  AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB
+  AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([gl_SOCKET_FAMILIES])
+  AC_REQUIRE([gl_SYS_SOCKET_H])
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl Including sys/socket.h is wrong for Windows, but Windows does not
+  dnl have sa_len so the result is correct anyway.
+  AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [
+#include <sys/types.h>
+#include <sys/socket.h>
+])
+
+  AC_CHECK_HEADERS_ONCE([netinet/in.h])
+
+  AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[[
+  /* sys/types.h is not needed according to POSIX, but the
+     sys/socket.h in i386-unknown-freebsd4.10 and
+     powerpc-apple-darwin5.5 required it. */
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+]])
+  if test $ac_cv_have_decl_getaddrinfo = no; then
+    HAVE_DECL_GETADDRINFO=0
+  fi
+  if test $ac_cv_have_decl_freeaddrinfo = no; then
+    HAVE_DECL_FREEADDRINFO=0
+  fi
+  if test $ac_cv_have_decl_gai_strerror = no; then
+    HAVE_DECL_GAI_STRERROR=0
+  fi
+  if test $ac_cv_have_decl_getnameinfo = no; then
+    HAVE_DECL_GETNAMEINFO=0
+  fi
+
+  AC_CHECK_TYPES([struct addrinfo],,,[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+])
+  if test $ac_cv_type_struct_addrinfo = no; then
+    HAVE_STRUCT_ADDRINFO=0
+  fi
+
+  dnl Append $HOSTENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
+  case " $GETADDRINFO_LIB " in
+    *" $HOSTENT_LIB "*) ;;
+    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $HOSTENT_LIB" ;;
+  esac
+
+  dnl Append $SERVENT_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
+  case " $GETADDRINFO_LIB " in
+    *" $SERVENT_LIB "*) ;;
+    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;;
+  esac
+
+  dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates.
+  case " $GETADDRINFO_LIB " in
+    *" $INET_NTOP_LIB "*) ;;
+    *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;;
+  esac
+])
deleted file mode 120000 (symlink)
index ca7121c98e47650f98a5ce3865611ce351b647ee..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getcwd-abort-bug.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..11f6a8a4c5a12b5c6eff79653f7485924d7b9876
--- /dev/null
@@ -0,0 +1,158 @@
+# serial 16
+# Determine whether getcwd aborts when the length of the working directory
+# name is unusually large.  Any length between 4k and 16k trigger the bug
+# when using glibc-2.4.90-9 or older.
+
+# Copyright (C) 2006, 2009-2024 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.
+
+# From Jim Meyering
+
+# gl_FUNC_GETCWD_ABORT_BUG([ACTION-IF-BUGGY[, ACTION-IF-WORKS]])
+AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_DECLS_ONCE([getcwd])
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ])
+
+  gl_CHECK_FUNC_GETPAGESIZE
+  if test $gl_cv_func_getpagesize = yes; then
+    AC_DEFINE_UNQUOTED([HAVE_GETPAGESIZE], [1],
+      [Define to 1 if the system has the 'getpagesize' function.])
+  fi
+
+  AC_CACHE_CHECK([whether getcwd succeeds when 4k < cwd_length < 16k],
+    [gl_cv_func_getcwd_succeeds_beyond_4k],
+    [# Remove any remnants of a previous test.
+     rm -rf confdir-14B---
+     # Arrange for deletion of the temporary directory this test creates.
+     ac_clean_files="$ac_clean_files confdir-14B---"
+     dnl Please keep this in sync with tests/test-getcwd.c.
+     AC_RUN_IFELSE(
+       [AC_LANG_SOURCE(
+          [[
+#include <errno.h>
+#include <stdlib.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#else /* on Windows with MSVC */
+# include <direct.h>
+#endif
+#include <string.h>
+#include <sys/stat.h>
+
+]gl_PATHMAX_SNIPPET[
+]GL_MDA_DEFINES[
+
+#ifndef S_IRWXU
+# define S_IRWXU 0700
+#endif
+
+/* FIXME: skip the run-test altogether on systems without getpagesize.  */
+#if ! HAVE_GETPAGESIZE
+# define getpagesize() 0
+#endif
+
+/* This size is chosen to be larger than PATH_MAX (4k), yet smaller than
+   the 16kB pagesize on ia64 linux.  Those conditions make the code below
+   trigger a bug in glibc's getcwd implementation before 2.4.90-10.  */
+#define TARGET_LEN (5 * 1024)
+
+int
+main ()
+{
+  char *cwd;
+  size_t initial_cwd_len;
+  int fail = 0;
+
+  /* The bug is triggered when PATH_MAX < getpagesize (), so skip
+     this relatively expensive and invasive test if that's not true.  */
+#ifdef PATH_MAX
+  int bug_possible = PATH_MAX < getpagesize ();
+#else
+  int bug_possible = 0;
+#endif
+  if (! bug_possible)
+    return 0;
+
+  cwd = getcwd (NULL, 0);
+  if (cwd == NULL)
+    return 2;
+
+  initial_cwd_len = strlen (cwd);
+  free (cwd);
+
+  if (1)
+    {
+      static char const dir_name[] = "confdir-14B---";
+      size_t desired_depth = ((TARGET_LEN - 1 - initial_cwd_len)
+                              / sizeof dir_name);
+      size_t d;
+      for (d = 0; d < desired_depth; d++)
+        {
+          if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0)
+            {
+              if (! (errno == ERANGE || errno == ENAMETOOLONG
+                     || errno == ENOENT))
+                fail = 3; /* Unable to construct deep hierarchy.  */
+              break;
+            }
+        }
+
+      /* If libc has the bug in question, this invocation of getcwd
+         results in a failed assertion.  */
+      cwd = getcwd (NULL, 0);
+      if (cwd == NULL)
+        fail = 4; /* getcwd didn't assert, but it failed for a long name
+                     where the answer could have been learned.  */
+      free (cwd);
+
+      /* Call rmdir first, in case the above chdir failed.  */
+      rmdir (dir_name);
+      while (0 < d--)
+        {
+          if (chdir ("..") < 0)
+            {
+              fail = 5;
+              break;
+            }
+          rmdir (dir_name);
+        }
+    }
+
+  return fail;
+}
+          ]])],
+       [gl_cv_func_getcwd_succeeds_beyond_4k=yes],
+       [dnl An abort will provoke an exit code of something like 134 (128 + 6).
+        dnl An exit code of 4 can also occur (for example in
+        dnl musl libc 1.2.2/powerpc64le, NetBSD 9.0, OpenBSD 6.7:
+        dnl getcwd (NULL, 0) fails rather than returning a string longer than
+        dnl PATH_MAX.  This may be POSIX compliant (in some interpretations of
+        dnl POSIX).  But gnulib's getcwd module wants to provide a non-NULL
+        dnl value in this case.
+        ret=$?
+        if test $ret -ge 128 || test $ret = 4; then
+          gl_cv_func_getcwd_succeeds_beyond_4k=no
+        else
+          gl_cv_func_getcwd_succeeds_beyond_4k=yes
+        fi
+       ],
+       [case "$host_os" in
+             # Guess no otherwise, even on glibc systems and musl systems.
+          *) gl_cv_func_getcwd_succeeds_beyond_4k="guessing no"
+        esac
+       ])
+    ])
+  case "$gl_cv_func_getcwd_succeeds_beyond_4k" in
+    *no)
+      $1
+      ;;
+    *)
+      $2
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index e22ad057d402dc8bd34ad88895241f255344039b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getcwd-path-max.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d30e75af601b15d2733e027b3dd253e724e58aa7
--- /dev/null
@@ -0,0 +1,236 @@
+# serial 25
+# Check for several getcwd bugs with long file names.
+# If so, arrange to compile the wrapper function.
+
+# This is necessary for at least GNU libc on linux-2.4.19 and 2.4.20.
+# I've heard that this is due to a Linux kernel bug, and that it has
+# been fixed between 2.4.21-pre3 and 2.4.21-pre4.
+
+# Copyright (C) 2003-2007, 2009-2024 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.
+
+# From Jim Meyering
+
+AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX],
+[
+  AC_CHECK_DECLS_ONCE([getcwd])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ])
+  AC_CACHE_CHECK([whether getcwd handles long file names properly],
+    [gl_cv_func_getcwd_path_max],
+    [# Arrange for deletion of the temporary directory this test creates.
+     ac_clean_files="$ac_clean_files confdir3"
+     dnl Please keep this in sync with tests/test-getcwd.c.
+     AC_RUN_IFELSE(
+       [AC_LANG_SOURCE(
+          [[
+#include <errno.h>
+#include <stdlib.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#else
+# include <direct.h>
+#endif
+#include <string.h>
+#include <limits.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+]gl_PATHMAX_SNIPPET[
+
+#ifndef AT_FDCWD
+# define AT_FDCWD 0
+#endif
+#ifdef ENAMETOOLONG
+# define is_ENAMETOOLONG(x) ((x) == ENAMETOOLONG)
+#else
+# define is_ENAMETOOLONG(x) 0
+#endif
+
+/* Use the getcwd function, not any macro.  */
+#undef getcwd
+
+]GL_MDA_DEFINES[
+
+#ifndef S_IRWXU
+# define S_IRWXU 0700
+#endif
+
+/* The length of this name must be 8.  */
+#define DIR_NAME "confdir3"
+#define DIR_NAME_LEN 8
+#define DIR_NAME_SIZE (DIR_NAME_LEN + 1)
+
+/* The length of "../".  */
+#define DOTDOTSLASH_LEN 3
+
+/* Leftover bytes in the buffer, to work around library or OS bugs.  */
+#define BUF_SLOP 20
+
+int
+main ()
+{
+#ifndef PATH_MAX
+  /* The Hurd doesn't define this, so getcwd can't exhibit the bug --
+     at least not on a local file system.  And if we were to start worrying
+     about remote file systems, we'd have to enable the wrapper function
+     all of the time, just to be safe.  That's not worth the cost.  */
+  exit (0);
+#elif ((INT_MAX / (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) \
+        - DIR_NAME_SIZE - BUF_SLOP) \
+       <= PATH_MAX)
+  /* FIXME: Assuming there's a system for which this is true,
+     this should be done in a compile test.  */
+  exit (0);
+#else
+  char buf[PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1)
+           + DIR_NAME_SIZE + BUF_SLOP];
+  char *cwd = getcwd (buf, PATH_MAX);
+  size_t initial_cwd_len;
+  size_t cwd_len;
+  int fail = 0;
+  size_t n_chdirs = 0;
+
+  if (cwd == NULL)
+    exit (10);
+
+  cwd_len = initial_cwd_len = strlen (cwd);
+
+  while (1)
+    {
+      size_t dotdot_max = PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN);
+      char *c = NULL;
+
+      cwd_len += DIR_NAME_SIZE;
+      /* If mkdir or chdir fails, it could be that this system cannot create
+         any file with an absolute name longer than PATH_MAX, such as cygwin.
+         If so, leave fail as 0, because the current working directory can't
+         be too long for getcwd if it can't even be created.  On Linux with
+         the 9p file system, mkdir fails with error EINVAL when cwd_len gets
+         too long; ignore this failure because the getcwd() system call
+         produces good results whereas the gnulib substitute calls getdents64
+         which fails with error EPROTO.
+         For other errors, be pessimistic and consider that as a failure,
+         too.  */
+      if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0)
+        {
+          if (! (errno == ERANGE || is_ENAMETOOLONG (errno)))
+            #ifdef __linux__
+            if (! (errno == EINVAL))
+            #endif
+              fail = 20;
+          break;
+        }
+
+      if (PATH_MAX <= cwd_len && cwd_len < PATH_MAX + DIR_NAME_SIZE)
+        {
+          struct stat sb;
+
+          c = getcwd (buf, PATH_MAX);
+          if (!c && errno == ENOENT)
+            {
+              fail = 11;
+              break;
+            }
+          if (c)
+            {
+              fail = 31;
+              break;
+            }
+          if (! (errno == ERANGE || is_ENAMETOOLONG (errno)))
+            {
+              fail = 21;
+              break;
+            }
+
+          /* Our replacement needs to be able to stat() long ../../paths,
+             so generate a path larger than PATH_MAX to check,
+             avoiding the replacement if we can't stat().  */
+          c = getcwd (buf, cwd_len + 1);
+          if (c && !AT_FDCWD && stat (c, &sb) != 0 && is_ENAMETOOLONG (errno))
+            {
+              fail = 32;
+              break;
+            }
+        }
+
+      if (dotdot_max <= cwd_len - initial_cwd_len)
+        {
+          if (dotdot_max + DIR_NAME_SIZE < cwd_len - initial_cwd_len)
+            break;
+          c = getcwd (buf, cwd_len + 1);
+          if (!c)
+            {
+              if (! (errno == ERANGE || errno == ENOENT
+                     || is_ENAMETOOLONG (errno)))
+                {
+                  fail = 22;
+                  break;
+                }
+              if (AT_FDCWD || errno == ERANGE || errno == ENOENT)
+                {
+                  fail = 12;
+                  break;
+                }
+            }
+        }
+
+      if (c && strlen (c) != cwd_len)
+        {
+          fail = 23;
+          break;
+        }
+      ++n_chdirs;
+    }
+
+  /* Leaving behind such a deep directory is not polite.
+     So clean up here, right away, even though the driving
+     shell script would also clean up.  */
+  {
+    size_t i;
+
+    /* Try rmdir first, in case the chdir failed.  */
+    rmdir (DIR_NAME);
+    for (i = 0; i <= n_chdirs; i++)
+      {
+        if (chdir ("..") < 0)
+          break;
+        if (rmdir (DIR_NAME) != 0)
+          break;
+      }
+  }
+
+  exit (fail);
+#endif
+}
+          ]])],
+       [gl_cv_func_getcwd_path_max=yes],
+       [case $? in
+        10|11|12) gl_cv_func_getcwd_path_max='no, but it is partly working';;
+        31) gl_cv_func_getcwd_path_max='no, it has the AIX bug';;
+        32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';;
+        *) gl_cv_func_getcwd_path_max=no;;
+        esac],
+       [# Cross-compilation guesses:
+        case "$host_os" in
+          aix*) # On AIX, it has the AIX bug.
+            gl_cv_func_getcwd_path_max='guessing no, it has the AIX bug' ;;
+          gnu*) # On Hurd, it is 'yes'.
+            gl_cv_func_getcwd_path_max='guessing yes' ;;
+          linux* | kfreebsd*)
+            # On older Linux+glibc it's 'no, but it is partly working',
+            # on newer Linux+glibc it's 'yes'.
+            # On Linux+musl libc, it's 'no, but it is partly working'.
+            # On kFreeBSD+glibc, it's 'no, but it is partly working'.
+            gl_cv_func_getcwd_path_max='guessing no, but it is partly working' ;;
+          *) # If we don't know, obey --enable-cross-guesses.
+            gl_cv_func_getcwd_path_max="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
+])
deleted file mode 120000 (symlink)
index b6deda411f1cc2b0320a3675feb6be930a57ab58..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getcwd.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..558a032f1b688e8c3e34129e26fef25687fd94b0
--- /dev/null
@@ -0,0 +1,168 @@
+# getcwd.m4 - check for working getcwd that is compatible with glibc
+
+# Copyright (C) 2001, 2003-2007, 2009-2024 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.
+
+# Written by Paul Eggert.
+# serial 21
+
+AC_DEFUN([gl_FUNC_GETCWD_NULL],
+  [
+   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+   AC_CHECK_HEADERS_ONCE([unistd.h])
+   AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
+     [gl_cv_func_getcwd_null],
+     [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#       include <stdlib.h>
+#        if HAVE_UNISTD_H
+#         include <unistd.h>
+#        else /* on Windows with MSVC */
+#         include <direct.h>
+#        endif
+         ]GL_MDA_DEFINES[
+#        ifndef getcwd
+         char *getcwd ();
+#        endif
+]], [[
+#if defined _WIN32 && ! defined __CYGWIN__
+/* mingw cwd does not start with '/', but _getcwd does allocate.
+   However, mingw fails to honor non-zero size.  */
+#else
+           if (chdir ("/") != 0)
+             return 1;
+           else
+             {
+               char *f = getcwd (NULL, 0);
+               if (! f)
+                 return 2;
+               if (f[0] != '/')
+                 { free (f); return 3; }
+               if (f[1] != '\0')
+                 { free (f); return 4; }
+               free (f);
+               return 0;
+             }
+#endif
+         ]])],
+        [gl_cv_func_getcwd_null=yes],
+        [gl_cv_func_getcwd_null=no],
+        [[case "$host_os" in
+                           # Guess yes on glibc systems.
+            *-gnu* | gnu*) gl_cv_func_getcwd_null="guessing yes";;
+                           # Guess yes on musl systems.
+            *-musl*)       gl_cv_func_getcwd_null="guessing yes";;
+                           # Guess yes on systems that emulate the Linux system calls.
+            midipix*)      gl_cv_func_getcwd_null="guessing yes";;
+                           # Guess yes on Cygwin.
+            cygwin*)       gl_cv_func_getcwd_null="guessing yes";;
+                           # If we don't know, obey --enable-cross-guesses.
+            *)             gl_cv_func_getcwd_null="$gl_cross_guess_normal";;
+          esac
+        ]])])
+])
+
+AC_DEFUN([gl_FUNC_GETCWD_SIGNATURE],
+[
+  AC_CACHE_CHECK([for getcwd with POSIX signature],
+    [gl_cv_func_getcwd_posix_signature],
+    [AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[#include <unistd.h>
+         ]GL_MDA_DEFINES],
+         [[extern
+           #ifdef __cplusplus
+           "C"
+           #endif
+           char *getcwd (char *, size_t);
+         ]])
+      ],
+      [gl_cv_func_getcwd_posix_signature=yes],
+      [gl_cv_func_getcwd_posix_signature=no])
+   ])
+])
+
+dnl Guarantee that getcwd will malloc with a NULL first argument.  Assumes
+dnl that either the system getcwd is robust, or that calling code is okay
+dnl with spurious failures when run from a directory with an absolute name
+dnl larger than 4k bytes.
+dnl
+dnl Assumes that getcwd exists; if you are worried about obsolete
+dnl platforms that lacked getcwd(), then you need to use the GPL module.
+AC_DEFUN([gl_FUNC_GETCWD_LGPL],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+  AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
+
+  case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in
+  *yes,yes) ;;
+  *)
+    dnl Minimal replacement lib/getcwd-lgpl.c.
+    REPLACE_GETCWD=1
+    ;;
+  esac
+])
+
+dnl Check for all known getcwd bugs; useful for a program likely to be
+dnl executed from an arbitrary location.
+AC_DEFUN([gl_FUNC_GETCWD],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+  AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  gl_abort_bug=no
+  case "$host_os" in
+    mingw* | windows*)
+      gl_cv_func_getcwd_path_max=yes
+      ;;
+    *)
+      gl_FUNC_GETCWD_PATH_MAX
+      case "$gl_cv_func_getcwd_null" in
+        *yes)
+          gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes])
+          ;;
+      esac
+      ;;
+  esac
+  dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD
+  dnl if appropriate.
+  case "$gl_cv_func_getcwd_path_max" in
+    *"no" | *"no, it has the AIX bug") ;;
+    *)
+      AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1],
+        [Define to 1 if getcwd minimally works, that is, its result can be
+         trusted when it succeeds.])
+      ;;
+  esac
+  case "$gl_cv_func_getcwd_path_max" in
+    *"no, but it is partly working")
+      AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1],
+        [Define to 1 if getcwd works, except it sometimes fails when it
+         shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.])
+      ;;
+    *"yes, but with shorter paths")
+      AC_DEFINE([HAVE_GETCWD_SHORTER], [1],
+        [Define to 1 if getcwd works, but with shorter paths
+         than is generally tested with the replacement.])
+      ;;
+  esac
+
+  if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \
+     || test $gl_cv_func_getcwd_posix_signature != yes \
+     || { case "$gl_cv_func_getcwd_path_max" in *yes*) false;; *) true;; esac; } \
+     || test $gl_abort_bug = yes; then
+    REPLACE_GETCWD=1
+  fi
+])
+
+# Prerequisites of lib/getcwd.c, when full replacement is in effect.
+AC_DEFUN([gl_PREREQ_GETCWD],
+[
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
+  :
+])
deleted file mode 120000 (symlink)
index 3c3236b72cf4085cd9ea1b7a15a551b4eec22e86..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getdelim.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0dbd8bc6f8b9b3acb39b0d63792c06fff3ffb038
--- /dev/null
@@ -0,0 +1,114 @@
+# getdelim.m4 serial 19
+
+dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc.
+dnl
+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_PREREQ([2.59])
+
+AC_DEFUN([gl_FUNC_GETDELIM],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl Persuade glibc <stdio.h> to declare getdelim().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_DECLS_ONCE([getdelim])
+
+  gl_CHECK_FUNCS_ANDROID([getdelim], [[#include <stdio.h>]])
+  if test $ac_cv_func_getdelim = yes; then
+    HAVE_GETDELIM=1
+    dnl Found it in some library.  Verify that it works.
+    AC_CACHE_CHECK([for working getdelim function],
+      [gl_cv_func_working_getdelim],
+      [case "$host_os" in
+         darwin*)
+           dnl On macOS 10.13, valgrind detected an out-of-bounds read during
+           dnl the GNU sed test suite:
+           dnl   Invalid read of size 16
+           dnl      at 0x100EE6A05: _platform_memchr$VARIANT$Base (in /usr/lib/system/libsystem_platform.dylib)
+           dnl      by 0x100B7B0BD: getdelim (in /usr/lib/system/libsystem_c.dylib)
+           dnl      by 0x10000B0BE: ck_getdelim (utils.c:254)
+           gl_cv_func_working_getdelim=no ;;
+         *)
+           echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
+           AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#    include <stdio.h>
+#    include <stdlib.h>
+#    include <string.h>
+    int main ()
+    {
+      FILE *in = fopen ("./conftest.data", "r");
+      if (!in)
+        return 1;
+      {
+        /* Test result for a NULL buffer and a zero size.
+           Based on a test program from Karl Heuer.  */
+        char *line = NULL;
+        size_t siz = 0;
+        int len = getdelim (&line, &siz, '\n', in);
+        if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
+          { free (line); fclose (in); return 2; }
+        free (line);
+      }
+      {
+        /* Test result for a NULL buffer and a non-zero size.
+           This crashes on FreeBSD 8.0.  */
+        char *line = NULL;
+        size_t siz = (size_t)(~0) / 4;
+        if (getdelim (&line, &siz, '\n', in) == -1)
+          { fclose (in); return 3; }
+        free (line);
+      }
+      fclose (in);
+      return 0;
+    }
+    ]])],
+             [gl_cv_func_working_getdelim=yes],
+             [gl_cv_func_working_getdelim=no],
+             [dnl We're cross compiling.
+              dnl Guess it works on glibc2 systems and musl systems.
+              AC_EGREP_CPP([Lucky GNU user],
+                [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ >= 2) && !defined __UCLIBC__
+  Lucky GNU user
+ #endif
+#endif
+                ],
+                [gl_cv_func_working_getdelim="guessing yes"],
+                [case "$host_os" in
+                   *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;;
+                   *)                  gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
+                 esac
+                ])
+             ])
+           ;;
+       esac
+      ])
+    case "$gl_cv_func_working_getdelim" in
+      *yes) ;;
+      *) REPLACE_GETDELIM=1 ;;
+    esac
+  else
+    HAVE_GETDELIM=0
+    case "$gl_cv_onwards_func_getdelim" in
+      future*) REPLACE_GETDELIM=1 ;;
+    esac
+  fi
+
+  if test $ac_cv_have_decl_getdelim = no; then
+    HAVE_DECL_GETDELIM=0
+  fi
+])
+
+# Prerequisites of lib/getdelim.c.
+AC_DEFUN([gl_PREREQ_GETDELIM],
+[
+  AC_CHECK_FUNCS([flockfile funlockfile])
+  AC_CHECK_DECLS([getc_unlocked])
+])
deleted file mode 120000 (symlink)
index a1f21451348cf6fafef0d91c327a77b2db9b9e1e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getdtablesize.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3b89456baf90d4194820b1b323eef6bdb9eeca7b
--- /dev/null
@@ -0,0 +1,63 @@
+# getdtablesize.m4 serial 8
+dnl Copyright (C) 2008-2024 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_GETDTABLESIZE],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS_ONCE([getdtablesize])
+  AC_CHECK_DECLS_ONCE([getdtablesize])
+  if test $ac_cv_func_getdtablesize = yes &&
+     test $ac_cv_have_decl_getdtablesize = yes; then
+    AC_CACHE_CHECK([whether getdtablesize works],
+      [gl_cv_func_getdtablesize_works],
+      [dnl There are two concepts: the "maximum possible file descriptor value + 1"
+       dnl and the "maximum number of open file descriptors in a process".
+       dnl Per SUSv2 and POSIX, getdtablesize() should return the first one.
+       dnl On most platforms, the first and the second concept are the same.
+       dnl On OpenVMS, however, they are different and getdtablesize() returns
+       dnl the second one; thus the test below fails. But we don't care
+       dnl because there's no good way to write a replacement getdtablesize().
+       case "$host_os" in
+         vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;;
+         *)
+           dnl Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft
+           dnl limit up to an unchangeable hard limit; all other platforms
+           dnl correctly require setrlimit before getdtablesize() can report
+           dnl a larger value.
+           AC_RUN_IFELSE([
+             AC_LANG_PROGRAM(
+               [[#include <unistd.h>]
+                GL_MDA_DEFINES
+               ],
+               [[int size = getdtablesize();
+                 if (dup2 (0, getdtablesize()) != -1)
+                   return 1;
+                 if (size != getdtablesize())
+                   return 2;
+               ]])],
+             [gl_cv_func_getdtablesize_works=yes],
+             [gl_cv_func_getdtablesize_works=no],
+             [case "$host_os" in
+                cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows
+                  gl_cv_func_getdtablesize_works="guessing no" ;;
+                *) gl_cv_func_getdtablesize_works="guessing yes" ;;
+              esac
+             ])
+           ;;
+       esac
+      ])
+    case "$gl_cv_func_getdtablesize_works" in
+      *yes | "no (limitation)") ;;
+      *) REPLACE_GETDTABLESIZE=1 ;;
+    esac
+  else
+    HAVE_GETDTABLESIZE=0
+  fi
+])
+
+# Prerequisites of lib/getdtablesize.c.
+AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:])
deleted file mode 120000 (symlink)
index 3deffbd2142eae277e3f40b8b1f9e168107775ed..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getgroups.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b5f6d9facd082a0e60985cbe1aa65b2a315f4a8e
--- /dev/null
@@ -0,0 +1,110 @@
+# serial 24
+
+dnl From Jim Meyering.
+dnl A wrapper around AC_FUNC_GETGROUPS.
+
+# Copyright (C) 1996-1997, 1999-2004, 2008-2024 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This is taken from the following Autoconf patch:
+# https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
+AC_DEFUN([AC_FUNC_GETGROUPS],
+[
+  AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
+  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+  AC_CHECK_FUNC([getgroups])
+
+  # If we don't yet have getgroups, see if it's in -lbsd.
+  # This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
+  ac_save_LIBS=$LIBS
+  if test $ac_cv_func_getgroups = no; then
+    AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
+  fi
+
+  # Run the program to test the functionality of the system-supplied
+  # getgroups function only if there is such a function.
+  if test $ac_cv_func_getgroups = yes; then
+    AC_CACHE_CHECK([for working getgroups], [ac_cv_func_getgroups_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [AC_INCLUDES_DEFAULT],
+            [[/* On NeXTstep 3.2, getgroups (0, 0) always fails.  */
+              return getgroups (0, 0) == -1;]])
+         ],
+         [ac_cv_func_getgroups_works=yes],
+         [ac_cv_func_getgroups_works=no],
+         [case "$host_os" in # ((
+                           # Guess yes on glibc systems.
+            *-gnu* | gnu*) ac_cv_func_getgroups_works="guessing yes" ;;
+                           # Guess yes on musl systems.
+            *-musl*)       ac_cv_func_getgroups_works="guessing yes" ;;
+                           # If we don't know, obey --enable-cross-guesses.
+            *)             ac_cv_func_getgroups_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      ])
+  else
+    ac_cv_func_getgroups_works=no
+  fi
+  case "$ac_cv_func_getgroups_works" in
+    *yes)
+      AC_DEFINE([HAVE_GETGROUPS], [1],
+        [Define to 1 if your system has a working `getgroups' function.])
+      ;;
+  esac
+  LIBS=$ac_save_LIBS
+])# AC_FUNC_GETGROUPS
+
+AC_DEFUN([gl_FUNC_GETGROUPS],
+[
+  AC_REQUIRE([AC_TYPE_GETGROUPS])
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_FUNC_GETGROUPS
+  if test $ac_cv_func_getgroups != yes; then
+    HAVE_GETGROUPS=0
+  else
+    if test "$ac_cv_type_getgroups" != gid_t \
+       || { case "$ac_cv_func_getgroups_works" in
+              *yes) false;;
+              *) true;;
+            esac
+          }; then
+      REPLACE_GETGROUPS=1
+      AC_DEFINE([GETGROUPS_ZERO_BUG], [1], [Define this to 1 if
+        getgroups(0,NULL) does not return the number of groups.])
+    else
+      dnl Detect Mac OS X and FreeBSD bug; POSIX requires getgroups(-1,ptr)
+      dnl to fail.
+      AC_CACHE_CHECK([whether getgroups handles negative values],
+        [gl_cv_func_getgroups_works],
+        [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+          [[int size = getgroups (0, 0);
+            gid_t *list = malloc (size * sizeof *list);
+            int result = getgroups (-1, list) != -1;
+            free (list);
+            return result;]])],
+          [gl_cv_func_getgroups_works=yes],
+          [gl_cv_func_getgroups_works=no],
+          [case "$host_os" in
+                            # Guess yes on glibc systems.
+             *-gnu* | gnu*) gl_cv_func_getgroups_works="guessing yes" ;;
+                            # Guess yes on musl systems.
+             *-musl*)       gl_cv_func_getgroups_works="guessing yes" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+             *)             gl_cv_func_getgroups_works="$gl_cross_guess_normal" ;;
+           esac
+          ])])
+      case "$gl_cv_func_getgroups_works" in
+        *yes) ;;
+        *) REPLACE_GETGROUPS=1 ;;
+      esac
+    fi
+  fi
+  test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
+])
deleted file mode 120000 (symlink)
index c6b3707da2e161007c4aa877ed1ac8530910d599..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/gethostname.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3e7446e5d7cd944646655c2eecd1b05e8fe1788c
--- /dev/null
@@ -0,0 +1,107 @@
+# gethostname.m4 serial 15
+dnl Copyright (C) 2002, 2008-2024 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.
+
+# Ensure
+# - the gethostname() function,
+# - the HOST_NAME_MAX macro in <limits.h>.
+AC_DEFUN([gl_FUNC_GETHOSTNAME],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  gl_PREREQ_SYS_H_WINSOCK2
+
+  dnl Where is gethostname() defined?
+  dnl - On native Windows, it is in ws2_32.dll.
+  dnl - Otherwise it is in libc.
+  GETHOSTNAME_LIB=
+  AC_CHECK_FUNCS([gethostname], , [
+    AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32],
+      [gl_cv_w32_gethostname],
+      [gl_cv_w32_gethostname=no
+       gl_save_LIBS="$LIBS"
+       LIBS="$LIBS -lws2_32"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#include <stddef.h>
+]], [[gethostname(NULL, 0);]])], [gl_cv_w32_gethostname=yes])
+       LIBS="$gl_save_LIBS"
+      ])
+    if test "$gl_cv_w32_gethostname" = "yes"; then
+      GETHOSTNAME_LIB="-lws2_32"
+    fi
+  ])
+  AC_SUBST([GETHOSTNAME_LIB])
+
+  if test "$ac_cv_func_gethostname" = no; then
+    HAVE_GETHOSTNAME=0
+  fi
+
+  gl_PREREQ_HOST_NAME_MAX
+])
+
+# Provide HOST_NAME_MAX when <limits.h> lacks it.
+AC_DEFUN([gl_PREREQ_HOST_NAME_MAX], [
+  dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead.
+  dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead.
+  dnl - On mingw, use 256, because
+  dnl   <https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-gethostname> says:
+  dnl   "if a buffer of 256 bytes is passed in the name parameter and
+  dnl    the namelen parameter is set to 256, the buffer size will always
+  dnl    be adequate."
+  dnl With this, there is no need to use sysconf (_SC_HOST_NAME_MAX), which
+  dnl is not a compile-time constant.
+  dnl We cannot override <limits.h> using the usual technique, because
+  dnl gl_CHECK_NEXT_HEADERS does not work for <limits.h>. Therefore retrieve
+  dnl the value of HOST_NAME_MAX at configure time.
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
+  AC_CHECK_HEADERS_ONCE([sys/socket.h])
+  AC_CHECK_HEADERS_ONCE([netdb.h])
+  AC_CACHE_CHECK([for HOST_NAME_MAX], [gl_cv_decl_HOST_NAME_MAX], [
+    gl_cv_decl_HOST_NAME_MAX=
+    AC_EGREP_CPP([lucky], [
+#include <limits.h>
+#ifdef HOST_NAME_MAX
+lucky
+#endif
+      ], [gl_cv_decl_HOST_NAME_MAX=yes])
+    if test -z "$gl_cv_decl_HOST_NAME_MAX"; then
+      dnl It's not defined in <limits.h>. Substitute it.
+      if test "$gl_cv_w32_gethostname" = yes; then
+        dnl mingw.
+        gl_cv_decl_HOST_NAME_MAX=256
+      else
+        AC_COMPUTE_INT([gl_cv_decl_HOST_NAME_MAX], [MAXHOSTNAMELEN], [
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+# include <netdb.h>
+#endif
+],
+          [dnl The system does not define MAXHOSTNAMELEN in any of the common
+           dnl headers. Use a safe fallback.
+           gl_cv_decl_HOST_NAME_MAX=256
+          ])
+      fi
+    fi
+  ])
+  if test "$gl_cv_decl_HOST_NAME_MAX" != yes; then
+    AC_DEFINE_UNQUOTED([HOST_NAME_MAX], [$gl_cv_decl_HOST_NAME_MAX],
+      [Define HOST_NAME_MAX when <limits.h> does not define it.])
+  fi
+])
+
+# Prerequisites of lib/gethostname.c.
+AC_DEFUN([gl_PREREQ_GETHOSTNAME], [
+  if test "$gl_cv_w32_gethostname" != "yes"; then
+    AC_CHECK_FUNCS([uname])
+  fi
+])
deleted file mode 120000 (symlink)
index d8d80efb1f1557f80b7a189b438ae3b47b663b76..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/gethrxtime.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b7d4be589368c1d24c01d2e3b7e8eb576e1ad512
--- /dev/null
@@ -0,0 +1,69 @@
+# gethrxtime.m4 serial 15
+dnl Copyright (C) 2005-2006, 2008-2024 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_GETHRXTIME],
+[
+  AC_REQUIRE([gl_ARITHMETIC_HRTIME_T])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_XTIME])
+  AC_CHECK_DECLS([gethrtime], [], [], [[#include <time.h>]])
+  GETHRXTIME_LIB=
+  if test $ac_cv_have_decl_gethrtime = no \
+     || test $gl_cv_arithmetic_hrtime_t = no; then
+    dnl Find libraries needed to link lib/gethrxtime.c.
+    AC_REQUIRE([gl_CLOCK_TIME])
+    AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+    AC_CHECK_FUNCS_ONCE([microuptime nanouptime])
+    if test $ac_cv_func_nanouptime != yes \
+       && { test $ac_cv_have_decl_gethrtime = no \
+            || test $gl_cv_arithmetic_hrtime_t = no; }; then
+      AC_CACHE_CHECK([whether CLOCK_MONOTONIC or CLOCK_REALTIME is defined],
+        [gl_cv_have_clock_gettime_macro],
+        [AC_EGREP_CPP([have_clock_gettime_macro],
+          [
+#          include <time.h>
+#          if defined CLOCK_MONOTONIC || defined CLOCK_REALTIME
+            have_clock_gettime_macro
+#          endif
+          ],
+          [gl_cv_have_clock_gettime_macro=yes],
+          [gl_cv_have_clock_gettime_macro=no])])
+      if test $gl_cv_have_clock_gettime_macro = yes; then
+        GETHRXTIME_LIB=$CLOCK_TIME_LIB
+      fi
+    fi
+  fi
+  AC_SUBST([GETHRXTIME_LIB])
+  dnl For backward compatibility.
+  LIB_GETHRXTIME="$GETHRXTIME_LIB"
+  AC_SUBST([LIB_GETHRXTIME])
+])
+
+# Test whether hrtime_t is an arithmetic type.
+# It is not arithmetic in older Solaris c89 (which insists on
+# not having a long long int type).
+AC_DEFUN([gl_ARITHMETIC_HRTIME_T],
+[
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CACHE_CHECK([for arithmetic hrtime_t], [gl_cv_arithmetic_hrtime_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[#include <time.h>]],
+          [[hrtime_t x = 0; return x/x;]])],
+       [gl_cv_arithmetic_hrtime_t=yes],
+       [gl_cv_arithmetic_hrtime_t=no])])
+  if test $gl_cv_arithmetic_hrtime_t = yes; then
+    AC_DEFINE([HAVE_ARITHMETIC_HRTIME_T], [1],
+      [Define if you have an arithmetic hrtime_t type.])
+  fi
+])
+
+# Prerequisites of lib/xtime.h.
+AC_DEFUN([gl_XTIME],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 242edadb4585a1596dbebdb4d094d335cbb6d626..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getline.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1a7e89034bcf85ad8b9cdf445ef0c1322ea6e837
--- /dev/null
@@ -0,0 +1,111 @@
+# getline.m4 serial 33
+
+dnl Copyright (C) 1998-2003, 2005-2007, 2009-2024 Free Software Foundation,
+dnl Inc.
+dnl
+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_PREREQ([2.59])
+
+dnl See if there's a working, system-supplied version of the getline function.
+dnl We can't just do AC_REPLACE_FUNCS([getline]) because some systems
+dnl have a function by that name in -linet that doesn't have anything
+dnl to do with the function we need.
+AC_DEFUN([gl_FUNC_GETLINE],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Persuade glibc <stdio.h> to declare getline().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_DECLS_ONCE([getline])
+
+  gl_CHECK_FUNCS_ANDROID([getline], [[#include <stdio.h>]])
+  if test $ac_cv_func_getline = yes; then
+    dnl Found it in some library.  Verify that it works.
+    AC_CACHE_CHECK([for working getline function],
+      [am_cv_func_working_getline],
+      [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
+       AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#    include <stdio.h>
+#    include <stdlib.h>
+#    include <string.h>
+    int main ()
+    {
+      FILE *in = fopen ("./conftest.data", "r");
+      if (!in)
+        return 1;
+      {
+        /* Test result for a NULL buffer and a zero size.
+           Based on a test program from Karl Heuer.  */
+        char *line = NULL;
+        size_t siz = 0;
+        int len = getline (&line, &siz, in);
+        if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
+          { free (line); fclose (in); return 2; }
+        free (line);
+      }
+      {
+        /* Test result for a NULL buffer and a non-zero size.
+           This crashes on FreeBSD 8.0.  */
+        char *line = NULL;
+        size_t siz = (size_t)(~0) / 4;
+        if (getline (&line, &siz, in) == -1)
+          { fclose (in); return 3; }
+        free (line);
+      }
+      fclose (in);
+      return 0;
+    }
+    ]])],
+         [am_cv_func_working_getline=yes],
+         [am_cv_func_working_getline=no],
+         [dnl We're cross compiling.
+          dnl Guess it works on glibc2 systems and musl systems.
+          AC_EGREP_CPP([Lucky GNU user],
+            [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ >= 2) && !defined __UCLIBC__
+  Lucky GNU user
+ #endif
+#endif
+            ],
+            [am_cv_func_working_getline="guessing yes"],
+            [case "$host_os" in
+               *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;;
+               *)                  am_cv_func_working_getline="$gl_cross_guess_normal" ;;
+             esac
+            ])
+         ])
+      ])
+  else
+    am_cv_func_working_getline=no
+    case "$gl_cv_onwards_func_getline" in
+      future*) REPLACE_GETLINE=1 ;;
+    esac
+  fi
+
+  if test $ac_cv_have_decl_getline = no; then
+    HAVE_DECL_GETLINE=0
+  fi
+
+  case "$am_cv_func_working_getline" in
+    *yes) ;;
+    *)
+      dnl Set REPLACE_GETLINE always: Even if we have not found the broken
+      dnl getline function among $LIBS, it may exist in libinet and the
+      dnl executable may be linked with -linet.
+      REPLACE_GETLINE=1
+      ;;
+  esac
+])
+
+# Prerequisites of lib/getline.c.
+AC_DEFUN([gl_PREREQ_GETLINE],
+[
+  :
+])
deleted file mode 120000 (symlink)
index c96bf1fdb02b2049c7d7f44481e06613c1ce6f60..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getloadavg.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..12627ab6e3c468a75d78862c02313f2e8ab25901
--- /dev/null
@@ -0,0 +1,167 @@
+# Check for getloadavg.
+
+# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2024 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.
+
+#serial 12
+
+# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
+# New applications should use gl_GETLOADAVG instead.
+
+# gl_GETLOADAVG
+# -------------
+AC_DEFUN([gl_GETLOADAVG],
+[AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+# Persuade glibc <stdlib.h> to declare getloadavg().
+AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+gl_save_LIBS=$LIBS
+
+# getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0,
+# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
+HAVE_GETLOADAVG=1
+gl_CHECK_FUNCS_ANDROID([getloadavg], [[#include <stdlib.h>]])
+if test $ac_cv_func_getloadavg != yes; then
+   case "$gl_cv_onwards_func_getloadavg" in
+     future*) REPLACE_GETLOADAVG=1 ;;
+   esac
+
+   gl_func_getloadavg_done=no
+
+   # Some systems with -lutil have (and need) -lkvm as well, some do not.
+   # On Solaris, -lkvm requires nlist from -lelf, so check that first
+   # to get the right answer into the cache.
+   # For kstat on solaris, we need to test for libelf and libkvm to force the
+   # definition of SVR4 below.
+   if test $gl_func_getloadavg_done = no; then
+     AC_CHECK_LIB([elf], [elf_begin], [LIBS="-lelf $LIBS"])
+     AC_CHECK_LIB([kvm], [kvm_open], [LIBS="-lkvm $LIBS"])
+     # Check for the 4.4BSD definition of getloadavg.
+     AC_CHECK_LIB([util], [getloadavg],
+       [LIBS="-lutil $LIBS" gl_func_getloadavg_done=yes])
+   fi
+
+   if test $gl_func_getloadavg_done = no; then
+     # There is a commonly available library for RS/6000 AIX.
+     # Since it is not a standard part of AIX, it might be installed locally.
+     gl_getloadavg_LIBS=$LIBS
+     if test $cross_compiling != yes; then
+       LIBS="-L/usr/local/lib $LIBS"
+     fi
+     AC_CHECK_LIB([getloadavg], [getloadavg],
+                  [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
+                  [LIBS=$gl_getloadavg_LIBS])
+   fi
+
+   # Set up the replacement function if necessary.
+   if test $gl_func_getloadavg_done = no; then
+     HAVE_GETLOADAVG=0
+
+     # Solaris has libkstat which does not require root.
+     AC_CHECK_LIB([kstat], [kstat_open])
+     test $ac_cv_lib_kstat_kstat_open = yes && gl_func_getloadavg_done=yes
+
+     # AIX has libperfstat which does not require root
+     if test $gl_func_getloadavg_done = no; then
+       AC_CHECK_LIB([perfstat], [perfstat_cpu_total])
+       test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_func_getloadavg_done=yes
+     fi
+
+     if test $gl_func_getloadavg_done = no; then
+       AC_CHECK_HEADER([sys/dg_sys_info.h],
+         [gl_func_getloadavg_done=yes
+          AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
+          AC_CHECK_LIB([dgc], [dg_sys_info])])
+     fi
+   fi
+fi
+
+if test "x$gl_save_LIBS" = x; then
+  GETLOADAVG_LIBS=$LIBS
+else
+  GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"`
+fi
+LIBS=$gl_save_LIBS
+
+AC_SUBST([GETLOADAVG_LIBS])dnl
+
+# Test whether the system declares getloadavg. Solaris has the function
+# but declares it in <sys/loadavg.h>, not <stdlib.h>.
+AC_CHECK_HEADERS([sys/loadavg.h])
+if test $ac_cv_header_sys_loadavg_h = yes; then
+  HAVE_SYS_LOADAVG_H=1
+else
+  HAVE_SYS_LOADAVG_H=0
+fi
+AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
+  [[#if HAVE_SYS_LOADAVG_H
+    /* OpenIndiana has a bug: <sys/time.h> must be included before
+       <sys/loadavg.h>.  */
+    # include <sys/time.h>
+    # include <sys/loadavg.h>
+    #endif
+    #include <stdlib.h>]])
+])# gl_GETLOADAVG
+
+
+# gl_PREREQ_GETLOADAVG
+# --------------------
+# Set up the AC_LIBOBJ replacement of 'getloadavg'.
+AC_DEFUN([gl_PREREQ_GETLOADAVG],
+[
+# Figure out what our getloadavg.c needs.
+
+AC_CHECK_HEADERS_ONCE([sys/param.h unistd.h])
+
+# On HPUX9, an unprivileged user can get load averages this way.
+if test $gl_func_getloadavg_done = no; then
+  AC_CHECK_FUNCS([pstat_getdynamic], [gl_func_getloadavg_done=yes])
+fi
+
+# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
+# uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
+# Irix 4.0.5F has the header but not the library.
+if test $gl_func_getloadavg_done = no && test "$ac_cv_lib_elf_elf_begin" = yes \
+    && test "$ac_cv_lib_kvm_kvm_open" = yes; then
+  gl_func_getloadavg_done=yes
+  AC_DEFINE([SVR4], [1], [Define to 1 on System V Release 4.])
+fi
+
+if test $gl_func_getloadavg_done = no; then
+  AC_CHECK_HEADER([inq_stats/cpustats.h],
+  [gl_func_getloadavg_done=yes
+   AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.])
+   AC_DEFINE([UMAX4_3], [1],
+             [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h>
+              instead of <sys/cpustats.h>.])])
+fi
+
+if test $gl_func_getloadavg_done = no; then
+  AC_CHECK_HEADER([sys/cpustats.h],
+  [gl_func_getloadavg_done=yes; AC_DEFINE([UMAX])])
+fi
+
+if test $gl_func_getloadavg_done = no; then
+  AC_CHECK_HEADERS([mach/mach.h])
+fi
+
+AC_CHECK_HEADERS([nlist.h],
+[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
+                  [], [],
+                  [#include <nlist.h>])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
+                   [[struct nlist x;
+                    #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
+                    x.n_un.n_name = "";
+                    #else
+                    x.n_name = "";
+                    #endif]])],
+                [AC_DEFINE([N_NAME_POINTER], [1],
+                           [Define to 1 if the nlist n_name member is a pointer])])
+])dnl
+])# gl_PREREQ_GETLOADAVG
deleted file mode 120000 (symlink)
index 681f7294331bc98695adb073f8999cf142f4cba3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getlogin.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..844e46589052592c967be200b293a46411ca1092
--- /dev/null
@@ -0,0 +1,35 @@
+# getlogin.m4 serial 7
+dnl Copyright (C) 2010-2024 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_GETLOGIN],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([getlogin])
+  if test $ac_cv_have_decl_getlogin = no; then
+    HAVE_DECL_GETLOGIN=0
+  fi
+  AC_CHECK_FUNCS_ONCE([getlogin])
+  if test $ac_cv_func_getlogin = no; then
+    HAVE_GETLOGIN=0
+  fi
+])
+
+dnl Determines the library needed by the implementation of the
+dnl getlogin and getlogin_r functions.
+AC_DEFUN([gl_LIB_GETLOGIN],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case $host_os in
+    mingw* | windows*)
+      GETLOGIN_LIB='-ladvapi32' ;;
+    *)
+      GETLOGIN_LIB= ;;
+  esac
+  AC_SUBST([GETLOGIN_LIB])
+  dnl For backward compatibility.
+  LIB_GETLOGIN="$GETLOGIN_LIB"
+  AC_SUBST([LIB_GETLOGIN])
+])
deleted file mode 120000 (symlink)
index 932e27aab04e7114ad14d2c54778b18a7bf56748..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getndelim2.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b5765d7131780b6b382ea5700142bf2e92ec2d54
--- /dev/null
@@ -0,0 +1,20 @@
+# getndelim2.m4 serial 8
+dnl Copyright (C) 2003, 2006, 2008-2024 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_GETNDELIM2],
+[
+  gl_PREREQ_GETNDELIM2
+  AC_CHECK_FUNCS_ONCE([flockfile])
+  AC_CHECK_FUNCS_ONCE([funlockfile])
+])
+
+# Prerequisites of lib/getndelim2.h and lib/getndelim2.c.
+AC_DEFUN([gl_PREREQ_GETNDELIM2],
+[
+  dnl Prerequisites of lib/getndelim2.h.
+  AC_REQUIRE([gt_TYPE_SSIZE_T])
+  dnl No prerequisites of lib/getndelim2.c.
+])
deleted file mode 120000 (symlink)
index c072d171f4c007a7647228f285b2a8effbdadbe8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getopt.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..be812d8459b69abbd6239b2ebe3a329bec68bd1d
--- /dev/null
@@ -0,0 +1,381 @@
+# getopt.m4 serial 49
+dnl Copyright (C) 2002-2006, 2008-2024 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.
+
+# Request a POSIX compliant getopt function.
+AC_DEFUN([gl_FUNC_GETOPT_POSIX],
+[
+  m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX])
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
+  dnl Other modules can request the gnulib implementation of the getopt
+  dnl functions unconditionally, by defining gl_REPLACE_GETOPT_ALWAYS.
+  dnl argp.m4 does this.
+  m4_ifdef([gl_REPLACE_GETOPT_ALWAYS], [
+    REPLACE_GETOPT=1
+  ], [
+    REPLACE_GETOPT=0
+    if test -n "$gl_replace_getopt"; then
+      REPLACE_GETOPT=1
+    fi
+  ])
+  GL_GENERATE_GETOPT_H=false
+  GL_GENERATE_GETOPT_CDEFS_H=false
+  if test $REPLACE_GETOPT = 1; then
+    dnl Arrange for getopt.h to be created.
+    gl_GETOPT_SUBSTITUTE_HEADER
+  fi
+])
+
+# Request a POSIX compliant getopt function with GNU extensions (such as
+# options with optional arguments) and the functions getopt_long,
+# getopt_long_only.
+AC_DEFUN([gl_FUNC_GETOPT_GNU],
+[
+  dnl Set the variable gl_getopt_required, so that all invocations of
+  dnl gl_GETOPT_CHECK_HEADERS in the scope of the current configure file
+  dnl will check for getopt with GNU extensions.
+  dnl This means that if one gnulib-tool invocation requests getopt-posix
+  dnl and another gnulib-tool invocation requests getopt-gnu, it is as if
+  dnl both had requested getopt-gnu.
+  m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU])
+
+  dnl No need to invoke gl_FUNC_GETOPT_POSIX here; this is automatically
+  dnl done through the module dependency getopt-gnu -> getopt-posix.
+])
+
+# Determine whether to replace the entire getopt facility.
+AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([AC_PROG_AWK]) dnl for awk that supports ENVIRON
+
+  dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  gl_CHECK_NEXT_HEADERS([getopt.h])
+  if test $ac_cv_header_getopt_h = yes; then
+    HAVE_GETOPT_H=1
+  else
+    HAVE_GETOPT_H=0
+  fi
+  AC_SUBST([HAVE_GETOPT_H])
+
+  gl_replace_getopt=
+
+  dnl Test whether <getopt.h> is available.
+  if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
+    AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes])
+  fi
+
+  dnl Test whether the function getopt_long is available.
+  if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
+    AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes])
+  fi
+
+  dnl POSIX 2008 does not specify leading '+' behavior, but see
+  dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on
+  dnl the next version of POSIX.  For now, we only guarantee leading '+'
+  dnl behavior with getopt-gnu.
+  if test -z "$gl_replace_getopt"; then
+    AC_CACHE_CHECK([whether getopt is POSIX compatible],
+      [gl_cv_func_getopt_posix],
+      [
+        dnl Merging these three different test programs into a single one
+        dnl would require a reset mechanism. On BSD systems, it can be done
+        dnl through 'optreset'; on some others (glibc), it can be done by
+        dnl setting 'optind' to 0; on others again (HP-UX, IRIX, OSF/1,
+        dnl Solaris 9, musl libc), there is no such mechanism.
+        if test $cross_compiling = no; then
+          dnl Sanity check. Succeeds everywhere (except on MSVC,
+          dnl which lacks <unistd.h> and getopt() entirely).
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main ()
+{
+  static char program[] = "program";
+  static char a[] = "-a";
+  static char foo[] = "foo";
+  static char bar[] = "bar";
+  char *argv[] = { program, a, foo, bar, NULL };
+  int c;
+
+  c = getopt (4, argv, "ab");
+  if (!(c == 'a'))
+    return 1;
+  c = getopt (4, argv, "ab");
+  if (!(c == -1))
+    return 2;
+  if (!(optind == 2))
+    return 3;
+  return 0;
+}
+]])],
+            [gl_cv_func_getopt_posix=maybe],
+            [gl_cv_func_getopt_posix=no])
+          if test $gl_cv_func_getopt_posix = maybe; then
+            dnl Sanity check with '+'. Succeeds everywhere (except on MSVC,
+            dnl which lacks <unistd.h> and getopt() entirely).
+            AC_RUN_IFELSE(
+              [AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main ()
+{
+  static char program[] = "program";
+  static char donald[] = "donald";
+  static char p[] = "-p";
+  static char billy[] = "billy";
+  static char duck[] = "duck";
+  static char a[] = "-a";
+  static char bar[] = "bar";
+  char *argv[] = { program, donald, p, billy, duck, a, bar, NULL };
+  int c;
+
+  c = getopt (7, argv, "+abp:q:");
+  if (!(c == -1))
+    return 4;
+  if (!(strcmp (argv[0], "program") == 0))
+    return 5;
+  if (!(strcmp (argv[1], "donald") == 0))
+    return 6;
+  if (!(strcmp (argv[2], "-p") == 0))
+    return 7;
+  if (!(strcmp (argv[3], "billy") == 0))
+    return 8;
+  if (!(strcmp (argv[4], "duck") == 0))
+    return 9;
+  if (!(strcmp (argv[5], "-a") == 0))
+    return 10;
+  if (!(strcmp (argv[6], "bar") == 0))
+    return 11;
+  if (!(optind == 1))
+    return 12;
+  return 0;
+}
+]])],
+              [gl_cv_func_getopt_posix=maybe],
+              [gl_cv_func_getopt_posix=no])
+          fi
+          if test $gl_cv_func_getopt_posix = maybe; then
+            dnl Detect Mac OS X 10.5, AIX 7.1, mingw bug.
+            AC_RUN_IFELSE(
+              [AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main ()
+{
+  static char program[] = "program";
+  static char ab[] = "-ab";
+  char *argv[3] = { program, ab, NULL };
+  if (getopt (2, argv, "ab:") != 'a')
+    return 13;
+  if (getopt (2, argv, "ab:") != '?')
+    return 14;
+  if (optopt != 'b')
+    return 15;
+  if (optind != 2)
+    return 16;
+  return 0;
+}
+]])],
+              [gl_cv_func_getopt_posix=yes],
+              [gl_cv_func_getopt_posix=no])
+          fi
+        else
+          case "$host_os" in
+            darwin* | aix* | mingw* | windows*) gl_cv_func_getopt_posix="guessing no";;
+            *)                                  gl_cv_func_getopt_posix="guessing yes";;
+          esac
+        fi
+      ])
+    case "$gl_cv_func_getopt_posix" in
+      *no) gl_replace_getopt=yes ;;
+    esac
+  fi
+
+  if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
+    AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_getopt_gnu],
+      [# Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the
+       # optstring is necessary for programs like m4 that have POSIX-mandated
+       # semantics for supporting options interspersed with files.
+       # Also, since getopt_long is a GNU extension, we require optind=0.
+       # Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT;
+       # so take care to revert to the correct (non-)export state.
+dnl GNU Coding Standards currently allow awk but not env; besides, env
+dnl is ambiguous with environment values that contain newlines.
+       gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }'
+       case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in
+         xx) gl_had_POSIXLY_CORRECT=exported ;;
+         x)  gl_had_POSIXLY_CORRECT=yes      ;;
+         *)  gl_had_POSIXLY_CORRECT=         ;;
+       esac
+       POSIXLY_CORRECT=1
+       export POSIXLY_CORRECT
+       AC_RUN_IFELSE(
+        [AC_LANG_PROGRAM([[#include <getopt.h>
+                           #include <stddef.h>
+                           #include <string.h>
+           ]GL_NOCRASH[
+           ]], [[
+             int result = 0;
+
+             nocrash_init();
+
+             /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
+                and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
+                OSF/1 5.1, Solaris 10.  */
+             {
+               static char conftest[] = "conftest";
+               static char plus[] = "-+";
+               char *argv[3] = { conftest, plus, NULL };
+               opterr = 0;
+               if (getopt (2, argv, "+a") != '?')
+                 result |= 1;
+             }
+             /* This code succeeds on glibc 2.8, mingw,
+                and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
+                IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x.  */
+             {
+               static char program[] = "program";
+               static char p[] = "-p";
+               static char foo[] = "foo";
+               static char bar[] = "bar";
+               char *argv[] = { program, p, foo, bar, NULL };
+
+               optind = 1;
+               if (getopt (4, argv, "p::") != 'p')
+                 result |= 2;
+               else if (optarg != NULL)
+                 result |= 4;
+               else if (getopt (4, argv, "p::") != -1)
+                 result |= 6;
+               else if (optind != 2)
+                 result |= 8;
+             }
+             /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0.  */
+             {
+               static char program[] = "program";
+               static char foo[] = "foo";
+               static char p[] = "-p";
+               char *argv[] = { program, foo, p, NULL };
+               optind = 0;
+               if (getopt (3, argv, "-p") != 1)
+                 result |= 16;
+               else if (getopt (3, argv, "-p") != 'p')
+                 result |= 16;
+             }
+             /* This code fails on glibc 2.11.  */
+             {
+               static char program[] = "program";
+               static char b[] = "-b";
+               static char a[] = "-a";
+               char *argv[] = { program, b, a, NULL };
+               optind = opterr = 0;
+               if (getopt (3, argv, "+:a:b") != 'b')
+                 result |= 32;
+               else if (getopt (3, argv, "+:a:b") != ':')
+                 result |= 32;
+             }
+             /* This code dumps core on glibc 2.14.  */
+             {
+               static char program[] = "program";
+               static char w[] = "-W";
+               static char dummy[] = "dummy";
+               char *argv[] = { program, w, dummy, NULL };
+               optind = opterr = 1;
+               if (getopt (3, argv, "W;") != 'W')
+                 result |= 64;
+             }
+             return result;
+           ]])],
+        [gl_cv_func_getopt_gnu=yes],
+        [gl_cv_func_getopt_gnu=no],
+        [dnl Cross compiling.
+         dnl Assume the worst, even on glibc platforms.
+         dnl But obey --enable-cross-guesses.
+         gl_cv_func_getopt_gnu="$gl_cross_guess_normal"
+        ])
+       case $gl_had_POSIXLY_CORRECT in
+         exported) ;;
+         yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;;
+         *) AS_UNSET([POSIXLY_CORRECT]) ;;
+       esac
+      ])
+    if test "$gl_cv_func_getopt_gnu" != yes; then
+      gl_replace_getopt=yes
+    else
+      AC_CACHE_CHECK([for working GNU getopt_long function],
+        [gl_cv_func_getopt_long_gnu],
+        [AC_RUN_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <getopt.h>
+                #include <stddef.h>
+                #include <string.h>
+              ]],
+              [[static const struct option long_options[] =
+                  {
+                    { "xtremely-",no_argument,       NULL, 1003 },
+                    { "xtra",     no_argument,       NULL, 1001 },
+                    { "xtreme",   no_argument,       NULL, 1002 },
+                    { "xtremely", no_argument,       NULL, 1003 },
+                    { NULL,       0,                 NULL, 0 }
+                  };
+                /* This code fails on OpenBSD 5.0.  */
+                {
+                  static char program[] = "program";
+                  static char xtremel[] = "--xtremel";
+                  char *argv[] = { program, xtremel, NULL };
+                  int option_index;
+                  optind = 1; opterr = 0;
+                  if (getopt_long (2, argv, "", long_options, &option_index) != 1003)
+                    return 1;
+                }
+                return 0;
+              ]])],
+           [gl_cv_func_getopt_long_gnu=yes],
+           [gl_cv_func_getopt_long_gnu=no],
+           [dnl Cross compiling. Guess no on OpenBSD, yes otherwise.
+            case "$host_os" in
+              openbsd*) gl_cv_func_getopt_long_gnu="guessing no";;
+              *)        gl_cv_func_getopt_long_gnu="guessing yes";;
+            esac
+           ])
+        ])
+      case "$gl_cv_func_getopt_long_gnu" in
+        *yes) ;;
+        *) gl_replace_getopt=yes ;;
+      esac
+    fi
+  fi
+])
+
+AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
+[
+  AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
+  if test $ac_cv_header_sys_cdefs_h = yes; then
+    HAVE_SYS_CDEFS_H=1
+  else
+    HAVE_SYS_CDEFS_H=0
+  fi
+  AC_SUBST([HAVE_SYS_CDEFS_H])
+
+  AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
+    [Define to rpl_ if the getopt replacement functions and variables
+     should be used.])
+  GL_GENERATE_GETOPT_H=true
+  GL_GENERATE_GETOPT_CDEFS_H=true
+])
deleted file mode 120000 (symlink)
index 40c7480914ece5445468388b6194bf11990c57d1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getpagesize.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..35dc257b38d6f41cb89e7b8bb3ad382d98bf3428
--- /dev/null
@@ -0,0 +1,49 @@
+# getpagesize.m4 serial 11
+dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2024 Free Software Foundation,
+dnl 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_GETPAGESIZE],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  gl_CHECK_FUNC_GETPAGESIZE
+  if test $gl_cv_func_getpagesize = no; then
+    HAVE_GETPAGESIZE=0
+    AC_CHECK_HEADERS([OS.h])
+    if test $ac_cv_header_OS_h = yes; then
+      HAVE_OS_H=1
+    fi
+    AC_CHECK_HEADERS([sys/param.h])
+    if test $ac_cv_header_sys_param_h = yes; then
+      HAVE_SYS_PARAM_H=1
+    fi
+  fi
+  case "$host_os" in
+    mingw* | windows*)
+      REPLACE_GETPAGESIZE=1
+      ;;
+  esac
+  dnl Also check whether it's declared.
+  dnl mingw has getpagesize() in libgcc.a but doesn't declare it.
+  AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0])
+])
+
+dnl Tests whether the function getpagesize() exists.
+dnl Sets gl_cv_func_getpagesize.
+AC_DEFUN([gl_CHECK_FUNC_GETPAGESIZE],
+[
+  dnl We can't use AC_CHECK_FUNC here, because getpagesize() is defined as a
+  dnl static inline function when compiling for Android 4.4 or older.
+  AC_CACHE_CHECK([for getpagesize], [gl_cv_func_getpagesize],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <unistd.h>]],
+          [[return getpagesize();]])
+       ],
+       [gl_cv_func_getpagesize=yes],
+       [gl_cv_func_getpagesize=no])
+    ])
+])
deleted file mode 120000 (symlink)
index 3546daeaabd1811b53ec8027a10159e7ec58e500..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getprogname.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b8f9f230ddf3fbf97bd4906ff8e8b543d90f310c
--- /dev/null
@@ -0,0 +1,60 @@
+# getprogname.m4 - check for getprogname or replacements for it
+
+# Copyright (C) 2016-2024 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.
+
+# serial 8
+
+AC_DEFUN([gl_FUNC_GETPROGNAME],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  gl_CHECK_FUNCS_ANDROID([getprogname], [[#include <stdlib.h>]])
+  if test $ac_cv_func_getprogname = no; then
+    HAVE_GETPROGNAME=0
+    case "$gl_cv_onwards_func_getprogname" in
+      future*) REPLACE_GETPROGNAME=1 ;;
+    esac
+  fi
+  AC_CHECK_DECLS([program_invocation_name],
+    [],
+    [HAVE_DECL_PROGRAM_INVOCATION_NAME=0],
+    [[#include <errno.h>]])
+])
+
+AC_DEFUN([gl_PREREQ_GETPROGNAME],
+[
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([getexecname])
+  ac_found=0
+  AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [],
+    [#include <errno.h>])
+  AC_CHECK_DECLS([program_invocation_short_name], [ac_found=1], [],
+    [#include <errno.h>])
+  AC_CHECK_DECLS([__argv], [ac_found=1], [], [#include <stdlib.h>])
+
+  # Incur the cost of this test only if none of the above worked.
+  if test $ac_found = 0; then
+    # On OpenBSD 5.1, using the global __progname variable appears to be
+    # the only way to implement getprogname.
+    AC_CACHE_CHECK([whether __progname is defined in default libraries],
+      [gl_cv_var___progname],
+      [
+        gl_cv_var___progname=
+        AC_LINK_IFELSE(
+          [AC_LANG_PROGRAM(
+            [[extern char *__progname;]],
+            [[return *__progname;]]
+          )],
+          [gl_cv_var___progname=yes]
+        )
+      ]
+    )
+    if test "$gl_cv_var___progname" = yes; then
+      AC_DEFINE([HAVE_VAR___PROGNAME], 1,
+        [Define if you have a global __progname variable])
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index 46ac8d32b4780ed3064fa4d2929ab8db41fa8041..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getrandom.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..55be445c31ab0377a52d8abdc3fb9897c7fa51ac
--- /dev/null
@@ -0,0 +1,82 @@
+# getrandom.m4 serial 13
+dnl Copyright 2020-2024 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_FUNC_GETRANDOM],
+[
+  AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  gl_CHECK_FUNCS_ANDROID([getrandom],
+    [[/* Additional includes are needed before <sys/random.h> on uClibc
+         and Mac OS X.  */
+      #include <sys/types.h>
+      #include <stdlib.h>
+      #include <sys/random.h>
+    ]])
+  if test "$ac_cv_func_getrandom" != yes; then
+    HAVE_GETRANDOM=0
+    case "$gl_cv_onwards_func_getrandom" in
+      future*) REPLACE_GETRANDOM=1 ;;
+    esac
+  else
+    dnl On Solaris 11.4 the return type is 'int', not 'ssize_t'.
+    AC_CACHE_CHECK([whether getrandom is compatible with its GNU+BSD signature],
+      [gl_cv_func_getrandom_ok],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[/* Additional includes are needed before <sys/random.h> on uClibc
+                 and Mac OS X.  */
+              #include <sys/types.h>
+              #include <stdlib.h>
+              #include <sys/random.h>
+              ssize_t getrandom (void *, size_t, unsigned int);
+            ]],
+            [[]])
+         ],
+         [gl_cv_func_getrandom_ok=yes],
+         [gl_cv_func_getrandom_ok=no])
+      ])
+    if test $gl_cv_func_getrandom_ok = no; then
+      REPLACE_GETRANDOM=1
+    fi
+  fi
+
+  case "$host_os" in
+    mingw* | windows*)
+      AC_CHECK_HEADERS([bcrypt.h], [], [],
+        [[#include <windows.h>
+        ]])
+      AC_CACHE_CHECK([whether the bcrypt library is guaranteed to be present],
+        [gl_cv_lib_assume_bcrypt],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <windows.h>]],
+              [[#if !(_WIN32_WINNT >= _WIN32_WINNT_WIN7)
+                  cannot assume it
+                #endif
+              ]])
+           ],
+           [gl_cv_lib_assume_bcrypt=yes],
+           [gl_cv_lib_assume_bcrypt=no])
+        ])
+      if test $gl_cv_lib_assume_bcrypt = yes; then
+        AC_DEFINE([HAVE_LIB_BCRYPT], [1],
+          [Define to 1 if the bcrypt library is guaranteed to be present.])
+        GETRANDOM_LIB='-lbcrypt'
+      else
+        GETRANDOM_LIB='-ladvapi32'
+      fi
+      ;;
+    *)
+      GETRANDOM_LIB= ;;
+  esac
+  AC_SUBST([GETRANDOM_LIB])
+  dnl For backward compatibility.
+  LIB_GETRANDOM="$GETRANDOM_LIB"
+  AC_SUBST([LIB_GETRANDOM])
+])
deleted file mode 120000 (symlink)
index ad9145b143475ccaa6ec74bd738dd0a0f88b1a8d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getrusage.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7d3df9c29658c0673a423f0d568c37c526f9ee23
--- /dev/null
@@ -0,0 +1,14 @@
+# getrusage.m4 serial 1
+dnl Copyright (C) 2012-2024 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_GETRUSAGE],
+[
+  AC_REQUIRE([gl_SYS_RESOURCE_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([getrusage])
+  if test $ac_cv_func_getrusage = no; then
+    HAVE_GETRUSAGE=0
+  fi
+])
deleted file mode 120000 (symlink)
index e8d37258159762c624966773a3296f74a71e68cd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/gettime.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1ec018d51540ef4cbdc40bcc416a1c52f906a67d
--- /dev/null
@@ -0,0 +1,68 @@
+# gettime.m4 serial 15
+dnl Copyright (C) 2002, 2004-2006, 2009-2024 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_GETTIME],
+[
+  dnl Prerequisites of lib/gettime.c.
+  AC_REQUIRE([gl_CLOCK_TIME])
+  AC_REQUIRE([gl_TIMESPEC])
+
+  AC_REQUIRE([gl_CHECK_FUNC_TIMESPEC_GET])
+  if test $gl_cv_func_timespec_get = yes; then
+    AC_DEFINE([HAVE_TIMESPEC_GET], [1],
+      [Define if you have the timespec_get function.])
+  fi
+])
+
+dnl Tests whether the function timespec_get exists.
+dnl Sets gl_cv_func_timespec_get and gl_cv_onwards_func_timespec_get.
+AC_DEFUN([gl_CHECK_FUNC_TIMESPEC_GET],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl Persuade OpenBSD <time.h> to declare timespec_get().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl We can't use AC_CHECK_FUNC here, because timespec_get() is defined as a
+  dnl static inline function in <time.h> on MSVC 14.
+  dnl But at the same time, we need to notice a missing declaration, like
+  dnl gl_CHECK_FUNCS_ANDROID does.
+  AC_CHECK_DECL([timespec_get], , , [[#include <time.h>]])
+  AC_CACHE_CHECK([for timespec_get], [gl_cv_onwards_func_timespec_get],
+    [if test $ac_cv_have_decl_timespec_get = yes; then
+       AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <time.h>
+              struct timespec ts;
+            ]],
+            [[return timespec_get (&ts, 0);]])
+         ],
+         [gl_cv_onwards_func_timespec_get=yes],
+         [gl_cv_onwards_func_timespec_get=no])
+     else
+       gl_cv_onwards_func_timespec_get=no
+     fi
+     case "$host_os" in
+       linux*-android*)
+         if test $gl_cv_onwards_func_timespec_get = no; then
+           gl_cv_onwards_func_timespec_get='future OS version'
+         fi
+         ;;
+     esac
+    ])
+  case "$gl_cv_onwards_func_timespec_get" in
+    future*) gl_cv_func_timespec_get=no ;;
+    *)       gl_cv_func_timespec_get=$gl_cv_onwards_func_timespec_get ;;
+  esac
+])
+
+AC_DEFUN([gl_GETTIME_RES],
+[
+  dnl Prerequisites of lib/gettime-res.c.
+  AC_REQUIRE([gl_CLOCK_TIME])
+  AC_REQUIRE([gl_TIMESPEC])
+  gl_CHECK_FUNCS_ANDROID([timespec_getres], [[#include <time.h>]])
+])
deleted file mode 120000 (symlink)
index 323ae2eb0f565858118ee5469aed2f1b7165682e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/gettimeofday.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..35269914ced9fe7ea7d3af4d6e029c0843e5c7e3
--- /dev/null
@@ -0,0 +1,69 @@
+# serial 30
+
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2024 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_GETTIMEOFDAY],
+[
+  AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS])
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_SYS_TIME_H])
+  AC_CHECK_FUNCS_ONCE([gettimeofday])
+
+  gl_gettimeofday_timezone=void
+  if test $ac_cv_func_gettimeofday != yes; then
+    HAVE_GETTIMEOFDAY=0
+  else
+    AC_CACHE_CHECK([for gettimeofday with POSIX signature],
+      [gl_cv_func_gettimeofday_posix_signature],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <sys/time.h>
+              struct timeval c;
+              int gettimeofday (struct timeval *restrict, void *restrict);
+            ]],
+            [[/* glibc uses struct timezone * rather than the POSIX void *
+                 if _GNU_SOURCE is defined.  However, since the only portable
+                 use of gettimeofday uses NULL as the second parameter, and
+                 since the glibc definition is actually more typesafe, it is
+                 not worth wrapping this to get a compliant signature.  */
+              int (*f) (struct timeval *restrict, void *restrict)
+                = gettimeofday;
+              int x = f (&c, 0);
+              return !(x | c.tv_sec | c.tv_usec);
+            ]])],
+          [gl_cv_func_gettimeofday_posix_signature=yes],
+          [AC_COMPILE_IFELSE(
+            [AC_LANG_PROGRAM(
+              [[#include <sys/time.h>
+int gettimeofday (struct timeval *restrict, struct timezone *restrict);
+              ]])],
+            [gl_cv_func_gettimeofday_posix_signature=almost],
+            [gl_cv_func_gettimeofday_posix_signature=no])])])
+    if test $gl_cv_func_gettimeofday_posix_signature = almost; then
+      gl_gettimeofday_timezone='struct timezone'
+    elif test $gl_cv_func_gettimeofday_posix_signature != yes; then
+      REPLACE_GETTIMEOFDAY=1
+    fi
+    dnl If we override 'struct timeval', we also have to override gettimeofday.
+    if test $REPLACE_STRUCT_TIMEVAL = 1; then
+      REPLACE_GETTIMEOFDAY=1
+    fi
+    dnl On mingw, the original gettimeofday has only a precision of 15.6
+    dnl milliseconds. So override it.
+    case "$host_os" in
+      mingw* | windows*) REPLACE_GETTIMEOFDAY=1 ;;
+    esac
+  fi
+  AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone],
+    [Define this to 'void' or 'struct timezone' to match the system's
+     declaration of the second argument to gettimeofday.])
+])
+
+# Prerequisites of lib/gettimeofday.c.
+AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [:])
deleted file mode 120000 (symlink)
index b28ded949b49c445a85738a7f409f606b694a74c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/getugroups.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..81494de0f17f1d755187fc2c0a81c84115ddfefd
--- /dev/null
@@ -0,0 +1,11 @@
+# getugroups.m4 serial 9
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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_GETUGROUPS],
+[
+  AC_CHECK_HEADERS_ONCE([grp.h])
+])
deleted file mode 120000 (symlink)
index d74a07e350b71e24b0fe1e05a95c710111ddb250..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/gl-openssl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7f389557859000edae8ec5aacfbaacdb363547c0
--- /dev/null
@@ -0,0 +1,79 @@
+# gl-openssl.m4 serial 7
+dnl Copyright (C) 2013-2024 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_SET_CRYPTO_CHECK_DEFAULT],
+[
+  m4_define([gl_CRYPTO_CHECK_DEFAULT], [$1])
+])
+gl_SET_CRYPTO_CHECK_DEFAULT([no])
+
+AC_DEFUN([gl_CRYPTO_CHECK],
+[
+  dnl gnulib users set this before gl_INIT with gl_SET_CRYPTO_CHECK_DEFAULT()
+  m4_divert_once([DEFAULTS], [with_openssl_default='gl_CRYPTO_CHECK_DEFAULT'])
+
+  dnl Only clear once, so crypto routines can be checked for individually
+  m4_divert_once([DEFAULTS], [LIB_CRYPTO=])
+
+  AC_ARG_WITH([openssl],
+    [[  --with-openssl[=ARG]    use libcrypto hash routines for the hash functions
+                          MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512.
+                          Valid ARGs are:
+                            'yes',
+                            'no',
+                            'auto' => use if any version available,
+                            'auto-gpl-compat' => use if GPL compatible version
+                                                 available,
+                            'optional' => use if available
+                                          and warn if not available;
+                          Default is ']gl_CRYPTO_CHECK_DEFAULT['.]m4_ifdef([gl_AF_ALG], [
+                          Note also --with-linux-crypto, which will enable the
+                          use of Linux kernel crypto routines (if available),
+                          which has precedence for files.])],
+    [],
+    [with_openssl=$with_openssl_default])
+
+  AC_SUBST([LIB_CRYPTO])
+  if test "x$with_openssl" != xno; then
+    if test "x$with_openssl" = xauto-gpl-compat; then
+      dnl OpenSSL versions < 3 are under the OpenSSL license, which is not
+      dnl GPL compatible.
+      dnl See <https://www.gnu.org/licenses/license-list.en.html#OpenSSL>.
+      AC_CACHE_CHECK([whether openssl is GPL compatible],
+                     [gl_cv_openssl_gpl_compat],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM([[
+                #include <openssl/opensslv.h>
+                #if OPENSSL_VERSION_MAJOR < 3
+                  #error "openssl >= version 3 not found"
+                #endif
+              ]])],
+           [gl_cv_openssl_gpl_compat=yes],
+           [gl_cv_openssl_gpl_compat=no])])
+    fi
+    if test "x$with_openssl" != xauto-gpl-compat ||
+       test "x$gl_cv_openssl_gpl_compat" = xyes; then
+      AC_CHECK_LIB([crypto], [$1],
+        [AC_CHECK_HEADERS(
+           m4_if([$1], [MD5], [openssl/md5.h], [openssl/sha.h]),
+           [LIB_CRYPTO=-lcrypto
+            AC_DEFINE([HAVE_OPENSSL_$1], [1],
+              [Define to 1 if libcrypto is used for $1.])])])
+    fi
+    if test "x$LIB_CRYPTO" = x; then
+      message='openssl development library not found for $1.
+  If you want to install it, first find the pre-built package name:
+    - On Debian and Debian-based systems: libssl-dev,
+    - On Red Hat distributions: openssl-devel.
+    - Other: https://repology.org/project/openssl/versions'
+      if test "x$with_openssl" = xyes; then
+        AC_MSG_ERROR([$message])
+      elif test "x$with_openssl" = xoptional; then
+        AC_MSG_WARN([$message])
+      fi
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index 8b8389142883ea361e38b3c5a45f524dd62819a1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/gnulib-common.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bba6d6001f619c8e3edd2d8d0959bf627e77c228
--- /dev/null
+# gnulib-common.m4 serial 89.2
+dnl Copyright (C) 2007-2024 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_PREREQ([2.62])
+
+# gl_COMMON
+# is expanded unconditionally through gnulib-tool magic.
+AC_DEFUN([gl_COMMON], [
+  dnl Use AC_REQUIRE here, so that the code is expanded once only.
+  AC_REQUIRE([gl_00GNULIB])
+  AC_REQUIRE([gl_COMMON_BODY])
+  AC_REQUIRE([gl_ZZGNULIB])
+])
+AC_DEFUN([gl_COMMON_BODY], [
+  AH_VERBATIM([0witness],
+[/* Witness that <config.h> has been included.  */
+#define _GL_CONFIG_H_INCLUDED 1
+])
+  AH_VERBATIM([_GL_GNUC_PREREQ],
+[/* True if the compiler says it groks GNU C version MAJOR.MINOR.  */
+#if defined __GNUC__ && defined __GNUC_MINOR__
+# define _GL_GNUC_PREREQ(major, minor) \
+    ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__))
+#else
+# define _GL_GNUC_PREREQ(major, minor) 0
+#endif
+])
+  AH_VERBATIM([_Noreturn],
+[/* The _Noreturn keyword of C11.  */
+#ifndef _Noreturn
+# if (defined __cplusplus \
+      && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
+          || (defined _MSC_VER && 1900 <= _MSC_VER)) \
+      && 0)
+    /* [[noreturn]] is not practically usable, because with it the syntax
+         extern _Noreturn void func (...);
+       would not be valid; such a declaration would only be valid with 'extern'
+       and '_Noreturn' swapped, or without the 'extern' keyword.  However, some
+       AIX system header files and several gnulib header files use precisely
+       this syntax with 'extern'.  */
+#  define _Noreturn [[noreturn]]
+# elif (defined __clang__ && __clang_major__ < 16 \
+        && defined _GL_WORK_AROUND_LLVM_BUG_59792)
+   /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
+      that rare LLVM bug, though you may get many false-alarm warnings.  */
+#  define _Noreturn
+# elif ((!defined __cplusplus || defined __clang__) \
+        && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
+            || (!defined __STRICT_ANSI__ \
+                && (_GL_GNUC_PREREQ (4, 7) \
+                    || (defined __apple_build_version__ \
+                        ? 6000000 <= __apple_build_version__ \
+                        : 3 < __clang_major__ + (5 <= __clang_minor__))))))
+   /* _Noreturn works as-is.  */
+# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C
+#  define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn
+# endif
+#endif
+])
+  AH_VERBATIM([isoc99_inline],
+[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
+   the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
+   earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
+   __APPLE__ && __MACH__ test for Mac OS X.
+   __APPLE_CC__ tests for the Apple compiler and its version.
+   __STDC_VERSION__ tests for the C99 mode.  */
+#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
+# define __GNUC_STDC_INLINE__ 1
+#endif])
+  AH_VERBATIM([attribute],
+[/* Attributes.  */
+/* Define _GL_HAS_ATTRIBUTE only once, because on FreeBSD, with gcc < 5, if
+   <config.h> gets included once again after <sys/cdefs.h>, __has_attribute(x)
+   expands to 0 always, and redefining _GL_HAS_ATTRIBUTE would turn off all
+   attributes.  */
+#ifndef _GL_HAS_ATTRIBUTE
+# if (defined __has_attribute \
+      && (!defined __clang_minor__ \
+          || (defined __apple_build_version__ \
+              ? 7000000 <= __apple_build_version__ \
+              : 5 <= __clang_major__)))
+#  define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
+# else
+#  define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr
+#  define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3)
+#  define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2)
+#  define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3)
+#  define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3)
+#  define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95)
+#  define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1)
+#  define _GL_ATTR_diagnose_if 0
+#  define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3)
+#  define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1)
+#  define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0)
+#  define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7)
+#  define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6)
+#  define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0)
+#  ifdef _ICC
+#   define _GL_ATTR_may_alias 0
+#  else
+#   define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3)
+#  endif
+#  define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1)
+#  define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3)
+#  define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0)
+#  define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3)
+#  define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7)
+#  define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96)
+#  define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9)
+#  define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0)
+#  define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7)
+#  define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
+# endif
+#endif
+
+/* Use __has_c_attribute if available.  However, do not use with
+   pre-C23 GCC, which can issue false positives if -Wpedantic.  */
+#if (defined __has_c_attribute \
+     && ! (_GL_GNUC_PREREQ (4, 6) \
+           && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710))
+# define _GL_HAVE___HAS_C_ATTRIBUTE 1
+#else
+# define _GL_HAVE___HAS_C_ATTRIBUTE 0
+#endif
+
+/* Define if, in a function declaration, the attributes in bracket syntax
+   [[...]] must come before the attributes in __attribute__((...)) syntax.
+   If this is defined, it is best to avoid the bracket syntax, so that the
+   various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any
+   order.  */
+#ifdef __cplusplus
+# if defined __clang__
+#  define _GL_BRACKET_BEFORE_ATTRIBUTE 1
+# endif
+#else
+# if defined __GNUC__ && !defined __clang__
+#  define _GL_BRACKET_BEFORE_ATTRIBUTE 1
+# endif
+#endif
+]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead.
+[
+/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function
+   is the size of the returned memory block.
+   _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied
+   by the Nth argument of the function is the size of the returned memory block.
+ */
+/* Applies to: function, pointer to function, function types.  */
+#ifndef _GL_ATTRIBUTE_ALLOC_SIZE
+# if _GL_HAS_ATTRIBUTE (alloc_size)
+#  define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
+# else
+#  define _GL_ATTRIBUTE_ALLOC_SIZE(args)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the
+   function and report an error if it cannot do so.  */
+/* Applies to: function.  */
+#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE
+# if _GL_HAS_ATTRIBUTE (always_inline)
+#  define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
+# else
+#  define _GL_ATTRIBUTE_ALWAYS_INLINE
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show
+    in stack traces when debugging.  The compiler should omit the function from
+    stack traces.  */
+/* Applies to: function.  */
+#ifndef _GL_ATTRIBUTE_ARTIFICIAL
+# if _GL_HAS_ATTRIBUTE (artificial)
+#  define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
+# else
+#  define _GL_ATTRIBUTE_ARTIFICIAL
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_COLD declares that the function is rarely executed.  */
+/* Applies to: functions.  */
+/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at
+   <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>.
+   Also, Oracle Studio 12.6 requires 'cold' not '__cold__'.  */
+#ifndef _GL_ATTRIBUTE_COLD
+# if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__
+#  ifndef __SUNPRO_C
+#   define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__))
+#  else
+#   define _GL_ATTRIBUTE_COLD __attribute__ ((cold))
+#  endif
+# else
+#  define _GL_ATTRIBUTE_COLD
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate
+   calls to the function with the same arguments.
+   This attribute is safe for a function that neither depends on nor affects
+   observable state, and always returns exactly once - e.g., does not loop
+   forever, and does not call longjmp.
+   (This attribute is stricter than _GL_ATTRIBUTE_PURE.)  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_CONST
+# if _GL_HAS_ATTRIBUTE (const)
+#  define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
+# else
+#  define _GL_ATTRIBUTE_CONST
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
+   that can be freed by passing them as the Ith argument to the
+   function F.
+   _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+   can be freed via 'free'; it can be used only after declaring 'free'.  */
+/* Applies to: functions.  Cannot be used on inline functions.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# if _GL_GNUC_PREREQ (11, 0)
+#  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+# else
+#  define _GL_ATTRIBUTE_DEALLOC(f, i)
+# endif
+#endif
+/* If gnulib's <string.h> or <wchar.h> has already defined this macro, continue
+   to use this earlier definition, since <stdlib.h> may not have been included
+   yet.  */
+#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
+# if defined __cplusplus && defined __GNUC__ && !defined __clang__
+/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
+#  define _GL_ATTRIBUTE_DEALLOC_FREE \
+     _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
+# else
+#  define _GL_ATTRIBUTE_DEALLOC_FREE \
+     _GL_ATTRIBUTE_DEALLOC (free, 1)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_DEPRECATED: Declares that an entity is deprecated.
+   The compiler may warn if the entity is used.  */
+/* Applies to:
+     - function, variable,
+     - struct, union, struct/union member,
+     - enumeration, enumeration item,
+     - typedef,
+   in C++ also: namespace, class, template specialization.  */
+#ifndef _GL_ATTRIBUTE_DEPRECATED
+# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
+#  if _GL_HAVE___HAS_C_ATTRIBUTE
+#   if __has_c_attribute (__deprecated__)
+#    define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
+#   endif
+#  endif
+# endif
+# if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated)
+#  define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
+# endif
+# ifndef _GL_ATTRIBUTE_DEPRECATED
+#  define _GL_ATTRIBUTE_DEPRECATED
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and
+   the function call is not optimized away.
+   _GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and
+   the function call is not optimized away.  */
+/* Applies to: functions.  */
+#if !(defined _GL_ATTRIBUTE_ERROR && defined _GL_ATTRIBUTE_WARNING)
+# if _GL_HAS_ATTRIBUTE (error)
+#  define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg)))
+#  define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg)))
+# elif _GL_HAS_ATTRIBUTE (diagnose_if)
+#  define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error")))
+#  define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning")))
+# else
+#  define _GL_ATTRIBUTE_ERROR(msg)
+#  define _GL_ATTRIBUTE_WARNING(msg)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain
+   visible to debuggers etc., even with '-fwhole-program'.  */
+/* Applies to: functions, variables.  */
+#ifndef _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
+# if _GL_HAS_ATTRIBUTE (externally_visible)
+#  define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible))
+# else
+#  define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if
+   the control flow falls through to the immediately following 'case' or
+   'default' label.  The compiler should not warn in this case.  */
+/* Applies to: Empty statement (;), inside a 'switch' statement.  */
+/* Always expands to something.  */
+#ifndef _GL_ATTRIBUTE_FALLTHROUGH
+# if _GL_HAVE___HAS_C_ATTRIBUTE
+#  if __has_c_attribute (__fallthrough__)
+#   define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
+#  endif
+# endif
+# if !defined _GL_ATTRIBUTE_FALLTHROUGH && _GL_HAS_ATTRIBUTE (fallthrough)
+#  define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+# ifndef _GL_ATTRIBUTE_FALLTHROUGH
+#  define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK))
+   declares that the STRING-INDEXth function argument is a format string of
+   style ARCHETYPE, which is one of:
+     printf, gnu_printf
+     scanf, gnu_scanf,
+     strftime, gnu_strftime,
+     strfmon,
+   or the same thing prefixed and suffixed with '__'.
+   If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK
+   are suitable for the format string.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_FORMAT
+# if _GL_HAS_ATTRIBUTE (format)
+#  define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+# else
+#  define _GL_ATTRIBUTE_FORMAT(spec)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other
+   compilation unit, it executes code from that unit only by return or by
+   exception handling.  This declaration lets the compiler optimize that unit
+   more aggressively.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_LEAF
+# if _GL_HAS_ATTRIBUTE (leaf)
+#  define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__))
+# else
+#  define _GL_ATTRIBUTE_LEAF
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
+   allocated memory.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if _GL_HAS_ATTRIBUTE (malloc)
+#  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define _GL_ATTRIBUTE_MALLOC
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the
+   same storage as pointers to other types.  Thus this declaration disables
+   strict aliasing optimization.  */
+/* Applies to: types.  */
+/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK.  */
+#ifndef _GL_ATTRIBUTE_MAY_ALIAS
+# if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C
+#  define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__))
+# else
+#  define _GL_ATTRIBUTE_MAY_ALIAS
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
+   the entity is not used.  The compiler should not warn if the entity is not
+   used.  */
+/* Applies to:
+     - function, variable,
+     - struct, union, struct/union member,
+     - enumeration, enumeration item,
+     - typedef,
+   in C++ also: class.  */
+/* In C++ and C23, this is spelled [[__maybe_unused__]].
+   GCC's syntax is __attribute__ ((__unused__)).
+   clang supports both syntaxes.  Except that with clang ≥ 6, < 10, in C++ mode,
+   __has_c_attribute (__maybe_unused__) yields true but the use of
+   [[__maybe_unused__]] nevertheless produces a warning.  */
+#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
+#  if defined __clang__ && defined __cplusplus
+#   if !defined __apple_build_version__ && __clang_major__ >= 10
+#    define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+#   endif
+#  elif _GL_HAVE___HAS_C_ATTRIBUTE
+#   if __has_c_attribute (__maybe_unused__)
+#    define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+#   endif
+#  endif
+# endif
+# ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+#  define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
+# endif
+#endif
+/* Alternative spelling of this macro, for convenience and for
+   compatibility with glibc/include/libc-symbols.h.  */
+#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
+/* Earlier spellings of this macro.  */
+#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED
+
+/* _GL_ATTRIBUTE_NODISCARD declares that the caller of the function should not
+   discard the return value.  The compiler may warn if the caller does not use
+   the return value, unless the caller uses something like ignore_value.  */
+/* Applies to: function, enumeration, class.  */
+#ifndef _GL_ATTRIBUTE_NODISCARD
+# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
+#  if defined __clang__ && defined __cplusplus
+  /* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces
+     a warning.
+     The 1000 below means a yet unknown threshold.  When clang++ version X
+     starts supporting [[__nodiscard__]] without warning about it, you can
+     replace the 1000 with X.  */
+#   if __clang_major__ >= 1000
+#    define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
+#   endif
+#  elif _GL_HAVE___HAS_C_ATTRIBUTE
+#   if __has_c_attribute (__nodiscard__)
+#    define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
+#   endif
+#  endif
+# endif
+# if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result)
+#  define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
+# endif
+# ifndef _GL_ATTRIBUTE_NODISCARD
+#  define _GL_ATTRIBUTE_NODISCARD
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the
+   function.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_NOINLINE
+# if _GL_HAS_ATTRIBUTE (noinline)
+#  define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__))
+# else
+#  define _GL_ATTRIBUTE_NOINLINE
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,...
+   must not be NULL.
+   _GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be
+   null.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_NONNULL
+# if _GL_HAS_ATTRIBUTE (nonnull)
+#  define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
+# else
+#  define _GL_ATTRIBUTE_NONNULL(args)
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
+   not meant to be NUL-terminated.  */
+/* Applies to: struct/union members and variables that are arrays of element
+   type '[[un]signed] char'.  */
+#ifndef _GL_ATTRIBUTE_NONSTRING
+# if _GL_HAS_ATTRIBUTE (nonstring)
+#  define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
+# else
+#  define _GL_ATTRIBUTE_NONSTRING
+# endif
+#endif
+
+/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead.  */
+
+/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
+ */
+/* Applies to: functions.  */
+/* After a function's parameter list, this attribute must come first, before
+   other attributes.  */
+#ifndef _GL_ATTRIBUTE_NOTHROW
+# if defined __cplusplus
+#  if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4
+#   if __cplusplus >= 201103L
+#    define _GL_ATTRIBUTE_NOTHROW noexcept (true)
+#   else
+#    define _GL_ATTRIBUTE_NOTHROW throw ()
+#   endif
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# else
+#  if _GL_HAS_ATTRIBUTE (nothrow)
+#   define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
+#  else
+#   define _GL_ATTRIBUTE_NOTHROW
+#  endif
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_PACKED declares:
+   For struct members: The member has the smallest possible alignment.
+   For struct, union, class: All members have the smallest possible alignment,
+   minimizing the memory required.  */
+/* Applies to: struct members, struct, union,
+   in C++ also: class.  */
+#ifndef _GL_ATTRIBUTE_PACKED
+# if _GL_HAS_ATTRIBUTE (packed)
+#  define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
+# else
+#  define _GL_ATTRIBUTE_PACKED
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate
+   calls to the function with the same arguments if observable state is not
+   changed between calls.
+   This attribute is safe for a function that does not affect
+   observable state, and always returns exactly once.
+   (This attribute is looser than _GL_ATTRIBUTE_CONST.)  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_PURE
+# if _GL_HAS_ATTRIBUTE (pure)
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is
+   a non-NULL pointer.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_RETURNS_NONNULL
+# if _GL_HAS_ATTRIBUTE (returns_nonnull)
+#  define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
+# else
+#  define _GL_ATTRIBUTE_RETURNS_NONNULL
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a
+   trailing NULL argument.
+   _GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99).
+   _GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL.  */
+/* Applies to: functions.  */
+#ifndef _GL_ATTRIBUTE_SENTINEL
+# if _GL_HAS_ATTRIBUTE (sentinel)
+#  define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos))
+# else
+#  define _GL_ATTRIBUTE_SENTINEL(pos)
+# endif
+#endif
+
+/* A helper macro.  Don't use it directly.  */
+#ifndef _GL_ATTRIBUTE_UNUSED
+# if _GL_HAS_ATTRIBUTE (unused)
+#  define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+#  define _GL_ATTRIBUTE_UNUSED
+# endif
+#endif
+
+]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead.
+[
+/* _GL_UNUSED_LABEL; declares that it is not a programming mistake if the
+   immediately preceding label is not used.  The compiler should not warn
+   if the label is not used.  */
+/* Applies to: label (both in C and C++).  */
+/* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;'
+   syntax.  But clang does.  */
+#ifndef _GL_UNUSED_LABEL
+# if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__
+#  define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED
+# else
+#  define _GL_UNUSED_LABEL
+# endif
+#endif
+])
+  AH_VERBATIM([c_linkage],
+[/* In C++, there is the concept of "language linkage", that encompasses
+    name mangling and function calling conventions.
+    The following macros start and end a block of "C" linkage.  */
+#ifdef __cplusplus
+# define _GL_BEGIN_C_LINKAGE extern "C" {
+# define _GL_END_C_LINKAGE }
+#else
+# define _GL_BEGIN_C_LINKAGE
+# define _GL_END_C_LINKAGE
+#endif
+])
+  AH_VERBATIM([async_safe],
+[/* The _GL_ASYNC_SAFE marker should be attached to functions that are
+   signal handlers (for signals other than SIGABRT, SIGPIPE) or can be
+   invoked from such signal handlers.  Such functions have some restrictions:
+     * All functions that it calls should be marked _GL_ASYNC_SAFE as well,
+       or should be listed as async-signal-safe in POSIX
+       <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04>
+       section 2.4.3.  Note that malloc(), sprintf(), and fwrite(), in
+       particular, are NOT async-signal-safe.
+     * All memory locations (variables and struct fields) that these functions
+       access must be marked 'volatile'.  This holds for both read and write
+       accesses.  Otherwise the compiler might optimize away stores to and
+       reads from such locations that occur in the program, depending on its
+       data flow analysis.  For example, when the program contains a loop
+       that is intended to inspect a variable set from within a signal handler
+           while (!signal_occurred)
+             ;
+       the compiler is allowed to transform this into an endless loop if the
+       variable 'signal_occurred' is not declared 'volatile'.
+   Additionally, recall that:
+     * A signal handler should not modify errno (except if it is a handler
+       for a fatal signal and ends by raising the same signal again, thus
+       provoking the termination of the process).  If it invokes a function
+       that may clobber errno, it needs to save and restore the value of
+       errno.  */
+#define _GL_ASYNC_SAFE
+])
+  AH_VERBATIM([micro_optimizations],
+[/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where
+   n1 and n2 are expressions without side effects, that evaluate to real
+   numbers (excluding NaN).
+   It returns
+     1  if n1 > n2
+     0  if n1 == n2
+     -1 if n1 < n2
+   The naïve code   (n1 > n2 ? 1 : n1 < n2 ? -1 : 0)  produces a conditional
+   jump with nearly all GCC versions up to GCC 10.
+   This variant     (n1 < n2 ? -1 : n1 > n2)  produces a conditional with many
+   GCC versions up to GCC 9.
+   The better code  (n1 > n2) - (n1 < n2)  from Hacker's Delight § 2-9
+   avoids conditional jumps in all GCC versions >= 3.4.  */
+#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
+])
+  dnl Hint which direction to take regarding cross-compilation guesses:
+  dnl When a user installs a program on a platform they are not intimately
+  dnl familiar with, --enable-cross-guesses=conservative is the appropriate
+  dnl choice.  It implements the "If we don't know, assume the worst" principle.
+  dnl However, when an operating system developer (on a platform which is not
+  dnl yet known to gnulib) builds packages for their platform, they want to
+  dnl expose, not hide, possible platform bugs; in this case,
+  dnl --enable-cross-guesses=risky is the appropriate choice.
+  dnl Sets the variables
+  dnl gl_cross_guess_normal    (to be used when 'yes' is good and 'no' is bad),
+  dnl gl_cross_guess_inverted  (to be used when 'no' is good and 'yes' is bad).
+  AC_ARG_ENABLE([cross-guesses],
+    [AS_HELP_STRING([[--enable-cross-guesses={conservative|risky}]],
+       [specify policy for cross-compilation guesses])],
+    [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then
+       AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses])
+       enableval=conservative
+     fi
+     gl_cross_guesses="$enableval"],
+    [gl_cross_guesses=conservative])
+  if test $gl_cross_guesses = risky; then
+    gl_cross_guess_normal="guessing yes"
+    gl_cross_guess_inverted="guessing no"
+  else
+    gl_cross_guess_normal="guessing no"
+    gl_cross_guess_inverted="guessing yes"
+  fi
+  dnl Preparation for running test programs:
+  dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
+  dnl to /dev/tty, so they can be redirected to log files.  Such diagnostics
+  dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N.
+  LIBC_FATAL_STDERR_=1
+  export LIBC_FATAL_STDERR_
+])
+
+# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename])
+# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename], [initialvalue])
+# initializes the shell variable that indicates the presence of the given module
+# as a C preprocessor expression.
+AC_DEFUN([gl_MODULE_INDICATOR_INIT_VARIABLE],
+[
+  GL_MODULE_INDICATOR_PREFIX[]_[$1]=m4_if([$2], , [0], [$2])
+  AC_SUBST(GL_MODULE_INDICATOR_PREFIX[]_[$1])
+])
+
+# gl_MODULE_INDICATOR_CONDITION
+# expands to a C preprocessor expression that evaluates to 1 or 0, depending
+# whether a gnulib module that has been requested shall be considered present
+# or not.
+m4_define([gl_MODULE_INDICATOR_CONDITION], [1])
+
+# gl_MODULE_INDICATOR_SET_VARIABLE([modulename])
+# sets the shell variable that indicates the presence of the given module to
+# a C preprocessor expression that will evaluate to 1.
+AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
+[
+  gl_MODULE_INDICATOR_SET_VARIABLE_AUX(
+    [GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]m4_translit([[$1]],
+                                                       [abcdefghijklmnopqrstuvwxyz./-],
+                                                       [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])],
+    [gl_MODULE_INDICATOR_CONDITION])
+])
+
+# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable])
+# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION.
+# The shell variable's value is a C preprocessor expression that evaluates
+# to 0 or 1.
+AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX],
+[
+  m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1],
+    [
+     dnl Simplify the expression VALUE || 1 to 1.
+     $1=1
+    ],
+    [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1],
+                                             [gl_MODULE_INDICATOR_CONDITION])])
+])
+
+# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition])
+# modifies the shell variable to include the given condition.  The shell
+# variable's value is a C preprocessor expression that evaluates to 0 or 1.
+AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR],
+[
+  dnl Simplify the expression 1 || CONDITION to 1.
+  if test "$[]$1" != 1; then
+    dnl Simplify the expression 0 || CONDITION to CONDITION.
+    if test "$[]$1" = 0; then
+      $1=$2
+    else
+      $1="($[]$1 || $2)"
+    fi
+  fi
+])
+
+# gl_MODULE_INDICATOR([modulename])
+# defines a C macro indicating the presence of the given module
+# in a location where it can be used.
+#                                             |  Value  |   Value   |
+#                                             | in lib/ | in tests/ |
+# --------------------------------------------+---------+-----------+
+# Module present among main modules:          |    1    |     1     |
+# --------------------------------------------+---------+-----------+
+# Module present among tests-related modules: |    0    |     1     |
+# --------------------------------------------+---------+-----------+
+# Module not present at all:                  |    0    |     0     |
+# --------------------------------------------+---------+-----------+
+AC_DEFUN([gl_MODULE_INDICATOR],
+[
+  AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]],
+      [abcdefghijklmnopqrstuvwxyz./-],
+      [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]),
+    [gl_MODULE_INDICATOR_CONDITION],
+    [Define to a C preprocessor expression that evaluates to 1 or 0,
+     depending whether the gnulib module $1 shall be considered present.])
+])
+
+# gl_MODULE_INDICATOR_FOR_TESTS([modulename])
+# defines a C macro indicating the presence of the given module
+# in lib or tests. This is useful to determine whether the module
+# should be tested.
+#                                             |  Value  |   Value   |
+#                                             | in lib/ | in tests/ |
+# --------------------------------------------+---------+-----------+
+# Module present among main modules:          |    1    |     1     |
+# --------------------------------------------+---------+-----------+
+# Module present among tests-related modules: |    1    |     1     |
+# --------------------------------------------+---------+-----------+
+# Module not present at all:                  |    0    |     0     |
+# --------------------------------------------+---------+-----------+
+AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
+[
+  AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]],
+      [abcdefghijklmnopqrstuvwxyz./-],
+      [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
+    [Define to 1 when the gnulib module $1 should be tested.])
+])
+
+# gl_ASSERT_NO_GNULIB_POSIXCHECK
+# asserts that there will never be a need to #define GNULIB_POSIXCHECK.
+# and thereby enables an optimization of configure and config.h.
+# Used by Emacs.
+AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK],
+[
+  dnl Override gl_WARN_ON_USE_PREPARE.
+  dnl But hide this definition from 'aclocal'.
+  AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], [])
+])
+
+# gl_ASSERT_NO_GNULIB_TESTS
+# asserts that there will be no gnulib tests in the scope of the configure.ac
+# and thereby enables an optimization of config.h.
+# Used by Emacs.
+AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS],
+[
+  dnl Override gl_MODULE_INDICATOR_FOR_TESTS.
+  AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], [])
+])
+
+# Test whether <features.h> exists.
+# Set HAVE_FEATURES_H.
+AC_DEFUN([gl_FEATURES_H],
+[
+  AC_CHECK_HEADERS_ONCE([features.h])
+  if test $ac_cv_header_features_h = yes; then
+    HAVE_FEATURES_H=1
+  else
+    HAVE_FEATURES_H=0
+  fi
+  AC_SUBST([HAVE_FEATURES_H])
+])
+
+# gl_PROG_CC_C99
+# Modifies the value of the shell variable CC in an attempt to make $CC
+# understand ISO C99 source code.
+AC_DEFUN([gl_PROG_CC_C99],
+[
+  dnl Just use AC_PROG_CC_C99.
+  dnl When AC_PROG_CC_C99 and AC_PROG_CC_STDC are used together, the substituted
+  dnl value of CC will contain the C99 enabling options twice. But this is only
+  dnl a cosmetic problem.
+  dnl With Autoconf >= 2.70, use AC_PROG_CC since it implies AC_PROG_CC_C99;
+  dnl this avoids a "warning: The macro `AC_PROG_CC_C99' is obsolete."
+  m4_version_prereq([2.70],
+    [AC_REQUIRE([AC_PROG_CC])],
+    [AC_REQUIRE([AC_PROG_CC_C99])])
+])
+
+# gl_PROG_AR_RANLIB
+# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler.
+# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override
+# the values.
+AC_DEFUN([gl_PROG_AR_RANLIB],
+[
+  dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler
+  dnl as "cc", and GCC as "gcc". They have different object file formats and
+  dnl library formats. In particular, the GNU binutils programs ar and ranlib
+  dnl produce libraries that work only with gcc, not with cc.
+  AC_REQUIRE([AC_PROG_CC])
+  dnl The '][' hides this use from 'aclocal'.
+  AC_BEFORE([$0], [A][M_PROG_AR])
+  AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler],
+    [
+      AC_EGREP_CPP([Amsterdam],
+        [
+#ifdef __ACK__
+Amsterdam
+#endif
+        ],
+        [gl_cv_c_amsterdam_compiler=yes],
+        [gl_cv_c_amsterdam_compiler=no])
+    ])
+
+  dnl Don't compete with AM_PROG_AR's decision about AR/ARFLAGS if we are not
+  dnl building with __ACK__.
+  if test $gl_cv_c_amsterdam_compiler = yes; then
+    if test -z "$AR"; then
+      AR='cc -c.a'
+    fi
+    if test -z "$ARFLAGS"; then
+      ARFLAGS='-o'
+    fi
+  else
+    dnl AM_PROG_AR was added in automake v1.11.2.  AM_PROG_AR does not AC_SUBST
+    dnl ARFLAGS variable (it is filed into Makefile.in directly by automake
+    dnl script on-demand, if not specified by ./configure of course).
+    dnl Don't AC_REQUIRE the AM_PROG_AR otherwise the code for __ACK__ above
+    dnl will be ignored.  Also, pay attention to call AM_PROG_AR in else block
+    dnl because AM_PROG_AR is written so it could re-set AR variable even for
+    dnl __ACK__.  It may seem like its easier to avoid calling the macro here,
+    dnl but we need to AC_SUBST both AR/ARFLAGS (thus those must have some good
+    dnl default value and automake should usually know them).
+    dnl
+    dnl The '][' hides this use from 'aclocal'.
+    m4_ifdef([A][M_PROG_AR], [A][M_PROG_AR], [:])
+  fi
+
+  dnl In case the code above has not helped with setting AR/ARFLAGS, use
+  dnl Automake-documented default values for AR and ARFLAGS, but prefer
+  dnl ${host}-ar over ar (useful for cross-compiling).
+  AC_CHECK_TOOL([AR], [ar], [ar])
+  if test -z "$ARFLAGS"; then
+    ARFLAGS='cr'
+  fi
+
+  AC_SUBST([AR])
+  AC_SUBST([ARFLAGS])
+  if test -z "$RANLIB"; then
+    if test $gl_cv_c_amsterdam_compiler = yes; then
+      RANLIB=':'
+    else
+      dnl Use the ranlib program if it is available.
+      AC_PROG_RANLIB
+    fi
+  fi
+  AC_SUBST([RANLIB])
+])
+
+# AC_C_RESTRICT
+# This definition is copied from post-2.70 Autoconf and overrides the
+# AC_C_RESTRICT macro from autoconf 2.60..2.70.
+m4_version_prereq([2.70.1], [], [
+AC_DEFUN([AC_C_RESTRICT],
+[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
+  [ac_cv_c_restrict=no
+   # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see:
+   # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html
+   # Put 'restrict' last, because C++ lacks it.
+   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 bar (int [$ac_kw]); /* Catch GCC bug 14050.  */
+           int bar (int ip[$ac_kw]) { return ip[0]; }
+         ]],
+         [[int s[1];
+           int *$ac_kw t = s;
+           t[0] = 0;
+           return foo (t) + bar (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 only directly.  */
+#undef restrict
+/* Work around a bug in older versions of Sun C++, which did not
+   #define __restrict__ or support _Restrict or __restrict__
+   even though the corresponding Sun C compiler ended up with
+   "#define restrict _Restrict" or "#define restrict __restrict__"
+   in the previous line.  This workaround can be removed once
+   we assume Oracle Developer Studio 12.5 (2016) or later.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__
+# define _Restrict
+# define __restrict__
+#endif])
+ case $ac_cv_c_restrict in
+   restrict) ;;
+   no) AC_DEFINE([restrict], []) ;;
+   *)  AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
+ esac
+])# AC_C_RESTRICT
+])
+
+# gl_BIGENDIAN
+# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
+# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some
+# macros invoke AC_C_BIGENDIAN with arguments.
+AC_DEFUN([gl_BIGENDIAN],
+[
+  AC_C_BIGENDIAN
+])
+
+# A temporary file descriptor.
+# Must be less than 10, because dash 0.5.8 does not support redirections
+# with multi-digit file descriptors.
+m4_define([GL_TMP_FD], 9)
+
+# gl_SILENT(command)
+# executes command, but without the normal configure output.
+# This is useful when you want to invoke AC_CACHE_CHECK (or AC_CHECK_FUNC etc.)
+# inside another AC_CACHE_CHECK.
+AC_DEFUN([gl_SILENT],
+[
+  exec GL_TMP_FD>&AS_MESSAGE_FD AS_MESSAGE_FD>/dev/null
+  $1
+  exec AS_MESSAGE_FD>&GL_TMP_FD GL_TMP_FD>&-
+])
+
+# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it)
+# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not
+# output a spurious "(cached)" mark in the midst of other configure output.
+# This macro should be used instead of AC_CACHE_VAL when it is not surrounded
+# by an AC_MSG_CHECKING/AC_MSG_RESULT pair.
+AC_DEFUN([gl_CACHE_VAL_SILENT],
+[
+  gl_SILENT([
+    AC_CACHE_VAL([$1], [$2])
+  ])
+])
+
+# gl_CONDITIONAL(conditional, condition)
+# is like AM_CONDITIONAL(conditional, condition), except that it does not
+# produce an error
+#   configure: error: conditional "..." was never defined.
+#   Usually this means the macro was only invoked conditionally.
+# when only invoked conditionally. Instead, in that case, both the _TRUE
+# and the _FALSE case are disabled.
+AC_DEFUN([gl_CONDITIONAL],
+[
+  pushdef([AC_CONFIG_COMMANDS_PRE], [:])dnl
+  AM_CONDITIONAL([$1], [$2])
+  popdef([AC_CONFIG_COMMANDS_PRE])dnl
+  if test -z "${[$1]_TRUE}" && test -z "${[$1]_FALSE}"; then
+    [$1]_TRUE='#'
+    [$1]_FALSE='#'
+  fi
+])
+
+# gl_CC_ALLOW_WARNINGS
+# sets and substitutes a variable GL_CFLAG_ALLOW_WARNINGS, to a $(CC) option
+# that reverts a preceding '-Werror' option, if available.
+# This is expected to be '-Wno-error' on gcc, clang (except clang/MSVC), xlclang
+# and empty otherwise.
+AC_DEFUN([gl_CC_ALLOW_WARNINGS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_CACHE_CHECK([for C compiler option to allow warnings],
+    [gl_cv_cc_wallow],
+    [rm -f conftest*
+     echo 'int dummy;' > conftest.c
+     AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
+     AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null
+     dnl Test the number of error output lines, because AIX xlc accepts the
+     dnl option '-Wno-error', just to produce a warning
+     dnl "Option -Wno-error was incorrectly specified. The option will be ignored."
+     dnl afterwards.
+     if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
+       gl_cv_cc_wallow='-Wno-error'
+     else
+       gl_cv_cc_wallow=none
+     fi
+     rm -f conftest*
+    ])
+  case "$gl_cv_cc_wallow" in
+    none) GL_CFLAG_ALLOW_WARNINGS='' ;;
+    *)    GL_CFLAG_ALLOW_WARNINGS="$gl_cv_cc_wallow" ;;
+  esac
+  AC_SUBST([GL_CFLAG_ALLOW_WARNINGS])
+])
+
+# gl_CXX_ALLOW_WARNINGS
+# sets and substitutes a variable GL_CXXFLAG_ALLOW_WARNINGS, to a $(CC) option
+# that reverts a preceding '-Werror' option, if available.
+AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
+[
+  dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX.
+  if test -n "$CXX" && test "$CXX" != no; then
+    AC_CACHE_CHECK([for C++ compiler option to allow warnings],
+      [gl_cv_cxx_wallow],
+      [rm -f conftest*
+       echo 'int dummy;' > conftest.cc
+       AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
+       AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null
+       dnl Test the number of error output lines, because AIX xlC accepts the
+       dnl option '-Wno-error', just to produce a warning
+       dnl "Option -Wno-error was incorrectly specified. The option will be ignored."
+       dnl afterwards.
+       if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
+         gl_cv_cxx_wallow='-Wno-error'
+       else
+         gl_cv_cxx_wallow=none
+       fi
+       rm -f conftest*
+      ])
+    case "$gl_cv_cxx_wallow" in
+      none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
+      *)    GL_CXXFLAG_ALLOW_WARNINGS="$gl_cv_cxx_wallow" ;;
+    esac
+  else
+    GL_CXXFLAG_ALLOW_WARNINGS=''
+  fi
+  AC_SUBST([GL_CXXFLAG_ALLOW_WARNINGS])
+])
+
+# gl_CC_GNULIB_WARNINGS
+# sets and substitutes a variable GL_CFLAG_GNULIB_WARNINGS, to a $(CC) option
+# set that enables or disables warnings as suitable for the Gnulib coding style.
+AC_DEFUN([gl_CC_GNULIB_WARNINGS],
+[
+  AC_REQUIRE([gl_CC_ALLOW_WARNINGS])
+  dnl Assume that the compiler supports -Wno-* options only if it also supports
+  dnl -Wno-error.
+  GL_CFLAG_GNULIB_WARNINGS=''
+  if test -n "$GL_CFLAG_ALLOW_WARNINGS"; then
+    dnl Enable these warning options:
+    dnl
+    dnl                                       GCC             clang
+    dnl -Wno-cast-qual                        >= 3            >= 3.9
+    dnl -Wno-conversion                       >= 3            >= 3.9
+    dnl -Wno-float-conversion                 >= 4.9          >= 3.9
+    dnl -Wno-float-equal                      >= 3            >= 3.9
+    dnl -Wimplicit-fallthrough                >= 7            >= 3.9
+    dnl -Wno-pedantic                         >= 4.8          >= 3.9
+    dnl -Wno-sign-compare                     >= 3            >= 3.9
+    dnl -Wno-sign-conversion                  >= 4.3          >= 3.9
+    dnl -Wno-tautological-out-of-range-compare  -             >= 3.9
+    dnl -Wno-type-limits                      >= 4.3          >= 3.9
+    dnl -Wno-undef                            >= 3            >= 3.9
+    dnl -Wno-unsuffixed-float-constants       >= 4.5
+    dnl -Wno-unused-function                  >= 3            >= 3.9
+    dnl -Wno-unused-parameter                 >= 3            >= 3.9
+    dnl
+    cat > conftest.c <<\EOF
+      #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      -Wno-cast-qual
+      -Wno-conversion
+      -Wno-float-equal
+      -Wno-sign-compare
+      -Wno-undef
+      -Wno-unused-function
+      -Wno-unused-parameter
+      #endif
+      #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      -Wno-float-conversion
+      #endif
+      #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      -Wimplicit-fallthrough
+      #endif
+      #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      -Wno-pedantic
+      #endif
+      #if 3 < __clang_major__ + (9 <= __clang_minor__)
+      -Wno-tautological-constant-out-of-range-compare
+      #endif
+      #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      -Wno-sign-conversion
+      -Wno-type-limits
+      #endif
+      #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4
+      -Wno-unsuffixed-float-constants
+      #endif
+EOF
+    gl_command="$CC $CFLAGS $CPPFLAGS -E conftest.c > conftest.out"
+    if AC_TRY_EVAL([gl_command]); then
+      gl_options=`grep -v '#' conftest.out`
+      for word in $gl_options; do
+        GL_CFLAG_GNULIB_WARNINGS="$GL_CFLAG_GNULIB_WARNINGS $word"
+      done
+    fi
+    rm -f conftest.c conftest.out
+  fi
+  AC_SUBST([GL_CFLAG_GNULIB_WARNINGS])
+])
+
+dnl gl_CONDITIONAL_HEADER([foo.h])
+dnl takes a shell variable GL_GENERATE_FOO_H (with value true or false) as input
+dnl and produces
+dnl   - an AC_SUBSTed variable FOO_H that is either a file name or empty, based
+dnl     on whether GL_GENERATE_FOO_H is true or false,
+dnl   - an Automake conditional GL_GENERATE_FOO_H that evaluates to the value of
+dnl     the shell variable GL_GENERATE_FOO_H.
+AC_DEFUN([gl_CONDITIONAL_HEADER],
+[
+  m4_pushdef([gl_header_name], AS_TR_SH(m4_toupper($1)))
+  m4_pushdef([gl_generate_var], [GL_GENERATE_]AS_TR_SH(m4_toupper($1)))
+  m4_pushdef([gl_generate_cond], [GL_GENERATE_]AS_TR_SH(m4_toupper($1)))
+  case "$gl_generate_var" in
+    false) gl_header_name='' ;;
+    true)
+      dnl It is OK to use a .h file in lib/ from within tests/, but not vice
+      dnl versa.
+      if test -z "$gl_header_name"; then
+        gl_header_name="${gl_source_base_prefix}$1"
+      fi
+      ;;
+    *) echo "*** gl_generate_var is not set correctly" 1>&2; exit 1 ;;
+  esac
+  AC_SUBST(gl_header_name)
+  gl_CONDITIONAL(gl_generate_cond, [$gl_generate_var])
+  m4_popdef([gl_generate_cond])
+  m4_popdef([gl_generate_var])
+  m4_popdef([gl_header_name])
+])
+
+dnl Preparations for gl_CHECK_FUNCS_MACOS.
+AC_DEFUN([gl_PREPARE_CHECK_FUNCS_MACOS],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_COMPILER_CLANG])
+  AC_CACHE_CHECK([for compiler option needed when checking for future declarations],
+    [gl_cv_compiler_check_future_option],
+    [case "$host_os" in
+       dnl This is only needed on macOS.
+       darwin*)
+         if test $gl_cv_compiler_clang = yes; then
+           dnl Test whether the compiler supports the option
+           dnl '-Werror=unguarded-availability-new'.
+           save_ac_compile="$ac_compile"
+           ac_compile="$ac_compile -Werror=unguarded-availability-new"
+           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
+             [gl_cv_compiler_check_future_option='-Werror=unguarded-availability-new'],
+             [gl_cv_compiler_check_future_option=none])
+           ac_compile="$save_ac_compile"
+         else
+           gl_cv_compiler_check_future_option=none
+         fi
+         ;;
+       *) gl_cv_compiler_check_future_option=none ;;
+     esac
+    ])
+])
+
+dnl Pieces of the expansion of
+dnl gl_CHECK_FUNCS_ANDROID
+dnl gl_CHECK_FUNCS_MACOS
+dnl gl_CHECK_FUNCS_ANDROID_MACOS
+
+AC_DEFUN([gl_CHECK_FUNCS_DEFAULT_CASE],
+[
+         *)
+           AC_CHECK_FUNC([$1])
+           [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1]
+           ;;
+])
+
+AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_ANDROID],
+[
+         linux*-android*)
+           AC_CHECK_DECL([$1], , , [$2])
+           if test $[ac_cv_have_decl_][$1] = yes; then
+             AC_CHECK_FUNC([[$1]])
+             if test $[ac_cv_func_][$1] = yes; then
+               [gl_cv_onwards_func_][$1]=yes
+             else
+               dnl The function is declared but does not exist. This should not
+               dnl happen normally. But anyway, we know that a future version
+               dnl of Android will have the function.
+               [gl_cv_onwards_func_][$1]='future OS version'
+             fi
+           else
+             [gl_cv_onwards_func_][$1]='future OS version'
+           fi
+           ;;
+])
+
+AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS],
+[
+         darwin*)
+           if test "x$gl_cv_compiler_check_future_option" != "xnone"; then
+             dnl Use a compile test, not a link test.
+             save_ac_compile="$ac_compile"
+             ac_compile="$ac_compile $gl_cv_compiler_check_future_option"
+             save_ac_compile_for_check_decl="$ac_compile_for_check_decl"
+             ac_compile_for_check_decl="$ac_compile_for_check_decl $gl_cv_compiler_check_future_option"
+             unset [ac_cv_have_decl_][$1]
+             AC_CHECK_DECL([$1], , , [$2])
+             ac_compile="$save_ac_compile"
+             ac_compile_for_check_decl="$save_ac_compile_for_check_decl"
+             [ac_cv_func_][$1]="$[ac_cv_have_decl_][$1]"
+             if test $[ac_cv_func_][$1] = yes; then
+               [gl_cv_onwards_func_][$1]=yes
+             else
+               unset [ac_cv_have_decl_][$1]
+               AC_CHECK_DECL([$1], , , [$2])
+               if test $[ac_cv_have_decl_][$1] = yes; then
+                 [gl_cv_onwards_func_][$1]='future OS version'
+               else
+                 [gl_cv_onwards_func_][$1]=no
+               fi
+             fi
+           else
+             AC_CHECK_FUNC([$1])
+             [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1]
+           fi
+           ;;
+])
+
+AC_DEFUN([gl_CHECK_FUNCS_SET_RESULTS],
+[
+  case "$[gl_cv_onwards_func_][$1]" in
+    future*) [ac_cv_func_][$1]=no ;;
+    *)       [ac_cv_func_][$1]=$[gl_cv_onwards_func_][$1] ;;
+  esac
+  if test $[ac_cv_func_][$1] = yes; then
+    AC_DEFINE([HAVE_]m4_translit([[$1]],
+                                 [abcdefghijklmnopqrstuvwxyz],
+                                 [ABCDEFGHIJKLMNOPQRSTUVWXYZ]),
+              [1], [Define to 1 if you have the `$1' function.])
+  fi
+])
+
+dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
+dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
+dnl on Android.
+dnl
+dnl When code is compiled on Android, it is in the context of a certain
+dnl "Android API level", which indicates the minimum version of Android on
+dnl which the app can be installed. In other words, you don't compile for a
+dnl specific version of Android. You compile for all versions of Android,
+dnl onwards from the given API level.
+dnl Thus, the question "does the OS have the function func" has three possible
+dnl answers:
+dnl   - yes, in all versions starting from the given API level,
+dnl   - no, in no version,
+dnl   - not in the given API level, but in a later version of Android.
+dnl
+dnl In detail, this works as follows:
+dnl If func was added to Android API level, say, 28, then the libc.so has the
+dnl symbol func always, whereas the header file <foo.h> declares func
+dnl conditionally:
+dnl   #if __ANDROID_API__ >= 28
+dnl   ... func (...) __INTRODUCED_IN(28);
+dnl   #endif
+dnl Thus, when compiling with "clang -target armv7a-unknown-linux-android28",
+dnl the function func is declared and exists in libc.
+dnl Whereas when compiling with "clang -target armv7a-unknown-linux-android27",
+dnl the function func is not declared but exists in libc.
+dnl
+dnl This macro sets two variables:
+dnl   - gl_cv_onwards_func_<func>   to yes / no / "future OS version"
+dnl   - ac_cv_func_<func>           to yes / no / no
+dnl The first variable allows to distinguish all three cases.
+dnl The second variable is set, so that an invocation
+dnl   gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
+dnl can be used as a drop-in replacement for
+dnl   AC_CHECK_FUNCS([func]).
+AC_DEFUN([gl_CHECK_FUNCS_ANDROID],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([for [$1]],
+    [[gl_cv_onwards_func_][$1]],
+    [gl_SILENT([
+       case "$host_os" in
+         gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2])
+         gl_CHECK_FUNCS_DEFAULT_CASE([$1])
+       esac
+      ])
+    ])
+  gl_CHECK_FUNCS_SET_RESULTS([$1])
+])
+
+dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
+dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
+dnl on macOS.
+dnl
+dnl When code is compiled on macOS, it is in the context of a certain minimum
+dnl macOS version, that can be set through the option '-mmacosx-version-min='.
+dnl In other words, you don't compile for a specific version of macOS. You
+dnl compile for all versions of macOS, onwards from the given version.
+dnl Thus, the question "does the OS have the function func" has three possible
+dnl answers:
+dnl   - yes, in all versions starting from the given version,
+dnl   - no, in no version,
+dnl   - not in the given version, but in a later version of macOS.
+dnl
+dnl In detail, this works as follows:
+dnl If func was added to, say, macOS version 13, then the libc has the
+dnl symbol func always, whereas the header file <foo.h> declares func
+dnl conditionally with a special availability attribute:
+dnl   ... func (...) __attribute__((availability(macos,introduced=13.0)));
+dnl Thus, when compiling with "clang mmacosx-version-min=13", there is no
+dnl warning about the use of func, and the resulting binary
+dnl   - runs fine on macOS 13,
+dnl   - aborts with a dyld "Symbol not found" message on macOS 12.
+dnl Whereas, when compiling with "clang mmacosx-version-min=12", there is a
+dnl   warning: 'func' is only available on macOS 13.0 or newer
+dnl   [-Wunguarded-availability-new],
+dnl and the resulting binary
+dnl   - runs fine on macOS 13,
+dnl   - crashes with a SIGSEGV (signal 11) on macOS 12.
+dnl
+dnl This macro sets two variables:
+dnl   - gl_cv_onwards_func_<func>   to yes / no / "future OS version"
+dnl   - ac_cv_func_<func>           to yes / no / no
+dnl The first variable allows to distinguish all three cases.
+dnl The second variable is set, so that an invocation
+dnl   gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
+dnl can be used as a drop-in replacement for
+dnl   AC_CHECK_FUNCS([func]).
+AC_DEFUN([gl_CHECK_FUNCS_MACOS],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS])
+  AC_CACHE_CHECK([for [$1]],
+    [[gl_cv_onwards_func_][$1]],
+    [gl_SILENT([
+       case "$host_os" in
+         gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2])
+         gl_CHECK_FUNCS_DEFAULT_CASE([$1])
+       esac
+      ])
+    ])
+  gl_CHECK_FUNCS_SET_RESULTS([$1])
+])
+
+dnl gl_CHECK_FUNCS_ANDROID_MACOS([func], [[#include <foo.h>]])
+dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
+dnl on Android and on macOS.
+dnl It is the combination of gl_CHECK_FUNCS_ANDROID and gl_CHECK_FUNCS_MACOS.
+AC_DEFUN([gl_CHECK_FUNCS_ANDROID_MACOS],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS])
+  AC_CACHE_CHECK([for [$1]],
+    [[gl_cv_onwards_func_][$1]],
+    [gl_SILENT([
+       case "$host_os" in
+         gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2])
+         gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2])
+         gl_CHECK_FUNCS_DEFAULT_CASE([$1])
+       esac
+      ])
+    ])
+  gl_CHECK_FUNCS_SET_RESULTS([$1])
+])
+
+dnl Expands to some code for use in .c programs that, on native Windows, defines
+dnl the Microsoft deprecated alias function names to the underscore-prefixed
+dnl actual function names. With this macro, these function names are available
+dnl without linking with '-loldnames' and without generating warnings.
+dnl Usage: Use it after all system header files are included.
+dnl          #include <...>
+dnl          #include <...>
+dnl          ]GL_MDA_DEFINES[
+dnl          ...
+AC_DEFUN([GL_MDA_DEFINES],[
+AC_REQUIRE([_GL_MDA_DEFINES])
+[$gl_mda_defines]
+])
+AC_DEFUN([_GL_MDA_DEFINES],
+[gl_mda_defines='
+#if defined _WIN32 && !defined __CYGWIN__
+#define access    _access
+#define chdir     _chdir
+#define chmod     _chmod
+#define close     _close
+#define creat     _creat
+#define dup       _dup
+#define dup2      _dup2
+#define ecvt      _ecvt
+#define execl     _execl
+#define execle    _execle
+#define execlp    _execlp
+#define execv     _execv
+#define execve    _execve
+#define execvp    _execvp
+#define execvpe   _execvpe
+#define fcloseall _fcloseall
+#define fcvt      _fcvt
+#define fdopen    _fdopen
+#define fileno    _fileno
+#define gcvt      _gcvt
+#define getcwd    _getcwd
+#define getpid    _getpid
+#define getw      _getw
+#define isatty    _isatty
+#define j0        _j0
+#define j1        _j1
+#define jn        _jn
+#define lfind     _lfind
+#define lsearch   _lsearch
+#define lseek     _lseek
+#define memccpy   _memccpy
+#define mkdir     _mkdir
+#define mktemp    _mktemp
+#define open      _open
+#define putenv    _putenv
+#define putw      _putw
+#define read      _read
+#define rmdir     _rmdir
+#define strdup    _strdup
+#define swab      _swab
+#define tempnam   _tempnam
+#define tzset     _tzset
+#define umask     _umask
+#define unlink    _unlink
+#define utime     _utime
+#define wcsdup    _wcsdup
+#define write     _write
+#define y0        _y0
+#define y1        _y1
+#define yn        _yn
+#endif
+'
+])
deleted file mode 120000 (symlink)
index 4d9b05039a10826ea43e61c8ae8f1003731b49c5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/gnulib-tool.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ccf619d6bd19d093e51d919e0d208fa6c040a0fa
--- /dev/null
@@ -0,0 +1,63 @@
+# gnulib-tool.m4 serial 4
+dnl Copyright (C) 2004-2005, 2009-2024 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 The following macros need not be invoked explicitly.
+dnl Invoking them does nothing except to declare default arguments
+dnl for "gnulib-tool --import".
+
+dnl Usage: gl_LOCAL_DIR([DIR])
+AC_DEFUN([gl_LOCAL_DIR], [])
+
+dnl Usage: gl_MODULES([module1 module2 ...])
+AC_DEFUN([gl_MODULES], [])
+
+dnl Usage: gl_AVOID([module1 module2 ...])
+AC_DEFUN([gl_AVOID], [])
+
+dnl Usage: gl_SOURCE_BASE([DIR])
+AC_DEFUN([gl_SOURCE_BASE], [])
+
+dnl Usage: gl_M4_BASE([DIR])
+AC_DEFUN([gl_M4_BASE], [])
+
+dnl Usage: gl_PO_BASE([DIR])
+AC_DEFUN([gl_PO_BASE], [])
+
+dnl Usage: gl_DOC_BASE([DIR])
+AC_DEFUN([gl_DOC_BASE], [])
+
+dnl Usage: gl_TESTS_BASE([DIR])
+AC_DEFUN([gl_TESTS_BASE], [])
+
+dnl Usage: gl_WITH_TESTS
+AC_DEFUN([gl_WITH_TESTS], [])
+
+dnl Usage: gl_LIB([LIBNAME])
+AC_DEFUN([gl_LIB], [])
+
+dnl Usage: gl_LGPL or gl_LGPL([VERSION])
+AC_DEFUN([gl_LGPL], [])
+
+dnl Usage: gl_MAKEFILE_NAME([FILENAME])
+AC_DEFUN([gl_MAKEFILE_NAME], [])
+
+dnl Usage: gl_TESTS_MAKEFILE_NAME([FILENAME])
+AC_DEFUN([gl_TESTS_MAKEFILE_NAME], [])
+
+dnl Usage: gl_AUTOMAKE_SUBDIR
+AC_DEFUN([gl_AUTOMAKE_SUBDIR], [])
+
+dnl Usage: gl_LIBTOOL
+AC_DEFUN([gl_LIBTOOL], [])
+
+dnl Usage: gl_MACRO_PREFIX([PREFIX])
+AC_DEFUN([gl_MACRO_PREFIX], [])
+
+dnl Usage: gl_PO_DOMAIN([DOMAIN])
+AC_DEFUN([gl_PO_DOMAIN], [])
+
+dnl Usage: gl_VC_FILES([BOOLEAN])
+AC_DEFUN([gl_VC_FILES], [])
deleted file mode 120000 (symlink)
index eb73e5fb357f0f2b471a8382c82f0c9597e42090..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/group-member.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..60b3d526db2b801aad0a5ceb556cdcf234616c92
--- /dev/null
@@ -0,0 +1,29 @@
+# serial 14
+
+# Copyright (C) 1999-2001, 2003-2007, 2009-2024 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 Written by Jim Meyering
+
+AC_DEFUN([gl_FUNC_GROUP_MEMBER],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
+  dnl Persuade glibc <unistd.h> to declare group_member().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl Do this replacement check manually because I want the hyphen
+  dnl (not the underscore) in the filename.
+  AC_CHECK_FUNC([group_member], , [
+    HAVE_GROUP_MEMBER=0
+  ])
+])
+
+# Prerequisites of lib/group-member.c.
+AC_DEFUN([gl_PREREQ_GROUP_MEMBER],
+[
+  AC_REQUIRE([AC_FUNC_GETGROUPS])
+])
deleted file mode 120000 (symlink)
index fa77bf6d751319b128a9a686b091c52d2425e7f2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/host-cpu-c-abi.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e860a19e74ab5e4e4c806057e0efcbae80903947
--- /dev/null
@@ -0,0 +1,527 @@
+# host-cpu-c-abi.m4 serial 17
+dnl Copyright (C) 2002-2024 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 Bruno Haible and Sam Steingold.
+
+dnl Sets the HOST_CPU variable to the canonical name of the CPU.
+dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its
+dnl C language ABI (application binary interface).
+dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in
+dnl config.h.
+dnl
+dnl This canonical name can be used to select a particular assembly language
+dnl source file that will interoperate with C code on the given host.
+dnl
+dnl For example:
+dnl * 'i386' and 'sparc' are different canonical names, because code for i386
+dnl   will not run on SPARC CPUs and vice versa. They have different
+dnl   instruction sets.
+dnl * 'sparc' and 'sparc64' are different canonical names, because code for
+dnl   'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code
+dnl   contains 32-bit instructions, whereas 'sparc64' code contains 64-bit
+dnl   instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit
+dnl   mode, but not both.
+dnl * 'mips' and 'mipsn32' are different canonical names, because they use
+dnl   different argument passing and return conventions for C functions, and
+dnl   although the instruction set of 'mips' is a large subset of the
+dnl   instruction set of 'mipsn32'.
+dnl * 'mipsn32' and 'mips64' are different canonical names, because they use
+dnl   different sizes for the C types like 'int' and 'void *', and although
+dnl   the instruction sets of 'mipsn32' and 'mips64' are the same.
+dnl * The same canonical name is used for different endiannesses. You can
+dnl   determine the endianness through preprocessor symbols:
+dnl   - 'arm': test __ARMEL__.
+dnl   - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL.
+dnl   - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN.
+dnl * The same name 'i386' is used for CPUs of type i386, i486, i586
+dnl   (Pentium), AMD K7, Pentium II, Pentium IV, etc., because
+dnl   - Instructions that do not exist on all of these CPUs (cmpxchg,
+dnl     MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your
+dnl     assembly language source files use such instructions, you will
+dnl     need to make the distinction.
+dnl   - Speed of execution of the common instruction set is reasonable across
+dnl     the entire family of CPUs. If you have assembly language source files
+dnl     that are optimized for particular CPU types (like GNU gmp has), you
+dnl     will need to make the distinction.
+dnl   See <https://en.wikipedia.org/wiki/X86_instruction_listings>.
+AC_DEFUN([gl_HOST_CPU_C_ABI],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_C_ASM])
+  AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi],
+    [case "$host_cpu" in
+
+changequote(,)dnl
+       i[34567]86 )
+changequote([,])dnl
+         gl_cv_host_cpu_c_abi=i386
+         ;;
+
+       x86_64 )
+         # On x86_64 systems, the C compiler may be generating code in one of
+         # these ABIs:
+         # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
+         # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
+         #   with native Windows (mingw, MSVC).
+         # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
+         # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#if (defined __x86_64__ || defined __amd64__ \
+                     || defined _M_X64 || defined _M_AMD64)
+                 int ok;
+                #else
+                 error fail
+                #endif
+              ]])],
+           [AC_COMPILE_IFELSE(
+              [AC_LANG_SOURCE(
+                 [[#if defined __ILP32__ || defined _ILP32
+                    int ok;
+                   #else
+                    error fail
+                   #endif
+                 ]])],
+              [gl_cv_host_cpu_c_abi=x86_64-x32],
+              [gl_cv_host_cpu_c_abi=x86_64])],
+           [gl_cv_host_cpu_c_abi=i386])
+         ;;
+
+changequote(,)dnl
+       alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
+changequote([,])dnl
+         gl_cv_host_cpu_c_abi=alpha
+         ;;
+
+       arm* | aarch64 )
+         # Assume arm with EABI.
+         # On arm64 systems, the C compiler may be generating code in one of
+         # these ABIs:
+         # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
+         # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
+         # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#ifdef __aarch64__
+                 int ok;
+                #else
+                 error fail
+                #endif
+              ]])],
+           [AC_COMPILE_IFELSE(
+              [AC_LANG_SOURCE(
+                [[#if defined __ILP32__ || defined _ILP32
+                   int ok;
+                  #else
+                   error fail
+                  #endif
+                ]])],
+              [gl_cv_host_cpu_c_abi=arm64-ilp32],
+              [gl_cv_host_cpu_c_abi=arm64])],
+           [# Don't distinguish little-endian and big-endian arm, since they
+            # don't require different machine code for simple operations and
+            # since the user can distinguish them through the preprocessor
+            # defines __ARMEL__ vs. __ARMEB__.
+            # But distinguish arm which passes floating-point arguments and
+            # return values in integer registers (r0, r1, ...) - this is
+            # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which
+            # passes them in float registers (s0, s1, ...) and double registers
+            # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer
+            # sets the preprocessor defines __ARM_PCS (for the first case) and
+            # __ARM_PCS_VFP (for the second case), but older GCC does not.
+            echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c
+            # Look for a reference to the register d0 in the .s file.
+            AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
+            if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then
+              gl_cv_host_cpu_c_abi=armhf
+            else
+              gl_cv_host_cpu_c_abi=arm
+            fi
+            rm -f conftest*
+           ])
+         ;;
+
+       hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
+         # On hppa, the C compiler may be generating 32-bit code or 64-bit
+         # code. In the latter case, it defines _LP64 and __LP64__.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#ifdef __LP64__
+                 int ok;
+                #else
+                 error fail
+                #endif
+              ]])],
+           [gl_cv_host_cpu_c_abi=hppa64],
+           [gl_cv_host_cpu_c_abi=hppa])
+         ;;
+
+       ia64* )
+         # On ia64 on HP-UX, the C compiler may be generating 64-bit code or
+         # 32-bit code. In the latter case, it defines _ILP32.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#ifdef _ILP32
+                 int ok;
+                #else
+                 error fail
+                #endif
+              ]])],
+           [gl_cv_host_cpu_c_abi=ia64-ilp32],
+           [gl_cv_host_cpu_c_abi=ia64])
+         ;;
+
+       mips* )
+         # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
+         # at 32.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
+                 int ok;
+                #else
+                 error fail
+                #endif
+              ]])],
+           [gl_cv_host_cpu_c_abi=mips64],
+           [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but
+            # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32.
+            # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but
+            # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32.
+            AC_COMPILE_IFELSE(
+              [AC_LANG_SOURCE(
+                 [[#if (_MIPS_SIM == _ABIN32)
+                    int ok;
+                   #else
+                    error fail
+                   #endif
+                 ]])],
+              [gl_cv_host_cpu_c_abi=mipsn32],
+              [gl_cv_host_cpu_c_abi=mips])])
+         ;;
+
+       powerpc* )
+         # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
+         # No need to distinguish them here; the caller may distinguish
+         # them based on the OS.
+         # On powerpc64 systems, the C compiler may still be generating
+         # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
+         # be generating 64-bit code.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#if defined __powerpc64__ || defined __LP64__
+                 int ok;
+                #else
+                 error fail
+                #endif
+              ]])],
+           [# On powerpc64, there are two ABIs on Linux: The AIX compatible
+            # one and the ELFv2 one. The latter defines _CALL_ELF=2.
+            AC_COMPILE_IFELSE(
+              [AC_LANG_SOURCE(
+                 [[#if defined _CALL_ELF && _CALL_ELF == 2
+                    int ok;
+                   #else
+                    error fail
+                   #endif
+                 ]])],
+              [gl_cv_host_cpu_c_abi=powerpc64-elfv2],
+              [gl_cv_host_cpu_c_abi=powerpc64])
+           ],
+           [gl_cv_host_cpu_c_abi=powerpc])
+         ;;
+
+       rs6000 )
+         gl_cv_host_cpu_c_abi=powerpc
+         ;;
+
+       riscv32 | riscv64 )
+         # There are 2 architectures (with variants): rv32* and rv64*.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#if __riscv_xlen == 64
+                  int ok;
+                #else
+                  error fail
+                #endif
+              ]])],
+           [cpu=riscv64],
+           [cpu=riscv32])
+         # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
+         # Size of 'long' and 'void *':
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#if defined __LP64__
+                  int ok;
+                #else
+                  error fail
+                #endif
+              ]])],
+           [main_abi=lp64],
+           [main_abi=ilp32])
+         # Float ABIs:
+         # __riscv_float_abi_double:
+         #   'float' and 'double' are passed in floating-point registers.
+         # __riscv_float_abi_single:
+         #   'float' are passed in floating-point registers.
+         # __riscv_float_abi_soft:
+         #   No values are passed in floating-point registers.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#if defined __riscv_float_abi_double
+                  int ok;
+                #else
+                  error fail
+                #endif
+              ]])],
+           [float_abi=d],
+           [AC_COMPILE_IFELSE(
+              [AC_LANG_SOURCE(
+                 [[#if defined __riscv_float_abi_single
+                     int ok;
+                   #else
+                     error fail
+                   #endif
+                 ]])],
+              [float_abi=f],
+              [float_abi=''])
+           ])
+         gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}"
+         ;;
+
+       s390* )
+         # On s390x, the C compiler may be generating 64-bit (= s390x) code
+         # or 31-bit (= s390) code.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#if defined __LP64__ || defined __s390x__
+                  int ok;
+                #else
+                  error fail
+                #endif
+              ]])],
+           [gl_cv_host_cpu_c_abi=s390x],
+           [gl_cv_host_cpu_c_abi=s390])
+         ;;
+
+       sparc | sparc64 )
+         # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
+         # C compiler still generates 32-bit code.
+         AC_COMPILE_IFELSE(
+           [AC_LANG_SOURCE(
+              [[#if defined __sparcv9 || defined __arch64__
+                 int ok;
+                #else
+                 error fail
+                #endif
+              ]])],
+           [gl_cv_host_cpu_c_abi=sparc64],
+           [gl_cv_host_cpu_c_abi=sparc])
+         ;;
+
+       *)
+         gl_cv_host_cpu_c_abi="$host_cpu"
+         ;;
+     esac
+    ])
+
+  dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same.
+  HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'`
+  HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi"
+  AC_SUBST([HOST_CPU])
+  AC_SUBST([HOST_CPU_C_ABI])
+
+  # This was
+  #   AC_DEFINE_UNQUOTED([__${HOST_CPU}__])
+  #   AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__])
+  # earlier, but KAI C++ 3.2d doesn't like this.
+  sed -e 's/-/_/g' >> confdefs.h <<EOF
+#ifndef __${HOST_CPU}__
+#define __${HOST_CPU}__ 1
+#endif
+#ifndef __${HOST_CPU_C_ABI}__
+#define __${HOST_CPU_C_ABI}__ 1
+#endif
+EOF
+  AH_TOP([/* CPU and C ABI indicator */
+#ifndef __i386__
+#undef __i386__
+#endif
+#ifndef __x86_64_x32__
+#undef __x86_64_x32__
+#endif
+#ifndef __x86_64__
+#undef __x86_64__
+#endif
+#ifndef __alpha__
+#undef __alpha__
+#endif
+#ifndef __arm__
+#undef __arm__
+#endif
+#ifndef __armhf__
+#undef __armhf__
+#endif
+#ifndef __arm64_ilp32__
+#undef __arm64_ilp32__
+#endif
+#ifndef __arm64__
+#undef __arm64__
+#endif
+#ifndef __hppa__
+#undef __hppa__
+#endif
+#ifndef __hppa64__
+#undef __hppa64__
+#endif
+#ifndef __ia64_ilp32__
+#undef __ia64_ilp32__
+#endif
+#ifndef __ia64__
+#undef __ia64__
+#endif
+#ifndef __loongarch64__
+#undef __loongarch64__
+#endif
+#ifndef __m68k__
+#undef __m68k__
+#endif
+#ifndef __mips__
+#undef __mips__
+#endif
+#ifndef __mipsn32__
+#undef __mipsn32__
+#endif
+#ifndef __mips64__
+#undef __mips64__
+#endif
+#ifndef __powerpc__
+#undef __powerpc__
+#endif
+#ifndef __powerpc64__
+#undef __powerpc64__
+#endif
+#ifndef __powerpc64_elfv2__
+#undef __powerpc64_elfv2__
+#endif
+#ifndef __riscv32__
+#undef __riscv32__
+#endif
+#ifndef __riscv64__
+#undef __riscv64__
+#endif
+#ifndef __riscv32_ilp32__
+#undef __riscv32_ilp32__
+#endif
+#ifndef __riscv32_ilp32f__
+#undef __riscv32_ilp32f__
+#endif
+#ifndef __riscv32_ilp32d__
+#undef __riscv32_ilp32d__
+#endif
+#ifndef __riscv64_ilp32__
+#undef __riscv64_ilp32__
+#endif
+#ifndef __riscv64_ilp32f__
+#undef __riscv64_ilp32f__
+#endif
+#ifndef __riscv64_ilp32d__
+#undef __riscv64_ilp32d__
+#endif
+#ifndef __riscv64_lp64__
+#undef __riscv64_lp64__
+#endif
+#ifndef __riscv64_lp64f__
+#undef __riscv64_lp64f__
+#endif
+#ifndef __riscv64_lp64d__
+#undef __riscv64_lp64d__
+#endif
+#ifndef __s390__
+#undef __s390__
+#endif
+#ifndef __s390x__
+#undef __s390x__
+#endif
+#ifndef __sh__
+#undef __sh__
+#endif
+#ifndef __sparc__
+#undef __sparc__
+#endif
+#ifndef __sparc64__
+#undef __sparc64__
+#endif
+])
+
+])
+
+
+dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI
+dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit
+dnl one.
+dnl This is a simplified variant of gl_HOST_CPU_C_ABI.
+AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit],
+    [case "$host_cpu" in
+
+       # CPUs that only support a 32-bit ABI.
+       arc \
+       | bfin \
+       | cris* \
+       | csky \
+       | epiphany \
+       | ft32 \
+       | h8300 \
+       | m68k \
+       | microblaze | microblazeel \
+       | nds32 | nds32le | nds32be \
+       | nios2 | nios2eb | nios2el \
+       | or1k* \
+       | or32 \
+       | sh | sh[1234] | sh[1234]e[lb] \
+       | tic6x \
+       | xtensa* )
+         gl_cv_host_cpu_c_abi_32bit=yes
+         ;;
+
+       # CPUs that only support a 64-bit ABI.
+changequote(,)dnl
+       alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
+       | mmix )
+changequote([,])dnl
+         gl_cv_host_cpu_c_abi_32bit=no
+         ;;
+
+       *)
+         if test -n "$gl_cv_host_cpu_c_abi"; then
+           dnl gl_HOST_CPU_C_ABI has already been run. Use its result.
+           case "$gl_cv_host_cpu_c_abi" in
+             i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
+               gl_cv_host_cpu_c_abi_32bit=yes ;;
+             x86_64 | alpha | arm64 | aarch64c | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+               gl_cv_host_cpu_c_abi_32bit=no ;;
+             *)
+               gl_cv_host_cpu_c_abi_32bit=unknown ;;
+           esac
+         else
+           gl_cv_host_cpu_c_abi_32bit=unknown
+         fi
+         if test $gl_cv_host_cpu_c_abi_32bit = unknown; then
+           AC_COMPILE_IFELSE(
+             [AC_LANG_SOURCE(
+                [[int test_pointer_size[sizeof (void *) - 5];
+                ]])],
+             [gl_cv_host_cpu_c_abi_32bit=no],
+             [gl_cv_host_cpu_c_abi_32bit=yes])
+         fi
+         ;;
+     esac
+    ])
+
+  HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit"
+])
deleted file mode 120000 (symlink)
index ed73c0673898ab89568bedc87cde0f70cf99f9d0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/host-os.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..32e3bc10f0934f6297c900dfe72ab6384a40145b
--- /dev/null
@@ -0,0 +1,85 @@
+# serial 13
+
+# Copyright (C) 2001, 2003-2004, 2006, 2009-2024 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.
+
+# Written by Paul Eggert.
+
+dnl From Paul Eggert.
+
+# Define HOST_OPERATING_SYSTEM to a name for the host operating system.
+AC_DEFUN([gl_HOST_OS],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl
+  AC_CACHE_CHECK([host operating system],
+    [gl_cv_host_operating_system],
+
+    [[case $host_os in
+
+       # These operating system names do not use the default heuristic below.
+       # They are in reverse order, so that more-specific prefixes come first.
+       winnt*)          os='Windows NT';;
+       vos*)            os='VOS';;
+       sysv*)           os='Unix System V';;
+       superux*)        os='SUPER-UX';;
+       sunos*)          os='SunOS';;
+       stop*)           os='STOP';;
+       sco*)            os='SCO Unix';;
+       riscos*)         os='RISC OS';;
+       riscix*)         os='RISCiX';;
+       qnx*)            os='QNX';;
+       pw32*)           os='PW32';;
+       ptx*)            os='ptx';;
+       plan9*)          os='Plan 9';;
+       osf*)            os='Tru64';;
+       os2*)            os='OS/2';;
+       openbsd*)        os='OpenBSD';;
+       nsk*)            os='NonStop Kernel';;
+       nonstopux*)      os='NonStop-UX';;
+       netbsd*-gnu*)    os='GNU/NetBSD';; # NetBSD kernel+libc, GNU userland
+       netbsd*)         os='NetBSD';;
+       mirbsd*)         os='MirBSD';;
+       midnightbsd*)    os='MidnightBSD';;
+       knetbsd*-gnu)    os='GNU/kNetBSD';; # NetBSD kernel, GNU libc+userland
+       kfreebsd*-gnu)   os='GNU/kFreeBSD';; # FreeBSD kernel, GNU libc+userland
+       msdosdjgpp*)     os='DJGPP';;
+       mpeix*)          os='MPE/iX';;
+       mint*)           os='MiNT';;
+       mingw* | windows*) os='MinGW';;
+       lynxos*)         os='LynxOS';;
+       linux*)          os='GNU/Linux';;
+       hpux*)           os='HP-UX';;
+       hiux*)           os='HI-UX';;
+       gnu*)            os='GNU';;
+       freebsd*)        os='FreeBSD';;
+       dgux*)           os='DG/UX';;
+       dragonfly*)      os='DragonFly BSD';;
+       bsdi*)           os='BSD/OS';;
+       bsd*)            os='BSD';;
+       beos*)           os='BeOS';;
+       aux*)            os='A/UX';;
+       atheos*)         os='AtheOS';;
+       amigaos*)        os='Amiga OS';;
+       aix*)            os='AIX';;
+
+       # The default heuristic takes the initial alphabetic string
+       # from $host_os, but capitalizes its first letter.
+       [A-Za-z]*)
+         os=`
+           expr "X$host_os" : 'X\([A-Za-z]\)' | LC_ALL=C tr '[a-z]' '[A-Z]'
+         ``
+           expr "X$host_os" : 'X.\([A-Za-z]*\)'
+         `
+         ;;
+
+       # If $host_os does not start with an alphabetic string, use it unchanged.
+       *)
+         os=$host_os;;
+     esac
+     gl_cv_host_operating_system=$os]])
+  AC_DEFINE_UNQUOTED([HOST_OPERATING_SYSTEM],
+    "$gl_cv_host_operating_system",
+    [The host operating system.])
+])
deleted file mode 120000 (symlink)
index 2ca4b4d227ba66cd9eb368b2ce66ffec30a66621..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/hostent.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..48228ad7fe13134b037dbeeb510ca00ec57669b3
--- /dev/null
@@ -0,0 +1,49 @@
+# hostent.m4 serial 4
+dnl Copyright (C) 2008, 2010-2024 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_HOSTENT],
+[
+  dnl Where are gethostent(), sethostent(), endhostent(), gethostbyname(),
+  dnl gethostbyaddr() defined?
+  dnl - On Solaris < 11.4, they are in libnsl. Ignore libxnet.
+  dnl - On Haiku, they are in libnetwork.
+  dnl - On BeOS, they are in libnet.
+  dnl - On native Windows, they are in ws2_32.dll.
+  dnl - Otherwise they are in libc.
+  AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+  HOSTENT_LIB=
+  gl_saved_libs="$LIBS"
+  AC_SEARCH_LIBS([gethostbyname], [nsl network net],
+    [if test "$ac_cv_search_gethostbyname" != "none required"; then
+       HOSTENT_LIB="$ac_cv_search_gethostbyname"
+     fi])
+  LIBS="$gl_saved_libs"
+  if test -z "$HOSTENT_LIB"; then
+    AC_CHECK_FUNCS([gethostbyname], , [
+      AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32],
+        [gl_cv_w32_gethostbyname],
+        [gl_cv_w32_gethostbyname=no
+         gl_save_LIBS="$LIBS"
+         LIBS="$LIBS -lws2_32"
+         AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#include <stddef.h>
+              ]],
+              [[gethostbyname(NULL);]])],
+           [gl_cv_w32_gethostbyname=yes])
+         LIBS="$gl_save_LIBS"
+        ])
+      if test "$gl_cv_w32_gethostbyname" = "yes"; then
+        HOSTENT_LIB="-lws2_32"
+      fi
+    ])
+  fi
+  AC_SUBST([HOSTENT_LIB])
+])
deleted file mode 120000 (symlink)
index 480aff5e612f8108e43ce8cbc0f45f72ea3f6bd7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/human.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b9ca6ba74b32f8e54a0a765f98ef8dc2039b3e16
--- /dev/null
@@ -0,0 +1,11 @@
+#serial 11
+dnl Copyright (C) 2002-2006, 2009-2024 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 Prerequisites of lib/human.c.
+AC_DEFUN([gl_HUMAN],
+[
+  :
+])
deleted file mode 120000 (symlink)
index bedb0728b342b4b553d0a046aa98f6079d368c34..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/i-ring.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4ec03338d7e1a238473b38105a08320260efa46c
--- /dev/null
@@ -0,0 +1,10 @@
+# serial 2
+dnl Copyright (C) 2006, 2009-2024 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_I_RING],
+[
+  :
+])
deleted file mode 120000 (symlink)
index c26db885d0fb10bfb40128ecbcfc0ecf8a4abb09..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/iconv.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aa3de6ca3565803a0a05a240e4b4f5f04cc40b90
--- /dev/null
@@ -0,0 +1,293 @@
+# iconv.m4 serial 26
+dnl Copyright (C) 2000-2002, 2007-2014, 2016-2024 Free Software Foundation,
+dnl 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 Bruno Haible.
+
+AC_PREREQ([2.64])
+
+dnl Note: AM_ICONV is documented in the GNU gettext manual
+dnl <https://www.gnu.org/software/gettext/manual/html_node/AM_005fICONV.html>.
+dnl Don't make changes that are incompatible with that documentation!
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+  dnl those with the standalone portable GNU libiconv installed).
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed libiconv and not disabled its use
+  dnl via --without-libiconv-prefix, he wants to use it. The first
+  dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
+  am_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[
+#include <stdlib.h>
+#include <iconv.h>
+         ]],
+         [[iconv_t cd = iconv_open("","");
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);]])],
+      [am_cv_func_iconv=yes])
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[
+#include <stdlib.h>
+#include <iconv.h>
+           ]],
+           [[iconv_t cd = iconv_open("","");
+             iconv(cd,NULL,NULL,NULL,NULL);
+             iconv_close(cd);]])],
+        [am_cv_lib_iconv=yes]
+        [am_cv_func_iconv=yes])
+      LIBS="$am_save_LIBS"
+    fi
+  ])
+  if test "$am_cv_func_iconv" = yes; then
+    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
+      dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
+      dnl Solaris 10.
+      am_save_LIBS="$LIBS"
+      if test $am_cv_lib_iconv = yes; then
+        LIBS="$LIBS $LIBICONV"
+      fi
+      am_cv_func_iconv_works=no
+      for ac_iconv_const in '' 'const'; do
+        AC_RUN_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[
+#include <iconv.h>
+#include <string.h>
+
+#ifndef ICONV_CONST
+# define ICONV_CONST $ac_iconv_const
+#endif
+             ]],
+             [[int result = 0;
+  /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from
+     successful returns.  This is even documented in
+     <https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */
+  {
+    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+    if (cd_utf8_to_88591 != (iconv_t)(-1))
+      {
+        static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
+        char buf[10];
+        ICONV_CONST char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_utf8_to_88591,
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 1;
+        iconv_close (cd_utf8_to_88591);
+      }
+  }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static ICONV_CONST char input[] = "\263";
+        char buf[10];
+        ICONV_CONST char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 2;
+        iconv_close (cd_ascii_to_88591);
+      }
+  }
+  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static ICONV_CONST char input[] = "\304";
+        static char buf[2] = { (char)0xDE, (char)0xAD };
+        ICONV_CONST char *inptr = input;
+        size_t inbytesleft = 1;
+        char *outptr = buf;
+        size_t outbytesleft = 1;
+        size_t res = iconv (cd_88591_to_utf8,
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+          result |= 4;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#if 0 /* This bug could be worked around by the caller.  */
+  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+        char buf[50];
+        ICONV_CONST char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_88591_to_utf8,
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if ((int)res > 0)
+          result |= 8;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#endif
+  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+     provided.  */
+  {
+    /* Try standardized names.  */
+    iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP");
+    /* Try IRIX, OSF/1 names.  */
+    iconv_t cd2 = iconv_open ("UTF-8", "eucJP");
+    /* Try AIX names.  */
+    iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP");
+    /* Try HP-UX names.  */
+    iconv_t cd4 = iconv_open ("utf8", "eucJP");
+    if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1)
+        && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1))
+      result |= 16;
+    if (cd1 != (iconv_t)(-1))
+      iconv_close (cd1);
+    if (cd2 != (iconv_t)(-1))
+      iconv_close (cd2);
+    if (cd3 != (iconv_t)(-1))
+      iconv_close (cd3);
+    if (cd4 != (iconv_t)(-1))
+      iconv_close (cd4);
+  }
+  return result;
+]])],
+          [am_cv_func_iconv_works=yes], ,
+          [case "$host_os" in
+             aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+             *)            am_cv_func_iconv_works="guessing yes" ;;
+           esac])
+        test "$am_cv_func_iconv_works" = no || break
+      done
+      LIBS="$am_save_LIBS"
+    ])
+    case "$am_cv_func_iconv_works" in
+      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+      *)   am_func_iconv=yes ;;
+    esac
+  else
+    am_func_iconv=no am_cv_lib_iconv=no
+  fi
+  if test "$am_func_iconv" = yes; then
+    AC_DEFINE([HAVE_ICONV], [1],
+      [Define if you have the iconv() function and it works.])
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    AC_MSG_CHECKING([how to link with libiconv])
+    AC_MSG_RESULT([$LIBICONV])
+  else
+    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+    dnl either.
+    CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+  AC_SUBST([LIBICONV])
+  AC_SUBST([LTLIBICONV])
+])
+
+dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like
+dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
+AC_DEFUN_ONCE([AM_ICONV],
+[
+  AM_ICONV_LINK
+  if test "$am_cv_func_iconv" = yes; then
+    AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature],
+      [gl_cv_iconv_nonconst],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+            ]],
+            [[]])],
+         [gl_cv_iconv_nonconst=yes],
+         [gl_cv_iconv_nonconst=no])
+      ])
+  else
+    dnl When compiling GNU libiconv on a system that does not have iconv yet,
+    dnl pick the POSIX compliant declaration without 'const'.
+    gl_cv_iconv_nonconst=yes
+  fi
+  if test $gl_cv_iconv_nonconst = yes; then
+    iconv_arg1=""
+  else
+    iconv_arg1="const"
+  fi
+  AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1],
+    [Define as const if the declaration of iconv() needs const.])
+  dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
+  m4_ifdef([gl_ICONV_H_DEFAULTS],
+    [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+     if test $gl_cv_iconv_nonconst != yes; then
+       ICONV_CONST="const"
+     fi
+    ])
+
+  dnl A summary result, for those packages which want to print a summary at the
+  dnl end of the configuration.
+  if test "$am_func_iconv" = yes; then
+    if test -n "$LIBICONV"; then
+      am_cv_func_iconv_summary='yes, in libiconv'
+    else
+      am_cv_func_iconv_summary='yes, in libc'
+    fi
+  else
+    if test "$am_cv_func_iconv" = yes; then
+      am_cv_func_iconv_summary='not working, consider installing GNU libiconv'
+    else
+      am_cv_func_iconv_summary='no, consider installing GNU libiconv'
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index 74bff4bea770bbb0f42657c80c0d904495c100d7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/iconv_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7b560887553d59e34e72f255c6521a88020f4573
--- /dev/null
@@ -0,0 +1,70 @@
+# iconv_h.m4 serial 16
+dnl Copyright (C) 2007-2024 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_ONCE([gl_ICONV_H],
+[
+  AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+
+  dnl Execute this unconditionally, because GL_GENERATE_ICONV_H may be set to
+  dnl true by other modules, after this code is executed.
+  gl_CHECK_NEXT_HEADERS([iconv.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <iconv.h>
+    ]], [iconv iconv_open])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+])
+
+dnl Unconditionally enables the replacement of <iconv.h>.
+AC_DEFUN([gl_REPLACE_ICONV_H],
+[
+  gl_ICONV_H_REQUIRE_DEFAULTS
+  GL_GENERATE_ICONV_H=true
+])
+
+# gl_ICONV_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_ICONV_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_ICONV_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_ICONV_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ICONV])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_ICONV_H_DEFAULTS],
+[
+  m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  ICONV_CONST=;         AC_SUBST([ICONV_CONST])
+  REPLACE_ICONV=0;      AC_SUBST([REPLACE_ICONV])
+  REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN])
+  REPLACE_ICONV_UTF=0;  AC_SUBST([REPLACE_ICONV_UTF])
+  GL_GENERATE_ICONV_H=false
+  m4_ifdef([gl_POSIXCHECK],
+    [GL_GENERATE_ICONV_H=true],
+    [if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
+       dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE.
+       GL_GENERATE_ICONV_H=true
+     fi
+    ])
+])
deleted file mode 120000 (symlink)
index 6159ac4b089936b2be236100e4925db471728f7c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/iconv_open.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c6fe346bd4f1f001b973678d246971b47c698153
--- /dev/null
@@ -0,0 +1,61 @@
+# iconv_open.m4 serial 17
+dnl Copyright (C) 2007-2024 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_ICONV_OPEN],
+[
+  AC_REQUIRE([AM_ICONV])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+  if test "$am_cv_func_iconv" = yes; then
+    dnl Provide the <iconv.h> override, for the sake of the C++ aliases.
+    gl_REPLACE_ICONV_H
+    dnl Test whether iconv_open accepts standardized encoding names.
+    dnl We know that GNU libiconv and GNU libc do.
+    AC_EGREP_CPP([gnu_iconv], [
+      #include <iconv.h>
+      #if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) \
+          || (defined __GLIBC__ && !defined __UCLIBC__)
+       gnu_iconv
+      #endif
+      ], [gl_func_iconv_gnu=yes], [gl_func_iconv_gnu=no])
+    if test $gl_func_iconv_gnu = no; then
+      iconv_flavor=
+      case "$host_os" in
+        aix*)         iconv_flavor=ICONV_FLAVOR_AIX ;;
+        irix*)        iconv_flavor=ICONV_FLAVOR_IRIX ;;
+        hpux*)        iconv_flavor=ICONV_FLAVOR_HPUX ;;
+        osf*)         iconv_flavor=ICONV_FLAVOR_OSF ;;
+        solaris*)     iconv_flavor=ICONV_FLAVOR_SOLARIS ;;
+        openedition*) iconv_flavor=ICONV_FLAVOR_ZOS ;;
+      esac
+      if test -n "$iconv_flavor"; then
+        AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor],
+          [Define to a symbolic name denoting the flavor of iconv_open()
+           implementation.])
+        gl_REPLACE_ICONV_OPEN
+      fi
+    fi
+    m4_ifdef([gl_FUNC_ICONV_OPEN_UTF_SUPPORT], [
+      gl_FUNC_ICONV_OPEN_UTF_SUPPORT
+      case "$gl_cv_func_iconv_supports_utf" in
+        *yes) ;;
+        *)
+          REPLACE_ICONV_UTF=1
+          AC_DEFINE([REPLACE_ICONV_UTF], [1],
+            [Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.])
+          REPLACE_ICONV=1
+          gl_REPLACE_ICONV_OPEN
+          ;;
+      esac
+    ])
+  fi
+])
+
+AC_DEFUN([gl_REPLACE_ICONV_OPEN],
+[
+  gl_REPLACE_ICONV_H
+  REPLACE_ICONV_OPEN=1
+])
deleted file mode 120000 (symlink)
index 8c53815f7b3135f7188bb9536959d7b86c2e3af4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/idcache.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0989a1116fda8b0ffa5a789f7780ddf2a82d2b0c
--- /dev/null
@@ -0,0 +1,11 @@
+# idcache.m4 serial 7
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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_IDCACHE],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 857ce3702863d736cf1d898026371fc7078fab0b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/include_next.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8a1c52c8564b2525fe0404ba210c5bf15074e95e
--- /dev/null
@@ -0,0 +1,224 @@
+# include_next.m4 serial 26
+dnl Copyright (C) 2006-2024 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 and Derek Price.
+
+dnl Sets INCLUDE_NEXT, INCLUDE_NEXT_AS_FIRST_DIRECTIVE, PRAGMA_SYSTEM_HEADER,
+dnl and PRAGMA_COLUMNS.
+dnl
+dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
+dnl 'include' otherwise.
+dnl
+dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler
+dnl supports it in the special case that it is the first include directive in
+dnl the given file, or to 'include' otherwise.
+dnl
+dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
+dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
+dnl '#pragma GCC system_header' has the same effect as if the file was found
+dnl through the include search path specified with '-isystem' options (as
+dnl opposed to the search path specified with '-I' options). Namely, gcc
+dnl does not warn about some things, and on some systems (Solaris and Interix)
+dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
+dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
+dnl of plain '__STDC__'.
+dnl
+dnl PRAGMA_COLUMNS can be used in files that override system header files, so
+dnl as to avoid compilation errors on HP NonStop systems when the gnulib file
+dnl is included by a system header file that does a "#pragma COLUMNS 80" (which
+dnl has the effect of truncating the lines of that file and all files that it
+dnl includes to 80 columns) and the gnulib file has lines longer than 80
+dnl columns.
+
+AC_DEFUN([gl_INCLUDE_NEXT],
+[
+  AC_LANG_PREPROC_REQUIRE()
+  AC_CACHE_CHECK([whether the preprocessor supports include_next],
+    [gl_cv_have_include_next],
+    [rm -rf conftestd1a conftestd1b conftestd2
+     mkdir conftestd1a conftestd1b conftestd2
+     dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on
+     dnl AIX 6.1 support include_next when used as first preprocessor directive
+     dnl in a file, but not when preceded by another include directive. Check
+     dnl for this bug by including <stdio.h>.
+     dnl Additionally, with this same compiler, include_next is a no-op when
+     dnl used in a header file that was included by specifying its absolute
+     dnl file name. Despite these two bugs, include_next is used in the
+     dnl compiler's <math.h>. By virtue of the second bug, we need to use
+     dnl include_next as well in this case.
+     cat <<EOF > conftestd1a/conftest.h
+#define DEFINED_IN_CONFTESTD1
+#include_next <conftest.h>
+#ifdef DEFINED_IN_CONFTESTD2
+int foo;
+#else
+#error "include_next doesn't work"
+#endif
+EOF
+     cat <<EOF > conftestd1b/conftest.h
+#define DEFINED_IN_CONFTESTD1
+#include <stdio.h>
+#include_next <conftest.h>
+#ifdef DEFINED_IN_CONFTESTD2
+int foo;
+#else
+#error "include_next doesn't work"
+#endif
+EOF
+     cat <<EOF > conftestd2/conftest.h
+#ifndef DEFINED_IN_CONFTESTD1
+#error "include_next test doesn't work"
+#endif
+#define DEFINED_IN_CONFTESTD2
+EOF
+     gl_save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
+dnl We intentionally avoid using AC_LANG_SOURCE here.
+     AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
+       [gl_cv_have_include_next=yes],
+       [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
+        AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
+          [gl_cv_have_include_next=buggy],
+          [gl_cv_have_include_next=no])
+       ])
+     CPPFLAGS="$gl_save_CPPFLAGS"
+     rm -rf conftestd1a conftestd1b conftestd2
+    ])
+  PRAGMA_SYSTEM_HEADER=
+  if test $gl_cv_have_include_next = yes; then
+    INCLUDE_NEXT=include_next
+    INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+    if test -n "$GCC"; then
+      PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
+    fi
+  else
+    if test $gl_cv_have_include_next = buggy; then
+      INCLUDE_NEXT=include
+      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+    else
+      INCLUDE_NEXT=include
+      INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
+    fi
+  fi
+  AC_SUBST([INCLUDE_NEXT])
+  AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
+  AC_SUBST([PRAGMA_SYSTEM_HEADER])
+
+  dnl HP NonStop systems, which define __TANDEM, limit the line length
+  dnl after including some system header files.
+  AC_CACHE_CHECK([whether source code line length is unlimited],
+    [gl_cv_source_line_length_unlimited],
+    [AC_EGREP_CPP([choke me],
+       [
+#ifdef __TANDEM
+choke me
+#endif
+       ],
+       [gl_cv_source_line_length_unlimited=no],
+       [gl_cv_source_line_length_unlimited=yes])
+    ])
+  if test $gl_cv_source_line_length_unlimited = no; then
+    PRAGMA_COLUMNS="#pragma COLUMNS 10000"
+  else
+    PRAGMA_COLUMNS=
+  fi
+  AC_SUBST([PRAGMA_COLUMNS])
+])
+
+# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
+# ------------------------------------------
+# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
+# '<foo.h>'; otherwise define it to be
+# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
+# Also, if #include_next works as first preprocessing directive in a file,
+# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
+# be
+# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
+# That way, a header file with the following line:
+#       #@INCLUDE_NEXT@ @NEXT_FOO_H@
+# or
+#       #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
+# behaves (after sed substitution) as if it contained
+#       #include_next <foo.h>
+# even if the compiler does not support include_next.
+# The three "///" are to pacify Sun C 5.8, which otherwise would say
+# "warning: #include of /usr/include/... may be non-portable".
+# Use '""', not '<>', so that the /// cannot be confused with a C99 comment.
+# Note: This macro assumes that the header file is not empty after
+# preprocessing, i.e. it does not only define preprocessor macros but also
+# provides some type/enum definitions or function/variable declarations.
+#
+# This macro also checks whether each header exists, by invoking
+# AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument.
+AC_DEFUN([gl_CHECK_NEXT_HEADERS],
+[
+  gl_NEXT_HEADERS_INTERNAL([$1], [check])
+])
+
+# gl_NEXT_HEADERS(HEADER1 HEADER2 ...)
+# ------------------------------------
+# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist.
+# This is suitable for headers like <stddef.h> that are standardized by C89
+# and therefore can be assumed to exist.
+AC_DEFUN([gl_NEXT_HEADERS],
+[
+  gl_NEXT_HEADERS_INTERNAL([$1], [assume])
+])
+
+# The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS.
+AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
+[
+  AC_REQUIRE([gl_INCLUDE_NEXT])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  m4_if([$2], [check],
+    [AC_CHECK_HEADERS_ONCE([$1])
+    ])
+
+  m4_foreach_w([gl_HEADER_NAME], [$1],
+    [AS_VAR_PUSHDEF([gl_next_header],
+                    [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
+     if test $gl_cv_have_include_next = yes; then
+       AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
+     else
+       AC_CACHE_CHECK(
+         [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
+         [gl_next_header],
+         [m4_if([$2], [check],
+            [AS_VAR_PUSHDEF([gl_header_exists],
+                            [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
+             if test AS_VAR_GET([gl_header_exists]) = yes; then
+             AS_VAR_POPDEF([gl_header_exists])
+            ])
+          gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME)
+          AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME))
+          AS_VAR_SET([gl_next_header], ['"'$gl_header'"'])
+          m4_if([$2], [check],
+            [else
+               AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
+             fi
+            ])
+         ])
+     fi
+     AC_SUBST(
+       AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
+       [AS_VAR_GET([gl_next_header])])
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'gl_HEADER_NAME'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
+     fi
+     AC_SUBST(
+       AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
+       [$gl_next_as_first_directive])
+     AS_VAR_POPDEF([gl_next_header])])
+])
+
+# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE;
+# this fallback is safe for all earlier autoconf versions.
+m4_define_default([AC_LANG_DEFINES_PROVIDED])
deleted file mode 120000 (symlink)
index 74c7543c8d0a6c549ba145ea2b912636feb2c066..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/inet_ntop.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bb12bb82cc8461c7392bc69fbb9e81b045438d2f
--- /dev/null
@@ -0,0 +1,70 @@
+# inet_ntop.m4 serial 21
+dnl Copyright (C) 2005-2006, 2008-2024 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_INET_NTOP],
+[
+  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+
+  dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  dnl Most platforms that provide inet_ntop define it in libc.
+  dnl Solaris 8..10 provide inet_ntop in libnsl instead.
+  dnl Solaris 2.6..7 provide inet_ntop in libresolv instead.
+  dnl Haiku provides it in -lnetwork.
+  dnl Native Windows provides it in -lws2_32 instead, with a declaration in
+  dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
+  dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
+  HAVE_INET_NTOP=1
+  INET_NTOP_LIB=
+  gl_PREREQ_SYS_H_WINSOCK2
+  if test $HAVE_WINSOCK2_H = 1; then
+    dnl It needs to be overridden, because the stdcall calling convention
+    dnl is not compliant with POSIX.  Set REPLACE_INET_NTOP in order to avoid
+    dnl a name conflict at the linker level, even though the header file
+    dnl <ws2tcpip.h> declares inet_ntop only if _WIN32_WINNT >= 0x0600.
+    REPLACE_INET_NTOP=1
+    AC_CHECK_DECLS([inet_ntop],,, [[#include <ws2tcpip.h>]])
+    if test $ac_cv_have_decl_inet_ntop = yes; then
+      INET_NTOP_LIB="-lws2_32"
+    else
+      HAVE_DECL_INET_NTOP=0
+    fi
+  else
+    gl_save_LIBS=$LIBS
+    AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [],
+      [AC_CHECK_FUNCS([inet_ntop])
+       if test $ac_cv_func_inet_ntop = no; then
+         HAVE_INET_NTOP=0
+       fi
+      ])
+    LIBS=$gl_save_LIBS
+
+    if test "$ac_cv_search_inet_ntop" != "no" \
+       && test "$ac_cv_search_inet_ntop" != "none required"; then
+      INET_NTOP_LIB="$ac_cv_search_inet_ntop"
+    fi
+
+    AC_CHECK_HEADERS_ONCE([netdb.h])
+    AC_CHECK_DECLS([inet_ntop],,,
+      [[#include <arpa/inet.h>
+        #if HAVE_NETDB_H
+        # include <netdb.h>
+        #endif
+      ]])
+    if test $ac_cv_have_decl_inet_ntop = no; then
+      HAVE_DECL_INET_NTOP=0
+    fi
+  fi
+  AC_SUBST([INET_NTOP_LIB])
+])
+
+# Prerequisites of lib/inet_ntop.c.
+AC_DEFUN([gl_PREREQ_INET_NTOP], [
+  AC_REQUIRE([gl_SOCKET_FAMILIES])
+])
deleted file mode 120000 (symlink)
index 6832d254dfc72e6d98a61f721d8c002ba0517ec8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/inet_pton.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2035feac7ef3741ad7d9a1e0e6a42d7e60f49d42
--- /dev/null
@@ -0,0 +1,70 @@
+# inet_pton.m4 serial 19
+dnl Copyright (C) 2006, 2008-2024 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_INET_PTON],
+[
+  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+
+  dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  dnl Most platforms that provide inet_pton define it in libc.
+  dnl Solaris 8..10 provide inet_pton in libnsl instead.
+  dnl Solaris 2.6..7 provide inet_pton in libresolv instead.
+  dnl Haiku provides it in -lnetwork.
+  dnl Native Windows provides it in -lws2_32 instead, with a declaration in
+  dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
+  dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
+  HAVE_INET_PTON=1
+  INET_PTON_LIB=
+  gl_PREREQ_SYS_H_WINSOCK2
+  if test $HAVE_WINSOCK2_H = 1; then
+    dnl It needs to be overridden, because the stdcall calling convention
+    dnl is not compliant with POSIX.  Set REPLACE_INET_PTON in order to avoid
+    dnl a name conflict at the linker level, even though the header file
+    dnl <ws2tcpip.h> declares inet_pton only if _WIN32_WINNT >= 0x0600.
+    REPLACE_INET_PTON=1
+    AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]])
+    if test $ac_cv_have_decl_inet_pton = yes; then
+      INET_PTON_LIB="-lws2_32"
+    else
+      HAVE_DECL_INET_PTON=0
+    fi
+  else
+    gl_save_LIBS=$LIBS
+    AC_SEARCH_LIBS([inet_pton], [nsl resolv network], [],
+      [AC_CHECK_FUNCS([inet_pton])
+       if test $ac_cv_func_inet_pton = no; then
+         HAVE_INET_PTON=0
+       fi
+      ])
+    LIBS=$gl_save_LIBS
+
+    if test "$ac_cv_search_inet_pton" != "no" \
+       && test "$ac_cv_search_inet_pton" != "none required"; then
+      INET_PTON_LIB="$ac_cv_search_inet_pton"
+    fi
+
+    AC_CHECK_HEADERS_ONCE([netdb.h])
+    AC_CHECK_DECLS([inet_pton],,,
+      [[#include <arpa/inet.h>
+        #if HAVE_NETDB_H
+        # include <netdb.h>
+        #endif
+      ]])
+    if test $ac_cv_have_decl_inet_pton = no; then
+      HAVE_DECL_INET_PTON=0
+    fi
+  fi
+  AC_SUBST([INET_PTON_LIB])
+])
+
+# Prerequisites of lib/inet_pton.c.
+AC_DEFUN([gl_PREREQ_INET_PTON], [
+  AC_REQUIRE([gl_SOCKET_FAMILIES])
+])
deleted file mode 120000 (symlink)
index 318970c14946a44c7607a86f20a7173ef8289c95..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/inline.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..208f7423cbd64d4be1000fceb30943af0d197754
--- /dev/null
@@ -0,0 +1,40 @@
+# inline.m4 serial 4
+dnl Copyright (C) 2006, 2009-2024 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 Test for the 'inline' keyword or equivalent.
+dnl Define 'inline' to a supported equivalent, or to nothing if not supported,
+dnl like AC_C_INLINE does.  Also, define HAVE_INLINE if 'inline' or an
+dnl equivalent is effectively supported, i.e. if the compiler is likely to
+dnl drop unused 'static inline' functions.
+AC_DEFUN([gl_INLINE],
+[
+  AC_REQUIRE([AC_C_INLINE])
+  AC_CACHE_CHECK([whether the compiler generally respects inline],
+    [gl_cv_c_inline_effective],
+    [if test $ac_cv_c_inline = no; then
+       gl_cv_c_inline_effective=no
+     else
+       dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
+       dnl specified.
+       dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result
+       dnl depends on optimization flags, which can be in CFLAGS.
+       dnl (AC_EGREP_CPP looks only at the CPPFLAGS.)
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[]],
+           [[#ifdef __NO_INLINE__
+               #error "inline is not effective"
+             #endif]])],
+         [gl_cv_c_inline_effective=yes],
+         [gl_cv_c_inline_effective=no])
+     fi
+    ])
+  if test $gl_cv_c_inline_effective = yes; then
+    AC_DEFINE([HAVE_INLINE], [1],
+      [Define to 1 if the compiler supports one of the keywords
+       'inline', '__inline__', '__inline' and effectively inlines
+       functions marked as such.])
+  fi
+])
deleted file mode 120000 (symlink)
index b5eed6126c111729180823b7f499f3da9a202589..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/intl-thread-locale.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..74a2654b651a895a6f1b99965dc3243655c81484
--- /dev/null
@@ -0,0 +1,219 @@
+# intl-thread-locale.m4 serial 10
+dnl Copyright (C) 2015-2024 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
+dnl This file can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Lesser General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Lesser General Public License, and the rest of the GNU
+dnl gettext package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Check how to retrieve the name of a per-thread locale (POSIX locale_t).
+dnl Sets gt_nameless_locales.
+AC_DEFUN([gt_INTL_THREAD_LOCALE_NAME],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl Persuade Solaris <locale.h> to define 'locale_t'.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl Test whether uselocale() exists and works at all.
+  gt_FUNC_USELOCALE
+
+  dnl On OpenBSD >= 6.2, the locale_t type and the uselocale(), newlocale(),
+  dnl duplocale(), freelocale() functions exist but are effectively useless,
+  dnl because the locale_t value depends only on the LC_CTYPE category of the
+  dnl locale and furthermore contains only one bit of information (it
+  dnl distinguishes the "C" locale from the *.UTF-8 locales). See
+  dnl <https://cvsweb.openbsd.org/src/lib/libc/locale/newlocale.c?rev=1.1&content-type=text/x-cvsweb-markup>.
+  dnl In the setlocale() implementation they have thought about the programs
+  dnl that use the API ("Even though only LC_CTYPE has any effect in the
+  dnl OpenBSD base system, store complete information about the global locale,
+  dnl such that third-party software can access it"), but for uselocale()
+  dnl they did not think about the programs.
+  dnl In this situation, even the HAVE_NAMELESS_LOCALES support does not work.
+  dnl So, define HAVE_FAKE_LOCALES and disable all locale_t support.
+  case "$gt_cv_func_uselocale_works" in
+    *yes)
+      AC_CHECK_HEADERS_ONCE([xlocale.h])
+      AC_CACHE_CHECK([for fake locale system (OpenBSD)],
+        [gt_cv_locale_fake],
+        [AC_RUN_IFELSE(
+           [AC_LANG_SOURCE([[
+#include <locale.h>
+#if HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
+int main ()
+{
+  locale_t loc1, loc2;
+  if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) return 1;
+  if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL) return 1;
+  loc1 = newlocale (LC_ALL_MASK, "de_DE.UTF-8", (locale_t)0);
+  loc2 = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", (locale_t)0);
+  return !(loc1 == loc2);
+}]])],
+           [gt_cv_locale_fake=yes],
+           [gt_cv_locale_fake=no],
+           [dnl Guess the locale system is fake only on OpenBSD.
+            case "$host_os" in
+              openbsd*) gt_cv_locale_fake="guessing yes" ;;
+              *)        gt_cv_locale_fake="guessing no" ;;
+            esac
+           ])
+        ])
+      ;;
+    *) gt_cv_locale_fake=no ;;
+  esac
+  case "$gt_cv_locale_fake" in
+    *yes)
+      gt_fake_locales=yes
+      AC_DEFINE([HAVE_FAKE_LOCALES], [1],
+        [Define if the locale_t type contains insufficient information, as on OpenBSD.])
+      ;;
+    *)
+      gt_fake_locales=no
+      ;;
+  esac
+
+  case "$gt_cv_func_uselocale_works" in
+    *yes)
+      AC_CACHE_CHECK([for Solaris 11.4 locale system],
+        [gt_cv_locale_solaris114],
+        [case "$host_os" in
+           solaris*)
+             dnl Test whether <locale.h> defines locale_t as a typedef of
+             dnl 'struct _LC_locale_t **' (whereas Illumos defines it as a
+             dnl typedef of 'struct _locale *').
+             dnl Another possible test would be to include <sys/localedef.h>
+             dnl and test whether it defines the _LC_core_data_locale_t type.
+             dnl This type was added in Solaris 11.4.
+             AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM([[
+                  #include <locale.h>
+                  struct _LC_locale_t *x;
+                  locale_t y;
+                ]],
+                [[*y = x;]])],
+               [gt_cv_locale_solaris114=yes],
+               [gt_cv_locale_solaris114=no])
+             ;;
+           *) gt_cv_locale_solaris114=no ;;
+         esac
+        ])
+      ;;
+    *) gt_cv_locale_solaris114=no ;;
+  esac
+  if test $gt_cv_locale_solaris114 = yes; then
+    AC_DEFINE([HAVE_SOLARIS114_LOCALES], [1],
+      [Define if the locale_t type is as on Solaris 11.4.])
+  fi
+
+  dnl Solaris 12 will maybe provide getlocalename_l.  If it does, it will
+  dnl improve the implementation of gl_locale_name_thread(), by removing
+  dnl the use of undocumented structures.
+  case "$gt_cv_func_uselocale_works" in
+    *yes)
+      AC_CHECK_FUNCS([getlocalename_l])
+      ;;
+  esac
+
+  dnl This code is for platforms where the locale_t type does not provide access
+  dnl to the name of each locale category.  This code has the drawback that it
+  dnl requires the gnulib overrides of 'newlocale', 'duplocale', 'freelocale',
+  dnl which is a problem for GNU libunistring.  Therefore try hard to avoid
+  dnl enabling this code!
+  gt_nameless_locales=no
+  case "$host_os" in
+    dnl It's needed on AIX 7.2.
+    aix*)
+      gt_nameless_locales=yes
+      AC_DEFINE([HAVE_NAMELESS_LOCALES], [1],
+        [Define if the locale_t type does not contain the name of each locale category.])
+      ;;
+  esac
+
+  dnl We cannot support uselocale() on platforms where the locale_t type is
+  dnl fake.  So, set
+  dnl   gt_good_uselocale = gt_working_uselocale && !gt_fake_locales.
+  if test $gt_working_uselocale = yes && test $gt_fake_locales = no; then
+    gt_good_uselocale=yes
+    AC_DEFINE([HAVE_GOOD_USELOCALE], [1],
+      [Define if the uselocale exists, may be safely called, and returns sufficient information.])
+  else
+    gt_good_uselocale=no
+  fi
+
+  dnl Set gt_localename_enhances_locale_funcs to indicate whether localename.c
+  dnl overrides newlocale(), duplocale(), freelocale() to keep track of locale
+  dnl names.
+  if test $gt_good_uselocale = yes && test $gt_nameless_locales = yes; then
+    gt_localename_enhances_locale_funcs=yes
+    LOCALENAME_ENHANCE_LOCALE_FUNCS=1
+    AC_DEFINE([LOCALENAME_ENHANCE_LOCALE_FUNCS], [1],
+      [Define if localename.c overrides newlocale(), duplocale(), freelocale().])
+  else
+    gt_localename_enhances_locale_funcs=no
+  fi
+])
+
+dnl Tests whether uselocale() exists and is usable.
+dnl Sets gt_working_uselocale and defines HAVE_WORKING_USELOCALE.
+AC_DEFUN([gt_FUNC_USELOCALE],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Persuade glibc and Solaris <locale.h> to define 'locale_t'.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  gl_CHECK_FUNCS_ANDROID([uselocale], [[#include <locale.h>]])
+
+  dnl On AIX 7.2, the uselocale() function is not documented and leads to
+  dnl crashes in subsequent setlocale() invocations.
+  dnl In 2019, some versions of z/OS lack the locale_t type and have a broken
+  dnl uselocale function.
+  if test $ac_cv_func_uselocale = yes; then
+    AC_CHECK_HEADERS_ONCE([xlocale.h])
+    AC_CACHE_CHECK([whether uselocale works],
+      [gt_cv_func_uselocale_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE([[
+#include <locale.h>
+#if HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
+locale_t loc1;
+int main ()
+{
+  uselocale (NULL);
+  setlocale (LC_ALL, "en_US.UTF-8");
+  return 0;
+}]])],
+         [gt_cv_func_uselocale_works=yes],
+         [gt_cv_func_uselocale_works=no],
+         [# Guess no on AIX and z/OS, yes otherwise.
+          case "$host_os" in
+            aix* | openedition*) gt_cv_func_uselocale_works="guessing no" ;;
+            *)                   gt_cv_func_uselocale_works="guessing yes" ;;
+          esac
+         ])
+      ])
+  else
+    gt_cv_func_uselocale_works=no
+  fi
+  case "$gt_cv_func_uselocale_works" in
+    *yes)
+      gt_working_uselocale=yes
+      AC_DEFINE([HAVE_WORKING_USELOCALE], [1],
+        [Define if the uselocale function exists and may safely be called.])
+      ;;
+    *)
+      gt_working_uselocale=no
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 09e78b305a7c67583400ba1e4398cf97b085898b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/intlmacosx.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8ea4d1e37afad2d95f1db3ebfc1f5bea4b35a986
--- /dev/null
@@ -0,0 +1,69 @@
+# intlmacosx.m4 serial 9 (gettext-0.22.3)
+dnl Copyright (C) 2004-2014, 2016, 2019-2024 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
+dnl This file can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Lesser General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Lesser General Public License, and the rest of the GNU
+dnl gettext package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Checks for special options needed on Mac OS X.
+dnl Defines INTL_MACOSX_LIBS.
+AC_DEFUN([gt_INTL_MACOSX],
+[
+  dnl Check for API introduced in Mac OS X 10.4.
+  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
+    [gt_cv_func_CFPreferencesCopyAppValue],
+    [gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <CoreFoundation/CFPreferences.h>]],
+          [[CFPreferencesCopyAppValue(NULL, NULL)]])],
+       [gt_cv_func_CFPreferencesCopyAppValue=yes],
+       [gt_cv_func_CFPreferencesCopyAppValue=no])
+     LIBS="$gt_save_LIBS"])
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
+      [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
+  fi
+  dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent,
+  dnl because in macOS 10.13.4 it has the following behaviour:
+  dnl When two or more languages are specified in the
+  dnl "System Preferences > Language & Region > Preferred Languages" panel,
+  dnl it returns en_CC where CC is the territory (even when English is not among
+  dnl the preferred languages!).  What we want instead is what
+  dnl CFLocaleCopyCurrent returned in earlier macOS releases and what
+  dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the
+  dnl first among the preferred languages and CC is the territory.
+  AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages],
+    [gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <CoreFoundation/CFLocale.h>]],
+          [[CFLocaleCopyPreferredLanguages();]])],
+       [gt_cv_func_CFLocaleCopyPreferredLanguages=yes],
+       [gt_cv_func_CFLocaleCopyPreferredLanguages=no])
+     LIBS="$gt_save_LIBS"])
+  if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
+    AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1],
+      [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.])
+  fi
+  INTL_MACOSX_LIBS=
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
+     || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
+    dnl Starting with macOS version 14, CoreFoundation relies on CoreServices,
+    dnl and we have to link it in explicitly, otherwise an exception
+    dnl NSInvalidArgumentException "unrecognized selector sent to instance"
+    dnl occurs.
+    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices"
+  fi
+  AC_SUBST([INTL_MACOSX_LIBS])
+])
deleted file mode 120000 (symlink)
index 7154c88139ced71d52d39ab37a5b1a5bdb3f5dff..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/intmax_t.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d3d21201f43f8c18decaffdd4b9eee06bba33bdc
--- /dev/null
@@ -0,0 +1,59 @@
+# intmax_t.m4 serial 9
+dnl Copyright (C) 1997-2004, 2006-2007, 2009-2024 Free Software Foundation,
+dnl 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.
+
+AC_PREREQ([2.53])
+
+# Define intmax_t to 'long' or 'long long'
+# if it is not already defined in <stdint.h> or <inttypes.h>.
+
+AC_DEFUN([gl_AC_TYPE_INTMAX_T],
+[
+  dnl For simplicity, we assume that a header file defines 'intmax_t' if and
+  dnl only if it defines 'uintmax_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_DEFINE_UNQUOTED([intmax_t], [long long],
+     [Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
+  else
+    AC_DEFINE([HAVE_INTMAX_T], [1],
+      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
+  fi
+])
+
+dnl An alternative would be to explicitly test for 'intmax_t'.
+
+AC_DEFUN([gt_AC_TYPE_INTMAX_T],
+[
+  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+  AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[
+#include <stddef.h>
+#include <stdlib.h>
+#if HAVE_STDINT_H_WITH_UINTMAX
+#include <stdint.h>
+#endif
+#if HAVE_INTTYPES_H_WITH_UINTMAX
+#include <inttypes.h>
+#endif
+          ]],
+          [[intmax_t x = -1; return !x;]])],
+       [gt_cv_c_intmax_t=yes],
+       [gt_cv_c_intmax_t=no])])
+  if test $gt_cv_c_intmax_t = yes; then
+    AC_DEFINE([HAVE_INTMAX_T], [1],
+      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
+  else
+    AC_DEFINE_UNQUOTED([intmax_t], [long long],
+     [Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
+  fi
+])
deleted file mode 120000 (symlink)
index 42d457996cc24074cb58649f73b2858ce502923f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/inttostr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9dadae52a2e98f73aaa0305b6fc7efc26723d24c
--- /dev/null
@@ -0,0 +1,32 @@
+#serial 8
+dnl Copyright (C) 2004-2006, 2009-2024 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_INTTOSTR],
+[
+  gl_PREREQ_INTTOSTR
+  gl_PREREQ_IMAXTOSTR
+  gl_PREREQ_OFFTOSTR
+  gl_PREREQ_UMAXTOSTR
+  gl_PREREQ_UINTTOSTR
+])
+
+# Prerequisites of lib/inttostr.h.
+AC_DEFUN([gl_PREREQ_INTTOSTR], [
+  AC_REQUIRE([AC_TYPE_OFF_T])
+  :
+])
+
+# Prerequisites of lib/imaxtostr.c.
+AC_DEFUN([gl_PREREQ_IMAXTOSTR], [:])
+
+# Prerequisites of lib/offtostr.c.
+AC_DEFUN([gl_PREREQ_OFFTOSTR], [:])
+
+# Prerequisites of lib/umaxtostr.c.
+AC_DEFUN([gl_PREREQ_UMAXTOSTR], [:])
+
+# Prerequisites of lib/uinttostr.c.
+AC_DEFUN([gl_PREREQ_UINTTOSTR], [:])
deleted file mode 120000 (symlink)
index 7b0ef133c8d82ffdb85c5072c042a6fafa16cbb0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/inttypes.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6abf9dbe280cbd94fc5231d769cd660e7b75c11b
--- /dev/null
@@ -0,0 +1,184 @@
+# inttypes.m4 serial 37
+dnl Copyright (C) 2006-2024 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 Derek Price, Bruno Haible.
+dnl Test whether <inttypes.h> is supported or must be substituted.
+
+AC_DEFUN_ONCE([gl_INTTYPES_H],
+[
+  AC_REQUIRE([gl_INTTYPES_INCOMPLETE])
+  gl_INTTYPES_PRI_SCN
+])
+
+AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE],
+[
+  AC_REQUIRE([gl_STDINT_H])
+  AC_CHECK_HEADERS_ONCE([inttypes.h])
+
+  dnl Override <inttypes.h> always, so that the portability warnings work.
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+  gl_CHECK_NEXT_HEADERS([inttypes.h])
+
+  AC_REQUIRE([gl_MULTIARCH])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
+    ]], [imaxabs imaxdiv strtoimax strtoumax])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+])
+
+# Ensure that the PRI* and SCN* macros are defined appropriately.
+AC_DEFUN([gl_INTTYPES_PRI_SCN],
+[
+  PRIPTR_PREFIX=
+  if $GL_GENERATE_STDINT_H; then
+    dnl Using the gnulib <stdint.h>. It defines intptr_t to 'long' or
+    dnl 'long long', depending on _WIN64.
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[
+         #ifdef _WIN64
+         LLP64
+         #endif
+         ]])
+      ],
+      [PRIPTR_PREFIX='"l"'],
+      [PRIPTR_PREFIX='"ll"'])
+  else
+    dnl Using the system's <stdint.h>.
+    for glpfx in '' l ll I64; do
+      case $glpfx in
+        '')  gltype1='int';;
+        l)   gltype1='long int';;
+        ll)  gltype1='long long int';;
+        I64) gltype1='__int64';;
+      esac
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[#include <stdint.h>
+           extern intptr_t foo;
+           extern $gltype1 foo;]])],
+        [PRIPTR_PREFIX='"'$glpfx'"'])
+      test -n "$PRIPTR_PREFIX" && break
+    done
+  fi
+  AC_SUBST([PRIPTR_PREFIX])
+
+  gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
+    [INT32_MAX_LT_INTMAX_MAX],
+    [defined INT32_MAX && defined INTMAX_MAX],
+    [INT32_MAX < INTMAX_MAX],
+    [sizeof (int) < sizeof (long long int)])
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
+    gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
+      [INT64_MAX_EQ_LONG_MAX],
+      [defined INT64_MAX],
+      [INT64_MAX == LONG_MAX],
+      [sizeof (long long int) == sizeof (long int)])
+  else
+    INT64_MAX_EQ_LONG_MAX=-1
+  fi
+  gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
+    [UINT32_MAX_LT_UINTMAX_MAX],
+    [defined UINT32_MAX && defined UINTMAX_MAX],
+    [UINT32_MAX < UINTMAX_MAX],
+    [sizeof (unsigned int) < sizeof (unsigned long long int)])
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
+    gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
+      [UINT64_MAX_EQ_ULONG_MAX],
+      [defined UINT64_MAX],
+      [UINT64_MAX == ULONG_MAX],
+      [sizeof (unsigned long long int) == sizeof (unsigned long int)])
+  else
+    UINT64_MAX_EQ_ULONG_MAX=-1
+  fi
+])
+
+# Define the symbol $1 to be 1 if the condition is true, 0 otherwise.
+# If $2 is true, the condition is $3; otherwise if long long int is supported
+# approximate the condition with $4; otherwise, assume the condition is false.
+# The condition should work on all C99 platforms; the approximations should be
+# good enough to work on all practical pre-C99 platforms.
+# $2 is evaluated by the C preprocessor, $3 and $4 as compile-time constants.
+AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION],
+[
+  AC_CACHE_CHECK([whether $3],
+    [gl_cv_test_$1],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[/* Work also in C++ mode.  */
+            #define __STDC_LIMIT_MACROS 1
+
+            /* Work if build is not clean.  */
+            #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H
+
+            #include <limits.h>
+            #if HAVE_STDINT_H
+             #include <stdint.h>
+            #endif
+
+            #if $2
+             #define CONDITION ($3)
+            #else
+             #define CONDITION ($4)
+            #endif
+            int test[CONDITION ? 1 : -1];]])],
+       [gl_cv_test_$1=yes],
+       [gl_cv_test_$1=no])])
+  if test $gl_cv_test_$1 = yes; then
+    $1=1;
+  else
+    $1=0;
+  fi
+  AC_SUBST([$1])
+])
+
+# gl_INTTYPES_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_INTTYPES_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_INTTYPES_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXABS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXDIV])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOIMAX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUMAX])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_DECL_IMAXABS=1;   AC_SUBST([HAVE_DECL_IMAXABS])
+  HAVE_DECL_IMAXDIV=1;   AC_SUBST([HAVE_DECL_IMAXDIV])
+  HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
+  HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
+  HAVE_IMAXDIV_T=1;      AC_SUBST([HAVE_IMAXDIV_T])
+  HAVE_IMAXABS=1;        AC_SUBST([HAVE_IMAXABS])
+  HAVE_IMAXDIV=1;        AC_SUBST([HAVE_IMAXDIV])
+  REPLACE_IMAXABS=0;     AC_SUBST([REPLACE_IMAXABS])
+  REPLACE_IMAXDIV=0;     AC_SUBST([REPLACE_IMAXDIV])
+  REPLACE_STRTOIMAX=0;   AC_SUBST([REPLACE_STRTOIMAX])
+  REPLACE_STRTOUMAX=0;   AC_SUBST([REPLACE_STRTOUMAX])
+  INT32_MAX_LT_INTMAX_MAX=1;  AC_SUBST([INT32_MAX_LT_INTMAX_MAX])
+  INT64_MAX_EQ_LONG_MAX='defined _LP64';  AC_SUBST([INT64_MAX_EQ_LONG_MAX])
+  PRIPTR_PREFIX=__PRIPTR_PREFIX;  AC_SUBST([PRIPTR_PREFIX])
+  UINT32_MAX_LT_UINTMAX_MAX=1;  AC_SUBST([UINT32_MAX_LT_UINTMAX_MAX])
+  UINT64_MAX_EQ_ULONG_MAX='defined _LP64';  AC_SUBST([UINT64_MAX_EQ_ULONG_MAX])
+])
deleted file mode 120000 (symlink)
index 082e5857fe827af8d5965b0b779a254d7b64a7e0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/inttypes_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ae0a00f0298421d77c628c517f158470d76c18bb
--- /dev/null
@@ -0,0 +1,29 @@
+# inttypes_h.m4 serial 10
+dnl Copyright (C) 1997-2004, 2006, 2008-2024 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_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
+[
+  AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[
+#include <sys/types.h>
+#include <inttypes.h>
+          ]],
+          [[uintmax_t i = (uintmax_t) -1; return !i;]])],
+       [gl_cv_header_inttypes_h=yes],
+       [gl_cv_header_inttypes_h=no])])
+  if test $gl_cv_header_inttypes_h = yes; then
+    AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1],
+      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
+       and declares uintmax_t. ])
+  fi
+])
deleted file mode 120000 (symlink)
index dcbfa96328971dc3e1c4d91d9fe16b69b34e0ad8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/ioctl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..427888305b2a10058a6798cc1b97266a76880467
--- /dev/null
@@ -0,0 +1,44 @@
+# ioctl.m4 serial 6
+dnl Copyright (C) 2008-2024 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_IOCTL],
+[
+  AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
+  AC_REQUIRE([gl_SYS_SOCKET_H])
+  HAVE_IOCTL=1
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    dnl Even if the 'socket' module is not used here, another part of the
+    dnl application may use it and pass file descriptors that refer to
+    dnl sockets to the ioctl() function. So enable the support for sockets.
+    HAVE_IOCTL=0
+  else
+    AC_CHECK_FUNCS([ioctl])
+    dnl On glibc systems, the second parameter is 'unsigned long int request',
+    dnl not 'int request'. We cannot simply cast the function pointer, but
+    dnl instead need a wrapper.
+    AC_CACHE_CHECK([for ioctl with POSIX signature],
+      [gl_cv_func_ioctl_posix_signature],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <sys/ioctl.h>
+              /* On some platforms, ioctl() is declared in <unistd.h>.  */
+              #include <unistd.h>
+            ]],
+            [[extern
+              #ifdef __cplusplus
+              "C"
+              #endif
+              int ioctl (int, int, ...);
+            ]])
+         ],
+         [gl_cv_func_ioctl_posix_signature=yes],
+         [gl_cv_func_ioctl_posix_signature=no])
+      ])
+    if test $gl_cv_func_ioctl_posix_signature != yes; then
+      REPLACE_IOCTL=1
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index 73265ea2ab953ec425c7ddfc19373e6054685100..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/isapipe.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..95f44ad4478db46b4edf233e3f5b115bd0a745b1
--- /dev/null
@@ -0,0 +1,93 @@
+# Test whether a file descriptor is a pipe.
+
+dnl Copyright (C) 2006, 2009-2024 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_ISAPIPE],
+[
+  # OpenVMS has isapipe already, so check for it.
+  AC_CHECK_FUNCS([isapipe])
+  if test $ac_cv_func_isapipe = yes; then
+    HAVE_ISAPIPE=1
+  else
+    HAVE_ISAPIPE=0
+  fi
+])
+
+# Prerequisites of lib/isapipe.c.
+AC_DEFUN([gl_PREREQ_ISAPIPE],
+[
+  AC_CACHE_CHECK([whether pipes are FIFOs (and for their link count)],
+    [gl_cv_pipes_are_fifos],
+    [AC_RUN_IFELSE(
+       [AC_LANG_SOURCE(
+          [[#include <stdio.h>
+            #include <sys/types.h>
+            #include <sys/stat.h>
+            #include <unistd.h>
+            #ifndef S_ISFIFO
+             #define S_ISFIFO(m) 0
+            #endif
+            #ifndef S_ISSOCK
+             #define S_ISSOCK(m) 0
+            #endif
+            int
+            main (int argc, char **argv)
+            {
+              int fd[2];
+              struct stat st;
+              if (pipe (fd) != 0)
+                return 1;
+              if (fstat (fd[0], &st) != 0)
+                return 2;
+              if (2 <= argc && argv[1][0] == '-')
+                {
+                  char const *yesno = (S_ISFIFO (st.st_mode) ? "yes" : "no");
+                  if (st.st_nlink <= 1)
+                    {
+                      long int i = st.st_nlink;
+                      if (i != st.st_nlink)
+                        return 3;
+                      printf ("%s (%ld)\n", yesno, i);
+                    }
+                  else
+                    {
+                      unsigned long int i = st.st_nlink;
+                      if (i != st.st_nlink)
+                        return 4;
+                      printf ("%s (%lu)\n", yesno, i);
+                    }
+                }
+              else
+                {
+                  if (! S_ISFIFO (st.st_mode) && ! S_ISSOCK (st.st_mode))
+                    return 5;
+                }
+              return 0;
+            }]])],
+       [gl_cv_pipes_are_fifos=`./conftest$ac_exeext -`
+        test -z "$gl_cv_pipes_are_fifos" && gl_cv_pipes_are_fifos=no],
+       [gl_cv_pipes_are_fifos=unknown],
+       [gl_cv_pipes_are_fifos=cross-compiling])])
+
+  case $gl_cv_pipes_are_fifos in #(
+  'yes ('*')')
+    AC_DEFINE([HAVE_FIFO_PIPES], [1],
+      [Define to 1 if pipes are FIFOs, 0 if sockets.  Leave undefined
+       if not known.]);; #(
+  'no ('*')')
+    AC_DEFINE([HAVE_FIFO_PIPES], [0]);;
+  esac
+
+  case $gl_cv_pipes_are_fifos in #(
+  *'('*')')
+    AC_DEFINE_UNQUOTED([PIPE_LINK_COUNT_MAX],
+      [`expr "$gl_cv_pipes_are_fifos" : '.*\((.*)\)'`],
+      [Define to the maximum link count that a true pipe can have.]);;
+  esac
+])
deleted file mode 120000 (symlink)
index 8ecc694b3055b1222be509577c315d65985e46df..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/isatty.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..98e226addc8396d0a47f66b57635bd058612af93
--- /dev/null
@@ -0,0 +1,19 @@
+# isatty.m4 serial 4
+dnl Copyright (C) 2012-2024 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_ISATTY],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  dnl On native Windows, the system's isatty(), defined as an alias of _isatty()
+  dnl in the "oldnames" library, returns true for the NUL device.
+  case $host_os in
+    mingw* | windows*) REPLACE_ISATTY=1 ;;
+  esac
+])
+
+# Prerequisites of lib/isatty.c.
+AC_DEFUN([gl_PREREQ_ISATTY], [:])
deleted file mode 120000 (symlink)
index 5ea911a8fa29cbdc1c47ce0127a8afd55cc54cae..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/isblank.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d07472cd3561303975a5899d16f1a1408643848e
--- /dev/null
@@ -0,0 +1,17 @@
+# isblank.m4 serial 3
+dnl Copyright (C) 2009-2024 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_ISBLANK],
+[
+  dnl Persuade glibc <ctype.h> to declare isblank().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([isblank])
+  if test $ac_cv_func_isblank = no; then
+    HAVE_ISBLANK=0
+  fi
+])
deleted file mode 120000 (symlink)
index eaa21fe2fe95a5cc92b12fc10ec4f2c6e97e4498..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/isnand.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8cd04903f0a4b8bb831f3ed27e5030b70219ba20
--- /dev/null
@@ -0,0 +1,95 @@
+# isnand.m4 serial 13
+dnl Copyright (C) 2007-2024 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 Check how to get or define isnand().
+
+AC_DEFUN([gl_FUNC_ISNAND],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  ISNAND_LIBM=
+  gl_HAVE_ISNAND_NO_LIBM
+  if test $gl_cv_func_isnand_no_libm = no; then
+    gl_HAVE_ISNAND_IN_LIBM
+    if test $gl_cv_func_isnand_in_libm = yes; then
+      ISNAND_LIBM=-lm
+    fi
+  fi
+  dnl The variable gl_func_isnand set here is used by isnan.m4.
+  if test $gl_cv_func_isnand_no_libm = yes || test -n "$ISNAND_LIBM"; then
+    gl_func_isnand=yes
+  else
+    gl_func_isnand=no
+    HAVE_ISNAND=0
+  fi
+  AC_SUBST([ISNAND_LIBM])
+])
+
+dnl Check how to get or define isnand() without linking with libm.
+
+AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM],
+[
+  gl_HAVE_ISNAND_NO_LIBM
+  gl_func_isnand_no_libm=$gl_cv_func_isnand_no_libm
+  if test $gl_cv_func_isnand_no_libm = yes; then
+    AC_DEFINE([HAVE_ISNAND_IN_LIBC], [1],
+      [Define if the isnan(double) function is available in libc.])
+  fi
+])
+
+dnl Prerequisites of replacement isnand definition. It does not need -lm.
+AC_DEFUN([gl_PREREQ_ISNAND],
+[
+  AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION])
+])
+
+dnl Test whether isnand() can be used with libm.
+
+AC_DEFUN([gl_HAVE_ISNAND_IN_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(double) can be used with libm],
+    [gl_cv_func_isnand_in_libm],
+    [
+      save_LIBS="$LIBS"
+      LIBS="$LIBS -lm"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+             # undef isnand
+             # define isnand(x) __builtin_isnan ((double)(x))
+             #elif defined isnan
+             # undef isnand
+             # define isnand(x) isnan ((double)(x))
+             #endif
+             double x;]],
+           [[return isnand (x);]])],
+        [gl_cv_func_isnand_in_libm=yes],
+        [gl_cv_func_isnand_in_libm=no])
+      LIBS="$save_LIBS"
+    ])
+])
+
+AC_DEFUN([gl_HAVE_ISNAND_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm],
+    [gl_cv_func_isnand_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+             # undef isnand
+             # define isnand(x) __builtin_isnan ((double)(x))
+             #else
+             # undef isnand
+             # define isnand(x) isnan ((double)(x))
+             #endif
+             double x;]],
+           [[return isnand (x);]])],
+        [gl_cv_func_isnand_no_libm=yes],
+        [gl_cv_func_isnand_no_libm=no])
+    ])
+])
deleted file mode 120000 (symlink)
index 68e68942310fa7b65bbae7bc0622093d43e52dc8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/isnanf.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..689fb621a8ba8b059185aabf85b9673dc1c18806
--- /dev/null
@@ -0,0 +1,196 @@
+# isnanf.m4 serial 20
+dnl Copyright (C) 2007-2024 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 Check how to get or define isnanf().
+
+AC_DEFUN([gl_FUNC_ISNANF],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  ISNANF_LIBM=
+  gl_HAVE_ISNANF_NO_LIBM
+  if test $gl_cv_func_isnanf_no_libm = no; then
+    gl_HAVE_ISNANF_IN_LIBM
+    if test $gl_cv_func_isnanf_in_libm = yes; then
+      ISNANF_LIBM=-lm
+    fi
+  fi
+  dnl The variable gl_func_isnanf set here is used by isnan.m4.
+  if test $gl_cv_func_isnanf_no_libm = yes || test -n "$ISNANF_LIBM"; then
+    save_LIBS="$LIBS"
+    LIBS="$LIBS $ISNANF_LIBM"
+    gl_ISNANF_WORKS
+    LIBS="$save_LIBS"
+    case "$gl_cv_func_isnanf_works" in
+      *yes) gl_func_isnanf=yes ;;
+      *)    gl_func_isnanf=no; ISNANF_LIBM= ;;
+    esac
+  else
+    gl_func_isnanf=no
+  fi
+  if test $gl_func_isnanf != yes; then
+    HAVE_ISNANF=0
+  fi
+  AC_SUBST([ISNANF_LIBM])
+])
+
+dnl Check how to get or define isnanf() without linking with libm.
+
+AC_DEFUN([gl_FUNC_ISNANF_NO_LIBM],
+[
+  gl_HAVE_ISNANF_NO_LIBM
+  if test $gl_cv_func_isnanf_no_libm = yes; then
+    gl_ISNANF_WORKS
+  fi
+  if test $gl_cv_func_isnanf_no_libm = yes \
+     && { case "$gl_cv_func_isnanf_works" in
+            *yes) true;;
+            *) false;;
+          esac
+        }; then
+    gl_func_isnanf_no_libm=yes
+    AC_DEFINE([HAVE_ISNANF_IN_LIBC], [1],
+      [Define if the isnan(float) function is available in libc.])
+  else
+    gl_func_isnanf_no_libm=no
+  fi
+])
+
+dnl Prerequisites of replacement isnanf definition. It does not need -lm.
+AC_DEFUN([gl_PREREQ_ISNANF],
+[
+  gl_FLOAT_EXPONENT_LOCATION
+])
+
+dnl Test whether isnanf() can be used without libm.
+AC_DEFUN([gl_HAVE_ISNANF_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(float) can be used without linking with libm],
+    [gl_cv_func_isnanf_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+             # undef isnanf
+             # define isnanf(x) __builtin_isnan ((float)(x))
+             #elif defined isnan
+             # undef isnanf
+             # define isnanf(x) isnan ((float)(x))
+             #endif
+             float x;]],
+           [[return isnanf (x);]])],
+        [gl_cv_func_isnanf_no_libm=yes],
+        [gl_cv_func_isnanf_no_libm=no])
+    ])
+])
+
+dnl Test whether isnanf() can be used with libm.
+AC_DEFUN([gl_HAVE_ISNANF_IN_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(float) can be used with libm],
+    [gl_cv_func_isnanf_in_libm],
+    [
+      save_LIBS="$LIBS"
+      LIBS="$LIBS -lm"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+             # undef isnanf
+             # define isnanf(x) __builtin_isnan ((float)(x))
+             #elif defined isnan
+             # undef isnanf
+             # define isnanf(x) isnan ((float)(x))
+             #endif
+             float x;]],
+           [[return isnanf (x);]])],
+        [gl_cv_func_isnanf_in_libm=yes],
+        [gl_cv_func_isnanf_in_libm=no])
+      LIBS="$save_LIBS"
+    ])
+])
+
+dnl Test whether isnanf() rejects Infinity (this fails on Solaris 2.5.1),
+dnl recognizes a NaN (this fails on IRIX 6.5 with cc), and recognizes a NaN
+dnl with in-memory representation 0x7fbfffff (this fails on IRIX 6.5).
+AC_DEFUN([gl_ISNANF_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION])
+  AC_CACHE_CHECK([whether isnan(float) works], [gl_cv_func_isnanf_works],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <math.h>
+#if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+# undef isnanf
+# define isnanf(x) __builtin_isnan ((float)(x))
+#elif defined isnan
+# undef isnanf
+# define isnanf(x) isnan ((float)(x))
+#endif
+/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0.  */
+#ifdef __DECC
+static float
+NaN ()
+{
+  static float zero = 0.0f;
+  return zero / zero;
+}
+#else
+# define NaN() (0.0f / 0.0f)
+#endif
+#define NWORDS \
+  ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { unsigned int word[NWORDS]; float value; } memory_float;
+int main()
+{
+  int result = 0;
+
+  if (isnanf (1.0f / 0.0f))
+    result |= 1;
+
+  if (!isnanf (NaN ()))
+    result |= 2;
+
+#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
+  /* The isnanf function should be immune against changes in the sign bit and
+     in the mantissa bits.  The xor operation twiddles a bit that can only be
+     a sign bit or a mantissa bit.  */
+  if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0)
+    {
+      memory_float m;
+
+      m.value = NaN ();
+      /* Set the bits below the exponent to 01111...111.  */
+      m.word[0] &= -1U << FLT_EXPBIT0_BIT;
+      m.word[0] |= (1U << (FLT_EXPBIT0_BIT - 1)) - 1;
+      if (!isnanf (m.value))
+        result |= 4;
+    }
+#endif
+
+  return result;
+}]])],
+        [gl_cv_func_isnanf_works=yes],
+        [gl_cv_func_isnanf_works=no],
+        [case "$host_os" in
+           irix* | solaris*) gl_cv_func_isnanf_works="guessing no" ;;
+           mingw* | windows*) # Guess yes on mingw, no on MSVC.
+             AC_EGREP_CPP([Known], [
+#ifdef __MINGW32__
+ Known
+#endif
+               ],
+               [gl_cv_func_isnanf_works="guessing yes"],
+               [gl_cv_func_isnanf_works="guessing no"])
+             ;;
+           *) gl_cv_func_isnanf_works="guessing yes" ;;
+         esac
+        ])
+    ])
+])
deleted file mode 120000 (symlink)
index 589dab07129d99afa3c9fee4db971f172266c65f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/isnanl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f0a30c0a567f18a0c29bfa22152401eeef926d4a
--- /dev/null
@@ -0,0 +1,247 @@
+# isnanl.m4 serial 24
+dnl Copyright (C) 2007-2024 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_ISNANL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  ISNANL_LIBM=
+  gl_HAVE_ISNANL_NO_LIBM
+  if test $gl_cv_func_isnanl_no_libm = no; then
+    gl_HAVE_ISNANL_IN_LIBM
+    if test $gl_cv_func_isnanl_in_libm = yes; then
+      ISNANL_LIBM=-lm
+    fi
+  fi
+  dnl The variable gl_func_isnanl set here is used by isnan.m4.
+  if test $gl_cv_func_isnanl_no_libm = yes || test -n "$ISNANL_LIBM"; then
+    save_LIBS="$LIBS"
+    LIBS="$LIBS $ISNANL_LIBM"
+    gl_FUNC_ISNANL_WORKS
+    LIBS="$save_LIBS"
+    case "$gl_cv_func_isnanl_works" in
+      *yes) gl_func_isnanl=yes ;;
+      *)    gl_func_isnanl=no; ISNANL_LIBM= ;;
+    esac
+  else
+    gl_func_isnanl=no
+  fi
+  if test $gl_func_isnanl != yes; then
+    HAVE_ISNANL=0
+  fi
+  AC_SUBST([ISNANL_LIBM])
+])
+
+AC_DEFUN([gl_FUNC_ISNANL_NO_LIBM],
+[
+  gl_HAVE_ISNANL_NO_LIBM
+  gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm
+  if test $gl_func_isnanl_no_libm = yes; then
+    gl_FUNC_ISNANL_WORKS
+    case "$gl_cv_func_isnanl_works" in
+      *yes) ;;
+      *)    gl_func_isnanl_no_libm=no ;;
+    esac
+  fi
+  if test $gl_func_isnanl_no_libm = yes; then
+    AC_DEFINE([HAVE_ISNANL_IN_LIBC], [1],
+      [Define if the isnan(long double) function is available in libc.])
+  fi
+])
+
+dnl Prerequisites of replacement isnanl definition. It does not need -lm.
+AC_DEFUN([gl_PREREQ_ISNANL],
+[
+  gl_LONG_DOUBLE_EXPONENT_LOCATION
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+])
+
+dnl Test whether isnanl() can be used without libm.
+AC_DEFUN([gl_HAVE_ISNANL_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(long double) can be used without linking with libm],
+    [gl_cv_func_isnanl_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+             # undef isnanl
+             # define isnanl(x) __builtin_isnan ((long double)(x))
+             #elif defined isnan
+             # undef isnanl
+             # define isnanl(x) isnan ((long double)(x))
+             #endif
+             long double x;]],
+           [[return isnanl (x);]])],
+        [gl_cv_func_isnanl_no_libm=yes],
+        [gl_cv_func_isnanl_no_libm=no])
+    ])
+])
+
+dnl Test whether isnanl() can be used with libm.
+AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(long double) can be used with libm],
+    [gl_cv_func_isnanl_in_libm],
+    [
+      save_LIBS="$LIBS"
+      LIBS="$LIBS -lm"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+             # undef isnanl
+             # define isnanl(x) __builtin_isnan ((long double)(x))
+             #elif defined isnan
+             # undef isnanl
+             # define isnanl(x) isnan ((long double)(x))
+             #endif
+             long double x;]],
+           [[return isnanl (x);]])],
+        [gl_cv_func_isnanl_in_libm=yes],
+        [gl_cv_func_isnanl_in_libm=no])
+      LIBS="$save_LIBS"
+    ])
+])
+
+dnl Test whether isnanl() recognizes all canonical numbers which are neither
+dnl finite nor infinite.
+AC_DEFUN([gl_FUNC_ISNANL_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_BIGENDIAN])
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether isnanl works], [gl_cv_func_isnanl_works],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+# undef isnanl
+# define isnanl(x) __builtin_isnan ((long double)(x))
+#elif defined isnan
+# undef isnanl
+# define isnanl(x) isnan ((long double)(x))
+#endif
+#define NWORDS \
+  ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { unsigned int word[NWORDS]; long double value; }
+        memory_long_double;
+/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
+   runtime type conversion.  */
+#ifdef __sgi
+static long double NaNl ()
+{
+  double zero = 0.0;
+  return zero / zero;
+}
+#else
+# define NaNl() (0.0L / 0.0L)
+#endif
+int main ()
+{
+  int result = 0;
+
+  if (!isnanl (NaNl ()))
+    result |= 1;
+
+  {
+    memory_long_double m;
+    unsigned int i;
+
+    /* The isnanl function should be immune against changes in the sign bit and
+       in the mantissa bits.  The xor operation twiddles a bit that can only be
+       a sign bit or a mantissa bit (since the exponent never extends to
+       bit 31).  */
+    m.value = NaNl ();
+    m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
+    for (i = 0; i < NWORDS; i++)
+      m.word[i] |= 1;
+    if (!isnanl (m.value))
+      result |= 1;
+  }
+
+#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+/* Representation of an 80-bit 'long double' as an initializer for a sequence
+   of 'unsigned int' words.  */
+# ifdef WORDS_BIGENDIAN
+#  define LDBL80_WORDS(exponent,manthi,mantlo) \
+     { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
+       ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16),   \
+       (unsigned int) (mantlo) << 16                                        \
+     }
+# else
+#  define LDBL80_WORDS(exponent,manthi,mantlo) \
+     { mantlo, manthi, exponent }
+# endif
+  { /* Quiet NaN.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
+    if (!isnanl (x.value))
+      result |= 2;
+  }
+  {
+    /* Signalling NaN.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
+    if (!isnanl (x.value))
+      result |= 2;
+  }
+  /* isnanl should return something even for noncanonical values.  */
+  { /* Pseudo-NaN.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
+    if (isnanl (x.value) && !isnanl (x.value))
+      result |= 4;
+  }
+  { /* Pseudo-Infinity.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
+    if (isnanl (x.value) && !isnanl (x.value))
+      result |= 8;
+  }
+  { /* Pseudo-Zero.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
+    if (isnanl (x.value) && !isnanl (x.value))
+      result |= 16;
+  }
+  { /* Unnormalized number.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
+    if (isnanl (x.value) && !isnanl (x.value))
+      result |= 32;
+  }
+  { /* Pseudo-Denormal.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
+    if (isnanl (x.value) && !isnanl (x.value))
+      result |= 64;
+  }
+#endif
+
+  return result;
+}]])],
+        [gl_cv_func_isnanl_works=yes],
+        [gl_cv_func_isnanl_works=no],
+        [case "$host_os" in
+           mingw* | windows*) # Guess yes on mingw, no on MSVC.
+             AC_EGREP_CPP([Known], [
+#ifdef __MINGW32__
+ Known
+#endif
+               ],
+               [gl_cv_func_isnanl_works="guessing yes"],
+               [gl_cv_func_isnanl_works="guessing no"])
+             ;;
+           *) gl_cv_func_isnanl_works="guessing yes" ;;
+         esac
+        ])
+    ])
+])
deleted file mode 120000 (symlink)
index fd6c88c0c083870598f0a2485101e21a7874bc70..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/iswblank.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e450f0bd8c6fac7747a82ef34f123bee92673107
--- /dev/null
@@ -0,0 +1,38 @@
+# iswblank.m4 serial 7
+dnl Copyright (C) 2011-2024 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_ISWBLANK],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H])
+  dnl Persuade glibc <wctype.h> to declare iswblank().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  gl_CHECK_FUNCS_ANDROID([iswblank], [[#include <wctype.h>]])
+  AC_CHECK_DECLS([iswblank], , , [[
+    #include <wchar.h>
+    #include <wctype.h>
+  ]])
+  if test $ac_cv_func_iswblank = no; then
+    HAVE_ISWBLANK=0
+    if test $ac_cv_have_decl_iswblank = yes \
+       || case "$gl_cv_onwards_func_iswblank" in \
+            future*) true ;; \
+            *) false ;; \
+          esac; then
+      REPLACE_ISWBLANK=1
+    fi
+  fi
+  if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
+    dnl Redefine all of iswcntrl, ..., towupper in <wctype.h>.
+    :
+  else
+    if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then
+      dnl Redefine only iswblank.
+      :
+    fi
+  fi
+
+])
deleted file mode 120000 (symlink)
index 96f22db968b8886ac82a502d3241ca70ee507595..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/iswctype.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..775f2227286ad54b1d71681af8b1e88da10dc236
--- /dev/null
@@ -0,0 +1,13 @@
+# iswctype.m4 serial 3
+dnl Copyright (C) 2011-2024 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_ISWCTYPE],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H])
+  dnl Determine REPLACE_WCTYPE.
+  AC_REQUIRE([gl_FUNC_WCTYPE])
+])
deleted file mode 120000 (symlink)
index 5928369f156edf52db8d6786e81d92e85dd7f5d5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/iswdigit.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d13c1ae967d62ae8ea8b684bb1d88c88ae393e08
--- /dev/null
@@ -0,0 +1,120 @@
+# iswdigit.m4 serial 6
+dnl Copyright (C) 2020-2024 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_ISWDIGIT],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H])
+  AC_REQUIRE([gt_LOCALE_FR])
+  AC_REQUIRE([gt_LOCALE_JA])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
+    dnl <wctype.h> redefines iswdigit already.
+    REPLACE_ISWDIGIT="$REPLACE_ISWCNTRL"
+  else
+    AC_CACHE_CHECK([whether iswdigit is ISO C compliant],
+      [gl_cv_func_iswdigit_works],
+      [
+       dnl Initial guess, used when cross-compiling or when no suitable locale
+       dnl is present.
+changequote(,)dnl
+       case "$host_os" in
+         # Guess no on FreeBSD, NetBSD, Solaris, native Windows.
+         freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*)
+           gl_cv_func_iswdigit_works="guessing no" ;;
+         # Guess yes otherwise.
+         *) gl_cv_func_iswdigit_works="guessing yes" ;;
+       esac
+changequote([,])dnl
+       if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then
+         AC_RUN_IFELSE(
+           [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+
+/* Returns the value of iswdigit for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  wchar_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (wchar_t) 0xBADFACE;
+  ret = mbrtowc (&wc, s, n, &state);
+  if (ret != n)
+    abort ();
+
+  return iswdigit (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  int result = 0;
+
+  if (strcmp ("$LOCALE_FR", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+    {
+      /* This fails on mingw, MSVC 14.  */
+      /* U+00B2 SUPERSCRIPT TWO */
+      is = for_character ("\262", 1);
+      if (!(is == 0))
+        result |= 1;
+    }
+  if (strcmp ("$LOCALE_JA", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      /* This fails on NetBSD 8.0.  */
+      /* U+FF11 FULLWIDTH DIGIT ONE */
+      is = for_character ("\243\261", 2);
+      if (!(is == 0))
+        result |= 2;
+    }
+  if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14.  */
+      /* U+0663 ARABIC-INDIC DIGIT THREE */
+      is = for_character ("\331\243", 2);
+      if (!(is == 0))
+        result |= 4;
+      /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14.  */
+      /* U+FF11 FULLWIDTH DIGIT ONE */
+      is = for_character ("\357\274\221", 3);
+      if (!(is == 0))
+        result |= 8;
+    }
+  if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      /* This fails on NetBSD 8.0, Solaris 10, Solaris 11.4.  */
+      /* U+FF11 FULLWIDTH DIGIT ONE */
+      is = for_character ("\243\261", 2);
+      if (!(is == 0))
+        result |= 16;
+    }
+  return result;
+}]])],
+           [gl_cv_func_iswdigit_works=yes],
+           [gl_cv_func_iswdigit_works=no],
+           [:])
+       fi
+      ])
+    case "$gl_cv_func_iswdigit_works" in
+      *yes) ;;
+      *) REPLACE_ISWDIGIT=1 ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 783b33749b52839f82e0d5991bf69f769541aa90..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/iswpunct.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2be15abaaa9bf6414a6dd82da87380b34473087c
--- /dev/null
@@ -0,0 +1,48 @@
+# iswpunct.m4 serial 2
+dnl Copyright (C) 2023-2024 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_ISWPUNCT],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
+    dnl <wctype.h> redefines iswpunct already.
+    REPLACE_ISWPUNCT="$REPLACE_ISWCNTRL"
+  else
+    AC_CACHE_CHECK([whether iswpunct is consistent with ispunct],
+      [gl_cv_func_iswpunct_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE([[
+#include <ctype.h>
+#include <wchar.h>
+#include <wctype.h>
+int
+main (int argc, char *argv[])
+{
+  int result = 0;
+  /* This fails on Android 11.  */
+  if ((! iswpunct ('\`')) != (! ispunct ('\`')))
+    result |= 1;
+  return result;
+}]])],
+         [gl_cv_func_iswpunct_works=yes],
+         [gl_cv_func_iswpunct_works=no],
+         [case "$host_os" in
+            # Guess no on Android.
+            android*) gl_cv_func_iswpunct_works="guessing no" ;;
+            # Guess yes otherwise.
+            *)        gl_cv_func_iswpunct_works="guessing yes" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_iswpunct_works" in
+      *yes) ;;
+      *) REPLACE_ISWPUNCT=1 ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 49b8fc6050816a8b4eb9ca0ca85ed083252ab98a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/iswxdigit.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d42f0d13409a62f2f477fda64cc145768c831355
--- /dev/null
@@ -0,0 +1,110 @@
+# iswxdigit.m4 serial 6
+dnl Copyright (C) 2020-2024 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_ISWXDIGIT],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H])
+  AC_REQUIRE([gt_LOCALE_JA])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
+    dnl <wctype.h> redefines iswxdigit already.
+    REPLACE_ISWXDIGIT="$REPLACE_ISWCNTRL"
+  else
+    AC_CACHE_CHECK([whether iswxdigit is ISO C compliant],
+      [gl_cv_func_iswxdigit_works],
+      [
+       dnl Initial guess, used when cross-compiling or when no suitable locale
+       dnl is present.
+changequote(,)dnl
+       case "$host_os" in
+         # Guess no on FreeBSD, NetBSD, Solaris, native Windows.
+         freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*)
+           gl_cv_func_iswxdigit_works="guessing no" ;;
+         # Guess yes otherwise.
+         *) gl_cv_func_iswxdigit_works="guessing yes" ;;
+       esac
+changequote([,])dnl
+       if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then
+         AC_RUN_IFELSE(
+           [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <wctype.h>
+
+/* Returns the value of iswxdigit for the multibyte character s[0..n-1].  */
+static int
+for_character (const char *s, size_t n)
+{
+  mbstate_t state;
+  wchar_t wc;
+  size_t ret;
+
+  memset (&state, '\0', sizeof (mbstate_t));
+  wc = (wchar_t) 0xBADFACE;
+  ret = mbrtowc (&wc, s, n, &state);
+  if (ret != n)
+    abort ();
+
+  return iswxdigit (wc);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int is;
+  int result = 0;
+
+  if (strcmp ("$LOCALE_JA", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      /* This fails on NetBSD 8.0.  */
+      /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
+      is = for_character ("\243\301", 2);
+      if (!(is == 0))
+        result |= 1;
+    }
+  if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      /* This fails on FreeBSD 13.0.  */
+      /* U+0663 ARABIC-INDIC DIGIT THREE */
+      is = for_character ("\331\243", 2);
+      if (!(is == 0))
+        result |= 2;
+      /* This fails on MSVC 14.  */
+      /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
+      is = for_character ("\357\274\241", 3);
+      if (!(is == 0))
+        result |= 4;
+    }
+  if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      /* This fails on Solaris 10, Solaris 11.4.  */
+      /* U+FF11 FULLWIDTH DIGIT ONE */
+      is = for_character ("\243\261", 2);
+      if (!(is == 0))
+        result |= 8;
+    }
+  return result;
+}]])],
+           [gl_cv_func_iswxdigit_works=yes],
+           [gl_cv_func_iswxdigit_works=no],
+           [:])
+       fi
+      ])
+    case "$gl_cv_func_iswxdigit_works" in
+      *yes) ;;
+      *) REPLACE_ISWXDIGIT=1 ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index e215f3fe30fdb1463195044d091e3f687303cff4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/jm-winsz1.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5a9b29ae082e2474157b5e4043bf793b74605562
--- /dev/null
@@ -0,0 +1,50 @@
+# serial 12
+
+# Copyright (C) 1996, 1999, 2001-2002, 2004, 2006, 2009-2024 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 and Paul Eggert.
+AC_DEFUN([gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
+[AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
+ AC_CACHE_CHECK([whether use of TIOCGWINSZ requires termios.h],
+                [gl_cv_sys_tiocgwinsz_needs_termios_h],
+  [gl_cv_sys_tiocgwinsz_needs_termios_h=no
+
+   if test $ac_cv_sys_posix_termios = yes; then
+     AC_EGREP_CPP([yes],
+     [#include <sys/types.h>
+#      include <termios.h>
+#      ifdef TIOCGWINSZ
+         yes
+#      endif
+     ], [gl_cv_sys_tiocgwinsz_needs_termios_h=yes])
+   fi
+  ])
+])
+
+AC_DEFUN([gl_WINSIZE_IN_PTEM],
+[
+   AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
+   AC_CACHE_CHECK([whether use of struct winsize requires sys/ptem.h],
+     [gl_cv_sys_struct_winsize_needs_sys_ptem_h],
+     [gl_cv_sys_struct_winsize_needs_sys_ptem_h=yes
+      if test $ac_cv_sys_posix_termios = yes; then
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <termios.h>]],
+          [[struct winsize x;
+            if (sizeof x > 0) return 0;]])],
+          [gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
+      fi
+      if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/ptem.h>]],
+          [[struct winsize x;
+            if (sizeof x > 0) return 0;]])],
+          [], [gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
+      fi])
+   if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
+     AC_DEFINE([WINSIZE_IN_PTEM], [1],
+       [Define if sys/ptem.h is required for struct winsize.])
+   fi
+])
deleted file mode 120000 (symlink)
index d10aa8cf8d8390fb263372b905e55c371891a9ee..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/jm-winsz2.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..10cc88ec55ad882d9c7d75e38c6b4f4b002f3522
--- /dev/null
@@ -0,0 +1,29 @@
+# serial 8
+
+# Copyright (C) 1996, 1999, 2001, 2004, 2009-2024 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_TIOCGWINSZ_NEEDS_SYS_IOCTL],
+[AC_REQUIRE([gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H])
+ AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
+                [gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h],
+  [gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
+
+   if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no; then
+     AC_EGREP_CPP([yes],
+       [#include <sys/types.h>
+#        include <sys/ioctl.h>
+#        ifdef TIOCGWINSZ
+           yes
+#        endif
+       ], [gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes])
+   fi
+  ])
+  if test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
+    AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
+      [Define if your system defines TIOCGWINSZ in sys/ioctl.h.])
+  fi
+])
deleted file mode 120000 (symlink)
index 2bb38e41b2767aebb34eab71e6135688b8feeaf5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/langinfo_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..888b161256a2bfd8069f211f44637588f9d66568
--- /dev/null
@@ -0,0 +1,137 @@
+# langinfo_h.m4 serial 12
+dnl Copyright (C) 2009-2024 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_ONCE([gl_LANGINFO_H],
+[
+  AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
+
+  dnl Persuade glibc-2.0.6 <langinfo.h> to define CODESET.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl <langinfo.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([langinfo.h])
+
+  dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
+  HAVE_LANGINFO_CODESET=0
+  HAVE_LANGINFO_T_FMT_AMPM=0
+  HAVE_LANGINFO_ALTMON=0
+  HAVE_LANGINFO_ERA=0
+  HAVE_LANGINFO_YESEXPR=0
+  AC_CHECK_HEADERS_ONCE([langinfo.h])
+  if test $ac_cv_header_langinfo_h = yes; then
+    HAVE_LANGINFO_H=1
+    dnl Determine what <langinfo.h> defines.
+    dnl CODESET is missing on OpenBSD 3.8.
+    dnl ERA etc. are missing on OpenBSD 6.7.
+    dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3.
+    dnl ALTMON_* are missing on glibc 2.26 and many other systems.
+    AC_CACHE_CHECK([whether langinfo.h defines CODESET],
+      [gl_cv_header_langinfo_codeset],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[#include <langinfo.h>
+int a = CODESET;
+]])],
+         [gl_cv_header_langinfo_codeset=yes],
+         [gl_cv_header_langinfo_codeset=no])
+      ])
+    if test $gl_cv_header_langinfo_codeset = yes; then
+      HAVE_LANGINFO_CODESET=1
+    fi
+    AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM],
+      [gl_cv_header_langinfo_t_fmt_ampm],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[#include <langinfo.h>
+int a = T_FMT_AMPM;
+]])],
+         [gl_cv_header_langinfo_t_fmt_ampm=yes],
+         [gl_cv_header_langinfo_t_fmt_ampm=no])
+      ])
+    if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
+      HAVE_LANGINFO_T_FMT_AMPM=1
+    fi
+    AC_CACHE_CHECK([whether langinfo.h defines ALTMON_1],
+      [gl_cv_header_langinfo_altmon],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[#include <langinfo.h>
+int a = ALTMON_1;
+]])],
+         [gl_cv_header_langinfo_altmon=yes],
+         [gl_cv_header_langinfo_altmon=no])
+      ])
+    if test $gl_cv_header_langinfo_altmon = yes; then
+      HAVE_LANGINFO_ALTMON=1
+    fi
+    AC_CACHE_CHECK([whether langinfo.h defines ERA],
+      [gl_cv_header_langinfo_era],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[#include <langinfo.h>
+int a = ERA;
+]])],
+         [gl_cv_header_langinfo_era=yes],
+         [gl_cv_header_langinfo_era=no])
+      ])
+    if test $gl_cv_header_langinfo_era = yes; then
+      HAVE_LANGINFO_ERA=1
+    fi
+    AC_CACHE_CHECK([whether langinfo.h defines YESEXPR],
+      [gl_cv_header_langinfo_yesexpr],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[#include <langinfo.h>
+int a = YESEXPR;
+]])],
+         [gl_cv_header_langinfo_yesexpr=yes],
+         [gl_cv_header_langinfo_yesexpr=no])
+      ])
+    if test $gl_cv_header_langinfo_yesexpr = yes; then
+      HAVE_LANGINFO_YESEXPR=1
+    fi
+  else
+    HAVE_LANGINFO_H=0
+  fi
+  AC_SUBST([HAVE_LANGINFO_H])
+  AC_SUBST([HAVE_LANGINFO_CODESET])
+  AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
+  AC_SUBST([HAVE_LANGINFO_ALTMON])
+  AC_SUBST([HAVE_LANGINFO_ERA])
+  AC_SUBST([HAVE_LANGINFO_YESEXPR])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <langinfo.h>
+    ]], [nl_langinfo])
+])
+
+# gl_LANGINFO_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_LANGINFO_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_LANGINFO_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NL_LANGINFO])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_LANGINFO_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_NL_LANGINFO=1;    AC_SUBST([HAVE_NL_LANGINFO])
+  REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO])
+])
deleted file mode 120000 (symlink)
index 99c959c5c4c7cbb8c2f1c1ca2bc63575e4b14324..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/largefile.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cbe9bc1f63d00a6fd1cfa3cb7a44cbfe22160f11
--- /dev/null
@@ -0,0 +1,358 @@
+# Enable large files on systems where this is not the default.
+# Enable support for files on Linux file systems with 64-bit inode numbers.
+
+# Copyright 1992-1996, 1998-2024 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.
+
+# The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO:
+# It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this
+# setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko
+# and ftello in C++ mode as well.
+# This problem occurs in Autoconf 2.71 and earlier, which lack AC_SYS_YEAR2038.
+AC_DEFUN([gl_SET_LARGEFILE_SOURCE],
+ m4_ifndef([AC_SYS_YEAR2038], [[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_FUNC_FSEEKO
+  case "$host_os" in
+    hpux*)
+      AC_DEFINE([_LARGEFILE_SOURCE], [1],
+        [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).])
+      ;;
+  esac
+ ]])
+)
+
+m4_ifndef([AC_SYS_YEAR2038_RECOMMENDED], [
+# Support AC_SYS_YEAR2038_RECOMMENDED and related macros, even if
+# Autoconf 2.71 or earlier.  This code is taken from Autoconf master.
+
+# _AC_SYS_YEAR2038_TEST_CODE
+# --------------------------
+# C code used to probe for time_t that can represent time points more
+# than 2**31 - 1 seconds after the epoch.  With the usual Unix epoch,
+# these correspond to dates after 2038-01-18 22:14:07 +0000 (Gregorian),
+# hence the name.
+AC_DEFUN([_AC_SYS_YEAR2038_TEST_CODE],
+[[
+  #include <time.h>
+  /* Check that time_t can represent 2**32 - 1 correctly.  */
+  #define LARGE_TIME_T \\
+    ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30)))
+  int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535
+                           && LARGE_TIME_T % 65537 == 0)
+                          ? 1 : -1];
+]])
+
+# _AC_SYS_YEAR2038_OPTIONS
+# ------------------------
+# List of known ways to enable support for large time_t.  If you change
+# this list you probably also need to change the AS_CASE at the end of
+# _AC_SYS_YEAR2038_PROBE.
+m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize(
+    ["none needed"]                   dnl 64-bit and newer 32-bit Unix
+    ["-D_TIME_BITS=64"]               dnl glibc 2.34 with some 32-bit ABIs
+    ["-D__MINGW_USE_VC2005_COMPAT"]   dnl 32-bit MinGW
+    ["-U_USE_32_BIT_TIME_T -D__MINGW_USE_VC2005_COMPAT"]
+                                      dnl 32-bit MinGW (misconfiguration)
+))
+
+# _AC_SYS_YEAR2038_PROBE
+# ----------------------
+# Subroutine of AC_SYS_YEAR2038.  Probe for time_t that can represent
+# time points more than 2**31 - 1 seconds after the epoch (dates after
+# 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts
+# to one of the values in the _AC_SYS_YEAR2038_OPTIONS list, or to
+# "support not detected" if none of them worked.  Then, set compilation
+# options and #defines as necessary to enable large time_t support.
+#
+# Note that we do not test whether mktime, localtime, etc. handle
+# large values of time_t correctly, as that would require use of
+# AC_TRY_RUN.  Note also that some systems only support large time_t
+# together with large off_t.
+#
+# If you change this macro you may also need to change
+# _AC_SYS_YEAR2038_OPTIONS.
+AC_DEFUN([_AC_SYS_YEAR2038_PROBE],
+[AC_CACHE_CHECK([for $CC option for timestamps after 2038],
+  [ac_cv_sys_year2038_opts],
+  [ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_opt_found=no
+  for ac_opt in _AC_SYS_YEAR2038_OPTIONS; do
+    AS_IF([test x"$ac_opt" != x"none needed"],
+      [CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_YEAR2038_TEST_CODE])],
+      [ac_cv_sys_year2038_opts="$ac_opt"
+      ac_opt_found=yes])
+    test $ac_opt_found = no || break
+  done
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  test $ac_opt_found = yes || ac_cv_sys_year2038_opts="support not detected"])
+
+ac_have_year2038=yes
+AS_CASE([$ac_cv_sys_year2038_opts],
+  ["none needed"], [],
+  ["support not detected"],
+    [ac_have_year2038=no],
+
+  ["-D_TIME_BITS=64"],
+    [AC_DEFINE([_TIME_BITS], [64],
+      [Number of bits in time_t, on hosts where this is settable.])],
+
+  ["-D__MINGW_USE_VC2005_COMPAT"],
+    [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1],
+      [Define to 1 on platforms where this makes time_t a 64-bit type.])],
+
+  ["-U_USE_32_BIT_TIME_T"*],
+    [AC_MSG_FAILURE(m4_text_wrap(
+      [the 'time_t' type is currently forced to be 32-bit.
+       It will stop working after mid-January 2038.
+       Remove _USE_32BIT_TIME_T from the compiler flags.],
+      [], [], [55]))],
+
+  [AC_MSG_ERROR(
+    [internal error: bad value for \$ac_cv_sys_year2038_opts])])
+])
+
+# _AC_SYS_YEAR2038_ENABLE
+# -----------------------
+# Depending on which of the YEAR2038 macros was used, add either an
+# --enable-year2038 or a --disable-year2038 to
+# the configure script.  This is expanded very late and
+# therefore there cannot be any code in the AC_ARG_ENABLE.  The
+# default value for 'enable_year2038' is emitted unconditionally
+# because the generated code always looks at this variable.
+m4_define([_AC_SYS_YEAR2038_ENABLE],
+[m4_divert_text([DEFAULTS],
+  m4_provide_if([AC_SYS_YEAR2038],
+    [enable_year2038=yes],
+    [enable_year2038=no]))]dnl
+[AC_ARG_ENABLE([year2038],
+  m4_provide_if([AC_SYS_YEAR2038],
+    [AS_HELP_STRING([--disable-year2038],
+      [don't support timestamps after 2038])],
+    [AS_HELP_STRING([--enable-year2038],
+      [support timestamps after 2038])]))])
+
+# AC_SYS_YEAR2038
+# ---------------
+# Attempt to detect and activate support for large time_t.
+# On systems where time_t is not always 64 bits, this probe can be
+# skipped by passing the --disable-year2038 option to configure.
+AC_DEFUN([AC_SYS_YEAR2038],
+[AC_REQUIRE([AC_SYS_LARGEFILE])dnl
+AS_IF([test "$enable_year2038,$ac_have_year2038,$cross_compiling" = yes,no,no],
+ [# If we're not cross compiling and 'touch' works with a large
+  # timestamp, then we can presume the system supports wider time_t
+  # *somehow* and we just weren't able to detect it.  One common
+  # case that we deliberately *don't* probe for is a system that
+  # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers
+  # wide time_t.  (It would be inappropriate for us to override an
+  # intentional use of -m32.)  Error out, demanding use of
+  # --disable-year2038 if this is intentional.
+  AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null],
+    [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`],
+       [*'Feb  7  2106'* | *'Feb  7 17:10'*],
+       [AC_MSG_FAILURE(m4_text_wrap(
+         [this system appears to support timestamps after mid-January 2038,
+          but no mechanism for enabling wide 'time_t' was detected.
+          Did you mean to build a 64-bit binary? (E.g., 'CC="${CC} -m64"'.)
+          To proceed with 32-bit time_t, configure with '--disable-year2038'.],
+         [], [], [55]))])])])])
+
+# AC_SYS_YEAR2038_RECOMMENDED
+# ---------------------------
+# Same as AC_SYS_YEAR2038, but recommend support for large time_t.
+# If we cannot find any way to make time_t capable of representing
+# values larger than 2**31 - 1, error out unless --disable-year2038 is given.
+AC_DEFUN([AC_SYS_YEAR2038_RECOMMENDED],
+[AC_REQUIRE([AC_SYS_YEAR2038])dnl
+AS_IF([test "$enable_year2038,$ac_have_year2038" = yes,no],
+   [AC_MSG_FAILURE(m4_text_wrap(
+      [could not enable timestamps after mid-January 2038.
+       This package recommends support for these later timestamps.
+       However, to proceed with signed 32-bit time_t even though it
+       will fail then, configure with '--disable-year2038'.],
+      [], [], [55]))])])
+
+# _AC_SYS_LARGEFILE_TEST_CODE
+# ---------------------------
+# C code used to probe for large file support.
+m4_define([_AC_SYS_LARGEFILE_TEST_CODE],
+[@%:@include <sys/types.h>
+@%:@ifndef FTYPE
+@%:@ define FTYPE off_t
+@%:@endif
+ /* Check that FTYPE can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_FTYPE to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+@%:@define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31))
+  int FTYPE_is_large[[(LARGE_FTYPE % 2147483629 == 721
+                      && LARGE_FTYPE % 2147483647 == 1)
+                     ? 1 : -1]];[]dnl
+])
+# Defined by Autoconf 2.71 and circa 2022 Gnulib unwisely depended on it.
+m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], [_AC_SYS_LARGEFILE_TEST_CODE])
+
+# _AC_SYS_LARGEFILE_OPTIONS
+# -------------------------
+# List of known ways to enable support for large files.  If you change
+# this list you probably also need to change the AS_CASE at the end of
+# _AC_SYS_LARGEFILE_PROBE.
+m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize(
+    ["none needed"]                   dnl Most current systems
+    ["-D_FILE_OFFSET_BITS=64"]        dnl X/Open LFS spec
+    ["-D_LARGE_FILES=1"]              dnl 32-bit AIX 4.2.1+, 32-bit z/OS
+    ["-n32"]                          dnl 32-bit IRIX 6, SGI cc (obsolete)
+))
+
+# _AC_SYS_LARGEFILE_PROBE
+# -----------------------
+# Subroutine of AC_SYS_LARGEFILE. Probe for large file support and set
+# the cache variable ac_cv_sys_largefile_opts to one of the values in
+# the _AC_SYS_LARGEFILE_OPTIONS list, or to "support not detected" if
+# none of the options in that list worked.  Then, set compilation
+# options and #defines as necessary to enable large file support.
+#
+# If large file support is not detected, the behavior depends on which of
+# the top-level AC_SYS_LARGEFILE macros was used (see below).
+#
+# If you change this macro you may also need to change
+# _AC_SYS_LARGEFILE_OPTIONS.
+AC_DEFUN([_AC_SYS_LARGEFILE_PROBE],
+[AC_CACHE_CHECK([for $CC option to enable large file support],
+  [ac_cv_sys_largefile_opts],
+  [ac_save_CC="$CC"
+  ac_opt_found=no
+  for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do
+    AS_IF([test x"$ac_opt" != x"none needed"],
+      [CC="$ac_save_CC $ac_opt"])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])],
+     [AS_IF([test x"$ac_opt" = x"none needed"],
+       [# GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t.
+        CC="$CC -DFTYPE=ino_t"
+        AC_COMPILE_IFELSE([], [],
+          [CC="$CC -D_FILE_OFFSET_BITS=64"
+           AC_COMPILE_IFELSE([], [ac_opt='-D_FILE_OFFSET_BITS=64'])])])
+      ac_cv_sys_largefile_opts=$ac_opt
+      ac_opt_found=yes])
+    test $ac_opt_found = no || break
+  done
+  CC="$ac_save_CC"
+  dnl Gnulib implements large file support for native Windows, based on the
+  dnl variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE.
+  m4_ifdef([gl_LARGEFILE], [
+    AC_REQUIRE([AC_CANONICAL_HOST])
+    if test $ac_opt_found != yes; then
+      AS_CASE([$host_os],
+        [mingw* | windows*],
+          [ac_cv_sys_largefile_opts="supported through gnulib"
+           ac_opt_found=yes]
+      )
+    fi
+  ])
+  test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"])
+
+ac_have_largefile=yes
+AS_CASE([$ac_cv_sys_largefile_opts],
+  ["none needed"], [],
+  ["supported through gnulib"], [],
+  ["support not detected"],
+    [ac_have_largefile=no],
+
+  ["-D_FILE_OFFSET_BITS=64"],
+    [AC_DEFINE([_FILE_OFFSET_BITS], [64],
+      [Number of bits in a file offset, on hosts where this is settable.])],
+
+  ["-D_LARGE_FILES=1"],
+    [AC_DEFINE([_LARGE_FILES], [1],
+      [Define to 1 on platforms where this makes off_t a 64-bit type.])],
+
+  ["-n32"],
+    [CC="$CC -n32"],
+
+  [AC_MSG_ERROR(
+    [internal error: bad value for \$ac_cv_sys_largefile_opts])])
+
+AS_IF([test "$enable_year2038" != no],
+  [_AC_SYS_YEAR2038_PROBE])
+AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])])
+
+# AC_SYS_LARGEFILE
+# ----------------
+# By default, many hosts won't let programs access large files;
+# one must use special compiler options to get large-file access to work.
+# For more details about this brain damage please see:
+# http://www.unix.org/version2/whatsnew/lfs20mar.html
+# Additionally, on Linux file systems with 64-bit inodes a file that happens
+# to have a 64-bit inode number cannot be accessed by 32-bit applications on
+# Linux x86/x86_64.  This can occur with file systems such as XFS and NFS.
+AC_DEFUN([AC_SYS_LARGEFILE],
+[AC_ARG_ENABLE([largefile],
+   [AS_HELP_STRING([--disable-largefile],
+      [omit support for large files])])dnl
+AS_IF([test "$enable_largefile,$enable_year2038" != no,no],
+  [_AC_SYS_LARGEFILE_PROBE])])
+])# m4_ifndef AC_SYS_YEAR2038_RECOMMENDED
+
+# Enable large files on systems where this is implemented by Gnulib, not by the
+# system headers.
+# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib
+# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively.
+AC_DEFUN([gl_LARGEFILE],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw* | windows*)
+      dnl Native Windows.
+      dnl mingw64 defines off_t to a 64-bit type already, if
+      dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE.
+      AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <sys/types.h>
+                int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
+              ]],
+              [[]])],
+           [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no])
+        ])
+      if test $gl_cv_type_off_t_64 = no; then
+        WINDOWS_64_BIT_OFF_T=1
+      else
+        WINDOWS_64_BIT_OFF_T=0
+      fi
+      dnl Some mingw versions define, if _FILE_OFFSET_BITS=64, 'struct stat'
+      dnl to 'struct _stat32i64' or 'struct _stat64' (depending on
+      dnl _USE_32BIT_TIME_T), which has a 32-bit st_size member.
+      AC_CACHE_CHECK([for 64-bit st_size], [gl_cv_member_st_size_64],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <sys/types.h>
+                struct stat buf;
+                int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1];
+              ]],
+              [[]])],
+           [gl_cv_member_st_size_64=yes], [gl_cv_member_st_size_64=no])
+        ])
+      if test $gl_cv_member_st_size_64 = no; then
+        WINDOWS_64_BIT_ST_SIZE=1
+      else
+        WINDOWS_64_BIT_ST_SIZE=0
+      fi
+      ;;
+    *)
+      dnl Nothing to do on gnulib's side.
+      dnl A 64-bit off_t is
+      dnl   - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX,
+      dnl     OSF/1, Cygwin,
+      dnl   - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
+      dnl     glibc, HP-UX, Solaris,
+      dnl   - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
+      dnl   - impossible to achieve on Minix 3.1.8.
+      WINDOWS_64_BIT_OFF_T=0
+      WINDOWS_64_BIT_ST_SIZE=0
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index babf78aaacef34119fc4a1e053dde37c178de029..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lchmod.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7b263a241eb6f83543734eb2bcfb334c547cb719
--- /dev/null
@@ -0,0 +1,28 @@
+#serial 10
+
+dnl Copyright (C) 2005-2006, 2008-2024 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.
+dnl Provide a replacement for lchmod on hosts that lack a working version.
+
+AC_DEFUN([gl_FUNC_LCHMOD],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+
+  dnl Persuade glibc <sys/stat.h> to declare lchmod().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_FUNCS_ONCE([lchmod])
+  if test "$ac_cv_func_lchmod" = no; then
+    HAVE_LCHMOD=0
+  fi
+])
+
+# Prerequisites of lib/lchmod.c.
+AC_DEFUN([gl_PREREQ_LCHMOD],
+[
+  :
+])
deleted file mode 120000 (symlink)
index fd05774f1db3b8b04bb66e541a807825a534d0f8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lchown.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..91a8c545c54f17df9ff4b8e7c67c4e3b250cfd23
--- /dev/null
@@ -0,0 +1,38 @@
+# serial 17
+# Determine whether we need the lchown wrapper.
+
+dnl Copyright (C) 1998, 2001, 2003-2007, 2009-2024 Free Software Foundation,
+dnl 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, and work around bugs
+dnl on systems that have it.
+
+AC_DEFUN([gl_FUNC_LCHOWN],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_CHOWN])
+  AC_CHECK_FUNCS_ONCE([lchmod])
+  AC_CHECK_FUNCS([lchown])
+  if test $ac_cv_func_lchown = no; then
+    HAVE_LCHOWN=0
+  else
+    dnl Trailing slash and ctime bugs in chown also occur in lchown.
+    case "$gl_cv_func_chown_slash_works" in
+      *yes) ;;
+      *)
+        REPLACE_LCHOWN=1
+        ;;
+    esac
+    case "$gl_cv_func_chown_ctime_works" in
+      *yes) ;;
+      *)
+        REPLACE_LCHOWN=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index df6cff97511ffb22f721165477b6c0f09712f726..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lcmessage.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7f4646cd7dc9ce000e933f356aac791da416ccdd
--- /dev/null
@@ -0,0 +1,35 @@
+# lcmessage.m4 serial 8
+dnl Copyright (C) 1995-2002, 2004-2005, 2008-2014, 2016, 2019-2024 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
+dnl This file can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Lesser General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Lesser General Public License, and the rest of the GNU
+dnl gettext package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+
+AC_DEFUN([gt_LC_MESSAGES],
+[
+  AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <locale.h>]],
+          [[return LC_MESSAGES]])],
+       [gt_cv_val_LC_MESSAGES=yes],
+       [gt_cv_val_LC_MESSAGES=no])])
+  if test $gt_cv_val_LC_MESSAGES = yes; then
+    AC_DEFINE([HAVE_LC_MESSAGES], [1],
+      [Define if your <locale.h> file defines LC_MESSAGES.])
+  fi
+])
deleted file mode 120000 (symlink)
index 5fe7f16d13fcd1aa8532c0910e3b4a1c7ccc63b5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/ldexpl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7e7a4addb188a6a800ada36f5127f5ee4e057a7c
--- /dev/null
@@ -0,0 +1,135 @@
+# ldexpl.m4 serial 18
+dnl Copyright (C) 2007-2024 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_LDEXPL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+  AC_REQUIRE([gl_FUNC_ISNANL]) dnl for ISNANL_LIBM
+
+  dnl Persuade glibc <math.h> to declare ldexpl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl Check whether it's declared.
+  dnl Mac OS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>.
+  AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [[#include <math.h>]])
+
+  LDEXPL_LIBM=
+  if test $HAVE_DECL_LDEXPL = 1; then
+    gl_CHECK_LDEXPL_NO_LIBM
+    if test $gl_cv_func_ldexpl_no_libm = no; then
+      AC_CACHE_CHECK([whether ldexpl() can be used with libm],
+        [gl_cv_func_ldexpl_in_libm],
+        [
+          save_LIBS="$LIBS"
+          LIBS="$LIBS -lm"
+          AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM(
+               [[#include <math.h>
+                 long double x;]],
+               [[return ldexpl (x, -1) > 0;]])],
+            [gl_cv_func_ldexpl_in_libm=yes],
+            [gl_cv_func_ldexpl_in_libm=no])
+          LIBS="$save_LIBS"
+        ])
+      if test $gl_cv_func_ldexpl_in_libm = yes; then
+        LDEXPL_LIBM=-lm
+      fi
+    fi
+    if test $gl_cv_func_ldexpl_no_libm = yes \
+       || test $gl_cv_func_ldexpl_in_libm = yes; then
+      save_LIBS="$LIBS"
+      LIBS="$LIBS $LDEXPL_LIBM"
+      gl_FUNC_LDEXPL_WORKS
+      LIBS="$save_LIBS"
+      case "$gl_cv_func_ldexpl_works" in
+        *yes) gl_func_ldexpl=yes ;;
+        *)    gl_func_ldexpl=no; REPLACE_LDEXPL=1 ;;
+      esac
+    else
+      gl_func_ldexpl=no
+    fi
+    if test $gl_func_ldexpl = yes; then
+      AC_DEFINE([HAVE_LDEXPL], [1],
+        [Define if the ldexpl() function is available.])
+    fi
+  fi
+  if test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; then
+    dnl Find libraries needed to link lib/ldexpl.c.
+    if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
+      AC_REQUIRE([gl_FUNC_LDEXP])
+      LDEXPL_LIBM="$LDEXP_LIBM"
+    else
+      LDEXPL_LIBM="$ISNANL_LIBM"
+    fi
+  fi
+  AC_SUBST([LDEXPL_LIBM])
+])
+
+dnl Test whether ldexpl() can be used without linking with libm.
+dnl Set gl_cv_func_ldexpl_no_libm to 'yes' or 'no' accordingly.
+AC_DEFUN([gl_CHECK_LDEXPL_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether ldexpl() can be used without linking with libm],
+    [gl_cv_func_ldexpl_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             long double x;]],
+           [[return ldexpl (x, -1) > 0;]])],
+        [gl_cv_func_ldexpl_no_libm=yes],
+        [gl_cv_func_ldexpl_no_libm=no])
+    ])
+])
+
+dnl Test whether ldexpl() works on finite numbers (this fails on AIX 5.1
+dnl and Mac OS X 10.4/PowerPC).
+AC_DEFUN([gl_FUNC_LDEXPL_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether ldexpl works], [gl_cv_func_ldexpl_works],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <math.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+long double ldexpl (long double, int);
+int main()
+{
+  int result = 0;
+  {
+    volatile long double x = 1.0;
+    volatile long double y = ldexpl (x, -1);
+    if (y != 0.5L)
+      result |= 1;
+  }
+  {
+    volatile long double x = 1.73205L;
+    volatile long double y = ldexpl (x, 0);
+    if (y != x)
+      result |= 2;
+  }
+  return result;
+}]])],
+        [gl_cv_func_ldexpl_works=yes],
+        [gl_cv_func_ldexpl_works=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+           aix | aix[3-6]*)   gl_cv_func_ldexpl_works="guessing no" ;;
+                              # Guess yes on native Windows.
+           mingw* | windows*) gl_cv_func_ldexpl_works="guessing yes" ;;
+           *)                 gl_cv_func_ldexpl_works="guessing yes" ;;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
deleted file mode 120000 (symlink)
index 7b339243f8ed2948e9699186fe92796f98a5d284..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lib-ignore.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..431b7e7472ef4eaed3cfc862952a80b88da52a52
--- /dev/null
@@ -0,0 +1,115 @@
+# If possible, ignore libraries that are not depended on.
+
+dnl Copyright (C) 2006, 2009-2024 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.
+
+# gl_IGNORE_UNUSED_LIBRARIES
+# --------------------------
+# Determines the option to be passed to the C/C++/Fortran compiler, so that it
+# omits unused libraries.
+# Example (on Solaris):
+# $ cc foo.c -lnsl; ldd ./a.out
+#         libnsl.so.1 =>   /lib/libnsl.so.1
+#         libc.so.1 =>     /lib/libc.so.1
+#         libmp.so.2 =>    /lib/libmp.so.2
+#         libmd.so.1 =>    /lib/libmd.so.1
+#         libscf.so.1 =>   /lib/libscf.so.1
+#         libdoor.so.1 =>  /lib/libdoor.so.1
+#         libuutil.so.1 =>         /lib/libuutil.so.1
+#         libgen.so.1 =>   /lib/libgen.so.1
+#         libm.so.2 =>     /lib/libm.so.2
+# $ cc foo.c -lnsl -Wl,-z,ignore; ldd ./a.out
+#         libc.so.1 =>     /lib/libc.so.1
+#         libm.so.2 =>     /lib/libm.so.2
+#
+# Note that the option works only for the C compiler, not for the C++
+# compiler:
+# - Sun C likes '-Wl,-z,ignore'.
+#   '-Qoption ld -z,ignore' is not accepted.
+#   '-z ignore' is accepted but has no effect.
+# - Sun C++ and Sun Fortran like '-Qoption ld -z,ignore'.
+#   '-Wl,-z,ignore' is not accepted.
+#   '-z ignore' is accepted but has no effect.
+#
+# Sets and substitutes a variable that depends on the current language:
+# - IGNORE_UNUSED_LIBRARIES_CFLAGS    for C
+# - IGNORE_UNUSED_LIBRARIES_CXXFLAGS  for C++
+# - IGNORE_UNUSED_LIBRARIES_FFLAGS    for Fortran
+#
+# Note that the option works only for direct invocation of the compiler, not
+# through libtool: When libtool is used to create a shared library, it will
+# honor and translate '-Wl,-z,ignore' to '-Qoption ld -z -Qoption ld ignore'
+# if needed, but it will drop a '-Qoption ld -z,ignore' on the command line.
+#
+AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES],
+[
+  AC_CACHE_CHECK([for []_AC_LANG[] compiler flag to ignore unused libraries],
+    [gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries],
+    [gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries=none
+     gl_saved_ldflags=$LDFLAGS
+     gl_saved_libs=$LIBS
+     # Link with -lm to detect binutils 2.16 bug with --as-needed; see
+     # <https://lists.gnu.org/r/bug-gnulib/2006-06/msg00131.html>.
+     LIBS="$LIBS -lm"
+     # Use long option sequences like '-z ignore' to test for the feature,
+     # to forestall problems with linkers that have -z, -i, -g, -n, etc. flags.
+     # GCC + binutils likes '-Wl,--as-needed'.
+     # GCC + Solaris ld likes '-Wl,-z,ignore'.
+     # Sun C likes '-Wl,-z,ignore'. '-z ignore' is accepted but has no effect.
+     # Don't try bare '--as-needed'; nothing likes it and the HP-UX 11.11
+     # native cc issues annoying warnings and then ignores it,
+     # which would cause us to incorrectly conclude that it worked.
+     for gl_flags in _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS
+     do
+       LDFLAGS="$gl_flags $LDFLAGS"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+         [gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries=$gl_flags])
+       LDFLAGS=$gl_saved_ldflags
+       test "$gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries" != none &&
+         break
+     done
+     LIBS=$gl_saved_libs
+    ])
+  IGNORE_UNUSED_LIBRARIES_[]_AC_LANG_PREFIX[]FLAGS=
+  if test "$gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries" != none; then
+    IGNORE_UNUSED_LIBRARIES_[]_AC_LANG_PREFIX[]FLAGS="$gl_cv_prog_[]_AC_LANG_ABBREV[]_ignore_unused_libraries"
+  fi
+  AC_SUBST([IGNORE_UNUSED_LIBRARIES_]_AC_LANG_PREFIX[FLAGS])
+])
+
+# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS
+# -----------------------------------
+# Expands to the language dependent options to be tried.
+AC_DEFUN([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C)
+# --------------------------------------
+m4_define([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C)],
+[ '-Wl,--as-needed' \
+  '-Wl,-z,ignore' \
+  '-z ignore'
+])
+
+# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C++)
+# ----------------------------------------
+m4_define([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C++)],
+[ '-Wl,--as-needed' \
+  '-Qoption ld -z,ignore' \
+  '-Wl,-z,ignore' \
+  '-z ignore'
+])
+
+# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran 77)
+# -----------------------------------------------
+m4_copy([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(C++)],
+        [_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran 77)])
+
+# _gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran)
+# --------------------------------------------
+m4_copy([_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran 77)],
+        [_gl_IGNORE_UNUSED_LIBRARIES_OPTIONS(Fortran)])
deleted file mode 120000 (symlink)
index 2e13ced16fac8de78cfe85a5c82e9ec83a374749..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lib-ld.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f0793329da12df72151ad927b6f851c812049b34
--- /dev/null
@@ -0,0 +1,168 @@
+# lib-ld.m4 serial 12
+dnl Copyright (C) 1996-2003, 2009-2024 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 Subroutines of libtool.m4,
+dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
+dnl collision with libtool.m4.
+
+dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  acl_cv_prog_gnu_ld=yes
+  ;;
+*)
+  acl_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-2.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([[--with-gnu-ld]],
+        [assume the C compiler uses GNU ld [default=no]])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+if test -n "$LD"; then
+  AC_MSG_CHECKING([for ld])
+elif test "$GCC" = yes; then
+  AC_MSG_CHECKING([for ld used by $CC])
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+if test -n "$LD"; then
+  # Let the user override the test with a path.
+  :
+else
+  AC_CACHE_VAL([acl_cv_path_LD],
+  [
+    acl_cv_path_LD= # Final result of this test
+    ac_prog=ld # Program to search in $PATH
+    if test "$GCC" = yes; then
+      # Check if gcc -print-prog-name=ld gives a path.
+      case $host in
+        *-*-mingw* | windows*)
+          # gcc leaves a trailing carriage return which upsets mingw
+          acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+        *)
+          acl_output=`($CC -print-prog-name=ld) 2>&5` ;;
+      esac
+      case $acl_output in
+        # Accept absolute paths.
+        [[\\/]]* | ?:[[\\/]]*)
+          re_direlt='/[[^/]][[^/]]*/\.\./'
+          # Canonicalize the pathname of ld
+          acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'`
+          while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do
+            acl_output=`echo $acl_output | sed "s%$re_direlt%/%"`
+          done
+          # Got the pathname. No search in PATH is needed.
+          acl_cv_path_LD="$acl_output"
+          ac_prog=
+          ;;
+        "")
+          # If it fails, then pretend we aren't using GCC.
+          ;;
+        *)
+          # If it is relative, then search for the first ld in PATH.
+          with_gnu_ld=unknown
+          ;;
+      esac
+    fi
+    if test -n "$ac_prog"; then
+      # Search for $ac_prog in $PATH.
+      acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+      for ac_dir in $PATH; do
+        IFS="$acl_save_ifs"
+        test -z "$ac_dir" && ac_dir=.
+        if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+          acl_cv_path_LD="$ac_dir/$ac_prog"
+          # Check to see if the program is GNU ld.  I'd rather use --version,
+          # but apparently some variants of GNU ld only accept -v.
+          # Break only if it was the GNU/non-GNU ld that we prefer.
+          case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
+            *GNU* | *'with BFD'*)
+              test "$with_gnu_ld" != no && break
+              ;;
+            *)
+              test "$with_gnu_ld" != yes && break
+              ;;
+          esac
+        fi
+      done
+      IFS="$acl_save_ifs"
+    fi
+    case $host in
+      *-*-aix*)
+        AC_COMPILE_IFELSE(
+          [AC_LANG_SOURCE(
+             [[#if defined __powerpc64__ || defined __LP64__
+                int ok;
+               #else
+                error fail
+               #endif
+             ]])],
+          [# The compiler produces 64-bit code. Add option '-b64' so that the
+           # linker groks 64-bit object files.
+           case "$acl_cv_path_LD " in
+             *" -b64 "*) ;;
+             *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;;
+           esac
+          ], [])
+        ;;
+      sparc64-*-netbsd*)
+        AC_COMPILE_IFELSE(
+          [AC_LANG_SOURCE(
+             [[#if defined __sparcv9 || defined __arch64__
+                int ok;
+               #else
+                error fail
+               #endif
+             ]])],
+          [],
+          [# The compiler produces 32-bit code. Add option '-m elf32_sparc'
+           # so that the linker groks 32-bit object files.
+           case "$acl_cv_path_LD " in
+             *" -m elf32_sparc "*) ;;
+             *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;;
+           esac
+          ])
+        ;;
+    esac
+  ])
+  LD="$acl_cv_path_LD"
+fi
+if test -n "$LD"; then
+  AC_MSG_RESULT([$LD])
+else
+  AC_MSG_RESULT([no])
+  AC_MSG_ERROR([no acceptable ld found in \$PATH])
+fi
+AC_LIB_PROG_LD_GNU
+])
deleted file mode 120000 (symlink)
index 2bd4d9da1d800fbb460700bed7d433cfafabe87f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lib-link.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d91ecb3ae16f9cbcf3143804a6f3737415161e56
--- /dev/null
@@ -0,0 +1,813 @@
+# lib-link.m4 serial 33
+dnl Copyright (C) 2001-2024 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 Bruno Haible.
+
+AC_PREREQ([2.61])
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  pushdef([Name],[m4_translit([$1],[./+-], [____])])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+    AC_LIB_LINKFLAGS_BODY([$1], [$2])
+    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
+  ])
+  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  AC_SUBST([LIB]NAME[_PREFIX])
+  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+  dnl results of this search when this library appears as a dependency.
+  HAVE_LIB[]NAME=yes
+  popdef([NAME])
+  popdef([Name])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. The missing-message
+dnl defaults to 'no' and may contain additional hints for the user.
+dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
+dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  pushdef([Name],[m4_translit([$1],[./+-], [____])])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+
+  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed lib[]Name and not disabled its use
+  dnl via --without-lib[]Name-prefix, he wants to use it.
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+    ac_save_LIBS="$LIBS"
+    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
+    dnl because these -l options might require -L options that are present in
+    dnl LIBS. -l options benefit only from the -L options listed before it.
+    dnl Otherwise, add it to the front of LIBS, because it may be a static
+    dnl library that depends on another static library that is present in LIBS.
+    dnl Static libraries benefit only from the static libraries listed after
+    dnl it.
+    case " $LIB[]NAME" in
+      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
+      *)       LIBS="$LIB[]NAME $LIBS" ;;
+    esac
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[$3]], [[$4]])],
+      [ac_cv_lib[]Name=yes],
+      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
+    LIBS="$ac_save_LIBS"
+  ])
+  if test "$ac_cv_lib[]Name" = yes; then
+    HAVE_LIB[]NAME=yes
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
+    AC_MSG_CHECKING([how to link with lib[]$1])
+    AC_MSG_RESULT([$LIB[]NAME])
+  else
+    HAVE_LIB[]NAME=no
+    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+    dnl $INC[]NAME either.
+    CPPFLAGS="$ac_save_CPPFLAGS"
+    LIB[]NAME=
+    LTLIB[]NAME=
+    LIB[]NAME[]_PREFIX=
+  fi
+  AC_SUBST([HAVE_LIB]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  AC_SUBST([LIB]NAME[_PREFIX])
+  popdef([NAME])
+  popdef([Name])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl   acl_libext,
+dnl   acl_shlibext,
+dnl   acl_libname_spec,
+dnl   acl_library_names_spec,
+dnl   acl_hardcode_libdir_flag_spec,
+dnl   acl_hardcode_libdir_separator,
+dnl   acl_hardcode_direct,
+dnl   acl_hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+  dnl Complain if config.rpath is missing.
+  AC_REQUIRE_AUX_FILE([config.rpath])
+  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
+  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
+  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
+  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
+  ])
+  wl="$acl_cv_wl"
+  acl_libext="$acl_cv_libext"
+  acl_shlibext="$acl_cv_shlibext"
+  acl_libname_spec="$acl_cv_libname_spec"
+  acl_library_names_spec="$acl_cv_library_names_spec"
+  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  acl_hardcode_direct="$acl_cv_hardcode_direct"
+  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
+  dnl Determine whether the user wants rpath handling at all.
+  AC_ARG_ENABLE([rpath],
+    [  --disable-rpath         do not hardcode runtime library paths],
+    :, enable_rpath=yes)
+])
+
+dnl AC_LIB_FROMPACKAGE(name, package)
+dnl declares that libname comes from the given package. The configure file
+dnl will then not have a --with-libname-prefix option but a
+dnl --with-package-prefix option. Several libraries can come from the same
+dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
+dnl macro call that searches for libname.
+AC_DEFUN([AC_LIB_FROMPACKAGE],
+[
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  define([acl_frompackage_]NAME, [$2])
+  popdef([NAME])
+  pushdef([PACK],[$2])
+  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  define([acl_libsinpackage_]PACKUP,
+    m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
+  popdef([PACKUP])
+  popdef([PACK])
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
+  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+    eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
+    eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
+  ])
+  AC_ARG_WITH(PACK[-prefix],
+[[  --with-]]PACK[[-prefix[=DIR]  search for ]]PACKLIBS[[ in DIR/include and DIR/lib
+  --without-]]PACK[[-prefix     don't search for ]]PACKLIBS[[ in includedir and libdir]],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+          eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
+          eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+        additional_libdir2="$withval/$acl_libdirstem2"
+        additional_libdir3="$withval/$acl_libdirstem3"
+      fi
+    fi
+])
+  if test "X$additional_libdir2" = "X$additional_libdir"; then
+    additional_libdir2=
+  fi
+  if test "X$additional_libdir3" = "X$additional_libdir"; then
+    additional_libdir3=
+  fi
+  dnl Search the library and its dependencies in $additional_libdir and
+  dnl $LDFLAGS. Use breadth-first search.
+  LIB[]NAME=
+  LTLIB[]NAME=
+  INC[]NAME=
+  LIB[]NAME[]_PREFIX=
+  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+  dnl computed. So it has to be reset here.
+  HAVE_LIB[]NAME=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='$1 $2'
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+        dnl or AC_LIB_HAVE_LINKFLAGS call.
+        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+          else
+            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+            dnl that this library doesn't exist. So just drop it.
+            :
+          fi
+        else
+          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+          dnl and the already constructed $LIBNAME/$LTLIBNAME.
+          found_dir=
+          found_la=
+          found_so=
+          found_a=
+          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
+          if test -n "$acl_shlibext"; then
+            shrext=".$acl_shlibext"             # typically: shrext=.so
+          else
+            shrext=
+          fi
+          if test $use_additional = yes; then
+            for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do
+              if test "X$found_dir" = "X"; then
+                eval dir=\$$additional_libdir_variable
+                if test -n "$dir"; then
+                  dnl The same code as in the loop below:
+                  dnl First look for a shared library.
+                  if test -n "$acl_shlibext"; then
+                    if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
+                      found_dir="$dir"
+                      found_so="$dir/$libname$shrext"
+                    else
+                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                        ver=`(cd "$dir" && \
+                              for f in "$libname$shrext".*; do echo "$f"; done \
+                              | sed -e "s,^$libname$shrext\\\\.,," \
+                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                              | sed 1q ) 2>/dev/null`
+                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
+                          found_dir="$dir"
+                          found_so="$dir/$libname$shrext.$ver"
+                        fi
+                      else
+                        eval library_names=\"$acl_library_names_spec\"
+                        for f in $library_names; do
+                          if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
+                            found_dir="$dir"
+                            found_so="$dir/$f"
+                            break
+                          fi
+                        done
+                      fi
+                    fi
+                  fi
+                  dnl Then look for a static library.
+                  if test "X$found_dir" = "X"; then
+                    if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
+                      found_dir="$dir"
+                      found_a="$dir/$libname.$acl_libext"
+                    fi
+                  fi
+                  if test "X$found_dir" != "X"; then
+                    if test -f "$dir/$libname.la"; then
+                      found_la="$dir/$libname.la"
+                    fi
+                  fi
+                fi
+              fi
+            done
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIB[]NAME; do
+              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                  dnl First look for a shared library.
+                  if test -n "$acl_shlibext"; then
+                    if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
+                      found_dir="$dir"
+                      found_so="$dir/$libname$shrext"
+                    else
+                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                        ver=`(cd "$dir" && \
+                              for f in "$libname$shrext".*; do echo "$f"; done \
+                              | sed -e "s,^$libname$shrext\\\\.,," \
+                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                              | sed 1q ) 2>/dev/null`
+                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
+                          found_dir="$dir"
+                          found_so="$dir/$libname$shrext.$ver"
+                        fi
+                      else
+                        eval library_names=\"$acl_library_names_spec\"
+                        for f in $library_names; do
+                          if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
+                            found_dir="$dir"
+                            found_so="$dir/$f"
+                            break
+                          fi
+                        done
+                      fi
+                    fi
+                  fi
+                  dnl Then look for a static library.
+                  if test "X$found_dir" = "X"; then
+                    if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
+                      found_dir="$dir"
+                      found_a="$dir/$libname.$acl_libext"
+                    fi
+                  fi
+                  if test "X$found_dir" != "X"; then
+                    if test -f "$dir/$libname.la"; then
+                      found_la="$dir/$libname.la"
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+            dnl Found the library.
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+              dnl Linking with a shared library. We attempt to hardcode its
+              dnl directory into the executable's runpath, unless it's the
+              dnl standard /usr/lib.
+              if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then
+                dnl No hardcoding is needed.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+              else
+                dnl Use an explicit option to hardcode DIR into the resulting
+                dnl binary.
+                dnl Potentially add DIR to ltrpathdirs.
+                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                dnl The hardcoding into $LIBNAME is system dependent.
+                if test "$acl_hardcode_direct" = yes; then
+                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+                  dnl resulting binary.
+                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                else
+                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+                    dnl Use an explicit option to hardcode DIR into the resulting
+                    dnl binary.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    dnl Potentially add DIR to rpathdirs.
+                    dnl The rpathdirs will be appended to $LIBNAME at the end.
+                    haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                    dnl Rely on "-L$found_dir".
+                    dnl But don't add it if it's already contained in the LDFLAGS
+                    dnl or the already constructed $LIBNAME
+                    haveit=
+                    for x in $LDFLAGS $LIB[]NAME; do
+                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+                    fi
+                    if test "$acl_hardcode_minus_L" != no; then
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    else
+                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
+                      dnl here, because this doesn't fit in flags passed to the
+                      dnl compiler. So give up. No hardcoding. This affects only
+                      dnl very old systems.
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                dnl Linking with a static library.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+              else
+                dnl We shouldn't come here, but anyway it's good to have a
+                dnl fallback.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+              fi
+            fi
+            dnl Assume the include files are nearby.
+            additional_includedir=
+            case "$found_dir" in
+              */$acl_libdirstem | */$acl_libdirstem/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+              */$acl_libdirstem3 | */$acl_libdirstem3/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+              dnl Potentially add $additional_includedir to $INCNAME.
+              dnl But don't add it
+              dnl   1. if it's the standard /usr/include,
+              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
+              dnl   3. if it's already present in $CPPFLAGS or the already
+              dnl      constructed $INCNAME,
+              dnl   4. if it doesn't exist as a directory.
+              if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INC[]NAME; do
+                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                      dnl Really add $additional_includedir to $INCNAME.
+                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+            dnl Look for dependencies.
+            if test -n "$found_la"; then
+              dnl Read the .la file. It defines the variables
+              dnl dlname, library_names, old_library, dependency_libs, current,
+              dnl age, revision, installed, dlopen, dlpreopen, libdir.
+              save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+              dnl We use only dependency_libs.
+              for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                    dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME.
+                    dnl But don't add it
+                    dnl   1. if it's the standard /usr/lib,
+                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
+                    dnl   3. if it's already present in $LDFLAGS or the already
+                    dnl      constructed $LIBNAME,
+                    dnl   4. if it doesn't exist as a directory.
+                    if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \
+                       && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then
+                      haveit=
+                      if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \
+                         || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$dependency_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$dependency_libdir"; then
+                            dnl Really add $dependency_libdir to $LIBNAME.
+                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$dependency_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$dependency_libdir"; then
+                            dnl Really add $dependency_libdir to $LTLIBNAME.
+                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                      dnl Potentially add DIR to rpathdirs.
+                      dnl The rpathdirs will be appended to $LIBNAME at the end.
+                      haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                      dnl Potentially add DIR to ltrpathdirs.
+                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                      haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                    dnl Handle this in the next round.
+                    dnl But on GNU systems, ignore -lc options, because
+                    dnl   - linking with libc is the default anyway,
+                    dnl   - linking with libc.a may produce an error
+                    dnl     "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie"
+                    dnl     or may produce an executable that always crashes, see
+                    dnl     <https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00052.html>.
+                    dep=`echo "X$dep" | sed -e 's/^X-l//'`
+                    if test "X$dep" != Xc \
+                       || case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) false ;;
+                            *)                          true ;;
+                          esac; then
+                      names_next_round="$names_next_round $dep"
+                    fi
+                    ;;
+                  *.la)
+                    dnl Handle this in the next round. Throw away the .la's
+                    dnl directory; it is already contained in a preceding -L
+                    dnl option.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                    dnl Most likely an immediate library name.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+            dnl Didn't find the library; assume it is in the system directories
+            dnl known to the linker and runtime loader. (All the system
+            dnl directories known to the linker should also be known to the
+            dnl runtime loader, otherwise the system is severely misconfigured.)
+            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$acl_hardcode_libdir_separator"; then
+      dnl Weird platform: only the last -rpath option counts, the user must
+      dnl pass all path elements in one option. We can arrange that for a
+      dnl single library, but not when more than one $LIBNAMEs are used.
+      alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+      done
+      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
+      acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$acl_hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+    else
+      dnl The -rpath options are cumulative.
+      for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$acl_hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+    dnl When using libtool, the option that works for both libraries and
+    dnl executables is -R. The -R options are cumulative.
+    for found_dir in $ltrpathdirs; do
+      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+    done
+  fi
+  popdef([PACKLIBS])
+  popdef([PACKUP])
+  popdef([PACK])
+  popdef([NAME])
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+  for element in [$2]; do
+    haveit=
+    for x in $[$1]; do
+      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      [$1]="${[$1]}${[$1]:+ }$element"
+    fi
+  done
+])
+
+dnl For those cases where a variable contains several -L and -l options
+dnl referring to unknown libraries and directories, this macro determines the
+dnl necessary additional linker options for the runtime path.
+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
+dnl otherwise linking without libtool is assumed.
+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
+[
+  AC_REQUIRE([AC_LIB_RPATH])
+  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+  $1=
+  if test "$enable_rpath" != no; then
+    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+      dnl Use an explicit option to hardcode directories into the resulting
+      dnl binary.
+      rpathdirs=
+      next=
+      for opt in $2; do
+        if test -n "$next"; then
+          dir="$next"
+          dnl No need to hardcode the standard /usr/lib.
+          if test "X$dir" != "X/usr/$acl_libdirstem" \
+             && test "X$dir" != "X/usr/$acl_libdirstem2" \
+             && test "X$dir" != "X/usr/$acl_libdirstem3"; then
+            rpathdirs="$rpathdirs $dir"
+          fi
+          next=
+        else
+          case $opt in
+            -L) next=yes ;;
+            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
+                 dnl No need to hardcode the standard /usr/lib.
+                 if test "X$dir" != "X/usr/$acl_libdirstem" \
+                    && test "X$dir" != "X/usr/$acl_libdirstem2" \
+                    && test "X$dir" != "X/usr/$acl_libdirstem3"; then
+                   rpathdirs="$rpathdirs $dir"
+                 fi
+                 next= ;;
+            *) next= ;;
+          esac
+        fi
+      done
+      if test "X$rpathdirs" != "X"; then
+        if test -n ""$3""; then
+          dnl libtool is used for linking. Use -R options.
+          for dir in $rpathdirs; do
+            $1="${$1}${$1:+ }-R$dir"
+          done
+        else
+          dnl The linker is used for linking directly.
+          if test -n "$acl_hardcode_libdir_separator"; then
+            dnl Weird platform: only the last -rpath option counts, the user
+            dnl must pass all path elements in one option.
+            alldirs=
+            for dir in $rpathdirs; do
+              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
+            done
+            acl_save_libdir="$libdir"
+            libdir="$alldirs"
+            eval flag=\"$acl_hardcode_libdir_flag_spec\"
+            libdir="$acl_save_libdir"
+            $1="$flag"
+          else
+            dnl The -rpath options are cumulative.
+            for dir in $rpathdirs; do
+              acl_save_libdir="$libdir"
+              libdir="$dir"
+              eval flag=\"$acl_hardcode_libdir_flag_spec\"
+              libdir="$acl_save_libdir"
+              $1="${$1}${$1:+ }$flag"
+            done
+          fi
+        fi
+      fi
+    fi
+  fi
+  AC_SUBST([$1])
+])
deleted file mode 120000 (symlink)
index 48c5da5e0dbdf4cb35f8263fdfc629071bf22170..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lib-prefix.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d597553b580e5990e05f972ef0b9bc94e7d3f15b
--- /dev/null
@@ -0,0 +1,323 @@
+# lib-prefix.m4 serial 20
+dnl Copyright (C) 2001-2005, 2008-2024 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 Bruno Haible.
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_ARG_WITH([lib-prefix],
+[[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+  --without-lib-prefix    don't search for libraries in includedir and libdir]],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+      fi
+    fi
+])
+  if test $use_additional = yes; then
+    dnl Potentially add $additional_includedir to $CPPFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/include,
+    dnl   2. if it's already present in $CPPFLAGS,
+    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_includedir" != "X/usr/include"; then
+      haveit=
+      for x in $CPPFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-I$additional_includedir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_includedir" = "X/usr/local/include"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_includedir"; then
+            dnl Really add $additional_includedir to $CPPFLAGS.
+            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+          fi
+        fi
+      fi
+    fi
+    dnl Potentially add $additional_libdir to $LDFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/lib,
+    dnl   2. if it's already present in $LDFLAGS,
+    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+      haveit=
+      for x in $LDFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-L$additional_libdir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux*) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_libdir"; then
+            dnl Really add $additional_libdir to $LDFLAGS.
+            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+          fi
+        fi
+      fi
+    fi
+  fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+  dnl Unfortunately, prefix and exec_prefix get only finally determined
+  dnl at the end of configure.
+  if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
+  else
+    acl_final_prefix="$prefix"
+  fi
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  $1
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_PREPARE_MULTILIB creates
+dnl - a function acl_is_expected_elfclass, that tests whether standard input
+dn;   has a 32-bit or 64-bit ELF header, depending on the host CPU ABI,
+dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing
+dnl   the basename of the libdir to try in turn, either "lib" or "lib64" or
+dnl   "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar.
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+[
+  dnl There is no formal standard regarding lib, lib32, and lib64.
+  dnl On most glibc systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on
+  dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go
+  dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib.
+  dnl We determine the compiler's default mode by looking at the compiler's
+  dnl library search path. If at least one of its elements ends in /lib64 or
+  dnl points to a directory whose absolute pathname ends in /lib64, we use that
+  dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default,
+  dnl namely "lib".
+  dnl On Solaris systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
+  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT])
+
+  AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf],
+    [AC_EGREP_CPP([Extensible Linking Format],
+       [#if defined __ELF__ || (defined __linux__ && defined __EDG__)
+        Extensible Linking Format
+        #endif
+       ],
+       [gl_cv_elf=yes],
+       [gl_cv_elf=no])
+    ])
+  if test $gl_cv_elf = yes; then
+    # Extract the ELF class of a file (5th byte) in decimal.
+    # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
+    if od -A x < /dev/null >/dev/null 2>/dev/null; then
+      # Use POSIX od.
+      func_elfclass ()
+      {
+        od -A n -t d1 -j 4 -N 1
+      }
+    else
+      # Use BSD hexdump.
+      func_elfclass ()
+      {
+        dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "'
+        echo
+      }
+    fi
+    # Use 'expr', not 'test', to compare the values of func_elfclass, because on
+    # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002,
+    # not 1 or 2.
+changequote(,)dnl
+    case $HOST_CPU_C_ABI_32BIT in
+      yes)
+        # 32-bit ABI.
+        acl_is_expected_elfclass ()
+        {
+          expr "`func_elfclass | sed -e 's/[   ]//g'`" = 1 > /dev/null
+        }
+        ;;
+      no)
+        # 64-bit ABI.
+        acl_is_expected_elfclass ()
+        {
+          expr "`func_elfclass | sed -e 's/[   ]//g'`" = 2 > /dev/null
+        }
+        ;;
+      *)
+        # Unknown.
+        acl_is_expected_elfclass ()
+        {
+          :
+        }
+        ;;
+    esac
+changequote([,])dnl
+  else
+    acl_is_expected_elfclass ()
+    {
+      :
+    }
+  fi
+
+  dnl Allow the user to override the result by setting acl_cv_libdirstems.
+  AC_CACHE_CHECK([for the common suffixes of directories in the library search path],
+    [acl_cv_libdirstems],
+    [dnl Try 'lib' first, because that's the default for libdir in GNU, see
+     dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>.
+     acl_libdirstem=lib
+     acl_libdirstem2=
+     acl_libdirstem3=
+     case "$host_os" in
+       solaris*)
+         dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
+         dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>.
+         dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
+         dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
+         dnl symlink is missing, so we set acl_libdirstem2 too.
+         if test $HOST_CPU_C_ABI_32BIT = no; then
+           acl_libdirstem2=lib/64
+           case "$host_cpu" in
+             sparc*)        acl_libdirstem3=lib/sparcv9 ;;
+             i*86 | x86_64) acl_libdirstem3=lib/amd64 ;;
+           esac
+         fi
+         ;;
+       *)
+         dnl If $CC generates code for a 32-bit ABI, the libraries are
+         dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64.
+         dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries
+         dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32.
+         dnl Find the compiler's search path. However, non-system compilers
+         dnl sometimes have odd library search paths. But we can't simply invoke
+         dnl '/usr/bin/gcc -print-search-dirs' because that would not take into
+         dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS.
+         searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \
+                     | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+         if test $HOST_CPU_C_ABI_32BIT != no; then
+           # 32-bit or unknown ABI.
+           if test -d /usr/lib32; then
+             acl_libdirstem2=lib32
+           fi
+         fi
+         if test $HOST_CPU_C_ABI_32BIT != yes; then
+           # 64-bit or unknown ABI.
+           if test -d /usr/lib64; then
+             acl_libdirstem3=lib64
+           fi
+         fi
+         if test -n "$searchpath"; then
+           acl_save_IFS="${IFS=        }"; IFS=":"
+           for searchdir in $searchpath; do
+             if test -d "$searchdir"; then
+               case "$searchdir" in
+                 */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;;
+                 */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;;
+                 */../ | */.. )
+                   # Better ignore directories of this form. They are misleading.
+                   ;;
+                 *) searchdir=`cd "$searchdir" && pwd`
+                    case "$searchdir" in
+                      */lib32 ) acl_libdirstem2=lib32 ;;
+                      */lib64 ) acl_libdirstem3=lib64 ;;
+                    esac ;;
+               esac
+             fi
+           done
+           IFS="$acl_save_IFS"
+           if test $HOST_CPU_C_ABI_32BIT = yes; then
+             # 32-bit ABI.
+             acl_libdirstem3=
+           fi
+           if test $HOST_CPU_C_ABI_32BIT = no; then
+             # 64-bit ABI.
+             acl_libdirstem2=
+           fi
+         fi
+         ;;
+     esac
+     test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
+     test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem"
+     acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3"
+    ])
+  dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and
+  dnl acl_libdirstem3.
+changequote(,)dnl
+  acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'`
+  acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'`
+  acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'`
+changequote([,])dnl
+])
deleted file mode 120000 (symlink)
index 19d08f313c1198d0760f266e36c06e08786bda69..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/libgmp.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..782dfbae2e14b59689a53c37e9389cb0e6206619
--- /dev/null
@@ -0,0 +1,70 @@
+# libgmp.m4 serial 8
+# Configure the GMP library or a replacement.
+dnl Copyright 2020-2024 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 gl_LIBGMP
+dnl Search for an installed libgmp.
+dnl If found, set and AC_SUBST HAVE_LIBGMP=yes and the LIBGMP and LTLIBGMP
+dnl variables, and augment the CPPFLAGS variable, and #define HAVE_LIBGMP to 1.
+dnl Otherwise, set and AC_SUBST HAVE_LIBGMP=no and LIBGMP and LTLIBGMP to
+dnl empty.
+
+AC_DEFUN([gl_LIBGMP],
+[
+  AC_ARG_WITH([libgmp],
+    [AS_HELP_STRING([[--without-libgmp]],
+       [do not use the GNU Multiple Precision (GMP) library;
+        this is the default on systems lacking libgmp.])])
+  HAVE_LIBGMP=no
+  LIBGMP=
+  LTLIBGMP=
+  AS_IF([test "$with_libgmp" != no],
+    [AC_CHECK_HEADERS([gmp.h gmp/gmp.h], [break])
+     dnl Prefer AC_LIB_HAVE_LINKFLAGS if the havelib module is also in use.
+     AS_IF([test "$ac_cv_header_gmp_h" = yes ||
+            test "$ac_cv_header_gmp_gmp_h" = yes],
+       [m4_ifdef([gl_HAVE_MODULE_HAVELIB],
+          [AC_LIB_HAVE_LINKFLAGS([gmp], [],
+             [#if HAVE_GMP_H
+              # include <gmp.h>
+              #else
+              # include <gmp/gmp.h>
+              #endif],
+             [static const mp_limb_t x[2] = { 0x73, 0x55 };
+              mpz_t tmp;
+              mpz_roinit_n (tmp, x, 2);
+             ],
+             [no])],
+          [gl_saved_LIBS=$LIBS
+           AC_SEARCH_LIBS([__gmpz_roinit_n], [gmp])
+           LIBS=$gl_saved_LIBS
+           case $ac_cv_search___gmpz_roinit_n in
+             'none needed')
+               HAVE_LIBGMP=yes;;
+             -*)
+               HAVE_LIBGMP=yes
+               LIBGMP=$ac_cv_search___gmpz_roinit_n
+               LTLIBGMP=$LIBGMP;;
+           esac
+           AC_SUBST([HAVE_LIBGMP])
+           AC_SUBST([LIBGMP])
+           AC_SUBST([LTLIBGMP])])])
+     if test "$with_libgmp,$HAVE_LIBGMP" = yes,no; then
+       AC_MSG_ERROR(
+         [GMP not found, although --with-libgmp was specified.m4_ifdef(
+            [AC_LIB_HAVE_LINKFLAGS],
+            [ Try specifying --with-libgmp-prefix=DIR.])])
+     fi])
+  if test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" = yes; then
+    GL_GENERATE_GMP_H=false
+  else
+    GL_GENERATE_GMP_H=true
+  fi
+  gl_CONDITIONAL([GL_GENERATE_MINI_GMP_H],
+    [test $HAVE_LIBGMP != yes])
+  gl_CONDITIONAL([GL_GENERATE_GMP_GMP_H],
+    [test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" != yes])
+])
deleted file mode 120000 (symlink)
index 3ff49071e71989da83deca403196ce536932e562..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/libunistring-base.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7c3f65eaa3dbd42a83409386ea022b703b41f1f3
--- /dev/null
@@ -0,0 +1,196 @@
+# libunistring-base.m4 serial 8
+dnl Copyright (C) 2010-2024 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 Paolo Bonzini and Bruno Haible.
+
+dnl gl_LIBUNISTRING_MODULE([VERSION], [Module])
+dnl Declares that the source files of Module should be compiled, unless we
+dnl are linking with libunistring and its version is >= the given VERSION.
+dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is
+dnl true if the source files of Module should be compiled.
+dnl This macro is to be used for public libunistring API, not for
+dnl undocumented API.
+dnl
+dnl You have to bump the VERSION argument to the next projected version
+dnl number each time you make a change that affects the behaviour of the
+dnl functions defined in Module (even if the sources of Module itself do not
+dnl change).
+dnl
+dnl This macro invocation must not occur in macros that are AC_REQUIREd.
+
+AC_DEFUN([gl_LIBUNISTRING_MODULE],
+[
+  AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
+  dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
+  dnl gl_LIBUNISTRING_CORE if that macro has been run.
+  gl_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]),
+    [gl_LIBUNISTRING_VERSION_CMP([$1])])
+])
+
+dnl gl_LIBUNISTRING_MODULE_WITH_VARIABLE([VERSION], [Module])
+dnl is like gl_LIBUNISTRING_MODULE([VERSION], [Module]), except that it also
+dnl defines an AC_SUBSTed autoconf variable GNULIB_$MODULE_DLL_VARIABLE.
+dnl What's the expansion of this autoconf variable?
+dnl   - When building libunistring, it expands to LIBUNISTRING_DLL_VARIABLE.
+dnl     (This is necessary because this token must be present in the .h files
+dnl     when the .h files get installed.)
+dnl   - When building gnulib or application code it expands to
+dnl       - LIBUNISTRING_DLL_VARIABLE by default,
+dnl       - empty if the automake conditional LIBUNISTRING_COMPILE_$MODULE
+dnl         evaluates to true.
+dnl     (This is necessary because when the conditional evaluates to false,
+dnl     the application code expects to use the declared variable from the
+dnl     installed libunistring; it's in this case that the
+dnl     LIBUNISTRING_DLL_VARIABLE macro from the installed
+dnl     <unistring/woe32dll.h> must be used.)
+dnl
+dnl This macro invocation must not occur in macros that are AC_REQUIREd.
+
+AC_DEFUN([gl_LIBUNISTRING_MODULE_WITH_VARIABLE],
+[
+  gl_LIBUNISTRING_MODULE([$1], [$2])
+  m4_ifndef([gl_IN_LIBUNISTRING],
+    [if test -z "${AS_TR_CPP([LIBUNISTRING_COMPILE_$2])_TRUE}"; then
+       GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]AS_TR_CPP([$2_DLL_VARIABLE])=
+     fi
+    ])
+])
+
+dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile])
+dnl Declares that HeaderFile should be created, unless we are linking
+dnl with libunistring and its version is >= the given VERSION.
+dnl HeaderFile should be relative to the lib directory and end in '.h'.
+dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty).
+dnl
+dnl When we are linking with the already installed libunistring and its version
+dnl is < VERSION, we create HeaderFile here, because we may compile functions
+dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed
+dnl version.
+dnl When we are linking with the already installed libunistring and its version
+dnl is > VERSION, we don't create HeaderFile here: it could cause compilation
+dnl errors in other libunistring header files if some types are missing.
+dnl
+dnl You have to bump the VERSION argument to the next projected version
+dnl number each time you make a non-comment change to the HeaderFile.
+
+AC_DEFUN([gl_LIBUNISTRING_LIBHEADER],
+[
+  AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
+  dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
+  dnl gl_LIBUNISTRING_CORE if that macro has been run.
+  if gl_LIBUNISTRING_VERSION_CMP([$1]); then
+    dnl It is OK to use a .h file in lib/ from within tests/, but not vice
+    dnl versa.
+    if test -z "$LIBUNISTRING_[]AS_TR_CPP([$2])"; then
+      LIBUNISTRING_[]AS_TR_CPP([$2])="${gl_source_base_prefix}$2"
+    fi
+  else
+    LIBUNISTRING_[]AS_TR_CPP([$2])=
+  fi
+  AC_SUBST([LIBUNISTRING_]AS_TR_CPP([$2]))
+])
+
+dnl Miscellaneous preparations/initializations.
+
+AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE],
+[
+  dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point.
+  m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])])
+
+  AC_REQUIRE([AC_PROG_AWK])
+
+dnl Sed expressions to extract the parts of a version number.
+changequote(,)
+gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;}
+i\
+0
+q
+'
+gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;}
+i\
+0
+q
+'
+gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;}
+i\
+0
+q
+'
+changequote([,])
+
+  if test "$HAVE_LIBUNISTRING" = yes; then
+    LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"`
+    LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"`
+    LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"`
+  fi
+
+  dnl Determine whether <unistring/woe32dll.h> from an installed libunistring
+  dnl is available.
+  m4_ifdef([gl_IN_LIBUNISTRING],
+    [dnl In libunistring, all .h files that declare variables need to
+     dnl #include <unistring/woe32dll.h>.  This references the file
+     dnl unistring/woe32dll.h in libunistring.
+     HAVE_UNISTRING_WOE32DLL_H=1
+    ],
+    [dnl In gnulib or in applications, we need a #include <unistring/woe32dll.h>
+     dnl if and only if an installed libunistring is available.
+     if test "$HAVE_LIBUNISTRING" = yes; then
+       AC_CHECK_HEADERS([unistring/woe32dll.h],
+         [HAVE_UNISTRING_WOE32DLL_H=1],
+         [HAVE_UNISTRING_WOE32DLL_H=0])
+     else
+       HAVE_UNISTRING_WOE32DLL_H=0
+     fi
+    ])
+  AC_SUBST([HAVE_UNISTRING_WOE32DLL_H])
+])
+
+dnl gl_LIBUNISTRING_VERSION_CMP([VERSION])
+dnl Expands to a shell statement that evaluates to true if LIBUNISTRING_VERSION
+dnl is less than the VERSION argument.
+AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP],
+[ { test "$HAVE_LIBUNISTRING" != yes \
+    || {
+         dnl AS_LITERAL_IF exists and works fine since autoconf-2.59 at least.
+         AS_LITERAL_IF([$1],
+           [dnl This is the optimized variant, that assumes the argument is a literal:
+            m4_pushdef([requested_version_major],
+              [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^\([0-9]*\).*], [\1]), [])])
+            m4_pushdef([requested_version_minor],
+              [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.]\([0-9]*\).*], [\1]), [$1])])
+            m4_pushdef([requested_version_subminor],
+              [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.][0-9]*[.]\([0-9]*\).*], [\1]), [$1])])
+            test $LIBUNISTRING_VERSION_MAJOR -lt requested_version_major \
+            || { test $LIBUNISTRING_VERSION_MAJOR -eq requested_version_major \
+                 && { test $LIBUNISTRING_VERSION_MINOR -lt requested_version_minor \
+                      || { test $LIBUNISTRING_VERSION_MINOR -eq requested_version_minor \
+                           && test $LIBUNISTRING_VERSION_SUBMINOR -lt requested_version_subminor
+                         }
+                    }
+               }
+            m4_popdef([requested_version_subminor])
+            m4_popdef([requested_version_minor])
+            m4_popdef([requested_version_major])
+           ],
+           [dnl This is the unoptimized variant:
+            requested_version_major=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_major"`
+            requested_version_minor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_minor"`
+            requested_version_subminor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_subminor"`
+            test $LIBUNISTRING_VERSION_MAJOR -lt $requested_version_major \
+            || { test $LIBUNISTRING_VERSION_MAJOR -eq $requested_version_major \
+                 && { test $LIBUNISTRING_VERSION_MINOR -lt $requested_version_minor \
+                      || { test $LIBUNISTRING_VERSION_MINOR -eq $requested_version_minor \
+                           && test $LIBUNISTRING_VERSION_SUBMINOR -lt $requested_version_subminor
+                         }
+                    }
+               }
+           ])
+       }
+  }])
+
+dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the
+dnl same as ORIG, otherwise to 0.
+m4_define([gl_LIBUNISTRING_ARG_OR_ZERO], [m4_if([$1], [$2], [0], [$1])])
deleted file mode 120000 (symlink)
index 85b329e909115cba87dae20be43c0bb75fd0b1e8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/limits-h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1825328380b570b1ee1d233a717812fa65bc8424
--- /dev/null
@@ -0,0 +1,54 @@
+dnl Check whether limits.h has needed features.
+
+dnl Copyright 2016-2024 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.
+
+AC_DEFUN_ONCE([gl_LIMITS_H],
+[
+  gl_CHECK_NEXT_HEADERS([limits.h])
+
+  AC_CACHE_CHECK([whether limits.h has WORD_BIT, BOOL_WIDTH etc.],
+    [gl_cv_header_limits_width],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+             #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
+            #endif
+            #include <limits.h>
+            long long llm = LLONG_MAX;
+            int wb = WORD_BIT;
+            int ullw = ULLONG_WIDTH;
+            int bw = BOOL_WIDTH;
+            int bm = BOOL_MAX;
+            int mblm = MB_LEN_MAX;
+          ]])],
+       [gl_cv_header_limits_width=yes],
+       [gl_cv_header_limits_width=no])])
+  GL_GENERATE_LIMITS_H=true
+  AS_IF([test "$gl_cv_header_limits_width" = yes],
+    [AC_CACHE_CHECK([whether limits.h has SSIZE_MAX],
+       [gl_cv_header_limits_ssize_max],
+       [AC_COMPILE_IFELSE(
+          [AC_LANG_SOURCE(
+             [[#include <limits.h>
+               #ifndef SSIZE_MAX
+                 #error "SSIZE_MAX is not defined"
+               #endif
+             ]])],
+          [gl_cv_header_limits_ssize_max=yes],
+          [gl_cv_header_limits_ssize_max=no])])
+     if test "$gl_cv_header_limits_ssize_max" = yes; then
+       GL_GENERATE_LIMITS_H=false
+     fi])
+])
+
+dnl Unconditionally enables the replacement of <limits.h>.
+AC_DEFUN([gl_REPLACE_LIMITS_H],
+[
+  AC_REQUIRE([gl_LIMITS_H])
+  GL_GENERATE_LIMITS_H=true
+])
deleted file mode 120000 (symlink)
index c74add7d365db4908e913b149524f31a31cdd84a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/link-follow.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..826471130a9a4310980ac6e0531126c3be8188e8
--- /dev/null
@@ -0,0 +1,110 @@
+# serial 21
+dnl Run a program to determine whether link(2) follows symlinks.
+dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
+
+# Copyright (C) 1999-2001, 2004-2006, 2009-2024 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 This macro can be used to emulate POSIX linkat.  If
+dnl LINK_FOLLOWS_SYMLINKS is 0, link matches linkat(,0), and
+dnl linkat(,AT_SYMLINK_FOLLOW) requires a readlink. If it is 1,
+dnl link matches linkat(,AT_SYMLINK_FOLLOW), and there is no way
+dnl to do linkat(,0) on symlinks (on all other file types,
+dnl link() is sufficient).  If it is -1, use a Solaris specific
+dnl runtime test.  If it is -2, use a generic runtime test.
+AC_DEFUN([gl_FUNC_LINK_FOLLOWS_SYMLINK],
+[dnl
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([readlink])
+  dnl Mingw lacks link, although gnulib provides a good replacement.
+  dnl However, it also lacks symlink, so there's nothing to test in
+  dnl the first place, and no reason to need to distinguish between
+  dnl linkat variants.  So, we set LINK_FOLLOWS_SYMLINKS to 0.
+  gl_link_follows_symlinks=0 # assume GNU behavior
+  if test $ac_cv_func_readlink = yes; then
+    dnl Solaris has an __xpg4 variable in libc, and it determines the
+    dnl behaviour of link(): It dereferences a symlink if and only if
+    dnl __xpg4 != 0.
+    AC_CACHE_CHECK([for __xpg4], [gl_cv_have___xpg4],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[extern int __xpg4;]],
+            [[return __xpg4;]])],
+         [gl_cv_have___xpg4=yes],
+         [gl_cv_have___xpg4=no])
+      ])
+    if test $gl_cv_have___xpg4 = yes; then
+      gl_link_follows_symlinks=-1
+    else
+      AC_CACHE_CHECK([whether link(2) dereferences a symlink],
+                     [gl_cv_func_link_follows_symlink],
+        [
+         # Create a regular file.
+         echo > conftest.file
+         AC_RUN_IFELSE(
+           [AC_LANG_SOURCE([[
+#       include <sys/types.h>
+#       include <sys/stat.h>
+#       include <unistd.h>
+#       include <stdlib.h>
+
+#       define SAME_INODE(Stat_buf_1, Stat_buf_2) \
+          ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
+           && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
+
+        int
+        main ()
+        {
+          const char *file = "conftest.file";
+          const char *sym = "conftest.sym";
+          const char *hard = "conftest.hard";
+          struct stat sb_file, sb_hard;
+
+          /* Create a symlink to the regular file. */
+          if (symlink (file, sym))
+            return 2;
+
+          /* Create a hard link to that symlink.  */
+          if (link (sym, hard))
+            return 3;
+
+          if (lstat (hard, &sb_hard))
+            return 4;
+          if (lstat (file, &sb_file))
+            return 5;
+
+          /* If the dev/inode of hard and file are the same, then
+             the link call followed the symlink.  */
+          return SAME_INODE (sb_hard, sb_file) ? 1 : 0;
+        }
+           ]])],
+           [gl_cv_func_link_follows_symlink=no], dnl GNU behavior
+           [gl_cv_func_link_follows_symlink=yes], dnl Followed link/compile failed
+           [dnl We're cross compiling.
+            dnl The past results are "yes" on Mac OS X, FreeBSD, NetBSD,
+            dnl OpenBSD, Minix, AIX, HP-UX, OSF/1, and "no" on Linux, Cygwin.
+            case "$host_os" in
+                                  # On glibc/Linux we know the result.
+              linux*-gnu* | gnu*) gl_cv_func_link_follows_symlink="guessing no" ;;
+                                  # On musl/Linux we know the result.
+              linux*-musl*)       gl_cv_func_link_follows_symlink="guessing no" ;;
+                                  # Otherwise, we don't know.
+              *)                  gl_cv_func_link_follows_symlink=unknown ;;
+            esac
+           ])
+         rm -f conftest.file conftest.sym conftest.hard
+        ])
+      case "$gl_cv_func_link_follows_symlink" in
+        *yes) gl_link_follows_symlinks=1 ;;
+        *no) ;; # already defaulted to 0
+        *) gl_link_follows_symlinks=-2 ;;
+      esac
+    fi
+  fi
+  AC_DEFINE_UNQUOTED([LINK_FOLLOWS_SYMLINKS], [$gl_link_follows_symlinks],
+    [Define to 1 if 'link(2)' dereferences symbolic links, 0 if it
+     creates hard links to symlinks, -1 if it depends on the variable __xpg4,
+     and -2 if unknown.])
+])
deleted file mode 120000 (symlink)
index 5665e1606f69882831b8ecc66b542b1cf7fcbb3a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/link.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3bd242fd12e1d57992fa72929aba516ecbb117cb
--- /dev/null
@@ -0,0 +1,60 @@
+# link.m4 serial 12
+dnl Copyright (C) 2009-2024 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_LINK],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([link])
+  if test $ac_cv_func_link = no; then
+    HAVE_LINK=0
+  else
+    AC_CACHE_CHECK([whether link obeys POSIX],
+      [gl_cv_func_link_works],
+      [touch conftest.a
+       # Assume that if we have lstat, we can also check symlinks.
+       if test $ac_cv_func_lstat = yes; then
+         ln -s conftest.a conftest.lnk
+       fi
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+             #include <stdio.h>
+           ]],
+           [[int result = 0;
+             if (!link ("conftest.a", "conftest.b/"))
+               result |= 1;
+#if HAVE_LSTAT
+             if (!link ("conftest.lnk/", "conftest.b"))
+               result |= 2;
+             if (rename ("conftest.a", "conftest.b"))
+               result |= 4;
+             if (!link ("conftest.b", "conftest.lnk"))
+               result |= 8;
+#endif
+             return result;
+           ]])],
+         [gl_cv_func_link_works=yes], [gl_cv_func_link_works=no],
+         [case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_link_works="guessing yes" ;;
+                             # Guess yes on systems that emulate the Linux system calls.
+            midipix*)        gl_cv_func_link_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_link_works="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_link_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+       rm -f conftest.a conftest.b conftest.lnk])
+    case "$gl_cv_func_link_works" in
+      *yes) ;;
+      *)
+        REPLACE_LINK=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 2ea00979f718fe5a5099f0a17354b5da26d2845d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/linkat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c5f925b31c6d9a8d8da4e7b88ff29464dcd45600
--- /dev/null
@@ -0,0 +1,134 @@
+# serial 17
+# See if we need to provide linkat replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_LINKAT],
+[
+  AC_REQUIRE([gl_FUNC_OPENAT])
+  AC_REQUIRE([gl_FUNC_LINK_FOLLOWS_SYMLINK])
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([symlink])
+  gl_CHECK_FUNCS_ANDROID([linkat], [[#include <unistd.h>]])
+  if test $ac_cv_func_linkat = no; then
+    HAVE_LINKAT=0
+    case "$gl_cv_onwards_func_linkat" in
+      future*) REPLACE_LINKAT=1 ;;
+    esac
+  else
+    dnl OS X Yosemite has linkat() but it's not sufficient
+    dnl to our needs since it doesn't support creating
+    dnl hardlinks to symlinks.  Therefore check for that
+    dnl capability before considering using the system version.
+    AC_CACHE_CHECK([whether linkat() can link symlinks],
+      [gl_cv_func_linkat_nofollow],
+      [rm -rf conftest.l1 conftest.l2
+       ln -s target conftest.l1
+       AC_RUN_IFELSE([AC_LANG_PROGRAM(
+                        [[#include <fcntl.h>
+                          #include <unistd.h>
+                        ]],
+                        [[return linkat (AT_FDCWD, "conftest.l1", AT_FDCWD,
+                                         "conftest.l2", 0);
+                        ]])],
+         [gl_cv_func_linkat_nofollow=yes],
+         [gl_cv_func_linkat_nofollow=no],
+         [case "$host_os" in
+           darwin*) gl_cv_func_linkat_nofollow="guessing no" ;;
+           *)       gl_cv_func_linkat_nofollow="guessing yes" ;;
+          esac])
+
+       rm -rf conftest.l1 conftest.l2])
+
+    case $gl_cv_func_linkat_nofollow in
+      *no) LINKAT_SYMLINK_NOTSUP=1 ;;
+      *yes) LINKAT_SYMLINK_NOTSUP=0 ;;
+    esac
+
+    AC_CACHE_CHECK([whether linkat handles trailing slash correctly],
+      [gl_cv_func_linkat_slash],
+      [rm -rf conftest.a conftest.b conftest.c conftest.d conftest.e conftest.s
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <unistd.h>
+              #include <fcntl.h>
+              #include <errno.h>
+              #include <stdio.h>
+            ]GL_MDA_DEFINES],
+            [[int result;
+              int fd;
+              /* Create a regular file.  */
+              fd = open ("conftest.a", O_CREAT | O_EXCL | O_WRONLY, 0600);
+              if (fd < 0)
+                return 1;
+              if (write (fd, "hello", 5) < 5)
+                return 2;
+              if (close (fd) < 0)
+                return 3;
+              /* Test whether hard links are supported on the current
+                 device.  */
+              if (linkat (AT_FDCWD, "conftest.a", AT_FDCWD, "conftest.b",
+                          AT_SYMLINK_FOLLOW) < 0)
+                return 0;
+              result = 0;
+              /* Test whether a trailing "/" is treated like "/.".  */
+              if (linkat (AT_FDCWD, "conftest.a/", AT_FDCWD, "conftest.c",
+                          AT_SYMLINK_FOLLOW) == 0)
+                result |= 4;
+              if (linkat (AT_FDCWD, "conftest.a", AT_FDCWD, "conftest.d/",
+                          AT_SYMLINK_FOLLOW) == 0)
+                result |= 8;
+
+              /* On Mac OS X 10.13 a trailing "/" will cause the second path to be
+                 dereferenced, and thus will succeed on a dangling symlink.  */
+              if (symlink ("conftest.e", "conftest.s") == 0)
+                {
+                  if (linkat (AT_FDCWD, "conftest.a", AT_FDCWD, "conftest.s/",
+                      AT_SYMLINK_FOLLOW) == 0)
+                    result |= 16;
+                }
+
+              return result;
+            ]])],
+         [gl_cv_func_linkat_slash=yes],
+         [gl_cv_func_linkat_slash=no],
+         [
+          case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_linkat_slash="guessing yes";;
+                             # Guess yes on systems that emulate the Linux system calls.
+            midipix*)        gl_cv_func_linkat_slash="guessing yes";;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_linkat_slash="guessing yes";;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_linkat_slash="$gl_cross_guess_normal";;
+          esac
+         ])
+       rm -rf conftest.a conftest.b conftest.c conftest.d conftest.e conftest.s])
+    case "$gl_cv_func_linkat_slash" in
+      *yes) gl_linkat_slash_bug=0 ;;
+      *)    gl_linkat_slash_bug=1 ;;
+    esac
+
+    case "$gl_cv_func_linkat_nofollow" in
+      *yes) linkat_nofollow=yes ;;
+      *) linkat_nofollow=no ;;
+    esac
+
+    if test "$linkat_nofollow" != yes \
+       || test $gl_linkat_slash_bug = 1; then
+      REPLACE_LINKAT=1
+      AC_DEFINE_UNQUOTED([LINKAT_TRAILING_SLASH_BUG], [$gl_linkat_slash_bug],
+        [Define to 1 if linkat fails to recognize a trailing slash.])
+      AC_DEFINE_UNQUOTED([LINKAT_SYMLINK_NOTSUP], [$LINKAT_SYMLINK_NOTSUP],
+        [Define to 1 if linkat can create hardlinks to symlinks])
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index ed7c1f38c26efe512288a8d4fbf32870602f7b80..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/localcharset.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..abf07dc3f145a522778b81788d6610574fb03f58
--- /dev/null
@@ -0,0 +1,11 @@
+# localcharset.m4 serial 8
+dnl Copyright (C) 2002, 2004, 2006, 2009-2024 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_LOCALCHARSET],
+[
+  dnl Prerequisites of lib/localcharset.c.
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+])
deleted file mode 120000 (symlink)
index 4d9473d004d2ea0ca8ad56b27ed62794c800a8a6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/locale-fr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c9528562e75c76f5c24d85e529632a68a2a5c786
--- /dev/null
@@ -0,0 +1,300 @@
+# locale-fr.m4 serial 23
+dnl Copyright (C) 2003, 2005-2024 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 Bruno Haible.
+
+dnl Determine the name of a french locale with traditional encoding.
+AC_DEFUN_ONCE([gt_LOCALE_FR],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [
+    AC_LANG_CONFTEST([AC_LANG_SOURCE([[
+#include <locale.h>
+#include <time.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+struct tm t;
+char buf[16];
+int main () {
+  /* On BeOS and Haiku, locales are not implemented in libc.  Rather, libintl
+     imitates locale dependent behaviour by looking at the environment
+     variables, and all locales use the UTF-8 encoding.  */
+#if defined __BEOS__ || defined __HAIKU__
+  return 1;
+#else
+  /* Check whether the given locale name is recognized by the system.  */
+# if defined _WIN32 && !defined __CYGWIN__
+  /* On native Windows, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+# else
+  if (setlocale (LC_ALL, "") == NULL) return 1;
+# endif
+  /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
+     On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
+     is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
+     On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "646". In this situation,
+     some unit tests fail.
+     On MirBSD 10, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "UTF-8".  */
+# if HAVE_LANGINFO_CODESET
+  {
+    const char *cs = nl_langinfo (CODESET);
+    if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
+        || strcmp (cs, "UTF-8") == 0)
+      return 1;
+  }
+# endif
+# ifdef __CYGWIN__
+  /* On Cygwin, avoid locale names without encoding suffix, because the
+     locale_charset() function relies on the encoding suffix.  Note that
+     LC_ALL is set on the command line.  */
+  if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
+# endif
+  /* Check whether in the abbreviation of the second month, the second
+     character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is only
+     one byte long. This excludes the UTF-8 encoding.  */
+  t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
+  if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1;
+# if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy.  */
+  /* Check whether the decimal separator is a comma.
+     On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point
+     are nl_langinfo(RADIXCHAR) are both ".".  */
+  if (localeconv () ->decimal_point[0] != ',') return 1;
+# endif
+  return 0;
+#endif
+}
+      ]])])
+    if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw* | windows*)
+          # Test for the native Windows locale name.
+          if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_fr=French_France.1252
+          else
+            # None found.
+            gt_cv_locale_fr=none
+          fi
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Test for the usual locale name.
+          if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_fr=fr_FR
+          else
+            # Test for the locale name with explicit encoding suffix.
+            if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_fr=fr_FR.ISO-8859-1
+            else
+              # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name.
+              if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_fr=fr_FR.ISO8859-1
+              else
+                # Test for the HP-UX locale name.
+                if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                  gt_cv_locale_fr=fr_FR.iso88591
+                else
+                  # Test for the Solaris 7 locale name.
+                  if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                    gt_cv_locale_fr=fr
+                  else
+                    # None found.
+                    gt_cv_locale_fr=none
+                  fi
+                fi
+              fi
+            fi
+          fi
+          ;;
+      esac
+    fi
+    rm -fr conftest*
+  ])
+  LOCALE_FR=$gt_cv_locale_fr
+  case $LOCALE_FR in #(
+    '' | *[[[:space:]\"\$\'*@<:@]]*)
+      dnl This locale name might cause trouble with sh or make.
+      AC_MSG_WARN([invalid locale "$LOCALE_FR"; assuming "none"])
+      LOCALE_FR=none;;
+  esac
+  AC_SUBST([LOCALE_FR])
+])
+
+dnl Determine the name of a french locale with UTF-8 encoding.
+AC_DEFUN_ONCE([gt_LOCALE_FR_UTF8],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [
+    case "$host_os" in
+      *-musl* | midipix*)
+        dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without
+        dnl any locale file on disk. But they are effectively equivalent to the
+        dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES)
+        dnl for which localizations (.mo files) have been installed.
+        gt_cv_locale_fr_utf8=fr_FR.UTF-8
+        ;;
+      *)
+        AC_LANG_CONFTEST([AC_LANG_SOURCE([[
+#include <locale.h>
+#include <time.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+struct tm t;
+char buf[16];
+int main () {
+  /* On BeOS and Haiku, locales are not implemented in libc.  Rather, libintl
+     imitates locale dependent behaviour by looking at the environment
+     variables, and all locales use the UTF-8 encoding.  */
+#if !(defined __BEOS__ || defined __HAIKU__)
+  /* Check whether the given locale name is recognized by the system.  */
+# if defined _WIN32 && !defined __CYGWIN__
+  /* On native Windows, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+# else
+  if (setlocale (LC_ALL, "") == NULL) return 1;
+# endif
+  /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
+     On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
+     is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
+     On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "646". In this situation,
+     some unit tests fail.  */
+# if HAVE_LANGINFO_CODESET
+  {
+    const char *cs = nl_langinfo (CODESET);
+    if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
+      return 1;
+  }
+# endif
+# ifdef __CYGWIN__
+  /* On Cygwin, avoid locale names without encoding suffix, because the
+     locale_charset() function relies on the encoding suffix.  Note that
+     LC_ALL is set on the command line.  */
+  if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
+# endif
+  /* Check whether in the abbreviation of the second month, the second
+     character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is
+     two bytes long, with UTF-8 encoding.  */
+  t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
+  if (strftime (buf, sizeof (buf), "%b", &t) < 4
+      || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v')
+    return 1;
+#endif
+#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy.  */
+  /* Check whether the decimal separator is a comma.
+     On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point
+     are nl_langinfo(RADIXCHAR) are both ".".  */
+  if (localeconv () ->decimal_point[0] != ',') return 1;
+#endif
+  return 0;
+}
+          ]])])
+        if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+          case "$host_os" in
+            # Handle native Windows specially, because there setlocale() interprets
+            # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+            # "fr" or "fra" as "French" or "French_France.1252",
+            # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+            # "ja" as "Japanese" or "Japanese_Japan.932",
+            # and similar.
+            mingw* | windows*)
+              # Test for the hypothetical native Windows locale name.
+              if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_fr_utf8=French_France.65001
+              else
+                # None found.
+                gt_cv_locale_fr_utf8=none
+              fi
+              ;;
+            *)
+              # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+              # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
+              # configure script would override the LC_ALL setting. Likewise for
+              # LC_CTYPE, which is also set at the beginning of the configure script.
+              # Test for the usual locale name.
+              if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_fr_utf8=fr_FR
+              else
+                # Test for the locale name with explicit encoding suffix.
+                if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                  gt_cv_locale_fr_utf8=fr_FR.UTF-8
+                else
+                  # Test for the Solaris 7 locale name.
+                  if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                    gt_cv_locale_fr_utf8=fr.UTF-8
+                  else
+                    # None found.
+                    gt_cv_locale_fr_utf8=none
+                  fi
+                fi
+              fi
+              ;;
+          esac
+        fi
+        rm -fr conftest*
+        ;;
+    esac
+  ])
+  LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8
+  case $LOCALE_FR_UTF8 in #(
+    '' | *[[[:space:]\"\$\'*@<:@]]*)
+      dnl This locale name might cause trouble with sh or make.
+      AC_MSG_WARN([invalid locale "$LOCALE_FR_UTF8"; assuming "none"])
+      LOCALE_FR_UTF8=none;;
+  esac
+  AC_SUBST([LOCALE_FR_UTF8])
+
+  dnl Users of $LOCALE_FR_UTF8 need to know which of the locale categories they
+  dnl can rely on.
+  case "$host_os" in
+    *-musl* | midipix*)
+      dnl On musl libc, locale categories other than LC_CTYPE and LC_MESSAGES
+      dnl are effectively unimplemented.
+      LC_COLLATE_IMPLEMENTED=false
+      LC_NUMERIC_IMPLEMENTED=false
+      LC_TIME_IMPLEMENTED=false
+      LC_MONETARY_IMPLEMENTED=false
+      ;;
+    *)
+      LC_COLLATE_IMPLEMENTED=true
+      LC_NUMERIC_IMPLEMENTED=true
+      LC_TIME_IMPLEMENTED=true
+      LC_MONETARY_IMPLEMENTED=true
+      ;;
+  esac
+  AC_SUBST([LC_COLLATE_IMPLEMENTED])
+  AC_SUBST([LC_NUMERIC_IMPLEMENTED])
+  AC_SUBST([LC_TIME_IMPLEMENTED])
+  AC_SUBST([LC_MONETARY_IMPLEMENTED])
+])
deleted file mode 120000 (symlink)
index 47e05d6f5420e55a33024545fbfa5494926a958d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/locale-ja.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..71a9863b47c4f7c8f95ab254620ed11585295212
--- /dev/null
@@ -0,0 +1,149 @@
+# locale-ja.m4 serial 18
+dnl Copyright (C) 2003, 2005-2024 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 Bruno Haible.
+
+dnl Determine the name of a japanese locale with EUC-JP encoding.
+AC_DEFUN_ONCE([gt_LOCALE_JA],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [
+    AC_LANG_CONFTEST([AC_LANG_SOURCE([[
+#include <locale.h>
+#include <time.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+struct tm t;
+char buf[16];
+int main ()
+{
+  /* On BeOS and Haiku, locales are not implemented in libc.  Rather, libintl
+     imitates locale dependent behaviour by looking at the environment
+     variables, and all locales use the UTF-8 encoding.  */
+#if defined __BEOS__ || defined __HAIKU__
+  return 1;
+#else
+  /* Check whether the given locale name is recognized by the system.  */
+# if defined _WIN32 && !defined __CYGWIN__
+  /* On native Windows, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+# else
+  if (setlocale (LC_ALL, "") == NULL) return 1;
+# endif
+  /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
+     On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
+     is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
+     On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "646". In this situation,
+     some unit tests fail.
+     On MirBSD 10, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "UTF-8".  */
+# if HAVE_LANGINFO_CODESET
+  {
+    const char *cs = nl_langinfo (CODESET);
+    if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
+        || strcmp (cs, "UTF-8") == 0)
+      return 1;
+  }
+# endif
+# ifdef __CYGWIN__
+  /* On Cygwin, avoid locale names without encoding suffix, because the
+     locale_charset() function relies on the encoding suffix.  Note that
+     LC_ALL is set on the command line.  */
+  if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
+# endif
+  /* Check whether MB_CUR_MAX is > 1.  This excludes the dysfunctional locales
+     on Cygwin 1.5.x.  */
+  if (MB_CUR_MAX == 1)
+    return 1;
+  /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
+     This excludes the UTF-8 encoding (except on MirBSD).  */
+  {
+    const char *p;
+    t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
+    if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
+    for (p = buf; *p != '\0'; p++)
+      if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0)
+        return 1;
+  }
+  return 0;
+#endif
+}
+      ]])])
+    if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw* | windows*)
+          # Note that on native Windows, the Japanese locale is
+          # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we
+          # cannot use it here.
+          gt_cv_locale_ja=none
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Test for the AIX locale name.
+          if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_ja=ja_JP
+          else
+            # Test for the locale name with explicit encoding suffix.
+            if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_ja=ja_JP.EUC-JP
+            else
+              # Test for the HP-UX, OSF/1, NetBSD locale name.
+              if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_ja=ja_JP.eucJP
+              else
+                # Test for the IRIX, FreeBSD locale name.
+                if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                  gt_cv_locale_ja=ja_JP.EUC
+                else
+                  # Test for the Solaris 7 locale name.
+                  if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                    gt_cv_locale_ja=ja
+                  else
+                    # Special test for NetBSD 1.6.
+                    if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then
+                      gt_cv_locale_ja=ja_JP.eucJP
+                    else
+                      # None found.
+                      gt_cv_locale_ja=none
+                    fi
+                  fi
+                fi
+              fi
+            fi
+          fi
+          ;;
+      esac
+    fi
+    rm -fr conftest*
+  ])
+  LOCALE_JA=$gt_cv_locale_ja
+  case $LOCALE_JA in #(
+    '' | *[[[:space:]\"\$\'*@<:@]]*)
+      dnl This locale name might cause trouble with sh or make.
+      AC_MSG_WARN([invalid locale "$LOCALE_JA"; assuming "none"])
+      LOCALE_JA=none;;
+  esac
+  AC_SUBST([LOCALE_JA])
+])
deleted file mode 120000 (symlink)
index 0519af0e577f5b2f73b05c3c28d959008c1fae2d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/locale-tr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b68e429a87e139a84373890ba1e4d9e84683b787
--- /dev/null
@@ -0,0 +1,132 @@
+# locale-tr.m4 serial 15
+dnl Copyright (C) 2003, 2005-2024 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 Bruno Haible.
+
+dnl Determine the name of a turkish locale with UTF-8 encoding.
+AC_DEFUN_ONCE([gt_LOCALE_TR_UTF8],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CACHE_CHECK([for a turkish Unicode locale], [gt_cv_locale_tr_utf8], [
+    AC_LANG_CONFTEST([AC_LANG_SOURCE([[
+#include <locale.h>
+#include <time.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+#include <wctype.h>
+struct tm t;
+char buf[16];
+int main () {
+  /* On BeOS, locales are not implemented in libc.  Rather, libintl
+     imitates locale dependent behaviour by looking at the environment
+     variables, and all locales use the UTF-8 encoding.  But BeOS does not
+     implement the Turkish upper-/lowercase mappings.  Therefore, let this
+     program return 1 on BeOS.  */
+  /* Check whether the given locale name is recognized by the system.  */
+#if defined _WIN32 && !defined __CYGWIN__
+  /* On native Windows, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+#else
+  if (setlocale (LC_ALL, "") == NULL) return 1;
+#endif
+  /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
+     On Mac OS X 10.3.5 (Darwin 7.5) in the tr_TR locale, nl_langinfo(CODESET)
+     is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
+     On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "646". In this situation,
+     some unit tests fail.  */
+#if HAVE_LANGINFO_CODESET
+  {
+    const char *cs = nl_langinfo (CODESET);
+    if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
+      return 1;
+  }
+#endif
+#ifdef __CYGWIN__
+  /* On Cygwin, avoid locale names without encoding suffix, because the
+     locale_charset() function relies on the encoding suffix.  Note that
+     LC_ALL is set on the command line.  */
+  if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
+#endif
+  /* Check whether in the abbreviation of the eighth month, the second
+     character (should be U+011F: LATIN SMALL LETTER G WITH BREVE) is
+     two bytes long, with UTF-8 encoding.  */
+  t.tm_year = 1992 - 1900; t.tm_mon = 8 - 1; t.tm_mday = 19;
+  if (strftime (buf, sizeof (buf), "%b", &t) < 4
+      || buf[1] != (char) 0xc4 || buf[2] != (char) 0x9f)
+    return 1;
+  /* Check whether the upper-/lowercase mappings are as expected for
+     Turkish.  */
+  if (towupper ('i') != 0x0130 || towlower (0x0130) != 'i'
+      || towupper(0x0131) != 'I' || towlower ('I') != 0x0131)
+    return 1;
+  return 0;
+}
+      ]])])
+    if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw* | windows*)
+          # Test for the hypothetical native Windows locale name.
+          if (LC_ALL=Turkish_Turkey.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_tr_utf8=Turkish_Turkey.65001
+          else
+            # None found.
+            gt_cv_locale_tr_utf8=none
+          fi
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Test for the usual locale name.
+          if (LC_ALL=tr_TR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_tr_utf8=tr_TR
+          else
+            # Test for the locale name with explicit encoding suffix.
+            if (LC_ALL=tr_TR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_tr_utf8=tr_TR.UTF-8
+            else
+              # Test for the Solaris 7 locale name.
+              if (LC_ALL=tr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+                gt_cv_locale_tr_utf8=tr.UTF-8
+              else
+                # None found.
+                gt_cv_locale_tr_utf8=none
+              fi
+            fi
+          fi
+          ;;
+      esac
+    else
+      gt_cv_locale_tr_utf8=none
+    fi
+    rm -fr conftest*
+  ])
+  LOCALE_TR_UTF8=$gt_cv_locale_tr_utf8
+  case $LOCALE_TR_UTF8 in #(
+    '' | *[[[:space:]\"\$\'*@<:@]]*)
+      dnl This locale name might cause trouble with sh or make.
+      AC_MSG_WARN([invalid locale "$LOCALE_TR_UTF8"; assuming "none"])
+      LOCALE_TR_UTF8=none;;
+  esac
+  AC_SUBST([LOCALE_TR_UTF8])
+])
deleted file mode 120000 (symlink)
index 46c9acb4e32ba0bf26504cd1493df13f3e4f53ae..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/locale-zh.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f1a58c63606d36a03ffc91e583326438efcc9b1d
--- /dev/null
@@ -0,0 +1,143 @@
+# locale-zh.m4 serial 18
+dnl Copyright (C) 2003, 2005-2024 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 Bruno Haible.
+
+dnl Determine the name of a chinese locale with GB18030 encoding.
+AC_DEFUN_ONCE([gt_LOCALE_ZH_CN],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AM_LANGINFO_CODESET])
+  AC_CACHE_CHECK([for a transitional chinese locale], [gt_cv_locale_zh_CN], [
+    AC_LANG_CONFTEST([AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdlib.h>
+#include <time.h>
+#if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+struct tm t;
+char buf[16];
+int main ()
+{
+  /* On BeOS and Haiku, locales are not implemented in libc.  Rather, libintl
+     imitates locale dependent behaviour by looking at the environment
+     variables, and all locales use the UTF-8 encoding.  */
+#if defined __BEOS__ || defined __HAIKU__
+  return 1;
+#else
+  /* Check whether the given locale name is recognized by the system.  */
+# if defined _WIN32 && !defined __CYGWIN__
+  /* On native Windows, setlocale(category, "") looks at the system settings,
+     not at the environment variables.  Also, when an encoding suffix such
+     as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
+     category of the locale to "C".  */
+  if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
+      || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
+    return 1;
+# else
+  if (setlocale (LC_ALL, "") == NULL) return 1;
+# endif
+  /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646".
+     On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET)
+     is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
+     On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "646". In this situation,
+     some unit tests fail.
+     On MirBSD 10, when an unsupported locale is specified, setlocale()
+     succeeds but then nl_langinfo(CODESET) is "UTF-8".  */
+# if HAVE_LANGINFO_CODESET
+  {
+    const char *cs = nl_langinfo (CODESET);
+    if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
+        || strcmp (cs, "UTF-8") == 0)
+      return 1;
+  }
+# endif
+# ifdef __CYGWIN__
+  /* On Cygwin, avoid locale names without encoding suffix, because the
+     locale_charset() function relies on the encoding suffix.  Note that
+     LC_ALL is set on the command line.  */
+  if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
+# endif
+  /* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
+     This excludes the UTF-8 encoding (except on MirBSD).  */
+  {
+    const char *p;
+    t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
+    if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
+    for (p = buf; *p != '\0'; p++)
+      if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0)
+        return 1;
+  }
+  /* Check whether a typical GB18030 multibyte sequence is recognized as a
+     single wide character.  This excludes the GB2312 and GBK encodings.  */
+  if (mblen ("\203\062\332\066", 5) != 4)
+    return 1;
+  return 0;
+#endif
+}
+      ]])])
+    if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+      case "$host_os" in
+        # Handle native Windows specially, because there setlocale() interprets
+        # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256",
+        # "fr" or "fra" as "French" or "French_France.1252",
+        # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
+        # "ja" as "Japanese" or "Japanese_Japan.932",
+        # and similar.
+        mingw* | windows*)
+          # Test for the hypothetical native Windows locale name.
+          if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_zh_CN=Chinese_China.54936
+          else
+            # None found.
+            gt_cv_locale_zh_CN=none
+          fi
+          ;;
+        solaris2.8)
+          # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are
+          # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK.
+          # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core.
+          gt_cv_locale_zh_CN=none
+          ;;
+        *)
+          # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
+          # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
+          # configure script would override the LC_ALL setting. Likewise for
+          # LC_CTYPE, which is also set at the beginning of the configure script.
+          # Test for the locale name without encoding suffix.
+          if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+            gt_cv_locale_zh_CN=zh_CN
+          else
+            # Test for the locale name with explicit encoding suffix.
+            if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
+              gt_cv_locale_zh_CN=zh_CN.GB18030
+            else
+              # None found.
+              gt_cv_locale_zh_CN=none
+            fi
+          fi
+          ;;
+      esac
+    else
+      # If there was a link error, due to mblen(), the system is so old that
+      # it certainly doesn't have a chinese locale.
+      gt_cv_locale_zh_CN=none
+    fi
+    rm -fr conftest*
+  ])
+  LOCALE_ZH_CN=$gt_cv_locale_zh_CN
+  case $LOCALE_ZH_CN in #(
+    '' | *[[[:space:]\"\$\'*@<:@]]*)
+      dnl This locale name might cause trouble with sh or make.
+      AC_MSG_WARN([invalid locale "$LOCALE_ZH_CN"; assuming "none"])
+      LOCALE_ZH_CN=none;;
+  esac
+  AC_SUBST([LOCALE_ZH_CN])
+])
deleted file mode 120000 (symlink)
index e9a6ca123c8821183b2014bb82d1758e867fb1f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/locale_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4e8e3adf9fdd2dba37e9f1f683b0ad71a52d0950
--- /dev/null
@@ -0,0 +1,176 @@
+# locale_h.m4 serial 30
+dnl Copyright (C) 2007, 2009-2024 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_ONCE([gl_LOCALE_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+
+  dnl Persuade glibc <locale.h> to define locale_t and the int_p_*, int_n_*
+  dnl members of 'struct lconv'.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
+  AC_REQUIRE([gl_STDDEF_H])
+
+  AC_REQUIRE([gl_LOCALE_T])
+
+  dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv'
+  dnl only if _LCONV_C99 is defined.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    solaris*)
+      AC_DEFINE([_LCONV_C99], [1], [Define to 1 on Solaris.])
+      ;;
+  esac
+
+  AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001],
+    [gl_cv_header_locale_h_posix2001],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <locale.h>
+            int x = LC_MESSAGES;
+            int y = sizeof (((struct lconv *) 0)->decimal_point);]],
+          [[]])],
+       [gl_cv_header_locale_h_posix2001=yes],
+       [gl_cv_header_locale_h_posix2001=no])])
+
+  dnl Check whether 'struct lconv' is complete.
+  dnl Bionic libc's 'struct lconv' is just a dummy.
+  dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x,
+  dnl mingw, MSVC 9, it lacks the int_p_* and int_n_* members.
+  AC_CACHE_CHECK([whether struct lconv is properly defined],
+    [gl_cv_sys_struct_lconv_ok],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <locale.h>
+            struct lconv l;
+            int x = sizeof (l.decimal_point);
+            int y = sizeof (l.int_p_cs_precedes);]],
+          [[]])],
+       [gl_cv_sys_struct_lconv_ok=yes],
+       [gl_cv_sys_struct_lconv_ok=no])
+    ])
+  if test $gl_cv_sys_struct_lconv_ok = no; then
+    dnl On native Windows with MSVC, merely define these member names as macros.
+    dnl This avoids trouble in C++ mode.
+    case "$host_os" in
+      windows*-msvc*)
+        ;;
+      mingw* | windows*)
+        AC_EGREP_CPP([Special], [
+#ifdef _MSC_VER
+ Special
+#endif
+          ],
+          [],
+          [REPLACE_STRUCT_LCONV=1])
+        ;;
+      *) REPLACE_STRUCT_LCONV=1 ;;
+    esac
+  fi
+
+  dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_NEXT_HEADERS([locale.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <locale.h>
+/* Some systems provide declarations in a non-standard header.  */
+#if HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
+    ]],
+    [setlocale newlocale duplocale freelocale])
+])
+
+dnl Checks to determine whether the system has the locale_t type,
+dnl and how to obtain it.
+AC_DEFUN([gl_LOCALE_T],
+[
+  dnl Persuade glibc and Solaris <locale.h> to define locale_t.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl Check whether use of locale_t requires inclusion of <xlocale.h>,
+  dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by
+  dnl itself, we assume that <xlocale.h> will do so.
+  AC_CACHE_CHECK([whether locale.h defines locale_t],
+    [gl_cv_header_locale_has_locale_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <locale.h>
+            locale_t x;]],
+          [[]])],
+       [gl_cv_header_locale_has_locale_t=yes],
+       [gl_cv_header_locale_has_locale_t=no])
+    ])
+
+  dnl Check for <xlocale.h>.
+  AC_CHECK_HEADERS_ONCE([xlocale.h])
+  if test $ac_cv_header_xlocale_h = yes; then
+    HAVE_XLOCALE_H=1
+    if test $gl_cv_header_locale_has_locale_t = yes; then
+      gl_cv_header_locale_h_needs_xlocale_h=no
+    else
+      gl_cv_header_locale_h_needs_xlocale_h=yes
+    fi
+    HAVE_LOCALE_T=1
+  else
+    HAVE_XLOCALE_H=0
+    gl_cv_header_locale_h_needs_xlocale_h=no
+    if test $gl_cv_header_locale_has_locale_t = yes; then
+      HAVE_LOCALE_T=1
+    else
+      HAVE_LOCALE_T=0
+    fi
+  fi
+  AC_SUBST([HAVE_XLOCALE_H])
+])
+
+# gl_LOCALE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_LOCALE_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_LOCALE_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_NEWLOCALE=1;       AC_SUBST([HAVE_NEWLOCALE])
+  HAVE_DUPLOCALE=1;       AC_SUBST([HAVE_DUPLOCALE])
+  HAVE_FREELOCALE=1;      AC_SUBST([HAVE_FREELOCALE])
+  REPLACE_LOCALECONV=0;   AC_SUBST([REPLACE_LOCALECONV])
+  REPLACE_SETLOCALE=0;    AC_SUBST([REPLACE_SETLOCALE])
+  REPLACE_NEWLOCALE=0;    AC_SUBST([REPLACE_NEWLOCALE])
+  REPLACE_DUPLOCALE=0;    AC_SUBST([REPLACE_DUPLOCALE])
+  REPLACE_FREELOCALE=0;   AC_SUBST([REPLACE_FREELOCALE])
+  REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV])
+  LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS])
+])
deleted file mode 120000 (symlink)
index 08ddb224fea497f7a6d0f5d5505c55f004676930..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/localeconv.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..351b4e1bac49120ce7116f35bba16131200371d5
--- /dev/null
@@ -0,0 +1,59 @@
+# localeconv.m4 serial 3
+dnl Copyright (C) 2012-2024 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_LOCALECONV],
+[
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+  AC_REQUIRE([gl_LOCALE_H])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  if test $REPLACE_STRUCT_LCONV = 1; then
+    REPLACE_LOCALECONV=1
+  fi
+  if test $REPLACE_LOCALECONV = 0; then
+    dnl Test whether fields of type 'char' are filled correctly.
+    dnl This test fails on mingw 5.0.3.
+    AC_CACHE_CHECK([whether localeconv works],
+      [gl_cv_func_localeconv_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE([[
+            #include <locale.h>
+            #include <limits.h>
+            int main ()
+            {
+              struct lconv *l = localeconv ();
+              return l->frac_digits != CHAR_MAX && l->frac_digits < 0;
+            }
+         ]])],
+         [gl_cv_func_localeconv_works=yes],
+         [gl_cv_func_localeconv_works=no],
+         [case "$host_os" in
+                                # Guess yes on glibc systems.
+            *-gnu* | gnu*)      gl_cv_func_localeconv_works="guessing yes" ;;
+                                # Guess yes on musl systems.
+            *-musl* | midipix*) gl_cv_func_localeconv_works="guessing yes" ;;
+                                # Guess no on native Windows.
+            mingw* | windows*)  gl_cv_func_localeconv_works="guessing no" ;;
+                                # If we don't know, obey --enable-cross-guesses.
+            *)                  gl_cv_func_localeconv_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_localeconv_works" in
+      *yes) ;;
+      *) REPLACE_LOCALECONV=1 ;;
+    esac
+  fi
+])
+
+# Prerequisites of lib/localeconv.c.
+AC_DEFUN([gl_PREREQ_LOCALECONV],
+[
+  AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [],
+    [[#include <locale.h>]])
+  AC_CHECK_MEMBERS([struct lconv.int_p_cs_precedes], [], [],
+    [[#include <locale.h>]])
+])
deleted file mode 120000 (symlink)
index 33bb6d385359fe052d76d63a998acbd99ef447f3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/localename.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e8e23ca4176d5c79dc6b4ef5df97a2fd988bf5b2
--- /dev/null
@@ -0,0 +1,55 @@
+# localename.m4 serial 10
+dnl Copyright (C) 2007, 2009-2024 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_LOCALENAME],
+[
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+  AC_REQUIRE([gl_LOCALE_T])
+  AC_REQUIRE([gt_LC_MESSAGES])
+  AC_REQUIRE([gt_INTL_THREAD_LOCALE_NAME])
+  AC_REQUIRE([gt_INTL_MACOSX])
+  AC_CHECK_HEADERS_ONCE([langinfo.h])
+  if test $HAVE_LOCALE_T = 1; then
+    gl_CHECK_FUNCS_ANDROID([newlocale], [[#include <locale.h>]])
+    gl_CHECK_FUNCS_ANDROID([duplocale], [[#include <locale.h>]])
+    gl_CHECK_FUNCS_ANDROID([freelocale], [[#include <locale.h>]])
+    gl_func_newlocale="$ac_cv_func_newlocale"
+    gl_func_duplocale="$ac_cv_func_duplocale"
+    gl_func_freelocale="$ac_cv_func_freelocale"
+  else
+    dnl In 2019, some versions of z/OS lack the locale_t type and have broken
+    dnl newlocale, duplocale, freelocale functions.
+    gl_cv_onwards_func_newlocale='future OS version'
+    gl_cv_onwards_func_duplocale='future OS version'
+    gl_cv_onwards_func_freelocale='future OS version'
+    gl_func_newlocale=no
+    gl_func_duplocale=no
+    gl_func_freelocale=no
+  fi
+  if test $gl_func_newlocale != yes; then
+    HAVE_NEWLOCALE=0
+    case "$gl_cv_onwards_func_newlocale" in
+      future*) REPLACE_NEWLOCALE=1 ;;
+    esac
+  fi
+  if test $gl_func_duplocale != yes; then
+    HAVE_DUPLOCALE=0
+    case "$gl_cv_onwards_func_duplocale" in
+      future*) REPLACE_DUPLOCALE=1 ;;
+    esac
+  fi
+  if test $gl_func_freelocale != yes; then
+    HAVE_FREELOCALE=0
+    case "$gl_cv_onwards_func_freelocale" in
+      future*) REPLACE_FREELOCALE=1 ;;
+    esac
+  fi
+  if test $gt_localename_enhances_locale_funcs = yes; then
+    REPLACE_NEWLOCALE=1
+    REPLACE_DUPLOCALE=1
+    REPLACE_FREELOCALE=1
+  fi
+])
deleted file mode 120000 (symlink)
index 8757540dd4cf84fcbd4f512876dedc368a8ff150..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lock.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2ca3bf2ffce38f9767a4b189884b7ab08ceb1a99
--- /dev/null
@@ -0,0 +1,47 @@
+# lock.m4 serial 14
+dnl Copyright (C) 2005-2024 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 Bruno Haible.
+
+AC_DEFUN([gl_LOCK],
+[
+  AC_REQUIRE([gl_THREADLIB])
+  if test "$gl_threads_api" = posix; then
+    # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the
+    # pthread_rwlock_* functions.
+    has_rwlock=false
+    AC_CHECK_TYPE([pthread_rwlock_t],
+      [has_rwlock=true
+       AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1],
+         [Define if the POSIX multithreading library has read/write locks.])],
+      [],
+      [#include <pthread.h>])
+    if $has_rwlock; then
+      gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER
+    fi
+    # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM(
+        [[#include <pthread.h>]],
+        [[
+#if __FreeBSD__ == 4
+error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
+#elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \
+       && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070)
+error "No, in Mac OS X < 10.7 recursive mutexes actually don't work."
+#else
+int x = (int)PTHREAD_MUTEX_RECURSIVE;
+return !x;
+#endif
+        ]])],
+      [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1],
+         [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
+  fi
+  gl_PREREQ_LOCK
+])
+
+# Prerequisites of lib/glthread/lock.c.
+AC_DEFUN([gl_PREREQ_LOCK], [:])
deleted file mode 120000 (symlink)
index d4fbf675814a75e5b0005129408e7e23e2d099fb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lseek.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bb30a478fd1d3c5584e69a538dc41feefd89cadd
--- /dev/null
@@ -0,0 +1,100 @@
+# lseek.m4 serial 15
+dnl Copyright (C) 2007, 2009-2024 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_LSEEK],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe],
+    [case "$host_os" in
+       mingw* | windows*)
+         dnl Native Windows.
+         dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or
+         dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT)
+         dnl for a pipe depends on the environment:
+         dnl In a Cygwin 1.5 environment it succeeds (wrong);
+         dnl in a Cygwin 1.7 environment it fails with a wrong errno value;
+         dnl in a Cygwin 2.9.0 environment it fails correctly;
+         dnl in a Cygwin 3.4.6 environment it succeeds again (wrong).
+         gl_cv_func_lseek_pipe=no
+         ;;
+       *)
+         if test $cross_compiling = no; then
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h> /* for off_t */
+#include <stdio.h> /* for SEEK_CUR */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#else /* on Windows with MSVC */
+# include <io.h>
+#endif
+]GL_MDA_DEFINES],
+[[
+  /* Exit with success only if stdin is seekable.  */
+  return lseek (0, (off_t)0, SEEK_CUR) < 0;
+]])],
+             [if test -s conftest$ac_exeext \
+                 && ./conftest$ac_exeext < conftest.$ac_ext \
+                 && test 1 = "`echo hi \
+                   | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then
+                gl_cv_func_lseek_pipe=yes
+              else
+                gl_cv_func_lseek_pipe=no
+              fi
+             ],
+             [gl_cv_func_lseek_pipe=no])
+         else
+           AC_COMPILE_IFELSE(
+             [AC_LANG_SOURCE([[
+#if defined __BEOS__
+/* BeOS mistakenly return 0 when trying to seek on pipes.  */
+  Choke me.
+#endif]])],
+             [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
+         fi
+         ;;
+     esac
+    ])
+  if test "$gl_cv_func_lseek_pipe" = no; then
+    REPLACE_LSEEK=1
+    AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
+      [Define to 1 if lseek does not detect pipes.])
+  fi
+
+  AC_REQUIRE([gl_SYS_TYPES_H])
+  if test $WINDOWS_64_BIT_OFF_T = 1; then
+    REPLACE_LSEEK=1
+  fi
+
+  AS_IF([test $REPLACE_LSEEK = 0],
+    [AC_CACHE_CHECK([whether SEEK_DATA works but is incompatible with GNU],
+       [gl_cv_func_lseek_works_but_incompatible],
+       [AC_PREPROC_IFELSE(
+          [AC_LANG_SOURCE(
+             dnl Use macOS "9999" to stand for a future fixed macOS version.
+             dnl See ../lib/unistd.in.h and <https://bugs.gnu.org/61386>.
+             [[#include <unistd.h>
+               #if defined __APPLE__ && defined __MACH__ && defined SEEK_DATA
+               # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+               #  include <AvailabilityMacros.h>
+               # endif
+               # if 99990000 <= MAC_OS_X_VERSION_MIN_REQUIRED
+               #  define LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU
+               # endif
+               #endif
+               #ifndef LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU
+                #error "No need to work around the bug"
+               #endif
+             ]])],
+          [gl_cv_func_lseek_works_but_incompatible=yes],
+          [gl_cv_func_lseek_works_but_incompatible=no])])
+     if test "$gl_cv_func_lseek_works_but_incompatible" = yes; then
+       REPLACE_LSEEK=1
+     fi])
+])
deleted file mode 120000 (symlink)
index 37bd88ae4c2765cfa96683d3e54869a9f7e26750..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/lstat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..48cc8653fe601b1d85829025c8f79bd741098697
--- /dev/null
@@ -0,0 +1,82 @@
+# serial 36
+
+# Copyright (C) 1997-2001, 2003-2024 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_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  dnl If lstat does not exist, the replacement <sys/stat.h> does
+  dnl "#define lstat stat", and lstat.c is a no-op.
+  AC_CHECK_FUNCS_ONCE([lstat])
+  if test $ac_cv_func_lstat = yes; then
+    AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+    case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in
+      darwin* | solaris* | *no)
+        REPLACE_LSTAT=1
+        ;;
+    esac
+  else
+    HAVE_LSTAT=0
+  fi
+])
+
+# Prerequisites of lib/lstat.c.
+AC_DEFUN([gl_PREREQ_LSTAT], [:])
+
+AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
+[
+  dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it
+  dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ.
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether lstat correctly handles trailing slash],
+    [gl_cv_func_lstat_dereferences_slashed_symlink],
+    [rm -f conftest.sym conftest.file
+     echo >conftest.file
+     AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [AC_INCLUDES_DEFAULT],
+          [[struct stat sbuf;
+            if (symlink ("conftest.file", "conftest.sym") != 0)
+              return 1;
+            /* Linux will dereference the symlink and fail, as required by
+               POSIX.  That is better in the sense that it means we will not
+               have to compile and use the lstat wrapper.  */
+            return lstat ("conftest.sym/", &sbuf) == 0;
+          ]])],
+       [gl_cv_func_lstat_dereferences_slashed_symlink=yes],
+       [gl_cv_func_lstat_dereferences_slashed_symlink=no],
+       [case "$host_os" in
+          linux-* | linux)
+            # Guess yes on Linux systems.
+            gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
+          midipix*)
+            # Guess yes on systems that emulate the Linux system calls.
+            gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
+          *-gnu* | gnu*)
+            # Guess yes on glibc systems.
+            gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
+          mingw* | windows*)
+            # Guess no on native Windows.
+            gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
+          *)
+            # If we don't know, obey --enable-cross-guesses.
+            gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -f conftest.sym conftest.file
+    ])
+  case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+    *yes)
+      AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
+        [Define to 1 if 'lstat' dereferences a symlink specified
+         with a trailing slash.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 43c46386c2e60654ca886db0bda2a621373c77f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/malloc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..635d6726b113e125cc1a2475faba6dcf1d79e817
--- /dev/null
@@ -0,0 +1,176 @@
+# malloc.m4 serial 31
+dnl Copyright (C) 2007, 2009-2024 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.
+
+# This is adapted with modifications from upstream Autoconf here:
+# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949
+AC_DEFUN([_AC_FUNC_MALLOC_IF],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+  AC_CACHE_CHECK([whether malloc (0) returns nonnull],
+    [ac_cv_func_malloc_0_nonnull],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdlib.h>
+          ]],
+          [[void *p = malloc (0);
+            void * volatile vp = p;
+            int result = !vp;
+            free (p);
+            return result;]])
+       ],
+       [ac_cv_func_malloc_0_nonnull=yes],
+       [ac_cv_func_malloc_0_nonnull=no],
+       [case "$host_os" in
+          # Guess yes on platforms where we know the result.
+          *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
+          | gnu* | *-musl* | midipix* | midnightbsd* \
+          | hpux* | solaris* | cygwin* | mingw* | windows* | msys* )
+            ac_cv_func_malloc_0_nonnull="guessing yes" ;;
+          # If we don't know, obey --enable-cross-guesses.
+          *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
+  AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2])
+])# _AC_FUNC_MALLOC_IF
+
+# gl_FUNC_MALLOC_GNU
+# ------------------
+# Replace malloc if it is not compatible with GNU libc.
+AC_DEFUN([gl_FUNC_MALLOC_GNU],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
+  REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX"
+  if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then
+    _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1])
+  fi
+])
+
+# gl_FUNC_MALLOC_PTRDIFF
+# ----------------------
+# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX,
+# and replace malloc otherwise.
+AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF])
+  test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC_FOR_MALLOC_POSIX=1
+])
+
+# Test whether malloc, realloc, calloc refuse to create objects
+# larger than what can be expressed in ptrdiff_t.
+# Set gl_cv_func_malloc_gnu to yes or no accordingly.
+AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF],
+[
+  AC_CACHE_CHECK([whether malloc is ptrdiff_t safe],
+    [gl_cv_malloc_ptrdiff],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdint.h>
+          ]],
+          [[/* 64-bit ptrdiff_t is so wide that no practical platform
+               can exceed it.  */
+            #define WIDE_PTRDIFF (PTRDIFF_MAX >> 31 >> 31 != 0)
+
+            /* On rare machines where size_t fits in ptrdiff_t there
+               is no problem.  */
+            #define NARROW_SIZE (SIZE_MAX <= PTRDIFF_MAX)
+
+            /* glibc 2.30 and later malloc refuses to exceed ptrdiff_t
+               bounds even on 32-bit platforms.  We don't know which
+               non-glibc systems are safe.  */
+            #define KNOWN_SAFE (2 < __GLIBC__ + (30 <= __GLIBC_MINOR__))
+
+            #if WIDE_PTRDIFF || NARROW_SIZE || KNOWN_SAFE
+              return 0;
+            #else
+              #error "malloc might not be ptrdiff_t safe"
+              syntax error
+            #endif
+          ]])],
+       [gl_cv_malloc_ptrdiff=yes],
+       [gl_cv_malloc_ptrdiff=no])
+    ])
+])
+
+# gl_FUNC_MALLOC_POSIX
+# --------------------
+# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
+# fails, and doesn't mess up with ptrdiff_t overflow), and replace
+# malloc if it is not.
+AC_DEFUN([gl_FUNC_MALLOC_POSIX],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF])
+  AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
+  if test "$gl_cv_func_malloc_posix" = yes; then
+    AC_DEFINE([HAVE_MALLOC_POSIX], [1],
+      [Define if malloc, realloc, and calloc set errno on allocation failure.])
+  else
+    REPLACE_MALLOC_FOR_MALLOC_POSIX=1
+  fi
+])
+
+# Test whether malloc, realloc, calloc set errno to ENOMEM on failure.
+# Set gl_cv_func_malloc_posix to yes or no accordingly.
+AC_DEFUN([gl_CHECK_MALLOC_POSIX],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure],
+    [gl_cv_func_malloc_posix],
+    [
+      dnl It is too dangerous to try to allocate a large amount of memory:
+      dnl some systems go to their knees when you do that. So assume that
+      dnl all Unix implementations of the function set errno on failure,
+      dnl except on those platforms where we have seen 'test-malloc-gnu',
+      dnl 'test-realloc-gnu', 'test-calloc-gnu' fail.
+      case "$host_os" in
+        mingw* | windows*)
+          gl_cv_func_malloc_posix=no ;;
+        irix* | solaris*)
+          dnl On IRIX 6.5, the three functions return NULL with errno unset
+          dnl when the argument is larger than PTRDIFF_MAX.
+          dnl On Solaris 11.3, the three functions return NULL with errno set
+          dnl to EAGAIN, not ENOMEM, when the argument is larger than
+          dnl PTRDIFF_MAX.
+          dnl Here is a test program:
+m4_divert_push([KILL])
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define ptrdiff_t long
+#ifndef PTRDIFF_MAX
+# define PTRDIFF_MAX ((ptrdiff_t) ((1UL << (8 * sizeof (ptrdiff_t) - 1)) - 1))
+#endif
+
+int main ()
+{
+  void *p;
+
+  fprintf (stderr, "PTRDIFF_MAX = %lu\n", (unsigned long) PTRDIFF_MAX);
+
+  errno = 0;
+  p = malloc ((unsigned long) PTRDIFF_MAX + 1);
+  fprintf (stderr, "p=%p errno=%d\n", p, errno);
+
+  errno = 0;
+  p = calloc (PTRDIFF_MAX / 2 + 1, 2);
+  fprintf (stderr, "p=%p errno=%d\n", p, errno);
+
+  errno = 0;
+  p = realloc (NULL, (unsigned long) PTRDIFF_MAX + 1);
+  fprintf (stderr, "p=%p errno=%d\n", p, errno);
+
+  return 0;
+}
+m4_divert_pop([KILL])
+          gl_cv_func_malloc_posix=no ;;
+        *)
+          gl_cv_func_malloc_posix=yes ;;
+      esac
+    ])
+])
deleted file mode 120000 (symlink)
index 415ae77575a40a3253e42e669cdfd198d5fa2385..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/malloca.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..77e15959e64cb4bc710a41f76eaa4e75bcc4175c
--- /dev/null
@@ -0,0 +1,14 @@
+# malloca.m4 serial 2
+dnl Copyright (C) 2003-2004, 2006-2007, 2009-2024 Free Software Foundation,
+dnl 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_MALLOCA],
+[
+  dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables
+  dnl @ALLOCA@ and @LTALLOCA@.
+  dnl gl_FUNC_ALLOCA   dnl Already brought in by the module dependencies.
+  AC_REQUIRE([gl_EEMALLOC])
+])
deleted file mode 120000 (symlink)
index 84c4a79788bc53ad1ab894d0918e8f3d8238a6d3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/manywarnings-c++.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aa6a31cbe5b8f8f8b7d99a4b5d8803abcfad6d3c
--- /dev/null
@@ -0,0 +1,243 @@
+# manywarnings-c++.m4 serial 3
+dnl Copyright (C) 2008-2024 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.
+
+# Implementation of the specialization of gl_MANYWARN_ALL_GCC
+# for _AC_LANG = C++.
+AC_DEFUN([gl_MANYWARN_ALL_GCC_CXX_IMPL],
+[
+  AC_LANG_PUSH([C++])
+
+  dnl First, check for some issues that only occur when combining multiple
+  dnl gcc warning categories.
+  AC_REQUIRE([AC_PROG_CXX])
+  if test -n "$GXX"; then
+
+    dnl Check if -W -Werror -Wno-missing-field-initializers is supported
+    dnl with the current $CXX $CXXFLAGS $CPPFLAGS.
+    AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported],
+      [gl_cv_cxx_nomfi_supported],
+      [gl_save_CXXFLAGS="$CXXFLAGS"
+       CXXFLAGS="$CXXFLAGS -W -Werror -Wno-missing-field-initializers"
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[]], [[]])],
+         [gl_cv_cxx_nomfi_supported=yes],
+         [gl_cv_cxx_nomfi_supported=no])
+       CXXFLAGS="$gl_save_CXXFLAGS"
+      ])
+
+    if test "$gl_cv_cxx_nomfi_supported" = yes; then
+      dnl Now check whether -Wno-missing-field-initializers is needed
+      dnl for the { 0, } construct.
+      AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
+        [gl_cv_cxx_nomfi_needed],
+        [gl_save_CXXFLAGS="$CXXFLAGS"
+         CXXFLAGS="$CXXFLAGS -W -Werror"
+         AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[int f (void)
+                {
+                  typedef struct { int a; int b; } s_t;
+                  s_t s1 = { 0, };
+                  return s1.b;
+                }
+              ]],
+              [[]])],
+           [gl_cv_cxx_nomfi_needed=no],
+           [gl_cv_cxx_nomfi_needed=yes])
+         CXXFLAGS="$gl_save_CXXFLAGS"
+        ])
+    fi
+
+    dnl Next, check if -Werror -Wuninitialized is useful with the
+    dnl user's choice of $CXXFLAGS; some versions of gcc warn that it
+    dnl has no effect if -O is not also used
+    AC_CACHE_CHECK([whether -Wuninitialized is supported],
+      [gl_cv_cxx_uninitialized_supported],
+      [gl_save_CXXFLAGS="$CXXFLAGS"
+       CXXFLAGS="$CXXFLAGS -Werror -Wuninitialized"
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[]], [[]])],
+         [gl_cv_cxx_uninitialized_supported=yes],
+         [gl_cv_cxx_uninitialized_supported=no])
+       CXXFLAGS="$gl_save_CXXFLAGS"
+      ])
+
+  fi
+
+  # List all gcc warning categories.
+  # To compare this list to your installed GCC's, run this Bash command:
+  #
+  # comm -3 \
+  #  <(sed -n 's/^  *\(-[^ ]*\) .*/\1/p' manywarnings-c++.m4 | sort) \
+  #  <(gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort |
+  #      grep -v -x -f <(
+  #         awk '/^[^#]/ {print $1}' ../build-aux/g++-warning.spec))
+
+  gl_manywarn_set=
+  for gl_manywarn_item in \
+    -W \
+    -Wabi-tag \
+    -Waddress \
+    -Waggressive-loop-optimizations \
+    -Wall \
+    -Wattributes \
+    -Wbool-compare \
+    -Wbuiltin-macro-redefined \
+    -Wcast-align \
+    -Wchar-subscripts \
+    -Wclobbered \
+    -Wcomment \
+    -Wcomments \
+    -Wconditionally-supported \
+    -Wconversion-null \
+    -Wcoverage-mismatch \
+    -Wcpp \
+    -Wctor-dtor-privacy \
+    -Wdate-time \
+    -Wdelete-incomplete \
+    -Wdelete-non-virtual-dtor \
+    -Wdeprecated \
+    -Wdeprecated-declarations \
+    -Wdisabled-optimization \
+    -Wdiv-by-zero \
+    -Wdouble-promotion \
+    -Weffc++ \
+    -Wempty-body \
+    -Wendif-labels \
+    -Wenum-compare \
+    -Wextra \
+    -Wformat-contains-nul \
+    -Wformat-extra-args \
+    -Wformat-nonliteral \
+    -Wformat-security \
+    -Wformat-signedness \
+    -Wformat-y2k \
+    -Wformat-zero-length \
+    -Wfree-nonheap-object \
+    -Wignored-qualifiers \
+    -Winherited-variadic-ctor \
+    -Winit-self \
+    -Winline \
+    -Wint-to-pointer-cast \
+    -Winvalid-memory-model \
+    -Winvalid-offsetof \
+    -Winvalid-pch \
+    -Wliteral-suffix \
+    -Wlogical-not-parentheses \
+    -Wlogical-op \
+    -Wmain \
+    -Wmaybe-uninitialized \
+    -Wmemset-transposed-args \
+    -Wmissing-braces \
+    -Wmissing-declarations \
+    -Wmissing-field-initializers \
+    -Wmissing-include-dirs \
+    -Wmultichar \
+    -Wnarrowing \
+    -Wnoexcept \
+    -Wnon-template-friend \
+    -Wnon-virtual-dtor \
+    -Wnonnull \
+    -Wodr \
+    -Wold-style-cast \
+    -Wopenmp-simd \
+    -Woverflow \
+    -Woverlength-strings \
+    -Woverloaded-virtual \
+    -Wpacked \
+    -Wpacked-bitfield-compat \
+    -Wparentheses \
+    -Wpmf-conversions \
+    -Wpointer-arith \
+    -Wpragmas \
+    -Wreorder \
+    -Wreturn-local-addr \
+    -Wreturn-type \
+    -Wsequence-point \
+    -Wshadow \
+    -Wshift-count-negative \
+    -Wshift-count-overflow \
+    -Wsign-promo \
+    -Wsized-deallocation \
+    -Wsizeof-array-argument \
+    -Wsizeof-pointer-memaccess \
+    -Wstack-protector \
+    -Wstrict-aliasing \
+    -Wstrict-null-sentinel \
+    -Wstrict-overflow \
+    -Wsuggest-attribute=const \
+    -Wsuggest-attribute=format \
+    -Wsuggest-attribute=noreturn \
+    -Wsuggest-attribute=pure \
+    -Wsuggest-final-methods \
+    -Wsuggest-final-types \
+    -Wsuggest-override \
+    -Wswitch \
+    -Wswitch-bool \
+    -Wsync-nand \
+    -Wsystem-headers \
+    -Wtrampolines \
+    -Wtrigraphs \
+    -Wtype-limits \
+    -Wuninitialized \
+    -Wunknown-pragmas \
+    -Wunsafe-loop-optimizations \
+    -Wunused \
+    -Wunused-but-set-parameter \
+    -Wunused-but-set-variable \
+    -Wunused-function \
+    -Wunused-label \
+    -Wunused-local-typedefs \
+    -Wunused-macros \
+    -Wunused-parameter \
+    -Wunused-result \
+    -Wunused-value \
+    -Wunused-variable \
+    -Wuseless-cast \
+    -Wvarargs \
+    -Wvariadic-macros \
+    -Wvector-operation-performance \
+    -Wvirtual-move-assign \
+    -Wvla \
+    -Wvolatile-register-var \
+    -Wwrite-strings \
+    -Wzero-as-null-pointer-constant \
+    \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
+
+  # gcc --help=warnings outputs an unusual form for these options; list
+  # them here so that the above 'comm' command doesn't report a false match.
+  gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
+  gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
+  gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
+  gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
+
+  # These are needed for older GCC versions.
+  if test -n "$GXX"; then
+    case `($CXX --version) 2>/dev/null` in
+      'g++ (GCC) '[[0-3]].* | \
+      'g++ (GCC) '4.[[0-7]].*)
+        gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option"
+        gl_manywarn_set="$gl_manywarn_set -funit-at-a-time"
+          ;;
+    esac
+  fi
+
+  # Disable specific options as needed.
+  if test "$gl_cv_cxx_nomfi_needed" = yes; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
+  fi
+
+  if test "$gl_cv_cxx_uninitialized_supported" = no; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
+  fi
+
+  $1=$gl_manywarn_set
+
+  AC_LANG_POP([C++])
+])
deleted file mode 120000 (symlink)
index 0bc2a58185e765973dfb4028daddc0644f476b31..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/manywarnings.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4d44f3aa34de6d06af81bc9b4e1206d2581ec0c6
--- /dev/null
@@ -0,0 +1,206 @@
+# manywarnings.m4 serial 24
+dnl Copyright (C) 2008-2024 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 Simon Josefsson
+
+AC_PREREQ([2.64])
+
+# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
+# --------------------------------------------------
+# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
+# Elements separated by whitespace.  In set logic terms, the function
+# does OUTVAR = LISTVAR \ REMOVEVAR.
+AC_DEFUN([gl_MANYWARN_COMPLEMENT],
+[
+  gl_warn_set=
+  set x $2; shift
+  for gl_warn_item
+  do
+    case " $3 " in
+      *" $gl_warn_item "*)
+        ;;
+      *)
+        AS_VAR_APPEND([gl_warn_set], [" $gl_warn_item"])
+        ;;
+    esac
+  done
+  $1=$gl_warn_set
+])
+
+# gl_MANYWARN_ALL_GCC(VARIABLE)
+# -----------------------------
+# Add all documented GCC warning parameters to variable VARIABLE.
+# Note that you need to test them using gl_WARN_ADD if you want to
+# make sure your gcc understands it.
+#
+# The effects of this macro depend on the current language (_AC_LANG).
+AC_DEFUN([gl_MANYWARN_ALL_GCC],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+# Specialization for _AC_LANG = C.
+AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
+[
+  AC_LANG_PUSH([C])
+
+  dnl First, check for some issues that only occur when combining multiple
+  dnl gcc warning categories.
+  AC_REQUIRE([AC_PROG_CC])
+  AS_IF([test -n "$GCC"], [
+    AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
+      [gl_cv_cc_nomfi_needed],
+      [gl_cv_cc_nomfi_needed=no
+       gl_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -Wextra -Werror"
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[struct file_data { int desc, name; };
+              struct cmp { struct file_data file[1]; };
+              void f (struct cmp *r)
+              {
+                typedef struct { int a; int b; } s_t;
+                s_t s1 = { 0, };
+                struct cmp cmp = { .file[0].desc = r->file[0].desc + s1.a };
+                *r = cmp;
+              }
+            ]],
+            [[]])],
+         [],
+         [CFLAGS="$CFLAGS -Wno-missing-field-initializers"
+          AC_COMPILE_IFELSE([],
+            [gl_cv_cc_nomfi_needed=yes])])
+       CFLAGS="$gl_save_CFLAGS"
+    ])
+
+    dnl Next, check if -Werror -Wuninitialized is useful with the
+    dnl user's choice of $CFLAGS; some versions of gcc warn that it
+    dnl has no effect if -O is not also used
+    AC_CACHE_CHECK([whether -Wuninitialized is supported],
+      [gl_cv_cc_uninitialized_supported],
+      [gl_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -Werror -Wuninitialized"
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[]], [[]])],
+         [gl_cv_cc_uninitialized_supported=yes],
+         [gl_cv_cc_uninitialized_supported=no])
+       CFLAGS="$gl_save_CFLAGS"
+      ])
+  ])
+
+  # List all gcc warning categories.
+  # To compare this list to your installed GCC's, run this Bash command:
+  #
+  # comm -3 \
+  #  <((sed -n 's/^  *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \
+  #     awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
+  #  <(LC_ALL=C gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort)
+
+  $1=
+  for gl_manywarn_item in -fanalyzer -fstrict-flex-arrays \
+    -Wall \
+    -Warith-conversion \
+    -Wbad-function-cast \
+    -Wcast-align=strict \
+    -Wdate-time \
+    -Wdisabled-optimization \
+    -Wdouble-promotion \
+    -Wduplicated-branches \
+    -Wduplicated-cond \
+    -Wextra \
+    -Wformat-signedness \
+    -Winit-self \
+    -Winline \
+    -Winvalid-pch \
+    -Wlogical-op \
+    -Wmissing-declarations \
+    -Wmissing-include-dirs \
+    -Wmissing-prototypes \
+    -Wnested-externs \
+    -Wnull-dereference \
+    -Wold-style-definition \
+    -Wopenmp-simd \
+    -Woverlength-strings \
+    -Wpacked \
+    -Wpointer-arith \
+    -Wshadow \
+    -Wstack-protector \
+    -Wstrict-flex-arrays \
+    -Wstrict-overflow \
+    -Wstrict-prototypes \
+    -Wsuggest-attribute=cold \
+    -Wsuggest-attribute=const \
+    -Wsuggest-attribute=format \
+    -Wsuggest-attribute=malloc \
+    -Wsuggest-attribute=noreturn \
+    -Wsuggest-attribute=pure \
+    -Wsuggest-final-methods \
+    -Wsuggest-final-types \
+    -Wsync-nand \
+    -Wsystem-headers \
+    -Wtrampolines \
+    -Wuninitialized \
+    -Wunknown-pragmas \
+    -Wunsafe-loop-optimizations \
+    -Wunused-macros \
+    -Wvariadic-macros \
+    -Wvector-operation-performance \
+    -Wvla \
+    -Wwrite-strings \
+    \
+    ; do
+    AS_VAR_APPEND([$1], [" $gl_manywarn_item"])
+  done
+
+  # gcc --help=warnings outputs an unusual form for these options; list
+  # them here so that the above 'comm' command doesn't report a false match.
+  AS_VAR_APPEND([$1], [' -Warray-bounds=2'])
+  AS_VAR_APPEND([$1], [' -Wattribute-alias=2'])
+  AS_VAR_APPEND([$1], [' -Wbidi-chars=any,ucn'])
+  AS_VAR_APPEND([$1], [' -Wformat-overflow=2'])
+  AS_VAR_APPEND([$1], [' -Wformat=2'])
+  AS_VAR_APPEND([$1], [' -Wformat-truncation=2'])
+  AS_VAR_APPEND([$1], [' -Wimplicit-fallthrough=5'])
+  AS_VAR_APPEND([$1], [' -Wshift-overflow=2'])
+  AS_VAR_APPEND([$1], [' -Wuse-after-free=3'])
+  AS_VAR_APPEND([$1], [' -Wunused-const-variable=2'])
+  AS_VAR_APPEND([$1], [' -Wvla-larger-than=4031'])
+
+  # These are needed for older GCC versions.
+  if test -n "$GCC" && gl_gcc_version=`($CC --version) 2>/dev/null`; then
+    case $gl_gcc_version in
+      'gcc (GCC) '[[0-3]].* | \
+      'gcc (GCC) '4.[[0-7]].*)
+        AS_VAR_APPEND([$1], [' -fdiagnostics-show-option'])
+        AS_VAR_APPEND([$1], [' -funit-at-a-time'])
+          ;;
+    esac
+    case $gl_gcc_version in
+      'gcc (GCC) '[[0-9]].*)
+        AS_VAR_APPEND([$1], [' -fno-common'])
+          ;;
+    esac
+  fi
+
+  # Disable specific options as needed.
+  if test "$gl_cv_cc_nomfi_needed" = yes; then
+    AS_VAR_APPEND([$1], [' -Wno-missing-field-initializers'])
+  fi
+
+  if test "$gl_cv_cc_uninitialized_supported" = no; then
+    AS_VAR_APPEND([$1], [' -Wno-uninitialized'])
+  fi
+
+  # This warning have too many false alarms in GCC 11.2.1.
+  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101713
+  AS_VAR_APPEND([$1], [' -Wno-analyzer-malloc-leak'])
+
+  AC_LANG_POP([C])
+])
+
+# Specialization for _AC_LANG = C++.
+AC_DEFUN([gl_MANYWARN_ALL_GCC(C++)],
+[
+  gl_MANYWARN_ALL_GCC_CXX_IMPL([$1])
+])
deleted file mode 120000 (symlink)
index 7f15f7bf1b1cdc686f0ed37a2c3d693ee0bbbb5d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/math_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7ba3c048cac1d79e77ab07f8cd93cc515799adff
--- /dev/null
@@ -0,0 +1,402 @@
+# math_h.m4 serial 126
+dnl Copyright (C) 2007-2024 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_ONCE([gl_MATH_H],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  gl_CHECK_NEXT_HEADERS([math.h])
+
+  AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
+      [[/* Solaris 10 has a broken definition of NAN.  Other platforms
+        fail to provide NAN, or provide it only in C99 mode; this
+        test only needs to fail when NAN is provided but wrong.  */
+         float f = 1.0f;
+#ifdef NAN
+         f = NAN;
+#endif
+         return f == 0;]])],
+      [gl_cv_header_math_nan_works=yes],
+      [gl_cv_header_math_nan_works=no])])
+  if test $gl_cv_header_math_nan_works = no; then
+    REPLACE_NAN=1
+  fi
+  AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
+      [[/* Solaris 10 has a broken definition of HUGE_VAL.  */
+         double d = HUGE_VAL;
+         return d == 0;]])],
+      [gl_cv_header_math_huge_val_works=yes],
+      [gl_cv_header_math_huge_val_works=no])])
+  if test $gl_cv_header_math_huge_val_works = no; then
+    REPLACE_HUGE_VAL=1
+  fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <math.h>]],
+    [acosf acosl asinf asinl atanf atanl
+     cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf
+     expf expl exp2 exp2f exp2l expm1 expm1f expm1l
+     fabsf fabsl floorf floorl fma fmaf fmal
+     fmod fmodf fmodl frexpf frexpl hypotf hypotl
+     ilogb ilogbf ilogbl
+     ldexpf ldexpl
+     log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
+     logb logbf logbl
+     modf modff modfl powf
+     remainder remainderf remainderl
+     rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl
+     tanf tanl tanhf totalorder totalorderf totalorderl trunc truncf truncl])
+])
+
+# gl_MATH_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_MATH_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_MATH_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_MATH_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACOSF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACOSL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ASINF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ASINL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATANF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATANL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATAN2F])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRTL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEIL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEILF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEILL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGNF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGNL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSHF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2F])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2L])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1F])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1L])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FABSF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FABSL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOOR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOORF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOORL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMA])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMAF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMAL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMOD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMODF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMODL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGB])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10F])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10L])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1P])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1PF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1PL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2F])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2L])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POWF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDER])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDERF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDERL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINTL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUND])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINHF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SQRTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SQRTL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANHF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDER])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCL])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_J0], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_J1], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_JN], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_Y0], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_Y1], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_YN], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_MATH_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_MATH_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_ACOSF=1;                     AC_SUBST([HAVE_ACOSF])
+  HAVE_ACOSL=1;                     AC_SUBST([HAVE_ACOSL])
+  HAVE_ASINF=1;                     AC_SUBST([HAVE_ASINF])
+  HAVE_ASINL=1;                     AC_SUBST([HAVE_ASINL])
+  HAVE_ATANF=1;                     AC_SUBST([HAVE_ATANF])
+  HAVE_ATANL=1;                     AC_SUBST([HAVE_ATANL])
+  HAVE_ATAN2F=1;                    AC_SUBST([HAVE_ATAN2F])
+  HAVE_CBRT=1;                      AC_SUBST([HAVE_CBRT])
+  HAVE_CBRTF=1;                     AC_SUBST([HAVE_CBRTF])
+  HAVE_CBRTL=1;                     AC_SUBST([HAVE_CBRTL])
+  HAVE_COPYSIGN=1;                  AC_SUBST([HAVE_COPYSIGN])
+  HAVE_COPYSIGNL=1;                 AC_SUBST([HAVE_COPYSIGNL])
+  HAVE_COSF=1;                      AC_SUBST([HAVE_COSF])
+  HAVE_COSL=1;                      AC_SUBST([HAVE_COSL])
+  HAVE_COSHF=1;                     AC_SUBST([HAVE_COSHF])
+  HAVE_EXPF=1;                      AC_SUBST([HAVE_EXPF])
+  HAVE_EXPL=1;                      AC_SUBST([HAVE_EXPL])
+  HAVE_EXPM1=1;                     AC_SUBST([HAVE_EXPM1])
+  HAVE_EXPM1F=1;                    AC_SUBST([HAVE_EXPM1F])
+  HAVE_FABSF=1;                     AC_SUBST([HAVE_FABSF])
+  HAVE_FABSL=1;                     AC_SUBST([HAVE_FABSL])
+  HAVE_FMA=1;                       AC_SUBST([HAVE_FMA])
+  HAVE_FMAF=1;                      AC_SUBST([HAVE_FMAF])
+  HAVE_FMAL=1;                      AC_SUBST([HAVE_FMAL])
+  HAVE_FMODF=1;                     AC_SUBST([HAVE_FMODF])
+  HAVE_FMODL=1;                     AC_SUBST([HAVE_FMODL])
+  HAVE_FREXPF=1;                    AC_SUBST([HAVE_FREXPF])
+  HAVE_HYPOTF=1;                    AC_SUBST([HAVE_HYPOTF])
+  HAVE_HYPOTL=1;                    AC_SUBST([HAVE_HYPOTL])
+  HAVE_ILOGB=1;                     AC_SUBST([HAVE_ILOGB])
+  HAVE_ILOGBF=1;                    AC_SUBST([HAVE_ILOGBF])
+  HAVE_ILOGBL=1;                    AC_SUBST([HAVE_ILOGBL])
+  HAVE_ISNANF=1;                    AC_SUBST([HAVE_ISNANF])
+  HAVE_ISNAND=1;                    AC_SUBST([HAVE_ISNAND])
+  HAVE_ISNANL=1;                    AC_SUBST([HAVE_ISNANL])
+  HAVE_LDEXPF=1;                    AC_SUBST([HAVE_LDEXPF])
+  HAVE_LOGF=1;                      AC_SUBST([HAVE_LOGF])
+  HAVE_LOGL=1;                      AC_SUBST([HAVE_LOGL])
+  HAVE_LOG10F=1;                    AC_SUBST([HAVE_LOG10F])
+  HAVE_LOG10L=1;                    AC_SUBST([HAVE_LOG10L])
+  HAVE_LOG1P=1;                     AC_SUBST([HAVE_LOG1P])
+  HAVE_LOG1PF=1;                    AC_SUBST([HAVE_LOG1PF])
+  HAVE_LOG1PL=1;                    AC_SUBST([HAVE_LOG1PL])
+  HAVE_LOGBF=1;                     AC_SUBST([HAVE_LOGBF])
+  HAVE_LOGBL=1;                     AC_SUBST([HAVE_LOGBL])
+  HAVE_MODFF=1;                     AC_SUBST([HAVE_MODFF])
+  HAVE_MODFL=1;                     AC_SUBST([HAVE_MODFL])
+  HAVE_POWF=1;                      AC_SUBST([HAVE_POWF])
+  HAVE_REMAINDER=1;                 AC_SUBST([HAVE_REMAINDER])
+  HAVE_REMAINDERF=1;                AC_SUBST([HAVE_REMAINDERF])
+  HAVE_RINT=1;                      AC_SUBST([HAVE_RINT])
+  HAVE_RINTL=1;                     AC_SUBST([HAVE_RINTL])
+  HAVE_SINF=1;                      AC_SUBST([HAVE_SINF])
+  HAVE_SINL=1;                      AC_SUBST([HAVE_SINL])
+  HAVE_SINHF=1;                     AC_SUBST([HAVE_SINHF])
+  HAVE_SQRTF=1;                     AC_SUBST([HAVE_SQRTF])
+  HAVE_SQRTL=1;                     AC_SUBST([HAVE_SQRTL])
+  HAVE_TANF=1;                      AC_SUBST([HAVE_TANF])
+  HAVE_TANL=1;                      AC_SUBST([HAVE_TANL])
+  HAVE_TANHF=1;                     AC_SUBST([HAVE_TANHF])
+  HAVE_TOTALORDER=1;                AC_SUBST([HAVE_TOTALORDER])
+  HAVE_TOTALORDERF=1;               AC_SUBST([HAVE_TOTALORDERF])
+  HAVE_TOTALORDERL=1;               AC_SUBST([HAVE_TOTALORDERL])
+  HAVE_DECL_ACOSL=1;                AC_SUBST([HAVE_DECL_ACOSL])
+  HAVE_DECL_ASINL=1;                AC_SUBST([HAVE_DECL_ASINL])
+  HAVE_DECL_ATANL=1;                AC_SUBST([HAVE_DECL_ATANL])
+  HAVE_DECL_CBRTF=1;                AC_SUBST([HAVE_DECL_CBRTF])
+  HAVE_DECL_CBRTL=1;                AC_SUBST([HAVE_DECL_CBRTL])
+  HAVE_DECL_CEILF=1;                AC_SUBST([HAVE_DECL_CEILF])
+  HAVE_DECL_CEILL=1;                AC_SUBST([HAVE_DECL_CEILL])
+  HAVE_DECL_COPYSIGNF=1;            AC_SUBST([HAVE_DECL_COPYSIGNF])
+  HAVE_DECL_COSL=1;                 AC_SUBST([HAVE_DECL_COSL])
+  HAVE_DECL_EXPL=1;                 AC_SUBST([HAVE_DECL_EXPL])
+  HAVE_DECL_EXP2=1;                 AC_SUBST([HAVE_DECL_EXP2])
+  HAVE_DECL_EXP2F=1;                AC_SUBST([HAVE_DECL_EXP2F])
+  HAVE_DECL_EXP2L=1;                AC_SUBST([HAVE_DECL_EXP2L])
+  HAVE_DECL_EXPM1L=1;               AC_SUBST([HAVE_DECL_EXPM1L])
+  HAVE_DECL_FLOORF=1;               AC_SUBST([HAVE_DECL_FLOORF])
+  HAVE_DECL_FLOORL=1;               AC_SUBST([HAVE_DECL_FLOORL])
+  HAVE_DECL_FREXPL=1;               AC_SUBST([HAVE_DECL_FREXPL])
+  HAVE_DECL_LDEXPL=1;               AC_SUBST([HAVE_DECL_LDEXPL])
+  HAVE_DECL_LOGL=1;                 AC_SUBST([HAVE_DECL_LOGL])
+  HAVE_DECL_LOG10L=1;               AC_SUBST([HAVE_DECL_LOG10L])
+  HAVE_DECL_LOG2=1;                 AC_SUBST([HAVE_DECL_LOG2])
+  HAVE_DECL_LOG2F=1;                AC_SUBST([HAVE_DECL_LOG2F])
+  HAVE_DECL_LOG2L=1;                AC_SUBST([HAVE_DECL_LOG2L])
+  HAVE_DECL_LOGB=1;                 AC_SUBST([HAVE_DECL_LOGB])
+  HAVE_DECL_REMAINDER=1;            AC_SUBST([HAVE_DECL_REMAINDER])
+  HAVE_DECL_REMAINDERL=1;           AC_SUBST([HAVE_DECL_REMAINDERL])
+  HAVE_DECL_RINTF=1;                AC_SUBST([HAVE_DECL_RINTF])
+  HAVE_DECL_ROUND=1;                AC_SUBST([HAVE_DECL_ROUND])
+  HAVE_DECL_ROUNDF=1;               AC_SUBST([HAVE_DECL_ROUNDF])
+  HAVE_DECL_ROUNDL=1;               AC_SUBST([HAVE_DECL_ROUNDL])
+  HAVE_DECL_SINL=1;                 AC_SUBST([HAVE_DECL_SINL])
+  HAVE_DECL_SQRTL=1;                AC_SUBST([HAVE_DECL_SQRTL])
+  HAVE_DECL_TANL=1;                 AC_SUBST([HAVE_DECL_TANL])
+  HAVE_DECL_TRUNC=1;                AC_SUBST([HAVE_DECL_TRUNC])
+  HAVE_DECL_TRUNCF=1;               AC_SUBST([HAVE_DECL_TRUNCF])
+  HAVE_DECL_TRUNCL=1;               AC_SUBST([HAVE_DECL_TRUNCL])
+  REPLACE_ACOSF=0;                  AC_SUBST([REPLACE_ACOSF])
+  REPLACE_ASINF=0;                  AC_SUBST([REPLACE_ASINF])
+  REPLACE_ATANF=0;                  AC_SUBST([REPLACE_ATANF])
+  REPLACE_ATAN2F=0;                 AC_SUBST([REPLACE_ATAN2F])
+  REPLACE_CBRTF=0;                  AC_SUBST([REPLACE_CBRTF])
+  REPLACE_CBRTL=0;                  AC_SUBST([REPLACE_CBRTL])
+  REPLACE_CEIL=0;                   AC_SUBST([REPLACE_CEIL])
+  REPLACE_CEILF=0;                  AC_SUBST([REPLACE_CEILF])
+  REPLACE_CEILL=0;                  AC_SUBST([REPLACE_CEILL])
+  REPLACE_COSF=0;                   AC_SUBST([REPLACE_COSF])
+  REPLACE_COSHF=0;                  AC_SUBST([REPLACE_COSHF])
+  REPLACE_EXPF=0;                   AC_SUBST([REPLACE_EXPF])
+  REPLACE_EXPL=0;                   AC_SUBST([REPLACE_EXPL])
+  REPLACE_EXPM1=0;                  AC_SUBST([REPLACE_EXPM1])
+  REPLACE_EXPM1F=0;                 AC_SUBST([REPLACE_EXPM1F])
+  REPLACE_EXPM1L=0;                 AC_SUBST([REPLACE_EXPM1L])
+  REPLACE_EXP2=0;                   AC_SUBST([REPLACE_EXP2])
+  REPLACE_EXP2L=0;                  AC_SUBST([REPLACE_EXP2L])
+  REPLACE_FABSL=0;                  AC_SUBST([REPLACE_FABSL])
+  REPLACE_FLOOR=0;                  AC_SUBST([REPLACE_FLOOR])
+  REPLACE_FLOORF=0;                 AC_SUBST([REPLACE_FLOORF])
+  REPLACE_FLOORL=0;                 AC_SUBST([REPLACE_FLOORL])
+  REPLACE_FMA=0;                    AC_SUBST([REPLACE_FMA])
+  REPLACE_FMAF=0;                   AC_SUBST([REPLACE_FMAF])
+  REPLACE_FMAL=0;                   AC_SUBST([REPLACE_FMAL])
+  REPLACE_FMOD=0;                   AC_SUBST([REPLACE_FMOD])
+  REPLACE_FMODF=0;                  AC_SUBST([REPLACE_FMODF])
+  REPLACE_FMODL=0;                  AC_SUBST([REPLACE_FMODL])
+  REPLACE_FREXPF=0;                 AC_SUBST([REPLACE_FREXPF])
+  REPLACE_FREXP=0;                  AC_SUBST([REPLACE_FREXP])
+  REPLACE_FREXPL=0;                 AC_SUBST([REPLACE_FREXPL])
+  REPLACE_HUGE_VAL=0;               AC_SUBST([REPLACE_HUGE_VAL])
+  REPLACE_HYPOT=0;                  AC_SUBST([REPLACE_HYPOT])
+  REPLACE_HYPOTF=0;                 AC_SUBST([REPLACE_HYPOTF])
+  REPLACE_HYPOTL=0;                 AC_SUBST([REPLACE_HYPOTL])
+  REPLACE_ILOGB=0;                  AC_SUBST([REPLACE_ILOGB])
+  REPLACE_ILOGBF=0;                 AC_SUBST([REPLACE_ILOGBF])
+  REPLACE_ILOGBL=0;                 AC_SUBST([REPLACE_ILOGBL])
+  REPLACE_ISFINITE=0;               AC_SUBST([REPLACE_ISFINITE])
+  REPLACE_ISINF=0;                  AC_SUBST([REPLACE_ISINF])
+  REPLACE_ISNAN=0;                  AC_SUBST([REPLACE_ISNAN])
+  REPLACE_LDEXP=0;                  AC_SUBST([REPLACE_LDEXP])
+  REPLACE_LDEXPL=0;                 AC_SUBST([REPLACE_LDEXPL])
+  REPLACE_LOG=0;                    AC_SUBST([REPLACE_LOG])
+  REPLACE_LOGF=0;                   AC_SUBST([REPLACE_LOGF])
+  REPLACE_LOGL=0;                   AC_SUBST([REPLACE_LOGL])
+  REPLACE_LOG10=0;                  AC_SUBST([REPLACE_LOG10])
+  REPLACE_LOG10F=0;                 AC_SUBST([REPLACE_LOG10F])
+  REPLACE_LOG10L=0;                 AC_SUBST([REPLACE_LOG10L])
+  REPLACE_LOG1P=0;                  AC_SUBST([REPLACE_LOG1P])
+  REPLACE_LOG1PF=0;                 AC_SUBST([REPLACE_LOG1PF])
+  REPLACE_LOG1PL=0;                 AC_SUBST([REPLACE_LOG1PL])
+  REPLACE_LOG2=0;                   AC_SUBST([REPLACE_LOG2])
+  REPLACE_LOG2F=0;                  AC_SUBST([REPLACE_LOG2F])
+  REPLACE_LOG2L=0;                  AC_SUBST([REPLACE_LOG2L])
+  REPLACE_LOGB=0;                   AC_SUBST([REPLACE_LOGB])
+  REPLACE_LOGBF=0;                  AC_SUBST([REPLACE_LOGBF])
+  REPLACE_LOGBL=0;                  AC_SUBST([REPLACE_LOGBL])
+  REPLACE_MODF=0;                   AC_SUBST([REPLACE_MODF])
+  REPLACE_MODFF=0;                  AC_SUBST([REPLACE_MODFF])
+  REPLACE_MODFL=0;                  AC_SUBST([REPLACE_MODFL])
+  REPLACE_NAN=0;                    AC_SUBST([REPLACE_NAN])
+  REPLACE_REMAINDER=0;              AC_SUBST([REPLACE_REMAINDER])
+  REPLACE_REMAINDERF=0;             AC_SUBST([REPLACE_REMAINDERF])
+  REPLACE_REMAINDERL=0;             AC_SUBST([REPLACE_REMAINDERL])
+  REPLACE_RINTL=0;                  AC_SUBST([REPLACE_RINTL])
+  REPLACE_ROUND=0;                  AC_SUBST([REPLACE_ROUND])
+  REPLACE_ROUNDF=0;                 AC_SUBST([REPLACE_ROUNDF])
+  REPLACE_ROUNDL=0;                 AC_SUBST([REPLACE_ROUNDL])
+  REPLACE_SIGNBIT=0;                AC_SUBST([REPLACE_SIGNBIT])
+  REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS])
+  REPLACE_SINF=0;                   AC_SUBST([REPLACE_SINF])
+  REPLACE_SINHF=0;                  AC_SUBST([REPLACE_SINHF])
+  REPLACE_SQRTF=0;                  AC_SUBST([REPLACE_SQRTF])
+  REPLACE_SQRTL=0;                  AC_SUBST([REPLACE_SQRTL])
+  REPLACE_TANF=0;                   AC_SUBST([REPLACE_TANF])
+  REPLACE_TANHF=0;                  AC_SUBST([REPLACE_TANHF])
+  REPLACE_TOTALORDER=0;             AC_SUBST([REPLACE_TOTALORDER])
+  REPLACE_TOTALORDERF=0;            AC_SUBST([REPLACE_TOTALORDERF])
+  REPLACE_TOTALORDERL=0;            AC_SUBST([REPLACE_TOTALORDERL])
+  REPLACE_TRUNC=0;                  AC_SUBST([REPLACE_TRUNC])
+  REPLACE_TRUNCF=0;                 AC_SUBST([REPLACE_TRUNCF])
+  REPLACE_TRUNCL=0;                 AC_SUBST([REPLACE_TRUNCL])
+])
+
+# gl_LONG_DOUBLE_VS_DOUBLE
+# determines whether 'long double' and 'double' have the same representation.
+# Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines
+# HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly.
+# The currently known platforms where this is the case are:
+# Linux/HPPA, NetBSD/sparc32, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9.
+AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE],
+[
+  AC_CACHE_CHECK([whether long double and double are the same],
+    [gl_cv_long_double_equals_double],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[#include <float.h>]],
+          [[typedef int check[sizeof (long double) == sizeof (double)
+                              && LDBL_MANT_DIG == DBL_MANT_DIG
+                              && LDBL_MAX_EXP == DBL_MAX_EXP
+                              && LDBL_MIN_EXP == DBL_MIN_EXP
+                              ? 1 : -1];
+          ]])],
+       [gl_cv_long_double_equals_double=yes],
+       [gl_cv_long_double_equals_double=no])
+    ])
+  if test $gl_cv_long_double_equals_double = yes; then
+    AC_DEFINE([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE], [1],
+      [Define to 1 if 'long double' and 'double' have the same representation.])
+    HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=1
+  else
+    HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=0
+  fi
+  AC_SUBST([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE])
+])
deleted file mode 120000 (symlink)
index d18213e2a4ac0363ea20eec371f32faae8909df4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mbrlen.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6516e8eb791ce72f49bdbf70542be72dae39b957
--- /dev/null
@@ -0,0 +1,240 @@
+# mbrlen.m4 serial 12  -*- coding: utf-8 -*-
+dnl Copyright (C) 2008, 2010-2024 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_MBRLEN],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  AC_REQUIRE([gl_FUNC_MBRTOWC])
+  AC_CHECK_FUNCS_ONCE([mbrlen])
+  if test $ac_cv_func_mbrlen = no; then
+    HAVE_MBRLEN=0
+    AC_CHECK_DECLS([mbrlen],,, [[
+      #include <wchar.h>
+    ]])
+    if test $ac_cv_have_decl_mbrlen = yes; then
+      dnl On Minix 3.1.8, the system's <wchar.h> declares mbrlen() although
+      dnl it does not have the function. Avoid a collision with gnulib's
+      dnl replacement.
+      REPLACE_MBRLEN=1
+    fi
+  else
+    dnl Most bugs affecting the system's mbrtowc function also affect the
+    dnl mbrlen function. So override mbrlen whenever mbrtowc is overridden.
+    dnl We could also run the individual tests below; the results would be
+    dnl the same.
+    if test $REPLACE_MBRTOWC = 1; then
+      REPLACE_MBRLEN=1
+    fi
+  fi
+])
+
+dnl Test whether mbrlen puts the state into non-initial state when parsing an
+dnl incomplete multibyte character.
+dnl Result is gl_cv_func_mbrlen_incomplete_state.
+
+AC_DEFUN([gl_MBRLEN_INCOMPLETE_STATE],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_JA])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrlen handles incomplete characters],
+    [gl_cv_func_mbrlen_incomplete_state],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                     # Guess no on AIX and OSF/1.
+        aix* | osf*) gl_cv_func_mbrlen_incomplete_state="guessing no" ;;
+                     # Guess yes otherwise.
+        *)           gl_cv_func_mbrlen_incomplete_state="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_JA != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrlen (input + 1, 1, &state) == (size_t)(-2))
+        if (mbsinit (&state))
+          return 1;
+    }
+  return 0;
+}]])],
+          [gl_cv_func_mbrlen_incomplete_state=yes],
+          [gl_cv_func_mbrlen_incomplete_state=no],
+          [])
+      fi
+    ])
+])
+
+dnl Test whether mbrlen, when parsing the end of a multibyte character,
+dnl correctly returns the number of bytes that were needed to complete the
+dnl character (not the total number of bytes of the multibyte character).
+dnl Result is gl_cv_func_mbrlen_retval.
+
+AC_DEFUN([gl_MBRLEN_RETVAL],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([gt_LOCALE_JA])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrlen has a correct return value],
+    [gl_cv_func_mbrlen_retval],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                          # Guess no on HP-UX and Solaris.
+        hpux* | solaris*) gl_cv_func_mbrlen_retval="guessing no" ;;
+                          # Guess yes otherwise.
+        *)                gl_cv_func_mbrlen_retval="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  int result = 0;
+  /* This fails on Solaris.  */
+  if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      char input[] = "B\303\274\303\237er"; /* "Büßer" */
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrlen (input + 1, 1, &state) == (size_t)(-2))
+        {
+          input[1] = '\0';
+          if (mbrlen (input + 2, 5, &state) != 1)
+            result |= 1;
+        }
+    }
+  /* This fails on HP-UX 11.11.  */
+  if (strcmp ("$LOCALE_JA", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrlen (input + 1, 1, &state) == (size_t)(-2))
+        {
+          input[1] = '\0';
+          if (mbrlen (input + 2, 5, &state) != 2)
+            result |= 2;
+        }
+    }
+  return result;
+}]])],
+          [gl_cv_func_mbrlen_retval=yes],
+          [gl_cv_func_mbrlen_retval=no],
+          [])
+      fi
+    ])
+])
+
+dnl Test whether mbrlen, when parsing a NUL character, correctly returns 0.
+dnl Result is gl_cv_func_mbrlen_nul_retval.
+
+AC_DEFUN([gl_MBRLEN_NUL_RETVAL],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrlen returns 0 when parsing a NUL character],
+    [gl_cv_func_mbrlen_nul_retval],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                    # Guess no on Solaris 9.
+        solaris2.9) gl_cv_func_mbrlen_nul_retval="guessing no" ;;
+                    # Guess yes otherwise.
+        *)          gl_cv_func_mbrlen_nul_retval="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_ZH_CN != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  /* This crashes on Solaris 9 inside __mbrtowc_dense_gb18030.  */
+  if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrlen ("", 1, &state) != 0)
+        return 1;
+    }
+  return 0;
+}]])],
+          [gl_cv_func_mbrlen_nul_retval=yes],
+          [gl_cv_func_mbrlen_nul_retval=no],
+          [])
+      fi
+    ])
+])
+
+dnl Test whether mbrlen returns the correct value on empty input.
+
+AC_DEFUN([gl_MBRLEN_EMPTY_INPUT],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrlen works on empty input],
+    [gl_cv_func_mbrlen_empty_input],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                              # Guess no on AIX and glibc systems.
+        aix* | *-gnu* | gnu*) gl_cv_func_mbrlen_empty_input="guessing no" ;;
+        *)                    gl_cv_func_mbrlen_empty_input="guessing yes" ;;
+      esac
+changequote([,])dnl
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+           #include <wchar.h>
+           static mbstate_t mbs;
+           int
+           main (void)
+           {
+             return mbrlen ("", 0, &mbs) != (size_t) -2;
+           }]])],
+        [gl_cv_func_mbrlen_empty_input=yes],
+        [gl_cv_func_mbrlen_empty_input=no],
+        [:])
+    ])
+])
+
+# Prerequisites of lib/mbrlen.c.
+AC_DEFUN([gl_PREREQ_MBRLEN], [
+  :
+])
deleted file mode 120000 (symlink)
index 47eae957a405797b903ad9cf9ff1e79bdb769f35..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mbrtoc32.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c1eb126a4eec5e108c2c868f6792c96afe960d53
--- /dev/null
@@ -0,0 +1,266 @@
+# mbrtoc32.m4 serial 18
+dnl Copyright (C) 2014-2024 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_MBRTOC32],
+[
+  AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
+  dnl determined.  It describes how our overridden mbrtowc is implemented.
+  dnl We then implement mbrtoc32 accordingly.
+  AC_REQUIRE([gl_MBSTATE_T_BROKEN])
+
+  AC_REQUIRE([gl_TYPE_CHAR32_T])
+  AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+
+  AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32])
+  if test $gl_cv_func_mbrtoc32 = no; then
+    HAVE_MBRTOC32=0
+  else
+    if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $REPLACE_MBSTATE_T = 1; then
+      REPLACE_MBRTOC32=1
+    else
+      gl_MBRTOC32_EMPTY_INPUT
+      gl_MBRTOC32_C_LOCALE
+      case "$gl_cv_func_mbrtoc32_empty_input" in
+        *yes) ;;
+        *) AC_DEFINE([MBRTOC32_EMPTY_INPUT_BUG], [1],
+             [Define if the mbrtoc32 function does not return (size_t) -2 for empty input.])
+           REPLACE_MBRTOC32=1
+           ;;
+      esac
+      case "$gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ" in
+        *yes) ;;
+        *) AC_DEFINE([MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ], [1],
+             [Define if the mbrtoc32 function may signal encoding errors in the C locale.])
+           REPLACE_MBRTOC32=1
+           ;;
+      esac
+    fi
+    if test $HAVE_WORKING_MBRTOC32 = 0; then
+      REPLACE_MBRTOC32=1
+    fi
+  fi
+])
+
+AC_DEFUN([gl_CHECK_FUNC_MBRTOC32],
+[
+  dnl Cf. gl_CHECK_FUNCS_ANDROID
+  AC_CHECK_DECL([mbrtoc32], , ,
+    [[#ifdef __HAIKU__
+       #include <stdint.h>
+      #endif
+      #include <uchar.h>
+    ]])
+  if test $ac_cv_have_decl_mbrtoc32 = yes; then
+    dnl We can't use AC_CHECK_FUNC here, because mbrtoc32() is defined as a
+    dnl static inline function on Haiku 2020.
+    AC_CACHE_CHECK([for mbrtoc32], [gl_cv_func_mbrtoc32],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <stdlib.h>
+              #ifdef __HAIKU__
+               #include <stdint.h>
+              #endif
+              #include <uchar.h>
+            ]],
+            [[char32_t c;
+              return mbrtoc32 (&c, "", 1, NULL) == 0;
+            ]])
+         ],
+         [gl_cv_func_mbrtoc32=yes],
+         [gl_cv_func_mbrtoc32=no])
+      ])
+  else
+    gl_cv_func_mbrtoc32=no
+  fi
+])
+
+dnl Test whether mbrtoc32 returns the correct value on empty input.
+
+AC_DEFUN([gl_MBRTOC32_EMPTY_INPUT],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtoc32 works on empty input],
+    [gl_cv_func_mbrtoc32_empty_input],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+           #ifdef __HAIKU__
+            #include <stdint.h>
+           #endif
+           #include <uchar.h>
+           static char32_t wc;
+           static mbstate_t mbs;
+           int
+           main (void)
+           {
+             return mbrtoc32 (&wc, "", 0, &mbs) != (size_t) -2;
+           }]])],
+        [gl_cv_func_mbrtoc32_empty_input=yes],
+        [gl_cv_func_mbrtoc32_empty_input=no],
+        [case "$host_os" in
+                              # Guess no on glibc systems.
+           *-gnu* | gnu*)     gl_cv_func_mbrtoc32_empty_input="guessing no" ;;
+                              # Guess no on Android.
+           linux*-android*)   gl_cv_func_mbrtoc32_empty_input="guessing no" ;;
+                              # Guess no on native Windows.
+           mingw* | windows*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;;
+           *)                 gl_cv_func_mbrtoc32_empty_input="guessing yes" ;;
+         esac
+        ])
+    ])
+])
+
+dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html>
+dnl POSIX:2018 says regarding mbrtowc: "In the POSIX locale an [EILSEQ] error
+dnl cannot occur since all byte values are valid characters."  It is reasonable
+dnl to expect mbrtoc32 to behave in the same way.
+
+AC_DEFUN([gl_MBRTOC32_C_LOCALE],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether the C locale is free of encoding errors],
+    [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <limits.h>
+            #include <locale.h>
+            #ifdef __HAIKU__
+             #include <stdint.h>
+            #endif
+            #include <uchar.h>
+          ]], [[
+            int i;
+            char *locale = setlocale (LC_ALL, "C");
+            if (! locale)
+              return 2;
+            for (i = CHAR_MIN; i <= CHAR_MAX; i++)
+              {
+                char c = i;
+                char32_t wc;
+                mbstate_t mbs = { 0, };
+                size_t ss = mbrtoc32 (&wc, &c, 1, &mbs);
+                if (1 < ss)
+                  return 3;
+              }
+            return 0;
+          ]])],
+       [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=yes],
+       [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=no],
+       [case "$host_os" in
+                             # Guess yes on native Windows.
+          mingw* | windows*) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="guessing yes" ;;
+          *)                 gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
+])
+
+dnl Test whether mbrtoc32 works not worse than mbrtowc.
+dnl Result is HAVE_WORKING_MBRTOC32.
+
+AC_DEFUN([gl_MBRTOC32_SANITYCHECK],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_TYPE_CHAR32_T])
+  AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32])
+  AC_REQUIRE([gt_LOCALE_FR])
+  AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_mbrtoc32 = no; then
+    HAVE_WORKING_MBRTOC32=0
+  else
+    AC_CACHE_CHECK([whether mbrtoc32 works as well as mbrtowc],
+      [gl_cv_func_mbrtoc32_sanitycheck],
+      [
+        dnl Initial guess, used when cross-compiling or when no suitable locale
+        dnl is present.
+changequote(,)dnl
+        case "$host_os" in
+          # Guess no on FreeBSD, Solaris, native Windows.
+          freebsd* | midnightbsd* | solaris* | mingw* | windows*)
+            gl_cv_func_mbrtoc32_sanitycheck="guessing no"
+            ;;
+          # Guess yes otherwise.
+          *)
+            gl_cv_func_mbrtoc32_sanitycheck="guessing yes"
+            ;;
+        esac
+changequote([,])dnl
+        if test $LOCALE_FR != none || test $LOCALE_ZH_CN != none; then
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#ifdef __HAIKU__
+ #include <stdint.h>
+#endif
+#include <uchar.h>
+int main ()
+{
+  int result = 0;
+  /* This fails on native Windows:
+     mbrtoc32 returns (size_t)-1.
+     mbrtowc returns 1 (correct).  */
+  if (strcmp ("$LOCALE_FR", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+    {
+      mbstate_t state;
+      wchar_t wc = (wchar_t) 0xBADFACE;
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, "\374", 1, &state) == 1)
+        {
+          char32_t c32 = (wchar_t) 0xBADFACE;
+          memset (&state, '\0', sizeof (mbstate_t));
+          if (mbrtoc32 (&c32, "\374", 1, &state) != 1)
+            result |= 1;
+        }
+    }
+  /* This fails on FreeBSD 13.0 and Solaris 11.4:
+     mbrtoc32 returns (size_t)-2 or (size_t)-1.
+     mbrtowc returns 4 (correct).  */
+  if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      mbstate_t state;
+      wchar_t wc = (wchar_t) 0xBADFACE;
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, "\224\071\375\067", 4, &state) == 4)
+        {
+          char32_t c32 = (wchar_t) 0xBADFACE;
+          memset (&state, '\0', sizeof (mbstate_t));
+          if (mbrtoc32 (&c32, "\224\071\375\067", 4, &state) != 4)
+            result |= 2;
+        }
+    }
+  return result;
+}]])],
+            [gl_cv_func_mbrtoc32_sanitycheck=yes],
+            [gl_cv_func_mbrtoc32_sanitycheck=no],
+            [:])
+        fi
+      ])
+    case "$gl_cv_func_mbrtoc32_sanitycheck" in
+      *yes)
+        HAVE_WORKING_MBRTOC32=1
+        AC_DEFINE([HAVE_WORKING_MBRTOC32], [1],
+          [Define if the mbrtoc32 function basically works.])
+        ;;
+      *) HAVE_WORKING_MBRTOC32=0 ;;
+    esac
+  fi
+  AC_SUBST([HAVE_WORKING_MBRTOC32])
+])
+
+# Prerequisites of lib/mbrtoc32.c and lib/lc-charset-dispatch.c.
+AC_DEFUN([gl_PREREQ_MBRTOC32], [
+  :
+])
deleted file mode 120000 (symlink)
index 7498069315ab1e73a63623d76b7790b3c1cf8ecb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mbrtowc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6ff518246e8db34a05ee66a09c7b5a02b044229d
--- /dev/null
@@ -0,0 +1,796 @@
+# mbrtowc.m4 serial 44  -*- coding: utf-8 -*-
+dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation,
+dnl 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_MBRTOWC],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([gl_PTHREADLIB])
+  AC_CHECK_HEADERS_ONCE([threads.h])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  gl_MBSTATE_T_BROKEN
+
+  AC_CHECK_FUNCS_ONCE([mbrtowc])
+  if test $ac_cv_func_mbrtowc = no; then
+    HAVE_MBRTOWC=0
+    AC_CHECK_DECLS([mbrtowc],,, [[
+      #include <wchar.h>
+    ]])
+    if test $ac_cv_have_decl_mbrtowc = yes; then
+      dnl On Minix 3.1.8, the system's <wchar.h> declares mbrtowc() although
+      dnl it does not have the function. Avoid a collision with gnulib's
+      dnl replacement.
+      REPLACE_MBRTOWC=1
+    fi
+  else
+    if test $REPLACE_MBSTATE_T = 1; then
+      REPLACE_MBRTOWC=1
+    else
+      gl_MBRTOWC_NULL_ARG1
+      gl_MBRTOWC_NULL_ARG2
+      gl_MBRTOWC_RETVAL
+      gl_MBRTOWC_NUL_RETVAL
+      gl_MBRTOWC_STORES_INCOMPLETE
+      gl_MBRTOWC_EMPTY_INPUT
+      gl_MBRTOWC_C_LOCALE
+      case "$gl_cv_func_mbrtowc_null_arg1" in
+        *yes) ;;
+        *) AC_DEFINE([MBRTOWC_NULL_ARG1_BUG], [1],
+             [Define if the mbrtowc function has the NULL pwc argument bug.])
+           REPLACE_MBRTOWC=1
+           ;;
+      esac
+      case "$gl_cv_func_mbrtowc_null_arg2" in
+        *yes) ;;
+        *) AC_DEFINE([MBRTOWC_NULL_ARG2_BUG], [1],
+             [Define if the mbrtowc function has the NULL string argument bug.])
+           REPLACE_MBRTOWC=1
+           ;;
+      esac
+      case "$gl_cv_func_mbrtowc_retval" in
+        *yes) ;;
+        *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1],
+             [Define if the mbrtowc function returns a wrong return value.])
+           REPLACE_MBRTOWC=1
+           ;;
+      esac
+      case "$gl_cv_func_mbrtowc_nul_retval" in
+        *yes) ;;
+        *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1],
+             [Define if the mbrtowc function does not return 0 for a NUL character.])
+           REPLACE_MBRTOWC=1
+           ;;
+      esac
+      case "$gl_cv_func_mbrtowc_stores_incomplete" in
+        *no) ;;
+        *) AC_DEFINE([MBRTOWC_STORES_INCOMPLETE_BUG], [1],
+             [Define if the mbrtowc function stores a wide character when reporting incomplete input.])
+           REPLACE_MBRTOWC=1
+           ;;
+      esac
+      case "$gl_cv_func_mbrtowc_empty_input" in
+        *yes) ;;
+        *) AC_DEFINE([MBRTOWC_EMPTY_INPUT_BUG], [1],
+             [Define if the mbrtowc function does not return (size_t) -2
+              for empty input.])
+           REPLACE_MBRTOWC=1
+           ;;
+      esac
+      case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in
+        *yes) ;;
+        *) AC_DEFINE([MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ], [1],
+             [Define if the mbrtowc function may signal encoding errors in the C locale.])
+           REPLACE_MBRTOWC=1
+           ;;
+      esac
+    fi
+  fi
+  if test $REPLACE_MBSTATE_T = 1; then
+    case "$host_os" in
+      mingw* | windows*)
+        MBRTOWC_LIB=
+        ;;
+      *)
+        gl_WEAK_SYMBOLS
+        case "$gl_cv_have_weak" in
+          *yes) MBRTOWC_LIB= ;;
+          *)    MBRTOWC_LIB="$LIBPTHREAD" ;;
+        esac
+        ;;
+    esac
+  else
+    MBRTOWC_LIB=
+  fi
+  dnl MBRTOWC_LIB is expected to be '-pthread' or '-lpthread' on AIX
+  dnl with gcc or xlc, and empty otherwise.
+  AC_SUBST([MBRTOWC_LIB])
+  dnl For backward compatibility.
+  LIB_MBRTOWC="$MBRTOWC_LIB"
+  AC_SUBST([LIB_MBRTOWC])
+])
+
+dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that
+dnl redefines the semantics of the given mbstate_t type.
+dnl Result is REPLACE_MBSTATE_T.
+dnl When this is set to 1, we replace both mbsinit() and mbrtowc(), in order to
+dnl avoid inconsistencies.
+
+AC_DEFUN_ONCE([gl_MBSTATE_T_BROKEN],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  AC_CHECK_FUNCS_ONCE([mbsinit])
+  AC_CHECK_FUNCS_ONCE([mbrtowc])
+  dnl On native Windows, we know exactly how mbsinit() behaves and don't need
+  dnl to override it, even if - like on MSVC - mbsinit() is only defined as
+  dnl an inline function, not as a global function.
+  if case "$host_os" in
+       mingw* | windows*) true ;;
+       *) test $ac_cv_func_mbsinit = yes ;;
+     esac \
+    && test $ac_cv_func_mbrtowc = yes; then
+    gl_MBRTOWC_INCOMPLETE_STATE
+    gl_MBRTOWC_SANITYCHECK
+    REPLACE_MBSTATE_T=0
+    case "$gl_cv_func_mbrtowc_incomplete_state" in
+      *yes) ;;
+      *) REPLACE_MBSTATE_T=1 ;;
+    esac
+    case "$gl_cv_func_mbrtowc_sanitycheck" in
+      *yes) ;;
+      *) REPLACE_MBSTATE_T=1 ;;
+    esac
+  else
+    REPLACE_MBSTATE_T=1
+  fi
+])
+
+dnl Test whether mbrtowc puts the state into non-initial state when parsing an
+dnl incomplete multibyte character.
+dnl Result is gl_cv_func_mbrtowc_incomplete_state.
+
+AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_JA])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc handles incomplete characters],
+    [gl_cv_func_mbrtowc_incomplete_state],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                     # Guess no on AIX and OSF/1.
+        aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;;
+                     # Guess yes otherwise.
+        *)           gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_JA != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
+        if (mbsinit (&state))
+          return 2;
+    }
+  return 0;
+}]])],
+          [gl_cv_func_mbrtowc_incomplete_state=yes],
+          [gl_cv_func_mbrtowc_incomplete_state=no],
+          [:])
+      else
+        if test $LOCALE_FR_UTF8 != none; then
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      const char input[] = "B\303\274\303\237er"; /* "Büßer" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
+        if (mbsinit (&state))
+          return 2;
+    }
+  return 0;
+}]])],
+          [gl_cv_func_mbrtowc_incomplete_state=yes],
+          [gl_cv_func_mbrtowc_incomplete_state=no],
+          [:])
+        fi
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc works not worse than mbtowc.
+dnl Result is gl_cv_func_mbrtowc_sanitycheck.
+
+AC_DEFUN([gl_MBRTOWC_SANITYCHECK],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc works as well as mbtowc],
+    [gl_cv_func_mbrtowc_sanitycheck],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                    # Guess no on Solaris 8.
+        solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;;
+                    # Guess yes otherwise.
+        *)          gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_ZH_CN != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  /* This fails on Solaris 8:
+     mbrtowc returns 2, and sets wc to 0x00F0.
+     mbtowc returns 4 (correct) and sets wc to 0x5EDC.  */
+  if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 3, 6, &state) != 4
+          && mbtowc (&wc, input + 3, 6) == 4)
+        return 2;
+    }
+  return 0;
+}]])],
+          [gl_cv_func_mbrtowc_sanitycheck=yes],
+          [gl_cv_func_mbrtowc_sanitycheck=no],
+          [:])
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc supports a NULL pwc argument correctly.
+dnl Result is gl_cv_func_mbrtowc_null_arg1.
+
+AC_DEFUN([gl_MBRTOWC_NULL_ARG1],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument],
+    [gl_cv_func_mbrtowc_null_arg1],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                  # Guess no on Solaris.
+        solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;;
+                  # Guess yes otherwise.
+        *)        gl_cv_func_mbrtowc_null_arg1="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_FR_UTF8 != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  int result = 0;
+
+  if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      char input[] = "\303\237er";
+      mbstate_t state;
+      wchar_t wc;
+      size_t ret;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      wc = (wchar_t) 0xBADFACE;
+      ret = mbrtowc (&wc, input, 5, &state);
+      if (ret != 2)
+        result |= 1;
+      if (!mbsinit (&state))
+        result |= 2;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      ret = mbrtowc (NULL, input, 5, &state);
+      if (ret != 2) /* Solaris 7 fails here: ret is -1.  */
+        result |= 4;
+      if (!mbsinit (&state))
+        result |= 8;
+    }
+  return result;
+}]])],
+          [gl_cv_func_mbrtowc_null_arg1=yes],
+          [gl_cv_func_mbrtowc_null_arg1=no],
+          [:])
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc supports a NULL string argument correctly.
+dnl Result is gl_cv_func_mbrtowc_null_arg2.
+
+AC_DEFUN([gl_MBRTOWC_NULL_ARG2],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument],
+    [gl_cv_func_mbrtowc_null_arg2],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+              # Guess no on OSF/1.
+        osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;;
+              # Guess yes otherwise.
+        *)    gl_cv_func_mbrtowc_null_arg2="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_FR_UTF8 != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      mbstate_t state;
+      wchar_t wc;
+      int ret;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      wc = (wchar_t) 0xBADFACE;
+      mbrtowc (&wc, NULL, 5, &state);
+      /* Check that wc was not modified.  */
+      if (wc != (wchar_t) 0xBADFACE)
+        return 2;
+    }
+  return 0;
+}]])],
+          [gl_cv_func_mbrtowc_null_arg2=yes],
+          [gl_cv_func_mbrtowc_null_arg2=no],
+          [:])
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc, when parsing the end of a multibyte character,
+dnl correctly returns the number of bytes that were needed to complete the
+dnl character (not the total number of bytes of the multibyte character).
+dnl Result is gl_cv_func_mbrtowc_retval.
+
+AC_DEFUN([gl_MBRTOWC_RETVAL],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([gt_LOCALE_JA])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([whether mbrtowc has a correct return value],
+    [gl_cv_func_mbrtowc_retval],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+          # Guess no on HP-UX, Solaris, native Windows.
+        hpux* | solaris* | mingw* | windows*)
+          gl_cv_func_mbrtowc_retval="guessing no" ;;
+          # Guess yes otherwise.
+        *)
+          gl_cv_func_mbrtowc_retval="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \
+         || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  int result = 0;
+  int found_some_locale = 0;
+  /* This fails on Solaris.  */
+  if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      char input[] = "B\303\274\303\237er"; /* "Büßer" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
+        {
+          input[1] = '\0';
+          if (mbrtowc (&wc, input + 2, 5, &state) != 1)
+            result |= 1;
+        }
+      found_some_locale = 1;
+    }
+  /* This fails on HP-UX 11.11.  */
+  if (strcmp ("$LOCALE_JA", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
+        {
+          input[1] = '\0';
+          if (mbrtowc (&wc, input + 2, 5, &state) != 2)
+            result |= 2;
+        }
+      found_some_locale = 1;
+    }
+  /* This fails on native Windows.  */
+  if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL)
+    {
+      char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2))
+        {
+          input[3] = '\0';
+          if (mbrtowc (&wc, input + 4, 4, &state) != 1)
+            result |= 4;
+        }
+      found_some_locale = 1;
+    }
+  if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL)
+    {
+      char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2))
+        {
+          input[3] = '\0';
+          if (mbrtowc (&wc, input + 4, 4, &state) != 1)
+            result |= 8;
+        }
+      found_some_locale = 1;
+    }
+  if (setlocale (LC_ALL, "Chinese_China.936") != NULL)
+    {
+      char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2))
+        {
+          input[3] = '\0';
+          if (mbrtowc (&wc, input + 4, 4, &state) != 1)
+            result |= 16;
+        }
+      found_some_locale = 1;
+    }
+  return (found_some_locale ? result : 77);
+}]])],
+          [gl_cv_func_mbrtowc_retval=yes],
+          [if test $? != 77; then
+             gl_cv_func_mbrtowc_retval=no
+           fi
+          ],
+          [:])
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc, when parsing a NUL character, correctly returns 0.
+dnl Result is gl_cv_func_mbrtowc_nul_retval.
+
+AC_DEFUN([gl_MBRTOWC_NUL_RETVAL],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc returns 0 when parsing a NUL character],
+    [gl_cv_func_mbrtowc_nul_retval],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                       # Guess no on Solaris 8 and 9.
+        solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;;
+                       # Guess yes otherwise.
+        *)             gl_cv_func_mbrtowc_nul_retval="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_ZH_CN != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  /* This fails on Solaris 8 and 9.  */
+  if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      mbstate_t state;
+      wchar_t wc;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, "", 1, &state) != 0)
+        return 2;
+    }
+  return 0;
+}]])],
+          [gl_cv_func_mbrtowc_nul_retval=yes],
+          [gl_cv_func_mbrtowc_nul_retval=no],
+          [:])
+      fi
+    ])
+])
+
+dnl Test whether mbrtowc stores a wide character when reporting incomplete
+dnl input.
+
+AC_DEFUN([gl_MBRTOWC_STORES_INCOMPLETE],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc stores incomplete characters],
+    [gl_cv_func_mbrtowc_stores_incomplete],
+    [
+     dnl Initial guess, used when cross-compiling or when no suitable locale
+     dnl is present.
+changequote(,)dnl
+     case "$host_os" in
+                          # Guess yes on native Windows.
+       mingw* | windows*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;;
+       *)                 gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;;
+     esac
+changequote([,])dnl
+     case "$host_os" in
+       mingw* | windows*)
+         AC_RUN_IFELSE(
+           [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  int result = 0;
+  if (setlocale (LC_ALL, "French_France.65001") != NULL)
+    {
+      wchar_t wc = (wchar_t) 0xBADFACE;
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2)
+          && wc != (wchar_t) 0xBADFACE)
+        result |= 1;
+    }
+  if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL)
+    {
+      wchar_t wc = (wchar_t) 0xBADFACE;
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, "\226", 1, &state) == (size_t)(-2)
+          && wc != (wchar_t) 0xBADFACE)
+        result |= 2;
+    }
+  if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL)
+    {
+      wchar_t wc = (wchar_t) 0xBADFACE;
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, "\245", 1, &state) == (size_t)(-2)
+          && wc != (wchar_t) 0xBADFACE)
+        result |= 4;
+    }
+  if (setlocale (LC_ALL, "Chinese_China.936") != NULL)
+    {
+      wchar_t wc = (wchar_t) 0xBADFACE;
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, "\261", 1, &state) == (size_t)(-2)
+          && wc != (wchar_t) 0xBADFACE)
+        result |= 8;
+    }
+  return result;
+}]])],
+           [gl_cv_func_mbrtowc_stores_incomplete=no],
+           [gl_cv_func_mbrtowc_stores_incomplete=yes],
+           [:])
+         ;;
+       *)
+         AC_REQUIRE([gt_LOCALE_FR_UTF8])
+         if test $LOCALE_FR_UTF8 != none; then
+           AC_RUN_IFELSE(
+             [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      wchar_t wc = (wchar_t) 0xBADFACE;
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2)
+          && wc != (wchar_t) 0xBADFACE)
+        return 1;
+    }
+  return 0;
+}]])],
+             [gl_cv_func_mbrtowc_stores_incomplete=no],
+             [gl_cv_func_mbrtowc_stores_incomplete=yes],
+             [:])
+         fi
+         ;;
+     esac
+    ])
+])
+
+dnl Test whether mbrtowc returns the correct value on empty input.
+
+AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbrtowc works on empty input],
+    [gl_cv_func_mbrtowc_empty_input],
+    [AC_RUN_IFELSE(
+       [AC_LANG_SOURCE([[
+          #include <wchar.h>
+          static wchar_t wc;
+          static mbstate_t mbs;
+          int
+          main (void)
+          {
+            return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2;
+          }]])],
+       [gl_cv_func_mbrtowc_empty_input=yes],
+       [gl_cv_func_mbrtowc_empty_input=no],
+       [case "$host_os" in
+                                # Guess no on AIX and glibc systems.
+          aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;;
+                                # Guess no on Android.
+          linux*-android*)      gl_cv_func_mbrtowc_empty_input="guessing no" ;;
+                                # Guess no on native Windows.
+          mingw* | windows*)    gl_cv_func_mbrtowc_empty_input="guessing no" ;;
+          *)                    gl_cv_func_mbrtowc_empty_input="guessing yes" ;;
+        esac
+       ])
+    ])
+])
+
+dnl Test whether mbrtowc reports encoding errors in the C locale.
+dnl Although POSIX was never intended to allow this, the GNU C Library
+dnl and other implementations do it.  See:
+dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932
+dnl POSIX has now clarified it:
+dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html>
+dnl says: "In the POSIX locale an [EILSEQ] error cannot occur since all byte
+dnl values are valid characters."
+
+AC_DEFUN([gl_MBRTOWC_C_LOCALE],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether the C locale is free of encoding errors],
+    [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <limits.h>
+            #include <locale.h>
+            #include <wchar.h>
+          ]], [[
+            int i;
+            char *locale = setlocale (LC_ALL, "C");
+            if (! locale)
+              return 2;
+            for (i = CHAR_MIN; i <= CHAR_MAX; i++)
+              {
+                char c = i;
+                wchar_t wc;
+                mbstate_t mbs = { 0, };
+                size_t ss = mbrtowc (&wc, &c, 1, &mbs);
+                if (1 < ss)
+                  return 3;
+              }
+            return 0;
+          ]])],
+       [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes],
+       [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no],
+       [case "$host_os" in
+                             # Guess yes on native Windows.
+          mingw* | windows*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;;
+          *)                 gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
+])
+
+# Prerequisites of lib/mbrtowc.c and lib/lc-charset-dispatch.c.
+AC_DEFUN([gl_PREREQ_MBRTOWC], [
+  AC_REQUIRE([AC_C_INLINE])
+  :
+])
+
+# Prerequisites of lib/mbtowc-lock.c.
+AC_DEFUN([gl_PREREQ_MBTOWC_LOCK],
+[
+  gl_VISIBILITY
+])
+
+
+dnl From Paul Eggert
+
+dnl This is an override of an autoconf macro.
+
+AC_DEFUN([AC_FUNC_MBRTOWC],
+[
+  dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
+  AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
+    [gl_cv_func_mbrtowc],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+            [[#include <wchar.h>]],
+            [[wchar_t wc;
+              char const s[] = "";
+              size_t n = 1;
+              mbstate_t state;
+              return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
+       [gl_cv_func_mbrtowc=yes],
+       [gl_cv_func_mbrtowc=no])])
+  if test $gl_cv_func_mbrtowc = yes; then
+    AC_DEFINE([HAVE_MBRTOWC], [1],
+      [Define to 1 if mbrtowc and mbstate_t are properly declared.])
+  fi
+])
deleted file mode 120000 (symlink)
index ec386310e32b2811f30a515ecf221170e085f59a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mbsinit.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..10a5b6199c8eca4472b838bca976fc298d36ce78
--- /dev/null
@@ -0,0 +1,44 @@
+# mbsinit.m4 serial 10
+dnl Copyright (C) 2008, 2010-2024 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_MBSINIT],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  gl_MBSTATE_T_BROKEN
+
+  AC_CHECK_FUNCS_ONCE([mbsinit])
+  if test $ac_cv_func_mbsinit = no; then
+    HAVE_MBSINIT=0
+    AC_CHECK_DECLS([mbsinit],,, [[
+      #include <wchar.h>
+    ]])
+    if test $ac_cv_have_decl_mbsinit = yes; then
+      dnl On Minix 3.1.8, the system's <wchar.h> declares mbsinit() although
+      dnl it does not have the function. Avoid a collision with gnulib's
+      dnl replacement.
+      REPLACE_MBSINIT=1
+    fi
+  else
+    if test $REPLACE_MBSTATE_T = 1; then
+      REPLACE_MBSINIT=1
+    else
+      dnl On mingw, mbsinit() always returns 1, which is inappropriate for
+      dnl states produced by mbrtowc() for an incomplete multibyte character
+      dnl in multibyte locales.
+      case "$host_os" in
+        mingw* | windows*) REPLACE_MBSINIT=1 ;;
+      esac
+    fi
+  fi
+])
+
+# Prerequisites of lib/mbsinit.c.
+AC_DEFUN([gl_PREREQ_MBSINIT], [
+  :
+])
deleted file mode 120000 (symlink)
index e81e10c47b3bee8472ccdb09a98e49b3ed871b61..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mbslen.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..58743e55f209b4a5f22a813b978a3ac829d80ef8
--- /dev/null
@@ -0,0 +1,16 @@
+# mbslen.m4 serial 3
+dnl Copyright (C) 2010-2024 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_MBSLEN],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([mbslen])
+  if test $ac_cv_func_mbslen = yes; then
+    HAVE_MBSLEN=1
+  else
+    HAVE_MBSLEN=0
+  fi
+])
deleted file mode 120000 (symlink)
index 98ea7e2b050e9fec1d659476b5d2d057b38b4db2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mbsrtowcs.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..84ac0b70d77c047fd9b5391a86ffe88c34527a56
--- /dev/null
@@ -0,0 +1,154 @@
+# mbsrtowcs.m4 serial 17
+dnl Copyright (C) 2008-2024 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_MBSRTOWCS],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  gl_MBSTATE_T_BROKEN
+
+  AC_CHECK_FUNCS_ONCE([mbsrtowcs])
+  if test $ac_cv_func_mbsrtowcs = no; then
+    HAVE_MBSRTOWCS=0
+    AC_CHECK_DECLS([mbsrtowcs],,, [[
+      #include <wchar.h>
+    ]])
+    if test $ac_cv_have_decl_mbsrtowcs = yes; then
+      dnl On Minix 3.1.8, the system's <wchar.h> declares mbsrtowcs() although
+      dnl it does not have the function. Avoid a collision with gnulib's
+      dnl replacement.
+      REPLACE_MBSRTOWCS=1
+    fi
+  else
+    if test $REPLACE_MBSTATE_T = 1; then
+      REPLACE_MBSRTOWCS=1
+    else
+      gl_MBSRTOWCS_WORKS
+      case "$gl_cv_func_mbsrtowcs_works" in
+        *yes) ;;
+        *) REPLACE_MBSRTOWCS=1 ;;
+      esac
+      if test $REPLACE_MBSRTOWCS = 0; then
+        gl_MBRTOWC_C_LOCALE
+        case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in
+          *yes) ;;
+          *) REPLACE_MBSRTOWCS=1 ;;
+        esac
+      fi
+    fi
+  fi
+])
+
+dnl Test whether mbsrtowcs works.
+dnl Result is gl_cv_func_mbsrtowcs_works.
+
+AC_DEFUN([gl_MBSRTOWCS_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gt_LOCALE_FR])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([gt_LOCALE_JA])
+  AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether mbsrtowcs works],
+    [gl_cv_func_mbsrtowcs_works],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+          # Guess no on HP-UX, Solaris, mingw.
+        hpux* | solaris* | mingw* | windows*)
+          gl_cv_func_mbsrtowcs_works="guessing no" ;;
+          # Guess yes otherwise.
+        *)
+          gl_cv_func_mbsrtowcs_works="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+int main ()
+{
+  int result = 0;
+  /* Test whether the function supports a NULL destination argument.
+     This fails on native Windows.  */
+  if (strcmp ("$LOCALE_FR", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+    {
+      const char input[] = "\337er";
+      const char *src = input;
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbsrtowcs (NULL, &src, 1, &state) != 3
+          || src != input)
+        result |= 1;
+    }
+  /* Test whether the function works when started with a conversion state
+     in non-initial state.  This fails on HP-UX 11.11 and Solaris 10.  */
+  if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      const char input[] = "B\303\274\303\237er";
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (NULL, input + 1, 1, &state) == (size_t)(-2))
+        if (!mbsinit (&state))
+          {
+            const char *src = input + 2;
+            if (mbsrtowcs (NULL, &src, 10, &state) != 4)
+              result |= 2;
+          }
+    }
+  if (strcmp ("$LOCALE_JA", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      const char input[] = "<\306\374\313\334\270\354>";
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (NULL, input + 3, 1, &state) == (size_t)(-2))
+        if (!mbsinit (&state))
+          {
+            const char *src = input + 4;
+            if (mbsrtowcs (NULL, &src, 10, &state) != 3)
+              result |= 4;
+          }
+    }
+  if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      const char input[] = "B\250\271\201\060\211\070er";
+      mbstate_t state;
+
+      memset (&state, '\0', sizeof (mbstate_t));
+      if (mbrtowc (NULL, input + 1, 1, &state) == (size_t)(-2))
+        if (!mbsinit (&state))
+          {
+            const char *src = input + 2;
+            if (mbsrtowcs (NULL, &src, 10, &state) != 4)
+              result |= 8;
+          }
+    }
+  return result;
+}]])],
+          [gl_cv_func_mbsrtowcs_works=yes],
+          [gl_cv_func_mbsrtowcs_works=no],
+          [:])
+      fi
+    ])
+])
+
+# Prerequisites of lib/mbsrtowcs.c.
+AC_DEFUN([gl_PREREQ_MBSRTOWCS], [
+  :
+])
deleted file mode 120000 (symlink)
index 43f5a1c7f6c2a5912ff12f4262e305b032ed0d48..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mbstate_t.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b2bcba45e96c652eac4ea765c91b75beece0b4ad
--- /dev/null
@@ -0,0 +1,34 @@
+# mbstate_t.m4 serial 14
+dnl Copyright (C) 2000-2002, 2008-2024 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.
+
+# From Paul Eggert.
+
+# BeOS 5 has <wchar.h> but does not define mbstate_t,
+# so you can't declare an object of that type.
+# Check for this incompatibility with Standard C.
+
+# AC_TYPE_MBSTATE_T
+# -----------------
+AC_DEFUN([AC_TYPE_MBSTATE_T],
+[
+   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl for HP-UX 11.11
+
+   AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t],
+     [AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+           [AC_INCLUDES_DEFAULT[
+             #include <wchar.h>]],
+           [[mbstate_t x; return sizeof x;]])],
+        [ac_cv_type_mbstate_t=yes],
+        [ac_cv_type_mbstate_t=no])])
+   if test $ac_cv_type_mbstate_t = yes; then
+     AC_DEFINE([HAVE_MBSTATE_T], [1],
+               [Define to 1 if <wchar.h> declares mbstate_t.])
+   else
+     AC_DEFINE([mbstate_t], [int],
+               [Define to a type if <wchar.h> does not define.])
+   fi
+])
deleted file mode 120000 (symlink)
index 63c1f158068b872bd9215b05cd4336734856e2ed..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mbswidth.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c895952eee06511c1a4d2b14c0c82f9dbcf66f25
--- /dev/null
@@ -0,0 +1,37 @@
+# mbswidth.m4 serial 19
+dnl Copyright (C) 2000-2002, 2004, 2006-2024 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 autoconf tests required for use of mbswidth.c
+dnl From Bruno Haible.
+
+AC_DEFUN([gl_MBSWIDTH],
+[
+  AC_CHECK_HEADERS_ONCE([wchar.h])
+  AC_CHECK_FUNCS_ONCE([isascii mbsinit])
+
+  dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth()
+  dnl that clashes with ours.
+  AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>],
+    [ac_cv_have_decl_mbswidth],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <wchar.h>
+          ]],
+          [[char *p = (char *) mbswidth;
+            return !p;
+          ]])],
+       [ac_cv_have_decl_mbswidth=yes],
+       [ac_cv_have_decl_mbswidth=no])])
+  if test $ac_cv_have_decl_mbswidth = yes; then
+    ac_val=1
+  else
+    ac_val=0
+  fi
+  AC_DEFINE_UNQUOTED([HAVE_DECL_MBSWIDTH_IN_WCHAR_H], [$ac_val],
+    [Define to 1 if you have a declaration of mbswidth() in <wchar.h>, and to 0 otherwise.])
+
+  AC_TYPE_MBSTATE_T
+])
deleted file mode 120000 (symlink)
index c38654d321b8c5f8f6cab65dd098d460e68fc773..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mbtowc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2bdc879c6e229320d0d8cf62d9f470fde410f372
--- /dev/null
@@ -0,0 +1,27 @@
+# mbtowc.m4 serial 5
+dnl Copyright (C) 2011-2024 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_MBTOWC],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+  gl_CHECK_FUNCS_ANDROID([mbtowc], [[#include <stdlib.h>]])
+  if test $ac_cv_func_mbtowc = no; then
+    HAVE_MBTOWC=0
+    case "$gl_cv_onwards_func_mbtowc" in
+      future*) REPLACE_MBTOWC=1 ;;
+    esac
+  else
+    if false; then
+      REPLACE_MBTOWC=1
+    fi
+  fi
+])
+
+# Prerequisites of lib/mbtowc.c.
+AC_DEFUN([gl_PREREQ_MBTOWC], [
+  :
+])
deleted file mode 120000 (symlink)
index 7ea5da1c5515355c511646a8384363b21cda7006..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/md5.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7af56a8a3d138141004fcaab9bc1fb22a5ba9e3c
--- /dev/null
@@ -0,0 +1,14 @@
+# md5.m4 serial 14
+dnl Copyright (C) 2002-2006, 2008-2024 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_MD5],
+[
+  dnl Prerequisites of lib/md5.c.
+  AC_REQUIRE([gl_BIGENDIAN])
+
+  dnl Determine HAVE_OPENSSL_MD5 and LIB_CRYPTO
+  gl_CRYPTO_CHECK([MD5])
+])
deleted file mode 120000 (symlink)
index 005d5c4b0f5f37deb0e656b87eec9abdf9fe73e2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/memcasecmp.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..debca971abdfacecaedb8fc525a5dc1bdb64fd27
--- /dev/null
@@ -0,0 +1,10 @@
+#serial 6
+dnl Copyright (C) 2005-2006, 2009-2024 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_MEMCASECMP],
+[
+  :
+])
deleted file mode 120000 (symlink)
index ed1eae0428fd1ae2a09196c7733aa50b8762bc9a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/memchr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6184ddc8385d2b34dd7b3704b9a51b58a01e96aa
--- /dev/null
@@ -0,0 +1,106 @@
+# memchr.m4 serial 19
+dnl Copyright (C) 2002-2004, 2009-2024 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_ONCE([gl_FUNC_MEMCHR],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Check for prerequisites for memory fence checks.
+  gl_FUNC_MMAP_ANON
+  AC_CHECK_HEADERS_ONCE([sys/mman.h])
+  AC_CHECK_FUNCS_ONCE([mprotect])
+
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  # Detect platform-specific bugs in some versions of glibc:
+  # memchr should not dereference anything with length 0
+  #   https://bugzilla.redhat.com/show_bug.cgi?id=499689
+  # memchr should not dereference overestimated length after a match
+  #   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737
+  #   https://sourceware.org/bugzilla/show_bug.cgi?id=10162
+  # memchr should cast the second argument to 'unsigned char'.
+  #   This bug exists in Android 4.3.
+  # Assume that memchr works on platforms that lack mprotect.
+  AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works],
+    [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <string.h>
+#if HAVE_SYS_MMAN_H
+# include <fcntl.h>
+# include <unistd.h>
+# include <sys/types.h>
+# include <sys/mman.h>
+# ifndef MAP_FILE
+#  define MAP_FILE 0
+# endif
+#endif
+]], [[
+  int result = 0;
+  char *fence = NULL;
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
+# if HAVE_MAP_ANONYMOUS
+  const int flags = MAP_ANONYMOUS | MAP_PRIVATE;
+  const int fd = -1;
+# else /* !HAVE_MAP_ANONYMOUS */
+  const int flags = MAP_FILE | MAP_PRIVATE;
+  int fd = open ("/dev/zero", O_RDONLY, 0666);
+  if (fd >= 0)
+# endif
+    {
+      int pagesize = getpagesize ();
+      char *two_pages =
+        (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
+                       flags, fd, 0);
+      if (two_pages != (char *)(-1)
+          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
+        fence = two_pages + pagesize;
+    }
+#endif
+  if (fence)
+    {
+      /* Test against bugs on glibc systems.  */
+      if (memchr (fence, 0, 0))
+        result |= 1;
+      strcpy (fence - 9, "12345678");
+      if (memchr (fence - 9, 0, 79) != fence - 1)
+        result |= 2;
+      if (memchr (fence - 1, 0, 3) != fence - 1)
+        result |= 4;
+      /* Test against bug on AIX 7.2.  */
+      if (memchr (fence - 4, '6', 16) != fence - 4)
+        result |= 8;
+    }
+  /* Test against bug on Android 4.3.  */
+  {
+    char input[3];
+    input[0] = 'a';
+    input[1] = 'b';
+    input[2] = 'c';
+    if (memchr (input, 0x789abc00 | 'b', 3) != input + 1)
+      result |= 16;
+  }
+  return result;
+]])],
+       [gl_cv_func_memchr_works=yes],
+       [gl_cv_func_memchr_works=no],
+       [case "$host_os" in
+                             # Guess no on Android.
+          linux*-android*)   gl_cv_func_memchr_works="guessing no" ;;
+                             # Guess yes on native Windows.
+          mingw* | windows*) gl_cv_func_memchr_works="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+          *)                 gl_cv_func_memchr_works="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
+  case "$gl_cv_func_memchr_works" in
+    *yes) ;;
+    *) REPLACE_MEMCHR=1 ;;
+  esac
+])
+
+# Prerequisites of lib/memchr.c.
+AC_DEFUN([gl_PREREQ_MEMCHR], [
+  AC_CHECK_HEADERS([bp-sym.h])
+])
deleted file mode 120000 (symlink)
index 8b7ced0583759ddcba1f20c03bf338e44303d748..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/memcoll.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b449a01dc373f9c7f65daf11845a5da5ac1fc1fd
--- /dev/null
@@ -0,0 +1,12 @@
+# memcoll.m4 serial 11
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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_MEMCOLL],
+[
+  AC_REQUIRE([AC_C_RESTRICT])
+  :
+])
deleted file mode 120000 (symlink)
index 6916f02fa4af7e4fe97543069aaa1ed3dbe7422c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mempcpy.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..94ce05d1a6a37f1f59c8f66a30af070b3ac8a8c1
--- /dev/null
@@ -0,0 +1,29 @@
+# mempcpy.m4 serial 14
+dnl Copyright (C) 2003-2004, 2006-2007, 2009-2024 Free Software Foundation,
+dnl 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_MEMPCPY],
+[
+  dnl Persuade glibc <string.h> to declare mempcpy().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'.
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  gl_CHECK_FUNCS_ANDROID([mempcpy], [[#include <string.h>]])
+  if test $ac_cv_func_mempcpy = no; then
+    HAVE_MEMPCPY=0
+    case "$gl_cv_onwards_func_mempcpy" in
+      future*) REPLACE_MEMPCPY=1 ;;
+    esac
+  fi
+])
+
+# Prerequisites of lib/mempcpy.c.
+AC_DEFUN([gl_PREREQ_MEMPCPY], [
+  :
+])
deleted file mode 120000 (symlink)
index 3991a13eff0c88fa3a1e1273f4175ece415549a6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/memrchr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b4ccdfa3c8d7b949a12b522afaa274fc6866ae5d
--- /dev/null
@@ -0,0 +1,23 @@
+# memrchr.m4 serial 11
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation,
+dnl 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_STRING_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([memrchr])
+  if test $ac_cv_have_decl_memrchr = no; then
+    HAVE_DECL_MEMRCHR=0
+  fi
+
+  AC_CHECK_FUNCS([memrchr])
+])
+
+# Prerequisites of lib/memrchr.c.
+AC_DEFUN([gl_PREREQ_MEMRCHR], [:])
deleted file mode 120000 (symlink)
index 36228ccbad5237d6a2fcb993618d199d25f9b81e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/memset_explicit.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..19514ff917e65487d8fdf5995d55d43f58540435
--- /dev/null
@@ -0,0 +1,24 @@
+# memset_explicit.m4 serial 2
+dnl Copyright 2022-2024 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_MEMSET_EXPLICIT],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+
+  gl_CHECK_FUNCS_ANDROID([memset_explicit], [[#include <string.h>]])
+  if test $ac_cv_func_memset_explicit = no; then
+    HAVE_MEMSET_EXPLICIT=0
+    case "$gl_cv_onwards_func_memset_explicit" in
+      future*) REPLACE_MEMSET_EXPLICIT=1 ;;
+    esac
+  fi
+])
+
+AC_DEFUN([gl_PREREQ_MEMSET_EXPLICIT],
+[
+  AC_CHECK_FUNCS([explicit_memset])
+  AC_CHECK_FUNCS_ONCE([memset_s])
+])
deleted file mode 120000 (symlink)
index eb4d143af70e0fa8ec79acadf6e2bc5758a78b18..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mgetgroups.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..03e60a8f0f7c326f630c6b3066ffecac23475637
--- /dev/null
@@ -0,0 +1,10 @@
+#serial 5
+dnl Copyright (C) 2007-2024 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_MGETGROUPS],
+[
+  AC_CHECK_FUNCS_ONCE([getgrouplist])
+])
deleted file mode 120000 (symlink)
index 2ef8ef7b99c1af9c5deaf11a253e2df5c176a1d3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/minmax.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5c0a927da66334f04cba585d0811fe81177eb785
--- /dev/null
@@ -0,0 +1,44 @@
+# minmax.m4 serial 4
+dnl Copyright (C) 2005, 2009-2024 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_PREREQ([2.53])
+
+AC_DEFUN([gl_MINMAX],
+[
+  AC_REQUIRE([gl_PREREQ_MINMAX])
+])
+
+# Prerequisites of lib/minmax.h.
+AC_DEFUN([gl_PREREQ_MINMAX],
+[
+  gl_MINMAX_IN_HEADER([limits.h])
+  gl_MINMAX_IN_HEADER([sys/param.h])
+])
+
+dnl gl_MINMAX_IN_HEADER(HEADER)
+dnl The parameter has to be a literal header name; it cannot be macro,
+dnl nor a shell variable. (Because autoheader collects only AC_DEFINE
+dnl invocations with a literal macro name.)
+AC_DEFUN([gl_MINMAX_IN_HEADER],
+[
+  m4_pushdef([header], AS_TR_SH([$1]))
+  m4_pushdef([HEADER], AS_TR_CPP([$1]))
+  AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
+    [gl_cv_minmax_in_]header,
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <$1>
+            int x = MIN (42, 17);]],
+          [[]])],
+       [gl_cv_minmax_in_]header[=yes],
+       [gl_cv_minmax_in_]header[=no])])
+  if test $gl_cv_minmax_in_[]header = yes; then
+    AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
+      [Define to 1 if <$1> defines the MIN and MAX macros.])
+  fi
+  m4_popdef([HEADER])
+  m4_popdef([header])
+])
deleted file mode 120000 (symlink)
index 9bb13f22b62d2d263b0d09f9f05048ab46e36b5e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mkancesdirs.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..914f534ff1e6d1b46920f9012f9400fb2fd6638b
--- /dev/null
@@ -0,0 +1,10 @@
+# Make a file's ancestor directories.
+dnl Copyright (C) 2006, 2009-2024 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_MKANCESDIRS],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 3bf2cdabc016025c65b878e0e9ec1618bc632e28..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mkdir-p.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..70676eaa5cd4adbf8f710dc0e1e597dc05548fd1
--- /dev/null
@@ -0,0 +1,11 @@
+# mkdir-p.m4 serial 15
+dnl Copyright (C) 2002-2006, 2009-2024 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_MKDIR_PARENTS],
+[
+  dnl Prerequisites of lib/dirchownmod.c.
+  AC_CHECK_FUNCS_ONCE([fchmod])
+])
deleted file mode 120000 (symlink)
index 3999c5db963fb043319d2dc5b495a1d3d423801e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mkdir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..48297f904012754f53146354ebc35d634a5ffa59
--- /dev/null
@@ -0,0 +1,92 @@
+# serial 20
+
+# Copyright (C) 2001, 2003-2004, 2006, 2008-2024 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.
+
+# On some systems, mkdir ("foo/", 0700) fails because of the trailing slash.
+# On others, mkdir ("foo/./", 0700) mistakenly succeeds.
+# On such systems, arrange to use a wrapper function.
+AC_DEFUN([gl_FUNC_MKDIR],
+[dnl
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CACHE_CHECK([whether mkdir handles trailing slash],
+    [gl_cv_func_mkdir_trailing_slash_works],
+    [rm -rf conftest.dir
+     AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #include <sys/types.h>
+          #include <sys/stat.h>
+          ]GL_MDA_DEFINES],
+          [[return mkdir ("conftest.dir/", 0700);]])],
+       [gl_cv_func_mkdir_trailing_slash_works=yes],
+       [gl_cv_func_mkdir_trailing_slash_works=no],
+       [case "$host_os" in
+                             # Guess yes on Linux systems.
+          linux-* | linux)   gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;;
+                             # Guess yes on systems that emulate the Linux system calls.
+          midipix*)          gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+          *-gnu* | gnu*)     gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;;
+                             # Guess yes on MSVC, no on mingw.
+          windows*-msvc*)    gl_cv_func_mkdir_trailing_slash_works="guessing yes" ;;
+          mingw* | windows*) AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                               ],
+                               [gl_cv_func_mkdir_trailing_slash_works="guessing yes"],
+                               [gl_cv_func_mkdir_trailing_slash_works="guessing no"])
+                             ;;
+                             # If we don't know, obey --enable-cross-guesses.
+          *)                 gl_cv_func_mkdir_trailing_slash_works="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -rf conftest.dir
+    ])
+  case "$gl_cv_func_mkdir_trailing_slash_works" in
+    *yes) ;;
+    *)
+      REPLACE_MKDIR=1
+      ;;
+  esac
+
+  AC_CACHE_CHECK([whether mkdir handles trailing dot],
+    [gl_cv_func_mkdir_trailing_dot_works],
+    [rm -rf conftest.dir
+     AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #include <sys/types.h>
+          #include <sys/stat.h>
+          ]GL_MDA_DEFINES],
+          [[return !mkdir ("conftest.dir/./", 0700);]])],
+       [gl_cv_func_mkdir_trailing_dot_works=yes],
+       [gl_cv_func_mkdir_trailing_dot_works=no],
+       [case "$host_os" in
+                             # Guess yes on glibc systems.
+          *-gnu* | gnu*)     gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
+                             # Guess yes on musl systems.
+          *-musl*)           gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
+                             # Guess yes on systems that emulate the Linux system calls.
+          midipix*)          gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
+                             # Guess no on native Windows.
+          mingw* | windows*) gl_cv_func_mkdir_trailing_dot_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+          *)                 gl_cv_func_mkdir_trailing_dot_works="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -rf conftest.dir
+    ]
+  )
+  case "$gl_cv_func_mkdir_trailing_dot_works" in
+    *yes) ;;
+    *)
+      REPLACE_MKDIR=1
+      AC_DEFINE([FUNC_MKDIR_DOT_BUG], [1], [Define to 1 if mkdir mistakenly
+        creates a directory given with a trailing dot component.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 1e7a1541b3da1ae65373c265b7f8f6a581f47aa1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mkdirat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..30cc4f4cccf1ed91643b22ff701f50eecf7481dc
--- /dev/null
@@ -0,0 +1,23 @@
+# mkdirat.m4 serial 1
+dnl Copyright (C) 2004-2024 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_MKDIRAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([mkdirat])
+  if test $ac_cv_func_mkdirat != yes; then
+    HAVE_MKDIRAT=0
+  fi
+])
+
+# Prerequisite of mkdirat's declaration and of lib/mkdirat.c.
+AC_DEFUN([gl_PREREQ_MKDIRAT],
+[
+  AC_REQUIRE([AC_TYPE_MODE_T])
+])
deleted file mode 120000 (symlink)
index c97cbbd306a2232e47a34705efc450c640e2af9c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mkfifo.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c49c68822fb47d6d9f15660cb29fd1f705aa10cf
--- /dev/null
@@ -0,0 +1,73 @@
+# serial 9
+# See if we need to provide mkfifo replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_MKFIFO],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl We can't use AC_CHECK_FUNC here, because mkfifo() is defined as a
+  dnl static inline function when compiling for Android 4.4 or older.
+  AC_CACHE_CHECK([for mkfifo], [gl_cv_func_mkfifo],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <sys/stat.h>]],
+          [[return mkfifo("/",0);]])
+       ],
+       [gl_cv_func_mkfifo=yes],
+       [gl_cv_func_mkfifo=no])
+    ])
+  if test $gl_cv_func_mkfifo = no; then
+    HAVE_MKFIFO=0
+  else
+    AC_DEFINE([HAVE_MKFIFO], [1],
+      [Define to 1 if you have a 'mkfifo' function.])
+    dnl Check for Solaris 9 and FreeBSD bug with trailing slash.
+    AC_CHECK_FUNCS_ONCE([lstat])
+    AC_CACHE_CHECK([whether mkfifo rejects trailing slashes],
+      [gl_cv_func_mkfifo_works],
+      [# Assume that if we have lstat, we can also check symlinks.
+       if test $ac_cv_func_lstat = yes; then
+         ln -s conftest.tmp conftest.lnk
+       fi
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <sys/stat.h>
+           ]],
+           [[int result = 0;
+             if (!mkfifo ("conftest.tmp/", 0600))
+               result |= 1;
+#if HAVE_LSTAT
+             if (!mkfifo ("conftest.lnk/", 0600))
+               result |= 2;
+#endif
+             return result;
+           ]])],
+         [gl_cv_func_mkfifo_works=yes], [gl_cv_func_mkfifo_works=no],
+         [case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_mkfifo_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_mkfifo_works="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_mkfifo_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+       rm -f conftest.tmp conftest.lnk])
+    case "$gl_cv_func_mkfifo_works" in
+      *yes) ;;
+      *)
+        AC_DEFINE([MKFIFO_TRAILING_SLASH_BUG], [1], [Define to 1 if mkfifo
+          does not reject trailing slash])
+        REPLACE_MKFIFO=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 65f40a8536f5c9d83a0865f2c67e402dc68400a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mkfifoat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e1d1547aef1bfed9d8c14874a268e7e60d8d2213
--- /dev/null
@@ -0,0 +1,73 @@
+# serial 10
+# See if we need to provide mkfifoat/mknodat replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_MKFIFOAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Persuade glibc <sys/stat.h> to declare mkfifoat() and mknodat().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_FUNC_OPENAT])
+
+  gl_CHECK_FUNCS_ANDROID_MACOS([mknodat], [[#include <sys/stat.h>]])
+  gl_CHECK_FUNCS_ANDROID_MACOS([mkfifoat], [[#include <sys/stat.h>]])
+  if test $ac_cv_func_mkfifoat = yes; then
+    dnl Check for AIX 7.2 bug with trailing slash.
+    AC_CACHE_CHECK([whether mkfifoat rejects trailing slashes],
+      [gl_cv_func_mkfifoat_works],
+      [rm -f conftest.tmp
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <fcntl.h>
+              #include <sys/stat.h>
+            ]],
+            [[int result = 0;
+              if (!mkfifoat (AT_FDCWD, "conftest.tmp/", 0600))
+                result |= 1;
+              return result;
+            ]])
+         ],
+         [gl_cv_func_mkfifoat_works=yes],
+         [gl_cv_func_mkfifoat_works=no],
+         [case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_mkfifoat_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_mkfifoat_works="guessing yes" ;;
+                             # Guess no on AIX systems.
+            aix*)            gl_cv_func_mkfifoat_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_mkfifoat_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+       rm -f conftest.tmp
+      ])
+    case "$gl_cv_func_mkfifoat_works" in
+      *yes) ;;
+      *)
+        REPLACE_MKFIFOAT=1
+        dnl mknodat() has the same bug as mkfifoat().
+        REPLACE_MKNODAT=1
+        ;;
+    esac
+  else
+    # No known system has mkfifoat but not mknodat
+    HAVE_MKFIFOAT=0
+    case "$gl_cv_onwards_func_mkfifoat" in
+      future*) REPLACE_MKFIFOAT=1 ;;
+    esac
+    HAVE_MKNODAT=0
+    case "$gl_cv_onwards_func_mknodat" in
+      future*) REPLACE_MKNODAT=1 ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index b3a3a4be4da0d80308393cbb0db53ef55862bce2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mknod.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d342211e09772c254373fca01f3b29cfc26af81a
--- /dev/null
@@ -0,0 +1,68 @@
+# serial 8
+# See if we need to provide mknod replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_MKNOD],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_FUNC_MKFIFO])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([mknod])
+  if test $ac_cv_func_mknod = no; then
+    HAVE_MKNOD=0
+  else
+    dnl Detect BSD bug, where mknod requires root privileges to create fifo.
+    AC_CACHE_CHECK([whether mknod can create fifo without root privileges],
+      [gl_cv_func_mknod_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <sys/stat.h>
+             #include <unistd.h>
+
+             /* Copied from root-uid.h.  FIXME: Just use root-uid.h.  */
+             #ifdef __TANDEM
+             # define ROOT_UID 65535
+             #else
+             # define ROOT_UID 0
+             #endif
+]], [[/* Indeterminate for super-user, assume no.  Why are you running
+         configure as root, anyway?  */
+      if (geteuid () == ROOT_UID) return 99;
+      if (mknod ("conftest.fifo", S_IFIFO | 0600, 0)) return 2;]])],
+         [gl_cv_func_mknod_works=yes],
+         [if test $? = 99 && test x"$FORCE_UNSAFE_CONFIGURE" = x; then
+            AC_MSG_FAILURE([you should not run configure as root ]dnl
+[(set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)])
+          fi
+          gl_cv_func_mknod_works=no],
+         [case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_mknod_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_mknod_works="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_mknod_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+       rm -f conftest.fifo])
+    case "$gl_cv_func_mknod_works" in
+      *yes) ;;
+      *)
+        REPLACE_MKNOD=1
+        AC_DEFINE([MKNOD_FIFO_BUG], [1], [Define to 1 if mknod cannot create
+          a fifo without super-user privileges])
+        ;;
+    esac
+    dnl Systems that mishandle trailing slash on mkfifo also goof on mknod.
+    if test $REPLACE_MKFIFO = 1; then
+      REPLACE_MKNOD=1
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index 39baff3e1eed50e48df40a2d4d2e936194401387..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mkostemp.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1c22b8d51b48d55afed57adce3ef5c4d3571b6b1
--- /dev/null
@@ -0,0 +1,26 @@
+# mkostemp.m4 serial 4
+dnl Copyright (C) 2009-2024 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_MKOSTEMP],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+  dnl Persuade glibc <stdlib.h> to declare mkostemp().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  gl_CHECK_FUNCS_ANDROID([mkostemp], [[#include <stdlib.h>]])
+  if test $ac_cv_func_mkostemp != yes; then
+    HAVE_MKOSTEMP=0
+    case "$gl_cv_onwards_func_mkostemp" in
+      future*) REPLACE_MKOSTEMP=1 ;;
+    esac
+  fi
+])
+
+# Prerequisites of lib/mkostemp.c.
+AC_DEFUN([gl_PREREQ_MKOSTEMP],
+[
+])
deleted file mode 120000 (symlink)
index 06a3262dbf673f674dd2c666fd7526b788352098..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mkstemp.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..106a6b8e5f3fad9de05b8bcfeea3ea55548dcf30
--- /dev/null
@@ -0,0 +1,87 @@
+#serial 30
+
+# Copyright (C) 2001, 2003-2007, 2009-2024 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.
+
+# On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a
+# silly limit that it can create no more than 26 files from a given template.
+# Other systems lack mkstemp altogether.
+# On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create
+# only 32 files per process.
+# On some hosts, mkstemp creates files with mode 0666, which is a security
+# problem and a violation of POSIX 2008.
+# On systems like the above, arrange to use the replacement function.
+AC_DEFUN([gl_FUNC_MKSTEMP],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_CHECK_FUNCS_ONCE([mkstemp])
+  if test $ac_cv_func_mkstemp = yes; then
+    AC_CACHE_CHECK([for working mkstemp],
+      [gl_cv_func_working_mkstemp],
+      [
+        mkdir conftest.mkstemp
+        AC_RUN_IFELSE(
+          [AC_LANG_PROGRAM(
+            [AC_INCLUDES_DEFAULT
+             GL_MDA_DEFINES],
+            [[int result = 0;
+              int i;
+              off_t large = (off_t) 4294967295u;
+              if (large < 0)
+                large = 2147483647;
+              umask (0);
+              for (i = 0; i < 70; i++)
+                {
+                  char templ[] = "conftest.mkstemp/coXXXXXX";
+                  int (*mkstemp_function) (char *) = mkstemp;
+                  int fd = mkstemp_function (templ);
+                  if (fd < 0)
+                    result |= 1;
+                  else
+                    {
+                      struct stat st;
+                      if (lseek (fd, large, SEEK_SET) != large)
+                        result |= 2;
+                      if (fstat (fd, &st) < 0)
+                        result |= 4;
+                      else if (st.st_mode & 0077)
+                        result |= 8;
+                      if (close (fd))
+                        result |= 16;
+                    }
+                }
+              return result;]])],
+          [gl_cv_func_working_mkstemp=yes],
+          [gl_cv_func_working_mkstemp=no],
+          [case "$host_os" in
+                                 # Guess yes on glibc systems.
+             *-gnu* | gnu*)      gl_cv_func_working_mkstemp="guessing yes" ;;
+                                 # Guess yes on musl systems.
+             *-musl* | midipix*) gl_cv_func_working_mkstemp="guessing yes" ;;
+                                 # Guess no on native Windows.
+             mingw* | windows*)  gl_cv_func_working_mkstemp="guessing no" ;;
+                                 # If we don't know, obey --enable-cross-guesses.
+             *)                  gl_cv_func_working_mkstemp="$gl_cross_guess_normal" ;;
+           esac
+          ])
+        rm -rf conftest.mkstemp
+      ])
+    case "$gl_cv_func_working_mkstemp" in
+      *yes) ;;
+      *)
+        REPLACE_MKSTEMP=1
+        ;;
+    esac
+  else
+    HAVE_MKSTEMP=0
+  fi
+])
+
+# Prerequisites of lib/mkstemp.c.
+AC_DEFUN([gl_PREREQ_MKSTEMP],
+[
+])
deleted file mode 120000 (symlink)
index 8a92855182274612c3c11f27cecd7ae73263b2c3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mktime.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0565e5e61fee22995130f52953956376f3aa906c
--- /dev/null
@@ -0,0 +1,318 @@
+# serial 39
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation,
+dnl 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.
+
+AC_DEFUN([gl_TIME_T_IS_SIGNED],
+[
+  AC_CACHE_CHECK([whether time_t is signed],
+    [gl_cv_time_t_is_signed],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[#include <time.h>
+                          char time_t_signed[(time_t) -1 < 0 ? 1 : -1];]])],
+       [gl_cv_time_t_is_signed=yes],
+       [gl_cv_time_t_is_signed=no])])
+  if test $gl_cv_time_t_is_signed = yes; then
+    AC_DEFINE([TIME_T_IS_SIGNED], [1], [Define to 1 if time_t is signed.])
+  fi
+])
+
+dnl Test whether mktime works. Set gl_cv_func_working_mktime.
+AC_DEFUN([gl_FUNC_MKTIME_WORKS],
+[
+  AC_REQUIRE([gl_TIME_T_IS_SIGNED])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained
+  dnl in Autoconf and because it invokes AC_LIBOBJ.
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CHECK_DECLS_ONCE([alarm])
+  AC_REQUIRE([gl_MULTIARCH])
+  AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime],
+    [if test $APPLE_UNIVERSAL_BUILD = 1; then
+       # A universal build on Apple Mac OS X platforms.
+       # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode.
+       # But we need a configuration result that is valid in both modes.
+       gl_cv_func_working_mktime="guessing no"
+     else
+       AC_RUN_IFELSE(
+         [AC_LANG_SOURCE(
+[[/* Test program from Paul Eggert and Tony Leneis.  */
+#include <limits.h>
+#include <stdlib.h>
+#include <time.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_DECL_ALARM
+# include <signal.h>
+#endif
+
+]GL_MDA_DEFINES[
+
+#ifndef TIME_T_IS_SIGNED
+# define TIME_T_IS_SIGNED 0
+#endif
+
+static time_t time_t_max;
+static time_t time_t_min;
+
+/* Values we'll use to set the TZ environment variable.  */
+static char *tz_strings[] = {
+  (char *) 0, "TZ=GMT0", "TZ=JST-9",
+  "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
+};
+#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
+
+/* Return 0 if mktime fails to convert a date in the spring-forward gap.
+   Based on a problem report from Andreas Jaeger.  */
+static int
+spring_forward_gap ()
+{
+  /* glibc (up to about 1998-10-07) failed this test. */
+  struct tm tm;
+
+  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
+     instead of "TZ=America/Vancouver" in order to detect the bug even
+     on systems that don't support the Olson extension, or don't have the
+     full zoneinfo tables installed.  */
+  if (putenv ("TZ=PST8PDT,M4.1.0,M10.5.0") != 0)
+    return -1;
+
+  tm.tm_year = 98;
+  tm.tm_mon = 3;
+  tm.tm_mday = 5;
+  tm.tm_hour = 2;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  return mktime (&tm) != (time_t) -1;
+}
+
+static int
+mktime_test1 (time_t now)
+{
+  struct tm *lt;
+  return ! (lt = localtime (&now)) || mktime (lt) == now;
+}
+
+static int
+mktime_test (time_t now)
+{
+  return (mktime_test1 (now)
+          && mktime_test1 ((time_t) (time_t_max - now))
+          && mktime_test1 ((time_t) (time_t_min + now)));
+}
+
+static int
+irix_6_4_bug ()
+{
+  /* Based on code from Ariel Faigon.  */
+  struct tm tm;
+  tm.tm_year = 96;
+  tm.tm_mon = 3;
+  tm.tm_mday = 0;
+  tm.tm_hour = 0;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  mktime (&tm);
+  return tm.tm_mon == 2 && tm.tm_mday == 31;
+}
+
+static int
+bigtime_test (int j)
+{
+  struct tm tm;
+  time_t now;
+  tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
+  now = mktime (&tm);
+  if (now != (time_t) -1)
+    {
+      struct tm *lt = localtime (&now);
+      if (! (lt
+             && lt->tm_year == tm.tm_year
+             && lt->tm_mon == tm.tm_mon
+             && lt->tm_mday == tm.tm_mday
+             && lt->tm_hour == tm.tm_hour
+             && lt->tm_min == tm.tm_min
+             && lt->tm_sec == tm.tm_sec
+             && lt->tm_yday == tm.tm_yday
+             && lt->tm_wday == tm.tm_wday
+             && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
+                  == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
+        return 0;
+    }
+  return 1;
+}
+
+static int
+year_2050_test ()
+{
+  /* The correct answer for 2050-02-01 00:00:00 in Pacific time,
+     ignoring leap seconds.  */
+  unsigned long int answer = 2527315200UL;
+
+  struct tm tm;
+  time_t t;
+  tm.tm_year = 2050 - 1900;
+  tm.tm_mon = 2 - 1;
+  tm.tm_mday = 1;
+  tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+
+  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
+     instead of "TZ=America/Vancouver" in order to detect the bug even
+     on systems that don't support the Olson extension, or don't have the
+     full zoneinfo tables installed.  */
+  if (putenv ("TZ=PST8PDT,M4.1.0,M10.5.0") != 0)
+    return -1;
+
+  t = mktime (&tm);
+
+  /* Check that the result is either a failure, or close enough
+     to the correct answer that we can assume the discrepancy is
+     due to leap seconds.  */
+  return (t == (time_t) -1
+          || (0 < t && answer - 120 <= t && t <= answer + 120));
+}
+
+static int
+indiana_test ()
+{
+  if (putenv ("TZ=America/Indiana/Indianapolis") != 0)
+    return -1;
+  struct tm tm;
+  tm.tm_year = 1986 - 1900; tm.tm_mon = 4 - 1; tm.tm_mday = 28;
+  tm.tm_hour = 16; tm.tm_min = 24; tm.tm_sec = 50; tm.tm_isdst = 0;
+  time_t std = mktime (&tm);
+  if (! (std == 515107490 || std == 515107503))
+    return 1;
+
+  /* This platform supports TZDB, either without or with leap seconds.
+     Return true if GNU Bug#48085 is absent.  */
+  tm.tm_isdst = 1;
+  time_t dst = mktime (&tm);
+  return std - dst == 60 * 60;
+}
+
+int
+main ()
+{
+  int result = 0;
+  time_t t, delta;
+  int i, j;
+  int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1;
+
+#if HAVE_DECL_ALARM
+  /* This test makes some buggy mktime implementations loop.
+     Give up after 60 seconds; a mktime slower than that
+     isn't worth using anyway.  */
+  signal (SIGALRM, SIG_DFL);
+  alarm (60);
+#endif
+
+  time_t_max = (! TIME_T_IS_SIGNED
+                ? (time_t) -1
+                : ((((time_t) 1 << (sizeof (time_t) * CHAR_BIT - 2)) - 1)
+                   * 2 + 1));
+  time_t_min = (! TIME_T_IS_SIGNED
+                ? (time_t) 0
+                : time_t_signed_magnitude
+                ? ~ (time_t) 0
+                : ~ time_t_max);
+
+  delta = time_t_max / 997; /* a suitable prime number */
+  for (i = 0; i < N_STRINGS; i++)
+    {
+      if (tz_strings[i])
+        putenv (tz_strings[i]);
+
+      for (t = 0; t <= time_t_max - delta && (result & 1) == 0; t += delta)
+        if (! mktime_test (t))
+          result |= 1;
+      if ((result & 2) == 0
+          && ! (mktime_test ((time_t) 1)
+                && mktime_test ((time_t) (60 * 60))
+                && mktime_test ((time_t) (60 * 60 * 24))))
+        result |= 2;
+
+      for (j = 1; (result & 4) == 0; j <<= 1)
+        {
+          if (! bigtime_test (j))
+            result |= 4;
+          if (INT_MAX / 2 < j)
+            break;
+        }
+      if ((result & 8) == 0 && ! bigtime_test (INT_MAX))
+        result |= 8;
+    }
+  if (! irix_6_4_bug ())
+    result |= 16;
+  if (! spring_forward_gap ())
+    result |= 32;
+  if (! year_2050_test () || ! indiana_test ())
+    result |= 64;
+  return result;
+}]])],
+         [gl_cv_func_working_mktime=yes],
+         [gl_cv_func_working_mktime=no],
+         [case "$host_os" in
+                               # Guess no on native Windows.
+            mingw* | windows*) gl_cv_func_working_mktime="guessing no" ;;
+            *)                 gl_cv_func_working_mktime="$gl_cross_guess_normal" ;;
+          esac
+         ])
+     fi
+    ])
+])
+
+dnl Main macro of module 'mktime'.
+AC_DEFUN([gl_FUNC_MKTIME],
+[
+  AC_REQUIRE([gl_TIME_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
+
+  if test "$gl_cv_func_working_mktime" != yes; then
+    REPLACE_MKTIME=1
+    AC_DEFINE([NEED_MKTIME_WORKING], [1],
+      [Define if the compilation of mktime.c should define 'mktime'
+       with the algorithmic workarounds.])
+  fi
+  case "$host_os" in
+    mingw* | windows*)
+      REPLACE_MKTIME=1
+      AC_DEFINE([NEED_MKTIME_WINDOWS], [1],
+        [Define if the compilation of mktime.c should define 'mktime'
+         with the native Windows TZ workaround.])
+      ;;
+  esac
+])
+
+dnl Main macro of module 'mktime-internal'.
+AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [
+  AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
+
+  WANT_MKTIME_INTERNAL=0
+  dnl BeOS has __mktime_internal in libc, but other platforms don't.
+  AC_CHECK_FUNC([__mktime_internal],
+    [AC_DEFINE([mktime_internal], [__mktime_internal],
+       [Define to the real name of the mktime_internal function.])
+    ],
+    [dnl mktime works but it doesn't export __mktime_internal,
+     dnl so we need to substitute our own mktime implementation.
+     WANT_MKTIME_INTERNAL=1
+     AC_DEFINE([NEED_MKTIME_INTERNAL], [1],
+       [Define if the compilation of mktime.c should define 'mktime_internal'.])
+    ])
+])
+
+# Prerequisites of lib/mktime.c.
+AC_DEFUN([gl_PREREQ_MKTIME], [:])
deleted file mode 120000 (symlink)
index 4db09559052fa5dc61fe0240335320bbe2140282..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mmap-anon.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..642f07db025d10f6ca2bf13c40a9caff85b5fa82
--- /dev/null
@@ -0,0 +1,55 @@
+# mmap-anon.m4 serial 12
+dnl Copyright (C) 2005, 2007, 2009-2024 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.
+
+# Detect how mmap can be used to create anonymous (not file-backed) memory
+# mappings.
+# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS
+#   and MAP_ANON exist and have the same value.
+# - On HP-UX, only MAP_ANONYMOUS exists.
+# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists.
+# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be
+#   used.
+
+AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
+[
+  dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it
+  # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is
+  # irrelevant for anonymous mappings.
+  AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no])
+
+  # Try to allow MAP_ANONYMOUS.
+  gl_have_mmap_anonymous=no
+  if test $gl_have_mmap = yes; then
+    AC_MSG_CHECKING([for MAP_ANONYMOUS])
+    AC_EGREP_CPP([I cannot identify this map], [
+#include <sys/mman.h>
+#ifdef MAP_ANONYMOUS
+    I cannot identify this map
+#endif
+],
+      [gl_have_mmap_anonymous=yes])
+    if test $gl_have_mmap_anonymous != yes; then
+      AC_EGREP_CPP([I cannot identify this map], [
+#include <sys/mman.h>
+#ifdef MAP_ANON
+    I cannot identify this map
+#endif
+],
+        [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON],
+          [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.])
+         gl_have_mmap_anonymous=yes])
+    fi
+    AC_MSG_RESULT([$gl_have_mmap_anonymous])
+    if test $gl_have_mmap_anonymous = yes; then
+      AC_DEFINE([HAVE_MAP_ANONYMOUS], [1],
+        [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
+         config.h and <sys/mman.h>.])
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index 4a7dcc29dc23585d3e57afe3eff1a3381e670897..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mode_t.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..af88da51285818321d023c57cea0d8f9a3779abe
--- /dev/null
@@ -0,0 +1,26 @@
+# mode_t.m4 serial 2
+dnl Copyright (C) 2009-2024 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.
+
+# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and
+# include <sys/types.h>.
+
+# Define PROMOTED_MODE_T to the type that is the result of "default argument
+# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t.
+AC_DEFUN([gl_PROMOTED_TYPE_MODE_T],
+[
+  AC_REQUIRE([AC_TYPE_MODE_T])
+  AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [
+    dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int',
+    dnl and to itself otherwise. This assumption is not guaranteed by the ISO C
+    dnl standard, but we don't know of any real-world counterexamples.
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
+      [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])],
+      [gl_cv_promoted_mode_t='int'],
+      [gl_cv_promoted_mode_t='mode_t'])
+  ])
+  AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t],
+    [Define to the type that is the result of default argument promotions of type mode_t.])
+])
deleted file mode 120000 (symlink)
index 0d24cc20b42b1961925be0e469c16c5edc8bee86..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/modechange.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..88213d0a49f6c61d6abb36947ba97b43344eb6a0
--- /dev/null
@@ -0,0 +1,11 @@
+# modechange.m4 serial 7
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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_MODECHANGE],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 0f14ec95226a73c95ed782cd56036f41ea24dcf9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mountlist.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a5ae8812d808d53e3d46199edf5677d2484b96f9
--- /dev/null
@@ -0,0 +1,349 @@
+# serial 17
+dnl Copyright (C) 2002-2006, 2009-2024 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 Jim Meyering.
+
+AC_PREREQ([2.60])
+
+AC_DEFUN([gl_MOUNTLIST],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS([listmntent])
+  AC_CHECK_HEADERS_ONCE([sys/param.h sys/statvfs.h])
+
+  # We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses
+  # NGROUPS (as the array dimension for a struct member) without a definition.
+  AC_CHECK_HEADERS([sys/ucred.h], [], [], [#include <grp.h>])
+
+  AC_CHECK_HEADERS([sys/mount.h], [], [],
+    [AC_INCLUDES_DEFAULT
+     [#if HAVE_SYS_PARAM_H
+       #include <sys/param.h>
+      #endif
+    ]])
+
+  AC_CHECK_HEADERS([mntent.h sys/fs_types.h])
+  getfsstat_includes="\
+$ac_includes_default
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */
+#endif
+#if HAVE_SYS_UCRED_H
+# include <grp.h> /* needed for definition of NGROUPS */
+# include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
+#endif
+#if HAVE_SYS_MOUNT_H
+# include <sys/mount.h>
+#endif
+#if HAVE_SYS_FS_TYPES_H
+# include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
+#endif
+"
+  AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes])
+
+  # Determine how to get the list of mounted file systems.
+  ac_list_mounted_fs=
+
+  # If the getmntent function is available but not in the standard library,
+  # make sure LIBS contains the appropriate -l option.
+  AC_FUNC_GETMNTENT
+
+  if test -z "$ac_list_mounted_fs"; then
+    # AIX.
+    AC_CACHE_CHECK([for mntctl function and struct vmount],
+      [fu_cv_sys_mounted_vmount],
+      [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <fshelp.h>]])],
+         [fu_cv_sys_mounted_vmount=yes],
+         [fu_cv_sys_mounted_vmount=no])])
+    if test $fu_cv_sys_mounted_vmount = yes; then
+      ac_list_mounted_fs=found
+      AC_DEFINE([MOUNTED_VMOUNT], [1],
+        [Define if there is a function named mntctl that can be used to read
+         the list of mounted file systems, and there is a system header file
+         that declares 'struct vmount'.  (AIX)])
+    fi
+  fi
+
+  if test $ac_cv_func_getmntent = yes; then
+
+    # This system has the getmntent function.
+    # Determine whether it's the one-argument variant or the two-argument one.
+
+    if test -z "$ac_list_mounted_fs"; then
+      # glibc, HP-UX, IRIX, Cygwin, Android, also (obsolete) 4.3BSD, SunOS.
+      AC_CACHE_CHECK([for one-argument getmntent function],
+        [fu_cv_sys_mounted_getmntent1],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM([[
+/* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
+#include <stdio.h>
+
+#include <mntent.h>
+#if defined __ANDROID__        /* Android */
+# undef MOUNTED
+# define MOUNTED "/proc/mounts"
+#elif !defined MOUNTED
+# if defined _PATH_MOUNTED     /* GNU libc  */
+#  define MOUNTED _PATH_MOUNTED
+# endif
+# if defined MNT_MNTTAB        /* HP-UX.  */
+#  define MOUNTED MNT_MNTTAB
+# endif
+#endif
+]],
+              [[struct mntent *mnt = 0; char *table = MOUNTED;
+                if (sizeof mnt && sizeof table) return 0;
+              ]])],
+           [fu_cv_sys_mounted_getmntent1=yes],
+           [fu_cv_sys_mounted_getmntent1=no])
+        ])
+      if test $fu_cv_sys_mounted_getmntent1 = yes; then
+        ac_list_mounted_fs=found
+        AC_DEFINE([MOUNTED_GETMNTENT1], [1],
+          [Define if there is a function named getmntent for reading the list
+           of mounted file systems, and that function takes a single argument.
+           (4.3BSD, SunOS, HP-UX, Irix)])
+        gl_CHECK_FUNCS_ANDROID([setmntent],
+          [[#include <stdio.h>
+            #include <mntent.h>
+          ]])
+        gl_CHECK_FUNCS_ANDROID([endmntent],
+          [[#include <stdio.h>
+            #include <mntent.h>
+          ]])
+        gl_CHECK_FUNCS_ANDROID([hasmntopt],
+          [[#include <stdio.h>
+            #include <mntent.h>
+          ]])
+      fi
+    fi
+
+    if test -z "$ac_list_mounted_fs"; then
+      # Solaris >= 8.
+      AC_CACHE_CHECK([for getextmntent function],
+        [fu_cv_sys_mounted_getextmntent],
+        [AC_EGREP_HEADER([getextmntent], [sys/mnttab.h],
+           [fu_cv_sys_mounted_getextmntent=yes],
+           [fu_cv_sys_mounted_getextmntent=no])])
+      if test $fu_cv_sys_mounted_getextmntent = yes; then
+        ac_list_mounted_fs=found
+        AC_DEFINE([MOUNTED_GETEXTMNTENT], [1],
+          [Define if there is a function named getextmntent for reading the list
+           of mounted file systems.  (Solaris)])
+      fi
+    fi
+
+    if test -z "$ac_list_mounted_fs"; then
+      # Solaris < 8, also (obsolete) SVR4.
+      # Solaris >= 8 has the two-argument getmntent but is already handled above.
+      AC_CACHE_CHECK([for two-argument getmntent function],
+        [fu_cv_sys_mounted_getmntent2],
+        [AC_EGREP_HEADER([getmntent], [sys/mnttab.h],
+           [fu_cv_sys_mounted_getmntent2=yes],
+           [fu_cv_sys_mounted_getmntent2=no])
+        ])
+      if test $fu_cv_sys_mounted_getmntent2 = yes; then
+        ac_list_mounted_fs=found
+        AC_DEFINE([MOUNTED_GETMNTENT2], [1],
+          [Define if there is a function named getmntent for reading the list of
+           mounted file systems, and that function takes two arguments.  (SVR4)])
+        AC_CHECK_FUNCS([hasmntopt])
+      fi
+    fi
+
+  fi
+
+  if test -z "$ac_list_mounted_fs"; then
+    # OSF/1, also (obsolete) Apple Darwin 1.3.
+    # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
+
+    AC_CACHE_CHECK([for getfsstat function],
+      [fu_cv_sys_mounted_getfsstat],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
+# define FS_TYPE(Ent) ((Ent).f_fstypename)
+#else
+# define FS_TYPE(Ent) mnt_names[(Ent).f_type]
+#endif
+$getfsstat_includes
+            ]],
+            [[struct statfs *stats;
+              int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
+              char *t = FS_TYPE (*stats);
+            ]])],
+         [fu_cv_sys_mounted_getfsstat=yes],
+         [fu_cv_sys_mounted_getfsstat=no])
+      ])
+    if test $fu_cv_sys_mounted_getfsstat = yes; then
+      ac_list_mounted_fs=found
+      AC_DEFINE([MOUNTED_GETFSSTAT], [1],
+        [Define if there is a function named getfsstat for reading the
+         list of mounted file systems.  (DEC Alpha running OSF/1)])
+    fi
+  fi
+
+  if test -z "$ac_list_mounted_fs"; then
+    # (obsolete) SVR3
+    AC_CACHE_CHECK([for FIXME existence of three headers],
+      [fu_cv_sys_mounted_fread_fstyp],
+      [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
+#include <sys/statfs.h>
+#include <sys/fstyp.h>
+#include <mnttab.h>
+]])],
+         [fu_cv_sys_mounted_fread_fstyp=yes],
+         [fu_cv_sys_mounted_fread_fstyp=no])
+      ])
+    if test $fu_cv_sys_mounted_fread_fstyp = yes; then
+      ac_list_mounted_fs=found
+      AC_DEFINE([MOUNTED_FREAD_FSTYP], [1],
+        [Define if (like SVR2) there is no specific function for reading the
+         list of mounted file systems, and your system has these header files:
+         <sys/fstyp.h> and <sys/statfs.h>.  (SVR3)])
+    fi
+  fi
+
+  if test -z "$ac_list_mounted_fs"; then
+    # Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, also (obsolete) 4.4BSD.
+    # OSF/1 also has getmntinfo but is already handled above.
+    # We cannot use AC_CHECK_FUNCS([getmntinfo]) here, because at the linker
+    # level the function is sometimes called getmntinfo64 or getmntinfo$INODE64
+    # on Mac OS X, __getmntinfo13 on NetBSD and Minix, _F64_getmntinfo on OSF/1.
+    AC_CACHE_CHECK([for getmntinfo function],
+      [fu_cv_sys_mounted_getmntinfo],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM([[
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_MOUNT_H
+# include <sys/mount.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+# include <sys/statvfs.h>
+#endif
+#include <stdlib.h>
+            ]],
+            [[int count = getmntinfo (NULL, MNT_WAIT);
+            ]])],
+         [fu_cv_sys_mounted_getmntinfo=yes],
+         [fu_cv_sys_mounted_getmntinfo=no])
+      ])
+    if test $fu_cv_sys_mounted_getmntinfo = yes; then
+      AC_CACHE_CHECK([whether getmntinfo returns statvfs structures],
+        [fu_cv_sys_mounted_getmntinfo2],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM([[
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_MOUNT_H
+# include <sys/mount.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+# include <sys/statvfs.h>
+#endif
+extern
+#ifdef __cplusplus
+"C"
+#endif
+int getmntinfo (struct statfs **, int);
+              ]], [[]])],
+           [fu_cv_sys_mounted_getmntinfo2=no],
+           [fu_cv_sys_mounted_getmntinfo2=yes])
+        ])
+      if test $fu_cv_sys_mounted_getmntinfo2 = no; then
+        # Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD.
+        ac_list_mounted_fs=found
+        AC_DEFINE([MOUNTED_GETMNTINFO], [1],
+          [Define if there is a function named getmntinfo for reading the
+           list of mounted file systems and it returns an array of
+           'struct statfs'.  (4.4BSD, Darwin)])
+      else
+        # NetBSD, Minix.
+        ac_list_mounted_fs=found
+        AC_DEFINE([MOUNTED_GETMNTINFO2], [1],
+          [Define if there is a function named getmntinfo for reading the
+           list of mounted file systems and it returns an array of
+           'struct statvfs'.  (NetBSD 3.0)])
+      fi
+    fi
+  fi
+
+  if test -z "$ac_list_mounted_fs"; then
+    # Haiku, also (obsolete) BeOS.
+    AC_CHECK_FUNCS([next_dev fs_stat_dev])
+    AC_CHECK_HEADERS([fs_info.h])
+    AC_CACHE_CHECK([for BEOS mounted file system support functions],
+      [fu_cv_sys_mounted_fs_stat_dev],
+      [if test $ac_cv_header_fs_info_h = yes \
+          && test $ac_cv_func_next_dev = yes \
+          && test $ac_cv_func_fs_stat_dev = yes; then
+         fu_cv_sys_mounted_fs_stat_dev=yes
+       else
+         fu_cv_sys_mounted_fs_stat_dev=no
+       fi
+      ])
+    if test $fu_cv_sys_mounted_fs_stat_dev = yes; then
+      ac_list_mounted_fs=found
+      AC_DEFINE([MOUNTED_FS_STAT_DEV], [1],
+        [Define if there are functions named next_dev and fs_stat_dev for
+         reading the list of mounted file systems.  (BeOS)])
+    fi
+  fi
+
+  if test -z "$ac_list_mounted_fs"; then
+    # Interix / BSD alike statvfs
+    # the code is really interix specific, so make sure, we're on it.
+    case "$host" in
+      *-interix*)
+        AC_CHECK_FUNCS([statvfs])
+        if test $ac_cv_func_statvfs = yes; then
+          ac_list_mounted_fs=found
+          AC_DEFINE([MOUNTED_INTERIX_STATVFS], [1],
+            [Define if we are on interix, and ought to use statvfs plus
+             some special knowledge on where mounted file systems can be
+             found. (Interix)])
+        fi
+        ;;
+    esac
+  fi
+
+  if test -z "$ac_list_mounted_fs"; then
+    AC_MSG_ERROR([could not determine how to read list of mounted file systems])
+    # FIXME -- no need to abort building the whole package
+    # Can't build mountlist.c or anything that needs its functions
+  fi
+
+  if test $ac_list_mounted_fs = found; then
+    gl_cv_list_mounted_fs=yes
+  else
+    gl_cv_list_mounted_fs=no
+  fi
+])
+
+# Prerequisites of lib/mountlist.c not done by gl_MOUNTLIST.
+AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA],
+[
+  dnl Note gl_MOUNTLIST checks for mntent.h, not sys/mntent.h.
+  AC_CHECK_HEADERS([sys/mntent.h])
+  AC_HEADER_MAJOR()dnl for use of makedev ()
+  gl_FSTYPENAME
+])
+
+# Replace Autoconf's AC_FUNC_GETMNTENT to omit checks that are unnecessary
+# nowadays.
+AC_DEFUN([AC_FUNC_GETMNTENT],
+[
+  # getmntent is in the standard C library on most systems, but in -lgen on
+  # Unixware.
+  AC_SEARCH_LIBS([getmntent], [gen])
+  AC_CHECK_FUNCS([getmntent])
+])
deleted file mode 120000 (symlink)
index 7af533911777ebd1ff7c907d6bb3ab7a1928ceb0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/mpsort.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3f592e9dab0752e7170bc8773499b5e555eb5a35
--- /dev/null
@@ -0,0 +1,12 @@
+# Sort a vector of pointers to data.
+
+# Copyright (C) 2007, 2009-2024 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_MPSORT],
+[
+  AC_REQUIRE([AC_C_RESTRICT])
+])
deleted file mode 120000 (symlink)
index 52856b18e1223506a1d05be9da92dab13b212805..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/msvc-inval.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b8ba598eeb846fc2dd42a113bb6c6595073e0b9e
--- /dev/null
@@ -0,0 +1,19 @@
+# msvc-inval.m4 serial 1
+dnl Copyright (C) 2011-2024 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_MSVC_INVAL],
+[
+  AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler])
+  if test $ac_cv_func__set_invalid_parameter_handler = yes; then
+    HAVE_MSVC_INVALID_PARAMETER_HANDLER=1
+    AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1],
+      [Define to 1 on MSVC platforms that have the "invalid parameter handler"
+       concept.])
+  else
+    HAVE_MSVC_INVALID_PARAMETER_HANDLER=0
+  fi
+  AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER])
+])
deleted file mode 120000 (symlink)
index 1397b1071816af99e497eda97b98c92babb2c9e9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/msvc-nothrow.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3e332a09356beec8247b66b39b335ee909911146
--- /dev/null
@@ -0,0 +1,10 @@
+# msvc-nothrow.m4 serial 1
+dnl Copyright (C) 2011-2024 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_MSVC_NOTHROW],
+[
+  AC_REQUIRE([gl_MSVC_INVAL])
+])
deleted file mode 120000 (symlink)
index ce80e40997cc88bb65910afc0e5e79a58be4b102..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/multiarch.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5f8339f5c7d22f47e194f316e3f759b14b2ec243
--- /dev/null
@@ -0,0 +1,65 @@
+# multiarch.m4 serial 9
+dnl Copyright (C) 2008-2024 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.
+
+# Determine whether the compiler is or may be producing universal binaries.
+#
+# On Mac OS X 10.5 and later systems, the user can create libraries and
+# executables that work on multiple system types--known as "fat" or
+# "universal" binaries--by specifying multiple '-arch' options to the
+# compiler but only a single '-arch' option to the preprocessor.  Like
+# this:
+#
+#     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+#                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+#                 CPP="gcc -E" CXXCPP="g++ -E"
+#
+# Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly.
+
+AC_DEFUN_ONCE([gl_MULTIARCH],
+[
+  dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
+  AC_CACHE_CHECK([whether the compiler produces multi-arch binaries],
+    [gl_cv_c_multiarch],
+    [gl_cv_c_multiarch=no
+     AC_COMPILE_IFELSE(
+       [AC_LANG_SOURCE(
+         [[#ifndef __APPLE_CC__
+            not a universal capable compiler
+           #endif
+           typedef int dummy;
+         ]])],
+       [
+        dnl Check for potential -arch flags.  It is not universal unless
+        dnl there are at least two -arch flags with different values.
+        arch=
+        prev=
+        for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do
+          if test -n "$prev"; then
+            case $word in
+              i?86 | x86_64 | ppc | ppc64 | arm | arm64)
+                if test -z "$arch" || test "$arch" = "$word"; then
+                  arch="$word"
+                else
+                  gl_cv_c_multiarch=yes
+                fi
+                ;;
+            esac
+            prev=
+          else
+            if test "x$word" = "x-arch"; then
+              prev=arch
+            fi
+          fi
+        done
+       ])
+    ])
+  if test $gl_cv_c_multiarch = yes; then
+    APPLE_UNIVERSAL_BUILD=1
+  else
+    APPLE_UNIVERSAL_BUILD=0
+  fi
+  AC_SUBST([APPLE_UNIVERSAL_BUILD])
+])
deleted file mode 120000 (symlink)
index b6b924597c0177b42f3eb05de56b8081ed0a93ab..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/musl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..34d2c1ff22a148eeb76936410ac497d68b228f59
--- /dev/null
@@ -0,0 +1,20 @@
+# musl.m4 serial 4
+dnl Copyright (C) 2019-2024 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.
+
+# Test for musl libc, despite the musl libc authors don't like it
+# <https://wiki.musl-libc.org/faq.html>
+# <https://lists.gnu.org/archive/html/bug-gnulib/2018-02/msg00079.html>.
+# From Bruno Haible.
+
+AC_DEFUN_ONCE([gl_MUSL_LIBC],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    *-musl* | midipix*)
+      AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 464a79578f3f223c2a1c0f77a63364d42a58fbd8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/nan-mips.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d5650e19973dd58141ca4be3ca77634200e66edf
--- /dev/null
@@ -0,0 +1,89 @@
+# nan-mips.m4 serial 1
+dnl Copyright (C) 2023-2024 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.
+
+# Extra meta-info mentioned by lib/snan.h.
+AC_DEFUN_ONCE([gl_NAN_MIPS],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_cpu" in
+    mips*)
+      AC_CACHE_CHECK([whether the NaN float encoding is IEEE 754-2008 compliant],
+        [gl_cv_nan2008_f],
+        [AC_RUN_IFELSE(
+           [AC_LANG_PROGRAM([[
+              float volatile zero;
+              /* Assume 'float' has 32 bits, i.e. IEEE single-float.  */
+              union { float value; unsigned int word; } qnan;
+              ]],
+              [[qnan.value = zero / zero;
+                return !((qnan.word >> 22) & 1);
+              ]])
+           ],
+           [gl_cv_nan2008_f=yes],
+           [gl_cv_nan2008_f=no],
+           [gl_cv_nan2008_f="guessing no"])
+        ])
+      case "$gl_cv_nan2008_f" in
+        *yes) gl_mips_nan2008_f=1 ;;
+        *)    gl_mips_nan2008_f=0 ;;
+      esac
+      AC_DEFINE_UNQUOTED([MIPS_NAN2008_FLOAT], [$gl_mips_nan2008_f],
+        [Define to 1 if the encoding of NaN 'float's is as in IEEE 754-2008 § 6.2.1.])
+
+      AC_CACHE_CHECK([whether the NaN double encoding is IEEE 754-2008 compliant],
+        [gl_cv_nan2008_d],
+        [AC_RUN_IFELSE(
+           [AC_LANG_PROGRAM([[
+              double volatile zero;
+              /* Assume 'double' has 64 bits, i.e. IEEE double-float.  */
+              union { double value; unsigned long long word; } qnan;
+              ]],
+              [[qnan.value = zero / zero;
+                return !((qnan.word >> 51) & 1);
+              ]])
+           ],
+           [gl_cv_nan2008_d=yes],
+           [gl_cv_nan2008_d=no],
+           [gl_cv_nan2008_d="guessing no"])
+        ])
+      case "$gl_cv_nan2008_d" in
+        *yes) gl_mips_nan2008_d=1 ;;
+        *)    gl_mips_nan2008_d=0 ;;
+      esac
+      AC_DEFINE_UNQUOTED([MIPS_NAN2008_DOUBLE], [$gl_mips_nan2008_d],
+        [Define to 1 if the encoding of NaN 'double's is as in IEEE 754-2008 § 6.2.1.])
+
+      AC_CACHE_CHECK([whether the NaN long double encoding is IEEE 754-2008 compliant],
+        [gl_cv_nan2008_l],
+        [AC_RUN_IFELSE(
+           [AC_LANG_PROGRAM([[
+              #include <float.h>
+              long double volatile zero;
+              #define NWORDS \
+                ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+              union { long double value; unsigned int word[NWORDS]; } qnan;
+              ]],
+              [[qnan.value = zero / zero;
+                #if defined _MIPSEB /* equivalent: __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ */
+                return !((qnan.word[0] >> ((LDBL_MANT_DIG - 2) % 32)) & 1);
+                #else
+                return !((qnan.word[NWORDS - 1] >> ((LDBL_MANT_DIG - 2) % 32)) & 1);
+                #endif
+              ]])
+           ],
+           [gl_cv_nan2008_l=yes],
+           [gl_cv_nan2008_l=no],
+           [gl_cv_nan2008_l="guessing no"])
+        ])
+      case "$gl_cv_nan2008_l" in
+        *yes) gl_mips_nan2008_l=1 ;;
+        *)    gl_mips_nan2008_l=0 ;;
+      esac
+      AC_DEFINE_UNQUOTED([MIPS_NAN2008_LONG_DOUBLE], [$gl_mips_nan2008_l],
+        [Define to 1 if the encoding of NaN 'long double's is as in IEEE 754-2008 § 6.2.1.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 201c7dc946ddc375ff8b7a1c108077c4b6818741..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/nanosleep.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2302d2d91689f96bccaf2de7e0e1ddbe8a286b3a
--- /dev/null
@@ -0,0 +1,151 @@
+# serial 45
+
+dnl From Jim Meyering.
+dnl Check for the nanosleep function.
+dnl If not found, use the supplied replacement.
+dnl
+
+# Copyright (C) 1999-2001, 2003-2024 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_FUNC_NANOSLEEP],
+[
+ AC_REQUIRE([gl_TIME_H_DEFAULTS])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ dnl Persuade glibc and Solaris <time.h> to declare nanosleep.
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ AC_CHECK_DECLS_ONCE([alarm])
+
+ nanosleep_save_libs=$LIBS
+
+ # Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
+ # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
+ NANOSLEEP_LIB=
+ AC_SUBST([NANOSLEEP_LIB])
+ AC_SEARCH_LIBS([nanosleep], [rt posix4],
+                [test "$ac_cv_search_nanosleep" = "none required" ||
+                 NANOSLEEP_LIB=$ac_cv_search_nanosleep])
+ if test "x$ac_cv_search_nanosleep" != xno; then
+   dnl The system has a nanosleep function.
+
+   AC_REQUIRE([gl_MULTIARCH])
+   if test $APPLE_UNIVERSAL_BUILD = 1; then
+     # A universal build on Apple Mac OS X platforms.
+     # The test result would be 'no (mishandles large arguments)' in 64-bit
+     # mode but 'yes' in 32-bit mode. But we need a configuration result that
+     # is valid in both modes.
+     gl_cv_func_nanosleep='no (mishandles large arguments)'
+   fi
+
+   AC_CACHE_CHECK([for working nanosleep],
+    [gl_cv_func_nanosleep],
+    [
+     AC_RUN_IFELSE(
+       [AC_LANG_SOURCE([[
+          #include <errno.h>
+          #include <limits.h>
+          #include <signal.h>
+          #include <time.h>
+          #include <unistd.h>
+          #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+          #define TYPE_MAXIMUM(t) \
+            ((t) (! TYPE_SIGNED (t) \
+                  ? (t) -1 \
+                  : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
+
+          #if HAVE_DECL_ALARM
+          static void
+          check_for_SIGALRM (int sig)
+          {
+            if (sig != SIGALRM)
+              _exit (1);
+          }
+          #endif
+
+          int
+          main ()
+          {
+            static struct timespec ts_sleep;
+            static struct timespec ts_remaining;
+            /* Test for major problems first.  */
+            if (! nanosleep)
+              return 2;
+            ts_sleep.tv_sec = 0;
+            ts_sleep.tv_nsec = 1;
+            #if HAVE_DECL_ALARM
+            {
+              static struct sigaction act;
+              act.sa_handler = check_for_SIGALRM;
+              sigemptyset (&act.sa_mask);
+              sigaction (SIGALRM, &act, NULL);
+              alarm (1);
+              if (nanosleep (&ts_sleep, NULL) != 0)
+                return 3;
+              /* Test for a minor problem: the handling of large arguments.  */
+              ts_sleep.tv_sec = TYPE_MAXIMUM (time_t);
+              ts_sleep.tv_nsec = 999999999;
+              alarm (1);
+              if (nanosleep (&ts_sleep, &ts_remaining) != -1)
+                return 4;
+              if (errno != EINTR)
+                return 5;
+              if (ts_remaining.tv_sec <= TYPE_MAXIMUM (time_t) - 10)
+                return 6;
+            }
+            #else /* A simpler test for native Windows.  */
+            if (nanosleep (&ts_sleep, &ts_remaining) < 0)
+              return 3;
+            /* Test for 32-bit mingw bug: negative nanosecond values do not
+               cause failure.  */
+            ts_sleep.tv_sec = 1;
+            ts_sleep.tv_nsec = -1;
+            if (nanosleep (&ts_sleep, &ts_remaining) != -1)
+              return 7;
+            #endif
+            return 0;
+          }]])],
+       [gl_cv_func_nanosleep=yes],
+       [case $? in
+        4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)' ;;
+        7)     gl_cv_func_nanosleep='no (mishandles negative tv_nsec)' ;;
+        *)     gl_cv_func_nanosleep=no ;;
+        esac],
+       [case "$host_os" in
+            # Guess it halfway works when the kernel is Linux.
+          linux*)
+            gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;;
+            # Guess no on native Windows.
+          mingw* | windows*)
+            gl_cv_func_nanosleep='guessing no' ;;
+            # If we don't know, obey --enable-cross-guesses.
+          *)
+            gl_cv_func_nanosleep="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
+   case "$gl_cv_func_nanosleep" in
+     *yes) ;;
+     *)
+       REPLACE_NANOSLEEP=1
+       case "$gl_cv_func_nanosleep" in
+         *"mishandles large arguments"*)
+           AC_DEFINE([HAVE_BUG_BIG_NANOSLEEP], [1],
+             [Define to 1 if nanosleep mishandles large arguments.])
+           ;;
+       esac
+       ;;
+   esac
+ else
+   HAVE_NANOSLEEP=0
+ fi
+ LIBS=$nanosleep_save_libs
+
+ # For backward compatibility.
+ LIB_NANOSLEEP="$NANOSLEEP_LIB"
+ AC_SUBST([LIB_NANOSLEEP])
+])
deleted file mode 120000 (symlink)
index dbae5705c06ab74be072c2ff3deaf9474a6cb378..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/netdb_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dc6539852cd973e871b5bb23574f592a9af61d2c
--- /dev/null
@@ -0,0 +1,59 @@
+# netdb_h.m4 serial 15
+dnl Copyright (C) 2008-2024 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_ONCE([gl_NETDB_H],
+[
+  AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+  gl_CHECK_NEXT_HEADERS([netdb.h])
+  if test $ac_cv_header_netdb_h = yes; then
+    HAVE_NETDB_H=1
+  else
+    HAVE_NETDB_H=0
+  fi
+  AC_SUBST([HAVE_NETDB_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <netdb.h>]],
+    [getaddrinfo freeaddrinfo gai_strerror getnameinfo])
+])
+
+# gl_NETDB_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_NETDB_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_NETDB_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_NETDB_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_NETDB_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETADDRINFO])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_NETDB_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_NETDB_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_STRUCT_ADDRINFO=1;   AC_SUBST([HAVE_STRUCT_ADDRINFO])
+  HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO])
+  HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR])
+  HAVE_DECL_GETADDRINFO=1;  AC_SUBST([HAVE_DECL_GETADDRINFO])
+  HAVE_DECL_GETNAMEINFO=1;  AC_SUBST([HAVE_DECL_GETNAMEINFO])
+  REPLACE_GAI_STRERROR=0;   AC_SUBST([REPLACE_GAI_STRERROR])
+  REPLACE_GETADDRINFO=0;    AC_SUBST([REPLACE_GETADDRINFO])
+])
deleted file mode 120000 (symlink)
index b6e5847b716136b37a74eeb38c9b47a6548faa22..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/netinet_in_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9618c0ccc6bd17fb826fd0b8da9f1fc963fb3a43
--- /dev/null
@@ -0,0 +1,29 @@
+# netinet_in_h.m4 serial 6
+dnl Copyright (C) 2006-2024 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_HEADER_NETINET_IN],
+[
+  AC_CACHE_CHECK([whether <netinet/in.h> is self-contained],
+    [gl_cv_header_netinet_in_h_selfcontained],
+    [
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[]])],
+        [gl_cv_header_netinet_in_h_selfcontained=yes],
+        [gl_cv_header_netinet_in_h_selfcontained=no])
+    ])
+  if test $gl_cv_header_netinet_in_h_selfcontained = yes; then
+    GL_GENERATE_NETINET_IN_H=false
+  else
+    GL_GENERATE_NETINET_IN_H=true
+    AC_CHECK_HEADERS([netinet/in.h])
+    gl_CHECK_NEXT_HEADERS([netinet/in.h])
+    if test $ac_cv_header_netinet_in_h = yes; then
+      HAVE_NETINET_IN_H=1
+    else
+      HAVE_NETINET_IN_H=0
+    fi
+    AC_SUBST([HAVE_NETINET_IN_H])
+  fi
+])
deleted file mode 120000 (symlink)
index ac71604427ff267d864e029308bf33a532bde2ef..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/nl_langinfo.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3ffefe3cdd0e5de7a50c01264092c9aa5a9c5d46
--- /dev/null
@@ -0,0 +1,80 @@
+# nl_langinfo.m4 serial 11
+dnl Copyright (C) 2009-2024 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_NL_LANGINFO],
+[
+  AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
+  AC_REQUIRE([gl_LANGINFO_H])
+  gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include <langinfo.h>]])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
+  AC_REQUIRE([gl_PTHREADLIB])
+  AC_CHECK_HEADERS_ONCE([threads.h])
+  if test $ac_cv_func_nl_langinfo = yes; then
+    # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken.
+    AC_CACHE_CHECK([whether YESEXPR works],
+      [gl_cv_func_nl_langinfo_yesexpr_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[#include <langinfo.h>
+]], [[return !*nl_langinfo(YESEXPR);
+]])],
+         [gl_cv_func_nl_langinfo_yesexpr_works=yes],
+         [gl_cv_func_nl_langinfo_yesexpr_works=no],
+         [
+         case "$host_os" in
+                   # Guess no on irix systems.
+           irix*)  gl_cv_func_nl_langinfo_yesexpr_works="guessing no";;
+                   # Guess yes elsewhere.
+           *)      gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";;
+         esac
+         ])
+      ])
+    case $gl_cv_func_nl_langinfo_yesexpr_works in
+      *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;;
+      *)    FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;;
+    esac
+    AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
+      [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
+      [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.])
+    # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe.
+    case "$host_os" in
+      solaris*) NL_LANGINFO_MTSAFE=0 ;;
+      *)        NL_LANGINFO_MTSAFE=1 ;;
+    esac
+    AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE],
+      [Define to 1 if nl_langinfo is multithread-safe.])
+    if test $HAVE_LANGINFO_CODESET = 1 \
+       && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \
+       && test $HAVE_LANGINFO_ALTMON = 1 \
+       && test $HAVE_LANGINFO_ERA = 1 \
+       && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \
+       && test $NL_LANGINFO_MTSAFE = 1; then
+      :
+    else
+      REPLACE_NL_LANGINFO=1
+      AC_DEFINE([REPLACE_NL_LANGINFO], [1],
+        [Define if nl_langinfo exists but is overridden by gnulib.])
+    fi
+  else
+    HAVE_NL_LANGINFO=0
+    case "$gl_cv_onwards_func_nl_langinfo" in
+      future*) REPLACE_NL_LANGINFO=1 ;;
+    esac
+  fi
+  if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then
+    LIB_NL_LANGINFO="$SETLOCALE_NULL_LIB"
+  else
+    LIB_NL_LANGINFO=
+  fi
+  dnl LIB_NL_LANGINFO is expected to be empty everywhere.
+  AC_SUBST([LIB_NL_LANGINFO])
+])
+
+# Prerequisites of lib/nl_langinfo-lock.c.
+AC_DEFUN([gl_PREREQ_NL_LANGINFO_LOCK],
+[
+  gl_VISIBILITY
+])
deleted file mode 120000 (symlink)
index d4a55e187ba0f2415b04de0f4f522aacb1d4cf7d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/nocrash.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9730fc09034cff6c66c97a847fcc33763e13a88c
--- /dev/null
@@ -0,0 +1,131 @@
+# nocrash.m4 serial 5
+dnl Copyright (C) 2005, 2009-2024 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 Based on libsigsegv, from Bruno Haible and Paolo Bonzini.
+
+AC_PREREQ([2.13])
+
+dnl Expands to some code for use in .c programs that will cause the configure
+dnl test to exit instead of crashing. This is useful to avoid triggering
+dnl action from a background debugger and to avoid core dumps.
+dnl Usage:   ...
+dnl          ]GL_NOCRASH[
+dnl          ...
+dnl          int main() { nocrash_init(); ... }
+AC_DEFUN([GL_NOCRASH],[[
+#include <stdlib.h>
+#if defined __MACH__ && defined __APPLE__
+/* Avoid a crash on Mac OS X.  */
+#include <mach/mach.h>
+#include <mach/mach_error.h>
+#include <mach/thread_status.h>
+#include <mach/exception.h>
+#include <mach/task.h>
+#include <pthread.h>
+/* The exception port on which our thread listens.  */
+static mach_port_t our_exception_port;
+/* The main function of the thread listening for exceptions of type
+   EXC_BAD_ACCESS.  */
+static void *
+mach_exception_thread (void *arg)
+{
+  /* Buffer for a message to be received.  */
+  struct {
+    mach_msg_header_t head;
+    mach_msg_body_t msgh_body;
+    char data[1024];
+  } msg;
+  mach_msg_return_t retval;
+  /* Wait for a message on the exception port.  */
+  retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg),
+                     our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+  if (retval != MACH_MSG_SUCCESS)
+    abort ();
+  exit (1);
+}
+static void
+nocrash_init (void)
+{
+  mach_port_t self = mach_task_self ();
+  /* Allocate a port on which the thread shall listen for exceptions.  */
+  if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
+      == KERN_SUCCESS) {
+    /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html.  */
+    if (mach_port_insert_right (self, our_exception_port, our_exception_port,
+                                MACH_MSG_TYPE_MAKE_SEND)
+        == KERN_SUCCESS) {
+      /* The exceptions we want to catch.  Only EXC_BAD_ACCESS is interesting
+         for us.  */
+      exception_mask_t mask = EXC_MASK_BAD_ACCESS;
+      /* Create the thread listening on the exception port.  */
+      pthread_attr_t attr;
+      pthread_t thread;
+      if (pthread_attr_init (&attr) == 0
+          && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0
+          && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) {
+        pthread_attr_destroy (&attr);
+        /* Replace the exception port info for these exceptions with our own.
+           Note that we replace the exception port for the entire task, not only
+           for a particular thread.  This has the effect that when our exception
+           port gets the message, the thread specific exception port has already
+           been asked, and we don't need to bother about it.
+           See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html.  */
+        task_set_exception_ports (self, mask, our_exception_port,
+                                  EXCEPTION_DEFAULT, MACHINE_THREAD_STATE);
+      }
+    }
+  }
+}
+#elif defined _WIN32 && ! defined __CYGWIN__
+/* Avoid a crash on native Windows.  */
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <winerror.h>
+static LONG WINAPI
+exception_filter (EXCEPTION_POINTERS *ExceptionInfo)
+{
+  switch (ExceptionInfo->ExceptionRecord->ExceptionCode)
+    {
+    case EXCEPTION_ACCESS_VIOLATION:
+    case EXCEPTION_IN_PAGE_ERROR:
+    case EXCEPTION_STACK_OVERFLOW:
+    case EXCEPTION_GUARD_PAGE:
+    case EXCEPTION_PRIV_INSTRUCTION:
+    case EXCEPTION_ILLEGAL_INSTRUCTION:
+    case EXCEPTION_DATATYPE_MISALIGNMENT:
+    case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
+    case EXCEPTION_NONCONTINUABLE_EXCEPTION:
+      exit (1);
+    }
+  return EXCEPTION_CONTINUE_SEARCH;
+}
+static void
+nocrash_init (void)
+{
+  SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter);
+}
+#else
+/* Avoid a crash on POSIX systems.  */
+#include <signal.h>
+#include <unistd.h>
+/* A POSIX signal handler.  */
+static void
+exception_handler (int sig)
+{
+  _exit (1);
+}
+static void
+nocrash_init (void)
+{
+#ifdef SIGSEGV
+  signal (SIGSEGV, exception_handler);
+#endif
+#ifdef SIGBUS
+  signal (SIGBUS, exception_handler);
+#endif
+}
+#endif
+]])
deleted file mode 120000 (symlink)
index aac671bf77e255fa41158a6375bdd6629248fe65..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/nproc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e4065776a8668520df80c204d048f9a60e150128
--- /dev/null
@@ -0,0 +1,54 @@
+# nproc.m4 serial 6
+dnl Copyright (C) 2009-2024 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_NPROC],
+[
+  gl_PREREQ_NPROC
+])
+
+# Prerequisites of lib/nproc.c.
+AC_DEFUN([gl_PREREQ_NPROC],
+[
+  dnl Persuade glibc <sched.h> to declare CPU_SETSIZE, CPU_ISSET etc.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_HEADERS([sys/pstat.h sys/sysmp.h sys/param.h],,,
+    [AC_INCLUDES_DEFAULT])
+  dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
+  AC_CHECK_HEADERS([sys/sysctl.h],,,
+    [AC_INCLUDES_DEFAULT
+     #if HAVE_SYS_PARAM_H
+     # include <sys/param.h>
+     #endif
+    ])
+
+  AC_CHECK_FUNCS([sched_getaffinity_np pstat_getdynamic sysmp sysctl])
+  gl_CHECK_FUNCS_ANDROID([sched_getaffinity], [[#include <sched.h>]])
+
+  dnl Test whether sched_getaffinity has the expected declaration.
+  dnl glibc 2.3.[0-2]:
+  dnl   int sched_getaffinity (pid_t, unsigned int, unsigned long int *);
+  dnl glibc 2.3.3:
+  dnl   int sched_getaffinity (pid_t, cpu_set_t *);
+  dnl glibc >= 2.3.4:
+  dnl   int sched_getaffinity (pid_t, size_t, cpu_set_t *);
+  if test $ac_cv_func_sched_getaffinity = yes; then
+    AC_CACHE_CHECK([for glibc compatible sched_getaffinity],
+      [gl_cv_func_sched_getaffinity3],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <errno.h>
+              #include <sched.h>]],
+            [[sched_getaffinity (0, 0, (cpu_set_t *) 0);]])],
+         [gl_cv_func_sched_getaffinity3=yes],
+         [gl_cv_func_sched_getaffinity3=no])
+      ])
+    if test $gl_cv_func_sched_getaffinity3 = yes; then
+      AC_DEFINE([HAVE_SCHED_GETAFFINITY_LIKE_GLIBC], [1],
+        [Define to 1 if sched_getaffinity has a glibc compatible declaration.])
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index 2d534699f6f94572233c69bfbec30d0b4cdf9c20..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/nstrftime.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..67250dc94556c37cf7f26911b7d13614eec7255b
--- /dev/null
@@ -0,0 +1,22 @@
+# serial 37
+
+# Copyright (C) 1996-1997, 1999-2007, 2009-2024 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.
+
+# Written by Jim Meyering and Paul Eggert.
+
+AC_DEFUN([gl_FUNC_GNU_STRFTIME],
+[
+ AC_REQUIRE([AC_C_RESTRICT])
+
+ # This defines (or not) HAVE_TZNAME and HAVE_STRUCT_TM_TM_ZONE.
+ AC_REQUIRE([AC_STRUCT_TIMEZONE])
+
+ AC_REQUIRE([gl_TM_GMTOFF])
+
+ AC_DEFINE([my_strftime], [nstrftime],
+   [Define to the name of the strftime replacement function.])
+])
deleted file mode 120000 (symlink)
index 63673634cecc641c672a6235f2246af00bcaaff6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/nullptr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f5721e5c33ae3c97e06bd6b434537624fe9510fe
--- /dev/null
@@ -0,0 +1,62 @@
+# Check for nullptr that conforms to C23 and C++11.
+
+dnl Copyright 2023-2024 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_NULLPTR],
+[
+  m4_provide_if([AC_PROG_CC],
+    [AC_LANG_PUSH([C])
+     AC_CACHE_CHECK([for C nullptr], [gl_cv_c_nullptr],
+       [AC_COMPILE_IFELSE(
+          [AC_LANG_SOURCE([[int *p = nullptr;]])],
+          [gl_cv_c_nullptr=yes],
+          [gl_cv_c_nullptr=no])])
+      gl_c_nullptr=$gl_cv_c_nullptr
+      AC_LANG_POP([C])],
+     [gl_c_nullptr=no])
+  if test "$gl_c_nullptr" = yes; then
+    AC_DEFINE([HAVE_C_NULLPTR], [1],
+      [Define to 1 if C nullptr is known to work.])
+  fi
+
+  m4_provide_if([AC_PROG_CXX],
+    [AC_LANG_PUSH([C++])
+     AC_CACHE_CHECK([for C++ nullptr], [gl_cv_cxx_nullptr],
+       [AC_COMPILE_IFELSE(
+          [AC_LANG_SOURCE([[int *p = nullptr;]])],
+          [gl_cv_cxx_nullptr=yes],
+          [AC_COMPILE_IFELSE(
+             [AC_LANG_SOURCE([[#include <stddef.h>
+                               int *p = nullptr;]])],
+             [gl_cv_cxx_nullptr="yes, but it is a <stddef.h> macro"],
+             [gl_cv_cxx_nullptr=no])])])
+     AS_CASE([$gl_cv_cxx_nullptr],
+       [yes],  [gl_have_cxx_nullptr=1],
+       [yes*], [gl_have_cxx_nullptr="(-1)"],
+               [gl_have_cxx_nullptr=0])
+     AC_DEFINE_UNQUOTED([HAVE_CXX_NULLPTR], [$gl_have_cxx_nullptr],
+                        [Define to 1 if C++ nullptr works, 0 if not,
+                         (-1) if it is a <stddef.h> macro.])
+     AC_LANG_POP([C++])])
+])
+
+  AH_VERBATIM([zznullptr],
+[#if defined __cplusplus && HAVE_CXX_NULLPTR < 0
+# include <stddef.h>
+# undef/**/nullptr
+#endif
+#ifndef nullptr
+# if !defined __cplusplus && !defined HAVE_C_NULLPTR
+#  define nullptr ((void *) 0)
+# elif defined __cplusplus && HAVE_CXX_NULLPTR <= 0
+#  if 3 <= __GNUG__
+#   define nullptr __null
+#  else
+#   define nullptr 0L
+#  endif
+# endif
+#endif])
+])
deleted file mode 120000 (symlink)
index bc2013d1ce3ae3c3bfef6d06cb4d8166e84c3258..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/obstack.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..196609d7fbd41b0ff2a07b21b2be6ea5e360f4c2
--- /dev/null
@@ -0,0 +1,48 @@
+# See if we need to provide obstacks.
+
+dnl Copyright 1996-2024 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 Autoconf's AC_FUNC_OBSTACK is marked obsolete since version 2.70.
+dnl We provide our own macro here.
+
+AC_DEFUN([gl_FUNC_OBSTACK],
+[
+  AC_CHECK_HEADERS_ONCE([obstack.h])
+  if test $ac_cv_header_obstack_h = yes; then
+    HAVE_OBSTACK=1
+    AC_CACHE_CHECK([for obstacks that work with any size object],
+      [gl_cv_func_obstack],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include "obstack.h"
+              void *obstack_chunk_alloc (size_t n) { return 0; }
+              void obstack_chunk_free (void *p) { }
+              /* Check that an internal function returns size_t, not int.  */
+              size_t _obstack_memory_used (struct obstack *);
+             ]],
+            [[struct obstack mem;
+              obstack_init (&mem);
+              obstack_free (&mem, 0);
+            ]])],
+         [gl_cv_func_obstack=yes],
+         [gl_cv_func_obstack=no])
+      ])
+    if test $gl_cv_func_obstack = yes; then
+      REPLACE_OBSTACK=0
+    else
+      REPLACE_OBSTACK=1
+    fi
+  else
+    HAVE_OBSTACK=0
+    REPLACE_OBSTACK=0
+  fi
+  if test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1; then
+    GL_GENERATE_OBSTACK_H=true
+  else
+    GL_GENERATE_OBSTACK_H=false
+  fi
+  AC_SUBST([REPLACE_OBSTACK])
+])
deleted file mode 120000 (symlink)
index 4626ba2a24df37a68aaa2aa2e7ecf1b5b644c795..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/off_t.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f3259f9c245b234100a438e4eafb955a68456e64
--- /dev/null
@@ -0,0 +1,18 @@
+# off_t.m4 serial 1
+dnl Copyright (C) 2012-2024 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 Check whether to override the 'off_t' type.
+dnl Set WINDOWS_64_BIT_OFF_T.
+
+AC_DEFUN([gl_TYPE_OFF_T],
+[
+  m4_ifdef([gl_LARGEFILE], [
+    AC_REQUIRE([gl_LARGEFILE])
+  ], [
+    WINDOWS_64_BIT_OFF_T=0
+  ])
+  AC_SUBST([WINDOWS_64_BIT_OFF_T])
+])
deleted file mode 120000 (symlink)
index 9545155f2662fba1f941f0eb2432e72721464ee3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/open-cloexec.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a2d50329b9772ce3cc4253677b5c4d709dfac85a
--- /dev/null
@@ -0,0 +1,21 @@
+# Test whether O_CLOEXEC is defined.
+
+dnl Copyright 2017-2024 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_PREPROC_O_CLOEXEC],
+[
+  AC_CACHE_CHECK([for O_CLOEXEC],
+    [gl_cv_macro_O_CLOEXEC],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[#include <fcntl.h>
+                          #ifndef O_CLOEXEC
+                            choke me;
+                          #endif
+                        ]],
+                        [[return O_CLOEXEC;]])],
+       [gl_cv_macro_O_CLOEXEC=yes],
+       [gl_cv_macro_O_CLOEXEC=no])])
+])
deleted file mode 120000 (symlink)
index 83e5f0ddda9b91f9b116a2f573f7190f47f9308b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/open-slash.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..45310c0c581378b6710d2177333de00293bcd9eb
--- /dev/null
@@ -0,0 +1,60 @@
+# open-slash.m4 serial 2
+dnl Copyright (C) 2007-2024 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 Tests whether open() and creat() recognize a trailing slash.
+dnl Sets gl_cv_func_open_slash.
+AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  dnl open("foo/") should not create a file when the file name has a
+  dnl trailing slash.  FreeBSD only has the problem on symlinks.
+  AC_CHECK_FUNCS_ONCE([lstat])
+  AC_CACHE_CHECK([whether open recognizes a trailing slash],
+    [gl_cv_func_open_slash],
+    [# Assume that if we have lstat, we can also check symlinks.
+     if test $ac_cv_func_lstat = yes; then
+       touch conftest.tmp
+       ln -s conftest.tmp conftest.lnk
+     fi
+     AC_RUN_IFELSE(
+       [AC_LANG_SOURCE([[
+#include <fcntl.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+]GL_MDA_DEFINES[
+int main ()
+{
+  int result = 0;
+#if HAVE_LSTAT
+  if (open ("conftest.lnk/", O_RDONLY) != -1)
+    result |= 1;
+#endif
+  if (open ("conftest.sl/", O_CREAT, 0600) >= 0)
+    result |= 2;
+  return result;
+}]])],
+       [gl_cv_func_open_slash=yes],
+       [gl_cv_func_open_slash=no],
+       [
+changequote(,)dnl
+        case "$host_os" in
+          freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*)
+            gl_cv_func_open_slash="guessing no" ;;
+          *)
+            gl_cv_func_open_slash="guessing yes" ;;
+        esac
+changequote([,])dnl
+       ])
+     rm -f conftest.sl conftest.tmp conftest.lnk
+    ])
+  case "$gl_cv_func_open_slash" in
+    *no)
+      AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1],
+        [Define to 1 if open() fails to recognize a trailing slash.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index a537d023a84def815198d3eac1e2fd8178e75a39..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/open.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..91e5c31b59ac9689d1f5942db2988a6249e1acdc
--- /dev/null
@@ -0,0 +1,56 @@
+# open.m4 serial 16
+dnl Copyright (C) 2007-2024 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_OPEN],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
+  case "$host_os" in
+    mingw* | windows* | pw*)
+      REPLACE_OPEN=1
+      ;;
+    *)
+      dnl open("foo/") should not create a file when the file name has a
+      dnl trailing slash.  FreeBSD only has the problem on symlinks.
+      AC_CHECK_FUNCS_ONCE([lstat])
+      if test "$gl_cv_macro_O_CLOEXEC" != yes; then
+        REPLACE_OPEN=1
+      fi
+      gl_OPEN_TRAILING_SLASH_BUG
+      case "$gl_cv_func_open_slash" in
+        *no)
+          REPLACE_OPEN=1
+          ;;
+      esac
+      ;;
+  esac
+  dnl Replace open() for supporting the gnulib-defined fchdir() function,
+  dnl to keep fchdir's bookkeeping up-to-date.
+  m4_ifdef([gl_FUNC_FCHDIR], [
+    if test $REPLACE_OPEN = 0; then
+      gl_TEST_FCHDIR
+      if test $HAVE_FCHDIR = 0; then
+        REPLACE_OPEN=1
+      fi
+    fi
+  ])
+  dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    if test $REPLACE_OPEN = 0; then
+      gl_NONBLOCKING_IO
+      if test $gl_cv_have_open_O_NONBLOCK != yes; then
+        REPLACE_OPEN=1
+      fi
+    fi
+  ])
+])
+
+# Prerequisites of lib/open.c.
+AC_DEFUN([gl_PREREQ_OPEN],
+[
+  AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
+  :
+])
deleted file mode 120000 (symlink)
index fbedfc3682878d49d118768148c3d719ad398294..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/openat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..47cd93c8c64d73c51448ae07ad4ea4ee05440e05
--- /dev/null
@@ -0,0 +1,38 @@
+# serial 46
+# See if we need to use our replacement for Solaris' openat et al functions.
+
+dnl Copyright (C) 2004-2024 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_REQUIRE([gl_FCNTL_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([openat])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
+  case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink+$gl_cv_macro_O_CLOEXEC in
+  yes+*yes+yes)
+    ;;
+  yes+*)
+    # Solaris 10 lacks O_CLOEXEC.
+    # Solaris 9 has *at functions, but uniformly mishandles trailing
+    # slash in all of them.
+    REPLACE_OPENAT=1
+    ;;
+  *)
+    HAVE_OPENAT=0
+    ;;
+  esac
+])
+
+# Prerequisites of lib/openat.c.
+AC_DEFUN([gl_PREREQ_OPENAT],
+[
+  AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
+  :
+])
deleted file mode 120000 (symlink)
index bf8b8d0639f1f1272d92df39025becb18228c1eb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/opendir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7cc863256fac1bdd8d9443ac8a65cd3ec0af539a
--- /dev/null
@@ -0,0 +1,31 @@
+# opendir.m4 serial 7
+dnl Copyright (C) 2011-2024 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_OPENDIR],
+[
+  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_CHECK_FUNCS([opendir])
+  if test $ac_cv_func_opendir = no; then
+    HAVE_OPENDIR=0
+  else
+    dnl Replace opendir() on native Windows and OS/2 kLIBC,
+    dnl to support fdopendir().
+    AC_REQUIRE([gl_DIRENT_DIR])
+    if test $DIR_HAS_FD_MEMBER = 0; then
+      REPLACE_OPENDIR=1
+    fi
+    dnl Replace opendir() for supporting the gnulib-defined fchdir() function,
+    dnl to keep fchdir's bookkeeping up-to-date.
+    m4_ifdef([gl_FUNC_FCHDIR], [
+      gl_TEST_FCHDIR
+      if test $HAVE_FCHDIR = 0; then
+        REPLACE_OPENDIR=1
+      fi
+    ])
+  fi
+])
deleted file mode 120000 (symlink)
index 739e61b3ff2156bc08a1ee495a970c2a202643cd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/parse-datetime.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1521a599b38f14c070f0ee1322ec6dc4bc90958b
--- /dev/null
@@ -0,0 +1,54 @@
+# parse-datetime.m4 serial 27
+dnl Copyright (C) 2002-2006, 2008-2024 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 Define HAVE_COMPOUND_LITERALS if the C compiler supports compound literals
+dnl as in ISO C99.
+dnl Note that compound literals such as (struct s) { 3, 4 } can be used for
+dnl initialization of stack-allocated variables, but are not constant
+dnl expressions and therefore cannot be used as initializer for global or
+dnl static variables (even though gcc supports this in pre-C99 mode).
+AC_DEFUN([gl_C_COMPOUND_LITERALS],
+[
+  AC_CACHE_CHECK([for compound literals], [gl_cv_compound_literals],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[struct s { int i, j; };]],
+          [[struct s t = (struct s) { 3, 4 };
+            if (t.i != 0) return 0;]])
+       ],
+       [gl_cv_compound_literals=yes],
+       [gl_cv_compound_literals=no])
+    ])
+  if test $gl_cv_compound_literals = yes; then
+    AC_DEFINE([HAVE_COMPOUND_LITERALS], [1],
+      [Define if you have compound literals.])
+  fi
+])
+
+AC_DEFUN([gl_PARSE_DATETIME],
+[
+  dnl parse-datetime.c is generated from parse-datetime.y. It requires bison,
+  dnl because parse-datetime.y uses bison specific features. It requires at
+  dnl least bison-2.4 for %define api.pure.
+  dnl bison is only needed for the maintainer (who touches parse-datetime.y).
+  dnl But in order to avoid separate Makefiles or --enable-maintainer-mode,
+  dnl we put the rule in general Makefile. Now, some people carelessly touch
+  dnl the files or have a broken "make" program, hence the parse-datetime.c
+  dnl rule will sometimes fire. To avoid an error, defines PARSE_DATETIME_BISON
+  dnl to ":" if it is not present or too old.
+  gl_PROG_BISON([PARSE_DATETIME_BISON], [2.4])
+
+  dnl Prerequisites of lib/parse-datetime.h.
+  AC_REQUIRE([gl_TIMESPEC])
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  dnl Prerequisites of lib/parse-datetime.y.
+  AC_REQUIRE([gl_BISON])
+  AC_REQUIRE([gl_C_COMPOUND_LITERALS])
+  AC_STRUCT_TIMEZONE
+  AC_REQUIRE([gl_CLOCK_TIME])
+  AC_REQUIRE([gl_TM_GMTOFF])
+])
deleted file mode 120000 (symlink)
index e8ef38968fe5233f3ec0ec96b6c493fa5b1eb7c3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pathmax.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a0fc296c9b28514891f92ff90c554cb66769bee5
--- /dev/null
@@ -0,0 +1,42 @@
+# pathmax.m4 serial 11
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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])
+])
+
+# Expands to a piece of C program that defines PATH_MAX in the same way as
+# "pathmax.h" will do.
+AC_DEFUN([gl_PATHMAX_SNIPPET], [[
+/* Arrange to define PATH_MAX, like "pathmax.h" does. */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#include <limits.h>
+#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
+# include <sys/param.h>
+#endif
+#if !defined PATH_MAX && defined MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+#endif
+#ifdef __hpux
+# undef PATH_MAX
+# define PATH_MAX 1024
+#endif
+#if defined _WIN32 && ! defined __CYGWIN__
+# undef PATH_MAX
+# define PATH_MAX 260
+#endif
+]])
+
+# Prerequisites of gl_PATHMAX_SNIPPET.
+AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ],
+[
+  AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h])
+])
deleted file mode 120000 (symlink)
index d639ab394777df61c5b5d31eeae71bd541ecca4b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/perl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..51a3c2152496ed5e7b04c57803476c645ac7a275
--- /dev/null
@@ -0,0 +1,53 @@
+# serial 11
+
+dnl From Jim Meyering.
+dnl Find a new-enough version of Perl.
+
+# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2024 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_PERL],
+[
+  dnl FIXME: don't hard-code 5.005
+AC_CACHE_CHECK([for Perl 5.005 or newer],
+ [gl_cv_prog_perl],
+ [
+  if test "${PERL+set}" = set; then
+    # 'PERL' is set in the user's environment.
+    candidate_perl_names="$PERL"
+    perl_specified=yes
+  else
+    candidate_perl_names='perl perl5'
+    perl_specified=no
+  fi
+
+  gl_cv_prog_perl=no
+  for perl in $candidate_perl_names; do
+    # Run test in a subshell; some versions of sh will print an error if
+    # an executable is not found, even if stderr is redirected.
+    if ( $perl -e 'require 5.005; use File::Compare; use warnings;' ) > /dev/null 2>&1; then
+      gl_cv_prog_perl=$perl
+      break
+    fi
+  done
+ ])
+
+if test "$gl_cv_prog_perl" != no; then
+  PERL=$gl_cv_prog_perl
+else
+  PERL="$am_missing_run perl"
+  AC_MSG_WARN([
+WARNING: You don't seem to have perl5.005 or newer installed, or you lack
+         a usable version of the Perl File::Compare module.  As a result,
+         you may be unable to run a few tests or to regenerate certain
+         files if you modify the sources from which they are derived.
+] )
+fi
+
+AC_SUBST([PERL])
+
+])
deleted file mode 120000 (symlink)
index 614e5f86cd59ca39d06450bafd5c1306f8183aaa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/perror.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6538c2527148bd24d07168674c535760cdd44f88
--- /dev/null
@@ -0,0 +1,76 @@
+# perror.m4 serial 13
+dnl Copyright (C) 2008-2024 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_PERROR],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([gl_HEADER_ERRNO_H])
+  AC_REQUIRE([gl_FUNC_STRERROR_R])
+  AC_REQUIRE([gl_FUNC_STRERROR_0])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  dnl We intentionally do not check for the broader REPLACE_STRERROR_R,
+  dnl since on glibc systems, strerror_r is replaced only for signature
+  dnl issues, and perror is just fine.  Rather, we only want to
+  dnl replace perror if strerror_r was replaced for a content fix.
+  if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" != false:0; then
+    dnl The system's perror() cannot know about the new errno values we add
+    dnl to <errno.h>, or any fix for strerror(0). Replace it.
+    REPLACE_PERROR=1
+  fi
+  case ${gl_cv_func_strerror_r_works-unset} in
+    unset|*yes)
+      AC_CACHE_CHECK([whether perror matches strerror],
+        [gl_cv_func_perror_works],
+        [AC_RUN_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <errno.h>
+                #include <stdio.h>
+                #include <stdlib.h>
+                #include <string.h>
+              ]],
+              [[char *str = strerror (-1);
+                if (!getenv("CONFTEST_OUTPUT")) return 0;
+                if (!str) str = "";
+                puts (str);
+                errno = -1;
+                perror ("");
+                return 0;
+              ]])],
+           [if CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2 \
+               && cmp conftest.txt1 conftest.txt2 >/dev/null; then
+              gl_cv_func_perror_works=yes
+            else
+              gl_cv_func_perror_works=no
+            fi
+            rm -rf conftest.txt1 conftest.txt2],
+           [gl_cv_func_perror_works=no],
+           [case "$host_os" in
+                                  # Guess yes on musl systems.
+              *-musl* | midipix*) gl_cv_func_perror_works="guessing yes" ;;
+                                  # Guess yes on native Windows.
+              mingw* | windows*)  gl_cv_func_perror_works="guessing yes" ;;
+                                  # Otherwise obey --enable-cross-guesses.
+              *)                  gl_cv_func_perror_works="$gl_cross_guess_normal" ;;
+            esac
+           ])
+        ])
+      case "$gl_cv_func_perror_works" in
+        *yes) ;;
+        *) REPLACE_PERROR=1 ;;
+      esac
+      ;;
+    *)
+      dnl The system's perror() probably inherits the bugs in the
+      dnl system's strerror_r(). Replace it.
+      REPLACE_PERROR=1
+      ;;
+  esac
+  dnl Does perror clobber the strerror buffer?
+  case "$host_os" in
+                     # Yes on Android 11.
+    linux*-android*) REPLACE_PERROR=1 ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 60a58acb49673117b5599e335a026fc18b5b9bd6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/physmem.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7eef90f42eff1eba97c55ca40751ee898592b767
--- /dev/null
@@ -0,0 +1,46 @@
+# physmem.m4 serial 12
+dnl Copyright (C) 2002-2003, 2005-2006, 2008-2024 Free Software Foundation,
+dnl 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.
+
+# Check for the external symbol, _system_configuration,
+# a struct with member 'physmem'.
+AC_DEFUN([gl_SYS__SYSTEM_CONFIGURATION],
+  [AC_CACHE_CHECK([for external symbol _system_configuration],
+                  [gl_cv_var__system_configuration],
+    [AC_LINK_IFELSE([AC_LANG_PROGRAM(
+                      [[#include <sys/systemcfg.h>
+                      ]],
+                      [[double x = _system_configuration.physmem;
+                        if (x > 0.0) return 0;]])],
+      [gl_cv_var__system_configuration=yes],
+      [gl_cv_var__system_configuration=no])])
+
+    if test $gl_cv_var__system_configuration = yes; then
+      AC_DEFINE([HAVE__SYSTEM_CONFIGURATION], [1],
+                [Define to 1 if you have the external variable,
+                _system_configuration with a member named physmem.])
+    fi
+  ]
+)
+
+AC_DEFUN([gl_PHYSMEM],
+[
+  # Prerequisites of lib/physmem.c.
+  AC_CHECK_HEADERS([sys/pstat.h sys/sysmp.h sys/sysinfo.h \
+    machine/hal_sysinfo.h sys/table.h sys/param.h sys/systemcfg.h],,,
+    [AC_INCLUDES_DEFAULT])
+  dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
+  AC_CHECK_HEADERS([sys/sysctl.h],,,
+    [AC_INCLUDES_DEFAULT
+     #if HAVE_SYS_PARAM_H
+     # include <sys/param.h>
+     #endif
+    ])
+
+  AC_CHECK_FUNCS([pstat_getstatic pstat_getdynamic sysmp getsysinfo sysctl table sysinfo])
+  AC_CHECK_MEMBERS([struct sysinfo.mem_unit],,, [[#include <sys/sysinfo.h>]])
+  AC_REQUIRE([gl_SYS__SYSTEM_CONFIGURATION])
+])
deleted file mode 120000 (symlink)
index 16540b878e5defe0aa68246dfd9abd316a7d2c1b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pid_t.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8f8d39d81dbb44cfd906875f589d6f4fd2aa3f3f
--- /dev/null
@@ -0,0 +1,38 @@
+# pid_t.m4 serial 4
+dnl Copyright (C) 2020-2024 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.
+
+# The following implementation works around a problem in autoconf <= 2.69.
+m4_version_prereq([2.70], [], [
+
+dnl Define pid_t if the headers don't define it.
+AC_DEFUN([AC_TYPE_PID_T],
+[
+  AC_CHECK_TYPE([pid_t],
+    [],
+    [dnl On 64-bit native Windows, define it to the equivalent of 'intptr_t'
+     dnl (= 'long long' = '__int64'), because that is the return type
+     dnl of the _spawnv* functions
+     dnl <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/spawnvp-wspawnvp>
+     dnl and the argument type of the _cwait function
+     dnl <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/cwait>.
+     dnl Otherwise (on 32-bit Windows and on old Unix platforms), define it
+     dnl to 'int'.
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #if defined _WIN64 && !defined __CYGWIN__
+          LLP64
+          #endif
+          ]])
+       ],
+       [gl_pid_type='int'],
+       [gl_pid_type='__int64'])
+     AC_DEFINE_UNQUOTED([pid_t], [$gl_pid_type],
+       [Define as a signed integer type capable of holding a process identifier.])
+    ],
+    [AC_INCLUDES_DEFAULT])
+])
+
+])# m4_version_prereq 2.70
deleted file mode 120000 (symlink)
index 701fbff8aea83f22b2de8ade9ef4e8b902f3dae1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pipe.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1d3742eb082d5a8d637ebafae70cdd1e91dd45b3
--- /dev/null
@@ -0,0 +1,15 @@
+# pipe.m4 serial 2
+dnl Copyright (C) 2010-2024 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_PIPE],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
+  AC_CHECK_FUNCS_ONCE([pipe])
+  if test $ac_cv_func_pipe != yes; then
+    HAVE_PIPE=0
+  fi
+])
deleted file mode 120000 (symlink)
index ddb600c0b4e27d541fe1e60d4e4fc454f9e37f5e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pipe2.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..74b7b284b3e7a59a3e1da4adf0414b2e9b5d9991
--- /dev/null
@@ -0,0 +1,23 @@
+# pipe2.m4 serial 4
+dnl Copyright (C) 2009-2024 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_PIPE2],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
+  dnl Persuade glibc <unistd.h> to declare pipe2().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  gl_CHECK_FUNCS_ANDROID([pipe2], [[#include <unistd.h>]])
+  if test $ac_cv_func_pipe2 != yes; then
+    HAVE_PIPE2=0
+    case "$gl_cv_onwards_func_pipe2" in
+      future*) REPLACE_PIPE2=1 ;;
+    esac
+  else
+    REPLACE_PIPE2=1
+  fi
+])
deleted file mode 120000 (symlink)
index f7f78466cd1dc73dfe78569d870e0dda82a2106d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/posix-shell.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..36f8fb8ca8dc30d7aeb56a160417125db6822668
--- /dev/null
@@ -0,0 +1,63 @@
+# Find a POSIX-conforming shell.
+
+# Copyright (C) 2007-2024 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.
+
+# Written by Paul Eggert.
+
+# If a POSIX-conforming shell can be found, set POSIX_SHELL and
+# PREFERABLY_POSIX_SHELL to it.  If not, set POSIX_SHELL to the
+# empty string and PREFERABLY_POSIX_SHELL to '/bin/sh'.
+
+AC_DEFUN([gl_POSIX_SHELL],
+[
+  AC_CACHE_CHECK([for a shell that conforms to POSIX], [gl_cv_posix_shell],
+    [gl_test_posix_shell_script='
+       func_return () {
+         (exit [$]1)
+       }
+       func_success () {
+         func_return 0
+       }
+       func_failure () {
+         func_return 1
+       }
+       func_ret_success () {
+         return 0
+       }
+       func_ret_failure () {
+         return 1
+       }
+       subshell_umask_sanity () {
+         (umask 22; (umask 0); test $(umask) -eq 22)
+       }
+       test "[$](echo foo)" = foo &&
+       func_success &&
+       ! func_failure &&
+       func_ret_success &&
+       ! func_ret_failure &&
+       (set x && func_ret_success y && test x = "[$]1") &&
+       subshell_umask_sanity
+     '
+     for gl_cv_posix_shell in \
+         "$CONFIG_SHELL" "$SHELL" /bin/sh /bin/bash /bin/ksh /bin/sh5 no; do
+       case $gl_cv_posix_shell in
+         /*)
+           "$gl_cv_posix_shell" -c "$gl_test_posix_shell_script" 2>/dev/null \
+             && break;;
+       esac
+     done])
+
+  if test "$gl_cv_posix_shell" != no; then
+    POSIX_SHELL=$gl_cv_posix_shell
+    PREFERABLY_POSIX_SHELL=$POSIX_SHELL
+  else
+    POSIX_SHELL=
+    PREFERABLY_POSIX_SHELL=/bin/sh
+  fi
+  AC_SUBST([POSIX_SHELL])
+  AC_SUBST([PREFERABLY_POSIX_SHELL])
+])
deleted file mode 120000 (symlink)
index 84704a4e2f8f7443e0245a6d96287aa06fe61a5c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/posix_memalign.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..74ba695e2eba631d4abf9b1b0f56db09a594fafa
--- /dev/null
@@ -0,0 +1,53 @@
+# posix_memalign.m4 serial 3
+dnl Copyright (C) 2020-2024 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_POSIX_MEMALIGN],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Persuade glibc <stdlib.h> to declare posix_memalign().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  gl_CHECK_FUNCS_ANDROID([posix_memalign], [[#include <stdlib.h>]])
+  if test $ac_cv_func_posix_memalign = yes; then
+    dnl On OpenBSD 6.1, posix_memalign (&p, 32, 2406) returns a pointer
+    dnl that is not a multiple of 32.
+    AC_CACHE_CHECK([whether posix_memalign works for large alignments],
+      [gl_cv_func_posix_memalign_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <stdlib.h>
+            ]],
+            [[void *p;
+              if (posix_memalign (&p, 32, 2406) == 0)
+                if (((unsigned long)p % 32) != 0)
+                  return 1;
+              return 0;
+            ]])
+         ],
+         [gl_cv_func_posix_memalign_works=yes],
+         [gl_cv_func_posix_memalign_works=no],
+         [case "$host_os" in
+                      # Guess no on OpenBSD.
+            openbsd*) gl_cv_func_posix_memalign_works="guessing no" ;;
+                      # If we don't know, obey --enable-cross-guesses.
+            *)        gl_cv_func_posix_memalign_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_posix_memalign_works" in
+      *yes) ;;
+      *) REPLACE_POSIX_MEMALIGN=1 ;;
+    esac
+  else
+    dnl The system does not have posix_memalign.
+    HAVE_POSIX_MEMALIGN=0
+    case "$gl_cv_onwards_func_posix_memalign" in
+      future*) REPLACE_POSIX_MEMALIGN=1 ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 905711fe0abc492029424d73d7e48def9db26a7c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/posixtm.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7b7480662acdfb1031717ee28e18cb442e50da80
--- /dev/null
@@ -0,0 +1,12 @@
+# posixtm.m4 serial 8
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation,
+dnl 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_POSIXTM],
+[
+  dnl No prerequisites of lib/posixtm.c.
+  :
+])
deleted file mode 120000 (symlink)
index e04a6322120f553de5f299a2d21942753be40c3c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/posixver.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e782ce3b5a9f402dff391b84c17ec59d2dfa2c4f
--- /dev/null
@@ -0,0 +1,43 @@
+# posixver.m4 serial 12
+dnl Copyright (C) 2002-2006, 2009-2024 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_POSIXVER],
+[
+  AC_REQUIRE([gl_DEFAULT_POSIX2_VERSION])
+])
+
+# Set the default level of POSIX conformance at configure-time.
+# Build with './configure DEFAULT_POSIX2_VERSION=199209 ...' to
+# support the older version, thus preserving portability with
+# scripts that use sort +1, tail +32, etc.
+# Note however, that this breaks tools that might run commands
+# like 'sort +some-file' that conform with the newer standard.
+AC_DEFUN([gl_DEFAULT_POSIX2_VERSION],
+[
+  AC_MSG_CHECKING([for desired default level of POSIX conformance])
+  gl_default_posix2_version=none-specified
+  if test -n "$ac_cv_env_DEFAULT_POSIX2_VERSION_set"; then
+    gl_default_posix2_version=$ac_cv_env_DEFAULT_POSIX2_VERSION_value
+    AC_DEFINE_UNQUOTED([DEFAULT_POSIX2_VERSION],
+      $gl_default_posix2_version,
+      [Define the default level of POSIX conformance. The value is of
+       the form YYYYMM, specifying the year and month the standard was
+       adopted. If not defined here, it defaults to the value of
+       _POSIX2_VERSION in <unistd.h>. Define to 199209 to default to
+       POSIX 1003.2-1992, which makes standard programs like 'head',
+       'tail', and 'sort' accept obsolete options like '+10' and
+       '-10'. Define to 200112 to default to POSIX 1003.1-2001, which
+       makes these standard programs treat leading-'+' operands as
+       file names and require modern usages like '-n 10' instead of
+       '-10'. Whether defined here or not, the default can be
+       overridden at run time via the _POSIX2_VERSION environment
+       variable.])
+  fi
+  AC_MSG_RESULT([$gl_default_posix2_version])
+  AC_ARG_VAR(
+    [DEFAULT_POSIX2_VERSION],
+    [POSIX version to default to; see 'config.hin'.])
+])
deleted file mode 120000 (symlink)
index e756a6d1172a07c9c764dbc4b99d567fa6699c74..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/printf-frexp.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9a2f767f4273e5dcf89febf0a1a748b225d17fec
--- /dev/null
@@ -0,0 +1,38 @@
+# printf-frexp.m4 serial 5
+dnl Copyright (C) 2007, 2009-2024 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 Check how to define printf_frexp() without linking with libm.
+
+AC_DEFUN([gl_FUNC_PRINTF_FREXP],
+[
+  AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM])
+  if test $gl_cv_func_frexp_no_libm = yes; then
+    gl_FUNC_FREXP_WORKS
+    case "$gl_cv_func_frexp_works" in
+      *yes)
+        AC_DEFINE([HAVE_FREXP_IN_LIBC], [1],
+          [Define if the frexp function is available in libc.])
+        ;;
+    esac
+  fi
+
+  AC_CACHE_CHECK([whether ldexp can be used without linking with libm],
+    [gl_cv_func_ldexp_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             double x;
+             int y;]],
+           [[return ldexp (x, y) < 1;]])],
+        [gl_cv_func_ldexp_no_libm=yes],
+        [gl_cv_func_ldexp_no_libm=no])
+    ])
+  if test $gl_cv_func_ldexp_no_libm = yes; then
+    AC_DEFINE([HAVE_LDEXP_IN_LIBC], [1],
+      [Define if the ldexp function is available in libc.])
+  fi
+])
deleted file mode 120000 (symlink)
index 6dc0d652f6dbe6b789af5683643d7e857b135dc8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/printf-frexpl.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7d3b7bd15cd5346e9a48120e773f3d0261b466c7
--- /dev/null
@@ -0,0 +1,48 @@
+# printf-frexpl.m4 serial 10
+dnl Copyright (C) 2007, 2009-2024 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 Check how to define printf_frexpl() without linking with libm.
+
+AC_DEFUN([gl_FUNC_PRINTF_FREXPL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+
+  dnl Subset of gl_FUNC_FREXPL_NO_LIBM.
+  gl_CHECK_FREXPL_NO_LIBM
+  if test $gl_cv_func_frexpl_no_libm = yes; then
+    gl_FUNC_FREXPL_WORKS
+    case "$gl_cv_func_frexpl_works" in
+      *yes) gl_func_frexpl_no_libm=yes ;;
+      *)    gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;;
+    esac
+  else
+    gl_func_frexpl_no_libm=no
+    dnl Set REPLACE_FREXPL here because the system may have frexpl in libm.
+    REPLACE_FREXPL=1
+  fi
+  if test $gl_func_frexpl_no_libm = yes; then
+    AC_DEFINE([HAVE_FREXPL_IN_LIBC], [1],
+      [Define if the frexpl function is available in libc.])
+    dnl Also check whether it's declared.
+    dnl Mac OS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]])
+  fi
+
+  gl_CHECK_LDEXPL_NO_LIBM
+  if test $gl_cv_func_ldexpl_no_libm = yes; then
+    gl_FUNC_LDEXPL_WORKS
+    case "$gl_cv_func_ldexpl_works" in
+      *yes)
+        AC_DEFINE([HAVE_LDEXPL_IN_LIBC], [1],
+          [Define if the ldexpl function is available in libc.])
+        dnl Also check whether it's declared.
+        dnl Mac OS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>.
+        AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [[#include <math.h>]])
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index d08844962627017b094e5a0710d893db9754d2b5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/printf.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bb67d59409ebec73f269ff2d4bed2adc0238f045
--- /dev/null
+# printf.m4 serial 89
+dnl Copyright (C) 2003, 2007-2024 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 Test whether the *printf family of functions supports the 'j', 'z', 't',
+dnl 'L' size specifiers. (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_printf_sizes_c99.
+
+AC_DEFUN([gl_PRINTF_SIZES_C99],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports size specifiers as in C99],
+    [gl_cv_func_printf_sizes_c99],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#if HAVE_STDINT_H_WITH_UINTMAX
+# include <stdint.h>
+#endif
+#if HAVE_INTTYPES_H_WITH_UINTMAX
+# include <inttypes.h>
+#endif
+static char buf[100];
+int main ()
+{
+  int result = 0;
+#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX
+  buf[0] = '\0';
+  if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
+      || strcmp (buf, "12345671 33") != 0)
+    result |= 1;
+#else
+  result |= 1;
+#endif
+  buf[0] = '\0';
+  if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
+      || strcmp (buf, "12345672 33") != 0)
+    result |= 2;
+  buf[0] = '\0';
+  if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0
+      || strcmp (buf, "12345673 33") != 0)
+    result |= 4;
+  buf[0] = '\0';
+  if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0
+      || strcmp (buf, "1.5 33") != 0)
+    result |= 8;
+  return result;
+}]])],
+        [gl_cv_func_printf_sizes_c99=yes],
+        [gl_cv_func_printf_sizes_c99=no],
+        [
+         case "$host_os" in
+changequote(,)dnl
+                                 # Guess yes on glibc systems.
+           *-gnu* | gnu*)        gl_cv_func_printf_sizes_c99="guessing yes";;
+                                 # Guess yes on musl systems.
+           *-musl* | midipix*)   gl_cv_func_printf_sizes_c99="guessing yes";;
+                                 # Guess yes on FreeBSD >= 5.
+           freebsd[1-4].*)       gl_cv_func_printf_sizes_c99="guessing no";;
+           freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
+           midnightbsd*)         gl_cv_func_printf_sizes_c99="guessing yes";;
+                                 # Guess yes on Mac OS X >= 10.3.
+           darwin[1-6].*)        gl_cv_func_printf_sizes_c99="guessing no";;
+           darwin*)              gl_cv_func_printf_sizes_c99="guessing yes";;
+                                 # Guess yes on OpenBSD >= 3.9.
+           openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
+                                 gl_cv_func_printf_sizes_c99="guessing no";;
+           openbsd*)             gl_cv_func_printf_sizes_c99="guessing yes";;
+                                 # Guess yes on Solaris >= 2.10.
+           solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
+           solaris*)             gl_cv_func_printf_sizes_c99="guessing no";;
+                                 # Guess yes on NetBSD >= 3.
+           netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+                                 gl_cv_func_printf_sizes_c99="guessing no";;
+           netbsd*)              gl_cv_func_printf_sizes_c99="guessing yes";;
+                                 # Guess yes on Android.
+           linux*-android*)      gl_cv_func_printf_sizes_c99="guessing yes";;
+changequote([,])dnl
+                                 # Guess yes on MSVC, no on mingw.
+           windows*-msvc*)       gl_cv_func_printf_sizes_c99="guessing yes" ;;
+           mingw* | windows*)    AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                   ],
+                                   [gl_cv_func_printf_sizes_c99="guessing yes"],
+                                   [gl_cv_func_printf_sizes_c99="guessing no"])
+                                 ;;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports the 'w8', 'w16',
+dnl 'w32', 'w64', 'wf8', 'wf16', 'wf32', 'wf64' size specifiers. (ISO C23)
+dnl Result is gl_cv_func_printf_sizes_c23.
+
+AC_DEFUN([gl_PRINTF_SIZES_C23],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports size specifiers as in C23],
+    [gl_cv_func_printf_sizes_c23],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#if HAVE_STDINT_H_WITH_UINTMAX
+# include <stdint.h>
+#endif
+#if HAVE_INTTYPES_H_WITH_UINTMAX
+# include <inttypes.h>
+#endif
+static char buf[100];
+int main ()
+{
+  int result = 0;
+  buf[0] = '\0';
+  if (sprintf (buf, "%w8u %d", (uint8_t) 123, 33, 44, 55) < 0
+      || strcmp (buf, "123 33") != 0)
+    result |= 1;
+  buf[0] = '\0';
+  if (sprintf (buf, "%wf8u %d", (uint_fast8_t) 123, 33, 44, 55) < 0
+      || strcmp (buf, "123 33") != 0)
+    result |= 1;
+  buf[0] = '\0';
+  if (sprintf (buf, "%w16u %d", (uint16_t) 12345, 33, 44, 55) < 0
+      || strcmp (buf, "12345 33") != 0)
+    result |= 2;
+  buf[0] = '\0';
+  if (sprintf (buf, "%wf16u %d", (uint_fast16_t) 12345, 33, 44, 55) < 0
+      || strcmp (buf, "12345 33") != 0)
+    result |= 2;
+  buf[0] = '\0';
+  if (sprintf (buf, "%w32u %d", (uint32_t) 12345671, 33, 44, 55) < 0
+      || strcmp (buf, "12345671 33") != 0)
+    result |= 4;
+  buf[0] = '\0';
+  if (sprintf (buf, "%wf32u %d", (uint_fast32_t) 12345671, 33, 44, 55) < 0
+      || strcmp (buf, "12345671 33") != 0)
+    result |= 4;
+#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX
+  buf[0] = '\0';
+  if (sprintf (buf, "%w64u %d", (uint64_t) 12345671, 33, 44, 55) < 0
+      || strcmp (buf, "12345671 33") != 0)
+    result |= 8;
+  buf[0] = '\0';
+  if (sprintf (buf, "%wf64u %d", (uint_fast64_t) 12345671, 33, 44, 55) < 0
+      || strcmp (buf, "12345671 33") != 0)
+    result |= 8;
+#else
+  result |= 8;
+#endif
+  return result;
+}]])],
+        [gl_cv_func_printf_sizes_c23=yes],
+        [gl_cv_func_printf_sizes_c23=no],
+        [
+         case "$host_os" in
+                               # Guess no on glibc systems.
+           *-gnu* | gnu*)      gl_cv_func_printf_sizes_c23="guessing no";;
+                               # Guess no on musl systems.
+           *-musl* | midipix*) gl_cv_func_printf_sizes_c23="guessing no";;
+                               # Guess no on Android.
+           linux*-android*)    gl_cv_func_printf_sizes_c23="guessing no";;
+                               # Guess no on native Windows.
+           mingw* | windows*)  gl_cv_func_printf_sizes_c23="guessing no";;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_printf_sizes_c23="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports 'long double'
+dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_printf_long_double.
+
+AC_DEFUN([gl_PRINTF_LONG_DOUBLE],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports 'long double' arguments],
+    [gl_cv_func_printf_long_double],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[10000];
+int main ()
+{
+  int result = 0;
+  buf[0] = '\0';
+  if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0
+      || strcmp (buf, "1.750000 33") != 0)
+    result |= 1;
+  buf[0] = '\0';
+  if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0
+      || strcmp (buf, "1.750000e+00 33") != 0)
+    result |= 2;
+  buf[0] = '\0';
+  if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0
+      || strcmp (buf, "1.75 33") != 0)
+    result |= 4;
+  return result;
+}]])],
+        [gl_cv_func_printf_long_double=yes],
+        [gl_cv_func_printf_long_double=no],
+        [case "$host_os" in
+                              # Guess no on BeOS.
+           beos*)             gl_cv_func_printf_long_double="guessing no";;
+                              # Guess yes on Android.
+           linux*-android*)   gl_cv_func_printf_long_double="guessing yes";;
+                              # Guess yes on MSVC, no on mingw.
+           windows*-msvc*)    gl_cv_func_printf_long_double="guessing yes" ;;
+           mingw* | windows*) AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                ],
+                                [gl_cv_func_printf_long_double="guessing yes"],
+                                [gl_cv_func_printf_long_double="guessing no"])
+                              ;;
+           *)                 gl_cv_func_printf_long_double="guessing yes";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports infinite and NaN
+dnl 'double' arguments and negative zero arguments in the %f, %e, %g
+dnl directives. (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_printf_infinite.
+
+AC_DEFUN([gl_PRINTF_INFINITE],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports infinite 'double' arguments],
+    [gl_cv_func_printf_infinite],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static int
+strisnan (const char *string, size_t start_index, size_t end_index)
+{
+  if (start_index < end_index)
+    {
+      if (string[start_index] == '-')
+        start_index++;
+      if (start_index + 3 <= end_index
+          && memcmp (string + start_index, "nan", 3) == 0)
+        {
+          start_index += 3;
+          if (start_index == end_index
+              || (string[start_index] == '(' && string[end_index - 1] == ')'))
+            return 1;
+        }
+    }
+  return 0;
+}
+static int
+have_minus_zero ()
+{
+  static double plus_zero = 0.0;
+  double minus_zero = - plus_zero;
+  return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
+}
+static char buf[10000];
+static double zero = 0.0;
+int main ()
+{
+  int result = 0;
+  if (sprintf (buf, "%f", 1.0 / zero) < 0
+      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
+    result |= 1;
+  if (sprintf (buf, "%f", -1.0 / zero) < 0
+      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
+    result |= 1;
+  if (sprintf (buf, "%f", zero / zero) < 0
+      || !strisnan (buf, 0, strlen (buf)))
+    result |= 2;
+  if (sprintf (buf, "%e", 1.0 / zero) < 0
+      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
+    result |= 4;
+  if (sprintf (buf, "%e", -1.0 / zero) < 0
+      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
+    result |= 4;
+  if (sprintf (buf, "%e", zero / zero) < 0
+      || !strisnan (buf, 0, strlen (buf)))
+    result |= 8;
+  if (sprintf (buf, "%g", 1.0 / zero) < 0
+      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
+    result |= 16;
+  if (sprintf (buf, "%g", -1.0 / zero) < 0
+      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
+    result |= 16;
+  if (sprintf (buf, "%g", zero / zero) < 0
+      || !strisnan (buf, 0, strlen (buf)))
+    result |= 32;
+  /* This test fails on HP-UX 10.20.  */
+  if (have_minus_zero ())
+    if (sprintf (buf, "%g", - zero) < 0
+        || strcmp (buf, "-0") != 0)
+    result |= 64;
+  return result;
+}]])],
+        [gl_cv_func_printf_infinite=yes],
+        [gl_cv_func_printf_infinite=no],
+        [
+         case "$host_os" in
+changequote(,)dnl
+                                 # Guess yes on glibc systems.
+           *-gnu* | gnu*)        gl_cv_func_printf_infinite="guessing yes";;
+                                 # Guess yes on musl systems.
+           *-musl* | midipix*)   gl_cv_func_printf_infinite="guessing yes";;
+                                 # Guess yes on FreeBSD >= 6.
+           freebsd[1-5].*)       gl_cv_func_printf_infinite="guessing no";;
+           freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
+           midnightbsd*)         gl_cv_func_printf_infinite="guessing yes";;
+                                 # Guess yes on Mac OS X >= 10.3.
+           darwin[1-6].*)        gl_cv_func_printf_infinite="guessing no";;
+           darwin*)              gl_cv_func_printf_infinite="guessing yes";;
+                                 # Guess yes on HP-UX >= 11.
+           hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
+           hpux*)                gl_cv_func_printf_infinite="guessing yes";;
+                                 # Guess yes on NetBSD >= 3.
+           netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+                                 gl_cv_func_printf_infinite="guessing no";;
+           netbsd*)              gl_cv_func_printf_infinite="guessing yes";;
+                                 # Guess yes on OpenBSD >= 6.0.
+           openbsd[1-5].*)       gl_cv_func_printf_infinite="guessing no";;
+           openbsd*)             gl_cv_func_printf_infinite="guessing yes";;
+                                 # Guess yes on BeOS.
+           beos*)                gl_cv_func_printf_infinite="guessing yes";;
+                                 # Guess no on Android.
+           linux*-android*)      gl_cv_func_printf_infinite="guessing no";;
+changequote([,])dnl
+                                 # Guess yes on MSVC, no on mingw.
+           windows*-msvc*)       gl_cv_func_printf_infinite="guessing yes" ;;
+           mingw* | windows*)    AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                   ],
+                                   [gl_cv_func_printf_infinite="guessing yes"],
+                                   [gl_cv_func_printf_infinite="guessing no"])
+                                 ;;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_printf_infinite="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports infinite and NaN
+dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_printf_infinite_long_double.
+
+AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE],
+[
+  AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_BIGENDIAN])
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  dnl The user can set or unset the variable gl_printf_safe to indicate
+  dnl that he wishes a safe handling of non-IEEE-754 'long double' values.
+  if test -n "$gl_printf_safe"; then
+    AC_DEFINE([CHECK_PRINTF_SAFE], [1],
+      [Define if you wish *printf() functions that have a safe handling of
+       non-IEEE-754 'long double' values.])
+  fi
+  case "$gl_cv_func_printf_long_double" in
+    *yes)
+      AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments],
+        [gl_cv_func_printf_infinite_long_double],
+        [
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+]GL_NOCRASH[
+#include <float.h>
+#include <stdio.h>
+#include <string.h>
+static int
+strisnan (const char *string, size_t start_index, size_t end_index)
+{
+  if (start_index < end_index)
+    {
+      if (string[start_index] == '-')
+        start_index++;
+      if (start_index + 3 <= end_index
+          && memcmp (string + start_index, "nan", 3) == 0)
+        {
+          start_index += 3;
+          if (start_index == end_index
+              || (string[start_index] == '(' && string[end_index - 1] == ')'))
+            return 1;
+        }
+    }
+  return 0;
+}
+static char buf[10000];
+static long double zeroL = 0.0L;
+int main ()
+{
+  int result = 0;
+  nocrash_init();
+  if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0
+      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
+    result |= 1;
+  if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0
+      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
+    result |= 1;
+  if (sprintf (buf, "%Lf", zeroL / zeroL) < 0
+      || !strisnan (buf, 0, strlen (buf)))
+    result |= 1;
+  if (sprintf (buf, "%Le", 1.0L / zeroL) < 0
+      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
+    result |= 1;
+  if (sprintf (buf, "%Le", -1.0L / zeroL) < 0
+      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
+    result |= 1;
+  if (sprintf (buf, "%Le", zeroL / zeroL) < 0
+      || !strisnan (buf, 0, strlen (buf)))
+    result |= 1;
+  if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0
+      || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
+    result |= 1;
+  if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0
+      || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
+    result |= 1;
+  if (sprintf (buf, "%Lg", zeroL / zeroL) < 0
+      || !strisnan (buf, 0, strlen (buf)))
+    result |= 1;
+#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+/* Representation of an 80-bit 'long double' as an initializer for a sequence
+   of 'unsigned int' words.  */
+# ifdef WORDS_BIGENDIAN
+#  define LDBL80_WORDS(exponent,manthi,mantlo) \
+     { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
+       ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16),   \
+       (unsigned int) (mantlo) << 16                                        \
+     }
+# else
+#  define LDBL80_WORDS(exponent,manthi,mantlo) \
+     { mantlo, manthi, exponent }
+# endif
+  { /* Quiet NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
+    if (sprintf (buf, "%Lf", x.value) < 0
+        || !strisnan (buf, 0, strlen (buf)))
+      result |= 2;
+    if (sprintf (buf, "%Le", x.value) < 0
+        || !strisnan (buf, 0, strlen (buf)))
+      result |= 2;
+    if (sprintf (buf, "%Lg", x.value) < 0
+        || !strisnan (buf, 0, strlen (buf)))
+      result |= 2;
+  }
+  {
+    /* Signalling NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
+    if (sprintf (buf, "%Lf", x.value) < 0
+        || !strisnan (buf, 0, strlen (buf)))
+      result |= 2;
+    if (sprintf (buf, "%Le", x.value) < 0
+        || !strisnan (buf, 0, strlen (buf)))
+      result |= 2;
+    if (sprintf (buf, "%Lg", x.value) < 0
+        || !strisnan (buf, 0, strlen (buf)))
+      result |= 2;
+  }
+  { /* Pseudo-NaN.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
+    if (sprintf (buf, "%Lf", x.value) <= 0)
+      result |= 4;
+    if (sprintf (buf, "%Le", x.value) <= 0)
+      result |= 4;
+    if (sprintf (buf, "%Lg", x.value) <= 0)
+      result |= 4;
+  }
+  { /* Pseudo-Infinity.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
+    if (sprintf (buf, "%Lf", x.value) <= 0)
+      result |= 8;
+    if (sprintf (buf, "%Le", x.value) <= 0)
+      result |= 8;
+    if (sprintf (buf, "%Lg", x.value) <= 0)
+      result |= 8;
+  }
+  { /* Pseudo-Zero.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
+    if (sprintf (buf, "%Lf", x.value) <= 0)
+      result |= 16;
+    if (sprintf (buf, "%Le", x.value) <= 0)
+      result |= 16;
+    if (sprintf (buf, "%Lg", x.value) <= 0)
+      result |= 16;
+  }
+  { /* Unnormalized number.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
+    if (sprintf (buf, "%Lf", x.value) <= 0)
+      result |= 32;
+    if (sprintf (buf, "%Le", x.value) <= 0)
+      result |= 32;
+    if (sprintf (buf, "%Lg", x.value) <= 0)
+      result |= 32;
+  }
+  { /* Pseudo-Denormal.  */
+    static union { unsigned int word[4]; long double value; } x =
+      { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
+    if (sprintf (buf, "%Lf", x.value) <= 0)
+      result |= 64;
+    if (sprintf (buf, "%Le", x.value) <= 0)
+      result |= 64;
+    if (sprintf (buf, "%Lg", x.value) <= 0)
+      result |= 64;
+  }
+#endif
+  return result;
+}]])],
+            [gl_cv_func_printf_infinite_long_double=yes],
+            [gl_cv_func_printf_infinite_long_double=no],
+            [case "$host_cpu" in
+                                     # Guess no on ia64, x86_64, i386.
+               ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
+               *)
+                 case "$host_os" in
+changequote(,)dnl
+                                         # Guess yes on glibc systems.
+                   *-gnu* | gnu*)        gl_cv_func_printf_infinite_long_double="guessing yes";;
+                                         # Guess yes on musl systems.
+                   *-musl* | midipix*)   gl_cv_func_printf_infinite_long_double="guessing yes";;
+                                         # Guess yes on FreeBSD >= 6.
+                   freebsd[1-5].*)       gl_cv_func_printf_infinite_long_double="guessing no";;
+                   freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+                   midnightbsd*)         gl_cv_func_printf_infinite_long_double="guessing yes";;
+                                         # Guess yes on HP-UX >= 11.
+                   hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
+                   hpux*)                gl_cv_func_printf_infinite_long_double="guessing yes";;
+                                         # Guess yes on OpenBSD >= 6.0.
+                   openbsd[1-5].*)       gl_cv_func_printf_infinite_long_double="guessing no";;
+                   openbsd*)             gl_cv_func_printf_infinite_long_double="guessing yes";;
+                                         # Guess no on Android.
+                   linux*-android*)      gl_cv_func_printf_infinite_long_double="guessing no";;
+changequote([,])dnl
+                                         # Guess yes on MSVC, no on mingw.
+                   windows*-msvc*)       gl_cv_func_printf_infinite_long_double="guessing yes" ;;
+                   mingw* | windows*)    AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                           ],
+                                           [gl_cv_func_printf_infinite_long_double="guessing yes"],
+                                           [gl_cv_func_printf_infinite_long_double="guessing no"])
+                                         ;;
+                                         # If we don't know, obey --enable-cross-guesses.
+                   *)                    gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";;
+                 esac
+                 ;;
+             esac
+            ])
+        ])
+      ;;
+    *)
+      gl_cv_func_printf_infinite_long_double="irrelevant"
+      ;;
+  esac
+])
+
+dnl Test whether the *printf family of functions supports the 'a' and 'A'
+dnl conversion specifier for hexadecimal output of floating-point numbers.
+dnl (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_printf_directive_a.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives],
+    [gl_cv_func_printf_directive_a],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+static double zero = 0.0;
+int main ()
+{
+  int result = 0;
+  if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
+      || (strcmp (buf, "0x1.922p+1 33") != 0
+          && strcmp (buf, "0x3.244p+0 33") != 0
+          && strcmp (buf, "0x6.488p-1 33") != 0
+          && strcmp (buf, "0xc.91p-2 33") != 0))
+    result |= 1;
+  if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0
+      || (strcmp (buf, "-0X1.922P+1 33") != 0
+          && strcmp (buf, "-0X3.244P+0 33") != 0
+          && strcmp (buf, "-0X6.488P-1 33") != 0
+          && strcmp (buf, "-0XC.91P-2 33") != 0))
+    result |= 2;
+  /* This catches a FreeBSD 13.0 bug: it doesn't round.  */
+  if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
+      || (strcmp (buf, "0x1.83p+0 33") != 0
+          && strcmp (buf, "0x3.05p-1 33") != 0
+          && strcmp (buf, "0x6.0ap-2 33") != 0
+          && strcmp (buf, "0xc.14p-3 33") != 0))
+    result |= 4;
+  /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round.  */
+  if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0
+      || (strcmp (buf, "0x2p+0 33") != 0
+          && strcmp (buf, "0x3p-1 33") != 0
+          && strcmp (buf, "0x6p-2 33") != 0
+          && strcmp (buf, "0xcp-3 33") != 0))
+    result |= 4;
+  /* This catches a FreeBSD 6.1 bug.  See
+     <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
+  if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
+      || buf[0] == '0')
+    result |= 8;
+  /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug.  */
+  if (sprintf (buf, "%.1a", 1.999) < 0
+      || (strcmp (buf, "0x1.0p+1") != 0
+          && strcmp (buf, "0x2.0p+0") != 0
+          && strcmp (buf, "0x4.0p-1") != 0
+          && strcmp (buf, "0x8.0p-2") != 0))
+    result |= 16;
+  /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a
+     glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>.  */
+  if (sprintf (buf, "%.1La", 1.999L) < 0
+      || (strcmp (buf, "0x1.0p+1") != 0
+          && strcmp (buf, "0x2.0p+0") != 0
+          && strcmp (buf, "0x4.0p-1") != 0
+          && strcmp (buf, "0x8.0p-2") != 0))
+    result |= 32;
+  return result;
+}]])],
+        [gl_cv_func_printf_directive_a=yes],
+        [gl_cv_func_printf_directive_a=no],
+        [
+         case "$host_os" in
+                                 # Guess yes on glibc >= 2.5 systems.
+           *-gnu* | gnu*)
+             AC_EGREP_CPP([BZ2908], [
+               #include <features.h>
+               #ifdef __GNU_LIBRARY__
+                #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__
+                 BZ2908
+                #endif
+               #endif
+               ],
+               [gl_cv_func_printf_directive_a="guessing yes"],
+               [gl_cv_func_printf_directive_a="guessing no"])
+             ;;
+                                 # Guess yes on musl systems.
+           *-musl* | midipix*)   gl_cv_func_printf_directive_a="guessing yes";;
+                                 # Guess no on Android.
+           linux*-android*)      gl_cv_func_printf_directive_a="guessing no";;
+                                 # Guess no on native Windows.
+           mingw* | windows*)    gl_cv_func_printf_directive_a="guessing no";;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_printf_directive_a="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports the 'b' conversion
+dnl specifier for binary output of integers.
+dnl (ISO C23)
+dnl Result is gl_cv_func_printf_directive_b.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_B],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the 'b' directive],
+    [gl_cv_func_printf_directive_b],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+int main ()
+{
+  int result = 0;
+  if (sprintf (buf, "%b %d", 12345, 33, 44, 55) < 0
+      || strcmp (buf, "11000000111001 33") != 0)
+    result |= 1;
+  return result;
+}]])],
+        [gl_cv_func_printf_directive_b=yes],
+        [gl_cv_func_printf_directive_b=no],
+        [
+         case "$host_os" in
+                               # Guess yes on glibc >= 2.35 systems.
+           *-gnu* | gnu*)
+             AC_EGREP_CPP([Lucky], [
+               #include <features.h>
+               #ifdef __GNU_LIBRARY__
+                #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2)
+                 Lucky user
+                #endif
+               #endif
+               ],
+               [gl_cv_func_printf_directive_uppercase_b="guessing yes"],
+               [gl_cv_func_printf_directive_uppercase_b="guessing no"])
+             ;;
+                               # Guess no on musl systems.
+           *-musl* | midipix*) gl_cv_func_printf_directive_b="guessing no";;
+                               # Guess no on Android.
+           linux*-android*)    gl_cv_func_printf_directive_b="guessing no";;
+                               # Guess no on native Windows.
+           mingw* | windows*)  gl_cv_func_printf_directive_b="guessing no";;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_printf_directive_b="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports the 'B' conversion
+dnl specifier for binary output of integers.
+dnl (GNU, encouraged by ISO C23 § 7.23.6.1)
+dnl Result is gl_cv_func_printf_directive_uppercase_b.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_UPPERCASE_B],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the 'B' directive],
+    [gl_cv_func_printf_directive_uppercase_b],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+int main ()
+{
+  int result = 0;
+  if (sprintf (buf, "%#B %d", 12345, 33, 44, 55) < 0
+      || strcmp (buf, "0B11000000111001 33") != 0)
+    result |= 1;
+  return result;
+}]])],
+        [gl_cv_func_printf_directive_uppercase_b=yes],
+        [gl_cv_func_printf_directive_uppercase_b=no],
+        [
+         case "$host_os" in
+                               # Guess yes on glibc >= 2.35 systems.
+           *-gnu* | gnu*)
+             AC_EGREP_CPP([Lucky], [
+               #include <features.h>
+               #ifdef __GNU_LIBRARY__
+                #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2)
+                 Lucky user
+                #endif
+               #endif
+               ],
+               [gl_cv_func_printf_directive_uppercase_b="guessing yes"],
+               [gl_cv_func_printf_directive_uppercase_b="guessing no"])
+             ;;
+                               # Guess no on musl systems.
+           *-musl* | midipix*) gl_cv_func_printf_directive_uppercase_b="guessing no";;
+                               # Guess no on Android.
+           linux*-android*)    gl_cv_func_printf_directive_uppercase_b="guessing no";;
+                               # Guess no on native Windows.
+           mingw* | windows*)  gl_cv_func_printf_directive_uppercase_b="guessing no";;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_printf_directive_uppercase_b="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports the %F format
+dnl directive. (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_printf_directive_f.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_F],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the 'F' directive],
+    [gl_cv_func_printf_directive_f],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+static double zero = 0.0;
+int main ()
+{
+  int result = 0;
+  if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
+      || strcmp (buf, "1234567.000000 33") != 0)
+    result |= 1;
+  if (sprintf (buf, "%F", 1.0 / zero) < 0
+      || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0))
+    result |= 2;
+  /* This catches a Cygwin 1.5.x bug.  */
+  if (sprintf (buf, "%.F", 1234.0) < 0
+      || strcmp (buf, "1234") != 0)
+    result |= 4;
+  return result;
+}]])],
+        [gl_cv_func_printf_directive_f=yes],
+        [gl_cv_func_printf_directive_f=no],
+        [
+         case "$host_os" in
+changequote(,)dnl
+                                 # Guess yes on glibc systems.
+           *-gnu* | gnu*)        gl_cv_func_printf_directive_f="guessing yes";;
+                                 # Guess yes on musl systems.
+           *-musl* | midipix*)   gl_cv_func_printf_directive_f="guessing yes";;
+                                 # Guess yes on FreeBSD >= 6.
+           freebsd[1-5].*)       gl_cv_func_printf_directive_f="guessing no";;
+           freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
+           midnightbsd*)         gl_cv_func_printf_directive_f="guessing yes";;
+                                 # Guess yes on Mac OS X >= 10.3.
+           darwin[1-6].*)        gl_cv_func_printf_directive_f="guessing no";;
+           darwin*)              gl_cv_func_printf_directive_f="guessing yes";;
+                                 # Guess yes on OpenBSD >= 6.0.
+           openbsd[1-5].*)       gl_cv_func_printf_directive_f="guessing no";;
+           openbsd*)             gl_cv_func_printf_directive_f="guessing yes";;
+                                 # Guess yes on Solaris >= 2.10.
+           solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";;
+           solaris*)             gl_cv_func_printf_directive_f="guessing no";;
+                                 # Guess no on Android.
+           linux*-android*)      gl_cv_func_printf_directive_f="guessing no";;
+changequote([,])dnl
+                                 # Guess yes on MSVC, no on mingw.
+           windows*-msvc*)       gl_cv_func_printf_directive_f="guessing yes" ;;
+           mingw* | windows*)    AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                   ],
+                                   [gl_cv_func_printf_directive_f="guessing yes"],
+                                   [gl_cv_func_printf_directive_f="guessing no"])
+                                 ;;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_printf_directive_f="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports the %n format
+dnl directive. (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_printf_directive_n.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the 'n' directive],
+    [gl_cv_func_printf_directive_n],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _MSC_VER
+#include <inttypes.h>
+/* See page about "Parameter Validation" on msdn.microsoft.com.
+   <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation>
+   <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-invalid-parameter-handler-set-thread-local-invalid-parameter-handler>  */
+static void cdecl
+invalid_parameter_handler (const wchar_t *expression,
+                           const wchar_t *function,
+                           const wchar_t *file, unsigned int line,
+                           uintptr_t dummy)
+{
+  exit (1);
+}
+#endif
+static char fmtstring[10];
+static char buf[100];
+int main ()
+{
+  int count = -1;
+#ifdef _MSC_VER
+  _set_invalid_parameter_handler (invalid_parameter_handler);
+#endif
+  /* Copy the format string.  Some systems (glibc with _FORTIFY_SOURCE=2)
+     support %n in format strings in read-only memory but not in writable
+     memory.  */
+  strcpy (fmtstring, "%d %n");
+  if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0
+      || strcmp (buf, "123 ") != 0
+      || count != 4)
+    return 1;
+  return 0;
+}]])],
+        [gl_cv_func_printf_directive_n=yes],
+        [gl_cv_func_printf_directive_n=no],
+        [case "$host_os" in
+                              # Guess no on glibc when _FORTIFY_SOURCE >= 2.
+           *-gnu* | gnu*)     AC_COMPILE_IFELSE(
+                                [AC_LANG_SOURCE(
+                                   [[#if _FORTIFY_SOURCE >= 2
+                                      error fail
+                                     #endif
+                                   ]])],
+                                [gl_cv_func_printf_directive_n="guessing yes"],
+                                [gl_cv_func_printf_directive_n="guessing no"])
+                              ;;
+                              # Guess no on Android.
+           linux*-android*)   gl_cv_func_printf_directive_n="guessing no";;
+                              # Guess no on native Windows.
+           mingw* | windows*) gl_cv_func_printf_directive_n="guessing no";;
+           *)                 gl_cv_func_printf_directive_n="guessing yes";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports the %ls format
+dnl directive and in particular, when a precision is specified, whether
+dnl the functions stop converting the wide string argument when the number
+dnl of bytes that have been produced by this conversion equals or exceeds
+dnl the precision.
+dnl Result is gl_cv_func_printf_directive_ls.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the 'ls' directive],
+    [gl_cv_func_printf_directive_ls],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <wchar.h>
+#include <string.h>
+int main ()
+{
+  int result = 0;
+  char buf[100];
+  /* Test whether %ls works at all.
+     This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on
+     Cygwin 1.5.  */
+  {
+    static const wchar_t wstring[] = { 'a', 'b', 'c', 0 };
+    buf[0] = '\0';
+    if (sprintf (buf, "%ls", wstring) < 0
+        || strcmp (buf, "abc") != 0)
+      result |= 1;
+  }
+  /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an
+     assertion failure inside libc), but not on OpenBSD 4.0.  */
+  {
+    static const wchar_t wstring[] = { 'a', 0 };
+    buf[0] = '\0';
+    if (sprintf (buf, "%ls", wstring) < 0
+        || strcmp (buf, "a") != 0)
+      result |= 2;
+  }
+  /* Test whether precisions in %ls are supported as specified in ISO C 99
+     section 7.19.6.1:
+       "If a precision is specified, no more than that many bytes are written
+        (including shift sequences, if any), and the array shall contain a
+        null wide character if, to equal the multibyte character sequence
+        length given by the precision, the function would need to access a
+        wide character one past the end of the array."
+     This test fails on Solaris 10.  */
+  {
+    static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 };
+    buf[0] = '\0';
+    if (sprintf (buf, "%.2ls", wstring) < 0
+        || strcmp (buf, "ab") != 0)
+      result |= 8;
+  }
+  return result;
+}]])],
+        [gl_cv_func_printf_directive_ls=yes],
+        [gl_cv_func_printf_directive_ls=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+                              # Guess yes on OpenBSD >= 6.0.
+           openbsd[1-5].*)    gl_cv_func_printf_directive_ls="guessing no";;
+           openbsd*)          gl_cv_func_printf_directive_ls="guessing yes";;
+           irix*)             gl_cv_func_printf_directive_ls="guessing no";;
+           solaris*)          gl_cv_func_printf_directive_ls="guessing no";;
+           cygwin*)           gl_cv_func_printf_directive_ls="guessing no";;
+           beos* | haiku*)    gl_cv_func_printf_directive_ls="guessing no";;
+                              # Guess no on Android.
+           linux*-android*)   gl_cv_func_printf_directive_ls="guessing no";;
+                              # Guess yes on native Windows.
+           mingw* | windows*) gl_cv_func_printf_directive_ls="guessing yes";;
+           *)                 gl_cv_func_printf_directive_ls="guessing yes";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports the %lc format
+dnl directive and in particular, when the argument is a null wide character,
+dnl whether the functions produce a NUL byte, as specified in ISO C 23
+dnl after the issue GB-141 was fixed.
+dnl Result is gl_cv_func_printf_directive_lc.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_LC],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the 'lc' directive correctly],
+    [gl_cv_func_printf_directive_lc],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <wchar.h>
+#include <string.h>
+int main ()
+{
+  int result = 0;
+  char buf[100];
+  /* This test fails on musl libc 1.2.4.  */
+  {
+    buf[0] = '\0';
+    if (sprintf (buf, "%lc%lc%lc", (wint_t) 'a', (wint_t) 0, (wint_t) 'z') < 0
+        || memcmp (buf, "a\0z", 4) != 0)
+      result |= 1;
+  }
+  return result;
+}]])],
+        [gl_cv_func_printf_directive_lc=yes],
+        [gl_cv_func_printf_directive_lc=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+                               # Guess no on musl libc.
+           *-musl* | midipix*) gl_cv_func_printf_directive_lc="guessing no";;
+                               # Guess yes otherwise.
+           *)                  gl_cv_func_printf_directive_lc="guessing yes";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports POSIX/XSI format
+dnl strings with positions. (POSIX:2001)
+dnl Result is gl_cv_func_printf_positions.
+
+AC_DEFUN_ONCE([gl_PRINTF_POSITIONS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions],
+    [gl_cv_func_printf_positions],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+/* The string "%2$d %1$d", with dollar characters protected from the shell's
+   dollar expansion (possibly an autoconf bug).  */
+static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
+static char buf[100];
+int main ()
+{
+  sprintf (buf, format, 33, 55);
+  return (strcmp (buf, "55 33") != 0);
+}]])],
+        [gl_cv_func_printf_positions=yes],
+        [gl_cv_func_printf_positions=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+           netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
+             gl_cv_func_printf_positions="guessing no";;
+           beos*)
+             gl_cv_func_printf_positions="guessing no";;
+             # Guess yes on Android.
+           linux*-android*)
+             gl_cv_func_printf_positions="guessing yes";;
+             # Guess no on native Windows.
+           mingw* | windows* | pw*)
+             gl_cv_func_printf_positions="guessing no";;
+           *)
+             gl_cv_func_printf_positions="guessing yes";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports POSIX/XSI format
+dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001)
+dnl Result is gl_cv_func_printf_flag_grouping.
+
+AC_DEFUN([gl_PRINTF_FLAG_GROUPING],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the grouping flag],
+    [gl_cv_func_printf_flag_grouping],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+int main ()
+{
+  if (sprintf (buf, "%'d %d", 1234567, 99) < 0
+      || buf[strlen (buf) - 1] != '9')
+    return 1;
+  return 0;
+}]])],
+        [gl_cv_func_printf_flag_grouping=yes],
+        [gl_cv_func_printf_flag_grouping=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+           cygwin*)                 gl_cv_func_printf_flag_grouping="guessing no";;
+           netbsd*)                 gl_cv_func_printf_flag_grouping="guessing no";;
+                                    # Guess no on Android.
+           linux*-android*)         gl_cv_func_printf_flag_grouping="guessing no";;
+                                    # Guess no on native Windows.
+           mingw* | windows* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
+           *)                       gl_cv_func_printf_flag_grouping="guessing yes";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports the - flag correctly.
+dnl (ISO C99.) See
+dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html>
+dnl Result is gl_cv_func_printf_flag_leftadjust.
+
+AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly],
+    [gl_cv_func_printf_flag_leftadjust],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+int main ()
+{
+  /* Check that a '-' flag is not annihilated by a negative width.  */
+  if (sprintf (buf, "a%-*sc", -3, "b") < 0
+      || strcmp (buf, "ab  c") != 0)
+    return 1;
+  return 0;
+}]])],
+        [gl_cv_func_printf_flag_leftadjust=yes],
+        [gl_cv_func_printf_flag_leftadjust=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+                              # Guess yes on HP-UX 11.
+           hpux11*)           gl_cv_func_printf_flag_leftadjust="guessing yes";;
+                              # Guess no on HP-UX 10 and older.
+           hpux*)             gl_cv_func_printf_flag_leftadjust="guessing no";;
+                              # Guess yes on Android.
+           linux*-android*)   gl_cv_func_printf_flag_leftadjust="guessing yes";;
+                              # Guess yes on native Windows.
+           mingw* | windows*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
+                              # Guess yes otherwise.
+           *)                 gl_cv_func_printf_flag_leftadjust="guessing yes";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports padding of non-finite
+dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See
+dnl <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html>
+dnl Result is gl_cv_func_printf_flag_zero.
+
+AC_DEFUN([gl_PRINTF_FLAG_ZERO],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the zero flag correctly],
+    [gl_cv_func_printf_flag_zero],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+static double zero = 0.0;
+int main ()
+{
+  if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0
+      || (strcmp (buf, "       inf") != 0
+          && strcmp (buf, "  infinity") != 0))
+    return 1;
+  return 0;
+}]])],
+        [gl_cv_func_printf_flag_zero=yes],
+        [gl_cv_func_printf_flag_zero=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+                               # Guess yes on glibc systems.
+           *-gnu* | gnu*)      gl_cv_func_printf_flag_zero="guessing yes";;
+                               # Guess yes on musl systems.
+           *-musl* | midipix*) gl_cv_func_printf_flag_zero="guessing yes";;
+                               # Guess yes on BeOS.
+           beos*)              gl_cv_func_printf_flag_zero="guessing yes";;
+                               # Guess no on Android.
+           linux*-android*)    gl_cv_func_printf_flag_zero="guessing no";;
+                               # Guess no on native Windows.
+           mingw* | windows*)  gl_cv_func_printf_flag_zero="guessing no";;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports the # flag with a
+dnl zero precision and a zero value in the 'x' and 'X' directives correctly.
+dnl ISO C and POSIX specify that for the 'd', 'i', 'b', 'o', 'u', 'x', 'X'
+dnl directives: "The result of converting a zero value with a precision of
+dnl zero is no characters."  But on Mac OS X 10.5, for the 'x', 'X' directives,
+dnl when a # flag is present, the output is "0" instead of "".
+dnl Result is gl_cv_func_printf_flag_alt_precision_zero.
+
+AC_DEFUN([gl_PRINTF_FLAG_ALT_PRECISION_ZERO],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the alternative flag with a zero precision],
+    [gl_cv_func_printf_flag_alt_precision_zero],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+static char buf[10];
+int main ()
+{
+  int result = 0;
+  if (sprintf (buf, "%#.0x %d", 0, 33, 44) > 0 + 3)
+    result |= 1;
+  return result;
+}]])],
+        [gl_cv_func_printf_flag_alt_precision_zero=yes],
+        [gl_cv_func_printf_flag_alt_precision_zero=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+           # Guess no only on macOS 10..12 systems.
+           darwin[0-9] | darwin[0-9].* | \
+           darwin1[0-9] | darwin1[0-9].* | \
+           darwin2[0-1] | darwin2[0-1].*)
+                    gl_cv_func_printf_flag_alt_precision_zero="guessing no" ;;
+           darwin*) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;;
+           *)       gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions supports large precisions.
+dnl On mingw, precisions larger than 512 are treated like 512, in integer,
+dnl floating-point or pointer output. On Solaris 10/x86, precisions larger
+dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC,
+dnl precisions larger than 510 in floating-point output yield wrong results.
+dnl On AIX 7.1, precisions larger than 998 in floating-point output yield
+dnl wrong results. On BeOS, precisions larger than 1044 crash the program.
+dnl Result is gl_cv_func_printf_precision.
+
+AC_DEFUN([gl_PRINTF_PRECISION],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports large precisions],
+    [gl_cv_func_printf_precision],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[5000];
+int main ()
+{
+  int result = 0;
+#ifdef __BEOS__
+  /* On BeOS, this would crash and show a dialog box.  Avoid the crash.  */
+  return 1;
+#endif
+  if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
+    result |= 1;
+  if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5)
+    result |= 2;
+  if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5
+      || buf[0] != '1')
+    result |= 4;
+  if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5
+      || buf[0] != '1')
+    result |= 4;
+  return result;
+}]])],
+        [gl_cv_func_printf_precision=yes],
+        [gl_cv_func_printf_precision=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+           # Guess no only on Solaris, native Windows, and BeOS systems.
+           solaris*)                gl_cv_func_printf_precision="guessing no" ;;
+           mingw* | windows* | pw*) gl_cv_func_printf_precision="guessing no" ;;
+           beos*)                   gl_cv_func_printf_precision="guessing no" ;;
+                                    # Guess yes on Android.
+           linux*-android*)         gl_cv_func_printf_precision="guessing yes" ;;
+           *)                       gl_cv_func_printf_precision="guessing yes" ;;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the *printf family of functions recovers gracefully in case
+dnl of an out-of-memory condition, or whether it crashes the entire program.
+dnl Result is gl_cv_func_printf_enomem.
+
+AC_DEFUN([gl_PRINTF_ENOMEM],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_MULTIARCH])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf survives out-of-memory conditions],
+    [gl_cv_func_printf_enomem],
+    [
+      gl_cv_func_printf_enomem="guessing no"
+      if test "$cross_compiling" = no; then
+        if test $APPLE_UNIVERSAL_BUILD = 0; then
+          AC_LANG_CONFTEST([AC_LANG_SOURCE([[
+]GL_NOCRASH[
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <errno.h>
+int main()
+{
+  struct rlimit limit;
+  int ret;
+  nocrash_init ();
+  /* Some printf implementations allocate temporary space with malloc.  */
+  /* On BSD systems, malloc() is limited by RLIMIT_DATA.  */
+#ifdef RLIMIT_DATA
+  if (getrlimit (RLIMIT_DATA, &limit) < 0)
+    return 77;
+  if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
+    limit.rlim_max = 5000000;
+  limit.rlim_cur = limit.rlim_max;
+  if (setrlimit (RLIMIT_DATA, &limit) < 0)
+    return 77;
+#endif
+  /* On Linux systems, malloc() is limited by RLIMIT_AS.  */
+#ifdef RLIMIT_AS
+  if (getrlimit (RLIMIT_AS, &limit) < 0)
+    return 77;
+  if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
+    limit.rlim_max = 5000000;
+  limit.rlim_cur = limit.rlim_max;
+  if (setrlimit (RLIMIT_AS, &limit) < 0)
+    return 77;
+#endif
+  /* Some printf implementations allocate temporary space on the stack.  */
+#ifdef RLIMIT_STACK
+  if (getrlimit (RLIMIT_STACK, &limit) < 0)
+    return 77;
+  if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
+    limit.rlim_max = 5000000;
+  limit.rlim_cur = limit.rlim_max;
+  if (setrlimit (RLIMIT_STACK, &limit) < 0)
+    return 77;
+#endif
+  ret = printf ("%.5000000f", 1.0);
+  return !(ret == 5000002 || (ret < 0 && errno == ENOMEM));
+}
+          ]])])
+          if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
+            (./conftest 2>&AS_MESSAGE_LOG_FD
+             result=$?
+             _AS_ECHO_LOG([\$? = $result])
+             if test $result != 0 && test $result != 77; then result=1; fi
+             exit $result
+            ) >/dev/null 2>/dev/null
+            case $? in
+              0) gl_cv_func_printf_enomem="yes" ;;
+              77) gl_cv_func_printf_enomem="guessing no" ;;
+              *) gl_cv_func_printf_enomem="no" ;;
+            esac
+          else
+            gl_cv_func_printf_enomem="guessing no"
+          fi
+          rm -fr conftest*
+        else
+          dnl A universal build on Apple Mac OS X platforms.
+          dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode.
+          dnl But we need a configuration result that is valid in both modes.
+          gl_cv_func_printf_enomem="guessing no"
+        fi
+      fi
+      if test "$gl_cv_func_printf_enomem" = "guessing no"; then
+changequote(,)dnl
+        case "$host_os" in
+                           # Guess yes on glibc systems.
+          *-gnu* | gnu*)   gl_cv_func_printf_enomem="guessing yes";;
+                           # Guess yes on Solaris.
+          solaris*)        gl_cv_func_printf_enomem="guessing yes";;
+                           # Guess yes on AIX.
+          aix*)            gl_cv_func_printf_enomem="guessing yes";;
+                           # Guess yes on HP-UX/hppa.
+          hpux*)           case "$host_cpu" in
+                             hppa*) gl_cv_func_printf_enomem="guessing yes";;
+                             *)     gl_cv_func_printf_enomem="guessing no";;
+                           esac
+                           ;;
+                           # Guess yes on IRIX.
+          irix*)           gl_cv_func_printf_enomem="guessing yes";;
+                           # Guess yes on OSF/1.
+          osf*)            gl_cv_func_printf_enomem="guessing yes";;
+                           # Guess yes on BeOS.
+          beos*)           gl_cv_func_printf_enomem="guessing yes";;
+                           # Guess yes on Haiku.
+          haiku*)          gl_cv_func_printf_enomem="guessing yes";;
+                           # Guess no on Android.
+          linux*-android*) gl_cv_func_printf_enomem="guessing no";;
+                           # If we don't know, obey --enable-cross-guesses.
+          *)               gl_cv_func_printf_enomem="$gl_cross_guess_normal";;
+        esac
+changequote([,])dnl
+      fi
+    ])
+])
+
+dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001)
+dnl Result is ac_cv_func_snprintf.
+
+AC_DEFUN([gl_SNPRINTF_PRESENCE],
+[
+  AC_CHECK_FUNCS_ONCE([snprintf])
+])
+
+dnl Test whether the string produced by the snprintf function is always NUL
+dnl terminated. (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_snprintf_truncation_c99.
+
+AC_DEFUN_ONCE([gl_SNPRINTF_TRUNCATION_C99],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_SNPRINTF_PRESENCE])
+  AC_CACHE_CHECK([whether snprintf truncates the result as in C99],
+    [gl_cv_func_snprintf_truncation_c99],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+#if HAVE_SNPRINTF
+# define my_snprintf snprintf
+#else
+# include <stdarg.h>
+static int my_snprintf (char *buf, int size, const char *format, ...)
+{
+  va_list args;
+  int ret;
+  va_start (args, format);
+  ret = vsnprintf (buf, size, format, args);
+  va_end (args);
+  return ret;
+}
+#endif
+static char buf[100];
+int main ()
+{
+  strcpy (buf, "ABCDEF");
+  my_snprintf (buf, 3, "%d %d", 4567, 89);
+  if (memcmp (buf, "45\0DEF", 6) != 0)
+    return 1;
+  return 0;
+}]])],
+        [gl_cv_func_snprintf_truncation_c99=yes],
+        [gl_cv_func_snprintf_truncation_c99=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+                                 # Guess yes on glibc systems.
+           *-gnu* | gnu*)        gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on musl systems.
+           *-musl* | midipix*)   gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on FreeBSD >= 5.
+           freebsd[1-4].*)       gl_cv_func_snprintf_truncation_c99="guessing no";;
+           freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+           midnightbsd*)         gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on Mac OS X >= 10.3.
+           darwin[1-6].*)        gl_cv_func_snprintf_truncation_c99="guessing no";;
+           darwin*)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on OpenBSD >= 3.9.
+           openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
+                                 gl_cv_func_snprintf_truncation_c99="guessing no";;
+           openbsd*)             gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on Solaris >= 2.6.
+           solaris2.[0-5] | solaris2.[0-5].*)
+                                 gl_cv_func_snprintf_truncation_c99="guessing no";;
+           solaris*)             gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on AIX >= 4.
+           aix[1-3]*)            gl_cv_func_snprintf_truncation_c99="guessing no";;
+           aix*)                 gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on HP-UX >= 11.
+           hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+           hpux*)                gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on IRIX >= 6.5.
+           irix6.5)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on OSF/1 >= 5.
+           osf[3-4]*)            gl_cv_func_snprintf_truncation_c99="guessing no";;
+           osf*)                 gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on NetBSD >= 3.
+           netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+                                 gl_cv_func_snprintf_truncation_c99="guessing no";;
+           netbsd*)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on BeOS.
+           beos*)                gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess yes on Android.
+           linux*-android*)      gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess no on native Windows.
+           mingw* | windows*)    gl_cv_func_snprintf_truncation_c99="guessing no";;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the return value of the snprintf function is the number
+dnl of bytes (excluding the terminating NUL) that would have been produced
+dnl if the buffer had been large enough. (ISO C99, POSIX:2001)
+dnl For example, this test program fails on IRIX 6.5:
+dnl     ---------------------------------------------------------------------
+dnl     #include <stdio.h>
+dnl     int main()
+dnl     {
+dnl       static char buf[8];
+dnl       int retval = snprintf (buf, 3, "%d", 12345);
+dnl       return retval >= 0 && retval < 3;
+dnl     }
+dnl     ---------------------------------------------------------------------
+dnl Result is gl_cv_func_snprintf_retval_c99.
+
+AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_SNPRINTF_PRESENCE])
+  AC_CACHE_CHECK([whether snprintf returns a byte count as in C99],
+    [gl_cv_func_snprintf_retval_c99],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+#if HAVE_SNPRINTF
+# define my_snprintf snprintf
+#else
+# include <stdarg.h>
+static int my_snprintf (char *buf, int size, const char *format, ...)
+{
+  va_list args;
+  int ret;
+  va_start (args, format);
+  ret = vsnprintf (buf, size, format, args);
+  va_end (args);
+  return ret;
+}
+#endif
+static char buf[100];
+int main ()
+{
+  strcpy (buf, "ABCDEF");
+  if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7)
+    return 1;
+  if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7)
+    return 2;
+  if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7)
+    return 3;
+  return 0;
+}]])],
+        [gl_cv_func_snprintf_retval_c99=yes],
+        [gl_cv_func_snprintf_retval_c99=no],
+        [case "$host_os" in
+changequote(,)dnl
+                                 # Guess yes on glibc systems.
+           *-gnu* | gnu*)        gl_cv_func_snprintf_retval_c99="guessing yes";;
+                                 # Guess yes on musl systems.
+           *-musl* | midipix*)   gl_cv_func_snprintf_retval_c99="guessing yes";;
+                                 # Guess yes on FreeBSD >= 5.
+           freebsd[1-4].*)       gl_cv_func_snprintf_retval_c99="guessing no";;
+           freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+           midnightbsd*)         gl_cv_func_snprintf_retval_c99="guessing yes";;
+                                 # Guess yes on Mac OS X >= 10.3.
+           darwin[1-6].*)        gl_cv_func_snprintf_retval_c99="guessing no";;
+           darwin*)              gl_cv_func_snprintf_retval_c99="guessing yes";;
+                                 # Guess yes on OpenBSD >= 3.9.
+           openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
+                                 gl_cv_func_snprintf_retval_c99="guessing no";;
+           openbsd*)             gl_cv_func_snprintf_retval_c99="guessing yes";;
+                                 # Guess yes on Solaris >= 2.10.
+           solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
+           solaris*)             gl_cv_func_printf_sizes_c99="guessing no";;
+                                 # Guess yes on AIX >= 4.
+           aix[1-3]*)            gl_cv_func_snprintf_retval_c99="guessing no";;
+           aix*)                 gl_cv_func_snprintf_retval_c99="guessing yes";;
+                                 # Guess yes on NetBSD >= 3.
+           netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+                                 gl_cv_func_snprintf_retval_c99="guessing no";;
+           netbsd*)              gl_cv_func_snprintf_retval_c99="guessing yes";;
+                                 # Guess yes on BeOS.
+           beos*)                gl_cv_func_snprintf_retval_c99="guessing yes";;
+                                 # Guess yes on Android.
+           linux*-android*)      gl_cv_func_snprintf_retval_c99="guessing yes";;
+changequote([,])dnl
+                                 # Guess yes on MSVC, no on mingw.
+           windows*-msvc*)       gl_cv_func_snprintf_retval_c99="guessing yes" ;;
+           mingw* | windows*)    AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                   ],
+                                   [gl_cv_func_snprintf_retval_c99="guessing yes"],
+                                   [gl_cv_func_snprintf_retval_c99="guessing no"])
+                                 ;;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the snprintf function supports the %n format directive
+dnl also in truncated portions of the format string. (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_snprintf_directive_n.
+
+AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_SNPRINTF_PRESENCE])
+  AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive],
+    [gl_cv_func_snprintf_directive_n],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+#if HAVE_SNPRINTF
+# define my_snprintf snprintf
+#else
+# include <stdarg.h>
+static int my_snprintf (char *buf, int size, const char *format, ...)
+{
+  va_list args;
+  int ret;
+  va_start (args, format);
+  ret = vsnprintf (buf, size, format, args);
+  va_end (args);
+  return ret;
+}
+#endif
+static char fmtstring[10];
+static char buf[100];
+int main ()
+{
+  int count = -1;
+  /* Copy the format string.  Some systems (glibc with _FORTIFY_SOURCE=2)
+     support %n in format strings in read-only memory but not in writable
+     memory.  */
+  strcpy (fmtstring, "%d %n");
+  my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55);
+  if (count != 6)
+    return 1;
+  return 0;
+}]])],
+        [gl_cv_func_snprintf_directive_n=yes],
+        [gl_cv_func_snprintf_directive_n=no],
+        [
+         case "$host_os" in
+                                 # Guess no on glibc when _FORTIFY_SOURCE >= 2.
+           *-gnu* | gnu*)        AC_COMPILE_IFELSE(
+                                   [AC_LANG_SOURCE(
+                                      [[#if _FORTIFY_SOURCE >= 2
+                                         error fail
+                                        #endif
+                                      ]])],
+                                   [gl_cv_func_snprintf_directive_n="guessing yes"],
+                                   [gl_cv_func_snprintf_directive_n="guessing no"])
+                                 ;;
+changequote(,)dnl
+                                 # Guess yes on musl systems.
+           *-musl* | midipix*)   gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess yes on FreeBSD >= 5.
+           freebsd[1-4].*)       gl_cv_func_snprintf_directive_n="guessing no";;
+           freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
+           midnightbsd*)         gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess yes on Mac OS X >= 10.3.
+           darwin[1-6].*)        gl_cv_func_snprintf_directive_n="guessing no";;
+           darwin*)              gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess yes on Solaris >= 2.6.
+           solaris2.[0-5] | solaris2.[0-5].*)
+                                 gl_cv_func_snprintf_directive_n="guessing no";;
+           solaris*)             gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess yes on AIX >= 4.
+           aix[1-3]*)            gl_cv_func_snprintf_directive_n="guessing no";;
+           aix*)                 gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess yes on IRIX >= 6.5.
+           irix6.5)              gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess yes on OSF/1 >= 5.
+           osf[3-4]*)            gl_cv_func_snprintf_directive_n="guessing no";;
+           osf*)                 gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess yes on NetBSD >= 3.
+           netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+                                 gl_cv_func_snprintf_directive_n="guessing no";;
+           netbsd*)              gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess yes on BeOS.
+           beos*)                gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess no on Android.
+           linux*-android*)      gl_cv_func_snprintf_directive_n="guessing no";;
+                                 # Guess no on native Windows.
+           mingw* | windows*)    gl_cv_func_snprintf_directive_n="guessing no";;
+                                 # If we don't know, obey --enable-cross-guesses.
+           *)                    gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";;
+changequote([,])dnl
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the snprintf function, when passed a size = 1, writes any
+dnl output without bounds in this case, behaving like sprintf. This is the
+dnl case on Linux libc5.
+dnl Result is gl_cv_func_snprintf_size1.
+
+AC_DEFUN([gl_SNPRINTF_SIZE1],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_SNPRINTF_PRESENCE])
+  AC_CACHE_CHECK([whether snprintf respects a size of 1],
+    [gl_cv_func_snprintf_size1],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#if HAVE_SNPRINTF
+# define my_snprintf snprintf
+#else
+# include <stdarg.h>
+static int my_snprintf (char *buf, int size, const char *format, ...)
+{
+  va_list args;
+  int ret;
+  va_start (args, format);
+  ret = vsnprintf (buf, size, format, args);
+  va_end (args);
+  return ret;
+}
+#endif
+int main()
+{
+  static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
+  my_snprintf (buf, 1, "%d", 12345);
+  return buf[1] != 'E';
+}]])],
+        [gl_cv_func_snprintf_size1=yes],
+        [gl_cv_func_snprintf_size1=no],
+        [case "$host_os" in
+                              # Guess yes on Android.
+           linux*-android*)   gl_cv_func_snprintf_size1="guessing yes" ;;
+                              # Guess yes on native Windows.
+           mingw* | windows*) gl_cv_func_snprintf_size1="guessing yes" ;;
+           *)                 gl_cv_func_snprintf_size1="guessing yes" ;;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the vsnprintf function, when passed a zero size, produces no
+dnl output. (ISO C99, POSIX:2001)
+dnl For example, snprintf nevertheless writes a NUL byte in this case
+dnl on OSF/1 5.1:
+dnl     ---------------------------------------------------------------------
+dnl     #include <stdio.h>
+dnl     int main()
+dnl     {
+dnl       static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
+dnl       snprintf (buf, 0, "%d", 12345);
+dnl       return buf[0] != 'D';
+dnl     }
+dnl     ---------------------------------------------------------------------
+dnl And vsnprintf writes any output without bounds in this case, behaving like
+dnl vsprintf, on HP-UX 11 and OSF/1 5.1:
+dnl     ---------------------------------------------------------------------
+dnl     #include <stdarg.h>
+dnl     #include <stdio.h>
+dnl     static int my_snprintf (char *buf, int size, const char *format, ...)
+dnl     {
+dnl       va_list args;
+dnl       int ret;
+dnl       va_start (args, format);
+dnl       ret = vsnprintf (buf, size, format, args);
+dnl       va_end (args);
+dnl       return ret;
+dnl     }
+dnl     int main()
+dnl     {
+dnl       static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
+dnl       my_snprintf (buf, 0, "%d", 12345);
+dnl       return buf[0] != 'D';
+dnl     }
+dnl     ---------------------------------------------------------------------
+dnl Result is gl_cv_func_vsnprintf_zerosize_c99.
+
+AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99],
+    [gl_cv_func_vsnprintf_zerosize_c99],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdarg.h>
+#include <stdio.h>
+static int my_snprintf (char *buf, int size, const char *format, ...)
+{
+  va_list args;
+  int ret;
+  va_start (args, format);
+  ret = vsnprintf (buf, size, format, args);
+  va_end (args);
+  return ret;
+}
+int main()
+{
+  static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
+  my_snprintf (buf, 0, "%d", 12345);
+  return buf[0] != 'D';
+}]])],
+        [gl_cv_func_vsnprintf_zerosize_c99=yes],
+        [gl_cv_func_vsnprintf_zerosize_c99=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+                                    # Guess yes on glibc systems.
+           *-gnu* | gnu*)           gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on musl systems.
+           *-musl* | midipix*)      gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on FreeBSD >= 5.
+           freebsd[1-4].*)          gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+           freebsd* | kfreebsd*)    gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+           midnightbsd*)            gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on Mac OS X >= 10.3.
+           darwin[1-6].*)           gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+           darwin*)                 gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on Cygwin.
+           cygwin*)                 gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on Solaris >= 2.6.
+           solaris2.[0-5] | solaris2.[0-5].*)
+                                    gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+           solaris*)                gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on AIX >= 4.
+           aix[1-3]*)               gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+           aix*)                    gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on IRIX >= 6.5.
+           irix6.5)                 gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on NetBSD >= 3.
+           netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+                                    gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+           netbsd*)                 gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on BeOS.
+           beos*)                   gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on Android.
+           linux*-android*)         gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # Guess yes on native Windows.
+           mingw* | windows* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+                                    # If we don't know, obey --enable-cross-guesses.
+           *)                       gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
+dnl Test whether the swprintf function works correctly when it produces output
+dnl that contains null wide characters.
+dnl Result is gl_cv_func_swprintf_works.
+
+AC_DEFUN([gl_SWPRINTF_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([swprintf])
+  AC_CACHE_CHECK([whether swprintf works],
+    [gl_cv_func_swprintf_works],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#ifndef __USE_MINGW_ANSI_STDIO
+# define __USE_MINGW_ANSI_STDIO 1
+#endif
+#include <stdio.h>
+#include <wchar.h>
+int main()
+{
+  int result = 0;
+  { /* This test fails on musl libc 1.2.3, FreeBSD, NetBSD, OpenBSD, macOS, AIX.  */
+    wchar_t buf[5] = { 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF };
+    int ret = swprintf (buf, 4, L"%cz", '\0');
+    /* Expected result:
+         ret = 2, buf[0] = 0x0, buf[1] = 0x7a, buf[2] = 0x0, buf[3] = 0xbeef
+       musl libc 1.2.3:
+         ret = 2, buf[0] = 0x0, buf[1] = 0x0, buf[2] = 0x0, buf[3] = 0x0
+         Reported at <https://www.openwall.com/lists/musl/2023/03/22/9>.
+       FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2:
+         ret = 2, buf[0] = 0x0, buf[1] = 0xbeef, buf[2] = 0xbeef, buf[3] = 0xbeef
+     */
+    if (ret < 0 || buf[1] != 'z')
+      result |= 1;
+  }
+  { /* This test fails on mingw.  */
+    wchar_t buf[2];
+    int ret = swprintf (buf, 2, L"%lc", (wint_t)0);
+    /* Expected: ret = 1
+       mingw:    ret = 0
+     */
+    if (ret != 1)
+      result |= 2;
+  }
+  return result;
+}]])],
+        [gl_cv_func_swprintf_works=yes],
+        [gl_cv_func_swprintf_works=no],
+        [case "$host_os" in
+                                    # Guess yes on glibc systems.
+           *-gnu* | gnu*)           gl_cv_func_swprintf_works="guessing yes";;
+                                    # Guess no on musl systems.
+           *-musl* | midipix*)      gl_cv_func_swprintf_works="guessing no";;
+                                    # Guess no on FreeBSD, NetBSD, OpenBSD, macOS, AIX.
+           freebsd* | midnightbsd* | netbsd* | openbsd* | darwin* | aix*)
+                                    gl_cv_func_swprintf_works="guessing no";;
+                                    # Guess no on native Windows.
+           mingw* | windows* | pw*) gl_cv_func_swprintf_works="guessing no";;
+                                    # If we don't know, obey --enable-cross-guesses.
+           *)                       gl_cv_func_swprintf_works="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *wprintf family of functions supports the 'a' and 'A'
+dnl conversion specifier for hexadecimal output of 'long double' numbers.
+dnl (ISO C99, POSIX:2001)
+dnl Result is gl_cv_func_swprintf_directive_la.
+
+AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LA],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether swprintf supports the 'La' and 'LA' directives],
+    [gl_cv_func_swprintf_directive_la],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <wchar.h>
+static wchar_t buf[100];
+int main ()
+{
+  int result = 0;
+  /* This catches a glibc 2.15 and Haiku 2022 bug.  */
+  if (swprintf (buf, sizeof (buf) / sizeof (wchar_t),
+                L"%La %d", 3.1416015625L, 33, 44, 55) < 0
+      || (wcscmp (buf, L"0x1.922p+1 33") != 0
+          && wcscmp (buf, L"0x3.244p+0 33") != 0
+          && wcscmp (buf, L"0x6.488p-1 33") != 0
+          && wcscmp (buf, L"0xc.91p-2 33") != 0))
+    result |= 1;
+  return result;
+}]])],
+        [gl_cv_func_swprintf_directive_la=yes],
+        [gl_cv_func_swprintf_directive_la=no],
+        [case "$host_os" in
+                               # Guess yes on glibc >= 2.17 systems.
+           *-gnu* | gnu*)
+             AC_EGREP_CPP([Unlucky], [
+               #include <features.h>
+               #ifdef __GNU_LIBRARY__
+                #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16) || (__GLIBC__ > 2)) && !defined __UCLIBC__
+                 Unlucky
+                #endif
+               #endif
+               ],
+               [gl_cv_func_swprintf_directive_la="guessing yes"],
+               [gl_cv_func_swprintf_directive_la="guessing no"])
+             ;;
+                               # Guess yes on musl systems.
+           *-musl* | midipix*) gl_cv_func_swprintf_directive_la="guessing yes";;
+                               # Guess yes on Android.
+           linux*-android*)    gl_cv_func_swprintf_directive_la="guessing yes";;
+                               # Guess no on native Windows.
+           mingw* | windows*)  gl_cv_func_swprintf_directive_la="guessing no";;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_swprintf_directive_la="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl Test whether the *wprintf family of functions supports the 'lc' conversion
+dnl specifier for all wide characters.
+dnl (ISO C11, POSIX:2001)
+dnl Result is gl_cv_func_swprintf_directive_lc.
+
+AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LC],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether swprintf supports the 'lc' directive],
+    [gl_cv_func_swprintf_directive_lc],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <wchar.h>
+static wchar_t buf[100];
+static wint_t L_invalid = (wchar_t) 0x76543210;
+int main ()
+{
+  int result = 0;
+  /* This catches a musl libc 1.2.4, Android bug.
+     Reported at <https://www.openwall.com/lists/musl/2023/06/12/3>. */
+  if (swprintf (buf, sizeof (buf) / sizeof (wchar_t),
+                L"%lc %d", L_invalid, 33, 44, 55) < 0)
+    result |= 1;
+  return result;
+}]])],
+        [gl_cv_func_swprintf_directive_lc=yes],
+        [gl_cv_func_swprintf_directive_lc=no],
+        [case "$host_os" in
+                               # Guess yes on glibc systems.
+           *-gnu* | gnu*)      gl_cv_func_swprintf_directive_lc="guessing yes";;
+                               # Guess no on musl systems.
+           *-musl* | midipix*) gl_cv_func_swprintf_directive_lc="guessing no";;
+                               # Guess no on Android.
+           linux*-android*)    gl_cv_func_swprintf_directive_lc="guessing no";;
+                               # Guess yes on native Windows.
+           mingw* | windows*)  gl_cv_func_swprintf_directive_lc="guessing yes";;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_swprintf_directive_lc="$gl_cross_guess_normal";;
+         esac
+        ])
+    ])
+])
+
+dnl The results of these tests on various platforms are:
+dnl
+dnl 1 = gl_PRINTF_SIZES_C99
+dnl 2 = gl_PRINTF_SIZES_C23
+dnl 3 = gl_PRINTF_LONG_DOUBLE
+dnl 4 = gl_PRINTF_INFINITE
+dnl 5 = gl_PRINTF_INFINITE_LONG_DOUBLE
+dnl 6 = gl_PRINTF_DIRECTIVE_A
+dnl 7 = gl_PRINTF_DIRECTIVE_B
+dnl 8 = gl_PRINTF_DIRECTIVE_UPPERCASE_B
+dnl 9 = gl_PRINTF_DIRECTIVE_F
+dnl 10 = gl_PRINTF_DIRECTIVE_N
+dnl 11 = gl_PRINTF_DIRECTIVE_LS
+dnl 12 = gl_PRINTF_DIRECTIVE_LC
+dnl 13 = gl_PRINTF_POSITIONS
+dnl 14 = gl_PRINTF_FLAG_GROUPING
+dnl 15 = gl_PRINTF_FLAG_LEFTADJUST
+dnl 16 = gl_PRINTF_FLAG_ZERO
+dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO
+dnl 18 = gl_PRINTF_PRECISION
+dnl 19 = gl_PRINTF_ENOMEM
+dnl 20 = gl_SNPRINTF_PRESENCE
+dnl 21 = gl_SNPRINTF_TRUNCATION_C99
+dnl 22 = gl_SNPRINTF_RETVAL_C99
+dnl 23 = gl_SNPRINTF_DIRECTIVE_N
+dnl 24 = gl_SNPRINTF_SIZE1
+dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99
+dnl 26 = gl_SWPRINTF_WORKS
+dnl 27 = gl_SWPRINTF_DIRECTIVE_LA
+dnl 28 = gl_SWPRINTF_DIRECTIVE_LC
+dnl
+dnl 1 = checking whether printf supports size specifiers as in C99...
+dnl 2 = checking whether printf supports size specifiers as in C23...
+dnl 3 = checking whether printf supports 'long double' arguments...
+dnl 4 = checking whether printf supports infinite 'double' arguments...
+dnl 5 = checking whether printf supports infinite 'long double' arguments...
+dnl 6 = checking whether printf supports the 'a' and 'A' directives...
+dnl 7 = checking whether printf supports the 'b' directive...
+dnl 8 = checking whether printf supports the 'B' directive...
+dnl 9 = checking whether printf supports the 'F' directive...
+dnl 10 = checking whether printf supports the 'n' directive...
+dnl 11 = checking whether printf supports the 'ls' directive...
+dnl 12 = checking whether printf supports the 'lc' directive correctly...
+dnl 13 = checking whether printf supports POSIX/XSI format strings with positions...
+dnl 14 = checking whether printf supports the grouping flag...
+dnl 15 = checking whether printf supports the left-adjust flag correctly...
+dnl 16 = checking whether printf supports the zero flag correctly...
+dnl 17 = checking whether printf supports the alternative flag with a zero precision...
+dnl 18 = checking whether printf supports large precisions...
+dnl 19 = checking whether printf survives out-of-memory conditions...
+dnl 20 = checking for snprintf...
+dnl 21 = checking whether snprintf truncates the result as in C99...
+dnl 22 = checking whether snprintf returns a byte count as in C99...
+dnl 23 = checking whether snprintf fully supports the 'n' directive...
+dnl 24 = checking whether snprintf respects a size of 1...
+dnl 25 = checking whether vsnprintf respects a zero size as in C99...
+dnl 26 = checking whether swprintf works...
+dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives...
+dnl 28 = checking whether swprintf supports the 'lc' directive...
+dnl
+dnl . = yes, # = no.
+dnl
+dnl                                  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
+dnl   musl libc 1.2.3                .  #  .  .  .  .  #  #  .  .  .  #  .  .  .  .  ?  .  .  .  .  .  .  .  .  #  .  #
+dnl   glibc 2.35                     .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
+dnl   glibc 2.5                      .  #  .  .  .  .  #  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .
+dnl   glibc 2.3.6                    .  #  .  .  .  #  #  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .
+dnl   FreeBSD 14.0                   .  .  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  #  .  .  .  .  .  .  #  .  #
+dnl   FreeBSD 13.0                   .  #  .  .  .  #  #  #  .  .  .  .  .  .  .  .  .  .  #  .  .  .  .  .  .  #  .  #
+dnl   FreeBSD 5.4, 6.1               .  #  .  .  .  #  #  #  .  .  .  .  .  .  .  #  ?  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   Mac OS X 10.13.5               .  #  .  .  #  #  #  #  .  #  .  .  .  .  .  .  .  .  .  .  .  .  #  .  .  #  ?  ?
+dnl   Mac OS X 10.5.8                .  #  .  .  #  #  #  #  .  .  .  .  .  .  .  #  #  .  .  .  .  .  .  .  .  #  ?  ?
+dnl   Mac OS X 10.3.9                .  #  .  .  .  #  #  #  .  .  .  .  .  .  .  #  #  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   OpenBSD 6.0, 6.7               .  #  .  .  .  #  #  #  .  .  .  .  .  .  .  .  .  .  #  .  .  .  .  .  .  #  .  #
+dnl   OpenBSD 3.9, 4.0               .  #  .  #  #  #  #  #  #  .  #  .  .  #  .  #  ?  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   Cygwin 1.7.0 (2009)            .  #  .  .  #  .  #  #  .  .  ?  ?  .  .  .  .  ?  .  ?  .  .  .  .  .  .  ?  ?  ?
+dnl   Cygwin 1.5.25 (2008)           .  #  .  .  #  #  #  #  .  .  #  ?  .  .  .  .  ?  .  #  .  .  .  .  .  .  ?  ?  ?
+dnl   Cygwin 1.5.19 (2006)           #  #  .  .  #  #  #  #  #  .  #  ?  .  #  .  #  ?  #  #  .  .  .  .  .  .  ?  ?  ?
+dnl   Solaris 11.4                   .  #  .  #  #  #  #  #  .  .  #  .  .  .  .  #  .  .  .  .  .  .  .  .  .  .  #  .
+dnl   Solaris 11.3                   .  #  .  .  .  #  #  #  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .
+dnl   Solaris 11.0                   .  #  .  #  #  #  #  #  .  .  #  .  .  .  .  #  .  .  .  .  .  .  .  .  .  ?  ?  ?
+dnl   Solaris 10                     .  #  .  #  #  #  #  #  .  .  #  .  .  .  .  #  .  #  .  .  .  .  .  .  .  .  #  .
+dnl   Solaris 2.6 ... 9              #  #  .  #  #  #  #  #  #  .  #  .  .  .  .  #  ?  #  .  .  .  #  .  .  .  ?  ?  ?
+dnl   Solaris 2.5.1                  #  #  .  #  #  #  #  #  #  .  #  .  .  .  .  #  ?  .  .  #  #  #  #  #  #  ?  ?  ?
+dnl   AIX 7.1                        .  #  .  #  #  #  #  #  .  .  .  .  .  .  .  #  .  #  .  .  .  .  .  .  .  #  .  .
+dnl   AIX 5.2                        .  #  .  #  #  #  #  #  .  .  .  .  .  .  .  #  ?  .  .  .  .  .  .  .  .  #  ?  ?
+dnl   AIX 4.3.2, 5.1                 #  #  .  #  #  #  #  #  #  .  .  .  .  .  .  #  ?  .  .  .  .  #  .  .  .  #  ?  ?
+dnl   HP-UX 11.31                    .  #  .  .  .  #  #  #  .  .  .  ?  .  .  .  #  ?  .  .  .  .  #  #  .  .  ?  ?  ?
+dnl   HP-UX 11.{00,11,23}            #  #  .  .  .  #  #  #  #  .  .  ?  .  .  .  #  ?  .  .  .  .  #  #  .  #  ?  ?  ?
+dnl   HP-UX 10.20                    #  #  .  #  .  #  #  #  #  .  ?  ?  .  .  #  #  ?  .  .  .  .  #  #  ?  #  ?  ?  ?
+dnl   IRIX 6.5                       #  #  .  #  #  #  #  #  #  .  #  .  .  .  .  #  ?  .  .  .  .  #  .  .  .  #  ?  ?
+dnl   OSF/1 5.1                      #  #  .  #  #  #  #  #  #  .  .  ?  .  .  .  #  ?  .  .  .  .  #  .  .  #  ?  ?  ?
+dnl   OSF/1 4.0d                     #  #  .  #  #  #  #  #  #  .  .  ?  .  .  .  #  ?  .  .  #  #  #  #  #  #  ?  ?  ?
+dnl   NetBSD 9.0                     .  #  .  .  .  #  #  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .  #
+dnl   NetBSD 5.0                     .  #  .  .  #  #  #  #  .  .  .  .  .  .  .  #  ?  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   NetBSD 4.0                     .  #  ?  ?  ?  ?  #  #  ?  .  ?  .  .  ?  ?  ?  ?  ?  ?  .  .  .  ?  ?  ?  #  ?  ?
+dnl   NetBSD 3.0                     .  #  .  .  .  #  #  #  #  .  ?  .  #  #  ?  #  ?  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   Haiku                          .  #  .  .  #  #  #  #  #  .  #  ?  .  .  .  .  ?  .  ?  .  .  ?  .  .  .  .  #  .
+dnl   BeOS                           #  #  #  .  #  #  #  #  #  .  ?  ?  #  .  ?  .  ?  #  ?  .  .  ?  .  .  .  ?  ?  ?
+dnl   Android 4.3                    .  #  .  #  #  #  #  #  #  #  #  ?  .  #  .  #  ?  .  #  .  .  .  #  .  .  ?  ?  ?
+dnl   old mingw / msvcrt             #  #  #  #  #  #  #  #  #  .  .  ?  #  #  .  #  ?  #  ?  .  #  #  #  .  .  #  ?  ?
+dnl   MSVC 9                         #  #  #  #  #  #  #  #  #  #  .  ?  #  #  .  #  ?  #  ?  #  #  #  #  .  .  #  ?  ?
+dnl   mingw 2009-2011                .  #  #  .  #  .  #  #  .  .  .  ?  #  #  .  .  ?  .  ?  .  .  .  .  .  .  #  ?  ?
+dnl   mingw-w64 2011                 #  #  #  #  #  #  #  #  #  .  .  ?  #  #  .  #  ?  #  ?  .  #  #  #  .  .  #  ?  ?
deleted file mode 120000 (symlink)
index 7f3cf4141a3337be0ba54e4e877a3b106a367924..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/priv-set.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bbdce660eb95f2f9e5d3e5bda6626084a6ad079f
--- /dev/null
@@ -0,0 +1,15 @@
+# serial 8
+
+# Copyright (C) 2009-2024 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.
+
+# Written by David Bartley.
+
+AC_DEFUN([gl_PRIV_SET],
+[
+  AC_CHECK_FUNCS([getppriv])
+  AC_CHECK_HEADERS_ONCE([priv.h])
+])
deleted file mode 120000 (symlink)
index a4fccc778fc652dbf41746e8cebf657e79d08b4c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pselect.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..005b722b9657b4483d29ba38c6bee2650fcc394d
--- /dev/null
@@ -0,0 +1,75 @@
+# pselect.m4 serial 11
+dnl Copyright (C) 2011-2024 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_PSELECT],
+[
+  AC_REQUIRE([gl_SYS_SELECT_H])
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([pselect])
+
+  if test $ac_cv_func_pselect = yes; then
+    AC_CACHE_CHECK([whether signature of pselect conforms to POSIX],
+      [gl_cv_sig_pselect],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+              [[#include <sys/select.h>
+                ]],
+              [[int (*p) (int, fd_set *, fd_set *, fd_set *restrict,
+                          struct timespec const *restrict,
+                          sigset_t const *restrict) = pselect;
+                return !p;]])],
+         [gl_cv_sig_pselect=yes],
+         [gl_cv_sig_pselect=no])])
+
+    dnl On FreeBSD 8.2, pselect() doesn't always reject bad fds.
+    AC_CACHE_CHECK([whether pselect detects invalid fds],
+      [gl_cv_func_pselect_detects_ebadf],
+      [
+        AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <sys/time.h>
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#include <unistd.h>
+#include <errno.h>
+]GL_MDA_DEFINES],
+[[
+  fd_set set;
+  dup2(0, 16);
+  FD_ZERO(&set);
+  FD_SET(16, &set);
+  close(16);
+  struct timespec timeout;
+  timeout.tv_sec = 0;
+  timeout.tv_nsec = 5000;
+  return pselect (17, &set, NULL, NULL, &timeout, NULL) != -1 || errno != EBADF;
+]])], [gl_cv_func_pselect_detects_ebadf=yes],
+      [gl_cv_func_pselect_detects_ebadf=no],
+          [
+           case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
+                             # Guess yes on systems that emulate the Linux system calls.
+            midipix*)        gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_pselect_detects_ebadf="$gl_cross_guess_normal" ;;
+           esac
+          ])
+      ])
+    case $gl_cv_func_pselect_detects_ebadf in
+      *yes) ;;
+      *) REPLACE_PSELECT=1 ;;
+    esac
+  fi
+
+  if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then
+    REPLACE_PSELECT=1
+  fi
+])
deleted file mode 120000 (symlink)
index 28bd441c3c798e54849b6cd3d76bbb0cd55324d4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pthread-cond.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5266a1a35d0b25e6d02deadbbad9941fbb39ca57
--- /dev/null
@@ -0,0 +1,36 @@
+# pthread-cond.m4 serial 3
+dnl Copyright (C) 2019-2024 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_PTHREAD_COND],
+[
+  AC_REQUIRE([gl_PTHREAD_H])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
+     && test $gl_threads_api = windows; then
+    dnl Choose function names that don't conflict with the mingw-w64 winpthreads
+    dnl library.
+    REPLACE_PTHREAD_COND_INIT=1
+    REPLACE_PTHREAD_CONDATTR_INIT=1
+    REPLACE_PTHREAD_CONDATTR_DESTROY=1
+    REPLACE_PTHREAD_COND_WAIT=1
+    REPLACE_PTHREAD_COND_TIMEDWAIT=1
+    REPLACE_PTHREAD_COND_SIGNAL=1
+    REPLACE_PTHREAD_COND_BROADCAST=1
+    REPLACE_PTHREAD_COND_DESTROY=1
+  else
+    if test $HAVE_PTHREAD_H = 0; then
+      HAVE_PTHREAD_COND_INIT=0
+      HAVE_PTHREAD_CONDATTR_INIT=0
+      HAVE_PTHREAD_CONDATTR_DESTROY=0
+      HAVE_PTHREAD_COND_WAIT=0
+      HAVE_PTHREAD_COND_TIMEDWAIT=0
+      HAVE_PTHREAD_COND_SIGNAL=0
+      HAVE_PTHREAD_COND_BROADCAST=0
+      HAVE_PTHREAD_COND_DESTROY=0
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index b6bb38070c9de7b4148e15f4a00cbe4c51108e7d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pthread-mutex.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..643f9c56750e047b28965f55454566e09168d2c1
--- /dev/null
@@ -0,0 +1,71 @@
+# pthread-mutex.m4 serial 4
+dnl Copyright (C) 2019-2024 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_PTHREAD_MUTEX],
+[
+  AC_REQUIRE([gl_PTHREAD_H])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
+     && test $gl_threads_api = windows; then
+    dnl Choose function names that don't conflict with the mingw-w64 winpthreads
+    dnl library.
+    REPLACE_PTHREAD_MUTEX_INIT=1
+    REPLACE_PTHREAD_MUTEXATTR_INIT=1
+    REPLACE_PTHREAD_MUTEXATTR_GETTYPE=1
+    REPLACE_PTHREAD_MUTEXATTR_SETTYPE=1
+    REPLACE_PTHREAD_MUTEXATTR_GETROBUST=1
+    REPLACE_PTHREAD_MUTEXATTR_SETROBUST=1
+    REPLACE_PTHREAD_MUTEXATTR_DESTROY=1
+    REPLACE_PTHREAD_MUTEX_LOCK=1
+    REPLACE_PTHREAD_MUTEX_TRYLOCK=1
+    REPLACE_PTHREAD_MUTEX_TIMEDLOCK=1
+    REPLACE_PTHREAD_MUTEX_UNLOCK=1
+    REPLACE_PTHREAD_MUTEX_DESTROY=1
+  else
+    if test $HAVE_PTHREAD_H = 0; then
+      HAVE_PTHREAD_MUTEX_INIT=0
+      HAVE_PTHREAD_MUTEXATTR_INIT=0
+      HAVE_PTHREAD_MUTEXATTR_GETTYPE=0
+      HAVE_PTHREAD_MUTEXATTR_SETTYPE=0
+      HAVE_PTHREAD_MUTEXATTR_GETROBUST=0
+      HAVE_PTHREAD_MUTEXATTR_SETROBUST=0
+      HAVE_PTHREAD_MUTEXATTR_DESTROY=0
+      HAVE_PTHREAD_MUTEX_LOCK=0
+      HAVE_PTHREAD_MUTEX_TRYLOCK=0
+      dnl HAVE_PTHREAD_MUTEX_TIMEDLOCK is set in pthread_mutex_timedlock.m4.
+      HAVE_PTHREAD_MUTEX_UNLOCK=0
+      HAVE_PTHREAD_MUTEX_DESTROY=0
+    else
+      AC_CACHE_CHECK([for pthread_mutexattr_getrobust],
+        [gl_cv_func_pthread_mutexattr_getrobust],
+        [saved_LIBS="$LIBS"
+         LIBS="$LIBS $LIBPMULTITHREAD"
+         AC_LINK_IFELSE(
+           [AC_LANG_SOURCE(
+              [[extern
+                #ifdef __cplusplus
+                "C"
+                #endif
+                int pthread_mutexattr_getrobust (void);
+                int main ()
+                {
+                  return pthread_mutexattr_getrobust ();
+                }
+              ]])],
+           [gl_cv_func_pthread_mutexattr_getrobust=yes],
+           [gl_cv_func_pthread_mutexattr_getrobust=no])
+         LIBS="$saved_LIBS"
+        ])
+      if test $gl_cv_func_pthread_mutexattr_getrobust = no; then
+        HAVE_PTHREAD_MUTEXATTR_GETROBUST=0
+        HAVE_PTHREAD_MUTEXATTR_SETROBUST=0
+        AC_DEFINE([PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED], [1],
+          [Define if the 'robust' attribute of pthread_mutex* doesn't exist.])
+      fi
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index 63496d90bd6803f229b3fd7e907903bf3444aefd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pthread-thread.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3785558739deee1810ed6e5d1eb889a151d86a5e
--- /dev/null
@@ -0,0 +1,69 @@
+# pthread-thread.m4 serial 3
+dnl Copyright (C) 2019-2024 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_PTHREAD_THREAD],
+[
+  AC_REQUIRE([gl_PTHREAD_H])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
+     && test $gl_threads_api = windows; then
+    dnl Choose function names that don't conflict with the mingw-w64 winpthreads
+    dnl library.
+    REPLACE_PTHREAD_CREATE=1
+    REPLACE_PTHREAD_ATTR_INIT=1
+    REPLACE_PTHREAD_ATTR_GETDETACHSTATE=1
+    REPLACE_PTHREAD_ATTR_SETDETACHSTATE=1
+    REPLACE_PTHREAD_ATTR_DESTROY=1
+    REPLACE_PTHREAD_SELF=1
+    REPLACE_PTHREAD_EQUAL=1
+    REPLACE_PTHREAD_DETACH=1
+    REPLACE_PTHREAD_JOIN=1
+    REPLACE_PTHREAD_EXIT=1
+  else
+    if test $HAVE_PTHREAD_H = 0; then
+      HAVE_PTHREAD_CREATE=0
+      HAVE_PTHREAD_ATTR_INIT=0
+      HAVE_PTHREAD_ATTR_GETDETACHSTATE=0
+      HAVE_PTHREAD_ATTR_SETDETACHSTATE=0
+      HAVE_PTHREAD_ATTR_DESTROY=0
+      HAVE_PTHREAD_SELF=0
+      HAVE_PTHREAD_EQUAL=0
+      HAVE_PTHREAD_DETACH=0
+      HAVE_PTHREAD_JOIN=0
+      HAVE_PTHREAD_EXIT=0
+    else
+      dnl On HP-UX 11.11, pthread_create() and pthread_attr_init() are only
+      dnl defined as inline functions.
+      AC_CACHE_CHECK([whether pthread_create exists as a global function],
+        [gl_cv_func_pthread_create],
+        [saved_LIBS="$LIBS"
+         LIBS="$LIBS $LIBPMULTITHREAD"
+         AC_LINK_IFELSE(
+           [AC_LANG_SOURCE(
+              [[extern
+                #ifdef __cplusplus
+                "C"
+                #endif
+                int pthread_create (void);
+                int main ()
+                {
+                  return pthread_create ();
+                }
+              ]])],
+           [gl_cv_func_pthread_create=yes],
+           [gl_cv_func_pthread_create=no])
+         LIBS="$saved_LIBS"
+        ])
+      if test $gl_cv_func_pthread_create = no; then
+        REPLACE_PTHREAD_CREATE=1
+        REPLACE_PTHREAD_ATTR_INIT=1
+        AC_DEFINE([PTHREAD_CREATE_IS_INLINE], [1],
+          [Define if pthread_create is an inline function.])
+      fi
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index b3b51840e7e64a0899e6bc75714d3a1de66a3227..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pthread_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c33afa0ce27ff3de5b868915988a5b7de0a57c8a
--- /dev/null
@@ -0,0 +1,283 @@
+# pthread_h.m4 serial 9
+dnl Copyright (C) 2009-2024 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_ONCE([gl_PTHREAD_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_PTHREAD_H_DEFAULTS])
+
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_PTHREADLIB])
+
+  gl_CHECK_NEXT_HEADERS([pthread.h])
+  if test $ac_cv_header_pthread_h = yes; then
+    HAVE_PTHREAD_H=1
+    dnl On mingw, if --enable-threads=windows or gl_AVOID_WINPTHREAD is used,
+    dnl ignore the <pthread.h> from the mingw-w64 winpthreads library.
+    m4_ifdef([gl_][THREADLIB], [
+      AC_REQUIRE([gl_][THREADLIB])
+      if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
+         && test $gl_threads_api = windows; then
+        HAVE_PTHREAD_H=0
+      fi
+    ])
+  else
+    HAVE_PTHREAD_H=0
+  fi
+  AC_SUBST([HAVE_PTHREAD_H])
+
+  AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [],
+    [AC_INCLUDES_DEFAULT[
+     #if HAVE_PTHREAD_H
+      #include <pthread.h>
+     #endif]])
+  if test $ac_cv_type_pthread_t != yes; then
+    HAVE_PTHREAD_T=0
+  fi
+  if test $ac_cv_type_pthread_spinlock_t != yes; then
+    HAVE_PTHREAD_SPINLOCK_T=0
+  fi
+
+  dnl Constants may be defined as C preprocessor macros or as enum items.
+
+  AC_CACHE_CHECK([for PTHREAD_CREATE_DETACHED],
+    [gl_cv_const_PTHREAD_CREATE_DETACHED],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <pthread.h>
+            int x = PTHREAD_CREATE_DETACHED;
+          ]],
+          [[]])],
+       [gl_cv_const_PTHREAD_CREATE_DETACHED=yes],
+       [gl_cv_const_PTHREAD_CREATE_DETACHED=no])
+    ])
+  if test $gl_cv_const_PTHREAD_CREATE_DETACHED != yes; then
+    HAVE_PTHREAD_CREATE_DETACHED=0
+  fi
+
+  AC_CACHE_CHECK([for PTHREAD_MUTEX_RECURSIVE],
+    [gl_cv_const_PTHREAD_MUTEX_RECURSIVE],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <pthread.h>
+            int x = PTHREAD_MUTEX_RECURSIVE;
+          ]],
+          [[]])],
+       [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=yes],
+       [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=no])
+    ])
+  if test $gl_cv_const_PTHREAD_MUTEX_RECURSIVE != yes; then
+    HAVE_PTHREAD_MUTEX_RECURSIVE=0
+  fi
+
+  AC_CACHE_CHECK([for PTHREAD_MUTEX_ROBUST],
+    [gl_cv_const_PTHREAD_MUTEX_ROBUST],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <pthread.h>
+            int x = PTHREAD_MUTEX_ROBUST;
+          ]],
+          [[]])],
+       [gl_cv_const_PTHREAD_MUTEX_ROBUST=yes],
+       [gl_cv_const_PTHREAD_MUTEX_ROBUST=no])
+    ])
+  if test $gl_cv_const_PTHREAD_MUTEX_ROBUST != yes; then
+    HAVE_PTHREAD_MUTEX_ROBUST=0
+  fi
+
+  AC_CACHE_CHECK([for PTHREAD_PROCESS_SHARED],
+    [gl_cv_const_PTHREAD_PROCESS_SHARED],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <pthread.h>
+            int x = PTHREAD_PROCESS_SHARED;
+          ]],
+          [[]])],
+       [gl_cv_const_PTHREAD_PROCESS_SHARED=yes],
+       [gl_cv_const_PTHREAD_PROCESS_SHARED=no])
+    ])
+  if test $gl_cv_const_PTHREAD_PROCESS_SHARED != yes; then
+    HAVE_PTHREAD_PROCESS_SHARED=0
+  fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, if it is not common
+  dnl enough to be declared everywhere.
+  gl_WARN_ON_USE_PREPARE([[#include <pthread.h>
+    ]], [
+    pthread_create pthread_attr_init pthread_attr_getdetachstate
+    pthread_attr_setdetachstate pthread_attr_destroy pthread_self pthread_equal
+    pthread_detach pthread_join pthread_exit
+    pthread_once
+    pthread_mutex_init pthread_mutexattr_init pthread_mutexattr_gettype
+    pthread_mutexattr_settype pthread_mutexattr_getrobust
+    pthread_mutexattr_setrobust pthread_mutexattr_destroy pthread_mutex_lock
+    pthread_mutex_trylock pthread_mutex_timedlock pthread_mutex_unlock
+    pthread_mutex_destroy
+    pthread_rwlock_init pthread_rwlockattr_init pthread_rwlockattr_destroy
+    pthread_rwlock_rdlock pthread_rwlock_wrlock pthread_rwlock_tryrdlock
+    pthread_rwlock_trywrlock pthread_rwlock_timedrdlock
+    pthread_rwlock_timedwrlock pthread_rwlock_unlock pthread_rwlock_destroy
+    pthread_cond_init pthread_condattr_init pthread_condattr_destroy
+    pthread_cond_wait pthread_cond_timedwait pthread_cond_signal
+    pthread_cond_broadcast pthread_cond_destroy
+    pthread_key_create pthread_setspecific pthread_getspecific
+    pthread_key_delete
+    pthread_spin_init pthread_spin_lock pthread_spin_trylock pthread_spin_unlock
+    pthread_spin_destroy])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  dnl For backward compatibility with gnulib versions <= 2019-07.
+  LIB_PTHREAD="$LIBPMULTITHREAD"
+  AC_SUBST([LIB_PTHREAD])
+])
+
+# gl_PTHREAD_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_PTHREAD_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_PTHREAD_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_PTHREAD_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_THREAD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_ONCE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_RWLOCK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_COND])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_TSS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SPIN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX_TIMEDLOCK])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_PTHREAD_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_PTHREAD_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_PTHREAD_T=1;                      AC_SUBST([HAVE_PTHREAD_T])
+  HAVE_PTHREAD_SPINLOCK_T=1;             AC_SUBST([HAVE_PTHREAD_SPINLOCK_T])
+  HAVE_PTHREAD_CREATE_DETACHED=1;        AC_SUBST([HAVE_PTHREAD_CREATE_DETACHED])
+  HAVE_PTHREAD_MUTEX_RECURSIVE=1;        AC_SUBST([HAVE_PTHREAD_MUTEX_RECURSIVE])
+  HAVE_PTHREAD_MUTEX_ROBUST=1;           AC_SUBST([HAVE_PTHREAD_MUTEX_ROBUST])
+  HAVE_PTHREAD_PROCESS_SHARED=1;         AC_SUBST([HAVE_PTHREAD_PROCESS_SHARED])
+  HAVE_PTHREAD_CREATE=1;                 AC_SUBST([HAVE_PTHREAD_CREATE])
+  HAVE_PTHREAD_ATTR_INIT=1;              AC_SUBST([HAVE_PTHREAD_ATTR_INIT])
+  HAVE_PTHREAD_ATTR_GETDETACHSTATE=1;    AC_SUBST([HAVE_PTHREAD_ATTR_GETDETACHSTATE])
+  HAVE_PTHREAD_ATTR_SETDETACHSTATE=1;    AC_SUBST([HAVE_PTHREAD_ATTR_SETDETACHSTATE])
+  HAVE_PTHREAD_ATTR_DESTROY=1;           AC_SUBST([HAVE_PTHREAD_ATTR_DESTROY])
+  HAVE_PTHREAD_SELF=1;                   AC_SUBST([HAVE_PTHREAD_SELF])
+  HAVE_PTHREAD_EQUAL=1;                  AC_SUBST([HAVE_PTHREAD_EQUAL])
+  HAVE_PTHREAD_DETACH=1;                 AC_SUBST([HAVE_PTHREAD_DETACH])
+  HAVE_PTHREAD_JOIN=1;                   AC_SUBST([HAVE_PTHREAD_JOIN])
+  HAVE_PTHREAD_EXIT=1;                   AC_SUBST([HAVE_PTHREAD_EXIT])
+  HAVE_PTHREAD_ONCE=1;                   AC_SUBST([HAVE_PTHREAD_ONCE])
+  HAVE_PTHREAD_MUTEX_INIT=1;             AC_SUBST([HAVE_PTHREAD_MUTEX_INIT])
+  HAVE_PTHREAD_MUTEXATTR_INIT=1;         AC_SUBST([HAVE_PTHREAD_MUTEXATTR_INIT])
+  HAVE_PTHREAD_MUTEXATTR_GETTYPE=1;      AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETTYPE])
+  HAVE_PTHREAD_MUTEXATTR_SETTYPE=1;      AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETTYPE])
+  HAVE_PTHREAD_MUTEXATTR_GETROBUST=1;    AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETROBUST])
+  HAVE_PTHREAD_MUTEXATTR_SETROBUST=1;    AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETROBUST])
+  HAVE_PTHREAD_MUTEXATTR_DESTROY=1;      AC_SUBST([HAVE_PTHREAD_MUTEXATTR_DESTROY])
+  HAVE_PTHREAD_MUTEX_LOCK=1;             AC_SUBST([HAVE_PTHREAD_MUTEX_LOCK])
+  HAVE_PTHREAD_MUTEX_TRYLOCK=1;          AC_SUBST([HAVE_PTHREAD_MUTEX_TRYLOCK])
+  HAVE_PTHREAD_MUTEX_TIMEDLOCK=1;        AC_SUBST([HAVE_PTHREAD_MUTEX_TIMEDLOCK])
+  HAVE_PTHREAD_MUTEX_UNLOCK=1;           AC_SUBST([HAVE_PTHREAD_MUTEX_UNLOCK])
+  HAVE_PTHREAD_MUTEX_DESTROY=1;          AC_SUBST([HAVE_PTHREAD_MUTEX_DESTROY])
+  HAVE_PTHREAD_RWLOCK_INIT=1;            AC_SUBST([HAVE_PTHREAD_RWLOCK_INIT])
+  HAVE_PTHREAD_RWLOCKATTR_INIT=1;        AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_INIT])
+  HAVE_PTHREAD_RWLOCKATTR_DESTROY=1;     AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_DESTROY])
+  HAVE_PTHREAD_RWLOCK_RDLOCK=1;          AC_SUBST([HAVE_PTHREAD_RWLOCK_RDLOCK])
+  HAVE_PTHREAD_RWLOCK_WRLOCK=1;          AC_SUBST([HAVE_PTHREAD_RWLOCK_WRLOCK])
+  HAVE_PTHREAD_RWLOCK_TRYRDLOCK=1;       AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYRDLOCK])
+  HAVE_PTHREAD_RWLOCK_TRYWRLOCK=1;       AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYWRLOCK])
+  HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK=1;     AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK])
+  HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK=1;     AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK])
+  HAVE_PTHREAD_RWLOCK_UNLOCK=1;          AC_SUBST([HAVE_PTHREAD_RWLOCK_UNLOCK])
+  HAVE_PTHREAD_RWLOCK_DESTROY=1;         AC_SUBST([HAVE_PTHREAD_RWLOCK_DESTROY])
+  HAVE_PTHREAD_COND_INIT=1;              AC_SUBST([HAVE_PTHREAD_COND_INIT])
+  HAVE_PTHREAD_CONDATTR_INIT=1;          AC_SUBST([HAVE_PTHREAD_CONDATTR_INIT])
+  HAVE_PTHREAD_CONDATTR_DESTROY=1;       AC_SUBST([HAVE_PTHREAD_CONDATTR_DESTROY])
+  HAVE_PTHREAD_COND_WAIT=1;              AC_SUBST([HAVE_PTHREAD_COND_WAIT])
+  HAVE_PTHREAD_COND_TIMEDWAIT=1;         AC_SUBST([HAVE_PTHREAD_COND_TIMEDWAIT])
+  HAVE_PTHREAD_COND_SIGNAL=1;            AC_SUBST([HAVE_PTHREAD_COND_SIGNAL])
+  HAVE_PTHREAD_COND_BROADCAST=1;         AC_SUBST([HAVE_PTHREAD_COND_BROADCAST])
+  HAVE_PTHREAD_COND_DESTROY=1;           AC_SUBST([HAVE_PTHREAD_COND_DESTROY])
+  HAVE_PTHREAD_KEY_CREATE=1;             AC_SUBST([HAVE_PTHREAD_KEY_CREATE])
+  HAVE_PTHREAD_SETSPECIFIC=1;            AC_SUBST([HAVE_PTHREAD_SETSPECIFIC])
+  HAVE_PTHREAD_GETSPECIFIC=1;            AC_SUBST([HAVE_PTHREAD_GETSPECIFIC])
+  HAVE_PTHREAD_KEY_DELETE=1;             AC_SUBST([HAVE_PTHREAD_KEY_DELETE])
+  HAVE_PTHREAD_SPIN_INIT=1;              AC_SUBST([HAVE_PTHREAD_SPIN_INIT])
+  HAVE_PTHREAD_SPIN_LOCK=1;              AC_SUBST([HAVE_PTHREAD_SPIN_LOCK])
+  HAVE_PTHREAD_SPIN_TRYLOCK=1;           AC_SUBST([HAVE_PTHREAD_SPIN_TRYLOCK])
+  HAVE_PTHREAD_SPIN_UNLOCK=1;            AC_SUBST([HAVE_PTHREAD_SPIN_UNLOCK])
+  HAVE_PTHREAD_SPIN_DESTROY=1;           AC_SUBST([HAVE_PTHREAD_SPIN_DESTROY])
+  REPLACE_PTHREAD_CREATE=0;              AC_SUBST([REPLACE_PTHREAD_CREATE])
+  REPLACE_PTHREAD_ATTR_INIT=0;           AC_SUBST([REPLACE_PTHREAD_ATTR_INIT])
+  REPLACE_PTHREAD_ATTR_GETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_GETDETACHSTATE])
+  REPLACE_PTHREAD_ATTR_SETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_SETDETACHSTATE])
+  REPLACE_PTHREAD_ATTR_DESTROY=0;        AC_SUBST([REPLACE_PTHREAD_ATTR_DESTROY])
+  REPLACE_PTHREAD_SELF=0;                AC_SUBST([REPLACE_PTHREAD_SELF])
+  REPLACE_PTHREAD_EQUAL=0;               AC_SUBST([REPLACE_PTHREAD_EQUAL])
+  REPLACE_PTHREAD_DETACH=0;              AC_SUBST([REPLACE_PTHREAD_DETACH])
+  REPLACE_PTHREAD_JOIN=0;                AC_SUBST([REPLACE_PTHREAD_JOIN])
+  REPLACE_PTHREAD_EXIT=0;                AC_SUBST([REPLACE_PTHREAD_EXIT])
+  REPLACE_PTHREAD_ONCE=0;                AC_SUBST([REPLACE_PTHREAD_ONCE])
+  REPLACE_PTHREAD_MUTEX_INIT=0;          AC_SUBST([REPLACE_PTHREAD_MUTEX_INIT])
+  REPLACE_PTHREAD_MUTEXATTR_INIT=0;      AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_INIT])
+  REPLACE_PTHREAD_MUTEXATTR_GETTYPE=0;   AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETTYPE])
+  REPLACE_PTHREAD_MUTEXATTR_SETTYPE=0;   AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETTYPE])
+  REPLACE_PTHREAD_MUTEXATTR_GETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETROBUST])
+  REPLACE_PTHREAD_MUTEXATTR_SETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETROBUST])
+  REPLACE_PTHREAD_MUTEXATTR_DESTROY=0;   AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_DESTROY])
+  REPLACE_PTHREAD_MUTEX_LOCK=0;          AC_SUBST([REPLACE_PTHREAD_MUTEX_LOCK])
+  REPLACE_PTHREAD_MUTEX_TRYLOCK=0;       AC_SUBST([REPLACE_PTHREAD_MUTEX_TRYLOCK])
+  REPLACE_PTHREAD_MUTEX_TIMEDLOCK=0;     AC_SUBST([REPLACE_PTHREAD_MUTEX_TIMEDLOCK])
+  REPLACE_PTHREAD_MUTEX_UNLOCK=0;        AC_SUBST([REPLACE_PTHREAD_MUTEX_UNLOCK])
+  REPLACE_PTHREAD_MUTEX_DESTROY=0;       AC_SUBST([REPLACE_PTHREAD_MUTEX_DESTROY])
+  REPLACE_PTHREAD_RWLOCK_INIT=0;         AC_SUBST([REPLACE_PTHREAD_RWLOCK_INIT])
+  REPLACE_PTHREAD_RWLOCKATTR_INIT=0;     AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_INIT])
+  REPLACE_PTHREAD_RWLOCKATTR_DESTROY=0;  AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_DESTROY])
+  REPLACE_PTHREAD_RWLOCK_RDLOCK=0;       AC_SUBST([REPLACE_PTHREAD_RWLOCK_RDLOCK])
+  REPLACE_PTHREAD_RWLOCK_WRLOCK=0;       AC_SUBST([REPLACE_PTHREAD_RWLOCK_WRLOCK])
+  REPLACE_PTHREAD_RWLOCK_TRYRDLOCK=0;    AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYRDLOCK])
+  REPLACE_PTHREAD_RWLOCK_TRYWRLOCK=0;    AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYWRLOCK])
+  REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK=0;  AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK])
+  REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK=0;  AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK])
+  REPLACE_PTHREAD_RWLOCK_UNLOCK=0;       AC_SUBST([REPLACE_PTHREAD_RWLOCK_UNLOCK])
+  REPLACE_PTHREAD_RWLOCK_DESTROY=0;      AC_SUBST([REPLACE_PTHREAD_RWLOCK_DESTROY])
+  REPLACE_PTHREAD_COND_INIT=0;           AC_SUBST([REPLACE_PTHREAD_COND_INIT])
+  REPLACE_PTHREAD_CONDATTR_INIT=0;       AC_SUBST([REPLACE_PTHREAD_CONDATTR_INIT])
+  REPLACE_PTHREAD_CONDATTR_DESTROY=0;    AC_SUBST([REPLACE_PTHREAD_CONDATTR_DESTROY])
+  REPLACE_PTHREAD_COND_WAIT=0;           AC_SUBST([REPLACE_PTHREAD_COND_WAIT])
+  REPLACE_PTHREAD_COND_TIMEDWAIT=0;      AC_SUBST([REPLACE_PTHREAD_COND_TIMEDWAIT])
+  REPLACE_PTHREAD_COND_SIGNAL=0;         AC_SUBST([REPLACE_PTHREAD_COND_SIGNAL])
+  REPLACE_PTHREAD_COND_BROADCAST=0;      AC_SUBST([REPLACE_PTHREAD_COND_BROADCAST])
+  REPLACE_PTHREAD_COND_DESTROY=0;        AC_SUBST([REPLACE_PTHREAD_COND_DESTROY])
+  REPLACE_PTHREAD_KEY_CREATE=0;          AC_SUBST([REPLACE_PTHREAD_KEY_CREATE])
+  REPLACE_PTHREAD_SETSPECIFIC=0;         AC_SUBST([REPLACE_PTHREAD_SETSPECIFIC])
+  REPLACE_PTHREAD_GETSPECIFIC=0;         AC_SUBST([REPLACE_PTHREAD_GETSPECIFIC])
+  REPLACE_PTHREAD_KEY_DELETE=0;          AC_SUBST([REPLACE_PTHREAD_KEY_DELETE])
+  REPLACE_PTHREAD_SPIN_INIT=0;           AC_SUBST([REPLACE_PTHREAD_SPIN_INIT])
+  REPLACE_PTHREAD_SPIN_LOCK=0;           AC_SUBST([REPLACE_PTHREAD_SPIN_LOCK])
+  REPLACE_PTHREAD_SPIN_TRYLOCK=0;        AC_SUBST([REPLACE_PTHREAD_SPIN_TRYLOCK])
+  REPLACE_PTHREAD_SPIN_UNLOCK=0;         AC_SUBST([REPLACE_PTHREAD_SPIN_UNLOCK])
+  REPLACE_PTHREAD_SPIN_DESTROY=0;        AC_SUBST([REPLACE_PTHREAD_SPIN_DESTROY])
+])
deleted file mode 120000 (symlink)
index 125222d68f3f699249acb608466cf88cfde9279c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pthread_mutex_timedlock.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dda6f5889c1335fade8011b39fa9275e7c1dfd33
--- /dev/null
@@ -0,0 +1,46 @@
+# pthread_mutex_timedlock.m4 serial 3.1
+dnl Copyright (C) 2019-2024 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_PTHREAD_MUTEX_TIMEDLOCK],
+[
+  AC_REQUIRE([gl_PTHREAD_H_DEFAULTS])
+
+  AC_CHECK_DECL([pthread_mutex_timedlock],
+    [dnl Test whether the gnulib module 'threadlib' is in use.
+     dnl Some packages like Emacs use --avoid=threadlib.
+     dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
+     dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
+     m4_ifdef([gl_][THREADLIB], [
+       AC_REQUIRE([gl_][THREADLIB])
+       dnl Test whether the function actually exists.
+       dnl FreeBSD 5.2.1 declares it but does not define it.
+       AC_CACHE_CHECK([for pthread_mutex_timedlock],
+         [gl_cv_func_pthread_mutex_timedlock_in_LIBMULTITHREAD],
+         [gl_save_LIBS="$LIBS"
+          LIBS="$LIBS $LIBMULTITHREAD"
+          AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM(
+               [[#include <pthread.h>
+                 #include <time.h>
+               ]],
+               [[pthread_mutex_t lock;
+                 return pthread_mutex_timedlock (&lock, (struct timespec *) 0);
+               ]])
+            ],
+            [gl_cv_func_pthread_mutex_timedlock_in_LIBMULTITHREAD=yes],
+            [gl_cv_func_pthread_mutex_timedlock_in_LIBMULTITHREAD=no])
+          LIBS="$gl_save_LIBS"
+         ])
+       if test $gl_cv_func_pthread_mutex_timedlock_in_LIBMULTITHREAD != yes; then
+         HAVE_PTHREAD_MUTEX_TIMEDLOCK=0
+       fi
+     ], [
+       :
+     ])
+    ],
+    [HAVE_PTHREAD_MUTEX_TIMEDLOCK=0],
+    [[#include <pthread.h>]])
+])
deleted file mode 120000 (symlink)
index c4ee90c270c3d31cb905f17edfabe52ce2cdae05..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pthread_rwlock_rdlock.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..98e5f0e3d238508a31f8eae5a63536aa80fd1027
--- /dev/null
@@ -0,0 +1,185 @@
+# pthread_rwlock_rdlock.m4 serial 7
+dnl Copyright (C) 2017-2024 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 Bruno Haible.
+dnl Inspired by
+dnl https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c
+dnl by Intel Corporation.
+
+dnl Test whether in a situation where
+dnl   - an rwlock is taken by a reader and has a writer waiting,
+dnl   - an additional reader requests the lock,
+dnl   - the waiting writer and the requesting reader threads have the same
+dnl     priority,
+dnl the requesting reader thread gets blocked, so that at some point the
+dnl waiting writer can acquire the lock.
+dnl Without such a guarantee, when there a N readers and each of the readers
+dnl spends more than 1/Nth of the time with the lock held, there is a high
+dnl probability that the waiting writer will not get the lock in a given finite
+dnl time, a phenomenon called "writer starvation".
+dnl Without such a guarantee, applications have a hard time avoiding writer
+dnl starvation.
+dnl
+dnl POSIX:2017 makes this requirement only for implementations that support TPS
+dnl (Thread Priority Scheduling) and only for the scheduling policies SCHED_FIFO
+dnl and SCHED_RR, see
+dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html
+dnl but this test verifies the guarantee regardless of TPS and regardless of
+dnl scheduling policy.
+dnl Glibc does not provide this guarantee (and never will on Linux), see
+dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701
+dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052
+AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER],
+[
+  AC_REQUIRE([gl_THREADLIB])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader],
+    [gl_cv_pthread_rwlock_rdlock_prefer_writer],
+    [save_LIBS="$LIBS"
+     LIBS="$LIBS $LIBMULTITHREAD"
+     AC_RUN_IFELSE(
+       [AC_LANG_SOURCE([[
+#include <errno.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define SUCCEED() exit (0)
+#define FAILURE() exit (1)
+#define UNEXPECTED(n) (exit (10 + (n)))
+
+/* The main thread creates the waiting writer and the requesting reader threads
+   in the default way; this guarantees that they have the same priority.
+   We can reuse the main thread as first reader thread.  */
+
+static pthread_rwlock_t lock;
+static pthread_t reader1;
+static pthread_t writer;
+static pthread_t reader2;
+static pthread_t timer;
+/* Used to pass control from writer to reader2 and from reader2 to timer,
+   as in a relay race.
+   Passing control from one running thread to another running thread
+   is most likely faster than to create the second thread.  */
+static pthread_mutex_t baton;
+
+static void *
+timer_func (void *ignored)
+{
+  /* Step 13 (can be before or after step 12):
+     The timer thread takes the baton, then waits a moment to make sure
+     it can tell whether the second reader thread is blocked at step 12.  */
+  if (pthread_mutex_lock (&baton))
+    UNEXPECTED (13);
+  usleep (100000);
+  /* By the time we get here, it's clear that the second reader thread is
+     blocked at step 12.  This is the desired behaviour.  */
+  SUCCEED ();
+}
+
+static void *
+reader2_func (void *ignored)
+{
+  int err;
+
+  /* Step 8 (can be before or after step 7):
+     The second reader thread takes the baton, then waits a moment to make sure
+     the writer thread has reached step 7.  */
+  if (pthread_mutex_lock (&baton))
+    UNEXPECTED (8);
+  usleep (100000);
+  /* Step 9: The second reader thread requests the lock.  */
+  err = pthread_rwlock_tryrdlock (&lock);
+  if (err == 0)
+    FAILURE ();
+  else if (err != EBUSY)
+    UNEXPECTED (9);
+  /* Step 10: Launch a timer, to test whether the next call blocks.  */
+  if (pthread_create (&timer, NULL, timer_func, NULL))
+    UNEXPECTED (10);
+  /* Step 11: Release the baton.  */
+  if (pthread_mutex_unlock (&baton))
+    UNEXPECTED (11);
+  /* Step 12: The second reader thread requests the lock.  */
+  err = pthread_rwlock_rdlock (&lock);
+  if (err == 0)
+    FAILURE ();
+  else
+    UNEXPECTED (12);
+}
+
+static void *
+writer_func (void *ignored)
+{
+  /* Step 4: Take the baton, so that the second reader thread does not go ahead
+     too early.  */
+  if (pthread_mutex_lock (&baton))
+    UNEXPECTED (4);
+  /* Step 5: Create the second reader thread.  */
+  if (pthread_create (&reader2, NULL, reader2_func, NULL))
+    UNEXPECTED (5);
+  /* Step 6: Release the baton.  */
+  if (pthread_mutex_unlock (&baton))
+    UNEXPECTED (6);
+  /* Step 7: The writer thread requests the lock.  */
+  if (pthread_rwlock_wrlock (&lock))
+    UNEXPECTED (7);
+  return NULL;
+}
+
+int
+main ()
+{
+  reader1 = pthread_self ();
+
+  /* Step 1: The main thread initializes the lock and the baton.  */
+  if (pthread_rwlock_init (&lock, NULL))
+    UNEXPECTED (1);
+  if (pthread_mutex_init (&baton, NULL))
+    UNEXPECTED (1);
+  /* Step 2: The main thread acquires the lock as a reader.  */
+  if (pthread_rwlock_rdlock (&lock))
+    UNEXPECTED (2);
+  /* Step 3: Create the writer thread.  */
+  if (pthread_create (&writer, NULL, writer_func, NULL))
+    UNEXPECTED (3);
+  /* Job done.  Go to sleep.  */
+  for (;;)
+    {
+      sleep (1);
+    }
+}
+]])],
+       [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes],
+       [gl_cv_pthread_rwlock_rdlock_prefer_writer=no],
+       [case "$host_os" in
+                              # Guess no on glibc systems.
+          *-gnu* | gnu*)      gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;;
+                              # Guess no on musl systems.
+          *-musl* | midipix*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;;
+                              # Guess no on bionic systems.
+          *-android*)         gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;;
+                              # Guess yes on native Windows with the mingw-w64 winpthreads library.
+                              # Guess no on native Windows with the gnulib windows-rwlock module.
+          mingw* | windows*)  if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
+                                gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes"
+                              else
+                                gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no"
+                              fi
+                              ;;
+                              # If we don't know, obey --enable-cross-guesses.
+          *)                  gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;;
+         esac
+       ])
+     LIBS="$save_LIBS"
+    ])
+  case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in
+    *yes)
+      AC_DEFINE([HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], [1],
+        [Define if the 'pthread_rwlock_rdlock' function prefers a writer to a reader.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 9cac0e8c1ec84088c480c5202bcc9547a7573711..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/pthread_sigmask.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..81be9611db21734ed051728c8c8fb9a7523b2285
--- /dev/null
@@ -0,0 +1,280 @@
+# pthread_sigmask.m4 serial 22
+dnl Copyright (C) 2011-2024 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_PTHREAD_SIGMASK],
+[
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+
+  AC_CHECK_FUNCS_ONCE([pthread_sigmask])
+
+  dnl On MinGW pthread_sigmask is just a macro which always returns 0.
+  dnl It does not exist as a real function, which is required by POSIX.
+  AC_CACHE_CHECK([whether pthread_sigmask is a macro],
+    [gl_cv_func_pthread_sigmask_macro],
+    [AC_EGREP_CPP([headers_define_pthread_sigmask], [
+#include <pthread.h>
+#include <signal.h>
+#ifdef pthread_sigmask
+ headers_define_pthread_sigmask
+#endif],
+       [gl_cv_func_pthread_sigmask_macro=yes],
+       [gl_cv_func_pthread_sigmask_macro=no])
+    ])
+
+  PTHREAD_SIGMASK_LIB=
+
+  if test $gl_cv_func_pthread_sigmask_macro = yes; then
+    dnl pthread_sigmask is a dummy macro.
+    HAVE_PTHREAD_SIGMASK=0
+    dnl Make sure to '#undef pthread_sigmask' before defining it.
+    REPLACE_PTHREAD_SIGMASK=1
+  else
+    dnl Test whether the gnulib module 'threadlib' is in use.
+    dnl Some packages like Emacs use --avoid=threadlib.
+    dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
+    dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
+    m4_ifdef([gl_][THREADLIB], [
+      AC_REQUIRE([gl_][THREADLIB])
+
+      if test "$gl_threads_api" = posix; then
+        if test $ac_cv_func_pthread_sigmask = yes; then
+          dnl pthread_sigmask is available without -lpthread.
+          :
+        else
+          if test -n "$LIBMULTITHREAD"; then
+            AC_CACHE_CHECK([for pthread_sigmask in $LIBMULTITHREAD],
+              [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD],
+              [gl_save_LIBS="$LIBS"
+               LIBS="$LIBS $LIBMULTITHREAD"
+               AC_LINK_IFELSE(
+                 [AC_LANG_PROGRAM(
+                    [[#include <pthread.h>
+                      #include <signal.h>
+                    ]],
+                    [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]])
+                 ],
+                 [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes],
+                 [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no])
+               LIBS="$gl_save_LIBS"
+              ])
+            if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
+              dnl pthread_sigmask is available with -pthread or -lpthread.
+              PTHREAD_SIGMASK_LIB="$LIBMULTITHREAD"
+            else
+              dnl pthread_sigmask is not available at all.
+              HAVE_PTHREAD_SIGMASK=0
+            fi
+          else
+            dnl pthread_sigmask is not available at all.
+            HAVE_PTHREAD_SIGMASK=0
+          fi
+        fi
+      else
+        dnl pthread_sigmask may exist but does not interoperate with the chosen
+        dnl multithreading facility.
+        if test $ac_cv_func_pthread_sigmask = yes; then
+          REPLACE_PTHREAD_SIGMASK=1
+        else
+          HAVE_PTHREAD_SIGMASK=0
+        fi
+      fi
+    ], [
+      dnl The module 'threadlib' is not in use, due to --avoid=threadlib being
+      dnl specified.
+      dnl The package either has prepared CPPFLAGS and LIBS for use of
+      dnl POSIX:2008 threads, or wants to build single-threaded programs.
+      if test $ac_cv_func_pthread_sigmask = yes; then
+        dnl pthread_sigmask exists and does not require extra libraries.
+        dnl Assume that it is declared.
+        :
+      else
+        dnl pthread_sigmask either does not exist or needs extra libraries.
+        HAVE_PTHREAD_SIGMASK=0
+        dnl Define the symbol rpl_pthread_sigmask, not pthread_sigmask,
+        dnl so as to not accidentally override the system's pthread_sigmask
+        dnl symbol from libpthread. This is necessary on IRIX 6.5.
+        REPLACE_PTHREAD_SIGMASK=1
+      fi
+    ])
+  fi
+
+  AC_SUBST([PTHREAD_SIGMASK_LIB])
+  dnl For backward compatibility.
+  LIB_PTHREAD_SIGMASK="$PTHREAD_SIGMASK_LIB"
+  AC_SUBST([LIB_PTHREAD_SIGMASK])
+  dnl We don't need a variable LTLIB_PTHREAD_SIGMASK, because when
+  dnl "$gl_threads_api" = posix, $LTLIBMULTITHREAD and $LIBMULTITHREAD are the
+  dnl same.
+
+  dnl Now test for some bugs in the system function.
+  if test $HAVE_PTHREAD_SIGMASK = 1; then
+    AC_REQUIRE([AC_PROG_CC])
+    AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+    dnl On FreeBSD 13.0, MidnightBSD 1.1, HP-UX 11.31, Solaris 9, in programs
+    dnl that are not linked with -lpthread, the pthread_sigmask() function
+    dnl always returns 0 and has no effect.
+    if test -z "$PTHREAD_SIGMASK_LIB"; then
+      case " $LIBS " in
+        *' -pthread '*) ;;
+        *' -lpthread '*) ;;
+        *)
+          AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread],
+            [gl_cv_func_pthread_sigmask_in_libc_works],
+            [
+              AC_RUN_IFELSE(
+                [AC_LANG_SOURCE([[
+                   #include <pthread.h>
+                   #include <signal.h>
+                   #include <stddef.h>
+                   int main ()
+                   {
+                     sigset_t set;
+                     sigemptyset (&set);
+                     return pthread_sigmask (1729, &set, NULL) != 0;
+                   }]])],
+                [gl_cv_func_pthread_sigmask_in_libc_works=no],
+                [gl_cv_func_pthread_sigmask_in_libc_works=yes],
+                [
+                 changequote(,)dnl
+                 case "$host_os" in
+                   freebsd* | midnightbsd* | hpux* | solaris | solaris2.[2-9]*)
+                     gl_cv_func_pthread_sigmask_in_libc_works="guessing no";;
+                   *)
+                     gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";;
+                 esac
+                 changequote([,])dnl
+                ])
+            ])
+          case "$gl_cv_func_pthread_sigmask_in_libc_works" in
+            *no)
+              REPLACE_PTHREAD_SIGMASK=1
+              AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1],
+                [Define to 1 if pthread_sigmask may return 0 and have no effect.])
+              ;;
+          esac;;
+      esac
+    fi
+
+    dnl On Cygwin 1.7.5, the pthread_sigmask() has a wrong return value
+    dnl convention: Upon failure, it returns -1 and sets errno.
+    AC_CACHE_CHECK([whether pthread_sigmask returns error numbers],
+      [gl_cv_func_pthread_sigmask_return_works],
+      [
+        gl_save_LIBS="$LIBS"
+        LIBS="$LIBS $PTHREAD_SIGMASK_LIB"
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <pthread.h>
+#include <signal.h>
+#include <stddef.h>
+int main ()
+{
+  sigset_t set;
+  sigemptyset (&set);
+  if (pthread_sigmask (1729, &set, NULL) == -1)
+    return 1;
+  return 0;
+}]])],
+          [gl_cv_func_pthread_sigmask_return_works=yes],
+          [gl_cv_func_pthread_sigmask_return_works=no],
+          [case "$host_os" in
+             cygwin*)
+               gl_cv_func_pthread_sigmask_return_works="guessing no";;
+             *)
+               gl_cv_func_pthread_sigmask_return_works="guessing yes";;
+           esac
+          ])
+        LIBS="$gl_save_LIBS"
+      ])
+    case "$gl_cv_func_pthread_sigmask_return_works" in
+      *no)
+        REPLACE_PTHREAD_SIGMASK=1
+        AC_DEFINE([PTHREAD_SIGMASK_FAILS_WITH_ERRNO], [1],
+          [Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno.])
+        ;;
+    esac
+
+    dnl On IRIX 6.5, in a single-threaded program, pending signals are not
+    dnl immediately delivered when they are unblocked through pthread_sigmask,
+    dnl only a little while later.
+    AC_CACHE_CHECK([whether pthread_sigmask unblocks signals correctly],
+      [gl_cv_func_pthread_sigmask_unblock_works],
+      [
+        case "$host_os" in
+          irix*)
+            gl_cv_func_pthread_sigmask_unblock_works="guessing no";;
+          *)
+            gl_cv_func_pthread_sigmask_unblock_works="guessing yes";;
+        esac
+        m4_ifdef([gl_][THREADLIB],
+          [dnl Link against $LIBMULTITHREAD, not only $PTHREAD_SIGMASK_LIB.
+           dnl Otherwise we get a false positive on those platforms where
+           dnl $gl_cv_func_pthread_sigmask_in_libc_works is "no".
+           gl_save_LIBS=$LIBS
+           LIBS="$LIBS $LIBMULTITHREAD"])
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <limits.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+]GL_MDA_DEFINES[
+static volatile int sigint_occurred;
+static void
+sigint_handler (int sig)
+{
+  sigint_occurred++;
+}
+int main ()
+{
+  sigset_t set;
+  pid_t pid = getpid ();
+  char command[80];
+  if (LONG_MAX < pid)
+    return 6;
+  signal (SIGINT, sigint_handler);
+  sigemptyset (&set);
+  sigaddset (&set, SIGINT);
+  if (!(pthread_sigmask (SIG_BLOCK, &set, NULL) == 0))
+    return 1;
+  sprintf (command, "sh -c 'sleep 1; kill -INT %ld' &", (long) pid);
+  if (!(system (command) == 0))
+    return 2;
+  sleep (2);
+  if (!(sigint_occurred == 0))
+    return 3;
+  if (!(pthread_sigmask (SIG_UNBLOCK, &set, NULL) == 0))
+    return 4;
+  if (!(sigint_occurred == 1)) /* This fails on IRIX.  */
+    return 5;
+  return 0;
+}]])],
+          [:],
+          [gl_cv_func_pthread_sigmask_unblock_works=no],
+          [:])
+        m4_ifdef([gl_][THREADLIB], [LIBS=$gl_save_LIBS])
+      ])
+    case "$gl_cv_func_pthread_sigmask_unblock_works" in
+      *no)
+        REPLACE_PTHREAD_SIGMASK=1
+        AC_DEFINE([PTHREAD_SIGMASK_UNBLOCK_BUG], [1],
+          [Define to 1 if pthread_sigmask() unblocks signals incorrectly.])
+        ;;
+    esac
+  fi
+])
+
+# Prerequisite of lib/pthread_sigmask.c.
+AC_DEFUN([gl_PREREQ_PTHREAD_SIGMASK],
+[
+  if test $HAVE_PTHREAD_SIGMASK = 1; then
+    AC_DEFINE([HAVE_PTHREAD_SIGMASK], [1],
+      [Define to 1 if the pthread_sigmask function can be used (despite bugs).])
+  fi
+])
deleted file mode 120000 (symlink)
index 4021e23d37fbfcf2e33ae52c206b1245e41cc176..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/putenv.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..da6abec2bac55f0dcb287b6d276bd863854dffdd
--- /dev/null
@@ -0,0 +1,64 @@
+# putenv.m4 serial 27
+dnl Copyright (C) 2002-2024 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 Jim Meyering.
+dnl
+dnl Check whether putenv ("FOO") removes FOO from the environment.
+dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
+
+AC_DEFUN([gl_FUNC_PUTENV],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([for putenv compatible with GNU and SVID],
+    [gl_cv_func_svid_putenv],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [AC_INCLUDES_DEFAULT
+           GL_MDA_DEFINES],
+          [[
+            /* Put it in env.  */
+            if (putenv ("CONFTEST_putenv=val"))
+              return 1;
+
+            /* Try to remove it.  */
+            if (putenv ("CONFTEST_putenv"))
+              return 2;
+
+            /* Make sure it was deleted.  */
+            if (getenv ("CONFTEST_putenv") != 0)
+              return 3;
+
+            return 0;
+          ]])],
+       [gl_cv_func_svid_putenv=yes],
+       [gl_cv_func_svid_putenv=no],
+       [dnl When crosscompiling, assume putenv is broken.
+        case "$host_os" in
+                              # Guess yes on glibc systems.
+          *-gnu* | gnu*)      gl_cv_func_svid_putenv="guessing yes" ;;
+                              # Guess yes on musl systems.
+          *-musl* | midipix*) gl_cv_func_svid_putenv="guessing yes" ;;
+                              # Guess no on native Windows.
+          mingw* | windows*)  gl_cv_func_svid_putenv="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+          *)                  gl_cv_func_svid_putenv="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
+  case "$gl_cv_func_svid_putenv" in
+    *yes) ;;
+    *)
+      REPLACE_PUTENV=1
+      ;;
+  esac
+])
+
+# Prerequisites of lib/putenv.c.
+AC_DEFUN([gl_PREREQ_PUTENV],
+[
+  AC_CHECK_DECLS([_putenv])
+])
deleted file mode 120000 (symlink)
index 8322e83b2930f50080602454b9fa8bcb0fc47917..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/qsort_r.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0ff79f30f4419b8bca7efe4e02a1aaf9fec6f97b
--- /dev/null
@@ -0,0 +1,52 @@
+dnl Reentrant sort function.
+
+dnl Copyright 2014-2024 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_FUNC_QSORT_R],
+[
+  dnl Persuade glibc to declare qsort_r.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+  AC_CHECK_FUNCS_ONCE([qsort_r])
+  if test $ac_cv_func_qsort_r = yes; then
+    AC_CACHE_CHECK([for qsort_r signature], [gl_cv_qsort_r_signature],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM([[#include <stdlib.h>
+                            void qsort_r (void *, size_t, size_t,
+                                          int (*) (void const *, void const *,
+                                                   void *),
+                                          void *);
+                            void (*p) (void *, size_t, size_t,
+                                       int (*) (void const *, void const *,
+                                                void *),
+                                       void *) = qsort_r;
+                          ]])],
+         [gl_cv_qsort_r_signature=GNU],
+         [AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM([[#include <stdlib.h>
+                               void qsort_r (void *, size_t, size_t, void *,
+                                             int (*) (void *,
+                                                      void const *,
+                                                      void const *));
+                               void (*p) (void *, size_t, size_t, void *,
+                                          int (*) (void *, void const *,
+                                                   void const *)) = qsort_r;
+                             ]])],
+            [gl_cv_qsort_r_signature=BSD],
+            [gl_cv_qsort_r_signature=unknown])])])
+    case $gl_cv_qsort_r_signature in
+      GNU)     ;;
+      BSD)     REPLACE_QSORT_R=1 ;;
+      unknown) HAVE_QSORT_R=0 REPLACE_QSORT_R=1 ;;
+    esac
+  else
+    HAVE_QSORT_R=0
+  fi
+])
deleted file mode 120000 (symlink)
index 3c48f1a8c092b799a3cc3c8e806c48d805ab2fd9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/quote.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e44c674e3be542af58e69cdaa7f1ce5340a04f30
--- /dev/null
@@ -0,0 +1,13 @@
+# quote.m4 serial 6
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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_QUOTE],
+[
+  dnl Prerequisites of lib/quote.c.
+  dnl (none)
+  :
+])
deleted file mode 120000 (symlink)
index 8e051e9e185fb94d1cf5a98f1997d085dd801625..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/quotearg.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3ea7eb51989f1afc59aed03de047e19a1d9e4b4f
--- /dev/null
@@ -0,0 +1,11 @@
+# quotearg.m4 serial 10
+dnl Copyright (C) 2002, 2004-2024 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_QUOTEARG],
+[
+  AC_REQUIRE([AC_C_RESTRICT])
+  :
+])
deleted file mode 120000 (symlink)
index d7dac73dd3710c3ffe870d58f1d85340505df093..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/raise.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..08b9545bdb5775e7246883db0bbe2d04aadd299c
--- /dev/null
@@ -0,0 +1,36 @@
+# raise.m4 serial 4
+dnl Copyright (C) 2011-2024 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_RAISE],
+[
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS([raise])
+  if test $ac_cv_func_raise = no; then
+    HAVE_RAISE=0
+  else
+    m4_ifdef([gl_MSVC_INVAL], [
+      AC_REQUIRE([gl_MSVC_INVAL])
+      if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+        REPLACE_RAISE=1
+      fi
+    ])
+    m4_ifdef([gl_SIGNALBLOCKING], [
+      gl_SIGNALBLOCKING
+      if test $HAVE_POSIX_SIGNALBLOCKING = 0; then
+        m4_ifdef([gl_SIGNAL_SIGPIPE], [
+          gl_SIGNAL_SIGPIPE
+          if test $gl_cv_header_signal_h_SIGPIPE != yes; then
+            REPLACE_RAISE=1
+          fi
+        ], [:])
+      fi
+    ])
+  fi
+])
+
+# Prerequisites of lib/raise.c.
+AC_DEFUN([gl_PREREQ_RAISE], [:])
deleted file mode 120000 (symlink)
index e3933cf116d3f6af20ad64ae4a5c765be3c297cc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/random.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..911c5d0e168c9dd0c258b72a3b058eca65b895cb
--- /dev/null
@@ -0,0 +1,79 @@
+# random.m4 serial 8
+dnl Copyright (C) 2012-2024 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_RANDOM],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl We can't use AC_CHECK_FUNC here, because random() is defined as a
+  dnl static inline function when compiling for Android 4.4 or older.
+  AC_CACHE_CHECK([for random], [gl_cv_func_random],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdlib.h>]],
+          [[return random() == 0;]])
+       ],
+       [gl_cv_func_random=yes],
+       [gl_cv_func_random=no])
+    ])
+  gl_CHECK_FUNCS_ANDROID([initstate], [[#include <stdlib.h>]])
+  gl_CHECK_FUNCS_ANDROID([setstate], [[#include <stdlib.h>]])
+  if test $gl_cv_func_random = no; then
+    HAVE_RANDOM=0
+    HAVE_INITSTATE=0
+    HAVE_SETSTATE=0
+  else
+    if test $ac_cv_func_initstate = no; then
+      HAVE_INITSTATE=0
+    fi
+    if test $ac_cv_func_setstate = no; then
+      HAVE_SETSTATE=0
+    fi
+  fi
+  if test $HAVE_INITSTATE = 0; then
+    case "$gl_cv_onwards_func_initstate" in
+      future*) REPLACE_INITSTATE=1 ;;
+    esac
+  fi
+  if test $HAVE_SETSTATE = 0; then
+    case "$gl_cv_onwards_func_setstate" in
+      future*) REPLACE_SETSTATE=1 ;;
+    esac
+  fi
+  dnl On several platforms, random() is not multithread-safe.
+  if test $ac_cv_func_initstate = no || test $ac_cv_func_setstate = no \
+     || case "$host_os" in \
+          darwin* | freebsd* | solaris* | cygwin* | haiku*) true ;; \
+          *) false ;; \
+        esac
+  then
+    dnl In order to define initstate or setstate, we need to define all the
+    dnl functions at once.
+    REPLACE_RANDOM=1
+    if test $ac_cv_func_initstate = yes; then
+      REPLACE_INITSTATE=1
+    fi
+    if test $ac_cv_func_setstate = yes; then
+      REPLACE_SETSTATE=1
+    fi
+  fi
+
+  AC_CHECK_DECLS_ONCE([initstate])
+  if test $ac_cv_have_decl_initstate = no; then
+    HAVE_DECL_INITSTATE=0
+  fi
+
+  AC_CHECK_DECLS_ONCE([setstate])
+  if test $ac_cv_have_decl_setstate = no; then
+    HAVE_DECL_SETSTATE=0
+  fi
+])
+
+# Prerequisites of lib/random.c.
+AC_DEFUN([gl_PREREQ_RANDOM], [
+  :
+])
deleted file mode 120000 (symlink)
index 2ba984655a0873a7be03b353336af850bfed0abc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/random_r.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6c5457e9f54a13d951cbb293dceed547d46deb6b
--- /dev/null
@@ -0,0 +1,43 @@
+# serial 5
+dnl Copyright (C) 2008-2024 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_RANDOM_R],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT])
+  if test $ac_cv_header_random_h = no; then
+    HAVE_RANDOM_H=0
+  fi
+
+  AC_CHECK_TYPES([struct random_data],
+    [], [HAVE_STRUCT_RANDOM_DATA=0],
+    [[#include <stdlib.h>
+      #if HAVE_RANDOM_H
+      # include <random.h>
+      #endif
+    ]])
+
+  dnl On AIX and OSF/1, these functions exist, but with different declarations.
+  dnl Override them all.
+  case "$host_os" in
+    aix* | osf*)
+      REPLACE_RANDOM_R=1
+      ;;
+    *)
+      AC_CHECK_FUNCS([random_r])
+      if test $ac_cv_func_random_r = no; then
+        HAVE_RANDOM_R=0
+      fi
+      ;;
+  esac
+])
+
+# Prerequisites of lib/random_r.c.
+AC_DEFUN([gl_PREREQ_RANDOM_R], [
+  :
+])
deleted file mode 120000 (symlink)
index 6e8055d2a75e3e58a5e05536d828f6e25aea6eb8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/rawmemchr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..57d1c2915e3cf57da1b903f3345da27fd99d1757
--- /dev/null
@@ -0,0 +1,20 @@
+# rawmemchr.m4 serial 3
+dnl Copyright (C) 2003, 2007-2024 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_RAWMEMCHR],
+[
+  dnl Persuade glibc <string.h> to declare rawmemchr().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  AC_CHECK_FUNCS([rawmemchr])
+  if test $ac_cv_func_rawmemchr = no; then
+    HAVE_RAWMEMCHR=0
+  fi
+])
+
+# Prerequisites of lib/strchrnul.c.
+AC_DEFUN([gl_PREREQ_RAWMEMCHR], [:])
deleted file mode 120000 (symlink)
index e18c56d807e04b56ba4a59fdd4a6e2d0fc755a31..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/read-file.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5bceefe29b93160dae986a22351419ffe47f8f9f
--- /dev/null
@@ -0,0 +1,8 @@
+# read-file.m4 serial 3
+dnl Copyright (C) 2002-2006, 2009-2024 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.
+
+# Prerequisites of lib/read-file.c.
+AC_DEFUN([gl_PREREQ_READ_FILE], [:])
deleted file mode 120000 (symlink)
index 09bdad52aef043f752b2278d74ff6883328ae2b7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/read.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a30282917d2f44cbf286ee4b3c9a9e620a17d7ba
--- /dev/null
@@ -0,0 +1,28 @@
+# read.m4 serial 5
+dnl Copyright (C) 2011-2024 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_READ],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_READ=1
+    fi
+  ])
+  dnl This ifdef is just an optimization, to avoid performing a configure
+  dnl check whose result is not used. It does not make the test of
+  dnl GNULIB_UNISTD_H_NONBLOCKING or GNULIB_NONBLOCKING redundant.
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    gl_NONBLOCKING_IO
+    if test $gl_cv_have_nonblocking != yes; then
+      REPLACE_READ=1
+    fi
+  ])
+])
+
+# Prerequisites of lib/read.c.
+AC_DEFUN([gl_PREREQ_READ], [:])
deleted file mode 120000 (symlink)
index 875568adea748238fd23fe99f899395cfe50964d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/readdir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2205f1329cab35b24cf2bc30266830c1b5de93bc
--- /dev/null
@@ -0,0 +1,22 @@
+# readdir.m4 serial 3
+dnl Copyright (C) 2011-2024 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_READDIR],
+[
+  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+
+  AC_CHECK_FUNCS([readdir])
+  if test $ac_cv_func_readdir = no; then
+    HAVE_READDIR=0
+  else
+    dnl Replace readdir() on native Windows and OS/2 kLIBC,
+    dnl to support fdopendir().
+    AC_REQUIRE([gl_DIRENT_DIR])
+    if test $DIR_HAS_FD_MEMBER = 0; then
+      REPLACE_READDIR=1
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index b782e30c093e3ac13422e07b88bbde2d82a6af36..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/readlink.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6d78ec84a03da30585bb32d5f86ebc05ebe6cabe
--- /dev/null
@@ -0,0 +1,120 @@
+# readlink.m4 serial 17
+dnl Copyright (C) 2003, 2007, 2009-2024 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_READLINK],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([readlink])
+  if test $ac_cv_func_readlink = no; then
+    HAVE_READLINK=0
+  else
+    AC_CACHE_CHECK([whether readlink signature is correct],
+      [gl_cv_decl_readlink_works],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+      /* Cause compilation failure if original declaration has wrong type.  */
+      ssize_t readlink (const char *, char *, size_t);]])],
+         [gl_cv_decl_readlink_works=yes], [gl_cv_decl_readlink_works=no])])
+    dnl Solaris 9 ignores trailing slash.
+    dnl FreeBSD 7.2 dereferences only one level of links with trailing slash.
+    AC_CACHE_CHECK([whether readlink handles trailing slash correctly],
+      [gl_cv_func_readlink_trailing_slash],
+      [# We have readlink, so assume ln -s works.
+       ln -s conftest.no-such conftest.link
+       ln -s conftest.link conftest.lnk2
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+]], [[char buf[20];
+      return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])],
+         [gl_cv_func_readlink_trailing_slash=yes],
+         [gl_cv_func_readlink_trailing_slash=no],
+         [case "$host_os" in
+            # Guess yes on Linux or glibc systems.
+            linux-* | linux | *-gnu* | gnu*)
+              gl_cv_func_readlink_trailing_slash="guessing yes" ;;
+            # Guess yes on systems that emulate the Linux system calls.
+            midipix*)
+              gl_cv_func_readlink_trailing_slash="guessing yes" ;;
+            # Guess no on AIX or HP-UX.
+            aix* | hpux*)
+              gl_cv_func_readlink_trailing_slash="guessing no" ;;
+            # If we don't know, obey --enable-cross-guesses.
+            *)
+              gl_cv_func_readlink_trailing_slash="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      rm -f conftest.link conftest.lnk2])
+    case "$gl_cv_func_readlink_trailing_slash" in
+      *yes)
+        if test "$gl_cv_decl_readlink_works" != yes; then
+          REPLACE_READLINK=1
+        fi
+        ;;
+      *)
+        AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink
+          fails to recognize a trailing slash.])
+        REPLACE_READLINK=1
+        ;;
+    esac
+
+    AC_CACHE_CHECK([whether readlink truncates results correctly],
+      [gl_cv_func_readlink_truncate],
+      [# We have readlink, so assume ln -s works.
+       ln -s ab conftest.link
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+]], [[char c;
+      return readlink ("conftest.link", &c, 1) != 1;]])],
+         [gl_cv_func_readlink_truncate=yes],
+         [gl_cv_func_readlink_truncate=no],
+         [case "$host_os" in
+            # Guess yes on Linux or glibc systems.
+            linux-* | linux | *-gnu* | gnu*)
+              gl_cv_func_readlink_truncate="guessing yes" ;;
+            # Guess yes on systems that emulate the Linux system calls.
+            midipix*)
+              gl_cv_func_readlink_truncate="guessing yes" ;;
+            # Guess no on AIX or HP-UX.
+            aix* | hpux*)
+              gl_cv_func_readlink_truncate="guessing no" ;;
+            # If we don't know, obey --enable-cross-guesses.
+            *)
+              gl_cv_func_readlink_truncate="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      rm -f conftest.link conftest.lnk2])
+    case $gl_cv_func_readlink_truncate in
+      *yes)
+        if test "$gl_cv_decl_readlink_works" != yes; then
+          REPLACE_READLINK=1
+        fi
+        ;;
+      *)
+        AC_DEFINE([READLINK_TRUNCATE_BUG], [1], [Define to 1 if readlink
+          sets errno instead of truncating a too-long link.])
+        REPLACE_READLINK=1
+        ;;
+    esac
+  fi
+])
+
+# Like gl_FUNC_READLINK, except prepare for separate compilation
+# (no REPLACE_READLINK, no AC_LIBOBJ).
+AC_DEFUN([gl_FUNC_READLINK_SEPARATE],
+[
+  AC_CHECK_FUNCS_ONCE([readlink])
+  gl_PREREQ_READLINK
+])
+
+# Prerequisites of lib/readlink.c.
+AC_DEFUN([gl_PREREQ_READLINK],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 50b928ca309ab0faa7825f3e154a5112eb49b6b6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/readlinkat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..99822102294365dad985e2f030a363ccd07ed872
--- /dev/null
@@ -0,0 +1,42 @@
+# serial 8
+# See if we need to provide readlinkat replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_READLINKAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  gl_CHECK_FUNCS_ANDROID([readlinkat], [[#include <unistd.h>]])
+  AC_REQUIRE([gl_FUNC_READLINK])
+  if test $ac_cv_func_readlinkat = no; then
+    HAVE_READLINKAT=0
+    case "$gl_cv_onwards_func_readlinkat" in
+      future*) REPLACE_READLINKAT=1 ;;
+    esac
+  else
+    AC_CACHE_CHECK([whether readlinkat signature is correct],
+      [gl_cv_decl_readlinkat_works],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+             /* Check whether original declaration has correct type.  */
+             ssize_t readlinkat (int, char const *, char *, size_t);]])],
+         [gl_cv_decl_readlinkat_works=yes],
+         [gl_cv_decl_readlinkat_works=no])])
+    # Assume readlinkat has the same bugs as readlink,
+    # as is the case on OS X 10.10 with trailing slashes.
+    case $gl_cv_decl_readlinkat_works,$gl_cv_func_readlink_trailing_slash,$gl_cv_func_readlink_truncate in
+      *yes,*yes,*yes)
+        ;;
+      *)
+        REPLACE_READLINKAT=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index f32980653c0fbb8722efb321ab298c401b88c663..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/readtokens.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cc42217beeaaa072857c27f5ae8720e2686aa775
--- /dev/null
@@ -0,0 +1,12 @@
+# readtokens.m4 serial 6
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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 Prerequisites of lib/readtokens.c.
+AC_DEFUN([gl_READTOKENS],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 2735677b6c66fcc032f298070113b41d8667bb40..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/readutmp.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d458a8b554ad746cea239c2d753eae1760ee33f1
--- /dev/null
@@ -0,0 +1,121 @@
+# readutmp.m4 serial 30
+dnl Copyright (C) 2002-2024 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_READUTMP],
+[
+  AC_REQUIRE([gl_SYSTEMD_CHOICE])
+
+  dnl Set READUTMP_LIB to '-lsystemd' or '', depending on whether use of
+  dnl systemd APIs is possible and desired (only the systemd login API, here).
+  dnl AC_LIB_LINKFLAGS_BODY would be overkill here, since few people install
+  dnl libsystemd in non-system directories.
+  READUTMP_LIB=
+  if test "$SYSTEMD_CHOICE" = yes; then
+    AC_CHECK_HEADER([systemd/sd-login.h])
+    if test $ac_cv_header_systemd_sd_login_h = yes; then
+      AC_CACHE_CHECK([for libsystemd version >= 254],
+        [gl_cv_lib_readutmp_systemd],
+        [gl_save_LIBS="$LIBS"
+         LIBS="$LIBS -lsystemd"
+         AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM([[
+              #include <stdint.h>
+              #include <systemd/sd-login.h>
+              ]], [[
+              uint64_t st;
+              sd_session_get_start_time ("1", &st);
+              ]])
+           ],
+           [gl_cv_lib_readutmp_systemd=yes],
+           [gl_cv_lib_readutmp_systemd=no])
+         LIBS="$gl_save_LIBS"
+        ])
+      if test $gl_cv_lib_readutmp_systemd = yes; then
+        AC_DEFINE([READUTMP_USE_SYSTEMD], [1],
+          [Define if the readutmp module should use the systemd login API.])
+        READUTMP_LIB='-lsystemd'
+      fi
+    fi
+  fi
+  AC_SUBST([READUTMP_LIB])
+
+  gl_PREREQ_READUTMP_H
+])
+
+# Prerequisites of readutmp.h and boot-time-aux.h.
+AC_DEFUN_ONCE([gl_PREREQ_READUTMP_H],
+[
+  dnl Persuade utmpx.h to declare utmpxname
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_HEADERS_ONCE([utmp.h utmpx.h])
+  if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
+    dnl Prerequisites of lib/readutmp.h and lib/readutmp.c.
+    AC_CHECK_FUNCS_ONCE([utmpname utmpxname])
+    AC_CHECK_DECLS([endutent],,,[[
+/* <sys/types.h> is a prerequisite of <utmp.h> on FreeBSD 8.0, OpenBSD 4.6.  */
+#include <sys/types.h>
+#ifdef HAVE_UTMP_H
+# include <utmp.h>
+#endif
+]])
+    utmp_includes="\
+AC_INCLUDES_DEFAULT
+#ifdef HAVE_UTMPX_H
+# include <utmpx.h>
+#endif
+#ifdef HAVE_UTMP_H
+# if defined _THREAD_SAFE && defined UTMP_DATA_INIT
+   /* When including both utmp.h and utmpx.h on AIX 4.3, with _THREAD_SAFE
+      defined, work around the duplicate struct utmp_data declaration.  */
+#  define utmp_data gl_aix_4_3_workaround_utmp_data
+# endif
+# include <utmp.h>
+#endif
+"
+    AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_tv],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmpx.ut_host],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_host],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmpx.ut_session],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_session],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmpx.ut_exit],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_exit],,,[$utmp_includes])
+
+    AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_exit],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_exit],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_exit.e_exit],,,[$utmp_includes])
+
+    AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_termination],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination],,,[$utmp_includes])
+    AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
+  fi
+
+  AC_CHECK_DECLS([sysinfo],,,[[
+    #include <sys/sysinfo.h>
+    ]])
+
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
+  dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
+  AC_CHECK_HEADERS([sys/sysctl.h],,,
+    [AC_INCLUDES_DEFAULT
+     #if HAVE_SYS_PARAM_H
+     # include <sys/param.h>
+     #endif
+    ])
+  AC_CHECK_FUNCS([sysctl])
+
+  AC_CHECK_HEADERS_ONCE([OS.h])
+])
deleted file mode 120000 (symlink)
index 6e32f6112ca07037dcffc742a8b672daadd11e93..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/realloc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a59af2807c917c62c78d6d95cc9ef84c7973d1a8
--- /dev/null
@@ -0,0 +1,64 @@
+# realloc.m4 serial 29
+dnl Copyright (C) 2007, 2009-2024 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.
+
+# This is adapted with modifications from upstream Autoconf here:
+# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455
+AC_DEFUN([_AC_FUNC_REALLOC_IF],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+  AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull],
+    [ac_cv_func_realloc_0_nonnull],
+    [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdlib.h>
+          ]],
+          [[void *p = realloc (0, 0);
+            void * volatile vp = p;
+            int result = !vp;
+            free (p);
+            return result;]])
+       ],
+       [ac_cv_func_realloc_0_nonnull=yes],
+       [ac_cv_func_realloc_0_nonnull=no],
+       [case "$host_os" in
+          # Guess yes on platforms where we know the result.
+          *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
+          | gnu* | *-musl* | midipix* | midnightbsd* \
+          | hpux* | solaris* | cygwin* | mingw* | windows* | msys* )
+            ac_cv_func_realloc_0_nonnull="guessing yes" ;;
+          # If we don't know, obey --enable-cross-guesses.
+          *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
+  AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2])
+])# AC_FUNC_REALLOC
+
+# gl_FUNC_REALLOC_GNU
+# -------------------
+# Replace realloc if it is not compatible with GNU libc.
+AC_DEFUN([gl_FUNC_REALLOC_GNU],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
+  if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then
+    _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1])
+  fi
+])# gl_FUNC_REALLOC_GNU
+
+# gl_FUNC_REALLOC_POSIX
+# ---------------------
+# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it
+# fails, and doesn't mess up with ptrdiff_t overflow),
+# and replace realloc if it is not.
+AC_DEFUN([gl_FUNC_REALLOC_POSIX],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
+  if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then
+    REPLACE_REALLOC_FOR_REALLOC_POSIX=1
+  fi
+])
deleted file mode 120000 (symlink)
index 0187e2819876ceb01eeb79194577a590fd7f662a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/reallocarray.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..20c4601eac75b7e7bf1ff99b73bfe51bc3f244db
--- /dev/null
@@ -0,0 +1,26 @@
+# reallocarray.m4 serial 5
+dnl Copyright (C) 2017-2024 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_REALLOCARRAY],
+[
+  dnl Persuade glibc <stdlib.h> to declare reallocarray.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF])
+  gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include <stdlib.h>]])
+  if test "$ac_cv_func_reallocarray" = no; then
+    HAVE_REALLOCARRAY=0
+    case "$gl_cv_onwards_func_reallocarray" in
+      future*) REPLACE_REALLOCARRAY=1 ;;
+    esac
+  elif test "$gl_cv_malloc_ptrdiff" = no; then
+    REPLACE_REALLOCARRAY=1
+  fi
+])
+
+# Prerequisites of lib/reallocarray.c.
+AC_DEFUN([gl_PREREQ_REALLOCARRAY], [:])
deleted file mode 120000 (symlink)
index 2fc25251132b4d99af4fdbb58fe1e64c019d3db5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/regex.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3dfeabea05778cb0497a39d691b93ca2874cfe54
--- /dev/null
@@ -0,0 +1,396 @@
+# serial 75
+
+# Copyright (C) 1996-2001, 2003-2024 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 Initially derived from code in GNU grep.
+dnl Mostly written by Jim Meyering.
+
+AC_PREREQ([2.50])
+
+AC_DEFUN([gl_REGEX],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_ARG_WITH([included-regex],
+    [AS_HELP_STRING([[--without-included-regex]],
+                    [don't compile regex; this is the default on systems
+                     with recent-enough versions of the GNU C Library
+                     (use with caution on other systems).])])
+
+  case $with_included_regex in #(
+  yes|no) ac_use_included_regex=$with_included_regex
+        ;;
+  '')
+    # If the system regex support is good enough that it passes the
+    # following run test, then default to *not* using the included regex.c.
+    # If cross compiling, assume the test would fail and use the included
+    # regex.c.
+    AC_CHECK_DECLS_ONCE([alarm])
+    AC_CHECK_HEADERS_ONCE([malloc.h])
+    AC_CACHE_CHECK([for working re_compile_pattern],
+                   [gl_cv_func_re_compile_pattern_working],
+      [AC_RUN_IFELSE(
+        [AC_LANG_PROGRAM(
+          [[#include <regex.h>
+
+            #include <locale.h>
+            #include <limits.h>
+            #include <string.h>
+
+            #if defined M_CHECK_ACTION || HAVE_DECL_ALARM
+            # include <signal.h>
+            # include <unistd.h>
+            #endif
+
+            #if HAVE_MALLOC_H
+            # include <malloc.h>
+            #endif
+
+            #ifdef M_CHECK_ACTION
+            /* Exit with distinguishable exit code.  */
+            static void sigabrt_no_core (int sig) { raise (SIGTERM); }
+            #endif
+          ]],
+          [[int result = 0;
+            static struct re_pattern_buffer regex;
+            unsigned char folded_chars[UCHAR_MAX + 1];
+            int i;
+            const char *s;
+            struct re_registers regs;
+
+            /* Some builds of glibc go into an infinite loop on this
+               test.  Use alarm to force death, and mallopt to avoid
+               malloc recursion in diagnosing the corrupted heap. */
+#if HAVE_DECL_ALARM
+            signal (SIGALRM, SIG_DFL);
+            alarm (2);
+#endif
+#ifdef M_CHECK_ACTION
+            signal (SIGABRT, sigabrt_no_core);
+            mallopt (M_CHECK_ACTION, 2);
+#endif
+
+            if (setlocale (LC_ALL, "en_US.UTF-8"))
+              {
+                {
+                  /* https://sourceware.org/ml/libc-hacker/2006-09/msg00008.html
+                     This test needs valgrind to catch the bug on Debian
+                     GNU/Linux 3.1 x86, but it might catch the bug better
+                     on other platforms and it shouldn't hurt to try the
+                     test here.  */
+                  static char const pat[] = "insert into";
+                  static char const data[] =
+                    "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
+                  re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
+                                 | RE_ICASE);
+                  memset (&regex, 0, sizeof regex);
+                  s = re_compile_pattern (pat, sizeof pat - 1, &regex);
+                  if (s)
+                    result |= 1;
+                  else
+                    {
+                      if (re_search (&regex, data, sizeof data - 1,
+                                     0, sizeof data - 1, &regs)
+                          != -1)
+                        result |= 1;
+                      regfree (&regex);
+                    }
+                }
+
+                {
+                  /* This test is from glibc bug 15078.
+                     The test case is from Andreas Schwab in
+                     <https://sourceware.org/ml/libc-alpha/2013-01/msg00967.html>.
+                     */
+                  static char const pat[] = "[^x]x";
+                  static char const data[] =
+                    /* <U1000><U103B><U103D><U1014><U103A><U102F><U1015><U103A> */
+                    "\xe1\x80\x80"
+                    "\xe1\x80\xbb"
+                    "\xe1\x80\xbd"
+                    "\xe1\x80\x94"
+                    "\xe1\x80\xba"
+                    "\xe1\x80\xaf"
+                    "\xe1\x80\x95"
+                    "\xe1\x80\xba"
+                    "x";
+                  re_set_syntax (0);
+                  memset (&regex, 0, sizeof regex);
+                  s = re_compile_pattern (pat, sizeof pat - 1, &regex);
+                  if (s)
+                    result |= 1;
+                  else
+                    {
+                      i = re_search (&regex, data, sizeof data - 1,
+                                     0, sizeof data - 1, 0);
+                      if (i != 0 && i != 21)
+                        result |= 1;
+                      regfree (&regex);
+                    }
+                }
+
+                if (! setlocale (LC_ALL, "C"))
+                  return 1;
+              }
+
+            /* This test is from glibc bug 3957, reported by Andrew Mackey.  */
+            re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE);
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("a[^x]b", 6, &regex);
+            if (s)
+              result |= 2;
+            else
+              {
+                /* This should fail, but succeeds for glibc-2.5.  */
+                if (re_search (&regex, "a\nb", 3, 0, 3, &regs) != -1)
+                  result |= 2;
+                regfree (&regex);
+              }
+
+            /* This regular expression is from Spencer ere test number 75
+               in grep-2.3.  */
+            re_set_syntax (RE_SYNTAX_POSIX_EGREP);
+            memset (&regex, 0, sizeof regex);
+            for (i = 0; i <= UCHAR_MAX; i++)
+              folded_chars[i] = i;
+            regex.translate = folded_chars;
+            s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex);
+            /* This should fail with _Invalid character class name_ error.  */
+            if (!s)
+              {
+                result |= 4;
+                regfree (&regex);
+              }
+
+            /* Ensure that [b-a] is diagnosed as invalid, when
+               using RE_NO_EMPTY_RANGES. */
+            re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES);
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("a[b-a]", 6, &regex);
+            if (s == 0)
+              {
+                result |= 8;
+                regfree (&regex);
+              }
+
+            /* This should succeed, but does not for glibc-2.1.3.  */
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("{1", 2, &regex);
+            if (s)
+              result |= 8;
+            else
+              regfree (&regex);
+
+            /* The following example is derived from a problem report
+               against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>.  */
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("[an\371]*n", 7, &regex);
+            if (s)
+              result |= 8;
+            else
+              {
+                /* This should match, but does not for glibc-2.2.1.  */
+                if (re_match (&regex, "an", 2, 0, &regs) != 2)
+                  result |= 8;
+                else
+                  {
+                    free (regs.start);
+                    free (regs.end);
+                  }
+                regfree (&regex);
+              }
+
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("x", 1, &regex);
+            if (s)
+              result |= 8;
+            else
+              {
+                /* glibc-2.2.93 does not work with a negative RANGE argument.  */
+                if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1)
+                  result |= 8;
+                else
+                  {
+                    free (regs.start);
+                    free (regs.end);
+                  }
+                regfree (&regex);
+              }
+
+            /* The version of regex.c in older versions of gnulib
+               ignored RE_ICASE.  Detect that problem too.  */
+            re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE);
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("x", 1, &regex);
+            if (s)
+              result |= 16;
+            else
+              {
+                if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0)
+                  result |= 16;
+                else
+                  {
+                    free (regs.start);
+                    free (regs.end);
+                  }
+                regfree (&regex);
+              }
+
+            /* Catch a bug reported by Vin Shelton in
+               https://lists.gnu.org/r/bug-coreutils/2007-06/msg00089.html
+               */
+            re_set_syntax (RE_SYNTAX_POSIX_BASIC
+                           & ~RE_CONTEXT_INVALID_DUP
+                           & ~RE_NO_EMPTY_RANGES);
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("[[:alnum:]_-]\\\\+\$", 16, &regex);
+            if (s)
+              result |= 32;
+            else
+              regfree (&regex);
+
+            /* REG_STARTEND was added to glibc on 2004-01-15.
+               Reject older versions.  */
+            if (! REG_STARTEND)
+              result |= 64;
+
+            /* Matching with the compiled form of this regexp would provoke
+               an assertion failure prior to glibc-2.28:
+                 regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed
+               With glibc-2.28, compilation fails and reports the invalid
+               back reference.  */
+            re_set_syntax (RE_SYNTAX_POSIX_EGREP);
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("0|()0|\\\\1|0", 10, &regex);
+            if (!s)
+              {
+                memset (&regs, 0, sizeof regs);
+                i = re_search (&regex, "x", 1, 0, 1, &regs);
+                if (i != -1)
+                  result |= 64;
+                if (0 <= i)
+                  {
+                    free (regs.start);
+                    free (regs.end);
+                  }
+                regfree (&regex);
+              }
+            else
+              {
+                if (strcmp (s, "Invalid back reference"))
+                  result |= 64;
+              }
+
+            /* glibc bug 11053.  */
+            re_set_syntax (RE_SYNTAX_POSIX_BASIC);
+            memset (&regex, 0, sizeof regex);
+            static char const pat_sub2[] = "\\\\(a*\\\\)*a*\\\\1";
+            s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, &regex);
+            if (s)
+              result |= 64;
+            else
+              {
+                memset (&regs, 0, sizeof regs);
+                static char const data[] = "a";
+                int datalen = sizeof data - 1;
+                i = re_search (&regex, data, datalen, 0, datalen, &regs);
+                if (i != 0)
+                  result |= 64;
+                else if (regs.num_regs < 2)
+                  result |= 64;
+                else if (! (regs.start[0] == 0 && regs.end[0] == 1))
+                  result |= 64;
+                else if (! (regs.start[1] == 0 && regs.end[1] == 0))
+                  result |= 64;
+                regfree (&regex);
+                free (regs.start);
+                free (regs.end);
+              }
+
+#if 0
+            /* It would be nice to reject hosts whose regoff_t values are too
+               narrow (including glibc on hosts with 64-bit ptrdiff_t and
+               32-bit int), but we should wait until glibc implements this
+               feature.  Otherwise, support for equivalence classes and
+               multibyte collation symbols would always be broken except
+               when compiling --without-included-regex.   */
+            if (sizeof (regoff_t) < sizeof (ptrdiff_t)
+                || sizeof (regoff_t) < sizeof (ssize_t))
+              result |= 64;
+#endif
+
+            return result;
+          ]])],
+        [gl_cv_func_re_compile_pattern_working=yes],
+        [gl_cv_func_re_compile_pattern_working=no],
+        [case "$host_os" in
+                              # Guess no on native Windows.
+           mingw* | windows*) gl_cv_func_re_compile_pattern_working="guessing no" ;;
+                              # Otherwise obey --enable-cross-guesses.
+           *)                 gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;;
+         esac
+        ])
+      ])
+    case "$gl_cv_func_re_compile_pattern_working" in #(
+      *yes) ac_use_included_regex=no;; #(
+      *no) ac_use_included_regex=yes;;
+    esac
+    ;;
+  *) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex])
+    ;;
+  esac
+
+  if test $ac_use_included_regex = yes; then
+    AC_DEFINE([_REGEX_INCLUDE_LIMITS_H], [1],
+      [Define if you want <regex.h> to include <limits.h>, so that it
+       consistently overrides <limits.h>'s RE_DUP_MAX.])
+    AC_DEFINE([_REGEX_LARGE_OFFSETS], [1],
+      [Define if you want regoff_t to be at least as wide POSIX requires.])
+    AC_DEFINE([re_syntax_options], [rpl_re_syntax_options],
+      [Define to rpl_re_syntax_options if the replacement should be used.])
+    AC_DEFINE([re_set_syntax], [rpl_re_set_syntax],
+      [Define to rpl_re_set_syntax if the replacement should be used.])
+    AC_DEFINE([re_compile_pattern], [rpl_re_compile_pattern],
+      [Define to rpl_re_compile_pattern if the replacement should be used.])
+    AC_DEFINE([re_compile_fastmap], [rpl_re_compile_fastmap],
+      [Define to rpl_re_compile_fastmap if the replacement should be used.])
+    AC_DEFINE([re_search], [rpl_re_search],
+      [Define to rpl_re_search if the replacement should be used.])
+    AC_DEFINE([re_search_2], [rpl_re_search_2],
+      [Define to rpl_re_search_2 if the replacement should be used.])
+    AC_DEFINE([re_match], [rpl_re_match],
+      [Define to rpl_re_match if the replacement should be used.])
+    AC_DEFINE([re_match_2], [rpl_re_match_2],
+      [Define to rpl_re_match_2 if the replacement should be used.])
+    AC_DEFINE([re_set_registers], [rpl_re_set_registers],
+      [Define to rpl_re_set_registers if the replacement should be used.])
+    AC_DEFINE([re_comp], [rpl_re_comp],
+      [Define to rpl_re_comp if the replacement should be used.])
+    AC_DEFINE([re_exec], [rpl_re_exec],
+      [Define to rpl_re_exec if the replacement should be used.])
+    AC_DEFINE([regcomp], [rpl_regcomp],
+      [Define to rpl_regcomp if the replacement should be used.])
+    AC_DEFINE([regexec], [rpl_regexec],
+      [Define to rpl_regexec if the replacement should be used.])
+    AC_DEFINE([regerror], [rpl_regerror],
+      [Define to rpl_regerror if the replacement should be used.])
+    AC_DEFINE([regfree], [rpl_regfree],
+      [Define to rpl_regfree if the replacement should be used.])
+  fi
+])
+
+# Prerequisites of lib/regex.c and lib/regex_internal.c.
+AC_DEFUN([gl_PREREQ_REGEX],
+[
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([AC_C_INLINE])
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  AC_REQUIRE([gl_EEMALLOC])
+  AC_CHECK_HEADERS([libintl.h])
+  AC_CHECK_FUNCS_ONCE([isblank iswctype])
+  AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]])
+])
deleted file mode 120000 (symlink)
index 8c8eed5a3c3e0e3ae21f38ac7921e488efbe0e35..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/remove.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..47a08081468e724ac8e15bd1b84dd92246785ed9
--- /dev/null
@@ -0,0 +1,41 @@
+# remove.m4 serial 6
+dnl Copyright (C) 2009-2024 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_REMOVE],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_RMDIR])
+  AC_REQUIRE([gl_FUNC_UNLINK])
+  if { case "$gl_cv_func_rmdir_works:$gl_cv_func_unlink_honors_slashes" in
+         *yes:*yes) false;;
+         *) true;;
+       esac
+     }; then
+    dnl If either underlying syscall is broken, then remove likely has
+    dnl the same bug; blindly use our replacement.
+    REPLACE_REMOVE=1
+  else
+    dnl C89 requires remove(), but only POSIX requires it to handle
+    dnl directories.  On mingw, directories fails with EPERM.
+    AC_CACHE_CHECK([whether remove handles directories],
+      [gl_cv_func_remove_dir_works],
+      [mkdir conftest.dir
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <stdio.h>
+]], [[return remove ("conftest.dir");]])],
+         [gl_cv_func_remove_dir_works=yes], [gl_cv_func_remove_dir_works=no],
+         [case $host_os in
+            mingw* | windows*) gl_cv_func_remove_dir_works="guessing no" ;;
+            *)                 gl_cv_func_remove_dir_works="guessing yes" ;;
+          esac])
+       rm -rf conftest.dir])
+    case $gl_cv_func_remove_dir_works in
+      *no*) REPLACE_REMOVE=1;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index cef319887bd835f035d72b3d71e7e8aa3d2139d0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/rename.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5383b3ea52ccccf76c1432158b6decdbdfea4852
--- /dev/null
@@ -0,0 +1,261 @@
+# serial 36
+
+# Copyright (C) 2001, 2003, 2005-2006, 2009-2024 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 Volker Borchert.
+dnl Determine whether rename works for source file names with a trailing slash.
+dnl The rename from SunOS 4.1.1_U1 doesn't.
+dnl
+dnl If it doesn't, arrange to compile the wrapper function and define
+dnl macros for use by that function.
+dnl
+
+AC_DEFUN([gl_FUNC_RENAME],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([lstat])
+
+  dnl Solaris 11.3, AIX 7.1 mistakenly allow rename("file","name/").
+  dnl NetBSD 1.6 mistakenly forbids rename("dir","name/").
+  dnl FreeBSD 7.2 mistakenly allows rename("file","link-to-file/").
+  dnl The Solaris bug can be worked around without stripping
+  dnl trailing slash, while the NetBSD bug requires stripping;
+  dnl the two conditions can be distinguished by whether hard
+  dnl links are also broken.
+  AC_CACHE_CHECK([whether rename honors trailing slash on destination],
+    [gl_cv_func_rename_slash_dst_works],
+    [rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk
+    touch conftest.f && touch conftest.f1 && mkdir conftest.d1 ||
+      AC_MSG_ERROR([cannot create temporary files])
+    # Assume that if we have lstat, we can also check symlinks.
+    if test $ac_cv_func_lstat = yes; then
+      ln -s conftest.f conftest.lnk
+    fi
+    AC_RUN_IFELSE(
+      [AC_LANG_PROGRAM([[
+#        include <stdio.h>
+#        include <stdlib.h>
+         ]],
+         [[int result = 0;
+           if (rename ("conftest.f1", "conftest.f2/") == 0)
+             result |= 1;
+           if (rename ("conftest.d1", "conftest.d2/") != 0)
+             result |= 2;
+#if HAVE_LSTAT
+           if (rename ("conftest.f", "conftest.lnk/") == 0)
+             result |= 4;
+#endif
+           return result;
+         ]])],
+      [gl_cv_func_rename_slash_dst_works=yes],
+      [gl_cv_func_rename_slash_dst_works=no],
+      dnl When crosscompiling, assume rename is broken.
+      [case "$host_os" in
+                            # Guess yes on Linux systems.
+         linux-* | linux)   gl_cv_func_rename_slash_dst_works="guessing yes" ;;
+                            # Guess yes on systems that emulate the Linux system calls.
+         midipix*)          gl_cv_func_rename_slash_dst_works="guessing yes" ;;
+                            # Guess yes on glibc systems.
+         *-gnu*)            gl_cv_func_rename_slash_dst_works="guessing yes" ;;
+                            # Guess no on native Windows.
+         mingw* | windows*) gl_cv_func_rename_slash_dst_works="guessing no" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+         *)                 gl_cv_func_rename_slash_dst_works="$gl_cross_guess_normal" ;;
+       esac
+      ])
+    rm -rf conftest.f conftest.f1 conftest.f2 conftest.d1 conftest.d2 conftest.lnk
+  ])
+  case "$gl_cv_func_rename_slash_dst_works" in
+    *yes) ;;
+    *)
+      REPLACE_RENAME=1
+      AC_DEFINE([RENAME_TRAILING_SLASH_DEST_BUG], [1],
+        [Define if rename does not correctly handle slashes on the destination
+         argument, such as on Solaris 11 or NetBSD 1.6.])
+      ;;
+  esac
+
+  dnl SunOS 4.1.1_U1 mistakenly forbids rename("dir/","name").
+  dnl Solaris 9 mistakenly allows rename("file/","name").
+  dnl FreeBSD 7.2 mistakenly allows rename("link-to-file/","name").
+  dnl These bugs require stripping trailing slash to avoid corrupting
+  dnl symlinks with a trailing slash.
+  AC_CACHE_CHECK([whether rename honors trailing slash on source],
+    [gl_cv_func_rename_slash_src_works],
+    [rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk
+    touch conftest.f && touch conftest.f1 && mkdir conftest.d1 ||
+      AC_MSG_ERROR([cannot create temporary files])
+    # Assume that if we have lstat, we can also check symlinks.
+    if test $ac_cv_func_lstat = yes; then
+      ln -s conftest.f conftest.lnk
+    fi
+    AC_RUN_IFELSE(
+      [AC_LANG_PROGRAM([[
+#        include <stdio.h>
+#        include <stdlib.h>
+         ]],
+         [[int result = 0;
+           if (rename ("conftest.f1/", "conftest.d3") == 0)
+             result |= 1;
+           if (rename ("conftest.d1/", "conftest.d2") != 0)
+             result |= 2;
+#if HAVE_LSTAT
+           if (rename ("conftest.lnk/", "conftest.f") == 0)
+             result |= 4;
+#endif
+           return result;
+         ]])],
+      [gl_cv_func_rename_slash_src_works=yes],
+      [gl_cv_func_rename_slash_src_works=no],
+      dnl When crosscompiling, assume rename is broken.
+      [case "$host_os" in
+                            # Guess yes on Linux systems.
+         linux-* | linux)   gl_cv_func_rename_slash_src_works="guessing yes" ;;
+                            # Guess yes on systems that emulate the Linux system calls.
+         midipix*)          gl_cv_func_rename_slash_src_works="guessing yes" ;;
+                            # Guess yes on glibc systems.
+         *-gnu*)            gl_cv_func_rename_slash_src_works="guessing yes" ;;
+                            # Guess yes on native Windows.
+         mingw* | windows*) gl_cv_func_rename_slash_src_works="guessing yes" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+         *)                 gl_cv_func_rename_slash_src_works="$gl_cross_guess_normal" ;;
+       esac
+      ])
+    rm -rf conftest.f conftest.f1 conftest.d1 conftest.d2 conftest.d3 conftest.lnk
+  ])
+  case "$gl_cv_func_rename_slash_src_works" in
+    *yes) ;;
+    *)
+      REPLACE_RENAME=1
+      AC_DEFINE([RENAME_TRAILING_SLASH_SOURCE_BUG], [1],
+        [Define if rename does not correctly handle slashes on the source
+         argument, such as on Solaris 9 or cygwin 1.5.])
+      ;;
+  esac
+
+  dnl NetBSD 1.6 and cygwin 1.5.x mistakenly reduce hard link count
+  dnl on rename("h1","h2").
+  dnl This bug requires stat'ting targets prior to attempting rename.
+  AC_CHECK_FUNCS_ONCE([link])
+  AC_CACHE_CHECK([whether rename manages hard links correctly],
+    [gl_cv_func_rename_link_works],
+    [if test $ac_cv_func_link = yes; then
+       if test $cross_compiling != yes; then
+         rm -rf conftest.f conftest.f1 conftest.f2
+         if touch conftest.f conftest.f2 && ln conftest.f conftest.f1 &&
+             set x `ls -i conftest.f conftest.f1` && test "$2" = "$4"; then
+           AC_RUN_IFELSE(
+             [AC_LANG_PROGRAM([[
+#               include <errno.h>
+#               include <stdio.h>
+#               include <stdlib.h>
+#               include <unistd.h>
+                ]GL_MDA_DEFINES],
+                [[int result = 0;
+                  if (rename ("conftest.f", "conftest.f1"))
+                    result |= 1;
+                  if (unlink ("conftest.f1"))
+                    result |= 2;
+
+                  /* Allow either the POSIX-required behavior, where the
+                     previous rename kept conftest.f, or the (better) NetBSD
+                     behavior, where it removed conftest.f.  */
+                  if (rename ("conftest.f", "conftest.f") != 0
+                      && errno != ENOENT)
+                    result |= 4;
+
+                  if (rename ("conftest.f1", "conftest.f1") == 0)
+                    result |= 8;
+                  if (rename ("conftest.f2", "conftest.f2") != 0)
+                    result |= 16;
+                  return result;
+                ]])],
+             [gl_cv_func_rename_link_works=yes],
+             [gl_cv_func_rename_link_works=no],
+             [dnl We don't get here.
+              :
+             ])
+         else
+           gl_cv_func_rename_link_works="guessing no"
+         fi
+         rm -rf conftest.f conftest.f1 conftest.f2
+       else
+         dnl When crosscompiling, assume rename is broken.
+         case "$host_os" in
+                              # Guess yes on Linux systems.
+           linux-* | linux)   gl_cv_func_rename_link_works="guessing yes" ;;
+                              # Guess yes on systems that emulate the Linux system calls.
+           midipix*)          gl_cv_func_rename_link_works="guessing yes" ;;
+                              # Guess yes on glibc systems.
+           *-gnu*)            gl_cv_func_rename_link_works="guessing yes" ;;
+                              # Guess yes on native Windows.
+           mingw* | windows*) gl_cv_func_rename_link_works="guessing yes" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+           *)                 gl_cv_func_rename_link_works="$gl_cross_guess_normal" ;;
+         esac
+       fi
+     else
+       gl_cv_func_rename_link_works=yes
+     fi
+    ])
+  case "$gl_cv_func_rename_link_works" in
+    *yes) ;;
+    *)
+      REPLACE_RENAME=1
+      AC_DEFINE([RENAME_HARD_LINK_BUG], [1],
+        [Define if rename fails to leave hard links alone, as on NetBSD 1.6
+         or Cygwin 1.5.])
+      ;;
+  esac
+
+  dnl Cygwin 1.5.x mistakenly allows rename("dir","file").
+  dnl mingw mistakenly forbids rename("dir1","dir2").
+  dnl These bugs require stripping trailing slash to avoid corrupting
+  dnl symlinks with a trailing slash.
+  AC_CACHE_CHECK([whether rename manages existing destinations correctly],
+    [gl_cv_func_rename_dest_works],
+    [rm -rf conftest.f conftest.d1 conftest.d2
+    touch conftest.f && mkdir conftest.d1 conftest.d2 ||
+      AC_MSG_ERROR([cannot create temporary files])
+    AC_RUN_IFELSE(
+      [AC_LANG_PROGRAM([[
+#        include <stdio.h>
+#        include <stdlib.h>
+         ]],
+         [[int result = 0;
+           if (rename ("conftest.d1", "conftest.d2") != 0)
+             result |= 1;
+           if (rename ("conftest.d2", "conftest.f") == 0)
+             result |= 2;
+           return result;
+         ]])],
+      [gl_cv_func_rename_dest_works=yes],
+      [gl_cv_func_rename_dest_works=no],
+      dnl When crosscompiling, assume rename is broken.
+      [case "$host_os" in
+                            # Guess yes on Linux systems.
+         linux-* | linux)   gl_cv_func_rename_dest_works="guessing yes" ;;
+                            # Guess yes on glibc systems.
+         *-gnu*)            gl_cv_func_rename_dest_works="guessing yes" ;;
+                            # Guess no on native Windows.
+         mingw* | windows*) gl_cv_func_rename_dest_works="guessing no" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+         *)                 gl_cv_func_rename_dest_works="$gl_cross_guess_normal" ;;
+       esac
+      ])
+    rm -rf conftest.f conftest.d1 conftest.d2
+  ])
+  case "$gl_cv_func_rename_dest_works" in
+    *yes) ;;
+    *)
+      REPLACE_RENAME=1
+      AC_DEFINE([RENAME_DEST_EXISTS_BUG], [1],
+        [Define if rename does not work when the destination file exists,
+         as on Cygwin 1.5 or Windows.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 66c10e475427a068fde403ad1baa0db17894d1a5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/renameat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..41bfc6e3bbc83d45a4db297d436404d5be11358f
--- /dev/null
@@ -0,0 +1,26 @@
+# serial 4
+# See if we need to provide renameat replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_RENAMEAT],
+[
+  AC_REQUIRE([gl_FUNC_OPENAT])
+  AC_REQUIRE([gl_FUNC_RENAME])
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_HEADERS([linux/fs.h])
+  AC_CHECK_FUNCS_ONCE([renameat])
+  if test $ac_cv_func_renameat = no; then
+    HAVE_RENAMEAT=0
+  elif test $REPLACE_RENAME = 1; then
+    dnl Solaris 9 and 10 have the same bugs in renameat as in rename.
+    REPLACE_RENAMEAT=1
+  fi
+  gl_CHECK_FUNCS_ANDROID([renameat2], [[#include <stdio.h>]])
+])
deleted file mode 120000 (symlink)
index 09fa8103c699ecb1dfe8b5572a65199195eaf9a8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/rewinddir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a5ee4e1f2423f26f14a0d886356d9dfa38f2c3c6
--- /dev/null
@@ -0,0 +1,22 @@
+# rewinddir.m4 serial 3
+dnl Copyright (C) 2011-2024 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_REWINDDIR],
+[
+  AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+
+  AC_CHECK_FUNCS([rewinddir])
+  if test $ac_cv_func_rewinddir = no; then
+    HAVE_REWINDDIR=0
+  else
+    dnl Replace rewinddir() on native Windows and OS/2 kLIBC,
+    dnl to support fdopendir().
+    AC_REQUIRE([gl_DIRENT_DIR])
+    if test $DIR_HAS_FD_MEMBER = 0; then
+      REPLACE_REWINDDIR=1
+    fi
+  fi
+])
deleted file mode 120000 (symlink)
index 55130eeae33b9731e969bced3215fd0303f0e76f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/rmdir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..50156e0de29762a025dae89c26a9ab5952dd0a4e
--- /dev/null
@@ -0,0 +1,56 @@
+# rmdir.m4 serial 19
+dnl Copyright (C) 2002, 2005, 2009-2024 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_RMDIR],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  dnl Detect cygwin 1.5.x bug.
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CACHE_CHECK([whether rmdir works], [gl_cv_func_rmdir_works],
+    [mkdir conftest.dir
+     touch conftest.file
+     AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+         [[#include <stdio.h>
+           #include <errno.h>
+           #if HAVE_UNISTD_H
+           # include <unistd.h>
+           #else /* on Windows with MSVC */
+           # include <direct.h>
+           #endif
+         ]GL_MDA_DEFINES],
+         [[int result = 0;
+           if (!rmdir ("conftest.file/"))
+             result |= 1;
+           else if (errno != ENOTDIR)
+             result |= 2;
+           if (!rmdir ("conftest.dir/./"))
+             result |= 4;
+           return result;
+         ]])],
+       [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no],
+       [case "$host_os" in
+                             # Guess yes on Linux systems.
+          linux-* | linux)   gl_cv_func_rmdir_works="guessing yes" ;;
+                             # Guess yes on systems that emulate the Linux system calls.
+          midipix*)          gl_cv_func_rmdir_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+          *-gnu* | gnu*)     gl_cv_func_rmdir_works="guessing yes" ;;
+                             # Guess no on native Windows.
+          mingw* | windows*) gl_cv_func_rmdir_works="guessing no" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+          *)                 gl_cv_func_rmdir_works="$gl_cross_guess_normal" ;;
+        esac
+       ])
+     rm -rf conftest.dir conftest.file])
+  case "$gl_cv_func_rmdir_works" in
+    *yes) ;;
+    *)
+      REPLACE_RMDIR=1
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index eee8c10c7ea80fd1f2da2cf51f382f17f30ad4b4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/rpmatch.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eecf3496eb6946dfa42b08d4176fddc062320132
--- /dev/null
@@ -0,0 +1,31 @@
+# rpmatch.m4 serial 10
+dnl Copyright (C) 2002-2003, 2007-2024 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_RPMATCH],
+[
+  dnl Persuade glibc <stdlib.h> to declare rpmatch().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_CHECK_FUNCS([rpmatch])
+  if test $ac_cv_func_rpmatch = no; then
+    HAVE_RPMATCH=0
+  fi
+])
+
+# Prerequisites of lib/rpmatch.c.
+AC_DEFUN([gl_PREREQ_RPMATCH], [
+  AC_CACHE_CHECK([for nl_langinfo and YESEXPR], [gl_cv_langinfo_yesexpr],
+    [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
+       [[char* cs = nl_langinfo(YESEXPR); return !cs;]])],
+       [gl_cv_langinfo_yesexpr=yes],
+       [gl_cv_langinfo_yesexpr=no])
+    ])
+  if test $gl_cv_langinfo_yesexpr = yes; then
+    AC_DEFINE([HAVE_LANGINFO_YESEXPR], [1],
+      [Define if you have <langinfo.h> and nl_langinfo(YESEXPR).])
+  fi
+])
deleted file mode 120000 (symlink)
index 16357f79f168e1facea732b50e4b7e6fd53f2275..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/safe-read.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..618ff2dc3a43c8041b7d782608d6ec02e7ff418a
--- /dev/null
@@ -0,0 +1,12 @@
+# safe-read.m4 serial 6
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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.
+
+# Prerequisites of lib/safe-read.c.
+AC_DEFUN([gl_PREREQ_SAFE_READ],
+[
+  AC_REQUIRE([gt_TYPE_SSIZE_T])
+])
deleted file mode 120000 (symlink)
index 7309c3610098af7cea9cf9172461d9549f038688..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/safe-write.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ee3c60b51ad7ece5887deb97b4d3bbb2192551ac
--- /dev/null
@@ -0,0 +1,11 @@
+# safe-write.m4 serial 4
+dnl Copyright (C) 2002, 2005-2006, 2009-2024 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.
+
+# Prerequisites of lib/safe-write.c.
+AC_DEFUN([gl_PREREQ_SAFE_WRITE],
+[
+  gl_PREREQ_SAFE_READ
+])
deleted file mode 120000 (symlink)
index b8846cb347e803856398606dc684c6b62c6eecd3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/same.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b3bc50fba3b3c30977be772fff95312b30e9039c
--- /dev/null
@@ -0,0 +1,13 @@
+#serial 10
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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 Prerequisites of lib/same.c.
+AC_DEFUN([gl_SAME],
+[
+  AC_REQUIRE([AC_SYS_LONG_FILE_NAMES])
+  AC_CHECK_FUNCS_ONCE([fpathconf])
+])
deleted file mode 120000 (symlink)
index f267d28ce7f6ff981d151e8a796f4835509c6e63..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/save-cwd.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f1ac3456f3cd1848b8b005ef4a17cdb12a24620f
--- /dev/null
@@ -0,0 +1,11 @@
+# serial 10
+dnl Copyright (C) 2002-2006, 2009-2024 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 Prerequisites for lib/save-cwd.c.
+AC_DEFUN([gl_SAVE_CWD],
+[
+  AC_CHECK_FUNCS_ONCE([fchdir])
+])
deleted file mode 120000 (symlink)
index 703df6dc30face6d1adf90e48953c41295d9058b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/savedir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..bca3753e203b1fa3db184087a59ab3c87c48a8b7
--- /dev/null
@@ -0,0 +1,11 @@
+# savedir.m4 serial 10
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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_SAVEDIR],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 0583dfa0dee0b474c4dcde51c581f7484b37f961..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/savewd.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ebbe65d0c1c51bc50fcd46d368a134ffd3ef7bb0
--- /dev/null
@@ -0,0 +1,8 @@
+# Save and restore the working directory, possibly using a child process.
+
+dnl Copyright (C) 2004, 2009-2024 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_SAVEWD], [:])
deleted file mode 120000 (symlink)
index 3ac724b582c445a6a7acb742de35ab2b3b98b3ed..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sched_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2ff821e4c07b91caed0d0a92dd99514b83c5da40
--- /dev/null
@@ -0,0 +1,106 @@
+# sched_h.m4 serial 15
+dnl Copyright (C) 2008-2024 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 Bruno Haible.
+
+AC_DEFUN_ONCE([gl_SCHED_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_SCHED_H_DEFAULTS])
+
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
+  AC_CHECK_HEADERS([sched.h], [], [],
+    [[#if HAVE_SYS_CDEFS_H
+       #include <sys/cdefs.h>
+      #endif
+    ]])
+  gl_NEXT_HEADERS([sched.h])
+
+  if test "$ac_cv_header_sched_h" = yes; then
+    HAVE_SCHED_H=1
+  else
+    HAVE_SCHED_H=0
+  fi
+  AC_SUBST([HAVE_SCHED_H])
+
+  if test "$HAVE_SCHED_H" = 1; then
+    AC_CHECK_TYPE([struct sched_param],
+      [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
+      [[#if HAVE_SYS_CDEFS_H
+         #include <sys/cdefs.h>
+        #endif
+        #include <sched.h>
+      ]])
+  else
+    HAVE_STRUCT_SCHED_PARAM=0
+    case "$host_os" in
+      os2*)
+        dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
+        AC_CHECK_TYPE([struct sched_param],
+          [HAVE_STRUCT_SCHED_PARAM=1], [],
+          [#include <spawn.h>])
+        ;;
+      vms)
+        dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h.
+        AC_CHECK_TYPE([struct sched_param],
+          [HAVE_STRUCT_SCHED_PARAM=1], [],
+          [#include <pthread.h>])
+        ;;
+    esac
+  fi
+  AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
+
+  if test "$ac_cv_header_sys_cdefs_h" = yes; then
+    HAVE_SYS_CDEFS_H=1
+  else
+    HAVE_SYS_CDEFS_H=0
+  fi
+  AC_SUBST([HAVE_SYS_CDEFS_H])
+
+  dnl Ensure the type pid_t gets defined.
+  AC_REQUIRE([AC_TYPE_PID_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, if it is not common
+  dnl enough to be declared everywhere.
+  gl_WARN_ON_USE_PREPARE([[#include <sched.h>
+    ]], [sched_yield])
+])
+
+# gl_SCHED_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SCHED_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SCHED_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SCHED_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCHED_YIELD])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SCHED_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SCHED_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_SCHED_YIELD=1;    AC_SUBST([HAVE_SCHED_YIELD])
+  REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD])
+])
deleted file mode 120000 (symlink)
index 058f92d82654d474b8224f8bd8ec6cd5b71f5b2f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sched_yield.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c717c06f90af62425649a2d5dacc585da5e155bc
--- /dev/null
@@ -0,0 +1,22 @@
+# sched_yield.m4 serial 3
+dnl Copyright (C) 2019-2024 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_SCHED_YIELD],
+[
+  AC_REQUIRE([gl_SCHED_H_DEFAULTS])
+  AC_REQUIRE([gl_PTHREADLIB])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
+     && test $gl_threads_api = windows; then
+    dnl Choose function names that don't conflict with the mingw-w64 winpthreads
+    dnl library.
+    REPLACE_SCHED_YIELD=1
+  else
+    AC_CHECK_DECL([sched_yield], , [HAVE_SCHED_YIELD=0],
+      [[#include <sched.h>]])
+  fi
+])
deleted file mode 120000 (symlink)
index d11c34b3a2a3a5d754328bd2f99fef157cd7cbbd..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/secure_getenv.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ce06595d37c70ab218ee53d9425c1f3e87bf03d4
--- /dev/null
@@ -0,0 +1,26 @@
+# secure_getenv.m4 serial 2
+dnl Copyright 2013-2024 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_SECURE_GETENV],
+[
+  dnl Persuade glibc <stdlib.h> to declare secure_getenv().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([secure_getenv])
+  if test $ac_cv_func_secure_getenv = no; then
+    HAVE_SECURE_GETENV=0
+  fi
+])
+
+# Prerequisites of lib/secure_getenv.c.
+AC_DEFUN([gl_PREREQ_SECURE_GETENV], [
+  AC_CHECK_FUNCS([__secure_getenv])
+  if test $ac_cv_func___secure_getenv = no; then
+    gl_CHECK_FUNCS_ANDROID([issetugid], [[#include <unistd.h>]])
+  fi
+  AC_CHECK_FUNCS_ONCE([getuid geteuid getgid getegid])
+])
deleted file mode 120000 (symlink)
index 6114237a521959ed1e67d0bbc64b22703f6173c7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/select.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f3f9dcc0e52e661b33473f079b39afea24ab6e55
--- /dev/null
@@ -0,0 +1,122 @@
+# select.m4 serial 16
+dnl Copyright (C) 2009-2024 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_SELECT],
+[
+  AC_REQUIRE([gl_SYS_SELECT_H])
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_SOCKETS])
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    REPLACE_SELECT=1
+  else
+    dnl On Interix 3.5, select(0, NULL, NULL, NULL, timeout) fails with error
+    dnl EFAULT.
+    AC_CHECK_HEADERS_ONCE([sys/select.h])
+    AC_CACHE_CHECK([whether select supports a 0 argument],
+      [gl_cv_func_select_supports0],
+      [
+        AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
+#include <sys/time.h>
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+int main ()
+{
+  struct timeval timeout;
+  timeout.tv_sec = 0;
+  timeout.tv_usec = 5;
+  return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0;
+}]])], [gl_cv_func_select_supports0=yes], [gl_cv_func_select_supports0=no],
+          [
+changequote(,)dnl
+           case "$host_os" in
+                       # Guess no on Interix.
+             interix*) gl_cv_func_select_supports0="guessing no";;
+                       # Guess yes otherwise.
+             *)        gl_cv_func_select_supports0="guessing yes";;
+           esac
+changequote([,])dnl
+          ])
+      ])
+    case "$gl_cv_func_select_supports0" in
+      *yes) ;;
+      *) REPLACE_SELECT=1 ;;
+    esac
+
+    dnl On FreeBSD 8.2, select() doesn't always reject bad fds.
+    AC_CACHE_CHECK([whether select detects invalid fds],
+      [gl_cv_func_select_detects_ebadf],
+      [
+        AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <sys/time.h>
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#include <unistd.h>
+#include <errno.h>
+]GL_MDA_DEFINES],
+[[
+  fd_set set;
+  dup2(0, 16);
+  FD_ZERO(&set);
+  FD_SET(16, &set);
+  close(16);
+  struct timeval timeout;
+  timeout.tv_sec = 0;
+  timeout.tv_usec = 5;
+  return select (17, &set, NULL, NULL, &timeout) != -1 || errno != EBADF;
+]])], [gl_cv_func_select_detects_ebadf=yes],
+      [gl_cv_func_select_detects_ebadf=no],
+          [
+           case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_select_detects_ebadf="guessing yes" ;;
+                             # Guess yes on systems that emulate the Linux system calls.
+            midipix*)        gl_cv_func_select_detects_ebadf="guessing yes" ;;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_select_detects_ebadf="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_select_detects_ebadf="$gl_cross_guess_normal" ;;
+           esac
+          ])
+      ])
+    case $gl_cv_func_select_detects_ebadf in
+      *yes) ;;
+      *) REPLACE_SELECT=1 ;;
+    esac
+  fi
+
+  dnl Determine the needed libraries.
+  SELECT_LIB="$LIBSOCKET"
+  if test $REPLACE_SELECT = 1; then
+    case "$host_os" in
+      mingw* | windows*)
+        dnl On the MSVC platform, the function MsgWaitForMultipleObjects
+        dnl (used in lib/select.c) requires linking with -luser32. On mingw,
+        dnl it is implicit.
+        AC_LINK_IFELSE(
+          [AC_LANG_SOURCE([[
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+int
+main ()
+{
+  MsgWaitForMultipleObjects (0, NULL, 0, 0, 0);
+  return 0;
+}]])],
+          [],
+          [SELECT_LIB="$SELECT_LIB -luser32"])
+        ;;
+    esac
+  fi
+  AC_SUBST([SELECT_LIB])
+  dnl For backward compatibility.
+  LIB_SELECT="$LIB_SELECT"
+  AC_SUBST([LIB_SELECT])
+])
deleted file mode 120000 (symlink)
index bfa410e8af3d4483d9d2ddcc151a328e542d3d9a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/selinux-context-h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..de2e6b7d1563c3e2fb8a493aa67134c4d9248b36
--- /dev/null
@@ -0,0 +1,20 @@
+# serial 4   -*- Autoconf -*-
+# Copyright (C) 2006-2007, 2009-2024 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.
+
+# From Jim Meyering
+# Provide <selinux/context.h>, if necessary.
+
+AC_DEFUN([gl_HEADERS_SELINUX_CONTEXT_H],
+[
+  AC_REQUIRE([gl_LIBSELINUX])
+  if test "$with_selinux" != no; then
+    AC_CHECK_HEADERS([selinux/context.h],
+                     [GL_GENERATE_SELINUX_CONTEXT_H=false],
+                     [GL_GENERATE_SELINUX_CONTEXT_H=true])
+  else
+    GL_GENERATE_SELINUX_CONTEXT_H=true
+  fi
+])
deleted file mode 120000 (symlink)
index 23f59efc99fd214b98e807f3e132c1e2f8289905..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/selinux-label-h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..87a19e1c048834256b7ebdb04897c3f8e15b4fb7
--- /dev/null
@@ -0,0 +1,17 @@
+# Copyright 2020-2024 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.
+
+# From Paul Eggert
+# Provide <selinux/label.h>, if necessary.
+
+AC_DEFUN([gl_HEADERS_SELINUX_LABEL_H],
+[
+  AC_REQUIRE([gl_LIBSELINUX])
+  GL_GENERATE_SELINUX_LABEL_H=true
+  if test "$with_selinux" != no; then
+    AC_CHECK_HEADERS([selinux/label.h],
+                     [GL_GENERATE_SELINUX_LABEL_H=false])
+  fi
+])
deleted file mode 120000 (symlink)
index ef1346d799cfbf13d61ecebf804019a738a85e79..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/selinux-selinux-h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d92c01b56443e199eab8bb5222a456d53ebffce9
--- /dev/null
@@ -0,0 +1,84 @@
+# serial 7   -*- Autoconf -*-
+# Copyright (C) 2006-2007, 2009-2024 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.
+
+# From Jim Meyering
+# Provide <selinux/selinux.h>, if necessary.
+# If it is already present, provide wrapper functions to guard against
+# misbehavior from getfilecon, lgetfilecon, and fgetfilecon.
+
+AC_DEFUN([gl_HEADERS_SELINUX_SELINUX_H],
+[
+  AC_REQUIRE([gl_LIBSELINUX])
+  if test "$with_selinux" != no; then
+    AC_CHECK_HEADERS([selinux/selinux.h])
+
+    if test $ac_cv_header_selinux_selinux_h = yes; then
+      HAVE_SELINUX_SELINUX_H=1
+    else
+      HAVE_SELINUX_SELINUX_H=0
+    fi
+
+    if test "$ac_cv_header_selinux_selinux_h" = yes; then
+      # We do have <selinux/selinux.h>, so do compile getfilecon.c
+      # and arrange to use its wrappers.
+      gl_CHECK_NEXT_HEADERS([selinux/selinux.h])
+      AC_DEFINE([getfilecon], [rpl_getfilecon],
+                [Always use our getfilecon wrapper.])
+      AC_DEFINE([getfilecon_raw], [rpl_getfilecon_raw],
+                [Always use our getfilecon_raw wrapper.])
+      AC_DEFINE([lgetfilecon], [rpl_lgetfilecon],
+                [Always use our lgetfilecon wrapper.])
+      AC_DEFINE([lgetfilecon_raw], [rpl_lgetfilecon_raw],
+                [Always use our lgetfilecon_raw wrapper.])
+      AC_DEFINE([fgetfilecon], [rpl_fgetfilecon],
+                [Always use our fgetfilecon wrapper.])
+      AC_DEFINE([fgetfilecon_raw], [rpl_fgetfilecon_raw],
+                [Always use our fgetfilecon_raw wrapper.])
+    fi
+
+    case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
+      no:*) # already warned
+        ;;
+      *:no)
+        AC_MSG_WARN([libselinux was found but selinux/selinux.h is missing.])
+        AC_MSG_WARN([AC_PACKAGE_NAME will be compiled without SELinux support.])
+    esac
+  else
+    # Do as if <selinux/selinux.h> does not exist, even if
+    # AC_CHECK_HEADERS_ONCE has already determined that it exists.
+    HAVE_SELINUX_SELINUX_H=0
+  fi
+  AC_SUBST([HAVE_SELINUX_SELINUX_H])
+])
+
+AC_DEFUN([gl_LIBSELINUX],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_CANONICAL_BUILD])
+
+  AC_ARG_WITH([selinux],
+    AS_HELP_STRING([[--without-selinux]], [do not use SELinux, even on systems with SELinux]),
+    [], [with_selinux=maybe])
+
+  LIB_SELINUX=
+  if test "$with_selinux" != no; then
+    gl_save_LIBS=$LIBS
+    AC_SEARCH_LIBS([setfilecon], [selinux],
+                   [test "$ac_cv_search_setfilecon" = "none required" ||
+                    LIB_SELINUX=$ac_cv_search_setfilecon])
+    LIBS=$gl_save_LIBS
+  fi
+  AC_SUBST([LIB_SELINUX])
+
+  # Warn if SELinux is found but libselinux is absent;
+  if test "$ac_cv_search_setfilecon" = no; then
+    if test "$host" = "$build" && test -d /selinux; then
+      AC_MSG_WARN([This system supports SELinux but libselinux is missing.])
+      AC_MSG_WARN([AC_PACKAGE_NAME will be compiled without SELinux support.])
+    fi
+    with_selinux=no
+  fi
+])
deleted file mode 120000 (symlink)
index fb4b0c2ebd99fc60c3b3ae2cfa13172bb301ba16..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/semaphore.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..87fc48ed1cc3ef7ea66d8e7efb6bff097a0fc1a2
--- /dev/null
@@ -0,0 +1,45 @@
+# semaphore.m4 serial 1
+dnl Copyright (C) 2019-2024 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.
+
+# Sets LIB_SEMAPHORE to the library needed, in addition to $(LIBMULTITHREAD),
+# for getting the <semaphore.h> functions.
+
+AC_DEFUN([gl_SEMAPHORE],
+[
+  AC_REQUIRE([gl_THREADLIB])
+  dnl sem_post is
+  dnl   - in libc on macOS, FreeBSD, AIX, IRIX, Solaris 11, Haiku, Cygwin,
+  dnl   - in libpthread on glibc systems, OpenBSD,
+  dnl   - in libpthread or librt on NetBSD,
+  dnl   - in librt on HP-UX 11, OSF/1, Solaris 10.
+  dnl On the platforms where -lpthread is needed, it is contained in
+  dnl $LIBMULTITHREAD. Therefore, the only library we need to test for is -lrt.
+  AC_CACHE_CHECK([for library needed for semaphore functions],
+    [gl_cv_semaphore_lib],
+    [save_LIBS="$LIBS"
+     LIBS="$LIBS $LIBMULTITHREAD"
+     AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <semaphore.h>]],
+          [[sem_post ((sem_t *)0);]])],
+       [gl_cv_semaphore_lib=none],
+       [LIBS="$LIBS -lrt"
+        AC_LINK_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[#include <semaphore.h>]],
+             [[sem_post ((sem_t *)0);]])],
+          [gl_cv_semaphore_lib='-lrt'],
+          [gl_cv_semaphore_lib=none])
+       ])
+     LIBS="$save_LIBS"
+    ])
+  if test "x$gl_cv_semaphore_lib" = xnone; then
+    LIB_SEMAPHORE=
+  else
+    LIB_SEMAPHORE="$gl_cv_semaphore_lib"
+  fi
+  AC_SUBST([LIB_SEMAPHORE])
+])
deleted file mode 120000 (symlink)
index 7bbb70504e4f17509bf8dacf3776cf962359ad80..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/servent.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7673a6395cea979057389d0683854b85e4a7871e
--- /dev/null
@@ -0,0 +1,51 @@
+# servent.m4 serial 4
+dnl Copyright (C) 2008, 2010-2024 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_SERVENT],
+[
+  dnl Where are getservent(), setservent(), endservent(), getservbyname(),
+  dnl getservbyport() defined?
+  dnl Where are getprotoent(), setprotoent(), endprotoent(), getprotobyname(),
+  dnl getprotobynumber() defined?
+  dnl - On Solaris < 11.4, they are in libsocket. Ignore libxnet.
+  dnl - On Haiku, they are in libnetwork.
+  dnl - On BeOS, they are in libnet.
+  dnl - On native Windows, they are in ws2_32.dll.
+  dnl - Otherwise they are in libc.
+  AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+  SERVENT_LIB=
+  gl_saved_libs="$LIBS"
+  AC_SEARCH_LIBS([getservbyname], [socket network net],
+    [if test "$ac_cv_search_getservbyname" != "none required"; then
+       SERVENT_LIB="$ac_cv_search_getservbyname"
+     fi])
+  LIBS="$gl_saved_libs"
+  if test -z "$SERVENT_LIB"; then
+    AC_CHECK_FUNCS([getservbyname], , [
+      AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32],
+        [gl_cv_w32_getservbyname],
+        [gl_cv_w32_getservbyname=no
+         gl_save_LIBS="$LIBS"
+         LIBS="$LIBS -lws2_32"
+         AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#include <stddef.h>
+              ]],
+              [[getservbyname(NULL,NULL);]])],
+           [gl_cv_w32_getservbyname=yes])
+         LIBS="$gl_save_LIBS"
+        ])
+      if test "$gl_cv_w32_getservbyname" = "yes"; then
+        SERVENT_LIB="-lws2_32"
+      fi
+    ])
+  fi
+  AC_SUBST([SERVENT_LIB])
+])
deleted file mode 120000 (symlink)
index 2a0744dc4544eb0b224d0cf8371dafd9ae1be4eb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/setenv.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..21253e65c99ec14eafdcd6492992a9af4f2ca01a
--- /dev/null
@@ -0,0 +1,165 @@
+# setenv.m4 serial 33
+dnl Copyright (C) 2001-2004, 2006-2024 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_SETENV],
+[
+  AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  if test $ac_cv_func_setenv = no; then
+    HAVE_SETENV=0
+  else
+    AC_CACHE_CHECK([whether setenv validates arguments],
+      [gl_cv_func_setenv_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+       #include <stdlib.h>
+       #include <errno.h>
+       #include <string.h>
+      ]], [[
+       int result = 0;
+       {
+         if (setenv ("", "", 0) != -1)
+           result |= 1;
+         else if (errno != EINVAL)
+           result |= 2;
+       }
+       {
+         if (setenv ("a", "=", 1) != 0)
+           result |= 4;
+         else if (strcmp (getenv ("a"), "=") != 0)
+           result |= 8;
+       }
+       return result;
+      ]])],
+      [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no],
+      [case "$host_os" in
+                             # Guess yes on glibc systems.
+         *-gnu* | gnu*)      gl_cv_func_setenv_works="guessing yes" ;;
+                             # Guess yes on musl systems.
+         *-musl* | midipix*) gl_cv_func_setenv_works="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+         *)                  gl_cv_func_setenv_works="$gl_cross_guess_normal" ;;
+       esac
+      ])])
+    case "$gl_cv_func_setenv_works" in
+      *yes) ;;
+      *)
+        REPLACE_SETENV=1
+        ;;
+    esac
+  fi
+])
+
+# Like gl_FUNC_SETENV, except prepare for separate compilation
+# (no REPLACE_SETENV, no AC_LIBOBJ).
+AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([setenv])
+  if test $ac_cv_have_decl_setenv = no; then
+    HAVE_DECL_SETENV=0
+  fi
+  AC_CHECK_FUNCS_ONCE([setenv])
+  gl_PREREQ_SETENV
+])
+
+AC_DEFUN([gl_FUNC_UNSETENV],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_DECLS_ONCE([unsetenv])
+  if test $ac_cv_have_decl_unsetenv = no; then
+    HAVE_DECL_UNSETENV=0
+  fi
+  AC_CHECK_FUNCS([unsetenv])
+  if test $ac_cv_func_unsetenv = no; then
+    HAVE_UNSETENV=0
+  else
+    HAVE_UNSETENV=1
+    dnl Some BSDs return void, failing to do error checking.
+    AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[
+#undef _BSD
+#define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 <stdlib.h> */
+#include <stdlib.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+int unsetenv (const char *name);
+            ]],
+            [[]])],
+         [gt_cv_func_unsetenv_ret='int'],
+         [gt_cv_func_unsetenv_ret='void'])])
+    if test $gt_cv_func_unsetenv_ret = 'void'; then
+      AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void
+       instead of int.])
+      REPLACE_UNSETENV=1
+    fi
+
+    dnl Solaris 10 unsetenv does not remove all copies of a name.
+    dnl Haiku alpha 2 unsetenv gets confused by assignment to environ.
+    dnl OpenBSD 4.7 unsetenv("") does not fail.
+    AC_CACHE_CHECK([whether unsetenv obeys POSIX],
+      [gl_cv_func_unsetenv_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[
+            #include <stdlib.h>
+            #include <errno.h>
+            extern char **environ;
+           ]GL_MDA_DEFINES],
+           [[
+            char entry1[] = "a=1";
+            char entry2[] = "b=2";
+            char *env[] = { entry1, entry2, NULL };
+            if (putenv ((char *) "a=1")) return 1;
+            if (putenv (entry2)) return 2;
+            entry2[0] = 'a';
+            unsetenv ("a");
+            if (getenv ("a")) return 3;
+            if (!unsetenv ("") || errno != EINVAL) return 4;
+            entry2[0] = 'b';
+            environ = env;
+            if (!getenv ("a")) return 5;
+            entry2[0] = 'a';
+            unsetenv ("a");
+            if (getenv ("a")) return 6;
+           ]])],
+         [gl_cv_func_unsetenv_works=yes],
+         [gl_cv_func_unsetenv_works=no],
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
+                    # If we don't know, obey --enable-cross-guesses.
+            *)      gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_unsetenv_works" in
+      *yes) ;;
+      *)
+        REPLACE_UNSETENV=1
+        ;;
+    esac
+  fi
+])
+
+# Prerequisites of lib/setenv.c.
+AC_DEFUN([gl_PREREQ_SETENV],
+[
+  AC_REQUIRE([gl_ENVIRON])
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CHECK_HEADERS([search.h])
+  gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]])
+])
+
+# Prerequisites of lib/unsetenv.c.
+AC_DEFUN([gl_PREREQ_UNSETENV],
+[
+  AC_REQUIRE([gl_ENVIRON])
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+])
deleted file mode 120000 (symlink)
index f6f03339a8e637d14a7dc098e520f58fc0195e03..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/setlocale.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ef26def43dde1fb0a5bb607bab7986dee9fa13d0
--- /dev/null
@@ -0,0 +1,88 @@
+# setlocale.m4 serial 10
+dnl Copyright (C) 2011-2024 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_SETLOCALE],
+[
+  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl Test whether we need to improve on the general working of setlocale.
+  NEED_SETLOCALE_IMPROVED=0
+  case "$host_os" in
+    dnl On native Windows systems, setlocale(category,NULL) does not look at
+    dnl the environment variables LC_ALL, category, and LANG.
+    mingw* | windows*) NEED_SETLOCALE_IMPROVED=1 ;;
+    dnl On Cygwin 1.5.x, setlocale always succeeds but setlocale(LC_CTYPE,NULL)
+    dnl is then still "C".
+    cygwin*)
+      case `uname -r` in
+        1.5.*) NEED_SETLOCALE_IMPROVED=1 ;;
+      esac
+      ;;
+    dnl On Android 4.3, setlocale(category,"C") always fails.
+    *)
+      AC_CACHE_CHECK([whether setlocale supports the C locale],
+        [gl_cv_func_setlocale_works],
+        [AC_RUN_IFELSE(
+           [AC_LANG_SOURCE([[
+#include <locale.h>
+int main ()
+{
+  return setlocale (LC_ALL, "C") == NULL;
+}]])],
+           [gl_cv_func_setlocale_works=yes],
+           [gl_cv_func_setlocale_works=no],
+           [case "$host_os" in
+                               # Guess no on Android.
+              linux*-android*) gl_cv_func_setlocale_works="guessing no";;
+                               # Guess yes otherwise.
+              *)               gl_cv_func_setlocale_works="guessing yes";;
+            esac
+           ])
+        ])
+      case "$gl_cv_func_setlocale_works" in
+        *yes) ;;
+        *) NEED_SETLOCALE_IMPROVED=1 ;;
+      esac
+      ;;
+  esac
+  AC_DEFINE_UNQUOTED([NEED_SETLOCALE_IMPROVED], [$NEED_SETLOCALE_IMPROVED],
+    [Define to 1 to enable general improvements of setlocale.])
+
+  dnl Test whether we need a multithread-safe setlocale(category,NULL).
+  NEED_SETLOCALE_MTSAFE=0
+  if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then
+    NEED_SETLOCALE_MTSAFE=1
+  fi
+  AC_DEFINE_UNQUOTED([NEED_SETLOCALE_MTSAFE], [$NEED_SETLOCALE_MTSAFE],
+    [Define to 1 to enable a multithread-safety fix of setlocale.])
+
+  if test $NEED_SETLOCALE_IMPROVED = 1 || test $NEED_SETLOCALE_MTSAFE = 1; then
+    REPLACE_SETLOCALE=1
+  fi
+
+  if test $NEED_SETLOCALE_MTSAFE = 1; then
+    SETLOCALE_LIB="$SETLOCALE_NULL_LIB"
+  else
+    SETLOCALE_LIB=
+  fi
+  dnl SETLOCALE_LIB is expected to be '-pthread' or '-lpthread' on AIX with gcc
+  dnl or xlc, and empty otherwise.
+  AC_SUBST([SETLOCALE_LIB])
+  dnl For backward compatibility.
+  LIB_SETLOCALE="$SETLOCALE_LIB"
+  AC_SUBST([LIB_SETLOCALE])
+])
+
+# Prerequisites of lib/setlocale.c.
+AC_DEFUN([gl_PREREQ_SETLOCALE],
+[
+  dnl No need to check for CFLocaleCopyPreferredLanguages and
+  dnl CFPreferencesCopyAppValue because lib/setlocale.c is not used on Mac OS X.
+  dnl (The Mac OS X specific code is only used in libintl.)
+  :
+])
deleted file mode 120000 (symlink)
index 5006c6cdeb9e388a8d3bf800239058bc00c29422..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/setlocale_null.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..54d3d46d8bd10bd8057a48983285ae65eeb5adf7
--- /dev/null
@@ -0,0 +1,117 @@
+# setlocale_null.m4 serial 9
+dnl Copyright (C) 2019-2024 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_SETLOCALE_NULL],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_PTHREADLIB])
+  AC_CHECK_HEADERS_ONCE([threads.h])
+
+  AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe],
+    [gl_cv_func_setlocale_null_all_mtsafe],
+    [case "$host_os" in
+       # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku.
+       *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku*)
+         gl_cv_func_setlocale_null_all_mtsafe=no ;;
+       # Guess no on Cygwin < 3.4.6.
+       cygwin*)
+         AC_EGREP_CPP([Lucky user],
+           [
+#if defined __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_COMBINED >= CYGWIN_VERSION_DLL_MAKE_COMBINED (3004, 6)
+  Lucky user
+ #endif
+#endif
+          ],
+          [gl_cv_func_setlocale_null_all_mtsafe=yes],
+          [gl_cv_func_setlocale_null_all_mtsafe=no])
+        ;;
+       # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows.
+       *-gnu* | gnu* | hpux* | irix* | solaris* | mingw* | windows*)
+         gl_cv_func_setlocale_null_all_mtsafe=yes ;;
+       # If we don't know, obey --enable-cross-guesses.
+       *)
+         gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;;
+     esac
+    ])
+  dnl On platforms without multithreading, there is no issue.
+  case "$host_os" in
+    mingw* | windows*) ;;
+    *)
+      if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then
+        gl_cv_func_setlocale_null_all_mtsafe="trivially yes"
+      fi
+      ;;
+  esac
+  case "$gl_cv_func_setlocale_null_all_mtsafe" in
+    *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;;
+    *)    SETLOCALE_NULL_ALL_MTSAFE=0 ;;
+  esac
+  AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ALL_MTSAFE], [$SETLOCALE_NULL_ALL_MTSAFE],
+    [Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe.])
+
+  dnl This is about a single category (not LC_ALL).
+  AC_CACHE_CHECK([whether setlocale (category, NULL) is multithread-safe],
+    [gl_cv_func_setlocale_null_one_mtsafe],
+    [case "$host_os" in
+       # Guess no on OpenBSD, AIX.
+       openbsd* | aix*)
+         gl_cv_func_setlocale_null_one_mtsafe=no ;;
+       # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows.
+       *-gnu* | gnu* | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw* | windows*)
+         gl_cv_func_setlocale_null_one_mtsafe=yes ;;
+       # If we don't know, obey --enable-cross-guesses.
+       *)
+         gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;;
+     esac
+    ])
+  dnl On platforms without multithreading, there is no issue.
+  case "$host_os" in
+    mingw* | windows*) ;;
+    *)
+      if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then
+        gl_cv_func_setlocale_null_one_mtsafe="trivially yes"
+      fi
+      ;;
+  esac
+  case "$gl_cv_func_setlocale_null_one_mtsafe" in
+    *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;;
+    *)    SETLOCALE_NULL_ONE_MTSAFE=0 ;;
+  esac
+  AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ONE_MTSAFE], [$SETLOCALE_NULL_ONE_MTSAFE],
+    [Define to 1 if setlocale (category, NULL) is multithread-safe.])
+
+  dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c.
+  if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then
+    case "$host_os" in
+      mingw* | windows*)
+        SETLOCALE_NULL_LIB=
+        ;;
+      *)
+        gl_WEAK_SYMBOLS
+        case "$gl_cv_have_weak" in
+          *yes) SETLOCALE_NULL_LIB= ;;
+          *)    SETLOCALE_NULL_LIB="$LIBPTHREAD" ;;
+        esac
+        ;;
+    esac
+  else
+    SETLOCALE_NULL_LIB=
+  fi
+  dnl SETLOCALE_NULL_LIB is expected to be '-pthread' or '-lpthread' on AIX
+  dnl with gcc or xlc, and empty otherwise.
+  AC_SUBST([SETLOCALE_NULL_LIB])
+  dnl For backward compatibility.
+  LIB_SETLOCALE_NULL="$SETLOCALE_NULL_LIB"
+  AC_SUBST([LIB_SETLOCALE_NULL])
+])
+
+# Prerequisites of lib/setlocale-lock.c.
+AC_DEFUN([gl_PREREQ_SETLOCALE_LOCK],
+[
+  gl_VISIBILITY
+])
deleted file mode 120000 (symlink)
index da0f389153d94620c8d60d8d2e0fde43d15b9b07..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/settime.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b91ea6ddb25d5c044c2c8011a8446042ce393195
--- /dev/null
@@ -0,0 +1,13 @@
+# settime.m4 serial 7
+dnl Copyright (C) 2002, 2004-2006, 2009-2024 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_SETTIME],
+[
+  dnl Prerequisites of lib/settime.c.
+  AC_REQUIRE([gl_CLOCK_TIME])
+  AC_REQUIRE([gl_TIMESPEC])
+  AC_CHECK_FUNCS_ONCE([settimeofday stime])
+])
deleted file mode 120000 (symlink)
index ef522b1f7297b150a12f363f96419f4b951509aa..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sha1.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c0a87536a5c8db56466f7a87c9f386fe9ad5095f
--- /dev/null
@@ -0,0 +1,14 @@
+# sha1.m4 serial 12
+dnl Copyright (C) 2002-2006, 2008-2024 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_SHA1],
+[
+  dnl Prerequisites of lib/sha1.c.
+  AC_REQUIRE([gl_BIGENDIAN])
+
+  dnl Determine HAVE_OPENSSL_SHA1 and LIB_CRYPTO
+  gl_CRYPTO_CHECK([SHA1])
+])
deleted file mode 120000 (symlink)
index 0caece01a0c5d66745237f2f3de1faeb7b2859e4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sha256.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2dd754c17782359dea09dd3a24c24b3a5c7a58d4
--- /dev/null
@@ -0,0 +1,14 @@
+# sha256.m4 serial 8
+dnl Copyright (C) 2005, 2008-2024 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_SHA256],
+[
+  dnl Prerequisites of lib/sha256.c.
+  AC_REQUIRE([gl_BIGENDIAN])
+
+  dnl Determine HAVE_OPENSSL_SHA256 and LIB_CRYPTO
+  gl_CRYPTO_CHECK([SHA256])
+])
deleted file mode 120000 (symlink)
index 6a6836760d6d5c48aefc2718e62f934d7349d458..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sha512.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..19d03b5027125694cfe231f1d10f8d7da031498b
--- /dev/null
@@ -0,0 +1,14 @@
+# sha512.m4 serial 9
+dnl Copyright (C) 2005-2006, 2008-2024 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_SHA512],
+[
+  dnl Prerequisites of lib/sha512.c.
+  AC_REQUIRE([gl_BIGENDIAN])
+
+  dnl Determine HAVE_OPENSSL_SHA512 and LIB_CRYPTO
+  gl_CRYPTO_CHECK([SHA512])
+])
deleted file mode 120000 (symlink)
index e76a9901a7f2015b417b2ad9e7ff3235f5fe2afc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sig2str.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ab3786b8954f01813a5b3c6a5e73bf3ae4a93cc3
--- /dev/null
@@ -0,0 +1,15 @@
+# serial 7
+dnl Copyright (C) 2002, 2005-2006, 2009-2024 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_SIG2STR],
+[
+  AC_CHECK_FUNCS([sig2str])
+])
+
+# Prerequisites of lib/sig2str.c.
+AC_DEFUN([gl_PREREQ_SIG2STR], [
+  :
+])
deleted file mode 120000 (symlink)
index 35200932130cb0ac820fc627b0d71764e896ea5a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sigaction.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..926bb9c7c5646bd13357d18b1d022932830b34f7
--- /dev/null
@@ -0,0 +1,40 @@
+# sigaction.m4 serial 7
+dnl Copyright (C) 2008-2024 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.
+
+# Determine if sigaction interface is present.
+AC_DEFUN([gl_SIGACTION],
+[
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([sigaction])
+  if test $ac_cv_func_sigaction = yes; then
+    AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , ,
+                     [[#include <signal.h>]])
+    if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then
+      HAVE_STRUCT_SIGACTION_SA_SIGACTION=0
+    fi
+  else
+    HAVE_SIGACTION=0
+  fi
+])
+
+# Prerequisites of the part of lib/signal.in.h and of lib/sigaction.c.
+AC_DEFUN([gl_PREREQ_SIGACTION],
+[
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([AC_TYPE_UID_T])
+  AC_REQUIRE([gl_PREREQ_SIG_HANDLER_H])
+  AC_CHECK_FUNCS_ONCE([sigaltstack siginterrupt])
+  AC_CHECK_TYPES([siginfo_t], [], [], [[
+#include <signal.h>
+  ]])
+  if test $ac_cv_type_siginfo_t = no; then
+    HAVE_SIGINFO_T=0
+  fi
+])
+
+# Prerequisites of lib/sig-handler.h.
+AC_DEFUN([gl_PREREQ_SIG_HANDLER_H], [:])
deleted file mode 120000 (symlink)
index e5ea19febea5e33d2a8c667d63020e5748da70ac..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/signal_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6f7dcc733b439d3509cbb94533c6dbecaae19aab
--- /dev/null
@@ -0,0 +1,100 @@
+# signal_h.m4 serial 22
+dnl Copyright (C) 2007-2024 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_ONCE([gl_SIGNAL_H],
+[
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
+  gl_NEXT_HEADERS([signal.h])
+
+# AIX declares sig_atomic_t to already include volatile, and C89 compilers
+# then choke on 'volatile sig_atomic_t'.  C99 requires that it compile.
+  AC_CHECK_TYPE([volatile sig_atomic_t], [],
+    [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
+#include <signal.h>
+    ]])
+
+  dnl Ensure the type pid_t gets defined.
+  AC_REQUIRE([AC_TYPE_PID_T])
+
+  AC_REQUIRE([AC_TYPE_UID_T])
+
+  dnl Persuade glibc <signal.h> to define sighandler_t.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[
+#include <signal.h>
+    ]])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <signal.h>
+    ]], [pthread_sigmask sigaction
+    sigaddset sigdelset sigemptyset sigfillset sigismember
+    sigpending sigprocmask])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+])
+
+AC_DEFUN([gl_CHECK_TYPE_SIGSET_T],
+[
+  AC_CHECK_TYPES([sigset_t],
+    [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no],
+    [[
+      #include <signal.h>
+      /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
+      #include <sys/types.h>
+    ]])
+  if test $gl_cv_type_sigset_t != yes; then
+    HAVE_SIGSET_T=0
+  fi
+])
+
+# gl_SIGNAL_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SIGNAL_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SIGNAL_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SIGMASK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAISE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNAL_H_SIGPIPE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGPROCMASK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGACTION])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING])
+  HAVE_PTHREAD_SIGMASK=1;      AC_SUBST([HAVE_PTHREAD_SIGMASK])
+  HAVE_RAISE=1;                AC_SUBST([HAVE_RAISE])
+  HAVE_SIGSET_T=1;             AC_SUBST([HAVE_SIGSET_T])
+  HAVE_SIGINFO_T=1;            AC_SUBST([HAVE_SIGINFO_T])
+  HAVE_SIGACTION=1;            AC_SUBST([HAVE_SIGACTION])
+  HAVE_STRUCT_SIGACTION_SA_SIGACTION=1;
+                               AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION])
+  HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1;
+                               AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
+  HAVE_SIGHANDLER_T=1;         AC_SUBST([HAVE_SIGHANDLER_T])
+  REPLACE_PTHREAD_SIGMASK=0;   AC_SUBST([REPLACE_PTHREAD_SIGMASK])
+  REPLACE_RAISE=0;             AC_SUBST([REPLACE_RAISE])
+])
deleted file mode 120000 (symlink)
index 56013b79be54e0eb8921188dd242afb9d6d745ae..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/signalblocking.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f818d5dab3d68f5f8b3abcf705128e82418dc4fe
--- /dev/null
@@ -0,0 +1,23 @@
+# signalblocking.m4 serial 17
+dnl Copyright (C) 2001-2002, 2006-2024 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.
+
+# Determine available signal blocking primitives. Three different APIs exist:
+# 1) POSIX: sigemptyset, sigaddset, sigprocmask
+# 2) SYSV: sighold, sigrelse
+# 3) BSD: sigblock, sigsetmask
+# For simplicity, here we check only for the POSIX signal blocking.
+AC_DEFUN([gl_SIGNALBLOCKING],
+[
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
+  HAVE_POSIX_SIGNALBLOCKING=0
+  if test "$gl_cv_type_sigset_t" = yes; then
+    AC_CHECK_FUNC([sigprocmask], [HAVE_POSIX_SIGNALBLOCKING=1])
+  fi
+])
+
+# Prerequisites of lib/sigprocmask.c.
+AC_DEFUN([gl_PREREQ_SIGPROCMASK], [:])
deleted file mode 120000 (symlink)
index 14b14e30546f4e996a66ae8183a7415af0f7902a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/signbit.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4acb0e98811f4eb4209de5d4e4719cc186b097d5
--- /dev/null
@@ -0,0 +1,393 @@
+# signbit.m4 serial 22
+dnl Copyright (C) 2007-2024 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_SIGNBIT],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([for signbit macro], [gl_cv_func_signbit],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <math.h>
+/* If signbit is defined as a function, don't use it, since calling it for
+   'float' or 'long double' arguments would involve conversions.
+   If signbit is not declared at all but exists as a library function, don't
+   use it, since the prototype may not match.
+   If signbit is not declared at all but exists as a compiler built-in, don't
+   use it, since it's preferable to use __builtin_signbit* (no warnings,
+   no conversions).  */
+#ifndef signbit
+# error "signbit should be a macro"
+#endif
+#include <string.h>
+]gl_SIGNBIT_TEST_PROGRAM
+])],
+        [gl_cv_func_signbit=yes],
+        [gl_cv_func_signbit=no],
+        [case "$host_os" in
+                               # Guess yes on glibc systems.
+           *-gnu* | gnu*)      gl_cv_func_signbit="guessing yes" ;;
+                               # Guess yes on musl systems.
+           *-musl* | midipix*) gl_cv_func_signbit="guessing yes" ;;
+                               # Guess yes on native Windows.
+           mingw* | windows*)  gl_cv_func_signbit="guessing yes" ;;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_signbit="$gl_cross_guess_normal" ;;
+         esac
+        ])
+    ])
+  dnl GCC >= 4.0 and clang provide three built-ins for signbit.
+  dnl They can be used without warnings, also in C++, regardless of <math.h>.
+  dnl But they may expand to calls to functions, which may or may not be in
+  dnl libc.
+  AC_CACHE_CHECK([for signbit compiler built-ins],
+    [gl_cv_func_signbit_builtins],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+# define signbit(x) \
+   (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
+    sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
+    __builtin_signbitf (x))
+#else
+# error "signbit should be three compiler built-ins"
+#endif
+#include <string.h>
+]gl_SIGNBIT_TEST_PROGRAM
+])],
+        [gl_cv_func_signbit_builtins=yes],
+        [gl_cv_func_signbit_builtins=no],
+        [case "$host_os" in
+                               # Guess yes on glibc systems.
+           *-gnu* | gnu*)      gl_cv_func_signbit_builtins="guessing yes" ;;
+                               # Guess yes on musl systems.
+           *-musl* | midipix*) gl_cv_func_signbit_builtins="guessing yes" ;;
+                               # Guess yes on mingw, no on MSVC.
+           mingw* | windows*)  if test -n "$GCC"; then
+                                 gl_cv_func_signbit_builtins="guessing yes"
+                               else
+                                 gl_cv_func_signbit_builtins="guessing no"
+                               fi
+                               ;;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_signbit_builtins="$gl_cross_guess_normal" ;;
+         esac
+        ])
+    ])
+  dnl Use the compiler built-ins whenever possible, because they are more
+  dnl efficient than the system library functions (if they exist).
+  case "$gl_cv_func_signbit_builtins" in
+    *yes)
+      REPLACE_SIGNBIT_USING_BUILTINS=1
+      ;;
+    *)
+      case "$gl_cv_func_signbit" in
+        *yes) ;;
+        *)
+          dnl REPLACE_SIGNBIT=1 makes sure the signbit[fdl] functions get built.
+          REPLACE_SIGNBIT=1
+          ;;
+      esac
+      ;;
+  esac
+  dnl On Solaris 10, with CC in C++ mode, signbit is not available although
+  dnl is with cc in C mode. This cannot be worked around by defining
+  dnl _XOPEN_SOURCE=600, because the latter does not work in C++ mode on
+  dnl Solaris 11.0. Therefore use the replacement functions on Solaris.
+  case "$host_os" in
+    solaris*)
+      REPLACE_SIGNBIT=1
+      ;;
+  esac
+  if test $REPLACE_SIGNBIT = 1; then
+    gl_FLOAT_SIGN_LOCATION
+    gl_DOUBLE_SIGN_LOCATION
+    gl_LONG_DOUBLE_SIGN_LOCATION
+    if test "$gl_cv_cc_float_signbit" = unknown; then
+      dnl Test whether copysignf() is declared.
+      AC_CHECK_DECLS([copysignf], , , [[#include <math.h>]])
+      if test "$ac_cv_have_decl_copysignf" = yes; then
+        dnl Test whether copysignf() can be used without libm.
+        AC_CACHE_CHECK([whether copysignf can be used without linking with libm],
+          [gl_cv_func_copysignf_no_libm],
+          [
+            AC_LINK_IFELSE(
+              [AC_LANG_PROGRAM(
+                 [[#include <math.h>
+                   float x, y;]],
+                 [[return copysignf (x, y) < 0;]])],
+              [gl_cv_func_copysignf_no_libm=yes],
+              [gl_cv_func_copysignf_no_libm=no])
+          ])
+        if test $gl_cv_func_copysignf_no_libm = yes; then
+          AC_DEFINE([HAVE_COPYSIGNF_IN_LIBC], [1],
+            [Define if the copysignf function is declared in <math.h> and available in libc.])
+        fi
+      fi
+    fi
+    if test "$gl_cv_cc_double_signbit" = unknown; then
+      dnl Test whether copysign() is declared.
+      AC_CHECK_DECLS([copysign], , , [[#include <math.h>]])
+      if test "$ac_cv_have_decl_copysign" = yes; then
+        dnl Test whether copysign() can be used without libm.
+        AC_CACHE_CHECK([whether copysign can be used without linking with libm],
+          [gl_cv_func_copysign_no_libm],
+          [
+            AC_LINK_IFELSE(
+              [AC_LANG_PROGRAM(
+                 [[#include <math.h>
+                   double x, y;]],
+                 [[return copysign (x, y) < 0;]])],
+              [gl_cv_func_copysign_no_libm=yes],
+              [gl_cv_func_copysign_no_libm=no])
+          ])
+        if test $gl_cv_func_copysign_no_libm = yes; then
+          AC_DEFINE([HAVE_COPYSIGN_IN_LIBC], [1],
+            [Define if the copysign function is declared in <math.h> and available in libc.])
+        fi
+      fi
+    fi
+    if test "$gl_cv_cc_long_double_signbit" = unknown; then
+      dnl Test whether copysignl() is declared.
+      AC_CHECK_DECLS([copysignl], , , [[#include <math.h>]])
+      if test "$ac_cv_have_decl_copysignl" = yes; then
+        dnl Test whether copysignl() can be used without libm.
+        AC_CACHE_CHECK([whether copysignl can be used without linking with libm],
+          [gl_cv_func_copysignl_no_libm],
+          [
+            AC_LINK_IFELSE(
+              [AC_LANG_PROGRAM(
+                 [[#include <math.h>
+                   long double x, y;]],
+                 [[return copysignl (x, y) < 0;]])],
+              [gl_cv_func_copysignl_no_libm=yes],
+              [gl_cv_func_copysignl_no_libm=no])
+          ])
+        if test $gl_cv_func_copysignl_no_libm = yes; then
+          AC_DEFINE([HAVE_COPYSIGNL_IN_LIBC], [1],
+            [Define if the copysignl function is declared in <math.h> and available in libc.])
+        fi
+      fi
+    fi
+  fi
+])
+
+AC_DEFUN([gl_SIGNBIT_TEST_PROGRAM], [[
+/* Global variables.
+   Needed because GCC 4 constant-folds __builtin_signbitl (literal)
+   but cannot constant-fold            __builtin_signbitl (variable).  */
+float vf;
+double vd;
+long double vl;
+int main ()
+{
+/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
+   So we use -p0f and -p0d instead.  */
+float p0f = 0.0f;
+float m0f = -p0f;
+double p0d = 0.0;
+double m0d = -p0d;
+/* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
+   So we use another constant expression instead.
+   But that expression does not work on other platforms, such as when
+   cross-compiling to PowerPC on Mac OS X 10.5.  */
+long double p0l = 0.0L;
+#if defined __hpux || defined __sgi
+long double m0l = -LDBL_MIN * LDBL_MIN;
+#else
+long double m0l = -p0l;
+#endif
+  int result = 0;
+  if (signbit (vf)) /* link check */
+    vf++;
+  {
+    float plus_inf = 1.0f / p0f;
+    float minus_inf = -1.0f / p0f;
+    if (!(!signbit (255.0f)
+          && signbit (-255.0f)
+          && !signbit (p0f)
+          && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f))
+          && !signbit (plus_inf)
+          && signbit (minus_inf)))
+      result |= 1;
+  }
+  if (signbit (vd)) /* link check */
+    vd++;
+  {
+    double plus_inf = 1.0 / p0d;
+    double minus_inf = -1.0 / p0d;
+    if (!(!signbit (255.0)
+          && signbit (-255.0)
+          && !signbit (p0d)
+          && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d))
+          && !signbit (plus_inf)
+          && signbit (minus_inf)))
+      result |= 2;
+  }
+  if (signbit (vl)) /* link check */
+    vl++;
+  {
+    long double plus_inf = 1.0L / p0l;
+    long double minus_inf = -1.0L / p0l;
+    if (signbit (255.0L))
+      result |= 4;
+    if (!signbit (-255.0L))
+      result |= 4;
+    if (signbit (p0l))
+      result |= 8;
+    if (!(memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l)))
+      result |= 16;
+    if (signbit (plus_inf))
+      result |= 32;
+    if (!signbit (minus_inf))
+      result |= 64;
+  }
+  return result;
+}
+]])
+
+AC_DEFUN([gl_FLOAT_SIGN_LOCATION],
+[
+  gl_FLOATTYPE_SIGN_LOCATION([float], [gl_cv_cc_float_signbit], [f], [FLT])
+])
+
+AC_DEFUN([gl_DOUBLE_SIGN_LOCATION],
+[
+  gl_FLOATTYPE_SIGN_LOCATION([double], [gl_cv_cc_double_signbit], [], [DBL])
+])
+
+AC_DEFUN([gl_LONG_DOUBLE_SIGN_LOCATION],
+[
+  gl_FLOATTYPE_SIGN_LOCATION([long double], [gl_cv_cc_long_double_signbit], [L], [LDBL])
+])
+
+AC_DEFUN([gl_FLOATTYPE_SIGN_LOCATION],
+[
+  AC_CACHE_CHECK([where to find the sign bit in a '$1'],
+    [$2],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stddef.h>
+#include <stdio.h>
+#define NWORDS \
+  ((sizeof ($1) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { $1 value; unsigned int word[NWORDS]; }
+        memory_float;
+static memory_float plus = { 1.0$3 };
+static memory_float minus = { -1.0$3 };
+int main ()
+{
+  size_t j, k, i;
+  unsigned int m;
+  FILE *fp = fopen ("conftest.out", "w");
+  if (fp == NULL)
+    return 1;
+  /* Find the different bit.  */
+  k = 0; m = 0;
+  for (j = 0; j < NWORDS; j++)
+    {
+      unsigned int x = plus.word[j] ^ minus.word[j];
+      if ((x & (x - 1)) || (x && m))
+        {
+          /* More than one bit difference.  */
+          fprintf (fp, "unknown");
+          fclose (fp);
+          return 2;
+        }
+      if (x)
+        {
+          k = j;
+          m = x;
+        }
+    }
+  if (m == 0)
+    {
+      /* No difference.  */
+      fprintf (fp, "unknown");
+      fclose (fp);
+      return 3;
+    }
+  /* Now m = plus.word[k] ^ ~minus.word[k].  */
+  if (plus.word[k] & ~minus.word[k])
+    {
+      /* Oh? The sign bit is set in the positive and cleared in the negative
+         numbers?  */
+      fprintf (fp, "unknown");
+      fclose (fp);
+      return 4;
+    }
+  for (i = 0; ; i++)
+    if ((m >> i) & 1)
+      break;
+  fprintf (fp, "word %d bit %d", (int) k, (int) i);
+  if (fclose (fp) != 0)
+    return 5;
+  return 0;
+}
+        ]])],
+        [$2=`cat conftest.out`],
+        [$2="unknown"],
+        [
+          dnl When cross-compiling, we don't know. It depends on the
+          dnl ABI and compiler version. There are too many cases.
+          $2="unknown"
+        ])
+      rm -f conftest.out
+    ])
+  case "$]$2[" in
+    word*bit*)
+      word=`echo "$]$2[" | sed -e 's/word //' -e 's/ bit.*//'`
+      bit=`echo "$]$2[" | sed -e 's/word.*bit //'`
+      AC_DEFINE_UNQUOTED([$4][_SIGNBIT_WORD], [$word],
+        [Define as the word index where to find the sign of '$1'.])
+      AC_DEFINE_UNQUOTED([$4][_SIGNBIT_BIT], [$bit],
+        [Define as the bit index in the word where to find the sign of '$1'.])
+      ;;
+  esac
+])
+
+# Expands to code that defines a function signbitf(float).
+# It extracts the sign bit of a non-NaN value.
+AC_DEFUN([gl_FLOAT_SIGNBIT_CODE],
+[
+  gl_FLOATTYPE_SIGNBIT_CODE([float], [f], [f])
+])
+
+# Expands to code that defines a function signbitd(double).
+# It extracts the sign bit of a non-NaN value.
+AC_DEFUN([gl_DOUBLE_SIGNBIT_CODE],
+[
+  gl_FLOATTYPE_SIGNBIT_CODE([double], [d], [])
+])
+
+# Expands to code that defines a function signbitl(long double).
+# It extracts the sign bit of a non-NaN value.
+AC_DEFUN([gl_LONG_DOUBLE_SIGNBIT_CODE],
+[
+  gl_FLOATTYPE_SIGNBIT_CODE([long double], [l], [L])
+])
+
+AC_DEFUN([gl_FLOATTYPE_SIGNBIT_CODE],
+[[
+static int
+signbit$2 ($1 value)
+{
+  typedef union { $1 f; unsigned char b[sizeof ($1)]; } float_union;
+  static float_union plus_one = { 1.0$3 };   /* unused bits are zero here */
+  static float_union minus_one = { -1.0$3 }; /* unused bits are zero here */
+  /* Compute the sign bit mask as the XOR of plus_one and minus_one.  */
+  float_union u;
+  unsigned int i;
+  u.f = value;
+  for (i = 0; i < sizeof ($1); i++)
+    if (u.b[i] & (plus_one.b[i] ^ minus_one.b[i]))
+      return 1;
+  return 0;
+}
+]])
deleted file mode 120000 (symlink)
index b9bad3668274dfac1486c562ad12377ffff13667..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/size_max.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b3f7624ff356ab7385f0a2f29b3af1358b120777
--- /dev/null
@@ -0,0 +1,75 @@
+# size_max.m4 serial 12
+dnl Copyright (C) 2003, 2005-2006, 2008-2024 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 Bruno Haible.
+
+AC_PREREQ([2.61])
+
+AC_DEFUN([gl_SIZE_MAX],
+[
+  AC_CHECK_HEADERS([stdint.h])
+  dnl First test whether the system already has SIZE_MAX.
+  AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [
+    gl_cv_size_max=no
+    AC_EGREP_CPP([Found it], [
+#include <limits.h>
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef SIZE_MAX
+Found it
+#endif
+], [gl_cv_size_max=yes])
+    if test $gl_cv_size_max != yes; then
+      dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
+      dnl than the type 'unsigned long'. Try hard to find a definition that can
+      dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
+      AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1],
+        [#include <stddef.h>
+#include <limits.h>], [size_t_bits_minus_1=])
+      AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)],
+        [#include <stddef.h>], [fits_in_uint=])
+      if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
+        if test $fits_in_uint = 1; then
+          dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
+          dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
+          AC_COMPILE_IFELSE(
+            [AC_LANG_PROGRAM(
+               [[#include <stddef.h>
+                 extern size_t foo;
+                 extern unsigned long foo;
+               ]],
+               [[]])],
+            [fits_in_uint=0])
+        fi
+        dnl We cannot use 'expr' to simplify this expression, because 'expr'
+        dnl works only with 'long' integers in the host environment, while we
+        dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
+        if test $fits_in_uint = 1; then
+          gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
+        else
+          gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
+        fi
+      else
+        dnl Shouldn't happen, but who knows...
+        gl_cv_size_max='((size_t)~(size_t)0)'
+      fi
+    fi
+  ])
+  if test "$gl_cv_size_max" != yes; then
+    AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
+      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
+  fi
+  dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after
+  dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with
+  dnl #define by AC_DEFINE_UNQUOTED.
+  AH_VERBATIM([SIZE_MAX],
+[/* Define as the maximum value of type 'size_t', if the system doesn't define
+   it. */
+#ifndef SIZE_MAX
+# undef SIZE_MAX
+#endif])
+])
deleted file mode 120000 (symlink)
index b622d770d8e676b66c40ea8a4fc26dadbb268745..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sleep.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2003698c9ca6c89a4ba7ee048403f8662c5371ba
--- /dev/null
@@ -0,0 +1,68 @@
+# sleep.m4 serial 13
+dnl Copyright (C) 2007-2024 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_SLEEP],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  dnl We expect to see the declaration of sleep() in a header file.
+  dnl Older versions of mingw have a sleep() function that is an alias to
+  dnl _sleep() in MSVCRT. It has a different signature than POSIX sleep():
+  dnl it takes the number of milliseconds as argument and returns void.
+  dnl mingw does not declare this function.
+  AC_CHECK_DECLS([sleep], , , [[#include <unistd.h>]])
+  AC_CHECK_FUNCS_ONCE([sleep])
+  if test $ac_cv_have_decl_sleep != yes; then
+    HAVE_SLEEP=0
+  else
+    dnl Cygwin 1.5.x has a bug where sleep can't exceed 49.7 days.
+    AC_CACHE_CHECK([for working sleep], [gl_cv_func_sleep_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <errno.h>
+#include <unistd.h>
+#include <signal.h>
+static void
+handle_alarm (int sig)
+{
+  if (sig != SIGALRM)
+    _exit (2);
+}
+]], [[
+    /* Failure to compile this test due to missing alarm is okay,
+       since all such platforms (mingw) also lack sleep.  */
+    unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days.  */
+    unsigned int remaining;
+    signal (SIGALRM, handle_alarm);
+    alarm (1);
+    remaining = sleep (pentecost);
+    if (remaining > pentecost)
+      return 3;
+    if (remaining <= pentecost - 10)
+      return 4;
+    return 0;
+    ]])],
+      [gl_cv_func_sleep_works=yes], [gl_cv_func_sleep_works=no],
+      [case "$host_os" in
+                            # Guess yes on glibc systems.
+         *-gnu* | gnu*)     gl_cv_func_sleep_works="guessing yes" ;;
+                            # Guess yes on musl systems.
+         *-musl*)           gl_cv_func_sleep_works="guessing yes" ;;
+                            # Guess yes on systems that emulate the Linux system calls.
+         midipix*)          gl_cv_func_sleep_works="guessing yes" ;;
+                            # Guess no on native Windows.
+         mingw* | windows*) gl_cv_func_sleep_works="guessing no" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+         *)                 gl_cv_func_sleep_works="$gl_cross_guess_normal" ;;
+       esac
+      ])])
+    case "$gl_cv_func_sleep_works" in
+      *yes) ;;
+      *)
+        REPLACE_SLEEP=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 1ca24df0a556f56b17f6e04e6bdcaeab2a20409e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sm3.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fc6ced62b3a7d98b58828b5c31a94e7e92f7e3d7
--- /dev/null
@@ -0,0 +1,18 @@
+# sm3.m4 serial 2
+dnl Copyright (C) 2017-2024 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_SM3],
+[
+  dnl Prerequisites of lib/sm3.h.
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  dnl Prerequisites of lib/sm3.c.
+  AC_REQUIRE([gl_BIGENDIAN])
+
+  dnl Currently openssl still doesn't support sm3.
+  m4_divert_once([DEFAULTS], [LIB_CRYPTO=])
+  AC_SUBST([LIB_CRYPTO])
+])
deleted file mode 120000 (symlink)
index 2fac77e587b736471df794ab4f01bb9827340256..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/snan.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6a0a7453fff019294b6bade809ddd3b9e4f2b2ff
--- /dev/null
@@ -0,0 +1,14 @@
+# snan.m4 serial 3
+dnl Copyright (C) 2023-2024 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.
+
+# Prerequisites for lib/snan.h.
+AC_DEFUN_ONCE([gl_SNAN],
+[
+  gl_FLOAT_EXPONENT_LOCATION
+  gl_DOUBLE_EXPONENT_LOCATION
+  gl_LONG_DOUBLE_EXPONENT_LOCATION
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+])
deleted file mode 120000 (symlink)
index 88088006f5895304ec784f2fb137b2982cb6add4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/snprintf.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..96f9c4e4a332a90a130f6d75a6833a769592a814
--- /dev/null
@@ -0,0 +1,62 @@
+# snprintf.m4 serial 7
+dnl Copyright (C) 2002-2004, 2007-2024 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 Libintl 0.17 will replace snprintf only if it does not support %1$s,
+dnl but defers to any gnulib snprintf replacements.  Therefore, gnulib
+dnl must guarantee that the decision for replacing snprintf is a superset
+dnl of the reasons checked by libintl.
+AC_DEFUN([gl_FUNC_SNPRINTF],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  gl_cv_func_snprintf_usable=no
+  AC_CHECK_FUNCS([snprintf])
+  if test $ac_cv_func_snprintf = yes; then
+    gl_SNPRINTF_SIZE1
+    case "$gl_cv_func_snprintf_size1" in
+      *yes)
+        gl_SNPRINTF_RETVAL_C99
+        case "$gl_cv_func_snprintf_retval_c99" in
+          *yes)
+            gl_PRINTF_POSITIONS
+            case "$gl_cv_func_printf_positions" in
+              *yes)
+                gl_cv_func_snprintf_usable=yes
+                ;;
+            esac
+            ;;
+        esac
+        ;;
+    esac
+  fi
+  if test $gl_cv_func_snprintf_usable = no; then
+    gl_REPLACE_SNPRINTF
+  fi
+  AC_CHECK_DECLS_ONCE([snprintf])
+  if test $ac_cv_have_decl_snprintf = no; then
+    HAVE_DECL_SNPRINTF=0
+  fi
+])
+
+AC_DEFUN([gl_REPLACE_SNPRINTF],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_LIBOBJ([snprintf])
+  if test $ac_cv_func_snprintf = yes; then
+    REPLACE_SNPRINTF=1
+  else
+    AC_CHECK_DECLS_ONCE([snprintf])
+    if test $ac_cv_have_decl_snprintf = yes; then
+      dnl If the function is declared but does not appear to exist, it may be
+      dnl defined as an inline function. In order to avoid a conflict, we have
+      dnl to define rpl_snprintf, not snprintf.
+      REPLACE_SNPRINTF=1
+    fi
+  fi
+  gl_PREREQ_SNPRINTF
+])
+
+# Prerequisites of lib/snprintf.c.
+AC_DEFUN([gl_PREREQ_SNPRINTF], [:])
deleted file mode 120000 (symlink)
index 851ea77d54a1f46dca87cef7e1b608048ca1ec38..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/socketlib.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5ecb34d34ef0d0a0940275d6353aef5735d94810
--- /dev/null
@@ -0,0 +1,96 @@
+# socketlib.m4 serial 3
+dnl Copyright (C) 2008-2024 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 gl_SOCKETLIB
+dnl Determines the library to use for socket functions.
+dnl Sets and AC_SUBSTs LIBSOCKET.
+
+AC_DEFUN([gl_SOCKETLIB],
+[
+  gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
+  LIBSOCKET=
+  if test $HAVE_WINSOCK2_H = 1; then
+    dnl Native Windows API (not Cygwin).
+    dnl If the function WSAStartup exists (declared in <winsock2.h> and
+    dnl defined through -lws2_32), we need to call it.
+    AC_CACHE_CHECK([for WSAStartup],
+      [gl_cv_func_wsastartup], [
+       gl_save_LIBS="$LIBS"
+       LIBS="$LIBS -lws2_32"
+       AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM([[
+#ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif]], [[
+            WORD wVersionRequested = MAKEWORD(1, 1);
+            WSADATA wsaData;
+            int err = WSAStartup(wVersionRequested, &wsaData);
+            WSACleanup ();
+            ]])
+         ],
+         [gl_cv_func_wsastartup=yes],
+         [gl_cv_func_wsastartup=no])
+       LIBS="$gl_save_LIBS"
+      ])
+    if test "$gl_cv_func_wsastartup" = "yes"; then
+      AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
+      LIBSOCKET='-lws2_32'
+    fi
+  else
+    dnl Unix API.
+    dnl Solaris has most socket functions in libsocket.
+    dnl Haiku has most socket functions in libnetwork.
+    dnl BeOS has most socket functions in libnet.
+    dnl On HP-UX, do NOT link with libxnet, because in 64-bit mode this would
+    dnl break code (e.g. in libraries) that invokes accept(), getpeername(),
+    dnl getsockname(), getsockopt(), or recvfrom() with a 32-bit addrlen. See
+    dnl "man xopen_networking" for details.
+    AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
+      gl_cv_lib_socket=
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+        [],
+        [gl_save_LIBS="$LIBS"
+         LIBS="$gl_save_LIBS -lsocket"
+         AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+           [gl_cv_lib_socket="-lsocket"])
+         if test -z "$gl_cv_lib_socket"; then
+           LIBS="$gl_save_LIBS -lnetwork"
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+             [gl_cv_lib_socket="-lnetwork"])
+           if test -z "$gl_cv_lib_socket"; then
+             LIBS="$gl_save_LIBS -lnet"
+             AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+               [gl_cv_lib_socket="-lnet"])
+           fi
+         fi
+         LIBS="$gl_save_LIBS"
+        ])
+      if test -z "$gl_cv_lib_socket"; then
+        gl_cv_lib_socket="none needed"
+      fi
+    ])
+    if test "$gl_cv_lib_socket" != "none needed"; then
+      LIBSOCKET="$gl_cv_lib_socket"
+    fi
+  fi
+  AC_SUBST([LIBSOCKET])
+])
deleted file mode 120000 (symlink)
index 071b9b1c46356ce7c95dccf77b0f48a218b9d5a1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sockets.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7be4dc965936f6c94ff50dd815c0c2c86113c8ef
--- /dev/null
@@ -0,0 +1,17 @@
+# sockets.m4 serial 7
+dnl Copyright (C) 2008-2024 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_SOCKETS],
+[
+  AC_REQUIRE([AC_C_INLINE])
+  AC_REQUIRE([gl_SOCKETLIB])
+  gl_PREREQ_SOCKETS
+])
+
+# Prerequisites of lib/sockets.c.
+AC_DEFUN([gl_PREREQ_SOCKETS], [
+  :
+])
deleted file mode 120000 (symlink)
index 3f27d6a55468d4523c5a4b1e77bfc75aea1bb8d8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/socklen.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9c46db1893784e747dbf4764968492fb0bedeb9d
--- /dev/null
@@ -0,0 +1,76 @@
+# socklen.m4 serial 11
+dnl Copyright (C) 2005-2007, 2009-2024 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 Albert Chin, Windows fixes from Simon Josefsson.
+
+dnl Check for socklen_t: historically on BSD it is an int, and in
+dnl POSIX 1g it is a type of its own, but some platforms use different
+dnl types for the argument to getsockopt, getpeername, etc.:
+dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS.
+dnl So we have to test to find something that will work.
+
+AC_DEFUN([gl_TYPE_SOCKLEN_T],
+  [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl
+   AC_CHECK_TYPE([socklen_t], ,
+     [AC_CACHE_CHECK([for socklen_t equivalent],
+        [gl_cv_socklen_t_equiv],
+        [# Systems have either "struct sockaddr *" or
+         # "void *" as the second argument to getpeername
+         gl_cv_socklen_t_equiv=
+         for arg2 in "struct sockaddr" void; do
+           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
+             AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+                 [[#include <sys/types.h>
+                   #include <sys/socket.h>
+
+                   int getpeername (int, $arg2 *, $t *);]],
+                 [[$t len;
+                  getpeername (0, 0, &len);]])],
+               [gl_cv_socklen_t_equiv="$t"])
+             test "$gl_cv_socklen_t_equiv" != "" && break
+           done
+           test "$gl_cv_socklen_t_equiv" != "" && break
+         done
+         if test "$gl_cv_socklen_t_equiv" = ""; then
+           AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+         fi
+        ])
+      AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
+        [type to use in place of socklen_t if not defined])],
+     [gl_SOCKET_HEADERS])])
+
+dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
+dnl it there too.  But on Cygwin, wc2tcpip.h must not be included.  Users
+dnl of this module should use the same include pattern as gl_SOCKET_HEADERS.
+dnl When you change this macro, keep also in sync:
+dnl   - gl_CHECK_SOCKET_HEADERS,
+dnl   - the Include section of modules/socklen.
+AC_DEFUN([gl_SOCKET_HEADERS],
+[
+/* <sys/types.h> is not needed according to POSIX, but the
+   <sys/socket.h> in i386-unknown-freebsd4.10 and
+   powerpc-apple-darwin5.5 required it. */
+#include <sys/types.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#elif HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
+])
+
+dnl Tests for the existence of the header for socket facilities.
+dnl Defines the C macros HAVE_SYS_SOCKET_H, HAVE_WS2TCPIP_H.
+dnl This macro must match gl_SOCKET_HEADERS.
+AC_DEFUN([gl_CHECK_SOCKET_HEADERS],
+  [AC_CHECK_HEADERS_ONCE([sys/socket.h])
+   if test $ac_cv_header_sys_socket_h = no; then
+     dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
+     dnl the check for those headers unconditional; yet cygwin reports
+     dnl that the headers are present but cannot be compiled (since on
+     dnl cygwin, all socket information should come from sys/socket.h).
+     AC_CHECK_HEADERS([ws2tcpip.h])
+   fi
+  ])
deleted file mode 120000 (symlink)
index ebd9ae9507e96ed4facdcdbdfb0deb01c9a14e9f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sockpfaf.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..390abfe2c4d8cc2c8597d605dd8d607a689cfd08
--- /dev/null
@@ -0,0 +1,84 @@
+# sockpfaf.m4 serial 10
+dnl Copyright (C) 2004, 2006, 2009-2024 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 Test for some common socket protocol families (PF_INET, PF_INET6, ...)
+dnl and some common address families (AF_INET, AF_INET6, ...).
+dnl This test assumes that a system supports an address family if and only if
+dnl it supports the corresponding protocol family.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gl_SOCKET_FAMILIES],
+[
+  AC_REQUIRE([gl_SYS_SOCKET_H])
+  AC_CHECK_HEADERS_ONCE([netinet/in.h])
+
+  AC_CACHE_CHECK([for IPv4 sockets],
+    [gl_cv_socket_ipv4],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif]],
+[[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
+ if (&x && &y && &z) return 0;]])],
+       gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
+  if test $gl_cv_socket_ipv4 = yes; then
+    AC_DEFINE([HAVE_IPV4], [1], [Define to 1 if <sys/socket.h> defines AF_INET.])
+  fi
+
+  AC_CACHE_CHECK([for IPv6 sockets],
+    [gl_cv_socket_ipv6],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif]],
+[[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
+ if (&x && &y && &z) return 0;]])],
+       gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
+  if test $gl_cv_socket_ipv6 = yes; then
+    AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.])
+  fi
+])
+
+AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
+[
+  AC_REQUIRE([gl_SYS_SOCKET_H])
+  AC_CHECK_HEADERS_ONCE([sys/un.h])
+
+  AC_CACHE_CHECK([for UNIX domain sockets],
+    [gl_cv_socket_unix],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif]],
+[[int x = AF_UNIX; struct sockaddr_un y;
+ if (&x && &y) return 0;]])],
+       gl_cv_socket_unix=yes, gl_cv_socket_unix=no)])
+  if test $gl_cv_socket_unix = yes; then
+    AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.])
+  fi
+])
deleted file mode 120000 (symlink)
index 0187c19a35907988205d16fbe31f0deb326775d4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/ssize_t.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..25b28d77e4ef05fb0b2938817f1fa0e349d7efab
--- /dev/null
@@ -0,0 +1,37 @@
+# ssize_t.m4 serial 6
+dnl Copyright (C) 2001-2003, 2006, 2010-2024 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 Bruno Haible.
+dnl Define ssize_t if it does not already exist.
+
+AC_DEFUN([gt_TYPE_SSIZE_T],
+[
+  AC_CACHE_CHECK([for ssize_t], [gl_cv_ssize_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <sys/types.h>]],
+          [[int x = sizeof (ssize_t *) + sizeof (ssize_t);
+            return !x;]])],
+       [gl_cv_ssize_t=yes], [gl_cv_ssize_t=no])])
+  if test $gl_cv_ssize_t = no; then
+    dnl On 64-bit native Windows, ssize_t needs to be defined as 'long long',
+    dnl for consistency with the 64-bit size_t.
+    AC_CACHE_CHECK([whether size_t is wider than 'long'], [gl_cv_size_t_large],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <sys/types.h>
+              typedef int array [2 * (sizeof (size_t) > sizeof (long)) - 1];
+            ]])],
+         [gl_cv_size_t_large=yes], [gl_cv_size_t_large=no])])
+    if test $gl_cv_size_t_large = yes; then
+      gl_def_ssize_t='long long'
+    else
+      gl_def_ssize_t='long'
+    fi
+    AC_DEFINE_UNQUOTED([ssize_t], [$gl_def_ssize_t],
+                       [Define as a signed type of the same size as size_t.])
+  fi
+])
deleted file mode 120000 (symlink)
index 296de9568a87069406adccb6c7ce1cedc0c5baa0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stat-size.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..334f6e9a81152b3b692d777b2899da420cb91171
--- /dev/null
@@ -0,0 +1,14 @@
+#serial 1
+
+# Copyright (C) 2011-2024 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_STAT_SIZE],
+[
+  # Don't call AC_STRUCT_ST_BLOCKS because it causes bugs.  Details at
+  # https://lists.gnu.org/r/bug-gnulib/2011-06/msg00051.html
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
+])
deleted file mode 120000 (symlink)
index ab89ee031501b2bd7a41a2095ccf1c83dd5686b5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stat-time.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..8bec2f5f8152a5a6b4f766168c6c2fca5e48629c
--- /dev/null
@@ -0,0 +1,83 @@
+# Checks for stat-related time functions.
+
+# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2024 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 Paul Eggert.
+
+# st_atim.tv_nsec - Linux, Solaris, Cygwin
+# st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE
+# st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE
+# st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1)
+
+# st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway)
+# st_birthtim - Cygwin 1.7.0+
+
+AC_DEFUN([gl_STAT_TIME],
+[
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
+
+  AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
+    [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
+       [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
+       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+          [[
+            #include <sys/types.h>
+            #include <sys/stat.h>
+            #if HAVE_SYS_TIME_H
+            # include <sys/time.h>
+            #endif
+            #include <time.h>
+            struct timespec ts;
+            struct stat st;
+          ]],
+          [[
+            st.st_atim = ts;
+          ]])],
+          [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
+          [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
+     if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
+       AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1],
+         [Define to 1 if the type of the st_atim member of a struct stat is
+          struct timespec.])
+     fi],
+    [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
+       [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
+          [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [],
+             [#include <sys/types.h>
+              #include <sys/stat.h>])],
+          [#include <sys/types.h>
+           #include <sys/stat.h>])],
+       [#include <sys/types.h>
+        #include <sys/stat.h>])],
+    [#include <sys/types.h>
+     #include <sys/stat.h>])
+])
+
+# Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.)
+# and NTFS (Cygwin).
+# There was a time when this field was named st_createtime (21 June
+# 2002 to 16 July 2002) But that window is very small and applied only
+# to development code, so systems still using that configuration are
+# not supported.  See revisions 1.10 and 1.11 of FreeBSD's
+# src/sys/ufs/ufs/dinode.h.
+#
+AC_DEFUN([gl_STAT_BIRTHTIME],
+[
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
+  AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [],
+    [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [],
+      [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [],
+         [#include <sys/types.h>
+          #include <sys/stat.h>])],
+       [#include <sys/types.h>
+        #include <sys/stat.h>])],
+    [#include <sys/types.h>
+     #include <sys/stat.h>])
+])
deleted file mode 120000 (symlink)
index 83b4f45719c1e5a28402090c8f7e2d06a3c79963..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1d2a9e2ca2ee6caa192086fe20dc133429ea77d4
--- /dev/null
@@ -0,0 +1,87 @@
+# serial 21
+
+# Copyright (C) 2009-2024 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_FUNC_STAT],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([lstat])
+  case "$host_os" in
+    mingw* | windows*)
+      dnl On this platform, the original stat() returns st_atime, st_mtime,
+      dnl st_ctime values that are affected by the time zone.
+      REPLACE_STAT=1
+      ;;
+    *)
+      dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
+      dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
+      dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
+      AC_CACHE_CHECK([whether stat handles trailing slashes on files],
+        [gl_cv_func_stat_file_slash],
+        [touch conftest.tmp
+         # Assume that if we have lstat, we can also check symlinks.
+         if test $ac_cv_func_lstat = yes; then
+           ln -s conftest.tmp conftest.lnk
+         fi
+         AC_RUN_IFELSE(
+           [AC_LANG_PROGRAM(
+             [[#include <sys/stat.h>
+]], [[int result = 0;
+               struct stat st;
+               if (!stat ("conftest.tmp/", &st))
+                 result |= 1;
+#if HAVE_LSTAT
+               if (!stat ("conftest.lnk/", &st))
+                 result |= 2;
+#endif
+               return result;
+             ]])],
+           [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
+           [case "$host_os" in
+                               # Guess yes on Linux systems.
+              linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;;
+                               # Guess yes on systems that emulate the Linux system calls.
+              midipix*)        gl_cv_func_stat_file_slash="guessing yes" ;;
+                               # Guess yes on glibc systems.
+              *-gnu* | gnu*)   gl_cv_func_stat_file_slash="guessing yes" ;;
+                               # If we don't know, obey --enable-cross-guesses.
+              *)               gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;;
+            esac
+           ])
+         rm -f conftest.tmp conftest.lnk])
+      case $gl_cv_func_stat_file_slash in
+        *no)
+          REPLACE_STAT=1
+          AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
+            help when passed a file name with a trailing slash]);;
+      esac
+      case $host_os in
+        dnl macOS and Solaris stat can return a negative tv_nsec.
+        darwin* | solaris*)
+          REPLACE_FSTAT=1 ;;
+      esac
+      ;;
+  esac
+])
+
+# Prerequisites of lib/stat.c and lib/stat-w32.c.
+AC_DEFUN([gl_PREREQ_STAT], [
+  AC_REQUIRE([gl_SYS_STAT_H])
+  AC_REQUIRE([gl_PREREQ_STAT_W32])
+  :
+])
+
+# Prerequisites of lib/stat-w32.c.
+AC_DEFUN([gl_PREREQ_STAT_W32], [
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw* | windows*)
+      AC_CHECK_HEADERS([sdkddkver.h])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 32848ddb11199bf2dd0b16bda657ca8a0173267a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/std-gnu11.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..59998c17cf75690ffdb3dfc04dcdeb8ee137ee57
--- /dev/null
@@ -0,0 +1,829 @@
+# Prefer GNU C11 and C++11 to earlier versions.  -*- coding: utf-8 -*-
+
+# This implementation is taken from GNU Autoconf lib/autoconf/c.m4
+# commit 017d5ddd82854911f0119691d91ea8a1438824d6
+# dated Sun Apr 3 13:57:17 2016 -0700
+# This implementation will be obsolete once we can assume Autoconf 2.70
+# or later is installed everywhere a Gnulib program might be developed.
+
+m4_version_prereq([2.70], [], [
+
+
+# Copyright (C) 2001-2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Written by David MacKenzie, with help from
+# Akim Demaille, Paul Eggert,
+# François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
+# Roland McGrath, Noah Friedman, david d zuhn, and many others.
+
+
+# AC_PROG_CC([COMPILER ...])
+# --------------------------
+# COMPILER ... is a space separated list of C compilers to search for.
+# This just gives the user an opportunity to specify an alternative
+# search list for the C compiler.
+AC_DEFUN_ONCE([AC_PROG_CC],
+[AC_LANG_PUSH(C)dnl
+AC_ARG_VAR([CC],     [C compiler command])dnl
+AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+_AC_ARG_VAR_LIBS()dnl
+_AC_ARG_VAR_CPPFLAGS()dnl
+m4_ifval([$1],
+      [AC_CHECK_TOOLS(CC, [$1])],
+[AC_CHECK_TOOL(CC, gcc)
+if test -z "$CC"; then
+  dnl Here we want:
+  dnl  AC_CHECK_TOOL(CC, cc)
+  dnl but without the check for a tool without the prefix.
+  dnl Until the check is removed from there, copy the code:
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc])
+  fi
+fi
+if test -z "$CC"; then
+  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+fi
+if test -z "$CC"; then
+  AC_CHECK_TOOLS(CC, cl.exe)
+fi
+if test -z "$CC"; then
+  AC_CHECK_TOOL(CC, clang)
+fi
+])
+
+test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
+
+# Provide some information about the compiler.
+_AS_ECHO_LOG([checking for _AC_LANG compiler version])
+set X $ac_compile
+ac_compiler=$[2]
+for ac_option in --version -v -V -qversion -version; do
+  _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
+done
+
+m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
+_AC_LANG_COMPILER_GNU
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+_AC_PROG_CC_G
+dnl
+dnl Set ac_prog_cc_stdc to the supported C version.
+dnl Also set the documented variable ac_cv_prog_cc_stdc;
+dnl its name was chosen when it was cached, but it is no longer cached.
+_AC_PROG_CC_C11([ac_prog_cc_stdc=c11
+                ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11],
+  [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99
+                   ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],
+     [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89
+                      ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],
+                     [ac_prog_cc_stdc=no
+                      ac_cv_prog_cc_stdc=no])])])
+dnl
+AC_LANG_POP(C)dnl
+])# AC_PROG_CC
+
+
+
+# AC_PROG_CXX([LIST-OF-COMPILERS])
+# --------------------------------
+# LIST-OF-COMPILERS is a space separated list of C++ compilers to search
+# for (if not specified, a default list is used).  This just gives the
+# user an opportunity to specify an alternative search list for the C++
+# compiler.
+# aCC  HP-UX C++ compiler much better than `CC', so test before.
+# FCC   Fujitsu C++ compiler
+# KCC  KAI C++ compiler
+# RCC  Rational C++
+# xlC_r        AIX C Set++ (with support for reentrant code)
+# xlC  AIX C Set++
+AC_DEFUN([AC_PROG_CXX],
+[AC_LANG_PUSH(C++)dnl
+AC_ARG_VAR([CXX],      [C++ compiler command])dnl
+AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+_AC_ARG_VAR_LIBS()dnl
+_AC_ARG_VAR_CPPFLAGS()dnl
+_AC_ARG_VAR_PRECIOUS([CCC])dnl
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    AC_CHECK_TOOLS(CXX,
+                  [m4_default([$1],
+                              [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++])],
+                  g++)
+  fi
+fi
+# Provide some information about the compiler.
+_AS_ECHO_LOG([checking for _AC_LANG compiler version])
+set X $ac_compile
+ac_compiler=$[2]
+for ac_option in --version -v -V -qversion; do
+  _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
+done
+
+m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
+_AC_LANG_COMPILER_GNU
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+_AC_PROG_CXX_G
+_AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11
+                   ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11
+                   ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11],
+   [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98
+                       ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98],
+                      [ac_prog_cxx_stdcxx=no
+                       ac_cv_prog_cxx_stdcxx=no])])
+AC_LANG_POP(C++)dnl
+])# AC_PROG_CXX
+
+
+# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
+#              ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
+# --------------------------------------------------------------
+# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
+# by trying to compile a program of TEST-PROLOGUE and TEST-BODY.  If this fails,
+# try again with each compiler option in the space-separated OPTION-LIST; if one
+# helps, append it to CC.  If eventually successful, run ACTION-IF-AVAILABLE,
+# else ACTION-IF-UNAVAILABLE.
+AC_DEFUN([_AC_C_STD_TRY],
+[AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features])
+AC_CACHE_VAL(ac_cv_prog_cc_$1,
+[ac_cv_prog_cc_$1=no
+ac_save_CC=$CC
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
+for ac_arg in '' $4
+do
+  CC="$ac_save_CC $ac_arg"
+  _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
+  test "x$ac_cv_prog_cc_$1" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+])# AC_CACHE_VAL
+ac_prog_cc_stdc_options=
+case "x$ac_cv_prog_cc_$1" in
+  x)
+    AC_MSG_RESULT([none needed]) ;;
+  xno)
+    AC_MSG_RESULT([unsupported]) ;;
+  *)
+    ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1"
+    CC=$CC$ac_prog_cc_stdc_options
+    AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
+esac
+AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
+])# _AC_C_STD_TRY
+
+# _AC_C_C99_TEST_HEADER
+# ---------------------
+# A C header suitable for testing for C99.
+AC_DEFUN([_AC_C_C99_TEST_HEADER],
+[[#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <stdio.h>
+
+// Check varargs macros.  These examples are taken from C99 6.10.3.5.
+#define debug(...) fprintf (stderr, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+  int x = 1234;
+  int y = 5678;
+  debug ("Flag");
+  debug ("X = %d\n", x);
+  showlist (The first, second, and third items.);
+  report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+  your preprocessor is broken;
+#endif
+#if BIG_OK
+#else
+  your preprocessor is broken;
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+  int datasize;
+  double data[];
+};
+
+struct named_init {
+  int number;
+  const wchar_t *name;
+  double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+  // See if C++-style comments work.
+  // Iterate through items via the restricted pointer.
+  // Also check for declarations in for loops.
+  for (unsigned int i = 0; *(text+i) != '\0'; ++i)
+    continue;
+  return 0;
+}
+
+// Check varargs and va_copy.
+static bool
+test_varargs (const char *format, ...)
+{
+  va_list args;
+  va_start (args, format);
+  va_list args_copy;
+  va_copy (args_copy, args);
+
+  const char *str = "";
+  int number = 0;
+  float fnumber = 0;
+
+  while (*format)
+    {
+      switch (*format++)
+       {
+       case 's': // string
+         str = va_arg (args_copy, const char *);
+         break;
+       case 'd': // int
+         number = va_arg (args_copy, int);
+         break;
+       case 'f': // float
+         fnumber = va_arg (args_copy, double);
+         break;
+       default:
+         break;
+       }
+    }
+  va_end (args_copy);
+  va_end (args);
+
+  return *str && number && fnumber;
+}]])# _AC_C_C99_TEST_HEADER
+
+# _AC_C_C99_TEST_BODY
+# -------------------
+# A C body suitable for testing for C99, assuming the corresponding header.
+AC_DEFUN([_AC_C_C99_TEST_BODY],
+[[
+  // Check bool.
+  _Bool success = false;
+
+  // Check restrict.
+  if (test_restrict ("String literal") == 0)
+    success = true;
+  char *restrict newvar = "Another string";
+
+  // Check varargs.
+  success &= test_varargs ("s, d' f .", "string", 65, 34.234);
+  test_varargs_macros ();
+
+  // Check flexible array members.
+  struct incomplete_array *ia =
+    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+  ia->datasize = 10;
+  for (int i = 0; i < ia->datasize; ++i)
+    ia->data[i] = i * 1.234;
+
+  // Check named initializers.
+  struct named_init ni = {
+    .number = 34,
+    .name = L"Test wide string",
+    .average = 543.34343,
+  };
+
+  ni.number = 58;
+
+  int dynamic_array[ni.number];
+  dynamic_array[ni.number - 1] = 543;
+
+  // work around unused variable warnings
+  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
+         || dynamic_array[ni.number - 1] != 543);
+]])
+
+# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
+# ----------------------------------------------------------------
+# If the C compiler is not in ISO C99 mode by default, try to add an
+# option to output variable CC to make it so.  This macro tries
+# various options that select ISO C99 on some system or another.  It
+# considers the compiler to be in ISO C99 mode if it handles _Bool,
+# // comments, flexible array members, inline, long long int, mixed
+# code and declarations, named initialization of structs, restrict,
+# va_copy, varargs macros, variable declarations in for loops and
+# variable length arrays.
+AC_DEFUN([_AC_PROG_CC_C99],
+[_AC_C_STD_TRY([c99],
+[_AC_C_C99_TEST_HEADER],
+[_AC_C_C99_TEST_BODY],
+dnl Try
+dnl GCC                -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
+dnl IBM XL C   -qlanglvl=extc1x (V12.1; does not pass C11 test)
+dnl IBM XL C   -qlanglvl=extc99
+dnl            (pre-V12.1; unused restrictive mode: -qlanglvl=stdc99)
+dnl HP cc      -AC99
+dnl Intel ICC  -std=c99, -c99 (deprecated)
+dnl IRIX       -c99
+dnl Solaris    -D_STDC_C99=
+dnl            cc's -xc99 option uses linker magic to define the external
+dnl            symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99
+dnl            behavior for C library functions.  This is not wanted here,
+dnl            because it means that a single module compiled with -xc99
+dnl            alters C runtime behavior for the entire program, not for
+dnl            just the module.  Instead, define the (private) symbol
+dnl            _STDC_C99, which suppresses a bogus failure in <stdbool.h>.
+dnl            The resulting compiler passes the test case here, and that's
+dnl            good enough.  For more, please see the thread starting at:
+dnl            https://lists.gnu.org/r/autoconf/2010-12/msg00059.html
+dnl Tru64      -c99
+dnl with extended modes being tried first.
+[[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl
+])# _AC_PROG_CC_C99
+
+
+# _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
+# ----------------------------------------------------------------
+# If the C compiler is not in ISO C11 mode by default, try to add an
+# option to output variable CC to make it so.  This macro tries
+# various options that select ISO C11 on some system or another.  It
+# considers the compiler to be in ISO C11 mode if it handles _Alignas,
+# _Alignof, _Noreturn, _Static_assert, UTF-8 string literals,
+# duplicate typedefs, and anonymous structures and unions.
+AC_DEFUN([_AC_PROG_CC_C11],
+[_AC_C_STD_TRY([c11],
+[_AC_C_C99_TEST_HEADER[
+// Check _Alignas.
+char _Alignas (double) aligned_as_double;
+char _Alignas (0) no_special_alignment;
+extern char aligned_as_int;
+char _Alignas (0) _Alignas (int) aligned_as_int;
+
+// Check _Alignof.
+enum
+{
+  int_alignment = _Alignof (int),
+  int_array_alignment = _Alignof (int[100]),
+  char_alignment = _Alignof (char)
+};
+_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
+
+// Check _Noreturn.
+int _Noreturn does_not_return (void) { for (;;) continue; }
+
+// Check _Static_assert.
+struct test_static_assert
+{
+  int x;
+  _Static_assert (sizeof (int) <= sizeof (long int),
+                  "_Static_assert does not work in struct");
+  long int y;
+};
+
+// Check UTF-8 literals.
+#define u8 syntax error!
+char const utf8_literal[] = u8"happens to be ASCII" "another string";
+
+// Check duplicate typedefs.
+typedef long *long_ptr;
+typedef long int *long_ptr;
+typedef long_ptr long_ptr;
+
+// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
+struct anonymous
+{
+  union {
+    struct { int i; int j; };
+    struct { int k; long int l; } w;
+  };
+  int m;
+} v1;
+]],
+[_AC_C_C99_TEST_BODY[
+  v1.i = 2;
+  v1.w.k = 5;
+  _Static_assert ((offsetof (struct anonymous, i)
+                  == offsetof (struct anonymous, w.k)),
+                 "Anonymous union alignment botch");
+]],
+dnl Try
+dnl GCC                -std=gnu11 (unused restrictive mode: -std=c11)
+dnl with extended modes being tried first.
+dnl
+dnl Do not try -qlanglvl=extc1x, because IBM XL C V12.1 (the latest version as
+dnl of September 2012) does not pass the C11 test.  For now, try extc1x when
+dnl compiling the C99 test instead, since it enables _Static_assert and
+dnl _Noreturn, which is a win.  If -qlanglvl=extc11 or -qlanglvl=extc1x passes
+dnl the C11 test in some future version of IBM XL C, we'll add it here,
+dnl preferably extc11.
+[[-std=gnu11]], [$1], [$2])[]dnl
+])# _AC_PROG_CC_C11
+
+
+# AC_PROG_CC_C89
+# --------------
+# Do not use AU_ALIAS here and in AC_PROG_CC_C99 and AC_PROG_CC_STDC,
+# as that'd be incompatible with how Automake redefines AC_PROG_CC.  See
+# <https://lists.gnu.org/r/autoconf/2012-10/msg00048.html>.
+AU_DEFUN([AC_PROG_CC_C89],
+  [AC_REQUIRE([AC_PROG_CC])],
+  [$0 is obsolete; use AC_PROG_CC]
+)
+
+# AC_PROG_CC_C99
+# --------------
+AU_DEFUN([AC_PROG_CC_C99],
+  [AC_REQUIRE([AC_PROG_CC])],
+  [$0 is obsolete; use AC_PROG_CC]
+)
+
+# AC_PROG_CC_STDC
+# ---------------
+AU_DEFUN([AC_PROG_CC_STDC],
+  [AC_REQUIRE([AC_PROG_CC])],
+  [$0 is obsolete; use AC_PROG_CC]
+)
+
+
+# AC_C_PROTOTYPES
+# ---------------
+# Check if the C compiler supports prototypes, included if it needs
+# options.
+AC_DEFUN([AC_C_PROTOTYPES],
+[AC_REQUIRE([AC_PROG_CC])dnl
+if test "$ac_prog_cc_stdc" != no; then
+  AC_DEFINE(PROTOTYPES, 1,
+           [Define to 1 if the C compiler supports function prototypes.])
+  AC_DEFINE(__PROTOTYPES, 1,
+           [Define like PROTOTYPES; this can be used by system headers.])
+fi
+])# AC_C_PROTOTYPES
+
+
+# _AC_CXX_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
+#                ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
+# ----------------------------------------------------------------
+# Check whether the C++ compiler accepts features of STANDARD (e.g
+# `cxx98', `cxx11') by trying to compile a program of TEST-PROLOGUE
+# and TEST-BODY.  If this fails, try again with each compiler option
+# in the space-separated OPTION-LIST; if one helps, append it to CXX.
+# If eventually successful, run ACTION-IF-AVAILABLE, else
+# ACTION-IF-UNAVAILABLE.
+AC_DEFUN([_AC_CXX_STD_TRY],
+[AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features])
+AC_LANG_PUSH(C++)dnl
+AC_CACHE_VAL(ac_cv_prog_cxx_$1,
+[ac_cv_prog_cxx_$1=no
+ac_save_CXX=$CXX
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
+for ac_arg in '' $4
+do
+  CXX="$ac_save_CXX $ac_arg"
+  _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg])
+  test "x$ac_cv_prog_cxx_$1" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CXX=$ac_save_CXX
+])# AC_CACHE_VAL
+ac_prog_cxx_stdcxx_options=
+case "x$ac_cv_prog_cxx_$1" in
+  x)
+    AC_MSG_RESULT([none needed]) ;;
+  xno)
+    AC_MSG_RESULT([unsupported]) ;;
+  *)
+    ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1"
+    CXX=$CXX$ac_prog_cxx_stdcxx_options
+    AC_MSG_RESULT([$ac_cv_prog_cxx_$1]) ;;
+esac
+AC_LANG_POP(C++)dnl
+AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$5], [$6])
+])# _AC_CXX_STD_TRY
+
+# _AC_CXX_CXX98_TEST_HEADER
+# -------------------------
+# A C++ header suitable for testing for CXX98.
+AC_DEFUN([_AC_CXX_CXX98_TEST_HEADER],
+[[
+#include <algorithm>
+#include <cstdlib>
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <list>
+#include <map>
+#include <set>
+#include <sstream>
+#include <stdexcept>
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace test {
+  typedef std::vector<std::string> string_vec;
+  typedef std::pair<int,bool> map_value;
+  typedef std::map<std::string,map_value> map_type;
+  typedef std::set<int> set_type;
+
+  template<typename T>
+  class printer {
+  public:
+    printer(std::ostringstream& os): os(os) {}
+    void operator() (T elem) { os << elem << std::endl; }
+  private:
+    std::ostringstream& os;
+  };
+}
+]])# _AC_CXX_CXX98_TEST_HEADER
+
+# _AC_CXX_CXX98_TEST_BODY
+# -----------------------
+# A C++ body suitable for testing for CXX98, assuming the corresponding header.
+AC_DEFUN([_AC_CXX_CXX98_TEST_BODY],
+[[
+
+try {
+  // Basic string.
+  std::string teststr("ASCII text");
+  teststr += " string";
+
+  // Simple vector.
+  test::string_vec testvec;
+  testvec.push_back(teststr);
+  testvec.push_back("foo");
+  testvec.push_back("bar");
+  if (testvec.size() != 3) {
+    throw std::runtime_error("vector size is not 1");
+  }
+
+  // Dump vector into stringstream and obtain string.
+  std::ostringstream os;
+  for (test::string_vec::const_iterator i = testvec.begin();
+       i != testvec.end(); ++i) {
+    if (i + 1 != testvec.end()) {
+      os << teststr << '\n';
+    }
+  }
+  // Check algorithms work.
+  std::for_each(testvec.begin(), testvec.end(), test::printer<std::string>(os));
+  std::string os_out = os.str();
+
+  // Test pair and map.
+  test::map_type testmap;
+  testmap.insert(std::make_pair(std::string("key"),
+                                std::make_pair(53,false)));
+
+  // Test set.
+  int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
+  test::set_type testset(values, values + sizeof(values)/sizeof(values[0]));
+  std::list<int> testlist(testset.begin(), testset.end());
+  std::copy(testset.begin(), testset.end(), std::back_inserter(testlist));
+} catch (const std::exception& e) {
+  std::cerr << "Caught exception: " << e.what() << std::endl;
+
+  // Test fstream
+  std::ofstream of("test.txt");
+  of << "Test ASCII text\n" << std::flush;
+  of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl;
+  of.close();
+}
+std::exit(0);
+]])
+
+# _AC_CXX_CXX11_TEST_HEADER
+# -------------------------
+# A C++ header suitable for testing for CXX11.
+AC_DEFUN([_AC_CXX_CXX11_TEST_HEADER],
+[[
+#include <deque>
+#include <functional>
+#include <memory>
+#include <tuple>
+#include <array>
+#include <regex>
+#include <iostream>
+
+namespace cxx11test
+{
+  typedef std::shared_ptr<std::string> sptr;
+  typedef std::weak_ptr<std::string> wptr;
+
+  typedef std::tuple<std::string,int,double> tp;
+  typedef std::array<int, 20> int_array;
+
+  constexpr int get_val() { return 20; }
+
+  struct testinit
+  {
+    int i;
+    double d;
+  };
+
+  class delegate  {
+  public:
+    delegate(int n) : n(n) {}
+    delegate(): delegate(2354) {}
+
+    virtual int getval() { return this->n; };
+  protected:
+    int n;
+  };
+
+  class overridden : public delegate {
+  public:
+    overridden(int n): delegate(n) {}
+    virtual int getval() override final { return this->n * 2; }
+  };
+
+  class nocopy {
+  public:
+    nocopy(int i): i(i) {}
+    nocopy() = default;
+    nocopy(const nocopy&) = delete;
+    nocopy & operator=(const nocopy&) = delete;
+  private:
+    int i;
+  };
+}
+]])# _AC_CXX_CXX11_TEST_HEADER
+
+# _AC_CXX_CXX11_TEST_BODY
+# -----------------------
+# A C++ body suitable for testing for CXX11, assuming the corresponding header.
+AC_DEFUN([_AC_CXX_CXX11_TEST_BODY],
+[[
+{
+  // Test auto and decltype
+  std::deque<int> d;
+  d.push_front(43);
+  d.push_front(484);
+  d.push_front(3);
+  d.push_front(844);
+  int total = 0;
+  for (auto i = d.begin(); i != d.end(); ++i) { total += *i; }
+
+  auto a1 = 6538;
+  auto a2 = 48573953.4;
+  auto a3 = "String literal";
+
+  decltype(a2) a4 = 34895.034;
+}
+{
+  // Test constexpr
+  short sa[cxx11test::get_val()] = { 0 };
+}
+{
+  // Test initializer lists
+  cxx11test::testinit il = { 4323, 435234.23544 };
+}
+{
+  // Test range-based for and lambda
+  cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
+  for (int &x : array) { x += 23; }
+  std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; });
+}
+{
+  using cxx11test::sptr;
+  using cxx11test::wptr;
+
+  sptr sp(new std::string("ASCII string"));
+  wptr wp(sp);
+  sptr sp2(wp);
+}
+{
+  cxx11test::tp tuple("test", 54, 45.53434);
+  double d = std::get<2>(tuple);
+  std::string s;
+  int i;
+  std::tie(s,i,d) = tuple;
+}
+{
+  static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$");
+  std::string testmatch("Test if this string matches");
+  bool match = std::regex_search(testmatch, filename_regex);
+}
+{
+  cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
+  cxx11test::int_array::size_type size = array.size();
+}
+{
+  // Test constructor delegation
+  cxx11test::delegate d1;
+  cxx11test::delegate d2();
+  cxx11test::delegate d3(45);
+}
+{
+  // Test override and final
+  cxx11test::overridden o1(55464);
+}
+{
+  // Test nullptr
+  char *c = nullptr;
+}
+{
+  // Test template brackets
+  std::vector<std::pair<int,char*>> v1;
+}
+{
+  // Unicode literals
+  char const *utf8 = u8"UTF-8 string \u2500";
+  char16_t const *utf16 = u"UTF-8 string \u2500";
+  char32_t const *utf32 = U"UTF-32 string \u2500";
+}
+]])
+
+# _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
+# -------------------------------------------------------------------
+
+# If the C++ compiler is not in ISO C++98 mode by default, try to add
+# an option to output variable CXX to make it so.  This macro tries
+# various options that select ISO C++98 on some system or another.  It
+# considers the compiler to be in ISO C++98 mode if it handles basic
+# features of the std namespace including: string, containers (list,
+# map, set, vector), streams (fstreams, iostreams, stringstreams,
+# iomanip), pair, exceptions and algorithms.
+
+
+AC_DEFUN([_AC_PROG_CXX_CXX98],
+[_AC_CXX_STD_TRY([cxx98],
+[_AC_CXX_CXX98_TEST_HEADER],
+[_AC_CXX_CXX98_TEST_BODY],
+dnl Try
+dnl GCC                -std=gnu++98 (unused restrictive mode: -std=c++98)
+dnl IBM XL C   -qlanglvl=extended
+dnl HP aC++    -AA
+dnl Intel ICC  -std=gnu++98
+dnl Solaris    N/A (default)
+dnl Tru64      N/A (default, but -std gnu could be used)
+dnl with extended modes being tried first.
+[[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl
+])# _AC_PROG_CXX_CXX98
+
+# _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
+# -------------------------------------------------------------------
+# If the C++ compiler is not in ISO CXX11 mode by default, try to add
+# an option to output variable CXX to make it so.  This macro tries
+# various options that select ISO C++11 on some system or another.  It
+# considers the compiler to be in ISO C++11 mode if it handles all the
+# tests from the C++98 checks, plus the following: Language features
+# (auto, constexpr, decltype, default/deleted constructors, delegate
+# constructors, final, initializer lists, lambda functions, nullptr,
+# override, range-based for loops, template brackets without spaces,
+# unicode literals) and library features (array, memory (shared_ptr,
+# weak_ptr), regex and tuple types).
+AC_DEFUN([_AC_PROG_CXX_CXX11],
+[_AC_CXX_STD_TRY([cxx11],
+[_AC_CXX_CXX11_TEST_HEADER
+_AC_CXX_CXX98_TEST_HEADER],
+[_AC_CXX_CXX11_TEST_BODY
+_AC_CXX_CXX98_TEST_BODY],
+dnl Try
+dnl GCC                -std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants]
+dnl IBM XL C   -qlanglvl=extended0x
+dnl            (pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11)
+dnl HP aC++    -AA
+dnl Intel ICC  -std=c++11 -std=c++0x
+dnl Solaris    N/A (no support)
+dnl Tru64      N/A (no support)
+dnl with extended modes being tried first.
+[[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl
+])# _AC_PROG_CXX_CXX11
+
+
+])# m4_version_prereq
deleted file mode 120000 (symlink)
index ad888e22c402b68354168359b10e7474d813cf68..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stdalign.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2efd5f9692ed5579c31b03d5742f3e9534766cc0
--- /dev/null
@@ -0,0 +1,206 @@
+# Check for alignas and alignof that conform to C23.
+
+dnl Copyright 2011-2024 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 and Bruno Haible.
+
+# Prepare for substituting <stdalign.h> if it is not supported.
+
+AC_DEFUN([gl_ALIGNASOF],
+[
+  AC_CACHE_CHECK([for alignas and alignof],
+    [gl_cv_header_working_stdalign_h],
+    [gl_save_CFLAGS=$CFLAGS
+     for gl_working in "yes, keywords" "yes, <stdalign.h> macros"; do
+      AS_CASE([$gl_working],
+        [*stdalign.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_STDALIGN_H"])
+      AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdint.h>
+            #ifdef INCLUDE_STDALIGN_H
+             #include <stdalign.h>
+            #endif
+            #include <stddef.h>
+
+            /* Test that alignof yields a result consistent with offsetof.
+               This catches GCC bug 52023
+               <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.  */
+            #ifdef __cplusplus
+               template <class t> struct alignof_helper { char a; t b; };
+            # define ao(type) offsetof (alignof_helper<type>, b)
+            #else
+            # define ao(type) offsetof (struct { char a; type b; }, b)
+            #endif
+            char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1];
+            char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1];
+            char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1];
+
+            /* Test alignas only on platforms where gnulib can help.  */
+            #if \
+                ((defined __cplusplus && 201103 <= __cplusplus) \
+                 || (__TINYC__ && defined __attribute__) \
+                 || (defined __APPLE__ && defined __MACH__ \
+                     ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
+                     : __GNUC__) \
+                 || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \
+                 || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__ \
+                 || 1300 <= _MSC_VER)
+              struct alignas_test { char c; char alignas (8) alignas_8; };
+              char test_alignas[offsetof (struct alignas_test, alignas_8) == 8
+                                ? 1 : -1];
+            #endif
+          ]])],
+       [gl_cv_header_working_stdalign_h=$gl_working],
+       [gl_cv_header_working_stdalign_h=no])
+
+      CFLAGS=$gl_save_CFLAGS
+      test "$gl_cv_header_working_stdalign_h" != no && break
+     done])
+
+  AS_CASE([$gl_cv_header_working_stdalign_h],
+    [yes*keyword*],
+      [AC_DEFINE([HAVE_C_ALIGNASOF], [1],
+         [Define to 1 if the alignas and alignof keywords work.])])
+
+  dnl The "zz" puts this toward config.h's end, to avoid potential
+  dnl collisions with other definitions.
+  AH_VERBATIM([zzalignas],
+[#if !defined HAVE_C_ALIGNASOF \
+    && !(defined __cplusplus && 201103 <= __cplusplus) \
+    && !defined alignof
+# if defined HAVE_STDALIGN_H
+#  include <stdalign.h>
+# endif
+
+/* ISO C23 alignas and alignof for platforms that lack it.
+
+   References:
+   ISO C23 (latest free draft
+   <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf>)
+   sections 6.5.3.4, 6.7.5, 7.15.
+   C++11 (latest free draft
+   <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
+   section 18.10. */
+
+/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
+   requirement of a structure member (i.e., slot or field) that is of
+   type TYPE, as an integer constant expression.
+
+   This differs from GCC's and clang's __alignof__ operator, which can
+   yield a better-performing alignment for an object of that type.  For
+   example, on x86 with GCC and on Linux/x86 with clang,
+   __alignof__ (double) and __alignof__ (long long) are 8, whereas
+   alignof (double) and alignof (long long) are 4 unless the option
+   '-malign-double' is used.
+
+   The result cannot be used as a value for an 'enum' constant, if you
+   want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.  */
+
+/* GCC releases before GCC 4.9 had a bug in _Alignof.  See GCC bug 52023
+   <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.
+   clang versions < 8.0.0 have the same bug.  */
+#  if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
+       || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
+           && !defined __clang__) \
+       || (defined __clang__ && __clang_major__ < 8))
+#   undef/**/_Alignof
+#   ifdef __cplusplus
+#    if (201103 <= __cplusplus || defined _MSC_VER)
+#     define _Alignof(type) alignof (type)
+#    else
+      template <class __t> struct __alignof_helper { char __a; __t __b; };
+#     if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__
+#      define _Alignof(type) __builtin_offsetof (__alignof_helper<type>, __b)
+#     else
+#      define _Alignof(type) offsetof (__alignof_helper<type>, __b)
+#     endif
+#     define _GL_STDALIGN_NEEDS_STDDEF 1
+#    endif
+#   else
+#    if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__
+#     define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b)
+#    else
+#     define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+#     define _GL_STDALIGN_NEEDS_STDDEF 1
+#    endif
+#   endif
+#  endif
+#  if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))
+#   undef/**/alignof
+#   define alignof _Alignof
+#  endif
+
+/* alignas (A), also known as _Alignas (A), aligns a variable or type
+   to the alignment A, where A is an integer constant expression.  For
+   example:
+
+      int alignas (8) foo;
+      struct s { int a; int alignas (8) bar; };
+
+   aligns the address of FOO and the offset of BAR to be multiples of 8.
+
+   A should be a power of two that is at least the type's alignment
+   and at most the implementation's alignment limit.  This limit is
+   2**28 on typical GNUish hosts, and 2**13 on MSVC.  To be portable
+   to MSVC through at least version 10.0, A should be an integer
+   constant, as MSVC does not support expressions such as 1 << 3.
+   To be portable to Sun C 5.11, do not align auto variables to
+   anything stricter than their default alignment.
+
+   The following C23 requirements are not supported here:
+
+     - If A is zero, alignas has no effect.
+     - alignas can be used multiple times; the strictest one wins.
+     - alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
+
+   */
+# if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+#  if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)
+#   define _Alignas(a) alignas (a)
+#  elif (!defined __attribute__ \
+         && ((defined __APPLE__ && defined __MACH__ \
+              ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
+              : __GNUC__ && !defined __ibmxl__) \
+             || (4 <= __clang_major__) \
+             || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \
+             || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__))
+#   define _Alignas(a) __attribute__ ((__aligned__ (a)))
+#  elif 1300 <= _MSC_VER
+#   define _Alignas(a) __declspec (align (a))
+#  endif
+# endif
+# if !defined HAVE_STDALIGN_H
+#  if ((defined _Alignas \
+        && !(defined __cplusplus \
+             && (201103 <= __cplusplus || defined _MSC_VER))) \
+       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
+#   define alignas _Alignas
+#  endif
+# endif
+
+# if defined _GL_STDALIGN_NEEDS_STDDEF
+#  include <stddef.h>
+# endif
+#endif])
+])
+
+AC_DEFUN([gl_STDALIGN_H],
+[
+  AC_REQUIRE([gl_ALIGNASOF])
+  if test "$gl_cv_header_working_stdalign_h" = no; then
+    GL_GENERATE_STDALIGN_H=true
+  else
+    GL_GENERATE_STDALIGN_H=false
+  fi
+
+  gl_CHECK_NEXT_HEADERS([stdalign.h])
+  if test $ac_cv_header_stdalign_h = yes; then
+    HAVE_STDALIGN_H=1
+  else
+    HAVE_STDALIGN_H=0
+  fi
+  AC_SUBST([HAVE_STDALIGN_H])
+])
deleted file mode 120000 (symlink)
index 304d1eb361e0eeaf1428e201c5885fb734a50005..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stdarg.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..989383c11937a8f96a8fe063985743586ba5a76d
--- /dev/null
@@ -0,0 +1,76 @@
+# stdarg.m4 serial 8
+dnl Copyright (C) 2006, 2008-2024 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 Bruno Haible.
+dnl Provide a working va_copy in combination with <stdarg.h>.
+
+AC_DEFUN([gl_STDARG_H],
+[
+  GL_GENERATE_STDARG_H=false
+  NEXT_STDARG_H='<stdarg.h>'
+  AC_CACHE_CHECK([for va_copy],
+    [gl_cv_func_va_copy],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdarg.h>]],
+          [[
+#ifndef va_copy
+void (*func) (va_list, va_list) = va_copy;
+#endif
+          ]])],
+       [gl_cv_func_va_copy=yes],
+       [gl_cv_func_va_copy=no])
+    ])
+  if test $gl_cv_func_va_copy = no; then
+    dnl Provide a substitute.
+    dnl Usually a simple definition in <config.h> is enough. Not so on AIX 5
+    dnl with some versions of the /usr/vac/bin/cc compiler. It has an <stdarg.h>
+    dnl which does '#undef va_copy', leading to a missing va_copy symbol. For
+    dnl this platform, we use an <stdarg.h> substitute. But we cannot use this
+    dnl approach on other platforms, because <stdarg.h> often defines only
+    dnl preprocessor macros and gl_ABSOLUTE_HEADER, gl_CHECK_NEXT_HEADERS do
+    dnl not work in this situation.
+    AC_EGREP_CPP([vaccine],
+      [#if defined _AIX && !defined __GNUC__
+        AIX vaccine
+       #endif
+      ], [gl_aixcc=yes], [gl_aixcc=no])
+    if test $gl_aixcc = yes; then
+      dnl Provide a substitute <stdarg.h> file.
+      GL_GENERATE_STDARG_H=true
+      gl_NEXT_HEADERS([stdarg.h])
+      dnl Fallback for the case when <stdarg.h> contains only macro definitions.
+      if test "$gl_cv_next_stdarg_h" = '""'; then
+        gl_cv_next_stdarg_h='"///usr/include/stdarg.h"'
+        NEXT_STDARG_H="$gl_cv_next_stdarg_h"
+      fi
+    else
+      dnl Provide a substitute in <config.h>, either __va_copy or as a simple
+      dnl assignment.
+      gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[#include <stdarg.h>]],
+             [[
+#ifndef __va_copy
+error, bail out
+#endif
+             ]])],
+          [gl_cv_func___va_copy=yes],
+          [gl_cv_func___va_copy=no])])
+      if test $gl_cv_func___va_copy = yes; then
+        AC_DEFINE([va_copy], [__va_copy],
+          [Define as a macro for copying va_list variables.])
+      else
+        AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed.  */
+#define gl_va_copy(a,b) ((a) = (b))])
+        AC_DEFINE([va_copy], [gl_va_copy],
+          [Define as a macro for copying va_list variables.])
+      fi
+    fi
+  fi
+  AC_SUBST([NEXT_STDARG_H])
+])
deleted file mode 120000 (symlink)
index 1eb9d7b3df9843bc7fac5760f7306e6c264e44da..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stddef_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1bf9eb39b66d193ebc7c3be65dd58f5057e9e7c4
--- /dev/null
@@ -0,0 +1,119 @@
+# stddef_h.m4 serial 14
+dnl Copyright (C) 2009-2024 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 A placeholder for <stddef.h>, for platforms that have issues.
+
+AC_DEFUN_ONCE([gl_STDDEF_H],
+[
+  AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+  AC_REQUIRE([gt_TYPE_WCHAR_T])
+
+  dnl Persuade OpenBSD <stddef.h> to declare max_align_t.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  GL_GENERATE_STDDEF_H=false
+
+  dnl Test whether the type max_align_t exists and whether its alignment
+  dnl "is as great as is supported by the implementation in all contexts".
+  AC_CACHE_CHECK([for good max_align_t],
+    [gl_cv_type_max_align_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[/* On FreeBSD 12.0/x86, max_align_t defined by <stddef.h> has
+               the correct alignment with the default (wrong) definition of
+               _Alignof, but a wrong alignment as soon as we activate an
+               ISO C compliant _Alignof definition.  */
+            #if ((defined __GNUC__ && 4 <= __GNUC__) || defined __clang__) && !defined __cplusplus
+             #define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b)
+            #endif
+            #include <stddef.h>
+            unsigned int s = sizeof (max_align_t);
+            #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__
+            int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1];
+            int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1];
+            #endif
+            typedef struct { char a; max_align_t b; } max_helper;
+            typedef struct { char a; long b; } long_helper;
+            typedef struct { char a; double b; } double_helper;
+            typedef struct { char a; long double b; } long_double_helper;
+            int check3[2 * (offsetof (long_helper, b) <= offsetof (max_helper, b)) - 1];
+            int check4[2 * (offsetof (double_helper, b) <= offsetof (max_helper, b)) - 1];
+            int check5[2 * (offsetof (long_double_helper, b) <= offsetof (max_helper, b)) - 1];
+          ]])],
+       [gl_cv_type_max_align_t=yes],
+       [gl_cv_type_max_align_t=no])
+    ])
+  if test $gl_cv_type_max_align_t = no; then
+    HAVE_MAX_ALIGN_T=0
+    GL_GENERATE_STDDEF_H=true
+  fi
+
+  if test $gt_cv_c_wchar_t = no; then
+    HAVE_WCHAR_T=0
+    GL_GENERATE_STDDEF_H=true
+  fi
+
+  AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
+    [gl_cv_decl_null_works],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
+      int test[2 * (sizeof NULL == sizeof (void *)) -1];
+]])],
+      [gl_cv_decl_null_works=yes],
+      [gl_cv_decl_null_works=no])])
+  if test $gl_cv_decl_null_works = no; then
+    REPLACE_NULL=1
+    GL_GENERATE_STDDEF_H=true
+  fi
+
+  AC_CACHE_CHECK([for unreachable],
+    [gl_cv_func_unreachable],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stddef.h>
+          ]],
+          [[unreachable ();
+          ]])],
+       [gl_cv_func_unreachable=yes],
+       [gl_cv_func_unreachable=no])
+    ])
+  if test $gl_cv_func_unreachable = no; then
+    GL_GENERATE_STDDEF_H=true
+  fi
+
+  if $GL_GENERATE_STDDEF_H; then
+    gl_NEXT_HEADERS([stddef.h])
+  fi
+])
+
+# gl_STDDEF_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_STDDEF_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS], [
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_STDDEF_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  REPLACE_NULL=0;                AC_SUBST([REPLACE_NULL])
+  HAVE_MAX_ALIGN_T=1;            AC_SUBST([HAVE_MAX_ALIGN_T])
+  HAVE_WCHAR_T=1;                AC_SUBST([HAVE_WCHAR_T])
+])
deleted file mode 120000 (symlink)
index 85b7e1fdd9bf31708a3f871a506db3d33aae416b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stdint.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4aa250827cc2f99d77d2cb11ab561c5d3df09533
--- /dev/null
@@ -0,0 +1,534 @@
+# stdint.m4 serial 63
+dnl Copyright (C) 2001-2024 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 and Bruno Haible.
+dnl Test whether <stdint.h> is supported or must be substituted.
+
+AC_PREREQ([2.61])
+
+AC_DEFUN_ONCE([gl_STDINT_H],
+[
+  AC_PREREQ([2.59])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_REQUIRE([gl_LIMITS_H])
+  AC_REQUIRE([gt_TYPE_WINT_T])
+
+  dnl For backward compatibility. Some packages may still be testing these
+  dnl macros.
+  AC_DEFINE([HAVE_LONG_LONG_INT], [1],
+    [Define to 1 if the system has the type 'long long int'.])
+  AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
+    [Define to 1 if the system has the type 'unsigned long long int'.])
+
+  dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
+  AC_CHECK_HEADERS_ONCE([wchar.h])
+  if test $ac_cv_header_wchar_h = yes; then
+    HAVE_WCHAR_H=1
+  else
+    HAVE_WCHAR_H=0
+  fi
+  AC_SUBST([HAVE_WCHAR_H])
+
+  dnl Check for <inttypes.h>.
+  AC_CHECK_HEADERS_ONCE([inttypes.h])
+  if test $ac_cv_header_inttypes_h = yes; then
+    HAVE_INTTYPES_H=1
+  else
+    HAVE_INTTYPES_H=0
+  fi
+  AC_SUBST([HAVE_INTTYPES_H])
+
+  dnl Check for <sys/types.h>.
+  AC_CHECK_HEADERS_ONCE([sys/types.h])
+  if test $ac_cv_header_sys_types_h = yes; then
+    HAVE_SYS_TYPES_H=1
+  else
+    HAVE_SYS_TYPES_H=0
+  fi
+  AC_SUBST([HAVE_SYS_TYPES_H])
+
+  gl_CHECK_NEXT_HEADERS([stdint.h])
+  if test $ac_cv_header_stdint_h = yes; then
+    HAVE_STDINT_H=1
+  else
+    HAVE_STDINT_H=0
+  fi
+  AC_SUBST([HAVE_STDINT_H])
+
+  dnl Now see whether we need a substitute <stdint.h>.
+  if test $ac_cv_header_stdint_h = yes; then
+    AC_CACHE_CHECK([whether stdint.h conforms to C99],
+      [gl_cv_header_working_stdint_h],
+      [gl_cv_header_working_stdint_h=no
+       AC_COMPILE_IFELSE([
+         AC_LANG_PROGRAM([[
+#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#define __STDC_CONSTANT_MACROS 1
+#define __STDC_LIMIT_MACROS 1
+#include <stdint.h>
+/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
+#if !(defined WCHAR_MIN && defined WCHAR_MAX)
+#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
+#endif
+]
+gl_STDINT_INCLUDES
+[
+#ifdef INT8_MAX
+int8_t a1 = INT8_MAX;
+int8_t a1min = INT8_MIN;
+#endif
+#ifdef INT16_MAX
+int16_t a2 = INT16_MAX;
+int16_t a2min = INT16_MIN;
+#endif
+#ifdef INT32_MAX
+int32_t a3 = INT32_MAX;
+int32_t a3min = INT32_MIN;
+#endif
+#ifdef INT64_MAX
+int64_t a4 = INT64_MAX;
+int64_t a4min = INT64_MIN;
+#endif
+#ifdef UINT8_MAX
+uint8_t b1 = UINT8_MAX;
+#else
+typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
+#endif
+#ifdef UINT16_MAX
+uint16_t b2 = UINT16_MAX;
+#endif
+#ifdef UINT32_MAX
+uint32_t b3 = UINT32_MAX;
+#endif
+#ifdef UINT64_MAX
+uint64_t b4 = UINT64_MAX;
+#endif
+int_least8_t c1 = INT8_C (0x7f);
+int_least8_t c1max = INT_LEAST8_MAX;
+int_least8_t c1min = INT_LEAST8_MIN;
+int_least16_t c2 = INT16_C (0x7fff);
+int_least16_t c2max = INT_LEAST16_MAX;
+int_least16_t c2min = INT_LEAST16_MIN;
+int_least32_t c3 = INT32_C (0x7fffffff);
+int_least32_t c3max = INT_LEAST32_MAX;
+int_least32_t c3min = INT_LEAST32_MIN;
+int_least64_t c4 = INT64_C (0x7fffffffffffffff);
+int_least64_t c4max = INT_LEAST64_MAX;
+int_least64_t c4min = INT_LEAST64_MIN;
+uint_least8_t d1 = UINT8_C (0xff);
+uint_least8_t d1max = UINT_LEAST8_MAX;
+uint_least16_t d2 = UINT16_C (0xffff);
+uint_least16_t d2max = UINT_LEAST16_MAX;
+uint_least32_t d3 = UINT32_C (0xffffffff);
+uint_least32_t d3max = UINT_LEAST32_MAX;
+uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
+uint_least64_t d4max = UINT_LEAST64_MAX;
+int_fast8_t e1 = INT_FAST8_MAX;
+int_fast8_t e1min = INT_FAST8_MIN;
+int_fast16_t e2 = INT_FAST16_MAX;
+int_fast16_t e2min = INT_FAST16_MIN;
+int_fast32_t e3 = INT_FAST32_MAX;
+int_fast32_t e3min = INT_FAST32_MIN;
+int_fast64_t e4 = INT_FAST64_MAX;
+int_fast64_t e4min = INT_FAST64_MIN;
+uint_fast8_t f1 = UINT_FAST8_MAX;
+uint_fast16_t f2 = UINT_FAST16_MAX;
+uint_fast32_t f3 = UINT_FAST32_MAX;
+uint_fast64_t f4 = UINT_FAST64_MAX;
+#ifdef INTPTR_MAX
+intptr_t g = INTPTR_MAX;
+intptr_t gmin = INTPTR_MIN;
+#endif
+#ifdef UINTPTR_MAX
+uintptr_t h = UINTPTR_MAX;
+#endif
+intmax_t i = INTMAX_MAX;
+uintmax_t j = UINTMAX_MAX;
+
+/* Check that SIZE_MAX has the correct type, if possible.  */
+/* ISO C 11 mandates _Generic, but GCC versions < 4.9 lack it.  */
+#if 201112 <= __STDC_VERSION__ \
+    && (!defined __GNUC__ || 4 < __GNUC__ + (9 <= __GNUC_MINOR__) \
+        || defined __clang__)
+int k = _Generic (SIZE_MAX, size_t: 0);
+#elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \
+       || (0x5110 <= __SUNPRO_C && !__STDC__))
+extern size_t k;
+extern __typeof__ (SIZE_MAX) k;
+#endif
+
+#include <limits.h> /* for CHAR_BIT */
+#define TYPE_MINIMUM(t) \
+  ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
+#define TYPE_MAXIMUM(t) \
+  ((t) ((t) 0 < (t) -1 \
+        ? (t) -1 \
+        : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
+struct s {
+  int check_PTRDIFF:
+      PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
+      && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
+      ? 1 : -1;
+  /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64.  */
+  int check_SIG_ATOMIC:
+      SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
+      && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
+      ? 1 : -1;
+  int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
+  int check_WCHAR:
+      WCHAR_MIN == TYPE_MINIMUM (wchar_t)
+      && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
+      ? 1 : -1;
+  /* Detect bug in mingw.  */
+  int check_WINT:
+      WINT_MIN == TYPE_MINIMUM (wint_t)
+      && WINT_MAX == TYPE_MAXIMUM (wint_t)
+      ? 1 : -1;
+
+  /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others.  */
+  int check_UINT8_C:
+        (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
+  int check_UINT16_C:
+        (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
+
+  /* Detect bugs in OpenBSD 3.9 stdint.h.  */
+#ifdef UINT8_MAX
+  int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
+#endif
+#ifdef UINT16_MAX
+  int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
+#endif
+#ifdef UINT32_MAX
+  int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
+#endif
+#ifdef UINT64_MAX
+  int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
+#endif
+  int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
+  int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
+  int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
+  int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
+  int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
+  int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
+  int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
+  int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
+  int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
+  int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
+  int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
+};
+         ]])],
+         [dnl Determine whether the various *_MIN, *_MAX macros are usable
+          dnl in preprocessor expression. We could do it by compiling a test
+          dnl program for each of these macros. It is faster to run a program
+          dnl that inspects the macro expansion.
+          dnl This detects a bug on HP-UX 11.23/ia64.
+          AC_RUN_IFELSE([
+            AC_LANG_PROGRAM([[
+#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#define __STDC_CONSTANT_MACROS 1
+#define __STDC_LIMIT_MACROS 1
+#include <stdint.h>
+]
+gl_STDINT_INCLUDES
+[
+#include <stdio.h>
+#include <string.h>
+#define MVAL(macro) MVAL1(macro)
+#define MVAL1(expression) #expression
+static const char *macro_values[] =
+  {
+#ifdef INT8_MAX
+    MVAL (INT8_MAX),
+#endif
+#ifdef INT16_MAX
+    MVAL (INT16_MAX),
+#endif
+#ifdef INT32_MAX
+    MVAL (INT32_MAX),
+#endif
+#ifdef INT64_MAX
+    MVAL (INT64_MAX),
+#endif
+#ifdef UINT8_MAX
+    MVAL (UINT8_MAX),
+#endif
+#ifdef UINT16_MAX
+    MVAL (UINT16_MAX),
+#endif
+#ifdef UINT32_MAX
+    MVAL (UINT32_MAX),
+#endif
+#ifdef UINT64_MAX
+    MVAL (UINT64_MAX),
+#endif
+    NULL
+  };
+]], [[
+  const char **mv;
+  for (mv = macro_values; *mv != NULL; mv++)
+    {
+      const char *value = *mv;
+      /* Test whether it looks like a cast expression.  */
+      if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
+          || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
+          || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
+          || strncmp (value, "((int)"/*)*/, 6) == 0
+          || strncmp (value, "((signed short)"/*)*/, 15) == 0
+          || strncmp (value, "((signed char)"/*)*/, 14) == 0)
+        return mv - macro_values + 1;
+    }
+  return 0;
+]])],
+              [gl_cv_header_working_stdint_h=yes],
+              [],
+              [case "$host_os" in
+                                    # Guess yes on native Windows.
+                 mingw* | windows*) gl_cv_header_working_stdint_h="guessing yes" ;;
+                                    # In general, assume it works.
+                 *)                 gl_cv_header_working_stdint_h="guessing yes" ;;
+               esac
+              ])
+         ])
+      ])
+  fi
+
+  HAVE_C99_STDINT_H=0
+  HAVE_SYS_BITYPES_H=0
+  HAVE_SYS_INTTYPES_H=0
+  GL_GENERATE_STDINT_H=true
+  case "$gl_cv_header_working_stdint_h" in
+    *yes)
+      HAVE_C99_STDINT_H=1
+      dnl Now see whether the system <stdint.h> works without
+      dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined.
+      dnl If not, there would be problems when stdint.h is included from C++.
+      AC_CACHE_CHECK([whether stdint.h works without ISO C predefines],
+        [gl_cv_header_stdint_without_STDC_macros],
+        [gl_cv_header_stdint_without_STDC_macros=no
+         AC_COMPILE_IFELSE([
+           AC_LANG_PROGRAM([[
+#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
+#include <stdint.h>
+]
+gl_STDINT_INCLUDES
+[
+intmax_t im = INTMAX_MAX;
+int32_t i32 = INT32_C (0x7fffffff);
+           ]])],
+           [gl_cv_header_stdint_without_STDC_macros=yes])
+        ])
+
+      if test $gl_cv_header_stdint_without_STDC_macros = no; then
+        AC_DEFINE([__STDC_CONSTANT_MACROS], [1],
+          [Define to 1 if the system <stdint.h> predates C++11.])
+        AC_DEFINE([__STDC_LIMIT_MACROS], [1],
+          [Define to 1 if the system <stdint.h> predates C++11.])
+      fi
+      AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.],
+        [gl_cv_header_stdint_width],
+        [gl_cv_header_stdint_width=no
+         AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM([[
+              /* Work if build is not clean.  */
+              #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1
+              #ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+               #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
+              #endif
+              #include <stdint.h>
+              ]gl_STDINT_INCLUDES[
+              int iw = UINTMAX_WIDTH;
+              ]])],
+           [gl_cv_header_stdint_width=yes])])
+      if test "$gl_cv_header_stdint_width" = yes; then
+        GL_GENERATE_STDINT_H=false
+      fi
+      ;;
+    *)
+      dnl Check for <sys/inttypes.h>, and for
+      dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
+      AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
+      if test $ac_cv_header_sys_inttypes_h = yes; then
+        HAVE_SYS_INTTYPES_H=1
+      fi
+      if test $ac_cv_header_sys_bitypes_h = yes; then
+        HAVE_SYS_BITYPES_H=1
+      fi
+      gl_STDINT_TYPE_PROPERTIES
+      ;;
+  esac
+
+  dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH.
+  gl_REPLACE_LIMITS_H
+
+  AC_SUBST([HAVE_C99_STDINT_H])
+  AC_SUBST([HAVE_SYS_BITYPES_H])
+  AC_SUBST([HAVE_SYS_INTTYPES_H])
+])
+
+dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
+dnl Determine the size of each of the given types in bits.
+AC_DEFUN([gl_STDINT_BITSIZEOF],
+[
+  dnl Use a shell loop, to avoid bloating configure, and
+  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
+  dnl   config.h.in,
+  dnl - extra AC_SUBST calls, so that the right substitutions are made.
+  m4_foreach_w([gltype], [$1],
+    [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
+       [Define to the number of bits in type ']gltype['.])])
+  for gltype in $1 ; do
+    AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
+      [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
+         [$2
+#include <limits.h>], [result=unknown])
+       eval gl_cv_bitsizeof_${gltype}=\$result
+      ])
+    eval result=\$gl_cv_bitsizeof_${gltype}
+    if test $result = unknown; then
+      dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
+      dnl do a syntax check even on unused #if conditions and give an error
+      dnl on valid C code like this:
+      dnl   #if 0
+      dnl   # if  > 32
+      dnl   # endif
+      dnl   #endif
+      result=0
+    fi
+    GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
+    AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
+    eval BITSIZEOF_${GLTYPE}=\$result
+  done
+  m4_foreach_w([gltype], [$1],
+    [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
+])
+
+dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
+dnl Determine the signedness of each of the given types.
+dnl Define HAVE_SIGNED_TYPE if type is signed.
+AC_DEFUN([gl_CHECK_TYPES_SIGNED],
+[
+  dnl Use a shell loop, to avoid bloating configure, and
+  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
+  dnl   config.h.in,
+  dnl - extra AC_SUBST calls, so that the right substitutions are made.
+  m4_foreach_w([gltype], [$1],
+    [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
+       [Define to 1 if ']gltype[' is a signed integer type.])])
+  for gltype in $1 ; do
+    AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([$2[
+            int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
+         result=yes, result=no)
+       eval gl_cv_type_${gltype}_signed=\$result
+      ])
+    eval result=\$gl_cv_type_${gltype}_signed
+    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
+    if test "$result" = yes; then
+      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
+      eval HAVE_SIGNED_${GLTYPE}=1
+    else
+      eval HAVE_SIGNED_${GLTYPE}=0
+    fi
+  done
+  m4_foreach_w([gltype], [$1],
+    [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
+])
+
+dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
+dnl Determine the suffix to use for integer constants of the given types.
+dnl Define t_SUFFIX for each such type.
+AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
+[
+  dnl Use a shell loop, to avoid bloating configure, and
+  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
+  dnl   config.h.in,
+  dnl - extra AC_SUBST calls, so that the right substitutions are made.
+  m4_foreach_w([gltype], [$1],
+    [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
+       [Define to l, ll, u, ul, ull, etc., as suitable for
+        constants of type ']gltype['.])])
+  for gltype in $1 ; do
+    AC_CACHE_CHECK([for $gltype integer literal suffix],
+      [gl_cv_type_${gltype}_suffix],
+      [eval gl_cv_type_${gltype}_suffix=no
+       eval result=\$gl_cv_type_${gltype}_signed
+       if test "$result" = yes; then
+         glsufu=
+       else
+         glsufu=u
+       fi
+       for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
+         case $glsuf in
+           '')  gltype1='int';;
+           l)   gltype1='long int';;
+           ll)  gltype1='long long int';;
+           i64) gltype1='__int64';;
+           u)   gltype1='unsigned int';;
+           ul)  gltype1='unsigned long int';;
+           ull) gltype1='unsigned long long int';;
+           ui64)gltype1='unsigned __int64';;
+         esac
+         AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM([$2[
+              extern $gltype foo;
+              extern $gltype1 foo;]])],
+           [eval gl_cv_type_${gltype}_suffix=\$glsuf])
+         eval result=\$gl_cv_type_${gltype}_suffix
+         test "$result" != no && break
+       done])
+    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
+    eval result=\$gl_cv_type_${gltype}_suffix
+    test "$result" = no && result=
+    eval ${GLTYPE}_SUFFIX=\$result
+    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
+  done
+  m4_foreach_w([gltype], [$1],
+    [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
+])
+
+dnl gl_STDINT_INCLUDES
+AC_DEFUN([gl_STDINT_INCLUDES],
+[[
+  #include <stddef.h>
+  #include <signal.h>
+  #if HAVE_WCHAR_H
+  # include <wchar.h>
+  #endif
+]])
+
+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.in.h.
+AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
+[
+  AC_REQUIRE([gl_MULTIARCH])
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
+    gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
+      [gl_STDINT_INCLUDES])
+  fi
+  gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
+    [gl_STDINT_INCLUDES])
+  gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
+    [gl_STDINT_INCLUDES])
+  gl_cv_type_ptrdiff_t_signed=yes
+  gl_cv_type_size_t_signed=no
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
+    gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
+      [gl_STDINT_INCLUDES])
+  fi
+  gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
+    [gl_STDINT_INCLUDES])
+
+  dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99
+  dnl requirement that wint_t is "unchanged by default argument promotions".
+  dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t.
+  dnl Set the variable BITSIZEOF_WINT_T accordingly.
+  if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
+    BITSIZEOF_WINT_T=32
+  fi
+])
deleted file mode 120000 (symlink)
index fadbc7292bdf4a6a5817a2d5843ff7ba8ab9c490..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stdint_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ee9773a81b29b7f51aca9187071a69840202b1c2
--- /dev/null
@@ -0,0 +1,27 @@
+# stdint_h.m4 serial 9
+dnl Copyright (C) 1997-2004, 2006, 2008-2024 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_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([gl_AC_HEADER_STDINT_H],
+[
+  AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <sys/types.h>
+            #include <stdint.h>]],
+          [[uintmax_t i = (uintmax_t) -1; return !i;]])],
+       [gl_cv_header_stdint_h=yes],
+       [gl_cv_header_stdint_h=no])])
+  if test $gl_cv_header_stdint_h = yes; then
+    AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1],
+      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
+       and declares uintmax_t. ])
+  fi
+])
deleted file mode 120000 (symlink)
index f32bdefbbeea64177c6f090f339d68c1d30b9bc1..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stdio_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c19feefe717083974523e0484a8ca8a530f15bf7
--- /dev/null
@@ -0,0 +1,255 @@
+# stdio_h.m4 serial 63
+dnl Copyright (C) 2007-2024 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_STDIO_H_EARLY],
+[
+  dnl Defining __USE_MINGW_ANSI_STDIO to 1 must be done early, because
+  dnl the results of several configure tests depend on it: The tests
+  dnl   - checking whether snprintf returns a byte count as in C99...
+  dnl   - checking whether snprintf truncates the result as in C99...
+  dnl   - checking whether printf supports the 'F' directive...
+  dnl   - checking whether printf supports the grouping flag...
+  dnl   - checking whether printf supports the zero flag correctly...
+  dnl   - checking whether printf supports infinite 'double' arguments...
+  dnl   - checking whether printf supports large precisions...
+  dnl report 'yes' if __USE_MINGW_ANSI_STDIO is 1 but 'no' if
+  dnl __USE_MINGW_ANSI_STDIO is not set.
+  AH_VERBATIM([MINGW_ANSI_STDIO],
+[/* Use GNU style printf and scanf.  */
+#ifndef __USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
+])
+  AC_DEFINE([__USE_MINGW_ANSI_STDIO])
+])
+
+AC_DEFUN_ONCE([gl_STDIO_H],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  gl_NEXT_HEADERS([stdio.h])
+
+  dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and
+  dnl inttypes.h behave like gnu instead of system; we must give our
+  dnl printf wrapper the right attribute to match.
+  AC_CACHE_CHECK([which flavor of printf attribute matches inttypes macros],
+    [gl_cv_func_printf_attribute_flavor],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+       #define __STDC_FORMAT_MACROS 1
+       #include <stdio.h>
+       #include <inttypes.h>
+       /* For non-mingw systems, compilation will trivially succeed.
+          For mingw, compilation will succeed for older mingw (system
+          printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */
+       #if (defined _WIN32 && ! defined __CYGWIN__) && \
+         (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+       extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1];
+       #endif
+      ]])], [gl_cv_func_printf_attribute_flavor=system],
+      [gl_cv_func_printf_attribute_flavor=gnu])])
+  if test "$gl_cv_func_printf_attribute_flavor" = gnu; then
+    AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1],
+      [Define to 1 if printf and friends should be labeled with
+       attribute "__gnu_printf__" instead of "__printf__"])
+  fi
+
+  dnl For defining _PRINTF_NAN_LEN_MAX.
+  gl_MUSL_LIBC
+
+  dnl This ifdef is an optimization, to avoid performing a configure check whose
+  dnl result is not used. But it does not make the test of
+  dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant.
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    gl_NONBLOCKING_IO
+    if test $gl_cv_have_nonblocking != yes; then
+      REPLACE_STDIO_READ_FUNCS=1
+    fi
+  ])
+
+  dnl This ifdef is an optimization, to avoid performing a configure check whose
+  dnl result is not used. But it does not make the test of
+  dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant.
+  m4_ifdef([gl_SIGNAL_SIGPIPE], [
+    gl_SIGNAL_SIGPIPE
+    if test $gl_cv_header_signal_h_SIGPIPE != yes; then
+      REPLACE_STDIO_WRITE_FUNCS=1
+    fi
+  ])
+  dnl This ifdef is an optimization, to avoid performing a configure check whose
+  dnl result is not used. But it does not make the test of
+  dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant.
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    gl_NONBLOCKING_IO
+    if test $gl_cv_have_nonblocking != yes; then
+      REPLACE_STDIO_WRITE_FUNCS=1
+    fi
+  ])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by both C89 and C11.
+  gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
+    ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen
+    renameat snprintf tmpfile vdprintf vsnprintf])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS_ONCE([fcloseall])
+  if test $ac_cv_have_decl_fcloseall = no; then
+    HAVE_DECL_FCLOSEALL=0
+  fi
+
+  AC_CHECK_DECLS_ONCE([getw])
+  if test $ac_cv_have_decl_getw = no; then
+    HAVE_DECL_GETW=0
+  fi
+
+  AC_CHECK_DECLS_ONCE([putw])
+  if test $ac_cv_have_decl_putw = no; then
+    HAVE_DECL_PUTW=0
+  fi
+])
+
+# gl_STDIO_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_STDIO_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN_GNU])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREAD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREOPEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSCANF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEKO])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTCHAR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMOVE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FILENO], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETW], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTW], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TEMPNAM], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_STDIO_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_DECL_FCLOSEALL=1;         AC_SUBST([HAVE_DECL_FCLOSEALL])
+  HAVE_DECL_FPURGE=1;            AC_SUBST([HAVE_DECL_FPURGE])
+  HAVE_DECL_FSEEKO=1;            AC_SUBST([HAVE_DECL_FSEEKO])
+  HAVE_DECL_FTELLO=1;            AC_SUBST([HAVE_DECL_FTELLO])
+  HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
+  HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
+  HAVE_DECL_GETW=1;              AC_SUBST([HAVE_DECL_GETW])
+  HAVE_DECL_OBSTACK_PRINTF=1;    AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
+  HAVE_DECL_PUTW=1;              AC_SUBST([HAVE_DECL_PUTW])
+  HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
+  HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
+  HAVE_DPRINTF=1;                AC_SUBST([HAVE_DPRINTF])
+  HAVE_FSEEKO=1;                 AC_SUBST([HAVE_FSEEKO])
+  HAVE_FTELLO=1;                 AC_SUBST([HAVE_FTELLO])
+  HAVE_PCLOSE=1;                 AC_SUBST([HAVE_PCLOSE])
+  HAVE_POPEN=1;                  AC_SUBST([HAVE_POPEN])
+  HAVE_RENAMEAT=1;               AC_SUBST([HAVE_RENAMEAT])
+  HAVE_VASPRINTF=1;              AC_SUBST([HAVE_VASPRINTF])
+  HAVE_VDPRINTF=1;               AC_SUBST([HAVE_VDPRINTF])
+  REPLACE_DPRINTF=0;             AC_SUBST([REPLACE_DPRINTF])
+  REPLACE_FCLOSE=0;              AC_SUBST([REPLACE_FCLOSE])
+  REPLACE_FDOPEN=0;              AC_SUBST([REPLACE_FDOPEN])
+  REPLACE_FFLUSH=0;              AC_SUBST([REPLACE_FFLUSH])
+  REPLACE_FOPEN=0;               AC_SUBST([REPLACE_FOPEN])
+  REPLACE_FOPEN_FOR_FOPEN_GNU=0; AC_SUBST([REPLACE_FOPEN_FOR_FOPEN_GNU])
+  REPLACE_FPRINTF=0;             AC_SUBST([REPLACE_FPRINTF])
+  REPLACE_FPURGE=0;              AC_SUBST([REPLACE_FPURGE])
+  REPLACE_FREOPEN=0;             AC_SUBST([REPLACE_FREOPEN])
+  REPLACE_FSEEK=0;               AC_SUBST([REPLACE_FSEEK])
+  REPLACE_FSEEKO=0;              AC_SUBST([REPLACE_FSEEKO])
+  REPLACE_FTELL=0;               AC_SUBST([REPLACE_FTELL])
+  REPLACE_FTELLO=0;              AC_SUBST([REPLACE_FTELLO])
+  REPLACE_GETDELIM=0;            AC_SUBST([REPLACE_GETDELIM])
+  REPLACE_GETLINE=0;             AC_SUBST([REPLACE_GETLINE])
+  REPLACE_OBSTACK_PRINTF=0;      AC_SUBST([REPLACE_OBSTACK_PRINTF])
+  REPLACE_PERROR=0;              AC_SUBST([REPLACE_PERROR])
+  REPLACE_POPEN=0;               AC_SUBST([REPLACE_POPEN])
+  REPLACE_PRINTF=0;              AC_SUBST([REPLACE_PRINTF])
+  REPLACE_REMOVE=0;              AC_SUBST([REPLACE_REMOVE])
+  REPLACE_RENAME=0;              AC_SUBST([REPLACE_RENAME])
+  REPLACE_RENAMEAT=0;            AC_SUBST([REPLACE_RENAMEAT])
+  REPLACE_SNPRINTF=0;            AC_SUBST([REPLACE_SNPRINTF])
+  REPLACE_SPRINTF=0;             AC_SUBST([REPLACE_SPRINTF])
+  REPLACE_STDIO_READ_FUNCS=0;    AC_SUBST([REPLACE_STDIO_READ_FUNCS])
+  REPLACE_STDIO_WRITE_FUNCS=0;   AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
+  REPLACE_TMPFILE=0;             AC_SUBST([REPLACE_TMPFILE])
+  REPLACE_VASPRINTF=0;           AC_SUBST([REPLACE_VASPRINTF])
+  REPLACE_VDPRINTF=0;            AC_SUBST([REPLACE_VDPRINTF])
+  REPLACE_VFPRINTF=0;            AC_SUBST([REPLACE_VFPRINTF])
+  REPLACE_VPRINTF=0;             AC_SUBST([REPLACE_VPRINTF])
+  REPLACE_VSNPRINTF=0;           AC_SUBST([REPLACE_VSNPRINTF])
+  REPLACE_VSPRINTF=0;            AC_SUBST([REPLACE_VSPRINTF])
+])
deleted file mode 120000 (symlink)
index fdf7a7d9576d6de31f96a393cfada1ae9d5cd1ea..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stdlib_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..92e67a74bb517c315760e58b402043212e1cc211
--- /dev/null
@@ -0,0 +1,258 @@
+# stdlib_h.m4 serial 76
+dnl Copyright (C) 2007-2024 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_ONCE([gl_STDLIB_H],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  gl_NEXT_HEADERS([stdlib.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
+#if HAVE_SYS_LOADAVG_H
+/* OpenIndiana has a bug: <sys/time.h> must be included before
+   <sys/loadavg.h>.  */
+# include <sys/time.h>
+# include <sys/loadavg.h>
+#endif
+#if HAVE_RANDOM_H
+# include <random.h>
+#endif
+    ]], [_Exit aligned_alloc atoll canonicalize_file_name free
+    getloadavg getprogname getsubopt grantpt
+    initstate initstate_r mbstowcs mbtowc mkdtemp mkostemp mkostemps mkstemp
+    mkstemps posix_memalign posix_openpt ptsname ptsname_r qsort_r
+    random random_r reallocarray realpath rpmatch secure_getenv setenv
+    setstate setstate_r srandom srandom_r
+    strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  dnl Test whether MB_CUR_MAX needs to be overridden.
+  dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4.
+  dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_CACHE_CHECK([whether MB_CUR_MAX is correct],
+    [gl_cv_macro_MB_CUR_MAX_good],
+    [
+      dnl Initial guess, used when cross-compiling or when no suitable locale
+      dnl is present.
+changequote(,)dnl
+      case "$host_os" in
+                  # Guess no on Solaris.
+        solaris*) gl_cv_macro_MB_CUR_MAX_good="guessing no" ;;
+                  # Guess yes otherwise.
+        *)        gl_cv_macro_MB_CUR_MAX_good="guessing yes" ;;
+      esac
+changequote([,])dnl
+      if test $LOCALE_FR_UTF8 != none; then
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdlib.h>
+int main ()
+{
+  int result = 0;
+  if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      if (MB_CUR_MAX < 4)
+        result |= 1;
+    }
+  return result;
+}]])],
+          [gl_cv_macro_MB_CUR_MAX_good=yes],
+          [gl_cv_macro_MB_CUR_MAX_good=no],
+          [:])
+      fi
+    ])
+  case "$gl_cv_macro_MB_CUR_MAX_good" in
+    *yes) ;;
+    *) REPLACE_MB_CUR_MAX=1 ;;
+  esac
+
+  AC_CHECK_DECLS_ONCE([ecvt])
+  if test $ac_cv_have_decl_ecvt = no; then
+    HAVE_DECL_ECVT=0
+  fi
+  AC_CHECK_DECLS_ONCE([fcvt])
+  if test $ac_cv_have_decl_fcvt = no; then
+    HAVE_DECL_FCVT=0
+  fi
+  AC_CHECK_DECLS_ONCE([gcvt])
+  if test $ac_cv_have_decl_gcvt = no; then
+    HAVE_DECL_GCVT=0
+  fi
+])
+
+# gl_STDLIB_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_STDLIB_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPROGNAME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOWCS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMPS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMPS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_MEMALIGN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_OPENPT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAND])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOULL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYSTEM_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLOCKPT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNSETENV])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOMB])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ECVT], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCVT], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GCVT], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKTEMP], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTENV], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_STDLIB_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE__EXIT=1;              AC_SUBST([HAVE__EXIT])
+  HAVE_ALIGNED_ALLOC=1;      AC_SUBST([HAVE_ALIGNED_ALLOC])
+  HAVE_ATOLL=1;              AC_SUBST([HAVE_ATOLL])
+  HAVE_CANONICALIZE_FILE_NAME=1;  AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
+  HAVE_DECL_ECVT=1;          AC_SUBST([HAVE_DECL_ECVT])
+  HAVE_DECL_FCVT=1;          AC_SUBST([HAVE_DECL_FCVT])
+  HAVE_DECL_GCVT=1;          AC_SUBST([HAVE_DECL_GCVT])
+  HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
+  HAVE_DECL_PROGRAM_INVOCATION_NAME=1; AC_SUBST([HAVE_DECL_PROGRAM_INVOCATION_NAME])
+  HAVE_GETPROGNAME=1;        AC_SUBST([HAVE_GETPROGNAME])
+  HAVE_GETSUBOPT=1;          AC_SUBST([HAVE_GETSUBOPT])
+  HAVE_GRANTPT=1;            AC_SUBST([HAVE_GRANTPT])
+  HAVE_INITSTATE=1;          AC_SUBST([HAVE_INITSTATE])
+  HAVE_DECL_INITSTATE=1;     AC_SUBST([HAVE_DECL_INITSTATE])
+  HAVE_MBTOWC=1;             AC_SUBST([HAVE_MBTOWC])
+  HAVE_MKDTEMP=1;            AC_SUBST([HAVE_MKDTEMP])
+  HAVE_MKOSTEMP=1;           AC_SUBST([HAVE_MKOSTEMP])
+  HAVE_MKOSTEMPS=1;          AC_SUBST([HAVE_MKOSTEMPS])
+  HAVE_MKSTEMP=1;            AC_SUBST([HAVE_MKSTEMP])
+  HAVE_MKSTEMPS=1;           AC_SUBST([HAVE_MKSTEMPS])
+  HAVE_POSIX_MEMALIGN=1;     AC_SUBST([HAVE_POSIX_MEMALIGN])
+  HAVE_POSIX_OPENPT=1;       AC_SUBST([HAVE_POSIX_OPENPT])
+  HAVE_PTSNAME=1;            AC_SUBST([HAVE_PTSNAME])
+  HAVE_PTSNAME_R=1;          AC_SUBST([HAVE_PTSNAME_R])
+  HAVE_QSORT_R=1;            AC_SUBST([HAVE_QSORT_R])
+  HAVE_RANDOM=1;             AC_SUBST([HAVE_RANDOM])
+  HAVE_RANDOM_H=1;           AC_SUBST([HAVE_RANDOM_H])
+  HAVE_RANDOM_R=1;           AC_SUBST([HAVE_RANDOM_R])
+  HAVE_REALLOCARRAY=1;       AC_SUBST([HAVE_REALLOCARRAY])
+  HAVE_REALPATH=1;           AC_SUBST([HAVE_REALPATH])
+  HAVE_RPMATCH=1;            AC_SUBST([HAVE_RPMATCH])
+  HAVE_SECURE_GETENV=1;      AC_SUBST([HAVE_SECURE_GETENV])
+  HAVE_SETENV=1;             AC_SUBST([HAVE_SETENV])
+  HAVE_DECL_SETENV=1;        AC_SUBST([HAVE_DECL_SETENV])
+  HAVE_SETSTATE=1;           AC_SUBST([HAVE_SETSTATE])
+  HAVE_DECL_SETSTATE=1;      AC_SUBST([HAVE_DECL_SETSTATE])
+  HAVE_STRTOD=1;             AC_SUBST([HAVE_STRTOD])
+  HAVE_STRTOL=1;             AC_SUBST([HAVE_STRTOL])
+  HAVE_STRTOLD=1;            AC_SUBST([HAVE_STRTOLD])
+  HAVE_STRTOLL=1;            AC_SUBST([HAVE_STRTOLL])
+  HAVE_STRTOUL=1;            AC_SUBST([HAVE_STRTOUL])
+  HAVE_STRTOULL=1;           AC_SUBST([HAVE_STRTOULL])
+  HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
+  HAVE_SYS_LOADAVG_H=0;      AC_SUBST([HAVE_SYS_LOADAVG_H])
+  HAVE_UNLOCKPT=1;           AC_SUBST([HAVE_UNLOCKPT])
+  HAVE_DECL_UNSETENV=1;      AC_SUBST([HAVE_DECL_UNSETENV])
+  REPLACE__EXIT=0;           AC_SUBST([REPLACE__EXIT])
+  REPLACE_ALIGNED_ALLOC=0;   AC_SUBST([REPLACE_ALIGNED_ALLOC])
+  REPLACE_CALLOC_FOR_CALLOC_GNU=0;    AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU])
+  REPLACE_CALLOC_FOR_CALLOC_POSIX=0;  AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX])
+  REPLACE_CANONICALIZE_FILE_NAME=0;  AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
+  REPLACE_FREE=0;            AC_SUBST([REPLACE_FREE])
+  REPLACE_GETLOADAVG=0;      AC_SUBST([REPLACE_GETLOADAVG])
+  REPLACE_GETPROGNAME=0;     AC_SUBST([REPLACE_GETPROGNAME])
+  REPLACE_GETSUBOPT=0;       AC_SUBST([REPLACE_GETSUBOPT])
+  REPLACE_INITSTATE=0;       AC_SUBST([REPLACE_INITSTATE])
+  REPLACE_MALLOC_FOR_MALLOC_GNU=0;    AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU])
+  REPLACE_MALLOC_FOR_MALLOC_POSIX=0;  AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX])
+  REPLACE_MB_CUR_MAX=0;      AC_SUBST([REPLACE_MB_CUR_MAX])
+  REPLACE_MBSTOWCS=0;        AC_SUBST([REPLACE_MBSTOWCS])
+  REPLACE_MBTOWC=0;          AC_SUBST([REPLACE_MBTOWC])
+  REPLACE_MKOSTEMP=0;        AC_SUBST([REPLACE_MKOSTEMP])
+  REPLACE_MKOSTEMPS=0;       AC_SUBST([REPLACE_MKOSTEMPS])
+  REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
+  REPLACE_POSIX_MEMALIGN=0;  AC_SUBST([REPLACE_POSIX_MEMALIGN])
+  REPLACE_POSIX_OPENPT=0;    AC_SUBST([REPLACE_POSIX_OPENPT])
+  REPLACE_PTSNAME=0;         AC_SUBST([REPLACE_PTSNAME])
+  REPLACE_PTSNAME_R=0;       AC_SUBST([REPLACE_PTSNAME_R])
+  REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
+  REPLACE_QSORT_R=0;         AC_SUBST([REPLACE_QSORT_R])
+  REPLACE_RAND=0;            AC_SUBST([REPLACE_RAND])
+  REPLACE_RANDOM=0;          AC_SUBST([REPLACE_RANDOM])
+  REPLACE_RANDOM_R=0;        AC_SUBST([REPLACE_RANDOM_R])
+  REPLACE_REALLOC_FOR_REALLOC_GNU=0;    AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU])
+  REPLACE_REALLOC_FOR_REALLOC_POSIX=0;  AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX])
+  REPLACE_REALLOCARRAY=0;    AC_SUBST([REPLACE_REALLOCARRAY])
+  REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
+  REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
+  REPLACE_SETSTATE=0;        AC_SUBST([REPLACE_SETSTATE])
+  REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
+  REPLACE_STRTOL=0;          AC_SUBST([REPLACE_STRTOL])
+  REPLACE_STRTOLD=0;         AC_SUBST([REPLACE_STRTOLD])
+  REPLACE_STRTOLL=0;         AC_SUBST([REPLACE_STRTOLL])
+  REPLACE_STRTOUL=0;         AC_SUBST([REPLACE_STRTOUL])
+  REPLACE_STRTOULL=0;        AC_SUBST([REPLACE_STRTOULL])
+  REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
+  REPLACE_WCTOMB=0;          AC_SUBST([REPLACE_WCTOMB])
+])
deleted file mode 120000 (symlink)
index d42a447fbe815e76115a7c3062a576544a26a229..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/stpcpy.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..04c8bbe4c94963afbd0df059186b3e8117ef7372
--- /dev/null
@@ -0,0 +1,28 @@
+# stpcpy.m4 serial 11
+dnl Copyright (C) 2002, 2007, 2009-2024 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_STPCPY],
+[
+  dnl Persuade glibc <string.h> to declare stpcpy().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl The stpcpy() declaration in lib/string.in.h uses 'restrict'.
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  gl_CHECK_FUNCS_ANDROID([stpcpy], [[#include <string.h>]])
+  if test $ac_cv_func_stpcpy = no; then
+    HAVE_STPCPY=0
+    case "$gl_cv_onwards_func_stpcpy" in
+      future*) REPLACE_STPCPY=1 ;;
+    esac
+  fi
+])
+
+# Prerequisites of lib/stpcpy.c.
+AC_DEFUN([gl_PREREQ_STPCPY], [
+  :
+])
deleted file mode 120000 (symlink)
index 42dea5dc8391f153a2fd99649f726ea93f0acaac..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strdup.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..491f760ce29a129023e4459663f4a1a34decb0bc
--- /dev/null
@@ -0,0 +1,32 @@
+# strdup.m4 serial 15
+
+dnl Copyright (C) 2002-2024 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_STRDUP],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([strdup])
+  if test $ac_cv_have_decl_strdup = no; then
+    HAVE_DECL_STRDUP=0
+  fi
+])
+
+AC_DEFUN([gl_FUNC_STRDUP_POSIX],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
+  if test $gl_cv_func_malloc_posix != yes; then
+    REPLACE_STRDUP=1
+  fi
+  AC_CHECK_DECLS_ONCE([strdup])
+  if test $ac_cv_have_decl_strdup = no; then
+    HAVE_DECL_STRDUP=0
+  fi
+])
+
+# Prerequisites of lib/strdup.c.
+AC_DEFUN([gl_PREREQ_STRDUP], [:])
deleted file mode 120000 (symlink)
index de34d68dbe61dae949c2bb0e106dbbcc8b0129bf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strerror.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a1d1261270a88763124753ce016f773c9c10f4aa
--- /dev/null
@@ -0,0 +1,102 @@
+# strerror.m4 serial 25
+dnl Copyright (C) 2002, 2007-2024 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_STRERROR],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  AC_REQUIRE([gl_HEADER_ERRNO_H])
+  AC_REQUIRE([gl_FUNC_STRERROR_0])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
+    AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
+  ])
+  if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" = false:0; then
+    AC_CACHE_CHECK([for working strerror function],
+     [gl_cv_func_working_strerror],
+     [AC_RUN_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <string.h>
+           ]],
+           [[if (!*strerror (-2)) return 1;]])],
+        [gl_cv_func_working_strerror=yes],
+        [gl_cv_func_working_strerror=no],
+        [case "$host_os" in
+                               # Guess yes on glibc systems.
+           *-gnu* | gnu*)      gl_cv_func_working_strerror="guessing yes" ;;
+                               # Guess yes on musl systems.
+           *-musl* | midipix*) gl_cv_func_working_strerror="guessing yes" ;;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_working_strerror="$gl_cross_guess_normal" ;;
+         esac
+        ])
+    ])
+    case "$gl_cv_func_working_strerror" in
+      *yes) ;;
+      *)
+        dnl The system's strerror() fails to return a string for out-of-range
+        dnl integers. Replace it.
+        REPLACE_STRERROR=1
+        ;;
+    esac
+    m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [
+      dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's
+      dnl buffer, we must replace strerror.
+      case "$gl_cv_func_strerror_r_works" in
+        *no) REPLACE_STRERROR=1 ;;
+      esac
+    ])
+  else
+    dnl The system's strerror() cannot know about the new errno values we add
+    dnl to <errno.h>, or any fix for strerror(0). Replace it.
+    REPLACE_STRERROR=1
+  fi
+])
+
+dnl Detect if strerror(0) passes (that is, does not set errno, and does not
+dnl return a string that matches strerror(-1)).
+AC_DEFUN([gl_FUNC_STRERROR_0],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  REPLACE_STRERROR_0=0
+  AC_CACHE_CHECK([whether strerror(0) succeeds],
+   [gl_cv_func_strerror_0_works],
+   [AC_RUN_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[#include <string.h>
+           #include <errno.h>
+         ]],
+         [[int result = 0;
+           char *str;
+           errno = 0;
+           str = strerror (0);
+           if (!*str) result |= 1;
+           if (errno) result |= 2;
+           if (strstr (str, "nknown") || strstr (str, "ndefined"))
+             result |= 4;
+           return result;]])],
+      [gl_cv_func_strerror_0_works=yes],
+      [gl_cv_func_strerror_0_works=no],
+      [case "$host_os" in
+                             # Guess yes on glibc systems.
+         *-gnu* | gnu*)      gl_cv_func_strerror_0_works="guessing yes" ;;
+                             # Guess yes on musl systems.
+         *-musl* | midipix*) gl_cv_func_strerror_0_works="guessing yes" ;;
+                             # Guess yes on native Windows.
+         mingw* | windows*)  gl_cv_func_strerror_0_works="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+         *)                  gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;;
+       esac
+      ])
+  ])
+  case "$gl_cv_func_strerror_0_works" in
+    *yes) ;;
+    *)
+      REPLACE_STRERROR_0=1
+      AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0)
+        does not return a message implying success.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 638d662da45241078b5636f5dc72c872335b3e11..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strerror_r.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..903d03c361956a5731671cd024b5f8d42a838c0a
--- /dev/null
@@ -0,0 +1,180 @@
+# strerror_r.m4 serial 26
+dnl Copyright (C) 2002, 2007-2024 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_STRERROR_R],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
+
+  dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT
+  dnl are not defined.
+  AC_CHECK_DECLS_ONCE([strerror_r])
+  if test $ac_cv_have_decl_strerror_r = no; then
+    HAVE_DECL_STRERROR_R=0
+  fi
+
+  if test $ac_cv_func_strerror_r = yes; then
+    if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" = false:0; then
+      if test $gl_cv_func_strerror_r_posix_signature = yes; then
+        case "$gl_cv_func_strerror_r_works" in
+          dnl The system's strerror_r has bugs.  Replace it.
+          *no) REPLACE_STRERROR_R=1 ;;
+        esac
+      else
+        dnl The system's strerror_r() has a wrong signature. Replace it.
+        REPLACE_STRERROR_R=1
+      fi
+    else
+      dnl The system's strerror_r() cannot know about the new errno values we
+      dnl add to <errno.h>, or any fix for strerror(0). Replace it.
+      REPLACE_STRERROR_R=1
+    fi
+  fi
+])
+
+# Prerequisites of lib/strerror_r.c.
+AC_DEFUN([gl_PREREQ_STRERROR_R], [
+  AC_REQUIRE([AC_FUNC_STRERROR_R])
+  dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r.
+  AC_CHECK_FUNCS_ONCE([__xpg_strerror_r])
+  gl_CHECK_FUNCS_ANDROID([catgets], [[#include <nl_types.h>]])
+  AC_CHECK_FUNCS_ONCE([snprintf])
+])
+
+# Detect if strerror_r works, but without affecting whether a replacement
+# strerror_r will be used.
+AC_DEFUN([gl_FUNC_STRERROR_R_WORKS],
+[
+  AC_REQUIRE([gl_HEADER_ERRNO_H])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Persuade Android <string.h> to use the GNU strerror_r API,
+  dnl and Solaris <string.h> to declare strerror_r.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_FUNC_STRERROR_0])
+
+  gl_CHECK_FUNCS_ANDROID([strerror_r], [[#include <string.h>]])
+  if test $ac_cv_func_strerror_r = yes; then
+    if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" = false:0; then
+      dnl The POSIX prototype is:  int strerror_r (int, char *, size_t);
+      dnl glibc, Cygwin:           char *strerror_r (int, char *, size_t);
+      dnl AIX 5.1, OSF/1 5.1:      int strerror_r (int, char *, int);
+      AC_CACHE_CHECK([for strerror_r with POSIX signature],
+        [gl_cv_func_strerror_r_posix_signature],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <string.h>
+                int strerror_r (int, char *, size_t);
+              ]],
+              [])],
+           [gl_cv_func_strerror_r_posix_signature=yes],
+           [gl_cv_func_strerror_r_posix_signature=no])
+        ])
+      if test $gl_cv_func_strerror_r_posix_signature = yes; then
+        dnl AIX 6.1 strerror_r fails by returning -1, not an error number.
+        dnl HP-UX 11.31 strerror_r always fails when the buffer length argument
+        dnl is less than 80.
+        dnl FreeBSD 8.s strerror_r claims failure on 0
+        dnl Mac OS X 10.5 strerror_r treats 0 like -1
+        dnl Solaris 10 strerror_r corrupts errno on failure
+        AC_CACHE_CHECK([whether strerror_r works],
+          [gl_cv_func_strerror_r_works],
+          [AC_RUN_IFELSE(
+             [AC_LANG_PROGRAM(
+                [[#include <errno.h>
+                  #include <string.h>
+                ]],
+                [[int result = 0;
+                  char buf[79];
+                  if (strerror_r (EACCES, buf, 0) < 0)
+                    result |= 1;
+                  errno = 0;
+                  if (strerror_r (EACCES, buf, sizeof buf) != 0)
+                    result |= 2;
+                  strcpy (buf, "Unknown");
+                  if (strerror_r (0, buf, sizeof buf) != 0)
+                    result |= 4;
+                  if (errno)
+                    result |= 8;
+                  if (strstr (buf, "nknown") || strstr (buf, "ndefined"))
+                    result |= 0x10;
+                  errno = 0;
+                  *buf = 0;
+                  if (strerror_r (-3, buf, sizeof buf) < 0)
+                    result |= 0x20;
+                  if (errno)
+                    result |= 0x40;
+                  if (!*buf)
+                    result |= 0x80;
+                  return result;
+                ]])],
+             [gl_cv_func_strerror_r_works=yes],
+             [gl_cv_func_strerror_r_works=no],
+             [
+changequote(,)dnl
+              case "$host_os" in
+                       # Guess no on AIX.
+                aix*)  gl_cv_func_strerror_r_works="guessing no";;
+                       # Guess no on HP-UX.
+                hpux*) gl_cv_func_strerror_r_works="guessing no";;
+                       # Guess no on BSD variants.
+                *bsd*)  gl_cv_func_strerror_r_works="guessing no";;
+                       # Guess yes otherwise.
+                *)     gl_cv_func_strerror_r_works="guessing yes";;
+              esac
+changequote([,])dnl
+             ])
+          ])
+      else
+        dnl The system's strerror() has a wrong signature.
+        dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r.
+        AC_CHECK_FUNCS_ONCE([__xpg_strerror_r])
+        dnl In glibc < 2.14, __xpg_strerror_r does not populate buf on failure.
+        dnl In cygwin < 1.7.10, __xpg_strerror_r clobbers strerror's buffer.
+        if test $ac_cv_func___xpg_strerror_r = yes; then
+          AC_CACHE_CHECK([whether __xpg_strerror_r works],
+            [gl_cv_func_strerror_r_works],
+            [AC_RUN_IFELSE(
+               [AC_LANG_PROGRAM(
+                  [[#include <errno.h>
+                    #include <string.h>
+                    extern
+                    #ifdef __cplusplus
+                    "C"
+                    #endif
+                    int __xpg_strerror_r(int, char *, size_t);
+                  ]],
+                  [[int result = 0;
+                    char buf[256] = "^";
+                    char copy[256];
+                    char *str = strerror (-1);
+                    strcpy (copy, str);
+                    if (__xpg_strerror_r (-2, buf, 1) == 0)
+                      result |= 1;
+                    if (*buf)
+                      result |= 2;
+                    __xpg_strerror_r (-2, buf, 256);
+                    if (strcmp (str, copy))
+                      result |= 4;
+                    return result;
+                  ]])],
+               [gl_cv_func_strerror_r_works=yes],
+               [gl_cv_func_strerror_r_works=no],
+               [dnl Guess no on all platforms that have __xpg_strerror_r,
+                dnl at least until fixed glibc and cygwin are more common.
+                gl_cv_func_strerror_r_works="$gl_cross_guess_normal"
+               ])
+            ])
+        fi
+      fi
+    fi
+  else
+    case "$gl_cv_onwards_func_strerror_r" in
+      future*) REPLACE_STRERROR_R=1 ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index e65f7aa2f97acf4505ee96208c1b3c9476557ce5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/string_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9ea748cc7740a43cb97ebf059a27a4ef8d0af826
--- /dev/null
@@ -0,0 +1,152 @@
+# Configure a GNU-like replacement for <string.h>.
+
+# Copyright (C) 2007-2024 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.
+
+# serial 39
+
+# Written by Paul Eggert.
+
+AC_DEFUN_ONCE([gl_STRING_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  gl_NEXT_HEADERS([string.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <string.h>
+    ]],
+    [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit
+     rawmemchr stpcpy stpncpy strchrnul
+     strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
+     strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+])
+
+# gl_STRING_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_STRING_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_STRING_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPLICIT_BZERO])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMSET_EXPLICIT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSEP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRCHR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSTR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASECMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNCASECMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPCASECMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASESTR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCSPN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPBRK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSIGNAL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRVERSCMP])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MEMCCPY], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS])
+  dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized.
+  gl_STDLIB_H_REQUIRE_DEFAULTS
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_STRING_H_DEFAULTS],
+[
+  HAVE_MBSLEN=0;             AC_SUBST([HAVE_MBSLEN])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_EXPLICIT_BZERO=1;        AC_SUBST([HAVE_EXPLICIT_BZERO])
+  HAVE_FFSL=1;                  AC_SUBST([HAVE_FFSL])
+  HAVE_FFSLL=1;                 AC_SUBST([HAVE_FFSLL])
+  HAVE_DECL_MEMMEM=1;           AC_SUBST([HAVE_DECL_MEMMEM])
+  HAVE_MEMPCPY=1;               AC_SUBST([HAVE_MEMPCPY])
+  HAVE_MEMSET_EXPLICIT=1;       AC_SUBST([HAVE_MEMSET_EXPLICIT])
+  HAVE_DECL_MEMRCHR=1;          AC_SUBST([HAVE_DECL_MEMRCHR])
+  HAVE_RAWMEMCHR=1;             AC_SUBST([HAVE_RAWMEMCHR])
+  HAVE_STPCPY=1;                AC_SUBST([HAVE_STPCPY])
+  HAVE_STPNCPY=1;               AC_SUBST([HAVE_STPNCPY])
+  HAVE_STRCHRNUL=1;             AC_SUBST([HAVE_STRCHRNUL])
+  HAVE_DECL_STRDUP=1;           AC_SUBST([HAVE_DECL_STRDUP])
+  HAVE_DECL_STRNDUP=1;          AC_SUBST([HAVE_DECL_STRNDUP])
+  HAVE_DECL_STRNLEN=1;          AC_SUBST([HAVE_DECL_STRNLEN])
+  HAVE_STRPBRK=1;               AC_SUBST([HAVE_STRPBRK])
+  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_R=1;       AC_SUBST([HAVE_DECL_STRERROR_R])
+  HAVE_STRERRORNAME_NP=1;       AC_SUBST([HAVE_STRERRORNAME_NP])
+  HAVE_SIGABBREV_NP=1;          AC_SUBST([HAVE_SIGABBREV_NP])
+  HAVE_SIGDESCR_NP=1;           AC_SUBST([HAVE_SIGDESCR_NP])
+  HAVE_DECL_STRSIGNAL=1;        AC_SUBST([HAVE_DECL_STRSIGNAL])
+  HAVE_STRVERSCMP=1;            AC_SUBST([HAVE_STRVERSCMP])
+  REPLACE_FFSLL=0;              AC_SUBST([REPLACE_FFSLL])
+  REPLACE_MEMCHR=0;             AC_SUBST([REPLACE_MEMCHR])
+  REPLACE_MEMMEM=0;             AC_SUBST([REPLACE_MEMMEM])
+  REPLACE_MEMPCPY=0;            AC_SUBST([REPLACE_MEMPCPY])
+  REPLACE_MEMSET_EXPLICIT=0;    AC_SUBST([REPLACE_MEMSET_EXPLICIT])
+  REPLACE_STPCPY=0;             AC_SUBST([REPLACE_STPCPY])
+  REPLACE_STPNCPY=0;            AC_SUBST([REPLACE_STPNCPY])
+  REPLACE_STRCHRNUL=0;          AC_SUBST([REPLACE_STRCHRNUL])
+  REPLACE_STRDUP=0;             AC_SUBST([REPLACE_STRDUP])
+  REPLACE_STRNCAT=0;            AC_SUBST([REPLACE_STRNCAT])
+  REPLACE_STRNDUP=0;            AC_SUBST([REPLACE_STRNDUP])
+  REPLACE_STRNLEN=0;            AC_SUBST([REPLACE_STRNLEN])
+  REPLACE_STRSTR=0;             AC_SUBST([REPLACE_STRSTR])
+  REPLACE_STRCASESTR=0;         AC_SUBST([REPLACE_STRCASESTR])
+  REPLACE_STRTOK_R=0;           AC_SUBST([REPLACE_STRTOK_R])
+  REPLACE_STRERROR=0;           AC_SUBST([REPLACE_STRERROR])
+  REPLACE_STRERROR_R=0;         AC_SUBST([REPLACE_STRERROR_R])
+  REPLACE_STRERRORNAME_NP=0;    AC_SUBST([REPLACE_STRERRORNAME_NP])
+  REPLACE_STRSIGNAL=0;          AC_SUBST([REPLACE_STRSIGNAL])
+  REPLACE_STRVERSCMP=0;         AC_SUBST([REPLACE_STRVERSCMP])
+  UNDEFINE_STRTOK_R=0;          AC_SUBST([UNDEFINE_STRTOK_R])
+])
deleted file mode 120000 (symlink)
index 78340f0754647c3f9124922c34ca6adb8e5a6877..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strnlen.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3eac8e629d7dde0ee1cee292cb8f4b4053cd240b
--- /dev/null
@@ -0,0 +1,30 @@
+# strnlen.m4 serial 14
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation,
+dnl 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_STRNLEN],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+
+  dnl Persuade glibc <string.h> to declare strnlen().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_DECLS_ONCE([strnlen])
+  if test $ac_cv_have_decl_strnlen = no; then
+    HAVE_DECL_STRNLEN=0
+  else
+    m4_pushdef([AC_LIBOBJ], [:])
+    dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]).
+    AC_FUNC_STRNLEN
+    m4_popdef([AC_LIBOBJ])
+    if test $ac_cv_func_strnlen_working = no; then
+      REPLACE_STRNLEN=1
+    fi
+  fi
+])
+
+# Prerequisites of lib/strnlen.c.
+AC_DEFUN([gl_PREREQ_STRNLEN], [:])
deleted file mode 120000 (symlink)
index 6e27e8ef80d7525b8b6f5f640eddef6e952de0c6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strsignal.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d206564a097868ff0c043966f141ac453492507a
--- /dev/null
@@ -0,0 +1,59 @@
+# strsignal.m4 serial 10
+dnl Copyright (C) 2008-2024 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_STRSIGNAL],
+[
+  dnl Persuade glibc <string.h> to declare strsignal().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_CHECK_DECLS_ONCE([strsignal])
+  if test $ac_cv_have_decl_strsignal = no; then
+    HAVE_DECL_STRSIGNAL=0
+  fi
+
+  AC_CHECK_FUNCS([strsignal])
+  if test $ac_cv_func_strsignal = yes; then
+    HAVE_STRSIGNAL=1
+    dnl Check if strsignal behaves reasonably for out-of-range signal numbers.
+    dnl On Solaris it returns NULL; on AIX 5.1 it returns (char *) -1.
+    AC_CACHE_CHECK([whether strsignal always returns a string],
+      [gl_cv_func_working_strsignal],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <string.h>
+#include <unistd.h> /* NetBSD 5.0 declares it in wrong header. */
+            ]],
+            [[int result = 0;
+              char *s = strsignal (-1);
+              if (s == (char *) 0)
+                result |= 1;
+              if (s == (char *) -1)
+                result |= 2;
+              return result;
+            ]])],
+         [gl_cv_func_working_strsignal=yes],
+         [gl_cv_func_working_strsignal=no],
+         [case "$host_os" in
+            solaris* | aix*) gl_cv_func_working_strsignal=no;;
+            *)               gl_cv_func_working_strsignal="guessing yes";;
+          esac])])
+    if test "$gl_cv_func_working_strsignal" = no; then
+      REPLACE_STRSIGNAL=1
+    fi
+  else
+    HAVE_STRSIGNAL=0
+  fi
+])
+
+# Prerequisites of lib/strsignal.c.
+AC_DEFUN([gl_PREREQ_STRSIGNAL], [
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+  AC_CHECK_DECLS([sys_siglist], [], [], [[#include <signal.h>]])
+  AC_CHECK_DECLS([_sys_siglist], [], [], [[#include <signal.h>]])
+])
deleted file mode 120000 (symlink)
index c2ec3895fa7595303cec2224fb2626c17f76e09f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strstr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..21d7768b04630ac263c49db0691776f4a2aa7cf9
--- /dev/null
@@ -0,0 +1,149 @@
+# strstr.m4 serial 24
+dnl Copyright (C) 2008-2024 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 Check that strstr works.
+AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_MEMCHR])
+  if test $REPLACE_MEMCHR = 1; then
+    REPLACE_STRSTR=1
+  else
+    dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092
+    dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637.
+    AC_CACHE_CHECK([whether strstr works],
+      [gl_cv_func_strstr_works_always],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[
+#include <string.h> /* for __GNU_LIBRARY__, strstr */
+#ifdef __GNU_LIBRARY__
+ #include <features.h>
+ #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28
+  Unlucky user
+ #endif
+#endif
+#define P "_EF_BF_BD"
+#define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P
+#define NEEDLE P P P P P
+]],
+            [[return !!strstr (HAYSTACK, NEEDLE);
+            ]])],
+         [gl_cv_func_strstr_works_always=yes],
+         [gl_cv_func_strstr_works_always=no],
+         [dnl glibc 2.12 and cygwin 1.7.7 have a known bug.  uClibc is not
+          dnl affected, since it uses different source code for strstr than
+          dnl glibc.
+          dnl Assume that it works on all other platforms, even if it is not
+          dnl linear.
+          AC_EGREP_CPP([Lucky user],
+            [
+#include <string.h> /* for __GNU_LIBRARY__ */
+#ifdef __GNU_LIBRARY__
+ #include <features.h>
+ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \
+     || defined __UCLIBC__
+  Lucky user
+ #endif
+#elif defined __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
+  Lucky user
+ #endif
+#else
+  Lucky user
+#endif
+            ],
+            [gl_cv_func_strstr_works_always="guessing yes"],
+            [gl_cv_func_strstr_works_always="$gl_cross_guess_normal"])
+         ])
+      ])
+    case "$gl_cv_func_strstr_works_always" in
+      *yes) ;;
+      *)
+        REPLACE_STRSTR=1
+        ;;
+    esac
+  fi
+]) # gl_FUNC_STRSTR_SIMPLE
+
+dnl Additionally, check that strstr is efficient.
+AC_DEFUN([gl_FUNC_STRSTR],
+[
+  AC_REQUIRE([gl_FUNC_STRSTR_SIMPLE])
+  if test $REPLACE_STRSTR = 0; then
+    AC_CACHE_CHECK([whether strstr works in linear time],
+      [gl_cv_func_strstr_linear],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#ifdef __MVS__
+/* z/OS does not deliver signals while strstr() is running (thanks to
+   restrictions on its LE runtime), which prevents us from limiting the
+   running time of this test.  */
+# error "This test does not work properly on z/OS"
+#endif
+#include <signal.h> /* for signal */
+#include <string.h> /* for strstr */
+#include <stdlib.h> /* for malloc */
+#include <unistd.h> /* for alarm */
+static void quit (int sig) { _exit (sig + 128); }
+]], [[
+    int result = 0;
+    size_t m = 1000000;
+    char *haystack = (char *) malloc (2 * m + 2);
+    char *needle = (char *) malloc (m + 2);
+    /* Failure to compile this test due to missing alarm is okay,
+       since all such platforms (mingw) also have quadratic strstr.  */
+    signal (SIGALRM, quit);
+    alarm (5);
+    /* Check for quadratic performance.  */
+    if (haystack && needle)
+      {
+        memset (haystack, 'A', 2 * m);
+        haystack[2 * m] = 'B';
+        haystack[2 * m + 1] = 0;
+        memset (needle, 'A', m);
+        needle[m] = 'B';
+        needle[m + 1] = 0;
+        if (!strstr (haystack, needle))
+          result |= 1;
+      }
+    /* Free allocated memory, in case some sanitizer is watching.  */
+    free (haystack);
+    free (needle);
+    return result;
+    ]])],
+        [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no],
+        [dnl Only glibc > 2.12 on processors without SSE 4.2 instructions and
+         dnl cygwin > 1.7.7 are known to have a bug-free strstr that works in
+         dnl linear time.
+         AC_EGREP_CPP([Lucky user],
+           [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \
+     && !(defined __i386__ || defined __x86_64__) \
+     && !defined __UCLIBC__
+  Lucky user
+ #endif
+#endif
+#ifdef __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
+  Lucky user
+ #endif
+#endif
+           ],
+           [gl_cv_func_strstr_linear="guessing yes"],
+           [gl_cv_func_strstr_linear="$gl_cross_guess_normal"])
+        ])
+      ])
+    case "$gl_cv_func_strstr_linear" in
+      *yes) ;;
+      *)
+        REPLACE_STRSTR=1
+        ;;
+    esac
+  fi
+]) # gl_FUNC_STRSTR
deleted file mode 120000 (symlink)
index 0a7d1463d9e55a20f17fa97694725575155c0f27..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strtoimax.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b58fa48ff6edc58b0dd67cf55c2225c5762e109c
--- /dev/null
@@ -0,0 +1,88 @@
+# strtoimax.m4 serial 17
+dnl Copyright (C) 2002-2004, 2006, 2009-2024 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_STRTOIMAX],
+[
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+
+  dnl On OSF/1 5.1 with cc, this function is declared but not defined.
+  AC_CHECK_FUNCS_ONCE([strtoimax])
+  AC_CHECK_DECLS_ONCE([strtoimax])
+  if test "$ac_cv_have_decl_strtoimax" != yes; then
+    HAVE_DECL_STRTOIMAX=0
+  fi
+
+  if test "$ac_cv_func_strtoimax" = yes; then
+    HAVE_STRTOIMAX=1
+    dnl On AIX 5.1, strtoimax() fails for values outside the 'int' range.
+    AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+    AC_CACHE_CHECK([whether strtoimax works], [gl_cv_func_strtoimax],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE([[
+#include <errno.h>
+#include <string.h>
+#include <inttypes.h>
+int main ()
+{
+  if (sizeof (intmax_t) > sizeof (int))
+    {
+      const char *s = "4294967295";
+      char *p;
+      intmax_t res;
+      errno = 0;
+      res = strtoimax (s, &p, 10);
+      if (p != s + strlen (s))
+        return 1;
+      if (errno != 0)
+        return 2;
+      if (res != (intmax_t) 65535 * (intmax_t) 65537)
+        return 3;
+    }
+  else
+    {
+      const char *s = "2147483647";
+      char *p;
+      intmax_t res;
+      errno = 0;
+      res = strtoimax (s, &p, 10);
+      if (p != s + strlen (s))
+        return 1;
+      if (errno != 0)
+        return 2;
+      if (res != 2147483647)
+        return 3;
+    }
+  return 0;
+}
+]])],
+         [gl_cv_func_strtoimax=yes],
+         [gl_cv_func_strtoimax=no],
+         [case "$host_os" in
+                               # Guess no on AIX 5.
+            aix5*)             gl_cv_func_strtoimax="guessing no" ;;
+                               # Guess yes on native Windows.
+            mingw* | windows*) gl_cv_func_strtoimax="guessing yes" ;;
+                               # Guess yes otherwise.
+            *)                 gl_cv_func_strtoimax="guessing yes" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_strtoimax" in
+      *no) REPLACE_STRTOIMAX=1 ;;
+    esac
+  else
+    if test "$ac_cv_have_decl_strtoimax" = yes; then
+      # HP-UX 11.11 has "#define strtoimax(...) ..." but no function.
+      REPLACE_STRTOIMAX=1
+    fi
+    HAVE_STRTOIMAX=0
+  fi
+])
+
+# Prerequisites of lib/strtoimax.c.
+AC_DEFUN([gl_PREREQ_STRTOIMAX], [
+  AC_CHECK_DECLS([strtoll])
+])
deleted file mode 120000 (symlink)
index 985efe8253a3a223d499603e162efbb7127f21ad..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strtoll.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..130b9094d881571694b741aa83ef3a183612a167
--- /dev/null
@@ -0,0 +1,68 @@
+# strtoll.m4 serial 12
+dnl Copyright (C) 2002, 2004, 2006, 2008-2024 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_STRTOLL],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS([strtoll])
+  if test $ac_cv_func_strtoll = yes; then
+    AC_CACHE_CHECK([whether strtoll works],
+      [gl_cv_func_strtoll_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <stdlib.h>]],
+            [[int result = 0;
+              char *term;
+              /* This test fails on Minix and native Windows.  */
+              {
+                static char const input[2][3] = {"0x", "0b"};
+                static int const base[] = {0, 2, 10};
+                int i, j;
+                for (i = 0; i < 2; i++)
+                  for (j = 0; j < 3; j++)
+                    {
+                      (void) strtoll (input[i], &term, base[j]);
+                      if (term != input[i] + 1)
+                        result |= 1;
+                    }
+              }
+              /* This test fails on pre-C23 platforms.  */
+              {
+                const char input[] = "0b1";
+                (void) strtoll (input, &term, 2);
+                if (term != input + 3)
+                  result |= 2;
+              }
+              return result;
+            ]])
+         ],
+         [gl_cv_func_strtoll_works=yes],
+         [gl_cv_func_strtoll_works=no],
+         [case "$host_os" in
+                                # Guess no on native Windows.
+            mingw* | windows*)  gl_cv_func_strtoll_works="guessing no" ;;
+                                # Guess no on glibc systems.
+            *-gnu* | gnu*)      gl_cv_func_strtoll_works="guessing no" ;;
+                                # Guess no on musl systems.
+            *-musl* | midipix*) gl_cv_func_strtoll_works="guessing no" ;;
+            *)                  gl_cv_func_strtoll_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+    ])
+    case "$gl_cv_func_strtoll_works" in
+      *yes) ;;
+      *)    REPLACE_STRTOLL=1 ;;
+    esac
+  else
+    HAVE_STRTOLL=0
+  fi
+])
+
+# Prerequisites of lib/strtoll.c.
+AC_DEFUN([gl_PREREQ_STRTOLL], [
+  :
+])
deleted file mode 120000 (symlink)
index 5270a0fb558e41f1ed1996c27845da8af57431bc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strtoull.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..fad725035fff3af78c2c37c84a461ba7ed784ed1
--- /dev/null
@@ -0,0 +1,62 @@
+# strtoull.m4 serial 11
+dnl Copyright (C) 2002, 2004, 2006, 2008-2024 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_STRTOULL],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS([strtoull])
+  if test $ac_cv_func_strtoull = yes; then
+    AC_CACHE_CHECK([whether strtoull works],
+      [gl_cv_func_strtoull_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <stdlib.h>]],
+            [[int result = 0;
+              char *term;
+              /* This test fails on Minix and native Windows.  */
+              {
+                const char input[] = "0x";
+                (void) strtoull (input, &term, 16);
+                if (term != input + 1)
+                  result |= 1;
+              }
+              /* This test fails on pre-C23 platforms.  */
+              {
+                const char input[] = "0b1";
+                (void) strtoull (input, &term, 2);
+                if (term != input + 3)
+                  result |= 2;
+              }
+              return result;
+            ]])
+         ],
+         [gl_cv_func_strtoull_works=yes],
+         [gl_cv_func_strtoull_works=no],
+         [case "$host_os" in
+                                # Guess no on native Windows.
+            mingw* | windows*)  gl_cv_func_strtoull_works="guessing no" ;;
+                                # Guess no on glibc systems.
+            *-gnu* | gnu*)      gl_cv_func_strtoull_works="guessing no" ;;
+                                # Guess no on musl systems.
+            *-musl* | midipix*) gl_cv_func_strtoull_works="guessing no" ;;
+            *)                  gl_cv_func_strtoull_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+    ])
+    case "$gl_cv_func_strtoull_works" in
+      *yes) ;;
+      *)    REPLACE_STRTOULL=1 ;;
+    esac
+  else
+    HAVE_STRTOULL=0
+  fi
+])
+
+# Prerequisites of lib/strtoull.c.
+AC_DEFUN([gl_PREREQ_STRTOULL], [
+  :
+])
deleted file mode 120000 (symlink)
index 6419bac8a664b384fb28ca8bda20b642e903dd65..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/strtoumax.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e8eb7fa6c1bb147fee985e808e639ca52bf02b57
--- /dev/null
@@ -0,0 +1,27 @@
+# strtoumax.m4 serial 13
+dnl Copyright (C) 2002-2004, 2006, 2009-2024 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_STRTOUMAX],
+[
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+
+  dnl On OSF/1 5.1 with cc, this function is declared but not defined.
+  AC_CHECK_FUNCS_ONCE([strtoumax])
+  AC_CHECK_DECLS_ONCE([strtoumax])
+  if test "$ac_cv_have_decl_strtoumax" = yes; then
+    if test "$ac_cv_func_strtoumax" != yes; then
+      # HP-UX 11.11 has "#define strtoimax(...) ..." but no function.
+      REPLACE_STRTOUMAX=1
+    fi
+  else
+    HAVE_DECL_STRTOUMAX=0
+  fi
+])
+
+# Prerequisites of lib/strtoumax.c.
+AC_DEFUN([gl_PREREQ_STRTOUMAX], [
+  AC_CHECK_DECLS([strtoull])
+])
deleted file mode 120000 (symlink)
index df369a63f7003e140a973ca7923ae9d4ef791c37..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/symlink.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..62062cf14991bb6398f5af93b6073781e84fcea1
--- /dev/null
@@ -0,0 +1,57 @@
+# serial 10
+# See if we need to provide symlink replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_SYMLINK],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([symlink])
+  dnl The best we can do on mingw is provide a dummy that always fails, so
+  dnl that compilation can proceed with fewer ifdefs.  On FreeBSD 7.2, AIX 7.1,
+  dnl and Solaris 9, we want to fix a bug with trailing slash handling.
+  if test $ac_cv_func_symlink = no; then
+    HAVE_SYMLINK=0
+  else
+    AC_CACHE_CHECK([whether symlink handles trailing slash correctly],
+      [gl_cv_func_symlink_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <unistd.h>
+           ]],
+           [[int result = 0;
+             if (!symlink ("a", "conftest.link/"))
+               result |= 1;
+             if (symlink ("conftest.f", "conftest.lnk2"))
+               result |= 2;
+             else if (!symlink ("a", "conftest.lnk2/"))
+               result |= 4;
+             return result;
+           ]])],
+         [gl_cv_func_symlink_works=yes], [gl_cv_func_symlink_works=no],
+         [case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;;
+                             # Guess yes on systems that emulate the Linux system calls.
+            midipix*)        gl_cv_func_symlink_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_symlink_works="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_symlink_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      rm -f conftest.f conftest.link conftest.lnk2])
+    case "$gl_cv_func_symlink_works" in
+      *yes) ;;
+      *)
+        REPLACE_SYMLINK=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 9f2dc679b7b51e063a5b4b6f950f5c2deaa3b64d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/symlinkat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..afc045d4f5c951e7283687da0e70064650f15ed7
--- /dev/null
@@ -0,0 +1,61 @@
+# serial 13
+# See if we need to provide symlinkat replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_SYMLINKAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_OPENAT])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  gl_CHECK_FUNCS_ANDROID([symlinkat], [[#include <unistd.h>]])
+  if test $ac_cv_func_symlinkat = no; then
+    HAVE_SYMLINKAT=0
+    case "$gl_cv_onwards_func_symlinkat" in
+      future*) REPLACE_SYMLINKAT=1 ;;
+    esac
+  else
+    AC_CACHE_CHECK([whether symlinkat handles trailing slash correctly],
+      [gl_cv_func_symlinkat_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[#include <fcntl.h>
+             #include <unistd.h>
+           ]],
+           [[int result = 0;
+             if (!symlinkat ("a", AT_FDCWD, "conftest.link/"))
+               result |= 1;
+             if (symlinkat ("conftest.f", AT_FDCWD, "conftest.lnk2"))
+               result |= 2;
+             else if (!symlinkat ("a", AT_FDCWD, "conftest.lnk2/"))
+               result |= 4;
+             return result;
+           ]])],
+         [gl_cv_func_symlinkat_works=yes],
+         [gl_cv_func_symlinkat_works=no],
+         [case "$host_os" in
+                             # Guess yes on Linux systems.
+            linux-* | linux) gl_cv_func_symlinkat_works="guessing yes" ;;
+                             # Guess yes on systems that emulate the Linux system calls.
+            midipix*)        gl_cv_func_symlinkat_works="guessing yes" ;;
+                             # Guess yes on glibc systems.
+            *-gnu* | gnu*)   gl_cv_func_symlinkat_works="guessing yes" ;;
+                             # If we don't know, obey --enable-cross-guesses.
+            *)               gl_cv_func_symlinkat_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      rm -f conftest.f conftest.link conftest.lnk2])
+    case "$gl_cv_func_symlinkat_works" in
+      *yes) ;;
+      *)
+        REPLACE_SYMLINKAT=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 7a90906dde9310644d5cd1701a6ad16be602d39b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_ioctl_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3e789f3d5e82aea385ef6bc8b8c4d56bad1f2f64
--- /dev/null
@@ -0,0 +1,79 @@
+# sys_ioctl_h.m4 serial 15
+dnl Copyright (C) 2008-2024 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 Bruno Haible.
+
+AC_DEFUN_ONCE([gl_SYS_IOCTL_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
+
+  AC_CHECK_HEADERS_ONCE([sys/ioctl.h])
+  if test $ac_cv_header_sys_ioctl_h = yes; then
+    HAVE_SYS_IOCTL_H=1
+    dnl Test whether <sys/ioctl.h> declares ioctl(), or whether some other
+    dnl header file, such as <unistd.h> or <stropts.h>, is needed for that.
+    AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl],
+      [gl_cv_decl_ioctl_in_sys_ioctl_h],
+      [dnl We cannot use AC_CHECK_DECL because it produces its own messages.
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <sys/ioctl.h>]],
+            [[(void) ioctl;]])],
+         [gl_cv_decl_ioctl_in_sys_ioctl_h=yes],
+         [gl_cv_decl_ioctl_in_sys_ioctl_h=no])
+      ])
+  else
+    HAVE_SYS_IOCTL_H=0
+  fi
+  AC_SUBST([HAVE_SYS_IOCTL_H])
+  dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([sys/ioctl.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h>
+/* Some platforms declare ioctl in the wrong header.  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <unistd.h>
+#endif
+    ]], [ioctl])
+])
+
+# gl_SYS_IOCTL_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_IOCTL_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_IOCTL_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_IOCTL_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IOCTL])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_IOCTL_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H])
+  SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
+                        AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
+  REPLACE_IOCTL=0;      AC_SUBST([REPLACE_IOCTL])
+])
deleted file mode 120000 (symlink)
index e01fb8000525aeac758a94d20e8a8912777e43d3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_random_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b050d079b92c91c17fc6dfad77c803765169a614
--- /dev/null
@@ -0,0 +1,68 @@
+# sys_random_h.m4 serial 8
+dnl Copyright (C) 2020-2024 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_ONCE([gl_SYS_RANDOM_H],
+[
+  AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
+  dnl <sys/random.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([sys/random.h])
+  if test $ac_cv_header_sys_random_h = yes; then
+    HAVE_SYS_RANDOM_H=1
+  else
+    HAVE_SYS_RANDOM_H=0
+  fi
+  AC_SUBST([HAVE_SYS_RANDOM_H])
+
+  m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
+  if test $ac_cv_header_sys_random_h = yes; then
+    UNISTD_H_HAVE_SYS_RANDOM_H=1
+  fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+#if HAVE_SYS_RANDOM_H
+/* Additional includes are needed before <sys/random.h> on uClibc
+   and Mac OS X.  */
+# include <sys/types.h>
+# include <stdlib.h>
+# include <sys/random.h>
+#endif
+    ]],
+    [getrandom])
+])
+
+# gl_SYS_RANDOM_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_RANDOM_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_RANDOM_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_RANDOM_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_RANDOM_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETRANDOM])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_RANDOM_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_RANDOM_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_GETRANDOM=1;       AC_SUBST([HAVE_GETRANDOM])
+  REPLACE_GETRANDOM=0;    AC_SUBST([REPLACE_GETRANDOM])
+])
deleted file mode 120000 (symlink)
index b19b31009616451466db98c524df6eec24bd9eb0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_resource_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..050370a3f01d94b61cb4a7401177aa37b5aaab45
--- /dev/null
@@ -0,0 +1,62 @@
+# sys_resource_h.m4 serial 5
+dnl Copyright (C) 2012-2024 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_ONCE([gl_SYS_RESOURCE_H],
+[
+  AC_REQUIRE([gl_SYS_RESOURCE_H_DEFAULTS])
+  dnl <sys/resource.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([sys/resource.h])
+  if test $ac_cv_header_sys_resource_h = yes; then
+    HAVE_SYS_RESOURCE_H=1
+  else
+    HAVE_SYS_RESOURCE_H=0
+  fi
+  AC_SUBST([HAVE_SYS_RESOURCE_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+#if HAVE_SYS_RESOURCE_H
+/* At least FreeBSD 5.0 needs extra headers before <sys/resource.h>
+   will compile.  */
+# include <sys/types.h>
+# include <sys/time.h>
+# include <sys/resource.h>
+#endif
+    ]],
+    [getrusage])
+])
+
+# gl_SYS_RESOURCE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_RESOURCE_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_RESOURCE_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_RESOURCE_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_RESOURCE_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETRUSAGE])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_RESOURCE_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_RESOURCE_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_RESOURCE_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_GETRUSAGE=1;       AC_SUBST([HAVE_GETRUSAGE])
+])
deleted file mode 120000 (symlink)
index 002d97088f9c0482b331ef60c5b4b8ecd09dca7f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_select_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9e279fbab8d9384f0e6697a6e76fb26f319ca44e
--- /dev/null
@@ -0,0 +1,110 @@
+# sys_select_h.m4 serial 23
+dnl Copyright (C) 2006-2024 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_ONCE([gl_SYS_SELECT_H],
+[
+  AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
+    [gl_cv_header_sys_select_h_selfcontained],
+    [
+      dnl Test against two bugs:
+      dnl 1. On many platforms, <sys/select.h> assumes prior inclusion of
+      dnl    <sys/types.h>.
+      dnl 2. On OSF/1 4.0, <sys/select.h> provides only a forward declaration
+      dnl    of 'struct timeval', and no definition of this type.
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]],
+                                         [[struct timeval b;]])],
+        [gl_cv_header_sys_select_h_selfcontained=yes],
+        [gl_cv_header_sys_select_h_selfcontained=no])
+      dnl Test against another bug:
+      dnl 3. On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
+      dnl    that relies on memset(), but without including <string.h>.
+      if test $gl_cv_header_sys_select_h_selfcontained = yes; then
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([[#include <sys/select.h>]],
+                           [[int memset; int bzero;]])
+          ],
+          [AC_LINK_IFELSE(
+             [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[
+                  #undef memset
+                  #define memset nonexistent_memset
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void *memset (void *, int, unsigned long);
+                  #undef bzero
+                  #define bzero nonexistent_bzero
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void bzero (void *, unsigned long);
+                  fd_set fds;
+                  FD_ZERO (&fds);
+                ]])
+             ],
+             [],
+             [gl_cv_header_sys_select_h_selfcontained=no])
+          ])
+      fi
+    ])
+  dnl <sys/select.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([sys/select.h])
+  if test $ac_cv_header_sys_select_h = yes; then
+    HAVE_SYS_SELECT_H=1
+  else
+    HAVE_SYS_SELECT_H=0
+  fi
+  AC_SUBST([HAVE_SYS_SELECT_H])
+  gl_PREREQ_SYS_H_WINSOCK2
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [pselect select])
+])
+
+# gl_SYS_SELECT_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_SELECT_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_SELECT_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PSELECT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SELECT])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_PSELECT=1; AC_SUBST([HAVE_PSELECT])
+  REPLACE_PSELECT=0; AC_SUBST([REPLACE_PSELECT])
+  REPLACE_SELECT=0; AC_SUBST([REPLACE_SELECT])
+])
deleted file mode 120000 (symlink)
index e3399a09923ac7f8295cb8b27a3e85e18b56290a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_socket_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..af524849f035fec56920dba5e55c15de15cea87e
--- /dev/null
@@ -0,0 +1,206 @@
+# sys_socket_h.m4 serial 29
+dnl Copyright (C) 2005-2024 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 Simon Josefsson.
+
+AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
+[
+  AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
+  dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
+  dnl old-style declarations (with return type 'int' instead of 'ssize_t')
+  dnl unless _POSIX_PII_SOCKET is defined.
+  case "$host_os" in
+    osf*)
+      AC_DEFINE([_POSIX_PII_SOCKET], [1],
+        [Define to 1 in order to get the POSIX compatible declarations
+         of socket functions.])
+      ;;
+  esac
+
+  GL_GENERATE_SYS_SOCKET_H=false
+  AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
+    [gl_cv_header_sys_socket_h_selfcontained],
+    [
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[]])],
+        [gl_cv_header_sys_socket_h_selfcontained=yes],
+        [gl_cv_header_sys_socket_h_selfcontained=no])
+    ])
+  if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
+    dnl If the shutdown function exists, <sys/socket.h> should define
+    dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
+    AC_CHECK_FUNCS([shutdown])
+    if test $ac_cv_func_shutdown = yes; then
+      AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros],
+        [gl_cv_header_sys_socket_h_shut],
+        [
+          AC_COMPILE_IFELSE(
+            [AC_LANG_PROGRAM([[#include <sys/socket.h>]],
+               [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])],
+            [gl_cv_header_sys_socket_h_shut=yes],
+            [gl_cv_header_sys_socket_h_shut=no])
+        ])
+      if test $gl_cv_header_sys_socket_h_shut = no; then
+        GL_GENERATE_SYS_SOCKET_H=true
+      fi
+    fi
+  fi
+  # We need to check for ws2tcpip.h now.
+  gl_PREREQ_SYS_H_SOCKET
+  AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
+  /* sys/types.h is not needed according to POSIX, but the
+     sys/socket.h in i386-unknown-freebsd4.10 and
+     powerpc-apple-darwin5.5 required it. */
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+])
+  if test $ac_cv_type_struct_sockaddr_storage = no; then
+    HAVE_STRUCT_SOCKADDR_STORAGE=0
+  fi
+  if test $ac_cv_type_sa_family_t = no; then
+    HAVE_SA_FAMILY_T=0
+  fi
+  if test $ac_cv_type_struct_sockaddr_storage != no; then
+    AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
+      [],
+      [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0],
+      [#include <sys/types.h>
+       #ifdef HAVE_SYS_SOCKET_H
+       #include <sys/socket.h>
+       #endif
+       #ifdef HAVE_WS2TCPIP_H
+       #include <ws2tcpip.h>
+       #endif
+      ])
+  fi
+  if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \
+     || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then
+    GL_GENERATE_SYS_SOCKET_H=true
+  fi
+  gl_PREREQ_SYS_H_WINSOCK2
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#include <sys/socket.h>
+    ]], [socket connect accept bind getpeername getsockname getsockopt
+    listen recv send recvfrom sendto setsockopt shutdown accept4])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+])
+
+AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
+[
+  dnl Check prerequisites of the <sys/socket.h> replacement.
+  AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
+  gl_CHECK_NEXT_HEADERS([sys/socket.h])
+  if test $ac_cv_header_sys_socket_h = yes; then
+    HAVE_SYS_SOCKET_H=1
+  else
+    HAVE_SYS_SOCKET_H=0
+  fi
+  AC_SUBST([HAVE_SYS_SOCKET_H])
+  gl_PREREQ_SYS_H_WS2TCPIP
+])
+
+# Common prerequisites of the <sys/socket.h> replacement and of the
+# <sys/select.h> replacement.
+# Sets and substitutes HAVE_WINSOCK2_H.
+AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
+[
+  m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
+  m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
+  AC_CHECK_HEADERS_ONCE([sys/socket.h])
+  if test $ac_cv_header_sys_socket_h != yes; then
+    dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
+    dnl the check for those headers unconditional; yet cygwin reports
+    dnl that the headers are present but cannot be compiled (since on
+    dnl cygwin, all socket information should come from sys/socket.h).
+    AC_CHECK_HEADERS([winsock2.h])
+  fi
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    HAVE_WINSOCK2_H=1
+    UNISTD_H_HAVE_WINSOCK2_H=1
+    SYS_IOCTL_H_HAVE_WINSOCK2_H=1
+  else
+    HAVE_WINSOCK2_H=0
+  fi
+  AC_SUBST([HAVE_WINSOCK2_H])
+])
+
+# Common prerequisites of the <sys/socket.h> replacement and of the
+# <arpa/inet.h> replacement.
+# Sets and substitutes HAVE_WS2TCPIP_H.
+AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
+[
+  AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
+  if test $ac_cv_header_sys_socket_h = yes; then
+    HAVE_WS2TCPIP_H=0
+  else
+    if test $ac_cv_header_ws2tcpip_h = yes; then
+      HAVE_WS2TCPIP_H=1
+    else
+      HAVE_WS2TCPIP_H=0
+    fi
+  fi
+  AC_SUBST([HAVE_WS2TCPIP_H])
+])
+
+# gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_SOCKET_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_SOCKET_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SOCKET])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CONNECT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BIND])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPEERNAME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKNAME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKOPT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LISTEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECV])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SEND])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECVFROM])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SENDTO])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETSOCKOPT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SHUTDOWN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT4])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
+[
+  HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
+  HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
+                        AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
+  HAVE_SA_FAMILY_T=1;   AC_SUBST([HAVE_SA_FAMILY_T])
+  HAVE_ACCEPT4=1;       AC_SUBST([HAVE_ACCEPT4])
+])
deleted file mode 120000 (symlink)
index e53487173b85b12721ff0d4eb472cc5a63053e4c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_stat_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..75018537d579fb2ddd2c94694866b28ab6e69ab9
--- /dev/null
@@ -0,0 +1,129 @@
+# sys_stat_h.m4 serial 42   -*- Autoconf -*-
+dnl Copyright (C) 2006-2024 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 Eric Blake.
+dnl Provide a GNU-like <sys/stat.h>.
+
+AC_DEFUN_ONCE([gl_SYS_STAT_H],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+
+  dnl Check for broken stat macros.
+  AC_REQUIRE([AC_HEADER_STAT])
+
+  gl_CHECK_NEXT_HEADERS([sys/stat.h])
+
+  dnl Ensure the type mode_t gets defined.
+  AC_REQUIRE([AC_TYPE_MODE_T])
+
+  dnl Whether to enable precise timestamps in 'struct stat'.
+  m4_ifdef([gl_WINDOWS_STAT_TIMESPEC], [
+    AC_REQUIRE([gl_WINDOWS_STAT_TIMESPEC])
+  ], [
+    WINDOWS_STAT_TIMESPEC=0
+  ])
+  AC_SUBST([WINDOWS_STAT_TIMESPEC])
+
+  dnl Whether to ensure that struct stat.st_size is 64-bit wide.
+  m4_ifdef([gl_LARGEFILE], [
+    AC_REQUIRE([gl_LARGEFILE])
+  ], [
+    WINDOWS_64_BIT_ST_SIZE=0
+  ])
+  AC_SUBST([WINDOWS_64_BIT_ST_SIZE])
+
+  dnl Define types that are supposed to be defined in <sys/types.h> or
+  dnl <sys/stat.h>.
+  AC_CHECK_TYPE([nlink_t], [],
+    [AC_DEFINE([nlink_t], [int],
+       [Define to the type of st_nlink in struct stat, or a supertype.])],
+    [#include <sys/types.h>
+     #include <sys/stat.h>])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
+    ]], [chmod fchmodat fstat fstatat futimens getumask lchmod lstat
+    mkdirat mkfifo mkfifoat mknod mknodat stat utimensat])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+])
+
+# gl_SYS_STAT_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_STAT_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHMOD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FUTIMENS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUMASK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHMOD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSTAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIRAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFO])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFOAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNOD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNODAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIMENSAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHMOD], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKDIR], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UMASK], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_FCHMODAT=1;      AC_SUBST([HAVE_FCHMODAT])
+  HAVE_FSTATAT=1;       AC_SUBST([HAVE_FSTATAT])
+  HAVE_FUTIMENS=1;      AC_SUBST([HAVE_FUTIMENS])
+  HAVE_GETUMASK=1;      AC_SUBST([HAVE_GETUMASK])
+  HAVE_LCHMOD=1;        AC_SUBST([HAVE_LCHMOD])
+  HAVE_LSTAT=1;         AC_SUBST([HAVE_LSTAT])
+  HAVE_MKDIRAT=1;       AC_SUBST([HAVE_MKDIRAT])
+  HAVE_MKFIFO=1;        AC_SUBST([HAVE_MKFIFO])
+  HAVE_MKFIFOAT=1;      AC_SUBST([HAVE_MKFIFOAT])
+  HAVE_MKNOD=1;         AC_SUBST([HAVE_MKNOD])
+  HAVE_MKNODAT=1;       AC_SUBST([HAVE_MKNODAT])
+  HAVE_UTIMENSAT=1;     AC_SUBST([HAVE_UTIMENSAT])
+  REPLACE_CHMOD=0;      AC_SUBST([REPLACE_CHMOD])
+  REPLACE_FCHMODAT=0;   AC_SUBST([REPLACE_FCHMODAT])
+  REPLACE_FSTAT=0;      AC_SUBST([REPLACE_FSTAT])
+  REPLACE_FSTATAT=0;    AC_SUBST([REPLACE_FSTATAT])
+  REPLACE_FUTIMENS=0;   AC_SUBST([REPLACE_FUTIMENS])
+  REPLACE_LSTAT=0;      AC_SUBST([REPLACE_LSTAT])
+  REPLACE_MKDIR=0;      AC_SUBST([REPLACE_MKDIR])
+  REPLACE_MKFIFO=0;     AC_SUBST([REPLACE_MKFIFO])
+  REPLACE_MKFIFOAT=0;   AC_SUBST([REPLACE_MKFIFOAT])
+  REPLACE_MKNOD=0;      AC_SUBST([REPLACE_MKNOD])
+  REPLACE_MKNODAT=0;    AC_SUBST([REPLACE_MKNODAT])
+  REPLACE_STAT=0;       AC_SUBST([REPLACE_STAT])
+  REPLACE_UTIMENSAT=0;  AC_SUBST([REPLACE_UTIMENSAT])
+])
deleted file mode 120000 (symlink)
index fd339f38780eb01509e59737e73b35b7f69d80ba..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_time_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..dc5353f3785cd294b2dd56987aa59082d8c90393
--- /dev/null
@@ -0,0 +1,120 @@
+# Configure a replacement for <sys/time.h>.
+# serial 12
+
+# Copyright (C) 2007, 2009-2024 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.
+
+# Written by Paul Eggert and Martin Lambers.
+
+AC_DEFUN_ONCE([gl_SYS_TIME_H],
+[
+  dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement
+  dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1
+  dnl statements that occur in other macros.
+  AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS])
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
+  gl_CHECK_NEXT_HEADERS([sys/time.h])
+
+  if test $ac_cv_header_sys_time_h != yes; then
+    HAVE_SYS_TIME_H=0
+  fi
+
+  dnl On native Windows with MSVC, 'struct timeval' is defined in <winsock2.h>
+  dnl only. So include that header in the list.
+  gl_PREREQ_SYS_H_WINSOCK2
+  AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#if HAVE_SYS_TIME_H
+             #include <sys/time.h>
+            #endif
+            #include <time.h>
+            #if HAVE_WINSOCK2_H
+            # include <winsock2.h>
+            #endif
+          ]],
+          [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
+       [gl_cv_sys_struct_timeval=yes],
+       [gl_cv_sys_struct_timeval=no])
+    ])
+  if test $gl_cv_sys_struct_timeval != yes; then
+    HAVE_STRUCT_TIMEVAL=0
+  else
+    dnl On native Windows with a 64-bit 'time_t', 'struct timeval' is defined
+    dnl (in <sys/time.h> and <winsock2.h> for mingw64, in <winsock2.h> only
+    dnl for MSVC) with a tv_sec field of type 'long' (32-bit!), which is
+    dnl smaller than the 'time_t' type mandated by POSIX.
+    dnl On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but
+    dnl that is good enough.
+    AC_CACHE_CHECK([for wide-enough struct timeval.tv_sec member],
+      [gl_cv_sys_struct_timeval_tv_sec],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#if HAVE_SYS_TIME_H
+               #include <sys/time.h>
+              #endif
+              #include <time.h>
+              #if HAVE_WINSOCK2_H
+              # include <winsock2.h>
+              #endif
+            ]],
+            [[static struct timeval x;
+              typedef int verify_tv_sec_type[
+                sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1
+              ];
+            ]])],
+         [gl_cv_sys_struct_timeval_tv_sec=yes],
+         [gl_cv_sys_struct_timeval_tv_sec=no])
+      ])
+    if test $gl_cv_sys_struct_timeval_tv_sec != yes; then
+      REPLACE_STRUCT_TIMEVAL=1
+    fi
+  fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <time.h>
+    ]], [gettimeofday])
+])
+
+# gl_SYS_TIME_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_TIME_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_TIME_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETTIMEOFDAY])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_TIME_H_DEFAULTS],
+[
+  dnl Assume POSIX behavior unless another module says otherwise.
+  HAVE_GETTIMEOFDAY=1;       AC_SUBST([HAVE_GETTIMEOFDAY])
+  HAVE_STRUCT_TIMEVAL=1;     AC_SUBST([HAVE_STRUCT_TIMEVAL])
+  HAVE_SYS_TIME_H=1;         AC_SUBST([HAVE_SYS_TIME_H])
+  REPLACE_GETTIMEOFDAY=0;    AC_SUBST([REPLACE_GETTIMEOFDAY])
+  REPLACE_STRUCT_TIMEVAL=0;  AC_SUBST([REPLACE_STRUCT_TIMEVAL])
+])
deleted file mode 120000 (symlink)
index b4caa7f4f808de7fdeb7c78065e43395899a3e64..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_types_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..37d0ccad4038e44f813531a2f9ebd5f7be2f307c
--- /dev/null
@@ -0,0 +1,70 @@
+# sys_types_h.m4 serial 13
+dnl Copyright (C) 2011-2024 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_ONCE([gl_SYS_TYPES_H],
+[
+  AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
+
+  dnl Use sane struct stat types in OpenVMS 8.2 and later.
+  AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.])
+
+  gl_NEXT_HEADERS([sys/types.h])
+
+  dnl Ensure the type pid_t gets defined.
+  AC_REQUIRE([AC_TYPE_PID_T])
+
+  dnl Ensure the type mode_t gets defined.
+  AC_REQUIRE([AC_TYPE_MODE_T])
+
+  dnl Whether to override the 'off_t' type.
+  AC_REQUIRE([gl_TYPE_OFF_T])
+
+  dnl Whether to override the 'dev_t' and 'ino_t' types.
+  m4_ifdef([gl_WINDOWS_STAT_INODES], [
+    AC_REQUIRE([gl_WINDOWS_STAT_INODES])
+  ], [
+    WINDOWS_STAT_INODES=0
+  ])
+  AC_SUBST([WINDOWS_STAT_INODES])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS],
+[
+])
+
+# This works around a buggy version in autoconf <= 2.69.
+# See <https://lists.gnu.org/r/autoconf/2016-08/msg00014.html>
+# The 2.70 version isn't quoted properly, so override it too.
+
+m4_version_prereq([2.70.1], [], [
+
+m4_undefine([AC_HEADER_MAJOR])
+AC_DEFUN([AC_HEADER_MAJOR],
+[AC_CHECK_HEADERS_ONCE([sys/types.h])
+AC_CHECK_HEADER([sys/mkdev.h],
+                [AC_DEFINE([MAJOR_IN_MKDEV], [1],
+                           [Define to 1 if `major', `minor', and `makedev' are
+                            declared in <mkdev.h>.])])
+if test $ac_cv_header_sys_mkdev_h = no; then
+  AC_CHECK_HEADER([sys/sysmacros.h],
+                  [AC_DEFINE([MAJOR_IN_SYSMACROS], [1],
+                             [Define to 1 if `major', `minor', and `makedev'
+                              are declared in <sysmacros.h>.])])
+fi
+])# AC_HEADER_MAJOR
+
+])
deleted file mode 120000 (symlink)
index 16b3ea09d8d50b5bb8b030d82683cad397e8177d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_uio_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ce252ed49ad597515d74451865c26dd3dd796aa9
--- /dev/null
@@ -0,0 +1,46 @@
+# sys_uio_h.m4 serial 3
+dnl Copyright (C) 2011-2024 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_ONCE([gl_SYS_UIO_H],
+[
+  AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
+  dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([sys/uio.h])
+  if test $ac_cv_header_sys_uio_h = yes; then
+    HAVE_SYS_UIO_H=1
+  else
+    HAVE_SYS_UIO_H=0
+  fi
+  AC_SUBST([HAVE_SYS_UIO_H])
+])
+
+# gl_SYS_UIO_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_UIO_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_UIO_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS], [
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_UIO_H_DEFAULTS],
+[
+])
deleted file mode 120000 (symlink)
index cd0055dccaa1b634aca413598a52ec8f294b720b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_utsname_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..214f7831260567964ad50f46a02f181af6ab3874
--- /dev/null
@@ -0,0 +1,69 @@
+# sys_utsname_h.m4 serial 11
+dnl Copyright (C) 2009-2024 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 Bruno Haible.
+
+AC_DEFUN_ONCE([gl_SYS_UTSNAME_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_SYS_UTSNAME_H_DEFAULTS])
+
+  dnl <sys/utsname.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([sys/utsname.h])
+  if test $ac_cv_header_sys_utsname_h != yes; then
+    HAVE_SYS_UTSNAME_H=0
+    HAVE_STRUCT_UTSNAME=0
+  else
+    HAVE_SYS_UTSNAME_H=1
+    AC_CHECK_TYPES([struct utsname], [], [HAVE_STRUCT_UTSNAME=0], [[
+/* Minix 3.1.8 has a bug: <stddef.h> must be included before
+   <sys/utsname.h>.  */
+#include <stddef.h>
+#include <sys/utsname.h>
+      ]])
+  fi
+  AC_SUBST([HAVE_SYS_UTSNAME_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+    /* Minix 3.1.8 has a bug: <stddef.h> must be included before
+       <sys/utsname.h>.  */
+    #include <stddef.h>
+    #include <sys/utsname.h>
+    ]], [uname])
+])
+
+# gl_SYS_UTSNAME_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_UTSNAME_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_UTSNAME_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_UTSNAME_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_UTSNAME_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNAME])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_UTSNAME_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_UTSNAME_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_UTSNAME_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_UNAME=1;           AC_SUBST([HAVE_UNAME])
+  HAVE_STRUCT_UTSNAME=1;  AC_SUBST([HAVE_STRUCT_UTSNAME])
+])
deleted file mode 120000 (symlink)
index 3f579db48f91e3b5d3a2fca52fc8d91f05ca5cae..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/sys_wait_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6759b0842fcafd6a24b746bcd1e9212851668870
--- /dev/null
@@ -0,0 +1,51 @@
+# sys_wait_h.m4 serial 9
+dnl Copyright (C) 2008-2024 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_ONCE([gl_SYS_WAIT_H],
+[
+  AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS])
+
+  dnl <sys/wait.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([sys/wait.h])
+
+  dnl Ensure the type pid_t gets defined.
+  AC_REQUIRE([AC_TYPE_PID_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/wait.h>]],
+    [waitpid])
+])
+
+# gl_SYS_WAIT_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_WAIT_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_SYS_WAIT_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_WAIT_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_WAIT_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WAITPID])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_WAIT_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_WAIT_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+])
deleted file mode 120000 (symlink)
index 27af85b85ba775a1df2772c7f931e2e40855da51..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/systemd.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9b4b5f87b901cf191b6d46c00f582f4afd997a20
--- /dev/null
@@ -0,0 +1,23 @@
+# systemd.m4 serial 3
+dnl Copyright (C) 2023-2024 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.
+
+# Sets SYSTEMD_CHOICE to 'yes' or 'no', depending on the preferred use of
+# systemd APIs.
+AC_DEFUN([gl_SYSTEMD_CHOICE],
+[
+  AC_MSG_CHECKING([whether to use systemd APIs])
+  AC_ARG_ENABLE([systemd],
+    [  --enable-systemd        use systemd APIs],
+    [SYSTEMD_CHOICE="$enableval"],
+    [SYSTEMD_CHOICE=no])
+  AC_MSG_RESULT([$SYSTEMD_CHOICE])
+  AC_SUBST([SYSTEMD_CHOICE])
+])
+
+# Pre-built package name for the libsystemd library:
+# - On Debian and Debian-based systems: libsystemd-dev
+# - On Red Hat distributions: systemd-devel
+# - Other: https://repology.org/project/systemd/versions
deleted file mode 120000 (symlink)
index b0b2e2bc98f4358db3dfe22233cde794c01acba4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/tempname.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..31d35c83eb5f2ab7a20e58c996e37deab494b8c0
--- /dev/null
@@ -0,0 +1,19 @@
+#serial 5
+
+# Copyright (C) 2006-2007, 2009-2024 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.
+
+# glibc provides __gen_tempname as a wrapper for mk[ds]temp.  Expose
+# it as a public API, and provide it on systems that are lacking.
+AC_DEFUN([gl_FUNC_GEN_TEMPNAME],
+[
+  gl_PREREQ_TEMPNAME
+])
+
+# Prerequisites of lib/tempname.c.
+AC_DEFUN([gl_PREREQ_TEMPNAME],
+[
+  :
+])
deleted file mode 120000 (symlink)
index a58a383ac42ab2d9354c2aac9dd67337ed61f1e8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/termios_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..5eadbb9337cf867231ced8797afaf2c46ddc5d0b
--- /dev/null
@@ -0,0 +1,58 @@
+# termios_h.m4 serial 7
+dnl Copyright (C) 2010-2024 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_ONCE([gl_TERMIOS_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_TERMIOS_H_DEFAULTS])
+
+  gl_CHECK_NEXT_HEADERS([termios.h])
+  if test $ac_cv_header_termios_h != yes; then
+    HAVE_TERMIOS_H=0
+  fi
+
+  dnl Ensure the type pid_t gets defined.
+  AC_REQUIRE([AC_TYPE_PID_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <termios.h>]],
+    [tcgetsid])
+])
+
+# gl_TERMIOS_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_TERMIOS_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_TERMIOS_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_TERMIOS_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_TERMIOS_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TCGETSID])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_TERMIOS_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_TERMIOS_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_TERMIOS_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_DECL_TCGETSID=1;   AC_SUBST([HAVE_DECL_TCGETSID])
+  HAVE_TERMIOS_H=1;       AC_SUBST([HAVE_TERMIOS_H])
+])
deleted file mode 120000 (symlink)
index 8d70d218109f6a3e0624335bd4fe0e4732ab2afb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/thread.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c2aead4abc626a24d3869ecbe7d2d93af73a479f
--- /dev/null
@@ -0,0 +1,17 @@
+# thread.m4 serial 4
+dnl Copyright (C) 2008-2024 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_THREAD],
+[
+  AC_REQUIRE([gl_THREADLIB])
+
+  if test $gl_threads_api = posix; then
+    gl_save_LIBS="$LIBS"
+    LIBS="$LIBS $LIBMULTITHREAD"
+    gl_CHECK_FUNCS_ANDROID([pthread_atfork], [[#include <pthread.h>]])
+    LIBS="$gl_save_LIBS"
+  fi
+])
deleted file mode 120000 (symlink)
index 920b09d0afad76c3a35f10dee7883ea561e57a26..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/threadlib.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0be2c987b12843a97c7e84113f8119f2f16a4c6a
--- /dev/null
@@ -0,0 +1,686 @@
+# threadlib.m4 serial 41
+dnl Copyright (C) 2005-2024 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 Bruno Haible.
+
+AC_PREREQ([2.60])
+
+dnl The general structure of the multithreading modules in gnulib is that we
+dnl have three set of modules:
+dnl
+dnl   * POSIX API:
+dnl     pthread, which combines
+dnl       pthread-h
+dnl       pthread-thread
+dnl       pthread-once
+dnl       pthread-mutex
+dnl       pthread-rwlock
+dnl       pthread-cond
+dnl       pthread-tss
+dnl       pthread-spin
+dnl     sched_yield
+dnl
+dnl   * ISO C API:
+dnl     threads, which combines
+dnl       threads-h
+dnl       thrd
+dnl       mtx
+dnl       cnd
+dnl       tss
+dnl
+dnl   * Gnulib API, with an implementation that can be chosen at configure
+dnl     time through the option --enable-threads=...
+dnl       thread
+dnl       lock
+dnl       cond
+dnl       tls
+dnl       yield
+dnl
+dnl They are independent, except for the fact that
+dnl   - the implementation of the ISO C API may use the POSIX (or some other
+dnl     platform dependent) API,
+dnl   - the implementation of the Gnulib API may use the POSIX or ISO C or
+dnl     some other platform dependent API, depending on the --enable-threads
+dnl     option.
+dnl
+dnl This file contains macros for all of these APIs!
+
+dnl ============================================================================
+dnl Macros for all thread APIs
+
+AC_DEFUN([gl_ANYTHREADLIB_EARLY],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  if test -z "$gl_anythreadlib_early_done"; then
+    case "$host_os" in
+      osf*)
+        # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
+        # groks <pthread.h>. cc also understands the flag -pthread, but
+        # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
+        # 2. putting a flag into CPPFLAGS that has an effect on the linker
+        # causes the AC_LINK_IFELSE test below to succeed unexpectedly,
+        # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
+        CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+        ;;
+    esac
+    # Some systems optimize for single-threaded programs by default, and
+    # need special flags to disable these optimizations. For example, the
+    # definition of 'errno' in <errno.h>.
+    case "$host_os" in
+      aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
+      solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
+    esac
+    gl_anythreadlib_early_done=done
+  fi
+])
+
+dnl Checks whether the compiler and linker support weak declarations of symbols.
+
+AC_DEFUN([gl_WEAK_SYMBOLS],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([whether imported symbols can be declared weak],
+    [gl_cv_have_weak],
+    [case "$host_os" in
+       cygwin* | mingw* | windows*)
+         dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with
+         dnl gcc 11.3, the test below would succeed, but programs that use
+         dnl pthread_in_use() with weak symbol references crash miserably at
+         dnl runtime.
+         gl_cv_have_weak="guessing no"
+         ;;
+       *)
+         gl_cv_have_weak=no
+         dnl First, test whether the compiler accepts it syntactically.
+         AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[extern void xyzzy ();
+#pragma weak xyzzy]],
+              [[xyzzy();]])],
+           [gl_cv_have_weak=maybe])
+         if test $gl_cv_have_weak = maybe; then
+           dnl Second, test whether it actually works. On Cygwin 1.7.2, with
+           dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
+           AC_RUN_IFELSE(
+             [AC_LANG_SOURCE([[
+#include <stdio.h>
+#pragma weak fputs
+int main ()
+{
+  return (fputs == NULL);
+}]])],
+             [gl_cv_have_weak=yes],
+             [gl_cv_have_weak=no],
+             [dnl When cross-compiling, assume that only ELF platforms support
+              dnl weak symbols.
+              AC_EGREP_CPP([Extensible Linking Format],
+                [#ifdef __ELF__
+                 Extensible Linking Format
+                 #endif
+                ],
+                [gl_cv_have_weak="guessing yes"],
+                [gl_cv_have_weak="guessing no"])
+             ])
+         fi
+         ;;
+     esac
+     dnl But when linking statically, weak symbols don't work.
+     case " $LDFLAGS " in
+       *" -static "*) gl_cv_have_weak=no ;;
+     esac
+     dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak
+     dnl symbol and linking against a shared library that has a dependency on
+     dnl the shared library that defines the symbol.
+     case "$gl_cv_have_weak" in
+       *yes)
+         case "$host_os" in
+           freebsd* | dragonfly* | midnightbsd*)
+             : > conftest1.c
+             $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1
+             cat <<EOF > conftest2.c
+#include <pthread.h>
+#pragma weak pthread_mutexattr_gettype
+int main ()
+{
+  return (pthread_mutexattr_gettype != NULL);
+}
+EOF
+             $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \
+               || gl_cv_have_weak=no
+             rm -f conftest1.c libempty.so conftest2.c conftest
+             ;;
+         esac
+         ;;
+     esac
+    ])
+  case "$gl_cv_have_weak" in
+    *yes)
+      AC_DEFINE([HAVE_WEAK_SYMBOLS], [1],
+        [Define to 1 if the compiler and linker support weak declarations of symbols.])
+      ;;
+  esac
+])
+
+dnl ============================================================================
+dnl Macros for the POSIX API
+
+dnl gl_PTHREADLIB
+dnl -------------
+dnl Tests for the libraries needs for using the POSIX threads API.
+dnl Sets the variable LIBPTHREAD to the linker options for use in a Makefile.
+dnl Sets the variable LIBPMULTITHREAD, for programs that really need
+dnl multithread functionality. The difference between LIBPTHREAD and
+dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically
+dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not.
+dnl Sets the variable SCHED_YIELD_LIB to the linker options needed to use the
+dnl sched_yield() function.
+dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
+dnl multithread-safe programs.
+dnl Defines the C macro HAVE_PTHREAD_API if (at least parts of) the POSIX
+dnl threads API is available.
+
+dnl The guts of gl_PTHREADLIB. Needs to be expanded only once.
+
+AC_DEFUN([gl_PTHREADLIB_BODY],
+[
+  AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
+  if test -z "$gl_pthreadlib_body_done"; then
+    gl_pthread_api=no
+    LIBPTHREAD=
+    LIBPMULTITHREAD=
+    # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
+    # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY.
+    AC_CHECK_HEADER([pthread.h],
+      [gl_have_pthread_h=yes], [gl_have_pthread_h=no])
+    if test "$gl_have_pthread_h" = yes; then
+      # Other possible tests:
+      #   -lpthreads (FSU threads, PCthreads)
+      #   -lgthreads
+      # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
+      # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
+      # the second one only in libpthread, and lock.c needs it.
+      #
+      # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04
+      # needs -pthread for some reason.  See:
+      # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html
+      save_LIBS=$LIBS
+      for gl_pthread in '' '-pthread'; do
+        LIBS="$LIBS $gl_pthread"
+        AC_LINK_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[#include <pthread.h>
+               pthread_mutex_t m;
+               pthread_mutexattr_t ma;
+             ]],
+             [[pthread_mutex_lock (&m);
+               pthread_mutexattr_init (&ma);]])],
+          [gl_pthread_api=yes
+           LIBPTHREAD=$gl_pthread
+           LIBPMULTITHREAD=$gl_pthread])
+        LIBS=$save_LIBS
+        test $gl_pthread_api = yes && break
+      done
+      echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD
+      echo "$as_me:__oline__: LIBPTHREAD=$LIBPTHREAD" >&AS_MESSAGE_LOG_FD
+
+      gl_pthread_in_glibc=no
+      # On Linux with glibc >= 2.34, libc contains the fully functional
+      # pthread functions.
+      case "$host_os" in
+        linux*)
+          AC_EGREP_CPP([Lucky user],
+            [#include <features.h>
+             #ifdef __GNU_LIBRARY__
+              #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2)
+               Lucky user
+              #endif
+             #endif
+            ],
+            [gl_pthread_in_glibc=yes],
+            [])
+          ;;
+      esac
+      echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD
+
+      # Test for libpthread by looking for pthread_kill. (Not pthread_self,
+      # since it is defined as a macro on OSF/1.)
+      if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then
+        # The program links fine without libpthread. But it may actually
+        # need to link with libpthread in order to create multiple threads.
+        AC_CHECK_LIB([pthread], [pthread_kill],
+          [if test $gl_pthread_in_glibc = yes; then
+             LIBPMULTITHREAD=
+           else
+             LIBPMULTITHREAD=-lpthread
+             # On Solaris and HP-UX, most pthread functions exist also in libc.
+             # Therefore pthread_in_use() needs to actually try to create a
+             # thread: pthread_create from libc will fail, whereas
+             # pthread_create will actually create a thread.
+             # On Solaris 10 or newer, this test is no longer needed, because
+             # libc contains the fully functional pthread functions.
+             case "$host_os" in
+changequote(,)dnl
+               solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*)
+changequote([,])dnl
+                 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
+                   [Define if the pthread_in_use() detection is hard.])
+             esac
+           fi
+          ],
+          [dnl This is needed on FreeBSD 5.2.1.
+           AC_CHECK_LIB([thr], [pthread_kill],
+             [if test $gl_pthread_in_glibc = yes; then
+                LIBPMULTITHREAD=
+              else
+                LIBPMULTITHREAD=-lthr
+              fi
+             ])
+          ])
+      elif test $gl_pthread_api != yes; then
+        # Some library is needed. Try libpthread and libc_r.
+        AC_CHECK_LIB([pthread], [pthread_kill],
+          [gl_pthread_api=yes
+           LIBPTHREAD=-lpthread
+           LIBPMULTITHREAD=-lpthread])
+        if test $gl_pthread_api != yes; then
+          # For FreeBSD 4.
+          AC_CHECK_LIB([c_r], [pthread_kill],
+            [gl_pthread_api=yes
+             LIBPTHREAD=-lc_r
+             LIBPMULTITHREAD=-lc_r])
+        fi
+      fi
+      echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD
+    fi
+    AC_MSG_CHECKING([whether POSIX threads API is available])
+    AC_MSG_RESULT([$gl_pthread_api])
+    AC_SUBST([LIBPTHREAD])
+    AC_SUBST([LIBPMULTITHREAD])
+    if test $gl_pthread_api = yes; then
+      AC_DEFINE([HAVE_PTHREAD_API], [1],
+        [Define if you have the <pthread.h> header and the POSIX threads API.])
+    fi
+
+    dnl On some systems, sched_yield is in librt, rather than in libpthread.
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[#include <sched.h>]],
+         [[sched_yield ();]])],
+      [SCHED_YIELD_LIB=
+      ],
+      [dnl Solaris 7...10 has sched_yield in librt, not in libpthread or libc.
+       AC_CHECK_LIB([rt], [sched_yield], [SCHED_YIELD_LIB=-lrt],
+         [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt.
+          AC_CHECK_LIB([posix4], [sched_yield], [SCHED_YIELD_LIB=-lposix4])])
+      ])
+    AC_SUBST([SCHED_YIELD_LIB])
+    dnl For backward compatibility.
+    LIB_SCHED_YIELD="$SCHED_YIELD_LIB"
+    AC_SUBST([LIB_SCHED_YIELD])
+
+    gl_pthreadlib_body_done=done
+  fi
+])
+
+AC_DEFUN([gl_PTHREADLIB],
+[
+  AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
+  gl_PTHREADLIB_BODY
+])
+
+dnl ============================================================================
+dnl Macros for the ISO C API
+
+dnl gl_STDTHREADLIB
+dnl ---------------
+dnl Tests for the libraries needs for using the ISO C threads API.
+dnl Sets the variable LIBSTDTHREAD to the linker options for use in a Makefile.
+dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
+dnl multithread-safe programs.
+dnl Defines the C macro HAVE_THREADS_H if (at least parts of) the ISO C threads
+dnl API is available.
+
+dnl The guts of gl_STDTHREADLIB. Needs to be expanded only once.
+
+AC_DEFUN([gl_STDTHREADLIB_BODY],
+[
+  AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  if test -z "$gl_stdthreadlib_body_done"; then
+    AC_CHECK_HEADERS_ONCE([threads.h])
+
+    case "$host_os" in
+      mingw* | windows*)
+        LIBSTDTHREAD=
+        ;;
+      *)
+        gl_PTHREADLIB_BODY
+        if test $ac_cv_header_threads_h = yes; then
+          dnl glibc >= 2.29 has thrd_create in libpthread.
+          dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends
+          dnl on libpthread (for the symbol 'pthread_mutexattr_gettype').
+          dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in
+          dnl libc.
+          gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>]])
+          if test $ac_cv_func_thrd_create = yes; then
+            LIBSTDTHREAD=
+          else
+            AC_CHECK_LIB([stdthreads], [thrd_create], [
+              LIBSTDTHREAD='-lstdthreads -lpthread'
+            ], [
+              dnl Guess that thrd_create is in libpthread.
+              LIBSTDTHREAD="$LIBPMULTITHREAD"
+            ])
+          fi
+        else
+          dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c.
+          LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB"
+        fi
+        ;;
+    esac
+    AC_SUBST([LIBSTDTHREAD])
+
+    AC_MSG_CHECKING([whether ISO C threads API is available])
+    AC_MSG_RESULT([$ac_cv_header_threads_h])
+    gl_stdthreadlib_body_done=done
+  fi
+])
+
+AC_DEFUN([gl_STDTHREADLIB],
+[
+  AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
+  gl_STDTHREADLIB_BODY
+])
+
+dnl ============================================================================
+dnl Macros for the Gnulib API
+
+dnl gl_THREADLIB
+dnl ------------
+dnl Tests for a multithreading library to be used.
+dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO
+dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the
+dnl default is 'no', otherwise it is system dependent. In both cases, the user
+dnl can change the choice through the options --enable-threads=choice or
+dnl --disable-threads.
+dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS,
+dnl USE_ISOC_AND_POSIX_THREADS, USE_WINDOWS_THREADS.
+dnl The choice --enable-threads=isoc+posix is available only on platforms that
+dnl have both the ISO C and the POSIX threads APIs. It has the effect of using
+dnl the ISO C API for most things and the POSIX API only for creating and
+dnl controlling threads (because there is no equivalent to pthread_atfork in
+dnl the ISO C API).
+dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
+dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
+dnl libtool).
+dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for
+dnl programs that really need multithread functionality. The difference
+dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak
+dnl symbols, typically LIBTHREAD is empty whereas LIBMULTITHREAD is not.
+dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
+dnl multithread-safe programs.
+dnl Since support for GNU pth was removed, $LTLIBTHREAD and $LIBTHREAD have the
+dnl same value, and similarly $LTLIBMULTITHREAD and $LIBMULTITHREAD have the
+dnl same value. Only system libraries are needed.
+
+AC_DEFUN([gl_THREADLIB_EARLY],
+[
+  AC_REQUIRE([gl_THREADLIB_EARLY_BODY])
+])
+
+dnl The guts of gl_THREADLIB_EARLY. Needs to be expanded only once.
+
+AC_DEFUN([gl_THREADLIB_EARLY_BODY],
+[
+  dnl Ordering constraints: This macro modifies CPPFLAGS in a way that
+  dnl influences the result of the autoconf tests that test for *_unlocked
+  dnl declarations, on AIX 5 at least. Therefore it must come early.
+  AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl
+  AC_BEFORE([$0], [gl_ARGP])dnl
+
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+  dnl Check for multithreading.
+  m4_ifdef([gl_THREADLIB_DEFAULT_NO],
+    [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
+    [m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
+  dnl gl_use_winpthreads_default defaults to 'no', because in mingw 10, like
+  dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash.
+  m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no])
+  AC_ARG_ENABLE([threads],
+AS_HELP_STRING([[--enable-threads={isoc|posix|isoc+posix|windows}]], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
+AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]),
+    [gl_use_threads=$enableval],
+    [if test -n "$gl_use_threads_default"; then
+       gl_use_threads="$gl_use_threads_default"
+     else
+changequote(,)dnl
+       case "$host_os" in
+         dnl Disable multithreading by default on OSF/1, because it interferes
+         dnl with fork()/exec(): When msgexec is linked with -lpthread, its
+         dnl child process gets an endless segmentation fault inside execvp().
+         osf*) gl_use_threads=no ;;
+         dnl Disable multithreading by default on Cygwin 1.5.x, because it has
+         dnl bugs that lead to endless loops or crashes. See
+         dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
+         cygwin*)
+               case `uname -r` in
+                 1.[0-5].*) gl_use_threads=no ;;
+                 *)         gl_use_threads=yes ;;
+               esac
+               ;;
+         dnl Obey gl_AVOID_WINPTHREAD on mingw.
+         mingw* | windows*)
+               case "$gl_use_winpthreads_default" in
+                 yes) gl_use_threads=posix ;;
+                 no)  gl_use_threads=windows ;;
+                 *)   gl_use_threads=yes ;;
+               esac
+               ;;
+         *)    gl_use_threads=yes ;;
+       esac
+changequote([,])dnl
+     fi
+    ])
+  if test "$gl_use_threads" = yes \
+     || test "$gl_use_threads" = isoc \
+     || test "$gl_use_threads" = posix \
+     || test "$gl_use_threads" = isoc+posix; then
+    # For using <threads.h> or <pthread.h>:
+    gl_ANYTHREADLIB_EARLY
+  fi
+])
+
+dnl The guts of gl_THREADLIB. Needs to be expanded only once.
+
+AC_DEFUN([gl_THREADLIB_BODY],
+[
+  AC_REQUIRE([gl_THREADLIB_EARLY_BODY])
+  gl_threads_api=none
+  LIBTHREAD=
+  LTLIBTHREAD=
+  LIBMULTITHREAD=
+  LTLIBMULTITHREAD=
+  if test "$gl_use_threads" != no; then
+    dnl Check whether the compiler and linker support weak declarations.
+    gl_WEAK_SYMBOLS
+    if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
+      dnl If we use weak symbols to implement pthread_in_use / pth_in_use /
+      dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create
+      dnl facility is in use.
+      AC_CHECK_HEADERS_ONCE([threads.h])
+      :
+    fi
+    if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then
+      AC_CHECK_HEADERS_ONCE([threads.h])
+      gl_have_isoc_threads="$ac_cv_header_threads_h"
+    fi
+    if test "$gl_use_threads" = yes \
+       || test "$gl_use_threads" = posix \
+       || test "$gl_use_threads" = isoc+posix; then
+      gl_PTHREADLIB_BODY
+      LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD
+      LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD
+      if test $gl_pthread_api = yes; then
+        if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then
+          gl_threads_api='isoc+posix'
+          AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1],
+            [Define if the combination of the ISO C and POSIX multithreading APIs can be used.])
+          LIBTHREAD= LTLIBTHREAD=
+        else
+          gl_threads_api=posix
+          AC_DEFINE([USE_POSIX_THREADS], [1],
+            [Define if the POSIX multithreading library can be used.])
+          if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then
+            AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1],
+              [Define if references to the POSIX multithreading library are satisfied by libc.])
+          else
+            if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
+              AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
+                [Define if references to the POSIX multithreading library should be made weak.])
+              LIBTHREAD= LTLIBTHREAD=
+            else
+              case "$host_os" in
+                freebsd* | dragonfly* | midnightbsd*)
+                  if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then
+                    dnl If weak symbols can't tell whether pthread_create(), pthread_key_create()
+                    dnl etc. will succeed, we need a runtime test.
+                    AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
+                      [Define if the pthread_in_use() detection is hard.])
+                  fi
+                  ;;
+              esac
+            fi
+          fi
+        fi
+      fi
+    fi
+    if test $gl_threads_api = none; then
+      if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then
+        gl_STDTHREADLIB_BODY
+        LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD
+        LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD
+        gl_threads_api=isoc
+        AC_DEFINE([USE_ISOC_THREADS], [1],
+          [Define if the ISO C multithreading library can be used.])
+      fi
+    fi
+    if test $gl_threads_api = none; then
+      case "$gl_use_threads" in
+        yes | windows | win32) # The 'win32' is for backward compatibility.
+          if { case "$host_os" in
+                 mingw* | windows*) true;;
+                 *) false;;
+               esac
+             }; then
+            gl_threads_api=windows
+            AC_DEFINE([USE_WINDOWS_THREADS], [1],
+              [Define if the native Windows multithreading API can be used.])
+          fi
+          ;;
+      esac
+    fi
+  else
+    dnl "$gl_use_threads" is "no".
+    AC_DEFINE([AVOID_ANY_THREADS], [1],
+      [Define if no multithread safety and no multithreading is desired.])
+  fi
+  AC_MSG_CHECKING([for multithread API to use])
+  AC_MSG_RESULT([$gl_threads_api])
+  AC_SUBST([LIBTHREAD])
+  AC_SUBST([LTLIBTHREAD])
+  AC_SUBST([LIBMULTITHREAD])
+  AC_SUBST([LTLIBMULTITHREAD])
+])
+
+AC_DEFUN([gl_THREADLIB],
+[
+  AC_REQUIRE([gl_THREADLIB_EARLY])
+  AC_REQUIRE([gl_THREADLIB_BODY])
+])
+
+
+dnl gl_DISABLE_THREADS
+dnl ------------------
+dnl Sets the gl_THREADLIB default so that threads are not used by default.
+dnl The user can still override it at installation time, by using the
+dnl configure option '--enable-threads'.
+
+AC_DEFUN([gl_DISABLE_THREADS], [
+  m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no])
+])
+
+
+dnl gl_AVOID_WINPTHREAD
+dnl -------------------
+dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the
+dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided.
+dnl The user can still override it at installation time, by using the
+dnl configure option '--enable-threads=posix'.
+dnl As of 2023, this is now the default.
+
+AC_DEFUN([gl_AVOID_WINPTHREAD], [
+  m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no])
+])
+
+
+dnl ============================================================================
+
+
+dnl Survey of platforms:
+dnl
+dnl Platform           Available  Compiler    Supports   test-lock
+dnl                    flavours   option      weak       result
+dnl ---------------    ---------  ---------   --------   ---------
+dnl Linux 2.4/glibc    posix      -lpthread       Y      OK
+dnl
+dnl Linux/glibc 2.34   posix                      Y      OK
+dnl
+dnl GNU Hurd/glibc     posix      -lpthread       Y      OK
+dnl
+dnl Ubuntu 14.04       posix      -pthread        Y      OK
+dnl
+dnl FreeBSD 5.3        posix      -lc_r           Y
+dnl                    posix      -lkse ?         Y
+dnl                    posix      -lpthread ?     Y
+dnl                    posix      -lthr           Y
+dnl
+dnl FreeBSD 5.2        posix      -lc_r           Y
+dnl                    posix      -lkse           Y
+dnl                    posix      -lthr           Y
+dnl
+dnl FreeBSD 4.0,4.10   posix      -lc_r           Y      OK
+dnl
+dnl NetBSD 1.6         --
+dnl
+dnl OpenBSD 3.4        posix      -lpthread       Y      OK
+dnl
+dnl Mac OS X 10.[123]  posix      -lpthread       Y      OK
+dnl
+dnl Solaris 7,8,9      posix      -lpthread       Y      Sol 7,8: 0.0; Sol 9: OK
+dnl
+dnl HP-UX 11           posix      -lpthread       N (cc) OK
+dnl                                               Y (gcc)
+dnl
+dnl IRIX 6.5           posix      -lpthread       Y      0.5
+dnl
+dnl AIX 4.3,5.1        posix      -lpthread       N      AIX 4: 0.5; AIX 5: OK
+dnl
+dnl OSF/1 4.0,5.1      posix      -pthread (cc)   N      OK
+dnl                               -lpthread (gcc) Y
+dnl
+dnl Cygwin             posix      -lpthread       Y      OK
+dnl
+dnl Mingw              windows                    N      OK
+dnl
+dnl BeOS 5             --
+dnl
+dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is
+dnl turned off:
+dnl   OK if all three tests terminate OK,
+dnl   0.5 if the first test terminates OK but the second one loops endlessly,
+dnl   0.0 if the first test already loops endlessly.
deleted file mode 120000 (symlink)
index 220b7066aad1b3e1be0adc50f1de5bc7939ddd6a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/time.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6f2347b2f1a4195df399186d23e8abdfef452ea2
--- /dev/null
@@ -0,0 +1,55 @@
+# time.m4 serial 5
+dnl Copyright (C) 2023-2024 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 Bruno Haible.
+
+AC_DEFUN([gl_FUNC_TIME],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  dnl glibc has the bug https://sourceware.org/bugzilla/show_bug.cgi?id=30200 .
+  AC_CACHE_CHECK([whether time() works],
+    [gl_cv_func_time_works],
+    [dnl Guess that it works except on
+     dnl   - glibc >= 2.31 with Linux. And binaries produced on glibc < 2.31
+     dnl     need to run fine on newer glibc versions as well; therefore ignore
+     dnl     __GLIBC_MINOR__.
+     dnl   - FreeBSD/sparc,
+     dnl   - AIX,
+     dnl   - native Windows.
+     case "$host_os" in
+       linux*-gnu*)
+         AC_EGREP_CPP([Unlucky], [
+           #include <features.h>
+           #ifdef __GNU_LIBRARY__
+            #if __GLIBC__ == 2
+             Unlucky GNU user
+            #endif
+           #endif
+           ],
+           [gl_cv_func_time_works="guessing no"],
+           [gl_cv_func_time_works="guessing yes"])
+         ;;
+       freebsd*)
+         case "$host_cpu" in
+           sparc*)        gl_cv_func_time_works="guessing no";;
+           *)             gl_cv_func_time_works="guessing yes";;
+         esac
+         ;;
+       aix*)              gl_cv_func_time_works="guessing no";;
+       mingw* | windows*) gl_cv_func_time_works="guessing no";;
+       *)                 gl_cv_func_time_works="guessing yes";;
+     esac
+    ])
+  case "$gl_cv_func_time_works" in
+    *no) REPLACE_TIME=1 ;;
+  esac
+])
+
+# Prerequisites of lib/time.c.
+AC_DEFUN([gl_PREREQ_TIME],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 860c23ba28c20e7c341f49e621f6f88e8687cde8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/time_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..32fade0f401a7eebc9c2fdeb9e5a24ed12fe323a
--- /dev/null
@@ -0,0 +1,180 @@
+# Configure a more-standard replacement for <time.h>.
+
+# Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc.
+
+# serial 25
+
+# 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.
+
+# Written by Paul Eggert and Jim Meyering.
+
+AC_DEFUN_ONCE([gl_TIME_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_TIME_H_DEFAULTS])
+
+  gl_NEXT_HEADERS([time.h])
+  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+#include <time.h>
+    ]], [
+      asctime asctime_r ctime ctime_r gmtime_r localtime localtime_r mktime
+      nanosleep strftime strptime time timegm timespec_get timespec_getres tzset
+    ])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CACHE_CHECK([for TIME_UTC in <time.h>],
+    [gl_cv_time_h_has_TIME_UTC],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <time.h>
+          ]],
+          [[static int x = TIME_UTC; x++;]])],
+       [gl_cv_time_h_has_TIME_UTC=yes],
+       [gl_cv_time_h_has_TIME_UTC=no])])
+  if test $gl_cv_time_h_has_TIME_UTC = yes; then
+    TIME_H_DEFINES_TIME_UTC=1
+  else
+    TIME_H_DEFINES_TIME_UTC=0
+  fi
+  AC_SUBST([TIME_H_DEFINES_TIME_UTC])
+])
+
+dnl Check whether 'struct timespec' is declared
+dnl in time.h, sys/time.h, pthread.h, or unistd.h.
+
+AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
+[
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
+  AC_CACHE_CHECK([for struct timespec in <time.h>],
+    [gl_cv_sys_struct_timespec_in_time_h],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <time.h>
+          ]],
+          [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+       [gl_cv_sys_struct_timespec_in_time_h=yes],
+       [gl_cv_sys_struct_timespec_in_time_h=no])])
+
+  TIME_H_DEFINES_STRUCT_TIMESPEC=0
+  SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
+  PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
+  UNISTD_H_DEFINES_STRUCT_TIMESPEC=0
+  if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
+    TIME_H_DEFINES_STRUCT_TIMESPEC=1
+  else
+    AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
+      [gl_cv_sys_struct_timespec_in_sys_time_h],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <sys/time.h>
+            ]],
+            [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
+    if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
+      SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
+    else
+      AC_CACHE_CHECK([for struct timespec in <pthread.h>],
+        [gl_cv_sys_struct_timespec_in_pthread_h],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <pthread.h>
+              ]],
+              [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+           [gl_cv_sys_struct_timespec_in_pthread_h=yes],
+           [gl_cv_sys_struct_timespec_in_pthread_h=no])])
+      if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
+        PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
+      else
+        AC_CACHE_CHECK([for struct timespec in <unistd.h>],
+          [gl_cv_sys_struct_timespec_in_unistd_h],
+          [AC_COMPILE_IFELSE(
+             [AC_LANG_PROGRAM(
+                [[#include <unistd.h>
+                ]],
+                [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+             [gl_cv_sys_struct_timespec_in_unistd_h=yes],
+             [gl_cv_sys_struct_timespec_in_unistd_h=no])])
+        if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then
+          UNISTD_H_DEFINES_STRUCT_TIMESPEC=1
+        fi
+      fi
+    fi
+  fi
+  AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
+  AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
+  AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])
+  AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC])
+])
+
+# gl_TIME_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_TIME_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_TIME_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CTIME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKTIME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALTIME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_TIME_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_TIME_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_DECL_LOCALTIME_R=1;               AC_SUBST([HAVE_DECL_LOCALTIME_R])
+  HAVE_NANOSLEEP=1;                      AC_SUBST([HAVE_NANOSLEEP])
+  HAVE_STRPTIME=1;                       AC_SUBST([HAVE_STRPTIME])
+  HAVE_TIMEGM=1;                         AC_SUBST([HAVE_TIMEGM])
+  HAVE_TIMESPEC_GET=1;                   AC_SUBST([HAVE_TIMESPEC_GET])
+  HAVE_TIMESPEC_GETRES=1;                AC_SUBST([HAVE_TIMESPEC_GETRES])
+  dnl Even GNU libc does not have timezone_t yet.
+  HAVE_TIMEZONE_T=0;                     AC_SUBST([HAVE_TIMEZONE_T])
+  REPLACE_CTIME=0;                       AC_SUBST([REPLACE_CTIME])
+  REPLACE_GMTIME=0;                      AC_SUBST([REPLACE_GMTIME])
+  REPLACE_LOCALTIME=0;                   AC_SUBST([REPLACE_LOCALTIME])
+  REPLACE_LOCALTIME_R=0;                 AC_SUBST([REPLACE_LOCALTIME_R])
+  REPLACE_MKTIME=0;                      AC_SUBST([REPLACE_MKTIME])
+  REPLACE_NANOSLEEP=0;                   AC_SUBST([REPLACE_NANOSLEEP])
+  REPLACE_STRFTIME=0;                    AC_SUBST([REPLACE_STRFTIME])
+  REPLACE_TIME=0;                        AC_SUBST([REPLACE_TIME])
+  REPLACE_TIMEGM=0;                      AC_SUBST([REPLACE_TIMEGM])
+  REPLACE_TIMESPEC_GET=0;                AC_SUBST([REPLACE_TIMESPEC_GET])
+  REPLACE_TIMESPEC_GETRES=0;             AC_SUBST([REPLACE_TIMESPEC_GETRES])
+  REPLACE_TZSET=0;                       AC_SUBST([REPLACE_TZSET])
+])
deleted file mode 120000 (symlink)
index 7555ae5687e4c385f3ddbe1d738a554a7aeb11bc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/time_r.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..4ee2175b6908d1b41158f6a2bbf75d2e69bc1a28
--- /dev/null
@@ -0,0 +1,97 @@
+dnl Reentrant time functions: localtime_r, gmtime_r.
+
+dnl Copyright (C) 2003, 2006-2024 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_TIME_R],
+[
+  dnl Persuade glibc and Solaris <time.h> to declare localtime_r.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gl_TIME_H_DEFAULTS])
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is
+  dnl not defined.
+  AC_CHECK_DECLS([localtime_r], [], [],
+    [[/* mingw's <time.h> provides the functions asctime_r, ctime_r,
+         gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has
+         been included before.  */
+      #if defined __MINGW32__
+      # include <unistd.h>
+      #endif
+      #include <time.h>
+    ]])
+  if test $ac_cv_have_decl_localtime_r = no; then
+    HAVE_DECL_LOCALTIME_R=0
+  fi
+
+  AC_CHECK_FUNCS_ONCE([localtime_r])
+  if test $ac_cv_func_localtime_r = yes; then
+    HAVE_LOCALTIME_R=1
+    AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature],
+      [gl_cv_time_r_posix],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[/* mingw's <time.h> provides the functions asctime_r, ctime_r,
+                 gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has
+                 been included before.  */
+              #if defined __MINGW32__
+              # include <unistd.h>
+              #endif
+              #include <time.h>
+            ]],
+            [[/* We don't need to append 'restrict's to the argument types,
+                 even though the POSIX signature has the 'restrict's,
+                 since C99 says they can't affect type compatibility.  */
+              struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
+              if (ptr) return 0;
+              /* Check the return type is a pointer.
+                 On HP-UX 10 it is 'int'.  */
+              *localtime_r (0, 0);]])
+         ],
+         [gl_cv_time_r_posix=yes],
+         [gl_cv_time_r_posix=no])
+      ])
+    if test $gl_cv_time_r_posix != yes; then
+      REPLACE_LOCALTIME_R=1
+    fi
+  else
+    HAVE_LOCALTIME_R=0
+    dnl On mingw, localtime_r() is defined as an inline function; use through a
+    dnl direct function call works but the use as a function pointer leads to a
+    dnl link error.
+    AC_CACHE_CHECK([whether localtime_r exists as an inline function],
+      [gl_cv_func_localtime_r_inline],
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[/* mingw's <time.h> provides the functions asctime_r, ctime_r,
+                 gmtime_r, localtime_r only if <unistd.h> or <pthread.h> has
+                 been included before.  */
+              #if defined __MINGW32__
+              # include <unistd.h>
+              #endif
+              #include <time.h>
+            ]],
+            [[time_t a;
+              struct tm r;
+              localtime_r (&a, &r);
+            ]])
+         ],
+         [gl_cv_func_localtime_r_inline=yes],
+         [gl_cv_func_localtime_r_inline=no])
+      ])
+    if test $gl_cv_func_localtime_r_inline = yes; then
+      REPLACE_LOCALTIME_R=1
+    fi
+  fi
+])
+
+# Prerequisites of lib/time_r.c.
+AC_DEFUN([gl_PREREQ_TIME_R], [
+  :
+])
deleted file mode 120000 (symlink)
index 86b5591c3dbbe5060093538d77162a64bb2ca3d5..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/time_rz.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c3b72b7603bdb807ec236e475c49ad32e21dd1a7
--- /dev/null
@@ -0,0 +1,53 @@
+dnl Time zone functions: tzalloc, localtime_rz, etc.
+
+dnl Copyright (C) 2015-2024 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_TIME_RZ],
+[
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_TIME_H_DEFAULTS])
+  AC_REQUIRE([AC_STRUCT_TIMEZONE])
+
+  # On Mac OS X 10.6, localtime loops forever with some time_t values.
+  # See Bug#27706, Bug#27736, and
+  # https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html
+  AC_CACHE_CHECK([whether localtime works even near extrema],
+    [gl_cv_func_localtime_works],
+    [gl_cv_func_localtime_works=yes
+     AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdlib.h>
+            #include <string.h>
+            #include <unistd.h>
+            #include <time.h>
+          ]], [[
+            time_t t = -67768038400666600;
+            struct tm *tm;
+            char *tz = getenv ("TZ");
+            if (! (tz && strcmp (tz, "QQQ0") == 0))
+              return 0;
+            alarm (2);
+            tm = localtime (&t);
+            /* Use TM and *TM to suppress over-optimization.  */
+            return tm && tm->tm_isdst;
+          ]])],
+       [(TZ=QQQ0 ./conftest$EXEEXT) >/dev/null 2>&1 ||
+           gl_cv_func_localtime_works=no],
+       [],
+       [gl_cv_func_localtime_works="guessing yes"])])
+  if test "$gl_cv_func_localtime_works" = no; then
+      AC_DEFINE([HAVE_LOCALTIME_INFLOOP_BUG], 1,
+        [Define if localtime-like functions can loop forever on
+         extreme arguments.])
+  fi
+
+  AC_CHECK_TYPES([timezone_t], [], [], [[#include <time.h>]])
+  if test "$ac_cv_type_timezone_t" = yes; then
+    HAVE_TIMEZONE_T=1
+  fi
+])
deleted file mode 120000 (symlink)
index cc584f2fc0edb110f674700043532b553627e9b7..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/timegm.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..84336043e5d1a741b87a32fbdb3268dc0f104d4b
--- /dev/null
@@ -0,0 +1,28 @@
+# timegm.m4 serial 16
+dnl Copyright (C) 2003, 2007, 2009-2024 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_TIMEGM],
+[
+  AC_REQUIRE([gl_TIME_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
+  gl_CHECK_FUNCS_ANDROID([timegm], [[#include <time.h>]])
+  if test $ac_cv_func_timegm = yes; then
+    if test "$gl_cv_func_working_mktime" != yes; then
+      # Assume that timegm is buggy if mktime is.
+      REPLACE_TIMEGM=1
+    fi
+  else
+    HAVE_TIMEGM=0
+    case "$gl_cv_onwards_func_timegm" in
+      future*) REPLACE_TIMEGM=1 ;;
+    esac
+  fi
+])
+
+# Prerequisites of lib/timegm.c.
+AC_DEFUN([gl_PREREQ_TIMEGM], [
+  :
+])
deleted file mode 120000 (symlink)
index 04602f585ae3e194934d6c69f3afc738c223c08e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/timer_time.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..10b7654d30f4c22e3a616615d88d463ce68f8605
--- /dev/null
@@ -0,0 +1,52 @@
+# timer_time.m4 serial 6
+dnl Copyright (C) 2011-2024 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.
+
+# Check for timer_settime, and set TIMER_TIME_LIB.
+
+AC_DEFUN([gl_TIMER_TIME],
+[
+  dnl Based on clock_time.m4. See details there.
+
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl Test whether the gnulib module 'threadlib' is in use.
+  dnl Some packages like Emacs use --avoid=threadlib.
+  dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
+  dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
+  m4_ifdef([gl_][PTHREADLIB], [AC_REQUIRE([gl_][PTHREADLIB])])
+
+  AC_CHECK_DECL([timer_settime], [], [],
+                [[#include <time.h>
+                ]])
+  TIMER_TIME_LIB=
+  AC_SUBST([TIMER_TIME_LIB])
+  AS_IF([test "$ac_cv_have_decl_timer_settime" = yes], [
+    gl_saved_libs=$LIBS
+    AC_SEARCH_LIBS([timer_settime], [rt posix4],
+                   [test "$ac_cv_search_timer_settime" = "none required" ||
+                    TIMER_TIME_LIB=$ac_cv_search_timer_settime])
+    m4_ifdef([gl_][PTHREADLIB],
+      [dnl GLIBC uses threads to emulate posix timers when kernel support
+       dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
+       dnl Now the pthread lib is linked automatically in the normal case,
+       dnl but when linking statically, it needs to be explicitly specified.
+       AC_EGREP_CPP([Thread],
+         [#include <features.h>
+          #ifdef __GNU_LIBRARY__
+           #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
+               && !(__UCLIBC__ && __HAS_NO_THREADS__)
+            Thread emulation available
+           #endif
+          #endif
+         ],
+         [TIMER_TIME_LIB="$TIMER_TIME_LIB $LIBPMULTITHREAD"])])
+    AC_CHECK_FUNCS([timer_settime])
+    LIBS=$gl_saved_libs
+  ])
+  dnl For backward compatibility.
+  LIB_TIMER_TIME="$TIMER_TIME_LIB"
+  AC_SUBST([LIB_TIMER_TIME])
+])
deleted file mode 120000 (symlink)
index 7d3a849064d6cac4fef0ae7803d72dd88d8fe614..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/timespec.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..59a0db9966e3d96b3275b7453392b8b5eac925d2
--- /dev/null
@@ -0,0 +1,11 @@
+#serial 15
+
+# Copyright (C) 2000-2001, 2003-2007, 2009-2024 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_TIMESPEC], [:])
deleted file mode 120000 (symlink)
index d55d790fe3a88a90e7c29987f15abf214bf776d4..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/tls.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7292ce4ea2f385acd1e083628d779aaf9bf1dd2a
--- /dev/null
@@ -0,0 +1,12 @@
+# tls.m4 serial 2 (gettext-0.18)
+dnl Copyright (C) 2005, 2008-2024 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 Bruno Haible.
+
+AC_DEFUN([gl_TLS],
+[
+  AC_REQUIRE([gl_THREADLIB])
+])
deleted file mode 120000 (symlink)
index a672e25acb109d49e61d1e0d0f29b18c9ce900dc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/tm_gmtoff.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f2e51597fdf13df38a0d2d68655834a9bd4b9887
--- /dev/null
@@ -0,0 +1,14 @@
+# tm_gmtoff.m4 serial 3
+dnl Copyright (C) 2002, 2009-2024 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_TM_GMTOFF],
+[
+ AC_CHECK_MEMBER([struct tm.tm_gmtoff],
+                 [AC_DEFINE([HAVE_TM_GMTOFF], [1],
+                            [Define if struct tm has the tm_gmtoff member.])],
+                 ,
+                 [#include <time.h>])
+])
deleted file mode 120000 (symlink)
index c6a22c4809cf288fff9fc05c8ed45fbb58cf8f4a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/tmpdir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..89bece684164cec410234abd60a1d710c1ed9cca
--- /dev/null
@@ -0,0 +1,9 @@
+# tmpdir.m4 serial 4
+dnl Copyright (C) 2001-2002, 2006, 2009-2024 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.
+
+# Prerequisites for lib/tmpdir.c
+
+AC_DEFUN([gt_TMPDIR], [:])
deleted file mode 120000 (symlink)
index c1113cd0070d9d763d13c0fa4914db2ccd772adb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/tmpfile.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f1273acca54101d9589ded685dd0a5aaa831241a
--- /dev/null
@@ -0,0 +1,62 @@
+# tmpfile.m4 serial 4
+# Copyright (C) 2007, 2009-2024 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.
+
+# Written by Ben Pfaff.
+
+# Check whether to use a replacement tmpfile() function.
+
+# The native Windows tmpfile function always tries to put the temporary
+# file in the root directory.  (This behaviour is even documented in
+# Microsoft's documentation!)  This often fails for ordinary users who
+# don't have the permissions to write in the root directory.
+#
+# We can't test for tmpfile even at runtime, since our test program
+# might be running with privileges that allow it to write to the root
+# directory, even though tmpfile wouldn't work in general.  Instead,
+# just test for a Windows platform (excluding Cygwin).
+
+# On Android 4.3, tmpfile() always returns NULL, even if TMPDIR is set
+# to a writable directory.
+
+AC_DEFUN([gl_FUNC_TMPFILE], [
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether tmpfile works],
+    [gl_cv_func_tmpfile_works],
+    [AC_EGREP_CPP([choke me], [
+#if defined _WIN32 && !defined __CYGWIN__
+choke me
+#endif
+       ],
+       [gl_cv_func_tmpfile_works=no],
+       [AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <stdlib.h>
+int
+main (void)
+{
+  return tmpfile () == NULL;
+}]])],
+          [gl_cv_func_tmpfile_works=yes],
+          [gl_cv_func_tmpfile_works=no],
+          [case "$host_os" in
+                              # Guess no on Android.
+             linux*-android*) gl_cv_func_tmpfile_works="guessing no" ;;
+                              # Guess yes otherwise.
+             *)               gl_cv_func_tmpfile_works="guessing yes" ;;
+           esac
+          ])
+       ])
+    ])
+  case "$gl_cv_func_tmpfile_works" in
+    *yes) ;;
+    *) REPLACE_TMPFILE=1 ;;
+  esac
+])
+
+# Prerequisites of lib/tmpfile.c.
+AC_DEFUN([gl_PREREQ_TMPFILE], [:])
deleted file mode 120000 (symlink)
index f74a677a3514cc37c28ec84ff2ba735ddc4ba4bc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/tzset.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d220534dd5993ec0136149658ab63a37564cae73
--- /dev/null
@@ -0,0 +1,17 @@
+# serial 18
+
+# Copyright (C) 2003, 2007, 2009-2024 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.
+
+# Written by Paul Eggert and Jim Meyering.
+
+AC_DEFUN([gl_FUNC_TZSET],
+[
+  AC_REQUIRE([gl_TIME_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw* | windows*) REPLACE_TZSET=1 ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 67f5e7f980b1a4c301176584bbc4aa4d26b0866a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/uchar_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..abd4f51fcf8894afab249b76f6a7f434476128a3
--- /dev/null
@@ -0,0 +1,249 @@
+# uchar_h.m4 serial 31
+dnl Copyright (C) 2019-2024 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 Bruno Haible.
+dnl Prepare the overridden <uchar.h>.
+
+AC_DEFUN_ONCE([gl_UCHAR_H],
+[
+  AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
+
+  gl_CHECK_NEXT_HEADERS([uchar.h])
+  if test $ac_cv_header_uchar_h = yes; then
+    HAVE_UCHAR_H=1
+  else
+    HAVE_UCHAR_H=0
+  fi
+  AC_SUBST([HAVE_UCHAR_H])
+
+  gl_TYPE_CHAR8_T
+  gl_TYPE_CHAR16_T
+  gl_TYPE_CHAR32_T
+
+  dnl In C++ mode, clang defines 'char16_t' and 'char32_t' as built-in types
+  dnl on some platforms (e.g. OpenBSD 6.7), and as types defined by many
+  dnl header files (<limits.h>, <stddef.h>, <stdint.h>, <stdio.h>, <stdlib.h>
+  dnl and others) on some platforms (e.g. Mac OS X 10.13).
+  dnl The same thing may also happen for 'char8_t'; so, be prepared for it.
+  m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
+  CXX_HAS_UCHAR_TYPES=0
+  if test $HAVE_UCHAR_H = 0; then
+    if test "$CXX" != no; then
+      AC_CACHE_CHECK([whether the C++ compiler predefines the <uchar.h> types],
+        [gl_cv_cxx_has_uchar_types],
+        [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
+         dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
+         cat > conftest.cpp <<\EOF
+#include <stddef.h>
+char16_t a;
+char32_t b;
+EOF
+         gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
+         if AC_TRY_EVAL([gl_command]); then
+           gl_cv_cxx_has_uchar_types=yes
+         else
+           gl_cv_cxx_has_uchar_types=no
+         fi
+         rm -fr conftest*
+        ])
+      if test $gl_cv_cxx_has_uchar_types = yes; then
+        CXX_HAS_UCHAR_TYPES=1
+      fi
+    fi
+  fi
+  AC_SUBST([CXX_HAS_UCHAR_TYPES])
+  CXX_HAS_CHAR8_TYPE=0
+  if test $HAVE_UCHAR_H = 0; then
+    if test "$CXX" != no; then
+      AC_CACHE_CHECK([whether the C++ compiler predefines the char8_t types],
+        [gl_cv_cxx_has_char8_type],
+        [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
+         dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
+         cat > conftest.cpp <<\EOF
+#include <stddef.h>
+char8_t a;
+EOF
+         gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
+         if AC_TRY_EVAL([gl_command]); then
+           gl_cv_cxx_has_char8_type=yes
+         else
+           gl_cv_cxx_has_char8_type=no
+         fi
+         rm -fr conftest*
+        ])
+      if test $gl_cv_cxx_has_char8_type = yes; then
+        CXX_HAS_CHAR8_TYPE=1
+      fi
+    fi
+  fi
+  AC_SUBST([CXX_HAS_CHAR8_TYPE])
+
+  dnl Test whether a 'char32_t' can hold more characters than a 'wchar_t'.
+  gl_STDINT_BITSIZEOF([wchar_t], [gl_STDINT_INCLUDES])
+  if test $BITSIZEOF_WCHAR_T -lt 32; then
+    SMALL_WCHAR_T=1
+  else
+    SMALL_WCHAR_T=0
+  fi
+  dnl SMALL_WCHAR_T is expected to be 1 on 32-bit AIX, Cygwin, native Windows.
+  AC_SUBST([SMALL_WCHAR_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C11.
+  gl_WARN_ON_USE_PREPARE([[
+      #ifdef __HAIKU__
+       #include <stdint.h>
+      #endif
+      #include <uchar.h>
+    ]], [c32rtomb mbrtoc16 mbrtoc32])
+])
+
+AC_DEFUN_ONCE([gl_TYPE_CHAR8_T],
+[
+  dnl Determine whether gnulib's <uchar.h> would, if present, override char8_t.
+  AC_CACHE_CHECK([whether char8_t is correctly defined],
+    [gl_cv_type_char8_t_works],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #ifdef __HAIKU__
+           #include <stdint.h>
+          #endif
+          #include <uchar.h>
+          int verify[(char8_t)(-1) >= 0 && sizeof (char8_t) == sizeof (unsigned char) ? 1 : -1];
+          ]])
+       ],
+       [gl_cv_type_char8_t_works=yes],
+       [gl_cv_type_char8_t_works=no])
+    ])
+  if test $gl_cv_type_char8_t_works = no; then
+    GNULIBHEADERS_OVERRIDE_CHAR8_T=1
+  else
+    GNULIBHEADERS_OVERRIDE_CHAR8_T=0
+  fi
+  AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR8_T])
+])
+
+dnl On Haiku 2020, char16_t and char32_t are incorrectly defined.
+dnl See <https://dev.haiku-os.org/ticket/15990>.
+AC_DEFUN_ONCE([gl_TYPE_CHAR16_T],
+[
+  dnl Determine whether gnulib's <uchar.h> would, if present, override char16_t.
+  AC_CACHE_CHECK([whether char16_t is correctly defined],
+    [gl_cv_type_char16_t_works],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #ifdef __HAIKU__
+           #include <stdint.h>
+          #endif
+          #include <uchar.h>
+          /* For simplicity, assume that uint16_least_t is equivalent to
+             'unsigned short'.  */
+          int verify[(char16_t)(-1) >= 0 && sizeof (char16_t) == sizeof (unsigned short) ? 1 : -1];
+          ]])
+       ],
+       [gl_cv_type_char16_t_works=yes],
+       [gl_cv_type_char16_t_works=no])
+    ])
+  if test $gl_cv_type_char16_t_works = no; then
+    GNULIBHEADERS_OVERRIDE_CHAR16_T=1
+  else
+    GNULIBHEADERS_OVERRIDE_CHAR16_T=0
+  fi
+  AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR16_T])
+])
+AC_DEFUN_ONCE([gl_TYPE_CHAR32_T],
+[
+  dnl Determine whether gnulib's <uchar.h> would, if present, override char32_t.
+  AC_CACHE_CHECK([whether char32_t is correctly defined],
+    [gl_cv_type_char32_t_works],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #ifdef __HAIKU__
+           #include <stdint.h>
+          #endif
+          #include <uchar.h>
+          /* For simplicity, assume that uint32_least_t is equivalent to
+             'unsigned int'.  */
+          int verify[(char32_t)(-1) >= 0 && sizeof (char32_t) == sizeof (unsigned int) ? 1 : -1];
+          ]])
+       ],
+       [gl_cv_type_char32_t_works=yes],
+       [gl_cv_type_char32_t_works=no])
+    ])
+  if test $gl_cv_type_char32_t_works = no; then
+    GNULIBHEADERS_OVERRIDE_CHAR32_T=1
+  else
+    GNULIBHEADERS_OVERRIDE_CHAR32_T=0
+  fi
+  AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR32_T])
+])
+
+# gl_UCHAR_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_UCHAR_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_UCHAR_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_UCHAR_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOC32])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALNUM])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALPHA])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISBLANK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISCNTRL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISDIGIT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISGRAPH])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISLOWER])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPRINT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPUNCT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISSPACE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISUPPER])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISXDIGIT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOLOWER])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOUPPER])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32WIDTH])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32RTOMB])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SNRTOMBS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SRTOMBS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32STOMBS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SWIDTH])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOB])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_MAPPING])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_TYPE_TEST])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_MAPPING])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_TYPE_TEST])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC16])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC32])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOC32S])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOC32S])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOC32S])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_UCHAR_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_C32RTOMB=1;             AC_SUBST([HAVE_C32RTOMB])
+  HAVE_MBRTOC16=1;             AC_SUBST([HAVE_MBRTOC16])
+  HAVE_MBRTOC32=1;             AC_SUBST([HAVE_MBRTOC32])
+  REPLACE_C32RTOMB=0;          AC_SUBST([REPLACE_C32RTOMB])
+  REPLACE_MBRTOC16=0;          AC_SUBST([REPLACE_MBRTOC16])
+  REPLACE_MBRTOC32=0;          AC_SUBST([REPLACE_MBRTOC32])
+])
deleted file mode 120000 (symlink)
index 5434ca762bcc82baf3e25284aaf2fbe15985cf7f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/uname.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..36ab734569438ef939244e527977d369a8a24284
--- /dev/null
@@ -0,0 +1,19 @@
+# uname.m4 serial 11
+dnl Copyright (C) 2009-2024 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_UNAME],
+[
+  AC_REQUIRE([gl_SYS_UTSNAME_H_DEFAULTS])
+  AC_CHECK_FUNCS([uname])
+  if test $ac_cv_func_uname = no; then
+    HAVE_UNAME=0
+  fi
+])
+
+# Prerequisites of lib/uname.c.
+AC_DEFUN([gl_PREREQ_UNAME], [
+  :
+])
deleted file mode 120000 (symlink)
index a828109cbf871ca38e0145fac4fc8c021cf78b83..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/ungetc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aab83e12e8c09d8e6251086fd11d18c6a8cc2fb2
--- /dev/null
@@ -0,0 +1,73 @@
+# ungetc.m4 serial 12
+dnl Copyright (C) 2009-2024 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_ONCE([gl_FUNC_UNGETC_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  AC_CACHE_CHECK([whether ungetc works on arbitrary bytes],
+    [gl_cv_func_ungetc_works],
+    [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stdio.h>
+      ]], [[FILE *f;
+            if (!(f = fopen ("conftest.tmp", "w+")))
+              return 1;
+            if (fputs ("abc", f) < 0)
+              { fclose (f); return 2; }
+            rewind (f);
+            if (fgetc (f) != 'a')
+              { fclose (f); return 3; }
+            if (fgetc (f) != 'b')
+              { fclose (f); return 4; }
+            if (ungetc ('d', f) != 'd')
+              { fclose (f); return 5; }
+            if (ftell (f) != 1)
+              { fclose (f); return 6; }
+            if (fgetc (f) != 'd')
+              { fclose (f); return 7; }
+            if (ftell (f) != 2)
+              { fclose (f); return 8; }
+            if (fseek (f, 0, SEEK_CUR) != 0)
+              { fclose (f); return 9; }
+            if (ftell (f) != 2)
+              { fclose (f); return 10; }
+            if (fgetc (f) != 'c')
+              { fclose (f); return 11; }
+            fclose (f);
+            remove ("conftest.tmp");
+          ]])],
+        [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no],
+        [case "$host_os" in
+                               # Guess yes on glibc systems.
+           *-gnu* | gnu*)      gl_cv_func_ungetc_works="guessing yes" ;;
+                               # Guess yes on musl systems.
+           *-musl* | midipix*) gl_cv_func_ungetc_works="guessing yes" ;;
+                               # Guess yes on bionic systems.
+           *-android*)         gl_cv_func_ungetc_works="guessing yes" ;;
+                               # Guess yes on native Windows.
+           mingw* | windows*)  gl_cv_func_ungetc_works="guessing yes" ;;
+                               # If we don't know, obey --enable-cross-guesses.
+           *)                  gl_cv_func_ungetc_works="$gl_cross_guess_normal" ;;
+         esac
+        ])
+    ])
+  gl_ftello_broken_after_ungetc=no
+  case "$gl_cv_func_ungetc_works" in
+    *yes) ;;
+    *)
+      dnl On macOS >= 10.15, where the above program fails with exit code 6,
+      dnl we fix it through an ftello override.
+      case "$host_os" in
+        darwin*) gl_ftello_broken_after_ungetc=yes ;;
+        *)
+          AC_DEFINE([FUNC_UNGETC_BROKEN], [1],
+            [Define to 1 if ungetc is broken when used on arbitrary bytes.])
+          ;;
+      esac
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 21d8a98575ce8474da2dae042dc15a3ea0ed5aaf..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unicase_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ad2f6215668081eea1393274888a7f878f47da9b
--- /dev/null
@@ -0,0 +1,43 @@
+# unicase_h.m4 serial 1
+dnl Copyright (C) 2023-2024 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_ONCE([gl_UNICASE_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_UNICASE_H_DEFAULTS])
+])
+
+# gl_UNICASE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_UNICASE_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_UNICASE_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_UNICASE_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_UNICASE_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_UNICASE_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+])
deleted file mode 120000 (symlink)
index 5c62cac54f0a5a23a7ab80e26a2ca4cf6dacdc0a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unicodeio.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..619d3f70456b7e61b2c1f73c69e3688f309befcc
--- /dev/null
@@ -0,0 +1,11 @@
+# unicodeio.m4 serial 3
+dnl Copyright (C) 2002-2003, 2009-2024 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_UNICODEIO],
+[
+  dnl Prerequisites of lib/unicodeio.c.
+  gl_MUSL_LIBC
+])
deleted file mode 120000 (symlink)
index ac6f92e8b422e1595e7d4ac4426469b12ff1ae69..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unictype_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c4bc5c2c8dd40281cf9e092110dbddd29995b6ba
--- /dev/null
@@ -0,0 +1,172 @@
+# unictype_h.m4 serial 1
+dnl Copyright (C) 2023-2024 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_ONCE([gl_UNICTYPE_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS])
+])
+
+# gl_UNICTYPE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_UNICTYPE_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_UNICTYPE_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_UNICTYPE_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_UNICTYPE_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+])
deleted file mode 120000 (symlink)
index afcee565018e9bef780162a724ab58a82b4fee01..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/uninorm_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..aadf55989ce97e93fdedc7f2ad3105f008905280
--- /dev/null
@@ -0,0 +1,45 @@
+# uninorm_h.m4 serial 1
+dnl Copyright (C) 2023-2024 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_ONCE([gl_UNINORM_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_UNINORM_H_DEFAULTS])
+])
+
+# gl_UNINORM_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_UNINORM_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_UNINORM_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_UNINORM_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_UNINORM_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_UNINORM_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+])
deleted file mode 120000 (symlink)
index 7fac10c1d3cfb740c04404e30985698d123e2670..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unistd-safer.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9d50964840b482314be44e0148699ccc5ed8edb0
--- /dev/null
@@ -0,0 +1,10 @@
+#serial 9
+dnl Copyright (C) 2002, 2005-2006, 2009-2024 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])
+])
deleted file mode 120000 (symlink)
index e34d7667e89b2c2151e6c5c52df9705eb52f42fc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unistd_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e078bd617a7b4f0da98071f93f048e4e2ac7e82a
--- /dev/null
@@ -0,0 +1,276 @@
+# unistd_h.m4 serial 95
+dnl Copyright (C) 2006-2024 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 Simon Josefsson, Bruno Haible.
+
+AC_DEFUN_ONCE([gl_UNISTD_H],
+[
+  dnl Ensure to expand the default settings once only, before all statements
+  dnl that occur in other macros.
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
+  gl_CHECK_NEXT_HEADERS([unistd.h])
+  if test $ac_cv_header_unistd_h = yes; then
+    HAVE_UNISTD_H=1
+  else
+    HAVE_UNISTD_H=0
+  fi
+  AC_SUBST([HAVE_UNISTD_H])
+
+  dnl Ensure the type pid_t gets defined.
+  AC_REQUIRE([AC_TYPE_PID_T])
+
+  dnl Determine WINDOWS_64_BIT_OFF_T.
+  AC_REQUIRE([gl_TYPE_OFF_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+/* Some systems declare various items in the wrong headers.  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <fcntl.h>
+# include <stdio.h>
+# include <stdlib.h>
+# if defined _WIN32 && ! defined __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+    ]], [access chdir chown copy_file_range dup dup2 dup3 environ euidaccess
+    execl execle execlp execv execve execvp execvpe
+    faccessat fchdir
+    fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize
+    getentropy getgroups gethostname getlogin getlogin_r getpagesize getpass
+    getusershell setusershell endusershell
+    group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite
+    readlink readlinkat rmdir sethostname sleep symlink symlinkat
+    truncate ttyname_r unlink unlinkat usleep])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS_ONCE([execvpe])
+  if test $ac_cv_have_decl_execvpe = no; then
+    HAVE_DECL_EXECVPE=0
+  fi
+])
+
+# gl_UNISTD_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_UNISTD_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCESS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHOWN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPY_FILE_RANGE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP2])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP3])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ENVIRON])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EUIDACCESS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECV])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVPE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FACCESSAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHOWNAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDATASYNC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSYNC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTRUNCATE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCWD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDOMAINNAME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDTABLESIZE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETENTROPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETGROUPS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETHOSTNAME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN_R])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETOPT_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAGESIZE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS_GNU])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUSERSHELL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GROUP_MEMBER])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISATTY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHOWN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINKAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSEEK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE2])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PREAD])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PWRITE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READ])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINKAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RMDIR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETHOSTNAME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SLEEP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINKAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCATE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TTYNAME_R])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_NONBLOCKING])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_SIGPIPE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINKAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_USLEEP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WRITE])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ACCESS], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHDIR], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CLOSE], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP2], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECL], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLE], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLP], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECV], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVE], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVP], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVPE], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETCWD], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETPID], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ISATTY], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEEK], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_READ], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_RMDIR], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_SWAB], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UNLINK], [1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WRITE], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_UNISTD_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_CHOWN=1;                      AC_SUBST([HAVE_CHOWN])
+  HAVE_COPY_FILE_RANGE=1;            AC_SUBST([HAVE_COPY_FILE_RANGE])
+  HAVE_DUP3=1;                       AC_SUBST([HAVE_DUP3])
+  HAVE_EUIDACCESS=1;                 AC_SUBST([HAVE_EUIDACCESS])
+  HAVE_EXECVPE=1;                    AC_SUBST([HAVE_EXECVPE])
+  HAVE_FACCESSAT=1;                  AC_SUBST([HAVE_FACCESSAT])
+  HAVE_FCHDIR=1;                     AC_SUBST([HAVE_FCHDIR])
+  HAVE_FCHOWNAT=1;                   AC_SUBST([HAVE_FCHOWNAT])
+  HAVE_FDATASYNC=1;                  AC_SUBST([HAVE_FDATASYNC])
+  HAVE_FSYNC=1;                      AC_SUBST([HAVE_FSYNC])
+  HAVE_FTRUNCATE=1;                  AC_SUBST([HAVE_FTRUNCATE])
+  HAVE_GETDTABLESIZE=1;              AC_SUBST([HAVE_GETDTABLESIZE])
+  HAVE_GETENTROPY=1;                 AC_SUBST([HAVE_GETENTROPY])
+  HAVE_GETGROUPS=1;                  AC_SUBST([HAVE_GETGROUPS])
+  HAVE_GETHOSTNAME=1;                AC_SUBST([HAVE_GETHOSTNAME])
+  HAVE_GETLOGIN=1;                   AC_SUBST([HAVE_GETLOGIN])
+  HAVE_GETPAGESIZE=1;                AC_SUBST([HAVE_GETPAGESIZE])
+  HAVE_GETPASS=1;                    AC_SUBST([HAVE_GETPASS])
+  HAVE_GROUP_MEMBER=1;               AC_SUBST([HAVE_GROUP_MEMBER])
+  HAVE_LCHOWN=1;                     AC_SUBST([HAVE_LCHOWN])
+  HAVE_LINK=1;                       AC_SUBST([HAVE_LINK])
+  HAVE_LINKAT=1;                     AC_SUBST([HAVE_LINKAT])
+  HAVE_PIPE=1;                       AC_SUBST([HAVE_PIPE])
+  HAVE_PIPE2=1;                      AC_SUBST([HAVE_PIPE2])
+  HAVE_PREAD=1;                      AC_SUBST([HAVE_PREAD])
+  HAVE_PWRITE=1;                     AC_SUBST([HAVE_PWRITE])
+  HAVE_READLINK=1;                   AC_SUBST([HAVE_READLINK])
+  HAVE_READLINKAT=1;                 AC_SUBST([HAVE_READLINKAT])
+  HAVE_SETHOSTNAME=1;                AC_SUBST([HAVE_SETHOSTNAME])
+  HAVE_SLEEP=1;                      AC_SUBST([HAVE_SLEEP])
+  HAVE_SYMLINK=1;                    AC_SUBST([HAVE_SYMLINK])
+  HAVE_SYMLINKAT=1;                  AC_SUBST([HAVE_SYMLINKAT])
+  HAVE_UNLINKAT=1;                   AC_SUBST([HAVE_UNLINKAT])
+  HAVE_USLEEP=1;                     AC_SUBST([HAVE_USLEEP])
+  HAVE_DECL_ENVIRON=1;               AC_SUBST([HAVE_DECL_ENVIRON])
+  HAVE_DECL_EXECVPE=1;               AC_SUBST([HAVE_DECL_EXECVPE])
+  HAVE_DECL_FCHDIR=1;                AC_SUBST([HAVE_DECL_FCHDIR])
+  HAVE_DECL_FDATASYNC=1;             AC_SUBST([HAVE_DECL_FDATASYNC])
+  HAVE_DECL_GETDOMAINNAME=1;         AC_SUBST([HAVE_DECL_GETDOMAINNAME])
+  HAVE_DECL_GETLOGIN=1;              AC_SUBST([HAVE_DECL_GETLOGIN])
+  HAVE_DECL_GETLOGIN_R=1;            AC_SUBST([HAVE_DECL_GETLOGIN_R])
+  HAVE_DECL_GETPAGESIZE=1;           AC_SUBST([HAVE_DECL_GETPAGESIZE])
+  HAVE_DECL_GETUSERSHELL=1;          AC_SUBST([HAVE_DECL_GETUSERSHELL])
+  HAVE_DECL_SETHOSTNAME=1;           AC_SUBST([HAVE_DECL_SETHOSTNAME])
+  HAVE_DECL_TRUNCATE=1;              AC_SUBST([HAVE_DECL_TRUNCATE])
+  HAVE_DECL_TTYNAME_R=1;             AC_SUBST([HAVE_DECL_TTYNAME_R])
+  HAVE_OS_H=0;                       AC_SUBST([HAVE_OS_H])
+  HAVE_SYS_PARAM_H=0;                AC_SUBST([HAVE_SYS_PARAM_H])
+  REPLACE_ACCESS=0;                  AC_SUBST([REPLACE_ACCESS])
+  REPLACE_CHOWN=0;                   AC_SUBST([REPLACE_CHOWN])
+  REPLACE_CLOSE=0;                   AC_SUBST([REPLACE_CLOSE])
+  REPLACE_COPY_FILE_RANGE=0;         AC_SUBST([REPLACE_COPY_FILE_RANGE])
+  REPLACE_DUP=0;                     AC_SUBST([REPLACE_DUP])
+  REPLACE_DUP2=0;                    AC_SUBST([REPLACE_DUP2])
+  REPLACE_DUP3=0;                    AC_SUBST([REPLACE_DUP3])
+  REPLACE_EXECL=0;                   AC_SUBST([REPLACE_EXECL])
+  REPLACE_EXECLE=0;                  AC_SUBST([REPLACE_EXECLE])
+  REPLACE_EXECLP=0;                  AC_SUBST([REPLACE_EXECLP])
+  REPLACE_EXECV=0;                   AC_SUBST([REPLACE_EXECV])
+  REPLACE_EXECVE=0;                  AC_SUBST([REPLACE_EXECVE])
+  REPLACE_EXECVP=0;                  AC_SUBST([REPLACE_EXECVP])
+  REPLACE_EXECVPE=0;                 AC_SUBST([REPLACE_EXECVPE])
+  REPLACE_FACCESSAT=0;               AC_SUBST([REPLACE_FACCESSAT])
+  REPLACE_FCHDIR=0;                  AC_SUBST([REPLACE_FCHDIR])
+  REPLACE_FCHOWNAT=0;                AC_SUBST([REPLACE_FCHOWNAT])
+  REPLACE_FDATASYNC=0;               AC_SUBST([REPLACE_FDATASYNC])
+  REPLACE_FTRUNCATE=0;               AC_SUBST([REPLACE_FTRUNCATE])
+  REPLACE_GETCWD=0;                  AC_SUBST([REPLACE_GETCWD])
+  REPLACE_GETDOMAINNAME=0;           AC_SUBST([REPLACE_GETDOMAINNAME])
+  REPLACE_GETDTABLESIZE=0;           AC_SUBST([REPLACE_GETDTABLESIZE])
+  REPLACE_GETENTROPY=0;              AC_SUBST([REPLACE_GETENTROPY])
+  REPLACE_GETLOGIN_R=0;              AC_SUBST([REPLACE_GETLOGIN_R])
+  REPLACE_GETGROUPS=0;               AC_SUBST([REPLACE_GETGROUPS])
+  REPLACE_GETPAGESIZE=0;             AC_SUBST([REPLACE_GETPAGESIZE])
+  REPLACE_GETPASS=0;                 AC_SUBST([REPLACE_GETPASS])
+  REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU])
+  REPLACE_ISATTY=0;                  AC_SUBST([REPLACE_ISATTY])
+  REPLACE_LCHOWN=0;                  AC_SUBST([REPLACE_LCHOWN])
+  REPLACE_LINK=0;                    AC_SUBST([REPLACE_LINK])
+  REPLACE_LINKAT=0;                  AC_SUBST([REPLACE_LINKAT])
+  REPLACE_LSEEK=0;                   AC_SUBST([REPLACE_LSEEK])
+  REPLACE_PIPE2=0;                   AC_SUBST([REPLACE_PIPE2])
+  REPLACE_PREAD=0;                   AC_SUBST([REPLACE_PREAD])
+  REPLACE_PWRITE=0;                  AC_SUBST([REPLACE_PWRITE])
+  REPLACE_READ=0;                    AC_SUBST([REPLACE_READ])
+  REPLACE_READLINK=0;                AC_SUBST([REPLACE_READLINK])
+  REPLACE_READLINKAT=0;              AC_SUBST([REPLACE_READLINKAT])
+  REPLACE_RMDIR=0;                   AC_SUBST([REPLACE_RMDIR])
+  REPLACE_SETHOSTNAME=0;             AC_SUBST([REPLACE_SETHOSTNAME])
+  REPLACE_SLEEP=0;                   AC_SUBST([REPLACE_SLEEP])
+  REPLACE_SYMLINK=0;                 AC_SUBST([REPLACE_SYMLINK])
+  REPLACE_SYMLINKAT=0;               AC_SUBST([REPLACE_SYMLINKAT])
+  REPLACE_TRUNCATE=0;                AC_SUBST([REPLACE_TRUNCATE])
+  REPLACE_TTYNAME_R=0;               AC_SUBST([REPLACE_TTYNAME_R])
+  REPLACE_UNLINK=0;                  AC_SUBST([REPLACE_UNLINK])
+  REPLACE_UNLINKAT=0;                AC_SUBST([REPLACE_UNLINKAT])
+  REPLACE_USLEEP=0;                  AC_SUBST([REPLACE_USLEEP])
+  REPLACE_WRITE=0;                   AC_SUBST([REPLACE_WRITE])
+  UNISTD_H_HAVE_SYS_RANDOM_H=0;      AC_SUBST([UNISTD_H_HAVE_SYS_RANDOM_H])
+  UNISTD_H_HAVE_WINSOCK2_H=0;        AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
+  UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
+                           AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
+])
deleted file mode 120000 (symlink)
index 208a735f35dfd129bcb7cea503bb93b14b768a34..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unlink-busy.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e7cb903d1f0613c24d3247f75076cdb6695cf8b3
--- /dev/null
@@ -0,0 +1,47 @@
+#serial 17
+
+dnl From J. David Anglin.
+
+dnl HPUX and other systems can't unlink shared text that is being executed.
+
+# Copyright (C) 2000-2001, 2004, 2007, 2009-2024 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_FUNC_UNLINK_BUSY_TEXT],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether a running program can be unlinked],
+    [gl_cv_func_unlink_busy_text],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE(
+           [AC_INCLUDES_DEFAULT
+            GL_MDA_DEFINES[
+            int
+            main (int argc, char **argv)
+            {
+              int result = 0;
+              if (argc == 0)
+                result |= 1;
+              else if (unlink (argv[0]) != 0)
+                result |= 2;
+              return result;
+            }]])],
+        [gl_cv_func_unlink_busy_text=yes],
+        [gl_cv_func_unlink_busy_text=no],
+        [case "$host_os" in
+                              # Guess no on native Windows.
+           mingw* | windows*) gl_cv_func_unlink_busy_text="guessing no" ;;
+           *)                 gl_cv_func_unlink_busy_text="guessing no" ;;
+         esac
+        ]
+      )
+    ]
+  )
+
+  case "$gl_cv_func_unlink_busy_text" in
+    *no) INSTALL=$ac_install_sh ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 74f7837dc9b35e72914b328a831a828b1d847457..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unlink.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..19982a0269b95366123e252c1f0b1fbce9347113
--- /dev/null
@@ -0,0 +1,137 @@
+# unlink.m4 serial 17
+dnl Copyright (C) 2009-2024 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_UNLINK],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_HEADERS_ONCE([unistd.h])
+
+  dnl Detect FreeBSD 7.2, AIX 7.1, Solaris 9 bug.
+  AC_CACHE_CHECK([whether unlink honors trailing slashes],
+    [gl_cv_func_unlink_honors_slashes],
+    [touch conftest.file
+     # Assume that if we have lstat, we can also check symlinks.
+     if test $ac_cv_func_lstat = yes; then
+       ln -s conftest.file conftest.lnk
+     fi
+     AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM(
+         [[#if HAVE_UNISTD_H
+           # include <unistd.h>
+           #else /* on Windows with MSVC */
+           # include <io.h>
+           #endif
+           #include <errno.h>
+         ]GL_MDA_DEFINES],
+         [[int result = 0;
+           if (!unlink ("conftest.file/"))
+             result |= 1;
+           else if (errno != ENOTDIR)
+             result |= 2;
+#if HAVE_LSTAT
+           if (!unlink ("conftest.lnk/"))
+             result |= 4;
+           else if (errno != ENOTDIR)
+             result |= 8;
+#endif
+           return result;
+         ]])],
+      [gl_cv_func_unlink_honors_slashes=yes],
+      [gl_cv_func_unlink_honors_slashes=no],
+      [case "$host_os" in
+                            # Guess yes on Linux systems.
+         linux-* | linux)   gl_cv_func_unlink_honors_slashes="guessing yes" ;;
+                            # Guess yes on systems that emulate the Linux system calls.
+         midipix*)          gl_cv_func_unlink_honors_slashes="guessing yes" ;;
+                            # Guess yes on glibc systems.
+         *-gnu*)            gl_cv_func_unlink_honors_slashes="guessing yes" ;;
+                            # Guess no on native Windows.
+         mingw* | windows*) gl_cv_func_unlink_honors_slashes="guessing no" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+         *)                 gl_cv_func_unlink_honors_slashes="$gl_cross_guess_normal" ;;
+       esac
+      ])
+     rm -f conftest.file conftest.lnk])
+  case "$gl_cv_func_unlink_honors_slashes" in
+    *no)
+      REPLACE_UNLINK=1
+      ;;
+  esac
+
+  dnl Detect Mac OS X 10.5.6 bug: On read-write HFS mounts, unlink("..") or
+  dnl unlink("../..") succeeds without doing anything.
+  AC_CACHE_CHECK([whether unlink of a parent directory fails as it should],
+    [gl_cv_func_unlink_parent_fails],
+    [case "$host_os" in
+       darwin*)
+         dnl Try to unlink a subdirectory of /tmp, because /tmp is usually on a
+         dnl HFS mount on Mac OS X. Use a subdirectory, owned by the current
+         dnl user, because otherwise unlink() may fail due to permissions
+         dnl reasons, and because when running as root we don't want to risk
+         dnl destroying the entire /tmp.
+         if {
+              # Use the mktemp program if available. If not available, hide the error
+              # message.
+              tmp=`(umask 077 && mktemp -d /tmp/gtXXXXXX) 2>/dev/null` &&
+              test -n "$tmp" && test -d "$tmp"
+            } ||
+            {
+              # Use a simple mkdir command. It is guaranteed to fail if the directory
+              # already exists.  $RANDOM is bash specific and expands to empty in shells
+              # other than bash, ksh and zsh.  Its use does not increase security;
+              # rather, it minimizes the probability of failure in a very cluttered /tmp
+              # directory.
+              tmp=/tmp/gt$$-$RANDOM
+              (umask 077 && mkdir "$tmp")
+            }; then
+           mkdir "$tmp/subdir"
+           GL_SUBDIR_FOR_UNLINK="$tmp/subdir"
+           export GL_SUBDIR_FOR_UNLINK
+           AC_RUN_IFELSE(
+             [AC_LANG_SOURCE([[
+                #include <stdlib.h>
+                #if HAVE_UNISTD_H
+                # include <unistd.h>
+                #else /* on Windows with MSVC */
+                # include <direct.h>
+                # include <io.h>
+                #endif
+                ]GL_MDA_DEFINES[
+                int main ()
+                {
+                  int result = 0;
+                  if (chdir (getenv ("GL_SUBDIR_FOR_UNLINK")) != 0)
+                    result |= 1;
+                  else if (unlink ("..") == 0)
+                    result |= 2;
+                  return result;
+                }
+              ]])],
+             [gl_cv_func_unlink_parent_fails=yes],
+             [gl_cv_func_unlink_parent_fails=no],
+             [# If we don't know, obey --enable-cross-guesses.
+              gl_cv_func_unlink_parent_fails="$gl_cross_guess_normal"
+             ])
+           unset GL_SUBDIR_FOR_UNLINK
+           rm -rf "$tmp"
+         else
+           gl_cv_func_unlink_parent_fails="guessing no"
+         fi
+         ;;
+       *)
+         gl_cv_func_unlink_parent_fails="guessing yes"
+         ;;
+     esac
+    ])
+  case "$gl_cv_func_unlink_parent_fails" in
+    *no)
+      REPLACE_UNLINK=1
+      AC_DEFINE([UNLINK_PARENT_BUG], [1],
+        [Define to 1 if unlink() on a parent directory may succeed])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 2d323dae08f7c357e694ec1331b112626b5a44a0..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unlinkat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d5615dfc47adc2d46641da46f62947c09f78593f
--- /dev/null
@@ -0,0 +1,34 @@
+# unlinkat.m4 serial 2
+dnl Copyright (C) 2004-2024 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_UNLINKAT],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_FUNCS_ONCE([unlinkat])
+  AC_REQUIRE([gl_FUNC_UNLINK])
+  AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+  if test $ac_cv_func_unlinkat = no; then
+    HAVE_UNLINKAT=0
+  else
+    case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+      *no)
+        # Solaris 9 has *at functions, but uniformly mishandles trailing
+        # slash in all of them.
+        REPLACE_UNLINKAT=1
+        ;;
+      *)
+        # GNU/Hurd has unlinkat, but it has the same bug as unlink.
+        # Darwin has unlinkat, but it has the same UNLINK_PARENT_BUG.
+        if test $REPLACE_UNLINK = 1; then
+          REPLACE_UNLINKAT=1
+        fi
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index a429500a6023344c978bcbb2541939714942ab98..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unlinkdir.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..baa3c0fc09910bae70b37943f7c7518bcb13bb39
--- /dev/null
@@ -0,0 +1,32 @@
+# serial 8
+
+# Copyright (C) 2005-2007, 2009-2024 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.
+
+# Written by Paul Eggert.
+
+AC_DEFUN([gl_UNLINKDIR],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_HEADERS_ONCE([priv.h])
+
+  # The Hurd, the Linux kernel, the FreeBSD kernel version 2.2 and later,
+  # Cygwin, and mingw never let anyone (even root) unlink directories.
+  # If anyone knows of another system for which unlink can never
+  # remove a directory, please report it to <bug-coreutils@gnu.org>.
+  # Unfortunately this is difficult to test for, since it requires root access
+  # and might create garbage in the file system,
+  # so the code below simply relies on the kernel name and version number.
+  case $host_os in
+  gnu[[0-9]]* | \
+  linux-* | linux | \
+  freebsd2.2* | freebsd[[3-9]]* | freebsd[[1-9]][[0-9]]* | \
+  cygwin | \
+  mingw* | windows*)
+    AC_DEFINE([UNLINK_CANNOT_UNLINK_DIR], [1],
+      [Define to 1 if unlink (dir) cannot possibly succeed.]);;
+  esac
+])
deleted file mode 120000 (symlink)
index e817c11426d88a388a1db1bb5e1eceaaa9fef558..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/unlocked-io.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..558f57d809bc6f721feedf2959aa414c810954d9
--- /dev/null
@@ -0,0 +1,36 @@
+# unlocked-io.m4 serial 16
+
+# Copyright (C) 1998-2006, 2009-2024 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.
+dnl
+dnl See if the glibc *_unlocked I/O macros or functions are available.
+dnl Use only those *_unlocked macros or functions that are declared
+dnl (because some of them were declared in Solaris 2.5.1 but were removed
+dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run
+dnl on Solaris 2.6).
+
+AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO],
+[
+  dnl Persuade glibc and Solaris <stdio.h> to declare
+  dnl fgets_unlocked(), fputs_unlocked() etc.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_DECLS_ONCE([clearerr_unlocked])
+  AC_CHECK_DECLS_ONCE([feof_unlocked])
+  AC_CHECK_DECLS_ONCE([ferror_unlocked])
+  AC_CHECK_DECLS_ONCE([fflush_unlocked])
+  AC_CHECK_DECLS_ONCE([fgets_unlocked])
+  AC_CHECK_DECLS_ONCE([fputc_unlocked])
+  AC_CHECK_DECLS_ONCE([fputs_unlocked])
+  AC_CHECK_DECLS_ONCE([fread_unlocked])
+  AC_CHECK_DECLS_ONCE([fwrite_unlocked])
+  AC_CHECK_DECLS_ONCE([getc_unlocked])
+  AC_CHECK_DECLS_ONCE([getchar_unlocked])
+  AC_CHECK_DECLS_ONCE([putc_unlocked])
+  AC_CHECK_DECLS_ONCE([putchar_unlocked])
+])
deleted file mode 120000 (symlink)
index f4b2ba985f5db4aa307f1a22f96dd781c0bedd98..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/userspec.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..05f4ac2f3e7cdf9f8f93f5d015acfcb5ca7c4296
--- /dev/null
@@ -0,0 +1,11 @@
+# serial 11
+dnl Copyright (C) 2002-2006, 2009-2024 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 Prerequisites of lib/userspec.c.
+AC_DEFUN([gl_USERSPEC],
+[
+  AC_CHECK_HEADERS_ONCE([sys/param.h])
+])
deleted file mode 120000 (symlink)
index 6c41ca6f2cc42471cfabef49ae09855a92dcce2e..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/usleep.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c688a043326270c7ee9e6c188b3deb80a17c4af1
--- /dev/null
@@ -0,0 +1,51 @@
+# usleep.m4 serial 9
+dnl Copyright (C) 2009-2024 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 This macro intentionally does not check for select or nanosleep;
+dnl both of those modules can require external libraries.
+AC_DEFUN([gl_FUNC_USLEEP],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  dnl usleep was required in POSIX 2001, but dropped as obsolete in
+  dnl POSIX 2008; therefore, it is not always exposed in headers.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([usleep])
+  AC_CHECK_TYPE([useconds_t], [],
+    [AC_DEFINE([useconds_t], [unsigned int], [Define to an unsigned 32-bit
+      type if <sys/types.h> lacks this type.])])
+  if test $ac_cv_func_usleep = no; then
+    HAVE_USLEEP=0
+  else
+    dnl POSIX allows implementations to reject arguments larger than
+    dnl 999999, but GNU guarantees it will work.
+    AC_CACHE_CHECK([whether usleep allows large arguments],
+      [gl_cv_func_usleep_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <unistd.h>
+]], [[return !!usleep (1000000);]])],
+        [gl_cv_func_usleep_works=yes], [gl_cv_func_usleep_works=no],
+        [case "$host_os" in
+                              # Guess yes on glibc systems.
+           *-gnu* | gnu*)     gl_cv_func_usleep_works="guessing yes" ;;
+                              # Guess yes on musl systems.
+           *-musl*)           gl_cv_func_usleep_works="guessing yes" ;;
+                              # Guess yes on systems that emulate the Linux system calls.
+           midipix*)          gl_cv_func_usleep_works="guessing yes" ;;
+                              # Guess no on native Windows.
+           mingw* | windows*) gl_cv_func_usleep_works="guessing no" ;;
+                              # If we don't know, obey --enable-cross-guesses.
+           *)                 gl_cv_func_usleep_works="$gl_cross_guess_normal" ;;
+         esac
+        ])])
+    case "$gl_cv_func_usleep_works" in
+      *yes) ;;
+      *)
+        REPLACE_USLEEP=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index a4478e379ad34d36f55f993447df0d0dc5db4205..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/utime.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0009e4f2f98b33cadda2e182882f9b3c991bdf8a
--- /dev/null
@@ -0,0 +1,76 @@
+# utime.m4 serial 5
+dnl Copyright (C) 2017-2024 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_UTIME],
+[
+  AC_REQUIRE([gl_UTIME_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS_ONCE([lstat])
+  case "$host_os" in
+    mingw* | windows*)
+      dnl On this platform, the original utime() or _utime() produces
+      dnl timestamps that are affected by the time zone.
+      dnl Use the function name 'rpl_utime' always, in order to avoid a
+      dnl possible conflict with the function name 'utime' from oldnames.lib
+      dnl (MSVC) or liboldnames.a (mingw).
+      REPLACE_UTIME=1
+      ;;
+    *)
+      AC_CHECK_FUNCS([utime])
+      if test $ac_cv_func_utime = no; then
+        HAVE_UTIME=0
+      else
+        dnl On macOS 10.13, utime("link-to-file/", NULL) mistakenly succeeds.
+        AC_CACHE_CHECK([whether utime handles trailing slashes on files],
+          [gl_cv_func_utime_file_slash],
+          [touch conftest.tmp
+           # Assume that if we have lstat, we can also check symlinks.
+           if test $ac_cv_func_lstat = yes; then
+             ln -s conftest.tmp conftest.lnk
+           fi
+           AC_RUN_IFELSE(
+             [AC_LANG_PROGRAM(
+               [[#include <stddef.h>
+                 #include <utime.h>
+               ]],
+               [[int result = 0;
+                 if (!utime ("conftest.tmp/", NULL))
+                   result |= 1;
+                 #if HAVE_LSTAT
+                 if (!utime ("conftest.lnk/", NULL))
+                   result |= 2;
+                 #endif
+                 return result;
+               ]])],
+             [gl_cv_func_utime_file_slash=yes],
+             [gl_cv_func_utime_file_slash=no],
+             [case "$host_os" in
+                                 # Guess yes on Linux systems.
+                linux-* | linux) gl_cv_func_utime_file_slash="guessing yes" ;;
+                                 # Guess yes on glibc systems.
+                *-gnu* | gnu*)   gl_cv_func_utime_file_slash="guessing yes" ;;
+                                 # Guess no on macOS.
+                darwin*)         gl_cv_func_utime_file_slash="guessing no" ;;
+                                 # If we don't know, obey --enable-cross-guesses.
+                *)               gl_cv_func_utime_file_slash="$gl_cross_guess_normal" ;;
+              esac
+             ])
+           rm -f conftest.tmp conftest.lnk
+          ])
+        case $gl_cv_func_stat_file_slash in
+          *no)
+            REPLACE_UTIME=1
+            AC_DEFINE([REPLACE_FUNC_UTIME_FILE], [1],
+              [Define to 1 if utime needs help when passed a file name with a trailing slash])
+            ;;
+        esac
+      fi
+      ;;
+  esac
+])
+
+# Prerequisites of lib/utime.c.
+AC_DEFUN([gl_PREREQ_UTIME], [:])
deleted file mode 120000 (symlink)
index 74d3f5ae2578a21a728f4c3bd0bf8af3a102ff23..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/utime_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7b224eef415ba436fbfd30ba2a37fdd93c88772e
--- /dev/null
@@ -0,0 +1,63 @@
+# utime_h.m4 serial 8
+dnl Copyright (C) 2017-2024 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 Bruno Haible.
+
+AC_DEFUN_ONCE([gl_UTIME_H],
+[
+  AC_REQUIRE([gl_UTIME_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
+  AC_CHECK_HEADERS_ONCE([utime.h])
+  gl_CHECK_NEXT_HEADERS([utime.h])
+
+  if test $ac_cv_header_utime_h = yes; then
+    HAVE_UTIME_H=1
+  else
+    HAVE_UTIME_H=0
+  fi
+  AC_SUBST([HAVE_UTIME_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <utime.h>
+    ]],
+    [utime])
+])
+
+# gl_UTIME_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_UTIME_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_UTIME_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_UTIME_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_UTIME_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIME])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UTIME], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_UTIME_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_UTIME_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_UTIME_H_DEFAULTS],
+[
+  dnl Assume POSIX behavior unless another module says otherwise.
+  HAVE_UTIME=1;              AC_SUBST([HAVE_UTIME])
+  REPLACE_UTIME=0;           AC_SUBST([REPLACE_UTIME])
+])
deleted file mode 120000 (symlink)
index e0edfc99d74342b1bbdd0dba53d353638097a4ef..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/utimecmp.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f76e6afd33cfd6c2407dbc6db0a8611e8a59030c
--- /dev/null
@@ -0,0 +1,12 @@
+#serial 4
+dnl Copyright (C) 2004-2007, 2009-2024 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_UTIMECMP],
+[
+  dnl Prerequisites of lib/utimecmp.c.
+  AC_REQUIRE([gl_FUNC_UTIMES])
+  :
+])
deleted file mode 120000 (symlink)
index 62eafd3c0ccb3d7acf323cb60406d4c13e829da3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/utimens.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..af03e6b52be81ec017532c0d103ab2a0e7f412b5
--- /dev/null
@@ -0,0 +1,56 @@
+dnl Copyright (C) 2003-2024 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 serial 15
+
+AC_DEFUN([gl_UTIMENS],
+[
+  dnl Prerequisites of lib/utimens.c.
+  AC_REQUIRE([gl_FUNC_UTIMES])
+  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  gl_CHECK_FUNCS_ANDROID([futimes], [[#include <sys/time.h>]])
+  gl_CHECK_FUNCS_ANDROID([futimesat], [[#include <sys/time.h>]])
+  gl_CHECK_FUNCS_ANDROID([lutimes], [[#include <sys/time.h>]])
+  gl_CHECK_FUNCS_ANDROID([futimens], [[#include <sys/stat.h>]])
+  gl_CHECK_FUNCS_ANDROID([utimensat], [[#include <sys/stat.h>]])
+
+  if test $ac_cv_func_futimens = no && test $ac_cv_func_futimesat = yes; then
+    dnl FreeBSD 8.0-rc2 mishandles futimesat(fd,NULL,time).  It is not
+    dnl standardized, but Solaris implemented it first and uses it as
+    dnl its only means to set fd time.
+    AC_CACHE_CHECK([whether futimesat handles NULL file],
+      [gl_cv_func_futimesat_works],
+      [touch conftest.file
+       AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stddef.h>
+#include <sys/times.h>
+#include <fcntl.h>
+]GL_MDA_DEFINES],
+        [[int fd = open ("conftest.file", O_RDWR);
+          if (fd < 0) return 1;
+          if (futimesat (fd, NULL, NULL)) return 2;
+        ]])],
+        [gl_cv_func_futimesat_works=yes],
+        [gl_cv_func_futimesat_works=no],
+        [case "$host_os" in
+                            # Guess yes on Linux systems.
+           linux-* | linux) gl_cv_func_futimesat_works="guessing yes" ;;
+                            # Guess yes on glibc systems.
+           *-gnu*)          gl_cv_func_futimesat_works="guessing yes" ;;
+                            # If we don't know, obey --enable-cross-guesses.
+           *)               gl_cv_func_futimesat_works="$gl_cross_guess_normal" ;;
+         esac
+        ])
+      rm -f conftest.file])
+    case "$gl_cv_func_futimesat_works" in
+      *yes) ;;
+      *)
+        AC_DEFINE([FUTIMESAT_NULL_BUG], [1],
+          [Define to 1 if futimesat mishandles a NULL file name.])
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 74ce9d5e2cb4c2215f6cfe4b39c7f2553591a292..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/utimensat.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..e595b333d17e1571c574c8755f3ffd5191613f67
--- /dev/null
@@ -0,0 +1,108 @@
+# serial 11
+# See if we need to provide utimensat replacement.
+
+dnl Copyright (C) 2009-2024 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 Eric Blake.
+
+AC_DEFUN([gl_FUNC_UTIMENSAT],
+[
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  gl_CHECK_FUNCS_ANDROID([utimensat], [[#include <sys/stat.h>]])
+  if test $ac_cv_func_utimensat = no; then
+    HAVE_UTIMENSAT=0
+    case "$gl_cv_onwards_func_utimensat" in
+      future*) REPLACE_UTIMENSAT=1 ;;
+    esac
+  else
+    AC_CACHE_CHECK([whether utimensat works],
+      [gl_cv_func_utimensat_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+]GL_MDA_DEFINES],
+            [[int result = 0;
+              const char *f = "conftest.file";
+              if (close (creat (f, 0600)))
+                return 1;
+              /* Test whether a trailing slash is handled correctly.
+                 This fails on AIX 7.2.  */
+              {
+                struct timespec ts[2];
+                ts[0].tv_sec = 345183300; ts[0].tv_nsec = 0;
+                ts[1] = ts[0];
+                if (utimensat (AT_FDCWD, "conftest.file/", ts, 0) == 0)
+                  result |= 2;
+              }
+              /* Test whether the AT_SYMLINK_NOFOLLOW flag is supported.  */
+              {
+                if (utimensat (AT_FDCWD, f, NULL, AT_SYMLINK_NOFOLLOW))
+                  result |= 4;
+              }
+              /* Test whether UTIME_NOW and UTIME_OMIT work.  */
+              {
+                struct timespec ts[2];
+                ts[0].tv_sec = 1;
+                ts[0].tv_nsec = UTIME_OMIT;
+                ts[1].tv_sec = 1;
+                ts[1].tv_nsec = UTIME_NOW;
+                if (utimensat (AT_FDCWD, f, ts, 0))
+                  result |= 8;
+              }
+              sleep (1);
+              {
+                struct stat st;
+                struct timespec ts[2];
+                ts[0].tv_sec = 1;
+                ts[0].tv_nsec = UTIME_NOW;
+                ts[1].tv_sec = 1;
+                ts[1].tv_nsec = UTIME_OMIT;
+                if (utimensat (AT_FDCWD, f, ts, 0))
+                  result |= 16;
+                if (stat (f, &st))
+                  result |= 32;
+                else if (st.st_ctime < st.st_atime)
+                  result |= 64;
+              }
+              return result;
+            ]])],
+         [gl_cv_func_utimensat_works=yes],
+         [case $? in
+            2) gl_cv_func_utimensat_works='nearly' ;;
+            *) gl_cv_func_utimensat_works=no ;;
+          esac
+         ],
+         [case "$host_os" in
+            # Guess yes on Linux or glibc systems.
+            linux-* | linux | *-gnu* | gnu*)
+              gl_cv_func_utimensat_works="guessing yes" ;;
+            # Guess 'nearly' on AIX.
+            aix*)
+              gl_cv_func_utimensat_works="guessing nearly" ;;
+            # If we don't know, obey --enable-cross-guesses.
+            *)
+              gl_cv_func_utimensat_works="$gl_cross_guess_normal" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_utimensat_works" in
+      *yes)
+        ;;
+      *nearly)
+        AC_DEFINE([HAVE_NEARLY_WORKING_UTIMENSAT], [1],
+          [Define to 1 if utimensat works, except for the trailing slash handling.])
+        REPLACE_UTIMENSAT=1
+        ;;
+      *)
+        REPLACE_UTIMENSAT=1
+        ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index b75835da1a3c3ecd8a9928ab36e99ce880e1c87f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/utimes.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..05b23cbb73676f9d7747578039908e3321631172
--- /dev/null
@@ -0,0 +1,161 @@
+# Detect some bugs in glibc's implementation of utimes.
+# serial 9
+
+dnl Copyright (C) 2003-2005, 2009-2024 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.
+
+# See if we need to work around bugs in glibc's implementation of
+# utimes from 2003-07-12 to 2003-09-17.
+# First, there was a bug that would make utimes set mtime
+# and atime to zero (1970-01-01) unconditionally.
+# Then, there was code to round rather than truncate.
+# Then, there was an implementation (sparc64, Linux-2.4.28, glibc-2.3.3)
+# that didn't honor the NULL-means-set-to-current-time semantics.
+# Finally, there was also a version of utimes that failed on read-only
+# files, while utime worked fine (linux-2.2.20, glibc-2.2.5).
+#
+# From Jim Meyering, with suggestions from Paul Eggert.
+
+AC_DEFUN([gl_FUNC_UTIMES],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether the utimes function works],
+                 [gl_cv_func_working_utimes],
+    [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <utime.h>
+#include <errno.h>
+]GL_MDA_DEFINES[
+
+static int
+inorder (time_t a, time_t b, time_t c)
+{
+  return a <= b && b <= c;
+}
+
+int
+main ()
+{
+  int result = 0;
+  char const *file = "conftest.utimes";
+  /* On OS/2, file timestamps must be on or after 1980 in local time,
+     with an even number of seconds.  */
+  static struct timeval timeval[2] = {{315620000 + 10, 10},
+                                      {315620000 + 1000000, 999998}};
+
+  /* Test whether utimes() essentially works.  */
+  {
+    struct stat sbuf;
+    FILE *f = fopen (file, "w");
+    if (f == NULL)
+      result |= 1;
+    else if (fclose (f) != 0)
+      result |= 1;
+    else if (utimes (file, timeval) != 0)
+      result |= 2;
+    else if (lstat (file, &sbuf) != 0)
+      result |= 1;
+    else if (!(sbuf.st_atime == timeval[0].tv_sec
+               && sbuf.st_mtime == timeval[1].tv_sec))
+      result |= 4;
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  /* Test whether utimes() with a NULL argument sets the file's timestamp
+     to the current time.  Use 'fstat' as well as 'time' to
+     determine the "current" time, to accommodate NFS file systems
+     if there is a time skew between the host and the NFS server.  */
+  {
+    int fd = open (file, O_WRONLY|O_CREAT, 0644);
+    if (fd < 0)
+      result |= 1;
+    else
+      {
+        time_t t0, t2;
+        struct stat st0, st1, st2;
+        if (time (&t0) == (time_t) -1)
+          result |= 1;
+        else if (fstat (fd, &st0) != 0)
+          result |= 1;
+        else if (utimes (file, timeval) != 0
+                 && (errno != EACCES
+                     /* OS/2 kLIBC utimes fails on opened files.  */
+                     || close (fd) != 0
+                     || utimes (file, timeval) != 0
+                     || (fd = open (file, O_WRONLY)) < 0))
+          result |= 2;
+        else if (utimes (file, NULL) != 0
+                 && (errno != EACCES
+                     /* OS/2 kLIBC utimes fails on opened files.  */
+                     || close (fd) != 0
+                     || utimes (file, NULL) != 0
+                     || (fd = open (file, O_WRONLY)) < 0))
+          result |= 8;
+        else if (fstat (fd, &st1) != 0)
+          result |= 1;
+        else if (write (fd, "\n", 1) != 1)
+          result |= 1;
+        else if (fstat (fd, &st2) != 0)
+          result |= 1;
+        else if (time (&t2) == (time_t) -1)
+          result |= 1;
+        else
+          {
+            int m_ok_POSIX = inorder (t0, st1.st_mtime, t2);
+            int m_ok_NFS = inorder (st0.st_mtime, st1.st_mtime, st2.st_mtime);
+            if (! (st1.st_atime == st1.st_mtime))
+              result |= 16;
+            if (! (m_ok_POSIX || m_ok_NFS))
+              result |= 32;
+          }
+        if (close (fd) != 0)
+          result |= 1;
+      }
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  /* Test whether utimes() with a NULL argument works on read-only files.  */
+  {
+    int fd = open (file, O_WRONLY|O_CREAT, 0444);
+    if (fd < 0)
+      result |= 1;
+    else if (close (fd) != 0)
+      result |= 1;
+    else if (utimes (file, NULL) != 0)
+      result |= 64;
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  return result;
+}
+  ]])],
+       [gl_cv_func_working_utimes=yes],
+       [gl_cv_func_working_utimes=no],
+       [case "$host_os" in
+                             # Guess yes on musl systems.
+          *-musl*)           gl_cv_func_working_utimes="guessing yes" ;;
+                             # Guess no on native Windows.
+          mingw* | windows*) gl_cv_func_working_utimes="guessing no" ;;
+          *)                 gl_cv_func_working_utimes="$gl_cross_guess_normal" ;;
+        esac
+       ])
+    ])
+
+  case "$gl_cv_func_working_utimes" in
+    *yes)
+      AC_DEFINE([HAVE_WORKING_UTIMES], [1], [Define if utimes works properly.])
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 0f265277d9d7cc032a4ea588849d48ed478560f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/vararrays.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..164bf0c49a99a0f3c8b7951dcb608632de7bc0e5
--- /dev/null
@@ -0,0 +1,72 @@
+# Check for variable-length arrays.
+
+# serial 6
+
+# From Paul Eggert
+
+# Copyright (C) 2001, 2009-2024 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.
+
+m4_version_prereq([2.70], [], [
+
+# AC_C_VARARRAYS
+# --------------
+# Check whether the C compiler supports variable-length arrays.
+AC_DEFUN([AC_C_VARARRAYS],
+[
+  AC_CACHE_CHECK([for variable-length arrays],
+    ac_cv_c_vararrays,
+    [AC_EGREP_CPP([defined],
+       [#ifdef __STDC_NO_VLA__
+        defined
+        #endif
+       ],
+       [ac_cv_c_vararrays='no: __STDC_NO_VLA__ is defined'],
+       [AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[/* Test for VLA support.  This test is partly inspired
+                  from examples in the C standard.  Use at least two VLA
+                  functions to detect the GCC 3.4.3 bug described in:
+                  https://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00014.html
+                  */
+               #ifdef __STDC_NO_VLA__
+                syntax error;
+               #else
+                 extern int n;
+                 int B[100];
+                 int fvla (int m, int C[m][m]);
+
+                 int
+                 simple (int count, int all[static count])
+                 {
+                   return all[count - 1];
+                 }
+
+                 int
+                 fvla (int m, int C[m][m])
+                 {
+                   typedef int VLA[m][m];
+                   VLA x;
+                   int D[m];
+                   static int (*q)[m] = &B;
+                   int (*s)[n] = q;
+                   return C && &x[0][0] == &D[0] && &D[0] == s[0];
+                 }
+               #endif
+               ]])],
+          [ac_cv_c_vararrays=yes],
+          [ac_cv_c_vararrays=no])])])
+  if test "$ac_cv_c_vararrays" = yes; then
+    dnl This is for compatibility with Autoconf 2.61-2.69.
+    AC_DEFINE([HAVE_C_VARARRAYS], 1,
+      [Define to 1 if C supports variable-length arrays.])
+  elif test "$ac_cv_c_vararrays" = no; then
+    AC_DEFINE([__STDC_NO_VLA__], 1,
+      [Define to 1 if C does not support variable-length arrays, and
+       if the compiler does not already define this.])
+  fi
+])
+
+])
deleted file mode 120000 (symlink)
index 02c763eaee11f1decc3df65e819e523cbc0a1893..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/vasnprintf.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..21a85bb171e146a07e588312a6a81f60f78e3eef
--- /dev/null
@@ -0,0 +1,480 @@
+# vasnprintf.m4 serial 52
+dnl Copyright (C) 2002-2004, 2006-2024 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_VASNPRINTF],
+[
+  AC_CHECK_FUNCS_ONCE([vasnprintf])
+  if test $ac_cv_func_vasnprintf = no; then
+    gl_REPLACE_VASNPRINTF
+  fi
+])
+
+AC_DEFUN([gl_REPLACE_VASNPRINTF],
+[
+  AC_CHECK_FUNCS_ONCE([vasnprintf])
+  AC_LIBOBJ([vasnprintf])
+  AC_LIBOBJ([printf-args])
+  AC_LIBOBJ([printf-parse])
+  AC_LIBOBJ([asnprintf])
+  if test $ac_cv_func_vasnprintf = yes; then
+    AC_DEFINE([REPLACE_VASNPRINTF], [1],
+      [Define if vasnprintf exists but is overridden by gnulib.])
+  fi
+  gl_PREREQ_PRINTF_ARGS
+  gl_PREREQ_PRINTF_PARSE
+  gl_PREREQ_VASNPRINTF
+  gl_PREREQ_ASNPRINTF
+])
+
+AC_DEFUN([gl_FUNC_VASNWPRINTF],
+[
+  AC_LIBOBJ([printf-args])
+  gl_PREREQ_PRINTF_ARGS
+  gl_PREREQ_PRINTF_PARSE
+  gl_PREREQ_VASNWPRINTF
+  gl_PREREQ_ASNPRINTF
+])
+
+# Prerequisites of lib/printf-args.h, lib/printf-args.c.
+AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
+[
+  AC_REQUIRE([gt_TYPE_WCHAR_T])
+  AC_REQUIRE([gt_TYPE_WINT_T])
+])
+
+# Prerequisites of lib/printf-parse.h, lib/printf-parse.c.
+# Prerequisites of lib/wprintf-parse.h, lib/wprintf-parse.c.
+AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
+[
+  AC_REQUIRE([gl_FEATURES_H])
+  AC_REQUIRE([gt_TYPE_WCHAR_T])
+  AC_REQUIRE([gt_TYPE_WINT_T])
+  AC_REQUIRE([AC_TYPE_SIZE_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])
+])
+
+# Prerequisites of lib/vasnprintf.c if !WIDE_CHAR_VERSION.
+AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF],
+[
+  AC_CHECK_FUNCS([snprintf strnlen wcrtomb])
+  dnl Use the _snprintf function only if it is declared (because on NetBSD it
+  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
+  AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]])
+  dnl We can avoid a lot of code by assuming that snprintf's return value
+  dnl conforms to ISO C99. So check that.
+  AC_REQUIRE([gl_SNPRINTF_RETVAL_C99])
+  case "$gl_cv_func_snprintf_retval_c99" in
+    *yes)
+      AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1],
+        [Define if the return value of the snprintf function is the number of
+         of bytes (excluding the terminating NUL) that would have been produced
+         if the buffer had been large enough.])
+      ;;
+  esac
+  dnl Additionally, the use of %n can be eliminated by assuming that snprintf
+  dnl always produces NUL-terminated strings (no truncation).
+  AC_REQUIRE([gl_SNPRINTF_TRUNCATION_C99])
+  case "$gl_cv_func_snprintf_truncation_c99" in
+    *yes)
+      AC_DEFINE([HAVE_SNPRINTF_TRUNCATION_C99], [1],
+        [Define if the string produced by the snprintf function is always NUL
+         terminated.])
+      ;;
+  esac
+  gl_PREREQ_VASNXPRINTF
+])
+
+# Prerequisites of lib/vasnwprintf.c.
+AC_DEFUN_ONCE([gl_PREREQ_VASNWPRINTF],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([swprintf wcsnlen mbrtowc])
+  AC_CHECK_DECLS([_snwprintf], , , [[#include <stdio.h>]])
+  AC_CHECK_DECLS([wcsnlen], , , [[#include <wchar.h>]])
+  gl_SWPRINTF_WORKS
+  case "$gl_cv_func_swprintf_works" in
+    *yes)
+      AC_DEFINE([HAVE_WORKING_SWPRINTF], [1],
+        [Define if the swprintf function works correctly when it produces output
+         that contains null wide characters.])
+      ;;
+  esac
+  gl_MBRTOWC_C_LOCALE
+  case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in
+    *yes)
+      AC_CACHE_CHECK([whether swprintf in the C locale is free of encoding errors],
+        [gl_cv_func_swprintf_C_locale_sans_EILSEQ],
+        [
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#ifndef __USE_MINGW_ANSI_STDIO
+# define __USE_MINGW_ANSI_STDIO 1
+#endif
+#include <stdio.h>
+#include <wchar.h>
+int main()
+{
+  int result = 0;
+  { /* This test fails on glibc 2.35, musl libc 1.2.4, FreeBSD 13.2, NetBSD 9.3,
+       OpenBSD 7.2, Cygwin 2.9.0.
+       Reported at <https://www.openwall.com/lists/musl/2023/06/12/2>.  */
+    wchar_t buf[12];
+    int ret = swprintf (buf, 12, L"%c", '\377');
+    if (ret < 0)
+      result |= 1;
+  }
+  return result;
+}]])],
+            [gl_cv_func_swprintf_C_locale_sans_EILSEQ=yes],
+            [gl_cv_func_swprintf_C_locale_sans_EILSEQ=no],
+            [case "$host_os" in
+                                   # Guess no on glibc systems.
+               *-gnu* | gnu*)      gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing yes";;
+                                   # Guess no on musl systems.
+               *-musl* | midipix*) gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing no";;
+                                   # If we don't know, obey --enable-cross-guesses.
+               *)                  gl_cv_func_swprintf_C_locale_sans_EILSEQ="$gl_cross_guess_normal";;
+             esac
+            ])
+        ])
+      ;;
+  esac
+  if case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in
+       *yes) false ;;
+       *) true ;;
+     esac \
+     || case "$gl_cv_func_swprintf_C_locale_sans_EILSEQ" in
+          *yes) false ;;
+          *) true ;;
+        esac; then
+    AC_DEFINE([NEED_WPRINTF_DIRECTIVE_C], [1],
+      [Define if the vasnwprintf implementation needs special code for
+       the 'c' directive.])
+  fi
+  gl_SWPRINTF_DIRECTIVE_LA
+  case "$gl_cv_func_swprintf_directive_la" in
+    *yes) ;;
+    *)
+      AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LA], [1],
+        [Define if the vasnwprintf implementation needs special code for
+         the 'a' directive with 'long double' arguments.])
+      ;;
+  esac
+  gl_SWPRINTF_DIRECTIVE_LC
+  case "$gl_cv_func_swprintf_directive_lc" in
+    *yes) ;;
+    *)
+      AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LC], [1],
+        [Define if the vasnwprintf implementation needs special code for
+         the 'lc' directive.])
+      ;;
+  esac
+  gl_MUSL_LIBC
+  gl_PREREQ_VASNXPRINTF
+])
+
+# Common prerequisites of lib/vasnprintf.c and lib/vasnwprintf.c.
+AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF],
+[
+  AC_REQUIRE([AC_FUNC_ALLOCA])
+  AC_REQUIRE([gt_TYPE_WCHAR_T])
+  AC_REQUIRE([gt_TYPE_WINT_T])
+  AC_CHECK_FUNCS([wcslen])
+  dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization
+  dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE.
+  AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION])
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
+# arguments.
+AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
+[
+  AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
+  case "$gl_cv_func_printf_long_double" in
+    *yes)
+      ;;
+    *)
+      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 supporting infinite 'double'
+# arguments.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
+[
+  AC_REQUIRE([gl_PRINTF_INFINITE])
+  case "$gl_cv_func_printf_infinite" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1],
+        [Define if the vasnprintf implementation needs special code for
+         infinite 'double' arguments.])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
+# arguments.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
+[
+  AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
+  dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
+  dnl NEED_PRINTF_LONG_DOUBLE is already set.
+  AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
+  case "$gl_cv_func_printf_long_double" in
+    *yes)
+      case "$gl_cv_func_printf_infinite_long_double" in
+        *yes)
+          ;;
+        *)
+          AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1],
+            [Define if the vasnprintf implementation needs special code for
+             infinite 'long double' arguments.])
+          ;;
+      esac
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
+[
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+  case "$gl_cv_func_printf_directive_a" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1],
+        [Define if the vasnprintf implementation needs special code for
+         the 'a' and 'A' directives.])
+      gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include <langinfo.h>]])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'b' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_B],
+[
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
+  case "$gl_cv_func_printf_directive_b" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_DIRECTIVE_B], [1],
+        [Define if the vasnprintf implementation needs special code for
+         the 'b' directive.])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
+[
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
+  case "$gl_cv_func_printf_directive_f" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1],
+        [Define if the vasnprintf implementation needs special code for
+         the 'F' directive.])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
+[
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+  case "$gl_cv_func_printf_directive_ls" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1],
+        [Define if the vasnprintf implementation needs special code for
+         the 'ls' directive.])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'lc' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC],
+[
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
+  case "$gl_cv_func_printf_directive_lc" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_DIRECTIVE_LC], [1],
+        [Define if the vasnprintf implementation needs special code for
+         the 'lc' directive.])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
+[
+  AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  case "$gl_cv_func_printf_flag_grouping" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
+        [Define if the vasnprintf implementation needs special code for the
+         ' flag.])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
+[
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
+  case "$gl_cv_func_printf_flag_leftadjust" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1],
+        [Define if the vasnprintf implementation needs special code for the
+         '-' flag.])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
+[
+  AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  case "$gl_cv_func_printf_flag_zero" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1],
+        [Define if the vasnprintf implementation needs special code for the
+         0 flag.])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the # flag with a
+# zero precision and a zero value in the 'x' and 'X' directives.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO],
+[
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
+  case "$gl_cv_func_printf_flag_alt_precision_zero" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_FLAG_ALT_PRECISION_ZERO], [1],
+        [Define if the vasnprintf implementation needs special code for the
+         # flag with a zero precision and a zero value in the 'x' and 'X' directives.])
+      ;;
+  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_POSIX_EXTRAS],
+[
+  AC_REQUIRE([gl_PREREQ_VASNPRINTF])
+  gl_PREREQ_VASNPRINTF_LONG_DOUBLE
+  gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
+  gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
+  gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+  gl_PREREQ_VASNPRINTF_DIRECTIVE_B
+  gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+  gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+  gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
+  gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+  gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
+  gl_PREREQ_VASNPRINTF_FLAG_ZERO
+  gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO
+  gl_PREREQ_VASNPRINTF_PRECISION
+  gl_PREREQ_VASNPRINTF_ENOMEM
+])
+
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'B' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B],
+[
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_UPPERCASE_B])
+  case "$gl_cv_func_printf_directive_uppercase_b" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_DIRECTIVE_UPPERCASE_B], [1],
+        [Define if the vasnprintf implementation needs special code for
+         the 'B' directive.])
+      ;;
+  esac
+])
+
+# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance
+# and GNU compatibility.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS],
+[
+  gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
+  AC_DEFINE([SUPPORT_GNU_PRINTF_DIRECTIVES], [1],
+    [Define if the vasnprintf implementation should support GNU compatible
+     printf directives.])
+  gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B
+])
+
+# Prerequisites of lib/asnprintf.c.
+# Prerequisites of lib/asnwprintf.c.
+AC_DEFUN([gl_PREREQ_ASNPRINTF],
+[
+])
deleted file mode 120000 (symlink)
index 4ac4a51239426c0c4640c2e8d6ffc2273e21c6ba..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/vasprintf-posix.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b82ccd3df78dffd7c1da3d675db1ff3f44447a29
--- /dev/null
@@ -0,0 +1,118 @@
+# vasprintf-posix.m4 serial 18
+dnl Copyright (C) 2007-2024 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_VASPRINTF_POSIX],
+[
+  AC_REQUIRE([gl_FUNC_VASPRINTF_IS_POSIX])
+  if test $gl_cv_func_vasprintf_posix = no; then
+    gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
+    gl_REPLACE_VASNPRINTF
+    gl_REPLACE_VASPRINTF
+  fi
+])
+
+dnl Test whether vasprintf exists and is POSIX compliant.
+dnl Result is gl_cv_func_vasprintf_posix.
+AC_DEFUN([gl_FUNC_VASPRINTF_IS_POSIX],
+[
+  AC_REQUIRE([gl_PRINTF_SIZES_C99])
+  AC_REQUIRE([gl_PRINTF_SIZES_C23])
+  AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
+  AC_REQUIRE([gl_PRINTF_INFINITE])
+  AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
+  AC_REQUIRE([gl_PRINTF_POSITIONS])
+  AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
+  AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
+  AC_REQUIRE([gl_PRINTF_PRECISION])
+  AC_REQUIRE([gl_PRINTF_ENOMEM])
+  gl_cv_func_vasprintf_posix=no
+  AC_CHECK_FUNCS([vasprintf])
+  case "$gl_cv_func_printf_sizes_c99" in
+    *yes)
+      case "$gl_cv_func_printf_sizes_c23" in
+        *yes)
+          case "$gl_cv_func_printf_long_double" in
+            *yes)
+              case "$gl_cv_func_printf_infinite" in
+                *yes)
+                  case "$gl_cv_func_printf_infinite_long_double" in
+                    *yes)
+                      case "$gl_cv_func_printf_directive_a" in
+                        *yes)
+                          case "$gl_cv_func_printf_directive_b" in
+                            *yes)
+                              case "$gl_cv_func_printf_directive_f" in
+                                *yes)
+                                  case "$gl_cv_func_printf_directive_n" in
+                                    *yes)
+                                      case "$gl_cv_func_printf_directive_ls" in
+                                        *yes)
+                                          case "$gl_cv_func_printf_directive_lc" in
+                                            *yes)
+                                              case "$gl_cv_func_printf_positions" in
+                                                *yes)
+                                                  case "$gl_cv_func_printf_flag_grouping" in
+                                                    *yes)
+                                                      case "$gl_cv_func_printf_flag_leftadjust" in
+                                                        *yes)
+                                                          case "$gl_cv_func_printf_flag_zero" in
+                                                            *yes)
+                                                              case "$gl_cv_func_printf_flag_alt_precision_zero" in
+                                                                *yes)
+                                                                  case "$gl_cv_func_printf_precision" in
+                                                                    *yes)
+                                                                      case "$gl_cv_func_printf_enomem" in
+                                                                        *yes)
+                                                                          if test $ac_cv_func_vasprintf = yes; then
+                                                                            # vasprintf exists and is
+                                                                            # already POSIX compliant.
+                                                                            gl_cv_func_vasprintf_posix=yes
+                                                                          fi
+                                                                          ;;
+                                                                      esac
+                                                                      ;;
+                                                                  esac
+                                                                  ;;
+                                                              esac
+                                                              ;;
+                                                          esac
+                                                          ;;
+                                                      esac
+                                                      ;;
+                                                  esac
+                                                  ;;
+                                              esac
+                                              ;;
+                                          esac
+                                          ;;
+                                      esac
+                                      ;;
+                                  esac
+                                  ;;
+                              esac
+                              ;;
+                          esac
+                          ;;
+                      esac
+                      ;;
+                  esac
+                  ;;
+              esac
+              ;;
+          esac
+          ;;
+      esac
+      ;;
+  esac
+])
deleted file mode 120000 (symlink)
index 61a860f46c9f24fee8d1fa435f8777250f5bf735..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/vasprintf.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ea0a8dccd37cfb851a70dd0a380e6d446effb27c
--- /dev/null
@@ -0,0 +1,46 @@
+# vasprintf.m4 serial 6
+dnl Copyright (C) 2002-2003, 2006-2007, 2009-2024 Free Software Foundation,
+dnl 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_VASPRINTF],
+[
+  AC_CHECK_FUNCS([vasprintf])
+  if test $ac_cv_func_vasprintf = no; then
+    gl_REPLACE_VASPRINTF
+  fi
+])
+
+AC_DEFUN([gl_REPLACE_VASPRINTF],
+[
+  AC_LIBOBJ([vasprintf])
+  AC_LIBOBJ([asprintf])
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  if test $ac_cv_func_vasprintf = yes; then
+    REPLACE_VASPRINTF=1
+  else
+    HAVE_VASPRINTF=0
+  fi
+  gl_PREREQ_VASPRINTF_H
+  gl_PREREQ_VASPRINTF
+  gl_PREREQ_ASPRINTF
+])
+
+# Prerequisites of the vasprintf portion of lib/stdio.h.
+AC_DEFUN([gl_PREREQ_VASPRINTF_H],
+[
+  dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+])
+
+# Prerequisites of lib/vasprintf.c.
+AC_DEFUN([gl_PREREQ_VASPRINTF],
+[
+])
+
+# Prerequisites of lib/asprintf.c.
+AC_DEFUN([gl_PREREQ_ASPRINTF],
+[
+])
deleted file mode 120000 (symlink)
index f9605a7f22d2763e030dd9ccc9039fcfc2e531f2..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/version-etc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d992e3094fb22f50e5bc93a64578715d280cfb28
--- /dev/null
@@ -0,0 +1,33 @@
+# version-etc.m4 serial 2
+# Copyright (C) 2009-2024 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 $1 - configure flag and define name
+dnl $2 - human readable description
+m4_define([gl_VERSION_ETC_FLAG],
+[dnl
+  AC_ARG_WITH([$1], [AS_HELP_STRING([[--with-]$1], [$2])],
+    [dnl
+      case $withval in
+        yes|no) ;;
+        *) AC_DEFINE_UNQUOTED(AS_TR_CPP([PACKAGE_$1]), ["$withval"], [$2]) ;;
+      esac
+    ])
+])
+
+AC_DEFUN([gl_VERSION_ETC],
+[dnl
+  gl_VERSION_ETC_FLAG([packager],
+                      [String identifying the packager of this software])
+  gl_VERSION_ETC_FLAG([packager-version],
+                      [Packager-specific version information])
+  gl_VERSION_ETC_FLAG([packager-bug-reports],
+                      [Packager info for bug reports (URL/e-mail/...)])
+  if test "X$with_packager" = "X" && \
+     test "X$with_packager_version$with_packager_bug_reports" != "X"
+  then
+    AC_MSG_ERROR([The --with-packager-{bug-reports,version} options require --with-packager])
+  fi
+])
deleted file mode 120000 (symlink)
index ff8b57107e5e3d13467ad016f6decc47d9078320..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/vfprintf-posix.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9c53db9d423faedeceb0cd6c45e554efaad572b2
--- /dev/null
@@ -0,0 +1,127 @@
+# vfprintf-posix.m4 serial 19
+dnl Copyright (C) 2007-2024 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_VFPRINTF_POSIX],
+[
+  AC_REQUIRE([gl_FUNC_VFPRINTF_IS_POSIX])
+  if test $gl_cv_func_vfprintf_posix = no; then
+    gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
+    gl_REPLACE_VASNPRINTF
+    gl_REPLACE_VFPRINTF
+  fi
+])
+
+dnl Test whether vfprintf is POSIX compliant.
+dnl Result is gl_cv_func_vfprintf_posix.
+AC_DEFUN([gl_FUNC_VFPRINTF_IS_POSIX],
+[
+  AC_REQUIRE([gl_PRINTF_SIZES_C99])
+  AC_REQUIRE([gl_PRINTF_SIZES_C23])
+  AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
+  AC_REQUIRE([gl_PRINTF_INFINITE])
+  AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
+  AC_REQUIRE([gl_PRINTF_POSITIONS])
+  AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
+  AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
+  AC_REQUIRE([gl_PRINTF_PRECISION])
+  AC_REQUIRE([gl_PRINTF_ENOMEM])
+  gl_cv_func_vfprintf_posix=no
+  case "$gl_cv_func_printf_sizes_c99" in
+    *yes)
+      case "$gl_cv_func_printf_sizes_c23" in
+        *yes)
+          case "$gl_cv_func_printf_long_double" in
+            *yes)
+              case "$gl_cv_func_printf_infinite" in
+                *yes)
+                  case "$gl_cv_func_printf_infinite_long_double" in
+                    *yes)
+                      case "$gl_cv_func_printf_directive_a" in
+                        *yes)
+                          case "$gl_cv_func_printf_directive_b" in
+                            *yes)
+                              case "$gl_cv_func_printf_directive_f" in
+                                *yes)
+                                  case "$gl_cv_func_printf_directive_n" in
+                                    *yes)
+                                      case "$gl_cv_func_printf_directive_ls" in
+                                        *yes)
+                                          case "$gl_cv_func_printf_directive_lc" in
+                                            *yes)
+                                              case "$gl_cv_func_printf_positions" in
+                                                *yes)
+                                                  case "$gl_cv_func_printf_flag_grouping" in
+                                                    *yes)
+                                                      case "$gl_cv_func_printf_flag_leftadjust" in
+                                                        *yes)
+                                                          case "$gl_cv_func_printf_flag_zero" in
+                                                            *yes)
+                                                              case "$gl_cv_func_printf_flag_alt_precision_zero" in
+                                                                *yes)
+                                                                  case "$gl_cv_func_printf_precision" in
+                                                                    *yes)
+                                                                      case "$gl_cv_func_printf_enomem" in
+                                                                        *yes)
+                                                                          # vfprintf exists and is
+                                                                          # already POSIX compliant.
+                                                                          gl_cv_func_vfprintf_posix=yes
+                                                                          ;;
+                                                                      esac
+                                                                      ;;
+                                                                  esac
+                                                                  ;;
+                                                              esac
+                                                              ;;
+                                                          esac
+                                                          ;;
+                                                      esac
+                                                      ;;
+                                                  esac
+                                                  ;;
+                                              esac
+                                              ;;
+                                          esac
+                                          ;;
+                                      esac
+                                      ;;
+                                  esac
+                                  ;;
+                              esac
+                              ;;
+                          esac
+                          ;;
+                      esac
+                      ;;
+                  esac
+                  ;;
+              esac
+              ;;
+          esac
+          ;;
+      esac
+      ;;
+  esac
+])
+
+AC_DEFUN([gl_REPLACE_VFPRINTF],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_LIBOBJ([vfprintf])
+  REPLACE_VFPRINTF=1
+  AC_DEFINE([REPLACE_VFPRINTF_POSIX], [1],
+    [Define if vfprintf is overridden by a POSIX compliant gnulib implementation.])
+  gl_PREREQ_VFPRINTF
+])
+
+AC_DEFUN([gl_PREREQ_VFPRINTF], [:])
deleted file mode 120000 (symlink)
index 3251f05e6110fba9c8a864705bdba31df1c1a1f6..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/visibility.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..b9b36a86baa2f460a833a722c02d6a56ee620182
--- /dev/null
@@ -0,0 +1,82 @@
+# visibility.m4 serial 8
+dnl Copyright (C) 2005, 2008, 2010-2024 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 Bruno Haible.
+
+dnl Tests whether the compiler supports the command-line option
+dnl -fvisibility=hidden and the function and variable attributes
+dnl __attribute__((__visibility__("hidden"))) and
+dnl __attribute__((__visibility__("default"))).
+dnl Does *not* test for __visibility__("protected") - which has tricky
+dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
+dnl Mac OS X.
+dnl Does *not* test for __visibility__("internal") - which has processor
+dnl dependent semantics.
+dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
+dnl "really only recommended for legacy code".
+dnl Set the variable CFLAG_VISIBILITY.
+dnl Defines and sets the variable HAVE_VISIBILITY.
+
+AC_DEFUN([gl_VISIBILITY],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  CFLAG_VISIBILITY=
+  HAVE_VISIBILITY=0
+  if test -n "$GCC"; then
+    dnl First, check whether -Werror can be added to the command line, or
+    dnl whether it leads to an error because of some other option that the
+    dnl user has put into $CC $CFLAGS $CPPFLAGS.
+    AC_CACHE_CHECK([whether the -Werror option is usable],
+      [gl_cv_cc_vis_werror],
+      [gl_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -Werror"
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[]], [[]])],
+         [gl_cv_cc_vis_werror=yes],
+         [gl_cv_cc_vis_werror=no])
+       CFLAGS="$gl_save_CFLAGS"
+      ])
+    dnl Now check whether visibility declarations are supported.
+    AC_CACHE_CHECK([for simple visibility declarations],
+      [gl_cv_cc_visibility],
+      [gl_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -fvisibility=hidden"
+       dnl We use the option -Werror and a function dummyfunc, because on some
+       dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
+       dnl "visibility attribute not supported in this configuration; ignored"
+       dnl at the first function definition in every compilation unit, and we
+       dnl don't want to use the option in this case.
+       if test $gl_cv_cc_vis_werror = yes; then
+         CFLAGS="$CFLAGS -Werror"
+       fi
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
+              extern __attribute__((__visibility__("default"))) int exportedvar;
+              extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
+              extern __attribute__((__visibility__("default"))) int exportedfunc (void);
+              void dummyfunc (void);
+              int hiddenvar;
+              int exportedvar;
+              int hiddenfunc (void) { return 51; }
+              int exportedfunc (void) { return 1225736919; }
+              void dummyfunc (void) {}
+            ]],
+            [[]])],
+         [gl_cv_cc_visibility=yes],
+         [gl_cv_cc_visibility=no])
+       CFLAGS="$gl_save_CFLAGS"
+      ])
+    if test $gl_cv_cc_visibility = yes; then
+      CFLAG_VISIBILITY="-fvisibility=hidden"
+      HAVE_VISIBILITY=1
+    fi
+  fi
+  AC_SUBST([CFLAG_VISIBILITY])
+  AC_SUBST([HAVE_VISIBILITY])
+  AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
+    [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
+])
deleted file mode 120000 (symlink)
index 7437449f4c1e403bf0a6d77d71fc37e92867c845..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/vprintf-posix.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..478e9fd3f8ce40839219fb30eeef9ca7cc4a6458
--- /dev/null
@@ -0,0 +1,35 @@
+# vprintf-posix.m4 serial 4
+dnl Copyright (C) 2007-2024 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_VPRINTF_POSIX],
+[
+  AC_REQUIRE([gl_FUNC_VPRINTF_IS_POSIX])
+  if test $gl_cv_func_vprintf_posix = no; then
+    gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
+    gl_REPLACE_VASNPRINTF
+    gl_REPLACE_VPRINTF
+  fi
+])
+
+dnl Test whether vprintf is POSIX compliant.
+dnl Result is gl_cv_func_vprintf_posix.
+AC_DEFUN([gl_FUNC_VPRINTF_IS_POSIX],
+[
+  AC_REQUIRE([gl_FUNC_VFPRINTF_IS_POSIX])
+  gl_cv_func_vprintf_posix="$gl_cv_func_vfprintf_posix"
+])
+
+AC_DEFUN([gl_REPLACE_VPRINTF],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_LIBOBJ([vprintf])
+  REPLACE_VPRINTF=1
+  AC_DEFINE([REPLACE_VPRINTF_POSIX], [1],
+    [Define if vprintf is overridden by a POSIX compliant gnulib implementation.])
+  gl_PREREQ_VPRINTF
+])
+
+AC_DEFUN([gl_PREREQ_VPRINTF], [:])
deleted file mode 120000 (symlink)
index ed28e0ddb8fef7df45f5cf1d5cfe5af6521cff01..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/warn-on-use.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6e251fb81ee162ccd139233febdbbf160b0cf575
--- /dev/null
@@ -0,0 +1,62 @@
+# warn-on-use.m4 serial 10
+dnl Copyright (C) 2010-2024 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.
+
+# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES)
+# ---------------------------------------
+# If the module 'posixcheck' is in use:
+#
+# For each whitespace-separated element in the list of NAMES, define
+# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES
+# even after being undefined as a macro.
+#
+# See warn-on-use.h for some hints on how to poison function names, as
+# well as ideas on poisoning global variables and macros.  NAMES may
+# include global variables, but remember that only functions work with
+# _GL_WARN_ON_USE.  Typically, INCLUDES only needs to list a single
+# header, but if the replacement header pulls in other headers because
+# some systems declare functions in the wrong header, then INCLUDES
+# should do likewise.
+#
+# It is generally safe to assume declarations for functions declared
+# in the intersection of C89 and C11 (such as printf) without
+# needing gl_WARN_ON_USE_PREPARE.
+AC_DEFUN([gl_WARN_ON_USE_PREPARE],
+[
+  m4_ifdef([gl_POSIXCHECK],
+    [m4_foreach_w([gl_decl], [$2],
+       [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])),
+         [Define to 1 if ]m4_defn([gl_decl])[ is declared even after
+          undefining macros.])])dnl
+     for gl_func in m4_flatten([$2]); do
+       AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl
+       dnl As a workaround to implicit built-in function declarations in
+       dnl clang (e.g. strndup), reference ac_compile_for_check_decl instead
+       dnl of ac_compile.  If, for whatever reason, the override of AC_PROG_CC
+       dnl in zzgnulib.m4 is inactive, use the original ac_compile.
+       ac_save_ac_compile="$ac_compile"
+       if test -n "$ac_compile_for_check_decl"; then
+         ac_compile="$ac_compile_for_check_decl"
+       fi
+       AC_CACHE_CHECK([whether $gl_func is declared without a macro],
+         [gl_Symbol],
+         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1],
+[[#undef $gl_func
+  (void) $gl_func;]])],
+           [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])])
+       ac_compile="$ac_save_ac_compile"
+       AS_VAR_IF([gl_Symbol], [yes],
+         [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1])
+          dnl Shortcut for an AC_CHECK_DECL invocation that may come later:
+          dnl If the raw declaration exists with the given includes, then
+          dnl AC_CHECK_DECL with its many includes would see it as well.
+          dnl So, set a cache variable to allow skipping any later
+          dnl AC_CHECK_DECL invocation for $gl_func.
+          eval "ac_cv_have_decl_$gl_func=yes"
+         ])
+       AS_VAR_POPDEF([gl_Symbol])dnl
+     done
+    ])
+])
deleted file mode 120000 (symlink)
index 88dc43428c9f1e1a363c88b751191e0105dff743..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/warnings.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6c97ef194e4186158ba8dfade23d9753d9d98176
--- /dev/null
@@ -0,0 +1,176 @@
+# warnings.m4 serial 19
+dnl Copyright (C) 2008-2024 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 Simon Josefsson
+
+AC_PREREQ([2.64])
+
+# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
+#                       [PROGRAM = AC_LANG_PROGRAM()])
+# -----------------------------------------------------------------
+# Check if the compiler supports OPTION when compiling PROGRAM.
+#
+# The effects of this macro depend on the current language (_AC_LANG).
+AC_DEFUN([gl_COMPILER_OPTION_IF],
+[
+AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
+AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
+AS_LITERAL_IF([$1],
+  [m4_pushdef([gl_Positive], m4_bpatsubst([$1], [^-Wno-], [-W]))],
+  [gl_positive="$1"
+case $gl_positive in
+  -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;;
+esac
+m4_pushdef([gl_Positive], [$gl_positive])])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], [gl_Warn], [
+  gl_save_compiler_FLAGS="$gl_Flags"
+  AS_VAR_APPEND(m4_defn([gl_Flags]),
+    [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
+  AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([[]])])],
+                 [AS_VAR_SET([gl_Warn], [yes])],
+                 [AS_VAR_SET([gl_Warn], [no])])
+  gl_Flags="$gl_save_compiler_FLAGS"
+])
+AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
+m4_popdef([gl_Positive])dnl
+AS_VAR_POPDEF([gl_Flags])dnl
+AS_VAR_POPDEF([gl_Warn])dnl
+])
+
+# gl_UNKNOWN_WARNINGS_ARE_ERRORS
+# ------------------------------
+# Clang doesn't complain about unknown warning options unless one also
+# specifies -Wunknown-warning-option -Werror.  Detect this.
+#
+# The effects of this macro depend on the current language (_AC_LANG).
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+# Specialization for _AC_LANG = C. This macro can be AC_REQUIREd.
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C)],
+[
+  AC_LANG_PUSH([C])
+  gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
+  AC_LANG_POP([C])
+])
+
+# Specialization for _AC_LANG = C++. This macro can be AC_REQUIREd.
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++)],
+[
+  AC_LANG_PUSH([C++])
+  gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
+  AC_LANG_POP([C++])
+])
+
+# Specialization for _AC_LANG = Objective C. This macro can be AC_REQUIREd.
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS(Objective C)],
+[
+  AC_LANG_PUSH([Objective C])
+  gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL
+  AC_LANG_POP([Objective C])
+])
+
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL],
+[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option],
+   [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'],
+   [gl_unknown_warnings_are_errors=])])
+
+# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS/WARN_CXXFLAGS],
+#             [PROGRAM = AC_LANG_PROGRAM()])
+# -----------------------------------------------------------
+# Adds OPTION to VARIABLE (which defaults to WARN_CFLAGS or WARN_CXXFLAGS)
+# if the compiler supports it when compiling PROGRAM.
+#
+# If VARIABLE is a variable name, AC_SUBST it.
+#
+# The effects of this macro depend on the current language (_AC_LANG).
+#
+# Example: gl_WARN_ADD([-Wparentheses]).
+AC_DEFUN([gl_WARN_ADD],
+[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS(]_AC_LANG[)])
+gl_COMPILER_OPTION_IF([$1],
+  [AS_VAR_APPEND(m4_if([$2], [], [[WARN_]_AC_LANG_PREFIX[FLAGS]], [[$2]]), [" $1"])],
+  [],
+  [$3])
+m4_ifval([$2],
+         [AS_LITERAL_IF([$2], [AC_SUBST([$2])])],
+         [AC_SUBST([WARN_]_AC_LANG_PREFIX[FLAGS])])dnl
+])
+
+
+# gl_CC_INHIBIT_WARNINGS
+# sets and substitutes a variable GL_CFLAG_INHIBIT_WARNINGS, to a $(CC) option
+# that reverts all preceding -W* options, if available.
+# This is expected to be '-w' at least on gcc, clang, AIX xlc, xlclang, Sun cc,
+# "compile cl" (MSVC), "compile clang-cl" (MSVC-compatible clang). Or it can be
+# empty.
+AC_DEFUN([gl_CC_INHIBIT_WARNINGS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_CACHE_CHECK([for C compiler option to inhibit all warnings],
+    [gl_cv_cc_winhibit],
+    [rm -f conftest*
+     echo 'int dummy;' > conftest.c
+     AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
+     AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -w -c conftest.c 2>conftest2.err]) >/dev/null
+     if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
+       gl_cv_cc_winhibit='-w'
+     else
+       gl_cv_cc_winhibit=none
+     fi
+     rm -f conftest*
+    ])
+  case "$gl_cv_cc_winhibit" in
+    none) GL_CFLAG_INHIBIT_WARNINGS='' ;;
+    *)
+      GL_CFLAG_INHIBIT_WARNINGS="$gl_cv_cc_winhibit"
+      dnl If all warnings are inhibited, there's no point in having the GCC
+      dnl analyzer enabled. This saves RAM requirements and CPU consumption.
+      gl_WARN_ADD([-fno-analyzer], [GL_CFLAG_INHIBIT_WARNINGS])
+      ;;
+  esac
+  AC_SUBST([GL_CFLAG_INHIBIT_WARNINGS])
+])
+
+# gl_CXX_INHIBIT_WARNINGS
+# sets and substitutes a variable GL_CXXFLAG_INHIBIT_WARNINGS, to a $(CC) option
+# that reverts all preceding -W* options, if available.
+AC_DEFUN([gl_CXX_INHIBIT_WARNINGS],
+[
+  dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX.
+  if test -n "$CXX" && test "$CXX" != no; then
+    AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings],
+      [gl_cv_cxx_winhibit],
+      [rm -f conftest*
+       echo 'int dummy;' > conftest.cc
+       AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
+       AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -w -c conftest.cc 2>conftest2.err]) >/dev/null
+       if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
+         gl_cv_cxx_winhibit='-w'
+       else
+         gl_cv_cxx_winhibit=none
+       fi
+       rm -f conftest*
+      ])
+    case "$gl_cv_cxx_winhibit" in
+      none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;;
+      *)
+        GL_CXXFLAG_INHIBIT_WARNINGS="$gl_cv_cxx_winhibit"
+        dnl If all warnings are inhibited, there's no point in having the GCC
+        dnl analyzer enabled. This saves RAM requirements and CPU consumption.
+        gl_WARN_ADD([-fno-analyzer], [GL_CXXFLAG_INHIBIT_WARNINGS])
+        ;;
+    esac
+  else
+    GL_CXXFLAG_INHIBIT_WARNINGS=''
+  fi
+  AC_SUBST([GL_CXXFLAG_INHIBIT_WARNINGS])
+])
+
+
+# Local Variables:
+# mode: autoconf
+# End:
deleted file mode 120000 (symlink)
index 59fe8cc4cdecba648023e73496186b640179daa9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wchar_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3582fa774f3d2b8cf962a0eb05b59aece5e8938a
--- /dev/null
@@ -0,0 +1,264 @@
+dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
+
+dnl Copyright (C) 2007-2024 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 Eric Blake.
+
+# wchar_h.m4 serial 62
+
+AC_DEFUN_ONCE([gl_WCHAR_H],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
+  dnl Prepare for creating substitute <wchar.h>.
+  dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
+  dnl character support).
+  dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([wchar.h])
+  if test $ac_cv_header_wchar_h = yes; then
+    HAVE_WCHAR_H=1
+  else
+    HAVE_WCHAR_H=0
+  fi
+  AC_SUBST([HAVE_WCHAR_H])
+
+  AC_REQUIRE([gl_FEATURES_H])
+
+  AC_REQUIRE([gt_TYPE_WINT_T])
+  if test $gt_cv_c_wint_t = yes; then
+    HAVE_WINT_T=1
+  else
+    HAVE_WINT_T=0
+  fi
+  AC_SUBST([HAVE_WINT_T])
+
+  AC_REQUIRE([gl_TYPE_WINT_T_PREREQ])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+      #include <wchar.h>
+    ]],
+    [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
+     wcsrtombs wcsnrtombs wcwidth
+     wmemchr wmemcmp wmemcpy wmemmove wmempcpy wmemset
+     wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp
+     wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr
+     wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth wcsftime
+    ])
+
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_CHECK_DECLS([wcsdup], [], [], [[
+      #include <wchar.h>
+    ]])
+  if test $ac_cv_have_decl_wcsdup = no; then
+    HAVE_DECL_WCSDUP=0
+  fi
+])
+
+dnl Check whether <wchar.h> is usable at all.
+AC_DEFUN([gl_WCHAR_H_INLINE_OK],
+[
+  dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
+  dnl 'gnu_inline'. See <https://sourceware.org/bugzilla/show_bug.cgi?id=4022>
+  dnl and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary,
+  dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
+  dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly],
+    [gl_cv_header_wchar_h_correct_inline],
+    [gl_cv_header_wchar_h_correct_inline=yes
+     case "$host_os" in
+       *-gnu* | gnu*)
+         AC_LANG_CONFTEST([
+           AC_LANG_SOURCE([[
+             #define wcstod renamed_wcstod
+             #include <wchar.h>
+             extern int zero (void);
+             int main () { return zero(); }
+           ]])])
+         dnl Do not rename the object file from conftest.$ac_objext to
+         dnl conftest1.$ac_objext, as this will cause the link to fail on
+         dnl z/OS when using the XPLINK object format (due to duplicate
+         dnl CSECT names). Instead, temporarily redefine $ac_compile so
+         dnl that the object file has the latter name from the start.
+         save_ac_compile="$ac_compile"
+         ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/`
+         if echo '#include "conftest.c"' >conftest1.c \
+            && AC_TRY_EVAL([ac_compile]); then
+           AC_LANG_CONFTEST([
+             AC_LANG_SOURCE([[
+               #define wcstod renamed_wcstod
+               #include <wchar.h>
+               int zero (void) { return 0; }
+             ]])])
+           dnl See note above about renaming object files.
+           ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/`
+           if echo '#include "conftest.c"' >conftest2.c \
+              && AC_TRY_EVAL([ac_compile]); then
+             if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
+               :
+             else
+               gl_cv_header_wchar_h_correct_inline=no
+             fi
+           fi
+         fi
+         ac_compile="$save_ac_compile"
+         rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext
+         ;;
+     esac
+    ])
+  if test $gl_cv_header_wchar_h_correct_inline = no; then
+    AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS).
+This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in
+C99 mode. You have four options:
+  - Add the flag -fgnu89-inline to CC and reconfigure, or
+  - Fix your include files, using parts of
+    <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or
+  - Use a gcc version older than 4.3, or
+  - Don't use the flags -std=c99 or -std=gnu99.
+Configuration aborted.])
+  fi
+])
+
+# gl_WCHAR_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_WCHAR_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSZERO])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOWCS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCRTOMB])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRTOMBS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNRTOMBS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCWIDTH])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCHR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMMOVE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMPCPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMSET])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSLEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNLEN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPCPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPNCPY])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCAT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCASECMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCASECMP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCOLL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSXFRM])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSDUP])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCHR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRCHR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCSPN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSPN])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSPBRK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSTR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WGETCWD])
+    dnl Support Microsoft deprecated alias function names by default.
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS])
+  dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized.
+  gl_STDLIB_H_REQUIRE_DEFAULTS
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_WCHAR_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_BTOWC=1;         AC_SUBST([HAVE_BTOWC])
+  HAVE_MBSINIT=1;       AC_SUBST([HAVE_MBSINIT])
+  HAVE_MBRTOWC=1;       AC_SUBST([HAVE_MBRTOWC])
+  HAVE_MBRLEN=1;        AC_SUBST([HAVE_MBRLEN])
+  HAVE_MBSRTOWCS=1;     AC_SUBST([HAVE_MBSRTOWCS])
+  HAVE_MBSNRTOWCS=1;    AC_SUBST([HAVE_MBSNRTOWCS])
+  HAVE_WCRTOMB=1;       AC_SUBST([HAVE_WCRTOMB])
+  HAVE_WCSRTOMBS=1;     AC_SUBST([HAVE_WCSRTOMBS])
+  HAVE_WCSNRTOMBS=1;    AC_SUBST([HAVE_WCSNRTOMBS])
+  HAVE_WMEMCHR=1;       AC_SUBST([HAVE_WMEMCHR])
+  HAVE_WMEMCMP=1;       AC_SUBST([HAVE_WMEMCMP])
+  HAVE_WMEMCPY=1;       AC_SUBST([HAVE_WMEMCPY])
+  HAVE_WMEMMOVE=1;      AC_SUBST([HAVE_WMEMMOVE])
+  HAVE_WMEMPCPY=1;      AC_SUBST([HAVE_WMEMPCPY])
+  HAVE_WMEMSET=1;       AC_SUBST([HAVE_WMEMSET])
+  HAVE_WCSLEN=1;        AC_SUBST([HAVE_WCSLEN])
+  HAVE_WCSNLEN=1;       AC_SUBST([HAVE_WCSNLEN])
+  HAVE_WCSCPY=1;        AC_SUBST([HAVE_WCSCPY])
+  HAVE_WCPCPY=1;        AC_SUBST([HAVE_WCPCPY])
+  HAVE_WCSNCPY=1;       AC_SUBST([HAVE_WCSNCPY])
+  HAVE_WCPNCPY=1;       AC_SUBST([HAVE_WCPNCPY])
+  HAVE_WCSCAT=1;        AC_SUBST([HAVE_WCSCAT])
+  HAVE_WCSNCAT=1;       AC_SUBST([HAVE_WCSNCAT])
+  HAVE_WCSCMP=1;        AC_SUBST([HAVE_WCSCMP])
+  HAVE_WCSNCMP=1;       AC_SUBST([HAVE_WCSNCMP])
+  HAVE_WCSCASECMP=1;    AC_SUBST([HAVE_WCSCASECMP])
+  HAVE_WCSNCASECMP=1;   AC_SUBST([HAVE_WCSNCASECMP])
+  HAVE_WCSCOLL=1;       AC_SUBST([HAVE_WCSCOLL])
+  HAVE_WCSXFRM=1;       AC_SUBST([HAVE_WCSXFRM])
+  HAVE_WCSDUP=1;        AC_SUBST([HAVE_WCSDUP])
+  HAVE_WCSCHR=1;        AC_SUBST([HAVE_WCSCHR])
+  HAVE_WCSRCHR=1;       AC_SUBST([HAVE_WCSRCHR])
+  HAVE_WCSCSPN=1;       AC_SUBST([HAVE_WCSCSPN])
+  HAVE_WCSSPN=1;        AC_SUBST([HAVE_WCSSPN])
+  HAVE_WCSPBRK=1;       AC_SUBST([HAVE_WCSPBRK])
+  HAVE_WCSSTR=1;        AC_SUBST([HAVE_WCSSTR])
+  HAVE_WCSTOK=1;        AC_SUBST([HAVE_WCSTOK])
+  HAVE_WCSWIDTH=1;      AC_SUBST([HAVE_WCSWIDTH])
+  HAVE_WCSFTIME=1;      AC_SUBST([HAVE_WCSFTIME])
+  HAVE_DECL_WCTOB=1;    AC_SUBST([HAVE_DECL_WCTOB])
+  HAVE_DECL_WCSDUP=1;   AC_SUBST([HAVE_DECL_WCSDUP])
+  HAVE_DECL_WCWIDTH=1;  AC_SUBST([HAVE_DECL_WCWIDTH])
+  REPLACE_MBSTATE_T=0;  AC_SUBST([REPLACE_MBSTATE_T])
+  REPLACE_BTOWC=0;      AC_SUBST([REPLACE_BTOWC])
+  REPLACE_WCTOB=0;      AC_SUBST([REPLACE_WCTOB])
+  REPLACE_MBSINIT=0;    AC_SUBST([REPLACE_MBSINIT])
+  REPLACE_MBRTOWC=0;    AC_SUBST([REPLACE_MBRTOWC])
+  REPLACE_MBRLEN=0;     AC_SUBST([REPLACE_MBRLEN])
+  REPLACE_MBSRTOWCS=0;  AC_SUBST([REPLACE_MBSRTOWCS])
+  REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
+  REPLACE_WCRTOMB=0;    AC_SUBST([REPLACE_WCRTOMB])
+  REPLACE_WCSRTOMBS=0;  AC_SUBST([REPLACE_WCSRTOMBS])
+  REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
+  REPLACE_WCWIDTH=0;    AC_SUBST([REPLACE_WCWIDTH])
+  REPLACE_WCSWIDTH=0;   AC_SUBST([REPLACE_WCSWIDTH])
+  REPLACE_WCSFTIME=0;   AC_SUBST([REPLACE_WCSFTIME])
+  REPLACE_WCSCMP=0;     AC_SUBST([REPLACE_WCSCMP])
+  REPLACE_WCSNCMP=0;    AC_SUBST([REPLACE_WCSNCMP])
+  REPLACE_WCSSTR=0;     AC_SUBST([REPLACE_WCSSTR])
+  REPLACE_WCSTOK=0;     AC_SUBST([REPLACE_WCSTOK])
+  REPLACE_WMEMCMP=0;    AC_SUBST([REPLACE_WMEMCMP])
+  REPLACE_WMEMPCPY=0;   AC_SUBST([REPLACE_WMEMPCPY])
+])
deleted file mode 120000 (symlink)
index 31fcb763b8c531797d0b60923d3b158d6b1e7bdc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wchar_t.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..94353571b00bc99e2539b6816efb324b74a145e9
--- /dev/null
@@ -0,0 +1,24 @@
+# wchar_t.m4 serial 4 (gettext-0.18.2)
+dnl Copyright (C) 2002-2003, 2008-2024 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 Bruno Haible.
+dnl Test whether <stddef.h> has the 'wchar_t' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_WCHAR_T],
+[
+  AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stddef.h>
+            wchar_t foo = (wchar_t)'\0';]],
+          [[]])],
+       [gt_cv_c_wchar_t=yes],
+       [gt_cv_c_wchar_t=no])])
+  if test $gt_cv_c_wchar_t = yes; then
+    AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
+  fi
+])
deleted file mode 120000 (symlink)
index 608b8624525d6b0d78ff509d057a4d05c5cddb30..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wcrtomb.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f00f6452fb28194f0a04078daa96a013910c5117
--- /dev/null
@@ -0,0 +1,152 @@
+# wcrtomb.m4 serial 19
+dnl Copyright (C) 2008-2024 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_WCRTOMB],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  gl_MBSTATE_T_BROKEN
+
+  AC_CHECK_FUNCS_ONCE([wcrtomb])
+  if test $ac_cv_func_wcrtomb = no; then
+    HAVE_WCRTOMB=0
+    AC_CHECK_DECLS([wcrtomb],,, [[
+      #include <wchar.h>
+    ]])
+    if test $ac_cv_have_decl_wcrtomb = yes; then
+      dnl On Minix 3.1.8, the system's <wchar.h> declares wcrtomb() although
+      dnl it does not have the function. Avoid a collision with gnulib's
+      dnl replacement.
+      REPLACE_WCRTOMB=1
+    fi
+  else
+    dnl We don't actually need to override wcrtomb when redefining the semantics
+    dnl of the mbstate_t type. Tested on 32-bit AIX.
+    dnl if test $REPLACE_MBSTATE_T = 1; then
+    dnl   REPLACE_WCRTOMB=1
+    dnl fi
+    if test $REPLACE_WCRTOMB = 0; then
+      dnl On Android 4.3, wcrtomb produces wrong characters in the C locale.
+      dnl On AIX 4.3, OSF/1 5.1 and Solaris <= 11.3, wcrtomb (NULL, 0, NULL)
+      dnl sometimes returns 0 instead of 1.
+      AC_REQUIRE([AC_PROG_CC])
+      AC_REQUIRE([gt_LOCALE_FR])
+      AC_REQUIRE([gt_LOCALE_FR_UTF8])
+      AC_REQUIRE([gt_LOCALE_JA])
+      AC_REQUIRE([gt_LOCALE_ZH_CN])
+      AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+      AC_CACHE_CHECK([whether wcrtomb works in the C locale],
+        [gl_cv_func_wcrtomb_works],
+        [AC_RUN_IFELSE(
+           [AC_LANG_SOURCE([[
+#include <string.h>
+#include <stdlib.h>
+#include <wchar.h>
+int main ()
+{
+  mbstate_t state;
+  char out[64];
+  int count;
+  memset (&state, 0, sizeof (state));
+  out[0] = 'x';
+  count = wcrtomb (out, L'a', &state);
+  return !(count == 1 && out[0] == 'a');
+}]])],
+           [gl_cv_func_wcrtomb_works=yes],
+           [gl_cv_func_wcrtomb_works=no],
+           [case "$host_os" in
+                               # Guess no on Android.
+              linux*-android*) gl_cv_func_wcrtomb_works="guessing no";;
+                               # Guess yes otherwise.
+              *)               gl_cv_func_wcrtomb_works="guessing yes";;
+            esac
+           ])
+        ])
+      case "$gl_cv_func_wcrtomb_works" in
+        *yes) ;;
+        *) AC_DEFINE([WCRTOMB_C_LOCALE_BUG], [1],
+             [Define if the wcrtomb function does not work in the C locale.])
+           REPLACE_WCRTOMB=1 ;;
+      esac
+    fi
+    if test $REPLACE_WCRTOMB = 0; then
+      AC_CACHE_CHECK([whether wcrtomb return value is correct],
+        [gl_cv_func_wcrtomb_retval],
+        [
+          dnl Initial guess, used when cross-compiling or when no suitable locale
+          dnl is present.
+changequote(,)dnl
+          case "$host_os" in
+            # Guess no on AIX 4, OSF/1, Solaris, native Windows.
+            aix4* | osf* | solaris* | mingw* | windows*)
+              gl_cv_func_wcrtomb_retval="guessing no" ;;
+            # Guess yes otherwise.
+            *)
+              gl_cv_func_wcrtomb_retval="guessing yes" ;;
+          esac
+changequote([,])dnl
+          if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
+            AC_RUN_IFELSE(
+              [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+#include <wchar.h>
+#include <stdlib.h>
+int main ()
+{
+  int result = 0;
+  if (strcmp ("$LOCALE_FR", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+    {
+      if (wcrtomb (NULL, 0, NULL) != 1)
+        result |= 1;
+    }
+  if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+    {
+      if (wcrtomb (NULL, 0, NULL) != 1)
+        result |= 2;
+      {
+        wchar_t wc = (wchar_t) 0xBADFACE;
+        if (mbtowc (&wc, "\303\274", 2) == 2)
+          if (wcrtomb (NULL, wc, NULL) != 1)
+            result |= 2;
+      }
+    }
+  if (strcmp ("$LOCALE_JA", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_JA") != NULL)
+    {
+      if (wcrtomb (NULL, 0, NULL) != 1)
+        result |= 4;
+    }
+  if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+    {
+      if (wcrtomb (NULL, 0, NULL) != 1)
+        result |= 8;
+    }
+  return result;
+}]])],
+              [gl_cv_func_wcrtomb_retval=yes],
+              [gl_cv_func_wcrtomb_retval=no],
+              [:])
+          fi
+        ])
+      case "$gl_cv_func_wcrtomb_retval" in
+        *yes) ;;
+        *) AC_DEFINE([WCRTOMB_RETVAL_BUG], [1],
+             [Define if the wcrtomb function has an incorrect return value.])
+           REPLACE_WCRTOMB=1 ;;
+      esac
+    fi
+  fi
+])
+
+# Prerequisites of lib/wcrtomb.c.
+AC_DEFUN([gl_PREREQ_WCRTOMB], [
+  :
+])
deleted file mode 120000 (symlink)
index a904697a82d3dd68d85272abcc8c8c9689af1c24..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wctob.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..323b1ede00404d54310cd8110654de122b38e363
--- /dev/null
@@ -0,0 +1,109 @@
+# wctob.m4 serial 14
+dnl Copyright (C) 2008-2024 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_WCTOB],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  AC_CHECK_FUNCS_ONCE([wctob])
+  if test $ac_cv_func_wctob = no; then
+    HAVE_WCTOB=0
+    HAVE_DECL_WCTOB=0
+  else
+    HAVE_WCTOB=1
+
+    dnl Solaris 9 has the wctob() function but it does not work.
+    dnl Cygwin 1.7.2 has the wctob() function but it clobbers caller-owned
+    dnl registers, see <https://cygwin.com/ml/cygwin/2010-05/msg00015.html>.
+    AC_REQUIRE([AC_PROG_CC])
+    AC_REQUIRE([gt_LOCALE_FR])
+    AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+    AC_CACHE_CHECK([whether wctob works],
+      [gl_cv_func_wctob_works],
+      [
+        dnl Initial guess, used when cross-compiling or when no suitable locale
+        dnl is present.
+changequote(,)dnl
+        case "$host_os" in
+            # Guess no on Solaris <= 9 and Cygwin.
+          solaris2.[1-9] | solaris2.[1-9].* | cygwin*)
+            gl_cv_func_wctob_works="guessing no" ;;
+            # Guess no on native Windows.
+          mingw* | windows*)
+            gl_cv_func_wctob_works="guessing no" ;;
+            # Guess yes otherwise.
+          *) gl_cv_func_wctob_works="guessing yes" ;;
+        esac
+changequote([,])dnl
+        case "$host_os" in
+          cygwin*)
+            AC_RUN_IFELSE(
+              [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <wchar.h>
+
+register long global __asm__ ("%ebx");
+
+int main ()
+{
+  setlocale (LC_ALL, "en_US.UTF-8");
+
+  global = 0x12345678;
+  if (wctob (0x00FC) != -1)
+    return 1;
+  if (global != 0x12345678)
+    return 2;
+  return 0;
+}]])],
+              [:],
+              [gl_cv_func_wctob_works=no],
+              [:])
+            ;;
+        esac
+        if test "$gl_cv_func_wctob_works" != no && test $LOCALE_FR != none; then
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdlib.h>
+#include <wchar.h>
+int main ()
+{
+  if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+    {
+      wchar_t wc;
+
+      if (mbtowc (&wc, "\374", 1) == 1)
+        if (wctob (wc) != (unsigned char) '\374')
+          return 1;
+    }
+  return 0;
+}]])],
+            [gl_cv_func_wctob_works=yes],
+            [gl_cv_func_wctob_works=no],
+            [:])
+        fi
+      ])
+    case "$gl_cv_func_wctob_works" in
+      *yes) ;;
+      *) REPLACE_WCTOB=1 ;;
+    esac
+    if test $REPLACE_WCTOB = 0; then
+
+      dnl IRIX 6.5 has the wctob() function but does not declare it.
+      AC_CHECK_DECLS([wctob], [], [], [[
+        #include <wchar.h>
+      ]])
+      if test $ac_cv_have_decl_wctob != yes; then
+        HAVE_DECL_WCTOB=0
+      fi
+    fi
+  fi
+])
+
+# Prerequisites of lib/wctob.c.
+AC_DEFUN([gl_PREREQ_WCTOB], [
+  :
+])
deleted file mode 120000 (symlink)
index 195faa08d98c47a61352071a632b2d5badd8a8bc..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wctomb.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..d8f3652788594b4142abf237f2b96849b8164722
--- /dev/null
@@ -0,0 +1,19 @@
+# wctomb.m4 serial 2
+dnl Copyright (C) 2011-2024 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_WCTOMB],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+  if false; then
+    REPLACE_WCTOMB=1
+  fi
+])
+
+# Prerequisites of lib/wctomb.c.
+AC_DEFUN([gl_PREREQ_WCTOMB], [
+  :
+])
deleted file mode 120000 (symlink)
index 2c5fce07f1fd08c706b65eee9199431f780d2e2d..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wctype.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..3660d7d9175ac160eb3109de633cbfcace49af58
--- /dev/null
@@ -0,0 +1,51 @@
+# wctype.m4 serial 6
+dnl Copyright (C) 2011-2024 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_ONCE([gl_FUNC_WCTYPE],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  HAVE_WCTYPE=$HAVE_WCTYPE_T
+  if test $HAVE_WCTYPE = 1; then
+    AC_CACHE_CHECK([whether wctype supports the "blank" and "punct" character classes],
+      [gl_cv_func_wctype_works],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE([[
+            #include <ctype.h>
+            #include <wchar.h>
+            #include <wctype.h>
+            int main ()
+            {
+              /* This test fails on mingw.  */
+              if (wctype ("blank") == (wctype_t)0)
+                return 1;
+              /* This test fails on MSVC 14.  */
+              if ((! iswctype ('\t', wctype ("blank"))) != (! iswblank ('\t')))
+                return 2;
+              /* This test fails on Android 11.  */
+              if ((! iswctype ('\`', wctype ("punct"))) != (! ispunct ('\`')))
+                return 4;
+              return 0;
+            }
+         ]])],
+         [gl_cv_func_wctype_works=yes], [gl_cv_func_wctype_works=no],
+         [case "$host_os" in
+                               # Guess no on native Windows.
+            mingw* | windows*) gl_cv_func_wctype_works="guessing no" ;;
+                               # Guess no on Android.
+            android*)          gl_cv_func_wctype_works="guessing no" ;;
+                               # Guess yes otherwise.
+            *)                 gl_cv_func_wctype_works="guessing yes" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_wctype_works" in
+      *yes) ;;
+      *) REPLACE_WCTYPE=1 ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index d4253c256151db0ef587abf3ea411a2c13c1a2f8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wctype_h.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c899394970158b1388afb0c6e31e1e980ddef6da
--- /dev/null
@@ -0,0 +1,204 @@
+# wctype_h.m4 serial 33
+
+dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
+
+dnl Copyright (C) 2006-2024 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_ONCE([gl_WCTYPE_H],
+[
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CHECK_FUNCS_ONCE([iswcntrl])
+  if test $ac_cv_func_iswcntrl = yes; then
+    HAVE_ISWCNTRL=1
+  else
+    HAVE_ISWCNTRL=0
+  fi
+  AC_SUBST([HAVE_ISWCNTRL])
+
+  AC_REQUIRE([gt_TYPE_WINT_T])
+  if test $gt_cv_c_wint_t = yes; then
+    HAVE_WINT_T=1
+  else
+    HAVE_WINT_T=0
+  fi
+  AC_SUBST([HAVE_WINT_T])
+
+  AC_REQUIRE([gl_TYPE_WINT_T_PREREQ])
+
+  gl_CHECK_NEXT_HEADERS([wctype.h])
+  if test $ac_cv_header_wctype_h = yes; then
+    if test $ac_cv_func_iswcntrl = yes; then
+      dnl Linux libc5 has an iswprint function that returns 0 for all arguments.
+      dnl The other functions are likely broken in the same way.
+      AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works],
+        [
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+               #include <wchar.h>
+               #include <wctype.h>
+               int main () { return iswprint ('x') == 0; }
+            ]])],
+            [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no],
+            [dnl Guess no on Linux libc5, yes otherwise.
+             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
+                          #if __GNU_LIBRARY__ == 1
+                          Linux libc5 i18n is broken.
+                          #endif]], [[]])],
+              [gl_cv_func_iswcntrl_works="guessing yes"],
+              [gl_cv_func_iswcntrl_works="guessing no"])
+            ])
+        ])
+    fi
+    HAVE_WCTYPE_H=1
+  else
+    HAVE_WCTYPE_H=0
+  fi
+  AC_SUBST([HAVE_WCTYPE_H])
+
+  if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
+    REPLACE_ISWCNTRL=1
+  else
+    case "$gl_cv_func_iswcntrl_works" in
+      *yes) REPLACE_ISWCNTRL=0 ;;
+      *)    REPLACE_ISWCNTRL=1 ;;
+    esac
+  fi
+  AC_SUBST([REPLACE_ISWCNTRL])
+
+  if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
+    dnl Redefine all of iswcntrl, ..., iswxdigit in <wctype.h>.
+    :
+  fi
+
+  if test $REPLACE_ISWCNTRL = 1; then
+    REPLACE_TOWLOWER=1
+  else
+    AC_CHECK_FUNCS([towlower])
+    if test $ac_cv_func_towlower = yes; then
+      REPLACE_TOWLOWER=0
+    else
+      AC_CHECK_DECLS([towlower],,,
+        [[#include <wchar.h>
+          #if HAVE_WCTYPE_H
+          # include <wctype.h>
+          #endif
+        ]])
+      if test $ac_cv_have_decl_towlower = yes; then
+        dnl On Minix 3.1.8, the system's <wctype.h> declares towlower() and
+        dnl towupper() although it does not have the functions. Avoid a
+        dnl collision with gnulib's replacement.
+        REPLACE_TOWLOWER=1
+      else
+        REPLACE_TOWLOWER=0
+      fi
+    fi
+  fi
+  AC_SUBST([REPLACE_TOWLOWER])
+
+  if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then
+    dnl Redefine towlower, towupper in <wctype.h>.
+    :
+  fi
+
+  dnl We assume that the wctype() and iswctype() functions exist if and only
+  dnl if the type wctype_t is defined in <wchar.h> or in <wctype.h> if that
+  dnl exists.
+  dnl HP-UX 11.00 declares all these in <wchar.h> and lacks <wctype.h>.
+  AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <wchar.h>
+            #if HAVE_WCTYPE_H
+            # include <wctype.h>
+            #endif
+            wctype_t a;
+          ]],
+          [[]])],
+       [gl_cv_type_wctype_t=yes],
+       [gl_cv_type_wctype_t=no])
+    ])
+  if test $gl_cv_type_wctype_t = no; then
+    HAVE_WCTYPE_T=0
+  fi
+
+  dnl We assume that the wctrans() and towctrans() functions exist if and only
+  dnl if the type wctrans_t is defined in <wctype.h>.
+  AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <wchar.h>
+            #include <wctype.h>
+            wctrans_t a;
+          ]],
+          [[]])],
+       [gl_cv_type_wctrans_t=yes],
+       [gl_cv_type_wctrans_t=no])
+    ])
+  if test $gl_cv_type_wctrans_t = no; then
+    HAVE_WCTRANS_T=0
+  fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <wchar.h>
+#endif
+#include <wctype.h>
+    ]],
+    [wctype iswctype wctrans towctrans
+    ])
+])
+
+# gl_WCTYPE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR],
+[
+  dnl Ensure to expand the default settings once only.
+  gl_WCTYPE_H_REQUIRE_DEFAULTS
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd.  It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS],
+[
+  m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWPUNCT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTRANS])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOWCTRANS])
+  ])
+  m4_require(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS])
+  AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_WCTYPE_H_DEFAULTS],
+[
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_ISWBLANK=1;      AC_SUBST([HAVE_ISWBLANK])
+  HAVE_WCTYPE_T=1;      AC_SUBST([HAVE_WCTYPE_T])
+  HAVE_WCTRANS_T=1;     AC_SUBST([HAVE_WCTRANS_T])
+  REPLACE_ISWBLANK=0;   AC_SUBST([REPLACE_ISWBLANK])
+  REPLACE_ISWDIGIT=0;   AC_SUBST([REPLACE_ISWDIGIT])
+  REPLACE_ISWPUNCT=0;   AC_SUBST([REPLACE_ISWPUNCT])
+  REPLACE_ISWXDIGIT=0;  AC_SUBST([REPLACE_ISWXDIGIT])
+  REPLACE_WCTRANS=0;    AC_SUBST([REPLACE_WCTRANS])
+  REPLACE_WCTYPE=0;     AC_SUBST([REPLACE_WCTYPE])
+])
deleted file mode 120000 (symlink)
index cd3ba1869148657cc5a9954f07a6bbb22cc21710..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wcwidth.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..53a26c7dd1194d83cfb0f756d3043d1eb423acaf
--- /dev/null
@@ -0,0 +1,115 @@
+# wcwidth.m4 serial 36
+dnl Copyright (C) 2006-2024 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_WCWIDTH],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Persuade glibc <wchar.h> to declare wcwidth().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_REQUIRE([gt_TYPE_WCHAR_T])
+  AC_REQUIRE([gt_TYPE_WINT_T])
+
+  AC_CHECK_HEADERS_ONCE([wchar.h])
+  AC_CHECK_FUNCS_ONCE([wcwidth])
+
+  AC_CHECK_DECLS([wcwidth], [], [], [[
+    #include <wchar.h>
+  ]])
+  if test $ac_cv_have_decl_wcwidth != yes; then
+    HAVE_DECL_WCWIDTH=0
+  fi
+
+  if test $ac_cv_func_wcwidth != yes; then
+    AC_CACHE_CHECK([whether wcwidth is a macro],
+      [gl_cv_func_wcwidth_macro],
+      [AC_EGREP_CPP([wchar_header_defines_wcwidth], [
+#include <wchar.h>
+#ifdef wcwidth
+ wchar_header_defines_wcwidth
+#endif],
+         [gl_cv_func_wcwidth_macro=yes],
+         [gl_cv_func_wcwidth_macro=no])
+      ])
+  fi
+
+  if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then
+    HAVE_WCWIDTH=1
+    dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1.
+    dnl On macOS 12.5, NetBSD 9.0, OpenBSD 5.0, MidnightBSD 1.1,
+    dnl wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1.
+    dnl On macOS 12.5, NetBSD 9.0, MidnightBSD 1.1, OSF/1 5.1,
+    dnl wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1.
+    dnl On OpenBSD 5.8, wcwidth(0xFF1A) (FULLWIDTH COLON) returns 0.
+    dnl This leads to bugs in 'ls' (coreutils).
+    dnl On Solaris 11.4, wcwidth(0x2202) (PARTIAL DIFFERENTIAL) returns 2,
+    dnl even in Western locales.
+    AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales],
+      [gl_cv_func_wcwidth_works],
+      [
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <wchar.h>
+#if !HAVE_DECL_WCWIDTH
+extern
+# ifdef __cplusplus
+"C"
+# endif
+int wcwidth (int);
+#endif
+int main ()
+{
+  int result = 0;
+  if (setlocale (LC_ALL, "en_US.UTF-8") != NULL)
+    {
+      if (wcwidth (0x0301) > 0)
+        result |= 1;
+      if (wcwidth (0x05B0) > 0)
+        result |= 2;
+      if (wcwidth (0x200B) > 0)
+        result |= 4;
+      if (wcwidth (0xFF1A) == 0)
+        result |= 8;
+      if (wcwidth (0x2202) > 1)
+        result |= 16;
+    }
+  return result;
+}]])],
+          [gl_cv_func_wcwidth_works=yes],
+          [gl_cv_func_wcwidth_works=no],
+          [
+changequote(,)dnl
+           case "$host_os" in
+                                 # Guess yes on glibc systems.
+             *-gnu* | gnu*)      gl_cv_func_wcwidth_works="guessing yes";;
+                                 # Guess yes on musl systems.
+             *-musl* | midipix*) gl_cv_func_wcwidth_works="guessing yes";;
+                                 # Guess yes on AIX 7 systems.
+             aix[7-9]*)          gl_cv_func_wcwidth_works="guessing yes";;
+             *)                  gl_cv_func_wcwidth_works="$gl_cross_guess_normal";;
+           esac
+changequote([,])dnl
+          ])
+      ])
+    case "$gl_cv_func_wcwidth_works" in
+      *yes) ;;
+      *no) REPLACE_WCWIDTH=1 ;;
+    esac
+  else
+    HAVE_WCWIDTH=0
+  fi
+  dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not
+  dnl have the wcwidth function, then it does not declare it.
+])
+
+# Prerequisites of lib/wcwidth.c.
+AC_DEFUN([gl_PREREQ_WCWIDTH], [
+  AC_REQUIRE([AC_C_INLINE])
+  :
+])
deleted file mode 120000 (symlink)
index 58e1b3275da97d69a078a7579063fea59eb82cd9..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wint_t.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..21350f5605c843db65d8d046ec8d46315d2772dc
--- /dev/null
@@ -0,0 +1,57 @@
+# wint_t.m4 serial 11
+dnl Copyright (C) 2003, 2007-2024 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 Bruno Haible.
+dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's
+dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_WINT_T],
+[
+  AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <wchar.h>
+            wint_t foo = (wchar_t)'\0';]],
+          [[]])],
+       [gt_cv_c_wint_t=yes],
+       [gt_cv_c_wint_t=no])])
+  if test $gt_cv_c_wint_t = yes; then
+    AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
+
+    dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present,
+    dnl override 'wint_t'.
+    AC_CACHE_CHECK([whether wint_t is large enough],
+      [gl_cv_type_wint_t_large_enough],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <wchar.h>
+              int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
+            ]])],
+         [gl_cv_type_wint_t_large_enough=yes],
+         [gl_cv_type_wint_t_large_enough=no])])
+    if test $gl_cv_type_wint_t_large_enough = no; then
+      GNULIBHEADERS_OVERRIDE_WINT_T=1
+    else
+      GNULIBHEADERS_OVERRIDE_WINT_T=0
+    fi
+  else
+    GNULIBHEADERS_OVERRIDE_WINT_T=0
+  fi
+  AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])
+])
+
+dnl Prerequisites of the 'wint_t' override.
+AC_DEFUN([gl_TYPE_WINT_T_PREREQ],
+[
+  AC_CHECK_HEADERS_ONCE([crtdefs.h])
+  if test $ac_cv_header_crtdefs_h = yes; then
+    HAVE_CRTDEFS_H=1
+  else
+    HAVE_CRTDEFS_H=0
+  fi
+  AC_SUBST([HAVE_CRTDEFS_H])
+])
deleted file mode 120000 (symlink)
index d410cc2e54b413bc57940f7501e9dab3a81d6dce..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wmemchr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..54f1c83d1498fc9d0d16135735fa83f39d0bb1c5
--- /dev/null
@@ -0,0 +1,25 @@
+# wmemchr.m4 serial 5
+dnl Copyright (C) 2011-2024 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_WMEMCHR],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  dnl We cannot use AC_CHECK_FUNCS here, because the MSVC 9 header files
+  dnl provide this function as an inline function definition.
+  AC_CACHE_CHECK([for wmemchr], [gl_cv_func_wmemchr],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <wchar.h>
+          ]],
+          [[return ! wmemchr ((const wchar_t *) 0, (wchar_t) ' ', 0);]])
+       ],
+       [gl_cv_func_wmemchr=yes],
+       [gl_cv_func_wmemchr=no])
+    ])
+  if test $gl_cv_func_wmemchr = no; then
+    HAVE_WMEMCHR=0
+  fi
+])
deleted file mode 120000 (symlink)
index bfef7f9803626a6225ee0f1a24410f3c7efa3e4b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/wmempcpy.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6c08d55d12c4125c3964719c3973b264d7bbf156
--- /dev/null
@@ -0,0 +1,24 @@
+# wmempcpy.m4 serial 3
+dnl Copyright (C) 2020-2024 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_WMEMPCPY],
+[
+  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+  dnl Persuade glibc <wchar.h> to declare wmempcpy().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl The wmempcpy() declaration in lib/wchar.in.h uses 'restrict'.
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  gl_CHECK_FUNCS_ANDROID([wmempcpy], [[#include <wchar.h>]])
+  if test $ac_cv_func_wmempcpy = no; then
+    HAVE_WMEMPCPY=0
+    case "$gl_cv_onwards_func_wmempcpy" in
+      future*) REPLACE_WMEMPCPY=1 ;;
+    esac
+  fi
+])
deleted file mode 120000 (symlink)
index 7a3130cbb19f54aa5bc8ab0de29a67ce97e1e42c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/write-any-file.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..0c7e9af2a30cdc79c8e9b47eb84691386129e96d
--- /dev/null
@@ -0,0 +1,14 @@
+# Determine whether we can write any file.
+
+# Copyright (C) 2007, 2009-2024 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.
+
+# Written by Paul Eggert.
+
+AC_DEFUN([gl_WRITE_ANY_FILE],
+[
+  AC_CHECK_HEADERS_ONCE([priv.h])
+])
deleted file mode 120000 (symlink)
index 75fee93ae285139f4d1d1e4d24b8c053af30694b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/write.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c50efc414240fcde90e16e0f544999a1959f88d2
--- /dev/null
@@ -0,0 +1,34 @@
+# write.m4 serial 6
+dnl Copyright (C) 2008-2024 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_WRITE],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  m4_ifdef([gl_MSVC_INVAL], [
+    AC_REQUIRE([gl_MSVC_INVAL])
+    if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+      REPLACE_WRITE=1
+    fi
+  ])
+  dnl This ifdef is just an optimization, to avoid performing a configure
+  dnl check whose result is not used. It does not make the test of
+  dnl GNULIB_UNISTD_H_SIGPIPE or GNULIB_SIGPIPE redundant.
+  m4_ifdef([gl_SIGNAL_SIGPIPE], [
+    gl_SIGNAL_SIGPIPE
+    if test $gl_cv_header_signal_h_SIGPIPE != yes; then
+      REPLACE_WRITE=1
+    fi
+  ])
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    gl_NONBLOCKING_IO
+    if test $gl_cv_have_nonblocking != yes; then
+      REPLACE_WRITE=1
+    fi
+  ])
+])
+
+# Prerequisites of lib/write.c.
+AC_DEFUN([gl_PREREQ_WRITE], [:])
deleted file mode 120000 (symlink)
index 57f45341804667b59dc7defad18452826a9441e3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/xalloc.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..f60ea3d559086d8d06a88657d1feba06775a7d05
--- /dev/null
@@ -0,0 +1,7 @@
+# xalloc.m4 serial 18
+dnl Copyright (C) 2002-2006, 2009-2024 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_XALLOC], [:])
deleted file mode 120000 (symlink)
index d4267447874071c2919f7fe369696c8eb9130066..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/xattr.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..7f72a81eeab38dd8898fcbbd667f3c67ed99b89b
--- /dev/null
@@ -0,0 +1,53 @@
+# xattr.m4 - check for Extended Attributes (Linux)
+# serial 7
+
+# Copyright (C) 2003-2024 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_FUNC_XATTR],
+[
+  AC_ARG_ENABLE([xattr],
+        AS_HELP_STRING([[--disable-xattr]],
+                       [do not support extended attributes]),
+        [use_xattr=$enableval], [use_xattr=yes])
+
+  LIB_XATTR=
+  AC_SUBST([LIB_XATTR])
+
+  if test "$use_xattr" = yes; then
+    AC_CACHE_CHECK([for xattr library with ATTR_ACTION_PERMISSIONS],
+      [gl_cv_xattr_lib],
+      [gl_cv_xattr_lib=no
+       AC_LANG_CONFTEST(
+         [AC_LANG_PROGRAM(
+            [[#include <attr/error_context.h>
+              #include <attr/libattr.h>
+              static int
+              is_attr_permissions (const char *name, struct error_context *ctx)
+              {
+                return attr_copy_action (name, ctx) == ATTR_ACTION_PERMISSIONS;
+              }
+            ]],
+            [[return attr_copy_fd ("/", 0, "/", 0, is_attr_permissions, 0);
+            ]])])
+       AC_LINK_IFELSE([],
+         [gl_cv_xattr_lib='none required'],
+         [xattr_saved_LIBS=$LIBS
+          LIBS="-lattr $LIBS"
+          AC_LINK_IFELSE([], [gl_cv_xattr_lib=-lattr])
+          LIBS=$xattr_saved_LIBS])])
+    if test "$gl_cv_xattr_lib" = no; then
+      AC_MSG_WARN([libattr development library was not found or not usable.])
+      AC_MSG_WARN([AC_PACKAGE_NAME will be built without xattr support.])
+      use_xattr=no
+    elif test "$gl_cv_xattr_lib" != 'none required'; then
+      LIB_XATTR=$gl_cv_xattr_lib
+    fi
+  fi
+  if test "$use_xattr" = yes; then
+    AC_DEFINE([USE_XATTR], [1],
+      [Define to 1 to use the Linux extended attributes library.])
+  fi
+])
deleted file mode 120000 (symlink)
index b991370989dd4d63940a66ddddbf13622a57d463..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/xgetcwd.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..909bbe80e13ed3e202f3fd315981bdbd95e8e84d
--- /dev/null
@@ -0,0 +1,10 @@
+#serial 8
+dnl Copyright (C) 2002-2006, 2009-2024 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_XGETCWD],
+[
+  :
+])
deleted file mode 120000 (symlink)
index 38f31c1002c453c33a280f68e52fb3b322cc8a76..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/xnanosleep.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..54d296abffb63a97c8722cdf52475a62e97aea67
--- /dev/null
@@ -0,0 +1,12 @@
+#serial 6
+dnl Copyright (C) 2005-2006, 2009-2024 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_XNANOSLEEP],
+[
+  AC_CHECK_FUNCS_ONCE([pause])
+])
deleted file mode 120000 (symlink)
index 1e1c3d342e16b14855b29b28dad28409ac6c71f8..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/xsize.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..6125f9c18f9b1b4657f9fb60cdc367a70f9e2f95
--- /dev/null
@@ -0,0 +1,12 @@
+# xsize.m4 serial 5
+dnl Copyright (C) 2003-2004, 2008-2024 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_XSIZE],
+[
+  dnl Prerequisites of lib/xsize.h.
+  AC_REQUIRE([gl_SIZE_MAX])
+  AC_CHECK_HEADERS([stdint.h])
+])
deleted file mode 120000 (symlink)
index e004556f6be980823cc73243d13db6cb86fe514a..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/xstrtod.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..49bcb29789fd3b82352dce420957424964d414d3
--- /dev/null
@@ -0,0 +1,18 @@
+#serial 8
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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.
+
+# Prerequisites of lib/xstrtod.c.
+AC_DEFUN([gl_XSTRTOD],
+[
+  :
+])
+
+# Prerequisites of lib/xstrtold.c.
+AC_DEFUN([gl_XSTRTOLD],
+[
+  :
+])
deleted file mode 120000 (symlink)
index bf5bd806d3361a5286dace1fa998d2da028aa968..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/xstrtol.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..9a53618967eb50bcec344e77e42c30e42395cb68
--- /dev/null
@@ -0,0 +1,10 @@
+#serial 11
+dnl Copyright (C) 2002-2007, 2009-2024 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_XSTRTOL],
+[
+  :
+])
deleted file mode 120000 (symlink)
index ccebe083c1a6ae464a60295bfebbd613941be548..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/xvasprintf.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..2ed9ad5b2fffc56b1cca7b42fe865ee8c1bd9340
--- /dev/null
@@ -0,0 +1,8 @@
+# xvasprintf.m4 serial 2
+dnl Copyright (C) 2006, 2009-2024 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 Prerequisites of lib/xvasprintf.c.
+AC_DEFUN([gl_XVASPRINTF], [:])
deleted file mode 120000 (symlink)
index 3687a1a8281905a8a02c7c3a22a5e66a368a5b99..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/yesno.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..45b0e7475f29eafe187fc51609bbab60c8c06b3b
--- /dev/null
@@ -0,0 +1,12 @@
+# yesno.m4 serial 6
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation,
+dnl 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_YESNO],
+[
+  dnl No prerequisites of lib/yesno.c.
+  :
+])
deleted file mode 120000 (symlink)
index f46e2229a40258d0220b9f15064896ad7fc55dc3..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/yield.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..cbed8725c20f5e95d97b6628bb667ff67fbf24f9
--- /dev/null
@@ -0,0 +1,18 @@
+# yield.m4 serial 5
+dnl Copyright (C) 2005-2024 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_YIELD],
+[
+  AC_REQUIRE([gl_PTHREADLIB])
+  AC_REQUIRE([gl_THREADLIB])
+
+  if test $gl_threads_api = posix; then
+    YIELD_LIB="$SCHED_YIELD_LIB"
+  else
+    YIELD_LIB=
+  fi
+  AC_SUBST([YIELD_LIB])
+])
deleted file mode 120000 (symlink)
index 3505c73974fc8bece78ee324d6b5a5ac50cb5c64..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/m4/zzgnulib.m4
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..eed5ecbfe1e314fd12ce4e4d6308553dad439440
--- /dev/null
@@ -0,0 +1,23 @@
+# zzgnulib.m4 serial 1
+dnl Copyright (C) 2020-2024 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 This file must be named something that sorts after all other
+dnl package- or gnulib-provided .m4 files - at least for those packages
+dnl that redefine AC_PROG_CC.
+
+dnl Redefine AC_PROG_CC so that it ends with invocations of gl_COMPILER_CLANG
+dnl and gl_COMPILER_PREPARE_CHECK_DECL.
+m4_define([AC_PROG_CC],
+  m4_defn([AC_PROG_CC])[
+gl_COMPILER_CLANG
+gl_COMPILER_PREPARE_CHECK_DECL
+])
+
+# gl_ZZGNULIB
+# -----------
+# Witness macro that this file has been included.  Needed to force
+# Automake to include this file after all other gnulib .m4 files.
+AC_DEFUN([gl_ZZGNULIB])
deleted file mode 120000 (symlink)
index 0ee790076cb1e969e816ed1b0b1057930b8a2a8b..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-/media/develdata/devel/GNULIB/maint-tools/gnulib-tool-tests/gnulib-data/top/maint.mk
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..1b4a2de4f9bc8558a4097db6e26ef3ed93ecdd46
--- /dev/null
+# -*-Makefile-*-
+# This Makefile fragment tries to be general-purpose enough to be
+# used by many projects via the gnulib maintainer-makefile module.
+
+## Copyright (C) 2001-2024 Free Software Foundation, Inc.
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# This is reported not to work with make-3.79.1
+# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
+ME := maint.mk
+
+# These variables ought to be defined through the configure.ac section
+# of the module description. But some packages import this file directly,
+# ignoring the module description.
+AWK ?= awk
+GREP ?= grep
+SED ?= sed
+
+# Helper variables.
+_empty =
+_sp = $(_empty) $(_empty)
+
+# _equal,S1,S2
+# ------------
+# If S1 == S2, return S1, otherwise the empty string.
+_equal = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
+
+# member-check,VARIABLE,VALID-VALUES
+# ----------------------------------
+# Check that $(VARIABLE) is in the space-separated list of VALID-VALUES, and
+# return it.  Die otherwise.
+member-check =                                                         \
+  $(strip                                                              \
+    $(if $($(1)),                                                      \
+      $(if $(findstring $(_sp),$($(1))),                               \
+          $(error invalid $(1): '$($(1))', expected $(2)),             \
+          $(or $(findstring $(_sp)$($(1))$(_sp),$(_sp)$(2)$(_sp)),     \
+            $(error invalid $(1): '$($(1))', expected $(2)))),         \
+      $(error $(1) undefined)))
+
+# Do not save the original name or timestamp in the .tar.gz file.
+# Use --rsyncable if available.
+gzip_rsyncable := \
+  $(shell gzip --help 2>/dev/null|$(GREP) rsyncable >/dev/null \
+    && printf %s --rsyncable)
+GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
+
+GIT = git
+VC = $(GIT)
+
+VC_LIST = $(srcdir)/$(_build-aux)/vc-list-files -C $(srcdir)
+
+# You can override this variable in cfg.mk if your gnulib submodule lives
+# in a different location.
+gnulib_dir ?= $(shell if test -n "$(GNULIB_SRCDIR)" && test -f "$(GNULIB_SRCDIR)/gnulib-tool"; then \
+                       echo "$(GNULIB_SRCDIR)"; \
+               else \
+                       echo $(srcdir)/gnulib; \
+               fi)
+
+# You can override this variable in cfg.mk to set your own regexp
+# matching files to ignore.
+VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
+
+# This is to preprocess robustly the output of $(VC_LIST), so that even
+# when $(srcdir) is a pathological name like "....", the leading sed command
+# removes only the intended prefix.
+_dot_escaped_srcdir = $(subst .,\.,$(srcdir))
+
+# Post-process $(VC_LIST) output, prepending $(srcdir)/, but only
+# when $(srcdir) is not ".".
+ifeq ($(srcdir),.)
+  _prepend_srcdir_prefix =
+else
+  _prepend_srcdir_prefix = | $(SED) 's|^|$(srcdir)/|'
+endif
+
+# In order to be able to consistently filter "."-relative names,
+# (i.e., with no $(srcdir) prefix), this definition is careful to
+# remove any $(srcdir) prefix, and to restore what it removes.
+_sc_excl = \
+  $(or $(exclude_file_name_regexp--$@),^$$)
+VC_LIST_EXCEPT = \
+  $(VC_LIST) | $(SED) 's|^$(_dot_escaped_srcdir)/||' \
+       | if test -f $(srcdir)/.x-$@; then $(GREP) -vEf $(srcdir)/.x-$@; \
+         else $(GREP) -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
+       | $(GREP) -Ev -e '($(VC_LIST_ALWAYS_EXCLUDE_REGEX)|$(_sc_excl))' \
+       $(_prepend_srcdir_prefix)
+
+ifeq ($(origin prev_version_file), undefined)
+  prev_version_file = $(srcdir)/.prev-version
+endif
+
+PREV_VERSION := $(shell cat $(prev_version_file) 2>/dev/null)
+VERSION_REGEXP = $(subst .,\.,$(VERSION))
+PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
+
+ifeq ($(VC),$(GIT))
+  this-vc-tag = v$(VERSION)
+  this-vc-tag-regexp = v$(VERSION_REGEXP)
+else
+  tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
+  tag-this-version = $(subst .,_,$(VERSION))
+  this-vc-tag = $(tag-package)-$(tag-this-version)
+  this-vc-tag-regexp = $(this-vc-tag)
+endif
+my_distdir = $(PACKAGE)-$(VERSION)
+
+# Old releases are stored here.
+release_archive_dir ?= ../release
+
+# If RELEASE_TYPE is undefined, but RELEASE is, use its second word.
+# But overwrite VERSION.
+ifdef RELEASE
+  VERSION := $(word 1, $(RELEASE))
+  RELEASE_TYPE ?= $(word 2, $(RELEASE))
+endif
+
+# Validate and return $(RELEASE_TYPE), or die.
+RELEASE_TYPES = alpha beta stable
+release-type = $(call member-check,RELEASE_TYPE,$(RELEASE_TYPES))
+
+# Override gnu_rel_host and url_dir_list in cfg.mk if these are not right.
+# Use alpha.gnu.org for alpha and beta releases.
+# Use ftp.gnu.org for stable releases.
+gnu_ftp_host-alpha = alpha.gnu.org
+gnu_ftp_host-beta = alpha.gnu.org
+gnu_ftp_host-stable = ftp.gnu.org
+gnu_rel_host ?= $(gnu_ftp_host-$(release-type))
+
+url_dir_list ?= $(if $(call _equal,$(gnu_rel_host),ftp.gnu.org),       \
+                     https://ftpmirror.gnu.org/$(PACKAGE),             \
+                     https://$(gnu_rel_host)/gnu/$(PACKAGE))
+
+# Override this in cfg.mk if you are using a different format in your
+# NEWS file.
+today = $(shell date +%Y-%m-%d)
+
+# Select which lines of NEWS are searched for $(news-check-regexp).
+# This is a sed line number spec.  The default says that we search
+# lines 1..10 of NEWS for $(news-check-regexp).
+# If you want to search only line 3 or only lines 20-22, use "3" or "20,22".
+news-check-lines-spec ?= 1,10
+news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)'
+
+# Prevent programs like 'sort' from considering distinct strings to be equal.
+# Doing it here saves us from having to set LC_ALL elsewhere in this file.
+export LC_ALL = C
+
+## --------------- ##
+## Sanity checks.  ##
+## --------------- ##
+
+ifneq ($(_gl-Makefile),)
+_cfg_mk := $(wildcard $(srcdir)/cfg.mk)
+
+# Collect the names of rules starting with 'sc_'.
+syntax-check-rules := $(sort $(shell env LC_ALL=C $(SED) -n \
+   's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(srcdir)/$(ME) $(_cfg_mk)))
+.PHONY: $(syntax-check-rules)
+
+ifeq ($(shell $(VC_LIST) >/dev/null 2>&1; echo $$?),0)
+  local-checks-available += $(syntax-check-rules)
+else
+  local-checks-available += no-vc-detected
+no-vc-detected:
+       @echo "No version control files detected; skipping syntax check"
+endif
+.PHONY: $(local-checks-available)
+
+# Arrange to prine the name of each syntax-checking rule just before running it.
+$(syntax-check-rules): %: %.m
+sc_m_rules_ = $(patsubst %, %.m, $(syntax-check-rules))
+.PHONY: $(sc_m_rules_)
+$(sc_m_rules_):
+       @echo $(patsubst sc_%.m, %, $@)
+       @date +%s.%N > .sc-start-$(basename $@)
+
+# Compute and print the elapsed time for each syntax-check rule.
+sc_z_rules_ = $(patsubst %, %.z, $(syntax-check-rules))
+.PHONY: $(sc_z_rules_)
+$(sc_z_rules_): %.z: %
+       @end=$$(date +%s.%N);                                           \
+       start=$$(cat .sc-start-$*);                                     \
+       rm -f .sc-start-$*;                                             \
+       $(AWK) -v s=$$start -v e=$$end                                  \
+         'END {printf "%.2f $(patsubst sc_%,%,$*)\n", e - s}' < /dev/null
+
+# The patsubst here is to replace each sc_% rule with its sc_%.z wrapper
+# that computes and prints elapsed time.
+local-check :=                                                         \
+  $(patsubst sc_%, sc_%.z,                                             \
+    $(filter-out $(local-checks-to-skip), $(local-checks-available)))
+
+syntax-check: $(local-check)
+endif
+
+# _sc_search_regexp
+#
+# This macro searches for a given construct in the selected files and
+# then takes some action.
+#
+# Parameters (shell variables):
+#
+#  prohibit | require
+#
+#     Regular expression (ERE) denoting either a forbidden construct
+#     or a required construct.  Those arguments are exclusive.
+#
+#  exclude
+#
+#     Regular expression (ERE) denoting lines to ignore that matched
+#     a prohibit construct.  For example, this can be used to exclude
+#     comments that mention why the nearby code uses an alternative
+#     construct instead of the simpler prohibited construct.
+#
+#  in_vc_files | in_files
+#
+#     grep-E-style regexp selecting the files to check.  For in_vc_files,
+#     the regexp is used to select matching files from the list of all
+#     version-controlled files; for in_files, it's from the names printed
+#     by "find $(srcdir)".  When neither is specified, use all files that
+#     are under version control.
+#
+#  containing | non_containing
+#
+#     Select the files (non) containing strings matching this regexp.
+#     If both arguments are specified then CONTAINING takes
+#     precedence.
+#
+#  with_grep_options
+#
+#     Extra options for grep.
+#
+#  ignore_case
+#
+#     Ignore case.
+#
+#  halt
+#
+#     Message to display before to halting execution.
+#
+# Finally, you may exempt files based on an ERE matching file names.
+# For example, to exempt from the sc_space_tab check all files with the
+# .diff suffix, set this Make variable:
+#
+# exclude_file_name_regexp--sc_space_tab = \.diff$
+#
+# Note that while this functionality is mostly inherited via VC_LIST_EXCEPT,
+# when filtering by name via in_files, we explicitly filter out matching
+# names here as well.
+
+# Initialize each, so that envvar settings cannot interfere.
+export require =
+export prohibit =
+export exclude =
+export in_vc_files =
+export in_files =
+export containing =
+export non_containing =
+export halt =
+export with_grep_options =
+
+# By default, _sc_search_regexp does not ignore case.
+export ignore_case =
+_ignore_case = $$(test -n "$$ignore_case" && printf %s -i || :)
+
+define _sc_say_and_exit
+   dummy=; : so we do not need a semicolon before each use;            \
+   { printf '%s\n' "$(ME): $$msg" 1>&2; exit 1; };
+endef
+
+define _sc_search_regexp
+   dummy=; : so we do not need a semicolon before each use;            \
+                                                                       \
+   : Check arguments;                                                  \
+   test -n "$$prohibit" && test -n "$$require"                         \
+     && { msg='Cannot specify both prohibit and require'               \
+          $(_sc_say_and_exit) } || :;                                  \
+   test -z "$$prohibit" && test -z "$$require"                         \
+     && { msg='Should specify either prohibit or require'              \
+          $(_sc_say_and_exit) } || :;                                  \
+   test -z "$$prohibit" && test -n "$$exclude"                         \
+     && { msg='Use of exclude requires a prohibit pattern'             \
+          $(_sc_say_and_exit) } || :;                                  \
+   test -n "$$in_vc_files" && test -n "$$in_files"                     \
+     && { msg='Cannot specify both in_vc_files and in_files'           \
+          $(_sc_say_and_exit) } || :;                                  \
+   test "x$$halt" != x                                                 \
+     || { msg='halt not defined' $(_sc_say_and_exit) };                        \
+                                                                       \
+   : Filter by file name;                                              \
+   if test -n "$$in_files"; then                                       \
+     files=$$(find $(srcdir) | $(GREP) -E "$$in_files"                 \
+              | $(GREP) -Ev '$(_sc_excl)');                            \
+   else                                                                        \
+     files=$$($(VC_LIST_EXCEPT));                                      \
+     if test -n "$$in_vc_files"; then                                  \
+       files=$$(echo "$$files" | $(GREP) -E "$$in_vc_files");          \
+     fi;                                                               \
+   fi;                                                                 \
+                                                                       \
+   : Filter by content;                                                        \
+   test -n "$$files"                                                   \
+     && test -n "$$containing"                                         \
+     && { files=$$(echo "$$files" | xargs $(GREP) -l "$$containing"); }        \
+     || :;                                                             \
+   test -n "$$files"                                                   \
+     && test -n "$$non_containing"                                     \
+     && { files=$$(echo "$$files" | xargs $(GREP) -vl "$$non_containing"); } \
+     || :;                                                             \
+                                                                       \
+   : Check for the construct;                                          \
+   if test -n "$$files"; then                                          \
+     if test -n "$$prohibit"; then                                     \
+       echo "$$files"                                                  \
+         | xargs $(GREP) $$with_grep_options $(_ignore_case) -nE       \
+               "$$prohibit" /dev/null                                  \
+         | $(GREP) -vE "$${exclude:-^$$}"                              \
+         && { msg="$$halt" $(_sc_say_and_exit) }                       \
+         || :;                                                         \
+     else                                                              \
+       echo "$$files"                                                  \
+         | xargs                                                       \
+             $(GREP) $$with_grep_options $(_ignore_case) -LE "$$require" \
+         | $(GREP) .                                                   \
+         && { msg="$$halt" $(_sc_say_and_exit) }                       \
+         || :;                                                         \
+     fi                                                                        \
+   else :;                                                             \
+   fi || :;
+endef
+
+sc_avoid_if_before_free:
+       @$(VC_LIST_EXCEPT)                                              \
+         | $(GREP) -v useless-if-before-free                           \
+         | xargs                                                       \
+             $(srcdir)/$(_build-aux)/useless-if-before-free            \
+             $(useless_free_options)                                   \
+         && { printf '$(ME): found useless "if"'                       \
+                     ' before "free" above\n' 1>&2;                    \
+              exit 1; }                                                \
+         || :
+
+sc_cast_of_argument_to_free:
+       @prohibit='\<free *\( *\(' halt="don't cast free argument"      \
+         $(_sc_search_regexp)
+
+sc_cast_of_x_alloc_return_value:
+       @prohibit='\*\) *x(m|c|re)alloc\>'                              \
+       halt="don't cast x*alloc return value"                          \
+         $(_sc_search_regexp)
+
+sc_cast_of_alloca_return_value:
+       @prohibit='\*\) *alloca\>'                                      \
+       halt="don't cast alloca return value"                           \
+         $(_sc_search_regexp)
+
+sc_space_tab:
+       @prohibit='[ ]  '                                               \
+       halt='found SPACE-TAB sequence; remove the SPACE'               \
+         $(_sc_search_regexp)
+
+# Don't use *scanf or the old ato* functions in "real" code.
+# They provide no error checking mechanism.
+# Instead, use strto* functions.
+sc_prohibit_atoi_atof:
+       @prohibit='\<([fs]?scanf|ato([filq]|ll)) *\('                           \
+       halt='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q'   \
+         $(_sc_search_regexp)
+
+# Use STREQ rather than comparing strcmp == 0, or != 0.
+sp_ = strcmp *\(.+\)
+sc_prohibit_strcmp:
+       @prohibit='! *strcmp *\(|\<$(sp_) *[!=]=|[!=]= *$(sp_)'         \
+       exclude='# *define STRN?EQ\('                                   \
+       halt='replace strcmp calls above with STREQ/STRNEQ'             \
+         $(_sc_search_regexp)
+
+# Really.  You don't want to use this function.
+# It may fail to NUL-terminate the destination,
+# and always NUL-pads out to the specified length.
+sc_prohibit_strncpy:
+       @prohibit='\<strncpy *\('                                       \
+       halt='do not use strncpy, period'                               \
+         $(_sc_search_regexp)
+
+# Pass EXIT_*, not number, to usage, exit, and error (when exiting)
+# Convert all uses automatically, via these two commands:
+# git grep -l '\<exit *(1)' \
+#  | grep -vEf .x-sc_prohibit_magic_number_exit \
+#  | xargs --no-run-if-empty \
+#      perl -pi -e 's/(^|[^.])\b(exit ?)\(1\)/$1$2(EXIT_FAILURE)/'
+# git grep -l '\<exit *(0)' \
+#  | grep -vEf .x-sc_prohibit_magic_number_exit \
+#  | xargs --no-run-if-empty \
+#      perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/'
+sc_prohibit_magic_number_exit:
+       @prohibit='(^|[^.])\<(usage|exit|error) ?\(-?[0-9]+[,)]'        \
+       exclude='exit \(77\)|error ?\(((0|77),|[^,]*)'                  \
+       halt='use EXIT_* values rather than magic number'               \
+         $(_sc_search_regexp)
+
+# Check that we don't use $< in non-implicit Makefile rules.
+#
+# To find the Makefiles, trace AC_CONFIG_FILES.  Using VC_LIST would
+# miss the Makefiles that are not under VC control (e.g., symlinks
+# installed for gettext).  "Parsing" (recursive) uses of SUBDIRS seems
+# too delicate.
+#
+# Use GNU Make's --print-data-base to normalize the rules into some
+# easy to parse format: they are separated by two \n.  Look for the
+# "section" about non-pattern rules (marked with "# Files") inside
+# which there are still the POSIX Make like implicit rules (".c.o").
+sc_prohibit_gnu_make_extensions_awk_ =                                 \
+  BEGIN {                                                              \
+      RS = "\n\n";                                                     \
+      in_rules = 0;                                                    \
+  }                                                                    \
+  /^\# Files/ {                                                                \
+      in_rules = 1;                                                    \
+  }                                                                    \
+  /\$$</ && in_rules && $$0 !~ /^(.*\n)*\.\w+(\.\w+)?:/ {              \
+      print "Error: " file ": $$< in a non implicit rule\n" $$0;       \
+      status = 1;                                                      \
+  }                                                                    \
+  END {                                                                        \
+     exit status;                                                      \
+  }
+sc_prohibit_gnu_make_extensions:
+       @if $(AWK) --version | grep GNU >/dev/null 2>&1; then           \
+         (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |    \
+           tr ' ' '\n' |                                               \
+           $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |                    \
+           while read m; do                                            \
+             $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |            \
+               $(AWK) -v file=$$m -e '$($@_awk_)' || exit 1;           \
+           done;                                                       \
+       fi
+
+# Using EXIT_SUCCESS as the first argument to error is misleading,
+# since when that parameter is 0, error does not exit.  Use '0' instead.
+sc_error_exit_success:
+       @prohibit='error *\(EXIT_SUCCESS,'                              \
+       in_vc_files='\.[chly]$$'                                        \
+       halt='found error (EXIT_SUCCESS'                                \
+        $(_sc_search_regexp)
+
+# "FATAL:" should be fully upper-cased in error messages
+# "WARNING:" should be fully upper-cased, or fully lower-cased
+sc_error_message_warn_fatal:
+       @$(VC_LIST_EXCEPT)                                              \
+         | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null              \
+         | $(GREP) -E '"Warning|"Fatal|"fatal'                         \
+         && { echo '$(ME): use FATAL, WARNING or warning' 1>&2;        \
+              exit 1; }                                                \
+         || :
+
+# Error messages should not start with a capital letter
+sc_error_message_uppercase:
+       @$(VC_LIST_EXCEPT)                                              \
+         | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null              \
+         | $(GREP) -E '"[A-Z]'                                         \
+         | $(GREP) -vE '"FATAL|"WARNING|"Java|"C#|"PRI'                \
+         && { echo '$(ME): found capitalized error message' 1>&2;      \
+              exit 1; }                                                \
+         || :
+
+# Error messages should not end with a period
+sc_error_message_period:
+       @$(VC_LIST_EXCEPT)                                              \
+         | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null              \
+         | $(GREP) -E '[^."]\."'                                       \
+         && { echo '$(ME): found error message ending in period' 1>&2; \
+              exit 1; }                                                \
+         || :
+
+sc_file_system:
+       @prohibit=file''system                                          \
+       exclude='/proc/filesystems'                                     \
+       ignore_case=1                                                   \
+       halt='found use of "file''system"; spell it "file system"'      \
+         $(_sc_search_regexp)
+
+# Don't use cpp tests of this symbol.  All code assumes config.h is included.
+sc_prohibit_have_config_h:
+       @prohibit='^# *if.*HAVE''_CONFIG_H'                             \
+       halt='found use of HAVE''_CONFIG_H; remove'                     \
+         $(_sc_search_regexp)
+
+# Nearly all .c files must include <config.h>.  However, we also permit this
+# via inclusion of a package-specific header, if cfg.mk specified one.
+# config_h_header must be suitable for grep -E.
+config_h_header ?= <config\.h>
+sc_require_config_h:
+       @require='^# *include $(config_h_header)'                       \
+       in_vc_files='\.c$$'                                             \
+       halt='the above files do not include <config.h>'                \
+         $(_sc_search_regexp)
+
+# Print each file name for which the first #include does not match
+# $(config_h_header).  Like grep -m 1, this only looks at the first match.
+perl_config_h_first_ =                                                 \
+  -e 'BEGIN {$$ret = 0}'                                               \
+  -e 'if (/^\# *include\b/) {'                                         \
+  -e '  if (not m{^\# *include $(config_h_header)}) {'                 \
+  -e '    print "$$ARGV\n";'                                           \
+  -e '    $$ret = 1;'                                                  \
+  -e '  }'                                                             \
+  -e '  \# Move on to next file after first include'                   \
+  -e '  close ARGV;'                                                   \
+  -e '}'                                                               \
+  -e 'END {exit $$ret}'
+
+# You must include <config.h> before including any other header file.
+# This can possibly be via a package-specific header, if given by cfg.mk.
+sc_require_config_h_first:
+       @if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then       \
+         files=$$($(VC_LIST_EXCEPT) | $(GREP) '\.c$$') &&              \
+         perl -n $(perl_config_h_first_) $$files ||                    \
+           { echo '$(ME): the above files include some other header'   \
+               'before <config.h>' 1>&2; exit 1; } || :;               \
+       else :;                                                         \
+       fi
+
+sc_prohibit_HAVE_MBRTOWC:
+       @prohibit='\bHAVE_MBRTOWC\b'                                    \
+       halt="do not use $$prohibit; it is always defined"              \
+         $(_sc_search_regexp)
+
+# To use this "command" macro, you must first define two shell variables:
+# h: the header name, with no enclosing <> or ""
+# re: a regular expression that matches IFF something provided by $h is used.
+define _sc_header_without_use
+  dummy=; : so we do not need a semicolon before each use;             \
+  h_esc=`echo '[<"]'"$$h"'[">]'|$(SED) 's/\./\\\\./g'`;                        \
+  if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then             \
+    files=$$($(GREP) -l '^# *include '"$$h_esc"                                \
+            $$($(VC_LIST_EXCEPT) | $(GREP) '\.c$$')) &&                \
+    $(GREP) -LE "$$re" $$files | $(GREP) . &&                          \
+      { echo "$(ME): the above files include $$h but don't use it"     \
+       1>&2; exit 1; } || :;                                           \
+  else :;                                                              \
+  fi
+endef
+
+# Prohibit the inclusion of assert.h without an actual use of assert.
+sc_prohibit_assert_without_use:
+       @h='assert.h' re='\<assert *\(' $(_sc_header_without_use)
+
+# Prohibit the inclusion of close-stream.h without an actual use.
+sc_prohibit_close_stream_without_use:
+       @h='close-stream.h' re='\<close_stream *\(' $(_sc_header_without_use)
+
+# Prohibit the inclusion of getopt.h without an actual use.
+sc_prohibit_getopt_without_use:
+       @h='getopt.h' re='\<getopt(_long)? *\(' $(_sc_header_without_use)
+
+# Don't include quotearg.h unless you use one of its functions.
+sc_prohibit_quotearg_without_use:
+       @h='quotearg.h' re='\<quotearg(_[^ ]+)? *\(' $(_sc_header_without_use)
+
+# Don't include quote.h unless you use one of its functions.
+sc_prohibit_quote_without_use:
+       @h='quote.h' re='\<quote((_n)? *\(|_quoting_options\>)' \
+         $(_sc_header_without_use)
+
+# Don't include this header unless you use one of its functions.
+sc_prohibit_long_options_without_use:
+       @h='long-options.h' re='\<parse_(long_options|gnu_standard_options_only) *\(' \
+         $(_sc_header_without_use)
+
+# Don't include this header unless you use one of its functions.
+sc_prohibit_inttostr_without_use:
+       @h='inttostr.h' re='\<(off|[iu]max|uint)tostr *\(' \
+         $(_sc_header_without_use)
+
+# Don't include this header unless you use one of its functions.
+sc_prohibit_ignore_value_without_use:
+       @h='ignore-value.h' re='\<ignore_(value|ptr) *\(' \
+         $(_sc_header_without_use)
+
+# Don't include this header unless you use one of its functions.
+sc_prohibit_error_without_use:
+       @h='error.h' \
+       re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
+         $(_sc_header_without_use)
+
+# Don't include xalloc.h unless you use one of its symbols.
+# Consider these symbols:
+# perl -lne '/^# *define (\w+)\(/ and print $1' lib/xalloc.h|grep -v '^__';
+# perl -lne 'm{^(?:_Noreturn )?(?:void|char) \*?(\w+) *\(} and print $1' lib/xalloc.h
+# Divide into two sets on case, and filter each through this:
+# | sort | perl -MRegexp::Assemble -le \
+#  'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 's/\?://g'
+_xa1 = x(i(m(emdup0?|alloc)|realloc(array)?|([cz]|nm)alloc)|([pz]|c(har)?|2n?re|nm)alloc|realloc(array)?|m(alloc|emdup)|alloc_die|strdup)
+_xa2 = X([CZ]|N?M)ALLOC
+sc_prohibit_xalloc_without_use:
+       @h='xalloc.h' \
+       re='\<($(_xa1)|$(_xa2)) *\('\
+         $(_sc_header_without_use)
+
+# Extract function names:
+# perl -lne '/^(?:extern )?(?:void|char|Hash_table) \*?(\w+) *\(/ and print $1' lib/hash.h
+_hash_re = \
+hash_(re(set_tuning|move)|xin(itialize|sert)|in(itialize|sert)|get_(firs|nex)t|print_statistics|(delet|fre)e|lookup|clear)
+_hash_fn = \<($(_hash_re)) *\(
+_hash_struct = (struct )?\<[Hh]ash_(table|tuning)\>
+sc_prohibit_hash_without_use:
+       @h='hash.h' \
+       re='$(_hash_fn)|$(_hash_struct)'\
+         $(_sc_header_without_use)
+
+sc_prohibit_cloexec_without_use:
+       @h='cloexec.h' re='\<(set_cloexec_flag|dup_cloexec) *\(' \
+         $(_sc_header_without_use)
+
+sc_prohibit_posixver_without_use:
+       @h='posixver.h' re='\<posix2_version *\(' $(_sc_header_without_use)
+
+sc_prohibit_same_without_use:
+       @h='same.h' re='\<same_name(at)? *\(' $(_sc_header_without_use)
+
+sc_prohibit_hash_pjw_without_use:
+       @h='hash-pjw.h' \
+       re='\<hash_pjw\>' \
+         $(_sc_header_without_use)
+
+sc_prohibit_safe_read_without_use:
+       @h='safe-read.h' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
+         $(_sc_header_without_use)
+
+sc_prohibit_argmatch_without_use:
+       @h='argmatch.h' \
+       re='(\<(ARGMATCH_DEFINE_GROUP|ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<(invalid_arg|argmatch(_exit_fn|_(in)?valid)?) *\()' \
+         $(_sc_header_without_use)
+
+sc_prohibit_canonicalize_without_use:
+       @h='canonicalize.h' \
+       re='CAN_(EXISTING|ALL_BUT_LAST|MISSING)|canonicalize_(mode_t|filename_mode|file_name)' \
+         $(_sc_header_without_use)
+
+sc_prohibit_root_dev_ino_without_use:
+       @h='root-dev-ino.h' \
+       re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
+         $(_sc_header_without_use)
+
+sc_prohibit_openat_without_use:
+       @h='openat.h' \
+       re='\<(openat_(permissive|needs_fchdir|(save|restore)_fail)|l?(stat|ch(own|mod))at|(euid)?accessat|(FCHMOD|FCHOWN|STAT)AT_INLINE)\>' \
+         $(_sc_header_without_use)
+
+# Prohibit the inclusion of c-ctype.h without an actual use.
+ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
+|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
+sc_prohibit_c_ctype_without_use:
+       @h='c-ctype.h' re='\<c_($(ctype_re)) *\(' \
+         $(_sc_header_without_use)
+
+# The following list was generated by running:
+# man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \
+#   | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt
+_sig_functions = \
+  bsd_signal kill killpg pthread_kill pthread_sigmask raise sigaction \
+  sigaddset sigaltstack sigdelset sigemptyset sigfillset sighold sigignore \
+  siginterrupt sigismember signal sigpause sigpending sigprocmask sigqueue \
+  sigrelse sigset sigsuspend sigtimedwait sigwait sigwaitinfo
+_sig_function_re = $(subst $(_sp),|,$(strip $(_sig_functions)))
+# The following were extracted from "man signal.h" manually.
+_sig_types_and_consts =                                                        \
+  MINSIGSTKSZ SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK          \
+  SA_RESETHAND SA_RESTART SA_SIGINFO SIGEV_NONE SIGEV_SIGNAL           \
+  SIGEV_THREAD SIGSTKSZ SIG_BLOCK SIG_SETMASK SIG_UNBLOCK SS_DISABLE   \
+  SS_ONSTACK mcontext_t pid_t sig_atomic_t sigevent siginfo_t sigset_t \
+  sigstack sigval stack_t ucontext_t
+# generated via this:
+# perl -lne '/^#ifdef (SIG\w+)/ and print $1' lib/sig2str.c|sort -u|fmt -70
+_sig_names =                                                           \
+  SIGABRT SIGALRM SIGALRM1 SIGBUS SIGCANCEL SIGCHLD SIGCLD SIGCONT     \
+  SIGDANGER SIGDIL SIGEMT SIGFPE SIGFREEZE SIGGRANT SIGHUP SIGILL      \
+  SIGINFO SIGINT SIGIO SIGIOT SIGKAP SIGKILL SIGKILLTHR SIGLOST SIGLWP \
+  SIGMIGRATE SIGMSG SIGPHONE SIGPIPE SIGPOLL SIGPRE SIGPROF SIGPWR     \
+  SIGQUIT SIGRETRACT SIGSAK SIGSEGV SIGSOUND SIGSTKFLT SIGSTOP SIGSYS  \
+  SIGTERM SIGTHAW SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR1       \
+  SIGUSR2 SIGVIRT SIGVTALRM SIGWAITING SIGWINCH SIGWIND SIGWINDOW      \
+  SIGXCPU SIGXFSZ
+_sig_syms_re = $(subst $(_sp),|,$(strip $(_sig_names) $(_sig_types_and_consts)))
+
+# Prohibit the inclusion of signal.h without an actual use.
+sc_prohibit_signal_without_use:
+       @h='signal.h'                                                   \
+       re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>'          \
+         $(_sc_header_without_use)
+
+# Don't include stdio--.h unless you use one of its functions.
+sc_prohibit_stdio--_without_use:
+       @h='stdio--.h' re='\<((f(re)?|p)open|tmpfile) *\('              \
+         $(_sc_header_without_use)
+
+# Don't include stdio-safer.h unless you use one of its functions.
+sc_prohibit_stdio-safer_without_use:
+       @h='stdio-safer.h' re='\<((f(re)?|p)open|tmpfile)_safer *\('    \
+         $(_sc_header_without_use)
+
+# Prohibit the inclusion of strings.h without a sensible use.
+# Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible.
+sc_prohibit_strings_without_use:
+       @h='strings.h'                                                  \
+       re='\<(strn?casecmp|ffs(ll)?)\>'                                \
+         $(_sc_header_without_use)
+
+# Extract the raw list of symbol names with this:
+gl_extract_define_simple = \
+  /^\# *define ([A-Z]\w+)\(/ and print $$1
+# Filter out duplicates and convert to a space-separated list:
+_intprops_names = \
+  $(shell f=$(gnulib_dir)/lib/intprops.h;                              \
+    perl -lne '$(gl_extract_define_simple)' $$f | sort -u | tr '\n' ' ')
+# Remove trailing space and convert to a regular expression:
+_intprops_syms_re = $(subst $(_sp),|,$(strip $(_intprops_names)))
+# Prohibit the inclusion of intprops.h without an actual use.
+sc_prohibit_intprops_without_use:
+       @h='intprops.h'                                                 \
+       re='\<($(_intprops_syms_re)) *\('                               \
+         $(_sc_header_without_use)
+
+_stddef_syms_re = \
+  NULL|max_align_t|nullptr_t|offsetof|ptrdiff_t|size_t|unreachable|wchar_t
+# Prohibit the inclusion of stddef.h without an actual use.
+sc_prohibit_stddef_without_use:
+       @h='stddef.h'                                                   \
+       re='\<($(_stddef_syms_re))\>'                                   \
+         $(_sc_header_without_use)
+
+_de1 = dirfd|(close|(fd)?open|read|rewind|seek|tell)dir(64)?(_r)?
+_de2 = (versionsort|struct dirent|getdirentries|alphasort|scandir(at)?)(64)?
+_de3 = MAXNAMLEN|DIR|ino_t|d_ino|d_fileno|d_namlen
+_dirent_syms_re = $(_de1)|$(_de2)|$(_de3)
+# Prohibit the inclusion of dirent.h without an actual use.
+sc_prohibit_dirent_without_use:
+       @h='dirent.h'                                                   \
+       re='\<($(_dirent_syms_re))\>'                                   \
+         $(_sc_header_without_use)
+
+# Prohibit the inclusion of verify.h without an actual use.
+sc_prohibit_verify_without_use:
+       @h='verify.h'                                                   \
+       re='\<(verify(_expr)?|assume) *\('                              \
+         $(_sc_header_without_use)
+
+# Don't include xfreopen.h unless you use one of its functions.
+sc_prohibit_xfreopen_without_use:
+       @h='xfreopen.h' re='\<xfreopen *\(' $(_sc_header_without_use)
+
+sc_obsolete_symbols:
+       @prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>'                     \
+       halt='do not use HAVE''_FCNTL_H or O'_NDELAY                    \
+         $(_sc_search_regexp)
+
+# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
+
+# Each nonempty ChangeLog line must start with a year number, or a TAB.
+sc_changelog:
+       @prohibit='^[^12        ]'                                      \
+       in_vc_files='^ChangeLog$$'                                      \
+       halt='found unexpected prefix in a ChangeLog'                   \
+         $(_sc_search_regexp)
+
+# Ensure that each .c file containing a "main" function also
+# calls bindtextdomain.
+sc_bindtextdomain:
+       @require='bindtextdomain *\('                                   \
+       in_vc_files='\.c$$'                                             \
+       containing='\<main *('                                          \
+       halt='the above files do not call bindtextdomain'               \
+         $(_sc_search_regexp)
+
+# Require that the final line of each test-lib.sh-using test be this one:
+# Exit $fail
+# Note: this test requires GNU grep's --label= option.
+Exit_witness_file ?= tests/test-lib.sh
+Exit_base := $(notdir $(Exit_witness_file))
+sc_require_test_exit_idiom:
+       @if test -f $(srcdir)/$(Exit_witness_file); then                \
+         die=0;                                                        \
+         for i in $$($(GREP) -l -F 'srcdir/$(Exit_base)'               \
+               $$($(VC_LIST) tests)); do                               \
+           tail -n1 $$i | $(GREP) '^Exit .' > /dev/null                \
+             && : || { die=1; echo $$i; }                              \
+         done;                                                         \
+         test $$die = 1 &&                                             \
+           { echo 1>&2 '$(ME): the final line in each of the above is not:'; \
+             echo 1>&2 'Exit something';                               \
+             exit 1; } || :;                                           \
+       fi
+
+sc_trailing_blank:
+       @prohibit='[     ]$$'                                           \
+       halt='found trailing blank(s)'                                  \
+       exclude='^Binary file .* matches$$'                             \
+         $(_sc_search_regexp)
+
+# Match lines like the following, but where there is only one space
+# between the options and the description:
+#   -D, --all-repeated[=delimit-method]  print all duplicate lines\n
+longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*]?)?
+sc_two_space_separator_in_usage:
+       @prohibit='^   *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$'         \
+       halt='help2man requires at least two spaces between an option and its description'\
+         $(_sc_search_regexp)
+
+# A regexp matching function names like "error" that may be used
+# to emit translatable messages.
+_gl_translatable_diag_func_re ?= error
+
+# Look for diagnostics that aren't marked for translation.
+# This won't find any for which error's format string is on a separate line.
+sc_unmarked_diagnostics:
+       @prohibit='\<$(_gl_translatable_diag_func_re) *\([^"]*"[^"]*[a-z]{3}' \
+       exclude='(_|ngettext ?)\('                                      \
+       halt='found unmarked diagnostic(s)'                             \
+         $(_sc_search_regexp)
+
+# Avoid useless parentheses like those in this example:
+# #if defined (SYMBOL) || defined (SYM2)
+sc_useless_cpp_parens:
+       @prohibit='^# *if .*defined *\('                                \
+       halt='found useless parentheses in cpp directive'               \
+         $(_sc_search_regexp)
+
+# List headers for which HAVE_HEADER_H is always true, assuming you are
+# using the appropriate gnulib module.  CAUTION: for each "unnecessary"
+# #if HAVE_HEADER_H that you remove, be sure that your project explicitly
+# requires the gnulib module that guarantees the usability of that header.
+gl_assured_headers_ = \
+  cd $(gnulib_dir)/lib && echo *.in.h|$(SED) 's/\.in\.h//g'
+
+# Convert the list of names to upper case, and replace each space with "|".
+az_ = abcdefghijklmnopqrstuvwxyz
+AZ_ = ABCDEFGHIJKLMNOPQRSTUVWXYZ
+gl_header_upper_case_or_ =                                             \
+  $$($(gl_assured_headers_)                                            \
+    | tr $(az_)/.- $(AZ_)___                                           \
+    | tr -s ' ' '|'                                                    \
+    )
+sc_prohibit_always_true_header_tests:
+       @or=$(gl_header_upper_case_or_);                                \
+       re="HAVE_($$or)_H";                                             \
+       prohibit='\<'"$$re"'\>'                                         \
+       halt=$$(printf '%s\n'                                           \
+       'do not test the above HAVE_<header>_H symbol(s);'              \
+       '  with the corresponding gnulib module, they are always true') \
+         $(_sc_search_regexp)
+
+sc_prohibit_defined_have_decl_tests:
+       @prohibit='(#[   ]*ifn?def|\<defined)\>[         (]+HAVE_DECL_' \
+       halt='HAVE_DECL macros are always defined'                      \
+         $(_sc_search_regexp)
+
+# ==================================================================
+gl_other_headers_ ?= \
+  intprops.h   \
+  openat.h     \
+  stat-macros.h
+
+# Perl -lne code to extract "significant" cpp-defined symbols from a
+# gnulib header file, eliminating a few common false-positives.
+# The exempted names below are defined only conditionally in gnulib,
+# and hence sometimes must/may be defined in application code.
+gl_extract_significant_defines_ = \
+  /^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/\
+    && $$2 !~ /(?:rpl_|_used_without_)/\
+    && $$1 !~ /^(?:NSIG|ENODATA)$$/\
+    && $$1 !~ /^(?:SA_RESETHAND|SA_RESTART)$$/\
+    and print $$1
+
+# Create a list of regular expressions matching the names
+# of macros that are guaranteed to be defined by parts of gnulib.
+define def_sym_regex
+       gen_h=$(gl_generated_headers_);                                 \
+       (cd $(gnulib_dir)/lib;                                          \
+         for f in *.in.h $(gl_other_headers_); do                      \
+           test -f $$f                                                 \
+             && perl -lne '$(gl_extract_significant_defines_)' $$f;    \
+         done;                                                         \
+       ) | sort -u                                                     \
+         | $(SED) 's/^/^ *# *(define|undef)  */;s/$$/\\>/'
+endef
+
+# Don't define macros that we already get from gnulib header files.
+sc_prohibit_always-defined_macros:
+       @if test -d $(gnulib_dir); then                                 \
+         case $$(echo all: | $(GREP) -l -f - Makefile) in Makefile);; *) \
+           echo '$(ME): skipping $@: you lack GNU grep' 1>&2; exit 0;; \
+         esac;                                                         \
+         regex=$$($(def_sym_regex)); export regex;                     \
+         $(VC_LIST_EXCEPT)                                             \
+           | xargs sh -c 'echo $$regex | $(GREP) -E -f - "$$@"'        \
+               dummy /dev/null                                         \
+           && { printf '$(ME): define the above'                       \
+                       ' via some gnulib .h file\n' 1>&2;              \
+                exit 1; }                                              \
+           || :;                                                       \
+       fi
+# ==================================================================
+
+# Prohibit checked in backup files.
+sc_prohibit_backup_files:
+       @$(VC_LIST) | $(GREP) '~$$' &&                                  \
+         { echo '$(ME): found version controlled backup file' 1>&2;    \
+           exit 1; } || :
+
+# Require the latest GPL.
+sc_GPL_version:
+       @prohibit='either ''version [^3]'                               \
+       halt='GPL vN, N!=3'                                             \
+         $(_sc_search_regexp)
+
+# Require the latest GFDL.  Two regexp, since some .texi files end up
+# line wrapping between 'Free Documentation License,' and 'Version'.
+_GFDL_regexp = (Free ''Documentation.*Version 1\.[^3]|Version 1\.[^3] or any)
+sc_GFDL_version:
+       @prohibit='$(_GFDL_regexp)'                                     \
+       halt='GFDL vN, N!=3'                                            \
+         $(_sc_search_regexp)
+
+# Don't use Texinfo's @acronym{}.
+# https://lists.gnu.org/r/bug-gnulib/2010-03/msg00321.html
+texinfo_suffix_re_ ?= \.(txi|texi(nfo)?)$$
+sc_texinfo_acronym:
+       @prohibit='@acronym\{'                                          \
+       in_vc_files='$(texinfo_suffix_re_)'                             \
+       halt='found use of Texinfo @acronym{}'                          \
+         $(_sc_search_regexp)
+
+cvs_keywords = \
+  Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
+
+sc_prohibit_cvs_keyword:
+       @prohibit='\$$($(cvs_keywords))\$$'                             \
+       halt='do not use CVS keyword expansion'                         \
+         $(_sc_search_regexp)
+
+# This Perl code is slightly obfuscated.  Not only is each "$" doubled
+# because it's in a Makefile, but the $$c's are comments;  we cannot
+# use "#" due to the way the script ends up concatenated onto one line.
+# It would be much more concise, and would produce better output (including
+# counts) if written as:
+#   perl -ln -0777 -e '/\n(\n+)$/ and print "$ARGV: ".length $1' ...
+# but that would be far less efficient, reading the entire contents
+# of each file, rather than just the last two bytes of each.
+# In addition, while the code below detects both blank lines and a missing
+# newline at EOF, the above detects only the former.
+#
+# This is a perl script that is expected to be the single-quoted argument
+# to a command-line "-le".  The remaining arguments are file names.
+# Print the name of each file that does not end in exactly one newline byte.
+# I.e., warn if there are blank lines (2 or more newlines), or if the
+# last byte is not a newline.  However, currently we don't complain
+# about any file that contains exactly one byte.
+# Exit nonzero if at least one such file is found, otherwise, exit 0.
+# Warn about, but otherwise ignore open failure.  Ignore seek/read failure.
+#
+# Use this if you want to remove trailing empty lines from selected files:
+#   perl -pi -0777 -e 's/\n\n+$/\n/' files...
+#
+require_exactly_one_NL_at_EOF_ =                                       \
+  foreach my $$f (@ARGV)                                               \
+    {                                                                  \
+      open F, "<", $$f or (warn "failed to open $$f: $$!\n"), next;    \
+      my $$p = sysseek (F, -2, 2);                                     \
+      my $$c = "seek failure probably means file has < 2 bytes; ignore"; \
+      my $$last_two_bytes;                                             \
+      defined $$p and $$p = sysread F, $$last_two_bytes, 2;            \
+      close F;                                                         \
+      $$c = "ignore read failure";                                     \
+      $$p && ($$last_two_bytes eq "\n\n"                               \
+              || substr ($$last_two_bytes,1) ne "\n")                  \
+          and (print $$f), $$fail=1;                                   \
+    }                                                                  \
+  END { exit defined $$fail }
+sc_prohibit_empty_lines_at_EOF:
+       @$(VC_LIST_EXCEPT)                                              \
+         | xargs perl -le '$(require_exactly_one_NL_at_EOF_)'          \
+         || { echo '$(ME): empty line(s) or no newline at EOF' 1>&2;   \
+              exit 1; }                                                \
+         || :
+
+# Make sure we don't use st_blocks.  Use ST_NBLOCKS or STP_NBLOCKS instead.
+# This is a bit of a kludge, since it prevents use of the string
+# even in comments, but for now it does the job with no false positives.
+sc_prohibit_stat_st_blocks:
+       @prohibit='[.>]st_blocks'                                       \
+       halt='do not use st_blocks; use ST_NBLOCKS or STP_NBLOCKS'      \
+         $(_sc_search_regexp)
+
+# Make sure we don't define any S_IS* macros in src/*.c files.
+# They're already defined via gnulib's sys/stat.h replacement.
+sc_prohibit_S_IS_definition:
+       @prohibit='^ *# *define  *S_IS'                                 \
+       halt='do not define S_IS* macros; include <sys/stat.h>'         \
+         $(_sc_search_regexp)
+
+# Perl block to convert a match to FILE_NAME:LINENO:TEST,
+# that is shared by two definitions below.
+perl_filename_lineno_text_ =                                           \
+    -e '  {'                                                           \
+    -e '    $$n = ($$` =~ tr/\n/\n/ + 1);'                             \
+    -e '    ($$v = $$&) =~ s/\n/\\n/g;'                                        \
+    -e '    print "$$ARGV:$$n:$$v\n";'                                 \
+    -e '  }'
+
+prohibit_doubled_words_ = \
+    the then in an on if is it but for or at and do to can
+# expand the regex before running the check to avoid using expensive captures
+prohibit_doubled_word_expanded_ = \
+    $(join $(prohibit_doubled_words_),$(addprefix \s+,$(prohibit_doubled_words_)))
+prohibit_doubled_word_RE_ ?= \
+    /\b(?:$(subst $(_sp),|,$(prohibit_doubled_word_expanded_)))\b/gims
+prohibit_doubled_word_ =                                               \
+    -e 'while ($(prohibit_doubled_word_RE_))'                          \
+    $(perl_filename_lineno_text_)
+
+# Define this to a regular expression that matches
+# any filename:dd:match lines you want to ignore.
+# The default is to ignore no matches.
+ignore_doubled_word_match_RE_ ?= ^$$
+
+sc_prohibit_doubled_word:
+       @$(VC_LIST_EXCEPT)                                              \
+         | xargs perl -n -0777 $(prohibit_doubled_word_)               \
+         | $(GREP) -vE '$(ignore_doubled_word_match_RE_)'              \
+         | $(GREP) .                                                   \
+         && { echo '$(ME): doubled words' 1>&2; exit 1; }              \
+         || :
+
+# A regular expression matching undesirable combinations of words like
+# "can not"; this matches them even when the two words appear on different
+# lines, but not when there is an intervening delimiter like "#" or "*".
+# Similarly undesirable, "See @xref{...}", since an @xref should start
+# a sentence.  Explicitly prohibit any prefix of "see" or "also".
+# Also prohibit a prefix matching "\w+ +".
+# @pxref gets the same see/also treatment and should be parenthesized;
+# presume it must *not* start a sentence.
+# POSIX spells it "timestamp" rather than "time\s+stamp", so we do, too.
+bad_xref_re_ ?= (?:[\w,:;] +|(?:see|also)\s+)\@xref\{
+bad_pxref_re_ ?= (?:[.!?]|(?:see|also))\s+\@pxref\{
+prohibit_undesirable_word_seq_RE_ ?=                                   \
+  /(?:\bcan\s+not\b|\btime\s+stamps?\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims
+prohibit_undesirable_word_seq_ =                                       \
+    -e 'while ($(prohibit_undesirable_word_seq_RE_))'                  \
+    $(perl_filename_lineno_text_)
+# Define this to a regular expression that matches
+# any filename:dd:match lines you want to ignore.
+# The default is to ignore no matches.
+ignore_undesirable_word_sequence_RE_ ?= ^$$
+
+sc_prohibit_undesirable_word_seq:
+       @$(VC_LIST_EXCEPT)                                              \
+         | xargs perl -n -0777 $(prohibit_undesirable_word_seq_)       \
+         | $(GREP) -vE '$(ignore_undesirable_word_sequence_RE_)'       \
+         | $(GREP) .                                                   \
+         && { echo '$(ME): undesirable word sequence' >&2; exit 1; }   \
+         || :
+
+# Except for shell files and for loops, double semicolon is probably a mistake
+sc_prohibit_double_semicolon:
+       @prohibit='; *;[        {} \]*(/[/*]|$$)'                       \
+       in_vc_files='\.[chly]$$'                                        \
+       exclude='\bfor *\(.*\)'                                         \
+       halt="Double semicolon detected"                                \
+         $(_sc_search_regexp)
+
+_ptm1 = use "test C1 && test C2", not "test C1 -''a C2"
+_ptm2 = use "test C1 || test C2", not "test C1 -''o C2"
+# Using test's -a and -o operators is not portable.
+# We prefer test over [, since the latter is spelled [[ in configure.ac.
+sc_prohibit_test_minus_ao:
+       @prohibit='(\<test| \[+) .+ -[ao] '                             \
+       halt='$(_ptm1); $(_ptm2)'                                       \
+         $(_sc_search_regexp)
+
+# Avoid a test bashism.
+sc_prohibit_test_double_equal:
+       @prohibit='(\<test| \[+) .+ == '                                \
+       containing='#! */bin/[a-z]*sh'                                  \
+       halt='use "test x = x", not "test x =''= x"'                    \
+         $(_sc_search_regexp)
+
+# Each program that uses proper_name_utf8 must link with one of the
+# ICONV libraries.  Otherwise, some ICONV library must appear in LDADD.
+# The perl -0777 invocation below extracts the possibly-multi-line
+# definition of LDADD from the appropriate Makefile.am and exits 0
+# when it contains "ICONV".
+sc_proper_name_utf8_requires_ICONV:
+       @progs=$$($(VC_LIST_EXCEPT)                                     \
+                   | xargs $(GREP) -l 'proper_name_utf8 ''("');        \
+       if test "x$$progs" != x; then                                   \
+         fail=0;                                                       \
+         for p in $$progs; do                                          \
+           dir=$$(dirname "$$p");                                      \
+           perl -0777                                                  \
+             -ne 'exit !(/^LDADD =(.+?[^\\]\n)/ms && $$1 =~ /ICONV/)'  \
+             $$dir/Makefile.am && continue;                            \
+           base=$$(basename "$$p" .c);                                 \
+           $(GREP) "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null      \
+             || { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
+         done;                                                         \
+         test $$fail = 1 &&                                            \
+           { echo 1>&2 '$(ME): the above do not link with any ICONV library'; \
+             exit 1; } || :;                                           \
+       fi
+
+# Warn about "c0nst struct Foo const foo[]",
+# but not about "char const *const foo" or "#define const const".
+sc_redundant_const:
+       @prohibit='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b'          \
+       halt='redundant "const" in declarations'                        \
+         $(_sc_search_regexp)
+
+sc_const_long_option:
+       @prohibit='^ *static.*struct option '                           \
+       exclude='const struct option|struct option const'               \
+       halt='add "const" to the above declarations'                    \
+         $(_sc_search_regexp)
+
+NEWS_hash =                                                            \
+  $$($(SED) -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p'          \
+       $(srcdir)/NEWS                                                  \
+     | perl -0777 -pe                                                  \
+       's/^Copyright.+?Free\sSoftware\sFoundation,\sInc\.\n//ms'       \
+     | md5sum -                                                                \
+     | $(SED) 's/ .*//')
+
+# Ensure that we don't accidentally insert an entry into an old NEWS block.
+sc_immutable_NEWS:
+       @if test -f $(srcdir)/NEWS; then                                \
+         test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : ||              \
+           { echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
+       fi
+
+# Update the hash stored above.  Do this after each release and
+# for any corrections to old entries.
+update-NEWS-hash: NEWS
+       perl -pi -e 's/^(old_NEWS_hash[ \t]+:?=[ \t]+).*/$${1}'"$(NEWS_hash)/" \
+         $(srcdir)/cfg.mk
+
+# Ensure that we use only the standard $(VAR) notation,
+# not @...@ in Makefile.am, now that we can rely on automake
+# to emit a definition for each substituted variable.
+# However, there is still one case in which @VAR@ use is not just
+# legitimate, but actually required: when augmenting an automake-defined
+# variable with a prefix.  For example, gettext uses this:
+# MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@
+# otherwise, makeinfo would put German or French (current locale)
+# navigation hints in the otherwise-English documentation.
+#
+# Allow the package to add exceptions via a hook in cfg.mk;
+# for example, @PRAGMA_SYSTEM_HEADER@ can be permitted by
+# setting this to ' && !/PRAGMA_SYSTEM_HEADER/'.
+_makefile_at_at_check_exceptions ?=
+sc_makefile_at_at_check:
+       @perl -ne '/\@\w+\@/'                                           \
+          -e ' && !/(\w+)\s+=.*\@\1\@$$/'                              \
+          -e ''$(_makefile_at_at_check_exceptions)                     \
+         -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}'    \
+           $$($(VC_LIST_EXCEPT) | $(GREP) -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \
+         && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
+
+news-check: NEWS
+       $(AM_V_GEN)if $(SED) -n $(news-check-lines-spec)p $<            \
+           | $(GREP) -E $(news-check-regexp) >/dev/null; then          \
+         :;                                                            \
+       else                                                            \
+         echo 'NEWS: $$(news-check-regexp) failed to match' 1>&2;      \
+         exit 1;                                                       \
+       fi
+
+sc_makefile_TAB_only_indentation:
+       @prohibit='^    [ ]{8}'                                         \
+       in_vc_files='akefile|\.mk$$'                                    \
+       halt='found TAB-8-space indentation'                            \
+         $(_sc_search_regexp)
+
+sc_m4_quote_check:
+       @prohibit='(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]'              \
+       in_vc_files='(^configure\.ac|\.m4)$$'                           \
+       halt='quote the first arg to AC_DEF*'                           \
+         $(_sc_search_regexp)
+
+fix_po_file_diag = \
+'you have changed the set of files with translatable diagnostics;\n\
+apply the above patch\n'
+
+# Generate a list of files in which to search for translatable strings.
+perl_translatable_files_list_ =                                                \
+  -e 'foreach $$file (@ARGV) {'                                                \
+  -e ' \# Consider only file extensions with one or two letters'       \
+  -e ' $$file =~ /\...?$$/ or next;'                                   \
+  -e ' \# Ignore m4 and mk files'                                      \
+  -e ' $$file =~ /\.m[4k]$$/ and next;'                                \
+  -e ' \# Ignore a .c or .h file with a corresponding .l or .y file'   \
+  -e ' $$file =~ /(.+)\.[ch]$$/ && (-e "$${1}.l" || -e "$${1}.y")'     \
+  -e '   and next;'                                                    \
+  -e ' \# Skip unreadable files'                                       \
+  -e ' -r $$file or next;'                                             \
+  -e ' print "$$file ";'                                               \
+  -e '}'
+
+# Verify that all source files using _() (more specifically, files that
+# match $(_gl_translatable_string_re)) are listed in po/POTFILES.in.
+po_file ?= $(srcdir)/po/POTFILES.in
+generated_files ?= $(srcdir)/lib/*.[ch]
+_gl_translatable_string_re ?= \b(N?_|gettext *)\([^)"]*("|$$)
+sc_po_check:
+       @if test -f $(po_file); then                                    \
+         $(GREP) -E -v '^(#|$$)' $(po_file)                            \
+           | $(GREP) -v '^src/false\.c$$' | sort > $@-1;               \
+         { $(VC_LIST_EXCEPT); echo $(generated_files); }               \
+           | xargs perl $(perl_translatable_files_list_)               \
+           | xargs $(GREP) -E -l '$(_gl_translatable_string_re)'       \
+           | $(SED) 's|^$(_dot_escaped_srcdir)/||'                     \
+           | sort -u > $@-2;                                           \
+         diff -u -L $(po_file) -L $(po_file) $@-1 $@-2                 \
+           || { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; };   \
+         rm -f $@-1 $@-2;                                              \
+       fi
+
+# Sometimes it is useful to change the PATH environment variable
+# in Makefiles.  When doing so, it's better not to use the Unix-centric
+# path separator of ':', but rather the automake-provided '$(PATH_SEPARATOR)'.
+msg = 'Do not use ":" above; use $$(PATH_SEPARATOR) instead'
+sc_makefile_path_separator_check:
+       @prohibit='PATH[=].*:'                                          \
+       in_vc_files='akefile|\.mk$$'                                    \
+       halt=$(msg)                                                     \
+         $(_sc_search_regexp)
+
+sc_makefile_DISTCHECK_CONFIGURE_FLAGS:
+       @prohibit='^DISTCHECK_CONFIGURE_FLAGS'                          \
+       in_vc_files='akefile|\.mk$$'                                    \
+       halt="use AM_DISTCHECK_CONFIGURE_FLAGS"                         \
+         $(_sc_search_regexp)
+
+# Check that 'make alpha' will not fail at the end of the process,
+# i.e., when pkg-M.N.tar.xz already exists (either in "." or in ../release)
+# and is read-only.
+writable-files:
+       $(AM_V_GEN)if test -d $(release_archive_dir); then              \
+         for file in $(DIST_ARCHIVES); do                              \
+           for p in ./ $(release_archive_dir)/; do                     \
+             test -e $$p$$file || continue;                            \
+             test -w $$p$$file                                         \
+               || { echo ERROR: $$p$$file is not writable; fail=1; };  \
+           done;                                                       \
+         done;                                                         \
+         test "$$fail" && exit 1 || : ;                                \
+       else :;                                                         \
+       fi
+
+v_etc_file = $(gnulib_dir)/lib/version-etc.c
+sample-test = tests/sample-test
+texi = doc/$(PACKAGE).texi
+# Make sure that the copyright date in $(v_etc_file) is up to date.
+# Do the same for the $(sample-test) and the main doc/.texi file.
+sc_copyright_check:
+       @require='enum { COPYRIGHT_YEAR = '$$(date +%Y)' };'            \
+       in_files=$(v_etc_file)                                          \
+       halt='out of date copyright in $(v_etc_file); update it'        \
+         $(_sc_search_regexp)
+       @require='# Copyright \(C\) '$$(date +%Y)' Free'                \
+       in_vc_files=$(sample-test)                                      \
+       halt='out of date copyright in $(sample-test); update it'       \
+         $(_sc_search_regexp)
+       @require='Copyright @copyright\{} .*'$$(date +%Y)               \
+       in_vc_files=$(texi)                                             \
+       halt='out of date copyright in $(texi); update it'              \
+         $(_sc_search_regexp)
+
+# If tests/help-version exists and seems to be new enough, assume that its
+# use of init.sh and path_prepend_ is correct, and ensure that every other
+# use of init.sh is identical.
+# This is useful because help-version cross-checks prog --version
+# with $(VERSION), which verifies that its path_prepend_ invocation
+# sets PATH correctly.  This is an inexpensive way to ensure that
+# the other init.sh-using tests also get it right.
+_hv_file ?= $(srcdir)/tests/help-version
+_hv_regex_weak ?= ^ *\. .*/init\.sh"
+# Fix syntax-highlighters "
+_hv_regex_strong ?= ^ *\. "\$${srcdir=\.}/init\.sh"
+sc_cross_check_PATH_usage_in_tests:
+       @if test -f $(_hv_file); then                                   \
+         $(GREP) -l 'VERSION mismatch' $(_hv_file) >/dev/null          \
+           || { echo "$@: skipped: no such file: $(_hv_file)" 1>&2;    \
+                exit 0; };                                             \
+         $(GREP) -lE '$(_hv_regex_strong)' $(_hv_file) >/dev/null      \
+           || { echo "$@: $(_hv_file) lacks conforming use of init.sh" 1>&2; \
+                exit 1; };                                             \
+         good=$$($(GREP) -E '$(_hv_regex_strong)' $(_hv_file));        \
+         $(VC_LIST_EXCEPT)                                             \
+           | xargs $(GREP) -lE '$(_hv_regex_weak)'                     \
+           | xargs $(GREP) -LFx "$$good"                               \
+           | $(GREP) .                                                 \
+           && { printf "$(ME): the above files use"                    \
+                       " path_prepend_ inconsistently\n" 1>&2;         \
+                exit 1; }                                              \
+           || :;                                                       \
+       fi
+
+# BRE regex of file contents to identify a test script.
+_test_script_regex ?= \<init\.sh\>
+
+# In tests, use "compare expected actual", not the reverse.
+sc_prohibit_reversed_compare_failure:
+       @prohibit='\<compare [^ ]+ ([^ ]*exp|/dev/null)'                \
+       containing='$(_test_script_regex)'                              \
+       halt='reversed compare arguments'                               \
+         $(_sc_search_regexp)
+
+# #if HAVE_... will evaluate to false for any non numeric string.
+# That would be flagged by using -Wundef, however gnulib currently
+# tests many undefined macros, and so we can't enable that option.
+# So at least preclude common boolean strings as macro values.
+sc_Wundef_boolean:
+       @prohibit='^#define.*(yes|no|true|false)$$'                     \
+       in_files='$(CONFIG_INCLUDE)'                                    \
+       halt='Use 0 or 1 for macro values'                              \
+         $(_sc_search_regexp)
+
+# Even if you use pathmax.h to guarantee that PATH_MAX is defined, it might
+# not be constant, or might overflow a stack.  In general, use PATH_MAX as
+# a limit, not an array or alloca size.
+sc_prohibit_path_max_allocation:
+       @prohibit='(\balloca *\([^)]*|\[[^]]*)\bPATH_MAX'               \
+       halt='Avoid stack allocations of size PATH_MAX'                 \
+         $(_sc_search_regexp)
+
+sc_vulnerable_makefile_CVE-2009-4029:
+       @prohibit='perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \
+       in_files='(^|/)Makefile\.in$$'                                  \
+       halt=$$(printf '%s\n'                                           \
+         'the above files are vulnerable; beware of running'           \
+         '  "make dist*" rules, and upgrade to fixed automake'         \
+         '  see https://bugzilla.redhat.com/show_bug.cgi?id=542609 for details') \
+         $(_sc_search_regexp)
+
+sc_vulnerable_makefile_CVE-2012-3386:
+       @prohibit='chmod a\+w \$$\(distdir\)'                           \
+       in_files='(^|/)Makefile\.in$$'                                  \
+       halt=$$(printf '%s\n'                                           \
+         'the above files are vulnerable; beware of running'           \
+         '  "make distcheck", and upgrade to fixed automake'           \
+         '  see https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-3386 for details') \
+         $(_sc_search_regexp)
+
+sc_unportable_grep_q:
+       @prohibit='grep -q' halt="unportable 'grep -q', use >/dev/null instead" \
+         $(_sc_search_regexp)
+
+# The GNU Coding standards say that README should refer to both
+# INSTALL and the file that contains the copying conditions.  This
+# shall be COPYING for GPL and COPYING.LESSER for LGPL.
+
+sc_readme_link_install:
+       @require='INSTALL'                                      \
+       in_vc_files='^README$$'                                 \
+       halt='The README file should refer to INSTALL'          \
+         $(_sc_search_regexp)
+
+sc_readme_link_copying:
+       @require='COPYING'                                      \
+       in_vc_files='^README$$'                                 \
+       halt='The README file should refer to COPYING[.LESSER]' \
+         $(_sc_search_regexp)
+
+vc-diff-check:
+       $(AM_V_GEN)(unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :
+       $(AM_V_at)if test -s vc-diffs; then                     \
+         cat vc-diffs;                                         \
+         echo "Some files are locally modified:" 1>&2;         \
+         exit 1;                                               \
+       else                                                    \
+         rm vc-diffs;                                          \
+       fi
+
+rel-files = $(DIST_ARCHIVES)
+
+gnulib-version = $$(cd $(gnulib_dir)                           \
+                    && { git describe || git rev-parse --short=10 HEAD; } )
+bootstrap-tools ?= autoconf,automake,gnulib
+
+gpgv = $$(gpgv2 --version >/dev/null && echo gpgv2 || echo gpgv)
+# If it's not already specified, derive the GPG key ID from
+# the signed tag we've just applied to mark this release.
+gpg_key_ID ?=                                                          \
+  $$(cd $(srcdir)                                                      \
+     && git cat-file tag v$(VERSION)                                   \
+        | $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null    \
+        | $(AWK) '/^\[GNUPG:] ERRSIG / {print $$3; exit}')
+gpg_key_email ?=                                                       \
+  $$(gpg --list-key --with-colons $(gpg_key_ID) 2>/dev/null            \
+       | $(AWK) -F: '/^uid/ {print $$10; exit}'                        \
+       | $(SED) -n 's/.*<\(.*\)>/\1/p')
+gpg_keyring_url ?= https://savannah.gnu.org/project/release-gpgkeys.php?group=$(PACKAGE)&download=1
+
+translation_project_ ?= coordinator@translationproject.org
+
+# Make info-gnu the default only for a stable release.
+announcement_Cc_stable = $(translation_project_), $(PACKAGE_BUGREPORT)
+announcement_mail_headers_stable =             \
+  To: info-gnu@gnu.org                         \
+  Cc: $(announcement_Cc_)                      \
+  Mail-Followup-To: $(PACKAGE_BUGREPORT)
+
+announcement_Cc_alpha = $(translation_project_)
+announcement_mail_headers_alpha =              \
+  To: $(PACKAGE_BUGREPORT)                     \
+  Cc: $(announcement_Cc_)
+
+announcement_mail_Cc_beta = $(announcement_mail_Cc_alpha)
+announcement_mail_headers_beta = $(announcement_mail_headers_alpha)
+
+announcement_Cc_ ?= $(announcement_Cc_$(release-type))
+announcement_mail_headers_ ?= $(announcement_mail_headers_$(release-type))
+announcement: NEWS ChangeLog $(rel-files)
+# Not $(AM_V_GEN) since the output of this command serves as
+# announcement message: it would start with " GEN announcement".
+       $(AM_V_at)$(srcdir)/$(_build-aux)/announce-gen                  \
+           --mail-headers='$(announcement_mail_headers_)'              \
+           --release-type=$(release-type)                              \
+           --package=$(PACKAGE)                                        \
+           --prev=$(PREV_VERSION)                                      \
+           --curr=$(VERSION)                                           \
+           --gpg-key-id=$(gpg_key_ID)                                  \
+           $$(test -n "$(gpg_key_email)" &&                            \
+              echo --gpg-key-email="$(gpg_key_email)")                 \
+           $$(test -n "$(gpg_keyring_url)" &&                          \
+              echo --gpg-keyring-url="$(gpg_keyring_url)")             \
+           --srcdir=$(srcdir)                                          \
+           --news=$(srcdir)/NEWS                                       \
+           --bootstrap-tools=$(bootstrap-tools)                        \
+           $$(case ,$(bootstrap-tools), in (*,gnulib,*)                \
+              echo --gnulib-version=$(gnulib-version);; esac)          \
+           $(addprefix --url-dir=, $(url_dir_list))
+
+.PHONY: release-commit
+release-commit:
+       $(AM_V_GEN)cd $(srcdir)                         \
+         && $(_build-aux)/do-release-commit-and-tag    \
+              -C $(abs_builddir) $(RELEASE)
+
+## ---------------- ##
+## Updating files.  ##
+## ---------------- ##
+
+ftp-gnu = https://ftp.gnu.org/gnu
+www-gnu = https://www.gnu.org
+
+upload_dest_dir_ ?= $(PACKAGE)
+upload_command =                                               \
+  $(srcdir)/$(_build-aux)/gnupload $(GNUPLOADFLAGS)            \
+  --to $(gnu_rel_host):$(upload_dest_dir_)                     \
+  $(rel-files)
+emit_upload_commands:
+       @echo =====================================
+       @echo =====================================
+       @echo '$(upload_command)'
+       @echo '# send the ~/announce-$(my_distdir) e-mail'
+       @echo =====================================
+       @echo =====================================
+
+.PHONY: upload
+upload:
+       $(AM_V_GEN)$(upload_command)
+
+define emit-commit-log
+  printf '%s\n' 'maint: post-release administrivia' ''                 \
+    '* NEWS: Add header line for next release.'                                \
+    '* .prev-version: Record previous version.'                                \
+    '* cfg.mk (old_NEWS_hash): Auto-update.'
+endef
+
+.PHONY: no-submodule-changes
+no-submodule-changes:
+       $(AM_V_GEN)if test -d $(srcdir)/.git                            \
+               && git --version >/dev/null 2>&1; then                  \
+         diff=$$(cd $(srcdir) && git submodule -q foreach              \
+                 git diff-index --name-only HEAD)                      \
+           || exit 1;                                                  \
+         case $$diff in '') ;;                                         \
+           *) echo '$(ME): submodule files are locally modified:';     \
+               echo "$$diff"; exit 1;; esac;                           \
+       else                                                            \
+         : ;                                                           \
+       fi
+
+submodule-checks ?= no-submodule-changes public-submodule-commit
+
+# Ensure that each sub-module commit we're using is public.
+# Without this, it is too easy to tag and release code that
+# cannot be built from a fresh clone.
+.PHONY: public-submodule-commit
+public-submodule-commit:
+       $(AM_V_GEN)if test -d $(srcdir)/.git                            \
+               && git --version >/dev/null 2>&1; then                  \
+         cd $(srcdir) &&                                               \
+         git submodule --quiet foreach                                 \
+             'test "$$(git rev-parse "$$sha1")"                        \
+                 = "$$(git merge-base origin "$$sha1")"'               \
+           || { echo '$(ME): found non-public submodule commit' >&2;   \
+                exit 1; };                                             \
+       else                                                            \
+         : ;                                                           \
+       fi
+# This rule has a high enough utility/cost ratio that it should be a
+# dependent of "check" by default.  However, some of us do occasionally
+# commit a temporary change that deliberately points to a non-public
+# submodule commit, and want to be able to use rules like "make check".
+# In that case, run e.g., "make check gl_public_submodule_commit="
+# to disable this test.
+gl_public_submodule_commit ?= public-submodule-commit
+check: $(gl_public_submodule_commit)
+
+.PHONY: alpha beta stable release
+ALL_RECURSIVE_TARGETS += alpha beta stable
+alpha beta stable: $(local-check) writable-files $(submodule-checks)
+       $(AM_V_GEN)test $@ = stable                                     \
+         && { echo $(VERSION) | $(GREP) -E '^[0-9]+(\.[0-9]+)+$$'      \
+              || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
+         || :
+       $(AM_V_at)$(MAKE) vc-diff-check
+       $(AM_V_at)$(MAKE) news-check
+       $(AM_V_at)$(MAKE) distcheck
+       $(AM_V_at)$(MAKE) dist
+       $(AM_V_at)$(MAKE) $(release-prep-hook) RELEASE_TYPE=$@
+       $(AM_V_at)$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
+
+release:
+       $(AM_V_GEN)$(MAKE) _version
+       $(AM_V_at)$(MAKE) $(release-type)
+
+# Override this in cfg.mk if you follow different procedures.
+release-prep-hook ?= release-prep
+
+gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?]
+.PHONY: release-prep
+release-prep:
+       $(AM_V_GEN)$(MAKE) --no-print-directory -s announcement \
+         > ~/announce-$(my_distdir)
+       $(AM_V_at)if test -d $(release_archive_dir); then       \
+         ln $(rel-files) $(release_archive_dir);               \
+         chmod a-w $(rel-files);                               \
+       fi
+       $(AM_V_at)echo $(VERSION) > $(prev_version_file)
+       $(AM_V_at)$(MAKE) update-NEWS-hash
+       $(AM_V_at)perl -pi                                              \
+         -e '$$. == 3 and print "$(gl_noteworthy_news_)\n\n\n"'        \
+         $(srcdir)/NEWS
+       $(AM_V_at)msg=$$($(emit-commit-log)) || exit 1;         \
+       cd $(srcdir) && $(VC) commit -m "$$msg" -a
+
+# Override this with e.g., -s $(srcdir)/some_other_name.texi
+# if the default $(PACKAGE)-derived name doesn't apply.
+gendocs_options_ ?=
+
+.PHONY: web-manual
+web-manual:
+       $(AM_V_GEN)test -z "$(manual_title)" \
+         && { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
+       $(AM_V_at)cd '$(srcdir)/doc'; \
+         $(SHELL) ../$(_build-aux)/gendocs.sh $(gendocs_options_) \
+            -o '$(abs_builddir)/doc/manual' \
+            --email $(PACKAGE_BUGREPORT) $(PACKAGE) \
+           "$(PACKAGE_NAME) - $(manual_title)"
+       $(AM_V_at)echo " *** Upload the doc/manual directory to web-cvs."
+
+.PHONY: web-manual-update
+web-manual-update:
+       $(AM_V_GEN)cd $(srcdir) \
+         && $(_build-aux)/gnu-web-doc-update -C $(abs_builddir)
+
+
+# Code Coverage
+
+init-coverage:
+       $(MAKE) $(AM_MAKEFLAGS) clean
+       lcov --directory . --zerocounters
+
+COVERAGE_CCOPTS ?= "-g --coverage"
+COVERAGE_OUT ?= doc/coverage
+
+build-coverage:
+       $(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS)
+       $(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS) check
+       mkdir -p $(COVERAGE_OUT)
+       lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
+               --capture
+
+gen-coverage:
+       genhtml --output-directory $(COVERAGE_OUT) \
+               $(COVERAGE_OUT)/$(PACKAGE).info \
+               --highlight --frames --legend \
+               --title "$(PACKAGE_NAME)"
+
+coverage:
+       $(MAKE) init-coverage
+       $(MAKE) build-coverage
+       $(MAKE) gen-coverage
+
+# Some projects carry local adjustments for gnulib modules via patches in
+# a gnulib patch directory whose default name is gl/ (defined in bootstrap
+# via local_gl_dir=gl).  Those patches become stale as the originals evolve
+# in gnulib.  Use this rule to refresh any stale patches.  It applies each
+# patch to the original in $(gnulib_dir) and uses the temporary result to
+# generate a fuzz-free .diff file.  If you customize the name of your local
+# gnulib patch directory via bootstrap.conf, this rule detects that name.
+# Run this from a non-VPATH (i.e., srcdir) build directory.
+.PHONY: refresh-gnulib-patches
+refresh-gnulib-patches:
+       gl=gl;                                                          \
+       if test -f bootstrap.conf; then                                 \
+         t=$$(perl -lne '/^\s*local_gl_dir=(\S+)/ and $$d=$$1;'        \
+              -e 'END{defined $$d and print $$d}' bootstrap.conf);     \
+         test -n "$$t" && gl=$$t;                                      \
+       fi;                                                             \
+       for diff in $$(cd $$gl; git ls-files | $(GREP) '\.diff$$'); do  \
+         b=$$(printf %s "$$diff"|$(SED) 's/\.diff$$//');               \
+         VERSION_CONTROL=none                                          \
+           patch "$(gnulib_dir)/$$b" "$$gl/$$diff" || exit 1;          \
+         ( cd $(gnulib_dir) || exit 1;                                 \
+           git diff "$$b" > "../$$gl/$$diff";                          \
+           git checkout $$b ) || exit 1;                               \
+       done
+
+# Update gettext files.
+PACKAGE ?= $(shell basename $(PWD))
+PO_DOMAIN ?= $(PACKAGE)
+POURL = https://translationproject.org/latest/$(PO_DOMAIN)/
+PODIR ?= po
+refresh-po:
+       rm -f $(PODIR)/*.po && \
+       echo "$(ME): getting translations into po (please ignore the robots.txt ERROR 404)..." && \
+       wget --no-verbose --directory-prefix $(PODIR) --no-directories --recursive --level 1 --accept .po --accept .po.1 $(POURL) && \
+       echo 'en@boldquot' > $(PODIR)/LINGUAS && \
+       echo 'en@quot' >> $(PODIR)/LINGUAS && \
+       ls $(PODIR)/*.po | $(SED) 's/\.po//;s,$(PODIR)/,,' | \
+         sort >> $(PODIR)/LINGUAS
+
+# Indentation
+
+indent_args ?= -ppi 1
+C_SOURCES ?= $$($(VC_LIST_EXCEPT) | grep '\.[ch]\(.in\)\?$$')
+INDENT_SOURCES ?= $(C_SOURCES)
+exclude_file_name_regexp--indent ?= $(exclude_file_name_regexp--sc_indent)
+
+.PHONY: indent
+indent: # Running indent once is not idempotent, but running it twice is.
+       $(AM_V_GEN)indent $(indent_args) $(INDENT_SOURCES) && \
+       indent $(indent_args) $(INDENT_SOURCES)
+
+sc_indent:
+       @if ! indent --version 2> /dev/null | grep 'GNU indent' > /dev/null; then \
+           echo 1>&2 '$(ME): sc_indent: GNU indent is missing';        \
+       else                                                            \
+         fail=0; files="$(INDENT_SOURCES)";                            \
+         for f in $$files; do                                          \
+           indent $(indent_args) -st $$f                               \
+               | indent $(indent_args) -st -                           \
+               | diff -u $$f - || fail=1;                              \
+         done;                                                         \
+         test $$fail = 1 &&                                            \
+           { echo 1>&2 '$(ME): code format error, try "make indent"';  \
+             exit 1; } || :;                                           \
+       fi
+
+# If you want to set UPDATE_COPYRIGHT_* environment variables,
+# put the assignments in this variable.
+update-copyright-env ?=
+
+# Run this rule once per year (usually early in January)
+# to update all FSF copyright year lists in your project.
+# If you have an additional project-specific rule,
+# add it in cfg.mk along with a line 'update-copyright: prereq'.
+# By default, exclude all variants of COPYING; you can also
+# add exemptions (such as ChangeLog..* for rotated change logs)
+# in the file .x-update-copyright.
+.PHONY: update-copyright
+update-copyright:
+       $(AM_V_GEN)$(GREP) -l -w Copyright                               \
+         $$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \
+         | $(update-copyright-env) xargs $(srcdir)/$(_build-aux)/$@
+
+# This tight_scope test is skipped with a warning if $(_gl_TS_headers) is not
+# overridden and $(_gl_TS_dir)/Makefile.am does not mention noinst_HEADERS.
+
+# NOTE: to override any _gl_TS_* default value, you must
+# define the variable(s) using "export" in cfg.mk.
+_gl_TS_dir ?= src
+
+ALL_RECURSIVE_TARGETS += sc_tight_scope
+sc_tight_scope: tight-scope.mk
+       @fail=0;                                                        \
+       if ! $(GREP) '^ *export _gl_TS_headers *=' $(srcdir)/cfg.mk     \
+               > /dev/null                                             \
+          && ! $(GREP) -w noinst_HEADERS $(srcdir)/$(_gl_TS_dir)/Makefile.am \
+               > /dev/null 2>&1; then                                  \
+           echo '$(ME): skipping $@';                                  \
+       else                                                            \
+           $(MAKE) -s -C $(_gl_TS_dir)                                 \
+               -f Makefile                                             \
+               -f $(abs_top_srcdir)/cfg.mk                             \
+               -f $(abs_top_builddir)/$<                               \
+             _gl_tight_scope                                           \
+               || fail=1;                                              \
+       fi;                                                             \
+       rm -f $<;                                                       \
+       exit $$fail
+
+tight-scope.mk: $(ME)
+       @perl -ne '/^# TS-start/.../^# TS-end/ and print' $(srcdir)/$(ME) > $@-t
+       @mv $@-t $@
+
+ifeq (a,b)
+# TS-start
+
+# Most functions should have static scope.
+# Any that don't must be marked with 'extern', but 'main'
+# and 'usage' are exceptions: they're always extern, but
+# do not need to be marked.  Symbols matching '__.*' are
+# reserved by the compiler, so are automatically excluded below.
+_gl_TS_unmarked_extern_functions ?= main usage
+_gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\w+) *\(/
+
+# If your project uses a macro like "XTERN", then put
+# the following in cfg.mk to override this default:
+# export _gl_TS_extern = extern|XTERN
+_gl_TS_extern ?= extern
+
+# The second nm|grep checks for file-scope variables with 'extern' scope.
+# Without gnulib's progname module, you might put program_name here.
+# Symbols matching '__.*' are reserved by the compiler,
+# so are automatically excluded below.
+_gl_TS_unmarked_extern_vars ?=
+
+# NOTE: the _match variables are perl expressions -- not mere regular
+# expressions -- so that you can extend them to match other patterns
+# and easily extract matched variable names.
+# For example, if your project declares some global variables via
+# a macro like this: GLOBAL(type, var_name, initializer), then you
+# can override this definition to automatically extract those names:
+# export _gl_TS_var_match = \
+#   /^(?:$(_gl_TS_extern)) .*?\**(\w+)(\[.*?])?;/ || /\bGLOBAL\(.*?,\s*(.*?),/
+_gl_TS_var_match ?= /^(?:$(_gl_TS_extern)) .*?(\w+)(\[.*?])?;/
+
+# The names of object files in (or relative to) $(_gl_TS_dir).
+_gl_TS_obj_files ?= *.$(OBJEXT)
+
+# Files in which to search for the one-line style extern declarations.
+# $(_gl_TS_dir)-relative.
+_gl_TS_headers ?= $(noinst_HEADERS)
+_gl_TS_other_headers ?= *.h
+
+.PHONY: _gl_tight_scope
+_gl_tight_scope: $(bin_PROGRAMS)
+       sed_wrap='s/^/^_?/;s/$$/$$/';                                   \
+       t=exceptions-$$$$;                                              \
+       trap 's=$$?; rm -f $$t; exit $$s' 0;                            \
+       for sig in 1 2 3 13 15; do                                      \
+         eval "trap 'v=`expr $$sig + 128`; (exit $$v); exit $$v' $$sig"; \
+       done;                                                           \
+       src=`for f in $(SOURCES); do                                    \
+              test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`;   \
+       hdr=`for f in $(_gl_TS_headers); do                             \
+              test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`;   \
+       ( printf '%s\n' '__.*' $(_gl_TS_unmarked_extern_functions);     \
+         $(GREP) -h -A1 '^extern .*[^;]$$' $$src                       \
+           | $(GREP) -vE '^(extern |--|#)' | $(SED) 's/ .*//; /^$$/d'; \
+         perl -lne                                                     \
+            '$(_gl_TS_function_match) and print $$1' $$hdr;            \
+       ) | sort -u | $(SED) "$$sed_wrap" > $$t;                        \
+       nm -g $(_gl_TS_obj_files)|$(SED) -n 's/.* T //p'|$(GREP) -Ev -f $$t \
+         && { echo the above functions should have static scope >&2;   \
+              exit 1; } || : ;                                         \
+       ( printf '%s\n' '__.*' main $(_gl_TS_unmarked_extern_vars);     \
+         perl -lne '$(_gl_TS_var_match) and print $$1'                 \
+               $$hdr $(_gl_TS_other_headers)                           \
+       ) | sort -u | $(SED) "$$sed_wrap" > $$t;                        \
+       nm -g $(_gl_TS_obj_files) | $(SED) -n 's/.* [BCDGRS] //p'       \
+            | sort -u | $(GREP) -Ev -f $$t                             \
+         && { echo the above variables should have static scope >&2;   \
+              exit 1; } || :
+# TS-end
+endif
index 5e478e7e5e1735a3dcb163015d10cb32549bf4e6..23c1bc031da18609a491b8e860b9949c364ea293 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 . ../init.sh
-do_import_test coreutils-20240101 . "--tests-base=gnulib-tests --with-tests --symlink --makefile-name=gnulib.mk --automake-subdir --import `echo '
+do_import_test coreutils-20240101 . "--tests-base=gnulib-tests --with-tests --makefile-name=gnulib.mk --automake-subdir --import `echo '
   --avoid=canonicalize-lgpl
   --avoid=dummy
   --avoid=mbuiter